@gqloom/core 0.10.0 → 0.11.0

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.
package/dist/context.cjs CHANGED
@@ -1,460 +1,259 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/context/index.ts
21
- var context_exports = {};
22
- __export(context_exports, {
23
- ContextMemoization: () => ContextMemoization,
24
- InjectableContext: () => InjectableContext,
25
- asyncContextProvider: () => asyncContextProvider,
26
- bindAsyncIterator: () => bindAsyncIterator,
27
- createContext: () => createContext,
28
- createMemoization: () => createMemoization,
29
- isAsyncIterator: () => isAsyncIterator,
30
- resolverPayloadStorage: () => resolverPayloadStorage,
31
- useContext: () => useContext,
32
- useMemoizationMap: () => useMemoizationMap,
33
- useResolverPayload: () => useResolverPayload,
34
- useResolvingFields: () => useResolvingFields
35
- });
36
- module.exports = __toCommonJS(context_exports);
37
-
38
- // src/utils/parse-resolving-fields.ts
39
- var import_graphql3 = require("graphql");
40
-
41
- // src/utils/constants.ts
42
- var DERIVED_DEPENDENCIES = "loom.derived-from-dependencies";
1
+ const require_context = require('./context-3UlS1xGQ.cjs');
2
+ let node_async_hooks = require("node:async_hooks");
3
+ node_async_hooks = require_context.__toESM(node_async_hooks);
43
4
 
