houdini 1.0.0-next.0 → 1.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cmd/generate.d.ts +0 -1
- package/build/cmd-cjs/index.js +409 -2066
- package/build/cmd-esm/index.js +409 -2066
- package/build/codegen/generators/artifacts/fieldKey.d.ts +1 -1
- package/build/codegen/generators/artifacts/index.d.ts +1 -1
- package/build/codegen/generators/artifacts/indexFile.d.ts +1 -1
- package/build/codegen/generators/artifacts/inputs.d.ts +2 -2
- package/build/codegen/generators/artifacts/operations.d.ts +2 -2
- package/build/codegen/generators/artifacts/selection.d.ts +1 -1
- package/build/codegen/generators/artifacts/utils.d.ts +1 -1
- package/build/codegen/generators/definitions/enums.d.ts +1 -1
- package/build/codegen/generators/definitions/index.d.ts +1 -1
- package/build/codegen/generators/indexFile/index.d.ts +1 -1
- package/build/codegen/generators/persistedQueries/index.d.ts +1 -1
- package/build/codegen/generators/runtime/graphqlFunction.d.ts +2 -0
- package/build/codegen/generators/runtime/index.d.ts +1 -1
- package/build/codegen/generators/runtime/injectPlugins.d.ts +7 -0
- package/build/codegen/generators/runtime/pluginIndex.d.ts +5 -0
- package/build/codegen/generators/typescript/addReferencedInputTypes.d.ts +1 -1
- package/build/codegen/generators/typescript/imperativeCache.d.ts +1 -1
- package/build/codegen/generators/typescript/index.d.ts +1 -1
- package/build/codegen/generators/typescript/inlineType.d.ts +1 -1
- package/build/codegen/generators/typescript/typeReference.d.ts +1 -1
- package/build/codegen/generators/typescript/types.d.ts +1 -1
- package/build/codegen/index.d.ts +1 -1
- package/build/codegen/transforms/addID.d.ts +1 -1
- package/build/codegen/transforms/composeQueries.d.ts +2 -2
- package/build/codegen/transforms/fragmentVariables.d.ts +2 -2
- package/build/codegen/transforms/list.d.ts +1 -1
- package/build/codegen/transforms/paginate.d.ts +1 -1
- package/build/codegen/transforms/schema.d.ts +1 -1
- package/build/codegen/transforms/typename.d.ts +1 -1
- package/build/codegen/utils/commonjs.d.ts +2 -0
- package/build/codegen/utils/flattenSelections.d.ts +2 -2
- package/build/codegen/utils/moduleExport.d.ts +1 -1
- package/build/codegen/utils/objectIdentificationSelection.d.ts +1 -1
- package/build/codegen/validators/noIDAlias.d.ts +1 -1
- package/build/codegen/validators/typeCheck.d.ts +1 -1
- package/build/codegen-cjs/index.js +330 -1977
- package/build/codegen-esm/index.js +330 -1977
- package/build/lib/config.d.ts +8 -3
- package/build/lib/fs.d.ts +1 -1
- package/build/lib/graphql.d.ts +1 -1
- package/build/lib/imports.d.ts +1 -1
- package/build/lib/types.d.ts +3 -3
- package/build/lib/walk.d.ts +4 -4
- package/build/lib-cjs/index.js +145 -1846
- package/build/lib-esm/index.js +145 -1846
- package/build/runtime/cache/cache.d.ts +10 -8
- package/build/runtime/cache/gc.d.ts +1 -1
- package/build/runtime/cache/lists.d.ts +2 -2
- package/build/runtime/cache/schema.d.ts +2 -2
- package/build/runtime/cache/stuff.d.ts +2 -2
- package/build/runtime/cache/subscription.d.ts +19 -11
- package/build/runtime/client/documentStore.d.ts +87 -0
- package/build/runtime/client/index.d.ts +25 -0
- package/build/runtime/client/plugins/cache.d.ts +8 -0
- package/build/runtime/client/plugins/fetch.d.ts +37 -0
- package/build/runtime/client/plugins/fetchParams.d.ts +9 -0
- package/build/runtime/client/plugins/index.d.ts +7 -0
- package/build/runtime/client/plugins/injectedPlugins.d.ts +3 -0
- package/build/runtime/client/plugins/mutation.d.ts +1 -0
- package/build/runtime/client/plugins/query.d.ts +2 -0
- package/build/runtime/client/plugins/subscription.d.ts +18 -0
- package/build/runtime/client/plugins/throwOnError.d.ts +7 -0
- package/build/runtime/client/utils/documentPlugins.d.ts +3 -0
- package/build/runtime/client/utils/index.d.ts +1 -0
- package/build/runtime/imports/config.d.ts +3 -0
- package/build/runtime/index.d.ts +2 -1
- package/build/runtime/lib/config.d.ts +5 -3
- package/build/runtime/lib/index.d.ts +1 -2
- package/build/runtime/lib/scalars.d.ts +5 -4
- package/build/runtime/lib/selection.d.ts +1 -1
- package/build/runtime/lib/store.d.ts +19 -0
- package/build/runtime/lib/types.d.ts +22 -9
- package/build/runtime/public/cache.d.ts +2 -2
- package/build/runtime/public/list.d.ts +2 -2
- package/build/runtime/public/record.d.ts +1 -1
- package/build/runtime/public/tests/test.d.ts +1 -1
- package/build/runtime-cjs/cache/cache.d.ts +10 -8
- package/build/runtime-cjs/cache/cache.js +5 -11
- package/build/runtime-cjs/cache/gc.d.ts +1 -1
- package/build/runtime-cjs/cache/lists.d.ts +2 -2
- package/build/runtime-cjs/cache/lists.js +2 -2
- package/build/runtime-cjs/cache/schema.d.ts +2 -2
- package/build/runtime-cjs/cache/stuff.d.ts +2 -2
- package/build/runtime-cjs/cache/subscription.d.ts +19 -11
- package/build/runtime-cjs/cache/subscription.js +95 -56
- package/build/runtime-cjs/client/documentStore.d.ts +87 -0
- package/build/runtime-cjs/client/documentStore.js +360 -0
- package/build/runtime-cjs/client/index.d.ts +25 -0
- package/build/runtime-cjs/client/index.js +87 -0
- package/build/runtime-cjs/client/plugins/cache.d.ts +8 -0
- package/build/runtime-cjs/client/plugins/cache.js +99 -0
- package/build/runtime-cjs/client/plugins/fetch.d.ts +37 -0
- package/build/runtime-cjs/{lib/networkUtils.js → client/plugins/fetch.js} +95 -3
- package/build/runtime-cjs/client/plugins/fetchParams.d.ts +9 -0
- package/build/runtime-cjs/client/plugins/fetchParams.js +40 -0
- package/build/runtime-cjs/client/plugins/index.d.ts +7 -0
- package/build/runtime-cjs/client/plugins/index.js +24 -0
- package/build/runtime-cjs/client/plugins/injectedPlugins.d.ts +3 -0
- package/build/runtime-cjs/{lib/errors.js → client/plugins/injectedPlugins.js} +7 -15
- package/build/runtime-cjs/client/plugins/mutation.d.ts +1 -0
- package/build/runtime-cjs/client/plugins/mutation.js +86 -0
- package/build/runtime-cjs/client/plugins/query.d.ts +2 -0
- package/build/runtime-cjs/client/plugins/query.js +83 -0
- package/build/runtime-cjs/client/plugins/subscription.d.ts +18 -0
- package/build/runtime-cjs/client/plugins/subscription.js +98 -0
- package/build/runtime-cjs/client/plugins/throwOnError.d.ts +7 -0
- package/build/runtime-cjs/client/plugins/throwOnError.js +47 -0
- package/build/runtime-cjs/client/utils/documentPlugins.d.ts +3 -0
- package/build/runtime-cjs/client/utils/documentPlugins.js +56 -0
- package/build/runtime-cjs/client/utils/index.d.ts +1 -0
- package/build/runtime-cjs/client/utils/index.js +18 -0
- package/build/runtime-cjs/imports/config.d.ts +3 -0
- package/build/runtime-cjs/imports/config.js +26 -0
- package/build/runtime-cjs/index.d.ts +2 -1
- package/build/runtime-cjs/index.js +1 -0
- package/build/runtime-cjs/lib/config.d.ts +5 -3
- package/build/runtime-cjs/lib/config.js +5 -4
- package/build/runtime-cjs/lib/index.d.ts +1 -2
- package/build/runtime-cjs/lib/index.js +1 -2
- package/build/runtime-cjs/lib/scalars.d.ts +5 -4
- package/build/runtime-cjs/lib/scalars.js +20 -24
- package/build/runtime-cjs/lib/selection.d.ts +1 -1
- package/build/runtime-cjs/lib/store.d.ts +19 -0
- package/build/runtime-cjs/lib/store.js +81 -0
- package/build/runtime-cjs/lib/types.d.ts +22 -9
- package/build/runtime-cjs/public/cache.d.ts +2 -2
- package/build/runtime-cjs/public/list.d.ts +2 -2
- package/build/runtime-cjs/public/list.js +2 -2
- package/build/runtime-cjs/public/record.d.ts +1 -1
- package/build/runtime-cjs/public/record.js +4 -4
- package/build/runtime-cjs/public/tests/test.d.ts +1 -1
- package/build/runtime-esm/cache/cache.d.ts +10 -8
- package/build/runtime-esm/cache/cache.js +5 -11
- package/build/runtime-esm/cache/gc.d.ts +1 -1
- package/build/runtime-esm/cache/lists.d.ts +2 -2
- package/build/runtime-esm/cache/lists.js +2 -2
- package/build/runtime-esm/cache/schema.d.ts +2 -2
- package/build/runtime-esm/cache/stuff.d.ts +2 -2
- package/build/runtime-esm/cache/subscription.d.ts +19 -11
- package/build/runtime-esm/cache/subscription.js +95 -56
- package/build/runtime-esm/client/documentStore.d.ts +87 -0
- package/build/runtime-esm/client/documentStore.js +336 -0
- package/build/runtime-esm/client/index.d.ts +25 -0
- package/build/runtime-esm/client/index.js +58 -0
- package/build/runtime-esm/client/plugins/cache.d.ts +8 -0
- package/build/runtime-esm/client/plugins/cache.js +69 -0
- package/build/runtime-esm/client/plugins/fetch.d.ts +37 -0
- package/build/runtime-esm/client/plugins/fetch.js +151 -0
- package/build/runtime-esm/client/plugins/fetchParams.d.ts +9 -0
- package/build/runtime-esm/client/plugins/fetchParams.js +16 -0
- package/build/runtime-esm/client/plugins/index.d.ts +7 -0
- package/build/runtime-esm/client/plugins/index.js +7 -0
- package/build/runtime-esm/client/plugins/injectedPlugins.d.ts +3 -0
- package/build/runtime-esm/client/plugins/injectedPlugins.js +5 -0
- package/build/runtime-esm/client/plugins/mutation.d.ts +1 -0
- package/build/runtime-esm/client/plugins/mutation.js +56 -0
- package/build/runtime-esm/client/plugins/query.d.ts +2 -0
- package/build/runtime-esm/client/plugins/query.js +53 -0
- package/build/runtime-esm/client/plugins/subscription.d.ts +18 -0
- package/build/runtime-esm/client/plugins/subscription.js +74 -0
- package/build/runtime-esm/client/plugins/throwOnError.d.ts +7 -0
- package/build/runtime-esm/client/plugins/throwOnError.js +23 -0
- package/build/runtime-esm/client/utils/documentPlugins.d.ts +3 -0
- package/build/runtime-esm/client/utils/documentPlugins.js +32 -0
- package/build/runtime-esm/client/utils/index.d.ts +1 -0
- package/build/runtime-esm/client/utils/index.js +1 -0
- package/build/runtime-esm/imports/config.d.ts +3 -0
- package/build/runtime-esm/imports/config.js +4 -0
- package/build/runtime-esm/index.d.ts +2 -1
- package/build/runtime-esm/index.js +1 -0
- package/build/runtime-esm/lib/config.d.ts +5 -3
- package/build/runtime-esm/lib/config.js +5 -4
- package/build/runtime-esm/lib/index.d.ts +1 -2
- package/build/runtime-esm/lib/index.js +1 -2
- package/build/runtime-esm/lib/scalars.d.ts +5 -4
- package/build/runtime-esm/lib/scalars.js +20 -24
- package/build/runtime-esm/lib/selection.d.ts +1 -1
- package/build/runtime-esm/lib/store.d.ts +19 -0
- package/build/runtime-esm/lib/store.js +57 -0
- package/build/runtime-esm/lib/types.d.ts +22 -9
- package/build/runtime-esm/public/cache.d.ts +2 -2
- package/build/runtime-esm/public/list.d.ts +2 -2
- package/build/runtime-esm/public/list.js +1 -1
- package/build/runtime-esm/public/record.d.ts +1 -1
- package/build/runtime-esm/public/record.js +1 -1
- package/build/runtime-esm/public/tests/test.d.ts +1 -1
- package/build/test/index.d.ts +4 -3
- package/build/test-cjs/index.js +336 -1955
- package/build/test-esm/index.js +336 -1955
- package/build/vite/ast.d.ts +1 -1
- package/build/vite/houdini.d.ts +1 -1
- package/build/vite/imports.d.ts +3 -3
- package/build/vite/index.d.ts +1 -1
- package/build/vite/schema.d.ts +1 -1
- package/build/vite-cjs/index.js +396 -2010
- package/build/vite-esm/index.js +396 -2010
- package/package.json +1 -1
- package/build/runtime/lib/errors.d.ts +0 -3
- package/build/runtime/lib/network.d.ts +0 -79
- package/build/runtime/lib/networkUtils.d.ts +0 -8
- package/build/runtime-cjs/lib/errors.d.ts +0 -3
- package/build/runtime-cjs/lib/network.d.ts +0 -79
- package/build/runtime-cjs/lib/network.js +0 -200
- package/build/runtime-cjs/lib/networkUtils.d.ts +0 -8
- package/build/runtime-esm/lib/errors.d.ts +0 -3
- package/build/runtime-esm/lib/errors.js +0 -11
- package/build/runtime-esm/lib/network.d.ts +0 -79
- package/build/runtime-esm/lib/network.js +0 -170
- package/build/runtime-esm/lib/networkUtils.d.ts +0 -8
- package/build/runtime-esm/lib/networkUtils.js +0 -60
package/build/vite-cjs/index.js
CHANGED
|
@@ -13663,18 +13663,18 @@ var require_execute = __commonJS({
|
|
|
13663
13663
|
}
|
|
13664
13664
|
var returnType = fieldDef.type;
|
|
13665
13665
|
var resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver;
|
|
13666
|
-
var
|
|
13666
|
+
var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path2);
|
|
13667
13667
|
try {
|
|
13668
13668
|
var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], exeContext.variableValues);
|
|
13669
13669
|
var _contextValue = exeContext.contextValue;
|
|
13670
|
-
var result = resolveFn(source, args, _contextValue,
|
|
13670
|
+
var result = resolveFn(source, args, _contextValue, info);
|
|
13671
13671
|
var completed;
|
|
13672
13672
|
if ((0, _isPromise.default)(result)) {
|
|
13673
13673
|
completed = result.then(function(resolved) {
|
|
13674
|
-
return completeValue(exeContext, returnType, fieldNodes,
|
|
13674
|
+
return completeValue(exeContext, returnType, fieldNodes, info, path2, resolved);
|
|
13675
13675
|
});
|
|
13676
13676
|
} else {
|
|
13677
|
-
completed = completeValue(exeContext, returnType, fieldNodes,
|
|
13677
|
+
completed = completeValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
13678
13678
|
}
|
|
13679
13679
|
if ((0, _isPromise.default)(completed)) {
|
|
13680
13680
|
return completed.then(void 0, function(rawError) {
|
|
@@ -13709,14 +13709,14 @@ var require_execute = __commonJS({
|
|
|
13709
13709
|
exeContext.errors.push(error);
|
|
13710
13710
|
return null;
|
|
13711
13711
|
}
|
|
13712
|
-
function completeValue(exeContext, returnType, fieldNodes,
|
|
13712
|
+
function completeValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
13713
13713
|
if (result instanceof Error) {
|
|
13714
13714
|
throw result;
|
|
13715
13715
|
}
|
|
13716
13716
|
if ((0, _definition.isNonNullType)(returnType)) {
|
|
13717
|
-
var completed = completeValue(exeContext, returnType.ofType, fieldNodes,
|
|
13717
|
+
var completed = completeValue(exeContext, returnType.ofType, fieldNodes, info, path2, result);
|
|
13718
13718
|
if (completed === null) {
|
|
13719
|
-
throw new Error("Cannot return null for non-nullable field ".concat(
|
|
13719
|
+
throw new Error("Cannot return null for non-nullable field ".concat(info.parentType.name, ".").concat(info.fieldName, "."));
|
|
13720
13720
|
}
|
|
13721
13721
|
return completed;
|
|
13722
13722
|
}
|
|
@@ -13724,20 +13724,20 @@ var require_execute = __commonJS({
|
|
|
13724
13724
|
return null;
|
|
13725
13725
|
}
|
|
13726
13726
|
if ((0, _definition.isListType)(returnType)) {
|
|
13727
|
-
return completeListValue(exeContext, returnType, fieldNodes,
|
|
13727
|
+
return completeListValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
13728
13728
|
}
|
|
13729
13729
|
if ((0, _definition.isLeafType)(returnType)) {
|
|
13730
13730
|
return completeLeafValue(returnType, result);
|
|
13731
13731
|
}
|
|
13732
13732
|
if ((0, _definition.isAbstractType)(returnType)) {
|
|
13733
|
-
return completeAbstractValue(exeContext, returnType, fieldNodes,
|
|
13733
|
+
return completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
13734
13734
|
}
|
|
13735
13735
|
if ((0, _definition.isObjectType)(returnType)) {
|
|
13736
|
-
return completeObjectValue(exeContext, returnType, fieldNodes,
|
|
13736
|
+
return completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
13737
13737
|
}
|
|
13738
13738
|
(0, _invariant.default)(0, "Cannot complete value of unexpected output type: " + (0, _inspect.default)(returnType));
|
|
13739
13739
|
}
|
|
13740
|
-
function completeListValue(exeContext, returnType, fieldNodes,
|
|
13740
|
+
function completeListValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
13741
13741
|
var itemType = returnType.ofType;
|
|
13742
13742
|
var containsPromise = false;
|
|
13743
13743
|
var completedResults = (0, _safeArrayFrom.default)(result, function(item, index) {
|
|
@@ -13746,10 +13746,10 @@ var require_execute = __commonJS({
|
|
|
13746
13746
|
var completedItem;
|
|
13747
13747
|
if ((0, _isPromise.default)(item)) {
|
|
13748
13748
|
completedItem = item.then(function(resolved) {
|
|
13749
|
-
return completeValue(exeContext, itemType, fieldNodes,
|
|
13749
|
+
return completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved);
|
|
13750
13750
|
});
|
|
13751
13751
|
} else {
|
|
13752
|
-
completedItem = completeValue(exeContext, itemType, fieldNodes,
|
|
13752
|
+
completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item);
|
|
13753
13753
|
}
|
|
13754
13754
|
if ((0, _isPromise.default)(completedItem)) {
|
|
13755
13755
|
containsPromise = true;
|
|
@@ -13765,7 +13765,7 @@ var require_execute = __commonJS({
|
|
|
13765
13765
|
}
|
|
13766
13766
|
});
|
|
13767
13767
|
if (completedResults == null) {
|
|
13768
|
-
throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(
|
|
13768
|
+
throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(info.parentType.name, ".").concat(info.fieldName, '".'));
|
|
13769
13769
|
}
|
|
13770
13770
|
return containsPromise ? Promise.all(completedResults) : completedResults;
|
|
13771
13771
|
}
|
|
@@ -13776,25 +13776,25 @@ var require_execute = __commonJS({
|
|
|
13776
13776
|
}
|
|
13777
13777
|
return serializedResult;
|
|
13778
13778
|
}
|
|
13779
|
-
function completeAbstractValue(exeContext, returnType, fieldNodes,
|
|
13779
|
+
function completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
13780
13780
|
var _returnType$resolveTy;
|
|
13781
13781
|
var resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver;
|
|
13782
13782
|
var contextValue = exeContext.contextValue;
|
|
13783
|
-
var runtimeType = resolveTypeFn(result, contextValue,
|
|
13783
|
+
var runtimeType = resolveTypeFn(result, contextValue, info, returnType);
|
|
13784
13784
|
if ((0, _isPromise.default)(runtimeType)) {
|
|
13785
13785
|
return runtimeType.then(function(resolvedRuntimeType) {
|
|
13786
|
-
return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes,
|
|
13786
|
+
return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
|
|
13787
13787
|
});
|
|
13788
13788
|
}
|
|
13789
|
-
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes,
|
|
13789
|
+
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
|
|
13790
13790
|
}
|
|
13791
|
-
function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes,
|
|
13791
|
+
function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info, result) {
|
|
13792
13792
|
if (runtimeTypeOrName == null) {
|
|
13793
|
-
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(
|
|
13793
|
+
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);
|
|
13794
13794
|
}
|
|
13795
13795
|
var runtimeTypeName = (0, _definition.isNamedType)(runtimeTypeOrName) ? runtimeTypeOrName.name : runtimeTypeOrName;
|
|
13796
13796
|
if (typeof runtimeTypeName !== "string") {
|
|
13797
|
-
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(
|
|
13797
|
+
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), '".'));
|
|
13798
13798
|
}
|
|
13799
13799
|
var runtimeType = exeContext.schema.getType(runtimeTypeName);
|
|
13800
13800
|
if (runtimeType == null) {
|
|
@@ -13808,9 +13808,9 @@ var require_execute = __commonJS({
|
|
|
13808
13808
|
}
|
|
13809
13809
|
return runtimeType;
|
|
13810
13810
|
}
|
|
13811
|
-
function completeObjectValue(exeContext, returnType, fieldNodes,
|
|
13811
|
+
function completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
13812
13812
|
if (returnType.isTypeOf) {
|
|
13813
|
-
var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue,
|
|
13813
|
+
var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info);
|
|
13814
13814
|
if ((0, _isPromise.default)(isTypeOf)) {
|
|
13815
13815
|
return isTypeOf.then(function(resolvedIsTypeOf) {
|
|
13816
13816
|
if (!resolvedIsTypeOf) {
|
|
@@ -13844,16 +13844,16 @@ var require_execute = __commonJS({
|
|
|
13844
13844
|
}
|
|
13845
13845
|
return subFieldNodes;
|
|
13846
13846
|
}
|
|
13847
|
-
var defaultTypeResolver = function defaultTypeResolver2(value, contextValue,
|
|
13847
|
+
var defaultTypeResolver = function defaultTypeResolver2(value, contextValue, info, abstractType) {
|
|
13848
13848
|
if ((0, _isObjectLike.default)(value) && typeof value.__typename === "string") {
|
|
13849
13849
|
return value.__typename;
|
|
13850
13850
|
}
|
|
13851
|
-
var possibleTypes =
|
|
13851
|
+
var possibleTypes = info.schema.getPossibleTypes(abstractType);
|
|
13852
13852
|
var promisedIsTypeOfResults = [];
|
|
13853
13853
|
for (var i2 = 0; i2 < possibleTypes.length; i2++) {
|
|
13854
13854
|
var type = possibleTypes[i2];
|
|
13855
13855
|
if (type.isTypeOf) {
|
|
13856
|
-
var isTypeOfResult = type.isTypeOf(value, contextValue,
|
|
13856
|
+
var isTypeOfResult = type.isTypeOf(value, contextValue, info);
|
|
13857
13857
|
if ((0, _isPromise.default)(isTypeOfResult)) {
|
|
13858
13858
|
promisedIsTypeOfResults[i2] = isTypeOfResult;
|
|
13859
13859
|
} else if (isTypeOfResult) {
|
|
@@ -13872,11 +13872,11 @@ var require_execute = __commonJS({
|
|
|
13872
13872
|
}
|
|
13873
13873
|
};
|
|
13874
13874
|
exports.defaultTypeResolver = defaultTypeResolver;
|
|
13875
|
-
var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue,
|
|
13875
|
+
var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue, info) {
|
|
13876
13876
|
if ((0, _isObjectLike.default)(source) || typeof source === "function") {
|
|
13877
|
-
var property = source[
|
|
13877
|
+
var property = source[info.fieldName];
|
|
13878
13878
|
if (typeof property === "function") {
|
|
13879
|
-
return source[
|
|
13879
|
+
return source[info.fieldName](args, contextValue, info);
|
|
13880
13880
|
}
|
|
13881
13881
|
return property;
|
|
13882
13882
|
}
|
|
@@ -13902,7 +13902,7 @@ var require_graphql = __commonJS({
|
|
|
13902
13902
|
Object.defineProperty(exports, "__esModule", {
|
|
13903
13903
|
value: true
|
|
13904
13904
|
});
|
|
13905
|
-
exports.graphql =
|
|
13905
|
+
exports.graphql = graphql28;
|
|
13906
13906
|
exports.graphqlSync = graphqlSync;
|
|
13907
13907
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
13908
13908
|
var _parser = require_parser();
|
|
@@ -13912,7 +13912,7 @@ var require_graphql = __commonJS({
|
|
|
13912
13912
|
function _interopRequireDefault(obj) {
|
|
13913
13913
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
13914
13914
|
}
|
|
13915
|
-
function
|
|
13915
|
+
function graphql28(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
13916
13916
|
var _arguments = arguments;
|
|
13917
13917
|
return new Promise(function(resolve2) {
|
|
13918
13918
|
return resolve2(
|
|
@@ -14896,13 +14896,13 @@ var require_subscribe = __commonJS({
|
|
|
14896
14896
|
throw new _GraphQLError.GraphQLError('The subscription field "'.concat(fieldName, '" is not defined.'), fieldNodes);
|
|
14897
14897
|
}
|
|
14898
14898
|
var path2 = (0, _Path.addPath)(void 0, responseName, type.name);
|
|
14899
|
-
var
|
|
14899
|
+
var info = (0, _execute.buildResolveInfo)(exeContext, fieldDef, fieldNodes, type, path2);
|
|
14900
14900
|
return new Promise(function(resolveResult) {
|
|
14901
14901
|
var _fieldDef$subscribe;
|
|
14902
14902
|
var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], variableValues);
|
|
14903
14903
|
var contextValue = exeContext.contextValue;
|
|
14904
14904
|
var resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.fieldResolver;
|
|
14905
|
-
resolveResult(resolveFn(rootValue, args, contextValue,
|
|
14905
|
+
resolveResult(resolveFn(rootValue, args, contextValue, info));
|
|
14906
14906
|
}).then(function(eventStream) {
|
|
14907
14907
|
if (eventStream instanceof Error) {
|
|
14908
14908
|
throw (0, _locatedError.locatedError)(eventStream, fieldNodes, (0, _Path.pathToArray)(path2));
|
|
@@ -23947,42 +23947,42 @@ var require_node = __commonJS({
|
|
|
23947
23947
|
return Link2;
|
|
23948
23948
|
}(events_1.EventEmitter);
|
|
23949
23949
|
exports.Link = Link;
|
|
23950
|
-
var
|
|
23951
|
-
function
|
|
23950
|
+
var File3 = function() {
|
|
23951
|
+
function File4(link, node, flags, fd) {
|
|
23952
23952
|
this.position = 0;
|
|
23953
23953
|
this.link = link;
|
|
23954
23954
|
this.node = node;
|
|
23955
23955
|
this.flags = flags;
|
|
23956
23956
|
this.fd = fd;
|
|
23957
23957
|
}
|
|
23958
|
-
|
|
23958
|
+
File4.prototype.getString = function(encoding) {
|
|
23959
23959
|
if (encoding === void 0) {
|
|
23960
23960
|
encoding = "utf8";
|
|
23961
23961
|
}
|
|
23962
23962
|
return this.node.getString();
|
|
23963
23963
|
};
|
|
23964
|
-
|
|
23964
|
+
File4.prototype.setString = function(str) {
|
|
23965
23965
|
this.node.setString(str);
|
|
23966
23966
|
};
|
|
23967
|
-
|
|
23967
|
+
File4.prototype.getBuffer = function() {
|
|
23968
23968
|
return this.node.getBuffer();
|
|
23969
23969
|
};
|
|
23970
|
-
|
|
23970
|
+
File4.prototype.setBuffer = function(buf) {
|
|
23971
23971
|
this.node.setBuffer(buf);
|
|
23972
23972
|
};
|
|
23973
|
-
|
|
23973
|
+
File4.prototype.getSize = function() {
|
|
23974
23974
|
return this.node.getSize();
|
|
23975
23975
|
};
|
|
23976
|
-
|
|
23976
|
+
File4.prototype.truncate = function(len) {
|
|
23977
23977
|
this.node.truncate(len);
|
|
23978
23978
|
};
|
|
23979
|
-
|
|
23979
|
+
File4.prototype.seekTo = function(position) {
|
|
23980
23980
|
this.position = position;
|
|
23981
23981
|
};
|
|
23982
|
-
|
|
23982
|
+
File4.prototype.stats = function() {
|
|
23983
23983
|
return Stats_1.default.build(this.node);
|
|
23984
23984
|
};
|
|
23985
|
-
|
|
23985
|
+
File4.prototype.write = function(buf, offset, length, position) {
|
|
23986
23986
|
if (offset === void 0) {
|
|
23987
23987
|
offset = 0;
|
|
23988
23988
|
}
|
|
@@ -23997,7 +23997,7 @@ var require_node = __commonJS({
|
|
|
23997
23997
|
this.position = position + bytes;
|
|
23998
23998
|
return bytes;
|
|
23999
23999
|
};
|
|
24000
|
-
|
|
24000
|
+
File4.prototype.read = function(buf, offset, length, position) {
|
|
24001
24001
|
if (offset === void 0) {
|
|
24002
24002
|
offset = 0;
|
|
24003
24003
|
}
|
|
@@ -24010,15 +24010,15 @@ var require_node = __commonJS({
|
|
|
24010
24010
|
this.position = position + bytes;
|
|
24011
24011
|
return bytes;
|
|
24012
24012
|
};
|
|
24013
|
-
|
|
24013
|
+
File4.prototype.chmod = function(perm) {
|
|
24014
24014
|
this.node.chmod(perm);
|
|
24015
24015
|
};
|
|
24016
|
-
|
|
24016
|
+
File4.prototype.chown = function(uid, gid) {
|
|
24017
24017
|
this.node.chown(uid, gid);
|
|
24018
24018
|
};
|
|
24019
|
-
return
|
|
24019
|
+
return File4;
|
|
24020
24020
|
}();
|
|
24021
|
-
exports.File =
|
|
24021
|
+
exports.File = File3;
|
|
24022
24022
|
}
|
|
24023
24023
|
});
|
|
24024
24024
|
|
|
@@ -30127,9 +30127,9 @@ var require_streams = __commonJS({
|
|
|
30127
30127
|
}
|
|
30128
30128
|
}
|
|
30129
30129
|
try {
|
|
30130
|
-
const { Blob:
|
|
30131
|
-
if (
|
|
30132
|
-
|
|
30130
|
+
const { Blob: Blob3 } = require("buffer");
|
|
30131
|
+
if (Blob3 && !Blob3.prototype.stream) {
|
|
30132
|
+
Blob3.prototype.stream = function name2(params) {
|
|
30133
30133
|
let position = 0;
|
|
30134
30134
|
const blob = this;
|
|
30135
30135
|
return new ReadableStream({
|
|
@@ -30180,12 +30180,12 @@ async function* toIterator(parts, clone2 = true) {
|
|
|
30180
30180
|
}
|
|
30181
30181
|
}
|
|
30182
30182
|
}
|
|
30183
|
-
var import_streams, POOL_SIZE, _Blob,
|
|
30183
|
+
var import_streams, POOL_SIZE, _Blob, Blob2, fetch_blob_default;
|
|
30184
30184
|
var init_fetch_blob = __esm({
|
|
30185
30185
|
"../../node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/index.js"() {
|
|
30186
30186
|
import_streams = __toESM(require_streams(), 1);
|
|
30187
30187
|
POOL_SIZE = 65536;
|
|
30188
|
-
_Blob = class
|
|
30188
|
+
_Blob = class Blob {
|
|
30189
30189
|
#parts = [];
|
|
30190
30190
|
#type = "";
|
|
30191
30191
|
#size = 0;
|
|
@@ -30209,7 +30209,7 @@ var init_fetch_blob = __esm({
|
|
|
30209
30209
|
part = new Uint8Array(element.buffer.slice(element.byteOffset, element.byteOffset + element.byteLength));
|
|
30210
30210
|
} else if (element instanceof ArrayBuffer) {
|
|
30211
30211
|
part = new Uint8Array(element.slice(0));
|
|
30212
|
-
} else if (element instanceof
|
|
30212
|
+
} else if (element instanceof Blob) {
|
|
30213
30213
|
part = element;
|
|
30214
30214
|
} else {
|
|
30215
30215
|
part = encoder.encode(`${element}`);
|
|
@@ -30288,7 +30288,7 @@ var init_fetch_blob = __esm({
|
|
|
30288
30288
|
relativeStart = 0;
|
|
30289
30289
|
}
|
|
30290
30290
|
}
|
|
30291
|
-
const blob = new
|
|
30291
|
+
const blob = new Blob([], { type: String(type).toLowerCase() });
|
|
30292
30292
|
blob.#size = span;
|
|
30293
30293
|
blob.#parts = blobParts;
|
|
30294
30294
|
return blob;
|
|
@@ -30305,17 +30305,17 @@ var init_fetch_blob = __esm({
|
|
|
30305
30305
|
type: { enumerable: true },
|
|
30306
30306
|
slice: { enumerable: true }
|
|
30307
30307
|
});
|
|
30308
|
-
|
|
30309
|
-
fetch_blob_default =
|
|
30308
|
+
Blob2 = _Blob;
|
|
30309
|
+
fetch_blob_default = Blob2;
|
|
30310
30310
|
}
|
|
30311
30311
|
});
|
|
30312
30312
|
|
|
30313
30313
|
// ../../node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/file.js
|
|
30314
|
-
var _File,
|
|
30314
|
+
var _File, File2, file_default;
|
|
30315
30315
|
var init_file = __esm({
|
|
30316
30316
|
"../../node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/file.js"() {
|
|
30317
30317
|
init_fetch_blob();
|
|
30318
|
-
_File = class
|
|
30318
|
+
_File = class File extends fetch_blob_default {
|
|
30319
30319
|
#lastModified = 0;
|
|
30320
30320
|
#name = "";
|
|
30321
30321
|
constructor(fileBits, fileName, options = {}) {
|
|
@@ -30344,8 +30344,8 @@ var init_file = __esm({
|
|
|
30344
30344
|
return !!object && object instanceof fetch_blob_default && /^(File)$/.test(object[Symbol.toStringTag]);
|
|
30345
30345
|
}
|
|
30346
30346
|
};
|
|
30347
|
-
|
|
30348
|
-
file_default =
|
|
30347
|
+
File2 = _File;
|
|
30348
|
+
file_default = File2;
|
|
30349
30349
|
}
|
|
30350
30350
|
});
|
|
30351
30351
|
|
|
@@ -30363,7 +30363,7 @@ Content-Type: ${v.type || "application/octet-stream"}\r
|
|
|
30363
30363
|
c.push(`--${b}--`);
|
|
30364
30364
|
return new B(c, { type: "multipart/form-data; boundary=" + b });
|
|
30365
30365
|
}
|
|
30366
|
-
var t, i, h, r, m, f, e, x,
|
|
30366
|
+
var t, i, h, r, m, f, e, x, FormData;
|
|
30367
30367
|
var init_esm_min = __esm({
|
|
30368
30368
|
"../../node_modules/.pnpm/formdata-polyfill@4.0.10/node_modules/formdata-polyfill/esm.min.js"() {
|
|
30369
30369
|
init_fetch_blob();
|
|
@@ -30378,7 +30378,7 @@ var init_esm_min = __esm({
|
|
|
30378
30378
|
throw new TypeError(`Failed to execute '${n}' on 'FormData': ${e2} arguments required, but only ${a.length} present.`);
|
|
30379
30379
|
}
|
|
30380
30380
|
};
|
|
30381
|
-
|
|
30381
|
+
FormData = class FormData2 {
|
|
30382
30382
|
#d = [];
|
|
30383
30383
|
constructor(...a) {
|
|
30384
30384
|
if (a.length)
|
|
@@ -30544,7 +30544,7 @@ async function toFormData(Body2, ct) {
|
|
|
30544
30544
|
let contentType;
|
|
30545
30545
|
let filename;
|
|
30546
30546
|
const entryChunks = [];
|
|
30547
|
-
const formData = new
|
|
30547
|
+
const formData = new FormData();
|
|
30548
30548
|
const onPartData = (ui8a) => {
|
|
30549
30549
|
entryValue += decoder.decode(ui8a, { stream: true });
|
|
30550
30550
|
};
|
|
@@ -57755,18 +57755,18 @@ var require_lines = __commonJS({
|
|
|
57755
57755
|
assert_1.default.strictEqual(typeof pos, "object");
|
|
57756
57756
|
assert_1.default.strictEqual(typeof pos.line, "number");
|
|
57757
57757
|
assert_1.default.strictEqual(typeof pos.column, "number");
|
|
57758
|
-
var line = pos.line, column = pos.column, secret = this, infos = secret.infos,
|
|
57759
|
-
if (typeof
|
|
57758
|
+
var line = pos.line, column = pos.column, secret = this, infos = secret.infos, info = infos[line - 1], c = column;
|
|
57759
|
+
if (typeof info === "undefined" || c < 0)
|
|
57760
57760
|
return "";
|
|
57761
57761
|
var indent2 = this.getIndentAt(line);
|
|
57762
57762
|
if (c < indent2)
|
|
57763
57763
|
return " ";
|
|
57764
|
-
c +=
|
|
57765
|
-
if (c ===
|
|
57764
|
+
c += info.sliceStart - indent2;
|
|
57765
|
+
if (c === info.sliceEnd && line < this.length)
|
|
57766
57766
|
return "\n";
|
|
57767
|
-
if (c >=
|
|
57767
|
+
if (c >= info.sliceEnd)
|
|
57768
57768
|
return "";
|
|
57769
|
-
return
|
|
57769
|
+
return info.line.charAt(c);
|
|
57770
57770
|
};
|
|
57771
57771
|
Lines2.prototype.stripMargin = function(width, skipFirstLine) {
|
|
57772
57772
|
if (width === 0)
|
|
@@ -57774,11 +57774,11 @@ var require_lines = __commonJS({
|
|
|
57774
57774
|
assert_1.default.ok(width > 0, "negative margin: " + width);
|
|
57775
57775
|
if (skipFirstLine && this.length === 1)
|
|
57776
57776
|
return this;
|
|
57777
|
-
var lines = new Lines2(this.infos.map(function(
|
|
57778
|
-
if (
|
|
57779
|
-
|
|
57777
|
+
var lines = new Lines2(this.infos.map(function(info, i2) {
|
|
57778
|
+
if (info.line && (i2 > 0 || !skipFirstLine)) {
|
|
57779
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: Math.max(0, info.indent - width) });
|
|
57780
57780
|
}
|
|
57781
|
-
return
|
|
57781
|
+
return info;
|
|
57782
57782
|
}));
|
|
57783
57783
|
if (this.mappings.length > 0) {
|
|
57784
57784
|
var newMappings_1 = lines.mappings;
|
|
@@ -57793,11 +57793,11 @@ var require_lines = __commonJS({
|
|
|
57793
57793
|
if (by === 0) {
|
|
57794
57794
|
return this;
|
|
57795
57795
|
}
|
|
57796
|
-
var lines = new Lines2(this.infos.map(function(
|
|
57797
|
-
if (
|
|
57798
|
-
|
|
57796
|
+
var lines = new Lines2(this.infos.map(function(info) {
|
|
57797
|
+
if (info.line && !info.locked) {
|
|
57798
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
|
|
57799
57799
|
}
|
|
57800
|
-
return
|
|
57800
|
+
return info;
|
|
57801
57801
|
}));
|
|
57802
57802
|
if (this.mappings.length > 0) {
|
|
57803
57803
|
var newMappings_2 = lines.mappings;
|
|
@@ -57815,11 +57815,11 @@ var require_lines = __commonJS({
|
|
|
57815
57815
|
if (this.length < 2) {
|
|
57816
57816
|
return this;
|
|
57817
57817
|
}
|
|
57818
|
-
var lines = new Lines2(this.infos.map(function(
|
|
57819
|
-
if (i2 > 0 &&
|
|
57820
|
-
|
|
57818
|
+
var lines = new Lines2(this.infos.map(function(info, i2) {
|
|
57819
|
+
if (i2 > 0 && info.line && !info.locked) {
|
|
57820
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
|
|
57821
57821
|
}
|
|
57822
|
-
return
|
|
57822
|
+
return info;
|
|
57823
57823
|
}));
|
|
57824
57824
|
if (this.mappings.length > 0) {
|
|
57825
57825
|
var newMappings_3 = lines.mappings;
|
|
@@ -57834,8 +57834,8 @@ var require_lines = __commonJS({
|
|
|
57834
57834
|
if (this.length < 2) {
|
|
57835
57835
|
return this;
|
|
57836
57836
|
}
|
|
57837
|
-
return new Lines2(this.infos.map(function(
|
|
57838
|
-
return tslib_1.__assign(tslib_1.__assign({},
|
|
57837
|
+
return new Lines2(this.infos.map(function(info, i2) {
|
|
57838
|
+
return tslib_1.__assign(tslib_1.__assign({}, info), { locked: i2 > 0 });
|
|
57839
57839
|
}));
|
|
57840
57840
|
};
|
|
57841
57841
|
Lines2.prototype.getIndentAt = function(line) {
|
|
@@ -57849,14 +57849,14 @@ var require_lines = __commonJS({
|
|
|
57849
57849
|
var counts = [];
|
|
57850
57850
|
var lastIndent = 0;
|
|
57851
57851
|
for (var line = 1, last = this.length; line <= last; ++line) {
|
|
57852
|
-
var
|
|
57853
|
-
var sliced =
|
|
57852
|
+
var info = this.infos[line - 1];
|
|
57853
|
+
var sliced = info.line.slice(info.sliceStart, info.sliceEnd);
|
|
57854
57854
|
if (isOnlyWhitespace(sliced)) {
|
|
57855
57855
|
continue;
|
|
57856
57856
|
}
|
|
57857
|
-
var diff = Math.abs(
|
|
57857
|
+
var diff = Math.abs(info.indent - lastIndent);
|
|
57858
57858
|
counts[diff] = ~~counts[diff] + 1;
|
|
57859
|
-
lastIndent =
|
|
57859
|
+
lastIndent = info.indent;
|
|
57860
57860
|
}
|
|
57861
57861
|
var maxCount = -1;
|
|
57862
57862
|
var result = 2;
|
|
@@ -57879,20 +57879,20 @@ var require_lines = __commonJS({
|
|
|
57879
57879
|
return isOnlyWhitespace(this.toString());
|
|
57880
57880
|
};
|
|
57881
57881
|
Lines2.prototype.isPrecededOnlyByWhitespace = function(pos) {
|
|
57882
|
-
var
|
|
57883
|
-
var indent2 = Math.max(
|
|
57882
|
+
var info = this.infos[pos.line - 1];
|
|
57883
|
+
var indent2 = Math.max(info.indent, 0);
|
|
57884
57884
|
var diff = pos.column - indent2;
|
|
57885
57885
|
if (diff <= 0) {
|
|
57886
57886
|
return true;
|
|
57887
57887
|
}
|
|
57888
|
-
var start =
|
|
57889
|
-
var end = Math.min(start + diff,
|
|
57890
|
-
var prefix =
|
|
57888
|
+
var start = info.sliceStart;
|
|
57889
|
+
var end = Math.min(start + diff, info.sliceEnd);
|
|
57890
|
+
var prefix = info.line.slice(start, end);
|
|
57891
57891
|
return isOnlyWhitespace(prefix);
|
|
57892
57892
|
};
|
|
57893
57893
|
Lines2.prototype.getLineLength = function(line) {
|
|
57894
|
-
var
|
|
57895
|
-
return this.getIndentAt(line) +
|
|
57894
|
+
var info = this.infos[line - 1];
|
|
57895
|
+
return this.getIndentAt(line) + info.sliceEnd - info.sliceStart;
|
|
57896
57896
|
};
|
|
57897
57897
|
Lines2.prototype.nextPos = function(pos, skipSpaces) {
|
|
57898
57898
|
if (skipSpaces === void 0) {
|
|
@@ -58058,20 +58058,20 @@ var require_lines = __commonJS({
|
|
|
58058
58058
|
var _a = (0, options_1.normalize)(options), tabWidth = _a.tabWidth, useTabs = _a.useTabs, reuseWhitespace = _a.reuseWhitespace, lineTerminator = _a.lineTerminator;
|
|
58059
58059
|
var parts = [];
|
|
58060
58060
|
for (var line = start.line; line <= end.line; ++line) {
|
|
58061
|
-
var
|
|
58061
|
+
var info = this.infos[line - 1];
|
|
58062
58062
|
if (line === start.line) {
|
|
58063
58063
|
if (line === end.line) {
|
|
58064
|
-
|
|
58064
|
+
info = sliceInfo(info, start.column, end.column);
|
|
58065
58065
|
} else {
|
|
58066
|
-
|
|
58066
|
+
info = sliceInfo(info, start.column);
|
|
58067
58067
|
}
|
|
58068
58068
|
} else if (line === end.line) {
|
|
58069
|
-
|
|
58069
|
+
info = sliceInfo(info, 0, end.column);
|
|
58070
58070
|
}
|
|
58071
|
-
var indent2 = Math.max(
|
|
58072
|
-
var before_1 =
|
|
58071
|
+
var indent2 = Math.max(info.indent, 0);
|
|
58072
|
+
var before_1 = info.line.slice(0, info.sliceStart);
|
|
58073
58073
|
if (reuseWhitespace && isOnlyWhitespace(before_1) && countSpaces(before_1, tabWidth) === indent2) {
|
|
58074
|
-
parts.push(
|
|
58074
|
+
parts.push(info.line.slice(0, info.sliceEnd));
|
|
58075
58075
|
continue;
|
|
58076
58076
|
}
|
|
58077
58077
|
var tabs = 0;
|
|
@@ -58087,7 +58087,7 @@ var require_lines = __commonJS({
|
|
|
58087
58087
|
if (spaces > 0) {
|
|
58088
58088
|
result += new Array(spaces + 1).join(" ");
|
|
58089
58089
|
}
|
|
58090
|
-
result +=
|
|
58090
|
+
result += info.line.slice(info.sliceStart, info.sliceEnd);
|
|
58091
58091
|
parts.push(result);
|
|
58092
58092
|
}
|
|
58093
58093
|
return parts.join(lineTerminator);
|
|
@@ -58105,12 +58105,12 @@ var require_lines = __commonJS({
|
|
|
58105
58105
|
return;
|
|
58106
58106
|
}
|
|
58107
58107
|
if (prevInfo) {
|
|
58108
|
-
var
|
|
58109
|
-
var indent2 = new Array(
|
|
58108
|
+
var info = linesOrNull.infos[0];
|
|
58109
|
+
var indent2 = new Array(info.indent + 1).join(" ");
|
|
58110
58110
|
var prevLine_1 = infos.length;
|
|
58111
58111
|
var prevColumn_1 = Math.max(prevInfo.indent, 0) + prevInfo.sliceEnd - prevInfo.sliceStart;
|
|
58112
|
-
prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent2 +
|
|
58113
|
-
prevInfo.locked = prevInfo.locked ||
|
|
58112
|
+
prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent2 + info.line.slice(info.sliceStart, info.sliceEnd);
|
|
58113
|
+
prevInfo.locked = prevInfo.locked || info.locked;
|
|
58114
58114
|
prevInfo.sliceEnd = prevInfo.line.length;
|
|
58115
58115
|
if (linesOrNull.mappings.length > 0) {
|
|
58116
58116
|
linesOrNull.mappings.forEach(function(mapping) {
|
|
@@ -58120,9 +58120,9 @@ var require_lines = __commonJS({
|
|
|
58120
58120
|
} else if (linesOrNull.mappings.length > 0) {
|
|
58121
58121
|
mappings.push.apply(mappings, linesOrNull.mappings);
|
|
58122
58122
|
}
|
|
58123
|
-
linesOrNull.infos.forEach(function(
|
|
58123
|
+
linesOrNull.infos.forEach(function(info2, i2) {
|
|
58124
58124
|
if (!prevInfo || i2 > 0) {
|
|
58125
|
-
prevInfo = tslib_1.__assign({},
|
|
58125
|
+
prevInfo = tslib_1.__assign({}, info2);
|
|
58126
58126
|
infos.push(prevInfo);
|
|
58127
58127
|
}
|
|
58128
58128
|
});
|
|
@@ -58226,10 +58226,10 @@ var require_lines = __commonJS({
|
|
|
58226
58226
|
function isOnlyWhitespace(string) {
|
|
58227
58227
|
return !/\S/.test(string);
|
|
58228
58228
|
}
|
|
58229
|
-
function sliceInfo(
|
|
58230
|
-
var sliceStart =
|
|
58231
|
-
var sliceEnd =
|
|
58232
|
-
var indent2 = Math.max(
|
|
58229
|
+
function sliceInfo(info, startCol, endCol) {
|
|
58230
|
+
var sliceStart = info.sliceStart;
|
|
58231
|
+
var sliceEnd = info.sliceEnd;
|
|
58232
|
+
var indent2 = Math.max(info.indent, 0);
|
|
58233
58233
|
var lineLength = indent2 + sliceEnd - sliceStart;
|
|
58234
58234
|
if (typeof endCol === "undefined") {
|
|
58235
58235
|
endCol = lineLength;
|
|
@@ -58255,11 +58255,11 @@ var require_lines = __commonJS({
|
|
|
58255
58255
|
assert_1.default.ok(indent2 >= 0);
|
|
58256
58256
|
assert_1.default.ok(sliceStart <= sliceEnd);
|
|
58257
58257
|
assert_1.default.strictEqual(lineLength, indent2 + sliceEnd - sliceStart);
|
|
58258
|
-
if (
|
|
58259
|
-
return
|
|
58258
|
+
if (info.indent === indent2 && info.sliceStart === sliceStart && info.sliceEnd === sliceEnd) {
|
|
58259
|
+
return info;
|
|
58260
58260
|
}
|
|
58261
58261
|
return {
|
|
58262
|
-
line:
|
|
58262
|
+
line: info.line,
|
|
58263
58263
|
indent: indent2,
|
|
58264
58264
|
locked: false,
|
|
58265
58265
|
sliceStart,
|
|
@@ -61266,9 +61266,9 @@ var require_printer2 = __commonJS({
|
|
|
61266
61266
|
var prevTrailingSpace = null;
|
|
61267
61267
|
var len = filtered.length;
|
|
61268
61268
|
var parts = [];
|
|
61269
|
-
filtered.forEach(function(
|
|
61270
|
-
var printed =
|
|
61271
|
-
var stmt =
|
|
61269
|
+
filtered.forEach(function(info, i2) {
|
|
61270
|
+
var printed = info.printed;
|
|
61271
|
+
var stmt = info.node;
|
|
61272
61272
|
var multiLine = printed.length > 1;
|
|
61273
61273
|
var notFirst = i2 > 0;
|
|
61274
61274
|
var notLast = i2 < len - 1;
|
|
@@ -61857,20 +61857,20 @@ async function checkConf(params) {
|
|
|
61857
61857
|
return paramsChecked;
|
|
61858
61858
|
}
|
|
61859
61859
|
async function shouldRun(absolutePath, watchKind, watchAndRunConf) {
|
|
61860
|
-
for (const
|
|
61861
|
-
if (!absolutePath || !
|
|
61860
|
+
for (const info of watchAndRunConf) {
|
|
61861
|
+
if (!absolutePath || !info.watchFile && !info.watch) {
|
|
61862
61862
|
continue;
|
|
61863
61863
|
}
|
|
61864
|
-
const isWatched =
|
|
61864
|
+
const isWatched = info.kind.includes(watchKind);
|
|
61865
61865
|
let isPathMatching = false;
|
|
61866
|
-
if (
|
|
61867
|
-
isPathMatching = await
|
|
61868
|
-
} else if (
|
|
61869
|
-
isPathMatching = import_micromatch.default.isMatch(absolutePath,
|
|
61866
|
+
if (info.watchFile) {
|
|
61867
|
+
isPathMatching = await info.watchFile(absolutePath);
|
|
61868
|
+
} else if (info.watch) {
|
|
61869
|
+
isPathMatching = import_micromatch.default.isMatch(absolutePath, info.watch);
|
|
61870
61870
|
}
|
|
61871
61871
|
const isWatchKindWithoutPath = kindWithoutPath.includes(watchKind);
|
|
61872
|
-
if (!
|
|
61873
|
-
return
|
|
61872
|
+
if (!info.isRunning && isWatched && (isPathMatching || isWatchKindWithoutPath)) {
|
|
61873
|
+
return info;
|
|
61874
61874
|
}
|
|
61875
61875
|
}
|
|
61876
61876
|
return null;
|
|
@@ -61879,45 +61879,45 @@ function formatLog(str, name2) {
|
|
|
61879
61879
|
return `${name2 ? logMagneta(`[${name2}]`) : ""} ${str}`;
|
|
61880
61880
|
}
|
|
61881
61881
|
async function watcher(absolutePath, watchKind, watchAndRunConf) {
|
|
61882
|
-
const
|
|
61883
|
-
if (
|
|
61884
|
-
|
|
61885
|
-
if (!
|
|
61882
|
+
const info = await shouldRun(absolutePath, watchKind, watchAndRunConf);
|
|
61883
|
+
if (info) {
|
|
61884
|
+
info.isRunning = true;
|
|
61885
|
+
if (!info.quiet) {
|
|
61886
61886
|
let message = `${logGreen("\u2714")} Watch ${logCyan(watchKind)}`;
|
|
61887
|
-
if (
|
|
61887
|
+
if (info.watch && absolutePath) {
|
|
61888
61888
|
message += logGreen(" " + absolutePath.replaceAll(process.cwd(), ""));
|
|
61889
61889
|
}
|
|
61890
|
-
if (typeof
|
|
61891
|
-
message + ` and run ${logGreen(
|
|
61890
|
+
if (typeof info.run === "string") {
|
|
61891
|
+
message + ` and run ${logGreen(info.run)} `;
|
|
61892
61892
|
}
|
|
61893
|
-
message += ` ${logCyan(
|
|
61893
|
+
message += ` ${logCyan(info.delay + "ms")}`;
|
|
61894
61894
|
log.info(message);
|
|
61895
61895
|
}
|
|
61896
61896
|
setTimeout(async () => {
|
|
61897
|
-
if (typeof
|
|
61898
|
-
const promise =
|
|
61897
|
+
if (typeof info.run === "function") {
|
|
61898
|
+
const promise = info.run();
|
|
61899
61899
|
try {
|
|
61900
61900
|
if (promise) {
|
|
61901
61901
|
await promise;
|
|
61902
61902
|
}
|
|
61903
61903
|
} catch (e2) {
|
|
61904
|
-
if (
|
|
61905
|
-
|
|
61904
|
+
if (info.formatErrors) {
|
|
61905
|
+
info.formatErrors(e2);
|
|
61906
61906
|
} else {
|
|
61907
61907
|
throw e2;
|
|
61908
61908
|
}
|
|
61909
61909
|
}
|
|
61910
|
-
|
|
61910
|
+
info.isRunning = false;
|
|
61911
61911
|
return;
|
|
61912
61912
|
}
|
|
61913
|
-
const child = (0, import_child_process.spawn)(
|
|
61913
|
+
const child = (0, import_child_process.spawn)(info.run, [], { shell: true });
|
|
61914
61914
|
child.stdout.on("data", (data) => {
|
|
61915
61915
|
var _a;
|
|
61916
|
-
process.stdout.write(formatLog(data.toString(), (_a =
|
|
61916
|
+
process.stdout.write(formatLog(data.toString(), (_a = info.name) !== null && _a !== void 0 ? _a : ""));
|
|
61917
61917
|
});
|
|
61918
61918
|
child.stderr.on("data", (data) => {
|
|
61919
61919
|
var _a;
|
|
61920
|
-
process.stdout.write(formatLog(data.toString(), (_a =
|
|
61920
|
+
process.stdout.write(formatLog(data.toString(), (_a = info.name) !== null && _a !== void 0 ? _a : ""));
|
|
61921
61921
|
});
|
|
61922
61922
|
child.on("close", (code) => {
|
|
61923
61923
|
if (code === 0) {
|
|
@@ -61925,10 +61925,10 @@ async function watcher(absolutePath, watchKind, watchAndRunConf) {
|
|
|
61925
61925
|
} else {
|
|
61926
61926
|
log.error(`finished with some ${logRed("errors")}`);
|
|
61927
61927
|
}
|
|
61928
|
-
|
|
61928
|
+
info.isRunning = false;
|
|
61929
61929
|
});
|
|
61930
61930
|
return;
|
|
61931
|
-
},
|
|
61931
|
+
}, info.delay);
|
|
61932
61932
|
}
|
|
61933
61933
|
return;
|
|
61934
61934
|
}
|
|
@@ -61954,7 +61954,7 @@ function watchAndRun(params) {
|
|
|
61954
61954
|
}
|
|
61955
61955
|
|
|
61956
61956
|
// src/codegen/index.ts
|
|
61957
|
-
var
|
|
61957
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
61958
61958
|
|
|
61959
61959
|
// src/lib/pipeline.ts
|
|
61960
61960
|
async function runPipeline(config4, pipeline2, target) {
|
|
@@ -65113,1719 +65113,6 @@ function computeID(configFile, type, data) {
|
|
|
65113
65113
|
return id.slice(0, -2);
|
|
65114
65114
|
}
|
|
65115
65115
|
|
|
65116
|
-
// src/runtime/lib/deepEquals.ts
|
|
65117
|
-
function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
|
|
65118
|
-
if (Object.is(objA, objB))
|
|
65119
|
-
return true;
|
|
65120
|
-
if (objA instanceof Date && objB instanceof Date) {
|
|
65121
|
-
return objA.getTime() === objB.getTime();
|
|
65122
|
-
}
|
|
65123
|
-
if (objA instanceof RegExp && objB instanceof RegExp) {
|
|
65124
|
-
return objA.toString() === objB.toString();
|
|
65125
|
-
}
|
|
65126
|
-
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
|
65127
|
-
return false;
|
|
65128
|
-
}
|
|
65129
|
-
if (map.get(objA) === objB)
|
|
65130
|
-
return true;
|
|
65131
|
-
map.set(objA, objB);
|
|
65132
|
-
const keysA = Reflect.ownKeys(objA);
|
|
65133
|
-
const keysB = Reflect.ownKeys(objB);
|
|
65134
|
-
if (keysA.length !== keysB.length) {
|
|
65135
|
-
return false;
|
|
65136
|
-
}
|
|
65137
|
-
for (let i2 = 0; i2 < keysA.length; i2++) {
|
|
65138
|
-
if (!Reflect.has(objB, keysA[i2]) || !deepEquals(objA[keysA[i2]], objB[keysA[i2]], map)) {
|
|
65139
|
-
return false;
|
|
65140
|
-
}
|
|
65141
|
-
}
|
|
65142
|
-
return true;
|
|
65143
|
-
}
|
|
65144
|
-
|
|
65145
|
-
// src/runtime/lib/selection.ts
|
|
65146
|
-
function getFieldsForType(selection2, __typename) {
|
|
65147
|
-
let targetSelection = selection2.fields || {};
|
|
65148
|
-
if (selection2.abstractFields && __typename) {
|
|
65149
|
-
const mappedType = selection2.abstractFields.typeMap[__typename];
|
|
65150
|
-
if (mappedType) {
|
|
65151
|
-
targetSelection = selection2.abstractFields.fields[mappedType];
|
|
65152
|
-
} else if (selection2.abstractFields.fields[__typename]) {
|
|
65153
|
-
targetSelection = selection2.abstractFields.fields[__typename];
|
|
65154
|
-
}
|
|
65155
|
-
}
|
|
65156
|
-
return targetSelection;
|
|
65157
|
-
}
|
|
65158
|
-
|
|
65159
|
-
// src/runtime/cache/gc.ts
|
|
65160
|
-
var GarbageCollector = class {
|
|
65161
|
-
cache;
|
|
65162
|
-
lifetimes = /* @__PURE__ */ new Map();
|
|
65163
|
-
get cacheBufferSize() {
|
|
65164
|
-
return this.cache._internal_unstable.config.cacheBufferSize ?? 10;
|
|
65165
|
-
}
|
|
65166
|
-
constructor(cache) {
|
|
65167
|
-
this.cache = cache;
|
|
65168
|
-
}
|
|
65169
|
-
resetLifetime(id, field) {
|
|
65170
|
-
if (!this.lifetimes.get(id)) {
|
|
65171
|
-
this.lifetimes.set(id, /* @__PURE__ */ new Map());
|
|
65172
|
-
}
|
|
65173
|
-
this.lifetimes.get(id).set(field, 0);
|
|
65174
|
-
}
|
|
65175
|
-
tick() {
|
|
65176
|
-
for (const [id, fieldMap] of this.lifetimes.entries()) {
|
|
65177
|
-
for (const [field, lifetime] of fieldMap.entries()) {
|
|
65178
|
-
if (this.cache._internal_unstable.subscriptions.get(id, field).length > 0) {
|
|
65179
|
-
continue;
|
|
65180
|
-
}
|
|
65181
|
-
fieldMap.set(field, lifetime + 1);
|
|
65182
|
-
if (fieldMap.get(field) > this.cacheBufferSize) {
|
|
65183
|
-
this.cache._internal_unstable.storage.deleteField(id, field);
|
|
65184
|
-
this.cache._internal_unstable.lists.deleteField(id, field);
|
|
65185
|
-
fieldMap.delete(field);
|
|
65186
|
-
if ([...fieldMap.keys()].length === 0) {
|
|
65187
|
-
this.lifetimes.delete(id);
|
|
65188
|
-
}
|
|
65189
|
-
}
|
|
65190
|
-
}
|
|
65191
|
-
}
|
|
65192
|
-
}
|
|
65193
|
-
};
|
|
65194
|
-
|
|
65195
|
-
// src/runtime/cache/stuff.ts
|
|
65196
|
-
function flattenList(source) {
|
|
65197
|
-
const flat = [];
|
|
65198
|
-
const unvisited = [source || []];
|
|
65199
|
-
while (unvisited.length > 0) {
|
|
65200
|
-
const target = unvisited.shift();
|
|
65201
|
-
for (const id of target) {
|
|
65202
|
-
if (Array.isArray(id)) {
|
|
65203
|
-
unvisited.push(id);
|
|
65204
|
-
continue;
|
|
65205
|
-
}
|
|
65206
|
-
flat.push(id);
|
|
65207
|
-
}
|
|
65208
|
-
}
|
|
65209
|
-
return flat;
|
|
65210
|
-
}
|
|
65211
|
-
function evaluateKey(key, variables = {}) {
|
|
65212
|
-
let evaluated = "";
|
|
65213
|
-
let varName = "";
|
|
65214
|
-
let inString = false;
|
|
65215
|
-
for (const char of key) {
|
|
65216
|
-
if (varName) {
|
|
65217
|
-
if (varChars.includes(char)) {
|
|
65218
|
-
varName += char;
|
|
65219
|
-
continue;
|
|
65220
|
-
}
|
|
65221
|
-
const value = variables[varName.slice(1)];
|
|
65222
|
-
evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
|
|
65223
|
-
varName = "";
|
|
65224
|
-
}
|
|
65225
|
-
if (char === "$" && !inString) {
|
|
65226
|
-
varName = "$";
|
|
65227
|
-
continue;
|
|
65228
|
-
}
|
|
65229
|
-
if (char === '"') {
|
|
65230
|
-
inString = !inString;
|
|
65231
|
-
}
|
|
65232
|
-
evaluated += char;
|
|
65233
|
-
}
|
|
65234
|
-
return evaluated;
|
|
65235
|
-
}
|
|
65236
|
-
var varChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
|
|
65237
|
-
|
|
65238
|
-
// src/runtime/cache/lists.ts
|
|
65239
|
-
var ListManager = class {
|
|
65240
|
-
rootID;
|
|
65241
|
-
cache;
|
|
65242
|
-
constructor(cache, rootID2) {
|
|
65243
|
-
this.rootID = rootID2;
|
|
65244
|
-
this.cache = cache;
|
|
65245
|
-
}
|
|
65246
|
-
lists = /* @__PURE__ */ new Map();
|
|
65247
|
-
listsByField = /* @__PURE__ */ new Map();
|
|
65248
|
-
get(listName, id, allLists) {
|
|
65249
|
-
const matches = this.lists.get(listName);
|
|
65250
|
-
if (!matches || matches.size === 0) {
|
|
65251
|
-
return null;
|
|
65252
|
-
}
|
|
65253
|
-
if (allLists) {
|
|
65254
|
-
return new ListCollection(
|
|
65255
|
-
Array.from(matches, ([key, value]) => [...value.lists]).flat()
|
|
65256
|
-
);
|
|
65257
|
-
}
|
|
65258
|
-
const head = [...matches.values()][0];
|
|
65259
|
-
const { recordType } = head.lists[0];
|
|
65260
|
-
const parentID = id ? this.cache._internal_unstable.id(recordType || "", id) : this.rootID;
|
|
65261
|
-
if (matches?.size === 1) {
|
|
65262
|
-
if (!id) {
|
|
65263
|
-
return head;
|
|
65264
|
-
}
|
|
65265
|
-
return parentID === Array.from(matches.keys())[0] ? head : null;
|
|
65266
|
-
}
|
|
65267
|
-
if (!id) {
|
|
65268
|
-
console.error(
|
|
65269
|
-
`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 `
|
|
65270
|
-
);
|
|
65271
|
-
return null;
|
|
65272
|
-
}
|
|
65273
|
-
return this.lists.get(listName)?.get(parentID);
|
|
65274
|
-
}
|
|
65275
|
-
remove(listName, id) {
|
|
65276
|
-
this.lists.get(listName)?.delete(id || this.rootID);
|
|
65277
|
-
}
|
|
65278
|
-
add(list) {
|
|
65279
|
-
if (!this.lists.has(list.name)) {
|
|
65280
|
-
this.lists.set(list.name, /* @__PURE__ */ new Map());
|
|
65281
|
-
}
|
|
65282
|
-
const name2 = list.name;
|
|
65283
|
-
const parentID = list.recordID || this.rootID;
|
|
65284
|
-
if (this.lists.get(name2)?.get(parentID)?.includes(list.key)) {
|
|
65285
|
-
return;
|
|
65286
|
-
}
|
|
65287
|
-
if (!this.lists.has(name2)) {
|
|
65288
|
-
this.lists.set(name2, /* @__PURE__ */ new Map());
|
|
65289
|
-
}
|
|
65290
|
-
if (!this.lists.get(name2).has(parentID)) {
|
|
65291
|
-
this.lists.get(name2).set(parentID, new ListCollection([]));
|
|
65292
|
-
}
|
|
65293
|
-
if (!this.listsByField.has(parentID)) {
|
|
65294
|
-
this.listsByField.set(parentID, /* @__PURE__ */ new Map());
|
|
65295
|
-
}
|
|
65296
|
-
if (!this.listsByField.get(parentID).has(list.key)) {
|
|
65297
|
-
this.listsByField.get(parentID)?.set(list.key, []);
|
|
65298
|
-
}
|
|
65299
|
-
const handler = new List({ ...list, manager: this });
|
|
65300
|
-
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
65301
|
-
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
65302
|
-
}
|
|
65303
|
-
removeIDFromAllLists(id) {
|
|
65304
|
-
for (const fieldMap of this.lists.values()) {
|
|
65305
|
-
for (const list of fieldMap.values()) {
|
|
65306
|
-
list.removeID(id);
|
|
65307
|
-
}
|
|
65308
|
-
}
|
|
65309
|
-
}
|
|
65310
|
-
deleteField(parentID, field) {
|
|
65311
|
-
if (!this.listsByField.get(parentID)?.has(field)) {
|
|
65312
|
-
return;
|
|
65313
|
-
}
|
|
65314
|
-
for (const list of this.listsByField.get(parentID).get(field)) {
|
|
65315
|
-
this.lists.get(list.name)?.get(list.recordID)?.deleteListWithKey(field);
|
|
65316
|
-
if (this.lists.get(list.name)?.get(list.recordID)?.lists.length === 0) {
|
|
65317
|
-
this.lists.get(list.name)?.delete(list.recordID);
|
|
65318
|
-
}
|
|
65319
|
-
}
|
|
65320
|
-
this.listsByField.get(parentID).delete(field);
|
|
65321
|
-
}
|
|
65322
|
-
};
|
|
65323
|
-
var List = class {
|
|
65324
|
-
recordID;
|
|
65325
|
-
recordType;
|
|
65326
|
-
key;
|
|
65327
|
-
type;
|
|
65328
|
-
cache;
|
|
65329
|
-
selection;
|
|
65330
|
-
_when;
|
|
65331
|
-
filters;
|
|
65332
|
-
name;
|
|
65333
|
-
connection;
|
|
65334
|
-
manager;
|
|
65335
|
-
abstract;
|
|
65336
|
-
constructor({
|
|
65337
|
-
name: name2,
|
|
65338
|
-
recordID,
|
|
65339
|
-
recordType,
|
|
65340
|
-
key,
|
|
65341
|
-
listType,
|
|
65342
|
-
selection: selection2,
|
|
65343
|
-
when,
|
|
65344
|
-
filters,
|
|
65345
|
-
connection,
|
|
65346
|
-
manager,
|
|
65347
|
-
abstract
|
|
65348
|
-
}) {
|
|
65349
|
-
this.recordID = recordID || rootID;
|
|
65350
|
-
this.recordType = recordType;
|
|
65351
|
-
this.key = key;
|
|
65352
|
-
this.type = listType;
|
|
65353
|
-
this.cache = manager.cache;
|
|
65354
|
-
this.selection = selection2;
|
|
65355
|
-
this._when = when;
|
|
65356
|
-
this.filters = filters;
|
|
65357
|
-
this.name = name2;
|
|
65358
|
-
this.connection = connection;
|
|
65359
|
-
this.manager = manager;
|
|
65360
|
-
this.abstract = abstract;
|
|
65361
|
-
}
|
|
65362
|
-
when(when) {
|
|
65363
|
-
return this.manager.lists.get(this.name).get(this.recordID).when(when);
|
|
65364
|
-
}
|
|
65365
|
-
append(selection2, data, variables = {}) {
|
|
65366
|
-
return this.addToList(selection2, data, variables, "last");
|
|
65367
|
-
}
|
|
65368
|
-
prepend(selection2, data, variables = {}) {
|
|
65369
|
-
return this.addToList(selection2, data, variables, "first");
|
|
65370
|
-
}
|
|
65371
|
-
addToList(selection2, data, variables = {}, where) {
|
|
65372
|
-
const listType = this.listType(data);
|
|
65373
|
-
const dataID = this.cache._internal_unstable.id(listType, data);
|
|
65374
|
-
if (!this.validateWhen() || !dataID) {
|
|
65375
|
-
return;
|
|
65376
|
-
}
|
|
65377
|
-
let insertSelection = selection2;
|
|
65378
|
-
let insertData = data;
|
|
65379
|
-
if (this.connection) {
|
|
65380
|
-
insertSelection = {
|
|
65381
|
-
fields: {
|
|
65382
|
-
newEntry: {
|
|
65383
|
-
keyRaw: this.key,
|
|
65384
|
-
type: "Connection",
|
|
65385
|
-
selection: {
|
|
65386
|
-
fields: {
|
|
65387
|
-
edges: {
|
|
65388
|
-
keyRaw: "edges",
|
|
65389
|
-
type: "ConnectionEdge",
|
|
65390
|
-
update: where === "first" ? "prepend" : "append",
|
|
65391
|
-
selection: {
|
|
65392
|
-
fields: {
|
|
65393
|
-
node: {
|
|
65394
|
-
type: listType,
|
|
65395
|
-
keyRaw: "node",
|
|
65396
|
-
selection: {
|
|
65397
|
-
...selection2,
|
|
65398
|
-
fields: {
|
|
65399
|
-
...selection2.fields,
|
|
65400
|
-
__typename: {
|
|
65401
|
-
keyRaw: "__typename",
|
|
65402
|
-
type: "String"
|
|
65403
|
-
}
|
|
65404
|
-
}
|
|
65405
|
-
}
|
|
65406
|
-
}
|
|
65407
|
-
}
|
|
65408
|
-
}
|
|
65409
|
-
}
|
|
65410
|
-
}
|
|
65411
|
-
}
|
|
65412
|
-
}
|
|
65413
|
-
}
|
|
65414
|
-
};
|
|
65415
|
-
insertData = {
|
|
65416
|
-
newEntry: {
|
|
65417
|
-
edges: [{ node: { ...data, __typename: listType } }]
|
|
65418
|
-
}
|
|
65419
|
-
};
|
|
65420
|
-
} else {
|
|
65421
|
-
insertSelection = {
|
|
65422
|
-
fields: {
|
|
65423
|
-
newEntries: {
|
|
65424
|
-
keyRaw: this.key,
|
|
65425
|
-
type: listType,
|
|
65426
|
-
update: where === "first" ? "prepend" : "append",
|
|
65427
|
-
selection: {
|
|
65428
|
-
...selection2,
|
|
65429
|
-
fields: {
|
|
65430
|
-
...selection2.fields,
|
|
65431
|
-
__typename: {
|
|
65432
|
-
keyRaw: "__typename",
|
|
65433
|
-
type: "String"
|
|
65434
|
-
}
|
|
65435
|
-
}
|
|
65436
|
-
}
|
|
65437
|
-
}
|
|
65438
|
-
}
|
|
65439
|
-
};
|
|
65440
|
-
insertData = {
|
|
65441
|
-
newEntries: [{ ...data, __typename: listType }]
|
|
65442
|
-
};
|
|
65443
|
-
}
|
|
65444
|
-
this.cache.write({
|
|
65445
|
-
selection: insertSelection,
|
|
65446
|
-
data: insertData,
|
|
65447
|
-
variables,
|
|
65448
|
-
parent: this.recordID,
|
|
65449
|
-
applyUpdates: true
|
|
65450
|
-
});
|
|
65451
|
-
}
|
|
65452
|
-
removeID(id, variables = {}) {
|
|
65453
|
-
if (!this.validateWhen()) {
|
|
65454
|
-
return;
|
|
65455
|
-
}
|
|
65456
|
-
let parentID = this.recordID;
|
|
65457
|
-
let targetID = id;
|
|
65458
|
-
let targetKey = this.key;
|
|
65459
|
-
if (this.connection) {
|
|
65460
|
-
const { value: embeddedConnection } = this.cache._internal_unstable.storage.get(
|
|
65461
|
-
this.recordID,
|
|
65462
|
-
this.key
|
|
65463
|
-
);
|
|
65464
|
-
if (!embeddedConnection) {
|
|
65465
|
-
return;
|
|
65466
|
-
}
|
|
65467
|
-
const embeddedConnectionID = embeddedConnection;
|
|
65468
|
-
const { value: edges } = this.cache._internal_unstable.storage.get(
|
|
65469
|
-
embeddedConnectionID,
|
|
65470
|
-
"edges"
|
|
65471
|
-
);
|
|
65472
|
-
for (const edge of flattenList(edges) || []) {
|
|
65473
|
-
if (!edge) {
|
|
65474
|
-
continue;
|
|
65475
|
-
}
|
|
65476
|
-
const edgeID = edge;
|
|
65477
|
-
const { value: nodeID } = this.cache._internal_unstable.storage.get(edgeID, "node");
|
|
65478
|
-
if (!nodeID) {
|
|
65479
|
-
continue;
|
|
65480
|
-
}
|
|
65481
|
-
if (nodeID === id) {
|
|
65482
|
-
targetID = edgeID;
|
|
65483
|
-
}
|
|
65484
|
-
}
|
|
65485
|
-
parentID = embeddedConnectionID;
|
|
65486
|
-
targetKey = "edges";
|
|
65487
|
-
}
|
|
65488
|
-
let value = this.cache._internal_unstable.storage.get(parentID, targetKey).value;
|
|
65489
|
-
if (!value || !value.includes(targetID)) {
|
|
65490
|
-
return;
|
|
65491
|
-
}
|
|
65492
|
-
const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
|
|
65493
|
-
this.cache._internal_unstable.subscriptions.remove(
|
|
65494
|
-
targetID,
|
|
65495
|
-
this.connection ? this.selection.fields.edges.selection : this.selection,
|
|
65496
|
-
subscribers,
|
|
65497
|
-
variables
|
|
65498
|
-
);
|
|
65499
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
65500
|
-
for (const spec of subscribers) {
|
|
65501
|
-
spec.set(
|
|
65502
|
-
this.cache._internal_unstable.getSelection({
|
|
65503
|
-
parent: spec.parentID || this.manager.rootID,
|
|
65504
|
-
selection: spec.selection,
|
|
65505
|
-
variables: spec.variables?.() || {}
|
|
65506
|
-
}).data
|
|
65507
|
-
);
|
|
65508
|
-
}
|
|
65509
|
-
return true;
|
|
65510
|
-
}
|
|
65511
|
-
remove(data, variables = {}) {
|
|
65512
|
-
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
65513
|
-
if (!targetID) {
|
|
65514
|
-
return;
|
|
65515
|
-
}
|
|
65516
|
-
return this.removeID(targetID, variables);
|
|
65517
|
-
}
|
|
65518
|
-
listType(data) {
|
|
65519
|
-
return data.__typename || this.type;
|
|
65520
|
-
}
|
|
65521
|
-
validateWhen(when) {
|
|
65522
|
-
let filters = when || this._when;
|
|
65523
|
-
let ok = true;
|
|
65524
|
-
if (filters) {
|
|
65525
|
-
const targets = this.filters;
|
|
65526
|
-
if (filters.must && targets) {
|
|
65527
|
-
ok = Object.entries(filters.must).reduce(
|
|
65528
|
-
(prev, [key, value]) => Boolean(prev && targets[key] == value),
|
|
65529
|
-
ok
|
|
65530
|
-
);
|
|
65531
|
-
}
|
|
65532
|
-
if (filters.must_not) {
|
|
65533
|
-
ok = !targets || Object.entries(filters.must_not).reduce(
|
|
65534
|
-
(prev, [key, value]) => Boolean(prev && targets[key] != value),
|
|
65535
|
-
ok
|
|
65536
|
-
);
|
|
65537
|
-
}
|
|
65538
|
-
}
|
|
65539
|
-
return ok;
|
|
65540
|
-
}
|
|
65541
|
-
toggleElement(selection2, data, variables = {}, where) {
|
|
65542
|
-
if (!this.remove(data, variables)) {
|
|
65543
|
-
this.addToList(selection2, data, variables, where);
|
|
65544
|
-
}
|
|
65545
|
-
}
|
|
65546
|
-
*[Symbol.iterator]() {
|
|
65547
|
-
let entries = [];
|
|
65548
|
-
let value = this.cache._internal_unstable.storage.get(this.recordID, this.key).value;
|
|
65549
|
-
if (!this.connection) {
|
|
65550
|
-
entries = flattenList(value);
|
|
65551
|
-
} else {
|
|
65552
|
-
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
65553
|
-
}
|
|
65554
|
-
for (let record2 of entries) {
|
|
65555
|
-
yield record2;
|
|
65556
|
-
}
|
|
65557
|
-
}
|
|
65558
|
-
};
|
|
65559
|
-
var ListCollection = class {
|
|
65560
|
-
lists = [];
|
|
65561
|
-
constructor(lists) {
|
|
65562
|
-
this.lists = lists;
|
|
65563
|
-
}
|
|
65564
|
-
append(...args) {
|
|
65565
|
-
this.lists.forEach((list) => list.append(...args));
|
|
65566
|
-
}
|
|
65567
|
-
prepend(...args) {
|
|
65568
|
-
this.lists.forEach((list) => list.prepend(...args));
|
|
65569
|
-
}
|
|
65570
|
-
addToList(...args) {
|
|
65571
|
-
this.lists.forEach((list) => list.addToList(...args));
|
|
65572
|
-
}
|
|
65573
|
-
removeID(...args) {
|
|
65574
|
-
this.lists.forEach((list) => list.removeID(...args));
|
|
65575
|
-
}
|
|
65576
|
-
remove(...args) {
|
|
65577
|
-
this.lists.forEach((list) => list.remove(...args));
|
|
65578
|
-
}
|
|
65579
|
-
toggleElement(...args) {
|
|
65580
|
-
this.lists.forEach((list) => list.toggleElement(...args));
|
|
65581
|
-
}
|
|
65582
|
-
when(when) {
|
|
65583
|
-
return new ListCollection(
|
|
65584
|
-
this.lists.filter((list) => {
|
|
65585
|
-
return list.validateWhen(when);
|
|
65586
|
-
})
|
|
65587
|
-
);
|
|
65588
|
-
}
|
|
65589
|
-
includes(key) {
|
|
65590
|
-
return !!this.lists.find((list) => list.key === key);
|
|
65591
|
-
}
|
|
65592
|
-
deleteListWithKey(key) {
|
|
65593
|
-
return this.lists = this.lists.filter((list) => list.key !== key);
|
|
65594
|
-
}
|
|
65595
|
-
*[Symbol.iterator]() {
|
|
65596
|
-
for (let list of this.lists) {
|
|
65597
|
-
for (const entry of list) {
|
|
65598
|
-
yield entry;
|
|
65599
|
-
}
|
|
65600
|
-
}
|
|
65601
|
-
}
|
|
65602
|
-
};
|
|
65603
|
-
|
|
65604
|
-
// src/runtime/cache/schema.ts
|
|
65605
|
-
var SchemaManager = class {
|
|
65606
|
-
cache;
|
|
65607
|
-
fieldTypes = {};
|
|
65608
|
-
constructor(cache) {
|
|
65609
|
-
this.cache = cache;
|
|
65610
|
-
}
|
|
65611
|
-
setFieldType({
|
|
65612
|
-
parent,
|
|
65613
|
-
key,
|
|
65614
|
-
type,
|
|
65615
|
-
nullable = false,
|
|
65616
|
-
link
|
|
65617
|
-
}) {
|
|
65618
|
-
let parensIndex = key.indexOf("(");
|
|
65619
|
-
if (parensIndex !== -1) {
|
|
65620
|
-
key = key.substring(0, parensIndex);
|
|
65621
|
-
}
|
|
65622
|
-
if (parent === rootID) {
|
|
65623
|
-
parent = "Query";
|
|
65624
|
-
} else if (parent.includes(":")) {
|
|
65625
|
-
parent = parent.substring(0, parent.indexOf(":"));
|
|
65626
|
-
}
|
|
65627
|
-
if (!this.fieldTypes[parent]) {
|
|
65628
|
-
this.fieldTypes[parent] = {};
|
|
65629
|
-
}
|
|
65630
|
-
this.fieldTypes[parent][key] = {
|
|
65631
|
-
type,
|
|
65632
|
-
nullable,
|
|
65633
|
-
link: !!link
|
|
65634
|
-
};
|
|
65635
|
-
}
|
|
65636
|
-
fieldType(type, field) {
|
|
65637
|
-
return this.fieldTypes[type]?.[field] || null;
|
|
65638
|
-
}
|
|
65639
|
-
get config() {
|
|
65640
|
-
return this.cache._internal_unstable.config;
|
|
65641
|
-
}
|
|
65642
|
-
};
|
|
65643
|
-
|
|
65644
|
-
// src/runtime/cache/storage.ts
|
|
65645
|
-
var InMemoryStorage = class {
|
|
65646
|
-
data;
|
|
65647
|
-
idCount = 0;
|
|
65648
|
-
rank = 0;
|
|
65649
|
-
constructor() {
|
|
65650
|
-
this.data = [];
|
|
65651
|
-
}
|
|
65652
|
-
get layerCount() {
|
|
65653
|
-
return this.data.length;
|
|
65654
|
-
}
|
|
65655
|
-
get nextRank() {
|
|
65656
|
-
return this.rank++;
|
|
65657
|
-
}
|
|
65658
|
-
createLayer(optimistic = false) {
|
|
65659
|
-
const layer = new Layer(this.idCount++);
|
|
65660
|
-
layer.optimistic = optimistic;
|
|
65661
|
-
this.data.push(layer);
|
|
65662
|
-
return layer;
|
|
65663
|
-
}
|
|
65664
|
-
insert(id, field, location, target) {
|
|
65665
|
-
return this.topLayer.insert(id, field, location, target);
|
|
65666
|
-
}
|
|
65667
|
-
remove(id, field, target) {
|
|
65668
|
-
return this.topLayer.remove(id, field, target);
|
|
65669
|
-
}
|
|
65670
|
-
delete(id) {
|
|
65671
|
-
return this.topLayer.delete(id);
|
|
65672
|
-
}
|
|
65673
|
-
deleteField(id, field) {
|
|
65674
|
-
return this.topLayer.deleteField(id, field);
|
|
65675
|
-
}
|
|
65676
|
-
getLayer(id) {
|
|
65677
|
-
for (const layer of this.data) {
|
|
65678
|
-
if (layer.id === id) {
|
|
65679
|
-
return layer;
|
|
65680
|
-
}
|
|
65681
|
-
}
|
|
65682
|
-
throw new Error("Could not find layer with id: " + id);
|
|
65683
|
-
}
|
|
65684
|
-
replaceID(replacement) {
|
|
65685
|
-
for (const layer of this.data) {
|
|
65686
|
-
layer.replaceID(replacement);
|
|
65687
|
-
}
|
|
65688
|
-
}
|
|
65689
|
-
get(id, field) {
|
|
65690
|
-
const operations = {
|
|
65691
|
-
[OperationKind.insert]: {
|
|
65692
|
-
[OperationLocation.start]: [],
|
|
65693
|
-
[OperationLocation.end]: []
|
|
65694
|
-
},
|
|
65695
|
-
[OperationKind.remove]: /* @__PURE__ */ new Set()
|
|
65696
|
-
};
|
|
65697
|
-
const layerIDs = [];
|
|
65698
|
-
for (let i2 = this.data.length - 1; i2 >= 0; i2--) {
|
|
65699
|
-
const layer = this.data[i2];
|
|
65700
|
-
const [layerValue, kind] = layer.get(id, field);
|
|
65701
|
-
const layerOperations = layer.getOperations(id, field) || [];
|
|
65702
|
-
layer.deletedIDs.forEach((v) => {
|
|
65703
|
-
if (layer.operations[v]?.undoDeletesInList?.includes(field)) {
|
|
65704
|
-
return;
|
|
65705
|
-
}
|
|
65706
|
-
operations.remove.add(v);
|
|
65707
|
-
});
|
|
65708
|
-
if (typeof layerValue === "undefined" && layerOperations.length === 0) {
|
|
65709
|
-
if (layer.deletedIDs.size > 0) {
|
|
65710
|
-
layerIDs.push(layer.id);
|
|
65711
|
-
}
|
|
65712
|
-
continue;
|
|
65713
|
-
}
|
|
65714
|
-
if (typeof layerValue !== "undefined" && !Array.isArray(layerValue)) {
|
|
65715
|
-
return {
|
|
65716
|
-
value: layerValue,
|
|
65717
|
-
kind,
|
|
65718
|
-
displayLayers: [layer.id]
|
|
65719
|
-
};
|
|
65720
|
-
}
|
|
65721
|
-
layerIDs.push(layer.id);
|
|
65722
|
-
if (layerOperations.length > 0) {
|
|
65723
|
-
for (const op of layerOperations) {
|
|
65724
|
-
if (isRemoveOperation(op)) {
|
|
65725
|
-
operations.remove.add(op.id);
|
|
65726
|
-
}
|
|
65727
|
-
if (isInsertOperation(op)) {
|
|
65728
|
-
operations.insert[op.location].unshift(op.id);
|
|
65729
|
-
}
|
|
65730
|
-
if (isDeleteOperation(op)) {
|
|
65731
|
-
return {
|
|
65732
|
-
value: void 0,
|
|
65733
|
-
kind: "unknown",
|
|
65734
|
-
displayLayers: []
|
|
65735
|
-
};
|
|
65736
|
-
}
|
|
65737
|
-
}
|
|
65738
|
-
}
|
|
65739
|
-
if (typeof layerValue === "undefined") {
|
|
65740
|
-
continue;
|
|
65741
|
-
}
|
|
65742
|
-
if (!operations.remove.size && !operations.insert.start.length && !operations.insert.end.length) {
|
|
65743
|
-
return { value: layerValue, displayLayers: layerIDs, kind: "link" };
|
|
65744
|
-
}
|
|
65745
|
-
return {
|
|
65746
|
-
value: [...operations.insert.start, ...layerValue, ...operations.insert.end].filter(
|
|
65747
|
-
(value) => !operations.remove.has(value)
|
|
65748
|
-
),
|
|
65749
|
-
displayLayers: layerIDs,
|
|
65750
|
-
kind
|
|
65751
|
-
};
|
|
65752
|
-
}
|
|
65753
|
-
return {
|
|
65754
|
-
value: void 0,
|
|
65755
|
-
kind: "unknown",
|
|
65756
|
-
displayLayers: []
|
|
65757
|
-
};
|
|
65758
|
-
}
|
|
65759
|
-
writeLink(id, field, value) {
|
|
65760
|
-
return this.topLayer.writeLink(id, field, value);
|
|
65761
|
-
}
|
|
65762
|
-
writeField(id, field, value) {
|
|
65763
|
-
return this.topLayer.writeField(id, field, value);
|
|
65764
|
-
}
|
|
65765
|
-
resolveLayer(id) {
|
|
65766
|
-
let startingIndex = null;
|
|
65767
|
-
for (const [index, layer] of this.data.entries()) {
|
|
65768
|
-
if (layer.id !== id) {
|
|
65769
|
-
continue;
|
|
65770
|
-
}
|
|
65771
|
-
startingIndex = index - 1;
|
|
65772
|
-
this.data[index].optimistic = false;
|
|
65773
|
-
break;
|
|
65774
|
-
}
|
|
65775
|
-
if (startingIndex === null) {
|
|
65776
|
-
throw new Error("could not find layer with id: " + id);
|
|
65777
|
-
}
|
|
65778
|
-
if (startingIndex === -1) {
|
|
65779
|
-
startingIndex = 0;
|
|
65780
|
-
}
|
|
65781
|
-
if (this.data[startingIndex].optimistic) {
|
|
65782
|
-
startingIndex++;
|
|
65783
|
-
}
|
|
65784
|
-
const baseLayer = this.data[startingIndex];
|
|
65785
|
-
let layerIndex = startingIndex;
|
|
65786
|
-
while (layerIndex < this.data.length) {
|
|
65787
|
-
const layer = this.data[layerIndex++];
|
|
65788
|
-
if (layer.optimistic) {
|
|
65789
|
-
layerIndex--;
|
|
65790
|
-
break;
|
|
65791
|
-
}
|
|
65792
|
-
baseLayer.writeLayer(layer);
|
|
65793
|
-
}
|
|
65794
|
-
this.data.splice(startingIndex + 1, layerIndex - startingIndex - 1);
|
|
65795
|
-
}
|
|
65796
|
-
get topLayer() {
|
|
65797
|
-
if (this.data.length === 0) {
|
|
65798
|
-
this.createLayer();
|
|
65799
|
-
}
|
|
65800
|
-
if (this.data[this.data.length - 1]?.optimistic) {
|
|
65801
|
-
this.createLayer();
|
|
65802
|
-
}
|
|
65803
|
-
return this.data[this.data.length - 1];
|
|
65804
|
-
}
|
|
65805
|
-
};
|
|
65806
|
-
var Layer = class {
|
|
65807
|
-
id;
|
|
65808
|
-
optimistic = false;
|
|
65809
|
-
fields = {};
|
|
65810
|
-
links = {};
|
|
65811
|
-
operations = {};
|
|
65812
|
-
deletedIDs = /* @__PURE__ */ new Set();
|
|
65813
|
-
constructor(id) {
|
|
65814
|
-
this.id = id;
|
|
65815
|
-
}
|
|
65816
|
-
get(id, field) {
|
|
65817
|
-
if (typeof this.links[id]?.[field] !== "undefined") {
|
|
65818
|
-
return [this.links[id][field], "link"];
|
|
65819
|
-
}
|
|
65820
|
-
return [this.fields[id]?.[field], "scalar"];
|
|
65821
|
-
}
|
|
65822
|
-
getOperations(id, field) {
|
|
65823
|
-
if (this.operations[id]?.deleted) {
|
|
65824
|
-
return [
|
|
65825
|
-
{
|
|
65826
|
-
kind: OperationKind.delete,
|
|
65827
|
-
target: id
|
|
65828
|
-
}
|
|
65829
|
-
];
|
|
65830
|
-
}
|
|
65831
|
-
if (this.operations[id]?.fields?.[field]) {
|
|
65832
|
-
return this.operations[id].fields[field];
|
|
65833
|
-
}
|
|
65834
|
-
}
|
|
65835
|
-
writeField(id, field, value) {
|
|
65836
|
-
this.fields[id] = {
|
|
65837
|
-
...this.fields[id],
|
|
65838
|
-
[field]: value
|
|
65839
|
-
};
|
|
65840
|
-
return this.id;
|
|
65841
|
-
}
|
|
65842
|
-
writeLink(id, field, value) {
|
|
65843
|
-
const valueList = Array.isArray(value) ? value : [value];
|
|
65844
|
-
for (const value2 of flattenList(valueList)) {
|
|
65845
|
-
if (!value2) {
|
|
65846
|
-
continue;
|
|
65847
|
-
}
|
|
65848
|
-
const fieldOperations = this.operations[id]?.fields[field];
|
|
65849
|
-
if (this.operations[value2]?.deleted || this.deletedIDs.has(value2)) {
|
|
65850
|
-
this.operations[value2] = {
|
|
65851
|
-
...this.operations[value2],
|
|
65852
|
-
undoDeletesInList: [...this.operations[id]?.undoDeletesInList || [], field]
|
|
65853
|
-
};
|
|
65854
|
-
} else if (value2 && fieldOperations?.length > 0) {
|
|
65855
|
-
this.operations[id].fields[field] = fieldOperations.filter(
|
|
65856
|
-
(op) => op.kind !== "remove" || op.id !== value2
|
|
65857
|
-
);
|
|
65858
|
-
}
|
|
65859
|
-
}
|
|
65860
|
-
this.links[id] = {
|
|
65861
|
-
...this.links[id],
|
|
65862
|
-
[field]: value
|
|
65863
|
-
};
|
|
65864
|
-
return this.id;
|
|
65865
|
-
}
|
|
65866
|
-
isDisplayLayer(displayLayers) {
|
|
65867
|
-
return displayLayers.length === 0 || displayLayers.includes(this.id) || Math.max(...displayLayers) < this.id;
|
|
65868
|
-
}
|
|
65869
|
-
clear() {
|
|
65870
|
-
this.links = {};
|
|
65871
|
-
this.fields = {};
|
|
65872
|
-
this.operations = {};
|
|
65873
|
-
this.deletedIDs = /* @__PURE__ */ new Set();
|
|
65874
|
-
}
|
|
65875
|
-
replaceID({ from, to }) {
|
|
65876
|
-
this.fields[to] = this.fields[from];
|
|
65877
|
-
this.links[to] = this.links[from];
|
|
65878
|
-
this.operations[to] = this.operations[from] || { fields: {} };
|
|
65879
|
-
if (this.deletedIDs.has(from)) {
|
|
65880
|
-
this.deletedIDs.add(to);
|
|
65881
|
-
}
|
|
65882
|
-
}
|
|
65883
|
-
removeUndefinedFields() {
|
|
65884
|
-
for (const [id, fields] of Object.entries(this.fields)) {
|
|
65885
|
-
for (const [field, value] of Object.entries(fields)) {
|
|
65886
|
-
if (typeof value === "undefined") {
|
|
65887
|
-
try {
|
|
65888
|
-
delete this.fields[id][field];
|
|
65889
|
-
} catch {
|
|
65890
|
-
}
|
|
65891
|
-
try {
|
|
65892
|
-
delete this.links[id][field];
|
|
65893
|
-
} catch {
|
|
65894
|
-
}
|
|
65895
|
-
}
|
|
65896
|
-
}
|
|
65897
|
-
if (Object.keys(fields || {}).length === 0) {
|
|
65898
|
-
delete this.fields[id];
|
|
65899
|
-
}
|
|
65900
|
-
if (Object.keys(this.links[id] || {}).length === 0) {
|
|
65901
|
-
delete this.links[id];
|
|
65902
|
-
}
|
|
65903
|
-
}
|
|
65904
|
-
}
|
|
65905
|
-
delete(id) {
|
|
65906
|
-
this.operations = {
|
|
65907
|
-
...this.operations,
|
|
65908
|
-
[id]: {
|
|
65909
|
-
...this.operations[id],
|
|
65910
|
-
deleted: true,
|
|
65911
|
-
undoDeletesInList: []
|
|
65912
|
-
}
|
|
65913
|
-
};
|
|
65914
|
-
this.deletedIDs.add(id);
|
|
65915
|
-
}
|
|
65916
|
-
deleteField(id, field) {
|
|
65917
|
-
this.fields[id] = {
|
|
65918
|
-
...this.fields[id],
|
|
65919
|
-
[field]: void 0
|
|
65920
|
-
};
|
|
65921
|
-
}
|
|
65922
|
-
insert(id, field, where, target) {
|
|
65923
|
-
this.addFieldOperation(id, field, {
|
|
65924
|
-
kind: OperationKind.insert,
|
|
65925
|
-
id: target,
|
|
65926
|
-
location: where
|
|
65927
|
-
});
|
|
65928
|
-
}
|
|
65929
|
-
remove(id, field, target) {
|
|
65930
|
-
this.addFieldOperation(id, field, {
|
|
65931
|
-
kind: OperationKind.remove,
|
|
65932
|
-
id: target
|
|
65933
|
-
});
|
|
65934
|
-
}
|
|
65935
|
-
writeLayer(layer) {
|
|
65936
|
-
if (layer.id === this.id) {
|
|
65937
|
-
return;
|
|
65938
|
-
}
|
|
65939
|
-
for (const [id, ops] of Object.entries(layer.operations)) {
|
|
65940
|
-
const fields = {};
|
|
65941
|
-
for (const opMap of [this.operations[id], layer.operations[id]].filter(Boolean)) {
|
|
65942
|
-
for (const [fieldName, operations] of Object.entries(opMap.fields || {})) {
|
|
65943
|
-
fields[fieldName] = [...fields[fieldName] || [], ...operations];
|
|
65944
|
-
}
|
|
65945
|
-
}
|
|
65946
|
-
if (Object.keys(fields).length > 0) {
|
|
65947
|
-
this.operations[id] = {
|
|
65948
|
-
...this.operations[id],
|
|
65949
|
-
fields
|
|
65950
|
-
};
|
|
65951
|
-
}
|
|
65952
|
-
if (ops?.deleted) {
|
|
65953
|
-
delete this.fields[id];
|
|
65954
|
-
delete this.links[id];
|
|
65955
|
-
}
|
|
65956
|
-
}
|
|
65957
|
-
for (const [id, values] of Object.entries(layer.fields)) {
|
|
65958
|
-
if (!values) {
|
|
65959
|
-
continue;
|
|
65960
|
-
}
|
|
65961
|
-
for (const [field, value] of Object.entries(values)) {
|
|
65962
|
-
this.writeField(id, field, value);
|
|
65963
|
-
}
|
|
65964
|
-
}
|
|
65965
|
-
for (const [id, values] of Object.entries(layer.links)) {
|
|
65966
|
-
if (!values) {
|
|
65967
|
-
continue;
|
|
65968
|
-
}
|
|
65969
|
-
for (const [field, value] of Object.entries(values)) {
|
|
65970
|
-
this.writeLink(id, field, value);
|
|
65971
|
-
}
|
|
65972
|
-
}
|
|
65973
|
-
layer.deletedIDs.forEach((v) => this.deletedIDs.add(v));
|
|
65974
|
-
}
|
|
65975
|
-
addFieldOperation(id, field, operation) {
|
|
65976
|
-
this.operations = {
|
|
65977
|
-
...this.operations,
|
|
65978
|
-
[id]: {
|
|
65979
|
-
...this.operations[id],
|
|
65980
|
-
fields: {
|
|
65981
|
-
[field]: [...this.operations[id]?.fields[field] || [], operation]
|
|
65982
|
-
}
|
|
65983
|
-
}
|
|
65984
|
-
};
|
|
65985
|
-
}
|
|
65986
|
-
};
|
|
65987
|
-
function isDeleteOperation(value) {
|
|
65988
|
-
return !!value && value.kind === OperationKind.delete;
|
|
65989
|
-
}
|
|
65990
|
-
function isInsertOperation(value) {
|
|
65991
|
-
return !!value && value.kind === OperationKind.insert;
|
|
65992
|
-
}
|
|
65993
|
-
function isRemoveOperation(value) {
|
|
65994
|
-
return !!value && value.kind === OperationKind.remove;
|
|
65995
|
-
}
|
|
65996
|
-
var OperationLocation = /* @__PURE__ */ ((OperationLocation2) => {
|
|
65997
|
-
OperationLocation2["start"] = "start";
|
|
65998
|
-
OperationLocation2["end"] = "end";
|
|
65999
|
-
return OperationLocation2;
|
|
66000
|
-
})(OperationLocation || {});
|
|
66001
|
-
var OperationKind = /* @__PURE__ */ ((OperationKind2) => {
|
|
66002
|
-
OperationKind2["delete"] = "delete";
|
|
66003
|
-
OperationKind2["insert"] = "insert";
|
|
66004
|
-
OperationKind2["remove"] = "remove";
|
|
66005
|
-
return OperationKind2;
|
|
66006
|
-
})(OperationKind || {});
|
|
66007
|
-
|
|
66008
|
-
// src/runtime/cache/subscription.ts
|
|
66009
|
-
var InMemorySubscriptions = class {
|
|
66010
|
-
cache;
|
|
66011
|
-
constructor(cache) {
|
|
66012
|
-
this.cache = cache;
|
|
66013
|
-
}
|
|
66014
|
-
subscribers = {};
|
|
66015
|
-
referenceCounts = {};
|
|
66016
|
-
keyVersions = {};
|
|
66017
|
-
add({
|
|
66018
|
-
parent,
|
|
66019
|
-
spec,
|
|
66020
|
-
selection: selection2,
|
|
66021
|
-
variables,
|
|
66022
|
-
parentType
|
|
66023
|
-
}) {
|
|
66024
|
-
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
66025
|
-
let targetSelection = getFieldsForType(selection2, __typename);
|
|
66026
|
-
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
66027
|
-
const { keyRaw, selection: innerSelection, type } = fieldSelection;
|
|
66028
|
-
const key = evaluateKey(keyRaw, variables);
|
|
66029
|
-
this.addFieldSubscription({
|
|
66030
|
-
id: parent,
|
|
66031
|
-
key,
|
|
66032
|
-
field: fieldSelection,
|
|
66033
|
-
spec,
|
|
66034
|
-
parentType: parentType || spec.rootType,
|
|
66035
|
-
variables
|
|
66036
|
-
});
|
|
66037
|
-
if (innerSelection) {
|
|
66038
|
-
const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
|
|
66039
|
-
parent,
|
|
66040
|
-
key
|
|
66041
|
-
);
|
|
66042
|
-
let children = !Array.isArray(linkedRecord) ? [linkedRecord] : flattenList(linkedRecord) || [];
|
|
66043
|
-
for (const child of children) {
|
|
66044
|
-
if (!child) {
|
|
66045
|
-
continue;
|
|
66046
|
-
}
|
|
66047
|
-
this.add({
|
|
66048
|
-
parent: child,
|
|
66049
|
-
spec,
|
|
66050
|
-
selection: innerSelection,
|
|
66051
|
-
variables,
|
|
66052
|
-
parentType: type
|
|
66053
|
-
});
|
|
66054
|
-
}
|
|
66055
|
-
}
|
|
66056
|
-
}
|
|
66057
|
-
}
|
|
66058
|
-
addFieldSubscription({
|
|
66059
|
-
id,
|
|
66060
|
-
key,
|
|
66061
|
-
field,
|
|
66062
|
-
spec,
|
|
66063
|
-
parentType,
|
|
66064
|
-
variables
|
|
66065
|
-
}) {
|
|
66066
|
-
if (!this.subscribers[id]) {
|
|
66067
|
-
this.subscribers[id] = {};
|
|
66068
|
-
}
|
|
66069
|
-
if (!this.subscribers[id][key]) {
|
|
66070
|
-
this.subscribers[id][key] = [];
|
|
66071
|
-
}
|
|
66072
|
-
if (!this.keyVersions[key]) {
|
|
66073
|
-
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
66074
|
-
}
|
|
66075
|
-
this.keyVersions[key].add(key);
|
|
66076
|
-
if (!this.subscribers[id][key].map(({ set }) => set).includes(spec.set)) {
|
|
66077
|
-
this.subscribers[id][key].push(spec);
|
|
66078
|
-
}
|
|
66079
|
-
if (!this.referenceCounts[id]) {
|
|
66080
|
-
this.referenceCounts[id] = {};
|
|
66081
|
-
}
|
|
66082
|
-
if (!this.referenceCounts[id][key]) {
|
|
66083
|
-
this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
|
|
66084
|
-
}
|
|
66085
|
-
const counts = this.referenceCounts[id][key];
|
|
66086
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
66087
|
-
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
66088
|
-
const { selection: selection2, list, filters } = field;
|
|
66089
|
-
if (selection2 && list) {
|
|
66090
|
-
this.cache._internal_unstable.lists.add({
|
|
66091
|
-
name: list.name,
|
|
66092
|
-
connection: list.connection,
|
|
66093
|
-
recordID: id,
|
|
66094
|
-
recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
|
|
66095
|
-
listType: list.type,
|
|
66096
|
-
key,
|
|
66097
|
-
selection: selection2,
|
|
66098
|
-
filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
|
|
66099
|
-
return {
|
|
66100
|
-
...acc,
|
|
66101
|
-
[key2]: kind !== "Variable" ? value : variables[value]
|
|
66102
|
-
};
|
|
66103
|
-
}, {})
|
|
66104
|
-
});
|
|
66105
|
-
}
|
|
66106
|
-
}
|
|
66107
|
-
addMany({
|
|
66108
|
-
parent,
|
|
66109
|
-
selection: selection2,
|
|
66110
|
-
variables,
|
|
66111
|
-
subscribers,
|
|
66112
|
-
parentType
|
|
66113
|
-
}) {
|
|
66114
|
-
let targetSelection = getFieldsForType(selection2, parentType);
|
|
66115
|
-
for (const fieldSelection of Object.values(targetSelection)) {
|
|
66116
|
-
const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
|
|
66117
|
-
const key = evaluateKey(keyRaw, variables);
|
|
66118
|
-
for (const spec of subscribers) {
|
|
66119
|
-
this.addFieldSubscription({
|
|
66120
|
-
id: parent,
|
|
66121
|
-
key,
|
|
66122
|
-
field: fieldSelection,
|
|
66123
|
-
spec,
|
|
66124
|
-
parentType,
|
|
66125
|
-
variables
|
|
66126
|
-
});
|
|
66127
|
-
}
|
|
66128
|
-
if (innerSelection) {
|
|
66129
|
-
const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
|
|
66130
|
-
const children = !Array.isArray(link) ? [link] : flattenList(link);
|
|
66131
|
-
for (const linkedRecord of children) {
|
|
66132
|
-
if (!linkedRecord) {
|
|
66133
|
-
continue;
|
|
66134
|
-
}
|
|
66135
|
-
this.addMany({
|
|
66136
|
-
parent: linkedRecord,
|
|
66137
|
-
selection: innerSelection,
|
|
66138
|
-
variables,
|
|
66139
|
-
subscribers,
|
|
66140
|
-
parentType: linkedType
|
|
66141
|
-
});
|
|
66142
|
-
}
|
|
66143
|
-
}
|
|
66144
|
-
}
|
|
66145
|
-
}
|
|
66146
|
-
get(id, field) {
|
|
66147
|
-
return this.subscribers[id]?.[field] || [];
|
|
66148
|
-
}
|
|
66149
|
-
remove(id, selection2, targets, variables, visited = []) {
|
|
66150
|
-
visited.push(id);
|
|
66151
|
-
const linkedIDs = [];
|
|
66152
|
-
for (const fieldSelection of Object.values(selection2.fields || {})) {
|
|
66153
|
-
const key = evaluateKey(fieldSelection.keyRaw, variables);
|
|
66154
|
-
this.removeSubscribers(id, key, targets);
|
|
66155
|
-
if (!fieldSelection.selection?.fields) {
|
|
66156
|
-
continue;
|
|
66157
|
-
}
|
|
66158
|
-
const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
|
|
66159
|
-
const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
|
|
66160
|
-
for (const link of links) {
|
|
66161
|
-
if (link !== null) {
|
|
66162
|
-
linkedIDs.push([link, fieldSelection.selection || {}]);
|
|
66163
|
-
}
|
|
66164
|
-
}
|
|
66165
|
-
}
|
|
66166
|
-
for (const [linkedRecordID, linkFields] of linkedIDs) {
|
|
66167
|
-
this.remove(linkedRecordID, linkFields, targets, visited);
|
|
66168
|
-
}
|
|
66169
|
-
}
|
|
66170
|
-
removeSubscribers(id, fieldName, specs) {
|
|
66171
|
-
let targets = [];
|
|
66172
|
-
for (const spec of specs) {
|
|
66173
|
-
if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
|
|
66174
|
-
continue;
|
|
66175
|
-
}
|
|
66176
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
66177
|
-
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
66178
|
-
counts.set(spec.set, newVal);
|
|
66179
|
-
if (newVal <= 0) {
|
|
66180
|
-
targets.push(spec.set);
|
|
66181
|
-
counts.delete(spec.set);
|
|
66182
|
-
}
|
|
66183
|
-
}
|
|
66184
|
-
if (this.subscribers[id]) {
|
|
66185
|
-
this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
|
|
66186
|
-
({ set }) => !targets.includes(set)
|
|
66187
|
-
);
|
|
66188
|
-
}
|
|
66189
|
-
}
|
|
66190
|
-
removeAllSubscribers(id, targets, visited = []) {
|
|
66191
|
-
visited.push(id);
|
|
66192
|
-
for (const field of Object.keys(this.subscribers[id] || [])) {
|
|
66193
|
-
const subscribers = targets || this.subscribers[id][field];
|
|
66194
|
-
this.removeSubscribers(id, field, subscribers);
|
|
66195
|
-
const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
|
|
66196
|
-
if (kind === "scalar") {
|
|
66197
|
-
continue;
|
|
66198
|
-
}
|
|
66199
|
-
const nextTargets = Array.isArray(value) ? flattenList(value) : [value];
|
|
66200
|
-
for (const id2 of nextTargets) {
|
|
66201
|
-
if (visited.includes(id2)) {
|
|
66202
|
-
continue;
|
|
66203
|
-
}
|
|
66204
|
-
this.removeAllSubscribers(id2, subscribers, visited);
|
|
66205
|
-
}
|
|
66206
|
-
}
|
|
66207
|
-
}
|
|
66208
|
-
};
|
|
66209
|
-
|
|
66210
|
-
// src/runtime/cache/cache.ts
|
|
66211
|
-
var Cache3 = class {
|
|
66212
|
-
_internal_unstable;
|
|
66213
|
-
constructor(config4) {
|
|
66214
|
-
this._internal_unstable = new CacheInternal({
|
|
66215
|
-
cache: this,
|
|
66216
|
-
storage: new InMemoryStorage(),
|
|
66217
|
-
subscriptions: new InMemorySubscriptions(this),
|
|
66218
|
-
lists: new ListManager(this, rootID),
|
|
66219
|
-
lifetimes: new GarbageCollector(this),
|
|
66220
|
-
schema: new SchemaManager(this)
|
|
66221
|
-
});
|
|
66222
|
-
if (config4) {
|
|
66223
|
-
this.setConfig(defaultConfigValues(config4));
|
|
66224
|
-
}
|
|
66225
|
-
}
|
|
66226
|
-
write({
|
|
66227
|
-
layer: layerID,
|
|
66228
|
-
notifySubscribers = [],
|
|
66229
|
-
...args
|
|
66230
|
-
}) {
|
|
66231
|
-
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
66232
|
-
const subscribers = this._internal_unstable.writeSelection({ ...args, layer });
|
|
66233
|
-
const notified = [];
|
|
66234
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
66235
|
-
if (!notified.includes(spec.set)) {
|
|
66236
|
-
notified.push(spec.set);
|
|
66237
|
-
spec.set(
|
|
66238
|
-
this._internal_unstable.getSelection({
|
|
66239
|
-
parent: spec.parentID || rootID,
|
|
66240
|
-
selection: spec.selection,
|
|
66241
|
-
variables: spec.variables?.() || {}
|
|
66242
|
-
}).data
|
|
66243
|
-
);
|
|
66244
|
-
}
|
|
66245
|
-
}
|
|
66246
|
-
return subscribers;
|
|
66247
|
-
}
|
|
66248
|
-
read(...args) {
|
|
66249
|
-
const { data, partial, hasData } = this._internal_unstable.getSelection(...args);
|
|
66250
|
-
if (!hasData) {
|
|
66251
|
-
return { data: null, partial: false };
|
|
66252
|
-
}
|
|
66253
|
-
return {
|
|
66254
|
-
data,
|
|
66255
|
-
partial
|
|
66256
|
-
};
|
|
66257
|
-
}
|
|
66258
|
-
subscribe(spec, variables = {}) {
|
|
66259
|
-
return this._internal_unstable.subscriptions.add({
|
|
66260
|
-
parent: spec.parentID || rootID,
|
|
66261
|
-
spec,
|
|
66262
|
-
selection: spec.selection,
|
|
66263
|
-
variables
|
|
66264
|
-
});
|
|
66265
|
-
}
|
|
66266
|
-
unsubscribe(spec, variables = {}) {
|
|
66267
|
-
return this._internal_unstable.subscriptions.remove(
|
|
66268
|
-
spec.parentID || rootID,
|
|
66269
|
-
spec.selection,
|
|
66270
|
-
[spec],
|
|
66271
|
-
variables
|
|
66272
|
-
);
|
|
66273
|
-
}
|
|
66274
|
-
list(name2, parentID, allLists) {
|
|
66275
|
-
const handler = this._internal_unstable.lists.get(name2, parentID, allLists);
|
|
66276
|
-
if (!handler) {
|
|
66277
|
-
throw new Error(
|
|
66278
|
-
`Cannot find list with name: ${name2}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
|
|
66279
|
-
);
|
|
66280
|
-
}
|
|
66281
|
-
return handler;
|
|
66282
|
-
}
|
|
66283
|
-
delete(id) {
|
|
66284
|
-
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
66285
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
66286
|
-
this._internal_unstable.storage.delete(id);
|
|
66287
|
-
}
|
|
66288
|
-
setConfig(config4) {
|
|
66289
|
-
this._internal_unstable.setConfig(config4);
|
|
66290
|
-
}
|
|
66291
|
-
};
|
|
66292
|
-
var CacheInternal = class {
|
|
66293
|
-
_disabled = false;
|
|
66294
|
-
config = defaultConfigValues({
|
|
66295
|
-
plugins: {
|
|
66296
|
-
"houdini-svelte": {
|
|
66297
|
-
client: ""
|
|
66298
|
-
}
|
|
66299
|
-
}
|
|
66300
|
-
});
|
|
66301
|
-
storage;
|
|
66302
|
-
subscriptions;
|
|
66303
|
-
lists;
|
|
66304
|
-
cache;
|
|
66305
|
-
lifetimes;
|
|
66306
|
-
schema;
|
|
66307
|
-
constructor({
|
|
66308
|
-
storage,
|
|
66309
|
-
subscriptions,
|
|
66310
|
-
lists,
|
|
66311
|
-
cache,
|
|
66312
|
-
lifetimes,
|
|
66313
|
-
schema
|
|
66314
|
-
}) {
|
|
66315
|
-
this.storage = storage;
|
|
66316
|
-
this.subscriptions = subscriptions;
|
|
66317
|
-
this.lists = lists;
|
|
66318
|
-
this.cache = cache;
|
|
66319
|
-
this.lifetimes = lifetimes;
|
|
66320
|
-
this.schema = schema;
|
|
66321
|
-
this._disabled = typeof globalThis.window === "undefined";
|
|
66322
|
-
try {
|
|
66323
|
-
if (process.env.HOUDINI_TEST === "true") {
|
|
66324
|
-
this._disabled = false;
|
|
66325
|
-
}
|
|
66326
|
-
} catch {
|
|
66327
|
-
}
|
|
66328
|
-
}
|
|
66329
|
-
setConfig(config4) {
|
|
66330
|
-
this.config = config4;
|
|
66331
|
-
}
|
|
66332
|
-
writeSelection({
|
|
66333
|
-
data,
|
|
66334
|
-
selection: selection2,
|
|
66335
|
-
variables = {},
|
|
66336
|
-
parent = rootID,
|
|
66337
|
-
applyUpdates = false,
|
|
66338
|
-
layer,
|
|
66339
|
-
toNotify = [],
|
|
66340
|
-
forceNotify
|
|
66341
|
-
}) {
|
|
66342
|
-
if (this._disabled) {
|
|
66343
|
-
return [];
|
|
66344
|
-
}
|
|
66345
|
-
let targetSelection = getFieldsForType(selection2, data["__typename"]);
|
|
66346
|
-
for (const [field, value] of Object.entries(data)) {
|
|
66347
|
-
if (!selection2 || !targetSelection[field]) {
|
|
66348
|
-
throw new Error(
|
|
66349
|
-
"Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
|
|
66350
|
-
);
|
|
66351
|
-
}
|
|
66352
|
-
let {
|
|
66353
|
-
type: linkedType,
|
|
66354
|
-
keyRaw,
|
|
66355
|
-
selection: fieldSelection,
|
|
66356
|
-
operations,
|
|
66357
|
-
abstract: isAbstract,
|
|
66358
|
-
update,
|
|
66359
|
-
nullable
|
|
66360
|
-
} = targetSelection[field];
|
|
66361
|
-
const key = evaluateKey(keyRaw, variables);
|
|
66362
|
-
this.schema.setFieldType({
|
|
66363
|
-
parent,
|
|
66364
|
-
key: keyRaw,
|
|
66365
|
-
type: linkedType,
|
|
66366
|
-
nullable,
|
|
66367
|
-
link: !!fieldSelection
|
|
66368
|
-
});
|
|
66369
|
-
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
66370
|
-
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
66371
|
-
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
66372
|
-
if (displayLayer) {
|
|
66373
|
-
this.lifetimes.resetLifetime(parent, key);
|
|
66374
|
-
}
|
|
66375
|
-
if (!fieldSelection) {
|
|
66376
|
-
let newValue = value;
|
|
66377
|
-
if (Array.isArray(value) && applyUpdates && update) {
|
|
66378
|
-
if (update === "append") {
|
|
66379
|
-
newValue = (previousValue || []).concat(value);
|
|
66380
|
-
} else if (update === "prepend") {
|
|
66381
|
-
newValue = value.concat(previousValue || []);
|
|
66382
|
-
}
|
|
66383
|
-
}
|
|
66384
|
-
const valueChanged = !deepEquals(newValue, previousValue);
|
|
66385
|
-
if (displayLayer && (valueChanged || forceNotify)) {
|
|
66386
|
-
toNotify.push(...currentSubscribers);
|
|
66387
|
-
}
|
|
66388
|
-
layer.writeField(parent, key, newValue);
|
|
66389
|
-
} else if (value === null) {
|
|
66390
|
-
if (previousValue === null) {
|
|
66391
|
-
continue;
|
|
66392
|
-
}
|
|
66393
|
-
const previousLinks = flattenList([previousValue]);
|
|
66394
|
-
for (const link of previousLinks) {
|
|
66395
|
-
this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
|
|
66396
|
-
}
|
|
66397
|
-
layer.writeLink(parent, key, null);
|
|
66398
|
-
toNotify.push(...currentSubscribers);
|
|
66399
|
-
} else if (value instanceof Object && !Array.isArray(value)) {
|
|
66400
|
-
if (isAbstract) {
|
|
66401
|
-
if (!value.__typename) {
|
|
66402
|
-
throw new Error(
|
|
66403
|
-
"Encountered interface type without __typename in the payload"
|
|
66404
|
-
);
|
|
66405
|
-
}
|
|
66406
|
-
linkedType = value.__typename;
|
|
66407
|
-
}
|
|
66408
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
66409
|
-
(field2) => typeof value[field2] === "undefined"
|
|
66410
|
-
).length > 0;
|
|
66411
|
-
let linkedID = null;
|
|
66412
|
-
if (value !== null) {
|
|
66413
|
-
linkedID = !embedded ? this.id(linkedType, value) : `${parent}.${key}`;
|
|
66414
|
-
}
|
|
66415
|
-
let linkChange = linkedID !== previousValue;
|
|
66416
|
-
layer.writeLink(parent, key, linkedID);
|
|
66417
|
-
if (linkedID && displayLayer && (linkChange || forceNotify)) {
|
|
66418
|
-
if (previousValue && typeof previousValue === "string") {
|
|
66419
|
-
this.subscriptions.remove(
|
|
66420
|
-
previousValue,
|
|
66421
|
-
fieldSelection,
|
|
66422
|
-
currentSubscribers,
|
|
66423
|
-
variables
|
|
66424
|
-
);
|
|
66425
|
-
}
|
|
66426
|
-
this.subscriptions.addMany({
|
|
66427
|
-
parent: linkedID,
|
|
66428
|
-
selection: fieldSelection,
|
|
66429
|
-
subscribers: currentSubscribers,
|
|
66430
|
-
variables,
|
|
66431
|
-
parentType: linkedType
|
|
66432
|
-
});
|
|
66433
|
-
toNotify.push(...currentSubscribers);
|
|
66434
|
-
}
|
|
66435
|
-
if (linkedID) {
|
|
66436
|
-
this.writeSelection({
|
|
66437
|
-
selection: fieldSelection,
|
|
66438
|
-
parent: linkedID,
|
|
66439
|
-
data: value,
|
|
66440
|
-
variables,
|
|
66441
|
-
toNotify,
|
|
66442
|
-
applyUpdates,
|
|
66443
|
-
layer,
|
|
66444
|
-
forceNotify
|
|
66445
|
-
});
|
|
66446
|
-
}
|
|
66447
|
-
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
|
|
66448
|
-
let oldIDs = [...previousValue || []];
|
|
66449
|
-
const emptyEdges = !update ? [] : oldIDs.map((id) => {
|
|
66450
|
-
if (!id) {
|
|
66451
|
-
return "";
|
|
66452
|
-
}
|
|
66453
|
-
const { value: cursorField } = this.storage.get(id, "cursor");
|
|
66454
|
-
if (cursorField) {
|
|
66455
|
-
return "";
|
|
66456
|
-
}
|
|
66457
|
-
const { value: node } = this.storage.get(id, "node");
|
|
66458
|
-
if (!node) {
|
|
66459
|
-
return "";
|
|
66460
|
-
}
|
|
66461
|
-
return node;
|
|
66462
|
-
});
|
|
66463
|
-
let linkedIDs = [];
|
|
66464
|
-
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
66465
|
-
value,
|
|
66466
|
-
abstract: Boolean(isAbstract),
|
|
66467
|
-
specs: toNotify,
|
|
66468
|
-
applyUpdates,
|
|
66469
|
-
recordID: parent,
|
|
66470
|
-
key,
|
|
66471
|
-
linkedType,
|
|
66472
|
-
variables,
|
|
66473
|
-
fields: fieldSelection,
|
|
66474
|
-
layer,
|
|
66475
|
-
forceNotify
|
|
66476
|
-
});
|
|
66477
|
-
if (applyUpdates && update) {
|
|
66478
|
-
if (key === "edges") {
|
|
66479
|
-
const newNodeIDs = [];
|
|
66480
|
-
for (const id of newIDs) {
|
|
66481
|
-
if (!id) {
|
|
66482
|
-
continue;
|
|
66483
|
-
}
|
|
66484
|
-
const { value: node } = this.storage.get(id, "node");
|
|
66485
|
-
if (typeof node !== "string") {
|
|
66486
|
-
continue;
|
|
66487
|
-
}
|
|
66488
|
-
if (!node || !this.storage.get(node, "__typename")) {
|
|
66489
|
-
continue;
|
|
66490
|
-
}
|
|
66491
|
-
newNodeIDs.push(node);
|
|
66492
|
-
}
|
|
66493
|
-
oldIDs = oldIDs.filter((id) => {
|
|
66494
|
-
if (!id) {
|
|
66495
|
-
return true;
|
|
66496
|
-
}
|
|
66497
|
-
const { value: value2 } = this.storage.get(id, "node");
|
|
66498
|
-
const node = value2;
|
|
66499
|
-
if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
|
|
66500
|
-
return false;
|
|
66501
|
-
}
|
|
66502
|
-
return true;
|
|
66503
|
-
});
|
|
66504
|
-
}
|
|
66505
|
-
if (update === "prepend") {
|
|
66506
|
-
linkedIDs = newIDs.concat(oldIDs);
|
|
66507
|
-
} else if (update === "append") {
|
|
66508
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
66509
|
-
} else if (update === "replace") {
|
|
66510
|
-
linkedIDs = newIDs;
|
|
66511
|
-
}
|
|
66512
|
-
} else {
|
|
66513
|
-
linkedIDs = nestedIDs;
|
|
66514
|
-
}
|
|
66515
|
-
const contentChanged = !deepEquals(linkedIDs, oldIDs);
|
|
66516
|
-
if (contentChanged || forceNotify) {
|
|
66517
|
-
toNotify.push(...currentSubscribers);
|
|
66518
|
-
}
|
|
66519
|
-
for (const lostID of oldIDs) {
|
|
66520
|
-
if (linkedIDs.includes(lostID) || !lostID) {
|
|
66521
|
-
continue;
|
|
66522
|
-
}
|
|
66523
|
-
this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
|
|
66524
|
-
}
|
|
66525
|
-
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
66526
|
-
layer.writeLink(parent, key, linkedIDs);
|
|
66527
|
-
}
|
|
66528
|
-
for (const id of newIDs.filter((id2) => !oldIDs.includes(id2))) {
|
|
66529
|
-
if (id == null) {
|
|
66530
|
-
continue;
|
|
66531
|
-
}
|
|
66532
|
-
this.subscriptions.addMany({
|
|
66533
|
-
parent: id,
|
|
66534
|
-
selection: fieldSelection,
|
|
66535
|
-
subscribers: currentSubscribers,
|
|
66536
|
-
variables,
|
|
66537
|
-
parentType: linkedType
|
|
66538
|
-
});
|
|
66539
|
-
}
|
|
66540
|
-
}
|
|
66541
|
-
for (const operation of operations || []) {
|
|
66542
|
-
let parentID;
|
|
66543
|
-
if (operation.parentID) {
|
|
66544
|
-
if (operation.parentID.kind !== "Variable") {
|
|
66545
|
-
parentID = operation.parentID.value;
|
|
66546
|
-
} else {
|
|
66547
|
-
const id = variables[operation.parentID.value];
|
|
66548
|
-
if (typeof id !== "string") {
|
|
66549
|
-
throw new Error("parentID value must be a string");
|
|
66550
|
-
}
|
|
66551
|
-
parentID = id;
|
|
66552
|
-
}
|
|
66553
|
-
}
|
|
66554
|
-
if (operation.list && !this.lists.get(operation.list, parentID, operation.target === "all")) {
|
|
66555
|
-
continue;
|
|
66556
|
-
}
|
|
66557
|
-
const targets = Array.isArray(value) ? value : [value];
|
|
66558
|
-
for (const target of targets) {
|
|
66559
|
-
if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
|
|
66560
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
66561
|
-
fieldSelection,
|
|
66562
|
-
target,
|
|
66563
|
-
variables,
|
|
66564
|
-
operation.position || "last"
|
|
66565
|
-
);
|
|
66566
|
-
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
66567
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
66568
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
66569
|
-
if (typeof target !== "string") {
|
|
66570
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
66571
|
-
}
|
|
66572
|
-
const targetID = this.id(operation.type, target);
|
|
66573
|
-
if (!targetID) {
|
|
66574
|
-
continue;
|
|
66575
|
-
}
|
|
66576
|
-
this.cache.delete(targetID);
|
|
66577
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
66578
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
66579
|
-
fieldSelection,
|
|
66580
|
-
target,
|
|
66581
|
-
variables,
|
|
66582
|
-
operation.position || "last"
|
|
66583
|
-
);
|
|
66584
|
-
}
|
|
66585
|
-
}
|
|
66586
|
-
}
|
|
66587
|
-
}
|
|
66588
|
-
return toNotify;
|
|
66589
|
-
}
|
|
66590
|
-
getSelection({
|
|
66591
|
-
selection: selection2,
|
|
66592
|
-
parent = rootID,
|
|
66593
|
-
variables,
|
|
66594
|
-
stepsFromConnection = null
|
|
66595
|
-
}) {
|
|
66596
|
-
if (parent === null) {
|
|
66597
|
-
return { data: null, partial: false, hasData: true };
|
|
66598
|
-
}
|
|
66599
|
-
const target = {};
|
|
66600
|
-
let hasData = false;
|
|
66601
|
-
let partial = false;
|
|
66602
|
-
let cascadeNull = false;
|
|
66603
|
-
const typename = this.storage.get(parent, "__typename").value;
|
|
66604
|
-
let targetSelection = getFieldsForType(selection2, typename);
|
|
66605
|
-
for (const [
|
|
66606
|
-
attributeName,
|
|
66607
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list }
|
|
66608
|
-
] of Object.entries(targetSelection)) {
|
|
66609
|
-
const key = evaluateKey(keyRaw, variables);
|
|
66610
|
-
const { value } = this.storage.get(parent, key);
|
|
66611
|
-
let nextStep = stepsFromConnection;
|
|
66612
|
-
if (nextStep !== null) {
|
|
66613
|
-
if (nextStep >= 2) {
|
|
66614
|
-
nextStep = null;
|
|
66615
|
-
} else {
|
|
66616
|
-
nextStep += 1;
|
|
66617
|
-
}
|
|
66618
|
-
}
|
|
66619
|
-
if (list?.connection) {
|
|
66620
|
-
nextStep = 0;
|
|
66621
|
-
}
|
|
66622
|
-
const embeddedCursor = key === "cursor" && stepsFromConnection === 1;
|
|
66623
|
-
if (typeof value === "undefined" && !embeddedCursor) {
|
|
66624
|
-
partial = true;
|
|
66625
|
-
}
|
|
66626
|
-
if (typeof value === "undefined" || value === null) {
|
|
66627
|
-
target[attributeName] = null;
|
|
66628
|
-
if (typeof value !== "undefined") {
|
|
66629
|
-
hasData = true;
|
|
66630
|
-
}
|
|
66631
|
-
} else if (!fieldSelection) {
|
|
66632
|
-
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
66633
|
-
if (fnUnmarshal) {
|
|
66634
|
-
target[attributeName] = fnUnmarshal(value);
|
|
66635
|
-
} else {
|
|
66636
|
-
target[attributeName] = value;
|
|
66637
|
-
}
|
|
66638
|
-
hasData = true;
|
|
66639
|
-
} else if (Array.isArray(value)) {
|
|
66640
|
-
const listValue = this.hydrateNestedList({
|
|
66641
|
-
fields: fieldSelection,
|
|
66642
|
-
variables,
|
|
66643
|
-
linkedList: value,
|
|
66644
|
-
stepsFromConnection: nextStep
|
|
66645
|
-
});
|
|
66646
|
-
target[attributeName] = listValue.data;
|
|
66647
|
-
if (listValue.partial) {
|
|
66648
|
-
partial = true;
|
|
66649
|
-
}
|
|
66650
|
-
if (listValue.hasData || value.length === 0) {
|
|
66651
|
-
hasData = true;
|
|
66652
|
-
}
|
|
66653
|
-
} else {
|
|
66654
|
-
const objectFields = this.getSelection({
|
|
66655
|
-
parent: value,
|
|
66656
|
-
selection: fieldSelection,
|
|
66657
|
-
variables,
|
|
66658
|
-
stepsFromConnection: nextStep
|
|
66659
|
-
});
|
|
66660
|
-
target[attributeName] = objectFields.data;
|
|
66661
|
-
if (objectFields.partial) {
|
|
66662
|
-
partial = true;
|
|
66663
|
-
}
|
|
66664
|
-
if (objectFields.hasData) {
|
|
66665
|
-
hasData = true;
|
|
66666
|
-
}
|
|
66667
|
-
}
|
|
66668
|
-
if (target[attributeName] === null && !nullable && !embeddedCursor) {
|
|
66669
|
-
cascadeNull = true;
|
|
66670
|
-
}
|
|
66671
|
-
}
|
|
66672
|
-
return {
|
|
66673
|
-
data: cascadeNull ? null : target,
|
|
66674
|
-
partial: hasData && partial,
|
|
66675
|
-
hasData
|
|
66676
|
-
};
|
|
66677
|
-
}
|
|
66678
|
-
id(type, data) {
|
|
66679
|
-
const id = typeof data === "string" ? data : this.computeID(type, data);
|
|
66680
|
-
if (!id) {
|
|
66681
|
-
return null;
|
|
66682
|
-
}
|
|
66683
|
-
if (!type) {
|
|
66684
|
-
return id;
|
|
66685
|
-
}
|
|
66686
|
-
return type + ":" + id;
|
|
66687
|
-
}
|
|
66688
|
-
idFields(type) {
|
|
66689
|
-
return keyFieldsForType(this.config, type);
|
|
66690
|
-
}
|
|
66691
|
-
computeID(type, data) {
|
|
66692
|
-
return computeID(this.config, type, data);
|
|
66693
|
-
}
|
|
66694
|
-
hydrateNestedList({
|
|
66695
|
-
fields,
|
|
66696
|
-
variables,
|
|
66697
|
-
linkedList,
|
|
66698
|
-
stepsFromConnection
|
|
66699
|
-
}) {
|
|
66700
|
-
const result = [];
|
|
66701
|
-
let partialData = false;
|
|
66702
|
-
let hasValues = false;
|
|
66703
|
-
for (const entry of linkedList) {
|
|
66704
|
-
if (Array.isArray(entry)) {
|
|
66705
|
-
const nestedValue = this.hydrateNestedList({
|
|
66706
|
-
fields,
|
|
66707
|
-
variables,
|
|
66708
|
-
linkedList: entry,
|
|
66709
|
-
stepsFromConnection
|
|
66710
|
-
});
|
|
66711
|
-
result.push(nestedValue.data);
|
|
66712
|
-
if (nestedValue.partial) {
|
|
66713
|
-
partialData = true;
|
|
66714
|
-
}
|
|
66715
|
-
continue;
|
|
66716
|
-
}
|
|
66717
|
-
if (entry === null) {
|
|
66718
|
-
result.push(entry);
|
|
66719
|
-
continue;
|
|
66720
|
-
}
|
|
66721
|
-
const { data, partial, hasData } = this.getSelection({
|
|
66722
|
-
parent: entry,
|
|
66723
|
-
selection: fields,
|
|
66724
|
-
variables,
|
|
66725
|
-
stepsFromConnection
|
|
66726
|
-
});
|
|
66727
|
-
result.push(data);
|
|
66728
|
-
if (partial) {
|
|
66729
|
-
partialData = true;
|
|
66730
|
-
}
|
|
66731
|
-
if (hasData) {
|
|
66732
|
-
hasValues = true;
|
|
66733
|
-
}
|
|
66734
|
-
}
|
|
66735
|
-
return {
|
|
66736
|
-
data: result,
|
|
66737
|
-
partial: partialData,
|
|
66738
|
-
hasData: hasValues
|
|
66739
|
-
};
|
|
66740
|
-
}
|
|
66741
|
-
extractNestedListIDs({
|
|
66742
|
-
value,
|
|
66743
|
-
abstract,
|
|
66744
|
-
recordID,
|
|
66745
|
-
key,
|
|
66746
|
-
linkedType,
|
|
66747
|
-
fields,
|
|
66748
|
-
variables,
|
|
66749
|
-
applyUpdates,
|
|
66750
|
-
specs,
|
|
66751
|
-
layer,
|
|
66752
|
-
forceNotify
|
|
66753
|
-
}) {
|
|
66754
|
-
const nestedIDs = [];
|
|
66755
|
-
const newIDs = [];
|
|
66756
|
-
for (const [i2, entry] of value.entries()) {
|
|
66757
|
-
if (Array.isArray(entry)) {
|
|
66758
|
-
const inner = this.extractNestedListIDs({
|
|
66759
|
-
value: entry,
|
|
66760
|
-
abstract,
|
|
66761
|
-
recordID,
|
|
66762
|
-
key,
|
|
66763
|
-
linkedType,
|
|
66764
|
-
fields,
|
|
66765
|
-
variables,
|
|
66766
|
-
applyUpdates,
|
|
66767
|
-
specs,
|
|
66768
|
-
layer,
|
|
66769
|
-
forceNotify
|
|
66770
|
-
});
|
|
66771
|
-
newIDs.push(...inner.newIDs);
|
|
66772
|
-
nestedIDs[i2] = inner.nestedIDs;
|
|
66773
|
-
continue;
|
|
66774
|
-
}
|
|
66775
|
-
if (entry === null || typeof entry === "undefined") {
|
|
66776
|
-
newIDs.push(null);
|
|
66777
|
-
nestedIDs[i2] = null;
|
|
66778
|
-
continue;
|
|
66779
|
-
}
|
|
66780
|
-
const entryObj = entry;
|
|
66781
|
-
let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
|
|
66782
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
66783
|
-
(field) => typeof entry[field] === "undefined"
|
|
66784
|
-
).length > 0;
|
|
66785
|
-
const typename = entryObj.__typename;
|
|
66786
|
-
let innerType = linkedType;
|
|
66787
|
-
if (abstract) {
|
|
66788
|
-
if (!typename) {
|
|
66789
|
-
throw new Error("Encountered interface type without __typename in the payload");
|
|
66790
|
-
}
|
|
66791
|
-
innerType = typename;
|
|
66792
|
-
}
|
|
66793
|
-
if (!embedded) {
|
|
66794
|
-
const id = this.id(innerType, entry);
|
|
66795
|
-
if (id) {
|
|
66796
|
-
linkedID = id;
|
|
66797
|
-
} else {
|
|
66798
|
-
continue;
|
|
66799
|
-
}
|
|
66800
|
-
}
|
|
66801
|
-
this.writeSelection({
|
|
66802
|
-
root: rootID,
|
|
66803
|
-
selection: fields,
|
|
66804
|
-
parent: linkedID,
|
|
66805
|
-
data: entryObj,
|
|
66806
|
-
variables,
|
|
66807
|
-
toNotify: specs,
|
|
66808
|
-
applyUpdates,
|
|
66809
|
-
layer,
|
|
66810
|
-
forceNotify
|
|
66811
|
-
});
|
|
66812
|
-
newIDs.push(linkedID);
|
|
66813
|
-
nestedIDs[i2] = linkedID;
|
|
66814
|
-
}
|
|
66815
|
-
return { newIDs, nestedIDs };
|
|
66816
|
-
}
|
|
66817
|
-
collectGarbage() {
|
|
66818
|
-
this.lifetimes.tick();
|
|
66819
|
-
if (this.storage.layerCount === 1) {
|
|
66820
|
-
this.storage.topLayer.removeUndefinedFields();
|
|
66821
|
-
}
|
|
66822
|
-
}
|
|
66823
|
-
};
|
|
66824
|
-
var rootID = "_ROOT_";
|
|
66825
|
-
|
|
66826
|
-
// src/runtime/cache/index.ts
|
|
66827
|
-
var cache_default = new Cache3();
|
|
66828
|
-
|
|
66829
65116
|
// src/runtime/lib/types.ts
|
|
66830
65117
|
var CompiledFragmentKind = "HoudiniFragment" /* Fragment */;
|
|
66831
65118
|
var CompiledMutationKind = "HoudiniMutation" /* Mutation */;
|
|
@@ -67123,7 +65410,7 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
67123
65410
|
const targetPath = join2(parentDir, child);
|
|
67124
65411
|
let original = await readFile(childPath) || "";
|
|
67125
65412
|
if (transforms?.[childPath]) {
|
|
67126
|
-
original = transforms[childPath](original);
|
|
65413
|
+
original = await transforms[childPath](original, childPath);
|
|
67127
65414
|
}
|
|
67128
65415
|
await writeFile(targetPath, original);
|
|
67129
65416
|
}
|
|
@@ -67259,7 +65546,7 @@ var Body = class {
|
|
|
67259
65546
|
} else if (ArrayBuffer.isView(body)) {
|
|
67260
65547
|
body = import_node_buffer.Buffer.from(body.buffer, body.byteOffset, body.byteLength);
|
|
67261
65548
|
} else if (body instanceof import_node_stream.default) {
|
|
67262
|
-
} else if (body instanceof
|
|
65549
|
+
} else if (body instanceof FormData) {
|
|
67263
65550
|
body = formDataToBlob(body);
|
|
67264
65551
|
boundary = body.type.split("=")[1];
|
|
67265
65552
|
} else {
|
|
@@ -67299,7 +65586,7 @@ var Body = class {
|
|
|
67299
65586
|
async formData() {
|
|
67300
65587
|
const ct = this.headers.get("content-type");
|
|
67301
65588
|
if (ct.startsWith("application/x-www-form-urlencoded")) {
|
|
67302
|
-
const formData = new
|
|
65589
|
+
const formData = new FormData();
|
|
67303
65590
|
const parameters = new URLSearchParams(await this.text());
|
|
67304
65591
|
for (const [name2, value] of parameters) {
|
|
67305
65592
|
formData.append(name2, value);
|
|
@@ -67425,7 +65712,7 @@ var extractContentType = (body, request) => {
|
|
|
67425
65712
|
if (import_node_buffer.Buffer.isBuffer(body) || import_node_util.types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
|
|
67426
65713
|
return null;
|
|
67427
65714
|
}
|
|
67428
|
-
if (body instanceof
|
|
65715
|
+
if (body instanceof FormData) {
|
|
67429
65716
|
return `multipart/form-data; boundary=${request[INTERNALS].boundary}`;
|
|
67430
65717
|
}
|
|
67431
65718
|
if (body && typeof body.getBoundary === "function") {
|
|
@@ -68685,8 +66972,11 @@ var Config = class {
|
|
|
68685
66972
|
pluginRuntimeDirectory(name2) {
|
|
68686
66973
|
return join2(this.pluginDirectory(name2), "runtime");
|
|
68687
66974
|
}
|
|
66975
|
+
get pluginRootDirectory() {
|
|
66976
|
+
return houdini_mode.is_testing ? "../../../" : join2(this.rootDir, "plugins");
|
|
66977
|
+
}
|
|
68688
66978
|
pluginDirectory(name2) {
|
|
68689
|
-
return
|
|
66979
|
+
return join2(this.pluginRootDirectory, name2);
|
|
68690
66980
|
}
|
|
68691
66981
|
get manualLoadDirective() {
|
|
68692
66982
|
return "manual_load";
|
|
@@ -68736,6 +67026,9 @@ var Config = class {
|
|
|
68736
67026
|
get whenNotDirective() {
|
|
68737
67027
|
return this.whenDirective + "_not";
|
|
68738
67028
|
}
|
|
67029
|
+
get liveDirective() {
|
|
67030
|
+
return "live";
|
|
67031
|
+
}
|
|
68739
67032
|
get argumentsDirective() {
|
|
68740
67033
|
return "arguments";
|
|
68741
67034
|
}
|
|
@@ -68931,7 +67224,9 @@ async function getConfig({
|
|
|
68931
67224
|
resolve2 = res;
|
|
68932
67225
|
reject = rej;
|
|
68933
67226
|
});
|
|
68934
|
-
let configFile =
|
|
67227
|
+
let configFile = {
|
|
67228
|
+
...await readConfigFile(configPath)
|
|
67229
|
+
};
|
|
68935
67230
|
if (!configFile.plugins) {
|
|
68936
67231
|
throw new HoudiniError({
|
|
68937
67232
|
message: "Welcome to 0.17.0! Please following the migration guide here: http://www.houdinigraphql.com/guides/release-notes#0170"
|
|
@@ -68986,13 +67281,14 @@ This will prevent your schema from being pulled.`
|
|
|
68986
67281
|
version = packageJSON.version;
|
|
68987
67282
|
} catch {
|
|
68988
67283
|
}
|
|
68989
|
-
|
|
68990
|
-
|
|
68991
|
-
|
|
68992
|
-
|
|
68993
|
-
|
|
68994
|
-
|
|
68995
|
-
|
|
67284
|
+
if (typeof plugin_config)
|
|
67285
|
+
plugins.push({
|
|
67286
|
+
...await pluginFactory(plugin_config),
|
|
67287
|
+
name: pluginName,
|
|
67288
|
+
include_runtime,
|
|
67289
|
+
version,
|
|
67290
|
+
directory: pluginDirectory
|
|
67291
|
+
});
|
|
68996
67292
|
} catch (e2) {
|
|
68997
67293
|
throw new Error(
|
|
68998
67294
|
`Could not find plugin: ${pluginName}. Are you sure its installed? If so, please open a ticket on GitHub.`
|
|
@@ -69450,7 +67746,13 @@ function exportStarFrom(where) {
|
|
|
69450
67746
|
}
|
|
69451
67747
|
function exportDefaultFrom(where, as) {
|
|
69452
67748
|
return `var ${as} = require("${where}");
|
|
69453
|
-
|
|
67749
|
+
${exportDefault(as)}`;
|
|
67750
|
+
}
|
|
67751
|
+
function exportDefault(as) {
|
|
67752
|
+
return `Object.defineProperty(exports, "${as}", { enumerable: true, get: function () { return __importDefault(${as}).default; } });`;
|
|
67753
|
+
}
|
|
67754
|
+
function importDefaultFrom(where, as) {
|
|
67755
|
+
return `var ${as} = require("${where}")`;
|
|
69454
67756
|
}
|
|
69455
67757
|
|
|
69456
67758
|
// src/codegen/utils/flattenSelections.ts
|
|
@@ -69494,6 +67796,9 @@ var FieldCollection = class {
|
|
|
69494
67796
|
this.add(selection2);
|
|
69495
67797
|
}
|
|
69496
67798
|
}
|
|
67799
|
+
get size() {
|
|
67800
|
+
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
67801
|
+
}
|
|
69497
67802
|
add(selection2) {
|
|
69498
67803
|
if (selection2.kind === "Field") {
|
|
69499
67804
|
const key = selection2.alias?.value || selection2.name.value;
|
|
@@ -69562,9 +67867,12 @@ var FieldCollection = class {
|
|
|
69562
67867
|
}
|
|
69563
67868
|
}
|
|
69564
67869
|
toSelectionSet() {
|
|
69565
|
-
return Object.values(this.inlineFragments).
|
|
67870
|
+
return Object.values(this.inlineFragments).flatMap((fragment) => {
|
|
67871
|
+
if (fragment.selection.size === 0) {
|
|
67872
|
+
return [];
|
|
67873
|
+
}
|
|
69566
67874
|
fragment.astNode.selectionSet.selections = fragment.selection.toSelectionSet();
|
|
69567
|
-
return fragment.astNode;
|
|
67875
|
+
return [fragment.astNode];
|
|
69568
67876
|
}).concat(
|
|
69569
67877
|
Object.values(this.fields).map((field) => {
|
|
69570
67878
|
if (field.astNode.selectionSet) {
|
|
@@ -69747,7 +68055,7 @@ function serializeValue(value) {
|
|
|
69747
68055
|
if (typeof value === "object" && value !== null) {
|
|
69748
68056
|
return AST4.objectExpression(
|
|
69749
68057
|
Object.entries(value).filter(([, value2]) => typeof value2 !== "undefined").map(
|
|
69750
|
-
([key, value2]) => AST4.objectProperty(AST4.
|
|
68058
|
+
([key, value2]) => AST4.objectProperty(AST4.stringLiteral(key), serializeValue(value2))
|
|
69751
68059
|
)
|
|
69752
68060
|
);
|
|
69753
68061
|
}
|
|
@@ -71307,6 +69615,23 @@ function artifactGenerator(stats) {
|
|
|
71307
69615
|
document: doc
|
|
71308
69616
|
})
|
|
71309
69617
|
};
|
|
69618
|
+
const pluginsData = config4.plugins.reduce(
|
|
69619
|
+
(prev, plugin) => {
|
|
69620
|
+
if (!plugin.artifact_data) {
|
|
69621
|
+
return prev;
|
|
69622
|
+
}
|
|
69623
|
+
const result = { ...prev };
|
|
69624
|
+
const dataToAdd = plugin.artifact_data(config4, doc) ?? {};
|
|
69625
|
+
if (Object.keys(dataToAdd).length > 0) {
|
|
69626
|
+
result[plugin.name] = dataToAdd;
|
|
69627
|
+
}
|
|
69628
|
+
return result;
|
|
69629
|
+
},
|
|
69630
|
+
{}
|
|
69631
|
+
);
|
|
69632
|
+
if (Object.keys(pluginsData).length > 0) {
|
|
69633
|
+
artifact.pluginsData = pluginsData;
|
|
69634
|
+
}
|
|
71310
69635
|
if (inputs && inputs.length > 0) {
|
|
71311
69636
|
artifact.input = inputObject(config4, inputs);
|
|
71312
69637
|
}
|
|
@@ -71370,77 +69695,132 @@ function artifactGenerator(stats) {
|
|
|
71370
69695
|
};
|
|
71371
69696
|
}
|
|
71372
69697
|
|
|
71373
|
-
// src/codegen/generators/runtime/
|
|
69698
|
+
// src/codegen/generators/runtime/graphqlFunction.ts
|
|
71374
69699
|
var recast6 = __toESM(require_main2(), 1);
|
|
71375
69700
|
var AST6 = recast6.types.builders;
|
|
71376
|
-
async function
|
|
71377
|
-
await Promise.all([
|
|
71378
|
-
fs_exports.recursiveCopy(config4.runtimeSource, config4.runtimeDirectory, {
|
|
71379
|
-
[path_exports.join(config4.runtimeSource, "lib", "config.js")]: (content) => {
|
|
71380
|
-
const configFilePath = path_exports.join(config4.runtimeDirectory, "lib", "config.js");
|
|
71381
|
-
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config4.filepath);
|
|
71382
|
-
return content.replace("HOUDINI_CONFIG_PATH", relativePath);
|
|
71383
|
-
},
|
|
71384
|
-
[path_exports.join(config4.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
71385
|
-
return content.replace("SITE_URL", siteURL);
|
|
71386
|
-
}
|
|
71387
|
-
}),
|
|
71388
|
-
...config4.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config4, plugin))
|
|
71389
|
-
]);
|
|
69701
|
+
async function generateGraphqlReturnTypes(config4, docs) {
|
|
71390
69702
|
const indexPath = path_exports.join(config4.runtimeDirectory, "index.d.ts");
|
|
71391
|
-
const
|
|
69703
|
+
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
69704
|
+
const contents = await parseJS(fileContent);
|
|
71392
69705
|
const graphql_tag_return = config4.plugins.find(
|
|
71393
69706
|
(plugin) => plugin.graphql_tag_return
|
|
71394
69707
|
)?.graphql_tag_return;
|
|
71395
|
-
if (graphql_tag_return
|
|
71396
|
-
|
|
71397
|
-
|
|
71398
|
-
|
|
71399
|
-
|
|
71400
|
-
|
|
71401
|
-
|
|
71402
|
-
|
|
71403
|
-
|
|
71404
|
-
|
|
71405
|
-
|
|
71406
|
-
|
|
71407
|
-
|
|
71408
|
-
|
|
71409
|
-
|
|
71410
|
-
if (return_value) {
|
|
71411
|
-
overloaded_returns[doc.originalString] = return_value;
|
|
69708
|
+
if (!graphql_tag_return || !contents) {
|
|
69709
|
+
return fileContent;
|
|
69710
|
+
}
|
|
69711
|
+
const overloaded_returns = {};
|
|
69712
|
+
for (const doc of docs) {
|
|
69713
|
+
const return_value = graphql_tag_return({
|
|
69714
|
+
config: config4,
|
|
69715
|
+
doc,
|
|
69716
|
+
ensure_import({ identifier, module: module2 }) {
|
|
69717
|
+
ensureImports({
|
|
69718
|
+
config: config4,
|
|
69719
|
+
body: contents.script.body,
|
|
69720
|
+
sourceModule: module2,
|
|
69721
|
+
import: [identifier]
|
|
69722
|
+
});
|
|
71412
69723
|
}
|
|
69724
|
+
});
|
|
69725
|
+
if (return_value) {
|
|
69726
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
71413
69727
|
}
|
|
71414
|
-
|
|
71415
|
-
|
|
71416
|
-
|
|
71417
|
-
|
|
71418
|
-
|
|
71419
|
-
|
|
71420
|
-
|
|
71421
|
-
|
|
71422
|
-
|
|
71423
|
-
)
|
|
71424
|
-
|
|
71425
|
-
|
|
71426
|
-
|
|
71427
|
-
|
|
71428
|
-
|
|
71429
|
-
|
|
71430
|
-
|
|
71431
|
-
|
|
71432
|
-
|
|
71433
|
-
)
|
|
71434
|
-
)
|
|
69728
|
+
}
|
|
69729
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
69730
|
+
for (const [i2, expression] of (contents?.script.body ?? []).entries()) {
|
|
69731
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
69732
|
+
continue;
|
|
69733
|
+
}
|
|
69734
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
69735
|
+
const input = AST6.identifier("str");
|
|
69736
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
69737
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
69738
|
+
);
|
|
69739
|
+
contents?.script.body.splice(
|
|
69740
|
+
i2,
|
|
69741
|
+
0,
|
|
69742
|
+
AST6.exportNamedDeclaration(
|
|
69743
|
+
AST6.tsDeclareFunction(
|
|
69744
|
+
AST6.identifier("graphql"),
|
|
69745
|
+
[input],
|
|
69746
|
+
AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
|
|
71435
69747
|
)
|
|
71436
|
-
)
|
|
71437
|
-
|
|
71438
|
-
break;
|
|
69748
|
+
)
|
|
69749
|
+
);
|
|
71439
69750
|
}
|
|
71440
|
-
|
|
69751
|
+
break;
|
|
71441
69752
|
}
|
|
69753
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
71442
69754
|
}
|
|
71443
69755
|
}
|
|
69756
|
+
|
|
69757
|
+
// src/codegen/generators/runtime/injectPlugins.ts
|
|
69758
|
+
async function injectPlugins({
|
|
69759
|
+
config: config4,
|
|
69760
|
+
content,
|
|
69761
|
+
importStatement,
|
|
69762
|
+
exportStatement
|
|
69763
|
+
}) {
|
|
69764
|
+
const client_plugins = config4.plugins.filter((plugin) => plugin.client_plugins).reduce((acc, plugin) => {
|
|
69765
|
+
let plugins = plugin.client_plugins;
|
|
69766
|
+
if (typeof plugins === "function") {
|
|
69767
|
+
plugins = plugins(config4, config4.pluginConfig(plugin.name));
|
|
69768
|
+
}
|
|
69769
|
+
return [...acc, ...Object.entries(plugins)];
|
|
69770
|
+
}, []);
|
|
69771
|
+
return client_plugins.length > 0 ? `
|
|
69772
|
+
${client_plugins.map((plugin, i2) => importStatement(plugin[0], `plugin${i2}`))}
|
|
69773
|
+
|
|
69774
|
+
const plugins = [
|
|
69775
|
+
${client_plugins.map((plugin, i2) => {
|
|
69776
|
+
const suffix = plugin[1] !== null ? `(${JSON.stringify(plugin[1])})` : "";
|
|
69777
|
+
return `plugin${i2}${suffix}`;
|
|
69778
|
+
}).join(",\n")}
|
|
69779
|
+
]
|
|
69780
|
+
|
|
69781
|
+
${exportStatement("plugins")}
|
|
69782
|
+
` : content;
|
|
69783
|
+
}
|
|
69784
|
+
|
|
69785
|
+
// src/codegen/generators/runtime/pluginIndex.ts
|
|
69786
|
+
async function generatePluginIndex({
|
|
69787
|
+
config: config4,
|
|
69788
|
+
exportStatement
|
|
69789
|
+
}) {
|
|
69790
|
+
const indexFile = `${exportStatement("../runtime/client/plugins/index.js")}
|
|
69791
|
+
`;
|
|
69792
|
+
const typedefs = `export * from '../runtime/client/plugins'`;
|
|
69793
|
+
await fs_exports.mkdirp(config4.pluginRootDirectory);
|
|
69794
|
+
await Promise.all([
|
|
69795
|
+
fs_exports.writeFile(path_exports.join(config4.pluginRootDirectory, "index.js"), indexFile),
|
|
69796
|
+
fs_exports.writeFile(path_exports.join(config4.pluginRootDirectory, "index.d.ts"), typedefs)
|
|
69797
|
+
]);
|
|
69798
|
+
}
|
|
69799
|
+
|
|
69800
|
+
// src/codegen/generators/runtime/index.ts
|
|
69801
|
+
async function runtimeGenerator(config4, docs) {
|
|
69802
|
+
const importStatement = config4.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
69803
|
+
const exportStatement = config4.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
69804
|
+
const exportStar = config4.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
|
|
69805
|
+
await Promise.all([
|
|
69806
|
+
fs_exports.recursiveCopy(config4.runtimeSource, config4.runtimeDirectory, {
|
|
69807
|
+
[path_exports.join(config4.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
69808
|
+
return content.replace("SITE_URL", siteURL);
|
|
69809
|
+
},
|
|
69810
|
+
[path_exports.join(config4.runtimeSource, "imports", "config.js")]: (content) => {
|
|
69811
|
+
const configFilePath = path_exports.join(config4.runtimeDirectory, "imports", "config.js");
|
|
69812
|
+
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config4.filepath);
|
|
69813
|
+
return `${importStatement(relativePath, "config")}
|
|
69814
|
+
${exportStatement("config")}
|
|
69815
|
+
`;
|
|
69816
|
+
},
|
|
69817
|
+
[path_exports.join(config4.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config4, content, importStatement, exportStatement })
|
|
69818
|
+
}),
|
|
69819
|
+
...config4.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config4, plugin)),
|
|
69820
|
+
generatePluginIndex({ config: config4, exportStatement: exportStar })
|
|
69821
|
+
]);
|
|
69822
|
+
await generateGraphqlReturnTypes(config4, docs);
|
|
69823
|
+
}
|
|
71444
69824
|
async function generatePluginRuntime(config4, plugin) {
|
|
71445
69825
|
if (houdini_mode.is_testing) {
|
|
71446
69826
|
return;
|
|
@@ -72506,6 +70886,7 @@ async function writeIndexFile2(config4, docs) {
|
|
|
72506
70886
|
const export_star_from = ({ module: module2 }) => "\n" + (cjs ? exportStarFrom(module2) : `export * from "${module2}"`) + "\n";
|
|
72507
70887
|
const export_default_as = ({ module: module2, as }) => "\n" + (cjs ? exportDefaultFrom(module2, as) : `export { default as ${as} } from "${module2}"`) + "\n";
|
|
72508
70888
|
body += [
|
|
70889
|
+
export_star_from({ module: "./" + path_exports.join(runtimeDir, "client") }),
|
|
72509
70890
|
export_star_from({ module: runtimeDir }),
|
|
72510
70891
|
export_star_from({ module: artifactDir }),
|
|
72511
70892
|
export_star_from({ module: definitionsDir })
|
|
@@ -72618,7 +70999,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
72618
70999
|
}
|
|
72619
71000
|
|
|
72620
71001
|
// src/codegen/transforms/schema.ts
|
|
72621
|
-
var
|
|
71002
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
72622
71003
|
async function graphqlExtensions(config4, documents) {
|
|
72623
71004
|
const internalSchema = `
|
|
72624
71005
|
enum CachePolicy {
|
|
@@ -72696,19 +71077,19 @@ directive @${config4.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
72696
71077
|
"""
|
|
72697
71078
|
directive @${config4.maskDisableDirective} on FRAGMENT_SPREAD
|
|
72698
71079
|
`;
|
|
72699
|
-
let currentSchema =
|
|
71080
|
+
let currentSchema = graphql21.printSchema(config4.schema);
|
|
72700
71081
|
if (!currentSchema.includes(`directive @${config4.listDirective}`)) {
|
|
72701
71082
|
currentSchema += internalSchema;
|
|
72702
71083
|
}
|
|
72703
71084
|
config4.newSchema += internalSchema;
|
|
72704
|
-
config4.schema =
|
|
71085
|
+
config4.schema = graphql21.buildSchema(currentSchema);
|
|
72705
71086
|
}
|
|
72706
71087
|
|
|
72707
71088
|
// src/codegen/transforms/typename.ts
|
|
72708
|
-
var
|
|
71089
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
72709
71090
|
async function addTypename(config4, documents) {
|
|
72710
71091
|
for (const doc of documents) {
|
|
72711
|
-
doc.document =
|
|
71092
|
+
doc.document = graphql22.visit(doc.document, {
|
|
72712
71093
|
Field(node, key, parent, path2, ancestors) {
|
|
72713
71094
|
if (!node.selectionSet) {
|
|
72714
71095
|
return;
|
|
@@ -72720,7 +71101,7 @@ async function addTypename(config4, documents) {
|
|
|
72720
71101
|
);
|
|
72721
71102
|
const field = type.getFields()[node.name.value];
|
|
72722
71103
|
const fieldType = unwrapType(config4, field.type).type;
|
|
72723
|
-
if (
|
|
71104
|
+
if (graphql22.isInterfaceType(fieldType) || graphql22.isUnionType(fieldType)) {
|
|
72724
71105
|
return {
|
|
72725
71106
|
...node,
|
|
72726
71107
|
selectionSet: {
|
|
@@ -72728,9 +71109,9 @@ async function addTypename(config4, documents) {
|
|
|
72728
71109
|
selections: [
|
|
72729
71110
|
...node.selectionSet.selections,
|
|
72730
71111
|
{
|
|
72731
|
-
kind:
|
|
71112
|
+
kind: graphql22.Kind.FIELD,
|
|
72732
71113
|
name: {
|
|
72733
|
-
kind:
|
|
71114
|
+
kind: graphql22.Kind.NAME,
|
|
72734
71115
|
value: "__typename"
|
|
72735
71116
|
}
|
|
72736
71117
|
}
|
|
@@ -72744,10 +71125,10 @@ async function addTypename(config4, documents) {
|
|
|
72744
71125
|
}
|
|
72745
71126
|
|
|
72746
71127
|
// src/codegen/transforms/addID.ts
|
|
72747
|
-
var
|
|
71128
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
72748
71129
|
async function addID(config4, documents) {
|
|
72749
71130
|
for (const doc of documents) {
|
|
72750
|
-
doc.document =
|
|
71131
|
+
doc.document = graphql23.visit(doc.document, {
|
|
72751
71132
|
Field(node, key, parent, path2, ancestors) {
|
|
72752
71133
|
if (!node.selectionSet) {
|
|
72753
71134
|
return;
|
|
@@ -72760,7 +71141,7 @@ async function addID(config4, documents) {
|
|
|
72760
71141
|
const field = type.getFields()[node.name.value];
|
|
72761
71142
|
const fieldType = unwrapType(config4, field.type).type;
|
|
72762
71143
|
if (node.selectionSet?.selections.length > 0) {
|
|
72763
|
-
if (!
|
|
71144
|
+
if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
|
|
72764
71145
|
return;
|
|
72765
71146
|
}
|
|
72766
71147
|
const keyFields = config4.keyFieldsForType(fieldType.name);
|
|
@@ -72775,9 +71156,9 @@ async function addID(config4, documents) {
|
|
|
72775
71156
|
continue;
|
|
72776
71157
|
}
|
|
72777
71158
|
selections.push({
|
|
72778
|
-
kind:
|
|
71159
|
+
kind: graphql23.Kind.FIELD,
|
|
72779
71160
|
name: {
|
|
72780
|
-
kind:
|
|
71161
|
+
kind: graphql23.Kind.NAME,
|
|
72781
71162
|
value: keyField
|
|
72782
71163
|
}
|
|
72783
71164
|
});
|
|
@@ -72796,8 +71177,8 @@ async function addID(config4, documents) {
|
|
|
72796
71177
|
}
|
|
72797
71178
|
|
|
72798
71179
|
// src/codegen/transforms/fragmentVariables.ts
|
|
72799
|
-
var
|
|
72800
|
-
var GraphqlKinds2 =
|
|
71180
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
71181
|
+
var GraphqlKinds2 = graphql24.Kind;
|
|
72801
71182
|
async function fragmentVariables(config4, documents) {
|
|
72802
71183
|
const fragments = collectFragments(config4, documents);
|
|
72803
71184
|
const generatedFragments = {};
|
|
@@ -72820,7 +71201,7 @@ async function fragmentVariables(config4, documents) {
|
|
|
72820
71201
|
});
|
|
72821
71202
|
}
|
|
72822
71203
|
const doc = {
|
|
72823
|
-
kind:
|
|
71204
|
+
kind: graphql24.Kind.DOCUMENT,
|
|
72824
71205
|
definitions: Object.values(generatedFragments)
|
|
72825
71206
|
};
|
|
72826
71207
|
documents.push({
|
|
@@ -72856,7 +71237,7 @@ function inlineFragmentArgs({
|
|
|
72856
71237
|
filepath,
|
|
72857
71238
|
document
|
|
72858
71239
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
72859
|
-
const result =
|
|
71240
|
+
const result = graphql24.visit(document, {
|
|
72860
71241
|
FragmentSpread(node) {
|
|
72861
71242
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
72862
71243
|
let { args, hash } = collectWithArguments(config4, filepath, node, scope);
|
|
@@ -72944,7 +71325,7 @@ function inlineFragmentArgs({
|
|
|
72944
71325
|
});
|
|
72945
71326
|
if (newName) {
|
|
72946
71327
|
result.name = {
|
|
72947
|
-
kind:
|
|
71328
|
+
kind: graphql24.Kind.NAME,
|
|
72948
71329
|
value: newName
|
|
72949
71330
|
};
|
|
72950
71331
|
}
|
|
@@ -73056,7 +71437,7 @@ function operationScope(operation) {
|
|
|
73056
71437
|
}
|
|
73057
71438
|
|
|
73058
71439
|
// src/codegen/validators/typeCheck.ts
|
|
73059
|
-
var
|
|
71440
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
73060
71441
|
async function typeCheck(config4, docs) {
|
|
73061
71442
|
const errors = [];
|
|
73062
71443
|
const freeLists = [];
|
|
@@ -73064,11 +71445,11 @@ async function typeCheck(config4, docs) {
|
|
|
73064
71445
|
const listTypes = [];
|
|
73065
71446
|
const fragments = {};
|
|
73066
71447
|
for (const { document: parsed, filename } of docs) {
|
|
73067
|
-
|
|
73068
|
-
[
|
|
71448
|
+
graphql25.visit(parsed, {
|
|
71449
|
+
[graphql25.Kind.FRAGMENT_DEFINITION](definition) {
|
|
73069
71450
|
fragments[definition.name.value] = definition;
|
|
73070
71451
|
},
|
|
73071
|
-
[
|
|
71452
|
+
[graphql25.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
73072
71453
|
if (![config4.listDirective, config4.paginateDirective].includes(directive.name.value)) {
|
|
73073
71454
|
return;
|
|
73074
71455
|
}
|
|
@@ -73114,14 +71495,14 @@ async function typeCheck(config4, docs) {
|
|
|
73114
71495
|
);
|
|
73115
71496
|
return;
|
|
73116
71497
|
}
|
|
73117
|
-
if (
|
|
71498
|
+
if (graphql25.isListType(rootType) || graphql25.isNonNullType(rootType) && graphql25.isListType(rootType.ofType)) {
|
|
73118
71499
|
needsParent = true;
|
|
73119
71500
|
break;
|
|
73120
71501
|
}
|
|
73121
|
-
if (
|
|
71502
|
+
if (graphql25.isNonNullType(rootType) && "ofType" in rootType) {
|
|
73122
71503
|
rootType = rootType.ofType;
|
|
73123
71504
|
}
|
|
73124
|
-
if (
|
|
71505
|
+
if (graphql25.isScalarType(rootType)) {
|
|
73125
71506
|
break;
|
|
73126
71507
|
}
|
|
73127
71508
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -73197,9 +71578,9 @@ async function typeCheck(config4, docs) {
|
|
|
73197
71578
|
);
|
|
73198
71579
|
}
|
|
73199
71580
|
let targetTypes = [type];
|
|
73200
|
-
if (
|
|
71581
|
+
if (graphql25.isUnionType(type)) {
|
|
73201
71582
|
targetTypes = config4.schema.getPossibleTypes(type);
|
|
73202
|
-
} else if (
|
|
71583
|
+
} else if (graphql25.isInterfaceType(type)) {
|
|
73203
71584
|
try {
|
|
73204
71585
|
for (const key of config4.keyFieldsForType(type.name)) {
|
|
73205
71586
|
if (!type.getFields()[key]) {
|
|
@@ -73237,13 +71618,13 @@ async function typeCheck(config4, docs) {
|
|
|
73237
71618
|
if (errors.length > 0) {
|
|
73238
71619
|
throw errors;
|
|
73239
71620
|
}
|
|
73240
|
-
const rules = (filepath) => [...
|
|
71621
|
+
const rules = (filepath) => [...graphql25.specifiedRules].filter(
|
|
73241
71622
|
(rule) => ![
|
|
73242
|
-
|
|
73243
|
-
|
|
73244
|
-
|
|
73245
|
-
|
|
73246
|
-
|
|
71623
|
+
graphql25.NoUnusedFragmentsRule,
|
|
71624
|
+
graphql25.KnownFragmentNamesRule,
|
|
71625
|
+
graphql25.ExecutableDefinitionsRule,
|
|
71626
|
+
graphql25.KnownDirectivesRule,
|
|
71627
|
+
graphql25.KnownArgumentNamesRule
|
|
73247
71628
|
].includes(rule)
|
|
73248
71629
|
).concat(
|
|
73249
71630
|
validateLists({
|
|
@@ -73262,7 +71643,7 @@ async function typeCheck(config4, docs) {
|
|
|
73262
71643
|
noUnusedFragmentArguments(config4)
|
|
73263
71644
|
);
|
|
73264
71645
|
for (const { filename, document: parsed } of docs) {
|
|
73265
|
-
for (const error of
|
|
71646
|
+
for (const error of graphql25.validate(config4.schema, parsed, rules(filename))) {
|
|
73266
71647
|
errors.push(
|
|
73267
71648
|
new HoudiniError({
|
|
73268
71649
|
filepath: filename,
|
|
@@ -73288,7 +71669,7 @@ var validateLists = ({
|
|
|
73288
71669
|
if (!config4.isListFragment(node.name.value)) {
|
|
73289
71670
|
if (!fragments[node.name.value]) {
|
|
73290
71671
|
ctx.reportError(
|
|
73291
|
-
new
|
|
71672
|
+
new graphql25.GraphQLError(
|
|
73292
71673
|
"Encountered unknown fragment: " + node.name.value
|
|
73293
71674
|
)
|
|
73294
71675
|
);
|
|
@@ -73298,7 +71679,7 @@ var validateLists = ({
|
|
|
73298
71679
|
const listName = config4.listNameFromFragment(node.name.value);
|
|
73299
71680
|
if (!lists.includes(listName)) {
|
|
73300
71681
|
ctx.reportError(
|
|
73301
|
-
new
|
|
71682
|
+
new graphql25.GraphQLError(
|
|
73302
71683
|
"Encountered fragment referencing unknown list: " + listName
|
|
73303
71684
|
)
|
|
73304
71685
|
);
|
|
@@ -73323,7 +71704,7 @@ var validateLists = ({
|
|
|
73323
71704
|
);
|
|
73324
71705
|
if (parentArg) {
|
|
73325
71706
|
ctx.reportError(
|
|
73326
|
-
new
|
|
71707
|
+
new graphql25.GraphQLError(
|
|
73327
71708
|
`@${config4.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
73328
71709
|
)
|
|
73329
71710
|
);
|
|
@@ -73339,7 +71720,7 @@ var validateLists = ({
|
|
|
73339
71720
|
return;
|
|
73340
71721
|
}
|
|
73341
71722
|
ctx.reportError(
|
|
73342
|
-
new
|
|
71723
|
+
new graphql25.GraphQLError(
|
|
73343
71724
|
`For this list fragment, you need to add or @${config4.listParentDirective} or @${config4.listAllListsDirective} directive to specify the behavior`
|
|
73344
71725
|
)
|
|
73345
71726
|
);
|
|
@@ -73349,7 +71730,7 @@ var validateLists = ({
|
|
|
73349
71730
|
const directiveName = node.name.value;
|
|
73350
71731
|
if (directiveName === "connection") {
|
|
73351
71732
|
ctx.reportError(
|
|
73352
|
-
new
|
|
71733
|
+
new graphql25.GraphQLError(
|
|
73353
71734
|
"@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."
|
|
73354
71735
|
)
|
|
73355
71736
|
);
|
|
@@ -73358,7 +71739,7 @@ var validateLists = ({
|
|
|
73358
71739
|
if (!config4.isInternalDirective(node)) {
|
|
73359
71740
|
if (!config4.schema.getDirective(directiveName)) {
|
|
73360
71741
|
ctx.reportError(
|
|
73361
|
-
new
|
|
71742
|
+
new graphql25.GraphQLError(
|
|
73362
71743
|
"Encountered unknown directive: " + directiveName
|
|
73363
71744
|
)
|
|
73364
71745
|
);
|
|
@@ -73367,7 +71748,7 @@ var validateLists = ({
|
|
|
73367
71748
|
}
|
|
73368
71749
|
if (config4.isListOperationDirective(directiveName) && !listTypes.includes(config4.listNameFromDirective(directiveName))) {
|
|
73369
71750
|
ctx.reportError(
|
|
73370
|
-
new
|
|
71751
|
+
new graphql25.GraphQLError(
|
|
73371
71752
|
"Encountered directive referencing unknown list: " + directiveName
|
|
73372
71753
|
)
|
|
73373
71754
|
);
|
|
@@ -73378,7 +71759,7 @@ var validateLists = ({
|
|
|
73378
71759
|
};
|
|
73379
71760
|
function knownArguments(config4) {
|
|
73380
71761
|
return function(ctx) {
|
|
73381
|
-
const nativeValidator =
|
|
71762
|
+
const nativeValidator = graphql25.KnownArgumentNamesRule(ctx);
|
|
73382
71763
|
return {
|
|
73383
71764
|
...nativeValidator,
|
|
73384
71765
|
Directive(directiveNode) {
|
|
@@ -73411,7 +71792,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73411
71792
|
for (const arg of node.arguments || []) {
|
|
73412
71793
|
if (arg.value.kind !== "ObjectValue") {
|
|
73413
71794
|
ctx.reportError(
|
|
73414
|
-
new
|
|
71795
|
+
new graphql25.GraphQLError("values in @arguments must be an object")
|
|
73415
71796
|
);
|
|
73416
71797
|
return;
|
|
73417
71798
|
}
|
|
@@ -73421,13 +71802,13 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73421
71802
|
);
|
|
73422
71803
|
if (!typeArg) {
|
|
73423
71804
|
ctx.reportError(
|
|
73424
|
-
new
|
|
71805
|
+
new graphql25.GraphQLError("missing type field for @arguments directive")
|
|
73425
71806
|
);
|
|
73426
71807
|
return;
|
|
73427
71808
|
}
|
|
73428
|
-
if (typeArg.value.kind !==
|
|
71809
|
+
if (typeArg.value.kind !== graphql25.Kind.STRING) {
|
|
73429
71810
|
ctx.reportError(
|
|
73430
|
-
new
|
|
71811
|
+
new graphql25.GraphQLError("type field to @arguments must be a string")
|
|
73431
71812
|
);
|
|
73432
71813
|
return;
|
|
73433
71814
|
}
|
|
@@ -73440,7 +71821,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73440
71821
|
);
|
|
73441
71822
|
if (typeArg.value.value !== defaultValueType) {
|
|
73442
71823
|
ctx.reportError(
|
|
73443
|
-
new
|
|
71824
|
+
new graphql25.GraphQLError(
|
|
73444
71825
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
73445
71826
|
)
|
|
73446
71827
|
);
|
|
@@ -73458,7 +71839,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73458
71839
|
try {
|
|
73459
71840
|
args = fragmentArguments(config4, filepath, fragments[fragmentName]);
|
|
73460
71841
|
} catch (e2) {
|
|
73461
|
-
ctx.reportError(new
|
|
71842
|
+
ctx.reportError(new graphql25.GraphQLError(e2.message));
|
|
73462
71843
|
return;
|
|
73463
71844
|
}
|
|
73464
71845
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -73481,7 +71862,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73481
71862
|
);
|
|
73482
71863
|
if (missing.length > 0) {
|
|
73483
71864
|
ctx.reportError(
|
|
73484
|
-
new
|
|
71865
|
+
new graphql25.GraphQLError(
|
|
73485
71866
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
73486
71867
|
)
|
|
73487
71868
|
);
|
|
@@ -73492,7 +71873,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73492
71873
|
);
|
|
73493
71874
|
if (unknown.length > 0) {
|
|
73494
71875
|
ctx.reportError(
|
|
73495
|
-
new
|
|
71876
|
+
new graphql25.GraphQLError(
|
|
73496
71877
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
73497
71878
|
)
|
|
73498
71879
|
);
|
|
@@ -73504,7 +71885,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73504
71885
|
]
|
|
73505
71886
|
);
|
|
73506
71887
|
for (const [applied, target] of zipped) {
|
|
73507
|
-
if (applied.value.kind ===
|
|
71888
|
+
if (applied.value.kind === graphql25.Kind.VARIABLE || applied.value.kind === graphql25.Kind.LIST || applied.value.kind === graphql25.Kind.OBJECT) {
|
|
73508
71889
|
continue;
|
|
73509
71890
|
}
|
|
73510
71891
|
const appliedType = applied.value.kind.substring(
|
|
@@ -73513,7 +71894,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73513
71894
|
);
|
|
73514
71895
|
if (appliedType !== target) {
|
|
73515
71896
|
ctx.reportError(
|
|
73516
|
-
new
|
|
71897
|
+
new graphql25.GraphQLError(
|
|
73517
71898
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
73518
71899
|
)
|
|
73519
71900
|
);
|
|
@@ -73534,7 +71915,7 @@ function paginateArgs(config4, filepath) {
|
|
|
73534
71915
|
}
|
|
73535
71916
|
if (alreadyPaginated) {
|
|
73536
71917
|
ctx.reportError(
|
|
73537
|
-
new
|
|
71918
|
+
new graphql25.GraphQLError(
|
|
73538
71919
|
`@${config4.paginateDirective} can only appear in a document once.`
|
|
73539
71920
|
)
|
|
73540
71921
|
);
|
|
@@ -73549,7 +71930,7 @@ function paginateArgs(config4, filepath) {
|
|
|
73549
71930
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
73550
71931
|
if (hasRequiredArgs) {
|
|
73551
71932
|
ctx.reportError(
|
|
73552
|
-
new
|
|
71933
|
+
new graphql25.GraphQLError(
|
|
73553
71934
|
"@paginate cannot appear on a document with required args"
|
|
73554
71935
|
)
|
|
73555
71936
|
);
|
|
@@ -73581,14 +71962,14 @@ function paginateArgs(config4, filepath) {
|
|
|
73581
71962
|
const backwards = appliedArgs.has("last");
|
|
73582
71963
|
if (!forward && !backwards) {
|
|
73583
71964
|
ctx.reportError(
|
|
73584
|
-
new
|
|
71965
|
+
new graphql25.GraphQLError(
|
|
73585
71966
|
"A field with cursor-based pagination must have a first or last argument"
|
|
73586
71967
|
)
|
|
73587
71968
|
);
|
|
73588
71969
|
}
|
|
73589
71970
|
if (forward && backwards) {
|
|
73590
71971
|
ctx.reportError(
|
|
73591
|
-
new
|
|
71972
|
+
new graphql25.GraphQLError(
|
|
73592
71973
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
73593
71974
|
)
|
|
73594
71975
|
);
|
|
@@ -73602,7 +71983,7 @@ function paginateArgs(config4, filepath) {
|
|
|
73602
71983
|
);
|
|
73603
71984
|
if (!appliedLimitArg) {
|
|
73604
71985
|
ctx.reportError(
|
|
73605
|
-
new
|
|
71986
|
+
new graphql25.GraphQLError(
|
|
73606
71987
|
"A field with offset-based pagination must have a limit argument"
|
|
73607
71988
|
)
|
|
73608
71989
|
);
|
|
@@ -73618,20 +71999,20 @@ function noUnusedFragmentArguments(config4) {
|
|
|
73618
71999
|
const args = /* @__PURE__ */ new Set();
|
|
73619
72000
|
return {
|
|
73620
72001
|
enter(node) {
|
|
73621
|
-
if (node.kind ===
|
|
72002
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
73622
72003
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config4.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
73623
72004
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
73624
72005
|
args.add(arg);
|
|
73625
72006
|
}
|
|
73626
|
-
} else if (node.kind ===
|
|
72007
|
+
} else if (node.kind === graphql25.Kind.VARIABLE) {
|
|
73627
72008
|
args.delete(node.name.value);
|
|
73628
72009
|
}
|
|
73629
72010
|
},
|
|
73630
72011
|
leave(node) {
|
|
73631
|
-
if (node.kind ===
|
|
72012
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
73632
72013
|
if (args.size > 0) {
|
|
73633
72014
|
ctx.reportError(
|
|
73634
|
-
new
|
|
72015
|
+
new graphql25.GraphQLError(
|
|
73635
72016
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
73636
72017
|
)
|
|
73637
72018
|
);
|
|
@@ -73667,7 +72048,7 @@ function nodeDirectives(config4, directives) {
|
|
|
73667
72048
|
if (definition.kind === "OperationDefinition") {
|
|
73668
72049
|
if (definition.operation !== "query") {
|
|
73669
72050
|
ctx.reportError(
|
|
73670
|
-
new
|
|
72051
|
+
new graphql25.GraphQLError(
|
|
73671
72052
|
`@${node.name.value} must fall on a fragment or query document`
|
|
73672
72053
|
)
|
|
73673
72054
|
);
|
|
@@ -73679,7 +72060,7 @@ function nodeDirectives(config4, directives) {
|
|
|
73679
72060
|
}
|
|
73680
72061
|
if (!possibleNodes.includes(definitionType)) {
|
|
73681
72062
|
ctx.reportError(
|
|
73682
|
-
new
|
|
72063
|
+
new graphql25.GraphQLError(paginateOnNonNodeMessage(config4, node.name.value))
|
|
73683
72064
|
);
|
|
73684
72065
|
}
|
|
73685
72066
|
}
|
|
@@ -73698,7 +72079,7 @@ function checkMutationOperation(config4) {
|
|
|
73698
72079
|
);
|
|
73699
72080
|
if (append && prepend) {
|
|
73700
72081
|
ctx.reportError(
|
|
73701
|
-
new
|
|
72082
|
+
new graphql25.GraphQLError(
|
|
73702
72083
|
`You can't apply both @${config4.listPrependDirective} and @${config4.listAppendDirective} at the same time`
|
|
73703
72084
|
)
|
|
73704
72085
|
);
|
|
@@ -73712,7 +72093,7 @@ function checkMutationOperation(config4) {
|
|
|
73712
72093
|
);
|
|
73713
72094
|
if (parentId && allLists) {
|
|
73714
72095
|
ctx.reportError(
|
|
73715
|
-
new
|
|
72096
|
+
new graphql25.GraphQLError(
|
|
73716
72097
|
`You can't apply both @${config4.listParentDirective} and @${config4.listAllListsDirective} at the same time`
|
|
73717
72098
|
)
|
|
73718
72099
|
);
|
|
@@ -73734,7 +72115,7 @@ function checkMaskDirective(config4) {
|
|
|
73734
72115
|
);
|
|
73735
72116
|
if (maskEnableDirective && maskDisableDirective) {
|
|
73736
72117
|
ctx.reportError(
|
|
73737
|
-
new
|
|
72118
|
+
new graphql25.GraphQLError(
|
|
73738
72119
|
`You can't apply both @${config4.maskEnableDirective} and @${config4.maskDisableDirective} at the same time`
|
|
73739
72120
|
)
|
|
73740
72121
|
);
|
|
@@ -73750,7 +72131,7 @@ function getAndVerifyNodeInterface(config4) {
|
|
|
73750
72131
|
if (!nodeInterface) {
|
|
73751
72132
|
return null;
|
|
73752
72133
|
}
|
|
73753
|
-
if (!
|
|
72134
|
+
if (!graphql25.isInterfaceType(nodeInterface)) {
|
|
73754
72135
|
displayInvalidNodeFieldMessage(config4.logLevel);
|
|
73755
72136
|
return null;
|
|
73756
72137
|
}
|
|
@@ -73848,11 +72229,11 @@ async function uniqueDocumentNames(config4, docs) {
|
|
|
73848
72229
|
}
|
|
73849
72230
|
|
|
73850
72231
|
// src/codegen/validators/noIDAlias.ts
|
|
73851
|
-
var
|
|
72232
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
73852
72233
|
async function noIDAlias(config4, docs) {
|
|
73853
72234
|
const errors = [];
|
|
73854
72235
|
for (const { filename, document } of docs) {
|
|
73855
|
-
|
|
72236
|
+
graphql26.visit(document, {
|
|
73856
72237
|
Field(node, _, __, ___, ancestors) {
|
|
73857
72238
|
const fieldType = parentTypeFromAncestors(config4.schema, filename, ancestors).name;
|
|
73858
72239
|
if (config4.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -74050,12 +72431,17 @@ async function processJSFile(config4, contents) {
|
|
|
74050
72431
|
return documents;
|
|
74051
72432
|
}
|
|
74052
72433
|
async function processGraphQLDocument(config4, filepath, document) {
|
|
74053
|
-
|
|
72434
|
+
try {
|
|
72435
|
+
var parsedDoc = graphql27.parse(document);
|
|
72436
|
+
} catch (e2) {
|
|
72437
|
+
console.log("error parsing!!");
|
|
72438
|
+
throw e2;
|
|
72439
|
+
}
|
|
74054
72440
|
const operations = parsedDoc.definitions.filter(
|
|
74055
|
-
({ kind: kind2 }) => kind2 ===
|
|
72441
|
+
({ kind: kind2 }) => kind2 === graphql27.Kind.OPERATION_DEFINITION
|
|
74056
72442
|
);
|
|
74057
72443
|
const fragments = parsedDoc.definitions.filter(
|
|
74058
|
-
({ kind: kind2 }) => kind2 ===
|
|
72444
|
+
({ kind: kind2 }) => kind2 === graphql27.Kind.FRAGMENT_DEFINITION
|
|
74059
72445
|
);
|
|
74060
72446
|
if (operations.length > 1) {
|
|
74061
72447
|
throw new HoudiniError({
|
|
@@ -74134,7 +72520,7 @@ function logStyled(kind, stat3, logLevel, plugin) {
|
|
|
74134
72520
|
|
|
74135
72521
|
// src/vite/houdini.ts
|
|
74136
72522
|
var config3;
|
|
74137
|
-
function
|
|
72523
|
+
function Plugin(opts = {}) {
|
|
74138
72524
|
return {
|
|
74139
72525
|
name: "houdini",
|
|
74140
72526
|
enforce: "pre",
|
|
@@ -74392,7 +72778,7 @@ function artifact_import({
|
|
|
74392
72778
|
function vite_default(opts) {
|
|
74393
72779
|
process.env.HOUDINI_PLUGIN = "true";
|
|
74394
72780
|
return [
|
|
74395
|
-
|
|
72781
|
+
Plugin(opts),
|
|
74396
72782
|
HoudiniWatchSchemaPlugin(opts),
|
|
74397
72783
|
watchAndRun([
|
|
74398
72784
|
{
|