UNPKG

2.39 kBSource Map (JSON)View Raw
1{"version":3,"file":"context.cjs","sources":["index.js"],"sourcesContent":["import { __rest } from \"tslib\";\nimport { ApolloLink } from '../core';\nimport { Observable } from '../../utilities';\nexport function setContext(setter) {\n return new ApolloLink(function (operation, forward) {\n var request = __rest(operation, []);\n return new Observable(function (observer) {\n var handle;\n var closed = false;\n Promise.resolve(request)\n .then(function (req) { return setter(req, operation.getContext()); })\n .then(operation.setContext)\n .then(function () {\n if (closed)\n return;\n handle = forward(operation).subscribe({\n next: observer.next.bind(observer),\n error: observer.error.bind(observer),\n complete: observer.complete.bind(observer),\n });\n })\n .catch(observer.error.bind(observer));\n return function () {\n closed = true;\n if (handle)\n handle.unsubscribe();\n };\n });\n });\n}\n//# sourceMappingURL=index.js.map"],"names":["ApolloLink","__rest","Observable"],"mappings":";;;;;;;;AAGO,SAAS,UAAU,CAAC,MAAM,EAAE;AACnC,IAAI,OAAO,IAAIA,eAAU,CAAC,UAAU,SAAS,EAAE,OAAO,EAAE;AACxD,QAAQ,IAAI,OAAO,GAAGC,YAAM,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAC5C,QAAQ,OAAO,IAAIC,oBAAU,CAAC,UAAU,QAAQ,EAAE;AAClD,YAAY,IAAI,MAAM,CAAC;AACvB,YAAY,IAAI,MAAM,GAAG,KAAK,CAAC;AAC/B,YAAY,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;AACpC,iBAAiB,IAAI,CAAC,UAAU,GAAG,EAAE,EAAE,OAAO,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC;AACrF,iBAAiB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;AAC3C,iBAAiB,IAAI,CAAC,YAAY;AAClC,gBAAgB,IAAI,MAAM;AAC1B,oBAAoB,OAAO;AAC3B,gBAAgB,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;AACtD,oBAAoB,IAA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