@faststore/core 2.2.21 → 2.2.22

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 (157) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/.turbo/turbo-test.log +11 -11
  3. package/next.config.js +1 -0
  4. package/package.json +9 -9
  5. package/.next/BUILD_ID +0 -1
  6. package/.next/build-manifest.json +0 -126
  7. package/.next/cache/.tsbuildinfo +0 -1
  8. package/.next/cache/config.json +0 -7
  9. package/.next/cache/eslint/.cache_1gneedd +0 -1
  10. package/.next/cache/next-server.js.nft.json +0 -1
  11. package/.next/cache/webpack/client-production/0.pack +0 -0
  12. package/.next/cache/webpack/client-production/index.pack +0 -0
  13. package/.next/cache/webpack/server-production/0.pack +0 -0
  14. package/.next/cache/webpack/server-production/index.pack +0 -0
  15. package/.next/export-marker.json +0 -1
  16. package/.next/images-manifest.json +0 -1
  17. package/.next/next-server.js.nft.json +0 -1
  18. package/.next/package.json +0 -1
  19. package/.next/prerender-manifest.json +0 -1
  20. package/.next/react-loadable-manifest.json +0 -47
  21. package/.next/required-server-files.json +0 -1
  22. package/.next/routes-manifest.json +0 -1
  23. package/.next/server/chunks/117.js +0 -430
  24. package/.next/server/chunks/177.js +0 -120
  25. package/.next/server/chunks/183.js +0 -121
  26. package/.next/server/chunks/184.js +0 -61
  27. package/.next/server/chunks/289.js +0 -240
  28. package/.next/server/chunks/312.js +0 -678
  29. package/.next/server/chunks/350.js +0 -200
  30. package/.next/server/chunks/386.js +0 -200
  31. package/.next/server/chunks/390.js +0 -550
  32. package/.next/server/chunks/398.js +0 -610
  33. package/.next/server/chunks/52.js +0 -4007
  34. package/.next/server/chunks/53.js +0 -61
  35. package/.next/server/chunks/574.js +0 -145
  36. package/.next/server/chunks/576.js +0 -121
  37. package/.next/server/chunks/585.js +0 -640
  38. package/.next/server/chunks/676.js +0 -32
  39. package/.next/server/chunks/693.js +0 -58
  40. package/.next/server/chunks/732.js +0 -1880
  41. package/.next/server/chunks/74.js +0 -4066
  42. package/.next/server/chunks/779.js +0 -58
  43. package/.next/server/chunks/817.js +0 -4007
  44. package/.next/server/chunks/825.js +0 -4074
  45. package/.next/server/chunks/854.js +0 -72
  46. package/.next/server/chunks/859.js +0 -959
  47. package/.next/server/chunks/863.js +0 -111
  48. package/.next/server/chunks/979.js +0 -1303
  49. package/.next/server/chunks/98.js +0 -163
  50. package/.next/server/chunks/988.js +0 -211
  51. package/.next/server/chunks/font-manifest.json +0 -1
  52. package/.next/server/font-manifest.json +0 -1
  53. package/.next/server/middleware-build-manifest.js +0 -1
  54. package/.next/server/middleware-manifest.json +0 -6
  55. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  56. package/.next/server/pages/404.js +0 -391
  57. package/.next/server/pages/404.js.nft.json +0 -1
  58. package/.next/server/pages/500.js +0 -395
  59. package/.next/server/pages/500.js.nft.json +0 -1
  60. package/.next/server/pages/[...slug].js +0 -1084
  61. package/.next/server/pages/[...slug].js.nft.json +0 -1
  62. package/.next/server/pages/[slug]/p.js +0 -2271
  63. package/.next/server/pages/[slug]/p.js.nft.json +0 -1
  64. package/.next/server/pages/_app.js +0 -287
  65. package/.next/server/pages/_app.js.nft.json +0 -1
  66. package/.next/server/pages/_document.js +0 -365
  67. package/.next/server/pages/_document.js.nft.json +0 -1
  68. package/.next/server/pages/_error.js +0 -164
  69. package/.next/server/pages/_error.js.nft.json +0 -1
  70. package/.next/server/pages/account.js +0 -370
  71. package/.next/server/pages/account.js.nft.json +0 -1
  72. package/.next/server/pages/api/graphql.js +0 -464
  73. package/.next/server/pages/api/graphql.js.nft.json +0 -1
  74. package/.next/server/pages/api/health/live.js +0 -31
  75. package/.next/server/pages/api/health/live.js.nft.json +0 -1
  76. package/.next/server/pages/api/health/ready.js +0 -31
  77. package/.next/server/pages/api/health/ready.js.nft.json +0 -1
  78. package/.next/server/pages/api/preview.js +0 -137
  79. package/.next/server/pages/api/preview.js.nft.json +0 -1
  80. package/.next/server/pages/checkout.js +0 -370
  81. package/.next/server/pages/checkout.js.nft.json +0 -1
  82. package/.next/server/pages/en-US/404.html +0 -81
  83. package/.next/server/pages/en-US/404.json +0 -1
  84. package/.next/server/pages/en-US/500.html +0 -81
  85. package/.next/server/pages/en-US/500.json +0 -1
  86. package/.next/server/pages/en-US/account.html +0 -81
  87. package/.next/server/pages/en-US/account.json +0 -1
  88. package/.next/server/pages/en-US/checkout.html +0 -81
  89. package/.next/server/pages/en-US/checkout.json +0 -1
  90. package/.next/server/pages/en-US/login.html +0 -81
  91. package/.next/server/pages/en-US/login.json +0 -1
  92. package/.next/server/pages/en-US/s.html +0 -81
  93. package/.next/server/pages/en-US/s.json +0 -1
  94. package/.next/server/pages/en-US.html +0 -90
  95. package/.next/server/pages/en-US.json +0 -1
  96. package/.next/server/pages/index.js +0 -439
  97. package/.next/server/pages/index.js.nft.json +0 -1
  98. package/.next/server/pages/login.js +0 -382
  99. package/.next/server/pages/login.js.nft.json +0 -1
  100. package/.next/server/pages/s.js +0 -554
  101. package/.next/server/pages/s.js.nft.json +0 -1
  102. package/.next/server/pages-manifest.json +0 -18
  103. package/.next/server/webpack-api-runtime.js +0 -229
  104. package/.next/server/webpack-runtime.js +0 -229
  105. package/.next/static/chunks/251.1c79f06f2a2814b1.js +0 -1
  106. package/.next/static/chunks/386.d01e0db26c523f0f.js +0 -1
  107. package/.next/static/chunks/400-a09ccc622ec96daa.js +0 -1
  108. package/.next/static/chunks/469-7259b855711d4ad3.js +0 -1
  109. package/.next/static/chunks/574.70612be06fd1365f.js +0 -1
  110. package/.next/static/chunks/585.4c5d40fc6a72a611.js +0 -1
  111. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  112. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  113. package/.next/static/chunks/742-e32d18d91fe6f08b.js +0 -1
  114. package/.next/static/chunks/783-a67df4e98c1ac27b.js +0 -1
  115. package/.next/static/chunks/800.ee4f8b9622001e8c.js +0 -1
  116. package/.next/static/chunks/98.40c7e17d9de4eb8f.js +0 -1
  117. package/.next/static/chunks/988.afda042dd9ba11d1.js +0 -1
  118. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  119. package/.next/static/chunks/main-e4e873ee741162eb.js +0 -1
  120. package/.next/static/chunks/pages/404-6763ce07878a1456.js +0 -1
  121. package/.next/static/chunks/pages/500-0f4374f30595d27c.js +0 -1
  122. package/.next/static/chunks/pages/[...slug]-111f89162eff5029.js +0 -1
  123. package/.next/static/chunks/pages/[slug]/p-46e7cb105136dc7a.js +0 -1
  124. package/.next/static/chunks/pages/_app-48d56037a2534a44.js +0 -1
  125. package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
  126. package/.next/static/chunks/pages/account-9eb6fab139286c66.js +0 -1
  127. package/.next/static/chunks/pages/checkout-7cd7b110c7cf2f10.js +0 -1
  128. package/.next/static/chunks/pages/index-3d5c756be5ce8fc7.js +0 -1
  129. package/.next/static/chunks/pages/login-5fd09e6402f47896.js +0 -1
  130. package/.next/static/chunks/pages/s-8e32a9b170819fa9.js +0 -1
  131. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  132. package/.next/static/chunks/webpack-4ccaf6613cbd7224.js +0 -1
  133. package/.next/static/css/29868543c76bc6fd.css +0 -1
  134. package/.next/static/css/527e334fa69cf40a.css +0 -1
  135. package/.next/static/css/5d1f64b61ea581f4.css +0 -1
  136. package/.next/static/css/6a7fdc5a21fbead5.css +0 -1
  137. package/.next/static/css/723835bce380750d.css +0 -1
  138. package/.next/static/css/a2eefb25a4608343.css +0 -1
  139. package/.next/static/css/cb7d1fcea42fab9c.css +0 -1
  140. package/.next/static/css/d7bbfbd552f407e9.css +0 -1
  141. package/.next/static/css/df588bb98c0b0ca6.css +0 -1
  142. package/.next/static/css/dfbdb0f27fd64782.css +0 -1
  143. package/.next/static/css/e84fc497732ea596.css +0 -1
  144. package/.next/static/l5ofCQQvVmQNWMK4ps_PJ/_buildManifest.js +0 -1
  145. package/.next/static/l5ofCQQvVmQNWMK4ps_PJ/_ssgManifest.js +0 -1
  146. package/.next/trace +0 -78
  147. package/public/~partytown/debug/partytown-atomics.js +0 -556
  148. package/public/~partytown/debug/partytown-media.js +0 -374
  149. package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
  150. package/public/~partytown/debug/partytown-sw.js +0 -59
  151. package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
  152. package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
  153. package/public/~partytown/debug/partytown.js +0 -72
  154. package/public/~partytown/partytown-atomics.js +0 -2
  155. package/public/~partytown/partytown-media.js +0 -2
  156. package/public/~partytown/partytown-sw.js +0 -2
  157. package/public/~partytown/partytown.js +0 -2
