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-esm/index.js
CHANGED
|
@@ -2288,7 +2288,7 @@ var require_kinds = __commonJS({
|
|
|
2288
2288
|
value: true
|
|
2289
2289
|
});
|
|
2290
2290
|
exports.Kind = void 0;
|
|
2291
|
-
var
|
|
2291
|
+
var Kind30 = Object.freeze({
|
|
2292
2292
|
NAME: "Name",
|
|
2293
2293
|
DOCUMENT: "Document",
|
|
2294
2294
|
OPERATION_DEFINITION: "OperationDefinition",
|
|
@@ -2333,7 +2333,7 @@ var require_kinds = __commonJS({
|
|
|
2333
2333
|
ENUM_TYPE_EXTENSION: "EnumTypeExtension",
|
|
2334
2334
|
INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension"
|
|
2335
2335
|
});
|
|
2336
|
-
exports.Kind =
|
|
2336
|
+
exports.Kind = Kind30;
|
|
2337
2337
|
}
|
|
2338
2338
|
});
|
|
2339
2339
|
|
|
@@ -11513,7 +11513,7 @@ var require_graphql = __commonJS({
|
|
|
11513
11513
|
Object.defineProperty(exports, "__esModule", {
|
|
11514
11514
|
value: true
|
|
11515
11515
|
});
|
|
11516
|
-
exports.graphql =
|
|
11516
|
+
exports.graphql = graphql29;
|
|
11517
11517
|
exports.graphqlSync = graphqlSync;
|
|
11518
11518
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
11519
11519
|
var _parser = require_parser();
|
|
@@ -11523,7 +11523,7 @@ var require_graphql = __commonJS({
|
|
|
11523
11523
|
function _interopRequireDefault(obj) {
|
|
11524
11524
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
11525
11525
|
}
|
|
11526
|
-
function
|
|
11526
|
+
function graphql29(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
11527
11527
|
var _arguments = arguments;
|
|
11528
11528
|
return new Promise(function(resolve2) {
|
|
11529
11529
|
return resolve2(
|
|
@@ -72394,10 +72394,10 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
72394
72394
|
}
|
|
72395
72395
|
|
|
72396
72396
|
// src/codegen/index.ts
|
|
72397
|
-
var
|
|
72397
|
+
var graphql28 = __toESM(require_graphql2(), 1);
|
|
72398
72398
|
|
|
72399
72399
|
// src/codegen/generators/artifacts/index.ts
|
|
72400
|
-
var
|
|
72400
|
+
var graphql14 = __toESM(require_graphql2(), 1);
|
|
72401
72401
|
var recast5 = __toESM(require_main2(), 1);
|
|
72402
72402
|
|
|
72403
72403
|
// src/codegen/utils/commonjs.ts
|
|
@@ -73001,7 +73001,7 @@ function ancestorKey(ancestors) {
|
|
|
73001
73001
|
}
|
|
73002
73002
|
|
|
73003
73003
|
// src/codegen/generators/artifacts/selection.ts
|
|
73004
|
-
var
|
|
73004
|
+
var graphql13 = __toESM(require_graphql2(), 1);
|
|
73005
73005
|
|
|
73006
73006
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
73007
73007
|
var config = {
|
|
@@ -73041,10 +73041,24 @@ function logYellow(str) {
|
|
|
73041
73041
|
}
|
|
73042
73042
|
|
|
73043
73043
|
// src/codegen/transforms/list.ts
|
|
73044
|
-
var
|
|
73044
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
73045
73045
|
|
|
73046
|
-
// src/codegen/
|
|
73046
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
73047
73047
|
var graphql9 = __toESM(require_graphql2(), 1);
|
|
73048
|
+
var objectIdentificationSelection = (config2, type) => {
|
|
73049
|
+
return config2.keyFieldsForType(type.name).map((key) => {
|
|
73050
|
+
return {
|
|
73051
|
+
kind: graphql9.Kind.FIELD,
|
|
73052
|
+
name: {
|
|
73053
|
+
kind: graphql9.Kind.NAME,
|
|
73054
|
+
value: key
|
|
73055
|
+
}
|
|
73056
|
+
};
|
|
73057
|
+
});
|
|
73058
|
+
};
|
|
73059
|
+
|
|
73060
|
+
// src/codegen/transforms/paginate.ts
|
|
73061
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
73048
73062
|
async function paginate(config2, documents) {
|
|
73049
73063
|
const newDocs = [];
|
|
73050
73064
|
for (const doc of documents) {
|
|
@@ -73077,7 +73091,7 @@ async function paginate(config2, documents) {
|
|
|
73077
73091
|
};
|
|
73078
73092
|
let cursorType = "String";
|
|
73079
73093
|
let paginationPath = [];
|
|
73080
|
-
doc.document =
|
|
73094
|
+
doc.document = graphql10.visit(doc.document, {
|
|
73081
73095
|
Field(node, _, __, ___, ancestors) {
|
|
73082
73096
|
const paginateDirective = node.directives?.find(
|
|
73083
73097
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -73104,7 +73118,7 @@ async function paginate(config2, documents) {
|
|
|
73104
73118
|
flags.offset.enabled = offsetPagination;
|
|
73105
73119
|
flags.limit.enabled = offsetPagination;
|
|
73106
73120
|
paginationPath = ancestors.filter(
|
|
73107
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
73121
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql10.Kind.FIELD
|
|
73108
73122
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
73109
73123
|
return {
|
|
73110
73124
|
...node,
|
|
@@ -73125,7 +73139,7 @@ async function paginate(config2, documents) {
|
|
|
73125
73139
|
refetchUpdate = "prepend" /* prepend */;
|
|
73126
73140
|
}
|
|
73127
73141
|
let fragment = "";
|
|
73128
|
-
doc.document =
|
|
73142
|
+
doc.document = graphql10.visit(doc.document, {
|
|
73129
73143
|
OperationDefinition(node) {
|
|
73130
73144
|
if (node.operation !== "query") {
|
|
73131
73145
|
throw new HoudiniError({
|
|
@@ -73179,9 +73193,9 @@ async function paginate(config2, documents) {
|
|
|
73179
73193
|
directives: [
|
|
73180
73194
|
...node.directives || [],
|
|
73181
73195
|
{
|
|
73182
|
-
kind:
|
|
73196
|
+
kind: graphql10.Kind.DIRECTIVE,
|
|
73183
73197
|
name: {
|
|
73184
|
-
kind:
|
|
73198
|
+
kind: graphql10.Kind.NAME,
|
|
73185
73199
|
value: config2.argumentsDirective
|
|
73186
73200
|
}
|
|
73187
73201
|
}
|
|
@@ -73244,16 +73258,16 @@ async function paginate(config2, documents) {
|
|
|
73244
73258
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
73245
73259
|
const fragmentSpreadSelection = [
|
|
73246
73260
|
{
|
|
73247
|
-
kind:
|
|
73261
|
+
kind: graphql10.Kind.FRAGMENT_SPREAD,
|
|
73248
73262
|
name: {
|
|
73249
|
-
kind:
|
|
73263
|
+
kind: graphql10.Kind.NAME,
|
|
73250
73264
|
value: fragmentName
|
|
73251
73265
|
},
|
|
73252
73266
|
directives: [
|
|
73253
73267
|
{
|
|
73254
|
-
kind:
|
|
73268
|
+
kind: graphql10.Kind.DIRECTIVE,
|
|
73255
73269
|
name: {
|
|
73256
|
-
kind:
|
|
73270
|
+
kind: graphql10.Kind.NAME,
|
|
73257
73271
|
value: config2.withDirective
|
|
73258
73272
|
},
|
|
73259
73273
|
["arguments"]: paginationArgs.map(
|
|
@@ -73281,29 +73295,29 @@ async function paginate(config2, documents) {
|
|
|
73281
73295
|
});
|
|
73282
73296
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
73283
73297
|
const queryDoc = {
|
|
73284
|
-
kind:
|
|
73298
|
+
kind: graphql10.Kind.DOCUMENT,
|
|
73285
73299
|
definitions: [
|
|
73286
73300
|
{
|
|
73287
|
-
kind:
|
|
73301
|
+
kind: graphql10.Kind.OPERATION_DEFINITION,
|
|
73288
73302
|
name: {
|
|
73289
|
-
kind:
|
|
73303
|
+
kind: graphql10.Kind.NAME,
|
|
73290
73304
|
value: refetchQueryName
|
|
73291
73305
|
},
|
|
73292
73306
|
operation: "query",
|
|
73293
73307
|
variableDefinitions: paginationArgs.map(
|
|
73294
73308
|
(arg) => ({
|
|
73295
|
-
kind:
|
|
73309
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73296
73310
|
type: {
|
|
73297
|
-
kind:
|
|
73311
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
73298
73312
|
name: {
|
|
73299
|
-
kind:
|
|
73313
|
+
kind: graphql10.Kind.NAME,
|
|
73300
73314
|
value: arg.type
|
|
73301
73315
|
}
|
|
73302
73316
|
},
|
|
73303
73317
|
variable: {
|
|
73304
|
-
kind:
|
|
73318
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73305
73319
|
name: {
|
|
73306
|
-
kind:
|
|
73320
|
+
kind: graphql10.Kind.NAME,
|
|
73307
73321
|
value: arg.name
|
|
73308
73322
|
}
|
|
73309
73323
|
},
|
|
@@ -73315,12 +73329,12 @@ async function paginate(config2, documents) {
|
|
|
73315
73329
|
).concat(
|
|
73316
73330
|
!nodeQuery ? [] : keys.map(
|
|
73317
73331
|
(key) => ({
|
|
73318
|
-
kind:
|
|
73332
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73319
73333
|
type: key.type,
|
|
73320
73334
|
variable: {
|
|
73321
|
-
kind:
|
|
73335
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73322
73336
|
name: {
|
|
73323
|
-
kind:
|
|
73337
|
+
kind: graphql10.Kind.NAME,
|
|
73324
73338
|
value: key.name
|
|
73325
73339
|
}
|
|
73326
73340
|
}
|
|
@@ -73328,42 +73342,42 @@ async function paginate(config2, documents) {
|
|
|
73328
73342
|
)
|
|
73329
73343
|
),
|
|
73330
73344
|
selectionSet: {
|
|
73331
|
-
kind:
|
|
73345
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73332
73346
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
73333
73347
|
{
|
|
73334
|
-
kind:
|
|
73348
|
+
kind: graphql10.Kind.FIELD,
|
|
73335
73349
|
name: {
|
|
73336
|
-
kind:
|
|
73350
|
+
kind: graphql10.Kind.NAME,
|
|
73337
73351
|
value: typeConfig?.resolve?.queryField || "node"
|
|
73338
73352
|
},
|
|
73339
73353
|
["arguments"]: keys.map((key) => ({
|
|
73340
|
-
kind:
|
|
73354
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73341
73355
|
name: {
|
|
73342
|
-
kind:
|
|
73356
|
+
kind: graphql10.Kind.NAME,
|
|
73343
73357
|
value: key.name
|
|
73344
73358
|
},
|
|
73345
73359
|
value: {
|
|
73346
|
-
kind:
|
|
73360
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73347
73361
|
name: {
|
|
73348
|
-
kind:
|
|
73362
|
+
kind: graphql10.Kind.NAME,
|
|
73349
73363
|
value: key.name
|
|
73350
73364
|
}
|
|
73351
73365
|
}
|
|
73352
73366
|
})),
|
|
73353
73367
|
selectionSet: {
|
|
73354
|
-
kind:
|
|
73368
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73355
73369
|
selections: [
|
|
73356
73370
|
{
|
|
73357
|
-
kind:
|
|
73371
|
+
kind: graphql10.Kind.FIELD,
|
|
73358
73372
|
name: {
|
|
73359
|
-
kind:
|
|
73373
|
+
kind: graphql10.Kind.NAME,
|
|
73360
73374
|
value: "__typename"
|
|
73361
73375
|
}
|
|
73362
73376
|
},
|
|
73363
73377
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
73364
|
-
kind:
|
|
73378
|
+
kind: graphql10.Kind.FIELD,
|
|
73365
73379
|
name: {
|
|
73366
|
-
kind:
|
|
73380
|
+
kind: graphql10.Kind.NAME,
|
|
73367
73381
|
value: key
|
|
73368
73382
|
}
|
|
73369
73383
|
})),
|
|
@@ -73425,15 +73439,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
73425
73439
|
}
|
|
73426
73440
|
function variableAsArgument(name2, variable) {
|
|
73427
73441
|
return {
|
|
73428
|
-
kind:
|
|
73442
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73429
73443
|
name: {
|
|
73430
|
-
kind:
|
|
73444
|
+
kind: graphql10.Kind.NAME,
|
|
73431
73445
|
value: name2
|
|
73432
73446
|
},
|
|
73433
73447
|
value: {
|
|
73434
|
-
kind:
|
|
73448
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73435
73449
|
name: {
|
|
73436
|
-
kind:
|
|
73450
|
+
kind: graphql10.Kind.NAME,
|
|
73437
73451
|
value: variable ?? name2
|
|
73438
73452
|
}
|
|
73439
73453
|
}
|
|
@@ -73441,18 +73455,18 @@ function variableAsArgument(name2, variable) {
|
|
|
73441
73455
|
}
|
|
73442
73456
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
73443
73457
|
return {
|
|
73444
|
-
kind:
|
|
73458
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73445
73459
|
type: {
|
|
73446
|
-
kind:
|
|
73460
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
73447
73461
|
name: {
|
|
73448
|
-
kind:
|
|
73462
|
+
kind: graphql10.Kind.NAME,
|
|
73449
73463
|
value: type
|
|
73450
73464
|
}
|
|
73451
73465
|
},
|
|
73452
73466
|
variable: {
|
|
73453
|
-
kind:
|
|
73467
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73454
73468
|
name: {
|
|
73455
|
-
kind:
|
|
73469
|
+
kind: graphql10.Kind.NAME,
|
|
73456
73470
|
value: variableName ?? name2
|
|
73457
73471
|
}
|
|
73458
73472
|
},
|
|
@@ -73464,9 +73478,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
73464
73478
|
}
|
|
73465
73479
|
function argumentNode(name2, value) {
|
|
73466
73480
|
return {
|
|
73467
|
-
kind:
|
|
73481
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73468
73482
|
name: {
|
|
73469
|
-
kind:
|
|
73483
|
+
kind: graphql10.Kind.NAME,
|
|
73470
73484
|
value: name2
|
|
73471
73485
|
},
|
|
73472
73486
|
value: objectNode(value)
|
|
@@ -73474,16 +73488,16 @@ function argumentNode(name2, value) {
|
|
|
73474
73488
|
}
|
|
73475
73489
|
function objectNode([type, defaultValue]) {
|
|
73476
73490
|
const node = {
|
|
73477
|
-
kind:
|
|
73491
|
+
kind: graphql10.Kind.OBJECT,
|
|
73478
73492
|
fields: [
|
|
73479
73493
|
{
|
|
73480
|
-
kind:
|
|
73494
|
+
kind: graphql10.Kind.OBJECT_FIELD,
|
|
73481
73495
|
name: {
|
|
73482
|
-
kind:
|
|
73496
|
+
kind: graphql10.Kind.NAME,
|
|
73483
73497
|
value: "type"
|
|
73484
73498
|
},
|
|
73485
73499
|
value: {
|
|
73486
|
-
kind:
|
|
73500
|
+
kind: graphql10.Kind.STRING,
|
|
73487
73501
|
value: type
|
|
73488
73502
|
}
|
|
73489
73503
|
}
|
|
@@ -73491,8 +73505,8 @@ function objectNode([type, defaultValue]) {
|
|
|
73491
73505
|
};
|
|
73492
73506
|
if (defaultValue) {
|
|
73493
73507
|
node.fields.push({
|
|
73494
|
-
kind:
|
|
73495
|
-
name: { kind:
|
|
73508
|
+
kind: graphql10.Kind.OBJECT_FIELD,
|
|
73509
|
+
name: { kind: graphql10.Kind.NAME, value: "default" },
|
|
73496
73510
|
value: {
|
|
73497
73511
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
73498
73512
|
value: defaultValue.toString()
|
|
@@ -73503,34 +73517,34 @@ function objectNode([type, defaultValue]) {
|
|
|
73503
73517
|
}
|
|
73504
73518
|
var pageInfoSelection = [
|
|
73505
73519
|
{
|
|
73506
|
-
kind:
|
|
73520
|
+
kind: graphql10.Kind.FIELD,
|
|
73507
73521
|
name: {
|
|
73508
|
-
kind:
|
|
73522
|
+
kind: graphql10.Kind.NAME,
|
|
73509
73523
|
value: "edges"
|
|
73510
73524
|
},
|
|
73511
73525
|
selectionSet: {
|
|
73512
|
-
kind:
|
|
73526
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73513
73527
|
selections: [
|
|
73514
73528
|
{
|
|
73515
|
-
kind:
|
|
73529
|
+
kind: graphql10.Kind.FIELD,
|
|
73516
73530
|
name: {
|
|
73517
|
-
kind:
|
|
73531
|
+
kind: graphql10.Kind.NAME,
|
|
73518
73532
|
value: "cursor"
|
|
73519
73533
|
}
|
|
73520
73534
|
},
|
|
73521
73535
|
{
|
|
73522
|
-
kind:
|
|
73536
|
+
kind: graphql10.Kind.FIELD,
|
|
73523
73537
|
name: {
|
|
73524
|
-
kind:
|
|
73538
|
+
kind: graphql10.Kind.NAME,
|
|
73525
73539
|
value: "node"
|
|
73526
73540
|
},
|
|
73527
73541
|
selectionSet: {
|
|
73528
|
-
kind:
|
|
73542
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73529
73543
|
selections: [
|
|
73530
73544
|
{
|
|
73531
|
-
kind:
|
|
73545
|
+
kind: graphql10.Kind.FIELD,
|
|
73532
73546
|
name: {
|
|
73533
|
-
kind:
|
|
73547
|
+
kind: graphql10.Kind.NAME,
|
|
73534
73548
|
value: "__typename"
|
|
73535
73549
|
}
|
|
73536
73550
|
}
|
|
@@ -73541,39 +73555,39 @@ var pageInfoSelection = [
|
|
|
73541
73555
|
}
|
|
73542
73556
|
},
|
|
73543
73557
|
{
|
|
73544
|
-
kind:
|
|
73558
|
+
kind: graphql10.Kind.FIELD,
|
|
73545
73559
|
name: {
|
|
73546
|
-
kind:
|
|
73560
|
+
kind: graphql10.Kind.NAME,
|
|
73547
73561
|
value: "pageInfo"
|
|
73548
73562
|
},
|
|
73549
73563
|
selectionSet: {
|
|
73550
|
-
kind:
|
|
73564
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73551
73565
|
selections: [
|
|
73552
73566
|
{
|
|
73553
|
-
kind:
|
|
73567
|
+
kind: graphql10.Kind.FIELD,
|
|
73554
73568
|
name: {
|
|
73555
|
-
kind:
|
|
73569
|
+
kind: graphql10.Kind.NAME,
|
|
73556
73570
|
value: "hasPreviousPage"
|
|
73557
73571
|
}
|
|
73558
73572
|
},
|
|
73559
73573
|
{
|
|
73560
|
-
kind:
|
|
73574
|
+
kind: graphql10.Kind.FIELD,
|
|
73561
73575
|
name: {
|
|
73562
|
-
kind:
|
|
73576
|
+
kind: graphql10.Kind.NAME,
|
|
73563
73577
|
value: "hasNextPage"
|
|
73564
73578
|
}
|
|
73565
73579
|
},
|
|
73566
73580
|
{
|
|
73567
|
-
kind:
|
|
73581
|
+
kind: graphql10.Kind.FIELD,
|
|
73568
73582
|
name: {
|
|
73569
|
-
kind:
|
|
73583
|
+
kind: graphql10.Kind.NAME,
|
|
73570
73584
|
value: "startCursor"
|
|
73571
73585
|
}
|
|
73572
73586
|
},
|
|
73573
73587
|
{
|
|
73574
|
-
kind:
|
|
73588
|
+
kind: graphql10.Kind.FIELD,
|
|
73575
73589
|
name: {
|
|
73576
|
-
kind:
|
|
73590
|
+
kind: graphql10.Kind.NAME,
|
|
73577
73591
|
value: "endCursor"
|
|
73578
73592
|
}
|
|
73579
73593
|
}
|
|
@@ -73587,15 +73601,15 @@ async function addListFragments(config2, documents) {
|
|
|
73587
73601
|
const lists = {};
|
|
73588
73602
|
const errors = [];
|
|
73589
73603
|
for (const doc of documents) {
|
|
73590
|
-
doc.document =
|
|
73604
|
+
doc.document = graphql11.visit(doc.document, {
|
|
73591
73605
|
Directive(node, key, parent, path2, ancestors) {
|
|
73592
73606
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
73593
73607
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
73594
73608
|
let error = {
|
|
73595
|
-
...new
|
|
73609
|
+
...new graphql11.GraphQLError(
|
|
73596
73610
|
"",
|
|
73597
73611
|
node,
|
|
73598
|
-
new
|
|
73612
|
+
new graphql11.Source(""),
|
|
73599
73613
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
73600
73614
|
path2
|
|
73601
73615
|
),
|
|
@@ -73647,7 +73661,7 @@ async function addListFragments(config2, documents) {
|
|
|
73647
73661
|
{
|
|
73648
73662
|
kind: "Argument",
|
|
73649
73663
|
name: {
|
|
73650
|
-
kind:
|
|
73664
|
+
kind: graphql11.Kind.NAME,
|
|
73651
73665
|
value: "connection"
|
|
73652
73666
|
},
|
|
73653
73667
|
value: {
|
|
@@ -73694,10 +73708,13 @@ async function addListFragments(config2, documents) {
|
|
|
73694
73708
|
if (errors.length > 0) {
|
|
73695
73709
|
throw errors;
|
|
73696
73710
|
}
|
|
73697
|
-
const
|
|
73711
|
+
const validDeletes = [
|
|
73698
73712
|
...new Set(
|
|
73699
73713
|
Object.values(lists).map(({ type }) => {
|
|
73700
|
-
if (!(type instanceof
|
|
73714
|
+
if (!(type instanceof graphql11.GraphQLObjectType)) {
|
|
73715
|
+
return "";
|
|
73716
|
+
}
|
|
73717
|
+
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
73701
73718
|
return "";
|
|
73702
73719
|
}
|
|
73703
73720
|
return type.name;
|
|
@@ -73708,7 +73725,7 @@ async function addListFragments(config2, documents) {
|
|
|
73708
73725
|
return;
|
|
73709
73726
|
}
|
|
73710
73727
|
const generatedDoc = {
|
|
73711
|
-
kind:
|
|
73728
|
+
kind: graphql11.Kind.DOCUMENT,
|
|
73712
73729
|
definitions: Object.entries(lists).flatMap(
|
|
73713
73730
|
([name2, { selection: selection2, type }]) => {
|
|
73714
73731
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -73716,35 +73733,29 @@ async function addListFragments(config2, documents) {
|
|
|
73716
73733
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
73717
73734
|
}
|
|
73718
73735
|
const fragmentSelection = {
|
|
73719
|
-
kind:
|
|
73736
|
+
kind: graphql11.Kind.SELECTION_SET,
|
|
73720
73737
|
selections: [...selection2.selections]
|
|
73721
73738
|
};
|
|
73722
73739
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
73723
|
-
(field) => field.kind === "Field" && field.name.value
|
|
73740
|
+
(field) => field.kind === "Field" && config2.keyFieldsForType(type.name).includes(field.name.value)
|
|
73724
73741
|
)) {
|
|
73725
73742
|
fragmentSelection.selections = [
|
|
73726
73743
|
...fragmentSelection.selections,
|
|
73727
|
-
|
|
73728
|
-
kind: graphql10.Kind.FIELD,
|
|
73729
|
-
name: {
|
|
73730
|
-
kind: graphql10.Kind.NAME,
|
|
73731
|
-
value: "id"
|
|
73732
|
-
}
|
|
73733
|
-
}
|
|
73744
|
+
...objectIdentificationSelection(config2, type)
|
|
73734
73745
|
];
|
|
73735
73746
|
}
|
|
73736
73747
|
return [
|
|
73737
73748
|
{
|
|
73738
73749
|
name: {
|
|
73739
73750
|
value: config2.listInsertFragment(name2),
|
|
73740
|
-
kind:
|
|
73751
|
+
kind: graphql11.Kind.NAME
|
|
73741
73752
|
},
|
|
73742
|
-
kind:
|
|
73753
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73743
73754
|
selectionSet: fragmentSelection,
|
|
73744
73755
|
typeCondition: {
|
|
73745
|
-
kind:
|
|
73756
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73746
73757
|
name: {
|
|
73747
|
-
kind:
|
|
73758
|
+
kind: graphql11.Kind.NAME,
|
|
73748
73759
|
value: type.name
|
|
73749
73760
|
}
|
|
73750
73761
|
}
|
|
@@ -73752,52 +73763,32 @@ async function addListFragments(config2, documents) {
|
|
|
73752
73763
|
{
|
|
73753
73764
|
name: {
|
|
73754
73765
|
value: config2.listToggleFragment(name2),
|
|
73755
|
-
kind:
|
|
73756
|
-
},
|
|
73757
|
-
kind: graphql10.Kind.FRAGMENT_DEFINITION,
|
|
73758
|
-
selectionSet: {
|
|
73759
|
-
...fragmentSelection,
|
|
73760
|
-
selections: [
|
|
73761
|
-
...fragmentSelection.selections,
|
|
73762
|
-
{
|
|
73763
|
-
kind: graphql10.Kind.FIELD,
|
|
73764
|
-
name: {
|
|
73765
|
-
kind: graphql10.Kind.NAME,
|
|
73766
|
-
value: "id"
|
|
73767
|
-
}
|
|
73768
|
-
}
|
|
73769
|
-
]
|
|
73766
|
+
kind: graphql11.Kind.NAME
|
|
73770
73767
|
},
|
|
73768
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73769
|
+
selectionSet: fragmentSelection,
|
|
73771
73770
|
typeCondition: {
|
|
73772
|
-
kind:
|
|
73771
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73773
73772
|
name: {
|
|
73774
|
-
kind:
|
|
73773
|
+
kind: graphql11.Kind.NAME,
|
|
73775
73774
|
value: type.name
|
|
73776
73775
|
}
|
|
73777
73776
|
}
|
|
73778
73777
|
},
|
|
73779
73778
|
{
|
|
73780
|
-
kind:
|
|
73779
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73781
73780
|
name: {
|
|
73782
73781
|
value: config2.listRemoveFragment(name2),
|
|
73783
|
-
kind:
|
|
73782
|
+
kind: graphql11.Kind.NAME
|
|
73784
73783
|
},
|
|
73785
73784
|
selectionSet: {
|
|
73786
|
-
kind:
|
|
73787
|
-
selections: [
|
|
73788
|
-
{
|
|
73789
|
-
kind: graphql10.Kind.FIELD,
|
|
73790
|
-
name: {
|
|
73791
|
-
kind: graphql10.Kind.NAME,
|
|
73792
|
-
value: "id"
|
|
73793
|
-
}
|
|
73794
|
-
}
|
|
73795
|
-
]
|
|
73785
|
+
kind: graphql11.Kind.SELECTION_SET,
|
|
73786
|
+
selections: [...objectIdentificationSelection(config2, type)]
|
|
73796
73787
|
},
|
|
73797
73788
|
typeCondition: {
|
|
73798
|
-
kind:
|
|
73789
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73799
73790
|
name: {
|
|
73800
|
-
kind:
|
|
73791
|
+
kind: graphql11.Kind.NAME,
|
|
73801
73792
|
value: type.name
|
|
73802
73793
|
}
|
|
73803
73794
|
}
|
|
@@ -73805,15 +73796,15 @@ async function addListFragments(config2, documents) {
|
|
|
73805
73796
|
];
|
|
73806
73797
|
}
|
|
73807
73798
|
).concat(
|
|
73808
|
-
...
|
|
73809
|
-
kind:
|
|
73799
|
+
...validDeletes.map((typeName) => ({
|
|
73800
|
+
kind: graphql11.Kind.DIRECTIVE_DEFINITION,
|
|
73810
73801
|
name: {
|
|
73811
|
-
kind:
|
|
73802
|
+
kind: graphql11.Kind.NAME,
|
|
73812
73803
|
value: config2.listDeleteDirective(typeName)
|
|
73813
73804
|
},
|
|
73814
73805
|
locations: [
|
|
73815
73806
|
{
|
|
73816
|
-
kind:
|
|
73807
|
+
kind: graphql11.Kind.NAME,
|
|
73817
73808
|
value: "FIELD"
|
|
73818
73809
|
}
|
|
73819
73810
|
],
|
|
@@ -73821,8 +73812,8 @@ async function addListFragments(config2, documents) {
|
|
|
73821
73812
|
}))
|
|
73822
73813
|
)
|
|
73823
73814
|
};
|
|
73824
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
73825
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
73815
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql11.print).join("\n\n");
|
|
73816
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql11.print).join("\n\n");
|
|
73826
73817
|
documents.push({
|
|
73827
73818
|
name: "generated::lists",
|
|
73828
73819
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -73907,11 +73898,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
73907
73898
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
73908
73899
|
|
|
73909
73900
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
73910
|
-
var
|
|
73901
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
73911
73902
|
function fieldKey(config2, field) {
|
|
73912
73903
|
const attributeName = field.alias?.value || field.name.value;
|
|
73913
|
-
const printed =
|
|
73914
|
-
const secondParse =
|
|
73904
|
+
const printed = graphql12.print(field);
|
|
73905
|
+
const secondParse = graphql12.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
73915
73906
|
const paginated = !!field.directives?.find(
|
|
73916
73907
|
(directive) => directive.name.value === config2.paginateDirective
|
|
73917
73908
|
);
|
|
@@ -74004,8 +73995,8 @@ function selection({
|
|
|
74004
73995
|
const typeConditionName = field.typeCondition.name.value;
|
|
74005
73996
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
74006
73997
|
const possibleTypes = [];
|
|
74007
|
-
if (!
|
|
74008
|
-
} else if (
|
|
73998
|
+
if (!graphql13.isAbstractType(typeCondition)) {
|
|
73999
|
+
} else if (graphql13.isAbstractType(parentType)) {
|
|
74009
74000
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
74010
74001
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
74011
74002
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -74053,7 +74044,7 @@ function selection({
|
|
|
74053
74044
|
} else {
|
|
74054
74045
|
let typeRef = type.getFields()[field.name.value].type;
|
|
74055
74046
|
fieldType = getRootType(typeRef);
|
|
74056
|
-
nullable = !
|
|
74047
|
+
nullable = !graphql13.isNonNullType(typeRef);
|
|
74057
74048
|
}
|
|
74058
74049
|
const typeName = fieldType.toString();
|
|
74059
74050
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -74118,7 +74109,7 @@ function selection({
|
|
|
74118
74109
|
{}
|
|
74119
74110
|
);
|
|
74120
74111
|
}
|
|
74121
|
-
if (
|
|
74112
|
+
if (graphql13.isInterfaceType(fieldType) || graphql13.isUnionType(fieldType)) {
|
|
74122
74113
|
fieldObj.abstract = true;
|
|
74123
74114
|
}
|
|
74124
74115
|
object.fields = {
|
|
@@ -74175,7 +74166,7 @@ function artifactGenerator(stats) {
|
|
|
74175
74166
|
return async function(config2, docs) {
|
|
74176
74167
|
const filterTypes = {};
|
|
74177
74168
|
for (const doc of docs) {
|
|
74178
|
-
|
|
74169
|
+
graphql14.visit(doc.document, {
|
|
74179
74170
|
Directive(node, _, __, ___, ancestors) {
|
|
74180
74171
|
if (node.name.value !== config2.listDirective) {
|
|
74181
74172
|
return;
|
|
@@ -74234,7 +74225,7 @@ function artifactGenerator(stats) {
|
|
|
74234
74225
|
return;
|
|
74235
74226
|
}
|
|
74236
74227
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
74237
|
-
let documentWithoutInternalDirectives =
|
|
74228
|
+
let documentWithoutInternalDirectives = graphql14.visit(document, {
|
|
74238
74229
|
Directive(node) {
|
|
74239
74230
|
if (config2.isInternalDirective(node)) {
|
|
74240
74231
|
return null;
|
|
@@ -74247,7 +74238,7 @@ function artifactGenerator(stats) {
|
|
|
74247
74238
|
}
|
|
74248
74239
|
}
|
|
74249
74240
|
});
|
|
74250
|
-
let documentWithoutExtraVariables =
|
|
74241
|
+
let documentWithoutExtraVariables = graphql14.visit(
|
|
74251
74242
|
documentWithoutInternalDirectives,
|
|
74252
74243
|
{
|
|
74253
74244
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -74258,13 +74249,13 @@ function artifactGenerator(stats) {
|
|
|
74258
74249
|
}
|
|
74259
74250
|
}
|
|
74260
74251
|
);
|
|
74261
|
-
let rawString =
|
|
74252
|
+
let rawString = graphql14.print(documentWithoutExtraVariables);
|
|
74262
74253
|
let docKind = doc.kind;
|
|
74263
74254
|
const operations = document.definitions.filter(
|
|
74264
|
-
({ kind }) => kind ===
|
|
74255
|
+
({ kind }) => kind === graphql14.Kind.OPERATION_DEFINITION
|
|
74265
74256
|
);
|
|
74266
74257
|
const fragments = document.definitions.filter(
|
|
74267
|
-
({ kind }) => kind ===
|
|
74258
|
+
({ kind }) => kind === graphql14.Kind.FRAGMENT_DEFINITION
|
|
74268
74259
|
);
|
|
74269
74260
|
let rootType = "";
|
|
74270
74261
|
let selectionSet;
|
|
@@ -74451,15 +74442,15 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
74451
74442
|
var recast10 = __toESM(require_main2(), 1);
|
|
74452
74443
|
|
|
74453
74444
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
74454
|
-
var
|
|
74445
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
74455
74446
|
var recast8 = __toESM(require_main2(), 1);
|
|
74456
74447
|
|
|
74457
74448
|
// src/codegen/generators/typescript/typeReference.ts
|
|
74458
|
-
var
|
|
74449
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
74459
74450
|
var recast7 = __toESM(require_main2(), 1);
|
|
74460
74451
|
|
|
74461
74452
|
// src/codegen/generators/typescript/types.ts
|
|
74462
|
-
var
|
|
74453
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
74463
74454
|
var recast6 = __toESM(require_main2(), 1);
|
|
74464
74455
|
var AST6 = recast6.types.builders;
|
|
74465
74456
|
function readonlyProperty(prop, enable = true) {
|
|
@@ -74493,7 +74484,7 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
74493
74484
|
return AST6.tsStringKeyword();
|
|
74494
74485
|
}
|
|
74495
74486
|
default: {
|
|
74496
|
-
if (
|
|
74487
|
+
if (graphql15.isNonNullType(target) && "ofType" in target) {
|
|
74497
74488
|
return scalarPropertyValue(
|
|
74498
74489
|
config2,
|
|
74499
74490
|
missingScalars,
|
|
@@ -74514,7 +74505,7 @@ var AST7 = recast7.types.builders;
|
|
|
74514
74505
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
74515
74506
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
74516
74507
|
let result;
|
|
74517
|
-
if (
|
|
74508
|
+
if (graphql16.isScalarType(type)) {
|
|
74518
74509
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
74519
74510
|
} else {
|
|
74520
74511
|
result = AST7.tsTypeReference(AST7.identifier(type.name));
|
|
@@ -74535,17 +74526,17 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
74535
74526
|
var AST8 = recast8.types.builders;
|
|
74536
74527
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
74537
74528
|
const { type } = unwrapType(config2, rootType);
|
|
74538
|
-
if (
|
|
74529
|
+
if (graphql17.isScalarType(type)) {
|
|
74539
74530
|
return;
|
|
74540
74531
|
}
|
|
74541
74532
|
if (visitedTypes.has(type.name)) {
|
|
74542
74533
|
return;
|
|
74543
74534
|
}
|
|
74544
|
-
if (
|
|
74535
|
+
if (graphql17.isUnionType(type)) {
|
|
74545
74536
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
74546
74537
|
}
|
|
74547
74538
|
visitedTypes.add(type.name);
|
|
74548
|
-
if (
|
|
74539
|
+
if (graphql17.isEnumType(type)) {
|
|
74549
74540
|
ensureImports({
|
|
74550
74541
|
config: config2,
|
|
74551
74542
|
body,
|
|
@@ -74562,7 +74553,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
74562
74553
|
AST8.tsPropertySignature(
|
|
74563
74554
|
AST8.identifier(field.name),
|
|
74564
74555
|
AST8.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
74565
|
-
|
|
74556
|
+
graphql17.isNullableType(field.type)
|
|
74566
74557
|
)
|
|
74567
74558
|
);
|
|
74568
74559
|
}
|
|
@@ -74570,7 +74561,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
74570
74561
|
}
|
|
74571
74562
|
|
|
74572
74563
|
// src/codegen/generators/typescript/inlineType.ts
|
|
74573
|
-
var
|
|
74564
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
74574
74565
|
var recast9 = __toESM(require_main2(), 1);
|
|
74575
74566
|
var AST9 = recast9.types.builders;
|
|
74576
74567
|
var fragmentKey = "$fragments";
|
|
@@ -74589,9 +74580,9 @@ function inlineType({
|
|
|
74589
74580
|
}) {
|
|
74590
74581
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
74591
74582
|
let result;
|
|
74592
|
-
if (
|
|
74583
|
+
if (graphql18.isScalarType(type)) {
|
|
74593
74584
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
74594
|
-
} else if (
|
|
74585
|
+
} else if (graphql18.isEnumType(type)) {
|
|
74595
74586
|
if (!visitedTypes.has(type.name)) {
|
|
74596
74587
|
ensureImports({
|
|
74597
74588
|
config: config2,
|
|
@@ -74609,11 +74600,11 @@ function inlineType({
|
|
|
74609
74600
|
for (const selection2 of selections) {
|
|
74610
74601
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
74611
74602
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
74612
|
-
if (!
|
|
74603
|
+
if (!graphql18.isInterfaceType(type) && !graphql18.isUnionType(type)) {
|
|
74613
74604
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
74614
74605
|
continue;
|
|
74615
74606
|
}
|
|
74616
|
-
if (!
|
|
74607
|
+
if (!graphql18.isInterfaceType(fragmentType) && !graphql18.isUnionType(fragmentType)) {
|
|
74617
74608
|
if (!inlineFragments[fragmentType.name]) {
|
|
74618
74609
|
inlineFragments[fragmentType.name] = [];
|
|
74619
74610
|
}
|
|
@@ -74733,7 +74724,7 @@ function inlineType({
|
|
|
74733
74724
|
}
|
|
74734
74725
|
}
|
|
74735
74726
|
}
|
|
74736
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
74727
|
+
if (objectType.type === "TSTypeLiteral" && !graphql18.isInterfaceType(fragmentRootType) && !graphql18.isUnionType(fragmentRootType)) {
|
|
74737
74728
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
74738
74729
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
74739
74730
|
);
|
|
@@ -74800,7 +74791,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
74800
74791
|
},
|
|
74801
74792
|
type: schema.getType("String")
|
|
74802
74793
|
};
|
|
74803
|
-
} else if (
|
|
74794
|
+
} else if (graphql18.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
74804
74795
|
fields = rootType.ofType.getFields();
|
|
74805
74796
|
} else {
|
|
74806
74797
|
fields = rootType.getFields();
|
|
@@ -74812,7 +74803,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
74812
74803
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
74813
74804
|
});
|
|
74814
74805
|
}
|
|
74815
|
-
const fieldType =
|
|
74806
|
+
const fieldType = graphql18.getNamedType(field.type);
|
|
74816
74807
|
if (!fieldType) {
|
|
74817
74808
|
throw new HoudiniError({
|
|
74818
74809
|
filepath,
|
|
@@ -75132,7 +75123,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
75132
75123
|
}
|
|
75133
75124
|
|
|
75134
75125
|
// src/codegen/generators/persistedQueries/index.ts
|
|
75135
|
-
var
|
|
75126
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
75136
75127
|
async function persistOutputGenerator(config2, docs) {
|
|
75137
75128
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
75138
75129
|
return;
|
|
@@ -75144,8 +75135,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75144
75135
|
if (!generateArtifact) {
|
|
75145
75136
|
return acc;
|
|
75146
75137
|
}
|
|
75147
|
-
let rawString =
|
|
75148
|
-
|
|
75138
|
+
let rawString = graphql19.print(
|
|
75139
|
+
graphql19.visit(document, {
|
|
75149
75140
|
Directive(node) {
|
|
75150
75141
|
if (config2.isInternalDirective(node)) {
|
|
75151
75142
|
return null;
|
|
@@ -75154,7 +75145,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75154
75145
|
})
|
|
75155
75146
|
);
|
|
75156
75147
|
const operations = document.definitions.filter(
|
|
75157
|
-
({ kind }) => kind ===
|
|
75148
|
+
({ kind }) => kind === graphql19.Kind.OPERATION_DEFINITION
|
|
75158
75149
|
);
|
|
75159
75150
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
75160
75151
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -75167,11 +75158,11 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75167
75158
|
}
|
|
75168
75159
|
|
|
75169
75160
|
// src/codegen/generators/definitions/enums.ts
|
|
75170
|
-
var
|
|
75161
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
75171
75162
|
var recast11 = __toESM(require_main2(), 1);
|
|
75172
75163
|
var AST11 = recast11.types.builders;
|
|
75173
75164
|
async function definitionsGenerator(config2) {
|
|
75174
|
-
const enums =
|
|
75165
|
+
const enums = graphql20.parse(graphql20.printSchema(config2.schema)).definitions.filter(
|
|
75175
75166
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
75176
75167
|
).filter((def) => !config2.isInternalEnum(def));
|
|
75177
75168
|
const runtimeDefinitions = recast11.print(
|
|
@@ -75344,7 +75335,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
75344
75335
|
}
|
|
75345
75336
|
|
|
75346
75337
|
// src/codegen/transforms/schema.ts
|
|
75347
|
-
var
|
|
75338
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
75348
75339
|
async function graphqlExtensions(config2, documents) {
|
|
75349
75340
|
const internalSchema = `
|
|
75350
75341
|
enum CachePolicy {
|
|
@@ -75422,19 +75413,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
75422
75413
|
"""
|
|
75423
75414
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
75424
75415
|
`;
|
|
75425
|
-
let currentSchema =
|
|
75416
|
+
let currentSchema = graphql22.printSchema(config2.schema);
|
|
75426
75417
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
75427
75418
|
currentSchema += internalSchema;
|
|
75428
75419
|
}
|
|
75429
75420
|
config2.newSchema += internalSchema;
|
|
75430
|
-
config2.schema =
|
|
75421
|
+
config2.schema = graphql22.buildSchema(currentSchema);
|
|
75431
75422
|
}
|
|
75432
75423
|
|
|
75433
75424
|
// src/codegen/transforms/typename.ts
|
|
75434
|
-
var
|
|
75425
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
75435
75426
|
async function addTypename(config2, documents) {
|
|
75436
75427
|
for (const doc of documents) {
|
|
75437
|
-
doc.document =
|
|
75428
|
+
doc.document = graphql23.visit(doc.document, {
|
|
75438
75429
|
Field(node, key, parent, path2, ancestors) {
|
|
75439
75430
|
if (!node.selectionSet) {
|
|
75440
75431
|
return;
|
|
@@ -75446,7 +75437,7 @@ async function addTypename(config2, documents) {
|
|
|
75446
75437
|
);
|
|
75447
75438
|
const field = type.getFields()[node.name.value];
|
|
75448
75439
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75449
|
-
if (
|
|
75440
|
+
if (graphql23.isInterfaceType(fieldType) || graphql23.isUnionType(fieldType)) {
|
|
75450
75441
|
return {
|
|
75451
75442
|
...node,
|
|
75452
75443
|
selectionSet: {
|
|
@@ -75454,9 +75445,9 @@ async function addTypename(config2, documents) {
|
|
|
75454
75445
|
selections: [
|
|
75455
75446
|
...node.selectionSet.selections,
|
|
75456
75447
|
{
|
|
75457
|
-
kind:
|
|
75448
|
+
kind: graphql23.Kind.FIELD,
|
|
75458
75449
|
name: {
|
|
75459
|
-
kind:
|
|
75450
|
+
kind: graphql23.Kind.NAME,
|
|
75460
75451
|
value: "__typename"
|
|
75461
75452
|
}
|
|
75462
75453
|
}
|
|
@@ -75470,10 +75461,10 @@ async function addTypename(config2, documents) {
|
|
|
75470
75461
|
}
|
|
75471
75462
|
|
|
75472
75463
|
// src/codegen/transforms/addID.ts
|
|
75473
|
-
var
|
|
75464
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
75474
75465
|
async function addID(config2, documents) {
|
|
75475
75466
|
for (const doc of documents) {
|
|
75476
|
-
doc.document =
|
|
75467
|
+
doc.document = graphql24.visit(doc.document, {
|
|
75477
75468
|
Field(node, key, parent, path2, ancestors) {
|
|
75478
75469
|
if (!node.selectionSet) {
|
|
75479
75470
|
return;
|
|
@@ -75486,7 +75477,7 @@ async function addID(config2, documents) {
|
|
|
75486
75477
|
const field = type.getFields()[node.name.value];
|
|
75487
75478
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75488
75479
|
if (node.selectionSet?.selections.length > 0) {
|
|
75489
|
-
if (!
|
|
75480
|
+
if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
|
|
75490
75481
|
return;
|
|
75491
75482
|
}
|
|
75492
75483
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -75501,9 +75492,9 @@ async function addID(config2, documents) {
|
|
|
75501
75492
|
continue;
|
|
75502
75493
|
}
|
|
75503
75494
|
selections.push({
|
|
75504
|
-
kind:
|
|
75495
|
+
kind: graphql24.Kind.FIELD,
|
|
75505
75496
|
name: {
|
|
75506
|
-
kind:
|
|
75497
|
+
kind: graphql24.Kind.NAME,
|
|
75507
75498
|
value: keyField
|
|
75508
75499
|
}
|
|
75509
75500
|
});
|
|
@@ -75522,8 +75513,8 @@ async function addID(config2, documents) {
|
|
|
75522
75513
|
}
|
|
75523
75514
|
|
|
75524
75515
|
// src/codegen/transforms/fragmentVariables.ts
|
|
75525
|
-
var
|
|
75526
|
-
var GraphqlKinds2 =
|
|
75516
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
75517
|
+
var GraphqlKinds2 = graphql25.Kind;
|
|
75527
75518
|
async function fragmentVariables(config2, documents) {
|
|
75528
75519
|
const fragments = collectFragments(config2, documents);
|
|
75529
75520
|
const generatedFragments = {};
|
|
@@ -75546,7 +75537,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
75546
75537
|
});
|
|
75547
75538
|
}
|
|
75548
75539
|
const doc = {
|
|
75549
|
-
kind:
|
|
75540
|
+
kind: graphql25.Kind.DOCUMENT,
|
|
75550
75541
|
definitions: Object.values(generatedFragments)
|
|
75551
75542
|
};
|
|
75552
75543
|
documents.push({
|
|
@@ -75582,7 +75573,7 @@ function inlineFragmentArgs({
|
|
|
75582
75573
|
filepath,
|
|
75583
75574
|
document
|
|
75584
75575
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
75585
|
-
const result =
|
|
75576
|
+
const result = graphql25.visit(document, {
|
|
75586
75577
|
FragmentSpread(node) {
|
|
75587
75578
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
75588
75579
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -75670,7 +75661,7 @@ function inlineFragmentArgs({
|
|
|
75670
75661
|
});
|
|
75671
75662
|
if (newName) {
|
|
75672
75663
|
result.name = {
|
|
75673
|
-
kind:
|
|
75664
|
+
kind: graphql25.Kind.NAME,
|
|
75674
75665
|
value: newName
|
|
75675
75666
|
};
|
|
75676
75667
|
}
|
|
@@ -75782,7 +75773,7 @@ function operationScope(operation) {
|
|
|
75782
75773
|
}
|
|
75783
75774
|
|
|
75784
75775
|
// src/codegen/validators/typeCheck.ts
|
|
75785
|
-
var
|
|
75776
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
75786
75777
|
async function typeCheck(config2, docs) {
|
|
75787
75778
|
const errors = [];
|
|
75788
75779
|
const freeLists = [];
|
|
@@ -75790,11 +75781,11 @@ async function typeCheck(config2, docs) {
|
|
|
75790
75781
|
const listTypes = [];
|
|
75791
75782
|
const fragments = {};
|
|
75792
75783
|
for (const { document: parsed, filename } of docs) {
|
|
75793
|
-
|
|
75794
|
-
[
|
|
75784
|
+
graphql26.visit(parsed, {
|
|
75785
|
+
[graphql26.Kind.FRAGMENT_DEFINITION](definition) {
|
|
75795
75786
|
fragments[definition.name.value] = definition;
|
|
75796
75787
|
},
|
|
75797
|
-
[
|
|
75788
|
+
[graphql26.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
75798
75789
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
75799
75790
|
return;
|
|
75800
75791
|
}
|
|
@@ -75840,14 +75831,14 @@ async function typeCheck(config2, docs) {
|
|
|
75840
75831
|
);
|
|
75841
75832
|
return;
|
|
75842
75833
|
}
|
|
75843
|
-
if (
|
|
75834
|
+
if (graphql26.isListType(rootType) || graphql26.isNonNullType(rootType) && graphql26.isListType(rootType.ofType)) {
|
|
75844
75835
|
needsParent = true;
|
|
75845
75836
|
break;
|
|
75846
75837
|
}
|
|
75847
|
-
if (
|
|
75838
|
+
if (graphql26.isNonNullType(rootType) && "ofType" in rootType) {
|
|
75848
75839
|
rootType = rootType.ofType;
|
|
75849
75840
|
}
|
|
75850
|
-
if (
|
|
75841
|
+
if (graphql26.isScalarType(rootType)) {
|
|
75851
75842
|
break;
|
|
75852
75843
|
}
|
|
75853
75844
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -75903,7 +75894,7 @@ async function typeCheck(config2, docs) {
|
|
|
75903
75894
|
);
|
|
75904
75895
|
const targetField = ancestors[ancestors.length - 1];
|
|
75905
75896
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
75906
|
-
const { type, error } = connectionSelection(
|
|
75897
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
75907
75898
|
config2,
|
|
75908
75899
|
targetFieldDefinition,
|
|
75909
75900
|
parentTypeFromAncestors(
|
|
@@ -75913,10 +75904,19 @@ async function typeCheck(config2, docs) {
|
|
|
75913
75904
|
),
|
|
75914
75905
|
targetField.selectionSet
|
|
75915
75906
|
);
|
|
75907
|
+
if (errorConnectionSelection && directive.name.value === config2.paginateDirective) {
|
|
75908
|
+
errors.push(
|
|
75909
|
+
new HoudiniError({
|
|
75910
|
+
filepath: filename,
|
|
75911
|
+
message: errorConnectionSelection,
|
|
75912
|
+
description: errorConnectionSelection
|
|
75913
|
+
})
|
|
75914
|
+
);
|
|
75915
|
+
}
|
|
75916
75916
|
let targetTypes = [type];
|
|
75917
|
-
if (
|
|
75917
|
+
if (graphql26.isUnionType(type)) {
|
|
75918
75918
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
75919
|
-
} else if (
|
|
75919
|
+
} else if (graphql26.isInterfaceType(type)) {
|
|
75920
75920
|
try {
|
|
75921
75921
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
75922
75922
|
if (!type.getFields()[key]) {
|
|
@@ -75930,23 +75930,16 @@ async function typeCheck(config2, docs) {
|
|
|
75930
75930
|
for (const targetType of targetTypes) {
|
|
75931
75931
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
75932
75932
|
if (missingIDFields.length > 0) {
|
|
75933
|
-
|
|
75934
|
-
|
|
75935
|
-
|
|
75936
|
-
|
|
75937
|
-
|
|
75938
|
-
|
|
75939
|
-
|
|
75940
|
-
|
|
75941
|
-
|
|
75942
|
-
|
|
75943
|
-
filepath: filename,
|
|
75944
|
-
message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
75945
|
-
", "
|
|
75946
|
-
)}.`
|
|
75947
|
-
})
|
|
75948
|
-
);
|
|
75949
|
-
}
|
|
75933
|
+
const message = `@${config2.listDirective} on ${logGreen(
|
|
75934
|
+
targetType.name
|
|
75935
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
75936
|
+
errors.push(
|
|
75937
|
+
new HoudiniError({
|
|
75938
|
+
filepath: filename,
|
|
75939
|
+
message,
|
|
75940
|
+
description: message
|
|
75941
|
+
})
|
|
75942
|
+
);
|
|
75950
75943
|
return;
|
|
75951
75944
|
}
|
|
75952
75945
|
}
|
|
@@ -75961,13 +75954,13 @@ async function typeCheck(config2, docs) {
|
|
|
75961
75954
|
if (errors.length > 0) {
|
|
75962
75955
|
throw errors;
|
|
75963
75956
|
}
|
|
75964
|
-
const rules = (filepath) => [...
|
|
75957
|
+
const rules = (filepath) => [...graphql26.specifiedRules].filter(
|
|
75965
75958
|
(rule) => ![
|
|
75966
|
-
|
|
75967
|
-
|
|
75968
|
-
|
|
75969
|
-
|
|
75970
|
-
|
|
75959
|
+
graphql26.NoUnusedFragmentsRule,
|
|
75960
|
+
graphql26.KnownFragmentNamesRule,
|
|
75961
|
+
graphql26.ExecutableDefinitionsRule,
|
|
75962
|
+
graphql26.KnownDirectivesRule,
|
|
75963
|
+
graphql26.KnownArgumentNamesRule
|
|
75971
75964
|
].includes(rule)
|
|
75972
75965
|
).concat(
|
|
75973
75966
|
validateLists({
|
|
@@ -75986,7 +75979,7 @@ async function typeCheck(config2, docs) {
|
|
|
75986
75979
|
noUnusedFragmentArguments(config2)
|
|
75987
75980
|
);
|
|
75988
75981
|
for (const { filename, document: parsed } of docs) {
|
|
75989
|
-
for (const error of
|
|
75982
|
+
for (const error of graphql26.validate(config2.schema, parsed, rules(filename))) {
|
|
75990
75983
|
errors.push(
|
|
75991
75984
|
new HoudiniError({
|
|
75992
75985
|
filepath: filename,
|
|
@@ -76012,7 +76005,7 @@ var validateLists = ({
|
|
|
76012
76005
|
if (!config2.isListFragment(node.name.value)) {
|
|
76013
76006
|
if (!fragments[node.name.value]) {
|
|
76014
76007
|
ctx.reportError(
|
|
76015
|
-
new
|
|
76008
|
+
new graphql26.GraphQLError(
|
|
76016
76009
|
"Encountered unknown fragment: " + node.name.value
|
|
76017
76010
|
)
|
|
76018
76011
|
);
|
|
@@ -76022,7 +76015,7 @@ var validateLists = ({
|
|
|
76022
76015
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
76023
76016
|
if (!lists.includes(listName)) {
|
|
76024
76017
|
ctx.reportError(
|
|
76025
|
-
new
|
|
76018
|
+
new graphql26.GraphQLError(
|
|
76026
76019
|
"Encountered fragment referencing unknown list: " + listName
|
|
76027
76020
|
)
|
|
76028
76021
|
);
|
|
@@ -76047,7 +76040,7 @@ var validateLists = ({
|
|
|
76047
76040
|
);
|
|
76048
76041
|
if (parentArg) {
|
|
76049
76042
|
ctx.reportError(
|
|
76050
|
-
new
|
|
76043
|
+
new graphql26.GraphQLError(
|
|
76051
76044
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
76052
76045
|
)
|
|
76053
76046
|
);
|
|
@@ -76063,7 +76056,7 @@ var validateLists = ({
|
|
|
76063
76056
|
return;
|
|
76064
76057
|
}
|
|
76065
76058
|
ctx.reportError(
|
|
76066
|
-
new
|
|
76059
|
+
new graphql26.GraphQLError(
|
|
76067
76060
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
76068
76061
|
)
|
|
76069
76062
|
);
|
|
@@ -76073,7 +76066,7 @@ var validateLists = ({
|
|
|
76073
76066
|
const directiveName = node.name.value;
|
|
76074
76067
|
if (directiveName === "connection") {
|
|
76075
76068
|
ctx.reportError(
|
|
76076
|
-
new
|
|
76069
|
+
new graphql26.GraphQLError(
|
|
76077
76070
|
"@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."
|
|
76078
76071
|
)
|
|
76079
76072
|
);
|
|
@@ -76082,7 +76075,7 @@ var validateLists = ({
|
|
|
76082
76075
|
if (!config2.isInternalDirective(node)) {
|
|
76083
76076
|
if (!config2.schema.getDirective(directiveName)) {
|
|
76084
76077
|
ctx.reportError(
|
|
76085
|
-
new
|
|
76078
|
+
new graphql26.GraphQLError(
|
|
76086
76079
|
"Encountered unknown directive: " + directiveName
|
|
76087
76080
|
)
|
|
76088
76081
|
);
|
|
@@ -76091,7 +76084,7 @@ var validateLists = ({
|
|
|
76091
76084
|
}
|
|
76092
76085
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
76093
76086
|
ctx.reportError(
|
|
76094
|
-
new
|
|
76087
|
+
new graphql26.GraphQLError(
|
|
76095
76088
|
"Encountered directive referencing unknown list: " + directiveName
|
|
76096
76089
|
)
|
|
76097
76090
|
);
|
|
@@ -76102,7 +76095,7 @@ var validateLists = ({
|
|
|
76102
76095
|
};
|
|
76103
76096
|
function knownArguments(config2) {
|
|
76104
76097
|
return function(ctx) {
|
|
76105
|
-
const nativeValidator =
|
|
76098
|
+
const nativeValidator = graphql26.KnownArgumentNamesRule(ctx);
|
|
76106
76099
|
return {
|
|
76107
76100
|
...nativeValidator,
|
|
76108
76101
|
Directive(directiveNode) {
|
|
@@ -76135,7 +76128,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76135
76128
|
for (const arg of node.arguments || []) {
|
|
76136
76129
|
if (arg.value.kind !== "ObjectValue") {
|
|
76137
76130
|
ctx.reportError(
|
|
76138
|
-
new
|
|
76131
|
+
new graphql26.GraphQLError("values in @arguments must be an object")
|
|
76139
76132
|
);
|
|
76140
76133
|
return;
|
|
76141
76134
|
}
|
|
@@ -76145,13 +76138,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76145
76138
|
);
|
|
76146
76139
|
if (!typeArg) {
|
|
76147
76140
|
ctx.reportError(
|
|
76148
|
-
new
|
|
76141
|
+
new graphql26.GraphQLError("missing type field for @arguments directive")
|
|
76149
76142
|
);
|
|
76150
76143
|
return;
|
|
76151
76144
|
}
|
|
76152
|
-
if (typeArg.value.kind !==
|
|
76145
|
+
if (typeArg.value.kind !== graphql26.Kind.STRING) {
|
|
76153
76146
|
ctx.reportError(
|
|
76154
|
-
new
|
|
76147
|
+
new graphql26.GraphQLError("type field to @arguments must be a string")
|
|
76155
76148
|
);
|
|
76156
76149
|
return;
|
|
76157
76150
|
}
|
|
@@ -76164,7 +76157,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76164
76157
|
);
|
|
76165
76158
|
if (typeArg.value.value !== defaultValueType) {
|
|
76166
76159
|
ctx.reportError(
|
|
76167
|
-
new
|
|
76160
|
+
new graphql26.GraphQLError(
|
|
76168
76161
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
76169
76162
|
)
|
|
76170
76163
|
);
|
|
@@ -76182,7 +76175,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76182
76175
|
try {
|
|
76183
76176
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
76184
76177
|
} catch (e2) {
|
|
76185
|
-
ctx.reportError(new
|
|
76178
|
+
ctx.reportError(new graphql26.GraphQLError(e2.message));
|
|
76186
76179
|
return;
|
|
76187
76180
|
}
|
|
76188
76181
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -76205,7 +76198,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76205
76198
|
);
|
|
76206
76199
|
if (missing.length > 0) {
|
|
76207
76200
|
ctx.reportError(
|
|
76208
|
-
new
|
|
76201
|
+
new graphql26.GraphQLError(
|
|
76209
76202
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
76210
76203
|
)
|
|
76211
76204
|
);
|
|
@@ -76216,7 +76209,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76216
76209
|
);
|
|
76217
76210
|
if (unknown.length > 0) {
|
|
76218
76211
|
ctx.reportError(
|
|
76219
|
-
new
|
|
76212
|
+
new graphql26.GraphQLError(
|
|
76220
76213
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
76221
76214
|
)
|
|
76222
76215
|
);
|
|
@@ -76228,7 +76221,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76228
76221
|
]
|
|
76229
76222
|
);
|
|
76230
76223
|
for (const [applied, target] of zipped) {
|
|
76231
|
-
if (applied.value.kind ===
|
|
76224
|
+
if (applied.value.kind === graphql26.Kind.VARIABLE || applied.value.kind === graphql26.Kind.LIST || applied.value.kind === graphql26.Kind.OBJECT) {
|
|
76232
76225
|
continue;
|
|
76233
76226
|
}
|
|
76234
76227
|
const appliedType = applied.value.kind.substring(
|
|
@@ -76237,7 +76230,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76237
76230
|
);
|
|
76238
76231
|
if (appliedType !== target) {
|
|
76239
76232
|
ctx.reportError(
|
|
76240
|
-
new
|
|
76233
|
+
new graphql26.GraphQLError(
|
|
76241
76234
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
76242
76235
|
)
|
|
76243
76236
|
);
|
|
@@ -76258,7 +76251,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76258
76251
|
}
|
|
76259
76252
|
if (alreadyPaginated) {
|
|
76260
76253
|
ctx.reportError(
|
|
76261
|
-
new
|
|
76254
|
+
new graphql26.GraphQLError(
|
|
76262
76255
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
76263
76256
|
)
|
|
76264
76257
|
);
|
|
@@ -76273,7 +76266,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76273
76266
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
76274
76267
|
if (hasRequiredArgs) {
|
|
76275
76268
|
ctx.reportError(
|
|
76276
|
-
new
|
|
76269
|
+
new graphql26.GraphQLError(
|
|
76277
76270
|
"@paginate cannot appear on a document with required args"
|
|
76278
76271
|
)
|
|
76279
76272
|
);
|
|
@@ -76305,14 +76298,14 @@ function paginateArgs(config2, filepath) {
|
|
|
76305
76298
|
const backwards = appliedArgs.has("last");
|
|
76306
76299
|
if (!forward && !backwards) {
|
|
76307
76300
|
ctx.reportError(
|
|
76308
|
-
new
|
|
76301
|
+
new graphql26.GraphQLError(
|
|
76309
76302
|
"A field with cursor-based pagination must have a first or last argument"
|
|
76310
76303
|
)
|
|
76311
76304
|
);
|
|
76312
76305
|
}
|
|
76313
76306
|
if (forward && backwards) {
|
|
76314
76307
|
ctx.reportError(
|
|
76315
|
-
new
|
|
76308
|
+
new graphql26.GraphQLError(
|
|
76316
76309
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
76317
76310
|
)
|
|
76318
76311
|
);
|
|
@@ -76326,7 +76319,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76326
76319
|
);
|
|
76327
76320
|
if (!appliedLimitArg) {
|
|
76328
76321
|
ctx.reportError(
|
|
76329
|
-
new
|
|
76322
|
+
new graphql26.GraphQLError(
|
|
76330
76323
|
"A field with offset-based pagination must have a limit argument"
|
|
76331
76324
|
)
|
|
76332
76325
|
);
|
|
@@ -76342,20 +76335,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
76342
76335
|
const args = /* @__PURE__ */ new Set();
|
|
76343
76336
|
return {
|
|
76344
76337
|
enter(node) {
|
|
76345
|
-
if (node.kind ===
|
|
76338
|
+
if (node.kind === graphql26.Kind.FRAGMENT_DEFINITION) {
|
|
76346
76339
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
76347
76340
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
76348
76341
|
args.add(arg);
|
|
76349
76342
|
}
|
|
76350
|
-
} else if (node.kind ===
|
|
76343
|
+
} else if (node.kind === graphql26.Kind.VARIABLE) {
|
|
76351
76344
|
args.delete(node.name.value);
|
|
76352
76345
|
}
|
|
76353
76346
|
},
|
|
76354
76347
|
leave(node) {
|
|
76355
|
-
if (node.kind ===
|
|
76348
|
+
if (node.kind === graphql26.Kind.FRAGMENT_DEFINITION) {
|
|
76356
76349
|
if (args.size > 0) {
|
|
76357
76350
|
ctx.reportError(
|
|
76358
|
-
new
|
|
76351
|
+
new graphql26.GraphQLError(
|
|
76359
76352
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
76360
76353
|
)
|
|
76361
76354
|
);
|
|
@@ -76391,7 +76384,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76391
76384
|
if (definition.kind === "OperationDefinition") {
|
|
76392
76385
|
if (definition.operation !== "query") {
|
|
76393
76386
|
ctx.reportError(
|
|
76394
|
-
new
|
|
76387
|
+
new graphql26.GraphQLError(
|
|
76395
76388
|
`@${node.name.value} must fall on a fragment or query document`
|
|
76396
76389
|
)
|
|
76397
76390
|
);
|
|
@@ -76403,7 +76396,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76403
76396
|
}
|
|
76404
76397
|
if (!possibleNodes.includes(definitionType)) {
|
|
76405
76398
|
ctx.reportError(
|
|
76406
|
-
new
|
|
76399
|
+
new graphql26.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
76407
76400
|
);
|
|
76408
76401
|
}
|
|
76409
76402
|
}
|
|
@@ -76422,7 +76415,7 @@ function checkMutationOperation(config2) {
|
|
|
76422
76415
|
);
|
|
76423
76416
|
if (append && prepend) {
|
|
76424
76417
|
ctx.reportError(
|
|
76425
|
-
new
|
|
76418
|
+
new graphql26.GraphQLError(
|
|
76426
76419
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
76427
76420
|
)
|
|
76428
76421
|
);
|
|
@@ -76436,7 +76429,7 @@ function checkMutationOperation(config2) {
|
|
|
76436
76429
|
);
|
|
76437
76430
|
if (parentId && allLists) {
|
|
76438
76431
|
ctx.reportError(
|
|
76439
|
-
new
|
|
76432
|
+
new graphql26.GraphQLError(
|
|
76440
76433
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
76441
76434
|
)
|
|
76442
76435
|
);
|
|
@@ -76458,7 +76451,7 @@ function checkMaskDirective(config2) {
|
|
|
76458
76451
|
);
|
|
76459
76452
|
if (maskEnableDirective && maskDisableDirective) {
|
|
76460
76453
|
ctx.reportError(
|
|
76461
|
-
new
|
|
76454
|
+
new graphql26.GraphQLError(
|
|
76462
76455
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
76463
76456
|
)
|
|
76464
76457
|
);
|
|
@@ -76474,7 +76467,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
76474
76467
|
if (!nodeInterface) {
|
|
76475
76468
|
return null;
|
|
76476
76469
|
}
|
|
76477
|
-
if (!
|
|
76470
|
+
if (!graphql26.isInterfaceType(nodeInterface)) {
|
|
76478
76471
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
76479
76472
|
return null;
|
|
76480
76473
|
}
|
|
@@ -76572,11 +76565,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
76572
76565
|
}
|
|
76573
76566
|
|
|
76574
76567
|
// src/codegen/validators/noIDAlias.ts
|
|
76575
|
-
var
|
|
76568
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
76576
76569
|
async function noIDAlias(config2, docs) {
|
|
76577
76570
|
const errors = [];
|
|
76578
76571
|
for (const { filename, document } of docs) {
|
|
76579
|
-
|
|
76572
|
+
graphql27.visit(document, {
|
|
76580
76573
|
Field(node, _, __, ___, ancestors) {
|
|
76581
76574
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
76582
76575
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -76774,12 +76767,12 @@ async function processJSFile(config2, contents) {
|
|
|
76774
76767
|
return documents;
|
|
76775
76768
|
}
|
|
76776
76769
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
76777
|
-
const parsedDoc =
|
|
76770
|
+
const parsedDoc = graphql28.parse(document);
|
|
76778
76771
|
const operations = parsedDoc.definitions.filter(
|
|
76779
|
-
({ kind: kind2 }) => kind2 ===
|
|
76772
|
+
({ kind: kind2 }) => kind2 === graphql28.Kind.OPERATION_DEFINITION
|
|
76780
76773
|
);
|
|
76781
76774
|
const fragments = parsedDoc.definitions.filter(
|
|
76782
|
-
({ kind: kind2 }) => kind2 ===
|
|
76775
|
+
({ kind: kind2 }) => kind2 === graphql28.Kind.FRAGMENT_DEFINITION
|
|
76783
76776
|
);
|
|
76784
76777
|
if (operations.length > 1) {
|
|
76785
76778
|
throw new HoudiniError({
|
|
@@ -77318,8 +77311,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
77318
77311
|
}
|
|
77319
77312
|
packageJSON.devDependencies = {
|
|
77320
77313
|
...packageJSON.devDependencies,
|
|
77321
|
-
houdini: "^0.18.
|
|
77322
|
-
"houdini-svelte": "^0.18.
|
|
77314
|
+
houdini: "^0.18.3",
|
|
77315
|
+
"houdini-svelte": "^0.18.3",
|
|
77323
77316
|
graphql: "^15.8.0"
|
|
77324
77317
|
};
|
|
77325
77318
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|