@gqloom/core 0.11.1 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_context = require('./context-CnY_BFnk.cjs');
1
+ const require_context = require('./context-DshDoxiE.cjs');
2
2
  let graphql = require("graphql");
3
3
  graphql = require_context.__toESM(graphql);
4
4
 
@@ -240,110 +240,176 @@ var EasyDataLoader = class extends LoomDataLoader {
240
240
 
241
241
  //#endregion
242
242
  //#region src/schema/weaver-context.ts
243
- let ref;
244
- const names = /* @__PURE__ */ new WeakMap();
245
- function initWeaverContext() {
246
- return {
247
- id: initWeaverContext.increasingID++,
248
- loomObjectMap: /* @__PURE__ */ new Map(),
249
- loomUnionMap: /* @__PURE__ */ new Map(),
250
- inputMap: /* @__PURE__ */ new Map(),
251
- interfaceMap: /* @__PURE__ */ new Map(),
252
- configs: /* @__PURE__ */ new Map(),
253
- getConfig(key) {
254
- return this.configs.get(key);
255
- },
256
- setConfig(config) {
257
- const key = config[require_context.WEAVER_CONFIG];
258
- this.configs.set(key, config);
259
- },
260
- deleteConfig(key) {
261
- this.configs.delete(key);
262
- },
263
- names,
264
- namedTypes: /* @__PURE__ */ new Map(),
265
- memoNamedType(gqlTypeValue) {
266
- const gqlType = gqlTypeValue;
267
- if ((0, graphql.isObjectType)(gqlType) || (0, graphql.isUnionType)(gqlType) || (0, graphql.isEnumType)(gqlType) || (0, graphql.isScalarType)(gqlType)) this.namedTypes.set(gqlType.name, gqlType);
268
- return gqlTypeValue;
269
- },
270
- getNamedType(name) {
271
- return this.namedTypes.get(name);
272
- },
273
- vendorWeavers: /* @__PURE__ */ new Map()
243
+ var WeaverContext = class WeaverContext {
244
+ static increasingID = 1;
245
+ static names = /* @__PURE__ */ new WeakMap();
246
+ static autoAliasTypes = /* @__PURE__ */ new WeakSet();
247
+ static _ref;
248
+ static get ref() {
249
+ return WeaverContext._ref;
250
+ }
251
+ id;
252
+ loomObjectMap;
253
+ loomUnionMap;
254
+ inputMap;
255
+ interfaceMap;
256
+ configs;
257
+ namedTypes;
258
+ vendorWeavers;
259
+ constructor() {
260
+ this.id = WeaverContext.increasingID++;
261
+ this.loomObjectMap = /* @__PURE__ */ new Map();
262
+ this.loomUnionMap = /* @__PURE__ */ new Map();
263
+ this.inputMap = /* @__PURE__ */ new Map();
264
+ this.interfaceMap = /* @__PURE__ */ new Map();
265
+ this.configs = /* @__PURE__ */ new Map();
266
+ this.namedTypes = /* @__PURE__ */ new Map();
267
+ this.vendorWeavers = /* @__PURE__ */ new Map();
268
+ }
269
+ getConfig(key) {
270
+ return this.configs.get(key);
271
+ }
272
+ setConfig(config) {
273
+ const key = config[require_context.WEAVER_CONFIG];
274
+ this.configs.set(key, config);
275
+ }
276
+ deleteConfig(key) {
277
+ this.configs.delete(key);
278
+ }
279
+ memoNamedType(gqlTypeValue) {
280
+ const gqlType = gqlTypeValue;
281
+ if ((0, graphql.isObjectType)(gqlType) || (0, graphql.isUnionType)(gqlType) || (0, graphql.isEnumType)(gqlType) || (0, graphql.isScalarType)(gqlType)) this.namedTypes.set(gqlType.name, gqlType);
282
+ return gqlTypeValue;
283
+ }
284
+ getNamedType(name) {
285
+ return this.namedTypes.get(name);
286
+ }
287
+ static namedTypes = {
288
+ Object: "Object",
289
+ Union: "Union",
290
+ Enum: "Enum",
291
+ Interface: "Interface",
292
+ Scalar: "Scalar"
274
293
  };
275
- }
276
- initWeaverContext.increasingID = 1;
277
- const weaverContext = {
294
+ aliasCounters = {};
295
+ setAlias(namedType, alias) {
296
+ if (namedType.name === require_context.AUTO_ALIASING) WeaverContext.autoAliasTypes.add(namedType);
297
+ if (!WeaverContext.autoAliasTypes.has(namedType)) return namedType.name;
298
+ if (WeaverContext.higherPriorityThan(alias, namedType.name) < 0) {
299
+ if (alias) return namedType.name = alias;
300
+ }
301
+ if (namedType.name === require_context.AUTO_ALIASING) {
302
+ if ((0, graphql.isObjectType)(namedType) || (0, graphql.isInputObjectType)(namedType)) {
303
+ this.aliasCounters["Object"] ??= 0;
304
+ return namedType.name = `Object${++this.aliasCounters["Object"]}`;
305
+ } else if ((0, graphql.isUnionType)(namedType)) {
306
+ this.aliasCounters["Union"] ??= 0;
307
+ return namedType.name = `Union${++this.aliasCounters["Union"]}`;
308
+ } else if ((0, graphql.isEnumType)(namedType)) {
309
+ this.aliasCounters["Enum"] ??= 0;
310
+ return namedType.name = `Enum${++this.aliasCounters["Enum"]}`;
311
+ } else if ((0, graphql.isInterfaceType)(namedType)) {
312
+ this.aliasCounters["Interface"] ??= 0;
313
+ return namedType.name = `Interface${++this.aliasCounters["Interface"]}`;
314
+ } else if ((0, graphql.isScalarType)(namedType)) {
315
+ this.aliasCounters["Scalar"] ??= 0;
316
+ return namedType.name = `Scalar${++this.aliasCounters["Scalar"]}`;
317
+ }
318
+ }
319
+ }
320
+ /**
321
+ * @returns -1 if a is better than b, 1 if b is better than a, 0 if they are equal
322
+ */
323
+ static higherPriorityThan(a, b) {
324
+ if (a === require_context.AUTO_ALIASING || a === void 0) return 1;
325
+ else if (b === require_context.AUTO_ALIASING || b === void 0) return -1;
326
+ const compareLength = a.length - b.length;
327
+ if (compareLength !== 0) return compareLength;
328
+ const compareLocale = a.localeCompare(b);
329
+ if (compareLocale !== 0) return compareLocale;
330
+ return 0;
331
+ }
332
+ static provide(func, value) {
333
+ const lastRef = WeaverContext._ref;
334
+ WeaverContext._ref = value;
335
+ try {
336
+ return func();
337
+ } finally {
338
+ WeaverContext._ref = lastRef;
339
+ }
340
+ }
341
+ };
342
+ const initWeaverContext = () => new WeaverContext();
343
+ const provideWeaverContext = Object.assign(WeaverContext.provide, { inherit: (func) => {
344
+ const weaverContextRef = WeaverContext.ref;
345
+ return () => WeaverContext.provide(func, weaverContextRef);
346
+ } });
347
+ var GlobalWeaverContext = class {
348
+ GraphQLTypes = /* @__PURE__ */ new WeakMap();
278
349
  get id() {
279
- return ref?.id;
280
- },
350
+ return WeaverContext.ref?.id;
351
+ }
281
352
  get loomObjectMap() {
282
- return ref?.loomObjectMap;
283
- },
353
+ return WeaverContext.ref?.loomObjectMap;
354
+ }
284
355
  get loomUnionMap() {
285
- return ref?.loomUnionMap;
286
- },
356
+ return WeaverContext.ref?.loomUnionMap;
357
+ }
287
358
  get inputMap() {
288
- return ref?.inputMap;
289
- },
359
+ return WeaverContext.ref?.inputMap;
360
+ }
290
361
  get interfaceMap() {
291
- return ref?.interfaceMap;
292
- },
362
+ return WeaverContext.ref?.interfaceMap;
363
+ }
293
364
  get configs() {
294
- return ref?.configs;
295
- },
365
+ return WeaverContext.ref?.configs;
366
+ }
296
367
  get vendorWeavers() {
297
- return ref?.vendorWeavers;
298
- },
368
+ return WeaverContext.ref?.vendorWeavers;
369
+ }
370
+ get names() {
371
+ return WeaverContext.names;
372
+ }
373
+ get autoAliasTypes() {
374
+ return WeaverContext.autoAliasTypes;
375
+ }
376
+ get value() {
377
+ return WeaverContext.ref;
378
+ }
299
379
  getConfig(key) {
300
- return ref?.getConfig(key);
301
- },
380
+ return WeaverContext.ref?.getConfig(key);
381
+ }
302
382
  setConfig(config) {
303
- ref?.setConfig(config);
304
- },
383
+ WeaverContext.ref?.setConfig(config);
384
+ }
305
385
  deleteConfig(key) {
306
- ref?.deleteConfig(key);
307
- },
308
- get value() {
309
- return ref;
310
- },
386
+ WeaverContext.ref?.deleteConfig(key);
387
+ }
311
388
  useConfig(config, callback) {
312
- const context = weaverContext.value ?? initWeaverContext();
389
+ const context = this.value ?? initWeaverContext();
313
390
  context.setConfig(config);
314
391
  const result = provideWeaverContext(callback, context);
315
392
  context.deleteConfig(config[require_context.WEAVER_CONFIG]);
316
393
  return result;
317
- },
318
- names,
394
+ }
319
395
  getNamedType(name) {
320
- return ref?.getNamedType(name);
321
- },
396
+ return WeaverContext.ref?.getNamedType(name);
397
+ }
322
398
  memoNamedType(gqlType) {
323
- return ref?.memoNamedType(gqlType) ?? gqlType;
324
- },
325
- GraphQLTypes: /* @__PURE__ */ new WeakMap(),
399
+ return WeaverContext.ref?.memoNamedType(gqlType) ?? gqlType;
400
+ }
326
401
  getGraphQLType(origin) {
327
402
  return this.GraphQLTypes.get(origin);
328
- },
403
+ }
329
404
  memoGraphQLType(origin, gqlType) {
330
405
  this.GraphQLTypes.set(origin, gqlType);
331
406
  return gqlType;
332
407
  }