44
- // src/utils/type.ts
45
- var import_graphql = require("graphql");
46
- var import_graphql2 = require("graphql");
47
- function unwrapType(gqlType) {
48
- if ((0, import_graphql2.isNonNullType)(gqlType)) {
49
- return unwrapType(gqlType.ofType);
50
- }
51
- if ((0, import_graphql.isListType)(gqlType)) {
52
- return unwrapType(gqlType.ofType);
53
- }
54
- return gqlType;
55
- }
56
-
57
- // src/utils/parse-resolving-fields.ts
58
- function getResolvingFields(payload) {
59
- const requestedFields = parseResolvingFields(payload.info);
60
- const derivedFields = /* @__PURE__ */ new Set();
61
- const derivedDependencies = /* @__PURE__ */ new Set();
62
- const resolvingObject = unwrapType(payload.info.returnType);
63
- if ((0, import_graphql3.isObjectType)(resolvingObject)) {
64
- const objectFields = resolvingObject.getFields();
65
- for (const requestedFieldName of requestedFields) {
66
- const field = objectFields[requestedFieldName];
67
- if (field) {
68
- const deps = field.extensions?.[DERIVED_DEPENDENCIES];
69
- if (deps && Array.isArray(deps) && deps.length > 0) {
70
- derivedFields.add(requestedFieldName);
71
- for (const d of deps) derivedDependencies.add(d);
72
- }
73
- }
74
- }
75
- }
76
- const selectedFields = new Set(requestedFields);
77
- for (const f of derivedFields) selectedFields.delete(f);
78
- for (const d of derivedDependencies) selectedFields.add(d);
79
- return { requestedFields, derivedFields, derivedDependencies, selectedFields };
80
- }
81
- function parseResolvingFields(info, maxDepth = 1) {
82
- return new ResolvingFieldsParser(info, maxDepth).parse();
83
- }
84
- var ResolvingFieldsParser = class {
85
- /** Store unique field paths */
86
- fields = /* @__PURE__ */ new Set();
87
- /** Track visited fragments to prevent circular references */
88
- visitedFragments = /* @__PURE__ */ new Set();
89
- /** The GraphQL resolve info object */
90
- info;
91
- /** Maximum depth of nested fields to parse */
92
- maxDepth;
93
- constructor(info, maxDepth) {
94
- this.info = info;
95
- this.maxDepth = maxDepth;
96
- }
97
- /**
98
- * Parses the GraphQL resolve info to extract all requested fields.
99
- * @returns A Set of field paths
100
- */
101
- parse() {
102
- for (const fieldNode of this.info.fieldNodes) {
103
- this.collectFields(fieldNode.selectionSet);
104
- }
105
- return this.fields;
106
- }
107
- /**
108
- * Recursively collects fields from a selection set.
109
- * Handles fields, inline fragments, and fragment spreads.
110
- *
111
- * @param selectionSet - The selection set to process
112
- * @param parentPath - The path of the parent field (for nested fields)
113
- * @param currentDepth - Current depth of recursion
114
- */
115
- collectFields(selectionSet, parentPath = "", currentDepth = 0) {
116
- if (!selectionSet?.selections.length || currentDepth >= this.maxDepth)
117
- return;
118
- for (const selection of selectionSet.selections) {
119
- if (!this.shouldIncludeNode(selection)) continue;
120
- switch (selection.kind) {
121
- case import_graphql3.Kind.FIELD: {
122
- const fieldName = selection.name.value;
123
- const fieldPath = parentPath ? `${parentPath}.${fieldName}` : fieldName;
124
- this.fields.add(fieldPath);
125
- const hasSelectionSet = selection.selectionSet != null;
126
- if (hasSelectionSet) {
127
- this.collectFields(
128
- selection.selectionSet,
129
- fieldPath,
130
- currentDepth + 1
131
- );
132
- }
133
- break;
134
- }
135
- case import_graphql3.Kind.INLINE_FRAGMENT: {
136
- if (selection.selectionSet) {
137
- this.collectFields(selection.selectionSet, parentPath, currentDepth);
138
- }
139
- break;
140
- }
141
- case import_graphql3.Kind.FRAGMENT_SPREAD: {
142
- const fragmentName = selection.name.value;
143
- if (this.visitedFragments.has(fragmentName)) continue;
144
- this.visitedFragments.add(fragmentName);
145
- const fragment = this.info.fragments[fragmentName];
146
- if (fragment) {
147
- this.collectFields(fragment.selectionSet, parentPath, currentDepth);
148
- }
149
- break;
150
- }
151
- }
152
- }
153
- }
154
- /**
155
- * Extracts the boolean value from a directive's 'if' argument.
156
- * Handles both literal boolean values and variables.
157
- *
158
- * @param directive - The directive node to extract value from
159
- * @returns The boolean value of the directive's condition
160
- */
161
- getDirectiveValue(directive) {
162
- const ifArg = directive.arguments?.find(
163
- (arg) => arg.name.value === "if"
164
- );
165
- if (!ifArg) return true;
166
- const value = ifArg.value;
167
- if (value.kind === import_graphql3.Kind.BOOLEAN) {
168
- return value.value;
169
- }
170
- if (value.kind === import_graphql3.Kind.VARIABLE) {
171
- const variableName = value.name.value;
172
- const variableValue = this.info.variableValues?.[variableName];
173
- return variableValue === true;
174
- }
175
- return true;
176
- }
177
- /**
178
- * Determines if a selection node should be included based on its directives.
179
- * Handles both @include and @skip directives.
180
- *
181
- * @param node - The selection node to check
182
- * @returns Whether the node should be included
183
- */
184
- shouldIncludeNode(node) {
185
- if (!node.directives?.length) return true;
186
- return node.directives.every((directive) => {
187
- const isIncludeDirective = directive.name.value === "include";
188
- if (isIncludeDirective) {
189
- return this.getDirectiveValue(directive);
190
- }
191
- if (directive.name.value === "skip") {
192
- return !this.getDirectiveValue(directive);
193
- }
194
- return true;
195
- });
196
- }
197
- };
198
-
199
- // src/context/context.ts
200
- var import_node_async_hooks = require("async_hooks");
201
-
202
- // src/utils/symbols.ts
203
- var GET_GRAPHQL_TYPE = Symbol.for("gqloom.get_graphql_type");
204
- var WEAVER_CONFIG = Symbol.for("gqloom.weaver_config");
205
- var RESOLVER_OPTIONS_KEY = Symbol.for("gqloom.resolver-options");
206
- var IS_RESOLVER = Symbol.for("gqloom.is-resolver");
207
- var CONTEXT_MAP_KEY = Symbol.for("gqloom.context-map");
208
-
209
- // src/utils/context.ts
210
- function onlyMemoization() {
211
- return { memoization: /* @__PURE__ */ new WeakMap(), isMemoization: true };
212
- }
213
- function isOnlyMemoryPayload(payload) {
214
- return payload.isMemoization === true;
215
- }
216
- function getMemoizationMap(payload) {
217
- if (isOnlyMemoryPayload(payload)) return payload.memoization;
218
- if (typeof payload.context === "undefined") {
219
- Object.defineProperty(payload, "context", { value: {} });
220
- }
221
- return assignContextMap(payload.context);
222
- }
223
- function assignContextMap(target) {
224
- target[CONTEXT_MAP_KEY] ??= /* @__PURE__ */ new WeakMap();
225
- return target[CONTEXT_MAP_KEY];
226
- }
227
-
228
- // src/context/async-iterator.ts
5
+ //#region src/context/async-iterator.ts
229
6
  function bindAsyncIterator(storage, generator) {
230
- const store = storage.getStore();
231
- const next = generator.next;
232
- Object.defineProperty(generator, "next", {
233
- value: (...args) => storage.run(store, () => next.apply(generator, args)),
234
- writable: false
235
- });
236
- return generator;
7
+ const store = storage.getStore();
8
+ const next = generator.next;
9
+ Object.defineProperty(generator, "next", {
10
+ value: (...args) => storage.run(store, () => next.apply(generator, args)),
11
+ writable: false
12
+ });
13
+ return generator;
237
14
  }