@@ -1,4007 +0,0 @@
1
- "use strict";
2
- exports.id = 52;
3
- exports.ids = [52];
4
- exports.modules = {
5
-
6
- /***/ 65:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- __webpack_require__.r(__webpack_exports__);
10
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11
- /* harmony export */ "__assign": () => (/* binding */ __assign),
12
- /* harmony export */ "__asyncDelegator": () => (/* binding */ __asyncDelegator),
13
- /* harmony export */ "__asyncGenerator": () => (/* binding */ __asyncGenerator),
14
- /* harmony export */ "__asyncValues": () => (/* binding */ __asyncValues),
15
- /* harmony export */ "__await": () => (/* binding */ __await),
16
- /* harmony export */ "__awaiter": () => (/* binding */ __awaiter),
17
- /* harmony export */ "__classPrivateFieldGet": () => (/* binding */ __classPrivateFieldGet),
18
- /* harmony export */ "__classPrivateFieldIn": () => (/* binding */ __classPrivateFieldIn),
19
- /* harmony export */ "__classPrivateFieldSet": () => (/* binding */ __classPrivateFieldSet),
20
- /* harmony export */ "__createBinding": () => (/* binding */ __createBinding),
21
- /* harmony export */ "__decorate": () => (/* binding */ __decorate),
22
- /* harmony export */ "__exportStar": () => (/* binding */ __exportStar),
23
- /* harmony export */ "__extends": () => (/* binding */ __extends),
24
- /* harmony export */ "__generator": () => (/* binding */ __generator),
25
- /* harmony export */ "__importDefault": () => (/* binding */ __importDefault),
26
- /* harmony export */ "__importStar": () => (/* binding */ __importStar),
27
- /* harmony export */ "__makeTemplateObject": () => (/* binding */ __makeTemplateObject),
28
- /* harmony export */ "__metadata": () => (/* binding */ __metadata),
29
- /* harmony export */ "__param": () => (/* binding */ __param),
30
- /* harmony export */ "__read": () => (/* binding */ __read),
31
- /* harmony export */ "__rest": () => (/* binding */ __rest),
32
- /* harmony export */ "__spread": () => (/* binding */ __spread),
33
- /* harmony export */ "__spreadArray": () => (/* binding */ __spreadArray),
34
- /* harmony export */ "__spreadArrays": () => (/* binding */ __spreadArrays),
35
- /* harmony export */ "__values": () => (/* binding */ __values)
36
- /* harmony export */ });
37
- /******************************************************************************
38
- Copyright (c) Microsoft Corporation.
39
-
40
- Permission to use, copy, modify, and/or distribute this software for any
41
- purpose with or without fee is hereby granted.
42
-
43
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
44
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
45
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
46
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
47
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
48
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
49
- PERFORMANCE OF THIS SOFTWARE.
50
- ***************************************************************************** */
51
- /* global Reflect, Promise */
52
-
53
- var extendStatics = function(d, b) {
54
- extendStatics = Object.setPrototypeOf ||
55
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
56
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
57
- return extendStatics(d, b);
58
- };
59
-
60
- function __extends(d, b) {
61
- if (typeof b !== "function" && b !== null)
62
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
63
- extendStatics(d, b);
64
- function __() { this.constructor = d; }
65
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
66
- }
67
-
68
- var __assign = function() {
69
- __assign = Object.assign || function __assign(t) {
70
- for (var s, i = 1, n = arguments.length; i < n; i++) {
71
- s = arguments[i];
72
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
73
- }
74
- return t;
75
- }
76
- return __assign.apply(this, arguments);
77
- }
78
-
79
- function __rest(s, e) {
80
- var t = {};
81
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
82
- t[p] = s[p];
83
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
84
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
85
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
86
- t[p[i]] = s[p[i]];
87
- }
88
- return t;
89
- }
90
-
91
- function __decorate(decorators, target, key, desc) {
92
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
93
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
94
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
95
- return c > 3 && r && Object.defineProperty(target, key, r), r;
96
- }
97
-
98
- function __param(paramIndex, decorator) {
99
- return function (target, key) { decorator(target, key, paramIndex); }
100
- }
101
-
102
- function __metadata(metadataKey, metadataValue) {
103
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
104
- }
105
-
106
- function __awaiter(thisArg, _arguments, P, generator) {
107
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
108
- return new (P || (P = Promise))(function (resolve, reject) {
109
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
110
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
111
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
112
- step((generator = generator.apply(thisArg, _arguments || [])).next());
113
- });
114
- }
115
-
116
- function __generator(thisArg, body) {
117
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
118
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
119
- function verb(n) { return function (v) { return step([n, v]); }; }
120
- function step(op) {
121
- if (f) throw new TypeError("Generator is already executing.");
122
- while (_) try {
123
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
124
- if (y = 0, t) op = [op[0] & 2, t.value];
125
- switch (op[0]) {
126
- case 0: case 1: t = op; break;
127
- case 4: _.label++; return { value: op[1], done: false };
128
- case 5: _.label++; y = op[1]; op = [0]; continue;
129
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
130
- default:
131
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
132
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
133
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
134
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
135
- if (t[2]) _.ops.pop();
136
- _.trys.pop(); continue;
137
- }
138
- op = body.call(thisArg, _);
139
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
140
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
141
- }
142
- }
143
-
144
- var __createBinding = Object.create ? (function(o, m, k, k2) {
145
- if (k2 === undefined) k2 = k;
146
- var desc = Object.getOwnPropertyDescriptor(m, k);
147
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
148
- desc = { enumerable: true, get: function() { return m[k]; } };
149
- }
150
- Object.defineProperty(o, k2, desc);
151
- }) : (function(o, m, k, k2) {
152
- if (k2 === undefined) k2 = k;
153
- o[k2] = m[k];
154
- });
155
-
156
- function __exportStar(m, o) {
157
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
158
- }
159
-
160
- function __values(o) {
161
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
162
- if (m) return m.call(o);
163
- if (o && typeof o.length === "number") return {
164
- next: function () {
165
- if (o && i >= o.length) o = void 0;
166
- return { value: o && o[i++], done: !o };
167
- }
168
- };
169
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
170
- }
171
-
172
- function __read(o, n) {
173
- var m = typeof Symbol === "function" && o[Symbol.iterator];
174
- if (!m) return o;
175
- var i = m.call(o), r, ar = [], e;
176
- try {
177
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
178
- }
179
- catch (error) { e = { error: error }; }
180
- finally {
181
- try {
182
- if (r && !r.done && (m = i["return"])) m.call(i);
183
- }
184
- finally { if (e) throw e.error; }
185
- }
186
- return ar;
187
- }
188
-
189
- /** @deprecated */
190
- function __spread() {
191
- for (var ar = [], i = 0; i < arguments.length; i++)
192
- ar = ar.concat(__read(arguments[i]));
193
- return ar;
194
- }
195
-
196
- /** @deprecated */
197
- function __spreadArrays() {
198
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
199
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
200
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
201
- r[k] = a[j];
202
- return r;
203
- }
204
-
205
- function __spreadArray(to, from, pack) {
206
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
207
- if (ar || !(i in from)) {
208
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
209
- ar[i] = from[i];
210
- }
211
- }
212
- return to.concat(ar || Array.prototype.slice.call(from));
213
- }
214
-
215
- function __await(v) {
216
- return this instanceof __await ? (this.v = v, this) : new __await(v);
217
- }
218
-
219
- function __asyncGenerator(thisArg, _arguments, generator) {
220
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
221
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
222
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
223
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
224
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
225
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
226
- function fulfill(value) { resume("next", value); }
227
- function reject(value) { resume("throw", value); }
228
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
229
- }
230
-
231
- function __asyncDelegator(o) {
232
- var i, p;
233
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
234
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
235
- }
236
-
237
- function __asyncValues(o) {
238
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
239
- var m = o[Symbol.asyncIterator], i;
240
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
241
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
242
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
243
- }
244
-
245
- function __makeTemplateObject(cooked, raw) {
246
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
247
- return cooked;
248
- };
249
-
250
- var __setModuleDefault = Object.create ? (function(o, v) {
251
- Object.defineProperty(o, "default", { enumerable: true, value: v });
252
- }) : function(o, v) {
253
- o["default"] = v;
254
- };
255
-
256
- function __importStar(mod) {
257
- if (mod && mod.__esModule) return mod;
258
- var result = {};
259
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
260
- __setModuleDefault(result, mod);
261
- return result;
262
- }
263
-
264
- function __importDefault(mod) {
265
- return (mod && mod.__esModule) ? mod : { default: mod };
266
- }
267
-
268
- function __classPrivateFieldGet(receiver, state, kind, f) {
269
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
270
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
271
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
272
- }
273
-
274
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
275
- if (kind === "m") throw new TypeError("Private method is not writable");
276
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
277
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
278
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
279
- }
280
-
281
- function __classPrivateFieldIn(state, receiver) {
282
- if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
283
- return typeof state === "function" ? receiver === state : state.has(receiver);
284
- }
285
-
286
-
287
- /***/ }),
288
-
289
- /***/ 3404:
290
- /***/ ((module) => {
291
-
292
-
293
-
294
- /**
295
- * Copyright (c) 2019-present, GraphQL Foundation
296
- *
297
- * This source code is licensed under the MIT license found in the
298
- * LICENSE file in the root directory of this source tree.
299
- *
300
- *
301
- */
302
- // A Function, which when given an Array of keys, returns a Promise of an Array
303
- // of values or Errors.
304
- // Optionally turn off batching or caching or provide a cache key function or a
305
- // custom cache instance.
306
- // If a custom cache is provided, it must be of this type (a subset of ES6 Map).
307
-
308
- /**
309
- * A `DataLoader` creates a public API for loading data from a particular
310
- * data back-end with unique keys such as the `id` column of a SQL table or
311
- * document name in a MongoDB database, given a batch loading function.
312
- *
313
- * Each `DataLoader` instance contains a unique memoized cache. Use caution when
314
- * used in long-lived applications or those which serve many users with
315
- * different access permissions and consider creating a new instance per
316
- * web request.
317
- */
318
- var DataLoader =
319
- /*#__PURE__*/
320
- function () {
321
- function DataLoader(batchLoadFn, options) {
322
- if (typeof batchLoadFn !== 'function') {
323
- throw new TypeError('DataLoader must be constructed with a function which accepts ' + ("Array<key> and returns Promise<Array<value>>, but got: " + batchLoadFn + "."));
324
- }
325
-
326
- this._batchLoadFn = batchLoadFn;
327
- this._maxBatchSize = getValidMaxBatchSize(options);
328
- this._batchScheduleFn = getValidBatchScheduleFn(options);
329
- this._cacheKeyFn = getValidCacheKeyFn(options);
330
- this._cacheMap = getValidCacheMap(options);
331
- this._batch = null;
332
- } // Private
333
-
334
-
335
- var _proto = DataLoader.prototype;
336
-
337
- /**
338
- * Loads a key, returning a `Promise` for the value represented by that key.
339
- */
340
- _proto.load = function load(key) {
341
- if (key === null || key === undefined) {
342
- throw new TypeError('The loader.load() function must be called with a value, ' + ("but got: " + String(key) + "."));
343
- }
344
-
345
- var batch = getCurrentBatch(this);
346
- var cacheMap = this._cacheMap;
347
-
348
- var cacheKey = this._cacheKeyFn(key); // If caching and there is a cache-hit, return cached Promise.
349
-
350
-
351
- if (cacheMap) {
352
- var cachedPromise = cacheMap.get(cacheKey);
353
-
354
- if (cachedPromise) {
355
- var cacheHits = batch.cacheHits || (batch.cacheHits = []);
356
- return new Promise(function (resolve) {
357
- cacheHits.push(function () {
358
- resolve(cachedPromise);
359
- });
360
- });
361
- }
362
- } // Otherwise, produce a new Promise for this key, and enqueue it to be
363
- // dispatched along with the current batch.
364
-
365
-
366
- batch.keys.push(key);
367
- var promise = new Promise(function (resolve, reject) {
368
- batch.callbacks.push({
369
- resolve: resolve,
370
- reject: reject
371
- });
372
- }); // If caching, cache this promise.
373
-
374
- if (cacheMap) {
375
- cacheMap.set(cacheKey, promise);
376
- }
377
-
378
- return promise;
379
- }
380
- /**
381
- * Loads multiple keys, promising an array of values:
382
- *
383
- * var [ a, b ] = await myLoader.loadMany([ 'a', 'b' ]);
384
- *
385
- * This is similar to the more verbose:
386
- *
387
- * var [ a, b ] = await Promise.all([
388
- * myLoader.load('a'),
389
- * myLoader.load('b')
390
- * ]);
391
- *
392
- * However it is different in the case where any load fails. Where
393
- * Promise.all() would reject, loadMany() always resolves, however each result
394
- * is either a value or an Error instance.
395
- *
396
- * var [ a, b, c ] = await myLoader.loadMany([ 'a', 'b', 'badkey' ]);
397
- * // c instanceof Error
398
- *
399
- */
400
- ;
401
-
402
- _proto.loadMany = function loadMany(keys) {
403
- if (!isArrayLike(keys)) {
404
- throw new TypeError('The loader.loadMany() function must be called with Array<key> ' + ("but got: " + keys + "."));
405
- } // Support ArrayLike by using only minimal property access
406
-
407
-
408
- var loadPromises = [];
409
-
410
- for (var i = 0; i < keys.length; i++) {
411
- loadPromises.push(this.load(keys[i])["catch"](function (error) {
412
- return error;
413
- }));
414
- }
415
-
416
- return Promise.all(loadPromises);
417
- }
418
- /**
419
- * Clears the value at `key` from the cache, if it exists. Returns itself for
420
- * method chaining.
421
- */
422
- ;
423
-
424
- _proto.clear = function clear(key) {
425
- var cacheMap = this._cacheMap;
426
-
427
- if (cacheMap) {
428
- var cacheKey = this._cacheKeyFn(key);
429
-
430
- cacheMap["delete"](cacheKey);
431
- }
432
-
433
- return this;
434
- }
435
- /**
436
- * Clears the entire cache. To be used when some event results in unknown
437
- * invalidations across this particular `DataLoader`. Returns itself for
438
- * method chaining.
439
- */
440
- ;
441
-
442
- _proto.clearAll = function clearAll() {
443
- var cacheMap = this._cacheMap;
444
-
445
- if (cacheMap) {
446
- cacheMap.clear();
447
- }
448
-
449
- return this;
450
- }
451
- /**
452
- * Adds the provided key and value to the cache. If the key already
453
- * exists, no change is made. Returns itself for method chaining.
454
- *
455
- * To prime the cache with an error at a key, provide an Error instance.
456
- */
457
- ;
458
-
459
- _proto.prime = function prime(key, value) {
460
- var cacheMap = this._cacheMap;
461
-
462
- if (cacheMap) {
463
- var cacheKey = this._cacheKeyFn(key); // Only add the key if it does not already exist.
464
-
465
-
466
- if (cacheMap.get(cacheKey) === undefined) {
467
- // Cache a rejected promise if the value is an Error, in order to match
468
- // the behavior of load(key).
469
- var promise;
470
-
471
- if (value instanceof Error) {
472
- promise = Promise.reject(value); // Since this is a case where an Error is intentionally being primed
473
- // for a given key, we want to disable unhandled promise rejection.
474
-
475
- promise["catch"](function () {});
476
- } else {
477
- promise = Promise.resolve(value);
478
- }
479
-
480
- cacheMap.set(cacheKey, promise);
481
- }
482
- }
483
-
484
- return this;
485
- };
486
-
487
- return DataLoader;
488
- }(); // Private: Enqueue a Job to be executed after all "PromiseJobs" Jobs.
489
- //
490
- // ES6 JavaScript uses the concepts Job and JobQueue to schedule work to occur
491
- // after the current execution context has completed:
492
- // http://www.ecma-international.org/ecma-262/6.0/#sec-jobs-and-job-queues
493
- //
494
- // Node.js uses the `process.nextTick` mechanism to implement the concept of a
495
- // Job, maintaining a global FIFO JobQueue for all Jobs, which is flushed after
496
- // the current call stack ends.
497
- //
498
- // When calling `then` on a Promise, it enqueues a Job on a specific
499
- // "PromiseJobs" JobQueue which is flushed in Node as a single Job on the
500
- // global JobQueue.
501
- //
502
- // DataLoader batches all loads which occur in a single frame of execution, but
503
- // should include in the batch all loads which occur during the flushing of the
504
- // "PromiseJobs" JobQueue after that same execution frame.
505
- //
506
- // In order to avoid the DataLoader dispatch Job occuring before "PromiseJobs",
507
- // A Promise Job is created with the sole purpose of enqueuing a global Job,
508
- // ensuring that it always occurs after "PromiseJobs" ends.
509
- //
510
- // Node.js's job queue is unique. Browsers do not have an equivalent mechanism
511
- // for enqueuing a job to be performed after promise microtasks and before the
512
- // next macrotask. For browser environments, a macrotask is used (via
513
- // setImmediate or setTimeout) at a potential performance penalty.
514
-
515
-
516
- var enqueuePostPromiseJob = typeof process === 'object' && typeof process.nextTick === 'function' ? function (fn) {
517
- if (!resolvedPromise) {
518
- resolvedPromise = Promise.resolve();
519
- }
520
-
521
- resolvedPromise.then(function () {
522
- process.nextTick(fn);
523
- });
524
- } : typeof setImmediate === 'function' ? function (fn) {
525
- setImmediate(fn);
526
- } : function (fn) {
527
- setTimeout(fn);
528
- }; // Private: cached resolved Promise instance
529
-
530
- var resolvedPromise; // Private: Describes a batch of requests
531
-
532
- // Private: Either returns the current batch, or creates and schedules a
533
- // dispatch of a new batch for the given loader.
534
- function getCurrentBatch(loader) {
535
- // If there is an existing batch which has not yet dispatched and is within
536
- // the limit of the batch size, then return it.
537
- var existingBatch = loader._batch;
538
-
539
- if (existingBatch !== null && !existingBatch.hasDispatched && existingBatch.keys.length < loader._maxBatchSize && (!existingBatch.cacheHits || existingBatch.cacheHits.length < loader._maxBatchSize)) {
540
- return existingBatch;
541
- } // Otherwise, create a new batch for this loader.
542
-
543
-
544
- var newBatch = {
545
- hasDispatched: false,
546
- keys: [],
547
- callbacks: []
548
- }; // Store it on the loader so it may be reused.
549
-
550
- loader._batch = newBatch; // Then schedule a task to dispatch this batch of requests.
551
-
552
- loader._batchScheduleFn(function () {
553
- dispatchBatch(loader, newBatch);
554
- });
555
-
556
- return newBatch;
557
- }
558
-
559
- function dispatchBatch(loader, batch) {
560
- // Mark this batch as having been dispatched.
561
- batch.hasDispatched = true; // If there's nothing to load, resolve any cache hits and return early.
562
-
563
- if (batch.keys.length === 0) {
564
- resolveCacheHits(batch);
565
- return;
566
- } // Call the provided batchLoadFn for this loader with the batch's keys and
567
- // with the loader as the `this` context.
568
-
569
-
570
- var batchPromise = loader._batchLoadFn(batch.keys); // Assert the expected response from batchLoadFn
571
-
572
-
573
- if (!batchPromise || typeof batchPromise.then !== 'function') {
574
- return failedDispatch(loader, batch, new TypeError('DataLoader must be constructed with a function which accepts ' + 'Array<key> and returns Promise<Array<value>>, but the function did ' + ("not return a Promise: " + String(batchPromise) + ".")));
575
- } // Await the resolution of the call to batchLoadFn.
576
-
577
-
578
- batchPromise.then(function (values) {
579
- // Assert the expected resolution from batchLoadFn.
580
- if (!isArrayLike(values)) {
581
- throw new TypeError('DataLoader must be constructed with a function which accepts ' + 'Array<key> and returns Promise<Array<value>>, but the function did ' + ("not return a Promise of an Array: " + String(values) + "."));
582
- }
583
-
584
- if (values.length !== batch.keys.length) {
585
- throw new TypeError('DataLoader must be constructed with a function which accepts ' + 'Array<key> and returns Promise<Array<value>>, but the function did ' + 'not return a Promise of an Array of the same length as the Array ' + 'of keys.' + ("\n\nKeys:\n" + String(batch.keys)) + ("\n\nValues:\n" + String(values)));
586
- } // Resolve all cache hits in the same micro-task as freshly loaded values.
587
-
588
-
589
- resolveCacheHits(batch); // Step through values, resolving or rejecting each Promise in the batch.
590
-
591
- for (var i = 0; i < batch.callbacks.length; i++) {
592
- var value = values[i];
593
-
594
- if (value instanceof Error) {
595
- batch.callbacks[i].reject(value);
596
- } else {
597
- batch.callbacks[i].resolve(value);
598
- }
599
- }
600
- })["catch"](function (error) {
601
- failedDispatch(loader, batch, error);
602
- });
603
- } // Private: do not cache individual loads if the entire batch dispatch fails,
604
- // but still reject each request so they do not hang.
605
-
606
-
607
- function failedDispatch(loader, batch, error) {
608
- // Cache hits are resolved, even though the batch failed.
609
- resolveCacheHits(batch);
610
-
611
- for (var i = 0; i < batch.keys.length; i++) {
612
- loader.clear(batch.keys[i]);
613
- batch.callbacks[i].reject(error);
614
- }
615
- } // Private: Resolves the Promises for any cache hits in this batch.
616
-
617
-
618
- function resolveCacheHits(batch) {
619
- if (batch.cacheHits) {
620
- for (var i = 0; i < batch.cacheHits.length; i++) {
621
- batch.cacheHits[i]();
622
- }
623
- }
624
- } // Private: given the DataLoader's options, produce a valid max batch size.
625
-
626
-
627
- function getValidMaxBatchSize(options) {
628
- var shouldBatch = !options || options.batch !== false;
629
-
630
- if (!shouldBatch) {
631
- return 1;
632
- }
633
-
634
- var maxBatchSize = options && options.maxBatchSize;
635
-
636
- if (maxBatchSize === undefined) {
637
- return Infinity;
638
- }
639
-
640
- if (typeof maxBatchSize !== 'number' || maxBatchSize < 1) {
641
- throw new TypeError("maxBatchSize must be a positive number: " + maxBatchSize);
642
- }
643
-
644
- return maxBatchSize;
645
- } // Private
646
-
647
-
648
- function getValidBatchScheduleFn(options) {
649
- var batchScheduleFn = options && options.batchScheduleFn;
650
-
651
- if (batchScheduleFn === undefined) {
652
- return enqueuePostPromiseJob;
653
- }
654
-
655
- if (typeof batchScheduleFn !== 'function') {
656
- throw new TypeError("batchScheduleFn must be a function: " + batchScheduleFn);
657
- }
658
-
659
- return batchScheduleFn;
660
- } // Private: given the DataLoader's options, produce a cache key function.
661
-
662
-
663
- function getValidCacheKeyFn(options) {
664
- var cacheKeyFn = options && options.cacheKeyFn;
665
-
666
- if (cacheKeyFn === undefined) {
667
- return function (key) {
668
- return key;
669
- };
670
- }
671
-
672
- if (typeof cacheKeyFn !== 'function') {
673
- throw new TypeError("cacheKeyFn must be a function: " + cacheKeyFn);
674
- }
675
-
676
- return cacheKeyFn;
677
- } // Private: given the DataLoader's options, produce a CacheMap to be used.
678
-
679
-
680
- function getValidCacheMap(options) {
681
- var shouldCache = !options || options.cache !== false;
682
-
683
- if (!shouldCache) {
684
- return null;
685
- }
686
-
687
- var cacheMap = options && options.cacheMap;
688
-
689
- if (cacheMap === undefined) {
690
- return new Map();
691
- }
692
-
693
- if (cacheMap !== null) {
694
- var cacheFunctions = ['get', 'set', 'delete', 'clear'];
695
- var missingFunctions = cacheFunctions.filter(function (fnName) {
696
- return cacheMap && typeof cacheMap[fnName] !== 'function';
697
- });
698
-
699
- if (missingFunctions.length !== 0) {
700
- throw new TypeError('Custom cacheMap missing methods: ' + missingFunctions.join(', '));
701
- }
702
- }
703
-
704
- return cacheMap;
705
- } // Private
706
-
707
-
708
- function isArrayLike(x) {
709
- return typeof x === 'object' && x !== null && typeof x.length === 'number' && (x.length === 0 || x.length > 0 && Object.prototype.hasOwnProperty.call(x, x.length - 1));
710
- }
711
-
712
- module.exports = DataLoader;
713
-
714
- /***/ }),
715
-
716
- /***/ 8572:
717
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
718
-
719
-
720
- Object.defineProperty(exports, "__esModule", ({ value: true }));
721
- exports.envelop = void 0;
722
- const enable_if_js_1 = __webpack_require__(279);
723
- const orchestrator_js_1 = __webpack_require__(2572);
724
- const traced_orchestrator_js_1 = __webpack_require__(5599);
725
- function envelop(options) {
726
- const plugins = options.plugins.filter(enable_if_js_1.isPluginEnabled);
727
- let orchestrator = (0, orchestrator_js_1.createEnvelopOrchestrator)(plugins);
728
- if (options.enableInternalTracing) {
729
- orchestrator = (0, traced_orchestrator_js_1.traceOrchestrator)(orchestrator);
730
- }
731
- const getEnveloped = (initialContext = {}) => {
732
- const typedOrchestrator = orchestrator;
733
- typedOrchestrator.init(initialContext);
734
- return {
735
- parse: typedOrchestrator.parse(initialContext),
736
- validate: typedOrchestrator.validate(initialContext),
737
- contextFactory: typedOrchestrator.contextFactory(initialContext),
738
- execute: typedOrchestrator.execute,
739
- subscribe: typedOrchestrator.subscribe,
740
- schema: typedOrchestrator.getCurrentSchema(),
741
- };
742
- };
743
- getEnveloped._plugins = plugins;
744
- return getEnveloped;
745
- }
746
- exports.envelop = envelop;
747
-
748
-
749
- /***/ }),
750
-
751
- /***/ 279:
752
- /***/ ((__unused_webpack_module, exports) => {
753
-
754
-
755
- Object.defineProperty(exports, "__esModule", ({ value: true }));
756
- exports.enableIf = exports.isPluginEnabled = void 0;
757
- /**
758
- * This enum is used only internally in order to create nominal type for the disabled plugin
759
- */
760
- var EnableIfBranded;
761
- (function (EnableIfBranded) {
762
- EnableIfBranded[EnableIfBranded["DisabledPlugin"] = 0] = "DisabledPlugin";
763
- })(EnableIfBranded || (EnableIfBranded = {}));
764
- function isPluginEnabled(t) {
765
- return t !== EnableIfBranded.DisabledPlugin && t !== null;
766
- }
767
- exports.isPluginEnabled = isPluginEnabled;
768
- /**
769
- * Utility function to enable a plugin.
770
- */
771
- function enableIf(condition, plugin) {
772
- if (condition) {
773
- return typeof plugin === 'function' ? plugin() : plugin;
774
- }
775
- return EnableIfBranded.DisabledPlugin;
776
- }
777
- exports.enableIf = enableIf;
778
-
779
-
780
- /***/ }),
781
-
782
- /***/ 8525:
783
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
784
-
785
-
786
- Object.defineProperty(exports, "__esModule", ({ value: true }));
787
- const tslib_1 = __webpack_require__(65);
788
- tslib_1.__exportStar(__webpack_require__(9443), exports);
789
- tslib_1.__exportStar(__webpack_require__(8572), exports);
790
- tslib_1.__exportStar(__webpack_require__(4862), exports);
791
- tslib_1.__exportStar(__webpack_require__(6419), exports);
792
- tslib_1.__exportStar(__webpack_require__(2861), exports);
793
- tslib_1.__exportStar(__webpack_require__(9938), exports);
794
- tslib_1.__exportStar(__webpack_require__(9887), exports);
795
- tslib_1.__exportStar(__webpack_require__(2476), exports);
796
- tslib_1.__exportStar(__webpack_require__(6718), exports);
797
- tslib_1.__exportStar(__webpack_require__(7293), exports);
798
- tslib_1.__exportStar(__webpack_require__(1970), exports);
799
- tslib_1.__exportStar(__webpack_require__(603), exports);
800
- tslib_1.__exportStar(__webpack_require__(279), exports);
801
-
802
-
803
- /***/ }),
804
-
805
- /***/ 2572:
806
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
807
-
808
-
809
- Object.defineProperty(exports, "__esModule", ({ value: true }));
810
- exports.createEnvelopOrchestrator = void 0;
811
- const graphql_1 = __webpack_require__(7343);
812
- const traced_schema_js_1 = __webpack_require__(4879);
813
- const utils_js_1 = __webpack_require__(4862);
814
- function createEnvelopOrchestrator(plugins) {
815
- let schema = null;
816
- let initDone = false;
817
- const onResolversHandlers = [];
818
- for (const plugin of plugins) {
819
- if (plugin.onResolverCalled) {
820
- onResolversHandlers.push(plugin.onResolverCalled);
821
- }
822
- }
823
- // Define the initial method for replacing the GraphQL schema, this is needed in order
824
- // to allow setting the schema from the onPluginInit callback. We also need to make sure
825
- // here not to call the same plugin that initiated the schema switch.
826
- const replaceSchema = (newSchema, ignorePluginIndex = -1) => {
827
- if (onResolversHandlers.length) {
828
- (0, traced_schema_js_1.prepareTracedSchema)(newSchema);
829
- }
830
- schema = newSchema;
831
- if (initDone) {
832
- for (const [i, plugin] of plugins.entries()) {
833
- if (i !== ignorePluginIndex) {
834
- plugin.onSchemaChange &&
835
- plugin.onSchemaChange({
836
- schema,
837
- replaceSchema: schemaToSet => {
838
- replaceSchema(schemaToSet, i);
839
- },
840
- });
841
- }
842
- }
843
- }
844
- };
845
- const contextErrorHandlers = [];
846
- // Iterate all plugins and trigger onPluginInit
847
- for (const [i, plugin] of plugins.entries()) {
848
- plugin.onPluginInit &&
849
- plugin.onPluginInit({
850
- plugins,
851
- addPlugin: newPlugin => {
852
- plugins.push(newPlugin);
853
- },
854
- setSchema: modifiedSchema => replaceSchema(modifiedSchema, i),
855
- registerContextErrorHandler: handler => contextErrorHandlers.push(handler),
856
- });
857
- }
858
- // A set of before callbacks defined here in order to allow it to be used later
859
- const beforeCallbacks = {
860
- init: [],
861
- parse: [],
862
- validate: [],
863
- subscribe: [],
864
- execute: [],
865
- context: [],
866
- };
867
- for (const { onContextBuilding, onExecute, onParse, onSubscribe, onValidate, onEnveloped } of plugins) {
868
- onEnveloped && beforeCallbacks.init.push(onEnveloped);
869
- onContextBuilding && beforeCallbacks.context.push(onContextBuilding);
870
- onExecute && beforeCallbacks.execute.push(onExecute);
871
- onParse && beforeCallbacks.parse.push(onParse);
872
- onSubscribe && beforeCallbacks.subscribe.push(onSubscribe);
873
- onValidate && beforeCallbacks.validate.push(onValidate);
874
- }
875
- const init = initialContext => {
876
- for (const [i, onEnveloped] of beforeCallbacks.init.entries()) {
877
- onEnveloped({
878
- context: initialContext,
879
- extendContext: extension => {
880
- if (!initialContext) {
881
- return;
882
- }
883
- Object.assign(initialContext, extension);
884
- },
885
- setSchema: modifiedSchema => replaceSchema(modifiedSchema, i),
886
- });
887
- }
888
- };
889
- const customParse = beforeCallbacks.parse.length
890
- ? initialContext => (source, parseOptions) => {
891
- let result = null;
892
- let parseFn = graphql_1.parse;
893
- const context = initialContext;
894
- const afterCalls = [];
895
- for (const onParse of beforeCallbacks.parse) {
896
- const afterFn = onParse({
897
- context,
898
- extendContext: extension => {
899
- Object.assign(context, extension);
900
- },
901
- params: { source, options: parseOptions },
902
- parseFn,
903
- setParseFn: newFn => {
904
- parseFn = newFn;
905
- },
906
- setParsedDocument: newDoc => {
907
- result = newDoc;
908
- },
909
- });
910
- afterFn && afterCalls.push(afterFn);
911
- }
912
- if (result === null) {
913
- try {
914
- result = parseFn(source, parseOptions);
915
- }
916
- catch (e) {
917
- result = e;
918
- }
919
- }
920
- for (const afterCb of afterCalls) {
921
- afterCb({
922
- context,
923
- extendContext: extension => {
924
- Object.assign(context, extension);
925
- },
926
- replaceParseResult: newResult => {
927
- result = newResult;
928
- },
929
- result,
930
- });
931
- }
932
- if (result === null) {
933
- throw new Error(`Failed to parse document.`);
934
- }
935
- if (result instanceof Error) {
936
- throw result;
937
- }
938
- return result;
939
- }
940
- : () => graphql_1.parse;
941
- const customValidate = beforeCallbacks.validate.length
942
- ? initialContext => (schema, documentAST, rules, typeInfo, validationOptions) => {
943
- let actualRules = rules ? [...rules] : undefined;
944
- let validateFn = graphql_1.validate;
945
- let result = null;
946
- const context = initialContext;
947
- const afterCalls = [];
948
- for (const onValidate of beforeCallbacks.validate) {
949
- const afterFn = onValidate({
950
- context,
951
- extendContext: extension => {
952
- Object.assign(context, extension);
953
- },
954
- params: {
955
- schema,
956
- documentAST,
957
- rules: actualRules,
958
- typeInfo,
959
- options: validationOptions,
960
- },
961
- validateFn,
962
- addValidationRule: rule => {
963
- if (!actualRules) {
964
- actualRules = [...graphql_1.specifiedRules];
965
- }
966
- actualRules.push(rule);
967
- },
968
- setValidationFn: newFn => {
969
- validateFn = newFn;
970
- },
971
- setResult: newResults => {
972
- result = newResults;
973
- },
974
- });
975
- afterFn && afterCalls.push(afterFn);
976
- }
977
- if (!result) {
978
- result = validateFn(schema, documentAST, actualRules, typeInfo, validationOptions);
979
- }
980
- const valid = result.length === 0;
981
- for (const afterCb of afterCalls) {
982
- afterCb({
983
- valid,
984
- result,
985
- context,
986
- extendContext: extension => {
987
- Object.assign(context, extension);
988
- },
989
- setResult: newResult => {
990
- result = newResult;
991
- },
992
- });
993
- }
994
- return result;
995
- }
996
- : () => graphql_1.validate;
997
- const customContextFactory = beforeCallbacks.context
998
- .length
999
- ? initialContext => async (orchestratorCtx) => {
1000
- const afterCalls = [];
1001
- // In order to have access to the "last working" context object we keep this outside of the try block:
1002
- let context = orchestratorCtx ? { ...initialContext, ...orchestratorCtx } : initialContext;
1003
- try {
1004
- let isBreakingContextBuilding = false;
1005
- for (const onContext of beforeCallbacks.context) {
1006
- const afterHookResult = await onContext({
1007
- context,
1008
- extendContext: extension => {
1009
- context = { ...context, ...extension };
1010
- },
1011
- breakContextBuilding: () => {
1012
- isBreakingContextBuilding = true;
1013
- },
1014
- });
1015
- if (typeof afterHookResult === 'function') {
1016
- afterCalls.push(afterHookResult);
1017
- }
1018
- if (isBreakingContextBuilding === true) {
1019
- break;
1020
- }
1021
- }
1022
- for (const afterCb of afterCalls) {
1023
- afterCb({
1024
- context,
1025
- extendContext: extension => {
1026
- context = { ...context, ...extension };
1027
- },
1028
- });
1029
- }
1030
- return context;
1031
- }
1032
- catch (err) {
1033
- let error = err;
1034
- for (const errorCb of contextErrorHandlers) {
1035
- errorCb({
1036
- context,
1037
- error,
1038
- setError: err => {
1039
- error = err;
1040
- },
1041
- });
1042
- }
1043
- throw error;
1044
- }
1045
- }
1046
- : initialContext => orchestratorCtx => orchestratorCtx ? { ...initialContext, ...orchestratorCtx } : initialContext;
1047
- const useCustomSubscribe = beforeCallbacks.subscribe.length || onResolversHandlers.length;
1048
- const customSubscribe = useCustomSubscribe
1049
- ? (0, utils_js_1.makeSubscribe)(async (args) => {
1050
- let subscribeFn = graphql_1.subscribe;
1051
- const afterCalls = [];
1052
- const subscribeErrorHandlers = [];
1053
- let context = args.contextValue || {};
1054
- let result;
1055
- for (const onSubscribe of beforeCallbacks.subscribe) {
1056
- const after = await onSubscribe({
1057
- subscribeFn,
1058
- setSubscribeFn: newSubscribeFn => {
1059
- subscribeFn = newSubscribeFn;
1060
- },
1061
- extendContext: extension => {
1062
- context = { ...context, ...extension };
1063
- },
1064
- args: args,
1065
- setResultAndStopExecution: stopResult => {
1066
- result = stopResult;
1067
- },
1068
- });
1069
- if (after) {
1070
- if (after.onSubscribeResult) {
1071
- afterCalls.push(after.onSubscribeResult);
1072
- }
1073
- if (after.onSubscribeError) {
1074
- subscribeErrorHandlers.push(after.onSubscribeError);
1075
- }
1076
- }
1077
- if (result !== undefined) {
1078
- break;
1079
- }
1080
- }
1081
- if (onResolversHandlers.length) {
1082
- context[traced_schema_js_1.resolversHooksSymbol] = onResolversHandlers;
1083
- }
1084
- if (result === undefined) {
1085
- result = await subscribeFn({
1086
- ...args,
1087
- contextValue: context,
1088
- // Casted for GraphQL.js 15 compatibility
1089
- // Can be removed once we drop support for GraphQL.js 15
1090
- });
1091
- }
1092
- const onNextHandler = [];
1093
- const onEndHandler = [];
1094
- for (const afterCb of afterCalls) {
1095
- const hookResult = afterCb({
1096
- args: args,
1097
- result,
1098
- setResult: newResult => {
1099
- result = newResult;
1100
- },
1101
- });
1102
- if (hookResult) {
1103
- if (hookResult.onNext) {
1104
- onNextHandler.push(hookResult.onNext);
1105
- }
1106
- if (hookResult.onEnd) {
1107
- onEndHandler.push(hookResult.onEnd);
1108
- }
1109
- }
1110
- }
1111
- if (onNextHandler.length && (0, utils_js_1.isAsyncIterable)(result)) {
1112
- result = (0, utils_js_1.mapAsyncIterator)(result, async (result) => {
1113
- for (const onNext of onNextHandler) {
1114
- await onNext({
1115
- args: args,
1116
- result,
1117
- setResult: newResult => (result = newResult),
1118
- });
1119
- }
1120
- return result;
1121
- });
1122
- }
1123
- if (onEndHandler.length && (0, utils_js_1.isAsyncIterable)(result)) {
1124
- result = (0, utils_js_1.finalAsyncIterator)(result, () => {
1125
- for (const onEnd of onEndHandler) {
1126
- onEnd();
1127
- }
1128
- });
1129
- }
1130
- if (subscribeErrorHandlers.length && (0, utils_js_1.isAsyncIterable)(result)) {
1131
- result = (0, utils_js_1.errorAsyncIterator)(result, err => {
1132
- let error = err;
1133
- for (const handler of subscribeErrorHandlers) {
1134
- handler({
1135
- error,
1136
- setError: err => {
1137
- error = err;
1138
- },
1139
- });
1140
- }
1141
- throw error;
1142
- });
1143
- }
1144
- return result;
1145
- })
1146
- : (0, utils_js_1.makeSubscribe)(graphql_1.subscribe);
1147
- const useCustomExecute = beforeCallbacks.execute.length || onResolversHandlers.length;
1148
- const customExecute = useCustomExecute
1149
- ? (0, utils_js_1.makeExecute)(async (args) => {
1150
- let executeFn = graphql_1.execute;
1151
- let result;
1152
- const afterCalls = [];
1153
- let context = args.contextValue || {};
1154
- for (const onExecute of beforeCallbacks.execute) {
1155
- const after = await onExecute({
1156
- executeFn,
1157
- setExecuteFn: newExecuteFn => {
1158
- executeFn = newExecuteFn;
1159
- },
1160
- setResultAndStopExecution: stopResult => {
1161
- result = stopResult;
1162
- },
1163
- extendContext: extension => {
1164
- if (typeof extension === 'object') {
1165
- context = {
1166
- ...context,
1167
- ...extension,
1168
- };
1169
- }
1170
- else {
1171
- throw new Error(`Invalid context extension provided! Expected "object", got: "${JSON.stringify(extension)}" (${typeof extension})`);
1172
- }
1173
- },
1174
- args: args,
1175
- });
1176
- if (after === null || after === void 0 ? void 0 : after.onExecuteDone) {
1177
- afterCalls.push(after.onExecuteDone);
1178
- }
1179
- if (result !== undefined) {
1180
- break;
1181
- }
1182
- }
1183
- if (onResolversHandlers.length) {
1184
- context[traced_schema_js_1.resolversHooksSymbol] = onResolversHandlers;
1185
- }
1186
- if (result === undefined) {
1187
- result = (await executeFn({
1188
- ...args,
1189
- contextValue: context,
1190
- }));
1191
- }
1192
- const onNextHandler = [];
1193
- const onEndHandler = [];
1194
- for (const afterCb of afterCalls) {
1195
- const hookResult = await afterCb({
1196
- args: args,
1197
- result,
1198
- setResult: newResult => {
1199
- result = newResult;
1200
- },
1201
- });
1202
- if (hookResult) {
1203
- if (hookResult.onNext) {
1204
- onNextHandler.push(hookResult.onNext);
1205
- }
1206
- if (hookResult.onEnd) {
1207
- onEndHandler.push(hookResult.onEnd);
1208
- }
1209
- }
1210
- }
1211
- if (onNextHandler.length && (0, utils_js_1.isAsyncIterable)(result)) {
1212
- result = (0, utils_js_1.mapAsyncIterator)(result, async (result) => {
1213
- for (const onNext of onNextHandler) {
1214
- await onNext({
1215
- args: args,
1216
- result,
1217
- setResult: newResult => {
1218
- result = newResult;
1219
- },
1220
- });
1221
- }
1222
- return result;
1223
- });
1224
- }
1225
- if (onEndHandler.length && (0, utils_js_1.isAsyncIterable)(result)) {
1226
- result = (0, utils_js_1.finalAsyncIterator)(result, () => {
1227
- for (const onEnd of onEndHandler) {
1228
- onEnd();
1229
- }
1230
- });
1231
- }
1232
- return result;
1233
- })
1234
- : (0, utils_js_1.makeExecute)(graphql_1.execute);
1235
- initDone = true;
1236
- // This is done in order to trigger the first schema available, to allow plugins that needs the schema
1237
- // eagerly to have it.
1238
- if (schema) {
1239
- for (const [i, plugin] of plugins.entries()) {
1240
- plugin.onSchemaChange &&
1241
- plugin.onSchemaChange({
1242
- schema,
1243
- replaceSchema: modifiedSchema => replaceSchema(modifiedSchema, i),
1244
- });
1245
- }
1246
- }
1247
- return {
1248
- getCurrentSchema() {
1249
- return schema;
1250
- },
1251
- init,
1252
- parse: customParse,
1253
- validate: customValidate,
1254
- execute: customExecute,
1255
- subscribe: customSubscribe,
1256
- contextFactory: customContextFactory,
1257
- };
1258
- }
1259
- exports.createEnvelopOrchestrator = createEnvelopOrchestrator;
1260
-
1261
-
1262
- /***/ }),
1263
-
1264
- /***/ 6419:
1265
- /***/ ((__unused_webpack_module, exports) => {
1266
-
1267
-
1268
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1269
- exports.useEnvelop = void 0;
1270
- const useEnvelop = (envelop) => {
1271
- return {
1272
- onPluginInit({ addPlugin }) {
1273
- for (const plugin of envelop._plugins) {
1274
- addPlugin(plugin);
1275
- }
1276
- },
1277
- };
1278
- };
1279
- exports.useEnvelop = useEnvelop;
1280
-
1281
-
1282
- /***/ }),
1283
-
1284
- /***/ 2476:
1285
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1286
-
1287
-
1288
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1289
- exports.useErrorHandler = void 0;
1290
- const utils_js_1 = __webpack_require__(4862);
1291
- const makeHandleResult = (errorHandler) => ({ result, args }) => {
1292
- var _a;
1293
- if ((_a = result.errors) === null || _a === void 0 ? void 0 : _a.length) {
1294
- errorHandler(result.errors, args);
1295
- }
1296
- };
1297
- const useErrorHandler = (errorHandler) => {
1298
- const handleResult = makeHandleResult(errorHandler);
1299
- return {
1300
- onExecute() {
1301
- return {
1302
- onExecuteDone(payload) {
1303
- return (0, utils_js_1.handleStreamOrSingleExecutionResult)(payload, handleResult);
1304
- },
1305
- };
1306
- },
1307
- onSubscribe() {
1308
- return {
1309
- onSubscribeResult(payload) {
1310
- return (0, utils_js_1.handleStreamOrSingleExecutionResult)(payload, handleResult);
1311
- },
1312
- };
1313
- },
1314
- };
1315
- };
1316
- exports.useErrorHandler = useErrorHandler;
1317
-
1318
-
1319
- /***/ }),
1320
-
1321
- /***/ 6718:
1322
- /***/ ((__unused_webpack_module, exports) => {
1323
-
1324
-
1325
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1326
- exports.useExtendContext = void 0;
1327
- const useExtendContext = (contextFactory) => ({
1328
- async onContextBuilding({ context, extendContext }) {
1329
- extendContext((await contextFactory(context)));
1330
- },
1331
- });
1332
- exports.useExtendContext = useExtendContext;
1333
-
1334
-
1335
- /***/ }),
1336
-
1337
- /***/ 603:
1338
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1339
-
1340
-
1341
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1342
- exports.useImmediateIntrospection = void 0;
1343
- const graphql_1 = __webpack_require__(7343);
1344
- const OnNonIntrospectionFieldReachedValidationRule = (onNonIntrospectionField) => ctx => {
1345
- const rootQueryType = ctx.getSchema().getQueryType();
1346
- const rootMutationType = ctx.getSchema().getMutationType();
1347
- const rootSubscriptionType = ctx.getSchema().getSubscriptionType();
1348
- return {
1349
- Field(field) {
1350
- const parentType = ctx.getParentType();
1351
- const isQuery = parentType === rootQueryType;
1352
- const isMutation = parentType === rootMutationType;
1353
- const isSubscription = parentType === rootSubscriptionType;
1354
- if ((isQuery && !field.name.value.startsWith('__')) || isMutation || isSubscription) {
1355
- onNonIntrospectionField();
1356
- return graphql_1.BREAK;
1357
- }
1358
- return undefined;
1359
- },
1360
- };
1361
- };
1362
- const fastIntroSpectionSymbol = Symbol('fastIntrospection');
1363
- /**
1364
- * In case a GraphQL operation only contains introspection fields the context building can be skipped completely.
1365
- * With this plugin any further context extensions will be skipped.
1366
- */
1367
- const useImmediateIntrospection = () => {
1368
- return {
1369
- onValidate({ addValidationRule }) {
1370
- let isIntrospectionOnly = true;
1371
- addValidationRule(OnNonIntrospectionFieldReachedValidationRule(() => {
1372
- isIntrospectionOnly = false;
1373
- }));
1374
- return function afterValidate({ extendContext }) {
1375
- if (isIntrospectionOnly) {
1376
- extendContext({ [fastIntroSpectionSymbol]: true });
1377
- }
1378
- };
1379
- },
1380
- onContextBuilding({ context, breakContextBuilding }) {
1381
- if (context[fastIntroSpectionSymbol]) {
1382
- // hijack and skip all other context related stuff.
1383
- // We dont need a context!
1384
- breakContextBuilding();
1385
- }
1386
- },
1387
- };
1388
- };
1389
- exports.useImmediateIntrospection = useImmediateIntrospection;
1390
-
1391
-
1392
- /***/ }),
1393
-
1394
- /***/ 2861:
1395
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1396
-
1397
-
1398
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1399
- exports.useLogger = void 0;
1400
- const utils_js_1 = __webpack_require__(4862);
1401
- const DEFAULT_OPTIONS = {
1402
- logFn: console.log,
1403
- };
1404
- const useLogger = (rawOptions = DEFAULT_OPTIONS) => {
1405
- const options = {
1406
- DEFAULT_OPTIONS,
1407
- ...rawOptions,
1408
- };
1409
- return {
1410
- onParse({ extendContext, params }) {
1411
- if (options.skipIntrospection && (0, utils_js_1.isIntrospectionOperationString)(params.source)) {
1412
- extendContext({
1413
- [utils_js_1.envelopIsIntrospectionSymbol]: true,
1414
- });
1415
- }
1416
- },
1417
- onExecute({ args }) {
1418
- if (args.contextValue[utils_js_1.envelopIsIntrospectionSymbol]) {
1419
- return;
1420
- }
1421
- options.logFn('execute-start', { args });
1422
- return {
1423
- onExecuteDone: ({ result }) => {
1424
- options.logFn('execute-end', { args, result });
1425
- },
1426
- };
1427
- },
1428
- onSubscribe({ args }) {
1429
- if (args.contextValue[utils_js_1.envelopIsIntrospectionSymbol]) {
1430
- return;
1431
- }
1432
- options.logFn('subscribe-start', { args });
1433
- return {
1434
- onSubscribeResult: ({ result }) => {
1435
- options.logFn('subscribe-end', { args, result });
1436
- },
1437
- };
1438
- },
1439
- };
1440
- };
1441
- exports.useLogger = useLogger;
1442
-
1443
-
1444
- /***/ }),
1445
-
1446
- /***/ 1970:
1447
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1448
-
1449
-
1450
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1451
- exports.useMaskedErrors = exports.formatError = exports.EnvelopError = exports.DEFAULT_ERROR_MESSAGE = void 0;
1452
- const graphql_1 = __webpack_require__(7343);
1453
- const utils_js_1 = __webpack_require__(4862);
1454
- exports.DEFAULT_ERROR_MESSAGE = 'Unexpected error.';
1455
- class EnvelopError extends graphql_1.GraphQLError {
1456
- constructor(message, extensions) {
1457
- super(message, undefined, undefined, undefined, undefined, undefined, extensions);
1458
- }
1459
- }
1460
- exports.EnvelopError = EnvelopError;
1461
- const formatError = (err, message, isDev) => {
1462
- var _a, _b, _c, _d;
1463
- if (err instanceof graphql_1.GraphQLError) {
1464
- if (
1465
- /** execution error */
1466
- (err.originalError && err.originalError instanceof EnvelopError === false) ||
1467
- /** validate and parse errors */
1468
- (err.originalError === undefined && err instanceof EnvelopError === false)) {
1469
- return new graphql_1.GraphQLError(message, err.nodes, err.source, err.positions, err.path, undefined, isDev
1470
- ? {
1471
- originalError: {
1472
- message: (_b = (_a = err.originalError) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : err.message,
1473
- stack: (_d = (_c = err.originalError) === null || _c === void 0 ? void 0 : _c.stack) !== null && _d !== void 0 ? _d : err.stack,
1474
- },
1475
- }
1476
- : undefined);
1477
- }
1478
- return err;
1479
- }
1480
- return new graphql_1.GraphQLError(message);
1481
- };
1482
- exports.formatError = formatError;
1483
- const makeHandleResult = (format, message, isDev) => ({ result, setResult }) => {
1484
- if (result.errors != null) {
1485
- setResult({ ...result, errors: result.errors.map(error => format(error, message, isDev)) });
1486
- }
1487
- };
1488
- const useMaskedErrors = (opts) => {
1489
- var _a, _b;
1490
- const format = (_a = opts === null || opts === void 0 ? void 0 : opts.formatError) !== null && _a !== void 0 ? _a : exports.formatError;
1491
- const message = (opts === null || opts === void 0 ? void 0 : opts.errorMessage) || exports.DEFAULT_ERROR_MESSAGE;
1492
- // eslint-disable-next-line dot-notation
1493
- const isDev = (_b = opts === null || opts === void 0 ? void 0 : opts.isDev) !== null && _b !== void 0 ? _b : (typeof process !== 'undefined' ? "production" === 'development' : false);
1494
- const handleResult = makeHandleResult(format, message, isDev);
1495
- return {
1496
- onParse: (opts === null || opts === void 0 ? void 0 : opts.handleParseErrors) === true
1497
- ? function onParse() {
1498
- return function onParseEnd({ result, replaceParseResult }) {
1499
- if (result instanceof Error) {
1500
- replaceParseResult(format(result, message, isDev));
1501
- }
1502
- };
1503
- }
1504
- : undefined,
1505
- onValidate: (opts === null || opts === void 0 ? void 0 : opts.handleValidationErrors) === true
1506
- ? function onValidate() {
1507
- return function onValidateEnd({ valid, result, setResult }) {
1508
- if (valid === false) {
1509
- setResult(result.map(error => format(error, message, isDev)));
1510
- }
1511
- };
1512
- }
1513
- : undefined,
1514
- onPluginInit(context) {
1515
- context.registerContextErrorHandler(({ error, setError }) => {
1516
- if (error instanceof graphql_1.GraphQLError === false && error instanceof Error) {
1517
- error = new graphql_1.GraphQLError(error.message, undefined, undefined, undefined, undefined, error);
1518
- }
1519
- setError(format(error, message, isDev));
1520
- });
1521
- },
1522
- onExecute() {
1523
- return {
1524
- onExecuteDone(payload) {
1525
- return (0, utils_js_1.handleStreamOrSingleExecutionResult)(payload, handleResult);
1526
- },
1527
- };
1528
- },
1529
- onSubscribe() {
1530
- return {
1531
- onSubscribeResult(payload) {
1532
- return (0, utils_js_1.handleStreamOrSingleExecutionResult)(payload, handleResult);
1533
- },
1534
- onSubscribeError({ error, setError }) {
1535
- setError(format(error, message, isDev));
1536
- },
1537
- };
1538
- },
1539
- };
1540
- };
1541
- exports.useMaskedErrors = useMaskedErrors;
1542
-
1543
-
1544
- /***/ }),
1545
-
1546
- /***/ 7293:
1547
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1548
-
1549
-
1550
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1551
- exports.usePayloadFormatter = void 0;
1552
- const utils_js_1 = __webpack_require__(4862);
1553
- const makeHandleResult = (formatter) => ({ args, result, setResult, }) => {
1554
- const modified = formatter(result, args);
1555
- if (modified !== false) {
1556
- setResult(modified);
1557
- }
1558
- };
1559
- const usePayloadFormatter = (formatter) => ({
1560
- onExecute() {
1561
- const handleResult = makeHandleResult(formatter);
1562
- return {
1563
- onExecuteDone(payload) {
1564
- return (0, utils_js_1.handleStreamOrSingleExecutionResult)(payload, handleResult);
1565
- },
1566
- };
1567
- },
1568
- });
1569
- exports.usePayloadFormatter = usePayloadFormatter;
1570
-
1571
-
1572
- /***/ }),
1573
-
1574
- /***/ 9887:
1575
- /***/ ((__unused_webpack_module, exports) => {
1576
-
1577
-
1578
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1579
- exports.useAsyncSchema = exports.useLazyLoadedSchema = exports.useSchema = void 0;
1580
- const useSchema = (schema) => {
1581
- return {
1582
- onPluginInit({ setSchema }) {
1583
- setSchema(schema);
1584
- },
1585
- };
1586
- };
1587
- exports.useSchema = useSchema;
1588
- const useLazyLoadedSchema = (schemaLoader) => {
1589
- return {
1590
- onEnveloped({ setSchema, context }) {
1591
- setSchema(schemaLoader(context));
1592
- },
1593
- };
1594
- };
1595
- exports.useLazyLoadedSchema = useLazyLoadedSchema;
1596
- const useAsyncSchema = (schemaPromise) => {
1597
- return {
1598
- onPluginInit({ setSchema }) {
1599
- schemaPromise.then(schemaObj => {
1600
- setSchema(schemaObj);
1601
- });
1602
- },
1603
- };
1604
- };
1605
- exports.useAsyncSchema = useAsyncSchema;
1606
-
1607
-
1608
- /***/ }),
1609
-
1610
- /***/ 9938:
1611
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1612
-
1613
-
1614
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1615
- exports.useTiming = void 0;
1616
- const graphql_1 = __webpack_require__(7343);
1617
- const utils_js_1 = __webpack_require__(4862);
1618
- const HR_TO_NS = 1e9;
1619
- const NS_TO_MS = 1e6;
1620
- const DEFAULT_OPTIONS = {
1621
- onExecutionMeasurement: (args, timing) => console.log(`Operation execution "${args.operationName}" done in ${timing.ms}ms`),
1622
- onSubscriptionMeasurement: (args, timing) => console.log(`Operation subscription "${args.operationName}" done in ${timing.ms}ms`),
1623
- onParsingMeasurement: (source, timing) => console.log(`Parsing "${source}" done in ${timing.ms}ms`),
1624
- onValidationMeasurement: (document, timing) => { var _a, _b; return console.log(`Validation "${((_b = (_a = (0, graphql_1.getOperationAST)(document)) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.value) || '-'}" done in ${timing.ms}ms`); },
1625
- onResolverMeasurement: (info, timing) => console.log(`\tResolver of "${info.parentType.toString()}.${info.fieldName}" done in ${timing.ms}ms`),
1626
- onContextBuildingMeasurement: (timing) => console.log(`Context building done in ${timing.ms}ms`),
1627
- };
1628
- const deltaFrom = (hrtime) => {
1629
- const delta = process.hrtime(hrtime);
1630
- const ns = delta[0] * HR_TO_NS + delta[1];
1631
- return {
1632
- ns,
1633
- get ms() {
1634
- return ns / NS_TO_MS;
1635
- },
1636
- };
1637
- };
1638
- const useTiming = (rawOptions) => {
1639
- const options = {
1640
- ...DEFAULT_OPTIONS,
1641
- ...rawOptions,
1642
- };
1643
- const result = {};
1644
- if (options.onContextBuildingMeasurement) {
1645
- result.onContextBuilding = ({ context }) => {
1646
- if (context[utils_js_1.envelopIsIntrospectionSymbol]) {
1647
- return;
1648
- }
1649
- const contextStartTime = process.hrtime();
1650
- return () => {
1651
- options.onContextBuildingMeasurement(deltaFrom(contextStartTime));
1652
- };
1653
- };
1654
- }
1655
- if (options.onParsingMeasurement) {
1656
- result.onParse = ({ params, extendContext }) => {
1657
- if (options.skipIntrospection && (0, utils_js_1.isIntrospectionOperationString)(params.source)) {
1658
- extendContext({
1659
- [utils_js_1.envelopIsIntrospectionSymbol]: true,
1660
- });
1661
- return;
1662
- }
1663
- const parseStartTime = process.hrtime();
1664
- return () => {
1665
- options.onParsingMeasurement(params.source, deltaFrom(parseStartTime));
1666
- };
1667
- };
1668
- }
1669
- if (options.onValidationMeasurement) {
1670
- result.onValidate = ({ params, context }) => {
1671
- if (context[utils_js_1.envelopIsIntrospectionSymbol]) {
1672
- return;
1673
- }
1674
- const validateStartTime = process.hrtime();
1675
- return () => {
1676
- options.onValidationMeasurement(params.documentAST, deltaFrom(validateStartTime));
1677
- };
1678
- };
1679
- }
1680
- if (options.onExecutionMeasurement) {
1681
- if (options.onResolverMeasurement) {
1682
- result.onExecute = ({ args }) => {
1683
- if (args.contextValue[utils_js_1.envelopIsIntrospectionSymbol]) {
1684
- return;
1685
- }
1686
- const executeStartTime = process.hrtime();
1687
- return {
1688
- onExecuteDone: () => {
1689
- options.onExecutionMeasurement(args, deltaFrom(executeStartTime));
1690
- },
1691
- };
1692
- };
1693
- result.onResolverCalled = ({ info }) => {
1694
- const resolverStartTime = process.hrtime();
1695
- return () => {
1696
- options.onResolverMeasurement(info, deltaFrom(resolverStartTime));
1697
- };
1698
- };
1699
- }
1700
- else {
1701
- result.onExecute = ({ args }) => {
1702
- if (args.contextValue[utils_js_1.envelopIsIntrospectionSymbol]) {
1703
- return;
1704
- }
1705
- const executeStartTime = process.hrtime();
1706
- return {
1707
- onExecuteDone: () => {
1708
- options.onExecutionMeasurement(args, deltaFrom(executeStartTime));
1709
- },
1710
- };
1711
- };
1712
- }
1713
- }
1714
- if (options.onSubscriptionMeasurement) {
1715
- if (options.onResolverMeasurement) {
1716
- result.onSubscribe = ({ args }) => {
1717
- if (args.contextValue[utils_js_1.envelopIsIntrospectionSymbol]) {
1718
- return;
1719
- }
1720
- const subscribeStartTime = process.hrtime();
1721
- return {
1722
- onSubscribeResult: () => {
1723
- options.onSubscriptionMeasurement && options.onSubscriptionMeasurement(args, deltaFrom(subscribeStartTime));
1724
- },
1725
- };
1726
- };
1727
- result.onResolverCalled = ({ info }) => {
1728
- const resolverStartTime = process.hrtime();
1729
- return () => {
1730
- options.onResolverMeasurement && options.onResolverMeasurement(info, deltaFrom(resolverStartTime));
1731
- };
1732
- };
1733
- }
1734
- else {
1735
- result.onSubscribe = ({ args }) => {
1736
- if (args.contextValue[utils_js_1.envelopIsIntrospectionSymbol]) {
1737
- return;
1738
- }
1739
- const subscribeStartTime = process.hrtime();
1740
- return {
1741
- onSubscribeResult: () => {
1742
- options.onSubscriptionMeasurement && options.onSubscriptionMeasurement(args, deltaFrom(subscribeStartTime));
1743
- },
1744
- };
1745
- };
1746
- }
1747
- }
1748
- return result;
1749
- };
1750
- exports.useTiming = useTiming;
1751
-
1752
-
1753
- /***/ }),
1754
-
1755
- /***/ 5599:
1756
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1757
-
1758
-
1759
- var _a;
1760
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1761
- exports.traceOrchestrator = void 0;
1762
- const graphql_1 = __webpack_require__(7343);
1763
- const utils_js_1 = __webpack_require__(4862);
1764
- const getTimestamp = typeof globalThis !== 'undefined' && ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.performance) === null || _a === void 0 ? void 0 : _a.now)
1765
- ? () => globalThis.performance.now()
1766
- : () => Date.now();
1767
- const measure = () => {
1768
- const start = getTimestamp();
1769
- return () => {
1770
- const end = getTimestamp();
1771
- return end - start;
1772
- };
1773
- };
1774
- const tracingSymbol = Symbol('envelopTracing');
1775
- function traceOrchestrator(orchestrator) {
1776
- const createTracer = (name, ctx) => {
1777
- const end = measure();
1778
- return () => {
1779
- ctx[tracingSymbol][name] = end();
1780
- };
1781
- };
1782
- return {
1783
- ...orchestrator,
1784
- init: (ctx = {}) => {
1785
- ctx[tracingSymbol] = ctx[tracingSymbol] || {};
1786
- const done = createTracer('init', ctx || {});
1787
- try {
1788
- return orchestrator.init(ctx);
1789
- }
1790
- finally {
1791
- done();
1792
- }
1793
- },
1794
- parse: (ctx = {}) => {
1795
- ctx[tracingSymbol] = ctx[tracingSymbol] || {};
1796
- const actualFn = orchestrator.parse(ctx);
1797
- return (...args) => {
1798
- const done = createTracer('parse', ctx);
1799
- try {
1800
- return actualFn(...args);
1801
- }
1802
- finally {
1803
- done();
1804
- }
1805
- };
1806
- },
1807
- validate: (ctx = {}) => {
1808
- ctx[tracingSymbol] = ctx[tracingSymbol] || {};
1809
- const actualFn = orchestrator.validate(ctx);
1810
- return (...args) => {
1811
- const done = createTracer('validate', ctx);
1812
- try {
1813
- return actualFn(...args);
1814
- }
1815
- finally {
1816
- done();
1817
- }
1818
- };
1819
- },
1820
- execute: async (argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) => {
1821
- const args = argsOrSchema instanceof graphql_1.GraphQLSchema
1822
- ? {
1823
- schema: argsOrSchema,
1824
- document: document,
1825
- rootValue,
1826
- contextValue,
1827
- variableValues,
1828
- operationName,
1829
- fieldResolver,
1830
- typeResolver,
1831
- }
1832
- : argsOrSchema;
1833
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1834
- // @ts-ignore GraphQL.js types contextValue as unknown
1835
- const done = createTracer('execute', args.contextValue || {});
1836
- try {
1837
- const result = await orchestrator.execute(args);
1838
- done();
1839
- if (!(0, utils_js_1.isAsyncIterable)(result)) {
1840
- result.extensions = result.extensions || {};
1841
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1842
- // @ts-ignore GraphQL.js types contextValue as unknown
1843
- result.extensions.envelopTracing = args.contextValue[tracingSymbol];
1844
- }
1845
- else {
1846
- // eslint-disable-next-line no-console
1847
- console.warn(`"traceOrchestrator" encountered a AsyncIterator which is not supported yet, so tracing data is not available for the operation.`);
1848
- }
1849
- return result;
1850
- }
1851
- catch (e) {
1852
- done();
1853
- throw e;
1854
- }
1855
- },
1856
- subscribe: async (argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) => {
1857
- const args = argsOrSchema instanceof graphql_1.GraphQLSchema
1858
- ? {
1859
- schema: argsOrSchema,
1860
- document: document,
1861
- rootValue,
1862
- contextValue,
1863
- variableValues,
1864
- operationName,
1865
- fieldResolver,
1866
- subscribeFieldResolver,
1867
- }
1868
- : argsOrSchema;
1869
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1870
- // @ts-ignore GraphQL.js types contextValue as unknown
1871
- const done = createTracer('subscribe', args.contextValue || {});
1872
- try {
1873
- return await orchestrator.subscribe(args);
1874
- }
1875
- finally {
1876
- done();
1877
- }
1878
- },
1879
- contextFactory: (ctx = {}) => {
1880
- const actualFn = orchestrator.contextFactory(ctx);
1881
- return async (childCtx) => {
1882
- const done = createTracer('contextFactory', ctx);
1883
- try {
1884
- return await actualFn(childCtx);
1885
- }
1886
- finally {
1887
- done();
1888
- }
1889
- };
1890
- },
1891
- };
1892
- }
1893
- exports.traceOrchestrator = traceOrchestrator;
1894
-
1895
-
1896
- /***/ }),
1897
-
1898
- /***/ 4879:
1899
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1900
-
1901
-
1902
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1903
- exports.prepareTracedSchema = exports.resolversHooksSymbol = exports.trackedSchemaSymbol = void 0;
1904
- const graphql_1 = __webpack_require__(7343);
1905
- exports.trackedSchemaSymbol = Symbol('TRACKED_SCHEMA');
1906
- exports.resolversHooksSymbol = Symbol('RESOLVERS_HOOKS');
1907
- function prepareTracedSchema(schema) {
1908
- if (!schema || schema[exports.trackedSchemaSymbol]) {
1909
- return;
1910
- }
1911
- schema[exports.trackedSchemaSymbol] = true;
1912
- const entries = Object.values(schema.getTypeMap());
1913
- for (const type of entries) {
1914
- if (!(0, graphql_1.isIntrospectionType)(type) && (0, graphql_1.isObjectType)(type)) {
1915
- const fields = Object.values(type.getFields());
1916
- for (const field of fields) {
1917
- let resolverFn = (field.resolve || graphql_1.defaultFieldResolver);
1918
- field.resolve = async (root, args, context, info) => {
1919
- if (context && context[exports.resolversHooksSymbol]) {
1920
- const hooks = context[exports.resolversHooksSymbol];
1921
- const afterCalls = [];
1922
- for (const hook of hooks) {
1923
- const afterFn = await hook({
1924
- root,
1925
- args,
1926
- context,
1927
- info,
1928
- resolverFn,
1929
- replaceResolverFn: newFn => {
1930
- resolverFn = newFn;
1931
- },
1932
- });
1933
- afterFn && afterCalls.push(afterFn);
1934
- }
1935
- try {
1936
- let result = await resolverFn(root, args, context, info);
1937
- for (const afterFn of afterCalls) {
1938
- afterFn({
1939
- result,
1940
- setResult: newResult => {
1941
- result = newResult;
1942
- },
1943
- });
1944
- }
1945
- return result;
1946
- }
1947
- catch (e) {
1948
- let resultErr = e;
1949
- for (const afterFn of afterCalls) {
1950
- afterFn({
1951
- result: resultErr,
1952
- setResult: newResult => {
1953
- resultErr = newResult;
1954
- },
1955
- });
1956
- }
1957
- throw resultErr;
1958
- }
1959
- }
1960
- else {
1961
- return resolverFn(root, args, context, info);
1962
- }
1963
- };
1964
- }
1965
- }
1966
- }
1967
- }
1968
- exports.prepareTracedSchema = prepareTracedSchema;
1969
-
1970
-
1971
- /***/ }),
1972
-
1973
- /***/ 4862:
1974
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1975
-
1976
-
1977
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1978
- exports.errorAsyncIterator = exports.finalAsyncIterator = exports.handleStreamOrSingleExecutionResult = exports.isAsyncIterable = exports.makeExecute = exports.mapAsyncIterator = exports.makeSubscribe = exports.isIntrospectionOperationString = exports.isIntrospectionDocument = exports.isIntrospectionOperation = exports.isOperationDefinition = exports.envelopIsIntrospectionSymbol = void 0;
1979
- const graphql_1 = __webpack_require__(7343);
1980
- exports.envelopIsIntrospectionSymbol = Symbol('ENVELOP_IS_INTROSPECTION');
1981
- function isOperationDefinition(def) {
1982
- return def.kind === graphql_1.Kind.OPERATION_DEFINITION;
1983
- }
1984
- exports.isOperationDefinition = isOperationDefinition;
1985
- function isIntrospectionOperation(operation) {
1986
- return isIntrospectionDocument({
1987
- kind: graphql_1.Kind.DOCUMENT,
1988
- definitions: [operation],
1989
- });
1990
- }
1991
- exports.isIntrospectionOperation = isIntrospectionOperation;
1992
- function isIntrospectionDocument(document) {
1993
- let isIntrospectionOperation = false;
1994
- (0, graphql_1.visit)(document, {
1995
- Field: node => {
1996
- if (node.name.value === '__schema' || node.name.value === '__type') {
1997
- isIntrospectionOperation = true;
1998
- return graphql_1.BREAK;
1999
- }
2000
- },
2001
- });
2002
- return isIntrospectionOperation;
2003
- }
2004
- exports.isIntrospectionDocument = isIntrospectionDocument;
2005
- function isIntrospectionOperationString(operation) {
2006
- return (typeof operation === 'string' ? operation : operation.body).indexOf('__schema') !== -1;
2007
- }
2008
- exports.isIntrospectionOperationString = isIntrospectionOperationString;
2009
- function getSubscribeArgs(args) {
2010
- return args.length === 1
2011
- ? args[0]
2012
- : {
2013
- schema: args[0],
2014
- document: args[1],
2015
- rootValue: args[2],
2016
- contextValue: args[3],
2017
- variableValues: args[4],
2018
- operationName: args[5],
2019
- fieldResolver: args[6],
2020
- subscribeFieldResolver: args[7],
2021
- };
2022
- }
2023
- /**
2024
- * Utility function for making a subscribe function that handles polymorphic arguments.
2025
- */
2026
- const makeSubscribe = (subscribeFn) => ((...polyArgs) => subscribeFn(getSubscribeArgs(polyArgs)));
2027
- exports.makeSubscribe = makeSubscribe;
2028
- function mapAsyncIterator(source, mapper) {
2029
- const iterator = source[Symbol.asyncIterator]();
2030
- async function mapResult(result) {
2031
- var _a;
2032
- if (result.done) {
2033
- return result;
2034
- }
2035
- try {
2036
- return { value: await mapper(result.value), done: false };
2037
- }
2038
- catch (error) {
2039
- try {
2040
- await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
2041
- }
2042
- catch (_error) {
2043
- /* ignore error */
2044
- }
2045
- throw error;
2046
- }
2047
- }
2048
- const stream = {
2049
- [Symbol.asyncIterator]() {
2050
- return stream;
2051
- },
2052
- async next() {
2053
- return await mapResult(await iterator.next());
2054
- },
2055
- async return() {
2056
- var _a;
2057
- const promise = (_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator);
2058
- return promise ? await mapResult(await promise) : { value: undefined, done: true };
2059
- },
2060
- async throw(error) {
2061
- var _a;
2062
- const promise = (_a = iterator.throw) === null || _a === void 0 ? void 0 : _a.call(iterator);
2063
- if (promise) {
2064
- return await mapResult(await promise);
2065
- }
2066
- // if the source has no throw method we just re-throw error
2067
- // usually throw is not called anyways
2068
- throw error;
2069
- },
2070
- };
2071
- return stream;
2072
- }
2073
- exports.mapAsyncIterator = mapAsyncIterator;
2074
- function getExecuteArgs(args) {
2075
- return args.length === 1
2076
- ? args[0]
2077
- : {
2078
- schema: args[0],
2079
- document: args[1],
2080
- rootValue: args[2],
2081
- contextValue: args[3],
2082
- variableValues: args[4],
2083
- operationName: args[5],
2084
- fieldResolver: args[6],
2085
- typeResolver: args[7],
2086
- };
2087
- }
2088
- /**
2089
- * Utility function for making a execute function that handles polymorphic arguments.
2090
- */
2091
- const makeExecute = (executeFn) => ((...polyArgs) => executeFn(getExecuteArgs(polyArgs)));
2092
- exports.makeExecute = makeExecute;
2093
- /**
2094
- * Returns true if the provided object implements the AsyncIterator protocol via
2095
- * implementing a `Symbol.asyncIterator` method.
2096
- *
2097
- * Source: https://github.com/graphql/graphql-js/blob/main/src/jsutils/isAsyncIterable.ts
2098
- */
2099
- function isAsyncIterable(maybeAsyncIterable) {
2100
- return (typeof maybeAsyncIterable === 'object' &&
2101
- maybeAsyncIterable != null &&
2102
- typeof maybeAsyncIterable[Symbol.asyncIterator] === 'function');
2103
- }
2104
- exports.isAsyncIterable = isAsyncIterable;
2105
- /**
2106
- * A utility function for handling `onExecuteDone` hook result, for simplifying the handling of AsyncIterable returned from `execute`.
2107
- *
2108
- * @param payload The payload send to `onExecuteDone` hook function
2109
- * @param fn The handler to be executed on each result
2110
- * @returns a subscription for streamed results, or undefined in case of an non-async
2111
- */
2112
- function handleStreamOrSingleExecutionResult(payload, fn) {
2113
- if (isAsyncIterable(payload.result)) {
2114
- return { onNext: fn };
2115
- }
2116
- fn({
2117
- args: payload.args,
2118
- result: payload.result,
2119
- setResult: payload.setResult,
2120
- });
2121
- return undefined;
2122
- }
2123
- exports.handleStreamOrSingleExecutionResult = handleStreamOrSingleExecutionResult;
2124
- function finalAsyncIterator(source, onFinal) {
2125
- const iterator = source[Symbol.asyncIterator]();
2126
- let isDone = false;
2127
- const stream = {
2128
- [Symbol.asyncIterator]() {
2129
- return stream;
2130
- },
2131
- async next() {
2132
- const result = await iterator.next();
2133
- if (result.done && isDone === false) {
2134
- isDone = true;
2135
- onFinal();
2136
- }
2137
- return result;
2138
- },
2139
- async return() {
2140
- var _a;
2141
- const promise = (_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator);
2142
- if (isDone === false) {
2143
- isDone = true;
2144
- onFinal();
2145
- }
2146
- return promise ? await promise : { done: true, value: undefined };
2147
- },
2148
- async throw(error) {
2149
- var _a;
2150
- const promise = (_a = iterator.throw) === null || _a === void 0 ? void 0 : _a.call(iterator);
2151
- if (promise) {
2152
- return await promise;
2153
- }
2154
- // if the source has no throw method we just re-throw error
2155
- // usually throw is not called anyways
2156
- throw error;
2157
- },
2158
- };
2159
- return stream;
2160
- }
2161
- exports.finalAsyncIterator = finalAsyncIterator;
2162
- function errorAsyncIterator(source, onError) {
2163
- const iterator = source[Symbol.asyncIterator]();
2164
- const stream = {
2165
- [Symbol.asyncIterator]() {
2166
- return stream;
2167
- },
2168
- async next() {
2169
- try {
2170
- return await iterator.next();
2171
- }
2172
- catch (error) {
2173
- onError(error);
2174
- return { done: true, value: undefined };
2175
- }
2176
- },
2177
- async return() {
2178
- var _a;
2179
- const promise = (_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator);
2180
- return promise ? await promise : { done: true, value: undefined };
2181
- },
2182
- async throw(error) {
2183
- var _a;
2184
- const promise = (_a = iterator.throw) === null || _a === void 0 ? void 0 : _a.call(iterator);
2185
- if (promise) {
2186
- return await promise;
2187
- }
2188
- // if the source has no throw method we just re-throw error
2189
- // usually throw is not called anyways
2190
- throw error;
2191
- },
2192
- };
2193
- return stream;
2194
- }
2195
- exports.errorAsyncIterator = errorAsyncIterator;
2196
-
2197
-
2198
- /***/ }),
2199
-
2200
- /***/ 9362:
2201
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2202
-
2203
-
2204
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2205
- exports.useOnResolve = void 0;
2206
- const graphql_1 = __webpack_require__(7343);
2207
- /**
2208
- * Wraps the provided schema by hooking into the resolvers of every field.
2209
- *
2210
- * Use the `onResolve` argument to manipulate the resolver and its results/errors.
2211
- */
2212
- function useOnResolve(onResolve) {
2213
- return {
2214
- onSchemaChange({ schema: _schema }) {
2215
- const schema = _schema;
2216
- if (!schema)
2217
- return; // nothing to do if schema is missing
2218
- for (const type of Object.values(schema.getTypeMap())) {
2219
- if (!(0, graphql_1.isIntrospectionType)(type) && (0, graphql_1.isObjectType)(type)) {
2220
- for (const field of Object.values(type.getFields())) {
2221
- let resolver = (field.resolve || graphql_1.defaultFieldResolver);
2222
- field.resolve = async (root, args, context, info) => {
2223
- const afterResolve = await onResolve({
2224
- root,
2225
- args,
2226
- context,
2227
- info,
2228
- resolver,
2229
- replaceResolver: newResolver => {
2230
- resolver = newResolver;
2231
- },
2232
- });
2233
- let result;
2234
- try {
2235
- result = await resolver(root, args, context, info);
2236
- }
2237
- catch (err) {
2238
- result = err;
2239
- }
2240
- if (typeof afterResolve === 'function') {
2241
- await afterResolve({
2242
- result,
2243
- setResult: newResult => {
2244
- result = newResult;
2245
- },
2246
- });
2247
- }
2248
- if (result instanceof Error) {
2249
- throw result;
2250
- }
2251
- return result;
2252
- };
2253
- }
2254
- }
2255
- }
2256
- },
2257
- };
2258
- }
2259
- exports.useOnResolve = useOnResolve;
2260
-
2261
-
2262
- /***/ }),
2263
-
2264
- /***/ 3885:
2265
- /***/ ((__unused_webpack_module, exports) => {
2266
-
2267
-
2268
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2269
-
2270
-
2271
- /***/ }),
2272
-
2273
- /***/ 1094:
2274
- /***/ ((__unused_webpack_module, exports) => {
2275
-
2276
-
2277
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2278
-
2279
-
2280
- /***/ }),
2281
-
2282
- /***/ 2436:
2283
- /***/ ((__unused_webpack_module, exports) => {
2284
-
2285
-
2286
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2287
-
2288
-
2289
- /***/ }),
2290
-
2291
- /***/ 7208:
2292
- /***/ ((__unused_webpack_module, exports) => {
2293
-
2294
-
2295
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2296
-
2297
-
2298
- /***/ }),
2299
-
2300
- /***/ 9443:
2301
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2302
-
2303
-
2304
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2305
- const tslib_1 = __webpack_require__(752);
2306
- tslib_1.__exportStar(__webpack_require__(3885), exports);
2307
- tslib_1.__exportStar(__webpack_require__(7208), exports);
2308
- tslib_1.__exportStar(__webpack_require__(1731), exports);
2309
- tslib_1.__exportStar(__webpack_require__(1094), exports);
2310
- tslib_1.__exportStar(__webpack_require__(2436), exports);
2311
- tslib_1.__exportStar(__webpack_require__(5227), exports);
2312
-
2313
-
2314
- /***/ }),
2315
-
2316
- /***/ 1731:
2317
- /***/ ((__unused_webpack_module, exports) => {
2318
-
2319
-
2320
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2321
-
2322
-
2323
- /***/ }),
2324
-
2325
- /***/ 5227:
2326
- /***/ ((__unused_webpack_module, exports) => {
2327
-
2328
-
2329
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2330
-
2331
-
2332
- /***/ }),
2333
-
2334
- /***/ 2775:
2335
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2336
-
2337
-
2338
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2339
- exports.applyExtensions = exports.mergeExtensions = exports.extractExtensionsFromSchema = void 0;
2340
- const utils_1 = __webpack_require__(1718);
2341
- var utils_2 = __webpack_require__(1718);
2342
- Object.defineProperty(exports, "extractExtensionsFromSchema", ({ enumerable: true, get: function () { return utils_2.extractExtensionsFromSchema; } }));
2343
- function mergeExtensions(extensions) {
2344
- return (0, utils_1.mergeDeep)(extensions);
2345
- }
2346
- exports.mergeExtensions = mergeExtensions;
2347
- function applyExtensionObject(obj, extensions) {
2348
- if (!obj) {
2349
- return;
2350
- }
2351
- obj.extensions = (0, utils_1.mergeDeep)([obj.extensions || {}, extensions || {}]);
2352
- }
2353
- function applyExtensions(schema, extensions) {
2354
- applyExtensionObject(schema, extensions.schemaExtensions);
2355
- for (const [typeName, data] of Object.entries(extensions.types || {})) {
2356
- const type = schema.getType(typeName);
2357
- if (type) {
2358
- applyExtensionObject(type, data.extensions);
2359
- if (data.type === 'object' || data.type === 'interface') {
2360
- for (const [fieldName, fieldData] of Object.entries(data.fields)) {
2361
- const field = type.getFields()[fieldName];
2362
- if (field) {
2363
- applyExtensionObject(field, fieldData.extensions);
2364
- for (const [arg, argData] of Object.entries(fieldData.arguments)) {
2365
- applyExtensionObject(field.args.find(a => a.name === arg), argData);
2366
- }
2367
- }
2368
- }
2369
- }
2370
- else if (data.type === 'input') {
2371
- for (const [fieldName, fieldData] of Object.entries(data.fields)) {
2372
- const field = type.getFields()[fieldName];
2373
- applyExtensionObject(field, fieldData.extensions);
2374
- }
2375
- }
2376
- else if (data.type === 'enum') {
2377
- for (const [valueName, valueData] of Object.entries(data.values)) {
2378
- const value = type.getValue(valueName);
2379
- applyExtensionObject(value, valueData);
2380
- }
2381
- }
2382
- }
2383
- }
2384
- return schema;
2385
- }
2386
- exports.applyExtensions = applyExtensions;
2387
-
2388
-
2389
- /***/ }),
2390
-
2391
- /***/ 7331:
2392
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2393
-
2394
-
2395
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2396
- const tslib_1 = __webpack_require__(752);
2397
- tslib_1.__exportStar(__webpack_require__(7793), exports);
2398
- tslib_1.__exportStar(__webpack_require__(6369), exports);
2399
- tslib_1.__exportStar(__webpack_require__(2775), exports);
2400
-
2401
-
2402
- /***/ }),
2403
-
2404
- /***/ 7793:
2405
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2406
-
2407
-
2408
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2409
- exports.mergeResolvers = void 0;
2410
- const utils_1 = __webpack_require__(1718);
2411
- /**
2412
- * Deep merges multiple resolver definition objects into a single definition.
2413
- * @param resolversDefinitions Resolver definitions to be merged
2414
- * @param options Additional options
2415
- *
2416
- * ```js
2417
- * const { mergeResolvers } = require('@graphql-tools/merge');
2418
- * const clientResolver = require('./clientResolver');
2419
- * const productResolver = require('./productResolver');
2420
- *
2421
- * const resolvers = mergeResolvers([
2422
- * clientResolver,
2423
- * productResolver,
2424
- * ]);
2425
- * ```
2426
- *
2427
- * If you don't want to manually create the array of resolver objects, you can
2428
- * also use this function along with loadFiles:
2429
- *
2430
- * ```js
2431
- * const path = require('path');
2432
- * const { mergeResolvers } = require('@graphql-tools/merge');
2433
- * const { loadFilesSync } = require('@graphql-tools/load-files');
2434
- *
2435
- * const resolversArray = loadFilesSync(path.join(__dirname, './resolvers'));
2436
- *
2437
- * const resolvers = mergeResolvers(resolversArray)
2438
- * ```
2439
- */
2440
- function mergeResolvers(resolversDefinitions, options) {
2441
- if (!resolversDefinitions || (Array.isArray(resolversDefinitions) && resolversDefinitions.length === 0)) {
2442
- return {};
2443
- }
2444
- if (!Array.isArray(resolversDefinitions)) {
2445
- return resolversDefinitions;
2446
- }
2447
- if (resolversDefinitions.length === 1) {
2448
- return resolversDefinitions[0] || {};
2449
- }
2450
- const resolvers = new Array();
2451
- for (let resolversDefinition of resolversDefinitions) {
2452
- if (Array.isArray(resolversDefinition)) {
2453
- resolversDefinition = mergeResolvers(resolversDefinition);
2454
- }
2455
- if (typeof resolversDefinition === 'object' && resolversDefinition) {
2456
- resolvers.push(resolversDefinition);
2457
- }
2458
- }
2459
- const result = (0, utils_1.mergeDeep)(resolvers, true);
2460
- if (options === null || options === void 0 ? void 0 : options.exclusions) {
2461
- for (const exclusion of options.exclusions) {
2462
- const [typeName, fieldName] = exclusion.split('.');
2463
- if (!fieldName || fieldName === '*') {
2464
- delete result[typeName];
2465
- }
2466
- else if (result[typeName]) {
2467
- delete result[typeName][fieldName];
2468
- }
2469
- }
2470
- }
2471
- return result;
2472
- }
2473
- exports.mergeResolvers = mergeResolvers;
2474
-
2475
-
2476
- /***/ }),
2477
-
2478
- /***/ 5283:
2479
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2480
-
2481
-
2482
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2483
- exports.mergeArguments = void 0;
2484
- const utils_1 = __webpack_require__(1718);
2485
- function mergeArguments(args1, args2, config) {
2486
- const result = deduplicateArguments([...args2, ...args1].filter(utils_1.isSome));
2487
- if (config && config.sort) {
2488
- result.sort(utils_1.compareNodes);
2489
- }
2490
- return result;
2491
- }
2492
- exports.mergeArguments = mergeArguments;
2493
- function deduplicateArguments(args) {
2494
- return args.reduce((acc, current) => {
2495
- const dup = acc.find(arg => arg.name.value === current.name.value);
2496
- if (!dup) {
2497
- return acc.concat([current]);
2498
- }
2499
- return acc;
2500
- }, []);
2501
- }
2502
-
2503
-
2504
- /***/ }),
2505
-
2506
- /***/ 6989:
2507
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2508
-
2509
-
2510
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2511
- exports.mergeDirective = exports.mergeDirectives = void 0;
2512
- const graphql_1 = __webpack_require__(7343);
2513
- const utils_1 = __webpack_require__(1718);
2514
- function directiveAlreadyExists(directivesArr, otherDirective) {
2515
- return !!directivesArr.find(directive => directive.name.value === otherDirective.name.value);
2516
- }
2517
- function nameAlreadyExists(name, namesArr) {
2518
- return namesArr.some(({ value }) => value === name.value);
2519
- }
2520
- function mergeArguments(a1, a2) {
2521
- const result = [...a2];
2522
- for (const argument of a1) {
2523
- const existingIndex = result.findIndex(a => a.name.value === argument.name.value);
2524
- if (existingIndex > -1) {
2525
- const existingArg = result[existingIndex];
2526
- if (existingArg.value.kind === 'ListValue') {
2527
- const source = existingArg.value.values;
2528
- const target = argument.value.values;
2529
- // merge values of two lists
2530
- existingArg.value.values = deduplicateLists(source, target, (targetVal, source) => {
2531
- const value = targetVal.value;
2532
- return !value || !source.some((sourceVal) => sourceVal.value === value);
2533
- });
2534
- }
2535
- else {
2536
- existingArg.value = argument.value;
2537
- }
2538
- }
2539
- else {
2540
- result.push(argument);
2541
- }
2542
- }
2543
- return result;
2544
- }
2545
- function deduplicateDirectives(directives) {
2546
- return directives
2547
- .map((directive, i, all) => {
2548
- const firstAt = all.findIndex(d => d.name.value === directive.name.value);
2549
- if (firstAt !== i) {
2550
- const dup = all[firstAt];
2551
- directive.arguments = mergeArguments(directive.arguments, dup.arguments);
2552
- return null;
2553
- }
2554
- return directive;
2555
- })
2556
- .filter(utils_1.isSome);
2557
- }
2558
- function mergeDirectives(d1 = [], d2 = [], config) {
2559
- const reverseOrder = config && config.reverseDirectives;
2560
- const asNext = reverseOrder ? d1 : d2;
2561
- const asFirst = reverseOrder ? d2 : d1;
2562
- const result = deduplicateDirectives([...asNext]);
2563
- for (const directive of asFirst) {
2564
- if (directiveAlreadyExists(result, directive)) {
2565
- const existingDirectiveIndex = result.findIndex(d => d.name.value === directive.name.value);
2566
- const existingDirective = result[existingDirectiveIndex];
2567
- result[existingDirectiveIndex].arguments = mergeArguments(directive.arguments || [], existingDirective.arguments || []);
2568
- }
2569
- else {
2570
- result.push(directive);
2571
- }
2572
- }
2573
- return result;
2574
- }
2575
- exports.mergeDirectives = mergeDirectives;
2576
- function validateInputs(node, existingNode) {
2577
- const printedNode = (0, graphql_1.print)({
2578
- ...node,
2579
- description: undefined,
2580
- });
2581
- const printedExistingNode = (0, graphql_1.print)({
2582
- ...existingNode,
2583
- description: undefined,
2584
- });
2585
- // eslint-disable-next-line
2586
- const leaveInputs = new RegExp('(directive @w*d*)|( on .*$)', 'g');
2587
- const sameArguments = printedNode.replace(leaveInputs, '') === printedExistingNode.replace(leaveInputs, '');
2588
- if (!sameArguments) {
2589
- throw new Error(`Unable to merge GraphQL directive "${node.name.value}". \nExisting directive: \n\t${printedExistingNode} \nReceived directive: \n\t${printedNode}`);
2590
- }
2591
- }
2592
- function mergeDirective(node, existingNode) {
2593
- if (existingNode) {
2594
- validateInputs(node, existingNode);
2595
- return {
2596
- ...node,
2597
- locations: [
2598
- ...existingNode.locations,
2599
- ...node.locations.filter(name => !nameAlreadyExists(name, existingNode.locations)),
2600
- ],
2601
- };
2602
- }
2603
- return node;
2604
- }
2605
- exports.mergeDirective = mergeDirective;
2606
- function deduplicateLists(source, target, filterFn) {
2607
- return source.concat(target.filter(val => filterFn(val, source)));
2608
- }
2609
-
2610
-
2611
- /***/ }),
2612
-
2613
- /***/ 3863:
2614
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2615
-
2616
-
2617
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2618
- exports.mergeEnumValues = void 0;
2619
- const directives_js_1 = __webpack_require__(6989);
2620
- const utils_1 = __webpack_require__(1718);
2621
- function mergeEnumValues(first, second, config) {
2622
- if (config === null || config === void 0 ? void 0 : config.consistentEnumMerge) {
2623
- const reversed = [];
2624
- if (first) {
2625
- reversed.push(...first);
2626
- }
2627
- first = second;
2628
- second = reversed;
2629
- }
2630
- const enumValueMap = new Map();
2631
- if (first) {
2632
- for (const firstValue of first) {
2633
- enumValueMap.set(firstValue.name.value, firstValue);
2634
- }
2635
- }
2636
- if (second) {
2637
- for (const secondValue of second) {
2638
- const enumValue = secondValue.name.value;
2639
- if (enumValueMap.has(enumValue)) {
2640
- const firstValue = enumValueMap.get(enumValue);
2641
- firstValue.description = secondValue.description || firstValue.description;
2642
- firstValue.directives = (0, directives_js_1.mergeDirectives)(secondValue.directives, firstValue.directives);
2643
- }
2644
- else {
2645
- enumValueMap.set(enumValue, secondValue);
2646
- }
2647
- }
2648
- }
2649
- const result = [...enumValueMap.values()];
2650
- if (config && config.sort) {
2651
- result.sort(utils_1.compareNodes);
2652
- }
2653
- return result;
2654
- }
2655
- exports.mergeEnumValues = mergeEnumValues;
2656
-
2657
-
2658
- /***/ }),
2659
-
2660
- /***/ 775:
2661
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2662
-
2663
-
2664
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2665
- exports.mergeEnum = void 0;
2666
- const graphql_1 = __webpack_require__(7343);
2667
- const directives_js_1 = __webpack_require__(6989);
2668
- const enum_values_js_1 = __webpack_require__(3863);
2669
- function mergeEnum(e1, e2, config) {
2670
- if (e2) {
2671
- return {
2672
- name: e1.name,
2673
- description: e1['description'] || e2['description'],
2674
- kind: (config === null || config === void 0 ? void 0 : config.convertExtensions) || e1.kind === 'EnumTypeDefinition' || e2.kind === 'EnumTypeDefinition'
2675
- ? 'EnumTypeDefinition'
2676
- : 'EnumTypeExtension',
2677
- loc: e1.loc,
2678
- directives: (0, directives_js_1.mergeDirectives)(e1.directives, e2.directives, config),
2679
- values: (0, enum_values_js_1.mergeEnumValues)(e1.values, e2.values, config),
2680
- };
2681
- }
2682
- return (config === null || config === void 0 ? void 0 : config.convertExtensions)
2683
- ? {
2684
- ...e1,
2685
- kind: graphql_1.Kind.ENUM_TYPE_DEFINITION,
2686
- }
2687
- : e1;
2688
- }
2689
- exports.mergeEnum = mergeEnum;
2690
-
2691
-
2692
- /***/ }),
2693
-
2694
- /***/ 5389:
2695
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2696
-
2697
-
2698
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2699
- exports.mergeFields = void 0;
2700
- const utils_js_1 = __webpack_require__(9227);
2701
- const directives_js_1 = __webpack_require__(6989);
2702
- const utils_1 = __webpack_require__(1718);
2703
- const arguments_js_1 = __webpack_require__(5283);
2704
- function fieldAlreadyExists(fieldsArr, otherField, config) {
2705
- const result = fieldsArr.find(field => field.name.value === otherField.name.value);
2706
- if (result && !(config === null || config === void 0 ? void 0 : config.ignoreFieldConflicts)) {
2707
- const t1 = (0, utils_js_1.extractType)(result.type);
2708
- const t2 = (0, utils_js_1.extractType)(otherField.type);
2709
- if (t1.name.value !== t2.name.value) {
2710
- throw new Error(`Field "${otherField.name.value}" already defined with a different type. Declared as "${t1.name.value}", but you tried to override with "${t2.name.value}"`);
2711
- }
2712
- }
2713
- return !!result;
2714
- }
2715
- function mergeFields(type, f1, f2, config) {
2716
- const result = [];
2717
- if (f2 != null) {
2718
- result.push(...f2);
2719
- }
2720
- if (f1 != null) {
2721
- for (const field of f1) {
2722
- if (fieldAlreadyExists(result, field, config)) {
2723
- const existing = result.find((f) => f.name.value === field.name.value);
2724
- if (!(config === null || config === void 0 ? void 0 : config.ignoreFieldConflicts)) {
2725
- if (config === null || config === void 0 ? void 0 : config.throwOnConflict) {
2726
- preventConflicts(type, existing, field, false);
2727
- }
2728
- else {
2729
- preventConflicts(type, existing, field, true);
2730
- }
2731
- if ((0, utils_js_1.isNonNullTypeNode)(field.type) && !(0, utils_js_1.isNonNullTypeNode)(existing.type)) {
2732
- existing.type = field.type;
2733
- }
2734
- }
2735
- existing.arguments = (0, arguments_js_1.mergeArguments)(field['arguments'] || [], existing.arguments || [], config);
2736
- existing.directives = (0, directives_js_1.mergeDirectives)(field.directives, existing.directives, config);
2737
- existing.description = field.description || existing.description;
2738
- }
2739
- else {
2740
- result.push(field);
2741
- }
2742
- }
2743
- }
2744
- if (config && config.sort) {
2745
- result.sort(utils_1.compareNodes);
2746
- }
2747
- if (config && config.exclusions) {
2748
- const exclusions = config.exclusions;
2749
- return result.filter(field => !exclusions.includes(`${type.name.value}.${field.name.value}`));
2750
- }
2751
- return result;
2752
- }
2753
- exports.mergeFields = mergeFields;
2754
- function preventConflicts(type, a, b, ignoreNullability = false) {
2755
- const aType = (0, utils_js_1.printTypeNode)(a.type);
2756
- const bType = (0, utils_js_1.printTypeNode)(b.type);
2757
- if (aType !== bType && !safeChangeForFieldType(a.type, b.type, ignoreNullability)) {
2758
- throw new Error(`Field '${type.name.value}.${a.name.value}' changed type from '${aType}' to '${bType}'`);
2759
- }
2760
- }
2761
- function safeChangeForFieldType(oldType, newType, ignoreNullability = false) {
2762
- // both are named
2763
- if (!(0, utils_js_1.isWrappingTypeNode)(oldType) && !(0, utils_js_1.isWrappingTypeNode)(newType)) {
2764
- return oldType.toString() === newType.toString();
2765
- }
2766
- // new is non-null
2767
- if ((0, utils_js_1.isNonNullTypeNode)(newType)) {
2768
- const ofType = (0, utils_js_1.isNonNullTypeNode)(oldType) ? oldType.type : oldType;
2769
- return safeChangeForFieldType(ofType, newType.type);
2770
- }
2771
- // old is non-null
2772
- if ((0, utils_js_1.isNonNullTypeNode)(oldType)) {
2773
- return safeChangeForFieldType(newType, oldType, ignoreNullability);
2774
- }
2775
- // old is list
2776
- if ((0, utils_js_1.isListTypeNode)(oldType)) {
2777
- return (((0, utils_js_1.isListTypeNode)(newType) && safeChangeForFieldType(oldType.type, newType.type)) ||
2778
- ((0, utils_js_1.isNonNullTypeNode)(newType) && safeChangeForFieldType(oldType, newType['type'])));
2779
- }
2780
- return false;
2781
- }
2782
-
2783
-
2784
- /***/ }),
2785
-
2786
- /***/ 6369:
2787
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2788
-
2789
-
2790
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2791
- const tslib_1 = __webpack_require__(752);
2792
- tslib_1.__exportStar(__webpack_require__(5283), exports);
2793
- tslib_1.__exportStar(__webpack_require__(6989), exports);
2794
- tslib_1.__exportStar(__webpack_require__(3863), exports);
2795
- tslib_1.__exportStar(__webpack_require__(775), exports);
2796
- tslib_1.__exportStar(__webpack_require__(5389), exports);
2797
- tslib_1.__exportStar(__webpack_require__(6711), exports);
2798
- tslib_1.__exportStar(__webpack_require__(7869), exports);
2799
- tslib_1.__exportStar(__webpack_require__(8700), exports);
2800
- tslib_1.__exportStar(__webpack_require__(1397), exports);
2801
- tslib_1.__exportStar(__webpack_require__(5119), exports);
2802
- tslib_1.__exportStar(__webpack_require__(5248), exports);
2803
- tslib_1.__exportStar(__webpack_require__(8196), exports);
2804
- tslib_1.__exportStar(__webpack_require__(6569), exports);
2805
- tslib_1.__exportStar(__webpack_require__(9227), exports);
2806
-
2807
-
2808
- /***/ }),
2809
-
2810
- /***/ 6711:
2811
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2812
-
2813
-
2814
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2815
- exports.mergeInputType = void 0;
2816
- const graphql_1 = __webpack_require__(7343);
2817
- const fields_js_1 = __webpack_require__(5389);
2818
- const directives_js_1 = __webpack_require__(6989);
2819
- function mergeInputType(node, existingNode, config) {
2820
- if (existingNode) {
2821
- try {
2822
- return {
2823
- name: node.name,
2824
- description: node['description'] || existingNode['description'],
2825
- kind: (config === null || config === void 0 ? void 0 : config.convertExtensions) ||
2826
- node.kind === 'InputObjectTypeDefinition' ||
2827
- existingNode.kind === 'InputObjectTypeDefinition'
2828
- ? 'InputObjectTypeDefinition'
2829
- : 'InputObjectTypeExtension',
2830
- loc: node.loc,
2831
- fields: (0, fields_js_1.mergeFields)(node, node.fields, existingNode.fields, config),
2832
- directives: (0, directives_js_1.mergeDirectives)(node.directives, existingNode.directives, config),
2833
- };
2834
- }
2835
- catch (e) {
2836
- throw new Error(`Unable to merge GraphQL input type "${node.name.value}": ${e.message}`);
2837
- }
2838
- }
2839
- return (config === null || config === void 0 ? void 0 : config.convertExtensions)
2840
- ? {
2841
- ...node,
2842
- kind: graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION,
2843
- }
2844
- : node;
2845
- }
2846
- exports.mergeInputType = mergeInputType;
2847
-
2848
-
2849
- /***/ }),
2850
-
2851
- /***/ 7869:
2852
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2853
-
2854
-
2855
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2856
- exports.mergeInterface = void 0;
2857
- const graphql_1 = __webpack_require__(7343);
2858
- const fields_js_1 = __webpack_require__(5389);
2859
- const directives_js_1 = __webpack_require__(6989);
2860
- const merge_named_type_array_js_1 = __webpack_require__(8700);
2861
- function mergeInterface(node, existingNode, config) {
2862
- if (existingNode) {
2863
- try {
2864
- return {
2865
- name: node.name,
2866
- description: node['description'] || existingNode['description'],
2867
- kind: (config === null || config === void 0 ? void 0 : config.convertExtensions) ||
2868
- node.kind === 'InterfaceTypeDefinition' ||
2869
- existingNode.kind === 'InterfaceTypeDefinition'
2870
- ? 'InterfaceTypeDefinition'
2871
- : 'InterfaceTypeExtension',
2872
- loc: node.loc,
2873
- fields: (0, fields_js_1.mergeFields)(node, node.fields, existingNode.fields, config),
2874
- directives: (0, directives_js_1.mergeDirectives)(node.directives, existingNode.directives, config),
2875
- interfaces: node['interfaces']
2876
- ? (0, merge_named_type_array_js_1.mergeNamedTypeArray)(node['interfaces'], existingNode['interfaces'], config)
2877
- : undefined,
2878
- };
2879
- }
2880
- catch (e) {
2881
- throw new Error(`Unable to merge GraphQL interface "${node.name.value}": ${e.message}`);
2882
- }
2883
- }
2884
- return (config === null || config === void 0 ? void 0 : config.convertExtensions)
2885
- ? {
2886
- ...node,
2887
- kind: graphql_1.Kind.INTERFACE_TYPE_DEFINITION,
2888
- }
2889
- : node;
2890
- }
2891
- exports.mergeInterface = mergeInterface;
2892
-
2893
-
2894
- /***/ }),
2895
-
2896
- /***/ 8700:
2897
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2898
-
2899
-
2900
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2901
- exports.mergeNamedTypeArray = void 0;
2902
- const utils_1 = __webpack_require__(1718);
2903
- function alreadyExists(arr, other) {
2904
- return !!arr.find(i => i.name.value === other.name.value);
2905
- }
2906
- function mergeNamedTypeArray(first = [], second = [], config = {}) {
2907
- const result = [...second, ...first.filter(d => !alreadyExists(second, d))];
2908
- if (config && config.sort) {
2909
- result.sort(utils_1.compareNodes);
2910
- }
2911
- return result;
2912
- }
2913
- exports.mergeNamedTypeArray = mergeNamedTypeArray;
2914
-
2915
-
2916
- /***/ }),
2917
-
2918
- /***/ 1397:
2919
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2920
-
2921
-
2922
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2923
- exports.mergeGraphQLNodes = exports.isNamedDefinitionNode = exports.schemaDefSymbol = void 0;
2924
- const graphql_1 = __webpack_require__(7343);
2925
- const type_js_1 = __webpack_require__(8196);
2926
- const enum_js_1 = __webpack_require__(775);
2927
- const scalar_js_1 = __webpack_require__(5248);
2928
- const union_js_1 = __webpack_require__(6569);
2929
- const input_type_js_1 = __webpack_require__(6711);
2930
- const interface_js_1 = __webpack_require__(7869);
2931
- const directives_js_1 = __webpack_require__(6989);
2932
- const schema_def_js_1 = __webpack_require__(8069);
2933
- const utils_1 = __webpack_require__(1718);
2934
- exports.schemaDefSymbol = 'SCHEMA_DEF_SYMBOL';
2935
- function isNamedDefinitionNode(definitionNode) {
2936
- return 'name' in definitionNode;
2937
- }
2938
- exports.isNamedDefinitionNode = isNamedDefinitionNode;
2939
- function mergeGraphQLNodes(nodes, config) {
2940
- var _a, _b, _c;
2941
- const mergedResultMap = {};
2942
- for (const nodeDefinition of nodes) {
2943
- if (isNamedDefinitionNode(nodeDefinition)) {
2944
- const name = (_a = nodeDefinition.name) === null || _a === void 0 ? void 0 : _a.value;
2945
- if (config === null || config === void 0 ? void 0 : config.commentDescriptions) {
2946
- (0, utils_1.collectComment)(nodeDefinition);
2947
- }
2948
- if (name == null) {
2949
- continue;
2950
- }
2951
- if (((_b = config === null || config === void 0 ? void 0 : config.exclusions) === null || _b === void 0 ? void 0 : _b.includes(name + '.*')) || ((_c = config === null || config === void 0 ? void 0 : config.exclusions) === null || _c === void 0 ? void 0 : _c.includes(name))) {
2952
- delete mergedResultMap[name];
2953
- }
2954
- else {
2955
- switch (nodeDefinition.kind) {
2956
- case graphql_1.Kind.OBJECT_TYPE_DEFINITION:
2957
- case graphql_1.Kind.OBJECT_TYPE_EXTENSION:
2958
- mergedResultMap[name] = (0, type_js_1.mergeType)(nodeDefinition, mergedResultMap[name], config);
2959
- break;
2960
- case graphql_1.Kind.ENUM_TYPE_DEFINITION:
2961
- case graphql_1.Kind.ENUM_TYPE_EXTENSION:
2962
- mergedResultMap[name] = (0, enum_js_1.mergeEnum)(nodeDefinition, mergedResultMap[name], config);
2963
- break;
2964
- case graphql_1.Kind.UNION_TYPE_DEFINITION:
2965
- case graphql_1.Kind.UNION_TYPE_EXTENSION:
2966
- mergedResultMap[name] = (0, union_js_1.mergeUnion)(nodeDefinition, mergedResultMap[name], config);
2967
- break;
2968
- case graphql_1.Kind.SCALAR_TYPE_DEFINITION:
2969
- case graphql_1.Kind.SCALAR_TYPE_EXTENSION:
2970
- mergedResultMap[name] = (0, scalar_js_1.mergeScalar)(nodeDefinition, mergedResultMap[name], config);
2971
- break;
2972
- case graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION:
2973
- case graphql_1.Kind.INPUT_OBJECT_TYPE_EXTENSION:
2974
- mergedResultMap[name] = (0, input_type_js_1.mergeInputType)(nodeDefinition, mergedResultMap[name], config);
2975
- break;
2976
- case graphql_1.Kind.INTERFACE_TYPE_DEFINITION:
2977
- case graphql_1.Kind.INTERFACE_TYPE_EXTENSION:
2978
- mergedResultMap[name] = (0, interface_js_1.mergeInterface)(nodeDefinition, mergedResultMap[name], config);
2979
- break;
2980
- case graphql_1.Kind.DIRECTIVE_DEFINITION:
2981
- mergedResultMap[name] = (0, directives_js_1.mergeDirective)(nodeDefinition, mergedResultMap[name]);
2982
- break;
2983
- }
2984
- }
2985
- }
2986
- else if (nodeDefinition.kind === graphql_1.Kind.SCHEMA_DEFINITION || nodeDefinition.kind === graphql_1.Kind.SCHEMA_EXTENSION) {
2987
- mergedResultMap[exports.schemaDefSymbol] = (0, schema_def_js_1.mergeSchemaDefs)(nodeDefinition, mergedResultMap[exports.schemaDefSymbol], config);
2988
- }
2989
- }
2990
- return mergedResultMap;
2991
- }
2992
- exports.mergeGraphQLNodes = mergeGraphQLNodes;
2993
-
2994
-
2995
- /***/ }),
2996
-
2997
- /***/ 5119:
2998
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2999
-
3000
-
3001
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3002
- exports.mergeGraphQLTypes = exports.mergeTypeDefs = void 0;
3003
- const graphql_1 = __webpack_require__(7343);
3004
- const utils_js_1 = __webpack_require__(9227);
3005
- const merge_nodes_js_1 = __webpack_require__(1397);
3006
- const utils_1 = __webpack_require__(1718);
3007
- const schema_def_js_1 = __webpack_require__(8069);
3008
- function mergeTypeDefs(typeSource, config) {
3009
- (0, utils_1.resetComments)();
3010
- const doc = {
3011
- kind: graphql_1.Kind.DOCUMENT,
3012
- definitions: mergeGraphQLTypes(typeSource, {
3013
- useSchemaDefinition: true,
3014
- forceSchemaDefinition: false,
3015
- throwOnConflict: false,
3016
- commentDescriptions: false,
3017
- ...config,
3018
- }),
3019
- };
3020
- let result;
3021
- if (config === null || config === void 0 ? void 0 : config.commentDescriptions) {
3022
- result = (0, utils_1.printWithComments)(doc);
3023
- }
3024
- else {
3025
- result = doc;
3026
- }
3027
- (0, utils_1.resetComments)();
3028
- return result;
3029
- }
3030
- exports.mergeTypeDefs = mergeTypeDefs;
3031
- function visitTypeSources(typeSource, options, allNodes = [], visitedTypeSources = new Set()) {
3032
- if (typeSource && !visitedTypeSources.has(typeSource)) {
3033
- visitedTypeSources.add(typeSource);
3034
- if (typeof typeSource === 'function') {
3035
- visitTypeSources(typeSource(), options, allNodes, visitedTypeSources);
3036
- }
3037
- else if (Array.isArray(typeSource)) {
3038
- for (const type of typeSource) {
3039
- visitTypeSources(type, options, allNodes, visitedTypeSources);
3040
- }
3041
- }
3042
- else if ((0, graphql_1.isSchema)(typeSource)) {
3043
- const documentNode = (0, utils_1.getDocumentNodeFromSchema)(typeSource, options);
3044
- visitTypeSources(documentNode.definitions, options, allNodes, visitedTypeSources);
3045
- }
3046
- else if ((0, utils_js_1.isStringTypes)(typeSource) || (0, utils_js_1.isSourceTypes)(typeSource)) {
3047
- const documentNode = (0, graphql_1.parse)(typeSource, options);
3048
- visitTypeSources(documentNode.definitions, options, allNodes, visitedTypeSources);
3049
- }
3050
- else if (typeof typeSource === 'object' && (0, graphql_1.isDefinitionNode)(typeSource)) {
3051
- allNodes.push(typeSource);
3052
- }
3053
- else if ((0, utils_1.isDocumentNode)(typeSource)) {
3054
- visitTypeSources(typeSource.definitions, options, allNodes, visitedTypeSources);
3055
- }
3056
- else {
3057
- throw new Error(`typeDefs must contain only strings, documents, schemas, or functions, got ${typeof typeSource}`);
3058
- }
3059
- }
3060
- return allNodes;
3061
- }
3062
- function mergeGraphQLTypes(typeSource, config) {
3063
- var _a, _b, _c;
3064
- (0, utils_1.resetComments)();
3065
- const allNodes = visitTypeSources(typeSource, config);
3066
- const mergedNodes = (0, merge_nodes_js_1.mergeGraphQLNodes)(allNodes, config);
3067
- if (config === null || config === void 0 ? void 0 : config.useSchemaDefinition) {
3068
- // XXX: right now we don't handle multiple schema definitions
3069
- const schemaDef = mergedNodes[merge_nodes_js_1.schemaDefSymbol] || {
3070
- kind: graphql_1.Kind.SCHEMA_DEFINITION,
3071
- operationTypes: [],
3072
- };
3073
- const operationTypes = schemaDef.operationTypes;
3074
- for (const opTypeDefNodeType in schema_def_js_1.DEFAULT_OPERATION_TYPE_NAME_MAP) {
3075
- const opTypeDefNode = operationTypes.find(operationType => operationType.operation === opTypeDefNodeType);
3076
- if (!opTypeDefNode) {
3077
- const possibleRootTypeName = schema_def_js_1.DEFAULT_OPERATION_TYPE_NAME_MAP[opTypeDefNodeType];
3078
- const existingPossibleRootType = mergedNodes[possibleRootTypeName];
3079
- if (existingPossibleRootType != null && existingPossibleRootType.name != null) {
3080
- operationTypes.push({
3081
- kind: graphql_1.Kind.OPERATION_TYPE_DEFINITION,
3082
- type: {
3083
- kind: graphql_1.Kind.NAMED_TYPE,
3084
- name: existingPossibleRootType.name,
3085
- },
3086
- operation: opTypeDefNodeType,
3087
- });
3088
- }
3089
- }
3090
- }
3091
- if (((_a = schemaDef === null || schemaDef === void 0 ? void 0 : schemaDef.operationTypes) === null || _a === void 0 ? void 0 : _a.length) != null && schemaDef.operationTypes.length > 0) {
3092
- mergedNodes[merge_nodes_js_1.schemaDefSymbol] = schemaDef;
3093
- }
3094
- }
3095
- if ((config === null || config === void 0 ? void 0 : config.forceSchemaDefinition) && !((_c = (_b = mergedNodes[merge_nodes_js_1.schemaDefSymbol]) === null || _b === void 0 ? void 0 : _b.operationTypes) === null || _c === void 0 ? void 0 : _c.length)) {
3096
- mergedNodes[merge_nodes_js_1.schemaDefSymbol] = {
3097
- kind: graphql_1.Kind.SCHEMA_DEFINITION,
3098
- operationTypes: [
3099
- {
3100
- kind: graphql_1.Kind.OPERATION_TYPE_DEFINITION,
3101
- operation: 'query',
3102
- type: {
3103
- kind: graphql_1.Kind.NAMED_TYPE,
3104
- name: {
3105
- kind: graphql_1.Kind.NAME,
3106
- value: 'Query',
3107
- },
3108
- },
3109
- },
3110
- ],
3111
- };
3112
- }
3113
- const mergedNodeDefinitions = Object.values(mergedNodes);
3114
- if (config === null || config === void 0 ? void 0 : config.sort) {
3115
- const sortFn = typeof config.sort === 'function' ? config.sort : utils_js_1.defaultStringComparator;
3116
- mergedNodeDefinitions.sort((a, b) => { var _a, _b; return sortFn((_a = a.name) === null || _a === void 0 ? void 0 : _a.value, (_b = b.name) === null || _b === void 0 ? void 0 : _b.value); });
3117
- }
3118
- return mergedNodeDefinitions;
3119
- }
3120
- exports.mergeGraphQLTypes = mergeGraphQLTypes;
3121
-
3122
-
3123
- /***/ }),
3124
-
3125
- /***/ 5248:
3126
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3127
-
3128
-
3129
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3130
- exports.mergeScalar = void 0;
3131
- const graphql_1 = __webpack_require__(7343);
3132
- const directives_js_1 = __webpack_require__(6989);
3133
- function mergeScalar(node, existingNode, config) {
3134
- if (existingNode) {
3135
- return {
3136
- name: node.name,
3137
- description: node['description'] || existingNode['description'],
3138
- kind: (config === null || config === void 0 ? void 0 : config.convertExtensions) ||
3139
- node.kind === 'ScalarTypeDefinition' ||
3140
- existingNode.kind === 'ScalarTypeDefinition'
3141
- ? 'ScalarTypeDefinition'
3142
- : 'ScalarTypeExtension',
3143
- loc: node.loc,
3144
- directives: (0, directives_js_1.mergeDirectives)(node.directives, existingNode.directives, config),
3145
- };
3146
- }
3147
- return (config === null || config === void 0 ? void 0 : config.convertExtensions)
3148
- ? {
3149
- ...node,
3150
- kind: graphql_1.Kind.SCALAR_TYPE_DEFINITION,
3151
- }
3152
- : node;
3153
- }
3154
- exports.mergeScalar = mergeScalar;
3155
-
3156
-
3157
- /***/ }),
3158
-
3159
- /***/ 8069:
3160
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3161
-
3162
-
3163
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3164
- exports.mergeSchemaDefs = exports.DEFAULT_OPERATION_TYPE_NAME_MAP = void 0;
3165
- const graphql_1 = __webpack_require__(7343);
3166
- const directives_js_1 = __webpack_require__(6989);
3167
- exports.DEFAULT_OPERATION_TYPE_NAME_MAP = {
3168
- query: 'Query',
3169
- mutation: 'Mutation',
3170
- subscription: 'Subscription',
3171
- };
3172
- function mergeOperationTypes(opNodeList = [], existingOpNodeList = []) {
3173
- const finalOpNodeList = [];
3174
- for (const opNodeType in exports.DEFAULT_OPERATION_TYPE_NAME_MAP) {
3175
- const opNode = opNodeList.find(n => n.operation === opNodeType) || existingOpNodeList.find(n => n.operation === opNodeType);
3176
- if (opNode) {
3177
- finalOpNodeList.push(opNode);
3178
- }
3179
- }
3180
- return finalOpNodeList;
3181
- }
3182
- function mergeSchemaDefs(node, existingNode, config) {
3183
- if (existingNode) {
3184
- return {
3185
- kind: node.kind === graphql_1.Kind.SCHEMA_DEFINITION || existingNode.kind === graphql_1.Kind.SCHEMA_DEFINITION
3186
- ? graphql_1.Kind.SCHEMA_DEFINITION
3187
- : graphql_1.Kind.SCHEMA_EXTENSION,
3188
- description: node['description'] || existingNode['description'],
3189
- directives: (0, directives_js_1.mergeDirectives)(node.directives, existingNode.directives, config),
3190
- operationTypes: mergeOperationTypes(node.operationTypes, existingNode.operationTypes),
3191
- };
3192
- }
3193
- return ((config === null || config === void 0 ? void 0 : config.convertExtensions)
3194
- ? {
3195
- ...node,
3196
- kind: graphql_1.Kind.SCHEMA_DEFINITION,
3197
- }
3198
- : node);
3199
- }
3200
- exports.mergeSchemaDefs = mergeSchemaDefs;
3201
-
3202
-
3203
- /***/ }),
3204
-
3205
- /***/ 8196:
3206
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3207
-
3208
-
3209
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3210
- exports.mergeType = void 0;
3211
- const graphql_1 = __webpack_require__(7343);
3212
- const fields_js_1 = __webpack_require__(5389);
3213
- const directives_js_1 = __webpack_require__(6989);
3214
- const merge_named_type_array_js_1 = __webpack_require__(8700);
3215
- function mergeType(node, existingNode, config) {
3216
- if (existingNode) {
3217
- try {
3218
- return {
3219
- name: node.name,
3220
- description: node['description'] || existingNode['description'],
3221
- kind: (config === null || config === void 0 ? void 0 : config.convertExtensions) ||
3222
- node.kind === 'ObjectTypeDefinition' ||
3223
- existingNode.kind === 'ObjectTypeDefinition'
3224
- ? 'ObjectTypeDefinition'
3225
- : 'ObjectTypeExtension',
3226
- loc: node.loc,
3227
- fields: (0, fields_js_1.mergeFields)(node, node.fields, existingNode.fields, config),
3228
- directives: (0, directives_js_1.mergeDirectives)(node.directives, existingNode.directives, config),
3229
- interfaces: (0, merge_named_type_array_js_1.mergeNamedTypeArray)(node.interfaces, existingNode.interfaces, config),
3230
- };
3231
- }
3232
- catch (e) {
3233
- throw new Error(`Unable to merge GraphQL type "${node.name.value}": ${e.message}`);
3234
- }
3235
- }
3236
- return (config === null || config === void 0 ? void 0 : config.convertExtensions)
3237
- ? {
3238
- ...node,
3239
- kind: graphql_1.Kind.OBJECT_TYPE_DEFINITION,
3240
- }
3241
- : node;
3242
- }
3243
- exports.mergeType = mergeType;
3244
-
3245
-
3246
- /***/ }),
3247
-
3248
- /***/ 6569:
3249
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3250
-
3251
-
3252
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3253
- exports.mergeUnion = void 0;
3254
- const graphql_1 = __webpack_require__(7343);
3255
- const directives_js_1 = __webpack_require__(6989);
3256
- const merge_named_type_array_js_1 = __webpack_require__(8700);
3257
- function mergeUnion(first, second, config) {
3258
- if (second) {
3259
- return {
3260
- name: first.name,
3261
- description: first['description'] || second['description'],
3262
- // ConstXNode has been introduced in v16 but it is not compatible with XNode so we do `as any` for backwards compatibility
3263
- directives: (0, directives_js_1.mergeDirectives)(first.directives, second.directives, config),
3264
- kind: (config === null || config === void 0 ? void 0 : config.convertExtensions) || first.kind === 'UnionTypeDefinition' || second.kind === 'UnionTypeDefinition'
3265
- ? graphql_1.Kind.UNION_TYPE_DEFINITION
3266
- : graphql_1.Kind.UNION_TYPE_EXTENSION,
3267
- loc: first.loc,
3268
- types: (0, merge_named_type_array_js_1.mergeNamedTypeArray)(first.types, second.types, config),
3269
- };
3270
- }
3271
- return (config === null || config === void 0 ? void 0 : config.convertExtensions)
3272
- ? {
3273
- ...first,
3274
- kind: graphql_1.Kind.UNION_TYPE_DEFINITION,
3275
- }
3276
- : first;
3277
- }
3278
- exports.mergeUnion = mergeUnion;
3279
-
3280
-
3281
- /***/ }),
3282
-
3283
- /***/ 9227:
3284
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3285
-
3286
-
3287
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3288
- exports.defaultStringComparator = exports.CompareVal = exports.printTypeNode = exports.isNonNullTypeNode = exports.isListTypeNode = exports.isWrappingTypeNode = exports.extractType = exports.isSourceTypes = exports.isStringTypes = void 0;
3289
- const graphql_1 = __webpack_require__(7343);
3290
- function isStringTypes(types) {
3291
- return typeof types === 'string';
3292
- }
3293
- exports.isStringTypes = isStringTypes;
3294
- function isSourceTypes(types) {
3295
- return types instanceof graphql_1.Source;
3296
- }
3297
- exports.isSourceTypes = isSourceTypes;
3298
- function extractType(type) {
3299
- let visitedType = type;
3300
- while (visitedType.kind === graphql_1.Kind.LIST_TYPE || visitedType.kind === 'NonNullType') {
3301
- visitedType = visitedType.type;
3302
- }
3303
- return visitedType;
3304
- }
3305
- exports.extractType = extractType;
3306
- function isWrappingTypeNode(type) {
3307
- return type.kind !== graphql_1.Kind.NAMED_TYPE;
3308
- }
3309
- exports.isWrappingTypeNode = isWrappingTypeNode;
3310
- function isListTypeNode(type) {
3311
- return type.kind === graphql_1.Kind.LIST_TYPE;
3312
- }
3313
- exports.isListTypeNode = isListTypeNode;
3314
- function isNonNullTypeNode(type) {
3315
- return type.kind === graphql_1.Kind.NON_NULL_TYPE;
3316
- }
3317
- exports.isNonNullTypeNode = isNonNullTypeNode;
3318
- function printTypeNode(type) {
3319
- if (isListTypeNode(type)) {
3320
- return `[${printTypeNode(type.type)}]`;
3321
- }
3322
- if (isNonNullTypeNode(type)) {
3323
- return `${printTypeNode(type.type)}!`;
3324
- }
3325
- return type.name.value;
3326
- }
3327
- exports.printTypeNode = printTypeNode;
3328
- var CompareVal;
3329
- (function (CompareVal) {
3330
- CompareVal[CompareVal["A_SMALLER_THAN_B"] = -1] = "A_SMALLER_THAN_B";
3331
- CompareVal[CompareVal["A_EQUALS_B"] = 0] = "A_EQUALS_B";
3332
- CompareVal[CompareVal["A_GREATER_THAN_B"] = 1] = "A_GREATER_THAN_B";
3333
- })(CompareVal = exports.CompareVal || (exports.CompareVal = {}));
3334
- function defaultStringComparator(a, b) {
3335
- if (a == null && b == null) {
3336
- return CompareVal.A_EQUALS_B;
3337
- }
3338
- if (a == null) {
3339
- return CompareVal.A_SMALLER_THAN_B;
3340
- }
3341
- if (b == null) {
3342
- return CompareVal.A_GREATER_THAN_B;
3343
- }
3344
- if (a < b)
3345
- return CompareVal.A_SMALLER_THAN_B;
3346
- if (a > b)
3347
- return CompareVal.A_GREATER_THAN_B;
3348
- return CompareVal.A_EQUALS_B;
3349
- }
3350
- exports.defaultStringComparator = defaultStringComparator;
3351
-
3352
-
3353
- /***/ }),
3354
-
3355
- /***/ 7715:
3356
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3357
-
3358
-
3359
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3360
- exports.addResolversToSchema = void 0;
3361
- const graphql_1 = __webpack_require__(7343);
3362
- const utils_1 = __webpack_require__(1718);
3363
- const checkForResolveTypeResolver_js_1 = __webpack_require__(9435);
3364
- const extendResolversFromInterfaces_js_1 = __webpack_require__(9630);
3365
- function addResolversToSchema({ schema, resolvers: inputResolvers, defaultFieldResolver, resolverValidationOptions = {}, inheritResolversFromInterfaces = false, updateResolversInPlace = false, }) {
3366
- const { requireResolversToMatchSchema = 'error', requireResolversForResolveType } = resolverValidationOptions;
3367
- const resolvers = inheritResolversFromInterfaces
3368
- ? (0, extendResolversFromInterfaces_js_1.extendResolversFromInterfaces)(schema, inputResolvers)
3369
- : inputResolvers;
3370
- for (const typeName in resolvers) {
3371
- const resolverValue = resolvers[typeName];
3372
- const resolverType = typeof resolverValue;
3373
- if (resolverType !== 'object') {
3374
- throw new Error(`"${typeName}" defined in resolvers, but has invalid value "${resolverValue}". The resolver's value must be of type object.`);
3375
- }
3376
- const type = schema.getType(typeName);
3377
- if (type == null) {
3378
- if (requireResolversToMatchSchema === 'ignore') {
3379
- continue;
3380
- }
3381
- throw new Error(`"${typeName}" defined in resolvers, but not in schema`);
3382
- }
3383
- else if ((0, graphql_1.isSpecifiedScalarType)(type)) {
3384
- // allow -- without recommending -- overriding of specified scalar types
3385
- for (const fieldName in resolverValue) {
3386
- if (fieldName.startsWith('__')) {
3387
- type[fieldName.substring(2)] = resolverValue[fieldName];
3388
- }
3389
- else {
3390
- type[fieldName] = resolverValue[fieldName];
3391
- }
3392
- }
3393
- }
3394
- else if ((0, graphql_1.isEnumType)(type)) {
3395
- const values = type.getValues();
3396
- for (const fieldName in resolverValue) {
3397
- if (!fieldName.startsWith('__') &&
3398
- !values.some(value => value.name === fieldName) &&
3399
- requireResolversToMatchSchema &&
3400
- requireResolversToMatchSchema !== 'ignore') {
3401
- throw new Error(`${type.name}.${fieldName} was defined in resolvers, but not present within ${type.name}`);
3402
- }
3403
- }
3404
- }
3405
- else if ((0, graphql_1.isUnionType)(type)) {
3406
- for (const fieldName in resolverValue) {
3407
- if (!fieldName.startsWith('__') &&
3408
- requireResolversToMatchSchema &&
3409
- requireResolversToMatchSchema !== 'ignore') {
3410
- throw new Error(`${type.name}.${fieldName} was defined in resolvers, but ${type.name} is not an object or interface type`);
3411
- }
3412
- }
3413
- }
3414
- else if ((0, graphql_1.isObjectType)(type) || (0, graphql_1.isInterfaceType)(type)) {
3415
- for (const fieldName in resolverValue) {
3416
- if (!fieldName.startsWith('__')) {
3417
- const fields = type.getFields();
3418
- const field = fields[fieldName];
3419
- if (field == null) {
3420
- // Field present in resolver but not in schema
3421
- if (requireResolversToMatchSchema && requireResolversToMatchSchema !== 'ignore') {
3422
- throw new Error(`${typeName}.${fieldName} defined in resolvers, but not in schema`);
3423
- }
3424
- }
3425
- else {
3426
- // Field present in both the resolver and schema
3427
- const fieldResolve = resolverValue[fieldName];
3428
- if (typeof fieldResolve !== 'function' && typeof fieldResolve !== 'object') {
3429
- throw new Error(`Resolver ${typeName}.${fieldName} must be object or function`);
3430
- }
3431
- }
3432
- }
3433
- }
3434
- }
3435
- }
3436
- schema = updateResolversInPlace
3437
- ? addResolversToExistingSchema(schema, resolvers, defaultFieldResolver)
3438
- : createNewSchemaWithResolvers(schema, resolvers, defaultFieldResolver);
3439
- if (requireResolversForResolveType && requireResolversForResolveType !== 'ignore') {
3440
- (0, checkForResolveTypeResolver_js_1.checkForResolveTypeResolver)(schema, requireResolversForResolveType);
3441
- }
3442
- return schema;
3443
- }
3444
- exports.addResolversToSchema = addResolversToSchema;
3445
- function addResolversToExistingSchema(schema, resolvers, defaultFieldResolver) {
3446
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3447
- const typeMap = schema.getTypeMap();
3448
- for (const typeName in resolvers) {
3449
- const type = schema.getType(typeName);
3450
- const resolverValue = resolvers[typeName];
3451
- if ((0, graphql_1.isScalarType)(type)) {
3452
- for (const fieldName in resolverValue) {
3453
- if (fieldName.startsWith('__')) {
3454
- type[fieldName.substring(2)] = resolverValue[fieldName];
3455
- }
3456
- else if (fieldName === 'astNode' && type.astNode != null) {
3457
- type.astNode = {
3458
- ...type.astNode,
3459
- description: (_b = (_a = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.astNode) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : type.astNode.description,
3460
- directives: ((_c = type.astNode.directives) !== null && _c !== void 0 ? _c : []).concat((_e = (_d = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.astNode) === null || _d === void 0 ? void 0 : _d.directives) !== null && _e !== void 0 ? _e : []),
3461
- };
3462
- }
3463
- else if (fieldName === 'extensionASTNodes' && type.extensionASTNodes != null) {
3464
- type.extensionASTNodes = type.extensionASTNodes.concat((_f = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.extensionASTNodes) !== null && _f !== void 0 ? _f : []);
3465
- }
3466
- else if (fieldName === 'extensions' &&
3467
- type.extensions != null &&
3468
- resolverValue.extensions != null) {
3469
- type.extensions = Object.assign(Object.create(null), type.extensions, resolverValue.extensions);
3470
- }
3471
- else {
3472
- type[fieldName] = resolverValue[fieldName];
3473
- }
3474
- }
3475
- }
3476
- else if ((0, graphql_1.isEnumType)(type)) {
3477
- const config = type.toConfig();
3478
- const enumValueConfigMap = config.values;
3479
- for (const fieldName in resolverValue) {
3480
- if (fieldName.startsWith('__')) {
3481
- config[fieldName.substring(2)] = resolverValue[fieldName];
3482
- }
3483
- else if (fieldName === 'astNode' && config.astNode != null) {
3484
- config.astNode = {
3485
- ...config.astNode,
3486
- description: (_h = (_g = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.astNode) === null || _g === void 0 ? void 0 : _g.description) !== null && _h !== void 0 ? _h : config.astNode.description,
3487
- directives: ((_j = config.astNode.directives) !== null && _j !== void 0 ? _j : []).concat((_l = (_k = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.astNode) === null || _k === void 0 ? void 0 : _k.directives) !== null && _l !== void 0 ? _l : []),
3488
- };
3489
- }
3490
- else if (fieldName === 'extensionASTNodes' && config.extensionASTNodes != null) {
3491
- config.extensionASTNodes = config.extensionASTNodes.concat((_m = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.extensionASTNodes) !== null && _m !== void 0 ? _m : []);
3492
- }
3493
- else if (fieldName === 'extensions' &&
3494
- type.extensions != null &&
3495
- resolverValue.extensions != null) {
3496
- type.extensions = Object.assign(Object.create(null), type.extensions, resolverValue.extensions);
3497
- }
3498
- else if (enumValueConfigMap[fieldName]) {
3499
- enumValueConfigMap[fieldName].value = resolverValue[fieldName];
3500
- }
3501
- }
3502
- typeMap[typeName] = new graphql_1.GraphQLEnumType(config);
3503
- }
3504
- else if ((0, graphql_1.isUnionType)(type)) {
3505
- for (const fieldName in resolverValue) {
3506
- if (fieldName.startsWith('__')) {
3507
- type[fieldName.substring(2)] = resolverValue[fieldName];
3508
- }
3509
- }
3510
- }
3511
- else if ((0, graphql_1.isObjectType)(type) || (0, graphql_1.isInterfaceType)(type)) {
3512
- for (const fieldName in resolverValue) {
3513
- if (fieldName.startsWith('__')) {
3514
- // this is for isTypeOf and resolveType and all the other stuff.
3515
- type[fieldName.substring(2)] = resolverValue[fieldName];
3516
- continue;
3517
- }
3518
- const fields = type.getFields();
3519
- const field = fields[fieldName];
3520
- if (field != null) {
3521
- const fieldResolve = resolverValue[fieldName];
3522
- if (typeof fieldResolve === 'function') {
3523
- // for convenience. Allows shorter syntax in resolver definition file
3524
- field.resolve = fieldResolve.bind(resolverValue);
3525
- }
3526
- else {
3527
- setFieldProperties(field, fieldResolve);
3528
- }
3529
- }
3530
- }
3531
- }
3532
- }
3533
- // serialize all default values prior to healing fields with new scalar/enum types.
3534
- (0, utils_1.forEachDefaultValue)(schema, utils_1.serializeInputValue);
3535
- // schema may have new scalar/enum types that require healing
3536
- (0, utils_1.healSchema)(schema);
3537
- // reparse all default values with new parsing functions.
3538
- (0, utils_1.forEachDefaultValue)(schema, utils_1.parseInputValue);
3539
- if (defaultFieldResolver != null) {
3540
- (0, utils_1.forEachField)(schema, field => {
3541
- if (!field.resolve) {
3542
- field.resolve = defaultFieldResolver;
3543
- }
3544
- });
3545
- }
3546
- return schema;
3547
- }
3548
- function createNewSchemaWithResolvers(schema, resolvers, defaultFieldResolver) {
3549
- schema = (0, utils_1.mapSchema)(schema, {
3550
- [utils_1.MapperKind.SCALAR_TYPE]: type => {
3551
- var _a, _b, _c, _d, _e, _f;
3552
- const config = type.toConfig();
3553
- const resolverValue = resolvers[type.name];
3554
- if (!(0, graphql_1.isSpecifiedScalarType)(type) && resolverValue != null) {
3555
- for (const fieldName in resolverValue) {
3556
- if (fieldName.startsWith('__')) {
3557
- config[fieldName.substring(2)] = resolverValue[fieldName];
3558
- }
3559
- else if (fieldName === 'astNode' && config.astNode != null) {
3560
- config.astNode = {
3561
- ...config.astNode,
3562
- description: (_b = (_a = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.astNode) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : config.astNode.description,
3563
- directives: ((_c = config.astNode.directives) !== null && _c !== void 0 ? _c : []).concat((_e = (_d = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.astNode) === null || _d === void 0 ? void 0 : _d.directives) !== null && _e !== void 0 ? _e : []),
3564
- };
3565
- }
3566
- else if (fieldName === 'extensionASTNodes' && config.extensionASTNodes != null) {
3567
- config.extensionASTNodes = config.extensionASTNodes.concat((_f = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.extensionASTNodes) !== null && _f !== void 0 ? _f : []);
3568
- }
3569
- else if (fieldName === 'extensions' &&
3570
- config.extensions != null &&
3571
- resolverValue.extensions != null) {
3572
- config.extensions = Object.assign(Object.create(null), type.extensions, resolverValue.extensions);
3573
- }
3574
- else {
3575
- config[fieldName] = resolverValue[fieldName];
3576
- }
3577
- }
3578
- return new graphql_1.GraphQLScalarType(config);
3579
- }
3580
- },
3581
- [utils_1.MapperKind.ENUM_TYPE]: type => {
3582
- var _a, _b, _c, _d, _e, _f;
3583
- const resolverValue = resolvers[type.name];
3584
- const config = type.toConfig();
3585
- const enumValueConfigMap = config.values;
3586
- if (resolverValue != null) {
3587
- for (const fieldName in resolverValue) {
3588
- if (fieldName.startsWith('__')) {
3589
- config[fieldName.substring(2)] = resolverValue[fieldName];
3590
- }
3591
- else if (fieldName === 'astNode' && config.astNode != null) {
3592
- config.astNode = {
3593
- ...config.astNode,
3594
- description: (_b = (_a = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.astNode) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : config.astNode.description,
3595
- directives: ((_c = config.astNode.directives) !== null && _c !== void 0 ? _c : []).concat((_e = (_d = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.astNode) === null || _d === void 0 ? void 0 : _d.directives) !== null && _e !== void 0 ? _e : []),
3596
- };
3597
- }
3598
- else if (fieldName === 'extensionASTNodes' && config.extensionASTNodes != null) {
3599
- config.extensionASTNodes = config.extensionASTNodes.concat((_f = resolverValue === null || resolverValue === void 0 ? void 0 : resolverValue.extensionASTNodes) !== null && _f !== void 0 ? _f : []);
3600
- }
3601
- else if (fieldName === 'extensions' &&
3602
- config.extensions != null &&
3603
- resolverValue.extensions != null) {
3604
- config.extensions = Object.assign(Object.create(null), type.extensions, resolverValue.extensions);
3605
- }
3606
- else if (enumValueConfigMap[fieldName]) {
3607
- enumValueConfigMap[fieldName].value = resolverValue[fieldName];
3608
- }
3609
- }
3610
- return new graphql_1.GraphQLEnumType(config);
3611
- }
3612
- },
3613
- [utils_1.MapperKind.UNION_TYPE]: type => {
3614
- const resolverValue = resolvers[type.name];
3615
- if (resolverValue != null) {
3616
- const config = type.toConfig();
3617
- if (resolverValue['__resolveType']) {
3618
- config.resolveType = resolverValue['__resolveType'];
3619
- }
3620
- return new graphql_1.GraphQLUnionType(config);
3621
- }
3622
- },
3623
- [utils_1.MapperKind.OBJECT_TYPE]: type => {
3624
- const resolverValue = resolvers[type.name];
3625
- if (resolverValue != null) {
3626
- const config = type.toConfig();
3627
- if (resolverValue['__isTypeOf']) {
3628
- config.isTypeOf = resolverValue['__isTypeOf'];
3629
- }
3630
- return new graphql_1.GraphQLObjectType(config);
3631
- }
3632
- },
3633
- [utils_1.MapperKind.INTERFACE_TYPE]: type => {
3634
- const resolverValue = resolvers[type.name];
3635
- if (resolverValue != null) {
3636
- const config = type.toConfig();
3637
- if (resolverValue['__resolveType']) {
3638
- config.resolveType = resolverValue['__resolveType'];
3639
- }
3640
- return new graphql_1.GraphQLInterfaceType(config);
3641
- }
3642
- },
3643
- [utils_1.MapperKind.COMPOSITE_FIELD]: (fieldConfig, fieldName, typeName) => {
3644
- const resolverValue = resolvers[typeName];
3645
- if (resolverValue != null) {
3646
- const fieldResolve = resolverValue[fieldName];
3647
- if (fieldResolve != null) {
3648
- const newFieldConfig = { ...fieldConfig };
3649
- if (typeof fieldResolve === 'function') {
3650
- // for convenience. Allows shorter syntax in resolver definition file
3651
- newFieldConfig.resolve = fieldResolve.bind(resolverValue);
3652
- }
3653
- else {
3654
- setFieldProperties(newFieldConfig, fieldResolve);
3655
- }
3656
- return newFieldConfig;
3657
- }
3658
- }
3659
- },
3660
- });
3661
- if (defaultFieldResolver != null) {
3662
- schema = (0, utils_1.mapSchema)(schema, {
3663
- [utils_1.MapperKind.OBJECT_FIELD]: fieldConfig => ({
3664
- ...fieldConfig,
3665
- resolve: fieldConfig.resolve != null ? fieldConfig.resolve : defaultFieldResolver,
3666
- }),
3667
- });
3668
- }
3669
- return schema;
3670
- }
3671
- function setFieldProperties(field, propertiesObj) {
3672
- for (const propertyName in propertiesObj) {
3673
- field[propertyName] = propertiesObj[propertyName];
3674
- }
3675
- }
3676
-
3677
-
3678
- /***/ }),
3679
-
3680
- /***/ 4996:
3681
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3682
-
3683
-
3684
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3685
- exports.assertResolversPresent = void 0;
3686
- const graphql_1 = __webpack_require__(7343);
3687
- const utils_1 = __webpack_require__(1718);
3688
- function assertResolversPresent(schema, resolverValidationOptions = {}) {
3689
- const { requireResolversForArgs, requireResolversForNonScalar, requireResolversForAllFields } = resolverValidationOptions;
3690
- if (requireResolversForAllFields && (requireResolversForArgs || requireResolversForNonScalar)) {
3691
- throw new TypeError('requireResolversForAllFields takes precedence over the more specific assertions. ' +
3692
- 'Please configure either requireResolversForAllFields or requireResolversForArgs / ' +
3693
- 'requireResolversForNonScalar, but not a combination of them.');
3694
- }
3695
- (0, utils_1.forEachField)(schema, (field, typeName, fieldName) => {
3696
- // requires a resolver for *every* field.
3697
- if (requireResolversForAllFields) {
3698
- expectResolver('requireResolversForAllFields', requireResolversForAllFields, field, typeName, fieldName);
3699
- }
3700
- // requires a resolver on every field that has arguments
3701
- if (requireResolversForArgs && field.args.length > 0) {
3702
- expectResolver('requireResolversForArgs', requireResolversForArgs, field, typeName, fieldName);
3703
- }
3704
- // requires a resolver on every field that returns a non-scalar type
3705
- if (requireResolversForNonScalar !== 'ignore' && !(0, graphql_1.isScalarType)((0, graphql_1.getNamedType)(field.type))) {
3706
- expectResolver('requireResolversForNonScalar', requireResolversForNonScalar, field, typeName, fieldName);
3707
- }
3708
- });
3709
- }
3710
- exports.assertResolversPresent = assertResolversPresent;
3711
- function expectResolver(validator, behavior, field, typeName, fieldName) {
3712
- if (!field.resolve) {
3713
- const message = `Resolver missing for "${typeName}.${fieldName}".
3714
- To disable this validator, use:
3715
- resolverValidationOptions: {
3716
- ${validator}: 'ignore'
3717
- }`;
3718
- if (behavior === 'error') {
3719
- throw new Error(message);
3720
- }
3721
- if (behavior === 'warn') {
3722
- console.warn(message);
3723
- }
3724
- return;
3725
- }
3726
- if (typeof field.resolve !== 'function') {
3727
- throw new Error(`Resolver "${typeName}.${fieldName}" must be a function`);
3728
- }
3729
- }
3730
-
3731
-
3732
- /***/ }),
3733
-
3734
- /***/ 4020:
3735
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3736
-
3737
-
3738
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3739
- exports.chainResolvers = void 0;
3740
- const graphql_1 = __webpack_require__(7343);
3741
- function chainResolvers(resolvers) {
3742
- return (root, args, ctx, info) => resolvers.reduce((prev, curResolver) => {
3743
- if (curResolver != null) {
3744
- return curResolver(prev, args, ctx, info);
3745
- }
3746
- return (0, graphql_1.defaultFieldResolver)(prev, args, ctx, info);
3747
- }, root);
3748
- }
3749
- exports.chainResolvers = chainResolvers;
3750
-
3751
-
3752
- /***/ }),
3753
-
3754
- /***/ 9435:
3755
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3756
-
3757
-
3758
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3759
- exports.checkForResolveTypeResolver = void 0;
3760
- const utils_1 = __webpack_require__(1718);
3761
- // If we have any union or interface types throw if no there is no resolveType resolver
3762
- function checkForResolveTypeResolver(schema, requireResolversForResolveType) {
3763
- (0, utils_1.mapSchema)(schema, {
3764
- [utils_1.MapperKind.ABSTRACT_TYPE]: type => {
3765
- if (!type.resolveType) {
3766
- const message = `Type "${type.name}" is missing a "__resolveType" resolver. Pass 'ignore' into ` +
3767
- '"resolverValidationOptions.requireResolversForResolveType" to disable this error.';
3768
- if (requireResolversForResolveType === 'error') {
3769
- throw new Error(message);
3770
- }
3771
- if (requireResolversForResolveType === 'warn') {
3772
- console.warn(message);
3773
- }
3774
- }
3775
- return undefined;
3776
- },
3777
- });
3778
- }
3779
- exports.checkForResolveTypeResolver = checkForResolveTypeResolver;
3780
-
3781
-
3782
- /***/ }),
3783
-
3784
- /***/ 9630:
3785
- /***/ ((__unused_webpack_module, exports) => {
3786
-
3787
-
3788
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3789
- exports.extendResolversFromInterfaces = void 0;
3790
- function extendResolversFromInterfaces(schema, resolvers) {
3791
- const extendedResolvers = {};
3792
- const typeMap = schema.getTypeMap();
3793
- for (const typeName in typeMap) {
3794
- const type = typeMap[typeName];
3795
- if ('getInterfaces' in type) {
3796
- extendedResolvers[typeName] = {};
3797
- for (const iFace of type.getInterfaces()) {
3798
- if (resolvers[iFace.name]) {
3799
- for (const fieldName in resolvers[iFace.name]) {
3800
- if (fieldName === '__isTypeOf' || !fieldName.startsWith('__')) {
3801
- extendedResolvers[typeName][fieldName] = resolvers[iFace.name][fieldName];
3802
- }
3803
- }
3804
- }
3805
- }
3806
- const typeResolvers = resolvers[typeName];
3807
- extendedResolvers[typeName] = {
3808
- ...extendedResolvers[typeName],
3809
- ...typeResolvers,
3810
- };
3811
- }
3812
- else {
3813
- const typeResolvers = resolvers[typeName];
3814
- if (typeResolvers != null) {
3815
- extendedResolvers[typeName] = typeResolvers;
3816
- }
3817
- }
3818
- }
3819
- return extendedResolvers;
3820
- }
3821
- exports.extendResolversFromInterfaces = extendResolversFromInterfaces;
3822
-
3823
-
3824
- /***/ }),
3825
-
3826
- /***/ 2547:
3827
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3828
-
3829
-
3830
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3831
- exports.extractExtensionsFromSchema = exports.extendResolversFromInterfaces = exports.checkForResolveTypeResolver = exports.addResolversToSchema = exports.chainResolvers = exports.assertResolversPresent = void 0;
3832
- const tslib_1 = __webpack_require__(752);
3833
- var assertResolversPresent_js_1 = __webpack_require__(4996);
3834
- Object.defineProperty(exports, "assertResolversPresent", ({ enumerable: true, get: function () { return assertResolversPresent_js_1.assertResolversPresent; } }));
3835
- var chainResolvers_js_1 = __webpack_require__(4020);
3836
- Object.defineProperty(exports, "chainResolvers", ({ enumerable: true, get: function () { return chainResolvers_js_1.chainResolvers; } }));
3837
- var addResolversToSchema_js_1 = __webpack_require__(7715);
3838
- Object.defineProperty(exports, "addResolversToSchema", ({ enumerable: true, get: function () { return addResolversToSchema_js_1.addResolversToSchema; } }));
3839
- var checkForResolveTypeResolver_js_1 = __webpack_require__(9435);
3840
- Object.defineProperty(exports, "checkForResolveTypeResolver", ({ enumerable: true, get: function () { return checkForResolveTypeResolver_js_1.checkForResolveTypeResolver; } }));
3841
- var extendResolversFromInterfaces_js_1 = __webpack_require__(9630);
3842
- Object.defineProperty(exports, "extendResolversFromInterfaces", ({ enumerable: true, get: function () { return extendResolversFromInterfaces_js_1.extendResolversFromInterfaces; } }));
3843
- tslib_1.__exportStar(__webpack_require__(4552), exports);
3844
- tslib_1.__exportStar(__webpack_require__(1074), exports);
3845
- tslib_1.__exportStar(__webpack_require__(9036), exports);
3846
- var utils_1 = __webpack_require__(1718);
3847
- Object.defineProperty(exports, "extractExtensionsFromSchema", ({ enumerable: true, get: function () { return utils_1.extractExtensionsFromSchema; } }));
3848
-
3849
-
3850
- /***/ }),
3851
-
3852
- /***/ 4552:
3853
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3854
-
3855
-
3856
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3857
- exports.makeExecutableSchema = void 0;
3858
- const graphql_1 = __webpack_require__(7343);
3859
- const utils_1 = __webpack_require__(1718);
3860
- const addResolversToSchema_js_1 = __webpack_require__(7715);
3861
- const assertResolversPresent_js_1 = __webpack_require__(4996);
3862
- const merge_1 = __webpack_require__(7331);
3863
- /**
3864
- * Builds a schema from the provided type definitions and resolvers.
3865
- *
3866
- * The type definitions are written using Schema Definition Language (SDL). They
3867
- * can be provided as a string, a `DocumentNode`, a function, or an array of any
3868
- * of these. If a function is provided, it will be passed no arguments and
3869
- * should return an array of strings or `DocumentNode`s.
3870
- *
3871
- * Note: You can use GraphQL magic comment provide additional syntax
3872
- * highlighting in your editor (with the appropriate editor plugin).
3873
- *
3874
- * ```js
3875
- * const typeDefs = /* GraphQL *\/ `
3876
- * type Query {
3877
- * posts: [Post]
3878
- * author(id: Int!): Author
3879
- * }
3880
- * `;
3881
- * ```
3882
- *
3883
- * The `resolvers` object should be a map of type names to nested object, which
3884
- * themselves map the type's fields to their appropriate resolvers.
3885
- * See the [Resolvers](/docs/resolvers) section of the documentation for more details.
3886
- *
3887
- * ```js
3888
- * const resolvers = {
3889
- * Query: {
3890
- * posts: (obj, args, ctx, info) => getAllPosts(),
3891
- * author: (obj, args, ctx, info) => getAuthorById(args.id)
3892
- * }
3893
- * };
3894
- * ```
3895
- *
3896
- * Once you've defined both the `typeDefs` and `resolvers`, you can create your
3897
- * schema:
3898
- *
3899
- * ```js
3900
- * const schema = makeExecutableSchema({
3901
- * typeDefs,
3902
- * resolvers,
3903
- * })
3904
- * ```
3905
- */
3906
- function makeExecutableSchema({ typeDefs, resolvers = {}, resolverValidationOptions = {}, inheritResolversFromInterfaces = false, updateResolversInPlace = false, schemaExtensions, ...otherOptions }) {
3907
- // Validate and clean up arguments
3908
- if (typeof resolverValidationOptions !== 'object') {
3909
- throw new Error('Expected `resolverValidationOptions` to be an object');
3910
- }
3911
- if (!typeDefs) {
3912
- throw new Error('Must provide typeDefs');
3913
- }
3914
- let schema;
3915
- if ((0, graphql_1.isSchema)(typeDefs)) {
3916
- schema = typeDefs;
3917
- }
3918
- else if (otherOptions === null || otherOptions === void 0 ? void 0 : otherOptions.commentDescriptions) {
3919
- const mergedTypeDefs = (0, merge_1.mergeTypeDefs)(typeDefs, {
3920
- ...otherOptions,
3921
- commentDescriptions: true,
3922
- });
3923
- schema = (0, graphql_1.buildSchema)(mergedTypeDefs, otherOptions);
3924
- }
3925
- else {
3926
- const mergedTypeDefs = (0, merge_1.mergeTypeDefs)(typeDefs, otherOptions);
3927
- schema = (0, graphql_1.buildASTSchema)(mergedTypeDefs, otherOptions);
3928
- }
3929
- // We allow passing in an array of resolver maps, in which case we merge them
3930
- schema = (0, addResolversToSchema_js_1.addResolversToSchema)({
3931
- schema,
3932
- resolvers: (0, merge_1.mergeResolvers)(resolvers),
3933
- resolverValidationOptions,
3934
- inheritResolversFromInterfaces,
3935
- updateResolversInPlace,
3936
- });
3937
- if (Object.keys(resolverValidationOptions).length > 0) {
3938
- (0, assertResolversPresent_js_1.assertResolversPresent)(schema, resolverValidationOptions);
3939
- }
3940
- if (schemaExtensions) {
3941
- schemaExtensions = (0, merge_1.mergeExtensions)((0, utils_1.asArray)(schemaExtensions));
3942
- (0, merge_1.applyExtensions)(schema, schemaExtensions);
3943
- }
3944
- return schema;
3945
- }
3946
- exports.makeExecutableSchema = makeExecutableSchema;
3947
-
3948
-
3949
- /***/ }),
3950
-
3951
- /***/ 9036:
3952
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3953
-
3954
-
3955
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3956
- exports.mergeSchemas = void 0;
3957
- const utils_1 = __webpack_require__(1718);
3958
- const makeExecutableSchema_js_1 = __webpack_require__(4552);
3959
- /**
3960
- * Synchronously merges multiple schemas, typeDefinitions and/or resolvers into a single schema.
3961
- * @param config Configuration object
3962
- */
3963
- function mergeSchemas(config) {
3964
- const extractedTypeDefs = [];
3965
- const extractedResolvers = [];
3966
- const extractedSchemaExtensions = [];
3967
- if (config.schemas != null) {
3968
- for (const schema of config.schemas) {
3969
- extractedTypeDefs.push(schema);
3970
- extractedResolvers.push((0, utils_1.getResolversFromSchema)(schema));
3971
- extractedSchemaExtensions.push((0, utils_1.extractExtensionsFromSchema)(schema));
3972
- }
3973
- }
3974
- if (config.typeDefs != null) {
3975
- extractedTypeDefs.push(config.typeDefs);
3976
- }
3977
- if (config.resolvers != null) {
3978
- const additionalResolvers = (0, utils_1.asArray)(config.resolvers);
3979
- extractedResolvers.push(...additionalResolvers);
3980
- }
3981
- if (config.schemaExtensions != null) {
3982
- const additionalSchemaExtensions = (0, utils_1.asArray)(config.schemaExtensions);
3983
- extractedSchemaExtensions.push(...additionalSchemaExtensions);
3984
- }
3985
- return (0, makeExecutableSchema_js_1.makeExecutableSchema)({
3986
- ...config,
3987
- typeDefs: extractedTypeDefs,
3988
- resolvers: extractedResolvers,
3989
- schemaExtensions: extractedSchemaExtensions,
3990
- });
3991
- }
3992
- exports.mergeSchemas = mergeSchemas;
3993
-
3994
-
3995
- /***/ }),
3996
-
3997
- /***/ 1074:
3998
- /***/ ((__unused_webpack_module, exports) => {
3999
-
4000
-
4001
- Object.defineProperty(exports, "__esModule", ({ value: true }));
4002
-
4003
-
4004
- /***/ })
4005
-
4006
- };
4007
- ;