@apollo/client 3.14.0 → 3.14.1

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.
Files changed (121) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/apollo-client.cjs +76 -72
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/cache/cache.cjs +14 -41
  6. package/cache/cache.cjs.map +1 -1
  7. package/cache/cache.cjs.native.js +14 -41
  8. package/cache/core/cache.js +1 -1
  9. package/cache/core/cache.js.map +1 -1
  10. package/cache/inmemory/inMemoryCache.js +1 -1
  11. package/cache/inmemory/inMemoryCache.js.map +1 -1
  12. package/core/ApolloClient.js +1 -1
  13. package/core/ApolloClient.js.map +1 -1
  14. package/core/ObservableQuery.js +1 -1
  15. package/core/ObservableQuery.js.map +1 -1
  16. package/core/QueryInfo.js +1 -1
  17. package/core/QueryInfo.js.map +1 -1
  18. package/core/QueryManager.js +1 -1
  19. package/core/QueryManager.js.map +1 -1
  20. package/core/core.cjs +29 -56
  21. package/core/core.cjs.map +1 -1
  22. package/core/core.cjs.native.js +29 -56
  23. package/dev/dev.cjs +49 -53
  24. package/dev/dev.cjs.map +1 -1
  25. package/dev/dev.cjs.native.js +49 -53
  26. package/invariantErrorCodes.js +48 -53
  27. package/link/core/ApolloLink.js +1 -1
  28. package/link/core/ApolloLink.js.map +1 -1
  29. package/link/core/core.cjs +1 -15
  30. package/link/core/core.cjs.map +1 -1
  31. package/link/core/core.cjs.native.js +1 -15
  32. package/package.json +1 -1
  33. package/react/components/components.cjs +2 -14
  34. package/react/components/components.cjs.map +1 -1
  35. package/react/components/components.cjs.native.js +2 -14
  36. package/react/hoc/graphql.js +1 -1
  37. package/react/hoc/graphql.js.map +1 -1
  38. package/react/hoc/hoc.cjs +12 -31
  39. package/react/hoc/hoc.cjs.map +1 -1
  40. package/react/hoc/hoc.cjs.native.js +12 -31
  41. package/react/hoc/mutation-hoc.js +1 -1
  42. package/react/hoc/mutation-hoc.js.map +1 -1
  43. package/react/hoc/query-hoc.js +1 -1
  44. package/react/hoc/query-hoc.js.map +1 -1
  45. package/react/hoc/subscription-hoc.js +1 -1
  46. package/react/hoc/subscription-hoc.js.map +1 -1
  47. package/react/hooks/hooks.cjs +26 -52
  48. package/react/hooks/hooks.cjs.map +1 -1
  49. package/react/hooks/hooks.cjs.native.js +26 -52
  50. package/react/hooks/internal/useWarnRemoved.d.ts +1 -1
  51. package/react/hooks/internal/useWarnRemoved.js +1 -1
  52. package/react/hooks/internal/useWarnRemoved.js.map +1 -1
  53. package/react/hooks/internal/useWarnRemovedOption.d.ts +2 -1
  54. package/react/hooks/internal/useWarnRemovedOption.js +7 -5
  55. package/react/hooks/internal/useWarnRemovedOption.js.map +1 -1
  56. package/react/hooks/useApolloClient.js +1 -1
  57. package/react/hooks/useBackgroundQuery.js +1 -1
  58. package/react/hooks/useBackgroundQuery.js.map +1 -1
  59. package/react/hooks/useFragment.js +1 -1
  60. package/react/hooks/useFragment.js.map +1 -1
  61. package/react/hooks/useLazyQuery.js +3 -3
  62. package/react/hooks/useLazyQuery.js.map +1 -1
  63. package/react/hooks/useLoadableQuery.js +3 -3
  64. package/react/hooks/useLoadableQuery.js.map +1 -1
  65. package/react/hooks/useQuery.js +3 -3
  66. package/react/hooks/useQuery.js.map +1 -1
  67. package/react/hooks/useSubscription.js +3 -3
  68. package/react/hooks/useSuspenseQuery.js +3 -3
  69. package/react/hooks/useSuspenseQuery.js.map +1 -1
  70. package/react/hooks/useSyncExternalStore.js +1 -1
  71. package/react/internal/cache/QueryReference.js +2 -2
  72. package/react/internal/cache/QueryReference.js.map +1 -1
  73. package/react/internal/internal.cjs +3 -14
  74. package/react/internal/internal.cjs.map +1 -1
  75. package/react/internal/internal.cjs.native.js +3 -14
  76. package/react/parser/index.js +7 -7
  77. package/react/parser/index.js.map +1 -1
  78. package/react/parser/parser.cjs +9 -29
  79. package/react/parser/parser.cjs.map +1 -1
  80. package/react/parser/parser.cjs.native.js +9 -29
  81. package/react/query-preloader/createQueryPreloader.js +1 -1
  82. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  83. package/react/react.cjs +4 -31
  84. package/react/react.cjs.map +1 -1
  85. package/react/react.cjs.native.js +4 -31
  86. package/testing/core/core.cjs +4 -4
  87. package/testing/core/core.cjs.map +1 -1
  88. package/testing/core/core.cjs.native.js +4 -4
  89. package/testing/core/mocking/mockLink.d.ts +13 -0
  90. package/testing/core/mocking/mockLink.js +4 -4
  91. package/testing/core/mocking/mockLink.js.map +1 -1
  92. package/testing/internal/disposables/index.d.ts +1 -0
  93. package/testing/internal/disposables/index.js +1 -0
  94. package/testing/internal/disposables/index.js.map +1 -1
  95. package/testing/internal/disposables/withMutedDeprecations.d.ts +4 -0
  96. package/testing/internal/disposables/withMutedDeprecations.js +13 -0
  97. package/testing/internal/disposables/withMutedDeprecations.js.map +1 -0
  98. package/testing/react/MockedProvider.js +1 -1
  99. package/testing/react/MockedProvider.js.map +1 -1
  100. package/testing/testing.cjs +5 -32
  101. package/testing/testing.cjs.map +1 -1
  102. package/testing/testing.cjs.native.js +5 -32
  103. package/utilities/deprecation/index.d.ts +0 -3
  104. package/utilities/deprecation/index.js +4 -12
  105. package/utilities/deprecation/index.js.map +1 -1
  106. package/utilities/globals/globals.cjs +1 -1
  107. package/utilities/globals/globals.cjs.map +1 -1
  108. package/utilities/globals/globals.cjs.native.js +1 -1
  109. package/utilities/graphql/DocumentTransform.js +1 -1
  110. package/utilities/graphql/directives.js +7 -7
  111. package/utilities/graphql/fragments.js +3 -3
  112. package/utilities/graphql/getFromAST.js +8 -8
  113. package/utilities/graphql/storeUtils.js +1 -1
  114. package/utilities/graphql/transform.js +2 -2
  115. package/utilities/index.d.ts +2 -0
  116. package/utilities/index.js +1 -0
  117. package/utilities/index.js.map +1 -1
  118. package/utilities/utilities.cjs +54 -22
  119. package/utilities/utilities.cjs.map +1 -1
  120. package/utilities/utilities.cjs.native.js +54 -22
  121. package/version.js +1 -1
@@ -4,33 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var globals = require('../../utilities/globals');
6
6
  var utilities = require('../../utilities');
7
- var tslib = require('tslib');
8
- var optimism = require('optimism');
7
+ require('tslib');
9
8
 
10
9
  var globalCaches = {};
11
10
  function registerGlobalCache(name, getSize) {
12
11
  globalCaches[name] = getSize;
13
12
  }
14
13
 
15
- var muteAllDeprecations = Symbol.for("apollo.deprecations");
16
- var global = globals.global;
17
- var slot = new optimism.Slot();
18
- function isMuted(name) {
19
- return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);
20
- }
21
- function muteDeprecations(name) {
22
- var args = [];
23
- for (var _i = 1; _i < arguments.length; _i++) {
24
- args[_i - 1] = arguments[_i];
25
- }
26
- return slot.withValue.apply(slot, tslib.__spreadArray([Array.isArray(name) ? name : [name]], args, false));
27
- }
28
- function warnDeprecated(name, cb) {
29
- if (!isMuted(name)) {
30
- cb();
31
- }
32
- }
33
-
34
14
  exports.DocumentType = void 0;