238
15
  function isAsyncIterator(value) {
239
- return value !== null && typeof value === "object" && "next" in value && typeof value.next === "function";
16
+ return value !== null && typeof value === "object" && "next" in value && typeof value.next === "function";
240
17
  }
241
18
 
242
- // src/context/context.ts
243
- var resolverPayloadStorage = new import_node_async_hooks.AsyncLocalStorage();
19
+ //#endregion
20
+ //#region src/context/context.ts
21
+ /**
22
+ * the AsyncLocalStorage instance to store the resolver payload
23
+ */
24
+ const resolverPayloadStorage = new node_async_hooks.AsyncLocalStorage();
25
+ /**
26
+ * use detailed payload of the current resolver
27
+ * @returns the resolver payload
28
+ */
244
29
  function useResolverPayload() {
245
- const payload = resolverPayloadStorage.getStore();
246
- if (payload === void 0 || isOnlyMemoryPayload(payload)) return;
247
- return payload;
30
+ const payload = resolverPayloadStorage.getStore();
31
+ if (payload === void 0 || require_context.isOnlyMemoryPayload(payload)) return;
32
+ return payload;
248
33
  }
34
+ /**
35
+ * use context of the current resolver
36
+ * @returns the context of the current resolver
37
+ */
249
38
  function useContext() {
250
- return useResolverPayload()?.context;
39
+ return useResolverPayload()?.context;
251
40
  }
41
+ /**
42
+ * use the MemoizationMap of the current context
43
+ */
252
44
  function useMemoizationMap() {
253
- const payload = resolverPayloadStorage.getStore();
254
- if (payload == null) return;
255
- return getMemoizationMap(payload);
45
+ const payload = resolverPayloadStorage.getStore();
46
+ if (payload == null) return;
47
+ return require_context.getMemoizationMap(payload);
256
48
  }
