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/cmd-cjs/index.js
CHANGED
|
@@ -11268,18 +11268,18 @@ var require_execute = __commonJS({
|
|
|
11268
11268
|
}
|
|
11269
11269
|
var returnType = fieldDef.type;
|
|
11270
11270
|
var resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver;
|
|
11271
|
-
var
|
|
11271
|
+
var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path2);
|
|
11272
11272
|
try {
|
|
11273
11273
|
var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], exeContext.variableValues);
|
|
11274
11274
|
var _contextValue = exeContext.contextValue;
|
|
11275
|
-
var result = resolveFn(source, args, _contextValue,
|
|
11275
|
+
var result = resolveFn(source, args, _contextValue, info);
|
|
11276
11276
|
var completed;
|
|
11277
11277
|
if ((0, _isPromise.default)(result)) {
|
|
11278
11278
|
completed = result.then(function(resolved) {
|
|
11279
|
-
return completeValue(exeContext, returnType, fieldNodes,
|
|
11279
|
+
return completeValue(exeContext, returnType, fieldNodes, info, path2, resolved);
|
|
11280
11280
|
});
|
|
11281
11281
|
} else {
|
|
11282
|
-
completed = completeValue(exeContext, returnType, fieldNodes,
|
|
11282
|
+
completed = completeValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
11283
11283
|
}
|
|
11284
11284
|
if ((0, _isPromise.default)(completed)) {
|
|
11285
11285
|
return completed.then(void 0, function(rawError) {
|
|
@@ -11314,14 +11314,14 @@ var require_execute = __commonJS({
|
|
|
11314
11314
|
exeContext.errors.push(error);
|
|
11315
11315
|
return null;
|
|
11316
11316
|
}
|
|
11317
|
-
function completeValue(exeContext, returnType, fieldNodes,
|
|
11317
|
+
function completeValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
11318
11318
|
if (result instanceof Error) {
|
|
11319
11319
|
throw result;
|
|
11320
11320
|
}
|
|
11321
11321
|
if ((0, _definition.isNonNullType)(returnType)) {
|
|
11322
|
-
var completed = completeValue(exeContext, returnType.ofType, fieldNodes,
|
|
11322
|
+
var completed = completeValue(exeContext, returnType.ofType, fieldNodes, info, path2, result);
|
|
11323
11323
|
if (completed === null) {
|
|
11324
|
-
throw new Error("Cannot return null for non-nullable field ".concat(
|
|
11324
|
+
throw new Error("Cannot return null for non-nullable field ".concat(info.parentType.name, ".").concat(info.fieldName, "."));
|
|
11325
11325
|
}
|
|
11326
11326
|
return completed;
|
|
11327
11327
|
}
|
|
@@ -11329,20 +11329,20 @@ var require_execute = __commonJS({
|
|
|
11329
11329
|
return null;
|
|
11330
11330
|
}
|
|
11331
11331
|
if ((0, _definition.isListType)(returnType)) {
|
|
11332
|
-
return completeListValue(exeContext, returnType, fieldNodes,
|
|
11332
|
+
return completeListValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
11333
11333
|
}
|
|
11334
11334
|
if ((0, _definition.isLeafType)(returnType)) {
|
|
11335
11335
|
return completeLeafValue(returnType, result);
|
|
11336
11336
|
}
|
|
11337
11337
|
if ((0, _definition.isAbstractType)(returnType)) {
|
|
11338
|
-
return completeAbstractValue(exeContext, returnType, fieldNodes,
|
|
11338
|
+
return completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
11339
11339
|
}
|
|
11340
11340
|
if ((0, _definition.isObjectType)(returnType)) {
|
|
11341
|
-
return completeObjectValue(exeContext, returnType, fieldNodes,
|
|
11341
|
+
return completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
11342
11342
|
}
|
|
11343
11343
|
(0, _invariant.default)(0, "Cannot complete value of unexpected output type: " + (0, _inspect.default)(returnType));
|
|
11344
11344
|
}
|
|
11345
|
-
function completeListValue(exeContext, returnType, fieldNodes,
|
|
11345
|
+
function completeListValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
11346
11346
|
var itemType = returnType.ofType;
|
|
11347
11347
|
var containsPromise = false;
|
|
11348
11348
|
var completedResults = (0, _safeArrayFrom.default)(result, function(item, index) {
|
|
@@ -11351,10 +11351,10 @@ var require_execute = __commonJS({
|
|
|
11351
11351
|
var completedItem;
|
|
11352
11352
|
if ((0, _isPromise.default)(item)) {
|
|
11353
11353
|
completedItem = item.then(function(resolved) {
|
|
11354
|
-
return completeValue(exeContext, itemType, fieldNodes,
|
|
11354
|
+
return completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved);
|
|
11355
11355
|
});
|
|
11356
11356
|
} else {
|
|
11357
|
-
completedItem = completeValue(exeContext, itemType, fieldNodes,
|
|
11357
|
+
completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item);
|
|
11358
11358
|
}
|
|
11359
11359
|
if ((0, _isPromise.default)(completedItem)) {
|
|
11360
11360
|
containsPromise = true;
|
|
@@ -11370,7 +11370,7 @@ var require_execute = __commonJS({
|
|
|
11370
11370
|
}
|
|
11371
11371
|
});
|
|
11372
11372
|
if (completedResults == null) {
|
|
11373
|
-
throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(
|
|
11373
|
+
throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(info.parentType.name, ".").concat(info.fieldName, '".'));
|
|
11374
11374
|
}
|
|
11375
11375
|
return containsPromise ? Promise.all(completedResults) : completedResults;
|
|
11376
11376
|
}
|
|
@@ -11381,25 +11381,25 @@ var require_execute = __commonJS({
|
|
|
11381
11381
|
}
|
|
11382
11382
|
return serializedResult;
|
|
11383
11383
|
}
|
|
11384
|
-
function completeAbstractValue(exeContext, returnType, fieldNodes,
|
|
11384
|
+
function completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
11385
11385
|
var _returnType$resolveTy;
|
|
11386
11386
|
var resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver;
|
|
11387
11387
|
var contextValue = exeContext.contextValue;
|
|
11388
|
-
var runtimeType = resolveTypeFn(result, contextValue,
|
|
11388
|
+
var runtimeType = resolveTypeFn(result, contextValue, info, returnType);
|
|
11389
11389
|
if ((0, _isPromise.default)(runtimeType)) {
|
|
11390
11390
|
return runtimeType.then(function(resolvedRuntimeType) {
|
|
11391
|
-
return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes,
|
|
11391
|
+
return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
|
|
11392
11392
|
});
|
|
11393
11393
|
}
|
|
11394
|
-
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes,
|
|
11394
|
+
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
|
|
11395
11395
|
}
|
|
11396
|
-
function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes,
|
|
11396
|
+
function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info, result) {
|
|
11397
11397
|
if (runtimeTypeOrName == null) {
|
|
11398
|
-
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(
|
|
11398
|
+
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);
|
|
11399
11399
|
}
|
|
11400
11400
|
var runtimeTypeName = (0, _definition.isNamedType)(runtimeTypeOrName) ? runtimeTypeOrName.name : runtimeTypeOrName;
|
|
11401
11401
|
if (typeof runtimeTypeName !== "string") {
|
|
11402
|
-
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(
|
|
11402
|
+
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), '".'));
|
|
11403
11403
|
}
|
|
11404
11404
|
var runtimeType = exeContext.schema.getType(runtimeTypeName);
|
|
11405
11405
|
if (runtimeType == null) {
|
|
@@ -11413,9 +11413,9 @@ var require_execute = __commonJS({
|
|
|
11413
11413
|
}
|
|
11414
11414
|
return runtimeType;
|
|
11415
11415
|
}
|
|
11416
|
-
function completeObjectValue(exeContext, returnType, fieldNodes,
|
|
11416
|
+
function completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
11417
11417
|
if (returnType.isTypeOf) {
|
|
11418
|
-
var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue,
|
|
11418
|
+
var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info);
|
|
11419
11419
|
if ((0, _isPromise.default)(isTypeOf)) {
|
|
11420
11420
|
return isTypeOf.then(function(resolvedIsTypeOf) {
|
|
11421
11421
|
if (!resolvedIsTypeOf) {
|
|
@@ -11449,16 +11449,16 @@ var require_execute = __commonJS({
|
|
|
11449
11449
|
}
|
|
11450
11450
|
return subFieldNodes;
|
|
11451
11451
|
}
|
|
11452
|
-
var defaultTypeResolver = function defaultTypeResolver2(value, contextValue,
|
|
11452
|
+
var defaultTypeResolver = function defaultTypeResolver2(value, contextValue, info, abstractType) {
|
|
11453
11453
|
if ((0, _isObjectLike.default)(value) && typeof value.__typename === "string") {
|
|
11454
11454
|
return value.__typename;
|
|
11455
11455
|
}
|
|
11456
|
-
var possibleTypes =
|
|
11456
|
+
var possibleTypes = info.schema.getPossibleTypes(abstractType);
|
|
11457
11457
|
var promisedIsTypeOfResults = [];
|
|
11458
11458
|
for (var i2 = 0; i2 < possibleTypes.length; i2++) {
|
|
11459
11459
|
var type = possibleTypes[i2];
|
|
11460
11460
|
if (type.isTypeOf) {
|
|
11461
|
-
var isTypeOfResult = type.isTypeOf(value, contextValue,
|
|
11461
|
+
var isTypeOfResult = type.isTypeOf(value, contextValue, info);
|
|
11462
11462
|
if ((0, _isPromise.default)(isTypeOfResult)) {
|
|
11463
11463
|
promisedIsTypeOfResults[i2] = isTypeOfResult;
|
|
11464
11464
|
} else if (isTypeOfResult) {
|
|
@@ -11477,11 +11477,11 @@ var require_execute = __commonJS({
|
|
|
11477
11477
|
}
|
|
11478
11478
|
};
|
|
11479
11479
|
exports.defaultTypeResolver = defaultTypeResolver;
|
|
11480
|
-
var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue,
|
|
11480
|
+
var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue, info) {
|
|
11481
11481
|
if ((0, _isObjectLike.default)(source) || typeof source === "function") {
|
|
11482
|
-
var property = source[
|
|
11482
|
+
var property = source[info.fieldName];
|
|
11483
11483
|
if (typeof property === "function") {
|
|
11484
|
-
return source[
|
|
11484
|
+
return source[info.fieldName](args, contextValue, info);
|
|
11485
11485
|
}
|
|
11486
11486
|
return property;
|
|
11487
11487
|
}
|
|
@@ -11507,7 +11507,7 @@ var require_graphql = __commonJS({
|
|
|
11507
11507
|
Object.defineProperty(exports, "__esModule", {
|
|
11508
11508
|
value: true
|
|
11509
11509
|
});
|
|
11510
|
-
exports.graphql =
|
|
11510
|
+
exports.graphql = graphql28;
|
|
11511
11511
|
exports.graphqlSync = graphqlSync;
|
|
11512
11512
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
11513
11513
|
var _parser = require_parser();
|
|
@@ -11517,7 +11517,7 @@ var require_graphql = __commonJS({
|
|
|
11517
11517
|
function _interopRequireDefault(obj) {
|
|
11518
11518
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
11519
11519
|
}
|
|
11520
|
-
function
|
|
11520
|
+
function graphql28(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
11521
11521
|
var _arguments = arguments;
|
|
11522
11522
|
return new Promise(function(resolve2) {
|
|
11523
11523
|
return resolve2(
|
|
@@ -12501,13 +12501,13 @@ var require_subscribe = __commonJS({
|
|
|
12501
12501
|
throw new _GraphQLError.GraphQLError('The subscription field "'.concat(fieldName, '" is not defined.'), fieldNodes);
|
|
12502
12502
|
}
|
|
12503
12503
|
var path2 = (0, _Path.addPath)(void 0, responseName, type.name);
|
|
12504
|
-
var
|
|
12504
|
+
var info = (0, _execute.buildResolveInfo)(exeContext, fieldDef, fieldNodes, type, path2);
|
|
12505
12505
|
return new Promise(function(resolveResult) {
|
|
12506
12506
|
var _fieldDef$subscribe;
|
|
12507
12507
|
var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], variableValues);
|
|
12508
12508
|
var contextValue = exeContext.contextValue;
|
|
12509
12509
|
var resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.fieldResolver;
|
|
12510
|
-
resolveResult(resolveFn(rootValue, args, contextValue,
|
|
12510
|
+
resolveResult(resolveFn(rootValue, args, contextValue, info));
|
|
12511
12511
|
}).then(function(eventStream) {
|
|
12512
12512
|
if (eventStream instanceof Error) {
|
|
12513
12513
|
throw (0, _locatedError.locatedError)(eventStream, fieldNodes, (0, _Path.pathToArray)(path2));
|
|
@@ -22315,42 +22315,42 @@ var require_node = __commonJS({
|
|
|
22315
22315
|
return Link2;
|
|
22316
22316
|
}(events_1.EventEmitter);
|
|
22317
22317
|
exports.Link = Link;
|
|
22318
|
-
var
|
|
22319
|
-
function
|
|
22318
|
+
var File3 = function() {
|
|
22319
|
+
function File4(link, node, flags, fd) {
|
|
22320
22320
|
this.position = 0;
|
|
22321
22321
|
this.link = link;
|
|
22322
22322
|
this.node = node;
|
|
22323
22323
|
this.flags = flags;
|
|
22324
22324
|
this.fd = fd;
|
|
22325
22325
|
}
|
|
22326
|
-
|
|
22326
|
+
File4.prototype.getString = function(encoding) {
|
|
22327
22327
|
if (encoding === void 0) {
|
|
22328
22328
|
encoding = "utf8";
|
|
22329
22329
|
}
|
|
22330
22330
|
return this.node.getString();
|
|
22331
22331
|
};
|
|
22332
|
-
|
|
22332
|
+
File4.prototype.setString = function(str) {
|
|
22333
22333
|
this.node.setString(str);
|
|
22334
22334
|
};
|
|
22335
|
-
|
|
22335
|
+
File4.prototype.getBuffer = function() {
|
|
22336
22336
|
return this.node.getBuffer();
|
|
22337
22337
|
};
|
|
22338
|
-
|
|
22338
|
+
File4.prototype.setBuffer = function(buf) {
|
|
22339
22339
|
this.node.setBuffer(buf);
|
|
22340
22340
|
};
|
|
22341
|
-
|
|
22341
|
+
File4.prototype.getSize = function() {
|
|
22342
22342
|
return this.node.getSize();
|
|
22343
22343
|
};
|
|
22344
|
-
|
|
22344
|
+
File4.prototype.truncate = function(len) {
|
|
22345
22345
|
this.node.truncate(len);
|
|
22346
22346
|
};
|
|
22347
|
-
|
|
22347
|
+
File4.prototype.seekTo = function(position) {
|
|
22348
22348
|
this.position = position;
|
|
22349
22349
|
};
|
|
22350
|
-
|
|
22350
|
+
File4.prototype.stats = function() {
|
|
22351
22351
|
return Stats_1.default.build(this.node);
|
|
22352
22352
|
};
|
|
22353
|
-
|
|
22353
|
+
File4.prototype.write = function(buf, offset, length, position) {
|
|
22354
22354
|
if (offset === void 0) {
|
|
22355
22355
|
offset = 0;
|
|
22356
22356
|
}
|
|
@@ -22365,7 +22365,7 @@ var require_node = __commonJS({
|
|
|
22365
22365
|
this.position = position + bytes;
|
|
22366
22366
|
return bytes;
|
|
22367
22367
|
};
|
|
22368
|
-
|
|
22368
|
+
File4.prototype.read = function(buf, offset, length, position) {
|
|
22369
22369
|
if (offset === void 0) {
|
|
22370
22370
|
offset = 0;
|
|
22371
22371
|
}
|
|
@@ -22378,15 +22378,15 @@ var require_node = __commonJS({
|
|
|
22378
22378
|
this.position = position + bytes;
|
|
22379
22379
|
return bytes;
|
|
22380
22380
|
};
|
|
22381
|
-
|
|
22381
|
+
File4.prototype.chmod = function(perm) {
|
|
22382
22382
|
this.node.chmod(perm);
|
|
22383
22383
|
};
|
|
22384
|
-
|
|
22384
|
+
File4.prototype.chown = function(uid, gid) {
|
|
22385
22385
|
this.node.chown(uid, gid);
|
|
22386
22386
|
};
|
|
22387
|
-
return
|
|
22387
|
+
return File4;
|
|
22388
22388
|
}();
|
|
22389
|
-
exports.File =
|
|
22389
|
+
exports.File = File3;
|
|
22390
22390
|
}
|
|
22391
22391
|
});
|
|
22392
22392
|
|
|
@@ -28495,9 +28495,9 @@ var require_streams = __commonJS({
|
|
|
28495
28495
|
}
|
|
28496
28496
|
}
|
|
28497
28497
|
try {
|
|
28498
|
-
const { Blob:
|
|
28499
|
-
if (
|
|
28500
|
-
|
|
28498
|
+
const { Blob: Blob3 } = require("buffer");
|
|
28499
|
+
if (Blob3 && !Blob3.prototype.stream) {
|
|
28500
|
+
Blob3.prototype.stream = function name2(params) {
|
|
28501
28501
|
let position = 0;
|
|
28502
28502
|
const blob = this;
|
|
28503
28503
|
return new ReadableStream({
|
|
@@ -28548,12 +28548,12 @@ async function* toIterator(parts, clone2 = true) {
|
|
|
28548
28548
|
}
|
|
28549
28549
|
}
|
|
28550
28550
|
}
|
|
28551
|
-
var import_streams, POOL_SIZE, _Blob,
|
|
28551
|
+
var import_streams, POOL_SIZE, _Blob, Blob2, fetch_blob_default;
|
|
28552
28552
|
var init_fetch_blob = __esm({
|
|
28553
28553
|
"../../node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/index.js"() {
|
|
28554
28554
|
import_streams = __toESM(require_streams(), 1);
|
|
28555
28555
|
POOL_SIZE = 65536;
|
|
28556
|
-
_Blob = class
|
|
28556
|
+
_Blob = class Blob {
|
|
28557
28557
|
#parts = [];
|
|
28558
28558
|
#type = "";
|
|
28559
28559
|
#size = 0;
|
|
@@ -28577,7 +28577,7 @@ var init_fetch_blob = __esm({
|
|
|
28577
28577
|
part = new Uint8Array(element.buffer.slice(element.byteOffset, element.byteOffset + element.byteLength));
|
|
28578
28578
|
} else if (element instanceof ArrayBuffer) {
|
|
28579
28579
|
part = new Uint8Array(element.slice(0));
|
|
28580
|
-
} else if (element instanceof
|
|
28580
|
+
} else if (element instanceof Blob) {
|
|
28581
28581
|
part = element;
|
|
28582
28582
|
} else {
|
|
28583
28583
|
part = encoder.encode(`${element}`);
|
|
@@ -28656,7 +28656,7 @@ var init_fetch_blob = __esm({
|
|
|
28656
28656
|
relativeStart = 0;
|
|
28657
28657
|
}
|
|
28658
28658
|
}
|
|
28659
|
-
const blob = new
|
|
28659
|
+
const blob = new Blob([], { type: String(type).toLowerCase() });
|
|
28660
28660
|
blob.#size = span;
|
|
28661
28661
|
blob.#parts = blobParts;
|
|
28662
28662
|
return blob;
|
|
@@ -28673,17 +28673,17 @@ var init_fetch_blob = __esm({
|
|
|
28673
28673
|
type: { enumerable: true },
|
|
28674
28674
|
slice: { enumerable: true }
|
|
28675
28675
|
});
|
|
28676
|
-
|
|
28677
|
-
fetch_blob_default =
|
|
28676
|
+
Blob2 = _Blob;
|
|
28677
|
+
fetch_blob_default = Blob2;
|
|
28678
28678
|
}
|
|
28679
28679
|
});
|
|
28680
28680
|
|
|
28681
28681
|
// ../../node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/file.js
|
|
28682
|
-
var _File,
|
|
28682
|
+
var _File, File2, file_default;
|
|
28683
28683
|
var init_file = __esm({
|
|
28684
28684
|
"../../node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/file.js"() {
|
|
28685
28685
|
init_fetch_blob();
|
|
28686
|
-
_File = class
|
|
28686
|
+
_File = class File extends fetch_blob_default {
|
|
28687
28687
|
#lastModified = 0;
|
|
28688
28688
|
#name = "";
|
|
28689
28689
|
constructor(fileBits, fileName, options = {}) {
|
|
@@ -28712,8 +28712,8 @@ var init_file = __esm({
|
|
|
28712
28712
|
return !!object && object instanceof fetch_blob_default && /^(File)$/.test(object[Symbol.toStringTag]);
|
|
28713
28713
|
}
|
|
28714
28714
|
};
|
|
28715
|
-
|
|
28716
|
-
file_default =
|
|
28715
|
+
File2 = _File;
|
|
28716
|
+
file_default = File2;
|
|
28717
28717
|
}
|
|
28718
28718
|
});
|
|
28719
28719
|
|
|
@@ -28731,7 +28731,7 @@ Content-Type: ${v.type || "application/octet-stream"}\r
|
|
|
28731
28731
|
c.push(`--${b}--`);
|
|
28732
28732
|
return new B(c, { type: "multipart/form-data; boundary=" + b });
|
|
28733
28733
|
}
|
|
28734
|
-
var t, i, h, r, m, f, e, x,
|
|
28734
|
+
var t, i, h, r, m, f, e, x, FormData;
|
|
28735
28735
|
var init_esm_min = __esm({
|
|
28736
28736
|
"../../node_modules/.pnpm/formdata-polyfill@4.0.10/node_modules/formdata-polyfill/esm.min.js"() {
|
|
28737
28737
|
init_fetch_blob();
|
|
@@ -28746,7 +28746,7 @@ var init_esm_min = __esm({
|
|
|
28746
28746
|
throw new TypeError(`Failed to execute '${n}' on 'FormData': ${e2} arguments required, but only ${a.length} present.`);
|
|
28747
28747
|
}
|
|
28748
28748
|
};
|
|
28749
|
-
|
|
28749
|
+
FormData = class FormData2 {
|
|
28750
28750
|
#d = [];
|
|
28751
28751
|
constructor(...a) {
|
|
28752
28752
|
if (a.length)
|
|
@@ -28912,7 +28912,7 @@ async function toFormData(Body2, ct) {
|
|
|
28912
28912
|
let contentType;
|
|
28913
28913
|
let filename;
|
|
28914
28914
|
const entryChunks = [];
|
|
28915
|
-
const formData = new
|
|
28915
|
+
const formData = new FormData();
|
|
28916
28916
|
const onPartData = (ui8a) => {
|
|
28917
28917
|
entryValue += decoder.decode(ui8a, { stream: true });
|
|
28918
28918
|
};
|
|
@@ -56123,18 +56123,18 @@ var require_lines = __commonJS({
|
|
|
56123
56123
|
assert_1.default.strictEqual(typeof pos, "object");
|
|
56124
56124
|
assert_1.default.strictEqual(typeof pos.line, "number");
|
|
56125
56125
|
assert_1.default.strictEqual(typeof pos.column, "number");
|
|
56126
|
-
var line = pos.line, column = pos.column, secret = this, infos = secret.infos,
|
|
56127
|
-
if (typeof
|
|
56126
|
+
var line = pos.line, column = pos.column, secret = this, infos = secret.infos, info = infos[line - 1], c = column;
|
|
56127
|
+
if (typeof info === "undefined" || c < 0)
|
|
56128
56128
|
return "";
|
|
56129
56129
|
var indent2 = this.getIndentAt(line);
|
|
56130
56130
|
if (c < indent2)
|
|
56131
56131
|
return " ";
|
|
56132
|
-
c +=
|
|
56133
|
-
if (c ===
|
|
56132
|
+
c += info.sliceStart - indent2;
|
|
56133
|
+
if (c === info.sliceEnd && line < this.length)
|
|
56134
56134
|
return "\n";
|
|
56135
|
-
if (c >=
|
|
56135
|
+
if (c >= info.sliceEnd)
|
|
56136
56136
|
return "";
|
|
56137
|
-
return
|
|
56137
|
+
return info.line.charAt(c);
|
|
56138
56138
|
};
|
|
56139
56139
|
Lines2.prototype.stripMargin = function(width, skipFirstLine) {
|
|
56140
56140
|
if (width === 0)
|
|
@@ -56142,11 +56142,11 @@ var require_lines = __commonJS({
|
|
|
56142
56142
|
assert_1.default.ok(width > 0, "negative margin: " + width);
|
|
56143
56143
|
if (skipFirstLine && this.length === 1)
|
|
56144
56144
|
return this;
|
|
56145
|
-
var lines = new Lines2(this.infos.map(function(
|
|
56146
|
-
if (
|
|
56147
|
-
|
|
56145
|
+
var lines = new Lines2(this.infos.map(function(info, i2) {
|
|
56146
|
+
if (info.line && (i2 > 0 || !skipFirstLine)) {
|
|
56147
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: Math.max(0, info.indent - width) });
|
|
56148
56148
|
}
|
|
56149
|
-
return
|
|
56149
|
+
return info;
|
|
56150
56150
|
}));
|
|
56151
56151
|
if (this.mappings.length > 0) {
|
|
56152
56152
|
var newMappings_1 = lines.mappings;
|
|
@@ -56161,11 +56161,11 @@ var require_lines = __commonJS({
|
|
|
56161
56161
|
if (by === 0) {
|
|
56162
56162
|
return this;
|
|
56163
56163
|
}
|
|
56164
|
-
var lines = new Lines2(this.infos.map(function(
|
|
56165
|
-
if (
|
|
56166
|
-
|
|
56164
|
+
var lines = new Lines2(this.infos.map(function(info) {
|
|
56165
|
+
if (info.line && !info.locked) {
|
|
56166
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
|
|
56167
56167
|
}
|
|
56168
|
-
return
|
|
56168
|
+
return info;
|
|
56169
56169
|
}));
|
|
56170
56170
|
if (this.mappings.length > 0) {
|
|
56171
56171
|
var newMappings_2 = lines.mappings;
|
|
@@ -56183,11 +56183,11 @@ var require_lines = __commonJS({
|
|
|
56183
56183
|
if (this.length < 2) {
|
|
56184
56184
|
return this;
|
|
56185
56185
|
}
|
|
56186
|
-
var lines = new Lines2(this.infos.map(function(
|
|
56187
|
-
if (i2 > 0 &&
|
|
56188
|
-
|
|
56186
|
+
var lines = new Lines2(this.infos.map(function(info, i2) {
|
|
56187
|
+
if (i2 > 0 && info.line && !info.locked) {
|
|
56188
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
|
|
56189
56189
|
}
|
|
56190
|
-
return
|
|
56190
|
+
return info;
|
|
56191
56191
|
}));
|
|
56192
56192
|
if (this.mappings.length > 0) {
|
|
56193
56193
|
var newMappings_3 = lines.mappings;
|
|
@@ -56202,8 +56202,8 @@ var require_lines = __commonJS({
|
|
|
56202
56202
|
if (this.length < 2) {
|
|
56203
56203
|
return this;
|
|
56204
56204
|
}
|
|
56205
|
-
return new Lines2(this.infos.map(function(
|
|
56206
|
-
return tslib_1.__assign(tslib_1.__assign({},
|
|
56205
|
+
return new Lines2(this.infos.map(function(info, i2) {
|
|
56206
|
+
return tslib_1.__assign(tslib_1.__assign({}, info), { locked: i2 > 0 });
|
|
56207
56207
|
}));
|
|
56208
56208
|
};
|
|
56209
56209
|
Lines2.prototype.getIndentAt = function(line) {
|
|
@@ -56217,14 +56217,14 @@ var require_lines = __commonJS({
|
|
|
56217
56217
|
var counts = [];
|
|
56218
56218
|
var lastIndent = 0;
|
|
56219
56219
|
for (var line = 1, last = this.length; line <= last; ++line) {
|
|
56220
|
-
var
|
|
56221
|
-
var sliced =
|
|
56220
|
+
var info = this.infos[line - 1];
|
|
56221
|
+
var sliced = info.line.slice(info.sliceStart, info.sliceEnd);
|
|
56222
56222
|
if (isOnlyWhitespace(sliced)) {
|
|
56223
56223
|
continue;
|
|
56224
56224
|
}
|
|
56225
|
-
var diff = Math.abs(
|
|
56225
|
+
var diff = Math.abs(info.indent - lastIndent);
|
|
56226
56226
|
counts[diff] = ~~counts[diff] + 1;
|
|
56227
|
-
lastIndent =
|
|
56227
|
+
lastIndent = info.indent;
|
|
56228
56228
|
}
|
|
56229
56229
|
var maxCount = -1;
|
|
56230
56230
|
var result = 2;
|
|
@@ -56247,20 +56247,20 @@ var require_lines = __commonJS({
|
|
|
56247
56247
|
return isOnlyWhitespace(this.toString());
|
|
56248
56248
|
};
|
|
56249
56249
|
Lines2.prototype.isPrecededOnlyByWhitespace = function(pos) {
|
|
56250
|
-
var
|
|
56251
|
-
var indent2 = Math.max(
|
|
56250
|
+
var info = this.infos[pos.line - 1];
|
|
56251
|
+
var indent2 = Math.max(info.indent, 0);
|
|
56252
56252
|
var diff = pos.column - indent2;
|
|
56253
56253
|
if (diff <= 0) {
|
|
56254
56254
|
return true;
|
|
56255
56255
|
}
|
|
56256
|
-
var start =
|
|
56257
|
-
var end = Math.min(start + diff,
|
|
56258
|
-
var prefix =
|
|
56256
|
+
var start = info.sliceStart;
|
|
56257
|
+
var end = Math.min(start + diff, info.sliceEnd);
|
|
56258
|
+
var prefix = info.line.slice(start, end);
|
|
56259
56259
|
return isOnlyWhitespace(prefix);
|
|
56260
56260
|
};
|
|
56261
56261
|
Lines2.prototype.getLineLength = function(line) {
|
|
56262
|
-
var
|
|
56263
|
-
return this.getIndentAt(line) +
|
|
56262
|
+
var info = this.infos[line - 1];
|
|
56263
|
+
return this.getIndentAt(line) + info.sliceEnd - info.sliceStart;
|
|
56264
56264
|
};
|
|
56265
56265
|
Lines2.prototype.nextPos = function(pos, skipSpaces) {
|
|
56266
56266
|
if (skipSpaces === void 0) {
|
|
@@ -56426,20 +56426,20 @@ var require_lines = __commonJS({
|
|
|
56426
56426
|
var _a = (0, options_1.normalize)(options), tabWidth = _a.tabWidth, useTabs = _a.useTabs, reuseWhitespace = _a.reuseWhitespace, lineTerminator = _a.lineTerminator;
|
|
56427
56427
|
var parts = [];
|
|
56428
56428
|
for (var line = start.line; line <= end.line; ++line) {
|
|
56429
|
-
var
|
|
56429
|
+
var info = this.infos[line - 1];
|
|
56430
56430
|
if (line === start.line) {
|
|
56431
56431
|
if (line === end.line) {
|
|
56432
|
-
|
|
56432
|
+
info = sliceInfo(info, start.column, end.column);
|
|
56433
56433
|
} else {
|
|
56434
|
-
|
|
56434
|
+
info = sliceInfo(info, start.column);
|
|
56435
56435
|
}
|
|
56436
56436
|
} else if (line === end.line) {
|
|
56437
|
-
|
|
56437
|
+
info = sliceInfo(info, 0, end.column);
|
|
56438
56438
|
}
|
|
56439
|
-
var indent2 = Math.max(
|
|
56440
|
-
var before_1 =
|
|
56439
|
+
var indent2 = Math.max(info.indent, 0);
|
|
56440
|
+
var before_1 = info.line.slice(0, info.sliceStart);
|
|
56441
56441
|
if (reuseWhitespace && isOnlyWhitespace(before_1) && countSpaces(before_1, tabWidth) === indent2) {
|
|
56442
|
-
parts.push(
|
|
56442
|
+
parts.push(info.line.slice(0, info.sliceEnd));
|
|
56443
56443
|
continue;
|
|
56444
56444
|
}
|
|
56445
56445
|
var tabs = 0;
|
|
@@ -56455,7 +56455,7 @@ var require_lines = __commonJS({
|
|
|
56455
56455
|
if (spaces > 0) {
|
|
56456
56456
|
result += new Array(spaces + 1).join(" ");
|
|
56457
56457
|
}
|
|
56458
|
-
result +=
|
|
56458
|
+
result += info.line.slice(info.sliceStart, info.sliceEnd);
|
|
56459
56459
|
parts.push(result);
|
|
56460
56460
|
}
|
|
56461
56461
|
return parts.join(lineTerminator);
|
|
@@ -56473,12 +56473,12 @@ var require_lines = __commonJS({
|
|
|
56473
56473
|
return;
|
|
56474
56474
|
}
|
|
56475
56475
|
if (prevInfo) {
|
|
56476
|
-
var
|
|
56477
|
-
var indent2 = new Array(
|
|
56476
|
+
var info = linesOrNull.infos[0];
|
|
56477
|
+
var indent2 = new Array(info.indent + 1).join(" ");
|
|
56478
56478
|
var prevLine_1 = infos.length;
|
|
56479
56479
|
var prevColumn_1 = Math.max(prevInfo.indent, 0) + prevInfo.sliceEnd - prevInfo.sliceStart;
|
|
56480
|
-
prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent2 +
|
|
56481
|
-
prevInfo.locked = prevInfo.locked ||
|
|
56480
|
+
prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent2 + info.line.slice(info.sliceStart, info.sliceEnd);
|
|
56481
|
+
prevInfo.locked = prevInfo.locked || info.locked;
|
|
56482
56482
|
prevInfo.sliceEnd = prevInfo.line.length;
|
|
56483
56483
|
if (linesOrNull.mappings.length > 0) {
|
|
56484
56484
|
linesOrNull.mappings.forEach(function(mapping) {
|
|
@@ -56488,9 +56488,9 @@ var require_lines = __commonJS({
|
|
|
56488
56488
|
} else if (linesOrNull.mappings.length > 0) {
|
|
56489
56489
|
mappings.push.apply(mappings, linesOrNull.mappings);
|
|
56490
56490
|
}
|
|
56491
|
-
linesOrNull.infos.forEach(function(
|
|
56491
|
+
linesOrNull.infos.forEach(function(info2, i2) {
|
|
56492
56492
|
if (!prevInfo || i2 > 0) {
|
|
56493
|
-
prevInfo = tslib_1.__assign({},
|
|
56493
|
+
prevInfo = tslib_1.__assign({}, info2);
|
|
56494
56494
|
infos.push(prevInfo);
|
|
56495
56495
|
}
|
|
56496
56496
|
});
|
|
@@ -56594,10 +56594,10 @@ var require_lines = __commonJS({
|
|
|
56594
56594
|
function isOnlyWhitespace(string) {
|
|
56595
56595
|
return !/\S/.test(string);
|
|
56596
56596
|
}
|
|
56597
|
-
function sliceInfo(
|
|
56598
|
-
var sliceStart =
|
|
56599
|
-
var sliceEnd =
|
|
56600
|
-
var indent2 = Math.max(
|
|
56597
|
+
function sliceInfo(info, startCol, endCol) {
|
|
56598
|
+
var sliceStart = info.sliceStart;
|
|
56599
|
+
var sliceEnd = info.sliceEnd;
|
|
56600
|
+
var indent2 = Math.max(info.indent, 0);
|
|
56601
56601
|
var lineLength = indent2 + sliceEnd - sliceStart;
|
|
56602
56602
|
if (typeof endCol === "undefined") {
|
|
56603
56603
|
endCol = lineLength;
|
|
@@ -56623,11 +56623,11 @@ var require_lines = __commonJS({
|
|
|
56623
56623
|
assert_1.default.ok(indent2 >= 0);
|
|
56624
56624
|
assert_1.default.ok(sliceStart <= sliceEnd);
|
|
56625
56625
|
assert_1.default.strictEqual(lineLength, indent2 + sliceEnd - sliceStart);
|
|
56626
|
-
if (
|
|
56627
|
-
return
|
|
56626
|
+
if (info.indent === indent2 && info.sliceStart === sliceStart && info.sliceEnd === sliceEnd) {
|
|
56627
|
+
return info;
|
|
56628
56628
|
}
|
|
56629
56629
|
return {
|
|
56630
|
-
line:
|
|
56630
|
+
line: info.line,
|
|
56631
56631
|
indent: indent2,
|
|
56632
56632
|
locked: false,
|
|
56633
56633
|
sliceStart,
|
|
@@ -59634,9 +59634,9 @@ var require_printer2 = __commonJS({
|
|
|
59634
59634
|
var prevTrailingSpace = null;
|
|
59635
59635
|
var len = filtered.length;
|
|
59636
59636
|
var parts = [];
|
|
59637
|
-
filtered.forEach(function(
|
|
59638
|
-
var printed =
|
|
59639
|
-
var stmt =
|
|
59637
|
+
filtered.forEach(function(info, i2) {
|
|
59638
|
+
var printed = info.printed;
|
|
59639
|
+
var stmt = info.node;
|
|
59640
59640
|
var multiLine = printed.length > 1;
|
|
59641
59641
|
var notFirst = i2 > 0;
|
|
59642
59642
|
var notLast = i2 < len - 1;
|
|
@@ -60573,13 +60573,13 @@ var require_text = __commonJS({
|
|
|
60573
60573
|
"use strict";
|
|
60574
60574
|
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
|
60575
60575
|
try {
|
|
60576
|
-
var
|
|
60577
|
-
var value =
|
|
60576
|
+
var info = gen[key](arg);
|
|
60577
|
+
var value = info.value;
|
|
60578
60578
|
} catch (error) {
|
|
60579
60579
|
reject(error);
|
|
60580
60580
|
return;
|
|
60581
60581
|
}
|
|
60582
|
-
if (
|
|
60582
|
+
if (info.done) {
|
|
60583
60583
|
resolve2(value);
|
|
60584
60584
|
} else {
|
|
60585
60585
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -61333,13 +61333,13 @@ var require_date = __commonJS({
|
|
|
61333
61333
|
"use strict";
|
|
61334
61334
|
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
|
61335
61335
|
try {
|
|
61336
|
-
var
|
|
61337
|
-
var value =
|
|
61336
|
+
var info = gen[key](arg);
|
|
61337
|
+
var value = info.value;
|
|
61338
61338
|
} catch (error) {
|
|
61339
61339
|
reject(error);
|
|
61340
61340
|
return;
|
|
61341
61341
|
}
|
|
61342
|
-
if (
|
|
61342
|
+
if (info.done) {
|
|
61343
61343
|
resolve2(value);
|
|
61344
61344
|
} else {
|
|
61345
61345
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -61559,13 +61559,13 @@ var require_number = __commonJS({
|
|
|
61559
61559
|
"use strict";
|
|
61560
61560
|
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
|
61561
61561
|
try {
|
|
61562
|
-
var
|
|
61563
|
-
var value =
|
|
61562
|
+
var info = gen[key](arg);
|
|
61563
|
+
var value = info.value;
|
|
61564
61564
|
} catch (error) {
|
|
61565
61565
|
reject(error);
|
|
61566
61566
|
return;
|
|
61567
61567
|
}
|
|
61568
|
-
if (
|
|
61568
|
+
if (info.done) {
|
|
61569
61569
|
resolve2(value);
|
|
61570
61570
|
} else {
|
|
61571
61571
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -62017,13 +62017,13 @@ var require_autocomplete = __commonJS({
|
|
|
62017
62017
|
"use strict";
|
|
62018
62018
|
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
|
62019
62019
|
try {
|
|
62020
|
-
var
|
|
62021
|
-
var value =
|
|
62020
|
+
var info = gen[key](arg);
|
|
62021
|
+
var value = info.value;
|
|
62022
62022
|
} catch (error) {
|
|
62023
62023
|
reject(error);
|
|
62024
62024
|
return;
|
|
62025
62025
|
}
|
|
62026
|
-
if (
|
|
62026
|
+
if (info.done) {
|
|
62027
62027
|
resolve2(value);
|
|
62028
62028
|
} else {
|
|
62029
62029
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -62703,13 +62703,13 @@ var require_dist = __commonJS({
|
|
|
62703
62703
|
}
|
|
62704
62704
|
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
|
62705
62705
|
try {
|
|
62706
|
-
var
|
|
62707
|
-
var value =
|
|
62706
|
+
var info = gen[key](arg);
|
|
62707
|
+
var value = info.value;
|
|
62708
62708
|
} catch (error) {
|
|
62709
62709
|
reject(error);
|
|
62710
62710
|
return;
|
|
62711
62711
|
}
|
|
62712
|
-
if (
|
|
62712
|
+
if (info.done) {
|
|
62713
62713
|
resolve2(value);
|
|
62714
62714
|
} else {
|
|
62715
62715
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -68248,1719 +68248,6 @@ function computeID(configFile, type, data) {
|
|
|
68248
68248
|
return id.slice(0, -2);
|
|
68249
68249
|
}
|
|
68250
68250
|
|
|
68251
|
-
// src/runtime/lib/deepEquals.ts
|
|
68252
|
-
function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
|
|
68253
|
-
if (Object.is(objA, objB))
|
|
68254
|
-
return true;
|
|
68255
|
-
if (objA instanceof Date && objB instanceof Date) {
|
|
68256
|
-
return objA.getTime() === objB.getTime();
|
|
68257
|
-
}
|
|
68258
|
-
if (objA instanceof RegExp && objB instanceof RegExp) {
|
|
68259
|
-
return objA.toString() === objB.toString();
|
|
68260
|
-
}
|
|
68261
|
-
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
|
68262
|
-
return false;
|
|
68263
|
-
}
|
|
68264
|
-
if (map.get(objA) === objB)
|
|
68265
|
-
return true;
|
|
68266
|
-
map.set(objA, objB);
|
|
68267
|
-
const keysA = Reflect.ownKeys(objA);
|
|
68268
|
-
const keysB = Reflect.ownKeys(objB);
|
|
68269
|
-
if (keysA.length !== keysB.length) {
|
|
68270
|
-
return false;
|
|
68271
|
-
}
|
|
68272
|
-
for (let i2 = 0; i2 < keysA.length; i2++) {
|
|
68273
|
-
if (!Reflect.has(objB, keysA[i2]) || !deepEquals(objA[keysA[i2]], objB[keysA[i2]], map)) {
|
|
68274
|
-
return false;
|
|
68275
|
-
}
|
|
68276
|
-
}
|
|
68277
|
-
return true;
|
|
68278
|
-
}
|
|
68279
|
-
|
|
68280
|
-
// src/runtime/lib/selection.ts
|
|
68281
|
-
function getFieldsForType(selection2, __typename) {
|
|
68282
|
-
let targetSelection = selection2.fields || {};
|
|
68283
|
-
if (selection2.abstractFields && __typename) {
|
|
68284
|
-
const mappedType = selection2.abstractFields.typeMap[__typename];
|
|
68285
|
-
if (mappedType) {
|
|
68286
|
-
targetSelection = selection2.abstractFields.fields[mappedType];
|
|
68287
|
-
} else if (selection2.abstractFields.fields[__typename]) {
|
|
68288
|
-
targetSelection = selection2.abstractFields.fields[__typename];
|
|
68289
|
-
}
|
|
68290
|
-
}
|
|
68291
|
-
return targetSelection;
|
|
68292
|
-
}
|
|
68293
|
-
|
|
68294
|
-
// src/runtime/cache/gc.ts
|
|
68295
|
-
var GarbageCollector = class {
|
|
68296
|
-
cache;
|
|
68297
|
-
lifetimes = /* @__PURE__ */ new Map();
|
|
68298
|
-
get cacheBufferSize() {
|
|
68299
|
-
return this.cache._internal_unstable.config.cacheBufferSize ?? 10;
|
|
68300
|
-
}
|
|
68301
|
-
constructor(cache) {
|
|
68302
|
-
this.cache = cache;
|
|
68303
|
-
}
|
|
68304
|
-
resetLifetime(id, field) {
|
|
68305
|
-
if (!this.lifetimes.get(id)) {
|
|
68306
|
-
this.lifetimes.set(id, /* @__PURE__ */ new Map());
|
|
68307
|
-
}
|
|
68308
|
-
this.lifetimes.get(id).set(field, 0);
|
|
68309
|
-
}
|
|
68310
|
-
tick() {
|
|
68311
|
-
for (const [id, fieldMap] of this.lifetimes.entries()) {
|
|
68312
|
-
for (const [field, lifetime] of fieldMap.entries()) {
|
|
68313
|
-
if (this.cache._internal_unstable.subscriptions.get(id, field).length > 0) {
|
|
68314
|
-
continue;
|
|
68315
|
-
}
|
|
68316
|
-
fieldMap.set(field, lifetime + 1);
|
|
68317
|
-
if (fieldMap.get(field) > this.cacheBufferSize) {
|
|
68318
|
-
this.cache._internal_unstable.storage.deleteField(id, field);
|
|
68319
|
-
this.cache._internal_unstable.lists.deleteField(id, field);
|
|
68320
|
-
fieldMap.delete(field);
|
|
68321
|
-
if ([...fieldMap.keys()].length === 0) {
|
|
68322
|
-
this.lifetimes.delete(id);
|
|
68323
|
-
}
|
|
68324
|
-
}
|
|
68325
|
-
}
|
|
68326
|
-
}
|
|
68327
|
-
}
|
|
68328
|
-
};
|
|
68329
|
-
|
|
68330
|
-
// src/runtime/cache/stuff.ts
|
|
68331
|
-
function flattenList(source) {
|
|
68332
|
-
const flat = [];
|
|
68333
|
-
const unvisited = [source || []];
|
|
68334
|
-
while (unvisited.length > 0) {
|
|
68335
|
-
const target = unvisited.shift();
|
|
68336
|
-
for (const id of target) {
|
|
68337
|
-
if (Array.isArray(id)) {
|
|
68338
|
-
unvisited.push(id);
|
|
68339
|
-
continue;
|
|
68340
|
-
}
|
|
68341
|
-
flat.push(id);
|
|
68342
|
-
}
|
|
68343
|
-
}
|
|
68344
|
-
return flat;
|
|
68345
|
-
}
|
|
68346
|
-
function evaluateKey(key, variables = {}) {
|
|
68347
|
-
let evaluated = "";
|
|
68348
|
-
let varName = "";
|
|
68349
|
-
let inString = false;
|
|
68350
|
-
for (const char of key) {
|
|
68351
|
-
if (varName) {
|
|
68352
|
-
if (varChars.includes(char)) {
|
|
68353
|
-
varName += char;
|
|
68354
|
-
continue;
|
|
68355
|
-
}
|
|
68356
|
-
const value = variables[varName.slice(1)];
|
|
68357
|
-
evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
|
|
68358
|
-
varName = "";
|
|
68359
|
-
}
|
|
68360
|
-
if (char === "$" && !inString) {
|
|
68361
|
-
varName = "$";
|
|
68362
|
-
continue;
|
|
68363
|
-
}
|
|
68364
|
-
if (char === '"') {
|
|
68365
|
-
inString = !inString;
|
|
68366
|
-
}
|
|
68367
|
-
evaluated += char;
|
|
68368
|
-
}
|
|
68369
|
-
return evaluated;
|
|
68370
|
-
}
|
|
68371
|
-
var varChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
|
|
68372
|
-
|
|
68373
|
-
// src/runtime/cache/lists.ts
|
|
68374
|
-
var ListManager = class {
|
|
68375
|
-
rootID;
|
|
68376
|
-
cache;
|
|
68377
|
-
constructor(cache, rootID2) {
|
|
68378
|
-
this.rootID = rootID2;
|
|
68379
|
-
this.cache = cache;
|
|
68380
|
-
}
|
|
68381
|
-
lists = /* @__PURE__ */ new Map();
|
|
68382
|
-
listsByField = /* @__PURE__ */ new Map();
|
|
68383
|
-
get(listName, id, allLists) {
|
|
68384
|
-
const matches = this.lists.get(listName);
|
|
68385
|
-
if (!matches || matches.size === 0) {
|
|
68386
|
-
return null;
|
|
68387
|
-
}
|
|
68388
|
-
if (allLists) {
|
|
68389
|
-
return new ListCollection(
|
|
68390
|
-
Array.from(matches, ([key, value]) => [...value.lists]).flat()
|
|
68391
|
-
);
|
|
68392
|
-
}
|
|
68393
|
-
const head = [...matches.values()][0];
|
|
68394
|
-
const { recordType } = head.lists[0];
|
|
68395
|
-
const parentID = id ? this.cache._internal_unstable.id(recordType || "", id) : this.rootID;
|
|
68396
|
-
if (matches?.size === 1) {
|
|
68397
|
-
if (!id) {
|
|
68398
|
-
return head;
|
|
68399
|
-
}
|
|
68400
|
-
return parentID === Array.from(matches.keys())[0] ? head : null;
|
|
68401
|
-
}
|
|
68402
|
-
if (!id) {
|
|
68403
|
-
console.error(
|
|
68404
|
-
`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 `
|
|
68405
|
-
);
|
|
68406
|
-
return null;
|
|
68407
|
-
}
|
|
68408
|
-
return this.lists.get(listName)?.get(parentID);
|
|
68409
|
-
}
|
|
68410
|
-
remove(listName, id) {
|
|
68411
|
-
this.lists.get(listName)?.delete(id || this.rootID);
|
|
68412
|
-
}
|
|
68413
|
-
add(list) {
|
|
68414
|
-
if (!this.lists.has(list.name)) {
|
|
68415
|
-
this.lists.set(list.name, /* @__PURE__ */ new Map());
|
|
68416
|
-
}
|
|
68417
|
-
const name2 = list.name;
|
|
68418
|
-
const parentID = list.recordID || this.rootID;
|
|
68419
|
-
if (this.lists.get(name2)?.get(parentID)?.includes(list.key)) {
|
|
68420
|
-
return;
|
|
68421
|
-
}
|
|
68422
|
-
if (!this.lists.has(name2)) {
|
|
68423
|
-
this.lists.set(name2, /* @__PURE__ */ new Map());
|
|
68424
|
-
}
|
|
68425
|
-
if (!this.lists.get(name2).has(parentID)) {
|
|
68426
|
-
this.lists.get(name2).set(parentID, new ListCollection([]));
|
|
68427
|
-
}
|
|
68428
|
-
if (!this.listsByField.has(parentID)) {
|
|
68429
|
-
this.listsByField.set(parentID, /* @__PURE__ */ new Map());
|
|
68430
|
-
}
|
|
68431
|
-
if (!this.listsByField.get(parentID).has(list.key)) {
|
|
68432
|
-
this.listsByField.get(parentID)?.set(list.key, []);
|
|
68433
|
-
}
|
|
68434
|
-
const handler = new List({ ...list, manager: this });
|
|
68435
|
-
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
68436
|
-
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
68437
|
-
}
|
|
68438
|
-
removeIDFromAllLists(id) {
|
|
68439
|
-
for (const fieldMap of this.lists.values()) {
|
|
68440
|
-
for (const list of fieldMap.values()) {
|
|
68441
|
-
list.removeID(id);
|
|
68442
|
-
}
|
|
68443
|
-
}
|
|
68444
|
-
}
|
|
68445
|
-
deleteField(parentID, field) {
|
|
68446
|
-
if (!this.listsByField.get(parentID)?.has(field)) {
|
|
68447
|
-
return;
|
|
68448
|
-
}
|
|
68449
|
-
for (const list of this.listsByField.get(parentID).get(field)) {
|
|
68450
|
-
this.lists.get(list.name)?.get(list.recordID)?.deleteListWithKey(field);
|
|
68451
|
-
if (this.lists.get(list.name)?.get(list.recordID)?.lists.length === 0) {
|
|
68452
|
-
this.lists.get(list.name)?.delete(list.recordID);
|
|
68453
|
-
}
|
|
68454
|
-
}
|
|
68455
|
-
this.listsByField.get(parentID).delete(field);
|
|
68456
|
-
}
|
|
68457
|
-
};
|
|
68458
|
-
var List = class {
|
|
68459
|
-
recordID;
|
|
68460
|
-
recordType;
|
|
68461
|
-
key;
|
|
68462
|
-
type;
|
|
68463
|
-
cache;
|
|
68464
|
-
selection;
|
|
68465
|
-
_when;
|
|
68466
|
-
filters;
|
|
68467
|
-
name;
|
|
68468
|
-
connection;
|
|
68469
|
-
manager;
|
|
68470
|
-
abstract;
|
|
68471
|
-
constructor({
|
|
68472
|
-
name: name2,
|
|
68473
|
-
recordID,
|
|
68474
|
-
recordType,
|
|
68475
|
-
key,
|
|
68476
|
-
listType,
|
|
68477
|
-
selection: selection2,
|
|
68478
|
-
when,
|
|
68479
|
-
filters,
|
|
68480
|
-
connection,
|
|
68481
|
-
manager,
|
|
68482
|
-
abstract
|
|
68483
|
-
}) {
|
|
68484
|
-
this.recordID = recordID || rootID;
|
|
68485
|
-
this.recordType = recordType;
|
|
68486
|
-
this.key = key;
|
|
68487
|
-
this.type = listType;
|
|
68488
|
-
this.cache = manager.cache;
|
|
68489
|
-
this.selection = selection2;
|
|
68490
|
-
this._when = when;
|
|
68491
|
-
this.filters = filters;
|
|
68492
|
-
this.name = name2;
|
|
68493
|
-
this.connection = connection;
|
|
68494
|
-
this.manager = manager;
|
|
68495
|
-
this.abstract = abstract;
|
|
68496
|
-
}
|
|
68497
|
-
when(when) {
|
|
68498
|
-
return this.manager.lists.get(this.name).get(this.recordID).when(when);
|
|
68499
|
-
}
|
|
68500
|
-
append(selection2, data, variables = {}) {
|
|
68501
|
-
return this.addToList(selection2, data, variables, "last");
|
|
68502
|
-
}
|
|
68503
|
-
prepend(selection2, data, variables = {}) {
|
|
68504
|
-
return this.addToList(selection2, data, variables, "first");
|
|
68505
|
-
}
|
|
68506
|
-
addToList(selection2, data, variables = {}, where) {
|
|
68507
|
-
const listType = this.listType(data);
|
|
68508
|
-
const dataID = this.cache._internal_unstable.id(listType, data);
|
|
68509
|
-
if (!this.validateWhen() || !dataID) {
|
|
68510
|
-
return;
|
|
68511
|
-
}
|
|
68512
|
-
let insertSelection = selection2;
|
|
68513
|
-
let insertData = data;
|
|
68514
|
-
if (this.connection) {
|
|
68515
|
-
insertSelection = {
|
|
68516
|
-
fields: {
|
|
68517
|
-
newEntry: {
|
|
68518
|
-
keyRaw: this.key,
|
|
68519
|
-
type: "Connection",
|
|
68520
|
-
selection: {
|
|
68521
|
-
fields: {
|
|
68522
|
-
edges: {
|
|
68523
|
-
keyRaw: "edges",
|
|
68524
|
-
type: "ConnectionEdge",
|
|
68525
|
-
update: where === "first" ? "prepend" : "append",
|
|
68526
|
-
selection: {
|
|
68527
|
-
fields: {
|
|
68528
|
-
node: {
|
|
68529
|
-
type: listType,
|
|
68530
|
-
keyRaw: "node",
|
|
68531
|
-
selection: {
|
|
68532
|
-
...selection2,
|
|
68533
|
-
fields: {
|
|
68534
|
-
...selection2.fields,
|
|
68535
|
-
__typename: {
|
|
68536
|
-
keyRaw: "__typename",
|
|
68537
|
-
type: "String"
|
|
68538
|
-
}
|
|
68539
|
-
}
|
|
68540
|
-
}
|
|
68541
|
-
}
|
|
68542
|
-
}
|
|
68543
|
-
}
|
|
68544
|
-
}
|
|
68545
|
-
}
|
|
68546
|
-
}
|
|
68547
|
-
}
|
|
68548
|
-
}
|
|
68549
|
-
};
|
|
68550
|
-
insertData = {
|
|
68551
|
-
newEntry: {
|
|
68552
|
-
edges: [{ node: { ...data, __typename: listType } }]
|
|
68553
|
-
}
|
|
68554
|
-
};
|
|
68555
|
-
} else {
|
|
68556
|
-
insertSelection = {
|
|
68557
|
-
fields: {
|
|
68558
|
-
newEntries: {
|
|
68559
|
-
keyRaw: this.key,
|
|
68560
|
-
type: listType,
|
|
68561
|
-
update: where === "first" ? "prepend" : "append",
|
|
68562
|
-
selection: {
|
|
68563
|
-
...selection2,
|
|
68564
|
-
fields: {
|
|
68565
|
-
...selection2.fields,
|
|
68566
|
-
__typename: {
|
|
68567
|
-
keyRaw: "__typename",
|
|
68568
|
-
type: "String"
|
|
68569
|
-
}
|
|
68570
|
-
}
|
|
68571
|
-
}
|
|
68572
|
-
}
|
|
68573
|
-
}
|
|
68574
|
-
};
|
|
68575
|
-
insertData = {
|
|
68576
|
-
newEntries: [{ ...data, __typename: listType }]
|
|
68577
|
-
};
|
|
68578
|
-
}
|
|
68579
|
-
this.cache.write({
|
|
68580
|
-
selection: insertSelection,
|
|
68581
|
-
data: insertData,
|
|
68582
|
-
variables,
|
|
68583
|
-
parent: this.recordID,
|
|
68584
|
-
applyUpdates: true
|
|
68585
|
-
});
|
|
68586
|
-
}
|
|
68587
|
-
removeID(id, variables = {}) {
|
|
68588
|
-
if (!this.validateWhen()) {
|
|
68589
|
-
return;
|
|
68590
|
-
}
|
|
68591
|
-
let parentID = this.recordID;
|
|
68592
|
-
let targetID = id;
|
|
68593
|
-
let targetKey = this.key;
|
|
68594
|
-
if (this.connection) {
|
|
68595
|
-
const { value: embeddedConnection } = this.cache._internal_unstable.storage.get(
|
|
68596
|
-
this.recordID,
|
|
68597
|
-
this.key
|
|
68598
|
-
);
|
|
68599
|
-
if (!embeddedConnection) {
|
|
68600
|
-
return;
|
|
68601
|
-
}
|
|
68602
|
-
const embeddedConnectionID = embeddedConnection;
|
|
68603
|
-
const { value: edges } = this.cache._internal_unstable.storage.get(
|
|
68604
|
-
embeddedConnectionID,
|
|
68605
|
-
"edges"
|
|
68606
|
-
);
|
|
68607
|
-
for (const edge of flattenList(edges) || []) {
|
|
68608
|
-
if (!edge) {
|
|
68609
|
-
continue;
|
|
68610
|
-
}
|
|
68611
|
-
const edgeID = edge;
|
|
68612
|
-
const { value: nodeID } = this.cache._internal_unstable.storage.get(edgeID, "node");
|
|
68613
|
-
if (!nodeID) {
|
|
68614
|
-
continue;
|
|
68615
|
-
}
|
|
68616
|
-
if (nodeID === id) {
|
|
68617
|
-
targetID = edgeID;
|
|
68618
|
-
}
|
|
68619
|
-
}
|
|
68620
|
-
parentID = embeddedConnectionID;
|
|
68621
|
-
targetKey = "edges";
|
|
68622
|
-
}
|
|
68623
|
-
let value = this.cache._internal_unstable.storage.get(parentID, targetKey).value;
|
|
68624
|
-
if (!value || !value.includes(targetID)) {
|
|
68625
|
-
return;
|
|
68626
|
-
}
|
|
68627
|
-
const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
|
|
68628
|
-
this.cache._internal_unstable.subscriptions.remove(
|
|
68629
|
-
targetID,
|
|
68630
|
-
this.connection ? this.selection.fields.edges.selection : this.selection,
|
|
68631
|
-
subscribers,
|
|
68632
|
-
variables
|
|
68633
|
-
);
|
|
68634
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
68635
|
-
for (const spec of subscribers) {
|
|
68636
|
-
spec.set(
|
|
68637
|
-
this.cache._internal_unstable.getSelection({
|
|
68638
|
-
parent: spec.parentID || this.manager.rootID,
|
|
68639
|
-
selection: spec.selection,
|
|
68640
|
-
variables: spec.variables?.() || {}
|
|
68641
|
-
}).data
|
|
68642
|
-
);
|
|
68643
|
-
}
|
|
68644
|
-
return true;
|
|
68645
|
-
}
|
|
68646
|
-
remove(data, variables = {}) {
|
|
68647
|
-
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
68648
|
-
if (!targetID) {
|
|
68649
|
-
return;
|
|
68650
|
-
}
|
|
68651
|
-
return this.removeID(targetID, variables);
|
|
68652
|
-
}
|
|
68653
|
-
listType(data) {
|
|
68654
|
-
return data.__typename || this.type;
|
|
68655
|
-
}
|
|
68656
|
-
validateWhen(when) {
|
|
68657
|
-
let filters = when || this._when;
|
|
68658
|
-
let ok = true;
|
|
68659
|
-
if (filters) {
|
|
68660
|
-
const targets = this.filters;
|
|
68661
|
-
if (filters.must && targets) {
|
|
68662
|
-
ok = Object.entries(filters.must).reduce(
|
|
68663
|
-
(prev, [key, value]) => Boolean(prev && targets[key] == value),
|
|
68664
|
-
ok
|
|
68665
|
-
);
|
|
68666
|
-
}
|
|
68667
|
-
if (filters.must_not) {
|
|
68668
|
-
ok = !targets || Object.entries(filters.must_not).reduce(
|
|
68669
|
-
(prev, [key, value]) => Boolean(prev && targets[key] != value),
|
|
68670
|
-
ok
|
|
68671
|
-
);
|
|
68672
|
-
}
|
|
68673
|
-
}
|
|
68674
|
-
return ok;
|
|
68675
|
-
}
|
|
68676
|
-
toggleElement(selection2, data, variables = {}, where) {
|
|
68677
|
-
if (!this.remove(data, variables)) {
|
|
68678
|
-
this.addToList(selection2, data, variables, where);
|
|
68679
|
-
}
|
|
68680
|
-
}
|
|
68681
|
-
*[Symbol.iterator]() {
|
|
68682
|
-
let entries = [];
|
|
68683
|
-
let value = this.cache._internal_unstable.storage.get(this.recordID, this.key).value;
|
|
68684
|
-
if (!this.connection) {
|
|
68685
|
-
entries = flattenList(value);
|
|
68686
|
-
} else {
|
|
68687
|
-
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
68688
|
-
}
|
|
68689
|
-
for (let record2 of entries) {
|
|
68690
|
-
yield record2;
|
|
68691
|
-
}
|
|
68692
|
-
}
|
|
68693
|
-
};
|
|
68694
|
-
var ListCollection = class {
|
|
68695
|
-
lists = [];
|
|
68696
|
-
constructor(lists) {
|
|
68697
|
-
this.lists = lists;
|
|
68698
|
-
}
|
|
68699
|
-
append(...args) {
|
|
68700
|
-
this.lists.forEach((list) => list.append(...args));
|
|
68701
|
-
}
|
|
68702
|
-
prepend(...args) {
|
|
68703
|
-
this.lists.forEach((list) => list.prepend(...args));
|
|
68704
|
-
}
|
|
68705
|
-
addToList(...args) {
|
|
68706
|
-
this.lists.forEach((list) => list.addToList(...args));
|
|
68707
|
-
}
|
|
68708
|
-
removeID(...args) {
|
|
68709
|
-
this.lists.forEach((list) => list.removeID(...args));
|
|
68710
|
-
}
|
|
68711
|
-
remove(...args) {
|
|
68712
|
-
this.lists.forEach((list) => list.remove(...args));
|
|
68713
|
-
}
|
|
68714
|
-
toggleElement(...args) {
|
|
68715
|
-
this.lists.forEach((list) => list.toggleElement(...args));
|
|
68716
|
-
}
|
|
68717
|
-
when(when) {
|
|
68718
|
-
return new ListCollection(
|
|
68719
|
-
this.lists.filter((list) => {
|
|
68720
|
-
return list.validateWhen(when);
|
|
68721
|
-
})
|
|
68722
|
-
);
|
|
68723
|
-
}
|
|
68724
|
-
includes(key) {
|
|
68725
|
-
return !!this.lists.find((list) => list.key === key);
|
|
68726
|
-
}
|
|
68727
|
-
deleteListWithKey(key) {
|
|
68728
|
-
return this.lists = this.lists.filter((list) => list.key !== key);
|
|
68729
|
-
}
|
|
68730
|
-
*[Symbol.iterator]() {
|
|
68731
|
-
for (let list of this.lists) {
|
|
68732
|
-
for (const entry of list) {
|
|
68733
|
-
yield entry;
|
|
68734
|
-
}
|
|
68735
|
-
}
|
|
68736
|
-
}
|
|
68737
|
-
};
|
|
68738
|
-
|
|
68739
|
-
// src/runtime/cache/schema.ts
|
|
68740
|
-
var SchemaManager = class {
|
|
68741
|
-
cache;
|
|
68742
|
-
fieldTypes = {};
|
|
68743
|
-
constructor(cache) {
|
|
68744
|
-
this.cache = cache;
|
|
68745
|
-
}
|
|
68746
|
-
setFieldType({
|
|
68747
|
-
parent,
|
|
68748
|
-
key,
|
|
68749
|
-
type,
|
|
68750
|
-
nullable = false,
|
|
68751
|
-
link
|
|
68752
|
-
}) {
|
|
68753
|
-
let parensIndex = key.indexOf("(");
|
|
68754
|
-
if (parensIndex !== -1) {
|
|
68755
|
-
key = key.substring(0, parensIndex);
|
|
68756
|
-
}
|
|
68757
|
-
if (parent === rootID) {
|
|
68758
|
-
parent = "Query";
|
|
68759
|
-
} else if (parent.includes(":")) {
|
|
68760
|
-
parent = parent.substring(0, parent.indexOf(":"));
|
|
68761
|
-
}
|
|
68762
|
-
if (!this.fieldTypes[parent]) {
|
|
68763
|
-
this.fieldTypes[parent] = {};
|
|
68764
|
-
}
|
|
68765
|
-
this.fieldTypes[parent][key] = {
|
|
68766
|
-
type,
|
|
68767
|
-
nullable,
|
|
68768
|
-
link: !!link
|
|
68769
|
-
};
|
|
68770
|
-
}
|
|
68771
|
-
fieldType(type, field) {
|
|
68772
|
-
return this.fieldTypes[type]?.[field] || null;
|
|
68773
|
-
}
|
|
68774
|
-
get config() {
|
|
68775
|
-
return this.cache._internal_unstable.config;
|
|
68776
|
-
}
|
|
68777
|
-
};
|
|
68778
|
-
|
|
68779
|
-
// src/runtime/cache/storage.ts
|
|
68780
|
-
var InMemoryStorage = class {
|
|
68781
|
-
data;
|
|
68782
|
-
idCount = 0;
|
|
68783
|
-
rank = 0;
|
|
68784
|
-
constructor() {
|
|
68785
|
-
this.data = [];
|
|
68786
|
-
}
|
|
68787
|
-
get layerCount() {
|
|
68788
|
-
return this.data.length;
|
|
68789
|
-
}
|
|
68790
|
-
get nextRank() {
|
|
68791
|
-
return this.rank++;
|
|
68792
|
-
}
|
|
68793
|
-
createLayer(optimistic = false) {
|
|
68794
|
-
const layer = new Layer(this.idCount++);
|
|
68795
|
-
layer.optimistic = optimistic;
|
|
68796
|
-
this.data.push(layer);
|
|
68797
|
-
return layer;
|
|
68798
|
-
}
|
|
68799
|
-
insert(id, field, location, target) {
|
|
68800
|
-
return this.topLayer.insert(id, field, location, target);
|
|
68801
|
-
}
|
|
68802
|
-
remove(id, field, target) {
|
|
68803
|
-
return this.topLayer.remove(id, field, target);
|
|
68804
|
-
}
|
|
68805
|
-
delete(id) {
|
|
68806
|
-
return this.topLayer.delete(id);
|
|
68807
|
-
}
|
|
68808
|
-
deleteField(id, field) {
|
|
68809
|
-
return this.topLayer.deleteField(id, field);
|
|
68810
|
-
}
|
|
68811
|
-
getLayer(id) {
|
|
68812
|
-
for (const layer of this.data) {
|
|
68813
|
-
if (layer.id === id) {
|
|
68814
|
-
return layer;
|
|
68815
|
-
}
|
|
68816
|
-
}
|
|
68817
|
-
throw new Error("Could not find layer with id: " + id);
|
|
68818
|
-
}
|
|
68819
|
-
replaceID(replacement) {
|
|
68820
|
-
for (const layer of this.data) {
|
|
68821
|
-
layer.replaceID(replacement);
|
|
68822
|
-
}
|
|
68823
|
-
}
|
|
68824
|
-
get(id, field) {
|
|
68825
|
-
const operations = {
|
|
68826
|
-
[OperationKind.insert]: {
|
|
68827
|
-
[OperationLocation.start]: [],
|
|
68828
|
-
[OperationLocation.end]: []
|
|
68829
|
-
},
|
|
68830
|
-
[OperationKind.remove]: /* @__PURE__ */ new Set()
|
|
68831
|
-
};
|
|
68832
|
-
const layerIDs = [];
|
|
68833
|
-
for (let i2 = this.data.length - 1; i2 >= 0; i2--) {
|
|
68834
|
-
const layer = this.data[i2];
|
|
68835
|
-
const [layerValue, kind] = layer.get(id, field);
|
|
68836
|
-
const layerOperations = layer.getOperations(id, field) || [];
|
|
68837
|
-
layer.deletedIDs.forEach((v) => {
|
|
68838
|
-
if (layer.operations[v]?.undoDeletesInList?.includes(field)) {
|
|
68839
|
-
return;
|
|
68840
|
-
}
|
|
68841
|
-
operations.remove.add(v);
|
|
68842
|
-
});
|
|
68843
|
-
if (typeof layerValue === "undefined" && layerOperations.length === 0) {
|
|
68844
|
-
if (layer.deletedIDs.size > 0) {
|
|
68845
|
-
layerIDs.push(layer.id);
|
|
68846
|
-
}
|
|
68847
|
-
continue;
|
|
68848
|
-
}
|
|
68849
|
-
if (typeof layerValue !== "undefined" && !Array.isArray(layerValue)) {
|
|
68850
|
-
return {
|
|
68851
|
-
value: layerValue,
|
|
68852
|
-
kind,
|
|
68853
|
-
displayLayers: [layer.id]
|
|
68854
|
-
};
|
|
68855
|
-
}
|
|
68856
|
-
layerIDs.push(layer.id);
|
|
68857
|
-
if (layerOperations.length > 0) {
|
|
68858
|
-
for (const op of layerOperations) {
|
|
68859
|
-
if (isRemoveOperation(op)) {
|
|
68860
|
-
operations.remove.add(op.id);
|
|
68861
|
-
}
|
|
68862
|
-
if (isInsertOperation(op)) {
|
|
68863
|
-
operations.insert[op.location].unshift(op.id);
|
|
68864
|
-
}
|
|
68865
|
-
if (isDeleteOperation(op)) {
|
|
68866
|
-
return {
|
|
68867
|
-
value: void 0,
|
|
68868
|
-
kind: "unknown",
|
|
68869
|
-
displayLayers: []
|
|
68870
|
-
};
|
|
68871
|
-
}
|
|
68872
|
-
}
|
|
68873
|
-
}
|
|
68874
|
-
if (typeof layerValue === "undefined") {
|
|
68875
|
-
continue;
|
|
68876
|
-
}
|
|
68877
|
-
if (!operations.remove.size && !operations.insert.start.length && !operations.insert.end.length) {
|
|
68878
|
-
return { value: layerValue, displayLayers: layerIDs, kind: "link" };
|
|
68879
|
-
}
|
|
68880
|
-
return {
|
|
68881
|
-
value: [...operations.insert.start, ...layerValue, ...operations.insert.end].filter(
|
|
68882
|
-
(value) => !operations.remove.has(value)
|
|
68883
|
-
),
|
|
68884
|
-
displayLayers: layerIDs,
|
|
68885
|
-
kind
|
|
68886
|
-
};
|
|
68887
|
-
}
|
|
68888
|
-
return {
|
|
68889
|
-
value: void 0,
|
|
68890
|
-
kind: "unknown",
|
|
68891
|
-
displayLayers: []
|
|
68892
|
-
};
|
|
68893
|
-
}
|
|
68894
|
-
writeLink(id, field, value) {
|
|
68895
|
-
return this.topLayer.writeLink(id, field, value);
|
|
68896
|
-
}
|
|
68897
|
-
writeField(id, field, value) {
|
|
68898
|
-
return this.topLayer.writeField(id, field, value);
|
|
68899
|
-
}
|
|
68900
|
-
resolveLayer(id) {
|
|
68901
|
-
let startingIndex = null;
|
|
68902
|
-
for (const [index, layer] of this.data.entries()) {
|
|
68903
|
-
if (layer.id !== id) {
|
|
68904
|
-
continue;
|
|
68905
|
-
}
|
|
68906
|
-
startingIndex = index - 1;
|
|
68907
|
-
this.data[index].optimistic = false;
|
|
68908
|
-
break;
|
|
68909
|
-
}
|
|
68910
|
-
if (startingIndex === null) {
|
|
68911
|
-
throw new Error("could not find layer with id: " + id);
|
|
68912
|
-
}
|
|
68913
|
-
if (startingIndex === -1) {
|
|
68914
|
-
startingIndex = 0;
|
|
68915
|
-
}
|
|
68916
|
-
if (this.data[startingIndex].optimistic) {
|
|
68917
|
-
startingIndex++;
|
|
68918
|
-
}
|
|
68919
|
-
const baseLayer = this.data[startingIndex];
|
|
68920
|
-
let layerIndex = startingIndex;
|
|
68921
|
-
while (layerIndex < this.data.length) {
|
|
68922
|
-
const layer = this.data[layerIndex++];
|
|
68923
|
-
if (layer.optimistic) {
|
|
68924
|
-
layerIndex--;
|
|
68925
|
-
break;
|
|
68926
|
-
}
|
|
68927
|
-
baseLayer.writeLayer(layer);
|
|
68928
|
-
}
|
|
68929
|
-
this.data.splice(startingIndex + 1, layerIndex - startingIndex - 1);
|
|
68930
|
-
}
|
|
68931
|
-
get topLayer() {
|
|
68932
|
-
if (this.data.length === 0) {
|
|
68933
|
-
this.createLayer();
|
|
68934
|
-
}
|
|
68935
|
-
if (this.data[this.data.length - 1]?.optimistic) {
|
|
68936
|
-
this.createLayer();
|
|
68937
|
-
}
|
|
68938
|
-
return this.data[this.data.length - 1];
|
|
68939
|
-
}
|
|
68940
|
-
};
|
|
68941
|
-
var Layer = class {
|
|
68942
|
-
id;
|
|
68943
|
-
optimistic = false;
|
|
68944
|
-
fields = {};
|
|
68945
|
-
links = {};
|
|
68946
|
-
operations = {};
|
|
68947
|
-
deletedIDs = /* @__PURE__ */ new Set();
|
|
68948
|
-
constructor(id) {
|
|
68949
|
-
this.id = id;
|
|
68950
|
-
}
|
|
68951
|
-
get(id, field) {
|
|
68952
|
-
if (typeof this.links[id]?.[field] !== "undefined") {
|
|
68953
|
-
return [this.links[id][field], "link"];
|
|
68954
|
-
}
|
|
68955
|
-
return [this.fields[id]?.[field], "scalar"];
|
|
68956
|
-
}
|
|
68957
|
-
getOperations(id, field) {
|
|
68958
|
-
if (this.operations[id]?.deleted) {
|
|
68959
|
-
return [
|
|
68960
|
-
{
|
|
68961
|
-
kind: OperationKind.delete,
|
|
68962
|
-
target: id
|
|
68963
|
-
}
|
|
68964
|
-
];
|
|
68965
|
-
}
|
|
68966
|
-
if (this.operations[id]?.fields?.[field]) {
|
|
68967
|
-
return this.operations[id].fields[field];
|
|
68968
|
-
}
|
|
68969
|
-
}
|
|
68970
|
-
writeField(id, field, value) {
|
|
68971
|
-
this.fields[id] = {
|
|
68972
|
-
...this.fields[id],
|
|
68973
|
-
[field]: value
|
|
68974
|
-
};
|
|
68975
|
-
return this.id;
|
|
68976
|
-
}
|
|
68977
|
-
writeLink(id, field, value) {
|
|
68978
|
-
const valueList = Array.isArray(value) ? value : [value];
|
|
68979
|
-
for (const value2 of flattenList(valueList)) {
|
|
68980
|
-
if (!value2) {
|
|
68981
|
-
continue;
|
|
68982
|
-
}
|
|
68983
|
-
const fieldOperations = this.operations[id]?.fields[field];
|
|
68984
|
-
if (this.operations[value2]?.deleted || this.deletedIDs.has(value2)) {
|
|
68985
|
-
this.operations[value2] = {
|
|
68986
|
-
...this.operations[value2],
|
|
68987
|
-
undoDeletesInList: [...this.operations[id]?.undoDeletesInList || [], field]
|
|
68988
|
-
};
|
|
68989
|
-
} else if (value2 && fieldOperations?.length > 0) {
|
|
68990
|
-
this.operations[id].fields[field] = fieldOperations.filter(
|
|
68991
|
-
(op) => op.kind !== "remove" || op.id !== value2
|
|
68992
|
-
);
|
|
68993
|
-
}
|
|
68994
|
-
}
|
|
68995
|
-
this.links[id] = {
|
|
68996
|
-
...this.links[id],
|
|
68997
|
-
[field]: value
|
|
68998
|
-
};
|
|
68999
|
-
return this.id;
|
|
69000
|
-
}
|
|
69001
|
-
isDisplayLayer(displayLayers) {
|
|
69002
|
-
return displayLayers.length === 0 || displayLayers.includes(this.id) || Math.max(...displayLayers) < this.id;
|
|
69003
|
-
}
|
|
69004
|
-
clear() {
|
|
69005
|
-
this.links = {};
|
|
69006
|
-
this.fields = {};
|
|
69007
|
-
this.operations = {};
|
|
69008
|
-
this.deletedIDs = /* @__PURE__ */ new Set();
|
|
69009
|
-
}
|
|
69010
|
-
replaceID({ from, to }) {
|
|
69011
|
-
this.fields[to] = this.fields[from];
|
|
69012
|
-
this.links[to] = this.links[from];
|
|
69013
|
-
this.operations[to] = this.operations[from] || { fields: {} };
|
|
69014
|
-
if (this.deletedIDs.has(from)) {
|
|
69015
|
-
this.deletedIDs.add(to);
|
|
69016
|
-
}
|
|
69017
|
-
}
|
|
69018
|
-
removeUndefinedFields() {
|
|
69019
|
-
for (const [id, fields] of Object.entries(this.fields)) {
|
|
69020
|
-
for (const [field, value] of Object.entries(fields)) {
|
|
69021
|
-
if (typeof value === "undefined") {
|
|
69022
|
-
try {
|
|
69023
|
-
delete this.fields[id][field];
|
|
69024
|
-
} catch {
|
|
69025
|
-
}
|
|
69026
|
-
try {
|
|
69027
|
-
delete this.links[id][field];
|
|
69028
|
-
} catch {
|
|
69029
|
-
}
|
|
69030
|
-
}
|
|
69031
|
-
}
|
|
69032
|
-
if (Object.keys(fields || {}).length === 0) {
|
|
69033
|
-
delete this.fields[id];
|
|
69034
|
-
}
|
|
69035
|
-
if (Object.keys(this.links[id] || {}).length === 0) {
|
|
69036
|
-
delete this.links[id];
|
|
69037
|
-
}
|
|
69038
|
-
}
|
|
69039
|
-
}
|
|
69040
|
-
delete(id) {
|
|
69041
|
-
this.operations = {
|
|
69042
|
-
...this.operations,
|
|
69043
|
-
[id]: {
|
|
69044
|
-
...this.operations[id],
|
|
69045
|
-
deleted: true,
|
|
69046
|
-
undoDeletesInList: []
|
|
69047
|
-
}
|
|
69048
|
-
};
|
|
69049
|
-
this.deletedIDs.add(id);
|
|
69050
|
-
}
|
|
69051
|
-
deleteField(id, field) {
|
|
69052
|
-
this.fields[id] = {
|
|
69053
|
-
...this.fields[id],
|
|
69054
|
-
[field]: void 0
|
|
69055
|
-
};
|
|
69056
|
-
}
|
|
69057
|
-
insert(id, field, where, target) {
|
|
69058
|
-
this.addFieldOperation(id, field, {
|
|
69059
|
-
kind: OperationKind.insert,
|
|
69060
|
-
id: target,
|
|
69061
|
-
location: where
|
|
69062
|
-
});
|
|
69063
|
-
}
|
|
69064
|
-
remove(id, field, target) {
|
|
69065
|
-
this.addFieldOperation(id, field, {
|
|
69066
|
-
kind: OperationKind.remove,
|
|
69067
|
-
id: target
|
|
69068
|
-
});
|
|
69069
|
-
}
|
|
69070
|
-
writeLayer(layer) {
|
|
69071
|
-
if (layer.id === this.id) {
|
|
69072
|
-
return;
|
|
69073
|
-
}
|
|
69074
|
-
for (const [id, ops] of Object.entries(layer.operations)) {
|
|
69075
|
-
const fields = {};
|
|
69076
|
-
for (const opMap of [this.operations[id], layer.operations[id]].filter(Boolean)) {
|
|
69077
|
-
for (const [fieldName, operations] of Object.entries(opMap.fields || {})) {
|
|
69078
|
-
fields[fieldName] = [...fields[fieldName] || [], ...operations];
|
|
69079
|
-
}
|
|
69080
|
-
}
|
|
69081
|
-
if (Object.keys(fields).length > 0) {
|
|
69082
|
-
this.operations[id] = {
|
|
69083
|
-
...this.operations[id],
|
|
69084
|
-
fields
|
|
69085
|
-
};
|
|
69086
|
-
}
|
|
69087
|
-
if (ops?.deleted) {
|
|
69088
|
-
delete this.fields[id];
|
|
69089
|
-
delete this.links[id];
|
|
69090
|
-
}
|
|
69091
|
-
}
|
|
69092
|
-
for (const [id, values] of Object.entries(layer.fields)) {
|
|
69093
|
-
if (!values) {
|
|
69094
|
-
continue;
|
|
69095
|
-
}
|
|
69096
|
-
for (const [field, value] of Object.entries(values)) {
|
|
69097
|
-
this.writeField(id, field, value);
|
|
69098
|
-
}
|
|
69099
|
-
}
|
|
69100
|
-
for (const [id, values] of Object.entries(layer.links)) {
|
|
69101
|
-
if (!values) {
|
|
69102
|
-
continue;
|
|
69103
|
-
}
|
|
69104
|
-
for (const [field, value] of Object.entries(values)) {
|
|
69105
|
-
this.writeLink(id, field, value);
|
|
69106
|
-
}
|
|
69107
|
-
}
|
|
69108
|
-
layer.deletedIDs.forEach((v) => this.deletedIDs.add(v));
|
|
69109
|
-
}
|
|
69110
|
-
addFieldOperation(id, field, operation) {
|
|
69111
|
-
this.operations = {
|
|
69112
|
-
...this.operations,
|
|
69113
|
-
[id]: {
|
|
69114
|
-
...this.operations[id],
|
|
69115
|
-
fields: {
|
|
69116
|
-
[field]: [...this.operations[id]?.fields[field] || [], operation]
|
|
69117
|
-
}
|
|
69118
|
-
}
|
|
69119
|
-
};
|
|
69120
|
-
}
|
|
69121
|
-
};
|
|
69122
|
-
function isDeleteOperation(value) {
|
|
69123
|
-
return !!value && value.kind === OperationKind.delete;
|
|
69124
|
-
}
|
|
69125
|
-
function isInsertOperation(value) {
|
|
69126
|
-
return !!value && value.kind === OperationKind.insert;
|
|
69127
|
-
}
|
|
69128
|
-
function isRemoveOperation(value) {
|
|
69129
|
-
return !!value && value.kind === OperationKind.remove;
|
|
69130
|
-
}
|
|
69131
|
-
var OperationLocation = /* @__PURE__ */ ((OperationLocation2) => {
|
|
69132
|
-
OperationLocation2["start"] = "start";
|
|
69133
|
-
OperationLocation2["end"] = "end";
|
|
69134
|
-
return OperationLocation2;
|
|
69135
|
-
})(OperationLocation || {});
|
|
69136
|
-
var OperationKind = /* @__PURE__ */ ((OperationKind2) => {
|
|
69137
|
-
OperationKind2["delete"] = "delete";
|
|
69138
|
-
OperationKind2["insert"] = "insert";
|
|
69139
|
-
OperationKind2["remove"] = "remove";
|
|
69140
|
-
return OperationKind2;
|
|
69141
|
-
})(OperationKind || {});
|
|
69142
|
-
|
|
69143
|
-
// src/runtime/cache/subscription.ts
|
|
69144
|
-
var InMemorySubscriptions = class {
|
|
69145
|
-
cache;
|
|
69146
|
-
constructor(cache) {
|
|
69147
|
-
this.cache = cache;
|
|
69148
|
-
}
|
|
69149
|
-
subscribers = {};
|
|
69150
|
-
referenceCounts = {};
|
|
69151
|
-
keyVersions = {};
|
|
69152
|
-
add({
|
|
69153
|
-
parent,
|
|
69154
|
-
spec,
|
|
69155
|
-
selection: selection2,
|
|
69156
|
-
variables,
|
|
69157
|
-
parentType
|
|
69158
|
-
}) {
|
|
69159
|
-
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
69160
|
-
let targetSelection = getFieldsForType(selection2, __typename);
|
|
69161
|
-
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
69162
|
-
const { keyRaw, selection: innerSelection, type } = fieldSelection;
|
|
69163
|
-
const key = evaluateKey(keyRaw, variables);
|
|
69164
|
-
this.addFieldSubscription({
|
|
69165
|
-
id: parent,
|
|
69166
|
-
key,
|
|
69167
|
-
field: fieldSelection,
|
|
69168
|
-
spec,
|
|
69169
|
-
parentType: parentType || spec.rootType,
|
|
69170
|
-
variables
|
|
69171
|
-
});
|
|
69172
|
-
if (innerSelection) {
|
|
69173
|
-
const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
|
|
69174
|
-
parent,
|
|
69175
|
-
key
|
|
69176
|
-
);
|
|
69177
|
-
let children = !Array.isArray(linkedRecord) ? [linkedRecord] : flattenList(linkedRecord) || [];
|
|
69178
|
-
for (const child of children) {
|
|
69179
|
-
if (!child) {
|
|
69180
|
-
continue;
|
|
69181
|
-
}
|
|
69182
|
-
this.add({
|
|
69183
|
-
parent: child,
|
|
69184
|
-
spec,
|
|
69185
|
-
selection: innerSelection,
|
|
69186
|
-
variables,
|
|
69187
|
-
parentType: type
|
|
69188
|
-
});
|
|
69189
|
-
}
|
|
69190
|
-
}
|
|
69191
|
-
}
|
|
69192
|
-
}
|
|
69193
|
-
addFieldSubscription({
|
|
69194
|
-
id,
|
|
69195
|
-
key,
|
|
69196
|
-
field,
|
|
69197
|
-
spec,
|
|
69198
|
-
parentType,
|
|
69199
|
-
variables
|
|
69200
|
-
}) {
|
|
69201
|
-
if (!this.subscribers[id]) {
|
|
69202
|
-
this.subscribers[id] = {};
|
|
69203
|
-
}
|
|
69204
|
-
if (!this.subscribers[id][key]) {
|
|
69205
|
-
this.subscribers[id][key] = [];
|
|
69206
|
-
}
|
|
69207
|
-
if (!this.keyVersions[key]) {
|
|
69208
|
-
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
69209
|
-
}
|
|
69210
|
-
this.keyVersions[key].add(key);
|
|
69211
|
-
if (!this.subscribers[id][key].map(({ set }) => set).includes(spec.set)) {
|
|
69212
|
-
this.subscribers[id][key].push(spec);
|
|
69213
|
-
}
|
|
69214
|
-
if (!this.referenceCounts[id]) {
|
|
69215
|
-
this.referenceCounts[id] = {};
|
|
69216
|
-
}
|
|
69217
|
-
if (!this.referenceCounts[id][key]) {
|
|
69218
|
-
this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
|
|
69219
|
-
}
|
|
69220
|
-
const counts = this.referenceCounts[id][key];
|
|
69221
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
69222
|
-
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
69223
|
-
const { selection: selection2, list, filters } = field;
|
|
69224
|
-
if (selection2 && list) {
|
|
69225
|
-
this.cache._internal_unstable.lists.add({
|
|
69226
|
-
name: list.name,
|
|
69227
|
-
connection: list.connection,
|
|
69228
|
-
recordID: id,
|
|
69229
|
-
recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
|
|
69230
|
-
listType: list.type,
|
|
69231
|
-
key,
|
|
69232
|
-
selection: selection2,
|
|
69233
|
-
filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
|
|
69234
|
-
return {
|
|
69235
|
-
...acc,
|
|
69236
|
-
[key2]: kind !== "Variable" ? value : variables[value]
|
|
69237
|
-
};
|
|
69238
|
-
}, {})
|
|
69239
|
-
});
|
|
69240
|
-
}
|
|
69241
|
-
}
|
|
69242
|
-
addMany({
|
|
69243
|
-
parent,
|
|
69244
|
-
selection: selection2,
|
|
69245
|
-
variables,
|
|
69246
|
-
subscribers,
|
|
69247
|
-
parentType
|
|
69248
|
-
}) {
|
|
69249
|
-
let targetSelection = getFieldsForType(selection2, parentType);
|
|
69250
|
-
for (const fieldSelection of Object.values(targetSelection)) {
|
|
69251
|
-
const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
|
|
69252
|
-
const key = evaluateKey(keyRaw, variables);
|
|
69253
|
-
for (const spec of subscribers) {
|
|
69254
|
-
this.addFieldSubscription({
|
|
69255
|
-
id: parent,
|
|
69256
|
-
key,
|
|
69257
|
-
field: fieldSelection,
|
|
69258
|
-
spec,
|
|
69259
|
-
parentType,
|
|
69260
|
-
variables
|
|
69261
|
-
});
|
|
69262
|
-
}
|
|
69263
|
-
if (innerSelection) {
|
|
69264
|
-
const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
|
|
69265
|
-
const children = !Array.isArray(link) ? [link] : flattenList(link);
|
|
69266
|
-
for (const linkedRecord of children) {
|
|
69267
|
-
if (!linkedRecord) {
|
|
69268
|
-
continue;
|
|
69269
|
-
}
|
|
69270
|
-
this.addMany({
|
|
69271
|
-
parent: linkedRecord,
|
|
69272
|
-
selection: innerSelection,
|
|
69273
|
-
variables,
|
|
69274
|
-
subscribers,
|
|
69275
|
-
parentType: linkedType
|
|
69276
|
-
});
|
|
69277
|
-
}
|
|
69278
|
-
}
|
|
69279
|
-
}
|
|
69280
|
-
}
|
|
69281
|
-
get(id, field) {
|
|
69282
|
-
return this.subscribers[id]?.[field] || [];
|
|
69283
|
-
}
|
|
69284
|
-
remove(id, selection2, targets, variables, visited = []) {
|
|
69285
|
-
visited.push(id);
|
|
69286
|
-
const linkedIDs = [];
|
|
69287
|
-
for (const fieldSelection of Object.values(selection2.fields || {})) {
|
|
69288
|
-
const key = evaluateKey(fieldSelection.keyRaw, variables);
|
|
69289
|
-
this.removeSubscribers(id, key, targets);
|
|
69290
|
-
if (!fieldSelection.selection?.fields) {
|
|
69291
|
-
continue;
|
|
69292
|
-
}
|
|
69293
|
-
const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
|
|
69294
|
-
const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
|
|
69295
|
-
for (const link of links) {
|
|
69296
|
-
if (link !== null) {
|
|
69297
|
-
linkedIDs.push([link, fieldSelection.selection || {}]);
|
|
69298
|
-
}
|
|
69299
|
-
}
|
|
69300
|
-
}
|
|
69301
|
-
for (const [linkedRecordID, linkFields] of linkedIDs) {
|
|
69302
|
-
this.remove(linkedRecordID, linkFields, targets, visited);
|
|
69303
|
-
}
|
|
69304
|
-
}
|
|
69305
|
-
removeSubscribers(id, fieldName, specs) {
|
|
69306
|
-
let targets = [];
|
|
69307
|
-
for (const spec of specs) {
|
|
69308
|
-
if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
|
|
69309
|
-
continue;
|
|
69310
|
-
}
|
|
69311
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
69312
|
-
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
69313
|
-
counts.set(spec.set, newVal);
|
|
69314
|
-
if (newVal <= 0) {
|
|
69315
|
-
targets.push(spec.set);
|
|
69316
|
-
counts.delete(spec.set);
|
|
69317
|
-
}
|
|
69318
|
-
}
|
|
69319
|
-
if (this.subscribers[id]) {
|
|
69320
|
-
this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
|
|
69321
|
-
({ set }) => !targets.includes(set)
|
|
69322
|
-
);
|
|
69323
|
-
}
|
|
69324
|
-
}
|
|
69325
|
-
removeAllSubscribers(id, targets, visited = []) {
|
|
69326
|
-
visited.push(id);
|
|
69327
|
-
for (const field of Object.keys(this.subscribers[id] || [])) {
|
|
69328
|
-
const subscribers = targets || this.subscribers[id][field];
|
|
69329
|
-
this.removeSubscribers(id, field, subscribers);
|
|
69330
|
-
const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
|
|
69331
|
-
if (kind === "scalar") {
|
|
69332
|
-
continue;
|
|
69333
|
-
}
|
|
69334
|
-
const nextTargets = Array.isArray(value) ? flattenList(value) : [value];
|
|
69335
|
-
for (const id2 of nextTargets) {
|
|
69336
|
-
if (visited.includes(id2)) {
|
|
69337
|
-
continue;
|
|
69338
|
-
}
|
|
69339
|
-
this.removeAllSubscribers(id2, subscribers, visited);
|
|
69340
|
-
}
|
|
69341
|
-
}
|
|
69342
|
-
}
|
|
69343
|
-
};
|
|
69344
|
-
|
|
69345
|
-
// src/runtime/cache/cache.ts
|
|
69346
|
-
var Cache3 = class {
|
|
69347
|
-
_internal_unstable;
|
|
69348
|
-
constructor(config2) {
|
|
69349
|
-
this._internal_unstable = new CacheInternal({
|
|
69350
|
-
cache: this,
|
|
69351
|
-
storage: new InMemoryStorage(),
|
|
69352
|
-
subscriptions: new InMemorySubscriptions(this),
|
|
69353
|
-
lists: new ListManager(this, rootID),
|
|
69354
|
-
lifetimes: new GarbageCollector(this),
|
|
69355
|
-
schema: new SchemaManager(this)
|
|
69356
|
-
});
|
|
69357
|
-
if (config2) {
|
|
69358
|
-
this.setConfig(defaultConfigValues(config2));
|
|
69359
|
-
}
|
|
69360
|
-
}
|
|
69361
|
-
write({
|
|
69362
|
-
layer: layerID,
|
|
69363
|
-
notifySubscribers = [],
|
|
69364
|
-
...args
|
|
69365
|
-
}) {
|
|
69366
|
-
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
69367
|
-
const subscribers = this._internal_unstable.writeSelection({ ...args, layer });
|
|
69368
|
-
const notified = [];
|
|
69369
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
69370
|
-
if (!notified.includes(spec.set)) {
|
|
69371
|
-
notified.push(spec.set);
|
|
69372
|
-
spec.set(
|
|
69373
|
-
this._internal_unstable.getSelection({
|
|
69374
|
-
parent: spec.parentID || rootID,
|
|
69375
|
-
selection: spec.selection,
|
|
69376
|
-
variables: spec.variables?.() || {}
|
|
69377
|
-
}).data
|
|
69378
|
-
);
|
|
69379
|
-
}
|
|
69380
|
-
}
|
|
69381
|
-
return subscribers;
|
|
69382
|
-
}
|
|
69383
|
-
read(...args) {
|
|
69384
|
-
const { data, partial, hasData } = this._internal_unstable.getSelection(...args);
|
|
69385
|
-
if (!hasData) {
|
|
69386
|
-
return { data: null, partial: false };
|
|
69387
|
-
}
|
|
69388
|
-
return {
|
|
69389
|
-
data,
|
|
69390
|
-
partial
|
|
69391
|
-
};
|
|
69392
|
-
}
|
|
69393
|
-
subscribe(spec, variables = {}) {
|
|
69394
|
-
return this._internal_unstable.subscriptions.add({
|
|
69395
|
-
parent: spec.parentID || rootID,
|
|
69396
|
-
spec,
|
|
69397
|
-
selection: spec.selection,
|
|
69398
|
-
variables
|
|
69399
|
-
});
|
|
69400
|
-
}
|
|
69401
|
-
unsubscribe(spec, variables = {}) {
|
|
69402
|
-
return this._internal_unstable.subscriptions.remove(
|
|
69403
|
-
spec.parentID || rootID,
|
|
69404
|
-
spec.selection,
|
|
69405
|
-
[spec],
|
|
69406
|
-
variables
|
|
69407
|
-
);
|
|
69408
|
-
}
|
|
69409
|
-
list(name2, parentID, allLists) {
|
|
69410
|
-
const handler = this._internal_unstable.lists.get(name2, parentID, allLists);
|
|
69411
|
-
if (!handler) {
|
|
69412
|
-
throw new Error(
|
|
69413
|
-
`Cannot find list with name: ${name2}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
|
|
69414
|
-
);
|
|
69415
|
-
}
|
|
69416
|
-
return handler;
|
|
69417
|
-
}
|
|
69418
|
-
delete(id) {
|
|
69419
|
-
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
69420
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
69421
|
-
this._internal_unstable.storage.delete(id);
|
|
69422
|
-
}
|
|
69423
|
-
setConfig(config2) {
|
|
69424
|
-
this._internal_unstable.setConfig(config2);
|
|
69425
|
-
}
|
|
69426
|
-
};
|
|
69427
|
-
var CacheInternal = class {
|
|
69428
|
-
_disabled = false;
|
|
69429
|
-
config = defaultConfigValues({
|
|
69430
|
-
plugins: {
|
|
69431
|
-
"houdini-svelte": {
|
|
69432
|
-
client: ""
|
|
69433
|
-
}
|
|
69434
|
-
}
|
|
69435
|
-
});
|
|
69436
|
-
storage;
|
|
69437
|
-
subscriptions;
|
|
69438
|
-
lists;
|
|
69439
|
-
cache;
|
|
69440
|
-
lifetimes;
|
|
69441
|
-
schema;
|
|
69442
|
-
constructor({
|
|
69443
|
-
storage,
|
|
69444
|
-
subscriptions,
|
|
69445
|
-
lists,
|
|
69446
|
-
cache,
|
|
69447
|
-
lifetimes,
|
|
69448
|
-
schema
|
|
69449
|
-
}) {
|
|
69450
|
-
this.storage = storage;
|
|
69451
|
-
this.subscriptions = subscriptions;
|
|
69452
|
-
this.lists = lists;
|
|
69453
|
-
this.cache = cache;
|
|
69454
|
-
this.lifetimes = lifetimes;
|
|
69455
|
-
this.schema = schema;
|
|
69456
|
-
this._disabled = typeof globalThis.window === "undefined";
|
|
69457
|
-
try {
|
|
69458
|
-
if (process.env.HOUDINI_TEST === "true") {
|
|
69459
|
-
this._disabled = false;
|
|
69460
|
-
}
|
|
69461
|
-
} catch {
|
|
69462
|
-
}
|
|
69463
|
-
}
|
|
69464
|
-
setConfig(config2) {
|
|
69465
|
-
this.config = config2;
|
|
69466
|
-
}
|
|
69467
|
-
writeSelection({
|
|
69468
|
-
data,
|
|
69469
|
-
selection: selection2,
|
|
69470
|
-
variables = {},
|
|
69471
|
-
parent = rootID,
|
|
69472
|
-
applyUpdates = false,
|
|
69473
|
-
layer,
|
|
69474
|
-
toNotify = [],
|
|
69475
|
-
forceNotify
|
|
69476
|
-
}) {
|
|
69477
|
-
if (this._disabled) {
|
|
69478
|
-
return [];
|
|
69479
|
-
}
|
|
69480
|
-
let targetSelection = getFieldsForType(selection2, data["__typename"]);
|
|
69481
|
-
for (const [field, value] of Object.entries(data)) {
|
|
69482
|
-
if (!selection2 || !targetSelection[field]) {
|
|
69483
|
-
throw new Error(
|
|
69484
|
-
"Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
|
|
69485
|
-
);
|
|
69486
|
-
}
|
|
69487
|
-
let {
|
|
69488
|
-
type: linkedType,
|
|
69489
|
-
keyRaw,
|
|
69490
|
-
selection: fieldSelection,
|
|
69491
|
-
operations,
|
|
69492
|
-
abstract: isAbstract,
|
|
69493
|
-
update,
|
|
69494
|
-
nullable
|
|
69495
|
-
} = targetSelection[field];
|
|
69496
|
-
const key = evaluateKey(keyRaw, variables);
|
|
69497
|
-
this.schema.setFieldType({
|
|
69498
|
-
parent,
|
|
69499
|
-
key: keyRaw,
|
|
69500
|
-
type: linkedType,
|
|
69501
|
-
nullable,
|
|
69502
|
-
link: !!fieldSelection
|
|
69503
|
-
});
|
|
69504
|
-
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
69505
|
-
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
69506
|
-
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
69507
|
-
if (displayLayer) {
|
|
69508
|
-
this.lifetimes.resetLifetime(parent, key);
|
|
69509
|
-
}
|
|
69510
|
-
if (!fieldSelection) {
|
|
69511
|
-
let newValue = value;
|
|
69512
|
-
if (Array.isArray(value) && applyUpdates && update) {
|
|
69513
|
-
if (update === "append") {
|
|
69514
|
-
newValue = (previousValue || []).concat(value);
|
|
69515
|
-
} else if (update === "prepend") {
|
|
69516
|
-
newValue = value.concat(previousValue || []);
|
|
69517
|
-
}
|
|
69518
|
-
}
|
|
69519
|
-
const valueChanged = !deepEquals(newValue, previousValue);
|
|
69520
|
-
if (displayLayer && (valueChanged || forceNotify)) {
|
|
69521
|
-
toNotify.push(...currentSubscribers);
|
|
69522
|
-
}
|
|
69523
|
-
layer.writeField(parent, key, newValue);
|
|
69524
|
-
} else if (value === null) {
|
|
69525
|
-
if (previousValue === null) {
|
|
69526
|
-
continue;
|
|
69527
|
-
}
|
|
69528
|
-
const previousLinks = flattenList([previousValue]);
|
|
69529
|
-
for (const link of previousLinks) {
|
|
69530
|
-
this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
|
|
69531
|
-
}
|
|
69532
|
-
layer.writeLink(parent, key, null);
|
|
69533
|
-
toNotify.push(...currentSubscribers);
|
|
69534
|
-
} else if (value instanceof Object && !Array.isArray(value)) {
|
|
69535
|
-
if (isAbstract) {
|
|
69536
|
-
if (!value.__typename) {
|
|
69537
|
-
throw new Error(
|
|
69538
|
-
"Encountered interface type without __typename in the payload"
|
|
69539
|
-
);
|
|
69540
|
-
}
|
|
69541
|
-
linkedType = value.__typename;
|
|
69542
|
-
}
|
|
69543
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
69544
|
-
(field2) => typeof value[field2] === "undefined"
|
|
69545
|
-
).length > 0;
|
|
69546
|
-
let linkedID = null;
|
|
69547
|
-
if (value !== null) {
|
|
69548
|
-
linkedID = !embedded ? this.id(linkedType, value) : `${parent}.${key}`;
|
|
69549
|
-
}
|
|
69550
|
-
let linkChange = linkedID !== previousValue;
|
|
69551
|
-
layer.writeLink(parent, key, linkedID);
|
|
69552
|
-
if (linkedID && displayLayer && (linkChange || forceNotify)) {
|
|
69553
|
-
if (previousValue && typeof previousValue === "string") {
|
|
69554
|
-
this.subscriptions.remove(
|
|
69555
|
-
previousValue,
|
|
69556
|
-
fieldSelection,
|
|
69557
|
-
currentSubscribers,
|
|
69558
|
-
variables
|
|
69559
|
-
);
|
|
69560
|
-
}
|
|
69561
|
-
this.subscriptions.addMany({
|
|
69562
|
-
parent: linkedID,
|
|
69563
|
-
selection: fieldSelection,
|
|
69564
|
-
subscribers: currentSubscribers,
|
|
69565
|
-
variables,
|
|
69566
|
-
parentType: linkedType
|
|
69567
|
-
});
|
|
69568
|
-
toNotify.push(...currentSubscribers);
|
|
69569
|
-
}
|
|
69570
|
-
if (linkedID) {
|
|
69571
|
-
this.writeSelection({
|
|
69572
|
-
selection: fieldSelection,
|
|
69573
|
-
parent: linkedID,
|
|
69574
|
-
data: value,
|
|
69575
|
-
variables,
|
|
69576
|
-
toNotify,
|
|
69577
|
-
applyUpdates,
|
|
69578
|
-
layer,
|
|
69579
|
-
forceNotify
|
|
69580
|
-
});
|
|
69581
|
-
}
|
|
69582
|
-
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
|
|
69583
|
-
let oldIDs = [...previousValue || []];
|
|
69584
|
-
const emptyEdges = !update ? [] : oldIDs.map((id) => {
|
|
69585
|
-
if (!id) {
|
|
69586
|
-
return "";
|
|
69587
|
-
}
|
|
69588
|
-
const { value: cursorField } = this.storage.get(id, "cursor");
|
|
69589
|
-
if (cursorField) {
|
|
69590
|
-
return "";
|
|
69591
|
-
}
|
|
69592
|
-
const { value: node } = this.storage.get(id, "node");
|
|
69593
|
-
if (!node) {
|
|
69594
|
-
return "";
|
|
69595
|
-
}
|
|
69596
|
-
return node;
|
|
69597
|
-
});
|
|
69598
|
-
let linkedIDs = [];
|
|
69599
|
-
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
69600
|
-
value,
|
|
69601
|
-
abstract: Boolean(isAbstract),
|
|
69602
|
-
specs: toNotify,
|
|
69603
|
-
applyUpdates,
|
|
69604
|
-
recordID: parent,
|
|
69605
|
-
key,
|
|
69606
|
-
linkedType,
|
|
69607
|
-
variables,
|
|
69608
|
-
fields: fieldSelection,
|
|
69609
|
-
layer,
|
|
69610
|
-
forceNotify
|
|
69611
|
-
});
|
|
69612
|
-
if (applyUpdates && update) {
|
|
69613
|
-
if (key === "edges") {
|
|
69614
|
-
const newNodeIDs = [];
|
|
69615
|
-
for (const id of newIDs) {
|
|
69616
|
-
if (!id) {
|
|
69617
|
-
continue;
|
|
69618
|
-
}
|
|
69619
|
-
const { value: node } = this.storage.get(id, "node");
|
|
69620
|
-
if (typeof node !== "string") {
|
|
69621
|
-
continue;
|
|
69622
|
-
}
|
|
69623
|
-
if (!node || !this.storage.get(node, "__typename")) {
|
|
69624
|
-
continue;
|
|
69625
|
-
}
|
|
69626
|
-
newNodeIDs.push(node);
|
|
69627
|
-
}
|
|
69628
|
-
oldIDs = oldIDs.filter((id) => {
|
|
69629
|
-
if (!id) {
|
|
69630
|
-
return true;
|
|
69631
|
-
}
|
|
69632
|
-
const { value: value2 } = this.storage.get(id, "node");
|
|
69633
|
-
const node = value2;
|
|
69634
|
-
if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
|
|
69635
|
-
return false;
|
|
69636
|
-
}
|
|
69637
|
-
return true;
|
|
69638
|
-
});
|
|
69639
|
-
}
|
|
69640
|
-
if (update === "prepend") {
|
|
69641
|
-
linkedIDs = newIDs.concat(oldIDs);
|
|
69642
|
-
} else if (update === "append") {
|
|
69643
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
69644
|
-
} else if (update === "replace") {
|
|
69645
|
-
linkedIDs = newIDs;
|
|
69646
|
-
}
|
|
69647
|
-
} else {
|
|
69648
|
-
linkedIDs = nestedIDs;
|
|
69649
|
-
}
|
|
69650
|
-
const contentChanged = !deepEquals(linkedIDs, oldIDs);
|
|
69651
|
-
if (contentChanged || forceNotify) {
|
|
69652
|
-
toNotify.push(...currentSubscribers);
|
|
69653
|
-
}
|
|
69654
|
-
for (const lostID of oldIDs) {
|
|
69655
|
-
if (linkedIDs.includes(lostID) || !lostID) {
|
|
69656
|
-
continue;
|
|
69657
|
-
}
|
|
69658
|
-
this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
|
|
69659
|
-
}
|
|
69660
|
-
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
69661
|
-
layer.writeLink(parent, key, linkedIDs);
|
|
69662
|
-
}
|
|
69663
|
-
for (const id of newIDs.filter((id2) => !oldIDs.includes(id2))) {
|
|
69664
|
-
if (id == null) {
|
|
69665
|
-
continue;
|
|
69666
|
-
}
|
|
69667
|
-
this.subscriptions.addMany({
|
|
69668
|
-
parent: id,
|
|
69669
|
-
selection: fieldSelection,
|
|
69670
|
-
subscribers: currentSubscribers,
|
|
69671
|
-
variables,
|
|
69672
|
-
parentType: linkedType
|
|
69673
|
-
});
|
|
69674
|
-
}
|
|
69675
|
-
}
|
|
69676
|
-
for (const operation of operations || []) {
|
|
69677
|
-
let parentID;
|
|
69678
|
-
if (operation.parentID) {
|
|
69679
|
-
if (operation.parentID.kind !== "Variable") {
|
|
69680
|
-
parentID = operation.parentID.value;
|
|
69681
|
-
} else {
|
|
69682
|
-
const id = variables[operation.parentID.value];
|
|
69683
|
-
if (typeof id !== "string") {
|
|
69684
|
-
throw new Error("parentID value must be a string");
|
|
69685
|
-
}
|
|
69686
|
-
parentID = id;
|
|
69687
|
-
}
|
|
69688
|
-
}
|
|
69689
|
-
if (operation.list && !this.lists.get(operation.list, parentID, operation.target === "all")) {
|
|
69690
|
-
continue;
|
|
69691
|
-
}
|
|
69692
|
-
const targets = Array.isArray(value) ? value : [value];
|
|
69693
|
-
for (const target of targets) {
|
|
69694
|
-
if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
|
|
69695
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
69696
|
-
fieldSelection,
|
|
69697
|
-
target,
|
|
69698
|
-
variables,
|
|
69699
|
-
operation.position || "last"
|
|
69700
|
-
);
|
|
69701
|
-
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
69702
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
69703
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
69704
|
-
if (typeof target !== "string") {
|
|
69705
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
69706
|
-
}
|
|
69707
|
-
const targetID = this.id(operation.type, target);
|
|
69708
|
-
if (!targetID) {
|
|
69709
|
-
continue;
|
|
69710
|
-
}
|
|
69711
|
-
this.cache.delete(targetID);
|
|
69712
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
69713
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
69714
|
-
fieldSelection,
|
|
69715
|
-
target,
|
|
69716
|
-
variables,
|
|
69717
|
-
operation.position || "last"
|
|
69718
|
-
);
|
|
69719
|
-
}
|
|
69720
|
-
}
|
|
69721
|
-
}
|
|
69722
|
-
}
|
|
69723
|
-
return toNotify;
|
|
69724
|
-
}
|
|
69725
|
-
getSelection({
|
|
69726
|
-
selection: selection2,
|
|
69727
|
-
parent = rootID,
|
|
69728
|
-
variables,
|
|
69729
|
-
stepsFromConnection = null
|
|
69730
|
-
}) {
|
|
69731
|
-
if (parent === null) {
|
|
69732
|
-
return { data: null, partial: false, hasData: true };
|
|
69733
|
-
}
|
|
69734
|
-
const target = {};
|
|
69735
|
-
let hasData = false;
|
|
69736
|
-
let partial = false;
|
|
69737
|
-
let cascadeNull = false;
|
|
69738
|
-
const typename = this.storage.get(parent, "__typename").value;
|
|
69739
|
-
let targetSelection = getFieldsForType(selection2, typename);
|
|
69740
|
-
for (const [
|
|
69741
|
-
attributeName,
|
|
69742
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list }
|
|
69743
|
-
] of Object.entries(targetSelection)) {
|
|
69744
|
-
const key = evaluateKey(keyRaw, variables);
|
|
69745
|
-
const { value } = this.storage.get(parent, key);
|
|
69746
|
-
let nextStep = stepsFromConnection;
|
|
69747
|
-
if (nextStep !== null) {
|
|
69748
|
-
if (nextStep >= 2) {
|
|
69749
|
-
nextStep = null;
|
|
69750
|
-
} else {
|
|
69751
|
-
nextStep += 1;
|
|
69752
|
-
}
|
|
69753
|
-
}
|
|
69754
|
-
if (list?.connection) {
|
|
69755
|
-
nextStep = 0;
|
|
69756
|
-
}
|
|
69757
|
-
const embeddedCursor = key === "cursor" && stepsFromConnection === 1;
|
|
69758
|
-
if (typeof value === "undefined" && !embeddedCursor) {
|
|
69759
|
-
partial = true;
|
|
69760
|
-
}
|
|
69761
|
-
if (typeof value === "undefined" || value === null) {
|
|
69762
|
-
target[attributeName] = null;
|
|
69763
|
-
if (typeof value !== "undefined") {
|
|
69764
|
-
hasData = true;
|
|
69765
|
-
}
|
|
69766
|
-
} else if (!fieldSelection) {
|
|
69767
|
-
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
69768
|
-
if (fnUnmarshal) {
|
|
69769
|
-
target[attributeName] = fnUnmarshal(value);
|
|
69770
|
-
} else {
|
|
69771
|
-
target[attributeName] = value;
|
|
69772
|
-
}
|
|
69773
|
-
hasData = true;
|
|
69774
|
-
} else if (Array.isArray(value)) {
|
|
69775
|
-
const listValue = this.hydrateNestedList({
|
|
69776
|
-
fields: fieldSelection,
|
|
69777
|
-
variables,
|
|
69778
|
-
linkedList: value,
|
|
69779
|
-
stepsFromConnection: nextStep
|
|
69780
|
-
});
|
|
69781
|
-
target[attributeName] = listValue.data;
|
|
69782
|
-
if (listValue.partial) {
|
|
69783
|
-
partial = true;
|
|
69784
|
-
}
|
|
69785
|
-
if (listValue.hasData || value.length === 0) {
|
|
69786
|
-
hasData = true;
|
|
69787
|
-
}
|
|
69788
|
-
} else {
|
|
69789
|
-
const objectFields = this.getSelection({
|
|
69790
|
-
parent: value,
|
|
69791
|
-
selection: fieldSelection,
|
|
69792
|
-
variables,
|
|
69793
|
-
stepsFromConnection: nextStep
|
|
69794
|
-
});
|
|
69795
|
-
target[attributeName] = objectFields.data;
|
|
69796
|
-
if (objectFields.partial) {
|
|
69797
|
-
partial = true;
|
|
69798
|
-
}
|
|
69799
|
-
if (objectFields.hasData) {
|
|
69800
|
-
hasData = true;
|
|
69801
|
-
}
|
|
69802
|
-
}
|
|
69803
|
-
if (target[attributeName] === null && !nullable && !embeddedCursor) {
|
|
69804
|
-
cascadeNull = true;
|
|
69805
|
-
}
|
|
69806
|
-
}
|
|
69807
|
-
return {
|
|
69808
|
-
data: cascadeNull ? null : target,
|
|
69809
|
-
partial: hasData && partial,
|
|
69810
|
-
hasData
|
|
69811
|
-
};
|
|
69812
|
-
}
|
|
69813
|
-
id(type, data) {
|
|
69814
|
-
const id = typeof data === "string" ? data : this.computeID(type, data);
|
|
69815
|
-
if (!id) {
|
|
69816
|
-
return null;
|
|
69817
|
-
}
|
|
69818
|
-
if (!type) {
|
|
69819
|
-
return id;
|
|
69820
|
-
}
|
|
69821
|
-
return type + ":" + id;
|
|
69822
|
-
}
|
|
69823
|
-
idFields(type) {
|
|
69824
|
-
return keyFieldsForType(this.config, type);
|
|
69825
|
-
}
|
|
69826
|
-
computeID(type, data) {
|
|
69827
|
-
return computeID(this.config, type, data);
|
|
69828
|
-
}
|
|
69829
|
-
hydrateNestedList({
|
|
69830
|
-
fields,
|
|
69831
|
-
variables,
|
|
69832
|
-
linkedList,
|
|
69833
|
-
stepsFromConnection
|
|
69834
|
-
}) {
|
|
69835
|
-
const result = [];
|
|
69836
|
-
let partialData = false;
|
|
69837
|
-
let hasValues = false;
|
|
69838
|
-
for (const entry of linkedList) {
|
|
69839
|
-
if (Array.isArray(entry)) {
|
|
69840
|
-
const nestedValue = this.hydrateNestedList({
|
|
69841
|
-
fields,
|
|
69842
|
-
variables,
|
|
69843
|
-
linkedList: entry,
|
|
69844
|
-
stepsFromConnection
|
|
69845
|
-
});
|
|
69846
|
-
result.push(nestedValue.data);
|
|
69847
|
-
if (nestedValue.partial) {
|
|
69848
|
-
partialData = true;
|
|
69849
|
-
}
|
|
69850
|
-
continue;
|
|
69851
|
-
}
|
|
69852
|
-
if (entry === null) {
|
|
69853
|
-
result.push(entry);
|
|
69854
|
-
continue;
|
|
69855
|
-
}
|
|
69856
|
-
const { data, partial, hasData } = this.getSelection({
|
|
69857
|
-
parent: entry,
|
|
69858
|
-
selection: fields,
|
|
69859
|
-
variables,
|
|
69860
|
-
stepsFromConnection
|
|
69861
|
-
});
|
|
69862
|
-
result.push(data);
|
|
69863
|
-
if (partial) {
|
|
69864
|
-
partialData = true;
|
|
69865
|
-
}
|
|
69866
|
-
if (hasData) {
|
|
69867
|
-
hasValues = true;
|
|
69868
|
-
}
|
|
69869
|
-
}
|
|
69870
|
-
return {
|
|
69871
|
-
data: result,
|
|
69872
|
-
partial: partialData,
|
|
69873
|
-
hasData: hasValues
|
|
69874
|
-
};
|
|
69875
|
-
}
|
|
69876
|
-
extractNestedListIDs({
|
|
69877
|
-
value,
|
|
69878
|
-
abstract,
|
|
69879
|
-
recordID,
|
|
69880
|
-
key,
|
|
69881
|
-
linkedType,
|
|
69882
|
-
fields,
|
|
69883
|
-
variables,
|
|
69884
|
-
applyUpdates,
|
|
69885
|
-
specs,
|
|
69886
|
-
layer,
|
|
69887
|
-
forceNotify
|
|
69888
|
-
}) {
|
|
69889
|
-
const nestedIDs = [];
|
|
69890
|
-
const newIDs = [];
|
|
69891
|
-
for (const [i2, entry] of value.entries()) {
|
|
69892
|
-
if (Array.isArray(entry)) {
|
|
69893
|
-
const inner = this.extractNestedListIDs({
|
|
69894
|
-
value: entry,
|
|
69895
|
-
abstract,
|
|
69896
|
-
recordID,
|
|
69897
|
-
key,
|
|
69898
|
-
linkedType,
|
|
69899
|
-
fields,
|
|
69900
|
-
variables,
|
|
69901
|
-
applyUpdates,
|
|
69902
|
-
specs,
|
|
69903
|
-
layer,
|
|
69904
|
-
forceNotify
|
|
69905
|
-
});
|
|
69906
|
-
newIDs.push(...inner.newIDs);
|
|
69907
|
-
nestedIDs[i2] = inner.nestedIDs;
|
|
69908
|
-
continue;
|
|
69909
|
-
}
|
|
69910
|
-
if (entry === null || typeof entry === "undefined") {
|
|
69911
|
-
newIDs.push(null);
|
|
69912
|
-
nestedIDs[i2] = null;
|
|
69913
|
-
continue;
|
|
69914
|
-
}
|
|
69915
|
-
const entryObj = entry;
|
|
69916
|
-
let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
|
|
69917
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
69918
|
-
(field) => typeof entry[field] === "undefined"
|
|
69919
|
-
).length > 0;
|
|
69920
|
-
const typename = entryObj.__typename;
|
|
69921
|
-
let innerType = linkedType;
|
|
69922
|
-
if (abstract) {
|
|
69923
|
-
if (!typename) {
|
|
69924
|
-
throw new Error("Encountered interface type without __typename in the payload");
|
|
69925
|
-
}
|
|
69926
|
-
innerType = typename;
|
|
69927
|
-
}
|
|
69928
|
-
if (!embedded) {
|
|
69929
|
-
const id = this.id(innerType, entry);
|
|
69930
|
-
if (id) {
|
|
69931
|
-
linkedID = id;
|
|
69932
|
-
} else {
|
|
69933
|
-
continue;
|
|
69934
|
-
}
|
|
69935
|
-
}
|
|
69936
|
-
this.writeSelection({
|
|
69937
|
-
root: rootID,
|
|
69938
|
-
selection: fields,
|
|
69939
|
-
parent: linkedID,
|
|
69940
|
-
data: entryObj,
|
|
69941
|
-
variables,
|
|
69942
|
-
toNotify: specs,
|
|
69943
|
-
applyUpdates,
|
|
69944
|
-
layer,
|
|
69945
|
-
forceNotify
|
|
69946
|
-
});
|
|
69947
|
-
newIDs.push(linkedID);
|
|
69948
|
-
nestedIDs[i2] = linkedID;
|
|
69949
|
-
}
|
|
69950
|
-
return { newIDs, nestedIDs };
|
|
69951
|
-
}
|
|
69952
|
-
collectGarbage() {
|
|
69953
|
-
this.lifetimes.tick();
|
|
69954
|
-
if (this.storage.layerCount === 1) {
|
|
69955
|
-
this.storage.topLayer.removeUndefinedFields();
|
|
69956
|
-
}
|
|
69957
|
-
}
|
|
69958
|
-
};
|
|
69959
|
-
var rootID = "_ROOT_";
|
|
69960
|
-
|
|
69961
|
-
// src/runtime/cache/index.ts
|
|
69962
|
-
var cache_default = new Cache3();
|
|
69963
|
-
|
|
69964
68251
|
// src/runtime/lib/types.ts
|
|
69965
68252
|
var CompiledFragmentKind = "HoudiniFragment" /* Fragment */;
|
|
69966
68253
|
var CompiledMutationKind = "HoudiniMutation" /* Mutation */;
|
|
@@ -70258,7 +68545,7 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
70258
68545
|
const targetPath = join2(parentDir, child);
|
|
70259
68546
|
let original = await readFile(childPath) || "";
|
|
70260
68547
|
if (transforms?.[childPath]) {
|
|
70261
|
-
original = transforms[childPath](original);
|
|
68548
|
+
original = await transforms[childPath](original, childPath);
|
|
70262
68549
|
}
|
|
70263
68550
|
await writeFile(targetPath, original);
|
|
70264
68551
|
}
|
|
@@ -70394,7 +68681,7 @@ var Body = class {
|
|
|
70394
68681
|
} else if (ArrayBuffer.isView(body)) {
|
|
70395
68682
|
body = import_node_buffer.Buffer.from(body.buffer, body.byteOffset, body.byteLength);
|
|
70396
68683
|
} else if (body instanceof import_node_stream.default) {
|
|
70397
|
-
} else if (body instanceof
|
|
68684
|
+
} else if (body instanceof FormData) {
|
|
70398
68685
|
body = formDataToBlob(body);
|
|
70399
68686
|
boundary = body.type.split("=")[1];
|
|
70400
68687
|
} else {
|
|
@@ -70434,7 +68721,7 @@ var Body = class {
|
|
|
70434
68721
|
async formData() {
|
|
70435
68722
|
const ct = this.headers.get("content-type");
|
|
70436
68723
|
if (ct.startsWith("application/x-www-form-urlencoded")) {
|
|
70437
|
-
const formData = new
|
|
68724
|
+
const formData = new FormData();
|
|
70438
68725
|
const parameters = new URLSearchParams(await this.text());
|
|
70439
68726
|
for (const [name2, value] of parameters) {
|
|
70440
68727
|
formData.append(name2, value);
|
|
@@ -70560,7 +68847,7 @@ var extractContentType = (body, request) => {
|
|
|
70560
68847
|
if (import_node_buffer.Buffer.isBuffer(body) || import_node_util.types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
|
|
70561
68848
|
return null;
|
|
70562
68849
|
}
|
|
70563
|
-
if (body instanceof
|
|
68850
|
+
if (body instanceof FormData) {
|
|
70564
68851
|
return `multipart/form-data; boundary=${request[INTERNALS].boundary}`;
|
|
70565
68852
|
}
|
|
70566
68853
|
if (body && typeof body.getBoundary === "function") {
|
|
@@ -71820,8 +70107,11 @@ var Config = class {
|
|
|
71820
70107
|
pluginRuntimeDirectory(name2) {
|
|
71821
70108
|
return join2(this.pluginDirectory(name2), "runtime");
|
|
71822
70109
|
}
|
|
70110
|
+
get pluginRootDirectory() {
|
|
70111
|
+
return houdini_mode.is_testing ? "../../../" : join2(this.rootDir, "plugins");
|
|
70112
|
+
}
|
|
71823
70113
|
pluginDirectory(name2) {
|
|
71824
|
-
return
|
|
70114
|
+
return join2(this.pluginRootDirectory, name2);
|
|
71825
70115
|
}
|
|
71826
70116
|
get manualLoadDirective() {
|
|
71827
70117
|
return "manual_load";
|
|
@@ -71871,6 +70161,9 @@ var Config = class {
|
|
|
71871
70161
|
get whenNotDirective() {
|
|
71872
70162
|
return this.whenDirective + "_not";
|
|
71873
70163
|
}
|
|
70164
|
+
get liveDirective() {
|
|
70165
|
+
return "live";
|
|
70166
|
+
}
|
|
71874
70167
|
get argumentsDirective() {
|
|
71875
70168
|
return "arguments";
|
|
71876
70169
|
}
|
|
@@ -72066,7 +70359,9 @@ async function getConfig({
|
|
|
72066
70359
|
resolve2 = res;
|
|
72067
70360
|
reject = rej;
|
|
72068
70361
|
});
|
|
72069
|
-
let configFile =
|
|
70362
|
+
let configFile = {
|
|
70363
|
+
...await readConfigFile(configPath)
|
|
70364
|
+
};
|
|
72070
70365
|
if (!configFile.plugins) {
|
|
72071
70366
|
throw new HoudiniError({
|
|
72072
70367
|
message: "Welcome to 0.17.0! Please following the migration guide here: http://www.houdinigraphql.com/guides/release-notes#0170"
|
|
@@ -72121,13 +70416,14 @@ This will prevent your schema from being pulled.`
|
|
|
72121
70416
|
version = packageJSON.version;
|
|
72122
70417
|
} catch {
|
|
72123
70418
|
}
|
|
72124
|
-
|
|
72125
|
-
|
|
72126
|
-
|
|
72127
|
-
|
|
72128
|
-
|
|
72129
|
-
|
|
72130
|
-
|
|
70419
|
+
if (typeof plugin_config)
|
|
70420
|
+
plugins.push({
|
|
70421
|
+
...await pluginFactory(plugin_config),
|
|
70422
|
+
name: pluginName,
|
|
70423
|
+
include_runtime,
|
|
70424
|
+
version,
|
|
70425
|
+
directory: pluginDirectory
|
|
70426
|
+
});
|
|
72131
70427
|
} catch (e2) {
|
|
72132
70428
|
throw new Error(
|
|
72133
70429
|
`Could not find plugin: ${pluginName}. Are you sure its installed? If so, please open a ticket on GitHub.`
|
|
@@ -72565,7 +70861,7 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
72565
70861
|
}
|
|
72566
70862
|
|
|
72567
70863
|
// src/codegen/index.ts
|
|
72568
|
-
var
|
|
70864
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
72569
70865
|
|
|
72570
70866
|
// src/codegen/generators/artifacts/index.ts
|
|
72571
70867
|
var graphql13 = __toESM(require_graphql2(), 1);
|
|
@@ -72592,7 +70888,13 @@ function exportStarFrom(where) {
|
|
|
72592
70888
|
}
|
|
72593
70889
|
function exportDefaultFrom(where, as) {
|
|
72594
70890
|
return `var ${as} = require("${where}");
|
|
72595
|
-
|
|
70891
|
+
${exportDefault(as)}`;
|
|
70892
|
+
}
|
|
70893
|
+
function exportDefault(as) {
|
|
70894
|
+
return `Object.defineProperty(exports, "${as}", { enumerable: true, get: function () { return __importDefault(${as}).default; } });`;
|
|
70895
|
+
}
|
|
70896
|
+
function importDefaultFrom(where, as) {
|
|
70897
|
+
return `var ${as} = require("${where}")`;
|
|
72596
70898
|
}
|
|
72597
70899
|
|
|
72598
70900
|
// src/codegen/utils/flattenSelections.ts
|
|
@@ -72636,6 +70938,9 @@ var FieldCollection = class {
|
|
|
72636
70938
|
this.add(selection2);
|
|
72637
70939
|
}
|
|
72638
70940
|
}
|
|
70941
|
+
get size() {
|
|
70942
|
+
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
70943
|
+
}
|
|
72639
70944
|
add(selection2) {
|
|
72640
70945
|
if (selection2.kind === "Field") {
|
|
72641
70946
|
const key = selection2.alias?.value || selection2.name.value;
|
|
@@ -72704,9 +71009,12 @@ var FieldCollection = class {
|
|
|
72704
71009
|
}
|
|
72705
71010
|
}
|
|
72706
71011
|
toSelectionSet() {
|
|
72707
|
-
return Object.values(this.inlineFragments).
|
|
71012
|
+
return Object.values(this.inlineFragments).flatMap((fragment) => {
|
|
71013
|
+
if (fragment.selection.size === 0) {
|
|
71014
|
+
return [];
|
|
71015
|
+
}
|
|
72708
71016
|
fragment.astNode.selectionSet.selections = fragment.selection.toSelectionSet();
|
|
72709
|
-
return fragment.astNode;
|
|
71017
|
+
return [fragment.astNode];
|
|
72710
71018
|
}).concat(
|
|
72711
71019
|
Object.values(this.fields).map((field) => {
|
|
72712
71020
|
if (field.astNode.selectionSet) {
|
|
@@ -72889,7 +71197,7 @@ function serializeValue(value) {
|
|
|
72889
71197
|
if (typeof value === "object" && value !== null) {
|
|
72890
71198
|
return AST4.objectExpression(
|
|
72891
71199
|
Object.entries(value).filter(([, value2]) => typeof value2 !== "undefined").map(
|
|
72892
|
-
([key, value2]) => AST4.objectProperty(AST4.
|
|
71200
|
+
([key, value2]) => AST4.objectProperty(AST4.stringLiteral(key), serializeValue(value2))
|
|
72893
71201
|
)
|
|
72894
71202
|
);
|
|
72895
71203
|
}
|
|
@@ -74443,6 +72751,23 @@ function artifactGenerator(stats) {
|
|
|
74443
72751
|
document: doc
|
|
74444
72752
|
})
|
|
74445
72753
|
};
|
|
72754
|
+
const pluginsData = config2.plugins.reduce(
|
|
72755
|
+
(prev, plugin) => {
|
|
72756
|
+
if (!plugin.artifact_data) {
|
|
72757
|
+
return prev;
|
|
72758
|
+
}
|
|
72759
|
+
const result = { ...prev };
|
|
72760
|
+
const dataToAdd = plugin.artifact_data(config2, doc) ?? {};
|
|
72761
|
+
if (Object.keys(dataToAdd).length > 0) {
|
|
72762
|
+
result[plugin.name] = dataToAdd;
|
|
72763
|
+
}
|
|
72764
|
+
return result;
|
|
72765
|
+
},
|
|
72766
|
+
{}
|
|
72767
|
+
);
|
|
72768
|
+
if (Object.keys(pluginsData).length > 0) {
|
|
72769
|
+
artifact.pluginsData = pluginsData;
|
|
72770
|
+
}
|
|
74446
72771
|
if (inputs && inputs.length > 0) {
|
|
74447
72772
|
artifact.input = inputObject(config2, inputs);
|
|
74448
72773
|
}
|
|
@@ -74506,77 +72831,132 @@ function artifactGenerator(stats) {
|
|
|
74506
72831
|
};
|
|
74507
72832
|
}
|
|
74508
72833
|
|
|
74509
|
-
// src/codegen/generators/runtime/
|
|
72834
|
+
// src/codegen/generators/runtime/graphqlFunction.ts
|
|
74510
72835
|
var recast6 = __toESM(require_main2(), 1);
|
|
74511
72836
|
var AST6 = recast6.types.builders;
|
|
74512
|
-
async function
|
|
74513
|
-
await Promise.all([
|
|
74514
|
-
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
74515
|
-
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
74516
|
-
const configFilePath = path_exports.join(config2.runtimeDirectory, "lib", "config.js");
|
|
74517
|
-
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
|
|
74518
|
-
return content.replace("HOUDINI_CONFIG_PATH", relativePath);
|
|
74519
|
-
},
|
|
74520
|
-
[path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
74521
|
-
return content.replace("SITE_URL", siteURL);
|
|
74522
|
-
}
|
|
74523
|
-
}),
|
|
74524
|
-
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
74525
|
-
]);
|
|
72837
|
+
async function generateGraphqlReturnTypes(config2, docs) {
|
|
74526
72838
|
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
74527
|
-
const
|
|
72839
|
+
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
72840
|
+
const contents = await parseJS(fileContent);
|
|
74528
72841
|
const graphql_tag_return = config2.plugins.find(
|
|
74529
72842
|
(plugin) => plugin.graphql_tag_return
|
|
74530
72843
|
)?.graphql_tag_return;
|
|
74531
|
-
if (graphql_tag_return
|
|
74532
|
-
|
|
74533
|
-
|
|
74534
|
-
|
|
74535
|
-
|
|
74536
|
-
|
|
74537
|
-
|
|
74538
|
-
|
|
74539
|
-
|
|
74540
|
-
|
|
74541
|
-
|
|
74542
|
-
|
|
74543
|
-
|
|
74544
|
-
|
|
74545
|
-
|
|
74546
|
-
if (return_value) {
|
|
74547
|
-
overloaded_returns[doc.originalString] = return_value;
|
|
72844
|
+
if (!graphql_tag_return || !contents) {
|
|
72845
|
+
return fileContent;
|
|
72846
|
+
}
|
|
72847
|
+
const overloaded_returns = {};
|
|
72848
|
+
for (const doc of docs) {
|
|
72849
|
+
const return_value = graphql_tag_return({
|
|
72850
|
+
config: config2,
|
|
72851
|
+
doc,
|
|
72852
|
+
ensure_import({ identifier, module: module2 }) {
|
|
72853
|
+
ensureImports({
|
|
72854
|
+
config: config2,
|
|
72855
|
+
body: contents.script.body,
|
|
72856
|
+
sourceModule: module2,
|
|
72857
|
+
import: [identifier]
|
|
72858
|
+
});
|
|
74548
72859
|
}
|
|
72860
|
+
});
|
|
72861
|
+
if (return_value) {
|
|
72862
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
74549
72863
|
}
|
|
74550
|
-
|
|
74551
|
-
|
|
74552
|
-
|
|
74553
|
-
|
|
74554
|
-
|
|
74555
|
-
|
|
74556
|
-
|
|
74557
|
-
|
|
74558
|
-
|
|
74559
|
-
)
|
|
74560
|
-
|
|
74561
|
-
|
|
74562
|
-
|
|
74563
|
-
|
|
74564
|
-
|
|
74565
|
-
|
|
74566
|
-
|
|
74567
|
-
|
|
74568
|
-
|
|
74569
|
-
)
|
|
74570
|
-
)
|
|
72864
|
+
}
|
|
72865
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
72866
|
+
for (const [i2, expression] of (contents?.script.body ?? []).entries()) {
|
|
72867
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
72868
|
+
continue;
|
|
72869
|
+
}
|
|
72870
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
72871
|
+
const input = AST6.identifier("str");
|
|
72872
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
72873
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
72874
|
+
);
|
|
72875
|
+
contents?.script.body.splice(
|
|
72876
|
+
i2,
|
|
72877
|
+
0,
|
|
72878
|
+
AST6.exportNamedDeclaration(
|
|
72879
|
+
AST6.tsDeclareFunction(
|
|
72880
|
+
AST6.identifier("graphql"),
|
|
72881
|
+
[input],
|
|
72882
|
+
AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
|
|
74571
72883
|
)
|
|
74572
|
-
)
|
|
74573
|
-
|
|
74574
|
-
break;
|
|
72884
|
+
)
|
|
72885
|
+
);
|
|
74575
72886
|
}
|
|
74576
|
-
|
|
72887
|
+
break;
|
|
74577
72888
|
}
|
|
72889
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
74578
72890
|
}
|
|
74579
72891
|
}
|
|
72892
|
+
|
|
72893
|
+
// src/codegen/generators/runtime/injectPlugins.ts
|
|
72894
|
+
async function injectPlugins({
|
|
72895
|
+
config: config2,
|
|
72896
|
+
content,
|
|
72897
|
+
importStatement,
|
|
72898
|
+
exportStatement
|
|
72899
|
+
}) {
|
|
72900
|
+
const client_plugins = config2.plugins.filter((plugin) => plugin.client_plugins).reduce((acc, plugin) => {
|
|
72901
|
+
let plugins = plugin.client_plugins;
|
|
72902
|
+
if (typeof plugins === "function") {
|
|
72903
|
+
plugins = plugins(config2, config2.pluginConfig(plugin.name));
|
|
72904
|
+
}
|
|
72905
|
+
return [...acc, ...Object.entries(plugins)];
|
|
72906
|
+
}, []);
|
|
72907
|
+
return client_plugins.length > 0 ? `
|
|
72908
|
+
${client_plugins.map((plugin, i2) => importStatement(plugin[0], `plugin${i2}`))}
|
|
72909
|
+
|
|
72910
|
+
const plugins = [
|
|
72911
|
+
${client_plugins.map((plugin, i2) => {
|
|
72912
|
+
const suffix = plugin[1] !== null ? `(${JSON.stringify(plugin[1])})` : "";
|
|
72913
|
+
return `plugin${i2}${suffix}`;
|
|
72914
|
+
}).join(",\n")}
|
|
72915
|
+
]
|
|
72916
|
+
|
|
72917
|
+
${exportStatement("plugins")}
|
|
72918
|
+
` : content;
|
|
72919
|
+
}
|
|
72920
|
+
|
|
72921
|
+
// src/codegen/generators/runtime/pluginIndex.ts
|
|
72922
|
+
async function generatePluginIndex({
|
|
72923
|
+
config: config2,
|
|
72924
|
+
exportStatement
|
|
72925
|
+
}) {
|
|
72926
|
+
const indexFile = `${exportStatement("../runtime/client/plugins/index.js")}
|
|
72927
|
+
`;
|
|
72928
|
+
const typedefs = `export * from '../runtime/client/plugins'`;
|
|
72929
|
+
await fs_exports.mkdirp(config2.pluginRootDirectory);
|
|
72930
|
+
await Promise.all([
|
|
72931
|
+
fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.js"), indexFile),
|
|
72932
|
+
fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.d.ts"), typedefs)
|
|
72933
|
+
]);
|
|
72934
|
+
}
|
|
72935
|
+
|
|
72936
|
+
// src/codegen/generators/runtime/index.ts
|
|
72937
|
+
async function runtimeGenerator(config2, docs) {
|
|
72938
|
+
const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
72939
|
+
const exportStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
72940
|
+
const exportStar = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
|
|
72941
|
+
await Promise.all([
|
|
72942
|
+
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
72943
|
+
[path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
72944
|
+
return content.replace("SITE_URL", siteURL);
|
|
72945
|
+
},
|
|
72946
|
+
[path_exports.join(config2.runtimeSource, "imports", "config.js")]: (content) => {
|
|
72947
|
+
const configFilePath = path_exports.join(config2.runtimeDirectory, "imports", "config.js");
|
|
72948
|
+
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
|
|
72949
|
+
return `${importStatement(relativePath, "config")}
|
|
72950
|
+
${exportStatement("config")}
|
|
72951
|
+
`;
|
|
72952
|
+
},
|
|
72953
|
+
[path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
72954
|
+
}),
|
|
72955
|
+
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin)),
|
|
72956
|
+
generatePluginIndex({ config: config2, exportStatement: exportStar })
|
|
72957
|
+
]);
|
|
72958
|
+
await generateGraphqlReturnTypes(config2, docs);
|
|
72959
|
+
}
|
|
74580
72960
|
async function generatePluginRuntime(config2, plugin) {
|
|
74581
72961
|
if (houdini_mode.is_testing) {
|
|
74582
72962
|
return;
|
|
@@ -75642,6 +74022,7 @@ async function writeIndexFile2(config2, docs) {
|
|
|
75642
74022
|
const export_star_from = ({ module: module2 }) => "\n" + (cjs ? exportStarFrom(module2) : `export * from "${module2}"`) + "\n";
|
|
75643
74023
|
const export_default_as = ({ module: module2, as }) => "\n" + (cjs ? exportDefaultFrom(module2, as) : `export { default as ${as} } from "${module2}"`) + "\n";
|
|
75644
74024
|
body += [
|
|
74025
|
+
export_star_from({ module: "./" + path_exports.join(runtimeDir, "client") }),
|
|
75645
74026
|
export_star_from({ module: runtimeDir }),
|
|
75646
74027
|
export_star_from({ module: artifactDir }),
|
|
75647
74028
|
export_star_from({ module: definitionsDir })
|
|
@@ -75754,7 +74135,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
75754
74135
|
}
|
|
75755
74136
|
|
|
75756
74137
|
// src/codegen/transforms/schema.ts
|
|
75757
|
-
var
|
|
74138
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
75758
74139
|
async function graphqlExtensions(config2, documents) {
|
|
75759
74140
|
const internalSchema = `
|
|
75760
74141
|
enum CachePolicy {
|
|
@@ -75832,19 +74213,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
75832
74213
|
"""
|
|
75833
74214
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
75834
74215
|
`;
|
|
75835
|
-
let currentSchema =
|
|
74216
|
+
let currentSchema = graphql21.printSchema(config2.schema);
|
|
75836
74217
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
75837
74218
|
currentSchema += internalSchema;
|
|
75838
74219
|
}
|
|
75839
74220
|
config2.newSchema += internalSchema;
|
|
75840
|
-
config2.schema =
|
|
74221
|
+
config2.schema = graphql21.buildSchema(currentSchema);
|
|
75841
74222
|
}
|
|
75842
74223
|
|
|
75843
74224
|
// src/codegen/transforms/typename.ts
|
|
75844
|
-
var
|
|
74225
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
75845
74226
|
async function addTypename(config2, documents) {
|
|
75846
74227
|
for (const doc of documents) {
|
|
75847
|
-
doc.document =
|
|
74228
|
+
doc.document = graphql22.visit(doc.document, {
|
|
75848
74229
|
Field(node, key, parent, path2, ancestors) {
|
|
75849
74230
|
if (!node.selectionSet) {
|
|
75850
74231
|
return;
|
|
@@ -75856,7 +74237,7 @@ async function addTypename(config2, documents) {
|
|
|
75856
74237
|
);
|
|
75857
74238
|
const field = type.getFields()[node.name.value];
|
|
75858
74239
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75859
|
-
if (
|
|
74240
|
+
if (graphql22.isInterfaceType(fieldType) || graphql22.isUnionType(fieldType)) {
|
|
75860
74241
|
return {
|
|
75861
74242
|
...node,
|
|
75862
74243
|
selectionSet: {
|
|
@@ -75864,9 +74245,9 @@ async function addTypename(config2, documents) {
|
|
|
75864
74245
|
selections: [
|
|
75865
74246
|
...node.selectionSet.selections,
|
|
75866
74247
|
{
|
|
75867
|
-
kind:
|
|
74248
|
+
kind: graphql22.Kind.FIELD,
|
|
75868
74249
|
name: {
|
|
75869
|
-
kind:
|
|
74250
|
+
kind: graphql22.Kind.NAME,
|
|
75870
74251
|
value: "__typename"
|
|
75871
74252
|
}
|
|
75872
74253
|
}
|
|
@@ -75880,10 +74261,10 @@ async function addTypename(config2, documents) {
|
|
|
75880
74261
|
}
|
|
75881
74262
|
|
|
75882
74263
|
// src/codegen/transforms/addID.ts
|
|
75883
|
-
var
|
|
74264
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
75884
74265
|
async function addID(config2, documents) {
|
|
75885
74266
|
for (const doc of documents) {
|
|
75886
|
-
doc.document =
|
|
74267
|
+
doc.document = graphql23.visit(doc.document, {
|
|
75887
74268
|
Field(node, key, parent, path2, ancestors) {
|
|
75888
74269
|
if (!node.selectionSet) {
|
|
75889
74270
|
return;
|
|
@@ -75896,7 +74277,7 @@ async function addID(config2, documents) {
|
|
|
75896
74277
|
const field = type.getFields()[node.name.value];
|
|
75897
74278
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75898
74279
|
if (node.selectionSet?.selections.length > 0) {
|
|
75899
|
-
if (!
|
|
74280
|
+
if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
|
|
75900
74281
|
return;
|
|
75901
74282
|
}
|
|
75902
74283
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -75911,9 +74292,9 @@ async function addID(config2, documents) {
|
|
|
75911
74292
|
continue;
|
|
75912
74293
|
}
|
|
75913
74294
|
selections.push({
|
|
75914
|
-
kind:
|
|
74295
|
+
kind: graphql23.Kind.FIELD,
|
|
75915
74296
|
name: {
|
|
75916
|
-
kind:
|
|
74297
|
+
kind: graphql23.Kind.NAME,
|
|
75917
74298
|
value: keyField
|
|
75918
74299
|
}
|
|
75919
74300
|
});
|
|
@@ -75932,8 +74313,8 @@ async function addID(config2, documents) {
|
|
|
75932
74313
|
}
|
|
75933
74314
|
|
|
75934
74315
|
// src/codegen/transforms/fragmentVariables.ts
|
|
75935
|
-
var
|
|
75936
|
-
var GraphqlKinds2 =
|
|
74316
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
74317
|
+
var GraphqlKinds2 = graphql24.Kind;
|
|
75937
74318
|
async function fragmentVariables(config2, documents) {
|
|
75938
74319
|
const fragments = collectFragments(config2, documents);
|
|
75939
74320
|
const generatedFragments = {};
|
|
@@ -75956,7 +74337,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
75956
74337
|
});
|
|
75957
74338
|
}
|
|
75958
74339
|
const doc = {
|
|
75959
|
-
kind:
|
|
74340
|
+
kind: graphql24.Kind.DOCUMENT,
|
|
75960
74341
|
definitions: Object.values(generatedFragments)
|
|
75961
74342
|
};
|
|
75962
74343
|
documents.push({
|
|
@@ -75992,7 +74373,7 @@ function inlineFragmentArgs({
|
|
|
75992
74373
|
filepath,
|
|
75993
74374
|
document
|
|
75994
74375
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
75995
|
-
const result =
|
|
74376
|
+
const result = graphql24.visit(document, {
|
|
75996
74377
|
FragmentSpread(node) {
|
|
75997
74378
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
75998
74379
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -76080,7 +74461,7 @@ function inlineFragmentArgs({
|
|
|
76080
74461
|
});
|
|
76081
74462
|
if (newName) {
|
|
76082
74463
|
result.name = {
|
|
76083
|
-
kind:
|
|
74464
|
+
kind: graphql24.Kind.NAME,
|
|
76084
74465
|
value: newName
|
|
76085
74466
|
};
|
|
76086
74467
|
}
|
|
@@ -76192,7 +74573,7 @@ function operationScope(operation) {
|
|
|
76192
74573
|
}
|
|
76193
74574
|
|
|
76194
74575
|
// src/codegen/validators/typeCheck.ts
|
|
76195
|
-
var
|
|
74576
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
76196
74577
|
async function typeCheck(config2, docs) {
|
|
76197
74578
|
const errors = [];
|
|
76198
74579
|
const freeLists = [];
|
|
@@ -76200,11 +74581,11 @@ async function typeCheck(config2, docs) {
|
|
|
76200
74581
|
const listTypes = [];
|
|
76201
74582
|
const fragments = {};
|
|
76202
74583
|
for (const { document: parsed, filename } of docs) {
|
|
76203
|
-
|
|
76204
|
-
[
|
|
74584
|
+
graphql25.visit(parsed, {
|
|
74585
|
+
[graphql25.Kind.FRAGMENT_DEFINITION](definition) {
|
|
76205
74586
|
fragments[definition.name.value] = definition;
|
|
76206
74587
|
},
|
|
76207
|
-
[
|
|
74588
|
+
[graphql25.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
76208
74589
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
76209
74590
|
return;
|
|
76210
74591
|
}
|
|
@@ -76250,14 +74631,14 @@ async function typeCheck(config2, docs) {
|
|
|
76250
74631
|
);
|
|
76251
74632
|
return;
|
|
76252
74633
|
}
|
|
76253
|
-
if (
|
|
74634
|
+
if (graphql25.isListType(rootType) || graphql25.isNonNullType(rootType) && graphql25.isListType(rootType.ofType)) {
|
|
76254
74635
|
needsParent = true;
|
|
76255
74636
|
break;
|
|
76256
74637
|
}
|
|
76257
|
-
if (
|
|
74638
|
+
if (graphql25.isNonNullType(rootType) && "ofType" in rootType) {
|
|
76258
74639
|
rootType = rootType.ofType;
|
|
76259
74640
|
}
|
|
76260
|
-
if (
|
|
74641
|
+
if (graphql25.isScalarType(rootType)) {
|
|
76261
74642
|
break;
|
|
76262
74643
|
}
|
|
76263
74644
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -76333,9 +74714,9 @@ async function typeCheck(config2, docs) {
|
|
|
76333
74714
|
);
|
|
76334
74715
|
}
|
|
76335
74716
|
let targetTypes = [type];
|
|
76336
|
-
if (
|
|
74717
|
+
if (graphql25.isUnionType(type)) {
|
|
76337
74718
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
76338
|
-
} else if (
|
|
74719
|
+
} else if (graphql25.isInterfaceType(type)) {
|
|
76339
74720
|
try {
|
|
76340
74721
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
76341
74722
|
if (!type.getFields()[key]) {
|
|
@@ -76373,13 +74754,13 @@ async function typeCheck(config2, docs) {
|
|
|
76373
74754
|
if (errors.length > 0) {
|
|
76374
74755
|
throw errors;
|
|
76375
74756
|
}
|
|
76376
|
-
const rules = (filepath) => [...
|
|
74757
|
+
const rules = (filepath) => [...graphql25.specifiedRules].filter(
|
|
76377
74758
|
(rule) => ![
|
|
76378
|
-
|
|
76379
|
-
|
|
76380
|
-
|
|
76381
|
-
|
|
76382
|
-
|
|
74759
|
+
graphql25.NoUnusedFragmentsRule,
|
|
74760
|
+
graphql25.KnownFragmentNamesRule,
|
|
74761
|
+
graphql25.ExecutableDefinitionsRule,
|
|
74762
|
+
graphql25.KnownDirectivesRule,
|
|
74763
|
+
graphql25.KnownArgumentNamesRule
|
|
76383
74764
|
].includes(rule)
|
|
76384
74765
|
).concat(
|
|
76385
74766
|
validateLists({
|
|
@@ -76398,7 +74779,7 @@ async function typeCheck(config2, docs) {
|
|
|
76398
74779
|
noUnusedFragmentArguments(config2)
|
|
76399
74780
|
);
|
|
76400
74781
|
for (const { filename, document: parsed } of docs) {
|
|
76401
|
-
for (const error of
|
|
74782
|
+
for (const error of graphql25.validate(config2.schema, parsed, rules(filename))) {
|
|
76402
74783
|
errors.push(
|
|
76403
74784
|
new HoudiniError({
|
|
76404
74785
|
filepath: filename,
|
|
@@ -76424,7 +74805,7 @@ var validateLists = ({
|
|
|
76424
74805
|
if (!config2.isListFragment(node.name.value)) {
|
|
76425
74806
|
if (!fragments[node.name.value]) {
|
|
76426
74807
|
ctx.reportError(
|
|
76427
|
-
new
|
|
74808
|
+
new graphql25.GraphQLError(
|
|
76428
74809
|
"Encountered unknown fragment: " + node.name.value
|
|
76429
74810
|
)
|
|
76430
74811
|
);
|
|
@@ -76434,7 +74815,7 @@ var validateLists = ({
|
|
|
76434
74815
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
76435
74816
|
if (!lists.includes(listName)) {
|
|
76436
74817
|
ctx.reportError(
|
|
76437
|
-
new
|
|
74818
|
+
new graphql25.GraphQLError(
|
|
76438
74819
|
"Encountered fragment referencing unknown list: " + listName
|
|
76439
74820
|
)
|
|
76440
74821
|
);
|
|
@@ -76459,7 +74840,7 @@ var validateLists = ({
|
|
|
76459
74840
|
);
|
|
76460
74841
|
if (parentArg) {
|
|
76461
74842
|
ctx.reportError(
|
|
76462
|
-
new
|
|
74843
|
+
new graphql25.GraphQLError(
|
|
76463
74844
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
76464
74845
|
)
|
|
76465
74846
|
);
|
|
@@ -76475,7 +74856,7 @@ var validateLists = ({
|
|
|
76475
74856
|
return;
|
|
76476
74857
|
}
|
|
76477
74858
|
ctx.reportError(
|
|
76478
|
-
new
|
|
74859
|
+
new graphql25.GraphQLError(
|
|
76479
74860
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
76480
74861
|
)
|
|
76481
74862
|
);
|
|
@@ -76485,7 +74866,7 @@ var validateLists = ({
|
|
|
76485
74866
|
const directiveName = node.name.value;
|
|
76486
74867
|
if (directiveName === "connection") {
|
|
76487
74868
|
ctx.reportError(
|
|
76488
|
-
new
|
|
74869
|
+
new graphql25.GraphQLError(
|
|
76489
74870
|
"@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."
|
|
76490
74871
|
)
|
|
76491
74872
|
);
|
|
@@ -76494,7 +74875,7 @@ var validateLists = ({
|
|
|
76494
74875
|
if (!config2.isInternalDirective(node)) {
|
|
76495
74876
|
if (!config2.schema.getDirective(directiveName)) {
|
|
76496
74877
|
ctx.reportError(
|
|
76497
|
-
new
|
|
74878
|
+
new graphql25.GraphQLError(
|
|
76498
74879
|
"Encountered unknown directive: " + directiveName
|
|
76499
74880
|
)
|
|
76500
74881
|
);
|
|
@@ -76503,7 +74884,7 @@ var validateLists = ({
|
|
|
76503
74884
|
}
|
|
76504
74885
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
76505
74886
|
ctx.reportError(
|
|
76506
|
-
new
|
|
74887
|
+
new graphql25.GraphQLError(
|
|
76507
74888
|
"Encountered directive referencing unknown list: " + directiveName
|
|
76508
74889
|
)
|
|
76509
74890
|
);
|
|
@@ -76514,7 +74895,7 @@ var validateLists = ({
|
|
|
76514
74895
|
};
|
|
76515
74896
|
function knownArguments(config2) {
|
|
76516
74897
|
return function(ctx) {
|
|
76517
|
-
const nativeValidator =
|
|
74898
|
+
const nativeValidator = graphql25.KnownArgumentNamesRule(ctx);
|
|
76518
74899
|
return {
|
|
76519
74900
|
...nativeValidator,
|
|
76520
74901
|
Directive(directiveNode) {
|
|
@@ -76547,7 +74928,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76547
74928
|
for (const arg of node.arguments || []) {
|
|
76548
74929
|
if (arg.value.kind !== "ObjectValue") {
|
|
76549
74930
|
ctx.reportError(
|
|
76550
|
-
new
|
|
74931
|
+
new graphql25.GraphQLError("values in @arguments must be an object")
|
|
76551
74932
|
);
|
|
76552
74933
|
return;
|
|
76553
74934
|
}
|
|
@@ -76557,13 +74938,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76557
74938
|
);
|
|
76558
74939
|
if (!typeArg) {
|
|
76559
74940
|
ctx.reportError(
|
|
76560
|
-
new
|
|
74941
|
+
new graphql25.GraphQLError("missing type field for @arguments directive")
|
|
76561
74942
|
);
|
|
76562
74943
|
return;
|
|
76563
74944
|
}
|
|
76564
|
-
if (typeArg.value.kind !==
|
|
74945
|
+
if (typeArg.value.kind !== graphql25.Kind.STRING) {
|
|
76565
74946
|
ctx.reportError(
|
|
76566
|
-
new
|
|
74947
|
+
new graphql25.GraphQLError("type field to @arguments must be a string")
|
|
76567
74948
|
);
|
|
76568
74949
|
return;
|
|
76569
74950
|
}
|
|
@@ -76576,7 +74957,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76576
74957
|
);
|
|
76577
74958
|
if (typeArg.value.value !== defaultValueType) {
|
|
76578
74959
|
ctx.reportError(
|
|
76579
|
-
new
|
|
74960
|
+
new graphql25.GraphQLError(
|
|
76580
74961
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
76581
74962
|
)
|
|
76582
74963
|
);
|
|
@@ -76594,7 +74975,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76594
74975
|
try {
|
|
76595
74976
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
76596
74977
|
} catch (e2) {
|
|
76597
|
-
ctx.reportError(new
|
|
74978
|
+
ctx.reportError(new graphql25.GraphQLError(e2.message));
|
|
76598
74979
|
return;
|
|
76599
74980
|
}
|
|
76600
74981
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -76617,7 +74998,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76617
74998
|
);
|
|
76618
74999
|
if (missing.length > 0) {
|
|
76619
75000
|
ctx.reportError(
|
|
76620
|
-
new
|
|
75001
|
+
new graphql25.GraphQLError(
|
|
76621
75002
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
76622
75003
|
)
|
|
76623
75004
|
);
|
|
@@ -76628,7 +75009,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76628
75009
|
);
|
|
76629
75010
|
if (unknown.length > 0) {
|
|
76630
75011
|
ctx.reportError(
|
|
76631
|
-
new
|
|
75012
|
+
new graphql25.GraphQLError(
|
|
76632
75013
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
76633
75014
|
)
|
|
76634
75015
|
);
|
|
@@ -76640,7 +75021,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76640
75021
|
]
|
|
76641
75022
|
);
|
|
76642
75023
|
for (const [applied, target] of zipped) {
|
|
76643
|
-
if (applied.value.kind ===
|
|
75024
|
+
if (applied.value.kind === graphql25.Kind.VARIABLE || applied.value.kind === graphql25.Kind.LIST || applied.value.kind === graphql25.Kind.OBJECT) {
|
|
76644
75025
|
continue;
|
|
76645
75026
|
}
|
|
76646
75027
|
const appliedType = applied.value.kind.substring(
|
|
@@ -76649,7 +75030,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76649
75030
|
);
|
|
76650
75031
|
if (appliedType !== target) {
|
|
76651
75032
|
ctx.reportError(
|
|
76652
|
-
new
|
|
75033
|
+
new graphql25.GraphQLError(
|
|
76653
75034
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
76654
75035
|
)
|
|
76655
75036
|
);
|
|
@@ -76670,7 +75051,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76670
75051
|
}
|
|
76671
75052
|
if (alreadyPaginated) {
|
|
76672
75053
|
ctx.reportError(
|
|
76673
|
-
new
|
|
75054
|
+
new graphql25.GraphQLError(
|
|
76674
75055
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
76675
75056
|
)
|
|
76676
75057
|
);
|
|
@@ -76685,7 +75066,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76685
75066
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
76686
75067
|
if (hasRequiredArgs) {
|
|
76687
75068
|
ctx.reportError(
|
|
76688
|
-
new
|
|
75069
|
+
new graphql25.GraphQLError(
|
|
76689
75070
|
"@paginate cannot appear on a document with required args"
|
|
76690
75071
|
)
|
|
76691
75072
|
);
|
|
@@ -76717,14 +75098,14 @@ function paginateArgs(config2, filepath) {
|
|
|
76717
75098
|
const backwards = appliedArgs.has("last");
|
|
76718
75099
|
if (!forward && !backwards) {
|
|
76719
75100
|
ctx.reportError(
|
|
76720
|
-
new
|
|
75101
|
+
new graphql25.GraphQLError(
|
|
76721
75102
|
"A field with cursor-based pagination must have a first or last argument"
|
|
76722
75103
|
)
|
|
76723
75104
|
);
|
|
76724
75105
|
}
|
|
76725
75106
|
if (forward && backwards) {
|
|
76726
75107
|
ctx.reportError(
|
|
76727
|
-
new
|
|
75108
|
+
new graphql25.GraphQLError(
|
|
76728
75109
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
76729
75110
|
)
|
|
76730
75111
|
);
|
|
@@ -76738,7 +75119,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76738
75119
|
);
|
|
76739
75120
|
if (!appliedLimitArg) {
|
|
76740
75121
|
ctx.reportError(
|
|
76741
|
-
new
|
|
75122
|
+
new graphql25.GraphQLError(
|
|
76742
75123
|
"A field with offset-based pagination must have a limit argument"
|
|
76743
75124
|
)
|
|
76744
75125
|
);
|
|
@@ -76754,20 +75135,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
76754
75135
|
const args = /* @__PURE__ */ new Set();
|
|
76755
75136
|
return {
|
|
76756
75137
|
enter(node) {
|
|
76757
|
-
if (node.kind ===
|
|
75138
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
76758
75139
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
76759
75140
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
76760
75141
|
args.add(arg);
|
|
76761
75142
|
}
|
|
76762
|
-
} else if (node.kind ===
|
|
75143
|
+
} else if (node.kind === graphql25.Kind.VARIABLE) {
|
|
76763
75144
|
args.delete(node.name.value);
|
|
76764
75145
|
}
|
|
76765
75146
|
},
|
|
76766
75147
|
leave(node) {
|
|
76767
|
-
if (node.kind ===
|
|
75148
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
76768
75149
|
if (args.size > 0) {
|
|
76769
75150
|
ctx.reportError(
|
|
76770
|
-
new
|
|
75151
|
+
new graphql25.GraphQLError(
|
|
76771
75152
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
76772
75153
|
)
|
|
76773
75154
|
);
|
|
@@ -76803,7 +75184,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76803
75184
|
if (definition.kind === "OperationDefinition") {
|
|
76804
75185
|
if (definition.operation !== "query") {
|
|
76805
75186
|
ctx.reportError(
|
|
76806
|
-
new
|
|
75187
|
+
new graphql25.GraphQLError(
|
|
76807
75188
|
`@${node.name.value} must fall on a fragment or query document`
|
|
76808
75189
|
)
|
|
76809
75190
|
);
|
|
@@ -76815,7 +75196,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76815
75196
|
}
|
|
76816
75197
|
if (!possibleNodes.includes(definitionType)) {
|
|
76817
75198
|
ctx.reportError(
|
|
76818
|
-
new
|
|
75199
|
+
new graphql25.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
76819
75200
|
);
|
|
76820
75201
|
}
|
|
76821
75202
|
}
|
|
@@ -76834,7 +75215,7 @@ function checkMutationOperation(config2) {
|
|
|
76834
75215
|
);
|
|
76835
75216
|
if (append && prepend) {
|
|
76836
75217
|
ctx.reportError(
|
|
76837
|
-
new
|
|
75218
|
+
new graphql25.GraphQLError(
|
|
76838
75219
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
76839
75220
|
)
|
|
76840
75221
|
);
|
|
@@ -76848,7 +75229,7 @@ function checkMutationOperation(config2) {
|
|
|
76848
75229
|
);
|
|
76849
75230
|
if (parentId && allLists) {
|
|
76850
75231
|
ctx.reportError(
|
|
76851
|
-
new
|
|
75232
|
+
new graphql25.GraphQLError(
|
|
76852
75233
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
76853
75234
|
)
|
|
76854
75235
|
);
|
|
@@ -76870,7 +75251,7 @@ function checkMaskDirective(config2) {
|
|
|
76870
75251
|
);
|
|
76871
75252
|
if (maskEnableDirective && maskDisableDirective) {
|
|
76872
75253
|
ctx.reportError(
|
|
76873
|
-
new
|
|
75254
|
+
new graphql25.GraphQLError(
|
|
76874
75255
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
76875
75256
|
)
|
|
76876
75257
|
);
|
|
@@ -76886,7 +75267,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
76886
75267
|
if (!nodeInterface) {
|
|
76887
75268
|
return null;
|
|
76888
75269
|
}
|
|
76889
|
-
if (!
|
|
75270
|
+
if (!graphql25.isInterfaceType(nodeInterface)) {
|
|
76890
75271
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
76891
75272
|
return null;
|
|
76892
75273
|
}
|
|
@@ -76984,11 +75365,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
76984
75365
|
}
|
|
76985
75366
|
|
|
76986
75367
|
// src/codegen/validators/noIDAlias.ts
|
|
76987
|
-
var
|
|
75368
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
76988
75369
|
async function noIDAlias(config2, docs) {
|
|
76989
75370
|
const errors = [];
|
|
76990
75371
|
for (const { filename, document } of docs) {
|
|
76991
|
-
|
|
75372
|
+
graphql26.visit(document, {
|
|
76992
75373
|
Field(node, _, __, ___, ancestors) {
|
|
76993
75374
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
76994
75375
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -77186,12 +75567,17 @@ async function processJSFile(config2, contents) {
|
|
|
77186
75567
|
return documents;
|
|
77187
75568
|
}
|
|
77188
75569
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
77189
|
-
|
|
75570
|
+
try {
|
|
75571
|
+
var parsedDoc = graphql27.parse(document);
|
|
75572
|
+
} catch (e2) {
|
|
75573
|
+
console.log("error parsing!!");
|
|
75574
|
+
throw e2;
|
|
75575
|
+
}
|
|
77190
75576
|
const operations = parsedDoc.definitions.filter(
|
|
77191
|
-
({ kind: kind2 }) => kind2 ===
|
|
75577
|
+
({ kind: kind2 }) => kind2 === graphql27.Kind.OPERATION_DEFINITION
|
|
77192
75578
|
);
|
|
77193
75579
|
const fragments = parsedDoc.definitions.filter(
|
|
77194
|
-
({ kind: kind2 }) => kind2 ===
|
|
75580
|
+
({ kind: kind2 }) => kind2 === graphql27.Kind.FRAGMENT_DEFINITION
|
|
77195
75581
|
);
|
|
77196
75582
|
if (operations.length > 1) {
|
|
77197
75583
|
throw new HoudiniError({
|
|
@@ -77318,10 +75704,6 @@ async function generate(args = {
|
|
|
77318
75704
|
config2.persistedQueryPath = args.output;
|
|
77319
75705
|
}
|
|
77320
75706
|
if (args.pullSchema && await config2.apiURL()) {
|
|
77321
|
-
if (args.pullHeader) {
|
|
77322
|
-
console.log("\u26A0\uFE0F --pull-headers has been replaced by --headers (abbreviated -h)");
|
|
77323
|
-
args.headers = args.pullHeader;
|
|
77324
|
-
}
|
|
77325
75707
|
await pullSchema_default(args);
|
|
77326
75708
|
}
|
|
77327
75709
|
await compile(config2);
|
|
@@ -77497,7 +75879,7 @@ async function init(_path, args) {
|
|
|
77497
75879
|
} else if (framework === "svelte") {
|
|
77498
75880
|
await updateSvelteMainJs(targetPath);
|
|
77499
75881
|
}
|
|
77500
|
-
await updateViteConfig(targetPath, framework
|
|
75882
|
+
await updateViteConfig(targetPath, framework);
|
|
77501
75883
|
await tjsConfig(targetPath, framework);
|
|
77502
75884
|
console.log();
|
|
77503
75885
|
console.log("\u{1F3A9} Welcome to Houdini!");
|
|
@@ -77518,28 +75900,19 @@ async function init(_path, args) {
|
|
|
77518
75900
|
}
|
|
77519
75901
|
var networkFile = (url, typescript) => `import { HoudiniClient${typescript ? ", type RequestHandler" : ""} } from '$houdini';
|
|
77520
75902
|
|
|
77521
|
-
|
|
77522
|
-
|
|
77523
|
-
|
|
77524
|
-
|
|
77525
|
-
|
|
77526
|
-
|
|
77527
|
-
|
|
77528
|
-
|
|
77529
|
-
|
|
77530
|
-
|
|
77531
|
-
|
|
77532
|
-
|
|
77533
|
-
|
|
77534
|
-
body: JSON.stringify({
|
|
77535
|
-
query: text,
|
|
77536
|
-
variables
|
|
77537
|
-
})
|
|
77538
|
-
});
|
|
77539
|
-
return await result.json();
|
|
77540
|
-
}
|
|
77541
|
-
|
|
77542
|
-
export default new HoudiniClient(requestHandler);
|
|
75903
|
+
export default new HoudiniClient({
|
|
75904
|
+
url: '${url}'
|
|
75905
|
+
|
|
75906
|
+
// uncomment this to configure the network call (for things like authentication)
|
|
75907
|
+
// for more information, please visit here: https://www.houdinigraphql.com/guides/authentication
|
|
75908
|
+
// fetchParams({ session }) {
|
|
75909
|
+
// return {
|
|
75910
|
+
// headers: {
|
|
75911
|
+
// Authentication: \`Bearer \${session.token}\`,
|
|
75912
|
+
// }
|
|
75913
|
+
// }
|
|
75914
|
+
// }
|
|
75915
|
+
})
|
|
77543
75916
|
`;
|
|
77544
75917
|
var writeConfigFile = async ({
|
|
77545
75918
|
configPath,
|
|
@@ -77611,8 +75984,8 @@ async function tjsConfig(targetPath, framework) {
|
|
|
77611
75984
|
}
|
|
77612
75985
|
return false;
|
|
77613
75986
|
}
|
|
77614
|
-
async function updateViteConfig(targetPath, framework
|
|
77615
|
-
const viteConfigPath = path_exports.join(targetPath,
|
|
75987
|
+
async function updateViteConfig(targetPath, framework) {
|
|
75988
|
+
const viteConfigPath = path_exports.join(targetPath, "vite.config.js");
|
|
77616
75989
|
const viteConfigKit = `import { sveltekit } from '@sveltejs/kit/vite';
|
|
77617
75990
|
import houdini from 'houdini/vite';
|
|
77618
75991
|
|
|
@@ -77621,16 +75994,6 @@ const config = {
|
|
|
77621
75994
|
plugins: [houdini(), sveltekit()],
|
|
77622
75995
|
}
|
|
77623
75996
|
|
|
77624
|
-
export default config;
|
|
77625
|
-
`;
|
|
77626
|
-
const viteConfigKitTs = `import { sveltekit } from '@sveltejs/kit/vite';
|
|
77627
|
-
import houdini from 'houdini/vite';
|
|
77628
|
-
import type { UserConfig } from "vite";
|
|
77629
|
-
|
|
77630
|
-
const config: UserConfig = {
|
|
77631
|
-
plugins: [houdini(), sveltekit()],
|
|
77632
|
-
}
|
|
77633
|
-
|
|
77634
75997
|
export default config;
|
|
77635
75998
|
`;
|
|
77636
75999
|
const viteConfigSvelte = `import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
@@ -77643,39 +76006,18 @@ const config = {
|
|
|
77643
76006
|
|
|
77644
76007
|
export default config;
|
|
77645
76008
|
`;
|
|
77646
|
-
|
|
77647
|
-
|
|
77648
|
-
import type { UserConfig } from "vite";
|
|
77649
|
-
|
|
77650
|
-
const config: UserConfig = {
|
|
77651
|
-
plugins: [houdini(), svelte()],
|
|
77652
|
-
}
|
|
77653
|
-
|
|
77654
|
-
export default config;
|
|
77655
|
-
`;
|
|
77656
|
-
let content = "NOTHING!";
|
|
77657
|
-
if (framework === "kit" && typescript) {
|
|
77658
|
-
content = viteConfigKitTs;
|
|
77659
|
-
} else if (framework === "kit" && !typescript) {
|
|
76009
|
+
let content;
|
|
76010
|
+
if (framework === "kit") {
|
|
77660
76011
|
content = viteConfigKit;
|
|
77661
|
-
} else if (framework === "svelte"
|
|
77662
|
-
content = viteConfigSvelteTs;
|
|
77663
|
-
} else if (framework === "svelte" && !typescript) {
|
|
76012
|
+
} else if (framework === "svelte") {
|
|
77664
76013
|
content = viteConfigSvelte;
|
|
77665
76014
|
} else {
|
|
77666
76015
|
throw new Error("Unknown updateViteConfig()");
|
|
77667
76016
|
}
|
|
77668
|
-
|
|
77669
|
-
|
|
77670
|
-
|
|
77671
|
-
|
|
77672
|
-
});
|
|
77673
|
-
} else {
|
|
77674
|
-
await updateFile({
|
|
77675
|
-
filepath: viteConfigPath,
|
|
77676
|
-
content: framework === "kit" ? viteConfigKit : viteConfigSvelte
|
|
77677
|
-
});
|
|
77678
|
-
}
|
|
76017
|
+
await updateFile({
|
|
76018
|
+
filepath: viteConfigPath,
|
|
76019
|
+
content: framework === "kit" ? viteConfigKit : viteConfigSvelte
|
|
76020
|
+
});
|
|
77679
76021
|
}
|
|
77680
76022
|
async function updateSvelteConfig(targetPath, typescript) {
|
|
77681
76023
|
const svelteConfigPath = path_exports.join(targetPath, "svelte.config.js");
|
|
@@ -77696,7 +76038,7 @@ const config = {
|
|
|
77696
76038
|
}
|
|
77697
76039
|
};
|
|
77698
76040
|
|
|
77699
|
-
export default config;
|
|
76041
|
+
export default config;
|
|
77700
76042
|
`;
|
|
77701
76043
|
const newContentJs = `import adapter from '@sveltejs/adapter-auto';
|
|
77702
76044
|
|
|
@@ -77746,8 +76088,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
77746
76088
|
}
|
|
77747
76089
|
packageJSON.devDependencies = {
|
|
77748
76090
|
...packageJSON.devDependencies,
|
|
77749
|
-
houdini: "^1.0.0-next.
|
|
77750
|
-
"houdini-svelte": "^1.0.0-next.
|
|
76091
|
+
houdini: "^1.0.0-next.2",
|
|
76092
|
+
"houdini-svelte": "^1.0.0-next.2",
|
|
77751
76093
|
graphql: "^15.8.0"
|
|
77752
76094
|
};
|
|
77753
76095
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|
|
@@ -77761,6 +76103,7 @@ async function graphqlRCFile(targetPath) {
|
|
|
77761
76103
|
- ./$houdini/graphql/schema.graphql
|
|
77762
76104
|
documents:
|
|
77763
76105
|
- '**/*.gql'
|
|
76106
|
+
- '**/*.svelte'
|
|
77764
76107
|
- ./$houdini/graphql/documents.gql
|
|
77765
76108
|
`;
|
|
77766
76109
|
await updateFile({
|