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-cjs/index.js
CHANGED
|
@@ -529,7 +529,7 @@ var require_kinds = __commonJS({
|
|
|
529
529
|
value: true
|
|
530
530
|
});
|
|
531
531
|
exports.Kind = void 0;
|
|
532
|
-
var
|
|
532
|
+
var Kind13 = Object.freeze({
|
|
533
533
|
NAME: "Name",
|
|
534
534
|
DOCUMENT: "Document",
|
|
535
535
|
OPERATION_DEFINITION: "OperationDefinition",
|
|
@@ -574,7 +574,7 @@ var require_kinds = __commonJS({
|
|
|
574
574
|
ENUM_TYPE_EXTENSION: "EnumTypeExtension",
|
|
575
575
|
INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension"
|
|
576
576
|
});
|
|
577
|
-
exports.Kind =
|
|
577
|
+
exports.Kind = Kind13;
|
|
578
578
|
}
|
|
579
579
|
});
|
|
580
580
|
|
|
@@ -1972,12 +1972,12 @@ var require_parser = __commonJS({
|
|
|
1972
1972
|
return [];
|
|
1973
1973
|
}
|
|
1974
1974
|
if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) {
|
|
1975
|
-
var
|
|
1975
|
+
var types14 = [];
|
|
1976
1976
|
this.expectOptionalToken(_tokenKind.TokenKind.AMP);
|
|
1977
1977
|
do {
|
|
1978
|
-
|
|
1978
|
+
types14.push(this.parseNamedType());
|
|
1979
1979
|
} while (this.expectOptionalToken(_tokenKind.TokenKind.AMP) || this.peek(_tokenKind.TokenKind.NAME));
|
|
1980
|
-
return
|
|
1980
|
+
return types14;
|
|
1981
1981
|
}
|
|
1982
1982
|
return this.delimitedMany(_tokenKind.TokenKind.AMP, this.parseNamedType);
|
|
1983
1983
|
};
|
|
@@ -2056,13 +2056,13 @@ var require_parser = __commonJS({
|
|
|
2056
2056
|
this.expectKeyword("union");
|
|
2057
2057
|
var name2 = this.parseName();
|
|
2058
2058
|
var directives = this.parseDirectives(true);
|
|
2059
|
-
var
|
|
2059
|
+
var types14 = this.parseUnionMemberTypes();
|
|
2060
2060
|
return {
|
|
2061
2061
|
kind: _kinds.Kind.UNION_TYPE_DEFINITION,
|
|
2062
2062
|
description,
|
|
2063
2063
|
name: name2,
|
|
2064
2064
|
directives,
|
|
2065
|
-
types:
|
|
2065
|
+
types: types14,
|
|
2066
2066
|
loc: this.loc(start)
|
|
2067
2067
|
};
|
|
2068
2068
|
};
|
|
@@ -2220,15 +2220,15 @@ var require_parser = __commonJS({
|
|
|
2220
2220
|
this.expectKeyword("union");
|
|
2221
2221
|
var name2 = this.parseName();
|
|
2222
2222
|
var directives = this.parseDirectives(true);
|
|
2223
|
-
var
|
|
2224
|
-
if (directives.length === 0 &&
|
|
2223
|
+
var types14 = this.parseUnionMemberTypes();
|
|
2224
|
+
if (directives.length === 0 && types14.length === 0) {
|
|
2225
2225
|
throw this.unexpected();
|
|
2226
2226
|
}
|
|
2227
2227
|
return {
|
|
2228
2228
|
kind: _kinds.Kind.UNION_TYPE_EXTENSION,
|
|
2229
2229
|
name: name2,
|
|
2230
2230
|
directives,
|
|
2231
|
-
types:
|
|
2231
|
+
types: types14,
|
|
2232
2232
|
loc: this.loc(start)
|
|
2233
2233
|
};
|
|
2234
2234
|
};
|
|
@@ -2398,7 +2398,7 @@ var require_visitor = __commonJS({
|
|
|
2398
2398
|
Object.defineProperty(exports, "__esModule", {
|
|
2399
2399
|
value: true
|
|
2400
2400
|
});
|
|
2401
|
-
exports.visit =
|
|
2401
|
+
exports.visit = visit12;
|
|
2402
2402
|
exports.visitInParallel = visitInParallel;
|
|
2403
2403
|
exports.getVisitFn = getVisitFn;
|
|
2404
2404
|
exports.BREAK = exports.QueryDocumentKeys = void 0;
|
|
@@ -2461,7 +2461,7 @@ var require_visitor = __commonJS({
|
|
|
2461
2461
|
exports.QueryDocumentKeys = QueryDocumentKeys;
|
|
2462
2462
|
var BREAK = Object.freeze({});
|
|
2463
2463
|
exports.BREAK = BREAK;
|
|
2464
|
-
function
|
|
2464
|
+
function visit12(root, visitor) {
|
|
2465
2465
|
var visitorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : QueryDocumentKeys;
|
|
2466
2466
|
var stack = void 0;
|
|
2467
2467
|
var inArray = Array.isArray(root);
|
|
@@ -3206,8 +3206,8 @@ var require_printer = __commonJS({
|
|
|
3206
3206
|
return join2(["interface", name2, wrap("implements ", join2(interfaces, " & ")), join2(directives, " "), block(fields)], " ");
|
|
3207
3207
|
}),
|
|
3208
3208
|
UnionTypeDefinition: addDescription(function(_ref27) {
|
|
3209
|
-
var name2 = _ref27.name, directives = _ref27.directives,
|
|
3210
|
-
return join2(["union", name2, join2(directives, " "),
|
|
3209
|
+
var name2 = _ref27.name, directives = _ref27.directives, types14 = _ref27.types;
|
|
3210
|
+
return join2(["union", name2, join2(directives, " "), types14 && types14.length !== 0 ? "= " + join2(types14, " | ") : ""], " ");
|
|
3211
3211
|
}),
|
|
3212
3212
|
EnumTypeDefinition: addDescription(function(_ref28) {
|
|
3213
3213
|
var name2 = _ref28.name, directives = _ref28.directives, values = _ref28.values;
|
|
@@ -3242,8 +3242,8 @@ var require_printer = __commonJS({
|
|
|
3242
3242
|
return join2(["extend interface", name2, wrap("implements ", join2(interfaces, " & ")), join2(directives, " "), block(fields)], " ");
|
|
3243
3243
|
},
|
|
3244
3244
|
UnionTypeExtension: function UnionTypeExtension(_ref36) {
|
|
3245
|
-
var name2 = _ref36.name, directives = _ref36.directives,
|
|
3246
|
-
return join2(["extend union", name2, join2(directives, " "),
|
|
3245
|
+
var name2 = _ref36.name, directives = _ref36.directives, types14 = _ref36.types;
|
|
3246
|
+
return join2(["extend union", name2, join2(directives, " "), types14 && types14.length !== 0 ? "= " + join2(types14, " | ") : ""], " ");
|
|
3247
3247
|
},
|
|
3248
3248
|
EnumTypeExtension: function EnumTypeExtension(_ref37) {
|
|
3249
3249
|
var name2 = _ref37.name, directives = _ref37.directives, values = _ref37.values;
|
|
@@ -3339,17 +3339,17 @@ var require_definition = __commonJS({
|
|
|
3339
3339
|
});
|
|
3340
3340
|
exports.isType = isType;
|
|
3341
3341
|
exports.assertType = assertType;
|
|
3342
|
-
exports.isScalarType =
|
|
3342
|
+
exports.isScalarType = isScalarType7;
|
|
3343
3343
|
exports.assertScalarType = assertScalarType;
|
|
3344
|
-
exports.isObjectType =
|
|
3344
|
+
exports.isObjectType = isObjectType3;
|
|
3345
3345
|
exports.assertObjectType = assertObjectType;
|
|
3346
3346
|
exports.isInterfaceType = isInterfaceType6;
|
|
3347
3347
|
exports.assertInterfaceType = assertInterfaceType;
|
|
3348
3348
|
exports.isUnionType = isUnionType7;
|
|
3349
3349
|
exports.assertUnionType = assertUnionType;
|
|
3350
|
-
exports.isEnumType =
|
|
3350
|
+
exports.isEnumType = isEnumType5;
|
|
3351
3351
|
exports.assertEnumType = assertEnumType;
|
|
3352
|
-
exports.isInputObjectType =
|
|
3352
|
+
exports.isInputObjectType = isInputObjectType2;
|
|
3353
3353
|
exports.assertInputObjectType = assertInputObjectType;
|
|
3354
3354
|
exports.isListType = isListType3;
|
|
3355
3355
|
exports.assertListType = assertListType;
|
|
@@ -3363,7 +3363,7 @@ var require_definition = __commonJS({
|
|
|
3363
3363
|
exports.assertLeafType = assertLeafType;
|
|
3364
3364
|
exports.isCompositeType = isCompositeType;
|
|
3365
3365
|
exports.assertCompositeType = assertCompositeType;
|
|
3366
|
-
exports.isAbstractType =
|
|
3366
|
+
exports.isAbstractType = isAbstractType3;
|
|
3367
3367
|
exports.assertAbstractType = assertAbstractType;
|
|
3368
3368
|
exports.GraphQLList = GraphQLList2;
|
|
3369
3369
|
exports.GraphQLNonNull = GraphQLNonNull2;
|
|
@@ -3418,7 +3418,7 @@ var require_definition = __commonJS({
|
|
|
3418
3418
|
return Constructor;
|
|
3419
3419
|
}
|
|
3420
3420
|
function isType(type) {
|
|
3421
|
-
return
|
|
3421
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isInputObjectType2(type) || isListType3(type) || isNonNullType6(type);
|
|
3422
3422
|
}
|
|
3423
3423
|
function assertType(type) {
|
|
3424
3424
|
if (!isType(type)) {
|
|
@@ -3426,20 +3426,20 @@ var require_definition = __commonJS({
|
|
|
3426
3426
|
}
|
|
3427
3427
|
return type;
|
|
3428
3428
|
}
|
|
3429
|
-
function
|
|
3429
|
+
function isScalarType7(type) {
|
|
3430
3430
|
return (0, _instanceOf.default)(type, GraphQLScalarType);
|
|
3431
3431
|
}
|
|
3432
3432
|
function assertScalarType(type) {
|
|
3433
|
-
if (!
|
|
3433
|
+
if (!isScalarType7(type)) {
|
|
3434
3434
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Scalar type."));
|
|
3435
3435
|
}
|
|
3436
3436
|
return type;
|
|
3437
3437
|
}
|
|
3438
|
-
function
|
|
3438
|
+
function isObjectType3(type) {
|
|
3439
3439
|
return (0, _instanceOf.default)(type, GraphQLObjectType2);
|
|
3440
3440
|
}
|
|
3441
3441
|
function assertObjectType(type) {
|
|
3442
|
-
if (!
|
|
3442
|
+
if (!isObjectType3(type)) {
|
|
3443
3443
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Object type."));
|
|
3444
3444
|
}
|
|
3445
3445
|
return type;
|
|
@@ -3462,20 +3462,20 @@ var require_definition = __commonJS({
|
|
|
3462
3462
|
}
|
|
3463
3463
|
return type;
|
|
3464
3464
|
}
|
|
3465
|
-
function
|
|
3465
|
+
function isEnumType5(type) {
|
|
3466
3466
|
return (0, _instanceOf.default)(type, GraphQLEnumType);
|
|
3467
3467
|
}
|
|
3468
3468
|
function assertEnumType(type) {
|
|
3469
|
-
if (!
|
|
3469
|
+
if (!isEnumType5(type)) {
|
|
3470
3470
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
|
|
3471
3471
|
}
|
|
3472
3472
|
return type;
|
|
3473
3473
|
}
|
|
3474
|
-
function
|
|
3474
|
+
function isInputObjectType2(type) {
|
|
3475
3475
|
return (0, _instanceOf.default)(type, GraphQLInputObjectType);
|
|
3476
3476
|
}
|
|
3477
3477
|
function assertInputObjectType(type) {
|
|
3478
|
-
if (!
|
|
3478
|
+
if (!isInputObjectType2(type)) {
|
|
3479
3479
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Input Object type."));
|
|
3480
3480
|
}
|
|
3481
3481
|
return type;
|
|
@@ -3499,7 +3499,7 @@ var require_definition = __commonJS({
|
|
|
3499
3499
|
return type;
|
|
3500
3500
|
}
|
|
3501
3501
|
function isInputType(type) {
|
|
3502
|
-
return
|
|
3502
|
+
return isScalarType7(type) || isEnumType5(type) || isInputObjectType2(type) || isWrappingType(type) && isInputType(type.ofType);
|
|
3503
3503
|
}
|
|
3504
3504
|
function assertInputType(type) {
|
|
3505
3505
|
if (!isInputType(type)) {
|
|
@@ -3508,7 +3508,7 @@ var require_definition = __commonJS({
|
|
|
3508
3508
|
return type;
|
|
3509
3509
|
}
|
|
3510
3510
|
function isOutputType(type) {
|
|
3511
|
-
return
|
|
3511
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
3512
3512
|
}
|
|
3513
3513
|
function assertOutputType(type) {
|
|
3514
3514
|
if (!isOutputType(type)) {
|
|
@@ -3517,7 +3517,7 @@ var require_definition = __commonJS({
|
|
|
3517
3517
|
return type;
|
|
3518
3518
|
}
|
|
3519
3519
|
function isLeafType(type) {
|
|
3520
|
-
return
|
|
3520
|
+
return isScalarType7(type) || isEnumType5(type);
|
|
3521
3521
|
}
|
|
3522
3522
|
function assertLeafType(type) {
|
|
3523
3523
|
if (!isLeafType(type)) {
|
|
@@ -3526,7 +3526,7 @@ var require_definition = __commonJS({
|
|
|
3526
3526
|
return type;
|
|
3527
3527
|
}
|
|
3528
3528
|
function isCompositeType(type) {
|
|
3529
|
-
return
|
|
3529
|
+
return isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type);
|
|
3530
3530
|
}
|
|
3531
3531
|
function assertCompositeType(type) {
|
|
3532
3532
|
if (!isCompositeType(type)) {
|
|
@@ -3534,11 +3534,11 @@ var require_definition = __commonJS({
|
|
|
3534
3534
|
}
|
|
3535
3535
|
return type;
|
|
3536
3536
|
}
|
|
3537
|
-
function
|
|
3537
|
+
function isAbstractType3(type) {
|
|
3538
3538
|
return isInterfaceType6(type) || isUnionType7(type);
|
|
3539
3539
|
}
|
|
3540
3540
|
function assertAbstractType(type) {
|
|
3541
|
-
if (!
|
|
3541
|
+
if (!isAbstractType3(type)) {
|
|
3542
3542
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL abstract type."));
|
|
3543
3543
|
}
|
|
3544
3544
|
return type;
|
|
@@ -3605,7 +3605,7 @@ var require_definition = __commonJS({
|
|
|
3605
3605
|
}
|
|
3606
3606
|
}
|
|
3607
3607
|
function isNamedType(type) {
|
|
3608
|
-
return
|
|
3608
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isInputObjectType2(type);
|
|
3609
3609
|
}
|
|
3610
3610
|
function assertNamedType(type) {
|
|
3611
3611
|
if (!isNamedType(type)) {
|
|
@@ -3914,9 +3914,9 @@ var require_definition = __commonJS({
|
|
|
3914
3914
|
exports.GraphQLUnionType = GraphQLUnionType;
|
|
3915
3915
|
(0, _defineInspect.default)(GraphQLUnionType);
|
|
3916
3916
|
function defineTypes(config2) {
|
|
3917
|
-
var
|
|
3918
|
-
Array.isArray(
|
|
3919
|
-
return
|
|
3917
|
+
var types14 = resolveThunk(config2.types);
|
|
3918
|
+
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, "."));
|
|
3919
|
+
return types14;
|
|
3920
3920
|
}
|
|
3921
3921
|
var GraphQLEnumType = /* @__PURE__ */ function() {
|
|
3922
3922
|
function GraphQLEnumType2(config2) {
|
|
@@ -9754,7 +9754,7 @@ var require_graphql = __commonJS({
|
|
|
9754
9754
|
Object.defineProperty(exports, "__esModule", {
|
|
9755
9755
|
value: true
|
|
9756
9756
|
});
|
|
9757
|
-
exports.graphql =
|
|
9757
|
+
exports.graphql = graphql28;
|
|
9758
9758
|
exports.graphqlSync = graphqlSync;
|
|
9759
9759
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
9760
9760
|
var _parser = require_parser();
|
|
@@ -9764,7 +9764,7 @@ var require_graphql = __commonJS({
|
|
|
9764
9764
|
function _interopRequireDefault(obj) {
|
|
9765
9765
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
9766
9766
|
}
|
|
9767
|
-
function
|
|
9767
|
+
function graphql28(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
9768
9768
|
var _arguments = arguments;
|
|
9769
9769
|
return new Promise(function(resolve2) {
|
|
9770
9770
|
return resolve2(
|
|
@@ -11553,7 +11553,7 @@ var require_buildClientSchema = __commonJS({
|
|
|
11553
11553
|
return new _definition.GraphQLUnionType({
|
|
11554
11554
|
name: unionIntrospection.name,
|
|
11555
11555
|
description: unionIntrospection.description,
|
|
11556
|
-
types: function
|
|
11556
|
+
types: function types14() {
|
|
11557
11557
|
return unionIntrospection.possibleTypes.map(getObjectType);
|
|
11558
11558
|
}
|
|
11559
11559
|
});
|
|
@@ -11898,7 +11898,7 @@ var require_extendSchema = __commonJS({
|
|
|
11898
11898
|
var config2 = type.toConfig();
|
|
11899
11899
|
var extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config2.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : [];
|
|
11900
11900
|
return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, config2), {}, {
|
|
11901
|
-
types: function
|
|
11901
|
+
types: function types14() {
|
|
11902
11902
|
return [].concat(type.getTypes().map(replaceNamedType), buildUnionTypes(extensions));
|
|
11903
11903
|
},
|
|
11904
11904
|
extensionASTNodes: config2.extensionASTNodes.concat(extensions)
|
|
@@ -12046,17 +12046,17 @@ var require_extendSchema = __commonJS({
|
|
|
12046
12046
|
return interfaces;
|
|
12047
12047
|
}
|
|
12048
12048
|
function buildUnionTypes(nodes) {
|
|
12049
|
-
var
|
|
12049
|
+
var types14 = [];
|
|
12050
12050
|
for (var _i32 = 0; _i32 < nodes.length; _i32++) {
|
|
12051
12051
|
var _node$types;
|
|
12052
12052
|
var node = nodes[_i32];
|
|
12053
12053
|
var typeNodes = (_node$types = node.types) !== null && _node$types !== void 0 ? _node$types : [];
|
|
12054
12054
|
for (var _i34 = 0; _i34 < typeNodes.length; _i34++) {
|
|
12055
12055
|
var type = typeNodes[_i34];
|
|
12056
|
-
|
|
12056
|
+
types14.push(getNamedType2(type));
|
|
12057
12057
|
}
|
|
12058
12058
|
}
|
|
12059
|
-
return
|
|
12059
|
+
return types14;
|
|
12060
12060
|
}
|
|
12061
12061
|
function buildType(astNode) {
|
|
12062
12062
|
var _typeExtensionsMap$na;
|
|
@@ -12113,7 +12113,7 @@ var require_extendSchema = __commonJS({
|
|
|
12113
12113
|
return new _definition.GraphQLUnionType({
|
|
12114
12114
|
name: name3,
|
|
12115
12115
|
description,
|
|
12116
|
-
types: function
|
|
12116
|
+
types: function types14() {
|
|
12117
12117
|
return buildUnionTypes(_allNodes3);
|
|
12118
12118
|
},
|
|
12119
12119
|
astNode,
|
|
@@ -12411,7 +12411,7 @@ var require_lexicographicSortSchema = __commonJS({
|
|
|
12411
12411
|
if ((0, _definition.isUnionType)(type)) {
|
|
12412
12412
|
var _config2 = type.toConfig();
|
|
12413
12413
|
return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, _config2), {}, {
|
|
12414
|
-
types: function
|
|
12414
|
+
types: function types14() {
|
|
12415
12415
|
return sortTypes(_config2.types);
|
|
12416
12416
|
}
|
|
12417
12417
|
}));
|
|
@@ -12496,10 +12496,10 @@ var require_printSchema = __commonJS({
|
|
|
12496
12496
|
}
|
|
12497
12497
|
function printFilteredSchema(schema, directiveFilter, typeFilter, options) {
|
|
12498
12498
|
var directives = schema.getDirectives().filter(directiveFilter);
|
|
12499
|
-
var
|
|
12499
|
+
var types14 = (0, _objectValues.default)(schema.getTypeMap()).filter(typeFilter);
|
|
12500
12500
|
return [printSchemaDefinition(schema)].concat(directives.map(function(directive) {
|
|
12501
12501
|
return printDirective(directive, options);
|
|
12502
|
-
}),
|
|
12502
|
+
}), types14.map(function(type) {
|
|
12503
12503
|
return printType(type, options);
|
|
12504
12504
|
})).filter(Boolean).join("\n\n") + "\n";
|
|
12505
12505
|
}
|
|
@@ -12574,8 +12574,8 @@ var require_printSchema = __commonJS({
|
|
|
12574
12574
|
return printDescription(options, type) + "interface ".concat(type.name) + printImplementedInterfaces(type) + printFields(options, type);
|
|
12575
12575
|
}
|
|
12576
12576
|
function printUnion(type, options) {
|
|
12577
|
-
var
|
|
12578
|
-
var possibleTypes =
|
|
12577
|
+
var types14 = type.getTypes();
|
|
12578
|
+
var possibleTypes = types14.length ? " = " + types14.join(" | ") : "";
|
|
12579
12579
|
return printDescription(options, type) + "union " + type.name + possibleTypes;
|
|
12580
12580
|
}
|
|
12581
12581
|
function printEnum(type, options) {
|
|
@@ -23903,14 +23903,14 @@ var require_lib3 = __commonJS({
|
|
|
23903
23903
|
this.preserveSpace = !!preserveSpace;
|
|
23904
23904
|
}
|
|
23905
23905
|
};
|
|
23906
|
-
var
|
|
23906
|
+
var types14 = {
|
|
23907
23907
|
brace: new TokContext("{"),
|
|
23908
23908
|
j_oTag: new TokContext("<tag"),
|
|
23909
23909
|
j_cTag: new TokContext("</tag"),
|
|
23910
23910
|
j_expr: new TokContext("<tag>...</tag>", true)
|
|
23911
23911
|
};
|
|
23912
23912
|
{
|
|
23913
|
-
|
|
23913
|
+
types14.template = new TokContext("`", true);
|
|
23914
23914
|
}
|
|
23915
23915
|
var beforeExpr = true;
|
|
23916
23916
|
var startsExpr = true;
|
|
@@ -24442,17 +24442,17 @@ var require_lib3 = __commonJS({
|
|
|
24442
24442
|
context.pop();
|
|
24443
24443
|
};
|
|
24444
24444
|
tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = (context) => {
|
|
24445
|
-
context.push(
|
|
24445
|
+
context.push(types14.brace);
|
|
24446
24446
|
};
|
|
24447
24447
|
tokenTypes[22].updateContext = (context) => {
|
|
24448
|
-
if (context[context.length - 1] ===
|
|
24448
|
+
if (context[context.length - 1] === types14.template) {
|
|
24449
24449
|
context.pop();
|
|
24450
24450
|
} else {
|
|
24451
|
-
context.push(
|
|
24451
|
+
context.push(types14.template);
|
|
24452
24452
|
}
|
|
24453
24453
|
};
|
|
24454
24454
|
tokenTypes[140].updateContext = (context) => {
|
|
24455
|
-
context.push(
|
|
24455
|
+
context.push(types14.j_expr, types14.j_oTag);
|
|
24456
24456
|
};
|
|
24457
24457
|
}
|
|
24458
24458
|
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";
|
|
@@ -25093,7 +25093,7 @@ var require_lib3 = __commonJS({
|
|
|
25093
25093
|
this.lastTokEndLoc = null;
|
|
25094
25094
|
this.lastTokStartLoc = null;
|
|
25095
25095
|
this.lastTokStart = 0;
|
|
25096
|
-
this.context = [
|
|
25096
|
+
this.context = [types14.brace];
|
|
25097
25097
|
this.canStartJSXElement = true;
|
|
25098
25098
|
this.containsEsc = false;
|
|
25099
25099
|
this.firstInvalidTemplateEscapePos = null;
|
|
@@ -29017,7 +29017,7 @@ var require_lib3 = __commonJS({
|
|
|
29017
29017
|
context
|
|
29018
29018
|
} = this.state;
|
|
29019
29019
|
const currentContext = context[context.length - 1];
|
|
29020
|
-
if (currentContext ===
|
|
29020
|
+
if (currentContext === types14.j_oTag || currentContext === types14.j_expr) {
|
|
29021
29021
|
context.pop();
|
|
29022
29022
|
}
|
|
29023
29023
|
}
|
|
@@ -30077,9 +30077,9 @@ var require_lib3 = __commonJS({
|
|
|
30077
30077
|
switch (this.state.type) {
|
|
30078
30078
|
case 5:
|
|
30079
30079
|
node = this.startNode();
|
|
30080
|
-
this.setContext(
|
|
30080
|
+
this.setContext(types14.brace);
|
|
30081
30081
|
this.next();
|
|
30082
|
-
node = this.jsxParseExpressionContainer(node,
|
|
30082
|
+
node = this.jsxParseExpressionContainer(node, types14.j_oTag);
|
|
30083
30083
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
30084
30084
|
this.raise(JsxErrors.AttributeIsEmpty, {
|
|
30085
30085
|
at: node
|
|
@@ -30102,7 +30102,7 @@ var require_lib3 = __commonJS({
|
|
|
30102
30102
|
jsxParseSpreadChild(node) {
|
|
30103
30103
|
this.next();
|
|
30104
30104
|
node.expression = this.parseExpression();
|
|
30105
|
-
this.setContext(
|
|
30105
|
+
this.setContext(types14.j_expr);
|
|
30106
30106
|
this.state.canStartJSXElement = true;
|
|
30107
30107
|
this.expect(8);
|
|
30108
30108
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -30122,11 +30122,11 @@ var require_lib3 = __commonJS({
|
|
|
30122
30122
|
jsxParseAttribute() {
|
|
30123
30123
|
const node = this.startNode();
|
|
30124
30124
|
if (this.match(5)) {
|
|
30125
|
-
this.setContext(
|
|
30125
|
+
this.setContext(types14.brace);
|
|
30126
30126
|
this.next();
|
|
30127
30127
|
this.expect(21);
|
|
30128
30128
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
30129
|
-
this.setContext(
|
|
30129
|
+
this.setContext(types14.j_oTag);
|
|
30130
30130
|
this.state.canStartJSXElement = true;
|
|
30131
30131
|
this.expect(8);
|
|
30132
30132
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
@@ -30185,12 +30185,12 @@ var require_lib3 = __commonJS({
|
|
|
30185
30185
|
break;
|
|
30186
30186
|
case 5: {
|
|
30187
30187
|
const node2 = this.startNode();
|
|
30188
|
-
this.setContext(
|
|
30188
|
+
this.setContext(types14.brace);
|
|
30189
30189
|
this.next();
|
|
30190
30190
|
if (this.match(21)) {
|
|
30191
30191
|
children.push(this.jsxParseSpreadChild(node2));
|
|
30192
30192
|
} else {
|
|
30193
|
-
children.push(this.jsxParseExpressionContainer(node2,
|
|
30193
|
+
children.push(this.jsxParseExpressionContainer(node2, types14.j_expr));
|
|
30194
30194
|
}
|
|
30195
30195
|
break;
|
|
30196
30196
|
}
|
|
@@ -30261,10 +30261,10 @@ var require_lib3 = __commonJS({
|
|
|
30261
30261
|
}
|
|
30262
30262
|
getTokenFromCode(code) {
|
|
30263
30263
|
const context = this.curContext();
|
|
30264
|
-
if (context ===
|
|
30264
|
+
if (context === types14.j_expr) {
|
|
30265
30265
|
return this.jsxReadToken();
|
|
30266
30266
|
}
|
|
30267
|
-
if (context ===
|
|
30267
|
+
if (context === types14.j_oTag || context === types14.j_cTag) {
|
|
30268
30268
|
if (isIdentifierStart(code)) {
|
|
30269
30269
|
return this.jsxReadWord();
|
|
30270
30270
|
}
|
|
@@ -30272,7 +30272,7 @@ var require_lib3 = __commonJS({
|
|
|
30272
30272
|
++this.state.pos;
|
|
30273
30273
|
return this.finishToken(141);
|
|
30274
30274
|
}
|
|
30275
|
-
if ((code === 34 || code === 39) && context ===
|
|
30275
|
+
if ((code === 34 || code === 39) && context === types14.j_oTag) {
|
|
30276
30276
|
return this.jsxReadString(code);
|
|
30277
30277
|
}
|
|
30278
30278
|
}
|
|
@@ -30288,17 +30288,17 @@ var require_lib3 = __commonJS({
|
|
|
30288
30288
|
type
|
|
30289
30289
|
} = this.state;
|
|
30290
30290
|
if (type === 56 && prevType === 140) {
|
|
30291
|
-
context.splice(-2, 2,
|
|
30291
|
+
context.splice(-2, 2, types14.j_cTag);
|
|
30292
30292
|
this.state.canStartJSXElement = false;
|
|
30293
30293
|
} else if (type === 140) {
|
|
30294
|
-
context.push(
|
|
30294
|
+
context.push(types14.j_oTag);
|
|
30295
30295
|
} else if (type === 141) {
|
|
30296
30296
|
const out = context[context.length - 1];
|
|
30297
|
-
if (out ===
|
|
30297
|
+
if (out === types14.j_oTag && prevType === 56 || out === types14.j_cTag) {
|
|
30298
30298
|
context.pop();
|
|
30299
|
-
this.state.canStartJSXElement = context[context.length - 1] ===
|
|
30299
|
+
this.state.canStartJSXElement = context[context.length - 1] === types14.j_expr;
|
|
30300
30300
|
} else {
|
|
30301
|
-
this.setContext(
|
|
30301
|
+
this.setContext(types14.j_expr);
|
|
30302
30302
|
this.state.canStartJSXElement = true;
|
|
30303
30303
|
}
|
|
30304
30304
|
} else {
|
|
@@ -31305,14 +31305,14 @@ var require_lib3 = __commonJS({
|
|
|
31305
31305
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
31306
31306
|
const node = this.startNode();
|
|
31307
31307
|
const hasLeadingOperator = this.eat(operator);
|
|
31308
|
-
const
|
|
31308
|
+
const types15 = [];
|
|
31309
31309
|
do {
|
|
31310
|
-
|
|
31310
|
+
types15.push(parseConstituentType());
|
|
31311
31311
|
} while (this.eat(operator));
|
|
31312
|
-
if (
|
|
31313
|
-
return
|
|
31312
|
+
if (types15.length === 1 && !hasLeadingOperator) {
|
|
31313
|
+
return types15[0];
|
|
31314
31314
|
}
|
|
31315
|
-
node.types =
|
|
31315
|
+
node.types = types15;
|
|
31316
31316
|
return this.finishNode(node, kind);
|
|
31317
31317
|
}
|
|
31318
31318
|
tsParseIntersectionTypeOrHigher() {
|
|
@@ -32528,7 +32528,7 @@ var require_lib3 = __commonJS({
|
|
|
32528
32528
|
context
|
|
32529
32529
|
} = this.state;
|
|
32530
32530
|
const currentContext = context[context.length - 1];
|
|
32531
|
-
if (currentContext ===
|
|
32531
|
+
if (currentContext === types14.j_oTag || currentContext === types14.j_expr) {
|
|
32532
32532
|
context.pop();
|
|
32533
32533
|
}
|
|
32534
32534
|
}
|
|
@@ -38100,9 +38100,9 @@ var require_shared = __commonJS({
|
|
|
38100
38100
|
var tslib_1 = require_tslib();
|
|
38101
38101
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
38102
38102
|
function default_1(fork) {
|
|
38103
|
-
var
|
|
38104
|
-
var Type =
|
|
38105
|
-
var builtin =
|
|
38103
|
+
var types14 = fork.use(types_1.default);
|
|
38104
|
+
var Type = types14.Type;
|
|
38105
|
+
var builtin = types14.builtInTypes;
|
|
38106
38106
|
var isNumber = builtin.number;
|
|
38107
38107
|
function geq(than) {
|
|
38108
38108
|
return Type.from(function(value) {
|
|
@@ -38252,9 +38252,9 @@ var require_types = __commonJS({
|
|
|
38252
38252
|
}(BaseType);
|
|
38253
38253
|
var OrType = function(_super) {
|
|
38254
38254
|
tslib_1.__extends(OrType2, _super);
|
|
38255
|
-
function OrType2(
|
|
38255
|
+
function OrType2(types14) {
|
|
38256
38256
|
var _this = _super.call(this) || this;
|
|
38257
|
-
_this.types =
|
|
38257
|
+
_this.types = types14;
|
|
38258
38258
|
_this.kind = "OrType";
|
|
38259
38259
|
return _this;
|
|
38260
38260
|
}
|
|
@@ -38395,11 +38395,11 @@ var require_types = __commonJS({
|
|
|
38395
38395
|
function typesPlugin(_fork) {
|
|
38396
38396
|
var Type = {
|
|
38397
38397
|
or: function() {
|
|
38398
|
-
var
|
|
38398
|
+
var types14 = [];
|
|
38399
38399
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
38400
|
-
|
|
38400
|
+
types14[_i] = arguments[_i];
|
|
38401
38401
|
}
|
|
38402
|
-
return new OrType(
|
|
38402
|
+
return new OrType(types14.map(function(type) {
|
|
38403
38403
|
return Type.from(type);
|
|
38404
38404
|
}));
|
|
38405
38405
|
},
|
|
@@ -38844,9 +38844,9 @@ var require_path2 = __commonJS({
|
|
|
38844
38844
|
var Op = Object.prototype;
|
|
38845
38845
|
var hasOwn = Op.hasOwnProperty;
|
|
38846
38846
|
function pathPlugin(fork) {
|
|
38847
|
-
var
|
|
38848
|
-
var isArray =
|
|
38849
|
-
var isNumber =
|
|
38847
|
+
var types14 = fork.use(types_1.default);
|
|
38848
|
+
var isArray = types14.builtInTypes.array;
|
|
38849
|
+
var isNumber = types14.builtInTypes.number;
|
|
38850
38850
|
var Path = function Path2(value, parentPath, name2) {
|
|
38851
38851
|
if (!(this instanceof Path2)) {
|
|
38852
38852
|
throw new Error("Path constructor cannot be invoked without 'new'");
|
|
@@ -39148,13 +39148,13 @@ var require_scope = __commonJS({
|
|
|
39148
39148
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
39149
39149
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
39150
39150
|
function scopePlugin(fork) {
|
|
39151
|
-
var
|
|
39152
|
-
var Type =
|
|
39153
|
-
var namedTypes =
|
|
39151
|
+
var types14 = fork.use(types_1.default);
|
|
39152
|
+
var Type = types14.Type;
|
|
39153
|
+
var namedTypes = types14.namedTypes;
|
|
39154
39154
|
var Node = namedTypes.Node;
|
|
39155
39155
|
var Expression = namedTypes.Expression;
|
|
39156
|
-
var isArray =
|
|
39157
|
-
var b =
|
|
39156
|
+
var isArray = types14.builtInTypes.array;
|
|
39157
|
+
var b = types14.builders;
|
|
39158
39158
|
var Scope = function Scope2(path2, parentScope) {
|
|
39159
39159
|
if (!(this instanceof Scope2)) {
|
|
39160
39160
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
@@ -39217,7 +39217,7 @@ var require_scope = __commonJS({
|
|
|
39217
39217
|
++index;
|
|
39218
39218
|
}
|
|
39219
39219
|
var name2 = prefix + index;
|
|
39220
|
-
return this.bindings[name2] =
|
|
39220
|
+
return this.bindings[name2] = types14.builders.identifier(name2);
|
|
39221
39221
|
};
|
|
39222
39222
|
Sp.injectTemporary = function(identifier, init) {
|
|
39223
39223
|
identifier || (identifier = this.declareTemporary());
|
|
@@ -39293,7 +39293,7 @@ var require_scope = __commonJS({
|
|
|
39293
39293
|
bindings
|
|
39294
39294
|
);
|
|
39295
39295
|
} else if (Node.check(node) && !Expression.check(node)) {
|
|
39296
|
-
|
|
39296
|
+
types14.eachField(node, function(name2, child) {
|
|
39297
39297
|
var childPath = path2.get(name2);
|
|
39298
39298
|
if (!pathHasValue(childPath, child)) {
|
|
39299
39299
|
throw new Error("");
|
|
@@ -39371,24 +39371,24 @@ var require_scope = __commonJS({
|
|
|
39371
39371
|
addPattern(patternPath.get("argument"), bindings);
|
|
39372
39372
|
}
|
|
39373
39373
|
}
|
|
39374
|
-
function addTypePattern(patternPath,
|
|
39374
|
+
function addTypePattern(patternPath, types15) {
|
|
39375
39375
|
var pattern = patternPath.value;
|
|
39376
39376
|
namedTypes.Pattern.assert(pattern);
|
|
39377
39377
|
if (namedTypes.Identifier.check(pattern)) {
|
|
39378
|
-
if (hasOwn.call(
|
|
39379
|
-
|
|
39378
|
+
if (hasOwn.call(types15, pattern.name)) {
|
|
39379
|
+
types15[pattern.name].push(patternPath);
|
|
39380
39380
|
} else {
|
|
39381
|
-
|
|
39381
|
+
types15[pattern.name] = [patternPath];
|
|
39382
39382
|
}
|
|
39383
39383
|
}
|
|
39384
39384
|
}
|
|
39385
|
-
function addTypeParameter(parameterPath,
|
|
39385
|
+
function addTypeParameter(parameterPath, types15) {
|
|
39386
39386
|
var parameter = parameterPath.value;
|
|
39387
39387
|
FlowOrTSTypeParameterType.assert(parameter);
|
|
39388
|
-
if (hasOwn.call(
|
|
39389
|
-
|
|
39388
|
+
if (hasOwn.call(types15, parameter.name)) {
|
|
39389
|
+
types15[parameter.name].push(parameterPath);
|
|
39390
39390
|
} else {
|
|
39391
|
-
|
|
39391
|
+
types15[parameter.name] = [parameterPath];
|
|
39392
39392
|
}
|
|
39393
39393
|
}
|
|
39394
39394
|
Sp.lookup = function(name2) {
|
|
@@ -39429,11 +39429,11 @@ var require_node_path = __commonJS({
|
|
|
39429
39429
|
var scope_1 = tslib_1.__importDefault(require_scope());
|
|
39430
39430
|
var shared_1 = require_shared();
|
|
39431
39431
|
function nodePathPlugin(fork) {
|
|
39432
|
-
var
|
|
39433
|
-
var n =
|
|
39434
|
-
var b =
|
|
39435
|
-
var isNumber =
|
|
39436
|
-
var isArray =
|
|
39432
|
+
var types14 = fork.use(types_1.default);
|
|
39433
|
+
var n = types14.namedTypes;
|
|
39434
|
+
var b = types14.builders;
|
|
39435
|
+
var isNumber = types14.builtInTypes.number;
|
|
39436
|
+
var isArray = types14.builtInTypes.array;
|
|
39437
39437
|
var Path = fork.use(path_1.default);
|
|
39438
39438
|
var Scope = fork.use(scope_1.default);
|
|
39439
39439
|
var NodePath = function NodePath2(value, parentPath, name2) {
|
|
@@ -39524,7 +39524,7 @@ var require_node_path = __commonJS({
|
|
|
39524
39524
|
return scope || null;
|
|
39525
39525
|
};
|
|
39526
39526
|
NPp.getValueProperty = function(name2) {
|
|
39527
|
-
return
|
|
39527
|
+
return types14.getFieldValue(this.value, name2);
|
|
39528
39528
|
};
|
|
39529
39529
|
NPp.needsParens = function(assumeExpressionContext) {
|
|
39530
39530
|
var pp = this.parentPath;
|
|
@@ -39666,7 +39666,7 @@ var require_node_path = __commonJS({
|
|
|
39666
39666
|
return node.some(containsCallExpression);
|
|
39667
39667
|
}
|
|
39668
39668
|
if (n.Node.check(node)) {
|
|
39669
|
-
return
|
|
39669
|
+
return types14.someField(node, function(_name, child) {
|
|
39670
39670
|
return containsCallExpression(child);
|
|
39671
39671
|
});
|
|
39672
39672
|
}
|
|
@@ -39787,11 +39787,11 @@ var require_path_visitor = __commonJS({
|
|
|
39787
39787
|
var shared_1 = require_shared();
|
|
39788
39788
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
39789
39789
|
function pathVisitorPlugin(fork) {
|
|
39790
|
-
var
|
|
39790
|
+
var types14 = fork.use(types_1.default);
|
|
39791
39791
|
var NodePath = fork.use(node_path_1.default);
|
|
39792
|
-
var isArray =
|
|
39793
|
-
var isObject =
|
|
39794
|
-
var isFunction =
|
|
39792
|
+
var isArray = types14.builtInTypes.array;
|
|
39793
|
+
var isObject = types14.builtInTypes.object;
|
|
39794
|
+
var isFunction = types14.builtInTypes.function;
|
|
39795
39795
|
var undefined2;
|
|
39796
39796
|
var PathVisitor = function PathVisitor2() {
|
|
39797
39797
|
if (!(this instanceof PathVisitor2)) {
|
|
@@ -39811,7 +39811,7 @@ var require_path_visitor = __commonJS({
|
|
|
39811
39811
|
typeNames[methodName.slice("visit".length)] = true;
|
|
39812
39812
|
}
|
|
39813
39813
|
}
|
|
39814
|
-
var supertypeTable =
|
|
39814
|
+
var supertypeTable = types14.computeSupertypeLookupTable(typeNames);
|
|
39815
39815
|
var methodNameTable = /* @__PURE__ */ Object.create(null);
|
|
39816
39816
|
var typeNameKeys = Object.keys(supertypeTable);
|
|
39817
39817
|
var typeNameCount = typeNameKeys.length;
|
|
@@ -39853,7 +39853,7 @@ var require_path_visitor = __commonJS({
|
|
|
39853
39853
|
}
|
|
39854
39854
|
return target;
|
|
39855
39855
|
}
|
|
39856
|
-
PathVisitor.visit = function
|
|
39856
|
+
PathVisitor.visit = function visit12(node, methods) {
|
|
39857
39857
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
39858
39858
|
};
|
|
39859
39859
|
var PVp = PathVisitor.prototype;
|
|
@@ -39930,7 +39930,7 @@ var require_path_visitor = __commonJS({
|
|
|
39930
39930
|
path2.each(visitor.visitWithoutReset, visitor);
|
|
39931
39931
|
} else if (!isObject.check(value)) {
|
|
39932
39932
|
} else {
|
|
39933
|
-
var childNames =
|
|
39933
|
+
var childNames = types14.getFieldNames(value);
|
|
39934
39934
|
if (visitor._shouldVisitComments && value.comments && childNames.indexOf("comments") < 0) {
|
|
39935
39935
|
childNames.push("comments");
|
|
39936
39936
|
}
|
|
@@ -39939,7 +39939,7 @@ var require_path_visitor = __commonJS({
|
|
|
39939
39939
|
for (var i = 0; i < childCount; ++i) {
|
|
39940
39940
|
var childName = childNames[i];
|
|
39941
39941
|
if (!hasOwn.call(value, childName)) {
|
|
39942
|
-
value[childName] =
|
|
39942
|
+
value[childName] = types14.getFieldValue(value, childName);
|
|
39943
39943
|
}
|
|
39944
39944
|
childPaths.push(path2.get(childName));
|
|
39945
39945
|
}
|
|
@@ -40044,7 +40044,7 @@ var require_path_visitor = __commonJS({
|
|
|
40044
40044
|
this.needToCallTraverse = false;
|
|
40045
40045
|
return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
40046
40046
|
};
|
|
40047
|
-
sharedContextProtoMethods.visit = function
|
|
40047
|
+
sharedContextProtoMethods.visit = function visit12(path2, newVisitor) {
|
|
40048
40048
|
if (!(this instanceof this.Context)) {
|
|
40049
40049
|
throw new Error("");
|
|
40050
40050
|
}
|
|
@@ -40082,13 +40082,13 @@ var require_equiv = __commonJS({
|
|
|
40082
40082
|
var shared_1 = require_shared();
|
|
40083
40083
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
40084
40084
|
function default_1(fork) {
|
|
40085
|
-
var
|
|
40086
|
-
var getFieldNames =
|
|
40087
|
-
var getFieldValue =
|
|
40088
|
-
var isArray =
|
|
40089
|
-
var isObject =
|
|
40090
|
-
var isDate =
|
|
40091
|
-
var isRegExp =
|
|
40085
|
+
var types14 = fork.use(types_1.default);
|
|
40086
|
+
var getFieldNames = types14.getFieldNames;
|
|
40087
|
+
var getFieldValue = types14.getFieldValue;
|
|
40088
|
+
var isArray = types14.builtInTypes.array;
|
|
40089
|
+
var isObject = types14.builtInTypes.object;
|
|
40090
|
+
var isDate = types14.builtInTypes.Date;
|
|
40091
|
+
var isRegExp = types14.builtInTypes.RegExp;
|
|
40092
40092
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
40093
40093
|
function astNodesAreEquivalent(a, b, problemPath) {
|
|
40094
40094
|
if (isArray.check(problemPath)) {
|
|
@@ -40241,24 +40241,24 @@ var require_fork = __commonJS({
|
|
|
40241
40241
|
var shared_1 = require_shared();
|
|
40242
40242
|
function default_1(plugins) {
|
|
40243
40243
|
var fork = createFork();
|
|
40244
|
-
var
|
|
40244
|
+
var types14 = fork.use(types_1.default);
|
|
40245
40245
|
plugins.forEach(fork.use);
|
|
40246
|
-
|
|
40246
|
+
types14.finalize();
|
|
40247
40247
|
var PathVisitor = fork.use(path_visitor_1.default);
|
|
40248
40248
|
return {
|
|
40249
|
-
Type:
|
|
40250
|
-
builtInTypes:
|
|
40251
|
-
namedTypes:
|
|
40252
|
-
builders:
|
|
40253
|
-
defineMethod:
|
|
40254
|
-
getFieldNames:
|
|
40255
|
-
getFieldValue:
|
|
40256
|
-
eachField:
|
|
40257
|
-
someField:
|
|
40258
|
-
getSupertypeNames:
|
|
40259
|
-
getBuilderName:
|
|
40249
|
+
Type: types14.Type,
|
|
40250
|
+
builtInTypes: types14.builtInTypes,
|
|
40251
|
+
namedTypes: types14.namedTypes,
|
|
40252
|
+
builders: types14.builders,
|
|
40253
|
+
defineMethod: types14.defineMethod,
|
|
40254
|
+
getFieldNames: types14.getFieldNames,
|
|
40255
|
+
getFieldValue: types14.getFieldValue,
|
|
40256
|
+
eachField: types14.eachField,
|
|
40257
|
+
someField: types14.someField,
|
|
40258
|
+
getSupertypeNames: types14.getSupertypeNames,
|
|
40259
|
+
getBuilderName: types14.getBuilderName,
|
|
40260
40260
|
astNodesAreEquivalent: fork.use(equiv_1.default),
|
|
40261
|
-
finalize:
|
|
40261
|
+
finalize: types14.finalize,
|
|
40262
40262
|
Path: fork.use(path_1.default),
|
|
40263
40263
|
NodePath: fork.use(node_path_1.default),
|
|
40264
40264
|
PathVisitor,
|
|
@@ -40428,8 +40428,8 @@ var require_core2 = __commonJS({
|
|
|
40428
40428
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
40429
40429
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40430
40430
|
function default_1(fork) {
|
|
40431
|
-
var
|
|
40432
|
-
var Type =
|
|
40431
|
+
var types14 = fork.use(types_1.default);
|
|
40432
|
+
var Type = types14.Type;
|
|
40433
40433
|
var def = Type.def;
|
|
40434
40434
|
var or = Type.or;
|
|
40435
40435
|
var shared = fork.use(shared_1.default);
|
|
@@ -40521,9 +40521,9 @@ var require_es6 = __commonJS({
|
|
|
40521
40521
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40522
40522
|
function default_1(fork) {
|
|
40523
40523
|
fork.use(core_1.default);
|
|
40524
|
-
var
|
|
40525
|
-
var def =
|
|
40526
|
-
var or =
|
|
40524
|
+
var types14 = fork.use(types_1.default);
|
|
40525
|
+
var def = types14.Type.def;
|
|
40526
|
+
var or = types14.Type.or;
|
|
40527
40527
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40528
40528
|
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"]);
|
|
40529
40529
|
def("RestElement").bases("Pattern").build("argument").field("argument", def("Pattern")).field(
|
|
@@ -40613,8 +40613,8 @@ var require_es2017 = __commonJS({
|
|
|
40613
40613
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40614
40614
|
function default_1(fork) {
|
|
40615
40615
|
fork.use(es2016_1.default);
|
|
40616
|
-
var
|
|
40617
|
-
var def =
|
|
40616
|
+
var types14 = fork.use(types_1.default);
|
|
40617
|
+
var def = types14.Type.def;
|
|
40618
40618
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40619
40619
|
def("Function").field("async", Boolean, defaults["false"]);
|
|
40620
40620
|
def("AwaitExpression").bases("Expression").build("argument").field("argument", def("Expression"));
|
|
@@ -40637,9 +40637,9 @@ var require_es2018 = __commonJS({
|
|
|
40637
40637
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40638
40638
|
function default_1(fork) {
|
|
40639
40639
|
fork.use(es2017_1.default);
|
|
40640
|
-
var
|
|
40641
|
-
var def =
|
|
40642
|
-
var or =
|
|
40640
|
+
var types14 = fork.use(types_1.default);
|
|
40641
|
+
var def = types14.Type.def;
|
|
40642
|
+
var or = types14.Type.or;
|
|
40643
40643
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40644
40644
|
def("ForOfStatement").field("await", Boolean, defaults["false"]);
|
|
40645
40645
|
def("SpreadProperty").bases("Node").build("argument").field("argument", def("Expression"));
|
|
@@ -40670,9 +40670,9 @@ var require_es2019 = __commonJS({
|
|
|
40670
40670
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40671
40671
|
function default_1(fork) {
|
|
40672
40672
|
fork.use(es2018_1.default);
|
|
40673
|
-
var
|
|
40674
|
-
var def =
|
|
40675
|
-
var or =
|
|
40673
|
+
var types14 = fork.use(types_1.default);
|
|
40674
|
+
var def = types14.Type.def;
|
|
40675
|
+
var or = types14.Type.or;
|
|
40676
40676
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40677
40677
|
def("CatchClause").field("param", or(def("Pattern"), null), defaults["null"]);
|
|
40678
40678
|
}
|
|
@@ -40696,9 +40696,9 @@ var require_es20202 = __commonJS({
|
|
|
40696
40696
|
function default_1(fork) {
|
|
40697
40697
|
fork.use(es2020_1.default);
|
|
40698
40698
|
fork.use(es2019_1.default);
|
|
40699
|
-
var
|
|
40700
|
-
var def =
|
|
40701
|
-
var or =
|
|
40699
|
+
var types14 = fork.use(types_1.default);
|
|
40700
|
+
var def = types14.Type.def;
|
|
40701
|
+
var or = types14.Type.or;
|
|
40702
40702
|
var shared = fork.use(shared_1.default);
|
|
40703
40703
|
var defaults = shared.defaults;
|
|
40704
40704
|
def("ImportExpression").bases("Expression").build("source").field("source", def("Expression"));
|
|
@@ -40748,8 +40748,8 @@ var require_es2022 = __commonJS({
|
|
|
40748
40748
|
var shared_1 = require_shared();
|
|
40749
40749
|
function default_1(fork) {
|
|
40750
40750
|
fork.use(es2021_1.default);
|
|
40751
|
-
var
|
|
40752
|
-
var def =
|
|
40751
|
+
var types14 = fork.use(types_1.default);
|
|
40752
|
+
var def = types14.Type.def;
|
|
40753
40753
|
def("StaticBlock").bases("Declaration").build("body").field("body", [def("Statement")]);
|
|
40754
40754
|
}
|
|
40755
40755
|
exports.default = default_1;
|
|
@@ -40770,9 +40770,9 @@ var require_es_proposals = __commonJS({
|
|
|
40770
40770
|
var es2022_1 = tslib_1.__importDefault(require_es2022());
|
|
40771
40771
|
function default_1(fork) {
|
|
40772
40772
|
fork.use(es2022_1.default);
|
|
40773
|
-
var
|
|
40774
|
-
var Type =
|
|
40775
|
-
var def =
|
|
40773
|
+
var types14 = fork.use(types_1.default);
|
|
40774
|
+
var Type = types14.Type;
|
|
40775
|
+
var def = types14.Type.def;
|
|
40776
40776
|
var or = Type.or;
|
|
40777
40777
|
var shared = fork.use(shared_1.default);
|
|
40778
40778
|
var defaults = shared.defaults;
|
|
@@ -40812,9 +40812,9 @@ var require_jsx = __commonJS({
|
|
|
40812
40812
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40813
40813
|
function default_1(fork) {
|
|
40814
40814
|
fork.use(es_proposals_1.default);
|
|
40815
|
-
var
|
|
40816
|
-
var def =
|
|
40817
|
-
var or =
|
|
40815
|
+
var types14 = fork.use(types_1.default);
|
|
40816
|
+
var def = types14.Type.def;
|
|
40817
|
+
var or = types14.Type.or;
|
|
40818
40818
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40819
40819
|
def("JSXAttribute").bases("Node").build("name", "value").field("name", or(def("JSXIdentifier"), def("JSXNamespacedName"))).field("value", or(
|
|
40820
40820
|
def("Literal"),
|
|
@@ -40872,9 +40872,9 @@ var require_type_annotations = __commonJS({
|
|
|
40872
40872
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
40873
40873
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40874
40874
|
function default_1(fork) {
|
|
40875
|
-
var
|
|
40876
|
-
var def =
|
|
40877
|
-
var or =
|
|
40875
|
+
var types14 = fork.use(types_1.default);
|
|
40876
|
+
var def = types14.Type.def;
|
|
40877
|
+
var or = types14.Type.or;
|
|
40878
40878
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40879
40879
|
var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
|
|
40880
40880
|
var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
|
|
@@ -40909,9 +40909,9 @@ var require_flow = __commonJS({
|
|
|
40909
40909
|
function default_1(fork) {
|
|
40910
40910
|
fork.use(es_proposals_1.default);
|
|
40911
40911
|
fork.use(type_annotations_1.default);
|
|
40912
|
-
var
|
|
40913
|
-
var def =
|
|
40914
|
-
var or =
|
|
40912
|
+
var types14 = fork.use(types_1.default);
|
|
40913
|
+
var def = types14.Type.def;
|
|
40914
|
+
var or = types14.Type.or;
|
|
40915
40915
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40916
40916
|
def("Flow").bases("Node");
|
|
40917
40917
|
def("FlowType").bases("Flow");
|
|
@@ -41025,10 +41025,10 @@ var require_esprima = __commonJS({
|
|
|
41025
41025
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
41026
41026
|
function default_1(fork) {
|
|
41027
41027
|
fork.use(es_proposals_1.default);
|
|
41028
|
-
var
|
|
41028
|
+
var types14 = fork.use(types_1.default);
|
|
41029
41029
|
var defaults = fork.use(shared_1.default).defaults;
|
|
41030
|
-
var def =
|
|
41031
|
-
var or =
|
|
41030
|
+
var def = types14.Type.def;
|
|
41031
|
+
var or = types14.Type.or;
|
|
41032
41032
|
def("VariableDeclaration").field("declarations", [or(
|
|
41033
41033
|
def("VariableDeclarator"),
|
|
41034
41034
|
def("Identifier")
|
|
@@ -41073,11 +41073,11 @@ var require_babel_core = __commonJS({
|
|
|
41073
41073
|
function default_1(fork) {
|
|
41074
41074
|
var _a, _b, _c, _d, _e;
|
|
41075
41075
|
fork.use(es_proposals_1.default);
|
|
41076
|
-
var
|
|
41076
|
+
var types14 = fork.use(types_1.default);
|
|
41077
41077
|
var defaults = fork.use(shared_1.default).defaults;
|
|
41078
|
-
var def =
|
|
41079
|
-
var or =
|
|
41080
|
-
var isUndefined =
|
|
41078
|
+
var def = types14.Type.def;
|
|
41079
|
+
var or = types14.Type.or;
|
|
41080
|
+
var isUndefined = types14.builtInTypes.undefined;
|
|
41081
41081
|
def("Noop").bases("Statement").build();
|
|
41082
41082
|
def("DoExpression").bases("Expression").build("body").field("body", [def("Statement")]);
|
|
41083
41083
|
def("BindExpression").bases("Expression").build("object", "callee").field("object", or(def("Expression"), null)).field("callee", def("Expression"));
|
|
@@ -41102,7 +41102,7 @@ var require_babel_core = __commonJS({
|
|
|
41102
41102
|
raw: String
|
|
41103
41103
|
},
|
|
41104
41104
|
function getDefault() {
|
|
41105
|
-
var value =
|
|
41105
|
+
var value = types14.getFieldValue(this, "value");
|
|
41106
41106
|
return {
|
|
41107
41107
|
rawValue: value,
|
|
41108
41108
|
raw: toRaw ? toRaw(value) : String(value)
|
|
@@ -41205,8 +41205,8 @@ var require_babel = __commonJS({
|
|
|
41205
41205
|
var flow_1 = tslib_1.__importDefault(require_flow());
|
|
41206
41206
|
var shared_1 = require_shared();
|
|
41207
41207
|
function default_1(fork) {
|
|
41208
|
-
var
|
|
41209
|
-
var def =
|
|
41208
|
+
var types14 = fork.use(types_1.default);
|
|
41209
|
+
var def = types14.Type.def;
|
|
41210
41210
|
fork.use(babel_core_1.default);
|
|
41211
41211
|
fork.use(flow_1.default);
|
|
41212
41212
|
def("V8IntrinsicIdentifier").bases("Expression").build("name").field("name", String);
|
|
@@ -41232,12 +41232,12 @@ var require_typescript = __commonJS({
|
|
|
41232
41232
|
function default_1(fork) {
|
|
41233
41233
|
fork.use(babel_core_1.default);
|
|
41234
41234
|
fork.use(type_annotations_1.default);
|
|
41235
|
-
var
|
|
41236
|
-
var n =
|
|
41237
|
-
var def =
|
|
41238
|
-
var or =
|
|
41235
|
+
var types14 = fork.use(types_1.default);
|
|
41236
|
+
var n = types14.namedTypes;
|
|
41237
|
+
var def = types14.Type.def;
|
|
41238
|
+
var or = types14.Type.or;
|
|
41239
41239
|
var defaults = fork.use(shared_1.default).defaults;
|
|
41240
|
-
var StringLiteral =
|
|
41240
|
+
var StringLiteral = types14.Type.from(function(value, deep) {
|
|
41241
41241
|
if (n.StringLiteral && n.StringLiteral.check(value, deep)) {
|
|
41242
41242
|
return true;
|
|
41243
41243
|
}
|
|
@@ -41437,7 +41437,7 @@ var require_main = __commonJS({
|
|
|
41437
41437
|
var someField = _a.someField;
|
|
41438
41438
|
var Type = _a.Type;
|
|
41439
41439
|
var use = _a.use;
|
|
41440
|
-
var
|
|
41440
|
+
var visit12 = _a.visit;
|
|
41441
41441
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
41442
41442
|
exports.builders = builders;
|
|
41443
41443
|
exports.builtInTypes = builtInTypes;
|
|
@@ -41454,7 +41454,7 @@ var require_main = __commonJS({
|
|
|
41454
41454
|
exports.someField = someField;
|
|
41455
41455
|
exports.Type = Type;
|
|
41456
41456
|
exports.use = use;
|
|
41457
|
-
exports.visit =
|
|
41457
|
+
exports.visit = visit12;
|
|
41458
41458
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
41459
41459
|
}
|
|
41460
41460
|
});
|
|
@@ -43213,8 +43213,8 @@ var require_util2 = __commonJS({
|
|
|
43213
43213
|
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;
|
|
43214
43214
|
var tslib_1 = require_tslib();
|
|
43215
43215
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
43216
|
-
var
|
|
43217
|
-
var n =
|
|
43216
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
43217
|
+
var n = types14.namedTypes;
|
|
43218
43218
|
var source_map_1 = tslib_1.__importDefault(require_source_map());
|
|
43219
43219
|
var SourceMapConsumer = source_map_1.default.SourceMapConsumer;
|
|
43220
43220
|
var SourceMapGenerator = source_map_1.default.SourceMapGenerator;
|
|
@@ -50532,10 +50532,10 @@ var require_comments = __commonJS({
|
|
|
50532
50532
|
exports.printComments = exports.attach = void 0;
|
|
50533
50533
|
var tslib_1 = require_tslib();
|
|
50534
50534
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
50535
|
-
var
|
|
50536
|
-
var n =
|
|
50537
|
-
var isArray =
|
|
50538
|
-
var isObject =
|
|
50535
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
50536
|
+
var n = types14.namedTypes;
|
|
50537
|
+
var isArray = types14.builtInTypes.array;
|
|
50538
|
+
var isObject = types14.builtInTypes.object;
|
|
50539
50539
|
var lines_1 = require_lines();
|
|
50540
50540
|
var util_1 = require_util2();
|
|
50541
50541
|
var childNodesCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -50566,7 +50566,7 @@ var require_comments = __commonJS({
|
|
|
50566
50566
|
if (isArray.check(node)) {
|
|
50567
50567
|
names = Object.keys(node);
|
|
50568
50568
|
} else if (isObject.check(node)) {
|
|
50569
|
-
names =
|
|
50569
|
+
names = types14.getFieldNames(node);
|
|
50570
50570
|
} else {
|
|
50571
50571
|
return resultArray;
|
|
50572
50572
|
}
|
|
@@ -50744,7 +50744,7 @@ var require_comments = __commonJS({
|
|
|
50744
50744
|
function printComments(path2, print10) {
|
|
50745
50745
|
var value = path2.getValue();
|
|
50746
50746
|
var innerLines = print10(path2);
|
|
50747
|
-
var comments = n.Node.check(value) &&
|
|
50747
|
+
var comments = n.Node.check(value) && types14.getFieldValue(value, "comments");
|
|
50748
50748
|
if (!comments || comments.length === 0) {
|
|
50749
50749
|
return innerLines;
|
|
50750
50750
|
}
|
|
@@ -50752,8 +50752,8 @@ var require_comments = __commonJS({
|
|
|
50752
50752
|
var trailingParts = [innerLines];
|
|
50753
50753
|
path2.each(function(commentPath) {
|
|
50754
50754
|
var comment = commentPath.getValue();
|
|
50755
|
-
var leading =
|
|
50756
|
-
var trailing =
|
|
50755
|
+
var leading = types14.getFieldValue(comment, "leading");
|
|
50756
|
+
var trailing = types14.getFieldValue(comment, "trailing");
|
|
50757
50757
|
if (leading || trailing && !(n.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
50758
50758
|
leadingParts.push(printLeadingComment(commentPath, print10));
|
|
50759
50759
|
} else if (trailing) {
|
|
@@ -50775,10 +50775,10 @@ var require_parser2 = __commonJS({
|
|
|
50775
50775
|
exports.parse = void 0;
|
|
50776
50776
|
var tslib_1 = require_tslib();
|
|
50777
50777
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
50778
|
-
var
|
|
50779
|
-
var b =
|
|
50780
|
-
var isObject =
|
|
50781
|
-
var isArray =
|
|
50778
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
50779
|
+
var b = types14.builders;
|
|
50780
|
+
var isObject = types14.builtInTypes.object;
|
|
50781
|
+
var isArray = types14.builtInTypes.array;
|
|
50782
50782
|
var options_1 = require_options();
|
|
50783
50783
|
var lines_1 = require_lines();
|
|
50784
50784
|
var comments_1 = require_comments();
|
|
@@ -50964,11 +50964,11 @@ var require_fast_path = __commonJS({
|
|
|
50964
50964
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50965
50965
|
var tslib_1 = require_tslib();
|
|
50966
50966
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
50967
|
-
var
|
|
50967
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
50968
50968
|
var util = tslib_1.__importStar(require_util2());
|
|
50969
|
-
var n =
|
|
50970
|
-
var isArray =
|
|
50971
|
-
var isNumber =
|
|
50969
|
+
var n = types14.namedTypes;
|
|
50970
|
+
var isArray = types14.builtInTypes.array;
|
|
50971
|
+
var isNumber = types14.builtInTypes.number;
|
|
50972
50972
|
var PRECEDENCE = {};
|
|
50973
50973
|
[
|
|
50974
50974
|
["??"],
|
|
@@ -50997,7 +50997,7 @@ var require_fast_path = __commonJS({
|
|
|
50997
50997
|
if (obj instanceof FastPath) {
|
|
50998
50998
|
return obj.copy();
|
|
50999
50999
|
}
|
|
51000
|
-
if (obj instanceof
|
|
51000
|
+
if (obj instanceof types14.NodePath) {
|
|
51001
51001
|
var copy = Object.create(FastPath.prototype);
|
|
51002
51002
|
var stack = [obj.value];
|
|
51003
51003
|
for (var pp = void 0; pp = obj.parentPath; obj = pp)
|
|
@@ -51308,7 +51308,7 @@ var require_fast_path = __commonJS({
|
|
|
51308
51308
|
return node.some(containsCallExpression);
|
|
51309
51309
|
}
|
|
51310
51310
|
if (n.Node.check(node)) {
|
|
51311
|
-
return
|
|
51311
|
+
return types14.someField(node, function(_name, child) {
|
|
51312
51312
|
return containsCallExpression(child);
|
|
51313
51313
|
});
|
|
51314
51314
|
}
|
|
@@ -51398,16 +51398,16 @@ var require_patcher = __commonJS({
|
|
|
51398
51398
|
var tslib_1 = require_tslib();
|
|
51399
51399
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
51400
51400
|
var linesModule = tslib_1.__importStar(require_lines());
|
|
51401
|
-
var
|
|
51402
|
-
var Printable =
|
|
51403
|
-
var Expression =
|
|
51404
|
-
var ReturnStatement =
|
|
51405
|
-
var SourceLocation =
|
|
51401
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
51402
|
+
var Printable = types14.namedTypes.Printable;
|
|
51403
|
+
var Expression = types14.namedTypes.Expression;
|
|
51404
|
+
var ReturnStatement = types14.namedTypes.ReturnStatement;
|
|
51405
|
+
var SourceLocation = types14.namedTypes.SourceLocation;
|
|
51406
51406
|
var util_1 = require_util2();
|
|
51407
51407
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
51408
|
-
var isObject =
|
|
51409
|
-
var isArray =
|
|
51410
|
-
var isString =
|
|
51408
|
+
var isObject = types14.builtInTypes.object;
|
|
51409
|
+
var isArray = types14.builtInTypes.array;
|
|
51410
|
+
var isString = types14.builtInTypes.string;
|
|
51411
51411
|
var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
|
|
51412
51412
|
var Patcher = function Patcher2(lines) {
|
|
51413
51413
|
assert_1.default.ok(this instanceof Patcher2);
|
|
@@ -51677,8 +51677,8 @@ var require_patcher = __commonJS({
|
|
|
51677
51677
|
if (k.charAt(0) === "_") {
|
|
51678
51678
|
continue;
|
|
51679
51679
|
}
|
|
51680
|
-
newPath.stack.push(k,
|
|
51681
|
-
oldPath.stack.push(k,
|
|
51680
|
+
newPath.stack.push(k, types14.getFieldValue(newNode, k));
|
|
51681
|
+
oldPath.stack.push(k, types14.getFieldValue(oldNode, k));
|
|
51682
51682
|
var canReprint = findAnyReprints(newPath, oldPath, reprints);
|
|
51683
51683
|
newPath.stack.length -= 2;
|
|
51684
51684
|
oldPath.stack.length -= 2;
|
|
@@ -51702,16 +51702,16 @@ var require_printer2 = __commonJS({
|
|
|
51702
51702
|
exports.Printer = void 0;
|
|
51703
51703
|
var tslib_1 = require_tslib();
|
|
51704
51704
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
51705
|
-
var
|
|
51705
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
51706
51706
|
var comments_1 = require_comments();
|
|
51707
51707
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
51708
51708
|
var lines_1 = require_lines();
|
|
51709
51709
|
var options_1 = require_options();
|
|
51710
51710
|
var patcher_1 = require_patcher();
|
|
51711
51711
|
var util = tslib_1.__importStar(require_util2());
|
|
51712
|
-
var namedTypes =
|
|
51713
|
-
var isString =
|
|
51714
|
-
var isObject =
|
|
51712
|
+
var namedTypes = types14.namedTypes;
|
|
51713
|
+
var isString = types14.builtInTypes.string;
|
|
51714
|
+
var isObject = types14.builtInTypes.object;
|
|
51715
51715
|
var PrintResult = function PrintResult2(code, sourceMap) {
|
|
51716
51716
|
assert_1.default.ok(this instanceof PrintResult2);
|
|
51717
51717
|
isString.assert(code);
|
|
@@ -51873,7 +51873,7 @@ var require_printer2 = __commonJS({
|
|
|
51873
51873
|
case "OptionalMemberExpression": {
|
|
51874
51874
|
parts.push(path2.call(print10, "object"));
|
|
51875
51875
|
var property = path2.call(print10, "property");
|
|
51876
|
-
var optional =
|
|
51876
|
+
var optional = types14.getFieldValue(n, "optional");
|
|
51877
51877
|
if (n.computed) {
|
|
51878
51878
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
51879
51879
|
} else {
|
|
@@ -52144,7 +52144,7 @@ var require_printer2 = __commonJS({
|
|
|
52144
52144
|
if (n.typeArguments) {
|
|
52145
52145
|
parts.push(path2.call(print10, "typeArguments"));
|
|
52146
52146
|
}
|
|
52147
|
-
if (
|
|
52147
|
+
if (types14.getFieldValue(n, "optional")) {
|
|
52148
52148
|
parts.push("?.");
|
|
52149
52149
|
}
|
|
52150
52150
|
parts.push(printArgumentsList(path2, options, print10));
|
|
@@ -53823,8 +53823,8 @@ var require_printer2 = __commonJS({
|
|
|
53823
53823
|
});
|
|
53824
53824
|
}
|
|
53825
53825
|
function getPossibleRaw(node) {
|
|
53826
|
-
var value =
|
|
53827
|
-
var extra =
|
|
53826
|
+
var value = types14.getFieldValue(node, "value");
|
|
53827
|
+
var extra = types14.getFieldValue(node, "extra");
|
|
53828
53828
|
if (extra && typeof extra.raw === "string" && value == extra.rawValue) {
|
|
53829
53829
|
return extra.raw;
|
|
53830
53830
|
}
|
|
@@ -53872,8 +53872,8 @@ var require_main2 = __commonJS({
|
|
|
53872
53872
|
exports.run = exports.prettyPrint = exports.print = exports.visit = exports.types = exports.parse = void 0;
|
|
53873
53873
|
var tslib_1 = require_tslib();
|
|
53874
53874
|
var fs_1 = tslib_1.__importDefault(require("fs"));
|
|
53875
|
-
var
|
|
53876
|
-
exports.types =
|
|
53875
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
53876
|
+
exports.types = types14;
|
|
53877
53877
|
var parser_1 = require_parser2();
|
|
53878
53878
|
Object.defineProperty(exports, "parse", { enumerable: true, get: function() {
|
|
53879
53879
|
return parser_1.parse;
|
|
@@ -53887,10 +53887,10 @@ var require_main2 = __commonJS({
|
|
|
53887
53887
|
return new printer_1.Printer(options).print(node);
|
|
53888
53888
|
}
|
|
53889
53889
|
exports.print = print10;
|
|
53890
|
-
function
|
|
53890
|
+
function prettyPrint3(node, options) {
|
|
53891
53891
|
return new printer_1.Printer(options).printGenerically(node);
|
|
53892
53892
|
}
|
|
53893
|
-
exports.prettyPrint =
|
|
53893
|
+
exports.prettyPrint = prettyPrint3;
|
|
53894
53894
|
function run(transformer, options) {
|
|
53895
53895
|
return runFile(process.argv[2], transformer, options);
|
|
53896
53896
|
}
|
|
@@ -53926,7 +53926,7 @@ __export(test_exports, {
|
|
|
53926
53926
|
testConfigFile: () => testConfigFile
|
|
53927
53927
|
});
|
|
53928
53928
|
module.exports = __toCommonJS(test_exports);
|
|
53929
|
-
var
|
|
53929
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
53930
53930
|
var import_memfs2 = __toESM(require_lib(), 1);
|
|
53931
53931
|
|
|
53932
53932
|
// src/lib/pipeline.ts
|
|
@@ -54408,8 +54408,8 @@ var List = class {
|
|
|
54408
54408
|
} else {
|
|
54409
54409
|
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
54410
54410
|
}
|
|
54411
|
-
for (let
|
|
54412
|
-
yield
|
|
54411
|
+
for (let record2 of entries) {
|
|
54412
|
+
yield record2;
|
|
54413
54413
|
}
|
|
54414
54414
|
}
|
|
54415
54415
|
};
|
|
@@ -54458,6 +54458,46 @@ var ListCollection = class {
|
|
|
54458
54458
|
}
|
|
54459
54459
|
};
|
|
54460
54460
|
|
|
54461
|
+
// src/runtime/cache/schema.ts
|
|
54462
|
+
var SchemaManager = class {
|
|
54463
|
+
cache;
|
|
54464
|
+
fieldTypes = {};
|
|
54465
|
+
constructor(cache) {
|
|
54466
|
+
this.cache = cache;
|
|
54467
|
+
}
|
|
54468
|
+
setFieldType({
|
|
54469
|
+
parent,
|
|
54470
|
+
key,
|
|
54471
|
+
type,
|
|
54472
|
+
nullable = false,
|
|
54473
|
+
link
|
|
54474
|
+
}) {
|
|
54475
|
+
let parensIndex = key.indexOf("(");
|
|
54476
|
+
if (parensIndex !== -1) {
|
|
54477
|
+
key = key.substring(0, parensIndex);
|
|
54478
|
+
}
|
|
54479
|
+
if (parent === rootID) {
|
|
54480
|
+
parent = "Query";
|
|
54481
|
+
} else if (parent.includes(":")) {
|
|
54482
|
+
parent = parent.substring(0, parent.indexOf(":"));
|
|
54483
|
+
}
|
|
54484
|
+
if (!this.fieldTypes[parent]) {
|
|
54485
|
+
this.fieldTypes[parent] = {};
|
|
54486
|
+
}
|
|
54487
|
+
this.fieldTypes[parent][key] = {
|
|
54488
|
+
type,
|
|
54489
|
+
nullable,
|
|
54490
|
+
link: !!link
|
|
54491
|
+
};
|
|
54492
|
+
}
|
|
54493
|
+
fieldType(type, field) {
|
|
54494
|
+
return this.fieldTypes[type]?.[field] || null;
|
|
54495
|
+
}
|
|
54496
|
+
get config() {
|
|
54497
|
+
return this.cache._internal_unstable.config;
|
|
54498
|
+
}
|
|
54499
|
+
};
|
|
54500
|
+
|
|
54461
54501
|
// src/runtime/cache/storage.ts
|
|
54462
54502
|
var InMemoryStorage = class {
|
|
54463
54503
|
data;
|
|
@@ -55025,7 +55065,7 @@ var InMemorySubscriptions = class {
|
|
|
55025
55065
|
};
|
|
55026
55066
|
|
|
55027
55067
|
// src/runtime/cache/cache.ts
|
|
55028
|
-
var
|
|
55068
|
+
var Cache3 = class {
|
|
55029
55069
|
_internal_unstable;
|
|
55030
55070
|
constructor(config2) {
|
|
55031
55071
|
this._internal_unstable = new CacheInternal({
|
|
@@ -55033,7 +55073,8 @@ var Cache2 = class {
|
|
|
55033
55073
|
storage: new InMemoryStorage(),
|
|
55034
55074
|
subscriptions: new InMemorySubscriptions(this),
|
|
55035
55075
|
lists: new ListManager(this, rootID),
|
|
55036
|
-
lifetimes: new GarbageCollector(this)
|
|
55076
|
+
lifetimes: new GarbageCollector(this),
|
|
55077
|
+
schema: new SchemaManager(this)
|
|
55037
55078
|
});
|
|
55038
55079
|
if (config2) {
|
|
55039
55080
|
this.setConfig(defaultConfigValues(config2));
|
|
@@ -55119,18 +55160,21 @@ var CacheInternal = class {
|
|
|
55119
55160
|
lists;
|
|
55120
55161
|
cache;
|
|
55121
55162
|
lifetimes;
|
|
55163
|
+
schema;
|
|
55122
55164
|
constructor({
|
|
55123
55165
|
storage,
|
|
55124
55166
|
subscriptions,
|
|
55125
55167
|
lists,
|
|
55126
55168
|
cache,
|
|
55127
|
-
lifetimes
|
|
55169
|
+
lifetimes,
|
|
55170
|
+
schema
|
|
55128
55171
|
}) {
|
|
55129
55172
|
this.storage = storage;
|
|
55130
55173
|
this.subscriptions = subscriptions;
|
|
55131
55174
|
this.lists = lists;
|
|
55132
55175
|
this.cache = cache;
|
|
55133
55176
|
this.lifetimes = lifetimes;
|
|
55177
|
+
this.schema = schema;
|
|
55134
55178
|
this._disabled = typeof globalThis.window === "undefined";
|
|
55135
55179
|
try {
|
|
55136
55180
|
if (process.env.HOUDINI_TEST === "true") {
|
|
@@ -55146,7 +55190,6 @@ var CacheInternal = class {
|
|
|
55146
55190
|
data,
|
|
55147
55191
|
selection: selection2,
|
|
55148
55192
|
variables = {},
|
|
55149
|
-
root = rootID,
|
|
55150
55193
|
parent = rootID,
|
|
55151
55194
|
applyUpdates = false,
|
|
55152
55195
|
layer,
|
|
@@ -55169,9 +55212,17 @@ var CacheInternal = class {
|
|
|
55169
55212
|
selection: fieldSelection,
|
|
55170
55213
|
operations,
|
|
55171
55214
|
abstract: isAbstract,
|
|
55172
|
-
update
|
|
55215
|
+
update,
|
|
55216
|
+
nullable
|
|
55173
55217
|
} = targetSelection[field];
|
|
55174
55218
|
const key = evaluateKey(keyRaw, variables);
|
|
55219
|
+
this.schema.setFieldType({
|
|
55220
|
+
parent,
|
|
55221
|
+
key: keyRaw,
|
|
55222
|
+
type: linkedType,
|
|
55223
|
+
nullable,
|
|
55224
|
+
link: !!fieldSelection
|
|
55225
|
+
});
|
|
55175
55226
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
55176
55227
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
55177
55228
|
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
@@ -55240,7 +55291,6 @@ var CacheInternal = class {
|
|
|
55240
55291
|
}
|
|
55241
55292
|
if (linkedID) {
|
|
55242
55293
|
this.writeSelection({
|
|
55243
|
-
root,
|
|
55244
55294
|
selection: fieldSelection,
|
|
55245
55295
|
parent: linkedID,
|
|
55246
55296
|
data: value,
|
|
@@ -55631,7 +55681,7 @@ var CacheInternal = class {
|
|
|
55631
55681
|
var rootID = "_ROOT_";
|
|
55632
55682
|
|
|
55633
55683
|
// src/runtime/cache/index.ts
|
|
55634
|
-
var cache_default = new
|
|
55684
|
+
var cache_default = new Cache3();
|
|
55635
55685
|
|
|
55636
55686
|
// src/lib/constants.ts
|
|
55637
55687
|
var siteURL = "https://houdinigraphql.com";
|
|
@@ -55817,6 +55867,7 @@ async function writeFile(filepath, data) {
|
|
|
55817
55867
|
return;
|
|
55818
55868
|
}
|
|
55819
55869
|
if (houdini_mode.is_testing) {
|
|
55870
|
+
import_memfs.fs.mkdirpSync(dirname(filepath));
|
|
55820
55871
|
return import_memfs.fs.writeFileSync(filepath, data);
|
|
55821
55872
|
}
|
|
55822
55873
|
return await import_promises.default.writeFile(filepath, data, "utf8");
|
|
@@ -55944,7 +55995,6 @@ var Config = class {
|
|
|
55944
55995
|
rootDir;
|
|
55945
55996
|
projectRoot;
|
|
55946
55997
|
schema;
|
|
55947
|
-
apiUrl;
|
|
55948
55998
|
schemaPath;
|
|
55949
55999
|
persistedQueryPath;
|
|
55950
56000
|
exclude;
|
|
@@ -55984,7 +56034,6 @@ var Config = class {
|
|
|
55984
56034
|
schema,
|
|
55985
56035
|
schemaPath = "./schema.graphql",
|
|
55986
56036
|
exclude = [],
|
|
55987
|
-
apiUrl,
|
|
55988
56037
|
module: module2 = "esm",
|
|
55989
56038
|
scalars,
|
|
55990
56039
|
cacheBufferSize,
|
|
@@ -55994,7 +56043,7 @@ var Config = class {
|
|
|
55994
56043
|
defaultListPosition = "append",
|
|
55995
56044
|
defaultListTarget = null,
|
|
55996
56045
|
defaultKeys,
|
|
55997
|
-
types:
|
|
56046
|
+
types: types14 = {},
|
|
55998
56047
|
logLevel,
|
|
55999
56048
|
defaultFragmentMasking = "enable",
|
|
56000
56049
|
schemaPollInterval = 2e3,
|
|
@@ -56015,11 +56064,6 @@ var Config = class {
|
|
|
56015
56064
|
logLevel = LogLevel.Summary;
|
|
56016
56065
|
}
|
|
56017
56066
|
this.schemaPath = schemaPath;
|
|
56018
|
-
if (apiUrl && apiUrl.startsWith("env:")) {
|
|
56019
|
-
this.apiUrl = process.env[apiUrl.slice("env:".length)];
|
|
56020
|
-
} else {
|
|
56021
|
-
this.apiUrl = apiUrl;
|
|
56022
|
-
}
|
|
56023
56067
|
this.filepath = filepath;
|
|
56024
56068
|
this.exclude = Array.isArray(exclude) ? exclude : [exclude];
|
|
56025
56069
|
this.module = module2;
|
|
@@ -56042,13 +56086,20 @@ var Config = class {
|
|
|
56042
56086
|
if (defaultKeys) {
|
|
56043
56087
|
this.defaultKeys = defaultKeys;
|
|
56044
56088
|
}
|
|
56045
|
-
if (
|
|
56089
|
+
if (types14) {
|
|
56046
56090
|
this.typeConfig = {
|
|
56047
56091
|
...this.typeConfig,
|
|
56048
|
-
...
|
|
56092
|
+
...types14
|
|
56049
56093
|
};
|
|
56050
56094
|
}
|
|
56051
56095
|
}
|
|
56096
|
+
async apiURL() {
|
|
56097
|
+
if (!this.configFile.apiUrl) {
|
|
56098
|
+
return "";
|
|
56099
|
+
}
|
|
56100
|
+
const env = await this.getEnv();
|
|
56101
|
+
return this.processEnvValues(env, this.configFile.apiUrl);
|
|
56102
|
+
}
|
|
56052
56103
|
get include() {
|
|
56053
56104
|
if (this.configFile.include) {
|
|
56054
56105
|
return Array.isArray(this.configFile.include) ? this.configFile.include : [this.configFile.include];
|
|
@@ -56061,23 +56112,43 @@ var Config = class {
|
|
|
56061
56112
|
pluginConfig(name2) {
|
|
56062
56113
|
return this.configFile.plugins?.[name2] ?? {};
|
|
56063
56114
|
}
|
|
56064
|
-
|
|
56065
|
-
|
|
56115
|
+
async getEnv() {
|
|
56116
|
+
let env = process.env;
|
|
56117
|
+
for (const plugin of this.plugins) {
|
|
56118
|
+
if (plugin.env) {
|
|
56119
|
+
env = {
|
|
56120
|
+
...await plugin.env({ config: this, env })
|
|
56121
|
+
};
|
|
56122
|
+
}
|
|
56123
|
+
}
|
|
56124
|
+
return env;
|
|
56125
|
+
}
|
|
56126
|
+
processEnvValues(env, value) {
|
|
56127
|
+
let headerValue;
|
|
56128
|
+
if (typeof value === "function") {
|
|
56129
|
+
headerValue = value(env);
|
|
56130
|
+
} else if (value.startsWith("env:")) {
|
|
56131
|
+
headerValue = env[value.slice("env:".length)];
|
|
56132
|
+
} else {
|
|
56133
|
+
headerValue = value;
|
|
56134
|
+
}
|
|
56135
|
+
return headerValue;
|
|
56136
|
+
}
|
|
56137
|
+
async pullHeaders() {
|
|
56138
|
+
const env = await this.getEnv();
|
|
56139
|
+
if (typeof this.schemaPollHeaders === "function") {
|
|
56140
|
+
return this.schemaPollHeaders(env);
|
|
56141
|
+
}
|
|
56142
|
+
const headers = Object.fromEntries(
|
|
56066
56143
|
Object.entries(this.schemaPollHeaders || {}).map(([key, value]) => {
|
|
56067
|
-
|
|
56068
|
-
if (typeof value === "function") {
|
|
56069
|
-
headerValue = value(process.env);
|
|
56070
|
-
} else if (value.startsWith("env:")) {
|
|
56071
|
-
headerValue = process.env[value.slice("env:".length)];
|
|
56072
|
-
} else {
|
|
56073
|
-
headerValue = value;
|
|
56074
|
-
}
|
|
56144
|
+
const headerValue = this.processEnvValues(env, value);
|
|
56075
56145
|
if (!headerValue) {
|
|
56076
56146
|
return [];
|
|
56077
56147
|
}
|
|
56078
56148
|
return [key, headerValue];
|
|
56079
|
-
})
|
|
56149
|
+
}).filter(([key]) => key)
|
|
56080
56150
|
);
|
|
56151
|
+
return headers;
|
|
56081
56152
|
}
|
|
56082
56153
|
async sourceFiles() {
|
|
56083
56154
|
return [
|
|
@@ -56503,6 +56574,16 @@ function definitionFromAncestors(ancestors) {
|
|
|
56503
56574
|
|
|
56504
56575
|
// src/lib/parse.ts
|
|
56505
56576
|
var import_parser = __toESM(require_lib3(), 1);
|
|
56577
|
+
async function parseJS(str) {
|
|
56578
|
+
return {
|
|
56579
|
+
start: 0,
|
|
56580
|
+
script: (0, import_parser.parse)(str || "", {
|
|
56581
|
+
plugins: ["typescript"],
|
|
56582
|
+
sourceType: "module"
|
|
56583
|
+
}).program,
|
|
56584
|
+
end: str.length
|
|
56585
|
+
};
|
|
56586
|
+
}
|
|
56506
56587
|
|
|
56507
56588
|
// src/lib/imports.ts
|
|
56508
56589
|
var recast = __toESM(require_main2(), 1);
|
|
@@ -56550,7 +56631,7 @@ async function cleanupFiles(pathFolder, listOfObj) {
|
|
|
56550
56631
|
}
|
|
56551
56632
|
|
|
56552
56633
|
// src/codegen/generators/artifacts/index.ts
|
|
56553
|
-
var
|
|
56634
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
56554
56635
|
var recast5 = __toESM(require_main2(), 1);
|
|
56555
56636
|
|
|
56556
56637
|
// src/codegen/utils/commonjs.ts
|
|
@@ -56967,7 +57048,7 @@ function deepMerge(filepath, ...targets) {
|
|
|
56967
57048
|
Object.entries(fields).map(([key, value]) => [key, deepMerge(filepath, ...value)])
|
|
56968
57049
|
);
|
|
56969
57050
|
}
|
|
56970
|
-
function convertValue(val) {
|
|
57051
|
+
function convertValue(config2, val) {
|
|
56971
57052
|
let value;
|
|
56972
57053
|
let kind;
|
|
56973
57054
|
if (val.kind === graphql5.Kind.INT) {
|
|
@@ -57099,7 +57180,7 @@ function operationObject({
|
|
|
57099
57180
|
operationWhen[i ? "must_not" : "must"] = arg.value.fields.reduce(
|
|
57100
57181
|
(obj, arg2) => ({
|
|
57101
57182
|
...obj,
|
|
57102
|
-
[arg2.name.value]: convertValue(arg2.value).value
|
|
57183
|
+
[arg2.name.value]: convertValue(config2, arg2.value).value
|
|
57103
57184
|
}),
|
|
57104
57185
|
{}
|
|
57105
57186
|
);
|
|
@@ -57115,7 +57196,7 @@ function operationObject({
|
|
|
57115
57196
|
operationWhen[which] = directive.arguments?.reduce(
|
|
57116
57197
|
(filters, argument) => ({
|
|
57117
57198
|
...filters,
|
|
57118
|
-
[argument.name.value]: convertValue(argument.value).value
|
|
57199
|
+
[argument.name.value]: convertValue(config2, argument.value).value
|
|
57119
57200
|
}),
|
|
57120
57201
|
{}
|
|
57121
57202
|
);
|
|
@@ -57154,7 +57235,7 @@ function ancestorKey(ancestors) {
|
|
|
57154
57235
|
}
|
|
57155
57236
|
|
|
57156
57237
|
// src/codegen/generators/artifacts/selection.ts
|
|
57157
|
-
var
|
|
57238
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
57158
57239
|
|
|
57159
57240
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
57160
57241
|
var config = {
|
|
@@ -57194,10 +57275,24 @@ function logYellow(str) {
|
|
|
57194
57275
|
}
|
|
57195
57276
|
|
|
57196
57277
|
// src/codegen/transforms/list.ts
|
|
57197
|
-
var
|
|
57278
|
+
var graphql9 = __toESM(require_graphql2(), 1);
|
|
57198
57279
|
|
|
57199
|
-
// src/codegen/
|
|
57280
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
57200
57281
|
var graphql7 = __toESM(require_graphql2(), 1);
|
|
57282
|
+
var objectIdentificationSelection = (config2, type) => {
|
|
57283
|
+
return config2.keyFieldsForType(type.name).map((key) => {
|
|
57284
|
+
return {
|
|
57285
|
+
kind: graphql7.Kind.FIELD,
|
|
57286
|
+
name: {
|
|
57287
|
+
kind: graphql7.Kind.NAME,
|
|
57288
|
+
value: key
|
|
57289
|
+
}
|
|
57290
|
+
};
|
|
57291
|
+
});
|
|
57292
|
+
};
|
|
57293
|
+
|
|
57294
|
+
// src/codegen/transforms/paginate.ts
|
|
57295
|
+
var graphql8 = __toESM(require_graphql2(), 1);
|
|
57201
57296
|
async function paginate(config2, documents) {
|
|
57202
57297
|
const newDocs = [];
|
|
57203
57298
|
for (const doc of documents) {
|
|
@@ -57230,7 +57325,7 @@ async function paginate(config2, documents) {
|
|
|
57230
57325
|
};
|
|
57231
57326
|
let cursorType = "String";
|
|
57232
57327
|
let paginationPath = [];
|
|
57233
|
-
doc.document =
|
|
57328
|
+
doc.document = graphql8.visit(doc.document, {
|
|
57234
57329
|
Field(node, _, __, ___, ancestors) {
|
|
57235
57330
|
const paginateDirective = node.directives?.find(
|
|
57236
57331
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -57257,7 +57352,7 @@ async function paginate(config2, documents) {
|
|
|
57257
57352
|
flags.offset.enabled = offsetPagination;
|
|
57258
57353
|
flags.limit.enabled = offsetPagination;
|
|
57259
57354
|
paginationPath = ancestors.filter(
|
|
57260
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
57355
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql8.Kind.FIELD
|
|
57261
57356
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
57262
57357
|
return {
|
|
57263
57358
|
...node,
|
|
@@ -57278,7 +57373,7 @@ async function paginate(config2, documents) {
|
|
|
57278
57373
|
refetchUpdate = "prepend" /* prepend */;
|
|
57279
57374
|
}
|
|
57280
57375
|
let fragment = "";
|
|
57281
|
-
doc.document =
|
|
57376
|
+
doc.document = graphql8.visit(doc.document, {
|
|
57282
57377
|
OperationDefinition(node) {
|
|
57283
57378
|
if (node.operation !== "query") {
|
|
57284
57379
|
throw new HoudiniError({
|
|
@@ -57332,9 +57427,9 @@ async function paginate(config2, documents) {
|
|
|
57332
57427
|
directives: [
|
|
57333
57428
|
...node.directives || [],
|
|
57334
57429
|
{
|
|
57335
|
-
kind:
|
|
57430
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57336
57431
|
name: {
|
|
57337
|
-
kind:
|
|
57432
|
+
kind: graphql8.Kind.NAME,
|
|
57338
57433
|
value: config2.argumentsDirective
|
|
57339
57434
|
}
|
|
57340
57435
|
}
|
|
@@ -57397,16 +57492,16 @@ async function paginate(config2, documents) {
|
|
|
57397
57492
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
57398
57493
|
const fragmentSpreadSelection = [
|
|
57399
57494
|
{
|
|
57400
|
-
kind:
|
|
57495
|
+
kind: graphql8.Kind.FRAGMENT_SPREAD,
|
|
57401
57496
|
name: {
|
|
57402
|
-
kind:
|
|
57497
|
+
kind: graphql8.Kind.NAME,
|
|
57403
57498
|
value: fragmentName
|
|
57404
57499
|
},
|
|
57405
57500
|
directives: [
|
|
57406
57501
|
{
|
|
57407
|
-
kind:
|
|
57502
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57408
57503
|
name: {
|
|
57409
|
-
kind:
|
|
57504
|
+
kind: graphql8.Kind.NAME,
|
|
57410
57505
|
value: config2.withDirective
|
|
57411
57506
|
},
|
|
57412
57507
|
["arguments"]: paginationArgs.map(
|
|
@@ -57434,29 +57529,29 @@ async function paginate(config2, documents) {
|
|
|
57434
57529
|
});
|
|
57435
57530
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
57436
57531
|
const queryDoc = {
|
|
57437
|
-
kind:
|
|
57532
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
57438
57533
|
definitions: [
|
|
57439
57534
|
{
|
|
57440
|
-
kind:
|
|
57535
|
+
kind: graphql8.Kind.OPERATION_DEFINITION,
|
|
57441
57536
|
name: {
|
|
57442
|
-
kind:
|
|
57537
|
+
kind: graphql8.Kind.NAME,
|
|
57443
57538
|
value: refetchQueryName
|
|
57444
57539
|
},
|
|
57445
57540
|
operation: "query",
|
|
57446
57541
|
variableDefinitions: paginationArgs.map(
|
|
57447
57542
|
(arg) => ({
|
|
57448
|
-
kind:
|
|
57543
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57449
57544
|
type: {
|
|
57450
|
-
kind:
|
|
57545
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57451
57546
|
name: {
|
|
57452
|
-
kind:
|
|
57547
|
+
kind: graphql8.Kind.NAME,
|
|
57453
57548
|
value: arg.type
|
|
57454
57549
|
}
|
|
57455
57550
|
},
|
|
57456
57551
|
variable: {
|
|
57457
|
-
kind:
|
|
57552
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57458
57553
|
name: {
|
|
57459
|
-
kind:
|
|
57554
|
+
kind: graphql8.Kind.NAME,
|
|
57460
57555
|
value: arg.name
|
|
57461
57556
|
}
|
|
57462
57557
|
},
|
|
@@ -57468,12 +57563,12 @@ async function paginate(config2, documents) {
|
|
|
57468
57563
|
).concat(
|
|
57469
57564
|
!nodeQuery ? [] : keys.map(
|
|
57470
57565
|
(key) => ({
|
|
57471
|
-
kind:
|
|
57566
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57472
57567
|
type: key.type,
|
|
57473
57568
|
variable: {
|
|
57474
|
-
kind:
|
|
57569
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57475
57570
|
name: {
|
|
57476
|
-
kind:
|
|
57571
|
+
kind: graphql8.Kind.NAME,
|
|
57477
57572
|
value: key.name
|
|
57478
57573
|
}
|
|
57479
57574
|
}
|
|
@@ -57481,42 +57576,42 @@ async function paginate(config2, documents) {
|
|
|
57481
57576
|
)
|
|
57482
57577
|
),
|
|
57483
57578
|
selectionSet: {
|
|
57484
|
-
kind:
|
|
57579
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57485
57580
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
57486
57581
|
{
|
|
57487
|
-
kind:
|
|
57582
|
+
kind: graphql8.Kind.FIELD,
|
|
57488
57583
|
name: {
|
|
57489
|
-
kind:
|
|
57584
|
+
kind: graphql8.Kind.NAME,
|
|
57490
57585
|
value: typeConfig?.resolve?.queryField || "node"
|
|
57491
57586
|
},
|
|
57492
57587
|
["arguments"]: keys.map((key) => ({
|
|
57493
|
-
kind:
|
|
57588
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57494
57589
|
name: {
|
|
57495
|
-
kind:
|
|
57590
|
+
kind: graphql8.Kind.NAME,
|
|
57496
57591
|
value: key.name
|
|
57497
57592
|
},
|
|
57498
57593
|
value: {
|
|
57499
|
-
kind:
|
|
57594
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57500
57595
|
name: {
|
|
57501
|
-
kind:
|
|
57596
|
+
kind: graphql8.Kind.NAME,
|
|
57502
57597
|
value: key.name
|
|
57503
57598
|
}
|
|
57504
57599
|
}
|
|
57505
57600
|
})),
|
|
57506
57601
|
selectionSet: {
|
|
57507
|
-
kind:
|
|
57602
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57508
57603
|
selections: [
|
|
57509
57604
|
{
|
|
57510
|
-
kind:
|
|
57605
|
+
kind: graphql8.Kind.FIELD,
|
|
57511
57606
|
name: {
|
|
57512
|
-
kind:
|
|
57607
|
+
kind: graphql8.Kind.NAME,
|
|
57513
57608
|
value: "__typename"
|
|
57514
57609
|
}
|
|
57515
57610
|
},
|
|
57516
57611
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
57517
|
-
kind:
|
|
57612
|
+
kind: graphql8.Kind.FIELD,
|
|
57518
57613
|
name: {
|
|
57519
|
-
kind:
|
|
57614
|
+
kind: graphql8.Kind.NAME,
|
|
57520
57615
|
value: key
|
|
57521
57616
|
}
|
|
57522
57617
|
})),
|
|
@@ -57578,15 +57673,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
57578
57673
|
}
|
|
57579
57674
|
function variableAsArgument(name2, variable) {
|
|
57580
57675
|
return {
|
|
57581
|
-
kind:
|
|
57676
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57582
57677
|
name: {
|
|
57583
|
-
kind:
|
|
57678
|
+
kind: graphql8.Kind.NAME,
|
|
57584
57679
|
value: name2
|
|
57585
57680
|
},
|
|
57586
57681
|
value: {
|
|
57587
|
-
kind:
|
|
57682
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57588
57683
|
name: {
|
|
57589
|
-
kind:
|
|
57684
|
+
kind: graphql8.Kind.NAME,
|
|
57590
57685
|
value: variable ?? name2
|
|
57591
57686
|
}
|
|
57592
57687
|
}
|
|
@@ -57594,18 +57689,18 @@ function variableAsArgument(name2, variable) {
|
|
|
57594
57689
|
}
|
|
57595
57690
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
57596
57691
|
return {
|
|
57597
|
-
kind:
|
|
57692
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57598
57693
|
type: {
|
|
57599
|
-
kind:
|
|
57694
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57600
57695
|
name: {
|
|
57601
|
-
kind:
|
|
57696
|
+
kind: graphql8.Kind.NAME,
|
|
57602
57697
|
value: type
|
|
57603
57698
|
}
|
|
57604
57699
|
},
|
|
57605
57700
|
variable: {
|
|
57606
|
-
kind:
|
|
57701
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57607
57702
|
name: {
|
|
57608
|
-
kind:
|
|
57703
|
+
kind: graphql8.Kind.NAME,
|
|
57609
57704
|
value: variableName ?? name2
|
|
57610
57705
|
}
|
|
57611
57706
|
},
|
|
@@ -57617,9 +57712,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
57617
57712
|
}
|
|
57618
57713
|
function argumentNode(name2, value) {
|
|
57619
57714
|
return {
|
|
57620
|
-
kind:
|
|
57715
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57621
57716
|
name: {
|
|
57622
|
-
kind:
|
|
57717
|
+
kind: graphql8.Kind.NAME,
|
|
57623
57718
|
value: name2
|
|
57624
57719
|
},
|
|
57625
57720
|
value: objectNode(value)
|
|
@@ -57627,16 +57722,16 @@ function argumentNode(name2, value) {
|
|
|
57627
57722
|
}
|
|
57628
57723
|
function objectNode([type, defaultValue]) {
|
|
57629
57724
|
const node = {
|
|
57630
|
-
kind:
|
|
57725
|
+
kind: graphql8.Kind.OBJECT,
|
|
57631
57726
|
fields: [
|
|
57632
57727
|
{
|
|
57633
|
-
kind:
|
|
57728
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57634
57729
|
name: {
|
|
57635
|
-
kind:
|
|
57730
|
+
kind: graphql8.Kind.NAME,
|
|
57636
57731
|
value: "type"
|
|
57637
57732
|
},
|
|
57638
57733
|
value: {
|
|
57639
|
-
kind:
|
|
57734
|
+
kind: graphql8.Kind.STRING,
|
|
57640
57735
|
value: type
|
|
57641
57736
|
}
|
|
57642
57737
|
}
|
|
@@ -57644,8 +57739,8 @@ function objectNode([type, defaultValue]) {
|
|
|
57644
57739
|
};
|
|
57645
57740
|
if (defaultValue) {
|
|
57646
57741
|
node.fields.push({
|
|
57647
|
-
kind:
|
|
57648
|
-
name: { kind:
|
|
57742
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57743
|
+
name: { kind: graphql8.Kind.NAME, value: "default" },
|
|
57649
57744
|
value: {
|
|
57650
57745
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
57651
57746
|
value: defaultValue.toString()
|
|
@@ -57656,34 +57751,34 @@ function objectNode([type, defaultValue]) {
|
|
|
57656
57751
|
}
|
|
57657
57752
|
var pageInfoSelection = [
|
|
57658
57753
|
{
|
|
57659
|
-
kind:
|
|
57754
|
+
kind: graphql8.Kind.FIELD,
|
|
57660
57755
|
name: {
|
|
57661
|
-
kind:
|
|
57756
|
+
kind: graphql8.Kind.NAME,
|
|
57662
57757
|
value: "edges"
|
|
57663
57758
|
},
|
|
57664
57759
|
selectionSet: {
|
|
57665
|
-
kind:
|
|
57760
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57666
57761
|
selections: [
|
|
57667
57762
|
{
|
|
57668
|
-
kind:
|
|
57763
|
+
kind: graphql8.Kind.FIELD,
|
|
57669
57764
|
name: {
|
|
57670
|
-
kind:
|
|
57765
|
+
kind: graphql8.Kind.NAME,
|
|
57671
57766
|
value: "cursor"
|
|
57672
57767
|
}
|
|
57673
57768
|
},
|
|
57674
57769
|
{
|
|
57675
|
-
kind:
|
|
57770
|
+
kind: graphql8.Kind.FIELD,
|
|
57676
57771
|
name: {
|
|
57677
|
-
kind:
|
|
57772
|
+
kind: graphql8.Kind.NAME,
|
|
57678
57773
|
value: "node"
|
|
57679
57774
|
},
|
|
57680
57775
|
selectionSet: {
|
|
57681
|
-
kind:
|
|
57776
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57682
57777
|
selections: [
|
|
57683
57778
|
{
|
|
57684
|
-
kind:
|
|
57779
|
+
kind: graphql8.Kind.FIELD,
|
|
57685
57780
|
name: {
|
|
57686
|
-
kind:
|
|
57781
|
+
kind: graphql8.Kind.NAME,
|
|
57687
57782
|
value: "__typename"
|
|
57688
57783
|
}
|
|
57689
57784
|
}
|
|
@@ -57694,39 +57789,39 @@ var pageInfoSelection = [
|
|
|
57694
57789
|
}
|
|
57695
57790
|
},
|
|
57696
57791
|
{
|
|
57697
|
-
kind:
|
|
57792
|
+
kind: graphql8.Kind.FIELD,
|
|
57698
57793
|
name: {
|
|
57699
|
-
kind:
|
|
57794
|
+
kind: graphql8.Kind.NAME,
|
|
57700
57795
|
value: "pageInfo"
|
|
57701
57796
|
},
|
|
57702
57797
|
selectionSet: {
|
|
57703
|
-
kind:
|
|
57798
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57704
57799
|
selections: [
|
|
57705
57800
|
{
|
|
57706
|
-
kind:
|
|
57801
|
+
kind: graphql8.Kind.FIELD,
|
|
57707
57802
|
name: {
|
|
57708
|
-
kind:
|
|
57803
|
+
kind: graphql8.Kind.NAME,
|
|
57709
57804
|
value: "hasPreviousPage"
|
|
57710
57805
|
}
|
|
57711
57806
|
},
|
|
57712
57807
|
{
|
|
57713
|
-
kind:
|
|
57808
|
+
kind: graphql8.Kind.FIELD,
|
|
57714
57809
|
name: {
|
|
57715
|
-
kind:
|
|
57810
|
+
kind: graphql8.Kind.NAME,
|
|
57716
57811
|
value: "hasNextPage"
|
|
57717
57812
|
}
|
|
57718
57813
|
},
|
|
57719
57814
|
{
|
|
57720
|
-
kind:
|
|
57815
|
+
kind: graphql8.Kind.FIELD,
|
|
57721
57816
|
name: {
|
|
57722
|
-
kind:
|
|
57817
|
+
kind: graphql8.Kind.NAME,
|
|
57723
57818
|
value: "startCursor"
|
|
57724
57819
|
}
|
|
57725
57820
|
},
|
|
57726
57821
|
{
|
|
57727
|
-
kind:
|
|
57822
|
+
kind: graphql8.Kind.FIELD,
|
|
57728
57823
|
name: {
|
|
57729
|
-
kind:
|
|
57824
|
+
kind: graphql8.Kind.NAME,
|
|
57730
57825
|
value: "endCursor"
|
|
57731
57826
|
}
|
|
57732
57827
|
}
|
|
@@ -57740,15 +57835,15 @@ async function addListFragments(config2, documents) {
|
|
|
57740
57835
|
const lists = {};
|
|
57741
57836
|
const errors = [];
|
|
57742
57837
|
for (const doc of documents) {
|
|
57743
|
-
doc.document =
|
|
57838
|
+
doc.document = graphql9.visit(doc.document, {
|
|
57744
57839
|
Directive(node, key, parent, path2, ancestors) {
|
|
57745
57840
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
57746
57841
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
57747
57842
|
let error = {
|
|
57748
|
-
...new
|
|
57843
|
+
...new graphql9.GraphQLError(
|
|
57749
57844
|
"",
|
|
57750
57845
|
node,
|
|
57751
|
-
new
|
|
57846
|
+
new graphql9.Source(""),
|
|
57752
57847
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
57753
57848
|
path2
|
|
57754
57849
|
),
|
|
@@ -57800,7 +57895,7 @@ async function addListFragments(config2, documents) {
|
|
|
57800
57895
|
{
|
|
57801
57896
|
kind: "Argument",
|
|
57802
57897
|
name: {
|
|
57803
|
-
kind:
|
|
57898
|
+
kind: graphql9.Kind.NAME,
|
|
57804
57899
|
value: "connection"
|
|
57805
57900
|
},
|
|
57806
57901
|
value: {
|
|
@@ -57847,10 +57942,13 @@ async function addListFragments(config2, documents) {
|
|
|
57847
57942
|
if (errors.length > 0) {
|
|
57848
57943
|
throw errors;
|
|
57849
57944
|
}
|
|
57850
|
-
const
|
|
57945
|
+
const validDeletes = [
|
|
57851
57946
|
...new Set(
|
|
57852
57947
|
Object.values(lists).map(({ type }) => {
|
|
57853
|
-
if (!(type instanceof
|
|
57948
|
+
if (!(type instanceof graphql9.GraphQLObjectType)) {
|
|
57949
|
+
return "";
|
|
57950
|
+
}
|
|
57951
|
+
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
57854
57952
|
return "";
|
|
57855
57953
|
}
|
|
57856
57954
|
return type.name;
|
|
@@ -57861,7 +57959,7 @@ async function addListFragments(config2, documents) {
|
|
|
57861
57959
|
return;
|
|
57862
57960
|
}
|
|
57863
57961
|
const generatedDoc = {
|
|
57864
|
-
kind:
|
|
57962
|
+
kind: graphql9.Kind.DOCUMENT,
|
|
57865
57963
|
definitions: Object.entries(lists).flatMap(
|
|
57866
57964
|
([name2, { selection: selection2, type }]) => {
|
|
57867
57965
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -57869,35 +57967,29 @@ async function addListFragments(config2, documents) {
|
|
|
57869
57967
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
57870
57968
|
}
|
|
57871
57969
|
const fragmentSelection = {
|
|
57872
|
-
kind:
|
|
57970
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57873
57971
|
selections: [...selection2.selections]
|
|
57874
57972
|
};
|
|
57875
57973
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
57876
|
-
(field) => field.kind === "Field" && field.name.value
|
|
57974
|
+
(field) => field.kind === "Field" && config2.keyFieldsForType(type.name).includes(field.name.value)
|
|
57877
57975
|
)) {
|
|
57878
57976
|
fragmentSelection.selections = [
|
|
57879
57977
|
...fragmentSelection.selections,
|
|
57880
|
-
|
|
57881
|
-
kind: graphql8.Kind.FIELD,
|
|
57882
|
-
name: {
|
|
57883
|
-
kind: graphql8.Kind.NAME,
|
|
57884
|
-
value: "id"
|
|
57885
|
-
}
|
|
57886
|
-
}
|
|
57978
|
+
...objectIdentificationSelection(config2, type)
|
|
57887
57979
|
];
|
|
57888
57980
|
}
|
|
57889
57981
|
return [
|
|
57890
57982
|
{
|
|
57891
57983
|
name: {
|
|
57892
57984
|
value: config2.listInsertFragment(name2),
|
|
57893
|
-
kind:
|
|
57985
|
+
kind: graphql9.Kind.NAME
|
|
57894
57986
|
},
|
|
57895
|
-
kind:
|
|
57987
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57896
57988
|
selectionSet: fragmentSelection,
|
|
57897
57989
|
typeCondition: {
|
|
57898
|
-
kind:
|
|
57990
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57899
57991
|
name: {
|
|
57900
|
-
kind:
|
|
57992
|
+
kind: graphql9.Kind.NAME,
|
|
57901
57993
|
value: type.name
|
|
57902
57994
|
}
|
|
57903
57995
|
}
|
|
@@ -57905,52 +57997,32 @@ async function addListFragments(config2, documents) {
|
|
|
57905
57997
|
{
|
|
57906
57998
|
name: {
|
|
57907
57999
|
value: config2.listToggleFragment(name2),
|
|
57908
|
-
kind:
|
|
57909
|
-
},
|
|
57910
|
-
kind: graphql8.Kind.FRAGMENT_DEFINITION,
|
|
57911
|
-
selectionSet: {
|
|
57912
|
-
...fragmentSelection,
|
|
57913
|
-
selections: [
|
|
57914
|
-
...fragmentSelection.selections,
|
|
57915
|
-
{
|
|
57916
|
-
kind: graphql8.Kind.FIELD,
|
|
57917
|
-
name: {
|
|
57918
|
-
kind: graphql8.Kind.NAME,
|
|
57919
|
-
value: "id"
|
|
57920
|
-
}
|
|
57921
|
-
}
|
|
57922
|
-
]
|
|
58000
|
+
kind: graphql9.Kind.NAME
|
|
57923
58001
|
},
|
|
58002
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
58003
|
+
selectionSet: fragmentSelection,
|
|
57924
58004
|
typeCondition: {
|
|
57925
|
-
kind:
|
|
58005
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57926
58006
|
name: {
|
|
57927
|
-
kind:
|
|
58007
|
+
kind: graphql9.Kind.NAME,
|
|
57928
58008
|
value: type.name
|
|
57929
58009
|
}
|
|
57930
58010
|
}
|
|
57931
58011
|
},
|
|
57932
58012
|
{
|
|
57933
|
-
kind:
|
|
58013
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57934
58014
|
name: {
|
|
57935
58015
|
value: config2.listRemoveFragment(name2),
|
|
57936
|
-
kind:
|
|
58016
|
+
kind: graphql9.Kind.NAME
|
|
57937
58017
|
},
|
|
57938
58018
|
selectionSet: {
|
|
57939
|
-
kind:
|
|
57940
|
-
selections: [
|
|
57941
|
-
{
|
|
57942
|
-
kind: graphql8.Kind.FIELD,
|
|
57943
|
-
name: {
|
|
57944
|
-
kind: graphql8.Kind.NAME,
|
|
57945
|
-
value: "id"
|
|
57946
|
-
}
|
|
57947
|
-
}
|
|
57948
|
-
]
|
|
58019
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
58020
|
+
selections: [...objectIdentificationSelection(config2, type)]
|
|
57949
58021
|
},
|
|
57950
58022
|
typeCondition: {
|
|
57951
|
-
kind:
|
|
58023
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57952
58024
|
name: {
|
|
57953
|
-
kind:
|
|
58025
|
+
kind: graphql9.Kind.NAME,
|
|
57954
58026
|
value: type.name
|
|
57955
58027
|
}
|
|
57956
58028
|
}
|
|
@@ -57958,15 +58030,15 @@ async function addListFragments(config2, documents) {
|
|
|
57958
58030
|
];
|
|
57959
58031
|
}
|
|
57960
58032
|
).concat(
|
|
57961
|
-
...
|
|
57962
|
-
kind:
|
|
58033
|
+
...validDeletes.map((typeName) => ({
|
|
58034
|
+
kind: graphql9.Kind.DIRECTIVE_DEFINITION,
|
|
57963
58035
|
name: {
|
|
57964
|
-
kind:
|
|
58036
|
+
kind: graphql9.Kind.NAME,
|
|
57965
58037
|
value: config2.listDeleteDirective(typeName)
|
|
57966
58038
|
},
|
|
57967
58039
|
locations: [
|
|
57968
58040
|
{
|
|
57969
|
-
kind:
|
|
58041
|
+
kind: graphql9.Kind.NAME,
|
|
57970
58042
|
value: "FIELD"
|
|
57971
58043
|
}
|
|
57972
58044
|
],
|
|
@@ -57974,8 +58046,8 @@ async function addListFragments(config2, documents) {
|
|
|
57974
58046
|
}))
|
|
57975
58047
|
)
|
|
57976
58048
|
};
|
|
57977
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
57978
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
58049
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
58050
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57979
58051
|
documents.push({
|
|
57980
58052
|
name: "generated::lists",
|
|
57981
58053
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -58060,11 +58132,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
58060
58132
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
58061
58133
|
|
|
58062
58134
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
58063
|
-
var
|
|
58135
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
58064
58136
|
function fieldKey(config2, field) {
|
|
58065
58137
|
const attributeName = field.alias?.value || field.name.value;
|
|
58066
|
-
const printed =
|
|
58067
|
-
const secondParse =
|
|
58138
|
+
const printed = graphql10.print(field);
|
|
58139
|
+
const secondParse = graphql10.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
58068
58140
|
const paginated = !!field.directives?.find(
|
|
58069
58141
|
(directive) => directive.name.value === config2.paginateDirective
|
|
58070
58142
|
);
|
|
@@ -58083,7 +58155,9 @@ function fieldKey(config2, field) {
|
|
|
58083
58155
|
[arg.name.value]: printed.substring(start - 1, end - 1)
|
|
58084
58156
|
};
|
|
58085
58157
|
}, {});
|
|
58086
|
-
|
|
58158
|
+
const args = Object.keys(argObj);
|
|
58159
|
+
args.sort();
|
|
58160
|
+
let key = Object.values(argObj).length > 0 ? `${attributeName}(${args.map((key2) => `${key2}: ${argObj[key2]}`).join(", ")})` : attributeName;
|
|
58087
58161
|
if (paginated) {
|
|
58088
58162
|
key = key + "::paginated";
|
|
58089
58163
|
}
|
|
@@ -58157,8 +58231,8 @@ function selection({
|
|
|
58157
58231
|
const typeConditionName = field.typeCondition.name.value;
|
|
58158
58232
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
58159
58233
|
const possibleTypes = [];
|
|
58160
|
-
if (!
|
|
58161
|
-
} else if (
|
|
58234
|
+
if (!graphql11.isAbstractType(typeCondition)) {
|
|
58235
|
+
} else if (graphql11.isAbstractType(parentType)) {
|
|
58162
58236
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
58163
58237
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
58164
58238
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -58206,7 +58280,7 @@ function selection({
|
|
|
58206
58280
|
} else {
|
|
58207
58281
|
let typeRef = type.getFields()[field.name.value].type;
|
|
58208
58282
|
fieldType = getRootType(typeRef);
|
|
58209
|
-
nullable = !
|
|
58283
|
+
nullable = !graphql11.isNonNullType(typeRef);
|
|
58210
58284
|
}
|
|
58211
58285
|
const typeName = fieldType.toString();
|
|
58212
58286
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -58266,12 +58340,12 @@ function selection({
|
|
|
58266
58340
|
fieldObj.filters = (field.arguments || []).reduce(
|
|
58267
58341
|
(filters, arg) => ({
|
|
58268
58342
|
...filters,
|
|
58269
|
-
[arg.name.value]: convertValue(arg.value)
|
|
58343
|
+
[arg.name.value]: convertValue(config2, arg.value)
|
|
58270
58344
|
}),
|
|
58271
58345
|
{}
|
|
58272
58346
|
);
|
|
58273
58347
|
}
|
|
58274
|
-
if (
|
|
58348
|
+
if (graphql11.isInterfaceType(fieldType) || graphql11.isUnionType(fieldType)) {
|
|
58275
58349
|
fieldObj.abstract = true;
|
|
58276
58350
|
}
|
|
58277
58351
|
object.fields = {
|
|
@@ -58328,7 +58402,7 @@ function artifactGenerator(stats) {
|
|
|
58328
58402
|
return async function(config2, docs) {
|
|
58329
58403
|
const filterTypes = {};
|
|
58330
58404
|
for (const doc of docs) {
|
|
58331
|
-
|
|
58405
|
+
graphql12.visit(doc.document, {
|
|
58332
58406
|
Directive(node, _, __, ___, ancestors) {
|
|
58333
58407
|
if (node.name.value !== config2.listDirective) {
|
|
58334
58408
|
return;
|
|
@@ -58387,7 +58461,7 @@ function artifactGenerator(stats) {
|
|
|
58387
58461
|
return;
|
|
58388
58462
|
}
|
|
58389
58463
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
58390
|
-
let documentWithoutInternalDirectives =
|
|
58464
|
+
let documentWithoutInternalDirectives = graphql12.visit(document, {
|
|
58391
58465
|
Directive(node) {
|
|
58392
58466
|
if (config2.isInternalDirective(node)) {
|
|
58393
58467
|
return null;
|
|
@@ -58400,7 +58474,7 @@ function artifactGenerator(stats) {
|
|
|
58400
58474
|
}
|
|
58401
58475
|
}
|
|
58402
58476
|
});
|
|
58403
|
-
let documentWithoutExtraVariables =
|
|
58477
|
+
let documentWithoutExtraVariables = graphql12.visit(
|
|
58404
58478
|
documentWithoutInternalDirectives,
|
|
58405
58479
|
{
|
|
58406
58480
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -58411,13 +58485,13 @@ function artifactGenerator(stats) {
|
|
|
58411
58485
|
}
|
|
58412
58486
|
}
|
|
58413
58487
|
);
|
|
58414
|
-
let rawString =
|
|
58488
|
+
let rawString = graphql12.print(documentWithoutExtraVariables);
|
|
58415
58489
|
let docKind = doc.kind;
|
|
58416
58490
|
const operations = document.definitions.filter(
|
|
58417
|
-
({ kind }) => kind ===
|
|
58491
|
+
({ kind }) => kind === graphql12.Kind.OPERATION_DEFINITION
|
|
58418
58492
|
);
|
|
58419
58493
|
const fragments = document.definitions.filter(
|
|
58420
|
-
({ kind }) => kind ===
|
|
58494
|
+
({ kind }) => kind === graphql12.Kind.FRAGMENT_DEFINITION
|
|
58421
58495
|
);
|
|
58422
58496
|
let rootType = "";
|
|
58423
58497
|
let selectionSet;
|
|
@@ -58553,7 +58627,9 @@ function artifactGenerator(stats) {
|
|
|
58553
58627
|
}
|
|
58554
58628
|
|
|
58555
58629
|
// src/codegen/generators/runtime/index.ts
|
|
58556
|
-
|
|
58630
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
58631
|
+
var AST6 = recast6.types.builders;
|
|
58632
|
+
async function runtimeGenerator(config2, docs) {
|
|
58557
58633
|
await Promise.all([
|
|
58558
58634
|
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
58559
58635
|
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
@@ -58567,6 +58643,59 @@ async function runtimeGenerator(config2) {
|
|
|
58567
58643
|
}),
|
|
58568
58644
|
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
58569
58645
|
]);
|
|
58646
|
+
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
58647
|
+
const contents = await parseJS(await fs_exports.readFile(indexPath) || "");
|
|
58648
|
+
const graphql_tag_return = config2.plugins.find(
|
|
58649
|
+
(plugin) => plugin.graphql_tag_return
|
|
58650
|
+
)?.graphql_tag_return;
|
|
58651
|
+
if (graphql_tag_return && contents) {
|
|
58652
|
+
const overloaded_returns = {};
|
|
58653
|
+
for (const doc of docs) {
|
|
58654
|
+
const return_value = graphql_tag_return({
|
|
58655
|
+
config: config2,
|
|
58656
|
+
doc,
|
|
58657
|
+
ensure_import({ identifier, module: module2 }) {
|
|
58658
|
+
ensureImports({
|
|
58659
|
+
config: config2,
|
|
58660
|
+
body: contents.script.body,
|
|
58661
|
+
sourceModule: module2,
|
|
58662
|
+
import: [identifier]
|
|
58663
|
+
});
|
|
58664
|
+
}
|
|
58665
|
+
});
|
|
58666
|
+
if (return_value) {
|
|
58667
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
58668
|
+
}
|
|
58669
|
+
}
|
|
58670
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
58671
|
+
for (const [i, expression] of (contents?.script.body ?? []).entries()) {
|
|
58672
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
58673
|
+
continue;
|
|
58674
|
+
}
|
|
58675
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
58676
|
+
const input = AST6.identifier("str");
|
|
58677
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
58678
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
58679
|
+
);
|
|
58680
|
+
contents?.script.body.splice(
|
|
58681
|
+
i,
|
|
58682
|
+
0,
|
|
58683
|
+
AST6.exportNamedDeclaration(
|
|
58684
|
+
AST6.tsDeclareFunction(
|
|
58685
|
+
AST6.identifier("graphql"),
|
|
58686
|
+
[input],
|
|
58687
|
+
AST6.tsTypeAnnotation(
|
|
58688
|
+
AST6.tsTypeReference(AST6.identifier(returnValue))
|
|
58689
|
+
)
|
|
58690
|
+
)
|
|
58691
|
+
)
|
|
58692
|
+
);
|
|
58693
|
+
}
|
|
58694
|
+
break;
|
|
58695
|
+
}
|
|
58696
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
58697
|
+
}
|
|
58698
|
+
}
|
|
58570
58699
|
}
|
|
58571
58700
|
async function generatePluginRuntime(config2, plugin) {
|
|
58572
58701
|
if (houdini_mode.is_testing) {
|
|
@@ -58601,20 +58730,20 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
58601
58730
|
}
|
|
58602
58731
|
|
|
58603
58732
|
// src/codegen/generators/typescript/index.ts
|
|
58604
|
-
var
|
|
58733
|
+
var recast12 = __toESM(require_main2(), 1);
|
|
58605
58734
|
|
|
58606
58735
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58736
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
58737
|
+
var recast9 = __toESM(require_main2(), 1);
|
|
58738
|
+
|
|
58739
|
+
// src/codegen/generators/typescript/typeReference.ts
|
|
58607
58740
|
var graphql14 = __toESM(require_graphql2(), 1);
|
|
58608
58741
|
var recast8 = __toESM(require_main2(), 1);
|
|
58609
58742
|
|
|
58610
|
-
// src/codegen/generators/typescript/
|
|
58743
|
+
// src/codegen/generators/typescript/types.ts
|
|
58611
58744
|
var graphql13 = __toESM(require_graphql2(), 1);
|
|
58612
58745
|
var recast7 = __toESM(require_main2(), 1);
|
|
58613
|
-
|
|
58614
|
-
// src/codegen/generators/typescript/types.ts
|
|
58615
|
-
var graphql12 = __toESM(require_graphql2(), 1);
|
|
58616
|
-
var recast6 = __toESM(require_main2(), 1);
|
|
58617
|
-
var AST6 = recast6.types.builders;
|
|
58746
|
+
var AST7 = recast7.types.builders;
|
|
58618
58747
|
function readonlyProperty(prop, enable = true) {
|
|
58619
58748
|
if (enable) {
|
|
58620
58749
|
prop.readonly = true;
|
|
@@ -58622,31 +58751,31 @@ function readonlyProperty(prop, enable = true) {
|
|
|
58622
58751
|
return prop;
|
|
58623
58752
|
}
|
|
58624
58753
|
function nullableField(inner, input = false) {
|
|
58625
|
-
const members = [inner,
|
|
58754
|
+
const members = [inner, AST7.tsNullKeyword()];
|
|
58626
58755
|
if (input) {
|
|
58627
|
-
members.push(
|
|
58756
|
+
members.push(AST7.tsUndefinedKeyword());
|
|
58628
58757
|
}
|
|
58629
|
-
return
|
|
58758
|
+
return AST7.tsUnionType(members);
|
|
58630
58759
|
}
|
|
58631
58760
|
function scalarPropertyValue(config2, missingScalars, target) {
|
|
58632
58761
|
switch (target.name) {
|
|
58633
58762
|
case "String": {
|
|
58634
|
-
return
|
|
58763
|
+
return AST7.tsStringKeyword();
|
|
58635
58764
|
}
|
|
58636
58765
|
case "Int": {
|
|
58637
|
-
return
|
|
58766
|
+
return AST7.tsNumberKeyword();
|
|
58638
58767
|
}
|
|
58639
58768
|
case "Float": {
|
|
58640
|
-
return
|
|
58769
|
+
return AST7.tsNumberKeyword();
|
|
58641
58770
|
}
|
|
58642
58771
|
case "Boolean": {
|
|
58643
|
-
return
|
|
58772
|
+
return AST7.tsBooleanKeyword();
|
|
58644
58773
|
}
|
|
58645
58774
|
case "ID": {
|
|
58646
|
-
return
|
|
58775
|
+
return AST7.tsStringKeyword();
|
|
58647
58776
|
}
|
|
58648
58777
|
default: {
|
|
58649
|
-
if (
|
|
58778
|
+
if (graphql13.isNonNullType(target) && "ofType" in target) {
|
|
58650
58779
|
return scalarPropertyValue(
|
|
58651
58780
|
config2,
|
|
58652
58781
|
missingScalars,
|
|
@@ -58654,23 +58783,23 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
58654
58783
|
);
|
|
58655
58784
|
}
|
|
58656
58785
|
if (config2.scalars?.[target.name]) {
|
|
58657
|
-
return
|
|
58786
|
+
return AST7.tsTypeReference(AST7.identifier(config2.scalars?.[target.name].type));
|
|
58658
58787
|
}
|
|
58659
58788
|
missingScalars.add(target.name);
|
|
58660
|
-
return
|
|
58789
|
+
return AST7.tsAnyKeyword();
|
|
58661
58790
|
}
|
|
58662
58791
|
}
|
|
58663
58792
|
}
|
|
58664
58793
|
|
|
58665
58794
|
// src/codegen/generators/typescript/typeReference.ts
|
|
58666
|
-
var
|
|
58795
|
+
var AST8 = recast8.types.builders;
|
|
58667
58796
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
58668
58797
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
58669
58798
|
let result;
|
|
58670
|
-
if (
|
|
58799
|
+
if (graphql14.isScalarType(type)) {
|
|
58671
58800
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58672
58801
|
} else {
|
|
58673
|
-
result =
|
|
58802
|
+
result = AST8.tsTypeReference(AST8.identifier(type.name));
|
|
58674
58803
|
}
|
|
58675
58804
|
for (const toWrap of wrappers) {
|
|
58676
58805
|
if (toWrap === "NonNull" /* NonNull */) {
|
|
@@ -58678,27 +58807,27 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
58678
58807
|
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
58679
58808
|
result = nullableField(result, true);
|
|
58680
58809
|
} else if (toWrap === "List" /* List */) {
|
|
58681
|
-
result =
|
|
58810
|
+
result = AST8.tsArrayType(AST8.tsParenthesizedType(result));
|
|
58682
58811
|
}
|
|
58683
58812
|
}
|
|
58684
58813
|
return result;
|
|
58685
58814
|
}
|
|
58686
58815
|
|
|
58687
58816
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58688
|
-
var
|
|
58817
|
+
var AST9 = recast9.types.builders;
|
|
58689
58818
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
58690
58819
|
const { type } = unwrapType(config2, rootType);
|
|
58691
|
-
if (
|
|
58820
|
+
if (graphql15.isScalarType(type)) {
|
|
58692
58821
|
return;
|
|
58693
58822
|
}
|
|
58694
58823
|
if (visitedTypes.has(type.name)) {
|
|
58695
58824
|
return;
|
|
58696
58825
|
}
|
|
58697
|
-
if (
|
|
58826
|
+
if (graphql15.isUnionType(type)) {
|
|
58698
58827
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
58699
58828
|
}
|
|
58700
58829
|
visitedTypes.add(type.name);
|
|
58701
|
-
if (
|
|
58830
|
+
if (graphql15.isEnumType(type)) {
|
|
58702
58831
|
ensureImports({
|
|
58703
58832
|
config: config2,
|
|
58704
58833
|
body,
|
|
@@ -58712,20 +58841,267 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58712
58841
|
for (const field of Object.values(type.getFields())) {
|
|
58713
58842
|
addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, field.type);
|
|
58714
58843
|
members.push(
|
|
58715
|
-
|
|
58716
|
-
|
|
58717
|
-
|
|
58718
|
-
|
|
58844
|
+
AST9.tsPropertySignature(
|
|
58845
|
+
AST9.identifier(field.name),
|
|
58846
|
+
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
58847
|
+
graphql15.isNullableType(field.type)
|
|
58719
58848
|
)
|
|
58720
58849
|
);
|
|
58721
58850
|
}
|
|
58722
|
-
body.push(
|
|
58851
|
+
body.push(AST9.tsTypeAliasDeclaration(AST9.identifier(type.name), AST9.tsTypeLiteral(members)));
|
|
58852
|
+
}
|
|
58853
|
+
|
|
58854
|
+
// src/codegen/generators/typescript/imperativeCache.ts
|
|
58855
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
58856
|
+
var recast10 = __toESM(require_main2(), 1);
|
|
58857
|
+
var AST10 = recast10.types.builders;
|
|
58858
|
+
async function imperativeCacheTypef(config2, docs) {
|
|
58859
|
+
const target = path_exports.join(config2.runtimeDirectory, "generated.d.ts");
|
|
58860
|
+
const body = [];
|
|
58861
|
+
const declaration = AST10.tsTypeAliasDeclaration(
|
|
58862
|
+
AST10.identifier(CacheTypeDefName),
|
|
58863
|
+
AST10.tsTypeLiteral([
|
|
58864
|
+
AST10.tsPropertySignature(
|
|
58865
|
+
AST10.identifier("types"),
|
|
58866
|
+
AST10.tsTypeAnnotation(typeDefinitions(config2, body))
|
|
58867
|
+
),
|
|
58868
|
+
AST10.tsPropertySignature(
|
|
58869
|
+
AST10.identifier("lists"),
|
|
58870
|
+
AST10.tsTypeAnnotation(listDefinitions(config2, docs))
|
|
58871
|
+
)
|
|
58872
|
+
])
|
|
58873
|
+
);
|
|
58874
|
+
declaration.declare = true;
|
|
58875
|
+
const importRecord = AST10.importDeclaration(
|
|
58876
|
+
[AST10.importSpecifier(AST10.identifier("Record"))],
|
|
58877
|
+
AST10.stringLiteral("./public/record")
|
|
58878
|
+
);
|
|
58879
|
+
importRecord.importKind = "type";
|
|
58880
|
+
await fs_exports.writeFile(
|
|
58881
|
+
target,
|
|
58882
|
+
recast10.prettyPrint(
|
|
58883
|
+
AST10.program([importRecord, ...body, AST10.exportNamedDeclaration(declaration)])
|
|
58884
|
+
).code
|
|
58885
|
+
);
|
|
58886
|
+
}
|
|
58887
|
+
function typeDefinitions(config2, body) {
|
|
58888
|
+
const operationTypes = [config2.schema.getMutationType(), config2.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
58889
|
+
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58890
|
+
const types14 = Object.values(config2.schema.getTypeMap()).filter(
|
|
58891
|
+
(type) => !graphql16.isAbstractType(type) && !graphql16.isScalarType(type) && !graphql16.isEnumType(type) && !graphql16.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
58892
|
+
);
|
|
58893
|
+
return AST10.tsTypeLiteral(
|
|
58894
|
+
types14.map((type) => {
|
|
58895
|
+
let typeName = type.name;
|
|
58896
|
+
if (config2.schema.getQueryType() && config2.schema.getQueryType()?.name === type.name) {
|
|
58897
|
+
typeName = "__ROOT__";
|
|
58898
|
+
}
|
|
58899
|
+
let idFields = AST10.tsNeverKeyword();
|
|
58900
|
+
const keys = keyFieldsForType(config2.configFile, type.name);
|
|
58901
|
+
if (graphql16.isObjectType(type) && keys.length > 0 && keys.every((key) => type.getFields()[key])) {
|
|
58902
|
+
idFields = AST10.tsTypeLiteral(
|
|
58903
|
+
keys.map((key) => {
|
|
58904
|
+
const fieldType = type.getFields()[key];
|
|
58905
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
58906
|
+
return AST10.tsPropertySignature(
|
|
58907
|
+
AST10.identifier(key),
|
|
58908
|
+
AST10.tsTypeAnnotation(
|
|
58909
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
58910
|
+
)
|
|
58911
|
+
);
|
|
58912
|
+
})
|
|
58913
|
+
);
|
|
58914
|
+
} else if (typeName === "__ROOT__") {
|
|
58915
|
+
idFields = AST10.tsTypeLiteral([]);
|
|
58916
|
+
}
|
|
58917
|
+
let fields = AST10.tsTypeLiteral([]);
|
|
58918
|
+
if (graphql16.isObjectType(type)) {
|
|
58919
|
+
fields = AST10.tsTypeLiteral(
|
|
58920
|
+
Object.entries(type.getFields()).map(
|
|
58921
|
+
([key, fieldType]) => {
|
|
58922
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
58923
|
+
let typeOptions = AST10.tsUnionType([]);
|
|
58924
|
+
if (graphql16.isScalarType(unwrapped.type)) {
|
|
58925
|
+
typeOptions.types.push(
|
|
58926
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
58927
|
+
);
|
|
58928
|
+
} else if (graphql16.isEnumType(unwrapped.type)) {
|
|
58929
|
+
typeOptions.types.push(
|
|
58930
|
+
AST10.tsTypeReference(AST10.identifier(unwrapped.type.name))
|
|
58931
|
+
);
|
|
58932
|
+
} else if (!graphql16.isAbstractType(unwrapped.type)) {
|
|
58933
|
+
typeOptions.types.push(record(unwrapped.type.name));
|
|
58934
|
+
} else {
|
|
58935
|
+
typeOptions.types.push(
|
|
58936
|
+
...config2.schema.getPossibleTypes(unwrapped.type).map((type2) => record(type2.name))
|
|
58937
|
+
);
|
|
58938
|
+
}
|
|
58939
|
+
for (const wrapper of unwrapped.wrappers) {
|
|
58940
|
+
if (wrapper === "Nullable" /* Nullable */) {
|
|
58941
|
+
typeOptions = AST10.tsParenthesizedType(
|
|
58942
|
+
AST10.tsUnionType([typeOptions, AST10.tsNullKeyword()])
|
|
58943
|
+
);
|
|
58944
|
+
} else if (wrapper === "List" /* List */) {
|
|
58945
|
+
typeOptions = AST10.tsArrayType(
|
|
58946
|
+
AST10.tsParenthesizedType(typeOptions)
|
|
58947
|
+
);
|
|
58948
|
+
}
|
|
58949
|
+
}
|
|
58950
|
+
if (typeOptions.type === "TSParenthesizedType") {
|
|
58951
|
+
typeOptions = typeOptions.typeAnnotation;
|
|
58952
|
+
}
|
|
58953
|
+
let args = AST10.tsNeverKeyword();
|
|
58954
|
+
if (fieldType.args?.length > 0) {
|
|
58955
|
+
args = AST10.tsTypeLiteral(
|
|
58956
|
+
fieldType.args.map((arg) => {
|
|
58957
|
+
addReferencedInputTypes(
|
|
58958
|
+
config2,
|
|
58959
|
+
"",
|
|
58960
|
+
body,
|
|
58961
|
+
visitedTypes,
|
|
58962
|
+
/* @__PURE__ */ new Set(),
|
|
58963
|
+
arg.type
|
|
58964
|
+
);
|
|
58965
|
+
const prop = AST10.tsPropertySignature(
|
|
58966
|
+
AST10.identifier(arg.name),
|
|
58967
|
+
AST10.tsTypeAnnotation(
|
|
58968
|
+
tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
|
|
58969
|
+
)
|
|
58970
|
+
);
|
|
58971
|
+
const unwrapped2 = unwrapType(config2, arg.type);
|
|
58972
|
+
prop.optional = unwrapped2.wrappers[unwrapped2.wrappers.length - 1] === "Nullable" /* Nullable */;
|
|
58973
|
+
return prop;
|
|
58974
|
+
})
|
|
58975
|
+
);
|
|
58976
|
+
}
|
|
58977
|
+
return AST10.tsPropertySignature(
|
|
58978
|
+
AST10.identifier(key),
|
|
58979
|
+
AST10.tsTypeAnnotation(
|
|
58980
|
+
AST10.tsTypeLiteral([
|
|
58981
|
+
AST10.tsPropertySignature(
|
|
58982
|
+
AST10.identifier("type"),
|
|
58983
|
+
AST10.tsTypeAnnotation(typeOptions)
|
|
58984
|
+
),
|
|
58985
|
+
AST10.tsPropertySignature(
|
|
58986
|
+
AST10.identifier("args"),
|
|
58987
|
+
AST10.tsTypeAnnotation(args)
|
|
58988
|
+
)
|
|
58989
|
+
])
|
|
58990
|
+
)
|
|
58991
|
+
);
|
|
58992
|
+
}
|
|
58993
|
+
)
|
|
58994
|
+
);
|
|
58995
|
+
}
|
|
58996
|
+
return AST10.tsPropertySignature(
|
|
58997
|
+
AST10.identifier(typeName),
|
|
58998
|
+
AST10.tsTypeAnnotation(
|
|
58999
|
+
AST10.tsTypeLiteral([
|
|
59000
|
+
AST10.tsPropertySignature(
|
|
59001
|
+
AST10.identifier("idFields"),
|
|
59002
|
+
AST10.tsTypeAnnotation(idFields)
|
|
59003
|
+
),
|
|
59004
|
+
AST10.tsPropertySignature(
|
|
59005
|
+
AST10.identifier("fields"),
|
|
59006
|
+
AST10.tsTypeAnnotation(fields)
|
|
59007
|
+
)
|
|
59008
|
+
])
|
|
59009
|
+
)
|
|
59010
|
+
);
|
|
59011
|
+
})
|
|
59012
|
+
);
|
|
59013
|
+
}
|
|
59014
|
+
function listDefinitions(config2, docs) {
|
|
59015
|
+
const lists = [];
|
|
59016
|
+
const visitedLists = /* @__PURE__ */ new Set();
|
|
59017
|
+
for (const doc of docs) {
|
|
59018
|
+
graphql16.visit(doc.document, {
|
|
59019
|
+
Directive(node, key, parent, path2, ancestors) {
|
|
59020
|
+
if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
59021
|
+
return;
|
|
59022
|
+
}
|
|
59023
|
+
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
59024
|
+
const nameValue = nameArg?.value?.value || "";
|
|
59025
|
+
if (!nameValue || visitedLists.has(nameValue)) {
|
|
59026
|
+
return;
|
|
59027
|
+
}
|
|
59028
|
+
visitedLists.add(nameValue);
|
|
59029
|
+
const parentType = parentTypeFromAncestors(
|
|
59030
|
+
config2.schema,
|
|
59031
|
+
doc.filename,
|
|
59032
|
+
ancestors.slice(0, -1)
|
|
59033
|
+
);
|
|
59034
|
+
const targetField = ancestors[ancestors.length - 1];
|
|
59035
|
+
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
59036
|
+
const { type: listType } = unwrapType(config2, targetFieldDefinition.type);
|
|
59037
|
+
const possibleTypes = [];
|
|
59038
|
+
if (graphql16.isAbstractType(listType)) {
|
|
59039
|
+
possibleTypes.push(
|
|
59040
|
+
...config2.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
59041
|
+
);
|
|
59042
|
+
} else {
|
|
59043
|
+
possibleTypes.push(listType.name);
|
|
59044
|
+
}
|
|
59045
|
+
lists.push(
|
|
59046
|
+
AST10.tsPropertySignature(
|
|
59047
|
+
AST10.identifier(nameValue),
|
|
59048
|
+
AST10.tsTypeAnnotation(
|
|
59049
|
+
AST10.tsTypeLiteral([
|
|
59050
|
+
AST10.tsPropertySignature(
|
|
59051
|
+
AST10.identifier("type"),
|
|
59052
|
+
AST10.tsTypeAnnotation(
|
|
59053
|
+
AST10.tsUnionType(
|
|
59054
|
+
possibleTypes.map(
|
|
59055
|
+
(possible) => AST10.tsLiteralType(AST10.stringLiteral(possible))
|
|
59056
|
+
)
|
|
59057
|
+
)
|
|
59058
|
+
)
|
|
59059
|
+
),
|
|
59060
|
+
AST10.tsPropertySignature(
|
|
59061
|
+
AST10.identifier("filters"),
|
|
59062
|
+
AST10.tsTypeAnnotation(
|
|
59063
|
+
targetFieldDefinition.args.length === 0 ? AST10.tsNeverKeyword() : AST10.tsTypeLiteral(
|
|
59064
|
+
targetFieldDefinition.args.map((arg) => {
|
|
59065
|
+
const argDef = AST10.tsPropertySignature(
|
|
59066
|
+
AST10.identifier(arg.name),
|
|
59067
|
+
AST10.tsTypeAnnotation(
|
|
59068
|
+
tsTypeReference(
|
|
59069
|
+
config2,
|
|
59070
|
+
/* @__PURE__ */ new Set(),
|
|
59071
|
+
arg
|
|
59072
|
+
)
|
|
59073
|
+
)
|
|
59074
|
+
);
|
|
59075
|
+
argDef.optional = true;
|
|
59076
|
+
return argDef;
|
|
59077
|
+
})
|
|
59078
|
+
)
|
|
59079
|
+
)
|
|
59080
|
+
)
|
|
59081
|
+
])
|
|
59082
|
+
)
|
|
59083
|
+
)
|
|
59084
|
+
);
|
|
59085
|
+
}
|
|
59086
|
+
});
|
|
59087
|
+
}
|
|
59088
|
+
return AST10.tsTypeLiteral(lists);
|
|
59089
|
+
}
|
|
59090
|
+
var CacheTypeDefName = "CacheTypeDef";
|
|
59091
|
+
function record(name2) {
|
|
59092
|
+
return AST10.tsTypeReference(
|
|
59093
|
+
AST10.identifier("Record"),
|
|
59094
|
+
AST10.tsTypeParameterInstantiation([
|
|
59095
|
+
AST10.tsTypeReference(AST10.identifier(CacheTypeDefName)),
|
|
59096
|
+
AST10.tsLiteralType(AST10.stringLiteral(name2))
|
|
59097
|
+
])
|
|
59098
|
+
);
|
|
58723
59099
|
}
|
|
58724
59100
|
|
|
58725
59101
|
// src/codegen/generators/typescript/inlineType.ts
|
|
58726
|
-
var
|
|
58727
|
-
var
|
|
58728
|
-
var
|
|
59102
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
59103
|
+
var recast11 = __toESM(require_main2(), 1);
|
|
59104
|
+
var AST11 = recast11.types.builders;
|
|
58729
59105
|
var fragmentKey = "$fragments";
|
|
58730
59106
|
function inlineType({
|
|
58731
59107
|
config: config2,
|
|
@@ -58742,9 +59118,9 @@ function inlineType({
|
|
|
58742
59118
|
}) {
|
|
58743
59119
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
58744
59120
|
let result;
|
|
58745
|
-
if (
|
|
59121
|
+
if (graphql17.isScalarType(type)) {
|
|
58746
59122
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58747
|
-
} else if (
|
|
59123
|
+
} else if (graphql17.isEnumType(type)) {
|
|
58748
59124
|
if (!visitedTypes.has(type.name)) {
|
|
58749
59125
|
ensureImports({
|
|
58750
59126
|
config: config2,
|
|
@@ -58754,7 +59130,7 @@ function inlineType({
|
|
|
58754
59130
|
});
|
|
58755
59131
|
visitedTypes.add(type.name);
|
|
58756
59132
|
}
|
|
58757
|
-
result =
|
|
59133
|
+
result = AST11.tsTypeReference(AST11.identifier(type.name));
|
|
58758
59134
|
} else if (selections) {
|
|
58759
59135
|
const rootObj = type;
|
|
58760
59136
|
const inlineFragments = {};
|
|
@@ -58762,11 +59138,11 @@ function inlineType({
|
|
|
58762
59138
|
for (const selection2 of selections) {
|
|
58763
59139
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
58764
59140
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
58765
|
-
if (!
|
|
59141
|
+
if (!graphql17.isInterfaceType(type) && !graphql17.isUnionType(type)) {
|
|
58766
59142
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
58767
59143
|
continue;
|
|
58768
59144
|
}
|
|
58769
|
-
if (!
|
|
59145
|
+
if (!graphql17.isInterfaceType(fragmentType) && !graphql17.isUnionType(fragmentType)) {
|
|
58770
59146
|
if (!inlineFragments[fragmentType.name]) {
|
|
58771
59147
|
inlineFragments[fragmentType.name] = [];
|
|
58772
59148
|
}
|
|
@@ -58805,7 +59181,7 @@ function inlineType({
|
|
|
58805
59181
|
selectedFields.push(selection2);
|
|
58806
59182
|
}
|
|
58807
59183
|
}
|
|
58808
|
-
result =
|
|
59184
|
+
result = AST11.tsTypeLiteral([
|
|
58809
59185
|
...(selectedFields || []).filter(
|
|
58810
59186
|
(field) => field.kind === "Field"
|
|
58811
59187
|
).map((selection2) => {
|
|
@@ -58825,9 +59201,9 @@ function inlineType({
|
|
|
58825
59201
|
allOptional
|
|
58826
59202
|
});
|
|
58827
59203
|
const prop = readonlyProperty(
|
|
58828
|
-
|
|
58829
|
-
|
|
58830
|
-
|
|
59204
|
+
AST11.tsPropertySignature(
|
|
59205
|
+
AST11.identifier(attributeName),
|
|
59206
|
+
AST11.tsTypeAnnotation(attributeType)
|
|
58831
59207
|
),
|
|
58832
59208
|
allowReadonly
|
|
58833
59209
|
);
|
|
@@ -58841,15 +59217,15 @@ function inlineType({
|
|
|
58841
59217
|
if (includeFragments && fragmentSpreads && fragmentSpreads.length) {
|
|
58842
59218
|
result.members.push(
|
|
58843
59219
|
readonlyProperty(
|
|
58844
|
-
|
|
58845
|
-
|
|
58846
|
-
|
|
58847
|
-
|
|
59220
|
+
AST11.tsPropertySignature(
|
|
59221
|
+
AST11.identifier(fragmentKey),
|
|
59222
|
+
AST11.tsTypeAnnotation(
|
|
59223
|
+
AST11.tsTypeLiteral(
|
|
58848
59224
|
(fragmentSpreads || []).map(
|
|
58849
|
-
(fragmentSpread) =>
|
|
58850
|
-
|
|
58851
|
-
|
|
58852
|
-
|
|
59225
|
+
(fragmentSpread) => AST11.tsPropertySignature(
|
|
59226
|
+
AST11.identifier(fragmentSpread.name.value),
|
|
59227
|
+
AST11.tsTypeAnnotation(
|
|
59228
|
+
AST11.tsLiteralType(AST11.booleanLiteral(true))
|
|
58853
59229
|
)
|
|
58854
59230
|
)
|
|
58855
59231
|
)
|
|
@@ -58886,7 +59262,7 @@ function inlineType({
|
|
|
58886
59262
|
}
|
|
58887
59263
|
}
|
|
58888
59264
|
}
|
|
58889
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
59265
|
+
if (objectType.type === "TSTypeLiteral" && !graphql17.isInterfaceType(fragmentRootType) && !graphql17.isUnionType(fragmentRootType)) {
|
|
58890
59266
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
58891
59267
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
58892
59268
|
);
|
|
@@ -58895,9 +59271,9 @@ function inlineType({
|
|
|
58895
59271
|
}
|
|
58896
59272
|
objectType.members.push(
|
|
58897
59273
|
readonlyProperty(
|
|
58898
|
-
|
|
58899
|
-
|
|
58900
|
-
|
|
59274
|
+
AST11.tsPropertySignature(
|
|
59275
|
+
AST11.identifier("__typename"),
|
|
59276
|
+
AST11.tsTypeAnnotation(AST11.tsLiteralType(AST11.stringLiteral(typeName)))
|
|
58901
59277
|
),
|
|
58902
59278
|
allowReadonly
|
|
58903
59279
|
)
|
|
@@ -58908,8 +59284,8 @@ function inlineType({
|
|
|
58908
59284
|
if (Object.keys(inlineFragmentSelections).length > 0) {
|
|
58909
59285
|
let selectionTypes = Object.entries(inlineFragmentSelections).map(
|
|
58910
59286
|
([typeName, { type: type2, tsType }]) => {
|
|
58911
|
-
return
|
|
58912
|
-
|
|
59287
|
+
return AST11.tsParenthesizedType(
|
|
59288
|
+
AST11.tsIntersectionType(
|
|
58913
59289
|
[tsType].flatMap((type3) => {
|
|
58914
59290
|
if (type3.type === "TSUnionType") {
|
|
58915
59291
|
return type3.types.filter(
|
|
@@ -58922,9 +59298,9 @@ function inlineType({
|
|
|
58922
59298
|
);
|
|
58923
59299
|
}
|
|
58924
59300
|
);
|
|
58925
|
-
result =
|
|
59301
|
+
result = AST11.tsIntersectionType([
|
|
58926
59302
|
result,
|
|
58927
|
-
|
|
59303
|
+
AST11.tsParenthesizedType(AST11.tsUnionType(selectionTypes))
|
|
58928
59304
|
]);
|
|
58929
59305
|
}
|
|
58930
59306
|
} else {
|
|
@@ -58936,7 +59312,7 @@ function inlineType({
|
|
|
58936
59312
|
} else if (toWrap === "NonNull" /* NonNull */) {
|
|
58937
59313
|
continue;
|
|
58938
59314
|
} else if (toWrap === "List" /* List */) {
|
|
58939
|
-
result =
|
|
59315
|
+
result = AST11.tsArrayType(AST11.tsParenthesizedType(result));
|
|
58940
59316
|
}
|
|
58941
59317
|
}
|
|
58942
59318
|
return result;
|
|
@@ -58953,7 +59329,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58953
59329
|
},
|
|
58954
59330
|
type: schema.getType("String")
|
|
58955
59331
|
};
|
|
58956
|
-
} else if (
|
|
59332
|
+
} else if (graphql17.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
58957
59333
|
fields = rootType.ofType.getFields();
|
|
58958
59334
|
} else {
|
|
58959
59335
|
fields = rootType.getFields();
|
|
@@ -58965,7 +59341,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58965
59341
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
58966
59342
|
});
|
|
58967
59343
|
}
|
|
58968
|
-
const fieldType =
|
|
59344
|
+
const fieldType = graphql17.getNamedType(field.type);
|
|
58969
59345
|
if (!fieldType) {
|
|
58970
59346
|
throw new HoudiniError({
|
|
58971
59347
|
filepath,
|
|
@@ -58981,7 +59357,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58981
59357
|
}
|
|
58982
59358
|
|
|
58983
59359
|
// src/codegen/generators/typescript/index.ts
|
|
58984
|
-
var
|
|
59360
|
+
var AST12 = recast12.types.builders;
|
|
58985
59361
|
async function typescriptGenerator(config2, docs) {
|
|
58986
59362
|
const typePaths = [];
|
|
58987
59363
|
const fragmentDefinitions = {};
|
|
@@ -58999,7 +59375,7 @@ async function typescriptGenerator(config2, docs) {
|
|
|
58999
59375
|
return;
|
|
59000
59376
|
}
|
|
59001
59377
|
const typeDefPath = config2.artifactTypePath(originalDocument);
|
|
59002
|
-
const program =
|
|
59378
|
+
const program = AST12.program([]);
|
|
59003
59379
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
59004
59380
|
let definition = originalDocument.definitions.find(
|
|
59005
59381
|
(def) => (def.kind === "OperationDefinition" || def.kind === "FragmentDefinition") && def.name?.value === name2
|
|
@@ -59032,21 +59408,21 @@ async function typescriptGenerator(config2, docs) {
|
|
|
59032
59408
|
missingScalars
|
|
59033
59409
|
);
|
|
59034
59410
|
}
|
|
59035
|
-
await fs_exports.writeFile(typeDefPath,
|
|
59411
|
+
await fs_exports.writeFile(typeDefPath, recast12.print(program).code);
|
|
59036
59412
|
typePaths.push(typeDefPath);
|
|
59037
59413
|
})
|
|
59038
59414
|
);
|
|
59039
|
-
const typeIndex =
|
|
59415
|
+
const typeIndex = AST12.program(
|
|
59040
59416
|
typePaths.sort((a, b) => a.localeCompare(b)).map((typePath) => {
|
|
59041
|
-
return
|
|
59042
|
-
|
|
59417
|
+
return AST12.exportAllDeclaration(
|
|
59418
|
+
AST12.literal(
|
|
59043
59419
|
"./" + path_exports.relative(path_exports.resolve(config2.typeIndexPath, ".."), typePath).replace(/\.[^/.]+\.[^/.]+$/, "")
|
|
59044
59420
|
),
|
|
59045
59421
|
null
|
|
59046
59422
|
);
|
|
59047
59423
|
}).concat([
|
|
59048
|
-
|
|
59049
|
-
|
|
59424
|
+
AST12.exportAllDeclaration(AST12.literal("./runtime"), null),
|
|
59425
|
+
AST12.exportAllDeclaration(AST12.literal("./graphql"), null)
|
|
59050
59426
|
])
|
|
59051
59427
|
);
|
|
59052
59428
|
const export_default_as = ({ module: module2, as }) => `
|
|
@@ -59055,7 +59431,7 @@ export { default as ${as} } from "${module2}"
|
|
|
59055
59431
|
const export_star_from = ({ module: module2 }) => `
|
|
59056
59432
|
export * from "${module2}"
|
|
59057
59433
|
`;
|
|
59058
|
-
let indexContent =
|
|
59434
|
+
let indexContent = recast12.print(typeIndex).code;
|
|
59059
59435
|
for (const plugin of config2.plugins) {
|
|
59060
59436
|
if (!plugin.index_file) {
|
|
59061
59437
|
continue;
|
|
@@ -59076,6 +59452,7 @@ export * from "${module2}"
|
|
|
59076
59452
|
}
|
|
59077
59453
|
}
|
|
59078
59454
|
await fs_exports.writeFile(config2.typeIndexPath, indexContent);
|
|
59455
|
+
await imperativeCacheTypef(config2, docs);
|
|
59079
59456
|
if (missingScalars.size > 0) {
|
|
59080
59457
|
console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
|
|
59081
59458
|
", "
|
|
@@ -59117,23 +59494,23 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59117
59494
|
const optimisticTypeName = `${definition.name.value}$optimistic`;
|
|
59118
59495
|
const hasInputs = definition.variableDefinitions && definition.variableDefinitions.length > 0;
|
|
59119
59496
|
body.push(
|
|
59120
|
-
|
|
59121
|
-
|
|
59122
|
-
|
|
59123
|
-
|
|
59497
|
+
AST12.exportNamedDeclaration(
|
|
59498
|
+
AST12.tsTypeAliasDeclaration(
|
|
59499
|
+
AST12.identifier(definition.name.value),
|
|
59500
|
+
AST12.tsTypeLiteral([
|
|
59124
59501
|
readonlyProperty(
|
|
59125
|
-
|
|
59126
|
-
|
|
59127
|
-
|
|
59502
|
+
AST12.tsPropertySignature(
|
|
59503
|
+
AST12.stringLiteral("input"),
|
|
59504
|
+
AST12.tsTypeAnnotation(AST12.tsTypeReference(AST12.identifier(inputTypeName)))
|
|
59128
59505
|
)
|
|
59129
59506
|
),
|
|
59130
59507
|
readonlyProperty(
|
|
59131
|
-
|
|
59132
|
-
|
|
59133
|
-
|
|
59134
|
-
definition.operation === "mutation" ?
|
|
59135
|
-
|
|
59136
|
-
|
|
59508
|
+
AST12.tsPropertySignature(
|
|
59509
|
+
AST12.stringLiteral("result"),
|
|
59510
|
+
AST12.tsTypeAnnotation(
|
|
59511
|
+
definition.operation === "mutation" ? AST12.tsTypeReference(AST12.identifier(shapeTypeName)) : AST12.tsUnionType([
|
|
59512
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName)),
|
|
59513
|
+
AST12.tsUndefinedKeyword()
|
|
59137
59514
|
])
|
|
59138
59515
|
)
|
|
59139
59516
|
)
|
|
@@ -59141,9 +59518,9 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59141
59518
|
])
|
|
59142
59519
|
)
|
|
59143
59520
|
),
|
|
59144
|
-
|
|
59145
|
-
|
|
59146
|
-
|
|
59521
|
+
AST12.exportNamedDeclaration(
|
|
59522
|
+
AST12.tsTypeAliasDeclaration(
|
|
59523
|
+
AST12.identifier(shapeTypeName),
|
|
59147
59524
|
inlineType({
|
|
59148
59525
|
config: config2,
|
|
59149
59526
|
filepath,
|
|
@@ -59171,15 +59548,15 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59171
59548
|
);
|
|
59172
59549
|
}
|
|
59173
59550
|
body.push(
|
|
59174
|
-
|
|
59175
|
-
|
|
59176
|
-
|
|
59177
|
-
|
|
59551
|
+
AST12.exportNamedDeclaration(
|
|
59552
|
+
AST12.tsTypeAliasDeclaration(
|
|
59553
|
+
AST12.identifier(inputTypeName),
|
|
59554
|
+
AST12.tsTypeLiteral(
|
|
59178
59555
|
(definition.variableDefinitions || []).map(
|
|
59179
59556
|
(definition2) => {
|
|
59180
|
-
return
|
|
59181
|
-
|
|
59182
|
-
|
|
59557
|
+
return AST12.tsPropertySignature(
|
|
59558
|
+
AST12.identifier(definition2.variable.name.value),
|
|
59559
|
+
AST12.tsTypeAnnotation(
|
|
59183
59560
|
tsTypeReference(config2, missingScalars, definition2)
|
|
59184
59561
|
),
|
|
59185
59562
|
definition2.type.kind !== "NonNullType"
|
|
@@ -59192,16 +59569,16 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59192
59569
|
);
|
|
59193
59570
|
} else {
|
|
59194
59571
|
body.push(
|
|
59195
|
-
|
|
59196
|
-
|
|
59572
|
+
AST12.exportNamedDeclaration(
|
|
59573
|
+
AST12.tsTypeAliasDeclaration(AST12.identifier(inputTypeName), AST12.tsNullKeyword())
|
|
59197
59574
|
)
|
|
59198
59575
|
);
|
|
59199
59576
|
}
|
|
59200
59577
|
if (definition.operation === "mutation") {
|
|
59201
59578
|
body.push(
|
|
59202
|
-
|
|
59203
|
-
|
|
59204
|
-
|
|
59579
|
+
AST12.exportNamedDeclaration(
|
|
59580
|
+
AST12.tsTypeAliasDeclaration(
|
|
59581
|
+
AST12.identifier(optimisticTypeName),
|
|
59205
59582
|
inlineType({
|
|
59206
59583
|
config: config2,
|
|
59207
59584
|
filepath,
|
|
@@ -59232,28 +59609,28 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59232
59609
|
throw new Error("Should not get here");
|
|
59233
59610
|
}
|
|
59234
59611
|
body.push(
|
|
59235
|
-
|
|
59236
|
-
|
|
59237
|
-
|
|
59238
|
-
|
|
59612
|
+
AST12.exportNamedDeclaration(
|
|
59613
|
+
AST12.tsTypeAliasDeclaration(
|
|
59614
|
+
AST12.identifier(propTypeName),
|
|
59615
|
+
AST12.tsTypeLiteral([
|
|
59239
59616
|
readonlyProperty(
|
|
59240
|
-
|
|
59241
|
-
|
|
59242
|
-
|
|
59243
|
-
|
|
59617
|
+
AST12.tsPropertySignature(
|
|
59618
|
+
AST12.stringLiteral("shape"),
|
|
59619
|
+
AST12.tsTypeAnnotation(
|
|
59620
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName))
|
|
59244
59621
|
),
|
|
59245
59622
|
true
|
|
59246
59623
|
)
|
|
59247
59624
|
),
|
|
59248
59625
|
readonlyProperty(
|
|
59249
|
-
|
|
59250
|
-
|
|
59251
|
-
|
|
59252
|
-
|
|
59253
|
-
|
|
59254
|
-
|
|
59255
|
-
|
|
59256
|
-
|
|
59626
|
+
AST12.tsPropertySignature(
|
|
59627
|
+
AST12.stringLiteral(fragmentKey),
|
|
59628
|
+
AST12.tsTypeAnnotation(
|
|
59629
|
+
AST12.tsTypeLiteral([
|
|
59630
|
+
AST12.tsPropertySignature(
|
|
59631
|
+
AST12.stringLiteral(propTypeName),
|
|
59632
|
+
AST12.tsTypeAnnotation(
|
|
59633
|
+
AST12.tsLiteralType(AST12.booleanLiteral(true))
|
|
59257
59634
|
)
|
|
59258
59635
|
)
|
|
59259
59636
|
])
|
|
@@ -59263,9 +59640,9 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59263
59640
|
])
|
|
59264
59641
|
)
|
|
59265
59642
|
),
|
|
59266
|
-
|
|
59267
|
-
|
|
59268
|
-
|
|
59643
|
+
AST12.exportNamedDeclaration(
|
|
59644
|
+
AST12.tsTypeAliasDeclaration(
|
|
59645
|
+
AST12.identifier(shapeTypeName),
|
|
59269
59646
|
inlineType({
|
|
59270
59647
|
config: config2,
|
|
59271
59648
|
filepath,
|
|
@@ -59285,7 +59662,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59285
59662
|
}
|
|
59286
59663
|
|
|
59287
59664
|
// src/codegen/generators/persistedQueries/index.ts
|
|
59288
|
-
var
|
|
59665
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
59289
59666
|
async function persistOutputGenerator(config2, docs) {
|
|
59290
59667
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
59291
59668
|
return;
|
|
@@ -59297,8 +59674,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59297
59674
|
if (!generateArtifact) {
|
|
59298
59675
|
return acc;
|
|
59299
59676
|
}
|
|
59300
|
-
let rawString =
|
|
59301
|
-
|
|
59677
|
+
let rawString = graphql18.print(
|
|
59678
|
+
graphql18.visit(document, {
|
|
59302
59679
|
Directive(node) {
|
|
59303
59680
|
if (config2.isInternalDirective(node)) {
|
|
59304
59681
|
return null;
|
|
@@ -59307,7 +59684,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59307
59684
|
})
|
|
59308
59685
|
);
|
|
59309
59686
|
const operations = document.definitions.filter(
|
|
59310
|
-
({ kind }) => kind ===
|
|
59687
|
+
({ kind }) => kind === graphql18.Kind.OPERATION_DEFINITION
|
|
59311
59688
|
);
|
|
59312
59689
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
59313
59690
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -59320,26 +59697,26 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59320
59697
|
}
|
|
59321
59698
|
|
|
59322
59699
|
// src/codegen/generators/definitions/enums.ts
|
|
59323
|
-
var
|
|
59324
|
-
var
|
|
59325
|
-
var
|
|
59700
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
59701
|
+
var recast13 = __toESM(require_main2(), 1);
|
|
59702
|
+
var AST13 = recast13.types.builders;
|
|
59326
59703
|
async function definitionsGenerator(config2) {
|
|
59327
|
-
const enums =
|
|
59704
|
+
const enums = graphql19.parse(graphql19.printSchema(config2.schema)).definitions.filter(
|
|
59328
59705
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
59329
59706
|
).filter((def) => !config2.isInternalEnum(def));
|
|
59330
|
-
const runtimeDefinitions =
|
|
59331
|
-
|
|
59707
|
+
const runtimeDefinitions = recast13.print(
|
|
59708
|
+
AST13.program(
|
|
59332
59709
|
enums.map((defn) => {
|
|
59333
59710
|
const name2 = defn.name.value;
|
|
59334
59711
|
return moduleExport(
|
|
59335
59712
|
config2,
|
|
59336
59713
|
name2,
|
|
59337
|
-
|
|
59714
|
+
AST13.objectExpression(
|
|
59338
59715
|
defn.values?.map((value) => {
|
|
59339
59716
|
const str = value.name.value;
|
|
59340
|
-
return
|
|
59341
|
-
|
|
59342
|
-
|
|
59717
|
+
return AST13.objectProperty(
|
|
59718
|
+
AST13.stringLiteral(str),
|
|
59719
|
+
AST13.stringLiteral(str)
|
|
59343
59720
|
);
|
|
59344
59721
|
}) || []
|
|
59345
59722
|
)
|
|
@@ -59347,7 +59724,7 @@ async function definitionsGenerator(config2) {
|
|
|
59347
59724
|
})
|
|
59348
59725
|
)
|
|
59349
59726
|
).code;
|
|
59350
|
-
const
|
|
59727
|
+
const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
|
|
59351
59728
|
(definition) => `
|
|
59352
59729
|
export declare enum ${definition.name.value} {
|
|
59353
59730
|
${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
|
|
@@ -59358,7 +59735,7 @@ ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.val
|
|
|
59358
59735
|
export * from './enums.js'
|
|
59359
59736
|
`;
|
|
59360
59737
|
await Promise.all([
|
|
59361
|
-
fs_exports.writeFile(config2.enumTypesDefinitionsPath,
|
|
59738
|
+
fs_exports.writeFile(config2.enumTypesDefinitionsPath, typeDefinitions2),
|
|
59362
59739
|
fs_exports.writeFile(config2.enumRuntimeDefinitionsPath, runtimeDefinitions),
|
|
59363
59740
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.js"), definitionsIndex),
|
|
59364
59741
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.d.ts"), definitionsIndex)
|
|
@@ -59497,7 +59874,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59497
59874
|
}
|
|
59498
59875
|
|
|
59499
59876
|
// src/codegen/transforms/schema.ts
|
|
59500
|
-
var
|
|
59877
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
59501
59878
|
async function graphqlExtensions(config2, documents) {
|
|
59502
59879
|
const internalSchema = `
|
|
59503
59880
|
enum CachePolicy {
|
|
@@ -59575,19 +59952,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59575
59952
|
"""
|
|
59576
59953
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59577
59954
|
`;
|
|
59578
|
-
let currentSchema =
|
|
59955
|
+
let currentSchema = graphql21.printSchema(config2.schema);
|
|
59579
59956
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59580
59957
|
currentSchema += internalSchema;
|
|
59581
59958
|
}
|
|
59582
59959
|
config2.newSchema += internalSchema;
|
|
59583
|
-
config2.schema =
|
|
59960
|
+
config2.schema = graphql21.buildSchema(currentSchema);
|
|
59584
59961
|
}
|
|
59585
59962
|
|
|
59586
59963
|
// src/codegen/transforms/typename.ts
|
|
59587
|
-
var
|
|
59964
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
59588
59965
|
async function addTypename(config2, documents) {
|
|
59589
59966
|
for (const doc of documents) {
|
|
59590
|
-
doc.document =
|
|
59967
|
+
doc.document = graphql22.visit(doc.document, {
|
|
59591
59968
|
Field(node, key, parent, path2, ancestors) {
|
|
59592
59969
|
if (!node.selectionSet) {
|
|
59593
59970
|
return;
|
|
@@ -59599,7 +59976,7 @@ async function addTypename(config2, documents) {
|
|
|
59599
59976
|
);
|
|
59600
59977
|
const field = type.getFields()[node.name.value];
|
|
59601
59978
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59602
|
-
if (
|
|
59979
|
+
if (graphql22.isInterfaceType(fieldType) || graphql22.isUnionType(fieldType)) {
|
|
59603
59980
|
return {
|
|
59604
59981
|
...node,
|
|
59605
59982
|
selectionSet: {
|
|
@@ -59607,9 +59984,9 @@ async function addTypename(config2, documents) {
|
|
|
59607
59984
|
selections: [
|
|
59608
59985
|
...node.selectionSet.selections,
|
|
59609
59986
|
{
|
|
59610
|
-
kind:
|
|
59987
|
+
kind: graphql22.Kind.FIELD,
|
|
59611
59988
|
name: {
|
|
59612
|
-
kind:
|
|
59989
|
+
kind: graphql22.Kind.NAME,
|
|
59613
59990
|
value: "__typename"
|
|
59614
59991
|
}
|
|
59615
59992
|
}
|
|
@@ -59623,10 +60000,10 @@ async function addTypename(config2, documents) {
|
|
|
59623
60000
|
}
|
|
59624
60001
|
|
|
59625
60002
|
// src/codegen/transforms/addID.ts
|
|
59626
|
-
var
|
|
60003
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
59627
60004
|
async function addID(config2, documents) {
|
|
59628
60005
|
for (const doc of documents) {
|
|
59629
|
-
doc.document =
|
|
60006
|
+
doc.document = graphql23.visit(doc.document, {
|
|
59630
60007
|
Field(node, key, parent, path2, ancestors) {
|
|
59631
60008
|
if (!node.selectionSet) {
|
|
59632
60009
|
return;
|
|
@@ -59639,7 +60016,7 @@ async function addID(config2, documents) {
|
|
|
59639
60016
|
const field = type.getFields()[node.name.value];
|
|
59640
60017
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59641
60018
|
if (node.selectionSet?.selections.length > 0) {
|
|
59642
|
-
if (!
|
|
60019
|
+
if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
|
|
59643
60020
|
return;
|
|
59644
60021
|
}
|
|
59645
60022
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -59654,9 +60031,9 @@ async function addID(config2, documents) {
|
|
|
59654
60031
|
continue;
|
|
59655
60032
|
}
|
|
59656
60033
|
selections.push({
|
|
59657
|
-
kind:
|
|
60034
|
+
kind: graphql23.Kind.FIELD,
|
|
59658
60035
|
name: {
|
|
59659
|
-
kind:
|
|
60036
|
+
kind: graphql23.Kind.NAME,
|
|
59660
60037
|
value: keyField
|
|
59661
60038
|
}
|
|
59662
60039
|
});
|
|
@@ -59675,8 +60052,8 @@ async function addID(config2, documents) {
|
|
|
59675
60052
|
}
|
|
59676
60053
|
|
|
59677
60054
|
// src/codegen/transforms/fragmentVariables.ts
|
|
59678
|
-
var
|
|
59679
|
-
var GraphqlKinds2 =
|
|
60055
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
60056
|
+
var GraphqlKinds2 = graphql24.Kind;
|
|
59680
60057
|
async function fragmentVariables(config2, documents) {
|
|
59681
60058
|
const fragments = collectFragments(config2, documents);
|
|
59682
60059
|
const generatedFragments = {};
|
|
@@ -59699,7 +60076,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
59699
60076
|
});
|
|
59700
60077
|
}
|
|
59701
60078
|
const doc = {
|
|
59702
|
-
kind:
|
|
60079
|
+
kind: graphql24.Kind.DOCUMENT,
|
|
59703
60080
|
definitions: Object.values(generatedFragments)
|
|
59704
60081
|
};
|
|
59705
60082
|
documents.push({
|
|
@@ -59735,7 +60112,7 @@ function inlineFragmentArgs({
|
|
|
59735
60112
|
filepath,
|
|
59736
60113
|
document
|
|
59737
60114
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
59738
|
-
const result =
|
|
60115
|
+
const result = graphql24.visit(document, {
|
|
59739
60116
|
FragmentSpread(node) {
|
|
59740
60117
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
59741
60118
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -59823,7 +60200,7 @@ function inlineFragmentArgs({
|
|
|
59823
60200
|
});
|
|
59824
60201
|
if (newName) {
|
|
59825
60202
|
result.name = {
|
|
59826
|
-
kind:
|
|
60203
|
+
kind: graphql24.Kind.NAME,
|
|
59827
60204
|
value: newName
|
|
59828
60205
|
};
|
|
59829
60206
|
}
|
|
@@ -59935,7 +60312,7 @@ function operationScope(operation) {
|
|
|
59935
60312
|
}
|
|
59936
60313
|
|
|
59937
60314
|
// src/codegen/validators/typeCheck.ts
|
|
59938
|
-
var
|
|
60315
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
59939
60316
|
async function typeCheck(config2, docs) {
|
|
59940
60317
|
const errors = [];
|
|
59941
60318
|
const freeLists = [];
|
|
@@ -59943,11 +60320,11 @@ async function typeCheck(config2, docs) {
|
|
|
59943
60320
|
const listTypes = [];
|
|
59944
60321
|
const fragments = {};
|
|
59945
60322
|
for (const { document: parsed, filename } of docs) {
|
|
59946
|
-
|
|
59947
|
-
[
|
|
60323
|
+
graphql25.visit(parsed, {
|
|
60324
|
+
[graphql25.Kind.FRAGMENT_DEFINITION](definition) {
|
|
59948
60325
|
fragments[definition.name.value] = definition;
|
|
59949
60326
|
},
|
|
59950
|
-
[
|
|
60327
|
+
[graphql25.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
59951
60328
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
59952
60329
|
return;
|
|
59953
60330
|
}
|
|
@@ -59993,14 +60370,14 @@ async function typeCheck(config2, docs) {
|
|
|
59993
60370
|
);
|
|
59994
60371
|
return;
|
|
59995
60372
|
}
|
|
59996
|
-
if (
|
|
60373
|
+
if (graphql25.isListType(rootType) || graphql25.isNonNullType(rootType) && graphql25.isListType(rootType.ofType)) {
|
|
59997
60374
|
needsParent = true;
|
|
59998
60375
|
break;
|
|
59999
60376
|
}
|
|
60000
|
-
if (
|
|
60377
|
+
if (graphql25.isNonNullType(rootType) && "ofType" in rootType) {
|
|
60001
60378
|
rootType = rootType.ofType;
|
|
60002
60379
|
}
|
|
60003
|
-
if (
|
|
60380
|
+
if (graphql25.isScalarType(rootType)) {
|
|
60004
60381
|
break;
|
|
60005
60382
|
}
|
|
60006
60383
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -60056,7 +60433,7 @@ async function typeCheck(config2, docs) {
|
|
|
60056
60433
|
);
|
|
60057
60434
|
const targetField = ancestors[ancestors.length - 1];
|
|
60058
60435
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
60059
|
-
const { type, error } = connectionSelection(
|
|
60436
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
60060
60437
|
config2,
|
|
60061
60438
|
targetFieldDefinition,
|
|
60062
60439
|
parentTypeFromAncestors(
|
|
@@ -60066,10 +60443,19 @@ async function typeCheck(config2, docs) {
|
|
|
60066
60443
|
),
|
|
60067
60444
|
targetField.selectionSet
|
|
60068
60445
|
);
|
|
60446
|
+
if (errorConnectionSelection && directive.name.value === config2.paginateDirective) {
|
|
60447
|
+
errors.push(
|
|
60448
|
+
new HoudiniError({
|
|
60449
|
+
filepath: filename,
|
|
60450
|
+
message: errorConnectionSelection,
|
|
60451
|
+
description: errorConnectionSelection
|
|
60452
|
+
})
|
|
60453
|
+
);
|
|
60454
|
+
}
|
|
60069
60455
|
let targetTypes = [type];
|
|
60070
|
-
if (
|
|
60456
|
+
if (graphql25.isUnionType(type)) {
|
|
60071
60457
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
60072
|
-
} else if (
|
|
60458
|
+
} else if (graphql25.isInterfaceType(type)) {
|
|
60073
60459
|
try {
|
|
60074
60460
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
60075
60461
|
if (!type.getFields()[key]) {
|
|
@@ -60083,23 +60469,16 @@ async function typeCheck(config2, docs) {
|
|
|
60083
60469
|
for (const targetType of targetTypes) {
|
|
60084
60470
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
60085
60471
|
if (missingIDFields.length > 0) {
|
|
60086
|
-
|
|
60087
|
-
|
|
60088
|
-
|
|
60089
|
-
|
|
60090
|
-
|
|
60091
|
-
|
|
60092
|
-
|
|
60093
|
-
|
|
60094
|
-
|
|
60095
|
-
|
|
60096
|
-
filepath: filename,
|
|
60097
|
-
message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
60098
|
-
", "
|
|
60099
|
-
)}.`
|
|
60100
|
-
})
|
|
60101
|
-
);
|
|
60102
|
-
}
|
|
60472
|
+
const message = `@${config2.listDirective} on ${logGreen(
|
|
60473
|
+
targetType.name
|
|
60474
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
60475
|
+
errors.push(
|
|
60476
|
+
new HoudiniError({
|
|
60477
|
+
filepath: filename,
|
|
60478
|
+
message,
|
|
60479
|
+
description: message
|
|
60480
|
+
})
|
|
60481
|
+
);
|
|
60103
60482
|
return;
|
|
60104
60483
|
}
|
|
60105
60484
|
}
|
|
@@ -60114,13 +60493,13 @@ async function typeCheck(config2, docs) {
|
|
|
60114
60493
|
if (errors.length > 0) {
|
|
60115
60494
|
throw errors;
|
|
60116
60495
|
}
|
|
60117
|
-
const rules = (filepath) => [...
|
|
60496
|
+
const rules = (filepath) => [...graphql25.specifiedRules].filter(
|
|
60118
60497
|
(rule) => ![
|
|
60119
|
-
|
|
60120
|
-
|
|
60121
|
-
|
|
60122
|
-
|
|
60123
|
-
|
|
60498
|
+
graphql25.NoUnusedFragmentsRule,
|
|
60499
|
+
graphql25.KnownFragmentNamesRule,
|
|
60500
|
+
graphql25.ExecutableDefinitionsRule,
|
|
60501
|
+
graphql25.KnownDirectivesRule,
|
|
60502
|
+
graphql25.KnownArgumentNamesRule
|
|
60124
60503
|
].includes(rule)
|
|
60125
60504
|
).concat(
|
|
60126
60505
|
validateLists({
|
|
@@ -60139,7 +60518,7 @@ async function typeCheck(config2, docs) {
|
|
|
60139
60518
|
noUnusedFragmentArguments(config2)
|
|
60140
60519
|
);
|
|
60141
60520
|
for (const { filename, document: parsed } of docs) {
|
|
60142
|
-
for (const error of
|
|
60521
|
+
for (const error of graphql25.validate(config2.schema, parsed, rules(filename))) {
|
|
60143
60522
|
errors.push(
|
|
60144
60523
|
new HoudiniError({
|
|
60145
60524
|
filepath: filename,
|
|
@@ -60165,7 +60544,7 @@ var validateLists = ({
|
|
|
60165
60544
|
if (!config2.isListFragment(node.name.value)) {
|
|
60166
60545
|
if (!fragments[node.name.value]) {
|
|
60167
60546
|
ctx.reportError(
|
|
60168
|
-
new
|
|
60547
|
+
new graphql25.GraphQLError(
|
|
60169
60548
|
"Encountered unknown fragment: " + node.name.value
|
|
60170
60549
|
)
|
|
60171
60550
|
);
|
|
@@ -60175,7 +60554,7 @@ var validateLists = ({
|
|
|
60175
60554
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
60176
60555
|
if (!lists.includes(listName)) {
|
|
60177
60556
|
ctx.reportError(
|
|
60178
|
-
new
|
|
60557
|
+
new graphql25.GraphQLError(
|
|
60179
60558
|
"Encountered fragment referencing unknown list: " + listName
|
|
60180
60559
|
)
|
|
60181
60560
|
);
|
|
@@ -60200,7 +60579,7 @@ var validateLists = ({
|
|
|
60200
60579
|
);
|
|
60201
60580
|
if (parentArg) {
|
|
60202
60581
|
ctx.reportError(
|
|
60203
|
-
new
|
|
60582
|
+
new graphql25.GraphQLError(
|
|
60204
60583
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
60205
60584
|
)
|
|
60206
60585
|
);
|
|
@@ -60216,7 +60595,7 @@ var validateLists = ({
|
|
|
60216
60595
|
return;
|
|
60217
60596
|
}
|
|
60218
60597
|
ctx.reportError(
|
|
60219
|
-
new
|
|
60598
|
+
new graphql25.GraphQLError(
|
|
60220
60599
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
60221
60600
|
)
|
|
60222
60601
|
);
|
|
@@ -60226,7 +60605,7 @@ var validateLists = ({
|
|
|
60226
60605
|
const directiveName = node.name.value;
|
|
60227
60606
|
if (directiveName === "connection") {
|
|
60228
60607
|
ctx.reportError(
|
|
60229
|
-
new
|
|
60608
|
+
new graphql25.GraphQLError(
|
|
60230
60609
|
"@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."
|
|
60231
60610
|
)
|
|
60232
60611
|
);
|
|
@@ -60235,7 +60614,7 @@ var validateLists = ({
|
|
|
60235
60614
|
if (!config2.isInternalDirective(node)) {
|
|
60236
60615
|
if (!config2.schema.getDirective(directiveName)) {
|
|
60237
60616
|
ctx.reportError(
|
|
60238
|
-
new
|
|
60617
|
+
new graphql25.GraphQLError(
|
|
60239
60618
|
"Encountered unknown directive: " + directiveName
|
|
60240
60619
|
)
|
|
60241
60620
|
);
|
|
@@ -60244,7 +60623,7 @@ var validateLists = ({
|
|
|
60244
60623
|
}
|
|
60245
60624
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
60246
60625
|
ctx.reportError(
|
|
60247
|
-
new
|
|
60626
|
+
new graphql25.GraphQLError(
|
|
60248
60627
|
"Encountered directive referencing unknown list: " + directiveName
|
|
60249
60628
|
)
|
|
60250
60629
|
);
|
|
@@ -60255,7 +60634,7 @@ var validateLists = ({
|
|
|
60255
60634
|
};
|
|
60256
60635
|
function knownArguments(config2) {
|
|
60257
60636
|
return function(ctx) {
|
|
60258
|
-
const nativeValidator =
|
|
60637
|
+
const nativeValidator = graphql25.KnownArgumentNamesRule(ctx);
|
|
60259
60638
|
return {
|
|
60260
60639
|
...nativeValidator,
|
|
60261
60640
|
Directive(directiveNode) {
|
|
@@ -60288,7 +60667,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60288
60667
|
for (const arg of node.arguments || []) {
|
|
60289
60668
|
if (arg.value.kind !== "ObjectValue") {
|
|
60290
60669
|
ctx.reportError(
|
|
60291
|
-
new
|
|
60670
|
+
new graphql25.GraphQLError("values in @arguments must be an object")
|
|
60292
60671
|
);
|
|
60293
60672
|
return;
|
|
60294
60673
|
}
|
|
@@ -60298,13 +60677,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60298
60677
|
);
|
|
60299
60678
|
if (!typeArg) {
|
|
60300
60679
|
ctx.reportError(
|
|
60301
|
-
new
|
|
60680
|
+
new graphql25.GraphQLError("missing type field for @arguments directive")
|
|
60302
60681
|
);
|
|
60303
60682
|
return;
|
|
60304
60683
|
}
|
|
60305
|
-
if (typeArg.value.kind !==
|
|
60684
|
+
if (typeArg.value.kind !== graphql25.Kind.STRING) {
|
|
60306
60685
|
ctx.reportError(
|
|
60307
|
-
new
|
|
60686
|
+
new graphql25.GraphQLError("type field to @arguments must be a string")
|
|
60308
60687
|
);
|
|
60309
60688
|
return;
|
|
60310
60689
|
}
|
|
@@ -60317,7 +60696,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60317
60696
|
);
|
|
60318
60697
|
if (typeArg.value.value !== defaultValueType) {
|
|
60319
60698
|
ctx.reportError(
|
|
60320
|
-
new
|
|
60699
|
+
new graphql25.GraphQLError(
|
|
60321
60700
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60322
60701
|
)
|
|
60323
60702
|
);
|
|
@@ -60335,7 +60714,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60335
60714
|
try {
|
|
60336
60715
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60337
60716
|
} catch (e) {
|
|
60338
|
-
ctx.reportError(new
|
|
60717
|
+
ctx.reportError(new graphql25.GraphQLError(e.message));
|
|
60339
60718
|
return;
|
|
60340
60719
|
}
|
|
60341
60720
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60358,7 +60737,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60358
60737
|
);
|
|
60359
60738
|
if (missing.length > 0) {
|
|
60360
60739
|
ctx.reportError(
|
|
60361
|
-
new
|
|
60740
|
+
new graphql25.GraphQLError(
|
|
60362
60741
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60363
60742
|
)
|
|
60364
60743
|
);
|
|
@@ -60369,7 +60748,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60369
60748
|
);
|
|
60370
60749
|
if (unknown.length > 0) {
|
|
60371
60750
|
ctx.reportError(
|
|
60372
|
-
new
|
|
60751
|
+
new graphql25.GraphQLError(
|
|
60373
60752
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60374
60753
|
)
|
|
60375
60754
|
);
|
|
@@ -60381,7 +60760,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60381
60760
|
]
|
|
60382
60761
|
);
|
|
60383
60762
|
for (const [applied, target] of zipped) {
|
|
60384
|
-
if (applied.value.kind ===
|
|
60763
|
+
if (applied.value.kind === graphql25.Kind.VARIABLE || applied.value.kind === graphql25.Kind.LIST || applied.value.kind === graphql25.Kind.OBJECT) {
|
|
60385
60764
|
continue;
|
|
60386
60765
|
}
|
|
60387
60766
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60390,7 +60769,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60390
60769
|
);
|
|
60391
60770
|
if (appliedType !== target) {
|
|
60392
60771
|
ctx.reportError(
|
|
60393
|
-
new
|
|
60772
|
+
new graphql25.GraphQLError(
|
|
60394
60773
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60395
60774
|
)
|
|
60396
60775
|
);
|
|
@@ -60411,7 +60790,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60411
60790
|
}
|
|
60412
60791
|
if (alreadyPaginated) {
|
|
60413
60792
|
ctx.reportError(
|
|
60414
|
-
new
|
|
60793
|
+
new graphql25.GraphQLError(
|
|
60415
60794
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60416
60795
|
)
|
|
60417
60796
|
);
|
|
@@ -60426,7 +60805,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60426
60805
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60427
60806
|
if (hasRequiredArgs) {
|
|
60428
60807
|
ctx.reportError(
|
|
60429
|
-
new
|
|
60808
|
+
new graphql25.GraphQLError(
|
|
60430
60809
|
"@paginate cannot appear on a document with required args"
|
|
60431
60810
|
)
|
|
60432
60811
|
);
|
|
@@ -60458,14 +60837,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60458
60837
|
const backwards = appliedArgs.has("last");
|
|
60459
60838
|
if (!forward && !backwards) {
|
|
60460
60839
|
ctx.reportError(
|
|
60461
|
-
new
|
|
60840
|
+
new graphql25.GraphQLError(
|
|
60462
60841
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60463
60842
|
)
|
|
60464
60843
|
);
|
|
60465
60844
|
}
|
|
60466
60845
|
if (forward && backwards) {
|
|
60467
60846
|
ctx.reportError(
|
|
60468
|
-
new
|
|
60847
|
+
new graphql25.GraphQLError(
|
|
60469
60848
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60470
60849
|
)
|
|
60471
60850
|
);
|
|
@@ -60479,7 +60858,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60479
60858
|
);
|
|
60480
60859
|
if (!appliedLimitArg) {
|
|
60481
60860
|
ctx.reportError(
|
|
60482
|
-
new
|
|
60861
|
+
new graphql25.GraphQLError(
|
|
60483
60862
|
"A field with offset-based pagination must have a limit argument"
|
|
60484
60863
|
)
|
|
60485
60864
|
);
|
|
@@ -60495,20 +60874,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60495
60874
|
const args = /* @__PURE__ */ new Set();
|
|
60496
60875
|
return {
|
|
60497
60876
|
enter(node) {
|
|
60498
|
-
if (node.kind ===
|
|
60877
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
60499
60878
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60500
60879
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60501
60880
|
args.add(arg);
|
|
60502
60881
|
}
|
|
60503
|
-
} else if (node.kind ===
|
|
60882
|
+
} else if (node.kind === graphql25.Kind.VARIABLE) {
|
|
60504
60883
|
args.delete(node.name.value);
|
|
60505
60884
|
}
|
|
60506
60885
|
},
|
|
60507
60886
|
leave(node) {
|
|
60508
|
-
if (node.kind ===
|
|
60887
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
60509
60888
|
if (args.size > 0) {
|
|
60510
60889
|
ctx.reportError(
|
|
60511
|
-
new
|
|
60890
|
+
new graphql25.GraphQLError(
|
|
60512
60891
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60513
60892
|
)
|
|
60514
60893
|
);
|
|
@@ -60544,7 +60923,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60544
60923
|
if (definition.kind === "OperationDefinition") {
|
|
60545
60924
|
if (definition.operation !== "query") {
|
|
60546
60925
|
ctx.reportError(
|
|
60547
|
-
new
|
|
60926
|
+
new graphql25.GraphQLError(
|
|
60548
60927
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60549
60928
|
)
|
|
60550
60929
|
);
|
|
@@ -60556,7 +60935,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60556
60935
|
}
|
|
60557
60936
|
if (!possibleNodes.includes(definitionType)) {
|
|
60558
60937
|
ctx.reportError(
|
|
60559
|
-
new
|
|
60938
|
+
new graphql25.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60560
60939
|
);
|
|
60561
60940
|
}
|
|
60562
60941
|
}
|
|
@@ -60575,7 +60954,7 @@ function checkMutationOperation(config2) {
|
|
|
60575
60954
|
);
|
|
60576
60955
|
if (append && prepend) {
|
|
60577
60956
|
ctx.reportError(
|
|
60578
|
-
new
|
|
60957
|
+
new graphql25.GraphQLError(
|
|
60579
60958
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60580
60959
|
)
|
|
60581
60960
|
);
|
|
@@ -60589,7 +60968,7 @@ function checkMutationOperation(config2) {
|
|
|
60589
60968
|
);
|
|
60590
60969
|
if (parentId && allLists) {
|
|
60591
60970
|
ctx.reportError(
|
|
60592
|
-
new
|
|
60971
|
+
new graphql25.GraphQLError(
|
|
60593
60972
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60594
60973
|
)
|
|
60595
60974
|
);
|
|
@@ -60611,7 +60990,7 @@ function checkMaskDirective(config2) {
|
|
|
60611
60990
|
);
|
|
60612
60991
|
if (maskEnableDirective && maskDisableDirective) {
|
|
60613
60992
|
ctx.reportError(
|
|
60614
|
-
new
|
|
60993
|
+
new graphql25.GraphQLError(
|
|
60615
60994
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
60616
60995
|
)
|
|
60617
60996
|
);
|
|
@@ -60627,7 +61006,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
60627
61006
|
if (!nodeInterface) {
|
|
60628
61007
|
return null;
|
|
60629
61008
|
}
|
|
60630
|
-
if (!
|
|
61009
|
+
if (!graphql25.isInterfaceType(nodeInterface)) {
|
|
60631
61010
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
60632
61011
|
return null;
|
|
60633
61012
|
}
|
|
@@ -60725,11 +61104,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
60725
61104
|
}
|
|
60726
61105
|
|
|
60727
61106
|
// src/codegen/validators/noIDAlias.ts
|
|
60728
|
-
var
|
|
61107
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
60729
61108
|
async function noIDAlias(config2, docs) {
|
|
60730
61109
|
const errors = [];
|
|
60731
61110
|
for (const { filename, document } of docs) {
|
|
60732
|
-
|
|
61111
|
+
graphql26.visit(document, {
|
|
60733
61112
|
Field(node, _, __, ___, ancestors) {
|
|
60734
61113
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
60735
61114
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -60897,11 +61276,12 @@ function testConfigFile(config2 = {}) {
|
|
|
60897
61276
|
return {
|
|
60898
61277
|
schema: `
|
|
60899
61278
|
scalar Cursor
|
|
60900
|
-
|
|
61279
|
+
scalar DateTime
|
|
60901
61280
|
|
|
60902
61281
|
type User implements Node & Friend & CatOwner {
|
|
60903
61282
|
id: ID!
|
|
60904
61283
|
name: String!
|
|
61284
|
+
birthday: DateTime!
|
|
60905
61285
|
firstName: String!
|
|
60906
61286
|
friends: [User!]!
|
|
60907
61287
|
friendsByCursor(first: Int, after: String, last: Int, before: String, filter: String): UserConnection!
|
|
@@ -60953,6 +61333,7 @@ function testConfigFile(config2 = {}) {
|
|
|
60953
61333
|
ghostsByCursor(first: Int, after: String, last: Int, before: String): IsGhostConnection!
|
|
60954
61334
|
entitiesByCursor(first: Int, after: String, last: Int, before: String): EntityConnection!
|
|
60955
61335
|
node(id: ID!): Node
|
|
61336
|
+
customIdList: [CustomIdType]!
|
|
60956
61337
|
}
|
|
60957
61338
|
|
|
60958
61339
|
type PageInfo {
|
|
@@ -61086,11 +61467,20 @@ function testConfigFile(config2 = {}) {
|
|
|
61086
61467
|
Value3
|
|
61087
61468
|
Value2
|
|
61088
61469
|
}
|
|
61470
|
+
|
|
61471
|
+
type CustomIdType {
|
|
61472
|
+
foo: String!
|
|
61473
|
+
bar: String!
|
|
61474
|
+
dummy: String
|
|
61475
|
+
}
|
|
61089
61476
|
`,
|
|
61090
61477
|
scalars: {
|
|
61091
61478
|
DateTime: {
|
|
61092
61479
|
type: "Date",
|
|
61093
61480
|
unmarshal(val) {
|
|
61481
|
+
if (typeof val !== "number") {
|
|
61482
|
+
throw new Error("unmarshaling not a number");
|
|
61483
|
+
}
|
|
61094
61484
|
return new Date(val);
|
|
61095
61485
|
},
|
|
61096
61486
|
marshal(date) {
|
|
@@ -61105,6 +61495,9 @@ function testConfigFile(config2 = {}) {
|
|
|
61105
61495
|
resolve: {
|
|
61106
61496
|
queryField: "ghost"
|
|
61107
61497
|
}
|
|
61498
|
+
},
|
|
61499
|
+
CustomIdType: {
|
|
61500
|
+
keys: ["foo", "bar"]
|
|
61108
61501
|
}
|
|
61109
61502
|
},
|
|
61110
61503
|
logLevel: "quiet",
|
|
@@ -61113,6 +61506,7 @@ function testConfigFile(config2 = {}) {
|
|
|
61113
61506
|
client: "./my/client/path"
|
|
61114
61507
|
}
|
|
61115
61508
|
},
|
|
61509
|
+
acceptImperativeInstability: true,
|
|
61116
61510
|
...config2
|
|
61117
61511
|
};
|
|
61118
61512
|
}
|
|
@@ -61144,7 +61538,7 @@ function pipelineTest(config2, documents, shouldPass, testBody) {
|
|
|
61144
61538
|
};
|
|
61145
61539
|
}
|
|
61146
61540
|
function mockCollectedDoc(query) {
|
|
61147
|
-
const parsed =
|
|
61541
|
+
const parsed = graphql27.parse(query);
|
|
61148
61542
|
const name2 = parsed.definitions[0].name.value;
|
|
61149
61543
|
const operations = parsed.definitions;
|
|
61150
61544
|
let kind = "HoudiniFragment" /* Fragment */;
|