houdini 1.0.0-next.0 → 1.0.0-next.2
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/build/cmd/generate.d.ts +0 -1
- package/build/cmd-cjs/index.js +409 -2066
- package/build/cmd-esm/index.js +409 -2066
- package/build/codegen/generators/artifacts/fieldKey.d.ts +1 -1
- package/build/codegen/generators/artifacts/index.d.ts +1 -1
- package/build/codegen/generators/artifacts/indexFile.d.ts +1 -1
- package/build/codegen/generators/artifacts/inputs.d.ts +2 -2
- package/build/codegen/generators/artifacts/operations.d.ts +2 -2
- package/build/codegen/generators/artifacts/selection.d.ts +1 -1
- package/build/codegen/generators/artifacts/utils.d.ts +1 -1
- package/build/codegen/generators/definitions/enums.d.ts +1 -1
- package/build/codegen/generators/definitions/index.d.ts +1 -1
- package/build/codegen/generators/indexFile/index.d.ts +1 -1
- package/build/codegen/generators/persistedQueries/index.d.ts +1 -1
- package/build/codegen/generators/runtime/graphqlFunction.d.ts +2 -0
- package/build/codegen/generators/runtime/index.d.ts +1 -1
- package/build/codegen/generators/runtime/injectPlugins.d.ts +7 -0
- package/build/codegen/generators/runtime/pluginIndex.d.ts +5 -0
- package/build/codegen/generators/typescript/addReferencedInputTypes.d.ts +1 -1
- package/build/codegen/generators/typescript/imperativeCache.d.ts +1 -1
- package/build/codegen/generators/typescript/index.d.ts +1 -1
- package/build/codegen/generators/typescript/inlineType.d.ts +1 -1
- package/build/codegen/generators/typescript/typeReference.d.ts +1 -1
- package/build/codegen/generators/typescript/types.d.ts +1 -1
- package/build/codegen/index.d.ts +1 -1
- package/build/codegen/transforms/addID.d.ts +1 -1
- package/build/codegen/transforms/composeQueries.d.ts +2 -2
- package/build/codegen/transforms/fragmentVariables.d.ts +2 -2
- package/build/codegen/transforms/list.d.ts +1 -1
- package/build/codegen/transforms/paginate.d.ts +1 -1
- package/build/codegen/transforms/schema.d.ts +1 -1
- package/build/codegen/transforms/typename.d.ts +1 -1
- package/build/codegen/utils/commonjs.d.ts +2 -0
- package/build/codegen/utils/flattenSelections.d.ts +2 -2
- package/build/codegen/utils/moduleExport.d.ts +1 -1
- package/build/codegen/utils/objectIdentificationSelection.d.ts +1 -1
- package/build/codegen/validators/noIDAlias.d.ts +1 -1
- package/build/codegen/validators/typeCheck.d.ts +1 -1
- package/build/codegen-cjs/index.js +330 -1977
- package/build/codegen-esm/index.js +330 -1977
- package/build/lib/config.d.ts +8 -3
- package/build/lib/fs.d.ts +1 -1
- package/build/lib/graphql.d.ts +1 -1
- package/build/lib/imports.d.ts +1 -1
- package/build/lib/types.d.ts +3 -3
- package/build/lib/walk.d.ts +4 -4
- package/build/lib-cjs/index.js +145 -1846
- package/build/lib-esm/index.js +145 -1846
- package/build/runtime/cache/cache.d.ts +10 -8
- package/build/runtime/cache/gc.d.ts +1 -1
- package/build/runtime/cache/lists.d.ts +2 -2
- package/build/runtime/cache/schema.d.ts +2 -2
- package/build/runtime/cache/stuff.d.ts +2 -2
- package/build/runtime/cache/subscription.d.ts +19 -11
- package/build/runtime/client/documentStore.d.ts +87 -0
- package/build/runtime/client/index.d.ts +25 -0
- package/build/runtime/client/plugins/cache.d.ts +8 -0
- package/build/runtime/client/plugins/fetch.d.ts +37 -0
- package/build/runtime/client/plugins/fetchParams.d.ts +9 -0
- package/build/runtime/client/plugins/index.d.ts +7 -0
- package/build/runtime/client/plugins/injectedPlugins.d.ts +3 -0
- package/build/runtime/client/plugins/mutation.d.ts +1 -0
- package/build/runtime/client/plugins/query.d.ts +2 -0
- package/build/runtime/client/plugins/subscription.d.ts +18 -0
- package/build/runtime/client/plugins/throwOnError.d.ts +7 -0
- package/build/runtime/client/utils/documentPlugins.d.ts +3 -0
- package/build/runtime/client/utils/index.d.ts +1 -0
- package/build/runtime/imports/config.d.ts +3 -0
- package/build/runtime/index.d.ts +2 -1
- package/build/runtime/lib/config.d.ts +5 -3
- package/build/runtime/lib/index.d.ts +1 -2
- package/build/runtime/lib/scalars.d.ts +5 -4
- package/build/runtime/lib/selection.d.ts +1 -1
- package/build/runtime/lib/store.d.ts +19 -0
- package/build/runtime/lib/types.d.ts +22 -9
- package/build/runtime/public/cache.d.ts +2 -2
- package/build/runtime/public/list.d.ts +2 -2
- package/build/runtime/public/record.d.ts +1 -1
- package/build/runtime/public/tests/test.d.ts +1 -1
- package/build/runtime-cjs/cache/cache.d.ts +10 -8
- package/build/runtime-cjs/cache/cache.js +5 -11
- package/build/runtime-cjs/cache/gc.d.ts +1 -1
- package/build/runtime-cjs/cache/lists.d.ts +2 -2
- package/build/runtime-cjs/cache/lists.js +2 -2
- package/build/runtime-cjs/cache/schema.d.ts +2 -2
- package/build/runtime-cjs/cache/stuff.d.ts +2 -2
- package/build/runtime-cjs/cache/subscription.d.ts +19 -11
- package/build/runtime-cjs/cache/subscription.js +95 -56
- package/build/runtime-cjs/client/documentStore.d.ts +87 -0
- package/build/runtime-cjs/client/documentStore.js +360 -0
- package/build/runtime-cjs/client/index.d.ts +25 -0
- package/build/runtime-cjs/client/index.js +87 -0
- package/build/runtime-cjs/client/plugins/cache.d.ts +8 -0
- package/build/runtime-cjs/client/plugins/cache.js +99 -0
- package/build/runtime-cjs/client/plugins/fetch.d.ts +37 -0
- package/build/runtime-cjs/{lib/networkUtils.js → client/plugins/fetch.js} +95 -3
- package/build/runtime-cjs/client/plugins/fetchParams.d.ts +9 -0
- package/build/runtime-cjs/client/plugins/fetchParams.js +40 -0
- package/build/runtime-cjs/client/plugins/index.d.ts +7 -0
- package/build/runtime-cjs/client/plugins/index.js +24 -0
- package/build/runtime-cjs/client/plugins/injectedPlugins.d.ts +3 -0
- package/build/runtime-cjs/{lib/errors.js → client/plugins/injectedPlugins.js} +7 -15
- package/build/runtime-cjs/client/plugins/mutation.d.ts +1 -0
- package/build/runtime-cjs/client/plugins/mutation.js +86 -0
- package/build/runtime-cjs/client/plugins/query.d.ts +2 -0
- package/build/runtime-cjs/client/plugins/query.js +83 -0
- package/build/runtime-cjs/client/plugins/subscription.d.ts +18 -0
- package/build/runtime-cjs/client/plugins/subscription.js +98 -0
- package/build/runtime-cjs/client/plugins/throwOnError.d.ts +7 -0
- package/build/runtime-cjs/client/plugins/throwOnError.js +47 -0
- package/build/runtime-cjs/client/utils/documentPlugins.d.ts +3 -0
- package/build/runtime-cjs/client/utils/documentPlugins.js +56 -0
- package/build/runtime-cjs/client/utils/index.d.ts +1 -0
- package/build/runtime-cjs/client/utils/index.js +18 -0
- package/build/runtime-cjs/imports/config.d.ts +3 -0
- package/build/runtime-cjs/imports/config.js +26 -0
- package/build/runtime-cjs/index.d.ts +2 -1
- package/build/runtime-cjs/index.js +1 -0
- package/build/runtime-cjs/lib/config.d.ts +5 -3
- package/build/runtime-cjs/lib/config.js +5 -4
- package/build/runtime-cjs/lib/index.d.ts +1 -2
- package/build/runtime-cjs/lib/index.js +1 -2
- package/build/runtime-cjs/lib/scalars.d.ts +5 -4
- package/build/runtime-cjs/lib/scalars.js +20 -24
- package/build/runtime-cjs/lib/selection.d.ts +1 -1
- package/build/runtime-cjs/lib/store.d.ts +19 -0
- package/build/runtime-cjs/lib/store.js +81 -0
- package/build/runtime-cjs/lib/types.d.ts +22 -9
- package/build/runtime-cjs/public/cache.d.ts +2 -2
- package/build/runtime-cjs/public/list.d.ts +2 -2
- package/build/runtime-cjs/public/list.js +2 -2
- package/build/runtime-cjs/public/record.d.ts +1 -1
- package/build/runtime-cjs/public/record.js +4 -4
- package/build/runtime-cjs/public/tests/test.d.ts +1 -1
- package/build/runtime-esm/cache/cache.d.ts +10 -8
- package/build/runtime-esm/cache/cache.js +5 -11
- package/build/runtime-esm/cache/gc.d.ts +1 -1
- package/build/runtime-esm/cache/lists.d.ts +2 -2
- package/build/runtime-esm/cache/lists.js +2 -2
- package/build/runtime-esm/cache/schema.d.ts +2 -2
- package/build/runtime-esm/cache/stuff.d.ts +2 -2
- package/build/runtime-esm/cache/subscription.d.ts +19 -11
- package/build/runtime-esm/cache/subscription.js +95 -56
- package/build/runtime-esm/client/documentStore.d.ts +87 -0
- package/build/runtime-esm/client/documentStore.js +336 -0
- package/build/runtime-esm/client/index.d.ts +25 -0
- package/build/runtime-esm/client/index.js +58 -0
- package/build/runtime-esm/client/plugins/cache.d.ts +8 -0
- package/build/runtime-esm/client/plugins/cache.js +69 -0
- package/build/runtime-esm/client/plugins/fetch.d.ts +37 -0
- package/build/runtime-esm/client/plugins/fetch.js +151 -0
- package/build/runtime-esm/client/plugins/fetchParams.d.ts +9 -0
- package/build/runtime-esm/client/plugins/fetchParams.js +16 -0
- package/build/runtime-esm/client/plugins/index.d.ts +7 -0
- package/build/runtime-esm/client/plugins/index.js +7 -0
- package/build/runtime-esm/client/plugins/injectedPlugins.d.ts +3 -0
- package/build/runtime-esm/client/plugins/injectedPlugins.js +5 -0
- package/build/runtime-esm/client/plugins/mutation.d.ts +1 -0
- package/build/runtime-esm/client/plugins/mutation.js +56 -0
- package/build/runtime-esm/client/plugins/query.d.ts +2 -0
- package/build/runtime-esm/client/plugins/query.js +53 -0
- package/build/runtime-esm/client/plugins/subscription.d.ts +18 -0
- package/build/runtime-esm/client/plugins/subscription.js +74 -0
- package/build/runtime-esm/client/plugins/throwOnError.d.ts +7 -0
- package/build/runtime-esm/client/plugins/throwOnError.js +23 -0
- package/build/runtime-esm/client/utils/documentPlugins.d.ts +3 -0
- package/build/runtime-esm/client/utils/documentPlugins.js +32 -0
- package/build/runtime-esm/client/utils/index.d.ts +1 -0
- package/build/runtime-esm/client/utils/index.js +1 -0
- package/build/runtime-esm/imports/config.d.ts +3 -0
- package/build/runtime-esm/imports/config.js +4 -0
- package/build/runtime-esm/index.d.ts +2 -1
- package/build/runtime-esm/index.js +1 -0
- package/build/runtime-esm/lib/config.d.ts +5 -3
- package/build/runtime-esm/lib/config.js +5 -4
- package/build/runtime-esm/lib/index.d.ts +1 -2
- package/build/runtime-esm/lib/index.js +1 -2
- package/build/runtime-esm/lib/scalars.d.ts +5 -4
- package/build/runtime-esm/lib/scalars.js +20 -24
- package/build/runtime-esm/lib/selection.d.ts +1 -1
- package/build/runtime-esm/lib/store.d.ts +19 -0
- package/build/runtime-esm/lib/store.js +57 -0
- package/build/runtime-esm/lib/types.d.ts +22 -9
- package/build/runtime-esm/public/cache.d.ts +2 -2
- package/build/runtime-esm/public/list.d.ts +2 -2
- package/build/runtime-esm/public/list.js +1 -1
- package/build/runtime-esm/public/record.d.ts +1 -1
- package/build/runtime-esm/public/record.js +1 -1
- package/build/runtime-esm/public/tests/test.d.ts +1 -1
- package/build/test/index.d.ts +4 -3
- package/build/test-cjs/index.js +336 -1955
- package/build/test-esm/index.js +336 -1955
- package/build/vite/ast.d.ts +1 -1
- package/build/vite/houdini.d.ts +1 -1
- package/build/vite/imports.d.ts +3 -3
- package/build/vite/index.d.ts +1 -1
- package/build/vite/schema.d.ts +1 -1
- package/build/vite-cjs/index.js +396 -2010
- package/build/vite-esm/index.js +396 -2010
- package/package.json +1 -1
- package/build/runtime/lib/errors.d.ts +0 -3
- package/build/runtime/lib/network.d.ts +0 -79
- package/build/runtime/lib/networkUtils.d.ts +0 -8
- package/build/runtime-cjs/lib/errors.d.ts +0 -3
- package/build/runtime-cjs/lib/network.d.ts +0 -79
- package/build/runtime-cjs/lib/network.js +0 -200
- package/build/runtime-cjs/lib/networkUtils.d.ts +0 -8
- package/build/runtime-esm/lib/errors.d.ts +0 -3
- package/build/runtime-esm/lib/errors.js +0 -11
- package/build/runtime-esm/lib/network.d.ts +0 -79
- package/build/runtime-esm/lib/network.js +0 -170
- package/build/runtime-esm/lib/networkUtils.d.ts +0 -8
- package/build/runtime-esm/lib/networkUtils.js +0 -60
|
@@ -9515,18 +9515,18 @@ var require_execute = __commonJS({
|
|
|
9515
9515
|
}
|
|
9516
9516
|
var returnType = fieldDef.type;
|
|
9517
9517
|
var resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver;
|
|
9518
|
-
var
|
|
9518
|
+
var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path2);
|
|
9519
9519
|
try {
|
|
9520
9520
|
var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], exeContext.variableValues);
|
|
9521
9521
|
var _contextValue = exeContext.contextValue;
|
|
9522
|
-
var result = resolveFn(source, args, _contextValue,
|
|
9522
|
+
var result = resolveFn(source, args, _contextValue, info);
|
|
9523
9523
|
var completed;
|
|
9524
9524
|
if ((0, _isPromise.default)(result)) {
|
|
9525
9525
|
completed = result.then(function(resolved) {
|
|
9526
|
-
return completeValue(exeContext, returnType, fieldNodes,
|
|
9526
|
+
return completeValue(exeContext, returnType, fieldNodes, info, path2, resolved);
|
|
9527
9527
|
});
|
|
9528
9528
|
} else {
|
|
9529
|
-
completed = completeValue(exeContext, returnType, fieldNodes,
|
|
9529
|
+
completed = completeValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
9530
9530
|
}
|
|
9531
9531
|
if ((0, _isPromise.default)(completed)) {
|
|
9532
9532
|
return completed.then(void 0, function(rawError) {
|
|
@@ -9561,14 +9561,14 @@ var require_execute = __commonJS({
|
|
|
9561
9561
|
exeContext.errors.push(error);
|
|
9562
9562
|
return null;
|
|
9563
9563
|
}
|
|
9564
|
-
function completeValue(exeContext, returnType, fieldNodes,
|
|
9564
|
+
function completeValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
9565
9565
|
if (result instanceof Error) {
|
|
9566
9566
|
throw result;
|
|
9567
9567
|
}
|
|
9568
9568
|
if ((0, _definition.isNonNullType)(returnType)) {
|
|
9569
|
-
var completed = completeValue(exeContext, returnType.ofType, fieldNodes,
|
|
9569
|
+
var completed = completeValue(exeContext, returnType.ofType, fieldNodes, info, path2, result);
|
|
9570
9570
|
if (completed === null) {
|
|
9571
|
-
throw new Error("Cannot return null for non-nullable field ".concat(
|
|
9571
|
+
throw new Error("Cannot return null for non-nullable field ".concat(info.parentType.name, ".").concat(info.fieldName, "."));
|
|
9572
9572
|
}
|
|
9573
9573
|
return completed;
|
|
9574
9574
|
}
|
|
@@ -9576,20 +9576,20 @@ var require_execute = __commonJS({
|
|
|
9576
9576
|
return null;
|
|
9577
9577
|
}
|
|
9578
9578
|
if ((0, _definition.isListType)(returnType)) {
|
|
9579
|
-
return completeListValue(exeContext, returnType, fieldNodes,
|
|
9579
|
+
return completeListValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
9580
9580
|
}
|
|
9581
9581
|
if ((0, _definition.isLeafType)(returnType)) {
|
|
9582
9582
|
return completeLeafValue(returnType, result);
|
|
9583
9583
|
}
|
|
9584
9584
|
if ((0, _definition.isAbstractType)(returnType)) {
|
|
9585
|
-
return completeAbstractValue(exeContext, returnType, fieldNodes,
|
|
9585
|
+
return completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
9586
9586
|
}
|
|
9587
9587
|
if ((0, _definition.isObjectType)(returnType)) {
|
|
9588
|
-
return completeObjectValue(exeContext, returnType, fieldNodes,
|
|
9588
|
+
return completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
9589
9589
|
}
|
|
9590
9590
|
(0, _invariant.default)(0, "Cannot complete value of unexpected output type: " + (0, _inspect.default)(returnType));
|
|
9591
9591
|
}
|
|
9592
|
-
function completeListValue(exeContext, returnType, fieldNodes,
|
|
9592
|
+
function completeListValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
9593
9593
|
var itemType = returnType.ofType;
|
|
9594
9594
|
var containsPromise = false;
|
|
9595
9595
|
var completedResults = (0, _safeArrayFrom.default)(result, function(item, index) {
|
|
@@ -9598,10 +9598,10 @@ var require_execute = __commonJS({
|
|
|
9598
9598
|
var completedItem;
|
|
9599
9599
|
if ((0, _isPromise.default)(item)) {
|
|
9600
9600
|
completedItem = item.then(function(resolved) {
|
|
9601
|
-
return completeValue(exeContext, itemType, fieldNodes,
|
|
9601
|
+
return completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved);
|
|
9602
9602
|
});
|
|
9603
9603
|
} else {
|
|
9604
|
-
completedItem = completeValue(exeContext, itemType, fieldNodes,
|
|
9604
|
+
completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item);
|
|
9605
9605
|
}
|
|
9606
9606
|
if ((0, _isPromise.default)(completedItem)) {
|
|
9607
9607
|
containsPromise = true;
|
|
@@ -9617,7 +9617,7 @@ var require_execute = __commonJS({
|
|
|
9617
9617
|
}
|
|
9618
9618
|
});
|
|
9619
9619
|
if (completedResults == null) {
|
|
9620
|
-
throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(
|
|
9620
|
+
throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(info.parentType.name, ".").concat(info.fieldName, '".'));
|
|
9621
9621
|
}
|
|
9622
9622
|
return containsPromise ? Promise.all(completedResults) : completedResults;
|
|
9623
9623
|
}
|
|
@@ -9628,25 +9628,25 @@ var require_execute = __commonJS({
|
|
|
9628
9628
|
}
|
|
9629
9629
|
return serializedResult;
|
|
9630
9630
|
}
|
|
9631
|
-
function completeAbstractValue(exeContext, returnType, fieldNodes,
|
|
9631
|
+
function completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
9632
9632
|
var _returnType$resolveTy;
|
|
9633
9633
|
var resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver;
|
|
9634
9634
|
var contextValue = exeContext.contextValue;
|
|
9635
|
-
var runtimeType = resolveTypeFn(result, contextValue,
|
|
9635
|
+
var runtimeType = resolveTypeFn(result, contextValue, info, returnType);
|
|
9636
9636
|
if ((0, _isPromise.default)(runtimeType)) {
|
|
9637
9637
|
return runtimeType.then(function(resolvedRuntimeType) {
|
|
9638
|
-
return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes,
|
|
9638
|
+
return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
|
|
9639
9639
|
});
|
|
9640
9640
|
}
|
|
9641
|
-
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes,
|
|
9641
|
+
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
|
|
9642
9642
|
}
|
|
9643
|
-
function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes,
|
|
9643
|
+
function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info, result) {
|
|
9644
9644
|
if (runtimeTypeOrName == null) {
|
|
9645
|
-
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(
|
|
9645
|
+
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(info.parentType.name, ".").concat(info.fieldName, '". Either the "').concat(returnType.name, '" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.'), fieldNodes);
|
|
9646
9646
|
}
|
|
9647
9647
|
var runtimeTypeName = (0, _definition.isNamedType)(runtimeTypeOrName) ? runtimeTypeOrName.name : runtimeTypeOrName;
|
|
9648
9648
|
if (typeof runtimeTypeName !== "string") {
|
|
9649
|
-
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(
|
|
9649
|
+
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(info.parentType.name, ".").concat(info.fieldName, '" with ') + "value ".concat((0, _inspect.default)(result), ', received "').concat((0, _inspect.default)(runtimeTypeOrName), '".'));
|
|
9650
9650
|
}
|
|
9651
9651
|
var runtimeType = exeContext.schema.getType(runtimeTypeName);
|
|
9652
9652
|
if (runtimeType == null) {
|
|
@@ -9660,9 +9660,9 @@ var require_execute = __commonJS({
|
|
|
9660
9660
|
}
|
|
9661
9661
|
return runtimeType;
|
|
9662
9662
|
}
|
|
9663
|
-
function completeObjectValue(exeContext, returnType, fieldNodes,
|
|
9663
|
+
function completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
9664
9664
|
if (returnType.isTypeOf) {
|
|
9665
|
-
var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue,
|
|
9665
|
+
var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info);
|
|
9666
9666
|
if ((0, _isPromise.default)(isTypeOf)) {
|
|
9667
9667
|
return isTypeOf.then(function(resolvedIsTypeOf) {
|
|
9668
9668
|
if (!resolvedIsTypeOf) {
|
|
@@ -9696,16 +9696,16 @@ var require_execute = __commonJS({
|
|
|
9696
9696
|
}
|
|
9697
9697
|
return subFieldNodes;
|
|
9698
9698
|
}
|
|
9699
|
-
var defaultTypeResolver = function defaultTypeResolver2(value, contextValue,
|
|
9699
|
+
var defaultTypeResolver = function defaultTypeResolver2(value, contextValue, info, abstractType) {
|
|
9700
9700
|
if ((0, _isObjectLike.default)(value) && typeof value.__typename === "string") {
|
|
9701
9701
|
return value.__typename;
|
|
9702
9702
|
}
|
|
9703
|
-
var possibleTypes =
|
|
9703
|
+
var possibleTypes = info.schema.getPossibleTypes(abstractType);
|
|
9704
9704
|
var promisedIsTypeOfResults = [];
|
|
9705
9705
|
for (var i = 0; i < possibleTypes.length; i++) {
|
|
9706
9706
|
var type = possibleTypes[i];
|
|
9707
9707
|
if (type.isTypeOf) {
|
|
9708
|
-
var isTypeOfResult = type.isTypeOf(value, contextValue,
|
|
9708
|
+
var isTypeOfResult = type.isTypeOf(value, contextValue, info);
|
|
9709
9709
|
if ((0, _isPromise.default)(isTypeOfResult)) {
|
|
9710
9710
|
promisedIsTypeOfResults[i] = isTypeOfResult;
|
|
9711
9711
|
} else if (isTypeOfResult) {
|
|
@@ -9724,11 +9724,11 @@ var require_execute = __commonJS({
|
|
|
9724
9724
|
}
|
|
9725
9725
|
};
|
|
9726
9726
|
exports.defaultTypeResolver = defaultTypeResolver;
|
|
9727
|
-
var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue,
|
|
9727
|
+
var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue, info) {
|
|
9728
9728
|
if ((0, _isObjectLike.default)(source) || typeof source === "function") {
|
|
9729
|
-
var property = source[
|
|
9729
|
+
var property = source[info.fieldName];
|
|
9730
9730
|
if (typeof property === "function") {
|
|
9731
|
-
return source[
|
|
9731
|
+
return source[info.fieldName](args, contextValue, info);
|
|
9732
9732
|
}
|
|
9733
9733
|
return property;
|
|
9734
9734
|
}
|
|
@@ -9754,7 +9754,7 @@ var require_graphql = __commonJS({
|
|
|
9754
9754
|
Object.defineProperty(exports, "__esModule", {
|
|
9755
9755
|
value: true
|
|
9756
9756
|
});
|
|
9757
|
-
exports.graphql =
|
|
9757
|
+
exports.graphql = graphql26;
|
|
9758
9758
|
exports.graphqlSync = graphqlSync;
|
|
9759
9759
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
9760
9760
|
var _parser = require_parser();
|
|
@@ -9764,7 +9764,7 @@ var require_graphql = __commonJS({
|
|
|
9764
9764
|
function _interopRequireDefault(obj) {
|
|
9765
9765
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
9766
9766
|
}
|
|
9767
|
-
function
|
|
9767
|
+
function graphql26(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
9768
9768
|
var _arguments = arguments;
|
|
9769
9769
|
return new Promise(function(resolve2) {
|
|
9770
9770
|
return resolve2(
|
|
@@ -10748,13 +10748,13 @@ var require_subscribe = __commonJS({
|
|
|
10748
10748
|
throw new _GraphQLError.GraphQLError('The subscription field "'.concat(fieldName, '" is not defined.'), fieldNodes);
|
|
10749
10749
|
}
|
|
10750
10750
|
var path2 = (0, _Path.addPath)(void 0, responseName, type.name);
|
|
10751
|
-
var
|
|
10751
|
+
var info = (0, _execute.buildResolveInfo)(exeContext, fieldDef, fieldNodes, type, path2);
|
|
10752
10752
|
return new Promise(function(resolveResult) {
|
|
10753
10753
|
var _fieldDef$subscribe;
|
|
10754
10754
|
var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], variableValues);
|
|
10755
10755
|
var contextValue = exeContext.contextValue;
|
|
10756
10756
|
var resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.fieldResolver;
|
|
10757
|
-
resolveResult(resolveFn(rootValue, args, contextValue,
|
|
10757
|
+
resolveResult(resolveFn(rootValue, args, contextValue, info));
|
|
10758
10758
|
}).then(function(eventStream) {
|
|
10759
10759
|
if (eventStream instanceof Error) {
|
|
10760
10760
|
throw (0, _locatedError.locatedError)(eventStream, fieldNodes, (0, _Path.pathToArray)(path2));
|
|
@@ -20562,42 +20562,42 @@ var require_node = __commonJS({
|
|
|
20562
20562
|
return Link2;
|
|
20563
20563
|
}(events_1.EventEmitter);
|
|
20564
20564
|
exports.Link = Link;
|
|
20565
|
-
var
|
|
20566
|
-
function
|
|
20565
|
+
var File = function() {
|
|
20566
|
+
function File2(link, node, flags, fd) {
|
|
20567
20567
|
this.position = 0;
|
|
20568
20568
|
this.link = link;
|
|
20569
20569
|
this.node = node;
|
|
20570
20570
|
this.flags = flags;
|
|
20571
20571
|
this.fd = fd;
|
|
20572
20572
|
}
|
|
20573
|
-
|
|
20573
|
+
File2.prototype.getString = function(encoding) {
|
|
20574
20574
|
if (encoding === void 0) {
|
|
20575
20575
|
encoding = "utf8";
|
|
20576
20576
|
}
|
|
20577
20577
|
return this.node.getString();
|
|
20578
20578
|
};
|
|
20579
|
-
|
|
20579
|
+
File2.prototype.setString = function(str) {
|
|
20580
20580
|
this.node.setString(str);
|
|
20581
20581
|
};
|
|
20582
|
-
|
|
20582
|
+
File2.prototype.getBuffer = function() {
|
|
20583
20583
|
return this.node.getBuffer();
|
|
20584
20584
|
};
|
|
20585
|
-
|
|
20585
|
+
File2.prototype.setBuffer = function(buf) {
|
|
20586
20586
|
this.node.setBuffer(buf);
|
|
20587
20587
|
};
|
|
20588
|
-
|
|
20588
|
+
File2.prototype.getSize = function() {
|
|
20589
20589
|
return this.node.getSize();
|
|
20590
20590
|
};
|
|
20591
|
-
|
|
20591
|
+
File2.prototype.truncate = function(len) {
|
|
20592
20592
|
this.node.truncate(len);
|
|
20593
20593
|
};
|
|
20594
|
-
|
|
20594
|
+
File2.prototype.seekTo = function(position) {
|
|
20595
20595
|
this.position = position;
|
|
20596
20596
|
};
|
|
20597
|
-
|
|
20597
|
+
File2.prototype.stats = function() {
|
|
20598
20598
|
return Stats_1.default.build(this.node);
|
|
20599
20599
|
};
|
|
20600
|
-
|
|
20600
|
+
File2.prototype.write = function(buf, offset, length, position) {
|
|
20601
20601
|
if (offset === void 0) {
|
|
20602
20602
|
offset = 0;
|
|
20603
20603
|
}
|
|
@@ -20612,7 +20612,7 @@ var require_node = __commonJS({
|
|
|
20612
20612
|
this.position = position + bytes;
|
|
20613
20613
|
return bytes;
|
|
20614
20614
|
};
|
|
20615
|
-
|
|
20615
|
+
File2.prototype.read = function(buf, offset, length, position) {
|
|
20616
20616
|
if (offset === void 0) {
|
|
20617
20617
|
offset = 0;
|
|
20618
20618
|
}
|
|
@@ -20625,15 +20625,15 @@ var require_node = __commonJS({
|
|
|
20625
20625
|
this.position = position + bytes;
|
|
20626
20626
|
return bytes;
|
|
20627
20627
|
};
|
|
20628
|
-
|
|
20628
|
+
File2.prototype.chmod = function(perm) {
|
|
20629
20629
|
this.node.chmod(perm);
|
|
20630
20630
|
};
|
|
20631
|
-
|
|
20631
|
+
File2.prototype.chown = function(uid, gid) {
|
|
20632
20632
|
this.node.chown(uid, gid);
|
|
20633
20633
|
};
|
|
20634
|
-
return
|
|
20634
|
+
return File2;
|
|
20635
20635
|
}();
|
|
20636
|
-
exports.File =
|
|
20636
|
+
exports.File = File;
|
|
20637
20637
|
}
|
|
20638
20638
|
});
|
|
20639
20639
|
|
|
@@ -50021,18 +50021,18 @@ var require_lines = __commonJS({
|
|
|
50021
50021
|
assert_1.default.strictEqual(typeof pos, "object");
|
|
50022
50022
|
assert_1.default.strictEqual(typeof pos.line, "number");
|
|
50023
50023
|
assert_1.default.strictEqual(typeof pos.column, "number");
|
|
50024
|
-
var line = pos.line, column = pos.column, secret = this, infos = secret.infos,
|
|
50025
|
-
if (typeof
|
|
50024
|
+
var line = pos.line, column = pos.column, secret = this, infos = secret.infos, info = infos[line - 1], c = column;
|
|
50025
|
+
if (typeof info === "undefined" || c < 0)
|
|
50026
50026
|
return "";
|
|
50027
50027
|
var indent = this.getIndentAt(line);
|
|
50028
50028
|
if (c < indent)
|
|
50029
50029
|
return " ";
|
|
50030
|
-
c +=
|
|
50031
|
-
if (c ===
|
|
50030
|
+
c += info.sliceStart - indent;
|
|
50031
|
+
if (c === info.sliceEnd && line < this.length)
|
|
50032
50032
|
return "\n";
|
|
50033
|
-
if (c >=
|
|
50033
|
+
if (c >= info.sliceEnd)
|
|
50034
50034
|
return "";
|
|
50035
|
-
return
|
|
50035
|
+
return info.line.charAt(c);
|
|
50036
50036
|
};
|
|
50037
50037
|
Lines2.prototype.stripMargin = function(width, skipFirstLine) {
|
|
50038
50038
|
if (width === 0)
|
|
@@ -50040,11 +50040,11 @@ var require_lines = __commonJS({
|
|
|
50040
50040
|
assert_1.default.ok(width > 0, "negative margin: " + width);
|
|
50041
50041
|
if (skipFirstLine && this.length === 1)
|
|
50042
50042
|
return this;
|
|
50043
|
-
var lines = new Lines2(this.infos.map(function(
|
|
50044
|
-
if (
|
|
50045
|
-
|
|
50043
|
+
var lines = new Lines2(this.infos.map(function(info, i) {
|
|
50044
|
+
if (info.line && (i > 0 || !skipFirstLine)) {
|
|
50045
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: Math.max(0, info.indent - width) });
|
|
50046
50046
|
}
|
|
50047
|
-
return
|
|
50047
|
+
return info;
|
|
50048
50048
|
}));
|
|
50049
50049
|
if (this.mappings.length > 0) {
|
|
50050
50050
|
var newMappings_1 = lines.mappings;
|
|
@@ -50059,11 +50059,11 @@ var require_lines = __commonJS({
|
|
|
50059
50059
|
if (by === 0) {
|
|
50060
50060
|
return this;
|
|
50061
50061
|
}
|
|
50062
|
-
var lines = new Lines2(this.infos.map(function(
|
|
50063
|
-
if (
|
|
50064
|
-
|
|
50062
|
+
var lines = new Lines2(this.infos.map(function(info) {
|
|
50063
|
+
if (info.line && !info.locked) {
|
|
50064
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
|
|
50065
50065
|
}
|
|
50066
|
-
return
|
|
50066
|
+
return info;
|
|
50067
50067
|
}));
|
|
50068
50068
|
if (this.mappings.length > 0) {
|
|
50069
50069
|
var newMappings_2 = lines.mappings;
|
|
@@ -50081,11 +50081,11 @@ var require_lines = __commonJS({
|
|
|
50081
50081
|
if (this.length < 2) {
|
|
50082
50082
|
return this;
|
|
50083
50083
|
}
|
|
50084
|
-
var lines = new Lines2(this.infos.map(function(
|
|
50085
|
-
if (i > 0 &&
|
|
50086
|
-
|
|
50084
|
+
var lines = new Lines2(this.infos.map(function(info, i) {
|
|
50085
|
+
if (i > 0 && info.line && !info.locked) {
|
|
50086
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
|
|
50087
50087
|
}
|
|
50088
|
-
return
|
|
50088
|
+
return info;
|
|
50089
50089
|
}));
|
|
50090
50090
|
if (this.mappings.length > 0) {
|
|
50091
50091
|
var newMappings_3 = lines.mappings;
|
|
@@ -50100,8 +50100,8 @@ var require_lines = __commonJS({
|
|
|
50100
50100
|
if (this.length < 2) {
|
|
50101
50101
|
return this;
|
|
50102
50102
|
}
|
|
50103
|
-
return new Lines2(this.infos.map(function(
|
|
50104
|
-
return tslib_1.__assign(tslib_1.__assign({},
|
|
50103
|
+
return new Lines2(this.infos.map(function(info, i) {
|
|
50104
|
+
return tslib_1.__assign(tslib_1.__assign({}, info), { locked: i > 0 });
|
|
50105
50105
|
}));
|
|
50106
50106
|
};
|
|
50107
50107
|
Lines2.prototype.getIndentAt = function(line) {
|
|
@@ -50115,14 +50115,14 @@ var require_lines = __commonJS({
|
|
|
50115
50115
|
var counts = [];
|
|
50116
50116
|
var lastIndent = 0;
|
|
50117
50117
|
for (var line = 1, last = this.length; line <= last; ++line) {
|
|
50118
|
-
var
|
|
50119
|
-
var sliced =
|
|
50118
|
+
var info = this.infos[line - 1];
|
|
50119
|
+
var sliced = info.line.slice(info.sliceStart, info.sliceEnd);
|
|
50120
50120
|
if (isOnlyWhitespace(sliced)) {
|
|
50121
50121
|
continue;
|
|
50122
50122
|
}
|
|
50123
|
-
var diff = Math.abs(
|
|
50123
|
+
var diff = Math.abs(info.indent - lastIndent);
|
|
50124
50124
|
counts[diff] = ~~counts[diff] + 1;
|
|
50125
|
-
lastIndent =
|
|
50125
|
+
lastIndent = info.indent;
|
|
50126
50126
|
}
|
|
50127
50127
|
var maxCount = -1;
|
|
50128
50128
|
var result = 2;
|
|
@@ -50145,20 +50145,20 @@ var require_lines = __commonJS({
|
|
|
50145
50145
|
return isOnlyWhitespace(this.toString());
|
|
50146
50146
|
};
|
|
50147
50147
|
Lines2.prototype.isPrecededOnlyByWhitespace = function(pos) {
|
|
50148
|
-
var
|
|
50149
|
-
var indent = Math.max(
|
|
50148
|
+
var info = this.infos[pos.line - 1];
|
|
50149
|
+
var indent = Math.max(info.indent, 0);
|
|
50150
50150
|
var diff = pos.column - indent;
|
|
50151
50151
|
if (diff <= 0) {
|
|
50152
50152
|
return true;
|
|
50153
50153
|
}
|
|
50154
|
-
var start =
|
|
50155
|
-
var end = Math.min(start + diff,
|
|
50156
|
-
var prefix =
|
|
50154
|
+
var start = info.sliceStart;
|
|
50155
|
+
var end = Math.min(start + diff, info.sliceEnd);
|
|
50156
|
+
var prefix = info.line.slice(start, end);
|
|
50157
50157
|
return isOnlyWhitespace(prefix);
|
|
50158
50158
|
};
|
|
50159
50159
|
Lines2.prototype.getLineLength = function(line) {
|
|
50160
|
-
var
|
|
50161
|
-
return this.getIndentAt(line) +
|
|
50160
|
+
var info = this.infos[line - 1];
|
|
50161
|
+
return this.getIndentAt(line) + info.sliceEnd - info.sliceStart;
|
|
50162
50162
|
};
|
|
50163
50163
|
Lines2.prototype.nextPos = function(pos, skipSpaces) {
|
|
50164
50164
|
if (skipSpaces === void 0) {
|
|
@@ -50324,20 +50324,20 @@ var require_lines = __commonJS({
|
|
|
50324
50324
|
var _a = (0, options_1.normalize)(options), tabWidth = _a.tabWidth, useTabs = _a.useTabs, reuseWhitespace = _a.reuseWhitespace, lineTerminator = _a.lineTerminator;
|
|
50325
50325
|
var parts = [];
|
|
50326
50326
|
for (var line = start.line; line <= end.line; ++line) {
|
|
50327
|
-
var
|
|
50327
|
+
var info = this.infos[line - 1];
|
|
50328
50328
|
if (line === start.line) {
|
|
50329
50329
|
if (line === end.line) {
|
|
50330
|
-
|
|
50330
|
+
info = sliceInfo(info, start.column, end.column);
|
|
50331
50331
|
} else {
|
|
50332
|
-
|
|
50332
|
+
info = sliceInfo(info, start.column);
|
|
50333
50333
|
}
|
|
50334
50334
|
} else if (line === end.line) {
|
|
50335
|
-
|
|
50335
|
+
info = sliceInfo(info, 0, end.column);
|
|
50336
50336
|
}
|
|
50337
|
-
var indent = Math.max(
|
|
50338
|
-
var before_1 =
|
|
50337
|
+
var indent = Math.max(info.indent, 0);
|
|
50338
|
+
var before_1 = info.line.slice(0, info.sliceStart);
|
|
50339
50339
|
if (reuseWhitespace && isOnlyWhitespace(before_1) && countSpaces(before_1, tabWidth) === indent) {
|
|
50340
|
-
parts.push(
|
|
50340
|
+
parts.push(info.line.slice(0, info.sliceEnd));
|
|
50341
50341
|
continue;
|
|
50342
50342
|
}
|
|
50343
50343
|
var tabs = 0;
|
|
@@ -50353,7 +50353,7 @@ var require_lines = __commonJS({
|
|
|
50353
50353
|
if (spaces > 0) {
|
|
50354
50354
|
result += new Array(spaces + 1).join(" ");
|
|
50355
50355
|
}
|
|
50356
|
-
result +=
|
|
50356
|
+
result += info.line.slice(info.sliceStart, info.sliceEnd);
|
|
50357
50357
|
parts.push(result);
|
|
50358
50358
|
}
|
|
50359
50359
|
return parts.join(lineTerminator);
|
|
@@ -50371,12 +50371,12 @@ var require_lines = __commonJS({
|
|
|
50371
50371
|
return;
|
|
50372
50372
|
}
|
|
50373
50373
|
if (prevInfo) {
|
|
50374
|
-
var
|
|
50375
|
-
var indent = new Array(
|
|
50374
|
+
var info = linesOrNull.infos[0];
|
|
50375
|
+
var indent = new Array(info.indent + 1).join(" ");
|
|
50376
50376
|
var prevLine_1 = infos.length;
|
|
50377
50377
|
var prevColumn_1 = Math.max(prevInfo.indent, 0) + prevInfo.sliceEnd - prevInfo.sliceStart;
|
|
50378
|
-
prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent +
|
|
50379
|
-
prevInfo.locked = prevInfo.locked ||
|
|
50378
|
+
prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent + info.line.slice(info.sliceStart, info.sliceEnd);
|
|
50379
|
+
prevInfo.locked = prevInfo.locked || info.locked;
|
|
50380
50380
|
prevInfo.sliceEnd = prevInfo.line.length;
|
|
50381
50381
|
if (linesOrNull.mappings.length > 0) {
|
|
50382
50382
|
linesOrNull.mappings.forEach(function(mapping) {
|
|
@@ -50386,9 +50386,9 @@ var require_lines = __commonJS({
|
|
|
50386
50386
|
} else if (linesOrNull.mappings.length > 0) {
|
|
50387
50387
|
mappings.push.apply(mappings, linesOrNull.mappings);
|
|
50388
50388
|
}
|
|
50389
|
-
linesOrNull.infos.forEach(function(
|
|
50389
|
+
linesOrNull.infos.forEach(function(info2, i) {
|
|
50390
50390
|
if (!prevInfo || i > 0) {
|
|
50391
|
-
prevInfo = tslib_1.__assign({},
|
|
50391
|
+
prevInfo = tslib_1.__assign({}, info2);
|
|
50392
50392
|
infos.push(prevInfo);
|
|
50393
50393
|
}
|
|
50394
50394
|
});
|
|
@@ -50492,10 +50492,10 @@ var require_lines = __commonJS({
|
|
|
50492
50492
|
function isOnlyWhitespace(string) {
|
|
50493
50493
|
return !/\S/.test(string);
|
|
50494
50494
|
}
|
|
50495
|
-
function sliceInfo(
|
|
50496
|
-
var sliceStart =
|
|
50497
|
-
var sliceEnd =
|
|
50498
|
-
var indent = Math.max(
|
|
50495
|
+
function sliceInfo(info, startCol, endCol) {
|
|
50496
|
+
var sliceStart = info.sliceStart;
|
|
50497
|
+
var sliceEnd = info.sliceEnd;
|
|
50498
|
+
var indent = Math.max(info.indent, 0);
|
|
50499
50499
|
var lineLength = indent + sliceEnd - sliceStart;
|
|
50500
50500
|
if (typeof endCol === "undefined") {
|
|
50501
50501
|
endCol = lineLength;
|
|
@@ -50521,11 +50521,11 @@ var require_lines = __commonJS({
|
|
|
50521
50521
|
assert_1.default.ok(indent >= 0);
|
|
50522
50522
|
assert_1.default.ok(sliceStart <= sliceEnd);
|
|
50523
50523
|
assert_1.default.strictEqual(lineLength, indent + sliceEnd - sliceStart);
|
|
50524
|
-
if (
|
|
50525
|
-
return
|
|
50524
|
+
if (info.indent === indent && info.sliceStart === sliceStart && info.sliceEnd === sliceEnd) {
|
|
50525
|
+
return info;
|
|
50526
50526
|
}
|
|
50527
50527
|
return {
|
|
50528
|
-
line:
|
|
50528
|
+
line: info.line,
|
|
50529
50529
|
indent,
|
|
50530
50530
|
locked: false,
|
|
50531
50531
|
sliceStart,
|
|
@@ -53532,9 +53532,9 @@ var require_printer2 = __commonJS({
|
|
|
53532
53532
|
var prevTrailingSpace = null;
|
|
53533
53533
|
var len = filtered.length;
|
|
53534
53534
|
var parts = [];
|
|
53535
|
-
filtered.forEach(function(
|
|
53536
|
-
var printed =
|
|
53537
|
-
var stmt =
|
|
53535
|
+
filtered.forEach(function(info, i) {
|
|
53536
|
+
var printed = info.printed;
|
|
53537
|
+
var stmt = info.node;
|
|
53538
53538
|
var multiLine = printed.length > 1;
|
|
53539
53539
|
var notFirst = i > 0;
|
|
53540
53540
|
var notLast = i < len - 1;
|
|
@@ -53939,7 +53939,7 @@ __export(codegen_exports, {
|
|
|
53939
53939
|
runPipeline: () => runPipeline2
|
|
53940
53940
|
});
|
|
53941
53941
|
module.exports = __toCommonJS(codegen_exports);
|
|
53942
|
-
var
|
|
53942
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
53943
53943
|
|
|
53944
53944
|
// src/lib/pipeline.ts
|
|
53945
53945
|
async function runPipeline(config2, pipeline, target) {
|
|
@@ -53953,1746 +53953,9 @@ var import_minimatch = __toESM(require_minimatch(), 1);
|
|
|
53953
53953
|
var import_url = require("url");
|
|
53954
53954
|
|
|
53955
53955
|
// src/runtime/lib/config.ts
|
|
53956
|
-
function defaultConfigValues(file) {
|
|
53957
|
-
return {
|
|
53958
|
-
defaultKeys: ["id"],
|
|
53959
|
-
...file,
|
|
53960
|
-
types: {
|
|
53961
|
-
Node: {
|
|
53962
|
-
keys: ["id"],
|
|
53963
|
-
resolve: {
|
|
53964
|
-
queryField: "node",
|
|
53965
|
-
arguments: (node) => ({ id: node.id })
|
|
53966
|
-
}
|
|
53967
|
-
},
|
|
53968
|
-
...file.types
|
|
53969
|
-
}
|
|
53970
|
-
};
|
|
53971
|
-
}
|
|
53972
53956
|
function keyFieldsForType(configFile, type) {
|
|
53973
53957
|
return configFile.types?.[type]?.keys || configFile.defaultKeys;
|
|
53974
53958
|
}
|
|
53975
|
-
function computeID(configFile, type, data) {
|
|
53976
|
-
const fields = keyFieldsForType(configFile, type);
|
|
53977
|
-
let id = "";
|
|
53978
|
-
for (const field of fields) {
|
|
53979
|
-
id += data[field] + "__";
|
|
53980
|
-
}
|
|
53981
|
-
return id.slice(0, -2);
|
|
53982
|
-
}
|
|
53983
|
-
|
|
53984
|
-
// src/runtime/lib/deepEquals.ts
|
|
53985
|
-
function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
|
|
53986
|
-
if (Object.is(objA, objB))
|
|
53987
|
-
return true;
|
|
53988
|
-
if (objA instanceof Date && objB instanceof Date) {
|
|
53989
|
-
return objA.getTime() === objB.getTime();
|
|
53990
|
-
}
|
|
53991
|
-
if (objA instanceof RegExp && objB instanceof RegExp) {
|
|
53992
|
-
return objA.toString() === objB.toString();
|
|
53993
|
-
}
|
|
53994
|
-
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
|
53995
|
-
return false;
|
|
53996
|
-
}
|
|
53997
|
-
if (map.get(objA) === objB)
|
|
53998
|
-
return true;
|
|
53999
|
-
map.set(objA, objB);
|
|
54000
|
-
const keysA = Reflect.ownKeys(objA);
|
|
54001
|
-
const keysB = Reflect.ownKeys(objB);
|
|
54002
|
-
if (keysA.length !== keysB.length) {
|
|
54003
|
-
return false;
|
|
54004
|
-
}
|
|
54005
|
-
for (let i = 0; i < keysA.length; i++) {
|
|
54006
|
-
if (!Reflect.has(objB, keysA[i]) || !deepEquals(objA[keysA[i]], objB[keysA[i]], map)) {
|
|
54007
|
-
return false;
|
|
54008
|
-
}
|
|
54009
|
-
}
|
|
54010
|
-
return true;
|
|
54011
|
-
}
|
|
54012
|
-
|
|
54013
|
-
// src/runtime/lib/selection.ts
|
|
54014
|
-
function getFieldsForType(selection2, __typename) {
|
|
54015
|
-
let targetSelection = selection2.fields || {};
|
|
54016
|
-
if (selection2.abstractFields && __typename) {
|
|
54017
|
-
const mappedType = selection2.abstractFields.typeMap[__typename];
|
|
54018
|
-
if (mappedType) {
|
|
54019
|
-
targetSelection = selection2.abstractFields.fields[mappedType];
|
|
54020
|
-
} else if (selection2.abstractFields.fields[__typename]) {
|
|
54021
|
-
targetSelection = selection2.abstractFields.fields[__typename];
|
|
54022
|
-
}
|
|
54023
|
-
}
|
|
54024
|
-
return targetSelection;
|
|
54025
|
-
}
|
|
54026
|
-
|
|
54027
|
-
// src/runtime/cache/gc.ts
|
|
54028
|
-
var GarbageCollector = class {
|
|
54029
|
-
cache;
|
|
54030
|
-
lifetimes = /* @__PURE__ */ new Map();
|
|
54031
|
-
get cacheBufferSize() {
|
|
54032
|
-
return this.cache._internal_unstable.config.cacheBufferSize ?? 10;
|
|
54033
|
-
}
|
|
54034
|
-
constructor(cache) {
|
|
54035
|
-
this.cache = cache;
|
|
54036
|
-
}
|
|
54037
|
-
resetLifetime(id, field) {
|
|
54038
|
-
if (!this.lifetimes.get(id)) {
|
|
54039
|
-
this.lifetimes.set(id, /* @__PURE__ */ new Map());
|
|
54040
|
-
}
|
|
54041
|
-
this.lifetimes.get(id).set(field, 0);
|
|
54042
|
-
}
|
|
54043
|
-
tick() {
|
|
54044
|
-
for (const [id, fieldMap] of this.lifetimes.entries()) {
|
|
54045
|
-
for (const [field, lifetime] of fieldMap.entries()) {
|
|
54046
|
-
if (this.cache._internal_unstable.subscriptions.get(id, field).length > 0) {
|
|
54047
|
-
continue;
|
|
54048
|
-
}
|
|
54049
|
-
fieldMap.set(field, lifetime + 1);
|
|
54050
|
-
if (fieldMap.get(field) > this.cacheBufferSize) {
|
|
54051
|
-
this.cache._internal_unstable.storage.deleteField(id, field);
|
|
54052
|
-
this.cache._internal_unstable.lists.deleteField(id, field);
|
|
54053
|
-
fieldMap.delete(field);
|
|
54054
|
-
if ([...fieldMap.keys()].length === 0) {
|
|
54055
|
-
this.lifetimes.delete(id);
|
|
54056
|
-
}
|
|
54057
|
-
}
|
|
54058
|
-
}
|
|
54059
|
-
}
|
|
54060
|
-
}
|
|
54061
|
-
};
|
|
54062
|
-
|
|
54063
|
-
// src/runtime/cache/stuff.ts
|
|
54064
|
-
function flattenList(source) {
|
|
54065
|
-
const flat = [];
|
|
54066
|
-
const unvisited = [source || []];
|
|
54067
|
-
while (unvisited.length > 0) {
|
|
54068
|
-
const target = unvisited.shift();
|
|
54069
|
-
for (const id of target) {
|
|
54070
|
-
if (Array.isArray(id)) {
|
|
54071
|
-
unvisited.push(id);
|
|
54072
|
-
continue;
|
|
54073
|
-
}
|
|
54074
|
-
flat.push(id);
|
|
54075
|
-
}
|
|
54076
|
-
}
|
|
54077
|
-
return flat;
|
|
54078
|
-
}
|
|
54079
|
-
function evaluateKey(key, variables = {}) {
|
|
54080
|
-
let evaluated = "";
|
|
54081
|
-
let varName = "";
|
|
54082
|
-
let inString = false;
|
|
54083
|
-
for (const char of key) {
|
|
54084
|
-
if (varName) {
|
|
54085
|
-
if (varChars.includes(char)) {
|
|
54086
|
-
varName += char;
|
|
54087
|
-
continue;
|
|
54088
|
-
}
|
|
54089
|
-
const value = variables[varName.slice(1)];
|
|
54090
|
-
evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
|
|
54091
|
-
varName = "";
|
|
54092
|
-
}
|
|
54093
|
-
if (char === "$" && !inString) {
|
|
54094
|
-
varName = "$";
|
|
54095
|
-
continue;
|
|
54096
|
-
}
|
|
54097
|
-
if (char === '"') {
|
|
54098
|
-
inString = !inString;
|
|
54099
|
-
}
|
|
54100
|
-
evaluated += char;
|
|
54101
|
-
}
|
|
54102
|
-
return evaluated;
|
|
54103
|
-
}
|
|
54104
|
-
var varChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
|
|
54105
|
-
|
|
54106
|
-
// src/runtime/cache/lists.ts
|
|
54107
|
-
var ListManager = class {
|
|
54108
|
-
rootID;
|
|
54109
|
-
cache;
|
|
54110
|
-
constructor(cache, rootID2) {
|
|
54111
|
-
this.rootID = rootID2;
|
|
54112
|
-
this.cache = cache;
|
|
54113
|
-
}
|
|
54114
|
-
lists = /* @__PURE__ */ new Map();
|
|
54115
|
-
listsByField = /* @__PURE__ */ new Map();
|
|
54116
|
-
get(listName, id, allLists) {
|
|
54117
|
-
const matches = this.lists.get(listName);
|
|
54118
|
-
if (!matches || matches.size === 0) {
|
|
54119
|
-
return null;
|
|
54120
|
-
}
|
|
54121
|
-
if (allLists) {
|
|
54122
|
-
return new ListCollection(
|
|
54123
|
-
Array.from(matches, ([key, value]) => [...value.lists]).flat()
|
|
54124
|
-
);
|
|
54125
|
-
}
|
|
54126
|
-
const head = [...matches.values()][0];
|
|
54127
|
-
const { recordType } = head.lists[0];
|
|
54128
|
-
const parentID = id ? this.cache._internal_unstable.id(recordType || "", id) : this.rootID;
|
|
54129
|
-
if (matches?.size === 1) {
|
|
54130
|
-
if (!id) {
|
|
54131
|
-
return head;
|
|
54132
|
-
}
|
|
54133
|
-
return parentID === Array.from(matches.keys())[0] ? head : null;
|
|
54134
|
-
}
|
|
54135
|
-
if (!id) {
|
|
54136
|
-
console.error(
|
|
54137
|
-
`Found multiple instances of "${listName}". Please provide one of @parentID or @allLists directives to help identify which list you want modify. For more information, visit this guide: https://www.houdinigraphql.com/api/graphql#parentidvalue-string `
|
|
54138
|
-
);
|
|
54139
|
-
return null;
|
|
54140
|
-
}
|
|
54141
|
-
return this.lists.get(listName)?.get(parentID);
|
|
54142
|
-
}
|
|
54143
|
-
remove(listName, id) {
|
|
54144
|
-
this.lists.get(listName)?.delete(id || this.rootID);
|
|
54145
|
-
}
|
|
54146
|
-
add(list) {
|
|
54147
|
-
if (!this.lists.has(list.name)) {
|
|
54148
|
-
this.lists.set(list.name, /* @__PURE__ */ new Map());
|
|
54149
|
-
}
|
|
54150
|
-
const name2 = list.name;
|
|
54151
|
-
const parentID = list.recordID || this.rootID;
|
|
54152
|
-
if (this.lists.get(name2)?.get(parentID)?.includes(list.key)) {
|
|
54153
|
-
return;
|
|
54154
|
-
}
|
|
54155
|
-
if (!this.lists.has(name2)) {
|
|
54156
|
-
this.lists.set(name2, /* @__PURE__ */ new Map());
|
|
54157
|
-
}
|
|
54158
|
-
if (!this.lists.get(name2).has(parentID)) {
|
|
54159
|
-
this.lists.get(name2).set(parentID, new ListCollection([]));
|
|
54160
|
-
}
|
|
54161
|
-
if (!this.listsByField.has(parentID)) {
|
|
54162
|
-
this.listsByField.set(parentID, /* @__PURE__ */ new Map());
|
|
54163
|
-
}
|
|
54164
|
-
if (!this.listsByField.get(parentID).has(list.key)) {
|
|
54165
|
-
this.listsByField.get(parentID)?.set(list.key, []);
|
|
54166
|
-
}
|
|
54167
|
-
const handler = new List({ ...list, manager: this });
|
|
54168
|
-
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
54169
|
-
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
54170
|
-
}
|
|
54171
|
-
removeIDFromAllLists(id) {
|
|
54172
|
-
for (const fieldMap of this.lists.values()) {
|
|
54173
|
-
for (const list of fieldMap.values()) {
|
|
54174
|
-
list.removeID(id);
|
|
54175
|
-
}
|
|
54176
|
-
}
|
|
54177
|
-
}
|
|
54178
|
-
deleteField(parentID, field) {
|
|
54179
|
-
if (!this.listsByField.get(parentID)?.has(field)) {
|
|
54180
|
-
return;
|
|
54181
|
-
}
|
|
54182
|
-
for (const list of this.listsByField.get(parentID).get(field)) {
|
|
54183
|
-
this.lists.get(list.name)?.get(list.recordID)?.deleteListWithKey(field);
|
|
54184
|
-
if (this.lists.get(list.name)?.get(list.recordID)?.lists.length === 0) {
|
|
54185
|
-
this.lists.get(list.name)?.delete(list.recordID);
|
|
54186
|
-
}
|
|
54187
|
-
}
|
|
54188
|
-
this.listsByField.get(parentID).delete(field);
|
|
54189
|
-
}
|
|
54190
|
-
};
|
|
54191
|
-
var List = class {
|
|
54192
|
-
recordID;
|
|
54193
|
-
recordType;
|
|
54194
|
-
key;
|
|
54195
|
-
type;
|
|
54196
|
-
cache;
|
|
54197
|
-
selection;
|
|
54198
|
-
_when;
|
|
54199
|
-
filters;
|
|
54200
|
-
name;
|
|
54201
|
-
connection;
|
|
54202
|
-
manager;
|
|
54203
|
-
abstract;
|
|
54204
|
-
constructor({
|
|
54205
|
-
name: name2,
|
|
54206
|
-
recordID,
|
|
54207
|
-
recordType,
|
|
54208
|
-
key,
|
|
54209
|
-
listType,
|
|
54210
|
-
selection: selection2,
|
|
54211
|
-
when,
|
|
54212
|
-
filters,
|
|
54213
|
-
connection,
|
|
54214
|
-
manager,
|
|
54215
|
-
abstract
|
|
54216
|
-
}) {
|
|
54217
|
-
this.recordID = recordID || rootID;
|
|
54218
|
-
this.recordType = recordType;
|
|
54219
|
-
this.key = key;
|
|
54220
|
-
this.type = listType;
|
|
54221
|
-
this.cache = manager.cache;
|
|
54222
|
-
this.selection = selection2;
|
|
54223
|
-
this._when = when;
|
|
54224
|
-
this.filters = filters;
|
|
54225
|
-
this.name = name2;
|
|
54226
|
-
this.connection = connection;
|
|
54227
|
-
this.manager = manager;
|
|
54228
|
-
this.abstract = abstract;
|
|
54229
|
-
}
|
|
54230
|
-
when(when) {
|
|
54231
|
-
return this.manager.lists.get(this.name).get(this.recordID).when(when);
|
|
54232
|
-
}
|
|
54233
|
-
append(selection2, data, variables = {}) {
|
|
54234
|
-
return this.addToList(selection2, data, variables, "last");
|
|
54235
|
-
}
|
|
54236
|
-
prepend(selection2, data, variables = {}) {
|
|
54237
|
-
return this.addToList(selection2, data, variables, "first");
|
|
54238
|
-
}
|
|
54239
|
-
addToList(selection2, data, variables = {}, where) {
|
|
54240
|
-
const listType = this.listType(data);
|
|
54241
|
-
const dataID = this.cache._internal_unstable.id(listType, data);
|
|
54242
|
-
if (!this.validateWhen() || !dataID) {
|
|
54243
|
-
return;
|
|
54244
|
-
}
|
|
54245
|
-
let insertSelection = selection2;
|
|
54246
|
-
let insertData = data;
|
|
54247
|
-
if (this.connection) {
|
|
54248
|
-
insertSelection = {
|
|
54249
|
-
fields: {
|
|
54250
|
-
newEntry: {
|
|
54251
|
-
keyRaw: this.key,
|
|
54252
|
-
type: "Connection",
|
|
54253
|
-
selection: {
|
|
54254
|
-
fields: {
|
|
54255
|
-
edges: {
|
|
54256
|
-
keyRaw: "edges",
|
|
54257
|
-
type: "ConnectionEdge",
|
|
54258
|
-
update: where === "first" ? "prepend" : "append",
|
|
54259
|
-
selection: {
|
|
54260
|
-
fields: {
|
|
54261
|
-
node: {
|
|
54262
|
-
type: listType,
|
|
54263
|
-
keyRaw: "node",
|
|
54264
|
-
selection: {
|
|
54265
|
-
...selection2,
|
|
54266
|
-
fields: {
|
|
54267
|
-
...selection2.fields,
|
|
54268
|
-
__typename: {
|
|
54269
|
-
keyRaw: "__typename",
|
|
54270
|
-
type: "String"
|
|
54271
|
-
}
|
|
54272
|
-
}
|
|
54273
|
-
}
|
|
54274
|
-
}
|
|
54275
|
-
}
|
|
54276
|
-
}
|
|
54277
|
-
}
|
|
54278
|
-
}
|
|
54279
|
-
}
|
|
54280
|
-
}
|
|
54281
|
-
}
|
|
54282
|
-
};
|
|
54283
|
-
insertData = {
|
|
54284
|
-
newEntry: {
|
|
54285
|
-
edges: [{ node: { ...data, __typename: listType } }]
|
|
54286
|
-
}
|
|
54287
|
-
};
|
|
54288
|
-
} else {
|
|
54289
|
-
insertSelection = {
|
|
54290
|
-
fields: {
|
|
54291
|
-
newEntries: {
|
|
54292
|
-
keyRaw: this.key,
|
|
54293
|
-
type: listType,
|
|
54294
|
-
update: where === "first" ? "prepend" : "append",
|
|
54295
|
-
selection: {
|
|
54296
|
-
...selection2,
|
|
54297
|
-
fields: {
|
|
54298
|
-
...selection2.fields,
|
|
54299
|
-
__typename: {
|
|
54300
|
-
keyRaw: "__typename",
|
|
54301
|
-
type: "String"
|
|
54302
|
-
}
|
|
54303
|
-
}
|
|
54304
|
-
}
|
|
54305
|
-
}
|
|
54306
|
-
}
|
|
54307
|
-
};
|
|
54308
|
-
insertData = {
|
|
54309
|
-
newEntries: [{ ...data, __typename: listType }]
|
|
54310
|
-
};
|
|
54311
|
-
}
|
|
54312
|
-
this.cache.write({
|
|
54313
|
-
selection: insertSelection,
|
|
54314
|
-
data: insertData,
|
|
54315
|
-
variables,
|
|
54316
|
-
parent: this.recordID,
|
|
54317
|
-
applyUpdates: true
|
|
54318
|
-
});
|
|
54319
|
-
}
|
|
54320
|
-
removeID(id, variables = {}) {
|
|
54321
|
-
if (!this.validateWhen()) {
|
|
54322
|
-
return;
|
|
54323
|
-
}
|
|
54324
|
-
let parentID = this.recordID;
|
|
54325
|
-
let targetID = id;
|
|
54326
|
-
let targetKey = this.key;
|
|
54327
|
-
if (this.connection) {
|
|
54328
|
-
const { value: embeddedConnection } = this.cache._internal_unstable.storage.get(
|
|
54329
|
-
this.recordID,
|
|
54330
|
-
this.key
|
|
54331
|
-
);
|
|
54332
|
-
if (!embeddedConnection) {
|
|
54333
|
-
return;
|
|
54334
|
-
}
|
|
54335
|
-
const embeddedConnectionID = embeddedConnection;
|
|
54336
|
-
const { value: edges } = this.cache._internal_unstable.storage.get(
|
|
54337
|
-
embeddedConnectionID,
|
|
54338
|
-
"edges"
|
|
54339
|
-
);
|
|
54340
|
-
for (const edge of flattenList(edges) || []) {
|
|
54341
|
-
if (!edge) {
|
|
54342
|
-
continue;
|
|
54343
|
-
}
|
|
54344
|
-
const edgeID = edge;
|
|
54345
|
-
const { value: nodeID } = this.cache._internal_unstable.storage.get(edgeID, "node");
|
|
54346
|
-
if (!nodeID) {
|
|
54347
|
-
continue;
|
|
54348
|
-
}
|
|
54349
|
-
if (nodeID === id) {
|
|
54350
|
-
targetID = edgeID;
|
|
54351
|
-
}
|
|
54352
|
-
}
|
|
54353
|
-
parentID = embeddedConnectionID;
|
|
54354
|
-
targetKey = "edges";
|
|
54355
|
-
}
|
|
54356
|
-
let value = this.cache._internal_unstable.storage.get(parentID, targetKey).value;
|
|
54357
|
-
if (!value || !value.includes(targetID)) {
|
|
54358
|
-
return;
|
|
54359
|
-
}
|
|
54360
|
-
const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
|
|
54361
|
-
this.cache._internal_unstable.subscriptions.remove(
|
|
54362
|
-
targetID,
|
|
54363
|
-
this.connection ? this.selection.fields.edges.selection : this.selection,
|
|
54364
|
-
subscribers,
|
|
54365
|
-
variables
|
|
54366
|
-
);
|
|
54367
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
54368
|
-
for (const spec of subscribers) {
|
|
54369
|
-
spec.set(
|
|
54370
|
-
this.cache._internal_unstable.getSelection({
|
|
54371
|
-
parent: spec.parentID || this.manager.rootID,
|
|
54372
|
-
selection: spec.selection,
|
|
54373
|
-
variables: spec.variables?.() || {}
|
|
54374
|
-
}).data
|
|
54375
|
-
);
|
|
54376
|
-
}
|
|
54377
|
-
return true;
|
|
54378
|
-
}
|
|
54379
|
-
remove(data, variables = {}) {
|
|
54380
|
-
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
54381
|
-
if (!targetID) {
|
|
54382
|
-
return;
|
|
54383
|
-
}
|
|
54384
|
-
return this.removeID(targetID, variables);
|
|
54385
|
-
}
|
|
54386
|
-
listType(data) {
|
|
54387
|
-
return data.__typename || this.type;
|
|
54388
|
-
}
|
|
54389
|
-
validateWhen(when) {
|
|
54390
|
-
let filters = when || this._when;
|
|
54391
|
-
let ok = true;
|
|
54392
|
-
if (filters) {
|
|
54393
|
-
const targets = this.filters;
|
|
54394
|
-
if (filters.must && targets) {
|
|
54395
|
-
ok = Object.entries(filters.must).reduce(
|
|
54396
|
-
(prev, [key, value]) => Boolean(prev && targets[key] == value),
|
|
54397
|
-
ok
|
|
54398
|
-
);
|
|
54399
|
-
}
|
|
54400
|
-
if (filters.must_not) {
|
|
54401
|
-
ok = !targets || Object.entries(filters.must_not).reduce(
|
|
54402
|
-
(prev, [key, value]) => Boolean(prev && targets[key] != value),
|
|
54403
|
-
ok
|
|
54404
|
-
);
|
|
54405
|
-
}
|
|
54406
|
-
}
|
|
54407
|
-
return ok;
|
|
54408
|
-
}
|
|
54409
|
-
toggleElement(selection2, data, variables = {}, where) {
|
|
54410
|
-
if (!this.remove(data, variables)) {
|
|
54411
|
-
this.addToList(selection2, data, variables, where);
|
|
54412
|
-
}
|
|
54413
|
-
}
|
|
54414
|
-
*[Symbol.iterator]() {
|
|
54415
|
-
let entries = [];
|
|
54416
|
-
let value = this.cache._internal_unstable.storage.get(this.recordID, this.key).value;
|
|
54417
|
-
if (!this.connection) {
|
|
54418
|
-
entries = flattenList(value);
|
|
54419
|
-
} else {
|
|
54420
|
-
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
54421
|
-
}
|
|
54422
|
-
for (let record2 of entries) {
|
|
54423
|
-
yield record2;
|
|
54424
|
-
}
|
|
54425
|
-
}
|
|
54426
|
-
};
|
|
54427
|
-
var ListCollection = class {
|
|
54428
|
-
lists = [];
|
|
54429
|
-
constructor(lists) {
|
|
54430
|
-
this.lists = lists;
|
|
54431
|
-
}
|
|
54432
|
-
append(...args) {
|
|
54433
|
-
this.lists.forEach((list) => list.append(...args));
|
|
54434
|
-
}
|
|
54435
|
-
prepend(...args) {
|
|
54436
|
-
this.lists.forEach((list) => list.prepend(...args));
|
|
54437
|
-
}
|
|
54438
|
-
addToList(...args) {
|
|
54439
|
-
this.lists.forEach((list) => list.addToList(...args));
|
|
54440
|
-
}
|
|
54441
|
-
removeID(...args) {
|
|
54442
|
-
this.lists.forEach((list) => list.removeID(...args));
|
|
54443
|
-
}
|
|
54444
|
-
remove(...args) {
|
|
54445
|
-
this.lists.forEach((list) => list.remove(...args));
|
|
54446
|
-
}
|
|
54447
|
-
toggleElement(...args) {
|
|
54448
|
-
this.lists.forEach((list) => list.toggleElement(...args));
|
|
54449
|
-
}
|
|
54450
|
-
when(when) {
|
|
54451
|
-
return new ListCollection(
|
|
54452
|
-
this.lists.filter((list) => {
|
|
54453
|
-
return list.validateWhen(when);
|
|
54454
|
-
})
|
|
54455
|
-
);
|
|
54456
|
-
}
|
|
54457
|
-
includes(key) {
|
|
54458
|
-
return !!this.lists.find((list) => list.key === key);
|
|
54459
|
-
}
|
|
54460
|
-
deleteListWithKey(key) {
|
|
54461
|
-
return this.lists = this.lists.filter((list) => list.key !== key);
|
|
54462
|
-
}
|
|
54463
|
-
*[Symbol.iterator]() {
|
|
54464
|
-
for (let list of this.lists) {
|
|
54465
|
-
for (const entry of list) {
|
|
54466
|
-
yield entry;
|
|
54467
|
-
}
|
|
54468
|
-
}
|
|
54469
|
-
}
|
|
54470
|
-
};
|
|
54471
|
-
|
|
54472
|
-
// src/runtime/cache/schema.ts
|
|
54473
|
-
var SchemaManager = class {
|
|
54474
|
-
cache;
|
|
54475
|
-
fieldTypes = {};
|
|
54476
|
-
constructor(cache) {
|
|
54477
|
-
this.cache = cache;
|
|
54478
|
-
}
|
|
54479
|
-
setFieldType({
|
|
54480
|
-
parent,
|
|
54481
|
-
key,
|
|
54482
|
-
type,
|
|
54483
|
-
nullable = false,
|
|
54484
|
-
link
|
|
54485
|
-
}) {
|
|
54486
|
-
let parensIndex = key.indexOf("(");
|
|
54487
|
-
if (parensIndex !== -1) {
|
|
54488
|
-
key = key.substring(0, parensIndex);
|
|
54489
|
-
}
|
|
54490
|
-
if (parent === rootID) {
|
|
54491
|
-
parent = "Query";
|
|
54492
|
-
} else if (parent.includes(":")) {
|
|
54493
|
-
parent = parent.substring(0, parent.indexOf(":"));
|
|
54494
|
-
}
|
|
54495
|
-
if (!this.fieldTypes[parent]) {
|
|
54496
|
-
this.fieldTypes[parent] = {};
|
|
54497
|
-
}
|
|
54498
|
-
this.fieldTypes[parent][key] = {
|
|
54499
|
-
type,
|
|
54500
|
-
nullable,
|
|
54501
|
-
link: !!link
|
|
54502
|
-
};
|
|
54503
|
-
}
|
|
54504
|
-
fieldType(type, field) {
|
|
54505
|
-
return this.fieldTypes[type]?.[field] || null;
|
|
54506
|
-
}
|
|
54507
|
-
get config() {
|
|
54508
|
-
return this.cache._internal_unstable.config;
|
|
54509
|
-
}
|
|
54510
|
-
};
|
|
54511
|
-
|
|
54512
|
-
// src/runtime/cache/storage.ts
|
|
54513
|
-
var InMemoryStorage = class {
|
|
54514
|
-
data;
|
|
54515
|
-
idCount = 0;
|
|
54516
|
-
rank = 0;
|
|
54517
|
-
constructor() {
|
|
54518
|
-
this.data = [];
|
|
54519
|
-
}
|
|
54520
|
-
get layerCount() {
|
|
54521
|
-
return this.data.length;
|
|
54522
|
-
}
|
|
54523
|
-
get nextRank() {
|
|
54524
|
-
return this.rank++;
|
|
54525
|
-
}
|
|
54526
|
-
createLayer(optimistic = false) {
|
|
54527
|
-
const layer = new Layer(this.idCount++);
|
|
54528
|
-
layer.optimistic = optimistic;
|
|
54529
|
-
this.data.push(layer);
|
|
54530
|
-
return layer;
|
|
54531
|
-
}
|
|
54532
|
-
insert(id, field, location, target) {
|
|
54533
|
-
return this.topLayer.insert(id, field, location, target);
|
|
54534
|
-
}
|
|
54535
|
-
remove(id, field, target) {
|
|
54536
|
-
return this.topLayer.remove(id, field, target);
|
|
54537
|
-
}
|
|
54538
|
-
delete(id) {
|
|
54539
|
-
return this.topLayer.delete(id);
|
|
54540
|
-
}
|
|
54541
|
-
deleteField(id, field) {
|
|
54542
|
-
return this.topLayer.deleteField(id, field);
|
|
54543
|
-
}
|
|
54544
|
-
getLayer(id) {
|
|
54545
|
-
for (const layer of this.data) {
|
|
54546
|
-
if (layer.id === id) {
|
|
54547
|
-
return layer;
|
|
54548
|
-
}
|
|
54549
|
-
}
|
|
54550
|
-
throw new Error("Could not find layer with id: " + id);
|
|
54551
|
-
}
|
|
54552
|
-
replaceID(replacement) {
|
|
54553
|
-
for (const layer of this.data) {
|
|
54554
|
-
layer.replaceID(replacement);
|
|
54555
|
-
}
|
|
54556
|
-
}
|
|
54557
|
-
get(id, field) {
|
|
54558
|
-
const operations = {
|
|
54559
|
-
[OperationKind.insert]: {
|
|
54560
|
-
[OperationLocation.start]: [],
|
|
54561
|
-
[OperationLocation.end]: []
|
|
54562
|
-
},
|
|
54563
|
-
[OperationKind.remove]: /* @__PURE__ */ new Set()
|
|
54564
|
-
};
|
|
54565
|
-
const layerIDs = [];
|
|
54566
|
-
for (let i = this.data.length - 1; i >= 0; i--) {
|
|
54567
|
-
const layer = this.data[i];
|
|
54568
|
-
const [layerValue, kind] = layer.get(id, field);
|
|
54569
|
-
const layerOperations = layer.getOperations(id, field) || [];
|
|
54570
|
-
layer.deletedIDs.forEach((v) => {
|
|
54571
|
-
if (layer.operations[v]?.undoDeletesInList?.includes(field)) {
|
|
54572
|
-
return;
|
|
54573
|
-
}
|
|
54574
|
-
operations.remove.add(v);
|
|
54575
|
-
});
|
|
54576
|
-
if (typeof layerValue === "undefined" && layerOperations.length === 0) {
|
|
54577
|
-
if (layer.deletedIDs.size > 0) {
|
|
54578
|
-
layerIDs.push(layer.id);
|
|
54579
|
-
}
|
|
54580
|
-
continue;
|
|
54581
|
-
}
|
|
54582
|
-
if (typeof layerValue !== "undefined" && !Array.isArray(layerValue)) {
|
|
54583
|
-
return {
|
|
54584
|
-
value: layerValue,
|
|
54585
|
-
kind,
|
|
54586
|
-
displayLayers: [layer.id]
|
|
54587
|
-
};
|
|
54588
|
-
}
|
|
54589
|
-
layerIDs.push(layer.id);
|
|
54590
|
-
if (layerOperations.length > 0) {
|
|
54591
|
-
for (const op of layerOperations) {
|
|
54592
|
-
if (isRemoveOperation(op)) {
|
|
54593
|
-
operations.remove.add(op.id);
|
|
54594
|
-
}
|
|
54595
|
-
if (isInsertOperation(op)) {
|
|
54596
|
-
operations.insert[op.location].unshift(op.id);
|
|
54597
|
-
}
|
|
54598
|
-
if (isDeleteOperation(op)) {
|
|
54599
|
-
return {
|
|
54600
|
-
value: void 0,
|
|
54601
|
-
kind: "unknown",
|
|
54602
|
-
displayLayers: []
|
|
54603
|
-
};
|
|
54604
|
-
}
|
|
54605
|
-
}
|
|
54606
|
-
}
|
|
54607
|
-
if (typeof layerValue === "undefined") {
|
|
54608
|
-
continue;
|
|
54609
|
-
}
|
|
54610
|
-
if (!operations.remove.size && !operations.insert.start.length && !operations.insert.end.length) {
|
|
54611
|
-
return { value: layerValue, displayLayers: layerIDs, kind: "link" };
|
|
54612
|
-
}
|
|
54613
|
-
return {
|
|
54614
|
-
value: [...operations.insert.start, ...layerValue, ...operations.insert.end].filter(
|
|
54615
|
-
(value) => !operations.remove.has(value)
|
|
54616
|
-
),
|
|
54617
|
-
displayLayers: layerIDs,
|
|
54618
|
-
kind
|
|
54619
|
-
};
|
|
54620
|
-
}
|
|
54621
|
-
return {
|
|
54622
|
-
value: void 0,
|
|
54623
|
-
kind: "unknown",
|
|
54624
|
-
displayLayers: []
|
|
54625
|
-
};
|
|
54626
|
-
}
|
|
54627
|
-
writeLink(id, field, value) {
|
|
54628
|
-
return this.topLayer.writeLink(id, field, value);
|
|
54629
|
-
}
|
|
54630
|
-
writeField(id, field, value) {
|
|
54631
|
-
return this.topLayer.writeField(id, field, value);
|
|
54632
|
-
}
|
|
54633
|
-
resolveLayer(id) {
|
|
54634
|
-
let startingIndex = null;
|
|
54635
|
-
for (const [index, layer] of this.data.entries()) {
|
|
54636
|
-
if (layer.id !== id) {
|
|
54637
|
-
continue;
|
|
54638
|
-
}
|
|
54639
|
-
startingIndex = index - 1;
|
|
54640
|
-
this.data[index].optimistic = false;
|
|
54641
|
-
break;
|
|
54642
|
-
}
|
|
54643
|
-
if (startingIndex === null) {
|
|
54644
|
-
throw new Error("could not find layer with id: " + id);
|
|
54645
|
-
}
|
|
54646
|
-
if (startingIndex === -1) {
|
|
54647
|
-
startingIndex = 0;
|
|
54648
|
-
}
|
|
54649
|
-
if (this.data[startingIndex].optimistic) {
|
|
54650
|
-
startingIndex++;
|
|
54651
|
-
}
|
|
54652
|
-
const baseLayer = this.data[startingIndex];
|
|
54653
|
-
let layerIndex = startingIndex;
|
|
54654
|
-
while (layerIndex < this.data.length) {
|
|
54655
|
-
const layer = this.data[layerIndex++];
|
|
54656
|
-
if (layer.optimistic) {
|
|
54657
|
-
layerIndex--;
|
|
54658
|
-
break;
|
|
54659
|
-
}
|
|
54660
|
-
baseLayer.writeLayer(layer);
|
|
54661
|
-
}
|
|
54662
|
-
this.data.splice(startingIndex + 1, layerIndex - startingIndex - 1);
|
|
54663
|
-
}
|
|
54664
|
-
get topLayer() {
|
|
54665
|
-
if (this.data.length === 0) {
|
|
54666
|
-
this.createLayer();
|
|
54667
|
-
}
|
|
54668
|
-
if (this.data[this.data.length - 1]?.optimistic) {
|
|
54669
|
-
this.createLayer();
|
|
54670
|
-
}
|
|
54671
|
-
return this.data[this.data.length - 1];
|
|
54672
|
-
}
|
|
54673
|
-
};
|
|
54674
|
-
var Layer = class {
|
|
54675
|
-
id;
|
|
54676
|
-
optimistic = false;
|
|
54677
|
-
fields = {};
|
|
54678
|
-
links = {};
|
|
54679
|
-
operations = {};
|
|
54680
|
-
deletedIDs = /* @__PURE__ */ new Set();
|
|
54681
|
-
constructor(id) {
|
|
54682
|
-
this.id = id;
|
|
54683
|
-
}
|
|
54684
|
-
get(id, field) {
|
|
54685
|
-
if (typeof this.links[id]?.[field] !== "undefined") {
|
|
54686
|
-
return [this.links[id][field], "link"];
|
|
54687
|
-
}
|
|
54688
|
-
return [this.fields[id]?.[field], "scalar"];
|
|
54689
|
-
}
|
|
54690
|
-
getOperations(id, field) {
|
|
54691
|
-
if (this.operations[id]?.deleted) {
|
|
54692
|
-
return [
|
|
54693
|
-
{
|
|
54694
|
-
kind: OperationKind.delete,
|
|
54695
|
-
target: id
|
|
54696
|
-
}
|
|
54697
|
-
];
|
|
54698
|
-
}
|
|
54699
|
-
if (this.operations[id]?.fields?.[field]) {
|
|
54700
|
-
return this.operations[id].fields[field];
|
|
54701
|
-
}
|
|
54702
|
-
}
|
|
54703
|
-
writeField(id, field, value) {
|
|
54704
|
-
this.fields[id] = {
|
|
54705
|
-
...this.fields[id],
|
|
54706
|
-
[field]: value
|
|
54707
|
-
};
|
|
54708
|
-
return this.id;
|
|
54709
|
-
}
|
|
54710
|
-
writeLink(id, field, value) {
|
|
54711
|
-
const valueList = Array.isArray(value) ? value : [value];
|
|
54712
|
-
for (const value2 of flattenList(valueList)) {
|
|
54713
|
-
if (!value2) {
|
|
54714
|
-
continue;
|
|
54715
|
-
}
|
|
54716
|
-
const fieldOperations = this.operations[id]?.fields[field];
|
|
54717
|
-
if (this.operations[value2]?.deleted || this.deletedIDs.has(value2)) {
|
|
54718
|
-
this.operations[value2] = {
|
|
54719
|
-
...this.operations[value2],
|
|
54720
|
-
undoDeletesInList: [...this.operations[id]?.undoDeletesInList || [], field]
|
|
54721
|
-
};
|
|
54722
|
-
} else if (value2 && fieldOperations?.length > 0) {
|
|
54723
|
-
this.operations[id].fields[field] = fieldOperations.filter(
|
|
54724
|
-
(op) => op.kind !== "remove" || op.id !== value2
|
|
54725
|
-
);
|
|
54726
|
-
}
|
|
54727
|
-
}
|
|
54728
|
-
this.links[id] = {
|
|
54729
|
-
...this.links[id],
|
|
54730
|
-
[field]: value
|
|
54731
|
-
};
|
|
54732
|
-
return this.id;
|
|
54733
|
-
}
|
|
54734
|
-
isDisplayLayer(displayLayers) {
|
|
54735
|
-
return displayLayers.length === 0 || displayLayers.includes(this.id) || Math.max(...displayLayers) < this.id;
|
|
54736
|
-
}
|
|
54737
|
-
clear() {
|
|
54738
|
-
this.links = {};
|
|
54739
|
-
this.fields = {};
|
|
54740
|
-
this.operations = {};
|
|
54741
|
-
this.deletedIDs = /* @__PURE__ */ new Set();
|
|
54742
|
-
}
|
|
54743
|
-
replaceID({ from, to }) {
|
|
54744
|
-
this.fields[to] = this.fields[from];
|
|
54745
|
-
this.links[to] = this.links[from];
|
|
54746
|
-
this.operations[to] = this.operations[from] || { fields: {} };
|
|
54747
|
-
if (this.deletedIDs.has(from)) {
|
|
54748
|
-
this.deletedIDs.add(to);
|
|
54749
|
-
}
|
|
54750
|
-
}
|
|
54751
|
-
removeUndefinedFields() {
|
|
54752
|
-
for (const [id, fields] of Object.entries(this.fields)) {
|
|
54753
|
-
for (const [field, value] of Object.entries(fields)) {
|
|
54754
|
-
if (typeof value === "undefined") {
|
|
54755
|
-
try {
|
|
54756
|
-
delete this.fields[id][field];
|
|
54757
|
-
} catch {
|
|
54758
|
-
}
|
|
54759
|
-
try {
|
|
54760
|
-
delete this.links[id][field];
|
|
54761
|
-
} catch {
|
|
54762
|
-
}
|
|
54763
|
-
}
|
|
54764
|
-
}
|
|
54765
|
-
if (Object.keys(fields || {}).length === 0) {
|
|
54766
|
-
delete this.fields[id];
|
|
54767
|
-
}
|
|
54768
|
-
if (Object.keys(this.links[id] || {}).length === 0) {
|
|
54769
|
-
delete this.links[id];
|
|
54770
|
-
}
|
|
54771
|
-
}
|
|
54772
|
-
}
|
|
54773
|
-
delete(id) {
|
|
54774
|
-
this.operations = {
|
|
54775
|
-
...this.operations,
|
|
54776
|
-
[id]: {
|
|
54777
|
-
...this.operations[id],
|
|
54778
|
-
deleted: true,
|
|
54779
|
-
undoDeletesInList: []
|
|
54780
|
-
}
|
|
54781
|
-
};
|
|
54782
|
-
this.deletedIDs.add(id);
|
|
54783
|
-
}
|
|
54784
|
-
deleteField(id, field) {
|
|
54785
|
-
this.fields[id] = {
|
|
54786
|
-
...this.fields[id],
|
|
54787
|
-
[field]: void 0
|
|
54788
|
-
};
|
|
54789
|
-
}
|
|
54790
|
-
insert(id, field, where, target) {
|
|
54791
|
-
this.addFieldOperation(id, field, {
|
|
54792
|
-
kind: OperationKind.insert,
|
|
54793
|
-
id: target,
|
|
54794
|
-
location: where
|
|
54795
|
-
});
|
|
54796
|
-
}
|
|
54797
|
-
remove(id, field, target) {
|
|
54798
|
-
this.addFieldOperation(id, field, {
|
|
54799
|
-
kind: OperationKind.remove,
|
|
54800
|
-
id: target
|
|
54801
|
-
});
|
|
54802
|
-
}
|
|
54803
|
-
writeLayer(layer) {
|
|
54804
|
-
if (layer.id === this.id) {
|
|
54805
|
-
return;
|
|
54806
|
-
}
|
|
54807
|
-
for (const [id, ops] of Object.entries(layer.operations)) {
|
|
54808
|
-
const fields = {};
|
|
54809
|
-
for (const opMap of [this.operations[id], layer.operations[id]].filter(Boolean)) {
|
|
54810
|
-
for (const [fieldName, operations] of Object.entries(opMap.fields || {})) {
|
|
54811
|
-
fields[fieldName] = [...fields[fieldName] || [], ...operations];
|
|
54812
|
-
}
|
|
54813
|
-
}
|
|
54814
|
-
if (Object.keys(fields).length > 0) {
|
|
54815
|
-
this.operations[id] = {
|
|
54816
|
-
...this.operations[id],
|
|
54817
|
-
fields
|
|
54818
|
-
};
|
|
54819
|
-
}
|
|
54820
|
-
if (ops?.deleted) {
|
|
54821
|
-
delete this.fields[id];
|
|
54822
|
-
delete this.links[id];
|
|
54823
|
-
}
|
|
54824
|
-
}
|
|
54825
|
-
for (const [id, values] of Object.entries(layer.fields)) {
|
|
54826
|
-
if (!values) {
|
|
54827
|
-
continue;
|
|
54828
|
-
}
|
|
54829
|
-
for (const [field, value] of Object.entries(values)) {
|
|
54830
|
-
this.writeField(id, field, value);
|
|
54831
|
-
}
|
|
54832
|
-
}
|
|
54833
|
-
for (const [id, values] of Object.entries(layer.links)) {
|
|
54834
|
-
if (!values) {
|
|
54835
|
-
continue;
|
|
54836
|
-
}
|
|
54837
|
-
for (const [field, value] of Object.entries(values)) {
|
|
54838
|
-
this.writeLink(id, field, value);
|
|
54839
|
-
}
|
|
54840
|
-
}
|
|
54841
|
-
layer.deletedIDs.forEach((v) => this.deletedIDs.add(v));
|
|
54842
|
-
}
|
|
54843
|
-
addFieldOperation(id, field, operation) {
|
|
54844
|
-
this.operations = {
|
|
54845
|
-
...this.operations,
|
|
54846
|
-
[id]: {
|
|
54847
|
-
...this.operations[id],
|
|
54848
|
-
fields: {
|
|
54849
|
-
[field]: [...this.operations[id]?.fields[field] || [], operation]
|
|
54850
|
-
}
|
|
54851
|
-
}
|
|
54852
|
-
};
|
|
54853
|
-
}
|
|
54854
|
-
};
|
|
54855
|
-
function isDeleteOperation(value) {
|
|
54856
|
-
return !!value && value.kind === OperationKind.delete;
|
|
54857
|
-
}
|
|
54858
|
-
function isInsertOperation(value) {
|
|
54859
|
-
return !!value && value.kind === OperationKind.insert;
|
|
54860
|
-
}
|
|
54861
|
-
function isRemoveOperation(value) {
|
|
54862
|
-
return !!value && value.kind === OperationKind.remove;
|
|
54863
|
-
}
|
|
54864
|
-
var OperationLocation = /* @__PURE__ */ ((OperationLocation2) => {
|
|
54865
|
-
OperationLocation2["start"] = "start";
|
|
54866
|
-
OperationLocation2["end"] = "end";
|
|
54867
|
-
return OperationLocation2;
|
|
54868
|
-
})(OperationLocation || {});
|
|
54869
|
-
var OperationKind = /* @__PURE__ */ ((OperationKind2) => {
|
|
54870
|
-
OperationKind2["delete"] = "delete";
|
|
54871
|
-
OperationKind2["insert"] = "insert";
|
|
54872
|
-
OperationKind2["remove"] = "remove";
|
|
54873
|
-
return OperationKind2;
|
|
54874
|
-
})(OperationKind || {});
|
|
54875
|
-
|
|
54876
|
-
// src/runtime/cache/subscription.ts
|
|
54877
|
-
var InMemorySubscriptions = class {
|
|
54878
|
-
cache;
|
|
54879
|
-
constructor(cache) {
|
|
54880
|
-
this.cache = cache;
|
|
54881
|
-
}
|
|
54882
|
-
subscribers = {};
|
|
54883
|
-
referenceCounts = {};
|
|
54884
|
-
keyVersions = {};
|
|
54885
|
-
add({
|
|
54886
|
-
parent,
|
|
54887
|
-
spec,
|
|
54888
|
-
selection: selection2,
|
|
54889
|
-
variables,
|
|
54890
|
-
parentType
|
|
54891
|
-
}) {
|
|
54892
|
-
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
54893
|
-
let targetSelection = getFieldsForType(selection2, __typename);
|
|
54894
|
-
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
54895
|
-
const { keyRaw, selection: innerSelection, type } = fieldSelection;
|
|
54896
|
-
const key = evaluateKey(keyRaw, variables);
|
|
54897
|
-
this.addFieldSubscription({
|
|
54898
|
-
id: parent,
|
|
54899
|
-
key,
|
|
54900
|
-
field: fieldSelection,
|
|
54901
|
-
spec,
|
|
54902
|
-
parentType: parentType || spec.rootType,
|
|
54903
|
-
variables
|
|
54904
|
-
});
|
|
54905
|
-
if (innerSelection) {
|
|
54906
|
-
const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
|
|
54907
|
-
parent,
|
|
54908
|
-
key
|
|
54909
|
-
);
|
|
54910
|
-
let children = !Array.isArray(linkedRecord) ? [linkedRecord] : flattenList(linkedRecord) || [];
|
|
54911
|
-
for (const child of children) {
|
|
54912
|
-
if (!child) {
|
|
54913
|
-
continue;
|
|
54914
|
-
}
|
|
54915
|
-
this.add({
|
|
54916
|
-
parent: child,
|
|
54917
|
-
spec,
|
|
54918
|
-
selection: innerSelection,
|
|
54919
|
-
variables,
|
|
54920
|
-
parentType: type
|
|
54921
|
-
});
|
|
54922
|
-
}
|
|
54923
|
-
}
|
|
54924
|
-
}
|
|
54925
|
-
}
|
|
54926
|
-
addFieldSubscription({
|
|
54927
|
-
id,
|
|
54928
|
-
key,
|
|
54929
|
-
field,
|
|
54930
|
-
spec,
|
|
54931
|
-
parentType,
|
|
54932
|
-
variables
|
|
54933
|
-
}) {
|
|
54934
|
-
if (!this.subscribers[id]) {
|
|
54935
|
-
this.subscribers[id] = {};
|
|
54936
|
-
}
|
|
54937
|
-
if (!this.subscribers[id][key]) {
|
|
54938
|
-
this.subscribers[id][key] = [];
|
|
54939
|
-
}
|
|
54940
|
-
if (!this.keyVersions[key]) {
|
|
54941
|
-
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
54942
|
-
}
|
|
54943
|
-
this.keyVersions[key].add(key);
|
|
54944
|
-
if (!this.subscribers[id][key].map(({ set }) => set).includes(spec.set)) {
|
|
54945
|
-
this.subscribers[id][key].push(spec);
|
|
54946
|
-
}
|
|
54947
|
-
if (!this.referenceCounts[id]) {
|
|
54948
|
-
this.referenceCounts[id] = {};
|
|
54949
|
-
}
|
|
54950
|
-
if (!this.referenceCounts[id][key]) {
|
|
54951
|
-
this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
|
|
54952
|
-
}
|
|
54953
|
-
const counts = this.referenceCounts[id][key];
|
|
54954
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
54955
|
-
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
54956
|
-
const { selection: selection2, list, filters } = field;
|
|
54957
|
-
if (selection2 && list) {
|
|
54958
|
-
this.cache._internal_unstable.lists.add({
|
|
54959
|
-
name: list.name,
|
|
54960
|
-
connection: list.connection,
|
|
54961
|
-
recordID: id,
|
|
54962
|
-
recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
|
|
54963
|
-
listType: list.type,
|
|
54964
|
-
key,
|
|
54965
|
-
selection: selection2,
|
|
54966
|
-
filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
|
|
54967
|
-
return {
|
|
54968
|
-
...acc,
|
|
54969
|
-
[key2]: kind !== "Variable" ? value : variables[value]
|
|
54970
|
-
};
|
|
54971
|
-
}, {})
|
|
54972
|
-
});
|
|
54973
|
-
}
|
|
54974
|
-
}
|
|
54975
|
-
addMany({
|
|
54976
|
-
parent,
|
|
54977
|
-
selection: selection2,
|
|
54978
|
-
variables,
|
|
54979
|
-
subscribers,
|
|
54980
|
-
parentType
|
|
54981
|
-
}) {
|
|
54982
|
-
let targetSelection = getFieldsForType(selection2, parentType);
|
|
54983
|
-
for (const fieldSelection of Object.values(targetSelection)) {
|
|
54984
|
-
const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
|
|
54985
|
-
const key = evaluateKey(keyRaw, variables);
|
|
54986
|
-
for (const spec of subscribers) {
|
|
54987
|
-
this.addFieldSubscription({
|
|
54988
|
-
id: parent,
|
|
54989
|
-
key,
|
|
54990
|
-
field: fieldSelection,
|
|
54991
|
-
spec,
|
|
54992
|
-
parentType,
|
|
54993
|
-
variables
|
|
54994
|
-
});
|
|
54995
|
-
}
|
|
54996
|
-
if (innerSelection) {
|
|
54997
|
-
const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
|
|
54998
|
-
const children = !Array.isArray(link) ? [link] : flattenList(link);
|
|
54999
|
-
for (const linkedRecord of children) {
|
|
55000
|
-
if (!linkedRecord) {
|
|
55001
|
-
continue;
|
|
55002
|
-
}
|
|
55003
|
-
this.addMany({
|
|
55004
|
-
parent: linkedRecord,
|
|
55005
|
-
selection: innerSelection,
|
|
55006
|
-
variables,
|
|
55007
|
-
subscribers,
|
|
55008
|
-
parentType: linkedType
|
|
55009
|
-
});
|
|
55010
|
-
}
|
|
55011
|
-
}
|
|
55012
|
-
}
|
|
55013
|
-
}
|
|
55014
|
-
get(id, field) {
|
|
55015
|
-
return this.subscribers[id]?.[field] || [];
|
|
55016
|
-
}
|
|
55017
|
-
remove(id, selection2, targets, variables, visited = []) {
|
|
55018
|
-
visited.push(id);
|
|
55019
|
-
const linkedIDs = [];
|
|
55020
|
-
for (const fieldSelection of Object.values(selection2.fields || {})) {
|
|
55021
|
-
const key = evaluateKey(fieldSelection.keyRaw, variables);
|
|
55022
|
-
this.removeSubscribers(id, key, targets);
|
|
55023
|
-
if (!fieldSelection.selection?.fields) {
|
|
55024
|
-
continue;
|
|
55025
|
-
}
|
|
55026
|
-
const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
|
|
55027
|
-
const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
|
|
55028
|
-
for (const link of links) {
|
|
55029
|
-
if (link !== null) {
|
|
55030
|
-
linkedIDs.push([link, fieldSelection.selection || {}]);
|
|
55031
|
-
}
|
|
55032
|
-
}
|
|
55033
|
-
}
|
|
55034
|
-
for (const [linkedRecordID, linkFields] of linkedIDs) {
|
|
55035
|
-
this.remove(linkedRecordID, linkFields, targets, visited);
|
|
55036
|
-
}
|
|
55037
|
-
}
|
|
55038
|
-
removeSubscribers(id, fieldName, specs) {
|
|
55039
|
-
let targets = [];
|
|
55040
|
-
for (const spec of specs) {
|
|
55041
|
-
if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
|
|
55042
|
-
continue;
|
|
55043
|
-
}
|
|
55044
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
55045
|
-
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
55046
|
-
counts.set(spec.set, newVal);
|
|
55047
|
-
if (newVal <= 0) {
|
|
55048
|
-
targets.push(spec.set);
|
|
55049
|
-
counts.delete(spec.set);
|
|
55050
|
-
}
|
|
55051
|
-
}
|
|
55052
|
-
if (this.subscribers[id]) {
|
|
55053
|
-
this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
|
|
55054
|
-
({ set }) => !targets.includes(set)
|
|
55055
|
-
);
|
|
55056
|
-
}
|
|
55057
|
-
}
|
|
55058
|
-
removeAllSubscribers(id, targets, visited = []) {
|
|
55059
|
-
visited.push(id);
|
|
55060
|
-
for (const field of Object.keys(this.subscribers[id] || [])) {
|
|
55061
|
-
const subscribers = targets || this.subscribers[id][field];
|
|
55062
|
-
this.removeSubscribers(id, field, subscribers);
|
|
55063
|
-
const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
|
|
55064
|
-
if (kind === "scalar") {
|
|
55065
|
-
continue;
|
|
55066
|
-
}
|
|
55067
|
-
const nextTargets = Array.isArray(value) ? flattenList(value) : [value];
|
|
55068
|
-
for (const id2 of nextTargets) {
|
|
55069
|
-
if (visited.includes(id2)) {
|
|
55070
|
-
continue;
|
|
55071
|
-
}
|
|
55072
|
-
this.removeAllSubscribers(id2, subscribers, visited);
|
|
55073
|
-
}
|
|
55074
|
-
}
|
|
55075
|
-
}
|
|
55076
|
-
};
|
|
55077
|
-
|
|
55078
|
-
// src/runtime/cache/cache.ts
|
|
55079
|
-
var Cache3 = class {
|
|
55080
|
-
_internal_unstable;
|
|
55081
|
-
constructor(config2) {
|
|
55082
|
-
this._internal_unstable = new CacheInternal({
|
|
55083
|
-
cache: this,
|
|
55084
|
-
storage: new InMemoryStorage(),
|
|
55085
|
-
subscriptions: new InMemorySubscriptions(this),
|
|
55086
|
-
lists: new ListManager(this, rootID),
|
|
55087
|
-
lifetimes: new GarbageCollector(this),
|
|
55088
|
-
schema: new SchemaManager(this)
|
|
55089
|
-
});
|
|
55090
|
-
if (config2) {
|
|
55091
|
-
this.setConfig(defaultConfigValues(config2));
|
|
55092
|
-
}
|
|
55093
|
-
}
|
|
55094
|
-
write({
|
|
55095
|
-
layer: layerID,
|
|
55096
|
-
notifySubscribers = [],
|
|
55097
|
-
...args
|
|
55098
|
-
}) {
|
|
55099
|
-
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
55100
|
-
const subscribers = this._internal_unstable.writeSelection({ ...args, layer });
|
|
55101
|
-
const notified = [];
|
|
55102
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
55103
|
-
if (!notified.includes(spec.set)) {
|
|
55104
|
-
notified.push(spec.set);
|
|
55105
|
-
spec.set(
|
|
55106
|
-
this._internal_unstable.getSelection({
|
|
55107
|
-
parent: spec.parentID || rootID,
|
|
55108
|
-
selection: spec.selection,
|
|
55109
|
-
variables: spec.variables?.() || {}
|
|
55110
|
-
}).data
|
|
55111
|
-
);
|
|
55112
|
-
}
|
|
55113
|
-
}
|
|
55114
|
-
return subscribers;
|
|
55115
|
-
}
|
|
55116
|
-
read(...args) {
|
|
55117
|
-
const { data, partial, hasData } = this._internal_unstable.getSelection(...args);
|
|
55118
|
-
if (!hasData) {
|
|
55119
|
-
return { data: null, partial: false };
|
|
55120
|
-
}
|
|
55121
|
-
return {
|
|
55122
|
-
data,
|
|
55123
|
-
partial
|
|
55124
|
-
};
|
|
55125
|
-
}
|
|
55126
|
-
subscribe(spec, variables = {}) {
|
|
55127
|
-
return this._internal_unstable.subscriptions.add({
|
|
55128
|
-
parent: spec.parentID || rootID,
|
|
55129
|
-
spec,
|
|
55130
|
-
selection: spec.selection,
|
|
55131
|
-
variables
|
|
55132
|
-
});
|
|
55133
|
-
}
|
|
55134
|
-
unsubscribe(spec, variables = {}) {
|
|
55135
|
-
return this._internal_unstable.subscriptions.remove(
|
|
55136
|
-
spec.parentID || rootID,
|
|
55137
|
-
spec.selection,
|
|
55138
|
-
[spec],
|
|
55139
|
-
variables
|
|
55140
|
-
);
|
|
55141
|
-
}
|
|
55142
|
-
list(name2, parentID, allLists) {
|
|
55143
|
-
const handler = this._internal_unstable.lists.get(name2, parentID, allLists);
|
|
55144
|
-
if (!handler) {
|
|
55145
|
-
throw new Error(
|
|
55146
|
-
`Cannot find list with name: ${name2}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
|
|
55147
|
-
);
|
|
55148
|
-
}
|
|
55149
|
-
return handler;
|
|
55150
|
-
}
|
|
55151
|
-
delete(id) {
|
|
55152
|
-
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
55153
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
55154
|
-
this._internal_unstable.storage.delete(id);
|
|
55155
|
-
}
|
|
55156
|
-
setConfig(config2) {
|
|
55157
|
-
this._internal_unstable.setConfig(config2);
|
|
55158
|
-
}
|
|
55159
|
-
};
|
|
55160
|
-
var CacheInternal = class {
|
|
55161
|
-
_disabled = false;
|
|
55162
|
-
config = defaultConfigValues({
|
|
55163
|
-
plugins: {
|
|
55164
|
-
"houdini-svelte": {
|
|
55165
|
-
client: ""
|
|
55166
|
-
}
|
|
55167
|
-
}
|
|
55168
|
-
});
|
|
55169
|
-
storage;
|
|
55170
|
-
subscriptions;
|
|
55171
|
-
lists;
|
|
55172
|
-
cache;
|
|
55173
|
-
lifetimes;
|
|
55174
|
-
schema;
|
|
55175
|
-
constructor({
|
|
55176
|
-
storage,
|
|
55177
|
-
subscriptions,
|
|
55178
|
-
lists,
|
|
55179
|
-
cache,
|
|
55180
|
-
lifetimes,
|
|
55181
|
-
schema
|
|
55182
|
-
}) {
|
|
55183
|
-
this.storage = storage;
|
|
55184
|
-
this.subscriptions = subscriptions;
|
|
55185
|
-
this.lists = lists;
|
|
55186
|
-
this.cache = cache;
|
|
55187
|
-
this.lifetimes = lifetimes;
|
|
55188
|
-
this.schema = schema;
|
|
55189
|
-
this._disabled = typeof globalThis.window === "undefined";
|
|
55190
|
-
try {
|
|
55191
|
-
if (process.env.HOUDINI_TEST === "true") {
|
|
55192
|
-
this._disabled = false;
|
|
55193
|
-
}
|
|
55194
|
-
} catch {
|
|
55195
|
-
}
|
|
55196
|
-
}
|
|
55197
|
-
setConfig(config2) {
|
|
55198
|
-
this.config = config2;
|
|
55199
|
-
}
|
|
55200
|
-
writeSelection({
|
|
55201
|
-
data,
|
|
55202
|
-
selection: selection2,
|
|
55203
|
-
variables = {},
|
|
55204
|
-
parent = rootID,
|
|
55205
|
-
applyUpdates = false,
|
|
55206
|
-
layer,
|
|
55207
|
-
toNotify = [],
|
|
55208
|
-
forceNotify
|
|
55209
|
-
}) {
|
|
55210
|
-
if (this._disabled) {
|
|
55211
|
-
return [];
|
|
55212
|
-
}
|
|
55213
|
-
let targetSelection = getFieldsForType(selection2, data["__typename"]);
|
|
55214
|
-
for (const [field, value] of Object.entries(data)) {
|
|
55215
|
-
if (!selection2 || !targetSelection[field]) {
|
|
55216
|
-
throw new Error(
|
|
55217
|
-
"Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
|
|
55218
|
-
);
|
|
55219
|
-
}
|
|
55220
|
-
let {
|
|
55221
|
-
type: linkedType,
|
|
55222
|
-
keyRaw,
|
|
55223
|
-
selection: fieldSelection,
|
|
55224
|
-
operations,
|
|
55225
|
-
abstract: isAbstract,
|
|
55226
|
-
update,
|
|
55227
|
-
nullable
|
|
55228
|
-
} = targetSelection[field];
|
|
55229
|
-
const key = evaluateKey(keyRaw, variables);
|
|
55230
|
-
this.schema.setFieldType({
|
|
55231
|
-
parent,
|
|
55232
|
-
key: keyRaw,
|
|
55233
|
-
type: linkedType,
|
|
55234
|
-
nullable,
|
|
55235
|
-
link: !!fieldSelection
|
|
55236
|
-
});
|
|
55237
|
-
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
55238
|
-
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
55239
|
-
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
55240
|
-
if (displayLayer) {
|
|
55241
|
-
this.lifetimes.resetLifetime(parent, key);
|
|
55242
|
-
}
|
|
55243
|
-
if (!fieldSelection) {
|
|
55244
|
-
let newValue = value;
|
|
55245
|
-
if (Array.isArray(value) && applyUpdates && update) {
|
|
55246
|
-
if (update === "append") {
|
|
55247
|
-
newValue = (previousValue || []).concat(value);
|
|
55248
|
-
} else if (update === "prepend") {
|
|
55249
|
-
newValue = value.concat(previousValue || []);
|
|
55250
|
-
}
|
|
55251
|
-
}
|
|
55252
|
-
const valueChanged = !deepEquals(newValue, previousValue);
|
|
55253
|
-
if (displayLayer && (valueChanged || forceNotify)) {
|
|
55254
|
-
toNotify.push(...currentSubscribers);
|
|
55255
|
-
}
|
|
55256
|
-
layer.writeField(parent, key, newValue);
|
|
55257
|
-
} else if (value === null) {
|
|
55258
|
-
if (previousValue === null) {
|
|
55259
|
-
continue;
|
|
55260
|
-
}
|
|
55261
|
-
const previousLinks = flattenList([previousValue]);
|
|
55262
|
-
for (const link of previousLinks) {
|
|
55263
|
-
this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
|
|
55264
|
-
}
|
|
55265
|
-
layer.writeLink(parent, key, null);
|
|
55266
|
-
toNotify.push(...currentSubscribers);
|
|
55267
|
-
} else if (value instanceof Object && !Array.isArray(value)) {
|
|
55268
|
-
if (isAbstract) {
|
|
55269
|
-
if (!value.__typename) {
|
|
55270
|
-
throw new Error(
|
|
55271
|
-
"Encountered interface type without __typename in the payload"
|
|
55272
|
-
);
|
|
55273
|
-
}
|
|
55274
|
-
linkedType = value.__typename;
|
|
55275
|
-
}
|
|
55276
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
55277
|
-
(field2) => typeof value[field2] === "undefined"
|
|
55278
|
-
).length > 0;
|
|
55279
|
-
let linkedID = null;
|
|
55280
|
-
if (value !== null) {
|
|
55281
|
-
linkedID = !embedded ? this.id(linkedType, value) : `${parent}.${key}`;
|
|
55282
|
-
}
|
|
55283
|
-
let linkChange = linkedID !== previousValue;
|
|
55284
|
-
layer.writeLink(parent, key, linkedID);
|
|
55285
|
-
if (linkedID && displayLayer && (linkChange || forceNotify)) {
|
|
55286
|
-
if (previousValue && typeof previousValue === "string") {
|
|
55287
|
-
this.subscriptions.remove(
|
|
55288
|
-
previousValue,
|
|
55289
|
-
fieldSelection,
|
|
55290
|
-
currentSubscribers,
|
|
55291
|
-
variables
|
|
55292
|
-
);
|
|
55293
|
-
}
|
|
55294
|
-
this.subscriptions.addMany({
|
|
55295
|
-
parent: linkedID,
|
|
55296
|
-
selection: fieldSelection,
|
|
55297
|
-
subscribers: currentSubscribers,
|
|
55298
|
-
variables,
|
|
55299
|
-
parentType: linkedType
|
|
55300
|
-
});
|
|
55301
|
-
toNotify.push(...currentSubscribers);
|
|
55302
|
-
}
|
|
55303
|
-
if (linkedID) {
|
|
55304
|
-
this.writeSelection({
|
|
55305
|
-
selection: fieldSelection,
|
|
55306
|
-
parent: linkedID,
|
|
55307
|
-
data: value,
|
|
55308
|
-
variables,
|
|
55309
|
-
toNotify,
|
|
55310
|
-
applyUpdates,
|
|
55311
|
-
layer,
|
|
55312
|
-
forceNotify
|
|
55313
|
-
});
|
|
55314
|
-
}
|
|
55315
|
-
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
|
|
55316
|
-
let oldIDs = [...previousValue || []];
|
|
55317
|
-
const emptyEdges = !update ? [] : oldIDs.map((id) => {
|
|
55318
|
-
if (!id) {
|
|
55319
|
-
return "";
|
|
55320
|
-
}
|
|
55321
|
-
const { value: cursorField } = this.storage.get(id, "cursor");
|
|
55322
|
-
if (cursorField) {
|
|
55323
|
-
return "";
|
|
55324
|
-
}
|
|
55325
|
-
const { value: node } = this.storage.get(id, "node");
|
|
55326
|
-
if (!node) {
|
|
55327
|
-
return "";
|
|
55328
|
-
}
|
|
55329
|
-
return node;
|
|
55330
|
-
});
|
|
55331
|
-
let linkedIDs = [];
|
|
55332
|
-
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
55333
|
-
value,
|
|
55334
|
-
abstract: Boolean(isAbstract),
|
|
55335
|
-
specs: toNotify,
|
|
55336
|
-
applyUpdates,
|
|
55337
|
-
recordID: parent,
|
|
55338
|
-
key,
|
|
55339
|
-
linkedType,
|
|
55340
|
-
variables,
|
|
55341
|
-
fields: fieldSelection,
|
|
55342
|
-
layer,
|
|
55343
|
-
forceNotify
|
|
55344
|
-
});
|
|
55345
|
-
if (applyUpdates && update) {
|
|
55346
|
-
if (key === "edges") {
|
|
55347
|
-
const newNodeIDs = [];
|
|
55348
|
-
for (const id of newIDs) {
|
|
55349
|
-
if (!id) {
|
|
55350
|
-
continue;
|
|
55351
|
-
}
|
|
55352
|
-
const { value: node } = this.storage.get(id, "node");
|
|
55353
|
-
if (typeof node !== "string") {
|
|
55354
|
-
continue;
|
|
55355
|
-
}
|
|
55356
|
-
if (!node || !this.storage.get(node, "__typename")) {
|
|
55357
|
-
continue;
|
|
55358
|
-
}
|
|
55359
|
-
newNodeIDs.push(node);
|
|
55360
|
-
}
|
|
55361
|
-
oldIDs = oldIDs.filter((id) => {
|
|
55362
|
-
if (!id) {
|
|
55363
|
-
return true;
|
|
55364
|
-
}
|
|
55365
|
-
const { value: value2 } = this.storage.get(id, "node");
|
|
55366
|
-
const node = value2;
|
|
55367
|
-
if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
|
|
55368
|
-
return false;
|
|
55369
|
-
}
|
|
55370
|
-
return true;
|
|
55371
|
-
});
|
|
55372
|
-
}
|
|
55373
|
-
if (update === "prepend") {
|
|
55374
|
-
linkedIDs = newIDs.concat(oldIDs);
|
|
55375
|
-
} else if (update === "append") {
|
|
55376
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
55377
|
-
} else if (update === "replace") {
|
|
55378
|
-
linkedIDs = newIDs;
|
|
55379
|
-
}
|
|
55380
|
-
} else {
|
|
55381
|
-
linkedIDs = nestedIDs;
|
|
55382
|
-
}
|
|
55383
|
-
const contentChanged = !deepEquals(linkedIDs, oldIDs);
|
|
55384
|
-
if (contentChanged || forceNotify) {
|
|
55385
|
-
toNotify.push(...currentSubscribers);
|
|
55386
|
-
}
|
|
55387
|
-
for (const lostID of oldIDs) {
|
|
55388
|
-
if (linkedIDs.includes(lostID) || !lostID) {
|
|
55389
|
-
continue;
|
|
55390
|
-
}
|
|
55391
|
-
this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
|
|
55392
|
-
}
|
|
55393
|
-
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
55394
|
-
layer.writeLink(parent, key, linkedIDs);
|
|
55395
|
-
}
|
|
55396
|
-
for (const id of newIDs.filter((id2) => !oldIDs.includes(id2))) {
|
|
55397
|
-
if (id == null) {
|
|
55398
|
-
continue;
|
|
55399
|
-
}
|
|
55400
|
-
this.subscriptions.addMany({
|
|
55401
|
-
parent: id,
|
|
55402
|
-
selection: fieldSelection,
|
|
55403
|
-
subscribers: currentSubscribers,
|
|
55404
|
-
variables,
|
|
55405
|
-
parentType: linkedType
|
|
55406
|
-
});
|
|
55407
|
-
}
|
|
55408
|
-
}
|
|
55409
|
-
for (const operation of operations || []) {
|
|
55410
|
-
let parentID;
|
|
55411
|
-
if (operation.parentID) {
|
|
55412
|
-
if (operation.parentID.kind !== "Variable") {
|
|
55413
|
-
parentID = operation.parentID.value;
|
|
55414
|
-
} else {
|
|
55415
|
-
const id = variables[operation.parentID.value];
|
|
55416
|
-
if (typeof id !== "string") {
|
|
55417
|
-
throw new Error("parentID value must be a string");
|
|
55418
|
-
}
|
|
55419
|
-
parentID = id;
|
|
55420
|
-
}
|
|
55421
|
-
}
|
|
55422
|
-
if (operation.list && !this.lists.get(operation.list, parentID, operation.target === "all")) {
|
|
55423
|
-
continue;
|
|
55424
|
-
}
|
|
55425
|
-
const targets = Array.isArray(value) ? value : [value];
|
|
55426
|
-
for (const target of targets) {
|
|
55427
|
-
if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
|
|
55428
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
55429
|
-
fieldSelection,
|
|
55430
|
-
target,
|
|
55431
|
-
variables,
|
|
55432
|
-
operation.position || "last"
|
|
55433
|
-
);
|
|
55434
|
-
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
55435
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
55436
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
55437
|
-
if (typeof target !== "string") {
|
|
55438
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
55439
|
-
}
|
|
55440
|
-
const targetID = this.id(operation.type, target);
|
|
55441
|
-
if (!targetID) {
|
|
55442
|
-
continue;
|
|
55443
|
-
}
|
|
55444
|
-
this.cache.delete(targetID);
|
|
55445
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
55446
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
55447
|
-
fieldSelection,
|
|
55448
|
-
target,
|
|
55449
|
-
variables,
|
|
55450
|
-
operation.position || "last"
|
|
55451
|
-
);
|
|
55452
|
-
}
|
|
55453
|
-
}
|
|
55454
|
-
}
|
|
55455
|
-
}
|
|
55456
|
-
return toNotify;
|
|
55457
|
-
}
|
|
55458
|
-
getSelection({
|
|
55459
|
-
selection: selection2,
|
|
55460
|
-
parent = rootID,
|
|
55461
|
-
variables,
|
|
55462
|
-
stepsFromConnection = null
|
|
55463
|
-
}) {
|
|
55464
|
-
if (parent === null) {
|
|
55465
|
-
return { data: null, partial: false, hasData: true };
|
|
55466
|
-
}
|
|
55467
|
-
const target = {};
|
|
55468
|
-
let hasData = false;
|
|
55469
|
-
let partial = false;
|
|
55470
|
-
let cascadeNull = false;
|
|
55471
|
-
const typename = this.storage.get(parent, "__typename").value;
|
|
55472
|
-
let targetSelection = getFieldsForType(selection2, typename);
|
|
55473
|
-
for (const [
|
|
55474
|
-
attributeName,
|
|
55475
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list }
|
|
55476
|
-
] of Object.entries(targetSelection)) {
|
|
55477
|
-
const key = evaluateKey(keyRaw, variables);
|
|
55478
|
-
const { value } = this.storage.get(parent, key);
|
|
55479
|
-
let nextStep = stepsFromConnection;
|
|
55480
|
-
if (nextStep !== null) {
|
|
55481
|
-
if (nextStep >= 2) {
|
|
55482
|
-
nextStep = null;
|
|
55483
|
-
} else {
|
|
55484
|
-
nextStep += 1;
|
|
55485
|
-
}
|
|
55486
|
-
}
|
|
55487
|
-
if (list?.connection) {
|
|
55488
|
-
nextStep = 0;
|
|
55489
|
-
}
|
|
55490
|
-
const embeddedCursor = key === "cursor" && stepsFromConnection === 1;
|
|
55491
|
-
if (typeof value === "undefined" && !embeddedCursor) {
|
|
55492
|
-
partial = true;
|
|
55493
|
-
}
|
|
55494
|
-
if (typeof value === "undefined" || value === null) {
|
|
55495
|
-
target[attributeName] = null;
|
|
55496
|
-
if (typeof value !== "undefined") {
|
|
55497
|
-
hasData = true;
|
|
55498
|
-
}
|
|
55499
|
-
} else if (!fieldSelection) {
|
|
55500
|
-
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
55501
|
-
if (fnUnmarshal) {
|
|
55502
|
-
target[attributeName] = fnUnmarshal(value);
|
|
55503
|
-
} else {
|
|
55504
|
-
target[attributeName] = value;
|
|
55505
|
-
}
|
|
55506
|
-
hasData = true;
|
|
55507
|
-
} else if (Array.isArray(value)) {
|
|
55508
|
-
const listValue = this.hydrateNestedList({
|
|
55509
|
-
fields: fieldSelection,
|
|
55510
|
-
variables,
|
|
55511
|
-
linkedList: value,
|
|
55512
|
-
stepsFromConnection: nextStep
|
|
55513
|
-
});
|
|
55514
|
-
target[attributeName] = listValue.data;
|
|
55515
|
-
if (listValue.partial) {
|
|
55516
|
-
partial = true;
|
|
55517
|
-
}
|
|
55518
|
-
if (listValue.hasData || value.length === 0) {
|
|
55519
|
-
hasData = true;
|
|
55520
|
-
}
|
|
55521
|
-
} else {
|
|
55522
|
-
const objectFields = this.getSelection({
|
|
55523
|
-
parent: value,
|
|
55524
|
-
selection: fieldSelection,
|
|
55525
|
-
variables,
|
|
55526
|
-
stepsFromConnection: nextStep
|
|
55527
|
-
});
|
|
55528
|
-
target[attributeName] = objectFields.data;
|
|
55529
|
-
if (objectFields.partial) {
|
|
55530
|
-
partial = true;
|
|
55531
|
-
}
|
|
55532
|
-
if (objectFields.hasData) {
|
|
55533
|
-
hasData = true;
|
|
55534
|
-
}
|
|
55535
|
-
}
|
|
55536
|
-
if (target[attributeName] === null && !nullable && !embeddedCursor) {
|
|
55537
|
-
cascadeNull = true;
|
|
55538
|
-
}
|
|
55539
|
-
}
|
|
55540
|
-
return {
|
|
55541
|
-
data: cascadeNull ? null : target,
|
|
55542
|
-
partial: hasData && partial,
|
|
55543
|
-
hasData
|
|
55544
|
-
};
|
|
55545
|
-
}
|
|
55546
|
-
id(type, data) {
|
|
55547
|
-
const id = typeof data === "string" ? data : this.computeID(type, data);
|
|
55548
|
-
if (!id) {
|
|
55549
|
-
return null;
|
|
55550
|
-
}
|
|
55551
|
-
if (!type) {
|
|
55552
|
-
return id;
|
|
55553
|
-
}
|
|
55554
|
-
return type + ":" + id;
|
|
55555
|
-
}
|
|
55556
|
-
idFields(type) {
|
|
55557
|
-
return keyFieldsForType(this.config, type);
|
|
55558
|
-
}
|
|
55559
|
-
computeID(type, data) {
|
|
55560
|
-
return computeID(this.config, type, data);
|
|
55561
|
-
}
|
|
55562
|
-
hydrateNestedList({
|
|
55563
|
-
fields,
|
|
55564
|
-
variables,
|
|
55565
|
-
linkedList,
|
|
55566
|
-
stepsFromConnection
|
|
55567
|
-
}) {
|
|
55568
|
-
const result = [];
|
|
55569
|
-
let partialData = false;
|
|
55570
|
-
let hasValues = false;
|
|
55571
|
-
for (const entry of linkedList) {
|
|
55572
|
-
if (Array.isArray(entry)) {
|
|
55573
|
-
const nestedValue = this.hydrateNestedList({
|
|
55574
|
-
fields,
|
|
55575
|
-
variables,
|
|
55576
|
-
linkedList: entry,
|
|
55577
|
-
stepsFromConnection
|
|
55578
|
-
});
|
|
55579
|
-
result.push(nestedValue.data);
|
|
55580
|
-
if (nestedValue.partial) {
|
|
55581
|
-
partialData = true;
|
|
55582
|
-
}
|
|
55583
|
-
continue;
|
|
55584
|
-
}
|
|
55585
|
-
if (entry === null) {
|
|
55586
|
-
result.push(entry);
|
|
55587
|
-
continue;
|
|
55588
|
-
}
|
|
55589
|
-
const { data, partial, hasData } = this.getSelection({
|
|
55590
|
-
parent: entry,
|
|
55591
|
-
selection: fields,
|
|
55592
|
-
variables,
|
|
55593
|
-
stepsFromConnection
|
|
55594
|
-
});
|
|
55595
|
-
result.push(data);
|
|
55596
|
-
if (partial) {
|
|
55597
|
-
partialData = true;
|
|
55598
|
-
}
|
|
55599
|
-
if (hasData) {
|
|
55600
|
-
hasValues = true;
|
|
55601
|
-
}
|
|
55602
|
-
}
|
|
55603
|
-
return {
|
|
55604
|
-
data: result,
|
|
55605
|
-
partial: partialData,
|
|
55606
|
-
hasData: hasValues
|
|
55607
|
-
};
|
|
55608
|
-
}
|
|
55609
|
-
extractNestedListIDs({
|
|
55610
|
-
value,
|
|
55611
|
-
abstract,
|
|
55612
|
-
recordID,
|
|
55613
|
-
key,
|
|
55614
|
-
linkedType,
|
|
55615
|
-
fields,
|
|
55616
|
-
variables,
|
|
55617
|
-
applyUpdates,
|
|
55618
|
-
specs,
|
|
55619
|
-
layer,
|
|
55620
|
-
forceNotify
|
|
55621
|
-
}) {
|
|
55622
|
-
const nestedIDs = [];
|
|
55623
|
-
const newIDs = [];
|
|
55624
|
-
for (const [i, entry] of value.entries()) {
|
|
55625
|
-
if (Array.isArray(entry)) {
|
|
55626
|
-
const inner = this.extractNestedListIDs({
|
|
55627
|
-
value: entry,
|
|
55628
|
-
abstract,
|
|
55629
|
-
recordID,
|
|
55630
|
-
key,
|
|
55631
|
-
linkedType,
|
|
55632
|
-
fields,
|
|
55633
|
-
variables,
|
|
55634
|
-
applyUpdates,
|
|
55635
|
-
specs,
|
|
55636
|
-
layer,
|
|
55637
|
-
forceNotify
|
|
55638
|
-
});
|
|
55639
|
-
newIDs.push(...inner.newIDs);
|
|
55640
|
-
nestedIDs[i] = inner.nestedIDs;
|
|
55641
|
-
continue;
|
|
55642
|
-
}
|
|
55643
|
-
if (entry === null || typeof entry === "undefined") {
|
|
55644
|
-
newIDs.push(null);
|
|
55645
|
-
nestedIDs[i] = null;
|
|
55646
|
-
continue;
|
|
55647
|
-
}
|
|
55648
|
-
const entryObj = entry;
|
|
55649
|
-
let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
|
|
55650
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
55651
|
-
(field) => typeof entry[field] === "undefined"
|
|
55652
|
-
).length > 0;
|
|
55653
|
-
const typename = entryObj.__typename;
|
|
55654
|
-
let innerType = linkedType;
|
|
55655
|
-
if (abstract) {
|
|
55656
|
-
if (!typename) {
|
|
55657
|
-
throw new Error("Encountered interface type without __typename in the payload");
|
|
55658
|
-
}
|
|
55659
|
-
innerType = typename;
|
|
55660
|
-
}
|
|
55661
|
-
if (!embedded) {
|
|
55662
|
-
const id = this.id(innerType, entry);
|
|
55663
|
-
if (id) {
|
|
55664
|
-
linkedID = id;
|
|
55665
|
-
} else {
|
|
55666
|
-
continue;
|
|
55667
|
-
}
|
|
55668
|
-
}
|
|
55669
|
-
this.writeSelection({
|
|
55670
|
-
root: rootID,
|
|
55671
|
-
selection: fields,
|
|
55672
|
-
parent: linkedID,
|
|
55673
|
-
data: entryObj,
|
|
55674
|
-
variables,
|
|
55675
|
-
toNotify: specs,
|
|
55676
|
-
applyUpdates,
|
|
55677
|
-
layer,
|
|
55678
|
-
forceNotify
|
|
55679
|
-
});
|
|
55680
|
-
newIDs.push(linkedID);
|
|
55681
|
-
nestedIDs[i] = linkedID;
|
|
55682
|
-
}
|
|
55683
|
-
return { newIDs, nestedIDs };
|
|
55684
|
-
}
|
|
55685
|
-
collectGarbage() {
|
|
55686
|
-
this.lifetimes.tick();
|
|
55687
|
-
if (this.storage.layerCount === 1) {
|
|
55688
|
-
this.storage.topLayer.removeUndefinedFields();
|
|
55689
|
-
}
|
|
55690
|
-
}
|
|
55691
|
-
};
|
|
55692
|
-
var rootID = "_ROOT_";
|
|
55693
|
-
|
|
55694
|
-
// src/runtime/cache/index.ts
|
|
55695
|
-
var cache_default = new Cache3();
|
|
55696
53959
|
|
|
55697
53960
|
// src/runtime/lib/types.ts
|
|
55698
53961
|
var CompiledFragmentKind = "HoudiniFragment" /* Fragment */;
|
|
@@ -55991,7 +54254,7 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
55991
54254
|
const targetPath = join(parentDir, child);
|
|
55992
54255
|
let original = await readFile(childPath) || "";
|
|
55993
54256
|
if (transforms?.[childPath]) {
|
|
55994
|
-
original = transforms[childPath](original);
|
|
54257
|
+
original = await transforms[childPath](original, childPath);
|
|
55995
54258
|
}
|
|
55996
54259
|
await writeFile(targetPath, original);
|
|
55997
54260
|
}
|
|
@@ -56419,7 +54682,13 @@ function exportStarFrom(where) {
|
|
|
56419
54682
|
}
|
|
56420
54683
|
function exportDefaultFrom(where, as) {
|
|
56421
54684
|
return `var ${as} = require("${where}");
|
|
56422
|
-
|
|
54685
|
+
${exportDefault(as)}`;
|
|
54686
|
+
}
|
|
54687
|
+
function exportDefault(as) {
|
|
54688
|
+
return `Object.defineProperty(exports, "${as}", { enumerable: true, get: function () { return __importDefault(${as}).default; } });`;
|
|
54689
|
+
}
|
|
54690
|
+
function importDefaultFrom(where, as) {
|
|
54691
|
+
return `var ${as} = require("${where}")`;
|
|
56423
54692
|
}
|
|
56424
54693
|
|
|
56425
54694
|
// src/codegen/utils/flattenSelections.ts
|
|
@@ -56463,6 +54732,9 @@ var FieldCollection = class {
|
|
|
56463
54732
|
this.add(selection2);
|
|
56464
54733
|
}
|
|
56465
54734
|
}
|
|
54735
|
+
get size() {
|
|
54736
|
+
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
54737
|
+
}
|
|
56466
54738
|
add(selection2) {
|
|
56467
54739
|
if (selection2.kind === "Field") {
|
|
56468
54740
|
const key = selection2.alias?.value || selection2.name.value;
|
|
@@ -56531,9 +54803,12 @@ var FieldCollection = class {
|
|
|
56531
54803
|
}
|
|
56532
54804
|
}
|
|
56533
54805
|
toSelectionSet() {
|
|
56534
|
-
return Object.values(this.inlineFragments).
|
|
54806
|
+
return Object.values(this.inlineFragments).flatMap((fragment) => {
|
|
54807
|
+
if (fragment.selection.size === 0) {
|
|
54808
|
+
return [];
|
|
54809
|
+
}
|
|
56535
54810
|
fragment.astNode.selectionSet.selections = fragment.selection.toSelectionSet();
|
|
56536
|
-
return fragment.astNode;
|
|
54811
|
+
return [fragment.astNode];
|
|
56537
54812
|
}).concat(
|
|
56538
54813
|
Object.values(this.fields).map((field) => {
|
|
56539
54814
|
if (field.astNode.selectionSet) {
|
|
@@ -56716,7 +54991,7 @@ function serializeValue(value) {
|
|
|
56716
54991
|
if (typeof value === "object" && value !== null) {
|
|
56717
54992
|
return AST4.objectExpression(
|
|
56718
54993
|
Object.entries(value).filter(([, value2]) => typeof value2 !== "undefined").map(
|
|
56719
|
-
([key, value2]) => AST4.objectProperty(AST4.
|
|
54994
|
+
([key, value2]) => AST4.objectProperty(AST4.stringLiteral(key), serializeValue(value2))
|
|
56720
54995
|
)
|
|
56721
54996
|
);
|
|
56722
54997
|
}
|
|
@@ -58270,6 +56545,23 @@ function artifactGenerator(stats) {
|
|
|
58270
56545
|
document: doc
|
|
58271
56546
|
})
|
|
58272
56547
|
};
|
|
56548
|
+
const pluginsData = config2.plugins.reduce(
|
|
56549
|
+
(prev, plugin) => {
|
|
56550
|
+
if (!plugin.artifact_data) {
|
|
56551
|
+
return prev;
|
|
56552
|
+
}
|
|
56553
|
+
const result = { ...prev };
|
|
56554
|
+
const dataToAdd = plugin.artifact_data(config2, doc) ?? {};
|
|
56555
|
+
if (Object.keys(dataToAdd).length > 0) {
|
|
56556
|
+
result[plugin.name] = dataToAdd;
|
|
56557
|
+
}
|
|
56558
|
+
return result;
|
|
56559
|
+
},
|
|
56560
|
+
{}
|
|
56561
|
+
);
|
|
56562
|
+
if (Object.keys(pluginsData).length > 0) {
|
|
56563
|
+
artifact.pluginsData = pluginsData;
|
|
56564
|
+
}
|
|
58273
56565
|
if (inputs && inputs.length > 0) {
|
|
58274
56566
|
artifact.input = inputObject(config2, inputs);
|
|
58275
56567
|
}
|
|
@@ -58333,77 +56625,132 @@ function artifactGenerator(stats) {
|
|
|
58333
56625
|
};
|
|
58334
56626
|
}
|
|
58335
56627
|
|
|
58336
|
-
// src/codegen/generators/runtime/
|
|
56628
|
+
// src/codegen/generators/runtime/graphqlFunction.ts
|
|
58337
56629
|
var recast6 = __toESM(require_main2(), 1);
|
|
58338
56630
|
var AST6 = recast6.types.builders;
|
|
58339
|
-
async function
|
|
58340
|
-
await Promise.all([
|
|
58341
|
-
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
58342
|
-
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
58343
|
-
const configFilePath = path_exports.join(config2.runtimeDirectory, "lib", "config.js");
|
|
58344
|
-
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
|
|
58345
|
-
return content.replace("HOUDINI_CONFIG_PATH", relativePath);
|
|
58346
|
-
},
|
|
58347
|
-
[path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
58348
|
-
return content.replace("SITE_URL", siteURL);
|
|
58349
|
-
}
|
|
58350
|
-
}),
|
|
58351
|
-
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
58352
|
-
]);
|
|
56631
|
+
async function generateGraphqlReturnTypes(config2, docs) {
|
|
58353
56632
|
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
58354
|
-
const
|
|
56633
|
+
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
56634
|
+
const contents = await parseJS(fileContent);
|
|
58355
56635
|
const graphql_tag_return = config2.plugins.find(
|
|
58356
56636
|
(plugin) => plugin.graphql_tag_return
|
|
58357
56637
|
)?.graphql_tag_return;
|
|
58358
|
-
if (graphql_tag_return
|
|
58359
|
-
|
|
58360
|
-
|
|
58361
|
-
|
|
58362
|
-
|
|
58363
|
-
|
|
58364
|
-
|
|
58365
|
-
|
|
58366
|
-
|
|
58367
|
-
|
|
58368
|
-
|
|
58369
|
-
|
|
58370
|
-
|
|
58371
|
-
|
|
58372
|
-
|
|
58373
|
-
if (return_value) {
|
|
58374
|
-
overloaded_returns[doc.originalString] = return_value;
|
|
56638
|
+
if (!graphql_tag_return || !contents) {
|
|
56639
|
+
return fileContent;
|
|
56640
|
+
}
|
|
56641
|
+
const overloaded_returns = {};
|
|
56642
|
+
for (const doc of docs) {
|
|
56643
|
+
const return_value = graphql_tag_return({
|
|
56644
|
+
config: config2,
|
|
56645
|
+
doc,
|
|
56646
|
+
ensure_import({ identifier, module: module2 }) {
|
|
56647
|
+
ensureImports({
|
|
56648
|
+
config: config2,
|
|
56649
|
+
body: contents.script.body,
|
|
56650
|
+
sourceModule: module2,
|
|
56651
|
+
import: [identifier]
|
|
56652
|
+
});
|
|
58375
56653
|
}
|
|
56654
|
+
});
|
|
56655
|
+
if (return_value) {
|
|
56656
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
58376
56657
|
}
|
|
58377
|
-
|
|
58378
|
-
|
|
58379
|
-
|
|
58380
|
-
|
|
58381
|
-
|
|
58382
|
-
|
|
58383
|
-
|
|
58384
|
-
|
|
58385
|
-
|
|
58386
|
-
)
|
|
58387
|
-
|
|
58388
|
-
|
|
58389
|
-
|
|
58390
|
-
|
|
58391
|
-
|
|
58392
|
-
|
|
58393
|
-
|
|
58394
|
-
|
|
58395
|
-
|
|
58396
|
-
)
|
|
58397
|
-
)
|
|
56658
|
+
}
|
|
56659
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
56660
|
+
for (const [i, expression] of (contents?.script.body ?? []).entries()) {
|
|
56661
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
56662
|
+
continue;
|
|
56663
|
+
}
|
|
56664
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
56665
|
+
const input = AST6.identifier("str");
|
|
56666
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
56667
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
56668
|
+
);
|
|
56669
|
+
contents?.script.body.splice(
|
|
56670
|
+
i,
|
|
56671
|
+
0,
|
|
56672
|
+
AST6.exportNamedDeclaration(
|
|
56673
|
+
AST6.tsDeclareFunction(
|
|
56674
|
+
AST6.identifier("graphql"),
|
|
56675
|
+
[input],
|
|
56676
|
+
AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
|
|
58398
56677
|
)
|
|
58399
|
-
)
|
|
58400
|
-
|
|
58401
|
-
break;
|
|
56678
|
+
)
|
|
56679
|
+
);
|
|
58402
56680
|
}
|
|
58403
|
-
|
|
56681
|
+
break;
|
|
58404
56682
|
}
|
|
56683
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
58405
56684
|
}
|
|
58406
56685
|
}
|
|
56686
|
+
|
|
56687
|
+
// src/codegen/generators/runtime/injectPlugins.ts
|
|
56688
|
+
async function injectPlugins({
|
|
56689
|
+
config: config2,
|
|
56690
|
+
content,
|
|
56691
|
+
importStatement,
|
|
56692
|
+
exportStatement
|
|
56693
|
+
}) {
|
|
56694
|
+
const client_plugins = config2.plugins.filter((plugin) => plugin.client_plugins).reduce((acc, plugin) => {
|
|
56695
|
+
let plugins = plugin.client_plugins;
|
|
56696
|
+
if (typeof plugins === "function") {
|
|
56697
|
+
plugins = plugins(config2, config2.pluginConfig(plugin.name));
|
|
56698
|
+
}
|
|
56699
|
+
return [...acc, ...Object.entries(plugins)];
|
|
56700
|
+
}, []);
|
|
56701
|
+
return client_plugins.length > 0 ? `
|
|
56702
|
+
${client_plugins.map((plugin, i) => importStatement(plugin[0], `plugin${i}`))}
|
|
56703
|
+
|
|
56704
|
+
const plugins = [
|
|
56705
|
+
${client_plugins.map((plugin, i) => {
|
|
56706
|
+
const suffix = plugin[1] !== null ? `(${JSON.stringify(plugin[1])})` : "";
|
|
56707
|
+
return `plugin${i}${suffix}`;
|
|
56708
|
+
}).join(",\n")}
|
|
56709
|
+
]
|
|
56710
|
+
|
|
56711
|
+
${exportStatement("plugins")}
|
|
56712
|
+
` : content;
|
|
56713
|
+
}
|
|
56714
|
+
|
|
56715
|
+
// src/codegen/generators/runtime/pluginIndex.ts
|
|
56716
|
+
async function generatePluginIndex({
|
|
56717
|
+
config: config2,
|
|
56718
|
+
exportStatement
|
|
56719
|
+
}) {
|
|
56720
|
+
const indexFile = `${exportStatement("../runtime/client/plugins/index.js")}
|
|
56721
|
+
`;
|
|
56722
|
+
const typedefs = `export * from '../runtime/client/plugins'`;
|
|
56723
|
+
await fs_exports.mkdirp(config2.pluginRootDirectory);
|
|
56724
|
+
await Promise.all([
|
|
56725
|
+
fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.js"), indexFile),
|
|
56726
|
+
fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.d.ts"), typedefs)
|
|
56727
|
+
]);
|
|
56728
|
+
}
|
|
56729
|
+
|
|
56730
|
+
// src/codegen/generators/runtime/index.ts
|
|
56731
|
+
async function runtimeGenerator(config2, docs) {
|
|
56732
|
+
const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
56733
|
+
const exportStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
56734
|
+
const exportStar = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
|
|
56735
|
+
await Promise.all([
|
|
56736
|
+
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
56737
|
+
[path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
56738
|
+
return content.replace("SITE_URL", siteURL);
|
|
56739
|
+
},
|
|
56740
|
+
[path_exports.join(config2.runtimeSource, "imports", "config.js")]: (content) => {
|
|
56741
|
+
const configFilePath = path_exports.join(config2.runtimeDirectory, "imports", "config.js");
|
|
56742
|
+
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
|
|
56743
|
+
return `${importStatement(relativePath, "config")}
|
|
56744
|
+
${exportStatement("config")}
|
|
56745
|
+
`;
|
|
56746
|
+
},
|
|
56747
|
+
[path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
56748
|
+
}),
|
|
56749
|
+
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin)),
|
|
56750
|
+
generatePluginIndex({ config: config2, exportStatement: exportStar })
|
|
56751
|
+
]);
|
|
56752
|
+
await generateGraphqlReturnTypes(config2, docs);
|
|
56753
|
+
}
|
|
58407
56754
|
async function generatePluginRuntime(config2, plugin) {
|
|
58408
56755
|
if (houdini_mode.is_testing) {
|
|
58409
56756
|
return;
|
|
@@ -59469,6 +57816,7 @@ async function writeIndexFile2(config2, docs) {
|
|
|
59469
57816
|
const export_star_from = ({ module: module2 }) => "\n" + (cjs ? exportStarFrom(module2) : `export * from "${module2}"`) + "\n";
|
|
59470
57817
|
const export_default_as = ({ module: module2, as }) => "\n" + (cjs ? exportDefaultFrom(module2, as) : `export { default as ${as} } from "${module2}"`) + "\n";
|
|
59471
57818
|
body += [
|
|
57819
|
+
export_star_from({ module: "./" + path_exports.join(runtimeDir, "client") }),
|
|
59472
57820
|
export_star_from({ module: runtimeDir }),
|
|
59473
57821
|
export_star_from({ module: artifactDir }),
|
|
59474
57822
|
export_star_from({ module: definitionsDir })
|
|
@@ -59581,7 +57929,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59581
57929
|
}
|
|
59582
57930
|
|
|
59583
57931
|
// src/codegen/transforms/schema.ts
|
|
59584
|
-
var
|
|
57932
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
59585
57933
|
async function graphqlExtensions(config2, documents) {
|
|
59586
57934
|
const internalSchema = `
|
|
59587
57935
|
enum CachePolicy {
|
|
@@ -59659,19 +58007,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59659
58007
|
"""
|
|
59660
58008
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59661
58009
|
`;
|
|
59662
|
-
let currentSchema =
|
|
58010
|
+
let currentSchema = graphql19.printSchema(config2.schema);
|
|
59663
58011
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59664
58012
|
currentSchema += internalSchema;
|
|
59665
58013
|
}
|
|
59666
58014
|
config2.newSchema += internalSchema;
|
|
59667
|
-
config2.schema =
|
|
58015
|
+
config2.schema = graphql19.buildSchema(currentSchema);
|
|
59668
58016
|
}
|
|
59669
58017
|
|
|
59670
58018
|
// src/codegen/transforms/typename.ts
|
|
59671
|
-
var
|
|
58019
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
59672
58020
|
async function addTypename(config2, documents) {
|
|
59673
58021
|
for (const doc of documents) {
|
|
59674
|
-
doc.document =
|
|
58022
|
+
doc.document = graphql20.visit(doc.document, {
|
|
59675
58023
|
Field(node, key, parent, path2, ancestors) {
|
|
59676
58024
|
if (!node.selectionSet) {
|
|
59677
58025
|
return;
|
|
@@ -59683,7 +58031,7 @@ async function addTypename(config2, documents) {
|
|
|
59683
58031
|
);
|
|
59684
58032
|
const field = type.getFields()[node.name.value];
|
|
59685
58033
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59686
|
-
if (
|
|
58034
|
+
if (graphql20.isInterfaceType(fieldType) || graphql20.isUnionType(fieldType)) {
|
|
59687
58035
|
return {
|
|
59688
58036
|
...node,
|
|
59689
58037
|
selectionSet: {
|
|
@@ -59691,9 +58039,9 @@ async function addTypename(config2, documents) {
|
|
|
59691
58039
|
selections: [
|
|
59692
58040
|
...node.selectionSet.selections,
|
|
59693
58041
|
{
|
|
59694
|
-
kind:
|
|
58042
|
+
kind: graphql20.Kind.FIELD,
|
|
59695
58043
|
name: {
|
|
59696
|
-
kind:
|
|
58044
|
+
kind: graphql20.Kind.NAME,
|
|
59697
58045
|
value: "__typename"
|
|
59698
58046
|
}
|
|
59699
58047
|
}
|
|
@@ -59707,10 +58055,10 @@ async function addTypename(config2, documents) {
|
|
|
59707
58055
|
}
|
|
59708
58056
|
|
|
59709
58057
|
// src/codegen/transforms/addID.ts
|
|
59710
|
-
var
|
|
58058
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
59711
58059
|
async function addID(config2, documents) {
|
|
59712
58060
|
for (const doc of documents) {
|
|
59713
|
-
doc.document =
|
|
58061
|
+
doc.document = graphql21.visit(doc.document, {
|
|
59714
58062
|
Field(node, key, parent, path2, ancestors) {
|
|
59715
58063
|
if (!node.selectionSet) {
|
|
59716
58064
|
return;
|
|
@@ -59723,7 +58071,7 @@ async function addID(config2, documents) {
|
|
|
59723
58071
|
const field = type.getFields()[node.name.value];
|
|
59724
58072
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59725
58073
|
if (node.selectionSet?.selections.length > 0) {
|
|
59726
|
-
if (!
|
|
58074
|
+
if (!graphql21.isObjectType(fieldType) && !graphql21.isInterfaceType(fieldType)) {
|
|
59727
58075
|
return;
|
|
59728
58076
|
}
|
|
59729
58077
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -59738,9 +58086,9 @@ async function addID(config2, documents) {
|
|
|
59738
58086
|
continue;
|
|
59739
58087
|
}
|
|
59740
58088
|
selections.push({
|
|
59741
|
-
kind:
|
|
58089
|
+
kind: graphql21.Kind.FIELD,
|
|
59742
58090
|
name: {
|
|
59743
|
-
kind:
|
|
58091
|
+
kind: graphql21.Kind.NAME,
|
|
59744
58092
|
value: keyField
|
|
59745
58093
|
}
|
|
59746
58094
|
});
|
|
@@ -59759,8 +58107,8 @@ async function addID(config2, documents) {
|
|
|
59759
58107
|
}
|
|
59760
58108
|
|
|
59761
58109
|
// src/codegen/transforms/fragmentVariables.ts
|
|
59762
|
-
var
|
|
59763
|
-
var GraphqlKinds2 =
|
|
58110
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
58111
|
+
var GraphqlKinds2 = graphql22.Kind;
|
|
59764
58112
|
async function fragmentVariables(config2, documents) {
|
|
59765
58113
|
const fragments = collectFragments(config2, documents);
|
|
59766
58114
|
const generatedFragments = {};
|
|
@@ -59783,7 +58131,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
59783
58131
|
});
|
|
59784
58132
|
}
|
|
59785
58133
|
const doc = {
|
|
59786
|
-
kind:
|
|
58134
|
+
kind: graphql22.Kind.DOCUMENT,
|
|
59787
58135
|
definitions: Object.values(generatedFragments)
|
|
59788
58136
|
};
|
|
59789
58137
|
documents.push({
|
|
@@ -59819,7 +58167,7 @@ function inlineFragmentArgs({
|
|
|
59819
58167
|
filepath,
|
|
59820
58168
|
document
|
|
59821
58169
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
59822
|
-
const result =
|
|
58170
|
+
const result = graphql22.visit(document, {
|
|
59823
58171
|
FragmentSpread(node) {
|
|
59824
58172
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
59825
58173
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -59907,7 +58255,7 @@ function inlineFragmentArgs({
|
|
|
59907
58255
|
});
|
|
59908
58256
|
if (newName) {
|
|
59909
58257
|
result.name = {
|
|
59910
|
-
kind:
|
|
58258
|
+
kind: graphql22.Kind.NAME,
|
|
59911
58259
|
value: newName
|
|
59912
58260
|
};
|
|
59913
58261
|
}
|
|
@@ -60019,7 +58367,7 @@ function operationScope(operation) {
|
|
|
60019
58367
|
}
|
|
60020
58368
|
|
|
60021
58369
|
// src/codegen/validators/typeCheck.ts
|
|
60022
|
-
var
|
|
58370
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
60023
58371
|
async function typeCheck(config2, docs) {
|
|
60024
58372
|
const errors = [];
|
|
60025
58373
|
const freeLists = [];
|
|
@@ -60027,11 +58375,11 @@ async function typeCheck(config2, docs) {
|
|
|
60027
58375
|
const listTypes = [];
|
|
60028
58376
|
const fragments = {};
|
|
60029
58377
|
for (const { document: parsed, filename } of docs) {
|
|
60030
|
-
|
|
60031
|
-
[
|
|
58378
|
+
graphql23.visit(parsed, {
|
|
58379
|
+
[graphql23.Kind.FRAGMENT_DEFINITION](definition) {
|
|
60032
58380
|
fragments[definition.name.value] = definition;
|
|
60033
58381
|
},
|
|
60034
|
-
[
|
|
58382
|
+
[graphql23.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
60035
58383
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
60036
58384
|
return;
|
|
60037
58385
|
}
|
|
@@ -60077,14 +58425,14 @@ async function typeCheck(config2, docs) {
|
|
|
60077
58425
|
);
|
|
60078
58426
|
return;
|
|
60079
58427
|
}
|
|
60080
|
-
if (
|
|
58428
|
+
if (graphql23.isListType(rootType) || graphql23.isNonNullType(rootType) && graphql23.isListType(rootType.ofType)) {
|
|
60081
58429
|
needsParent = true;
|
|
60082
58430
|
break;
|
|
60083
58431
|
}
|
|
60084
|
-
if (
|
|
58432
|
+
if (graphql23.isNonNullType(rootType) && "ofType" in rootType) {
|
|
60085
58433
|
rootType = rootType.ofType;
|
|
60086
58434
|
}
|
|
60087
|
-
if (
|
|
58435
|
+
if (graphql23.isScalarType(rootType)) {
|
|
60088
58436
|
break;
|
|
60089
58437
|
}
|
|
60090
58438
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -60160,9 +58508,9 @@ async function typeCheck(config2, docs) {
|
|
|
60160
58508
|
);
|
|
60161
58509
|
}
|
|
60162
58510
|
let targetTypes = [type];
|
|
60163
|
-
if (
|
|
58511
|
+
if (graphql23.isUnionType(type)) {
|
|
60164
58512
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
60165
|
-
} else if (
|
|
58513
|
+
} else if (graphql23.isInterfaceType(type)) {
|
|
60166
58514
|
try {
|
|
60167
58515
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
60168
58516
|
if (!type.getFields()[key]) {
|
|
@@ -60200,13 +58548,13 @@ async function typeCheck(config2, docs) {
|
|
|
60200
58548
|
if (errors.length > 0) {
|
|
60201
58549
|
throw errors;
|
|
60202
58550
|
}
|
|
60203
|
-
const rules = (filepath) => [...
|
|
58551
|
+
const rules = (filepath) => [...graphql23.specifiedRules].filter(
|
|
60204
58552
|
(rule) => ![
|
|
60205
|
-
|
|
60206
|
-
|
|
60207
|
-
|
|
60208
|
-
|
|
60209
|
-
|
|
58553
|
+
graphql23.NoUnusedFragmentsRule,
|
|
58554
|
+
graphql23.KnownFragmentNamesRule,
|
|
58555
|
+
graphql23.ExecutableDefinitionsRule,
|
|
58556
|
+
graphql23.KnownDirectivesRule,
|
|
58557
|
+
graphql23.KnownArgumentNamesRule
|
|
60210
58558
|
].includes(rule)
|
|
60211
58559
|
).concat(
|
|
60212
58560
|
validateLists({
|
|
@@ -60225,7 +58573,7 @@ async function typeCheck(config2, docs) {
|
|
|
60225
58573
|
noUnusedFragmentArguments(config2)
|
|
60226
58574
|
);
|
|
60227
58575
|
for (const { filename, document: parsed } of docs) {
|
|
60228
|
-
for (const error of
|
|
58576
|
+
for (const error of graphql23.validate(config2.schema, parsed, rules(filename))) {
|
|
60229
58577
|
errors.push(
|
|
60230
58578
|
new HoudiniError({
|
|
60231
58579
|
filepath: filename,
|
|
@@ -60251,7 +58599,7 @@ var validateLists = ({
|
|
|
60251
58599
|
if (!config2.isListFragment(node.name.value)) {
|
|
60252
58600
|
if (!fragments[node.name.value]) {
|
|
60253
58601
|
ctx.reportError(
|
|
60254
|
-
new
|
|
58602
|
+
new graphql23.GraphQLError(
|
|
60255
58603
|
"Encountered unknown fragment: " + node.name.value
|
|
60256
58604
|
)
|
|
60257
58605
|
);
|
|
@@ -60261,7 +58609,7 @@ var validateLists = ({
|
|
|
60261
58609
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
60262
58610
|
if (!lists.includes(listName)) {
|
|
60263
58611
|
ctx.reportError(
|
|
60264
|
-
new
|
|
58612
|
+
new graphql23.GraphQLError(
|
|
60265
58613
|
"Encountered fragment referencing unknown list: " + listName
|
|
60266
58614
|
)
|
|
60267
58615
|
);
|
|
@@ -60286,7 +58634,7 @@ var validateLists = ({
|
|
|
60286
58634
|
);
|
|
60287
58635
|
if (parentArg) {
|
|
60288
58636
|
ctx.reportError(
|
|
60289
|
-
new
|
|
58637
|
+
new graphql23.GraphQLError(
|
|
60290
58638
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
60291
58639
|
)
|
|
60292
58640
|
);
|
|
@@ -60302,7 +58650,7 @@ var validateLists = ({
|
|
|
60302
58650
|
return;
|
|
60303
58651
|
}
|
|
60304
58652
|
ctx.reportError(
|
|
60305
|
-
new
|
|
58653
|
+
new graphql23.GraphQLError(
|
|
60306
58654
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
60307
58655
|
)
|
|
60308
58656
|
);
|
|
@@ -60312,7 +58660,7 @@ var validateLists = ({
|
|
|
60312
58660
|
const directiveName = node.name.value;
|
|
60313
58661
|
if (directiveName === "connection") {
|
|
60314
58662
|
ctx.reportError(
|
|
60315
|
-
new
|
|
58663
|
+
new graphql23.GraphQLError(
|
|
60316
58664
|
"@connection was renamed to @list. Please change your components. If you were using `cache.connection` in your components, you will need to update that to `cache.list` too."
|
|
60317
58665
|
)
|
|
60318
58666
|
);
|
|
@@ -60321,7 +58669,7 @@ var validateLists = ({
|
|
|
60321
58669
|
if (!config2.isInternalDirective(node)) {
|
|
60322
58670
|
if (!config2.schema.getDirective(directiveName)) {
|
|
60323
58671
|
ctx.reportError(
|
|
60324
|
-
new
|
|
58672
|
+
new graphql23.GraphQLError(
|
|
60325
58673
|
"Encountered unknown directive: " + directiveName
|
|
60326
58674
|
)
|
|
60327
58675
|
);
|
|
@@ -60330,7 +58678,7 @@ var validateLists = ({
|
|
|
60330
58678
|
}
|
|
60331
58679
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
60332
58680
|
ctx.reportError(
|
|
60333
|
-
new
|
|
58681
|
+
new graphql23.GraphQLError(
|
|
60334
58682
|
"Encountered directive referencing unknown list: " + directiveName
|
|
60335
58683
|
)
|
|
60336
58684
|
);
|
|
@@ -60341,7 +58689,7 @@ var validateLists = ({
|
|
|
60341
58689
|
};
|
|
60342
58690
|
function knownArguments(config2) {
|
|
60343
58691
|
return function(ctx) {
|
|
60344
|
-
const nativeValidator =
|
|
58692
|
+
const nativeValidator = graphql23.KnownArgumentNamesRule(ctx);
|
|
60345
58693
|
return {
|
|
60346
58694
|
...nativeValidator,
|
|
60347
58695
|
Directive(directiveNode) {
|
|
@@ -60374,7 +58722,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60374
58722
|
for (const arg of node.arguments || []) {
|
|
60375
58723
|
if (arg.value.kind !== "ObjectValue") {
|
|
60376
58724
|
ctx.reportError(
|
|
60377
|
-
new
|
|
58725
|
+
new graphql23.GraphQLError("values in @arguments must be an object")
|
|
60378
58726
|
);
|
|
60379
58727
|
return;
|
|
60380
58728
|
}
|
|
@@ -60384,13 +58732,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60384
58732
|
);
|
|
60385
58733
|
if (!typeArg) {
|
|
60386
58734
|
ctx.reportError(
|
|
60387
|
-
new
|
|
58735
|
+
new graphql23.GraphQLError("missing type field for @arguments directive")
|
|
60388
58736
|
);
|
|
60389
58737
|
return;
|
|
60390
58738
|
}
|
|
60391
|
-
if (typeArg.value.kind !==
|
|
58739
|
+
if (typeArg.value.kind !== graphql23.Kind.STRING) {
|
|
60392
58740
|
ctx.reportError(
|
|
60393
|
-
new
|
|
58741
|
+
new graphql23.GraphQLError("type field to @arguments must be a string")
|
|
60394
58742
|
);
|
|
60395
58743
|
return;
|
|
60396
58744
|
}
|
|
@@ -60403,7 +58751,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60403
58751
|
);
|
|
60404
58752
|
if (typeArg.value.value !== defaultValueType) {
|
|
60405
58753
|
ctx.reportError(
|
|
60406
|
-
new
|
|
58754
|
+
new graphql23.GraphQLError(
|
|
60407
58755
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60408
58756
|
)
|
|
60409
58757
|
);
|
|
@@ -60421,7 +58769,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60421
58769
|
try {
|
|
60422
58770
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60423
58771
|
} catch (e) {
|
|
60424
|
-
ctx.reportError(new
|
|
58772
|
+
ctx.reportError(new graphql23.GraphQLError(e.message));
|
|
60425
58773
|
return;
|
|
60426
58774
|
}
|
|
60427
58775
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60444,7 +58792,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60444
58792
|
);
|
|
60445
58793
|
if (missing.length > 0) {
|
|
60446
58794
|
ctx.reportError(
|
|
60447
|
-
new
|
|
58795
|
+
new graphql23.GraphQLError(
|
|
60448
58796
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60449
58797
|
)
|
|
60450
58798
|
);
|
|
@@ -60455,7 +58803,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60455
58803
|
);
|
|
60456
58804
|
if (unknown.length > 0) {
|
|
60457
58805
|
ctx.reportError(
|
|
60458
|
-
new
|
|
58806
|
+
new graphql23.GraphQLError(
|
|
60459
58807
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60460
58808
|
)
|
|
60461
58809
|
);
|
|
@@ -60467,7 +58815,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60467
58815
|
]
|
|
60468
58816
|
);
|
|
60469
58817
|
for (const [applied, target] of zipped) {
|
|
60470
|
-
if (applied.value.kind ===
|
|
58818
|
+
if (applied.value.kind === graphql23.Kind.VARIABLE || applied.value.kind === graphql23.Kind.LIST || applied.value.kind === graphql23.Kind.OBJECT) {
|
|
60471
58819
|
continue;
|
|
60472
58820
|
}
|
|
60473
58821
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60476,7 +58824,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60476
58824
|
);
|
|
60477
58825
|
if (appliedType !== target) {
|
|
60478
58826
|
ctx.reportError(
|
|
60479
|
-
new
|
|
58827
|
+
new graphql23.GraphQLError(
|
|
60480
58828
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60481
58829
|
)
|
|
60482
58830
|
);
|
|
@@ -60497,7 +58845,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60497
58845
|
}
|
|
60498
58846
|
if (alreadyPaginated) {
|
|
60499
58847
|
ctx.reportError(
|
|
60500
|
-
new
|
|
58848
|
+
new graphql23.GraphQLError(
|
|
60501
58849
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60502
58850
|
)
|
|
60503
58851
|
);
|
|
@@ -60512,7 +58860,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60512
58860
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60513
58861
|
if (hasRequiredArgs) {
|
|
60514
58862
|
ctx.reportError(
|
|
60515
|
-
new
|
|
58863
|
+
new graphql23.GraphQLError(
|
|
60516
58864
|
"@paginate cannot appear on a document with required args"
|
|
60517
58865
|
)
|
|
60518
58866
|
);
|
|
@@ -60544,14 +58892,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60544
58892
|
const backwards = appliedArgs.has("last");
|
|
60545
58893
|
if (!forward && !backwards) {
|
|
60546
58894
|
ctx.reportError(
|
|
60547
|
-
new
|
|
58895
|
+
new graphql23.GraphQLError(
|
|
60548
58896
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60549
58897
|
)
|
|
60550
58898
|
);
|
|
60551
58899
|
}
|
|
60552
58900
|
if (forward && backwards) {
|
|
60553
58901
|
ctx.reportError(
|
|
60554
|
-
new
|
|
58902
|
+
new graphql23.GraphQLError(
|
|
60555
58903
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60556
58904
|
)
|
|
60557
58905
|
);
|
|
@@ -60565,7 +58913,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60565
58913
|
);
|
|
60566
58914
|
if (!appliedLimitArg) {
|
|
60567
58915
|
ctx.reportError(
|
|
60568
|
-
new
|
|
58916
|
+
new graphql23.GraphQLError(
|
|
60569
58917
|
"A field with offset-based pagination must have a limit argument"
|
|
60570
58918
|
)
|
|
60571
58919
|
);
|
|
@@ -60581,20 +58929,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60581
58929
|
const args = /* @__PURE__ */ new Set();
|
|
60582
58930
|
return {
|
|
60583
58931
|
enter(node) {
|
|
60584
|
-
if (node.kind ===
|
|
58932
|
+
if (node.kind === graphql23.Kind.FRAGMENT_DEFINITION) {
|
|
60585
58933
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60586
58934
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60587
58935
|
args.add(arg);
|
|
60588
58936
|
}
|
|
60589
|
-
} else if (node.kind ===
|
|
58937
|
+
} else if (node.kind === graphql23.Kind.VARIABLE) {
|
|
60590
58938
|
args.delete(node.name.value);
|
|
60591
58939
|
}
|
|
60592
58940
|
},
|
|
60593
58941
|
leave(node) {
|
|
60594
|
-
if (node.kind ===
|
|
58942
|
+
if (node.kind === graphql23.Kind.FRAGMENT_DEFINITION) {
|
|
60595
58943
|
if (args.size > 0) {
|
|
60596
58944
|
ctx.reportError(
|
|
60597
|
-
new
|
|
58945
|
+
new graphql23.GraphQLError(
|
|
60598
58946
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60599
58947
|
)
|
|
60600
58948
|
);
|
|
@@ -60630,7 +58978,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60630
58978
|
if (definition.kind === "OperationDefinition") {
|
|
60631
58979
|
if (definition.operation !== "query") {
|
|
60632
58980
|
ctx.reportError(
|
|
60633
|
-
new
|
|
58981
|
+
new graphql23.GraphQLError(
|
|
60634
58982
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60635
58983
|
)
|
|
60636
58984
|
);
|
|
@@ -60642,7 +58990,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60642
58990
|
}
|
|
60643
58991
|
if (!possibleNodes.includes(definitionType)) {
|
|
60644
58992
|
ctx.reportError(
|
|
60645
|
-
new
|
|
58993
|
+
new graphql23.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60646
58994
|
);
|
|
60647
58995
|
}
|
|
60648
58996
|
}
|
|
@@ -60661,7 +59009,7 @@ function checkMutationOperation(config2) {
|
|
|
60661
59009
|
);
|
|
60662
59010
|
if (append && prepend) {
|
|
60663
59011
|
ctx.reportError(
|
|
60664
|
-
new
|
|
59012
|
+
new graphql23.GraphQLError(
|
|
60665
59013
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60666
59014
|
)
|
|
60667
59015
|
);
|
|
@@ -60675,7 +59023,7 @@ function checkMutationOperation(config2) {
|
|
|
60675
59023
|
);
|
|
60676
59024
|
if (parentId && allLists) {
|
|
60677
59025
|
ctx.reportError(
|
|
60678
|
-
new
|
|
59026
|
+
new graphql23.GraphQLError(
|
|
60679
59027
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60680
59028
|
)
|
|
60681
59029
|
);
|
|
@@ -60697,7 +59045,7 @@ function checkMaskDirective(config2) {
|
|
|
60697
59045
|
);
|
|
60698
59046
|
if (maskEnableDirective && maskDisableDirective) {
|
|
60699
59047
|
ctx.reportError(
|
|
60700
|
-
new
|
|
59048
|
+
new graphql23.GraphQLError(
|
|
60701
59049
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
60702
59050
|
)
|
|
60703
59051
|
);
|
|
@@ -60713,7 +59061,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
60713
59061
|
if (!nodeInterface) {
|
|
60714
59062
|
return null;
|
|
60715
59063
|
}
|
|
60716
|
-
if (!
|
|
59064
|
+
if (!graphql23.isInterfaceType(nodeInterface)) {
|
|
60717
59065
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
60718
59066
|
return null;
|
|
60719
59067
|
}
|
|
@@ -60811,11 +59159,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
60811
59159
|
}
|
|
60812
59160
|
|
|
60813
59161
|
// src/codegen/validators/noIDAlias.ts
|
|
60814
|
-
var
|
|
59162
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
60815
59163
|
async function noIDAlias(config2, docs) {
|
|
60816
59164
|
const errors = [];
|
|
60817
59165
|
for (const { filename, document } of docs) {
|
|
60818
|
-
|
|
59166
|
+
graphql24.visit(document, {
|
|
60819
59167
|
Field(node, _, __, ___, ancestors) {
|
|
60820
59168
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
60821
59169
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -61013,12 +59361,17 @@ async function processJSFile(config2, contents) {
|
|
|
61013
59361
|
return documents;
|
|
61014
59362
|
}
|
|
61015
59363
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
61016
|
-
|
|
59364
|
+
try {
|
|
59365
|
+
var parsedDoc = graphql25.parse(document);
|
|
59366
|
+
} catch (e) {
|
|
59367
|
+
console.log("error parsing!!");
|
|
59368
|
+
throw e;
|
|
59369
|
+
}
|
|
61017
59370
|
const operations = parsedDoc.definitions.filter(
|
|
61018
|
-
({ kind: kind2 }) => kind2 ===
|
|
59371
|
+
({ kind: kind2 }) => kind2 === graphql25.Kind.OPERATION_DEFINITION
|
|
61019
59372
|
);
|
|
61020
59373
|
const fragments = parsedDoc.definitions.filter(
|
|
61021
|
-
({ kind: kind2 }) => kind2 ===
|
|
59374
|
+
({ kind: kind2 }) => kind2 === graphql25.Kind.FRAGMENT_DEFINITION
|
|
61022
59375
|
);
|
|
61023
59376
|
if (operations.length > 1) {
|
|
61024
59377
|
throw new HoudiniError({
|