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
package/build/test-cjs/index.js
CHANGED
|
@@ -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));
|
|
@@ -15645,42 +15645,42 @@ var require_node = __commonJS({
|
|
|
15645
15645
|
return Link2;
|
|
15646
15646
|
}(events_1.EventEmitter);
|
|
15647
15647
|
exports.Link = Link;
|
|
15648
|
-
var
|
|
15649
|
-
function
|
|
15648
|
+
var File = function() {
|
|
15649
|
+
function File2(link, node, flags, fd) {
|
|
15650
15650
|
this.position = 0;
|
|
15651
15651
|
this.link = link;
|
|
15652
15652
|
this.node = node;
|
|
15653
15653
|
this.flags = flags;
|
|
15654
15654
|
this.fd = fd;
|
|
15655
15655
|
}
|
|
15656
|
-
|
|
15656
|
+
File2.prototype.getString = function(encoding) {
|
|
15657
15657
|
if (encoding === void 0) {
|
|
15658
15658
|
encoding = "utf8";
|
|
15659
15659
|
}
|
|
15660
15660
|
return this.node.getString();
|
|
15661
15661
|
};
|
|
15662
|
-
|
|
15662
|
+
File2.prototype.setString = function(str) {
|
|
15663
15663
|
this.node.setString(str);
|
|
15664
15664
|
};
|
|
15665
|
-
|
|
15665
|
+
File2.prototype.getBuffer = function() {
|
|
15666
15666
|
return this.node.getBuffer();
|
|
15667
15667
|
};
|
|
15668
|
-
|
|
15668
|
+
File2.prototype.setBuffer = function(buf) {
|
|
15669
15669
|
this.node.setBuffer(buf);
|
|
15670
15670
|
};
|
|
15671
|
-
|
|
15671
|
+
File2.prototype.getSize = function() {
|
|
15672
15672
|
return this.node.getSize();
|
|
15673
15673
|
};
|
|
15674
|
-
|
|
15674
|
+
File2.prototype.truncate = function(len) {
|
|
15675
15675
|
this.node.truncate(len);
|
|
15676
15676
|
};
|
|
15677
|
-
|
|
15677
|
+
File2.prototype.seekTo = function(position) {
|
|
15678
15678
|
this.position = position;
|
|
15679
15679
|
};
|
|
15680
|
-
|
|
15680
|
+
File2.prototype.stats = function() {
|
|
15681
15681
|
return Stats_1.default.build(this.node);
|
|
15682
15682
|
};
|
|
15683
|
-
|
|
15683
|
+
File2.prototype.write = function(buf, offset, length, position) {
|
|
15684
15684
|
if (offset === void 0) {
|
|
15685
15685
|
offset = 0;
|
|
15686
15686
|
}
|
|
@@ -15695,7 +15695,7 @@ var require_node = __commonJS({
|
|
|
15695
15695
|
this.position = position + bytes;
|
|
15696
15696
|
return bytes;
|
|
15697
15697
|
};
|
|
15698
|
-
|
|
15698
|
+
File2.prototype.read = function(buf, offset, length, position) {
|
|
15699
15699
|
if (offset === void 0) {
|
|
15700
15700
|
offset = 0;
|
|
15701
15701
|
}
|
|
@@ -15708,15 +15708,15 @@ var require_node = __commonJS({
|
|
|
15708
15708
|
this.position = position + bytes;
|
|
15709
15709
|
return bytes;
|
|
15710
15710
|
};
|
|
15711
|
-
|
|
15711
|
+
File2.prototype.chmod = function(perm) {
|
|
15712
15712
|
this.node.chmod(perm);
|
|
15713
15713
|
};
|
|
15714
|
-
|
|
15714
|
+
File2.prototype.chown = function(uid, gid) {
|
|
15715
15715
|
this.node.chown(uid, gid);
|
|
15716
15716
|
};
|
|
15717
|
-
return
|
|
15717
|
+
return File2;
|
|
15718
15718
|
}();
|
|
15719
|
-
exports.File =
|
|
15719
|
+
exports.File = File;
|
|
15720
15720
|
}
|
|
15721
15721
|
});
|
|
15722
15722
|
|
|
@@ -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;
|
|
@@ -53942,7 +53942,7 @@ __export(test_exports, {
|
|
|
53942
53942
|
testConfigFile: () => testConfigFile
|
|
53943
53943
|
});
|
|
53944
53944
|
module.exports = __toCommonJS(test_exports);
|
|
53945
|
-
var
|
|
53945
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
53946
53946
|
var import_memfs2 = __toESM(require_lib(), 1);
|
|
53947
53947
|
|
|
53948
53948
|
// src/lib/pipeline.ts
|
|
@@ -53986,1719 +53986,6 @@ function computeID(configFile, type, data) {
|
|
|
53986
53986
|
return id.slice(0, -2);
|
|
53987
53987
|
}
|
|
53988
53988
|
|
|
53989
|
-
// src/runtime/lib/deepEquals.ts
|
|
53990
|
-
function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
|
|
53991
|
-
if (Object.is(objA, objB))
|
|
53992
|
-
return true;
|
|
53993
|
-
if (objA instanceof Date && objB instanceof Date) {
|
|
53994
|
-
return objA.getTime() === objB.getTime();
|
|
53995
|
-
}
|
|
53996
|
-
if (objA instanceof RegExp && objB instanceof RegExp) {
|
|
53997
|
-
return objA.toString() === objB.toString();
|
|
53998
|
-
}
|
|
53999
|
-
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
|
54000
|
-
return false;
|
|
54001
|
-
}
|
|
54002
|
-
if (map.get(objA) === objB)
|
|
54003
|
-
return true;
|
|
54004
|
-
map.set(objA, objB);
|
|
54005
|
-
const keysA = Reflect.ownKeys(objA);
|
|
54006
|
-
const keysB = Reflect.ownKeys(objB);
|
|
54007
|
-
if (keysA.length !== keysB.length) {
|
|
54008
|
-
return false;
|
|
54009
|
-
}
|
|
54010
|
-
for (let i = 0; i < keysA.length; i++) {
|
|
54011
|
-
if (!Reflect.has(objB, keysA[i]) || !deepEquals(objA[keysA[i]], objB[keysA[i]], map)) {
|
|
54012
|
-
return false;
|
|
54013
|
-
}
|
|
54014
|
-
}
|
|
54015
|
-
return true;
|
|
54016
|
-
}
|
|
54017
|
-
|
|
54018
|
-
// src/runtime/lib/selection.ts
|
|
54019
|
-
function getFieldsForType(selection2, __typename) {
|
|
54020
|
-
let targetSelection = selection2.fields || {};
|
|
54021
|
-
if (selection2.abstractFields && __typename) {
|
|
54022
|
-
const mappedType = selection2.abstractFields.typeMap[__typename];
|
|
54023
|
-
if (mappedType) {
|
|
54024
|
-
targetSelection = selection2.abstractFields.fields[mappedType];
|
|
54025
|
-
} else if (selection2.abstractFields.fields[__typename]) {
|
|
54026
|
-
targetSelection = selection2.abstractFields.fields[__typename];
|
|
54027
|
-
}
|
|
54028
|
-
}
|
|
54029
|
-
return targetSelection;
|
|
54030
|
-
}
|
|
54031
|
-
|
|
54032
|
-
// src/runtime/cache/gc.ts
|
|
54033
|
-
var GarbageCollector = class {
|
|
54034
|
-
cache;
|
|
54035
|
-
lifetimes = /* @__PURE__ */ new Map();
|
|
54036
|
-
get cacheBufferSize() {
|
|
54037
|
-
return this.cache._internal_unstable.config.cacheBufferSize ?? 10;
|
|
54038
|
-
}
|
|
54039
|
-
constructor(cache) {
|
|
54040
|
-
this.cache = cache;
|
|
54041
|
-
}
|
|
54042
|
-
resetLifetime(id, field) {
|
|
54043
|
-
if (!this.lifetimes.get(id)) {
|
|
54044
|
-
this.lifetimes.set(id, /* @__PURE__ */ new Map());
|
|
54045
|
-
}
|
|
54046
|
-
this.lifetimes.get(id).set(field, 0);
|
|
54047
|
-
}
|
|
54048
|
-
tick() {
|
|
54049
|
-
for (const [id, fieldMap] of this.lifetimes.entries()) {
|
|
54050
|
-
for (const [field, lifetime] of fieldMap.entries()) {
|
|
54051
|
-
if (this.cache._internal_unstable.subscriptions.get(id, field).length > 0) {
|
|
54052
|
-
continue;
|
|
54053
|
-
}
|
|
54054
|
-
fieldMap.set(field, lifetime + 1);
|
|
54055
|
-
if (fieldMap.get(field) > this.cacheBufferSize) {
|
|
54056
|
-
this.cache._internal_unstable.storage.deleteField(id, field);
|
|
54057
|
-
this.cache._internal_unstable.lists.deleteField(id, field);
|
|
54058
|
-
fieldMap.delete(field);
|
|
54059
|
-
if ([...fieldMap.keys()].length === 0) {
|
|
54060
|
-
this.lifetimes.delete(id);
|
|
54061
|
-
}
|
|
54062
|
-
}
|
|
54063
|
-
}
|
|
54064
|
-
}
|
|
54065
|
-
}
|
|
54066
|
-
};
|
|
54067
|
-
|
|
54068
|
-
// src/runtime/cache/stuff.ts
|
|
54069
|
-
function flattenList(source) {
|
|
54070
|
-
const flat = [];
|
|
54071
|
-
const unvisited = [source || []];
|
|
54072
|
-
while (unvisited.length > 0) {
|
|
54073
|
-
const target = unvisited.shift();
|
|
54074
|
-
for (const id of target) {
|
|
54075
|
-
if (Array.isArray(id)) {
|
|
54076
|
-
unvisited.push(id);
|
|
54077
|
-
continue;
|
|
54078
|
-
}
|
|
54079
|
-
flat.push(id);
|
|
54080
|
-
}
|
|
54081
|
-
}
|
|
54082
|
-
return flat;
|
|
54083
|
-
}
|
|
54084
|
-
function evaluateKey(key, variables = {}) {
|
|
54085
|
-
let evaluated = "";
|
|
54086
|
-
let varName = "";
|
|
54087
|
-
let inString = false;
|
|
54088
|
-
for (const char of key) {
|
|
54089
|
-
if (varName) {
|
|
54090
|
-
if (varChars.includes(char)) {
|
|
54091
|
-
varName += char;
|
|
54092
|
-
continue;
|
|
54093
|
-
}
|
|
54094
|
-
const value = variables[varName.slice(1)];
|
|
54095
|
-
evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
|
|
54096
|
-
varName = "";
|
|
54097
|
-
}
|
|
54098
|
-
if (char === "$" && !inString) {
|
|
54099
|
-
varName = "$";
|
|
54100
|
-
continue;
|
|
54101
|
-
}
|
|
54102
|
-
if (char === '"') {
|
|
54103
|
-
inString = !inString;
|
|
54104
|
-
}
|
|
54105
|
-
evaluated += char;
|
|
54106
|
-
}
|
|
54107
|
-
return evaluated;
|
|
54108
|
-
}
|
|
54109
|
-
var varChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
|
|
54110
|
-
|
|
54111
|
-
// src/runtime/cache/lists.ts
|
|
54112
|
-
var ListManager = class {
|
|
54113
|
-
rootID;
|
|
54114
|
-
cache;
|
|
54115
|
-
constructor(cache, rootID2) {
|
|
54116
|
-
this.rootID = rootID2;
|
|
54117
|
-
this.cache = cache;
|
|
54118
|
-
}
|
|
54119
|
-
lists = /* @__PURE__ */ new Map();
|
|
54120
|
-
listsByField = /* @__PURE__ */ new Map();
|
|
54121
|
-
get(listName, id, allLists) {
|
|
54122
|
-
const matches = this.lists.get(listName);
|
|
54123
|
-
if (!matches || matches.size === 0) {
|
|
54124
|
-
return null;
|
|
54125
|
-
}
|
|
54126
|
-
if (allLists) {
|
|
54127
|
-
return new ListCollection(
|
|
54128
|
-
Array.from(matches, ([key, value]) => [...value.lists]).flat()
|
|
54129
|
-
);
|
|
54130
|
-
}
|
|
54131
|
-
const head = [...matches.values()][0];
|
|
54132
|
-
const { recordType } = head.lists[0];
|
|
54133
|
-
const parentID = id ? this.cache._internal_unstable.id(recordType || "", id) : this.rootID;
|
|
54134
|
-
if (matches?.size === 1) {
|
|
54135
|
-
if (!id) {
|
|
54136
|
-
return head;
|
|
54137
|
-
}
|
|
54138
|
-
return parentID === Array.from(matches.keys())[0] ? head : null;
|
|
54139
|
-
}
|
|
54140
|
-
if (!id) {
|
|
54141
|
-
console.error(
|
|
54142
|
-
`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 `
|
|
54143
|
-
);
|
|
54144
|
-
return null;
|
|
54145
|
-
}
|
|
54146
|
-
return this.lists.get(listName)?.get(parentID);
|
|
54147
|
-
}
|
|
54148
|
-
remove(listName, id) {
|
|
54149
|
-
this.lists.get(listName)?.delete(id || this.rootID);
|
|
54150
|
-
}
|
|
54151
|
-
add(list) {
|
|
54152
|
-
if (!this.lists.has(list.name)) {
|
|
54153
|
-
this.lists.set(list.name, /* @__PURE__ */ new Map());
|
|
54154
|
-
}
|
|
54155
|
-
const name2 = list.name;
|
|
54156
|
-
const parentID = list.recordID || this.rootID;
|
|
54157
|
-
if (this.lists.get(name2)?.get(parentID)?.includes(list.key)) {
|
|
54158
|
-
return;
|
|
54159
|
-
}
|
|
54160
|
-
if (!this.lists.has(name2)) {
|
|
54161
|
-
this.lists.set(name2, /* @__PURE__ */ new Map());
|
|
54162
|
-
}
|
|
54163
|
-
if (!this.lists.get(name2).has(parentID)) {
|
|
54164
|
-
this.lists.get(name2).set(parentID, new ListCollection([]));
|
|
54165
|
-
}
|
|
54166
|
-
if (!this.listsByField.has(parentID)) {
|
|
54167
|
-
this.listsByField.set(parentID, /* @__PURE__ */ new Map());
|
|
54168
|
-
}
|
|
54169
|
-
if (!this.listsByField.get(parentID).has(list.key)) {
|
|
54170
|
-
this.listsByField.get(parentID)?.set(list.key, []);
|
|
54171
|
-
}
|
|
54172
|
-
const handler = new List({ ...list, manager: this });
|
|
54173
|
-
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
54174
|
-
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
54175
|
-
}
|
|
54176
|
-
removeIDFromAllLists(id) {
|
|
54177
|
-
for (const fieldMap of this.lists.values()) {
|
|
54178
|
-
for (const list of fieldMap.values()) {
|
|
54179
|
-
list.removeID(id);
|
|
54180
|
-
}
|
|
54181
|
-
}
|
|
54182
|
-
}
|
|
54183
|
-
deleteField(parentID, field) {
|
|
54184
|
-
if (!this.listsByField.get(parentID)?.has(field)) {
|
|
54185
|
-
return;
|
|
54186
|
-
}
|
|
54187
|
-
for (const list of this.listsByField.get(parentID).get(field)) {
|
|
54188
|
-
this.lists.get(list.name)?.get(list.recordID)?.deleteListWithKey(field);
|
|
54189
|
-
if (this.lists.get(list.name)?.get(list.recordID)?.lists.length === 0) {
|
|
54190
|
-
this.lists.get(list.name)?.delete(list.recordID);
|
|
54191
|
-
}
|
|
54192
|
-
}
|
|
54193
|
-
this.listsByField.get(parentID).delete(field);
|
|
54194
|
-
}
|
|
54195
|
-
};
|
|
54196
|
-
var List = class {
|
|
54197
|
-
recordID;
|
|
54198
|
-
recordType;
|
|
54199
|
-
key;
|
|
54200
|
-
type;
|
|
54201
|
-
cache;
|
|
54202
|
-
selection;
|
|
54203
|
-
_when;
|
|
54204
|
-
filters;
|
|
54205
|
-
name;
|
|
54206
|
-
connection;
|
|
54207
|
-
manager;
|
|
54208
|
-
abstract;
|
|
54209
|
-
constructor({
|
|
54210
|
-
name: name2,
|
|
54211
|
-
recordID,
|
|
54212
|
-
recordType,
|
|
54213
|
-
key,
|
|
54214
|
-
listType,
|
|
54215
|
-
selection: selection2,
|
|
54216
|
-
when,
|
|
54217
|
-
filters,
|
|
54218
|
-
connection,
|
|
54219
|
-
manager,
|
|
54220
|
-
abstract
|
|
54221
|
-
}) {
|
|
54222
|
-
this.recordID = recordID || rootID;
|
|
54223
|
-
this.recordType = recordType;
|
|
54224
|
-
this.key = key;
|
|
54225
|
-
this.type = listType;
|
|
54226
|
-
this.cache = manager.cache;
|
|
54227
|
-
this.selection = selection2;
|
|
54228
|
-
this._when = when;
|
|
54229
|
-
this.filters = filters;
|
|
54230
|
-
this.name = name2;
|
|
54231
|
-
this.connection = connection;
|
|
54232
|
-
this.manager = manager;
|
|
54233
|
-
this.abstract = abstract;
|
|
54234
|
-
}
|
|
54235
|
-
when(when) {
|
|
54236
|
-
return this.manager.lists.get(this.name).get(this.recordID).when(when);
|
|
54237
|
-
}
|
|
54238
|
-
append(selection2, data, variables = {}) {
|
|
54239
|
-
return this.addToList(selection2, data, variables, "last");
|
|
54240
|
-
}
|
|
54241
|
-
prepend(selection2, data, variables = {}) {
|
|
54242
|
-
return this.addToList(selection2, data, variables, "first");
|
|
54243
|
-
}
|
|
54244
|
-
addToList(selection2, data, variables = {}, where) {
|
|
54245
|
-
const listType = this.listType(data);
|
|
54246
|
-
const dataID = this.cache._internal_unstable.id(listType, data);
|
|
54247
|
-
if (!this.validateWhen() || !dataID) {
|
|
54248
|
-
return;
|
|
54249
|
-
}
|
|
54250
|
-
let insertSelection = selection2;
|
|
54251
|
-
let insertData = data;
|
|
54252
|
-
if (this.connection) {
|
|
54253
|
-
insertSelection = {
|
|
54254
|
-
fields: {
|
|
54255
|
-
newEntry: {
|
|
54256
|
-
keyRaw: this.key,
|
|
54257
|
-
type: "Connection",
|
|
54258
|
-
selection: {
|
|
54259
|
-
fields: {
|
|
54260
|
-
edges: {
|
|
54261
|
-
keyRaw: "edges",
|
|
54262
|
-
type: "ConnectionEdge",
|
|
54263
|
-
update: where === "first" ? "prepend" : "append",
|
|
54264
|
-
selection: {
|
|
54265
|
-
fields: {
|
|
54266
|
-
node: {
|
|
54267
|
-
type: listType,
|
|
54268
|
-
keyRaw: "node",
|
|
54269
|
-
selection: {
|
|
54270
|
-
...selection2,
|
|
54271
|
-
fields: {
|
|
54272
|
-
...selection2.fields,
|
|
54273
|
-
__typename: {
|
|
54274
|
-
keyRaw: "__typename",
|
|
54275
|
-
type: "String"
|
|
54276
|
-
}
|
|
54277
|
-
}
|
|
54278
|
-
}
|
|
54279
|
-
}
|
|
54280
|
-
}
|
|
54281
|
-
}
|
|
54282
|
-
}
|
|
54283
|
-
}
|
|
54284
|
-
}
|
|
54285
|
-
}
|
|
54286
|
-
}
|
|
54287
|
-
};
|
|
54288
|
-
insertData = {
|
|
54289
|
-
newEntry: {
|
|
54290
|
-
edges: [{ node: { ...data, __typename: listType } }]
|
|
54291
|
-
}
|
|
54292
|
-
};
|
|
54293
|
-
} else {
|
|
54294
|
-
insertSelection = {
|
|
54295
|
-
fields: {
|
|
54296
|
-
newEntries: {
|
|
54297
|
-
keyRaw: this.key,
|
|
54298
|
-
type: listType,
|
|
54299
|
-
update: where === "first" ? "prepend" : "append",
|
|
54300
|
-
selection: {
|
|
54301
|
-
...selection2,
|
|
54302
|
-
fields: {
|
|
54303
|
-
...selection2.fields,
|
|
54304
|
-
__typename: {
|
|
54305
|
-
keyRaw: "__typename",
|
|
54306
|
-
type: "String"
|
|
54307
|
-
}
|
|
54308
|
-
}
|
|
54309
|
-
}
|
|
54310
|
-
}
|
|
54311
|
-
}
|
|
54312
|
-
};
|
|
54313
|
-
insertData = {
|
|
54314
|
-
newEntries: [{ ...data, __typename: listType }]
|
|
54315
|
-
};
|
|
54316
|
-
}
|
|
54317
|
-
this.cache.write({
|
|
54318
|
-
selection: insertSelection,
|
|
54319
|
-
data: insertData,
|
|
54320
|
-
variables,
|
|
54321
|
-
parent: this.recordID,
|
|
54322
|
-
applyUpdates: true
|
|
54323
|
-
});
|
|
54324
|
-
}
|
|
54325
|
-
removeID(id, variables = {}) {
|
|
54326
|
-
if (!this.validateWhen()) {
|
|
54327
|
-
return;
|
|
54328
|
-
}
|
|
54329
|
-
let parentID = this.recordID;
|
|
54330
|
-
let targetID = id;
|
|
54331
|
-
let targetKey = this.key;
|
|
54332
|
-
if (this.connection) {
|
|
54333
|
-
const { value: embeddedConnection } = this.cache._internal_unstable.storage.get(
|
|
54334
|
-
this.recordID,
|
|
54335
|
-
this.key
|
|
54336
|
-
);
|
|
54337
|
-
if (!embeddedConnection) {
|
|
54338
|
-
return;
|
|
54339
|
-
}
|
|
54340
|
-
const embeddedConnectionID = embeddedConnection;
|
|
54341
|
-
const { value: edges } = this.cache._internal_unstable.storage.get(
|
|
54342
|
-
embeddedConnectionID,
|
|
54343
|
-
"edges"
|
|
54344
|
-
);
|
|
54345
|
-
for (const edge of flattenList(edges) || []) {
|
|
54346
|
-
if (!edge) {
|
|
54347
|
-
continue;
|
|
54348
|
-
}
|
|
54349
|
-
const edgeID = edge;
|
|
54350
|
-
const { value: nodeID } = this.cache._internal_unstable.storage.get(edgeID, "node");
|
|
54351
|
-
if (!nodeID) {
|
|
54352
|
-
continue;
|
|
54353
|
-
}
|
|
54354
|
-
if (nodeID === id) {
|
|
54355
|
-
targetID = edgeID;
|
|
54356
|
-
}
|
|
54357
|
-
}
|
|
54358
|
-
parentID = embeddedConnectionID;
|
|
54359
|
-
targetKey = "edges";
|
|
54360
|
-
}
|
|
54361
|
-
let value = this.cache._internal_unstable.storage.get(parentID, targetKey).value;
|
|
54362
|
-
if (!value || !value.includes(targetID)) {
|
|
54363
|
-
return;
|
|
54364
|
-
}
|
|
54365
|
-
const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
|
|
54366
|
-
this.cache._internal_unstable.subscriptions.remove(
|
|
54367
|
-
targetID,
|
|
54368
|
-
this.connection ? this.selection.fields.edges.selection : this.selection,
|
|
54369
|
-
subscribers,
|
|
54370
|
-
variables
|
|
54371
|
-
);
|
|
54372
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
54373
|
-
for (const spec of subscribers) {
|
|
54374
|
-
spec.set(
|
|
54375
|
-
this.cache._internal_unstable.getSelection({
|
|
54376
|
-
parent: spec.parentID || this.manager.rootID,
|
|
54377
|
-
selection: spec.selection,
|
|
54378
|
-
variables: spec.variables?.() || {}
|
|
54379
|
-
}).data
|
|
54380
|
-
);
|
|
54381
|
-
}
|
|
54382
|
-
return true;
|
|
54383
|
-
}
|
|
54384
|
-
remove(data, variables = {}) {
|
|
54385
|
-
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
54386
|
-
if (!targetID) {
|
|
54387
|
-
return;
|
|
54388
|
-
}
|
|
54389
|
-
return this.removeID(targetID, variables);
|
|
54390
|
-
}
|
|
54391
|
-
listType(data) {
|
|
54392
|
-
return data.__typename || this.type;
|
|
54393
|
-
}
|
|
54394
|
-
validateWhen(when) {
|
|
54395
|
-
let filters = when || this._when;
|
|
54396
|
-
let ok = true;
|
|
54397
|
-
if (filters) {
|
|
54398
|
-
const targets = this.filters;
|
|
54399
|
-
if (filters.must && targets) {
|
|
54400
|
-
ok = Object.entries(filters.must).reduce(
|
|
54401
|
-
(prev, [key, value]) => Boolean(prev && targets[key] == value),
|
|
54402
|
-
ok
|
|
54403
|
-
);
|
|
54404
|
-
}
|
|
54405
|
-
if (filters.must_not) {
|
|
54406
|
-
ok = !targets || Object.entries(filters.must_not).reduce(
|
|
54407
|
-
(prev, [key, value]) => Boolean(prev && targets[key] != value),
|
|
54408
|
-
ok
|
|
54409
|
-
);
|
|
54410
|
-
}
|
|
54411
|
-
}
|
|
54412
|
-
return ok;
|
|
54413
|
-
}
|
|
54414
|
-
toggleElement(selection2, data, variables = {}, where) {
|
|
54415
|
-
if (!this.remove(data, variables)) {
|
|
54416
|
-
this.addToList(selection2, data, variables, where);
|
|
54417
|
-
}
|
|
54418
|
-
}
|
|
54419
|
-
*[Symbol.iterator]() {
|
|
54420
|
-
let entries = [];
|
|
54421
|
-
let value = this.cache._internal_unstable.storage.get(this.recordID, this.key).value;
|
|
54422
|
-
if (!this.connection) {
|
|
54423
|
-
entries = flattenList(value);
|
|
54424
|
-
} else {
|
|
54425
|
-
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
54426
|
-
}
|
|
54427
|
-
for (let record2 of entries) {
|
|
54428
|
-
yield record2;
|
|
54429
|
-
}
|
|
54430
|
-
}
|
|
54431
|
-
};
|
|
54432
|
-
var ListCollection = class {
|
|
54433
|
-
lists = [];
|
|
54434
|
-
constructor(lists) {
|
|
54435
|
-
this.lists = lists;
|
|
54436
|
-
}
|
|
54437
|
-
append(...args) {
|
|
54438
|
-
this.lists.forEach((list) => list.append(...args));
|
|
54439
|
-
}
|
|
54440
|
-
prepend(...args) {
|
|
54441
|
-
this.lists.forEach((list) => list.prepend(...args));
|
|
54442
|
-
}
|
|
54443
|
-
addToList(...args) {
|
|
54444
|
-
this.lists.forEach((list) => list.addToList(...args));
|
|
54445
|
-
}
|
|
54446
|
-
removeID(...args) {
|
|
54447
|
-
this.lists.forEach((list) => list.removeID(...args));
|
|
54448
|
-
}
|
|
54449
|
-
remove(...args) {
|
|
54450
|
-
this.lists.forEach((list) => list.remove(...args));
|
|
54451
|
-
}
|
|
54452
|
-
toggleElement(...args) {
|
|
54453
|
-
this.lists.forEach((list) => list.toggleElement(...args));
|
|
54454
|
-
}
|
|
54455
|
-
when(when) {
|
|
54456
|
-
return new ListCollection(
|
|
54457
|
-
this.lists.filter((list) => {
|
|
54458
|
-
return list.validateWhen(when);
|
|
54459
|
-
})
|
|
54460
|
-
);
|
|
54461
|
-
}
|
|
54462
|
-
includes(key) {
|
|
54463
|
-
return !!this.lists.find((list) => list.key === key);
|
|
54464
|
-
}
|
|
54465
|
-
deleteListWithKey(key) {
|
|
54466
|
-
return this.lists = this.lists.filter((list) => list.key !== key);
|
|
54467
|
-
}
|
|
54468
|
-
*[Symbol.iterator]() {
|
|
54469
|
-
for (let list of this.lists) {
|
|
54470
|
-
for (const entry of list) {
|
|
54471
|
-
yield entry;
|
|
54472
|
-
}
|
|
54473
|
-
}
|
|
54474
|
-
}
|
|
54475
|
-
};
|
|
54476
|
-
|
|
54477
|
-
// src/runtime/cache/schema.ts
|
|
54478
|
-
var SchemaManager = class {
|
|
54479
|
-
cache;
|
|
54480
|
-
fieldTypes = {};
|
|
54481
|
-
constructor(cache) {
|
|
54482
|
-
this.cache = cache;
|
|
54483
|
-
}
|
|
54484
|
-
setFieldType({
|
|
54485
|
-
parent,
|
|
54486
|
-
key,
|
|
54487
|
-
type,
|
|
54488
|
-
nullable = false,
|
|
54489
|
-
link
|
|
54490
|
-
}) {
|
|
54491
|
-
let parensIndex = key.indexOf("(");
|
|
54492
|
-
if (parensIndex !== -1) {
|
|
54493
|
-
key = key.substring(0, parensIndex);
|
|
54494
|
-
}
|
|
54495
|
-
if (parent === rootID) {
|
|
54496
|
-
parent = "Query";
|
|
54497
|
-
} else if (parent.includes(":")) {
|
|
54498
|
-
parent = parent.substring(0, parent.indexOf(":"));
|
|
54499
|
-
}
|
|
54500
|
-
if (!this.fieldTypes[parent]) {
|
|
54501
|
-
this.fieldTypes[parent] = {};
|
|
54502
|
-
}
|
|
54503
|
-
this.fieldTypes[parent][key] = {
|
|
54504
|
-
type,
|
|
54505
|
-
nullable,
|
|
54506
|
-
link: !!link
|
|
54507
|
-
};
|
|
54508
|
-
}
|
|
54509
|
-
fieldType(type, field) {
|
|
54510
|
-
return this.fieldTypes[type]?.[field] || null;
|
|
54511
|
-
}
|
|
54512
|
-
get config() {
|
|
54513
|
-
return this.cache._internal_unstable.config;
|
|
54514
|
-
}
|
|
54515
|
-
};
|
|
54516
|
-
|
|
54517
|
-
// src/runtime/cache/storage.ts
|
|
54518
|
-
var InMemoryStorage = class {
|
|
54519
|
-
data;
|
|
54520
|
-
idCount = 0;
|
|
54521
|
-
rank = 0;
|
|
54522
|
-
constructor() {
|
|
54523
|
-
this.data = [];
|
|
54524
|
-
}
|
|
54525
|
-
get layerCount() {
|
|
54526
|
-
return this.data.length;
|
|
54527
|
-
}
|
|
54528
|
-
get nextRank() {
|
|
54529
|
-
return this.rank++;
|
|
54530
|
-
}
|
|
54531
|
-
createLayer(optimistic = false) {
|
|
54532
|
-
const layer = new Layer(this.idCount++);
|
|
54533
|
-
layer.optimistic = optimistic;
|
|
54534
|
-
this.data.push(layer);
|
|
54535
|
-
return layer;
|
|
54536
|
-
}
|
|
54537
|
-
insert(id, field, location, target) {
|
|
54538
|
-
return this.topLayer.insert(id, field, location, target);
|
|
54539
|
-
}
|
|
54540
|
-
remove(id, field, target) {
|
|
54541
|
-
return this.topLayer.remove(id, field, target);
|
|
54542
|
-
}
|
|
54543
|
-
delete(id) {
|
|
54544
|
-
return this.topLayer.delete(id);
|
|
54545
|
-
}
|
|
54546
|
-
deleteField(id, field) {
|
|
54547
|
-
return this.topLayer.deleteField(id, field);
|
|
54548
|
-
}
|
|
54549
|
-
getLayer(id) {
|
|
54550
|
-
for (const layer of this.data) {
|
|
54551
|
-
if (layer.id === id) {
|
|
54552
|
-
return layer;
|
|
54553
|
-
}
|
|
54554
|
-
}
|
|
54555
|
-
throw new Error("Could not find layer with id: " + id);
|
|
54556
|
-
}
|
|
54557
|
-
replaceID(replacement) {
|
|
54558
|
-
for (const layer of this.data) {
|
|
54559
|
-
layer.replaceID(replacement);
|
|
54560
|
-
}
|
|
54561
|
-
}
|
|
54562
|
-
get(id, field) {
|
|
54563
|
-
const operations = {
|
|
54564
|
-
[OperationKind.insert]: {
|
|
54565
|
-
[OperationLocation.start]: [],
|
|
54566
|
-
[OperationLocation.end]: []
|
|
54567
|
-
},
|
|
54568
|
-
[OperationKind.remove]: /* @__PURE__ */ new Set()
|
|
54569
|
-
};
|
|
54570
|
-
const layerIDs = [];
|
|
54571
|
-
for (let i = this.data.length - 1; i >= 0; i--) {
|
|
54572
|
-
const layer = this.data[i];
|
|
54573
|
-
const [layerValue, kind] = layer.get(id, field);
|
|
54574
|
-
const layerOperations = layer.getOperations(id, field) || [];
|
|
54575
|
-
layer.deletedIDs.forEach((v) => {
|
|
54576
|
-
if (layer.operations[v]?.undoDeletesInList?.includes(field)) {
|
|
54577
|
-
return;
|
|
54578
|
-
}
|
|
54579
|
-
operations.remove.add(v);
|
|
54580
|
-
});
|
|
54581
|
-
if (typeof layerValue === "undefined" && layerOperations.length === 0) {
|
|
54582
|
-
if (layer.deletedIDs.size > 0) {
|
|
54583
|
-
layerIDs.push(layer.id);
|
|
54584
|
-
}
|
|
54585
|
-
continue;
|
|
54586
|
-
}
|
|
54587
|
-
if (typeof layerValue !== "undefined" && !Array.isArray(layerValue)) {
|
|
54588
|
-
return {
|
|
54589
|
-
value: layerValue,
|
|
54590
|
-
kind,
|
|
54591
|
-
displayLayers: [layer.id]
|
|
54592
|
-
};
|
|
54593
|
-
}
|
|
54594
|
-
layerIDs.push(layer.id);
|
|
54595
|
-
if (layerOperations.length > 0) {
|
|
54596
|
-
for (const op of layerOperations) {
|
|
54597
|
-
if (isRemoveOperation(op)) {
|
|
54598
|
-
operations.remove.add(op.id);
|
|
54599
|
-
}
|
|
54600
|
-
if (isInsertOperation(op)) {
|
|
54601
|
-
operations.insert[op.location].unshift(op.id);
|
|
54602
|
-
}
|
|
54603
|
-
if (isDeleteOperation(op)) {
|
|
54604
|
-
return {
|
|
54605
|
-
value: void 0,
|
|
54606
|
-
kind: "unknown",
|
|
54607
|
-
displayLayers: []
|
|
54608
|
-
};
|
|
54609
|
-
}
|
|
54610
|
-
}
|
|
54611
|
-
}
|
|
54612
|
-
if (typeof layerValue === "undefined") {
|
|
54613
|
-
continue;
|
|
54614
|
-
}
|
|
54615
|
-
if (!operations.remove.size && !operations.insert.start.length && !operations.insert.end.length) {
|
|
54616
|
-
return { value: layerValue, displayLayers: layerIDs, kind: "link" };
|
|
54617
|
-
}
|
|
54618
|
-
return {
|
|
54619
|
-
value: [...operations.insert.start, ...layerValue, ...operations.insert.end].filter(
|
|
54620
|
-
(value) => !operations.remove.has(value)
|
|
54621
|
-
),
|
|
54622
|
-
displayLayers: layerIDs,
|
|
54623
|
-
kind
|
|
54624
|
-
};
|
|
54625
|
-
}
|
|
54626
|
-
return {
|
|
54627
|
-
value: void 0,
|
|
54628
|
-
kind: "unknown",
|
|
54629
|
-
displayLayers: []
|
|
54630
|
-
};
|
|
54631
|
-
}
|
|
54632
|
-
writeLink(id, field, value) {
|
|
54633
|
-
return this.topLayer.writeLink(id, field, value);
|
|
54634
|
-
}
|
|
54635
|
-
writeField(id, field, value) {
|
|
54636
|
-
return this.topLayer.writeField(id, field, value);
|
|
54637
|
-
}
|
|
54638
|
-
resolveLayer(id) {
|
|
54639
|
-
let startingIndex = null;
|
|
54640
|
-
for (const [index, layer] of this.data.entries()) {
|
|
54641
|
-
if (layer.id !== id) {
|
|
54642
|
-
continue;
|
|
54643
|
-
}
|
|
54644
|
-
startingIndex = index - 1;
|
|
54645
|
-
this.data[index].optimistic = false;
|
|
54646
|
-
break;
|
|
54647
|
-
}
|
|
54648
|
-
if (startingIndex === null) {
|
|
54649
|
-
throw new Error("could not find layer with id: " + id);
|
|
54650
|
-
}
|
|
54651
|
-
if (startingIndex === -1) {
|
|
54652
|
-
startingIndex = 0;
|
|
54653
|
-
}
|
|
54654
|
-
if (this.data[startingIndex].optimistic) {
|
|
54655
|
-
startingIndex++;
|
|
54656
|
-
}
|
|
54657
|
-
const baseLayer = this.data[startingIndex];
|
|
54658
|
-
let layerIndex = startingIndex;
|
|
54659
|
-
while (layerIndex < this.data.length) {
|
|
54660
|
-
const layer = this.data[layerIndex++];
|
|
54661
|
-
if (layer.optimistic) {
|
|
54662
|
-
layerIndex--;
|
|
54663
|
-
break;
|
|
54664
|
-
}
|
|
54665
|
-
baseLayer.writeLayer(layer);
|
|
54666
|
-
}
|
|
54667
|
-
this.data.splice(startingIndex + 1, layerIndex - startingIndex - 1);
|
|
54668
|
-
}
|
|
54669
|
-
get topLayer() {
|
|
54670
|
-
if (this.data.length === 0) {
|
|
54671
|
-
this.createLayer();
|
|
54672
|
-
}
|
|
54673
|
-
if (this.data[this.data.length - 1]?.optimistic) {
|
|
54674
|
-
this.createLayer();
|
|
54675
|
-
}
|
|
54676
|
-
return this.data[this.data.length - 1];
|
|
54677
|
-
}
|
|
54678
|
-
};
|
|
54679
|
-
var Layer = class {
|
|
54680
|
-
id;
|
|
54681
|
-
optimistic = false;
|
|
54682
|
-
fields = {};
|
|
54683
|
-
links = {};
|
|
54684
|
-
operations = {};
|
|
54685
|
-
deletedIDs = /* @__PURE__ */ new Set();
|
|
54686
|
-
constructor(id) {
|
|
54687
|
-
this.id = id;
|
|
54688
|
-
}
|
|
54689
|
-
get(id, field) {
|
|
54690
|
-
if (typeof this.links[id]?.[field] !== "undefined") {
|
|
54691
|
-
return [this.links[id][field], "link"];
|
|
54692
|
-
}
|
|
54693
|
-
return [this.fields[id]?.[field], "scalar"];
|
|
54694
|
-
}
|
|
54695
|
-
getOperations(id, field) {
|
|
54696
|
-
if (this.operations[id]?.deleted) {
|
|
54697
|
-
return [
|
|
54698
|
-
{
|
|
54699
|
-
kind: OperationKind.delete,
|
|
54700
|
-
target: id
|
|
54701
|
-
}
|
|
54702
|
-
];
|
|
54703
|
-
}
|
|
54704
|
-
if (this.operations[id]?.fields?.[field]) {
|
|
54705
|
-
return this.operations[id].fields[field];
|
|
54706
|
-
}
|
|
54707
|
-
}
|
|
54708
|
-
writeField(id, field, value) {
|
|
54709
|
-
this.fields[id] = {
|
|
54710
|
-
...this.fields[id],
|
|
54711
|
-
[field]: value
|
|
54712
|
-
};
|
|
54713
|
-
return this.id;
|
|
54714
|
-
}
|
|
54715
|
-
writeLink(id, field, value) {
|
|
54716
|
-
const valueList = Array.isArray(value) ? value : [value];
|
|
54717
|
-
for (const value2 of flattenList(valueList)) {
|
|
54718
|
-
if (!value2) {
|
|
54719
|
-
continue;
|
|
54720
|
-
}
|
|
54721
|
-
const fieldOperations = this.operations[id]?.fields[field];
|
|
54722
|
-
if (this.operations[value2]?.deleted || this.deletedIDs.has(value2)) {
|
|
54723
|
-
this.operations[value2] = {
|
|
54724
|
-
...this.operations[value2],
|
|
54725
|
-
undoDeletesInList: [...this.operations[id]?.undoDeletesInList || [], field]
|
|
54726
|
-
};
|
|
54727
|
-
} else if (value2 && fieldOperations?.length > 0) {
|
|
54728
|
-
this.operations[id].fields[field] = fieldOperations.filter(
|
|
54729
|
-
(op) => op.kind !== "remove" || op.id !== value2
|
|
54730
|
-
);
|
|
54731
|
-
}
|
|
54732
|
-
}
|
|
54733
|
-
this.links[id] = {
|
|
54734
|
-
...this.links[id],
|
|
54735
|
-
[field]: value
|
|
54736
|
-
};
|
|
54737
|
-
return this.id;
|
|
54738
|
-
}
|
|
54739
|
-
isDisplayLayer(displayLayers) {
|
|
54740
|
-
return displayLayers.length === 0 || displayLayers.includes(this.id) || Math.max(...displayLayers) < this.id;
|
|
54741
|
-
}
|
|
54742
|
-
clear() {
|
|
54743
|
-
this.links = {};
|
|
54744
|
-
this.fields = {};
|
|
54745
|
-
this.operations = {};
|
|
54746
|
-
this.deletedIDs = /* @__PURE__ */ new Set();
|
|
54747
|
-
}
|
|
54748
|
-
replaceID({ from, to }) {
|
|
54749
|
-
this.fields[to] = this.fields[from];
|
|
54750
|
-
this.links[to] = this.links[from];
|
|
54751
|
-
this.operations[to] = this.operations[from] || { fields: {} };
|
|
54752
|
-
if (this.deletedIDs.has(from)) {
|
|
54753
|
-
this.deletedIDs.add(to);
|
|
54754
|
-
}
|
|
54755
|
-
}
|
|
54756
|
-
removeUndefinedFields() {
|
|
54757
|
-
for (const [id, fields] of Object.entries(this.fields)) {
|
|
54758
|
-
for (const [field, value] of Object.entries(fields)) {
|
|
54759
|
-
if (typeof value === "undefined") {
|
|
54760
|
-
try {
|
|
54761
|
-
delete this.fields[id][field];
|
|
54762
|
-
} catch {
|
|
54763
|
-
}
|
|
54764
|
-
try {
|
|
54765
|
-
delete this.links[id][field];
|
|
54766
|
-
} catch {
|
|
54767
|
-
}
|
|
54768
|
-
}
|
|
54769
|
-
}
|
|
54770
|
-
if (Object.keys(fields || {}).length === 0) {
|
|
54771
|
-
delete this.fields[id];
|
|
54772
|
-
}
|
|
54773
|
-
if (Object.keys(this.links[id] || {}).length === 0) {
|
|
54774
|
-
delete this.links[id];
|
|
54775
|
-
}
|
|
54776
|
-
}
|
|
54777
|
-
}
|
|
54778
|
-
delete(id) {
|
|
54779
|
-
this.operations = {
|
|
54780
|
-
...this.operations,
|
|
54781
|
-
[id]: {
|
|
54782
|
-
...this.operations[id],
|
|
54783
|
-
deleted: true,
|
|
54784
|
-
undoDeletesInList: []
|
|
54785
|
-
}
|
|
54786
|
-
};
|
|
54787
|
-
this.deletedIDs.add(id);
|
|
54788
|
-
}
|
|
54789
|
-
deleteField(id, field) {
|
|
54790
|
-
this.fields[id] = {
|
|
54791
|
-
...this.fields[id],
|
|
54792
|
-
[field]: void 0
|
|
54793
|
-
};
|
|
54794
|
-
}
|
|
54795
|
-
insert(id, field, where, target) {
|
|
54796
|
-
this.addFieldOperation(id, field, {
|
|
54797
|
-
kind: OperationKind.insert,
|
|
54798
|
-
id: target,
|
|
54799
|
-
location: where
|
|
54800
|
-
});
|
|
54801
|
-
}
|
|
54802
|
-
remove(id, field, target) {
|
|
54803
|
-
this.addFieldOperation(id, field, {
|
|
54804
|
-
kind: OperationKind.remove,
|
|
54805
|
-
id: target
|
|
54806
|
-
});
|
|
54807
|
-
}
|
|
54808
|
-
writeLayer(layer) {
|
|
54809
|
-
if (layer.id === this.id) {
|
|
54810
|
-
return;
|
|
54811
|
-
}
|
|
54812
|
-
for (const [id, ops] of Object.entries(layer.operations)) {
|
|
54813
|
-
const fields = {};
|
|
54814
|
-
for (const opMap of [this.operations[id], layer.operations[id]].filter(Boolean)) {
|
|
54815
|
-
for (const [fieldName, operations] of Object.entries(opMap.fields || {})) {
|
|
54816
|
-
fields[fieldName] = [...fields[fieldName] || [], ...operations];
|
|
54817
|
-
}
|
|
54818
|
-
}
|
|
54819
|
-
if (Object.keys(fields).length > 0) {
|
|
54820
|
-
this.operations[id] = {
|
|
54821
|
-
...this.operations[id],
|
|
54822
|
-
fields
|
|
54823
|
-
};
|
|
54824
|
-
}
|
|
54825
|
-
if (ops?.deleted) {
|
|
54826
|
-
delete this.fields[id];
|
|
54827
|
-
delete this.links[id];
|
|
54828
|
-
}
|
|
54829
|
-
}
|
|
54830
|
-
for (const [id, values] of Object.entries(layer.fields)) {
|
|
54831
|
-
if (!values) {
|
|
54832
|
-
continue;
|
|
54833
|
-
}
|
|
54834
|
-
for (const [field, value] of Object.entries(values)) {
|
|
54835
|
-
this.writeField(id, field, value);
|
|
54836
|
-
}
|
|
54837
|
-
}
|
|
54838
|
-
for (const [id, values] of Object.entries(layer.links)) {
|
|
54839
|
-
if (!values) {
|
|
54840
|
-
continue;
|
|
54841
|
-
}
|
|
54842
|
-
for (const [field, value] of Object.entries(values)) {
|
|
54843
|
-
this.writeLink(id, field, value);
|
|
54844
|
-
}
|
|
54845
|
-
}
|
|
54846
|
-
layer.deletedIDs.forEach((v) => this.deletedIDs.add(v));
|
|
54847
|
-
}
|
|
54848
|
-
addFieldOperation(id, field, operation) {
|
|
54849
|
-
this.operations = {
|
|
54850
|
-
...this.operations,
|
|
54851
|
-
[id]: {
|
|
54852
|
-
...this.operations[id],
|
|
54853
|
-
fields: {
|
|
54854
|
-
[field]: [...this.operations[id]?.fields[field] || [], operation]
|
|
54855
|
-
}
|
|
54856
|
-
}
|
|
54857
|
-
};
|
|
54858
|
-
}
|
|
54859
|
-
};
|
|
54860
|
-
function isDeleteOperation(value) {
|
|
54861
|
-
return !!value && value.kind === OperationKind.delete;
|
|
54862
|
-
}
|
|
54863
|
-
function isInsertOperation(value) {
|
|
54864
|
-
return !!value && value.kind === OperationKind.insert;
|
|
54865
|
-
}
|
|
54866
|
-
function isRemoveOperation(value) {
|
|
54867
|
-
return !!value && value.kind === OperationKind.remove;
|
|
54868
|
-
}
|
|
54869
|
-
var OperationLocation = /* @__PURE__ */ ((OperationLocation2) => {
|
|
54870
|
-
OperationLocation2["start"] = "start";
|
|
54871
|
-
OperationLocation2["end"] = "end";
|
|
54872
|
-
return OperationLocation2;
|
|
54873
|
-
})(OperationLocation || {});
|
|
54874
|
-
var OperationKind = /* @__PURE__ */ ((OperationKind2) => {
|
|
54875
|
-
OperationKind2["delete"] = "delete";
|
|
54876
|
-
OperationKind2["insert"] = "insert";
|
|
54877
|
-
OperationKind2["remove"] = "remove";
|
|
54878
|
-
return OperationKind2;
|
|
54879
|
-
})(OperationKind || {});
|
|
54880
|
-
|
|
54881
|
-
// src/runtime/cache/subscription.ts
|
|
54882
|
-
var InMemorySubscriptions = class {
|
|
54883
|
-
cache;
|
|
54884
|
-
constructor(cache) {
|
|
54885
|
-
this.cache = cache;
|
|
54886
|
-
}
|
|
54887
|
-
subscribers = {};
|
|
54888
|
-
referenceCounts = {};
|
|
54889
|
-
keyVersions = {};
|
|
54890
|
-
add({
|
|
54891
|
-
parent,
|
|
54892
|
-
spec,
|
|
54893
|
-
selection: selection2,
|
|
54894
|
-
variables,
|
|
54895
|
-
parentType
|
|
54896
|
-
}) {
|
|
54897
|
-
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
54898
|
-
let targetSelection = getFieldsForType(selection2, __typename);
|
|
54899
|
-
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
54900
|
-
const { keyRaw, selection: innerSelection, type } = fieldSelection;
|
|
54901
|
-
const key = evaluateKey(keyRaw, variables);
|
|
54902
|
-
this.addFieldSubscription({
|
|
54903
|
-
id: parent,
|
|
54904
|
-
key,
|
|
54905
|
-
field: fieldSelection,
|
|
54906
|
-
spec,
|
|
54907
|
-
parentType: parentType || spec.rootType,
|
|
54908
|
-
variables
|
|
54909
|
-
});
|
|
54910
|
-
if (innerSelection) {
|
|
54911
|
-
const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
|
|
54912
|
-
parent,
|
|
54913
|
-
key
|
|
54914
|
-
);
|
|
54915
|
-
let children = !Array.isArray(linkedRecord) ? [linkedRecord] : flattenList(linkedRecord) || [];
|
|
54916
|
-
for (const child of children) {
|
|
54917
|
-
if (!child) {
|
|
54918
|
-
continue;
|
|
54919
|
-
}
|
|
54920
|
-
this.add({
|
|
54921
|
-
parent: child,
|
|
54922
|
-
spec,
|
|
54923
|
-
selection: innerSelection,
|
|
54924
|
-
variables,
|
|
54925
|
-
parentType: type
|
|
54926
|
-
});
|
|
54927
|
-
}
|
|
54928
|
-
}
|
|
54929
|
-
}
|
|
54930
|
-
}
|
|
54931
|
-
addFieldSubscription({
|
|
54932
|
-
id,
|
|
54933
|
-
key,
|
|
54934
|
-
field,
|
|
54935
|
-
spec,
|
|
54936
|
-
parentType,
|
|
54937
|
-
variables
|
|
54938
|
-
}) {
|
|
54939
|
-
if (!this.subscribers[id]) {
|
|
54940
|
-
this.subscribers[id] = {};
|
|
54941
|
-
}
|
|
54942
|
-
if (!this.subscribers[id][key]) {
|
|
54943
|
-
this.subscribers[id][key] = [];
|
|
54944
|
-
}
|
|
54945
|
-
if (!this.keyVersions[key]) {
|
|
54946
|
-
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
54947
|
-
}
|
|
54948
|
-
this.keyVersions[key].add(key);
|
|
54949
|
-
if (!this.subscribers[id][key].map(({ set }) => set).includes(spec.set)) {
|
|
54950
|
-
this.subscribers[id][key].push(spec);
|
|
54951
|
-
}
|
|
54952
|
-
if (!this.referenceCounts[id]) {
|
|
54953
|
-
this.referenceCounts[id] = {};
|
|
54954
|
-
}
|
|
54955
|
-
if (!this.referenceCounts[id][key]) {
|
|
54956
|
-
this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
|
|
54957
|
-
}
|
|
54958
|
-
const counts = this.referenceCounts[id][key];
|
|
54959
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
54960
|
-
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
54961
|
-
const { selection: selection2, list, filters } = field;
|
|
54962
|
-
if (selection2 && list) {
|
|
54963
|
-
this.cache._internal_unstable.lists.add({
|
|
54964
|
-
name: list.name,
|
|
54965
|
-
connection: list.connection,
|
|
54966
|
-
recordID: id,
|
|
54967
|
-
recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
|
|
54968
|
-
listType: list.type,
|
|
54969
|
-
key,
|
|
54970
|
-
selection: selection2,
|
|
54971
|
-
filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
|
|
54972
|
-
return {
|
|
54973
|
-
...acc,
|
|
54974
|
-
[key2]: kind !== "Variable" ? value : variables[value]
|
|
54975
|
-
};
|
|
54976
|
-
}, {})
|
|
54977
|
-
});
|
|
54978
|
-
}
|
|
54979
|
-
}
|
|
54980
|
-
addMany({
|
|
54981
|
-
parent,
|
|
54982
|
-
selection: selection2,
|
|
54983
|
-
variables,
|
|
54984
|
-
subscribers,
|
|
54985
|
-
parentType
|
|
54986
|
-
}) {
|
|
54987
|
-
let targetSelection = getFieldsForType(selection2, parentType);
|
|
54988
|
-
for (const fieldSelection of Object.values(targetSelection)) {
|
|
54989
|
-
const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
|
|
54990
|
-
const key = evaluateKey(keyRaw, variables);
|
|
54991
|
-
for (const spec of subscribers) {
|
|
54992
|
-
this.addFieldSubscription({
|
|
54993
|
-
id: parent,
|
|
54994
|
-
key,
|
|
54995
|
-
field: fieldSelection,
|
|
54996
|
-
spec,
|
|
54997
|
-
parentType,
|
|
54998
|
-
variables
|
|
54999
|
-
});
|
|
55000
|
-
}
|
|
55001
|
-
if (innerSelection) {
|
|
55002
|
-
const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
|
|
55003
|
-
const children = !Array.isArray(link) ? [link] : flattenList(link);
|
|
55004
|
-
for (const linkedRecord of children) {
|
|
55005
|
-
if (!linkedRecord) {
|
|
55006
|
-
continue;
|
|
55007
|
-
}
|
|
55008
|
-
this.addMany({
|
|
55009
|
-
parent: linkedRecord,
|
|
55010
|
-
selection: innerSelection,
|
|
55011
|
-
variables,
|
|
55012
|
-
subscribers,
|
|
55013
|
-
parentType: linkedType
|
|
55014
|
-
});
|
|
55015
|
-
}
|
|
55016
|
-
}
|
|
55017
|
-
}
|
|
55018
|
-
}
|
|
55019
|
-
get(id, field) {
|
|
55020
|
-
return this.subscribers[id]?.[field] || [];
|
|
55021
|
-
}
|
|
55022
|
-
remove(id, selection2, targets, variables, visited = []) {
|
|
55023
|
-
visited.push(id);
|
|
55024
|
-
const linkedIDs = [];
|
|
55025
|
-
for (const fieldSelection of Object.values(selection2.fields || {})) {
|
|
55026
|
-
const key = evaluateKey(fieldSelection.keyRaw, variables);
|
|
55027
|
-
this.removeSubscribers(id, key, targets);
|
|
55028
|
-
if (!fieldSelection.selection?.fields) {
|
|
55029
|
-
continue;
|
|
55030
|
-
}
|
|
55031
|
-
const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
|
|
55032
|
-
const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
|
|
55033
|
-
for (const link of links) {
|
|
55034
|
-
if (link !== null) {
|
|
55035
|
-
linkedIDs.push([link, fieldSelection.selection || {}]);
|
|
55036
|
-
}
|
|
55037
|
-
}
|
|
55038
|
-
}
|
|
55039
|
-
for (const [linkedRecordID, linkFields] of linkedIDs) {
|
|
55040
|
-
this.remove(linkedRecordID, linkFields, targets, visited);
|
|
55041
|
-
}
|
|
55042
|
-
}
|
|
55043
|
-
removeSubscribers(id, fieldName, specs) {
|
|
55044
|
-
let targets = [];
|
|
55045
|
-
for (const spec of specs) {
|
|
55046
|
-
if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
|
|
55047
|
-
continue;
|
|
55048
|
-
}
|
|
55049
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
55050
|
-
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
55051
|
-
counts.set(spec.set, newVal);
|
|
55052
|
-
if (newVal <= 0) {
|
|
55053
|
-
targets.push(spec.set);
|
|
55054
|
-
counts.delete(spec.set);
|
|
55055
|
-
}
|
|
55056
|
-
}
|
|
55057
|
-
if (this.subscribers[id]) {
|
|
55058
|
-
this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
|
|
55059
|
-
({ set }) => !targets.includes(set)
|
|
55060
|
-
);
|
|
55061
|
-
}
|
|
55062
|
-
}
|
|
55063
|
-
removeAllSubscribers(id, targets, visited = []) {
|
|
55064
|
-
visited.push(id);
|
|
55065
|
-
for (const field of Object.keys(this.subscribers[id] || [])) {
|
|
55066
|
-
const subscribers = targets || this.subscribers[id][field];
|
|
55067
|
-
this.removeSubscribers(id, field, subscribers);
|
|
55068
|
-
const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
|
|
55069
|
-
if (kind === "scalar") {
|
|
55070
|
-
continue;
|
|
55071
|
-
}
|
|
55072
|
-
const nextTargets = Array.isArray(value) ? flattenList(value) : [value];
|
|
55073
|
-
for (const id2 of nextTargets) {
|
|
55074
|
-
if (visited.includes(id2)) {
|
|
55075
|
-
continue;
|
|
55076
|
-
}
|
|
55077
|
-
this.removeAllSubscribers(id2, subscribers, visited);
|
|
55078
|
-
}
|
|
55079
|
-
}
|
|
55080
|
-
}
|
|
55081
|
-
};
|
|
55082
|
-
|
|
55083
|
-
// src/runtime/cache/cache.ts
|
|
55084
|
-
var Cache3 = class {
|
|
55085
|
-
_internal_unstable;
|
|
55086
|
-
constructor(config2) {
|
|
55087
|
-
this._internal_unstable = new CacheInternal({
|
|
55088
|
-
cache: this,
|
|
55089
|
-
storage: new InMemoryStorage(),
|
|
55090
|
-
subscriptions: new InMemorySubscriptions(this),
|
|
55091
|
-
lists: new ListManager(this, rootID),
|
|
55092
|
-
lifetimes: new GarbageCollector(this),
|
|
55093
|
-
schema: new SchemaManager(this)
|
|
55094
|
-
});
|
|
55095
|
-
if (config2) {
|
|
55096
|
-
this.setConfig(defaultConfigValues(config2));
|
|
55097
|
-
}
|
|
55098
|
-
}
|
|
55099
|
-
write({
|
|
55100
|
-
layer: layerID,
|
|
55101
|
-
notifySubscribers = [],
|
|
55102
|
-
...args
|
|
55103
|
-
}) {
|
|
55104
|
-
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
55105
|
-
const subscribers = this._internal_unstable.writeSelection({ ...args, layer });
|
|
55106
|
-
const notified = [];
|
|
55107
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
55108
|
-
if (!notified.includes(spec.set)) {
|
|
55109
|
-
notified.push(spec.set);
|
|
55110
|
-
spec.set(
|
|
55111
|
-
this._internal_unstable.getSelection({
|
|
55112
|
-
parent: spec.parentID || rootID,
|
|
55113
|
-
selection: spec.selection,
|
|
55114
|
-
variables: spec.variables?.() || {}
|
|
55115
|
-
}).data
|
|
55116
|
-
);
|
|
55117
|
-
}
|
|
55118
|
-
}
|
|
55119
|
-
return subscribers;
|
|
55120
|
-
}
|
|
55121
|
-
read(...args) {
|
|
55122
|
-
const { data, partial, hasData } = this._internal_unstable.getSelection(...args);
|
|
55123
|
-
if (!hasData) {
|
|
55124
|
-
return { data: null, partial: false };
|
|
55125
|
-
}
|
|
55126
|
-
return {
|
|
55127
|
-
data,
|
|
55128
|
-
partial
|
|
55129
|
-
};
|
|
55130
|
-
}
|
|
55131
|
-
subscribe(spec, variables = {}) {
|
|
55132
|
-
return this._internal_unstable.subscriptions.add({
|
|
55133
|
-
parent: spec.parentID || rootID,
|
|
55134
|
-
spec,
|
|
55135
|
-
selection: spec.selection,
|
|
55136
|
-
variables
|
|
55137
|
-
});
|
|
55138
|
-
}
|
|
55139
|
-
unsubscribe(spec, variables = {}) {
|
|
55140
|
-
return this._internal_unstable.subscriptions.remove(
|
|
55141
|
-
spec.parentID || rootID,
|
|
55142
|
-
spec.selection,
|
|
55143
|
-
[spec],
|
|
55144
|
-
variables
|
|
55145
|
-
);
|
|
55146
|
-
}
|
|
55147
|
-
list(name2, parentID, allLists) {
|
|
55148
|
-
const handler = this._internal_unstable.lists.get(name2, parentID, allLists);
|
|
55149
|
-
if (!handler) {
|
|
55150
|
-
throw new Error(
|
|
55151
|
-
`Cannot find list with name: ${name2}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
|
|
55152
|
-
);
|
|
55153
|
-
}
|
|
55154
|
-
return handler;
|
|
55155
|
-
}
|
|
55156
|
-
delete(id) {
|
|
55157
|
-
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
55158
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
55159
|
-
this._internal_unstable.storage.delete(id);
|
|
55160
|
-
}
|
|
55161
|
-
setConfig(config2) {
|
|
55162
|
-
this._internal_unstable.setConfig(config2);
|
|
55163
|
-
}
|
|
55164
|
-
};
|
|
55165
|
-
var CacheInternal = class {
|
|
55166
|
-
_disabled = false;
|
|
55167
|
-
config = defaultConfigValues({
|
|
55168
|
-
plugins: {
|
|
55169
|
-
"houdini-svelte": {
|
|
55170
|
-
client: ""
|
|
55171
|
-
}
|
|
55172
|
-
}
|
|
55173
|
-
});
|
|
55174
|
-
storage;
|
|
55175
|
-
subscriptions;
|
|
55176
|
-
lists;
|
|
55177
|
-
cache;
|
|
55178
|
-
lifetimes;
|
|
55179
|
-
schema;
|
|
55180
|
-
constructor({
|
|
55181
|
-
storage,
|
|
55182
|
-
subscriptions,
|
|
55183
|
-
lists,
|
|
55184
|
-
cache,
|
|
55185
|
-
lifetimes,
|
|
55186
|
-
schema
|
|
55187
|
-
}) {
|
|
55188
|
-
this.storage = storage;
|
|
55189
|
-
this.subscriptions = subscriptions;
|
|
55190
|
-
this.lists = lists;
|
|
55191
|
-
this.cache = cache;
|
|
55192
|
-
this.lifetimes = lifetimes;
|
|
55193
|
-
this.schema = schema;
|
|
55194
|
-
this._disabled = typeof globalThis.window === "undefined";
|
|
55195
|
-
try {
|
|
55196
|
-
if (process.env.HOUDINI_TEST === "true") {
|
|
55197
|
-
this._disabled = false;
|
|
55198
|
-
}
|
|
55199
|
-
} catch {
|
|
55200
|
-
}
|
|
55201
|
-
}
|
|
55202
|
-
setConfig(config2) {
|
|
55203
|
-
this.config = config2;
|
|
55204
|
-
}
|
|
55205
|
-
writeSelection({
|
|
55206
|
-
data,
|
|
55207
|
-
selection: selection2,
|
|
55208
|
-
variables = {},
|
|
55209
|
-
parent = rootID,
|
|
55210
|
-
applyUpdates = false,
|
|
55211
|
-
layer,
|
|
55212
|
-
toNotify = [],
|
|
55213
|
-
forceNotify
|
|
55214
|
-
}) {
|
|
55215
|
-
if (this._disabled) {
|
|
55216
|
-
return [];
|
|
55217
|
-
}
|
|
55218
|
-
let targetSelection = getFieldsForType(selection2, data["__typename"]);
|
|
55219
|
-
for (const [field, value] of Object.entries(data)) {
|
|
55220
|
-
if (!selection2 || !targetSelection[field]) {
|
|
55221
|
-
throw new Error(
|
|
55222
|
-
"Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
|
|
55223
|
-
);
|
|
55224
|
-
}
|
|
55225
|
-
let {
|
|
55226
|
-
type: linkedType,
|
|
55227
|
-
keyRaw,
|
|
55228
|
-
selection: fieldSelection,
|
|
55229
|
-
operations,
|
|
55230
|
-
abstract: isAbstract,
|
|
55231
|
-
update,
|
|
55232
|
-
nullable
|
|
55233
|
-
} = targetSelection[field];
|
|
55234
|
-
const key = evaluateKey(keyRaw, variables);
|
|
55235
|
-
this.schema.setFieldType({
|
|
55236
|
-
parent,
|
|
55237
|
-
key: keyRaw,
|
|
55238
|
-
type: linkedType,
|
|
55239
|
-
nullable,
|
|
55240
|
-
link: !!fieldSelection
|
|
55241
|
-
});
|
|
55242
|
-
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
55243
|
-
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
55244
|
-
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
55245
|
-
if (displayLayer) {
|
|
55246
|
-
this.lifetimes.resetLifetime(parent, key);
|
|
55247
|
-
}
|
|
55248
|
-
if (!fieldSelection) {
|
|
55249
|
-
let newValue = value;
|
|
55250
|
-
if (Array.isArray(value) && applyUpdates && update) {
|
|
55251
|
-
if (update === "append") {
|
|
55252
|
-
newValue = (previousValue || []).concat(value);
|
|
55253
|
-
} else if (update === "prepend") {
|
|
55254
|
-
newValue = value.concat(previousValue || []);
|
|
55255
|
-
}
|
|
55256
|
-
}
|
|
55257
|
-
const valueChanged = !deepEquals(newValue, previousValue);
|
|
55258
|
-
if (displayLayer && (valueChanged || forceNotify)) {
|
|
55259
|
-
toNotify.push(...currentSubscribers);
|
|
55260
|
-
}
|
|
55261
|
-
layer.writeField(parent, key, newValue);
|
|
55262
|
-
} else if (value === null) {
|
|
55263
|
-
if (previousValue === null) {
|
|
55264
|
-
continue;
|
|
55265
|
-
}
|
|
55266
|
-
const previousLinks = flattenList([previousValue]);
|
|
55267
|
-
for (const link of previousLinks) {
|
|
55268
|
-
this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
|
|
55269
|
-
}
|
|
55270
|
-
layer.writeLink(parent, key, null);
|
|
55271
|
-
toNotify.push(...currentSubscribers);
|
|
55272
|
-
} else if (value instanceof Object && !Array.isArray(value)) {
|
|
55273
|
-
if (isAbstract) {
|
|
55274
|
-
if (!value.__typename) {
|
|
55275
|
-
throw new Error(
|
|
55276
|
-
"Encountered interface type without __typename in the payload"
|
|
55277
|
-
);
|
|
55278
|
-
}
|
|
55279
|
-
linkedType = value.__typename;
|
|
55280
|
-
}
|
|
55281
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
55282
|
-
(field2) => typeof value[field2] === "undefined"
|
|
55283
|
-
).length > 0;
|
|
55284
|
-
let linkedID = null;
|
|
55285
|
-
if (value !== null) {
|
|
55286
|
-
linkedID = !embedded ? this.id(linkedType, value) : `${parent}.${key}`;
|
|
55287
|
-
}
|
|
55288
|
-
let linkChange = linkedID !== previousValue;
|
|
55289
|
-
layer.writeLink(parent, key, linkedID);
|
|
55290
|
-
if (linkedID && displayLayer && (linkChange || forceNotify)) {
|
|
55291
|
-
if (previousValue && typeof previousValue === "string") {
|
|
55292
|
-
this.subscriptions.remove(
|
|
55293
|
-
previousValue,
|
|
55294
|
-
fieldSelection,
|
|
55295
|
-
currentSubscribers,
|
|
55296
|
-
variables
|
|
55297
|
-
);
|
|
55298
|
-
}
|
|
55299
|
-
this.subscriptions.addMany({
|
|
55300
|
-
parent: linkedID,
|
|
55301
|
-
selection: fieldSelection,
|
|
55302
|
-
subscribers: currentSubscribers,
|
|
55303
|
-
variables,
|
|
55304
|
-
parentType: linkedType
|
|
55305
|
-
});
|
|
55306
|
-
toNotify.push(...currentSubscribers);
|
|
55307
|
-
}
|
|
55308
|
-
if (linkedID) {
|
|
55309
|
-
this.writeSelection({
|
|
55310
|
-
selection: fieldSelection,
|
|
55311
|
-
parent: linkedID,
|
|
55312
|
-
data: value,
|
|
55313
|
-
variables,
|
|
55314
|
-
toNotify,
|
|
55315
|
-
applyUpdates,
|
|
55316
|
-
layer,
|
|
55317
|
-
forceNotify
|
|
55318
|
-
});
|
|
55319
|
-
}
|
|
55320
|
-
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
|
|
55321
|
-
let oldIDs = [...previousValue || []];
|
|
55322
|
-
const emptyEdges = !update ? [] : oldIDs.map((id) => {
|
|
55323
|
-
if (!id) {
|
|
55324
|
-
return "";
|
|
55325
|
-
}
|
|
55326
|
-
const { value: cursorField } = this.storage.get(id, "cursor");
|
|
55327
|
-
if (cursorField) {
|
|
55328
|
-
return "";
|
|
55329
|
-
}
|
|
55330
|
-
const { value: node } = this.storage.get(id, "node");
|
|
55331
|
-
if (!node) {
|
|
55332
|
-
return "";
|
|
55333
|
-
}
|
|
55334
|
-
return node;
|
|
55335
|
-
});
|
|
55336
|
-
let linkedIDs = [];
|
|
55337
|
-
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
55338
|
-
value,
|
|
55339
|
-
abstract: Boolean(isAbstract),
|
|
55340
|
-
specs: toNotify,
|
|
55341
|
-
applyUpdates,
|
|
55342
|
-
recordID: parent,
|
|
55343
|
-
key,
|
|
55344
|
-
linkedType,
|
|
55345
|
-
variables,
|
|
55346
|
-
fields: fieldSelection,
|
|
55347
|
-
layer,
|
|
55348
|
-
forceNotify
|
|
55349
|
-
});
|
|
55350
|
-
if (applyUpdates && update) {
|
|
55351
|
-
if (key === "edges") {
|
|
55352
|
-
const newNodeIDs = [];
|
|
55353
|
-
for (const id of newIDs) {
|
|
55354
|
-
if (!id) {
|
|
55355
|
-
continue;
|
|
55356
|
-
}
|
|
55357
|
-
const { value: node } = this.storage.get(id, "node");
|
|
55358
|
-
if (typeof node !== "string") {
|
|
55359
|
-
continue;
|
|
55360
|
-
}
|
|
55361
|
-
if (!node || !this.storage.get(node, "__typename")) {
|
|
55362
|
-
continue;
|
|
55363
|
-
}
|
|
55364
|
-
newNodeIDs.push(node);
|
|
55365
|
-
}
|
|
55366
|
-
oldIDs = oldIDs.filter((id) => {
|
|
55367
|
-
if (!id) {
|
|
55368
|
-
return true;
|
|
55369
|
-
}
|
|
55370
|
-
const { value: value2 } = this.storage.get(id, "node");
|
|
55371
|
-
const node = value2;
|
|
55372
|
-
if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
|
|
55373
|
-
return false;
|
|
55374
|
-
}
|
|
55375
|
-
return true;
|
|
55376
|
-
});
|
|
55377
|
-
}
|
|
55378
|
-
if (update === "prepend") {
|
|
55379
|
-
linkedIDs = newIDs.concat(oldIDs);
|
|
55380
|
-
} else if (update === "append") {
|
|
55381
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
55382
|
-
} else if (update === "replace") {
|
|
55383
|
-
linkedIDs = newIDs;
|
|
55384
|
-
}
|
|
55385
|
-
} else {
|
|
55386
|
-
linkedIDs = nestedIDs;
|
|
55387
|
-
}
|
|
55388
|
-
const contentChanged = !deepEquals(linkedIDs, oldIDs);
|
|
55389
|
-
if (contentChanged || forceNotify) {
|
|
55390
|
-
toNotify.push(...currentSubscribers);
|
|
55391
|
-
}
|
|
55392
|
-
for (const lostID of oldIDs) {
|
|
55393
|
-
if (linkedIDs.includes(lostID) || !lostID) {
|
|
55394
|
-
continue;
|
|
55395
|
-
}
|
|
55396
|
-
this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
|
|
55397
|
-
}
|
|
55398
|
-
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
55399
|
-
layer.writeLink(parent, key, linkedIDs);
|
|
55400
|
-
}
|
|
55401
|
-
for (const id of newIDs.filter((id2) => !oldIDs.includes(id2))) {
|
|
55402
|
-
if (id == null) {
|
|
55403
|
-
continue;
|
|
55404
|
-
}
|
|
55405
|
-
this.subscriptions.addMany({
|
|
55406
|
-
parent: id,
|
|
55407
|
-
selection: fieldSelection,
|
|
55408
|
-
subscribers: currentSubscribers,
|
|
55409
|
-
variables,
|
|
55410
|
-
parentType: linkedType
|
|
55411
|
-
});
|
|
55412
|
-
}
|
|
55413
|
-
}
|
|
55414
|
-
for (const operation of operations || []) {
|
|
55415
|
-
let parentID;
|
|
55416
|
-
if (operation.parentID) {
|
|
55417
|
-
if (operation.parentID.kind !== "Variable") {
|
|
55418
|
-
parentID = operation.parentID.value;
|
|
55419
|
-
} else {
|
|
55420
|
-
const id = variables[operation.parentID.value];
|
|
55421
|
-
if (typeof id !== "string") {
|
|
55422
|
-
throw new Error("parentID value must be a string");
|
|
55423
|
-
}
|
|
55424
|
-
parentID = id;
|
|
55425
|
-
}
|
|
55426
|
-
}
|
|
55427
|
-
if (operation.list && !this.lists.get(operation.list, parentID, operation.target === "all")) {
|
|
55428
|
-
continue;
|
|
55429
|
-
}
|
|
55430
|
-
const targets = Array.isArray(value) ? value : [value];
|
|
55431
|
-
for (const target of targets) {
|
|
55432
|
-
if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
|
|
55433
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
55434
|
-
fieldSelection,
|
|
55435
|
-
target,
|
|
55436
|
-
variables,
|
|
55437
|
-
operation.position || "last"
|
|
55438
|
-
);
|
|
55439
|
-
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
55440
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
55441
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
55442
|
-
if (typeof target !== "string") {
|
|
55443
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
55444
|
-
}
|
|
55445
|
-
const targetID = this.id(operation.type, target);
|
|
55446
|
-
if (!targetID) {
|
|
55447
|
-
continue;
|
|
55448
|
-
}
|
|
55449
|
-
this.cache.delete(targetID);
|
|
55450
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
55451
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
55452
|
-
fieldSelection,
|
|
55453
|
-
target,
|
|
55454
|
-
variables,
|
|
55455
|
-
operation.position || "last"
|
|
55456
|
-
);
|
|
55457
|
-
}
|
|
55458
|
-
}
|
|
55459
|
-
}
|
|
55460
|
-
}
|
|
55461
|
-
return toNotify;
|
|
55462
|
-
}
|
|
55463
|
-
getSelection({
|
|
55464
|
-
selection: selection2,
|
|
55465
|
-
parent = rootID,
|
|
55466
|
-
variables,
|
|
55467
|
-
stepsFromConnection = null
|
|
55468
|
-
}) {
|
|
55469
|
-
if (parent === null) {
|
|
55470
|
-
return { data: null, partial: false, hasData: true };
|
|
55471
|
-
}
|
|
55472
|
-
const target = {};
|
|
55473
|
-
let hasData = false;
|
|
55474
|
-
let partial = false;
|
|
55475
|
-
let cascadeNull = false;
|
|
55476
|
-
const typename = this.storage.get(parent, "__typename").value;
|
|
55477
|
-
let targetSelection = getFieldsForType(selection2, typename);
|
|
55478
|
-
for (const [
|
|
55479
|
-
attributeName,
|
|
55480
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list }
|
|
55481
|
-
] of Object.entries(targetSelection)) {
|
|
55482
|
-
const key = evaluateKey(keyRaw, variables);
|
|
55483
|
-
const { value } = this.storage.get(parent, key);
|
|
55484
|
-
let nextStep = stepsFromConnection;
|
|
55485
|
-
if (nextStep !== null) {
|
|
55486
|
-
if (nextStep >= 2) {
|
|
55487
|
-
nextStep = null;
|
|
55488
|
-
} else {
|
|
55489
|
-
nextStep += 1;
|
|
55490
|
-
}
|
|
55491
|
-
}
|
|
55492
|
-
if (list?.connection) {
|
|
55493
|
-
nextStep = 0;
|
|
55494
|
-
}
|
|
55495
|
-
const embeddedCursor = key === "cursor" && stepsFromConnection === 1;
|
|
55496
|
-
if (typeof value === "undefined" && !embeddedCursor) {
|
|
55497
|
-
partial = true;
|
|
55498
|
-
}
|
|
55499
|
-
if (typeof value === "undefined" || value === null) {
|
|
55500
|
-
target[attributeName] = null;
|
|
55501
|
-
if (typeof value !== "undefined") {
|
|
55502
|
-
hasData = true;
|
|
55503
|
-
}
|
|
55504
|
-
} else if (!fieldSelection) {
|
|
55505
|
-
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
55506
|
-
if (fnUnmarshal) {
|
|
55507
|
-
target[attributeName] = fnUnmarshal(value);
|
|
55508
|
-
} else {
|
|
55509
|
-
target[attributeName] = value;
|
|
55510
|
-
}
|
|
55511
|
-
hasData = true;
|
|
55512
|
-
} else if (Array.isArray(value)) {
|
|
55513
|
-
const listValue = this.hydrateNestedList({
|
|
55514
|
-
fields: fieldSelection,
|
|
55515
|
-
variables,
|
|
55516
|
-
linkedList: value,
|
|
55517
|
-
stepsFromConnection: nextStep
|
|
55518
|
-
});
|
|
55519
|
-
target[attributeName] = listValue.data;
|
|
55520
|
-
if (listValue.partial) {
|
|
55521
|
-
partial = true;
|
|
55522
|
-
}
|
|
55523
|
-
if (listValue.hasData || value.length === 0) {
|
|
55524
|
-
hasData = true;
|
|
55525
|
-
}
|
|
55526
|
-
} else {
|
|
55527
|
-
const objectFields = this.getSelection({
|
|
55528
|
-
parent: value,
|
|
55529
|
-
selection: fieldSelection,
|
|
55530
|
-
variables,
|
|
55531
|
-
stepsFromConnection: nextStep
|
|
55532
|
-
});
|
|
55533
|
-
target[attributeName] = objectFields.data;
|
|
55534
|
-
if (objectFields.partial) {
|
|
55535
|
-
partial = true;
|
|
55536
|
-
}
|
|
55537
|
-
if (objectFields.hasData) {
|
|
55538
|
-
hasData = true;
|
|
55539
|
-
}
|
|
55540
|
-
}
|
|
55541
|
-
if (target[attributeName] === null && !nullable && !embeddedCursor) {
|
|
55542
|
-
cascadeNull = true;
|
|
55543
|
-
}
|
|
55544
|
-
}
|
|
55545
|
-
return {
|
|
55546
|
-
data: cascadeNull ? null : target,
|
|
55547
|
-
partial: hasData && partial,
|
|
55548
|
-
hasData
|
|
55549
|
-
};
|
|
55550
|
-
}
|
|
55551
|
-
id(type, data) {
|
|
55552
|
-
const id = typeof data === "string" ? data : this.computeID(type, data);
|
|
55553
|
-
if (!id) {
|
|
55554
|
-
return null;
|
|
55555
|
-
}
|
|
55556
|
-
if (!type) {
|
|
55557
|
-
return id;
|
|
55558
|
-
}
|
|
55559
|
-
return type + ":" + id;
|
|
55560
|
-
}
|
|
55561
|
-
idFields(type) {
|
|
55562
|
-
return keyFieldsForType(this.config, type);
|
|
55563
|
-
}
|
|
55564
|
-
computeID(type, data) {
|
|
55565
|
-
return computeID(this.config, type, data);
|
|
55566
|
-
}
|
|
55567
|
-
hydrateNestedList({
|
|
55568
|
-
fields,
|
|
55569
|
-
variables,
|
|
55570
|
-
linkedList,
|
|
55571
|
-
stepsFromConnection
|
|
55572
|
-
}) {
|
|
55573
|
-
const result = [];
|
|
55574
|
-
let partialData = false;
|
|
55575
|
-
let hasValues = false;
|
|
55576
|
-
for (const entry of linkedList) {
|
|
55577
|
-
if (Array.isArray(entry)) {
|
|
55578
|
-
const nestedValue = this.hydrateNestedList({
|
|
55579
|
-
fields,
|
|
55580
|
-
variables,
|
|
55581
|
-
linkedList: entry,
|
|
55582
|
-
stepsFromConnection
|
|
55583
|
-
});
|
|
55584
|
-
result.push(nestedValue.data);
|
|
55585
|
-
if (nestedValue.partial) {
|
|
55586
|
-
partialData = true;
|
|
55587
|
-
}
|
|
55588
|
-
continue;
|
|
55589
|
-
}
|
|
55590
|
-
if (entry === null) {
|
|
55591
|
-
result.push(entry);
|
|
55592
|
-
continue;
|
|
55593
|
-
}
|
|
55594
|
-
const { data, partial, hasData } = this.getSelection({
|
|
55595
|
-
parent: entry,
|
|
55596
|
-
selection: fields,
|
|
55597
|
-
variables,
|
|
55598
|
-
stepsFromConnection
|
|
55599
|
-
});
|
|
55600
|
-
result.push(data);
|
|
55601
|
-
if (partial) {
|
|
55602
|
-
partialData = true;
|
|
55603
|
-
}
|
|
55604
|
-
if (hasData) {
|
|
55605
|
-
hasValues = true;
|
|
55606
|
-
}
|
|
55607
|
-
}
|
|
55608
|
-
return {
|
|
55609
|
-
data: result,
|
|
55610
|
-
partial: partialData,
|
|
55611
|
-
hasData: hasValues
|
|
55612
|
-
};
|
|
55613
|
-
}
|
|
55614
|
-
extractNestedListIDs({
|
|
55615
|
-
value,
|
|
55616
|
-
abstract,
|
|
55617
|
-
recordID,
|
|
55618
|
-
key,
|
|
55619
|
-
linkedType,
|
|
55620
|
-
fields,
|
|
55621
|
-
variables,
|
|
55622
|
-
applyUpdates,
|
|
55623
|
-
specs,
|
|
55624
|
-
layer,
|
|
55625
|
-
forceNotify
|
|
55626
|
-
}) {
|
|
55627
|
-
const nestedIDs = [];
|
|
55628
|
-
const newIDs = [];
|
|
55629
|
-
for (const [i, entry] of value.entries()) {
|
|
55630
|
-
if (Array.isArray(entry)) {
|
|
55631
|
-
const inner = this.extractNestedListIDs({
|
|
55632
|
-
value: entry,
|
|
55633
|
-
abstract,
|
|
55634
|
-
recordID,
|
|
55635
|
-
key,
|
|
55636
|
-
linkedType,
|
|
55637
|
-
fields,
|
|
55638
|
-
variables,
|
|
55639
|
-
applyUpdates,
|
|
55640
|
-
specs,
|
|
55641
|
-
layer,
|
|
55642
|
-
forceNotify
|
|
55643
|
-
});
|
|
55644
|
-
newIDs.push(...inner.newIDs);
|
|
55645
|
-
nestedIDs[i] = inner.nestedIDs;
|
|
55646
|
-
continue;
|
|
55647
|
-
}
|
|
55648
|
-
if (entry === null || typeof entry === "undefined") {
|
|
55649
|
-
newIDs.push(null);
|
|
55650
|
-
nestedIDs[i] = null;
|
|
55651
|
-
continue;
|
|
55652
|
-
}
|
|
55653
|
-
const entryObj = entry;
|
|
55654
|
-
let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
|
|
55655
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
55656
|
-
(field) => typeof entry[field] === "undefined"
|
|
55657
|
-
).length > 0;
|
|
55658
|
-
const typename = entryObj.__typename;
|
|
55659
|
-
let innerType = linkedType;
|
|
55660
|
-
if (abstract) {
|
|
55661
|
-
if (!typename) {
|
|
55662
|
-
throw new Error("Encountered interface type without __typename in the payload");
|
|
55663
|
-
}
|
|
55664
|
-
innerType = typename;
|
|
55665
|
-
}
|
|
55666
|
-
if (!embedded) {
|
|
55667
|
-
const id = this.id(innerType, entry);
|
|
55668
|
-
if (id) {
|
|
55669
|
-
linkedID = id;
|
|
55670
|
-
} else {
|
|
55671
|
-
continue;
|
|
55672
|
-
}
|
|
55673
|
-
}
|
|
55674
|
-
this.writeSelection({
|
|
55675
|
-
root: rootID,
|
|
55676
|
-
selection: fields,
|
|
55677
|
-
parent: linkedID,
|
|
55678
|
-
data: entryObj,
|
|
55679
|
-
variables,
|
|
55680
|
-
toNotify: specs,
|
|
55681
|
-
applyUpdates,
|
|
55682
|
-
layer,
|
|
55683
|
-
forceNotify
|
|
55684
|
-
});
|
|
55685
|
-
newIDs.push(linkedID);
|
|
55686
|
-
nestedIDs[i] = linkedID;
|
|
55687
|
-
}
|
|
55688
|
-
return { newIDs, nestedIDs };
|
|
55689
|
-
}
|
|
55690
|
-
collectGarbage() {
|
|
55691
|
-
this.lifetimes.tick();
|
|
55692
|
-
if (this.storage.layerCount === 1) {
|
|
55693
|
-
this.storage.topLayer.removeUndefinedFields();
|
|
55694
|
-
}
|
|
55695
|
-
}
|
|
55696
|
-
};
|
|
55697
|
-
var rootID = "_ROOT_";
|
|
55698
|
-
|
|
55699
|
-
// src/runtime/cache/index.ts
|
|
55700
|
-
var cache_default = new Cache3();
|
|
55701
|
-
|
|
55702
53989
|
// src/lib/constants.ts
|
|
55703
53990
|
var siteURL = "https://houdinigraphql.com";
|
|
55704
53991
|
var houdini_mode = {
|
|
@@ -55990,7 +54277,7 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
55990
54277
|
const targetPath = join(parentDir, child);
|
|
55991
54278
|
let original = await readFile(childPath) || "";
|
|
55992
54279
|
if (transforms?.[childPath]) {
|
|
55993
|
-
original = transforms[childPath](original);
|
|
54280
|
+
original = await transforms[childPath](original, childPath);
|
|
55994
54281
|
}
|
|
55995
54282
|
await writeFile(targetPath, original);
|
|
55996
54283
|
}
|
|
@@ -56312,8 +54599,11 @@ var Config = class {
|
|
|
56312
54599
|
pluginRuntimeDirectory(name2) {
|
|
56313
54600
|
return join(this.pluginDirectory(name2), "runtime");
|
|
56314
54601
|
}
|
|
54602
|
+
get pluginRootDirectory() {
|
|
54603
|
+
return houdini_mode.is_testing ? "../../../" : join(this.rootDir, "plugins");
|
|
54604
|
+
}
|
|
56315
54605
|
pluginDirectory(name2) {
|
|
56316
|
-
return
|
|
54606
|
+
return join(this.pluginRootDirectory, name2);
|
|
56317
54607
|
}
|
|
56318
54608
|
get manualLoadDirective() {
|
|
56319
54609
|
return "manual_load";
|
|
@@ -56363,6 +54653,9 @@ var Config = class {
|
|
|
56363
54653
|
get whenNotDirective() {
|
|
56364
54654
|
return this.whenDirective + "_not";
|
|
56365
54655
|
}
|
|
54656
|
+
get liveDirective() {
|
|
54657
|
+
return "live";
|
|
54658
|
+
}
|
|
56366
54659
|
get argumentsDirective() {
|
|
56367
54660
|
return "arguments";
|
|
56368
54661
|
}
|
|
@@ -56725,7 +55018,13 @@ function exportStarFrom(where) {
|
|
|
56725
55018
|
}
|
|
56726
55019
|
function exportDefaultFrom(where, as) {
|
|
56727
55020
|
return `var ${as} = require("${where}");
|
|
56728
|
-
|
|
55021
|
+
${exportDefault(as)}`;
|
|
55022
|
+
}
|
|
55023
|
+
function exportDefault(as) {
|
|
55024
|
+
return `Object.defineProperty(exports, "${as}", { enumerable: true, get: function () { return __importDefault(${as}).default; } });`;
|
|
55025
|
+
}
|
|
55026
|
+
function importDefaultFrom(where, as) {
|
|
55027
|
+
return `var ${as} = require("${where}")`;
|
|
56729
55028
|
}
|
|
56730
55029
|
|
|
56731
55030
|
// src/codegen/utils/flattenSelections.ts
|
|
@@ -56769,6 +55068,9 @@ var FieldCollection = class {
|
|
|
56769
55068
|
this.add(selection2);
|
|
56770
55069
|
}
|
|
56771
55070
|
}
|
|
55071
|
+
get size() {
|
|
55072
|
+
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
55073
|
+
}
|
|
56772
55074
|
add(selection2) {
|
|
56773
55075
|
if (selection2.kind === "Field") {
|
|
56774
55076
|
const key = selection2.alias?.value || selection2.name.value;
|
|
@@ -56837,9 +55139,12 @@ var FieldCollection = class {
|
|
|
56837
55139
|
}
|
|
56838
55140
|
}
|
|
56839
55141
|
toSelectionSet() {
|
|
56840
|
-
return Object.values(this.inlineFragments).
|
|
55142
|
+
return Object.values(this.inlineFragments).flatMap((fragment) => {
|
|
55143
|
+
if (fragment.selection.size === 0) {
|
|
55144
|
+
return [];
|
|
55145
|
+
}
|
|
56841
55146
|
fragment.astNode.selectionSet.selections = fragment.selection.toSelectionSet();
|
|
56842
|
-
return fragment.astNode;
|
|
55147
|
+
return [fragment.astNode];
|
|
56843
55148
|
}).concat(
|
|
56844
55149
|
Object.values(this.fields).map((field) => {
|
|
56845
55150
|
if (field.astNode.selectionSet) {
|
|
@@ -57022,7 +55327,7 @@ function serializeValue(value) {
|
|
|
57022
55327
|
if (typeof value === "object" && value !== null) {
|
|
57023
55328
|
return AST4.objectExpression(
|
|
57024
55329
|
Object.entries(value).filter(([, value2]) => typeof value2 !== "undefined").map(
|
|
57025
|
-
([key, value2]) => AST4.objectProperty(AST4.
|
|
55330
|
+
([key, value2]) => AST4.objectProperty(AST4.stringLiteral(key), serializeValue(value2))
|
|
57026
55331
|
)
|
|
57027
55332
|
);
|
|
57028
55333
|
}
|
|
@@ -58576,6 +56881,23 @@ function artifactGenerator(stats) {
|
|
|
58576
56881
|
document: doc
|
|
58577
56882
|
})
|
|
58578
56883
|
};
|
|
56884
|
+
const pluginsData = config2.plugins.reduce(
|
|
56885
|
+
(prev, plugin) => {
|
|
56886
|
+
if (!plugin.artifact_data) {
|
|
56887
|
+
return prev;
|
|
56888
|
+
}
|
|
56889
|
+
const result = { ...prev };
|
|
56890
|
+
const dataToAdd = plugin.artifact_data(config2, doc) ?? {};
|
|
56891
|
+
if (Object.keys(dataToAdd).length > 0) {
|
|
56892
|
+
result[plugin.name] = dataToAdd;
|
|
56893
|
+
}
|
|
56894
|
+
return result;
|
|
56895
|
+
},
|
|
56896
|
+
{}
|
|
56897
|
+
);
|
|
56898
|
+
if (Object.keys(pluginsData).length > 0) {
|
|
56899
|
+
artifact.pluginsData = pluginsData;
|
|
56900
|
+
}
|
|
58579
56901
|
if (inputs && inputs.length > 0) {
|
|
58580
56902
|
artifact.input = inputObject(config2, inputs);
|
|
58581
56903
|
}
|
|
@@ -58639,77 +56961,132 @@ function artifactGenerator(stats) {
|
|
|
58639
56961
|
};
|
|
58640
56962
|
}
|
|
58641
56963
|
|
|
58642
|
-
// src/codegen/generators/runtime/
|
|
56964
|
+
// src/codegen/generators/runtime/graphqlFunction.ts
|
|
58643
56965
|
var recast6 = __toESM(require_main2(), 1);
|
|
58644
56966
|
var AST6 = recast6.types.builders;
|
|
58645
|
-
async function
|
|
58646
|
-
await Promise.all([
|
|
58647
|
-
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
58648
|
-
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
58649
|
-
const configFilePath = path_exports.join(config2.runtimeDirectory, "lib", "config.js");
|
|
58650
|
-
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
|
|
58651
|
-
return content.replace("HOUDINI_CONFIG_PATH", relativePath);
|
|
58652
|
-
},
|
|
58653
|
-
[path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
58654
|
-
return content.replace("SITE_URL", siteURL);
|
|
58655
|
-
}
|
|
58656
|
-
}),
|
|
58657
|
-
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
58658
|
-
]);
|
|
56967
|
+
async function generateGraphqlReturnTypes(config2, docs) {
|
|
58659
56968
|
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
58660
|
-
const
|
|
56969
|
+
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
56970
|
+
const contents = await parseJS(fileContent);
|
|
58661
56971
|
const graphql_tag_return = config2.plugins.find(
|
|
58662
56972
|
(plugin) => plugin.graphql_tag_return
|
|
58663
56973
|
)?.graphql_tag_return;
|
|
58664
|
-
if (graphql_tag_return
|
|
58665
|
-
|
|
58666
|
-
|
|
58667
|
-
|
|
58668
|
-
|
|
58669
|
-
|
|
58670
|
-
|
|
58671
|
-
|
|
58672
|
-
|
|
58673
|
-
|
|
58674
|
-
|
|
58675
|
-
|
|
58676
|
-
|
|
58677
|
-
|
|
58678
|
-
|
|
58679
|
-
if (return_value) {
|
|
58680
|
-
overloaded_returns[doc.originalString] = return_value;
|
|
56974
|
+
if (!graphql_tag_return || !contents) {
|
|
56975
|
+
return fileContent;
|
|
56976
|
+
}
|
|
56977
|
+
const overloaded_returns = {};
|
|
56978
|
+
for (const doc of docs) {
|
|
56979
|
+
const return_value = graphql_tag_return({
|
|
56980
|
+
config: config2,
|
|
56981
|
+
doc,
|
|
56982
|
+
ensure_import({ identifier, module: module2 }) {
|
|
56983
|
+
ensureImports({
|
|
56984
|
+
config: config2,
|
|
56985
|
+
body: contents.script.body,
|
|
56986
|
+
sourceModule: module2,
|
|
56987
|
+
import: [identifier]
|
|
56988
|
+
});
|
|
58681
56989
|
}
|
|
56990
|
+
});
|
|
56991
|
+
if (return_value) {
|
|
56992
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
58682
56993
|
}
|
|
58683
|
-
|
|
58684
|
-
|
|
58685
|
-
|
|
58686
|
-
|
|
58687
|
-
|
|
58688
|
-
|
|
58689
|
-
|
|
58690
|
-
|
|
58691
|
-
|
|
58692
|
-
)
|
|
58693
|
-
|
|
58694
|
-
|
|
58695
|
-
|
|
58696
|
-
|
|
58697
|
-
|
|
58698
|
-
|
|
58699
|
-
|
|
58700
|
-
|
|
58701
|
-
|
|
58702
|
-
)
|
|
58703
|
-
)
|
|
56994
|
+
}
|
|
56995
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
56996
|
+
for (const [i, expression] of (contents?.script.body ?? []).entries()) {
|
|
56997
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
56998
|
+
continue;
|
|
56999
|
+
}
|
|
57000
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
57001
|
+
const input = AST6.identifier("str");
|
|
57002
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
57003
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
57004
|
+
);
|
|
57005
|
+
contents?.script.body.splice(
|
|
57006
|
+
i,
|
|
57007
|
+
0,
|
|
57008
|
+
AST6.exportNamedDeclaration(
|
|
57009
|
+
AST6.tsDeclareFunction(
|
|
57010
|
+
AST6.identifier("graphql"),
|
|
57011
|
+
[input],
|
|
57012
|
+
AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
|
|
58704
57013
|
)
|
|
58705
|
-
)
|
|
58706
|
-
|
|
58707
|
-
break;
|
|
57014
|
+
)
|
|
57015
|
+
);
|
|
58708
57016
|
}
|
|
58709
|
-
|
|
57017
|
+
break;
|
|
58710
57018
|
}
|
|
57019
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
58711
57020
|
}
|
|
58712
57021
|
}
|
|
57022
|
+
|
|
57023
|
+
// src/codegen/generators/runtime/injectPlugins.ts
|
|
57024
|
+
async function injectPlugins({
|
|
57025
|
+
config: config2,
|
|
57026
|
+
content,
|
|
57027
|
+
importStatement,
|
|
57028
|
+
exportStatement
|
|
57029
|
+
}) {
|
|
57030
|
+
const client_plugins = config2.plugins.filter((plugin) => plugin.client_plugins).reduce((acc, plugin) => {
|
|
57031
|
+
let plugins = plugin.client_plugins;
|
|
57032
|
+
if (typeof plugins === "function") {
|
|
57033
|
+
plugins = plugins(config2, config2.pluginConfig(plugin.name));
|
|
57034
|
+
}
|
|
57035
|
+
return [...acc, ...Object.entries(plugins)];
|
|
57036
|
+
}, []);
|
|
57037
|
+
return client_plugins.length > 0 ? `
|
|
57038
|
+
${client_plugins.map((plugin, i) => importStatement(plugin[0], `plugin${i}`))}
|
|
57039
|
+
|
|
57040
|
+
const plugins = [
|
|
57041
|
+
${client_plugins.map((plugin, i) => {
|
|
57042
|
+
const suffix = plugin[1] !== null ? `(${JSON.stringify(plugin[1])})` : "";
|
|
57043
|
+
return `plugin${i}${suffix}`;
|
|
57044
|
+
}).join(",\n")}
|
|
57045
|
+
]
|
|
57046
|
+
|
|
57047
|
+
${exportStatement("plugins")}
|
|
57048
|
+
` : content;
|
|
57049
|
+
}
|
|
57050
|
+
|
|
57051
|
+
// src/codegen/generators/runtime/pluginIndex.ts
|
|
57052
|
+
async function generatePluginIndex({
|
|
57053
|
+
config: config2,
|
|
57054
|
+
exportStatement
|
|
57055
|
+
}) {
|
|
57056
|
+
const indexFile = `${exportStatement("../runtime/client/plugins/index.js")}
|
|
57057
|
+
`;
|
|
57058
|
+
const typedefs = `export * from '../runtime/client/plugins'`;
|
|
57059
|
+
await fs_exports.mkdirp(config2.pluginRootDirectory);
|
|
57060
|
+
await Promise.all([
|
|
57061
|
+
fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.js"), indexFile),
|
|
57062
|
+
fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.d.ts"), typedefs)
|
|
57063
|
+
]);
|
|
57064
|
+
}
|
|
57065
|
+
|
|
57066
|
+
// src/codegen/generators/runtime/index.ts
|
|
57067
|
+
async function runtimeGenerator(config2, docs) {
|
|
57068
|
+
const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
57069
|
+
const exportStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
57070
|
+
const exportStar = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
|
|
57071
|
+
await Promise.all([
|
|
57072
|
+
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
57073
|
+
[path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
57074
|
+
return content.replace("SITE_URL", siteURL);
|
|
57075
|
+
},
|
|
57076
|
+
[path_exports.join(config2.runtimeSource, "imports", "config.js")]: (content) => {
|
|
57077
|
+
const configFilePath = path_exports.join(config2.runtimeDirectory, "imports", "config.js");
|
|
57078
|
+
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
|
|
57079
|
+
return `${importStatement(relativePath, "config")}
|
|
57080
|
+
${exportStatement("config")}
|
|
57081
|
+
`;
|
|
57082
|
+
},
|
|
57083
|
+
[path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
57084
|
+
}),
|
|
57085
|
+
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin)),
|
|
57086
|
+
generatePluginIndex({ config: config2, exportStatement: exportStar })
|
|
57087
|
+
]);
|
|
57088
|
+
await generateGraphqlReturnTypes(config2, docs);
|
|
57089
|
+
}
|
|
58713
57090
|
async function generatePluginRuntime(config2, plugin) {
|
|
58714
57091
|
if (houdini_mode.is_testing) {
|
|
58715
57092
|
return;
|
|
@@ -59775,6 +58152,7 @@ async function writeIndexFile2(config2, docs) {
|
|
|
59775
58152
|
const export_star_from = ({ module: module2 }) => "\n" + (cjs ? exportStarFrom(module2) : `export * from "${module2}"`) + "\n";
|
|
59776
58153
|
const export_default_as = ({ module: module2, as }) => "\n" + (cjs ? exportDefaultFrom(module2, as) : `export { default as ${as} } from "${module2}"`) + "\n";
|
|
59777
58154
|
body += [
|
|
58155
|
+
export_star_from({ module: "./" + path_exports.join(runtimeDir, "client") }),
|
|
59778
58156
|
export_star_from({ module: runtimeDir }),
|
|
59779
58157
|
export_star_from({ module: artifactDir }),
|
|
59780
58158
|
export_star_from({ module: definitionsDir })
|
|
@@ -59887,7 +58265,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59887
58265
|
}
|
|
59888
58266
|
|
|
59889
58267
|
// src/codegen/transforms/schema.ts
|
|
59890
|
-
var
|
|
58268
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
59891
58269
|
async function graphqlExtensions(config2, documents) {
|
|
59892
58270
|
const internalSchema = `
|
|
59893
58271
|
enum CachePolicy {
|
|
@@ -59965,19 +58343,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59965
58343
|
"""
|
|
59966
58344
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59967
58345
|
`;
|
|
59968
|
-
let currentSchema =
|
|
58346
|
+
let currentSchema = graphql19.printSchema(config2.schema);
|
|
59969
58347
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59970
58348
|
currentSchema += internalSchema;
|
|
59971
58349
|
}
|
|
59972
58350
|
config2.newSchema += internalSchema;
|
|
59973
|
-
config2.schema =
|
|
58351
|
+
config2.schema = graphql19.buildSchema(currentSchema);
|
|
59974
58352
|
}
|
|
59975
58353
|
|
|
59976
58354
|
// src/codegen/transforms/typename.ts
|
|
59977
|
-
var
|
|
58355
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
59978
58356
|
async function addTypename(config2, documents) {
|
|
59979
58357
|
for (const doc of documents) {
|
|
59980
|
-
doc.document =
|
|
58358
|
+
doc.document = graphql20.visit(doc.document, {
|
|
59981
58359
|
Field(node, key, parent, path2, ancestors) {
|
|
59982
58360
|
if (!node.selectionSet) {
|
|
59983
58361
|
return;
|
|
@@ -59989,7 +58367,7 @@ async function addTypename(config2, documents) {
|
|
|
59989
58367
|
);
|
|
59990
58368
|
const field = type.getFields()[node.name.value];
|
|
59991
58369
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59992
|
-
if (
|
|
58370
|
+
if (graphql20.isInterfaceType(fieldType) || graphql20.isUnionType(fieldType)) {
|
|
59993
58371
|
return {
|
|
59994
58372
|
...node,
|
|
59995
58373
|
selectionSet: {
|
|
@@ -59997,9 +58375,9 @@ async function addTypename(config2, documents) {
|
|
|
59997
58375
|
selections: [
|
|
59998
58376
|
...node.selectionSet.selections,
|
|
59999
58377
|
{
|
|
60000
|
-
kind:
|
|
58378
|
+
kind: graphql20.Kind.FIELD,
|
|
60001
58379
|
name: {
|
|
60002
|
-
kind:
|
|
58380
|
+
kind: graphql20.Kind.NAME,
|
|
60003
58381
|
value: "__typename"
|
|
60004
58382
|
}
|
|
60005
58383
|
}
|
|
@@ -60013,10 +58391,10 @@ async function addTypename(config2, documents) {
|
|
|
60013
58391
|
}
|
|
60014
58392
|
|
|
60015
58393
|
// src/codegen/transforms/addID.ts
|
|
60016
|
-
var
|
|
58394
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
60017
58395
|
async function addID(config2, documents) {
|
|
60018
58396
|
for (const doc of documents) {
|
|
60019
|
-
doc.document =
|
|
58397
|
+
doc.document = graphql21.visit(doc.document, {
|
|
60020
58398
|
Field(node, key, parent, path2, ancestors) {
|
|
60021
58399
|
if (!node.selectionSet) {
|
|
60022
58400
|
return;
|
|
@@ -60029,7 +58407,7 @@ async function addID(config2, documents) {
|
|
|
60029
58407
|
const field = type.getFields()[node.name.value];
|
|
60030
58408
|
const fieldType = unwrapType(config2, field.type).type;
|
|
60031
58409
|
if (node.selectionSet?.selections.length > 0) {
|
|
60032
|
-
if (!
|
|
58410
|
+
if (!graphql21.isObjectType(fieldType) && !graphql21.isInterfaceType(fieldType)) {
|
|
60033
58411
|
return;
|
|
60034
58412
|
}
|
|
60035
58413
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -60044,9 +58422,9 @@ async function addID(config2, documents) {
|
|
|
60044
58422
|
continue;
|
|
60045
58423
|
}
|
|
60046
58424
|
selections.push({
|
|
60047
|
-
kind:
|
|
58425
|
+
kind: graphql21.Kind.FIELD,
|
|
60048
58426
|
name: {
|
|
60049
|
-
kind:
|
|
58427
|
+
kind: graphql21.Kind.NAME,
|
|
60050
58428
|
value: keyField
|
|
60051
58429
|
}
|
|
60052
58430
|
});
|
|
@@ -60065,8 +58443,8 @@ async function addID(config2, documents) {
|
|
|
60065
58443
|
}
|
|
60066
58444
|
|
|
60067
58445
|
// src/codegen/transforms/fragmentVariables.ts
|
|
60068
|
-
var
|
|
60069
|
-
var GraphqlKinds2 =
|
|
58446
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
58447
|
+
var GraphqlKinds2 = graphql22.Kind;
|
|
60070
58448
|
async function fragmentVariables(config2, documents) {
|
|
60071
58449
|
const fragments = collectFragments(config2, documents);
|
|
60072
58450
|
const generatedFragments = {};
|
|
@@ -60089,7 +58467,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
60089
58467
|
});
|
|
60090
58468
|
}
|
|
60091
58469
|
const doc = {
|
|
60092
|
-
kind:
|
|
58470
|
+
kind: graphql22.Kind.DOCUMENT,
|
|
60093
58471
|
definitions: Object.values(generatedFragments)
|
|
60094
58472
|
};
|
|
60095
58473
|
documents.push({
|
|
@@ -60125,7 +58503,7 @@ function inlineFragmentArgs({
|
|
|
60125
58503
|
filepath,
|
|
60126
58504
|
document
|
|
60127
58505
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
60128
|
-
const result =
|
|
58506
|
+
const result = graphql22.visit(document, {
|
|
60129
58507
|
FragmentSpread(node) {
|
|
60130
58508
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
60131
58509
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -60213,7 +58591,7 @@ function inlineFragmentArgs({
|
|
|
60213
58591
|
});
|
|
60214
58592
|
if (newName) {
|
|
60215
58593
|
result.name = {
|
|
60216
|
-
kind:
|
|
58594
|
+
kind: graphql22.Kind.NAME,
|
|
60217
58595
|
value: newName
|
|
60218
58596
|
};
|
|
60219
58597
|
}
|
|
@@ -60325,7 +58703,7 @@ function operationScope(operation) {
|
|
|
60325
58703
|
}
|
|
60326
58704
|
|
|
60327
58705
|
// src/codegen/validators/typeCheck.ts
|
|
60328
|
-
var
|
|
58706
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
60329
58707
|
async function typeCheck(config2, docs) {
|
|
60330
58708
|
const errors = [];
|
|
60331
58709
|
const freeLists = [];
|
|
@@ -60333,11 +58711,11 @@ async function typeCheck(config2, docs) {
|
|
|
60333
58711
|
const listTypes = [];
|
|
60334
58712
|
const fragments = {};
|
|
60335
58713
|
for (const { document: parsed, filename } of docs) {
|
|
60336
|
-
|
|
60337
|
-
[
|
|
58714
|
+
graphql23.visit(parsed, {
|
|
58715
|
+
[graphql23.Kind.FRAGMENT_DEFINITION](definition) {
|
|
60338
58716
|
fragments[definition.name.value] = definition;
|
|
60339
58717
|
},
|
|
60340
|
-
[
|
|
58718
|
+
[graphql23.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
60341
58719
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
60342
58720
|
return;
|
|
60343
58721
|
}
|
|
@@ -60383,14 +58761,14 @@ async function typeCheck(config2, docs) {
|
|
|
60383
58761
|
);
|
|
60384
58762
|
return;
|
|
60385
58763
|
}
|
|
60386
|
-
if (
|
|
58764
|
+
if (graphql23.isListType(rootType) || graphql23.isNonNullType(rootType) && graphql23.isListType(rootType.ofType)) {
|
|
60387
58765
|
needsParent = true;
|
|
60388
58766
|
break;
|
|
60389
58767
|
}
|
|
60390
|
-
if (
|
|
58768
|
+
if (graphql23.isNonNullType(rootType) && "ofType" in rootType) {
|
|
60391
58769
|
rootType = rootType.ofType;
|
|
60392
58770
|
}
|
|
60393
|
-
if (
|
|
58771
|
+
if (graphql23.isScalarType(rootType)) {
|
|
60394
58772
|
break;
|
|
60395
58773
|
}
|
|
60396
58774
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -60466,9 +58844,9 @@ async function typeCheck(config2, docs) {
|
|
|
60466
58844
|
);
|
|
60467
58845
|
}
|
|
60468
58846
|
let targetTypes = [type];
|
|
60469
|
-
if (
|
|
58847
|
+
if (graphql23.isUnionType(type)) {
|
|
60470
58848
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
60471
|
-
} else if (
|
|
58849
|
+
} else if (graphql23.isInterfaceType(type)) {
|
|
60472
58850
|
try {
|
|
60473
58851
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
60474
58852
|
if (!type.getFields()[key]) {
|
|
@@ -60506,13 +58884,13 @@ async function typeCheck(config2, docs) {
|
|
|
60506
58884
|
if (errors.length > 0) {
|
|
60507
58885
|
throw errors;
|
|
60508
58886
|
}
|
|
60509
|
-
const rules = (filepath) => [...
|
|
58887
|
+
const rules = (filepath) => [...graphql23.specifiedRules].filter(
|
|
60510
58888
|
(rule) => ![
|
|
60511
|
-
|
|
60512
|
-
|
|
60513
|
-
|
|
60514
|
-
|
|
60515
|
-
|
|
58889
|
+
graphql23.NoUnusedFragmentsRule,
|
|
58890
|
+
graphql23.KnownFragmentNamesRule,
|
|
58891
|
+
graphql23.ExecutableDefinitionsRule,
|
|
58892
|
+
graphql23.KnownDirectivesRule,
|
|
58893
|
+
graphql23.KnownArgumentNamesRule
|
|
60516
58894
|
].includes(rule)
|
|
60517
58895
|
).concat(
|
|
60518
58896
|
validateLists({
|
|
@@ -60531,7 +58909,7 @@ async function typeCheck(config2, docs) {
|
|
|
60531
58909
|
noUnusedFragmentArguments(config2)
|
|
60532
58910
|
);
|
|
60533
58911
|
for (const { filename, document: parsed } of docs) {
|
|
60534
|
-
for (const error of
|
|
58912
|
+
for (const error of graphql23.validate(config2.schema, parsed, rules(filename))) {
|
|
60535
58913
|
errors.push(
|
|
60536
58914
|
new HoudiniError({
|
|
60537
58915
|
filepath: filename,
|
|
@@ -60557,7 +58935,7 @@ var validateLists = ({
|
|
|
60557
58935
|
if (!config2.isListFragment(node.name.value)) {
|
|
60558
58936
|
if (!fragments[node.name.value]) {
|
|
60559
58937
|
ctx.reportError(
|
|
60560
|
-
new
|
|
58938
|
+
new graphql23.GraphQLError(
|
|
60561
58939
|
"Encountered unknown fragment: " + node.name.value
|
|
60562
58940
|
)
|
|
60563
58941
|
);
|
|
@@ -60567,7 +58945,7 @@ var validateLists = ({
|
|
|
60567
58945
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
60568
58946
|
if (!lists.includes(listName)) {
|
|
60569
58947
|
ctx.reportError(
|
|
60570
|
-
new
|
|
58948
|
+
new graphql23.GraphQLError(
|
|
60571
58949
|
"Encountered fragment referencing unknown list: " + listName
|
|
60572
58950
|
)
|
|
60573
58951
|
);
|
|
@@ -60592,7 +58970,7 @@ var validateLists = ({
|
|
|
60592
58970
|
);
|
|
60593
58971
|
if (parentArg) {
|
|
60594
58972
|
ctx.reportError(
|
|
60595
|
-
new
|
|
58973
|
+
new graphql23.GraphQLError(
|
|
60596
58974
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
60597
58975
|
)
|
|
60598
58976
|
);
|
|
@@ -60608,7 +58986,7 @@ var validateLists = ({
|
|
|
60608
58986
|
return;
|
|
60609
58987
|
}
|
|
60610
58988
|
ctx.reportError(
|
|
60611
|
-
new
|
|
58989
|
+
new graphql23.GraphQLError(
|
|
60612
58990
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
60613
58991
|
)
|
|
60614
58992
|
);
|
|
@@ -60618,7 +58996,7 @@ var validateLists = ({
|
|
|
60618
58996
|
const directiveName = node.name.value;
|
|
60619
58997
|
if (directiveName === "connection") {
|
|
60620
58998
|
ctx.reportError(
|
|
60621
|
-
new
|
|
58999
|
+
new graphql23.GraphQLError(
|
|
60622
59000
|
"@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."
|
|
60623
59001
|
)
|
|
60624
59002
|
);
|
|
@@ -60627,7 +59005,7 @@ var validateLists = ({
|
|
|
60627
59005
|
if (!config2.isInternalDirective(node)) {
|
|
60628
59006
|
if (!config2.schema.getDirective(directiveName)) {
|
|
60629
59007
|
ctx.reportError(
|
|
60630
|
-
new
|
|
59008
|
+
new graphql23.GraphQLError(
|
|
60631
59009
|
"Encountered unknown directive: " + directiveName
|
|
60632
59010
|
)
|
|
60633
59011
|
);
|
|
@@ -60636,7 +59014,7 @@ var validateLists = ({
|
|
|
60636
59014
|
}
|
|
60637
59015
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
60638
59016
|
ctx.reportError(
|
|
60639
|
-
new
|
|
59017
|
+
new graphql23.GraphQLError(
|
|
60640
59018
|
"Encountered directive referencing unknown list: " + directiveName
|
|
60641
59019
|
)
|
|
60642
59020
|
);
|
|
@@ -60647,7 +59025,7 @@ var validateLists = ({
|
|
|
60647
59025
|
};
|
|
60648
59026
|
function knownArguments(config2) {
|
|
60649
59027
|
return function(ctx) {
|
|
60650
|
-
const nativeValidator =
|
|
59028
|
+
const nativeValidator = graphql23.KnownArgumentNamesRule(ctx);
|
|
60651
59029
|
return {
|
|
60652
59030
|
...nativeValidator,
|
|
60653
59031
|
Directive(directiveNode) {
|
|
@@ -60680,7 +59058,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60680
59058
|
for (const arg of node.arguments || []) {
|
|
60681
59059
|
if (arg.value.kind !== "ObjectValue") {
|
|
60682
59060
|
ctx.reportError(
|
|
60683
|
-
new
|
|
59061
|
+
new graphql23.GraphQLError("values in @arguments must be an object")
|
|
60684
59062
|
);
|
|
60685
59063
|
return;
|
|
60686
59064
|
}
|
|
@@ -60690,13 +59068,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60690
59068
|
);
|
|
60691
59069
|
if (!typeArg) {
|
|
60692
59070
|
ctx.reportError(
|
|
60693
|
-
new
|
|
59071
|
+
new graphql23.GraphQLError("missing type field for @arguments directive")
|
|
60694
59072
|
);
|
|
60695
59073
|
return;
|
|
60696
59074
|
}
|
|
60697
|
-
if (typeArg.value.kind !==
|
|
59075
|
+
if (typeArg.value.kind !== graphql23.Kind.STRING) {
|
|
60698
59076
|
ctx.reportError(
|
|
60699
|
-
new
|
|
59077
|
+
new graphql23.GraphQLError("type field to @arguments must be a string")
|
|
60700
59078
|
);
|
|
60701
59079
|
return;
|
|
60702
59080
|
}
|
|
@@ -60709,7 +59087,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60709
59087
|
);
|
|
60710
59088
|
if (typeArg.value.value !== defaultValueType) {
|
|
60711
59089
|
ctx.reportError(
|
|
60712
|
-
new
|
|
59090
|
+
new graphql23.GraphQLError(
|
|
60713
59091
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60714
59092
|
)
|
|
60715
59093
|
);
|
|
@@ -60727,7 +59105,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60727
59105
|
try {
|
|
60728
59106
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60729
59107
|
} catch (e) {
|
|
60730
|
-
ctx.reportError(new
|
|
59108
|
+
ctx.reportError(new graphql23.GraphQLError(e.message));
|
|
60731
59109
|
return;
|
|
60732
59110
|
}
|
|
60733
59111
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60750,7 +59128,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60750
59128
|
);
|
|
60751
59129
|
if (missing.length > 0) {
|
|
60752
59130
|
ctx.reportError(
|
|
60753
|
-
new
|
|
59131
|
+
new graphql23.GraphQLError(
|
|
60754
59132
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60755
59133
|
)
|
|
60756
59134
|
);
|
|
@@ -60761,7 +59139,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60761
59139
|
);
|
|
60762
59140
|
if (unknown.length > 0) {
|
|
60763
59141
|
ctx.reportError(
|
|
60764
|
-
new
|
|
59142
|
+
new graphql23.GraphQLError(
|
|
60765
59143
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60766
59144
|
)
|
|
60767
59145
|
);
|
|
@@ -60773,7 +59151,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60773
59151
|
]
|
|
60774
59152
|
);
|
|
60775
59153
|
for (const [applied, target] of zipped) {
|
|
60776
|
-
if (applied.value.kind ===
|
|
59154
|
+
if (applied.value.kind === graphql23.Kind.VARIABLE || applied.value.kind === graphql23.Kind.LIST || applied.value.kind === graphql23.Kind.OBJECT) {
|
|
60777
59155
|
continue;
|
|
60778
59156
|
}
|
|
60779
59157
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60782,7 +59160,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60782
59160
|
);
|
|
60783
59161
|
if (appliedType !== target) {
|
|
60784
59162
|
ctx.reportError(
|
|
60785
|
-
new
|
|
59163
|
+
new graphql23.GraphQLError(
|
|
60786
59164
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60787
59165
|
)
|
|
60788
59166
|
);
|
|
@@ -60803,7 +59181,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60803
59181
|
}
|
|
60804
59182
|
if (alreadyPaginated) {
|
|
60805
59183
|
ctx.reportError(
|
|
60806
|
-
new
|
|
59184
|
+
new graphql23.GraphQLError(
|
|
60807
59185
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60808
59186
|
)
|
|
60809
59187
|
);
|
|
@@ -60818,7 +59196,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60818
59196
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60819
59197
|
if (hasRequiredArgs) {
|
|
60820
59198
|
ctx.reportError(
|
|
60821
|
-
new
|
|
59199
|
+
new graphql23.GraphQLError(
|
|
60822
59200
|
"@paginate cannot appear on a document with required args"
|
|
60823
59201
|
)
|
|
60824
59202
|
);
|
|
@@ -60850,14 +59228,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60850
59228
|
const backwards = appliedArgs.has("last");
|
|
60851
59229
|
if (!forward && !backwards) {
|
|
60852
59230
|
ctx.reportError(
|
|
60853
|
-
new
|
|
59231
|
+
new graphql23.GraphQLError(
|
|
60854
59232
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60855
59233
|
)
|
|
60856
59234
|
);
|
|
60857
59235
|
}
|
|
60858
59236
|
if (forward && backwards) {
|
|
60859
59237
|
ctx.reportError(
|
|
60860
|
-
new
|
|
59238
|
+
new graphql23.GraphQLError(
|
|
60861
59239
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60862
59240
|
)
|
|
60863
59241
|
);
|
|
@@ -60871,7 +59249,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60871
59249
|
);
|
|
60872
59250
|
if (!appliedLimitArg) {
|
|
60873
59251
|
ctx.reportError(
|
|
60874
|
-
new
|
|
59252
|
+
new graphql23.GraphQLError(
|
|
60875
59253
|
"A field with offset-based pagination must have a limit argument"
|
|
60876
59254
|
)
|
|
60877
59255
|
);
|
|
@@ -60887,20 +59265,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60887
59265
|
const args = /* @__PURE__ */ new Set();
|
|
60888
59266
|
return {
|
|
60889
59267
|
enter(node) {
|
|
60890
|
-
if (node.kind ===
|
|
59268
|
+
if (node.kind === graphql23.Kind.FRAGMENT_DEFINITION) {
|
|
60891
59269
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60892
59270
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60893
59271
|
args.add(arg);
|
|
60894
59272
|
}
|
|
60895
|
-
} else if (node.kind ===
|
|
59273
|
+
} else if (node.kind === graphql23.Kind.VARIABLE) {
|
|
60896
59274
|
args.delete(node.name.value);
|
|
60897
59275
|
}
|
|
60898
59276
|
},
|
|
60899
59277
|
leave(node) {
|
|
60900
|
-
if (node.kind ===
|
|
59278
|
+
if (node.kind === graphql23.Kind.FRAGMENT_DEFINITION) {
|
|
60901
59279
|
if (args.size > 0) {
|
|
60902
59280
|
ctx.reportError(
|
|
60903
|
-
new
|
|
59281
|
+
new graphql23.GraphQLError(
|
|
60904
59282
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60905
59283
|
)
|
|
60906
59284
|
);
|
|
@@ -60936,7 +59314,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60936
59314
|
if (definition.kind === "OperationDefinition") {
|
|
60937
59315
|
if (definition.operation !== "query") {
|
|
60938
59316
|
ctx.reportError(
|
|
60939
|
-
new
|
|
59317
|
+
new graphql23.GraphQLError(
|
|
60940
59318
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60941
59319
|
)
|
|
60942
59320
|
);
|
|
@@ -60948,7 +59326,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60948
59326
|
}
|
|
60949
59327
|
if (!possibleNodes.includes(definitionType)) {
|
|
60950
59328
|
ctx.reportError(
|
|
60951
|
-
new
|
|
59329
|
+
new graphql23.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60952
59330
|
);
|
|
60953
59331
|
}
|
|
60954
59332
|
}
|
|
@@ -60967,7 +59345,7 @@ function checkMutationOperation(config2) {
|
|
|
60967
59345
|
);
|
|
60968
59346
|
if (append && prepend) {
|
|
60969
59347
|
ctx.reportError(
|
|
60970
|
-
new
|
|
59348
|
+
new graphql23.GraphQLError(
|
|
60971
59349
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60972
59350
|
)
|
|
60973
59351
|
);
|
|
@@ -60981,7 +59359,7 @@ function checkMutationOperation(config2) {
|
|
|
60981
59359
|
);
|
|
60982
59360
|
if (parentId && allLists) {
|
|
60983
59361
|
ctx.reportError(
|
|
60984
|
-
new
|
|
59362
|
+
new graphql23.GraphQLError(
|
|
60985
59363
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60986
59364
|
)
|
|
60987
59365
|
);
|
|
@@ -61003,7 +59381,7 @@ function checkMaskDirective(config2) {
|
|
|
61003
59381
|
);
|
|
61004
59382
|
if (maskEnableDirective && maskDisableDirective) {
|
|
61005
59383
|
ctx.reportError(
|
|
61006
|
-
new
|
|
59384
|
+
new graphql23.GraphQLError(
|
|
61007
59385
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
61008
59386
|
)
|
|
61009
59387
|
);
|
|
@@ -61019,7 +59397,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
61019
59397
|
if (!nodeInterface) {
|
|
61020
59398
|
return null;
|
|
61021
59399
|
}
|
|
61022
|
-
if (!
|
|
59400
|
+
if (!graphql23.isInterfaceType(nodeInterface)) {
|
|
61023
59401
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
61024
59402
|
return null;
|
|
61025
59403
|
}
|
|
@@ -61117,11 +59495,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
61117
59495
|
}
|
|
61118
59496
|
|
|
61119
59497
|
// src/codegen/validators/noIDAlias.ts
|
|
61120
|
-
var
|
|
59498
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
61121
59499
|
async function noIDAlias(config2, docs) {
|
|
61122
59500
|
const errors = [];
|
|
61123
59501
|
for (const { filename, document } of docs) {
|
|
61124
|
-
|
|
59502
|
+
graphql24.visit(document, {
|
|
61125
59503
|
Field(node, _, __, ___, ancestors) {
|
|
61126
59504
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
61127
59505
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -61285,12 +59663,14 @@ function logStyled(kind, stat2, logLevel, plugin) {
|
|
|
61285
59663
|
}
|
|
61286
59664
|
|
|
61287
59665
|
// src/test/index.ts
|
|
61288
|
-
function testConfigFile(config2 = {}) {
|
|
59666
|
+
function testConfigFile({ plugins, ...config2 } = {}) {
|
|
61289
59667
|
return {
|
|
61290
59668
|
schema: `
|
|
61291
59669
|
scalar Cursor
|
|
61292
59670
|
scalar DateTime
|
|
61293
59671
|
|
|
59672
|
+
directive @live on QUERY
|
|
59673
|
+
|
|
61294
59674
|
type User implements Node & Friend & CatOwner {
|
|
61295
59675
|
id: ID!
|
|
61296
59676
|
name: String!
|
|
@@ -61424,7 +59804,7 @@ function testConfigFile(config2 = {}) {
|
|
|
61424
59804
|
cats: [Cat!]!
|
|
61425
59805
|
}
|
|
61426
59806
|
|
|
61427
|
-
interface IsGhost {
|
|
59807
|
+
interface IsGhost {
|
|
61428
59808
|
aka: String!
|
|
61429
59809
|
}
|
|
61430
59810
|
|
|
@@ -61517,7 +59897,8 @@ function testConfigFile(config2 = {}) {
|
|
|
61517
59897
|
plugins: {
|
|
61518
59898
|
"houdini-svelte": {
|
|
61519
59899
|
client: "./my/client/path"
|
|
61520
|
-
}
|
|
59900
|
+
},
|
|
59901
|
+
...plugins
|
|
61521
59902
|
},
|
|
61522
59903
|
acceptImperativeInstability: true,
|
|
61523
59904
|
...config2
|
|
@@ -61551,7 +59932,7 @@ function pipelineTest(config2, documents, shouldPass, testBody) {
|
|
|
61551
59932
|
};
|
|
61552
59933
|
}
|
|
61553
59934
|
function mockCollectedDoc(query) {
|
|
61554
|
-
const parsed =
|
|
59935
|
+
const parsed = graphql25.parse(query);
|
|
61555
59936
|
const name2 = parsed.definitions[0].name.value;
|
|
61556
59937
|
const operations = parsed.definitions;
|
|
61557
59938
|
let kind = "HoudiniFragment" /* Fragment */;
|