@apollo/client 3.12.0-alpha.0 → 3.12.0-rc.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 (148) hide show
  1. package/.changeset/brown-readers-smash.md +5 -0
  2. package/.changeset/cold-apes-bow.md +5 -0
  3. package/.changeset/early-bobcats-eat.md +5 -0
  4. package/.changeset/flat-beans-knock.md +15 -0
  5. package/.changeset/gorgeous-zebras-confess.md +5 -0
  6. package/.changeset/kind-toys-tie.md +5 -0
  7. package/.changeset/long-zoos-ring.md +5 -0
  8. package/.changeset/nervous-owls-hear.md +5 -0
  9. package/.changeset/nice-countries-share.md +5 -0
  10. package/.changeset/pre.json +13 -2
  11. package/.changeset/slimy-points-end.md +5 -0
  12. package/.changeset/small-bears-confess.md +5 -0
  13. package/CHANGELOG.md +52 -0
  14. package/apollo-client.cjs +187 -93
  15. package/apollo-client.cjs.map +1 -1
  16. package/apollo-client.min.cjs +1 -1
  17. package/cache/cache.cjs +59 -25
  18. package/cache/cache.cjs.map +1 -1
  19. package/cache/cache.cjs.native.js +59 -25
  20. package/cache/inmemory/policies.js +12 -9
  21. package/cache/inmemory/policies.js.map +1 -1
  22. package/config/jest/setup.js +5 -0
  23. package/config/jest/setup.js.map +1 -1
  24. package/core/ApolloClient.js +7 -3
  25. package/core/ApolloClient.js.map +1 -1
  26. package/core/ObservableQuery.js +2 -0
  27. package/core/ObservableQuery.js.map +1 -1
  28. package/core/QueryManager.d.ts +4 -1
  29. package/core/QueryManager.js +26 -2
  30. package/core/QueryManager.js.map +1 -1
  31. package/core/core.cjs +86 -25
  32. package/core/core.cjs.map +1 -1
  33. package/core/core.cjs.native.js +86 -25
  34. package/core/masking.d.ts +6 -0
  35. package/core/masking.js +62 -20
  36. package/core/masking.js.map +1 -1
  37. package/dev/dev.cjs +66 -62
  38. package/dev/dev.cjs.map +1 -1
  39. package/dev/dev.cjs.native.js +66 -62
  40. package/invariantErrorCodes.js +66 -61
  41. package/link/core/ApolloLink.js +2 -2
  42. package/link/core/core.cjs +2 -2
  43. package/link/core/core.cjs.map +1 -1
  44. package/link/core/core.cjs.native.js +2 -2
  45. package/link/http/checkFetcher.js +1 -1
  46. package/link/http/createHttpLink.js +1 -1
  47. package/link/http/http.cjs +3 -3
  48. package/link/http/http.cjs.map +1 -1
  49. package/link/http/http.cjs.native.js +3 -3
  50. package/link/http/serializeFetchParameter.js +1 -1
  51. package/link/persisted-queries/index.js +2 -2
  52. package/link/persisted-queries/index.js.map +1 -1
  53. package/link/persisted-queries/persisted-queries.cjs +2 -2
  54. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  55. package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
  56. package/link/utils/toPromise.js +1 -1
  57. package/link/utils/utils.cjs +2 -2
  58. package/link/utils/utils.cjs.map +1 -1
  59. package/link/utils/utils.cjs.native.js +2 -2
  60. package/link/utils/validateOperation.js +1 -1
  61. package/masking/internal/types.d.ts +2 -2
  62. package/masking/internal/types.js.map +1 -1
  63. package/masking/types.d.ts +2 -2
  64. package/masking/types.js.map +1 -1
  65. package/package.json +4 -3
  66. package/react/context/ApolloConsumer.js +1 -1
  67. package/react/context/ApolloContext.js +1 -1
  68. package/react/context/ApolloProvider.js +1 -1
  69. package/react/context/context.cjs +3 -3
  70. package/react/context/context.cjs.map +1 -1
  71. package/react/context/context.cjs.native.js +3 -3
  72. package/react/hoc/hoc-utils.js +1 -1
  73. package/react/hoc/hoc.cjs +2 -2
  74. package/react/hoc/hoc.cjs.map +1 -1
  75. package/react/hoc/hoc.cjs.native.js +2 -2
  76. package/react/hoc/withApollo.js +1 -1
  77. package/react/hooks/hooks.cjs +34 -20
  78. package/react/hooks/hooks.cjs.map +1 -1
  79. package/react/hooks/hooks.cjs.native.js +34 -20
  80. package/react/hooks/useApolloClient.js +1 -1
  81. package/react/hooks/useFragment.d.ts +1 -1
  82. package/react/hooks/useFragment.js +33 -19
  83. package/react/hooks/useFragment.js.map +1 -1
  84. package/react/hooks/useLoadableQuery.js +2 -2
  85. package/react/hooks/useSubscription.js +3 -3
  86. package/react/hooks/useSuspenseQuery.js +2 -2
  87. package/react/hooks/useSyncExternalStore.js +1 -1
  88. package/react/internal/cache/QueryReference.js +2 -2
  89. package/react/internal/cache/QueryReference.js.map +1 -1
  90. package/react/internal/internal.cjs +3 -3
  91. package/react/internal/internal.cjs.map +1 -1
  92. package/react/internal/internal.cjs.native.js +3 -3
  93. package/react/parser/index.js +5 -5
  94. package/react/parser/parser.cjs +5 -5
  95. package/react/parser/parser.cjs.map +1 -1
  96. package/react/parser/parser.cjs.native.js +5 -5
  97. package/testing/core/core.cjs +2 -2
  98. package/testing/core/core.cjs.map +1 -1
  99. package/testing/core/core.cjs.native.js +2 -2
  100. package/testing/core/mocking/mockLink.js +2 -2
  101. package/testing/internal/ObservableStream.d.ts +11 -15
  102. package/testing/internal/ObservableStream.js +18 -62
  103. package/testing/internal/ObservableStream.js.map +1 -1
  104. package/testing/internal/index.d.ts +1 -2
  105. package/testing/internal/index.js +1 -2
  106. package/testing/internal/index.js.map +1 -1
  107. package/testing/internal/renderHelpers.d.ts +13 -2
  108. package/testing/internal/renderHelpers.js +20 -12
  109. package/testing/internal/renderHelpers.js.map +1 -1
  110. package/testing/matchers/index.js +0 -3
  111. package/testing/matchers/index.js.map +1 -1
  112. package/utilities/globals/globals.cjs +1 -1
  113. package/utilities/globals/globals.cjs.map +1 -1
  114. package/utilities/globals/globals.cjs.native.js +1 -1
  115. package/utilities/graphql/DocumentTransform.js +1 -1
  116. package/utilities/graphql/directives.js +7 -7
  117. package/utilities/graphql/fragments.d.ts +1 -0
  118. package/utilities/graphql/fragments.js +18 -3
  119. package/utilities/graphql/fragments.js.map +1 -1
  120. package/utilities/graphql/getFromAST.js +8 -8
  121. package/utilities/graphql/storeUtils.js +1 -1
  122. package/utilities/graphql/transform.js +8 -2
  123. package/utilities/graphql/transform.js.map +1 -1
  124. package/utilities/index.d.ts +1 -1
  125. package/utilities/index.js +1 -1
  126. package/utilities/index.js.map +1 -1
  127. package/utilities/utilities.cjs +41 -22
  128. package/utilities/utilities.cjs.map +1 -1
  129. package/utilities/utilities.cjs.native.js +41 -22
  130. package/version.js +1 -1
  131. package/testing/internal/profile/Render.d.ts +0 -69
  132. package/testing/internal/profile/Render.js +0 -144
  133. package/testing/internal/profile/Render.js.map +0 -1
  134. package/testing/internal/profile/context.d.ts +0 -10
  135. package/testing/internal/profile/context.js +0 -14
  136. package/testing/internal/profile/context.js.map +0 -1
  137. package/testing/internal/profile/index.d.ts +0 -4
  138. package/testing/internal/profile/index.js +0 -2
  139. package/testing/internal/profile/index.js.map +0 -1
  140. package/testing/internal/profile/profile.d.ts +0 -109
  141. package/testing/internal/profile/profile.js +0 -304
  142. package/testing/internal/profile/profile.js.map +0 -1
  143. package/testing/internal/profile/traces.d.ts +0 -7
  144. package/testing/internal/profile/traces.js +0 -30
  145. package/testing/internal/profile/traces.js.map +0 -1
  146. package/testing/matchers/ProfiledComponent.d.ts +0 -8
  147. package/testing/matchers/ProfiledComponent.js +0 -110
  148. package/testing/matchers/ProfiledComponent.js.map +0 -1
