@graphql-mesh/utils 1.0.0-alpha-3fc47d119.0 → 1.0.0-alpha-20230420181317-a95037648

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 (85) hide show
  1. package/cjs/apply-transforms.js +35 -0
  2. package/cjs/defaultImportFn.js +57 -0
  3. package/cjs/extract-resolvers.js +23 -0
  4. package/cjs/fileURLToPath.js +50 -0
  5. package/cjs/fs-operations.js +65 -0
  6. package/cjs/getHeadersObj.js +61 -0
  7. package/cjs/global-lru-cache.js +9 -0
  8. package/cjs/group-transforms.js +17 -0
  9. package/cjs/index.js +20 -0
  10. package/cjs/load-from-module-export-expression.js +29 -0
  11. package/cjs/logger.js +127 -0
  12. package/cjs/package.json +1 -0
  13. package/cjs/parseAndPrintWithCache.js +42 -0
  14. package/cjs/pubsub.js +57 -0
  15. package/cjs/read-file-or-url.js +132 -0
  16. package/cjs/resolve-additional-resolvers.js +350 -0
  17. package/cjs/sanitize-name-for-graphql.js +96 -0
  18. package/cjs/with-cancel.js +34 -0
  19. package/cjs/with-cookies.js +18 -0
  20. package/cjs/with-filter.js +53 -0
  21. package/esm/apply-transforms.js +29 -0
  22. package/esm/defaultImportFn.js +32 -0
  23. package/esm/extract-resolvers.js +19 -0
  24. package/esm/fileURLToPath.js +46 -0
  25. package/esm/fs-operations.js +57 -0
  26. package/esm/getHeadersObj.js +57 -0
  27. package/esm/global-lru-cache.js +4 -0
  28. package/esm/group-transforms.js +13 -0
  29. package/esm/index.js +17 -0
  30. package/esm/load-from-module-export-expression.js +25 -0
  31. package/esm/logger.js +118 -0
  32. package/esm/parseAndPrintWithCache.js +37 -0
  33. package/esm/pubsub.js +53 -0
  34. package/esm/read-file-or-url.js +124 -0
  35. package/esm/resolve-additional-resolvers.js +344 -0
  36. package/esm/sanitize-name-for-graphql.js +91 -0
  37. package/esm/with-cancel.js +30 -0
  38. package/esm/with-cookies.js +14 -0
  39. package/esm/with-filter.js +49 -0
  40. package/package.json +28 -23
  41. package/typings/apply-transforms.d.cts +6 -0
  42. package/{apply-transforms.d.ts → typings/apply-transforms.d.ts} +3 -3
  43. package/typings/defaultImportFn.d.cts +2 -0
  44. package/typings/defaultImportFn.d.ts +2 -0
  45. package/typings/extract-resolvers.d.ts +2 -0
  46. package/typings/fileURLToPath.d.ts +1 -0
  47. package/typings/fs-operations.d.ts +7 -0
  48. package/typings/getHeadersObj.d.cts +1 -0
  49. package/typings/getHeadersObj.d.ts +1 -0
  50. package/typings/global-lru-cache.d.cts +3 -0
  51. package/{global-lru-cache.d.ts → typings/global-lru-cache.d.ts} +2 -2
  52. package/typings/group-transforms.d.ts +5 -0
  53. package/typings/index.d.cts +17 -0
  54. package/typings/index.d.ts +17 -0
  55. package/typings/load-from-module-export-expression.d.cts +8 -0
  56. package/{load-from-module-export-expression.d.ts → typings/load-from-module-export-expression.d.ts} +1 -1
  57. package/typings/logger.d.cts +22 -0
  58. package/{logger.d.ts → typings/logger.d.ts} +1 -1
  59. package/typings/parseAndPrintWithCache.d.ts +4 -0
  60. package/typings/pubsub.d.cts +13 -0
  61. package/{pubsub.d.ts → typings/pubsub.d.ts} +3 -2
  62. package/typings/read-file-or-url.d.cts +14 -0
  63. package/{read-file-or-url.d.ts → typings/read-file-or-url.d.ts} +3 -3
  64. package/typings/resolve-additional-resolvers.d.cts +4 -0
  65. package/{resolve-additional-resolvers.d.ts → typings/resolve-additional-resolvers.d.ts} +1 -1
  66. package/typings/sanitize-name-for-graphql.d.cts +2 -0
  67. package/{sanitize-name-for-graphql.d.ts → typings/sanitize-name-for-graphql.d.ts} +1 -0
  68. package/typings/with-cancel.d.cts +1 -0
  69. package/typings/with-cancel.d.ts +1 -0
  70. package/typings/with-cookies.d.cts +3 -0
  71. package/typings/with-cookies.d.ts +3 -0
  72. package/typings/with-filter.d.cts +4 -0
  73. package/typings/with-filter.d.ts +4 -0
  74. package/defaultImportFn.d.ts +0 -1
  75. package/getHeadersObj.d.ts +0 -1
  76. package/index.d.ts +0 -16
  77. package/index.js +0 -1112
  78. package/index.mjs +0 -1054
  79. package/with-cancel.d.ts +0 -1
  80. package/with-filter.d.ts +0 -4
  81. /package/{extract-resolvers.d.ts → typings/extract-resolvers.d.cts} +0 -0
  82. /package/{fileURLToPath.d.ts → typings/fileURLToPath.d.cts} +0 -0
  83. /package/{fs-operations.d.ts → typings/fs-operations.d.cts} +0 -0
  84. /package/{group-transforms.d.ts → typings/group-transforms.d.cts} +0 -0
  85. /package/{parseAndPrintWithCache.d.ts → typings/parseAndPrintWithCache.d.cts} +0 -0