49
+ /**
50
+ * A class that provides dependency injection and context sharing capabilities.
51
+ * It allows you to create injectable dependencies that can be shared across different parts of your application.
52
+ *
53
+ * @template T The type of the value that will be injected
54
+ *
55
+ */
257
56
  var InjectableContext = class {
258
- /**
259
- * Creates a new instance of InjectableContext.
260
- *
261
- * @param getter - A function that returns the default value when no custom implementation is provided
262
- * @param options - Optional configuration for the context
263
- * @param options.getContextMap - A function that returns the WeakMap used to store context values. Defaults to useMemoizationMap
264
- * @param options.key - A unique key used to identify this context in the WeakMap. Defaults to the getter function
265
- */
266
- constructor(getter, options = {}) {
267
- this.getter = getter;
268
- this.getter = getter;
269
- this.getContextMap = options.getContextMap ?? useMemoizationMap;
270
- this.key = options.key ?? this.getter;
271
- }
272
- /**
273
- * A function that returns the WeakMap used to store context values.
274
- * This can be customized to use different storage mechanisms.
275
- */
276
- getContextMap;
277
- /**
278
- * A unique key used to identify this context in the WeakMap.
279
- * This is used to store and retrieve values from the context map.
280
- */
281
- key;
282
- /**
283
- * Retrieves the value from the context.
284
- * If a custom implementation is provided, it will be used.
285
- * Otherwise, the default getter function will be called.
286
- *
287
- * @returns The value of type T
288
- */
289
- get() {
290
- const getter = this.getContextMap()?.get(this.key) ?? this.getter;
291
- if (typeof getter === "function") return getter();
292
- return getter;
293
- }
294
- /**
295
- * Provides a new implementation for this context.
296
- *
297
- * @param getter - A function that returns the new value
298
- * @returns A tuple containing the key and the new getter function
299
- */
300
- provide(getter) {
301
- return [this.key, getter];
302
- }
57
+ /**
58
+ * Creates a new instance of InjectableContext.
59
+ *
60
+ * @param getter - A function that returns the default value when no custom implementation is provided
61
+ * @param options - Optional configuration for the context
62
+ * @param options.getContextMap - A function that returns the WeakMap used to store context values. Defaults to useMemoizationMap
63
+ * @param options.key - A unique key used to identify this context in the WeakMap. Defaults to the getter function
64
+ */
65
+ constructor(getter, options = {}) {
66
+ this.getter = getter;
67
+ this.getter = getter;
68
+ this.getContextMap = options.getContextMap ?? useMemoizationMap;
69
+ this.key = options.key ?? this.getter;
70
+ }
71
+ /**
72
+ * A function that returns the WeakMap used to store context values.
73
+ * This can be customized to use different storage mechanisms.
74
+ */
75
+ getContextMap;
76
+ /**
77
+ * A unique key used to identify this context in the WeakMap.
78
+ * This is used to store and retrieve values from the context map.
79
+ */
80
+ key;
81
+ /**
82
+ * Retrieves the value from the context.
83
+ * If a custom implementation is provided, it will be used.
84
+ * Otherwise, the default getter function will be called.
85
+ *
86
+ * @returns The value of type T
87
+ */
88
+ get() {
89
+ const getter = this.getContextMap()?.get(this.key) ?? this.getter;
90
+ if (typeof getter === "function") return getter();
91
+ return getter;
92
+ }
93
+ /**
94
+ * Provides a new implementation for this context.
95
+ *
96
+ * @param getter - A function that returns the new value
97
+ * @returns A tuple containing the key and the new getter function
98
+ */
99
+ provide(getter) {
100
+ return [this.key, getter];
101
+ }
303
102
  };
103
+ /**
104
+ * Create a memoization in context to store the result of a getter function
105
+ */
304
106
  var ContextMemoization = class {
305
- constructor(getter, options = {}) {
306
- this.getter = getter;
307
- this.getter = getter;
308
- this.getContextMap = options.getContextMap ?? useMemoizationMap;
309
- this.key = options.key ?? this.getter;
310
- }
311
- getContextMap;
312
- key;
313
- /**
314
- * Get the value in memoization or call the getter function
315
- * @returns the value of the getter function
316
- */
317
- get() {
318
- const map = this.getContextMap();
319
- if (!map) return this.getter();
320
- if (!map.has(this.key)) {
321
- map.set(this.key, this.getter());
322
- }
323
- return map.get(this.key);
324
- }
325
- /**
326
- * Clear the memoization
327
- * @returns true if the memoization is cleared, undefined if the context is not found
328
- */
329
- clear() {
330
- const map = this.getContextMap();
331
- if (!map) return;
332
- return map.delete(this.key);
333
- }
334
- /**
335
- * Check if the memoization exists
336
- * @returns true if the memoization exists, undefined if the context is not found
337
- */
338
- exists() {
339
- const map = this.getContextMap();
340
- if (!map) return;
341
- return map.has(this.key);
342
- }
343
- /**
344
- * Set a new value to the memoization
345
- * @param value the new value to set
346
- * @returns the memoization map or undefined if the context is not found
347
- */
348
- set(value) {
349
- const map = this.getContextMap();
350
- if (!map) return;
351
- return map.set(this.key, value);
352
- }
353
- provide(value) {
354
- return [this.key, value];
355
- }
107
+ constructor(getter, options = {}) {
108
+ this.getter = getter;
109
+ this.getter = getter;
110
+ this.getContextMap = options.getContextMap ?? useMemoizationMap;
111
+ this.key = options.key ?? this.getter;
112
+ }
113
+ getContextMap;
114
+ key;
115
+ /**
116
+ * Get the value in memoization or call the getter function
117
+ * @returns the value of the getter function
118
+ */
119
+ get() {
120
+ const map = this.getContextMap();
121
+ if (!map) return this.getter();
122
+ if (!map.has(this.key)) map.set(this.key, this.getter());
123
+ return map.get(this.key);
124
+ }
125
+ /**
126
+ * Clear the memoization
127
+ * @returns true if the memoization is cleared, undefined if the context is not found
128
+ */
129
+ clear() {
130
+ const map = this.getContextMap();
131
+ if (!map) return;
132
+ return map.delete(this.key);
133
+ }
134
+ /**
135
+ * Check if the memoization exists
136
+ * @returns true if the memoization exists, undefined if the context is not found
137
+ */
138
+ exists() {
139
+ const map = this.getContextMap();
140
+ if (!map) return;
141
+ return map.has(this.key);
142
+ }
143
+ /**
144
+ * Set a new value to the memoization
145
+ * @param value the new value to set
146
+ * @returns the memoization map or undefined if the context is not found
147
+ */
148
+ set(value) {
149
+ const map = this.getContextMap();
150
+ if (!map) return;
151
+ return map.set(this.key, value);
152
+ }
153
+ provide(value) {
154
+ return [this.key, value];
155
+ }
356
156
  };
