Odoo GraphQL Subscription using Node, Express JS for Sample
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
24 KiB

4 months ago
{"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.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: