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
17 KiB

4 months ago
{"version":3,"file":"batch-http.cjs","sources":["../utils/filterOperationVariables.js","batchHttpLink.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { visit } from \"graphql\";\nexport function filterOperationVariables(variables, query) {\n var result = __assign({}, variables);\n var unusedNames = new Set(Object.keys(variables));\n visit(query, {\n Variable: function (node, _key, parent) {\n // A variable type definition at the top level of a query is not\n // enough to silence server-side errors about the variable being\n // unused, so variable definitions do not count as usage.\n // https://spec.graphql.org/draft/#sec-All-Variables-Used\n if (parent &&\n parent.kind !== \"VariableDefinition\") {\n unusedNames.delete(node.name.value);\n }\n },\n });\n unusedNames.forEach(function (name) {\n delete result[name];\n });\n return result;\n}\n//# sourceMappingURL=filterOperationVariables.js.map","import { __assign, __extends, __rest } from \"tslib\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable, hasDirectives, removeClientSetsFromDocument, } from \"../../utilities/index.js\";\nimport { fromError } from \"../utils/index.js\";\nimport { serializeFetchParameter, selectURI, parseAndCheckHttpResponse, checkFetcher, selectHttpOptionsAndBodyInternal, defaultPrinter, fallbackHttpConfig, } from \"../http/index.js\";\nimport { BatchLink } from \"../batch/index.js\";\nimport { filterOperationVariables } from \"../utils/filterOperationVariables.js\";\n/**\n * Transforms Operation for into HTTP results.\n * context can include the headers property, which will be passed to the fetch function\n */\nvar BatchHttpLink = /** @class */ (function (_super) {\n __extends(BatchHttpLink, _super);\n function BatchHttpLink(fetchParams) {\n var _this = _super.call(this) || this;\n var _a = fetchParams || {}, _b = _a.uri, uri = _b === void 0 ? \"/graphql\" : _b, \n // use default global fetch if nothing is passed in\n fetcher = _a.fetch, _c = _a.print, print = _c === void 0 ? defaultPrinter : _c, includeExtensions = _a.includeExtensions, preserveHeaderCase = _a.preserveHeaderCase, batchInterval = _a.batchInterval, batchDebounce = _a.batchDebounce, batchMax = _a.batchMax, batchKey = _a.batchKey, _d = _a.includeUnusedVariables, includeUnusedVariables = _d === void 0 ? false : _d, requestOptions = __rest(_a, [\"uri\", \"fetch\", \"print\", \"includeExtensions\", \"preserveHeaderCase\", \"batchInterval\", \"batchDebounce\", \"batchMax\", \"batchKey\", \"includeUnusedVariables\"]);\n // dev warnings to ensure fetch is present\n checkFetcher(fetcher);\n //fetcher is set here rather than the destructuring to ensure fetch is\n //declared before referencing it. Reference in the destructuring would cause\n //a ReferenceError\n if (!fetcher) {\n fetcher = fetch;\n }\n var linkConfig = {\n http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase },\n options: requestOptions.fetchOptions,\n credentials: requestOptions.credentials,\n headers: requestOptions.headers,\n };\n _this.batchDebounce = batchDebounce;\n _this.batchInterval = batchInterval || 10;\n _this.batchMax = batchMax || 10;\n var batchHandler = function (operations) {\n var chosenURI = selectURI(operations[0], uri);\n var context = operations[0].getContext();\n var clientAwarenessHeaders = {};\n if (context.clientAwareness) {\n var _a = context.clientAwareness, name_1 = _a.name, version = _a.version;\n if (name_1) {\n clientAwarenessHeaders[\"apollographql-client-name\"] = name_1;\n }\n if (version) {\n clientAwarenessHeaders[\"apollographql-client-version\"] = version;\n