@@ -2,22 +2,18 @@ import type { Observable } from "../../utilities/index.js";
2
2
  interface TakeOptions {
3
3
  timeout?: number;
4
4
  }
5
- type ObservableEvent<T> = {
6
- type: "next";
7
- value: T;
8
- } | {
9
- type: "error";
10
- error: any;
11
- } | {
12
- type: "complete";
13
- };
14
- declare class IteratorStream<T> {
15
- private iterator;
16
- constructor(iterator: AsyncGenerator<T, void, unknown>);
17
- take({ timeout }?: TakeOptions): Promise<T>;
18
- }
19
- export declare class ObservableStream<T> extends IteratorStream<ObservableEvent<T>> {
5
+ export declare class ObservableStream<T> {
6
+ private reader;
20
7
  constructor(observable: Observable<T>);
8
+ take({ timeout }?: TakeOptions): Promise<{
9
+ type: "error";
10
+ error: any;
11
+ } | {
12
+ type: "complete";
13
+ } | {
14
+ type: "next";
15
+ value: T;
16
+ } | Awaited<T>>;
21
17
  takeNext(options?: TakeOptions): Promise<T>;
22
18
  takeError(options?: TakeOptions): Promise<any>;
23
19
  takeComplete(options?: TakeOptions): Promise<void>;
@@ -1,66 +1,22 @@
1
- import { __asyncGenerator, __await, __awaiter, __extends, __generator } from "tslib";
2
- function observableToAsyncEventIterator(observable) {
3
- return __asyncGenerator(this, arguments, function observableToAsyncEventIterator_1() {
4
- function queuePromise() {
5
- promises.push(new Promise(function (resolve) {
6
- resolveNext = function (event) {
7
- resolve(event);
8
- queuePromise();
9
- };
10
- }));
11
- }
12
- var resolveNext, promises;
13
- return __generator(this, function (_a) {
14
- switch (_a.label) {
15
- case 0:
16
- promises = [];
17
- queuePromise();
18
- observable.subscribe(function (value) { return resolveNext({ type: "next", value: value }); }, function (error) { return resolveNext({ type: "error", error: error }); }, function () { return resolveNext({ type: "complete" }); });
19
- return [4 /*yield*/, __await("initialization value")];
20
- case 1: return [4 /*yield*/, _a.sent()];
21
- case 2:
22
- _a.sent();
23
- _a.label = 3;
24
- case 3:
25
- if (!true) return [3 /*break*/, 6];
26
- return [4 /*yield*/, __await(promises.shift())];
27
- case 4: return [4 /*yield*/, _a.sent()];
28
- case 5:
29
- _a.sent();
30
- return [3 /*break*/, 3];
31
- case 6: return [2 /*return*/];
32
- }
33
- });
34
- });
35
- }
36
- var IteratorStream = /** @class */ (function () {
37
- function IteratorStream(iterator) {
38
- this.iterator = iterator;
39
- }
40
- IteratorStream.prototype.take = function () {
41
- return __awaiter(this, arguments, void 0, function (_a) {
42
- var _b = _a === void 0 ? {} : _a, _c = _b.timeout, timeout = _c === void 0 ? 100 : _c;
43
- return __generator(this, function (_d) {
44
- return [2 /*return*/, Promise.race([
45
- this.iterator.next().then(function (result) { return result.value; }),
46
- new Promise(function (_, reject) {
47
- setTimeout(reject, timeout, new Error("Timeout waiting for next event"));
48
- }),
49
- ])];
50
- });
51
- });
52
- };
53
- return IteratorStream;
54
- }());
55
- var ObservableStream = /** @class */ (function (_super) {
56
- __extends(ObservableStream, _super);
1
+ import { __awaiter, __generator } from "tslib";
2
+ import { ReadableStream } from "node:stream/web";
3
+ var ObservableStream = /** @class */ (function () {
57
4
  function ObservableStream(observable) {
58
- var iterator = observableToAsyncEventIterator(observable);
59
- // we need to call next() once to start the generator so we immediately subscribe.
60
- // the first value is always "initialization value" which we don't care about
61
- iterator.next();
62
- return _super.call(this, iterator) || this;
5
+ this.reader = new ReadableStream({
6
+ start: function (controller) {
7
+ observable.subscribe(function (value) { return controller.enqueue({ type: "next", value: value }); }, function (error) { return controller.enqueue({ type: "error", error: error }); }, function () { return controller.enqueue({ type: "complete" }); });
8
+ },
9
+ }).getReader();
63
10
  }
11
+ ObservableStream.prototype.take = function (_a) {
12
+ var _b = _a === void 0 ? {} : _a, _c = _b.timeout, timeout = _c === void 0 ? 100 : _c;
13
+ return Promise.race([
14
+ this.reader.read().then(function (result) { return result.value; }),
15
+ new Promise(function (_, reject) {
16
+ setTimeout(reject, timeout, new Error("Timeout waiting for next event"));
17
+ }),
18
+ ]);
19
+ };
64
20
  ObservableStream.prototype.takeNext = function (options) {
65
21
  return __awaiter(this, void 0, void 0, function () {
66
22
  var event;
@@ -104,6 +60,6 @@ var ObservableStream = /** @class */ (function (_super) {
104
60
  });
105
61
  };
106
62
  return ObservableStream;
107
- }(IteratorStream));
63
+ }());
108
64
  export { ObservableStream };
109
65
  //# sourceMappingURL=ObservableStream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObservableStream.js","sourceRoot":"","sources":["../../../src/testing/internal/ObservableStream.ts"],"names":[],"mappings":";AAUA,SAAgB,8BAA8B,CAAI,UAAyB;;QAKzE,SAAS,YAAY;YACnB,QAAQ,CAAC,IAAI,CACX,IAAI,OAAO,CAAqB,UAAC,OAAO;gBACtC,WAAW,GAAG,UAAC,KAAyB;oBACtC,OAAO,CAAC,KAAK,CAAC,CAAC;oBACf,YAAY,EAAE,CAAC;gBACjB,CAAC,CAAC;YACJ,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;;;;;oBAZK,QA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AC7E,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChB,OAAA,MAAK,YAAC,QAAQ,CAAC,SAAC;IAClB,CAAC;IAEK,mCAAQ,GAAd,UAAe,OAAqB;;;;;4BACpB,qBAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;wBAAhC,KAAK,GAAG,SAAwB;wBACtC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;wBAClE,sBAAQ,KAA+C,CAAC,KAAK,EAAC;;;;KAC/D;IAEK,oCAAS,GAAf,UAAgB,OAAqB;;;;;4BACrB,qBAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;wBAAhC,KAAK,GAAG,SAAwB;wBACtC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;wBACnE,sBAAQ,KAAgD,CAAC,KAAK,EAAC;;;;KAChE;IAEK,uCAAY,GAAlB,UAAmB,OAAqB;;;;;4BACxB,qBAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;wBAAhC,KAAK,GAAG,SAAwB;wBACtC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;;;;;KAC7C;IACH,uBAAC;AAAD,CAAC,AAzBD,CAAyC,cAAc,GAyBtD","sourcesContent":["import type { Observable } from \"../../utilities/index.js\";\n\ninterface TakeOptions {\n timeout?: number;\n}\ntype ObservableEvent<T> =\n | { type: \"next\"; value: T }\n | { type: \"error\"; error: any }\n | { type: \"complete\" };\n\nasync function* observableToAsyncEventIterator<T>(observable: Observable<T>) {\n let resolveNext: (value: ObservableEvent<T>) => void;\n const promises: Promise<ObservableEvent<T>>[] = [];\n queuePromise();\n\n function queuePromise() {\n promises.push(\n new Promise<ObservableEvent<T>>((resolve) => {\n resolveNext = (event: ObservableEvent<T>) => {\n resolve(event);\n queuePromise();\n };\n })\n );\n }\n\n observable.subscribe(\n (value) => resolveNext({ type: \"next\", value }),\n (error) => resolveNext({ type: \"error\", error }),\n () => resolveNext({ type: \"complete\" })\n );\n yield \"initialization value\" as unknown as Promise<ObservableEvent<T>>;\n\n while (true) {\n yield promises.shift()!;\n }\n}\n\nclass IteratorStream<T> {\n constructor(private iterator: AsyncGenerator<T, void, unknown>) {}\n\n async take({ timeout = 100 }: TakeOptions = {}): Promise<T> {\n return Promise.race([\n this.iterator.next().then((result) => result.value!),\n new Promise<T>((_, reject) => {\n setTimeout(\n reject,\n timeout,\n new Error(\"Timeout waiting for next event\")\n );\n }),\n ]);\n }\n}\n\nexport class ObservableStream<T> extends IteratorStream<ObservableEvent<T>> {\n constructor(observable: Observable<T>) {\n const iterator = observableToAsyncEventIterator(observable);\n // we need to call next() once to start the generator so we immediately subscribe.\n // the first value is always \"initialization value\" which we don't care about\n iterator.next();\n super(iterator);\n }\n\n async takeNext(options?: TakeOptions): Promise<T> {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"next\", value: expect.anything() });\n return (event as ObservableEvent<T> & { type: \"next\" }).value;\n }\n\n async takeError(options?: TakeOptions): Promise<any> {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"error\", error: expect.anything() });\n return (event as ObservableEvent<T> & { type: \"error\" }).error;\n }\n\n async takeComplete(options?: TakeOptions): Promise<void> {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"complete\" });\n }\n}\n"]}
1
+ {"version":3,"file":"ObservableStream.js","sourceRoot":"","sources":["../../../src/testing/internal/ObservableStream.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAUjD;IAEE,0BAAY,UAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAqB;Y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B,OAAqB;;;;;4BACrB,qBAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;wBAAhC,KAAK,GAAG,SAAwB;wBACtC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;wBACnE,sBAAQ,KAAgD,CAAC,KAAK,EAAC;;;;KAChE;IAEK,uCAAY,GAAlB,UAAmB,OAAqB;;;;;4BACxB,qBAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;wBAAhC,KAAK,GAAG,SAAwB;wBACtC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;;;;;KAC7C;IACH,uBAAC;AAAD,CAAC,AA3CD,IA2CC","sourcesContent":["import type { Observable } from \"../../utilities/index.js\";\nimport { ReadableStream } from \"node:stream/web\";\n\ninterface TakeOptions {\n timeout?: number;\n}\ntype ObservableEvent<T> =\n | { type: \"next\"; value: T }\n | { type: \"error\"; error: any }\n | { type: \"complete\" };\n\nexport class ObservableStream<T> {\n private reader: ReadableStreamDefaultReader<ObservableEvent<T>>;\n constructor(observable: Observable<T>) {\n this.reader = new ReadableStream<ObservableEvent<T>>({\n start(controller) {\n observable.subscribe(\n (value) => controller.enqueue({ type: \"next\", value }),\n (error) => controller.enqueue({ type: \"error\", error }),\n () => controller.enqueue({ type: \"complete\" })\n );\n },\n }).getReader();\n }\n\n take({ timeout = 100 }: TakeOptions = {}) {\n return Promise.race([\n this.reader.read().then((result) => result.value!),\n new Promise<T>((_, reject) => {\n setTimeout(\n reject,\n timeout,\n new Error(\"Timeout waiting for next event\")\n );\n }),\n ]);\n }\n\n async takeNext(options?: TakeOptions): Promise<T> {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"next\", value: expect.anything() });\n return (event as ObservableEvent<T> & { type: \"next\" }).value;\n }\n\n async takeError(options?: TakeOptions): Promise<any> {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"error\", error: expect.anything() });\n return (event as ObservableEvent<T> & { type: \"error\" }).error;\n }\n\n async takeComplete(options?: TakeOptions): Promise<void> {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"complete\" });\n }\n}\n"]}
@@ -1,8 +1,7 @@
1
- export * from "./profile/index.js";
2
1
  export * from "./disposables/index.js";
3
2
  export { ObservableStream } from "./ObservableStream.js";
4
3
  export type { SimpleCaseData, PaginatedCaseData, PaginatedCaseVariables, VariablesCaseData, VariablesCaseVariables, } from "./scenarios/index.js";
5
4
  export { setupSimpleCase, setupVariablesCase, setupPaginatedCase, } from "./scenarios/index.js";
6
5
  export type { RenderWithClientOptions, RenderWithMocksOptions, } from "./renderHelpers.js";
7
- export { renderWithClient, renderWithMocks } from "./renderHelpers.js";
6
+ export { renderWithClient, renderWithMocks, createMockWrapper, createClientWrapper, } from "./renderHelpers.js";
8
7
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,5 @@
1
- export * from "./profile/index.js";
2
1
  export * from "./disposables/index.js";
3
2
  export { ObservableStream } from "./ObservableStream.js";
4
3
  export { setupSimpleCase, setupVariablesCase, setupPaginatedCase, } from "./scenarios/index.js";
5
- export { renderWithClient, renderWithMocks } from "./renderHelpers.js";
4
+ export { renderWithClient, renderWithMocks, createMockWrapper, createClientWrapper, } from "./renderHelpers.js";
6
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AASzD,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export * from \"./profile/index.js\";\nexport * from \"./disposables/index.js\";\nexport { ObservableStream } from \"./ObservableStream.js\";\n\nexport type {\n SimpleCaseData,\n PaginatedCaseData,\n PaginatedCaseVariables,\n VariablesCaseData,\n VariablesCaseVariables,\n} from \"./scenarios/index.js\";\nexport {\n setupSimpleCase,\n setupVariablesCase,\n setupPaginatedCase,\n} from \"./scenarios/index.js\";\n\nexport type {\n RenderWithClientOptions,\n RenderWithMocksOptions,\n} from \"./renderHelpers.js\";\nexport { renderWithClient, renderWithMocks } from \"./renderHelpers.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AASzD,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC","sourcesContent":["export * from \"./disposables/index.js\";\nexport { ObservableStream } from \"./ObservableStream.js\";\n\nexport type {\n SimpleCaseData,\n PaginatedCaseData,\n PaginatedCaseVariables,\n VariablesCaseData,\n VariablesCaseVariables,\n} from \"./scenarios/index.js\";\nexport {\n setupSimpleCase,\n setupVariablesCase,\n setupPaginatedCase,\n} from \"./scenarios/index.js\";\n\nexport type {\n RenderWithClientOptions,\n RenderWithMocksOptions,\n} from \"./renderHelpers.js\";\nexport {\n renderWithClient,\n renderWithMocks,\n createMockWrapper,\n createClientWrapper,\n} from \"./renderHelpers.js\";\n"]}
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  import type { ReactElement } from "react";
2
3
  import type { Queries, RenderOptions, queries } from "@testing-library/react";
3
4
  import type { ApolloClient } from "../../core/index.js";
@@ -5,8 +6,18 @@ import type { MockedProviderProps } from "../react/MockedProvider.js";
5
6
  export interface RenderWithClientOptions<Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container> extends RenderOptions<Q, Container, BaseElement> {
6
7
  client: ApolloClient<any>;
7
8
  }
8
- export declare function renderWithClient<Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container>(ui: ReactElement, { client, wrapper: Wrapper, ...renderOptions }: RenderWithClientOptions<Q, Container, BaseElement>): import("@testing-library/react").RenderResult<Q, Container, BaseElement>;
9
+ export declare function createClientWrapper(client: ApolloClient<any>, Wrapper?: React.JSXElementConstructor<{
10
+ children: React.ReactNode;
11
+ }>): React.JSXElementConstructor<{
12
+ children: React.ReactNode;
13
+ }>;
14
+ export declare function renderWithClient<Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container>(ui: ReactElement, { client, wrapper, ...renderOptions }: RenderWithClientOptions<Q, Container, BaseElement>): import("@testing-library/react").RenderResult<Q, Container, BaseElement>;
9
15
  export interface RenderWithMocksOptions<Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container> extends RenderOptions<Q, Container, BaseElement>, MockedProviderProps<any> {
10
16
  }
11
- export declare function renderWithMocks<Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container>(ui: ReactElement, { wrapper: Wrapper, ...renderOptions }: RenderWithMocksOptions<Q, Container, BaseElement>): import("@testing-library/react").RenderResult<Q, Container, BaseElement>;
17
+ export declare function createMockWrapper(renderOptions: MockedProviderProps<any>, Wrapper?: React.JSXElementConstructor<{
18
+ children: React.ReactNode;
19
+ }>): React.JSXElementConstructor<{
20
+ children: React.ReactNode;
21
+ }>;
22
+ export declare function renderWithMocks<Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container>(ui: ReactElement, { wrapper, ...renderOptions }: RenderWithMocksOptions<Q, Container, BaseElement>): import("@testing-library/react").RenderResult<Q, Container, BaseElement>;
12
23
  //# sourceMappingURL=renderHelpers.d.ts.map
@@ -3,20 +3,28 @@ import * as React from "react";
3
3
  import { render } from "@testing-library/react";
4
4
  import { ApolloProvider } from "../../react/index.js";
5
5
  import { MockedProvider } from "../react/MockedProvider.js";
6
+ export function createClientWrapper(client, Wrapper) {
7
+ if (Wrapper === void 0) { Wrapper = React.Fragment; }
8
+ return function (_a) {
9
+ var children = _a.children;
10
+ return (React.createElement(ApolloProvider, { client: client },
11
+ React.createElement(Wrapper, null, children)));
12
+ };
13
+ }
6
14
  export function renderWithClient(ui, _a) {
7
- var client = _a.client, _b = _a.wrapper, Wrapper = _b === void 0 ? React.Fragment : _b, renderOptions = __rest(_a, ["client", "wrapper"]);
8
- return render(ui, __assign(__assign({}, renderOptions), { wrapper: function (_a) {
9
- var children = _a.children;
10
- return (React.createElement(ApolloProvider, { client: client },
11
- React.createElement(Wrapper, null, children)));
12
- } }));
15
+ var client = _a.client, wrapper = _a.wrapper, renderOptions = __rest(_a, ["client", "wrapper"]);
16
+ return render(ui, __assign(__assign({}, renderOptions), { wrapper: createClientWrapper(client, wrapper) }));
17
+ }
18
+ export function createMockWrapper(renderOptions, Wrapper) {
19
+ if (Wrapper === void 0) { Wrapper = React.Fragment; }
20
+ return function (_a) {
21
+ var children = _a.children;
22
+ return (React.createElement(MockedProvider, __assign({}, renderOptions),
23
+ React.createElement(Wrapper, null, children)));
24
+ };
13
25
  }
14
26
  export function renderWithMocks(ui, _a) {
15
- var _b = _a.wrapper, Wrapper = _b === void 0 ? React.Fragment : _b, renderOptions = __rest(_a, ["wrapper"]);
16
- return render(ui, __assign(__assign({}, renderOptions), { wrapper: function (_a) {
17
- var children = _a.children;
18
- return (React.createElement(MockedProvider, __assign({}, renderOptions),
19
- React.createElement(Wrapper, null, children)));
20
- } }));
27
+ var wrapper = _a.wrapper, renderOptions = __rest(_a, ["wrapper"]);
28
+ return render(ui, __assign(__assign({}, renderOptions), { wrapper: createMockWrapper(renderOptions, wrapper) }));
21
29
  }
22
30
  //# sourceMappingURL=renderHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderHelpers.js","sourceRoot":"","sources":["../../../src/testing/internal/renderHelpers.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAU5D,MAAM,UAAU,gBAAgB,CAK9B,EAAgB,EAChB,EAIqD;IAHnD,IAAA,MAAM,YAAA,EACN,eAAiC,EAAxB,OAAO,mBAAG,KAAK,CAAC,QAAQ,KAAA,EAC9B,aAAa,cAHlB,qBAIC,CADiB;IAGlB,OAAO,MAAM,CAAC,EAAE,wBACX,aAAa,KAChB,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAClB,OAAO,CACL,oBAAC,cAAc,IAAC,MAAM,EAAE,MAAM;gBAC5B,oBAAC,OAAO,QAAE,QAAQ,CAAW,CACd,CAClB,CAAC;QACJ,CAAC,IACD,CAAC;AACL,CAAC;AASD,MAAM,UAAU,eAAe,CAK7B,EAAgB,EAChB,EAGoD;IAFlD,IAAA,eAAiC,EAAxB,OAAO,mBAAG,KAAK,CAAC,QAAQ,KAAA,EAC9B,aAAa,cAFlB,WAGC,CADiB;IAGlB,OAAO,MAAM,CAAC,EAAE,wBACX,aAAa,KAChB,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAClB,OAAO,CACL,oBAAC,cAAc,eAAK,aAAa;gBAC/B,oBAAC,OAAO,QAAE,QAAQ,CAAW,CACd,CAClB,CAAC;QACJ,CAAC,IACD,CAAC;AACL,CAAC","sourcesContent":["import * as React from \"react\";\nimport type { ReactElement } from \"react\";\nimport { render } from \"@testing-library/react\";\nimport type { Queries, RenderOptions, queries } from \"@testing-library/react\";\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { ApolloProvider } from \"../../react/index.js\";\nimport type { MockedProviderProps } from \"../react/MockedProvider.js\";\nimport { MockedProvider } from \"../react/MockedProvider.js\";\n\nexport interface RenderWithClientOptions<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n> extends RenderOptions<Q, Container, BaseElement> {\n client: ApolloClient<any>;\n}\n\nexport function renderWithClient<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n>(\n ui: ReactElement,\n {\n client,\n wrapper: Wrapper = React.Fragment,\n ...renderOptions\n }: RenderWithClientOptions<Q, Container, BaseElement>\n) {\n return render(ui, {\n ...renderOptions,\n wrapper: ({ children }) => {\n return (\n <ApolloProvider client={client}>\n <Wrapper>{children}</Wrapper>\n </ApolloProvider>\n );\n },\n });\n}\n\nexport interface RenderWithMocksOptions<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n> extends RenderOptions<Q, Container, BaseElement>,\n MockedProviderProps<any> {}\n\nexport function renderWithMocks<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n>(\n ui: ReactElement,\n {\n wrapper: Wrapper = React.Fragment,\n ...renderOptions\n }: RenderWithMocksOptions<Q, Container, BaseElement>\n) {\n return render(ui, {\n ...renderOptions,\n wrapper: ({ children }) => {\n return (\n <MockedProvider {...renderOptions}>\n <Wrapper>{children}</Wrapper>\n </MockedProvider>\n );\n },\n });\n}\n"]}
1
+ {"version":3,"file":"renderHelpers.js","sourceRoot":"","sources":["../../../src/testing/internal/renderHelpers.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,K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react\";\nimport type { ReactElement } from \"react\";\nimport { render } from \"@testing-library/react\";\nimport type { Queries, RenderOptions, queries } from \"@testing-library/react\";\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { ApolloProvider } from \"../../react/index.js\";\nimport type { MockedProviderProps } from \"../react/MockedProvider.js\";\nimport { MockedProvider } from \"../react/MockedProvider.js\";\n\nexport interface RenderWithClientOptions<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n> extends RenderOptions<Q, Container, BaseElement> {\n client: ApolloClient<any>;\n}\n\nexport function createClientWrapper(\n client: ApolloClient<any>,\n Wrapper: React.JSXElementConstructor<{\n children: React.ReactNode;\n }> = React.Fragment\n): React.JSXElementConstructor<{\n children: React.ReactNode;\n}> {\n return ({ children }) => {\n return (\n <ApolloProvider client={client}>\n <Wrapper>{children}</Wrapper>\n </ApolloProvider>\n );\n };\n}\n\nexport function renderWithClient<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n>(\n ui: ReactElement,\n {\n client,\n wrapper,\n ...renderOptions\n }: RenderWithClientOptions<Q, Container, BaseElement>\n) {\n return render(ui, {\n ...renderOptions,\n wrapper: createClientWrapper(client, wrapper),\n });\n}\n\nexport interface RenderWithMocksOptions<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n> extends RenderOptions<Q, Container, BaseElement>,\n MockedProviderProps<any> {}\n\nexport function createMockWrapper(\n renderOptions: MockedProviderProps<any>,\n Wrapper: React.JSXElementConstructor<{\n children: React.ReactNode;\n }> = React.Fragment\n): React.JSXElementConstructor<{\n children: React.ReactNode;\n}> {\n return ({ children }) => {\n return (\n <MockedProvider {...renderOptions}>\n <Wrapper>{children}</Wrapper>\n </MockedProvider>\n );\n };\n}\n\nexport function renderWithMocks<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n>(\n ui: ReactElement,\n {\n wrapper,\n ...renderOptions\n }: RenderWithMocksOptions<Q, Container, BaseElement>\n) {\n return render(ui, {\n ...renderOptions,\n wrapper: createMockWrapper(renderOptions, wrapper),\n });\n}\n"]}
@@ -1,15 +1,12 @@
1
1
  import { expect } from "@jest/globals";
2
2
  import { toMatchDocument } from "./toMatchDocument.js";
3
3
  import { toHaveSuspenseCacheEntryUsing } from "./toHaveSuspenseCacheEntryUsing.js";
4
- import { toRerender, toRenderExactlyTimes } from "./ProfiledComponent.js";
5
4
  import { toBeGarbageCollected } from "./toBeGarbageCollected.js";
6
5
  import { toBeDisposed } from "./toBeDisposed.js";
7
6
  expect.extend({
8
7
  toBeDisposed: toBeDisposed,
9
8
  toHaveSuspenseCacheEntryUsing: toHaveSuspenseCacheEntryUsing,
10
9
  toMatchDocument: toMatchDocument,
11
- toRerender: toRerender,
12
- toRenderExactlyTimes: toRenderExactlyTimes,
13
10
  toBeGarbageCollected: toBeGarbageCollected,
14
11
  });
15
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/matchers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,MAAM,CAAC;IACZ,YAAY,cAAA;IACZ,6BAA6B,+BAAA;IAC7B,eAAe,iBAAA;IACf,UAAU,YAAA;IACV,oBAAoB,sBAAA;IACpB,oBAAoB,sBAAA;CACrB,CAAC,CAAC","sourcesContent":["import { expect } from \"@jest/globals\";\nimport { toMatchDocument } from \"./toMatchDocument.js\";\nimport { toHaveSuspenseCacheEntryUsing } from \"./toHaveSuspenseCacheEntryUsing.js\";\nimport { toRerender, toRenderExactlyTimes } from \"./ProfiledComponent.js\";\nimport { toBeGarbageCollected } from \"./toBeGarbageCollected.js\";\nimport { toBeDisposed } from \"./toBeDisposed.js\";\n\nexpect.extend({\n toBeDisposed,\n toHaveSuspenseCacheEntryUsing,\n toMatchDocument,\n toRerender,\n toRenderExactlyTimes,\n toBeGarbageCollected,\n});\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/matchers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,MAAM,CAAC;IACZ,YAAY,cAAA;IACZ,6BAA6B,+BAAA;IAC7B,eAAe,iBAAA;IACf,oBAAoB,sBAAA;CACrB,CAAC,CAAC","sourcesContent":["import { expect } from \"@jest/globals\";\nimport { toMatchDocument } from \"./toMatchDocument.js\";\nimport { toHaveSuspenseCacheEntryUsing } from \"./toHaveSuspenseCacheEntryUsing.js\";\nimport { toBeGarbageCollected } from \"./toBeGarbageCollected.js\";\nimport { toBeDisposed } from \"./toBeDisposed.js\";\n\nexpect.extend({\n toBeDisposed,\n toHaveSuspenseCacheEntryUsing,\n toMatchDocument,\n toBeGarbageCollected,\n});\n"]}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tsInvariant = require('ts-invariant');
6
6
 
7
- var version = "3.12.0-alpha.0";
7
+ var version = "3.12.0-rc.1";
8
8
 
9
9
  function maybe(thunk) {
10
10
  try {
@@ -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.12.0-alpha.0\";\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 if (typeof arg == \"string\") {\n return arg;\n }\n try {\n return stringifyForDisplay(arg, 2).slice(0, 1000);\n }\n catch (_a) {\n return \"<non-serializable>\";\n }\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,gBAAgB;;ACA9B,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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W,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;;ACtEU,IAAC,GAAG,GAAG,UAAU,CAAC,OAAO,KAAK;;;;;;;;;;"}
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.12.0-rc.1\";\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 if (typeof arg == \"string\") {\n return arg;\n }\n try {\n return stringifyForDisplay(arg, 2).slice(0, 1000);\n }\n catch (_a) {\n return \"<non-serializable>\";\n }\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,aAAa;;ACA3B,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,CA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,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;;ACtEU,IAAC,GAAG,GAAG,UAAU,CAAC,OAAO,KAAK;;;;;;;;;;"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tsInvariant = require('ts-invariant');
6
6
 
7
- var version = "3.12.0-alpha.0";
7
+ var version = "3.12.0-rc.1";
8
8
 
9
9
  function maybe(thunk) {
10
10
  try {
@@ -54,7 +54,7 @@ var DocumentTransform = /** @class */ (function () {
54
54
  makeCacheKey: function (document) {
55
55
  var cacheKeys = _this.getCacheKey(document);
56
56
  if (cacheKeys) {
57
- invariant(Array.isArray(cacheKeys), 76);
57
+ invariant(Array.isArray(cacheKeys), 77);
58
58
  return stableCacheKeys_1.lookupArray(cacheKeys);
59
59
  }
60
60
  },
@@ -11,7 +11,7 @@ export function shouldInclude(_a, variables) {
11
11
  if (ifArgument.value.kind === "Variable") {
12
12
  evaledValue =
13
13
  variables && variables[ifArgument.value.name.value];
14
- invariant(evaledValue !== void 0, 77, directive.name.value);
14
+ invariant(evaledValue !== void 0, 78, directive.name.value);
15
15
  }
16
16
  else {
17
17
  evaledValue = ifArgument.value.value;
@@ -63,13 +63,13 @@ export function getInclusionDirectives(directives) {
63
63
  return;
64
64
  var directiveArguments = directive.arguments;
65
65
  var directiveName = directive.name.value;
66
- invariant(directiveArguments && directiveArguments.length === 1, 78, directiveName);
66
+ invariant(directiveArguments && directiveArguments.length === 1, 79, directiveName);
67
67
  var ifArgument = directiveArguments[0];
68
- invariant(ifArgument.name && ifArgument.name.value === "if", 79, directiveName);
68
+ invariant(ifArgument.name && ifArgument.name.value === "if", 80, directiveName);
69
69
  var ifValue = ifArgument.value;
70
70
  // means it has to be a variable value if this is a valid @skip or @include directive
71
71
  invariant(ifValue &&
72
- (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 80, directiveName);
72
+ (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 81, directiveName);
73
73
  result.push({ directive: directive, ifArgument: ifArgument });
74
74
  });
75
75
  }
@@ -92,13 +92,13 @@ export function getFragmentMaskMode(fragment) {
92
92
  if (globalThis.__DEV__ !== false) {
93
93
  if (modeArg) {
94
94
  if (modeArg.value.kind === Kind.VARIABLE) {
95
- globalThis.__DEV__ !== false && invariant.warn(81);
95
+ globalThis.__DEV__ !== false && invariant.warn(82);
96
96
  }
97
97
  else if (modeArg.value.kind !== Kind.STRING) {
98
- globalThis.__DEV__ !== false && invariant.warn(82);
98
+ globalThis.__DEV__ !== false && invariant.warn(83);
99
99
  }
100
100
  else if (modeArg.value.value !== "migrate") {
101
- globalThis.__DEV__ !== false && invariant.warn(83, modeArg.value.value);
101
+ globalThis.__DEV__ !== false && invariant.warn(84, modeArg.value.value);
102
102
  }
103
103
  }
104
104
  }
@@ -31,4 +31,5 @@ export interface FragmentMap {
31
31
  export type FragmentMapFunction = (fragmentName: string) => FragmentDefinitionNode | null;
32
32
  export declare function createFragmentMap(fragments?: FragmentDefinitionNode[]): FragmentMap;
33
33
  export declare function getFragmentFromSelection(selection: SelectionNode, fragmentMap?: FragmentMap | FragmentMapFunction): InlineFragmentNode | FragmentDefinitionNode | null;
34
+ export declare function isFullyUnmaskedOperation(document: DocumentNode): boolean;
34
35
  //# sourceMappingURL=fragments.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { __assign, __spreadArray } from "tslib";
2
2
  import { invariant, newInvariantError } from "../globals/index.js";
3
+ import { BREAK, visit } from "graphql";
3
4
  /**
4
5
  * Returns a query document which adds a single query operation that only
5
6
  * spreads the target fragment inside of it.
@@ -33,7 +34,7 @@ export function getFragmentQueryDocument(document, fragmentName) {
33
34
  // define our own operation definition later on.
34
35
  if (definition.kind === "OperationDefinition") {
35
36
  throw newInvariantError(
36
- 84,
37
+ 85,
37
38
  definition.operation,
38
39
  definition.name ? " named '".concat(definition.name.value, "'") : ""
39
40
  );
@@ -47,7 +48,7 @@ export function getFragmentQueryDocument(document, fragmentName) {
47
48
  // If the user did not give us a fragment name then let us try to get a
48
49
  // name from a single fragment in the definition.
49
50
  if (typeof actualFragmentName === "undefined") {
50
- invariant(fragments.length === 1, 85, fragments.length);
51
+ invariant(fragments.length === 1, 86, fragments.length);
51
52
  actualFragmentName = fragments[0].name.value;
52
53
  }
53
54
  // Generate a query document with an operation that simply spreads the
@@ -93,11 +94,25 @@ export function getFragmentFromSelection(selection, fragmentMap) {
93
94
  return fragmentMap(fragmentName);
94
95
  }
95
96
  var fragment = fragmentMap && fragmentMap[fragmentName];
96
- invariant(fragment, 86, fragmentName);
97
+ invariant(fragment, 87, fragmentName);
97
98
  return fragment || null;
98
99
  }
99
100
  default:
100
101
  return null;
101
102
  }
102
103
  }
104
+ export function isFullyUnmaskedOperation(document) {
105
+ var isUnmasked = true;
106
+ visit(document, {
107
+ FragmentSpread: function (node) {
108
+ isUnmasked =
109
+ !!node.directives &&
110
+ node.directives.some(function (directive) { return directive.name.value === "unmask"; });
111
+ if (!isUnmasked) {
112
+ return BREAK;
113
+ }
114
+ },
115
+ });
116
+ return isUnmasked;
117
+ }
103
118
  //# sourceMappingURL=fragments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../../src/utilities/graphql/fragments.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAYnE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAAsB,EACtB,YAAqB;IAErB,IAAI,kBAAkB,GAAG,YAAY,CAAC;IAEtC,uEAAuE;IACvE,2EAA2E;IAC3E,qCAAqC;IACrC,IAAM,SAAS,GAAkC,EAAE,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,UAAU;QACtC,yEAAyE;QACzE,gDAAgD;QAChD,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;YAC9C,MAAM,iBAAiB,CACrB,0BAA0B;gBACxB,yFAAyF,EAC3F,UAAU,CAAC,SAAS,EACpB,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAW,UAAU,CAAC,IAAI,CAAC,KAAK,MAAG,CAAC,CAAC,CAAC,EAAE,CAC3D,CAAC;QACJ,CAAC;QACD,gEAAgE;QAChE,cAAc;QACd,IAAI,UAAU,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;YAC7C,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,uEAAuE;IACvE,iDAAiD;IACjD,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE,CAAC;QAC9C,SAAS,CACP,SAAS,CAAC,MAAM,KAAK,CAAC,EACtB,2FAA6F,EAC7F,SAAS,CAAC,MAAM,CACjB,CAAC;QACF,kBAAkB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC/C,CAAC;IAED,sEAAsE;IACtE,yBAAyB;IACzB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QACD;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../globals/index.js\";\n\nimport type {\n DocumentNode,\n FragmentDefinitionNode,\n InlineFragmentNode,\n SelectionNode,\n} from \"graphql\";\n\n// TODO(brian): A hack until this issue is resolved (https://github.com/graphql/graphql-js/issues/3356)\ntype Kind = any;\ntype OperationTypeNode = any;\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array<FragmentDefinitionNode> = [];\n document.definitions.forEach((definition) => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === \"OperationDefinition\") {\n throw newInvariantError(\n `Found a %s operation%s. ` +\n \"No operations are allowed when using a fragment as a query. Only fragments are allowed.\",\n definition.operation,\n definition.name ? ` named '${definition.name.value}'` : \"\"\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === \"FragmentDefinition\") {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === \"undefined\") {\n invariant(\n fragments.length === 1,\n `Found %s fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n fragments.length\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: \"OperationDefinition\" as Kind,\n // OperationTypeNode is an enum\n operation: \"query\" as OperationTypeNode,\n selectionSet: {\n kind: \"SelectionSet\" as Kind,\n selections: [\n {\n kind: \"FragmentSpread\" as Kind,\n name: {\n kind: \"Name\" as Kind,\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\nexport type FragmentMapFunction = (\n fragmentName: string\n) => FragmentDefinitionNode | null;\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = []\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach((fragment) => {\n symTable[fragment.name.value] = fragment;\n });\n return symTable;\n}\n\nexport function getFragmentFromSelection(\n selection: SelectionNode,\n fragmentMap?: FragmentMap | FragmentMapFunction\n): InlineFragmentNode | FragmentDefinitionNode | null {\n switch (selection.kind) {\n case \"InlineFragment\":\n return selection;\n case \"FragmentSpread\": {\n const fragmentName = selection.name.value;\n if (typeof fragmentMap === \"function\") {\n return fragmentMap(fragmentName);\n }\n const fragment = fragmentMap && fragmentMap[fragmentName];\n invariant(fragment, `No fragment named %s`, fragmentName);\n return fragment || null;\n }\n default:\n return null;\n }\n}\n"]}
1
+ {"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../../src/utilities/graphql/fragments.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAWvC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAAsB,EACtB,YAAqB;IAErB,IAAI,kBAAkB,GAAG,YAAY,CAAC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K,KAAK,QAAQ,EAAjC,CAAiC,CAAC,CAAC;YAEzE,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../globals/index.js\";\n\nimport { BREAK, visit } from \"graphql\";\nimport type {\n DocumentNode,\n FragmentDefinitionNode,\n InlineFragmentNode,\n SelectionNode,\n} from \"graphql\";\n\n// TODO(brian): A hack until this issue is resolved (https://github.com/graphql/graphql-js/issues/3356)\ntype Kind = any;\ntype OperationTypeNode = any;\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array<FragmentDefinitionNode> = [];\n document.definitions.forEach((definition) => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === \"OperationDefinition\") {\n throw newInvariantError(\n `Found a %s operation%s. ` +\n \"No operations are allowed when using a fragment as a query. Only fragments are allowed.\",\n definition.operation,\n definition.name ? ` named '${definition.name.value}'` : \"\"\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === \"FragmentDefinition\") {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === \"undefined\") {\n invariant(\n fragments.length === 1,\n `Found %s fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n fragments.length\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: \"OperationDefinition\" as Kind,\n // OperationTypeNode is an enum\n operation: \"query\" as OperationTypeNode,\n selectionSet: {\n kind: \"SelectionSet\" as Kind,\n selections: [\n {\n kind: \"FragmentSpread\" as Kind,\n name: {\n kind: \"Name\" as Kind,\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\nexport type FragmentMapFunction = (\n fragmentName: string\n) => FragmentDefinitionNode | null;\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = []\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach((fragment) => {\n symTable[fragment.name.value] = fragment;\n });\n return symTable;\n}\n\nexport function getFragmentFromSelection(\n selection: SelectionNode,\n fragmentMap?: FragmentMap | FragmentMapFunction\n): InlineFragmentNode | FragmentDefinitionNode | null {\n switch (selection.kind) {\n case \"InlineFragment\":\n return selection;\n case \"FragmentSpread\": {\n const fragmentName = selection.name.value;\n if (typeof fragmentMap === \"function\") {\n return fragmentMap(fragmentName);\n }\n const fragment = fragmentMap && fragmentMap[fragmentName];\n invariant(fragment, `No fragment named %s`, fragmentName);\n return fragment || null;\n }\n default:\n return null;\n }\n}\n\nexport function isFullyUnmaskedOperation(document: DocumentNode) {\n let isUnmasked = true;\n\n visit(document, {\n FragmentSpread: (node) => {\n isUnmasked =\n !!node.directives &&\n node.directives.some((directive) => directive.name.value === \"unmask\");\n\n if (!isUnmasked) {\n return BREAK;\n }\n },\n });\n\n return isUnmasked;\n}\n"]}
@@ -2,16 +2,16 @@ import { invariant, newInvariantError } from "../globals/index.js";
2
2
  import { valueToObjectRepresentation } from "./storeUtils.js";
3
3
  // Checks the document for errors and throws an exception if there is an error.
4
4
  export function checkDocument(doc) {
5
- invariant(doc && doc.kind === "Document", 87);
5
+ invariant(doc && doc.kind === "Document", 88);
6
6
  var operations = doc.definitions
7
7
  .filter(function (d) { return d.kind !== "FragmentDefinition"; })
8
8
  .map(function (definition) {
9
9
  if (definition.kind !== "OperationDefinition") {
10
- throw newInvariantError(88, definition.kind);
10
+ throw newInvariantError(89, definition.kind);
11
11
  }
12
12
  return definition;
13
13
  });
14
- invariant(operations.length <= 1, 89, operations.length);
14
+ invariant(operations.length <= 1, 90, operations.length);
15
15
  return doc;
16
16
  }
17
17
  export function getOperationDefinition(doc) {
@@ -35,14 +35,14 @@ export function getFragmentDefinitions(doc) {
35
35
  }
36
36
  export function getQueryDefinition(doc) {
37
37
  var queryDef = getOperationDefinition(doc);
38
- invariant(queryDef && queryDef.operation === "query", 90);
38
+ invariant(queryDef && queryDef.operation === "query", 91);
39
39
  return queryDef;
40
40
  }
41
41
  export function getFragmentDefinition(doc) {
42
- invariant(doc.kind === "Document", 91);
43
- invariant(doc.definitions.length <= 1, 92);
42
+ invariant(doc.kind === "Document", 92);
43
+ invariant(doc.definitions.length <= 1, 93);
44
44
  var fragmentDef = doc.definitions[0];
45
- invariant(fragmentDef.kind === "FragmentDefinition", 93);
45
+ invariant(fragmentDef.kind === "FragmentDefinition", 94);
46
46
  return fragmentDef;
47
47
  }
48
48
  /**
@@ -72,7 +72,7 @@ export function getMainDefinition(queryDoc) {
72
72
  if (fragmentDefinition) {
73
73
  return fragmentDefinition;
74
74
  }
75
- throw newInvariantError(94);
75
+ throw newInvariantError(95);
76
76
  }
77
77
  export function getDefaultValues(definition) {
78
78
  var defaultValues = Object.create(null);
@@ -72,7 +72,7 @@ export function valueToObjectRepresentation(argObj, name, value, variables) {
72
72
  argObj[name.value] = null;
73
73
  }
74
74
  else {
75
- throw newInvariantError(95, name.value, value.kind);
75
+ throw newInvariantError(96, name.value, value.kind);
76
76
  }
77
77
  }
78
78
  export function storeKeyNameFromField(field, variables) {
@@ -87,7 +87,7 @@ export function removeDirectivesFromDocument(directives, doc) {
87
87
  return getInUseByFragmentName(ancestor.name.value);
88
88
  }
89
89
  }
90
- globalThis.__DEV__ !== false && invariant.error(96);
90
+ globalThis.__DEV__ !== false && invariant.error(97);
91
91
  return null;
92
92
  };
93
93
  var operationCount = 0;
@@ -353,7 +353,7 @@ var connectionRemoveConfig = {
353
353
  if (willRemove) {
354
354
  if (!directive.arguments ||
355
355
  !directive.arguments.some(function (arg) { return arg.name.value === "key"; })) {
356
- globalThis.__DEV__ !== false && invariant.warn(97);
356
+ globalThis.__DEV__ !== false && invariant.warn(98);
357
357
  }
358
358
  }
359
359
  return willRemove;
@@ -483,6 +483,12 @@ export function addNonReactiveToNamedFragments(document) {
483
483
  checkDocument(document);
484
484
  return visit(document, {
485
485
  FragmentSpread: function (node) {
486
+ var _a;
487
+ // Do not add `@nonreactive` if the fragment is marked with `@unmask`
488
+ // since we want to react to changes in this fragment.
489
+ if ((_a = node.directives) === null || _a === void 0 ? void 0 : _a.some(function (directive) { return directive.name.value === "unmask"; })) {
490
+ return;
491
+ }
486
492
  return __assign(__assign({}, node), { directives: __spreadArray(__spreadArray([], (node.directives || []), true), [
487
493
  {
488
494
  kind: Kind.DIRECTIVE,