@apollo/client 3.10.1 → 3.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/apollo-client.cjs +14 -20
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +1 -1
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +1 -1
- package/cache/inmemory/writeToStore.js +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +1 -1
- package/dev/dev.cjs +1 -1
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +1 -1
- package/link/http/selectURI.d.ts +1 -1
- package/package.json +24 -24
- package/react/context/ApolloConsumer.d.ts +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/hooks/hooks.cjs +7 -15
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +7 -15
- package/react/hooks/useBackgroundQuery.js +13 -9
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useReadQuery.js +1 -10
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +0 -27
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/internal/cache/QueryReference.js +5 -3
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/internal.cjs +5 -3
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +5 -3
- package/react/types/types.d.ts +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/experimental/createSchemaFetch.d.ts +0 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/subscriptions/urql/index.d.ts +1 -1
- package/version.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.cjs","sources":["cache/QueryReference.js","cache/SuspenseCache.js","cache/getSuspenseCache.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { equal } from \"@wry/equality\";\nimport { createFulfilledPromise, createRejectedPromise, } from \"../../../utilities/index.js\";\nimport { wrapPromiseWithState } from \"../../../utilities/index.js\";\nvar QUERY_REFERENCE_SYMBOL = Symbol();\nvar PROMISE_SYMBOL = Symbol();\nexport function wrapQueryRef(internalQueryRef) {\n var _a;\n var ref = (_a = {\n toPromise: function () {\n // We avoid resolving this promise with the query data because we want to\n // discourage using the server data directly from the queryRef. Instead,\n // the data should be accessed through `useReadQuery`. When the server\n // data is needed, its better to use `client.query()` directly.\n //\n // Here we resolve with the ref itself to make using this in React Router\n // or TanStack Router `loader` functions a bit more ergonomic e.g.\n //\n // function loader() {\n // return { queryRef: await preloadQuery(query).toPromise() }\n // }\n return getWrappedPromise(ref).then(function () { return ref; });\n }\n },\n _a[QUERY_REFERENCE_SYMBOL] = internalQueryRef,\n _a[PROMISE_SYMBOL] = internalQueryRef.promise,\n _a);\n return ref;\n}\nexport function getWrappedPromise(queryRef) {\n var internalQueryRef = unwrapQueryRef(queryRef);\n return internalQueryRef.promise.status === \"fulfilled\" ?\n internalQueryRef.promise\n : queryRef[PROMISE_SYMBOL];\n}\nexport function unwrapQueryRef(queryRef) {\n return queryRef[QUERY_REFERENCE_SYMBOL];\n}\nexport function updateWrappedQueryRef(queryRef, promise) {\n queryRef[PROMISE_SYMBOL] = promise;\n}\nvar OBSERVED_CHANGED_OPTIONS = [\n \"canonizeResults\",\n \"context\",\n \"errorPolicy\",\n \"fetchPolicy\",\n \"refetchWritePolicy\",\n \"returnPartialData\",\n];\nvar InternalQueryReference = /** @class */ (function () {\n function InternalQueryReference(observable, options) {\n var _this = this;\n this.key = {};\n this.listeners = new Set();\n this.references = 0;\n this.softReferences = 0;\n this.handleNext = this.handleNext.bind(this);\n this.handleError = this.handleError.bind(this);\n this.dispose = this.dispose.bind(this);\n this.observable = observable;\n if (options.onDispose) {\n this.onDispose = options.onDispose;\n }\n this.setResult();\n this.subscribeToQuery();\n // Start a timer that will automatically dispose of the query if the\n // suspended resource does not use this queryRef in the given time. This\n // helps prevent memory leaks when a component has unmounted before the\n // query has finished loading.\n var startDisposeTimer = function () {\n var _a;\n if (!_this.references) {\n _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);\n }\n };\n // We wait until the request has settled to ensure we don't dispose of the\n // query ref before the request finishes, otherwise we would leave the\n // promise in a pending state rendering the suspense boundary indefinitely.\n this.promise.then(startDisposeTimer, startDisposeTimer);\n }\n Object.defineProperty(InternalQueryReference.prototype, \"disposed\", {\n get: function () {\n return this.subscription.closed;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InternalQueryReference.prototype, \"watchQueryOptions\", {\n get: function () {\n return this.observable.options;\n },\n enumerable: false,\n configurable: true\n });\n InternalQueryReference.prototype.reinitialize = function () {\n var observable = this.observable;\n var originalFetchPolicy = this.watchQueryOptions.fetchPolicy;\n var avoidNetworkRequests = originalFetchPolicy === \"no-cache\" || originalFetchPolicy === \"standby\";\n try {\n if (avoidNetworkRequests) {\n observable.silentSetOptions({ fetchPolicy: \"standby\" });\n }\n else {\n observable.resetLastResults();\n observable.silentSetOptions({ fetchPolicy: \"cache-first\" });\n }\n this.subscribeToQuery();\n if (avoidNetworkRequests) {\n return;\n }\n observable.resetDiff();\n this.setResult();\n }\n finally {\n observable.silentSetOptions({ fetchPolicy: originalFetchPolicy });\n }\n };\n InternalQueryReference.prototype.retain = function () {\n var _this = this;\n this.references++;\n clearTimeout(this.autoDisposeTimeoutId);\n var disposed = false;\n return function () {\n if (disposed) {\n return;\n }\n disposed = true;\n _this.references--;\n if (!_this.references) {\n _this.dispose();\n }\n };\n };\n InternalQueryReference.prototype.softRetain = function () {\n var _this = this;\n this.softReferences++;\n var disposed = false;\n return function () {\n // Tracking if this has already been called helps ensure that\n // multiple calls to this function won't decrement the reference\n // counter more than it should. Subsequent calls just result in a noop.\n if (disposed) {\n return;\n }\n disposed = true;\n _this.softReferences--;\n setTimeout(function () {\n if (!_this.softReferences && !_this.references) {\n _this.dispose();\n }\n });\n };\n };\n InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {\n var _this = this;\n return OBSERVED_CHANGED_OPTIONS.some(function (option) {\n return option in watchQueryOptions &&\n !equal(_this.watchQueryOptions[option], watchQueryOptions[option]);\n });\n };\n InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {\n var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults;\n // \"standby\" is used when `skip` is set to `true`. Detect when we've\n // enabled the query (i.e. `skip` is `false`) to execute a network request.\n if (currentFetchPolicy === \"standby\" &&\n currentFetchPolicy !== watchQueryOptions.fetchPolicy) {\n this.initiateFetch(this.observable.reobserve(watchQueryOptions));\n }\n else {\n this.observable.silentSetOptions(watchQueryOptions);\n if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {\n this.result = __assign(__assign({}, this.result), this.observable.getCurrentResult());\n this.promise = createFulfilledPromise(this.result);\n }\n }\n return this.promise;\n };\n InternalQueryReference.prototype.listen = function (listener) {\n var _this = this;\n this.listeners.add(listener);\n return function () {\n _this.listeners.delete(listener);\n };\n };\n InternalQueryReference.prototype.refetch = function (variables) {\n return this.initiateFetch(this.observable.refetch(variables));\n };\n InternalQueryReference.prototype.fetchMore = function (options) {\n return this.initiateFetch(this.observable.fetchMore(options));\n };\n InternalQueryReference.prototype.dispose = function () {\n this.subscription.unsubscribe();\n this.onDispose();\n };\n InternalQueryReference.prototype.onDispose = function () {\n // noop. overridable by options\n };\n InternalQueryReference.prototype.handleNext = function (result) {\n var _a;\n switch (this.promise.status) {\n case \"pending\": {\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n (_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result);\n break;\n }\n default: {\n // This occurs when switching to a result that is fully cached when this\n // class is instantiated. ObservableQuery will run reobserve when\n // subscribing, which delivers a result from the cache.\n if (result.data === this.result.data &&\n result.networkStatus === this.result.networkStatus) {\n return;\n }\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n this.promise = createFulfilledPromise(result);\n this.deliver(this.promise);\n break;\n }\n }\n };\n InternalQueryReference.prototype.handleError = function (error) {\n var _a;\n this.subscription.unsubscribe();\n this.subscription = this.observable.resubscribeAfterError(this.handleNext, this.handleError);\n switch (this.promise.status) {\n case \"pending\": {\n (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error);\n break;\n }\n default: {\n this.promise = createRejectedPromise(error);\n this.deliver(this.promise);\n }\n }\n };\n InternalQueryReference.prototype.deliver = function (promise) {\n this.listeners.forEach(function (listener) { return listener(promise); });\n };\n InternalQueryReference.prototype.initiateFetch = function (returnedPromise) {\n var _this = this;\n this.promise = this.createPendingPromise();\n this.promise.catch(function () { });\n // If the data returned from the fetch is deeply equal to the data already\n // in the cache, `handleNext` will not be triggered leaving the promise we\n // created in a pending state forever. To avoid this situtation, we attempt\n // to resolve the promise if `handleNext` hasn't been run to ensure the\n // promise is resolved correctly.\n returnedPromise\n .then(function () {\n // In the case of `fetchMore`, this promise is resolved before a cache\n // result is emitted due to the fact that `fetchMore` sets a `no-cache`\n // fetch policy and runs `cache.batch` in its `.then` handler. Because\n // the timing is different, we accidentally run this update twice\n // causing an additional re-render with the `fetchMore` result by\n // itself. By wrapping in `setTimeout`, this should provide a short\n // delay to allow the `QueryInfo.notify` handler to run before this\n // promise is checked.\n // See https://github.com/apollographql/apollo-client/issues/11315 for\n // more information\n setTimeout(function () {\n var _a;\n if (_this.promise.status === \"pending\") {\n // Use the current result from the observable instead of the value\n // resolved from the promise. This avoids issues in some cases where\n // the raw resolved value should not be the emitted value, such as\n // when a `fetchMore` call returns an empty array after it has\n // reached the end of the list.\n //\n // See the following for more information:\n // https://github.com/apollographql/apollo-client/issues/11642\n _this.result = _this.observable.getCurrentResult();\n (_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, _this.result);\n }\n });\n })\n .catch(function () { });\n return returnedPromise;\n };\n InternalQueryReference.prototype.subscribeToQuery = function () {\n var _this = this;\n this.subscription = this.observable\n .filter(function (result) { return !equal(result.data, {}) && !equal(result, _this.result); })\n .subscribe(this.handleNext, this.handleError);\n };\n InternalQueryReference.prototype.setResult = function () {\n // Don't save this result as last result to prevent delivery of last result\n // when first subscribing\n var result = this.observable.getCurrentResult(false);\n if (equal(result, this.result)) {\n return;\n }\n this.result = result;\n this.promise =\n (result.data &&\n (!result.partial || this.watchQueryOptions.returnPartialData)) ?\n createFulfilledPromise(result)\n : this.createPendingPromise();\n };\n InternalQueryReference.prototype.createPendingPromise = function () {\n var _this = this;\n return wrapPromiseWithState(new Promise(function (resolve, reject) {\n _this.resolve = resolve;\n _this.reject = reject;\n }));\n };\n return InternalQueryReference;\n}());\nexport { InternalQueryReference };\n//# sourceMappingURL=QueryReference.js.map","import { Trie } from \"@wry/trie\";\nimport { canUseWeakMap } from \"../../../utilities/index.js\";\nimport { InternalQueryReference } from \"./QueryReference.js\";\nvar SuspenseCache = /** @class */ (function () {\n function SuspenseCache(options) {\n if (options === void 0) { options = Object.create(null); }\n this.queryRefs = new Trie(canUseWeakMap);\n this.options = options;\n }\n SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {\n var ref = this.queryRefs.lookupArray(cacheKey);\n if (!ref.current) {\n ref.current = new InternalQueryReference(createObservable(), {\n autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,\n onDispose: function () {\n delete ref.current;\n },\n });\n }\n return ref.current;\n };\n SuspenseCache.prototype.add = function (cacheKey, queryRef) {\n var ref = this.queryRefs.lookupArray(cacheKey);\n ref.current = queryRef;\n };\n return SuspenseCache;\n}());\nexport { SuspenseCache };\n//# sourceMappingURL=SuspenseCache.js.map","import { SuspenseCache } from \"./SuspenseCache.js\";\nvar suspenseCacheSymbol = Symbol.for(\"apollo.suspenseCache\");\nexport function getSuspenseCache(client) {\n var _a;\n if (!client[suspenseCacheSymbol]) {\n client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);\n }\n return client[suspenseCacheSymbol];\n}\n//# sourceMappingURL=getSuspenseCache.js.map"],"names":["equal","__assign","createFulfilledPromise","createRejectedPromise","wrapPromiseWithState","Trie","canUseWeakMap"],"mappings":";;;;;;;;;AAIA,IAAI,sBAAsB,GAAG,MAAM,EAAE,CAAC;AACtC,IAAI,cAAc,GAAG,MAAM,EAAE,CAAC;AACvB,SAAS,YAAY,CAAC,gBAAgB,EAAE;AAC/C,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,GAAG,IAAI,EAAE,GAAG;AACpB,YAAY,SAAS,EAAE,YAAY;AAYnC,gBAAgB,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC;AAChF,aAAa;AACb,SAAS;AACT,QAAQ,EAAE,CAAC,sBAAsB,CAAC,GAAG,gBAAgB;AACrD,QAAQ,EAAE,CAAC,cAAc,CAAC,GAAG,gBAAgB,CAAC,OAAO;AACrD,QAAQ,EAAE,CAAC,CAAC;AACZ,IAAI,OAAO,GAAG,CAAC;AACf,CAAC;AACM,SAAS,iBAAiB,CAAC,QAAQ,EAAE;AAC5C,IAAI,IAAI,gBAAgB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;AACpD,IAAI,OAAO,gBAAgB,CAAC,OAAO,CAAC,MAAM,KAAK,WAAW;AAC1D,QAAQ,gBAAgB,CAAC,OAAO;AAChC,UAAU,QAAQ,CAAC,cAAc,CAAC,CAAC;AACnC,CAAC;AACM,SAAS,cAAc,CAAC,QAAQ,EAAE;AACzC,IA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,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC7I,KAAK;AACL,IAAI,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACvC;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"internal.cjs","sources":["cache/QueryReference.js","cache/SuspenseCache.js","cache/getSuspenseCache.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { equal } from \"@wry/equality\";\nimport { createFulfilledPromise, createRejectedPromise, } from \"../../../utilities/index.js\";\nimport { wrapPromiseWithState } from \"../../../utilities/index.js\";\nvar QUERY_REFERENCE_SYMBOL = Symbol();\nvar PROMISE_SYMBOL = Symbol();\nexport function wrapQueryRef(internalQueryRef) {\n var _a;\n var ref = (_a = {\n toPromise: function () {\n // We avoid resolving this promise with the query data because we want to\n // discourage using the server data directly from the queryRef. Instead,\n // the data should be accessed through `useReadQuery`. When the server\n // data is needed, its better to use `client.query()` directly.\n //\n // Here we resolve with the ref itself to make using this in React Router\n // or TanStack Router `loader` functions a bit more ergonomic e.g.\n //\n // function loader() {\n // return { queryRef: await preloadQuery(query).toPromise() }\n // }\n return getWrappedPromise(ref).then(function () { return ref; });\n }\n },\n _a[QUERY_REFERENCE_SYMBOL] = internalQueryRef,\n _a[PROMISE_SYMBOL] = internalQueryRef.promise,\n _a);\n return ref;\n}\nexport function getWrappedPromise(queryRef) {\n var internalQueryRef = unwrapQueryRef(queryRef);\n return internalQueryRef.promise.status === \"fulfilled\" ?\n internalQueryRef.promise\n : queryRef[PROMISE_SYMBOL];\n}\nexport function unwrapQueryRef(queryRef) {\n return queryRef[QUERY_REFERENCE_SYMBOL];\n}\nexport function updateWrappedQueryRef(queryRef, promise) {\n queryRef[PROMISE_SYMBOL] = promise;\n}\nvar OBSERVED_CHANGED_OPTIONS = [\n \"canonizeResults\",\n \"context\",\n \"errorPolicy\",\n \"fetchPolicy\",\n \"refetchWritePolicy\",\n \"returnPartialData\",\n];\nvar InternalQueryReference = /** @class */ (function () {\n function InternalQueryReference(observable, options) {\n var _this = this;\n this.key = {};\n this.listeners = new Set();\n this.references = 0;\n this.softReferences = 0;\n this.handleNext = this.handleNext.bind(this);\n this.handleError = this.handleError.bind(this);\n this.dispose = this.dispose.bind(this);\n this.observable = observable;\n if (options.onDispose) {\n this.onDispose = options.onDispose;\n }\n this.setResult();\n this.subscribeToQuery();\n // Start a timer that will automatically dispose of the query if the\n // suspended resource does not use this queryRef in the given time. This\n // helps prevent memory leaks when a component has unmounted before the\n // query has finished loading.\n var startDisposeTimer = function () {\n var _a;\n if (!_this.references) {\n _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);\n }\n };\n // We wait until the request has settled to ensure we don't dispose of the\n // query ref before the request finishes, otherwise we would leave the\n // promise in a pending state rendering the suspense boundary indefinitely.\n this.promise.then(startDisposeTimer, startDisposeTimer);\n }\n Object.defineProperty(InternalQueryReference.prototype, \"disposed\", {\n get: function () {\n return this.subscription.closed;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InternalQueryReference.prototype, \"watchQueryOptions\", {\n get: function () {\n return this.observable.options;\n },\n enumerable: false,\n configurable: true\n });\n InternalQueryReference.prototype.reinitialize = function () {\n var observable = this.observable;\n var originalFetchPolicy = this.watchQueryOptions.fetchPolicy;\n var avoidNetworkRequests = originalFetchPolicy === \"no-cache\" || originalFetchPolicy === \"standby\";\n try {\n if (avoidNetworkRequests) {\n observable.silentSetOptions({ fetchPolicy: \"standby\" });\n }\n else {\n observable.resetLastResults();\n observable.silentSetOptions({ fetchPolicy: \"cache-first\" });\n }\n this.subscribeToQuery();\n if (avoidNetworkRequests) {\n return;\n }\n observable.resetDiff();\n this.setResult();\n }\n finally {\n observable.silentSetOptions({ fetchPolicy: originalFetchPolicy });\n }\n };\n InternalQueryReference.prototype.retain = function () {\n var _this = this;\n this.references++;\n clearTimeout(this.autoDisposeTimeoutId);\n var disposed = false;\n return function () {\n if (disposed) {\n return;\n }\n disposed = true;\n _this.references--;\n setTimeout(function () {\n if (!_this.references) {\n _this.dispose();\n }\n });\n };\n };\n InternalQueryReference.prototype.softRetain = function () {\n var _this = this;\n this.softReferences++;\n var disposed = false;\n return function () {\n // Tracking if this has already been called helps ensure that\n // multiple calls to this function won't decrement the reference\n // counter more than it should. Subsequent calls just result in a noop.\n if (disposed) {\n return;\n }\n disposed = true;\n _this.softReferences--;\n setTimeout(function () {\n if (!_this.softReferences && !_this.references) {\n _this.dispose();\n }\n });\n };\n };\n InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {\n var _this = this;\n return OBSERVED_CHANGED_OPTIONS.some(function (option) {\n return option in watchQueryOptions &&\n !equal(_this.watchQueryOptions[option], watchQueryOptions[option]);\n });\n };\n InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {\n var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults;\n // \"standby\" is used when `skip` is set to `true`. Detect when we've\n // enabled the query (i.e. `skip` is `false`) to execute a network request.\n if (currentFetchPolicy === \"standby\" &&\n currentFetchPolicy !== watchQueryOptions.fetchPolicy) {\n this.initiateFetch(this.observable.reobserve(watchQueryOptions));\n }\n else {\n this.observable.silentSetOptions(watchQueryOptions);\n if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {\n this.result = __assign(__assign({}, this.result), this.observable.getCurrentResult());\n this.promise = createFulfilledPromise(this.result);\n }\n }\n return this.promise;\n };\n InternalQueryReference.prototype.listen = function (listener) {\n var _this = this;\n this.listeners.add(listener);\n return function () {\n _this.listeners.delete(listener);\n };\n };\n InternalQueryReference.prototype.refetch = function (variables) {\n return this.initiateFetch(this.observable.refetch(variables));\n };\n InternalQueryReference.prototype.fetchMore = function (options) {\n return this.initiateFetch(this.observable.fetchMore(options));\n };\n InternalQueryReference.prototype.dispose = function () {\n this.subscription.unsubscribe();\n this.onDispose();\n };\n InternalQueryReference.prototype.onDispose = function () {\n // noop. overridable by options\n };\n InternalQueryReference.prototype.handleNext = function (result) {\n var _a;\n switch (this.promise.status) {\n case \"pending\": {\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n (_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result);\n break;\n }\n default: {\n // This occurs when switching to a result that is fully cached when this\n // class is instantiated. ObservableQuery will run reobserve when\n // subscribing, which delivers a result from the cache.\n if (result.data === this.result.data &&\n result.networkStatus === this.result.networkStatus) {\n return;\n }\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n this.promise = createFulfilledPromise(result);\n this.deliver(this.promise);\n break;\n }\n }\n };\n InternalQueryReference.prototype.handleError = function (error) {\n var _a;\n this.subscription.unsubscribe();\n this.subscription = this.observable.resubscribeAfterError(this.handleNext, this.handleError);\n switch (this.promise.status) {\n case \"pending\": {\n (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error);\n break;\n }\n default: {\n this.promise = createRejectedPromise(error);\n this.deliver(this.promise);\n }\n }\n };\n InternalQueryReference.prototype.deliver = function (promise) {\n this.listeners.forEach(function (listener) { return listener(promise); });\n };\n InternalQueryReference.prototype.initiateFetch = function (returnedPromise) {\n var _this = this;\n this.promise = this.createPendingPromise();\n this.promise.catch(function () { });\n // If the data returned from the fetch is deeply equal to the data already\n // in the cache, `handleNext` will not be triggered leaving the promise we\n // created in a pending state forever. To avoid this situtation, we attempt\n // to resolve the promise if `handleNext` hasn't been run to ensure the\n // promise is resolved correctly.\n returnedPromise\n .then(function () {\n // In the case of `fetchMore`, this promise is resolved before a cache\n // result is emitted due to the fact that `fetchMore` sets a `no-cache`\n // fetch policy and runs `cache.batch` in its `.then` handler. Because\n // the timing is different, we accidentally run this update twice\n // causing an additional re-render with the `fetchMore` result by\n // itself. By wrapping in `setTimeout`, this should provide a short\n // delay to allow the `QueryInfo.notify` handler to run before this\n // promise is checked.\n // See https://github.com/apollographql/apollo-client/issues/11315 for\n // more information\n setTimeout(function () {\n var _a;\n if (_this.promise.status === \"pending\") {\n // Use the current result from the observable instead of the value\n // resolved from the promise. This avoids issues in some cases where\n // the raw resolved value should not be the emitted value, such as\n // when a `fetchMore` call returns an empty array after it has\n // reached the end of the list.\n //\n // See the following for more information:\n // https://github.com/apollographql/apollo-client/issues/11642\n _this.result = _this.observable.getCurrentResult();\n (_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, _this.result);\n }\n });\n })\n .catch(function () { });\n return returnedPromise;\n };\n InternalQueryReference.prototype.subscribeToQuery = function () {\n var _this = this;\n this.subscription = this.observable\n .filter(function (result) { return !equal(result.data, {}) && !equal(result, _this.result); })\n .subscribe(this.handleNext, this.handleError);\n };\n InternalQueryReference.prototype.setResult = function () {\n // Don't save this result as last result to prevent delivery of last result\n // when first subscribing\n var result = this.observable.getCurrentResult(false);\n if (equal(result, this.result)) {\n return;\n }\n this.result = result;\n this.promise =\n (result.data &&\n (!result.partial || this.watchQueryOptions.returnPartialData)) ?\n createFulfilledPromise(result)\n : this.createPendingPromise();\n };\n InternalQueryReference.prototype.createPendingPromise = function () {\n var _this = this;\n return wrapPromiseWithState(new Promise(function (resolve, reject) {\n _this.resolve = resolve;\n _this.reject = reject;\n }));\n };\n return InternalQueryReference;\n}());\nexport { InternalQueryReference };\n//# sourceMappingURL=QueryReference.js.map","import { Trie } from \"@wry/trie\";\nimport { canUseWeakMap } from \"../../../utilities/index.js\";\nimport { InternalQueryReference } from \"./QueryReference.js\";\nvar SuspenseCache = /** @class */ (function () {\n function SuspenseCache(options) {\n if (options === void 0) { options = Object.create(null); }\n this.queryRefs = new Trie(canUseWeakMap);\n this.options = options;\n }\n SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {\n var ref = this.queryRefs.lookupArray(cacheKey);\n if (!ref.current) {\n ref.current = new InternalQueryReference(createObservable(), {\n autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,\n onDispose: function () {\n delete ref.current;\n },\n });\n }\n return ref.current;\n };\n SuspenseCache.prototype.add = function (cacheKey, queryRef) {\n var ref = this.queryRefs.lookupArray(cacheKey);\n ref.current = queryRef;\n };\n return SuspenseCache;\n}());\nexport { SuspenseCache };\n//# sourceMappingURL=SuspenseCache.js.map","import { SuspenseCache } from \"./SuspenseCache.js\";\nvar suspenseCacheSymbol = Symbol.for(\"apollo.suspenseCache\");\nexport function getSuspenseCache(client) {\n var _a;\n if (!client[suspenseCacheSymbol]) {\n client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);\n }\n return client[suspenseCacheSymbol];\n}\n//# sourceMappingURL=getSuspenseCache.js.map"],"names":["equal","__assign","createFulfilledPromise","createRejectedPromise","wrapPromiseWithState","Trie","canUseWeakMap"],"mappings":";;;;;;;;;AAIA,IAAI,sBAAsB,GAAG,MAAM,EAAE,CAAC;AACtC,IAAI,cAAc,GAAG,MAAM,EAAE,CAAC;AACvB,SAAS,YAAY,CAAC,gBAAgB,EAAE;AAC/C,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,GAAG,IAAI,EAAE,GAAG;AACpB,YAAY,SAAS,EAAE,YAAY;AAYnC,gBAAgB,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC;AAChF,aAAa;AACb,SAAS;AACT,QAAQ,EAAE,CAAC,sBAAsB,CAAC,GAAG,gBAAgB;AACrD,QAAQ,EAAE,CAAC,cAAc,CAAC,GAAG,gBAAgB,CAAC,OAAO;AACrD,QAAQ,EAAE,CAAC,CAAC;AACZ,IAAI,OAAO,GAAG,CAAC;AACf,CAAC;AACM,SAAS,iBAAiB,CAAC,QAAQ,EAAE;AAC5C,IAAI,IAAI,gBAAgB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC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AAC,CAAC;AACtD,SAAS,gBAAgB,CAAC,MAAM,EAAE;AACzC,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE;AACtC,QAAQ,MAAM,CAAC,mBAAmB,CAAC,GAAG,IAAI,aAAa,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC7I,KAAK;AACL,IAAI,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACvC;;;;;;;;;"}
|
|
@@ -113,9 +113,11 @@ var InternalQueryReference = (function () {
|
|
|
113
113
|
}
|
|
114
114
|
disposed = true;
|
|
115
115
|
_this.references--;
|
|
116
|
-
|
|
117
|
-
_this.
|
|
118
|
-
|
|
116
|
+
setTimeout(function () {
|
|
117
|
+
if (!_this.references) {
|
|
118
|
+
_this.dispose();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
119
121
|
};
|
|
120
122
|
};
|
|
121
123
|
InternalQueryReference.prototype.softRetain = function () {
|
package/react/types/types.d.ts
CHANGED
|
@@ -721,7 +721,7 @@ export interface SubscriptionHookOptions<TData = any, TVariables extends Operati
|
|
|
721
721
|
}
|
|
722
722
|
export interface SubscriptionDataOptions<TData = any, TVariables extends OperationVariables = OperationVariables> extends BaseSubscriptionOptions<TData, TVariables> {
|
|
723
723
|
subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
724
|
-
children?: null | ((result: SubscriptionResult<TData>) =>
|
|
724
|
+
children?: null | ((result: SubscriptionResult<TData>) => ReactTypes.ReactNode);
|
|
725
725
|
}
|
|
726
726
|
export interface SubscriptionCurrentObservable {
|
|
727
727
|
query?: Observable<any>;
|
package/react/types/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/types/types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as ReactTypes from \"react\";\nimport type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type {\n Observable,\n ObservableSubscription,\n} from \"../../utilities/index.js\";\nimport type { FetchResult } from \"../../link/core/index.js\";\nimport type { ApolloError } from \"../../errors/index.js\";\nimport type {\n ApolloCache,\n ApolloClient,\n DefaultContext,\n FetchPolicy,\n NetworkStatus,\n ObservableQuery,\n OperationVariables,\n InternalRefetchQueriesInclude,\n WatchQueryOptions,\n WatchQueryFetchPolicy,\n SubscribeToMoreOptions,\n ApolloQueryResult,\n FetchMoreQueryOptions,\n ErrorPolicy,\n RefetchWritePolicy,\n} from \"../../core/index.js\";\nimport type {\n MutationSharedOptions,\n SharedWatchQueryOptions,\n} from \"../../core/watchQueryOptions.js\";\n\n/* QueryReference type */\n\nexport type { QueryReference } from \"../internal/index.js\";\n\n/* Common types */\n\nexport type { DefaultContext as Context } from \"../../core/index.js\";\n\nexport type CommonOptions<TOptions> = TOptions & {\n client?: ApolloClient<object>;\n};\n\n/* Query types */\n\nexport interface BaseQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n TData = any,\n> extends SharedWatchQueryOptions<TVariables, TData> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#ssr:member} */\n ssr?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */\n client?: ApolloClient<any>;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n}\n\nexport interface QueryFunctionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseQueryOptions<TVariables, TData> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#skip:member} */\n skip?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onCompleted:member} */\n onCompleted?: (data: TData) => void;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError) => void;\n\n // Default WatchQueryOptions for this useQuery, providing initial values for\n // unspecified options, superseding client.defaultOptions.watchQuery (option\n // by option, not whole), but never overriding options previously passed to\n // useQuery (or options added/modified later by other means).\n // TODO What about about default values that are expensive to evaluate?\n /** @internal */\n defaultOptions?: Partial<WatchQueryOptions<TVariables, TData>>;\n}\n\nexport interface ObservableQueryFields<\n TData,\n TVariables extends OperationVariables,\n> {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#startPolling:member} */\n startPolling: (pollInterval: number) => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#stopPolling:member} */\n stopPolling: () => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#subscribeToMore:member} */\n subscribeToMore: <\n TSubscriptionData = TData,\n TSubscriptionVariables extends OperationVariables = TVariables,\n >(\n options: SubscribeToMoreOptions<\n TData,\n TSubscriptionVariables,\n TSubscriptionData\n >\n ) => () => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#updateQuery:member} */\n updateQuery: <TVars extends OperationVariables = TVariables>(\n mapFn: (\n previousQueryResult: TData,\n options: Pick<WatchQueryOptions<TVars, TData>, \"variables\">\n ) => TData\n ) => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#refetch:member} */\n refetch: (\n variables?: Partial<TVariables>\n ) => Promise<ApolloQueryResult<TData>>;\n /** @internal */\n reobserve: (\n newOptions?: Partial<WatchQueryOptions<TVariables, TData>>,\n newNetworkStatus?: NetworkStatus\n ) => Promise<ApolloQueryResult<TData>>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#variables:member} */\n variables: TVariables | undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#fetchMore:member} */\n fetchMore: <\n TFetchData = TData,\n TFetchVars extends OperationVariables = TVariables,\n >(\n fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {\n updateQuery?: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult: TFetchData;\n variables: TFetchVars;\n }\n ) => TData;\n }\n ) => Promise<ApolloQueryResult<TFetchData>>;\n}\n\nexport interface QueryResult<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends ObservableQueryFields<TData, TVariables> {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#client:member} */\n client: ApolloClient<any>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#observable:member} */\n observable: ObservableQuery<TData, TVariables>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: TData | undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#previousData:member} */\n previousData?: TData;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#error:member} */\n error?: ApolloError;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#loading:member} */\n loading: boolean;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#networkStatus:member} */\n networkStatus: NetworkStatus;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#called:member} */\n called: boolean;\n}\n\nexport interface QueryDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions<TData, TVariables> {\n children?: (result: QueryResult<TData, TVariables>) => ReactTypes.ReactNode;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface QueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions<TData, TVariables> {}\n\nexport interface LazyQueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseQueryOptions<TVariables, TData> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onCompleted:member} */\n onCompleted?: (data: TData) => void;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError) => void;\n\n /** @internal */\n defaultOptions?: Partial<WatchQueryOptions<TVariables, TData>>;\n}\nexport interface LazyQueryHookExecOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends LazyQueryHookOptions<TData, TVariables> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport type SuspenseQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface SuspenseQueryHookOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */\n client?: ApolloClient<any>;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy_suspense:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: SuspenseQueryHookFetchPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#queryKey:member} */\n queryKey?: string | number | any[];\n\n /**\n * {@inheritDoc @apollo/client!QueryOptionsDocumentation#skip_deprecated:member}\n *\n * @example Recommended usage of `skipToken`:\n * ```ts\n * import { skipToken, useSuspenseQuery } from '@apollo/client';\n *\n * const { data } = useSuspenseQuery(query, id ? { variables: { id } } : skipToken);\n * ```\n */\n skip?: boolean;\n}\n\nexport type BackgroundQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface BackgroundQueryHookOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> extends Pick<\n QueryHookOptions<TData, TVariables>,\n | \"client\"\n | \"variables\"\n | \"errorPolicy\"\n | \"context\"\n | \"canonizeResults\"\n | \"returnPartialData\"\n | \"refetchWritePolicy\"\n > {\n fetchPolicy?: BackgroundQueryHookFetchPolicy;\n queryKey?: string | number | any[];\n\n /**\n * {@inheritDoc @apollo/client!QueryOptionsDocumentation#skip_deprecated:member}\n *\n * @example Recommended usage of `skipToken`:\n * ```ts\n * import { skipToken, useBackgroundQuery } from '@apollo/client';\n *\n * const [queryRef] = useBackgroundQuery(query, id ? { variables: { id } } : skipToken);\n * ```\n */\n skip?: boolean;\n}\n\nexport type LoadableQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface LoadableQueryHookOptions {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */\n client?: ApolloClient<any>;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: LoadableQueryHookFetchPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#queryKey:member} */\n queryKey?: string | number | any[];\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n}\n\n/**\n * @deprecated This type will be removed in the next major version of Apollo Client\n */\nexport interface QueryLazyOptions<TVariables> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n}\n\n/**\n * @deprecated This type will be removed in the next major version of Apollo Client\n */\nexport type LazyQueryResult<\n TData,\n TVariables extends OperationVariables,\n> = QueryResult<TData, TVariables>;\n\n/**\n * @deprecated This type will be removed in the next major version of Apollo Client\n */\nexport type QueryTuple<\n TData,\n TVariables extends OperationVariables,\n> = LazyQueryResultTuple<TData, TVariables>;\n\nexport type LazyQueryExecFunction<\n TData,\n TVariables extends OperationVariables,\n> = (\n options?: Partial<LazyQueryHookExecOptions<TData, TVariables>>\n) => Promise<QueryResult<TData, TVariables>>;\n\nexport type LazyQueryResultTuple<\n TData,\n TVariables extends OperationVariables,\n> = [\n execute: LazyQueryExecFunction<TData, TVariables>,\n result: QueryResult<TData, TVariables>,\n];\n\n/* Mutation types */\n\nexport type RefetchQueriesFunction = (\n ...args: any[]\n) => InternalRefetchQueriesInclude;\n\nexport interface BaseMutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationSharedOptions<TData, TVariables, TContext, TCache> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#client:member} */\n client?: ApolloClient<object>;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onCompleted:member} */\n onCompleted?: (data: TData, clientOptions?: BaseMutationOptions) => void;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError, clientOptions?: BaseMutationOptions) => void;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#ignoreResults:member} */\n ignoreResults?: boolean;\n}\n\nexport interface MutationFunctionOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#mutation:member} */\n mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface MutationResult<TData = any> {\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#data:member} */\n data?: TData | null;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#error:member} */\n error?: ApolloError;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#loading:member} */\n loading: boolean;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#called:member} */\n called: boolean;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#client:member} */\n client: ApolloClient<object>;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#reset:member} */\n reset(): void;\n}\n\nexport declare type MutationFunction<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> = (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n) => Promise<FetchResult<TData>>;\n\nexport interface MutationHookOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {}\n\nexport interface MutationDataOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport type MutationTuple<\n TData,\n TVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> = [\n mutate: (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n // TODO This FetchResult<TData> seems strange here, as opposed to an\n // ApolloQueryResult<TData>\n ) => Promise<FetchResult<TData>>,\n result: MutationResult<TData>,\n];\n\n/* Subscription types */\n\nexport interface OnDataOptions<TData = any> {\n client: ApolloClient<object>;\n data: SubscriptionResult<TData>;\n}\n\nexport interface OnSubscriptionDataOptions<TData = any> {\n client: ApolloClient<object>;\n subscriptionData: SubscriptionResult<TData>;\n}\n\nexport interface BaseSubscriptionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> {\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#variables:member} */\n variables?: TVariables;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: FetchPolicy;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#shouldResubscribe:member} */\n shouldResubscribe?:\n | boolean\n | ((options: BaseSubscriptionOptions<TData, TVariables>) => boolean);\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#client:member} */\n client?: ApolloClient<object>;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#skip:member} */\n skip?: boolean;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onComplete:member} */\n onComplete?: () => void;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onData:member} */\n onData?: (options: OnDataOptions<TData>) => any;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onSubscriptionData:member} */\n onSubscriptionData?: (options: OnSubscriptionDataOptions<TData>) => any;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError) => void;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onSubscriptionComplete:member} */\n onSubscriptionComplete?: () => void;\n}\n\nexport interface SubscriptionResult<TData = any, TVariables = any> {\n /** {@inheritDoc @apollo/client!SubscriptionResultDocumentation#loading:member} */\n loading: boolean;\n /** {@inheritDoc @apollo/client!SubscriptionResultDocumentation#data:member} */\n data?: TData;\n /** {@inheritDoc @apollo/client!SubscriptionResultDocumentation#error:member} */\n error?: ApolloError;\n // This was added by the legacy useSubscription type, and is tested in unit\n // tests, but probably shouldn’t be added to the result.\n /**\n * @internal\n */\n variables?: TVariables;\n}\n\nexport interface SubscriptionHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions<TData, TVariables> {}\n\nexport interface SubscriptionDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions<TData, TVariables> {\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children?: null | ((result: SubscriptionResult<TData>) => JSX.Element | null);\n}\n\nexport interface SubscriptionCurrentObservable {\n query?: Observable<any>;\n subscription?: ObservableSubscription;\n}\n\n/**\nHelper type that allows using a type in a way that cannot be \"widened\" by inference on the value it is used on.\n\nThis type was first suggested [in this Github discussion](https://github.com/microsoft/TypeScript/issues/14829#issuecomment-504042546).\n\nExample usage:\n```ts\nexport function useQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: QueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> = Object.create(null),\n)\n```\nIn this case, `TData` and `TVariables` should be inferred from `query`, but never widened from something in `options`.\n\nSo, in this code example:\n```ts\ndeclare const typedNode: TypedDocumentNode<{ foo: string}, { bar: number }>\nconst { variables } = useQuery(typedNode, { variables: { bar: 4, nonExistingVariable: \"string\" } });\n```\nWithout the use of `NoInfer`, `variables` would now be of the type `{ bar: number, nonExistingVariable: \"string\" }`.\nWith `NoInfer`, it will instead give an error on `nonExistingVariable`.\n */\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/types/types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as ReactTypes from \"react\";\nimport type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type {\n Observable,\n ObservableSubscription,\n} from \"../../utilities/index.js\";\nimport type { FetchResult } from \"../../link/core/index.js\";\nimport type { ApolloError } from \"../../errors/index.js\";\nimport type {\n ApolloCache,\n ApolloClient,\n DefaultContext,\n FetchPolicy,\n NetworkStatus,\n ObservableQuery,\n OperationVariables,\n InternalRefetchQueriesInclude,\n WatchQueryOptions,\n WatchQueryFetchPolicy,\n SubscribeToMoreOptions,\n ApolloQueryResult,\n FetchMoreQueryOptions,\n ErrorPolicy,\n RefetchWritePolicy,\n} from \"../../core/index.js\";\nimport type {\n MutationSharedOptions,\n SharedWatchQueryOptions,\n} from \"../../core/watchQueryOptions.js\";\n\n/* QueryReference type */\n\nexport type { QueryReference } from \"../internal/index.js\";\n\n/* Common types */\n\nexport type { DefaultContext as Context } from \"../../core/index.js\";\n\nexport type CommonOptions<TOptions> = TOptions & {\n client?: ApolloClient<object>;\n};\n\n/* Query types */\n\nexport interface BaseQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n TData = any,\n> extends SharedWatchQueryOptions<TVariables, TData> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#ssr:member} */\n ssr?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */\n client?: ApolloClient<any>;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n}\n\nexport interface QueryFunctionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseQueryOptions<TVariables, TData> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#skip:member} */\n skip?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onCompleted:member} */\n onCompleted?: (data: TData) => void;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError) => void;\n\n // Default WatchQueryOptions for this useQuery, providing initial values for\n // unspecified options, superseding client.defaultOptions.watchQuery (option\n // by option, not whole), but never overriding options previously passed to\n // useQuery (or options added/modified later by other means).\n // TODO What about about default values that are expensive to evaluate?\n /** @internal */\n defaultOptions?: Partial<WatchQueryOptions<TVariables, TData>>;\n}\n\nexport interface ObservableQueryFields<\n TData,\n TVariables extends OperationVariables,\n> {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#startPolling:member} */\n startPolling: (pollInterval: number) => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#stopPolling:member} */\n stopPolling: () => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#subscribeToMore:member} */\n subscribeToMore: <\n TSubscriptionData = TData,\n TSubscriptionVariables extends OperationVariables = TVariables,\n >(\n options: SubscribeToMoreOptions<\n TData,\n TSubscriptionVariables,\n TSubscriptionData\n >\n ) => () => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#updateQuery:member} */\n updateQuery: <TVars extends OperationVariables = TVariables>(\n mapFn: (\n previousQueryResult: TData,\n options: Pick<WatchQueryOptions<TVars, TData>, \"variables\">\n ) => TData\n ) => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#refetch:member} */\n refetch: (\n variables?: Partial<TVariables>\n ) => Promise<ApolloQueryResult<TData>>;\n /** @internal */\n reobserve: (\n newOptions?: Partial<WatchQueryOptions<TVariables, TData>>,\n newNetworkStatus?: NetworkStatus\n ) => Promise<ApolloQueryResult<TData>>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#variables:member} */\n variables: TVariables | undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#fetchMore:member} */\n fetchMore: <\n TFetchData = TData,\n TFetchVars extends OperationVariables = TVariables,\n >(\n fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {\n updateQuery?: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult: TFetchData;\n variables: TFetchVars;\n }\n ) => TData;\n }\n ) => Promise<ApolloQueryResult<TFetchData>>;\n}\n\nexport interface QueryResult<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends ObservableQueryFields<TData, TVariables> {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#client:member} */\n client: ApolloClient<any>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#observable:member} */\n observable: ObservableQuery<TData, TVariables>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: TData | undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#previousData:member} */\n previousData?: TData;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#error:member} */\n error?: ApolloError;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#loading:member} */\n loading: boolean;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#networkStatus:member} */\n networkStatus: NetworkStatus;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#called:member} */\n called: boolean;\n}\n\nexport interface QueryDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions<TData, TVariables> {\n children?: (result: QueryResult<TData, TVariables>) => ReactTypes.ReactNode;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface QueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions<TData, TVariables> {}\n\nexport interface LazyQueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseQueryOptions<TVariables, TData> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onCompleted:member} */\n onCompleted?: (data: TData) => void;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError) => void;\n\n /** @internal */\n defaultOptions?: Partial<WatchQueryOptions<TVariables, TData>>;\n}\nexport interface LazyQueryHookExecOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends LazyQueryHookOptions<TData, TVariables> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport type SuspenseQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface SuspenseQueryHookOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */\n client?: ApolloClient<any>;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy_suspense:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: SuspenseQueryHookFetchPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#queryKey:member} */\n queryKey?: string | number | any[];\n\n /**\n * {@inheritDoc @apollo/client!QueryOptionsDocumentation#skip_deprecated:member}\n *\n * @example Recommended usage of `skipToken`:\n * ```ts\n * import { skipToken, useSuspenseQuery } from '@apollo/client';\n *\n * const { data } = useSuspenseQuery(query, id ? { variables: { id } } : skipToken);\n * ```\n */\n skip?: boolean;\n}\n\nexport type BackgroundQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface BackgroundQueryHookOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> extends Pick<\n QueryHookOptions<TData, TVariables>,\n | \"client\"\n | \"variables\"\n | \"errorPolicy\"\n | \"context\"\n | \"canonizeResults\"\n | \"returnPartialData\"\n | \"refetchWritePolicy\"\n > {\n fetchPolicy?: BackgroundQueryHookFetchPolicy;\n queryKey?: string | number | any[];\n\n /**\n * {@inheritDoc @apollo/client!QueryOptionsDocumentation#skip_deprecated:member}\n *\n * @example Recommended usage of `skipToken`:\n * ```ts\n * import { skipToken, useBackgroundQuery } from '@apollo/client';\n *\n * const [queryRef] = useBackgroundQuery(query, id ? { variables: { id } } : skipToken);\n * ```\n */\n skip?: boolean;\n}\n\nexport type LoadableQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface LoadableQueryHookOptions {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */\n client?: ApolloClient<any>;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: LoadableQueryHookFetchPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#queryKey:member} */\n queryKey?: string | number | any[];\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n}\n\n/**\n * @deprecated This type will be removed in the next major version of Apollo Client\n */\nexport interface QueryLazyOptions<TVariables> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n}\n\n/**\n * @deprecated This type will be removed in the next major version of Apollo Client\n */\nexport type LazyQueryResult<\n TData,\n TVariables extends OperationVariables,\n> = QueryResult<TData, TVariables>;\n\n/**\n * @deprecated This type will be removed in the next major version of Apollo Client\n */\nexport type QueryTuple<\n TData,\n TVariables extends OperationVariables,\n> = LazyQueryResultTuple<TData, TVariables>;\n\nexport type LazyQueryExecFunction<\n TData,\n TVariables extends OperationVariables,\n> = (\n options?: Partial<LazyQueryHookExecOptions<TData, TVariables>>\n) => Promise<QueryResult<TData, TVariables>>;\n\nexport type LazyQueryResultTuple<\n TData,\n TVariables extends OperationVariables,\n> = [\n execute: LazyQueryExecFunction<TData, TVariables>,\n result: QueryResult<TData, TVariables>,\n];\n\n/* Mutation types */\n\nexport type RefetchQueriesFunction = (\n ...args: any[]\n) => InternalRefetchQueriesInclude;\n\nexport interface BaseMutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationSharedOptions<TData, TVariables, TContext, TCache> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#client:member} */\n client?: ApolloClient<object>;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onCompleted:member} */\n onCompleted?: (data: TData, clientOptions?: BaseMutationOptions) => void;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError, clientOptions?: BaseMutationOptions) => void;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#ignoreResults:member} */\n ignoreResults?: boolean;\n}\n\nexport interface MutationFunctionOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#mutation:member} */\n mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface MutationResult<TData = any> {\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#data:member} */\n data?: TData | null;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#error:member} */\n error?: ApolloError;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#loading:member} */\n loading: boolean;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#called:member} */\n called: boolean;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#client:member} */\n client: ApolloClient<object>;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#reset:member} */\n reset(): void;\n}\n\nexport declare type MutationFunction<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> = (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n) => Promise<FetchResult<TData>>;\n\nexport interface MutationHookOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {}\n\nexport interface MutationDataOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport type MutationTuple<\n TData,\n TVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> = [\n mutate: (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n // TODO This FetchResult<TData> seems strange here, as opposed to an\n // ApolloQueryResult<TData>\n ) => Promise<FetchResult<TData>>,\n result: MutationResult<TData>,\n];\n\n/* Subscription types */\n\nexport interface OnDataOptions<TData = any> {\n client: ApolloClient<object>;\n data: SubscriptionResult<TData>;\n}\n\nexport interface OnSubscriptionDataOptions<TData = any> {\n client: ApolloClient<object>;\n subscriptionData: SubscriptionResult<TData>;\n}\n\nexport interface BaseSubscriptionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> {\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#variables:member} */\n variables?: TVariables;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: FetchPolicy;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#shouldResubscribe:member} */\n shouldResubscribe?:\n | boolean\n | ((options: BaseSubscriptionOptions<TData, TVariables>) => boolean);\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#client:member} */\n client?: ApolloClient<object>;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#skip:member} */\n skip?: boolean;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onComplete:member} */\n onComplete?: () => void;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onData:member} */\n onData?: (options: OnDataOptions<TData>) => any;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onSubscriptionData:member} */\n onSubscriptionData?: (options: OnSubscriptionDataOptions<TData>) => any;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError) => void;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onSubscriptionComplete:member} */\n onSubscriptionComplete?: () => void;\n}\n\nexport interface SubscriptionResult<TData = any, TVariables = any> {\n /** {@inheritDoc @apollo/client!SubscriptionResultDocumentation#loading:member} */\n loading: boolean;\n /** {@inheritDoc @apollo/client!SubscriptionResultDocumentation#data:member} */\n data?: TData;\n /** {@inheritDoc @apollo/client!SubscriptionResultDocumentation#error:member} */\n error?: ApolloError;\n // This was added by the legacy useSubscription type, and is tested in unit\n // tests, but probably shouldn’t be added to the result.\n /**\n * @internal\n */\n variables?: TVariables;\n}\n\nexport interface SubscriptionHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions<TData, TVariables> {}\n\nexport interface SubscriptionDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions<TData, TVariables> {\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children?:\n | null\n | ((result: SubscriptionResult<TData>) => ReactTypes.ReactNode);\n}\n\nexport interface SubscriptionCurrentObservable {\n query?: Observable<any>;\n subscription?: ObservableSubscription;\n}\n\n/**\nHelper type that allows using a type in a way that cannot be \"widened\" by inference on the value it is used on.\n\nThis type was first suggested [in this Github discussion](https://github.com/microsoft/TypeScript/issues/14829#issuecomment-504042546).\n\nExample usage:\n```ts\nexport function useQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: QueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> = Object.create(null),\n)\n```\nIn this case, `TData` and `TVariables` should be inferred from `query`, but never widened from something in `options`.\n\nSo, in this code example:\n```ts\ndeclare const typedNode: TypedDocumentNode<{ foo: string}, { bar: number }>\nconst { variables } = useQuery(typedNode, { variables: { bar: 4, nonExistingVariable: \"string\" } });\n```\nWithout the use of `NoInfer`, `variables` would now be of the type `{ bar: number, nonExistingVariable: \"string\" }`.\nWith `NoInfer`, it will instead give an error on `nonExistingVariable`.\n */\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globals.cjs","sources":["../../version.js","maybe.js","global.js","../common/makeUniqueId.js","../common/stringifyForDisplay.js","invariantWrappers.js","index.js"],"sourcesContent":["export var version = \"3.10.
|
|
1
|
+
{"version":3,"file":"globals.cjs","sources":["../../version.js","maybe.js","global.js","../common/makeUniqueId.js","../common/stringifyForDisplay.js","invariantWrappers.js","index.js"],"sourcesContent":["export var version = \"3.10.3\";\n//# sourceMappingURL=version.js.map","export function maybe(thunk) {\n try {\n return thunk();\n }\n catch (_a) { }\n}\n//# sourceMappingURL=maybe.js.map","import { maybe } from \"./maybe.js\";\nexport default (maybe(function () { return globalThis; }) ||\n maybe(function () { return window; }) ||\n maybe(function () { return self; }) ||\n maybe(function () { return global; }) || // We don't expect the Function constructor ever to be invoked at runtime, as\n// long as at least one of globalThis, window, self, or global is defined, so\n// we are under no obligation to make it easy for static analysis tools to\n// detect syntactic usage of the Function constructor. If you think you can\n// improve your static analysis to detect this obfuscation, think again. This\n// is an arms race you cannot win, at least not in JavaScript.\nmaybe(function () {\n return maybe.constructor(\"return this\")();\n}));\n//# sourceMappingURL=global.js.map","var prefixCounts = new Map();\n// These IDs won't be globally unique, but they will be unique within this\n// process, thanks to the counter, and unguessable thanks to the random suffix.\nexport function makeUniqueId(prefix) {\n var count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return \"\".concat(prefix, \":\").concat(count, \":\").concat(Math.random().toString(36).slice(2));\n}\n//# sourceMappingURL=makeUniqueId.js.map","import { makeUniqueId } from \"./makeUniqueId.js\";\nexport function stringifyForDisplay(value, space) {\n if (space === void 0) { space = 0; }\n var undefId = makeUniqueId(\"stringifyForDisplay\");\n return JSON.stringify(value, function (key, value) {\n return value === void 0 ? undefId : value;\n }, space)\n .split(JSON.stringify(undefId))\n .join(\"<undefined>\");\n}\n//# sourceMappingURL=stringifyForDisplay.js.map","import { invariant as originalInvariant, InvariantError } from \"ts-invariant\";\nimport { version } from \"../../version.js\";\nimport global from \"./global.js\";\nimport { stringifyForDisplay } from \"../common/stringifyForDisplay.js\";\nfunction wrap(fn) {\n return function (message) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (typeof message === \"number\") {\n var arg0 = message;\n message = getHandledErrorMsg(arg0);\n if (!message) {\n message = getFallbackErrorMsg(arg0, args);\n args = [];\n }\n }\n fn.apply(void 0, [message].concat(args));\n };\n}\nvar invariant = Object.assign(function invariant(condition, message) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n if (!condition) {\n originalInvariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args));\n }\n}, {\n debug: wrap(originalInvariant.debug),\n log: wrap(originalInvariant.log),\n warn: wrap(originalInvariant.warn),\n error: wrap(originalInvariant.error),\n});\n/**\n * Returns an InvariantError.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n * String substitutions with %s are supported and will also return\n * pretty-stringified objects.\n * Excess `optionalParams` will be swallowed.\n */\nfunction newInvariantError(message) {\n var optionalParams = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n optionalParams[_i - 1] = arguments[_i];\n }\n return new InvariantError(getHandledErrorMsg(message, optionalParams) ||\n getFallbackErrorMsg(message, optionalParams));\n}\nvar ApolloErrorMessageHandler = Symbol.for(\"ApolloErrorMessageHandler_\" + version);\nfunction stringify(arg) {\n return typeof arg == \"string\" ? arg : (stringifyForDisplay(arg, 2).slice(0, 1000));\n}\nfunction getHandledErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return (global[ApolloErrorMessageHandler] &&\n global[ApolloErrorMessageHandler](message, messageArgs.map(stringify)));\n}\nfunction getFallbackErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return \"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#\".concat(encodeURIComponent(JSON.stringify({\n version: version,\n message: message,\n args: messageArgs.map(stringify),\n })));\n}\nexport { invariant, InvariantError, newInvariantError, ApolloErrorMessageHandler, };\n//# sourceMappingURL=invariantWrappers.js.map","import { invariant, newInvariantError, InvariantError, } from \"./invariantWrappers.js\";\nexport { maybe } from \"./maybe.js\";\nexport { default as global } from \"./global.js\";\nexport { invariant, newInvariantError, InvariantError };\n/**\n * @deprecated we do not use this internally anymore,\n * it is just exported for backwards compatibility\n */\n// this file is extempt from automatic `__DEV__` replacement\n// so we have to write it out here\n// @ts-ignore\nexport var DEV = globalThis.__DEV__ !== false;\nexport { DEV as __DEV__ };\n//# sourceMappingURL=index.js.map"],"names":["originalInvariant","InvariantError","global"],"mappings":";;;;;;AAAO,IAAI,OAAO,GAAG,QAAQ;;ACAtB,SAAS,KAAK,CAAC,KAAK,EAAE;AAC7B,IAAI,IAAI;AACR,QAAQ,OAAO,KAAK,EAAE,CAAC;AACvB,KAAK;AACL,IAAI,OAAO,EAAE,EAAE,GAAG;AAClB;;ACJA,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,UAAU,CAAC,EAAE,CAAC;AACzD,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,MAAM,CAAC,EAAE,CAAC;AACzC,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;AACvC,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,MAAM,CAAC,EAAE,CAAC;AAMzC,KAAK,CAAC,YAAY;AAClB,IAAI,OAAO,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC;AAC9C,CAAC,CAAC;;ACZF,IAAI,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAGtB,SAAS,YAAY,CAAC,MAAM,EAAE;AACrC,IAAI,IAAI,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC9C,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;AACxC,IAAI,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACjG;;ACNO,SAAS,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE;AAClD,IAAI,IAA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yB,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,GAAG,OAAO,CAAC,CAAC;AACnF,SAAS,SAAS,CAAC,GAAG,EAAE;AACxB,IAAI,OAAO,OAAO,GAAG,IAAI,QAAQ,GAAG,GAAG,IAAI,mBAAmB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AACvF,CAAC;AACD,SAAS,kBAAkB,CAAC,OAAO,EAAE,WAAW,EAAE;AAClD,IAAI,IAAI,WAAW,KAAK,KAAK,CAAC,EAAE,EAAE,WAAW,GAAG,EAAE,CAAC,EAAE;AACrD,IAAI,IAAI,CAAC,OAAO;AAChB,QAAQ,OAAO;AACf,IAAI,QAAQC,QAAM,CAAC,yBAAyB,CAAC;AAC7C,QAAQA,QAAM,CAAC,yBAAyB,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE;AAChF,CAAC;AACD,SAAS,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE;AACnD,IAAI,IAAI,WAAW,KAAK,KAAK,CAAC,EAAE,EAAE,WAAW,GAAG,EAAE,CAAC,EAAE;AACrD,IAAI,IAAI,CAAC,OAAO;AAChB,QAAQ,OAAO;AACf,IAAI,OAAO,8FAA8F,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC;AACnJ,QAAQ,OAAO,EAAE,OAAO;AACxB,QAAQ,OAAO,EAAE,OAAO;AACxB,QAAQ,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC;AACxC,KAAK,CAAC,CAAC,CAAC,CAAC;AACT;;AC9DU,IAAC,GAAG,GAAG,UAAU,CAAC,OAAO,KAAK;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Observable } from "../../index.js";
|
|
2
2
|
import type { CreateMultipartSubscriptionOptions } from "../shared.js";
|
|
3
3
|
export declare function createFetchMultipartSubscription(uri: string, { fetch: preferredFetch, headers }?: CreateMultipartSubscriptionOptions): ({ query, variables, }: {
|
|
4
|
-
query?: string
|
|
4
|
+
query?: string;
|
|
5
5
|
variables: undefined | Record<string, any>;
|
|
6
6
|
}) => Observable<unknown>;
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var version = "3.10.
|
|
1
|
+
export var version = "3.10.3";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|