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-esm/index.js
CHANGED
|
@@ -11274,18 +11274,18 @@ var require_execute = __commonJS({
|
|
|
11274
11274
|
}
|
|
11275
11275
|
var returnType = fieldDef.type;
|
|
11276
11276
|
var resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver;
|
|
11277
|
-
var
|
|
11277
|
+
var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path2);
|
|
11278
11278
|
try {
|
|
11279
11279
|
var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], exeContext.variableValues);
|
|
11280
11280
|
var _contextValue = exeContext.contextValue;
|
|
11281
|
-
var result = resolveFn(source, args, _contextValue,
|
|
11281
|
+
var result = resolveFn(source, args, _contextValue, info);
|
|
11282
11282
|
var completed;
|
|
11283
11283
|
if ((0, _isPromise.default)(result)) {
|
|
11284
11284
|
completed = result.then(function(resolved) {
|
|
11285
|
-
return completeValue(exeContext, returnType, fieldNodes,
|
|
11285
|
+
return completeValue(exeContext, returnType, fieldNodes, info, path2, resolved);
|
|
11286
11286
|
});
|
|
11287
11287
|
} else {
|
|
11288
|
-
completed = completeValue(exeContext, returnType, fieldNodes,
|
|
11288
|
+
completed = completeValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
11289
11289
|
}
|
|
11290
11290
|
if ((0, _isPromise.default)(completed)) {
|
|
11291
11291
|
return completed.then(void 0, function(rawError) {
|
|
@@ -11320,14 +11320,14 @@ var require_execute = __commonJS({
|
|
|
11320
11320
|
exeContext.errors.push(error);
|
|
11321
11321
|
return null;
|
|
11322
11322
|
}
|
|
11323
|
-
function completeValue(exeContext, returnType, fieldNodes,
|
|
11323
|
+
function completeValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
11324
11324
|
if (result instanceof Error) {
|
|
11325
11325
|
throw result;
|
|
11326
11326
|
}
|
|
11327
11327
|
if ((0, _definition.isNonNullType)(returnType)) {
|
|
11328
|
-
var completed = completeValue(exeContext, returnType.ofType, fieldNodes,
|
|
11328
|
+
var completed = completeValue(exeContext, returnType.ofType, fieldNodes, info, path2, result);
|
|
11329
11329
|
if (completed === null) {
|
|
11330
|
-
throw new Error("Cannot return null for non-nullable field ".concat(
|
|
11330
|
+
throw new Error("Cannot return null for non-nullable field ".concat(info.parentType.name, ".").concat(info.fieldName, "."));
|
|
11331
11331
|
}
|
|
11332
11332
|
return completed;
|
|
11333
11333
|
}
|
|
@@ -11335,20 +11335,20 @@ var require_execute = __commonJS({
|
|
|
11335
11335
|
return null;
|
|
11336
11336
|
}
|
|
11337
11337
|
if ((0, _definition.isListType)(returnType)) {
|
|
11338
|
-
return completeListValue(exeContext, returnType, fieldNodes,
|
|
11338
|
+
return completeListValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
11339
11339
|
}
|
|
11340
11340
|
if ((0, _definition.isLeafType)(returnType)) {
|
|
11341
11341
|
return completeLeafValue(returnType, result);
|
|
11342
11342
|
}
|
|
11343
11343
|
if ((0, _definition.isAbstractType)(returnType)) {
|
|
11344
|
-
return completeAbstractValue(exeContext, returnType, fieldNodes,
|
|
11344
|
+
return completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
11345
11345
|
}
|
|
11346
11346
|
if ((0, _definition.isObjectType)(returnType)) {
|
|
11347
|
-
return completeObjectValue(exeContext, returnType, fieldNodes,
|
|
11347
|
+
return completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result);
|
|
11348
11348
|
}
|
|
11349
11349
|
(0, _invariant.default)(0, "Cannot complete value of unexpected output type: " + (0, _inspect.default)(returnType));
|
|
11350
11350
|
}
|
|
11351
|
-
function completeListValue(exeContext, returnType, fieldNodes,
|
|
11351
|
+
function completeListValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
11352
11352
|
var itemType = returnType.ofType;
|
|
11353
11353
|
var containsPromise = false;
|
|
11354
11354
|
var completedResults = (0, _safeArrayFrom.default)(result, function(item, index) {
|
|
@@ -11357,10 +11357,10 @@ var require_execute = __commonJS({
|
|
|
11357
11357
|
var completedItem;
|
|
11358
11358
|
if ((0, _isPromise.default)(item)) {
|
|
11359
11359
|
completedItem = item.then(function(resolved) {
|
|
11360
|
-
return completeValue(exeContext, itemType, fieldNodes,
|
|
11360
|
+
return completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved);
|
|
11361
11361
|
});
|
|
11362
11362
|
} else {
|
|
11363
|
-
completedItem = completeValue(exeContext, itemType, fieldNodes,
|
|
11363
|
+
completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item);
|
|
11364
11364
|
}
|
|
11365
11365
|
if ((0, _isPromise.default)(completedItem)) {
|
|
11366
11366
|
containsPromise = true;
|
|
@@ -11376,7 +11376,7 @@ var require_execute = __commonJS({
|
|
|
11376
11376
|
}
|
|
11377
11377
|
});
|
|
11378
11378
|
if (completedResults == null) {
|
|
11379
|
-
throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(
|
|
11379
|
+
throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(info.parentType.name, ".").concat(info.fieldName, '".'));
|
|
11380
11380
|
}
|
|
11381
11381
|
return containsPromise ? Promise.all(completedResults) : completedResults;
|
|
11382
11382
|
}
|
|
@@ -11387,25 +11387,25 @@ var require_execute = __commonJS({
|
|
|
11387
11387
|
}
|
|
11388
11388
|
return serializedResult;
|
|
11389
11389
|
}
|
|
11390
|
-
function completeAbstractValue(exeContext, returnType, fieldNodes,
|
|
11390
|
+
function completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
11391
11391
|
var _returnType$resolveTy;
|
|
11392
11392
|
var resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver;
|
|
11393
11393
|
var contextValue = exeContext.contextValue;
|
|
11394
|
-
var runtimeType = resolveTypeFn(result, contextValue,
|
|
11394
|
+
var runtimeType = resolveTypeFn(result, contextValue, info, returnType);
|
|
11395
11395
|
if ((0, _isPromise.default)(runtimeType)) {
|
|
11396
11396
|
return runtimeType.then(function(resolvedRuntimeType) {
|
|
11397
|
-
return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes,
|
|
11397
|
+
return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
|
|
11398
11398
|
});
|
|
11399
11399
|
}
|
|
11400
|
-
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes,
|
|
11400
|
+
return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
|
|
11401
11401
|
}
|
|
11402
|
-
function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes,
|
|
11402
|
+
function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info, result) {
|
|
11403
11403
|
if (runtimeTypeOrName == null) {
|
|
11404
|
-
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(
|
|
11404
|
+
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);
|
|
11405
11405
|
}
|
|
11406
11406
|
var runtimeTypeName = (0, _definition.isNamedType)(runtimeTypeOrName) ? runtimeTypeOrName.name : runtimeTypeOrName;
|
|
11407
11407
|
if (typeof runtimeTypeName !== "string") {
|
|
11408
|
-
throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(
|
|
11408
|
+
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), '".'));
|
|
11409
11409
|
}
|
|
11410
11410
|
var runtimeType = exeContext.schema.getType(runtimeTypeName);
|
|
11411
11411
|
if (runtimeType == null) {
|
|
@@ -11419,9 +11419,9 @@ var require_execute = __commonJS({
|
|
|
11419
11419
|
}
|
|
11420
11420
|
return runtimeType;
|
|
11421
11421
|
}
|
|
11422
|
-
function completeObjectValue(exeContext, returnType, fieldNodes,
|
|
11422
|
+
function completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result) {
|
|
11423
11423
|
if (returnType.isTypeOf) {
|
|
11424
|
-
var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue,
|
|
11424
|
+
var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info);
|
|
11425
11425
|
if ((0, _isPromise.default)(isTypeOf)) {
|
|
11426
11426
|
return isTypeOf.then(function(resolvedIsTypeOf) {
|
|
11427
11427
|
if (!resolvedIsTypeOf) {
|
|
@@ -11455,16 +11455,16 @@ var require_execute = __commonJS({
|
|
|
11455
11455
|
}
|
|
11456
11456
|
return subFieldNodes;
|
|
11457
11457
|
}
|
|
11458
|
-
var defaultTypeResolver = function defaultTypeResolver2(value, contextValue,
|
|
11458
|
+
var defaultTypeResolver = function defaultTypeResolver2(value, contextValue, info, abstractType) {
|
|
11459
11459
|
if ((0, _isObjectLike.default)(value) && typeof value.__typename === "string") {
|
|
11460
11460
|
return value.__typename;
|
|
11461
11461
|
}
|
|
11462
|
-
var possibleTypes =
|
|
11462
|
+
var possibleTypes = info.schema.getPossibleTypes(abstractType);
|
|
11463
11463
|
var promisedIsTypeOfResults = [];
|
|
11464
11464
|
for (var i2 = 0; i2 < possibleTypes.length; i2++) {
|
|
11465
11465
|
var type = possibleTypes[i2];
|
|
11466
11466
|
if (type.isTypeOf) {
|
|
11467
|
-
var isTypeOfResult = type.isTypeOf(value, contextValue,
|
|
11467
|
+
var isTypeOfResult = type.isTypeOf(value, contextValue, info);
|
|
11468
11468
|
if ((0, _isPromise.default)(isTypeOfResult)) {
|
|
11469
11469
|
promisedIsTypeOfResults[i2] = isTypeOfResult;
|
|
11470
11470
|
} else if (isTypeOfResult) {
|
|
@@ -11483,11 +11483,11 @@ var require_execute = __commonJS({
|
|
|
11483
11483
|
}
|
|
11484
11484
|
};
|
|
11485
11485
|
exports.defaultTypeResolver = defaultTypeResolver;
|
|
11486
|
-
var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue,
|
|
11486
|
+
var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue, info) {
|
|
11487
11487
|
if ((0, _isObjectLike.default)(source) || typeof source === "function") {
|
|
11488
|
-
var property = source[
|
|
11488
|
+
var property = source[info.fieldName];
|
|
11489
11489
|
if (typeof property === "function") {
|
|
11490
|
-
return source[
|
|
11490
|
+
return source[info.fieldName](args, contextValue, info);
|
|
11491
11491
|
}
|
|
11492
11492
|
return property;
|
|
11493
11493
|
}
|
|
@@ -11513,7 +11513,7 @@ var require_graphql = __commonJS({
|
|
|
11513
11513
|
Object.defineProperty(exports, "__esModule", {
|
|
11514
11514
|
value: true
|
|
11515
11515
|
});
|
|
11516
|
-
exports.graphql =
|
|
11516
|
+
exports.graphql = graphql28;
|
|
11517
11517
|
exports.graphqlSync = graphqlSync;
|
|
11518
11518
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
11519
11519
|
var _parser = require_parser();
|
|
@@ -11523,7 +11523,7 @@ var require_graphql = __commonJS({
|
|
|
11523
11523
|
function _interopRequireDefault(obj) {
|
|
11524
11524
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
11525
11525
|
}
|
|
11526
|
-
function
|
|
11526
|
+
function graphql28(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
11527
11527
|
var _arguments = arguments;
|
|
11528
11528
|
return new Promise(function(resolve2) {
|
|
11529
11529
|
return resolve2(
|
|
@@ -12507,13 +12507,13 @@ var require_subscribe = __commonJS({
|
|
|
12507
12507
|
throw new _GraphQLError.GraphQLError('The subscription field "'.concat(fieldName, '" is not defined.'), fieldNodes);
|
|
12508
12508
|
}
|
|
12509
12509
|
var path2 = (0, _Path.addPath)(void 0, responseName, type.name);
|
|
12510
|
-
var
|
|
12510
|
+
var info = (0, _execute.buildResolveInfo)(exeContext, fieldDef, fieldNodes, type, path2);
|
|
12511
12511
|
return new Promise(function(resolveResult) {
|
|
12512
12512
|
var _fieldDef$subscribe;
|
|
12513
12513
|
var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], variableValues);
|
|
12514
12514
|
var contextValue = exeContext.contextValue;
|
|
12515
12515
|
var resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.fieldResolver;
|
|
12516
|
-
resolveResult(resolveFn(rootValue, args, contextValue,
|
|
12516
|
+
resolveResult(resolveFn(rootValue, args, contextValue, info));
|
|
12517
12517
|
}).then(function(eventStream) {
|
|
12518
12518
|
if (eventStream instanceof Error) {
|
|
12519
12519
|
throw (0, _locatedError.locatedError)(eventStream, fieldNodes, (0, _Path.pathToArray)(path2));
|
|
@@ -22321,42 +22321,42 @@ var require_node = __commonJS({
|
|
|
22321
22321
|
return Link2;
|
|
22322
22322
|
}(events_1.EventEmitter);
|
|
22323
22323
|
exports.Link = Link;
|
|
22324
|
-
var
|
|
22325
|
-
function
|
|
22324
|
+
var File3 = function() {
|
|
22325
|
+
function File4(link, node, flags, fd) {
|
|
22326
22326
|
this.position = 0;
|
|
22327
22327
|
this.link = link;
|
|
22328
22328
|
this.node = node;
|
|
22329
22329
|
this.flags = flags;
|
|
22330
22330
|
this.fd = fd;
|
|
22331
22331
|
}
|
|
22332
|
-
|
|
22332
|
+
File4.prototype.getString = function(encoding) {
|
|
22333
22333
|
if (encoding === void 0) {
|
|
22334
22334
|
encoding = "utf8";
|
|
22335
22335
|
}
|
|
22336
22336
|
return this.node.getString();
|
|
22337
22337
|
};
|
|
22338
|
-
|
|
22338
|
+
File4.prototype.setString = function(str) {
|
|
22339
22339
|
this.node.setString(str);
|
|
22340
22340
|
};
|
|
22341
|
-
|
|
22341
|
+
File4.prototype.getBuffer = function() {
|
|
22342
22342
|
return this.node.getBuffer();
|
|
22343
22343
|
};
|
|
22344
|
-
|
|
22344
|
+
File4.prototype.setBuffer = function(buf) {
|
|
22345
22345
|
this.node.setBuffer(buf);
|
|
22346
22346
|
};
|
|
22347
|
-
|
|
22347
|
+
File4.prototype.getSize = function() {
|
|
22348
22348
|
return this.node.getSize();
|
|
22349
22349
|
};
|
|
22350
|
-
|
|
22350
|
+
File4.prototype.truncate = function(len) {
|
|
22351
22351
|
this.node.truncate(len);
|
|
22352
22352
|
};
|
|
22353
|
-
|
|
22353
|
+
File4.prototype.seekTo = function(position) {
|
|
22354
22354
|
this.position = position;
|
|
22355
22355
|
};
|
|
22356
|
-
|
|
22356
|
+
File4.prototype.stats = function() {
|
|
22357
22357
|
return Stats_1.default.build(this.node);
|
|
22358
22358
|
};
|
|
22359
|
-
|
|
22359
|
+
File4.prototype.write = function(buf, offset, length, position) {
|
|
22360
22360
|
if (offset === void 0) {
|
|
22361
22361
|
offset = 0;
|
|
22362
22362
|
}
|
|
@@ -22371,7 +22371,7 @@ var require_node = __commonJS({
|
|
|
22371
22371
|
this.position = position + bytes;
|
|
22372
22372
|
return bytes;
|
|
22373
22373
|
};
|
|
22374
|
-
|
|
22374
|
+
File4.prototype.read = function(buf, offset, length, position) {
|
|
22375
22375
|
if (offset === void 0) {
|
|
22376
22376
|
offset = 0;
|
|
22377
22377
|
}
|
|
@@ -22384,15 +22384,15 @@ var require_node = __commonJS({
|
|
|
22384
22384
|
this.position = position + bytes;
|
|
22385
22385
|
return bytes;
|
|
22386
22386
|
};
|
|
22387
|
-
|
|
22387
|
+
File4.prototype.chmod = function(perm) {
|
|
22388
22388
|
this.node.chmod(perm);
|
|
22389
22389
|
};
|
|
22390
|
-
|
|
22390
|
+
File4.prototype.chown = function(uid, gid) {
|
|
22391
22391
|
this.node.chown(uid, gid);
|
|
22392
22392
|
};
|
|
22393
|
-
return
|
|
22393
|
+
return File4;
|
|
22394
22394
|
}();
|
|
22395
|
-
exports.File =
|
|
22395
|
+
exports.File = File3;
|
|
22396
22396
|
}
|
|
22397
22397
|
});
|
|
22398
22398
|
|
|
@@ -28501,9 +28501,9 @@ var require_streams = __commonJS({
|
|
|
28501
28501
|
}
|
|
28502
28502
|
}
|
|
28503
28503
|
try {
|
|
28504
|
-
const { Blob:
|
|
28505
|
-
if (
|
|
28506
|
-
|
|
28504
|
+
const { Blob: Blob3 } = __require("buffer");
|
|
28505
|
+
if (Blob3 && !Blob3.prototype.stream) {
|
|
28506
|
+
Blob3.prototype.stream = function name2(params) {
|
|
28507
28507
|
let position = 0;
|
|
28508
28508
|
const blob = this;
|
|
28509
28509
|
return new ReadableStream({
|
|
@@ -28554,12 +28554,12 @@ async function* toIterator(parts, clone2 = true) {
|
|
|
28554
28554
|
}
|
|
28555
28555
|
}
|
|
28556
28556
|
}
|
|
28557
|
-
var import_streams, POOL_SIZE, _Blob,
|
|
28557
|
+
var import_streams, POOL_SIZE, _Blob, Blob2, fetch_blob_default;
|
|
28558
28558
|
var init_fetch_blob = __esm({
|
|
28559
28559
|
"../../node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/index.js"() {
|
|
28560
28560
|
import_streams = __toESM(require_streams(), 1);
|
|
28561
28561
|
POOL_SIZE = 65536;
|
|
28562
|
-
_Blob = class
|
|
28562
|
+
_Blob = class Blob {
|
|
28563
28563
|
#parts = [];
|
|
28564
28564
|
#type = "";
|
|
28565
28565
|
#size = 0;
|
|
@@ -28583,7 +28583,7 @@ var init_fetch_blob = __esm({
|
|
|
28583
28583
|
part = new Uint8Array(element.buffer.slice(element.byteOffset, element.byteOffset + element.byteLength));
|
|
28584
28584
|
} else if (element instanceof ArrayBuffer) {
|
|
28585
28585
|
part = new Uint8Array(element.slice(0));
|
|
28586
|
-
} else if (element instanceof
|
|
28586
|
+
} else if (element instanceof Blob) {
|
|
28587
28587
|
part = element;
|
|
28588
28588
|
} else {
|
|
28589
28589
|
part = encoder.encode(`${element}`);
|
|
@@ -28662,7 +28662,7 @@ var init_fetch_blob = __esm({
|
|
|
28662
28662
|
relativeStart = 0;
|
|
28663
28663
|
}
|
|
28664
28664
|
}
|
|
28665
|
-
const blob = new
|
|
28665
|
+
const blob = new Blob([], { type: String(type).toLowerCase() });
|
|
28666
28666
|
blob.#size = span;
|
|
28667
28667
|
blob.#parts = blobParts;
|
|
28668
28668
|
return blob;
|
|
@@ -28679,17 +28679,17 @@ var init_fetch_blob = __esm({
|
|
|
28679
28679
|
type: { enumerable: true },
|
|
28680
28680
|
slice: { enumerable: true }
|
|
28681
28681
|
});
|
|
28682
|
-
|
|
28683
|
-
fetch_blob_default =
|
|
28682
|
+
Blob2 = _Blob;
|
|
28683
|
+
fetch_blob_default = Blob2;
|
|
28684
28684
|
}
|
|
28685
28685
|
});
|
|
28686
28686
|
|
|
28687
28687
|
// ../../node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/file.js
|
|
28688
|
-
var _File,
|
|
28688
|
+
var _File, File2, file_default;
|
|
28689
28689
|
var init_file = __esm({
|
|
28690
28690
|
"../../node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/file.js"() {
|
|
28691
28691
|
init_fetch_blob();
|
|
28692
|
-
_File = class
|
|
28692
|
+
_File = class File extends fetch_blob_default {
|
|
28693
28693
|
#lastModified = 0;
|
|
28694
28694
|
#name = "";
|
|
28695
28695
|
constructor(fileBits, fileName, options = {}) {
|
|
@@ -28718,8 +28718,8 @@ var init_file = __esm({
|
|
|
28718
28718
|
return !!object && object instanceof fetch_blob_default && /^(File)$/.test(object[Symbol.toStringTag]);
|
|
28719
28719
|
}
|
|
28720
28720
|
};
|
|
28721
|
-
|
|
28722
|
-
file_default =
|
|
28721
|
+
File2 = _File;
|
|
28722
|
+
file_default = File2;
|
|
28723
28723
|
}
|
|
28724
28724
|
});
|
|
28725
28725
|
|
|
@@ -28737,7 +28737,7 @@ Content-Type: ${v.type || "application/octet-stream"}\r
|
|
|
28737
28737
|
c.push(`--${b}--`);
|
|
28738
28738
|
return new B(c, { type: "multipart/form-data; boundary=" + b });
|
|
28739
28739
|
}
|
|
28740
|
-
var t, i, h, r, m, f, e, x,
|
|
28740
|
+
var t, i, h, r, m, f, e, x, FormData;
|
|
28741
28741
|
var init_esm_min = __esm({
|
|
28742
28742
|
"../../node_modules/.pnpm/formdata-polyfill@4.0.10/node_modules/formdata-polyfill/esm.min.js"() {
|
|
28743
28743
|
init_fetch_blob();
|
|
@@ -28752,7 +28752,7 @@ var init_esm_min = __esm({
|
|
|
28752
28752
|
throw new TypeError(`Failed to execute '${n}' on 'FormData': ${e2} arguments required, but only ${a.length} present.`);
|
|
28753
28753
|
}
|
|
28754
28754
|
};
|
|
28755
|
-
|
|
28755
|
+
FormData = class FormData2 {
|
|
28756
28756
|
#d = [];
|
|
28757
28757
|
constructor(...a) {
|
|
28758
28758
|
if (a.length)
|
|
@@ -28918,7 +28918,7 @@ async function toFormData(Body2, ct) {
|
|
|
28918
28918
|
let contentType;
|
|
28919
28919
|
let filename;
|
|
28920
28920
|
const entryChunks = [];
|
|
28921
|
-
const formData = new
|
|
28921
|
+
const formData = new FormData();
|
|
28922
28922
|
const onPartData = (ui8a) => {
|
|
28923
28923
|
entryValue += decoder.decode(ui8a, { stream: true });
|
|
28924
28924
|
};
|
|
@@ -56129,18 +56129,18 @@ var require_lines = __commonJS({
|
|
|
56129
56129
|
assert_1.default.strictEqual(typeof pos, "object");
|
|
56130
56130
|
assert_1.default.strictEqual(typeof pos.line, "number");
|
|
56131
56131
|
assert_1.default.strictEqual(typeof pos.column, "number");
|
|
56132
|
-
var line = pos.line, column = pos.column, secret = this, infos = secret.infos,
|
|
56133
|
-
if (typeof
|
|
56132
|
+
var line = pos.line, column = pos.column, secret = this, infos = secret.infos, info = infos[line - 1], c = column;
|
|
56133
|
+
if (typeof info === "undefined" || c < 0)
|
|
56134
56134
|
return "";
|
|
56135
56135
|
var indent2 = this.getIndentAt(line);
|
|
56136
56136
|
if (c < indent2)
|
|
56137
56137
|
return " ";
|
|
56138
|
-
c +=
|
|
56139
|
-
if (c ===
|
|
56138
|
+
c += info.sliceStart - indent2;
|
|
56139
|
+
if (c === info.sliceEnd && line < this.length)
|
|
56140
56140
|
return "\n";
|
|
56141
|
-
if (c >=
|
|
56141
|
+
if (c >= info.sliceEnd)
|
|
56142
56142
|
return "";
|
|
56143
|
-
return
|
|
56143
|
+
return info.line.charAt(c);
|
|
56144
56144
|
};
|
|
56145
56145
|
Lines2.prototype.stripMargin = function(width, skipFirstLine) {
|
|
56146
56146
|
if (width === 0)
|
|
@@ -56148,11 +56148,11 @@ var require_lines = __commonJS({
|
|
|
56148
56148
|
assert_1.default.ok(width > 0, "negative margin: " + width);
|
|
56149
56149
|
if (skipFirstLine && this.length === 1)
|
|
56150
56150
|
return this;
|
|
56151
|
-
var lines = new Lines2(this.infos.map(function(
|
|
56152
|
-
if (
|
|
56153
|
-
|
|
56151
|
+
var lines = new Lines2(this.infos.map(function(info, i2) {
|
|
56152
|
+
if (info.line && (i2 > 0 || !skipFirstLine)) {
|
|
56153
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: Math.max(0, info.indent - width) });
|
|
56154
56154
|
}
|
|
56155
|
-
return
|
|
56155
|
+
return info;
|
|
56156
56156
|
}));
|
|
56157
56157
|
if (this.mappings.length > 0) {
|
|
56158
56158
|
var newMappings_1 = lines.mappings;
|
|
@@ -56167,11 +56167,11 @@ var require_lines = __commonJS({
|
|
|
56167
56167
|
if (by === 0) {
|
|
56168
56168
|
return this;
|
|
56169
56169
|
}
|
|
56170
|
-
var lines = new Lines2(this.infos.map(function(
|
|
56171
|
-
if (
|
|
56172
|
-
|
|
56170
|
+
var lines = new Lines2(this.infos.map(function(info) {
|
|
56171
|
+
if (info.line && !info.locked) {
|
|
56172
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
|
|
56173
56173
|
}
|
|
56174
|
-
return
|
|
56174
|
+
return info;
|
|
56175
56175
|
}));
|
|
56176
56176
|
if (this.mappings.length > 0) {
|
|
56177
56177
|
var newMappings_2 = lines.mappings;
|
|
@@ -56189,11 +56189,11 @@ var require_lines = __commonJS({
|
|
|
56189
56189
|
if (this.length < 2) {
|
|
56190
56190
|
return this;
|
|
56191
56191
|
}
|
|
56192
|
-
var lines = new Lines2(this.infos.map(function(
|
|
56193
|
-
if (i2 > 0 &&
|
|
56194
|
-
|
|
56192
|
+
var lines = new Lines2(this.infos.map(function(info, i2) {
|
|
56193
|
+
if (i2 > 0 && info.line && !info.locked) {
|
|
56194
|
+
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
|
|
56195
56195
|
}
|
|
56196
|
-
return
|
|
56196
|
+
return info;
|
|
56197
56197
|
}));
|
|
56198
56198
|
if (this.mappings.length > 0) {
|
|
56199
56199
|
var newMappings_3 = lines.mappings;
|
|
@@ -56208,8 +56208,8 @@ var require_lines = __commonJS({
|
|
|
56208
56208
|
if (this.length < 2) {
|
|
56209
56209
|
return this;
|
|
56210
56210
|
}
|
|
56211
|
-
return new Lines2(this.infos.map(function(
|
|
56212
|
-
return tslib_1.__assign(tslib_1.__assign({},
|
|
56211
|
+
return new Lines2(this.infos.map(function(info, i2) {
|
|
56212
|
+
return tslib_1.__assign(tslib_1.__assign({}, info), { locked: i2 > 0 });
|
|
56213
56213
|
}));
|
|
56214
56214
|
};
|
|
56215
56215
|
Lines2.prototype.getIndentAt = function(line) {
|
|
@@ -56223,14 +56223,14 @@ var require_lines = __commonJS({
|
|
|
56223
56223
|
var counts = [];
|
|
56224
56224
|
var lastIndent = 0;
|
|
56225
56225
|
for (var line = 1, last = this.length; line <= last; ++line) {
|
|
56226
|
-
var
|
|
56227
|
-
var sliced =
|
|
56226
|
+
var info = this.infos[line - 1];
|
|
56227
|
+
var sliced = info.line.slice(info.sliceStart, info.sliceEnd);
|
|
56228
56228
|
if (isOnlyWhitespace(sliced)) {
|
|
56229
56229
|
continue;
|
|
56230
56230
|
}
|
|
56231
|
-
var diff = Math.abs(
|
|
56231
|
+
var diff = Math.abs(info.indent - lastIndent);
|
|
56232
56232
|
counts[diff] = ~~counts[diff] + 1;
|
|
56233
|
-
lastIndent =
|
|
56233
|
+
lastIndent = info.indent;
|
|
56234
56234
|
}
|
|
56235
56235
|
var maxCount = -1;
|
|
56236
56236
|
var result = 2;
|
|
@@ -56253,20 +56253,20 @@ var require_lines = __commonJS({
|
|
|
56253
56253
|
return isOnlyWhitespace(this.toString());
|
|
56254
56254
|
};
|
|
56255
56255
|
Lines2.prototype.isPrecededOnlyByWhitespace = function(pos) {
|
|
56256
|
-
var
|
|
56257
|
-
var indent2 = Math.max(
|
|
56256
|
+
var info = this.infos[pos.line - 1];
|
|
56257
|
+
var indent2 = Math.max(info.indent, 0);
|
|
56258
56258
|
var diff = pos.column - indent2;
|
|
56259
56259
|
if (diff <= 0) {
|
|
56260
56260
|
return true;
|
|
56261
56261
|
}
|
|
56262
|
-
var start =
|
|
56263
|
-
var end = Math.min(start + diff,
|
|
56264
|
-
var prefix =
|
|
56262
|
+
var start = info.sliceStart;
|
|
56263
|
+
var end = Math.min(start + diff, info.sliceEnd);
|
|
56264
|
+
var prefix = info.line.slice(start, end);
|
|
56265
56265
|
return isOnlyWhitespace(prefix);
|
|
56266
56266
|
};
|
|
56267
56267
|
Lines2.prototype.getLineLength = function(line) {
|
|
56268
|
-
var
|
|
56269
|
-
return this.getIndentAt(line) +
|
|
56268
|
+
var info = this.infos[line - 1];
|
|
56269
|
+
return this.getIndentAt(line) + info.sliceEnd - info.sliceStart;
|
|
56270
56270
|
};
|
|
56271
56271
|
Lines2.prototype.nextPos = function(pos, skipSpaces) {
|
|
56272
56272
|
if (skipSpaces === void 0) {
|
|
@@ -56432,20 +56432,20 @@ var require_lines = __commonJS({
|
|
|
56432
56432
|
var _a = (0, options_1.normalize)(options), tabWidth = _a.tabWidth, useTabs = _a.useTabs, reuseWhitespace = _a.reuseWhitespace, lineTerminator = _a.lineTerminator;
|
|
56433
56433
|
var parts = [];
|
|
56434
56434
|
for (var line = start.line; line <= end.line; ++line) {
|
|
56435
|
-
var
|
|
56435
|
+
var info = this.infos[line - 1];
|
|
56436
56436
|
if (line === start.line) {
|
|
56437
56437
|
if (line === end.line) {
|
|
56438
|
-
|
|
56438
|
+
info = sliceInfo(info, start.column, end.column);
|
|
56439
56439
|
} else {
|
|
56440
|
-
|
|
56440
|
+
info = sliceInfo(info, start.column);
|
|
56441
56441
|
}
|
|
56442
56442
|
} else if (line === end.line) {
|
|
56443
|
-
|
|
56443
|
+
info = sliceInfo(info, 0, end.column);
|
|
56444
56444
|
}
|
|
56445
|
-
var indent2 = Math.max(
|
|
56446
|
-
var before_1 =
|
|
56445
|
+
var indent2 = Math.max(info.indent, 0);
|
|
56446
|
+
var before_1 = info.line.slice(0, info.sliceStart);
|
|
56447
56447
|
if (reuseWhitespace && isOnlyWhitespace(before_1) && countSpaces(before_1, tabWidth) === indent2) {
|
|
56448
|
-
parts.push(
|
|
56448
|
+
parts.push(info.line.slice(0, info.sliceEnd));
|
|
56449
56449
|
continue;
|
|
56450
56450
|
}
|
|
56451
56451
|
var tabs = 0;
|
|
@@ -56461,7 +56461,7 @@ var require_lines = __commonJS({
|
|
|
56461
56461
|
if (spaces > 0) {
|
|
56462
56462
|
result += new Array(spaces + 1).join(" ");
|
|
56463
56463
|
}
|
|
56464
|
-
result +=
|
|
56464
|
+
result += info.line.slice(info.sliceStart, info.sliceEnd);
|
|
56465
56465
|
parts.push(result);
|
|
56466
56466
|
}
|
|
56467
56467
|
return parts.join(lineTerminator);
|
|
@@ -56479,12 +56479,12 @@ var require_lines = __commonJS({
|
|
|
56479
56479
|
return;
|
|
56480
56480
|
}
|
|
56481
56481
|
if (prevInfo) {
|
|
56482
|
-
var
|
|
56483
|
-
var indent2 = new Array(
|
|
56482
|
+
var info = linesOrNull.infos[0];
|
|
56483
|
+
var indent2 = new Array(info.indent + 1).join(" ");
|
|
56484
56484
|
var prevLine_1 = infos.length;
|
|
56485
56485
|
var prevColumn_1 = Math.max(prevInfo.indent, 0) + prevInfo.sliceEnd - prevInfo.sliceStart;
|
|
56486
|
-
prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent2 +
|
|
56487
|
-
prevInfo.locked = prevInfo.locked ||
|
|
56486
|
+
prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent2 + info.line.slice(info.sliceStart, info.sliceEnd);
|
|
56487
|
+
prevInfo.locked = prevInfo.locked || info.locked;
|
|
56488
56488
|
prevInfo.sliceEnd = prevInfo.line.length;
|
|
56489
56489
|
if (linesOrNull.mappings.length > 0) {
|
|
56490
56490
|
linesOrNull.mappings.forEach(function(mapping) {
|
|
@@ -56494,9 +56494,9 @@ var require_lines = __commonJS({
|
|
|
56494
56494
|
} else if (linesOrNull.mappings.length > 0) {
|
|
56495
56495
|
mappings.push.apply(mappings, linesOrNull.mappings);
|
|
56496
56496
|
}
|
|
56497
|
-
linesOrNull.infos.forEach(function(
|
|
56497
|
+
linesOrNull.infos.forEach(function(info2, i2) {
|
|
56498
56498
|
if (!prevInfo || i2 > 0) {
|
|
56499
|
-
prevInfo = tslib_1.__assign({},
|
|
56499
|
+
prevInfo = tslib_1.__assign({}, info2);
|
|
56500
56500
|
infos.push(prevInfo);
|
|
56501
56501
|
}
|
|
56502
56502
|
});
|
|
@@ -56600,10 +56600,10 @@ var require_lines = __commonJS({
|
|
|
56600
56600
|
function isOnlyWhitespace(string) {
|
|
56601
56601
|
return !/\S/.test(string);
|
|
56602
56602
|
}
|
|
56603
|
-
function sliceInfo(
|
|
56604
|
-
var sliceStart =
|
|
56605
|
-
var sliceEnd =
|
|
56606
|
-
var indent2 = Math.max(
|
|
56603
|
+
function sliceInfo(info, startCol, endCol) {
|
|
56604
|
+
var sliceStart = info.sliceStart;
|
|
56605
|
+
var sliceEnd = info.sliceEnd;
|
|
56606
|
+
var indent2 = Math.max(info.indent, 0);
|
|
56607
56607
|
var lineLength = indent2 + sliceEnd - sliceStart;
|
|
56608
56608
|
if (typeof endCol === "undefined") {
|
|
56609
56609
|
endCol = lineLength;
|
|
@@ -56629,11 +56629,11 @@ var require_lines = __commonJS({
|
|
|
56629
56629
|
assert_1.default.ok(indent2 >= 0);
|
|
56630
56630
|
assert_1.default.ok(sliceStart <= sliceEnd);
|
|
56631
56631
|
assert_1.default.strictEqual(lineLength, indent2 + sliceEnd - sliceStart);
|
|
56632
|
-
if (
|
|
56633
|
-
return
|
|
56632
|
+
if (info.indent === indent2 && info.sliceStart === sliceStart && info.sliceEnd === sliceEnd) {
|
|
56633
|
+
return info;
|
|
56634
56634
|
}
|
|
56635
56635
|
return {
|
|
56636
|
-
line:
|
|
56636
|
+
line: info.line,
|
|
56637
56637
|
indent: indent2,
|
|
56638
56638
|
locked: false,
|
|
56639
56639
|
sliceStart,
|
|
@@ -59640,9 +59640,9 @@ var require_printer2 = __commonJS({
|
|
|
59640
59640
|
var prevTrailingSpace = null;
|
|
59641
59641
|
var len = filtered.length;
|
|
59642
59642
|
var parts = [];
|
|
59643
|
-
filtered.forEach(function(
|
|
59644
|
-
var printed =
|
|
59645
|
-
var stmt =
|
|
59643
|
+
filtered.forEach(function(info, i2) {
|
|
59644
|
+
var printed = info.printed;
|
|
59645
|
+
var stmt = info.node;
|
|
59646
59646
|
var multiLine = printed.length > 1;
|
|
59647
59647
|
var notFirst = i2 > 0;
|
|
59648
59648
|
var notLast = i2 < len - 1;
|
|
@@ -60579,13 +60579,13 @@ var require_text = __commonJS({
|
|
|
60579
60579
|
"use strict";
|
|
60580
60580
|
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
|
60581
60581
|
try {
|
|
60582
|
-
var
|
|
60583
|
-
var value =
|
|
60582
|
+
var info = gen[key](arg);
|
|
60583
|
+
var value = info.value;
|
|
60584
60584
|
} catch (error) {
|
|
60585
60585
|
reject(error);
|
|
60586
60586
|
return;
|
|
60587
60587
|
}
|
|
60588
|
-
if (
|
|
60588
|
+
if (info.done) {
|
|
60589
60589
|
resolve2(value);
|
|
60590
60590
|
} else {
|
|
60591
60591
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -61339,13 +61339,13 @@ var require_date = __commonJS({
|
|
|
61339
61339
|
"use strict";
|
|
61340
61340
|
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
|
61341
61341
|
try {
|
|
61342
|
-
var
|
|
61343
|
-
var value =
|
|
61342
|
+
var info = gen[key](arg);
|
|
61343
|
+
var value = info.value;
|
|
61344
61344
|
} catch (error) {
|
|
61345
61345
|
reject(error);
|
|
61346
61346
|
return;
|
|
61347
61347
|
}
|
|
61348
|
-
if (
|
|
61348
|
+
if (info.done) {
|
|
61349
61349
|
resolve2(value);
|
|
61350
61350
|
} else {
|
|
61351
61351
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -61565,13 +61565,13 @@ var require_number = __commonJS({
|
|
|
61565
61565
|
"use strict";
|
|
61566
61566
|
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
|
61567
61567
|
try {
|
|
61568
|
-
var
|
|
61569
|
-
var value =
|
|
61568
|
+
var info = gen[key](arg);
|
|
61569
|
+
var value = info.value;
|
|
61570
61570
|
} catch (error) {
|
|
61571
61571
|
reject(error);
|
|
61572
61572
|
return;
|
|
61573
61573
|
}
|
|
61574
|
-
if (
|
|
61574
|
+
if (info.done) {
|
|
61575
61575
|
resolve2(value);
|
|
61576
61576
|
} else {
|
|
61577
61577
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -62023,13 +62023,13 @@ var require_autocomplete = __commonJS({
|
|
|
62023
62023
|
"use strict";
|
|
62024
62024
|
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
|
62025
62025
|
try {
|
|
62026
|
-
var
|
|
62027
|
-
var value =
|
|
62026
|
+
var info = gen[key](arg);
|
|
62027
|
+
var value = info.value;
|
|
62028
62028
|
} catch (error) {
|
|
62029
62029
|
reject(error);
|
|
62030
62030
|
return;
|
|
62031
62031
|
}
|
|
62032
|
-
if (
|
|
62032
|
+
if (info.done) {
|
|
62033
62033
|
resolve2(value);
|
|
62034
62034
|
} else {
|
|
62035
62035
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -62709,13 +62709,13 @@ var require_dist = __commonJS({
|
|
|
62709
62709
|
}
|
|
62710
62710
|
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
|
62711
62711
|
try {
|
|
62712
|
-
var
|
|
62713
|
-
var value =
|
|
62712
|
+
var info = gen[key](arg);
|
|
62713
|
+
var value = info.value;
|
|
62714
62714
|
} catch (error) {
|
|
62715
62715
|
reject(error);
|
|
62716
62716
|
return;
|
|
62717
62717
|
}
|
|
62718
|
-
if (
|
|
62718
|
+
if (info.done) {
|
|
62719
62719
|
resolve2(value);
|
|
62720
62720
|
} else {
|
|
62721
62721
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -68254,1719 +68254,6 @@ function computeID(configFile, type, data) {
|
|
|
68254
68254
|
return id.slice(0, -2);
|
|
68255
68255
|
}
|
|
68256
68256
|
|
|
68257
|
-
// src/runtime/lib/deepEquals.ts
|
|
68258
|
-
function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
|
|
68259
|
-
if (Object.is(objA, objB))
|
|
68260
|
-
return true;
|
|
68261
|
-
if (objA instanceof Date && objB instanceof Date) {
|
|
68262
|
-
return objA.getTime() === objB.getTime();
|
|
68263
|
-
}
|
|
68264
|
-
if (objA instanceof RegExp && objB instanceof RegExp) {
|
|
68265
|
-
return objA.toString() === objB.toString();
|
|
68266
|
-
}
|
|
68267
|
-
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
|
68268
|
-
return false;
|
|
68269
|
-
}
|
|
68270
|
-
if (map.get(objA) === objB)
|
|
68271
|
-
return true;
|
|
68272
|
-
map.set(objA, objB);
|
|
68273
|
-
const keysA = Reflect.ownKeys(objA);
|
|
68274
|
-
const keysB = Reflect.ownKeys(objB);
|
|
68275
|
-
if (keysA.length !== keysB.length) {
|
|
68276
|
-
return false;
|
|
68277
|
-
}
|
|
68278
|
-
for (let i2 = 0; i2 < keysA.length; i2++) {
|
|
68279
|
-
if (!Reflect.has(objB, keysA[i2]) || !deepEquals(objA[keysA[i2]], objB[keysA[i2]], map)) {
|
|
68280
|
-
return false;
|
|
68281
|
-
}
|
|
68282
|
-
}
|
|
68283
|
-
return true;
|
|
68284
|
-
}
|
|
68285
|
-
|
|
68286
|
-
// src/runtime/lib/selection.ts
|
|
68287
|
-
function getFieldsForType(selection2, __typename) {
|
|
68288
|
-
let targetSelection = selection2.fields || {};
|
|
68289
|
-
if (selection2.abstractFields && __typename) {
|
|
68290
|
-
const mappedType = selection2.abstractFields.typeMap[__typename];
|
|
68291
|
-
if (mappedType) {
|
|
68292
|
-
targetSelection = selection2.abstractFields.fields[mappedType];
|
|
68293
|
-
} else if (selection2.abstractFields.fields[__typename]) {
|
|
68294
|
-
targetSelection = selection2.abstractFields.fields[__typename];
|
|
68295
|
-
}
|
|
68296
|
-
}
|
|
68297
|
-
return targetSelection;
|
|
68298
|
-
}
|
|
68299
|
-
|
|
68300
|
-
// src/runtime/cache/gc.ts
|
|
68301
|
-
var GarbageCollector = class {
|
|
68302
|
-
cache;
|
|
68303
|
-
lifetimes = /* @__PURE__ */ new Map();
|
|
68304
|
-
get cacheBufferSize() {
|
|
68305
|
-
return this.cache._internal_unstable.config.cacheBufferSize ?? 10;
|
|
68306
|
-
}
|
|
68307
|
-
constructor(cache) {
|
|
68308
|
-
this.cache = cache;
|
|
68309
|
-
}
|
|
68310
|
-
resetLifetime(id, field) {
|
|
68311
|
-
if (!this.lifetimes.get(id)) {
|
|
68312
|
-
this.lifetimes.set(id, /* @__PURE__ */ new Map());
|
|
68313
|
-
}
|
|
68314
|
-
this.lifetimes.get(id).set(field, 0);
|
|
68315
|
-
}
|
|
68316
|
-
tick() {
|
|
68317
|
-
for (const [id, fieldMap] of this.lifetimes.entries()) {
|
|
68318
|
-
for (const [field, lifetime] of fieldMap.entries()) {
|
|
68319
|
-
if (this.cache._internal_unstable.subscriptions.get(id, field).length > 0) {
|
|
68320
|
-
continue;
|
|
68321
|
-
}
|
|
68322
|
-
fieldMap.set(field, lifetime + 1);
|
|
68323
|
-
if (fieldMap.get(field) > this.cacheBufferSize) {
|
|
68324
|
-
this.cache._internal_unstable.storage.deleteField(id, field);
|
|
68325
|
-
this.cache._internal_unstable.lists.deleteField(id, field);
|
|
68326
|
-
fieldMap.delete(field);
|
|
68327
|
-
if ([...fieldMap.keys()].length === 0) {
|
|
68328
|
-
this.lifetimes.delete(id);
|
|
68329
|
-
}
|
|
68330
|
-
}
|
|
68331
|
-
}
|
|
68332
|
-
}
|
|
68333
|
-
}
|
|
68334
|
-
};
|
|
68335
|
-
|
|
68336
|
-
// src/runtime/cache/stuff.ts
|
|
68337
|
-
function flattenList(source) {
|
|
68338
|
-
const flat = [];
|
|
68339
|
-
const unvisited = [source || []];
|
|
68340
|
-
while (unvisited.length > 0) {
|
|
68341
|
-
const target = unvisited.shift();
|
|
68342
|
-
for (const id of target) {
|
|
68343
|
-
if (Array.isArray(id)) {
|
|
68344
|
-
unvisited.push(id);
|
|
68345
|
-
continue;
|
|
68346
|
-
}
|
|
68347
|
-
flat.push(id);
|
|
68348
|
-
}
|
|
68349
|
-
}
|
|
68350
|
-
return flat;
|
|
68351
|
-
}
|
|
68352
|
-
function evaluateKey(key, variables = {}) {
|
|
68353
|
-
let evaluated = "";
|
|
68354
|
-
let varName = "";
|
|
68355
|
-
let inString = false;
|
|
68356
|
-
for (const char of key) {
|
|
68357
|
-
if (varName) {
|
|
68358
|
-
if (varChars.includes(char)) {
|
|
68359
|
-
varName += char;
|
|
68360
|
-
continue;
|
|
68361
|
-
}
|
|
68362
|
-
const value = variables[varName.slice(1)];
|
|
68363
|
-
evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
|
|
68364
|
-
varName = "";
|
|
68365
|
-
}
|
|
68366
|
-
if (char === "$" && !inString) {
|
|
68367
|
-
varName = "$";
|
|
68368
|
-
continue;
|
|
68369
|
-
}
|
|
68370
|
-
if (char === '"') {
|
|
68371
|
-
inString = !inString;
|
|
68372
|
-
}
|
|
68373
|
-
evaluated += char;
|
|
68374
|
-
}
|
|
68375
|
-
return evaluated;
|
|
68376
|
-
}
|
|
68377
|
-
var varChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
|
|
68378
|
-
|
|
68379
|
-
// src/runtime/cache/lists.ts
|
|
68380
|
-
var ListManager = class {
|
|
68381
|
-
rootID;
|
|
68382
|
-
cache;
|
|
68383
|
-
constructor(cache, rootID2) {
|
|
68384
|
-
this.rootID = rootID2;
|
|
68385
|
-
this.cache = cache;
|
|
68386
|
-
}
|
|
68387
|
-
lists = /* @__PURE__ */ new Map();
|
|
68388
|
-
listsByField = /* @__PURE__ */ new Map();
|
|
68389
|
-
get(listName, id, allLists) {
|
|
68390
|
-
const matches = this.lists.get(listName);
|
|
68391
|
-
if (!matches || matches.size === 0) {
|
|
68392
|
-
return null;
|
|
68393
|
-
}
|
|
68394
|
-
if (allLists) {
|
|
68395
|
-
return new ListCollection(
|
|
68396
|
-
Array.from(matches, ([key, value]) => [...value.lists]).flat()
|
|
68397
|
-
);
|
|
68398
|
-
}
|
|
68399
|
-
const head = [...matches.values()][0];
|
|
68400
|
-
const { recordType } = head.lists[0];
|
|
68401
|
-
const parentID = id ? this.cache._internal_unstable.id(recordType || "", id) : this.rootID;
|
|
68402
|
-
if (matches?.size === 1) {
|
|
68403
|
-
if (!id) {
|
|
68404
|
-
return head;
|
|
68405
|
-
}
|
|
68406
|
-
return parentID === Array.from(matches.keys())[0] ? head : null;
|
|
68407
|
-
}
|
|
68408
|
-
if (!id) {
|
|
68409
|
-
console.error(
|
|
68410
|
-
`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 `
|
|
68411
|
-
);
|
|
68412
|
-
return null;
|
|
68413
|
-
}
|
|
68414
|
-
return this.lists.get(listName)?.get(parentID);
|
|
68415
|
-
}
|
|
68416
|
-
remove(listName, id) {
|
|
68417
|
-
this.lists.get(listName)?.delete(id || this.rootID);
|
|
68418
|
-
}
|
|
68419
|
-
add(list) {
|
|
68420
|
-
if (!this.lists.has(list.name)) {
|
|
68421
|
-
this.lists.set(list.name, /* @__PURE__ */ new Map());
|
|
68422
|
-
}
|
|
68423
|
-
const name2 = list.name;
|
|
68424
|
-
const parentID = list.recordID || this.rootID;
|
|
68425
|
-
if (this.lists.get(name2)?.get(parentID)?.includes(list.key)) {
|
|
68426
|
-
return;
|
|
68427
|
-
}
|
|
68428
|
-
if (!this.lists.has(name2)) {
|
|
68429
|
-
this.lists.set(name2, /* @__PURE__ */ new Map());
|
|
68430
|
-
}
|
|
68431
|
-
if (!this.lists.get(name2).has(parentID)) {
|
|
68432
|
-
this.lists.get(name2).set(parentID, new ListCollection([]));
|
|
68433
|
-
}
|
|
68434
|
-
if (!this.listsByField.has(parentID)) {
|
|
68435
|
-
this.listsByField.set(parentID, /* @__PURE__ */ new Map());
|
|
68436
|
-
}
|
|
68437
|
-
if (!this.listsByField.get(parentID).has(list.key)) {
|
|
68438
|
-
this.listsByField.get(parentID)?.set(list.key, []);
|
|
68439
|
-
}
|
|
68440
|
-
const handler = new List({ ...list, manager: this });
|
|
68441
|
-
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
68442
|
-
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
68443
|
-
}
|
|
68444
|
-
removeIDFromAllLists(id) {
|
|
68445
|
-
for (const fieldMap of this.lists.values()) {
|
|
68446
|
-
for (const list of fieldMap.values()) {
|
|
68447
|
-
list.removeID(id);
|
|
68448
|
-
}
|
|
68449
|
-
}
|
|
68450
|
-
}
|
|
68451
|
-
deleteField(parentID, field) {
|
|
68452
|
-
if (!this.listsByField.get(parentID)?.has(field)) {
|
|
68453
|
-
return;
|
|
68454
|
-
}
|
|
68455
|
-
for (const list of this.listsByField.get(parentID).get(field)) {
|
|
68456
|
-
this.lists.get(list.name)?.get(list.recordID)?.deleteListWithKey(field);
|
|
68457
|
-
if (this.lists.get(list.name)?.get(list.recordID)?.lists.length === 0) {
|
|
68458
|
-
this.lists.get(list.name)?.delete(list.recordID);
|
|
68459
|
-
}
|
|
68460
|
-
}
|
|
68461
|
-
this.listsByField.get(parentID).delete(field);
|
|
68462
|
-
}
|
|
68463
|
-
};
|
|
68464
|
-
var List = class {
|
|
68465
|
-
recordID;
|
|
68466
|
-
recordType;
|
|
68467
|
-
key;
|
|
68468
|
-
type;
|
|
68469
|
-
cache;
|
|
68470
|
-
selection;
|
|
68471
|
-
_when;
|
|
68472
|
-
filters;
|
|
68473
|
-
name;
|
|
68474
|
-
connection;
|
|
68475
|
-
manager;
|
|
68476
|
-
abstract;
|
|
68477
|
-
constructor({
|
|
68478
|
-
name: name2,
|
|
68479
|
-
recordID,
|
|
68480
|
-
recordType,
|
|
68481
|
-
key,
|
|
68482
|
-
listType,
|
|
68483
|
-
selection: selection2,
|
|
68484
|
-
when,
|
|
68485
|
-
filters,
|
|
68486
|
-
connection,
|
|
68487
|
-
manager,
|
|
68488
|
-
abstract
|
|
68489
|
-
}) {
|
|
68490
|
-
this.recordID = recordID || rootID;
|
|
68491
|
-
this.recordType = recordType;
|
|
68492
|
-
this.key = key;
|
|
68493
|
-
this.type = listType;
|
|
68494
|
-
this.cache = manager.cache;
|
|
68495
|
-
this.selection = selection2;
|
|
68496
|
-
this._when = when;
|
|
68497
|
-
this.filters = filters;
|
|
68498
|
-
this.name = name2;
|
|
68499
|
-
this.connection = connection;
|
|
68500
|
-
this.manager = manager;
|
|
68501
|
-
this.abstract = abstract;
|
|
68502
|
-
}
|
|
68503
|
-
when(when) {
|
|
68504
|
-
return this.manager.lists.get(this.name).get(this.recordID).when(when);
|
|
68505
|
-
}
|
|
68506
|
-
append(selection2, data, variables = {}) {
|
|
68507
|
-
return this.addToList(selection2, data, variables, "last");
|
|
68508
|
-
}
|
|
68509
|
-
prepend(selection2, data, variables = {}) {
|
|
68510
|
-
return this.addToList(selection2, data, variables, "first");
|
|
68511
|
-
}
|
|
68512
|
-
addToList(selection2, data, variables = {}, where) {
|
|
68513
|
-
const listType = this.listType(data);
|
|
68514
|
-
const dataID = this.cache._internal_unstable.id(listType, data);
|
|
68515
|
-
if (!this.validateWhen() || !dataID) {
|
|
68516
|
-
return;
|
|
68517
|
-
}
|
|
68518
|
-
let insertSelection = selection2;
|
|
68519
|
-
let insertData = data;
|
|
68520
|
-
if (this.connection) {
|
|
68521
|
-
insertSelection = {
|
|
68522
|
-
fields: {
|
|
68523
|
-
newEntry: {
|
|
68524
|
-
keyRaw: this.key,
|
|
68525
|
-
type: "Connection",
|
|
68526
|
-
selection: {
|
|
68527
|
-
fields: {
|
|
68528
|
-
edges: {
|
|
68529
|
-
keyRaw: "edges",
|
|
68530
|
-
type: "ConnectionEdge",
|
|
68531
|
-
update: where === "first" ? "prepend" : "append",
|
|
68532
|
-
selection: {
|
|
68533
|
-
fields: {
|
|
68534
|
-
node: {
|
|
68535
|
-
type: listType,
|
|
68536
|
-
keyRaw: "node",
|
|
68537
|
-
selection: {
|
|
68538
|
-
...selection2,
|
|
68539
|
-
fields: {
|
|
68540
|
-
...selection2.fields,
|
|
68541
|
-
__typename: {
|
|
68542
|
-
keyRaw: "__typename",
|
|
68543
|
-
type: "String"
|
|
68544
|
-
}
|
|
68545
|
-
}
|
|
68546
|
-
}
|
|
68547
|
-
}
|
|
68548
|
-
}
|
|
68549
|
-
}
|
|
68550
|
-
}
|
|
68551
|
-
}
|
|
68552
|
-
}
|
|
68553
|
-
}
|
|
68554
|
-
}
|
|
68555
|
-
};
|
|
68556
|
-
insertData = {
|
|
68557
|
-
newEntry: {
|
|
68558
|
-
edges: [{ node: { ...data, __typename: listType } }]
|
|
68559
|
-
}
|
|
68560
|
-
};
|
|
68561
|
-
} else {
|
|
68562
|
-
insertSelection = {
|
|
68563
|
-
fields: {
|
|
68564
|
-
newEntries: {
|
|
68565
|
-
keyRaw: this.key,
|
|
68566
|
-
type: listType,
|
|
68567
|
-
update: where === "first" ? "prepend" : "append",
|
|
68568
|
-
selection: {
|
|
68569
|
-
...selection2,
|
|
68570
|
-
fields: {
|
|
68571
|
-
...selection2.fields,
|
|
68572
|
-
__typename: {
|
|
68573
|
-
keyRaw: "__typename",
|
|
68574
|
-
type: "String"
|
|
68575
|
-
}
|
|
68576
|
-
}
|
|
68577
|
-
}
|
|
68578
|
-
}
|
|
68579
|
-
}
|
|
68580
|
-
};
|
|
68581
|
-
insertData = {
|
|
68582
|
-
newEntries: [{ ...data, __typename: listType }]
|
|
68583
|
-
};
|
|
68584
|
-
}
|
|
68585
|
-
this.cache.write({
|
|
68586
|
-
selection: insertSelection,
|
|
68587
|
-
data: insertData,
|
|
68588
|
-
variables,
|
|
68589
|
-
parent: this.recordID,
|
|
68590
|
-
applyUpdates: true
|
|
68591
|
-
});
|
|
68592
|
-
}
|
|
68593
|
-
removeID(id, variables = {}) {
|
|
68594
|
-
if (!this.validateWhen()) {
|
|
68595
|
-
return;
|
|
68596
|
-
}
|
|
68597
|
-
let parentID = this.recordID;
|
|
68598
|
-
let targetID = id;
|
|
68599
|
-
let targetKey = this.key;
|
|
68600
|
-
if (this.connection) {
|
|
68601
|
-
const { value: embeddedConnection } = this.cache._internal_unstable.storage.get(
|
|
68602
|
-
this.recordID,
|
|
68603
|
-
this.key
|
|
68604
|
-
);
|
|
68605
|
-
if (!embeddedConnection) {
|
|
68606
|
-
return;
|
|
68607
|
-
}
|
|
68608
|
-
const embeddedConnectionID = embeddedConnection;
|
|
68609
|
-
const { value: edges } = this.cache._internal_unstable.storage.get(
|
|
68610
|
-
embeddedConnectionID,
|
|
68611
|
-
"edges"
|
|
68612
|
-
);
|
|
68613
|
-
for (const edge of flattenList(edges) || []) {
|
|
68614
|
-
if (!edge) {
|
|
68615
|
-
continue;
|
|
68616
|
-
}
|
|
68617
|
-
const edgeID = edge;
|
|
68618
|
-
const { value: nodeID } = this.cache._internal_unstable.storage.get(edgeID, "node");
|
|
68619
|
-
if (!nodeID) {
|
|
68620
|
-
continue;
|
|
68621
|
-
}
|
|
68622
|
-
if (nodeID === id) {
|
|
68623
|
-
targetID = edgeID;
|
|
68624
|
-
}
|
|
68625
|
-
}
|
|
68626
|
-
parentID = embeddedConnectionID;
|
|
68627
|
-
targetKey = "edges";
|
|
68628
|
-
}
|
|
68629
|
-
let value = this.cache._internal_unstable.storage.get(parentID, targetKey).value;
|
|
68630
|
-
if (!value || !value.includes(targetID)) {
|
|
68631
|
-
return;
|
|
68632
|
-
}
|
|
68633
|
-
const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
|
|
68634
|
-
this.cache._internal_unstable.subscriptions.remove(
|
|
68635
|
-
targetID,
|
|
68636
|
-
this.connection ? this.selection.fields.edges.selection : this.selection,
|
|
68637
|
-
subscribers,
|
|
68638
|
-
variables
|
|
68639
|
-
);
|
|
68640
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
68641
|
-
for (const spec of subscribers) {
|
|
68642
|
-
spec.set(
|
|
68643
|
-
this.cache._internal_unstable.getSelection({
|
|
68644
|
-
parent: spec.parentID || this.manager.rootID,
|
|
68645
|
-
selection: spec.selection,
|
|
68646
|
-
variables: spec.variables?.() || {}
|
|
68647
|
-
}).data
|
|
68648
|
-
);
|
|
68649
|
-
}
|
|
68650
|
-
return true;
|
|
68651
|
-
}
|
|
68652
|
-
remove(data, variables = {}) {
|
|
68653
|
-
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
68654
|
-
if (!targetID) {
|
|
68655
|
-
return;
|
|
68656
|
-
}
|
|
68657
|
-
return this.removeID(targetID, variables);
|
|
68658
|
-
}
|
|
68659
|
-
listType(data) {
|
|
68660
|
-
return data.__typename || this.type;
|
|
68661
|
-
}
|
|
68662
|
-
validateWhen(when) {
|
|
68663
|
-
let filters = when || this._when;
|
|
68664
|
-
let ok = true;
|
|
68665
|
-
if (filters) {
|
|
68666
|
-
const targets = this.filters;
|
|
68667
|
-
if (filters.must && targets) {
|
|
68668
|
-
ok = Object.entries(filters.must).reduce(
|
|
68669
|
-
(prev, [key, value]) => Boolean(prev && targets[key] == value),
|
|
68670
|
-
ok
|
|
68671
|
-
);
|
|
68672
|
-
}
|
|
68673
|
-
if (filters.must_not) {
|
|
68674
|
-
ok = !targets || Object.entries(filters.must_not).reduce(
|
|
68675
|
-
(prev, [key, value]) => Boolean(prev && targets[key] != value),
|
|
68676
|
-
ok
|
|
68677
|
-
);
|
|
68678
|
-
}
|
|
68679
|
-
}
|
|
68680
|
-
return ok;
|
|
68681
|
-
}
|
|
68682
|
-
toggleElement(selection2, data, variables = {}, where) {
|
|
68683
|
-
if (!this.remove(data, variables)) {
|
|
68684
|
-
this.addToList(selection2, data, variables, where);
|
|
68685
|
-
}
|
|
68686
|
-
}
|
|
68687
|
-
*[Symbol.iterator]() {
|
|
68688
|
-
let entries = [];
|
|
68689
|
-
let value = this.cache._internal_unstable.storage.get(this.recordID, this.key).value;
|
|
68690
|
-
if (!this.connection) {
|
|
68691
|
-
entries = flattenList(value);
|
|
68692
|
-
} else {
|
|
68693
|
-
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
68694
|
-
}
|
|
68695
|
-
for (let record2 of entries) {
|
|
68696
|
-
yield record2;
|
|
68697
|
-
}
|
|
68698
|
-
}
|
|
68699
|
-
};
|
|
68700
|
-
var ListCollection = class {
|
|
68701
|
-
lists = [];
|
|
68702
|
-
constructor(lists) {
|
|
68703
|
-
this.lists = lists;
|
|
68704
|
-
}
|
|
68705
|
-
append(...args) {
|
|
68706
|
-
this.lists.forEach((list) => list.append(...args));
|
|
68707
|
-
}
|
|
68708
|
-
prepend(...args) {
|
|
68709
|
-
this.lists.forEach((list) => list.prepend(...args));
|
|
68710
|
-
}
|
|
68711
|
-
addToList(...args) {
|
|
68712
|
-
this.lists.forEach((list) => list.addToList(...args));
|
|
68713
|
-
}
|
|
68714
|
-
removeID(...args) {
|
|
68715
|
-
this.lists.forEach((list) => list.removeID(...args));
|
|
68716
|
-
}
|
|
68717
|
-
remove(...args) {
|
|
68718
|
-
this.lists.forEach((list) => list.remove(...args));
|
|
68719
|
-
}
|
|
68720
|
-
toggleElement(...args) {
|
|
68721
|
-
this.lists.forEach((list) => list.toggleElement(...args));
|
|
68722
|
-
}
|
|
68723
|
-
when(when) {
|
|
68724
|
-
return new ListCollection(
|
|
68725
|
-
this.lists.filter((list) => {
|
|
68726
|
-
return list.validateWhen(when);
|
|
68727
|
-
})
|
|
68728
|
-
);
|
|
68729
|
-
}
|
|
68730
|
-
includes(key) {
|
|
68731
|
-
return !!this.lists.find((list) => list.key === key);
|
|
68732
|
-
}
|
|
68733
|
-
deleteListWithKey(key) {
|
|
68734
|
-
return this.lists = this.lists.filter((list) => list.key !== key);
|
|
68735
|
-
}
|
|
68736
|
-
*[Symbol.iterator]() {
|
|
68737
|
-
for (let list of this.lists) {
|
|
68738
|
-
for (const entry of list) {
|
|
68739
|
-
yield entry;
|
|
68740
|
-
}
|
|
68741
|
-
}
|
|
68742
|
-
}
|
|
68743
|
-
};
|
|
68744
|
-
|
|
68745
|
-
// src/runtime/cache/schema.ts
|
|
68746
|
-
var SchemaManager = class {
|
|
68747
|
-
cache;
|
|
68748
|
-
fieldTypes = {};
|
|
68749
|
-
constructor(cache) {
|
|
68750
|
-
this.cache = cache;
|
|
68751
|
-
}
|
|
68752
|
-
setFieldType({
|
|
68753
|
-
parent,
|
|
68754
|
-
key,
|
|
68755
|
-
type,
|
|
68756
|
-
nullable = false,
|
|
68757
|
-
link
|
|
68758
|
-
}) {
|
|
68759
|
-
let parensIndex = key.indexOf("(");
|
|
68760
|
-
if (parensIndex !== -1) {
|
|
68761
|
-
key = key.substring(0, parensIndex);
|
|
68762
|
-
}
|
|
68763
|
-
if (parent === rootID) {
|
|
68764
|
-
parent = "Query";
|
|
68765
|
-
} else if (parent.includes(":")) {
|
|
68766
|
-
parent = parent.substring(0, parent.indexOf(":"));
|
|
68767
|
-
}
|
|
68768
|
-
if (!this.fieldTypes[parent]) {
|
|
68769
|
-
this.fieldTypes[parent] = {};
|
|
68770
|
-
}
|
|
68771
|
-
this.fieldTypes[parent][key] = {
|
|
68772
|
-
type,
|
|
68773
|
-
nullable,
|
|
68774
|
-
link: !!link
|
|
68775
|
-
};
|
|
68776
|
-
}
|
|
68777
|
-
fieldType(type, field) {
|
|
68778
|
-
return this.fieldTypes[type]?.[field] || null;
|
|
68779
|
-
}
|
|
68780
|
-
get config() {
|
|
68781
|
-
return this.cache._internal_unstable.config;
|
|
68782
|
-
}
|
|
68783
|
-
};
|
|
68784
|
-
|
|
68785
|
-
// src/runtime/cache/storage.ts
|
|
68786
|
-
var InMemoryStorage = class {
|
|
68787
|
-
data;
|
|
68788
|
-
idCount = 0;
|
|
68789
|
-
rank = 0;
|
|
68790
|
-
constructor() {
|
|
68791
|
-
this.data = [];
|
|
68792
|
-
}
|
|
68793
|
-
get layerCount() {
|
|
68794
|
-
return this.data.length;
|
|
68795
|
-
}
|
|
68796
|
-
get nextRank() {
|
|
68797
|
-
return this.rank++;
|
|
68798
|
-
}
|
|
68799
|
-
createLayer(optimistic = false) {
|
|
68800
|
-
const layer = new Layer(this.idCount++);
|
|
68801
|
-
layer.optimistic = optimistic;
|
|
68802
|
-
this.data.push(layer);
|
|
68803
|
-
return layer;
|
|
68804
|
-
}
|
|
68805
|
-
insert(id, field, location, target) {
|
|
68806
|
-
return this.topLayer.insert(id, field, location, target);
|
|
68807
|
-
}
|
|
68808
|
-
remove(id, field, target) {
|
|
68809
|
-
return this.topLayer.remove(id, field, target);
|
|
68810
|
-
}
|
|
68811
|
-
delete(id) {
|
|
68812
|
-
return this.topLayer.delete(id);
|
|
68813
|
-
}
|
|
68814
|
-
deleteField(id, field) {
|
|
68815
|
-
return this.topLayer.deleteField(id, field);
|
|
68816
|
-
}
|
|
68817
|
-
getLayer(id) {
|
|
68818
|
-
for (const layer of this.data) {
|
|
68819
|
-
if (layer.id === id) {
|
|
68820
|
-
return layer;
|
|
68821
|
-
}
|
|
68822
|
-
}
|
|
68823
|
-
throw new Error("Could not find layer with id: " + id);
|
|
68824
|
-
}
|
|
68825
|
-
replaceID(replacement) {
|
|
68826
|
-
for (const layer of this.data) {
|
|
68827
|
-
layer.replaceID(replacement);
|
|
68828
|
-
}
|
|
68829
|
-
}
|
|
68830
|
-
get(id, field) {
|
|
68831
|
-
const operations = {
|
|
68832
|
-
[OperationKind.insert]: {
|
|
68833
|
-
[OperationLocation.start]: [],
|
|
68834
|
-
[OperationLocation.end]: []
|
|
68835
|
-
},
|
|
68836
|
-
[OperationKind.remove]: /* @__PURE__ */ new Set()
|
|
68837
|
-
};
|
|
68838
|
-
const layerIDs = [];
|
|
68839
|
-
for (let i2 = this.data.length - 1; i2 >= 0; i2--) {
|
|
68840
|
-
const layer = this.data[i2];
|
|
68841
|
-
const [layerValue, kind] = layer.get(id, field);
|
|
68842
|
-
const layerOperations = layer.getOperations(id, field) || [];
|
|
68843
|
-
layer.deletedIDs.forEach((v) => {
|
|
68844
|
-
if (layer.operations[v]?.undoDeletesInList?.includes(field)) {
|
|
68845
|
-
return;
|
|
68846
|
-
}
|
|
68847
|
-
operations.remove.add(v);
|
|
68848
|
-
});
|
|
68849
|
-
if (typeof layerValue === "undefined" && layerOperations.length === 0) {
|
|
68850
|
-
if (layer.deletedIDs.size > 0) {
|
|
68851
|
-
layerIDs.push(layer.id);
|
|
68852
|
-
}
|
|
68853
|
-
continue;
|
|
68854
|
-
}
|
|
68855
|
-
if (typeof layerValue !== "undefined" && !Array.isArray(layerValue)) {
|
|
68856
|
-
return {
|
|
68857
|
-
value: layerValue,
|
|
68858
|
-
kind,
|
|
68859
|
-
displayLayers: [layer.id]
|
|
68860
|
-
};
|
|
68861
|
-
}
|
|
68862
|
-
layerIDs.push(layer.id);
|
|
68863
|
-
if (layerOperations.length > 0) {
|
|
68864
|
-
for (const op of layerOperations) {
|
|
68865
|
-
if (isRemoveOperation(op)) {
|
|
68866
|
-
operations.remove.add(op.id);
|
|
68867
|
-
}
|
|
68868
|
-
if (isInsertOperation(op)) {
|
|
68869
|
-
operations.insert[op.location].unshift(op.id);
|
|
68870
|
-
}
|
|
68871
|
-
if (isDeleteOperation(op)) {
|
|
68872
|
-
return {
|
|
68873
|
-
value: void 0,
|
|
68874
|
-
kind: "unknown",
|
|
68875
|
-
displayLayers: []
|
|
68876
|
-
};
|
|
68877
|
-
}
|
|
68878
|
-
}
|
|
68879
|
-
}
|
|
68880
|
-
if (typeof layerValue === "undefined") {
|
|
68881
|
-
continue;
|
|
68882
|
-
}
|
|
68883
|
-
if (!operations.remove.size && !operations.insert.start.length && !operations.insert.end.length) {
|
|
68884
|
-
return { value: layerValue, displayLayers: layerIDs, kind: "link" };
|
|
68885
|
-
}
|
|
68886
|
-
return {
|
|
68887
|
-
value: [...operations.insert.start, ...layerValue, ...operations.insert.end].filter(
|
|
68888
|
-
(value) => !operations.remove.has(value)
|
|
68889
|
-
),
|
|
68890
|
-
displayLayers: layerIDs,
|
|
68891
|
-
kind
|
|
68892
|
-
};
|
|
68893
|
-
}
|
|
68894
|
-
return {
|
|
68895
|
-
value: void 0,
|
|
68896
|
-
kind: "unknown",
|
|
68897
|
-
displayLayers: []
|
|
68898
|
-
};
|
|
68899
|
-
}
|
|
68900
|
-
writeLink(id, field, value) {
|
|
68901
|
-
return this.topLayer.writeLink(id, field, value);
|
|
68902
|
-
}
|
|
68903
|
-
writeField(id, field, value) {
|
|
68904
|
-
return this.topLayer.writeField(id, field, value);
|
|
68905
|
-
}
|
|
68906
|
-
resolveLayer(id) {
|
|
68907
|
-
let startingIndex = null;
|
|
68908
|
-
for (const [index, layer] of this.data.entries()) {
|
|
68909
|
-
if (layer.id !== id) {
|
|
68910
|
-
continue;
|
|
68911
|
-
}
|
|
68912
|
-
startingIndex = index - 1;
|
|
68913
|
-
this.data[index].optimistic = false;
|
|
68914
|
-
break;
|
|
68915
|
-
}
|
|
68916
|
-
if (startingIndex === null) {
|
|
68917
|
-
throw new Error("could not find layer with id: " + id);
|
|
68918
|
-
}
|
|
68919
|
-
if (startingIndex === -1) {
|
|
68920
|
-
startingIndex = 0;
|
|
68921
|
-
}
|
|
68922
|
-
if (this.data[startingIndex].optimistic) {
|
|
68923
|
-
startingIndex++;
|
|
68924
|
-
}
|
|
68925
|
-
const baseLayer = this.data[startingIndex];
|
|
68926
|
-
let layerIndex = startingIndex;
|
|
68927
|
-
while (layerIndex < this.data.length) {
|
|
68928
|
-
const layer = this.data[layerIndex++];
|
|
68929
|
-
if (layer.optimistic) {
|
|
68930
|
-
layerIndex--;
|
|
68931
|
-
break;
|
|
68932
|
-
}
|
|
68933
|
-
baseLayer.writeLayer(layer);
|
|
68934
|
-
}
|
|
68935
|
-
this.data.splice(startingIndex + 1, layerIndex - startingIndex - 1);
|
|
68936
|
-
}
|
|
68937
|
-
get topLayer() {
|
|
68938
|
-
if (this.data.length === 0) {
|
|
68939
|
-
this.createLayer();
|
|
68940
|
-
}
|
|
68941
|
-
if (this.data[this.data.length - 1]?.optimistic) {
|
|
68942
|
-
this.createLayer();
|
|
68943
|
-
}
|
|
68944
|
-
return this.data[this.data.length - 1];
|
|
68945
|
-
}
|
|
68946
|
-
};
|
|
68947
|
-
var Layer = class {
|
|
68948
|
-
id;
|
|
68949
|
-
optimistic = false;
|
|
68950
|
-
fields = {};
|
|
68951
|
-
links = {};
|
|
68952
|
-
operations = {};
|
|
68953
|
-
deletedIDs = /* @__PURE__ */ new Set();
|
|
68954
|
-
constructor(id) {
|
|
68955
|
-
this.id = id;
|
|
68956
|
-
}
|
|
68957
|
-
get(id, field) {
|
|
68958
|
-
if (typeof this.links[id]?.[field] !== "undefined") {
|
|
68959
|
-
return [this.links[id][field], "link"];
|
|
68960
|
-
}
|
|
68961
|
-
return [this.fields[id]?.[field], "scalar"];
|
|
68962
|
-
}
|
|
68963
|
-
getOperations(id, field) {
|
|
68964
|
-
if (this.operations[id]?.deleted) {
|
|
68965
|
-
return [
|
|
68966
|
-
{
|
|
68967
|
-
kind: OperationKind.delete,
|
|
68968
|
-
target: id
|
|
68969
|
-
}
|
|
68970
|
-
];
|
|
68971
|
-
}
|
|
68972
|
-
if (this.operations[id]?.fields?.[field]) {
|
|
68973
|
-
return this.operations[id].fields[field];
|
|
68974
|
-
}
|
|
68975
|
-
}
|
|
68976
|
-
writeField(id, field, value) {
|
|
68977
|
-
this.fields[id] = {
|
|
68978
|
-
...this.fields[id],
|
|
68979
|
-
[field]: value
|
|
68980
|
-
};
|
|
68981
|
-
return this.id;
|
|
68982
|
-
}
|
|
68983
|
-
writeLink(id, field, value) {
|
|
68984
|
-
const valueList = Array.isArray(value) ? value : [value];
|
|
68985
|
-
for (const value2 of flattenList(valueList)) {
|
|
68986
|
-
if (!value2) {
|
|
68987
|
-
continue;
|
|
68988
|
-
}
|
|
68989
|
-
const fieldOperations = this.operations[id]?.fields[field];
|
|
68990
|
-
if (this.operations[value2]?.deleted || this.deletedIDs.has(value2)) {
|
|
68991
|
-
this.operations[value2] = {
|
|
68992
|
-
...this.operations[value2],
|
|
68993
|
-
undoDeletesInList: [...this.operations[id]?.undoDeletesInList || [], field]
|
|
68994
|
-
};
|
|
68995
|
-
} else if (value2 && fieldOperations?.length > 0) {
|
|
68996
|
-
this.operations[id].fields[field] = fieldOperations.filter(
|
|
68997
|
-
(op) => op.kind !== "remove" || op.id !== value2
|
|
68998
|
-
);
|
|
68999
|
-
}
|
|
69000
|
-
}
|
|
69001
|
-
this.links[id] = {
|
|
69002
|
-
...this.links[id],
|
|
69003
|
-
[field]: value
|
|
69004
|
-
};
|
|
69005
|
-
return this.id;
|
|
69006
|
-
}
|
|
69007
|
-
isDisplayLayer(displayLayers) {
|
|
69008
|
-
return displayLayers.length === 0 || displayLayers.includes(this.id) || Math.max(...displayLayers) < this.id;
|
|
69009
|
-
}
|
|
69010
|
-
clear() {
|
|
69011
|
-
this.links = {};
|
|
69012
|
-
this.fields = {};
|
|
69013
|
-
this.operations = {};
|
|
69014
|
-
this.deletedIDs = /* @__PURE__ */ new Set();
|
|
69015
|
-
}
|
|
69016
|
-
replaceID({ from, to }) {
|
|
69017
|
-
this.fields[to] = this.fields[from];
|
|
69018
|
-
this.links[to] = this.links[from];
|
|
69019
|
-
this.operations[to] = this.operations[from] || { fields: {} };
|
|
69020
|
-
if (this.deletedIDs.has(from)) {
|
|
69021
|
-
this.deletedIDs.add(to);
|
|
69022
|
-
}
|
|
69023
|
-
}
|
|
69024
|
-
removeUndefinedFields() {
|
|
69025
|
-
for (const [id, fields] of Object.entries(this.fields)) {
|
|
69026
|
-
for (const [field, value] of Object.entries(fields)) {
|
|
69027
|
-
if (typeof value === "undefined") {
|
|
69028
|
-
try {
|
|
69029
|
-
delete this.fields[id][field];
|
|
69030
|
-
} catch {
|
|
69031
|
-
}
|
|
69032
|
-
try {
|
|
69033
|
-
delete this.links[id][field];
|
|
69034
|
-
} catch {
|
|
69035
|
-
}
|
|
69036
|
-
}
|
|
69037
|
-
}
|
|
69038
|
-
if (Object.keys(fields || {}).length === 0) {
|
|
69039
|
-
delete this.fields[id];
|
|
69040
|
-
}
|
|
69041
|
-
if (Object.keys(this.links[id] || {}).length === 0) {
|
|
69042
|
-
delete this.links[id];
|
|
69043
|
-
}
|
|
69044
|
-
}
|
|
69045
|
-
}
|
|
69046
|
-
delete(id) {
|
|
69047
|
-
this.operations = {
|
|
69048
|
-
...this.operations,
|
|
69049
|
-
[id]: {
|
|
69050
|
-
...this.operations[id],
|
|
69051
|
-
deleted: true,
|
|
69052
|
-
undoDeletesInList: []
|
|
69053
|
-
}
|
|
69054
|
-
};
|
|
69055
|
-
this.deletedIDs.add(id);
|
|
69056
|
-
}
|
|
69057
|
-
deleteField(id, field) {
|
|
69058
|
-
this.fields[id] = {
|
|
69059
|
-
...this.fields[id],
|
|
69060
|
-
[field]: void 0
|
|
69061
|
-
};
|
|
69062
|
-
}
|
|
69063
|
-
insert(id, field, where, target) {
|
|
69064
|
-
this.addFieldOperation(id, field, {
|
|
69065
|
-
kind: OperationKind.insert,
|
|
69066
|
-
id: target,
|
|
69067
|
-
location: where
|
|
69068
|
-
});
|
|
69069
|
-
}
|
|
69070
|
-
remove(id, field, target) {
|
|
69071
|
-
this.addFieldOperation(id, field, {
|
|
69072
|
-
kind: OperationKind.remove,
|
|
69073
|
-
id: target
|
|
69074
|
-
});
|
|
69075
|
-
}
|
|
69076
|
-
writeLayer(layer) {
|
|
69077
|
-
if (layer.id === this.id) {
|
|
69078
|
-
return;
|
|
69079
|
-
}
|
|
69080
|
-
for (const [id, ops] of Object.entries(layer.operations)) {
|
|
69081
|
-
const fields = {};
|
|
69082
|
-
for (const opMap of [this.operations[id], layer.operations[id]].filter(Boolean)) {
|
|
69083
|
-
for (const [fieldName, operations] of Object.entries(opMap.fields || {})) {
|
|
69084
|
-
fields[fieldName] = [...fields[fieldName] || [], ...operations];
|
|
69085
|
-
}
|
|
69086
|
-
}
|
|
69087
|
-
if (Object.keys(fields).length > 0) {
|
|
69088
|
-
this.operations[id] = {
|
|
69089
|
-
...this.operations[id],
|
|
69090
|
-
fields
|
|
69091
|
-
};
|
|
69092
|
-
}
|
|
69093
|
-
if (ops?.deleted) {
|
|
69094
|
-
delete this.fields[id];
|
|
69095
|
-
delete this.links[id];
|
|
69096
|
-
}
|
|
69097
|
-
}
|
|
69098
|
-
for (const [id, values] of Object.entries(layer.fields)) {
|
|
69099
|
-
if (!values) {
|
|
69100
|
-
continue;
|
|
69101
|
-
}
|
|
69102
|
-
for (const [field, value] of Object.entries(values)) {
|
|
69103
|
-
this.writeField(id, field, value);
|
|
69104
|
-
}
|
|
69105
|
-
}
|
|
69106
|
-
for (const [id, values] of Object.entries(layer.links)) {
|
|
69107
|
-
if (!values) {
|
|
69108
|
-
continue;
|
|
69109
|
-
}
|
|
69110
|
-
for (const [field, value] of Object.entries(values)) {
|
|
69111
|
-
this.writeLink(id, field, value);
|
|
69112
|
-
}
|
|
69113
|
-
}
|
|
69114
|
-
layer.deletedIDs.forEach((v) => this.deletedIDs.add(v));
|
|
69115
|
-
}
|
|
69116
|
-
addFieldOperation(id, field, operation) {
|
|
69117
|
-
this.operations = {
|
|
69118
|
-
...this.operations,
|
|
69119
|
-
[id]: {
|
|
69120
|
-
...this.operations[id],
|
|
69121
|
-
fields: {
|
|
69122
|
-
[field]: [...this.operations[id]?.fields[field] || [], operation]
|
|
69123
|
-
}
|
|
69124
|
-
}
|
|
69125
|
-
};
|
|
69126
|
-
}
|
|
69127
|
-
};
|
|
69128
|
-
function isDeleteOperation(value) {
|
|
69129
|
-
return !!value && value.kind === OperationKind.delete;
|
|
69130
|
-
}
|
|
69131
|
-
function isInsertOperation(value) {
|
|
69132
|
-
return !!value && value.kind === OperationKind.insert;
|
|
69133
|
-
}
|
|
69134
|
-
function isRemoveOperation(value) {
|
|
69135
|
-
return !!value && value.kind === OperationKind.remove;
|
|
69136
|
-
}
|
|
69137
|
-
var OperationLocation = /* @__PURE__ */ ((OperationLocation2) => {
|
|
69138
|
-
OperationLocation2["start"] = "start";
|
|
69139
|
-
OperationLocation2["end"] = "end";
|
|
69140
|
-
return OperationLocation2;
|
|
69141
|
-
})(OperationLocation || {});
|
|
69142
|
-
var OperationKind = /* @__PURE__ */ ((OperationKind2) => {
|
|
69143
|
-
OperationKind2["delete"] = "delete";
|
|
69144
|
-
OperationKind2["insert"] = "insert";
|
|
69145
|
-
OperationKind2["remove"] = "remove";
|
|
69146
|
-
return OperationKind2;
|
|
69147
|
-
})(OperationKind || {});
|
|
69148
|
-
|
|
69149
|
-
// src/runtime/cache/subscription.ts
|
|
69150
|
-
var InMemorySubscriptions = class {
|
|
69151
|
-
cache;
|
|
69152
|
-
constructor(cache) {
|
|
69153
|
-
this.cache = cache;
|
|
69154
|
-
}
|
|
69155
|
-
subscribers = {};
|
|
69156
|
-
referenceCounts = {};
|
|
69157
|
-
keyVersions = {};
|
|
69158
|
-
add({
|
|
69159
|
-
parent,
|
|
69160
|
-
spec,
|
|
69161
|
-
selection: selection2,
|
|
69162
|
-
variables,
|
|
69163
|
-
parentType
|
|
69164
|
-
}) {
|
|
69165
|
-
const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
|
|
69166
|
-
let targetSelection = getFieldsForType(selection2, __typename);
|
|
69167
|
-
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
69168
|
-
const { keyRaw, selection: innerSelection, type } = fieldSelection;
|
|
69169
|
-
const key = evaluateKey(keyRaw, variables);
|
|
69170
|
-
this.addFieldSubscription({
|
|
69171
|
-
id: parent,
|
|
69172
|
-
key,
|
|
69173
|
-
field: fieldSelection,
|
|
69174
|
-
spec,
|
|
69175
|
-
parentType: parentType || spec.rootType,
|
|
69176
|
-
variables
|
|
69177
|
-
});
|
|
69178
|
-
if (innerSelection) {
|
|
69179
|
-
const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
|
|
69180
|
-
parent,
|
|
69181
|
-
key
|
|
69182
|
-
);
|
|
69183
|
-
let children = !Array.isArray(linkedRecord) ? [linkedRecord] : flattenList(linkedRecord) || [];
|
|
69184
|
-
for (const child of children) {
|
|
69185
|
-
if (!child) {
|
|
69186
|
-
continue;
|
|
69187
|
-
}
|
|
69188
|
-
this.add({
|
|
69189
|
-
parent: child,
|
|
69190
|
-
spec,
|
|
69191
|
-
selection: innerSelection,
|
|
69192
|
-
variables,
|
|
69193
|
-
parentType: type
|
|
69194
|
-
});
|
|
69195
|
-
}
|
|
69196
|
-
}
|
|
69197
|
-
}
|
|
69198
|
-
}
|
|
69199
|
-
addFieldSubscription({
|
|
69200
|
-
id,
|
|
69201
|
-
key,
|
|
69202
|
-
field,
|
|
69203
|
-
spec,
|
|
69204
|
-
parentType,
|
|
69205
|
-
variables
|
|
69206
|
-
}) {
|
|
69207
|
-
if (!this.subscribers[id]) {
|
|
69208
|
-
this.subscribers[id] = {};
|
|
69209
|
-
}
|
|
69210
|
-
if (!this.subscribers[id][key]) {
|
|
69211
|
-
this.subscribers[id][key] = [];
|
|
69212
|
-
}
|
|
69213
|
-
if (!this.keyVersions[key]) {
|
|
69214
|
-
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
69215
|
-
}
|
|
69216
|
-
this.keyVersions[key].add(key);
|
|
69217
|
-
if (!this.subscribers[id][key].map(({ set }) => set).includes(spec.set)) {
|
|
69218
|
-
this.subscribers[id][key].push(spec);
|
|
69219
|
-
}
|
|
69220
|
-
if (!this.referenceCounts[id]) {
|
|
69221
|
-
this.referenceCounts[id] = {};
|
|
69222
|
-
}
|
|
69223
|
-
if (!this.referenceCounts[id][key]) {
|
|
69224
|
-
this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
|
|
69225
|
-
}
|
|
69226
|
-
const counts = this.referenceCounts[id][key];
|
|
69227
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
69228
|
-
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
69229
|
-
const { selection: selection2, list, filters } = field;
|
|
69230
|
-
if (selection2 && list) {
|
|
69231
|
-
this.cache._internal_unstable.lists.add({
|
|
69232
|
-
name: list.name,
|
|
69233
|
-
connection: list.connection,
|
|
69234
|
-
recordID: id,
|
|
69235
|
-
recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
|
|
69236
|
-
listType: list.type,
|
|
69237
|
-
key,
|
|
69238
|
-
selection: selection2,
|
|
69239
|
-
filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
|
|
69240
|
-
return {
|
|
69241
|
-
...acc,
|
|
69242
|
-
[key2]: kind !== "Variable" ? value : variables[value]
|
|
69243
|
-
};
|
|
69244
|
-
}, {})
|
|
69245
|
-
});
|
|
69246
|
-
}
|
|
69247
|
-
}
|
|
69248
|
-
addMany({
|
|
69249
|
-
parent,
|
|
69250
|
-
selection: selection2,
|
|
69251
|
-
variables,
|
|
69252
|
-
subscribers,
|
|
69253
|
-
parentType
|
|
69254
|
-
}) {
|
|
69255
|
-
let targetSelection = getFieldsForType(selection2, parentType);
|
|
69256
|
-
for (const fieldSelection of Object.values(targetSelection)) {
|
|
69257
|
-
const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
|
|
69258
|
-
const key = evaluateKey(keyRaw, variables);
|
|
69259
|
-
for (const spec of subscribers) {
|
|
69260
|
-
this.addFieldSubscription({
|
|
69261
|
-
id: parent,
|
|
69262
|
-
key,
|
|
69263
|
-
field: fieldSelection,
|
|
69264
|
-
spec,
|
|
69265
|
-
parentType,
|
|
69266
|
-
variables
|
|
69267
|
-
});
|
|
69268
|
-
}
|
|
69269
|
-
if (innerSelection) {
|
|
69270
|
-
const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
|
|
69271
|
-
const children = !Array.isArray(link) ? [link] : flattenList(link);
|
|
69272
|
-
for (const linkedRecord of children) {
|
|
69273
|
-
if (!linkedRecord) {
|
|
69274
|
-
continue;
|
|
69275
|
-
}
|
|
69276
|
-
this.addMany({
|
|
69277
|
-
parent: linkedRecord,
|
|
69278
|
-
selection: innerSelection,
|
|
69279
|
-
variables,
|
|
69280
|
-
subscribers,
|
|
69281
|
-
parentType: linkedType
|
|
69282
|
-
});
|
|
69283
|
-
}
|
|
69284
|
-
}
|
|
69285
|
-
}
|
|
69286
|
-
}
|
|
69287
|
-
get(id, field) {
|
|
69288
|
-
return this.subscribers[id]?.[field] || [];
|
|
69289
|
-
}
|
|
69290
|
-
remove(id, selection2, targets, variables, visited = []) {
|
|
69291
|
-
visited.push(id);
|
|
69292
|
-
const linkedIDs = [];
|
|
69293
|
-
for (const fieldSelection of Object.values(selection2.fields || {})) {
|
|
69294
|
-
const key = evaluateKey(fieldSelection.keyRaw, variables);
|
|
69295
|
-
this.removeSubscribers(id, key, targets);
|
|
69296
|
-
if (!fieldSelection.selection?.fields) {
|
|
69297
|
-
continue;
|
|
69298
|
-
}
|
|
69299
|
-
const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
|
|
69300
|
-
const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
|
|
69301
|
-
for (const link of links) {
|
|
69302
|
-
if (link !== null) {
|
|
69303
|
-
linkedIDs.push([link, fieldSelection.selection || {}]);
|
|
69304
|
-
}
|
|
69305
|
-
}
|
|
69306
|
-
}
|
|
69307
|
-
for (const [linkedRecordID, linkFields] of linkedIDs) {
|
|
69308
|
-
this.remove(linkedRecordID, linkFields, targets, visited);
|
|
69309
|
-
}
|
|
69310
|
-
}
|
|
69311
|
-
removeSubscribers(id, fieldName, specs) {
|
|
69312
|
-
let targets = [];
|
|
69313
|
-
for (const spec of specs) {
|
|
69314
|
-
if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
|
|
69315
|
-
continue;
|
|
69316
|
-
}
|
|
69317
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
69318
|
-
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
69319
|
-
counts.set(spec.set, newVal);
|
|
69320
|
-
if (newVal <= 0) {
|
|
69321
|
-
targets.push(spec.set);
|
|
69322
|
-
counts.delete(spec.set);
|
|
69323
|
-
}
|
|
69324
|
-
}
|
|
69325
|
-
if (this.subscribers[id]) {
|
|
69326
|
-
this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
|
|
69327
|
-
({ set }) => !targets.includes(set)
|
|
69328
|
-
);
|
|
69329
|
-
}
|
|
69330
|
-
}
|
|
69331
|
-
removeAllSubscribers(id, targets, visited = []) {
|
|
69332
|
-
visited.push(id);
|
|
69333
|
-
for (const field of Object.keys(this.subscribers[id] || [])) {
|
|
69334
|
-
const subscribers = targets || this.subscribers[id][field];
|
|
69335
|
-
this.removeSubscribers(id, field, subscribers);
|
|
69336
|
-
const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
|
|
69337
|
-
if (kind === "scalar") {
|
|
69338
|
-
continue;
|
|
69339
|
-
}
|
|
69340
|
-
const nextTargets = Array.isArray(value) ? flattenList(value) : [value];
|
|
69341
|
-
for (const id2 of nextTargets) {
|
|
69342
|
-
if (visited.includes(id2)) {
|
|
69343
|
-
continue;
|
|
69344
|
-
}
|
|
69345
|
-
this.removeAllSubscribers(id2, subscribers, visited);
|
|
69346
|
-
}
|
|
69347
|
-
}
|
|
69348
|
-
}
|
|
69349
|
-
};
|
|
69350
|
-
|
|
69351
|
-
// src/runtime/cache/cache.ts
|
|
69352
|
-
var Cache3 = class {
|
|
69353
|
-
_internal_unstable;
|
|
69354
|
-
constructor(config2) {
|
|
69355
|
-
this._internal_unstable = new CacheInternal({
|
|
69356
|
-
cache: this,
|
|
69357
|
-
storage: new InMemoryStorage(),
|
|
69358
|
-
subscriptions: new InMemorySubscriptions(this),
|
|
69359
|
-
lists: new ListManager(this, rootID),
|
|
69360
|
-
lifetimes: new GarbageCollector(this),
|
|
69361
|
-
schema: new SchemaManager(this)
|
|
69362
|
-
});
|
|
69363
|
-
if (config2) {
|
|
69364
|
-
this.setConfig(defaultConfigValues(config2));
|
|
69365
|
-
}
|
|
69366
|
-
}
|
|
69367
|
-
write({
|
|
69368
|
-
layer: layerID,
|
|
69369
|
-
notifySubscribers = [],
|
|
69370
|
-
...args
|
|
69371
|
-
}) {
|
|
69372
|
-
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
69373
|
-
const subscribers = this._internal_unstable.writeSelection({ ...args, layer });
|
|
69374
|
-
const notified = [];
|
|
69375
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
69376
|
-
if (!notified.includes(spec.set)) {
|
|
69377
|
-
notified.push(spec.set);
|
|
69378
|
-
spec.set(
|
|
69379
|
-
this._internal_unstable.getSelection({
|
|
69380
|
-
parent: spec.parentID || rootID,
|
|
69381
|
-
selection: spec.selection,
|
|
69382
|
-
variables: spec.variables?.() || {}
|
|
69383
|
-
}).data
|
|
69384
|
-
);
|
|
69385
|
-
}
|
|
69386
|
-
}
|
|
69387
|
-
return subscribers;
|
|
69388
|
-
}
|
|
69389
|
-
read(...args) {
|
|
69390
|
-
const { data, partial, hasData } = this._internal_unstable.getSelection(...args);
|
|
69391
|
-
if (!hasData) {
|
|
69392
|
-
return { data: null, partial: false };
|
|
69393
|
-
}
|
|
69394
|
-
return {
|
|
69395
|
-
data,
|
|
69396
|
-
partial
|
|
69397
|
-
};
|
|
69398
|
-
}
|
|
69399
|
-
subscribe(spec, variables = {}) {
|
|
69400
|
-
return this._internal_unstable.subscriptions.add({
|
|
69401
|
-
parent: spec.parentID || rootID,
|
|
69402
|
-
spec,
|
|
69403
|
-
selection: spec.selection,
|
|
69404
|
-
variables
|
|
69405
|
-
});
|
|
69406
|
-
}
|
|
69407
|
-
unsubscribe(spec, variables = {}) {
|
|
69408
|
-
return this._internal_unstable.subscriptions.remove(
|
|
69409
|
-
spec.parentID || rootID,
|
|
69410
|
-
spec.selection,
|
|
69411
|
-
[spec],
|
|
69412
|
-
variables
|
|
69413
|
-
);
|
|
69414
|
-
}
|
|
69415
|
-
list(name2, parentID, allLists) {
|
|
69416
|
-
const handler = this._internal_unstable.lists.get(name2, parentID, allLists);
|
|
69417
|
-
if (!handler) {
|
|
69418
|
-
throw new Error(
|
|
69419
|
-
`Cannot find list with name: ${name2}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
|
|
69420
|
-
);
|
|
69421
|
-
}
|
|
69422
|
-
return handler;
|
|
69423
|
-
}
|
|
69424
|
-
delete(id) {
|
|
69425
|
-
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
69426
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
69427
|
-
this._internal_unstable.storage.delete(id);
|
|
69428
|
-
}
|
|
69429
|
-
setConfig(config2) {
|
|
69430
|
-
this._internal_unstable.setConfig(config2);
|
|
69431
|
-
}
|
|
69432
|
-
};
|
|
69433
|
-
var CacheInternal = class {
|
|
69434
|
-
_disabled = false;
|
|
69435
|
-
config = defaultConfigValues({
|
|
69436
|
-
plugins: {
|
|
69437
|
-
"houdini-svelte": {
|
|
69438
|
-
client: ""
|
|
69439
|
-
}
|
|
69440
|
-
}
|
|
69441
|
-
});
|
|
69442
|
-
storage;
|
|
69443
|
-
subscriptions;
|
|
69444
|
-
lists;
|
|
69445
|
-
cache;
|
|
69446
|
-
lifetimes;
|
|
69447
|
-
schema;
|
|
69448
|
-
constructor({
|
|
69449
|
-
storage,
|
|
69450
|
-
subscriptions,
|
|
69451
|
-
lists,
|
|
69452
|
-
cache,
|
|
69453
|
-
lifetimes,
|
|
69454
|
-
schema
|
|
69455
|
-
}) {
|
|
69456
|
-
this.storage = storage;
|
|
69457
|
-
this.subscriptions = subscriptions;
|
|
69458
|
-
this.lists = lists;
|
|
69459
|
-
this.cache = cache;
|
|
69460
|
-
this.lifetimes = lifetimes;
|
|
69461
|
-
this.schema = schema;
|
|
69462
|
-
this._disabled = typeof globalThis.window === "undefined";
|
|
69463
|
-
try {
|
|
69464
|
-
if (process.env.HOUDINI_TEST === "true") {
|
|
69465
|
-
this._disabled = false;
|
|
69466
|
-
}
|
|
69467
|
-
} catch {
|
|
69468
|
-
}
|
|
69469
|
-
}
|
|
69470
|
-
setConfig(config2) {
|
|
69471
|
-
this.config = config2;
|
|
69472
|
-
}
|
|
69473
|
-
writeSelection({
|
|
69474
|
-
data,
|
|
69475
|
-
selection: selection2,
|
|
69476
|
-
variables = {},
|
|
69477
|
-
parent = rootID,
|
|
69478
|
-
applyUpdates = false,
|
|
69479
|
-
layer,
|
|
69480
|
-
toNotify = [],
|
|
69481
|
-
forceNotify
|
|
69482
|
-
}) {
|
|
69483
|
-
if (this._disabled) {
|
|
69484
|
-
return [];
|
|
69485
|
-
}
|
|
69486
|
-
let targetSelection = getFieldsForType(selection2, data["__typename"]);
|
|
69487
|
-
for (const [field, value] of Object.entries(data)) {
|
|
69488
|
-
if (!selection2 || !targetSelection[field]) {
|
|
69489
|
-
throw new Error(
|
|
69490
|
-
"Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
|
|
69491
|
-
);
|
|
69492
|
-
}
|
|
69493
|
-
let {
|
|
69494
|
-
type: linkedType,
|
|
69495
|
-
keyRaw,
|
|
69496
|
-
selection: fieldSelection,
|
|
69497
|
-
operations,
|
|
69498
|
-
abstract: isAbstract,
|
|
69499
|
-
update,
|
|
69500
|
-
nullable
|
|
69501
|
-
} = targetSelection[field];
|
|
69502
|
-
const key = evaluateKey(keyRaw, variables);
|
|
69503
|
-
this.schema.setFieldType({
|
|
69504
|
-
parent,
|
|
69505
|
-
key: keyRaw,
|
|
69506
|
-
type: linkedType,
|
|
69507
|
-
nullable,
|
|
69508
|
-
link: !!fieldSelection
|
|
69509
|
-
});
|
|
69510
|
-
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
69511
|
-
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
69512
|
-
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
69513
|
-
if (displayLayer) {
|
|
69514
|
-
this.lifetimes.resetLifetime(parent, key);
|
|
69515
|
-
}
|
|
69516
|
-
if (!fieldSelection) {
|
|
69517
|
-
let newValue = value;
|
|
69518
|
-
if (Array.isArray(value) && applyUpdates && update) {
|
|
69519
|
-
if (update === "append") {
|
|
69520
|
-
newValue = (previousValue || []).concat(value);
|
|
69521
|
-
} else if (update === "prepend") {
|
|
69522
|
-
newValue = value.concat(previousValue || []);
|
|
69523
|
-
}
|
|
69524
|
-
}
|
|
69525
|
-
const valueChanged = !deepEquals(newValue, previousValue);
|
|
69526
|
-
if (displayLayer && (valueChanged || forceNotify)) {
|
|
69527
|
-
toNotify.push(...currentSubscribers);
|
|
69528
|
-
}
|
|
69529
|
-
layer.writeField(parent, key, newValue);
|
|
69530
|
-
} else if (value === null) {
|
|
69531
|
-
if (previousValue === null) {
|
|
69532
|
-
continue;
|
|
69533
|
-
}
|
|
69534
|
-
const previousLinks = flattenList([previousValue]);
|
|
69535
|
-
for (const link of previousLinks) {
|
|
69536
|
-
this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
|
|
69537
|
-
}
|
|
69538
|
-
layer.writeLink(parent, key, null);
|
|
69539
|
-
toNotify.push(...currentSubscribers);
|
|
69540
|
-
} else if (value instanceof Object && !Array.isArray(value)) {
|
|
69541
|
-
if (isAbstract) {
|
|
69542
|
-
if (!value.__typename) {
|
|
69543
|
-
throw new Error(
|
|
69544
|
-
"Encountered interface type without __typename in the payload"
|
|
69545
|
-
);
|
|
69546
|
-
}
|
|
69547
|
-
linkedType = value.__typename;
|
|
69548
|
-
}
|
|
69549
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
69550
|
-
(field2) => typeof value[field2] === "undefined"
|
|
69551
|
-
).length > 0;
|
|
69552
|
-
let linkedID = null;
|
|
69553
|
-
if (value !== null) {
|
|
69554
|
-
linkedID = !embedded ? this.id(linkedType, value) : `${parent}.${key}`;
|
|
69555
|
-
}
|
|
69556
|
-
let linkChange = linkedID !== previousValue;
|
|
69557
|
-
layer.writeLink(parent, key, linkedID);
|
|
69558
|
-
if (linkedID && displayLayer && (linkChange || forceNotify)) {
|
|
69559
|
-
if (previousValue && typeof previousValue === "string") {
|
|
69560
|
-
this.subscriptions.remove(
|
|
69561
|
-
previousValue,
|
|
69562
|
-
fieldSelection,
|
|
69563
|
-
currentSubscribers,
|
|
69564
|
-
variables
|
|
69565
|
-
);
|
|
69566
|
-
}
|
|
69567
|
-
this.subscriptions.addMany({
|
|
69568
|
-
parent: linkedID,
|
|
69569
|
-
selection: fieldSelection,
|
|
69570
|
-
subscribers: currentSubscribers,
|
|
69571
|
-
variables,
|
|
69572
|
-
parentType: linkedType
|
|
69573
|
-
});
|
|
69574
|
-
toNotify.push(...currentSubscribers);
|
|
69575
|
-
}
|
|
69576
|
-
if (linkedID) {
|
|
69577
|
-
this.writeSelection({
|
|
69578
|
-
selection: fieldSelection,
|
|
69579
|
-
parent: linkedID,
|
|
69580
|
-
data: value,
|
|
69581
|
-
variables,
|
|
69582
|
-
toNotify,
|
|
69583
|
-
applyUpdates,
|
|
69584
|
-
layer,
|
|
69585
|
-
forceNotify
|
|
69586
|
-
});
|
|
69587
|
-
}
|
|
69588
|
-
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
|
|
69589
|
-
let oldIDs = [...previousValue || []];
|
|
69590
|
-
const emptyEdges = !update ? [] : oldIDs.map((id) => {
|
|
69591
|
-
if (!id) {
|
|
69592
|
-
return "";
|
|
69593
|
-
}
|
|
69594
|
-
const { value: cursorField } = this.storage.get(id, "cursor");
|
|
69595
|
-
if (cursorField) {
|
|
69596
|
-
return "";
|
|
69597
|
-
}
|
|
69598
|
-
const { value: node } = this.storage.get(id, "node");
|
|
69599
|
-
if (!node) {
|
|
69600
|
-
return "";
|
|
69601
|
-
}
|
|
69602
|
-
return node;
|
|
69603
|
-
});
|
|
69604
|
-
let linkedIDs = [];
|
|
69605
|
-
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
69606
|
-
value,
|
|
69607
|
-
abstract: Boolean(isAbstract),
|
|
69608
|
-
specs: toNotify,
|
|
69609
|
-
applyUpdates,
|
|
69610
|
-
recordID: parent,
|
|
69611
|
-
key,
|
|
69612
|
-
linkedType,
|
|
69613
|
-
variables,
|
|
69614
|
-
fields: fieldSelection,
|
|
69615
|
-
layer,
|
|
69616
|
-
forceNotify
|
|
69617
|
-
});
|
|
69618
|
-
if (applyUpdates && update) {
|
|
69619
|
-
if (key === "edges") {
|
|
69620
|
-
const newNodeIDs = [];
|
|
69621
|
-
for (const id of newIDs) {
|
|
69622
|
-
if (!id) {
|
|
69623
|
-
continue;
|
|
69624
|
-
}
|
|
69625
|
-
const { value: node } = this.storage.get(id, "node");
|
|
69626
|
-
if (typeof node !== "string") {
|
|
69627
|
-
continue;
|
|
69628
|
-
}
|
|
69629
|
-
if (!node || !this.storage.get(node, "__typename")) {
|
|
69630
|
-
continue;
|
|
69631
|
-
}
|
|
69632
|
-
newNodeIDs.push(node);
|
|
69633
|
-
}
|
|
69634
|
-
oldIDs = oldIDs.filter((id) => {
|
|
69635
|
-
if (!id) {
|
|
69636
|
-
return true;
|
|
69637
|
-
}
|
|
69638
|
-
const { value: value2 } = this.storage.get(id, "node");
|
|
69639
|
-
const node = value2;
|
|
69640
|
-
if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
|
|
69641
|
-
return false;
|
|
69642
|
-
}
|
|
69643
|
-
return true;
|
|
69644
|
-
});
|
|
69645
|
-
}
|
|
69646
|
-
if (update === "prepend") {
|
|
69647
|
-
linkedIDs = newIDs.concat(oldIDs);
|
|
69648
|
-
} else if (update === "append") {
|
|
69649
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
69650
|
-
} else if (update === "replace") {
|
|
69651
|
-
linkedIDs = newIDs;
|
|
69652
|
-
}
|
|
69653
|
-
} else {
|
|
69654
|
-
linkedIDs = nestedIDs;
|
|
69655
|
-
}
|
|
69656
|
-
const contentChanged = !deepEquals(linkedIDs, oldIDs);
|
|
69657
|
-
if (contentChanged || forceNotify) {
|
|
69658
|
-
toNotify.push(...currentSubscribers);
|
|
69659
|
-
}
|
|
69660
|
-
for (const lostID of oldIDs) {
|
|
69661
|
-
if (linkedIDs.includes(lostID) || !lostID) {
|
|
69662
|
-
continue;
|
|
69663
|
-
}
|
|
69664
|
-
this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
|
|
69665
|
-
}
|
|
69666
|
-
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
69667
|
-
layer.writeLink(parent, key, linkedIDs);
|
|
69668
|
-
}
|
|
69669
|
-
for (const id of newIDs.filter((id2) => !oldIDs.includes(id2))) {
|
|
69670
|
-
if (id == null) {
|
|
69671
|
-
continue;
|
|
69672
|
-
}
|
|
69673
|
-
this.subscriptions.addMany({
|
|
69674
|
-
parent: id,
|
|
69675
|
-
selection: fieldSelection,
|
|
69676
|
-
subscribers: currentSubscribers,
|
|
69677
|
-
variables,
|
|
69678
|
-
parentType: linkedType
|
|
69679
|
-
});
|
|
69680
|
-
}
|
|
69681
|
-
}
|
|
69682
|
-
for (const operation of operations || []) {
|
|
69683
|
-
let parentID;
|
|
69684
|
-
if (operation.parentID) {
|
|
69685
|
-
if (operation.parentID.kind !== "Variable") {
|
|
69686
|
-
parentID = operation.parentID.value;
|
|
69687
|
-
} else {
|
|
69688
|
-
const id = variables[operation.parentID.value];
|
|
69689
|
-
if (typeof id !== "string") {
|
|
69690
|
-
throw new Error("parentID value must be a string");
|
|
69691
|
-
}
|
|
69692
|
-
parentID = id;
|
|
69693
|
-
}
|
|
69694
|
-
}
|
|
69695
|
-
if (operation.list && !this.lists.get(operation.list, parentID, operation.target === "all")) {
|
|
69696
|
-
continue;
|
|
69697
|
-
}
|
|
69698
|
-
const targets = Array.isArray(value) ? value : [value];
|
|
69699
|
-
for (const target of targets) {
|
|
69700
|
-
if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
|
|
69701
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
|
|
69702
|
-
fieldSelection,
|
|
69703
|
-
target,
|
|
69704
|
-
variables,
|
|
69705
|
-
operation.position || "last"
|
|
69706
|
-
);
|
|
69707
|
-
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
69708
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
69709
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
69710
|
-
if (typeof target !== "string") {
|
|
69711
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
69712
|
-
}
|
|
69713
|
-
const targetID = this.id(operation.type, target);
|
|
69714
|
-
if (!targetID) {
|
|
69715
|
-
continue;
|
|
69716
|
-
}
|
|
69717
|
-
this.cache.delete(targetID);
|
|
69718
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
69719
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
|
|
69720
|
-
fieldSelection,
|
|
69721
|
-
target,
|
|
69722
|
-
variables,
|
|
69723
|
-
operation.position || "last"
|
|
69724
|
-
);
|
|
69725
|
-
}
|
|
69726
|
-
}
|
|
69727
|
-
}
|
|
69728
|
-
}
|
|
69729
|
-
return toNotify;
|
|
69730
|
-
}
|
|
69731
|
-
getSelection({
|
|
69732
|
-
selection: selection2,
|
|
69733
|
-
parent = rootID,
|
|
69734
|
-
variables,
|
|
69735
|
-
stepsFromConnection = null
|
|
69736
|
-
}) {
|
|
69737
|
-
if (parent === null) {
|
|
69738
|
-
return { data: null, partial: false, hasData: true };
|
|
69739
|
-
}
|
|
69740
|
-
const target = {};
|
|
69741
|
-
let hasData = false;
|
|
69742
|
-
let partial = false;
|
|
69743
|
-
let cascadeNull = false;
|
|
69744
|
-
const typename = this.storage.get(parent, "__typename").value;
|
|
69745
|
-
let targetSelection = getFieldsForType(selection2, typename);
|
|
69746
|
-
for (const [
|
|
69747
|
-
attributeName,
|
|
69748
|
-
{ type, keyRaw, selection: fieldSelection, nullable, list }
|
|
69749
|
-
] of Object.entries(targetSelection)) {
|
|
69750
|
-
const key = evaluateKey(keyRaw, variables);
|
|
69751
|
-
const { value } = this.storage.get(parent, key);
|
|
69752
|
-
let nextStep = stepsFromConnection;
|
|
69753
|
-
if (nextStep !== null) {
|
|
69754
|
-
if (nextStep >= 2) {
|
|
69755
|
-
nextStep = null;
|
|
69756
|
-
} else {
|
|
69757
|
-
nextStep += 1;
|
|
69758
|
-
}
|
|
69759
|
-
}
|
|
69760
|
-
if (list?.connection) {
|
|
69761
|
-
nextStep = 0;
|
|
69762
|
-
}
|
|
69763
|
-
const embeddedCursor = key === "cursor" && stepsFromConnection === 1;
|
|
69764
|
-
if (typeof value === "undefined" && !embeddedCursor) {
|
|
69765
|
-
partial = true;
|
|
69766
|
-
}
|
|
69767
|
-
if (typeof value === "undefined" || value === null) {
|
|
69768
|
-
target[attributeName] = null;
|
|
69769
|
-
if (typeof value !== "undefined") {
|
|
69770
|
-
hasData = true;
|
|
69771
|
-
}
|
|
69772
|
-
} else if (!fieldSelection) {
|
|
69773
|
-
const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
|
|
69774
|
-
if (fnUnmarshal) {
|
|
69775
|
-
target[attributeName] = fnUnmarshal(value);
|
|
69776
|
-
} else {
|
|
69777
|
-
target[attributeName] = value;
|
|
69778
|
-
}
|
|
69779
|
-
hasData = true;
|
|
69780
|
-
} else if (Array.isArray(value)) {
|
|
69781
|
-
const listValue = this.hydrateNestedList({
|
|
69782
|
-
fields: fieldSelection,
|
|
69783
|
-
variables,
|
|
69784
|
-
linkedList: value,
|
|
69785
|
-
stepsFromConnection: nextStep
|
|
69786
|
-
});
|
|
69787
|
-
target[attributeName] = listValue.data;
|
|
69788
|
-
if (listValue.partial) {
|
|
69789
|
-
partial = true;
|
|
69790
|
-
}
|
|
69791
|
-
if (listValue.hasData || value.length === 0) {
|
|
69792
|
-
hasData = true;
|
|
69793
|
-
}
|
|
69794
|
-
} else {
|
|
69795
|
-
const objectFields = this.getSelection({
|
|
69796
|
-
parent: value,
|
|
69797
|
-
selection: fieldSelection,
|
|
69798
|
-
variables,
|
|
69799
|
-
stepsFromConnection: nextStep
|
|
69800
|
-
});
|
|
69801
|
-
target[attributeName] = objectFields.data;
|
|
69802
|
-
if (objectFields.partial) {
|
|
69803
|
-
partial = true;
|
|
69804
|
-
}
|
|
69805
|
-
if (objectFields.hasData) {
|
|
69806
|
-
hasData = true;
|
|
69807
|
-
}
|
|
69808
|
-
}
|
|
69809
|
-
if (target[attributeName] === null && !nullable && !embeddedCursor) {
|
|
69810
|
-
cascadeNull = true;
|
|
69811
|
-
}
|
|
69812
|
-
}
|
|
69813
|
-
return {
|
|
69814
|
-
data: cascadeNull ? null : target,
|
|
69815
|
-
partial: hasData && partial,
|
|
69816
|
-
hasData
|
|
69817
|
-
};
|
|
69818
|
-
}
|
|
69819
|
-
id(type, data) {
|
|
69820
|
-
const id = typeof data === "string" ? data : this.computeID(type, data);
|
|
69821
|
-
if (!id) {
|
|
69822
|
-
return null;
|
|
69823
|
-
}
|
|
69824
|
-
if (!type) {
|
|
69825
|
-
return id;
|
|
69826
|
-
}
|
|
69827
|
-
return type + ":" + id;
|
|
69828
|
-
}
|
|
69829
|
-
idFields(type) {
|
|
69830
|
-
return keyFieldsForType(this.config, type);
|
|
69831
|
-
}
|
|
69832
|
-
computeID(type, data) {
|
|
69833
|
-
return computeID(this.config, type, data);
|
|
69834
|
-
}
|
|
69835
|
-
hydrateNestedList({
|
|
69836
|
-
fields,
|
|
69837
|
-
variables,
|
|
69838
|
-
linkedList,
|
|
69839
|
-
stepsFromConnection
|
|
69840
|
-
}) {
|
|
69841
|
-
const result = [];
|
|
69842
|
-
let partialData = false;
|
|
69843
|
-
let hasValues = false;
|
|
69844
|
-
for (const entry of linkedList) {
|
|
69845
|
-
if (Array.isArray(entry)) {
|
|
69846
|
-
const nestedValue = this.hydrateNestedList({
|
|
69847
|
-
fields,
|
|
69848
|
-
variables,
|
|
69849
|
-
linkedList: entry,
|
|
69850
|
-
stepsFromConnection
|
|
69851
|
-
});
|
|
69852
|
-
result.push(nestedValue.data);
|
|
69853
|
-
if (nestedValue.partial) {
|
|
69854
|
-
partialData = true;
|
|
69855
|
-
}
|
|
69856
|
-
continue;
|
|
69857
|
-
}
|
|
69858
|
-
if (entry === null) {
|
|
69859
|
-
result.push(entry);
|
|
69860
|
-
continue;
|
|
69861
|
-
}
|
|
69862
|
-
const { data, partial, hasData } = this.getSelection({
|
|
69863
|
-
parent: entry,
|
|
69864
|
-
selection: fields,
|
|
69865
|
-
variables,
|
|
69866
|
-
stepsFromConnection
|
|
69867
|
-
});
|
|
69868
|
-
result.push(data);
|
|
69869
|
-
if (partial) {
|
|
69870
|
-
partialData = true;
|
|
69871
|
-
}
|
|
69872
|
-
if (hasData) {
|
|
69873
|
-
hasValues = true;
|
|
69874
|
-
}
|
|
69875
|
-
}
|
|
69876
|
-
return {
|
|
69877
|
-
data: result,
|
|
69878
|
-
partial: partialData,
|
|
69879
|
-
hasData: hasValues
|
|
69880
|
-
};
|
|
69881
|
-
}
|
|
69882
|
-
extractNestedListIDs({
|
|
69883
|
-
value,
|
|
69884
|
-
abstract,
|
|
69885
|
-
recordID,
|
|
69886
|
-
key,
|
|
69887
|
-
linkedType,
|
|
69888
|
-
fields,
|
|
69889
|
-
variables,
|
|
69890
|
-
applyUpdates,
|
|
69891
|
-
specs,
|
|
69892
|
-
layer,
|
|
69893
|
-
forceNotify
|
|
69894
|
-
}) {
|
|
69895
|
-
const nestedIDs = [];
|
|
69896
|
-
const newIDs = [];
|
|
69897
|
-
for (const [i2, entry] of value.entries()) {
|
|
69898
|
-
if (Array.isArray(entry)) {
|
|
69899
|
-
const inner = this.extractNestedListIDs({
|
|
69900
|
-
value: entry,
|
|
69901
|
-
abstract,
|
|
69902
|
-
recordID,
|
|
69903
|
-
key,
|
|
69904
|
-
linkedType,
|
|
69905
|
-
fields,
|
|
69906
|
-
variables,
|
|
69907
|
-
applyUpdates,
|
|
69908
|
-
specs,
|
|
69909
|
-
layer,
|
|
69910
|
-
forceNotify
|
|
69911
|
-
});
|
|
69912
|
-
newIDs.push(...inner.newIDs);
|
|
69913
|
-
nestedIDs[i2] = inner.nestedIDs;
|
|
69914
|
-
continue;
|
|
69915
|
-
}
|
|
69916
|
-
if (entry === null || typeof entry === "undefined") {
|
|
69917
|
-
newIDs.push(null);
|
|
69918
|
-
nestedIDs[i2] = null;
|
|
69919
|
-
continue;
|
|
69920
|
-
}
|
|
69921
|
-
const entryObj = entry;
|
|
69922
|
-
let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
|
|
69923
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
69924
|
-
(field) => typeof entry[field] === "undefined"
|
|
69925
|
-
).length > 0;
|
|
69926
|
-
const typename = entryObj.__typename;
|
|
69927
|
-
let innerType = linkedType;
|
|
69928
|
-
if (abstract) {
|
|
69929
|
-
if (!typename) {
|
|
69930
|
-
throw new Error("Encountered interface type without __typename in the payload");
|
|
69931
|
-
}
|
|
69932
|
-
innerType = typename;
|
|
69933
|
-
}
|
|
69934
|
-
if (!embedded) {
|
|
69935
|
-
const id = this.id(innerType, entry);
|
|
69936
|
-
if (id) {
|
|
69937
|
-
linkedID = id;
|
|
69938
|
-
} else {
|
|
69939
|
-
continue;
|
|
69940
|
-
}
|
|
69941
|
-
}
|
|
69942
|
-
this.writeSelection({
|
|
69943
|
-
root: rootID,
|
|
69944
|
-
selection: fields,
|
|
69945
|
-
parent: linkedID,
|
|
69946
|
-
data: entryObj,
|
|
69947
|
-
variables,
|
|
69948
|
-
toNotify: specs,
|
|
69949
|
-
applyUpdates,
|
|
69950
|
-
layer,
|
|
69951
|
-
forceNotify
|
|
69952
|
-
});
|
|
69953
|
-
newIDs.push(linkedID);
|
|
69954
|
-
nestedIDs[i2] = linkedID;
|
|
69955
|
-
}
|
|
69956
|
-
return { newIDs, nestedIDs };
|
|
69957
|
-
}
|
|
69958
|
-
collectGarbage() {
|
|
69959
|
-
this.lifetimes.tick();
|
|
69960
|
-
if (this.storage.layerCount === 1) {
|
|
69961
|
-
this.storage.topLayer.removeUndefinedFields();
|
|
69962
|
-
}
|
|
69963
|
-
}
|
|
69964
|
-
};
|
|
69965
|
-
var rootID = "_ROOT_";
|
|
69966
|
-
|
|
69967
|
-
// src/runtime/cache/index.ts
|
|
69968
|
-
var cache_default = new Cache3();
|
|
69969
|
-
|
|
69970
68257
|
// src/runtime/lib/types.ts
|
|
69971
68258
|
var CompiledFragmentKind = "HoudiniFragment" /* Fragment */;
|
|
69972
68259
|
var CompiledMutationKind = "HoudiniMutation" /* Mutation */;
|
|
@@ -70264,7 +68551,7 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
70264
68551
|
const targetPath = join2(parentDir, child);
|
|
70265
68552
|
let original = await readFile(childPath) || "";
|
|
70266
68553
|
if (transforms?.[childPath]) {
|
|
70267
|
-
original = transforms[childPath](original);
|
|
68554
|
+
original = await transforms[childPath](original, childPath);
|
|
70268
68555
|
}
|
|
70269
68556
|
await writeFile(targetPath, original);
|
|
70270
68557
|
}
|
|
@@ -70400,7 +68687,7 @@ var Body = class {
|
|
|
70400
68687
|
} else if (ArrayBuffer.isView(body)) {
|
|
70401
68688
|
body = Buffer2.from(body.buffer, body.byteOffset, body.byteLength);
|
|
70402
68689
|
} else if (body instanceof Stream) {
|
|
70403
|
-
} else if (body instanceof
|
|
68690
|
+
} else if (body instanceof FormData) {
|
|
70404
68691
|
body = formDataToBlob(body);
|
|
70405
68692
|
boundary = body.type.split("=")[1];
|
|
70406
68693
|
} else {
|
|
@@ -70440,7 +68727,7 @@ var Body = class {
|
|
|
70440
68727
|
async formData() {
|
|
70441
68728
|
const ct = this.headers.get("content-type");
|
|
70442
68729
|
if (ct.startsWith("application/x-www-form-urlencoded")) {
|
|
70443
|
-
const formData = new
|
|
68730
|
+
const formData = new FormData();
|
|
70444
68731
|
const parameters = new URLSearchParams(await this.text());
|
|
70445
68732
|
for (const [name2, value] of parameters) {
|
|
70446
68733
|
formData.append(name2, value);
|
|
@@ -70566,7 +68853,7 @@ var extractContentType = (body, request) => {
|
|
|
70566
68853
|
if (Buffer2.isBuffer(body) || types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
|
|
70567
68854
|
return null;
|
|
70568
68855
|
}
|
|
70569
|
-
if (body instanceof
|
|
68856
|
+
if (body instanceof FormData) {
|
|
70570
68857
|
return `multipart/form-data; boundary=${request[INTERNALS].boundary}`;
|
|
70571
68858
|
}
|
|
70572
68859
|
if (body && typeof body.getBoundary === "function") {
|
|
@@ -71825,8 +70112,11 @@ var Config = class {
|
|
|
71825
70112
|
pluginRuntimeDirectory(name2) {
|
|
71826
70113
|
return join2(this.pluginDirectory(name2), "runtime");
|
|
71827
70114
|
}
|
|
70115
|
+
get pluginRootDirectory() {
|
|
70116
|
+
return houdini_mode.is_testing ? "../../../" : join2(this.rootDir, "plugins");
|
|
70117
|
+
}
|
|
71828
70118
|
pluginDirectory(name2) {
|
|
71829
|
-
return
|
|
70119
|
+
return join2(this.pluginRootDirectory, name2);
|
|
71830
70120
|
}
|
|
71831
70121
|
get manualLoadDirective() {
|
|
71832
70122
|
return "manual_load";
|
|
@@ -71876,6 +70166,9 @@ var Config = class {
|
|
|
71876
70166
|
get whenNotDirective() {
|
|
71877
70167
|
return this.whenDirective + "_not";
|
|
71878
70168
|
}
|
|
70169
|
+
get liveDirective() {
|
|
70170
|
+
return "live";
|
|
70171
|
+
}
|
|
71879
70172
|
get argumentsDirective() {
|
|
71880
70173
|
return "arguments";
|
|
71881
70174
|
}
|
|
@@ -72071,7 +70364,9 @@ async function getConfig({
|
|
|
72071
70364
|
resolve2 = res;
|
|
72072
70365
|
reject = rej;
|
|
72073
70366
|
});
|
|
72074
|
-
let configFile =
|
|
70367
|
+
let configFile = {
|
|
70368
|
+
...await readConfigFile(configPath)
|
|
70369
|
+
};
|
|
72075
70370
|
if (!configFile.plugins) {
|
|
72076
70371
|
throw new HoudiniError({
|
|
72077
70372
|
message: "Welcome to 0.17.0! Please following the migration guide here: http://www.houdinigraphql.com/guides/release-notes#0170"
|
|
@@ -72126,13 +70421,14 @@ This will prevent your schema from being pulled.`
|
|
|
72126
70421
|
version = packageJSON.version;
|
|
72127
70422
|
} catch {
|
|
72128
70423
|
}
|
|
72129
|
-
|
|
72130
|
-
|
|
72131
|
-
|
|
72132
|
-
|
|
72133
|
-
|
|
72134
|
-
|
|
72135
|
-
|
|
70424
|
+
if (typeof plugin_config)
|
|
70425
|
+
plugins.push({
|
|
70426
|
+
...await pluginFactory(plugin_config),
|
|
70427
|
+
name: pluginName,
|
|
70428
|
+
include_runtime,
|
|
70429
|
+
version,
|
|
70430
|
+
directory: pluginDirectory
|
|
70431
|
+
});
|
|
72136
70432
|
} catch (e2) {
|
|
72137
70433
|
throw new Error(
|
|
72138
70434
|
`Could not find plugin: ${pluginName}. Are you sure its installed? If so, please open a ticket on GitHub.`
|
|
@@ -72570,7 +70866,7 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
72570
70866
|
}
|
|
72571
70867
|
|
|
72572
70868
|
// src/codegen/index.ts
|
|
72573
|
-
var
|
|
70869
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
72574
70870
|
|
|
72575
70871
|
// src/codegen/generators/artifacts/index.ts
|
|
72576
70872
|
var graphql13 = __toESM(require_graphql2(), 1);
|
|
@@ -72597,7 +70893,13 @@ function exportStarFrom(where) {
|
|
|
72597
70893
|
}
|
|
72598
70894
|
function exportDefaultFrom(where, as) {
|
|
72599
70895
|
return `var ${as} = require("${where}");
|
|
72600
|
-
|
|
70896
|
+
${exportDefault(as)}`;
|
|
70897
|
+
}
|
|
70898
|
+
function exportDefault(as) {
|
|
70899
|
+
return `Object.defineProperty(exports, "${as}", { enumerable: true, get: function () { return __importDefault(${as}).default; } });`;
|
|
70900
|
+
}
|
|
70901
|
+
function importDefaultFrom(where, as) {
|
|
70902
|
+
return `var ${as} = require("${where}")`;
|
|
72601
70903
|
}
|
|
72602
70904
|
|
|
72603
70905
|
// src/codegen/utils/flattenSelections.ts
|
|
@@ -72641,6 +70943,9 @@ var FieldCollection = class {
|
|
|
72641
70943
|
this.add(selection2);
|
|
72642
70944
|
}
|
|
72643
70945
|
}
|
|
70946
|
+
get size() {
|
|
70947
|
+
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
70948
|
+
}
|
|
72644
70949
|
add(selection2) {
|
|
72645
70950
|
if (selection2.kind === "Field") {
|
|
72646
70951
|
const key = selection2.alias?.value || selection2.name.value;
|
|
@@ -72709,9 +71014,12 @@ var FieldCollection = class {
|
|
|
72709
71014
|
}
|
|
72710
71015
|
}
|
|
72711
71016
|
toSelectionSet() {
|
|
72712
|
-
return Object.values(this.inlineFragments).
|
|
71017
|
+
return Object.values(this.inlineFragments).flatMap((fragment) => {
|
|
71018
|
+
if (fragment.selection.size === 0) {
|
|
71019
|
+
return [];
|
|
71020
|
+
}
|
|
72713
71021
|
fragment.astNode.selectionSet.selections = fragment.selection.toSelectionSet();
|
|
72714
|
-
return fragment.astNode;
|
|
71022
|
+
return [fragment.astNode];
|
|
72715
71023
|
}).concat(
|
|
72716
71024
|
Object.values(this.fields).map((field) => {
|
|
72717
71025
|
if (field.astNode.selectionSet) {
|
|
@@ -72894,7 +71202,7 @@ function serializeValue(value) {
|
|
|
72894
71202
|
if (typeof value === "object" && value !== null) {
|
|
72895
71203
|
return AST4.objectExpression(
|
|
72896
71204
|
Object.entries(value).filter(([, value2]) => typeof value2 !== "undefined").map(
|
|
72897
|
-
([key, value2]) => AST4.objectProperty(AST4.
|
|
71205
|
+
([key, value2]) => AST4.objectProperty(AST4.stringLiteral(key), serializeValue(value2))
|
|
72898
71206
|
)
|
|
72899
71207
|
);
|
|
72900
71208
|
}
|
|
@@ -74448,6 +72756,23 @@ function artifactGenerator(stats) {
|
|
|
74448
72756
|
document: doc
|
|
74449
72757
|
})
|
|
74450
72758
|
};
|
|
72759
|
+
const pluginsData = config2.plugins.reduce(
|
|
72760
|
+
(prev, plugin) => {
|
|
72761
|
+
if (!plugin.artifact_data) {
|
|
72762
|
+
return prev;
|
|
72763
|
+
}
|
|
72764
|
+
const result = { ...prev };
|
|
72765
|
+
const dataToAdd = plugin.artifact_data(config2, doc) ?? {};
|
|
72766
|
+
if (Object.keys(dataToAdd).length > 0) {
|
|
72767
|
+
result[plugin.name] = dataToAdd;
|
|
72768
|
+
}
|
|
72769
|
+
return result;
|
|
72770
|
+
},
|
|
72771
|
+
{}
|
|
72772
|
+
);
|
|
72773
|
+
if (Object.keys(pluginsData).length > 0) {
|
|
72774
|
+
artifact.pluginsData = pluginsData;
|
|
72775
|
+
}
|
|
74451
72776
|
if (inputs && inputs.length > 0) {
|
|
74452
72777
|
artifact.input = inputObject(config2, inputs);
|
|
74453
72778
|
}
|
|
@@ -74511,77 +72836,132 @@ function artifactGenerator(stats) {
|
|
|
74511
72836
|
};
|
|
74512
72837
|
}
|
|
74513
72838
|
|
|
74514
|
-
// src/codegen/generators/runtime/
|
|
72839
|
+
// src/codegen/generators/runtime/graphqlFunction.ts
|
|
74515
72840
|
var recast6 = __toESM(require_main2(), 1);
|
|
74516
72841
|
var AST6 = recast6.types.builders;
|
|
74517
|
-
async function
|
|
74518
|
-
await Promise.all([
|
|
74519
|
-
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
74520
|
-
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
74521
|
-
const configFilePath = path_exports.join(config2.runtimeDirectory, "lib", "config.js");
|
|
74522
|
-
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
|
|
74523
|
-
return content.replace("HOUDINI_CONFIG_PATH", relativePath);
|
|
74524
|
-
},
|
|
74525
|
-
[path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
74526
|
-
return content.replace("SITE_URL", siteURL);
|
|
74527
|
-
}
|
|
74528
|
-
}),
|
|
74529
|
-
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
74530
|
-
]);
|
|
72842
|
+
async function generateGraphqlReturnTypes(config2, docs) {
|
|
74531
72843
|
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
74532
|
-
const
|
|
72844
|
+
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
72845
|
+
const contents = await parseJS(fileContent);
|
|
74533
72846
|
const graphql_tag_return = config2.plugins.find(
|
|
74534
72847
|
(plugin) => plugin.graphql_tag_return
|
|
74535
72848
|
)?.graphql_tag_return;
|
|
74536
|
-
if (graphql_tag_return
|
|
74537
|
-
|
|
74538
|
-
|
|
74539
|
-
|
|
74540
|
-
|
|
74541
|
-
|
|
74542
|
-
|
|
74543
|
-
|
|
74544
|
-
|
|
74545
|
-
|
|
74546
|
-
|
|
74547
|
-
|
|
74548
|
-
|
|
74549
|
-
|
|
74550
|
-
|
|
74551
|
-
if (return_value) {
|
|
74552
|
-
overloaded_returns[doc.originalString] = return_value;
|
|
72849
|
+
if (!graphql_tag_return || !contents) {
|
|
72850
|
+
return fileContent;
|
|
72851
|
+
}
|
|
72852
|
+
const overloaded_returns = {};
|
|
72853
|
+
for (const doc of docs) {
|
|
72854
|
+
const return_value = graphql_tag_return({
|
|
72855
|
+
config: config2,
|
|
72856
|
+
doc,
|
|
72857
|
+
ensure_import({ identifier, module }) {
|
|
72858
|
+
ensureImports({
|
|
72859
|
+
config: config2,
|
|
72860
|
+
body: contents.script.body,
|
|
72861
|
+
sourceModule: module,
|
|
72862
|
+
import: [identifier]
|
|
72863
|
+
});
|
|
74553
72864
|
}
|
|
72865
|
+
});
|
|
72866
|
+
if (return_value) {
|
|
72867
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
74554
72868
|
}
|
|
74555
|
-
|
|
74556
|
-
|
|
74557
|
-
|
|
74558
|
-
|
|
74559
|
-
|
|
74560
|
-
|
|
74561
|
-
|
|
74562
|
-
|
|
74563
|
-
|
|
74564
|
-
)
|
|
74565
|
-
|
|
74566
|
-
|
|
74567
|
-
|
|
74568
|
-
|
|
74569
|
-
|
|
74570
|
-
|
|
74571
|
-
|
|
74572
|
-
|
|
74573
|
-
|
|
74574
|
-
)
|
|
74575
|
-
)
|
|
72869
|
+
}
|
|
72870
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
72871
|
+
for (const [i2, expression] of (contents?.script.body ?? []).entries()) {
|
|
72872
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
72873
|
+
continue;
|
|
72874
|
+
}
|
|
72875
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
72876
|
+
const input = AST6.identifier("str");
|
|
72877
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
72878
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
72879
|
+
);
|
|
72880
|
+
contents?.script.body.splice(
|
|
72881
|
+
i2,
|
|
72882
|
+
0,
|
|
72883
|
+
AST6.exportNamedDeclaration(
|
|
72884
|
+
AST6.tsDeclareFunction(
|
|
72885
|
+
AST6.identifier("graphql"),
|
|
72886
|
+
[input],
|
|
72887
|
+
AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
|
|
74576
72888
|
)
|
|
74577
|
-
)
|
|
74578
|
-
|
|
74579
|
-
break;
|
|
72889
|
+
)
|
|
72890
|
+
);
|
|
74580
72891
|
}
|
|
74581
|
-
|
|
72892
|
+
break;
|
|
74582
72893
|
}
|
|
72894
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
74583
72895
|
}
|
|
74584
72896
|
}
|
|
72897
|
+
|
|
72898
|
+
// src/codegen/generators/runtime/injectPlugins.ts
|
|
72899
|
+
async function injectPlugins({
|
|
72900
|
+
config: config2,
|
|
72901
|
+
content,
|
|
72902
|
+
importStatement,
|
|
72903
|
+
exportStatement
|
|
72904
|
+
}) {
|
|
72905
|
+
const client_plugins = config2.plugins.filter((plugin) => plugin.client_plugins).reduce((acc, plugin) => {
|
|
72906
|
+
let plugins = plugin.client_plugins;
|
|
72907
|
+
if (typeof plugins === "function") {
|
|
72908
|
+
plugins = plugins(config2, config2.pluginConfig(plugin.name));
|
|
72909
|
+
}
|
|
72910
|
+
return [...acc, ...Object.entries(plugins)];
|
|
72911
|
+
}, []);
|
|
72912
|
+
return client_plugins.length > 0 ? `
|
|
72913
|
+
${client_plugins.map((plugin, i2) => importStatement(plugin[0], `plugin${i2}`))}
|
|
72914
|
+
|
|
72915
|
+
const plugins = [
|
|
72916
|
+
${client_plugins.map((plugin, i2) => {
|
|
72917
|
+
const suffix = plugin[1] !== null ? `(${JSON.stringify(plugin[1])})` : "";
|
|
72918
|
+
return `plugin${i2}${suffix}`;
|
|
72919
|
+
}).join(",\n")}
|
|
72920
|
+
]
|
|
72921
|
+
|
|
72922
|
+
${exportStatement("plugins")}
|
|
72923
|
+
` : content;
|
|
72924
|
+
}
|
|
72925
|
+
|
|
72926
|
+
// src/codegen/generators/runtime/pluginIndex.ts
|
|
72927
|
+
async function generatePluginIndex({
|
|
72928
|
+
config: config2,
|
|
72929
|
+
exportStatement
|
|
72930
|
+
}) {
|
|
72931
|
+
const indexFile = `${exportStatement("../runtime/client/plugins/index.js")}
|
|
72932
|
+
`;
|
|
72933
|
+
const typedefs = `export * from '../runtime/client/plugins'`;
|
|
72934
|
+
await fs_exports.mkdirp(config2.pluginRootDirectory);
|
|
72935
|
+
await Promise.all([
|
|
72936
|
+
fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.js"), indexFile),
|
|
72937
|
+
fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.d.ts"), typedefs)
|
|
72938
|
+
]);
|
|
72939
|
+
}
|
|
72940
|
+
|
|
72941
|
+
// src/codegen/generators/runtime/index.ts
|
|
72942
|
+
async function runtimeGenerator(config2, docs) {
|
|
72943
|
+
const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
72944
|
+
const exportStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
72945
|
+
const exportStar = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
|
|
72946
|
+
await Promise.all([
|
|
72947
|
+
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
72948
|
+
[path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
72949
|
+
return content.replace("SITE_URL", siteURL);
|
|
72950
|
+
},
|
|
72951
|
+
[path_exports.join(config2.runtimeSource, "imports", "config.js")]: (content) => {
|
|
72952
|
+
const configFilePath = path_exports.join(config2.runtimeDirectory, "imports", "config.js");
|
|
72953
|
+
const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
|
|
72954
|
+
return `${importStatement(relativePath, "config")}
|
|
72955
|
+
${exportStatement("config")}
|
|
72956
|
+
`;
|
|
72957
|
+
},
|
|
72958
|
+
[path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
72959
|
+
}),
|
|
72960
|
+
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin)),
|
|
72961
|
+
generatePluginIndex({ config: config2, exportStatement: exportStar })
|
|
72962
|
+
]);
|
|
72963
|
+
await generateGraphqlReturnTypes(config2, docs);
|
|
72964
|
+
}
|
|
74585
72965
|
async function generatePluginRuntime(config2, plugin) {
|
|
74586
72966
|
if (houdini_mode.is_testing) {
|
|
74587
72967
|
return;
|
|
@@ -75647,6 +74027,7 @@ async function writeIndexFile2(config2, docs) {
|
|
|
75647
74027
|
const export_star_from = ({ module }) => "\n" + (cjs ? exportStarFrom(module) : `export * from "${module}"`) + "\n";
|
|
75648
74028
|
const export_default_as = ({ module, as }) => "\n" + (cjs ? exportDefaultFrom(module, as) : `export { default as ${as} } from "${module}"`) + "\n";
|
|
75649
74029
|
body += [
|
|
74030
|
+
export_star_from({ module: "./" + path_exports.join(runtimeDir, "client") }),
|
|
75650
74031
|
export_star_from({ module: runtimeDir }),
|
|
75651
74032
|
export_star_from({ module: artifactDir }),
|
|
75652
74033
|
export_star_from({ module: definitionsDir })
|
|
@@ -75759,7 +74140,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
75759
74140
|
}
|
|
75760
74141
|
|
|
75761
74142
|
// src/codegen/transforms/schema.ts
|
|
75762
|
-
var
|
|
74143
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
75763
74144
|
async function graphqlExtensions(config2, documents) {
|
|
75764
74145
|
const internalSchema = `
|
|
75765
74146
|
enum CachePolicy {
|
|
@@ -75837,19 +74218,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
75837
74218
|
"""
|
|
75838
74219
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
75839
74220
|
`;
|
|
75840
|
-
let currentSchema =
|
|
74221
|
+
let currentSchema = graphql21.printSchema(config2.schema);
|
|
75841
74222
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
75842
74223
|
currentSchema += internalSchema;
|
|
75843
74224
|
}
|
|
75844
74225
|
config2.newSchema += internalSchema;
|
|
75845
|
-
config2.schema =
|
|
74226
|
+
config2.schema = graphql21.buildSchema(currentSchema);
|
|
75846
74227
|
}
|
|
75847
74228
|
|
|
75848
74229
|
// src/codegen/transforms/typename.ts
|
|
75849
|
-
var
|
|
74230
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
75850
74231
|
async function addTypename(config2, documents) {
|
|
75851
74232
|
for (const doc of documents) {
|
|
75852
|
-
doc.document =
|
|
74233
|
+
doc.document = graphql22.visit(doc.document, {
|
|
75853
74234
|
Field(node, key, parent, path2, ancestors) {
|
|
75854
74235
|
if (!node.selectionSet) {
|
|
75855
74236
|
return;
|
|
@@ -75861,7 +74242,7 @@ async function addTypename(config2, documents) {
|
|
|
75861
74242
|
);
|
|
75862
74243
|
const field = type.getFields()[node.name.value];
|
|
75863
74244
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75864
|
-
if (
|
|
74245
|
+
if (graphql22.isInterfaceType(fieldType) || graphql22.isUnionType(fieldType)) {
|
|
75865
74246
|
return {
|
|
75866
74247
|
...node,
|
|
75867
74248
|
selectionSet: {
|
|
@@ -75869,9 +74250,9 @@ async function addTypename(config2, documents) {
|
|
|
75869
74250
|
selections: [
|
|
75870
74251
|
...node.selectionSet.selections,
|
|
75871
74252
|
{
|
|
75872
|
-
kind:
|
|
74253
|
+
kind: graphql22.Kind.FIELD,
|
|
75873
74254
|
name: {
|
|
75874
|
-
kind:
|
|
74255
|
+
kind: graphql22.Kind.NAME,
|
|
75875
74256
|
value: "__typename"
|
|
75876
74257
|
}
|
|
75877
74258
|
}
|
|
@@ -75885,10 +74266,10 @@ async function addTypename(config2, documents) {
|
|
|
75885
74266
|
}
|
|
75886
74267
|
|
|
75887
74268
|
// src/codegen/transforms/addID.ts
|
|
75888
|
-
var
|
|
74269
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
75889
74270
|
async function addID(config2, documents) {
|
|
75890
74271
|
for (const doc of documents) {
|
|
75891
|
-
doc.document =
|
|
74272
|
+
doc.document = graphql23.visit(doc.document, {
|
|
75892
74273
|
Field(node, key, parent, path2, ancestors) {
|
|
75893
74274
|
if (!node.selectionSet) {
|
|
75894
74275
|
return;
|
|
@@ -75901,7 +74282,7 @@ async function addID(config2, documents) {
|
|
|
75901
74282
|
const field = type.getFields()[node.name.value];
|
|
75902
74283
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75903
74284
|
if (node.selectionSet?.selections.length > 0) {
|
|
75904
|
-
if (!
|
|
74285
|
+
if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
|
|
75905
74286
|
return;
|
|
75906
74287
|
}
|
|
75907
74288
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -75916,9 +74297,9 @@ async function addID(config2, documents) {
|
|
|
75916
74297
|
continue;
|
|
75917
74298
|
}
|
|
75918
74299
|
selections.push({
|
|
75919
|
-
kind:
|
|
74300
|
+
kind: graphql23.Kind.FIELD,
|
|
75920
74301
|
name: {
|
|
75921
|
-
kind:
|
|
74302
|
+
kind: graphql23.Kind.NAME,
|
|
75922
74303
|
value: keyField
|
|
75923
74304
|
}
|
|
75924
74305
|
});
|
|
@@ -75937,8 +74318,8 @@ async function addID(config2, documents) {
|
|
|
75937
74318
|
}
|
|
75938
74319
|
|
|
75939
74320
|
// src/codegen/transforms/fragmentVariables.ts
|
|
75940
|
-
var
|
|
75941
|
-
var GraphqlKinds2 =
|
|
74321
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
74322
|
+
var GraphqlKinds2 = graphql24.Kind;
|
|
75942
74323
|
async function fragmentVariables(config2, documents) {
|
|
75943
74324
|
const fragments = collectFragments(config2, documents);
|
|
75944
74325
|
const generatedFragments = {};
|
|
@@ -75961,7 +74342,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
75961
74342
|
});
|
|
75962
74343
|
}
|
|
75963
74344
|
const doc = {
|
|
75964
|
-
kind:
|
|
74345
|
+
kind: graphql24.Kind.DOCUMENT,
|
|
75965
74346
|
definitions: Object.values(generatedFragments)
|
|
75966
74347
|
};
|
|
75967
74348
|
documents.push({
|
|
@@ -75997,7 +74378,7 @@ function inlineFragmentArgs({
|
|
|
75997
74378
|
filepath,
|
|
75998
74379
|
document
|
|
75999
74380
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
76000
|
-
const result =
|
|
74381
|
+
const result = graphql24.visit(document, {
|
|
76001
74382
|
FragmentSpread(node) {
|
|
76002
74383
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
76003
74384
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -76085,7 +74466,7 @@ function inlineFragmentArgs({
|
|
|
76085
74466
|
});
|
|
76086
74467
|
if (newName) {
|
|
76087
74468
|
result.name = {
|
|
76088
|
-
kind:
|
|
74469
|
+
kind: graphql24.Kind.NAME,
|
|
76089
74470
|
value: newName
|
|
76090
74471
|
};
|
|
76091
74472
|
}
|
|
@@ -76197,7 +74578,7 @@ function operationScope(operation) {
|
|
|
76197
74578
|
}
|
|
76198
74579
|
|
|
76199
74580
|
// src/codegen/validators/typeCheck.ts
|
|
76200
|
-
var
|
|
74581
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
76201
74582
|
async function typeCheck(config2, docs) {
|
|
76202
74583
|
const errors = [];
|
|
76203
74584
|
const freeLists = [];
|
|
@@ -76205,11 +74586,11 @@ async function typeCheck(config2, docs) {
|
|
|
76205
74586
|
const listTypes = [];
|
|
76206
74587
|
const fragments = {};
|
|
76207
74588
|
for (const { document: parsed, filename } of docs) {
|
|
76208
|
-
|
|
76209
|
-
[
|
|
74589
|
+
graphql25.visit(parsed, {
|
|
74590
|
+
[graphql25.Kind.FRAGMENT_DEFINITION](definition) {
|
|
76210
74591
|
fragments[definition.name.value] = definition;
|
|
76211
74592
|
},
|
|
76212
|
-
[
|
|
74593
|
+
[graphql25.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
76213
74594
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
76214
74595
|
return;
|
|
76215
74596
|
}
|
|
@@ -76255,14 +74636,14 @@ async function typeCheck(config2, docs) {
|
|
|
76255
74636
|
);
|
|
76256
74637
|
return;
|
|
76257
74638
|
}
|
|
76258
|
-
if (
|
|
74639
|
+
if (graphql25.isListType(rootType) || graphql25.isNonNullType(rootType) && graphql25.isListType(rootType.ofType)) {
|
|
76259
74640
|
needsParent = true;
|
|
76260
74641
|
break;
|
|
76261
74642
|
}
|
|
76262
|
-
if (
|
|
74643
|
+
if (graphql25.isNonNullType(rootType) && "ofType" in rootType) {
|
|
76263
74644
|
rootType = rootType.ofType;
|
|
76264
74645
|
}
|
|
76265
|
-
if (
|
|
74646
|
+
if (graphql25.isScalarType(rootType)) {
|
|
76266
74647
|
break;
|
|
76267
74648
|
}
|
|
76268
74649
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -76338,9 +74719,9 @@ async function typeCheck(config2, docs) {
|
|
|
76338
74719
|
);
|
|
76339
74720
|
}
|
|
76340
74721
|
let targetTypes = [type];
|
|
76341
|
-
if (
|
|
74722
|
+
if (graphql25.isUnionType(type)) {
|
|
76342
74723
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
76343
|
-
} else if (
|
|
74724
|
+
} else if (graphql25.isInterfaceType(type)) {
|
|
76344
74725
|
try {
|
|
76345
74726
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
76346
74727
|
if (!type.getFields()[key]) {
|
|
@@ -76378,13 +74759,13 @@ async function typeCheck(config2, docs) {
|
|
|
76378
74759
|
if (errors.length > 0) {
|
|
76379
74760
|
throw errors;
|
|
76380
74761
|
}
|
|
76381
|
-
const rules = (filepath) => [...
|
|
74762
|
+
const rules = (filepath) => [...graphql25.specifiedRules].filter(
|
|
76382
74763
|
(rule) => ![
|
|
76383
|
-
|
|
76384
|
-
|
|
76385
|
-
|
|
76386
|
-
|
|
76387
|
-
|
|
74764
|
+
graphql25.NoUnusedFragmentsRule,
|
|
74765
|
+
graphql25.KnownFragmentNamesRule,
|
|
74766
|
+
graphql25.ExecutableDefinitionsRule,
|
|
74767
|
+
graphql25.KnownDirectivesRule,
|
|
74768
|
+
graphql25.KnownArgumentNamesRule
|
|
76388
74769
|
].includes(rule)
|
|
76389
74770
|
).concat(
|
|
76390
74771
|
validateLists({
|
|
@@ -76403,7 +74784,7 @@ async function typeCheck(config2, docs) {
|
|
|
76403
74784
|
noUnusedFragmentArguments(config2)
|
|
76404
74785
|
);
|
|
76405
74786
|
for (const { filename, document: parsed } of docs) {
|
|
76406
|
-
for (const error of
|
|
74787
|
+
for (const error of graphql25.validate(config2.schema, parsed, rules(filename))) {
|
|
76407
74788
|
errors.push(
|
|
76408
74789
|
new HoudiniError({
|
|
76409
74790
|
filepath: filename,
|
|
@@ -76429,7 +74810,7 @@ var validateLists = ({
|
|
|
76429
74810
|
if (!config2.isListFragment(node.name.value)) {
|
|
76430
74811
|
if (!fragments[node.name.value]) {
|
|
76431
74812
|
ctx.reportError(
|
|
76432
|
-
new
|
|
74813
|
+
new graphql25.GraphQLError(
|
|
76433
74814
|
"Encountered unknown fragment: " + node.name.value
|
|
76434
74815
|
)
|
|
76435
74816
|
);
|
|
@@ -76439,7 +74820,7 @@ var validateLists = ({
|
|
|
76439
74820
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
76440
74821
|
if (!lists.includes(listName)) {
|
|
76441
74822
|
ctx.reportError(
|
|
76442
|
-
new
|
|
74823
|
+
new graphql25.GraphQLError(
|
|
76443
74824
|
"Encountered fragment referencing unknown list: " + listName
|
|
76444
74825
|
)
|
|
76445
74826
|
);
|
|
@@ -76464,7 +74845,7 @@ var validateLists = ({
|
|
|
76464
74845
|
);
|
|
76465
74846
|
if (parentArg) {
|
|
76466
74847
|
ctx.reportError(
|
|
76467
|
-
new
|
|
74848
|
+
new graphql25.GraphQLError(
|
|
76468
74849
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
76469
74850
|
)
|
|
76470
74851
|
);
|
|
@@ -76480,7 +74861,7 @@ var validateLists = ({
|
|
|
76480
74861
|
return;
|
|
76481
74862
|
}
|
|
76482
74863
|
ctx.reportError(
|
|
76483
|
-
new
|
|
74864
|
+
new graphql25.GraphQLError(
|
|
76484
74865
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
76485
74866
|
)
|
|
76486
74867
|
);
|
|
@@ -76490,7 +74871,7 @@ var validateLists = ({
|
|
|
76490
74871
|
const directiveName = node.name.value;
|
|
76491
74872
|
if (directiveName === "connection") {
|
|
76492
74873
|
ctx.reportError(
|
|
76493
|
-
new
|
|
74874
|
+
new graphql25.GraphQLError(
|
|
76494
74875
|
"@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."
|
|
76495
74876
|
)
|
|
76496
74877
|
);
|
|
@@ -76499,7 +74880,7 @@ var validateLists = ({
|
|
|
76499
74880
|
if (!config2.isInternalDirective(node)) {
|
|
76500
74881
|
if (!config2.schema.getDirective(directiveName)) {
|
|
76501
74882
|
ctx.reportError(
|
|
76502
|
-
new
|
|
74883
|
+
new graphql25.GraphQLError(
|
|
76503
74884
|
"Encountered unknown directive: " + directiveName
|
|
76504
74885
|
)
|
|
76505
74886
|
);
|
|
@@ -76508,7 +74889,7 @@ var validateLists = ({
|
|
|
76508
74889
|
}
|
|
76509
74890
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
76510
74891
|
ctx.reportError(
|
|
76511
|
-
new
|
|
74892
|
+
new graphql25.GraphQLError(
|
|
76512
74893
|
"Encountered directive referencing unknown list: " + directiveName
|
|
76513
74894
|
)
|
|
76514
74895
|
);
|
|
@@ -76519,7 +74900,7 @@ var validateLists = ({
|
|
|
76519
74900
|
};
|
|
76520
74901
|
function knownArguments(config2) {
|
|
76521
74902
|
return function(ctx) {
|
|
76522
|
-
const nativeValidator =
|
|
74903
|
+
const nativeValidator = graphql25.KnownArgumentNamesRule(ctx);
|
|
76523
74904
|
return {
|
|
76524
74905
|
...nativeValidator,
|
|
76525
74906
|
Directive(directiveNode) {
|
|
@@ -76552,7 +74933,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76552
74933
|
for (const arg of node.arguments || []) {
|
|
76553
74934
|
if (arg.value.kind !== "ObjectValue") {
|
|
76554
74935
|
ctx.reportError(
|
|
76555
|
-
new
|
|
74936
|
+
new graphql25.GraphQLError("values in @arguments must be an object")
|
|
76556
74937
|
);
|
|
76557
74938
|
return;
|
|
76558
74939
|
}
|
|
@@ -76562,13 +74943,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76562
74943
|
);
|
|
76563
74944
|
if (!typeArg) {
|
|
76564
74945
|
ctx.reportError(
|
|
76565
|
-
new
|
|
74946
|
+
new graphql25.GraphQLError("missing type field for @arguments directive")
|
|
76566
74947
|
);
|
|
76567
74948
|
return;
|
|
76568
74949
|
}
|
|
76569
|
-
if (typeArg.value.kind !==
|
|
74950
|
+
if (typeArg.value.kind !== graphql25.Kind.STRING) {
|
|
76570
74951
|
ctx.reportError(
|
|
76571
|
-
new
|
|
74952
|
+
new graphql25.GraphQLError("type field to @arguments must be a string")
|
|
76572
74953
|
);
|
|
76573
74954
|
return;
|
|
76574
74955
|
}
|
|
@@ -76581,7 +74962,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76581
74962
|
);
|
|
76582
74963
|
if (typeArg.value.value !== defaultValueType) {
|
|
76583
74964
|
ctx.reportError(
|
|
76584
|
-
new
|
|
74965
|
+
new graphql25.GraphQLError(
|
|
76585
74966
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
76586
74967
|
)
|
|
76587
74968
|
);
|
|
@@ -76599,7 +74980,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76599
74980
|
try {
|
|
76600
74981
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
76601
74982
|
} catch (e2) {
|
|
76602
|
-
ctx.reportError(new
|
|
74983
|
+
ctx.reportError(new graphql25.GraphQLError(e2.message));
|
|
76603
74984
|
return;
|
|
76604
74985
|
}
|
|
76605
74986
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -76622,7 +75003,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76622
75003
|
);
|
|
76623
75004
|
if (missing.length > 0) {
|
|
76624
75005
|
ctx.reportError(
|
|
76625
|
-
new
|
|
75006
|
+
new graphql25.GraphQLError(
|
|
76626
75007
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
76627
75008
|
)
|
|
76628
75009
|
);
|
|
@@ -76633,7 +75014,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76633
75014
|
);
|
|
76634
75015
|
if (unknown.length > 0) {
|
|
76635
75016
|
ctx.reportError(
|
|
76636
|
-
new
|
|
75017
|
+
new graphql25.GraphQLError(
|
|
76637
75018
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
76638
75019
|
)
|
|
76639
75020
|
);
|
|
@@ -76645,7 +75026,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76645
75026
|
]
|
|
76646
75027
|
);
|
|
76647
75028
|
for (const [applied, target] of zipped) {
|
|
76648
|
-
if (applied.value.kind ===
|
|
75029
|
+
if (applied.value.kind === graphql25.Kind.VARIABLE || applied.value.kind === graphql25.Kind.LIST || applied.value.kind === graphql25.Kind.OBJECT) {
|
|
76649
75030
|
continue;
|
|
76650
75031
|
}
|
|
76651
75032
|
const appliedType = applied.value.kind.substring(
|
|
@@ -76654,7 +75035,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76654
75035
|
);
|
|
76655
75036
|
if (appliedType !== target) {
|
|
76656
75037
|
ctx.reportError(
|
|
76657
|
-
new
|
|
75038
|
+
new graphql25.GraphQLError(
|
|
76658
75039
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
76659
75040
|
)
|
|
76660
75041
|
);
|
|
@@ -76675,7 +75056,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76675
75056
|
}
|
|
76676
75057
|
if (alreadyPaginated) {
|
|
76677
75058
|
ctx.reportError(
|
|
76678
|
-
new
|
|
75059
|
+
new graphql25.GraphQLError(
|
|
76679
75060
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
76680
75061
|
)
|
|
76681
75062
|
);
|
|
@@ -76690,7 +75071,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76690
75071
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
76691
75072
|
if (hasRequiredArgs) {
|
|
76692
75073
|
ctx.reportError(
|
|
76693
|
-
new
|
|
75074
|
+
new graphql25.GraphQLError(
|
|
76694
75075
|
"@paginate cannot appear on a document with required args"
|
|
76695
75076
|
)
|
|
76696
75077
|
);
|
|
@@ -76722,14 +75103,14 @@ function paginateArgs(config2, filepath) {
|
|
|
76722
75103
|
const backwards = appliedArgs.has("last");
|
|
76723
75104
|
if (!forward && !backwards) {
|
|
76724
75105
|
ctx.reportError(
|
|
76725
|
-
new
|
|
75106
|
+
new graphql25.GraphQLError(
|
|
76726
75107
|
"A field with cursor-based pagination must have a first or last argument"
|
|
76727
75108
|
)
|
|
76728
75109
|
);
|
|
76729
75110
|
}
|
|
76730
75111
|
if (forward && backwards) {
|
|
76731
75112
|
ctx.reportError(
|
|
76732
|
-
new
|
|
75113
|
+
new graphql25.GraphQLError(
|
|
76733
75114
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
76734
75115
|
)
|
|
76735
75116
|
);
|
|
@@ -76743,7 +75124,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76743
75124
|
);
|
|
76744
75125
|
if (!appliedLimitArg) {
|
|
76745
75126
|
ctx.reportError(
|
|
76746
|
-
new
|
|
75127
|
+
new graphql25.GraphQLError(
|
|
76747
75128
|
"A field with offset-based pagination must have a limit argument"
|
|
76748
75129
|
)
|
|
76749
75130
|
);
|
|
@@ -76759,20 +75140,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
76759
75140
|
const args = /* @__PURE__ */ new Set();
|
|
76760
75141
|
return {
|
|
76761
75142
|
enter(node) {
|
|
76762
|
-
if (node.kind ===
|
|
75143
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
76763
75144
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
76764
75145
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
76765
75146
|
args.add(arg);
|
|
76766
75147
|
}
|
|
76767
|
-
} else if (node.kind ===
|
|
75148
|
+
} else if (node.kind === graphql25.Kind.VARIABLE) {
|
|
76768
75149
|
args.delete(node.name.value);
|
|
76769
75150
|
}
|
|
76770
75151
|
},
|
|
76771
75152
|
leave(node) {
|
|
76772
|
-
if (node.kind ===
|
|
75153
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
76773
75154
|
if (args.size > 0) {
|
|
76774
75155
|
ctx.reportError(
|
|
76775
|
-
new
|
|
75156
|
+
new graphql25.GraphQLError(
|
|
76776
75157
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
76777
75158
|
)
|
|
76778
75159
|
);
|
|
@@ -76808,7 +75189,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76808
75189
|
if (definition.kind === "OperationDefinition") {
|
|
76809
75190
|
if (definition.operation !== "query") {
|
|
76810
75191
|
ctx.reportError(
|
|
76811
|
-
new
|
|
75192
|
+
new graphql25.GraphQLError(
|
|
76812
75193
|
`@${node.name.value} must fall on a fragment or query document`
|
|
76813
75194
|
)
|
|
76814
75195
|
);
|
|
@@ -76820,7 +75201,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76820
75201
|
}
|
|
76821
75202
|
if (!possibleNodes.includes(definitionType)) {
|
|
76822
75203
|
ctx.reportError(
|
|
76823
|
-
new
|
|
75204
|
+
new graphql25.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
76824
75205
|
);
|
|
76825
75206
|
}
|
|
76826
75207
|
}
|
|
@@ -76839,7 +75220,7 @@ function checkMutationOperation(config2) {
|
|
|
76839
75220
|
);
|
|
76840
75221
|
if (append && prepend) {
|
|
76841
75222
|
ctx.reportError(
|
|
76842
|
-
new
|
|
75223
|
+
new graphql25.GraphQLError(
|
|
76843
75224
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
76844
75225
|
)
|
|
76845
75226
|
);
|
|
@@ -76853,7 +75234,7 @@ function checkMutationOperation(config2) {
|
|
|
76853
75234
|
);
|
|
76854
75235
|
if (parentId && allLists) {
|
|
76855
75236
|
ctx.reportError(
|
|
76856
|
-
new
|
|
75237
|
+
new graphql25.GraphQLError(
|
|
76857
75238
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
76858
75239
|
)
|
|
76859
75240
|
);
|
|
@@ -76875,7 +75256,7 @@ function checkMaskDirective(config2) {
|
|
|
76875
75256
|
);
|
|
76876
75257
|
if (maskEnableDirective && maskDisableDirective) {
|
|
76877
75258
|
ctx.reportError(
|
|
76878
|
-
new
|
|
75259
|
+
new graphql25.GraphQLError(
|
|
76879
75260
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
76880
75261
|
)
|
|
76881
75262
|
);
|
|
@@ -76891,7 +75272,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
76891
75272
|
if (!nodeInterface) {
|
|
76892
75273
|
return null;
|
|
76893
75274
|
}
|
|
76894
|
-
if (!
|
|
75275
|
+
if (!graphql25.isInterfaceType(nodeInterface)) {
|
|
76895
75276
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
76896
75277
|
return null;
|
|
76897
75278
|
}
|
|
@@ -76989,11 +75370,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
76989
75370
|
}
|
|
76990
75371
|
|
|
76991
75372
|
// src/codegen/validators/noIDAlias.ts
|
|
76992
|
-
var
|
|
75373
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
76993
75374
|
async function noIDAlias(config2, docs) {
|
|
76994
75375
|
const errors = [];
|
|
76995
75376
|
for (const { filename, document } of docs) {
|
|
76996
|
-
|
|
75377
|
+
graphql26.visit(document, {
|
|
76997
75378
|
Field(node, _, __, ___, ancestors) {
|
|
76998
75379
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
76999
75380
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -77191,12 +75572,17 @@ async function processJSFile(config2, contents) {
|
|
|
77191
75572
|
return documents;
|
|
77192
75573
|
}
|
|
77193
75574
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
77194
|
-
|
|
75575
|
+
try {
|
|
75576
|
+
var parsedDoc = graphql27.parse(document);
|
|
75577
|
+
} catch (e2) {
|
|
75578
|
+
console.log("error parsing!!");
|
|
75579
|
+
throw e2;
|
|
75580
|
+
}
|
|
77195
75581
|
const operations = parsedDoc.definitions.filter(
|
|
77196
|
-
({ kind: kind2 }) => kind2 ===
|
|
75582
|
+
({ kind: kind2 }) => kind2 === graphql27.Kind.OPERATION_DEFINITION
|
|
77197
75583
|
);
|
|
77198
75584
|
const fragments = parsedDoc.definitions.filter(
|
|
77199
|
-
({ kind: kind2 }) => kind2 ===
|
|
75585
|
+
({ kind: kind2 }) => kind2 === graphql27.Kind.FRAGMENT_DEFINITION
|
|
77200
75586
|
);
|
|
77201
75587
|
if (operations.length > 1) {
|
|
77202
75588
|
throw new HoudiniError({
|
|
@@ -77323,10 +75709,6 @@ async function generate(args = {
|
|
|
77323
75709
|
config2.persistedQueryPath = args.output;
|
|
77324
75710
|
}
|
|
77325
75711
|
if (args.pullSchema && await config2.apiURL()) {
|
|
77326
|
-
if (args.pullHeader) {
|
|
77327
|
-
console.log("\u26A0\uFE0F --pull-headers has been replaced by --headers (abbreviated -h)");
|
|
77328
|
-
args.headers = args.pullHeader;
|
|
77329
|
-
}
|
|
77330
75712
|
await pullSchema_default(args);
|
|
77331
75713
|
}
|
|
77332
75714
|
await compile(config2);
|
|
@@ -77502,7 +75884,7 @@ async function init(_path, args) {
|
|
|
77502
75884
|
} else if (framework === "svelte") {
|
|
77503
75885
|
await updateSvelteMainJs(targetPath);
|
|
77504
75886
|
}
|
|
77505
|
-
await updateViteConfig(targetPath, framework
|
|
75887
|
+
await updateViteConfig(targetPath, framework);
|
|
77506
75888
|
await tjsConfig(targetPath, framework);
|
|
77507
75889
|
console.log();
|
|
77508
75890
|
console.log("\u{1F3A9} Welcome to Houdini!");
|
|
@@ -77523,28 +75905,19 @@ async function init(_path, args) {
|
|
|
77523
75905
|
}
|
|
77524
75906
|
var networkFile = (url, typescript) => `import { HoudiniClient${typescript ? ", type RequestHandler" : ""} } from '$houdini';
|
|
77525
75907
|
|
|
77526
|
-
|
|
77527
|
-
|
|
77528
|
-
|
|
77529
|
-
|
|
77530
|
-
|
|
77531
|
-
|
|
77532
|
-
|
|
77533
|
-
|
|
77534
|
-
|
|
77535
|
-
|
|
77536
|
-
|
|
77537
|
-
|
|
77538
|
-
|
|
77539
|
-
body: JSON.stringify({
|
|
77540
|
-
query: text,
|
|
77541
|
-
variables
|
|
77542
|
-
})
|
|
77543
|
-
});
|
|
77544
|
-
return await result.json();
|
|
77545
|
-
}
|
|
77546
|
-
|
|
77547
|
-
export default new HoudiniClient(requestHandler);
|
|
75908
|
+
export default new HoudiniClient({
|
|
75909
|
+
url: '${url}'
|
|
75910
|
+
|
|
75911
|
+
// uncomment this to configure the network call (for things like authentication)
|
|
75912
|
+
// for more information, please visit here: https://www.houdinigraphql.com/guides/authentication
|
|
75913
|
+
// fetchParams({ session }) {
|
|
75914
|
+
// return {
|
|
75915
|
+
// headers: {
|
|
75916
|
+
// Authentication: \`Bearer \${session.token}\`,
|
|
75917
|
+
// }
|
|
75918
|
+
// }
|
|
75919
|
+
// }
|
|
75920
|
+
})
|
|
77548
75921
|
`;
|
|
77549
75922
|
var writeConfigFile = async ({
|
|
77550
75923
|
configPath,
|
|
@@ -77616,8 +75989,8 @@ async function tjsConfig(targetPath, framework) {
|
|
|
77616
75989
|
}
|
|
77617
75990
|
return false;
|
|
77618
75991
|
}
|
|
77619
|
-
async function updateViteConfig(targetPath, framework
|
|
77620
|
-
const viteConfigPath = path_exports.join(targetPath,
|
|
75992
|
+
async function updateViteConfig(targetPath, framework) {
|
|
75993
|
+
const viteConfigPath = path_exports.join(targetPath, "vite.config.js");
|
|
77621
75994
|
const viteConfigKit = `import { sveltekit } from '@sveltejs/kit/vite';
|
|
77622
75995
|
import houdini from 'houdini/vite';
|
|
77623
75996
|
|
|
@@ -77626,16 +75999,6 @@ const config = {
|
|
|
77626
75999
|
plugins: [houdini(), sveltekit()],
|
|
77627
76000
|
}
|
|
77628
76001
|
|
|
77629
|
-
export default config;
|
|
77630
|
-
`;
|
|
77631
|
-
const viteConfigKitTs = `import { sveltekit } from '@sveltejs/kit/vite';
|
|
77632
|
-
import houdini from 'houdini/vite';
|
|
77633
|
-
import type { UserConfig } from "vite";
|
|
77634
|
-
|
|
77635
|
-
const config: UserConfig = {
|
|
77636
|
-
plugins: [houdini(), sveltekit()],
|
|
77637
|
-
}
|
|
77638
|
-
|
|
77639
76002
|
export default config;
|
|
77640
76003
|
`;
|
|
77641
76004
|
const viteConfigSvelte = `import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
@@ -77648,39 +76011,18 @@ const config = {
|
|
|
77648
76011
|
|
|
77649
76012
|
export default config;
|
|
77650
76013
|
`;
|
|
77651
|
-
|
|
77652
|
-
|
|
77653
|
-
import type { UserConfig } from "vite";
|
|
77654
|
-
|
|
77655
|
-
const config: UserConfig = {
|
|
77656
|
-
plugins: [houdini(), svelte()],
|
|
77657
|
-
}
|
|
77658
|
-
|
|
77659
|
-
export default config;
|
|
77660
|
-
`;
|
|
77661
|
-
let content = "NOTHING!";
|
|
77662
|
-
if (framework === "kit" && typescript) {
|
|
77663
|
-
content = viteConfigKitTs;
|
|
77664
|
-
} else if (framework === "kit" && !typescript) {
|
|
76014
|
+
let content;
|
|
76015
|
+
if (framework === "kit") {
|
|
77665
76016
|
content = viteConfigKit;
|
|
77666
|
-
} else if (framework === "svelte"
|
|
77667
|
-
content = viteConfigSvelteTs;
|
|
77668
|
-
} else if (framework === "svelte" && !typescript) {
|
|
76017
|
+
} else if (framework === "svelte") {
|
|
77669
76018
|
content = viteConfigSvelte;
|
|
77670
76019
|
} else {
|
|
77671
76020
|
throw new Error("Unknown updateViteConfig()");
|
|
77672
76021
|
}
|
|
77673
|
-
|
|
77674
|
-
|
|
77675
|
-
|
|
77676
|
-
|
|
77677
|
-
});
|
|
77678
|
-
} else {
|
|
77679
|
-
await updateFile({
|
|
77680
|
-
filepath: viteConfigPath,
|
|
77681
|
-
content: framework === "kit" ? viteConfigKit : viteConfigSvelte
|
|
77682
|
-
});
|
|
77683
|
-
}
|
|
76022
|
+
await updateFile({
|
|
76023
|
+
filepath: viteConfigPath,
|
|
76024
|
+
content: framework === "kit" ? viteConfigKit : viteConfigSvelte
|
|
76025
|
+
});
|
|
77684
76026
|
}
|
|
77685
76027
|
async function updateSvelteConfig(targetPath, typescript) {
|
|
77686
76028
|
const svelteConfigPath = path_exports.join(targetPath, "svelte.config.js");
|
|
@@ -77701,7 +76043,7 @@ const config = {
|
|
|
77701
76043
|
}
|
|
77702
76044
|
};
|
|
77703
76045
|
|
|
77704
|
-
export default config;
|
|
76046
|
+
export default config;
|
|
77705
76047
|
`;
|
|
77706
76048
|
const newContentJs = `import adapter from '@sveltejs/adapter-auto';
|
|
77707
76049
|
|
|
@@ -77751,8 +76093,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
77751
76093
|
}
|
|
77752
76094
|
packageJSON.devDependencies = {
|
|
77753
76095
|
...packageJSON.devDependencies,
|
|
77754
|
-
houdini: "^1.0.0-next.
|
|
77755
|
-
"houdini-svelte": "^1.0.0-next.
|
|
76096
|
+
houdini: "^1.0.0-next.2",
|
|
76097
|
+
"houdini-svelte": "^1.0.0-next.2",
|
|
77756
76098
|
graphql: "^15.8.0"
|
|
77757
76099
|
};
|
|
77758
76100
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|
|
@@ -77766,6 +76108,7 @@ async function graphqlRCFile(targetPath) {
|
|
|
77766
76108
|
- ./$houdini/graphql/schema.graphql
|
|
77767
76109
|
documents:
|
|
77768
76110
|
- '**/*.gql'
|
|
76111
|
+
- '**/*.svelte'
|
|
77769
76112
|
- ./$houdini/graphql/documents.gql
|
|
77770
76113
|
`;
|
|
77771
76114
|
await updateFile({
|