JSPM

relay-runtime

0.0.0-main-79f0355e
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3916853
  • Score
    100M100P100Q201253F
  • License MIT

A core runtime for building GraphQL-driven applications.

Package Exports

  • relay-runtime
  • relay-runtime/experimental
  • relay-runtime/experimental.js
  • relay-runtime/index.js
  • relay-runtime/lib
  • relay-runtime/lib/index.js
  • relay-runtime/lib/multi-actor-environment/ActorIdentifier
  • relay-runtime/lib/multi-actor-environment/ActorIdentifier.js
  • relay-runtime/lib/network/RelayObservable
  • relay-runtime/lib/network/RelayObservable.js
  • relay-runtime/lib/query/fetchQueryInternal
  • relay-runtime/lib/query/fetchQueryInternal.js
  • relay-runtime/lib/store/DataChecker
  • relay-runtime/lib/store/DataChecker.js
  • relay-runtime/lib/store/RelayModernRecord
  • relay-runtime/lib/store/RelayModernRecord.js
  • relay-runtime/lib/store/RelayModernStore
  • relay-runtime/lib/store/RelayModernStore.js
  • relay-runtime/lib/store/RelayPublishQueue
  • relay-runtime/lib/store/RelayPublishQueue.js
  • relay-runtime/lib/store/RelayRecordSource
  • relay-runtime/lib/store/RelayRecordSource.js
  • relay-runtime/lib/store/RelayRecordState
  • relay-runtime/lib/store/RelayRecordState.js
  • relay-runtime/lib/store/RelayReferenceMarker
  • relay-runtime/lib/store/RelayReferenceMarker.js
  • relay-runtime/lib/store/RelayResponseNormalizer
  • relay-runtime/lib/store/RelayResponseNormalizer.js
  • relay-runtime/lib/store/RelayStoreUtils
  • relay-runtime/lib/store/RelayStoreUtils.js
  • relay-runtime/lib/store/ResolverFragments
  • relay-runtime/lib/store/ResolverFragments.js
  • relay-runtime/lib/store/live-resolvers/LiveResolverStore
  • relay-runtime/lib/store/live-resolvers/LiveResolverStore.js
  • relay-runtime/lib/util/RelayReplaySubject
  • relay-runtime/lib/util/RelayReplaySubject.js
  • relay-runtime/lib/util/getRequestIdentifier
  • relay-runtime/lib/util/getRequestIdentifier.js
  • relay-runtime/lib/util/resolveImmediate
  • relay-runtime/lib/util/resolveImmediate.js
  • relay-runtime/lib/util/stableCopy
  • relay-runtime/lib/util/stableCopy.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (relay-runtime) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Relay Runtime

A set of Relay APIs responsible for data fetching, reading and normalization of the GraphQL data.

Example:

// @flow strict-local

import type {FetchFunction} from 'relay-runtime';

const {
  Environment,
  Network,
  Observable,
  RecordSource,
  Store,
  fetchQuery,
  graphql,
} = require('relay-runtime');

const fetchFn: FetchFunction = function (request, variables) {
  return new Observable.create(source => {
    fetch('/my-graphql-api', {
      method: 'POST',
      body: JSON.stringify({
        text: request.text,
        variables,
      }),
    })
      .then(response => response.json())
      .then(data => source.next(data));
  });
};

const network = Network.create(fetchFn);
const store = new Store(new RecordSource());
const environment = new Environment({
  network,
  store,
});

fetchQuery(
  environment,
  graphql`
    query AppQuery($id: ID!) {
      user(id: $id) {
        name
      }
    }
  `,
  {id: 'my-node-id'},
).subscribe({
  error: error => {
    console.error(error);
  },
  next: data => {
    console.log(data);
  },
});

For complete API reference, visit https://relay.dev/.