houdini 1.2.44 → 1.2.46
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-cjs/index.js +664 -848
- package/build/cmd-esm/index.js +514 -698
- package/build/codegen/generators/comments/jsdoc.d.ts +2 -0
- package/build/codegen-cjs/index.js +662 -846
- package/build/codegen-esm/index.js +512 -696
- package/build/lib/graphql.d.ts +1 -1
- package/build/lib/index.d.ts +1 -0
- package/build/lib/typescript.d.ts +19 -0
- package/build/lib-cjs/index.js +726 -467
- package/build/lib-esm/index.js +720 -467
- package/build/runtime/client/index.d.ts +7 -1
- package/build/runtime/client/plugins/fragment.d.ts +2 -2
- package/build/runtime/client/plugins/mutation.d.ts +2 -1
- package/build/runtime/client/plugins/query.d.ts +2 -2
- package/build/runtime/lib/scalars.d.ts +1 -1
- package/build/runtime/lib/types.d.ts +13 -2
- package/build/runtime/router/match.d.ts +3 -2
- package/build/runtime/router/types.d.ts +3 -1
- package/build/runtime-cjs/client/index.d.ts +7 -1
- package/build/runtime-cjs/client/index.js +26 -11
- package/build/runtime-cjs/client/plugins/fragment.d.ts +2 -2
- package/build/runtime-cjs/client/plugins/fragment.js +4 -11
- package/build/runtime-cjs/client/plugins/mutation.d.ts +2 -1
- package/build/runtime-cjs/client/plugins/mutation.js +8 -15
- package/build/runtime-cjs/client/plugins/query.d.ts +2 -2
- package/build/runtime-cjs/client/plugins/query.js +4 -11
- package/build/runtime-cjs/lib/scalars.d.ts +1 -1
- package/build/runtime-cjs/lib/scalars.js +4 -0
- package/build/runtime-cjs/lib/types.d.ts +13 -2
- package/build/runtime-cjs/router/match.d.ts +3 -2
- package/build/runtime-cjs/router/match.js +11 -2
- package/build/runtime-cjs/router/server.js +1 -1
- package/build/runtime-cjs/router/types.d.ts +3 -1
- package/build/runtime-esm/client/index.d.ts +7 -1
- package/build/runtime-esm/client/index.js +26 -11
- package/build/runtime-esm/client/plugins/fragment.d.ts +2 -2
- package/build/runtime-esm/client/plugins/fragment.js +1 -2
- package/build/runtime-esm/client/plugins/mutation.d.ts +2 -1
- package/build/runtime-esm/client/plugins/mutation.js +1 -2
- package/build/runtime-esm/client/plugins/query.d.ts +2 -2
- package/build/runtime-esm/client/plugins/query.js +1 -2
- package/build/runtime-esm/lib/scalars.d.ts +1 -1
- package/build/runtime-esm/lib/scalars.js +6 -0
- package/build/runtime-esm/lib/types.d.ts +13 -2
- package/build/runtime-esm/router/match.d.ts +3 -2
- package/build/runtime-esm/router/match.js +11 -2
- package/build/runtime-esm/router/server.js +1 -1
- package/build/runtime-esm/router/types.d.ts +3 -1
- package/build/test-cjs/index.js +677 -844
- package/build/test-esm/index.js +527 -694
- package/build/vite-cjs/index.js +786 -857
- package/build/vite-esm/index.js +636 -707
- package/package.json +1 -1
- package/build/codegen/generators/typescript/typeReference.d.ts +0 -8
- package/build/codegen/generators/typescript/types.d.ts +0 -10
package/build/cmd-esm/index.js
CHANGED
|
@@ -63311,47 +63311,6 @@ function deepMerge(...objects) {
|
|
|
63311
63311
|
return mergedObj;
|
|
63312
63312
|
}
|
|
63313
63313
|
|
|
63314
|
-
// src/runtime/lib/scalars.ts
|
|
63315
|
-
async function marshalSelection({
|
|
63316
|
-
selection,
|
|
63317
|
-
data
|
|
63318
|
-
}) {
|
|
63319
|
-
const config = getCurrentConfig();
|
|
63320
|
-
if (data === null || typeof data === "undefined") {
|
|
63321
|
-
return data;
|
|
63322
|
-
}
|
|
63323
|
-
if (Array.isArray(data)) {
|
|
63324
|
-
return await Promise.all(data.map((val) => marshalSelection({ selection, data: val })));
|
|
63325
|
-
}
|
|
63326
|
-
const targetSelection = getFieldsForType(selection, data["__typename"], false);
|
|
63327
|
-
return Object.fromEntries(
|
|
63328
|
-
await Promise.all(
|
|
63329
|
-
Object.entries(data).map(async ([fieldName, value]) => {
|
|
63330
|
-
const { type, selection: selection2 } = targetSelection[fieldName];
|
|
63331
|
-
if (!type) {
|
|
63332
|
-
return [fieldName, value];
|
|
63333
|
-
}
|
|
63334
|
-
if (selection2) {
|
|
63335
|
-
return [fieldName, await marshalSelection({ selection: selection2, data: value })];
|
|
63336
|
-
}
|
|
63337
|
-
if (config.scalars?.[type]) {
|
|
63338
|
-
const marshalFn = config.scalars[type].marshal;
|
|
63339
|
-
if (!marshalFn) {
|
|
63340
|
-
throw new Error(
|
|
63341
|
-
`scalar type ${type} is missing a \`marshal\` function. see https://github.com/AlecAivazis/houdini#%EF%B8%8Fcustom-scalars`
|
|
63342
|
-
);
|
|
63343
|
-
}
|
|
63344
|
-
if (Array.isArray(value)) {
|
|
63345
|
-
return [fieldName, value.map(marshalFn)];
|
|
63346
|
-
}
|
|
63347
|
-
return [fieldName, marshalFn(value)];
|
|
63348
|
-
}
|
|
63349
|
-
return [fieldName, value];
|
|
63350
|
-
})
|
|
63351
|
-
)
|
|
63352
|
-
);
|
|
63353
|
-
}
|
|
63354
|
-
|
|
63355
63314
|
// src/runtime/lib/types.ts
|
|
63356
63315
|
var CachePolicy = {
|
|
63357
63316
|
CacheOrNetwork: "CacheOrNetwork",
|
|
@@ -63379,11 +63338,6 @@ var RefetchUpdateMode = {
|
|
|
63379
63338
|
prepend: "prepend",
|
|
63380
63339
|
replace: "replace"
|
|
63381
63340
|
};
|
|
63382
|
-
var DataSource = {
|
|
63383
|
-
Cache: "cache",
|
|
63384
|
-
Network: "network",
|
|
63385
|
-
Ssr: "ssr"
|
|
63386
|
-
};
|
|
63387
63341
|
var fragmentKey = " $fragments";
|
|
63388
63342
|
var PendingValue = Symbol("houdini_loading");
|
|
63389
63343
|
|
|
@@ -67291,202 +67245,6 @@ var cache_default = new Cache();
|
|
|
67291
67245
|
// src/runtime/client/plugins/cache.ts
|
|
67292
67246
|
var serverSide = typeof globalThis.window === "undefined";
|
|
67293
67247
|
|
|
67294
|
-
// src/runtime/client/utils/documentPlugins.ts
|
|
67295
|
-
var documentPlugin = (kind, source) => {
|
|
67296
|
-
return () => {
|
|
67297
|
-
const sourceHandlers = source();
|
|
67298
|
-
const enterWrapper = (handler) => {
|
|
67299
|
-
return !handler ? void 0 : (ctx, handlers) => {
|
|
67300
|
-
if (ctx.artifact.kind !== kind) {
|
|
67301
|
-
return handlers.next(ctx);
|
|
67302
|
-
}
|
|
67303
|
-
return handler(ctx, handlers);
|
|
67304
|
-
};
|
|
67305
|
-
};
|
|
67306
|
-
const exitWrapper = (handler) => {
|
|
67307
|
-
return !handler ? void 0 : (ctx, handlers) => {
|
|
67308
|
-
if (ctx.artifact.kind !== kind) {
|
|
67309
|
-
return handlers.resolve(ctx);
|
|
67310
|
-
}
|
|
67311
|
-
return handler(ctx, handlers);
|
|
67312
|
-
};
|
|
67313
|
-
};
|
|
67314
|
-
return {
|
|
67315
|
-
start: enterWrapper(sourceHandlers.start),
|
|
67316
|
-
network: enterWrapper(sourceHandlers.network),
|
|
67317
|
-
afterNetwork: exitWrapper(sourceHandlers.afterNetwork),
|
|
67318
|
-
end: exitWrapper(sourceHandlers.end),
|
|
67319
|
-
catch: sourceHandlers.catch ? (ctx, handlers) => sourceHandlers.catch(ctx, handlers) : void 0,
|
|
67320
|
-
cleanup: (...args) => sourceHandlers.cleanup?.(...args)
|
|
67321
|
-
};
|
|
67322
|
-
};
|
|
67323
|
-
};
|
|
67324
|
-
|
|
67325
|
-
// src/runtime/client/plugins/query.ts
|
|
67326
|
-
var query = documentPlugin(ArtifactKind.Query, function() {
|
|
67327
|
-
let subscriptionSpec = null;
|
|
67328
|
-
let lastVariables = null;
|
|
67329
|
-
return {
|
|
67330
|
-
start(ctx, { next }) {
|
|
67331
|
-
const runtimeScalarPayload = {
|
|
67332
|
-
session: ctx.session
|
|
67333
|
-
};
|
|
67334
|
-
ctx.variables = {
|
|
67335
|
-
...lastVariables,
|
|
67336
|
-
...Object.fromEntries(
|
|
67337
|
-
Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
|
|
67338
|
-
([field, type]) => {
|
|
67339
|
-
const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
|
|
67340
|
-
if (!runtimeScalar) {
|
|
67341
|
-
return [field, type];
|
|
67342
|
-
}
|
|
67343
|
-
return [field, runtimeScalar.resolve(runtimeScalarPayload)];
|
|
67344
|
-
}
|
|
67345
|
-
)
|
|
67346
|
-
),
|
|
67347
|
-
...ctx.variables
|
|
67348
|
-
};
|
|
67349
|
-
next(ctx);
|
|
67350
|
-
},
|
|
67351
|
-
end(ctx, { resolve: resolve2, marshalVariables, variablesChanged }) {
|
|
67352
|
-
if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
|
|
67353
|
-
if (subscriptionSpec) {
|
|
67354
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
67355
|
-
}
|
|
67356
|
-
lastVariables = { ...marshalVariables(ctx) };
|
|
67357
|
-
const variables = lastVariables;
|
|
67358
|
-
subscriptionSpec = {
|
|
67359
|
-
rootType: ctx.artifact.rootType,
|
|
67360
|
-
selection: ctx.artifact.selection,
|
|
67361
|
-
variables: () => variables,
|
|
67362
|
-
set: (newValue) => {
|
|
67363
|
-
resolve2(ctx, {
|
|
67364
|
-
data: newValue,
|
|
67365
|
-
errors: null,
|
|
67366
|
-
fetching: false,
|
|
67367
|
-
partial: false,
|
|
67368
|
-
stale: false,
|
|
67369
|
-
source: DataSource.Cache,
|
|
67370
|
-
variables: ctx.variables ?? {}
|
|
67371
|
-
});
|
|
67372
|
-
}
|
|
67373
|
-
};
|
|
67374
|
-
cache_default.subscribe(subscriptionSpec, lastVariables);
|
|
67375
|
-
}
|
|
67376
|
-
resolve2(ctx);
|
|
67377
|
-
},
|
|
67378
|
-
cleanup() {
|
|
67379
|
-
if (subscriptionSpec) {
|
|
67380
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
67381
|
-
lastVariables = null;
|
|
67382
|
-
}
|
|
67383
|
-
}
|
|
67384
|
-
};
|
|
67385
|
-
});
|
|
67386
|
-
|
|
67387
|
-
// src/runtime/client/plugins/fragment.ts
|
|
67388
|
-
var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
67389
|
-
let subscriptionSpec = null;
|
|
67390
|
-
let lastReference = null;
|
|
67391
|
-
return {
|
|
67392
|
-
start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
|
|
67393
|
-
if (!ctx.stuff.parentID) {
|
|
67394
|
-
return next(ctx);
|
|
67395
|
-
}
|
|
67396
|
-
const currentReference = {
|
|
67397
|
-
parent: ctx.stuff.parentID,
|
|
67398
|
-
variables: marshalVariables(ctx)
|
|
67399
|
-
};
|
|
67400
|
-
if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
|
|
67401
|
-
if (subscriptionSpec) {
|
|
67402
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
67403
|
-
}
|
|
67404
|
-
const variables = marshalVariables(ctx);
|
|
67405
|
-
subscriptionSpec = {
|
|
67406
|
-
rootType: ctx.artifact.rootType,
|
|
67407
|
-
selection: ctx.artifact.selection,
|
|
67408
|
-
variables: () => variables,
|
|
67409
|
-
parentID: ctx.stuff.parentID,
|
|
67410
|
-
set: (newValue) => {
|
|
67411
|
-
resolve2(ctx, {
|
|
67412
|
-
data: newValue,
|
|
67413
|
-
errors: null,
|
|
67414
|
-
fetching: false,
|
|
67415
|
-
partial: false,
|
|
67416
|
-
stale: false,
|
|
67417
|
-
source: DataSource.Cache,
|
|
67418
|
-
variables
|
|
67419
|
-
});
|
|
67420
|
-
}
|
|
67421
|
-
};
|
|
67422
|
-
cache_default.subscribe(subscriptionSpec, variables);
|
|
67423
|
-
lastReference = currentReference;
|
|
67424
|
-
}
|
|
67425
|
-
next(ctx);
|
|
67426
|
-
},
|
|
67427
|
-
cleanup() {
|
|
67428
|
-
if (subscriptionSpec) {
|
|
67429
|
-
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
|
|
67430
|
-
}
|
|
67431
|
-
}
|
|
67432
|
-
};
|
|
67433
|
-
});
|
|
67434
|
-
|
|
67435
|
-
// src/runtime/client/plugins/mutation.ts
|
|
67436
|
-
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
67437
|
-
return {
|
|
67438
|
-
async start(ctx, { next, marshalVariables }) {
|
|
67439
|
-
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
67440
|
-
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
67441
|
-
let toNotify = [];
|
|
67442
|
-
if (optimisticResponse) {
|
|
67443
|
-
toNotify = cache_default.write({
|
|
67444
|
-
selection: ctx.artifact.selection,
|
|
67445
|
-
data: await marshalSelection({
|
|
67446
|
-
selection: ctx.artifact.selection,
|
|
67447
|
-
data: optimisticResponse
|
|
67448
|
-
}),
|
|
67449
|
-
variables: marshalVariables(ctx),
|
|
67450
|
-
layer: layerOptimistic.id
|
|
67451
|
-
});
|
|
67452
|
-
}
|
|
67453
|
-
ctx.cacheParams = {
|
|
67454
|
-
...ctx.cacheParams,
|
|
67455
|
-
layer: layerOptimistic,
|
|
67456
|
-
notifySubscribers: toNotify,
|
|
67457
|
-
forceNotify: true
|
|
67458
|
-
};
|
|
67459
|
-
next(ctx);
|
|
67460
|
-
},
|
|
67461
|
-
afterNetwork(ctx, { resolve: resolve2 }) {
|
|
67462
|
-
if (ctx.cacheParams?.layer) {
|
|
67463
|
-
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
67464
|
-
}
|
|
67465
|
-
resolve2(ctx);
|
|
67466
|
-
},
|
|
67467
|
-
end(ctx, { resolve: resolve2, value }) {
|
|
67468
|
-
const hasErrors = value.errors && value.errors.length > 0;
|
|
67469
|
-
if (hasErrors) {
|
|
67470
|
-
if (ctx.cacheParams?.layer) {
|
|
67471
|
-
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
67472
|
-
}
|
|
67473
|
-
}
|
|
67474
|
-
if (ctx.cacheParams?.layer) {
|
|
67475
|
-
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
67476
|
-
}
|
|
67477
|
-
resolve2(ctx);
|
|
67478
|
-
},
|
|
67479
|
-
catch(ctx, { error }) {
|
|
67480
|
-
if (ctx.cacheParams?.layer) {
|
|
67481
|
-
const { layer } = ctx.cacheParams;
|
|
67482
|
-
cache_default.clearLayer(layer.id);
|
|
67483
|
-
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
67484
|
-
}
|
|
67485
|
-
throw error;
|
|
67486
|
-
}
|
|
67487
|
-
};
|
|
67488
|
-
});
|
|
67489
|
-
|
|
67490
67248
|
// src/lib/types.ts
|
|
67491
67249
|
var LogLevel = {
|
|
67492
67250
|
Full: "full",
|
|
@@ -68499,7 +68257,7 @@ function formatErrors(e3, afterError) {
|
|
|
68499
68257
|
afterError?.(e3);
|
|
68500
68258
|
}
|
|
68501
68259
|
}
|
|
68502
|
-
function unwrapType(config, type, wrappers = []) {
|
|
68260
|
+
function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
|
|
68503
68261
|
if (type.kind === "NonNullType") {
|
|
68504
68262
|
return unwrapType(config, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
68505
68263
|
}
|
|
@@ -68515,6 +68273,11 @@ function unwrapType(config, type, wrappers = []) {
|
|
|
68515
68273
|
if (type instanceof graphql3.GraphQLList) {
|
|
68516
68274
|
return unwrapType(config, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
68517
68275
|
}
|
|
68276
|
+
if (convertRuntimeScalars && config.configFile.features?.runtimeScalars?.[type.name.value]) {
|
|
68277
|
+
type = config.schema.getType(
|
|
68278
|
+
config.configFile.features?.runtimeScalars?.[type.name.value].type
|
|
68279
|
+
);
|
|
68280
|
+
}
|
|
68518
68281
|
const namedType = config.schema.getType(type.name.value || type.name);
|
|
68519
68282
|
if (!namedType) {
|
|
68520
68283
|
throw new Error("Unknown type: " + type.name.value || type.name);
|
|
@@ -68582,7 +68345,12 @@ function deepMerge2(filepath, ...targets) {
|
|
|
68582
68345
|
// src/lib/parse.ts
|
|
68583
68346
|
function parseJS(str, config) {
|
|
68584
68347
|
const defaultConfig = {
|
|
68585
|
-
plugins: [
|
|
68348
|
+
plugins: [
|
|
68349
|
+
"typescript",
|
|
68350
|
+
"importAssertions",
|
|
68351
|
+
"decorators-legacy",
|
|
68352
|
+
"explicitResourceManagement"
|
|
68353
|
+
],
|
|
68586
68354
|
sourceType: "module"
|
|
68587
68355
|
};
|
|
68588
68356
|
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|
|
@@ -68709,6 +68477,152 @@ async function detectTools(cwd = process.cwd()) {
|
|
|
68709
68477
|
};
|
|
68710
68478
|
}
|
|
68711
68479
|
|
|
68480
|
+
// src/lib/typescript.ts
|
|
68481
|
+
var recast2 = __toESM(require_main2(), 1);
|
|
68482
|
+
import * as graphql4 from "graphql";
|
|
68483
|
+
var AST2 = recast2.types.builders;
|
|
68484
|
+
function unwrappedTsTypeReference(config, filepath, missingScalars, {
|
|
68485
|
+
type,
|
|
68486
|
+
wrappers
|
|
68487
|
+
}, body) {
|
|
68488
|
+
let result;
|
|
68489
|
+
if (graphql4.isScalarType(type)) {
|
|
68490
|
+
result = scalarPropertyValue(config, filepath, missingScalars, type, body, null);
|
|
68491
|
+
} else if (graphql4.isEnumType(type)) {
|
|
68492
|
+
result = enumReference(config, body, type.name);
|
|
68493
|
+
} else {
|
|
68494
|
+
result = AST2.tsTypeReference(AST2.identifier(type.name));
|
|
68495
|
+
}
|
|
68496
|
+
for (const toWrap of wrappers) {
|
|
68497
|
+
if (toWrap === "NonNull" /* NonNull */) {
|
|
68498
|
+
continue;
|
|
68499
|
+
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
68500
|
+
result = nullableField(result, true);
|
|
68501
|
+
} else if (toWrap === "List" /* List */) {
|
|
68502
|
+
result = AST2.tsArrayType(AST2.tsParenthesizedType(result));
|
|
68503
|
+
}
|
|
68504
|
+
}
|
|
68505
|
+
return result;
|
|
68506
|
+
}
|
|
68507
|
+
function tsTypeReference(config, filepath, missingScalars, definition, body) {
|
|
68508
|
+
const { type, wrappers } = unwrapType(config, definition.type);
|
|
68509
|
+
return unwrappedTsTypeReference(
|
|
68510
|
+
config,
|
|
68511
|
+
filepath,
|
|
68512
|
+
missingScalars,
|
|
68513
|
+
{ type, wrappers },
|
|
68514
|
+
body
|
|
68515
|
+
);
|
|
68516
|
+
}
|
|
68517
|
+
function enumReference(config, body, name) {
|
|
68518
|
+
ensureImports({
|
|
68519
|
+
config,
|
|
68520
|
+
body,
|
|
68521
|
+
import: ["ValueOf"],
|
|
68522
|
+
importKind: "type",
|
|
68523
|
+
sourceModule: "$houdini/runtime/lib/types"
|
|
68524
|
+
});
|
|
68525
|
+
return AST2.tsTypeReference(
|
|
68526
|
+
AST2.identifier("ValueOf"),
|
|
68527
|
+
AST2.tsTypeParameterInstantiation([AST2.tsTypeQuery(AST2.identifier(name))])
|
|
68528
|
+
);
|
|
68529
|
+
}
|
|
68530
|
+
function readonlyProperty(prop, enable = true) {
|
|
68531
|
+
if (enable) {
|
|
68532
|
+
prop.readonly = true;
|
|
68533
|
+
}
|
|
68534
|
+
return prop;
|
|
68535
|
+
}
|
|
68536
|
+
function nullableField(inner, input = false) {
|
|
68537
|
+
const members = [inner, AST2.tsNullKeyword()];
|
|
68538
|
+
if (input) {
|
|
68539
|
+
members.push(AST2.tsUndefinedKeyword());
|
|
68540
|
+
}
|
|
68541
|
+
return AST2.tsUnionType(members);
|
|
68542
|
+
}
|
|
68543
|
+
function scalarPropertyValue(config, filepath, missingScalars, target, body, field) {
|
|
68544
|
+
if (config.configFile.features?.componentFields && target.name === config.componentScalar) {
|
|
68545
|
+
if (!field) {
|
|
68546
|
+
return AST2.tsNeverKeyword();
|
|
68547
|
+
}
|
|
68548
|
+
const component = config.componentFields[field.parent][field.field];
|
|
68549
|
+
const sourcePathRelative = path_exports.relative(
|
|
68550
|
+
path_exports.join(config.projectRoot, "src"),
|
|
68551
|
+
component.filepath
|
|
68552
|
+
);
|
|
68553
|
+
let sourcePathParsed = path_exports.parse(sourcePathRelative);
|
|
68554
|
+
let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
|
|
68555
|
+
const localImport = ensureImports({
|
|
68556
|
+
config,
|
|
68557
|
+
body,
|
|
68558
|
+
import: "__component__" + component.fragment,
|
|
68559
|
+
sourceModule: path_exports.join(
|
|
68560
|
+
path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
|
|
68561
|
+
"src",
|
|
68562
|
+
sourcePath
|
|
68563
|
+
)
|
|
68564
|
+
}) ?? "__component__" + component.fragment;
|
|
68565
|
+
const parameters = AST2.tsTypeReference(AST2.identifier("Parameters"));
|
|
68566
|
+
parameters.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
68567
|
+
AST2.tsTypeQuery(AST2.identifier(localImport))
|
|
68568
|
+
]);
|
|
68569
|
+
const indexed = AST2.tsIndexedAccessType(
|
|
68570
|
+
parameters,
|
|
68571
|
+
AST2.tsLiteralType(AST2.numericLiteral(0))
|
|
68572
|
+
);
|
|
68573
|
+
const omit = AST2.tsTypeReference(AST2.identifier("Omit"));
|
|
68574
|
+
omit.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
68575
|
+
indexed,
|
|
68576
|
+
AST2.tsLiteralType(AST2.stringLiteral(component.prop))
|
|
68577
|
+
]);
|
|
68578
|
+
const arg = AST2.identifier("props");
|
|
68579
|
+
arg.typeAnnotation = AST2.tsTypeAnnotation(omit);
|
|
68580
|
+
const returnType = AST2.tsTypeReference(AST2.identifier("ReturnType"));
|
|
68581
|
+
returnType.typeParameters = AST2.tsTypeParameterInstantiation([
|
|
68582
|
+
AST2.tsTypeQuery(AST2.identifier(localImport))
|
|
68583
|
+
]);
|
|
68584
|
+
const fnType = AST2.tsFunctionType([arg]);
|
|
68585
|
+
fnType.typeAnnotation = AST2.tsTypeAnnotation(returnType);
|
|
68586
|
+
return fnType;
|
|
68587
|
+
}
|
|
68588
|
+
switch (target.name) {
|
|
68589
|
+
case "String": {
|
|
68590
|
+
return AST2.tsStringKeyword();
|
|
68591
|
+
}
|
|
68592
|
+
case "Int": {
|
|
68593
|
+
return AST2.tsNumberKeyword();
|
|
68594
|
+
}
|
|
68595
|
+
case "Float": {
|
|
68596
|
+
return AST2.tsNumberKeyword();
|
|
68597
|
+
}
|
|
68598
|
+
case "Boolean": {
|
|
68599
|
+
return AST2.tsBooleanKeyword();
|
|
68600
|
+
}
|
|
68601
|
+
case "ID": {
|
|
68602
|
+
return AST2.tsStringKeyword();
|
|
68603
|
+
}
|
|
68604
|
+
default: {
|
|
68605
|
+
if (graphql4.isNonNullType(target) && "ofType" in target) {
|
|
68606
|
+
return scalarPropertyValue(
|
|
68607
|
+
config,
|
|
68608
|
+
filepath,
|
|
68609
|
+
missingScalars,
|
|
68610
|
+
target.ofType,
|
|
68611
|
+
body,
|
|
68612
|
+
field
|
|
68613
|
+
);
|
|
68614
|
+
}
|
|
68615
|
+
if (config.scalars?.[target.name]) {
|
|
68616
|
+
return AST2.tsTypeReference(AST2.identifier(config.scalars?.[target.name].type));
|
|
68617
|
+
}
|
|
68618
|
+
if (target.name !== config.componentScalar) {
|
|
68619
|
+
missingScalars.add(target.name);
|
|
68620
|
+
}
|
|
68621
|
+
return AST2.tsAnyKeyword();
|
|
68622
|
+
}
|
|
68623
|
+
}
|
|
68624
|
+
}
|
|
68625
|
+
|
|
68712
68626
|
// ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
|
|
68713
68627
|
var WalkerBase = class {
|
|
68714
68628
|
constructor() {
|
|
@@ -68822,7 +68736,7 @@ async function asyncWalk(ast, { enter, leave }) {
|
|
|
68822
68736
|
}
|
|
68823
68737
|
|
|
68824
68738
|
// src/lib/walk.ts
|
|
68825
|
-
import * as
|
|
68739
|
+
import * as graphql5 from "graphql";
|
|
68826
68740
|
async function find_graphql(config, parsedScript, walker) {
|
|
68827
68741
|
await asyncWalk(parsedScript, {
|
|
68828
68742
|
async enter(node, parent2) {
|
|
@@ -68877,7 +68791,7 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
68877
68791
|
} else if (!documentString) {
|
|
68878
68792
|
return;
|
|
68879
68793
|
}
|
|
68880
|
-
const parsedTag =
|
|
68794
|
+
const parsedTag = graphql5.parse(documentString);
|
|
68881
68795
|
if (walker.where && !walker.where(parsedTag, { node, parent: parent2 })) {
|
|
68882
68796
|
return;
|
|
68883
68797
|
}
|
|
@@ -69009,7 +68923,7 @@ function extractAnonymousQuery(config, raw, expr, propName) {
|
|
|
69009
68923
|
};
|
|
69010
68924
|
return defs.concat([
|
|
69011
68925
|
{
|
|
69012
|
-
raw:
|
|
68926
|
+
raw: graphql5.print(parsed),
|
|
69013
68927
|
parsed
|
|
69014
68928
|
}
|
|
69015
68929
|
]);
|
|
@@ -69024,7 +68938,7 @@ function extractAnonymousQuery(config, raw, expr, propName) {
|
|
|
69024
68938
|
|
|
69025
68939
|
// src/lib/router/manifest.ts
|
|
69026
68940
|
var t2 = __toESM(require_lib6(), 1);
|
|
69027
|
-
import * as
|
|
68941
|
+
import * as graphql6 from "graphql";
|
|
69028
68942
|
|
|
69029
68943
|
// src/lib/router/server.ts
|
|
69030
68944
|
import path2 from "node:path";
|
|
@@ -69062,11 +68976,11 @@ async function loadLocalSchema(config) {
|
|
|
69062
68976
|
}
|
|
69063
68977
|
|
|
69064
68978
|
// src/codegen/index.ts
|
|
69065
|
-
import * as
|
|
68979
|
+
import * as graphql32 from "graphql";
|
|
69066
68980
|
|
|
69067
68981
|
// src/codegen/generators/artifacts/index.ts
|
|
69068
|
-
var
|
|
69069
|
-
import * as
|
|
68982
|
+
var recast5 = __toESM(require_main2(), 1);
|
|
68983
|
+
import * as graphql17 from "graphql";
|
|
69070
68984
|
|
|
69071
68985
|
// src/codegen/utils/commonjs.ts
|
|
69072
68986
|
var cjsIndexFilePreamble = `"use strict";
|
|
@@ -69308,19 +69222,19 @@ var FieldCollection = class {
|
|
|
69308
69222
|
};
|
|
69309
69223
|
|
|
69310
69224
|
// src/codegen/utils/moduleExport.ts
|
|
69311
|
-
var
|
|
69312
|
-
var
|
|
69225
|
+
var recast3 = __toESM(require_main2(), 1);
|
|
69226
|
+
var AST3 = recast3.types.builders;
|
|
69313
69227
|
function moduleExport(config, key, value) {
|
|
69314
69228
|
if (config.module === "commonjs") {
|
|
69315
|
-
let target =
|
|
69229
|
+
let target = AST3.memberExpression(AST3.identifier("module"), AST3.identifier("exports"));
|
|
69316
69230
|
if (key !== "default") {
|
|
69317
|
-
target =
|
|
69231
|
+
target = AST3.memberExpression(target, AST3.identifier(key));
|
|
69318
69232
|
}
|
|
69319
|
-
return
|
|
69233
|
+
return AST3.expressionStatement(AST3.assignmentExpression("=", target, value));
|
|
69320
69234
|
}
|
|
69321
|
-
return key === "default" ?
|
|
69322
|
-
|
|
69323
|
-
|
|
69235
|
+
return key === "default" ? AST3.exportDefaultDeclaration(value) : AST3.exportNamedDeclaration(
|
|
69236
|
+
AST3.variableDeclaration("const", [
|
|
69237
|
+
AST3.variableDeclarator(AST3.identifier(key), value)
|
|
69324
69238
|
])
|
|
69325
69239
|
);
|
|
69326
69240
|
}
|
|
@@ -69577,7 +69491,7 @@ var serialize = (value, { json, lossy } = {}) => {
|
|
|
69577
69491
|
var esm_default = typeof structuredClone === "function" ? (any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize(any, options)) : structuredClone(any) : (any, options) => deserialize(serialize(any, options));
|
|
69578
69492
|
|
|
69579
69493
|
// src/codegen/transforms/fragmentVariables.ts
|
|
69580
|
-
import * as
|
|
69494
|
+
import * as graphql8 from "graphql";
|
|
69581
69495
|
|
|
69582
69496
|
// src/codegen/utils/stripLoc.ts
|
|
69583
69497
|
function stripLoc(value) {
|
|
@@ -69598,7 +69512,7 @@ function stripLoc(value) {
|
|
|
69598
69512
|
}
|
|
69599
69513
|
|
|
69600
69514
|
// src/codegen/transforms/collectDefinitions.ts
|
|
69601
|
-
import * as
|
|
69515
|
+
import * as graphql7 from "graphql";
|
|
69602
69516
|
import { Kind as GraphqlKinds } from "graphql";
|
|
69603
69517
|
async function includeFragmentDefinitions(config, documents) {
|
|
69604
69518
|
const fragments = collectDefinitions(config, documents);
|
|
@@ -69648,10 +69562,10 @@ function collectDefinitions(config, docs) {
|
|
|
69648
69562
|
}
|
|
69649
69563
|
function findRequiredFragments(config, definition) {
|
|
69650
69564
|
const referencedFragments = [];
|
|
69651
|
-
const typeInfo = new
|
|
69652
|
-
definition.selectionSet =
|
|
69565
|
+
const typeInfo = new graphql7.TypeInfo(config.schema);
|
|
69566
|
+
definition.selectionSet = graphql7.visit(
|
|
69653
69567
|
definition,
|
|
69654
|
-
|
|
69568
|
+
graphql7.visitWithTypeInfo(typeInfo, {
|
|
69655
69569
|
FragmentSpread(node) {
|
|
69656
69570
|
referencedFragments.push(node.name.value);
|
|
69657
69571
|
}
|
|
@@ -69685,7 +69599,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
69685
69599
|
}
|
|
69686
69600
|
|
|
69687
69601
|
// src/codegen/transforms/fragmentVariables.ts
|
|
69688
|
-
var GraphqlKinds2 =
|
|
69602
|
+
var GraphqlKinds2 = graphql8.Kind;
|
|
69689
69603
|
async function fragmentVariables(config, documents) {
|
|
69690
69604
|
const fragments = collectDefinitions(config, documents);
|
|
69691
69605
|
const generatedFragments = {};
|
|
@@ -69708,7 +69622,7 @@ async function fragmentVariables(config, documents) {
|
|
|
69708
69622
|
});
|
|
69709
69623
|
}
|
|
69710
69624
|
const doc = {
|
|
69711
|
-
kind:
|
|
69625
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
69712
69626
|
definitions: Object.values(generatedFragments)
|
|
69713
69627
|
};
|
|
69714
69628
|
documents.push({
|
|
@@ -69779,7 +69693,7 @@ function inlineFragmentArgs({
|
|
|
69779
69693
|
return null;
|
|
69780
69694
|
};
|
|
69781
69695
|
const result = esm_default(
|
|
69782
|
-
|
|
69696
|
+
graphql8.visit(document, {
|
|
69783
69697
|
FragmentSpread(node) {
|
|
69784
69698
|
if (!fragmentDefinitions[node.name.value]) {
|
|
69785
69699
|
throw new Error("Could not find definition for fragment" + node.name.value);
|
|
@@ -69865,7 +69779,7 @@ function inlineFragmentArgs({
|
|
|
69865
69779
|
);
|
|
69866
69780
|
if (newName) {
|
|
69867
69781
|
result.name = {
|
|
69868
|
-
kind:
|
|
69782
|
+
kind: graphql8.Kind.NAME,
|
|
69869
69783
|
value: newName
|
|
69870
69784
|
};
|
|
69871
69785
|
}
|
|
@@ -70032,7 +69946,7 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
|
|
|
70032
69946
|
}
|
|
70033
69947
|
|
|
70034
69948
|
// src/codegen/generators/artifacts/inputs.ts
|
|
70035
|
-
import * as
|
|
69949
|
+
import * as graphql9 from "graphql";
|
|
70036
69950
|
function inputObject(config, inputs, runtimeScalars) {
|
|
70037
69951
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
70038
69952
|
const inputObj = {
|
|
@@ -70062,10 +69976,10 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
|
|
|
70062
69976
|
if (visitedTypes.has(type.name)) {
|
|
70063
69977
|
return;
|
|
70064
69978
|
}
|
|
70065
|
-
if (
|
|
69979
|
+
if (graphql9.isEnumType(type) || graphql9.isScalarType(type)) {
|
|
70066
69980
|
return;
|
|
70067
69981
|
}
|
|
70068
|
-
if (
|
|
69982
|
+
if (graphql9.isUnionType(type)) {
|
|
70069
69983
|
return;
|
|
70070
69984
|
}
|
|
70071
69985
|
visitedTypes.add(type.name);
|
|
@@ -70083,50 +69997,50 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
|
|
|
70083
69997
|
}
|
|
70084
69998
|
|
|
70085
69999
|
// src/codegen/generators/artifacts/operations.ts
|
|
70086
|
-
import * as
|
|
70000
|
+
import * as graphql11 from "graphql";
|
|
70087
70001
|
|
|
70088
70002
|
// src/codegen/generators/artifacts/utils.ts
|
|
70089
|
-
var
|
|
70090
|
-
import * as
|
|
70091
|
-
var
|
|
70003
|
+
var recast4 = __toESM(require_main2(), 1);
|
|
70004
|
+
import * as graphql10 from "graphql";
|
|
70005
|
+
var AST4 = recast4.types.builders;
|
|
70092
70006
|
function serializeValue(value) {
|
|
70093
70007
|
if (Array.isArray(value)) {
|
|
70094
|
-
return
|
|
70008
|
+
return AST4.arrayExpression(value.map(serializeValue));
|
|
70095
70009
|
}
|
|
70096
70010
|
if (typeof value === "object" && value !== null) {
|
|
70097
|
-
return
|
|
70011
|
+
return AST4.objectExpression(
|
|
70098
70012
|
Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
|
|
70099
|
-
return
|
|
70013
|
+
return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
|
|
70100
70014
|
})
|
|
70101
70015
|
);
|
|
70102
70016
|
}
|
|
70103
70017
|
if (typeof value === "string") {
|
|
70104
70018
|
if (value.indexOf("\n") !== -1) {
|
|
70105
|
-
return
|
|
70106
|
-
[
|
|
70019
|
+
return AST4.templateLiteral(
|
|
70020
|
+
[AST4.templateElement({ raw: value, cooked: value }, true)],
|
|
70107
70021
|
[]
|
|
70108
70022
|
);
|
|
70109
70023
|
}
|
|
70110
|
-
return
|
|
70024
|
+
return AST4.stringLiteral(value);
|
|
70111
70025
|
}
|
|
70112
|
-
return
|
|
70026
|
+
return AST4.literal(value);
|
|
70113
70027
|
}
|
|
70114
70028
|
function convertValue(config, val) {
|
|
70115
70029
|
let value;
|
|
70116
70030
|
let kind;
|
|
70117
|
-
if (val.kind ===
|
|
70031
|
+
if (val.kind === graphql10.Kind.INT) {
|
|
70118
70032
|
value = parseInt(val.value, 10);
|
|
70119
70033
|
kind = "Int";
|
|
70120
|
-
} else if (val.kind ===
|
|
70034
|
+
} else if (val.kind === graphql10.Kind.FLOAT) {
|
|
70121
70035
|
value = parseFloat(val.value);
|
|
70122
70036
|
kind = "Float";
|
|
70123
|
-
} else if (val.kind ===
|
|
70037
|
+
} else if (val.kind === graphql10.Kind.BOOLEAN) {
|
|
70124
70038
|
value = val.value;
|
|
70125
70039
|
kind = "Boolean";
|
|
70126
|
-
} else if (val.kind ===
|
|
70040
|
+
} else if (val.kind === graphql10.Kind.VARIABLE) {
|
|
70127
70041
|
value = val.name.value;
|
|
70128
70042
|
kind = "Variable";
|
|
70129
|
-
} else if (val.kind ===
|
|
70043
|
+
} else if (val.kind === graphql10.Kind.STRING) {
|
|
70130
70044
|
value = val.value;
|
|
70131
70045
|
kind = "String";
|
|
70132
70046
|
}
|
|
@@ -70139,9 +70053,13 @@ function operationsByPath(config, filepath, definition, filterTypes) {
|
|
|
70139
70053
|
return {};
|
|
70140
70054
|
}
|
|
70141
70055
|
const pathOperations = {};
|
|
70142
|
-
|
|
70056
|
+
graphql11.visit(definition, {
|
|
70143
70057
|
FragmentSpread(node, _3, __, ___, ancestors) {
|
|
70144
|
-
|
|
70058
|
+
let nameWithoutHash = node.name.value;
|
|
70059
|
+
if (node.directives && node.directives.find((directive) => directive.name.value === "with")) {
|
|
70060
|
+
nameWithoutHash = nameWithoutHash.substring(0, nameWithoutHash.lastIndexOf("_"));
|
|
70061
|
+
}
|
|
70062
|
+
if (!config.isListFragment(nameWithoutHash)) {
|
|
70145
70063
|
return;
|
|
70146
70064
|
}
|
|
70147
70065
|
const path3 = ancestorKey(ancestors);
|
|
@@ -70152,8 +70070,8 @@ function operationsByPath(config, filepath, definition, filterTypes) {
|
|
|
70152
70070
|
operationObject({
|
|
70153
70071
|
config,
|
|
70154
70072
|
filepath,
|
|
70155
|
-
listName: config.listNameFromFragment(
|
|
70156
|
-
operationKind: config.listOperationFromFragment(
|
|
70073
|
+
listName: config.listNameFromFragment(nameWithoutHash),
|
|
70074
|
+
operationKind: config.listOperationFromFragment(nameWithoutHash),
|
|
70157
70075
|
type: parentTypeFromAncestors(config.schema, filepath, ancestors).name,
|
|
70158
70076
|
selection: node
|
|
70159
70077
|
})
|
|
@@ -70298,19 +70216,19 @@ function ancestorKey(ancestors) {
|
|
|
70298
70216
|
}
|
|
70299
70217
|
|
|
70300
70218
|
// src/codegen/generators/artifacts/selection.ts
|
|
70301
|
-
import * as
|
|
70219
|
+
import * as graphql16 from "graphql";
|
|
70302
70220
|
|
|
70303
70221
|
// src/codegen/transforms/list.ts
|
|
70304
|
-
import * as
|
|
70222
|
+
import * as graphql14 from "graphql";
|
|
70305
70223
|
|
|
70306
70224
|
// src/codegen/utils/objectIdentificationSelection.ts
|
|
70307
|
-
import * as
|
|
70225
|
+
import * as graphql12 from "graphql";
|
|
70308
70226
|
var objectIdentificationSelection = (config, type) => {
|
|
70309
70227
|
return config.keyFieldsForType(type.name).map((key) => {
|
|
70310
70228
|
return {
|
|
70311
|
-
kind:
|
|
70229
|
+
kind: graphql12.Kind.FIELD,
|
|
70312
70230
|
name: {
|
|
70313
|
-
kind:
|
|
70231
|
+
kind: graphql12.Kind.NAME,
|
|
70314
70232
|
value: key
|
|
70315
70233
|
}
|
|
70316
70234
|
};
|
|
@@ -70318,7 +70236,7 @@ var objectIdentificationSelection = (config, type) => {
|
|
|
70318
70236
|
};
|
|
70319
70237
|
|
|
70320
70238
|
// src/codegen/transforms/paginate.ts
|
|
70321
|
-
import * as
|
|
70239
|
+
import * as graphql13 from "graphql";
|
|
70322
70240
|
async function paginate(config, documents) {
|
|
70323
70241
|
const newDocs = [];
|
|
70324
70242
|
for (const doc of documents) {
|
|
@@ -70351,7 +70269,7 @@ async function paginate(config, documents) {
|
|
|
70351
70269
|
};
|
|
70352
70270
|
let cursorType = "String";
|
|
70353
70271
|
let paginationPath = [];
|
|
70354
|
-
doc.document =
|
|
70272
|
+
doc.document = graphql13.visit(doc.document, {
|
|
70355
70273
|
Field(node, _3, __, ___, ancestors) {
|
|
70356
70274
|
const paginateDirective = node.directives?.find(
|
|
70357
70275
|
(directive) => directive.name.value === config.paginateDirective
|
|
@@ -70377,7 +70295,7 @@ async function paginate(config, documents) {
|
|
|
70377
70295
|
flags.offset.enabled = offsetPagination;
|
|
70378
70296
|
flags.limit.enabled = offsetPagination;
|
|
70379
70297
|
paginationPath = ancestors.filter(
|
|
70380
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
70298
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql13.Kind.FIELD
|
|
70381
70299
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
70382
70300
|
return {
|
|
70383
70301
|
...node,
|
|
@@ -70396,7 +70314,7 @@ async function paginate(config, documents) {
|
|
|
70396
70314
|
let fragment2 = "";
|
|
70397
70315
|
let paginateMode = config.defaultPaginateMode;
|
|
70398
70316
|
const requiredArgs = [];
|
|
70399
|
-
doc.document =
|
|
70317
|
+
doc.document = graphql13.visit(doc.document, {
|
|
70400
70318
|
OperationDefinition(node) {
|
|
70401
70319
|
if (node.operation !== "query") {
|
|
70402
70320
|
throw new HoudiniError({
|
|
@@ -70455,9 +70373,9 @@ async function paginate(config, documents) {
|
|
|
70455
70373
|
directives: [
|
|
70456
70374
|
...node.directives || [],
|
|
70457
70375
|
{
|
|
70458
|
-
kind:
|
|
70376
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
70459
70377
|
name: {
|
|
70460
|
-
kind:
|
|
70378
|
+
kind: graphql13.Kind.NAME,
|
|
70461
70379
|
value: config.argumentsDirective
|
|
70462
70380
|
}
|
|
70463
70381
|
}
|
|
@@ -70527,22 +70445,22 @@ async function paginate(config, documents) {
|
|
|
70527
70445
|
const paginationArgs = Object.entries(flags).filter(([_3, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
70528
70446
|
const fragmentSpreadSelection = [
|
|
70529
70447
|
{
|
|
70530
|
-
kind:
|
|
70448
|
+
kind: graphql13.Kind.FRAGMENT_SPREAD,
|
|
70531
70449
|
name: {
|
|
70532
|
-
kind:
|
|
70450
|
+
kind: graphql13.Kind.NAME,
|
|
70533
70451
|
value: fragmentName
|
|
70534
70452
|
},
|
|
70535
70453
|
directives: [
|
|
70536
70454
|
{
|
|
70537
|
-
kind:
|
|
70455
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
70538
70456
|
name: {
|
|
70539
|
-
kind:
|
|
70457
|
+
kind: graphql13.Kind.NAME,
|
|
70540
70458
|
value: config.withDirective
|
|
70541
70459
|
},
|
|
70542
70460
|
["arguments"]: requiredArgs.map((arg) => variableAsArgument(arg.name)).concat(paginationArgs.map(({ name }) => variableAsArgument(name)))
|
|
70543
70461
|
},
|
|
70544
70462
|
{
|
|
70545
|
-
kind:
|
|
70463
|
+
kind: graphql13.Kind.DIRECTIVE,
|
|
70546
70464
|
name: {
|
|
70547
70465
|
kind: "Name",
|
|
70548
70466
|
value: config.maskDisableDirective
|
|
@@ -70569,23 +70487,23 @@ async function paginate(config, documents) {
|
|
|
70569
70487
|
});
|
|
70570
70488
|
const typeConfig = config.typeConfig?.[fragment2];
|
|
70571
70489
|
const queryDoc = {
|
|
70572
|
-
kind:
|
|
70490
|
+
kind: graphql13.Kind.DOCUMENT,
|
|
70573
70491
|
definitions: [
|
|
70574
70492
|
{
|
|
70575
|
-
kind:
|
|
70493
|
+
kind: graphql13.Kind.OPERATION_DEFINITION,
|
|
70576
70494
|
name: {
|
|
70577
|
-
kind:
|
|
70495
|
+
kind: graphql13.Kind.NAME,
|
|
70578
70496
|
value: refetchQueryName
|
|
70579
70497
|
},
|
|
70580
70498
|
operation: "query",
|
|
70581
70499
|
variableDefinitions: requiredArgs.map(
|
|
70582
70500
|
(arg) => ({
|
|
70583
|
-
kind:
|
|
70501
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
70584
70502
|
type: arg.type,
|
|
70585
70503
|
variable: {
|
|
70586
|
-
kind:
|
|
70504
|
+
kind: graphql13.Kind.VARIABLE,
|
|
70587
70505
|
name: {
|
|
70588
|
-
kind:
|
|
70506
|
+
kind: graphql13.Kind.NAME,
|
|
70589
70507
|
value: arg.name
|
|
70590
70508
|
}
|
|
70591
70509
|
}
|
|
@@ -70593,18 +70511,18 @@ async function paginate(config, documents) {
|
|
|
70593
70511
|
).concat(
|
|
70594
70512
|
paginationArgs.map(
|
|
70595
70513
|
(arg) => ({
|
|
70596
|
-
kind:
|
|
70514
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
70597
70515
|
type: {
|
|
70598
|
-
kind:
|
|
70516
|
+
kind: graphql13.Kind.NAMED_TYPE,
|
|
70599
70517
|
name: {
|
|
70600
|
-
kind:
|
|
70518
|
+
kind: graphql13.Kind.NAME,
|
|
70601
70519
|
value: arg.type
|
|
70602
70520
|
}
|
|
70603
70521
|
},
|
|
70604
70522
|
variable: {
|
|
70605
|
-
kind:
|
|
70523
|
+
kind: graphql13.Kind.VARIABLE,
|
|
70606
70524
|
name: {
|
|
70607
|
-
kind:
|
|
70525
|
+
kind: graphql13.Kind.NAME,
|
|
70608
70526
|
value: arg.name
|
|
70609
70527
|
}
|
|
70610
70528
|
},
|
|
@@ -70616,12 +70534,12 @@ async function paginate(config, documents) {
|
|
|
70616
70534
|
).concat(
|
|
70617
70535
|
!nodeQuery ? [] : keys2.map(
|
|
70618
70536
|
(key) => ({
|
|
70619
|
-
kind:
|
|
70537
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
70620
70538
|
type: key.type,
|
|
70621
70539
|
variable: {
|
|
70622
|
-
kind:
|
|
70540
|
+
kind: graphql13.Kind.VARIABLE,
|
|
70623
70541
|
name: {
|
|
70624
|
-
kind:
|
|
70542
|
+
kind: graphql13.Kind.NAME,
|
|
70625
70543
|
value: key.name
|
|
70626
70544
|
}
|
|
70627
70545
|
}
|
|
@@ -70630,42 +70548,42 @@ async function paginate(config, documents) {
|
|
|
70630
70548
|
)
|
|
70631
70549
|
),
|
|
70632
70550
|
selectionSet: {
|
|
70633
|
-
kind:
|
|
70551
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
70634
70552
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
70635
70553
|
{
|
|
70636
|
-
kind:
|
|
70554
|
+
kind: graphql13.Kind.FIELD,
|
|
70637
70555
|
name: {
|
|
70638
|
-
kind:
|
|
70556
|
+
kind: graphql13.Kind.NAME,
|
|
70639
70557
|
value: typeConfig?.resolve?.queryField || "node"
|
|
70640
70558
|
},
|
|
70641
70559
|
["arguments"]: keys2.map((key) => ({
|
|
70642
|
-
kind:
|
|
70560
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
70643
70561
|
name: {
|
|
70644
|
-
kind:
|
|
70562
|
+
kind: graphql13.Kind.NAME,
|
|
70645
70563
|
value: key.name
|
|
70646
70564
|
},
|
|
70647
70565
|
value: {
|
|
70648
|
-
kind:
|
|
70566
|
+
kind: graphql13.Kind.VARIABLE,
|
|
70649
70567
|
name: {
|
|
70650
|
-
kind:
|
|
70568
|
+
kind: graphql13.Kind.NAME,
|
|
70651
70569
|
value: key.name
|
|
70652
70570
|
}
|
|
70653
70571
|
}
|
|
70654
70572
|
})),
|
|
70655
70573
|
selectionSet: {
|
|
70656
|
-
kind:
|
|
70574
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
70657
70575
|
selections: [
|
|
70658
70576
|
{
|
|
70659
|
-
kind:
|
|
70577
|
+
kind: graphql13.Kind.FIELD,
|
|
70660
70578
|
name: {
|
|
70661
|
-
kind:
|
|
70579
|
+
kind: graphql13.Kind.NAME,
|
|
70662
70580
|
value: "__typename"
|
|
70663
70581
|
}
|
|
70664
70582
|
},
|
|
70665
70583
|
...(typeConfig?.keys || [config.defaultKeys[0]]).map((key) => ({
|
|
70666
|
-
kind:
|
|
70584
|
+
kind: graphql13.Kind.FIELD,
|
|
70667
70585
|
name: {
|
|
70668
|
-
kind:
|
|
70586
|
+
kind: graphql13.Kind.NAME,
|
|
70669
70587
|
value: key
|
|
70670
70588
|
}
|
|
70671
70589
|
})),
|
|
@@ -70722,15 +70640,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
70722
70640
|
}
|
|
70723
70641
|
function variableAsArgument(name, variable) {
|
|
70724
70642
|
return {
|
|
70725
|
-
kind:
|
|
70643
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
70726
70644
|
name: {
|
|
70727
|
-
kind:
|
|
70645
|
+
kind: graphql13.Kind.NAME,
|
|
70728
70646
|
value: name
|
|
70729
70647
|
},
|
|
70730
70648
|
value: {
|
|
70731
|
-
kind:
|
|
70649
|
+
kind: graphql13.Kind.VARIABLE,
|
|
70732
70650
|
name: {
|
|
70733
|
-
kind:
|
|
70651
|
+
kind: graphql13.Kind.NAME,
|
|
70734
70652
|
value: variable ?? name
|
|
70735
70653
|
}
|
|
70736
70654
|
}
|
|
@@ -70738,18 +70656,18 @@ function variableAsArgument(name, variable) {
|
|
|
70738
70656
|
}
|
|
70739
70657
|
function staticVariableDefinition(name, type, defaultValue, variableName) {
|
|
70740
70658
|
return {
|
|
70741
|
-
kind:
|
|
70659
|
+
kind: graphql13.Kind.VARIABLE_DEFINITION,
|
|
70742
70660
|
type: {
|
|
70743
|
-
kind:
|
|
70661
|
+
kind: graphql13.Kind.NAMED_TYPE,
|
|
70744
70662
|
name: {
|
|
70745
|
-
kind:
|
|
70663
|
+
kind: graphql13.Kind.NAME,
|
|
70746
70664
|
value: type
|
|
70747
70665
|
}
|
|
70748
70666
|
},
|
|
70749
70667
|
variable: {
|
|
70750
|
-
kind:
|
|
70668
|
+
kind: graphql13.Kind.VARIABLE,
|
|
70751
70669
|
name: {
|
|
70752
|
-
kind:
|
|
70670
|
+
kind: graphql13.Kind.NAME,
|
|
70753
70671
|
value: variableName ?? name
|
|
70754
70672
|
}
|
|
70755
70673
|
},
|
|
@@ -70761,9 +70679,9 @@ function staticVariableDefinition(name, type, defaultValue, variableName) {
|
|
|
70761
70679
|
}
|
|
70762
70680
|
function argumentNode(name, value) {
|
|
70763
70681
|
return {
|
|
70764
|
-
kind:
|
|
70682
|
+
kind: graphql13.Kind.ARGUMENT,
|
|
70765
70683
|
name: {
|
|
70766
|
-
kind:
|
|
70684
|
+
kind: graphql13.Kind.NAME,
|
|
70767
70685
|
value: name
|
|
70768
70686
|
},
|
|
70769
70687
|
value: objectNode(value)
|
|
@@ -70771,16 +70689,16 @@ function argumentNode(name, value) {
|
|
|
70771
70689
|
}
|
|
70772
70690
|
function objectNode([type, defaultValue]) {
|
|
70773
70691
|
const node = {
|
|
70774
|
-
kind:
|
|
70692
|
+
kind: graphql13.Kind.OBJECT,
|
|
70775
70693
|
fields: [
|
|
70776
70694
|
{
|
|
70777
|
-
kind:
|
|
70695
|
+
kind: graphql13.Kind.OBJECT_FIELD,
|
|
70778
70696
|
name: {
|
|
70779
|
-
kind:
|
|
70697
|
+
kind: graphql13.Kind.NAME,
|
|
70780
70698
|
value: "type"
|
|
70781
70699
|
},
|
|
70782
70700
|
value: {
|
|
70783
|
-
kind:
|
|
70701
|
+
kind: graphql13.Kind.STRING,
|
|
70784
70702
|
value: type
|
|
70785
70703
|
}
|
|
70786
70704
|
}
|
|
@@ -70788,8 +70706,8 @@ function objectNode([type, defaultValue]) {
|
|
|
70788
70706
|
};
|
|
70789
70707
|
if (defaultValue) {
|
|
70790
70708
|
node.fields.push({
|
|
70791
|
-
kind:
|
|
70792
|
-
name: { kind:
|
|
70709
|
+
kind: graphql13.Kind.OBJECT_FIELD,
|
|
70710
|
+
name: { kind: graphql13.Kind.NAME, value: "default" },
|
|
70793
70711
|
value: {
|
|
70794
70712
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
70795
70713
|
value: defaultValue.toString()
|
|
@@ -70800,34 +70718,34 @@ function objectNode([type, defaultValue]) {
|
|
|
70800
70718
|
}
|
|
70801
70719
|
var pageInfoSelection = [
|
|
70802
70720
|
{
|
|
70803
|
-
kind:
|
|
70721
|
+
kind: graphql13.Kind.FIELD,
|
|
70804
70722
|
name: {
|
|
70805
|
-
kind:
|
|
70723
|
+
kind: graphql13.Kind.NAME,
|
|
70806
70724
|
value: "edges"
|
|
70807
70725
|
},
|
|
70808
70726
|
selectionSet: {
|
|
70809
|
-
kind:
|
|
70727
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
70810
70728
|
selections: [
|
|
70811
70729
|
{
|
|
70812
|
-
kind:
|
|
70730
|
+
kind: graphql13.Kind.FIELD,
|
|
70813
70731
|
name: {
|
|
70814
|
-
kind:
|
|
70732
|
+
kind: graphql13.Kind.NAME,
|
|
70815
70733
|
value: "cursor"
|
|
70816
70734
|
}
|
|
70817
70735
|
},
|
|
70818
70736
|
{
|
|
70819
|
-
kind:
|
|
70737
|
+
kind: graphql13.Kind.FIELD,
|
|
70820
70738
|
name: {
|
|
70821
|
-
kind:
|
|
70739
|
+
kind: graphql13.Kind.NAME,
|
|
70822
70740
|
value: "node"
|
|
70823
70741
|
},
|
|
70824
70742
|
selectionSet: {
|
|
70825
|
-
kind:
|
|
70743
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
70826
70744
|
selections: [
|
|
70827
70745
|
{
|
|
70828
|
-
kind:
|
|
70746
|
+
kind: graphql13.Kind.FIELD,
|
|
70829
70747
|
name: {
|
|
70830
|
-
kind:
|
|
70748
|
+
kind: graphql13.Kind.NAME,
|
|
70831
70749
|
value: "__typename"
|
|
70832
70750
|
}
|
|
70833
70751
|
}
|
|
@@ -70838,39 +70756,39 @@ var pageInfoSelection = [
|
|
|
70838
70756
|
}
|
|
70839
70757
|
},
|
|
70840
70758
|
{
|
|
70841
|
-
kind:
|
|
70759
|
+
kind: graphql13.Kind.FIELD,
|
|
70842
70760
|
name: {
|
|
70843
|
-
kind:
|
|
70761
|
+
kind: graphql13.Kind.NAME,
|
|
70844
70762
|
value: "pageInfo"
|
|
70845
70763
|
},
|
|
70846
70764
|
selectionSet: {
|
|
70847
|
-
kind:
|
|
70765
|
+
kind: graphql13.Kind.SELECTION_SET,
|
|
70848
70766
|
selections: [
|
|
70849
70767
|
{
|
|
70850
|
-
kind:
|
|
70768
|
+
kind: graphql13.Kind.FIELD,
|
|
70851
70769
|
name: {
|
|
70852
|
-
kind:
|
|
70770
|
+
kind: graphql13.Kind.NAME,
|
|
70853
70771
|
value: "hasPreviousPage"
|
|
70854
70772
|
}
|
|
70855
70773
|
},
|
|
70856
70774
|
{
|
|
70857
|
-
kind:
|
|
70775
|
+
kind: graphql13.Kind.FIELD,
|
|
70858
70776
|
name: {
|
|
70859
|
-
kind:
|
|
70777
|
+
kind: graphql13.Kind.NAME,
|
|
70860
70778
|
value: "hasNextPage"
|
|
70861
70779
|
}
|
|
70862
70780
|
},
|
|
70863
70781
|
{
|
|
70864
|
-
kind:
|
|
70782
|
+
kind: graphql13.Kind.FIELD,
|
|
70865
70783
|
name: {
|
|
70866
|
-
kind:
|
|
70784
|
+
kind: graphql13.Kind.NAME,
|
|
70867
70785
|
value: "startCursor"
|
|
70868
70786
|
}
|
|
70869
70787
|
},
|
|
70870
70788
|
{
|
|
70871
|
-
kind:
|
|
70789
|
+
kind: graphql13.Kind.FIELD,
|
|
70872
70790
|
name: {
|
|
70873
|
-
kind:
|
|
70791
|
+
kind: graphql13.Kind.NAME,
|
|
70874
70792
|
value: "endCursor"
|
|
70875
70793
|
}
|
|
70876
70794
|
}
|
|
@@ -70884,17 +70802,17 @@ async function addListFragments(config, documents) {
|
|
|
70884
70802
|
const lists = {};
|
|
70885
70803
|
const errors = [];
|
|
70886
70804
|
for (const doc of documents) {
|
|
70887
|
-
doc.document =
|
|
70805
|
+
doc.document = graphql14.visit(doc.document, {
|
|
70888
70806
|
Directive(node, key, parent2, path3, ancestors) {
|
|
70889
70807
|
if ([config.listDirective, config.paginateDirective].includes(node.name.value)) {
|
|
70890
70808
|
const nameArg = node.arguments?.find(
|
|
70891
70809
|
(arg) => arg.name.value === config.listOrPaginateNameArg
|
|
70892
70810
|
);
|
|
70893
70811
|
let error = {
|
|
70894
|
-
...new
|
|
70812
|
+
...new graphql14.GraphQLError(
|
|
70895
70813
|
"",
|
|
70896
70814
|
node,
|
|
70897
|
-
new
|
|
70815
|
+
new graphql14.Source(""),
|
|
70898
70816
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
70899
70817
|
path3
|
|
70900
70818
|
),
|
|
@@ -70946,7 +70864,7 @@ async function addListFragments(config, documents) {
|
|
|
70946
70864
|
{
|
|
70947
70865
|
kind: "Argument",
|
|
70948
70866
|
name: {
|
|
70949
|
-
kind:
|
|
70867
|
+
kind: graphql14.Kind.NAME,
|
|
70950
70868
|
value: "connection"
|
|
70951
70869
|
},
|
|
70952
70870
|
value: {
|
|
@@ -70996,7 +70914,7 @@ async function addListFragments(config, documents) {
|
|
|
70996
70914
|
const validDeletes = [
|
|
70997
70915
|
...new Set(
|
|
70998
70916
|
Object.values(lists).map(({ type }) => {
|
|
70999
|
-
if (!(type instanceof
|
|
70917
|
+
if (!(type instanceof graphql14.GraphQLObjectType)) {
|
|
71000
70918
|
return "";
|
|
71001
70919
|
}
|
|
71002
70920
|
if (config.keyFieldsForType(type.name).length !== 1) {
|
|
@@ -71010,7 +70928,7 @@ async function addListFragments(config, documents) {
|
|
|
71010
70928
|
return;
|
|
71011
70929
|
}
|
|
71012
70930
|
const generatedDoc = {
|
|
71013
|
-
kind:
|
|
70931
|
+
kind: graphql14.Kind.DOCUMENT,
|
|
71014
70932
|
definitions: Object.entries(lists).flatMap(
|
|
71015
70933
|
([name, { selection, type }]) => {
|
|
71016
70934
|
const schemaType = config.schema.getType(type.name);
|
|
@@ -71018,7 +70936,7 @@ async function addListFragments(config, documents) {
|
|
|
71018
70936
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
71019
70937
|
}
|
|
71020
70938
|
const fragmentSelection = {
|
|
71021
|
-
kind:
|
|
70939
|
+
kind: graphql14.Kind.SELECTION_SET,
|
|
71022
70940
|
selections: [...selection.selections]
|
|
71023
70941
|
};
|
|
71024
70942
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
@@ -71033,14 +70951,14 @@ async function addListFragments(config, documents) {
|
|
|
71033
70951
|
{
|
|
71034
70952
|
name: {
|
|
71035
70953
|
value: config.listInsertFragment(name),
|
|
71036
|
-
kind:
|
|
70954
|
+
kind: graphql14.Kind.NAME
|
|
71037
70955
|
},
|
|
71038
|
-
kind:
|
|
70956
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
71039
70957
|
selectionSet: fragmentSelection,
|
|
71040
70958
|
typeCondition: {
|
|
71041
|
-
kind:
|
|
70959
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
71042
70960
|
name: {
|
|
71043
|
-
kind:
|
|
70961
|
+
kind: graphql14.Kind.NAME,
|
|
71044
70962
|
value: type.name
|
|
71045
70963
|
}
|
|
71046
70964
|
}
|
|
@@ -71048,32 +70966,32 @@ async function addListFragments(config, documents) {
|
|
|
71048
70966
|
{
|
|
71049
70967
|
name: {
|
|
71050
70968
|
value: config.listToggleFragment(name),
|
|
71051
|
-
kind:
|
|
70969
|
+
kind: graphql14.Kind.NAME
|
|
71052
70970
|
},
|
|
71053
|
-
kind:
|
|
70971
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
71054
70972
|
selectionSet: fragmentSelection,
|
|
71055
70973
|
typeCondition: {
|
|
71056
|
-
kind:
|
|
70974
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
71057
70975
|
name: {
|
|
71058
|
-
kind:
|
|
70976
|
+
kind: graphql14.Kind.NAME,
|
|
71059
70977
|
value: type.name
|
|
71060
70978
|
}
|
|
71061
70979
|
}
|
|
71062
70980
|
},
|
|
71063
70981
|
{
|
|
71064
|
-
kind:
|
|
70982
|
+
kind: graphql14.Kind.FRAGMENT_DEFINITION,
|
|
71065
70983
|
name: {
|
|
71066
70984
|
value: config.listRemoveFragment(name),
|
|
71067
|
-
kind:
|
|
70985
|
+
kind: graphql14.Kind.NAME
|
|
71068
70986
|
},
|
|
71069
70987
|
selectionSet: {
|
|
71070
|
-
kind:
|
|
70988
|
+
kind: graphql14.Kind.SELECTION_SET,
|
|
71071
70989
|
selections: [...objectIdentificationSelection(config, type)]
|
|
71072
70990
|
},
|
|
71073
70991
|
typeCondition: {
|
|
71074
|
-
kind:
|
|
70992
|
+
kind: graphql14.Kind.NAMED_TYPE,
|
|
71075
70993
|
name: {
|
|
71076
|
-
kind:
|
|
70994
|
+
kind: graphql14.Kind.NAME,
|
|
71077
70995
|
value: type.name
|
|
71078
70996
|
}
|
|
71079
70997
|
}
|
|
@@ -71082,14 +71000,14 @@ async function addListFragments(config, documents) {
|
|
|
71082
71000
|
}
|
|
71083
71001
|
).concat(
|
|
71084
71002
|
...validDeletes.map((typeName) => ({
|
|
71085
|
-
kind:
|
|
71003
|
+
kind: graphql14.Kind.DIRECTIVE_DEFINITION,
|
|
71086
71004
|
name: {
|
|
71087
|
-
kind:
|
|
71005
|
+
kind: graphql14.Kind.NAME,
|
|
71088
71006
|
value: config.listDeleteDirective(typeName)
|
|
71089
71007
|
},
|
|
71090
71008
|
locations: [
|
|
71091
71009
|
{
|
|
71092
|
-
kind:
|
|
71010
|
+
kind: graphql14.Kind.NAME,
|
|
71093
71011
|
value: "FIELD"
|
|
71094
71012
|
}
|
|
71095
71013
|
],
|
|
@@ -71097,8 +71015,8 @@ async function addListFragments(config, documents) {
|
|
|
71097
71015
|
}))
|
|
71098
71016
|
)
|
|
71099
71017
|
};
|
|
71100
|
-
config.newSchema += "\n" + generatedDoc.definitions.filter((c2) => c2.kind !== "FragmentDefinition").map(
|
|
71101
|
-
config.newDocuments += "\n" + generatedDoc.definitions.filter((c2) => c2.kind === "FragmentDefinition").map(
|
|
71018
|
+
config.newSchema += "\n" + generatedDoc.definitions.filter((c2) => c2.kind !== "FragmentDefinition").map(graphql14.print).join("\n\n");
|
|
71019
|
+
config.newDocuments += "\n" + generatedDoc.definitions.filter((c2) => c2.kind === "FragmentDefinition").map(graphql14.print).join("\n\n");
|
|
71102
71020
|
documents.push({
|
|
71103
71021
|
name: "generated::lists",
|
|
71104
71022
|
kind: ArtifactKind.Fragment,
|
|
@@ -71184,11 +71102,11 @@ var nodeNotDefinedMessage = (config) => `Looks like you are trying to use the ${
|
|
|
71184
71102
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
71185
71103
|
|
|
71186
71104
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
71187
|
-
import * as
|
|
71105
|
+
import * as graphql15 from "graphql";
|
|
71188
71106
|
function fieldKey(config, field) {
|
|
71189
71107
|
const attributeName = field.alias?.value || field.name.value;
|
|
71190
|
-
const printed =
|
|
71191
|
-
const secondParse =
|
|
71108
|
+
const printed = graphql15.print(field);
|
|
71109
|
+
const secondParse = graphql15.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
71192
71110
|
let paginateMode = config.defaultPaginateMode;
|
|
71193
71111
|
const paginatedDirective = field.directives?.find(
|
|
71194
71112
|
(directive) => directive.name.value === config.paginateDirective
|
|
@@ -71311,13 +71229,13 @@ function prepareSelection({
|
|
|
71311
71229
|
} else if ("getFields" in type) {
|
|
71312
71230
|
let typeRef = type.getFields()[field.name.value].type;
|
|
71313
71231
|
fieldType = getRootType(typeRef);
|
|
71314
|
-
nullable = !
|
|
71315
|
-
} else if (
|
|
71232
|
+
nullable = !graphql16.isNonNullType(typeRef);
|
|
71233
|
+
} else if (graphql16.isAbstractType(type)) {
|
|
71316
71234
|
for (const possible of config.schema.getPossibleTypes(type)) {
|
|
71317
|
-
if (
|
|
71235
|
+
if (graphql16.isObjectType(possible)) {
|
|
71318
71236
|
if (possible.getFields()[field.name.value]) {
|
|
71319
71237
|
fieldType = possible.getFields()[field.name.value].type;
|
|
71320
|
-
nullable = !
|
|
71238
|
+
nullable = !graphql16.isNonNullType(fieldType);
|
|
71321
71239
|
break;
|
|
71322
71240
|
}
|
|
71323
71241
|
}
|
|
@@ -71454,7 +71372,7 @@ function prepareSelection({
|
|
|
71454
71372
|
kind: "value"
|
|
71455
71373
|
} : { kind: "continue" };
|
|
71456
71374
|
const parentType = config.schema.getType(rootType);
|
|
71457
|
-
if (
|
|
71375
|
+
if (graphql16.isObjectType(parentType) || graphql16.isInterfaceType(parentType)) {
|
|
71458
71376
|
const fieldType2 = parentType.getFields()[field.name.value]?.type;
|
|
71459
71377
|
if (fieldType2) {
|
|
71460
71378
|
const listCount = unwrapType(config, fieldType2).wrappers.filter(
|
|
@@ -71477,7 +71395,7 @@ function prepareSelection({
|
|
|
71477
71395
|
}
|
|
71478
71396
|
fieldObj.loading = loadingValue;
|
|
71479
71397
|
}
|
|
71480
|
-
if (
|
|
71398
|
+
if (graphql16.isInterfaceType(fieldType) || graphql16.isUnionType(fieldType)) {
|
|
71481
71399
|
fieldObj.abstract = true;
|
|
71482
71400
|
if (Object.values(fieldObj.selection?.abstractFields?.fields ?? {}).some(
|
|
71483
71401
|
(fields) => Object.values(fields ?? {}).some((field2) => field2.required)
|
|
@@ -71559,7 +71477,7 @@ function mergeSelection({
|
|
|
71559
71477
|
typeSelection,
|
|
71560
71478
|
abstractSelection.fields[typeName] ?? {}
|
|
71561
71479
|
);
|
|
71562
|
-
if (
|
|
71480
|
+
if (graphql16.isAbstractType(gqlType)) {
|
|
71563
71481
|
for (const possible of config.schema.getPossibleTypes(gqlType)) {
|
|
71564
71482
|
if (!possibleSelectionTypes[typeName]) {
|
|
71565
71483
|
possibleSelectionTypes[typeName] = [];
|
|
@@ -71594,7 +71512,7 @@ function mergeSelection({
|
|
|
71594
71512
|
}
|
|
71595
71513
|
}
|
|
71596
71514
|
const parentType = config.schema.getType(rootType);
|
|
71597
|
-
const possibleParents =
|
|
71515
|
+
const possibleParents = graphql16.isAbstractType(parentType) ? config.schema.getPossibleTypes(parentType)?.map((t3) => t3.name) : [parentType.name];
|
|
71598
71516
|
for (const key of Object.keys(abstractSelection.typeMap)) {
|
|
71599
71517
|
if (!possibleParents.includes(key) && rootType !== key || abstractSelection.fields[key]) {
|
|
71600
71518
|
delete abstractSelection.typeMap[key];
|
|
@@ -71651,12 +71569,12 @@ function mergeSelection({
|
|
|
71651
71569
|
}
|
|
71652
71570
|
|
|
71653
71571
|
// src/codegen/generators/artifacts/index.ts
|
|
71654
|
-
var
|
|
71572
|
+
var AST5 = recast5.types.builders;
|
|
71655
71573
|
function artifactGenerator(stats) {
|
|
71656
71574
|
return async function(config, docs) {
|
|
71657
71575
|
const filterTypes = {};
|
|
71658
71576
|
for (const doc of docs) {
|
|
71659
|
-
|
|
71577
|
+
graphql17.visit(doc.document, {
|
|
71660
71578
|
Directive(node, _3, __, ___, ancestors) {
|
|
71661
71579
|
if (node.name.value !== config.listDirective) {
|
|
71662
71580
|
return;
|
|
@@ -71716,7 +71634,7 @@ function artifactGenerator(stats) {
|
|
|
71716
71634
|
return;
|
|
71717
71635
|
}
|
|
71718
71636
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
71719
|
-
let documentWithoutInternalDirectives =
|
|
71637
|
+
let documentWithoutInternalDirectives = graphql17.visit(document, {
|
|
71720
71638
|
Directive(node) {
|
|
71721
71639
|
if (config.isInternalDirective(node.name.value)) {
|
|
71722
71640
|
return null;
|
|
@@ -71729,7 +71647,7 @@ function artifactGenerator(stats) {
|
|
|
71729
71647
|
}
|
|
71730
71648
|
}
|
|
71731
71649
|
});
|
|
71732
|
-
let documentWithoutExtraVariables =
|
|
71650
|
+
let documentWithoutExtraVariables = graphql17.visit(
|
|
71733
71651
|
documentWithoutInternalDirectives,
|
|
71734
71652
|
{
|
|
71735
71653
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -71740,13 +71658,13 @@ function artifactGenerator(stats) {
|
|
|
71740
71658
|
}
|
|
71741
71659
|
}
|
|
71742
71660
|
);
|
|
71743
|
-
let rawString =
|
|
71661
|
+
let rawString = graphql17.print(documentWithoutExtraVariables);
|
|
71744
71662
|
let docKind = doc.kind;
|
|
71745
71663
|
const operations = document.definitions.filter(
|
|
71746
|
-
({ kind }) => kind ===
|
|
71664
|
+
({ kind }) => kind === graphql17.Kind.OPERATION_DEFINITION
|
|
71747
71665
|
);
|
|
71748
71666
|
const fragments = document.definitions.filter(
|
|
71749
|
-
({ kind }) => kind ===
|
|
71667
|
+
({ kind }) => kind === graphql17.Kind.FRAGMENT_DEFINITION
|
|
71750
71668
|
);
|
|
71751
71669
|
let rootType = "";
|
|
71752
71670
|
let selectionSet;
|
|
@@ -71946,9 +71864,9 @@ function artifactGenerator(stats) {
|
|
|
71946
71864
|
plugin2.artifactEnd({ config, document: doc });
|
|
71947
71865
|
}
|
|
71948
71866
|
const _houdiniHash = hashOriginal({ document: doc });
|
|
71949
|
-
const file =
|
|
71867
|
+
const file = AST5.program([
|
|
71950
71868
|
moduleExport(config, "default", serializeValue(artifact)),
|
|
71951
|
-
|
|
71869
|
+
AST5.expressionStatement(AST5.stringLiteral(`HoudiniHash=${_houdiniHash}`))
|
|
71952
71870
|
]);
|
|
71953
71871
|
const artifactPath = config.artifactPath(document);
|
|
71954
71872
|
const countDocument = doc.generateStore;
|
|
@@ -72006,7 +71924,7 @@ function applyMask(config, target, mask) {
|
|
|
72006
71924
|
if (!targetType) {
|
|
72007
71925
|
continue;
|
|
72008
71926
|
}
|
|
72009
|
-
if (
|
|
71927
|
+
if (graphql17.isAbstractType(targetType)) {
|
|
72010
71928
|
for (const possible of config.schema.getPossibleTypes(targetType)) {
|
|
72011
71929
|
if (target.abstractFields?.fields[possible.name]) {
|
|
72012
71930
|
applyMask(
|
|
@@ -72029,8 +71947,8 @@ function applyMask(config, target, mask) {
|
|
|
72029
71947
|
}
|
|
72030
71948
|
|
|
72031
71949
|
// src/codegen/generators/runtime/graphqlFunction.ts
|
|
72032
|
-
var
|
|
72033
|
-
var
|
|
71950
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
71951
|
+
var AST6 = recast6.types.builders;
|
|
72034
71952
|
async function generateGraphqlReturnTypes(config, docs) {
|
|
72035
71953
|
const indexPath = path_exports.join(config.runtimeDirectory, "index.d.ts");
|
|
72036
71954
|
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
@@ -72065,18 +71983,18 @@ async function generateGraphqlReturnTypes(config, docs) {
|
|
|
72065
71983
|
continue;
|
|
72066
71984
|
}
|
|
72067
71985
|
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
72068
|
-
const input =
|
|
72069
|
-
input.typeAnnotation =
|
|
72070
|
-
|
|
71986
|
+
const input = AST6.identifier("str");
|
|
71987
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
71988
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
72071
71989
|
);
|
|
72072
71990
|
script.body.splice(
|
|
72073
71991
|
i2,
|
|
72074
71992
|
0,
|
|
72075
|
-
|
|
72076
|
-
|
|
72077
|
-
|
|
71993
|
+
AST6.exportNamedDeclaration(
|
|
71994
|
+
AST6.tsDeclareFunction(
|
|
71995
|
+
AST6.identifier("graphql"),
|
|
72078
71996
|
[input],
|
|
72079
|
-
|
|
71997
|
+
AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
|
|
72080
71998
|
)
|
|
72081
71999
|
)
|
|
72082
72000
|
);
|
|
@@ -72251,165 +72169,22 @@ function moduleStatments(config) {
|
|
|
72251
72169
|
var recast11 = __toESM(require_main2(), 1);
|
|
72252
72170
|
|
|
72253
72171
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
72254
|
-
var recast8 = __toESM(require_main2(), 1);
|
|
72255
|
-
import * as graphql19 from "graphql";
|
|
72256
|
-
|
|
72257
|
-
// src/codegen/generators/typescript/typeReference.ts
|
|
72258
72172
|
var recast7 = __toESM(require_main2(), 1);
|
|
72259
72173
|
import * as graphql18 from "graphql";
|
|
72260
|
-
|
|
72261
|
-
// src/codegen/generators/typescript/types.ts
|
|
72262
|
-
var recast6 = __toESM(require_main2(), 1);
|
|
72263
|
-
import * as graphql17 from "graphql";
|
|
72264
|
-
var AST6 = recast6.types.builders;
|
|
72265
|
-
function readonlyProperty(prop, enable = true) {
|
|
72266
|
-
if (enable) {
|
|
72267
|
-
prop.readonly = true;
|
|
72268
|
-
}
|
|
72269
|
-
return prop;
|
|
72270
|
-
}
|
|
72271
|
-
function nullableField(inner, input = false) {
|
|
72272
|
-
const members = [inner, AST6.tsNullKeyword()];
|
|
72273
|
-
if (input) {
|
|
72274
|
-
members.push(AST6.tsUndefinedKeyword());
|
|
72275
|
-
}
|
|
72276
|
-
return AST6.tsUnionType(members);
|
|
72277
|
-
}
|
|
72278
|
-
function scalarPropertyValue(config, filepath, missingScalars, target, body, field) {
|
|
72279
|
-
if (config.configFile.features?.componentFields && target.name === config.componentScalar) {
|
|
72280
|
-
if (!field) {
|
|
72281
|
-
return AST6.tsNeverKeyword();
|
|
72282
|
-
}
|
|
72283
|
-
const component = config.componentFields[field.parent][field.field];
|
|
72284
|
-
const sourcePathRelative = path_exports.relative(
|
|
72285
|
-
path_exports.join(config.projectRoot, "src"),
|
|
72286
|
-
component.filepath
|
|
72287
|
-
);
|
|
72288
|
-
let sourcePathParsed = path_exports.parse(sourcePathRelative);
|
|
72289
|
-
let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
|
|
72290
|
-
const localImport = ensureImports({
|
|
72291
|
-
config,
|
|
72292
|
-
body,
|
|
72293
|
-
import: "__component__" + component.fragment,
|
|
72294
|
-
sourceModule: path_exports.join(
|
|
72295
|
-
path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
|
|
72296
|
-
"src",
|
|
72297
|
-
sourcePath
|
|
72298
|
-
)
|
|
72299
|
-
});
|
|
72300
|
-
const parameters = AST6.tsTypeReference(AST6.identifier("Parameters"));
|
|
72301
|
-
parameters.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
72302
|
-
AST6.tsTypeQuery(AST6.identifier(localImport))
|
|
72303
|
-
]);
|
|
72304
|
-
const indexed = AST6.tsIndexedAccessType(
|
|
72305
|
-
parameters,
|
|
72306
|
-
AST6.tsLiteralType(AST6.numericLiteral(0))
|
|
72307
|
-
);
|
|
72308
|
-
const omit = AST6.tsTypeReference(AST6.identifier("Omit"));
|
|
72309
|
-
omit.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
72310
|
-
indexed,
|
|
72311
|
-
AST6.tsLiteralType(AST6.stringLiteral(component.prop))
|
|
72312
|
-
]);
|
|
72313
|
-
const arg = AST6.identifier("props");
|
|
72314
|
-
arg.typeAnnotation = AST6.tsTypeAnnotation(omit);
|
|
72315
|
-
const returnType = AST6.tsTypeReference(AST6.identifier("ReturnType"));
|
|
72316
|
-
returnType.typeParameters = AST6.tsTypeParameterInstantiation([
|
|
72317
|
-
AST6.tsTypeQuery(AST6.identifier(localImport))
|
|
72318
|
-
]);
|
|
72319
|
-
const fnType = AST6.tsFunctionType([arg]);
|
|
72320
|
-
fnType.typeAnnotation = AST6.tsTypeAnnotation(returnType);
|
|
72321
|
-
return fnType;
|
|
72322
|
-
}
|
|
72323
|
-
switch (target.name) {
|
|
72324
|
-
case "String": {
|
|
72325
|
-
return AST6.tsStringKeyword();
|
|
72326
|
-
}
|
|
72327
|
-
case "Int": {
|
|
72328
|
-
return AST6.tsNumberKeyword();
|
|
72329
|
-
}
|
|
72330
|
-
case "Float": {
|
|
72331
|
-
return AST6.tsNumberKeyword();
|
|
72332
|
-
}
|
|
72333
|
-
case "Boolean": {
|
|
72334
|
-
return AST6.tsBooleanKeyword();
|
|
72335
|
-
}
|
|
72336
|
-
case "ID": {
|
|
72337
|
-
return AST6.tsStringKeyword();
|
|
72338
|
-
}
|
|
72339
|
-
default: {
|
|
72340
|
-
if (graphql17.isNonNullType(target) && "ofType" in target) {
|
|
72341
|
-
return scalarPropertyValue(
|
|
72342
|
-
config,
|
|
72343
|
-
filepath,
|
|
72344
|
-
missingScalars,
|
|
72345
|
-
target.ofType,
|
|
72346
|
-
body,
|
|
72347
|
-
field
|
|
72348
|
-
);
|
|
72349
|
-
}
|
|
72350
|
-
if (config.scalars?.[target.name]) {
|
|
72351
|
-
return AST6.tsTypeReference(AST6.identifier(config.scalars?.[target.name].type));
|
|
72352
|
-
}
|
|
72353
|
-
if (target.name !== config.componentScalar) {
|
|
72354
|
-
missingScalars.add(target.name);
|
|
72355
|
-
}
|
|
72356
|
-
return AST6.tsAnyKeyword();
|
|
72357
|
-
}
|
|
72358
|
-
}
|
|
72359
|
-
}
|
|
72360
|
-
|
|
72361
|
-
// src/codegen/generators/typescript/typeReference.ts
|
|
72362
72174
|
var AST7 = recast7.types.builders;
|
|
72363
|
-
function tsTypeReference(config, filepath, missingScalars, definition, body) {
|
|
72364
|
-
const { type, wrappers } = unwrapType(config, definition.type);
|
|
72365
|
-
let result;
|
|
72366
|
-
if (graphql18.isScalarType(type)) {
|
|
72367
|
-
result = scalarPropertyValue(config, filepath, missingScalars, type, body, null);
|
|
72368
|
-
} else if (graphql18.isEnumType(type)) {
|
|
72369
|
-
result = enumReference(config, body, type.name);
|
|
72370
|
-
} else {
|
|
72371
|
-
result = AST7.tsTypeReference(AST7.identifier(type.name));
|
|
72372
|
-
}
|
|
72373
|
-
for (const toWrap of wrappers) {
|
|
72374
|
-
if (toWrap === "NonNull" /* NonNull */) {
|
|
72375
|
-
continue;
|
|
72376
|
-
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
72377
|
-
result = nullableField(result, true);
|
|
72378
|
-
} else if (toWrap === "List" /* List */) {
|
|
72379
|
-
result = AST7.tsArrayType(AST7.tsParenthesizedType(result));
|
|
72380
|
-
}
|
|
72381
|
-
}
|
|
72382
|
-
return result;
|
|
72383
|
-
}
|
|
72384
|
-
function enumReference(config, body, name) {
|
|
72385
|
-
ensureImports({
|
|
72386
|
-
config,
|
|
72387
|
-
body,
|
|
72388
|
-
import: ["ValueOf"],
|
|
72389
|
-
importKind: "type",
|
|
72390
|
-
sourceModule: "$houdini/runtime/lib/types"
|
|
72391
|
-
});
|
|
72392
|
-
return AST7.tsTypeReference(
|
|
72393
|
-
AST7.identifier("ValueOf"),
|
|
72394
|
-
AST7.tsTypeParameterInstantiation([AST7.tsTypeQuery(AST7.identifier(name))])
|
|
72395
|
-
);
|
|
72396
|
-
}
|
|
72397
|
-
|
|
72398
|
-
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
72399
|
-
var AST8 = recast8.types.builders;
|
|
72400
72175
|
function addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
72401
72176
|
const { type } = unwrapType(config, rootType);
|
|
72402
|
-
if (
|
|
72177
|
+
if (graphql18.isScalarType(type)) {
|
|
72403
72178
|
return;
|
|
72404
72179
|
}
|
|
72405
72180
|
if (visitedTypes.has(type.name)) {
|
|
72406
72181
|
return;
|
|
72407
72182
|
}
|
|
72408
|
-
if (
|
|
72183
|
+
if (graphql18.isUnionType(type)) {
|
|
72409
72184
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
72410
72185
|
}
|
|
72411
72186
|
visitedTypes.add(type.name);
|
|
72412
|
-
if (
|
|
72187
|
+
if (graphql18.isEnumType(type)) {
|
|
72413
72188
|
ensureImports({
|
|
72414
72189
|
config,
|
|
72415
72190
|
body,
|
|
@@ -72423,21 +72198,37 @@ function addReferencedInputTypes(config, filepath, body, visitedTypes, missingSc
|
|
|
72423
72198
|
for (const field of Object.values(type.getFields())) {
|
|
72424
72199
|
addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, field.type);
|
|
72425
72200
|
members.push(
|
|
72426
|
-
|
|
72427
|
-
|
|
72428
|
-
|
|
72201
|
+
AST7.tsPropertySignature(
|
|
72202
|
+
AST7.identifier(field.name),
|
|
72203
|
+
AST7.tsTypeAnnotation(
|
|
72429
72204
|
tsTypeReference(config, filepath, missingScalars, field, body)
|
|
72430
72205
|
),
|
|
72431
|
-
|
|
72206
|
+
graphql18.isNullableType(field.type)
|
|
72432
72207
|
)
|
|
72433
72208
|
);
|
|
72434
72209
|
}
|
|
72435
|
-
body.push(
|
|
72210
|
+
body.push(AST7.tsTypeAliasDeclaration(AST7.identifier(type.name), AST7.tsTypeLiteral(members)));
|
|
72436
72211
|
}
|
|
72437
72212
|
|
|
72438
72213
|
// src/codegen/generators/typescript/inlineType.ts
|
|
72439
72214
|
var recast9 = __toESM(require_main2(), 1);
|
|
72440
|
-
import * as
|
|
72215
|
+
import * as graphql19 from "graphql";
|
|
72216
|
+
|
|
72217
|
+
// src/codegen/generators/comments/jsdoc.ts
|
|
72218
|
+
var recast8 = __toESM(require_main2(), 1);
|
|
72219
|
+
var AST8 = recast8.types.builders;
|
|
72220
|
+
function jsdocComment(text, deprecated) {
|
|
72221
|
+
let commentContent = `*
|
|
72222
|
+
* ${text}
|
|
72223
|
+
`;
|
|
72224
|
+
if (deprecated) {
|
|
72225
|
+
commentContent = `${commentContent} * @deprecated ${deprecated}
|
|
72226
|
+
`;
|
|
72227
|
+
}
|
|
72228
|
+
return AST8.commentBlock(commentContent, true);
|
|
72229
|
+
}
|
|
72230
|
+
|
|
72231
|
+
// src/codegen/generators/typescript/inlineType.ts
|
|
72441
72232
|
var AST9 = recast9.types.builders;
|
|
72442
72233
|
var fragmentKey2 = " $fragments";
|
|
72443
72234
|
function inlineType({
|
|
@@ -72458,7 +72249,7 @@ function inlineType({
|
|
|
72458
72249
|
const { type, wrappers } = unwrapType(config, rootType);
|
|
72459
72250
|
let result;
|
|
72460
72251
|
let forceNullable = false;
|
|
72461
|
-
if (
|
|
72252
|
+
if (graphql19.isScalarType(type)) {
|
|
72462
72253
|
result = scalarPropertyValue(
|
|
72463
72254
|
config,
|
|
72464
72255
|
filepath,
|
|
@@ -72467,7 +72258,7 @@ function inlineType({
|
|
|
72467
72258
|
body,
|
|
72468
72259
|
field
|
|
72469
72260
|
);
|
|
72470
|
-
} else if (
|
|
72261
|
+
} else if (graphql19.isEnumType(type)) {
|
|
72471
72262
|
ensureImports({
|
|
72472
72263
|
config,
|
|
72473
72264
|
body,
|
|
@@ -72492,11 +72283,11 @@ function inlineType({
|
|
|
72492
72283
|
for (const selection of selections) {
|
|
72493
72284
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
72494
72285
|
const fragmentType = config.schema.getType(selection.typeCondition.name.value);
|
|
72495
|
-
if (!
|
|
72286
|
+
if (!graphql19.isInterfaceType(type) && !graphql19.isUnionType(type)) {
|
|
72496
72287
|
selectedFields.push(...selection.selectionSet.selections);
|
|
72497
72288
|
continue;
|
|
72498
72289
|
}
|
|
72499
|
-
if (!
|
|
72290
|
+
if (!graphql19.isInterfaceType(fragmentType) && !graphql19.isUnionType(fragmentType)) {
|
|
72500
72291
|
if (!inlineFragments[fragmentType.name]) {
|
|
72501
72292
|
inlineFragments[fragmentType.name] = [];
|
|
72502
72293
|
}
|
|
@@ -72588,6 +72379,11 @@ function inlineType({
|
|
|
72588
72379
|
if (allOptional) {
|
|
72589
72380
|
prop.optional = true;
|
|
72590
72381
|
}
|
|
72382
|
+
if (field2.description || field2.deprecationReason) {
|
|
72383
|
+
prop.comments = [
|
|
72384
|
+
jsdocComment(field2.description ?? "", field2.deprecationReason ?? void 0)
|
|
72385
|
+
];
|
|
72386
|
+
}
|
|
72591
72387
|
return prop;
|
|
72592
72388
|
})
|
|
72593
72389
|
]);
|
|
@@ -72639,7 +72435,7 @@ function inlineType({
|
|
|
72639
72435
|
}
|
|
72640
72436
|
}
|
|
72641
72437
|
}
|
|
72642
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
72438
|
+
if (objectType.type === "TSTypeLiteral" && !graphql19.isInterfaceType(fragmentRootType) && !graphql19.isUnionType(fragmentRootType)) {
|
|
72643
72439
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
72644
72440
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
72645
72441
|
);
|
|
@@ -72664,11 +72460,11 @@ function inlineType({
|
|
|
72664
72460
|
];
|
|
72665
72461
|
}
|
|
72666
72462
|
let coveredTypenames;
|
|
72667
|
-
if (
|
|
72463
|
+
if (graphql19.isInterfaceType(fragmentRootType)) {
|
|
72668
72464
|
coveredTypenames = interfaceCoveredTypenames(fragmentRootType);
|
|
72669
|
-
} else if (
|
|
72465
|
+
} else if (graphql19.isUnionType(fragmentRootType)) {
|
|
72670
72466
|
coveredTypenames = fragmentRootType.getTypes().map((type2) => type2.name);
|
|
72671
|
-
} else if (
|
|
72467
|
+
} else if (graphql19.isObjectType(fragmentRootType)) {
|
|
72672
72468
|
coveredTypenames = [fragmentRootType.name];
|
|
72673
72469
|
} else {
|
|
72674
72470
|
throw Error("unreachable code");
|
|
@@ -72704,7 +72500,7 @@ function inlineType({
|
|
|
72704
72500
|
);
|
|
72705
72501
|
}
|
|
72706
72502
|
);
|
|
72707
|
-
const parentIsUnionOrInterface = !
|
|
72503
|
+
const parentIsUnionOrInterface = !graphql19.isInterfaceType(type) && !graphql19.isUnionType(type);
|
|
72708
72504
|
const possibleTypenames = parentIsUnionOrInterface ? [parent.name] : config.schema.getPossibleTypes(type).map((type2) => type2.name);
|
|
72709
72505
|
const coveredTypenames = new Set(
|
|
72710
72506
|
Object.values(inlineFragmentSelections).flatMap((sel) => sel.coveredTypenames)
|
|
@@ -72771,7 +72567,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
|
|
|
72771
72567
|
},
|
|
72772
72568
|
type: schema.getType("String")
|
|
72773
72569
|
};
|
|
72774
|
-
} else if (
|
|
72570
|
+
} else if (graphql19.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
72775
72571
|
fields = rootType.ofType.getFields();
|
|
72776
72572
|
} else {
|
|
72777
72573
|
fields = rootType.getFields();
|
|
@@ -72783,7 +72579,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
|
|
|
72783
72579
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
72784
72580
|
});
|
|
72785
72581
|
}
|
|
72786
|
-
const fieldType =
|
|
72582
|
+
const fieldType = graphql19.getNamedType(field.type);
|
|
72787
72583
|
if (!fieldType) {
|
|
72788
72584
|
throw new HoudiniError({
|
|
72789
72585
|
filepath,
|
|
@@ -73292,7 +73088,7 @@ async function generateFragmentTypeDefs(config, filepath, body, selections, defi
|
|
|
73292
73088
|
|
|
73293
73089
|
// src/codegen/generators/typescript/imperativeTypeDef.ts
|
|
73294
73090
|
var recast12 = __toESM(require_main2(), 1);
|
|
73295
|
-
import * as
|
|
73091
|
+
import * as graphql20 from "graphql";
|
|
73296
73092
|
var AST12 = recast12.types.builders;
|
|
73297
73093
|
async function imperativeCacheTypef(config, docs) {
|
|
73298
73094
|
const returnType = (doc) => config.plugins.find((plugin2) => plugin2.graphqlTagReturn)?.graphqlTagReturn?.({
|
|
@@ -73343,7 +73139,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
73343
73139
|
const operationTypes = [config.schema.getMutationType(), config.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
73344
73140
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
73345
73141
|
const types16 = Object.values(config.schema.getTypeMap()).filter(
|
|
73346
|
-
(type) => !
|
|
73142
|
+
(type) => !graphql20.isAbstractType(type) && !graphql20.isScalarType(type) && !graphql20.isEnumType(type) && !graphql20.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
73347
73143
|
);
|
|
73348
73144
|
const fragmentMap = fragmentListMap(
|
|
73349
73145
|
config,
|
|
@@ -73360,7 +73156,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
73360
73156
|
}
|
|
73361
73157
|
let idFields = AST12.tsNeverKeyword();
|
|
73362
73158
|
const keys2 = keyFieldsForType(config.configFile, type.name);
|
|
73363
|
-
if (
|
|
73159
|
+
if (graphql20.isObjectType(type) && keys2.length > 0 && keys2.every((key) => type.getFields()[key])) {
|
|
73364
73160
|
idFields = AST12.tsTypeLiteral(
|
|
73365
73161
|
keys2.map((key) => {
|
|
73366
73162
|
const fieldType = type.getFields()[key];
|
|
@@ -73387,13 +73183,13 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
73387
73183
|
idFields = AST12.tsTypeLiteral([]);
|
|
73388
73184
|
}
|
|
73389
73185
|
let fields = AST12.tsTypeLiteral([]);
|
|
73390
|
-
if (
|
|
73186
|
+
if (graphql20.isObjectType(type)) {
|
|
73391
73187
|
fields = AST12.tsTypeLiteral(
|
|
73392
73188
|
Object.entries(type.getFields()).map(
|
|
73393
73189
|
([key, fieldType]) => {
|
|
73394
73190
|
const unwrapped = unwrapType(config, fieldType.type);
|
|
73395
73191
|
let typeOptions = AST12.tsUnionType([]);
|
|
73396
|
-
if (
|
|
73192
|
+
if (graphql20.isScalarType(unwrapped.type)) {
|
|
73397
73193
|
typeOptions.types.push(
|
|
73398
73194
|
scalarPropertyValue(
|
|
73399
73195
|
config,
|
|
@@ -73407,11 +73203,11 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
|
|
|
73407
73203
|
}
|
|
73408
73204
|
)
|
|
73409
73205
|
);
|
|
73410
|
-
} else if (
|
|
73206
|
+
} else if (graphql20.isEnumType(unwrapped.type)) {
|
|
73411
73207
|
typeOptions.types.push(
|
|
73412
73208
|
AST12.tsTypeReference(AST12.identifier(unwrapped.type.name))
|
|
73413
73209
|
);
|
|
73414
|
-
} else if (!
|
|
73210
|
+
} else if (!graphql20.isAbstractType(unwrapped.type)) {
|
|
73415
73211
|
typeOptions.types.push(record(unwrapped.type.name));
|
|
73416
73212
|
} else {
|
|
73417
73213
|
typeOptions.types.push(
|
|
@@ -73507,7 +73303,7 @@ function listDefinitions(config, filepath, body, docs) {
|
|
|
73507
73303
|
const lists = [];
|
|
73508
73304
|
const visitedLists = /* @__PURE__ */ new Set();
|
|
73509
73305
|
for (const doc of docs) {
|
|
73510
|
-
|
|
73306
|
+
graphql20.visit(doc.document, {
|
|
73511
73307
|
Directive(node, key, parent2, path3, ancestors) {
|
|
73512
73308
|
if (![config.listDirective, config.paginateDirective].includes(node.name.value)) {
|
|
73513
73309
|
return;
|
|
@@ -73529,7 +73325,7 @@ function listDefinitions(config, filepath, body, docs) {
|
|
|
73529
73325
|
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
73530
73326
|
const { type: listType } = unwrapType(config, targetFieldDefinition.type);
|
|
73531
73327
|
const possibleTypes = [];
|
|
73532
|
-
if (
|
|
73328
|
+
if (graphql20.isAbstractType(listType)) {
|
|
73533
73329
|
possibleTypes.push(
|
|
73534
73330
|
...config.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
73535
73331
|
);
|
|
@@ -73691,7 +73487,7 @@ async function typescriptGenerator(config, docs) {
|
|
|
73691
73487
|
}
|
|
73692
73488
|
|
|
73693
73489
|
// src/codegen/generators/persistedQueries/index.ts
|
|
73694
|
-
import * as
|
|
73490
|
+
import * as graphql21 from "graphql";
|
|
73695
73491
|
async function persistOutputGenerator(config, docs) {
|
|
73696
73492
|
if (!config.persistedQueriesPath.endsWith(".json")) {
|
|
73697
73493
|
throw new Error('Can write Persisted Queries only in a ".json" file.');
|
|
@@ -73701,8 +73497,8 @@ async function persistOutputGenerator(config, docs) {
|
|
|
73701
73497
|
if (!generateArtifact) {
|
|
73702
73498
|
return acc;
|
|
73703
73499
|
}
|
|
73704
|
-
let rawString =
|
|
73705
|
-
|
|
73500
|
+
let rawString = graphql21.print(
|
|
73501
|
+
graphql21.visit(document, {
|
|
73706
73502
|
Directive(node) {
|
|
73707
73503
|
if (config.isInternalDirective(node.name.value)) {
|
|
73708
73504
|
return null;
|
|
@@ -73711,7 +73507,7 @@ async function persistOutputGenerator(config, docs) {
|
|
|
73711
73507
|
})
|
|
73712
73508
|
);
|
|
73713
73509
|
const operations = document.definitions.filter(
|
|
73714
|
-
({ kind }) => kind ===
|
|
73510
|
+
({ kind }) => kind === graphql21.Kind.OPERATION_DEFINITION
|
|
73715
73511
|
);
|
|
73716
73512
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
73717
73513
|
if (artifact) {
|
|
@@ -73726,33 +73522,45 @@ async function persistOutputGenerator(config, docs) {
|
|
|
73726
73522
|
}
|
|
73727
73523
|
|
|
73728
73524
|
// src/codegen/generators/definitions/index.ts
|
|
73729
|
-
import * as
|
|
73525
|
+
import * as graphql23 from "graphql";
|
|
73730
73526
|
|
|
73731
73527
|
// src/codegen/generators/definitions/enums.ts
|
|
73732
73528
|
var recast13 = __toESM(require_main2(), 1);
|
|
73733
|
-
import * as
|
|
73529
|
+
import * as graphql22 from "graphql";
|
|
73734
73530
|
var AST13 = recast13.types.builders;
|
|
73735
73531
|
async function definitionsGenerator(config) {
|
|
73736
|
-
const enums =
|
|
73532
|
+
const enums = graphql22.parse(graphql22.printSchema(config.schema)).definitions.filter(
|
|
73737
73533
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
73738
73534
|
).filter((def) => !config.isInternalEnum(def));
|
|
73739
73535
|
const { code: runtimeDefinitions } = await printJS(
|
|
73740
73536
|
AST13.program(
|
|
73741
73537
|
enums.map((defn) => {
|
|
73742
73538
|
const name = defn.name.value;
|
|
73743
|
-
|
|
73539
|
+
const declaration = moduleExport(
|
|
73744
73540
|
config,
|
|
73745
73541
|
name,
|
|
73746
73542
|
AST13.objectExpression(
|
|
73747
73543
|
defn.values?.map((value) => {
|
|
73748
73544
|
const str = value.name.value;
|
|
73749
|
-
|
|
73545
|
+
const prop = AST13.objectProperty(
|
|
73750
73546
|
AST13.stringLiteral(str),
|
|
73751
73547
|
AST13.stringLiteral(str)
|
|
73752
73548
|
);
|
|
73549
|
+
const deprecationReason = value.directives?.find((d3) => d3.name.value === "deprecated")?.arguments?.find((a2) => a2.name.value === "reason")?.value?.value;
|
|
73550
|
+
if (value.description || deprecationReason)
|
|
73551
|
+
prop.comments = [
|
|
73552
|
+
jsdocComment(value.description?.value ?? "", deprecationReason)
|
|
73553
|
+
];
|
|
73554
|
+
return prop;
|
|
73753
73555
|
}) || []
|
|
73754
73556
|
)
|
|
73755
73557
|
);
|
|
73558
|
+
if (defn.description) {
|
|
73559
|
+
declaration.comments = [
|
|
73560
|
+
AST13.commentBlock(`* ${defn.description.value} `, true, false)
|
|
73561
|
+
];
|
|
73562
|
+
}
|
|
73563
|
+
return declaration;
|
|
73756
73564
|
})
|
|
73757
73565
|
)
|
|
73758
73566
|
);
|
|
@@ -73761,11 +73569,19 @@ type ValuesOf<T> = T[keyof T]
|
|
|
73761
73569
|
` + enums.sort((a2, b2) => a2.name.value.localeCompare(b2.name.value)).map((definition) => {
|
|
73762
73570
|
const name = definition.name.value;
|
|
73763
73571
|
const values = definition.values;
|
|
73764
|
-
|
|
73572
|
+
let jsdoc = "";
|
|
73573
|
+
if (definition.description) {
|
|
73574
|
+
jsdoc = `
|
|
73575
|
+
/** ${definition.description.value} */`;
|
|
73576
|
+
}
|
|
73577
|
+
return `${jsdoc}
|
|
73765
73578
|
export declare const ${name}: {
|
|
73766
|
-
${values?.map(
|
|
73579
|
+
${values?.map(
|
|
73580
|
+
(value) => (value.description ? ` /** ${value.description.value} */
|
|
73581
|
+
` : "") + ` readonly ${value.name.value}: "${value.name.value}";`
|
|
73582
|
+
).join("\n")}
|
|
73767
73583
|
}
|
|
73768
|
-
|
|
73584
|
+
${jsdoc}
|
|
73769
73585
|
export type ${name}$options = ValuesOf<typeof ${name}>
|
|
73770
73586
|
`;
|
|
73771
73587
|
}).join("");
|
|
@@ -73785,7 +73601,7 @@ async function schemaGenerator(config) {
|
|
|
73785
73601
|
await Promise.all([
|
|
73786
73602
|
fs_exports.writeFile(
|
|
73787
73603
|
config.definitionsSchemaPath,
|
|
73788
|
-
config.localSchema ?
|
|
73604
|
+
config.localSchema ? graphql23.printSchema(config.schema) : config.newSchema
|
|
73789
73605
|
),
|
|
73790
73606
|
fs_exports.writeFile(config.definitionsDocumentsPath, config.newDocuments),
|
|
73791
73607
|
definitionsGenerator(config)
|
|
@@ -75490,7 +75306,7 @@ function mergeGraphQLTypes2(typeSource, config) {
|
|
|
75490
75306
|
}
|
|
75491
75307
|
|
|
75492
75308
|
// src/codegen/transforms/schema.ts
|
|
75493
|
-
import * as
|
|
75309
|
+
import * as graphql24 from "graphql";
|
|
75494
75310
|
async function graphqlExtensions(config, documents) {
|
|
75495
75311
|
let internalSchema = `
|
|
75496
75312
|
enum CachePolicy {
|
|
@@ -75613,7 +75429,7 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
75613
75429
|
const args = fragmentArguments(config, "", field.parent);
|
|
75614
75430
|
if (args.length > 0) {
|
|
75615
75431
|
argString = "(" + args.map((arg) => {
|
|
75616
|
-
const typeName =
|
|
75432
|
+
const typeName = graphql24.print(arg.type);
|
|
75617
75433
|
return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
|
|
75618
75434
|
}).join("\n") + ")";
|
|
75619
75435
|
}
|
|
@@ -75623,20 +75439,20 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
|
|
|
75623
75439
|
`;
|
|
75624
75440
|
}).join("\n");
|
|
75625
75441
|
extensions += `${Object.keys(config.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
|
|
75626
|
-
config.newSchema =
|
|
75442
|
+
config.newSchema = graphql24.print(mergeTypeDefs2([internalSchema, config.newSchema]));
|
|
75627
75443
|
config.schemaString += extensions;
|
|
75628
|
-
config.schema =
|
|
75629
|
-
|
|
75630
|
-
mergeTypeDefs2([
|
|
75444
|
+
config.schema = graphql24.buildSchema(
|
|
75445
|
+
graphql24.print(
|
|
75446
|
+
mergeTypeDefs2([graphql24.printSchema(config.schema), internalSchema, extensions])
|
|
75631
75447
|
)
|
|
75632
75448
|
);
|
|
75633
75449
|
}
|
|
75634
75450
|
|
|
75635
75451
|
// src/codegen/transforms/typename.ts
|
|
75636
|
-
import * as
|
|
75452
|
+
import * as graphql25 from "graphql";
|
|
75637
75453
|
async function addTypename(config, documents) {
|
|
75638
75454
|
for (const doc of documents) {
|
|
75639
|
-
doc.document =
|
|
75455
|
+
doc.document = graphql25.visit(doc.document, {
|
|
75640
75456
|
Field(node, key, parent2, path3, ancestors) {
|
|
75641
75457
|
if (!node.selectionSet) {
|
|
75642
75458
|
return;
|
|
@@ -75648,7 +75464,7 @@ async function addTypename(config, documents) {
|
|
|
75648
75464
|
);
|
|
75649
75465
|
const field = type.getFields()[node.name.value];
|
|
75650
75466
|
const fieldType = unwrapType(config, field.type).type;
|
|
75651
|
-
if (
|
|
75467
|
+
if (graphql25.isInterfaceType(fieldType) || graphql25.isUnionType(fieldType)) {
|
|
75652
75468
|
return {
|
|
75653
75469
|
...node,
|
|
75654
75470
|
selectionSet: {
|
|
@@ -75656,9 +75472,9 @@ async function addTypename(config, documents) {
|
|
|
75656
75472
|
selections: [
|
|
75657
75473
|
...node.selectionSet.selections,
|
|
75658
75474
|
{
|
|
75659
|
-
kind:
|
|
75475
|
+
kind: graphql25.Kind.FIELD,
|
|
75660
75476
|
name: {
|
|
75661
|
-
kind:
|
|
75477
|
+
kind: graphql25.Kind.NAME,
|
|
75662
75478
|
value: "__typename"
|
|
75663
75479
|
}
|
|
75664
75480
|
}
|
|
@@ -75675,9 +75491,9 @@ async function addTypename(config, documents) {
|
|
|
75675
75491
|
selections: [
|
|
75676
75492
|
...node.selectionSet.selections,
|
|
75677
75493
|
{
|
|
75678
|
-
kind:
|
|
75494
|
+
kind: graphql25.Kind.FIELD,
|
|
75679
75495
|
name: {
|
|
75680
|
-
kind:
|
|
75496
|
+
kind: graphql25.Kind.NAME,
|
|
75681
75497
|
value: "__typename"
|
|
75682
75498
|
}
|
|
75683
75499
|
}
|
|
@@ -75690,10 +75506,10 @@ async function addTypename(config, documents) {
|
|
|
75690
75506
|
}
|
|
75691
75507
|
|
|
75692
75508
|
// src/codegen/transforms/addID.ts
|
|
75693
|
-
import * as
|
|
75509
|
+
import * as graphql26 from "graphql";
|
|
75694
75510
|
async function addID(config, documents) {
|
|
75695
75511
|
for (const doc of documents) {
|
|
75696
|
-
doc.document =
|
|
75512
|
+
doc.document = graphql26.visit(doc.document, {
|
|
75697
75513
|
Field(node, key, parent2, path3, ancestors) {
|
|
75698
75514
|
if (!node.selectionSet) {
|
|
75699
75515
|
return;
|
|
@@ -75731,7 +75547,7 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
75731
75547
|
if (!node.selectionSet || node.selectionSet.selections.length == 0) {
|
|
75732
75548
|
return;
|
|
75733
75549
|
}
|
|
75734
|
-
if (!
|
|
75550
|
+
if (!graphql26.isObjectType(fieldType) && !graphql26.isInterfaceType(fieldType)) {
|
|
75735
75551
|
return;
|
|
75736
75552
|
}
|
|
75737
75553
|
const keyFields = config.keyFieldsForType(fieldType.name);
|
|
@@ -75746,9 +75562,9 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
75746
75562
|
continue;
|
|
75747
75563
|
}
|
|
75748
75564
|
selections.push({
|
|
75749
|
-
kind:
|
|
75565
|
+
kind: graphql26.Kind.FIELD,
|
|
75750
75566
|
name: {
|
|
75751
|
-
kind:
|
|
75567
|
+
kind: graphql26.Kind.NAME,
|
|
75752
75568
|
value: keyField
|
|
75753
75569
|
}
|
|
75754
75570
|
});
|
|
@@ -75763,13 +75579,13 @@ function addKeysToSelection(config, node, fieldType) {
|
|
|
75763
75579
|
}
|
|
75764
75580
|
|
|
75765
75581
|
// src/codegen/transforms/componentFields.ts
|
|
75766
|
-
import * as
|
|
75582
|
+
import * as graphql27 from "graphql";
|
|
75767
75583
|
async function componentFields(config, documents) {
|
|
75768
75584
|
for (const document of documents) {
|
|
75769
|
-
const typeInfo = new
|
|
75770
|
-
document.document =
|
|
75585
|
+
const typeInfo = new graphql27.TypeInfo(config.schema);
|
|
75586
|
+
document.document = graphql27.visit(
|
|
75771
75587
|
document.document,
|
|
75772
|
-
|
|
75588
|
+
graphql27.visitWithTypeInfo(typeInfo, {
|
|
75773
75589
|
Field(node) {
|
|
75774
75590
|
const parentType = typeInfo.getParentType();
|
|
75775
75591
|
if (!parentType) {
|
|
@@ -75818,10 +75634,10 @@ async function componentFields(config, documents) {
|
|
|
75818
75634
|
}
|
|
75819
75635
|
|
|
75820
75636
|
// src/codegen/transforms/runtimeScalars.ts
|
|
75821
|
-
import * as
|
|
75637
|
+
import * as graphql28 from "graphql";
|
|
75822
75638
|
async function addTypename2(config, documents) {
|
|
75823
75639
|
for (const doc of documents) {
|
|
75824
|
-
doc.document =
|
|
75640
|
+
doc.document = graphql28.visit(doc.document, {
|
|
75825
75641
|
VariableDefinition(node) {
|
|
75826
75642
|
const { type, wrappers } = unwrapType(config, node.type);
|
|
75827
75643
|
const runtimeScalar = config.configFile.features?.runtimeScalars?.[type.name];
|
|
@@ -75860,7 +75676,7 @@ async function addTypename2(config, documents) {
|
|
|
75860
75676
|
}
|
|
75861
75677
|
|
|
75862
75678
|
// src/codegen/validators/typeCheck.ts
|
|
75863
|
-
import * as
|
|
75679
|
+
import * as graphql29 from "graphql";
|
|
75864
75680
|
async function typeCheck(config, docs) {
|
|
75865
75681
|
const errors = [];
|
|
75866
75682
|
const freeLists = [];
|
|
@@ -75868,7 +75684,7 @@ async function typeCheck(config, docs) {
|
|
|
75868
75684
|
const listTypes = [];
|
|
75869
75685
|
const fragments = {};
|
|
75870
75686
|
for (const { document: parsed, originalString, filename } of docs) {
|
|
75871
|
-
|
|
75687
|
+
graphql29.visit(parsed, {
|
|
75872
75688
|
FragmentDefinition(definition) {
|
|
75873
75689
|
fragments[definition.name.value] = definition;
|
|
75874
75690
|
},
|
|
@@ -75913,14 +75729,14 @@ async function typeCheck(config, docs) {
|
|
|
75913
75729
|
);
|
|
75914
75730
|
return;
|
|
75915
75731
|
}
|
|
75916
|
-
if (
|
|
75732
|
+
if (graphql29.isListType(rootType) || graphql29.isNonNullType(rootType) && graphql29.isListType(rootType.ofType)) {
|
|
75917
75733
|
needsParent = true;
|
|
75918
75734
|
break;
|
|
75919
75735
|
}
|
|
75920
|
-
if (
|
|
75736
|
+
if (graphql29.isNonNullType(rootType) && "ofType" in rootType) {
|
|
75921
75737
|
rootType = rootType.ofType;
|
|
75922
75738
|
}
|
|
75923
|
-
if (
|
|
75739
|
+
if (graphql29.isScalarType(rootType)) {
|
|
75924
75740
|
break;
|
|
75925
75741
|
}
|
|
75926
75742
|
rootType = rootType?.getFields()[parent3.name.value]?.type;
|
|
@@ -75996,9 +75812,9 @@ async function typeCheck(config, docs) {
|
|
|
75996
75812
|
);
|
|
75997
75813
|
}
|
|
75998
75814
|
let targetTypes = [type];
|
|
75999
|
-
if (
|
|
75815
|
+
if (graphql29.isUnionType(type)) {
|
|
76000
75816
|
targetTypes = config.schema.getPossibleTypes(type);
|
|
76001
|
-
} else if (
|
|
75817
|
+
} else if (graphql29.isInterfaceType(type)) {
|
|
76002
75818
|
try {
|
|
76003
75819
|
for (const key of config.keyFieldsForType(type.name)) {
|
|
76004
75820
|
if (!type.getFields()[key]) {
|
|
@@ -76034,13 +75850,13 @@ async function typeCheck(config, docs) {
|
|
|
76034
75850
|
if (errors.length > 0) {
|
|
76035
75851
|
throw errors;
|
|
76036
75852
|
}
|
|
76037
|
-
const rules = (filepath) => [...
|
|
75853
|
+
const rules = (filepath) => [...graphql29.specifiedRules].filter(
|
|
76038
75854
|
(rule) => ![
|
|
76039
|
-
|
|
76040
|
-
|
|
76041
|
-
|
|
76042
|
-
|
|
76043
|
-
|
|
75855
|
+
graphql29.NoUnusedFragmentsRule,
|
|
75856
|
+
graphql29.KnownFragmentNamesRule,
|
|
75857
|
+
graphql29.ExecutableDefinitionsRule,
|
|
75858
|
+
graphql29.KnownDirectivesRule,
|
|
75859
|
+
graphql29.KnownArgumentNamesRule
|
|
76044
75860
|
].includes(rule)
|
|
76045
75861
|
).concat(
|
|
76046
75862
|
validateLists({
|
|
@@ -76061,7 +75877,7 @@ async function typeCheck(config, docs) {
|
|
|
76061
75877
|
validateLoadingDirective(config)
|
|
76062
75878
|
);
|
|
76063
75879
|
for (const { filename, document: parsed, originalString } of docs) {
|
|
76064
|
-
for (const error of
|
|
75880
|
+
for (const error of graphql29.validate(config.schema, parsed, rules(filename))) {
|
|
76065
75881
|
errors.push(
|
|
76066
75882
|
new HoudiniError({
|
|
76067
75883
|
filepath: filename,
|
|
@@ -76090,20 +75906,20 @@ function validateRequiredDirective(config, filepath) {
|
|
|
76090
75906
|
if (!node.directives?.some(({ name }) => name.value === config.requiredDirective))
|
|
76091
75907
|
return;
|
|
76092
75908
|
const parentType = parentTypeFromAncestors(config.schema, filepath, ancestors);
|
|
76093
|
-
if (!
|
|
75909
|
+
if (!graphql29.isObjectType(parentType)) {
|
|
76094
75910
|
ctx.reportError(
|
|
76095
|
-
new
|
|
75911
|
+
new graphql29.GraphQLError(
|
|
76096
75912
|
`@${config.requiredDirective} may only be used on objects, not arguments`
|
|
76097
75913
|
)
|
|
76098
75914
|
);
|
|
76099
75915
|
return;
|
|
76100
75916
|
}
|
|
76101
75917
|
const type = parentType.getFields()[node.name.value].type;
|
|
76102
|
-
const isServerNullable = !
|
|
75918
|
+
const isServerNullable = !graphql29.isNonNullType(type);
|
|
76103
75919
|
const isAlreadyClientNullable = isClientNullable(node, true);
|
|
76104
75920
|
if (!isServerNullable && !isAlreadyClientNullable) {
|
|
76105
75921
|
ctx.reportError(
|
|
76106
|
-
new
|
|
75922
|
+
new graphql29.GraphQLError(
|
|
76107
75923
|
`@${config.requiredDirective} may only be used on nullable fields`
|
|
76108
75924
|
)
|
|
76109
75925
|
);
|
|
@@ -76125,7 +75941,7 @@ var validateLists = ({
|
|
|
76125
75941
|
if (!config.isListFragment(node.name.value)) {
|
|
76126
75942
|
if (!fragments[node.name.value]) {
|
|
76127
75943
|
ctx.reportError(
|
|
76128
|
-
new
|
|
75944
|
+
new graphql29.GraphQLError(
|
|
76129
75945
|
"Encountered unknown fragment: " + node.name.value
|
|
76130
75946
|
)
|
|
76131
75947
|
);
|
|
@@ -76135,7 +75951,7 @@ var validateLists = ({
|
|
|
76135
75951
|
const listName = config.listNameFromFragment(node.name.value);
|
|
76136
75952
|
if (!lists.includes(listName)) {
|
|
76137
75953
|
ctx.reportError(
|
|
76138
|
-
new
|
|
75954
|
+
new graphql29.GraphQLError(
|
|
76139
75955
|
"Encountered fragment referencing unknown list: " + listName
|
|
76140
75956
|
)
|
|
76141
75957
|
);
|
|
@@ -76160,7 +75976,7 @@ var validateLists = ({
|
|
|
76160
75976
|
);
|
|
76161
75977
|
if (parentArg) {
|
|
76162
75978
|
ctx.reportError(
|
|
76163
|
-
new
|
|
75979
|
+
new graphql29.GraphQLError(
|
|
76164
75980
|
`@${config.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
76165
75981
|
)
|
|
76166
75982
|
);
|
|
@@ -76176,7 +75992,7 @@ var validateLists = ({
|
|
|
76176
75992
|
return;
|
|
76177
75993
|
}
|
|
76178
75994
|
ctx.reportError(
|
|
76179
|
-
new
|
|
75995
|
+
new graphql29.GraphQLError(
|
|
76180
75996
|
`For this list fragment, you need to add or @${config.listParentDirective} or @${config.listAllListsDirective} directive to specify the behavior`
|
|
76181
75997
|
)
|
|
76182
75998
|
);
|
|
@@ -76186,7 +76002,7 @@ var validateLists = ({
|
|
|
76186
76002
|
const directiveName = node.name.value;
|
|
76187
76003
|
if (directiveName === "connection") {
|
|
76188
76004
|
ctx.reportError(
|
|
76189
|
-
new
|
|
76005
|
+
new graphql29.GraphQLError(
|
|
76190
76006
|
"@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."
|
|
76191
76007
|
)
|
|
76192
76008
|
);
|
|
@@ -76195,7 +76011,7 @@ var validateLists = ({
|
|
|
76195
76011
|
if (!config.isInternalDirective(node.name.value)) {
|
|
76196
76012
|
if (!config.schema.getDirective(directiveName)) {
|
|
76197
76013
|
ctx.reportError(
|
|
76198
|
-
new
|
|
76014
|
+
new graphql29.GraphQLError(
|
|
76199
76015
|
"Encountered unknown directive: " + directiveName
|
|
76200
76016
|
)
|
|
76201
76017
|
);
|
|
@@ -76204,7 +76020,7 @@ var validateLists = ({
|
|
|
76204
76020
|
}
|
|
76205
76021
|
if (config.isListOperationDirective(directiveName) && !listTypes.includes(config.listNameFromDirective(directiveName))) {
|
|
76206
76022
|
ctx.reportError(
|
|
76207
|
-
new
|
|
76023
|
+
new graphql29.GraphQLError(
|
|
76208
76024
|
"Encountered directive referencing unknown list: " + directiveName
|
|
76209
76025
|
)
|
|
76210
76026
|
);
|
|
@@ -76215,7 +76031,7 @@ var validateLists = ({
|
|
|
76215
76031
|
};
|
|
76216
76032
|
function knownArguments(config) {
|
|
76217
76033
|
return function(ctx) {
|
|
76218
|
-
const nativeValidator =
|
|
76034
|
+
const nativeValidator = graphql29.KnownArgumentNamesRule(ctx);
|
|
76219
76035
|
return {
|
|
76220
76036
|
...nativeValidator,
|
|
76221
76037
|
Directive(directiveNode) {
|
|
@@ -76250,7 +76066,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76250
76066
|
for (const arg of node.arguments || []) {
|
|
76251
76067
|
if (arg.value.kind !== "ObjectValue") {
|
|
76252
76068
|
ctx.reportError(
|
|
76253
|
-
new
|
|
76069
|
+
new graphql29.GraphQLError("values in @arguments must be an object")
|
|
76254
76070
|
);
|
|
76255
76071
|
return;
|
|
76256
76072
|
}
|
|
@@ -76260,13 +76076,13 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76260
76076
|
);
|
|
76261
76077
|
if (!typeArg) {
|
|
76262
76078
|
ctx.reportError(
|
|
76263
|
-
new
|
|
76079
|
+
new graphql29.GraphQLError("missing type field for @arguments directive")
|
|
76264
76080
|
);
|
|
76265
76081
|
return;
|
|
76266
76082
|
}
|
|
76267
|
-
if (typeArg.value.kind !==
|
|
76083
|
+
if (typeArg.value.kind !== graphql29.Kind.STRING) {
|
|
76268
76084
|
ctx.reportError(
|
|
76269
|
-
new
|
|
76085
|
+
new graphql29.GraphQLError("type field to @arguments must be a string")
|
|
76270
76086
|
);
|
|
76271
76087
|
return;
|
|
76272
76088
|
}
|
|
@@ -76279,7 +76095,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76279
76095
|
);
|
|
76280
76096
|
if (typeArg.value.value !== defaultValueType) {
|
|
76281
76097
|
ctx.reportError(
|
|
76282
|
-
new
|
|
76098
|
+
new graphql29.GraphQLError(
|
|
76283
76099
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
76284
76100
|
)
|
|
76285
76101
|
);
|
|
@@ -76297,7 +76113,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76297
76113
|
try {
|
|
76298
76114
|
args = fragmentArguments(config, filepath, fragments[fragmentName]);
|
|
76299
76115
|
} catch (e3) {
|
|
76300
|
-
ctx.reportError(new
|
|
76116
|
+
ctx.reportError(new graphql29.GraphQLError(e3.message));
|
|
76301
76117
|
return;
|
|
76302
76118
|
}
|
|
76303
76119
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -76320,7 +76136,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76320
76136
|
);
|
|
76321
76137
|
if (missing.length > 0) {
|
|
76322
76138
|
ctx.reportError(
|
|
76323
|
-
new
|
|
76139
|
+
new graphql29.GraphQLError(
|
|
76324
76140
|
`The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
|
|
76325
76141
|
)
|
|
76326
76142
|
);
|
|
@@ -76331,7 +76147,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76331
76147
|
);
|
|
76332
76148
|
if (unknown.length > 0) {
|
|
76333
76149
|
ctx.reportError(
|
|
76334
|
-
new
|
|
76150
|
+
new graphql29.GraphQLError(
|
|
76335
76151
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
76336
76152
|
)
|
|
76337
76153
|
);
|
|
@@ -76343,7 +76159,7 @@ function validateFragmentArguments(config, filepath, fragments) {
|
|
|
76343
76159
|
for (const [applied, target] of zipped) {
|
|
76344
76160
|
if (!valueIsType(config, applied.value, target)) {
|
|
76345
76161
|
ctx.reportError(
|
|
76346
|
-
new
|
|
76162
|
+
new graphql29.GraphQLError(
|
|
76347
76163
|
`Invalid argument type. Expected ${target}, found ${applied.value.kind}`
|
|
76348
76164
|
)
|
|
76349
76165
|
);
|
|
@@ -76385,7 +76201,7 @@ function valueIsType(config, value, targetType) {
|
|
|
76385
76201
|
}
|
|
76386
76202
|
if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
|
|
76387
76203
|
const enumType = config.schema.getType(targetType.name.value);
|
|
76388
|
-
if (!
|
|
76204
|
+
if (!graphql29.isEnumType(enumType)) {
|
|
76389
76205
|
return false;
|
|
76390
76206
|
}
|
|
76391
76207
|
return enumType.getValues().some((enumValue) => enumValue.value === value.value);
|
|
@@ -76405,7 +76221,7 @@ function paginateArgs(config, filepath) {
|
|
|
76405
76221
|
}
|
|
76406
76222
|
if (alreadyPaginated) {
|
|
76407
76223
|
ctx.reportError(
|
|
76408
|
-
new
|
|
76224
|
+
new graphql29.GraphQLError(
|
|
76409
76225
|
`@${config.paginateDirective} can only appear in a document once.`
|
|
76410
76226
|
)
|
|
76411
76227
|
);
|
|
@@ -76437,7 +76253,7 @@ function paginateArgs(config, filepath) {
|
|
|
76437
76253
|
const backwards = appliedArgs.has("last");
|
|
76438
76254
|
if (!forward && !backwards) {
|
|
76439
76255
|
ctx.reportError(
|
|
76440
|
-
new
|
|
76256
|
+
new graphql29.GraphQLError(
|
|
76441
76257
|
"A field with cursor-based pagination must have a first or last argument"
|
|
76442
76258
|
)
|
|
76443
76259
|
);
|
|
@@ -76451,7 +76267,7 @@ function paginateArgs(config, filepath) {
|
|
|
76451
76267
|
}
|
|
76452
76268
|
if (forward && backwards && paginateMode === "Infinite") {
|
|
76453
76269
|
ctx.reportError(
|
|
76454
|
-
new
|
|
76270
|
+
new graphql29.GraphQLError(
|
|
76455
76271
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
76456
76272
|
)
|
|
76457
76273
|
);
|
|
@@ -76465,7 +76281,7 @@ function paginateArgs(config, filepath) {
|
|
|
76465
76281
|
);
|
|
76466
76282
|
if (!appliedLimitArg) {
|
|
76467
76283
|
ctx.reportError(
|
|
76468
|
-
new
|
|
76284
|
+
new graphql29.GraphQLError(
|
|
76469
76285
|
"A field with offset-based pagination must have a limit argument"
|
|
76470
76286
|
)
|
|
76471
76287
|
);
|
|
@@ -76481,20 +76297,20 @@ function noUnusedFragmentArguments(config) {
|
|
|
76481
76297
|
const args = /* @__PURE__ */ new Set();
|
|
76482
76298
|
return {
|
|
76483
76299
|
enter(node) {
|
|
76484
|
-
if (node.kind ===
|
|
76300
|
+
if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
|
|
76485
76301
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
76486
76302
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
76487
76303
|
args.add(arg);
|
|
76488
76304
|
}
|
|
76489
|
-
} else if (node.kind ===
|
|
76305
|
+
} else if (node.kind === graphql29.Kind.VARIABLE) {
|
|
76490
76306
|
args.delete(node.name.value);
|
|
76491
76307
|
}
|
|
76492
76308
|
},
|
|
76493
76309
|
leave(node) {
|
|
76494
|
-
if (node.kind ===
|
|
76310
|
+
if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
|
|
76495
76311
|
if (args.size > 0) {
|
|
76496
76312
|
ctx.reportError(
|
|
76497
|
-
new
|
|
76313
|
+
new graphql29.GraphQLError(
|
|
76498
76314
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
76499
76315
|
)
|
|
76500
76316
|
);
|
|
@@ -76530,7 +76346,7 @@ function nodeDirectives(config, directives) {
|
|
|
76530
76346
|
if (definition.kind === "OperationDefinition") {
|
|
76531
76347
|
if (definition.operation !== "query") {
|
|
76532
76348
|
ctx.reportError(
|
|
76533
|
-
new
|
|
76349
|
+
new graphql29.GraphQLError(
|
|
76534
76350
|
`@${node.name.value} must fall on a fragment or query document`
|
|
76535
76351
|
)
|
|
76536
76352
|
);
|
|
@@ -76542,7 +76358,7 @@ function nodeDirectives(config, directives) {
|
|
|
76542
76358
|
}
|
|
76543
76359
|
if (!possibleNodes.includes(definitionType)) {
|
|
76544
76360
|
ctx.reportError(
|
|
76545
|
-
new
|
|
76361
|
+
new graphql29.GraphQLError(paginateOnNonNodeMessage(node.name.value))
|
|
76546
76362
|
);
|
|
76547
76363
|
}
|
|
76548
76364
|
}
|
|
@@ -76561,7 +76377,7 @@ function checkMutationOperation(config) {
|
|
|
76561
76377
|
);
|
|
76562
76378
|
if (append && prepend) {
|
|
76563
76379
|
ctx.reportError(
|
|
76564
|
-
new
|
|
76380
|
+
new graphql29.GraphQLError(
|
|
76565
76381
|
`You can't apply both @${config.listPrependDirective} and @${config.listAppendDirective} at the same time`
|
|
76566
76382
|
)
|
|
76567
76383
|
);
|
|
@@ -76575,7 +76391,7 @@ function checkMutationOperation(config) {
|
|
|
76575
76391
|
);
|
|
76576
76392
|
if (parentId && allLists) {
|
|
76577
76393
|
ctx.reportError(
|
|
76578
|
-
new
|
|
76394
|
+
new graphql29.GraphQLError(
|
|
76579
76395
|
`You can't apply both @${config.listParentDirective} and @${config.listAllListsDirective} at the same time`
|
|
76580
76396
|
)
|
|
76581
76397
|
);
|
|
@@ -76597,7 +76413,7 @@ function checkMaskDirectives(config) {
|
|
|
76597
76413
|
);
|
|
76598
76414
|
if (maskEnableDirective && maskDisableDirective) {
|
|
76599
76415
|
ctx.reportError(
|
|
76600
|
-
new
|
|
76416
|
+
new graphql29.GraphQLError(
|
|
76601
76417
|
`You can't apply both @${config.maskEnableDirective} and @${config.maskDisableDirective} at the same time`
|
|
76602
76418
|
)
|
|
76603
76419
|
);
|
|
@@ -76639,7 +76455,7 @@ function validateLoadingDirective(config) {
|
|
|
76639
76455
|
);
|
|
76640
76456
|
if (!parentLoading && !global2) {
|
|
76641
76457
|
ctx.reportError(
|
|
76642
|
-
new
|
|
76458
|
+
new graphql29.GraphQLError(
|
|
76643
76459
|
`@${config.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config.loadingDirective}`
|
|
76644
76460
|
)
|
|
76645
76461
|
);
|
|
@@ -76661,7 +76477,7 @@ function validateLoadingDirective(config) {
|
|
|
76661
76477
|
);
|
|
76662
76478
|
if (!parentLoading && !global2) {
|
|
76663
76479
|
ctx.reportError(
|
|
76664
|
-
new
|
|
76480
|
+
new graphql29.GraphQLError(
|
|
76665
76481
|
`@${config.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config.loadingDirective}`
|
|
76666
76482
|
)
|
|
76667
76483
|
);
|
|
@@ -76676,7 +76492,7 @@ function getAndVerifyNodeInterface(config) {
|
|
|
76676
76492
|
if (!nodeInterface) {
|
|
76677
76493
|
return null;
|
|
76678
76494
|
}
|
|
76679
|
-
if (!
|
|
76495
|
+
if (!graphql29.isInterfaceType(nodeInterface)) {
|
|
76680
76496
|
displayInvalidNodeFieldMessage(config);
|
|
76681
76497
|
return null;
|
|
76682
76498
|
}
|
|
@@ -76771,11 +76587,11 @@ async function uniqueDocumentNames(config, docs) {
|
|
|
76771
76587
|
}
|
|
76772
76588
|
|
|
76773
76589
|
// src/codegen/validators/noIDAlias.ts
|
|
76774
|
-
import * as
|
|
76590
|
+
import * as graphql30 from "graphql";
|
|
76775
76591
|
async function noIDAlias(config, docs) {
|
|
76776
76592
|
const errors = [];
|
|
76777
76593
|
for (const { filename, document } of docs) {
|
|
76778
|
-
|
|
76594
|
+
graphql30.visit(document, {
|
|
76779
76595
|
Field(node, _3, __, ___, ancestors) {
|
|
76780
76596
|
const fieldType = parentTypeFromAncestors(config.schema, filename, ancestors).name;
|
|
76781
76597
|
if (config.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -76814,11 +76630,11 @@ async function validatePlugins(config, documents) {
|
|
|
76814
76630
|
}
|
|
76815
76631
|
|
|
76816
76632
|
// src/codegen/validators/componentFields.ts
|
|
76817
|
-
import * as
|
|
76633
|
+
import * as graphql31 from "graphql";
|
|
76818
76634
|
async function componentFields2(config, docs) {
|
|
76819
76635
|
const errors = [];
|
|
76820
76636
|
for (const { filename: filepath, document } of docs) {
|
|
76821
|
-
|
|
76637
|
+
graphql31.visit(document, {
|
|
76822
76638
|
FragmentDefinition(node, _3, __, ___, ancestors) {
|
|
76823
76639
|
const componentFieldDirective = node.directives?.find(
|
|
76824
76640
|
(dir) => dir.name.value === config.componentFieldDirective
|
|
@@ -76866,7 +76682,7 @@ async function componentFields2(config, docs) {
|
|
|
76866
76682
|
if (existingField && existingField.filepath !== filepath) {
|
|
76867
76683
|
conflict = true;
|
|
76868
76684
|
} else if (parentType && fieldValue) {
|
|
76869
|
-
const fieldDef =
|
|
76685
|
+
const fieldDef = graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue];
|
|
76870
76686
|
if (fieldDef && !fieldDef.astNode?.directives?.find(
|
|
76871
76687
|
(dir) => dir.name.value === config.componentFieldDirective
|
|
76872
76688
|
)) {
|
|
@@ -76879,7 +76695,7 @@ async function componentFields2(config, docs) {
|
|
|
76879
76695
|
filepath
|
|
76880
76696
|
});
|
|
76881
76697
|
}
|
|
76882
|
-
if (parentType &&
|
|
76698
|
+
if (parentType && graphql31.isAbstractType(parentType)) {
|
|
76883
76699
|
errors.push({
|
|
76884
76700
|
message: `Cannot add component field ${parent2}.${fieldValue} because ${parent2} is an abstract type`,
|
|
76885
76701
|
filepath
|
|
@@ -77100,12 +76916,12 @@ async function processJSFile(config, contents) {
|
|
|
77100
76916
|
return documents;
|
|
77101
76917
|
}
|
|
77102
76918
|
async function processGraphQLDocument(config, filepath, document) {
|
|
77103
|
-
const parsedDoc =
|
|
76919
|
+
const parsedDoc = graphql32.parse(document);
|
|
77104
76920
|
const operations = parsedDoc.definitions.filter(
|
|
77105
|
-
({ kind: kind2 }) => kind2 ===
|
|
76921
|
+
({ kind: kind2 }) => kind2 === graphql32.Kind.OPERATION_DEFINITION
|
|
77106
76922
|
);
|
|
77107
76923
|
const fragments = parsedDoc.definitions.filter(
|
|
77108
|
-
({ kind: kind2 }) => kind2 ===
|
|
76924
|
+
({ kind: kind2 }) => kind2 === graphql32.Kind.FRAGMENT_DEFINITION
|
|
77109
76925
|
);
|
|
77110
76926
|
if (operations.length > 1) {
|
|
77111
76927
|
throw new HoudiniError({
|
|
@@ -78221,12 +78037,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
78221
78037
|
}
|
|
78222
78038
|
packageJSON2.devDependencies = {
|
|
78223
78039
|
...packageJSON2.devDependencies,
|
|
78224
|
-
houdini: "^1.2.
|
|
78040
|
+
houdini: "^1.2.46"
|
|
78225
78041
|
};
|
|
78226
78042
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
78227
78043
|
packageJSON2.devDependencies = {
|
|
78228
78044
|
...packageJSON2.devDependencies,
|
|
78229
|
-
"houdini-svelte": "^1.2.
|
|
78045
|
+
"houdini-svelte": "^1.2.46"
|
|
78230
78046
|
};
|
|
78231
78047
|
} else {
|
|
78232
78048
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|