houdini 0.18.2 → 0.18.3
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 +257 -264
- package/build/cmd-esm/index.js +257 -264
- package/build/codegen/utils/objectIdentificationSelection.d.ts +3 -0
- package/build/codegen-cjs/index.js +255 -262
- package/build/codegen-esm/index.js +255 -262
- package/build/runtime/lib/config.d.ts +1 -1
- package/build/runtime-cjs/lib/config.d.ts +1 -1
- package/build/runtime-esm/lib/config.d.ts +1 -1
- package/build/test-cjs/index.js +263 -260
- package/build/test-esm/index.js +263 -260
- package/build/vite-cjs/index.js +255 -262
- package/build/vite-esm/index.js +255 -262
- package/package.json +1 -1
package/build/cmd-cjs/index.js
CHANGED
|
@@ -2282,7 +2282,7 @@ var require_kinds = __commonJS({
|
|
|
2282
2282
|
value: true
|
|
2283
2283
|
});
|
|
2284
2284
|
exports.Kind = void 0;
|
|
2285
|
-
var
|
|
2285
|
+
var Kind30 = Object.freeze({
|
|
2286
2286
|
NAME: "Name",
|
|
2287
2287
|
DOCUMENT: "Document",
|
|
2288
2288
|
OPERATION_DEFINITION: "OperationDefinition",
|
|
@@ -2327,7 +2327,7 @@ var require_kinds = __commonJS({
|
|
|
2327
2327
|
ENUM_TYPE_EXTENSION: "EnumTypeExtension",
|
|
2328
2328
|
INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension"
|
|
2329
2329
|
});
|
|
2330
|
-
exports.Kind =
|
|
2330
|
+
exports.Kind = Kind30;
|
|
2331
2331
|
}
|
|
2332
2332
|
});
|
|
2333
2333
|
|
|
@@ -11507,7 +11507,7 @@ var require_graphql = __commonJS({
|
|
|
11507
11507
|
Object.defineProperty(exports, "__esModule", {
|
|
11508
11508
|
value: true
|
|
11509
11509
|
});
|
|
11510
|
-
exports.graphql =
|
|
11510
|
+
exports.graphql = graphql29;
|
|
11511
11511
|
exports.graphqlSync = graphqlSync;
|
|
11512
11512
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
11513
11513
|
var _parser = require_parser();
|
|
@@ -11517,7 +11517,7 @@ var require_graphql = __commonJS({
|
|
|
11517
11517
|
function _interopRequireDefault(obj) {
|
|
11518
11518
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
11519
11519
|
}
|
|
11520
|
-
function
|
|
11520
|
+
function graphql29(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
11521
11521
|
var _arguments = arguments;
|
|
11522
11522
|
return new Promise(function(resolve2) {
|
|
11523
11523
|
return resolve2(
|
|
@@ -72389,10 +72389,10 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
72389
72389
|
}
|
|
72390
72390
|
|
|
72391
72391
|
// src/codegen/index.ts
|
|
72392
|
-
var
|
|
72392
|
+
var graphql28 = __toESM(require_graphql2(), 1);
|
|
72393
72393
|
|
|
72394
72394
|
// src/codegen/generators/artifacts/index.ts
|
|
72395
|
-
var
|
|
72395
|
+
var graphql14 = __toESM(require_graphql2(), 1);
|
|
72396
72396
|
var recast5 = __toESM(require_main2(), 1);
|
|
72397
72397
|
|
|
72398
72398
|
// src/codegen/utils/commonjs.ts
|
|
@@ -72996,7 +72996,7 @@ function ancestorKey(ancestors) {
|
|
|
72996
72996
|
}
|
|
72997
72997
|
|
|
72998
72998
|
// src/codegen/generators/artifacts/selection.ts
|
|
72999
|
-
var
|
|
72999
|
+
var graphql13 = __toESM(require_graphql2(), 1);
|
|
73000
73000
|
|
|
73001
73001
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
73002
73002
|
var config = {
|
|
@@ -73036,10 +73036,24 @@ function logYellow(str) {
|
|
|
73036
73036
|
}
|
|
73037
73037
|
|
|
73038
73038
|
// src/codegen/transforms/list.ts
|
|
73039
|
-
var
|
|
73039
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
73040
73040
|
|
|
73041
|
-
// src/codegen/
|
|
73041
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
73042
73042
|
var graphql9 = __toESM(require_graphql2(), 1);
|
|
73043
|
+
var objectIdentificationSelection = (config2, type) => {
|
|
73044
|
+
return config2.keyFieldsForType(type.name).map((key) => {
|
|
73045
|
+
return {
|
|
73046
|
+
kind: graphql9.Kind.FIELD,
|
|
73047
|
+
name: {
|
|
73048
|
+
kind: graphql9.Kind.NAME,
|
|
73049
|
+
value: key
|
|
73050
|
+
}
|
|
73051
|
+
};
|
|
73052
|
+
});
|
|
73053
|
+
};
|
|
73054
|
+
|
|
73055
|
+
// src/codegen/transforms/paginate.ts
|
|
73056
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
73043
73057
|
async function paginate(config2, documents) {
|
|
73044
73058
|
const newDocs = [];
|
|
73045
73059
|
for (const doc of documents) {
|
|
@@ -73072,7 +73086,7 @@ async function paginate(config2, documents) {
|
|
|
73072
73086
|
};
|
|
73073
73087
|
let cursorType = "String";
|
|
73074
73088
|
let paginationPath = [];
|
|
73075
|
-
doc.document =
|
|
73089
|
+
doc.document = graphql10.visit(doc.document, {
|
|
73076
73090
|
Field(node, _, __, ___, ancestors) {
|
|
73077
73091
|
const paginateDirective = node.directives?.find(
|
|
73078
73092
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -73099,7 +73113,7 @@ async function paginate(config2, documents) {
|
|
|
73099
73113
|
flags.offset.enabled = offsetPagination;
|
|
73100
73114
|
flags.limit.enabled = offsetPagination;
|
|
73101
73115
|
paginationPath = ancestors.filter(
|
|
73102
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
73116
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql10.Kind.FIELD
|
|
73103
73117
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
73104
73118
|
return {
|
|
73105
73119
|
...node,
|
|
@@ -73120,7 +73134,7 @@ async function paginate(config2, documents) {
|
|
|
73120
73134
|
refetchUpdate = "prepend" /* prepend */;
|
|
73121
73135
|
}
|
|
73122
73136
|
let fragment = "";
|
|
73123
|
-
doc.document =
|
|
73137
|
+
doc.document = graphql10.visit(doc.document, {
|
|
73124
73138
|
OperationDefinition(node) {
|
|
73125
73139
|
if (node.operation !== "query") {
|
|
73126
73140
|
throw new HoudiniError({
|
|
@@ -73174,9 +73188,9 @@ async function paginate(config2, documents) {
|
|
|
73174
73188
|
directives: [
|
|
73175
73189
|
...node.directives || [],
|
|
73176
73190
|
{
|
|
73177
|
-
kind:
|
|
73191
|
+
kind: graphql10.Kind.DIRECTIVE,
|
|
73178
73192
|
name: {
|
|
73179
|
-
kind:
|
|
73193
|
+
kind: graphql10.Kind.NAME,
|
|
73180
73194
|
value: config2.argumentsDirective
|
|
73181
73195
|
}
|
|
73182
73196
|
}
|
|
@@ -73239,16 +73253,16 @@ async function paginate(config2, documents) {
|
|
|
73239
73253
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
73240
73254
|
const fragmentSpreadSelection = [
|
|
73241
73255
|
{
|
|
73242
|
-
kind:
|
|
73256
|
+
kind: graphql10.Kind.FRAGMENT_SPREAD,
|
|
73243
73257
|
name: {
|
|
73244
|
-
kind:
|
|
73258
|
+
kind: graphql10.Kind.NAME,
|
|
73245
73259
|
value: fragmentName
|
|
73246
73260
|
},
|
|
73247
73261
|
directives: [
|
|
73248
73262
|
{
|
|
73249
|
-
kind:
|
|
73263
|
+
kind: graphql10.Kind.DIRECTIVE,
|
|
73250
73264
|
name: {
|
|
73251
|
-
kind:
|
|
73265
|
+
kind: graphql10.Kind.NAME,
|
|
73252
73266
|
value: config2.withDirective
|
|
73253
73267
|
},
|
|
73254
73268
|
["arguments"]: paginationArgs.map(
|
|
@@ -73276,29 +73290,29 @@ async function paginate(config2, documents) {
|
|
|
73276
73290
|
});
|
|
73277
73291
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
73278
73292
|
const queryDoc = {
|
|
73279
|
-
kind:
|
|
73293
|
+
kind: graphql10.Kind.DOCUMENT,
|
|
73280
73294
|
definitions: [
|
|
73281
73295
|
{
|
|
73282
|
-
kind:
|
|
73296
|
+
kind: graphql10.Kind.OPERATION_DEFINITION,
|
|
73283
73297
|
name: {
|
|
73284
|
-
kind:
|
|
73298
|
+
kind: graphql10.Kind.NAME,
|
|
73285
73299
|
value: refetchQueryName
|
|
73286
73300
|
},
|
|
73287
73301
|
operation: "query",
|
|
73288
73302
|
variableDefinitions: paginationArgs.map(
|
|
73289
73303
|
(arg) => ({
|
|
73290
|
-
kind:
|
|
73304
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73291
73305
|
type: {
|
|
73292
|
-
kind:
|
|
73306
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
73293
73307
|
name: {
|
|
73294
|
-
kind:
|
|
73308
|
+
kind: graphql10.Kind.NAME,
|
|
73295
73309
|
value: arg.type
|
|
73296
73310
|
}
|
|
73297
73311
|
},
|
|
73298
73312
|
variable: {
|
|
73299
|
-
kind:
|
|
73313
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73300
73314
|
name: {
|
|
73301
|
-
kind:
|
|
73315
|
+
kind: graphql10.Kind.NAME,
|
|
73302
73316
|
value: arg.name
|
|
73303
73317
|
}
|
|
73304
73318
|
},
|
|
@@ -73310,12 +73324,12 @@ async function paginate(config2, documents) {
|
|
|
73310
73324
|
).concat(
|
|
73311
73325
|
!nodeQuery ? [] : keys.map(
|
|
73312
73326
|
(key) => ({
|
|
73313
|
-
kind:
|
|
73327
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73314
73328
|
type: key.type,
|
|
73315
73329
|
variable: {
|
|
73316
|
-
kind:
|
|
73330
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73317
73331
|
name: {
|
|
73318
|
-
kind:
|
|
73332
|
+
kind: graphql10.Kind.NAME,
|
|
73319
73333
|
value: key.name
|
|
73320
73334
|
}
|
|
73321
73335
|
}
|
|
@@ -73323,42 +73337,42 @@ async function paginate(config2, documents) {
|
|
|
73323
73337
|
)
|
|
73324
73338
|
),
|
|
73325
73339
|
selectionSet: {
|
|
73326
|
-
kind:
|
|
73340
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73327
73341
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
73328
73342
|
{
|
|
73329
|
-
kind:
|
|
73343
|
+
kind: graphql10.Kind.FIELD,
|
|
73330
73344
|
name: {
|
|
73331
|
-
kind:
|
|
73345
|
+
kind: graphql10.Kind.NAME,
|
|
73332
73346
|
value: typeConfig?.resolve?.queryField || "node"
|
|
73333
73347
|
},
|
|
73334
73348
|
["arguments"]: keys.map((key) => ({
|
|
73335
|
-
kind:
|
|
73349
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73336
73350
|
name: {
|
|
73337
|
-
kind:
|
|
73351
|
+
kind: graphql10.Kind.NAME,
|
|
73338
73352
|
value: key.name
|
|
73339
73353
|
},
|
|
73340
73354
|
value: {
|
|
73341
|
-
kind:
|
|
73355
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73342
73356
|
name: {
|
|
73343
|
-
kind:
|
|
73357
|
+
kind: graphql10.Kind.NAME,
|
|
73344
73358
|
value: key.name
|
|
73345
73359
|
}
|
|
73346
73360
|
}
|
|
73347
73361
|
})),
|
|
73348
73362
|
selectionSet: {
|
|
73349
|
-
kind:
|
|
73363
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73350
73364
|
selections: [
|
|
73351
73365
|
{
|
|
73352
|
-
kind:
|
|
73366
|
+
kind: graphql10.Kind.FIELD,
|
|
73353
73367
|
name: {
|
|
73354
|
-
kind:
|
|
73368
|
+
kind: graphql10.Kind.NAME,
|
|
73355
73369
|
value: "__typename"
|
|
73356
73370
|
}
|
|
73357
73371
|
},
|
|
73358
73372
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
73359
|
-
kind:
|
|
73373
|
+
kind: graphql10.Kind.FIELD,
|
|
73360
73374
|
name: {
|
|
73361
|
-
kind:
|
|
73375
|
+
kind: graphql10.Kind.NAME,
|
|
73362
73376
|
value: key
|
|
73363
73377
|
}
|
|
73364
73378
|
})),
|
|
@@ -73420,15 +73434,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
73420
73434
|
}
|
|
73421
73435
|
function variableAsArgument(name2, variable) {
|
|
73422
73436
|
return {
|
|
73423
|
-
kind:
|
|
73437
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73424
73438
|
name: {
|
|
73425
|
-
kind:
|
|
73439
|
+
kind: graphql10.Kind.NAME,
|
|
73426
73440
|
value: name2
|
|
73427
73441
|
},
|
|
73428
73442
|
value: {
|
|
73429
|
-
kind:
|
|
73443
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73430
73444
|
name: {
|
|
73431
|
-
kind:
|
|
73445
|
+
kind: graphql10.Kind.NAME,
|
|
73432
73446
|
value: variable ?? name2
|
|
73433
73447
|
}
|
|
73434
73448
|
}
|
|
@@ -73436,18 +73450,18 @@ function variableAsArgument(name2, variable) {
|
|
|
73436
73450
|
}
|
|
73437
73451
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
73438
73452
|
return {
|
|
73439
|
-
kind:
|
|
73453
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73440
73454
|
type: {
|
|
73441
|
-
kind:
|
|
73455
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
73442
73456
|
name: {
|
|
73443
|
-
kind:
|
|
73457
|
+
kind: graphql10.Kind.NAME,
|
|
73444
73458
|
value: type
|
|
73445
73459
|
}
|
|
73446
73460
|
},
|
|
73447
73461
|
variable: {
|
|
73448
|
-
kind:
|
|
73462
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73449
73463
|
name: {
|
|
73450
|
-
kind:
|
|
73464
|
+
kind: graphql10.Kind.NAME,
|
|
73451
73465
|
value: variableName ?? name2
|
|
73452
73466
|
}
|
|
73453
73467
|
},
|
|
@@ -73459,9 +73473,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
73459
73473
|
}
|
|
73460
73474
|
function argumentNode(name2, value) {
|
|
73461
73475
|
return {
|
|
73462
|
-
kind:
|
|
73476
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73463
73477
|
name: {
|
|
73464
|
-
kind:
|
|
73478
|
+
kind: graphql10.Kind.NAME,
|
|
73465
73479
|
value: name2
|
|
73466
73480
|
},
|
|
73467
73481
|
value: objectNode(value)
|
|
@@ -73469,16 +73483,16 @@ function argumentNode(name2, value) {
|
|
|
73469
73483
|
}
|
|
73470
73484
|
function objectNode([type, defaultValue]) {
|
|
73471
73485
|
const node = {
|
|
73472
|
-
kind:
|
|
73486
|
+
kind: graphql10.Kind.OBJECT,
|
|
73473
73487
|
fields: [
|
|
73474
73488
|
{
|
|
73475
|
-
kind:
|
|
73489
|
+
kind: graphql10.Kind.OBJECT_FIELD,
|
|
73476
73490
|
name: {
|
|
73477
|
-
kind:
|
|
73491
|
+
kind: graphql10.Kind.NAME,
|
|
73478
73492
|
value: "type"
|
|
73479
73493
|
},
|
|
73480
73494
|
value: {
|
|
73481
|
-
kind:
|
|
73495
|
+
kind: graphql10.Kind.STRING,
|
|
73482
73496
|
value: type
|
|
73483
73497
|
}
|
|
73484
73498
|
}
|
|
@@ -73486,8 +73500,8 @@ function objectNode([type, defaultValue]) {
|
|
|
73486
73500
|
};
|
|
73487
73501
|
if (defaultValue) {
|
|
73488
73502
|
node.fields.push({
|
|
73489
|
-
kind:
|
|
73490
|
-
name: { kind:
|
|
73503
|
+
kind: graphql10.Kind.OBJECT_FIELD,
|
|
73504
|
+
name: { kind: graphql10.Kind.NAME, value: "default" },
|
|
73491
73505
|
value: {
|
|
73492
73506
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
73493
73507
|
value: defaultValue.toString()
|
|
@@ -73498,34 +73512,34 @@ function objectNode([type, defaultValue]) {
|
|
|
73498
73512
|
}
|
|
73499
73513
|
var pageInfoSelection = [
|
|
73500
73514
|
{
|
|
73501
|
-
kind:
|
|
73515
|
+
kind: graphql10.Kind.FIELD,
|
|
73502
73516
|
name: {
|
|
73503
|
-
kind:
|
|
73517
|
+
kind: graphql10.Kind.NAME,
|
|
73504
73518
|
value: "edges"
|
|
73505
73519
|
},
|
|
73506
73520
|
selectionSet: {
|
|
73507
|
-
kind:
|
|
73521
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73508
73522
|
selections: [
|
|
73509
73523
|
{
|
|
73510
|
-
kind:
|
|
73524
|
+
kind: graphql10.Kind.FIELD,
|
|
73511
73525
|
name: {
|
|
73512
|
-
kind:
|
|
73526
|
+
kind: graphql10.Kind.NAME,
|
|
73513
73527
|
value: "cursor"
|
|
73514
73528
|
}
|
|
73515
73529
|
},
|
|
73516
73530
|
{
|
|
73517
|
-
kind:
|
|
73531
|
+
kind: graphql10.Kind.FIELD,
|
|
73518
73532
|
name: {
|
|
73519
|
-
kind:
|
|
73533
|
+
kind: graphql10.Kind.NAME,
|
|
73520
73534
|
value: "node"
|
|
73521
73535
|
},
|
|
73522
73536
|
selectionSet: {
|
|
73523
|
-
kind:
|
|
73537
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73524
73538
|
selections: [
|
|
73525
73539
|
{
|
|
73526
|
-
kind:
|
|
73540
|
+
kind: graphql10.Kind.FIELD,
|
|
73527
73541
|
name: {
|
|
73528
|
-
kind:
|
|
73542
|
+
kind: graphql10.Kind.NAME,
|
|
73529
73543
|
value: "__typename"
|
|
73530
73544
|
}
|
|
73531
73545
|
}
|
|
@@ -73536,39 +73550,39 @@ var pageInfoSelection = [
|
|
|
73536
73550
|
}
|
|
73537
73551
|
},
|
|
73538
73552
|
{
|
|
73539
|
-
kind:
|
|
73553
|
+
kind: graphql10.Kind.FIELD,
|
|
73540
73554
|
name: {
|
|
73541
|
-
kind:
|
|
73555
|
+
kind: graphql10.Kind.NAME,
|
|
73542
73556
|
value: "pageInfo"
|
|
73543
73557
|
},
|
|
73544
73558
|
selectionSet: {
|
|
73545
|
-
kind:
|
|
73559
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73546
73560
|
selections: [
|
|
73547
73561
|
{
|
|
73548
|
-
kind:
|
|
73562
|
+
kind: graphql10.Kind.FIELD,
|
|
73549
73563
|
name: {
|
|
73550
|
-
kind:
|
|
73564
|
+
kind: graphql10.Kind.NAME,
|
|
73551
73565
|
value: "hasPreviousPage"
|
|
73552
73566
|
}
|
|
73553
73567
|
},
|
|
73554
73568
|
{
|
|
73555
|
-
kind:
|
|
73569
|
+
kind: graphql10.Kind.FIELD,
|
|
73556
73570
|
name: {
|
|
73557
|
-
kind:
|
|
73571
|
+
kind: graphql10.Kind.NAME,
|
|
73558
73572
|
value: "hasNextPage"
|
|
73559
73573
|
}
|
|
73560
73574
|
},
|
|
73561
73575
|
{
|
|
73562
|
-
kind:
|
|
73576
|
+
kind: graphql10.Kind.FIELD,
|
|
73563
73577
|
name: {
|
|
73564
|
-
kind:
|
|
73578
|
+
kind: graphql10.Kind.NAME,
|
|
73565
73579
|
value: "startCursor"
|
|
73566
73580
|
}
|
|
73567
73581
|
},
|
|
73568
73582
|
{
|
|
73569
|
-
kind:
|
|
73583
|
+
kind: graphql10.Kind.FIELD,
|
|
73570
73584
|
name: {
|
|
73571
|
-
kind:
|
|
73585
|
+
kind: graphql10.Kind.NAME,
|
|
73572
73586
|
value: "endCursor"
|
|
73573
73587
|
}
|
|
73574
73588
|
}
|
|
@@ -73582,15 +73596,15 @@ async function addListFragments(config2, documents) {
|
|
|
73582
73596
|
const lists = {};
|
|
73583
73597
|
const errors = [];
|
|
73584
73598
|
for (const doc of documents) {
|
|
73585
|
-
doc.document =
|
|
73599
|
+
doc.document = graphql11.visit(doc.document, {
|
|
73586
73600
|
Directive(node, key, parent, path2, ancestors) {
|
|
73587
73601
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
73588
73602
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
73589
73603
|
let error = {
|
|
73590
|
-
...new
|
|
73604
|
+
...new graphql11.GraphQLError(
|
|
73591
73605
|
"",
|
|
73592
73606
|
node,
|
|
73593
|
-
new
|
|
73607
|
+
new graphql11.Source(""),
|
|
73594
73608
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
73595
73609
|
path2
|
|
73596
73610
|
),
|
|
@@ -73642,7 +73656,7 @@ async function addListFragments(config2, documents) {
|
|
|
73642
73656
|
{
|
|
73643
73657
|
kind: "Argument",
|
|
73644
73658
|
name: {
|
|
73645
|
-
kind:
|
|
73659
|
+
kind: graphql11.Kind.NAME,
|
|
73646
73660
|
value: "connection"
|
|
73647
73661
|
},
|
|
73648
73662
|
value: {
|
|
@@ -73689,10 +73703,13 @@ async function addListFragments(config2, documents) {
|
|
|
73689
73703
|
if (errors.length > 0) {
|
|
73690
73704
|
throw errors;
|
|
73691
73705
|
}
|
|
73692
|
-
const
|
|
73706
|
+
const validDeletes = [
|
|
73693
73707
|
...new Set(
|
|
73694
73708
|
Object.values(lists).map(({ type }) => {
|
|
73695
|
-
if (!(type instanceof
|
|
73709
|
+
if (!(type instanceof graphql11.GraphQLObjectType)) {
|
|
73710
|
+
return "";
|
|
73711
|
+
}
|
|
73712
|
+
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
73696
73713
|
return "";
|
|
73697
73714
|
}
|
|
73698
73715
|
return type.name;
|
|
@@ -73703,7 +73720,7 @@ async function addListFragments(config2, documents) {
|
|
|
73703
73720
|
return;
|
|
73704
73721
|
}
|
|
73705
73722
|
const generatedDoc = {
|
|
73706
|
-
kind:
|
|
73723
|
+
kind: graphql11.Kind.DOCUMENT,
|
|
73707
73724
|
definitions: Object.entries(lists).flatMap(
|
|
73708
73725
|
([name2, { selection: selection2, type }]) => {
|
|
73709
73726
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -73711,35 +73728,29 @@ async function addListFragments(config2, documents) {
|
|
|
73711
73728
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
73712
73729
|
}
|
|
73713
73730
|
const fragmentSelection = {
|
|
73714
|
-
kind:
|
|
73731
|
+
kind: graphql11.Kind.SELECTION_SET,
|
|
73715
73732
|
selections: [...selection2.selections]
|
|
73716
73733
|
};
|
|
73717
73734
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
73718
|
-
(field) => field.kind === "Field" && field.name.value
|
|
73735
|
+
(field) => field.kind === "Field" && config2.keyFieldsForType(type.name).includes(field.name.value)
|
|
73719
73736
|
)) {
|
|
73720
73737
|
fragmentSelection.selections = [
|
|
73721
73738
|
...fragmentSelection.selections,
|
|
73722
|
-
|
|
73723
|
-
kind: graphql10.Kind.FIELD,
|
|
73724
|
-
name: {
|
|
73725
|
-
kind: graphql10.Kind.NAME,
|
|
73726
|
-
value: "id"
|
|
73727
|
-
}
|
|
73728
|
-
}
|
|
73739
|
+
...objectIdentificationSelection(config2, type)
|
|
73729
73740
|
];
|
|
73730
73741
|
}
|
|
73731
73742
|
return [
|
|
73732
73743
|
{
|
|
73733
73744
|
name: {
|
|
73734
73745
|
value: config2.listInsertFragment(name2),
|
|
73735
|
-
kind:
|
|
73746
|
+
kind: graphql11.Kind.NAME
|
|
73736
73747
|
},
|
|
73737
|
-
kind:
|
|
73748
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73738
73749
|
selectionSet: fragmentSelection,
|
|
73739
73750
|
typeCondition: {
|
|
73740
|
-
kind:
|
|
73751
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73741
73752
|
name: {
|
|
73742
|
-
kind:
|
|
73753
|
+
kind: graphql11.Kind.NAME,
|
|
73743
73754
|
value: type.name
|
|
73744
73755
|
}
|
|
73745
73756
|
}
|
|
@@ -73747,52 +73758,32 @@ async function addListFragments(config2, documents) {
|
|
|
73747
73758
|
{
|
|
73748
73759
|
name: {
|
|
73749
73760
|
value: config2.listToggleFragment(name2),
|
|
73750
|
-
kind:
|
|
73751
|
-
},
|
|
73752
|
-
kind: graphql10.Kind.FRAGMENT_DEFINITION,
|
|
73753
|
-
selectionSet: {
|
|
73754
|
-
...fragmentSelection,
|
|
73755
|
-
selections: [
|
|
73756
|
-
...fragmentSelection.selections,
|
|
73757
|
-
{
|
|
73758
|
-
kind: graphql10.Kind.FIELD,
|
|
73759
|
-
name: {
|
|
73760
|
-
kind: graphql10.Kind.NAME,
|
|
73761
|
-
value: "id"
|
|
73762
|
-
}
|
|
73763
|
-
}
|
|
73764
|
-
]
|
|
73761
|
+
kind: graphql11.Kind.NAME
|
|
73765
73762
|
},
|
|
73763
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73764
|
+
selectionSet: fragmentSelection,
|
|
73766
73765
|
typeCondition: {
|
|
73767
|
-
kind:
|
|
73766
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73768
73767
|
name: {
|
|
73769
|
-
kind:
|
|
73768
|
+
kind: graphql11.Kind.NAME,
|
|
73770
73769
|
value: type.name
|
|
73771
73770
|
}
|
|
73772
73771
|
}
|
|
73773
73772
|
},
|
|
73774
73773
|
{
|
|
73775
|
-
kind:
|
|
73774
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73776
73775
|
name: {
|
|
73777
73776
|
value: config2.listRemoveFragment(name2),
|
|
73778
|
-
kind:
|
|
73777
|
+
kind: graphql11.Kind.NAME
|
|
73779
73778
|
},
|
|
73780
73779
|
selectionSet: {
|
|
73781
|
-
kind:
|
|
73782
|
-
selections: [
|
|
73783
|
-
{
|
|
73784
|
-
kind: graphql10.Kind.FIELD,
|
|
73785
|
-
name: {
|
|
73786
|
-
kind: graphql10.Kind.NAME,
|
|
73787
|
-
value: "id"
|
|
73788
|
-
}
|
|
73789
|
-
}
|
|
73790
|
-
]
|
|
73780
|
+
kind: graphql11.Kind.SELECTION_SET,
|
|
73781
|
+
selections: [...objectIdentificationSelection(config2, type)]
|
|
73791
73782
|
},
|
|
73792
73783
|
typeCondition: {
|
|
73793
|
-
kind:
|
|
73784
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73794
73785
|
name: {
|
|
73795
|
-
kind:
|
|
73786
|
+
kind: graphql11.Kind.NAME,
|
|
73796
73787
|
value: type.name
|
|
73797
73788
|
}
|
|
73798
73789
|
}
|
|
@@ -73800,15 +73791,15 @@ async function addListFragments(config2, documents) {
|
|
|
73800
73791
|
];
|
|
73801
73792
|
}
|
|
73802
73793
|
).concat(
|
|
73803
|
-
...
|
|
73804
|
-
kind:
|
|
73794
|
+
...validDeletes.map((typeName) => ({
|
|
73795
|
+
kind: graphql11.Kind.DIRECTIVE_DEFINITION,
|
|
73805
73796
|
name: {
|
|
73806
|
-
kind:
|
|
73797
|
+
kind: graphql11.Kind.NAME,
|
|
73807
73798
|
value: config2.listDeleteDirective(typeName)
|
|
73808
73799
|
},
|
|
73809
73800
|
locations: [
|
|
73810
73801
|
{
|
|
73811
|
-
kind:
|
|
73802
|
+
kind: graphql11.Kind.NAME,
|
|
73812
73803
|
value: "FIELD"
|
|
73813
73804
|
}
|
|
73814
73805
|
],
|
|
@@ -73816,8 +73807,8 @@ async function addListFragments(config2, documents) {
|
|
|
73816
73807
|
}))
|
|
73817
73808
|
)
|
|
73818
73809
|
};
|
|
73819
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
73820
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
73810
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql11.print).join("\n\n");
|
|
73811
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql11.print).join("\n\n");
|
|
73821
73812
|
documents.push({
|
|
73822
73813
|
name: "generated::lists",
|
|
73823
73814
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -73902,11 +73893,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
73902
73893
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
73903
73894
|
|
|
73904
73895
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
73905
|
-
var
|
|
73896
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
73906
73897
|
function fieldKey(config2, field) {
|
|
73907
73898
|
const attributeName = field.alias?.value || field.name.value;
|
|
73908
|
-
const printed =
|
|
73909
|
-
const secondParse =
|
|
73899
|
+
const printed = graphql12.print(field);
|
|
73900
|
+
const secondParse = graphql12.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
73910
73901
|
const paginated = !!field.directives?.find(
|
|
73911
73902
|
(directive) => directive.name.value === config2.paginateDirective
|
|
73912
73903
|
);
|
|
@@ -73999,8 +73990,8 @@ function selection({
|
|
|
73999
73990
|
const typeConditionName = field.typeCondition.name.value;
|
|
74000
73991
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
74001
73992
|
const possibleTypes = [];
|
|
74002
|
-
if (!
|
|
74003
|
-
} else if (
|
|
73993
|
+
if (!graphql13.isAbstractType(typeCondition)) {
|
|
73994
|
+
} else if (graphql13.isAbstractType(parentType)) {
|
|
74004
73995
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
74005
73996
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
74006
73997
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -74048,7 +74039,7 @@ function selection({
|
|
|
74048
74039
|
} else {
|
|
74049
74040
|
let typeRef = type.getFields()[field.name.value].type;
|
|
74050
74041
|
fieldType = getRootType(typeRef);
|
|
74051
|
-
nullable = !
|
|
74042
|
+
nullable = !graphql13.isNonNullType(typeRef);
|
|
74052
74043
|
}
|
|
74053
74044
|
const typeName = fieldType.toString();
|
|
74054
74045
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -74113,7 +74104,7 @@ function selection({
|
|
|
74113
74104
|
{}
|
|
74114
74105
|
);
|
|
74115
74106
|
}
|
|
74116
|
-
if (
|
|
74107
|
+
if (graphql13.isInterfaceType(fieldType) || graphql13.isUnionType(fieldType)) {
|
|
74117
74108
|
fieldObj.abstract = true;
|
|
74118
74109
|
}
|
|
74119
74110
|
object.fields = {
|
|
@@ -74170,7 +74161,7 @@ function artifactGenerator(stats) {
|
|
|
74170
74161
|
return async function(config2, docs) {
|
|
74171
74162
|
const filterTypes = {};
|
|
74172
74163
|
for (const doc of docs) {
|
|
74173
|
-
|
|
74164
|
+
graphql14.visit(doc.document, {
|
|
74174
74165
|
Directive(node, _, __, ___, ancestors) {
|
|
74175
74166
|
if (node.name.value !== config2.listDirective) {
|
|
74176
74167
|
return;
|
|
@@ -74229,7 +74220,7 @@ function artifactGenerator(stats) {
|
|
|
74229
74220
|
return;
|
|
74230
74221
|
}
|
|
74231
74222
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
74232
|
-
let documentWithoutInternalDirectives =
|
|
74223
|
+
let documentWithoutInternalDirectives = graphql14.visit(document, {
|
|
74233
74224
|
Directive(node) {
|
|
74234
74225
|
if (config2.isInternalDirective(node)) {
|
|
74235
74226
|
return null;
|
|
@@ -74242,7 +74233,7 @@ function artifactGenerator(stats) {
|
|
|
74242
74233
|
}
|
|
74243
74234
|
}
|
|
74244
74235
|
});
|
|
74245
|
-
let documentWithoutExtraVariables =
|
|
74236
|
+
let documentWithoutExtraVariables = graphql14.visit(
|
|
74246
74237
|
documentWithoutInternalDirectives,
|
|
74247
74238
|
{
|
|
74248
74239
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -74253,13 +74244,13 @@ function artifactGenerator(stats) {
|
|
|
74253
74244
|
}
|
|
74254
74245
|
}
|
|
74255
74246
|
);
|
|
74256
|
-
let rawString =
|
|
74247
|
+
let rawString = graphql14.print(documentWithoutExtraVariables);
|
|
74257
74248
|
let docKind = doc.kind;
|
|
74258
74249
|
const operations = document.definitions.filter(
|
|
74259
|
-
({ kind }) => kind ===
|
|
74250
|
+
({ kind }) => kind === graphql14.Kind.OPERATION_DEFINITION
|
|
74260
74251
|
);
|
|
74261
74252
|
const fragments = document.definitions.filter(
|
|
74262
|
-
({ kind }) => kind ===
|
|
74253
|
+
({ kind }) => kind === graphql14.Kind.FRAGMENT_DEFINITION
|
|
74263
74254
|
);
|
|
74264
74255
|
let rootType = "";
|
|
74265
74256
|
let selectionSet;
|
|
@@ -74446,15 +74437,15 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
74446
74437
|
var recast10 = __toESM(require_main2(), 1);
|
|
74447
74438
|
|
|
74448
74439
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
74449
|
-
var
|
|
74440
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
74450
74441
|
var recast8 = __toESM(require_main2(), 1);
|
|
74451
74442
|
|
|
74452
74443
|
// src/codegen/generators/typescript/typeReference.ts
|
|
74453
|
-
var
|
|
74444
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
74454
74445
|
var recast7 = __toESM(require_main2(), 1);
|
|
74455
74446
|
|
|
74456
74447
|
// src/codegen/generators/typescript/types.ts
|
|
74457
|
-
var
|
|
74448
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
74458
74449
|
var recast6 = __toESM(require_main2(), 1);
|
|
74459
74450
|
var AST6 = recast6.types.builders;
|
|
74460
74451
|
function readonlyProperty(prop, enable = true) {
|
|
@@ -74488,7 +74479,7 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
74488
74479
|
return AST6.tsStringKeyword();
|
|
74489
74480
|
}
|
|
74490
74481
|
default: {
|
|
74491
|
-
if (
|
|
74482
|
+
if (graphql15.isNonNullType(target) && "ofType" in target) {
|
|
74492
74483
|
return scalarPropertyValue(
|
|
74493
74484
|
config2,
|
|
74494
74485
|
missingScalars,
|
|
@@ -74509,7 +74500,7 @@ var AST7 = recast7.types.builders;
|
|
|
74509
74500
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
74510
74501
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
74511
74502
|
let result;
|
|
74512
|
-
if (
|
|
74503
|
+
if (graphql16.isScalarType(type)) {
|
|
74513
74504
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
74514
74505
|
} else {
|
|
74515
74506
|
result = AST7.tsTypeReference(AST7.identifier(type.name));
|
|
@@ -74530,17 +74521,17 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
74530
74521
|
var AST8 = recast8.types.builders;
|
|
74531
74522
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
74532
74523
|
const { type } = unwrapType(config2, rootType);
|
|
74533
|
-
if (
|
|
74524
|
+
if (graphql17.isScalarType(type)) {
|
|
74534
74525
|
return;
|
|
74535
74526
|
}
|
|
74536
74527
|
if (visitedTypes.has(type.name)) {
|
|
74537
74528
|
return;
|
|
74538
74529
|
}
|
|
74539
|
-
if (
|
|
74530
|
+
if (graphql17.isUnionType(type)) {
|
|
74540
74531
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
74541
74532
|
}
|
|
74542
74533
|
visitedTypes.add(type.name);
|
|
74543
|
-
if (
|
|
74534
|
+
if (graphql17.isEnumType(type)) {
|
|
74544
74535
|
ensureImports({
|
|
74545
74536
|
config: config2,
|
|
74546
74537
|
body,
|
|
@@ -74557,7 +74548,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
74557
74548
|
AST8.tsPropertySignature(
|
|
74558
74549
|
AST8.identifier(field.name),
|
|
74559
74550
|
AST8.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
74560
|
-
|
|
74551
|
+
graphql17.isNullableType(field.type)
|
|
74561
74552
|
)
|
|
74562
74553
|
);
|
|
74563
74554
|
}
|
|
@@ -74565,7 +74556,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
74565
74556
|
}
|
|
74566
74557
|
|
|
74567
74558
|
// src/codegen/generators/typescript/inlineType.ts
|
|
74568
|
-
var
|
|
74559
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
74569
74560
|
var recast9 = __toESM(require_main2(), 1);
|
|
74570
74561
|
var AST9 = recast9.types.builders;
|
|
74571
74562
|
var fragmentKey = "$fragments";
|
|
@@ -74584,9 +74575,9 @@ function inlineType({
|
|
|
74584
74575
|
}) {
|
|
74585
74576
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
74586
74577
|
let result;
|
|
74587
|
-
if (
|
|
74578
|
+
if (graphql18.isScalarType(type)) {
|
|
74588
74579
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
74589
|
-
} else if (
|
|
74580
|
+
} else if (graphql18.isEnumType(type)) {
|
|
74590
74581
|
if (!visitedTypes.has(type.name)) {
|
|
74591
74582
|
ensureImports({
|
|
74592
74583
|
config: config2,
|
|
@@ -74604,11 +74595,11 @@ function inlineType({
|
|
|
74604
74595
|
for (const selection2 of selections) {
|
|
74605
74596
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
74606
74597
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
74607
|
-
if (!
|
|
74598
|
+
if (!graphql18.isInterfaceType(type) && !graphql18.isUnionType(type)) {
|
|
74608
74599
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
74609
74600
|
continue;
|
|
74610
74601
|
}
|
|
74611
|
-
if (!
|
|
74602
|
+
if (!graphql18.isInterfaceType(fragmentType) && !graphql18.isUnionType(fragmentType)) {
|
|
74612
74603
|
if (!inlineFragments[fragmentType.name]) {
|
|
74613
74604
|
inlineFragments[fragmentType.name] = [];
|
|
74614
74605
|
}
|
|
@@ -74728,7 +74719,7 @@ function inlineType({
|
|
|
74728
74719
|
}
|
|
74729
74720
|
}
|
|
74730
74721
|
}
|
|
74731
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
74722
|
+
if (objectType.type === "TSTypeLiteral" && !graphql18.isInterfaceType(fragmentRootType) && !graphql18.isUnionType(fragmentRootType)) {
|
|
74732
74723
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
74733
74724
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
74734
74725
|
);
|
|
@@ -74795,7 +74786,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
74795
74786
|
},
|
|
74796
74787
|
type: schema.getType("String")
|
|
74797
74788
|
};
|
|
74798
|
-
} else if (
|
|
74789
|
+
} else if (graphql18.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
74799
74790
|
fields = rootType.ofType.getFields();
|
|
74800
74791
|
} else {
|
|
74801
74792
|
fields = rootType.getFields();
|
|
@@ -74807,7 +74798,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
74807
74798
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
74808
74799
|
});
|
|
74809
74800
|
}
|
|
74810
|
-
const fieldType =
|
|
74801
|
+
const fieldType = graphql18.getNamedType(field.type);
|
|
74811
74802
|
if (!fieldType) {
|
|
74812
74803
|
throw new HoudiniError({
|
|
74813
74804
|
filepath,
|
|
@@ -75127,7 +75118,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
75127
75118
|
}
|
|
75128
75119
|
|
|
75129
75120
|
// src/codegen/generators/persistedQueries/index.ts
|
|
75130
|
-
var
|
|
75121
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
75131
75122
|
async function persistOutputGenerator(config2, docs) {
|
|
75132
75123
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
75133
75124
|
return;
|
|
@@ -75139,8 +75130,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75139
75130
|
if (!generateArtifact) {
|
|
75140
75131
|
return acc;
|
|
75141
75132
|
}
|
|
75142
|
-
let rawString =
|
|
75143
|
-
|
|
75133
|
+
let rawString = graphql19.print(
|
|
75134
|
+
graphql19.visit(document, {
|
|
75144
75135
|
Directive(node) {
|
|
75145
75136
|
if (config2.isInternalDirective(node)) {
|
|
75146
75137
|
return null;
|
|
@@ -75149,7 +75140,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75149
75140
|
})
|
|
75150
75141
|
);
|
|
75151
75142
|
const operations = document.definitions.filter(
|
|
75152
|
-
({ kind }) => kind ===
|
|
75143
|
+
({ kind }) => kind === graphql19.Kind.OPERATION_DEFINITION
|
|
75153
75144
|
);
|
|
75154
75145
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
75155
75146
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -75162,11 +75153,11 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75162
75153
|
}
|
|
75163
75154
|
|
|
75164
75155
|
// src/codegen/generators/definitions/enums.ts
|
|
75165
|
-
var
|
|
75156
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
75166
75157
|
var recast11 = __toESM(require_main2(), 1);
|
|
75167
75158
|
var AST11 = recast11.types.builders;
|
|
75168
75159
|
async function definitionsGenerator(config2) {
|
|
75169
|
-
const enums =
|
|
75160
|
+
const enums = graphql20.parse(graphql20.printSchema(config2.schema)).definitions.filter(
|
|
75170
75161
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
75171
75162
|
).filter((def) => !config2.isInternalEnum(def));
|
|
75172
75163
|
const runtimeDefinitions = recast11.print(
|
|
@@ -75339,7 +75330,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
75339
75330
|
}
|
|
75340
75331
|
|
|
75341
75332
|
// src/codegen/transforms/schema.ts
|
|
75342
|
-
var
|
|
75333
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
75343
75334
|
async function graphqlExtensions(config2, documents) {
|
|
75344
75335
|
const internalSchema = `
|
|
75345
75336
|
enum CachePolicy {
|
|
@@ -75417,19 +75408,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
75417
75408
|
"""
|
|
75418
75409
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
75419
75410
|
`;
|
|
75420
|
-
let currentSchema =
|
|
75411
|
+
let currentSchema = graphql22.printSchema(config2.schema);
|
|
75421
75412
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
75422
75413
|
currentSchema += internalSchema;
|
|
75423
75414
|
}
|
|
75424
75415
|
config2.newSchema += internalSchema;
|
|
75425
|
-
config2.schema =
|
|
75416
|
+
config2.schema = graphql22.buildSchema(currentSchema);
|
|
75426
75417
|
}
|
|
75427
75418
|
|
|
75428
75419
|
// src/codegen/transforms/typename.ts
|
|
75429
|
-
var
|
|
75420
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
75430
75421
|
async function addTypename(config2, documents) {
|
|
75431
75422
|
for (const doc of documents) {
|
|
75432
|
-
doc.document =
|
|
75423
|
+
doc.document = graphql23.visit(doc.document, {
|
|
75433
75424
|
Field(node, key, parent, path2, ancestors) {
|
|
75434
75425
|
if (!node.selectionSet) {
|
|
75435
75426
|
return;
|
|
@@ -75441,7 +75432,7 @@ async function addTypename(config2, documents) {
|
|
|
75441
75432
|
);
|
|
75442
75433
|
const field = type.getFields()[node.name.value];
|
|
75443
75434
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75444
|
-
if (
|
|
75435
|
+
if (graphql23.isInterfaceType(fieldType) || graphql23.isUnionType(fieldType)) {
|
|
75445
75436
|
return {
|
|
75446
75437
|
...node,
|
|
75447
75438
|
selectionSet: {
|
|
@@ -75449,9 +75440,9 @@ async function addTypename(config2, documents) {
|
|
|
75449
75440
|
selections: [
|
|
75450
75441
|
...node.selectionSet.selections,
|
|
75451
75442
|
{
|
|
75452
|
-
kind:
|
|
75443
|
+
kind: graphql23.Kind.FIELD,
|
|
75453
75444
|
name: {
|
|
75454
|
-
kind:
|
|
75445
|
+
kind: graphql23.Kind.NAME,
|
|
75455
75446
|
value: "__typename"
|
|
75456
75447
|
}
|
|
75457
75448
|
}
|
|
@@ -75465,10 +75456,10 @@ async function addTypename(config2, documents) {
|
|
|
75465
75456
|
}
|
|
75466
75457
|
|
|
75467
75458
|
// src/codegen/transforms/addID.ts
|
|
75468
|
-
var
|
|
75459
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
75469
75460
|
async function addID(config2, documents) {
|
|
75470
75461
|
for (const doc of documents) {
|
|
75471
|
-
doc.document =
|
|
75462
|
+
doc.document = graphql24.visit(doc.document, {
|
|
75472
75463
|
Field(node, key, parent, path2, ancestors) {
|
|
75473
75464
|
if (!node.selectionSet) {
|
|
75474
75465
|
return;
|
|
@@ -75481,7 +75472,7 @@ async function addID(config2, documents) {
|
|
|
75481
75472
|
const field = type.getFields()[node.name.value];
|
|
75482
75473
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75483
75474
|
if (node.selectionSet?.selections.length > 0) {
|
|
75484
|
-
if (!
|
|
75475
|
+
if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
|
|
75485
75476
|
return;
|
|
75486
75477
|
}
|
|
75487
75478
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -75496,9 +75487,9 @@ async function addID(config2, documents) {
|
|
|
75496
75487
|
continue;
|
|
75497
75488
|
}
|
|
75498
75489
|
selections.push({
|
|
75499
|
-
kind:
|
|
75490
|
+
kind: graphql24.Kind.FIELD,
|
|
75500
75491
|
name: {
|
|
75501
|
-
kind:
|
|
75492
|
+
kind: graphql24.Kind.NAME,
|
|
75502
75493
|
value: keyField
|
|
75503
75494
|
}
|
|
75504
75495
|
});
|
|
@@ -75517,8 +75508,8 @@ async function addID(config2, documents) {
|
|
|
75517
75508
|
}
|
|
75518
75509
|
|
|
75519
75510
|
// src/codegen/transforms/fragmentVariables.ts
|
|
75520
|
-
var
|
|
75521
|
-
var GraphqlKinds2 =
|
|
75511
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
75512
|
+
var GraphqlKinds2 = graphql25.Kind;
|
|
75522
75513
|
async function fragmentVariables(config2, documents) {
|
|
75523
75514
|
const fragments = collectFragments(config2, documents);
|
|
75524
75515
|
const generatedFragments = {};
|
|
@@ -75541,7 +75532,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
75541
75532
|
});
|
|
75542
75533
|
}
|
|
75543
75534
|
const doc = {
|
|
75544
|
-
kind:
|
|
75535
|
+
kind: graphql25.Kind.DOCUMENT,
|
|
75545
75536
|
definitions: Object.values(generatedFragments)
|
|
75546
75537
|
};
|
|
75547
75538
|
documents.push({
|
|
@@ -75577,7 +75568,7 @@ function inlineFragmentArgs({
|
|
|
75577
75568
|
filepath,
|
|
75578
75569
|
document
|
|
75579
75570
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
75580
|
-
const result =
|
|
75571
|
+
const result = graphql25.visit(document, {
|
|
75581
75572
|
FragmentSpread(node) {
|
|
75582
75573
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
75583
75574
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -75665,7 +75656,7 @@ function inlineFragmentArgs({
|
|
|
75665
75656
|
});
|
|
75666
75657
|
if (newName) {
|
|
75667
75658
|
result.name = {
|
|
75668
|
-
kind:
|
|
75659
|
+
kind: graphql25.Kind.NAME,
|
|
75669
75660
|
value: newName
|
|
75670
75661
|
};
|
|
75671
75662
|
}
|
|
@@ -75777,7 +75768,7 @@ function operationScope(operation) {
|
|
|
75777
75768
|
}
|
|
75778
75769
|
|
|
75779
75770
|
// src/codegen/validators/typeCheck.ts
|
|
75780
|
-
var
|
|
75771
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
75781
75772
|
async function typeCheck(config2, docs) {
|
|
75782
75773
|
const errors = [];
|
|
75783
75774
|
const freeLists = [];
|
|
@@ -75785,11 +75776,11 @@ async function typeCheck(config2, docs) {
|
|
|
75785
75776
|
const listTypes = [];
|
|
75786
75777
|
const fragments = {};
|
|
75787
75778
|
for (const { document: parsed, filename } of docs) {
|
|
75788
|
-
|
|
75789
|
-
[
|
|
75779
|
+
graphql26.visit(parsed, {
|
|
75780
|
+
[graphql26.Kind.FRAGMENT_DEFINITION](definition) {
|
|
75790
75781
|
fragments[definition.name.value] = definition;
|
|
75791
75782
|
},
|
|
75792
|
-
[
|
|
75783
|
+
[graphql26.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
75793
75784
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
75794
75785
|
return;
|
|
75795
75786
|
}
|
|
@@ -75835,14 +75826,14 @@ async function typeCheck(config2, docs) {
|
|
|
75835
75826
|
);
|
|
75836
75827
|
return;
|
|
75837
75828
|
}
|
|
75838
|
-
if (
|
|
75829
|
+
if (graphql26.isListType(rootType) || graphql26.isNonNullType(rootType) && graphql26.isListType(rootType.ofType)) {
|
|
75839
75830
|
needsParent = true;
|
|
75840
75831
|
break;
|
|
75841
75832
|
}
|
|
75842
|
-
if (
|
|
75833
|
+
if (graphql26.isNonNullType(rootType) && "ofType" in rootType) {
|
|
75843
75834
|
rootType = rootType.ofType;
|
|
75844
75835
|
}
|
|
75845
|
-
if (
|
|
75836
|
+
if (graphql26.isScalarType(rootType)) {
|
|
75846
75837
|
break;
|
|
75847
75838
|
}
|
|
75848
75839
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -75898,7 +75889,7 @@ async function typeCheck(config2, docs) {
|
|
|
75898
75889
|
);
|
|
75899
75890
|
const targetField = ancestors[ancestors.length - 1];
|
|
75900
75891
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
75901
|
-
const { type, error } = connectionSelection(
|
|
75892
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
75902
75893
|
config2,
|
|
75903
75894
|
targetFieldDefinition,
|
|
75904
75895
|
parentTypeFromAncestors(
|
|
@@ -75908,10 +75899,19 @@ async function typeCheck(config2, docs) {
|
|
|
75908
75899
|
),
|
|
75909
75900
|
targetField.selectionSet
|
|
75910
75901
|
);
|
|
75902
|
+
if (errorConnectionSelection && directive.name.value === config2.paginateDirective) {
|
|
75903
|
+
errors.push(
|
|
75904
|
+
new HoudiniError({
|
|
75905
|
+
filepath: filename,
|
|
75906
|
+
message: errorConnectionSelection,
|
|
75907
|
+
description: errorConnectionSelection
|
|
75908
|
+
})
|
|
75909
|
+
);
|
|
75910
|
+
}
|
|
75911
75911
|
let targetTypes = [type];
|
|
75912
|
-
if (
|
|
75912
|
+
if (graphql26.isUnionType(type)) {
|
|
75913
75913
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
75914
|
-
} else if (
|
|
75914
|
+
} else if (graphql26.isInterfaceType(type)) {
|
|
75915
75915
|
try {
|
|
75916
75916
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
75917
75917
|
if (!type.getFields()[key]) {
|
|
@@ -75925,23 +75925,16 @@ async function typeCheck(config2, docs) {
|
|
|
75925
75925
|
for (const targetType of targetTypes) {
|
|
75926
75926
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
75927
75927
|
if (missingIDFields.length > 0) {
|
|
75928
|
-
|
|
75929
|
-
|
|
75930
|
-
|
|
75931
|
-
|
|
75932
|
-
|
|
75933
|
-
|
|
75934
|
-
|
|
75935
|
-
|
|
75936
|
-
|
|
75937
|
-
|
|
75938
|
-
filepath: filename,
|
|
75939
|
-
message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
75940
|
-
", "
|
|
75941
|
-
)}.`
|
|
75942
|
-
})
|
|
75943
|
-
);
|
|
75944
|
-
}
|
|
75928
|
+
const message = `@${config2.listDirective} on ${logGreen(
|
|
75929
|
+
targetType.name
|
|
75930
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
75931
|
+
errors.push(
|
|
75932
|
+
new HoudiniError({
|
|
75933
|
+
filepath: filename,
|
|
75934
|
+
message,
|
|
75935
|
+
description: message
|
|
75936
|
+
})
|
|
75937
|
+
);
|
|
75945
75938
|
return;
|
|
75946
75939
|
}
|
|
75947
75940
|
}
|
|
@@ -75956,13 +75949,13 @@ async function typeCheck(config2, docs) {
|
|
|
75956
75949
|
if (errors.length > 0) {
|
|
75957
75950
|
throw errors;
|
|
75958
75951
|
}
|
|
75959
|
-
const rules = (filepath) => [...
|
|
75952
|
+
const rules = (filepath) => [...graphql26.specifiedRules].filter(
|
|
75960
75953
|
(rule) => ![
|
|
75961
|
-
|
|
75962
|
-
|
|
75963
|
-
|
|
75964
|
-
|
|
75965
|
-
|
|
75954
|
+
graphql26.NoUnusedFragmentsRule,
|
|
75955
|
+
graphql26.KnownFragmentNamesRule,
|
|
75956
|
+
graphql26.ExecutableDefinitionsRule,
|
|
75957
|
+
graphql26.KnownDirectivesRule,
|
|
75958
|
+
graphql26.KnownArgumentNamesRule
|
|
75966
75959
|
].includes(rule)
|
|
75967
75960
|
).concat(
|
|
75968
75961
|
validateLists({
|
|
@@ -75981,7 +75974,7 @@ async function typeCheck(config2, docs) {
|
|
|
75981
75974
|
noUnusedFragmentArguments(config2)
|
|
75982
75975
|
);
|
|
75983
75976
|
for (const { filename, document: parsed } of docs) {
|
|
75984
|
-
for (const error of
|
|
75977
|
+
for (const error of graphql26.validate(config2.schema, parsed, rules(filename))) {
|
|
75985
75978
|
errors.push(
|
|
75986
75979
|
new HoudiniError({
|
|
75987
75980
|
filepath: filename,
|
|
@@ -76007,7 +76000,7 @@ var validateLists = ({
|
|
|
76007
76000
|
if (!config2.isListFragment(node.name.value)) {
|
|
76008
76001
|
if (!fragments[node.name.value]) {
|
|
76009
76002
|
ctx.reportError(
|
|
76010
|
-
new
|
|
76003
|
+
new graphql26.GraphQLError(
|
|
76011
76004
|
"Encountered unknown fragment: " + node.name.value
|
|
76012
76005
|
)
|
|
76013
76006
|
);
|
|
@@ -76017,7 +76010,7 @@ var validateLists = ({
|
|
|
76017
76010
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
76018
76011
|
if (!lists.includes(listName)) {
|
|
76019
76012
|
ctx.reportError(
|
|
76020
|
-
new
|
|
76013
|
+
new graphql26.GraphQLError(
|
|
76021
76014
|
"Encountered fragment referencing unknown list: " + listName
|
|
76022
76015
|
)
|
|
76023
76016
|
);
|
|
@@ -76042,7 +76035,7 @@ var validateLists = ({
|
|
|
76042
76035
|
);
|
|
76043
76036
|
if (parentArg) {
|
|
76044
76037
|
ctx.reportError(
|
|
76045
|
-
new
|
|
76038
|
+
new graphql26.GraphQLError(
|
|
76046
76039
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
76047
76040
|
)
|
|
76048
76041
|
);
|
|
@@ -76058,7 +76051,7 @@ var validateLists = ({
|
|
|
76058
76051
|
return;
|
|
76059
76052
|
}
|
|
76060
76053
|
ctx.reportError(
|
|
76061
|
-
new
|
|
76054
|
+
new graphql26.GraphQLError(
|
|
76062
76055
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
76063
76056
|
)
|
|
76064
76057
|
);
|
|
@@ -76068,7 +76061,7 @@ var validateLists = ({
|
|
|
76068
76061
|
const directiveName = node.name.value;
|
|
76069
76062
|
if (directiveName === "connection") {
|
|
76070
76063
|
ctx.reportError(
|
|
76071
|
-
new
|
|
76064
|
+
new graphql26.GraphQLError(
|
|
76072
76065
|
"@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."
|
|
76073
76066
|
)
|
|
76074
76067
|
);
|
|
@@ -76077,7 +76070,7 @@ var validateLists = ({
|
|
|
76077
76070
|
if (!config2.isInternalDirective(node)) {
|
|
76078
76071
|
if (!config2.schema.getDirective(directiveName)) {
|
|
76079
76072
|
ctx.reportError(
|
|
76080
|
-
new
|
|
76073
|
+
new graphql26.GraphQLError(
|
|
76081
76074
|
"Encountered unknown directive: " + directiveName
|
|
76082
76075
|
)
|
|
76083
76076
|
);
|
|
@@ -76086,7 +76079,7 @@ var validateLists = ({
|
|
|
76086
76079
|
}
|
|
76087
76080
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
76088
76081
|
ctx.reportError(
|
|
76089
|
-
new
|
|
76082
|
+
new graphql26.GraphQLError(
|
|
76090
76083
|
"Encountered directive referencing unknown list: " + directiveName
|
|
76091
76084
|
)
|
|
76092
76085
|
);
|
|
@@ -76097,7 +76090,7 @@ var validateLists = ({
|
|
|
76097
76090
|
};
|
|
76098
76091
|
function knownArguments(config2) {
|
|
76099
76092
|
return function(ctx) {
|
|
76100
|
-
const nativeValidator =
|
|
76093
|
+
const nativeValidator = graphql26.KnownArgumentNamesRule(ctx);
|
|
76101
76094
|
return {
|
|
76102
76095
|
...nativeValidator,
|
|
76103
76096
|
Directive(directiveNode) {
|
|
@@ -76130,7 +76123,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76130
76123
|
for (const arg of node.arguments || []) {
|
|
76131
76124
|
if (arg.value.kind !== "ObjectValue") {
|
|
76132
76125
|
ctx.reportError(
|
|
76133
|
-
new
|
|
76126
|
+
new graphql26.GraphQLError("values in @arguments must be an object")
|
|
76134
76127
|
);
|
|
76135
76128
|
return;
|
|
76136
76129
|
}
|
|
@@ -76140,13 +76133,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76140
76133
|
);
|
|
76141
76134
|
if (!typeArg) {
|
|
76142
76135
|
ctx.reportError(
|
|
76143
|
-
new
|
|
76136
|
+
new graphql26.GraphQLError("missing type field for @arguments directive")
|
|
76144
76137
|
);
|
|
76145
76138
|
return;
|
|
76146
76139
|
}
|
|
76147
|
-
if (typeArg.value.kind !==
|
|
76140
|
+
if (typeArg.value.kind !== graphql26.Kind.STRING) {
|
|
76148
76141
|
ctx.reportError(
|
|
76149
|
-
new
|
|
76142
|
+
new graphql26.GraphQLError("type field to @arguments must be a string")
|
|
76150
76143
|
);
|
|
76151
76144
|
return;
|
|
76152
76145
|
}
|
|
@@ -76159,7 +76152,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76159
76152
|
);
|
|
76160
76153
|
if (typeArg.value.value !== defaultValueType) {
|
|
76161
76154
|
ctx.reportError(
|
|
76162
|
-
new
|
|
76155
|
+
new graphql26.GraphQLError(
|
|
76163
76156
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
76164
76157
|
)
|
|
76165
76158
|
);
|
|
@@ -76177,7 +76170,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76177
76170
|
try {
|
|
76178
76171
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
76179
76172
|
} catch (e2) {
|
|
76180
|
-
ctx.reportError(new
|
|
76173
|
+
ctx.reportError(new graphql26.GraphQLError(e2.message));
|
|
76181
76174
|
return;
|
|
76182
76175
|
}
|
|
76183
76176
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -76200,7 +76193,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76200
76193
|
);
|
|
76201
76194
|
if (missing.length > 0) {
|
|
76202
76195
|
ctx.reportError(
|
|
76203
|
-
new
|
|
76196
|
+
new graphql26.GraphQLError(
|
|
76204
76197
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
76205
76198
|
)
|
|
76206
76199
|
);
|
|
@@ -76211,7 +76204,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76211
76204
|
);
|
|
76212
76205
|
if (unknown.length > 0) {
|
|
76213
76206
|
ctx.reportError(
|
|
76214
|
-
new
|
|
76207
|
+
new graphql26.GraphQLError(
|
|
76215
76208
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
76216
76209
|
)
|
|
76217
76210
|
);
|
|
@@ -76223,7 +76216,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76223
76216
|
]
|
|
76224
76217
|
);
|
|
76225
76218
|
for (const [applied, target] of zipped) {
|
|
76226
|
-
if (applied.value.kind ===
|
|
76219
|
+
if (applied.value.kind === graphql26.Kind.VARIABLE || applied.value.kind === graphql26.Kind.LIST || applied.value.kind === graphql26.Kind.OBJECT) {
|
|
76227
76220
|
continue;
|
|
76228
76221
|
}
|
|
76229
76222
|
const appliedType = applied.value.kind.substring(
|
|
@@ -76232,7 +76225,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76232
76225
|
);
|
|
76233
76226
|
if (appliedType !== target) {
|
|
76234
76227
|
ctx.reportError(
|
|
76235
|
-
new
|
|
76228
|
+
new graphql26.GraphQLError(
|
|
76236
76229
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
76237
76230
|
)
|
|
76238
76231
|
);
|
|
@@ -76253,7 +76246,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76253
76246
|
}
|
|
76254
76247
|
if (alreadyPaginated) {
|
|
76255
76248
|
ctx.reportError(
|
|
76256
|
-
new
|
|
76249
|
+
new graphql26.GraphQLError(
|
|
76257
76250
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
76258
76251
|
)
|
|
76259
76252
|
);
|
|
@@ -76268,7 +76261,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76268
76261
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
76269
76262
|
if (hasRequiredArgs) {
|
|
76270
76263
|
ctx.reportError(
|
|
76271
|
-
new
|
|
76264
|
+
new graphql26.GraphQLError(
|
|
76272
76265
|
"@paginate cannot appear on a document with required args"
|
|
76273
76266
|
)
|
|
76274
76267
|
);
|
|
@@ -76300,14 +76293,14 @@ function paginateArgs(config2, filepath) {
|
|
|
76300
76293
|
const backwards = appliedArgs.has("last");
|
|
76301
76294
|
if (!forward && !backwards) {
|
|
76302
76295
|
ctx.reportError(
|
|
76303
|
-
new
|
|
76296
|
+
new graphql26.GraphQLError(
|
|
76304
76297
|
"A field with cursor-based pagination must have a first or last argument"
|
|
76305
76298
|
)
|
|
76306
76299
|
);
|
|
76307
76300
|
}
|
|
76308
76301
|
if (forward && backwards) {
|
|
76309
76302
|
ctx.reportError(
|
|
76310
|
-
new
|
|
76303
|
+
new graphql26.GraphQLError(
|
|
76311
76304
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
76312
76305
|
)
|
|
76313
76306
|
);
|
|
@@ -76321,7 +76314,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76321
76314
|
);
|
|
76322
76315
|
if (!appliedLimitArg) {
|
|
76323
76316
|
ctx.reportError(
|
|
76324
|
-
new
|
|
76317
|
+
new graphql26.GraphQLError(
|
|
76325
76318
|
"A field with offset-based pagination must have a limit argument"
|
|
76326
76319
|
)
|
|
76327
76320
|
);
|
|
@@ -76337,20 +76330,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
76337
76330
|
const args = /* @__PURE__ */ new Set();
|
|
76338
76331
|
return {
|
|
76339
76332
|
enter(node) {
|
|
76340
|
-
if (node.kind ===
|
|
76333
|
+
if (node.kind === graphql26.Kind.FRAGMENT_DEFINITION) {
|
|
76341
76334
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
76342
76335
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
76343
76336
|
args.add(arg);
|
|
76344
76337
|
}
|
|
76345
|
-
} else if (node.kind ===
|
|
76338
|
+
} else if (node.kind === graphql26.Kind.VARIABLE) {
|
|
76346
76339
|
args.delete(node.name.value);
|
|
76347
76340
|
}
|
|
76348
76341
|
},
|
|
76349
76342
|
leave(node) {
|
|
76350
|
-
if (node.kind ===
|
|
76343
|
+
if (node.kind === graphql26.Kind.FRAGMENT_DEFINITION) {
|
|
76351
76344
|
if (args.size > 0) {
|
|
76352
76345
|
ctx.reportError(
|
|
76353
|
-
new
|
|
76346
|
+
new graphql26.GraphQLError(
|
|
76354
76347
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
76355
76348
|
)
|
|
76356
76349
|
);
|
|
@@ -76386,7 +76379,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76386
76379
|
if (definition.kind === "OperationDefinition") {
|
|
76387
76380
|
if (definition.operation !== "query") {
|
|
76388
76381
|
ctx.reportError(
|
|
76389
|
-
new
|
|
76382
|
+
new graphql26.GraphQLError(
|
|
76390
76383
|
`@${node.name.value} must fall on a fragment or query document`
|
|
76391
76384
|
)
|
|
76392
76385
|
);
|
|
@@ -76398,7 +76391,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76398
76391
|
}
|
|
76399
76392
|
if (!possibleNodes.includes(definitionType)) {
|
|
76400
76393
|
ctx.reportError(
|
|
76401
|
-
new
|
|
76394
|
+
new graphql26.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
76402
76395
|
);
|
|
76403
76396
|
}
|
|
76404
76397
|
}
|
|
@@ -76417,7 +76410,7 @@ function checkMutationOperation(config2) {
|
|
|
76417
76410
|
);
|
|
76418
76411
|
if (append && prepend) {
|
|
76419
76412
|
ctx.reportError(
|
|
76420
|
-
new
|
|
76413
|
+
new graphql26.GraphQLError(
|
|
76421
76414
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
76422
76415
|
)
|
|
76423
76416
|
);
|
|
@@ -76431,7 +76424,7 @@ function checkMutationOperation(config2) {
|
|
|
76431
76424
|
);
|
|
76432
76425
|
if (parentId && allLists) {
|
|
76433
76426
|
ctx.reportError(
|
|
76434
|
-
new
|
|
76427
|
+
new graphql26.GraphQLError(
|
|
76435
76428
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
76436
76429
|
)
|
|
76437
76430
|
);
|
|
@@ -76453,7 +76446,7 @@ function checkMaskDirective(config2) {
|
|
|
76453
76446
|
);
|
|
76454
76447
|
if (maskEnableDirective && maskDisableDirective) {
|
|
76455
76448
|
ctx.reportError(
|
|
76456
|
-
new
|
|
76449
|
+
new graphql26.GraphQLError(
|
|
76457
76450
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
76458
76451
|
)
|
|
76459
76452
|
);
|
|
@@ -76469,7 +76462,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
76469
76462
|
if (!nodeInterface) {
|
|
76470
76463
|
return null;
|
|
76471
76464
|
}
|
|
76472
|
-
if (!
|
|
76465
|
+
if (!graphql26.isInterfaceType(nodeInterface)) {
|
|
76473
76466
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
76474
76467
|
return null;
|
|
76475
76468
|
}
|
|
@@ -76567,11 +76560,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
76567
76560
|
}
|
|
76568
76561
|
|
|
76569
76562
|
// src/codegen/validators/noIDAlias.ts
|
|
76570
|
-
var
|
|
76563
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
76571
76564
|
async function noIDAlias(config2, docs) {
|
|
76572
76565
|
const errors = [];
|
|
76573
76566
|
for (const { filename, document } of docs) {
|
|
76574
|
-
|
|
76567
|
+
graphql27.visit(document, {
|
|
76575
76568
|
Field(node, _, __, ___, ancestors) {
|
|
76576
76569
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
76577
76570
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -76769,12 +76762,12 @@ async function processJSFile(config2, contents) {
|
|
|
76769
76762
|
return documents;
|
|
76770
76763
|
}
|
|
76771
76764
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
76772
|
-
const parsedDoc =
|
|
76765
|
+
const parsedDoc = graphql28.parse(document);
|
|
76773
76766
|
const operations = parsedDoc.definitions.filter(
|
|
76774
|
-
({ kind: kind2 }) => kind2 ===
|
|
76767
|
+
({ kind: kind2 }) => kind2 === graphql28.Kind.OPERATION_DEFINITION
|
|
76775
76768
|
);
|
|
76776
76769
|
const fragments = parsedDoc.definitions.filter(
|
|
76777
|
-
({ kind: kind2 }) => kind2 ===
|
|
76770
|
+
({ kind: kind2 }) => kind2 === graphql28.Kind.FRAGMENT_DEFINITION
|
|
76778
76771
|
);
|
|
76779
76772
|
if (operations.length > 1) {
|
|
76780
76773
|
throw new HoudiniError({
|
|
@@ -77313,8 +77306,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
77313
77306
|
}
|
|
77314
77307
|
packageJSON.devDependencies = {
|
|
77315
77308
|
...packageJSON.devDependencies,
|
|
77316
|
-
houdini: "^0.18.
|
|
77317
|
-
"houdini-svelte": "^0.18.
|
|
77309
|
+
houdini: "^0.18.3",
|
|
77310
|
+
"houdini-svelte": "^0.18.3",
|
|
77318
77311
|
graphql: "^15.8.0"
|
|
77319
77312
|
};
|
|
77320
77313
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|