157
+ /**
158
+ * Create a callable context
159
+ * @param args - The arguments to pass to the InjectableContext constructor
160
+ * @returns A callable context
161
+ */
357
162
  function createContext(...args) {
358
- const context = new InjectableContext(...args);
359
- const callable = () => context.get();
360
- Object.defineProperty(context, "key", {
361
- value: callable,
362
- writable: false,
363
- configurable: false
364
- });
365
- return Object.assign(callable, {
366
- key: context.key,
367
- get: () => context.get(),
368
- provide: (getter) => context.provide(getter),
369
- getContextMap: () => context.getContextMap(),
370
- getter: context.getter
371
- });
163
+ const context = new InjectableContext(...args);
164
+ const callable = () => context.get();
165
+ Object.defineProperty(context, "key", {
166
+ value: callable,
167
+ writable: false,
168
+ configurable: false
169
+ });
170
+ return Object.assign(callable, {
171
+ key: context.key,
172
+ get: () => context.get(),
173
+ provide: (getter) => context.provide(getter),
174
+ getContextMap: () => context.getContextMap(),
175
+ getter: context.getter
176
+ });
372
177
  }
178
+ /**
179
+ * Create a memoization in context to store the result of a getter function
180
+ */
373
181
  function createMemoization(...args) {
374
- const memoization = new ContextMemoization(...args);
375
- const callable = () => memoization.get();
376
- Object.defineProperty(memoization, "key", {
377
- value: callable,
378
- writable: false,
379
- configurable: false
380
- });
381
- return Object.assign(callable, {
382
- key: memoization.key,
383
- get: () => memoization.get(),
384
- set: (value) => memoization.set(value),
385
- clear: () => memoization.clear(),
386
- exists: () => memoization.exists(),
387
- getter: memoization.getter,
388
- provide: (value) => memoization.provide(value),
389
- getContextMap: () => memoization.getContextMap()
390
- });
182
+ const memoization = new ContextMemoization(...args);
183
+ const callable = () => memoization.get();
184
+ Object.defineProperty(memoization, "key", {
185
+ value: callable,
186
+ writable: false,
187
+ configurable: false
188
+ });
189
+ return Object.assign(callable, {
190
+ key: memoization.key,
191
+ get: () => memoization.get(),
192
+ set: (value) => memoization.set(value),
193
+ clear: () => memoization.clear(),
194
+ exists: () => memoization.exists(),
195
+ getter: memoization.getter,
196
+ provide: (value) => memoization.provide(value),
197
+ getContextMap: () => memoization.getContextMap()
198
+ });
391
199
  }
