houdini 1.0.0-next.1 → 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 +398 -2024
- package/build/cmd-esm/index.js +398 -2024
- 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-esm/index.js
CHANGED
|
@@ -9520,18 +9520,18 @@ var require_execute = __commonJS({
|
|
|
9520
9520
|
}
|
|
9521
9521
|
var returnType = fieldDef.type;
|
|
9522
9522
|
var resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver;
|
|
9523
|
-
var
|
|
9523
|
+
var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path2);
|
|
9524
9524
|
try {
|
|
9525
9525
|
var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], exeContext.variableValues);
|
|
9526
9526
|
var _contextValue = exeContext.contextValue;
|
|
9527
|
-
var result = resolveFn(source, args, _contextValue,
|
|
9527
|
+
var result = resolveFn(source, args, _contextValue, info);
|
|
9528
9528
|
var completed;
|
|
9529
9529
|
if ((0, _isPromise.default)(result)) {
|
|
9530
9530
|
completed = result.then(function(resolved) {
|
|
9531
|
-
return completeValue(exeContext, returnType, fieldNodes,
|
|
9531
|
+
return completeValue(exeContext, returnType, fieldNodes, info, path2, resolved);
|
|
9532
9532
|
});
|
|
9533
9533
|
} else {
|
|
9534
|
-
completed = completeValue(exeContext, returnType, fieldNodes,
|
|
9534
|
+
completed = completeValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
9535
9535
|
}
|
|
9536
9536
|
if ((0, _isPromise.default)(completed)) {
|
|
9537
9537
|
return completed.then(void 0, function(rawError) {
|
|
@@ -9566,14 +9566,14 @@ var require_execute = __commonJS({
|
|
|
9566
9566
|
exeContext.errors.push(error);
|
|
9567
9567
|
return null;
|
|
9568
9568
|
}
|
|
9569
|
-
function completeValue(exeContext, returnType, fieldNodes,
|
|
9569
|
+
function completeValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
9570
9570
|
if (result instanceof Error) {
|
|
9571
9571
|
throw result;
|
|
9572
9572
|
}
|
|
9573
9573
|
if ((0, _definition.isNonNullType)(returnType)) {
|
|
9574
|
-
var completed = completeValue(exeContext, returnType.ofType, fieldNodes,
|
|
9574
|
+
var completed = completeValue(exeContext, returnType.ofType, fieldNodes, info, path2, result);
|
|
9575
9575
|
if (completed === null) {
|
|
9576
|
-
throw new Error("Cannot return null for non-nullable field ".concat(
|
|
9576
|
+
throw new Error("Cannot return null for non-nullable field ".concat(info.parentType.name, ".").concat(info.fieldName, "."));
|
|
9577
9577
|
}
|
|
9578
9578
|
return completed;
|
|
9579
9579
|
}
|
|
@@ -9581,20 +9581,20 @@ var require_execute = __commonJS({
|
|
|
9581
9581
|
return null;
|
|
9582
9582
|
}
|
|
9583
9583
|
if ((0, _definition.isListType)(returnType)) {
|
|
9584
|
-
return completeListValue(exeContext, returnType, fieldNodes,
|
|
9584
|
+
return completeListValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
9585
9585
|
}
|
|
9586
9586
|
if ((0, _definition.isLeafType)(returnType)) {
|
|
9587
9587
|
return completeLeafValue(returnType, result);
|
|
9588
9588
|
}
|
|
9589
9589
|
if ((0, _definition.isAbstractType)(returnType)) {
|
|
9590
|
-
return completeAbstractValue(exeContext, returnType, fieldNodes,
|
|
9590
|
+
return completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
9591
9591
|
}
|
|
9592
9592
|
if ((0, _definition.isObjectType)(returnType)) {
|
|
9593
|
-
return completeObjectValue(exeContext, returnType, fieldNodes,
|
|
9593
|
+
return completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
9594
9594
|
}
|
|
9595
9595
|
(0, _invariant.default)(0, "Cannot complete value of unexpected output type: " + (0, _inspect.default)(returnType));
|
|
9596
9596
|
}
|
|
9597
|
-
function completeListValue(exeContext, returnType, fieldNodes,
|
|
9597
|
+
function completeListValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
9598
9598
|
var itemType = returnType.ofType;
|
|
9599
9599
|
var containsPromise = false;
|
|
9600
9600
|
var completedResults = (0, _safeArrayFrom.default)(result, function(item, index) {
|
|
@@ -9603,10 +9603,10 @@ var require_execute = __commonJS({
|
|
|
9603
9603
|
var completedItem;
|
|
9604
9604
|
if ((0, _isPromise.default)(item)) {
|
|
9605
9605
|
completedItem = item.then(function(resolved) {
|
|
9606
|
-
return completeValue(exeContext, itemType, fieldNodes,
|
|
9606
|
+
return completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved);
|
|
9607
9607
|
});
|
|
9608
9608
|
} else {
|
|
9609
|
-
completedItem = completeValue(exeContext, itemType, fieldNodes,
|
|
9609
|
+
completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item);
|
|
9610
9610
|
}
|
|
9611
9611
|
if ((0, _isPromise.default)(completedItem)) {
|
|
9612
9612
|
containsPromise = true;
|
|
@@ -9622,7 +9622,7 @@ var require_execute = __commonJS({
|
|
|
9622
9622
|
}
|
|
9623
9623
|
});
|
|
9624
9624
|
if (completedResults == null) {
|
|
9625
|
-
throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(
|
|
9625
|
+
throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(info.parentType.name, ".").concat(info.fieldName, '".'));
|
|
9626
9626
|
}
|
|
9627
9627
|
return containsPromise ? Promise.all(completedResults) : completedResults;
|
|
9628
9628
|
}
|
|
@@ -9633,25 +9633,25 @@ var require_execute = __commonJS({
|
|
|
9633
9633
|
}
|
|
9634
9634
|
return serializedResult;
|
|
9635
9635
|
}
|
|
9636
|
-
function completeAbstractValue(exeContext, returnType, fieldNodes,
|
|
9636
|
+
function completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
9637
9637
|
var _returnType$resolveTy;
|
|
9638
9638
|
var resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver;
|
|
9639
9639
|
var contextValue = exeContext.contextValue;
|
|
9640
|
-
var runtimeType = resolveTypeFn(result, contextValue,
|
|
9640
|
+
var runtimeType = resolveTypeFn(result, contextValue, info, returnType);
|
|
9641
9641
|
if ((0, _isPromise.default)(runtimeType)) {
|
|
9642
9642
|
return runtimeType.then(function(resolvedRuntimeType) {
|
|
9643
|
-
return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes,
|
|
9643
|
+
return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
|
|
9644
9644
|
});
|
|
9645
9645
|
}
|
|
9646
|
-
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes,
|
|
9646
|
+
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
|
|
9647
9647
|
}
|
|
9648
|
-
function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes,
|
|
9648
|
+
function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info, result) {
|
|
9649
9649
|
if (runtimeTypeOrName == null) {
|
|
9650
|
-
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(
|
|
9650
|
+
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);
|
|
9651
9651
|
}
|
|
9652
9652
|
var runtimeTypeName = (0, _definition.isNamedType)(runtimeTypeOrName) ? runtimeTypeOrName.name : runtimeTypeOrName;
|
|
9653
9653
|
if (typeof runtimeTypeName !== "string") {
|
|
9654
|
-
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(
|
|
9654
|
+
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), '".'));
|
|
9655
9655
|
}
|
|
9656
9656
|
var runtimeType = exeContext.schema.getType(runtimeTypeName);
|
|
9657
9657
|
if (runtimeType == null) {
|
|
@@ -9665,9 +9665,9 @@ var require_execute = __commonJS({
|
|
|
9665
9665
|
}
|
|
9666
9666
|
return runtimeType;
|
|
9667
9667
|
}
|
|
9668
|
-
function completeObjectValue(exeContext, returnType, fieldNodes,
|
|
9668
|
+
function completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
9669
9669
|
if (returnType.isTypeOf) {
|
|
9670
|
-
var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue,
|
|
9670
|
+
var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info);
|
|
9671
9671
|
if ((0, _isPromise.default)(isTypeOf)) {
|
|
9672
9672
|
return isTypeOf.then(function(resolvedIsTypeOf) {
|
|
9673
9673
|
if (!resolvedIsTypeOf) {
|
|
@@ -9701,16 +9701,16 @@ var require_execute = __commonJS({
|
|
|
9701
9701
|
}
|
|
9702
9702
|
return subFieldNodes;
|
|
9703
9703
|
}
|
|
9704
|
-
var defaultTypeResolver = function defaultTypeResolver2(value, contextValue,
|
|
9704
|
+
var defaultTypeResolver = function defaultTypeResolver2(value, contextValue, info, abstractType) {
|
|
9705
9705
|
if ((0, _isObjectLike.default)(value) && typeof value.__typename === "string") {
|
|
9706
9706
|
return value.__typename;
|
|
9707
9707
|
}
|
|
9708
|
-
var possibleTypes =
|
|
9708
|
+
var possibleTypes = info.schema.getPossibleTypes(abstractType);
|
|
9709
9709
|
var promisedIsTypeOfResults = [];
|
|
9710
9710
|
for (var i = 0; i < possibleTypes.length; i++) {
|
|
9711
9711
|
var type = possibleTypes[i];
|
|
9712
9712
|
if (type.isTypeOf) {
|
|
9713
|
-
var isTypeOfResult = type.isTypeOf(value, contextValue,
|
|
9713
|
+
var isTypeOfResult = type.isTypeOf(value, contextValue, info);
|
|
9714
9714
|
if ((0, _isPromise.default)(isTypeOfResult)) {
|
|
9715
9715
|
promisedIsTypeOfResults[i] = isTypeOfResult;
|
|
9716
9716
|
} else if (isTypeOfResult) {
|
|
@@ -9729,11 +9729,11 @@ var require_execute = __commonJS({
|
|
|
9729
9729
|
}
|
|
9730
9730
|
};
|
|
9731
9731
|
exports.defaultTypeResolver = defaultTypeResolver;
|
|
9732
|
-
var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue,
|
|
9732
|
+
var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue, info) {
|
|
9733
9733
|
if ((0, _isObjectLike.default)(source) || typeof source === "function") {
|
|
9734
|
-
var property = source[
|
|
9734
|
+
var property = source[info.fieldName];
|
|
9735
9735
|
if (typeof property === "function") {
|
|
9736
|
-
return source[
|
|
9736
|
+
return source[info.fieldName](args, contextValue, info);
|
|
9737
9737
|
}
|
|
9738
9738
|
return property;
|
|
9739
9739
|
}
|
|
@@ -9759,7 +9759,7 @@ var require_graphql = __commonJS({
|
|
|
9759
9759
|
Object.defineProperty(exports, "__esModule", {
|
|
9760
9760
|
value: true
|
|
9761
9761
|
});
|
|
9762
|
-
exports.graphql =
|
|
9762
|
+
exports.graphql = graphql26;
|
|
9763
9763
|
exports.graphqlSync = graphqlSync;
|
|
9764
9764
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
9765
9765
|
var _parser = require_parser();
|
|
@@ -9769,7 +9769,7 @@ var require_graphql = __commonJS({
|
|
|
9769
9769
|
function _interopRequireDefault(obj) {
|
|
9770
9770
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
9771
9771
|
}
|
|
9772
|
-
function
|
|
9772
|
+
function graphql26(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
9773
9773
|
var _arguments = arguments;
|
|
9774
9774
|
return new Promise(function(resolve2) {
|
|
9775
9775
|
return resolve2(
|
|
@@ -10753,13 +10753,13 @@ var require_subscribe = __commonJS({
|
|
|
10753
10753
|
throw new _GraphQLError.GraphQLError('The subscription field "'.concat(fieldName, '" is not defined.'), fieldNodes);
|
|
10754
10754
|
}
|
|
10755
10755
|
var path2 = (0, _Path.addPath)(void 0, responseName, type.name);
|
|
10756
|
-
var
|
|
10756
|
+
var info = (0, _execute.buildResolveInfo)(exeContext, fieldDef, fieldNodes, type, path2);
|
|
10757
10757
|
return new Promise(function(resolveResult) {
|
|
10758
10758
|
var _fieldDef$subscribe;
|
|
10759
10759
|
var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], variableValues);
|
|
10760
10760
|
var contextValue = exeContext.contextValue;
|
|
10761
10761
|
var resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.fieldResolver;
|
|
10762
|
-
resolveResult(resolveFn(rootValue, args, contextValue,
|
|
10762
|
+
resolveResult(resolveFn(rootValue, args, contextValue, info));
|
|
10763
10763
|
}).then(function(eventStream) {
|
|
10764
10764
|
if (eventStream instanceof Error) {
|
|
10765
10765
|
throw (0, _locatedError.locatedError)(eventStream, fieldNodes, (0, _Path.pathToArray)(path2));
|
|
@@ -15650,42 +15650,42 @@ var require_node = __commonJS({
|
|
|
15650
15650
|
return Link2;
|
|
15651
15651
|
}(events_1.EventEmitter);
|
|
15652
15652
|
exports.Link = Link;
|
|
15653
|
-
var
|
|
15654
|
-
function
|
|
15653
|
+
var File = function() {
|
|
15654
|
+
function File2(link, node, flags, fd) {
|
|
15655
15655
|
this.position = 0;
|
|
15656
15656
|
this.link = link;
|
|
15657
15657
|
this.node = node;
|
|
15658
15658
|
this.flags = flags;
|
|
15659
15659
|
this.fd = fd;
|
|
15660
15660
|
}
|
|
15661
|
-
|
|
15661
|
+
File2.prototype.getString = function(encoding) {
|
|
15662
15662
|
if (encoding === void 0) {
|
|
15663
15663
|
encoding = "utf8";
|
|
15664
15664
|
}
|
|
15665
15665
|
return this.node.getString();
|
|
15666
15666
|
};
|
|
15667
|
-
|
|
15667
|
+
File2.prototype.setString = function(str) {
|
|
15668
15668
|
this.node.setString(str);
|
|
15669
15669
|
};
|
|
15670
|
-
|
|
15670
|
+
File2.prototype.getBuffer = function() {
|
|
15671
15671
|
return this.node.getBuffer();
|
|
15672
15672
|
};
|
|
15673
|
-
|
|
15673
|
+
File2.prototype.setBuffer = function(buf) {
|
|
15674
15674
|
this.node.setBuffer(buf);
|
|
15675
15675
|
};
|
|
15676
|
-
|
|
15676
|
+
File2.prototype.getSize = function() {
|
|
15677
15677
|
return this.node.getSize();
|
|
15678
15678
|
};
|
|
15679
|
-
|
|
15679
|
+
File2.prototype.truncate = function(len) {
|
|
15680
15680
|
this.node.truncate(len);
|
|
15681
15681
|
};
|
|
15682
|
-
|
|
15682
|
+
File2.prototype.seekTo = function(position) {
|
|
15683
15683
|
this.position = position;
|
|
15684
15684
|
};
|
|
15685
|
-
|
|
15685
|
+
File2.prototype.stats = function() {
|
|
15686
15686
|
return Stats_1.default.build(this.node);
|
|
15687
15687
|
};
|
|
15688
|
-
|
|
15688
|
+
File2.prototype.write = function(buf, offset, length, position) {
|
|
15689
15689
|
if (offset === void 0) {
|
|
15690
15690
|
offset = 0;
|
|
15691
15691
|
}
|
|
@@ -15700,7 +15700,7 @@ var require_node = __commonJS({
|
|
|
15700
15700
|
this.position = position + bytes;
|
|
15701
15701
|
return bytes;
|
|
15702
15702
|
};
|
|
15703
|
-
|
|
15703
|
+
File2.prototype.read = function(buf, offset, length, position) {
|
|
15704
15704
|
if (offset === void 0) {
|
|
15705
15705
|
offset = 0;
|
|
15706
15706
|
}
|
|
@@ -15713,15 +15713,15 @@ var require_node = __commonJS({
|
|
|
15713
15713
|
this.position = position + bytes;
|
|
15714
15714
|
return bytes;
|
|
15715
15715
|
};
|
|
15716
|
-
|
|
15716
|
+
File2.prototype.chmod = function(perm) {
|
|
15717
15717
|
this.node.chmod(perm);
|
|
15718
15718
|
};
|
|
15719
|
-
|
|
15719
|
+
File2.prototype.chown = function(uid, gid) {
|
|
15720
15720
|
this.node.chown(uid, gid);
|
|
15721
15721
|
};
|
|
15722
|
-
return
|
|
15722
|
+
return File2;
|
|
15723
15723
|
}();
|
|
15724
|
-
exports.File =
|
|
15724
|
+
exports.File = File;
|
|
15725
15725
|
}
|
|
15726
15726
|
});
|
|
15727
15727
|
|
|
@@ -50026,18 +50026,18 @@ var require_lines = __commonJS({
|
|
|
50026
50026
|
assert_1.default.strictEqual(typeof pos, "object");
|
|
50027
50027
|
assert_1.default.strictEqual(typeof pos.line, "number");
|
|
50028
50028
|
assert_1.default.strictEqual(typeof pos.column, "number");
|
|
50029
|
-
var line = pos.line, column = pos.column, secret = this, infos = secret.infos,
|
|
50030
|
-
if (typeof
|
|
50029
|
+
var line = pos.line, column = pos.column, secret = this, infos = secret.infos, info = infos[line - 1], c = column;
|
|
50030
|
+
if (typeof info === "undefined" || c < 0)
|
|
50031
50031
|
return "";
|
|
50032
50032
|
var indent = this.getIndentAt(line);
|
|
50033
50033
|
if (c < indent)
|
|
50034
50034
|
return " ";
|
|
50035
|
-
c +=
|
|
50036
|
-
if (c ===
|
|
50035
|
+
c += info.sliceStart - indent;
|
|
50036
|
+
if (c === info.sliceEnd && line < this.length)
|
|
50037
50037
|
return "\n";
|
|
50038
|
-
if (c >=
|
|
50038
|
+
if (c >= info.sliceEnd)
|
|
50039
50039
|
return "";
|
|
50040
|
-
return
|
|
50040
|
+
return info.line.charAt(c);
|
|
50041
50041
|
};
|
|
50042
50042
|
Lines2.prototype.stripMargin = function(width, skipFirstLine) {
|
|
50043
50043
|
if (width === 0)
|
|
@@ -50045,11 +50045,11 @@ var require_lines = __commonJS({
|
|
|
50045
50045
|
assert_1.default.ok(width > 0, "negative margin: " + width);
|
|
50046
50046
|
if (skipFirstLine && this.length === 1)
|
|
50047
50047
|
return this;
|
|
50048
|
-
var lines = new Lines2(this.infos.map(function(
|
|
50049
|
-
if (
|
|
50050
|
-
|
|
50048
|
+
var lines = new Lines2(this.infos.map(function(info, i) {
|
|
50049
|
+
if (info.line && (i > 0 || !skipFirstLine)) {
|
|
50050
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: Math.max(0, info.indent - width) });
|
|
50051
50051
|
}
|
|
50052
|
-
return
|
|
50052
|
+
return info;
|
|
50053
50053
|
}));
|
|
50054
50054
|
if (this.mappings.length > 0) {
|
|
50055
50055
|
var newMappings_1 = lines.mappings;
|
|
@@ -50064,11 +50064,11 @@ var require_lines = __commonJS({
|
|
|
50064
50064
|
if (by === 0) {
|
|
50065
50065
|
return this;
|
|
50066
50066
|
}
|
|
50067
|
-
var lines = new Lines2(this.infos.map(function(
|
|
50068
|
-
if (
|
|
50069
|
-
|
|
50067
|
+
var lines = new Lines2(this.infos.map(function(info) {
|
|
50068
|
+
if (info.line && !info.locked) {
|
|
50069
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
|
|
50070
50070
|
}
|
|
50071
|
-
return
|
|
50071
|
+
return info;
|
|
50072
50072
|
}));
|
|
50073
50073
|
if (this.mappings.length > 0) {
|
|
50074
50074
|
var newMappings_2 = lines.mappings;
|
|
@@ -50086,11 +50086,11 @@ var require_lines = __commonJS({
|
|
|
50086
50086
|
if (this.length < 2) {
|
|
50087
50087
|
return this;
|
|
50088
50088
|
}
|
|
50089
|
-
var lines = new Lines2(this.infos.map(function(
|
|
50090
|
-
if (i > 0 &&
|
|
50091
|
-
|
|
50089
|
+
var lines = new Lines2(this.infos.map(function(info, i) {
|
|
50090
|
+
if (i > 0 && info.line && !info.locked) {
|
|
50091
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
|
|
50092
50092
|
}
|
|
50093
|
-
return
|
|
50093
|
+
return info;
|
|
50094
50094
|
}));
|
|
50095
50095
|
if (this.mappings.length > 0) {
|
|
50096
50096
|
var newMappings_3 = lines.mappings;
|
|
@@ -50105,8 +50105,8 @@ var require_lines = __commonJS({
|
|
|
50105
50105
|
if (this.length < 2) {
|
|
50106
50106
|
return this;
|
|
50107
50107
|
}
|
|
50108
|
-
return new Lines2(this.infos.map(function(
|
|
50109
|
-
return tslib_1.__assign(tslib_1.__assign({},
|
|
50108
|
+
return new Lines2(this.infos.map(function(info, i) {
|
|
50109
|
+
return tslib_1.__assign(tslib_1.__assign({}, info), { locked: i > 0 });
|
|
50110
50110
|
}));
|
|
50111
50111
|
};
|
|
50112
50112
|
Lines2.prototype.getIndentAt = function(line) {
|
|
@@ -50120,14 +50120,14 @@ var require_lines = __commonJS({
|
|
|
50120
50120
|
var counts = [];
|
|
50121
50121
|
var lastIndent = 0;
|
|
50122
50122
|
for (var line = 1, last = this.length; line <= last; ++line) {
|
|
50123
|
-
var
|
|
50124
|
-
var sliced =
|
|
50123
|
+
var info = this.infos[line - 1];
|
|
50124
|
+
var sliced = info.line.slice(info.sliceStart, info.sliceEnd);
|
|
50125
50125
|
if (isOnlyWhitespace(sliced)) {
|
|
50126
50126
|
continue;
|
|
50127
50127
|
}
|
|
50128
|
-
var diff = Math.abs(
|
|
50128
|
+
var diff = Math.abs(info.indent - lastIndent);
|
|
50129
50129
|
counts[diff] = ~~counts[diff] + 1;
|
|
50130
|
-
lastIndent =
|
|
50130
|
+
lastIndent = info.indent;
|
|
50131
50131
|
}
|
|
50132
50132
|
var maxCount = -1;
|
|
50133
50133
|
var result = 2;
|
|
@@ -50150,20 +50150,20 @@ var require_lines = __commonJS({
|
|
|
50150
50150
|
return isOnlyWhitespace(this.toString());
|
|
50151
50151
|
};
|
|
50152
50152
|
Lines2.prototype.isPrecededOnlyByWhitespace = function(pos) {
|
|
50153
|
-
var
|
|
50154
|
-
var indent = Math.max(
|
|
50153
|
+
var info = this.infos[pos.line - 1];
|
|
50154
|
+
var indent = Math.max(info.indent, 0);
|
|
50155
50155
|
var diff = pos.column - indent;
|
|
50156
50156
|
if (diff <= 0) {
|
|
50157
50157
|
return true;
|
|
50158
50158
|
}
|
|
50159
|
-
var start =
|
|
50160
|
-
var end = Math.min(start + diff,
|
|
50161
|
-
var prefix =
|
|
50159
|
+
var start = info.sliceStart;
|
|
50160
|
+
var end = Math.min(start + diff, info.sliceEnd);
|
|
50161
|
+
var prefix = info.line.slice(start, end);
|
|
50162
50162
|
return isOnlyWhitespace(prefix);
|
|
50163
50163
|
};
|
|
50164
50164
|
Lines2.prototype.getLineLength = function(line) {
|
|
50165
|
-
var
|
|
50166
|
-
return this.getIndentAt(line) +
|
|
50165
|
+
var info = this.infos[line - 1];
|
|
50166
|
+
return this.getIndentAt(line) + info.sliceEnd - info.sliceStart;
|
|
50167
50167
|
};
|
|
50168
50168
|
Lines2.prototype.nextPos = function(pos, skipSpaces) {
|
|
50169
50169
|
if (skipSpaces === void 0) {
|
|
@@ -50329,20 +50329,20 @@ var require_lines = __commonJS({
|
|
|
50329
50329
|
var _a = (0, options_1.normalize)(options), tabWidth = _a.tabWidth, useTabs = _a.useTabs, reuseWhitespace = _a.reuseWhitespace, lineTerminator = _a.lineTerminator;
|
|
50330
50330
|
var parts = [];
|
|
50331
50331
|
for (var line = start.line; line <= end.line; ++line) {
|
|
50332
|
-
var
|
|
50332
|
+
var info = this.infos[line - 1];
|
|
50333
50333
|
if (line === start.line) {
|
|
50334
50334
|
if (line === end.line) {
|
|
50335
|
-
|
|
50335
|
+
info = sliceInfo(info, start.column, end.column);
|
|
50336
50336
|
} else {
|
|
50337
|
-
|
|
50337
|
+
info = sliceInfo(info, start.column);
|
|
50338
50338
|
}
|
|
50339
50339
|
} else if (line === end.line) {
|
|
50340
|
-
|
|
50340
|
+
info = sliceInfo(info, 0, end.column);
|
|
50341
50341
|
}
|
|
50342
|
-
var indent = Math.max(
|
|
50343
|
-
var before_1 =
|
|
50342
|
+
var indent = Math.max(info.indent, 0);
|
|
50343
|
+
var before_1 = info.line.slice(0, info.sliceStart);
|
|
50344
50344
|
if (reuseWhitespace && isOnlyWhitespace(before_1) && countSpaces(before_1, tabWidth) === indent) {
|
|
50345
|
-
parts.push(
|
|
50345
|
+
parts.push(info.line.slice(0, info.sliceEnd));
|
|
50346
50346
|
continue;
|
|
50347
50347
|
}
|
|
50348
50348
|
var tabs = 0;
|
|
@@ -50358,7 +50358,7 @@ var require_lines = __commonJS({
|
|
|
50358
50358
|
if (spaces > 0) {
|
|
50359
50359
|
result += new Array(spaces + 1).join(" ");
|
|
50360
50360
|
}
|
|
50361
|
-
result +=
|
|
50361
|
+
result += info.line.slice(info.sliceStart, info.sliceEnd);
|
|
50362
50362
|
parts.push(result);
|
|
50363
50363
|
}
|
|
50364
50364
|
return parts.join(lineTerminator);
|
|
@@ -50376,12 +50376,12 @@ var require_lines = __commonJS({
|
|
|
50376
50376
|
return;
|
|
50377
50377
|
}
|
|
50378
50378
|
if (prevInfo) {
|
|
50379
|
-
var
|
|
50380
|
-
var indent = new Array(
|
|
50379
|
+
var info = linesOrNull.infos[0];
|
|
50380
|
+
var indent = new Array(info.indent + 1).join(" ");
|
|
50381
50381
|
var prevLine_1 = infos.length;
|
|
50382
50382
|
var prevColumn_1 = Math.max(prevInfo.indent, 0) + prevInfo.sliceEnd - prevInfo.sliceStart;
|
|
50383
|
-
prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent +
|
|
50384
|
-
prevInfo.locked = prevInfo.locked ||
|
|
50383
|
+
prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent + info.line.slice(info.sliceStart, info.sliceEnd);
|
|
50384
|
+
prevInfo.locked = prevInfo.locked || info.locked;
|
|
50385
50385
|
prevInfo.sliceEnd = prevInfo.line.length;
|
|
50386
50386
|
if (linesOrNull.mappings.length > 0) {
|
|
50387
50387
|
linesOrNull.mappings.forEach(function(mapping) {
|
|
@@ -50391,9 +50391,9 @@ var require_lines = __commonJS({
|
|
|
50391
50391
|
} else if (linesOrNull.mappings.length > 0) {
|
|
50392
50392
|
mappings.push.apply(mappings, linesOrNull.mappings);
|
|
50393
50393
|
}
|
|
50394
|
-
linesOrNull.infos.forEach(function(
|
|
50394
|
+
linesOrNull.infos.forEach(function(info2, i) {
|
|
50395
50395
|
if (!prevInfo || i > 0) {
|
|
50396
|
-
prevInfo = tslib_1.__assign({},
|
|
50396
|
+
prevInfo = tslib_1.__assign({}, info2);
|
|
50397
50397
|
infos.push(prevInfo);
|
|
50398
50398
|
}
|
|
50399
50399
|
});
|
|
@@ -50497,10 +50497,10 @@ var require_lines = __commonJS({
|
|
|
50497
50497
|
function isOnlyWhitespace(string) {
|
|
50498
50498
|
return !/\S/.test(string);
|
|
50499
50499
|
}
|
|
50500
|
-
function sliceInfo(
|
|
50501
|
-
var sliceStart =
|
|
50502
|
-
var sliceEnd =
|
|
50503
|
-
var indent = Math.max(
|
|
50500
|
+
function sliceInfo(info, startCol, endCol) {
|
|
50501
|
+
var sliceStart = info.sliceStart;
|
|
50502
|
+
var sliceEnd = info.sliceEnd;
|
|
50503
|
+
var indent = Math.max(info.indent, 0);
|
|
50504
50504
|
var lineLength = indent + sliceEnd - sliceStart;
|
|
50505
50505
|
if (typeof endCol === "undefined") {
|
|
50506
50506
|
endCol = lineLength;
|
|
@@ -50526,11 +50526,11 @@ var require_lines = __commonJS({
|
|
|
50526
50526
|
assert_1.default.ok(indent >= 0);
|
|
50527
50527
|
assert_1.default.ok(sliceStart <= sliceEnd);
|
|
50528
50528
|
assert_1.default.strictEqual(lineLength, indent + sliceEnd - sliceStart);
|
|
50529
|
-
if (
|
|
50530
|
-
return
|
|
50529
|
+
if (info.indent === indent && info.sliceStart === sliceStart && info.sliceEnd === sliceEnd) {
|
|
50530
|
+
return info;
|
|
50531
50531
|
}
|
|
50532
50532
|
return {
|
|
50533
|
-
line:
|
|
50533
|
+
line: info.line,
|
|
50534
50534
|
indent,
|
|
50535
50535
|
locked: false,
|
|
50536
50536
|
sliceStart,
|
|
@@ -53537,9 +53537,9 @@ var require_printer2 = __commonJS({
|
|
|
53537
53537
|
var prevTrailingSpace = null;
|
|
53538
53538
|
var len = filtered.length;
|
|
53539
53539
|
var parts = [];
|
|
53540
|
-
filtered.forEach(function(
|
|
53541
|
-
var printed =
|
|
53542
|
-
var stmt =
|
|
53540
|
+
filtered.forEach(function(info, i) {
|
|
53541
|
+
var printed = info.printed;
|
|
53542
|
+
var stmt = info.node;
|
|
53543
53543
|
var multiLine = printed.length > 1;
|
|
53544
53544
|
var notFirst = i > 0;
|
|
53545
53545
|
var notLast = i < len - 1;
|
|
@@ -53938,7 +53938,7 @@ var require_main2 = __commonJS({
|
|
|
53938
53938
|
});
|
|
53939
53939
|
|
|
53940
53940
|
// src/test/index.ts
|
|
53941
|
-
var
|
|
53941
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
53942
53942
|
var import_memfs2 = __toESM(require_lib(), 1);
|
|
53943
53943
|
|
|
53944
53944
|
// src/lib/pipeline.ts
|
|
@@ -53982,1719 +53982,6 @@ function computeID(configFile, type, data) {
|
|
|
53982
53982
|
return id.slice(0, -2);
|
|
53983
53983
|
}
|
|
53984
53984
|
|
|
53985
|
-
// src/runtime/lib/deepEquals.ts
|
|
53986
|
-
function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
|
|
53987
|
-
if (Object.is(objA, objB))
|
|
53988
|
-
return true;
|
|
53989
|
-
if (objA instanceof Date && objB instanceof Date) {
|
|
53990
|
-
return objA.getTime() === objB.getTime();
|
|
53991
|
-
}
|
|
53992
|
-
if (objA instanceof RegExp && objB instanceof RegExp) {
|
|
53993
|
-
return objA.toString() === objB.toString();
|
|
53994
|
-
}
|
|
53995
|
-
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
|
53996
|
-
return false;
|
|
53997
|
-
}
|
|
53998
|
-
if (map.get(objA) === objB)
|
|
53999
|
-
return true;
|
|
54000
|
-
map.set(objA, objB);
|
|
54001
|
-
const keysA = Reflect.ownKeys(objA);
|
|
54002
|
-
const keysB = Reflect.ownKeys(objB);
|
|
54003
|
-
if (keysA.length !== keysB.length) {
|
|
54004
|
-
return false;
|
|
54005
|
-
}
|
|
54006
|
-
for (let i = 0; i < keysA.length; i++) {
|
|
54007
|
-
if (!Reflect.has(objB, keysA[i]) || !deepEquals(objA[keysA[i]], objB[keysA[i]], map)) {
|
|
54008
|
-
return false;
|
|
54009
|
-
}
|
|
54010
|
-
}
|
|
54011
|
-
return true;
|
|
54012
|
-
}
|
|
54013
|
-
|
|
54014
|
-
// src/runtime/lib/selection.ts
|
|
54015
|
-
function getFieldsForType(selection2, __typename) {
|
|
54016
|
-
let targetSelection = selection2.fields || {};
|
|
54017
|
-
if (selection2.abstractFields && __typename) {
|
|
54018
|
-
const mappedType = selection2.abstractFields.typeMap[__typename];
|
|
54019
|
-
if (mappedType) {
|
|
54020
|
-
targetSelection = selection2.abstractFields.fields[mappedType];
|
|
54021
|
-
} else if (selection2.abstractFields.fields[__typename]) {
|
|
54022
|
-
targetSelection = selection2.abstractFields.fields[__typename];
|
|
54023
|
-
}
|
|
54024
|
-
}
|
|
54025
|
-
return targetSelection;
|
|
54026
|
-
}
|
|
54027
|
-
|
|
54028
|
-
// src/runtime/cache/gc.ts
|
|
54029
|
-
var GarbageCollector = class {
|
|
54030
|
-
cache;
|
|
54031
|
-
lifetimes = /* @__PURE__ */ new Map();
|
|
54032
|
-
get cacheBufferSize() {
|
|
54033
|
-
return this.cache._internal_unstable.config.cacheBufferSize ?? 10;
|
|
54034
|
-
}
|
|
54035
|
-
constructor(cache) {
|
|
54036
|
-
this.cache = cache;
|
|
54037
|
-
}
|
|
54038
|
-
resetLifetime(id, field) {
|
|
54039
|
-
if (!this.lifetimes.get(id)) {
|
|
54040
|
-
this.lifetimes.set(id, /* @__PURE__ */ new Map());
|
|
54041
|
-
}
|
|
54042
|
-
this.lifetimes.get(id).set(field, 0);
|
|
54043
|
-
}
|
|
54044
|
-
tick() {
|
|
54045
|
-
for (const [id, fieldMap] of this.lifetimes.entries()) {
|
|
54046
|
-
for (const [field, lifetime] of fieldMap.entries()) {
|
|
54047
|
-
if (this.cache._internal_unstable.subscriptions.get(id, field).length > 0) {
|
|
54048
|
-
continue;
|
|
54049
|
-
}
|
|
54050
|
-
fieldMap.set(field, lifetime + 1);
|
|
54051
|
-
if (fieldMap.get(field) > this.cacheBufferSize) {
|
|
54052
|
-
this.cache._internal_unstable.storage.deleteField(id, field);
|
|
54053
|
-
this.cache._internal_unstable.lists.deleteField(id, field);
|
|
54054
|
-
fieldMap.delete(field);
|
|
54055
|
-
if ([...fieldMap.keys()].length === 0) {
|
|
54056
|
-
this.lifetimes.delete(id);
|
|
54057
|
-
}
|
|
54058
|
-
}
|
|
54059
|
-
}
|
|
54060
|
-
}
|
|
54061
|
-
}
|
|
54062
|
-
};
|
|
54063
|
-
|
|
54064
|
-
// src/runtime/cache/stuff.ts
|
|
54065
|
-
function flattenList(source) {
|
|
54066
|
-
const flat = [];
|
|
54067
|
-
const unvisited = [source || []];
|
|
54068
|
-
while (unvisited.length > 0) {
|
|
54069
|
-
const target = unvisited.shift();
|
|
54070
|
-
for (const id of target) {
|
|
54071
|
-
if (Array.isArray(id)) {
|
|
54072
|
-
unvisited.push(id);
|
|
54073
|
-
continue;
|
|
54074
|
-
}
|
|
54075
|
-
flat.push(id);
|
|
54076
|
-
}
|
|
54077
|
-
}
|
|
54078
|
-
return flat;
|
|
54079
|
-
}
|
|
54080
|
-
function evaluateKey(key, variables = {}) {
|
|
54081
|
-
let evaluated = "";
|
|
54082
|
-
let varName = "";
|
|
54083
|
-
let inString = false;
|
|
54084
|
-
for (const char of key) {
|
|
54085
|
-
if (varName) {
|
|
54086
|
-
if (varChars.includes(char)) {
|
|
54087
|
-
varName += char;
|
|
54088
|
-
continue;
|
|
54089
|
-
}
|
|
54090
|
-
const value = variables[varName.slice(1)];
|
|
54091
|
-
evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
|
|
54092
|
-
varName = "";
|
|
54093
|
-
}
|
|
54094
|
-
if (char === "$" && !inString) {
|
|
54095
|
-
varName = "$";
|
|
54096
|
-
continue;
|
|
54097
|
-
}
|
|
54098
|
-
if (char === '"') {
|
|
54099
|
-
inString = !inString;
|
|
54100
|
-
}
|
|
54101
|
-
evaluated += char;
|
|
54102
|
-
}
|
|
54103
|
-
return evaluated;
|
|
54104
|
-
}
|
|
54105
|
-
var varChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
|
|
54106
|
-
|
|
54107
|
-
// src/runtime/cache/lists.ts
|
|
54108
|
-
var ListManager = class {
|
|
54109
|
-
rootID;
|
|
54110
|
-
cache;
|
|
54111
|
-
constructor(cache, rootID2) {
|
|
54112
|
-
this.rootID = rootID2;
|
|
54113
|
-
this.cache = cache;
|
|
54114
|
-
}
|
|
54115
|
-
lists = /* @__PURE__ */ new Map();
|
|
54116
|
-
listsByField = /* @__PURE__ */ new Map();
|
|
54117
|
-
get(listName, id, allLists) {
|
|
54118
|
-
const matches = this.lists.get(listName);
|
|
54119
|
-
if (!matches || matches.size === 0) {
|
|
54120
|
-
return null;
|
|
54121
|
-
}
|
|
54122
|
-
if (allLists) {
|
|
54123
|
-
return new ListCollection(
|
|
54124
|
-
Array.from(matches, ([key, value]) => [...value.lists]).flat()
|
|
54125
|
-
);
|
|
54126
|
-
}
|
|
54127
|
-
const head = [...matches.values()][0];
|
|
54128
|
-
const { recordType } = head.lists[0];
|
|
54129
|
-
const parentID = id ? this.cache._internal_unstable.id(recordType || "", id) : this.rootID;
|
|
54130
|
-
if (matches?.size === 1) {
|
|
54131
|
-
if (!id) {
|
|
54132
|
-
return head;
|
|
54133
|
-
}
|
|
54134
|
-
return parentID === Array.from(matches.keys())[0] ? head : null;
|
|
54135
|
-
}
|
|
54136
|
-
if (!id) {
|
|
54137
|
-
console.error(
|
|
54138
|
-
`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 `
|
|
54139
|
-
);
|
|
54140
|
-
return null;
|
|
54141
|
-
}
|
|
54142
|
-
return this.lists.get(listName)?.get(parentID);
|
|
54143
|
-
}
|
|
54144
|
-
remove(listName, id) {
|
|
54145
|
-
this.lists.get(listName)?.delete(id || this.rootID);
|
|
54146
|
-
}
|
|
54147
|
-
add(list) {
|
|
54148
|
-
if (!this.lists.has(list.name)) {
|
|
54149
|
-
this.lists.set(list.name, /* @__PURE__ */ new Map());
|
|
54150
|
-
}
|
|
54151
|
-
const name2 = list.name;
|
|
54152
|
-
const parentID = list.recordID || this.rootID;
|
|
54153
|
-
if (this.lists.get(name2)?.get(parentID)?.includes(list.key)) {
|
|
54154
|
-
return;
|
|
54155
|
-
}
|
|
54156
|
-
if (!this.lists.has(name2)) {
|
|
54157
|
-
this.lists.set(name2, /* @__PURE__ */ new Map());
|
|
54158
|
-
}
|
|
54159
|
-
if (!this.lists.get(name2).has(parentID)) {
|
|
54160
|
-
this.lists.get(name2).set(parentID, new ListCollection([]));
|
|
54161
|
-
}
|
|
54162
|
-
if (!this.listsByField.has(parentID)) {
|
|
54163
|
-
this.listsByField.set(parentID, /* @__PURE__ */ new Map());
|
|
54164
|
-
}
|
|
54165
|
-
if (!this.listsByField.get(parentID).has(list.key)) {
|
|
54166
|
-
this.listsByField.get(parentID)?.set(list.key, []);
|
|
54167
|
-
}
|
|
54168
|
-
const handler = new List({ ...list, manager: this });
|
|
54169
|
-
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
54170
|
-
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
54171
|
-
}
|
|
54172
|
-
removeIDFromAllLists(id) {
|
|
54173
|
-
for (const fieldMap of this.lists.values()) {
|
|
54174
|
-
for (const list of fieldMap.values()) {
|
|
54175
|
-
list.removeID(id);
|
|
54176
|
-
}
|
|
54177
|
-
}
|
|
54178
|
-
}
|
|
54179
|
-
deleteField(parentID, field) {
|
|
54180
|
-
if (!this.listsByField.get(parentID)?.has(field)) {
|
|
54181
|
-
return;
|
|
54182
|
-
}
|
|
54183
|
-
for (const list of this.listsByField.get(parentID).get(field)) {
|
|
54184
|
-
this.lists.get(list.name)?.get(list.recordID)?.deleteListWithKey(field);
|
|
54185
|
-
if (this.lists.get(list.name)?.get(list.recordID)?.lists.length === 0) {
|
|
54186
|
-
this.lists.get(list.name)?.delete(list.recordID);
|
|
54187
|
-
}
|
|
54188
|
-
}
|
|
54189
|
-
this.listsByField.get(parentID).delete(field);
|
|
54190
|
-
}
|
|
54191
|
-
};
|
|
54192
|
-
var List = class {
|
|
54193
|
-
recordID;
|
|
54194
|
-
recordType;
|
|
54195
|
-
key;
|
|
54196
|
-
type;
|
|
54197
|
-
cache;
|
|
54198
|
-
selection;
|
|
54199
|
-
_when;
|
|
54200
|
-
filters;
|
|
54201
|
-
name;
|
|
54202
|
-
connection;
|
|
54203
|
-
manager;
|
|
54204
|
-
abstract;
|
|
54205
|
-
constructor({
|
|
54206
|
-
name: name2,
|
|
54207
|
-
recordID,
|
|
54208
|
-
recordType,
|
|
54209
|
-
key,
|
|
54210
|
-
listType,
|
|
54211
|
-
selection: selection2,
|
|
54212
|
-
when,
|
|
54213
|
-
filters,
|
|
54214
|
-
connection,
|
|
54215
|
-
manager,
|
|
54216
|
-
abstract
|
|
54217
|
-
}) {
|
|
54218
|
-
this.recordID = recordID || rootID;
|
|
54219
|
-
this.recordType = recordType;
|
|
54220
|
-
this.key = key;
|
|
54221
|
-
this.type = listType;
|
|
54222
|
-
this.cache = manager.cache;
|
|
54223
|
-
this.selection = selection2;
|
|
54224
|
-
this._when = when;
|
|
54225
|
-
this.filters = filters;
|
|
54226
|
-
this.name = name2;
|
|
54227
|
-
this.connection = connection;
|
|
54228
|
-
this.manager = manager;
|
|
54229
|
-
this.abstract = abstract;
|
|
54230
|
-
}
|
|
54231
|
-
when(when) {
|
|
54232
|
-
return this.manager.lists.get(this.name).get(this.recordID).when(when);
|
|
54233
|
-
}
|
|
54234
|
-
append(selection2, data, variables = {}) {
|
|
54235
|
-
return this.addToList(selection2, data, variables, "last");
|
|
54236
|
-
}
|
|
54237
|
-
prepend(selection2, data, variables = {}) {
|
|
54238
|
-
return this.addToList(selection2, data, variables, "first");
|
|
54239
|
-
}
|
|
54240
|
-
addToList(selection2, data, variables = {}, where) {
|
|
54241
|
-
const listType = this.listType(data);
|
|
54242
|
-
const dataID = this.cache._internal_unstable.id(listType, data);
|
|
54243
|
-
if (!this.validateWhen() || !dataID) {
|
|
54244
|
-
return;
|
|
54245
|
-
}
|
|
54246
|
-
let insertSelection = selection2;
|
|
54247
|
-
let insertData = data;
|
|
54248
|
-
if (this.connection) {
|
|
54249
|
-
insertSelection = {
|
|
54250
|
-
fields: {
|
|
54251
|
-
newEntry: {
|
|
54252
|
-
keyRaw: this.key,
|
|
54253
|
-
type: "Connection",
|
|
54254
|
-
selection: {
|
|
54255
|
-
fields: {
|
|
54256
|
-
edges: {
|
|
54257
|
-
keyRaw: "edges",
|
|
54258
|
-
type: "ConnectionEdge",
|
|
54259
|
-
update: where === "first" ? "prepend" : "append",
|
|
54260
|
-
selection: {
|
|
54261
|
-
fields: {
|
|
54262
|
-
node: {
|
|
54263
|
-
type: listType,
|
|
54264
|
-
keyRaw: "node",
|
|
54265
|
-
selection: {
|
|
54266
|
-
...selection2,
|
|
54267
|
-
fields: {
|
|
54268
|
-
...selection2.fields,
|
|
54269
|
-
__typename: {
|
|
54270
|
-
keyRaw: "__typename",
|
|
54271
|
-
type: "String"
|
|
54272
|
-
}
|
|
54273
|
-
}
|
|
54274
|
-
}
|
|
54275
|
-
}
|
|
54276
|
-
}
|
|
54277
|
-
}
|
|
54278
|
-
}
|
|
54279
|
-
}
|
|
54280
|
-
}
|
|
54281
|
-
}
|
|
54282
|
-
}
|
|
54283
|
-
};
|
|
54284
|
-
insertData = {
|
|
54285
|
-
newEntry: {
|
|
54286
|
-
edges: [{ node: { ...data, __typename: listType } }]
|
|
54287
|
-
}
|
|
54288
|
-
};
|
|
54289
|
-
} else {
|
|
54290
|
-
insertSelection = {
|
|
54291
|
-
fields: {
|
|
54292
|
-
newEntries: {
|
|
54293
|
-
keyRaw: this.key,
|
|
54294
|
-
type: listType,
|
|
54295
|
-
update: where === "first" ? "prepend" : "append",
|
|
54296
|
-
selection: {
|
|
54297
|
-
...selection2,
|
|
54298
|
-
fields: {
|
|
54299
|
-
...selection2.fields,
|
|
54300
|
-
__typename: {
|
|
54301
|
-
keyRaw: "__typename",
|
|
54302
|
-
type: "String"
|
|
54303
|
-
}
|
|
54304
|
-
}
|
|
54305
|
-
}
|
|
54306
|
-
}
|
|
54307
|
-
}
|
|
54308
|
-
};
|
|
54309
|
-
insertData = {
|
|
54310
|
-
newEntries: [{ ...data, __typename: listType }]
|
|
54311
|
-
};
|
|
54312
|
-
}
|
|
54313
|
-
this.cache.write({
|
|
54314
|
-
selection: insertSelection,
|
|
54315
|
-
data: insertData,
|
|
54316
|
-
variables,
|
|
54317
|
-
parent: this.recordID,
|
|
54318
|
-
applyUpdates: true
|
|
54319
|
-
});
|
|
54320
|
-
}
|
|
54321
|
-
removeID(id, variables = {}) {
|
|
54322
|
-
if (!this.validateWhen()) {
|
|
54323
|
-
return;
|
|
54324
|
-
}
|
|
54325
|
-
let parentID = this.recordID;
|
|
54326
|
-
let targetID = id;
|
|
54327
|
-
let targetKey = this.key;
|
|
54328
|
-
if (this.connection) {
|
|
54329
|
-
const { value: embeddedConnection } = this.cache._internal_unstable.storage.get(
|
|
54330
|
-
this.recordID,
|
|
54331
|
-
this.key
|
|
54332
|
-
);
|
|
54333
|
-
if (!embeddedConnection) {
|
|
54334
|
-
return;
|
|
54335
|
-
}
|
|
54336
|
-
const embeddedConnectionID = embeddedConnection;
|
|
54337
|
-
const { value: edges } = this.cache._internal_unstable.storage.get(
|
|
54338
|
-
embeddedConnectionID,
|
|
54339
|
-
"edges"
|
|
54340
|
-
);
|
|
54341
|
-
for (const edge of flattenList(edges) || []) {
|
|
54342
|
-
if (!edge) {
|
|
54343
|
-
continue;
|
|
54344
|
-
}
|
|
54345
|
-
const edgeID = edge;
|
|
54346
|
-
const { value: nodeID } = this.cache._internal_unstable.storage.get(edgeID, "node");
|
|
54347
|
-
if (!nodeID) {
|
|
54348
|
-
continue;
|
|
54349
|
-
}
|
|
54350
|
-
if (nodeID === id) {
|
|
54351
|
-
targetID = edgeID;
|
|
54352
|
-
}
|
|
54353
|
-
}
|
|
54354
|
-
parentID = embeddedConnectionID;
|
|
54355
|
-
targetKey = "edges";
|
|
54356
|
-
}
|
|
54357
|
-
let value = this.cache._internal_unstable.storage.get(parentID, targetKey).value;
|
|
54358
|
-
if (!value || !value.includes(targetID)) {
|
|
54359
|
-
return;
|
|
54360
|
-
}
|
|
54361
|
-
const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
|
|
54362
|
-
this.cache._internal_unstable.subscriptions.remove(
|
|
54363
|
-
targetID,
|
|
54364
|
-
this.connection ? this.selection.fields.edges.selection : this.selection,
|
|
54365
|
-
subscribers,
|
|
54366
|
-
variables
|
|
54367
|
-
);
|
|
54368
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
54369
|
-
for (const spec of subscribers) {
|
|
54370
|
-
spec.set(
|
|
54371
|
-
this.cache._internal_unstable.getSelection({
|
|
54372
|
-
parent: spec.parentID || this.manager.rootID,
|
|
54373
|
-
selection: spec.selection,
|
|
54374
|
-
variables: spec.variables?.() || {}
|
|
54375
|
-
}).data
|
|
54376
|
-
);
|
|
54377
|
-
}
|
|
54378
|
-
return true;
|
|
54379
|
-
}
|
|
54380
|
-
remove(data, variables = {}) {
|
|
54381
|
-
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
54382
|
-
if (!targetID) {
|
|
54383
|
-
return;
|
|
54384
|
-
}
|
|
54385
|
-
return this.removeID(targetID, variables);
|
|
54386
|
-
}
|
|
54387
|
-
listType(data) {
|
|
54388
|
-
return data.__typename || this.type;
|
|
54389
|
-
}
|
|
54390
|
-
validateWhen(when) {
|
|
54391
|
-
let filters = when || this._when;
|
|
54392
|
-
let ok = true;
|
|
54393
|
-
if (filters) {
|
|
54394
|
-
const targets = this.filters;
|
|
54395
|
-
if (filters.must && targets) {
|
|
54396
|
-
ok = Object.entries(filters.must).reduce(
|
|
54397
|
-
(prev, [key, value]) => Boolean(prev && targets[key] == value),
|
|
54398
|
-
ok
|
|
54399
|
-
);
|
|
54400
|
-
}
|
|
54401
|
-
if (filters.must_not) {
|
|
54402
|
-
ok = !targets || Object.entries(filters.must_not).reduce(
|
|
54403
|
-
(prev, [key, value]) => Boolean(prev && targets[key] != value),
|
|
54404
|
-
ok
|
|
54405
|
-
);
|
|
54406
|
-
}
|
|
54407
|
-
}
|
|
54408
|
-
return ok;
|
|
54409
|
-
}
|
|
54410
|
-
toggleElement(selection2, data, variables = {}, where) {
|
|
54411
|
-
if (!this.remove(data, variables)) {
|
|
54412
|
-
this.addToList(selection2, data, variables, where);
|
|
54413
|
-
}
|
|
54414
|
-
}
|
|
54415
|
-
*[Symbol.iterator]() {
|
|
54416
|
-
let entries = [];
|
|
54417
|
-
let value = this.cache._internal_unstable.storage.get(this.recordID, this.key).value;
|
|
54418
|
-
if (!this.connection) {
|
|
54419
|
-
entries = flattenList(value);
|
|
54420
|
-
} else {
|
|
54421
|
-
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
54422
|
-
}
|
|
54423
|
-
for (let record2 of entries) {
|
|
54424
|
-
yield record2;
|
|
54425
|
-
}
|
|
54426
|
-
}
|
|
54427
|
-
};
|
|
54428
|
-
var ListCollection = class {
|
|
54429
|
-
lists = [];
|
|
54430
|
-
constructor(lists) {
|
|
54431
|
-
this.lists = lists;
|
|
54432
|
-
}
|
|
54433
|
-
append(...args) {
|
|
54434
|
-
this.lists.forEach((list) => list.append(...args));
|
|
54435
|
-
}
|
|
54436
|
-
prepend(...args) {
|
|
54437
|
-
this.lists.forEach((list) => list.prepend(...args));
|
|
54438
|
-
}
|
|
54439
|
-
addToList(...args) {
|
|
54440
|
-
this.lists.forEach((list) => list.addToList(...args));
|
|
54441
|
-
}
|
|
54442
|
-
removeID(...args) {
|
|
54443
|
-
this.lists.forEach((list) => list.removeID(...args));
|
|
54444
|
-
}
|
|
54445
|
-
remove(...args) {
|
|
54446
|
-
this.lists.forEach((list) => list.remove(...args));
|
|
54447
|
-
}
|
|
54448
|
-
toggleElement(...args) {
|
|
54449
|
-
this.lists.forEach((list) => list.toggleElement(...args));
|
|
54450
|
-
}
|
|
54451
|
-
when(when) {
|
|
54452
|
-
return new ListCollection(
|
|
54453
|
-
this.lists.filter((list) => {
|
|
54454
|
-
return list.validateWhen(when);
|
|
54455
|
-
})
|
|
54456
|
-
);
|
|
54457
|
-
}
|
|
54458
|
-
includes(key) {
|
|
54459
|
-
return !!this.lists.find((list) => list.key === key);
|
|
54460
|
-
}
|
|
54461
|
-
deleteListWithKey(key) {
|
|
54462
|
-
return this.lists = this.lists.filter((list) => list.key !== key);
|
|
54463
|
-
}
|
|
54464
|
-
*[Symbol.iterator]() {
|
|
54465
|
-
for (let list of this.lists) {
|
|
54466
|
-
for (const entry of list) {
|
|
54467
|
-
yield entry;
|
|
54468
|
-
}
|
|
54469
|
-
}
|
|
54470
|
-
}
|
|
54471
|
-
};
|
|
54472
|
-
|
|
54473
|
-
// src/runtime/cache/schema.ts
|
|
54474
|
-
var SchemaManager = class {
|
|
54475
|
-
cache;
|
|
54476
|
-
fieldTypes = {};
|
|
54477
|
-
constructor(cache) {
|
|
54478
|
-
this.cache = cache;
|
|
54479
|
-
}
|
|
54480
|
-
setFieldType({
|
|
54481
|
-
parent,
|
|
54482
|
-
key,
|
|
54483
|
-
type,
|
|
54484
|
-
nullable = false,
|
|
54485
|
-
link
|
|
54486
|
-
}) {
|
|
54487
|
-
let parensIndex = key.indexOf("(");
|
|
54488
|
-
if (parensIndex !== -1) {
|
|
54489
|
-
key = key.substring(0, parensIndex);
|
|
54490
|
-
}
|
|
54491
|
-
if (parent === rootID) {
|
|
54492
|
-
parent = "Query";
|
|
54493
|
-
} else if (parent.includes(":")) {
|
|
54494
|
-
parent = parent.substring(0, parent.indexOf(":"));
|
|
54495
|
-
}
|
|
54496
|
-
if (!this.fieldTypes[parent]) {
|
|
54497
|
-
this.fieldTypes[parent] = {};
|
|
54498
|
-
}
|
|
54499
|
-
this.fieldTypes[parent][key] = {
|
|
54500
|
-
type,
|
|
54501
|
-
nullable,
|
|
54502
|
-
link: !!link
|
|
54503
|
-
};
|
|
54504
|
-
}
|
|
54505
|
-
fieldType(type, field) {
|
|
54506
|
-
return this.fieldTypes[type]?.[field] || null;
|
|
54507
|
-
}
|
|
54508
|
-
get config() {
|
|
54509
|
-
return this.cache._internal_unstable.config;
|
|
54510
|
-
}
|
|
54511
|
-
};
|
|
54512
|
-
|
|
54513
|
-
// src/runtime/cache/storage.ts
|
|
54514
|
-
var InMemoryStorage = class {
|
|
54515
|
-
data;
|
|
54516
|
-
idCount = 0;
|
|
54517
|
-
rank = 0;
|
|
54518
|
-
constructor() {
|
|
54519
|
-
this.data = [];
|
|
54520
|
-
}
|
|
54521
|
-
get layerCount() {
|
|
54522
|
-
return this.data.length;
|
|
54523
|
-
}
|
|
54524
|
-
get nextRank() {
|
|
54525
|
-
return this.rank++;
|
|
54526
|
-
}
|
|
54527
|
-
createLayer(optimistic = false) {
|
|
54528
|
-
const layer = new Layer(this.idCount++);
|
|
54529
|
-
layer.optimistic = optimistic;
|
|
54530
|
-
this.data.push(layer);
|
|
54531
|
-
return layer;
|
|
54532
|
-
}
|
|
54533
|
-
insert(id, field, location, target) {
|
|
54534
|
-
return this.topLayer.insert(id, field, location, target);
|
|
54535
|
-
}
|
|
54536
|
-
remove(id, field, target) {
|
|
54537
|
-
return this.topLayer.remove(id, field, target);
|
|
54538
|
-
}
|
|
54539
|
-
delete(id) {
|
|
54540
|
-
return this.topLayer.delete(id);
|
|
54541
|
-
}
|
|
54542
|
-
deleteField(id, field) {
|
|
54543
|
-
return this.topLayer.deleteField(id, field);
|
|
54544
|
-
}
|
|
54545
|
-
getLayer(id) {
|
|
54546
|
-
for (const layer of this.data) {
|
|
54547
|
-
if (layer.id === id) {
|
|
54548
|
-
return layer;
|
|
54549
|
-
}
|
|
54550
|
-
}
|
|
54551
|
-
throw new Error("Could not find layer with id: " + id);
|
|
54552
|
-
}
|
|
54553
|
-
replaceID(replacement) {
|
|
54554
|
-
for (const layer of this.data) {
|
|
54555
|
-
layer.replaceID(replacement);
|
|
54556
|
-
}
|
|
54557
|
-
}
|
|
54558
|
-
get(id, field) {
|
|
54559
|
-
const operations = {
|
|
54560
|
-
[OperationKind.insert]: {
|
|
54561
|
-
[OperationLocation.start]: [],
|
|
54562
|
-
[OperationLocation.end]: []
|
|
54563
|
-
},
|
|
54564
|
-
[OperationKind.remove]: /* @__PURE__ */ new Set()
|
|
54565
|
-
};
|
|
54566
|
-
const layerIDs = [];
|
|
54567
|
-
for (let i = this.data.length - 1; i >= 0; i--) {
|
|
54568
|
-
const layer = this.data[i];
|
|
54569
|
-
const [layerValue, kind] = layer.get(id, field);
|
|
54570
|
-
const layerOperations = layer.getOperations(id, field) || [];
|
|
54571
|
-
layer.deletedIDs.forEach((v) => {
|
|
54572
|
-
if (layer.operations[v]?.undoDeletesInList?.includes(field)) {
|
|
54573
|
-
return;
|
|
54574
|
-
}
|
|
54575
|
-
operations.remove.add(v);
|
|
54576
|
-
});
|
|
54577
|
-
if (typeof layerValue === "undefined" && layerOperations.length === 0) {
|
|
54578
|
-
if (layer.deletedIDs.size > 0) {
|
|
54579
|
-
layerIDs.push(layer.id);
|
|
54580
|
-
}
|
|
54581
|
-
continue;
|
|
54582
|
-
}
|
|
54583
|
-
if (typeof layerValue !== "undefined" && !Array.isArray(layerValue)) {
|
|
54584
|
-
return {
|
|
54585
|
-
value: layerValue,
|
|
54586
|
-
kind,
|
|
54587
|
-
displayLayers: [layer.id]
|
|
54588
|
-
};
|
|
54589
|
-
}
|
|
54590
|
-
layerIDs.push(layer.id);
|
|
54591
|
-
if (layerOperations.length > 0) {
|
|
54592
|
-
for (const op of layerOperations) {
|
|
54593
|
-
if (isRemoveOperation(op)) {
|
|
54594
|
-
operations.remove.add(op.id);
|
|
54595
|
-
}
|
|
54596
|
-
if (isInsertOperation(op)) {
|
|
54597
|
-
operations.insert[op.location].unshift(op.id);
|
|
54598
|
-
}
|
|
54599
|
-
if (isDeleteOperation(op)) {
|
|
54600
|
-
return {
|
|
54601
|
-
value: void 0,
|
|
54602
|
-
kind: "unknown",
|
|
54603
|
-
displayLayers: []
|
|
54604
|
-
};
|
|
54605
|
-
}
|
|
54606
|
-
}
|
|
54607
|
-
}
|
|
54608
|
-
if (typeof layerValue === "undefined") {
|
|
54609
|
-
continue;
|
|
54610
|
-
}
|
|
54611
|
-
if (!operations.remove.size && !operations.insert.start.length && !operations.insert.end.length) {
|
|
54612
|
-
return { value: layerValue, displayLayers: layerIDs, kind: "link" };
|
|
54613
|
-
}
|
|
54614
|
-
return {
|
|
54615
|
-
value: [...operations.insert.start, ...layerValue, ...operations.insert.end].filter(
|
|
54616
|
-
(value) => !operations.remove.has(value)
|
|
54617
|
-
),
|
|
54618
|
-
displayLayers: layerIDs,
|
|
54619
|
-
kind
|
|
54620
|
-
};
|
|
54621
|
-
}
|
|
54622
|
-
return {
|
|
54623
|
-
value: void 0,
|
|
54624
|
-
kind: "unknown",
|
|
54625
|
-
displayLayers: []
|
|
54626
|
-
};
|
|
54627
|
-
}
|
|
54628
|
-
writeLink(id, field, value) {
|
|
54629
|
-
return this.topLayer.writeLink(id, field, value);
|
|
54630
|
-
}
|
|
54631
|
-
writeField(id, field, value) {
|
|
54632
|
-
return this.topLayer.writeField(id, field, value);
|
|
54633
|
-
}
|
|
54634
|
-
resolveLayer(id) {
|
|
54635
|
-
let startingIndex = null;
|
|
54636
|
-
for (const [index, layer] of this.data.entries()) {
|
|
54637
|
-
if (layer.id !== id) {
|
|
54638
|
-
continue;
|
|
54639
|
-
}
|
|
54640
|
-
startingIndex = index - 1;
|
|
54641
|
-
this.data[index].optimistic = false;
|
|
54642
|
-
break;
|
|
54643
|
-
}
|
|
54644
|
-
if (startingIndex === null) {
|
|
54645
|
-
throw new Error("could not find layer with id: " + id);
|
|
54646
|
-
}
|
|
54647
|
-
if (startingIndex === -1) {
|
|
54648
|
-
startingIndex = 0;
|
|
54649
|
-
}
|
|
54650
|
-
if (this.data[startingIndex].optimistic) {
|
|
54651
|
-
startingIndex++;
|
|
54652
|
-
}
|
|
54653
|
-
const baseLayer = this.data[startingIndex];
|
|
54654
|
-
let layerIndex = startingIndex;
|
|
54655
|
-
while (layerIndex < this.data.length) {
|
|
54656
|
-
const layer = this.data[layerIndex++];
|
|
54657
|
-
if (layer.optimistic) {
|
|
54658
|
-
layerIndex--;
|
|
54659
|
-
break;
|
|
54660
|
-
}
|
|
54661
|
-
baseLayer.writeLayer(layer);
|
|
54662
|
-
}
|
|
54663
|
-
this.data.splice(startingIndex + 1, layerIndex - startingIndex - 1);
|
|
54664
|
-
}
|
|
54665
|
-
get topLayer() {
|
|
54666
|
-
if (this.data.length === 0) {
|
|
54667
|
-
this.createLayer();
|
|
54668
|
-
}
|
|
54669
|
-
if (this.data[this.data.length - 1]?.optimistic) {
|
|
54670
|
-
this.createLayer();
|
|
54671
|
-
}
|
|
54672
|
-
return this.data[this.data.length - 1];
|
|
54673
|
-
}
|
|
54674
|
-
};
|
|
54675
|
-
var Layer = class {
|
|
54676
|
-
id;
|
|
54677
|
-
optimistic = false;
|
|
54678
|
-
fields = {};
|
|
54679
|
-
links = {};
|
|
54680
|
-
operations = {};
|
|
54681
|
-
deletedIDs = /* @__PURE__ */ new Set();
|
|
54682
|
-
constructor(id) {
|
|
54683
|
-
this.id = id;
|
|
54684
|
-
}
|
|
54685
|
-
get(id, field) {
|
|
54686
|
-
if (typeof this.links[id]?.[field] !== "undefined") {
|
|
54687
|
-
return [this.links[id][field], "link"];
|
|
54688
|
-
}
|
|
54689
|
-
return [this.fields[id]?.[field], "scalar"];
|
|
54690
|
-
}
|
|
54691
|
-
getOperations(id, field) {
|
|
54692
|
-
if (this.operations[id]?.deleted) {
|
|
54693
|
-
return [
|
|
54694
|
-
{
|
|
54695
|
-
kind: OperationKind.delete,
|
|
54696
|
-
target: id
|
|
54697
|
-
}
|
|
54698
|
-
];
|
|
54699
|
-
}
|
|
54700
|
-
if (this.operations[id]?.fields?.[field]) {
|
|
54701
|
-
return this.operations[id].fields[field];
|
|
54702
|
-
}
|
|
54703
|
-
}
|
|
54704
|
-
writeField(id, field, value) {
|
|
54705
|
-
this.fields[id] = {
|
|
54706
|
-
...this.fields[id],
|
|
54707
|
-
[field]: value
|
|
54708
|
-
};
|
|
54709
|
-
return this.id;
|
|
54710
|
-
}
|
|
54711
|
-
writeLink(id, field, value) {
|
|
54712
|
-
const valueList = Array.isArray(value) ? value : [value];
|
|
54713
|
-
for (const value2 of flattenList(valueList)) {
|
|
54714
|
-
if (!value2) {
|
|
54715
|
-
continue;
|
|
54716
|
-
}
|
|
54717
|
-
const fieldOperations = this.operations[id]?.fields[field];
|
|
54718
|
-
if (this.operations[value2]?.deleted || this.deletedIDs.has(value2)) {
|
|
54719
|
-
this.operations[value2] = {
|
|
54720
|
-
...this.operations[value2],
|
|
54721
|
-
undoDeletesInList: [...this.operations[id]?.undoDeletesInList || [], field]
|
|
54722
|
-
};
|
|
54723
|
-
} else if (value2 && fieldOperations?.length > 0) {
|
|
54724
|
-
this.operations[id].fields[field] = fieldOperations.filter(
|
|
54725
|
-
(op) => op.kind !== "remove" || op.id !== value2
|
|
54726
|
-
);
|
|
54727
|
-
}
|
|
54728
|
-
}
|
|
54729
|
-
this.links[id] = {
|
|
54730
|
-
...this.links[id],
|
|
54731
|
-
[field]: value
|
|
54732
|
-
};
|
|
54733
|
-
return this.id;
|
|
54734
|
-
}
|
|
54735
|
-
isDisplayLayer(displayLayers) {
|
|
54736
|
-
return displayLayers.length === 0 || displayLayers.includes(this.id) || Math.max(...displayLayers) < this.id;
|
|
54737
|
-
}
|
|
54738
|
-
clear() {
|
|
54739
|
-
this.links = {};
|
|
54740
|
-
this.fields = {};
|
|
54741
|
-
this.operations = {};
|
|
54742
|
-
this.deletedIDs = /* @__PURE__ */ new Set();
|
|
54743
|
-
}
|
|
54744
|
-
replaceID({ from, to }) {
|
|
54745
|
-
this.fields[to] = this.fields[from];
|
|
54746
|
-
this.links[to] = this.links[from];
|
|
54747
|
-
this.operations[to] = this.operations[from] || { fields: {} };
|
|
54748
|
-
if (this.deletedIDs.has(from)) {
|
|
54749
|
-
this.deletedIDs.add(to);
|
|
54750
|
-
}
|
|
54751
|
-
}
|
|
54752
|
-
removeUndefinedFields() {
|
|
54753
|
-
for (const [id, fields] of Object.entries(this.fields)) {
|
|
54754
|
-
for (const [field, value] of Object.entries(fields)) {
|
|
54755
|
-
if (typeof value === "undefined") {
|
|
54756
|
-
try {
|
|
54757
|
-
delete this.fields[id][field];
|
|
54758
|
-
} catch {
|
|
54759
|
-
}
|
|
54760
|
-
try {
|
|
54761
|
-
delete this.links[id][field];
|
|
54762
|
-
} catch {
|
|
54763
|
-
}
|
|
54764
|
-
}
|
|
54765
|
-
}
|
|
54766
|
-
if (Object.keys(fields || {}).length === 0) {
|
|
54767
|
-
delete this.fields[id];
|
|
54768
|
-
}
|
|
54769
|
-
if (Object.keys(this.links[id] || {}).length === 0) {
|
|
54770
|
-
delete this.links[id];
|
|
54771
|
-
}
|
|
54772
|
-
}
|
|
54773
|
-
}
|
|
54774
|
-
delete(id) {
|
|
54775
|
-
this.operations = {
|
|
54776
|
-
...this.operations,
|
|
54777
|
-
[id]: {
|
|
54778
|
-
...this.operations[id],
|
|
54779
|
-
deleted: true,
|
|
54780
|
-
undoDeletesInList: []
|
|
54781
|
-
}
|
|
54782
|
-
};
|
|
54783
|
-
this.deletedIDs.add(id);
|
|
54784
|
-
}
|
|
54785
|
-
deleteField(id, field) {
|
|
54786
|
-
this.fields[id] = {
|
|
54787
|
-
...this.fields[id],
|
|
54788
|
-
[field]: void 0
|
|
54789
|
-
};
|
|
54790
|
-
}
|
|
54791
|
-
insert(id, field, where, target) {
|
|
54792
|
-
this.addFieldOperation(id, field, {
|
|
54793
|
-
kind: OperationKind.insert,
|
|
54794
|
-
id: target,
|
|
54795
|
-
location: where
|
|
54796
|
-
});
|
|
54797
|
-
}
|
|
54798
|
-
remove(id, field, target) {
|
|
54799
|
-
this.addFieldOperation(id, field, {
|
|
54800
|
-
kind: OperationKind.remove,
|
|
54801
|
-
id: target
|
|
54802
|
-
});
|
|
54803
|
-
}
|
|
54804
|
-
writeLayer(layer) {
|
|
54805
|
-
if (layer.id === this.id) {
|
|
54806
|
-
return;
|
|
54807
|
-
}
|
|
54808
|
-
for (const [id, ops] of Object.entries(layer.operations)) {
|
|
54809
|
-
const fields = {};
|
|
54810
|
-
for (const opMap of [this.operations[id], layer.operations[id]].filter(Boolean)) {
|
|
54811
|
-
for (const [fieldName, operations] of Object.entries(opMap.fields || {})) {
|
|
54812
|
-
fields[fieldName] = [...fields[fieldName] || [], ...operations];
|
|
54813
|
-
}
|
|
54814
|
-
}
|
|
54815
|
-
if (Object.keys(fields).length > 0) {
|
|
54816
|
-
this.operations[id] = {
|
|
54817
|
-
...this.operations[id],
|
|
54818
|
-
fields
|
|
54819
|
-
};
|
|
54820
|
-
}
|
|
54821
|
-
if (ops?.deleted) {
|
|
54822
|
-
delete this.fields[id];
|
|
54823
|
-
delete this.links[id];
|
|
54824
|
-
}
|
|
54825
|
-
}
|
|
54826
|
-
for (const [id, values] of Object.entries(layer.fields)) {
|
|
54827
|
-
if (!values) {
|
|
54828
|
-
continue;
|
|
54829
|
-
}
|
|
54830
|
-
for (const [field, value] of Object.entries(values)) {
|
|
54831
|
-
this.writeField(id, field, value);
|
|
54832
|
-
}
|
|
54833
|
-
}
|
|
54834
|
-
for (const [id, values] of Object.entries(layer.links)) {
|
|
54835
|
-
if (!values) {
|
|
54836
|
-
continue;
|
|
54837
|
-
}
|
|
54838
|
-
for (const [field, value] of Object.entries(values)) {
|
|
54839
|
-
this.writeLink(id, field, value);
|
|
54840
|
-
}
|
|
54841
|
-
}
|
|
54842
|
-
layer.deletedIDs.forEach((v) => this.deletedIDs.add(v));
|
|
54843
|
-
}
|
|
54844
|
-
addFieldOperation(id, field, operation) {
|
|
54845
|
-
this.operations = {
|
|
54846
|
-
...this.operations,
|
|
54847
|
-
[id]: {
|
|
54848
|
-
...this.operations[id],
|
|
54849
|
-
fields: {
|
|
54850
|
-
[field]: [...this.operations[id]?.fields[field] || [], operation]
|
|
54851
|
-
}
|
|
54852
|
-
}
|
|
54853
|
-
};
|
|
54854
|
-
}
|
|
54855
|
-
};
|
|
54856
|
-
function isDeleteOperation(value) {
|
|
54857
|
-
return !!value && value.kind === OperationKind.delete;
|
|
54858
|
-
}
|
|
54859
|
-
function isInsertOperation(value) {
|
|
54860
|
-
return !!value && value.kind === OperationKind.insert;
|
|
54861
|
-
}
|
|
54862
|
-
function isRemoveOperation(value) {
|
|
54863
|
-
return !!value && value.kind === OperationKind.remove;
|
|
54864
|
-
}
|
|
54865
|
-
var OperationLocation = /* @__PURE__ */ ((OperationLocation2) => {
|
|
54866
|
-
OperationLocation2["start"] = "start";
|
|
54867
|
-
OperationLocation2["end"] = "end";
|
|
54868
|
-
return OperationLocation2;
|
|
54869
|
-
})(OperationLocation || {});
|
|
54870
|
-
var OperationKind = /* @__PURE__ */ ((OperationKind2) => {
|
|
54871
|
-
OperationKind2["delete"] = "delete";
|
|
54872
|
-
OperationKind2["insert"] = "insert";
|
|
54873
|
-
OperationKind2["remove"] = "remove";
|
|
54874
|
-
return OperationKind2;
|
|
54875
|
-
})(OperationKind || {});
|
|
54876
|
-
|
|
54877
|
-
// src/runtime/cache/subscription.ts
|
|
54878
|
-
var InMemorySubscriptions = class {
|
|
54879
|
-
cache;
|
|
54880
|
-
constructor(cache) {
|
|
54881
|
-
this.cache = cache;
|
|
54882
|
-
}
|
|
54883
|
-
subscribers = {};
|
|
54884
|
-
referenceCounts = {};
|
|
54885
|
-
keyVersions = {};
|
|
54886
|
-
add({
|
|
54887
|
-
parent,
|
|
54888
|
-
spec,
|
|
54889
|
-
selection: selection2,
|
|
54890
|
-
variables,
|
|
54891
|
-
parentType
|
|
54892
|
-
}) {
|
|
54893
|
-
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
54894
|
-
let targetSelection = getFieldsForType(selection2, __typename);
|
|
54895
|
-
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
54896
|
-
const { keyRaw, selection: innerSelection, type } = fieldSelection;
|
|
54897
|
-
const key = evaluateKey(keyRaw, variables);
|
|
54898
|
-
this.addFieldSubscription({
|
|
54899
|
-
id: parent,
|
|
54900
|
-
key,
|
|
54901
|
-
field: fieldSelection,
|
|
54902
|
-
spec,
|
|
54903
|
-
parentType: parentType || spec.rootType,
|
|
54904
|
-
variables
|
|
54905
|
-
});
|
|
54906
|
-
if (innerSelection) {
|
|
54907
|
-
const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
|
|
54908
|
-
parent,
|
|
54909
|
-
key
|
|
54910
|
-
);
|
|
54911
|
-
let children = !Array.isArray(linkedRecord) ? [linkedRecord] : flattenList(linkedRecord) || [];
|
|
54912
|
-
for (const child of children) {
|
|
54913
|
-
if (!child) {
|
|
54914
|
-
continue;
|
|
54915
|
-
}
|
|
54916
|
-
this.add({
|
|
54917
|
-
parent: child,
|
|
54918
|
-
spec,
|
|
54919
|
-
selection: innerSelection,
|
|
54920
|
-
variables,
|
|
54921
|
-
parentType: type
|
|
54922
|
-
});
|
|
54923
|
-
}
|
|
54924
|
-
}
|
|
54925
|
-
}
|
|
54926
|
-
}
|
|
54927
|
-
addFieldSubscription({
|
|
54928
|
-
id,
|
|
54929
|
-
key,
|
|
54930
|
-
field,
|
|
54931
|
-
spec,
|
|
54932
|
-
parentType,
|
|
54933
|
-
variables
|
|
54934
|
-
}) {
|
|
54935
|
-
if (!this.subscribers[id]) {
|
|
54936
|
-
this.subscribers[id] = {};
|
|
54937
|
-
}
|
|
54938
|
-
if (!this.subscribers[id][key]) {
|
|
54939
|
-
this.subscribers[id][key] = [];
|
|
54940
|
-
}
|
|
54941
|
-
if (!this.keyVersions[key]) {
|
|
54942
|
-
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
54943
|
-
}
|
|
54944
|
-
this.keyVersions[key].add(key);
|
|
54945
|
-
if (!this.subscribers[id][key].map(({ set }) => set).includes(spec.set)) {
|
|
54946
|
-
this.subscribers[id][key].push(spec);
|
|
54947
|
-
}
|
|
54948
|
-
if (!this.referenceCounts[id]) {
|
|
54949
|
-
this.referenceCounts[id] = {};
|
|
54950
|
-
}
|
|
54951
|
-
if (!this.referenceCounts[id][key]) {
|
|
54952
|
-
this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
|
|
54953
|
-
}
|
|
54954
|
-
const counts = this.referenceCounts[id][key];
|
|
54955
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
54956
|
-
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
54957
|
-
const { selection: selection2, list, filters } = field;
|
|
54958
|
-
if (selection2 && list) {
|
|
54959
|
-
this.cache._internal_unstable.lists.add({
|
|
54960
|
-
name: list.name,
|
|
54961
|
-
connection: list.connection,
|
|
54962
|
-
recordID: id,
|
|
54963
|
-
recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
|
|
54964
|
-
listType: list.type,
|
|
54965
|
-
key,
|
|
54966
|
-
selection: selection2,
|
|
54967
|
-
filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
|
|
54968
|
-
return {
|
|
54969
|
-
...acc,
|
|
54970
|
-
[key2]: kind !== "Variable" ? value : variables[value]
|
|
54971
|
-
};
|
|
54972
|
-
}, {})
|
|
54973
|
-
});
|
|
54974
|
-
}
|
|
54975
|
-
}
|
|
54976
|
-
addMany({
|
|
54977
|
-
parent,
|
|
54978
|
-
selection: selection2,
|
|
54979
|
-
variables,
|
|
54980
|
-
subscribers,
|
|
54981
|
-
parentType
|
|
54982
|
-
}) {
|
|
54983
|
-
let targetSelection = getFieldsForType(selection2, parentType);
|
|
54984
|
-
for (const fieldSelection of Object.values(targetSelection)) {
|
|
54985
|
-
const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
|
|
54986
|
-
const key = evaluateKey(keyRaw, variables);
|
|
54987
|
-
for (const spec of subscribers) {
|
|
54988
|
-
this.addFieldSubscription({
|
|
54989
|
-
id: parent,
|
|
54990
|
-
key,
|
|
54991
|
-
field: fieldSelection,
|
|
54992
|
-
spec,
|
|
54993
|
-
parentType,
|
|
54994
|
-
variables
|
|
54995
|
-
});
|
|
54996
|
-
}
|
|
54997
|
-
if (innerSelection) {
|
|
54998
|
-
const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
|
|
54999
|
-
const children = !Array.isArray(link) ? [link] : flattenList(link);
|
|
55000
|
-
for (const linkedRecord of children) {
|
|
55001
|
-
if (!linkedRecord) {
|
|
55002
|
-
continue;
|
|
55003
|
-
}
|
|
55004
|
-
this.addMany({
|
|
55005
|
-
parent: linkedRecord,
|
|
55006
|
-
selection: innerSelection,
|
|
55007
|
-
variables,
|
|
55008
|
-
subscribers,
|
|
55009
|
-
parentType: linkedType
|
|
55010
|
-
});
|
|
55011
|
-
}
|
|
55012
|
-
}
|
|
55013
|
-
}
|
|
55014
|
-
}
|
|
55015
|
-
get(id, field) {
|
|
55016
|
-
return this.subscribers[id]?.[field] || [];
|
|
55017
|
-
}
|
|
55018
|
-
remove(id, selection2, targets, variables, visited = []) {
|
|
55019
|
-
visited.push(id);
|
|
55020
|
-
const linkedIDs = [];
|
|
55021
|
-
for (const fieldSelection of Object.values(selection2.fields || {})) {
|
|
55022
|
-
const key = evaluateKey(fieldSelection.keyRaw, variables);
|
|
55023
|
-
this.removeSubscribers(id, key, targets);
|
|
55024
|
-
if (!fieldSelection.selection?.fields) {
|
|
55025
|
-
continue;
|
|
55026
|
-
}
|
|
55027
|
-
const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
|
|
55028
|
-
const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
|
|
55029
|
-
for (const link of links) {
|
|
55030
|
-
if (link !== null) {
|
|
55031
|
-
linkedIDs.push([link, fieldSelection.selection || {}]);
|
|
55032
|
-
}
|
|
55033
|
-
}
|
|
55034
|
-
}
|
|
55035
|
-
for (const [linkedRecordID, linkFields] of linkedIDs) {
|
|
55036
|
-
this.remove(linkedRecordID, linkFields, targets, visited);
|
|
55037
|
-
}
|
|
55038
|
-
}
|
|
55039
|
-
removeSubscribers(id, fieldName, specs) {
|
|
55040
|
-
let targets = [];
|
|
55041
|
-
for (const spec of specs) {
|
|
55042
|
-
if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
|
|
55043
|
-
continue;
|
|
55044
|
-
}
|
|
55045
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
55046
|
-
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
55047
|
-
counts.set(spec.set, newVal);
|
|
55048
|
-
if (newVal <= 0) {
|
|
55049
|
-
targets.push(spec.set);
|
|
55050
|
-
counts.delete(spec.set);
|
|
55051
|
-
}
|
|
55052
|
-
}
|
|
55053
|
-
if (this.subscribers[id]) {
|
|
55054
|
-
this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
|
|
55055
|
-
({ set }) => !targets.includes(set)
|
|
55056
|
-
);
|
|
55057
|
-
}
|
|
55058
|
-
}
|
|
55059
|
-
removeAllSubscribers(id, targets, visited = []) {
|
|
55060
|
-
visited.push(id);
|
|
55061
|
-
for (const field of Object.keys(this.subscribers[id] || [])) {
|
|
55062
|
-
const subscribers = targets || this.subscribers[id][field];
|
|
55063
|
-
this.removeSubscribers(id, field, subscribers);
|
|
55064
|
-
const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
|
|
55065
|
-
if (kind === "scalar") {
|
|
55066
|
-
continue;
|
|
55067
|
-
}
|
|
55068
|
-
const nextTargets = Array.isArray(value) ? flattenList(value) : [value];
|
|
55069
|
-
for (const id2 of nextTargets) {
|
|
55070
|
-
if (visited.includes(id2)) {
|
|
55071
|
-
continue;
|
|
55072
|
-
}
|
|
55073
|
-
this.removeAllSubscribers(id2, subscribers, visited);
|
|
55074
|
-
}
|
|
55075
|
-
}
|
|
55076
|
-
}
|
|
55077
|
-
};
|
|
55078
|
-
|
|
55079
|
-
// src/runtime/cache/cache.ts
|
|
55080
|
-
var Cache3 = class {
|
|
55081
|
-
_internal_unstable;
|
|
55082
|
-
constructor(config2) {
|
|
55083
|
-
this._internal_unstable = new CacheInternal({
|
|
55084
|
-
cache: this,
|
|
55085
|
-
storage: new InMemoryStorage(),
|
|
55086
|
-
subscriptions: new InMemorySubscriptions(this),
|
|
55087
|
-
lists: new ListManager(this, rootID),
|
|
55088
|
-
lifetimes: new GarbageCollector(this),
|
|
55089
|
-
schema: new SchemaManager(this)
|
|
55090
|
-
});
|
|
55091
|
-
if (config2) {
|
|
55092
|
-
this.setConfig(defaultConfigValues(config2));
|
|
55093
|
-
}
|
|
55094
|
-
}
|
|
55095
|
-
write({
|
|
55096
|
-
layer: layerID,
|
|
55097
|
-
notifySubscribers = [],
|
|
55098
|
-
...args
|
|
55099
|
-
}) {
|
|
55100
|
-
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
55101
|
-
const subscribers = this._internal_unstable.writeSelection({ ...args, layer });
|
|
55102
|
-
const notified = [];
|
|
55103
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
55104
|
-
if (!notified.includes(spec.set)) {
|
|
55105
|
-
notified.push(spec.set);
|
|
55106
|
-
spec.set(
|
|
55107
|
-
this._internal_unstable.getSelection({
|
|
55108
|
-
parent: spec.parentID || rootID,
|
|
55109
|
-
selection: spec.selection,
|
|
55110
|
-
variables: spec.variables?.() || {}
|
|
55111
|
-
}).data
|
|
55112
|
-
);
|
|
55113
|
-
}
|
|
55114
|
-
}
|
|
55115
|
-
return subscribers;
|
|
55116
|
-
}
|
|
55117
|
-
read(...args) {
|
|
55118
|
-
const { data, partial, hasData } = this._internal_unstable.getSelection(...args);
|
|
55119
|
-
if (!hasData) {
|
|
55120
|
-
return { data: null, partial: false };
|
|
55121
|
-
}
|
|
55122
|
-
return {
|
|
55123
|
-
data,
|
|
55124
|
-
partial
|
|
55125
|
-
};
|
|
55126
|
-
}
|
|
55127
|
-
subscribe(spec, variables = {}) {
|
|
55128
|
-
return this._internal_unstable.subscriptions.add({
|
|
55129
|
-
parent: spec.parentID || rootID,
|
|
55130
|
-
spec,
|
|
55131
|
-
selection: spec.selection,
|
|
55132
|
-
variables
|
|
55133
|
-
});
|
|
55134
|
-
}
|
|
55135
|
-
unsubscribe(spec, variables = {}) {
|
|
55136
|
-
return this._internal_unstable.subscriptions.remove(
|
|
55137
|
-
spec.parentID || rootID,
|
|
55138
|
-
spec.selection,
|
|
55139
|
-
[spec],
|
|
55140
|
-
variables
|
|
55141
|
-
);
|
|
55142
|
-
}
|
|
55143
|
-
list(name2, parentID, allLists) {
|
|
55144
|
-
const handler = this._internal_unstable.lists.get(name2, parentID, allLists);
|
|
55145
|
-
if (!handler) {
|
|
55146
|
-
throw new Error(
|
|
55147
|
-
`Cannot find list with name: ${name2}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
|
|
55148
|
-
);
|
|
55149
|
-
}
|
|
55150
|
-
return handler;
|
|
55151
|
-
}
|
|
55152
|
-
delete(id) {
|
|
55153
|
-
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
55154
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
55155
|
-
this._internal_unstable.storage.delete(id);
|
|
55156
|
-
}
|
|
55157
|
-
setConfig(config2) {
|
|
55158
|
-
this._internal_unstable.setConfig(config2);
|
|
55159
|
-
}
|
|
55160
|
-
};
|
|
55161
|
-
var CacheInternal = class {
|
|
55162
|
-
_disabled = false;
|
|
55163
|
-
config = defaultConfigValues({
|
|
55164
|
-
plugins: {
|
|
55165
|
-
"houdini-svelte": {
|
|
55166
|
-
client: ""
|
|
55167
|
-
}
|
|
55168
|
-
}
|
|
55169
|
-
});
|
|
55170
|
-
storage;
|
|
55171
|
-
subscriptions;
|
|
55172
|
-
lists;
|
|
55173
|
-
cache;
|
|
55174
|
-
lifetimes;
|
|
55175
|
-
schema;
|
|
55176
|
-
constructor({
|
|
55177
|
-
storage,
|
|
55178
|
-
subscriptions,
|
|
55179
|
-
lists,
|
|
55180
|
-
cache,
|
|
55181
|
-
lifetimes,
|
|
55182
|
-
schema
|
|
55183
|
-
}) {
|
|
55184
|
-
this.storage = storage;
|
|
55185
|
-
this.subscriptions = subscriptions;
|
|
55186
|
-
this.lists = lists;
|
|
55187
|
-
this.cache = cache;
|
|
55188
|
-
this.lifetimes = lifetimes;
|
|
55189
|
-
this.schema = schema;
|
|
55190
|
-
this._disabled = typeof globalThis.window === "undefined";
|
|
55191
|
-
try {
|
|
55192
|
-
if (process.env.HOUDINI_TEST === "true") {
|
|
55193
|
-
this._disabled = false;
|
|
55194
|
-
}
|
|
55195
|
-
} catch {
|
|
55196
|
-
}
|
|
55197
|
-
}
|
|
55198
|
-
setConfig(config2) {
|
|
55199
|
-
this.config = config2;
|
|
55200
|
-
}
|
|
55201
|
-
writeSelection({
|
|
55202
|
-
data,
|
|
55203
|
-
selection: selection2,
|
|
55204
|
-
variables = {},
|
|
55205
|
-
parent = rootID,
|
|
55206
|
-
applyUpdates = false,
|
|
55207
|
-
layer,
|
|
55208
|
-
toNotify = [],
|
|
55209
|
-
forceNotify
|
|
55210
|
-
}) {
|
|
55211
|
-
if (this._disabled) {
|
|
55212
|
-
return [];
|
|
55213
|
-
}
|
|
55214
|
-
let targetSelection = getFieldsForType(selection2, data["__typename"]);
|
|
55215
|
-
for (const [field, value] of Object.entries(data)) {
|
|
55216
|
-
if (!selection2 || !targetSelection[field]) {
|
|
55217
|
-
throw new Error(
|
|
55218
|
-
"Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
|
|
55219
|
-
);
|
|
55220
|
-
}
|
|
55221
|
-
let {
|
|
55222
|
-
type: linkedType,
|
|
55223
|
-
keyRaw,
|
|
55224
|
-
selection: fieldSelection,
|
|
55225
|
-
operations,
|
|
55226
|
-
abstract: isAbstract,
|
|
55227
|
-
update,
|
|
55228
|
-
nullable
|
|
55229
|
-
} = targetSelection[field];
|
|
55230
|
-
const key = evaluateKey(keyRaw, variables);
|
|
55231
|
-
this.schema.setFieldType({
|
|
55232
|
-
parent,
|
|
55233
|
-
key: keyRaw,
|
|
55234
|
-
type: linkedType,
|
|
55235
|
-
nullable,
|
|
55236
|
-
link: !!fieldSelection
|
|
55237
|
-
});
|
|
55238
|
-
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
55239
|
-
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
55240
|
-
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
55241
|
-
if (displayLayer) {
|
|
55242
|
-
this.lifetimes.resetLifetime(parent, key);
|
|
55243
|
-
}
|
|
55244
|
-
if (!fieldSelection) {
|
|
55245
|
-
let newValue = value;
|
|
55246
|
-
if (Array.isArray(value) && applyUpdates && update) {
|
|
55247
|
-
if (update === "append") {
|
|
55248
|
-
newValue = (previousValue || []).concat(value);
|
|
55249
|
-
} else if (update === "prepend") {
|
|
55250
|
-
newValue = value.concat(previousValue || []);
|
|
55251
|
-
}
|
|
55252
|
-
}
|
|
55253
|
-
const valueChanged = !deepEquals(newValue, previousValue);
|
|
55254
|
-
if (displayLayer && (valueChanged || forceNotify)) {
|
|
55255
|
-
toNotify.push(...currentSubscribers);
|
|
55256
|
-
}
|
|
55257
|
-
layer.writeField(parent, key, newValue);
|
|
55258
|
-
} else if (value === null) {
|
|
55259
|
-
if (previousValue === null) {
|
|
55260
|
-
continue;
|
|
55261
|
-
}
|
|
55262
|
-
const previousLinks = flattenList([previousValue]);
|
|
55263
|
-
for (const link of previousLinks) {
|
|
55264
|
-
this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
|
|
55265
|
-
}
|
|
55266
|
-
layer.writeLink(parent, key, null);
|
|
55267
|
-
toNotify.push(...currentSubscribers);
|
|
55268
|
-
} else if (value instanceof Object && !Array.isArray(value)) {
|
|
55269
|
-
if (isAbstract) {
|
|
55270
|
-
if (!value.__typename) {
|
|
55271
|
-
throw new Error(
|
|
55272
|
-
"Encountered interface type without __typename in the payload"
|
|
55273
|
-
);
|
|
55274
|
-
}
|
|
55275
|
-
linkedType = value.__typename;
|
|
55276
|
-
}
|
|
55277
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
55278
|
-
(field2) => typeof value[field2] === "undefined"
|
|
55279
|
-
).length > 0;
|
|
55280
|
-
let linkedID = null;
|
|
55281
|
-
if (value !== null) {
|
|
55282
|
-
linkedID = !embedded ? this.id(linkedType, value) : `${parent}.${key}`;
|
|
55283
|
-
}
|
|
55284
|
-
let linkChange = linkedID !== previousValue;
|
|
55285
|
-
layer.writeLink(parent, key, linkedID);
|
|
55286
|
-
if (linkedID && displayLayer && (linkChange || forceNotify)) {
|
|
55287
|
-
if (previousValue && typeof previousValue === "string") {
|
|
55288
|
-
this.subscriptions.remove(
|
|
55289
|
-
previousValue,
|
|
55290
|
-
fieldSelection,
|
|
55291
|
-
currentSubscribers,
|
|
55292
|
-
variables
|
|
55293
|
-
);
|
|
55294
|
-
}
|
|
55295
|
-
this.subscriptions.addMany({
|
|
55296
|
-
parent: linkedID,
|
|
55297
|
-
selection: fieldSelection,
|
|
55298
|
-
subscribers: currentSubscribers,
|
|
55299
|
-
variables,
|
|
55300
|
-
parentType: linkedType
|
|
55301
|
-
});
|
|
55302
|
-
toNotify.push(...currentSubscribers);
|
|
55303
|
-
}
|
|
55304
|
-
if (linkedID) {
|
|
55305
|
-
this.writeSelection({
|
|
55306
|
-
selection: fieldSelection,
|
|
55307
|
-
parent: linkedID,
|
|
55308
|
-
data: value,
|
|
55309
|
-
variables,
|
|
55310
|
-
toNotify,
|
|
55311
|
-
applyUpdates,
|
|
55312
|
-
layer,
|
|
55313
|
-
forceNotify
|
|
55314
|
-
});
|
|
55315
|
-
}
|
|
55316
|
-
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
|
|
55317
|
-
let oldIDs = [...previousValue || []];
|
|
55318
|
-
const emptyEdges = !update ? [] : oldIDs.map((id) => {
|
|
55319
|
-
if (!id) {
|
|
55320
|
-
return "";
|
|
55321
|
-
}
|
|
55322
|
-
const { value: cursorField } = this.storage.get(id, "cursor");
|
|
55323
|
-
if (cursorField) {
|
|
55324
|
-
return "";
|
|
55325
|
-
}
|
|
55326
|
-
const { value: node } = this.storage.get(id, "node");
|
|
55327
|
-
if (!node) {
|
|
55328
|
-
return "";
|
|
55329
|
-
}
|
|
55330
|
-
return node;
|
|
55331
|
-
});
|
|
55332
|
-
let linkedIDs = [];
|
|
55333
|
-
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
55334
|
-
value,
|
|
55335
|
-
abstract: Boolean(isAbstract),
|
|
55336
|
-
specs: toNotify,
|
|
55337
|
-
applyUpdates,
|
|
55338
|
-
recordID: parent,
|
|
55339
|
-
key,
|
|
55340
|
-
linkedType,
|
|
55341
|
-
variables,
|
|
55342
|
-
fields: fieldSelection,
|
|
55343
|
-
layer,
|
|
55344
|
-
forceNotify
|
|
55345
|
-
});
|
|
55346
|
-
if (applyUpdates && update) {
|
|
55347
|
-
if (key === "edges") {
|
|
55348
|
-
const newNodeIDs = [];
|
|
55349
|
-
for (const id of newIDs) {
|
|
55350
|
-
if (!id) {
|
|
55351
|
-
continue;
|
|
55352
|
-
}
|
|
55353
|
-
const { value: node } = this.storage.get(id, "node");
|
|
55354
|
-
if (typeof node !== "string") {
|
|
55355
|
-
continue;
|
|
55356
|
-
}
|
|
55357
|
-
if (!node || !this.storage.get(node, "__typename")) {
|
|
55358
|
-
continue;
|
|
55359
|
-
}
|
|
55360
|
-
newNodeIDs.push(node);
|
|
55361
|
-
}
|
|
55362
|
-
oldIDs = oldIDs.filter((id) => {
|
|
55363
|
-
if (!id) {
|
|
55364
|
-
return true;
|
|
55365
|
-
}
|
|
55366
|
-
const { value: value2 } = this.storage.get(id, "node");
|
|
55367
|
-
const node = value2;
|
|
55368
|
-
if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
|
|
55369
|
-
return false;
|
|
55370
|
-
}
|
|
55371
|
-
return true;
|
|
55372
|
-
});
|
|
55373
|
-
}
|
|
55374
|
-
if (update === "prepend") {
|
|
55375
|
-
linkedIDs = newIDs.concat(oldIDs);
|
|
55376
|
-
} else if (update === "append") {
|
|
55377
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
55378
|
-
} else if (update === "replace") {
|
|
55379
|
-
linkedIDs = newIDs;
|
|
55380
|
-
}
|
|
55381
|
-
} else {
|
|
55382
|
-
linkedIDs = nestedIDs;
|
|
55383
|
-
}
|
|
55384
|
-
const contentChanged = !deepEquals(linkedIDs, oldIDs);
|
|
55385
|
-
if (contentChanged || forceNotify) {
|
|
55386
|
-
toNotify.push(...currentSubscribers);
|
|
55387
|
-
}
|
|
55388
|
-
for (const lostID of oldIDs) {
|
|
55389
|
-
if (linkedIDs.includes(lostID) || !lostID) {
|
|
55390
|
-
continue;
|
|
55391
|
-
}
|
|
55392
|
-
this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
|
|
55393
|
-
}
|
|
55394
|
-
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
55395
|
-
layer.writeLink(parent, key, linkedIDs);
|
|
55396
|
-
}
|
|
55397
|
-
for (const id of newIDs.filter((id2) => !oldIDs.includes(id2))) {
|
|
55398
|
-
if (id == null) {
|
|
55399
|
-
continue;
|
|
55400
|
-
}
|
|
55401
|
-
this.subscriptions.addMany({
|
|
55402
|
-
parent: id,
|
|
55403
|
-
selection: fieldSelection,
|
|
55404
|
-
subscribers: currentSubscribers,
|
|
55405
|
-
variables,
|
|
55406
|
-
parentType: linkedType
|
|
55407
|
-
});
|
|
55408
|
-
}
|
|
55409
|
-
}
|
|
55410
|
-
for (const operation of operations || []) {
|
|
55411
|
-
let parentID;
|
|
55412
|
-
if (operation.parentID) {
|
|
55413
|
-
if (operation.parentID.kind !== "Variable") {
|
|
55414
|
-
parentID = operation.parentID.value;
|
|
55415
|
-
} else {
|
|
55416
|
-
const id = variables[operation.parentID.value];
|
|
55417
|
-
if (typeof id !== "string") {
|
|
55418
|
-
throw new Error("parentID value must be a string");
|
|
55419
|
-
}
|
|
55420
|
-
parentID = id;
|
|
55421
|
-
}
|
|
55422
|
-
}
|
|
55423
|
-
if (operation.list && !this.lists.get(operation.list, parentID, operation.target === "all")) {
|
|
55424
|
-
continue;
|
|
55425
|
-
}
|
|
55426
|
-
const targets = Array.isArray(value) ? value : [value];
|
|
55427
|
-
for (const target of targets) {
|
|
55428
|
-
if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
|
|
55429
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
55430
|
-
fieldSelection,
|
|
55431
|
-
target,
|
|
55432
|
-
variables,
|
|
55433
|
-
operation.position || "last"
|
|
55434
|
-
);
|
|
55435
|
-
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
55436
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
55437
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
55438
|
-
if (typeof target !== "string") {
|
|
55439
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
55440
|
-
}
|
|
55441
|
-
const targetID = this.id(operation.type, target);
|
|
55442
|
-
if (!targetID) {
|
|
55443
|
-
continue;
|
|
55444
|
-
}
|
|
55445
|
-
this.cache.delete(targetID);
|
|
55446
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
55447
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
55448
|
-
fieldSelection,
|
|
55449
|
-
target,
|
|
55450
|
-
variables,
|
|
55451
|
-
operation.position || "last"
|
|
55452
|
-
);
|
|
55453
|
-
}
|
|
55454
|
-
}
|
|
55455
|
-
}
|
|
55456
|
-
}
|
|
55457
|
-
return toNotify;
|
|
55458
|
-
}
|
|
55459
|
-
getSelection({
|
|
55460
|
-
selection: selection2,
|
|
55461
|
-
parent = rootID,
|
|
55462
|
-
variables,
|
|
55463
|
-
stepsFromConnection = null
|
|
55464
|
-
}) {
|
|
55465
|
-
if (parent === null) {
|
|
55466
|
-
return { data: null, partial: false, hasData: true };
|
|
55467
|
-
}
|
|
55468
|
-
const target = {};
|
|
55469
|
-
let hasData = false;
|
|
55470
|
-
let partial = false;
|
|
55471
|
-
let cascadeNull = false;
|
|
55472
|
-
const typename = this.storage.get(parent, "__typename").value;
|
|
55473
|
-
let targetSelection = getFieldsForType(selection2, typename);
|
|
55474
|
-
for (const [
|
|
55475
|
-
attributeName,
|
|
55476
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list }
|
|
55477
|
-
] of Object.entries(targetSelection)) {
|
|
55478
|
-
const key = evaluateKey(keyRaw, variables);
|
|
55479
|
-
const { value } = this.storage.get(parent, key);
|
|
55480
|
-
let nextStep = stepsFromConnection;
|
|
55481
|
-
if (nextStep !== null) {
|
|
55482
|
-
if (nextStep >= 2) {
|
|
55483
|
-
nextStep = null;
|
|
55484
|
-
} else {
|
|
55485
|
-
nextStep += 1;
|
|
55486
|
-
}
|
|
55487
|
-
}
|
|
55488
|
-
if (list?.connection) {
|
|
55489
|
-
nextStep = 0;
|
|
55490
|
-
}
|
|
55491
|
-
const embeddedCursor = key === "cursor" && stepsFromConnection === 1;
|
|
55492
|
-
if (typeof value === "undefined" && !embeddedCursor) {
|
|
55493
|
-
partial = true;
|
|
55494
|
-
}
|
|
55495
|
-
if (typeof value === "undefined" || value === null) {
|
|
55496
|
-
target[attributeName] = null;
|
|
55497
|
-
if (typeof value !== "undefined") {
|
|
55498
|
-
hasData = true;
|
|
55499
|
-
}
|
|
55500
|
-
} else if (!fieldSelection) {
|
|
55501
|
-
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
55502
|
-
if (fnUnmarshal) {
|
|
55503
|
-
target[attributeName] = fnUnmarshal(value);
|
|
55504
|
-
} else {
|
|
55505
|
-
target[attributeName] = value;
|
|
55506
|
-
}
|
|
55507
|
-
hasData = true;
|
|
55508
|
-
} else if (Array.isArray(value)) {
|
|
55509
|
-
const listValue = this.hydrateNestedList({
|
|
55510
|
-
fields: fieldSelection,
|
|
55511
|
-
variables,
|
|
55512
|
-
linkedList: value,
|
|
55513
|
-
stepsFromConnection: nextStep
|
|
55514
|
-
});
|
|
55515
|
-
target[attributeName] = listValue.data;
|
|
55516
|
-
if (listValue.partial) {
|
|
55517
|
-
partial = true;
|
|
55518
|
-
}
|
|
55519
|
-
if (listValue.hasData || value.length === 0) {
|
|
55520
|
-
hasData = true;
|
|
55521
|
-
}
|
|
55522
|
-
} else {
|
|
55523
|
-
const objectFields = this.getSelection({
|
|
55524
|
-
parent: value,
|
|
55525
|
-
selection: fieldSelection,
|
|
55526
|
-
variables,
|
|
55527
|
-
stepsFromConnection: nextStep
|
|
55528
|
-
});
|
|
55529
|
-
target[attributeName] = objectFields.data;
|
|
55530
|
-
if (objectFields.partial) {
|
|
55531
|
-
partial = true;
|
|
55532
|
-
}
|
|
55533
|
-
if (objectFields.hasData) {
|
|
55534
|
-
hasData = true;
|
|
55535
|
-
}
|
|
55536
|
-
}
|
|
55537
|
-
if (target[attributeName] === null && !nullable && !embeddedCursor) {
|
|
55538
|
-
cascadeNull = true;
|
|
55539
|
-
}
|
|
55540
|
-
}
|
|
55541
|
-
return {
|
|
55542
|
-
data: cascadeNull ? null : target,
|
|
55543
|
-
partial: hasData && partial,
|
|
55544
|
-
hasData
|
|
55545
|
-
};
|
|
55546
|
-
}
|
|
55547
|
-
id(type, data) {
|
|
55548
|
-
const id = typeof data === "string" ? data : this.computeID(type, data);
|
|
55549
|
-
if (!id) {
|
|
55550
|
-
return null;
|
|
55551
|
-
}
|
|
55552
|
-
if (!type) {
|
|
55553
|
-
return id;
|
|
55554
|
-
}
|
|
55555
|
-
return type + ":" + id;
|
|
55556
|
-
}
|
|
55557
|
-
idFields(type) {
|
|
55558
|
-
return keyFieldsForType(this.config, type);
|
|
55559
|
-
}
|
|
55560
|
-
computeID(type, data) {
|
|
55561
|
-
return computeID(this.config, type, data);
|
|
55562
|
-
}
|
|
55563
|
-
hydrateNestedList({
|
|
55564
|
-
fields,
|
|
55565
|
-
variables,
|
|
55566
|
-
linkedList,
|
|
55567
|
-
stepsFromConnection
|
|
55568
|
-
}) {
|
|
55569
|
-
const result = [];
|
|
55570
|
-
let partialData = false;
|
|
55571
|
-
let hasValues = false;
|
|
55572
|
-
for (const entry of linkedList) {
|
|
55573
|
-
if (Array.isArray(entry)) {
|
|
55574
|
-
const nestedValue = this.hydrateNestedList({
|
|
55575
|
-
fields,
|
|
55576
|
-
variables,
|
|
55577
|
-
linkedList: entry,
|
|
55578
|
-
stepsFromConnection
|
|
55579
|
-
});
|
|
55580
|
-
result.push(nestedValue.data);
|
|
55581
|
-
if (nestedValue.partial) {
|
|
55582
|
-
partialData = true;
|
|
55583
|
-
}
|
|
55584
|
-
continue;
|
|
55585
|
-
}
|
|
55586
|
-
if (entry === null) {
|
|
55587
|
-
result.push(entry);
|
|
55588
|
-
continue;
|
|
55589
|
-
}
|
|
55590
|
-
const { data, partial, hasData } = this.getSelection({
|
|
55591
|
-
parent: entry,
|
|
55592
|
-
selection: fields,
|
|
55593
|
-
variables,
|
|
55594
|
-
stepsFromConnection
|
|
55595
|
-
});
|
|
55596
|
-
result.push(data);
|
|
55597
|
-
if (partial) {
|
|
55598
|
-
partialData = true;
|
|
55599
|
-
}
|
|
55600
|
-
if (hasData) {
|
|
55601
|
-
hasValues = true;
|
|
55602
|
-
}
|
|
55603
|
-
}
|
|
55604
|
-
return {
|
|
55605
|
-
data: result,
|
|
55606
|
-
partial: partialData,
|
|
55607
|
-
hasData: hasValues
|
|
55608
|
-
};
|
|
55609
|
-
}
|
|
55610
|
-
extractNestedListIDs({
|
|
55611
|
-
value,
|
|
55612
|
-
abstract,
|
|
55613
|
-
recordID,
|
|
55614
|
-
key,
|
|
55615
|
-
linkedType,
|
|
55616
|
-
fields,
|
|
55617
|
-
variables,
|
|
55618
|
-
applyUpdates,
|
|
55619
|
-
specs,
|
|
55620
|
-
layer,
|
|
55621
|
-
forceNotify
|
|
55622
|
-
}) {
|
|
55623
|
-
const nestedIDs = [];
|
|
55624
|
-
const newIDs = [];
|
|
55625
|
-
for (const [i, entry] of value.entries()) {
|
|
55626
|
-
if (Array.isArray(entry)) {
|
|
55627
|
-
const inner = this.extractNestedListIDs({
|
|
55628
|
-
value: entry,
|
|
55629
|
-
abstract,
|
|
55630
|
-
recordID,
|
|
55631
|
-
key,
|
|
55632
|
-
linkedType,
|
|
55633
|
-
fields,
|
|
55634
|
-
variables,
|
|
55635
|
-
applyUpdates,
|
|
55636
|
-
specs,
|
|
55637
|
-
layer,
|
|
55638
|
-
forceNotify
|
|
55639
|
-
});
|
|
55640
|
-
newIDs.push(...inner.newIDs);
|
|
55641
|
-
nestedIDs[i] = inner.nestedIDs;
|
|
55642
|
-
continue;
|
|
55643
|
-
}
|
|
55644
|
-
if (entry === null || typeof entry === "undefined") {
|
|
55645
|
-
newIDs.push(null);
|
|
55646
|
-
nestedIDs[i] = null;
|
|
55647
|
-
continue;
|
|
55648
|
-
}
|
|
55649
|
-
const entryObj = entry;
|
|
55650
|
-
let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
|
|
55651
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
55652
|
-
(field) => typeof entry[field] === "undefined"
|
|
55653
|
-
).length > 0;
|
|
55654
|
-
const typename = entryObj.__typename;
|
|
55655
|
-
let innerType = linkedType;
|
|
55656
|
-
if (abstract) {
|
|
55657
|
-
if (!typename) {
|
|
55658
|
-
throw new Error("Encountered interface type without __typename in the payload");
|
|
55659
|
-
}
|
|
55660
|
-
innerType = typename;
|
|
55661
|
-
}
|
|
55662
|
-
if (!embedded) {
|
|
55663
|
-
const id = this.id(innerType, entry);
|
|
55664
|
-
if (id) {
|
|
55665
|
-
linkedID = id;
|
|
55666
|
-
} else {
|
|
55667
|
-
continue;
|
|
55668
|
-
}
|
|
55669
|
-
}
|
|
55670
|
-
this.writeSelection({
|
|
55671
|
-
root: rootID,
|
|
55672
|
-
selection: fields,
|
|
55673
|
-
parent: linkedID,
|
|
55674
|
-
data: entryObj,
|
|
55675
|
-
variables,
|
|
55676
|
-
toNotify: specs,
|
|
55677
|
-
applyUpdates,
|
|
55678
|
-
layer,
|
|
55679
|
-
forceNotify
|
|
55680
|
-
});
|
|
55681
|
-
newIDs.push(linkedID);
|
|
55682
|
-
nestedIDs[i] = linkedID;
|
|
55683
|
-
}
|
|
55684
|
-
return { newIDs, nestedIDs };
|
|
55685
|
-
}
|
|
55686
|
-
collectGarbage() {
|
|
55687
|
-
this.lifetimes.tick();
|
|
55688
|
-
if (this.storage.layerCount === 1) {
|
|
55689
|
-
this.storage.topLayer.removeUndefinedFields();
|
|
55690
|
-
}
|
|
55691
|
-
}
|
|
55692
|
-
};
|
|
55693
|
-
var rootID = "_ROOT_";
|
|
55694
|
-
|
|
55695
|
-
// src/runtime/cache/index.ts
|
|
55696
|
-
var cache_default = new Cache3();
|
|
55697
|
-
|
|
55698
53985
|
// src/lib/constants.ts
|
|
55699
53986
|
var siteURL = "https://houdinigraphql.com";
|
|
55700
53987
|
var houdini_mode = {
|
|
@@ -55986,7 +54273,7 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
55986
54273
|
const targetPath = join(parentDir, child);
|
|
55987
54274
|
let original = await readFile(childPath) || "";
|
|
55988
54275
|
if (transforms?.[childPath]) {
|
|
55989
|
-
original = transforms[childPath](original);
|
|
54276
|
+
original = await transforms[childPath](original, childPath);
|
|
55990
54277
|
}
|
|
55991
54278
|
await writeFile(targetPath, original);
|
|
55992
54279
|
}
|
|
@@ -56307,8 +54594,11 @@ var Config = class {
|
|
|
56307
54594
|
pluginRuntimeDirectory(name2) {
|
|
56308
54595
|
return join(this.pluginDirectory(name2), "runtime");
|
|
56309
54596
|
}
|
|
54597
|
+
get pluginRootDirectory() {
|
|
54598
|
+
return houdini_mode.is_testing ? "../../../" : join(this.rootDir, "plugins");
|
|
54599
|
+
}
|
|
56310
54600
|
pluginDirectory(name2) {
|
|
56311
|
-
return
|
|
54601
|
+
return join(this.pluginRootDirectory, name2);
|
|
56312
54602
|
}
|
|
56313
54603
|
get manualLoadDirective() {
|
|
56314
54604
|
return "manual_load";
|
|
@@ -56358,6 +54648,9 @@ var Config = class {
|
|
|
56358
54648
|
get whenNotDirective() {
|
|
56359
54649
|
return this.whenDirective + "_not";
|
|
56360
54650
|
}
|
|
54651
|
+
get liveDirective() {
|
|
54652
|
+
return "live";
|
|
54653
|
+
}
|
|
56361
54654
|
get argumentsDirective() {
|
|
56362
54655
|
return "arguments";
|
|
56363
54656
|
}
|
|
@@ -56720,7 +55013,13 @@ function exportStarFrom(where) {
|
|
|
56720
55013
|
}
|
|
56721
55014
|
function exportDefaultFrom(where, as) {
|
|
56722
55015
|
return `var ${as} = require("${where}");
|
|
56723
|
-
|
|
55016
|
+
${exportDefault(as)}`;
|
|
55017
|
+
}
|
|
55018
|
+
function exportDefault(as) {
|
|
55019
|
+
return `Object.defineProperty(exports, "${as}", { enumerable: true, get: function () { return __importDefault(${as}).default; } });`;
|
|
55020
|
+
}
|
|
55021
|
+
function importDefaultFrom(where, as) {
|
|
55022
|
+
return `var ${as} = require("${where}")`;
|
|
56724
55023
|
}
|
|
56725
55024
|
|
|
56726
55025
|
// src/codegen/utils/flattenSelections.ts
|
|
@@ -56764,6 +55063,9 @@ var FieldCollection = class {
|
|
|
56764
55063
|
this.add(selection2);
|
|
56765
55064
|
}
|
|
56766
55065
|
}
|
|
55066
|
+
get size() {
|
|
55067
|
+
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
55068
|
+
}
|
|
56767
55069
|
add(selection2) {
|
|
56768
55070
|
if (selection2.kind === "Field") {
|
|
56769
55071
|
const key = selection2.alias?.value || selection2.name.value;
|
|
@@ -56832,9 +55134,12 @@ var FieldCollection = class {
|
|
|
56832
55134
|
}
|
|
56833
55135
|
}
|
|
56834
55136
|
toSelectionSet() {
|
|
56835
|
-
return Object.values(this.inlineFragments).
|
|
55137
|
+
return Object.values(this.inlineFragments).flatMap((fragment) => {
|
|
55138
|
+
if (fragment.selection.size === 0) {
|
|
55139
|
+
return [];
|
|
55140
|
+
}
|
|
56836
55141
|
fragment.astNode.selectionSet.selections = fragment.selection.toSelectionSet();
|
|
56837
|
-
return fragment.astNode;
|
|
55142
|
+
return [fragment.astNode];
|
|
56838
55143
|
}).concat(
|
|
56839
55144
|
Object.values(this.fields).map((field) => {
|
|
56840
55145
|
if (field.astNode.selectionSet) {
|
|
@@ -57017,7 +55322,7 @@ function serializeValue(value) {
|
|
|
57017
55322
|
if (typeof value === "object" && value !== null) {
|
|
57018
55323
|
return AST4.objectExpression(
|
|
57019
55324
|
Object.entries(value).filter(([, value2]) => typeof value2 !== "undefined").map(
|
|
57020
|
-
([key, value2]) => AST4.objectProperty(AST4.
|
|
55325
|
+
([key, value2]) => AST4.objectProperty(AST4.stringLiteral(key), serializeValue(value2))
|
|
57021
55326
|
)
|
|
57022
55327
|
);
|
|
57023
55328
|
}
|
|
@@ -58571,6 +56876,23 @@ function artifactGenerator(stats) {
|
|
|
58571
56876
|
document: doc
|
|
58572
56877
|
})
|
|
58573
56878
|
};
|
|
56879
|
+
const pluginsData = config2.plugins.reduce(
|
|
56880
|
+
(prev, plugin) => {
|
|
56881
|
+
if (!plugin.artifact_data) {
|
|
56882
|
+
return prev;
|
|
56883
|
+
}
|
|
56884
|
+
const result = { ...prev };
|
|
56885
|
+
const dataToAdd = plugin.artifact_data(config2, doc) ?? {};
|
|
56886
|
+
if (Object.keys(dataToAdd).length > 0) {
|
|
56887
|
+
result[plugin.name] = dataToAdd;
|
|
56888
|
+
}
|
|
56889
|
+
return result;
|
|
56890
|
+
},
|
|
56891
|
+
{}
|
|
56892
|
+
);
|
|
56893
|
+
if (Object.keys(pluginsData).length > 0) {
|
|
56894
|
+
artifact.pluginsData = pluginsData;
|
|
56895
|
+
}
|
|
58574
56896
|
if (inputs && inputs.length > 0) {
|
|
58575
56897
|
artifact.input = inputObject(config2, inputs);
|
|
58576
56898
|
}
|
|
@@ -58634,77 +56956,132 @@ function artifactGenerator(stats) {
|
|
|
58634
56956
|
};
|
|
58635
56957
|
}
|
|
58636
56958
|
|
|
58637
|
-
// src/codegen/generators/runtime/
|
|
56959
|
+
// src/codegen/generators/runtime/graphqlFunction.ts
|
|
58638
56960
|
var recast6 = __toESM(require_main2(), 1);
|
|
58639
56961
|
var AST6 = recast6.types.builders;
|
|
58640
|
-
async function
|
|
58641
|
-
await Promise.all([
|
|
58642
|
-
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
58643
|
-
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
58644
|
-
const configFilePath = path_exports.join(config2.runtimeDirectory, "lib", "config.js");
|
|
58645
|
-
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
|
|
58646
|
-
return content.replace("HOUDINI_CONFIG_PATH", relativePath);
|
|
58647
|
-
},
|
|
58648
|
-
[path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
58649
|
-
return content.replace("SITE_URL", siteURL);
|
|
58650
|
-
}
|
|
58651
|
-
}),
|
|
58652
|
-
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
58653
|
-
]);
|
|
56962
|
+
async function generateGraphqlReturnTypes(config2, docs) {
|
|
58654
56963
|
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
58655
|
-
const
|
|
56964
|
+
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
56965
|
+
const contents = await parseJS(fileContent);
|
|
58656
56966
|
const graphql_tag_return = config2.plugins.find(
|
|
58657
56967
|
(plugin) => plugin.graphql_tag_return
|
|
58658
56968
|
)?.graphql_tag_return;
|
|
58659
|
-
if (graphql_tag_return
|
|
58660
|
-
|
|
58661
|
-
|
|
58662
|
-
|
|
58663
|
-
|
|
58664
|
-
|
|
58665
|
-
|
|
58666
|
-
|
|
58667
|
-
|
|
58668
|
-
|
|
58669
|
-
|
|
58670
|
-
|
|
58671
|
-
|
|
58672
|
-
|
|
58673
|
-
|
|
58674
|
-
if (return_value) {
|
|
58675
|
-
overloaded_returns[doc.originalString] = return_value;
|
|
56969
|
+
if (!graphql_tag_return || !contents) {
|
|
56970
|
+
return fileContent;
|
|
56971
|
+
}
|
|
56972
|
+
const overloaded_returns = {};
|
|
56973
|
+
for (const doc of docs) {
|
|
56974
|
+
const return_value = graphql_tag_return({
|
|
56975
|
+
config: config2,
|
|
56976
|
+
doc,
|
|
56977
|
+
ensure_import({ identifier, module }) {
|
|
56978
|
+
ensureImports({
|
|
56979
|
+
config: config2,
|
|
56980
|
+
body: contents.script.body,
|
|
56981
|
+
sourceModule: module,
|
|
56982
|
+
import: [identifier]
|
|
56983
|
+
});
|
|
58676
56984
|
}
|
|
56985
|
+
});
|
|
56986
|
+
if (return_value) {
|
|
56987
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
58677
56988
|
}
|
|
58678
|
-
|
|
58679
|
-
|
|
58680
|
-
|
|
58681
|
-
|
|
58682
|
-
|
|
58683
|
-
|
|
58684
|
-
|
|
58685
|
-
|
|
58686
|
-
|
|
58687
|
-
)
|
|
58688
|
-
|
|
58689
|
-
|
|
58690
|
-
|
|
58691
|
-
|
|
58692
|
-
|
|
58693
|
-
|
|
58694
|
-
|
|
58695
|
-
|
|
58696
|
-
|
|
58697
|
-
)
|
|
58698
|
-
)
|
|
56989
|
+
}
|
|
56990
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
56991
|
+
for (const [i, expression] of (contents?.script.body ?? []).entries()) {
|
|
56992
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
56993
|
+
continue;
|
|
56994
|
+
}
|
|
56995
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
56996
|
+
const input = AST6.identifier("str");
|
|
56997
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
56998
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
56999
|
+
);
|
|
57000
|
+
contents?.script.body.splice(
|
|
57001
|
+
i,
|
|
57002
|
+
0,
|
|
57003
|
+
AST6.exportNamedDeclaration(
|
|
57004
|
+
AST6.tsDeclareFunction(
|
|
57005
|
+
AST6.identifier("graphql"),
|
|
57006
|
+
[input],
|
|
57007
|
+
AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
|
|
58699
57008
|
)
|
|
58700
|
-
)
|
|
58701
|
-
|
|
58702
|
-
break;
|
|
57009
|
+
)
|
|
57010
|
+
);
|
|
58703
57011
|
}
|
|
58704
|
-
|
|
57012
|
+
break;
|
|
58705
57013
|
}
|
|
57014
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
58706
57015
|
}
|
|
58707
57016
|
}
|
|
57017
|
+
|
|
57018
|
+
// src/codegen/generators/runtime/injectPlugins.ts
|
|
57019
|
+
async function injectPlugins({
|
|
57020
|
+
config: config2,
|
|
57021
|
+
content,
|
|
57022
|
+
importStatement,
|
|
57023
|
+
exportStatement
|
|
57024
|
+
}) {
|
|
57025
|
+
const client_plugins = config2.plugins.filter((plugin) => plugin.client_plugins).reduce((acc, plugin) => {
|
|
57026
|
+
let plugins = plugin.client_plugins;
|
|
57027
|
+
if (typeof plugins === "function") {
|
|
57028
|
+
plugins = plugins(config2, config2.pluginConfig(plugin.name));
|
|
57029
|
+
}
|
|
57030
|
+
return [...acc, ...Object.entries(plugins)];
|
|
57031
|
+
}, []);
|
|
57032
|
+
return client_plugins.length > 0 ? `
|
|
57033
|
+
${client_plugins.map((plugin, i) => importStatement(plugin[0], `plugin${i}`))}
|
|
57034
|
+
|
|
57035
|
+
const plugins = [
|
|
57036
|
+
${client_plugins.map((plugin, i) => {
|
|
57037
|
+
const suffix = plugin[1] !== null ? `(${JSON.stringify(plugin[1])})` : "";
|
|
57038
|
+
return `plugin${i}${suffix}`;
|
|
57039
|
+
}).join(",\n")}
|
|
57040
|
+
]
|
|
57041
|
+
|
|
57042
|
+
${exportStatement("plugins")}
|
|
57043
|
+
` : content;
|
|
57044
|
+
}
|
|
57045
|
+
|
|
57046
|
+
// src/codegen/generators/runtime/pluginIndex.ts
|
|
57047
|
+
async function generatePluginIndex({
|
|
57048
|
+
config: config2,
|
|
57049
|
+
exportStatement
|
|
57050
|
+
}) {
|
|
57051
|
+
const indexFile = `${exportStatement("../runtime/client/plugins/index.js")}
|
|
57052
|
+
`;
|
|
57053
|
+
const typedefs = `export * from '../runtime/client/plugins'`;
|
|
57054
|
+
await fs_exports.mkdirp(config2.pluginRootDirectory);
|
|
57055
|
+
await Promise.all([
|
|
57056
|
+
fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.js"), indexFile),
|
|
57057
|
+
fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.d.ts"), typedefs)
|
|
57058
|
+
]);
|
|
57059
|
+
}
|
|
57060
|
+
|
|
57061
|
+
// src/codegen/generators/runtime/index.ts
|
|
57062
|
+
async function runtimeGenerator(config2, docs) {
|
|
57063
|
+
const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
57064
|
+
const exportStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
57065
|
+
const exportStar = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
|
|
57066
|
+
await Promise.all([
|
|
57067
|
+
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
57068
|
+
[path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
57069
|
+
return content.replace("SITE_URL", siteURL);
|
|
57070
|
+
},
|
|
57071
|
+
[path_exports.join(config2.runtimeSource, "imports", "config.js")]: (content) => {
|
|
57072
|
+
const configFilePath = path_exports.join(config2.runtimeDirectory, "imports", "config.js");
|
|
57073
|
+
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
|
|
57074
|
+
return `${importStatement(relativePath, "config")}
|
|
57075
|
+
${exportStatement("config")}
|
|
57076
|
+
`;
|
|
57077
|
+
},
|
|
57078
|
+
[path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
57079
|
+
}),
|
|
57080
|
+
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin)),
|
|
57081
|
+
generatePluginIndex({ config: config2, exportStatement: exportStar })
|
|
57082
|
+
]);
|
|
57083
|
+
await generateGraphqlReturnTypes(config2, docs);
|
|
57084
|
+
}
|
|
58708
57085
|
async function generatePluginRuntime(config2, plugin) {
|
|
58709
57086
|
if (houdini_mode.is_testing) {
|
|
58710
57087
|
return;
|
|
@@ -59770,6 +58147,7 @@ async function writeIndexFile2(config2, docs) {
|
|
|
59770
58147
|
const export_star_from = ({ module }) => "\n" + (cjs ? exportStarFrom(module) : `export * from "${module}"`) + "\n";
|
|
59771
58148
|
const export_default_as = ({ module, as }) => "\n" + (cjs ? exportDefaultFrom(module, as) : `export { default as ${as} } from "${module}"`) + "\n";
|
|
59772
58149
|
body += [
|
|
58150
|
+
export_star_from({ module: "./" + path_exports.join(runtimeDir, "client") }),
|
|
59773
58151
|
export_star_from({ module: runtimeDir }),
|
|
59774
58152
|
export_star_from({ module: artifactDir }),
|
|
59775
58153
|
export_star_from({ module: definitionsDir })
|
|
@@ -59882,7 +58260,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59882
58260
|
}
|
|
59883
58261
|
|
|
59884
58262
|
// src/codegen/transforms/schema.ts
|
|
59885
|
-
var
|
|
58263
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
59886
58264
|
async function graphqlExtensions(config2, documents) {
|
|
59887
58265
|
const internalSchema = `
|
|
59888
58266
|
enum CachePolicy {
|
|
@@ -59960,19 +58338,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59960
58338
|
"""
|
|
59961
58339
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59962
58340
|
`;
|
|
59963
|
-
let currentSchema =
|
|
58341
|
+
let currentSchema = graphql19.printSchema(config2.schema);
|
|
59964
58342
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59965
58343
|
currentSchema += internalSchema;
|
|
59966
58344
|
}
|
|
59967
58345
|
config2.newSchema += internalSchema;
|
|
59968
|
-
config2.schema =
|
|
58346
|
+
config2.schema = graphql19.buildSchema(currentSchema);
|
|
59969
58347
|
}
|
|
59970
58348
|
|
|
59971
58349
|
// src/codegen/transforms/typename.ts
|
|
59972
|
-
var
|
|
58350
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
59973
58351
|
async function addTypename(config2, documents) {
|
|
59974
58352
|
for (const doc of documents) {
|
|
59975
|
-
doc.document =
|
|
58353
|
+
doc.document = graphql20.visit(doc.document, {
|
|
59976
58354
|
Field(node, key, parent, path2, ancestors) {
|
|
59977
58355
|
if (!node.selectionSet) {
|
|
59978
58356
|
return;
|
|
@@ -59984,7 +58362,7 @@ async function addTypename(config2, documents) {
|
|
|
59984
58362
|
);
|
|
59985
58363
|
const field = type.getFields()[node.name.value];
|
|
59986
58364
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59987
|
-
if (
|
|
58365
|
+
if (graphql20.isInterfaceType(fieldType) || graphql20.isUnionType(fieldType)) {
|
|
59988
58366
|
return {
|
|
59989
58367
|
...node,
|
|
59990
58368
|
selectionSet: {
|
|
@@ -59992,9 +58370,9 @@ async function addTypename(config2, documents) {
|
|
|
59992
58370
|
selections: [
|
|
59993
58371
|
...node.selectionSet.selections,
|
|
59994
58372
|
{
|
|
59995
|
-
kind:
|
|
58373
|
+
kind: graphql20.Kind.FIELD,
|
|
59996
58374
|
name: {
|
|
59997
|
-
kind:
|
|
58375
|
+
kind: graphql20.Kind.NAME,
|
|
59998
58376
|
value: "__typename"
|
|
59999
58377
|
}
|
|
60000
58378
|
}
|
|
@@ -60008,10 +58386,10 @@ async function addTypename(config2, documents) {
|
|
|
60008
58386
|
}
|
|
60009
58387
|
|
|
60010
58388
|
// src/codegen/transforms/addID.ts
|
|
60011
|
-
var
|
|
58389
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
60012
58390
|
async function addID(config2, documents) {
|
|
60013
58391
|
for (const doc of documents) {
|
|
60014
|
-
doc.document =
|
|
58392
|
+
doc.document = graphql21.visit(doc.document, {
|
|
60015
58393
|
Field(node, key, parent, path2, ancestors) {
|
|
60016
58394
|
if (!node.selectionSet) {
|
|
60017
58395
|
return;
|
|
@@ -60024,7 +58402,7 @@ async function addID(config2, documents) {
|
|
|
60024
58402
|
const field = type.getFields()[node.name.value];
|
|
60025
58403
|
const fieldType = unwrapType(config2, field.type).type;
|
|
60026
58404
|
if (node.selectionSet?.selections.length > 0) {
|
|
60027
|
-
if (!
|
|
58405
|
+
if (!graphql21.isObjectType(fieldType) && !graphql21.isInterfaceType(fieldType)) {
|
|
60028
58406
|
return;
|
|
60029
58407
|
}
|
|
60030
58408
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -60039,9 +58417,9 @@ async function addID(config2, documents) {
|
|
|
60039
58417
|
continue;
|
|
60040
58418
|
}
|
|
60041
58419
|
selections.push({
|
|
60042
|
-
kind:
|
|
58420
|
+
kind: graphql21.Kind.FIELD,
|
|
60043
58421
|
name: {
|
|
60044
|
-
kind:
|
|
58422
|
+
kind: graphql21.Kind.NAME,
|
|
60045
58423
|
value: keyField
|
|
60046
58424
|
}
|
|
60047
58425
|
});
|
|
@@ -60060,8 +58438,8 @@ async function addID(config2, documents) {
|
|
|
60060
58438
|
}
|
|
60061
58439
|
|
|
60062
58440
|
// src/codegen/transforms/fragmentVariables.ts
|
|
60063
|
-
var
|
|
60064
|
-
var GraphqlKinds2 =
|
|
58441
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
58442
|
+
var GraphqlKinds2 = graphql22.Kind;
|
|
60065
58443
|
async function fragmentVariables(config2, documents) {
|
|
60066
58444
|
const fragments = collectFragments(config2, documents);
|
|
60067
58445
|
const generatedFragments = {};
|
|
@@ -60084,7 +58462,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
60084
58462
|
});
|
|
60085
58463
|
}
|
|
60086
58464
|
const doc = {
|
|
60087
|
-
kind:
|
|
58465
|
+
kind: graphql22.Kind.DOCUMENT,
|
|
60088
58466
|
definitions: Object.values(generatedFragments)
|
|
60089
58467
|
};
|
|
60090
58468
|
documents.push({
|
|
@@ -60120,7 +58498,7 @@ function inlineFragmentArgs({
|
|
|
60120
58498
|
filepath,
|
|
60121
58499
|
document
|
|
60122
58500
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
60123
|
-
const result =
|
|
58501
|
+
const result = graphql22.visit(document, {
|
|
60124
58502
|
FragmentSpread(node) {
|
|
60125
58503
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
60126
58504
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -60208,7 +58586,7 @@ function inlineFragmentArgs({
|
|
|
60208
58586
|
});
|
|
60209
58587
|
if (newName) {
|
|
60210
58588
|
result.name = {
|
|
60211
|
-
kind:
|
|
58589
|
+
kind: graphql22.Kind.NAME,
|
|
60212
58590
|
value: newName
|
|
60213
58591
|
};
|
|
60214
58592
|
}
|
|
@@ -60320,7 +58698,7 @@ function operationScope(operation) {
|
|
|
60320
58698
|
}
|
|
60321
58699
|
|
|
60322
58700
|
// src/codegen/validators/typeCheck.ts
|
|
60323
|
-
var
|
|
58701
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
60324
58702
|
async function typeCheck(config2, docs) {
|
|
60325
58703
|
const errors = [];
|
|
60326
58704
|
const freeLists = [];
|
|
@@ -60328,11 +58706,11 @@ async function typeCheck(config2, docs) {
|
|
|
60328
58706
|
const listTypes = [];
|
|
60329
58707
|
const fragments = {};
|
|
60330
58708
|
for (const { document: parsed, filename } of docs) {
|
|
60331
|
-
|
|
60332
|
-
[
|
|
58709
|
+
graphql23.visit(parsed, {
|
|
58710
|
+
[graphql23.Kind.FRAGMENT_DEFINITION](definition) {
|
|
60333
58711
|
fragments[definition.name.value] = definition;
|
|
60334
58712
|
},
|
|
60335
|
-
[
|
|
58713
|
+
[graphql23.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
60336
58714
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
60337
58715
|
return;
|
|
60338
58716
|
}
|
|
@@ -60378,14 +58756,14 @@ async function typeCheck(config2, docs) {
|
|
|
60378
58756
|
);
|
|
60379
58757
|
return;
|
|
60380
58758
|
}
|
|
60381
|
-
if (
|
|
58759
|
+
if (graphql23.isListType(rootType) || graphql23.isNonNullType(rootType) && graphql23.isListType(rootType.ofType)) {
|
|
60382
58760
|
needsParent = true;
|
|
60383
58761
|
break;
|
|
60384
58762
|
}
|
|
60385
|
-
if (
|
|
58763
|
+
if (graphql23.isNonNullType(rootType) && "ofType" in rootType) {
|
|
60386
58764
|
rootType = rootType.ofType;
|
|
60387
58765
|
}
|
|
60388
|
-
if (
|
|
58766
|
+
if (graphql23.isScalarType(rootType)) {
|
|
60389
58767
|
break;
|
|
60390
58768
|
}
|
|
60391
58769
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -60461,9 +58839,9 @@ async function typeCheck(config2, docs) {
|
|
|
60461
58839
|
);
|
|
60462
58840
|
}
|
|
60463
58841
|
let targetTypes = [type];
|
|
60464
|
-
if (
|
|
58842
|
+
if (graphql23.isUnionType(type)) {
|
|
60465
58843
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
60466
|
-
} else if (
|
|
58844
|
+
} else if (graphql23.isInterfaceType(type)) {
|
|
60467
58845
|
try {
|
|
60468
58846
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
60469
58847
|
if (!type.getFields()[key]) {
|
|
@@ -60501,13 +58879,13 @@ async function typeCheck(config2, docs) {
|
|
|
60501
58879
|
if (errors.length > 0) {
|
|
60502
58880
|
throw errors;
|
|
60503
58881
|
}
|
|
60504
|
-
const rules = (filepath) => [...
|
|
58882
|
+
const rules = (filepath) => [...graphql23.specifiedRules].filter(
|
|
60505
58883
|
(rule) => ![
|
|
60506
|
-
|
|
60507
|
-
|
|
60508
|
-
|
|
60509
|
-
|
|
60510
|
-
|
|
58884
|
+
graphql23.NoUnusedFragmentsRule,
|
|
58885
|
+
graphql23.KnownFragmentNamesRule,
|
|
58886
|
+
graphql23.ExecutableDefinitionsRule,
|
|
58887
|
+
graphql23.KnownDirectivesRule,
|
|
58888
|
+
graphql23.KnownArgumentNamesRule
|
|
60511
58889
|
].includes(rule)
|
|
60512
58890
|
).concat(
|
|
60513
58891
|
validateLists({
|
|
@@ -60526,7 +58904,7 @@ async function typeCheck(config2, docs) {
|
|
|
60526
58904
|
noUnusedFragmentArguments(config2)
|
|
60527
58905
|
);
|
|
60528
58906
|
for (const { filename, document: parsed } of docs) {
|
|
60529
|
-
for (const error of
|
|
58907
|
+
for (const error of graphql23.validate(config2.schema, parsed, rules(filename))) {
|
|
60530
58908
|
errors.push(
|
|
60531
58909
|
new HoudiniError({
|
|
60532
58910
|
filepath: filename,
|
|
@@ -60552,7 +58930,7 @@ var validateLists = ({
|
|
|
60552
58930
|
if (!config2.isListFragment(node.name.value)) {
|
|
60553
58931
|
if (!fragments[node.name.value]) {
|
|
60554
58932
|
ctx.reportError(
|
|
60555
|
-
new
|
|
58933
|
+
new graphql23.GraphQLError(
|
|
60556
58934
|
"Encountered unknown fragment: " + node.name.value
|
|
60557
58935
|
)
|
|
60558
58936
|
);
|
|
@@ -60562,7 +58940,7 @@ var validateLists = ({
|
|
|
60562
58940
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
60563
58941
|
if (!lists.includes(listName)) {
|
|
60564
58942
|
ctx.reportError(
|
|
60565
|
-
new
|
|
58943
|
+
new graphql23.GraphQLError(
|
|
60566
58944
|
"Encountered fragment referencing unknown list: " + listName
|
|
60567
58945
|
)
|
|
60568
58946
|
);
|
|
@@ -60587,7 +58965,7 @@ var validateLists = ({
|
|
|
60587
58965
|
);
|
|
60588
58966
|
if (parentArg) {
|
|
60589
58967
|
ctx.reportError(
|
|
60590
|
-
new
|
|
58968
|
+
new graphql23.GraphQLError(
|
|
60591
58969
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
60592
58970
|
)
|
|
60593
58971
|
);
|
|
@@ -60603,7 +58981,7 @@ var validateLists = ({
|
|
|
60603
58981
|
return;
|
|
60604
58982
|
}
|
|
60605
58983
|
ctx.reportError(
|
|
60606
|
-
new
|
|
58984
|
+
new graphql23.GraphQLError(
|
|
60607
58985
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
60608
58986
|
)
|
|
60609
58987
|
);
|
|
@@ -60613,7 +58991,7 @@ var validateLists = ({
|
|
|
60613
58991
|
const directiveName = node.name.value;
|
|
60614
58992
|
if (directiveName === "connection") {
|
|
60615
58993
|
ctx.reportError(
|
|
60616
|
-
new
|
|
58994
|
+
new graphql23.GraphQLError(
|
|
60617
58995
|
"@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."
|
|
60618
58996
|
)
|
|
60619
58997
|
);
|
|
@@ -60622,7 +59000,7 @@ var validateLists = ({
|
|
|
60622
59000
|
if (!config2.isInternalDirective(node)) {
|
|
60623
59001
|
if (!config2.schema.getDirective(directiveName)) {
|
|
60624
59002
|
ctx.reportError(
|
|
60625
|
-
new
|
|
59003
|
+
new graphql23.GraphQLError(
|
|
60626
59004
|
"Encountered unknown directive: " + directiveName
|
|
60627
59005
|
)
|
|
60628
59006
|
);
|
|
@@ -60631,7 +59009,7 @@ var validateLists = ({
|
|
|
60631
59009
|
}
|
|
60632
59010
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
60633
59011
|
ctx.reportError(
|
|
60634
|
-
new
|
|
59012
|
+
new graphql23.GraphQLError(
|
|
60635
59013
|
"Encountered directive referencing unknown list: " + directiveName
|
|
60636
59014
|
)
|
|
60637
59015
|
);
|
|
@@ -60642,7 +59020,7 @@ var validateLists = ({
|
|
|
60642
59020
|
};
|
|
60643
59021
|
function knownArguments(config2) {
|
|
60644
59022
|
return function(ctx) {
|
|
60645
|
-
const nativeValidator =
|
|
59023
|
+
const nativeValidator = graphql23.KnownArgumentNamesRule(ctx);
|
|
60646
59024
|
return {
|
|
60647
59025
|
...nativeValidator,
|
|
60648
59026
|
Directive(directiveNode) {
|
|
@@ -60675,7 +59053,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60675
59053
|
for (const arg of node.arguments || []) {
|
|
60676
59054
|
if (arg.value.kind !== "ObjectValue") {
|
|
60677
59055
|
ctx.reportError(
|
|
60678
|
-
new
|
|
59056
|
+
new graphql23.GraphQLError("values in @arguments must be an object")
|
|
60679
59057
|
);
|
|
60680
59058
|
return;
|
|
60681
59059
|
}
|
|
@@ -60685,13 +59063,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60685
59063
|
);
|
|
60686
59064
|
if (!typeArg) {
|
|
60687
59065
|
ctx.reportError(
|
|
60688
|
-
new
|
|
59066
|
+
new graphql23.GraphQLError("missing type field for @arguments directive")
|
|
60689
59067
|
);
|
|
60690
59068
|
return;
|
|
60691
59069
|
}
|
|
60692
|
-
if (typeArg.value.kind !==
|
|
59070
|
+
if (typeArg.value.kind !== graphql23.Kind.STRING) {
|
|
60693
59071
|
ctx.reportError(
|
|
60694
|
-
new
|
|
59072
|
+
new graphql23.GraphQLError("type field to @arguments must be a string")
|
|
60695
59073
|
);
|
|
60696
59074
|
return;
|
|
60697
59075
|
}
|
|
@@ -60704,7 +59082,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60704
59082
|
);
|
|
60705
59083
|
if (typeArg.value.value !== defaultValueType) {
|
|
60706
59084
|
ctx.reportError(
|
|
60707
|
-
new
|
|
59085
|
+
new graphql23.GraphQLError(
|
|
60708
59086
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60709
59087
|
)
|
|
60710
59088
|
);
|
|
@@ -60722,7 +59100,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60722
59100
|
try {
|
|
60723
59101
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60724
59102
|
} catch (e) {
|
|
60725
|
-
ctx.reportError(new
|
|
59103
|
+
ctx.reportError(new graphql23.GraphQLError(e.message));
|
|
60726
59104
|
return;
|
|
60727
59105
|
}
|
|
60728
59106
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60745,7 +59123,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60745
59123
|
);
|
|
60746
59124
|
if (missing.length > 0) {
|
|
60747
59125
|
ctx.reportError(
|
|
60748
|
-
new
|
|
59126
|
+
new graphql23.GraphQLError(
|
|
60749
59127
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60750
59128
|
)
|
|
60751
59129
|
);
|
|
@@ -60756,7 +59134,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60756
59134
|
);
|
|
60757
59135
|
if (unknown.length > 0) {
|
|
60758
59136
|
ctx.reportError(
|
|
60759
|
-
new
|
|
59137
|
+
new graphql23.GraphQLError(
|
|
60760
59138
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60761
59139
|
)
|
|
60762
59140
|
);
|
|
@@ -60768,7 +59146,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60768
59146
|
]
|
|
60769
59147
|
);
|
|
60770
59148
|
for (const [applied, target] of zipped) {
|
|
60771
|
-
if (applied.value.kind ===
|
|
59149
|
+
if (applied.value.kind === graphql23.Kind.VARIABLE || applied.value.kind === graphql23.Kind.LIST || applied.value.kind === graphql23.Kind.OBJECT) {
|
|
60772
59150
|
continue;
|
|
60773
59151
|
}
|
|
60774
59152
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60777,7 +59155,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60777
59155
|
);
|
|
60778
59156
|
if (appliedType !== target) {
|
|
60779
59157
|
ctx.reportError(
|
|
60780
|
-
new
|
|
59158
|
+
new graphql23.GraphQLError(
|
|
60781
59159
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60782
59160
|
)
|
|
60783
59161
|
);
|
|
@@ -60798,7 +59176,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60798
59176
|
}
|
|
60799
59177
|
if (alreadyPaginated) {
|
|
60800
59178
|
ctx.reportError(
|
|
60801
|
-
new
|
|
59179
|
+
new graphql23.GraphQLError(
|
|
60802
59180
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60803
59181
|
)
|
|
60804
59182
|
);
|
|
@@ -60813,7 +59191,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60813
59191
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60814
59192
|
if (hasRequiredArgs) {
|
|
60815
59193
|
ctx.reportError(
|
|
60816
|
-
new
|
|
59194
|
+
new graphql23.GraphQLError(
|
|
60817
59195
|
"@paginate cannot appear on a document with required args"
|
|
60818
59196
|
)
|
|
60819
59197
|
);
|
|
@@ -60845,14 +59223,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60845
59223
|
const backwards = appliedArgs.has("last");
|
|
60846
59224
|
if (!forward && !backwards) {
|
|
60847
59225
|
ctx.reportError(
|
|
60848
|
-
new
|
|
59226
|
+
new graphql23.GraphQLError(
|
|
60849
59227
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60850
59228
|
)
|
|
60851
59229
|
);
|
|
60852
59230
|
}
|
|
60853
59231
|
if (forward && backwards) {
|
|
60854
59232
|
ctx.reportError(
|
|
60855
|
-
new
|
|
59233
|
+
new graphql23.GraphQLError(
|
|
60856
59234
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60857
59235
|
)
|
|
60858
59236
|
);
|
|
@@ -60866,7 +59244,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60866
59244
|
);
|
|
60867
59245
|
if (!appliedLimitArg) {
|
|
60868
59246
|
ctx.reportError(
|
|
60869
|
-
new
|
|
59247
|
+
new graphql23.GraphQLError(
|
|
60870
59248
|
"A field with offset-based pagination must have a limit argument"
|
|
60871
59249
|
)
|
|
60872
59250
|
);
|
|
@@ -60882,20 +59260,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60882
59260
|
const args = /* @__PURE__ */ new Set();
|
|
60883
59261
|
return {
|
|
60884
59262
|
enter(node) {
|
|
60885
|
-
if (node.kind ===
|
|
59263
|
+
if (node.kind === graphql23.Kind.FRAGMENT_DEFINITION) {
|
|
60886
59264
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60887
59265
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60888
59266
|
args.add(arg);
|
|
60889
59267
|
}
|
|
60890
|
-
} else if (node.kind ===
|
|
59268
|
+
} else if (node.kind === graphql23.Kind.VARIABLE) {
|
|
60891
59269
|
args.delete(node.name.value);
|
|
60892
59270
|
}
|
|
60893
59271
|
},
|
|
60894
59272
|
leave(node) {
|
|
60895
|
-
if (node.kind ===
|
|
59273
|
+
if (node.kind === graphql23.Kind.FRAGMENT_DEFINITION) {
|
|
60896
59274
|
if (args.size > 0) {
|
|
60897
59275
|
ctx.reportError(
|
|
60898
|
-
new
|
|
59276
|
+
new graphql23.GraphQLError(
|
|
60899
59277
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60900
59278
|
)
|
|
60901
59279
|
);
|
|
@@ -60931,7 +59309,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60931
59309
|
if (definition.kind === "OperationDefinition") {
|
|
60932
59310
|
if (definition.operation !== "query") {
|
|
60933
59311
|
ctx.reportError(
|
|
60934
|
-
new
|
|
59312
|
+
new graphql23.GraphQLError(
|
|
60935
59313
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60936
59314
|
)
|
|
60937
59315
|
);
|
|
@@ -60943,7 +59321,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60943
59321
|
}
|
|
60944
59322
|
if (!possibleNodes.includes(definitionType)) {
|
|
60945
59323
|
ctx.reportError(
|
|
60946
|
-
new
|
|
59324
|
+
new graphql23.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60947
59325
|
);
|
|
60948
59326
|
}
|
|
60949
59327
|
}
|
|
@@ -60962,7 +59340,7 @@ function checkMutationOperation(config2) {
|
|
|
60962
59340
|
);
|
|
60963
59341
|
if (append && prepend) {
|
|
60964
59342
|
ctx.reportError(
|
|
60965
|
-
new
|
|
59343
|
+
new graphql23.GraphQLError(
|
|
60966
59344
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60967
59345
|
)
|
|
60968
59346
|
);
|
|
@@ -60976,7 +59354,7 @@ function checkMutationOperation(config2) {
|
|
|
60976
59354
|
);
|
|
60977
59355
|
if (parentId && allLists) {
|
|
60978
59356
|
ctx.reportError(
|
|
60979
|
-
new
|
|
59357
|
+
new graphql23.GraphQLError(
|
|
60980
59358
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60981
59359
|
)
|
|
60982
59360
|
);
|
|
@@ -60998,7 +59376,7 @@ function checkMaskDirective(config2) {
|
|
|
60998
59376
|
);
|
|
60999
59377
|
if (maskEnableDirective && maskDisableDirective) {
|
|
61000
59378
|
ctx.reportError(
|
|
61001
|
-
new
|
|
59379
|
+
new graphql23.GraphQLError(
|
|
61002
59380
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
61003
59381
|
)
|
|
61004
59382
|
);
|
|
@@ -61014,7 +59392,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
61014
59392
|
if (!nodeInterface) {
|
|
61015
59393
|
return null;
|
|
61016
59394
|
}
|
|
61017
|
-
if (!
|
|
59395
|
+
if (!graphql23.isInterfaceType(nodeInterface)) {
|
|
61018
59396
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
61019
59397
|
return null;
|
|
61020
59398
|
}
|
|
@@ -61112,11 +59490,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
61112
59490
|
}
|
|
61113
59491
|
|
|
61114
59492
|
// src/codegen/validators/noIDAlias.ts
|
|
61115
|
-
var
|
|
59493
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
61116
59494
|
async function noIDAlias(config2, docs) {
|
|
61117
59495
|
const errors = [];
|
|
61118
59496
|
for (const { filename, document } of docs) {
|
|
61119
|
-
|
|
59497
|
+
graphql24.visit(document, {
|
|
61120
59498
|
Field(node, _, __, ___, ancestors) {
|
|
61121
59499
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
61122
59500
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -61280,12 +59658,14 @@ function logStyled(kind, stat2, logLevel, plugin) {
|
|
|
61280
59658
|
}
|
|
61281
59659
|
|
|
61282
59660
|
// src/test/index.ts
|
|
61283
|
-
function testConfigFile(config2 = {}) {
|
|
59661
|
+
function testConfigFile({ plugins, ...config2 } = {}) {
|
|
61284
59662
|
return {
|
|
61285
59663
|
schema: `
|
|
61286
59664
|
scalar Cursor
|
|
61287
59665
|
scalar DateTime
|
|
61288
59666
|
|
|
59667
|
+
directive @live on QUERY
|
|
59668
|
+
|
|
61289
59669
|
type User implements Node & Friend & CatOwner {
|
|
61290
59670
|
id: ID!
|
|
61291
59671
|
name: String!
|
|
@@ -61419,7 +59799,7 @@ function testConfigFile(config2 = {}) {
|
|
|
61419
59799
|
cats: [Cat!]!
|
|
61420
59800
|
}
|
|
61421
59801
|
|
|
61422
|
-
interface IsGhost {
|
|
59802
|
+
interface IsGhost {
|
|
61423
59803
|
aka: String!
|
|
61424
59804
|
}
|
|
61425
59805
|
|
|
@@ -61512,7 +59892,8 @@ function testConfigFile(config2 = {}) {
|
|
|
61512
59892
|
plugins: {
|
|
61513
59893
|
"houdini-svelte": {
|
|
61514
59894
|
client: "./my/client/path"
|
|
61515
|
-
}
|
|
59895
|
+
},
|
|
59896
|
+
...plugins
|
|
61516
59897
|
},
|
|
61517
59898
|
acceptImperativeInstability: true,
|
|
61518
59899
|
...config2
|
|
@@ -61546,7 +59927,7 @@ function pipelineTest(config2, documents, shouldPass, testBody) {
|
|
|
61546
59927
|
};
|
|
61547
59928
|
}
|
|
61548
59929
|
function mockCollectedDoc(query) {
|
|
61549
|
-
const parsed =
|
|
59930
|
+
const parsed = graphql25.parse(query);
|
|
61550
59931
|
const name2 = parsed.definitions[0].name.value;
|
|
61551
59932
|
const operations = parsed.definitions;
|
|
61552
59933
|
let kind = "HoudiniFragment" /* Fragment */;
|