houdini 0.18.2 → 0.19.0
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 +1126 -706
- package/build/cmd-esm/index.js +1126 -706
- package/build/codegen/generators/artifacts/utils.d.ts +2 -1
- package/build/codegen/generators/runtime/index.d.ts +2 -2
- package/build/codegen/generators/typescript/addReferencedInputTypes.d.ts +1 -1
- package/build/codegen/generators/typescript/imperativeCache.d.ts +2 -0
- package/build/codegen/generators/typescript/typeReference.d.ts +1 -1
- package/build/codegen/utils/objectIdentificationSelection.d.ts +3 -0
- package/build/codegen-cjs/index.js +1026 -655
- package/build/codegen-esm/index.js +1026 -655
- package/build/lib/config.d.ts +27 -10
- package/build/lib-cjs/index.js +172 -64
- package/build/lib-esm/index.js +171 -64
- package/build/runtime/cache/cache.d.ts +5 -2
- package/build/runtime/cache/schema.d.ts +21 -0
- package/build/runtime/generated.d.ts +4 -0
- package/build/runtime/index.d.ts +6 -3
- package/build/runtime/lib/config.d.ts +8 -4
- package/build/runtime/lib/network.d.ts +2 -2
- package/build/runtime/lib/types.d.ts +2 -2
- package/build/runtime/public/cache.d.ts +19 -0
- package/build/runtime/public/index.d.ts +1 -0
- package/build/runtime/public/list.d.ts +18 -0
- package/build/runtime/public/record.d.ts +31 -0
- package/build/runtime/public/tests/test.d.ts +114 -0
- package/build/runtime/public/types.d.ts +36 -0
- package/build/runtime-cjs/cache/cache.d.ts +5 -2
- package/build/runtime-cjs/cache/cache.js +16 -5
- package/build/runtime-cjs/cache/schema.d.ts +21 -0
- package/build/runtime-cjs/cache/schema.js +66 -0
- package/build/runtime-cjs/generated.d.ts +4 -0
- package/build/runtime-cjs/generated.js +16 -0
- package/build/runtime-cjs/index.d.ts +6 -3
- package/build/runtime-cjs/index.js +4 -0
- package/build/runtime-cjs/lib/config.d.ts +8 -4
- package/build/runtime-cjs/lib/network.d.ts +2 -2
- package/build/runtime-cjs/lib/network.js +2 -2
- package/build/runtime-cjs/lib/types.d.ts +2 -2
- package/build/runtime-cjs/public/cache.d.ts +19 -0
- package/build/runtime-cjs/public/cache.js +97 -0
- package/build/runtime-cjs/public/index.d.ts +1 -0
- package/build/runtime-cjs/public/index.js +28 -0
- package/build/runtime-cjs/public/list.d.ts +18 -0
- package/build/runtime-cjs/public/list.js +163 -0
- package/build/runtime-cjs/public/record.d.ts +31 -0
- package/build/runtime-cjs/public/record.js +249 -0
- package/build/runtime-cjs/public/tests/test.d.ts +114 -0
- package/build/runtime-cjs/public/tests/test.js +31 -0
- package/build/runtime-cjs/public/types.d.ts +36 -0
- package/build/runtime-cjs/public/types.js +16 -0
- package/build/runtime-esm/cache/cache.d.ts +5 -2
- package/build/runtime-esm/cache/cache.js +16 -5
- package/build/runtime-esm/cache/schema.d.ts +21 -0
- package/build/runtime-esm/cache/schema.js +42 -0
- package/build/runtime-esm/generated.d.ts +4 -0
- package/build/runtime-esm/generated.js +0 -0
- package/build/runtime-esm/index.d.ts +6 -3
- package/build/runtime-esm/index.js +5 -2
- package/build/runtime-esm/lib/config.d.ts +8 -4
- package/build/runtime-esm/lib/network.d.ts +2 -2
- package/build/runtime-esm/lib/network.js +2 -2
- package/build/runtime-esm/lib/types.d.ts +2 -2
- package/build/runtime-esm/public/cache.d.ts +19 -0
- package/build/runtime-esm/public/cache.js +72 -0
- package/build/runtime-esm/public/index.d.ts +1 -0
- package/build/runtime-esm/public/index.js +4 -0
- package/build/runtime-esm/public/list.d.ts +18 -0
- package/build/runtime-esm/public/list.js +139 -0
- package/build/runtime-esm/public/record.d.ts +31 -0
- package/build/runtime-esm/public/record.js +222 -0
- package/build/runtime-esm/public/tests/test.d.ts +114 -0
- package/build/runtime-esm/public/tests/test.js +7 -0
- package/build/runtime-esm/public/types.d.ts +36 -0
- package/build/runtime-esm/public/types.js +0 -0
- package/build/test-cjs/index.js +1032 -638
- package/build/test-esm/index.js +1032 -638
- package/build/vite-cjs/index.js +1104 -699
- package/build/vite-esm/index.js +1104 -699
- package/package.json +2 -2
|
@@ -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
|
|
|
@@ -1977,12 +1977,12 @@ var require_parser = __commonJS({
|
|
|
1977
1977
|
return [];
|
|
1978
1978
|
}
|
|
1979
1979
|
if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) {
|
|
1980
|
-
var
|
|
1980
|
+
var types14 = [];
|
|
1981
1981
|
this.expectOptionalToken(_tokenKind.TokenKind.AMP);
|
|
1982
1982
|
do {
|
|
1983
|
-
|
|
1983
|
+
types14.push(this.parseNamedType());
|
|
1984
1984
|
} while (this.expectOptionalToken(_tokenKind.TokenKind.AMP) || this.peek(_tokenKind.TokenKind.NAME));
|
|
1985
|
-
return
|
|
1985
|
+
return types14;
|
|
1986
1986
|
}
|
|
1987
1987
|
return this.delimitedMany(_tokenKind.TokenKind.AMP, this.parseNamedType);
|
|
1988
1988
|
};
|
|
@@ -2061,13 +2061,13 @@ var require_parser = __commonJS({
|
|
|
2061
2061
|
this.expectKeyword("union");
|
|
2062
2062
|
var name2 = this.parseName();
|
|
2063
2063
|
var directives = this.parseDirectives(true);
|
|
2064
|
-
var
|
|
2064
|
+
var types14 = this.parseUnionMemberTypes();
|
|
2065
2065
|
return {
|
|
2066
2066
|
kind: _kinds.Kind.UNION_TYPE_DEFINITION,
|
|
2067
2067
|
description,
|
|
2068
2068
|
name: name2,
|
|
2069
2069
|
directives,
|
|
2070
|
-
types:
|
|
2070
|
+
types: types14,
|
|
2071
2071
|
loc: this.loc(start)
|
|
2072
2072
|
};
|
|
2073
2073
|
};
|
|
@@ -2225,15 +2225,15 @@ var require_parser = __commonJS({
|
|
|
2225
2225
|
this.expectKeyword("union");
|
|
2226
2226
|
var name2 = this.parseName();
|
|
2227
2227
|
var directives = this.parseDirectives(true);
|
|
2228
|
-
var
|
|
2229
|
-
if (directives.length === 0 &&
|
|
2228
|
+
var types14 = this.parseUnionMemberTypes();
|
|
2229
|
+
if (directives.length === 0 && types14.length === 0) {
|
|
2230
2230
|
throw this.unexpected();
|
|
2231
2231
|
}
|
|
2232
2232
|
return {
|
|
2233
2233
|
kind: _kinds.Kind.UNION_TYPE_EXTENSION,
|
|
2234
2234
|
name: name2,
|
|
2235
2235
|
directives,
|
|
2236
|
-
types:
|
|
2236
|
+
types: types14,
|
|
2237
2237
|
loc: this.loc(start)
|
|
2238
2238
|
};
|
|
2239
2239
|
};
|
|
@@ -2403,7 +2403,7 @@ var require_visitor = __commonJS({
|
|
|
2403
2403
|
Object.defineProperty(exports, "__esModule", {
|
|
2404
2404
|
value: true
|
|
2405
2405
|
});
|
|
2406
|
-
exports.visit =
|
|
2406
|
+
exports.visit = visit12;
|
|
2407
2407
|
exports.visitInParallel = visitInParallel;
|
|
2408
2408
|
exports.getVisitFn = getVisitFn;
|
|
2409
2409
|
exports.BREAK = exports.QueryDocumentKeys = void 0;
|
|
@@ -2466,7 +2466,7 @@ var require_visitor = __commonJS({
|
|
|
2466
2466
|
exports.QueryDocumentKeys = QueryDocumentKeys;
|
|
2467
2467
|
var BREAK = Object.freeze({});
|
|
2468
2468
|
exports.BREAK = BREAK;
|
|
2469
|
-
function
|
|
2469
|
+
function visit12(root, visitor) {
|
|
2470
2470
|
var visitorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : QueryDocumentKeys;
|
|
2471
2471
|
var stack = void 0;
|
|
2472
2472
|
var inArray = Array.isArray(root);
|
|
@@ -3211,8 +3211,8 @@ var require_printer = __commonJS({
|
|
|
3211
3211
|
return join2(["interface", name2, wrap("implements ", join2(interfaces, " & ")), join2(directives, " "), block(fields)], " ");
|
|
3212
3212
|
}),
|
|
3213
3213
|
UnionTypeDefinition: addDescription(function(_ref27) {
|
|
3214
|
-
var name2 = _ref27.name, directives = _ref27.directives,
|
|
3215
|
-
return join2(["union", name2, join2(directives, " "),
|
|
3214
|
+
var name2 = _ref27.name, directives = _ref27.directives, types14 = _ref27.types;
|
|
3215
|
+
return join2(["union", name2, join2(directives, " "), types14 && types14.length !== 0 ? "= " + join2(types14, " | ") : ""], " ");
|
|
3216
3216
|
}),
|
|
3217
3217
|
EnumTypeDefinition: addDescription(function(_ref28) {
|
|
3218
3218
|
var name2 = _ref28.name, directives = _ref28.directives, values = _ref28.values;
|
|
@@ -3247,8 +3247,8 @@ var require_printer = __commonJS({
|
|
|
3247
3247
|
return join2(["extend interface", name2, wrap("implements ", join2(interfaces, " & ")), join2(directives, " "), block(fields)], " ");
|
|
3248
3248
|
},
|
|
3249
3249
|
UnionTypeExtension: function UnionTypeExtension(_ref36) {
|
|
3250
|
-
var name2 = _ref36.name, directives = _ref36.directives,
|
|
3251
|
-
return join2(["extend union", name2, join2(directives, " "),
|
|
3250
|
+
var name2 = _ref36.name, directives = _ref36.directives, types14 = _ref36.types;
|
|
3251
|
+
return join2(["extend union", name2, join2(directives, " "), types14 && types14.length !== 0 ? "= " + join2(types14, " | ") : ""], " ");
|
|
3252
3252
|
},
|
|
3253
3253
|
EnumTypeExtension: function EnumTypeExtension(_ref37) {
|
|
3254
3254
|
var name2 = _ref37.name, directives = _ref37.directives, values = _ref37.values;
|
|
@@ -3344,17 +3344,17 @@ var require_definition = __commonJS({
|
|
|
3344
3344
|
});
|
|
3345
3345
|
exports.isType = isType;
|
|
3346
3346
|
exports.assertType = assertType;
|
|
3347
|
-
exports.isScalarType =
|
|
3347
|
+
exports.isScalarType = isScalarType7;
|
|
3348
3348
|
exports.assertScalarType = assertScalarType;
|
|
3349
|
-
exports.isObjectType =
|
|
3349
|
+
exports.isObjectType = isObjectType3;
|
|
3350
3350
|
exports.assertObjectType = assertObjectType;
|
|
3351
3351
|
exports.isInterfaceType = isInterfaceType6;
|
|
3352
3352
|
exports.assertInterfaceType = assertInterfaceType;
|
|
3353
3353
|
exports.isUnionType = isUnionType7;
|
|
3354
3354
|
exports.assertUnionType = assertUnionType;
|
|
3355
|
-
exports.isEnumType =
|
|
3355
|
+
exports.isEnumType = isEnumType5;
|
|
3356
3356
|
exports.assertEnumType = assertEnumType;
|
|
3357
|
-
exports.isInputObjectType =
|
|
3357
|
+
exports.isInputObjectType = isInputObjectType2;
|
|
3358
3358
|
exports.assertInputObjectType = assertInputObjectType;
|
|
3359
3359
|
exports.isListType = isListType3;
|
|
3360
3360
|
exports.assertListType = assertListType;
|
|
@@ -3368,7 +3368,7 @@ var require_definition = __commonJS({
|
|
|
3368
3368
|
exports.assertLeafType = assertLeafType;
|
|
3369
3369
|
exports.isCompositeType = isCompositeType;
|
|
3370
3370
|
exports.assertCompositeType = assertCompositeType;
|
|
3371
|
-
exports.isAbstractType =
|
|
3371
|
+
exports.isAbstractType = isAbstractType3;
|
|
3372
3372
|
exports.assertAbstractType = assertAbstractType;
|
|
3373
3373
|
exports.GraphQLList = GraphQLList2;
|
|
3374
3374
|
exports.GraphQLNonNull = GraphQLNonNull2;
|
|
@@ -3423,7 +3423,7 @@ var require_definition = __commonJS({
|
|
|
3423
3423
|
return Constructor;
|
|
3424
3424
|
}
|
|
3425
3425
|
function isType(type) {
|
|
3426
|
-
return
|
|
3426
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isInputObjectType2(type) || isListType3(type) || isNonNullType6(type);
|
|
3427
3427
|
}
|
|
3428
3428
|
function assertType(type) {
|
|
3429
3429
|
if (!isType(type)) {
|
|
@@ -3431,20 +3431,20 @@ var require_definition = __commonJS({
|
|
|
3431
3431
|
}
|
|
3432
3432
|
return type;
|
|
3433
3433
|
}
|
|
3434
|
-
function
|
|
3434
|
+
function isScalarType7(type) {
|
|
3435
3435
|
return (0, _instanceOf.default)(type, GraphQLScalarType);
|
|
3436
3436
|
}
|
|
3437
3437
|
function assertScalarType(type) {
|
|
3438
|
-
if (!
|
|
3438
|
+
if (!isScalarType7(type)) {
|
|
3439
3439
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Scalar type."));
|
|
3440
3440
|
}
|
|
3441
3441
|
return type;
|
|
3442
3442
|
}
|
|
3443
|
-
function
|
|
3443
|
+
function isObjectType3(type) {
|
|
3444
3444
|
return (0, _instanceOf.default)(type, GraphQLObjectType2);
|
|
3445
3445
|
}
|
|
3446
3446
|
function assertObjectType(type) {
|
|
3447
|
-
if (!
|
|
3447
|
+
if (!isObjectType3(type)) {
|
|
3448
3448
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Object type."));
|
|
3449
3449
|
}
|
|
3450
3450
|
return type;
|
|
@@ -3467,20 +3467,20 @@ var require_definition = __commonJS({
|
|
|
3467
3467
|
}
|
|
3468
3468
|
return type;
|
|
3469
3469
|
}
|
|
3470
|
-
function
|
|
3470
|
+
function isEnumType5(type) {
|
|
3471
3471
|
return (0, _instanceOf.default)(type, GraphQLEnumType);
|
|
3472
3472
|
}
|
|
3473
3473
|
function assertEnumType(type) {
|
|
3474
|
-
if (!
|
|
3474
|
+
if (!isEnumType5(type)) {
|
|
3475
3475
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
|
|
3476
3476
|
}
|
|
3477
3477
|
return type;
|
|
3478
3478
|
}
|
|
3479
|
-
function
|
|
3479
|
+
function isInputObjectType2(type) {
|
|
3480
3480
|
return (0, _instanceOf.default)(type, GraphQLInputObjectType);
|
|
3481
3481
|
}
|
|
3482
3482
|
function assertInputObjectType(type) {
|
|
3483
|
-
if (!
|
|
3483
|
+
if (!isInputObjectType2(type)) {
|
|
3484
3484
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Input Object type."));
|
|
3485
3485
|
}
|
|
3486
3486
|
return type;
|
|
@@ -3504,7 +3504,7 @@ var require_definition = __commonJS({
|
|
|
3504
3504
|
return type;
|
|
3505
3505
|
}
|
|
3506
3506
|
function isInputType(type) {
|
|
3507
|
-
return
|
|
3507
|
+
return isScalarType7(type) || isEnumType5(type) || isInputObjectType2(type) || isWrappingType(type) && isInputType(type.ofType);
|
|
3508
3508
|
}
|
|
3509
3509
|
function assertInputType(type) {
|
|
3510
3510
|
if (!isInputType(type)) {
|
|
@@ -3513,7 +3513,7 @@ var require_definition = __commonJS({
|
|
|
3513
3513
|
return type;
|
|
3514
3514
|
}
|
|
3515
3515
|
function isOutputType(type) {
|
|
3516
|
-
return
|
|
3516
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
3517
3517
|
}
|
|
3518
3518
|
function assertOutputType(type) {
|
|
3519
3519
|
if (!isOutputType(type)) {
|
|
@@ -3522,7 +3522,7 @@ var require_definition = __commonJS({
|
|
|
3522
3522
|
return type;
|
|
3523
3523
|
}
|
|
3524
3524
|
function isLeafType(type) {
|
|
3525
|
-
return
|
|
3525
|
+
return isScalarType7(type) || isEnumType5(type);
|
|
3526
3526
|
}
|
|
3527
3527
|
function assertLeafType(type) {
|
|
3528
3528
|
if (!isLeafType(type)) {
|
|
@@ -3531,7 +3531,7 @@ var require_definition = __commonJS({
|
|
|
3531
3531
|
return type;
|
|
3532
3532
|
}
|
|
3533
3533
|
function isCompositeType(type) {
|
|
3534
|
-
return
|
|
3534
|
+
return isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type);
|
|
3535
3535
|
}
|
|
3536
3536
|
function assertCompositeType(type) {
|
|
3537
3537
|
if (!isCompositeType(type)) {
|
|
@@ -3539,11 +3539,11 @@ var require_definition = __commonJS({
|
|
|
3539
3539
|
}
|
|
3540
3540
|
return type;
|
|
3541
3541
|
}
|
|
3542
|
-
function
|
|
3542
|
+
function isAbstractType3(type) {
|
|
3543
3543
|
return isInterfaceType6(type) || isUnionType7(type);
|
|
3544
3544
|
}
|
|
3545
3545
|
function assertAbstractType(type) {
|
|
3546
|
-
if (!
|
|
3546
|
+
if (!isAbstractType3(type)) {
|
|
3547
3547
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL abstract type."));
|
|
3548
3548
|
}
|
|
3549
3549
|
return type;
|
|
@@ -3610,7 +3610,7 @@ var require_definition = __commonJS({
|
|
|
3610
3610
|
}
|
|
3611
3611
|
}
|
|
3612
3612
|
function isNamedType(type) {
|
|
3613
|
-
return
|
|
3613
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isInputObjectType2(type);
|
|
3614
3614
|
}
|
|
3615
3615
|
function assertNamedType(type) {
|
|
3616
3616
|
if (!isNamedType(type)) {
|
|
@@ -3919,9 +3919,9 @@ var require_definition = __commonJS({
|
|
|
3919
3919
|
exports.GraphQLUnionType = GraphQLUnionType;
|
|
3920
3920
|
(0, _defineInspect.default)(GraphQLUnionType);
|
|
3921
3921
|
function defineTypes(config2) {
|
|
3922
|
-
var
|
|
3923
|
-
Array.isArray(
|
|
3924
|
-
return
|
|
3922
|
+
var types14 = resolveThunk(config2.types);
|
|
3923
|
+
Array.isArray(types14) || (0, _devAssert.default)(0, "Must provide Array of types or a function which returns such an array for Union ".concat(config2.name, "."));
|
|
3924
|
+
return types14;
|
|
3925
3925
|
}
|
|
3926
3926
|
var GraphQLEnumType = /* @__PURE__ */ function() {
|
|
3927
3927
|
function GraphQLEnumType2(config2) {
|
|
@@ -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 = graphql28;
|
|
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 graphql28(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
9773
9773
|
var _arguments = arguments;
|
|
9774
9774
|
return new Promise(function(resolve2) {
|
|
9775
9775
|
return resolve2(
|
|
@@ -11558,7 +11558,7 @@ var require_buildClientSchema = __commonJS({
|
|
|
11558
11558
|
return new _definition.GraphQLUnionType({
|
|
11559
11559
|
name: unionIntrospection.name,
|
|
11560
11560
|
description: unionIntrospection.description,
|
|
11561
|
-
types: function
|
|
11561
|
+
types: function types14() {
|
|
11562
11562
|
return unionIntrospection.possibleTypes.map(getObjectType);
|
|
11563
11563
|
}
|
|
11564
11564
|
});
|
|
@@ -11903,7 +11903,7 @@ var require_extendSchema = __commonJS({
|
|
|
11903
11903
|
var config2 = type.toConfig();
|
|
11904
11904
|
var extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config2.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : [];
|
|
11905
11905
|
return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, config2), {}, {
|
|
11906
|
-
types: function
|
|
11906
|
+
types: function types14() {
|
|
11907
11907
|
return [].concat(type.getTypes().map(replaceNamedType), buildUnionTypes(extensions));
|
|
11908
11908
|
},
|
|
11909
11909
|
extensionASTNodes: config2.extensionASTNodes.concat(extensions)
|
|
@@ -12051,17 +12051,17 @@ var require_extendSchema = __commonJS({
|
|
|
12051
12051
|
return interfaces;
|
|
12052
12052
|
}
|
|
12053
12053
|
function buildUnionTypes(nodes) {
|
|
12054
|
-
var
|
|
12054
|
+
var types14 = [];
|
|
12055
12055
|
for (var _i32 = 0; _i32 < nodes.length; _i32++) {
|
|
12056
12056
|
var _node$types;
|
|
12057
12057
|
var node = nodes[_i32];
|
|
12058
12058
|
var typeNodes = (_node$types = node.types) !== null && _node$types !== void 0 ? _node$types : [];
|
|
12059
12059
|
for (var _i34 = 0; _i34 < typeNodes.length; _i34++) {
|
|
12060
12060
|
var type = typeNodes[_i34];
|
|
12061
|
-
|
|
12061
|
+
types14.push(getNamedType2(type));
|
|
12062
12062
|
}
|
|
12063
12063
|
}
|
|
12064
|
-
return
|
|
12064
|
+
return types14;
|
|
12065
12065
|
}
|
|
12066
12066
|
function buildType(astNode) {
|
|
12067
12067
|
var _typeExtensionsMap$na;
|
|
@@ -12118,7 +12118,7 @@ var require_extendSchema = __commonJS({
|
|
|
12118
12118
|
return new _definition.GraphQLUnionType({
|
|
12119
12119
|
name: name3,
|
|
12120
12120
|
description,
|
|
12121
|
-
types: function
|
|
12121
|
+
types: function types14() {
|
|
12122
12122
|
return buildUnionTypes(_allNodes3);
|
|
12123
12123
|
},
|
|
12124
12124
|
astNode,
|
|
@@ -12416,7 +12416,7 @@ var require_lexicographicSortSchema = __commonJS({
|
|
|
12416
12416
|
if ((0, _definition.isUnionType)(type)) {
|
|
12417
12417
|
var _config2 = type.toConfig();
|
|
12418
12418
|
return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, _config2), {}, {
|
|
12419
|
-
types: function
|
|
12419
|
+
types: function types14() {
|
|
12420
12420
|
return sortTypes(_config2.types);
|
|
12421
12421
|
}
|
|
12422
12422
|
}));
|
|
@@ -12501,10 +12501,10 @@ var require_printSchema = __commonJS({
|
|
|
12501
12501
|
}
|
|
12502
12502
|
function printFilteredSchema(schema, directiveFilter, typeFilter, options) {
|
|
12503
12503
|
var directives = schema.getDirectives().filter(directiveFilter);
|
|
12504
|
-
var
|
|
12504
|
+
var types14 = (0, _objectValues.default)(schema.getTypeMap()).filter(typeFilter);
|
|
12505
12505
|
return [printSchemaDefinition(schema)].concat(directives.map(function(directive) {
|
|
12506
12506
|
return printDirective(directive, options);
|
|
12507
|
-
}),
|
|
12507
|
+
}), types14.map(function(type) {
|
|
12508
12508
|
return printType(type, options);
|
|
12509
12509
|
})).filter(Boolean).join("\n\n") + "\n";
|
|
12510
12510
|
}
|
|
@@ -12579,8 +12579,8 @@ var require_printSchema = __commonJS({
|
|
|
12579
12579
|
return printDescription(options, type) + "interface ".concat(type.name) + printImplementedInterfaces(type) + printFields(options, type);
|
|
12580
12580
|
}
|
|
12581
12581
|
function printUnion(type, options) {
|
|
12582
|
-
var
|
|
12583
|
-
var possibleTypes =
|
|
12582
|
+
var types14 = type.getTypes();
|
|
12583
|
+
var possibleTypes = types14.length ? " = " + types14.join(" | ") : "";
|
|
12584
12584
|
return printDescription(options, type) + "union " + type.name + possibleTypes;
|
|
12585
12585
|
}
|
|
12586
12586
|
function printEnum(type, options) {
|
|
@@ -23908,14 +23908,14 @@ var require_lib3 = __commonJS({
|
|
|
23908
23908
|
this.preserveSpace = !!preserveSpace;
|
|
23909
23909
|
}
|
|
23910
23910
|
};
|
|
23911
|
-
var
|
|
23911
|
+
var types14 = {
|
|
23912
23912
|
brace: new TokContext("{"),
|
|
23913
23913
|
j_oTag: new TokContext("<tag"),
|
|
23914
23914
|
j_cTag: new TokContext("</tag"),
|
|
23915
23915
|
j_expr: new TokContext("<tag>...</tag>", true)
|
|
23916
23916
|
};
|
|
23917
23917
|
{
|
|
23918
|
-
|
|
23918
|
+
types14.template = new TokContext("`", true);
|
|
23919
23919
|
}
|
|
23920
23920
|
var beforeExpr = true;
|
|
23921
23921
|
var startsExpr = true;
|
|
@@ -24447,17 +24447,17 @@ var require_lib3 = __commonJS({
|
|
|
24447
24447
|
context.pop();
|
|
24448
24448
|
};
|
|
24449
24449
|
tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = (context) => {
|
|
24450
|
-
context.push(
|
|
24450
|
+
context.push(types14.brace);
|
|
24451
24451
|
};
|
|
24452
24452
|
tokenTypes[22].updateContext = (context) => {
|
|
24453
|
-
if (context[context.length - 1] ===
|
|
24453
|
+
if (context[context.length - 1] === types14.template) {
|
|
24454
24454
|
context.pop();
|
|
24455
24455
|
} else {
|
|
24456
|
-
context.push(
|
|
24456
|
+
context.push(types14.template);
|
|
24457
24457
|
}
|
|
24458
24458
|
};
|
|
24459
24459
|
tokenTypes[140].updateContext = (context) => {
|
|
24460
|
-
context.push(
|
|
24460
|
+
context.push(types14.j_expr, types14.j_oTag);
|
|
24461
24461
|
};
|
|
24462
24462
|
}
|
|
24463
24463
|
var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
|
|
@@ -25098,7 +25098,7 @@ var require_lib3 = __commonJS({
|
|
|
25098
25098
|
this.lastTokEndLoc = null;
|
|
25099
25099
|
this.lastTokStartLoc = null;
|
|
25100
25100
|
this.lastTokStart = 0;
|
|
25101
|
-
this.context = [
|
|
25101
|
+
this.context = [types14.brace];
|
|
25102
25102
|
this.canStartJSXElement = true;
|
|
25103
25103
|
this.containsEsc = false;
|
|
25104
25104
|
this.firstInvalidTemplateEscapePos = null;
|
|
@@ -29022,7 +29022,7 @@ var require_lib3 = __commonJS({
|
|
|
29022
29022
|
context
|
|
29023
29023
|
} = this.state;
|
|
29024
29024
|
const currentContext = context[context.length - 1];
|
|
29025
|
-
if (currentContext ===
|
|
29025
|
+
if (currentContext === types14.j_oTag || currentContext === types14.j_expr) {
|
|
29026
29026
|
context.pop();
|
|
29027
29027
|
}
|
|
29028
29028
|
}
|
|
@@ -30082,9 +30082,9 @@ var require_lib3 = __commonJS({
|
|
|
30082
30082
|
switch (this.state.type) {
|
|
30083
30083
|
case 5:
|
|
30084
30084
|
node = this.startNode();
|
|
30085
|
-
this.setContext(
|
|
30085
|
+
this.setContext(types14.brace);
|
|
30086
30086
|
this.next();
|
|
30087
|
-
node = this.jsxParseExpressionContainer(node,
|
|
30087
|
+
node = this.jsxParseExpressionContainer(node, types14.j_oTag);
|
|
30088
30088
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
30089
30089
|
this.raise(JsxErrors.AttributeIsEmpty, {
|
|
30090
30090
|
at: node
|
|
@@ -30107,7 +30107,7 @@ var require_lib3 = __commonJS({
|
|
|
30107
30107
|
jsxParseSpreadChild(node) {
|
|
30108
30108
|
this.next();
|
|
30109
30109
|
node.expression = this.parseExpression();
|
|
30110
|
-
this.setContext(
|
|
30110
|
+
this.setContext(types14.j_expr);
|
|
30111
30111
|
this.state.canStartJSXElement = true;
|
|
30112
30112
|
this.expect(8);
|
|
30113
30113
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -30127,11 +30127,11 @@ var require_lib3 = __commonJS({
|
|
|
30127
30127
|
jsxParseAttribute() {
|
|
30128
30128
|
const node = this.startNode();
|
|
30129
30129
|
if (this.match(5)) {
|
|
30130
|
-
this.setContext(
|
|
30130
|
+
this.setContext(types14.brace);
|
|
30131
30131
|
this.next();
|
|
30132
30132
|
this.expect(21);
|
|
30133
30133
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
30134
|
-
this.setContext(
|
|
30134
|
+
this.setContext(types14.j_oTag);
|
|
30135
30135
|
this.state.canStartJSXElement = true;
|
|
30136
30136
|
this.expect(8);
|
|
30137
30137
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
@@ -30190,12 +30190,12 @@ var require_lib3 = __commonJS({
|
|
|
30190
30190
|
break;
|
|
30191
30191
|
case 5: {
|
|
30192
30192
|
const node2 = this.startNode();
|
|
30193
|
-
this.setContext(
|
|
30193
|
+
this.setContext(types14.brace);
|
|
30194
30194
|
this.next();
|
|
30195
30195
|
if (this.match(21)) {
|
|
30196
30196
|
children.push(this.jsxParseSpreadChild(node2));
|
|
30197
30197
|
} else {
|
|
30198
|
-
children.push(this.jsxParseExpressionContainer(node2,
|
|
30198
|
+
children.push(this.jsxParseExpressionContainer(node2, types14.j_expr));
|
|
30199
30199
|
}
|
|
30200
30200
|
break;
|
|
30201
30201
|
}
|
|
@@ -30266,10 +30266,10 @@ var require_lib3 = __commonJS({
|
|
|
30266
30266
|
}
|
|
30267
30267
|
getTokenFromCode(code) {
|
|
30268
30268
|
const context = this.curContext();
|
|
30269
|
-
if (context ===
|
|
30269
|
+
if (context === types14.j_expr) {
|
|
30270
30270
|
return this.jsxReadToken();
|
|
30271
30271
|
}
|
|
30272
|
-
if (context ===
|
|
30272
|
+
if (context === types14.j_oTag || context === types14.j_cTag) {
|
|
30273
30273
|
if (isIdentifierStart(code)) {
|
|
30274
30274
|
return this.jsxReadWord();
|
|
30275
30275
|
}
|
|
@@ -30277,7 +30277,7 @@ var require_lib3 = __commonJS({
|
|
|
30277
30277
|
++this.state.pos;
|
|
30278
30278
|
return this.finishToken(141);
|
|
30279
30279
|
}
|
|
30280
|
-
if ((code === 34 || code === 39) && context ===
|
|
30280
|
+
if ((code === 34 || code === 39) && context === types14.j_oTag) {
|
|
30281
30281
|
return this.jsxReadString(code);
|
|
30282
30282
|
}
|
|
30283
30283
|
}
|
|
@@ -30293,17 +30293,17 @@ var require_lib3 = __commonJS({
|
|
|
30293
30293
|
type
|
|
30294
30294
|
} = this.state;
|
|
30295
30295
|
if (type === 56 && prevType === 140) {
|
|
30296
|
-
context.splice(-2, 2,
|
|
30296
|
+
context.splice(-2, 2, types14.j_cTag);
|
|
30297
30297
|
this.state.canStartJSXElement = false;
|
|
30298
30298
|
} else if (type === 140) {
|
|
30299
|
-
context.push(
|
|
30299
|
+
context.push(types14.j_oTag);
|
|
30300
30300
|
} else if (type === 141) {
|
|
30301
30301
|
const out = context[context.length - 1];
|
|
30302
|
-
if (out ===
|
|
30302
|
+
if (out === types14.j_oTag && prevType === 56 || out === types14.j_cTag) {
|
|
30303
30303
|
context.pop();
|
|
30304
|
-
this.state.canStartJSXElement = context[context.length - 1] ===
|
|
30304
|
+
this.state.canStartJSXElement = context[context.length - 1] === types14.j_expr;
|
|
30305
30305
|
} else {
|
|
30306
|
-
this.setContext(
|
|
30306
|
+
this.setContext(types14.j_expr);
|
|
30307
30307
|
this.state.canStartJSXElement = true;
|
|
30308
30308
|
}
|
|
30309
30309
|
} else {
|
|
@@ -31310,14 +31310,14 @@ var require_lib3 = __commonJS({
|
|
|
31310
31310
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
31311
31311
|
const node = this.startNode();
|
|
31312
31312
|
const hasLeadingOperator = this.eat(operator);
|
|
31313
|
-
const
|
|
31313
|
+
const types15 = [];
|
|
31314
31314
|
do {
|
|
31315
|
-
|
|
31315
|
+
types15.push(parseConstituentType());
|
|
31316
31316
|
} while (this.eat(operator));
|
|
31317
|
-
if (
|
|
31318
|
-
return
|
|
31317
|
+
if (types15.length === 1 && !hasLeadingOperator) {
|
|
31318
|
+
return types15[0];
|
|
31319
31319
|
}
|
|
31320
|
-
node.types =
|
|
31320
|
+
node.types = types15;
|
|
31321
31321
|
return this.finishNode(node, kind);
|
|
31322
31322
|
}
|
|
31323
31323
|
tsParseIntersectionTypeOrHigher() {
|
|
@@ -32533,7 +32533,7 @@ var require_lib3 = __commonJS({
|
|
|
32533
32533
|
context
|
|
32534
32534
|
} = this.state;
|
|
32535
32535
|
const currentContext = context[context.length - 1];
|
|
32536
|
-
if (currentContext ===
|
|
32536
|
+
if (currentContext === types14.j_oTag || currentContext === types14.j_expr) {
|
|
32537
32537
|
context.pop();
|
|
32538
32538
|
}
|
|
32539
32539
|
}
|
|
@@ -38105,9 +38105,9 @@ var require_shared = __commonJS({
|
|
|
38105
38105
|
var tslib_1 = require_tslib();
|
|
38106
38106
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
38107
38107
|
function default_1(fork) {
|
|
38108
|
-
var
|
|
38109
|
-
var Type =
|
|
38110
|
-
var builtin =
|
|
38108
|
+
var types14 = fork.use(types_1.default);
|
|
38109
|
+
var Type = types14.Type;
|
|
38110
|
+
var builtin = types14.builtInTypes;
|
|
38111
38111
|
var isNumber = builtin.number;
|
|
38112
38112
|
function geq(than) {
|
|
38113
38113
|
return Type.from(function(value) {
|
|
@@ -38257,9 +38257,9 @@ var require_types = __commonJS({
|
|
|
38257
38257
|
}(BaseType);
|
|
38258
38258
|
var OrType = function(_super) {
|
|
38259
38259
|
tslib_1.__extends(OrType2, _super);
|
|
38260
|
-
function OrType2(
|
|
38260
|
+
function OrType2(types14) {
|
|
38261
38261
|
var _this = _super.call(this) || this;
|
|
38262
|
-
_this.types =
|
|
38262
|
+
_this.types = types14;
|
|
38263
38263
|
_this.kind = "OrType";
|
|
38264
38264
|
return _this;
|
|
38265
38265
|
}
|
|
@@ -38400,11 +38400,11 @@ var require_types = __commonJS({
|
|
|
38400
38400
|
function typesPlugin(_fork) {
|
|
38401
38401
|
var Type = {
|
|
38402
38402
|
or: function() {
|
|
38403
|
-
var
|
|
38403
|
+
var types14 = [];
|
|
38404
38404
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
38405
|
-
|
|
38405
|
+
types14[_i] = arguments[_i];
|
|
38406
38406
|
}
|
|
38407
|
-
return new OrType(
|
|
38407
|
+
return new OrType(types14.map(function(type) {
|
|
38408
38408
|
return Type.from(type);
|
|
38409
38409
|
}));
|
|
38410
38410
|
},
|
|
@@ -38849,9 +38849,9 @@ var require_path2 = __commonJS({
|
|
|
38849
38849
|
var Op = Object.prototype;
|
|
38850
38850
|
var hasOwn = Op.hasOwnProperty;
|
|
38851
38851
|
function pathPlugin(fork) {
|
|
38852
|
-
var
|
|
38853
|
-
var isArray =
|
|
38854
|
-
var isNumber =
|
|
38852
|
+
var types14 = fork.use(types_1.default);
|
|
38853
|
+
var isArray = types14.builtInTypes.array;
|
|
38854
|
+
var isNumber = types14.builtInTypes.number;
|
|
38855
38855
|
var Path = function Path2(value, parentPath, name2) {
|
|
38856
38856
|
if (!(this instanceof Path2)) {
|
|
38857
38857
|
throw new Error("Path constructor cannot be invoked without 'new'");
|
|
@@ -39153,13 +39153,13 @@ var require_scope = __commonJS({
|
|
|
39153
39153
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
39154
39154
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
39155
39155
|
function scopePlugin(fork) {
|
|
39156
|
-
var
|
|
39157
|
-
var Type =
|
|
39158
|
-
var namedTypes =
|
|
39156
|
+
var types14 = fork.use(types_1.default);
|
|
39157
|
+
var Type = types14.Type;
|
|
39158
|
+
var namedTypes = types14.namedTypes;
|
|
39159
39159
|
var Node = namedTypes.Node;
|
|
39160
39160
|
var Expression = namedTypes.Expression;
|
|
39161
|
-
var isArray =
|
|
39162
|
-
var b =
|
|
39161
|
+
var isArray = types14.builtInTypes.array;
|
|
39162
|
+
var b = types14.builders;
|
|
39163
39163
|
var Scope = function Scope2(path2, parentScope) {
|
|
39164
39164
|
if (!(this instanceof Scope2)) {
|
|
39165
39165
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
@@ -39222,7 +39222,7 @@ var require_scope = __commonJS({
|
|
|
39222
39222
|
++index;
|
|
39223
39223
|
}
|
|
39224
39224
|
var name2 = prefix + index;
|
|
39225
|
-
return this.bindings[name2] =
|
|
39225
|
+
return this.bindings[name2] = types14.builders.identifier(name2);
|
|
39226
39226
|
};
|
|
39227
39227
|
Sp.injectTemporary = function(identifier, init) {
|
|
39228
39228
|
identifier || (identifier = this.declareTemporary());
|
|
@@ -39298,7 +39298,7 @@ var require_scope = __commonJS({
|
|
|
39298
39298
|
bindings
|
|
39299
39299
|
);
|
|
39300
39300
|
} else if (Node.check(node) && !Expression.check(node)) {
|
|
39301
|
-
|
|
39301
|
+
types14.eachField(node, function(name2, child) {
|
|
39302
39302
|
var childPath = path2.get(name2);
|
|
39303
39303
|
if (!pathHasValue(childPath, child)) {
|
|
39304
39304
|
throw new Error("");
|
|
@@ -39376,24 +39376,24 @@ var require_scope = __commonJS({
|
|
|
39376
39376
|
addPattern(patternPath.get("argument"), bindings);
|
|
39377
39377
|
}
|
|
39378
39378
|
}
|
|
39379
|
-
function addTypePattern(patternPath,
|
|
39379
|
+
function addTypePattern(patternPath, types15) {
|
|
39380
39380
|
var pattern = patternPath.value;
|
|
39381
39381
|
namedTypes.Pattern.assert(pattern);
|
|
39382
39382
|
if (namedTypes.Identifier.check(pattern)) {
|
|
39383
|
-
if (hasOwn.call(
|
|
39384
|
-
|
|
39383
|
+
if (hasOwn.call(types15, pattern.name)) {
|
|
39384
|
+
types15[pattern.name].push(patternPath);
|
|
39385
39385
|
} else {
|
|
39386
|
-
|
|
39386
|
+
types15[pattern.name] = [patternPath];
|
|
39387
39387
|
}
|
|
39388
39388
|
}
|
|
39389
39389
|
}
|
|
39390
|
-
function addTypeParameter(parameterPath,
|
|
39390
|
+
function addTypeParameter(parameterPath, types15) {
|
|
39391
39391
|
var parameter = parameterPath.value;
|
|
39392
39392
|
FlowOrTSTypeParameterType.assert(parameter);
|
|
39393
|
-
if (hasOwn.call(
|
|
39394
|
-
|
|
39393
|
+
if (hasOwn.call(types15, parameter.name)) {
|
|
39394
|
+
types15[parameter.name].push(parameterPath);
|
|
39395
39395
|
} else {
|
|
39396
|
-
|
|
39396
|
+
types15[parameter.name] = [parameterPath];
|
|
39397
39397
|
}
|
|
39398
39398
|
}
|
|
39399
39399
|
Sp.lookup = function(name2) {
|
|
@@ -39434,11 +39434,11 @@ var require_node_path = __commonJS({
|
|
|
39434
39434
|
var scope_1 = tslib_1.__importDefault(require_scope());
|
|
39435
39435
|
var shared_1 = require_shared();
|
|
39436
39436
|
function nodePathPlugin(fork) {
|
|
39437
|
-
var
|
|
39438
|
-
var n =
|
|
39439
|
-
var b =
|
|
39440
|
-
var isNumber =
|
|
39441
|
-
var isArray =
|
|
39437
|
+
var types14 = fork.use(types_1.default);
|
|
39438
|
+
var n = types14.namedTypes;
|
|
39439
|
+
var b = types14.builders;
|
|
39440
|
+
var isNumber = types14.builtInTypes.number;
|
|
39441
|
+
var isArray = types14.builtInTypes.array;
|
|
39442
39442
|
var Path = fork.use(path_1.default);
|
|
39443
39443
|
var Scope = fork.use(scope_1.default);
|
|
39444
39444
|
var NodePath = function NodePath2(value, parentPath, name2) {
|
|
@@ -39529,7 +39529,7 @@ var require_node_path = __commonJS({
|
|
|
39529
39529
|
return scope || null;
|
|
39530
39530
|
};
|
|
39531
39531
|
NPp.getValueProperty = function(name2) {
|
|
39532
|
-
return
|
|
39532
|
+
return types14.getFieldValue(this.value, name2);
|
|
39533
39533
|
};
|
|
39534
39534
|
NPp.needsParens = function(assumeExpressionContext) {
|
|
39535
39535
|
var pp = this.parentPath;
|
|
@@ -39671,7 +39671,7 @@ var require_node_path = __commonJS({
|
|
|
39671
39671
|
return node.some(containsCallExpression);
|
|
39672
39672
|
}
|
|
39673
39673
|
if (n.Node.check(node)) {
|
|
39674
|
-
return
|
|
39674
|
+
return types14.someField(node, function(_name, child) {
|
|
39675
39675
|
return containsCallExpression(child);
|
|
39676
39676
|
});
|
|
39677
39677
|
}
|
|
@@ -39792,11 +39792,11 @@ var require_path_visitor = __commonJS({
|
|
|
39792
39792
|
var shared_1 = require_shared();
|
|
39793
39793
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
39794
39794
|
function pathVisitorPlugin(fork) {
|
|
39795
|
-
var
|
|
39795
|
+
var types14 = fork.use(types_1.default);
|
|
39796
39796
|
var NodePath = fork.use(node_path_1.default);
|
|
39797
|
-
var isArray =
|
|
39798
|
-
var isObject =
|
|
39799
|
-
var isFunction =
|
|
39797
|
+
var isArray = types14.builtInTypes.array;
|
|
39798
|
+
var isObject = types14.builtInTypes.object;
|
|
39799
|
+
var isFunction = types14.builtInTypes.function;
|
|
39800
39800
|
var undefined2;
|
|
39801
39801
|
var PathVisitor = function PathVisitor2() {
|
|
39802
39802
|
if (!(this instanceof PathVisitor2)) {
|
|
@@ -39816,7 +39816,7 @@ var require_path_visitor = __commonJS({
|
|
|
39816
39816
|
typeNames[methodName.slice("visit".length)] = true;
|
|
39817
39817
|
}
|
|
39818
39818
|
}
|
|
39819
|
-
var supertypeTable =
|
|
39819
|
+
var supertypeTable = types14.computeSupertypeLookupTable(typeNames);
|
|
39820
39820
|
var methodNameTable = /* @__PURE__ */ Object.create(null);
|
|
39821
39821
|
var typeNameKeys = Object.keys(supertypeTable);
|
|
39822
39822
|
var typeNameCount = typeNameKeys.length;
|
|
@@ -39858,7 +39858,7 @@ var require_path_visitor = __commonJS({
|
|
|
39858
39858
|
}
|
|
39859
39859
|
return target;
|
|
39860
39860
|
}
|
|
39861
|
-
PathVisitor.visit = function
|
|
39861
|
+
PathVisitor.visit = function visit12(node, methods) {
|
|
39862
39862
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
39863
39863
|
};
|
|
39864
39864
|
var PVp = PathVisitor.prototype;
|
|
@@ -39935,7 +39935,7 @@ var require_path_visitor = __commonJS({
|
|
|
39935
39935
|
path2.each(visitor.visitWithoutReset, visitor);
|
|
39936
39936
|
} else if (!isObject.check(value)) {
|
|
39937
39937
|
} else {
|
|
39938
|
-
var childNames =
|
|
39938
|
+
var childNames = types14.getFieldNames(value);
|
|
39939
39939
|
if (visitor._shouldVisitComments && value.comments && childNames.indexOf("comments") < 0) {
|
|
39940
39940
|
childNames.push("comments");
|
|
39941
39941
|
}
|
|
@@ -39944,7 +39944,7 @@ var require_path_visitor = __commonJS({
|
|
|
39944
39944
|
for (var i = 0; i < childCount; ++i) {
|
|
39945
39945
|
var childName = childNames[i];
|
|
39946
39946
|
if (!hasOwn.call(value, childName)) {
|
|
39947
|
-
value[childName] =
|
|
39947
|
+
value[childName] = types14.getFieldValue(value, childName);
|
|
39948
39948
|
}
|
|
39949
39949
|
childPaths.push(path2.get(childName));
|
|
39950
39950
|
}
|
|
@@ -40049,7 +40049,7 @@ var require_path_visitor = __commonJS({
|
|
|
40049
40049
|
this.needToCallTraverse = false;
|
|
40050
40050
|
return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
40051
40051
|
};
|
|
40052
|
-
sharedContextProtoMethods.visit = function
|
|
40052
|
+
sharedContextProtoMethods.visit = function visit12(path2, newVisitor) {
|
|
40053
40053
|
if (!(this instanceof this.Context)) {
|
|
40054
40054
|
throw new Error("");
|
|
40055
40055
|
}
|
|
@@ -40087,13 +40087,13 @@ var require_equiv = __commonJS({
|
|
|
40087
40087
|
var shared_1 = require_shared();
|
|
40088
40088
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
40089
40089
|
function default_1(fork) {
|
|
40090
|
-
var
|
|
40091
|
-
var getFieldNames =
|
|
40092
|
-
var getFieldValue =
|
|
40093
|
-
var isArray =
|
|
40094
|
-
var isObject =
|
|
40095
|
-
var isDate =
|
|
40096
|
-
var isRegExp =
|
|
40090
|
+
var types14 = fork.use(types_1.default);
|
|
40091
|
+
var getFieldNames = types14.getFieldNames;
|
|
40092
|
+
var getFieldValue = types14.getFieldValue;
|
|
40093
|
+
var isArray = types14.builtInTypes.array;
|
|
40094
|
+
var isObject = types14.builtInTypes.object;
|
|
40095
|
+
var isDate = types14.builtInTypes.Date;
|
|
40096
|
+
var isRegExp = types14.builtInTypes.RegExp;
|
|
40097
40097
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
40098
40098
|
function astNodesAreEquivalent(a, b, problemPath) {
|
|
40099
40099
|
if (isArray.check(problemPath)) {
|
|
@@ -40246,24 +40246,24 @@ var require_fork = __commonJS({
|
|
|
40246
40246
|
var shared_1 = require_shared();
|
|
40247
40247
|
function default_1(plugins) {
|
|
40248
40248
|
var fork = createFork();
|
|
40249
|
-
var
|
|
40249
|
+
var types14 = fork.use(types_1.default);
|
|
40250
40250
|
plugins.forEach(fork.use);
|
|
40251
|
-
|
|
40251
|
+
types14.finalize();
|
|
40252
40252
|
var PathVisitor = fork.use(path_visitor_1.default);
|
|
40253
40253
|
return {
|
|
40254
|
-
Type:
|
|
40255
|
-
builtInTypes:
|
|
40256
|
-
namedTypes:
|
|
40257
|
-
builders:
|
|
40258
|
-
defineMethod:
|
|
40259
|
-
getFieldNames:
|
|
40260
|
-
getFieldValue:
|
|
40261
|
-
eachField:
|
|
40262
|
-
someField:
|
|
40263
|
-
getSupertypeNames:
|
|
40264
|
-
getBuilderName:
|
|
40254
|
+
Type: types14.Type,
|
|
40255
|
+
builtInTypes: types14.builtInTypes,
|
|
40256
|
+
namedTypes: types14.namedTypes,
|
|
40257
|
+
builders: types14.builders,
|
|
40258
|
+
defineMethod: types14.defineMethod,
|
|
40259
|
+
getFieldNames: types14.getFieldNames,
|
|
40260
|
+
getFieldValue: types14.getFieldValue,
|
|
40261
|
+
eachField: types14.eachField,
|
|
40262
|
+
someField: types14.someField,
|
|
40263
|
+
getSupertypeNames: types14.getSupertypeNames,
|
|
40264
|
+
getBuilderName: types14.getBuilderName,
|
|
40265
40265
|
astNodesAreEquivalent: fork.use(equiv_1.default),
|
|
40266
|
-
finalize:
|
|
40266
|
+
finalize: types14.finalize,
|
|
40267
40267
|
Path: fork.use(path_1.default),
|
|
40268
40268
|
NodePath: fork.use(node_path_1.default),
|
|
40269
40269
|
PathVisitor,
|
|
@@ -40433,8 +40433,8 @@ var require_core2 = __commonJS({
|
|
|
40433
40433
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
40434
40434
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40435
40435
|
function default_1(fork) {
|
|
40436
|
-
var
|
|
40437
|
-
var Type =
|
|
40436
|
+
var types14 = fork.use(types_1.default);
|
|
40437
|
+
var Type = types14.Type;
|
|
40438
40438
|
var def = Type.def;
|
|
40439
40439
|
var or = Type.or;
|
|
40440
40440
|
var shared = fork.use(shared_1.default);
|
|
@@ -40526,9 +40526,9 @@ var require_es6 = __commonJS({
|
|
|
40526
40526
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40527
40527
|
function default_1(fork) {
|
|
40528
40528
|
fork.use(core_1.default);
|
|
40529
|
-
var
|
|
40530
|
-
var def =
|
|
40531
|
-
var or =
|
|
40529
|
+
var types14 = fork.use(types_1.default);
|
|
40530
|
+
var def = types14.Type.def;
|
|
40531
|
+
var or = types14.Type.or;
|
|
40532
40532
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40533
40533
|
def("Function").field("generator", Boolean, defaults["false"]).field("expression", Boolean, defaults["false"]).field("defaults", [or(def("Expression"), null)], defaults.emptyArray).field("rest", or(def("Identifier"), null), defaults["null"]);
|
|
40534
40534
|
def("RestElement").bases("Pattern").build("argument").field("argument", def("Pattern")).field(
|
|
@@ -40618,8 +40618,8 @@ var require_es2017 = __commonJS({
|
|
|
40618
40618
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40619
40619
|
function default_1(fork) {
|
|
40620
40620
|
fork.use(es2016_1.default);
|
|
40621
|
-
var
|
|
40622
|
-
var def =
|
|
40621
|
+
var types14 = fork.use(types_1.default);
|
|
40622
|
+
var def = types14.Type.def;
|
|
40623
40623
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40624
40624
|
def("Function").field("async", Boolean, defaults["false"]);
|
|
40625
40625
|
def("AwaitExpression").bases("Expression").build("argument").field("argument", def("Expression"));
|
|
@@ -40642,9 +40642,9 @@ var require_es2018 = __commonJS({
|
|
|
40642
40642
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40643
40643
|
function default_1(fork) {
|
|
40644
40644
|
fork.use(es2017_1.default);
|
|
40645
|
-
var
|
|
40646
|
-
var def =
|
|
40647
|
-
var or =
|
|
40645
|
+
var types14 = fork.use(types_1.default);
|
|
40646
|
+
var def = types14.Type.def;
|
|
40647
|
+
var or = types14.Type.or;
|
|
40648
40648
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40649
40649
|
def("ForOfStatement").field("await", Boolean, defaults["false"]);
|
|
40650
40650
|
def("SpreadProperty").bases("Node").build("argument").field("argument", def("Expression"));
|
|
@@ -40675,9 +40675,9 @@ var require_es2019 = __commonJS({
|
|
|
40675
40675
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40676
40676
|
function default_1(fork) {
|
|
40677
40677
|
fork.use(es2018_1.default);
|
|
40678
|
-
var
|
|
40679
|
-
var def =
|
|
40680
|
-
var or =
|
|
40678
|
+
var types14 = fork.use(types_1.default);
|
|
40679
|
+
var def = types14.Type.def;
|
|
40680
|
+
var or = types14.Type.or;
|
|
40681
40681
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40682
40682
|
def("CatchClause").field("param", or(def("Pattern"), null), defaults["null"]);
|
|
40683
40683
|
}
|
|
@@ -40701,9 +40701,9 @@ var require_es20202 = __commonJS({
|
|
|
40701
40701
|
function default_1(fork) {
|
|
40702
40702
|
fork.use(es2020_1.default);
|
|
40703
40703
|
fork.use(es2019_1.default);
|
|
40704
|
-
var
|
|
40705
|
-
var def =
|
|
40706
|
-
var or =
|
|
40704
|
+
var types14 = fork.use(types_1.default);
|
|
40705
|
+
var def = types14.Type.def;
|
|
40706
|
+
var or = types14.Type.or;
|
|
40707
40707
|
var shared = fork.use(shared_1.default);
|
|
40708
40708
|
var defaults = shared.defaults;
|
|
40709
40709
|
def("ImportExpression").bases("Expression").build("source").field("source", def("Expression"));
|
|
@@ -40753,8 +40753,8 @@ var require_es2022 = __commonJS({
|
|
|
40753
40753
|
var shared_1 = require_shared();
|
|
40754
40754
|
function default_1(fork) {
|
|
40755
40755
|
fork.use(es2021_1.default);
|
|
40756
|
-
var
|
|
40757
|
-
var def =
|
|
40756
|
+
var types14 = fork.use(types_1.default);
|
|
40757
|
+
var def = types14.Type.def;
|
|
40758
40758
|
def("StaticBlock").bases("Declaration").build("body").field("body", [def("Statement")]);
|
|
40759
40759
|
}
|
|
40760
40760
|
exports.default = default_1;
|
|
@@ -40775,9 +40775,9 @@ var require_es_proposals = __commonJS({
|
|
|
40775
40775
|
var es2022_1 = tslib_1.__importDefault(require_es2022());
|
|
40776
40776
|
function default_1(fork) {
|
|
40777
40777
|
fork.use(es2022_1.default);
|
|
40778
|
-
var
|
|
40779
|
-
var Type =
|
|
40780
|
-
var def =
|
|
40778
|
+
var types14 = fork.use(types_1.default);
|
|
40779
|
+
var Type = types14.Type;
|
|
40780
|
+
var def = types14.Type.def;
|
|
40781
40781
|
var or = Type.or;
|
|
40782
40782
|
var shared = fork.use(shared_1.default);
|
|
40783
40783
|
var defaults = shared.defaults;
|
|
@@ -40817,9 +40817,9 @@ var require_jsx = __commonJS({
|
|
|
40817
40817
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40818
40818
|
function default_1(fork) {
|
|
40819
40819
|
fork.use(es_proposals_1.default);
|
|
40820
|
-
var
|
|
40821
|
-
var def =
|
|
40822
|
-
var or =
|
|
40820
|
+
var types14 = fork.use(types_1.default);
|
|
40821
|
+
var def = types14.Type.def;
|
|
40822
|
+
var or = types14.Type.or;
|
|
40823
40823
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40824
40824
|
def("JSXAttribute").bases("Node").build("name", "value").field("name", or(def("JSXIdentifier"), def("JSXNamespacedName"))).field("value", or(
|
|
40825
40825
|
def("Literal"),
|
|
@@ -40877,9 +40877,9 @@ var require_type_annotations = __commonJS({
|
|
|
40877
40877
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
40878
40878
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40879
40879
|
function default_1(fork) {
|
|
40880
|
-
var
|
|
40881
|
-
var def =
|
|
40882
|
-
var or =
|
|
40880
|
+
var types14 = fork.use(types_1.default);
|
|
40881
|
+
var def = types14.Type.def;
|
|
40882
|
+
var or = types14.Type.or;
|
|
40883
40883
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40884
40884
|
var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
|
|
40885
40885
|
var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
|
|
@@ -40914,9 +40914,9 @@ var require_flow = __commonJS({
|
|
|
40914
40914
|
function default_1(fork) {
|
|
40915
40915
|
fork.use(es_proposals_1.default);
|
|
40916
40916
|
fork.use(type_annotations_1.default);
|
|
40917
|
-
var
|
|
40918
|
-
var def =
|
|
40919
|
-
var or =
|
|
40917
|
+
var types14 = fork.use(types_1.default);
|
|
40918
|
+
var def = types14.Type.def;
|
|
40919
|
+
var or = types14.Type.or;
|
|
40920
40920
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40921
40921
|
def("Flow").bases("Node");
|
|
40922
40922
|
def("FlowType").bases("Flow");
|
|
@@ -41030,10 +41030,10 @@ var require_esprima = __commonJS({
|
|
|
41030
41030
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
41031
41031
|
function default_1(fork) {
|
|
41032
41032
|
fork.use(es_proposals_1.default);
|
|
41033
|
-
var
|
|
41033
|
+
var types14 = fork.use(types_1.default);
|
|
41034
41034
|
var defaults = fork.use(shared_1.default).defaults;
|
|
41035
|
-
var def =
|
|
41036
|
-
var or =
|
|
41035
|
+
var def = types14.Type.def;
|
|
41036
|
+
var or = types14.Type.or;
|
|
41037
41037
|
def("VariableDeclaration").field("declarations", [or(
|
|
41038
41038
|
def("VariableDeclarator"),
|
|
41039
41039
|
def("Identifier")
|
|
@@ -41078,11 +41078,11 @@ var require_babel_core = __commonJS({
|
|
|
41078
41078
|
function default_1(fork) {
|
|
41079
41079
|
var _a, _b, _c, _d, _e;
|
|
41080
41080
|
fork.use(es_proposals_1.default);
|
|
41081
|
-
var
|
|
41081
|
+
var types14 = fork.use(types_1.default);
|
|
41082
41082
|
var defaults = fork.use(shared_1.default).defaults;
|
|
41083
|
-
var def =
|
|
41084
|
-
var or =
|
|
41085
|
-
var isUndefined =
|
|
41083
|
+
var def = types14.Type.def;
|
|
41084
|
+
var or = types14.Type.or;
|
|
41085
|
+
var isUndefined = types14.builtInTypes.undefined;
|
|
41086
41086
|
def("Noop").bases("Statement").build();
|
|
41087
41087
|
def("DoExpression").bases("Expression").build("body").field("body", [def("Statement")]);
|
|
41088
41088
|
def("BindExpression").bases("Expression").build("object", "callee").field("object", or(def("Expression"), null)).field("callee", def("Expression"));
|
|
@@ -41107,7 +41107,7 @@ var require_babel_core = __commonJS({
|
|
|
41107
41107
|
raw: String
|
|
41108
41108
|
},
|
|
41109
41109
|
function getDefault() {
|
|
41110
|
-
var value =
|
|
41110
|
+
var value = types14.getFieldValue(this, "value");
|
|
41111
41111
|
return {
|
|
41112
41112
|
rawValue: value,
|
|
41113
41113
|
raw: toRaw ? toRaw(value) : String(value)
|
|
@@ -41210,8 +41210,8 @@ var require_babel = __commonJS({
|
|
|
41210
41210
|
var flow_1 = tslib_1.__importDefault(require_flow());
|
|
41211
41211
|
var shared_1 = require_shared();
|
|
41212
41212
|
function default_1(fork) {
|
|
41213
|
-
var
|
|
41214
|
-
var def =
|
|
41213
|
+
var types14 = fork.use(types_1.default);
|
|
41214
|
+
var def = types14.Type.def;
|
|
41215
41215
|
fork.use(babel_core_1.default);
|
|
41216
41216
|
fork.use(flow_1.default);
|
|
41217
41217
|
def("V8IntrinsicIdentifier").bases("Expression").build("name").field("name", String);
|
|
@@ -41237,12 +41237,12 @@ var require_typescript = __commonJS({
|
|
|
41237
41237
|
function default_1(fork) {
|
|
41238
41238
|
fork.use(babel_core_1.default);
|
|
41239
41239
|
fork.use(type_annotations_1.default);
|
|
41240
|
-
var
|
|
41241
|
-
var n =
|
|
41242
|
-
var def =
|
|
41243
|
-
var or =
|
|
41240
|
+
var types14 = fork.use(types_1.default);
|
|
41241
|
+
var n = types14.namedTypes;
|
|
41242
|
+
var def = types14.Type.def;
|
|
41243
|
+
var or = types14.Type.or;
|
|
41244
41244
|
var defaults = fork.use(shared_1.default).defaults;
|
|
41245
|
-
var StringLiteral =
|
|
41245
|
+
var StringLiteral = types14.Type.from(function(value, deep) {
|
|
41246
41246
|
if (n.StringLiteral && n.StringLiteral.check(value, deep)) {
|
|
41247
41247
|
return true;
|
|
41248
41248
|
}
|
|
@@ -41442,7 +41442,7 @@ var require_main = __commonJS({
|
|
|
41442
41442
|
var someField = _a.someField;
|
|
41443
41443
|
var Type = _a.Type;
|
|
41444
41444
|
var use = _a.use;
|
|
41445
|
-
var
|
|
41445
|
+
var visit12 = _a.visit;
|
|
41446
41446
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
41447
41447
|
exports.builders = builders;
|
|
41448
41448
|
exports.builtInTypes = builtInTypes;
|
|
@@ -41459,7 +41459,7 @@ var require_main = __commonJS({
|
|
|
41459
41459
|
exports.someField = someField;
|
|
41460
41460
|
exports.Type = Type;
|
|
41461
41461
|
exports.use = use;
|
|
41462
|
-
exports.visit =
|
|
41462
|
+
exports.visit = visit12;
|
|
41463
41463
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
41464
41464
|
}
|
|
41465
41465
|
});
|
|
@@ -43218,8 +43218,8 @@ var require_util2 = __commonJS({
|
|
|
43218
43218
|
exports.isTrailingCommaEnabled = exports.getParentExportDeclaration = exports.isExportDeclaration = exports.fixFaultyLocations = exports.getTrueLoc = exports.composeSourceMaps = exports.copyPos = exports.comparePos = exports.getUnionOfKeys = exports.getOption = exports.isBrowser = exports.getLineTerminator = void 0;
|
|
43219
43219
|
var tslib_1 = require_tslib();
|
|
43220
43220
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
43221
|
-
var
|
|
43222
|
-
var n =
|
|
43221
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
43222
|
+
var n = types14.namedTypes;
|
|
43223
43223
|
var source_map_1 = tslib_1.__importDefault(require_source_map());
|
|
43224
43224
|
var SourceMapConsumer = source_map_1.default.SourceMapConsumer;
|
|
43225
43225
|
var SourceMapGenerator = source_map_1.default.SourceMapGenerator;
|
|
@@ -50537,10 +50537,10 @@ var require_comments = __commonJS({
|
|
|
50537
50537
|
exports.printComments = exports.attach = void 0;
|
|
50538
50538
|
var tslib_1 = require_tslib();
|
|
50539
50539
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
50540
|
-
var
|
|
50541
|
-
var n =
|
|
50542
|
-
var isArray =
|
|
50543
|
-
var isObject =
|
|
50540
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
50541
|
+
var n = types14.namedTypes;
|
|
50542
|
+
var isArray = types14.builtInTypes.array;
|
|
50543
|
+
var isObject = types14.builtInTypes.object;
|
|
50544
50544
|
var lines_1 = require_lines();
|
|
50545
50545
|
var util_1 = require_util2();
|
|
50546
50546
|
var childNodesCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -50571,7 +50571,7 @@ var require_comments = __commonJS({
|
|
|
50571
50571
|
if (isArray.check(node)) {
|
|
50572
50572
|
names = Object.keys(node);
|
|
50573
50573
|
} else if (isObject.check(node)) {
|
|
50574
|
-
names =
|
|
50574
|
+
names = types14.getFieldNames(node);
|
|
50575
50575
|
} else {
|
|
50576
50576
|
return resultArray;
|
|
50577
50577
|
}
|
|
@@ -50749,7 +50749,7 @@ var require_comments = __commonJS({
|
|
|
50749
50749
|
function printComments(path2, print9) {
|
|
50750
50750
|
var value = path2.getValue();
|
|
50751
50751
|
var innerLines = print9(path2);
|
|
50752
|
-
var comments = n.Node.check(value) &&
|
|
50752
|
+
var comments = n.Node.check(value) && types14.getFieldValue(value, "comments");
|
|
50753
50753
|
if (!comments || comments.length === 0) {
|
|
50754
50754
|
return innerLines;
|
|
50755
50755
|
}
|
|
@@ -50757,8 +50757,8 @@ var require_comments = __commonJS({
|
|
|
50757
50757
|
var trailingParts = [innerLines];
|
|
50758
50758
|
path2.each(function(commentPath) {
|
|
50759
50759
|
var comment = commentPath.getValue();
|
|
50760
|
-
var leading =
|
|
50761
|
-
var trailing =
|
|
50760
|
+
var leading = types14.getFieldValue(comment, "leading");
|
|
50761
|
+
var trailing = types14.getFieldValue(comment, "trailing");
|
|
50762
50762
|
if (leading || trailing && !(n.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
50763
50763
|
leadingParts.push(printLeadingComment(commentPath, print9));
|
|
50764
50764
|
} else if (trailing) {
|
|
@@ -50780,10 +50780,10 @@ var require_parser2 = __commonJS({
|
|
|
50780
50780
|
exports.parse = void 0;
|
|
50781
50781
|
var tslib_1 = require_tslib();
|
|
50782
50782
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
50783
|
-
var
|
|
50784
|
-
var b =
|
|
50785
|
-
var isObject =
|
|
50786
|
-
var isArray =
|
|
50783
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
50784
|
+
var b = types14.builders;
|
|
50785
|
+
var isObject = types14.builtInTypes.object;
|
|
50786
|
+
var isArray = types14.builtInTypes.array;
|
|
50787
50787
|
var options_1 = require_options();
|
|
50788
50788
|
var lines_1 = require_lines();
|
|
50789
50789
|
var comments_1 = require_comments();
|
|
@@ -50969,11 +50969,11 @@ var require_fast_path = __commonJS({
|
|
|
50969
50969
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50970
50970
|
var tslib_1 = require_tslib();
|
|
50971
50971
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
50972
|
-
var
|
|
50972
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
50973
50973
|
var util = tslib_1.__importStar(require_util2());
|
|
50974
|
-
var n =
|
|
50975
|
-
var isArray =
|
|
50976
|
-
var isNumber =
|
|
50974
|
+
var n = types14.namedTypes;
|
|
50975
|
+
var isArray = types14.builtInTypes.array;
|
|
50976
|
+
var isNumber = types14.builtInTypes.number;
|
|
50977
50977
|
var PRECEDENCE = {};
|
|
50978
50978
|
[
|
|
50979
50979
|
["??"],
|
|
@@ -51002,7 +51002,7 @@ var require_fast_path = __commonJS({
|
|
|
51002
51002
|
if (obj instanceof FastPath) {
|
|
51003
51003
|
return obj.copy();
|
|
51004
51004
|
}
|
|
51005
|
-
if (obj instanceof
|
|
51005
|
+
if (obj instanceof types14.NodePath) {
|
|
51006
51006
|
var copy = Object.create(FastPath.prototype);
|
|
51007
51007
|
var stack = [obj.value];
|
|
51008
51008
|
for (var pp = void 0; pp = obj.parentPath; obj = pp)
|
|
@@ -51313,7 +51313,7 @@ var require_fast_path = __commonJS({
|
|
|
51313
51313
|
return node.some(containsCallExpression);
|
|
51314
51314
|
}
|
|
51315
51315
|
if (n.Node.check(node)) {
|
|
51316
|
-
return
|
|
51316
|
+
return types14.someField(node, function(_name, child) {
|
|
51317
51317
|
return containsCallExpression(child);
|
|
51318
51318
|
});
|
|
51319
51319
|
}
|
|
@@ -51403,16 +51403,16 @@ var require_patcher = __commonJS({
|
|
|
51403
51403
|
var tslib_1 = require_tslib();
|
|
51404
51404
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
51405
51405
|
var linesModule = tslib_1.__importStar(require_lines());
|
|
51406
|
-
var
|
|
51407
|
-
var Printable =
|
|
51408
|
-
var Expression =
|
|
51409
|
-
var ReturnStatement =
|
|
51410
|
-
var SourceLocation =
|
|
51406
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
51407
|
+
var Printable = types14.namedTypes.Printable;
|
|
51408
|
+
var Expression = types14.namedTypes.Expression;
|
|
51409
|
+
var ReturnStatement = types14.namedTypes.ReturnStatement;
|
|
51410
|
+
var SourceLocation = types14.namedTypes.SourceLocation;
|
|
51411
51411
|
var util_1 = require_util2();
|
|
51412
51412
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
51413
|
-
var isObject =
|
|
51414
|
-
var isArray =
|
|
51415
|
-
var isString =
|
|
51413
|
+
var isObject = types14.builtInTypes.object;
|
|
51414
|
+
var isArray = types14.builtInTypes.array;
|
|
51415
|
+
var isString = types14.builtInTypes.string;
|
|
51416
51416
|
var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
|
|
51417
51417
|
var Patcher = function Patcher2(lines) {
|
|
51418
51418
|
assert_1.default.ok(this instanceof Patcher2);
|
|
@@ -51682,8 +51682,8 @@ var require_patcher = __commonJS({
|
|
|
51682
51682
|
if (k.charAt(0) === "_") {
|
|
51683
51683
|
continue;
|
|
51684
51684
|
}
|
|
51685
|
-
newPath.stack.push(k,
|
|
51686
|
-
oldPath.stack.push(k,
|
|
51685
|
+
newPath.stack.push(k, types14.getFieldValue(newNode, k));
|
|
51686
|
+
oldPath.stack.push(k, types14.getFieldValue(oldNode, k));
|
|
51687
51687
|
var canReprint = findAnyReprints(newPath, oldPath, reprints);
|
|
51688
51688
|
newPath.stack.length -= 2;
|
|
51689
51689
|
oldPath.stack.length -= 2;
|
|
@@ -51707,16 +51707,16 @@ var require_printer2 = __commonJS({
|
|
|
51707
51707
|
exports.Printer = void 0;
|
|
51708
51708
|
var tslib_1 = require_tslib();
|
|
51709
51709
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
51710
|
-
var
|
|
51710
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
51711
51711
|
var comments_1 = require_comments();
|
|
51712
51712
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
51713
51713
|
var lines_1 = require_lines();
|
|
51714
51714
|
var options_1 = require_options();
|
|
51715
51715
|
var patcher_1 = require_patcher();
|
|
51716
51716
|
var util = tslib_1.__importStar(require_util2());
|
|
51717
|
-
var namedTypes =
|
|
51718
|
-
var isString =
|
|
51719
|
-
var isObject =
|
|
51717
|
+
var namedTypes = types14.namedTypes;
|
|
51718
|
+
var isString = types14.builtInTypes.string;
|
|
51719
|
+
var isObject = types14.builtInTypes.object;
|
|
51720
51720
|
var PrintResult = function PrintResult2(code, sourceMap) {
|
|
51721
51721
|
assert_1.default.ok(this instanceof PrintResult2);
|
|
51722
51722
|
isString.assert(code);
|
|
@@ -51878,7 +51878,7 @@ var require_printer2 = __commonJS({
|
|
|
51878
51878
|
case "OptionalMemberExpression": {
|
|
51879
51879
|
parts.push(path2.call(print9, "object"));
|
|
51880
51880
|
var property = path2.call(print9, "property");
|
|
51881
|
-
var optional =
|
|
51881
|
+
var optional = types14.getFieldValue(n, "optional");
|
|
51882
51882
|
if (n.computed) {
|
|
51883
51883
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
51884
51884
|
} else {
|
|
@@ -52149,7 +52149,7 @@ var require_printer2 = __commonJS({
|
|
|
52149
52149
|
if (n.typeArguments) {
|
|
52150
52150
|
parts.push(path2.call(print9, "typeArguments"));
|
|
52151
52151
|
}
|
|
52152
|
-
if (
|
|
52152
|
+
if (types14.getFieldValue(n, "optional")) {
|
|
52153
52153
|
parts.push("?.");
|
|
52154
52154
|
}
|
|
52155
52155
|
parts.push(printArgumentsList(path2, options, print9));
|
|
@@ -53828,8 +53828,8 @@ var require_printer2 = __commonJS({
|
|
|
53828
53828
|
});
|
|
53829
53829
|
}
|
|
53830
53830
|
function getPossibleRaw(node) {
|
|
53831
|
-
var value =
|
|
53832
|
-
var extra =
|
|
53831
|
+
var value = types14.getFieldValue(node, "value");
|
|
53832
|
+
var extra = types14.getFieldValue(node, "extra");
|
|
53833
53833
|
if (extra && typeof extra.raw === "string" && value == extra.rawValue) {
|
|
53834
53834
|
return extra.raw;
|
|
53835
53835
|
}
|
|
@@ -53877,8 +53877,8 @@ var require_main2 = __commonJS({
|
|
|
53877
53877
|
exports.run = exports.prettyPrint = exports.print = exports.visit = exports.types = exports.parse = void 0;
|
|
53878
53878
|
var tslib_1 = require_tslib();
|
|
53879
53879
|
var fs_1 = tslib_1.__importDefault(__require("fs"));
|
|
53880
|
-
var
|
|
53881
|
-
exports.types =
|
|
53880
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
53881
|
+
exports.types = types14;
|
|
53882
53882
|
var parser_1 = require_parser2();
|
|
53883
53883
|
Object.defineProperty(exports, "parse", { enumerable: true, get: function() {
|
|
53884
53884
|
return parser_1.parse;
|
|
@@ -53892,10 +53892,10 @@ var require_main2 = __commonJS({
|
|
|
53892
53892
|
return new printer_1.Printer(options).print(node);
|
|
53893
53893
|
}
|
|
53894
53894
|
exports.print = print9;
|
|
53895
|
-
function
|
|
53895
|
+
function prettyPrint3(node, options) {
|
|
53896
53896
|
return new printer_1.Printer(options).printGenerically(node);
|
|
53897
53897
|
}
|
|
53898
|
-
exports.prettyPrint =
|
|
53898
|
+
exports.prettyPrint = prettyPrint3;
|
|
53899
53899
|
function run(transformer, options) {
|
|
53900
53900
|
return runFile(process.argv[2], transformer, options);
|
|
53901
53901
|
}
|
|
@@ -53922,7 +53922,7 @@ var require_main2 = __commonJS({
|
|
|
53922
53922
|
});
|
|
53923
53923
|
|
|
53924
53924
|
// src/codegen/index.ts
|
|
53925
|
-
var
|
|
53925
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
53926
53926
|
|
|
53927
53927
|
// src/lib/pipeline.ts
|
|
53928
53928
|
async function runPipeline(config2, pipeline, target) {
|
|
@@ -54402,8 +54402,8 @@ var List = class {
|
|
|
54402
54402
|
} else {
|
|
54403
54403
|
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
54404
54404
|
}
|
|
54405
|
-
for (let
|
|
54406
|
-
yield
|
|
54405
|
+
for (let record2 of entries) {
|
|
54406
|
+
yield record2;
|
|
54407
54407
|
}
|
|
54408
54408
|
}
|
|
54409
54409
|
};
|
|
@@ -54452,6 +54452,46 @@ var ListCollection = class {
|
|
|
54452
54452
|
}
|
|
54453
54453
|
};
|
|
54454
54454
|
|
|
54455
|
+
// src/runtime/cache/schema.ts
|
|
54456
|
+
var SchemaManager = class {
|
|
54457
|
+
cache;
|
|
54458
|
+
fieldTypes = {};
|
|
54459
|
+
constructor(cache) {
|
|
54460
|
+
this.cache = cache;
|
|
54461
|
+
}
|
|
54462
|
+
setFieldType({
|
|
54463
|
+
parent,
|
|
54464
|
+
key,
|
|
54465
|
+
type,
|
|
54466
|
+
nullable = false,
|
|
54467
|
+
link
|
|
54468
|
+
}) {
|
|
54469
|
+
let parensIndex = key.indexOf("(");
|
|
54470
|
+
if (parensIndex !== -1) {
|
|
54471
|
+
key = key.substring(0, parensIndex);
|
|
54472
|
+
}
|
|
54473
|
+
if (parent === rootID) {
|
|
54474
|
+
parent = "Query";
|
|
54475
|
+
} else if (parent.includes(":")) {
|
|
54476
|
+
parent = parent.substring(0, parent.indexOf(":"));
|
|
54477
|
+
}
|
|
54478
|
+
if (!this.fieldTypes[parent]) {
|
|
54479
|
+
this.fieldTypes[parent] = {};
|
|
54480
|
+
}
|
|
54481
|
+
this.fieldTypes[parent][key] = {
|
|
54482
|
+
type,
|
|
54483
|
+
nullable,
|
|
54484
|
+
link: !!link
|
|
54485
|
+
};
|
|
54486
|
+
}
|
|
54487
|
+
fieldType(type, field) {
|
|
54488
|
+
return this.fieldTypes[type]?.[field] || null;
|
|
54489
|
+
}
|
|
54490
|
+
get config() {
|
|
54491
|
+
return this.cache._internal_unstable.config;
|
|
54492
|
+
}
|
|
54493
|
+
};
|
|
54494
|
+
|
|
54455
54495
|
// src/runtime/cache/storage.ts
|
|
54456
54496
|
var InMemoryStorage = class {
|
|
54457
54497
|
data;
|
|
@@ -55019,7 +55059,7 @@ var InMemorySubscriptions = class {
|
|
|
55019
55059
|
};
|
|
55020
55060
|
|
|
55021
55061
|
// src/runtime/cache/cache.ts
|
|
55022
|
-
var
|
|
55062
|
+
var Cache3 = class {
|
|
55023
55063
|
_internal_unstable;
|
|
55024
55064
|
constructor(config2) {
|
|
55025
55065
|
this._internal_unstable = new CacheInternal({
|
|
@@ -55027,7 +55067,8 @@ var Cache2 = class {
|
|
|
55027
55067
|
storage: new InMemoryStorage(),
|
|
55028
55068
|
subscriptions: new InMemorySubscriptions(this),
|
|
55029
55069
|
lists: new ListManager(this, rootID),
|
|
55030
|
-
lifetimes: new GarbageCollector(this)
|
|
55070
|
+
lifetimes: new GarbageCollector(this),
|
|
55071
|
+
schema: new SchemaManager(this)
|
|
55031
55072
|
});
|
|
55032
55073
|
if (config2) {
|
|
55033
55074
|
this.setConfig(defaultConfigValues(config2));
|
|
@@ -55113,18 +55154,21 @@ var CacheInternal = class {
|
|
|
55113
55154
|
lists;
|
|
55114
55155
|
cache;
|
|
55115
55156
|
lifetimes;
|
|
55157
|
+
schema;
|
|
55116
55158
|
constructor({
|
|
55117
55159
|
storage,
|
|
55118
55160
|
subscriptions,
|
|
55119
55161
|
lists,
|
|
55120
55162
|
cache,
|
|
55121
|
-
lifetimes
|
|
55163
|
+
lifetimes,
|
|
55164
|
+
schema
|
|
55122
55165
|
}) {
|
|
55123
55166
|
this.storage = storage;
|
|
55124
55167
|
this.subscriptions = subscriptions;
|
|
55125
55168
|
this.lists = lists;
|
|
55126
55169
|
this.cache = cache;
|
|
55127
55170
|
this.lifetimes = lifetimes;
|
|
55171
|
+
this.schema = schema;
|
|
55128
55172
|
this._disabled = typeof globalThis.window === "undefined";
|
|
55129
55173
|
try {
|
|
55130
55174
|
if (process.env.HOUDINI_TEST === "true") {
|
|
@@ -55140,7 +55184,6 @@ var CacheInternal = class {
|
|
|
55140
55184
|
data,
|
|
55141
55185
|
selection: selection2,
|
|
55142
55186
|
variables = {},
|
|
55143
|
-
root = rootID,
|
|
55144
55187
|
parent = rootID,
|
|
55145
55188
|
applyUpdates = false,
|
|
55146
55189
|
layer,
|
|
@@ -55163,9 +55206,17 @@ var CacheInternal = class {
|
|
|
55163
55206
|
selection: fieldSelection,
|
|
55164
55207
|
operations,
|
|
55165
55208
|
abstract: isAbstract,
|
|
55166
|
-
update
|
|
55209
|
+
update,
|
|
55210
|
+
nullable
|
|
55167
55211
|
} = targetSelection[field];
|
|
55168
55212
|
const key = evaluateKey(keyRaw, variables);
|
|
55213
|
+
this.schema.setFieldType({
|
|
55214
|
+
parent,
|
|
55215
|
+
key: keyRaw,
|
|
55216
|
+
type: linkedType,
|
|
55217
|
+
nullable,
|
|
55218
|
+
link: !!fieldSelection
|
|
55219
|
+
});
|
|
55169
55220
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
55170
55221
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
55171
55222
|
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
@@ -55234,7 +55285,6 @@ var CacheInternal = class {
|
|
|
55234
55285
|
}
|
|
55235
55286
|
if (linkedID) {
|
|
55236
55287
|
this.writeSelection({
|
|
55237
|
-
root,
|
|
55238
55288
|
selection: fieldSelection,
|
|
55239
55289
|
parent: linkedID,
|
|
55240
55290
|
data: value,
|
|
@@ -55625,7 +55675,7 @@ var CacheInternal = class {
|
|
|
55625
55675
|
var rootID = "_ROOT_";
|
|
55626
55676
|
|
|
55627
55677
|
// src/runtime/cache/index.ts
|
|
55628
|
-
var cache_default = new
|
|
55678
|
+
var cache_default = new Cache3();
|
|
55629
55679
|
|
|
55630
55680
|
// src/runtime/lib/types.ts
|
|
55631
55681
|
var CompiledFragmentKind = "HoudiniFragment" /* Fragment */;
|
|
@@ -55817,6 +55867,7 @@ async function writeFile(filepath, data) {
|
|
|
55817
55867
|
return;
|
|
55818
55868
|
}
|
|
55819
55869
|
if (houdini_mode.is_testing) {
|
|
55870
|
+
import_memfs.fs.mkdirpSync(dirname(filepath));
|
|
55820
55871
|
return import_memfs.fs.writeFileSync(filepath, data);
|
|
55821
55872
|
}
|
|
55822
55873
|
return await fs.writeFile(filepath, data, "utf8");
|
|
@@ -56204,53 +56255,75 @@ var graphql2 = __toESM(require_graphql2(), 1);
|
|
|
56204
56255
|
async function find_graphql(config2, parsedScript, walker) {
|
|
56205
56256
|
await asyncWalk(parsedScript, {
|
|
56206
56257
|
async enter(node, parent) {
|
|
56207
|
-
if (node.type
|
|
56258
|
+
if (node.type !== "TaggedTemplateExpression" && node.type !== "CallExpression") {
|
|
56259
|
+
return;
|
|
56260
|
+
}
|
|
56261
|
+
let documentString;
|
|
56262
|
+
if (node.type === "TaggedTemplateExpression") {
|
|
56208
56263
|
const expr = node;
|
|
56209
|
-
|
|
56210
|
-
const parsedTag = graphql2.parse(tagContent);
|
|
56211
|
-
if (walker.where && !walker.where(parsedTag)) {
|
|
56264
|
+
if (expr.tag.type !== "Identifier" || expr.tag.name !== "graphql") {
|
|
56212
56265
|
return;
|
|
56213
56266
|
}
|
|
56214
|
-
|
|
56215
|
-
|
|
56216
|
-
|
|
56217
|
-
|
|
56267
|
+
documentString = expr.quasi.quasis[0].value.raw;
|
|
56268
|
+
} else if (node.type === "CallExpression") {
|
|
56269
|
+
const expr = node;
|
|
56270
|
+
if (expr.callee.type !== "Identifier" || expr.callee.name !== "graphql" || expr.arguments.length !== 1) {
|
|
56271
|
+
return;
|
|
56218
56272
|
}
|
|
56219
|
-
|
|
56220
|
-
if (
|
|
56221
|
-
|
|
56273
|
+
const argument = expr.arguments[0];
|
|
56274
|
+
if (argument.type === "TemplateLiteral") {
|
|
56275
|
+
documentString = argument.quasis[0].value.raw;
|
|
56276
|
+
} else if (argument.type === "StringLiteral") {
|
|
56277
|
+
documentString = argument.value;
|
|
56222
56278
|
} else {
|
|
56223
|
-
|
|
56224
|
-
kind = CompiledQueryKind;
|
|
56225
|
-
} else if (definition.operation === "mutation") {
|
|
56226
|
-
kind = CompiledMutationKind;
|
|
56227
|
-
} else {
|
|
56228
|
-
kind = CompiledSubscriptionKind;
|
|
56229
|
-
}
|
|
56279
|
+
return;
|
|
56230
56280
|
}
|
|
56231
|
-
|
|
56232
|
-
|
|
56233
|
-
parsedDocument: parsedTag,
|
|
56234
|
-
node: {
|
|
56235
|
-
...node,
|
|
56236
|
-
...this,
|
|
56237
|
-
remove: this.remove,
|
|
56238
|
-
replaceWith: this.replace
|
|
56239
|
-
},
|
|
56240
|
-
artifact: {
|
|
56241
|
-
name: name2,
|
|
56242
|
-
kind
|
|
56243
|
-
},
|
|
56244
|
-
parent,
|
|
56245
|
-
tagContent
|
|
56246
|
-
});
|
|
56281
|
+
} else {
|
|
56282
|
+
return;
|
|
56247
56283
|
}
|
|
56284
|
+
const parsedTag = graphql2.parse(documentString);
|
|
56285
|
+
if (walker.where && !walker.where(parsedTag)) {
|
|
56286
|
+
return;
|
|
56287
|
+
}
|
|
56288
|
+
const definition = config2.extractDefinition(parsedTag);
|
|
56289
|
+
const name2 = definition.name?.value;
|
|
56290
|
+
if (!name2) {
|
|
56291
|
+
throw new Error("Could not find definition name");
|
|
56292
|
+
}
|
|
56293
|
+
let kind;
|
|
56294
|
+
if (definition.kind === "FragmentDefinition") {
|
|
56295
|
+
kind = CompiledFragmentKind;
|
|
56296
|
+
} else {
|
|
56297
|
+
if (definition.operation === "query") {
|
|
56298
|
+
kind = CompiledQueryKind;
|
|
56299
|
+
} else if (definition.operation === "mutation") {
|
|
56300
|
+
kind = CompiledMutationKind;
|
|
56301
|
+
} else {
|
|
56302
|
+
kind = CompiledSubscriptionKind;
|
|
56303
|
+
}
|
|
56304
|
+
}
|
|
56305
|
+
walker.dependency?.(config2.artifactPath(parsedTag));
|
|
56306
|
+
await walker.tag({
|
|
56307
|
+
parsedDocument: parsedTag,
|
|
56308
|
+
node: {
|
|
56309
|
+
...node,
|
|
56310
|
+
...this,
|
|
56311
|
+
remove: this.remove,
|
|
56312
|
+
replaceWith: this.replace
|
|
56313
|
+
},
|
|
56314
|
+
artifact: {
|
|
56315
|
+
name: name2,
|
|
56316
|
+
kind
|
|
56317
|
+
},
|
|
56318
|
+
parent,
|
|
56319
|
+
tagContent: documentString
|
|
56320
|
+
});
|
|
56248
56321
|
}
|
|
56249
56322
|
});
|
|
56250
56323
|
}
|
|
56251
56324
|
|
|
56252
56325
|
// src/codegen/generators/artifacts/index.ts
|
|
56253
|
-
var
|
|
56326
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
56254
56327
|
var recast5 = __toESM(require_main2(), 1);
|
|
56255
56328
|
|
|
56256
56329
|
// src/codegen/utils/commonjs.ts
|
|
@@ -56667,7 +56740,7 @@ function deepMerge(filepath, ...targets) {
|
|
|
56667
56740
|
Object.entries(fields).map(([key, value]) => [key, deepMerge(filepath, ...value)])
|
|
56668
56741
|
);
|
|
56669
56742
|
}
|
|
56670
|
-
function convertValue(val) {
|
|
56743
|
+
function convertValue(config2, val) {
|
|
56671
56744
|
let value;
|
|
56672
56745
|
let kind;
|
|
56673
56746
|
if (val.kind === graphql5.Kind.INT) {
|
|
@@ -56799,7 +56872,7 @@ function operationObject({
|
|
|
56799
56872
|
operationWhen[i ? "must_not" : "must"] = arg.value.fields.reduce(
|
|
56800
56873
|
(obj, arg2) => ({
|
|
56801
56874
|
...obj,
|
|
56802
|
-
[arg2.name.value]: convertValue(arg2.value).value
|
|
56875
|
+
[arg2.name.value]: convertValue(config2, arg2.value).value
|
|
56803
56876
|
}),
|
|
56804
56877
|
{}
|
|
56805
56878
|
);
|
|
@@ -56815,7 +56888,7 @@ function operationObject({
|
|
|
56815
56888
|
operationWhen[which] = directive.arguments?.reduce(
|
|
56816
56889
|
(filters, argument) => ({
|
|
56817
56890
|
...filters,
|
|
56818
|
-
[argument.name.value]: convertValue(argument.value).value
|
|
56891
|
+
[argument.name.value]: convertValue(config2, argument.value).value
|
|
56819
56892
|
}),
|
|
56820
56893
|
{}
|
|
56821
56894
|
);
|
|
@@ -56854,7 +56927,7 @@ function ancestorKey(ancestors) {
|
|
|
56854
56927
|
}
|
|
56855
56928
|
|
|
56856
56929
|
// src/codegen/generators/artifacts/selection.ts
|
|
56857
|
-
var
|
|
56930
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
56858
56931
|
|
|
56859
56932
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
56860
56933
|
var config = {
|
|
@@ -56894,10 +56967,24 @@ function logYellow(str) {
|
|
|
56894
56967
|
}
|
|
56895
56968
|
|
|
56896
56969
|
// src/codegen/transforms/list.ts
|
|
56897
|
-
var
|
|
56970
|
+
var graphql9 = __toESM(require_graphql2(), 1);
|
|
56898
56971
|
|
|
56899
|
-
// src/codegen/
|
|
56972
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
56900
56973
|
var graphql7 = __toESM(require_graphql2(), 1);
|
|
56974
|
+
var objectIdentificationSelection = (config2, type) => {
|
|
56975
|
+
return config2.keyFieldsForType(type.name).map((key) => {
|
|
56976
|
+
return {
|
|
56977
|
+
kind: graphql7.Kind.FIELD,
|
|
56978
|
+
name: {
|
|
56979
|
+
kind: graphql7.Kind.NAME,
|
|
56980
|
+
value: key
|
|
56981
|
+
}
|
|
56982
|
+
};
|
|
56983
|
+
});
|
|
56984
|
+
};
|
|
56985
|
+
|
|
56986
|
+
// src/codegen/transforms/paginate.ts
|
|
56987
|
+
var graphql8 = __toESM(require_graphql2(), 1);
|
|
56901
56988
|
async function paginate(config2, documents) {
|
|
56902
56989
|
const newDocs = [];
|
|
56903
56990
|
for (const doc of documents) {
|
|
@@ -56930,7 +57017,7 @@ async function paginate(config2, documents) {
|
|
|
56930
57017
|
};
|
|
56931
57018
|
let cursorType = "String";
|
|
56932
57019
|
let paginationPath = [];
|
|
56933
|
-
doc.document =
|
|
57020
|
+
doc.document = graphql8.visit(doc.document, {
|
|
56934
57021
|
Field(node, _, __, ___, ancestors) {
|
|
56935
57022
|
const paginateDirective = node.directives?.find(
|
|
56936
57023
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -56957,7 +57044,7 @@ async function paginate(config2, documents) {
|
|
|
56957
57044
|
flags.offset.enabled = offsetPagination;
|
|
56958
57045
|
flags.limit.enabled = offsetPagination;
|
|
56959
57046
|
paginationPath = ancestors.filter(
|
|
56960
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
57047
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql8.Kind.FIELD
|
|
56961
57048
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
56962
57049
|
return {
|
|
56963
57050
|
...node,
|
|
@@ -56978,7 +57065,7 @@ async function paginate(config2, documents) {
|
|
|
56978
57065
|
refetchUpdate = "prepend" /* prepend */;
|
|
56979
57066
|
}
|
|
56980
57067
|
let fragment = "";
|
|
56981
|
-
doc.document =
|
|
57068
|
+
doc.document = graphql8.visit(doc.document, {
|
|
56982
57069
|
OperationDefinition(node) {
|
|
56983
57070
|
if (node.operation !== "query") {
|
|
56984
57071
|
throw new HoudiniError({
|
|
@@ -57032,9 +57119,9 @@ async function paginate(config2, documents) {
|
|
|
57032
57119
|
directives: [
|
|
57033
57120
|
...node.directives || [],
|
|
57034
57121
|
{
|
|
57035
|
-
kind:
|
|
57122
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57036
57123
|
name: {
|
|
57037
|
-
kind:
|
|
57124
|
+
kind: graphql8.Kind.NAME,
|
|
57038
57125
|
value: config2.argumentsDirective
|
|
57039
57126
|
}
|
|
57040
57127
|
}
|
|
@@ -57097,16 +57184,16 @@ async function paginate(config2, documents) {
|
|
|
57097
57184
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
57098
57185
|
const fragmentSpreadSelection = [
|
|
57099
57186
|
{
|
|
57100
|
-
kind:
|
|
57187
|
+
kind: graphql8.Kind.FRAGMENT_SPREAD,
|
|
57101
57188
|
name: {
|
|
57102
|
-
kind:
|
|
57189
|
+
kind: graphql8.Kind.NAME,
|
|
57103
57190
|
value: fragmentName
|
|
57104
57191
|
},
|
|
57105
57192
|
directives: [
|
|
57106
57193
|
{
|
|
57107
|
-
kind:
|
|
57194
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57108
57195
|
name: {
|
|
57109
|
-
kind:
|
|
57196
|
+
kind: graphql8.Kind.NAME,
|
|
57110
57197
|
value: config2.withDirective
|
|
57111
57198
|
},
|
|
57112
57199
|
["arguments"]: paginationArgs.map(
|
|
@@ -57134,29 +57221,29 @@ async function paginate(config2, documents) {
|
|
|
57134
57221
|
});
|
|
57135
57222
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
57136
57223
|
const queryDoc = {
|
|
57137
|
-
kind:
|
|
57224
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
57138
57225
|
definitions: [
|
|
57139
57226
|
{
|
|
57140
|
-
kind:
|
|
57227
|
+
kind: graphql8.Kind.OPERATION_DEFINITION,
|
|
57141
57228
|
name: {
|
|
57142
|
-
kind:
|
|
57229
|
+
kind: graphql8.Kind.NAME,
|
|
57143
57230
|
value: refetchQueryName
|
|
57144
57231
|
},
|
|
57145
57232
|
operation: "query",
|
|
57146
57233
|
variableDefinitions: paginationArgs.map(
|
|
57147
57234
|
(arg) => ({
|
|
57148
|
-
kind:
|
|
57235
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57149
57236
|
type: {
|
|
57150
|
-
kind:
|
|
57237
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57151
57238
|
name: {
|
|
57152
|
-
kind:
|
|
57239
|
+
kind: graphql8.Kind.NAME,
|
|
57153
57240
|
value: arg.type
|
|
57154
57241
|
}
|
|
57155
57242
|
},
|
|
57156
57243
|
variable: {
|
|
57157
|
-
kind:
|
|
57244
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57158
57245
|
name: {
|
|
57159
|
-
kind:
|
|
57246
|
+
kind: graphql8.Kind.NAME,
|
|
57160
57247
|
value: arg.name
|
|
57161
57248
|
}
|
|
57162
57249
|
},
|
|
@@ -57168,12 +57255,12 @@ async function paginate(config2, documents) {
|
|
|
57168
57255
|
).concat(
|
|
57169
57256
|
!nodeQuery ? [] : keys.map(
|
|
57170
57257
|
(key) => ({
|
|
57171
|
-
kind:
|
|
57258
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57172
57259
|
type: key.type,
|
|
57173
57260
|
variable: {
|
|
57174
|
-
kind:
|
|
57261
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57175
57262
|
name: {
|
|
57176
|
-
kind:
|
|
57263
|
+
kind: graphql8.Kind.NAME,
|
|
57177
57264
|
value: key.name
|
|
57178
57265
|
}
|
|
57179
57266
|
}
|
|
@@ -57181,42 +57268,42 @@ async function paginate(config2, documents) {
|
|
|
57181
57268
|
)
|
|
57182
57269
|
),
|
|
57183
57270
|
selectionSet: {
|
|
57184
|
-
kind:
|
|
57271
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57185
57272
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
57186
57273
|
{
|
|
57187
|
-
kind:
|
|
57274
|
+
kind: graphql8.Kind.FIELD,
|
|
57188
57275
|
name: {
|
|
57189
|
-
kind:
|
|
57276
|
+
kind: graphql8.Kind.NAME,
|
|
57190
57277
|
value: typeConfig?.resolve?.queryField || "node"
|
|
57191
57278
|
},
|
|
57192
57279
|
["arguments"]: keys.map((key) => ({
|
|
57193
|
-
kind:
|
|
57280
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57194
57281
|
name: {
|
|
57195
|
-
kind:
|
|
57282
|
+
kind: graphql8.Kind.NAME,
|
|
57196
57283
|
value: key.name
|
|
57197
57284
|
},
|
|
57198
57285
|
value: {
|
|
57199
|
-
kind:
|
|
57286
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57200
57287
|
name: {
|
|
57201
|
-
kind:
|
|
57288
|
+
kind: graphql8.Kind.NAME,
|
|
57202
57289
|
value: key.name
|
|
57203
57290
|
}
|
|
57204
57291
|
}
|
|
57205
57292
|
})),
|
|
57206
57293
|
selectionSet: {
|
|
57207
|
-
kind:
|
|
57294
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57208
57295
|
selections: [
|
|
57209
57296
|
{
|
|
57210
|
-
kind:
|
|
57297
|
+
kind: graphql8.Kind.FIELD,
|
|
57211
57298
|
name: {
|
|
57212
|
-
kind:
|
|
57299
|
+
kind: graphql8.Kind.NAME,
|
|
57213
57300
|
value: "__typename"
|
|
57214
57301
|
}
|
|
57215
57302
|
},
|
|
57216
57303
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
57217
|
-
kind:
|
|
57304
|
+
kind: graphql8.Kind.FIELD,
|
|
57218
57305
|
name: {
|
|
57219
|
-
kind:
|
|
57306
|
+
kind: graphql8.Kind.NAME,
|
|
57220
57307
|
value: key
|
|
57221
57308
|
}
|
|
57222
57309
|
})),
|
|
@@ -57278,15 +57365,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
57278
57365
|
}
|
|
57279
57366
|
function variableAsArgument(name2, variable) {
|
|
57280
57367
|
return {
|
|
57281
|
-
kind:
|
|
57368
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57282
57369
|
name: {
|
|
57283
|
-
kind:
|
|
57370
|
+
kind: graphql8.Kind.NAME,
|
|
57284
57371
|
value: name2
|
|
57285
57372
|
},
|
|
57286
57373
|
value: {
|
|
57287
|
-
kind:
|
|
57374
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57288
57375
|
name: {
|
|
57289
|
-
kind:
|
|
57376
|
+
kind: graphql8.Kind.NAME,
|
|
57290
57377
|
value: variable ?? name2
|
|
57291
57378
|
}
|
|
57292
57379
|
}
|
|
@@ -57294,18 +57381,18 @@ function variableAsArgument(name2, variable) {
|
|
|
57294
57381
|
}
|
|
57295
57382
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
57296
57383
|
return {
|
|
57297
|
-
kind:
|
|
57384
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57298
57385
|
type: {
|
|
57299
|
-
kind:
|
|
57386
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57300
57387
|
name: {
|
|
57301
|
-
kind:
|
|
57388
|
+
kind: graphql8.Kind.NAME,
|
|
57302
57389
|
value: type
|
|
57303
57390
|
}
|
|
57304
57391
|
},
|
|
57305
57392
|
variable: {
|
|
57306
|
-
kind:
|
|
57393
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57307
57394
|
name: {
|
|
57308
|
-
kind:
|
|
57395
|
+
kind: graphql8.Kind.NAME,
|
|
57309
57396
|
value: variableName ?? name2
|
|
57310
57397
|
}
|
|
57311
57398
|
},
|
|
@@ -57317,9 +57404,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
57317
57404
|
}
|
|
57318
57405
|
function argumentNode(name2, value) {
|
|
57319
57406
|
return {
|
|
57320
|
-
kind:
|
|
57407
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57321
57408
|
name: {
|
|
57322
|
-
kind:
|
|
57409
|
+
kind: graphql8.Kind.NAME,
|
|
57323
57410
|
value: name2
|
|
57324
57411
|
},
|
|
57325
57412
|
value: objectNode(value)
|
|
@@ -57327,16 +57414,16 @@ function argumentNode(name2, value) {
|
|
|
57327
57414
|
}
|
|
57328
57415
|
function objectNode([type, defaultValue]) {
|
|
57329
57416
|
const node = {
|
|
57330
|
-
kind:
|
|
57417
|
+
kind: graphql8.Kind.OBJECT,
|
|
57331
57418
|
fields: [
|
|
57332
57419
|
{
|
|
57333
|
-
kind:
|
|
57420
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57334
57421
|
name: {
|
|
57335
|
-
kind:
|
|
57422
|
+
kind: graphql8.Kind.NAME,
|
|
57336
57423
|
value: "type"
|
|
57337
57424
|
},
|
|
57338
57425
|
value: {
|
|
57339
|
-
kind:
|
|
57426
|
+
kind: graphql8.Kind.STRING,
|
|
57340
57427
|
value: type
|
|
57341
57428
|
}
|
|
57342
57429
|
}
|
|
@@ -57344,8 +57431,8 @@ function objectNode([type, defaultValue]) {
|
|
|
57344
57431
|
};
|
|
57345
57432
|
if (defaultValue) {
|
|
57346
57433
|
node.fields.push({
|
|
57347
|
-
kind:
|
|
57348
|
-
name: { kind:
|
|
57434
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57435
|
+
name: { kind: graphql8.Kind.NAME, value: "default" },
|
|
57349
57436
|
value: {
|
|
57350
57437
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
57351
57438
|
value: defaultValue.toString()
|
|
@@ -57356,34 +57443,34 @@ function objectNode([type, defaultValue]) {
|
|
|
57356
57443
|
}
|
|
57357
57444
|
var pageInfoSelection = [
|
|
57358
57445
|
{
|
|
57359
|
-
kind:
|
|
57446
|
+
kind: graphql8.Kind.FIELD,
|
|
57360
57447
|
name: {
|
|
57361
|
-
kind:
|
|
57448
|
+
kind: graphql8.Kind.NAME,
|
|
57362
57449
|
value: "edges"
|
|
57363
57450
|
},
|
|
57364
57451
|
selectionSet: {
|
|
57365
|
-
kind:
|
|
57452
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57366
57453
|
selections: [
|
|
57367
57454
|
{
|
|
57368
|
-
kind:
|
|
57455
|
+
kind: graphql8.Kind.FIELD,
|
|
57369
57456
|
name: {
|
|
57370
|
-
kind:
|
|
57457
|
+
kind: graphql8.Kind.NAME,
|
|
57371
57458
|
value: "cursor"
|
|
57372
57459
|
}
|
|
57373
57460
|
},
|
|
57374
57461
|
{
|
|
57375
|
-
kind:
|
|
57462
|
+
kind: graphql8.Kind.FIELD,
|
|
57376
57463
|
name: {
|
|
57377
|
-
kind:
|
|
57464
|
+
kind: graphql8.Kind.NAME,
|
|
57378
57465
|
value: "node"
|
|
57379
57466
|
},
|
|
57380
57467
|
selectionSet: {
|
|
57381
|
-
kind:
|
|
57468
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57382
57469
|
selections: [
|
|
57383
57470
|
{
|
|
57384
|
-
kind:
|
|
57471
|
+
kind: graphql8.Kind.FIELD,
|
|
57385
57472
|
name: {
|
|
57386
|
-
kind:
|
|
57473
|
+
kind: graphql8.Kind.NAME,
|
|
57387
57474
|
value: "__typename"
|
|
57388
57475
|
}
|
|
57389
57476
|
}
|
|
@@ -57394,39 +57481,39 @@ var pageInfoSelection = [
|
|
|
57394
57481
|
}
|
|
57395
57482
|
},
|
|
57396
57483
|
{
|
|
57397
|
-
kind:
|
|
57484
|
+
kind: graphql8.Kind.FIELD,
|
|
57398
57485
|
name: {
|
|
57399
|
-
kind:
|
|
57486
|
+
kind: graphql8.Kind.NAME,
|
|
57400
57487
|
value: "pageInfo"
|
|
57401
57488
|
},
|
|
57402
57489
|
selectionSet: {
|
|
57403
|
-
kind:
|
|
57490
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57404
57491
|
selections: [
|
|
57405
57492
|
{
|
|
57406
|
-
kind:
|
|
57493
|
+
kind: graphql8.Kind.FIELD,
|
|
57407
57494
|
name: {
|
|
57408
|
-
kind:
|
|
57495
|
+
kind: graphql8.Kind.NAME,
|
|
57409
57496
|
value: "hasPreviousPage"
|
|
57410
57497
|
}
|
|
57411
57498
|
},
|
|
57412
57499
|
{
|
|
57413
|
-
kind:
|
|
57500
|
+
kind: graphql8.Kind.FIELD,
|
|
57414
57501
|
name: {
|
|
57415
|
-
kind:
|
|
57502
|
+
kind: graphql8.Kind.NAME,
|
|
57416
57503
|
value: "hasNextPage"
|
|
57417
57504
|
}
|
|
57418
57505
|
},
|
|
57419
57506
|
{
|
|
57420
|
-
kind:
|
|
57507
|
+
kind: graphql8.Kind.FIELD,
|
|
57421
57508
|
name: {
|
|
57422
|
-
kind:
|
|
57509
|
+
kind: graphql8.Kind.NAME,
|
|
57423
57510
|
value: "startCursor"
|
|
57424
57511
|
}
|
|
57425
57512
|
},
|
|
57426
57513
|
{
|
|
57427
|
-
kind:
|
|
57514
|
+
kind: graphql8.Kind.FIELD,
|
|
57428
57515
|
name: {
|
|
57429
|
-
kind:
|
|
57516
|
+
kind: graphql8.Kind.NAME,
|
|
57430
57517
|
value: "endCursor"
|
|
57431
57518
|
}
|
|
57432
57519
|
}
|
|
@@ -57440,15 +57527,15 @@ async function addListFragments(config2, documents) {
|
|
|
57440
57527
|
const lists = {};
|
|
57441
57528
|
const errors = [];
|
|
57442
57529
|
for (const doc of documents) {
|
|
57443
|
-
doc.document =
|
|
57530
|
+
doc.document = graphql9.visit(doc.document, {
|
|
57444
57531
|
Directive(node, key, parent, path2, ancestors) {
|
|
57445
57532
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
57446
57533
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
57447
57534
|
let error = {
|
|
57448
|
-
...new
|
|
57535
|
+
...new graphql9.GraphQLError(
|
|
57449
57536
|
"",
|
|
57450
57537
|
node,
|
|
57451
|
-
new
|
|
57538
|
+
new graphql9.Source(""),
|
|
57452
57539
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
57453
57540
|
path2
|
|
57454
57541
|
),
|
|
@@ -57500,7 +57587,7 @@ async function addListFragments(config2, documents) {
|
|
|
57500
57587
|
{
|
|
57501
57588
|
kind: "Argument",
|
|
57502
57589
|
name: {
|
|
57503
|
-
kind:
|
|
57590
|
+
kind: graphql9.Kind.NAME,
|
|
57504
57591
|
value: "connection"
|
|
57505
57592
|
},
|
|
57506
57593
|
value: {
|
|
@@ -57547,10 +57634,13 @@ async function addListFragments(config2, documents) {
|
|
|
57547
57634
|
if (errors.length > 0) {
|
|
57548
57635
|
throw errors;
|
|
57549
57636
|
}
|
|
57550
|
-
const
|
|
57637
|
+
const validDeletes = [
|
|
57551
57638
|
...new Set(
|
|
57552
57639
|
Object.values(lists).map(({ type }) => {
|
|
57553
|
-
if (!(type instanceof
|
|
57640
|
+
if (!(type instanceof graphql9.GraphQLObjectType)) {
|
|
57641
|
+
return "";
|
|
57642
|
+
}
|
|
57643
|
+
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
57554
57644
|
return "";
|
|
57555
57645
|
}
|
|
57556
57646
|
return type.name;
|
|
@@ -57561,7 +57651,7 @@ async function addListFragments(config2, documents) {
|
|
|
57561
57651
|
return;
|
|
57562
57652
|
}
|
|
57563
57653
|
const generatedDoc = {
|
|
57564
|
-
kind:
|
|
57654
|
+
kind: graphql9.Kind.DOCUMENT,
|
|
57565
57655
|
definitions: Object.entries(lists).flatMap(
|
|
57566
57656
|
([name2, { selection: selection2, type }]) => {
|
|
57567
57657
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -57569,35 +57659,29 @@ async function addListFragments(config2, documents) {
|
|
|
57569
57659
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
57570
57660
|
}
|
|
57571
57661
|
const fragmentSelection = {
|
|
57572
|
-
kind:
|
|
57662
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57573
57663
|
selections: [...selection2.selections]
|
|
57574
57664
|
};
|
|
57575
57665
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
57576
|
-
(field) => field.kind === "Field" && field.name.value
|
|
57666
|
+
(field) => field.kind === "Field" && config2.keyFieldsForType(type.name).includes(field.name.value)
|
|
57577
57667
|
)) {
|
|
57578
57668
|
fragmentSelection.selections = [
|
|
57579
57669
|
...fragmentSelection.selections,
|
|
57580
|
-
|
|
57581
|
-
kind: graphql8.Kind.FIELD,
|
|
57582
|
-
name: {
|
|
57583
|
-
kind: graphql8.Kind.NAME,
|
|
57584
|
-
value: "id"
|
|
57585
|
-
}
|
|
57586
|
-
}
|
|
57670
|
+
...objectIdentificationSelection(config2, type)
|
|
57587
57671
|
];
|
|
57588
57672
|
}
|
|
57589
57673
|
return [
|
|
57590
57674
|
{
|
|
57591
57675
|
name: {
|
|
57592
57676
|
value: config2.listInsertFragment(name2),
|
|
57593
|
-
kind:
|
|
57677
|
+
kind: graphql9.Kind.NAME
|
|
57594
57678
|
},
|
|
57595
|
-
kind:
|
|
57679
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57596
57680
|
selectionSet: fragmentSelection,
|
|
57597
57681
|
typeCondition: {
|
|
57598
|
-
kind:
|
|
57682
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57599
57683
|
name: {
|
|
57600
|
-
kind:
|
|
57684
|
+
kind: graphql9.Kind.NAME,
|
|
57601
57685
|
value: type.name
|
|
57602
57686
|
}
|
|
57603
57687
|
}
|
|
@@ -57605,52 +57689,32 @@ async function addListFragments(config2, documents) {
|
|
|
57605
57689
|
{
|
|
57606
57690
|
name: {
|
|
57607
57691
|
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
|
-
]
|
|
57692
|
+
kind: graphql9.Kind.NAME
|
|
57623
57693
|
},
|
|
57694
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57695
|
+
selectionSet: fragmentSelection,
|
|
57624
57696
|
typeCondition: {
|
|
57625
|
-
kind:
|
|
57697
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57626
57698
|
name: {
|
|
57627
|
-
kind:
|
|
57699
|
+
kind: graphql9.Kind.NAME,
|
|
57628
57700
|
value: type.name
|
|
57629
57701
|
}
|
|
57630
57702
|
}
|
|
57631
57703
|
},
|
|
57632
57704
|
{
|
|
57633
|
-
kind:
|
|
57705
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57634
57706
|
name: {
|
|
57635
57707
|
value: config2.listRemoveFragment(name2),
|
|
57636
|
-
kind:
|
|
57708
|
+
kind: graphql9.Kind.NAME
|
|
57637
57709
|
},
|
|
57638
57710
|
selectionSet: {
|
|
57639
|
-
kind:
|
|
57640
|
-
selections: [
|
|
57641
|
-
{
|
|
57642
|
-
kind: graphql8.Kind.FIELD,
|
|
57643
|
-
name: {
|
|
57644
|
-
kind: graphql8.Kind.NAME,
|
|
57645
|
-
value: "id"
|
|
57646
|
-
}
|
|
57647
|
-
}
|
|
57648
|
-
]
|
|
57711
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57712
|
+
selections: [...objectIdentificationSelection(config2, type)]
|
|
57649
57713
|
},
|
|
57650
57714
|
typeCondition: {
|
|
57651
|
-
kind:
|
|
57715
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57652
57716
|
name: {
|
|
57653
|
-
kind:
|
|
57717
|
+
kind: graphql9.Kind.NAME,
|
|
57654
57718
|
value: type.name
|
|
57655
57719
|
}
|
|
57656
57720
|
}
|
|
@@ -57658,15 +57722,15 @@ async function addListFragments(config2, documents) {
|
|
|
57658
57722
|
];
|
|
57659
57723
|
}
|
|
57660
57724
|
).concat(
|
|
57661
|
-
...
|
|
57662
|
-
kind:
|
|
57725
|
+
...validDeletes.map((typeName) => ({
|
|
57726
|
+
kind: graphql9.Kind.DIRECTIVE_DEFINITION,
|
|
57663
57727
|
name: {
|
|
57664
|
-
kind:
|
|
57728
|
+
kind: graphql9.Kind.NAME,
|
|
57665
57729
|
value: config2.listDeleteDirective(typeName)
|
|
57666
57730
|
},
|
|
57667
57731
|
locations: [
|
|
57668
57732
|
{
|
|
57669
|
-
kind:
|
|
57733
|
+
kind: graphql9.Kind.NAME,
|
|
57670
57734
|
value: "FIELD"
|
|
57671
57735
|
}
|
|
57672
57736
|
],
|
|
@@ -57674,8 +57738,8 @@ async function addListFragments(config2, documents) {
|
|
|
57674
57738
|
}))
|
|
57675
57739
|
)
|
|
57676
57740
|
};
|
|
57677
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
57678
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
57741
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57742
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57679
57743
|
documents.push({
|
|
57680
57744
|
name: "generated::lists",
|
|
57681
57745
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -57760,11 +57824,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
57760
57824
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
57761
57825
|
|
|
57762
57826
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
57763
|
-
var
|
|
57827
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
57764
57828
|
function fieldKey(config2, field) {
|
|
57765
57829
|
const attributeName = field.alias?.value || field.name.value;
|
|
57766
|
-
const printed =
|
|
57767
|
-
const secondParse =
|
|
57830
|
+
const printed = graphql10.print(field);
|
|
57831
|
+
const secondParse = graphql10.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
57768
57832
|
const paginated = !!field.directives?.find(
|
|
57769
57833
|
(directive) => directive.name.value === config2.paginateDirective
|
|
57770
57834
|
);
|
|
@@ -57783,7 +57847,9 @@ function fieldKey(config2, field) {
|
|
|
57783
57847
|
[arg.name.value]: printed.substring(start - 1, end - 1)
|
|
57784
57848
|
};
|
|
57785
57849
|
}, {});
|
|
57786
|
-
|
|
57850
|
+
const args = Object.keys(argObj);
|
|
57851
|
+
args.sort();
|
|
57852
|
+
let key = Object.values(argObj).length > 0 ? `${attributeName}(${args.map((key2) => `${key2}: ${argObj[key2]}`).join(", ")})` : attributeName;
|
|
57787
57853
|
if (paginated) {
|
|
57788
57854
|
key = key + "::paginated";
|
|
57789
57855
|
}
|
|
@@ -57857,8 +57923,8 @@ function selection({
|
|
|
57857
57923
|
const typeConditionName = field.typeCondition.name.value;
|
|
57858
57924
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
57859
57925
|
const possibleTypes = [];
|
|
57860
|
-
if (!
|
|
57861
|
-
} else if (
|
|
57926
|
+
if (!graphql11.isAbstractType(typeCondition)) {
|
|
57927
|
+
} else if (graphql11.isAbstractType(parentType)) {
|
|
57862
57928
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
57863
57929
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
57864
57930
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -57906,7 +57972,7 @@ function selection({
|
|
|
57906
57972
|
} else {
|
|
57907
57973
|
let typeRef = type.getFields()[field.name.value].type;
|
|
57908
57974
|
fieldType = getRootType(typeRef);
|
|
57909
|
-
nullable = !
|
|
57975
|
+
nullable = !graphql11.isNonNullType(typeRef);
|
|
57910
57976
|
}
|
|
57911
57977
|
const typeName = fieldType.toString();
|
|
57912
57978
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -57966,12 +58032,12 @@ function selection({
|
|
|
57966
58032
|
fieldObj.filters = (field.arguments || []).reduce(
|
|
57967
58033
|
(filters, arg) => ({
|
|
57968
58034
|
...filters,
|
|
57969
|
-
[arg.name.value]: convertValue(arg.value)
|
|
58035
|
+
[arg.name.value]: convertValue(config2, arg.value)
|
|
57970
58036
|
}),
|
|
57971
58037
|
{}
|
|
57972
58038
|
);
|
|
57973
58039
|
}
|
|
57974
|
-
if (
|
|
58040
|
+
if (graphql11.isInterfaceType(fieldType) || graphql11.isUnionType(fieldType)) {
|
|
57975
58041
|
fieldObj.abstract = true;
|
|
57976
58042
|
}
|
|
57977
58043
|
object.fields = {
|
|
@@ -58028,7 +58094,7 @@ function artifactGenerator(stats) {
|
|
|
58028
58094
|
return async function(config2, docs) {
|
|
58029
58095
|
const filterTypes = {};
|
|
58030
58096
|
for (const doc of docs) {
|
|
58031
|
-
|
|
58097
|
+
graphql12.visit(doc.document, {
|
|
58032
58098
|
Directive(node, _, __, ___, ancestors) {
|
|
58033
58099
|
if (node.name.value !== config2.listDirective) {
|
|
58034
58100
|
return;
|
|
@@ -58087,7 +58153,7 @@ function artifactGenerator(stats) {
|
|
|
58087
58153
|
return;
|
|
58088
58154
|
}
|
|
58089
58155
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
58090
|
-
let documentWithoutInternalDirectives =
|
|
58156
|
+
let documentWithoutInternalDirectives = graphql12.visit(document, {
|
|
58091
58157
|
Directive(node) {
|
|
58092
58158
|
if (config2.isInternalDirective(node)) {
|
|
58093
58159
|
return null;
|
|
@@ -58100,7 +58166,7 @@ function artifactGenerator(stats) {
|
|
|
58100
58166
|
}
|
|
58101
58167
|
}
|
|
58102
58168
|
});
|
|
58103
|
-
let documentWithoutExtraVariables =
|
|
58169
|
+
let documentWithoutExtraVariables = graphql12.visit(
|
|
58104
58170
|
documentWithoutInternalDirectives,
|
|
58105
58171
|
{
|
|
58106
58172
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -58111,13 +58177,13 @@ function artifactGenerator(stats) {
|
|
|
58111
58177
|
}
|
|
58112
58178
|
}
|
|
58113
58179
|
);
|
|
58114
|
-
let rawString =
|
|
58180
|
+
let rawString = graphql12.print(documentWithoutExtraVariables);
|
|
58115
58181
|
let docKind = doc.kind;
|
|
58116
58182
|
const operations = document.definitions.filter(
|
|
58117
|
-
({ kind }) => kind ===
|
|
58183
|
+
({ kind }) => kind === graphql12.Kind.OPERATION_DEFINITION
|
|
58118
58184
|
);
|
|
58119
58185
|
const fragments = document.definitions.filter(
|
|
58120
|
-
({ kind }) => kind ===
|
|
58186
|
+
({ kind }) => kind === graphql12.Kind.FRAGMENT_DEFINITION
|
|
58121
58187
|
);
|
|
58122
58188
|
let rootType = "";
|
|
58123
58189
|
let selectionSet;
|
|
@@ -58253,7 +58319,9 @@ function artifactGenerator(stats) {
|
|
|
58253
58319
|
}
|
|
58254
58320
|
|
|
58255
58321
|
// src/codegen/generators/runtime/index.ts
|
|
58256
|
-
|
|
58322
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
58323
|
+
var AST6 = recast6.types.builders;
|
|
58324
|
+
async function runtimeGenerator(config2, docs) {
|
|
58257
58325
|
await Promise.all([
|
|
58258
58326
|
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
58259
58327
|
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
@@ -58267,6 +58335,59 @@ async function runtimeGenerator(config2) {
|
|
|
58267
58335
|
}),
|
|
58268
58336
|
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
58269
58337
|
]);
|
|
58338
|
+
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
58339
|
+
const contents = await parseJS(await fs_exports.readFile(indexPath) || "");
|
|
58340
|
+
const graphql_tag_return = config2.plugins.find(
|
|
58341
|
+
(plugin) => plugin.graphql_tag_return
|
|
58342
|
+
)?.graphql_tag_return;
|
|
58343
|
+
if (graphql_tag_return && contents) {
|
|
58344
|
+
const overloaded_returns = {};
|
|
58345
|
+
for (const doc of docs) {
|
|
58346
|
+
const return_value = graphql_tag_return({
|
|
58347
|
+
config: config2,
|
|
58348
|
+
doc,
|
|
58349
|
+
ensure_import({ identifier, module }) {
|
|
58350
|
+
ensureImports({
|
|
58351
|
+
config: config2,
|
|
58352
|
+
body: contents.script.body,
|
|
58353
|
+
sourceModule: module,
|
|
58354
|
+
import: [identifier]
|
|
58355
|
+
});
|
|
58356
|
+
}
|
|
58357
|
+
});
|
|
58358
|
+
if (return_value) {
|
|
58359
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
58360
|
+
}
|
|
58361
|
+
}
|
|
58362
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
58363
|
+
for (const [i, expression] of (contents?.script.body ?? []).entries()) {
|
|
58364
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
58365
|
+
continue;
|
|
58366
|
+
}
|
|
58367
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
58368
|
+
const input = AST6.identifier("str");
|
|
58369
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
58370
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
58371
|
+
);
|
|
58372
|
+
contents?.script.body.splice(
|
|
58373
|
+
i,
|
|
58374
|
+
0,
|
|
58375
|
+
AST6.exportNamedDeclaration(
|
|
58376
|
+
AST6.tsDeclareFunction(
|
|
58377
|
+
AST6.identifier("graphql"),
|
|
58378
|
+
[input],
|
|
58379
|
+
AST6.tsTypeAnnotation(
|
|
58380
|
+
AST6.tsTypeReference(AST6.identifier(returnValue))
|
|
58381
|
+
)
|
|
58382
|
+
)
|
|
58383
|
+
)
|
|
58384
|
+
);
|
|
58385
|
+
}
|
|
58386
|
+
break;
|
|
58387
|
+
}
|
|
58388
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
58389
|
+
}
|
|
58390
|
+
}
|
|
58270
58391
|
}
|
|
58271
58392
|
async function generatePluginRuntime(config2, plugin) {
|
|
58272
58393
|
if (houdini_mode.is_testing) {
|
|
@@ -58301,20 +58422,20 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
58301
58422
|
}
|
|
58302
58423
|
|
|
58303
58424
|
// src/codegen/generators/typescript/index.ts
|
|
58304
|
-
var
|
|
58425
|
+
var recast12 = __toESM(require_main2(), 1);
|
|
58305
58426
|
|
|
58306
58427
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58428
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
58429
|
+
var recast9 = __toESM(require_main2(), 1);
|
|
58430
|
+
|
|
58431
|
+
// src/codegen/generators/typescript/typeReference.ts
|
|
58307
58432
|
var graphql14 = __toESM(require_graphql2(), 1);
|
|
58308
58433
|
var recast8 = __toESM(require_main2(), 1);
|
|
58309
58434
|
|
|
58310
|
-
// src/codegen/generators/typescript/
|
|
58435
|
+
// src/codegen/generators/typescript/types.ts
|
|
58311
58436
|
var graphql13 = __toESM(require_graphql2(), 1);
|
|
58312
58437
|
var recast7 = __toESM(require_main2(), 1);
|
|
58313
|
-
|
|
58314
|
-
// src/codegen/generators/typescript/types.ts
|
|
58315
|
-
var graphql12 = __toESM(require_graphql2(), 1);
|
|
58316
|
-
var recast6 = __toESM(require_main2(), 1);
|
|
58317
|
-
var AST6 = recast6.types.builders;
|
|
58438
|
+
var AST7 = recast7.types.builders;
|
|
58318
58439
|
function readonlyProperty(prop, enable = true) {
|
|
58319
58440
|
if (enable) {
|
|
58320
58441
|
prop.readonly = true;
|
|
@@ -58322,31 +58443,31 @@ function readonlyProperty(prop, enable = true) {
|
|
|
58322
58443
|
return prop;
|
|
58323
58444
|
}
|
|
58324
58445
|
function nullableField(inner, input = false) {
|
|
58325
|
-
const members = [inner,
|
|
58446
|
+
const members = [inner, AST7.tsNullKeyword()];
|
|
58326
58447
|
if (input) {
|
|
58327
|
-
members.push(
|
|
58448
|
+
members.push(AST7.tsUndefinedKeyword());
|
|
58328
58449
|
}
|
|
58329
|
-
return
|
|
58450
|
+
return AST7.tsUnionType(members);
|
|
58330
58451
|
}
|
|
58331
58452
|
function scalarPropertyValue(config2, missingScalars, target) {
|
|
58332
58453
|
switch (target.name) {
|
|
58333
58454
|
case "String": {
|
|
58334
|
-
return
|
|
58455
|
+
return AST7.tsStringKeyword();
|
|
58335
58456
|
}
|
|
58336
58457
|
case "Int": {
|
|
58337
|
-
return
|
|
58458
|
+
return AST7.tsNumberKeyword();
|
|
58338
58459
|
}
|
|
58339
58460
|
case "Float": {
|
|
58340
|
-
return
|
|
58461
|
+
return AST7.tsNumberKeyword();
|
|
58341
58462
|
}
|
|
58342
58463
|
case "Boolean": {
|
|
58343
|
-
return
|
|
58464
|
+
return AST7.tsBooleanKeyword();
|
|
58344
58465
|
}
|
|
58345
58466
|
case "ID": {
|
|
58346
|
-
return
|
|
58467
|
+
return AST7.tsStringKeyword();
|
|
58347
58468
|
}
|
|
58348
58469
|
default: {
|
|
58349
|
-
if (
|
|
58470
|
+
if (graphql13.isNonNullType(target) && "ofType" in target) {
|
|
58350
58471
|
return scalarPropertyValue(
|
|
58351
58472
|
config2,
|
|
58352
58473
|
missingScalars,
|
|
@@ -58354,23 +58475,23 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
58354
58475
|
);
|
|
58355
58476
|
}
|
|
58356
58477
|
if (config2.scalars?.[target.name]) {
|
|
58357
|
-
return
|
|
58478
|
+
return AST7.tsTypeReference(AST7.identifier(config2.scalars?.[target.name].type));
|
|
58358
58479
|
}
|
|
58359
58480
|
missingScalars.add(target.name);
|
|
58360
|
-
return
|
|
58481
|
+
return AST7.tsAnyKeyword();
|
|
58361
58482
|
}
|
|
58362
58483
|
}
|
|
58363
58484
|
}
|
|
58364
58485
|
|
|
58365
58486
|
// src/codegen/generators/typescript/typeReference.ts
|
|
58366
|
-
var
|
|
58487
|
+
var AST8 = recast8.types.builders;
|
|
58367
58488
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
58368
58489
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
58369
58490
|
let result;
|
|
58370
|
-
if (
|
|
58491
|
+
if (graphql14.isScalarType(type)) {
|
|
58371
58492
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58372
58493
|
} else {
|
|
58373
|
-
result =
|
|
58494
|
+
result = AST8.tsTypeReference(AST8.identifier(type.name));
|
|
58374
58495
|
}
|
|
58375
58496
|
for (const toWrap of wrappers) {
|
|
58376
58497
|
if (toWrap === "NonNull" /* NonNull */) {
|
|
@@ -58378,27 +58499,27 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
58378
58499
|
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
58379
58500
|
result = nullableField(result, true);
|
|
58380
58501
|
} else if (toWrap === "List" /* List */) {
|
|
58381
|
-
result =
|
|
58502
|
+
result = AST8.tsArrayType(AST8.tsParenthesizedType(result));
|
|
58382
58503
|
}
|
|
58383
58504
|
}
|
|
58384
58505
|
return result;
|
|
58385
58506
|
}
|
|
58386
58507
|
|
|
58387
58508
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58388
|
-
var
|
|
58509
|
+
var AST9 = recast9.types.builders;
|
|
58389
58510
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
58390
58511
|
const { type } = unwrapType(config2, rootType);
|
|
58391
|
-
if (
|
|
58512
|
+
if (graphql15.isScalarType(type)) {
|
|
58392
58513
|
return;
|
|
58393
58514
|
}
|
|
58394
58515
|
if (visitedTypes.has(type.name)) {
|
|
58395
58516
|
return;
|
|
58396
58517
|
}
|
|
58397
|
-
if (
|
|
58518
|
+
if (graphql15.isUnionType(type)) {
|
|
58398
58519
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
58399
58520
|
}
|
|
58400
58521
|
visitedTypes.add(type.name);
|
|
58401
|
-
if (
|
|
58522
|
+
if (graphql15.isEnumType(type)) {
|
|
58402
58523
|
ensureImports({
|
|
58403
58524
|
config: config2,
|
|
58404
58525
|
body,
|
|
@@ -58412,20 +58533,267 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58412
58533
|
for (const field of Object.values(type.getFields())) {
|
|
58413
58534
|
addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, field.type);
|
|
58414
58535
|
members.push(
|
|
58415
|
-
|
|
58416
|
-
|
|
58417
|
-
|
|
58418
|
-
|
|
58536
|
+
AST9.tsPropertySignature(
|
|
58537
|
+
AST9.identifier(field.name),
|
|
58538
|
+
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
58539
|
+
graphql15.isNullableType(field.type)
|
|
58419
58540
|
)
|
|
58420
58541
|
);
|
|
58421
58542
|
}
|
|
58422
|
-
body.push(
|
|
58543
|
+
body.push(AST9.tsTypeAliasDeclaration(AST9.identifier(type.name), AST9.tsTypeLiteral(members)));
|
|
58544
|
+
}
|
|
58545
|
+
|
|
58546
|
+
// src/codegen/generators/typescript/imperativeCache.ts
|
|
58547
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
58548
|
+
var recast10 = __toESM(require_main2(), 1);
|
|
58549
|
+
var AST10 = recast10.types.builders;
|
|
58550
|
+
async function imperativeCacheTypef(config2, docs) {
|
|
58551
|
+
const target = path_exports.join(config2.runtimeDirectory, "generated.d.ts");
|
|
58552
|
+
const body = [];
|
|
58553
|
+
const declaration = AST10.tsTypeAliasDeclaration(
|
|
58554
|
+
AST10.identifier(CacheTypeDefName),
|
|
58555
|
+
AST10.tsTypeLiteral([
|
|
58556
|
+
AST10.tsPropertySignature(
|
|
58557
|
+
AST10.identifier("types"),
|
|
58558
|
+
AST10.tsTypeAnnotation(typeDefinitions(config2, body))
|
|
58559
|
+
),
|
|
58560
|
+
AST10.tsPropertySignature(
|
|
58561
|
+
AST10.identifier("lists"),
|
|
58562
|
+
AST10.tsTypeAnnotation(listDefinitions(config2, docs))
|
|
58563
|
+
)
|
|
58564
|
+
])
|
|
58565
|
+
);
|
|
58566
|
+
declaration.declare = true;
|
|
58567
|
+
const importRecord = AST10.importDeclaration(
|
|
58568
|
+
[AST10.importSpecifier(AST10.identifier("Record"))],
|
|
58569
|
+
AST10.stringLiteral("./public/record")
|
|
58570
|
+
);
|
|
58571
|
+
importRecord.importKind = "type";
|
|
58572
|
+
await fs_exports.writeFile(
|
|
58573
|
+
target,
|
|
58574
|
+
recast10.prettyPrint(
|
|
58575
|
+
AST10.program([importRecord, ...body, AST10.exportNamedDeclaration(declaration)])
|
|
58576
|
+
).code
|
|
58577
|
+
);
|
|
58578
|
+
}
|
|
58579
|
+
function typeDefinitions(config2, body) {
|
|
58580
|
+
const operationTypes = [config2.schema.getMutationType(), config2.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
58581
|
+
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58582
|
+
const types14 = Object.values(config2.schema.getTypeMap()).filter(
|
|
58583
|
+
(type) => !graphql16.isAbstractType(type) && !graphql16.isScalarType(type) && !graphql16.isEnumType(type) && !graphql16.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
58584
|
+
);
|
|
58585
|
+
return AST10.tsTypeLiteral(
|
|
58586
|
+
types14.map((type) => {
|
|
58587
|
+
let typeName = type.name;
|
|
58588
|
+
if (config2.schema.getQueryType() && config2.schema.getQueryType()?.name === type.name) {
|
|
58589
|
+
typeName = "__ROOT__";
|
|
58590
|
+
}
|
|
58591
|
+
let idFields = AST10.tsNeverKeyword();
|
|
58592
|
+
const keys = keyFieldsForType(config2.configFile, type.name);
|
|
58593
|
+
if (graphql16.isObjectType(type) && keys.length > 0 && keys.every((key) => type.getFields()[key])) {
|
|
58594
|
+
idFields = AST10.tsTypeLiteral(
|
|
58595
|
+
keys.map((key) => {
|
|
58596
|
+
const fieldType = type.getFields()[key];
|
|
58597
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
58598
|
+
return AST10.tsPropertySignature(
|
|
58599
|
+
AST10.identifier(key),
|
|
58600
|
+
AST10.tsTypeAnnotation(
|
|
58601
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
58602
|
+
)
|
|
58603
|
+
);
|
|
58604
|
+
})
|
|
58605
|
+
);
|
|
58606
|
+
} else if (typeName === "__ROOT__") {
|
|
58607
|
+
idFields = AST10.tsTypeLiteral([]);
|
|
58608
|
+
}
|
|
58609
|
+
let fields = AST10.tsTypeLiteral([]);
|
|
58610
|
+
if (graphql16.isObjectType(type)) {
|
|
58611
|
+
fields = AST10.tsTypeLiteral(
|
|
58612
|
+
Object.entries(type.getFields()).map(
|
|
58613
|
+
([key, fieldType]) => {
|
|
58614
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
58615
|
+
let typeOptions = AST10.tsUnionType([]);
|
|
58616
|
+
if (graphql16.isScalarType(unwrapped.type)) {
|
|
58617
|
+
typeOptions.types.push(
|
|
58618
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
58619
|
+
);
|
|
58620
|
+
} else if (graphql16.isEnumType(unwrapped.type)) {
|
|
58621
|
+
typeOptions.types.push(
|
|
58622
|
+
AST10.tsTypeReference(AST10.identifier(unwrapped.type.name))
|
|
58623
|
+
);
|
|
58624
|
+
} else if (!graphql16.isAbstractType(unwrapped.type)) {
|
|
58625
|
+
typeOptions.types.push(record(unwrapped.type.name));
|
|
58626
|
+
} else {
|
|
58627
|
+
typeOptions.types.push(
|
|
58628
|
+
...config2.schema.getPossibleTypes(unwrapped.type).map((type2) => record(type2.name))
|
|
58629
|
+
);
|
|
58630
|
+
}
|
|
58631
|
+
for (const wrapper of unwrapped.wrappers) {
|
|
58632
|
+
if (wrapper === "Nullable" /* Nullable */) {
|
|
58633
|
+
typeOptions = AST10.tsParenthesizedType(
|
|
58634
|
+
AST10.tsUnionType([typeOptions, AST10.tsNullKeyword()])
|
|
58635
|
+
);
|
|
58636
|
+
} else if (wrapper === "List" /* List */) {
|
|
58637
|
+
typeOptions = AST10.tsArrayType(
|
|
58638
|
+
AST10.tsParenthesizedType(typeOptions)
|
|
58639
|
+
);
|
|
58640
|
+
}
|
|
58641
|
+
}
|
|
58642
|
+
if (typeOptions.type === "TSParenthesizedType") {
|
|
58643
|
+
typeOptions = typeOptions.typeAnnotation;
|
|
58644
|
+
}
|
|
58645
|
+
let args = AST10.tsNeverKeyword();
|
|
58646
|
+
if (fieldType.args?.length > 0) {
|
|
58647
|
+
args = AST10.tsTypeLiteral(
|
|
58648
|
+
fieldType.args.map((arg) => {
|
|
58649
|
+
addReferencedInputTypes(
|
|
58650
|
+
config2,
|
|
58651
|
+
"",
|
|
58652
|
+
body,
|
|
58653
|
+
visitedTypes,
|
|
58654
|
+
/* @__PURE__ */ new Set(),
|
|
58655
|
+
arg.type
|
|
58656
|
+
);
|
|
58657
|
+
const prop = AST10.tsPropertySignature(
|
|
58658
|
+
AST10.identifier(arg.name),
|
|
58659
|
+
AST10.tsTypeAnnotation(
|
|
58660
|
+
tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
|
|
58661
|
+
)
|
|
58662
|
+
);
|
|
58663
|
+
const unwrapped2 = unwrapType(config2, arg.type);
|
|
58664
|
+
prop.optional = unwrapped2.wrappers[unwrapped2.wrappers.length - 1] === "Nullable" /* Nullable */;
|
|
58665
|
+
return prop;
|
|
58666
|
+
})
|
|
58667
|
+
);
|
|
58668
|
+
}
|
|
58669
|
+
return AST10.tsPropertySignature(
|
|
58670
|
+
AST10.identifier(key),
|
|
58671
|
+
AST10.tsTypeAnnotation(
|
|
58672
|
+
AST10.tsTypeLiteral([
|
|
58673
|
+
AST10.tsPropertySignature(
|
|
58674
|
+
AST10.identifier("type"),
|
|
58675
|
+
AST10.tsTypeAnnotation(typeOptions)
|
|
58676
|
+
),
|
|
58677
|
+
AST10.tsPropertySignature(
|
|
58678
|
+
AST10.identifier("args"),
|
|
58679
|
+
AST10.tsTypeAnnotation(args)
|
|
58680
|
+
)
|
|
58681
|
+
])
|
|
58682
|
+
)
|
|
58683
|
+
);
|
|
58684
|
+
}
|
|
58685
|
+
)
|
|
58686
|
+
);
|
|
58687
|
+
}
|
|
58688
|
+
return AST10.tsPropertySignature(
|
|
58689
|
+
AST10.identifier(typeName),
|
|
58690
|
+
AST10.tsTypeAnnotation(
|
|
58691
|
+
AST10.tsTypeLiteral([
|
|
58692
|
+
AST10.tsPropertySignature(
|
|
58693
|
+
AST10.identifier("idFields"),
|
|
58694
|
+
AST10.tsTypeAnnotation(idFields)
|
|
58695
|
+
),
|
|
58696
|
+
AST10.tsPropertySignature(
|
|
58697
|
+
AST10.identifier("fields"),
|
|
58698
|
+
AST10.tsTypeAnnotation(fields)
|
|
58699
|
+
)
|
|
58700
|
+
])
|
|
58701
|
+
)
|
|
58702
|
+
);
|
|
58703
|
+
})
|
|
58704
|
+
);
|
|
58705
|
+
}
|
|
58706
|
+
function listDefinitions(config2, docs) {
|
|
58707
|
+
const lists = [];
|
|
58708
|
+
const visitedLists = /* @__PURE__ */ new Set();
|
|
58709
|
+
for (const doc of docs) {
|
|
58710
|
+
graphql16.visit(doc.document, {
|
|
58711
|
+
Directive(node, key, parent, path2, ancestors) {
|
|
58712
|
+
if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
58713
|
+
return;
|
|
58714
|
+
}
|
|
58715
|
+
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
58716
|
+
const nameValue = nameArg?.value?.value || "";
|
|
58717
|
+
if (!nameValue || visitedLists.has(nameValue)) {
|
|
58718
|
+
return;
|
|
58719
|
+
}
|
|
58720
|
+
visitedLists.add(nameValue);
|
|
58721
|
+
const parentType = parentTypeFromAncestors(
|
|
58722
|
+
config2.schema,
|
|
58723
|
+
doc.filename,
|
|
58724
|
+
ancestors.slice(0, -1)
|
|
58725
|
+
);
|
|
58726
|
+
const targetField = ancestors[ancestors.length - 1];
|
|
58727
|
+
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
58728
|
+
const { type: listType } = unwrapType(config2, targetFieldDefinition.type);
|
|
58729
|
+
const possibleTypes = [];
|
|
58730
|
+
if (graphql16.isAbstractType(listType)) {
|
|
58731
|
+
possibleTypes.push(
|
|
58732
|
+
...config2.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
58733
|
+
);
|
|
58734
|
+
} else {
|
|
58735
|
+
possibleTypes.push(listType.name);
|
|
58736
|
+
}
|
|
58737
|
+
lists.push(
|
|
58738
|
+
AST10.tsPropertySignature(
|
|
58739
|
+
AST10.identifier(nameValue),
|
|
58740
|
+
AST10.tsTypeAnnotation(
|
|
58741
|
+
AST10.tsTypeLiteral([
|
|
58742
|
+
AST10.tsPropertySignature(
|
|
58743
|
+
AST10.identifier("type"),
|
|
58744
|
+
AST10.tsTypeAnnotation(
|
|
58745
|
+
AST10.tsUnionType(
|
|
58746
|
+
possibleTypes.map(
|
|
58747
|
+
(possible) => AST10.tsLiteralType(AST10.stringLiteral(possible))
|
|
58748
|
+
)
|
|
58749
|
+
)
|
|
58750
|
+
)
|
|
58751
|
+
),
|
|
58752
|
+
AST10.tsPropertySignature(
|
|
58753
|
+
AST10.identifier("filters"),
|
|
58754
|
+
AST10.tsTypeAnnotation(
|
|
58755
|
+
targetFieldDefinition.args.length === 0 ? AST10.tsNeverKeyword() : AST10.tsTypeLiteral(
|
|
58756
|
+
targetFieldDefinition.args.map((arg) => {
|
|
58757
|
+
const argDef = AST10.tsPropertySignature(
|
|
58758
|
+
AST10.identifier(arg.name),
|
|
58759
|
+
AST10.tsTypeAnnotation(
|
|
58760
|
+
tsTypeReference(
|
|
58761
|
+
config2,
|
|
58762
|
+
/* @__PURE__ */ new Set(),
|
|
58763
|
+
arg
|
|
58764
|
+
)
|
|
58765
|
+
)
|
|
58766
|
+
);
|
|
58767
|
+
argDef.optional = true;
|
|
58768
|
+
return argDef;
|
|
58769
|
+
})
|
|
58770
|
+
)
|
|
58771
|
+
)
|
|
58772
|
+
)
|
|
58773
|
+
])
|
|
58774
|
+
)
|
|
58775
|
+
)
|
|
58776
|
+
);
|
|
58777
|
+
}
|
|
58778
|
+
});
|
|
58779
|
+
}
|
|
58780
|
+
return AST10.tsTypeLiteral(lists);
|
|
58781
|
+
}
|
|
58782
|
+
var CacheTypeDefName = "CacheTypeDef";
|
|
58783
|
+
function record(name2) {
|
|
58784
|
+
return AST10.tsTypeReference(
|
|
58785
|
+
AST10.identifier("Record"),
|
|
58786
|
+
AST10.tsTypeParameterInstantiation([
|
|
58787
|
+
AST10.tsTypeReference(AST10.identifier(CacheTypeDefName)),
|
|
58788
|
+
AST10.tsLiteralType(AST10.stringLiteral(name2))
|
|
58789
|
+
])
|
|
58790
|
+
);
|
|
58423
58791
|
}
|
|
58424
58792
|
|
|
58425
58793
|
// src/codegen/generators/typescript/inlineType.ts
|
|
58426
|
-
var
|
|
58427
|
-
var
|
|
58428
|
-
var
|
|
58794
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
58795
|
+
var recast11 = __toESM(require_main2(), 1);
|
|
58796
|
+
var AST11 = recast11.types.builders;
|
|
58429
58797
|
var fragmentKey = "$fragments";
|
|
58430
58798
|
function inlineType({
|
|
58431
58799
|
config: config2,
|
|
@@ -58442,9 +58810,9 @@ function inlineType({
|
|
|
58442
58810
|
}) {
|
|
58443
58811
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
58444
58812
|
let result;
|
|
58445
|
-
if (
|
|
58813
|
+
if (graphql17.isScalarType(type)) {
|
|
58446
58814
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58447
|
-
} else if (
|
|
58815
|
+
} else if (graphql17.isEnumType(type)) {
|
|
58448
58816
|
if (!visitedTypes.has(type.name)) {
|
|
58449
58817
|
ensureImports({
|
|
58450
58818
|
config: config2,
|
|
@@ -58454,7 +58822,7 @@ function inlineType({
|
|
|
58454
58822
|
});
|
|
58455
58823
|
visitedTypes.add(type.name);
|
|
58456
58824
|
}
|
|
58457
|
-
result =
|
|
58825
|
+
result = AST11.tsTypeReference(AST11.identifier(type.name));
|
|
58458
58826
|
} else if (selections) {
|
|
58459
58827
|
const rootObj = type;
|
|
58460
58828
|
const inlineFragments = {};
|
|
@@ -58462,11 +58830,11 @@ function inlineType({
|
|
|
58462
58830
|
for (const selection2 of selections) {
|
|
58463
58831
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
58464
58832
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
58465
|
-
if (!
|
|
58833
|
+
if (!graphql17.isInterfaceType(type) && !graphql17.isUnionType(type)) {
|
|
58466
58834
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
58467
58835
|
continue;
|
|
58468
58836
|
}
|
|
58469
|
-
if (!
|
|
58837
|
+
if (!graphql17.isInterfaceType(fragmentType) && !graphql17.isUnionType(fragmentType)) {
|
|
58470
58838
|
if (!inlineFragments[fragmentType.name]) {
|
|
58471
58839
|
inlineFragments[fragmentType.name] = [];
|
|
58472
58840
|
}
|
|
@@ -58505,7 +58873,7 @@ function inlineType({
|
|
|
58505
58873
|
selectedFields.push(selection2);
|
|
58506
58874
|
}
|
|
58507
58875
|
}
|
|
58508
|
-
result =
|
|
58876
|
+
result = AST11.tsTypeLiteral([
|
|
58509
58877
|
...(selectedFields || []).filter(
|
|
58510
58878
|
(field) => field.kind === "Field"
|
|
58511
58879
|
).map((selection2) => {
|
|
@@ -58525,9 +58893,9 @@ function inlineType({
|
|
|
58525
58893
|
allOptional
|
|
58526
58894
|
});
|
|
58527
58895
|
const prop = readonlyProperty(
|
|
58528
|
-
|
|
58529
|
-
|
|
58530
|
-
|
|
58896
|
+
AST11.tsPropertySignature(
|
|
58897
|
+
AST11.identifier(attributeName),
|
|
58898
|
+
AST11.tsTypeAnnotation(attributeType)
|
|
58531
58899
|
),
|
|
58532
58900
|
allowReadonly
|
|
58533
58901
|
);
|
|
@@ -58541,15 +58909,15 @@ function inlineType({
|
|
|
58541
58909
|
if (includeFragments && fragmentSpreads && fragmentSpreads.length) {
|
|
58542
58910
|
result.members.push(
|
|
58543
58911
|
readonlyProperty(
|
|
58544
|
-
|
|
58545
|
-
|
|
58546
|
-
|
|
58547
|
-
|
|
58912
|
+
AST11.tsPropertySignature(
|
|
58913
|
+
AST11.identifier(fragmentKey),
|
|
58914
|
+
AST11.tsTypeAnnotation(
|
|
58915
|
+
AST11.tsTypeLiteral(
|
|
58548
58916
|
(fragmentSpreads || []).map(
|
|
58549
|
-
(fragmentSpread) =>
|
|
58550
|
-
|
|
58551
|
-
|
|
58552
|
-
|
|
58917
|
+
(fragmentSpread) => AST11.tsPropertySignature(
|
|
58918
|
+
AST11.identifier(fragmentSpread.name.value),
|
|
58919
|
+
AST11.tsTypeAnnotation(
|
|
58920
|
+
AST11.tsLiteralType(AST11.booleanLiteral(true))
|
|
58553
58921
|
)
|
|
58554
58922
|
)
|
|
58555
58923
|
)
|
|
@@ -58586,7 +58954,7 @@ function inlineType({
|
|
|
58586
58954
|
}
|
|
58587
58955
|
}
|
|
58588
58956
|
}
|
|
58589
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
58957
|
+
if (objectType.type === "TSTypeLiteral" && !graphql17.isInterfaceType(fragmentRootType) && !graphql17.isUnionType(fragmentRootType)) {
|
|
58590
58958
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
58591
58959
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
58592
58960
|
);
|
|
@@ -58595,9 +58963,9 @@ function inlineType({
|
|
|
58595
58963
|
}
|
|
58596
58964
|
objectType.members.push(
|
|
58597
58965
|
readonlyProperty(
|
|
58598
|
-
|
|
58599
|
-
|
|
58600
|
-
|
|
58966
|
+
AST11.tsPropertySignature(
|
|
58967
|
+
AST11.identifier("__typename"),
|
|
58968
|
+
AST11.tsTypeAnnotation(AST11.tsLiteralType(AST11.stringLiteral(typeName)))
|
|
58601
58969
|
),
|
|
58602
58970
|
allowReadonly
|
|
58603
58971
|
)
|
|
@@ -58608,8 +58976,8 @@ function inlineType({
|
|
|
58608
58976
|
if (Object.keys(inlineFragmentSelections).length > 0) {
|
|
58609
58977
|
let selectionTypes = Object.entries(inlineFragmentSelections).map(
|
|
58610
58978
|
([typeName, { type: type2, tsType }]) => {
|
|
58611
|
-
return
|
|
58612
|
-
|
|
58979
|
+
return AST11.tsParenthesizedType(
|
|
58980
|
+
AST11.tsIntersectionType(
|
|
58613
58981
|
[tsType].flatMap((type3) => {
|
|
58614
58982
|
if (type3.type === "TSUnionType") {
|
|
58615
58983
|
return type3.types.filter(
|
|
@@ -58622,9 +58990,9 @@ function inlineType({
|
|
|
58622
58990
|
);
|
|
58623
58991
|
}
|
|
58624
58992
|
);
|
|
58625
|
-
result =
|
|
58993
|
+
result = AST11.tsIntersectionType([
|
|
58626
58994
|
result,
|
|
58627
|
-
|
|
58995
|
+
AST11.tsParenthesizedType(AST11.tsUnionType(selectionTypes))
|
|
58628
58996
|
]);
|
|
58629
58997
|
}
|
|
58630
58998
|
} else {
|
|
@@ -58636,7 +59004,7 @@ function inlineType({
|
|
|
58636
59004
|
} else if (toWrap === "NonNull" /* NonNull */) {
|
|
58637
59005
|
continue;
|
|
58638
59006
|
} else if (toWrap === "List" /* List */) {
|
|
58639
|
-
result =
|
|
59007
|
+
result = AST11.tsArrayType(AST11.tsParenthesizedType(result));
|
|
58640
59008
|
}
|
|
58641
59009
|
}
|
|
58642
59010
|
return result;
|
|
@@ -58653,7 +59021,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58653
59021
|
},
|
|
58654
59022
|
type: schema.getType("String")
|
|
58655
59023
|
};
|
|
58656
|
-
} else if (
|
|
59024
|
+
} else if (graphql17.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
58657
59025
|
fields = rootType.ofType.getFields();
|
|
58658
59026
|
} else {
|
|
58659
59027
|
fields = rootType.getFields();
|
|
@@ -58665,7 +59033,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58665
59033
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
58666
59034
|
});
|
|
58667
59035
|
}
|
|
58668
|
-
const fieldType =
|
|
59036
|
+
const fieldType = graphql17.getNamedType(field.type);
|
|
58669
59037
|
if (!fieldType) {
|
|
58670
59038
|
throw new HoudiniError({
|
|
58671
59039
|
filepath,
|
|
@@ -58681,7 +59049,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58681
59049
|
}
|
|
58682
59050
|
|
|
58683
59051
|
// src/codegen/generators/typescript/index.ts
|
|
58684
|
-
var
|
|
59052
|
+
var AST12 = recast12.types.builders;
|
|
58685
59053
|
async function typescriptGenerator(config2, docs) {
|
|
58686
59054
|
const typePaths = [];
|
|
58687
59055
|
const fragmentDefinitions = {};
|
|
@@ -58699,7 +59067,7 @@ async function typescriptGenerator(config2, docs) {
|
|
|
58699
59067
|
return;
|
|
58700
59068
|
}
|
|
58701
59069
|
const typeDefPath = config2.artifactTypePath(originalDocument);
|
|
58702
|
-
const program =
|
|
59070
|
+
const program = AST12.program([]);
|
|
58703
59071
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58704
59072
|
let definition = originalDocument.definitions.find(
|
|
58705
59073
|
(def) => (def.kind === "OperationDefinition" || def.kind === "FragmentDefinition") && def.name?.value === name2
|
|
@@ -58732,21 +59100,21 @@ async function typescriptGenerator(config2, docs) {
|
|
|
58732
59100
|
missingScalars
|
|
58733
59101
|
);
|
|
58734
59102
|
}
|
|
58735
|
-
await fs_exports.writeFile(typeDefPath,
|
|
59103
|
+
await fs_exports.writeFile(typeDefPath, recast12.print(program).code);
|
|
58736
59104
|
typePaths.push(typeDefPath);
|
|
58737
59105
|
})
|
|
58738
59106
|
);
|
|
58739
|
-
const typeIndex =
|
|
59107
|
+
const typeIndex = AST12.program(
|
|
58740
59108
|
typePaths.sort((a, b) => a.localeCompare(b)).map((typePath) => {
|
|
58741
|
-
return
|
|
58742
|
-
|
|
59109
|
+
return AST12.exportAllDeclaration(
|
|
59110
|
+
AST12.literal(
|
|
58743
59111
|
"./" + path_exports.relative(path_exports.resolve(config2.typeIndexPath, ".."), typePath).replace(/\.[^/.]+\.[^/.]+$/, "")
|
|
58744
59112
|
),
|
|
58745
59113
|
null
|
|
58746
59114
|
);
|
|
58747
59115
|
}).concat([
|
|
58748
|
-
|
|
58749
|
-
|
|
59116
|
+
AST12.exportAllDeclaration(AST12.literal("./runtime"), null),
|
|
59117
|
+
AST12.exportAllDeclaration(AST12.literal("./graphql"), null)
|
|
58750
59118
|
])
|
|
58751
59119
|
);
|
|
58752
59120
|
const export_default_as = ({ module, as }) => `
|
|
@@ -58755,7 +59123,7 @@ export { default as ${as} } from "${module}"
|
|
|
58755
59123
|
const export_star_from = ({ module }) => `
|
|
58756
59124
|
export * from "${module}"
|
|
58757
59125
|
`;
|
|
58758
|
-
let indexContent =
|
|
59126
|
+
let indexContent = recast12.print(typeIndex).code;
|
|
58759
59127
|
for (const plugin of config2.plugins) {
|
|
58760
59128
|
if (!plugin.index_file) {
|
|
58761
59129
|
continue;
|
|
@@ -58776,6 +59144,7 @@ export * from "${module}"
|
|
|
58776
59144
|
}
|
|
58777
59145
|
}
|
|
58778
59146
|
await fs_exports.writeFile(config2.typeIndexPath, indexContent);
|
|
59147
|
+
await imperativeCacheTypef(config2, docs);
|
|
58779
59148
|
if (missingScalars.size > 0) {
|
|
58780
59149
|
console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
|
|
58781
59150
|
", "
|
|
@@ -58817,23 +59186,23 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
58817
59186
|
const optimisticTypeName = `${definition.name.value}$optimistic`;
|
|
58818
59187
|
const hasInputs = definition.variableDefinitions && definition.variableDefinitions.length > 0;
|
|
58819
59188
|
body.push(
|
|
58820
|
-
|
|
58821
|
-
|
|
58822
|
-
|
|
58823
|
-
|
|
59189
|
+
AST12.exportNamedDeclaration(
|
|
59190
|
+
AST12.tsTypeAliasDeclaration(
|
|
59191
|
+
AST12.identifier(definition.name.value),
|
|
59192
|
+
AST12.tsTypeLiteral([
|
|
58824
59193
|
readonlyProperty(
|
|
58825
|
-
|
|
58826
|
-
|
|
58827
|
-
|
|
59194
|
+
AST12.tsPropertySignature(
|
|
59195
|
+
AST12.stringLiteral("input"),
|
|
59196
|
+
AST12.tsTypeAnnotation(AST12.tsTypeReference(AST12.identifier(inputTypeName)))
|
|
58828
59197
|
)
|
|
58829
59198
|
),
|
|
58830
59199
|
readonlyProperty(
|
|
58831
|
-
|
|
58832
|
-
|
|
58833
|
-
|
|
58834
|
-
definition.operation === "mutation" ?
|
|
58835
|
-
|
|
58836
|
-
|
|
59200
|
+
AST12.tsPropertySignature(
|
|
59201
|
+
AST12.stringLiteral("result"),
|
|
59202
|
+
AST12.tsTypeAnnotation(
|
|
59203
|
+
definition.operation === "mutation" ? AST12.tsTypeReference(AST12.identifier(shapeTypeName)) : AST12.tsUnionType([
|
|
59204
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName)),
|
|
59205
|
+
AST12.tsUndefinedKeyword()
|
|
58837
59206
|
])
|
|
58838
59207
|
)
|
|
58839
59208
|
)
|
|
@@ -58841,9 +59210,9 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
58841
59210
|
])
|
|
58842
59211
|
)
|
|
58843
59212
|
),
|
|
58844
|
-
|
|
58845
|
-
|
|
58846
|
-
|
|
59213
|
+
AST12.exportNamedDeclaration(
|
|
59214
|
+
AST12.tsTypeAliasDeclaration(
|
|
59215
|
+
AST12.identifier(shapeTypeName),
|
|
58847
59216
|
inlineType({
|
|
58848
59217
|
config: config2,
|
|
58849
59218
|
filepath,
|
|
@@ -58871,15 +59240,15 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
58871
59240
|
);
|
|
58872
59241
|
}
|
|
58873
59242
|
body.push(
|
|
58874
|
-
|
|
58875
|
-
|
|
58876
|
-
|
|
58877
|
-
|
|
59243
|
+
AST12.exportNamedDeclaration(
|
|
59244
|
+
AST12.tsTypeAliasDeclaration(
|
|
59245
|
+
AST12.identifier(inputTypeName),
|
|
59246
|
+
AST12.tsTypeLiteral(
|
|
58878
59247
|
(definition.variableDefinitions || []).map(
|
|
58879
59248
|
(definition2) => {
|
|
58880
|
-
return
|
|
58881
|
-
|
|
58882
|
-
|
|
59249
|
+
return AST12.tsPropertySignature(
|
|
59250
|
+
AST12.identifier(definition2.variable.name.value),
|
|
59251
|
+
AST12.tsTypeAnnotation(
|
|
58883
59252
|
tsTypeReference(config2, missingScalars, definition2)
|
|
58884
59253
|
),
|
|
58885
59254
|
definition2.type.kind !== "NonNullType"
|
|
@@ -58892,16 +59261,16 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
58892
59261
|
);
|
|
58893
59262
|
} else {
|
|
58894
59263
|
body.push(
|
|
58895
|
-
|
|
58896
|
-
|
|
59264
|
+
AST12.exportNamedDeclaration(
|
|
59265
|
+
AST12.tsTypeAliasDeclaration(AST12.identifier(inputTypeName), AST12.tsNullKeyword())
|
|
58897
59266
|
)
|
|
58898
59267
|
);
|
|
58899
59268
|
}
|
|
58900
59269
|
if (definition.operation === "mutation") {
|
|
58901
59270
|
body.push(
|
|
58902
|
-
|
|
58903
|
-
|
|
58904
|
-
|
|
59271
|
+
AST12.exportNamedDeclaration(
|
|
59272
|
+
AST12.tsTypeAliasDeclaration(
|
|
59273
|
+
AST12.identifier(optimisticTypeName),
|
|
58905
59274
|
inlineType({
|
|
58906
59275
|
config: config2,
|
|
58907
59276
|
filepath,
|
|
@@ -58932,28 +59301,28 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
58932
59301
|
throw new Error("Should not get here");
|
|
58933
59302
|
}
|
|
58934
59303
|
body.push(
|
|
58935
|
-
|
|
58936
|
-
|
|
58937
|
-
|
|
58938
|
-
|
|
59304
|
+
AST12.exportNamedDeclaration(
|
|
59305
|
+
AST12.tsTypeAliasDeclaration(
|
|
59306
|
+
AST12.identifier(propTypeName),
|
|
59307
|
+
AST12.tsTypeLiteral([
|
|
58939
59308
|
readonlyProperty(
|
|
58940
|
-
|
|
58941
|
-
|
|
58942
|
-
|
|
58943
|
-
|
|
59309
|
+
AST12.tsPropertySignature(
|
|
59310
|
+
AST12.stringLiteral("shape"),
|
|
59311
|
+
AST12.tsTypeAnnotation(
|
|
59312
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName))
|
|
58944
59313
|
),
|
|
58945
59314
|
true
|
|
58946
59315
|
)
|
|
58947
59316
|
),
|
|
58948
59317
|
readonlyProperty(
|
|
58949
|
-
|
|
58950
|
-
|
|
58951
|
-
|
|
58952
|
-
|
|
58953
|
-
|
|
58954
|
-
|
|
58955
|
-
|
|
58956
|
-
|
|
59318
|
+
AST12.tsPropertySignature(
|
|
59319
|
+
AST12.stringLiteral(fragmentKey),
|
|
59320
|
+
AST12.tsTypeAnnotation(
|
|
59321
|
+
AST12.tsTypeLiteral([
|
|
59322
|
+
AST12.tsPropertySignature(
|
|
59323
|
+
AST12.stringLiteral(propTypeName),
|
|
59324
|
+
AST12.tsTypeAnnotation(
|
|
59325
|
+
AST12.tsLiteralType(AST12.booleanLiteral(true))
|
|
58957
59326
|
)
|
|
58958
59327
|
)
|
|
58959
59328
|
])
|
|
@@ -58963,9 +59332,9 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
58963
59332
|
])
|
|
58964
59333
|
)
|
|
58965
59334
|
),
|
|
58966
|
-
|
|
58967
|
-
|
|
58968
|
-
|
|
59335
|
+
AST12.exportNamedDeclaration(
|
|
59336
|
+
AST12.tsTypeAliasDeclaration(
|
|
59337
|
+
AST12.identifier(shapeTypeName),
|
|
58969
59338
|
inlineType({
|
|
58970
59339
|
config: config2,
|
|
58971
59340
|
filepath,
|
|
@@ -58985,7 +59354,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
58985
59354
|
}
|
|
58986
59355
|
|
|
58987
59356
|
// src/codegen/generators/persistedQueries/index.ts
|
|
58988
|
-
var
|
|
59357
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
58989
59358
|
async function persistOutputGenerator(config2, docs) {
|
|
58990
59359
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
58991
59360
|
return;
|
|
@@ -58997,8 +59366,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
58997
59366
|
if (!generateArtifact) {
|
|
58998
59367
|
return acc;
|
|
58999
59368
|
}
|
|
59000
|
-
let rawString =
|
|
59001
|
-
|
|
59369
|
+
let rawString = graphql18.print(
|
|
59370
|
+
graphql18.visit(document, {
|
|
59002
59371
|
Directive(node) {
|
|
59003
59372
|
if (config2.isInternalDirective(node)) {
|
|
59004
59373
|
return null;
|
|
@@ -59007,7 +59376,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59007
59376
|
})
|
|
59008
59377
|
);
|
|
59009
59378
|
const operations = document.definitions.filter(
|
|
59010
|
-
({ kind }) => kind ===
|
|
59379
|
+
({ kind }) => kind === graphql18.Kind.OPERATION_DEFINITION
|
|
59011
59380
|
);
|
|
59012
59381
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
59013
59382
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -59020,26 +59389,26 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59020
59389
|
}
|
|
59021
59390
|
|
|
59022
59391
|
// src/codegen/generators/definitions/enums.ts
|
|
59023
|
-
var
|
|
59024
|
-
var
|
|
59025
|
-
var
|
|
59392
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
59393
|
+
var recast13 = __toESM(require_main2(), 1);
|
|
59394
|
+
var AST13 = recast13.types.builders;
|
|
59026
59395
|
async function definitionsGenerator(config2) {
|
|
59027
|
-
const enums =
|
|
59396
|
+
const enums = graphql19.parse(graphql19.printSchema(config2.schema)).definitions.filter(
|
|
59028
59397
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
59029
59398
|
).filter((def) => !config2.isInternalEnum(def));
|
|
59030
|
-
const runtimeDefinitions =
|
|
59031
|
-
|
|
59399
|
+
const runtimeDefinitions = recast13.print(
|
|
59400
|
+
AST13.program(
|
|
59032
59401
|
enums.map((defn) => {
|
|
59033
59402
|
const name2 = defn.name.value;
|
|
59034
59403
|
return moduleExport(
|
|
59035
59404
|
config2,
|
|
59036
59405
|
name2,
|
|
59037
|
-
|
|
59406
|
+
AST13.objectExpression(
|
|
59038
59407
|
defn.values?.map((value) => {
|
|
59039
59408
|
const str = value.name.value;
|
|
59040
|
-
return
|
|
59041
|
-
|
|
59042
|
-
|
|
59409
|
+
return AST13.objectProperty(
|
|
59410
|
+
AST13.stringLiteral(str),
|
|
59411
|
+
AST13.stringLiteral(str)
|
|
59043
59412
|
);
|
|
59044
59413
|
}) || []
|
|
59045
59414
|
)
|
|
@@ -59047,7 +59416,7 @@ async function definitionsGenerator(config2) {
|
|
|
59047
59416
|
})
|
|
59048
59417
|
)
|
|
59049
59418
|
).code;
|
|
59050
|
-
const
|
|
59419
|
+
const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
|
|
59051
59420
|
(definition) => `
|
|
59052
59421
|
export declare enum ${definition.name.value} {
|
|
59053
59422
|
${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
|
|
@@ -59058,7 +59427,7 @@ ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.val
|
|
|
59058
59427
|
export * from './enums.js'
|
|
59059
59428
|
`;
|
|
59060
59429
|
await Promise.all([
|
|
59061
|
-
fs_exports.writeFile(config2.enumTypesDefinitionsPath,
|
|
59430
|
+
fs_exports.writeFile(config2.enumTypesDefinitionsPath, typeDefinitions2),
|
|
59062
59431
|
fs_exports.writeFile(config2.enumRuntimeDefinitionsPath, runtimeDefinitions),
|
|
59063
59432
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.js"), definitionsIndex),
|
|
59064
59433
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.d.ts"), definitionsIndex)
|
|
@@ -59197,7 +59566,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59197
59566
|
}
|
|
59198
59567
|
|
|
59199
59568
|
// src/codegen/transforms/schema.ts
|
|
59200
|
-
var
|
|
59569
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
59201
59570
|
async function graphqlExtensions(config2, documents) {
|
|
59202
59571
|
const internalSchema = `
|
|
59203
59572
|
enum CachePolicy {
|
|
@@ -59275,19 +59644,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59275
59644
|
"""
|
|
59276
59645
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59277
59646
|
`;
|
|
59278
|
-
let currentSchema =
|
|
59647
|
+
let currentSchema = graphql21.printSchema(config2.schema);
|
|
59279
59648
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59280
59649
|
currentSchema += internalSchema;
|
|
59281
59650
|
}
|
|
59282
59651
|
config2.newSchema += internalSchema;
|
|
59283
|
-
config2.schema =
|
|
59652
|
+
config2.schema = graphql21.buildSchema(currentSchema);
|
|
59284
59653
|
}
|
|
59285
59654
|
|
|
59286
59655
|
// src/codegen/transforms/typename.ts
|
|
59287
|
-
var
|
|
59656
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
59288
59657
|
async function addTypename(config2, documents) {
|
|
59289
59658
|
for (const doc of documents) {
|
|
59290
|
-
doc.document =
|
|
59659
|
+
doc.document = graphql22.visit(doc.document, {
|
|
59291
59660
|
Field(node, key, parent, path2, ancestors) {
|
|
59292
59661
|
if (!node.selectionSet) {
|
|
59293
59662
|
return;
|
|
@@ -59299,7 +59668,7 @@ async function addTypename(config2, documents) {
|
|
|
59299
59668
|
);
|
|
59300
59669
|
const field = type.getFields()[node.name.value];
|
|
59301
59670
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59302
|
-
if (
|
|
59671
|
+
if (graphql22.isInterfaceType(fieldType) || graphql22.isUnionType(fieldType)) {
|
|
59303
59672
|
return {
|
|
59304
59673
|
...node,
|
|
59305
59674
|
selectionSet: {
|
|
@@ -59307,9 +59676,9 @@ async function addTypename(config2, documents) {
|
|
|
59307
59676
|
selections: [
|
|
59308
59677
|
...node.selectionSet.selections,
|
|
59309
59678
|
{
|
|
59310
|
-
kind:
|
|
59679
|
+
kind: graphql22.Kind.FIELD,
|
|
59311
59680
|
name: {
|
|
59312
|
-
kind:
|
|
59681
|
+
kind: graphql22.Kind.NAME,
|
|
59313
59682
|
value: "__typename"
|
|
59314
59683
|
}
|
|
59315
59684
|
}
|
|
@@ -59323,10 +59692,10 @@ async function addTypename(config2, documents) {
|
|
|
59323
59692
|
}
|
|
59324
59693
|
|
|
59325
59694
|
// src/codegen/transforms/addID.ts
|
|
59326
|
-
var
|
|
59695
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
59327
59696
|
async function addID(config2, documents) {
|
|
59328
59697
|
for (const doc of documents) {
|
|
59329
|
-
doc.document =
|
|
59698
|
+
doc.document = graphql23.visit(doc.document, {
|
|
59330
59699
|
Field(node, key, parent, path2, ancestors) {
|
|
59331
59700
|
if (!node.selectionSet) {
|
|
59332
59701
|
return;
|
|
@@ -59339,7 +59708,7 @@ async function addID(config2, documents) {
|
|
|
59339
59708
|
const field = type.getFields()[node.name.value];
|
|
59340
59709
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59341
59710
|
if (node.selectionSet?.selections.length > 0) {
|
|
59342
|
-
if (!
|
|
59711
|
+
if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
|
|
59343
59712
|
return;
|
|
59344
59713
|
}
|
|
59345
59714
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -59354,9 +59723,9 @@ async function addID(config2, documents) {
|
|
|
59354
59723
|
continue;
|
|
59355
59724
|
}
|
|
59356
59725
|
selections.push({
|
|
59357
|
-
kind:
|
|
59726
|
+
kind: graphql23.Kind.FIELD,
|
|
59358
59727
|
name: {
|
|
59359
|
-
kind:
|
|
59728
|
+
kind: graphql23.Kind.NAME,
|
|
59360
59729
|
value: keyField
|
|
59361
59730
|
}
|
|
59362
59731
|
});
|
|
@@ -59375,8 +59744,8 @@ async function addID(config2, documents) {
|
|
|
59375
59744
|
}
|
|
59376
59745
|
|
|
59377
59746
|
// src/codegen/transforms/fragmentVariables.ts
|
|
59378
|
-
var
|
|
59379
|
-
var GraphqlKinds2 =
|
|
59747
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
59748
|
+
var GraphqlKinds2 = graphql24.Kind;
|
|
59380
59749
|
async function fragmentVariables(config2, documents) {
|
|
59381
59750
|
const fragments = collectFragments(config2, documents);
|
|
59382
59751
|
const generatedFragments = {};
|
|
@@ -59399,7 +59768,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
59399
59768
|
});
|
|
59400
59769
|
}
|
|
59401
59770
|
const doc = {
|
|
59402
|
-
kind:
|
|
59771
|
+
kind: graphql24.Kind.DOCUMENT,
|
|
59403
59772
|
definitions: Object.values(generatedFragments)
|
|
59404
59773
|
};
|
|
59405
59774
|
documents.push({
|
|
@@ -59435,7 +59804,7 @@ function inlineFragmentArgs({
|
|
|
59435
59804
|
filepath,
|
|
59436
59805
|
document
|
|
59437
59806
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
59438
|
-
const result =
|
|
59807
|
+
const result = graphql24.visit(document, {
|
|
59439
59808
|
FragmentSpread(node) {
|
|
59440
59809
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
59441
59810
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -59523,7 +59892,7 @@ function inlineFragmentArgs({
|
|
|
59523
59892
|
});
|
|
59524
59893
|
if (newName) {
|
|
59525
59894
|
result.name = {
|
|
59526
|
-
kind:
|
|
59895
|
+
kind: graphql24.Kind.NAME,
|
|
59527
59896
|
value: newName
|
|
59528
59897
|
};
|
|
59529
59898
|
}
|
|
@@ -59635,7 +60004,7 @@ function operationScope(operation) {
|
|
|
59635
60004
|
}
|
|
59636
60005
|
|
|
59637
60006
|
// src/codegen/validators/typeCheck.ts
|
|
59638
|
-
var
|
|
60007
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
59639
60008
|
async function typeCheck(config2, docs) {
|
|
59640
60009
|
const errors = [];
|
|
59641
60010
|
const freeLists = [];
|
|
@@ -59643,11 +60012,11 @@ async function typeCheck(config2, docs) {
|
|
|
59643
60012
|
const listTypes = [];
|
|
59644
60013
|
const fragments = {};
|
|
59645
60014
|
for (const { document: parsed, filename } of docs) {
|
|
59646
|
-
|
|
59647
|
-
[
|
|
60015
|
+
graphql25.visit(parsed, {
|
|
60016
|
+
[graphql25.Kind.FRAGMENT_DEFINITION](definition) {
|
|
59648
60017
|
fragments[definition.name.value] = definition;
|
|
59649
60018
|
},
|
|
59650
|
-
[
|
|
60019
|
+
[graphql25.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
59651
60020
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
59652
60021
|
return;
|
|
59653
60022
|
}
|
|
@@ -59693,14 +60062,14 @@ async function typeCheck(config2, docs) {
|
|
|
59693
60062
|
);
|
|
59694
60063
|
return;
|
|
59695
60064
|
}
|
|
59696
|
-
if (
|
|
60065
|
+
if (graphql25.isListType(rootType) || graphql25.isNonNullType(rootType) && graphql25.isListType(rootType.ofType)) {
|
|
59697
60066
|
needsParent = true;
|
|
59698
60067
|
break;
|
|
59699
60068
|
}
|
|
59700
|
-
if (
|
|
60069
|
+
if (graphql25.isNonNullType(rootType) && "ofType" in rootType) {
|
|
59701
60070
|
rootType = rootType.ofType;
|
|
59702
60071
|
}
|
|
59703
|
-
if (
|
|
60072
|
+
if (graphql25.isScalarType(rootType)) {
|
|
59704
60073
|
break;
|
|
59705
60074
|
}
|
|
59706
60075
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -59756,7 +60125,7 @@ async function typeCheck(config2, docs) {
|
|
|
59756
60125
|
);
|
|
59757
60126
|
const targetField = ancestors[ancestors.length - 1];
|
|
59758
60127
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
59759
|
-
const { type, error } = connectionSelection(
|
|
60128
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
59760
60129
|
config2,
|
|
59761
60130
|
targetFieldDefinition,
|
|
59762
60131
|
parentTypeFromAncestors(
|
|
@@ -59766,10 +60135,19 @@ async function typeCheck(config2, docs) {
|
|
|
59766
60135
|
),
|
|
59767
60136
|
targetField.selectionSet
|
|
59768
60137
|
);
|
|
60138
|
+
if (errorConnectionSelection && directive.name.value === config2.paginateDirective) {
|
|
60139
|
+
errors.push(
|
|
60140
|
+
new HoudiniError({
|
|
60141
|
+
filepath: filename,
|
|
60142
|
+
message: errorConnectionSelection,
|
|
60143
|
+
description: errorConnectionSelection
|
|
60144
|
+
})
|
|
60145
|
+
);
|
|
60146
|
+
}
|
|
59769
60147
|
let targetTypes = [type];
|
|
59770
|
-
if (
|
|
60148
|
+
if (graphql25.isUnionType(type)) {
|
|
59771
60149
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
59772
|
-
} else if (
|
|
60150
|
+
} else if (graphql25.isInterfaceType(type)) {
|
|
59773
60151
|
try {
|
|
59774
60152
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
59775
60153
|
if (!type.getFields()[key]) {
|
|
@@ -59783,23 +60161,16 @@ async function typeCheck(config2, docs) {
|
|
|
59783
60161
|
for (const targetType of targetTypes) {
|
|
59784
60162
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
59785
60163
|
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
|
-
}
|
|
60164
|
+
const message = `@${config2.listDirective} on ${logGreen(
|
|
60165
|
+
targetType.name
|
|
60166
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
60167
|
+
errors.push(
|
|
60168
|
+
new HoudiniError({
|
|
60169
|
+
filepath: filename,
|
|
60170
|
+
message,
|
|
60171
|
+
description: message
|
|
60172
|
+
})
|
|
60173
|
+
);
|
|
59803
60174
|
return;
|
|
59804
60175
|
}
|
|
59805
60176
|
}
|
|
@@ -59814,13 +60185,13 @@ async function typeCheck(config2, docs) {
|
|
|
59814
60185
|
if (errors.length > 0) {
|
|
59815
60186
|
throw errors;
|
|
59816
60187
|
}
|
|
59817
|
-
const rules = (filepath) => [...
|
|
60188
|
+
const rules = (filepath) => [...graphql25.specifiedRules].filter(
|
|
59818
60189
|
(rule) => ![
|
|
59819
|
-
|
|
59820
|
-
|
|
59821
|
-
|
|
59822
|
-
|
|
59823
|
-
|
|
60190
|
+
graphql25.NoUnusedFragmentsRule,
|
|
60191
|
+
graphql25.KnownFragmentNamesRule,
|
|
60192
|
+
graphql25.ExecutableDefinitionsRule,
|
|
60193
|
+
graphql25.KnownDirectivesRule,
|
|
60194
|
+
graphql25.KnownArgumentNamesRule
|
|
59824
60195
|
].includes(rule)
|
|
59825
60196
|
).concat(
|
|
59826
60197
|
validateLists({
|
|
@@ -59839,7 +60210,7 @@ async function typeCheck(config2, docs) {
|
|
|
59839
60210
|
noUnusedFragmentArguments(config2)
|
|
59840
60211
|
);
|
|
59841
60212
|
for (const { filename, document: parsed } of docs) {
|
|
59842
|
-
for (const error of
|
|
60213
|
+
for (const error of graphql25.validate(config2.schema, parsed, rules(filename))) {
|
|
59843
60214
|
errors.push(
|
|
59844
60215
|
new HoudiniError({
|
|
59845
60216
|
filepath: filename,
|
|
@@ -59865,7 +60236,7 @@ var validateLists = ({
|
|
|
59865
60236
|
if (!config2.isListFragment(node.name.value)) {
|
|
59866
60237
|
if (!fragments[node.name.value]) {
|
|
59867
60238
|
ctx.reportError(
|
|
59868
|
-
new
|
|
60239
|
+
new graphql25.GraphQLError(
|
|
59869
60240
|
"Encountered unknown fragment: " + node.name.value
|
|
59870
60241
|
)
|
|
59871
60242
|
);
|
|
@@ -59875,7 +60246,7 @@ var validateLists = ({
|
|
|
59875
60246
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
59876
60247
|
if (!lists.includes(listName)) {
|
|
59877
60248
|
ctx.reportError(
|
|
59878
|
-
new
|
|
60249
|
+
new graphql25.GraphQLError(
|
|
59879
60250
|
"Encountered fragment referencing unknown list: " + listName
|
|
59880
60251
|
)
|
|
59881
60252
|
);
|
|
@@ -59900,7 +60271,7 @@ var validateLists = ({
|
|
|
59900
60271
|
);
|
|
59901
60272
|
if (parentArg) {
|
|
59902
60273
|
ctx.reportError(
|
|
59903
|
-
new
|
|
60274
|
+
new graphql25.GraphQLError(
|
|
59904
60275
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
59905
60276
|
)
|
|
59906
60277
|
);
|
|
@@ -59916,7 +60287,7 @@ var validateLists = ({
|
|
|
59916
60287
|
return;
|
|
59917
60288
|
}
|
|
59918
60289
|
ctx.reportError(
|
|
59919
|
-
new
|
|
60290
|
+
new graphql25.GraphQLError(
|
|
59920
60291
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
59921
60292
|
)
|
|
59922
60293
|
);
|
|
@@ -59926,7 +60297,7 @@ var validateLists = ({
|
|
|
59926
60297
|
const directiveName = node.name.value;
|
|
59927
60298
|
if (directiveName === "connection") {
|
|
59928
60299
|
ctx.reportError(
|
|
59929
|
-
new
|
|
60300
|
+
new graphql25.GraphQLError(
|
|
59930
60301
|
"@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
60302
|
)
|
|
59932
60303
|
);
|
|
@@ -59935,7 +60306,7 @@ var validateLists = ({
|
|
|
59935
60306
|
if (!config2.isInternalDirective(node)) {
|
|
59936
60307
|
if (!config2.schema.getDirective(directiveName)) {
|
|
59937
60308
|
ctx.reportError(
|
|
59938
|
-
new
|
|
60309
|
+
new graphql25.GraphQLError(
|
|
59939
60310
|
"Encountered unknown directive: " + directiveName
|
|
59940
60311
|
)
|
|
59941
60312
|
);
|
|
@@ -59944,7 +60315,7 @@ var validateLists = ({
|
|
|
59944
60315
|
}
|
|
59945
60316
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
59946
60317
|
ctx.reportError(
|
|
59947
|
-
new
|
|
60318
|
+
new graphql25.GraphQLError(
|
|
59948
60319
|
"Encountered directive referencing unknown list: " + directiveName
|
|
59949
60320
|
)
|
|
59950
60321
|
);
|
|
@@ -59955,7 +60326,7 @@ var validateLists = ({
|
|
|
59955
60326
|
};
|
|
59956
60327
|
function knownArguments(config2) {
|
|
59957
60328
|
return function(ctx) {
|
|
59958
|
-
const nativeValidator =
|
|
60329
|
+
const nativeValidator = graphql25.KnownArgumentNamesRule(ctx);
|
|
59959
60330
|
return {
|
|
59960
60331
|
...nativeValidator,
|
|
59961
60332
|
Directive(directiveNode) {
|
|
@@ -59988,7 +60359,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
59988
60359
|
for (const arg of node.arguments || []) {
|
|
59989
60360
|
if (arg.value.kind !== "ObjectValue") {
|
|
59990
60361
|
ctx.reportError(
|
|
59991
|
-
new
|
|
60362
|
+
new graphql25.GraphQLError("values in @arguments must be an object")
|
|
59992
60363
|
);
|
|
59993
60364
|
return;
|
|
59994
60365
|
}
|
|
@@ -59998,13 +60369,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
59998
60369
|
);
|
|
59999
60370
|
if (!typeArg) {
|
|
60000
60371
|
ctx.reportError(
|
|
60001
|
-
new
|
|
60372
|
+
new graphql25.GraphQLError("missing type field for @arguments directive")
|
|
60002
60373
|
);
|
|
60003
60374
|
return;
|
|
60004
60375
|
}
|
|
60005
|
-
if (typeArg.value.kind !==
|
|
60376
|
+
if (typeArg.value.kind !== graphql25.Kind.STRING) {
|
|
60006
60377
|
ctx.reportError(
|
|
60007
|
-
new
|
|
60378
|
+
new graphql25.GraphQLError("type field to @arguments must be a string")
|
|
60008
60379
|
);
|
|
60009
60380
|
return;
|
|
60010
60381
|
}
|
|
@@ -60017,7 +60388,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60017
60388
|
);
|
|
60018
60389
|
if (typeArg.value.value !== defaultValueType) {
|
|
60019
60390
|
ctx.reportError(
|
|
60020
|
-
new
|
|
60391
|
+
new graphql25.GraphQLError(
|
|
60021
60392
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60022
60393
|
)
|
|
60023
60394
|
);
|
|
@@ -60035,7 +60406,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60035
60406
|
try {
|
|
60036
60407
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60037
60408
|
} catch (e) {
|
|
60038
|
-
ctx.reportError(new
|
|
60409
|
+
ctx.reportError(new graphql25.GraphQLError(e.message));
|
|
60039
60410
|
return;
|
|
60040
60411
|
}
|
|
60041
60412
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60058,7 +60429,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60058
60429
|
);
|
|
60059
60430
|
if (missing.length > 0) {
|
|
60060
60431
|
ctx.reportError(
|
|
60061
|
-
new
|
|
60432
|
+
new graphql25.GraphQLError(
|
|
60062
60433
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60063
60434
|
)
|
|
60064
60435
|
);
|
|
@@ -60069,7 +60440,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60069
60440
|
);
|
|
60070
60441
|
if (unknown.length > 0) {
|
|
60071
60442
|
ctx.reportError(
|
|
60072
|
-
new
|
|
60443
|
+
new graphql25.GraphQLError(
|
|
60073
60444
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60074
60445
|
)
|
|
60075
60446
|
);
|
|
@@ -60081,7 +60452,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60081
60452
|
]
|
|
60082
60453
|
);
|
|
60083
60454
|
for (const [applied, target] of zipped) {
|
|
60084
|
-
if (applied.value.kind ===
|
|
60455
|
+
if (applied.value.kind === graphql25.Kind.VARIABLE || applied.value.kind === graphql25.Kind.LIST || applied.value.kind === graphql25.Kind.OBJECT) {
|
|
60085
60456
|
continue;
|
|
60086
60457
|
}
|
|
60087
60458
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60090,7 +60461,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60090
60461
|
);
|
|
60091
60462
|
if (appliedType !== target) {
|
|
60092
60463
|
ctx.reportError(
|
|
60093
|
-
new
|
|
60464
|
+
new graphql25.GraphQLError(
|
|
60094
60465
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60095
60466
|
)
|
|
60096
60467
|
);
|
|
@@ -60111,7 +60482,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60111
60482
|
}
|
|
60112
60483
|
if (alreadyPaginated) {
|
|
60113
60484
|
ctx.reportError(
|
|
60114
|
-
new
|
|
60485
|
+
new graphql25.GraphQLError(
|
|
60115
60486
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60116
60487
|
)
|
|
60117
60488
|
);
|
|
@@ -60126,7 +60497,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60126
60497
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60127
60498
|
if (hasRequiredArgs) {
|
|
60128
60499
|
ctx.reportError(
|
|
60129
|
-
new
|
|
60500
|
+
new graphql25.GraphQLError(
|
|
60130
60501
|
"@paginate cannot appear on a document with required args"
|
|
60131
60502
|
)
|
|
60132
60503
|
);
|
|
@@ -60158,14 +60529,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60158
60529
|
const backwards = appliedArgs.has("last");
|
|
60159
60530
|
if (!forward && !backwards) {
|
|
60160
60531
|
ctx.reportError(
|
|
60161
|
-
new
|
|
60532
|
+
new graphql25.GraphQLError(
|
|
60162
60533
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60163
60534
|
)
|
|
60164
60535
|
);
|
|
60165
60536
|
}
|
|
60166
60537
|
if (forward && backwards) {
|
|
60167
60538
|
ctx.reportError(
|
|
60168
|
-
new
|
|
60539
|
+
new graphql25.GraphQLError(
|
|
60169
60540
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60170
60541
|
)
|
|
60171
60542
|
);
|
|
@@ -60179,7 +60550,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60179
60550
|
);
|
|
60180
60551
|
if (!appliedLimitArg) {
|
|
60181
60552
|
ctx.reportError(
|
|
60182
|
-
new
|
|
60553
|
+
new graphql25.GraphQLError(
|
|
60183
60554
|
"A field with offset-based pagination must have a limit argument"
|
|
60184
60555
|
)
|
|
60185
60556
|
);
|
|
@@ -60195,20 +60566,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60195
60566
|
const args = /* @__PURE__ */ new Set();
|
|
60196
60567
|
return {
|
|
60197
60568
|
enter(node) {
|
|
60198
|
-
if (node.kind ===
|
|
60569
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
60199
60570
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60200
60571
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60201
60572
|
args.add(arg);
|
|
60202
60573
|
}
|
|
60203
|
-
} else if (node.kind ===
|
|
60574
|
+
} else if (node.kind === graphql25.Kind.VARIABLE) {
|
|
60204
60575
|
args.delete(node.name.value);
|
|
60205
60576
|
}
|
|
60206
60577
|
},
|
|
60207
60578
|
leave(node) {
|
|
60208
|
-
if (node.kind ===
|
|
60579
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
60209
60580
|
if (args.size > 0) {
|
|
60210
60581
|
ctx.reportError(
|
|
60211
|
-
new
|
|
60582
|
+
new graphql25.GraphQLError(
|
|
60212
60583
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60213
60584
|
)
|
|
60214
60585
|
);
|
|
@@ -60244,7 +60615,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60244
60615
|
if (definition.kind === "OperationDefinition") {
|
|
60245
60616
|
if (definition.operation !== "query") {
|
|
60246
60617
|
ctx.reportError(
|
|
60247
|
-
new
|
|
60618
|
+
new graphql25.GraphQLError(
|
|
60248
60619
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60249
60620
|
)
|
|
60250
60621
|
);
|
|
@@ -60256,7 +60627,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60256
60627
|
}
|
|
60257
60628
|
if (!possibleNodes.includes(definitionType)) {
|
|
60258
60629
|
ctx.reportError(
|
|
60259
|
-
new
|
|
60630
|
+
new graphql25.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60260
60631
|
);
|
|
60261
60632
|
}
|
|
60262
60633
|
}
|
|
@@ -60275,7 +60646,7 @@ function checkMutationOperation(config2) {
|
|
|
60275
60646
|
);
|
|
60276
60647
|
if (append && prepend) {
|
|
60277
60648
|
ctx.reportError(
|
|
60278
|
-
new
|
|
60649
|
+
new graphql25.GraphQLError(
|
|
60279
60650
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60280
60651
|
)
|
|
60281
60652
|
);
|
|
@@ -60289,7 +60660,7 @@ function checkMutationOperation(config2) {
|
|
|
60289
60660
|
);
|
|
60290
60661
|
if (parentId && allLists) {
|
|
60291
60662
|
ctx.reportError(
|
|
60292
|
-
new
|
|
60663
|
+
new graphql25.GraphQLError(
|
|
60293
60664
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60294
60665
|
)
|
|
60295
60666
|
);
|
|
@@ -60311,7 +60682,7 @@ function checkMaskDirective(config2) {
|
|
|
60311
60682
|
);
|
|
60312
60683
|
if (maskEnableDirective && maskDisableDirective) {
|
|
60313
60684
|
ctx.reportError(
|
|
60314
|
-
new
|
|
60685
|
+
new graphql25.GraphQLError(
|
|
60315
60686
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
60316
60687
|
)
|
|
60317
60688
|
);
|
|
@@ -60327,7 +60698,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
60327
60698
|
if (!nodeInterface) {
|
|
60328
60699
|
return null;
|
|
60329
60700
|
}
|
|
60330
|
-
if (!
|
|
60701
|
+
if (!graphql25.isInterfaceType(nodeInterface)) {
|
|
60331
60702
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
60332
60703
|
return null;
|
|
60333
60704
|
}
|
|
@@ -60425,11 +60796,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
60425
60796
|
}
|
|
60426
60797
|
|
|
60427
60798
|
// src/codegen/validators/noIDAlias.ts
|
|
60428
|
-
var
|
|
60799
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
60429
60800
|
async function noIDAlias(config2, docs) {
|
|
60430
60801
|
const errors = [];
|
|
60431
60802
|
for (const { filename, document } of docs) {
|
|
60432
|
-
|
|
60803
|
+
graphql26.visit(document, {
|
|
60433
60804
|
Field(node, _, __, ___, ancestors) {
|
|
60434
60805
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
60435
60806
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -60571,8 +60942,8 @@ async function collectDocuments(config2) {
|
|
|
60571
60942
|
}
|
|
60572
60943
|
}
|
|
60573
60944
|
}
|
|
60574
|
-
const graphql_extractor = (filepath, content) => [content];
|
|
60575
|
-
const javascript_extractor = (
|
|
60945
|
+
const graphql_extractor = (config3, filepath, content) => [content];
|
|
60946
|
+
const javascript_extractor = (fconfig, ilepath, content) => processJSFile(config2, content);
|
|
60576
60947
|
extractors[".ts"].push(javascript_extractor);
|
|
60577
60948
|
extractors[".js"].push(javascript_extractor);
|
|
60578
60949
|
extractors[".graphql"].push(graphql_extractor);
|
|
@@ -60596,7 +60967,7 @@ async function collectDocuments(config2) {
|
|
|
60596
60967
|
if (!extractor) {
|
|
60597
60968
|
continue;
|
|
60598
60969
|
}
|
|
60599
|
-
const found = await extractor(filepath, contents);
|
|
60970
|
+
const found = await extractor(config2, filepath, contents);
|
|
60600
60971
|
if (found.length > 0) {
|
|
60601
60972
|
documents.push(...found.map((document) => ({ filepath, document })));
|
|
60602
60973
|
}
|
|
@@ -60627,12 +60998,12 @@ async function processJSFile(config2, contents) {
|
|
|
60627
60998
|
return documents;
|
|
60628
60999
|
}
|
|
60629
61000
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
60630
|
-
const parsedDoc =
|
|
61001
|
+
const parsedDoc = graphql27.parse(document);
|
|
60631
61002
|
const operations = parsedDoc.definitions.filter(
|
|
60632
|
-
({ kind: kind2 }) => kind2 ===
|
|
61003
|
+
({ kind: kind2 }) => kind2 === graphql27.Kind.OPERATION_DEFINITION
|
|
60633
61004
|
);
|
|
60634
61005
|
const fragments = parsedDoc.definitions.filter(
|
|
60635
|
-
({ kind: kind2 }) => kind2 ===
|
|
61006
|
+
({ kind: kind2 }) => kind2 === graphql27.Kind.FRAGMENT_DEFINITION
|
|
60636
61007
|
);
|
|
60637
61008
|
if (operations.length > 1) {
|
|
60638
61009
|
throw new HoudiniError({
|