35
15
  (function (DocumentType) {
36
16
  DocumentType[DocumentType["Query"] = 0] = "Query";
@@ -54,8 +34,8 @@ function operationName(type) {
54
34
  return name;
55
35
  }
56
36
  function parser(document) {
57
- warnDeprecated("parser", function () {
58
- globalThis.__DEV__ !== false && globals.invariant.warn(94);
37
+ utilities.warnDeprecated("parser", function () {
38
+ globalThis.__DEV__ !== false && globals.invariant.warn(93);
59
39
  });
60
40
  if (!cache) {
61
41
  cache = new utilities.AutoCleanedWeakCache(utilities.cacheSizes.parser || 1000 );
@@ -64,7 +44,7 @@ function parser(document) {
64
44
  if (cached)
65
45
  return cached;
66
46
  var variables, type, name;
67
- globals.invariant(!!document && !!document.kind, 95, document);
47
+ globals.invariant(!!document && !!document.kind, 94, document);
68
48
  var fragments = [];
69
49
  var queries = [];
70
50
  var mutations = [];
@@ -92,10 +72,10 @@ function parser(document) {
92
72
  globals.invariant(!fragments.length ||
93
73
  queries.length ||
94
74
  mutations.length ||
95
- subscriptions.length, 96);
75
+ subscriptions.length, 95);
96
76
  globals.invariant(
97
77
  queries.length + mutations.length + subscriptions.length <= 1,
98
- 97,
78
+ 96,
99
79
  document,
100
80
  queries.length,
101
81
  subscriptions.length,
@@ -107,7 +87,7 @@ function parser(document) {
107
87
  var definitions = queries.length ? queries
108
88
  : mutations.length ? mutations
109
89
  : subscriptions;
110
- globals.invariant(definitions.length === 1, 98, document, definitions.length);
90
+ globals.invariant(definitions.length === 1, 97, document, definitions.length);
111
91
  var definition = definitions[0];
112
92
  variables = definition.variableDefinitions || [];
113
93
  if (definition.name && definition.name.kind === "Name") {
@@ -127,12 +107,12 @@ if (globalThis.__DEV__ !== false) {
127
107
  registerGlobalCache("parser", function () { return (cache ? cache.size : 0); });
128
108
  }
129
109
  function verifyDocumentType(document, type) {
130
- var operation = muteDeprecations("parser", parser, [document]);
110
+ var operation = utilities.muteDeprecations("parser", parser, [document]);
131
111
  var requiredOperationName = operationName(type);
132
112
  var usedOperationName = operationName(operation.type);
133
113
  globals.invariant(
134
114
  operation.type === type,
135
- 99,
115
+ 98,
136
116
  requiredOperationName,
137
117
  requiredOperationName,
138
118
  usedOperationName
@@ -1 +1 @@
1
- {"version":3,"file":"parser.cjs","sources":["../../utilities/caching/getMemoryInternals.js","../../utilities/deprecation/index.js","index.js"],"sourcesContent":["import { __assign, __spreadArray } from \"tslib\";\nimport { cacheSizes } from \"./sizes.js\";\nvar globalCaches = {};\nexport function registerGlobalCache(name, getSize) {\n globalCaches[name] = getSize;\n}\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloClientMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getInMemoryCacheMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloCacheMemoryInternals\n : undefined;\nfunction getCurrentCacheSizes() {\n // `defaultCacheSizes` is a `const enum` that will be inlined during build, so we have to reconstruct it's shape here\n var defaults = {\n parser: 1000 /* defaultCacheSizes[\"parser\"] */,\n canonicalStringify: 1000 /* defaultCacheSizes[\"canonicalStringify\"] */,\n print: 2000 /* defaultCacheSizes[\"print\"] */,\n \"documentTransform.cache\": 2000 /* defaultCacheSizes[\"documentTransform.cache\"] */,\n \"queryManager.getDocumentInfo\": 2000 /* defaultCacheSizes[\"queryManager.getDocumentInfo\"] */,\n \"PersistedQueryLink.persistedQueryHashes\": 2000 /* defaultCacheSizes[\"PersistedQueryLink.persistedQueryHashes\"] */,\n \"fragmentRegistry.transform\": 2000 /* defaultCacheSizes[\"fragmentRegistry.transform\"] */,\n \"fragmentRegistry.lookup\": 1000 /* defaultCacheSizes[\"fragmentRegistry.lookup\"] */,\n \"fragmentRegistry.findFragmentSpreads\": 4000 /* defaultCacheSizes[\"fragmentRegistry.findFragmentSpreads\"] */,\n \"cache.fragmentQueryDocuments\": 1000 /* defaultCacheSizes[\"cache.fragmentQueryDocuments\"] */,\n \"removeTypenameFromVariables.getVariableDefinitions\": 2000 /* defaultCacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"] */,\n \"inMemoryCache.maybeBroadcastWatch\": 5000 /* defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] */,\n \"inMemoryCache.executeSelectionSet\": 50000 /* defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"] */,\n \"inMemoryCache.executeSubSelectedArray\": 10000 /* defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"] */,\n };\n return Object.fromEntries(Object.entries(defaults).map(function (_a) {\n var k = _a[0], v = _a[1];\n return [\n k,\n cacheSizes[k] || v,\n ];\n }));\n}\nfunction _getApolloClientMemoryInternals() {\n var _a, _b, _c, _d, _e;\n if (!(globalThis.__DEV__ !== false))\n throw new Error(\"only supported in development mode\");\n return {\n limits: getCurrentCacheSizes(),\n sizes: __assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: {\n getDocumentInfo: this[\"queryManager\"][\"transformCache\"].size,\n documentTransforms: transformInfo(this[\"queryManager\"].documentTransform),\n } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)),\n };\n}\nfunction _getApolloCacheMemoryInternals() {\n return {\n cache: {\n fragmentQueryDocuments: getWrapperInformation(this[\"getFragmentDoc\"]),\n },\n };\n}\nfunction _getInMemoryCacheMemoryInternals() {\n var fragments = this.config.fragments;\n return __assign(__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this[\"addTypenameTransform\"]), inMemoryCache: {\n executeSelectionSet: getWrapperInformation(this[\"storeReader\"][\"executeSelectionSet\"]),\n executeSubSelectedArray: getWrapperInformation(this[\"storeReader\"][\"executeSubSelectedArray\"]),\n maybeBroadcastWatch: getWrapperInformation(this[\"maybeBroadcastWatch\"]),\n }, fragmentRegistry: {\n findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads),\n lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup),\n transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform),\n } });\n}\nfunction isWrapper(f) {\n return !!f && \"dirtyKey\" in f;\n}\nfunction getWrapperInformation(f) {\n return isWrapper(f) ? f.size : undefined;\n}\nfunction isDefined(value) {\n return value != null;\n}\nfunction transformInfo(transform) {\n return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); });\n}\nfunction recurseTransformInfo(transform) {\n return transform ?\n __spreadArray(__spreadArray([\n getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform[\"performWork\"])\n ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"left\"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"right\"]), true).filter(isDefined)\n : [];\n}\nfunction linkInfo(link) {\n var _a;\n return link ?\n __spreadArray(__spreadArray([\n (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link)\n ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined)\n : [];\n}\n//# sourceMappingURL=getMemoryInternals.js.map","import { __spreadArray } from \"tslib\";\nimport { Slot } from \"optimism\";\nimport { invariant, global as untypedGlobal } from \"../globals/index.js\";\nvar muteAllDeprecations = Symbol.for(\"apollo.deprecations\");\nvar global = untypedGlobal;\nvar slot = new Slot();\nfunction isMuted(name) {\n return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);\n}\nexport function muteDeprecations(name) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n return slot.withValue.apply(slot, __spreadArray([Array.isArray(name) ? name : [name]], args, false));\n}\nexport function warnRemovedOption(options, name, callSite, recommendation) {\n if (recommendation === void 0) { recommendation = \"Please remove this option.\"; }\n warnDeprecated(name, function () {\n if (name in options) {\n globalThis.__DEV__ !== false && invariant.warn(104, callSite, name, recommendation);\n }\n });\n}\nexport function warnDeprecated(name, cb) {\n if (!isMuted(name)) {\n cb();\n }\n}\nexport function withDisabledDeprecations() {\n var _a;\n var prev = global[muteAllDeprecations];\n global[muteAllDeprecations] = true;\n return _a = {},\n _a[Symbol.dispose] = function () {\n global[muteAllDeprecations] = prev;\n },\n _a;\n}\n//# sourceMappingURL=index.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport { AutoCleanedWeakCache, cacheSizes, } from \"../../utilities/index.js\";\nimport { registerGlobalCache } from \"../../utilities/caching/getMemoryInternals.js\";\nimport { muteDeprecations, warnDeprecated, } from \"../../utilities/deprecation/index.js\";\nexport var DocumentType;\n(function (DocumentType) {\n DocumentType[DocumentType[\"Query\"] = 0] = \"Query\";\n DocumentType[DocumentType[\"Mutation\"] = 1] = \"Mutation\";\n DocumentType[DocumentType[\"Subscription\"] = 2] = \"Subscription\";\n})(DocumentType || (DocumentType = {}));\nvar cache;\nexport function operationName(type) {\n var name;\n switch (type) {\n case DocumentType.Query:\n name = \"Query\";\n break;\n case DocumentType.Mutation:\n name = \"Mutation\";\n break;\n case DocumentType.Subscription:\n name = \"Subscription\";\n break;\n }\n return name;\n}\n/**\n * @deprecated `parser` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Remove all usages of `parser` as it is an internal implementation detail.\n */\nexport function parser(document) {\n warnDeprecated(\"parser\", function () {\n globalThis.__DEV__ !== false && invariant.warn(94);\n });\n if (!cache) {\n cache = new AutoCleanedWeakCache(cacheSizes.parser || 1000 /* defaultCacheSizes.parser */);\n }\n var cached = cache.get(document);\n if (cached)\n return cached;\n var variables, type, name;\n invariant(!!document && !!document.kind, 95, document);\n var fragments = [];\n var queries = [];\n var mutations = [];\n var subscriptions = [];\n for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) {\n var x = _a[_i];\n if (x.kind === \"FragmentDefinition\") {\n fragments.push(x);\n continue;\n }\n if (x.kind === \"OperationDefinition\") {\n switch (x.operation) {\n case \"query\":\n queries.push(x);\n break;\n case \"mutation\":\n mutations.push(x);\n break;\n case \"subscription\":\n subscriptions.push(x);\n break;\n }\n }\n }\n invariant(!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length, 96);\n invariant(\n queries.length + mutations.length + subscriptions.length <= 1,\n 97,\n document,\n queries.length,\n subscriptions.length,\n mutations.length\n );\n type = queries.length ? DocumentType.Query : DocumentType.Mutation;\n if (!queries.length && !mutations.length)\n type = DocumentType.Subscription;\n var definitions = queries.length ? queries\n : mutations.length ? mutations\n : subscriptions;\n invariant(definitions.length === 1, 98, document, definitions.length);\n var definition = definitions[0];\n variables = definition.variableDefinitions || [];\n if (definition.name && definition.name.kind === \"Name\") {\n name = definition.name.value;\n }\n else {\n name = \"data\"; // fallback to using data if no name\n }\n var payload = { name: name, type: type, variables: variables };\n cache.set(document, payload);\n return payload;\n}\nparser.resetCache = function () {\n cache = undefined;\n};\nif (globalThis.__DEV__ !== false) {\n registerGlobalCache(\"parser\", function () { return (cache ? cache.size : 0); });\n}\nexport function verifyDocumentType(document, type) {\n var operation = muteDeprecations(\"parser\", parser, [document]);\n var requiredOperationName = operationName(type);\n var usedOperationName = operationName(operation.type);\n invariant(\n operation.type === type,\n 99,\n requiredOperationName,\n requiredOperationName,\n usedOperationName\n );\n}\n//# sourceMappingURL=index.js.map"],"names":["untypedGlobal","Slot","__spreadArray","DocumentType","invariant","AutoCleanedWeakCache","cacheSizes"],"mappings":";;;;;;;;;AAEA,IAAI,YAAY,GAAG,EAAE,CAAC;AACf,SAAS,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE;AACnD,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;AACjC;;ACFA,IAAI,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAC5D,IAAI,MAAM,GAAGA,cAAa,CAAC;AAC3B,IAAI,IAAI,GAAG,IAAIC,aAAI,EAAE,CAAC;AACtB,SAAS,OAAO,CAAC,IAAI,EAAE;AACvB,IAAI,OAAO,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AACjF,CAAC;AACM,SAAS,gBAAgB,CAAC,IAAI,EAAE;AACvC,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;AAClB,IAAI,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,SAAS,CA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C,SAAS,CAAC,IAAI,CAAC,CAAC;AAC1D,IAAIA,iBAAS;AACb,QAAQ,SAAS,CAAC,IAAI,KAAK,IAAI;AAC/B,QAAQ,EAAE;AACV,QAAQ,qBAAqB;AAC7B,QAAQ,qBAAqB;AAC7B,QAAQ,iBAAiB;AACzB,KAAK,CAAC;AACN;;;;;;"}
1
+ {"version":3,"file":"parser.cjs","sources":["../../utilities/caching/getMemoryInternals.js","index.js"],"sourcesContent":["import { __assign, __spreadArray } from \"tslib\";\nimport { cacheSizes } from \"./sizes.js\";\nvar globalCaches = {};\nexport function registerGlobalCache(name, getSize) {\n globalCaches[name] = getSize;\n}\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloClientMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getInMemoryCacheMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloCacheMemoryInternals\n : undefined;\nfunction getCurrentCacheSizes() {\n // `defaultCacheSizes` is a `const enum` that will be inlined during build, so we have to reconstruct it's shape here\n var defaults = {\n parser: 1000 /* defaultCacheSizes[\"parser\"] */,\n canonicalStringify: 1000 /* defaultCacheSizes[\"canonicalStringify\"] */,\n print: 2000 /* defaultCacheSizes[\"print\"] */,\n \"documentTransform.cache\": 2000 /* defaultCacheSizes[\"documentTransform.cache\"] */,\n \"queryManager.getDocumentInfo\": 2000 /* defaultCacheSizes[\"queryManager.getDocumentInfo\"] */,\n \"PersistedQueryLink.persistedQueryHashes\": 2000 /* defaultCacheSizes[\"PersistedQueryLink.persistedQueryHashes\"] */,\n \"fragmentRegistry.transform\": 2000 /* defaultCacheSizes[\"fragmentRegistry.transform\"] */,\n \"fragmentRegistry.lookup\": 1000 /* defaultCacheSizes[\"fragmentRegistry.lookup\"] */,\n \"fragmentRegistry.findFragmentSpreads\": 4000 /* defaultCacheSizes[\"fragmentRegistry.findFragmentSpreads\"] */,\n \"cache.fragmentQueryDocuments\": 1000 /* defaultCacheSizes[\"cache.fragmentQueryDocuments\"] */,\n \"removeTypenameFromVariables.getVariableDefinitions\": 2000 /* defaultCacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"] */,\n \"inMemoryCache.maybeBroadcastWatch\": 5000 /* defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] */,\n \"inMemoryCache.executeSelectionSet\": 50000 /* defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"] */,\n \"inMemoryCache.executeSubSelectedArray\": 10000 /* defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"] */,\n };\n return Object.fromEntries(Object.entries(defaults).map(function (_a) {\n var k = _a[0], v = _a[1];\n return [\n k,\n cacheSizes[k] || v,\n ];\n }));\n}\nfunction _getApolloClientMemoryInternals() {\n var _a, _b, _c, _d, _e;\n if (!(globalThis.__DEV__ !== false))\n throw new Error(\"only supported in development mode\");\n return {\n limits: getCurrentCacheSizes(),\n sizes: __assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: {\n getDocumentInfo: this[\"queryManager\"][\"transformCache\"].size,\n documentTransforms: transformInfo(this[\"queryManager\"].documentTransform),\n } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)),\n };\n}\nfunction _getApolloCacheMemoryInternals() {\n return {\n cache: {\n fragmentQueryDocuments: getWrapperInformation(this[\"getFragmentDoc\"]),\n },\n };\n}\nfunction _getInMemoryCacheMemoryInternals() {\n var fragments = this.config.fragments;\n return __assign(__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this[\"addTypenameTransform\"]), inMemoryCache: {\n executeSelectionSet: getWrapperInformation(this[\"storeReader\"][\"executeSelectionSet\"]),\n executeSubSelectedArray: getWrapperInformation(this[\"storeReader\"][\"executeSubSelectedArray\"]),\n maybeBroadcastWatch: getWrapperInformation(this[\"maybeBroadcastWatch\"]),\n }, fragmentRegistry: {\n findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads),\n lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup),\n transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform),\n } });\n}\nfunction isWrapper(f) {\n return !!f && \"dirtyKey\" in f;\n}\nfunction getWrapperInformation(f) {\n return isWrapper(f) ? f.size : undefined;\n}\nfunction isDefined(value) {\n return value != null;\n}\nfunction transformInfo(transform) {\n return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); });\n}\nfunction recurseTransformInfo(transform) {\n return transform ?\n __spreadArray(__spreadArray([\n getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform[\"performWork\"])\n ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"left\"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"right\"]), true).filter(isDefined)\n : [];\n}\nfunction linkInfo(link) {\n var _a;\n return link ?\n __spreadArray(__spreadArray([\n (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link)\n ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined)\n : [];\n}\n//# sourceMappingURL=getMemoryInternals.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport { AutoCleanedWeakCache, cacheSizes, } from \"../../utilities/index.js\";\nimport { registerGlobalCache } from \"../../utilities/caching/getMemoryInternals.js\";\nimport { muteDeprecations, warnDeprecated } from \"../../utilities/index.js\";\nexport var DocumentType;\n(function (DocumentType) {\n DocumentType[DocumentType[\"Query\"] = 0] = \"Query\";\n DocumentType[DocumentType[\"Mutation\"] = 1] = \"Mutation\";\n DocumentType[DocumentType[\"Subscription\"] = 2] = \"Subscription\";\n})(DocumentType || (DocumentType = {}));\nvar cache;\nexport function operationName(type) {\n var name;\n switch (type) {\n case DocumentType.Query:\n name = \"Query\";\n break;\n case DocumentType.Mutation:\n name = \"Mutation\";\n break;\n case DocumentType.Subscription:\n name = \"Subscription\";\n break;\n }\n return name;\n}\n/**\n * @deprecated `parser` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Remove all usages of `parser` as it is an internal implementation detail.\n */\nexport function parser(document) {\n warnDeprecated(\"parser\", function () {\n globalThis.__DEV__ !== false && invariant.warn(93);\n });\n if (!cache) {\n cache = new AutoCleanedWeakCache(cacheSizes.parser || 1000 /* defaultCacheSizes.parser */);\n }\n var cached = cache.get(document);\n if (cached)\n return cached;\n var variables, type, name;\n invariant(!!document && !!document.kind, 94, document);\n var fragments = [];\n var queries = [];\n var mutations = [];\n var subscriptions = [];\n for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) {\n var x = _a[_i];\n if (x.kind === \"FragmentDefinition\") {\n fragments.push(x);\n continue;\n }\n if (x.kind === \"OperationDefinition\") {\n switch (x.operation) {\n case \"query\":\n queries.push(x);\n break;\n case \"mutation\":\n mutations.push(x);\n break;\n case \"subscription\":\n subscriptions.push(x);\n break;\n }\n }\n }\n invariant(!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length, 95);\n invariant(\n queries.length + mutations.length + subscriptions.length <= 1,\n 96,\n document,\n queries.length,\n subscriptions.length,\n mutations.length\n );\n type = queries.length ? DocumentType.Query : DocumentType.Mutation;\n if (!queries.length && !mutations.length)\n type = DocumentType.Subscription;\n var definitions = queries.length ? queries\n : mutations.length ? mutations\n : subscriptions;\n invariant(definitions.length === 1, 97, document, definitions.length);\n var definition = definitions[0];\n variables = definition.variableDefinitions || [];\n if (definition.name && definition.name.kind === \"Name\") {\n name = definition.name.value;\n }\n else {\n name = \"data\"; // fallback to using data if no name\n }\n var payload = { name: name, type: type, variables: variables };\n cache.set(document, payload);\n return payload;\n}\nparser.resetCache = function () {\n cache = undefined;\n};\nif (globalThis.__DEV__ !== false) {\n registerGlobalCache(\"parser\", function () { return (cache ? cache.size : 0); });\n}\nexport function verifyDocumentType(document, type) {\n var operation = muteDeprecations(\"parser\", parser, [document]);\n var requiredOperationName = operationName(type);\n var usedOperationName = operationName(operation.type);\n invariant(\n operation.type === type,\n 98,\n requiredOperationName,\n requiredOperationName,\n usedOperationName\n );\n}\n//# sourceMappingURL=index.js.map"],"names":["DocumentType","warnDeprecated","invariant","AutoCleanedWeakCache","cacheSizes","muteDeprecations"],"mappings":";;;;;;;;AAEA,IAAI,YAAY,GAAG,EAAE,CAAC;AACf,SAAS,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE;AACnD,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;AACjC;;ACDWA,8BAAa;AACxB,CAAC,UAAU,YAAY,EAAE;AACzB,IAAI,YAAY,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC;AACtD,IAAI,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AAC5D,IAAI,YAAY,CAAC,YAAY,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC;AACpE,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC,CAAC;AACxC,IAAI,KAAK,CAAC;AACH,SAAS,aAAa,CAAC,IAAI,EAAE;AACpC,IAAI,IAAI,IAAI,CAAC;AACb,IAAI,QAAQ,IAAI;AAChB,QAAQ,KAAKA,oBAAY,CAAC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E,IAAI,EAAE;AACnD,IAAI,IAAI,SAAS,GAAGG,0BAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACnE,IAAI,IAAI,qBAAqB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;AACpD,IAAI,IAAI,iBAAiB,GAAG,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC1D,IAAIH,iBAAS;AACb,QAAQ,SAAS,CAAC,IAAI,KAAK,IAAI;AAC/B,QAAQ,EAAE;AACV,QAAQ,qBAAqB;AAC7B,QAAQ,qBAAqB;AAC7B,QAAQ,iBAAiB;AACzB,KAAK,CAAC;AACN;;;;;;"}
@@ -4,33 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var globals = require('../../utilities/globals');
6
6
  var utilities = require('../../utilities');
7
- var tslib = require('tslib');
8
- var optimism = require('optimism');
7
+ require('tslib');
9
8
 
10
9
  var globalCaches = {};
11
10
  function registerGlobalCache(name, getSize) {
12
11
  globalCaches[name] = getSize;
13
12
  }
14
13
 
15
- var muteAllDeprecations = Symbol.for("apollo.deprecations");
16
- var global = globals.global;
17
- var slot = new optimism.Slot();
18
- function isMuted(name) {
19
- return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);
20
- }
21
- function muteDeprecations(name) {
22
- var args = [];
23
- for (var _i = 1; _i < arguments.length; _i++) {
24
- args[_i - 1] = arguments[_i];
25
- }
26
- return slot.withValue.apply(slot, tslib.__spreadArray([Array.isArray(name) ? name : [name]], args, false));
27
- }
28
- function warnDeprecated(name, cb) {
29
- if (!isMuted(name)) {
30
- cb();
31
- }
32
- }
33
-
34
14
  exports.DocumentType = void 0;
35
15
  (function (DocumentType) {
36
16
  DocumentType[DocumentType["Query"] = 0] = "Query";
@@ -54,8 +34,8 @@ function operationName(type) {
54
34
  return name;
55
35
  }
56
36
  function parser(document) {
57
- warnDeprecated("parser", function () {
58
- globalThis.__DEV__ !== false && globals.invariant.warn(94);
37
+ utilities.warnDeprecated("parser", function () {
38
+ globalThis.__DEV__ !== false && globals.invariant.warn(93);
59
39
  });
60
40
  if (!cache) {
61
41
  cache = new utilities.AutoCleanedWeakCache(utilities.cacheSizes.parser || 1000 );
@@ -64,7 +44,7 @@ function parser(document) {
64
44
  if (cached)
65
45
  return cached;
66
46
  var variables, type, name;
67
- globals.invariant(!!document && !!document.kind, 95, document);
47
+ globals.invariant(!!document && !!document.kind, 94, document);
68
48
  var fragments = [];
69
49
  var queries = [];
70
50
  var mutations = [];
@@ -92,10 +72,10 @@ function parser(document) {
92
72
  globals.invariant(!fragments.length ||
93
73
  queries.length ||
94
74
  mutations.length ||
95
- subscriptions.length, 96);
75
+ subscriptions.length, 95);
96
76
  globals.invariant(
97
77
  queries.length + mutations.length + subscriptions.length <= 1,
98
- 97,
78
+ 96,
99
79
  document,
100
80
  queries.length,
101
81
  subscriptions.length,
@@ -107,7 +87,7 @@ function parser(document) {
107
87
  var definitions = queries.length ? queries
108
88
  : mutations.length ? mutations
109
89
  : subscriptions;
110
- globals.invariant(definitions.length === 1, 98, document, definitions.length);
90
+ globals.invariant(definitions.length === 1, 97, document, definitions.length);
111
91
  var definition = definitions[0];
112
92
  variables = definition.variableDefinitions || [];
113
93
  if (definition.name && definition.name.kind === "Name") {
@@ -127,12 +107,12 @@ if (globalThis.__DEV__ !== false) {
127
107
  registerGlobalCache("parser", function () { return (cache ? cache.size : 0); });
128
108
  }
129
109
  function verifyDocumentType(document, type) {
130
- var operation = muteDeprecations("parser", parser, [document]);
110
+ var operation = utilities.muteDeprecations("parser", parser, [document]);
131
111
  var requiredOperationName = operationName(type);
132
112
  var usedOperationName = operationName(operation.type);
133
113
  globals.invariant(
134
114
  operation.type === type,
135
- 99,
115
+ 98,
136
116
  requiredOperationName,
137
117
  requiredOperationName,
138
118
  usedOperationName
@@ -1,7 +1,7 @@
1
1
  import { __assign } from "tslib";
2
2
  import { InternalQueryReference, wrapQueryRef } from "../internal/index.js";
3
3
  import { wrapHook } from "../hooks/internal/index.js";
4
- import { muteDeprecations, warnRemovedOption, } from "../../utilities/deprecation/index.js";
4
+ import { muteDeprecations, warnRemovedOption } from "../../utilities/index.js";
5
5
  /**
6
6
  * A higher order function that returns a `preloadQuery` function which
7
7
  * can be used to begin loading a query with the given `client`. This is useful
@@ -1 +1 @@
1
- {"version":3,"file":"createQueryPreloader.js","sourceRoot":"","sources":["../../../src/react/query-preloader/createQueryPreloader.ts"],"names":[],"mappings":";AAeA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG5E,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,sCAAsC,CAAC;AAwH9C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAyB;IAEzB,OAAO,QAAQ,CACb,sBAAsB,EACtB,qBAAqB,EACrB,MAAM,CACP,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAED,IAAM,qBAAqB,GAAgC,UAAC,MAAM;IAChE,SAAS,YAAY,CAInB,KAA0D,EAC1D,OACmD;QADnD,wBAAA,EAAA,UACgC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QAEnD,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC;QAE9D,IAAM,QAAQ,GAAG,gBAAgB,CAC/B,iBAAiB,EACjB;;YACE,OAAA,IAAI,sBAAsB,CACxB,MAAM,CAAC,UAAU,CAAC,sBACb,OAAO,KACV,KAAK,OAAA,GACyB,CAAC,EACjC;gBACE,oBAAoB,EAClB,MAAA,MAAA,MAAM,CAAC,cAAc,CAAC,KAAK,0CAAE,QAAQ,0CAAE,oBAAoB;aAC9D,CACF,CAAA;SAAA,CACJ,CAAC;QAEF,OAAO,YAAY,CAAC,QAAQ,CAAyC,CAAC;IACxE,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;QACjC,SAAS,YACP,QAAmB;YAEnB,OAAO,QAAQ,CAAC,SAAS,EAAwB,CAAC;QACpD,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type {\n ApolloClient,\n DefaultContext,\n DocumentNode,\n ErrorPolicy,\n OperationVariables,\n RefetchWritePolicy,\n TypedDocumentNode,\n WatchQueryFetchPolicy,\n WatchQueryOptions,\n} from \"../../core/index.js\";\nimport type {\n DeepPartial,\n OnlyRequiredProperties,\n} from \"../../utilities/index.js\";\nimport { InternalQueryReference, wrapQueryRef } from \"../internal/index.js\";\nimport type { PreloadedQueryRef } from \"../internal/index.js\";\nimport type { NoInfer, VariablesOption } from \"../index.js\";\nimport { wrapHook } from \"../hooks/internal/index.js\";\nimport {\n muteDeprecations,\n warnRemovedOption,\n} from \"../../utilities/deprecation/index.js\";\n\nexport type PreloadQueryFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport type PreloadQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n> = {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\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?: PreloadQueryFetchPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n} & VariablesOption<TVariables>;\n\ntype PreloadQueryOptionsArg<\n TVariables extends OperationVariables,\n TOptions = unknown,\n> = [TVariables] extends [never] ?\n [options?: PreloadQueryOptions<never> & TOptions]\n: {} extends OnlyRequiredProperties<TVariables> ?\n [\n options?: PreloadQueryOptions<NoInfer<TVariables>> &\n Omit<TOptions, \"variables\">,\n ]\n: [\n options: PreloadQueryOptions<NoInfer<TVariables>> &\n Omit<TOptions, \"variables\">,\n ];\n\n/**\n * A function that will begin loading a query when called. It's result can be\n * read by `useReadQuery` which will suspend until the query is loaded.\n * This is useful when you want to start loading a query as early as possible\n * outside of a React component.\n *\n * @example\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * const queryRef = preloadQuery(query, { variables, ...otherOptions });\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading</div>}>\n * <MyQuery />\n * </Suspense>\n * );\n * }\n *\n * function MyQuery() {\n * const { data } = useReadQuery(queryRef);\n *\n * // do something with `data`\n * }\n * ```\n */\nexport interface PreloadQueryFunction {\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n TOptions extends Omit<PreloadQueryOptions, \"variables\">,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: PreloadQueryOptionsArg<NoInfer<TVariables>, TOptions>\n ): PreloadedQueryRef<\n TOptions[\"errorPolicy\"] extends \"ignore\" | \"all\" ?\n TOptions[\"returnPartialData\"] extends true ?\n DeepPartial<TData> | undefined\n : TData | undefined\n : TOptions[\"returnPartialData\"] extends true ? DeepPartial<TData>\n : TData,\n TVariables\n >;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<DeepPartial<TData> | undefined, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<TData | undefined, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n }\n ): PreloadedQueryRef<DeepPartial<TData>, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: PreloadQueryOptionsArg<NoInfer<TVariables>>\n ): PreloadedQueryRef<TData, TVariables>;\n\n toPromise<TQueryRef extends PreloadedQueryRef<any, any>>(\n queryRef: TQueryRef\n ): Promise<TQueryRef>;\n}\n\n/**\n * A higher order function that returns a `preloadQuery` function which\n * can be used to begin loading a query with the given `client`. This is useful\n * when you want to start loading a query as early as possible outside of a\n * React component.\n *\n * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview.\n *\n * @param client - The `ApolloClient` instance that will be used to load queries\n * from the returned `preloadQuery` function.\n * @returns The `preloadQuery` function.\n *\n * @example\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n * @since 3.9.0\n */\nexport function createQueryPreloader(\n client: ApolloClient<any>\n): PreloadQueryFunction {\n return wrapHook(\n \"createQueryPreloader\",\n _createQueryPreloader,\n client\n )(client);\n}\n\nconst _createQueryPreloader: typeof createQueryPreloader = (client) => {\n function preloadQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> &\n VariablesOption<TVariables> = Object.create(null)\n ): PreloadedQueryRef<TData, TVariables> {\n warnRemovedOption(options, \"canonizeResults\", \"preloadQuery\");\n\n const queryRef = muteDeprecations(\n \"canonizeResults\",\n () =>\n new InternalQueryReference(\n client.watchQuery({\n ...options,\n query,\n } as WatchQueryOptions<any, any>),\n {\n autoDisposeTimeoutMs:\n client.defaultOptions.react?.suspense?.autoDisposeTimeoutMs,\n }\n )\n );\n\n return wrapQueryRef(queryRef) as PreloadedQueryRef<TData, TVariables>;\n }\n\n return Object.assign(preloadQuery, {\n toPromise<TQueryRef extends PreloadedQueryRef<any, any>>(\n queryRef: TQueryRef\n ): Promise<TQueryRef> {\n return queryRef.toPromise() as Promise<TQueryRef>;\n },\n });\n};\n"]}
1
+ {"version":3,"file":"createQueryPreloader.js","sourceRoot":"","sources":["../../../src/react/query-preloader/createQueryPreloader.ts"],"names":[],"mappings":";AAeA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG5E,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAwH/E;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAyB;IAEzB,OAAO,QAAQ,CACb,sBAAsB,EACtB,qBAAqB,EACrB,MAAM,CACP,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAED,IAAM,qBAAqB,GAAgC,UAAC,MAAM;IAChE,SAAS,YAAY,CAInB,KAA0D,EAC1D,OACmD;QADnD,wBAAA,EAAA,UACgC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QAEnD,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC;QAE9D,IAAM,QAAQ,GAAG,gBAAgB,CAC/B,iBAAiB,EACjB;;YACE,OAAA,IAAI,sBAAsB,CACxB,MAAM,CAAC,UAAU,CAAC,sBACb,OAAO,KACV,KAAK,OAAA,GACyB,CAAC,EACjC;gBACE,oBAAoB,EAClB,MAAA,MAAA,MAAM,CAAC,cAAc,CAAC,KAAK,0CAAE,QAAQ,0CAAE,oBAAoB;aAC9D,CACF,CAAA;SAAA,CACJ,CAAC;QAEF,OAAO,YAAY,CAAC,QAAQ,CAAyC,CAAC;IACxE,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;QACjC,SAAS,YACP,QAAmB;YAEnB,OAAO,QAAQ,CAAC,SAAS,EAAwB,CAAC;QACpD,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type {\n ApolloClient,\n DefaultContext,\n DocumentNode,\n ErrorPolicy,\n OperationVariables,\n RefetchWritePolicy,\n TypedDocumentNode,\n WatchQueryFetchPolicy,\n WatchQueryOptions,\n} from \"../../core/index.js\";\nimport type {\n DeepPartial,\n OnlyRequiredProperties,\n} from \"../../utilities/index.js\";\nimport { InternalQueryReference, wrapQueryRef } from \"../internal/index.js\";\nimport type { PreloadedQueryRef } from \"../internal/index.js\";\nimport type { NoInfer, VariablesOption } from \"../index.js\";\nimport { wrapHook } from \"../hooks/internal/index.js\";\nimport { muteDeprecations, warnRemovedOption } from \"../../utilities/index.js\";\n\nexport type PreloadQueryFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport type PreloadQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n> = {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\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?: PreloadQueryFetchPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n} & VariablesOption<TVariables>;\n\ntype PreloadQueryOptionsArg<\n TVariables extends OperationVariables,\n TOptions = unknown,\n> = [TVariables] extends [never] ?\n [options?: PreloadQueryOptions<never> & TOptions]\n: {} extends OnlyRequiredProperties<TVariables> ?\n [\n options?: PreloadQueryOptions<NoInfer<TVariables>> &\n Omit<TOptions, \"variables\">,\n ]\n: [\n options: PreloadQueryOptions<NoInfer<TVariables>> &\n Omit<TOptions, \"variables\">,\n ];\n\n/**\n * A function that will begin loading a query when called. It's result can be\n * read by `useReadQuery` which will suspend until the query is loaded.\n * This is useful when you want to start loading a query as early as possible\n * outside of a React component.\n *\n * @example\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * const queryRef = preloadQuery(query, { variables, ...otherOptions });\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading</div>}>\n * <MyQuery />\n * </Suspense>\n * );\n * }\n *\n * function MyQuery() {\n * const { data } = useReadQuery(queryRef);\n *\n * // do something with `data`\n * }\n * ```\n */\nexport interface PreloadQueryFunction {\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n TOptions extends Omit<PreloadQueryOptions, \"variables\">,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: PreloadQueryOptionsArg<NoInfer<TVariables>, TOptions>\n ): PreloadedQueryRef<\n TOptions[\"errorPolicy\"] extends \"ignore\" | \"all\" ?\n TOptions[\"returnPartialData\"] extends true ?\n DeepPartial<TData> | undefined\n : TData | undefined\n : TOptions[\"returnPartialData\"] extends true ? DeepPartial<TData>\n : TData,\n TVariables\n >;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<DeepPartial<TData> | undefined, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<TData | undefined, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n }\n ): PreloadedQueryRef<DeepPartial<TData>, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: PreloadQueryOptionsArg<NoInfer<TVariables>>\n ): PreloadedQueryRef<TData, TVariables>;\n\n toPromise<TQueryRef extends PreloadedQueryRef<any, any>>(\n queryRef: TQueryRef\n ): Promise<TQueryRef>;\n}\n\n/**\n * A higher order function that returns a `preloadQuery` function which\n * can be used to begin loading a query with the given `client`. This is useful\n * when you want to start loading a query as early as possible outside of a\n * React component.\n *\n * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview.\n *\n * @param client - The `ApolloClient` instance that will be used to load queries\n * from the returned `preloadQuery` function.\n * @returns The `preloadQuery` function.\n *\n * @example\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n * @since 3.9.0\n */\nexport function createQueryPreloader(\n client: ApolloClient<any>\n): PreloadQueryFunction {\n return wrapHook(\n \"createQueryPreloader\",\n _createQueryPreloader,\n client\n )(client);\n}\n\nconst _createQueryPreloader: typeof createQueryPreloader = (client) => {\n function preloadQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> &\n VariablesOption<TVariables> = Object.create(null)\n ): PreloadedQueryRef<TData, TVariables> {\n warnRemovedOption(options, \"canonizeResults\", \"preloadQuery\");\n\n const queryRef = muteDeprecations(\n \"canonizeResults\",\n () =>\n new InternalQueryReference(\n client.watchQuery({\n ...options,\n query,\n } as WatchQueryOptions<any, any>),\n {\n autoDisposeTimeoutMs:\n client.defaultOptions.react?.suspense?.autoDisposeTimeoutMs,\n }\n )\n );\n\n return wrapQueryRef(queryRef) as PreloadedQueryRef<TData, TVariables>;\n }\n\n return Object.assign(preloadQuery, {\n toPromise<TQueryRef extends PreloadedQueryRef<any, any>>(\n queryRef: TQueryRef\n ): Promise<TQueryRef> {\n return queryRef.toPromise() as Promise<TQueryRef>;\n },\n });\n};\n"]}
package/react/react.cjs CHANGED
@@ -2,40 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var globals = require('../utilities/globals');
5
+ require('../utilities/globals');
6
6
  var context = require('./context');
7
7
  var hooks = require('./hooks');
8
8
  var parser = require('./parser');
9
9
  var tslib = require('tslib');
10
10
  var internal = require('./internal');
11
- var optimism = require('optimism');
12
-
13
- var muteAllDeprecations = Symbol.for("apollo.deprecations");
14
- var global = globals.global;
15
- var slot = new optimism.Slot();
16
- function isMuted(name) {
17
- return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);
18
- }
19
- function muteDeprecations(name) {
20
- var args = [];
21
- for (var _i = 1; _i < arguments.length; _i++) {
22
- args[_i - 1] = arguments[_i];
23
- }
24
- return slot.withValue.apply(slot, tslib.__spreadArray([Array.isArray(name) ? name : [name]], args, false));
25
- }
26
- function warnRemovedOption(options, name, callSite, recommendation) {
27
- if (recommendation === void 0) { recommendation = "Please remove this option."; }
28
- warnDeprecated(name, function () {
29
- if (name in options) {
30
- globalThis.__DEV__ !== false && globals.invariant.warn(104, callSite, name, recommendation);
31
- }
32
- });
33
- }
34
- function warnDeprecated(name, cb) {
35
- if (!isMuted(name)) {
36
- cb();
37
- }
38
- }
11
+ var utilities = require('../utilities');
39
12
 
40
13
  var wrapperSymbol = Symbol.for("apollo.hook.wrappers");
41
14
  function wrapHook(hookName, useHook, clientOrObsQuery) {
@@ -51,8 +24,8 @@ function createQueryPreloader(client) {
51
24
  var _createQueryPreloader = function (client) {
52
25
  function preloadQuery(query, options) {
53
26
  if (options === void 0) { options = Object.create(null); }
54
- warnRemovedOption(options, "canonizeResults", "preloadQuery");
55
- var queryRef = muteDeprecations("canonizeResults", function () {
27
+ utilities.warnRemovedOption(options, "canonizeResults", "preloadQuery");
28
+ var queryRef = utilities.muteDeprecations("canonizeResults", function () {
56
29
  var _a, _b;
57
30
  return new internal.InternalQueryReference(client.watchQuery(tslib.__assign(tslib.__assign({}, options), { query: query })), {
58
31
  autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs,
@@ -1 +1 @@
1
- {"version":3,"file":"react.cjs","sources":["../utilities/deprecation/index.js","hooks/internal/wrapHook.js","query-preloader/createQueryPreloader.js"],"sourcesContent":["import { __spreadArray } from \"tslib\";\nimport { Slot } from \"optimism\";\nimport { invariant, global as untypedGlobal } from \"../globals/index.js\";\nvar muteAllDeprecations = Symbol.for(\"apollo.deprecations\");\nvar global = untypedGlobal;\nvar slot = new Slot();\nfunction isMuted(name) {\n return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);\n}\nexport function muteDeprecations(name) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n return slot.withValue.apply(slot, __spreadArray([Array.isArray(name) ? name : [name]], args, false));\n}\nexport function warnRemovedOption(options, name, callSite, recommendation) {\n if (recommendation === void 0) { recommendation = \"Please remove this option.\"; }\n warnDeprecated(name, function () {\n if (name in options) {\n globalThis.__DEV__ !== false && invariant.warn(104, callSite, name, recommendation);\n }\n });\n}\nexport function warnDeprecated(name, cb) {\n if (!isMuted(name)) {\n cb();\n }\n}\nexport function withDisabledDeprecations() {\n var _a;\n var prev = global[muteAllDeprecations];\n global[muteAllDeprecations] = true;\n return _a = {},\n _a[Symbol.dispose] = function () {\n global[muteAllDeprecations] = prev;\n },\n _a;\n}\n//# sourceMappingURL=index.js.map","var wrapperSymbol = Symbol.for(\"apollo.hook.wrappers\");\n/**\n * @internal\n *\n * Makes an Apollo Client hook \"wrappable\".\n * That means that the Apollo Client instance can expose a \"wrapper\" that will be\n * used to wrap the original hook implementation with additional logic.\n * @example\n * ```tsx\n * // this is already done in `@apollo/client` for all wrappable hooks (see `WrappableHooks`)\n * // following this pattern\n * function useQuery() {\n * return wrapHook('useQuery', _useQuery, options.client)(query, options);\n * }\n * function _useQuery(query, options) {\n * // original implementation\n * }\n *\n * // this is what a library like `@apollo/client-react-streaming` would do\n * class ApolloClientWithStreaming extends ApolloClient {\n * constructor(options) {\n * super(options);\n * this.queryManager[Symbol.for(\"apollo.hook.wrappers\")] = {\n * useQuery: (original) => (query, options) => {\n * console.log(\"useQuery was called with options\", options);\n * return original(query, options);\n * }\n * }\n * }\n * }\n *\n * // this will now log the options and then call the original `useQuery`\n * const client = new ApolloClientWithStreaming({ ... });\n * useQuery(query, { client });\n * ```\n */\nexport function wrapHook(hookName, useHook, clientOrObsQuery) {\n var queryManager = clientOrObsQuery[\"queryManager\"];\n var wrappers = queryManager && queryManager[wrapperSymbol];\n var wrapper = wrappers && wrappers[hookName];\n return wrapper ? wrapper(useHook) : useHook;\n}\n//# sourceMappingURL=wrapHook.js.map","import { __assign } from \"tslib\";\nimport { InternalQueryReference, wrapQueryRef } from \"../internal/index.js\";\nimport { wrapHook } from \"../hooks/internal/index.js\";\nimport { muteDeprecations, warnRemovedOption, } from \"../../utilities/deprecation/index.js\";\n/**\n * A higher order function that returns a `preloadQuery` function which\n * can be used to begin loading a query with the given `client`. This is useful\n * when you want to start loading a query as early as possible outside of a\n * React component.\n *\n * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview.\n *\n * @param client - The `ApolloClient` instance that will be used to load queries\n * from the returned `preloadQuery` function.\n * @returns The `preloadQuery` function.\n *\n * @example\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n * @since 3.9.0\n */\nexport function createQueryPreloader(client) {\n return wrapHook(\"createQueryPreloader\", _createQueryPreloader, client)(client);\n}\nvar _createQueryPreloader = function (client) {\n function preloadQuery(query, options) {\n if (options === void 0) { options = Object.create(null); }\n warnRemovedOption(options, \"canonizeResults\", \"preloadQuery\");\n var queryRef = muteDeprecations(\"canonizeResults\", function () {\n var _a, _b;\n return new InternalQueryReference(client.watchQuery(__assign(__assign({}, options), { query: query })), {\n autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs,\n });\n });\n return wrapQueryRef(queryRef);\n }\n return Object.assign(preloadQuery, {\n toPromise: function (queryRef) {\n return queryRef.toPromise();\n },\n });\n};\n//# sourceMappingURL=createQueryPreloader.js.map"],"names":["untypedGlobal","Slot","__spreadArray","invariant","InternalQueryReference","__assign","wrapQueryRef"],"mappings":";;;;;;;;;;;;AAGA,IAAI,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAC5D,IAAI,MAAM,GAAGA,cAAa,CAAC;AAC3B,IAAI,IAAI,GAAG,IAAIC,aAAI,EAAE,CAAC;AACtB,SAAS,OAAO,CAAC,IAAI,EAAE;AACvB,IAAI,OAAO,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC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EAAE,CAAC,QAAQ,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,oBAAoB;AAC7L,aAAa,CAAC,CAAC;AACf,SAAS,CAAC,CAAC;AACX,QAAQ,OAAOC,qBAAY,CAAC,QAAQ,CAAC,CAAC;AACtC,KAAK;AACL,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;AACvC,QAAQ,SAAS,EAAE,UAAU,QAAQ,EAAE;AACvC,YAAY,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC;AACxC,SAAS;AACT,KAAK,CAAC,CAAC;AACP,CAAC;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"react.cjs","sources":["hooks/internal/wrapHook.js","query-preloader/createQueryPreloader.js"],"sourcesContent":["var wrapperSymbol = Symbol.for(\"apollo.hook.wrappers\");\n/**\n * @internal\n *\n * Makes an Apollo Client hook \"wrappable\".\n * That means that the Apollo Client instance can expose a \"wrapper\" that will be\n * used to wrap the original hook implementation with additional logic.\n * @example\n * ```tsx\n * // this is already done in `@apollo/client` for all wrappable hooks (see `WrappableHooks`)\n * // following this pattern\n * function useQuery() {\n * return wrapHook('useQuery', _useQuery, options.client)(query, options);\n * }\n * function _useQuery(query, options) {\n * // original implementation\n * }\n *\n * // this is what a library like `@apollo/client-react-streaming` would do\n * class ApolloClientWithStreaming extends ApolloClient {\n * constructor(options) {\n * super(options);\n * this.queryManager[Symbol.for(\"apollo.hook.wrappers\")] = {\n * useQuery: (original) => (query, options) => {\n * console.log(\"useQuery was called with options\", options);\n * return original(query, options);\n * }\n * }\n * }\n * }\n *\n * // this will now log the options and then call the original `useQuery`\n * const client = new ApolloClientWithStreaming({ ... });\n * useQuery(query, { client });\n * ```\n */\nexport function wrapHook(hookName, useHook, clientOrObsQuery) {\n var queryManager = clientOrObsQuery[\"queryManager\"];\n var wrappers = queryManager && queryManager[wrapperSymbol];\n var wrapper = wrappers && wrappers[hookName];\n return wrapper ? wrapper(useHook) : useHook;\n}\n//# sourceMappingURL=wrapHook.js.map","import { __assign } from \"tslib\";\nimport { InternalQueryReference, wrapQueryRef } from \"../internal/index.js\";\nimport { wrapHook } from \"../hooks/internal/index.js\";\nimport { muteDeprecations, warnRemovedOption } from \"../../utilities/index.js\";\n/**\n * A higher order function that returns a `preloadQuery` function which\n * can be used to begin loading a query with the given `client`. This is useful\n * when you want to start loading a query as early as possible outside of a\n * React component.\n *\n * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview.\n *\n * @param client - The `ApolloClient` instance that will be used to load queries\n * from the returned `preloadQuery` function.\n * @returns The `preloadQuery` function.\n *\n * @example\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n * @since 3.9.0\n */\nexport function createQueryPreloader(client) {\n return wrapHook(\"createQueryPreloader\", _createQueryPreloader, client)(client);\n}\nvar _createQueryPreloader = function (client) {\n function preloadQuery(query, options) {\n if (options === void 0) { options = Object.create(null); }\n warnRemovedOption(options, \"canonizeResults\", \"preloadQuery\");\n var queryRef = muteDeprecations(\"canonizeResults\", function () {\n var _a, _b;\n return new InternalQueryReference(client.watchQuery(__assign(__assign({}, options), { query: query })), {\n autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs,\n });\n });\n return wrapQueryRef(queryRef);\n }\n return Object.assign(preloadQuery, {\n toPromise: function (queryRef) {\n return queryRef.toPromise();\n },\n });\n};\n//# sourceMappingURL=createQueryPreloader.js.map"],"names":["warnRemovedOption","muteDeprecations","InternalQueryReference","__assign","wrapQueryRef"],"mappings":";;;;;;;;;;;;AAAA,IAAI,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAoChD,SAAS,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE;AAC9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,KAAK,CAAC,GAAG,EAAE,CAAC,oBAAoB;AAC7L,aAAa,CAAC,CAAC;AACf,SAAS,CAAC,CAAC;AACX,QAAQ,OAAOC,qBAAY,CAAC,QAAQ,CAAC,CAAC;AACtC,KAAK;AACL,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;AACvC,QAAQ,SAAS,EAAE,UAAU,QAAQ,EAAE;AACvC,YAAY,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC;AACxC,SAAS;AACT,KAAK,CAAC,CAAC;AACP,CAAC;;;;;;;;;;;;;;"}
@@ -2,40 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var globals = require('../utilities/globals');
5
+ require('../utilities/globals');
6
6
  var context = require('./context');
7
7
  var hooks = require('./hooks');
8
8
  var parser = require('./parser');
9
9
  var tslib = require('tslib');
10
10
  var internal = require('./internal');
11
- var optimism = require('optimism');
12
-
13
- var muteAllDeprecations = Symbol.for("apollo.deprecations");
14
- var global = globals.global;
15
- var slot = new optimism.Slot();
16
- function isMuted(name) {
17
- return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);
18
- }
19
- function muteDeprecations(name) {
20
- var args = [];
21
- for (var _i = 1; _i < arguments.length; _i++) {
22
- args[_i - 1] = arguments[_i];
23
- }
24
- return slot.withValue.apply(slot, tslib.__spreadArray([Array.isArray(name) ? name : [name]], args, false));
25
- }
26
- function warnRemovedOption(options, name, callSite, recommendation) {
27
- if (recommendation === void 0) { recommendation = "Please remove this option."; }
28
- warnDeprecated(name, function () {
29
- if (name in options) {
30
- globalThis.__DEV__ !== false && globals.invariant.warn(104, callSite, name, recommendation);
31
- }
32
- });
33
- }
34
- function warnDeprecated(name, cb) {
35
- if (!isMuted(name)) {
36
- cb();
37
- }
38
- }
11
+ var utilities = require('../utilities');
39
12
 
40
13
  var wrapperSymbol = Symbol.for("apollo.hook.wrappers");
41
14
  function wrapHook(hookName, useHook, clientOrObsQuery) {
@@ -51,8 +24,8 @@ function createQueryPreloader(client) {
51
24
  var _createQueryPreloader = function (client) {
52
25
  function preloadQuery(query, options) {
53
26
  if (options === void 0) { options = Object.create(null); }
54
- warnRemovedOption(options, "canonizeResults", "preloadQuery");
55
- var queryRef = muteDeprecations("canonizeResults", function () {
27
+ utilities.warnRemovedOption(options, "canonizeResults", "preloadQuery");
28
+ var queryRef = utilities.muteDeprecations("canonizeResults", function () {
56
29
  var _a, _b;
57
30
  return new internal.InternalQueryReference(client.watchQuery(tslib.__assign(tslib.__assign({}, options), { query: query })), {
58
31
  autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs,
@@ -89,7 +89,7 @@ var MockLink = (function (_super) {
89
89
  var newData = response.newData;
90
90
  if (newData) {
91
91
  if (globalThis.__DEV__ !== false) {
92
- globalThis.__DEV__ !== false && globals.invariant.warn(100, response);
92
+ globalThis.__DEV__ !== false && globals.invariant.warn(99, response);
93
93
  }
94
94
  response.result = newData(operation.variables);
95
95
  mockedResponses.push(response);
@@ -103,7 +103,7 @@ var MockLink = (function (_super) {
103
103
  var serverQuery = utilities.removeClientSetsFromDocument(response === null || response === void 0 ? void 0 : response.request.query);
104
104
  if (!serverQuery) {
105
105
  globalThis.__DEV__ !== false && globals.invariant.warn(
106
- 101,
106
+ 100,
107
107
  (_b = utilities.getOperationName(response.request.query)) !== null && _b !== void 0 ? _b : "(anonymous)"
108
108
  );
109
109
  }
@@ -144,14 +144,14 @@ var MockLink = (function (_super) {
144
144
  var _a;
145
145
  var newMockedResponse = utilities.cloneDeep(mockedResponse);
146
146
  var queryWithoutClientOnlyDirectives = utilities.removeDirectivesFromDocument([{ name: "connection" }, { name: "nonreactive" }, { name: "unmask" }], utilities.checkDocument(newMockedResponse.request.query));
147
- globals.invariant(queryWithoutClientOnlyDirectives, 102);
147
+ globals.invariant(queryWithoutClientOnlyDirectives, 101);
148
148
  newMockedResponse.request.query = queryWithoutClientOnlyDirectives;
149
149
  var query = utilities.removeClientSetsFromDocument(newMockedResponse.request.query);
150
150
  if (query) {
151
151
  newMockedResponse.request.query = query;
152
152
  }
153
153
  mockedResponse.maxUsageCount = (_a = mockedResponse.maxUsageCount) !== null && _a !== void 0 ? _a : 1;
154
- globals.invariant(mockedResponse.maxUsageCount > 0, 103, mockedResponse.maxUsageCount);
154
+ globals.invariant(mockedResponse.maxUsageCount > 0, 102, mockedResponse.maxUsageCount);
155
155
  this.normalizeVariableMatching(newMockedResponse);
156
156
  return newMockedResponse;
157
157
  };