333
- };
334
- function provideWeaverContext(func, value) {
335
- const lastRef = ref;
336
- ref = value;
337
- try {
338
- return func();
339
- } finally {
340
- ref = lastRef;
408
+ setAlias(namedType, alias) {
409
+ return WeaverContext.ref?.setAlias(namedType, alias);
341
410
  }
342
- }
343
- provideWeaverContext.inherit = (func) => {
344
- const weaverContextRef = weaverContext.value;
345
- return () => provideWeaverContext(func, weaverContextRef);
346
411
  };
412
+ const weaverContext = new GlobalWeaverContext();
347
413
  /**
348
414
  * collect names for schemas
349
415
  * @param namesList - names to collect
@@ -352,7 +418,7 @@ provideWeaverContext.inherit = (func) => {
352
418
  function collectNames(...namesList) {
353
419
  const namesRecord = {};
354
420
  for (const namesItem of namesList) for (const [name, schema] of Object.entries(namesItem)) {
355
- names.set(schema, name);
421
+ WeaverContext.names.set(schema, name);
356
422
  namesRecord[name] = schema;
357
423
  }
358
424
  return namesRecord;
@@ -364,7 +430,7 @@ function collectNames(...namesList) {
364
430
  * @returns schema
365
431
  */
366
432
  function collectName(name, schema) {
367
- names.set(schema, name);
433
+ WeaverContext.names.set(schema, name);
368
434
  return schema;
369
435
  }
370
436
 
@@ -1211,8 +1277,7 @@ function inputToArgs(input, options) {
1211
1277
  let inputType = getGraphQLType(input);
1212
1278
  if ((0, graphql.isNonNullType)(inputType)) inputType = inputType.ofType;
1213
1279
  if ((0, graphql.isObjectType)(inputType)) return mapValue(inputType.toConfig().fields, (it, key) => {
1214
- let fieldName;
1215
- if (options?.fieldName) fieldName = `${pascalCase(options.fieldName)}${pascalCase(key)}`;
1280
+ const fieldName = `${pascalCase(options.fieldName)}${pascalCase(key)}`;
1216
1281
  return toInputFieldConfig(it, { fieldName });
1217
1282
  });
1218
1283
  throw new Error(`Cannot convert ${inputType.toString()} to input type`);
@@ -1220,8 +1285,7 @@ function inputToArgs(input, options) {
1220
1285
  const args = {};
1221
1286
  Object.entries(input).forEach(([name, field$1]) => {
1222
1287
  tryIn(() => {
1223
- let fieldName;
1224
- if (options?.fieldName) fieldName = `${pascalCase(options.fieldName)}${pascalCase(name)}`;
1288
+ const fieldName = `${pascalCase(options.fieldName)}${pascalCase(name)}`;
1225
1289
  args[name] = {
1226
1290
  ...field$1,
1227
1291
  type: ensureInputType(field$1, { fieldName })
@@ -1239,6 +1303,13 @@ function ensureInputType(silkOrType, options) {
1239
1303
  if ((0, graphql.isNonNullType)(gqlType)) return new graphql.GraphQLNonNull(ensureInputType(gqlType.ofType, options));
1240
1304
  if ((0, graphql.isListType)(gqlType)) return new graphql.GraphQLList(ensureInputType(gqlType.ofType, options));
1241
1305
  if ((0, graphql.isObjectType)(gqlType) || (0, graphql.isInterfaceType)(gqlType)) return ensureInputObjectType(gqlType, options);
1306
+ if ((0, graphql.isEnumType)(gqlType)) {
1307
+ if (gqlType.name === require_context.AUTO_ALIASING) {
1308
+ const alias = `${pascalCase(options.fieldName)}Input`;
1309
+ weaverContext.setAlias(gqlType, alias);
1310
+ }
1311
+ return gqlType;
1312
+ }
1242
1313
  return gqlType;
1243
1314
  }
1244
1315
  function ensureInputObjectType(object, options) {
@@ -1247,7 +1318,7 @@ function ensureInputObjectType(object, options) {
1247
1318
  if (existing != null) return existing;
1248
1319
  const { astNode, extensionASTNodes, fields,...config } = object.toConfig();
1249
1320
  let name = object.name;
1250
- if (name === LoomObjectType.AUTO_ALIASING) name = `${pascalCase(options?.fieldName ?? "")}Input`;
1321
+ if (name === require_context.AUTO_ALIASING) name = `${pascalCase(options.fieldName)}Input`;
1251
1322
  name = (weaverContext.getConfig("gqloom.core.schema")?.getInputObjectName ?? ((n) => n))(name);
1252
1323
  const input = new graphql.GraphQLInputObjectType({
1253
1324
  ...config,
@@ -1270,10 +1341,9 @@ function inputFieldName(name) {
1270
1341
 
1271
1342
  //#endregion
1272
1343
  //#region src/schema/object.ts
1273
- var LoomObjectType = class LoomObjectType extends graphql.GraphQLObjectType {
1344
+ var LoomObjectType = class extends graphql.GraphQLObjectType {
1274
1345
  extraFields = /* @__PURE__ */ new Map();
1275
1346
  hiddenFields = /* @__PURE__ */ new Set();
1276
- static AUTO_ALIASING = "__gqloom_auto_aliasing";
1277
1347
  weaverContext;
1278
1348
  globalOptions;
1279
1349
  /**
@@ -1294,22 +1364,11 @@ var LoomObjectType = class LoomObjectType extends graphql.GraphQLObjectType {
1294
1364
  this.globalOptions = options.globalOptions;
1295
1365
  this.weaverContext = options.weaverContext ?? initWeaverContext();
1296
1366
  this.resolvers = /* @__PURE__ */ new Map();
1297
- if (this.name !== LoomObjectType.AUTO_ALIASING) this.hasExplicitName = true;
1298
- }
1299
- hasExplicitName;
1300
- _aliases = [];
1301
- get aliases() {
1302
- return this._aliases;
1303
- }
1304
- addAlias(name) {
1305
- if (this.hasExplicitName) return;
1306
- this._aliases.push(name);
1307
- this.renameByAliases();
1367
+ if (this.name === require_context.AUTO_ALIASING) WeaverContext.autoAliasTypes.add(this);
1308
1368
  }
1309
- renameByAliases() {
1310
- let name;
1311
- for (const alias of this.aliases) if (name === void 0 || alias.length < name.length) name = alias;
1312
- if (name) this.name = name;
1369
+ addAlias(alias) {
1370
+ if (!WeaverContext.autoAliasTypes.has(this) || !alias) return;
1371
+ this.name = alias.length < this.name.length ? alias : this.name;
1313
1372
  }
1314
1373
  hideField(name) {
1315
1374
  this.hiddenFields.add(name);
@@ -1323,10 +1382,14 @@ var LoomObjectType = class LoomObjectType extends graphql.GraphQLObjectType {
1323
1382
  mergeExtensions(extensions) {
1324
1383
  this.extensions = deepMerge(this.extensions, extensions);
1325
1384
  }
1385
+ collectedFieldNames() {
1386
+ const fieldsBySuper = super.getFields();
1387
+ Object.entries(fieldsBySuper).forEach(([fieldName, field$1]) => field$1.type = this.getCacheType(field$1.type, fieldName));
1388
+ }
1326
1389
  extraFieldMap;
1327
1390
  getFields() {
1328
1391
  const fieldsBySuper = super.getFields();
1329
- Object.entries(fieldsBySuper).forEach(([fieldName, field$1]) => field$1.type = this.getCacheType(field$1.type, fieldName));
1392
+ this.collectedFieldNames();
1330
1393
  const extraFields = provideWeaverContext(() => defineFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
1331
1394
  if (Object.keys(this.extraFieldMap ?? {}).join() !== Object.keys(extraFields).join()) this.extraFieldMap = extraFields;
1332
1395
  const answer = {
@@ -1348,7 +1411,7 @@ var LoomObjectType = class LoomObjectType extends graphql.GraphQLObjectType {
1348
1411
  return {
1349
1412
  ...extract(field$1),
1350
1413
  type: outputType,
1351
- args: inputToArgs(field$1["~meta"].input, { fieldName: fieldName ? parentName(this.name) + fieldName : void 0 }),
1414
+ args: inputToArgs(field$1["~meta"].input, { fieldName: parentName(this.name) + fieldName }),
1352
1415
  resolve,
1353
1416
  ...subscribe ? { subscribe } : {}
1354
1417
  };
@@ -1500,13 +1563,17 @@ const OPERATION_OBJECT_NAMES = new Set([
1500
1563
  ]);
1501
1564
  function getCacheType(gqlType, options = {}) {
1502
1565
  const context = options.weaverContext ?? weaverContext;
1566
+ const getAlias = () => {
1567
+ if (!options.fieldName || !options.parent) return;
1568
+ return parentName(options.parent.name) + pascalCase(options.fieldName);
1569
+ };
1503
1570
  if (gqlType instanceof LoomObjectType) return gqlType;
1504
1571
  if ((0, graphql.isObjectType)(gqlType)) {
1505
1572
  const gqlObject = context.loomObjectMap?.get(gqlType);
1506
1573
  if (gqlObject != null) return gqlObject;
1507
1574
  const loomObject = new LoomObjectType(gqlType, options);
1508
1575
  context.loomObjectMap?.set(gqlType, loomObject);
1509
- if (options.fieldName && options.parent) loomObject.addAlias(parentName(options.parent.name) + pascalCase(options.fieldName));
1576
+ context.setAlias(loomObject, getAlias());
1510
1577
  return loomObject;
1511
1578
  } else if ((0, graphql.isListType)(gqlType)) return new graphql.GraphQLList(getCacheType(gqlType.ofType, options));
1512
1579
  else if ((0, graphql.isNonNullType)(gqlType)) return new graphql.GraphQLNonNull(getCacheType(gqlType.ofType, options));
@@ -1516,10 +1583,17 @@ function getCacheType(gqlType, options = {}) {
1516
1583
  const config = gqlType.toConfig();
1517
1584
  const unionType = new graphql.GraphQLUnionType({
1518
1585
  ...config,
1519
- types: config.types.map((type) => getCacheType(type, options))
1586
+ types: config.types.map((type, i) => getCacheType(type, {
1587
+ ...options,
1588
+ fieldName: options.fieldName ? `${options.fieldName}Item${i + 1}` : void 0
1589
+ }))
1520
1590
  });
1521
1591
  context.loomUnionMap?.set(gqlType, unionType);
1592
+ context.setAlias(unionType, getAlias());
1522
1593
  return unionType;
1594
+ } else if ((0, graphql.isEnumType)(gqlType) || (0, graphql.isInterfaceType)(gqlType) || (0, graphql.isScalarType)(gqlType)) {
1595
+ context.setAlias(gqlType, getAlias());
1596
+ return gqlType;
1523
1597
  }
1524
1598
  return gqlType;
1525
1599
  }
@@ -1580,18 +1654,11 @@ var GraphQLSchemaLoom = class GraphQLSchemaLoom {
1580
1654
  return this;
1581
1655
  }
1582
1656
  addType(silk$1) {
1583
- const gqlType = provideWeaverContext(() => {
1584
- let gqlType$1 = getGraphQLType(silk$1);
1585
- if ((0, graphql.isNonNullType)(gqlType$1)) gqlType$1 = gqlType$1.ofType;
1586
- if ((0, graphql.isObjectType)(gqlType$1)) {
1587
- const existing = this.context.loomObjectMap.get(gqlType$1);
1588
- if (existing != null) return existing;
1589
- const extraObject = new LoomObjectType(gqlType$1, this.fieldOptions);
1590
- this.context.loomObjectMap.set(gqlType$1, extraObject);
1591
- return extraObject;
1592
- } else if ((0, graphql.isUnionType)(gqlType$1) || (0, graphql.isEnumType)(gqlType$1)) return gqlType$1;
1593
- throw new Error(`${gqlType$1?.name ?? gqlType$1.toString()} is not a named type`);
1657
+ let gqlType = provideWeaverContext(() => {
1658
+ const gqlType$1 = getGraphQLType(silk$1);
1659
+ return getCacheType(gqlType$1);
1594
1660
  }, this.context);
1661
+ while ((0, graphql.isNonNullType)(gqlType) || (0, graphql.isListType)(gqlType)) gqlType = gqlType.ofType;
1595
1662
  this.types.add(gqlType);
1596
1663
  return this;
1597
1664
  }
@@ -1616,8 +1683,8 @@ var GraphQLSchemaLoom = class GraphQLSchemaLoom {
1616
1683
  let parentObject = (() => {
1617
1684
  if (parent == null) return void 0;
1618
1685
  let gqlType = getGraphQLType(parent);
1619
- if ((0, graphql.isNonNullType)(gqlType)) gqlType = gqlType.ofType;
1620
- if (!(0, graphql.isObjectType)(gqlType)) throw new Error(`${gqlType?.name ?? gqlType.toString()} is not an object type`);
1686
+ while ((0, graphql.isNonNullType)(gqlType) || (0, graphql.isListType)(gqlType)) gqlType = gqlType.ofType;
1687
+ if (!(0, graphql.isObjectType)(gqlType)) throw new Error(`${gqlType.name} is not an object type`);
1621
1688
  const existing = this.context.loomObjectMap.get(gqlType);
1622
1689
  if (existing != null) return existing;
1623
1690
  const extraObject = new LoomObjectType(gqlType, this.fieldOptions);
@@ -1741,11 +1808,14 @@ function ensureInterfaceType(gqlType, interfaceConfig) {
1741
1808
  }
1742
1809
 
1743
1810
  //#endregion
1811
+ exports.AUTO_ALIASING = require_context.AUTO_ALIASING;
1744
1812
  exports.BaseChainFactory = BaseChainFactory;
1745
1813
  exports.ChainResolver = ChainResolver;
1814
+ exports.DERIVED_DEPENDENCIES = require_context.DERIVED_DEPENDENCIES;
1746
1815
  exports.EasyDataLoader = EasyDataLoader;
1747
1816
  exports.FieldChainFactory = FieldChainFactory;
1748
1817
  exports.FieldFactoryWithResolve = FieldFactoryWithResolve;
1818
+ exports.GlobalWeaverContext = GlobalWeaverContext;
1749
1819
  exports.GraphQLSchemaLoom = GraphQLSchemaLoom;
1750
1820
  exports.LoomDataLoader = LoomDataLoader;
1751
1821
  exports.LoomObjectType = LoomObjectType;
@@ -1762,6 +1832,7 @@ Object.defineProperty(exports, 'SYMBOLS', {
1762
1832
  }
1763
1833
  });
1764
1834
  exports.SubscriptionChainFactory = SubscriptionChainFactory;
1835
+ exports.WeaverContext = WeaverContext;
1765
1836
  exports.applyMiddlewares = applyMiddlewares;
1766
1837
  exports.assignContextMap = require_context.assignContextMap;
1767
1838
  exports.capitalize = capitalize;
package/dist/index.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, symbols_d_exports, toObjMap, tryIn, types_loom_d_exports, weave, weaverContext } from "./index-DXUAbzqx.cjs";
2
- export { BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, types_loom_d_exports as Loom, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, symbols_d_exports as SYMBOLS, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, toObjMap, tryIn, weave, weaverContext };
1
+ import { AUTO_ALIASING, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, symbols_d_exports, toObjMap, tryIn, types_loom_d_exports, weave, weaverContext } from "./index-BxqR3YsC.cjs";
2
+ export { AUTO_ALIASING, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, types_loom_d_exports as Loom, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, symbols_d_exports as SYMBOLS, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, toObjMap, tryIn, weave, weaverContext };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, symbols_d_exports, toObjMap, tryIn, types_loom_d_exports, weave, weaverContext } from "./index-t3pO8DK2.js";
2
- export { BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, types_loom_d_exports as Loom, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, symbols_d_exports as SYMBOLS, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, toObjMap, tryIn, weave, weaverContext };
1
+ import { AUTO_ALIASING, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, symbols_d_exports, toObjMap, tryIn, types_loom_d_exports, weave, weaverContext } from "./index-sGKC4BRu.js";
2
+ export { AUTO_ALIASING, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, types_loom_d_exports as Loom, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, symbols_d_exports as SYMBOLS, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, toObjMap, tryIn, weave, weaverContext };