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
|
@@ -529,7 +529,7 @@ var require_kinds = __commonJS({
|
|
|
529
529
|
value: true
|
|
530
530
|
});
|
|
531
531
|
exports.Kind = void 0;
|
|
532
|
-
var
|
|
532
|
+
var Kind13 = Object.freeze({
|
|
533
533
|
NAME: "Name",
|
|
534
534
|
DOCUMENT: "Document",
|
|
535
535
|
OPERATION_DEFINITION: "OperationDefinition",
|
|
@@ -574,7 +574,7 @@ var require_kinds = __commonJS({
|
|
|
574
574
|
ENUM_TYPE_EXTENSION: "EnumTypeExtension",
|
|
575
575
|
INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension"
|
|
576
576
|
});
|
|
577
|
-
exports.Kind =
|
|
577
|
+
exports.Kind = Kind13;
|
|
578
578
|
}
|
|
579
579
|
});
|
|
580
580
|
|
|
@@ -9754,7 +9754,7 @@ var require_graphql = __commonJS({
|
|
|
9754
9754
|
Object.defineProperty(exports, "__esModule", {
|
|
9755
9755
|
value: true
|
|
9756
9756
|
});
|
|
9757
|
-
exports.graphql =
|
|
9757
|
+
exports.graphql = graphql27;
|
|
9758
9758
|
exports.graphqlSync = graphqlSync;
|
|
9759
9759
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
9760
9760
|
var _parser = require_parser();
|
|
@@ -9764,7 +9764,7 @@ var require_graphql = __commonJS({
|
|
|
9764
9764
|
function _interopRequireDefault(obj) {
|
|
9765
9765
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
9766
9766
|
}
|
|
9767
|
-
function
|
|
9767
|
+
function graphql27(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
9768
9768
|
var _arguments = arguments;
|
|
9769
9769
|
return new Promise(function(resolve2) {
|
|
9770
9770
|
return resolve2(
|
|
@@ -53923,7 +53923,7 @@ __export(codegen_exports, {
|
|
|
53923
53923
|
runPipeline: () => runPipeline2
|
|
53924
53924
|
});
|
|
53925
53925
|
module.exports = __toCommonJS(codegen_exports);
|
|
53926
|
-
var
|
|
53926
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
53927
53927
|
|
|
53928
53928
|
// src/lib/pipeline.ts
|
|
53929
53929
|
async function runPipeline(config2, pipeline, target) {
|
|
@@ -56252,7 +56252,7 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
56252
56252
|
}
|
|
56253
56253
|
|
|
56254
56254
|
// src/codegen/generators/artifacts/index.ts
|
|
56255
|
-
var
|
|
56255
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
56256
56256
|
var recast5 = __toESM(require_main2(), 1);
|
|
56257
56257
|
|
|
56258
56258
|
// src/codegen/utils/commonjs.ts
|
|
@@ -56856,7 +56856,7 @@ function ancestorKey(ancestors) {
|
|
|
56856
56856
|
}
|
|
56857
56857
|
|
|
56858
56858
|
// src/codegen/generators/artifacts/selection.ts
|
|
56859
|
-
var
|
|
56859
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
56860
56860
|
|
|
56861
56861
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
56862
56862
|
var config = {
|
|
@@ -56896,10 +56896,24 @@ function logYellow(str) {
|
|
|
56896
56896
|
}
|
|
56897
56897
|
|
|
56898
56898
|
// src/codegen/transforms/list.ts
|
|
56899
|
-
var
|
|
56899
|
+
var graphql9 = __toESM(require_graphql2(), 1);
|
|
56900
56900
|
|
|
56901
|
-
// src/codegen/
|
|
56901
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
56902
56902
|
var graphql7 = __toESM(require_graphql2(), 1);
|
|
56903
|
+
var objectIdentificationSelection = (config2, type) => {
|
|
56904
|
+
return config2.keyFieldsForType(type.name).map((key) => {
|
|
56905
|
+
return {
|
|
56906
|
+
kind: graphql7.Kind.FIELD,
|
|
56907
|
+
name: {
|
|
56908
|
+
kind: graphql7.Kind.NAME,
|
|
56909
|
+
value: key
|
|
56910
|
+
}
|
|
56911
|
+
};
|
|
56912
|
+
});
|
|
56913
|
+
};
|
|
56914
|
+
|
|
56915
|
+
// src/codegen/transforms/paginate.ts
|
|
56916
|
+
var graphql8 = __toESM(require_graphql2(), 1);
|
|
56903
56917
|
async function paginate(config2, documents) {
|
|
56904
56918
|
const newDocs = [];
|
|
56905
56919
|
for (const doc of documents) {
|
|
@@ -56932,7 +56946,7 @@ async function paginate(config2, documents) {
|
|
|
56932
56946
|
};
|
|
56933
56947
|
let cursorType = "String";
|
|
56934
56948
|
let paginationPath = [];
|
|
56935
|
-
doc.document =
|
|
56949
|
+
doc.document = graphql8.visit(doc.document, {
|
|
56936
56950
|
Field(node, _, __, ___, ancestors) {
|
|
56937
56951
|
const paginateDirective = node.directives?.find(
|
|
56938
56952
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -56959,7 +56973,7 @@ async function paginate(config2, documents) {
|
|
|
56959
56973
|
flags.offset.enabled = offsetPagination;
|
|
56960
56974
|
flags.limit.enabled = offsetPagination;
|
|
56961
56975
|
paginationPath = ancestors.filter(
|
|
56962
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
56976
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql8.Kind.FIELD
|
|
56963
56977
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
56964
56978
|
return {
|
|
56965
56979
|
...node,
|
|
@@ -56980,7 +56994,7 @@ async function paginate(config2, documents) {
|
|
|
56980
56994
|
refetchUpdate = "prepend" /* prepend */;
|
|
56981
56995
|
}
|
|
56982
56996
|
let fragment = "";
|
|
56983
|
-
doc.document =
|
|
56997
|
+
doc.document = graphql8.visit(doc.document, {
|
|
56984
56998
|
OperationDefinition(node) {
|
|
56985
56999
|
if (node.operation !== "query") {
|
|
56986
57000
|
throw new HoudiniError({
|
|
@@ -57034,9 +57048,9 @@ async function paginate(config2, documents) {
|
|
|
57034
57048
|
directives: [
|
|
57035
57049
|
...node.directives || [],
|
|
57036
57050
|
{
|
|
57037
|
-
kind:
|
|
57051
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57038
57052
|
name: {
|
|
57039
|
-
kind:
|
|
57053
|
+
kind: graphql8.Kind.NAME,
|
|
57040
57054
|
value: config2.argumentsDirective
|
|
57041
57055
|
}
|
|
57042
57056
|
}
|
|
@@ -57099,16 +57113,16 @@ async function paginate(config2, documents) {
|
|
|
57099
57113
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
57100
57114
|
const fragmentSpreadSelection = [
|
|
57101
57115
|
{
|
|
57102
|
-
kind:
|
|
57116
|
+
kind: graphql8.Kind.FRAGMENT_SPREAD,
|
|
57103
57117
|
name: {
|
|
57104
|
-
kind:
|
|
57118
|
+
kind: graphql8.Kind.NAME,
|
|
57105
57119
|
value: fragmentName
|
|
57106
57120
|
},
|
|
57107
57121
|
directives: [
|
|
57108
57122
|
{
|
|
57109
|
-
kind:
|
|
57123
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57110
57124
|
name: {
|
|
57111
|
-
kind:
|
|
57125
|
+
kind: graphql8.Kind.NAME,
|
|
57112
57126
|
value: config2.withDirective
|
|
57113
57127
|
},
|
|
57114
57128
|
["arguments"]: paginationArgs.map(
|
|
@@ -57136,29 +57150,29 @@ async function paginate(config2, documents) {
|
|
|
57136
57150
|
});
|
|
57137
57151
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
57138
57152
|
const queryDoc = {
|
|
57139
|
-
kind:
|
|
57153
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
57140
57154
|
definitions: [
|
|
57141
57155
|
{
|
|
57142
|
-
kind:
|
|
57156
|
+
kind: graphql8.Kind.OPERATION_DEFINITION,
|
|
57143
57157
|
name: {
|
|
57144
|
-
kind:
|
|
57158
|
+
kind: graphql8.Kind.NAME,
|
|
57145
57159
|
value: refetchQueryName
|
|
57146
57160
|
},
|
|
57147
57161
|
operation: "query",
|
|
57148
57162
|
variableDefinitions: paginationArgs.map(
|
|
57149
57163
|
(arg) => ({
|
|
57150
|
-
kind:
|
|
57164
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57151
57165
|
type: {
|
|
57152
|
-
kind:
|
|
57166
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57153
57167
|
name: {
|
|
57154
|
-
kind:
|
|
57168
|
+
kind: graphql8.Kind.NAME,
|
|
57155
57169
|
value: arg.type
|
|
57156
57170
|
}
|
|
57157
57171
|
},
|
|
57158
57172
|
variable: {
|
|
57159
|
-
kind:
|
|
57173
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57160
57174
|
name: {
|
|
57161
|
-
kind:
|
|
57175
|
+
kind: graphql8.Kind.NAME,
|
|
57162
57176
|
value: arg.name
|
|
57163
57177
|
}
|
|
57164
57178
|
},
|
|
@@ -57170,12 +57184,12 @@ async function paginate(config2, documents) {
|
|
|
57170
57184
|
).concat(
|
|
57171
57185
|
!nodeQuery ? [] : keys.map(
|
|
57172
57186
|
(key) => ({
|
|
57173
|
-
kind:
|
|
57187
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57174
57188
|
type: key.type,
|
|
57175
57189
|
variable: {
|
|
57176
|
-
kind:
|
|
57190
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57177
57191
|
name: {
|
|
57178
|
-
kind:
|
|
57192
|
+
kind: graphql8.Kind.NAME,
|
|
57179
57193
|
value: key.name
|
|
57180
57194
|
}
|
|
57181
57195
|
}
|
|
@@ -57183,42 +57197,42 @@ async function paginate(config2, documents) {
|
|
|
57183
57197
|
)
|
|
57184
57198
|
),
|
|
57185
57199
|
selectionSet: {
|
|
57186
|
-
kind:
|
|
57200
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57187
57201
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
57188
57202
|
{
|
|
57189
|
-
kind:
|
|
57203
|
+
kind: graphql8.Kind.FIELD,
|
|
57190
57204
|
name: {
|
|
57191
|
-
kind:
|
|
57205
|
+
kind: graphql8.Kind.NAME,
|
|
57192
57206
|
value: typeConfig?.resolve?.queryField || "node"
|
|
57193
57207
|
},
|
|
57194
57208
|
["arguments"]: keys.map((key) => ({
|
|
57195
|
-
kind:
|
|
57209
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57196
57210
|
name: {
|
|
57197
|
-
kind:
|
|
57211
|
+
kind: graphql8.Kind.NAME,
|
|
57198
57212
|
value: key.name
|
|
57199
57213
|
},
|
|
57200
57214
|
value: {
|
|
57201
|
-
kind:
|
|
57215
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57202
57216
|
name: {
|
|
57203
|
-
kind:
|
|
57217
|
+
kind: graphql8.Kind.NAME,
|
|
57204
57218
|
value: key.name
|
|
57205
57219
|
}
|
|
57206
57220
|
}
|
|
57207
57221
|
})),
|
|
57208
57222
|
selectionSet: {
|
|
57209
|
-
kind:
|
|
57223
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57210
57224
|
selections: [
|
|
57211
57225
|
{
|
|
57212
|
-
kind:
|
|
57226
|
+
kind: graphql8.Kind.FIELD,
|
|
57213
57227
|
name: {
|
|
57214
|
-
kind:
|
|
57228
|
+
kind: graphql8.Kind.NAME,
|
|
57215
57229
|
value: "__typename"
|
|
57216
57230
|
}
|
|
57217
57231
|
},
|
|
57218
57232
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
57219
|
-
kind:
|
|
57233
|
+
kind: graphql8.Kind.FIELD,
|
|
57220
57234
|
name: {
|
|
57221
|
-
kind:
|
|
57235
|
+
kind: graphql8.Kind.NAME,
|
|
57222
57236
|
value: key
|
|
57223
57237
|
}
|
|
57224
57238
|
})),
|
|
@@ -57280,15 +57294,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
57280
57294
|
}
|
|
57281
57295
|
function variableAsArgument(name2, variable) {
|
|
57282
57296
|
return {
|
|
57283
|
-
kind:
|
|
57297
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57284
57298
|
name: {
|
|
57285
|
-
kind:
|
|
57299
|
+
kind: graphql8.Kind.NAME,
|
|
57286
57300
|
value: name2
|
|
57287
57301
|
},
|
|
57288
57302
|
value: {
|
|
57289
|
-
kind:
|
|
57303
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57290
57304
|
name: {
|
|
57291
|
-
kind:
|
|
57305
|
+
kind: graphql8.Kind.NAME,
|
|
57292
57306
|
value: variable ?? name2
|
|
57293
57307
|
}
|
|
57294
57308
|
}
|
|
@@ -57296,18 +57310,18 @@ function variableAsArgument(name2, variable) {
|
|
|
57296
57310
|
}
|
|
57297
57311
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
57298
57312
|
return {
|
|
57299
|
-
kind:
|
|
57313
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57300
57314
|
type: {
|
|
57301
|
-
kind:
|
|
57315
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57302
57316
|
name: {
|
|
57303
|
-
kind:
|
|
57317
|
+
kind: graphql8.Kind.NAME,
|
|
57304
57318
|
value: type
|
|
57305
57319
|
}
|
|
57306
57320
|
},
|
|
57307
57321
|
variable: {
|
|
57308
|
-
kind:
|
|
57322
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57309
57323
|
name: {
|
|
57310
|
-
kind:
|
|
57324
|
+
kind: graphql8.Kind.NAME,
|
|
57311
57325
|
value: variableName ?? name2
|
|
57312
57326
|
}
|
|
57313
57327
|
},
|
|
@@ -57319,9 +57333,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
57319
57333
|
}
|
|
57320
57334
|
function argumentNode(name2, value) {
|
|
57321
57335
|
return {
|
|
57322
|
-
kind:
|
|
57336
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57323
57337
|
name: {
|
|
57324
|
-
kind:
|
|
57338
|
+
kind: graphql8.Kind.NAME,
|
|
57325
57339
|
value: name2
|
|
57326
57340
|
},
|
|
57327
57341
|
value: objectNode(value)
|
|
@@ -57329,16 +57343,16 @@ function argumentNode(name2, value) {
|
|
|
57329
57343
|
}
|
|
57330
57344
|
function objectNode([type, defaultValue]) {
|
|
57331
57345
|
const node = {
|
|
57332
|
-
kind:
|
|
57346
|
+
kind: graphql8.Kind.OBJECT,
|
|
57333
57347
|
fields: [
|
|
57334
57348
|
{
|
|
57335
|
-
kind:
|
|
57349
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57336
57350
|
name: {
|
|
57337
|
-
kind:
|
|
57351
|
+
kind: graphql8.Kind.NAME,
|
|
57338
57352
|
value: "type"
|
|
57339
57353
|
},
|
|
57340
57354
|
value: {
|
|
57341
|
-
kind:
|
|
57355
|
+
kind: graphql8.Kind.STRING,
|
|
57342
57356
|
value: type
|
|
57343
57357
|
}
|
|
57344
57358
|
}
|
|
@@ -57346,8 +57360,8 @@ function objectNode([type, defaultValue]) {
|
|
|
57346
57360
|
};
|
|
57347
57361
|
if (defaultValue) {
|
|
57348
57362
|
node.fields.push({
|
|
57349
|
-
kind:
|
|
57350
|
-
name: { kind:
|
|
57363
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57364
|
+
name: { kind: graphql8.Kind.NAME, value: "default" },
|
|
57351
57365
|
value: {
|
|
57352
57366
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
57353
57367
|
value: defaultValue.toString()
|
|
@@ -57358,34 +57372,34 @@ function objectNode([type, defaultValue]) {
|
|
|
57358
57372
|
}
|
|
57359
57373
|
var pageInfoSelection = [
|
|
57360
57374
|
{
|
|
57361
|
-
kind:
|
|
57375
|
+
kind: graphql8.Kind.FIELD,
|
|
57362
57376
|
name: {
|
|
57363
|
-
kind:
|
|
57377
|
+
kind: graphql8.Kind.NAME,
|
|
57364
57378
|
value: "edges"
|
|
57365
57379
|
},
|
|
57366
57380
|
selectionSet: {
|
|
57367
|
-
kind:
|
|
57381
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57368
57382
|
selections: [
|
|
57369
57383
|
{
|
|
57370
|
-
kind:
|
|
57384
|
+
kind: graphql8.Kind.FIELD,
|
|
57371
57385
|
name: {
|
|
57372
|
-
kind:
|
|
57386
|
+
kind: graphql8.Kind.NAME,
|
|
57373
57387
|
value: "cursor"
|
|
57374
57388
|
}
|
|
57375
57389
|
},
|
|
57376
57390
|
{
|
|
57377
|
-
kind:
|
|
57391
|
+
kind: graphql8.Kind.FIELD,
|
|
57378
57392
|
name: {
|
|
57379
|
-
kind:
|
|
57393
|
+
kind: graphql8.Kind.NAME,
|
|
57380
57394
|
value: "node"
|
|
57381
57395
|
},
|
|
57382
57396
|
selectionSet: {
|
|
57383
|
-
kind:
|
|
57397
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57384
57398
|
selections: [
|
|
57385
57399
|
{
|
|
57386
|
-
kind:
|
|
57400
|
+
kind: graphql8.Kind.FIELD,
|
|
57387
57401
|
name: {
|
|
57388
|
-
kind:
|
|
57402
|
+
kind: graphql8.Kind.NAME,
|
|
57389
57403
|
value: "__typename"
|
|
57390
57404
|
}
|
|
57391
57405
|
}
|
|
@@ -57396,39 +57410,39 @@ var pageInfoSelection = [
|
|
|
57396
57410
|
}
|
|
57397
57411
|
},
|
|
57398
57412
|
{
|
|
57399
|
-
kind:
|
|
57413
|
+
kind: graphql8.Kind.FIELD,
|
|
57400
57414
|
name: {
|
|
57401
|
-
kind:
|
|
57415
|
+
kind: graphql8.Kind.NAME,
|
|
57402
57416
|
value: "pageInfo"
|
|
57403
57417
|
},
|
|
57404
57418
|
selectionSet: {
|
|
57405
|
-
kind:
|
|
57419
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57406
57420
|
selections: [
|
|
57407
57421
|
{
|
|
57408
|
-
kind:
|
|
57422
|
+
kind: graphql8.Kind.FIELD,
|
|
57409
57423
|
name: {
|
|
57410
|
-
kind:
|
|
57424
|
+
kind: graphql8.Kind.NAME,
|
|
57411
57425
|
value: "hasPreviousPage"
|
|
57412
57426
|
}
|
|
57413
57427
|
},
|
|
57414
57428
|
{
|
|
57415
|
-
kind:
|
|
57429
|
+
kind: graphql8.Kind.FIELD,
|
|
57416
57430
|
name: {
|
|
57417
|
-
kind:
|
|
57431
|
+
kind: graphql8.Kind.NAME,
|
|
57418
57432
|
value: "hasNextPage"
|
|
57419
57433
|
}
|
|
57420
57434
|
},
|
|
57421
57435
|
{
|
|
57422
|
-
kind:
|
|
57436
|
+
kind: graphql8.Kind.FIELD,
|
|
57423
57437
|
name: {
|
|
57424
|
-
kind:
|
|
57438
|
+
kind: graphql8.Kind.NAME,
|
|
57425
57439
|
value: "startCursor"
|
|
57426
57440
|
}
|
|
57427
57441
|
},
|
|
57428
57442
|
{
|
|
57429
|
-
kind:
|
|
57443
|
+
kind: graphql8.Kind.FIELD,
|
|
57430
57444
|
name: {
|
|
57431
|
-
kind:
|
|
57445
|
+
kind: graphql8.Kind.NAME,
|
|
57432
57446
|
value: "endCursor"
|
|
57433
57447
|
}
|
|
57434
57448
|
}
|
|
@@ -57442,15 +57456,15 @@ async function addListFragments(config2, documents) {
|
|
|
57442
57456
|
const lists = {};
|
|
57443
57457
|
const errors = [];
|
|
57444
57458
|
for (const doc of documents) {
|
|
57445
|
-
doc.document =
|
|
57459
|
+
doc.document = graphql9.visit(doc.document, {
|
|
57446
57460
|
Directive(node, key, parent, path2, ancestors) {
|
|
57447
57461
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
57448
57462
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
57449
57463
|
let error = {
|
|
57450
|
-
...new
|
|
57464
|
+
...new graphql9.GraphQLError(
|
|
57451
57465
|
"",
|
|
57452
57466
|
node,
|
|
57453
|
-
new
|
|
57467
|
+
new graphql9.Source(""),
|
|
57454
57468
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
57455
57469
|
path2
|
|
57456
57470
|
),
|
|
@@ -57502,7 +57516,7 @@ async function addListFragments(config2, documents) {
|
|
|
57502
57516
|
{
|
|
57503
57517
|
kind: "Argument",
|
|
57504
57518
|
name: {
|
|
57505
|
-
kind:
|
|
57519
|
+
kind: graphql9.Kind.NAME,
|
|
57506
57520
|
value: "connection"
|
|
57507
57521
|
},
|
|
57508
57522
|
value: {
|
|
@@ -57549,10 +57563,13 @@ async function addListFragments(config2, documents) {
|
|
|
57549
57563
|
if (errors.length > 0) {
|
|
57550
57564
|
throw errors;
|
|
57551
57565
|
}
|
|
57552
|
-
const
|
|
57566
|
+
const validDeletes = [
|
|
57553
57567
|
...new Set(
|
|
57554
57568
|
Object.values(lists).map(({ type }) => {
|
|
57555
|
-
if (!(type instanceof
|
|
57569
|
+
if (!(type instanceof graphql9.GraphQLObjectType)) {
|
|
57570
|
+
return "";
|
|
57571
|
+
}
|
|
57572
|
+
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
57556
57573
|
return "";
|
|
57557
57574
|
}
|
|
57558
57575
|
return type.name;
|
|
@@ -57563,7 +57580,7 @@ async function addListFragments(config2, documents) {
|
|
|
57563
57580
|
return;
|
|
57564
57581
|
}
|
|
57565
57582
|
const generatedDoc = {
|
|
57566
|
-
kind:
|
|
57583
|
+
kind: graphql9.Kind.DOCUMENT,
|
|
57567
57584
|
definitions: Object.entries(lists).flatMap(
|
|
57568
57585
|
([name2, { selection: selection2, type }]) => {
|
|
57569
57586
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -57571,35 +57588,29 @@ async function addListFragments(config2, documents) {
|
|
|
57571
57588
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
57572
57589
|
}
|
|
57573
57590
|
const fragmentSelection = {
|
|
57574
|
-
kind:
|
|
57591
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57575
57592
|
selections: [...selection2.selections]
|
|
57576
57593
|
};
|
|
57577
57594
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
57578
|
-
(field) => field.kind === "Field" && field.name.value
|
|
57595
|
+
(field) => field.kind === "Field" && config2.keyFieldsForType(type.name).includes(field.name.value)
|
|
57579
57596
|
)) {
|
|
57580
57597
|
fragmentSelection.selections = [
|
|
57581
57598
|
...fragmentSelection.selections,
|
|
57582
|
-
|
|
57583
|
-
kind: graphql8.Kind.FIELD,
|
|
57584
|
-
name: {
|
|
57585
|
-
kind: graphql8.Kind.NAME,
|
|
57586
|
-
value: "id"
|
|
57587
|
-
}
|
|
57588
|
-
}
|
|
57599
|
+
...objectIdentificationSelection(config2, type)
|
|
57589
57600
|
];
|
|
57590
57601
|
}
|
|
57591
57602
|
return [
|
|
57592
57603
|
{
|
|
57593
57604
|
name: {
|
|
57594
57605
|
value: config2.listInsertFragment(name2),
|
|
57595
|
-
kind:
|
|
57606
|
+
kind: graphql9.Kind.NAME
|
|
57596
57607
|
},
|
|
57597
|
-
kind:
|
|
57608
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57598
57609
|
selectionSet: fragmentSelection,
|
|
57599
57610
|
typeCondition: {
|
|
57600
|
-
kind:
|
|
57611
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57601
57612
|
name: {
|
|
57602
|
-
kind:
|
|
57613
|
+
kind: graphql9.Kind.NAME,
|
|
57603
57614
|
value: type.name
|
|
57604
57615
|
}
|
|
57605
57616
|
}
|
|
@@ -57607,52 +57618,32 @@ async function addListFragments(config2, documents) {
|
|
|
57607
57618
|
{
|
|
57608
57619
|
name: {
|
|
57609
57620
|
value: config2.listToggleFragment(name2),
|
|
57610
|
-
kind:
|
|
57611
|
-
},
|
|
57612
|
-
kind: graphql8.Kind.FRAGMENT_DEFINITION,
|
|
57613
|
-
selectionSet: {
|
|
57614
|
-
...fragmentSelection,
|
|
57615
|
-
selections: [
|
|
57616
|
-
...fragmentSelection.selections,
|
|
57617
|
-
{
|
|
57618
|
-
kind: graphql8.Kind.FIELD,
|
|
57619
|
-
name: {
|
|
57620
|
-
kind: graphql8.Kind.NAME,
|
|
57621
|
-
value: "id"
|
|
57622
|
-
}
|
|
57623
|
-
}
|
|
57624
|
-
]
|
|
57621
|
+
kind: graphql9.Kind.NAME
|
|
57625
57622
|
},
|
|
57623
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57624
|
+
selectionSet: fragmentSelection,
|
|
57626
57625
|
typeCondition: {
|
|
57627
|
-
kind:
|
|
57626
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57628
57627
|
name: {
|
|
57629
|
-
kind:
|
|
57628
|
+
kind: graphql9.Kind.NAME,
|
|
57630
57629
|
value: type.name
|
|
57631
57630
|
}
|
|
57632
57631
|
}
|
|
57633
57632
|
},
|
|
57634
57633
|
{
|
|
57635
|
-
kind:
|
|
57634
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57636
57635
|
name: {
|
|
57637
57636
|
value: config2.listRemoveFragment(name2),
|
|
57638
|
-
kind:
|
|
57637
|
+
kind: graphql9.Kind.NAME
|
|
57639
57638
|
},
|
|
57640
57639
|
selectionSet: {
|
|
57641
|
-
kind:
|
|
57642
|
-
selections: [
|
|
57643
|
-
{
|
|
57644
|
-
kind: graphql8.Kind.FIELD,
|
|
57645
|
-
name: {
|
|
57646
|
-
kind: graphql8.Kind.NAME,
|
|
57647
|
-
value: "id"
|
|
57648
|
-
}
|
|
57649
|
-
}
|
|
57650
|
-
]
|
|
57640
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57641
|
+
selections: [...objectIdentificationSelection(config2, type)]
|
|
57651
57642
|
},
|
|
57652
57643
|
typeCondition: {
|
|
57653
|
-
kind:
|
|
57644
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57654
57645
|
name: {
|
|
57655
|
-
kind:
|
|
57646
|
+
kind: graphql9.Kind.NAME,
|
|
57656
57647
|
value: type.name
|
|
57657
57648
|
}
|
|
57658
57649
|
}
|
|
@@ -57660,15 +57651,15 @@ async function addListFragments(config2, documents) {
|
|
|
57660
57651
|
];
|
|
57661
57652
|
}
|
|
57662
57653
|
).concat(
|
|
57663
|
-
...
|
|
57664
|
-
kind:
|
|
57654
|
+
...validDeletes.map((typeName) => ({
|
|
57655
|
+
kind: graphql9.Kind.DIRECTIVE_DEFINITION,
|
|
57665
57656
|
name: {
|
|
57666
|
-
kind:
|
|
57657
|
+
kind: graphql9.Kind.NAME,
|
|
57667
57658
|
value: config2.listDeleteDirective(typeName)
|
|
57668
57659
|
},
|
|
57669
57660
|
locations: [
|
|
57670
57661
|
{
|
|
57671
|
-
kind:
|
|
57662
|
+
kind: graphql9.Kind.NAME,
|
|
57672
57663
|
value: "FIELD"
|
|
57673
57664
|
}
|
|
57674
57665
|
],
|
|
@@ -57676,8 +57667,8 @@ async function addListFragments(config2, documents) {
|
|
|
57676
57667
|
}))
|
|
57677
57668
|
)
|
|
57678
57669
|
};
|
|
57679
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
57680
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
57670
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57671
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57681
57672
|
documents.push({
|
|
57682
57673
|
name: "generated::lists",
|
|
57683
57674
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -57762,11 +57753,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
57762
57753
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
57763
57754
|
|
|
57764
57755
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
57765
|
-
var
|
|
57756
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
57766
57757
|
function fieldKey(config2, field) {
|
|
57767
57758
|
const attributeName = field.alias?.value || field.name.value;
|
|
57768
|
-
const printed =
|
|
57769
|
-
const secondParse =
|
|
57759
|
+
const printed = graphql10.print(field);
|
|
57760
|
+
const secondParse = graphql10.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
57770
57761
|
const paginated = !!field.directives?.find(
|
|
57771
57762
|
(directive) => directive.name.value === config2.paginateDirective
|
|
57772
57763
|
);
|
|
@@ -57859,8 +57850,8 @@ function selection({
|
|
|
57859
57850
|
const typeConditionName = field.typeCondition.name.value;
|
|
57860
57851
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
57861
57852
|
const possibleTypes = [];
|
|
57862
|
-
if (!
|
|
57863
|
-
} else if (
|
|
57853
|
+
if (!graphql11.isAbstractType(typeCondition)) {
|
|
57854
|
+
} else if (graphql11.isAbstractType(parentType)) {
|
|
57864
57855
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
57865
57856
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
57866
57857
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -57908,7 +57899,7 @@ function selection({
|
|
|
57908
57899
|
} else {
|
|
57909
57900
|
let typeRef = type.getFields()[field.name.value].type;
|
|
57910
57901
|
fieldType = getRootType(typeRef);
|
|
57911
|
-
nullable = !
|
|
57902
|
+
nullable = !graphql11.isNonNullType(typeRef);
|
|
57912
57903
|
}
|
|
57913
57904
|
const typeName = fieldType.toString();
|
|
57914
57905
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -57973,7 +57964,7 @@ function selection({
|
|
|
57973
57964
|
{}
|
|
57974
57965
|
);
|
|
57975
57966
|
}
|
|
57976
|
-
if (
|
|
57967
|
+
if (graphql11.isInterfaceType(fieldType) || graphql11.isUnionType(fieldType)) {
|
|
57977
57968
|
fieldObj.abstract = true;
|
|
57978
57969
|
}
|
|
57979
57970
|
object.fields = {
|
|
@@ -58030,7 +58021,7 @@ function artifactGenerator(stats) {
|
|
|
58030
58021
|
return async function(config2, docs) {
|
|
58031
58022
|
const filterTypes = {};
|
|
58032
58023
|
for (const doc of docs) {
|
|
58033
|
-
|
|
58024
|
+
graphql12.visit(doc.document, {
|
|
58034
58025
|
Directive(node, _, __, ___, ancestors) {
|
|
58035
58026
|
if (node.name.value !== config2.listDirective) {
|
|
58036
58027
|
return;
|
|
@@ -58089,7 +58080,7 @@ function artifactGenerator(stats) {
|
|
|
58089
58080
|
return;
|
|
58090
58081
|
}
|
|
58091
58082
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
58092
|
-
let documentWithoutInternalDirectives =
|
|
58083
|
+
let documentWithoutInternalDirectives = graphql12.visit(document, {
|
|
58093
58084
|
Directive(node) {
|
|
58094
58085
|
if (config2.isInternalDirective(node)) {
|
|
58095
58086
|
return null;
|
|
@@ -58102,7 +58093,7 @@ function artifactGenerator(stats) {
|
|
|
58102
58093
|
}
|
|
58103
58094
|
}
|
|
58104
58095
|
});
|
|
58105
|
-
let documentWithoutExtraVariables =
|
|
58096
|
+
let documentWithoutExtraVariables = graphql12.visit(
|
|
58106
58097
|
documentWithoutInternalDirectives,
|
|
58107
58098
|
{
|
|
58108
58099
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -58113,13 +58104,13 @@ function artifactGenerator(stats) {
|
|
|
58113
58104
|
}
|
|
58114
58105
|
}
|
|
58115
58106
|
);
|
|
58116
|
-
let rawString =
|
|
58107
|
+
let rawString = graphql12.print(documentWithoutExtraVariables);
|
|
58117
58108
|
let docKind = doc.kind;
|
|
58118
58109
|
const operations = document.definitions.filter(
|
|
58119
|
-
({ kind }) => kind ===
|
|
58110
|
+
({ kind }) => kind === graphql12.Kind.OPERATION_DEFINITION
|
|
58120
58111
|
);
|
|
58121
58112
|
const fragments = document.definitions.filter(
|
|
58122
|
-
({ kind }) => kind ===
|
|
58113
|
+
({ kind }) => kind === graphql12.Kind.FRAGMENT_DEFINITION
|
|
58123
58114
|
);
|
|
58124
58115
|
let rootType = "";
|
|
58125
58116
|
let selectionSet;
|
|
@@ -58306,15 +58297,15 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
58306
58297
|
var recast10 = __toESM(require_main2(), 1);
|
|
58307
58298
|
|
|
58308
58299
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58309
|
-
var
|
|
58300
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
58310
58301
|
var recast8 = __toESM(require_main2(), 1);
|
|
58311
58302
|
|
|
58312
58303
|
// src/codegen/generators/typescript/typeReference.ts
|
|
58313
|
-
var
|
|
58304
|
+
var graphql14 = __toESM(require_graphql2(), 1);
|
|
58314
58305
|
var recast7 = __toESM(require_main2(), 1);
|
|
58315
58306
|
|
|
58316
58307
|
// src/codegen/generators/typescript/types.ts
|
|
58317
|
-
var
|
|
58308
|
+
var graphql13 = __toESM(require_graphql2(), 1);
|
|
58318
58309
|
var recast6 = __toESM(require_main2(), 1);
|
|
58319
58310
|
var AST6 = recast6.types.builders;
|
|
58320
58311
|
function readonlyProperty(prop, enable = true) {
|
|
@@ -58348,7 +58339,7 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
58348
58339
|
return AST6.tsStringKeyword();
|
|
58349
58340
|
}
|
|
58350
58341
|
default: {
|
|
58351
|
-
if (
|
|
58342
|
+
if (graphql13.isNonNullType(target) && "ofType" in target) {
|
|
58352
58343
|
return scalarPropertyValue(
|
|
58353
58344
|
config2,
|
|
58354
58345
|
missingScalars,
|
|
@@ -58369,7 +58360,7 @@ var AST7 = recast7.types.builders;
|
|
|
58369
58360
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
58370
58361
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
58371
58362
|
let result;
|
|
58372
|
-
if (
|
|
58363
|
+
if (graphql14.isScalarType(type)) {
|
|
58373
58364
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58374
58365
|
} else {
|
|
58375
58366
|
result = AST7.tsTypeReference(AST7.identifier(type.name));
|
|
@@ -58390,17 +58381,17 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
58390
58381
|
var AST8 = recast8.types.builders;
|
|
58391
58382
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
58392
58383
|
const { type } = unwrapType(config2, rootType);
|
|
58393
|
-
if (
|
|
58384
|
+
if (graphql15.isScalarType(type)) {
|
|
58394
58385
|
return;
|
|
58395
58386
|
}
|
|
58396
58387
|
if (visitedTypes.has(type.name)) {
|
|
58397
58388
|
return;
|
|
58398
58389
|
}
|
|
58399
|
-
if (
|
|
58390
|
+
if (graphql15.isUnionType(type)) {
|
|
58400
58391
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
58401
58392
|
}
|
|
58402
58393
|
visitedTypes.add(type.name);
|
|
58403
|
-
if (
|
|
58394
|
+
if (graphql15.isEnumType(type)) {
|
|
58404
58395
|
ensureImports({
|
|
58405
58396
|
config: config2,
|
|
58406
58397
|
body,
|
|
@@ -58417,7 +58408,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58417
58408
|
AST8.tsPropertySignature(
|
|
58418
58409
|
AST8.identifier(field.name),
|
|
58419
58410
|
AST8.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
58420
|
-
|
|
58411
|
+
graphql15.isNullableType(field.type)
|
|
58421
58412
|
)
|
|
58422
58413
|
);
|
|
58423
58414
|
}
|
|
@@ -58425,7 +58416,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58425
58416
|
}
|
|
58426
58417
|
|
|
58427
58418
|
// src/codegen/generators/typescript/inlineType.ts
|
|
58428
|
-
var
|
|
58419
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
58429
58420
|
var recast9 = __toESM(require_main2(), 1);
|
|
58430
58421
|
var AST9 = recast9.types.builders;
|
|
58431
58422
|
var fragmentKey = "$fragments";
|
|
@@ -58444,9 +58435,9 @@ function inlineType({
|
|
|
58444
58435
|
}) {
|
|
58445
58436
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
58446
58437
|
let result;
|
|
58447
|
-
if (
|
|
58438
|
+
if (graphql16.isScalarType(type)) {
|
|
58448
58439
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58449
|
-
} else if (
|
|
58440
|
+
} else if (graphql16.isEnumType(type)) {
|
|
58450
58441
|
if (!visitedTypes.has(type.name)) {
|
|
58451
58442
|
ensureImports({
|
|
58452
58443
|
config: config2,
|
|
@@ -58464,11 +58455,11 @@ function inlineType({
|
|
|
58464
58455
|
for (const selection2 of selections) {
|
|
58465
58456
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
58466
58457
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
58467
|
-
if (!
|
|
58458
|
+
if (!graphql16.isInterfaceType(type) && !graphql16.isUnionType(type)) {
|
|
58468
58459
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
58469
58460
|
continue;
|
|
58470
58461
|
}
|
|
58471
|
-
if (!
|
|
58462
|
+
if (!graphql16.isInterfaceType(fragmentType) && !graphql16.isUnionType(fragmentType)) {
|
|
58472
58463
|
if (!inlineFragments[fragmentType.name]) {
|
|
58473
58464
|
inlineFragments[fragmentType.name] = [];
|
|
58474
58465
|
}
|
|
@@ -58588,7 +58579,7 @@ function inlineType({
|
|
|
58588
58579
|
}
|
|
58589
58580
|
}
|
|
58590
58581
|
}
|
|
58591
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
58582
|
+
if (objectType.type === "TSTypeLiteral" && !graphql16.isInterfaceType(fragmentRootType) && !graphql16.isUnionType(fragmentRootType)) {
|
|
58592
58583
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
58593
58584
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
58594
58585
|
);
|
|
@@ -58655,7 +58646,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58655
58646
|
},
|
|
58656
58647
|
type: schema.getType("String")
|
|
58657
58648
|
};
|
|
58658
|
-
} else if (
|
|
58649
|
+
} else if (graphql16.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
58659
58650
|
fields = rootType.ofType.getFields();
|
|
58660
58651
|
} else {
|
|
58661
58652
|
fields = rootType.getFields();
|
|
@@ -58667,7 +58658,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58667
58658
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
58668
58659
|
});
|
|
58669
58660
|
}
|
|
58670
|
-
const fieldType =
|
|
58661
|
+
const fieldType = graphql16.getNamedType(field.type);
|
|
58671
58662
|
if (!fieldType) {
|
|
58672
58663
|
throw new HoudiniError({
|
|
58673
58664
|
filepath,
|
|
@@ -58987,7 +58978,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
58987
58978
|
}
|
|
58988
58979
|
|
|
58989
58980
|
// src/codegen/generators/persistedQueries/index.ts
|
|
58990
|
-
var
|
|
58981
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
58991
58982
|
async function persistOutputGenerator(config2, docs) {
|
|
58992
58983
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
58993
58984
|
return;
|
|
@@ -58999,8 +58990,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
58999
58990
|
if (!generateArtifact) {
|
|
59000
58991
|
return acc;
|
|
59001
58992
|
}
|
|
59002
|
-
let rawString =
|
|
59003
|
-
|
|
58993
|
+
let rawString = graphql17.print(
|
|
58994
|
+
graphql17.visit(document, {
|
|
59004
58995
|
Directive(node) {
|
|
59005
58996
|
if (config2.isInternalDirective(node)) {
|
|
59006
58997
|
return null;
|
|
@@ -59009,7 +59000,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59009
59000
|
})
|
|
59010
59001
|
);
|
|
59011
59002
|
const operations = document.definitions.filter(
|
|
59012
|
-
({ kind }) => kind ===
|
|
59003
|
+
({ kind }) => kind === graphql17.Kind.OPERATION_DEFINITION
|
|
59013
59004
|
);
|
|
59014
59005
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
59015
59006
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -59022,11 +59013,11 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59022
59013
|
}
|
|
59023
59014
|
|
|
59024
59015
|
// src/codegen/generators/definitions/enums.ts
|
|
59025
|
-
var
|
|
59016
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
59026
59017
|
var recast11 = __toESM(require_main2(), 1);
|
|
59027
59018
|
var AST11 = recast11.types.builders;
|
|
59028
59019
|
async function definitionsGenerator(config2) {
|
|
59029
|
-
const enums =
|
|
59020
|
+
const enums = graphql18.parse(graphql18.printSchema(config2.schema)).definitions.filter(
|
|
59030
59021
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
59031
59022
|
).filter((def) => !config2.isInternalEnum(def));
|
|
59032
59023
|
const runtimeDefinitions = recast11.print(
|
|
@@ -59199,7 +59190,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59199
59190
|
}
|
|
59200
59191
|
|
|
59201
59192
|
// src/codegen/transforms/schema.ts
|
|
59202
|
-
var
|
|
59193
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
59203
59194
|
async function graphqlExtensions(config2, documents) {
|
|
59204
59195
|
const internalSchema = `
|
|
59205
59196
|
enum CachePolicy {
|
|
@@ -59277,19 +59268,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59277
59268
|
"""
|
|
59278
59269
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59279
59270
|
`;
|
|
59280
|
-
let currentSchema =
|
|
59271
|
+
let currentSchema = graphql20.printSchema(config2.schema);
|
|
59281
59272
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59282
59273
|
currentSchema += internalSchema;
|
|
59283
59274
|
}
|
|
59284
59275
|
config2.newSchema += internalSchema;
|
|
59285
|
-
config2.schema =
|
|
59276
|
+
config2.schema = graphql20.buildSchema(currentSchema);
|
|
59286
59277
|
}
|
|
59287
59278
|
|
|
59288
59279
|
// src/codegen/transforms/typename.ts
|
|
59289
|
-
var
|
|
59280
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
59290
59281
|
async function addTypename(config2, documents) {
|
|
59291
59282
|
for (const doc of documents) {
|
|
59292
|
-
doc.document =
|
|
59283
|
+
doc.document = graphql21.visit(doc.document, {
|
|
59293
59284
|
Field(node, key, parent, path2, ancestors) {
|
|
59294
59285
|
if (!node.selectionSet) {
|
|
59295
59286
|
return;
|
|
@@ -59301,7 +59292,7 @@ async function addTypename(config2, documents) {
|
|
|
59301
59292
|
);
|
|
59302
59293
|
const field = type.getFields()[node.name.value];
|
|
59303
59294
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59304
|
-
if (
|
|
59295
|
+
if (graphql21.isInterfaceType(fieldType) || graphql21.isUnionType(fieldType)) {
|
|
59305
59296
|
return {
|
|
59306
59297
|
...node,
|
|
59307
59298
|
selectionSet: {
|
|
@@ -59309,9 +59300,9 @@ async function addTypename(config2, documents) {
|
|
|
59309
59300
|
selections: [
|
|
59310
59301
|
...node.selectionSet.selections,
|
|
59311
59302
|
{
|
|
59312
|
-
kind:
|
|
59303
|
+
kind: graphql21.Kind.FIELD,
|
|
59313
59304
|
name: {
|
|
59314
|
-
kind:
|
|
59305
|
+
kind: graphql21.Kind.NAME,
|
|
59315
59306
|
value: "__typename"
|
|
59316
59307
|
}
|
|
59317
59308
|
}
|
|
@@ -59325,10 +59316,10 @@ async function addTypename(config2, documents) {
|
|
|
59325
59316
|
}
|
|
59326
59317
|
|
|
59327
59318
|
// src/codegen/transforms/addID.ts
|
|
59328
|
-
var
|
|
59319
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
59329
59320
|
async function addID(config2, documents) {
|
|
59330
59321
|
for (const doc of documents) {
|
|
59331
|
-
doc.document =
|
|
59322
|
+
doc.document = graphql22.visit(doc.document, {
|
|
59332
59323
|
Field(node, key, parent, path2, ancestors) {
|
|
59333
59324
|
if (!node.selectionSet) {
|
|
59334
59325
|
return;
|
|
@@ -59341,7 +59332,7 @@ async function addID(config2, documents) {
|
|
|
59341
59332
|
const field = type.getFields()[node.name.value];
|
|
59342
59333
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59343
59334
|
if (node.selectionSet?.selections.length > 0) {
|
|
59344
|
-
if (!
|
|
59335
|
+
if (!graphql22.isObjectType(fieldType) && !graphql22.isInterfaceType(fieldType)) {
|
|
59345
59336
|
return;
|
|
59346
59337
|
}
|
|
59347
59338
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -59356,9 +59347,9 @@ async function addID(config2, documents) {
|
|
|
59356
59347
|
continue;
|
|
59357
59348
|
}
|
|
59358
59349
|
selections.push({
|
|
59359
|
-
kind:
|
|
59350
|
+
kind: graphql22.Kind.FIELD,
|
|
59360
59351
|
name: {
|
|
59361
|
-
kind:
|
|
59352
|
+
kind: graphql22.Kind.NAME,
|
|
59362
59353
|
value: keyField
|
|
59363
59354
|
}
|
|
59364
59355
|
});
|
|
@@ -59377,8 +59368,8 @@ async function addID(config2, documents) {
|
|
|
59377
59368
|
}
|
|
59378
59369
|
|
|
59379
59370
|
// src/codegen/transforms/fragmentVariables.ts
|
|
59380
|
-
var
|
|
59381
|
-
var GraphqlKinds2 =
|
|
59371
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
59372
|
+
var GraphqlKinds2 = graphql23.Kind;
|
|
59382
59373
|
async function fragmentVariables(config2, documents) {
|
|
59383
59374
|
const fragments = collectFragments(config2, documents);
|
|
59384
59375
|
const generatedFragments = {};
|
|
@@ -59401,7 +59392,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
59401
59392
|
});
|
|
59402
59393
|
}
|
|
59403
59394
|
const doc = {
|
|
59404
|
-
kind:
|
|
59395
|
+
kind: graphql23.Kind.DOCUMENT,
|
|
59405
59396
|
definitions: Object.values(generatedFragments)
|
|
59406
59397
|
};
|
|
59407
59398
|
documents.push({
|
|
@@ -59437,7 +59428,7 @@ function inlineFragmentArgs({
|
|
|
59437
59428
|
filepath,
|
|
59438
59429
|
document
|
|
59439
59430
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
59440
|
-
const result =
|
|
59431
|
+
const result = graphql23.visit(document, {
|
|
59441
59432
|
FragmentSpread(node) {
|
|
59442
59433
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
59443
59434
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -59525,7 +59516,7 @@ function inlineFragmentArgs({
|
|
|
59525
59516
|
});
|
|
59526
59517
|
if (newName) {
|
|
59527
59518
|
result.name = {
|
|
59528
|
-
kind:
|
|
59519
|
+
kind: graphql23.Kind.NAME,
|
|
59529
59520
|
value: newName
|
|
59530
59521
|
};
|
|
59531
59522
|
}
|
|
@@ -59637,7 +59628,7 @@ function operationScope(operation) {
|
|
|
59637
59628
|
}
|
|
59638
59629
|
|
|
59639
59630
|
// src/codegen/validators/typeCheck.ts
|
|
59640
|
-
var
|
|
59631
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
59641
59632
|
async function typeCheck(config2, docs) {
|
|
59642
59633
|
const errors = [];
|
|
59643
59634
|
const freeLists = [];
|
|
@@ -59645,11 +59636,11 @@ async function typeCheck(config2, docs) {
|
|
|
59645
59636
|
const listTypes = [];
|
|
59646
59637
|
const fragments = {};
|
|
59647
59638
|
for (const { document: parsed, filename } of docs) {
|
|
59648
|
-
|
|
59649
|
-
[
|
|
59639
|
+
graphql24.visit(parsed, {
|
|
59640
|
+
[graphql24.Kind.FRAGMENT_DEFINITION](definition) {
|
|
59650
59641
|
fragments[definition.name.value] = definition;
|
|
59651
59642
|
},
|
|
59652
|
-
[
|
|
59643
|
+
[graphql24.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
59653
59644
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
59654
59645
|
return;
|
|
59655
59646
|
}
|
|
@@ -59695,14 +59686,14 @@ async function typeCheck(config2, docs) {
|
|
|
59695
59686
|
);
|
|
59696
59687
|
return;
|
|
59697
59688
|
}
|
|
59698
|
-
if (
|
|
59689
|
+
if (graphql24.isListType(rootType) || graphql24.isNonNullType(rootType) && graphql24.isListType(rootType.ofType)) {
|
|
59699
59690
|
needsParent = true;
|
|
59700
59691
|
break;
|
|
59701
59692
|
}
|
|
59702
|
-
if (
|
|
59693
|
+
if (graphql24.isNonNullType(rootType) && "ofType" in rootType) {
|
|
59703
59694
|
rootType = rootType.ofType;
|
|
59704
59695
|
}
|
|
59705
|
-
if (
|
|
59696
|
+
if (graphql24.isScalarType(rootType)) {
|
|
59706
59697
|
break;
|
|
59707
59698
|
}
|
|
59708
59699
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -59758,7 +59749,7 @@ async function typeCheck(config2, docs) {
|
|
|
59758
59749
|
);
|
|
59759
59750
|
const targetField = ancestors[ancestors.length - 1];
|
|
59760
59751
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
59761
|
-
const { type, error } = connectionSelection(
|
|
59752
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
59762
59753
|
config2,
|
|
59763
59754
|
targetFieldDefinition,
|
|
59764
59755
|
parentTypeFromAncestors(
|
|
@@ -59768,10 +59759,19 @@ async function typeCheck(config2, docs) {
|
|
|
59768
59759
|
),
|
|
59769
59760
|
targetField.selectionSet
|
|
59770
59761
|
);
|
|
59762
|
+
if (errorConnectionSelection && directive.name.value === config2.paginateDirective) {
|
|
59763
|
+
errors.push(
|
|
59764
|
+
new HoudiniError({
|
|
59765
|
+
filepath: filename,
|
|
59766
|
+
message: errorConnectionSelection,
|
|
59767
|
+
description: errorConnectionSelection
|
|
59768
|
+
})
|
|
59769
|
+
);
|
|
59770
|
+
}
|
|
59771
59771
|
let targetTypes = [type];
|
|
59772
|
-
if (
|
|
59772
|
+
if (graphql24.isUnionType(type)) {
|
|
59773
59773
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
59774
|
-
} else if (
|
|
59774
|
+
} else if (graphql24.isInterfaceType(type)) {
|
|
59775
59775
|
try {
|
|
59776
59776
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
59777
59777
|
if (!type.getFields()[key]) {
|
|
@@ -59785,23 +59785,16 @@ async function typeCheck(config2, docs) {
|
|
|
59785
59785
|
for (const targetType of targetTypes) {
|
|
59786
59786
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
59787
59787
|
if (missingIDFields.length > 0) {
|
|
59788
|
-
|
|
59789
|
-
|
|
59790
|
-
|
|
59791
|
-
|
|
59792
|
-
|
|
59793
|
-
|
|
59794
|
-
|
|
59795
|
-
|
|
59796
|
-
|
|
59797
|
-
|
|
59798
|
-
filepath: filename,
|
|
59799
|
-
message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
59800
|
-
", "
|
|
59801
|
-
)}.`
|
|
59802
|
-
})
|
|
59803
|
-
);
|
|
59804
|
-
}
|
|
59788
|
+
const message = `@${config2.listDirective} on ${logGreen(
|
|
59789
|
+
targetType.name
|
|
59790
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
59791
|
+
errors.push(
|
|
59792
|
+
new HoudiniError({
|
|
59793
|
+
filepath: filename,
|
|
59794
|
+
message,
|
|
59795
|
+
description: message
|
|
59796
|
+
})
|
|
59797
|
+
);
|
|
59805
59798
|
return;
|
|
59806
59799
|
}
|
|
59807
59800
|
}
|
|
@@ -59816,13 +59809,13 @@ async function typeCheck(config2, docs) {
|
|
|
59816
59809
|
if (errors.length > 0) {
|
|
59817
59810
|
throw errors;
|
|
59818
59811
|
}
|
|
59819
|
-
const rules = (filepath) => [...
|
|
59812
|
+
const rules = (filepath) => [...graphql24.specifiedRules].filter(
|
|
59820
59813
|
(rule) => ![
|
|
59821
|
-
|
|
59822
|
-
|
|
59823
|
-
|
|
59824
|
-
|
|
59825
|
-
|
|
59814
|
+
graphql24.NoUnusedFragmentsRule,
|
|
59815
|
+
graphql24.KnownFragmentNamesRule,
|
|
59816
|
+
graphql24.ExecutableDefinitionsRule,
|
|
59817
|
+
graphql24.KnownDirectivesRule,
|
|
59818
|
+
graphql24.KnownArgumentNamesRule
|
|
59826
59819
|
].includes(rule)
|
|
59827
59820
|
).concat(
|
|
59828
59821
|
validateLists({
|
|
@@ -59841,7 +59834,7 @@ async function typeCheck(config2, docs) {
|
|
|
59841
59834
|
noUnusedFragmentArguments(config2)
|
|
59842
59835
|
);
|
|
59843
59836
|
for (const { filename, document: parsed } of docs) {
|
|
59844
|
-
for (const error of
|
|
59837
|
+
for (const error of graphql24.validate(config2.schema, parsed, rules(filename))) {
|
|
59845
59838
|
errors.push(
|
|
59846
59839
|
new HoudiniError({
|
|
59847
59840
|
filepath: filename,
|
|
@@ -59867,7 +59860,7 @@ var validateLists = ({
|
|
|
59867
59860
|
if (!config2.isListFragment(node.name.value)) {
|
|
59868
59861
|
if (!fragments[node.name.value]) {
|
|
59869
59862
|
ctx.reportError(
|
|
59870
|
-
new
|
|
59863
|
+
new graphql24.GraphQLError(
|
|
59871
59864
|
"Encountered unknown fragment: " + node.name.value
|
|
59872
59865
|
)
|
|
59873
59866
|
);
|
|
@@ -59877,7 +59870,7 @@ var validateLists = ({
|
|
|
59877
59870
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
59878
59871
|
if (!lists.includes(listName)) {
|
|
59879
59872
|
ctx.reportError(
|
|
59880
|
-
new
|
|
59873
|
+
new graphql24.GraphQLError(
|
|
59881
59874
|
"Encountered fragment referencing unknown list: " + listName
|
|
59882
59875
|
)
|
|
59883
59876
|
);
|
|
@@ -59902,7 +59895,7 @@ var validateLists = ({
|
|
|
59902
59895
|
);
|
|
59903
59896
|
if (parentArg) {
|
|
59904
59897
|
ctx.reportError(
|
|
59905
|
-
new
|
|
59898
|
+
new graphql24.GraphQLError(
|
|
59906
59899
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
59907
59900
|
)
|
|
59908
59901
|
);
|
|
@@ -59918,7 +59911,7 @@ var validateLists = ({
|
|
|
59918
59911
|
return;
|
|
59919
59912
|
}
|
|
59920
59913
|
ctx.reportError(
|
|
59921
|
-
new
|
|
59914
|
+
new graphql24.GraphQLError(
|
|
59922
59915
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
59923
59916
|
)
|
|
59924
59917
|
);
|
|
@@ -59928,7 +59921,7 @@ var validateLists = ({
|
|
|
59928
59921
|
const directiveName = node.name.value;
|
|
59929
59922
|
if (directiveName === "connection") {
|
|
59930
59923
|
ctx.reportError(
|
|
59931
|
-
new
|
|
59924
|
+
new graphql24.GraphQLError(
|
|
59932
59925
|
"@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."
|
|
59933
59926
|
)
|
|
59934
59927
|
);
|
|
@@ -59937,7 +59930,7 @@ var validateLists = ({
|
|
|
59937
59930
|
if (!config2.isInternalDirective(node)) {
|
|
59938
59931
|
if (!config2.schema.getDirective(directiveName)) {
|
|
59939
59932
|
ctx.reportError(
|
|
59940
|
-
new
|
|
59933
|
+
new graphql24.GraphQLError(
|
|
59941
59934
|
"Encountered unknown directive: " + directiveName
|
|
59942
59935
|
)
|
|
59943
59936
|
);
|
|
@@ -59946,7 +59939,7 @@ var validateLists = ({
|
|
|
59946
59939
|
}
|
|
59947
59940
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
59948
59941
|
ctx.reportError(
|
|
59949
|
-
new
|
|
59942
|
+
new graphql24.GraphQLError(
|
|
59950
59943
|
"Encountered directive referencing unknown list: " + directiveName
|
|
59951
59944
|
)
|
|
59952
59945
|
);
|
|
@@ -59957,7 +59950,7 @@ var validateLists = ({
|
|
|
59957
59950
|
};
|
|
59958
59951
|
function knownArguments(config2) {
|
|
59959
59952
|
return function(ctx) {
|
|
59960
|
-
const nativeValidator =
|
|
59953
|
+
const nativeValidator = graphql24.KnownArgumentNamesRule(ctx);
|
|
59961
59954
|
return {
|
|
59962
59955
|
...nativeValidator,
|
|
59963
59956
|
Directive(directiveNode) {
|
|
@@ -59990,7 +59983,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
59990
59983
|
for (const arg of node.arguments || []) {
|
|
59991
59984
|
if (arg.value.kind !== "ObjectValue") {
|
|
59992
59985
|
ctx.reportError(
|
|
59993
|
-
new
|
|
59986
|
+
new graphql24.GraphQLError("values in @arguments must be an object")
|
|
59994
59987
|
);
|
|
59995
59988
|
return;
|
|
59996
59989
|
}
|
|
@@ -60000,13 +59993,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60000
59993
|
);
|
|
60001
59994
|
if (!typeArg) {
|
|
60002
59995
|
ctx.reportError(
|
|
60003
|
-
new
|
|
59996
|
+
new graphql24.GraphQLError("missing type field for @arguments directive")
|
|
60004
59997
|
);
|
|
60005
59998
|
return;
|
|
60006
59999
|
}
|
|
60007
|
-
if (typeArg.value.kind !==
|
|
60000
|
+
if (typeArg.value.kind !== graphql24.Kind.STRING) {
|
|
60008
60001
|
ctx.reportError(
|
|
60009
|
-
new
|
|
60002
|
+
new graphql24.GraphQLError("type field to @arguments must be a string")
|
|
60010
60003
|
);
|
|
60011
60004
|
return;
|
|
60012
60005
|
}
|
|
@@ -60019,7 +60012,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60019
60012
|
);
|
|
60020
60013
|
if (typeArg.value.value !== defaultValueType) {
|
|
60021
60014
|
ctx.reportError(
|
|
60022
|
-
new
|
|
60015
|
+
new graphql24.GraphQLError(
|
|
60023
60016
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60024
60017
|
)
|
|
60025
60018
|
);
|
|
@@ -60037,7 +60030,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60037
60030
|
try {
|
|
60038
60031
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60039
60032
|
} catch (e) {
|
|
60040
|
-
ctx.reportError(new
|
|
60033
|
+
ctx.reportError(new graphql24.GraphQLError(e.message));
|
|
60041
60034
|
return;
|
|
60042
60035
|
}
|
|
60043
60036
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60060,7 +60053,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60060
60053
|
);
|
|
60061
60054
|
if (missing.length > 0) {
|
|
60062
60055
|
ctx.reportError(
|
|
60063
|
-
new
|
|
60056
|
+
new graphql24.GraphQLError(
|
|
60064
60057
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60065
60058
|
)
|
|
60066
60059
|
);
|
|
@@ -60071,7 +60064,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60071
60064
|
);
|
|
60072
60065
|
if (unknown.length > 0) {
|
|
60073
60066
|
ctx.reportError(
|
|
60074
|
-
new
|
|
60067
|
+
new graphql24.GraphQLError(
|
|
60075
60068
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60076
60069
|
)
|
|
60077
60070
|
);
|
|
@@ -60083,7 +60076,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60083
60076
|
]
|
|
60084
60077
|
);
|
|
60085
60078
|
for (const [applied, target] of zipped) {
|
|
60086
|
-
if (applied.value.kind ===
|
|
60079
|
+
if (applied.value.kind === graphql24.Kind.VARIABLE || applied.value.kind === graphql24.Kind.LIST || applied.value.kind === graphql24.Kind.OBJECT) {
|
|
60087
60080
|
continue;
|
|
60088
60081
|
}
|
|
60089
60082
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60092,7 +60085,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60092
60085
|
);
|
|
60093
60086
|
if (appliedType !== target) {
|
|
60094
60087
|
ctx.reportError(
|
|
60095
|
-
new
|
|
60088
|
+
new graphql24.GraphQLError(
|
|
60096
60089
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60097
60090
|
)
|
|
60098
60091
|
);
|
|
@@ -60113,7 +60106,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60113
60106
|
}
|
|
60114
60107
|
if (alreadyPaginated) {
|
|
60115
60108
|
ctx.reportError(
|
|
60116
|
-
new
|
|
60109
|
+
new graphql24.GraphQLError(
|
|
60117
60110
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60118
60111
|
)
|
|
60119
60112
|
);
|
|
@@ -60128,7 +60121,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60128
60121
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60129
60122
|
if (hasRequiredArgs) {
|
|
60130
60123
|
ctx.reportError(
|
|
60131
|
-
new
|
|
60124
|
+
new graphql24.GraphQLError(
|
|
60132
60125
|
"@paginate cannot appear on a document with required args"
|
|
60133
60126
|
)
|
|
60134
60127
|
);
|
|
@@ -60160,14 +60153,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60160
60153
|
const backwards = appliedArgs.has("last");
|
|
60161
60154
|
if (!forward && !backwards) {
|
|
60162
60155
|
ctx.reportError(
|
|
60163
|
-
new
|
|
60156
|
+
new graphql24.GraphQLError(
|
|
60164
60157
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60165
60158
|
)
|
|
60166
60159
|
);
|
|
60167
60160
|
}
|
|
60168
60161
|
if (forward && backwards) {
|
|
60169
60162
|
ctx.reportError(
|
|
60170
|
-
new
|
|
60163
|
+
new graphql24.GraphQLError(
|
|
60171
60164
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60172
60165
|
)
|
|
60173
60166
|
);
|
|
@@ -60181,7 +60174,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60181
60174
|
);
|
|
60182
60175
|
if (!appliedLimitArg) {
|
|
60183
60176
|
ctx.reportError(
|
|
60184
|
-
new
|
|
60177
|
+
new graphql24.GraphQLError(
|
|
60185
60178
|
"A field with offset-based pagination must have a limit argument"
|
|
60186
60179
|
)
|
|
60187
60180
|
);
|
|
@@ -60197,20 +60190,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60197
60190
|
const args = /* @__PURE__ */ new Set();
|
|
60198
60191
|
return {
|
|
60199
60192
|
enter(node) {
|
|
60200
|
-
if (node.kind ===
|
|
60193
|
+
if (node.kind === graphql24.Kind.FRAGMENT_DEFINITION) {
|
|
60201
60194
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60202
60195
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60203
60196
|
args.add(arg);
|
|
60204
60197
|
}
|
|
60205
|
-
} else if (node.kind ===
|
|
60198
|
+
} else if (node.kind === graphql24.Kind.VARIABLE) {
|
|
60206
60199
|
args.delete(node.name.value);
|
|
60207
60200
|
}
|
|
60208
60201
|
},
|
|
60209
60202
|
leave(node) {
|
|
60210
|
-
if (node.kind ===
|
|
60203
|
+
if (node.kind === graphql24.Kind.FRAGMENT_DEFINITION) {
|
|
60211
60204
|
if (args.size > 0) {
|
|
60212
60205
|
ctx.reportError(
|
|
60213
|
-
new
|
|
60206
|
+
new graphql24.GraphQLError(
|
|
60214
60207
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60215
60208
|
)
|
|
60216
60209
|
);
|
|
@@ -60246,7 +60239,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60246
60239
|
if (definition.kind === "OperationDefinition") {
|
|
60247
60240
|
if (definition.operation !== "query") {
|
|
60248
60241
|
ctx.reportError(
|
|
60249
|
-
new
|
|
60242
|
+
new graphql24.GraphQLError(
|
|
60250
60243
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60251
60244
|
)
|
|
60252
60245
|
);
|
|
@@ -60258,7 +60251,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60258
60251
|
}
|
|
60259
60252
|
if (!possibleNodes.includes(definitionType)) {
|
|
60260
60253
|
ctx.reportError(
|
|
60261
|
-
new
|
|
60254
|
+
new graphql24.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60262
60255
|
);
|
|
60263
60256
|
}
|
|
60264
60257
|
}
|
|
@@ -60277,7 +60270,7 @@ function checkMutationOperation(config2) {
|
|
|
60277
60270
|
);
|
|
60278
60271
|
if (append && prepend) {
|
|
60279
60272
|
ctx.reportError(
|
|
60280
|
-
new
|
|
60273
|
+
new graphql24.GraphQLError(
|
|
60281
60274
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60282
60275
|
)
|
|
60283
60276
|
);
|
|
@@ -60291,7 +60284,7 @@ function checkMutationOperation(config2) {
|
|
|
60291
60284
|
);
|
|
60292
60285
|
if (parentId && allLists) {
|
|
60293
60286
|
ctx.reportError(
|
|
60294
|
-
new
|
|
60287
|
+
new graphql24.GraphQLError(
|
|
60295
60288
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60296
60289
|
)
|
|
60297
60290
|
);
|
|
@@ -60313,7 +60306,7 @@ function checkMaskDirective(config2) {
|
|
|
60313
60306
|
);
|
|
60314
60307
|
if (maskEnableDirective && maskDisableDirective) {
|
|
60315
60308
|
ctx.reportError(
|
|
60316
|
-
new
|
|
60309
|
+
new graphql24.GraphQLError(
|
|
60317
60310
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
60318
60311
|
)
|
|
60319
60312
|
);
|
|
@@ -60329,7 +60322,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
60329
60322
|
if (!nodeInterface) {
|
|
60330
60323
|
return null;
|
|
60331
60324
|
}
|
|
60332
|
-
if (!
|
|
60325
|
+
if (!graphql24.isInterfaceType(nodeInterface)) {
|
|
60333
60326
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
60334
60327
|
return null;
|
|
60335
60328
|
}
|
|
@@ -60427,11 +60420,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
60427
60420
|
}
|
|
60428
60421
|
|
|
60429
60422
|
// src/codegen/validators/noIDAlias.ts
|
|
60430
|
-
var
|
|
60423
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
60431
60424
|
async function noIDAlias(config2, docs) {
|
|
60432
60425
|
const errors = [];
|
|
60433
60426
|
for (const { filename, document } of docs) {
|
|
60434
|
-
|
|
60427
|
+
graphql25.visit(document, {
|
|
60435
60428
|
Field(node, _, __, ___, ancestors) {
|
|
60436
60429
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
60437
60430
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -60629,12 +60622,12 @@ async function processJSFile(config2, contents) {
|
|
|
60629
60622
|
return documents;
|
|
60630
60623
|
}
|
|
60631
60624
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
60632
|
-
const parsedDoc =
|
|
60625
|
+
const parsedDoc = graphql26.parse(document);
|
|
60633
60626
|
const operations = parsedDoc.definitions.filter(
|
|
60634
|
-
({ kind: kind2 }) => kind2 ===
|
|
60627
|
+
({ kind: kind2 }) => kind2 === graphql26.Kind.OPERATION_DEFINITION
|
|
60635
60628
|
);
|
|
60636
60629
|
const fragments = parsedDoc.definitions.filter(
|
|
60637
|
-
({ kind: kind2 }) => kind2 ===
|
|
60630
|
+
({ kind: kind2 }) => kind2 === graphql26.Kind.FRAGMENT_DEFINITION
|
|
60638
60631
|
);
|
|
60639
60632
|
if (operations.length > 1) {
|
|
60640
60633
|
throw new HoudiniError({
|