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