392
- var createProvider = (...keyValues) => {
393
- return ({ next, payload, operation }) => {
394
- const store = payload ?? onlyMemoization();
395
- const map = getMemoizationMap(store);
396
- if (map) {
397
- for (const [key, value] of keyValues) {
398
- map.set(key, value);
399
- }
400
- }
401
- if (operation === "subscription.subscribe") {
402
- return resolverPayloadStorage.run(store, async () => {
403
- let result = await next();
404
- if (isAsyncIterator(result)) {
405
- result = bindAsyncIterator(resolverPayloadStorage, result);
406
- }
407
- return result;
408
- });
409
- }
410
- return resolverPayloadStorage.run(store, next);
411
- };
200
+ const createProvider = (...keyValues) => {
201
+ return ({ next, payload, operation }) => {
202
+ const store = payload ?? require_context.onlyMemoization();
203
+ const map = require_context.getMemoizationMap(store);
204
+ if (map) for (const [key, value] of keyValues) map.set(key, value);
205
+ if (operation === "subscription.subscribe") return resolverPayloadStorage.run(store, async () => {
206
+ let result = await next();
207
+ if (isAsyncIterator(result)) result = bindAsyncIterator(resolverPayloadStorage, result);
208
+ return result;
209
+ });
210
+ return resolverPayloadStorage.run(store, next);
211
+ };
412
212
  };
413
- var asyncContextProvider = Object.assign(
414
- createProvider(),
415
- {
416
- operations: [
417
- "query",
418
- "mutation",
419
- "field",
420
- "subscription.resolve",
421
- "subscription.subscribe",
422
- "resolveReference"
423
- ],
424
- with: (...keyValues) => {
425
- return createProvider(...keyValues);
426
- },
427
- run: async (resolve, ...keyValues) => {
428
- const store = onlyMemoization();
429
- const map = getMemoizationMap(store);
430
- for (const [key, value] of keyValues) {
431
- map.set(key, value);
432
- }
433
- return resolverPayloadStorage.run(store, resolve);
434
- }
435
- }
436
- );
213
+ const asyncContextProvider = Object.assign(createProvider(), {
214
+ operations: [
215
+ "query",
216
+ "mutation",
217
+ "field",
218
+ "subscription.resolve",
219
+ "subscription.subscribe",
220
+ "resolveReference"
221
+ ],
222
+ with: (...keyValues) => {
223
+ return createProvider(...keyValues);
224
+ },
225
+ run: async (resolve, ...keyValues) => {
226
+ const store = require_context.onlyMemoization();
227
+ const map = require_context.getMemoizationMap(store);
228
+ for (const [key, value] of keyValues) map.set(key, value);
229
+ return resolverPayloadStorage.run(store, resolve);
230
+ }
231
+ });
437
232
 
438
- // src/context/use-resolving-fields.ts
439
- var useResolvingFields = createContext(
440
- () => {
441
- const payload = useResolverPayload();
442
- if (!payload) return;
443
- return getResolvingFields(payload);
444
- }
445
- );
446
- // Annotate the CommonJS export names for ESM import in node:
447
- 0 && (module.exports = {
448
- ContextMemoization,
449
- InjectableContext,
450
- asyncContextProvider,
451
- bindAsyncIterator,
452
- createContext,
453
- createMemoization,
454
- isAsyncIterator,
455
- resolverPayloadStorage,
456
- useContext,
457
- useMemoizationMap,
458
- useResolverPayload,
459
- useResolvingFields
233
+ //#endregion
234
+ //#region src/context/use-resolving-fields.ts
235
+ /**
236
+ * A hook that analyzes and processes field resolution in a GraphQL query.
237
+ *
238
+ * @returns An object containing sets of different field types,
239
+ * or undefined if no resolver payload is available
240
+ */
241
+ const useResolvingFields = createContext(() => {
242
+ const payload = useResolverPayload();
243
+ if (!payload) return;
244
+ return require_context.getResolvingFields(payload);
460
245
  });
246
+
247
+ //#endregion
248
+ exports.ContextMemoization = ContextMemoization;
249
+ exports.InjectableContext = InjectableContext;
250
+ exports.asyncContextProvider = asyncContextProvider;
251
+ exports.bindAsyncIterator = bindAsyncIterator;
252
+ exports.createContext = createContext;
253
+ exports.createMemoization = createMemoization;
254
+ exports.isAsyncIterator = isAsyncIterator;
255
+ exports.resolverPayloadStorage = resolverPayloadStorage;
256
+ exports.useContext = useContext;
257
+ exports.useMemoizationMap = useMemoizationMap;
258
+ exports.useResolverPayload = useResolverPayload;
259
+ exports.useResolvingFields = useResolvingFields;