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
package/build/test-esm/index.js
CHANGED
|
@@ -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, print10) {
|
|
50750
50750
|
var value = path2.getValue();
|
|
50751
50751
|
var innerLines = print10(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, print10));
|
|
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(print10, "object"));
|
|
51880
51880
|
var property = path2.call(print10, "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(print10, "typeArguments"));
|
|
52151
52151
|
}
|
|
52152
|
-
if (
|
|
52152
|
+
if (types14.getFieldValue(n, "optional")) {
|
|
52153
52153
|
parts.push("?.");
|
|
52154
52154
|
}
|
|
52155
52155
|
parts.push(printArgumentsList(path2, options, print10));
|
|
@@ -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 = print10;
|
|
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/test/index.ts
|
|
53925
|
-
var
|
|
53925
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
53926
53926
|
var import_memfs2 = __toESM(require_lib(), 1);
|
|
53927
53927
|
|
|
53928
53928
|
// src/lib/pipeline.ts
|
|
@@ -54404,8 +54404,8 @@ var List = class {
|
|
|
54404
54404
|
} else {
|
|
54405
54405
|
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
54406
54406
|
}
|
|
54407
|
-
for (let
|
|
54408
|
-
yield
|
|
54407
|
+
for (let record2 of entries) {
|
|
54408
|
+
yield record2;
|
|
54409
54409
|
}
|
|
54410
54410
|
}
|
|
54411
54411
|
};
|
|
@@ -54454,6 +54454,46 @@ var ListCollection = class {
|
|
|
54454
54454
|
}
|
|
54455
54455
|
};
|
|
54456
54456
|
|
|
54457
|
+
// src/runtime/cache/schema.ts
|
|
54458
|
+
var SchemaManager = class {
|
|
54459
|
+
cache;
|
|
54460
|
+
fieldTypes = {};
|
|
54461
|
+
constructor(cache) {
|
|
54462
|
+
this.cache = cache;
|
|
54463
|
+
}
|
|
54464
|
+
setFieldType({
|
|
54465
|
+
parent,
|
|
54466
|
+
key,
|
|
54467
|
+
type,
|
|
54468
|
+
nullable = false,
|
|
54469
|
+
link
|
|
54470
|
+
}) {
|
|
54471
|
+
let parensIndex = key.indexOf("(");
|
|
54472
|
+
if (parensIndex !== -1) {
|
|
54473
|
+
key = key.substring(0, parensIndex);
|
|
54474
|
+
}
|
|
54475
|
+
if (parent === rootID) {
|
|
54476
|
+
parent = "Query";
|
|
54477
|
+
} else if (parent.includes(":")) {
|
|
54478
|
+
parent = parent.substring(0, parent.indexOf(":"));
|
|
54479
|
+
}
|
|
54480
|
+
if (!this.fieldTypes[parent]) {
|
|
54481
|
+
this.fieldTypes[parent] = {};
|
|
54482
|
+
}
|
|
54483
|
+
this.fieldTypes[parent][key] = {
|
|
54484
|
+
type,
|
|
54485
|
+
nullable,
|
|
54486
|
+
link: !!link
|
|
54487
|
+
};
|
|
54488
|
+
}
|
|
54489
|
+
fieldType(type, field) {
|
|
54490
|
+
return this.fieldTypes[type]?.[field] || null;
|
|
54491
|
+
}
|
|
54492
|
+
get config() {
|
|
54493
|
+
return this.cache._internal_unstable.config;
|
|
54494
|
+
}
|
|
54495
|
+
};
|
|
54496
|
+
|
|
54457
54497
|
// src/runtime/cache/storage.ts
|
|
54458
54498
|
var InMemoryStorage = class {
|
|
54459
54499
|
data;
|
|
@@ -55021,7 +55061,7 @@ var InMemorySubscriptions = class {
|
|
|
55021
55061
|
};
|
|
55022
55062
|
|
|
55023
55063
|
// src/runtime/cache/cache.ts
|
|
55024
|
-
var
|
|
55064
|
+
var Cache3 = class {
|
|
55025
55065
|
_internal_unstable;
|
|
55026
55066
|
constructor(config2) {
|
|
55027
55067
|
this._internal_unstable = new CacheInternal({
|
|
@@ -55029,7 +55069,8 @@ var Cache2 = class {
|
|
|
55029
55069
|
storage: new InMemoryStorage(),
|
|
55030
55070
|
subscriptions: new InMemorySubscriptions(this),
|
|
55031
55071
|
lists: new ListManager(this, rootID),
|
|
55032
|
-
lifetimes: new GarbageCollector(this)
|
|
55072
|
+
lifetimes: new GarbageCollector(this),
|
|
55073
|
+
schema: new SchemaManager(this)
|
|
55033
55074
|
});
|
|
55034
55075
|
if (config2) {
|
|
55035
55076
|
this.setConfig(defaultConfigValues(config2));
|
|
@@ -55115,18 +55156,21 @@ var CacheInternal = class {
|
|
|
55115
55156
|
lists;
|
|
55116
55157
|
cache;
|
|
55117
55158
|
lifetimes;
|
|
55159
|
+
schema;
|
|
55118
55160
|
constructor({
|
|
55119
55161
|
storage,
|
|
55120
55162
|
subscriptions,
|
|
55121
55163
|
lists,
|
|
55122
55164
|
cache,
|
|
55123
|
-
lifetimes
|
|
55165
|
+
lifetimes,
|
|
55166
|
+
schema
|
|
55124
55167
|
}) {
|
|
55125
55168
|
this.storage = storage;
|
|
55126
55169
|
this.subscriptions = subscriptions;
|
|
55127
55170
|
this.lists = lists;
|
|
55128
55171
|
this.cache = cache;
|
|
55129
55172
|
this.lifetimes = lifetimes;
|
|
55173
|
+
this.schema = schema;
|
|
55130
55174
|
this._disabled = typeof globalThis.window === "undefined";
|
|
55131
55175
|
try {
|
|
55132
55176
|
if (process.env.HOUDINI_TEST === "true") {
|
|
@@ -55142,7 +55186,6 @@ var CacheInternal = class {
|
|
|
55142
55186
|
data,
|
|
55143
55187
|
selection: selection2,
|
|
55144
55188
|
variables = {},
|
|
55145
|
-
root = rootID,
|
|
55146
55189
|
parent = rootID,
|
|
55147
55190
|
applyUpdates = false,
|
|
55148
55191
|
layer,
|
|
@@ -55165,9 +55208,17 @@ var CacheInternal = class {
|
|
|
55165
55208
|
selection: fieldSelection,
|
|
55166
55209
|
operations,
|
|
55167
55210
|
abstract: isAbstract,
|
|
55168
|
-
update
|
|
55211
|
+
update,
|
|
55212
|
+
nullable
|
|
55169
55213
|
} = targetSelection[field];
|
|
55170
55214
|
const key = evaluateKey(keyRaw, variables);
|
|
55215
|
+
this.schema.setFieldType({
|
|
55216
|
+
parent,
|
|
55217
|
+
key: keyRaw,
|
|
55218
|
+
type: linkedType,
|
|
55219
|
+
nullable,
|
|
55220
|
+
link: !!fieldSelection
|
|
55221
|
+
});
|
|
55171
55222
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
55172
55223
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
55173
55224
|
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
@@ -55236,7 +55287,6 @@ var CacheInternal = class {
|
|
|
55236
55287
|
}
|
|
55237
55288
|
if (linkedID) {
|
|
55238
55289
|
this.writeSelection({
|
|
55239
|
-
root,
|
|
55240
55290
|
selection: fieldSelection,
|
|
55241
55291
|
parent: linkedID,
|
|
55242
55292
|
data: value,
|
|
@@ -55627,7 +55677,7 @@ var CacheInternal = class {
|
|
|
55627
55677
|
var rootID = "_ROOT_";
|
|
55628
55678
|
|
|
55629
55679
|
// src/runtime/cache/index.ts
|
|
55630
|
-
var cache_default = new
|
|
55680
|
+
var cache_default = new Cache3();
|
|
55631
55681
|
|
|
55632
55682
|
// src/lib/constants.ts
|
|
55633
55683
|
var siteURL = "https://houdinigraphql.com";
|
|
@@ -55813,6 +55863,7 @@ async function writeFile(filepath, data) {
|
|
|
55813
55863
|
return;
|
|
55814
55864
|
}
|
|
55815
55865
|
if (houdini_mode.is_testing) {
|
|
55866
|
+
import_memfs.fs.mkdirpSync(dirname(filepath));
|
|
55816
55867
|
return import_memfs.fs.writeFileSync(filepath, data);
|
|
55817
55868
|
}
|
|
55818
55869
|
return await fs.writeFile(filepath, data, "utf8");
|
|
@@ -55939,7 +55990,6 @@ var Config = class {
|
|
|
55939
55990
|
rootDir;
|
|
55940
55991
|
projectRoot;
|
|
55941
55992
|
schema;
|
|
55942
|
-
apiUrl;
|
|
55943
55993
|
schemaPath;
|
|
55944
55994
|
persistedQueryPath;
|
|
55945
55995
|
exclude;
|
|
@@ -55979,7 +56029,6 @@ var Config = class {
|
|
|
55979
56029
|
schema,
|
|
55980
56030
|
schemaPath = "./schema.graphql",
|
|
55981
56031
|
exclude = [],
|
|
55982
|
-
apiUrl,
|
|
55983
56032
|
module = "esm",
|
|
55984
56033
|
scalars,
|
|
55985
56034
|
cacheBufferSize,
|
|
@@ -55989,7 +56038,7 @@ var Config = class {
|
|
|
55989
56038
|
defaultListPosition = "append",
|
|
55990
56039
|
defaultListTarget = null,
|
|
55991
56040
|
defaultKeys,
|
|
55992
|
-
types:
|
|
56041
|
+
types: types14 = {},
|
|
55993
56042
|
logLevel,
|
|
55994
56043
|
defaultFragmentMasking = "enable",
|
|
55995
56044
|
schemaPollInterval = 2e3,
|
|
@@ -56010,11 +56059,6 @@ var Config = class {
|
|
|
56010
56059
|
logLevel = LogLevel.Summary;
|
|
56011
56060
|
}
|
|
56012
56061
|
this.schemaPath = schemaPath;
|
|
56013
|
-
if (apiUrl && apiUrl.startsWith("env:")) {
|
|
56014
|
-
this.apiUrl = process.env[apiUrl.slice("env:".length)];
|
|
56015
|
-
} else {
|
|
56016
|
-
this.apiUrl = apiUrl;
|
|
56017
|
-
}
|
|
56018
56062
|
this.filepath = filepath;
|
|
56019
56063
|
this.exclude = Array.isArray(exclude) ? exclude : [exclude];
|
|
56020
56064
|
this.module = module;
|
|
@@ -56037,13 +56081,20 @@ var Config = class {
|
|
|
56037
56081
|
if (defaultKeys) {
|
|
56038
56082
|
this.defaultKeys = defaultKeys;
|
|
56039
56083
|
}
|
|
56040
|
-
if (
|
|
56084
|
+
if (types14) {
|
|
56041
56085
|
this.typeConfig = {
|
|
56042
56086
|
...this.typeConfig,
|
|
56043
|
-
...
|
|
56087
|
+
...types14
|
|
56044
56088
|
};
|
|
56045
56089
|
}
|
|
56046
56090
|
}
|
|
56091
|
+
async apiURL() {
|
|
56092
|
+
if (!this.configFile.apiUrl) {
|
|
56093
|
+
return "";
|
|
56094
|
+
}
|
|
56095
|
+
const env = await this.getEnv();
|
|
56096
|
+
return this.processEnvValues(env, this.configFile.apiUrl);
|
|
56097
|
+
}
|
|
56047
56098
|
get include() {
|
|
56048
56099
|
if (this.configFile.include) {
|
|
56049
56100
|
return Array.isArray(this.configFile.include) ? this.configFile.include : [this.configFile.include];
|
|
@@ -56056,23 +56107,43 @@ var Config = class {
|
|
|
56056
56107
|
pluginConfig(name2) {
|
|
56057
56108
|
return this.configFile.plugins?.[name2] ?? {};
|
|
56058
56109
|
}
|
|
56059
|
-
|
|
56060
|
-
|
|
56110
|
+
async getEnv() {
|
|
56111
|
+
let env = process.env;
|
|
56112
|
+
for (const plugin of this.plugins) {
|
|
56113
|
+
if (plugin.env) {
|
|
56114
|
+
env = {
|
|
56115
|
+
...await plugin.env({ config: this, env })
|
|
56116
|
+
};
|
|
56117
|
+
}
|
|
56118
|
+
}
|
|
56119
|
+
return env;
|
|
56120
|
+
}
|
|
56121
|
+
processEnvValues(env, value) {
|
|
56122
|
+
let headerValue;
|
|
56123
|
+
if (typeof value === "function") {
|
|
56124
|
+
headerValue = value(env);
|
|
56125
|
+
} else if (value.startsWith("env:")) {
|
|
56126
|
+
headerValue = env[value.slice("env:".length)];
|
|
56127
|
+
} else {
|
|
56128
|
+
headerValue = value;
|
|
56129
|
+
}
|
|
56130
|
+
return headerValue;
|
|
56131
|
+
}
|
|
56132
|
+
async pullHeaders() {
|
|
56133
|
+
const env = await this.getEnv();
|
|
56134
|
+
if (typeof this.schemaPollHeaders === "function") {
|
|
56135
|
+
return this.schemaPollHeaders(env);
|
|
56136
|
+
}
|
|
56137
|
+
const headers = Object.fromEntries(
|
|
56061
56138
|
Object.entries(this.schemaPollHeaders || {}).map(([key, value]) => {
|
|
56062
|
-
|
|
56063
|
-
if (typeof value === "function") {
|
|
56064
|
-
headerValue = value(process.env);
|
|
56065
|
-
} else if (value.startsWith("env:")) {
|
|
56066
|
-
headerValue = process.env[value.slice("env:".length)];
|
|
56067
|
-
} else {
|
|
56068
|
-
headerValue = value;
|
|
56069
|
-
}
|
|
56139
|
+
const headerValue = this.processEnvValues(env, value);
|
|
56070
56140
|
if (!headerValue) {
|
|
56071
56141
|
return [];
|
|
56072
56142
|
}
|
|
56073
56143
|
return [key, headerValue];
|
|
56074
|
-
})
|
|
56144
|
+
}).filter(([key]) => key)
|
|
56075
56145
|
);
|
|
56146
|
+
return headers;
|
|
56076
56147
|
}
|
|
56077
56148
|
async sourceFiles() {
|
|
56078
56149
|
return [
|
|
@@ -56498,6 +56569,16 @@ function definitionFromAncestors(ancestors) {
|
|
|
56498
56569
|
|
|
56499
56570
|
// src/lib/parse.ts
|
|
56500
56571
|
var import_parser = __toESM(require_lib3(), 1);
|
|
56572
|
+
async function parseJS(str) {
|
|
56573
|
+
return {
|
|
56574
|
+
start: 0,
|
|
56575
|
+
script: (0, import_parser.parse)(str || "", {
|
|
56576
|
+
plugins: ["typescript"],
|
|
56577
|
+
sourceType: "module"
|
|
56578
|
+
}).program,
|
|
56579
|
+
end: str.length
|
|
56580
|
+
};
|
|
56581
|
+
}
|
|
56501
56582
|
|
|
56502
56583
|
// src/lib/imports.ts
|
|
56503
56584
|
var recast = __toESM(require_main2(), 1);
|
|
@@ -56545,7 +56626,7 @@ async function cleanupFiles(pathFolder, listOfObj) {
|
|
|
56545
56626
|
}
|
|
56546
56627
|
|
|
56547
56628
|
// src/codegen/generators/artifacts/index.ts
|
|
56548
|
-
var
|
|
56629
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
56549
56630
|
var recast5 = __toESM(require_main2(), 1);
|
|
56550
56631
|
|
|
56551
56632
|
// src/codegen/utils/commonjs.ts
|
|
@@ -56962,7 +57043,7 @@ function deepMerge(filepath, ...targets) {
|
|
|
56962
57043
|
Object.entries(fields).map(([key, value]) => [key, deepMerge(filepath, ...value)])
|
|
56963
57044
|
);
|
|
56964
57045
|
}
|
|
56965
|
-
function convertValue(val) {
|
|
57046
|
+
function convertValue(config2, val) {
|
|
56966
57047
|
let value;
|
|
56967
57048
|
let kind;
|
|
56968
57049
|
if (val.kind === graphql5.Kind.INT) {
|
|
@@ -57094,7 +57175,7 @@ function operationObject({
|
|
|
57094
57175
|
operationWhen[i ? "must_not" : "must"] = arg.value.fields.reduce(
|
|
57095
57176
|
(obj, arg2) => ({
|
|
57096
57177
|
...obj,
|
|
57097
|
-
[arg2.name.value]: convertValue(arg2.value).value
|
|
57178
|
+
[arg2.name.value]: convertValue(config2, arg2.value).value
|
|
57098
57179
|
}),
|
|
57099
57180
|
{}
|
|
57100
57181
|
);
|
|
@@ -57110,7 +57191,7 @@ function operationObject({
|
|
|
57110
57191
|
operationWhen[which] = directive.arguments?.reduce(
|
|
57111
57192
|
(filters, argument) => ({
|
|
57112
57193
|
...filters,
|
|
57113
|
-
[argument.name.value]: convertValue(argument.value).value
|
|
57194
|
+
[argument.name.value]: convertValue(config2, argument.value).value
|
|
57114
57195
|
}),
|
|
57115
57196
|
{}
|
|
57116
57197
|
);
|
|
@@ -57149,7 +57230,7 @@ function ancestorKey(ancestors) {
|
|
|
57149
57230
|
}
|
|
57150
57231
|
|
|
57151
57232
|
// src/codegen/generators/artifacts/selection.ts
|
|
57152
|
-
var
|
|
57233
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
57153
57234
|
|
|
57154
57235
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
57155
57236
|
var config = {
|
|
@@ -57189,10 +57270,24 @@ function logYellow(str) {
|
|
|
57189
57270
|
}
|
|
57190
57271
|
|
|
57191
57272
|
// src/codegen/transforms/list.ts
|
|
57192
|
-
var
|
|
57273
|
+
var graphql9 = __toESM(require_graphql2(), 1);
|
|
57193
57274
|
|
|
57194
|
-
// src/codegen/
|
|
57275
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
57195
57276
|
var graphql7 = __toESM(require_graphql2(), 1);
|
|
57277
|
+
var objectIdentificationSelection = (config2, type) => {
|
|
57278
|
+
return config2.keyFieldsForType(type.name).map((key) => {
|
|
57279
|
+
return {
|
|
57280
|
+
kind: graphql7.Kind.FIELD,
|
|
57281
|
+
name: {
|
|
57282
|
+
kind: graphql7.Kind.NAME,
|
|
57283
|
+
value: key
|
|
57284
|
+
}
|
|
57285
|
+
};
|
|
57286
|
+
});
|
|
57287
|
+
};
|
|
57288
|
+
|
|
57289
|
+
// src/codegen/transforms/paginate.ts
|
|
57290
|
+
var graphql8 = __toESM(require_graphql2(), 1);
|
|
57196
57291
|
async function paginate(config2, documents) {
|
|
57197
57292
|
const newDocs = [];
|
|
57198
57293
|
for (const doc of documents) {
|
|
@@ -57225,7 +57320,7 @@ async function paginate(config2, documents) {
|
|
|
57225
57320
|
};
|
|
57226
57321
|
let cursorType = "String";
|
|
57227
57322
|
let paginationPath = [];
|
|
57228
|
-
doc.document =
|
|
57323
|
+
doc.document = graphql8.visit(doc.document, {
|
|
57229
57324
|
Field(node, _, __, ___, ancestors) {
|
|
57230
57325
|
const paginateDirective = node.directives?.find(
|
|
57231
57326
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -57252,7 +57347,7 @@ async function paginate(config2, documents) {
|
|
|
57252
57347
|
flags.offset.enabled = offsetPagination;
|
|
57253
57348
|
flags.limit.enabled = offsetPagination;
|
|
57254
57349
|
paginationPath = ancestors.filter(
|
|
57255
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
57350
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql8.Kind.FIELD
|
|
57256
57351
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
57257
57352
|
return {
|
|
57258
57353
|
...node,
|
|
@@ -57273,7 +57368,7 @@ async function paginate(config2, documents) {
|
|
|
57273
57368
|
refetchUpdate = "prepend" /* prepend */;
|
|
57274
57369
|
}
|
|
57275
57370
|
let fragment = "";
|
|
57276
|
-
doc.document =
|
|
57371
|
+
doc.document = graphql8.visit(doc.document, {
|
|
57277
57372
|
OperationDefinition(node) {
|
|
57278
57373
|
if (node.operation !== "query") {
|
|
57279
57374
|
throw new HoudiniError({
|
|
@@ -57327,9 +57422,9 @@ async function paginate(config2, documents) {
|
|
|
57327
57422
|
directives: [
|
|
57328
57423
|
...node.directives || [],
|
|
57329
57424
|
{
|
|
57330
|
-
kind:
|
|
57425
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57331
57426
|
name: {
|
|
57332
|
-
kind:
|
|
57427
|
+
kind: graphql8.Kind.NAME,
|
|
57333
57428
|
value: config2.argumentsDirective
|
|
57334
57429
|
}
|
|
57335
57430
|
}
|
|
@@ -57392,16 +57487,16 @@ async function paginate(config2, documents) {
|
|
|
57392
57487
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
57393
57488
|
const fragmentSpreadSelection = [
|
|
57394
57489
|
{
|
|
57395
|
-
kind:
|
|
57490
|
+
kind: graphql8.Kind.FRAGMENT_SPREAD,
|
|
57396
57491
|
name: {
|
|
57397
|
-
kind:
|
|
57492
|
+
kind: graphql8.Kind.NAME,
|
|
57398
57493
|
value: fragmentName
|
|
57399
57494
|
},
|
|
57400
57495
|
directives: [
|
|
57401
57496
|
{
|
|
57402
|
-
kind:
|
|
57497
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57403
57498
|
name: {
|
|
57404
|
-
kind:
|
|
57499
|
+
kind: graphql8.Kind.NAME,
|
|
57405
57500
|
value: config2.withDirective
|
|
57406
57501
|
},
|
|
57407
57502
|
["arguments"]: paginationArgs.map(
|
|
@@ -57429,29 +57524,29 @@ async function paginate(config2, documents) {
|
|
|
57429
57524
|
});
|
|
57430
57525
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
57431
57526
|
const queryDoc = {
|
|
57432
|
-
kind:
|
|
57527
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
57433
57528
|
definitions: [
|
|
57434
57529
|
{
|
|
57435
|
-
kind:
|
|
57530
|
+
kind: graphql8.Kind.OPERATION_DEFINITION,
|
|
57436
57531
|
name: {
|
|
57437
|
-
kind:
|
|
57532
|
+
kind: graphql8.Kind.NAME,
|
|
57438
57533
|
value: refetchQueryName
|
|
57439
57534
|
},
|
|
57440
57535
|
operation: "query",
|
|
57441
57536
|
variableDefinitions: paginationArgs.map(
|
|
57442
57537
|
(arg) => ({
|
|
57443
|
-
kind:
|
|
57538
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57444
57539
|
type: {
|
|
57445
|
-
kind:
|
|
57540
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57446
57541
|
name: {
|
|
57447
|
-
kind:
|
|
57542
|
+
kind: graphql8.Kind.NAME,
|
|
57448
57543
|
value: arg.type
|
|
57449
57544
|
}
|
|
57450
57545
|
},
|
|
57451
57546
|
variable: {
|
|
57452
|
-
kind:
|
|
57547
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57453
57548
|
name: {
|
|
57454
|
-
kind:
|
|
57549
|
+
kind: graphql8.Kind.NAME,
|
|
57455
57550
|
value: arg.name
|
|
57456
57551
|
}
|
|
57457
57552
|
},
|
|
@@ -57463,12 +57558,12 @@ async function paginate(config2, documents) {
|
|
|
57463
57558
|
).concat(
|
|
57464
57559
|
!nodeQuery ? [] : keys.map(
|
|
57465
57560
|
(key) => ({
|
|
57466
|
-
kind:
|
|
57561
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57467
57562
|
type: key.type,
|
|
57468
57563
|
variable: {
|
|
57469
|
-
kind:
|
|
57564
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57470
57565
|
name: {
|
|
57471
|
-
kind:
|
|
57566
|
+
kind: graphql8.Kind.NAME,
|
|
57472
57567
|
value: key.name
|
|
57473
57568
|
}
|
|
57474
57569
|
}
|
|
@@ -57476,42 +57571,42 @@ async function paginate(config2, documents) {
|
|
|
57476
57571
|
)
|
|
57477
57572
|
),
|
|
57478
57573
|
selectionSet: {
|
|
57479
|
-
kind:
|
|
57574
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57480
57575
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
57481
57576
|
{
|
|
57482
|
-
kind:
|
|
57577
|
+
kind: graphql8.Kind.FIELD,
|
|
57483
57578
|
name: {
|
|
57484
|
-
kind:
|
|
57579
|
+
kind: graphql8.Kind.NAME,
|
|
57485
57580
|
value: typeConfig?.resolve?.queryField || "node"
|
|
57486
57581
|
},
|
|
57487
57582
|
["arguments"]: keys.map((key) => ({
|
|
57488
|
-
kind:
|
|
57583
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57489
57584
|
name: {
|
|
57490
|
-
kind:
|
|
57585
|
+
kind: graphql8.Kind.NAME,
|
|
57491
57586
|
value: key.name
|
|
57492
57587
|
},
|
|
57493
57588
|
value: {
|
|
57494
|
-
kind:
|
|
57589
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57495
57590
|
name: {
|
|
57496
|
-
kind:
|
|
57591
|
+
kind: graphql8.Kind.NAME,
|
|
57497
57592
|
value: key.name
|
|
57498
57593
|
}
|
|
57499
57594
|
}
|
|
57500
57595
|
})),
|
|
57501
57596
|
selectionSet: {
|
|
57502
|
-
kind:
|
|
57597
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57503
57598
|
selections: [
|
|
57504
57599
|
{
|
|
57505
|
-
kind:
|
|
57600
|
+
kind: graphql8.Kind.FIELD,
|
|
57506
57601
|
name: {
|
|
57507
|
-
kind:
|
|
57602
|
+
kind: graphql8.Kind.NAME,
|
|
57508
57603
|
value: "__typename"
|
|
57509
57604
|
}
|
|
57510
57605
|
},
|
|
57511
57606
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
57512
|
-
kind:
|
|
57607
|
+
kind: graphql8.Kind.FIELD,
|
|
57513
57608
|
name: {
|
|
57514
|
-
kind:
|
|
57609
|
+
kind: graphql8.Kind.NAME,
|
|
57515
57610
|
value: key
|
|
57516
57611
|
}
|
|
57517
57612
|
})),
|
|
@@ -57573,15 +57668,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
57573
57668
|
}
|
|
57574
57669
|
function variableAsArgument(name2, variable) {
|
|
57575
57670
|
return {
|
|
57576
|
-
kind:
|
|
57671
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57577
57672
|
name: {
|
|
57578
|
-
kind:
|
|
57673
|
+
kind: graphql8.Kind.NAME,
|
|
57579
57674
|
value: name2
|
|
57580
57675
|
},
|
|
57581
57676
|
value: {
|
|
57582
|
-
kind:
|
|
57677
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57583
57678
|
name: {
|
|
57584
|
-
kind:
|
|
57679
|
+
kind: graphql8.Kind.NAME,
|
|
57585
57680
|
value: variable ?? name2
|
|
57586
57681
|
}
|
|
57587
57682
|
}
|
|
@@ -57589,18 +57684,18 @@ function variableAsArgument(name2, variable) {
|
|
|
57589
57684
|
}
|
|
57590
57685
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
57591
57686
|
return {
|
|
57592
|
-
kind:
|
|
57687
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57593
57688
|
type: {
|
|
57594
|
-
kind:
|
|
57689
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57595
57690
|
name: {
|
|
57596
|
-
kind:
|
|
57691
|
+
kind: graphql8.Kind.NAME,
|
|
57597
57692
|
value: type
|
|
57598
57693
|
}
|
|
57599
57694
|
},
|
|
57600
57695
|
variable: {
|
|
57601
|
-
kind:
|
|
57696
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57602
57697
|
name: {
|
|
57603
|
-
kind:
|
|
57698
|
+
kind: graphql8.Kind.NAME,
|
|
57604
57699
|
value: variableName ?? name2
|
|
57605
57700
|
}
|
|
57606
57701
|
},
|
|
@@ -57612,9 +57707,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
57612
57707
|
}
|
|
57613
57708
|
function argumentNode(name2, value) {
|
|
57614
57709
|
return {
|
|
57615
|
-
kind:
|
|
57710
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57616
57711
|
name: {
|
|
57617
|
-
kind:
|
|
57712
|
+
kind: graphql8.Kind.NAME,
|
|
57618
57713
|
value: name2
|
|
57619
57714
|
},
|
|
57620
57715
|
value: objectNode(value)
|
|
@@ -57622,16 +57717,16 @@ function argumentNode(name2, value) {
|
|
|
57622
57717
|
}
|
|
57623
57718
|
function objectNode([type, defaultValue]) {
|
|
57624
57719
|
const node = {
|
|
57625
|
-
kind:
|
|
57720
|
+
kind: graphql8.Kind.OBJECT,
|
|
57626
57721
|
fields: [
|
|
57627
57722
|
{
|
|
57628
|
-
kind:
|
|
57723
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57629
57724
|
name: {
|
|
57630
|
-
kind:
|
|
57725
|
+
kind: graphql8.Kind.NAME,
|
|
57631
57726
|
value: "type"
|
|
57632
57727
|
},
|
|
57633
57728
|
value: {
|
|
57634
|
-
kind:
|
|
57729
|
+
kind: graphql8.Kind.STRING,
|
|
57635
57730
|
value: type
|
|
57636
57731
|
}
|
|
57637
57732
|
}
|
|
@@ -57639,8 +57734,8 @@ function objectNode([type, defaultValue]) {
|
|
|
57639
57734
|
};
|
|
57640
57735
|
if (defaultValue) {
|
|
57641
57736
|
node.fields.push({
|
|
57642
|
-
kind:
|
|
57643
|
-
name: { kind:
|
|
57737
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57738
|
+
name: { kind: graphql8.Kind.NAME, value: "default" },
|
|
57644
57739
|
value: {
|
|
57645
57740
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
57646
57741
|
value: defaultValue.toString()
|
|
@@ -57651,34 +57746,34 @@ function objectNode([type, defaultValue]) {
|
|
|
57651
57746
|
}
|
|
57652
57747
|
var pageInfoSelection = [
|
|
57653
57748
|
{
|
|
57654
|
-
kind:
|
|
57749
|
+
kind: graphql8.Kind.FIELD,
|
|
57655
57750
|
name: {
|
|
57656
|
-
kind:
|
|
57751
|
+
kind: graphql8.Kind.NAME,
|
|
57657
57752
|
value: "edges"
|
|
57658
57753
|
},
|
|
57659
57754
|
selectionSet: {
|
|
57660
|
-
kind:
|
|
57755
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57661
57756
|
selections: [
|
|
57662
57757
|
{
|
|
57663
|
-
kind:
|
|
57758
|
+
kind: graphql8.Kind.FIELD,
|
|
57664
57759
|
name: {
|
|
57665
|
-
kind:
|
|
57760
|
+
kind: graphql8.Kind.NAME,
|
|
57666
57761
|
value: "cursor"
|
|
57667
57762
|
}
|
|
57668
57763
|
},
|
|
57669
57764
|
{
|
|
57670
|
-
kind:
|
|
57765
|
+
kind: graphql8.Kind.FIELD,
|
|
57671
57766
|
name: {
|
|
57672
|
-
kind:
|
|
57767
|
+
kind: graphql8.Kind.NAME,
|
|
57673
57768
|
value: "node"
|
|
57674
57769
|
},
|
|
57675
57770
|
selectionSet: {
|
|
57676
|
-
kind:
|
|
57771
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57677
57772
|
selections: [
|
|
57678
57773
|
{
|
|
57679
|
-
kind:
|
|
57774
|
+
kind: graphql8.Kind.FIELD,
|
|
57680
57775
|
name: {
|
|
57681
|
-
kind:
|
|
57776
|
+
kind: graphql8.Kind.NAME,
|
|
57682
57777
|
value: "__typename"
|
|
57683
57778
|
}
|
|
57684
57779
|
}
|
|
@@ -57689,39 +57784,39 @@ var pageInfoSelection = [
|
|
|
57689
57784
|
}
|
|
57690
57785
|
},
|
|
57691
57786
|
{
|
|
57692
|
-
kind:
|
|
57787
|
+
kind: graphql8.Kind.FIELD,
|
|
57693
57788
|
name: {
|
|
57694
|
-
kind:
|
|
57789
|
+
kind: graphql8.Kind.NAME,
|
|
57695
57790
|
value: "pageInfo"
|
|
57696
57791
|
},
|
|
57697
57792
|
selectionSet: {
|
|
57698
|
-
kind:
|
|
57793
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57699
57794
|
selections: [
|
|
57700
57795
|
{
|
|
57701
|
-
kind:
|
|
57796
|
+
kind: graphql8.Kind.FIELD,
|
|
57702
57797
|
name: {
|
|
57703
|
-
kind:
|
|
57798
|
+
kind: graphql8.Kind.NAME,
|
|
57704
57799
|
value: "hasPreviousPage"
|
|
57705
57800
|
}
|
|
57706
57801
|
},
|
|
57707
57802
|
{
|
|
57708
|
-
kind:
|
|
57803
|
+
kind: graphql8.Kind.FIELD,
|
|
57709
57804
|
name: {
|
|
57710
|
-
kind:
|
|
57805
|
+
kind: graphql8.Kind.NAME,
|
|
57711
57806
|
value: "hasNextPage"
|
|
57712
57807
|
}
|
|
57713
57808
|
},
|
|
57714
57809
|
{
|
|
57715
|
-
kind:
|
|
57810
|
+
kind: graphql8.Kind.FIELD,
|
|
57716
57811
|
name: {
|
|
57717
|
-
kind:
|
|
57812
|
+
kind: graphql8.Kind.NAME,
|
|
57718
57813
|
value: "startCursor"
|
|
57719
57814
|
}
|
|
57720
57815
|
},
|
|
57721
57816
|
{
|
|
57722
|
-
kind:
|
|
57817
|
+
kind: graphql8.Kind.FIELD,
|
|
57723
57818
|
name: {
|
|
57724
|
-
kind:
|
|
57819
|
+
kind: graphql8.Kind.NAME,
|
|
57725
57820
|
value: "endCursor"
|
|
57726
57821
|
}
|
|
57727
57822
|
}
|
|
@@ -57735,15 +57830,15 @@ async function addListFragments(config2, documents) {
|
|
|
57735
57830
|
const lists = {};
|
|
57736
57831
|
const errors = [];
|
|
57737
57832
|
for (const doc of documents) {
|
|
57738
|
-
doc.document =
|
|
57833
|
+
doc.document = graphql9.visit(doc.document, {
|
|
57739
57834
|
Directive(node, key, parent, path2, ancestors) {
|
|
57740
57835
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
57741
57836
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
57742
57837
|
let error = {
|
|
57743
|
-
...new
|
|
57838
|
+
...new graphql9.GraphQLError(
|
|
57744
57839
|
"",
|
|
57745
57840
|
node,
|
|
57746
|
-
new
|
|
57841
|
+
new graphql9.Source(""),
|
|
57747
57842
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
57748
57843
|
path2
|
|
57749
57844
|
),
|
|
@@ -57795,7 +57890,7 @@ async function addListFragments(config2, documents) {
|
|
|
57795
57890
|
{
|
|
57796
57891
|
kind: "Argument",
|
|
57797
57892
|
name: {
|
|
57798
|
-
kind:
|
|
57893
|
+
kind: graphql9.Kind.NAME,
|
|
57799
57894
|
value: "connection"
|
|
57800
57895
|
},
|
|
57801
57896
|
value: {
|
|
@@ -57842,10 +57937,13 @@ async function addListFragments(config2, documents) {
|
|
|
57842
57937
|
if (errors.length > 0) {
|
|
57843
57938
|
throw errors;
|
|
57844
57939
|
}
|
|
57845
|
-
const
|
|
57940
|
+
const validDeletes = [
|
|
57846
57941
|
...new Set(
|
|
57847
57942
|
Object.values(lists).map(({ type }) => {
|
|
57848
|
-
if (!(type instanceof
|
|
57943
|
+
if (!(type instanceof graphql9.GraphQLObjectType)) {
|
|
57944
|
+
return "";
|
|
57945
|
+
}
|
|
57946
|
+
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
57849
57947
|
return "";
|
|
57850
57948
|
}
|
|
57851
57949
|
return type.name;
|
|
@@ -57856,7 +57954,7 @@ async function addListFragments(config2, documents) {
|
|
|
57856
57954
|
return;
|
|
57857
57955
|
}
|
|
57858
57956
|
const generatedDoc = {
|
|
57859
|
-
kind:
|
|
57957
|
+
kind: graphql9.Kind.DOCUMENT,
|
|
57860
57958
|
definitions: Object.entries(lists).flatMap(
|
|
57861
57959
|
([name2, { selection: selection2, type }]) => {
|
|
57862
57960
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -57864,35 +57962,29 @@ async function addListFragments(config2, documents) {
|
|
|
57864
57962
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
57865
57963
|
}
|
|
57866
57964
|
const fragmentSelection = {
|
|
57867
|
-
kind:
|
|
57965
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57868
57966
|
selections: [...selection2.selections]
|
|
57869
57967
|
};
|
|
57870
57968
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
57871
|
-
(field) => field.kind === "Field" && field.name.value
|
|
57969
|
+
(field) => field.kind === "Field" && config2.keyFieldsForType(type.name).includes(field.name.value)
|
|
57872
57970
|
)) {
|
|
57873
57971
|
fragmentSelection.selections = [
|
|
57874
57972
|
...fragmentSelection.selections,
|
|
57875
|
-
|
|
57876
|
-
kind: graphql8.Kind.FIELD,
|
|
57877
|
-
name: {
|
|
57878
|
-
kind: graphql8.Kind.NAME,
|
|
57879
|
-
value: "id"
|
|
57880
|
-
}
|
|
57881
|
-
}
|
|
57973
|
+
...objectIdentificationSelection(config2, type)
|
|
57882
57974
|
];
|
|
57883
57975
|
}
|
|
57884
57976
|
return [
|
|
57885
57977
|
{
|
|
57886
57978
|
name: {
|
|
57887
57979
|
value: config2.listInsertFragment(name2),
|
|
57888
|
-
kind:
|
|
57980
|
+
kind: graphql9.Kind.NAME
|
|
57889
57981
|
},
|
|
57890
|
-
kind:
|
|
57982
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57891
57983
|
selectionSet: fragmentSelection,
|
|
57892
57984
|
typeCondition: {
|
|
57893
|
-
kind:
|
|
57985
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57894
57986
|
name: {
|
|
57895
|
-
kind:
|
|
57987
|
+
kind: graphql9.Kind.NAME,
|
|
57896
57988
|
value: type.name
|
|
57897
57989
|
}
|
|
57898
57990
|
}
|
|
@@ -57900,52 +57992,32 @@ async function addListFragments(config2, documents) {
|
|
|
57900
57992
|
{
|
|
57901
57993
|
name: {
|
|
57902
57994
|
value: config2.listToggleFragment(name2),
|
|
57903
|
-
kind:
|
|
57904
|
-
},
|
|
57905
|
-
kind: graphql8.Kind.FRAGMENT_DEFINITION,
|
|
57906
|
-
selectionSet: {
|
|
57907
|
-
...fragmentSelection,
|
|
57908
|
-
selections: [
|
|
57909
|
-
...fragmentSelection.selections,
|
|
57910
|
-
{
|
|
57911
|
-
kind: graphql8.Kind.FIELD,
|
|
57912
|
-
name: {
|
|
57913
|
-
kind: graphql8.Kind.NAME,
|
|
57914
|
-
value: "id"
|
|
57915
|
-
}
|
|
57916
|
-
}
|
|
57917
|
-
]
|
|
57995
|
+
kind: graphql9.Kind.NAME
|
|
57918
57996
|
},
|
|
57997
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57998
|
+
selectionSet: fragmentSelection,
|
|
57919
57999
|
typeCondition: {
|
|
57920
|
-
kind:
|
|
58000
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57921
58001
|
name: {
|
|
57922
|
-
kind:
|
|
58002
|
+
kind: graphql9.Kind.NAME,
|
|
57923
58003
|
value: type.name
|
|
57924
58004
|
}
|
|
57925
58005
|
}
|
|
57926
58006
|
},
|
|
57927
58007
|
{
|
|
57928
|
-
kind:
|
|
58008
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57929
58009
|
name: {
|
|
57930
58010
|
value: config2.listRemoveFragment(name2),
|
|
57931
|
-
kind:
|
|
58011
|
+
kind: graphql9.Kind.NAME
|
|
57932
58012
|
},
|
|
57933
58013
|
selectionSet: {
|
|
57934
|
-
kind:
|
|
57935
|
-
selections: [
|
|
57936
|
-
{
|
|
57937
|
-
kind: graphql8.Kind.FIELD,
|
|
57938
|
-
name: {
|
|
57939
|
-
kind: graphql8.Kind.NAME,
|
|
57940
|
-
value: "id"
|
|
57941
|
-
}
|
|
57942
|
-
}
|
|
57943
|
-
]
|
|
58014
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
58015
|
+
selections: [...objectIdentificationSelection(config2, type)]
|
|
57944
58016
|
},
|
|
57945
58017
|
typeCondition: {
|
|
57946
|
-
kind:
|
|
58018
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57947
58019
|
name: {
|
|
57948
|
-
kind:
|
|
58020
|
+
kind: graphql9.Kind.NAME,
|
|
57949
58021
|
value: type.name
|
|
57950
58022
|
}
|
|
57951
58023
|
}
|
|
@@ -57953,15 +58025,15 @@ async function addListFragments(config2, documents) {
|
|
|
57953
58025
|
];
|
|
57954
58026
|
}
|
|
57955
58027
|
).concat(
|
|
57956
|
-
...
|
|
57957
|
-
kind:
|
|
58028
|
+
...validDeletes.map((typeName) => ({
|
|
58029
|
+
kind: graphql9.Kind.DIRECTIVE_DEFINITION,
|
|
57958
58030
|
name: {
|
|
57959
|
-
kind:
|
|
58031
|
+
kind: graphql9.Kind.NAME,
|
|
57960
58032
|
value: config2.listDeleteDirective(typeName)
|
|
57961
58033
|
},
|
|
57962
58034
|
locations: [
|
|
57963
58035
|
{
|
|
57964
|
-
kind:
|
|
58036
|
+
kind: graphql9.Kind.NAME,
|
|
57965
58037
|
value: "FIELD"
|
|
57966
58038
|
}
|
|
57967
58039
|
],
|
|
@@ -57969,8 +58041,8 @@ async function addListFragments(config2, documents) {
|
|
|
57969
58041
|
}))
|
|
57970
58042
|
)
|
|
57971
58043
|
};
|
|
57972
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
57973
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
58044
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
58045
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57974
58046
|
documents.push({
|
|
57975
58047
|
name: "generated::lists",
|
|
57976
58048
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -58055,11 +58127,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
58055
58127
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
58056
58128
|
|
|
58057
58129
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
58058
|
-
var
|
|
58130
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
58059
58131
|
function fieldKey(config2, field) {
|
|
58060
58132
|
const attributeName = field.alias?.value || field.name.value;
|
|
58061
|
-
const printed =
|
|
58062
|
-
const secondParse =
|
|
58133
|
+
const printed = graphql10.print(field);
|
|
58134
|
+
const secondParse = graphql10.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
58063
58135
|
const paginated = !!field.directives?.find(
|
|
58064
58136
|
(directive) => directive.name.value === config2.paginateDirective
|
|
58065
58137
|
);
|
|
@@ -58078,7 +58150,9 @@ function fieldKey(config2, field) {
|
|
|
58078
58150
|
[arg.name.value]: printed.substring(start - 1, end - 1)
|
|
58079
58151
|
};
|
|
58080
58152
|
}, {});
|
|
58081
|
-
|
|
58153
|
+
const args = Object.keys(argObj);
|
|
58154
|
+
args.sort();
|
|
58155
|
+
let key = Object.values(argObj).length > 0 ? `${attributeName}(${args.map((key2) => `${key2}: ${argObj[key2]}`).join(", ")})` : attributeName;
|
|
58082
58156
|
if (paginated) {
|
|
58083
58157
|
key = key + "::paginated";
|
|
58084
58158
|
}
|
|
@@ -58152,8 +58226,8 @@ function selection({
|
|
|
58152
58226
|
const typeConditionName = field.typeCondition.name.value;
|
|
58153
58227
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
58154
58228
|
const possibleTypes = [];
|
|
58155
|
-
if (!
|
|
58156
|
-
} else if (
|
|
58229
|
+
if (!graphql11.isAbstractType(typeCondition)) {
|
|
58230
|
+
} else if (graphql11.isAbstractType(parentType)) {
|
|
58157
58231
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
58158
58232
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
58159
58233
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -58201,7 +58275,7 @@ function selection({
|
|
|
58201
58275
|
} else {
|
|
58202
58276
|
let typeRef = type.getFields()[field.name.value].type;
|
|
58203
58277
|
fieldType = getRootType(typeRef);
|
|
58204
|
-
nullable = !
|
|
58278
|
+
nullable = !graphql11.isNonNullType(typeRef);
|
|
58205
58279
|
}
|
|
58206
58280
|
const typeName = fieldType.toString();
|
|
58207
58281
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -58261,12 +58335,12 @@ function selection({
|
|
|
58261
58335
|
fieldObj.filters = (field.arguments || []).reduce(
|
|
58262
58336
|
(filters, arg) => ({
|
|
58263
58337
|
...filters,
|
|
58264
|
-
[arg.name.value]: convertValue(arg.value)
|
|
58338
|
+
[arg.name.value]: convertValue(config2, arg.value)
|
|
58265
58339
|
}),
|
|
58266
58340
|
{}
|
|
58267
58341
|
);
|
|
58268
58342
|
}
|
|
58269
|
-
if (
|
|
58343
|
+
if (graphql11.isInterfaceType(fieldType) || graphql11.isUnionType(fieldType)) {
|
|
58270
58344
|
fieldObj.abstract = true;
|
|
58271
58345
|
}
|
|
58272
58346
|
object.fields = {
|
|
@@ -58323,7 +58397,7 @@ function artifactGenerator(stats) {
|
|
|
58323
58397
|
return async function(config2, docs) {
|
|
58324
58398
|
const filterTypes = {};
|
|
58325
58399
|
for (const doc of docs) {
|
|
58326
|
-
|
|
58400
|
+
graphql12.visit(doc.document, {
|
|
58327
58401
|
Directive(node, _, __, ___, ancestors) {
|
|
58328
58402
|
if (node.name.value !== config2.listDirective) {
|
|
58329
58403
|
return;
|
|
@@ -58382,7 +58456,7 @@ function artifactGenerator(stats) {
|
|
|
58382
58456
|
return;
|
|
58383
58457
|
}
|
|
58384
58458
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
58385
|
-
let documentWithoutInternalDirectives =
|
|
58459
|
+
let documentWithoutInternalDirectives = graphql12.visit(document, {
|
|
58386
58460
|
Directive(node) {
|
|
58387
58461
|
if (config2.isInternalDirective(node)) {
|
|
58388
58462
|
return null;
|
|
@@ -58395,7 +58469,7 @@ function artifactGenerator(stats) {
|
|
|
58395
58469
|
}
|
|
58396
58470
|
}
|
|
58397
58471
|
});
|
|
58398
|
-
let documentWithoutExtraVariables =
|
|
58472
|
+
let documentWithoutExtraVariables = graphql12.visit(
|
|
58399
58473
|
documentWithoutInternalDirectives,
|
|
58400
58474
|
{
|
|
58401
58475
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -58406,13 +58480,13 @@ function artifactGenerator(stats) {
|
|
|
58406
58480
|
}
|
|
58407
58481
|
}
|
|
58408
58482
|
);
|
|
58409
|
-
let rawString =
|
|
58483
|
+
let rawString = graphql12.print(documentWithoutExtraVariables);
|
|
58410
58484
|
let docKind = doc.kind;
|
|
58411
58485
|
const operations = document.definitions.filter(
|
|
58412
|
-
({ kind }) => kind ===
|
|
58486
|
+
({ kind }) => kind === graphql12.Kind.OPERATION_DEFINITION
|
|
58413
58487
|
);
|
|
58414
58488
|
const fragments = document.definitions.filter(
|
|
58415
|
-
({ kind }) => kind ===
|
|
58489
|
+
({ kind }) => kind === graphql12.Kind.FRAGMENT_DEFINITION
|
|
58416
58490
|
);
|
|
58417
58491
|
let rootType = "";
|
|
58418
58492
|
let selectionSet;
|
|
@@ -58548,7 +58622,9 @@ function artifactGenerator(stats) {
|
|
|
58548
58622
|
}
|
|
58549
58623
|
|
|
58550
58624
|
// src/codegen/generators/runtime/index.ts
|
|
58551
|
-
|
|
58625
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
58626
|
+
var AST6 = recast6.types.builders;
|
|
58627
|
+
async function runtimeGenerator(config2, docs) {
|
|
58552
58628
|
await Promise.all([
|
|
58553
58629
|
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
58554
58630
|
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
@@ -58562,6 +58638,59 @@ async function runtimeGenerator(config2) {
|
|
|
58562
58638
|
}),
|
|
58563
58639
|
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
58564
58640
|
]);
|
|
58641
|
+
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
58642
|
+
const contents = await parseJS(await fs_exports.readFile(indexPath) || "");
|
|
58643
|
+
const graphql_tag_return = config2.plugins.find(
|
|
58644
|
+
(plugin) => plugin.graphql_tag_return
|
|
58645
|
+
)?.graphql_tag_return;
|
|
58646
|
+
if (graphql_tag_return && contents) {
|
|
58647
|
+
const overloaded_returns = {};
|
|
58648
|
+
for (const doc of docs) {
|
|
58649
|
+
const return_value = graphql_tag_return({
|
|
58650
|
+
config: config2,
|
|
58651
|
+
doc,
|
|
58652
|
+
ensure_import({ identifier, module }) {
|
|
58653
|
+
ensureImports({
|
|
58654
|
+
config: config2,
|
|
58655
|
+
body: contents.script.body,
|
|
58656
|
+
sourceModule: module,
|
|
58657
|
+
import: [identifier]
|
|
58658
|
+
});
|
|
58659
|
+
}
|
|
58660
|
+
});
|
|
58661
|
+
if (return_value) {
|
|
58662
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
58663
|
+
}
|
|
58664
|
+
}
|
|
58665
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
58666
|
+
for (const [i, expression] of (contents?.script.body ?? []).entries()) {
|
|
58667
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
58668
|
+
continue;
|
|
58669
|
+
}
|
|
58670
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
58671
|
+
const input = AST6.identifier("str");
|
|
58672
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
58673
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
58674
|
+
);
|
|
58675
|
+
contents?.script.body.splice(
|
|
58676
|
+
i,
|
|
58677
|
+
0,
|
|
58678
|
+
AST6.exportNamedDeclaration(
|
|
58679
|
+
AST6.tsDeclareFunction(
|
|
58680
|
+
AST6.identifier("graphql"),
|
|
58681
|
+
[input],
|
|
58682
|
+
AST6.tsTypeAnnotation(
|
|
58683
|
+
AST6.tsTypeReference(AST6.identifier(returnValue))
|
|
58684
|
+
)
|
|
58685
|
+
)
|
|
58686
|
+
)
|
|
58687
|
+
);
|
|
58688
|
+
}
|
|
58689
|
+
break;
|
|
58690
|
+
}
|
|
58691
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
58692
|
+
}
|
|
58693
|
+
}
|
|
58565
58694
|
}
|
|
58566
58695
|
async function generatePluginRuntime(config2, plugin) {
|
|
58567
58696
|
if (houdini_mode.is_testing) {
|
|
@@ -58596,20 +58725,20 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
58596
58725
|
}
|
|
58597
58726
|
|
|
58598
58727
|
// src/codegen/generators/typescript/index.ts
|
|
58599
|
-
var
|
|
58728
|
+
var recast12 = __toESM(require_main2(), 1);
|
|
58600
58729
|
|
|
58601
58730
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58731
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
58732
|
+
var recast9 = __toESM(require_main2(), 1);
|
|
58733
|
+
|
|
58734
|
+
// src/codegen/generators/typescript/typeReference.ts
|
|
58602
58735
|
var graphql14 = __toESM(require_graphql2(), 1);
|
|
58603
58736
|
var recast8 = __toESM(require_main2(), 1);
|
|
58604
58737
|
|
|
58605
|
-
// src/codegen/generators/typescript/
|
|
58738
|
+
// src/codegen/generators/typescript/types.ts
|
|
58606
58739
|
var graphql13 = __toESM(require_graphql2(), 1);
|
|
58607
58740
|
var recast7 = __toESM(require_main2(), 1);
|
|
58608
|
-
|
|
58609
|
-
// src/codegen/generators/typescript/types.ts
|
|
58610
|
-
var graphql12 = __toESM(require_graphql2(), 1);
|
|
58611
|
-
var recast6 = __toESM(require_main2(), 1);
|
|
58612
|
-
var AST6 = recast6.types.builders;
|
|
58741
|
+
var AST7 = recast7.types.builders;
|
|
58613
58742
|
function readonlyProperty(prop, enable = true) {
|
|
58614
58743
|
if (enable) {
|
|
58615
58744
|
prop.readonly = true;
|
|
@@ -58617,31 +58746,31 @@ function readonlyProperty(prop, enable = true) {
|
|
|
58617
58746
|
return prop;
|
|
58618
58747
|
}
|
|
58619
58748
|
function nullableField(inner, input = false) {
|
|
58620
|
-
const members = [inner,
|
|
58749
|
+
const members = [inner, AST7.tsNullKeyword()];
|
|
58621
58750
|
if (input) {
|
|
58622
|
-
members.push(
|
|
58751
|
+
members.push(AST7.tsUndefinedKeyword());
|
|
58623
58752
|
}
|
|
58624
|
-
return
|
|
58753
|
+
return AST7.tsUnionType(members);
|
|
58625
58754
|
}
|
|
58626
58755
|
function scalarPropertyValue(config2, missingScalars, target) {
|
|
58627
58756
|
switch (target.name) {
|
|
58628
58757
|
case "String": {
|
|
58629
|
-
return
|
|
58758
|
+
return AST7.tsStringKeyword();
|
|
58630
58759
|
}
|
|
58631
58760
|
case "Int": {
|
|
58632
|
-
return
|
|
58761
|
+
return AST7.tsNumberKeyword();
|
|
58633
58762
|
}
|
|
58634
58763
|
case "Float": {
|
|
58635
|
-
return
|
|
58764
|
+
return AST7.tsNumberKeyword();
|
|
58636
58765
|
}
|
|
58637
58766
|
case "Boolean": {
|
|
58638
|
-
return
|
|
58767
|
+
return AST7.tsBooleanKeyword();
|
|
58639
58768
|
}
|
|
58640
58769
|
case "ID": {
|
|
58641
|
-
return
|
|
58770
|
+
return AST7.tsStringKeyword();
|
|
58642
58771
|
}
|
|
58643
58772
|
default: {
|
|
58644
|
-
if (
|
|
58773
|
+
if (graphql13.isNonNullType(target) && "ofType" in target) {
|
|
58645
58774
|
return scalarPropertyValue(
|
|
58646
58775
|
config2,
|
|
58647
58776
|
missingScalars,
|
|
@@ -58649,23 +58778,23 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
58649
58778
|
);
|
|
58650
58779
|
}
|
|
58651
58780
|
if (config2.scalars?.[target.name]) {
|
|
58652
|
-
return
|
|
58781
|
+
return AST7.tsTypeReference(AST7.identifier(config2.scalars?.[target.name].type));
|
|
58653
58782
|
}
|
|
58654
58783
|
missingScalars.add(target.name);
|
|
58655
|
-
return
|
|
58784
|
+
return AST7.tsAnyKeyword();
|
|
58656
58785
|
}
|
|
58657
58786
|
}
|
|
58658
58787
|
}
|
|
58659
58788
|
|
|
58660
58789
|
// src/codegen/generators/typescript/typeReference.ts
|
|
58661
|
-
var
|
|
58790
|
+
var AST8 = recast8.types.builders;
|
|
58662
58791
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
58663
58792
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
58664
58793
|
let result;
|
|
58665
|
-
if (
|
|
58794
|
+
if (graphql14.isScalarType(type)) {
|
|
58666
58795
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58667
58796
|
} else {
|
|
58668
|
-
result =
|
|
58797
|
+
result = AST8.tsTypeReference(AST8.identifier(type.name));
|
|
58669
58798
|
}
|
|
58670
58799
|
for (const toWrap of wrappers) {
|
|
58671
58800
|
if (toWrap === "NonNull" /* NonNull */) {
|
|
@@ -58673,27 +58802,27 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
58673
58802
|
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
58674
58803
|
result = nullableField(result, true);
|
|
58675
58804
|
} else if (toWrap === "List" /* List */) {
|
|
58676
|
-
result =
|
|
58805
|
+
result = AST8.tsArrayType(AST8.tsParenthesizedType(result));
|
|
58677
58806
|
}
|
|
58678
58807
|
}
|
|
58679
58808
|
return result;
|
|
58680
58809
|
}
|
|
58681
58810
|
|
|
58682
58811
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58683
|
-
var
|
|
58812
|
+
var AST9 = recast9.types.builders;
|
|
58684
58813
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
58685
58814
|
const { type } = unwrapType(config2, rootType);
|
|
58686
|
-
if (
|
|
58815
|
+
if (graphql15.isScalarType(type)) {
|
|
58687
58816
|
return;
|
|
58688
58817
|
}
|
|
58689
58818
|
if (visitedTypes.has(type.name)) {
|
|
58690
58819
|
return;
|
|
58691
58820
|
}
|
|
58692
|
-
if (
|
|
58821
|
+
if (graphql15.isUnionType(type)) {
|
|
58693
58822
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
58694
58823
|
}
|
|
58695
58824
|
visitedTypes.add(type.name);
|
|
58696
|
-
if (
|
|
58825
|
+
if (graphql15.isEnumType(type)) {
|
|
58697
58826
|
ensureImports({
|
|
58698
58827
|
config: config2,
|
|
58699
58828
|
body,
|
|
@@ -58707,20 +58836,267 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58707
58836
|
for (const field of Object.values(type.getFields())) {
|
|
58708
58837
|
addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, field.type);
|
|
58709
58838
|
members.push(
|
|
58710
|
-
|
|
58711
|
-
|
|
58712
|
-
|
|
58713
|
-
|
|
58839
|
+
AST9.tsPropertySignature(
|
|
58840
|
+
AST9.identifier(field.name),
|
|
58841
|
+
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
58842
|
+
graphql15.isNullableType(field.type)
|
|
58714
58843
|
)
|
|
58715
58844
|
);
|
|
58716
58845
|
}
|
|
58717
|
-
body.push(
|
|
58846
|
+
body.push(AST9.tsTypeAliasDeclaration(AST9.identifier(type.name), AST9.tsTypeLiteral(members)));
|
|
58847
|
+
}
|
|
58848
|
+
|
|
58849
|
+
// src/codegen/generators/typescript/imperativeCache.ts
|
|
58850
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
58851
|
+
var recast10 = __toESM(require_main2(), 1);
|
|
58852
|
+
var AST10 = recast10.types.builders;
|
|
58853
|
+
async function imperativeCacheTypef(config2, docs) {
|
|
58854
|
+
const target = path_exports.join(config2.runtimeDirectory, "generated.d.ts");
|
|
58855
|
+
const body = [];
|
|
58856
|
+
const declaration = AST10.tsTypeAliasDeclaration(
|
|
58857
|
+
AST10.identifier(CacheTypeDefName),
|
|
58858
|
+
AST10.tsTypeLiteral([
|
|
58859
|
+
AST10.tsPropertySignature(
|
|
58860
|
+
AST10.identifier("types"),
|
|
58861
|
+
AST10.tsTypeAnnotation(typeDefinitions(config2, body))
|
|
58862
|
+
),
|
|
58863
|
+
AST10.tsPropertySignature(
|
|
58864
|
+
AST10.identifier("lists"),
|
|
58865
|
+
AST10.tsTypeAnnotation(listDefinitions(config2, docs))
|
|
58866
|
+
)
|
|
58867
|
+
])
|
|
58868
|
+
);
|
|
58869
|
+
declaration.declare = true;
|
|
58870
|
+
const importRecord = AST10.importDeclaration(
|
|
58871
|
+
[AST10.importSpecifier(AST10.identifier("Record"))],
|
|
58872
|
+
AST10.stringLiteral("./public/record")
|
|
58873
|
+
);
|
|
58874
|
+
importRecord.importKind = "type";
|
|
58875
|
+
await fs_exports.writeFile(
|
|
58876
|
+
target,
|
|
58877
|
+
recast10.prettyPrint(
|
|
58878
|
+
AST10.program([importRecord, ...body, AST10.exportNamedDeclaration(declaration)])
|
|
58879
|
+
).code
|
|
58880
|
+
);
|
|
58881
|
+
}
|
|
58882
|
+
function typeDefinitions(config2, body) {
|
|
58883
|
+
const operationTypes = [config2.schema.getMutationType(), config2.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
58884
|
+
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58885
|
+
const types14 = Object.values(config2.schema.getTypeMap()).filter(
|
|
58886
|
+
(type) => !graphql16.isAbstractType(type) && !graphql16.isScalarType(type) && !graphql16.isEnumType(type) && !graphql16.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
58887
|
+
);
|
|
58888
|
+
return AST10.tsTypeLiteral(
|
|
58889
|
+
types14.map((type) => {
|
|
58890
|
+
let typeName = type.name;
|
|
58891
|
+
if (config2.schema.getQueryType() && config2.schema.getQueryType()?.name === type.name) {
|
|
58892
|
+
typeName = "__ROOT__";
|
|
58893
|
+
}
|
|
58894
|
+
let idFields = AST10.tsNeverKeyword();
|
|
58895
|
+
const keys = keyFieldsForType(config2.configFile, type.name);
|
|
58896
|
+
if (graphql16.isObjectType(type) && keys.length > 0 && keys.every((key) => type.getFields()[key])) {
|
|
58897
|
+
idFields = AST10.tsTypeLiteral(
|
|
58898
|
+
keys.map((key) => {
|
|
58899
|
+
const fieldType = type.getFields()[key];
|
|
58900
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
58901
|
+
return AST10.tsPropertySignature(
|
|
58902
|
+
AST10.identifier(key),
|
|
58903
|
+
AST10.tsTypeAnnotation(
|
|
58904
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
58905
|
+
)
|
|
58906
|
+
);
|
|
58907
|
+
})
|
|
58908
|
+
);
|
|
58909
|
+
} else if (typeName === "__ROOT__") {
|
|
58910
|
+
idFields = AST10.tsTypeLiteral([]);
|
|
58911
|
+
}
|
|
58912
|
+
let fields = AST10.tsTypeLiteral([]);
|
|
58913
|
+
if (graphql16.isObjectType(type)) {
|
|
58914
|
+
fields = AST10.tsTypeLiteral(
|
|
58915
|
+
Object.entries(type.getFields()).map(
|
|
58916
|
+
([key, fieldType]) => {
|
|
58917
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
58918
|
+
let typeOptions = AST10.tsUnionType([]);
|
|
58919
|
+
if (graphql16.isScalarType(unwrapped.type)) {
|
|
58920
|
+
typeOptions.types.push(
|
|
58921
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
58922
|
+
);
|
|
58923
|
+
} else if (graphql16.isEnumType(unwrapped.type)) {
|
|
58924
|
+
typeOptions.types.push(
|
|
58925
|
+
AST10.tsTypeReference(AST10.identifier(unwrapped.type.name))
|
|
58926
|
+
);
|
|
58927
|
+
} else if (!graphql16.isAbstractType(unwrapped.type)) {
|
|
58928
|
+
typeOptions.types.push(record(unwrapped.type.name));
|
|
58929
|
+
} else {
|
|
58930
|
+
typeOptions.types.push(
|
|
58931
|
+
...config2.schema.getPossibleTypes(unwrapped.type).map((type2) => record(type2.name))
|
|
58932
|
+
);
|
|
58933
|
+
}
|
|
58934
|
+
for (const wrapper of unwrapped.wrappers) {
|
|
58935
|
+
if (wrapper === "Nullable" /* Nullable */) {
|
|
58936
|
+
typeOptions = AST10.tsParenthesizedType(
|
|
58937
|
+
AST10.tsUnionType([typeOptions, AST10.tsNullKeyword()])
|
|
58938
|
+
);
|
|
58939
|
+
} else if (wrapper === "List" /* List */) {
|
|
58940
|
+
typeOptions = AST10.tsArrayType(
|
|
58941
|
+
AST10.tsParenthesizedType(typeOptions)
|
|
58942
|
+
);
|
|
58943
|
+
}
|
|
58944
|
+
}
|
|
58945
|
+
if (typeOptions.type === "TSParenthesizedType") {
|
|
58946
|
+
typeOptions = typeOptions.typeAnnotation;
|
|
58947
|
+
}
|
|
58948
|
+
let args = AST10.tsNeverKeyword();
|
|
58949
|
+
if (fieldType.args?.length > 0) {
|
|
58950
|
+
args = AST10.tsTypeLiteral(
|
|
58951
|
+
fieldType.args.map((arg) => {
|
|
58952
|
+
addReferencedInputTypes(
|
|
58953
|
+
config2,
|
|
58954
|
+
"",
|
|
58955
|
+
body,
|
|
58956
|
+
visitedTypes,
|
|
58957
|
+
/* @__PURE__ */ new Set(),
|
|
58958
|
+
arg.type
|
|
58959
|
+
);
|
|
58960
|
+
const prop = AST10.tsPropertySignature(
|
|
58961
|
+
AST10.identifier(arg.name),
|
|
58962
|
+
AST10.tsTypeAnnotation(
|
|
58963
|
+
tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
|
|
58964
|
+
)
|
|
58965
|
+
);
|
|
58966
|
+
const unwrapped2 = unwrapType(config2, arg.type);
|
|
58967
|
+
prop.optional = unwrapped2.wrappers[unwrapped2.wrappers.length - 1] === "Nullable" /* Nullable */;
|
|
58968
|
+
return prop;
|
|
58969
|
+
})
|
|
58970
|
+
);
|
|
58971
|
+
}
|
|
58972
|
+
return AST10.tsPropertySignature(
|
|
58973
|
+
AST10.identifier(key),
|
|
58974
|
+
AST10.tsTypeAnnotation(
|
|
58975
|
+
AST10.tsTypeLiteral([
|
|
58976
|
+
AST10.tsPropertySignature(
|
|
58977
|
+
AST10.identifier("type"),
|
|
58978
|
+
AST10.tsTypeAnnotation(typeOptions)
|
|
58979
|
+
),
|
|
58980
|
+
AST10.tsPropertySignature(
|
|
58981
|
+
AST10.identifier("args"),
|
|
58982
|
+
AST10.tsTypeAnnotation(args)
|
|
58983
|
+
)
|
|
58984
|
+
])
|
|
58985
|
+
)
|
|
58986
|
+
);
|
|
58987
|
+
}
|
|
58988
|
+
)
|
|
58989
|
+
);
|
|
58990
|
+
}
|
|
58991
|
+
return AST10.tsPropertySignature(
|
|
58992
|
+
AST10.identifier(typeName),
|
|
58993
|
+
AST10.tsTypeAnnotation(
|
|
58994
|
+
AST10.tsTypeLiteral([
|
|
58995
|
+
AST10.tsPropertySignature(
|
|
58996
|
+
AST10.identifier("idFields"),
|
|
58997
|
+
AST10.tsTypeAnnotation(idFields)
|
|
58998
|
+
),
|
|
58999
|
+
AST10.tsPropertySignature(
|
|
59000
|
+
AST10.identifier("fields"),
|
|
59001
|
+
AST10.tsTypeAnnotation(fields)
|
|
59002
|
+
)
|
|
59003
|
+
])
|
|
59004
|
+
)
|
|
59005
|
+
);
|
|
59006
|
+
})
|
|
59007
|
+
);
|
|
59008
|
+
}
|
|
59009
|
+
function listDefinitions(config2, docs) {
|
|
59010
|
+
const lists = [];
|
|
59011
|
+
const visitedLists = /* @__PURE__ */ new Set();
|
|
59012
|
+
for (const doc of docs) {
|
|
59013
|
+
graphql16.visit(doc.document, {
|
|
59014
|
+
Directive(node, key, parent, path2, ancestors) {
|
|
59015
|
+
if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
59016
|
+
return;
|
|
59017
|
+
}
|
|
59018
|
+
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
59019
|
+
const nameValue = nameArg?.value?.value || "";
|
|
59020
|
+
if (!nameValue || visitedLists.has(nameValue)) {
|
|
59021
|
+
return;
|
|
59022
|
+
}
|
|
59023
|
+
visitedLists.add(nameValue);
|
|
59024
|
+
const parentType = parentTypeFromAncestors(
|
|
59025
|
+
config2.schema,
|
|
59026
|
+
doc.filename,
|
|
59027
|
+
ancestors.slice(0, -1)
|
|
59028
|
+
);
|
|
59029
|
+
const targetField = ancestors[ancestors.length - 1];
|
|
59030
|
+
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
59031
|
+
const { type: listType } = unwrapType(config2, targetFieldDefinition.type);
|
|
59032
|
+
const possibleTypes = [];
|
|
59033
|
+
if (graphql16.isAbstractType(listType)) {
|
|
59034
|
+
possibleTypes.push(
|
|
59035
|
+
...config2.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
59036
|
+
);
|
|
59037
|
+
} else {
|
|
59038
|
+
possibleTypes.push(listType.name);
|
|
59039
|
+
}
|
|
59040
|
+
lists.push(
|
|
59041
|
+
AST10.tsPropertySignature(
|
|
59042
|
+
AST10.identifier(nameValue),
|
|
59043
|
+
AST10.tsTypeAnnotation(
|
|
59044
|
+
AST10.tsTypeLiteral([
|
|
59045
|
+
AST10.tsPropertySignature(
|
|
59046
|
+
AST10.identifier("type"),
|
|
59047
|
+
AST10.tsTypeAnnotation(
|
|
59048
|
+
AST10.tsUnionType(
|
|
59049
|
+
possibleTypes.map(
|
|
59050
|
+
(possible) => AST10.tsLiteralType(AST10.stringLiteral(possible))
|
|
59051
|
+
)
|
|
59052
|
+
)
|
|
59053
|
+
)
|
|
59054
|
+
),
|
|
59055
|
+
AST10.tsPropertySignature(
|
|
59056
|
+
AST10.identifier("filters"),
|
|
59057
|
+
AST10.tsTypeAnnotation(
|
|
59058
|
+
targetFieldDefinition.args.length === 0 ? AST10.tsNeverKeyword() : AST10.tsTypeLiteral(
|
|
59059
|
+
targetFieldDefinition.args.map((arg) => {
|
|
59060
|
+
const argDef = AST10.tsPropertySignature(
|
|
59061
|
+
AST10.identifier(arg.name),
|
|
59062
|
+
AST10.tsTypeAnnotation(
|
|
59063
|
+
tsTypeReference(
|
|
59064
|
+
config2,
|
|
59065
|
+
/* @__PURE__ */ new Set(),
|
|
59066
|
+
arg
|
|
59067
|
+
)
|
|
59068
|
+
)
|
|
59069
|
+
);
|
|
59070
|
+
argDef.optional = true;
|
|
59071
|
+
return argDef;
|
|
59072
|
+
})
|
|
59073
|
+
)
|
|
59074
|
+
)
|
|
59075
|
+
)
|
|
59076
|
+
])
|
|
59077
|
+
)
|
|
59078
|
+
)
|
|
59079
|
+
);
|
|
59080
|
+
}
|
|
59081
|
+
});
|
|
59082
|
+
}
|
|
59083
|
+
return AST10.tsTypeLiteral(lists);
|
|
59084
|
+
}
|
|
59085
|
+
var CacheTypeDefName = "CacheTypeDef";
|
|
59086
|
+
function record(name2) {
|
|
59087
|
+
return AST10.tsTypeReference(
|
|
59088
|
+
AST10.identifier("Record"),
|
|
59089
|
+
AST10.tsTypeParameterInstantiation([
|
|
59090
|
+
AST10.tsTypeReference(AST10.identifier(CacheTypeDefName)),
|
|
59091
|
+
AST10.tsLiteralType(AST10.stringLiteral(name2))
|
|
59092
|
+
])
|
|
59093
|
+
);
|
|
58718
59094
|
}
|
|
58719
59095
|
|
|
58720
59096
|
// src/codegen/generators/typescript/inlineType.ts
|
|
58721
|
-
var
|
|
58722
|
-
var
|
|
58723
|
-
var
|
|
59097
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
59098
|
+
var recast11 = __toESM(require_main2(), 1);
|
|
59099
|
+
var AST11 = recast11.types.builders;
|
|
58724
59100
|
var fragmentKey = "$fragments";
|
|
58725
59101
|
function inlineType({
|
|
58726
59102
|
config: config2,
|
|
@@ -58737,9 +59113,9 @@ function inlineType({
|
|
|
58737
59113
|
}) {
|
|
58738
59114
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
58739
59115
|
let result;
|
|
58740
|
-
if (
|
|
59116
|
+
if (graphql17.isScalarType(type)) {
|
|
58741
59117
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58742
|
-
} else if (
|
|
59118
|
+
} else if (graphql17.isEnumType(type)) {
|
|
58743
59119
|
if (!visitedTypes.has(type.name)) {
|
|
58744
59120
|
ensureImports({
|
|
58745
59121
|
config: config2,
|
|
@@ -58749,7 +59125,7 @@ function inlineType({
|
|
|
58749
59125
|
});
|
|
58750
59126
|
visitedTypes.add(type.name);
|
|
58751
59127
|
}
|
|
58752
|
-
result =
|
|
59128
|
+
result = AST11.tsTypeReference(AST11.identifier(type.name));
|
|
58753
59129
|
} else if (selections) {
|
|
58754
59130
|
const rootObj = type;
|
|
58755
59131
|
const inlineFragments = {};
|
|
@@ -58757,11 +59133,11 @@ function inlineType({
|
|
|
58757
59133
|
for (const selection2 of selections) {
|
|
58758
59134
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
58759
59135
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
58760
|
-
if (!
|
|
59136
|
+
if (!graphql17.isInterfaceType(type) && !graphql17.isUnionType(type)) {
|
|
58761
59137
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
58762
59138
|
continue;
|
|
58763
59139
|
}
|
|
58764
|
-
if (!
|
|
59140
|
+
if (!graphql17.isInterfaceType(fragmentType) && !graphql17.isUnionType(fragmentType)) {
|
|
58765
59141
|
if (!inlineFragments[fragmentType.name]) {
|
|
58766
59142
|
inlineFragments[fragmentType.name] = [];
|
|
58767
59143
|
}
|
|
@@ -58800,7 +59176,7 @@ function inlineType({
|
|
|
58800
59176
|
selectedFields.push(selection2);
|
|
58801
59177
|
}
|
|
58802
59178
|
}
|
|
58803
|
-
result =
|
|
59179
|
+
result = AST11.tsTypeLiteral([
|
|
58804
59180
|
...(selectedFields || []).filter(
|
|
58805
59181
|
(field) => field.kind === "Field"
|
|
58806
59182
|
).map((selection2) => {
|
|
@@ -58820,9 +59196,9 @@ function inlineType({
|
|
|
58820
59196
|
allOptional
|
|
58821
59197
|
});
|
|
58822
59198
|
const prop = readonlyProperty(
|
|
58823
|
-
|
|
58824
|
-
|
|
58825
|
-
|
|
59199
|
+
AST11.tsPropertySignature(
|
|
59200
|
+
AST11.identifier(attributeName),
|
|
59201
|
+
AST11.tsTypeAnnotation(attributeType)
|
|
58826
59202
|
),
|
|
58827
59203
|
allowReadonly
|
|
58828
59204
|
);
|
|
@@ -58836,15 +59212,15 @@ function inlineType({
|
|
|
58836
59212
|
if (includeFragments && fragmentSpreads && fragmentSpreads.length) {
|
|
58837
59213
|
result.members.push(
|
|
58838
59214
|
readonlyProperty(
|
|
58839
|
-
|
|
58840
|
-
|
|
58841
|
-
|
|
58842
|
-
|
|
59215
|
+
AST11.tsPropertySignature(
|
|
59216
|
+
AST11.identifier(fragmentKey),
|
|
59217
|
+
AST11.tsTypeAnnotation(
|
|
59218
|
+
AST11.tsTypeLiteral(
|
|
58843
59219
|
(fragmentSpreads || []).map(
|
|
58844
|
-
(fragmentSpread) =>
|
|
58845
|
-
|
|
58846
|
-
|
|
58847
|
-
|
|
59220
|
+
(fragmentSpread) => AST11.tsPropertySignature(
|
|
59221
|
+
AST11.identifier(fragmentSpread.name.value),
|
|
59222
|
+
AST11.tsTypeAnnotation(
|
|
59223
|
+
AST11.tsLiteralType(AST11.booleanLiteral(true))
|
|
58848
59224
|
)
|
|
58849
59225
|
)
|
|
58850
59226
|
)
|
|
@@ -58881,7 +59257,7 @@ function inlineType({
|
|
|
58881
59257
|
}
|
|
58882
59258
|
}
|
|
58883
59259
|
}
|
|
58884
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
59260
|
+
if (objectType.type === "TSTypeLiteral" && !graphql17.isInterfaceType(fragmentRootType) && !graphql17.isUnionType(fragmentRootType)) {
|
|
58885
59261
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
58886
59262
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
58887
59263
|
);
|
|
@@ -58890,9 +59266,9 @@ function inlineType({
|
|
|
58890
59266
|
}
|
|
58891
59267
|
objectType.members.push(
|
|
58892
59268
|
readonlyProperty(
|
|
58893
|
-
|
|
58894
|
-
|
|
58895
|
-
|
|
59269
|
+
AST11.tsPropertySignature(
|
|
59270
|
+
AST11.identifier("__typename"),
|
|
59271
|
+
AST11.tsTypeAnnotation(AST11.tsLiteralType(AST11.stringLiteral(typeName)))
|
|
58896
59272
|
),
|
|
58897
59273
|
allowReadonly
|
|
58898
59274
|
)
|
|
@@ -58903,8 +59279,8 @@ function inlineType({
|
|
|
58903
59279
|
if (Object.keys(inlineFragmentSelections).length > 0) {
|
|
58904
59280
|
let selectionTypes = Object.entries(inlineFragmentSelections).map(
|
|
58905
59281
|
([typeName, { type: type2, tsType }]) => {
|
|
58906
|
-
return
|
|
58907
|
-
|
|
59282
|
+
return AST11.tsParenthesizedType(
|
|
59283
|
+
AST11.tsIntersectionType(
|
|
58908
59284
|
[tsType].flatMap((type3) => {
|
|
58909
59285
|
if (type3.type === "TSUnionType") {
|
|
58910
59286
|
return type3.types.filter(
|
|
@@ -58917,9 +59293,9 @@ function inlineType({
|
|
|
58917
59293
|
);
|
|
58918
59294
|
}
|
|
58919
59295
|
);
|
|
58920
|
-
result =
|
|
59296
|
+
result = AST11.tsIntersectionType([
|
|
58921
59297
|
result,
|
|
58922
|
-
|
|
59298
|
+
AST11.tsParenthesizedType(AST11.tsUnionType(selectionTypes))
|
|
58923
59299
|
]);
|
|
58924
59300
|
}
|
|
58925
59301
|
} else {
|
|
@@ -58931,7 +59307,7 @@ function inlineType({
|
|
|
58931
59307
|
} else if (toWrap === "NonNull" /* NonNull */) {
|
|
58932
59308
|
continue;
|
|
58933
59309
|
} else if (toWrap === "List" /* List */) {
|
|
58934
|
-
result =
|
|
59310
|
+
result = AST11.tsArrayType(AST11.tsParenthesizedType(result));
|
|
58935
59311
|
}
|
|
58936
59312
|
}
|
|
58937
59313
|
return result;
|
|
@@ -58948,7 +59324,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58948
59324
|
},
|
|
58949
59325
|
type: schema.getType("String")
|
|
58950
59326
|
};
|
|
58951
|
-
} else if (
|
|
59327
|
+
} else if (graphql17.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
58952
59328
|
fields = rootType.ofType.getFields();
|
|
58953
59329
|
} else {
|
|
58954
59330
|
fields = rootType.getFields();
|
|
@@ -58960,7 +59336,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58960
59336
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
58961
59337
|
});
|
|
58962
59338
|
}
|
|
58963
|
-
const fieldType =
|
|
59339
|
+
const fieldType = graphql17.getNamedType(field.type);
|
|
58964
59340
|
if (!fieldType) {
|
|
58965
59341
|
throw new HoudiniError({
|
|
58966
59342
|
filepath,
|
|
@@ -58976,7 +59352,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58976
59352
|
}
|
|
58977
59353
|
|
|
58978
59354
|
// src/codegen/generators/typescript/index.ts
|
|
58979
|
-
var
|
|
59355
|
+
var AST12 = recast12.types.builders;
|
|
58980
59356
|
async function typescriptGenerator(config2, docs) {
|
|
58981
59357
|
const typePaths = [];
|
|
58982
59358
|
const fragmentDefinitions = {};
|
|
@@ -58994,7 +59370,7 @@ async function typescriptGenerator(config2, docs) {
|
|
|
58994
59370
|
return;
|
|
58995
59371
|
}
|
|
58996
59372
|
const typeDefPath = config2.artifactTypePath(originalDocument);
|
|
58997
|
-
const program =
|
|
59373
|
+
const program = AST12.program([]);
|
|
58998
59374
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58999
59375
|
let definition = originalDocument.definitions.find(
|
|
59000
59376
|
(def) => (def.kind === "OperationDefinition" || def.kind === "FragmentDefinition") && def.name?.value === name2
|
|
@@ -59027,21 +59403,21 @@ async function typescriptGenerator(config2, docs) {
|
|
|
59027
59403
|
missingScalars
|
|
59028
59404
|
);
|
|
59029
59405
|
}
|
|
59030
|
-
await fs_exports.writeFile(typeDefPath,
|
|
59406
|
+
await fs_exports.writeFile(typeDefPath, recast12.print(program).code);
|
|
59031
59407
|
typePaths.push(typeDefPath);
|
|
59032
59408
|
})
|
|
59033
59409
|
);
|
|
59034
|
-
const typeIndex =
|
|
59410
|
+
const typeIndex = AST12.program(
|
|
59035
59411
|
typePaths.sort((a, b) => a.localeCompare(b)).map((typePath) => {
|
|
59036
|
-
return
|
|
59037
|
-
|
|
59412
|
+
return AST12.exportAllDeclaration(
|
|
59413
|
+
AST12.literal(
|
|
59038
59414
|
"./" + path_exports.relative(path_exports.resolve(config2.typeIndexPath, ".."), typePath).replace(/\.[^/.]+\.[^/.]+$/, "")
|
|
59039
59415
|
),
|
|
59040
59416
|
null
|
|
59041
59417
|
);
|
|
59042
59418
|
}).concat([
|
|
59043
|
-
|
|
59044
|
-
|
|
59419
|
+
AST12.exportAllDeclaration(AST12.literal("./runtime"), null),
|
|
59420
|
+
AST12.exportAllDeclaration(AST12.literal("./graphql"), null)
|
|
59045
59421
|
])
|
|
59046
59422
|
);
|
|
59047
59423
|
const export_default_as = ({ module, as }) => `
|
|
@@ -59050,7 +59426,7 @@ export { default as ${as} } from "${module}"
|
|
|
59050
59426
|
const export_star_from = ({ module }) => `
|
|
59051
59427
|
export * from "${module}"
|
|
59052
59428
|
`;
|
|
59053
|
-
let indexContent =
|
|
59429
|
+
let indexContent = recast12.print(typeIndex).code;
|
|
59054
59430
|
for (const plugin of config2.plugins) {
|
|
59055
59431
|
if (!plugin.index_file) {
|
|
59056
59432
|
continue;
|
|
@@ -59071,6 +59447,7 @@ export * from "${module}"
|
|
|
59071
59447
|
}
|
|
59072
59448
|
}
|
|
59073
59449
|
await fs_exports.writeFile(config2.typeIndexPath, indexContent);
|
|
59450
|
+
await imperativeCacheTypef(config2, docs);
|
|
59074
59451
|
if (missingScalars.size > 0) {
|
|
59075
59452
|
console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
|
|
59076
59453
|
", "
|
|
@@ -59112,23 +59489,23 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59112
59489
|
const optimisticTypeName = `${definition.name.value}$optimistic`;
|
|
59113
59490
|
const hasInputs = definition.variableDefinitions && definition.variableDefinitions.length > 0;
|
|
59114
59491
|
body.push(
|
|
59115
|
-
|
|
59116
|
-
|
|
59117
|
-
|
|
59118
|
-
|
|
59492
|
+
AST12.exportNamedDeclaration(
|
|
59493
|
+
AST12.tsTypeAliasDeclaration(
|
|
59494
|
+
AST12.identifier(definition.name.value),
|
|
59495
|
+
AST12.tsTypeLiteral([
|
|
59119
59496
|
readonlyProperty(
|
|
59120
|
-
|
|
59121
|
-
|
|
59122
|
-
|
|
59497
|
+
AST12.tsPropertySignature(
|
|
59498
|
+
AST12.stringLiteral("input"),
|
|
59499
|
+
AST12.tsTypeAnnotation(AST12.tsTypeReference(AST12.identifier(inputTypeName)))
|
|
59123
59500
|
)
|
|
59124
59501
|
),
|
|
59125
59502
|
readonlyProperty(
|
|
59126
|
-
|
|
59127
|
-
|
|
59128
|
-
|
|
59129
|
-
definition.operation === "mutation" ?
|
|
59130
|
-
|
|
59131
|
-
|
|
59503
|
+
AST12.tsPropertySignature(
|
|
59504
|
+
AST12.stringLiteral("result"),
|
|
59505
|
+
AST12.tsTypeAnnotation(
|
|
59506
|
+
definition.operation === "mutation" ? AST12.tsTypeReference(AST12.identifier(shapeTypeName)) : AST12.tsUnionType([
|
|
59507
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName)),
|
|
59508
|
+
AST12.tsUndefinedKeyword()
|
|
59132
59509
|
])
|
|
59133
59510
|
)
|
|
59134
59511
|
)
|
|
@@ -59136,9 +59513,9 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59136
59513
|
])
|
|
59137
59514
|
)
|
|
59138
59515
|
),
|
|
59139
|
-
|
|
59140
|
-
|
|
59141
|
-
|
|
59516
|
+
AST12.exportNamedDeclaration(
|
|
59517
|
+
AST12.tsTypeAliasDeclaration(
|
|
59518
|
+
AST12.identifier(shapeTypeName),
|
|
59142
59519
|
inlineType({
|
|
59143
59520
|
config: config2,
|
|
59144
59521
|
filepath,
|
|
@@ -59166,15 +59543,15 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59166
59543
|
);
|
|
59167
59544
|
}
|
|
59168
59545
|
body.push(
|
|
59169
|
-
|
|
59170
|
-
|
|
59171
|
-
|
|
59172
|
-
|
|
59546
|
+
AST12.exportNamedDeclaration(
|
|
59547
|
+
AST12.tsTypeAliasDeclaration(
|
|
59548
|
+
AST12.identifier(inputTypeName),
|
|
59549
|
+
AST12.tsTypeLiteral(
|
|
59173
59550
|
(definition.variableDefinitions || []).map(
|
|
59174
59551
|
(definition2) => {
|
|
59175
|
-
return
|
|
59176
|
-
|
|
59177
|
-
|
|
59552
|
+
return AST12.tsPropertySignature(
|
|
59553
|
+
AST12.identifier(definition2.variable.name.value),
|
|
59554
|
+
AST12.tsTypeAnnotation(
|
|
59178
59555
|
tsTypeReference(config2, missingScalars, definition2)
|
|
59179
59556
|
),
|
|
59180
59557
|
definition2.type.kind !== "NonNullType"
|
|
@@ -59187,16 +59564,16 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59187
59564
|
);
|
|
59188
59565
|
} else {
|
|
59189
59566
|
body.push(
|
|
59190
|
-
|
|
59191
|
-
|
|
59567
|
+
AST12.exportNamedDeclaration(
|
|
59568
|
+
AST12.tsTypeAliasDeclaration(AST12.identifier(inputTypeName), AST12.tsNullKeyword())
|
|
59192
59569
|
)
|
|
59193
59570
|
);
|
|
59194
59571
|
}
|
|
59195
59572
|
if (definition.operation === "mutation") {
|
|
59196
59573
|
body.push(
|
|
59197
|
-
|
|
59198
|
-
|
|
59199
|
-
|
|
59574
|
+
AST12.exportNamedDeclaration(
|
|
59575
|
+
AST12.tsTypeAliasDeclaration(
|
|
59576
|
+
AST12.identifier(optimisticTypeName),
|
|
59200
59577
|
inlineType({
|
|
59201
59578
|
config: config2,
|
|
59202
59579
|
filepath,
|
|
@@ -59227,28 +59604,28 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59227
59604
|
throw new Error("Should not get here");
|
|
59228
59605
|
}
|
|
59229
59606
|
body.push(
|
|
59230
|
-
|
|
59231
|
-
|
|
59232
|
-
|
|
59233
|
-
|
|
59607
|
+
AST12.exportNamedDeclaration(
|
|
59608
|
+
AST12.tsTypeAliasDeclaration(
|
|
59609
|
+
AST12.identifier(propTypeName),
|
|
59610
|
+
AST12.tsTypeLiteral([
|
|
59234
59611
|
readonlyProperty(
|
|
59235
|
-
|
|
59236
|
-
|
|
59237
|
-
|
|
59238
|
-
|
|
59612
|
+
AST12.tsPropertySignature(
|
|
59613
|
+
AST12.stringLiteral("shape"),
|
|
59614
|
+
AST12.tsTypeAnnotation(
|
|
59615
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName))
|
|
59239
59616
|
),
|
|
59240
59617
|
true
|
|
59241
59618
|
)
|
|
59242
59619
|
),
|
|
59243
59620
|
readonlyProperty(
|
|
59244
|
-
|
|
59245
|
-
|
|
59246
|
-
|
|
59247
|
-
|
|
59248
|
-
|
|
59249
|
-
|
|
59250
|
-
|
|
59251
|
-
|
|
59621
|
+
AST12.tsPropertySignature(
|
|
59622
|
+
AST12.stringLiteral(fragmentKey),
|
|
59623
|
+
AST12.tsTypeAnnotation(
|
|
59624
|
+
AST12.tsTypeLiteral([
|
|
59625
|
+
AST12.tsPropertySignature(
|
|
59626
|
+
AST12.stringLiteral(propTypeName),
|
|
59627
|
+
AST12.tsTypeAnnotation(
|
|
59628
|
+
AST12.tsLiteralType(AST12.booleanLiteral(true))
|
|
59252
59629
|
)
|
|
59253
59630
|
)
|
|
59254
59631
|
])
|
|
@@ -59258,9 +59635,9 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59258
59635
|
])
|
|
59259
59636
|
)
|
|
59260
59637
|
),
|
|
59261
|
-
|
|
59262
|
-
|
|
59263
|
-
|
|
59638
|
+
AST12.exportNamedDeclaration(
|
|
59639
|
+
AST12.tsTypeAliasDeclaration(
|
|
59640
|
+
AST12.identifier(shapeTypeName),
|
|
59264
59641
|
inlineType({
|
|
59265
59642
|
config: config2,
|
|
59266
59643
|
filepath,
|
|
@@ -59280,7 +59657,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59280
59657
|
}
|
|
59281
59658
|
|
|
59282
59659
|
// src/codegen/generators/persistedQueries/index.ts
|
|
59283
|
-
var
|
|
59660
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
59284
59661
|
async function persistOutputGenerator(config2, docs) {
|
|
59285
59662
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
59286
59663
|
return;
|
|
@@ -59292,8 +59669,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59292
59669
|
if (!generateArtifact) {
|
|
59293
59670
|
return acc;
|
|
59294
59671
|
}
|
|
59295
|
-
let rawString =
|
|
59296
|
-
|
|
59672
|
+
let rawString = graphql18.print(
|
|
59673
|
+
graphql18.visit(document, {
|
|
59297
59674
|
Directive(node) {
|
|
59298
59675
|
if (config2.isInternalDirective(node)) {
|
|
59299
59676
|
return null;
|
|
@@ -59302,7 +59679,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59302
59679
|
})
|
|
59303
59680
|
);
|
|
59304
59681
|
const operations = document.definitions.filter(
|
|
59305
|
-
({ kind }) => kind ===
|
|
59682
|
+
({ kind }) => kind === graphql18.Kind.OPERATION_DEFINITION
|
|
59306
59683
|
);
|
|
59307
59684
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
59308
59685
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -59315,26 +59692,26 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59315
59692
|
}
|
|
59316
59693
|
|
|
59317
59694
|
// src/codegen/generators/definitions/enums.ts
|
|
59318
|
-
var
|
|
59319
|
-
var
|
|
59320
|
-
var
|
|
59695
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
59696
|
+
var recast13 = __toESM(require_main2(), 1);
|
|
59697
|
+
var AST13 = recast13.types.builders;
|
|
59321
59698
|
async function definitionsGenerator(config2) {
|
|
59322
|
-
const enums =
|
|
59699
|
+
const enums = graphql19.parse(graphql19.printSchema(config2.schema)).definitions.filter(
|
|
59323
59700
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
59324
59701
|
).filter((def) => !config2.isInternalEnum(def));
|
|
59325
|
-
const runtimeDefinitions =
|
|
59326
|
-
|
|
59702
|
+
const runtimeDefinitions = recast13.print(
|
|
59703
|
+
AST13.program(
|
|
59327
59704
|
enums.map((defn) => {
|
|
59328
59705
|
const name2 = defn.name.value;
|
|
59329
59706
|
return moduleExport(
|
|
59330
59707
|
config2,
|
|
59331
59708
|
name2,
|
|
59332
|
-
|
|
59709
|
+
AST13.objectExpression(
|
|
59333
59710
|
defn.values?.map((value) => {
|
|
59334
59711
|
const str = value.name.value;
|
|
59335
|
-
return
|
|
59336
|
-
|
|
59337
|
-
|
|
59712
|
+
return AST13.objectProperty(
|
|
59713
|
+
AST13.stringLiteral(str),
|
|
59714
|
+
AST13.stringLiteral(str)
|
|
59338
59715
|
);
|
|
59339
59716
|
}) || []
|
|
59340
59717
|
)
|
|
@@ -59342,7 +59719,7 @@ async function definitionsGenerator(config2) {
|
|
|
59342
59719
|
})
|
|
59343
59720
|
)
|
|
59344
59721
|
).code;
|
|
59345
|
-
const
|
|
59722
|
+
const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
|
|
59346
59723
|
(definition) => `
|
|
59347
59724
|
export declare enum ${definition.name.value} {
|
|
59348
59725
|
${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
|
|
@@ -59353,7 +59730,7 @@ ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.val
|
|
|
59353
59730
|
export * from './enums.js'
|
|
59354
59731
|
`;
|
|
59355
59732
|
await Promise.all([
|
|
59356
|
-
fs_exports.writeFile(config2.enumTypesDefinitionsPath,
|
|
59733
|
+
fs_exports.writeFile(config2.enumTypesDefinitionsPath, typeDefinitions2),
|
|
59357
59734
|
fs_exports.writeFile(config2.enumRuntimeDefinitionsPath, runtimeDefinitions),
|
|
59358
59735
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.js"), definitionsIndex),
|
|
59359
59736
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.d.ts"), definitionsIndex)
|
|
@@ -59492,7 +59869,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59492
59869
|
}
|
|
59493
59870
|
|
|
59494
59871
|
// src/codegen/transforms/schema.ts
|
|
59495
|
-
var
|
|
59872
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
59496
59873
|
async function graphqlExtensions(config2, documents) {
|
|
59497
59874
|
const internalSchema = `
|
|
59498
59875
|
enum CachePolicy {
|
|
@@ -59570,19 +59947,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59570
59947
|
"""
|
|
59571
59948
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59572
59949
|
`;
|
|
59573
|
-
let currentSchema =
|
|
59950
|
+
let currentSchema = graphql21.printSchema(config2.schema);
|
|
59574
59951
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59575
59952
|
currentSchema += internalSchema;
|
|
59576
59953
|
}
|
|
59577
59954
|
config2.newSchema += internalSchema;
|
|
59578
|
-
config2.schema =
|
|
59955
|
+
config2.schema = graphql21.buildSchema(currentSchema);
|
|
59579
59956
|
}
|
|
59580
59957
|
|
|
59581
59958
|
// src/codegen/transforms/typename.ts
|
|
59582
|
-
var
|
|
59959
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
59583
59960
|
async function addTypename(config2, documents) {
|
|
59584
59961
|
for (const doc of documents) {
|
|
59585
|
-
doc.document =
|
|
59962
|
+
doc.document = graphql22.visit(doc.document, {
|
|
59586
59963
|
Field(node, key, parent, path2, ancestors) {
|
|
59587
59964
|
if (!node.selectionSet) {
|
|
59588
59965
|
return;
|
|
@@ -59594,7 +59971,7 @@ async function addTypename(config2, documents) {
|
|
|
59594
59971
|
);
|
|
59595
59972
|
const field = type.getFields()[node.name.value];
|
|
59596
59973
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59597
|
-
if (
|
|
59974
|
+
if (graphql22.isInterfaceType(fieldType) || graphql22.isUnionType(fieldType)) {
|
|
59598
59975
|
return {
|
|
59599
59976
|
...node,
|
|
59600
59977
|
selectionSet: {
|
|
@@ -59602,9 +59979,9 @@ async function addTypename(config2, documents) {
|
|
|
59602
59979
|
selections: [
|
|
59603
59980
|
...node.selectionSet.selections,
|
|
59604
59981
|
{
|
|
59605
|
-
kind:
|
|
59982
|
+
kind: graphql22.Kind.FIELD,
|
|
59606
59983
|
name: {
|
|
59607
|
-
kind:
|
|
59984
|
+
kind: graphql22.Kind.NAME,
|
|
59608
59985
|
value: "__typename"
|
|
59609
59986
|
}
|
|
59610
59987
|
}
|
|
@@ -59618,10 +59995,10 @@ async function addTypename(config2, documents) {
|
|
|
59618
59995
|
}
|
|
59619
59996
|
|
|
59620
59997
|
// src/codegen/transforms/addID.ts
|
|
59621
|
-
var
|
|
59998
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
59622
59999
|
async function addID(config2, documents) {
|
|
59623
60000
|
for (const doc of documents) {
|
|
59624
|
-
doc.document =
|
|
60001
|
+
doc.document = graphql23.visit(doc.document, {
|
|
59625
60002
|
Field(node, key, parent, path2, ancestors) {
|
|
59626
60003
|
if (!node.selectionSet) {
|
|
59627
60004
|
return;
|
|
@@ -59634,7 +60011,7 @@ async function addID(config2, documents) {
|
|
|
59634
60011
|
const field = type.getFields()[node.name.value];
|
|
59635
60012
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59636
60013
|
if (node.selectionSet?.selections.length > 0) {
|
|
59637
|
-
if (!
|
|
60014
|
+
if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
|
|
59638
60015
|
return;
|
|
59639
60016
|
}
|
|
59640
60017
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -59649,9 +60026,9 @@ async function addID(config2, documents) {
|
|
|
59649
60026
|
continue;
|
|
59650
60027
|
}
|
|
59651
60028
|
selections.push({
|
|
59652
|
-
kind:
|
|
60029
|
+
kind: graphql23.Kind.FIELD,
|
|
59653
60030
|
name: {
|
|
59654
|
-
kind:
|
|
60031
|
+
kind: graphql23.Kind.NAME,
|
|
59655
60032
|
value: keyField
|
|
59656
60033
|
}
|
|
59657
60034
|
});
|
|
@@ -59670,8 +60047,8 @@ async function addID(config2, documents) {
|
|
|
59670
60047
|
}
|
|
59671
60048
|
|
|
59672
60049
|
// src/codegen/transforms/fragmentVariables.ts
|
|
59673
|
-
var
|
|
59674
|
-
var GraphqlKinds2 =
|
|
60050
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
60051
|
+
var GraphqlKinds2 = graphql24.Kind;
|
|
59675
60052
|
async function fragmentVariables(config2, documents) {
|
|
59676
60053
|
const fragments = collectFragments(config2, documents);
|
|
59677
60054
|
const generatedFragments = {};
|
|
@@ -59694,7 +60071,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
59694
60071
|
});
|
|
59695
60072
|
}
|
|
59696
60073
|
const doc = {
|
|
59697
|
-
kind:
|
|
60074
|
+
kind: graphql24.Kind.DOCUMENT,
|
|
59698
60075
|
definitions: Object.values(generatedFragments)
|
|
59699
60076
|
};
|
|
59700
60077
|
documents.push({
|
|
@@ -59730,7 +60107,7 @@ function inlineFragmentArgs({
|
|
|
59730
60107
|
filepath,
|
|
59731
60108
|
document
|
|
59732
60109
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
59733
|
-
const result =
|
|
60110
|
+
const result = graphql24.visit(document, {
|
|
59734
60111
|
FragmentSpread(node) {
|
|
59735
60112
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
59736
60113
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -59818,7 +60195,7 @@ function inlineFragmentArgs({
|
|
|
59818
60195
|
});
|
|
59819
60196
|
if (newName) {
|
|
59820
60197
|
result.name = {
|
|
59821
|
-
kind:
|
|
60198
|
+
kind: graphql24.Kind.NAME,
|
|
59822
60199
|
value: newName
|
|
59823
60200
|
};
|
|
59824
60201
|
}
|
|
@@ -59930,7 +60307,7 @@ function operationScope(operation) {
|
|
|
59930
60307
|
}
|
|
59931
60308
|
|
|
59932
60309
|
// src/codegen/validators/typeCheck.ts
|
|
59933
|
-
var
|
|
60310
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
59934
60311
|
async function typeCheck(config2, docs) {
|
|
59935
60312
|
const errors = [];
|
|
59936
60313
|
const freeLists = [];
|
|
@@ -59938,11 +60315,11 @@ async function typeCheck(config2, docs) {
|
|
|
59938
60315
|
const listTypes = [];
|
|
59939
60316
|
const fragments = {};
|
|
59940
60317
|
for (const { document: parsed, filename } of docs) {
|
|
59941
|
-
|
|
59942
|
-
[
|
|
60318
|
+
graphql25.visit(parsed, {
|
|
60319
|
+
[graphql25.Kind.FRAGMENT_DEFINITION](definition) {
|
|
59943
60320
|
fragments[definition.name.value] = definition;
|
|
59944
60321
|
},
|
|
59945
|
-
[
|
|
60322
|
+
[graphql25.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
59946
60323
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
59947
60324
|
return;
|
|
59948
60325
|
}
|
|
@@ -59988,14 +60365,14 @@ async function typeCheck(config2, docs) {
|
|
|
59988
60365
|
);
|
|
59989
60366
|
return;
|
|
59990
60367
|
}
|
|
59991
|
-
if (
|
|
60368
|
+
if (graphql25.isListType(rootType) || graphql25.isNonNullType(rootType) && graphql25.isListType(rootType.ofType)) {
|
|
59992
60369
|
needsParent = true;
|
|
59993
60370
|
break;
|
|
59994
60371
|
}
|
|
59995
|
-
if (
|
|
60372
|
+
if (graphql25.isNonNullType(rootType) && "ofType" in rootType) {
|
|
59996
60373
|
rootType = rootType.ofType;
|
|
59997
60374
|
}
|
|
59998
|
-
if (
|
|
60375
|
+
if (graphql25.isScalarType(rootType)) {
|
|
59999
60376
|
break;
|
|
60000
60377
|
}
|
|
60001
60378
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -60051,7 +60428,7 @@ async function typeCheck(config2, docs) {
|
|
|
60051
60428
|
);
|
|
60052
60429
|
const targetField = ancestors[ancestors.length - 1];
|
|
60053
60430
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
60054
|
-
const { type, error } = connectionSelection(
|
|
60431
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
60055
60432
|
config2,
|
|
60056
60433
|
targetFieldDefinition,
|
|
60057
60434
|
parentTypeFromAncestors(
|
|
@@ -60061,10 +60438,19 @@ async function typeCheck(config2, docs) {
|
|
|
60061
60438
|
),
|
|
60062
60439
|
targetField.selectionSet
|
|
60063
60440
|
);
|
|
60441
|
+
if (errorConnectionSelection && directive.name.value === config2.paginateDirective) {
|
|
60442
|
+
errors.push(
|
|
60443
|
+
new HoudiniError({
|
|
60444
|
+
filepath: filename,
|
|
60445
|
+
message: errorConnectionSelection,
|
|
60446
|
+
description: errorConnectionSelection
|
|
60447
|
+
})
|
|
60448
|
+
);
|
|
60449
|
+
}
|
|
60064
60450
|
let targetTypes = [type];
|
|
60065
|
-
if (
|
|
60451
|
+
if (graphql25.isUnionType(type)) {
|
|
60066
60452
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
60067
|
-
} else if (
|
|
60453
|
+
} else if (graphql25.isInterfaceType(type)) {
|
|
60068
60454
|
try {
|
|
60069
60455
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
60070
60456
|
if (!type.getFields()[key]) {
|
|
@@ -60078,23 +60464,16 @@ async function typeCheck(config2, docs) {
|
|
|
60078
60464
|
for (const targetType of targetTypes) {
|
|
60079
60465
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
60080
60466
|
if (missingIDFields.length > 0) {
|
|
60081
|
-
|
|
60082
|
-
|
|
60083
|
-
|
|
60084
|
-
|
|
60085
|
-
|
|
60086
|
-
|
|
60087
|
-
|
|
60088
|
-
|
|
60089
|
-
|
|
60090
|
-
|
|
60091
|
-
filepath: filename,
|
|
60092
|
-
message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
60093
|
-
", "
|
|
60094
|
-
)}.`
|
|
60095
|
-
})
|
|
60096
|
-
);
|
|
60097
|
-
}
|
|
60467
|
+
const message = `@${config2.listDirective} on ${logGreen(
|
|
60468
|
+
targetType.name
|
|
60469
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
60470
|
+
errors.push(
|
|
60471
|
+
new HoudiniError({
|
|
60472
|
+
filepath: filename,
|
|
60473
|
+
message,
|
|
60474
|
+
description: message
|
|
60475
|
+
})
|
|
60476
|
+
);
|
|
60098
60477
|
return;
|
|
60099
60478
|
}
|
|
60100
60479
|
}
|
|
@@ -60109,13 +60488,13 @@ async function typeCheck(config2, docs) {
|
|
|
60109
60488
|
if (errors.length > 0) {
|
|
60110
60489
|
throw errors;
|
|
60111
60490
|
}
|
|
60112
|
-
const rules = (filepath) => [...
|
|
60491
|
+
const rules = (filepath) => [...graphql25.specifiedRules].filter(
|
|
60113
60492
|
(rule) => ![
|
|
60114
|
-
|
|
60115
|
-
|
|
60116
|
-
|
|
60117
|
-
|
|
60118
|
-
|
|
60493
|
+
graphql25.NoUnusedFragmentsRule,
|
|
60494
|
+
graphql25.KnownFragmentNamesRule,
|
|
60495
|
+
graphql25.ExecutableDefinitionsRule,
|
|
60496
|
+
graphql25.KnownDirectivesRule,
|
|
60497
|
+
graphql25.KnownArgumentNamesRule
|
|
60119
60498
|
].includes(rule)
|
|
60120
60499
|
).concat(
|
|
60121
60500
|
validateLists({
|
|
@@ -60134,7 +60513,7 @@ async function typeCheck(config2, docs) {
|
|
|
60134
60513
|
noUnusedFragmentArguments(config2)
|
|
60135
60514
|
);
|
|
60136
60515
|
for (const { filename, document: parsed } of docs) {
|
|
60137
|
-
for (const error of
|
|
60516
|
+
for (const error of graphql25.validate(config2.schema, parsed, rules(filename))) {
|
|
60138
60517
|
errors.push(
|
|
60139
60518
|
new HoudiniError({
|
|
60140
60519
|
filepath: filename,
|
|
@@ -60160,7 +60539,7 @@ var validateLists = ({
|
|
|
60160
60539
|
if (!config2.isListFragment(node.name.value)) {
|
|
60161
60540
|
if (!fragments[node.name.value]) {
|
|
60162
60541
|
ctx.reportError(
|
|
60163
|
-
new
|
|
60542
|
+
new graphql25.GraphQLError(
|
|
60164
60543
|
"Encountered unknown fragment: " + node.name.value
|
|
60165
60544
|
)
|
|
60166
60545
|
);
|
|
@@ -60170,7 +60549,7 @@ var validateLists = ({
|
|
|
60170
60549
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
60171
60550
|
if (!lists.includes(listName)) {
|
|
60172
60551
|
ctx.reportError(
|
|
60173
|
-
new
|
|
60552
|
+
new graphql25.GraphQLError(
|
|
60174
60553
|
"Encountered fragment referencing unknown list: " + listName
|
|
60175
60554
|
)
|
|
60176
60555
|
);
|
|
@@ -60195,7 +60574,7 @@ var validateLists = ({
|
|
|
60195
60574
|
);
|
|
60196
60575
|
if (parentArg) {
|
|
60197
60576
|
ctx.reportError(
|
|
60198
|
-
new
|
|
60577
|
+
new graphql25.GraphQLError(
|
|
60199
60578
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
60200
60579
|
)
|
|
60201
60580
|
);
|
|
@@ -60211,7 +60590,7 @@ var validateLists = ({
|
|
|
60211
60590
|
return;
|
|
60212
60591
|
}
|
|
60213
60592
|
ctx.reportError(
|
|
60214
|
-
new
|
|
60593
|
+
new graphql25.GraphQLError(
|
|
60215
60594
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
60216
60595
|
)
|
|
60217
60596
|
);
|
|
@@ -60221,7 +60600,7 @@ var validateLists = ({
|
|
|
60221
60600
|
const directiveName = node.name.value;
|
|
60222
60601
|
if (directiveName === "connection") {
|
|
60223
60602
|
ctx.reportError(
|
|
60224
|
-
new
|
|
60603
|
+
new graphql25.GraphQLError(
|
|
60225
60604
|
"@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."
|
|
60226
60605
|
)
|
|
60227
60606
|
);
|
|
@@ -60230,7 +60609,7 @@ var validateLists = ({
|
|
|
60230
60609
|
if (!config2.isInternalDirective(node)) {
|
|
60231
60610
|
if (!config2.schema.getDirective(directiveName)) {
|
|
60232
60611
|
ctx.reportError(
|
|
60233
|
-
new
|
|
60612
|
+
new graphql25.GraphQLError(
|
|
60234
60613
|
"Encountered unknown directive: " + directiveName
|
|
60235
60614
|
)
|
|
60236
60615
|
);
|
|
@@ -60239,7 +60618,7 @@ var validateLists = ({
|
|
|
60239
60618
|
}
|
|
60240
60619
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
60241
60620
|
ctx.reportError(
|
|
60242
|
-
new
|
|
60621
|
+
new graphql25.GraphQLError(
|
|
60243
60622
|
"Encountered directive referencing unknown list: " + directiveName
|
|
60244
60623
|
)
|
|
60245
60624
|
);
|
|
@@ -60250,7 +60629,7 @@ var validateLists = ({
|
|
|
60250
60629
|
};
|
|
60251
60630
|
function knownArguments(config2) {
|
|
60252
60631
|
return function(ctx) {
|
|
60253
|
-
const nativeValidator =
|
|
60632
|
+
const nativeValidator = graphql25.KnownArgumentNamesRule(ctx);
|
|
60254
60633
|
return {
|
|
60255
60634
|
...nativeValidator,
|
|
60256
60635
|
Directive(directiveNode) {
|
|
@@ -60283,7 +60662,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60283
60662
|
for (const arg of node.arguments || []) {
|
|
60284
60663
|
if (arg.value.kind !== "ObjectValue") {
|
|
60285
60664
|
ctx.reportError(
|
|
60286
|
-
new
|
|
60665
|
+
new graphql25.GraphQLError("values in @arguments must be an object")
|
|
60287
60666
|
);
|
|
60288
60667
|
return;
|
|
60289
60668
|
}
|
|
@@ -60293,13 +60672,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60293
60672
|
);
|
|
60294
60673
|
if (!typeArg) {
|
|
60295
60674
|
ctx.reportError(
|
|
60296
|
-
new
|
|
60675
|
+
new graphql25.GraphQLError("missing type field for @arguments directive")
|
|
60297
60676
|
);
|
|
60298
60677
|
return;
|
|
60299
60678
|
}
|
|
60300
|
-
if (typeArg.value.kind !==
|
|
60679
|
+
if (typeArg.value.kind !== graphql25.Kind.STRING) {
|
|
60301
60680
|
ctx.reportError(
|
|
60302
|
-
new
|
|
60681
|
+
new graphql25.GraphQLError("type field to @arguments must be a string")
|
|
60303
60682
|
);
|
|
60304
60683
|
return;
|
|
60305
60684
|
}
|
|
@@ -60312,7 +60691,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60312
60691
|
);
|
|
60313
60692
|
if (typeArg.value.value !== defaultValueType) {
|
|
60314
60693
|
ctx.reportError(
|
|
60315
|
-
new
|
|
60694
|
+
new graphql25.GraphQLError(
|
|
60316
60695
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60317
60696
|
)
|
|
60318
60697
|
);
|
|
@@ -60330,7 +60709,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60330
60709
|
try {
|
|
60331
60710
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60332
60711
|
} catch (e) {
|
|
60333
|
-
ctx.reportError(new
|
|
60712
|
+
ctx.reportError(new graphql25.GraphQLError(e.message));
|
|
60334
60713
|
return;
|
|
60335
60714
|
}
|
|
60336
60715
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60353,7 +60732,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60353
60732
|
);
|
|
60354
60733
|
if (missing.length > 0) {
|
|
60355
60734
|
ctx.reportError(
|
|
60356
|
-
new
|
|
60735
|
+
new graphql25.GraphQLError(
|
|
60357
60736
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60358
60737
|
)
|
|
60359
60738
|
);
|
|
@@ -60364,7 +60743,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60364
60743
|
);
|
|
60365
60744
|
if (unknown.length > 0) {
|
|
60366
60745
|
ctx.reportError(
|
|
60367
|
-
new
|
|
60746
|
+
new graphql25.GraphQLError(
|
|
60368
60747
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60369
60748
|
)
|
|
60370
60749
|
);
|
|
@@ -60376,7 +60755,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60376
60755
|
]
|
|
60377
60756
|
);
|
|
60378
60757
|
for (const [applied, target] of zipped) {
|
|
60379
|
-
if (applied.value.kind ===
|
|
60758
|
+
if (applied.value.kind === graphql25.Kind.VARIABLE || applied.value.kind === graphql25.Kind.LIST || applied.value.kind === graphql25.Kind.OBJECT) {
|
|
60380
60759
|
continue;
|
|
60381
60760
|
}
|
|
60382
60761
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60385,7 +60764,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60385
60764
|
);
|
|
60386
60765
|
if (appliedType !== target) {
|
|
60387
60766
|
ctx.reportError(
|
|
60388
|
-
new
|
|
60767
|
+
new graphql25.GraphQLError(
|
|
60389
60768
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60390
60769
|
)
|
|
60391
60770
|
);
|
|
@@ -60406,7 +60785,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60406
60785
|
}
|
|
60407
60786
|
if (alreadyPaginated) {
|
|
60408
60787
|
ctx.reportError(
|
|
60409
|
-
new
|
|
60788
|
+
new graphql25.GraphQLError(
|
|
60410
60789
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60411
60790
|
)
|
|
60412
60791
|
);
|
|
@@ -60421,7 +60800,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60421
60800
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60422
60801
|
if (hasRequiredArgs) {
|
|
60423
60802
|
ctx.reportError(
|
|
60424
|
-
new
|
|
60803
|
+
new graphql25.GraphQLError(
|
|
60425
60804
|
"@paginate cannot appear on a document with required args"
|
|
60426
60805
|
)
|
|
60427
60806
|
);
|
|
@@ -60453,14 +60832,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60453
60832
|
const backwards = appliedArgs.has("last");
|
|
60454
60833
|
if (!forward && !backwards) {
|
|
60455
60834
|
ctx.reportError(
|
|
60456
|
-
new
|
|
60835
|
+
new graphql25.GraphQLError(
|
|
60457
60836
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60458
60837
|
)
|
|
60459
60838
|
);
|
|
60460
60839
|
}
|
|
60461
60840
|
if (forward && backwards) {
|
|
60462
60841
|
ctx.reportError(
|
|
60463
|
-
new
|
|
60842
|
+
new graphql25.GraphQLError(
|
|
60464
60843
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60465
60844
|
)
|
|
60466
60845
|
);
|
|
@@ -60474,7 +60853,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60474
60853
|
);
|
|
60475
60854
|
if (!appliedLimitArg) {
|
|
60476
60855
|
ctx.reportError(
|
|
60477
|
-
new
|
|
60856
|
+
new graphql25.GraphQLError(
|
|
60478
60857
|
"A field with offset-based pagination must have a limit argument"
|
|
60479
60858
|
)
|
|
60480
60859
|
);
|
|
@@ -60490,20 +60869,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60490
60869
|
const args = /* @__PURE__ */ new Set();
|
|
60491
60870
|
return {
|
|
60492
60871
|
enter(node) {
|
|
60493
|
-
if (node.kind ===
|
|
60872
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
60494
60873
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60495
60874
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60496
60875
|
args.add(arg);
|
|
60497
60876
|
}
|
|
60498
|
-
} else if (node.kind ===
|
|
60877
|
+
} else if (node.kind === graphql25.Kind.VARIABLE) {
|
|
60499
60878
|
args.delete(node.name.value);
|
|
60500
60879
|
}
|
|
60501
60880
|
},
|
|
60502
60881
|
leave(node) {
|
|
60503
|
-
if (node.kind ===
|
|
60882
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
60504
60883
|
if (args.size > 0) {
|
|
60505
60884
|
ctx.reportError(
|
|
60506
|
-
new
|
|
60885
|
+
new graphql25.GraphQLError(
|
|
60507
60886
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60508
60887
|
)
|
|
60509
60888
|
);
|
|
@@ -60539,7 +60918,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60539
60918
|
if (definition.kind === "OperationDefinition") {
|
|
60540
60919
|
if (definition.operation !== "query") {
|
|
60541
60920
|
ctx.reportError(
|
|
60542
|
-
new
|
|
60921
|
+
new graphql25.GraphQLError(
|
|
60543
60922
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60544
60923
|
)
|
|
60545
60924
|
);
|
|
@@ -60551,7 +60930,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60551
60930
|
}
|
|
60552
60931
|
if (!possibleNodes.includes(definitionType)) {
|
|
60553
60932
|
ctx.reportError(
|
|
60554
|
-
new
|
|
60933
|
+
new graphql25.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60555
60934
|
);
|
|
60556
60935
|
}
|
|
60557
60936
|
}
|
|
@@ -60570,7 +60949,7 @@ function checkMutationOperation(config2) {
|
|
|
60570
60949
|
);
|
|
60571
60950
|
if (append && prepend) {
|
|
60572
60951
|
ctx.reportError(
|
|
60573
|
-
new
|
|
60952
|
+
new graphql25.GraphQLError(
|
|
60574
60953
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60575
60954
|
)
|
|
60576
60955
|
);
|
|
@@ -60584,7 +60963,7 @@ function checkMutationOperation(config2) {
|
|
|
60584
60963
|
);
|
|
60585
60964
|
if (parentId && allLists) {
|
|
60586
60965
|
ctx.reportError(
|
|
60587
|
-
new
|
|
60966
|
+
new graphql25.GraphQLError(
|
|
60588
60967
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60589
60968
|
)
|
|
60590
60969
|
);
|
|
@@ -60606,7 +60985,7 @@ function checkMaskDirective(config2) {
|
|
|
60606
60985
|
);
|
|
60607
60986
|
if (maskEnableDirective && maskDisableDirective) {
|
|
60608
60987
|
ctx.reportError(
|
|
60609
|
-
new
|
|
60988
|
+
new graphql25.GraphQLError(
|
|
60610
60989
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
60611
60990
|
)
|
|
60612
60991
|
);
|
|
@@ -60622,7 +61001,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
60622
61001
|
if (!nodeInterface) {
|
|
60623
61002
|
return null;
|
|
60624
61003
|
}
|
|
60625
|
-
if (!
|
|
61004
|
+
if (!graphql25.isInterfaceType(nodeInterface)) {
|
|
60626
61005
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
60627
61006
|
return null;
|
|
60628
61007
|
}
|
|
@@ -60720,11 +61099,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
60720
61099
|
}
|
|
60721
61100
|
|
|
60722
61101
|
// src/codegen/validators/noIDAlias.ts
|
|
60723
|
-
var
|
|
61102
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
60724
61103
|
async function noIDAlias(config2, docs) {
|
|
60725
61104
|
const errors = [];
|
|
60726
61105
|
for (const { filename, document } of docs) {
|
|
60727
|
-
|
|
61106
|
+
graphql26.visit(document, {
|
|
60728
61107
|
Field(node, _, __, ___, ancestors) {
|
|
60729
61108
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
60730
61109
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -60892,11 +61271,12 @@ function testConfigFile(config2 = {}) {
|
|
|
60892
61271
|
return {
|
|
60893
61272
|
schema: `
|
|
60894
61273
|
scalar Cursor
|
|
60895
|
-
|
|
61274
|
+
scalar DateTime
|
|
60896
61275
|
|
|
60897
61276
|
type User implements Node & Friend & CatOwner {
|
|
60898
61277
|
id: ID!
|
|
60899
61278
|
name: String!
|
|
61279
|
+
birthday: DateTime!
|
|
60900
61280
|
firstName: String!
|
|
60901
61281
|
friends: [User!]!
|
|
60902
61282
|
friendsByCursor(first: Int, after: String, last: Int, before: String, filter: String): UserConnection!
|
|
@@ -60948,6 +61328,7 @@ function testConfigFile(config2 = {}) {
|
|
|
60948
61328
|
ghostsByCursor(first: Int, after: String, last: Int, before: String): IsGhostConnection!
|
|
60949
61329
|
entitiesByCursor(first: Int, after: String, last: Int, before: String): EntityConnection!
|
|
60950
61330
|
node(id: ID!): Node
|
|
61331
|
+
customIdList: [CustomIdType]!
|
|
60951
61332
|
}
|
|
60952
61333
|
|
|
60953
61334
|
type PageInfo {
|
|
@@ -61081,11 +61462,20 @@ function testConfigFile(config2 = {}) {
|
|
|
61081
61462
|
Value3
|
|
61082
61463
|
Value2
|
|
61083
61464
|
}
|
|
61465
|
+
|
|
61466
|
+
type CustomIdType {
|
|
61467
|
+
foo: String!
|
|
61468
|
+
bar: String!
|
|
61469
|
+
dummy: String
|
|
61470
|
+
}
|
|
61084
61471
|
`,
|
|
61085
61472
|
scalars: {
|
|
61086
61473
|
DateTime: {
|
|
61087
61474
|
type: "Date",
|
|
61088
61475
|
unmarshal(val) {
|
|
61476
|
+
if (typeof val !== "number") {
|
|
61477
|
+
throw new Error("unmarshaling not a number");
|
|
61478
|
+
}
|
|
61089
61479
|
return new Date(val);
|
|
61090
61480
|
},
|
|
61091
61481
|
marshal(date) {
|
|
@@ -61100,6 +61490,9 @@ function testConfigFile(config2 = {}) {
|
|
|
61100
61490
|
resolve: {
|
|
61101
61491
|
queryField: "ghost"
|
|
61102
61492
|
}
|
|
61493
|
+
},
|
|
61494
|
+
CustomIdType: {
|
|
61495
|
+
keys: ["foo", "bar"]
|
|
61103
61496
|
}
|
|
61104
61497
|
},
|
|
61105
61498
|
logLevel: "quiet",
|
|
@@ -61108,6 +61501,7 @@ function testConfigFile(config2 = {}) {
|
|
|
61108
61501
|
client: "./my/client/path"
|
|
61109
61502
|
}
|
|
61110
61503
|
},
|
|
61504
|
+
acceptImperativeInstability: true,
|
|
61111
61505
|
...config2
|
|
61112
61506
|
};
|
|
61113
61507
|
}
|
|
@@ -61139,7 +61533,7 @@ function pipelineTest(config2, documents, shouldPass, testBody) {
|
|
|
61139
61533
|
};
|
|
61140
61534
|
}
|
|
61141
61535
|
function mockCollectedDoc(query) {
|
|
61142
|
-
const parsed =
|
|
61536
|
+
const parsed = graphql27.parse(query);
|
|
61143
61537
|
const name2 = parsed.definitions[0].name.value;
|
|
61144
61538
|
const operations = parsed.definitions;
|
|
61145
61539
|
let kind = "HoudiniFragment" /* Fragment */;
|