UNPKG

@apollo/client-react-streaming

Version:

This package provides building blocks to create framework-level integration of Apollo Client with React's streaming SSR. See the [@apollo/client-integration-nextjs](https://github.com/apollographql/apollo-client-integrations/tree/main/packages/nextjs) pac

1 lines 71.4 kB
{"version":3,"sources":["../src/AccumulateMultipartResponsesLink.ts","../src/RemoveMultipartDirectivesLink.ts","../src/SSRMultipartLink.ts","../src/DataTransportAbstraction/WrappedInMemoryCache.tsx","../src/bundleInfo.ts","../src/DataTransportAbstraction/WrappedApolloClient.tsx","../src/DataTransportAbstraction/backpressuredCallback.ts","../src/DataTransportAbstraction/useTransportValue.tsx","../src/DataTransportAbstraction/DataTransportAbstraction.ts","../src/transportedQueryRef.ts","../src/ReadableStreamLink.tsx","../src/DataTransportAbstraction/transportedOptions.ts","../src/DataTransportAbstraction/hooks.ts","../src/assertInstance.ts","../src/DataTransportAbstraction/symbols.ts","../src/DataTransportAbstraction/testHelpers.ts","../src/DataTransportAbstraction/WrapApolloProvider.tsx"],"names":["ApolloLink","Observable","invariant","reader","WrappedApolloProvider","ApolloClientSingleton"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAmCvB,IAAM,mCAAN,cAA+C,WAAW;AAAA,EACvD;AAAA,EAER,YAAY,QAA4C;AACtD,UAAM;AACN,SAAK,WAAW,OAAO;AAAA,EACzB;AAAA,EACA,QACE,WACA,SACA;AACA,QAAI,CAAC,SAAS;AACZ,YAAM,IAAI,MAAM,8BAA8B;AAAA,IAChD;AAEA,UAAM,uCAAuC;AAAA,MAC3C,CAAC,OAAO;AAAA,MACR,UAAU;AAAA,IACZ;AAEA,UAAM,WAAW,QAAQ,SAAS;AAClC,QAAI,CAAC;AAAsC,aAAO;AAGlD,UAAM,WAAW,KAAK;AACtB,QAAI,iBAAoC;AACxC,UAAM,qBACJ,UAAU,OAAO,cAAc,EAC/B;AACF,QAAI;AAKJ,WAAO,IAAI,WAA8B,CAAC,eAAe;AACvD,YAAM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vB,SAAS,sBAAsB;AA+CxB,SAAS,mBACd,mBACmC;AACnC,QAAMG,yBAA2D,CAAC;AAAA,IAChE;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,MAAM;AACJ,UAAM,YAAY,OAAqB,MAAS;AAChD,QAAI,CAAC,UAAU,SAAS;AACtB,UAAI,MAAiC;AACnC,kBAAU,UAAU,WAAW;AAAA,MACjC,OAAO;AACL,kBAAU,UAAU,OAAOC,sBAAqB,MAAM,WAAW;AAAA,MACnE;AACA;AAAA,QACE,UAAU;AAAA,QACVD,uBAAsB;AAAA,QACtB;AAAA,MACF;AAAA,IACF;AAEA,WACE,oCAAC,kBAAe,QAAQ,UAAU,WAChC;AAAA,MAAC;AAAA;AAAA,QACC,cAAc,CAAC,UACb,MAAM,SAAS,YACX,UAAU,QAAS,eAAgB,KAAK,IACxC,UAAU,QAAS,gBAAiB,KAAK;AAAA,QAE/C,uBAAuB,UAAU,QAAQ;AAAA,QACzC,gCACE,UAAU,QAAQ,iBAAiB;AAAA,QAEpC,GAAI;AAAA;AAAA,MAEJ;AAAA,IACH,CACF;AAAA,EAEJ;AACA,EAAAA,uBAAsB,OAAO;AAC7B,SAAOA;AACT","sourcesContent":["import { ApolloLink } from \"@apollo/client\";\nimport { Observable } from \"@apollo/client/utilities\";\nimport { hasDirectives } from \"@apollo/client/utilities/internal\";\nimport type { InternalTypes } from \"@apollo/client\";\nimport type { Incremental } from \"@apollo/client/incremental\";\n\ninterface AccumulateMultipartResponsesConfig {\n /**\n * The maximum delay in milliseconds\n * from receiving the first response\n * until the accumulated data will be flushed\n * and the connection will be closed.\n */\n cutoffDelay: number;\n}\n\n/**\n *\n * This link can be used to \"debounce\" the initial response of a multipart request. Any incremental data received during the `cutoffDelay` time will be merged into the initial response.\n *\n * After `cutoffDelay`, the link will return the initial response, even if there is still incremental data pending, and close the network connection.\n *\n * If `cutoffDelay` is `0`, the link will immediately return data as soon as it is received, without waiting for incremental data, and immediately close the network connection.\n *\n * @example\n * ```ts\n * new AccumulateMultipartResponsesLink({\n * // The maximum delay in milliseconds\n * // from receiving the first response\n * // until the accumulated data will be flushed\n * // and the connection will be closed.\n * cutoffDelay: 100,\n * });\n * ```\n *\n * @public\n */\nexport class AccumulateMultipartResponsesLink extends ApolloLink {\n private maxDelay: number;\n\n constructor(config: AccumulateMultipartResponsesConfig) {\n super();\n this.maxDelay = config.cutoffDelay;\n }\n request(\n operation: ApolloLink.Operation,\n forward?: ApolloLink.ForwardFunction\n ) {\n if (!forward) {\n throw new Error(\"This is not a terminal link!\");\n }\n\n const operationContainsMultipartDirectives = hasDirectives(\n [\"defer\"],\n operation.query\n );\n\n const upstream = forward(operation);\n if (!operationContainsMultipartDirectives) return upstream;\n\n // TODO: this could be overwritten with a `@AccumulateMultipartResponsesConfig(maxDelay: 1000)` directive on the operation\n const maxDelay = this.maxDelay;\n let accumulatedData: ApolloLink.Result, maxDelayTimeout: NodeJS.Timeout;\n const incrementalHandler = (\n operation.client[\"queryManager\"] as InternalTypes.QueryManager\n ).incrementalHandler;\n let incremental: Incremental.IncrementalRequest<\n Record<string, unknown>,\n Record<string, unknown>\n >;\n\n return new Observable<ApolloLink.Result>((subscriber) => {\n const upstreamSubscription = upstream.subscribe({\n next: (result) => {\n if (incrementalHandler.isIncrementalResult(result)) {\n incremental ||= incrementalHandler.startRequest({\n query: operation.query,\n });\n accumulatedData = incremental.handle(accumulatedData.data, result);\n } else {\n accumulatedData = result;\n }\n if (!maxDelay) {\n flushAccumulatedData();\n } else if (!maxDelayTimeout) {\n maxDelayTimeout = setTimeout(flushAccumulatedData, maxDelay);\n }\n },\n error: (error) => {\n if (maxDelayTimeout) clearTimeout(maxDelayTimeout);\n subscriber.error(error);\n },\n complete: () => {\n if (maxDelayTimeout) {\n clearTimeout(maxDelayTimeout);\n flushAccumulatedData();\n }\n subscriber.complete();\n },\n });\n\n function flushAccumulatedData() {\n subscriber.next(accumulatedData);\n subscriber.complete();\n upstreamSubscription.unsubscribe();\n }\n\n return function cleanUp() {\n clearTimeout(maxDelayTimeout);\n upstreamSubscription.unsubscribe();\n };\n });\n }\n}\n","import type { DocumentNode } from \"@apollo/client\";\nimport { ApolloLink } from \"@apollo/client\";\nimport { removeDirectivesFromDocument } from \"@apollo/client/utilities/internal\";\nimport type { DirectiveNode } from \"graphql\";\nimport { of } from \"rxjs\";\n\ninterface RemoveMultipartDirectivesConfig {\n /**\n * Whether to strip fragments with `@defer` directives\n * from queries before sending them to the server.\n *\n * Defaults to `true`.\n *\n * Can be overwritten by adding a label starting\n * with either `\"SsrDontStrip\"` or `\"SsrStrip\"` to the\n * directive.\n */\n stripDefer?: boolean;\n}\n\nfunction getDirectiveArgumentValue(directive: DirectiveNode, argument: string) {\n return directive.arguments?.find((arg: any) => arg.name.value === argument)\n ?.value;\n}\n/**\n * This link will (if called with `stripDefer: true`) strip all `@defer` fragments from your query.\n *\n * This is used to prevent the server from doing additional work in SSR scenarios where multipart responses cannot be handled anyways.\n *\n * You can exclude certain fragments from this behavior by giving them a label starting with `\"SsrDontStrip\"`.\n * The \"starting with\" is important, because labels have to be unique per operation. So if you have multiple directives where you want to override the default stipping behaviour,\n * you can do this by annotating them like\n * ```graphql\n * query myQuery {\n * fastField\n * ... @defer(label: \"SsrDontStrip1\") {\n * slowField1\n * }\n * ... @defer(label: \"SsrDontStrip2\") {\n * slowField2\n * }\n * }\n * ```\n *\n * You can also use the link with `stripDefer: false` and mark certain fragments to be stripped by giving them a label starting with `\"SsrStrip\"`.\n *\n * @example\n * ```ts\n * new RemoveMultipartDirectivesLink({\n * // Whether to strip fragments with `@defer` directives\n * // from queries before sending them to the server.\n * //\n * // Defaults to `true`.\n * //\n * // Can be overwritten by adding a label starting\n * // with either `\"SsrDontStrip\"` or `\"SsrStrip\"` to the\n * // directive.\n * stripDefer: true,\n * });\n * ```\n *\n * @public\n */\nexport class RemoveMultipartDirectivesLink extends ApolloLink {\n private stripDirectives: string[] = [];\n constructor(config: RemoveMultipartDirectivesConfig) {\n super();\n\n if (config.stripDefer !== false) this.stripDirectives.push(\"defer\");\n }\n\n request(\n operation: ApolloLink.Operation,\n forward?: ApolloLink.ForwardFunction\n ) {\n if (!forward) {\n throw new Error(\"This is not a terminal link!\");\n }\n const { query } = operation;\n\n let modifiedQuery: DocumentNode | null = query;\n modifiedQuery = removeDirectivesFromDocument(\n this.stripDirectives\n .map<Parameters<typeof removeDirectivesFromDocument>[0][0]>(\n (directive) => ({\n test(node) {\n let shouldStrip =\n node.kind === \"Directive\" && node.name.value === directive;\n const label = getDirectiveArgumentValue(node, \"label\");\n if (\n label?.kind === \"StringValue\" &&\n label.value.startsWith(\"SsrDontStrip\")\n ) {\n shouldStrip = false;\n }\n return shouldStrip;\n },\n remove: true,\n })\n )\n .concat({\n test(node) {\n if (node.kind !== \"Directive\") return false;\n const label = getDirectiveArgumentValue(node, \"label\");\n return (\n label?.kind === \"StringValue\" &&\n label.value.startsWith(\"SsrStrip\")\n );\n },\n remove: true,\n }),\n modifiedQuery\n );\n\n if (modifiedQuery === null) {\n return of({});\n }\n\n operation.query = modifiedQuery;\n\n return forward(operation);\n }\n}\n","import { ApolloLink } from \"@apollo/client\";\nimport { RemoveMultipartDirectivesLink } from \"./RemoveMultipartDirectivesLink.js\";\nimport { AccumulateMultipartResponsesLink } from \"./AccumulateMultipartResponsesLink.js\";\n\ninterface SSRMultipartLinkConfig {\n /**\n * Whether to strip fragments with `@defer` directives\n * from queries before sending them to the server.\n *\n * Defaults to `true`.\n *\n * Can be overwritten by adding a label starting\n * with either `\"SsrDontStrip\"` or `\"SsrStrip\"` to the\n * directive.\n */\n stripDefer?: boolean;\n /**\n * The maximum delay in milliseconds\n * from receiving the first response\n * until the accumulated data will be flushed\n * and the connection will be closed.\n *\n * Defaults to `0`.\n */\n cutoffDelay?: number;\n}\n\n/**\n * A convenient combination of `RemoveMultipartDirectivesLink` and `AccumulateMultipartResponsesLink`.\n *\n * @example\n * ```ts\n * new SSRMultipartLink({\n * // Whether to strip fragments with `@defer` directives\n * // from queries before sending them to the server.\n * //\n * // Defaults to `true`.\n * //\n * // Can be overwritten by adding a label starting\n * // with either `\"SsrDontStrip\"` or `\"SsrStrip\"` to the\n * // directive.\n * stripDefer: true,\n * // The maximum delay in milliseconds\n * // from receiving the first response\n * // until the accumulated data will be flushed\n * // and the connection will be closed.\n * //\n * // Defaults to `0`.\n * //\n * cutoffDelay: 100,\n * });\n * ```\n *\n * @public\n */\nexport class SSRMultipartLink extends ApolloLink {\n constructor(config: SSRMultipartLinkConfig = {}) {\n const combined = ApolloLink.from([\n new RemoveMultipartDirectivesLink({\n stripDefer: config.stripDefer,\n }),\n new AccumulateMultipartResponsesLink({\n cutoffDelay: config.cutoffDelay || 0,\n }),\n ]);\n super(combined.request);\n }\n}\n","import type { InMemoryCacheConfig } from \"@apollo/client\";\nimport { InMemoryCache as OrigInMemoryCache } from \"@apollo/client\";\nimport { bundle, sourceSymbol } from \"../bundleInfo.js\";\n/*\n * We just subclass `InMemoryCache` here so that `WrappedApolloClient`\n * can detect if it was initialized with an `InMemoryCache` instance that\n * was also exported from this package.\n * Right now, we don't have extra logic here, but we might have so again\n * in the future.\n * So we want to enforce this import path from the start to prevent future\n * subtle bugs if people update the package and don't read the patch notes.\n */\n/**\n * A version of `InMemoryCache` to be used with streaming SSR.\n *\n * For more documentation, please see {@link https://www.apollographql.com/docs/react/api/cache/InMemoryCache | the Apollo Client API documentation}.\n *\n * @public\n */\nexport class InMemoryCache extends OrigInMemoryCache {\n /**\n * Information about the current package and it's export names, for use in error messages.\n *\n * @internal\n */\n static readonly info = bundle;\n [sourceSymbol]: string;\n constructor(config?: InMemoryCacheConfig | undefined) {\n super(config);\n const info = (this.constructor as typeof InMemoryCache).info;\n this[sourceSymbol] = `${info.pkg}:InMemoryCache`;\n }\n}\n","export const bundle = {\n pkg: \"@apollo/client-react-streaming\",\n};\n\nexport const sourceSymbol = Symbol.for(\"apollo.source_package\");\n","import type { OperationVariables } from \"@apollo/client\";\n\nimport {\n ApolloLink,\n ApolloClient as OrigApolloClient,\n Observable,\n type InternalTypes,\n} from \"@apollo/client\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\nimport { createBackpressuredCallback } from \"./backpressuredCallback.js\";\nimport type { InMemoryCache } from \"./WrappedInMemoryCache.js\";\nimport { hookWrappers } from \"./hooks.js\";\nimport type { HookWrappers } from \"@apollo/client/react/internal\";\nimport type {\n ProgressEvent,\n QueryEvent,\n TransportIdentifier,\n} from \"./DataTransportAbstraction.js\";\nimport { bundle, sourceSymbol } from \"../bundleInfo.js\";\nimport { serializeOptions, deserializeOptions } from \"./transportedOptions.js\";\nimport { assertInstance } from \"../assertInstance.js\";\nimport type { ReadableStreamLinkEvent } from \"../ReadableStreamLink.js\";\nimport {\n readFromReadableStream,\n ReadFromReadableStreamLink,\n teeToReadableStream,\n TeeToReadableStreamLink,\n} from \"../ReadableStreamLink.js\";\nimport { getInjectableEventStream } from \"../transportedQueryRef.js\";\n\nfunction getQueryManager(\n client: OrigApolloClient\n): InternalTypes.QueryManager & {\n [wrappers]: HookWrappers;\n} {\n return client[\"queryManager\"];\n}\n\ntype SimulatedQueryInfo = {\n controller: ReadableStreamDefaultController<ReadableStreamLinkEvent>;\n options: OrigApolloClient.WatchQueryOptions<any, OperationVariables>;\n};\n/** @public */\nexport declare namespace ApolloClient {\n /** @public */\n export interface Options\n extends Omit<\n OrigApolloClient.Options,\n \"cache\" | \"ssrMode\" | \"ssrForceFetchDelay\"\n > {\n cache: InMemoryCache;\n }\n /*\n We can currently not re-export these types from the upstream ApolloClient implementation because the build \n tooling doesn't support that:\n > DTS Build error\n > Error: namespace child (hoisting) not supported yet\n\n We could re-export them by defining them as new types that reference the originals, but that would require us\n to keep generics in sync and would either erase the docblocks or require us to duplicate them \n (and they would go out of sync).\n If you need any of the other types, please use the `ApolloClient` namespace exported from `@apollo/client` directly.\n */\n // export import DefaultOptions = OrigApolloClient.DefaultOptions;\n // export import DevtoolsOptions = OrigApolloClient.DevtoolsOptions;\n // export import MutateOptions = OrigApolloClient.MutateOptions;\n // export import MutateResult = OrigApolloClient.MutateResult;\n // export import QueryOptions = OrigApolloClient.QueryOptions;\n // export import QueryResult = OrigApolloClient.QueryResult;\n // export import RefetchQueriesOptions = OrigApolloClient.RefetchQueriesOptions;\n // export import RefetchQueriesResult = OrigApolloClient.RefetchQueriesResult;\n // export import SubscribeOptions = OrigApolloClient.SubscribeOptions;\n // export import SubscribeResult = OrigApolloClient.SubscribeResult;\n // export import WatchFragmentOptions = OrigApolloClient.WatchFragmentOptions;\n // export import WatchFragmentResult = OrigApolloClient.WatchFragmentResult;\n // export import WatchQueryOptions = OrigApolloClient.WatchQueryOptions;\n // export import ReadQueryOptions = OrigApolloClient.ReadQueryOptions;\n // export import WriteQueryOptions = OrigApolloClient.WriteQueryOptions;\n // export import WriteFragmentOptions = OrigApolloClient.WriteFragmentOptions;\n}\n\nconst wrappers = Symbol.for(\"apollo.hook.wrappers\");\nclass ApolloClientBase extends OrigApolloClient {\n /**\n * Information about the current package and it's export names, for use in error messages.\n *\n * @internal\n */\n static readonly info = bundle;\n\n [sourceSymbol]: string;\n\n constructor(options: ApolloClient.Options) {\n const warnings: string[] = [];\n if (\"ssrMode\" in options) {\n delete options.ssrMode;\n warnings.push(\n \"The `ssrMode` option is not supported in %s. Please remove it from your %s constructor options.\"\n );\n }\n if (\"ssrForceFetchDelay\" in options) {\n delete options.ssrForceFetchDelay;\n warnings.push(\n \"The `ssrForceFetchDelay` option is not supported in %s. Please remove it from your %s constructor options.\"\n );\n }\n super(\n process.env.REACT_ENV === \"rsc\" || process.env.REACT_ENV === \"ssr\"\n ? {\n devtools: { enabled: false, ...options.devtools },\n ...options,\n }\n : options\n );\n const info = (this.constructor as typeof ApolloClientBase).info;\n this[sourceSymbol] = `${info.pkg}:ApolloClient`;\n\n for (const warning of warnings) {\n console.warn(warning, info.pkg, \"ApolloClient\");\n }\n\n assertInstance(\n this.cache as unknown as InMemoryCache,\n info,\n \"InMemoryCache\"\n );\n\n this.setLink(this.link);\n }\n\n setLink(newLink: ApolloLink) {\n super.setLink.call(\n this,\n ApolloLink.from([\n new ReadFromReadableStreamLink(),\n new TeeToReadableStreamLink(),\n newLink,\n ])\n );\n }\n}\n\nclass ApolloClientClientBaseImpl extends ApolloClientBase {\n constructor(options: ApolloClient.Options) {\n super(options);\n this.onQueryStarted = this.onQueryStarted.bind(this);\n\n getQueryManager(this)[wrappers] = hookWrappers;\n }\n\n private simulatedStreamingQueries = new Map<\n TransportIdentifier,\n SimulatedQueryInfo\n >();\n\n onQueryStarted({ options, id }: Extract<QueryEvent, { type: \"started\" }>) {\n const hydratedOptions = deserializeOptions(options);\n\n const [controller, stream] = getInjectableEventStream();\n\n const queryManager = getQueryManager(this);\n queryManager.fetchQuery({\n ...hydratedOptions,\n query: queryManager.transform(hydratedOptions.query),\n fetchPolicy: \"network-only\",\n context: skipDataTransport(\n readFromReadableStream(stream, {\n ...hydratedOptions.context,\n queryDeduplication: true,\n })\n ),\n });\n\n this.simulatedStreamingQueries.set(id, {\n controller,\n options: hydratedOptions,\n });\n }\n\n onQueryProgress = (event: ProgressEvent) => {\n const queryInfo = this.simulatedStreamingQueries.get(event.id);\n if (!queryInfo) return;\n\n if (\n event.type === \"error\" ||\n (event.type === \"next\" && event.value.errors)\n ) {\n /**\n * At this point we're not able to correctly serialize the error over the wire\n * so we do the next-best thing: restart the query in the browser as soon as it\n * failed on the server.\n * This matches up with what React will be doing (abort hydration and rerender)\n * See https://github.com/apollographql/apollo-client-integrations/issues/52\n */\n this.simulatedStreamingQueries.delete(event.id);\n if (process.env.REACT_ENV === \"browser\") {\n invariant.debug(\n \"Query failed on server, rerunning in browser:\",\n queryInfo.options\n );\n this.rerunSimulatedQuery(queryInfo);\n } else if (process.env.REACT_ENV === \"ssr\") {\n invariant.debug(\n \"Query failed upstream, will fail it during SSR and rerun it in the browser:\",\n queryInfo.options\n );\n queryInfo.controller.error(new Error(\"Query failed upstream.\"));\n }\n } else if (event.type === \"completed\") {\n this.simulatedStreamingQueries.delete(event.id);\n queryInfo.controller.enqueue(event);\n } else if (event.type === \"next\") {\n queryInfo.controller.enqueue(event);\n }\n };\n\n /**\n * Can be called when the stream closed unexpectedly while there might still be unresolved\n * simulated server-side queries going on.\n * Those queries will be cancelled and then re-run in the browser.\n */\n rerunSimulatedQueries = () => {\n for (const [id, queryInfo] of this.simulatedStreamingQueries) {\n this.simulatedStreamingQueries.delete(id);\n invariant.debug(\n \"streaming connection closed before server query could be fully transported, rerunning:\",\n queryInfo.options\n );\n this.rerunSimulatedQuery(queryInfo);\n }\n };\n rerunSimulatedQuery = (queryInfo: SimulatedQueryInfo) => {\n const queryManager = getQueryManager(this);\n queryManager.fetchQuery({\n ...queryInfo.options,\n fetchPolicy: \"no-cache\",\n query: queryManager.transform(queryInfo.options.query),\n context: skipDataTransport(\n teeToReadableStream(() => queryInfo.controller, {\n ...queryInfo.options.context,\n queryDeduplication: false,\n })\n ),\n });\n };\n}\n\nconst skipDataTransportKey = Symbol.for(\"apollo.dataTransport.skip\");\ninterface InternalContext {\n [skipDataTransportKey]?: boolean;\n}\n\n/**\n * Apply to a context to prevent this operation from being transported over the SSR data transport mechanism.\n * @public\n */\nexport function skipDataTransport<T extends Record<string, any>>(\n context: T\n): T & InternalContext {\n return Object.assign(context, {\n [skipDataTransportKey]: true,\n });\n}\n\nclass ApolloClientSSRImpl extends ApolloClientClientBaseImpl {\n watchQueryQueue = createBackpressuredCallback<{\n event: Extract<QueryEvent, { type: \"started\" }>;\n observable: Observable<Exclude<QueryEvent, { type: \"started\" }>>;\n }>();\n\n pushEventStream(\n options: OrigApolloClient.WatchQueryOptions<any, any>\n ): ReadableStreamDefaultController<ReadableStreamLinkEvent> {\n const id = crypto.randomUUID() as TransportIdentifier;\n\n const [controller, eventStream] = getInjectableEventStream();\n\n const streamObservable = new Observable<\n Exclude<QueryEvent, { type: \"started\" }>\n >((subscriber) => {\n function consume(\n event: ReadableStreamReadResult<ReadableStreamLinkEvent>\n ) {\n const value = event.value;\n if (value) {\n subscriber.next({ ...value, id });\n }\n if (event.done) {\n subscriber.complete();\n } else {\n reader.read().then(consume);\n }\n }\n const reader = eventStream.getReader();\n reader.read().then(consume);\n });\n\n this.watchQueryQueue.push({\n event: {\n type: \"started\",\n options: serializeOptions(options),\n id,\n },\n observable: streamObservable,\n });\n\n return controller;\n }\n\n watchQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n >(options: OrigApolloClient.WatchQueryOptions<TData, TVariables>) {\n if (\n !(options.context as InternalContext | undefined)?.[skipDataTransportKey]\n ) {\n return super.watchQuery({\n ...options,\n context: teeToReadableStream(\n () =>\n this.pushEventStream(\n options as OrigApolloClient.WatchQueryOptions<any, any>\n ),\n {\n ...options?.context,\n }\n ),\n });\n }\n return super.watchQuery(options);\n }\n}\n\nclass ApolloClientBrowserImpl extends ApolloClientClientBaseImpl {}\n\nclass ApolloClientRSCImpl extends ApolloClientBase {}\n\nconst ApolloClientImplementation =\n /*#__PURE__*/ process.env.REACT_ENV === \"ssr\"\n ? ApolloClientSSRImpl\n : process.env.REACT_ENV === \"browser\"\n ? ApolloClientBrowserImpl\n : ApolloClientRSCImpl;\n\n/**\n * A version of `ApolloClient` to be used with streaming SSR or in React Server Components.\n *\n * For more documentation, please see {@link https://www.apollographql.com/docs/react/api/core/ApolloClient | the Apollo Client API documentation}.\n *\n * @public\n */\nexport class ApolloClient\n extends (ApolloClientImplementation as typeof ApolloClientBase)\n implements Partial<ApolloClientSSRImpl>\n{\n /** @internal */\n declare onQueryStarted?: ApolloClientSSRImpl[\"onQueryStarted\"];\n /** @internal */\n declare onQueryProgress?: ApolloClientSSRImpl[\"onQueryProgress\"];\n /** @internal */\n declare rerunSimulatedQueries?: ApolloClientSSRImpl[\"rerunSimulatedQueries\"];\n /** @internal */\n declare rerunSimulatedQuery?: ApolloClientSSRImpl[\"rerunSimulatedQuery\"];\n /** @internal */\n declare watchQueryQueue?: ApolloClientSSRImpl[\"watchQueryQueue\"];\n}\n","/**\n * Creates a callback with backpressure support.\n *\n * New calls can be made with `callback.push(value)`.\n * If a callback is already registered, it will be called directly.\n * Otherwise, the calls will be queued until a callback is registered,\n * at which point all queued calls will be executed.\n *\n * The callback can be registered with `callback.register(callback)`.\n *\n * Registering `null` as a callback will clear the current callback -\n * future calls after that will be queued again.\n */\nexport function createBackpressuredCallback<T>() {\n const queue: T[] = [];\n let push: (value: T) => void = queue.push.bind(queue);\n return {\n push: (value: T) => push(value),\n register: (callback: null | ((value: T) => void)) => {\n if (callback) {\n push = callback;\n while (queue.length) {\n callback(queue.shift()!);\n }\n } else {\n push = queue.push.bind(queue);\n }\n },\n };\n}\n","\"use client\";\nimport { useContext, useSyncExternalStore } from \"react\";\nimport { DataTransportContext } from \"./DataTransportAbstraction.js\";\nimport { equal } from \"@wry/equality\";\n\nconst CLEAN = {};\nconst enum WhichResult {\n client,\n server,\n}\n\n/**\n * A hook that mostly acts as an identity function.\n * It will only behave differently during\n * the first render on the client, in which case it will\n * try to return the last value it was called with by\n * the same component during SSR. If that is successful,\n * it will schedule another rerender, to after hydration\n * the component can change to client-side values instead.\n */\nexport function useTransportValue<T>(value: T): T {\n const dataTransport = useContext(DataTransportContext);\n if (!dataTransport)\n throw new Error(\n \"useTransportValue must be used within a streaming-specific ApolloProvider\"\n );\n const valueRef = dataTransport.useStaticValueRef<T | typeof CLEAN>(value);\n\n const whichResult = useSyncExternalStore(\n () => () => {},\n () => WhichResult.client,\n () =>\n valueRef.current === CLEAN\n ? WhichResult.client\n : equal(value, valueRef.current)\n ? WhichResult.client\n : WhichResult.server\n );\n\n if (whichResult === WhichResult.client) {\n // this value will never be used again\n // so we can safely delete it to save memory\n valueRef.current = CLEAN;\n }\n\n return whichResult === WhichResult.server ? (valueRef.current as T) : value;\n}\n","import type React from \"react\";\nimport type { Observable } from \"@apollo/client\";\nimport { createContext } from \"react\";\nimport type { TransportedOptions } from \"./transportedOptions.js\";\nimport type { ReadableStreamLinkEvent } from \"../ReadableStreamLink.ts\";\n\ninterface DataTransportAbstraction {\n /**\n * This hook should always return the first value it was called with.\n *\n * If used in the browser and SSR happened, it should return the value passed to it on the server.\n */\n useStaticValueRef<T>(value: T): { current: T };\n}\n\n/**\n * > This export is only available in React Client Components\n *\n * If you create a custom data transport, you need to wrap the child tree in a\n * `DataTransportContext.Provider` and provide the `DataTransportAbstraction` to it.\n *\n * See for example\n * https://github.com/apollographql/apollo-client-integrations/blob/37feeaa9aea69b90a974eb9cd0fbd636b62d841a/integration-test/experimental-react/src/WrappedApolloProvider.tsx\n *\n * @public\n */\nexport const DataTransportContext =\n /*#__PURE__*/ createContext<DataTransportAbstraction | null>(null);\n\n/**\n * Interface to be implemented by a custom data transport component,\n * for usage with `WrapApolloProvider`.\n *\n * This component needs to provide a `DataTransportContext` to it's children.\n *\n * See for example\n * https://github.com/apollographql/apollo-client-integrations/blob/37feeaa9aea69b90a974eb9cd0fbd636b62d841a/integration-test/experimental-react/src/WrappedApolloProvider.tsx\n *\n * @public\n */\nexport type DataTransportProviderImplementation<\n // eslint-disable-next-line @typescript-eslint/ban-types\n ExtraProps = {},\n> = React.FC<\n {\n /** will be present in the Browser */\n onQueryEvent?: (event: QueryEvent) => void;\n /** will be present in the Browser */\n rerunSimulatedQueries?: () => void;\n /** will be present during SSR */\n registerDispatchRequestStarted?: (\n callback: (query: {\n event: Extract<QueryEvent, { type: \"started\" }>;\n observable: Observable<Exclude<QueryEvent, { type: \"started\" }>>;\n }) => void\n ) => void;\n /** will always be present */\n children: React.ReactNode;\n } & ExtraProps\n>;\n\nexport type TransportIdentifier = string & { __transportIdentifier: true };\n\n/**\n * Events that will be emitted by a wrapped ApolloClient instance during\n * SSR on `DataTransportProviderImplementation.registerDispatchRequestStarted`,\n * to be transported to the browser and replayed there using\n * `DataTransportProviderImplementation.onQueryEvent`.\n *\n * @public\n */\nexport type QueryEvent =\n | {\n type: \"started\";\n options: TransportedOptions;\n id: TransportIdentifier;\n }\n | (ReadableStreamLinkEvent & {\n id: TransportIdentifier;\n });\n\nexport type ProgressEvent = Exclude<QueryEvent, { type: \"started\" }>;\n","import { unwrapQueryRef, wrapQueryRef } from \"@apollo/client/react/internal\";\nimport {\n readFromReadableStream,\n teeToReadableStream,\n} from \"./ReadableStreamLink.js\";\nimport { skipDataTransport } from \"./DataTransportAbstraction/index.js\";\nimport type { ReadableStreamLinkEvent } from \"./ReadableStreamLink.js\";\nimport type { QueryRef } from \"@apollo/client/react\";\nimport { useApolloClient } from \"@apollo/client/react\";\nimport type {\n DocumentNode,\n ApolloClient,\n OperationVariables,\n TypedDocumentNode,\n} from \"@apollo/client\";\nimport {\n serializeOptions,\n deserializeOptions,\n type TransportedOptions,\n} from \"./DataTransportAbstraction/transportedOptions.js\";\nimport { useEffect } from \"react\";\nimport {\n JSONDecodeStream,\n JSONEncodeStream,\n type JsonString,\n} from \"@apollo/client-react-streaming/stream-utils\";\nimport { InternalQueryReference } from \"@apollo/client/react/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\n\ntype RestrictedPreloadOptions = {\n fetchPolicy?: \"network-only\" | \"cache-and-network\" | \"cache-first\";\n returnPartialData?: false;\n nextFetchPolicy?: undefined;\n pollInterval?: undefined;\n};\n\n/** @public */\nexport type PreloadTransportedQueryOptions<\n TData,\n TVariables extends OperationVariables,\n> = Omit<ApolloClient.QueryOptions<TData, TVariables>, \"query\"> &\n RestrictedPreloadOptions;\n\ntype TransportedQueryRefOptions = TransportedOptions & RestrictedPreloadOptions;\n\n/**\n * A `TransportedQueryRef` is an opaque object accessible via renderProp within `PreloadQuery`.\n *\n * A child client component reading the `TransportedQueryRef` via useReadQuery will suspend until the promise resolves.\n *\n * @public\n */\nexport interface TransportedQueryRef<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryRef<TData, TVariables> {\n /**\n * Temporarily disabled - see https://github.com/apollographql/apollo-client-integrations/issues/332\n *\n * Will now be be `undefined` both in React Server Components and Client Components until we can find a better resolution.\n */\n toPromise?: undefined;\n /** @internal */\n $__apollo_queryRef: {\n options: TransportedQueryRefOptions;\n stream: ReadableStream<JsonString<ReadableStreamLinkEvent>>;\n /**\n * A unique key for this query, to ensure it is only hydrated once,\n * even if it should get transported over the wire in a way that results\n * in multiple objects describing the same queryRef.\n * This key will be used to store the queryRef in the suspence cache.\n *\n * The chances of this happening should be slim (it is handled within\n * React thanks to https://github.com/facebook/react/pull/28996), but\n * as we use transported queryRefs with multiple frameworks with distinct\n * transport mechanisms, this seems like a safe option.\n */\n queryKey: string;\n };\n}\n\n/** @public */\nexport interface PreloadTransportedQueryFunction {\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: PreloadTransportedQueryOptions<TData, NoInfer<TVariables>>\n ): TransportedQueryRef<TData, TVariables>;\n}\n\n/** @internal */\nexport function getInjectableEventStream() {\n let controller:\n | ReadableStreamDefaultController<ReadableStreamLinkEvent>\n | undefined;\n const stream = new ReadableStream<ReadableStreamLinkEvent>({\n start(c) {\n controller = c;\n },\n });\n return [controller!, stream] as const;\n}\n\n/** @public */\nexport function createTransportedQueryPreloader(\n client: ApolloClient,\n {\n prepareForReuse = false,\n notTransportedOptionOverrides = {},\n }: {\n /**\n * Set this to `true` to indicate that this `queryRef` will be reused within the same process with the same Apollo Client instance without being dehydrated and hydrated.\n * In that case, it will already be written to the suspense cache so it doesn't need to be hydrated by re-running the query with a fake network request.\n */\n prepareForReuse?: boolean;\n /**\n * Overrides to the options that should happen only in the `preloader` call, but should not be transported/hydrated on the client.\n */\n notTransportedOptionOverrides?: Partial<\n ApolloClient.WatchQueryOptions<any, any>\n >;\n } = {}\n): PreloadTransportedQueryFunction {\n return (...[query, options]: Parameters<PreloadTransportedQueryFunction>) => {\n // unset options that we do not support\n options = { ...options };\n delete opti