package/index.js DELETED
@@ -1,1112 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) { return e; } else {
9
- var n = {};
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- var d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: function () {
16
- return e[k];
17
- }
18
- });
19
- });
20
- }
21
- n['default'] = e;
22
- return n;
23
- }
24
- }
25
-
26
- const jsYaml = require('js-yaml');
27
- const crossHelpers = require('@graphql-mesh/cross-helpers');
28
- const utils = require('@graphql-tools/utils');
29
- const lru = _interopDefault(require('tiny-lru'));
30
- const graphql = require('graphql');
31
- const lodashGet = _interopDefault(require('lodash.get'));
32
- const lodashSet = _interopDefault(require('lodash.set'));
33
- const toPath = _interopDefault(require('lodash.topath'));
34
- const stringInterpolation = require('@graphql-mesh/string-interpolation');
35
-
36
- async function defaultImportFn(path) {
37
- let module = await new Promise(function (resolve) { resolve(_interopNamespace(require(/* @vite-ignore */ path))); }).catch(e => {
38
- if (e.message.includes('Must use import to load ES Module')) {
39
- // eslint-disable-next-line no-new-func
40
- return new Function(`return import(${JSON.stringify(path)})`)();
41
- }
42
- throw e;
43
- });
44
- if (module.default != null) {
45
- module = module.default;
46
- }
47
- if (typeof module === 'object' && module != null) {
48
- const prototypeOfObject = Object.getPrototypeOf(module);
49
- if (prototypeOfObject == null || prototypeOfObject === Object.prototype) {
50
- const normalizedVal = {};
51
- for (const key in module) {
52
- normalizedVal[key] = module[key];
53
- }
54
- return normalizedVal;
55
- }
56
- }
57
- return module;
58
- }
59
-
60
- /* eslint-disable @typescript-eslint/return-await */
61
- async function loadFromModuleExportExpression(expression, options) {
62
- if (typeof expression !== 'string') {
63
- return Promise.resolve(expression);
64
- }
65
- const { defaultExportName, cwd, importFn = defaultImportFn } = options || {};
66
- const [modulePath, exportName = defaultExportName] = expression.split('#');
67
- const mod = await tryImport(modulePath, cwd, importFn);
68
- return mod[exportName] || (mod.default && mod.default[exportName]) || mod.default || mod;
69
- }
70
- async function tryImport(modulePath, cwd, importFn) {
71
- try {
72
- return await importFn(modulePath);
73
- }
74
- catch (_a) {
75
- if (!crossHelpers.path.isAbsolute(modulePath)) {
76
- const absoluteModulePath = crossHelpers.path.isAbsolute(modulePath) ? modulePath : crossHelpers.path.join(cwd, modulePath);
77
- return importFn(absoluteModulePath);
78
- }
79
- }
80
- }
81
-
82
- function isUrl(str) {
83
- try {
84
- // eslint-disable-next-line no-new
85
- new URL(str);
86
- return true;
87
- }
88
- catch (_a) {
89
- return false;
90
- }
91
- }
92
- async function readFileOrUrl(filePathOrUrl, config) {
93
- if (isUrl(filePathOrUrl)) {
94
- config.logger.debug(`Fetching ${filePathOrUrl} via HTTP`);
95
- return readUrl(filePathOrUrl, config);
96
- }
97
- else if (filePathOrUrl.startsWith('{') || filePathOrUrl.startsWith('[')) {
98
- return JSON.parse(filePathOrUrl);
99
- }
100
- else {
101
- config.logger.debug(`Reading ${filePathOrUrl} from the file system`);
102
- return readFile(filePathOrUrl, config);
103
- }
104
- }
105
- function getSchema(filepath, logger) {
106
- return jsYaml.DEFAULT_SCHEMA.extend([
107
- new jsYaml.Type('!include', {
108
- kind: 'scalar',
109
- resolve(path) {
110
- return typeof path === 'string';
111
- },
112
- construct(path) {
113
- const newCwd = crossHelpers.path.dirname(filepath);
114
- const absoluteFilePath = crossHelpers.path.isAbsolute(path) ? path : crossHelpers.path.resolve(newCwd, path);
115
- const content = crossHelpers.fs.readFileSync(absoluteFilePath, 'utf8');
116
- return loadYaml(absoluteFilePath, content, logger);
117
- },
118
- }),
119
- new jsYaml.Type('!includes', {
120
- kind: 'scalar',
121
- resolve(path) {
122
- return typeof path === 'string';
123
- },
124
- construct(path) {
125
- const newCwd = crossHelpers.path.dirname(filepath);
126
- const absoluteDirPath = crossHelpers.path.isAbsolute(path) ? path : crossHelpers.path.resolve(newCwd, path);
127
- const files = crossHelpers.fs.readdirSync(absoluteDirPath);
128
- return files.map(filePath => {
129
- const absoluteFilePath = crossHelpers.path.resolve(absoluteDirPath, filePath);
130
- const fileContent = crossHelpers.fs.readFileSync(absoluteFilePath, 'utf8');
131
- return loadYaml(absoluteFilePath, fileContent, logger);
132
- });
133
- },
134
- }),
135
- ]);
136
- }
137
- function loadYaml(filepath, content, logger) {
138
- return jsYaml.load(content, {
139
- filename: filepath,
140
- schema: getSchema(filepath, logger),
141
- onWarning(warning) {
142
- logger.warn(`${filepath}: ${warning.message}\n${warning.stack}`);
143
- },
144
- });
145
- }
146
- async function readFile(fileExpression, { allowUnknownExtensions, cwd, fallbackFormat, importFn, logger }) {
147
- const [filePath] = fileExpression.split('#');
148
- if (/js$/.test(filePath) || /ts$/.test(filePath)) {
149
- return loadFromModuleExportExpression(fileExpression, {
150
- cwd,
151
- importFn,
152
- defaultExportName: 'default',
153
- });
154
- }
155
- const actualPath = crossHelpers.path.isAbsolute(filePath) ? filePath : crossHelpers.path.join(cwd, filePath);
156
- const rawResult = await crossHelpers.fs.promises.readFile(actualPath, 'utf-8');
157
- if (/json$/.test(actualPath)) {
158
- return JSON.parse(rawResult);
159
- }
160
- if (/yaml$/.test(actualPath) || /yml$/.test(actualPath)) {
161
- return loadYaml(actualPath, rawResult, logger);
162
- }
163
- else if (fallbackFormat) {
164
- switch (fallbackFormat) {
165
- case 'json':
166
- return JSON.parse(rawResult);
167
- case 'yaml':
168
- return loadYaml(actualPath, rawResult, logger);
169
- case 'ts':
170
- case 'js':
171
- return importFn(actualPath);
172
- }
173
- }
174
- else if (!allowUnknownExtensions) {
175
- throw new Error(`Failed to parse JSON/YAML. Ensure file '${filePath}' has ` +
176
- `the correct extension (i.e. '.json', '.yaml', or '.yml).`);
177
- }
178
- return rawResult;
179
- }
180
- async function readUrl(path, config) {
181
- var _a, _b;
182
- const { allowUnknownExtensions, fallbackFormat } = config || {};
183
- config.headers = config.headers || {};
184
- const response = await config.fetch(path, config);
185
- const contentType = ((_a = response.headers) === null || _a === void 0 ? void 0 : _a.get('content-type')) || '';
186
- const responseText = await response.text();
187
- (_b = config === null || config === void 0 ? void 0 : config.logger) === null || _b === void 0 ? void 0 : _b.debug(`${path} returned `, responseText);
188
- if (/json$/.test(path) || contentType.startsWith('application/json') || fallbackFormat === 'json') {
189
- return JSON.parse(responseText);
190
- }
191
- else if (/yaml$/.test(path) ||
192
- /yml$/.test(path) ||
193
- contentType.includes('yaml') ||
194
- contentType.includes('yml') ||
195
- fallbackFormat === 'yaml') {
196
- return loadYaml(path, responseText, config === null || config === void 0 ? void 0 : config.logger);
197
- }
198
- else if (!allowUnknownExtensions) {
199
- throw new Error(`Failed to parse JSON/YAML. Ensure URL '${path}' has ` +
200
- `the correct extension (i.e. '.json', '.yaml', or '.yml) or mime type in the response headers.`);
201
- }
202
- return responseText;
203
- }
204
-
205
- function withCancel(asyncIterable, onCancel) {
206
- return new Proxy(asyncIterable, {
207
- get(asyncIterable, prop) {
208
- var _a;
209
- if (prop === Symbol.asyncIterator) {
210
- return function getIteratorWithCancel() {
211
- const asyncIterator = asyncIterable[Symbol.asyncIterator]();
212
- return {
213
- next: asyncIterator.next ? (...args) => asyncIterator.next(...args) : undefined,
214
- return: async (...args) => {
215
- onCancel();
216
- if (asyncIterator.return) {
217
- return asyncIterator.return(...args);
218
- }
219
- return {
220
- value: undefined,
221
- done: true,
222
- };
223
- },
224
- throw: asyncIterator.throw ? (...args) => asyncIterator.throw(...args) : undefined,
225
- };
226
- };
227
- }
228
- return (_a = asyncIterable[prop]) === null || _a === void 0 ? void 0 : _a.bind(asyncIterable);
229
- },
230
- });
231
- }
232
-
233
- function extractResolvers(schema) {
234
- const allResolvers = utils.getResolversFromSchema(schema);
235
- const filteredResolvers = {};
236
- for (const prop in allResolvers) {
237
- if (!prop.startsWith('_')) {
238
- filteredResolvers[prop] = allResolvers[prop];
239
- }
240
- if (typeof filteredResolvers === 'object') {
241
- for (const fieldName in filteredResolvers[prop]) {
242
- if (!prop.startsWith('_resolveType')) {
243
- filteredResolvers[prop][fieldName] = allResolvers[prop][fieldName];
244
- }
245
- }
246
- }
247
- }
248
- return filteredResolvers;
249
- }
250
-
251
- function groupTransforms(transforms) {
252
- const wrapTransforms = [];
253
- const noWrapTransforms = [];
254
- transforms === null || transforms === void 0 ? void 0 : transforms.forEach(transform => {
255
- if (transform.noWrap) {
256
- noWrapTransforms.push(transform);
257
- }
258
- else {
259
- wrapTransforms.push(transform);
260
- }
261
- });
262
- return { wrapTransforms, noWrapTransforms };
263
- }
264
-
265
- function applySchemaTransforms(originalWrappingSchema, subschemaConfig, transformedSchema, transforms) {
266
- if (transforms === null || transforms === void 0 ? void 0 : transforms.length) {
267
- return transforms.reduce((schema, transform) => 'transformSchema' in transform ? transform.transformSchema(schema, subschemaConfig, transformedSchema) : schema, originalWrappingSchema);
268
- }
269
- return originalWrappingSchema;
270
- }
271
- function applyRequestTransforms(originalRequest, delegationContext, transformationContext, transforms) {
272
- transformationContext.contextMap = transformationContext.contextMap || new WeakMap();
273
- const contextMap = transformationContext.contextMap;
274
- transforms === null || transforms === void 0 ? void 0 : transforms.forEach(transform => {
275
- if (!contextMap.has(transform)) {
276
- contextMap.set(transform, {
277
- nextIndex: 0,
278
- paths: {},
279
- });
280
- }
281
- });
282
- return transforms.reduceRight((request, transform) => 'transformRequest' in transform
283
- ? transform.transformRequest(request, delegationContext, contextMap.get(transform))
284
- : request, originalRequest);
285
- }
286
- function applyResultTransforms(originalResult, delegationContext, transformationContext, transforms) {
287
- const contextMap = transformationContext.contextMap;
288
- return transforms.reduce((result, transform) => 'transformResult' in transform
289
- ? transform.transformResult(result, delegationContext, contextMap.get(transform))
290
- : result, originalResult);
291
- }
292
-
293
- async function pathExists(path) {
294
- if (!path) {
295
- return false;
296
- }
297
- try {
298
- await crossHelpers.fs.promises.stat(path);
299
- return true;
300
- }
301
- catch (e) {
302
- if (e.toString().includes('ENOENT')) {
303
- return false;
304
- }
305
- else {
306
- throw e;
307
- }
308
- }
309
- }
310
- function writeJSON(path, data, replacer, space) {
311
- const stringified = JSON.stringify(data, replacer, space);
312
- return writeFile(path, stringified, 'utf-8');
313
- }
314
- const writeFile = async (path, ...args) => {
315
- if (typeof path === 'string') {
316
- const containingDir = crossHelpers.path.dirname(path);
317
- if (!(await pathExists(containingDir))) {
318
- await mkdir(containingDir);
319
- }
320
- }
321
- return crossHelpers.fs.promises.writeFile(path, ...args);
322
- };
323
- async function mkdir(path, options = { recursive: true }) {
324
- const ifExists = await pathExists(path);
325
- if (!ifExists) {
326
- await crossHelpers.fs.promises.mkdir(path, options);
327
- }
328
- }
329
- async function rmdirs(dir) {
330
- if (await pathExists(dir)) {
331
- const entries = await crossHelpers.fs.promises.readdir(dir, { withFileTypes: true });
332
- const results = await Promise.allSettled(entries.map(entry => {
333
- const fullPath = crossHelpers.path.join(dir, entry.name);
334
- if (entry.isDirectory()) {
335
- return rmdirs(fullPath);
336
- }
337
- else {
338
- return crossHelpers.fs.promises.unlink(fullPath);
339
- }
340
- }));
341
- for (const result of results) {
342
- if (result.status === 'rejected' && result.reason.code !== 'ENOENT') {
343
- throw result.reason;
344
- }
345
- }
346
- await crossHelpers.fs.promises.rmdir(dir);
347
- }
348
- }
349
-
350
- function createLruCache(max, ttl) {
351
- return lru(max, ttl);
352
- }
353
-
354
- const reservedNames = ['Query', 'Mutation', 'Subscription'];
355
- const KNOWN_CHARACTERS = {
356
- '+': 'PLUS',
357
- '-': 'MINUS',
358
- '>': 'GREATER_THAN',
359
- '<': 'LESS_THAN',
360
- '=': 'EQUALS',
361
- '&': 'AMPERSAND',
362
- '|': 'PIPE',
363
- '@': 'AT',
364
- '*': 'STAR',
365
- ':': 'COLON',
366
- '{': 'LEFT_CURLY_BRACE',
367
- '}': 'RIGHT_CURLY_BRACE',
368
- '[': 'LEFT_SQUARE_BRACE',
369
- ']': 'RIGHT_SQUARE_BRACE',
370
- ',': 'COMMA',
371
- '%': 'PERCENT',
372
- $: 'DOLLAR',
373
- '#': 'POUND',
374
- '^': 'CARET',
375
- '~': 'TILDE',
376
- '?': 'QUESTION_MARK',
377
- '!': 'EXCLAMATION_MARK',
378
- '"': 'QUOTATION_MARK',
379
- "'": 'SINGLE_QUOTE',
380
- '\\': 'BACKSLASH',
381
- '/': 'SLASH',
382
- '.': 'DOT',
383
- '`': 'BACKTICK',
384
- ';': 'SEMICOLON',
385
- '(': 'LEFT_PARENTHESIS',
386
- ')': 'RIGHT_PARENTHESIS',
387
- };
388
- function getKnownCharacterOrCharCode(ch) {
389
- return KNOWN_CHARACTERS[ch] || ch.charCodeAt(0).toString();
390
- }
391
- function sanitizeNameForGraphQL(unsafeName) {
392
- let sanitizedName = unsafeName.trim();
393
- if (!isNaN(parseInt(sanitizedName))) {
394
- if (sanitizedName.startsWith('-')) {
395
- sanitizedName = sanitizedName.replace('-', 'NEGATIVE_');
396
- }
397
- else {
398
- sanitizedName = '_' + sanitizedName;
399
- }
400
- }
401
- if (!/^[_a-zA-Z0-9]*$/.test(sanitizedName)) {
402
- const unsanitizedName = sanitizedName;
403
- sanitizedName = '';
404
- for (const ch of unsanitizedName) {
405
- if (/^[_a-zA-Z0-9]$/.test(ch)) {
406
- sanitizedName += ch;
407
- }
408
- else if (ch === ' ' || ch === '-' || ch === '.') {
409
- sanitizedName += '_';
410
- }
411
- else {
412
- sanitizedName += `_${getKnownCharacterOrCharCode(ch)}_`;
413
- }
414
- }
415
- }
416
- // Names cannot start with __
417
- if (sanitizedName.startsWith('__')) {
418
- sanitizedName = sanitizedName.replace('__', '_0');
419
- }
420
- if (reservedNames.includes(sanitizedName)) {
421
- sanitizedName += '_';
422
- }
423
- return sanitizedName;
424
- }
425
-
426
- function withFilter(asyncIteratorFn, filterFn) {
427
- return async (rootValue, args, context, info) => {
428
- const asyncIterator = await asyncIteratorFn(rootValue, args, context, info);
429
- const getNextPromise = () => {
430
- return new Promise((resolve, reject) => {
431
- const inner = () => {
432
- asyncIterator
433
- .next()
434
- .then(payload => {
435
- if (payload.done === true) {
436
- resolve(payload);
437
- return;
438
- }
439
- Promise.resolve(filterFn(payload.value, args, context, info))
440
- .catch(() => false) // We ignore errors from filter function
441
- .then(filterResult => {
442
- if (filterResult === true) {
443
- resolve(payload);
444
- return;
445
- }
446
- // Skip the current value and wait for the next one
447
- inner();
448
- })
449
- .catch(() => false); // We ignore errors from filter function;
450
- })
451
- .catch(err => {
452
- reject(err);
453
- });
454
- };
455
- inner();
456
- });
457
- };
458
- const asyncIterator2 = {
459
- next() {
460
- return getNextPromise();
461
- },
462
- return() {
463
- return asyncIterator.return();
464
- },
465
- throw(error) {
466
- return asyncIterator.throw(error);
467
- },
468
- [Symbol.asyncIterator]() {
469
- return this;
470
- },
471
- };
472
- return asyncIterator2;
473
- };
474
- }
475
-
476
- function getTypeByPath(type, path) {
477
- if ('ofType' in type) {
478
- return getTypeByPath(graphql.getNamedType(type), path);
479
- }
480
- if (path.length === 0) {
481
- return graphql.getNamedType(type);
482
- }
483
- if (!('getFields' in type)) {
484
- throw new Error(`${type} cannot have a path ${path.join('.')}`);
485
- }
486
- const fieldMap = type.getFields();
487
- const currentFieldName = path[0];
488
- // Might be an index of an array
489
- if (!Number.isNaN(parseInt(currentFieldName))) {
490
- return getTypeByPath(type, path.slice(1));
491
- }
492
- const field = fieldMap[currentFieldName];
493
- if (!(field === null || field === void 0 ? void 0 : field.type)) {
494
- throw new Error(`${type}.${currentFieldName} is not a valid field.`);
495
- }
496
- return getTypeByPath(field.type, path.slice(1));
497
- }
498
- function generateSelectionSetFactory(schema, additionalResolver) {
499
- if (additionalResolver.sourceSelectionSet) {
500
- return () => utils.parseSelectionSet(additionalResolver.sourceSelectionSet);
501
- // If result path provided without a selectionSet
502
- }
503
- else if (additionalResolver.result) {
504
- const resultPath = toPath(additionalResolver.result);
505
- let abstractResultTypeName;
506
- const sourceType = schema.getType(additionalResolver.sourceTypeName);
507
- const sourceTypeFields = sourceType.getFields();
508
- const sourceField = sourceTypeFields[additionalResolver.sourceFieldName];
509
- const resultFieldType = getTypeByPath(sourceField.type, resultPath);
510
- if (graphql.isAbstractType(resultFieldType)) {
511
- if (additionalResolver.resultType) {
512
- abstractResultTypeName = additionalResolver.resultType;
513
- }
514
- else {
515
- const targetType = schema.getType(additionalResolver.targetTypeName);
516
- const targetTypeFields = targetType.getFields();
517
- const targetField = targetTypeFields[additionalResolver.targetFieldName];
518
- const targetFieldType = graphql.getNamedType(targetField.type);
519
- abstractResultTypeName = targetFieldType === null || targetFieldType === void 0 ? void 0 : targetFieldType.name;
520
- }
521
- if (abstractResultTypeName !== resultFieldType.name) {
522
- const abstractResultType = schema.getType(abstractResultTypeName);
523
- if ((graphql.isInterfaceType(abstractResultType) || graphql.isObjectType(abstractResultType)) &&
524
- !schema.isSubType(resultFieldType, abstractResultType)) {
525
- throw new Error(`${additionalResolver.sourceTypeName}.${additionalResolver.sourceFieldName}.${resultPath.join('.')} doesn't implement ${abstractResultTypeName}.}`);
526
- }
527
- }
528
- }
529
- return (subtree) => {
530
- let finalSelectionSet = subtree;
531
- let isLastResult = true;
532
- const resultPathReversed = [...resultPath].reverse();
533
- for (const pathElem of resultPathReversed) {
534
- // Ensure the path elem is not array index
535
- if (Number.isNaN(parseInt(pathElem))) {
536
- if (isLastResult && abstractResultTypeName && abstractResultTypeName !== resultFieldType.name) {
537
- finalSelectionSet = {
538
- kind: graphql.Kind.SELECTION_SET,
539
- selections: [
540
- {
541
- kind: graphql.Kind.INLINE_FRAGMENT,
542
- typeCondition: {
543
- kind: graphql.Kind.NAMED_TYPE,
544
- name: {
545
- kind: graphql.Kind.NAME,
546
- value: abstractResultTypeName,
547
- },
548
- },
549
- selectionSet: finalSelectionSet,
550
- },
551
- ],
552
- };
553
- }
554
- finalSelectionSet = {
555
- kind: graphql.Kind.SELECTION_SET,
556
- selections: [
557
- {
558
- // we create a wrapping AST Field
559
- kind: graphql.Kind.FIELD,
560
- name: {
561
- kind: graphql.Kind.NAME,
562
- value: pathElem,
563
- },
564
- // Inside the field selection
565
- selectionSet: finalSelectionSet,
566
- },
567
- ],
568
- };
569
- isLastResult = false;
570
- }
571
- }
572
- return finalSelectionSet;
573
- };
574
- }
575
- return undefined;
576
- }
577
- function generateValuesFromResults(resultExpression) {
578
- return function valuesFromResults(result) {
579
- if (Array.isArray(result)) {
580
- return result.map(valuesFromResults);
581
- }
582
- return lodashGet(result, resultExpression);
583
- };
584
- }
585
- function resolveAdditionalResolversWithoutImport(additionalResolver, pubsub) {
586
- const baseOptions = {};
587
- if (additionalResolver.result) {
588
- baseOptions.valuesFromResults = generateValuesFromResults(additionalResolver.result);
589
- }
590
- if ('pubsubTopic' in additionalResolver) {
591
- return {
592
- [additionalResolver.targetTypeName]: {
593
- [additionalResolver.targetFieldName]: {
594
- subscribe: withFilter((root, args, context, info) => {
595
- const resolverData = { root, args, context, info, env: crossHelpers.process.env };
596
- const topic = stringInterpolation.stringInterpolator.parse(additionalResolver.pubsubTopic, resolverData);
597
- return pubsub.asyncIterator(topic);
598
- }, (root, args, context, info) => {
599
- // eslint-disable-next-line no-new-func
600
- return additionalResolver.filterBy ? new Function(`return ${additionalResolver.filterBy}`)() : true;
601
- }),
602
- resolve: (payload) => {
603
- if (baseOptions.valuesFromResults) {
604
- return baseOptions.valuesFromResults(payload);
605
- }
606
- return payload;
607
- },
608
- },
609
- },
610
- };
611
- }
612
- else if ('keysArg' in additionalResolver) {
613
- return {
614
- [additionalResolver.targetTypeName]: {
615
- [additionalResolver.targetFieldName]: {
616
- selectionSet: additionalResolver.requiredSelectionSet || `{ ${additionalResolver.keyField} }`,
617
- resolve: async (root, args, context, info) => {
618
- if (!baseOptions.selectionSet) {
619
- baseOptions.selectionSet = generateSelectionSetFactory(info.schema, additionalResolver);
620
- }
621
- const resolverData = { root, args, context, info, env: crossHelpers.process.env };
622
- const targetArgs = {};
623
- for (const argPath in additionalResolver.additionalArgs || {}) {
624
- lodashSet(targetArgs, argPath, stringInterpolation.stringInterpolator.parse(additionalResolver.additionalArgs[argPath], resolverData));
625
- }
626
- const options = {
627
- ...baseOptions,
628
- root,
629
- context,
630
- info,
631
- argsFromKeys: (keys) => {
632
- const args = {};
633
- lodashSet(args, additionalResolver.keysArg, keys);
634
- Object.assign(args, targetArgs);
635
- return args;
636
- },
637
- key: lodashGet(root, additionalResolver.keyField),
638
- };
639
- return context[additionalResolver.sourceName][additionalResolver.sourceTypeName][additionalResolver.sourceFieldName](options);
640
- },
641
- },
642
- },
643
- };
644
- }
645
- else if ('targetTypeName' in additionalResolver) {
646
- return {
647
- [additionalResolver.targetTypeName]: {
648
- [additionalResolver.targetFieldName]: {
649
- selectionSet: additionalResolver.requiredSelectionSet,
650
- resolve: (root, args, context, info) => {
651
- // Assert source exists
652
- if (!context[additionalResolver.sourceName]) {
653
- throw new Error(`No source found named "${additionalResolver.sourceName}"`);
654
- }
655
- if (!context[additionalResolver.sourceName][additionalResolver.sourceTypeName]) {
656
- throw new Error(`No root type found named "${additionalResolver.sourceTypeName}" exists in the source ${additionalResolver.sourceName}\n` +
657
- `It should be one of the following; ${Object.keys(context[additionalResolver.sourceName]).join(',')})}}`);
658
- }
659
- if (!context[additionalResolver.sourceName][additionalResolver.sourceTypeName][additionalResolver.sourceFieldName]) {
660
- throw new Error(`No field named "${additionalResolver.sourceFieldName}" exists in the type ${additionalResolver.sourceTypeName} from the source ${additionalResolver.sourceName}`);
661
- }
662
- if (!baseOptions.selectionSet) {
663
- baseOptions.selectionSet = generateSelectionSetFactory(info.schema, additionalResolver);
664
- }
665
- const resolverData = { root, args, context, info, env: crossHelpers.process.env };
666
- const targetArgs = {};
667
- for (const argPath in additionalResolver.sourceArgs) {
668
- lodashSet(targetArgs, argPath, stringInterpolation.stringInterpolator.parse(additionalResolver.sourceArgs[argPath].toString(), resolverData));
669
- }
670
- const options = {
671
- ...baseOptions,
672
- root,
673
- args: targetArgs,
674
- context,
675
- info,
676
- };
677
- return context[additionalResolver.sourceName][additionalResolver.sourceTypeName][additionalResolver.sourceFieldName](options);
678
- },
679
- },
680
- },
681
- };
682
- }
683
- else {
684
- return additionalResolver;
685
- }
686
- }
687
- function resolveAdditionalResolvers(baseDir, additionalResolvers, importFn, pubsub) {
688
- return Promise.all((additionalResolvers || []).map(async (additionalResolver) => {
689
- if (typeof additionalResolver === 'string') {
690
- const resolvers = await loadFromModuleExportExpression(additionalResolver, {
691
- cwd: baseDir,
692
- defaultExportName: 'resolvers',
693
- importFn,
694
- });
695
- if (!resolvers) {
696
- console.warn(`Unable to load resolvers from file: ${additionalResolver}`);
697
- return {};
698
- }
699
- return resolvers;
700
- }
701
- else {
702
- const baseOptions = {};
703
- if (additionalResolver.result) {
704
- baseOptions.valuesFromResults = generateValuesFromResults(additionalResolver.result);
705
- }
706
- if ('pubsubTopic' in additionalResolver) {
707
- return {
708
- [additionalResolver.targetTypeName]: {
709
- [additionalResolver.targetFieldName]: {
710
- subscribe: withFilter((root, args, context, info) => {
711
- const resolverData = { root, args, context, info, env: crossHelpers.process.env };
712
- const topic = stringInterpolation.stringInterpolator.parse(additionalResolver.pubsubTopic, resolverData);
713
- return pubsub.asyncIterator(topic);
714
- }, (root, args, context, info) => {
715
- // eslint-disable-next-line no-new-func
716
- return additionalResolver.filterBy ? new Function(`return ${additionalResolver.filterBy}`)() : true;
717
- }),
718
- resolve: (payload) => {
719
- if (baseOptions.valuesFromResults) {
720
- return baseOptions.valuesFromResults(payload);
721
- }
722
- return payload;
723
- },
724
- },
725
- },
726
- };
727
- }
728
- else if ('keysArg' in additionalResolver) {
729
- return {
730
- [additionalResolver.targetTypeName]: {
731
- [additionalResolver.targetFieldName]: {
732
- selectionSet: additionalResolver.requiredSelectionSet || `{ ${additionalResolver.keyField} }`,
733
- resolve: async (root, args, context, info) => {
734
- if (!baseOptions.selectionSet) {
735
- baseOptions.selectionSet = generateSelectionSetFactory(info.schema, additionalResolver);
736
- }
737
- const resolverData = { root, args, context, info, env: crossHelpers.process.env };
738
- const targetArgs = {};
739
- for (const argPath in additionalResolver.additionalArgs || {}) {
740
- lodashSet(targetArgs, argPath, stringInterpolation.stringInterpolator.parse(additionalResolver.additionalArgs[argPath], resolverData));
741
- }
742
- const options = {
743
- ...baseOptions,
744
- root,
745
- context,
746
- info,
747
- argsFromKeys: (keys) => {
748
- const args = {};
749
- lodashSet(args, additionalResolver.keysArg, keys);
750
- Object.assign(args, targetArgs);
751
- return args;
752
- },
753
- key: lodashGet(root, additionalResolver.keyField),
754
- };
755
- return context[additionalResolver.sourceName][additionalResolver.sourceTypeName][additionalResolver.sourceFieldName](options);
756
- },
757
- },
758
- },
759
- };
760
- }
761
- else if ('targetTypeName' in additionalResolver) {
762
- return {
763
- [additionalResolver.targetTypeName]: {
764
- [additionalResolver.targetFieldName]: {
765
- selectionSet: additionalResolver.requiredSelectionSet,
766
- resolve: (root, args, context, info) => {
767
- // Assert source exists
768
- if (!context[additionalResolver.sourceName]) {
769
- throw new Error(`No source found named "${additionalResolver.sourceName}"`);
770
- }
771
- if (!context[additionalResolver.sourceName][additionalResolver.sourceTypeName]) {
772
- throw new Error(`No root type found named "${additionalResolver.sourceTypeName}" exists in the source ${additionalResolver.sourceName}\n` +
773
- `It should be one of the following; ${Object.keys(context[additionalResolver.sourceName]).join(',')})}}`);
774
- }
775
- if (!context[additionalResolver.sourceName][additionalResolver.sourceTypeName][additionalResolver.sourceFieldName]) {
776
- throw new Error(`No field named "${additionalResolver.sourceFieldName}" exists in the type ${additionalResolver.sourceTypeName} from the source ${additionalResolver.sourceName}`);
777
- }
778
- if (!baseOptions.selectionSet) {
779
- baseOptions.selectionSet = generateSelectionSetFactory(info.schema, additionalResolver);
780
- }
781
- const resolverData = { root, args, context, info, env: crossHelpers.process.env };
782
- const targetArgs = {};
783
- for (const argPath in additionalResolver.sourceArgs) {
784
- lodashSet(targetArgs, argPath, stringInterpolation.stringInterpolator.parse(additionalResolver.sourceArgs[argPath].toString(), resolverData));
785
- }
786
- const options = {
787
- ...baseOptions,
788
- root,
789
- args: targetArgs,
790
- context,
791
- info,
792
- };
793
- return context[additionalResolver.sourceName][additionalResolver.sourceTypeName][additionalResolver.sourceFieldName](options);
794
- },
795
- },
796
- },
797
- };
798
- }
799
- else {
800
- return additionalResolver;
801
- }
802
- }
803
- }));
804
- }
805
-
806
- const ANSI_CODES = {
807
- black: '\x1b[30m',
808
- red: '\x1b[31m',
809
- green: '\x1b[32m',
810
- yellow: '\x1b[33m',
811
- blue: '\x1b[34m',
812
- magenta: '\x1b[35m',
813
- cyan: '\x1b[36m',
814
- white: '\x1b[37m',
815
- reset: '\x1b[0m',
816
- bold: '\x1b[1m',
817
- orange: '\x1b[48:5:166m',
818
- };
819
- const warnColor = msg => ANSI_CODES.orange + msg + ANSI_CODES.reset;
820
- const infoColor = msg => ANSI_CODES.cyan + msg + ANSI_CODES.reset;
821
- const errorColor = msg => ANSI_CODES.red + msg + ANSI_CODES.reset;
822
- const debugColor = msg => ANSI_CODES.magenta + msg + ANSI_CODES.reset;
823
- const titleBold = msg => ANSI_CODES.bold + msg + ANSI_CODES.reset;
824
- class DefaultLogger {
825
- constructor(name) {
826
- this.name = name;
827
- }
828
- getLoggerMessage(...args) {
829
- return args
830
- .flat(Infinity)
831
- .map(arg => {
832
- if (typeof arg === 'string') {
833
- if (arg.length > 100 && !this.isDebug) {
834
- return arg.slice(0, 100) + '...';
835
- }
836
- return arg;
837
- }
838
- else if (typeof arg === 'object' && (arg === null || arg === void 0 ? void 0 : arg.stack) != null) {
839
- return arg.stack;
840
- }
841
- return crossHelpers.util.inspect(arg);
842
- })
843
- .join(` `);
844
- }
845
- handleLazyMessage(...lazyArgs) {
846
- const flattenedArgs = lazyArgs.flat(Infinity).flatMap(arg => {
847
- if (typeof arg === 'function') {
848
- return arg();
849
- }
850
- return arg;
851
- });
852
- return this.getLoggerMessage(flattenedArgs);
853
- }
854
- get isDebug() {
855
- return (crossHelpers.process.env.DEBUG === '1' ||
856
- globalThis.DEBUG === '1' ||
857
- this.name.includes(crossHelpers.process.env.DEBUG || globalThis.DEBUG));
858
- }
859
- get prefix() {
860
- return this.name ? titleBold(this.name) : ``;
861
- }
862
- log(...args) {
863
- const message = this.getLoggerMessage(...args);
864
- return console.log(`${this.prefix} ${message}`);
865
- }
866
- warn(...args) {
867
- const message = this.getLoggerMessage(...args);
868
- const fullMessage = `⚠️ ${this.prefix} ${warnColor(message)}`;
869
- if (console.warn) {
870
- console.warn(fullMessage);
871
- }
872
- else {
873
- console.log(fullMessage);
874
- }
875
- }
876
- info(...args) {
877
- const message = this.getLoggerMessage(...args);
878
- const fullMessage = `💡 ${this.prefix} ${infoColor(message)}`;
879
- if (console.info) {
880
- console.info(fullMessage);
881
- }
882
- else {
883
- console.log(fullMessage);
884
- }
885
- }
886
- error(...args) {
887
- const message = this.getLoggerMessage(...args);
888
- const fullMessage = `💥 ${this.prefix} ${errorColor(message)}`;
889
- console.log(fullMessage);
890
- }
891
- debug(...lazyArgs) {
892
- if (this.isDebug) {
893
- const message = this.handleLazyMessage(lazyArgs);
894
- const fullMessage = `🐛 ${this.prefix} ${debugColor(message)}`;
895
- if (console.debug) {
896
- console.debug(fullMessage);
897
- }
898
- else {
899
- console.log(fullMessage);
900
- }
901
- }
902
- }
903
- child(name) {
904
- return new DefaultLogger(this.name ? `${this.name} - ${name}` : name);
905
- }
906
- }
907
-
908
- const parseCache = createLruCache(1000, 3600);
909
- const printCache = createLruCache(1000, 3600);
910
- function parseWithCache(sdl) {
911
- const trimmedSdl = sdl.trim();
912
- let document = parseCache.get(trimmedSdl);
913
- if (!document) {
914
- document = graphql.parse(trimmedSdl, { noLocation: true });
915
- parseCache.set(trimmedSdl, document);
916
- printCache.set(JSON.stringify(document), trimmedSdl);
917
- }
918
- return document;
919
- }
920
- const printWithCache = utils.memoize1(function printWithCache(document) {
921
- const stringifedDocumentJson = JSON.stringify(document);
922
- let sdl = printCache.get(stringifedDocumentJson);
923
- if (!sdl) {
924
- sdl = graphql.print(document).trim();
925
- printCache.set(stringifedDocumentJson, sdl);
926
- parseCache.set(sdl, document);
927
- }
928
- return sdl;
929
- });
930
- function gql([sdl], ...args) {
931
- let result = sdl;
932
- for (const arg of args || []) {
933
- if (typeof arg === 'string') {
934
- result += arg;
935
- }
936
- else {
937
- result += printWithCache(arg);
938
- }
939
- }
940
- return parseWithCache(result);
941
- }
942
-
943
- class PubSub {
944
- constructor() {
945
- this.subIdListenerMap = new Map();
946
- this.listenerEventMap = new Map();
947
- this.eventNameListenersMap = new Map();
948
- }
949
- publish(triggerName, detail) {
950
- const eventNameListeners = this.eventNameListenersMap.get(triggerName);
951
- if (eventNameListeners) {
952
- Promise.allSettled([...eventNameListeners].map(listener => listener(detail))).catch(e => console.error(e));
953
- }
954
- }
955
- subscribe(triggerName, onMessage) {
956
- let eventNameListeners = this.eventNameListenersMap.get(triggerName);
957
- if (!eventNameListeners) {
958
- eventNameListeners = new Set();
959
- this.eventNameListenersMap.set(triggerName, eventNameListeners);
960
- }
961
- const subId = Date.now();
962
- eventNameListeners.add(onMessage);
963
- this.subIdListenerMap.set(subId, onMessage);
964
- this.listenerEventMap.set(onMessage, triggerName);
965
- return subId;
966
- }
967
- unsubscribe(subId) {
968
- const listener = this.subIdListenerMap.get(subId);
969
- if (listener) {
970
- this.subIdListenerMap.delete(subId);
971
- const eventName = this.listenerEventMap.get(listener);
972
- if (eventName) {
973
- const eventNameListeners = this.eventNameListenersMap.get(eventName);
974
- if (eventNameListeners) {
975
- eventNameListeners.delete(listener);
976
- }
977
- }
978
- }
979
- this.listenerEventMap.delete(listener);
980
- }
981
- asyncIterator(triggerName) {
982
- return utils.observableToAsyncIterable({
983
- subscribe: observer => {
984
- const subId = this.subscribe(triggerName, data => observer.next(data));
985
- return {
986
- unsubscribe: () => this.unsubscribe(subId),
987
- };
988
- },
989
- });
990
- }
991
- }
992
-
993
- function fileUriToPath(uri) {
994
- if (typeof uri !== 'string' || uri.length <= 7 || uri.substring(0, 7) !== 'file://') {
995
- throw new TypeError('must pass in a file:// URI to convert to a file path');
996
- }
997
- const rest = decodeURI(uri.substring(7));
998
- const firstSlash = rest.indexOf('/');
999
- let host = rest.substring(0, firstSlash);
1000
- let path = rest.substring(firstSlash + 1);
1001
- // 2. Scheme Definition
1002
- // As a special case, <host> can be the string "localhost" or the empty
1003
- // string; this is interpreted as "the machine from which the URL is
1004
- // being interpreted".
1005
- if (host === 'localhost') {
1006
- host = '';
1007
- }
1008
- if (host) {
1009
- host = crossHelpers.path.sep + crossHelpers.path.sep + host;
1010
- }
1011
- // 3.2 Drives, drive letters, mount points, file system root
1012
- // Drive letters are mapped into the top of a file URI in various ways,
1013
- // depending on the implementation; some applications substitute
1014
- // vertical bar ("|") for the colon after the drive letter, yielding
1015
- // "file:///c|/tmp/test.txt". In some cases, the colon is left
1016
- // unchanged, as in "file:///c:/tmp/test.txt". In other cases, the
1017
- // colon is simply omitted, as in "file:///c/tmp/test.txt".
1018
- path = path.replace(/^(.+)\|/, '$1:');
1019
- // for Windows, we need to invert the path separators from what a URI uses
1020
- if (crossHelpers.path.sep === '\\') {
1021
- path = path.replace(/\//g, '\\');
1022
- }
1023
- if (/^.+:/.test(path)) ;
1024
- else {
1025
- // unix path…
1026
- path = crossHelpers.path.sep + path;
1027
- }
1028
- return host + path;
1029
- }
1030
- function fileURLToPath(url) {
1031
- if (url === null || url === void 0 ? void 0 : url.startsWith('file://')) {
1032
- return fileUriToPath(url);
1033
- }
1034
- return url || '';
1035
- }
1036
-
1037
- function headersToJSON(headers) {
1038
- const obj = {};
1039
- headers.forEach((value, key) => {
1040
- obj[key] = value;
1041
- });
1042
- return obj;
1043
- }
1044
- function getHeadersObj(headers) {
1045
- return new Proxy({}, {
1046
- get(_target, name) {
1047
- if (name === 'toJSON') {
1048
- return () => headersToJSON(headers);
1049
- }
1050
- return headers.get(name.toString());
1051
- },
1052
- has(_target, name) {
1053
- if (name === 'toJSON') {
1054
- return true;
1055
- }
1056
- return headers.has(name.toString());
1057
- },
1058
- ownKeys(_target) {
1059
- const keys = [];
1060
- headers.forEach((_value, name) => {
1061
- keys.push(name);
1062
- });
1063
- return keys;
1064
- },
1065
- set(_target, name, value) {
1066
- headers.set(name.toString(), value);
1067
- return true;
1068
- },
1069
- deleteProperty(_target, name) {
1070
- headers.delete(name.toString());
1071
- return true;
1072
- },
1073
- preventExtensions() {
1074
- return true;
1075
- },
1076
- });
1077
- }
1078
-
1079
- exports.DefaultLogger = DefaultLogger;
1080
- exports.PubSub = PubSub;
1081
- exports.applyRequestTransforms = applyRequestTransforms;
1082
- exports.applyResultTransforms = applyResultTransforms;
1083
- exports.applySchemaTransforms = applySchemaTransforms;
1084
- exports.createLruCache = createLruCache;
1085
- exports.debugColor = debugColor;
1086
- exports.defaultImportFn = defaultImportFn;
1087
- exports.errorColor = errorColor;
1088
- exports.extractResolvers = extractResolvers;
1089
- exports.fileURLToPath = fileURLToPath;
1090
- exports.getHeadersObj = getHeadersObj;
1091
- exports.gql = gql;
1092
- exports.groupTransforms = groupTransforms;
1093
- exports.infoColor = infoColor;
1094
- exports.isUrl = isUrl;
1095
- exports.loadFromModuleExportExpression = loadFromModuleExportExpression;
1096
- exports.loadYaml = loadYaml;
1097
- exports.mkdir = mkdir;
1098
- exports.parseWithCache = parseWithCache;
1099
- exports.pathExists = pathExists;
1100
- exports.printWithCache = printWithCache;
1101
- exports.readFile = readFile;
1102
- exports.readFileOrUrl = readFileOrUrl;
1103
- exports.readUrl = readUrl;
1104
- exports.resolveAdditionalResolvers = resolveAdditionalResolvers;
1105
- exports.resolveAdditionalResolversWithoutImport = resolveAdditionalResolversWithoutImport;
1106
- exports.rmdirs = rmdirs;
1107
- exports.sanitizeNameForGraphQL = sanitizeNameForGraphQL;
1108
- exports.titleBold = titleBold;
1109
- exports.warnColor = warnColor;
1110
- exports.withCancel = withCancel;
1111
- exports.writeFile = writeFile;
1112
- exports.writeJSON = writeJSON;