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
|
@@ -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, print9) {
|
|
50745
50745
|
var value = path2.getValue();
|
|
50746
50746
|
var innerLines = print9(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, print9));
|
|
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(print9, "object"));
|
|
51875
51875
|
var property = path2.call(print9, "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(print9, "typeArguments"));
|
|
52146
52146
|
}
|
|
52147
|
-
if (
|
|
52147
|
+
if (types14.getFieldValue(n, "optional")) {
|
|
52148
52148
|
parts.push("?.");
|
|
52149
52149
|
}
|
|
52150
52150
|
parts.push(printArgumentsList(path2, options, print9));
|
|
@@ -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 = print9;
|
|
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
|
}
|
|
@@ -53923,7 +53923,7 @@ __export(codegen_exports, {
|
|
|
53923
53923
|
runPipeline: () => runPipeline2
|
|
53924
53924
|
});
|
|
53925
53925
|
module.exports = __toCommonJS(codegen_exports);
|
|
53926
|
-
var
|
|
53926
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
53927
53927
|
|
|
53928
53928
|
// src/lib/pipeline.ts
|
|
53929
53929
|
async function runPipeline(config2, pipeline, target) {
|
|
@@ -54403,8 +54403,8 @@ var List = class {
|
|
|
54403
54403
|
} else {
|
|
54404
54404
|
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
54405
54405
|
}
|
|
54406
|
-
for (let
|
|
54407
|
-
yield
|
|
54406
|
+
for (let record2 of entries) {
|
|
54407
|
+
yield record2;
|
|
54408
54408
|
}
|
|
54409
54409
|
}
|
|
54410
54410
|
};
|
|
@@ -54453,6 +54453,46 @@ var ListCollection = class {
|
|
|
54453
54453
|
}
|
|
54454
54454
|
};
|
|
54455
54455
|
|
|
54456
|
+
// src/runtime/cache/schema.ts
|
|
54457
|
+
var SchemaManager = class {
|
|
54458
|
+
cache;
|
|
54459
|
+
fieldTypes = {};
|
|
54460
|
+
constructor(cache) {
|
|
54461
|
+
this.cache = cache;
|
|
54462
|
+
}
|
|
54463
|
+
setFieldType({
|
|
54464
|
+
parent,
|
|
54465
|
+
key,
|
|
54466
|
+
type,
|
|
54467
|
+
nullable = false,
|
|
54468
|
+
link
|
|
54469
|
+
}) {
|
|
54470
|
+
let parensIndex = key.indexOf("(");
|
|
54471
|
+
if (parensIndex !== -1) {
|
|
54472
|
+
key = key.substring(0, parensIndex);
|
|
54473
|
+
}
|
|
54474
|
+
if (parent === rootID) {
|
|
54475
|
+
parent = "Query";
|
|
54476
|
+
} else if (parent.includes(":")) {
|
|
54477
|
+
parent = parent.substring(0, parent.indexOf(":"));
|
|
54478
|
+
}
|
|
54479
|
+
if (!this.fieldTypes[parent]) {
|
|
54480
|
+
this.fieldTypes[parent] = {};
|
|
54481
|
+
}
|
|
54482
|
+
this.fieldTypes[parent][key] = {
|
|
54483
|
+
type,
|
|
54484
|
+
nullable,
|
|
54485
|
+
link: !!link
|
|
54486
|
+
};
|
|
54487
|
+
}
|
|
54488
|
+
fieldType(type, field) {
|
|
54489
|
+
return this.fieldTypes[type]?.[field] || null;
|
|
54490
|
+
}
|
|
54491
|
+
get config() {
|
|
54492
|
+
return this.cache._internal_unstable.config;
|
|
54493
|
+
}
|
|
54494
|
+
};
|
|
54495
|
+
|
|
54456
54496
|
// src/runtime/cache/storage.ts
|
|
54457
54497
|
var InMemoryStorage = class {
|
|
54458
54498
|
data;
|
|
@@ -55020,7 +55060,7 @@ var InMemorySubscriptions = class {
|
|
|
55020
55060
|
};
|
|
55021
55061
|
|
|
55022
55062
|
// src/runtime/cache/cache.ts
|
|
55023
|
-
var
|
|
55063
|
+
var Cache3 = class {
|
|
55024
55064
|
_internal_unstable;
|
|
55025
55065
|
constructor(config2) {
|
|
55026
55066
|
this._internal_unstable = new CacheInternal({
|
|
@@ -55028,7 +55068,8 @@ var Cache2 = class {
|
|
|
55028
55068
|
storage: new InMemoryStorage(),
|
|
55029
55069
|
subscriptions: new InMemorySubscriptions(this),
|
|
55030
55070
|
lists: new ListManager(this, rootID),
|
|
55031
|
-
lifetimes: new GarbageCollector(this)
|
|
55071
|
+
lifetimes: new GarbageCollector(this),
|
|
55072
|
+
schema: new SchemaManager(this)
|
|
55032
55073
|
});
|
|
55033
55074
|
if (config2) {
|
|
55034
55075
|
this.setConfig(defaultConfigValues(config2));
|
|
@@ -55114,18 +55155,21 @@ var CacheInternal = class {
|
|
|
55114
55155
|
lists;
|
|
55115
55156
|
cache;
|
|
55116
55157
|
lifetimes;
|
|
55158
|
+
schema;
|
|
55117
55159
|
constructor({
|
|
55118
55160
|
storage,
|
|
55119
55161
|
subscriptions,
|
|
55120
55162
|
lists,
|
|
55121
55163
|
cache,
|
|
55122
|
-
lifetimes
|
|
55164
|
+
lifetimes,
|
|
55165
|
+
schema
|
|
55123
55166
|
}) {
|
|
55124
55167
|
this.storage = storage;
|
|
55125
55168
|
this.subscriptions = subscriptions;
|
|
55126
55169
|
this.lists = lists;
|
|
55127
55170
|
this.cache = cache;
|
|
55128
55171
|
this.lifetimes = lifetimes;
|
|
55172
|
+
this.schema = schema;
|
|
55129
55173
|
this._disabled = typeof globalThis.window === "undefined";
|
|
55130
55174
|
try {
|
|
55131
55175
|
if (process.env.HOUDINI_TEST === "true") {
|
|
@@ -55141,7 +55185,6 @@ var CacheInternal = class {
|
|
|
55141
55185
|
data,
|
|
55142
55186
|
selection: selection2,
|
|
55143
55187
|
variables = {},
|
|
55144
|
-
root = rootID,
|
|
55145
55188
|
parent = rootID,
|
|
55146
55189
|
applyUpdates = false,
|
|
55147
55190
|
layer,
|
|
@@ -55164,9 +55207,17 @@ var CacheInternal = class {
|
|
|
55164
55207
|
selection: fieldSelection,
|
|
55165
55208
|
operations,
|
|
55166
55209
|
abstract: isAbstract,
|
|
55167
|
-
update
|
|
55210
|
+
update,
|
|
55211
|
+
nullable
|
|
55168
55212
|
} = targetSelection[field];
|
|
55169
55213
|
const key = evaluateKey(keyRaw, variables);
|
|
55214
|
+
this.schema.setFieldType({
|
|
55215
|
+
parent,
|
|
55216
|
+
key: keyRaw,
|
|
55217
|
+
type: linkedType,
|
|
55218
|
+
nullable,
|
|
55219
|
+
link: !!fieldSelection
|
|
55220
|
+
});
|
|
55170
55221
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
55171
55222
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
55172
55223
|
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
@@ -55235,7 +55286,6 @@ var CacheInternal = class {
|
|
|
55235
55286
|
}
|
|
55236
55287
|
if (linkedID) {
|
|
55237
55288
|
this.writeSelection({
|
|
55238
|
-
root,
|
|
55239
55289
|
selection: fieldSelection,
|
|
55240
55290
|
parent: linkedID,
|
|
55241
55291
|
data: value,
|
|
@@ -55626,7 +55676,7 @@ var CacheInternal = class {
|
|
|
55626
55676
|
var rootID = "_ROOT_";
|
|
55627
55677
|
|
|
55628
55678
|
// src/runtime/cache/index.ts
|
|
55629
|
-
var cache_default = new
|
|
55679
|
+
var cache_default = new Cache3();
|
|
55630
55680
|
|
|
55631
55681
|
// src/runtime/lib/types.ts
|
|
55632
55682
|
var CompiledFragmentKind = "HoudiniFragment" /* Fragment */;
|
|
@@ -55818,6 +55868,7 @@ async function writeFile(filepath, data) {
|
|
|
55818
55868
|
return;
|
|
55819
55869
|
}
|
|
55820
55870
|
if (houdini_mode.is_testing) {
|
|
55871
|
+
import_memfs.fs.mkdirpSync(dirname(filepath));
|
|
55821
55872
|
return import_memfs.fs.writeFileSync(filepath, data);
|
|
55822
55873
|
}
|
|
55823
55874
|
return await import_promises.default.writeFile(filepath, data, "utf8");
|
|
@@ -56206,53 +56257,75 @@ var graphql2 = __toESM(require_graphql2(), 1);
|
|
|
56206
56257
|
async function find_graphql(config2, parsedScript, walker) {
|
|
56207
56258
|
await asyncWalk(parsedScript, {
|
|
56208
56259
|
async enter(node, parent) {
|
|
56209
|
-
if (node.type
|
|
56260
|
+
if (node.type !== "TaggedTemplateExpression" && node.type !== "CallExpression") {
|
|
56261
|
+
return;
|
|
56262
|
+
}
|
|
56263
|
+
let documentString;
|
|
56264
|
+
if (node.type === "TaggedTemplateExpression") {
|
|
56210
56265
|
const expr = node;
|
|
56211
|
-
|
|
56212
|
-
const parsedTag = graphql2.parse(tagContent);
|
|
56213
|
-
if (walker.where && !walker.where(parsedTag)) {
|
|
56266
|
+
if (expr.tag.type !== "Identifier" || expr.tag.name !== "graphql") {
|
|
56214
56267
|
return;
|
|
56215
56268
|
}
|
|
56216
|
-
|
|
56217
|
-
|
|
56218
|
-
|
|
56219
|
-
|
|
56269
|
+
documentString = expr.quasi.quasis[0].value.raw;
|
|
56270
|
+
} else if (node.type === "CallExpression") {
|
|
56271
|
+
const expr = node;
|
|
56272
|
+
if (expr.callee.type !== "Identifier" || expr.callee.name !== "graphql" || expr.arguments.length !== 1) {
|
|
56273
|
+
return;
|
|
56220
56274
|
}
|
|
56221
|
-
|
|
56222
|
-
if (
|
|
56223
|
-
|
|
56275
|
+
const argument = expr.arguments[0];
|
|
56276
|
+
if (argument.type === "TemplateLiteral") {
|
|
56277
|
+
documentString = argument.quasis[0].value.raw;
|
|
56278
|
+
} else if (argument.type === "StringLiteral") {
|
|
56279
|
+
documentString = argument.value;
|
|
56224
56280
|
} else {
|
|
56225
|
-
|
|
56226
|
-
kind = CompiledQueryKind;
|
|
56227
|
-
} else if (definition.operation === "mutation") {
|
|
56228
|
-
kind = CompiledMutationKind;
|
|
56229
|
-
} else {
|
|
56230
|
-
kind = CompiledSubscriptionKind;
|
|
56231
|
-
}
|
|
56281
|
+
return;
|
|
56232
56282
|
}
|
|
56233
|
-
|
|
56234
|
-
|
|
56235
|
-
parsedDocument: parsedTag,
|
|
56236
|
-
node: {
|
|
56237
|
-
...node,
|
|
56238
|
-
...this,
|
|
56239
|
-
remove: this.remove,
|
|
56240
|
-
replaceWith: this.replace
|
|
56241
|
-
},
|
|
56242
|
-
artifact: {
|
|
56243
|
-
name: name2,
|
|
56244
|
-
kind
|
|
56245
|
-
},
|
|
56246
|
-
parent,
|
|
56247
|
-
tagContent
|
|
56248
|
-
});
|
|
56283
|
+
} else {
|
|
56284
|
+
return;
|
|
56249
56285
|
}
|
|
56286
|
+
const parsedTag = graphql2.parse(documentString);
|
|
56287
|
+
if (walker.where && !walker.where(parsedTag)) {
|
|
56288
|
+
return;
|
|
56289
|
+
}
|
|
56290
|
+
const definition = config2.extractDefinition(parsedTag);
|
|
56291
|
+
const name2 = definition.name?.value;
|
|
56292
|
+
if (!name2) {
|
|
56293
|
+
throw new Error("Could not find definition name");
|
|
56294
|
+
}
|
|
56295
|
+
let kind;
|
|
56296
|
+
if (definition.kind === "FragmentDefinition") {
|
|
56297
|
+
kind = CompiledFragmentKind;
|
|
56298
|
+
} else {
|
|
56299
|
+
if (definition.operation === "query") {
|
|
56300
|
+
kind = CompiledQueryKind;
|
|
56301
|
+
} else if (definition.operation === "mutation") {
|
|
56302
|
+
kind = CompiledMutationKind;
|
|
56303
|
+
} else {
|
|
56304
|
+
kind = CompiledSubscriptionKind;
|
|
56305
|
+
}
|
|
56306
|
+
}
|
|
56307
|
+
walker.dependency?.(config2.artifactPath(parsedTag));
|
|
56308
|
+
await walker.tag({
|
|
56309
|
+
parsedDocument: parsedTag,
|
|
56310
|
+
node: {
|
|
56311
|
+
...node,
|
|
56312
|
+
...this,
|
|
56313
|
+
remove: this.remove,
|
|
56314
|
+
replaceWith: this.replace
|
|
56315
|
+
},
|
|
56316
|
+
artifact: {
|
|
56317
|
+
name: name2,
|
|
56318
|
+
kind
|
|
56319
|
+
},
|
|
56320
|
+
parent,
|
|
56321
|
+
tagContent: documentString
|
|
56322
|
+
});
|
|
56250
56323
|
}
|
|
56251
56324
|
});
|
|
56252
56325
|
}
|
|
56253
56326
|
|
|
56254
56327
|
// src/codegen/generators/artifacts/index.ts
|
|
56255
|
-
var
|
|
56328
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
56256
56329
|
var recast5 = __toESM(require_main2(), 1);
|
|
56257
56330
|
|
|
56258
56331
|
// src/codegen/utils/commonjs.ts
|
|
@@ -56669,7 +56742,7 @@ function deepMerge(filepath, ...targets) {
|
|
|
56669
56742
|
Object.entries(fields).map(([key, value]) => [key, deepMerge(filepath, ...value)])
|
|
56670
56743
|
);
|
|
56671
56744
|
}
|
|
56672
|
-
function convertValue(val) {
|
|
56745
|
+
function convertValue(config2, val) {
|
|
56673
56746
|
let value;
|
|
56674
56747
|
let kind;
|
|
56675
56748
|
if (val.kind === graphql5.Kind.INT) {
|
|
@@ -56801,7 +56874,7 @@ function operationObject({
|
|
|
56801
56874
|
operationWhen[i ? "must_not" : "must"] = arg.value.fields.reduce(
|
|
56802
56875
|
(obj, arg2) => ({
|
|
56803
56876
|
...obj,
|
|
56804
|
-
[arg2.name.value]: convertValue(arg2.value).value
|
|
56877
|
+
[arg2.name.value]: convertValue(config2, arg2.value).value
|
|
56805
56878
|
}),
|
|
56806
56879
|
{}
|
|
56807
56880
|
);
|
|
@@ -56817,7 +56890,7 @@ function operationObject({
|
|
|
56817
56890
|
operationWhen[which] = directive.arguments?.reduce(
|
|
56818
56891
|
(filters, argument) => ({
|
|
56819
56892
|
...filters,
|
|
56820
|
-
[argument.name.value]: convertValue(argument.value).value
|
|
56893
|
+
[argument.name.value]: convertValue(config2, argument.value).value
|
|
56821
56894
|
}),
|
|
56822
56895
|
{}
|
|
56823
56896
|
);
|
|
@@ -56856,7 +56929,7 @@ function ancestorKey(ancestors) {
|
|
|
56856
56929
|
}
|
|
56857
56930
|
|
|
56858
56931
|
// src/codegen/generators/artifacts/selection.ts
|
|
56859
|
-
var
|
|
56932
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
56860
56933
|
|
|
56861
56934
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
56862
56935
|
var config = {
|
|
@@ -56896,10 +56969,24 @@ function logYellow(str) {
|
|
|
56896
56969
|
}
|
|
56897
56970
|
|
|
56898
56971
|
// src/codegen/transforms/list.ts
|
|
56899
|
-
var
|
|
56972
|
+
var graphql9 = __toESM(require_graphql2(), 1);
|
|
56900
56973
|
|
|
56901
|
-
// src/codegen/
|
|
56974
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
56902
56975
|
var graphql7 = __toESM(require_graphql2(), 1);
|
|
56976
|
+
var objectIdentificationSelection = (config2, type) => {
|
|
56977
|
+
return config2.keyFieldsForType(type.name).map((key) => {
|
|
56978
|
+
return {
|
|
56979
|
+
kind: graphql7.Kind.FIELD,
|
|
56980
|
+
name: {
|
|
56981
|
+
kind: graphql7.Kind.NAME,
|
|
56982
|
+
value: key
|
|
56983
|
+
}
|
|
56984
|
+
};
|
|
56985
|
+
});
|
|
56986
|
+
};
|
|
56987
|
+
|
|
56988
|
+
// src/codegen/transforms/paginate.ts
|
|
56989
|
+
var graphql8 = __toESM(require_graphql2(), 1);
|
|
56903
56990
|
async function paginate(config2, documents) {
|
|
56904
56991
|
const newDocs = [];
|
|
56905
56992
|
for (const doc of documents) {
|
|
@@ -56932,7 +57019,7 @@ async function paginate(config2, documents) {
|
|
|
56932
57019
|
};
|
|
56933
57020
|
let cursorType = "String";
|
|
56934
57021
|
let paginationPath = [];
|
|
56935
|
-
doc.document =
|
|
57022
|
+
doc.document = graphql8.visit(doc.document, {
|
|
56936
57023
|
Field(node, _, __, ___, ancestors) {
|
|
56937
57024
|
const paginateDirective = node.directives?.find(
|
|
56938
57025
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -56959,7 +57046,7 @@ async function paginate(config2, documents) {
|
|
|
56959
57046
|
flags.offset.enabled = offsetPagination;
|
|
56960
57047
|
flags.limit.enabled = offsetPagination;
|
|
56961
57048
|
paginationPath = ancestors.filter(
|
|
56962
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
57049
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql8.Kind.FIELD
|
|
56963
57050
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
56964
57051
|
return {
|
|
56965
57052
|
...node,
|
|
@@ -56980,7 +57067,7 @@ async function paginate(config2, documents) {
|
|
|
56980
57067
|
refetchUpdate = "prepend" /* prepend */;
|
|
56981
57068
|
}
|
|
56982
57069
|
let fragment = "";
|
|
56983
|
-
doc.document =
|
|
57070
|
+
doc.document = graphql8.visit(doc.document, {
|
|
56984
57071
|
OperationDefinition(node) {
|
|
56985
57072
|
if (node.operation !== "query") {
|
|
56986
57073
|
throw new HoudiniError({
|
|
@@ -57034,9 +57121,9 @@ async function paginate(config2, documents) {
|
|
|
57034
57121
|
directives: [
|
|
57035
57122
|
...node.directives || [],
|
|
57036
57123
|
{
|
|
57037
|
-
kind:
|
|
57124
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57038
57125
|
name: {
|
|
57039
|
-
kind:
|
|
57126
|
+
kind: graphql8.Kind.NAME,
|
|
57040
57127
|
value: config2.argumentsDirective
|
|
57041
57128
|
}
|
|
57042
57129
|
}
|
|
@@ -57099,16 +57186,16 @@ async function paginate(config2, documents) {
|
|
|
57099
57186
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
57100
57187
|
const fragmentSpreadSelection = [
|
|
57101
57188
|
{
|
|
57102
|
-
kind:
|
|
57189
|
+
kind: graphql8.Kind.FRAGMENT_SPREAD,
|
|
57103
57190
|
name: {
|
|
57104
|
-
kind:
|
|
57191
|
+
kind: graphql8.Kind.NAME,
|
|
57105
57192
|
value: fragmentName
|
|
57106
57193
|
},
|
|
57107
57194
|
directives: [
|
|
57108
57195
|
{
|
|
57109
|
-
kind:
|
|
57196
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57110
57197
|
name: {
|
|
57111
|
-
kind:
|
|
57198
|
+
kind: graphql8.Kind.NAME,
|
|
57112
57199
|
value: config2.withDirective
|
|
57113
57200
|
},
|
|
57114
57201
|
["arguments"]: paginationArgs.map(
|
|
@@ -57136,29 +57223,29 @@ async function paginate(config2, documents) {
|
|
|
57136
57223
|
});
|
|
57137
57224
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
57138
57225
|
const queryDoc = {
|
|
57139
|
-
kind:
|
|
57226
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
57140
57227
|
definitions: [
|
|
57141
57228
|
{
|
|
57142
|
-
kind:
|
|
57229
|
+
kind: graphql8.Kind.OPERATION_DEFINITION,
|
|
57143
57230
|
name: {
|
|
57144
|
-
kind:
|
|
57231
|
+
kind: graphql8.Kind.NAME,
|
|
57145
57232
|
value: refetchQueryName
|
|
57146
57233
|
},
|
|
57147
57234
|
operation: "query",
|
|
57148
57235
|
variableDefinitions: paginationArgs.map(
|
|
57149
57236
|
(arg) => ({
|
|
57150
|
-
kind:
|
|
57237
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57151
57238
|
type: {
|
|
57152
|
-
kind:
|
|
57239
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57153
57240
|
name: {
|
|
57154
|
-
kind:
|
|
57241
|
+
kind: graphql8.Kind.NAME,
|
|
57155
57242
|
value: arg.type
|
|
57156
57243
|
}
|
|
57157
57244
|
},
|
|
57158
57245
|
variable: {
|
|
57159
|
-
kind:
|
|
57246
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57160
57247
|
name: {
|
|
57161
|
-
kind:
|
|
57248
|
+
kind: graphql8.Kind.NAME,
|
|
57162
57249
|
value: arg.name
|
|
57163
57250
|
}
|
|
57164
57251
|
},
|
|
@@ -57170,12 +57257,12 @@ async function paginate(config2, documents) {
|
|
|
57170
57257
|
).concat(
|
|
57171
57258
|
!nodeQuery ? [] : keys.map(
|
|
57172
57259
|
(key) => ({
|
|
57173
|
-
kind:
|
|
57260
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57174
57261
|
type: key.type,
|
|
57175
57262
|
variable: {
|
|
57176
|
-
kind:
|
|
57263
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57177
57264
|
name: {
|
|
57178
|
-
kind:
|
|
57265
|
+
kind: graphql8.Kind.NAME,
|
|
57179
57266
|
value: key.name
|
|
57180
57267
|
}
|
|
57181
57268
|
}
|
|
@@ -57183,42 +57270,42 @@ async function paginate(config2, documents) {
|
|
|
57183
57270
|
)
|
|
57184
57271
|
),
|
|
57185
57272
|
selectionSet: {
|
|
57186
|
-
kind:
|
|
57273
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57187
57274
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
57188
57275
|
{
|
|
57189
|
-
kind:
|
|
57276
|
+
kind: graphql8.Kind.FIELD,
|
|
57190
57277
|
name: {
|
|
57191
|
-
kind:
|
|
57278
|
+
kind: graphql8.Kind.NAME,
|
|
57192
57279
|
value: typeConfig?.resolve?.queryField || "node"
|
|
57193
57280
|
},
|
|
57194
57281
|
["arguments"]: keys.map((key) => ({
|
|
57195
|
-
kind:
|
|
57282
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57196
57283
|
name: {
|
|
57197
|
-
kind:
|
|
57284
|
+
kind: graphql8.Kind.NAME,
|
|
57198
57285
|
value: key.name
|
|
57199
57286
|
},
|
|
57200
57287
|
value: {
|
|
57201
|
-
kind:
|
|
57288
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57202
57289
|
name: {
|
|
57203
|
-
kind:
|
|
57290
|
+
kind: graphql8.Kind.NAME,
|
|
57204
57291
|
value: key.name
|
|
57205
57292
|
}
|
|
57206
57293
|
}
|
|
57207
57294
|
})),
|
|
57208
57295
|
selectionSet: {
|
|
57209
|
-
kind:
|
|
57296
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57210
57297
|
selections: [
|
|
57211
57298
|
{
|
|
57212
|
-
kind:
|
|
57299
|
+
kind: graphql8.Kind.FIELD,
|
|
57213
57300
|
name: {
|
|
57214
|
-
kind:
|
|
57301
|
+
kind: graphql8.Kind.NAME,
|
|
57215
57302
|
value: "__typename"
|
|
57216
57303
|
}
|
|
57217
57304
|
},
|
|
57218
57305
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
57219
|
-
kind:
|
|
57306
|
+
kind: graphql8.Kind.FIELD,
|
|
57220
57307
|
name: {
|
|
57221
|
-
kind:
|
|
57308
|
+
kind: graphql8.Kind.NAME,
|
|
57222
57309
|
value: key
|
|
57223
57310
|
}
|
|
57224
57311
|
})),
|
|
@@ -57280,15 +57367,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
57280
57367
|
}
|
|
57281
57368
|
function variableAsArgument(name2, variable) {
|
|
57282
57369
|
return {
|
|
57283
|
-
kind:
|
|
57370
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57284
57371
|
name: {
|
|
57285
|
-
kind:
|
|
57372
|
+
kind: graphql8.Kind.NAME,
|
|
57286
57373
|
value: name2
|
|
57287
57374
|
},
|
|
57288
57375
|
value: {
|
|
57289
|
-
kind:
|
|
57376
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57290
57377
|
name: {
|
|
57291
|
-
kind:
|
|
57378
|
+
kind: graphql8.Kind.NAME,
|
|
57292
57379
|
value: variable ?? name2
|
|
57293
57380
|
}
|
|
57294
57381
|
}
|
|
@@ -57296,18 +57383,18 @@ function variableAsArgument(name2, variable) {
|
|
|
57296
57383
|
}
|
|
57297
57384
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
57298
57385
|
return {
|
|
57299
|
-
kind:
|
|
57386
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57300
57387
|
type: {
|
|
57301
|
-
kind:
|
|
57388
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57302
57389
|
name: {
|
|
57303
|
-
kind:
|
|
57390
|
+
kind: graphql8.Kind.NAME,
|
|
57304
57391
|
value: type
|
|
57305
57392
|
}
|
|
57306
57393
|
},
|
|
57307
57394
|
variable: {
|
|
57308
|
-
kind:
|
|
57395
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57309
57396
|
name: {
|
|
57310
|
-
kind:
|
|
57397
|
+
kind: graphql8.Kind.NAME,
|
|
57311
57398
|
value: variableName ?? name2
|
|
57312
57399
|
}
|
|
57313
57400
|
},
|
|
@@ -57319,9 +57406,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
57319
57406
|
}
|
|
57320
57407
|
function argumentNode(name2, value) {
|
|
57321
57408
|
return {
|
|
57322
|
-
kind:
|
|
57409
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57323
57410
|
name: {
|
|
57324
|
-
kind:
|
|
57411
|
+
kind: graphql8.Kind.NAME,
|
|
57325
57412
|
value: name2
|
|
57326
57413
|
},
|
|
57327
57414
|
value: objectNode(value)
|
|
@@ -57329,16 +57416,16 @@ function argumentNode(name2, value) {
|
|
|
57329
57416
|
}
|
|
57330
57417
|
function objectNode([type, defaultValue]) {
|
|
57331
57418
|
const node = {
|
|
57332
|
-
kind:
|
|
57419
|
+
kind: graphql8.Kind.OBJECT,
|
|
57333
57420
|
fields: [
|
|
57334
57421
|
{
|
|
57335
|
-
kind:
|
|
57422
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57336
57423
|
name: {
|
|
57337
|
-
kind:
|
|
57424
|
+
kind: graphql8.Kind.NAME,
|
|
57338
57425
|
value: "type"
|
|
57339
57426
|
},
|
|
57340
57427
|
value: {
|
|
57341
|
-
kind:
|
|
57428
|
+
kind: graphql8.Kind.STRING,
|
|
57342
57429
|
value: type
|
|
57343
57430
|
}
|
|
57344
57431
|
}
|
|
@@ -57346,8 +57433,8 @@ function objectNode([type, defaultValue]) {
|
|
|
57346
57433
|
};
|
|
57347
57434
|
if (defaultValue) {
|
|
57348
57435
|
node.fields.push({
|
|
57349
|
-
kind:
|
|
57350
|
-
name: { kind:
|
|
57436
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57437
|
+
name: { kind: graphql8.Kind.NAME, value: "default" },
|
|
57351
57438
|
value: {
|
|
57352
57439
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
57353
57440
|
value: defaultValue.toString()
|
|
@@ -57358,34 +57445,34 @@ function objectNode([type, defaultValue]) {
|
|
|
57358
57445
|
}
|
|
57359
57446
|
var pageInfoSelection = [
|
|
57360
57447
|
{
|
|
57361
|
-
kind:
|
|
57448
|
+
kind: graphql8.Kind.FIELD,
|
|
57362
57449
|
name: {
|
|
57363
|
-
kind:
|
|
57450
|
+
kind: graphql8.Kind.NAME,
|
|
57364
57451
|
value: "edges"
|
|
57365
57452
|
},
|
|
57366
57453
|
selectionSet: {
|
|
57367
|
-
kind:
|
|
57454
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57368
57455
|
selections: [
|
|
57369
57456
|
{
|
|
57370
|
-
kind:
|
|
57457
|
+
kind: graphql8.Kind.FIELD,
|
|
57371
57458
|
name: {
|
|
57372
|
-
kind:
|
|
57459
|
+
kind: graphql8.Kind.NAME,
|
|
57373
57460
|
value: "cursor"
|
|
57374
57461
|
}
|
|
57375
57462
|
},
|
|
57376
57463
|
{
|
|
57377
|
-
kind:
|
|
57464
|
+
kind: graphql8.Kind.FIELD,
|
|
57378
57465
|
name: {
|
|
57379
|
-
kind:
|
|
57466
|
+
kind: graphql8.Kind.NAME,
|
|
57380
57467
|
value: "node"
|
|
57381
57468
|
},
|
|
57382
57469
|
selectionSet: {
|
|
57383
|
-
kind:
|
|
57470
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57384
57471
|
selections: [
|
|
57385
57472
|
{
|
|
57386
|
-
kind:
|
|
57473
|
+
kind: graphql8.Kind.FIELD,
|
|
57387
57474
|
name: {
|
|
57388
|
-
kind:
|
|
57475
|
+
kind: graphql8.Kind.NAME,
|
|
57389
57476
|
value: "__typename"
|
|
57390
57477
|
}
|
|
57391
57478
|
}
|
|
@@ -57396,39 +57483,39 @@ var pageInfoSelection = [
|
|
|
57396
57483
|
}
|
|
57397
57484
|
},
|
|
57398
57485
|
{
|
|
57399
|
-
kind:
|
|
57486
|
+
kind: graphql8.Kind.FIELD,
|
|
57400
57487
|
name: {
|
|
57401
|
-
kind:
|
|
57488
|
+
kind: graphql8.Kind.NAME,
|
|
57402
57489
|
value: "pageInfo"
|
|
57403
57490
|
},
|
|
57404
57491
|
selectionSet: {
|
|
57405
|
-
kind:
|
|
57492
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57406
57493
|
selections: [
|
|
57407
57494
|
{
|
|
57408
|
-
kind:
|
|
57495
|
+
kind: graphql8.Kind.FIELD,
|
|
57409
57496
|
name: {
|
|
57410
|
-
kind:
|
|
57497
|
+
kind: graphql8.Kind.NAME,
|
|
57411
57498
|
value: "hasPreviousPage"
|
|
57412
57499
|
}
|
|
57413
57500
|
},
|
|
57414
57501
|
{
|
|
57415
|
-
kind:
|
|
57502
|
+
kind: graphql8.Kind.FIELD,
|
|
57416
57503
|
name: {
|
|
57417
|
-
kind:
|
|
57504
|
+
kind: graphql8.Kind.NAME,
|
|
57418
57505
|
value: "hasNextPage"
|
|
57419
57506
|
}
|
|
57420
57507
|
},
|
|
57421
57508
|
{
|
|
57422
|
-
kind:
|
|
57509
|
+
kind: graphql8.Kind.FIELD,
|
|
57423
57510
|
name: {
|
|
57424
|
-
kind:
|
|
57511
|
+
kind: graphql8.Kind.NAME,
|
|
57425
57512
|
value: "startCursor"
|
|
57426
57513
|
}
|
|
57427
57514
|
},
|
|
57428
57515
|
{
|
|
57429
|
-
kind:
|
|
57516
|
+
kind: graphql8.Kind.FIELD,
|
|
57430
57517
|
name: {
|
|
57431
|
-
kind:
|
|
57518
|
+
kind: graphql8.Kind.NAME,
|
|
57432
57519
|
value: "endCursor"
|
|
57433
57520
|
}
|
|
57434
57521
|
}
|
|
@@ -57442,15 +57529,15 @@ async function addListFragments(config2, documents) {
|
|
|
57442
57529
|
const lists = {};
|
|
57443
57530
|
const errors = [];
|
|
57444
57531
|
for (const doc of documents) {
|
|
57445
|
-
doc.document =
|
|
57532
|
+
doc.document = graphql9.visit(doc.document, {
|
|
57446
57533
|
Directive(node, key, parent, path2, ancestors) {
|
|
57447
57534
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
57448
57535
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
57449
57536
|
let error = {
|
|
57450
|
-
...new
|
|
57537
|
+
...new graphql9.GraphQLError(
|
|
57451
57538
|
"",
|
|
57452
57539
|
node,
|
|
57453
|
-
new
|
|
57540
|
+
new graphql9.Source(""),
|
|
57454
57541
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
57455
57542
|
path2
|
|
57456
57543
|
),
|
|
@@ -57502,7 +57589,7 @@ async function addListFragments(config2, documents) {
|
|
|
57502
57589
|
{
|
|
57503
57590
|
kind: "Argument",
|
|
57504
57591
|
name: {
|
|
57505
|
-
kind:
|
|
57592
|
+
kind: graphql9.Kind.NAME,
|
|
57506
57593
|
value: "connection"
|
|
57507
57594
|
},
|
|
57508
57595
|
value: {
|
|
@@ -57549,10 +57636,13 @@ async function addListFragments(config2, documents) {
|
|
|
57549
57636
|
if (errors.length > 0) {
|
|
57550
57637
|
throw errors;
|
|
57551
57638
|
}
|
|
57552
|
-
const
|
|
57639
|
+
const validDeletes = [
|
|
57553
57640
|
...new Set(
|
|
57554
57641
|
Object.values(lists).map(({ type }) => {
|
|
57555
|
-
if (!(type instanceof
|
|
57642
|
+
if (!(type instanceof graphql9.GraphQLObjectType)) {
|
|
57643
|
+
return "";
|
|
57644
|
+
}
|
|
57645
|
+
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
57556
57646
|
return "";
|
|
57557
57647
|
}
|
|
57558
57648
|
return type.name;
|
|
@@ -57563,7 +57653,7 @@ async function addListFragments(config2, documents) {
|
|
|
57563
57653
|
return;
|
|
57564
57654
|
}
|
|
57565
57655
|
const generatedDoc = {
|
|
57566
|
-
kind:
|
|
57656
|
+
kind: graphql9.Kind.DOCUMENT,
|
|
57567
57657
|
definitions: Object.entries(lists).flatMap(
|
|
57568
57658
|
([name2, { selection: selection2, type }]) => {
|
|
57569
57659
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -57571,35 +57661,29 @@ async function addListFragments(config2, documents) {
|
|
|
57571
57661
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
57572
57662
|
}
|
|
57573
57663
|
const fragmentSelection = {
|
|
57574
|
-
kind:
|
|
57664
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57575
57665
|
selections: [...selection2.selections]
|
|
57576
57666
|
};
|
|
57577
57667
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
57578
|
-
(field) => field.kind === "Field" && field.name.value
|
|
57668
|
+
(field) => field.kind === "Field" && config2.keyFieldsForType(type.name).includes(field.name.value)
|
|
57579
57669
|
)) {
|
|
57580
57670
|
fragmentSelection.selections = [
|
|
57581
57671
|
...fragmentSelection.selections,
|
|
57582
|
-
|
|
57583
|
-
kind: graphql8.Kind.FIELD,
|
|
57584
|
-
name: {
|
|
57585
|
-
kind: graphql8.Kind.NAME,
|
|
57586
|
-
value: "id"
|
|
57587
|
-
}
|
|
57588
|
-
}
|
|
57672
|
+
...objectIdentificationSelection(config2, type)
|
|
57589
57673
|
];
|
|
57590
57674
|
}
|
|
57591
57675
|
return [
|
|
57592
57676
|
{
|
|
57593
57677
|
name: {
|
|
57594
57678
|
value: config2.listInsertFragment(name2),
|
|
57595
|
-
kind:
|
|
57679
|
+
kind: graphql9.Kind.NAME
|
|
57596
57680
|
},
|
|
57597
|
-
kind:
|
|
57681
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57598
57682
|
selectionSet: fragmentSelection,
|
|
57599
57683
|
typeCondition: {
|
|
57600
|
-
kind:
|
|
57684
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57601
57685
|
name: {
|
|
57602
|
-
kind:
|
|
57686
|
+
kind: graphql9.Kind.NAME,
|
|
57603
57687
|
value: type.name
|
|
57604
57688
|
}
|
|
57605
57689
|
}
|
|
@@ -57607,52 +57691,32 @@ async function addListFragments(config2, documents) {
|
|
|
57607
57691
|
{
|
|
57608
57692
|
name: {
|
|
57609
57693
|
value: config2.listToggleFragment(name2),
|
|
57610
|
-
kind:
|
|
57611
|
-
},
|
|
57612
|
-
kind: graphql8.Kind.FRAGMENT_DEFINITION,
|
|
57613
|
-
selectionSet: {
|
|
57614
|
-
...fragmentSelection,
|
|
57615
|
-
selections: [
|
|
57616
|
-
...fragmentSelection.selections,
|
|
57617
|
-
{
|
|
57618
|
-
kind: graphql8.Kind.FIELD,
|
|
57619
|
-
name: {
|
|
57620
|
-
kind: graphql8.Kind.NAME,
|
|
57621
|
-
value: "id"
|
|
57622
|
-
}
|
|
57623
|
-
}
|
|
57624
|
-
]
|
|
57694
|
+
kind: graphql9.Kind.NAME
|
|
57625
57695
|
},
|
|
57696
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57697
|
+
selectionSet: fragmentSelection,
|
|
57626
57698
|
typeCondition: {
|
|
57627
|
-
kind:
|
|
57699
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57628
57700
|
name: {
|
|
57629
|
-
kind:
|
|
57701
|
+
kind: graphql9.Kind.NAME,
|
|
57630
57702
|
value: type.name
|
|
57631
57703
|
}
|
|
57632
57704
|
}
|
|
57633
57705
|
},
|
|
57634
57706
|
{
|
|
57635
|
-
kind:
|
|
57707
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57636
57708
|
name: {
|
|
57637
57709
|
value: config2.listRemoveFragment(name2),
|
|
57638
|
-
kind:
|
|
57710
|
+
kind: graphql9.Kind.NAME
|
|
57639
57711
|
},
|
|
57640
57712
|
selectionSet: {
|
|
57641
|
-
kind:
|
|
57642
|
-
selections: [
|
|
57643
|
-
{
|
|
57644
|
-
kind: graphql8.Kind.FIELD,
|
|
57645
|
-
name: {
|
|
57646
|
-
kind: graphql8.Kind.NAME,
|
|
57647
|
-
value: "id"
|
|
57648
|
-
}
|
|
57649
|
-
}
|
|
57650
|
-
]
|
|
57713
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57714
|
+
selections: [...objectIdentificationSelection(config2, type)]
|
|
57651
57715
|
},
|
|
57652
57716
|
typeCondition: {
|
|
57653
|
-
kind:
|
|
57717
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57654
57718
|
name: {
|
|
57655
|
-
kind:
|
|
57719
|
+
kind: graphql9.Kind.NAME,
|
|
57656
57720
|
value: type.name
|
|
57657
57721
|
}
|
|
57658
57722
|
}
|
|
@@ -57660,15 +57724,15 @@ async function addListFragments(config2, documents) {
|
|
|
57660
57724
|
];
|
|
57661
57725
|
}
|
|
57662
57726
|
).concat(
|
|
57663
|
-
...
|
|
57664
|
-
kind:
|
|
57727
|
+
...validDeletes.map((typeName) => ({
|
|
57728
|
+
kind: graphql9.Kind.DIRECTIVE_DEFINITION,
|
|
57665
57729
|
name: {
|
|
57666
|
-
kind:
|
|
57730
|
+
kind: graphql9.Kind.NAME,
|
|
57667
57731
|
value: config2.listDeleteDirective(typeName)
|
|
57668
57732
|
},
|
|
57669
57733
|
locations: [
|
|
57670
57734
|
{
|
|
57671
|
-
kind:
|
|
57735
|
+
kind: graphql9.Kind.NAME,
|
|
57672
57736
|
value: "FIELD"
|
|
57673
57737
|
}
|
|
57674
57738
|
],
|
|
@@ -57676,8 +57740,8 @@ async function addListFragments(config2, documents) {
|
|
|
57676
57740
|
}))
|
|
57677
57741
|
)
|
|
57678
57742
|
};
|
|
57679
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
57680
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
57743
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57744
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57681
57745
|
documents.push({
|
|
57682
57746
|
name: "generated::lists",
|
|
57683
57747
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -57762,11 +57826,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
57762
57826
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
57763
57827
|
|
|
57764
57828
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
57765
|
-
var
|
|
57829
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
57766
57830
|
function fieldKey(config2, field) {
|
|
57767
57831
|
const attributeName = field.alias?.value || field.name.value;
|
|
57768
|
-
const printed =
|
|
57769
|
-
const secondParse =
|
|
57832
|
+
const printed = graphql10.print(field);
|
|
57833
|
+
const secondParse = graphql10.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
57770
57834
|
const paginated = !!field.directives?.find(
|
|
57771
57835
|
(directive) => directive.name.value === config2.paginateDirective
|
|
57772
57836
|
);
|
|
@@ -57785,7 +57849,9 @@ function fieldKey(config2, field) {
|
|
|
57785
57849
|
[arg.name.value]: printed.substring(start - 1, end - 1)
|
|
57786
57850
|
};
|
|
57787
57851
|
}, {});
|
|
57788
|
-
|
|
57852
|
+
const args = Object.keys(argObj);
|
|
57853
|
+
args.sort();
|
|
57854
|
+
let key = Object.values(argObj).length > 0 ? `${attributeName}(${args.map((key2) => `${key2}: ${argObj[key2]}`).join(", ")})` : attributeName;
|
|
57789
57855
|
if (paginated) {
|
|
57790
57856
|
key = key + "::paginated";
|
|
57791
57857
|
}
|
|
@@ -57859,8 +57925,8 @@ function selection({
|
|
|
57859
57925
|
const typeConditionName = field.typeCondition.name.value;
|
|
57860
57926
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
57861
57927
|
const possibleTypes = [];
|
|
57862
|
-
if (!
|
|
57863
|
-
} else if (
|
|
57928
|
+
if (!graphql11.isAbstractType(typeCondition)) {
|
|
57929
|
+
} else if (graphql11.isAbstractType(parentType)) {
|
|
57864
57930
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
57865
57931
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
57866
57932
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -57908,7 +57974,7 @@ function selection({
|
|
|
57908
57974
|
} else {
|
|
57909
57975
|
let typeRef = type.getFields()[field.name.value].type;
|
|
57910
57976
|
fieldType = getRootType(typeRef);
|
|
57911
|
-
nullable = !
|
|
57977
|
+
nullable = !graphql11.isNonNullType(typeRef);
|
|
57912
57978
|
}
|
|
57913
57979
|
const typeName = fieldType.toString();
|
|
57914
57980
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -57968,12 +58034,12 @@ function selection({
|
|
|
57968
58034
|
fieldObj.filters = (field.arguments || []).reduce(
|
|
57969
58035
|
(filters, arg) => ({
|
|
57970
58036
|
...filters,
|
|
57971
|
-
[arg.name.value]: convertValue(arg.value)
|
|
58037
|
+
[arg.name.value]: convertValue(config2, arg.value)
|
|
57972
58038
|
}),
|
|
57973
58039
|
{}
|
|
57974
58040
|
);
|
|
57975
58041
|
}
|
|
57976
|
-
if (
|
|
58042
|
+
if (graphql11.isInterfaceType(fieldType) || graphql11.isUnionType(fieldType)) {
|
|
57977
58043
|
fieldObj.abstract = true;
|
|
57978
58044
|
}
|
|
57979
58045
|
object.fields = {
|
|
@@ -58030,7 +58096,7 @@ function artifactGenerator(stats) {
|
|
|
58030
58096
|
return async function(config2, docs) {
|
|
58031
58097
|
const filterTypes = {};
|
|
58032
58098
|
for (const doc of docs) {
|
|
58033
|
-
|
|
58099
|
+
graphql12.visit(doc.document, {
|
|
58034
58100
|
Directive(node, _, __, ___, ancestors) {
|
|
58035
58101
|
if (node.name.value !== config2.listDirective) {
|
|
58036
58102
|
return;
|
|
@@ -58089,7 +58155,7 @@ function artifactGenerator(stats) {
|
|
|
58089
58155
|
return;
|
|
58090
58156
|
}
|
|
58091
58157
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
58092
|
-
let documentWithoutInternalDirectives =
|
|
58158
|
+
let documentWithoutInternalDirectives = graphql12.visit(document, {
|
|
58093
58159
|
Directive(node) {
|
|
58094
58160
|
if (config2.isInternalDirective(node)) {
|
|
58095
58161
|
return null;
|
|
@@ -58102,7 +58168,7 @@ function artifactGenerator(stats) {
|
|
|
58102
58168
|
}
|
|
58103
58169
|
}
|
|
58104
58170
|
});
|
|
58105
|
-
let documentWithoutExtraVariables =
|
|
58171
|
+
let documentWithoutExtraVariables = graphql12.visit(
|
|
58106
58172
|
documentWithoutInternalDirectives,
|
|
58107
58173
|
{
|
|
58108
58174
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -58113,13 +58179,13 @@ function artifactGenerator(stats) {
|
|
|
58113
58179
|
}
|
|
58114
58180
|
}
|
|
58115
58181
|
);
|
|
58116
|
-
let rawString =
|
|
58182
|
+
let rawString = graphql12.print(documentWithoutExtraVariables);
|
|
58117
58183
|
let docKind = doc.kind;
|
|
58118
58184
|
const operations = document.definitions.filter(
|
|
58119
|
-
({ kind }) => kind ===
|
|
58185
|
+
({ kind }) => kind === graphql12.Kind.OPERATION_DEFINITION
|
|
58120
58186
|
);
|
|
58121
58187
|
const fragments = document.definitions.filter(
|
|
58122
|
-
({ kind }) => kind ===
|
|
58188
|
+
({ kind }) => kind === graphql12.Kind.FRAGMENT_DEFINITION
|
|
58123
58189
|
);
|
|
58124
58190
|
let rootType = "";
|
|
58125
58191
|
let selectionSet;
|
|
@@ -58255,7 +58321,9 @@ function artifactGenerator(stats) {
|
|
|
58255
58321
|
}
|
|
58256
58322
|
|
|
58257
58323
|
// src/codegen/generators/runtime/index.ts
|
|
58258
|
-
|
|
58324
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
58325
|
+
var AST6 = recast6.types.builders;
|
|
58326
|
+
async function runtimeGenerator(config2, docs) {
|
|
58259
58327
|
await Promise.all([
|
|
58260
58328
|
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
58261
58329
|
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
@@ -58269,6 +58337,59 @@ async function runtimeGenerator(config2) {
|
|
|
58269
58337
|
}),
|
|
58270
58338
|
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
58271
58339
|
]);
|
|
58340
|
+
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
58341
|
+
const contents = await parseJS(await fs_exports.readFile(indexPath) || "");
|
|
58342
|
+
const graphql_tag_return = config2.plugins.find(
|
|
58343
|
+
(plugin) => plugin.graphql_tag_return
|
|
58344
|
+
)?.graphql_tag_return;
|
|
58345
|
+
if (graphql_tag_return && contents) {
|
|
58346
|
+
const overloaded_returns = {};
|
|
58347
|
+
for (const doc of docs) {
|
|
58348
|
+
const return_value = graphql_tag_return({
|
|
58349
|
+
config: config2,
|
|
58350
|
+
doc,
|
|
58351
|
+
ensure_import({ identifier, module: module2 }) {
|
|
58352
|
+
ensureImports({
|
|
58353
|
+
config: config2,
|
|
58354
|
+
body: contents.script.body,
|
|
58355
|
+
sourceModule: module2,
|
|
58356
|
+
import: [identifier]
|
|
58357
|
+
});
|
|
58358
|
+
}
|
|
58359
|
+
});
|
|
58360
|
+
if (return_value) {
|
|
58361
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
58362
|
+
}
|
|
58363
|
+
}
|
|
58364
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
58365
|
+
for (const [i, expression] of (contents?.script.body ?? []).entries()) {
|
|
58366
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
58367
|
+
continue;
|
|
58368
|
+
}
|
|
58369
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
58370
|
+
const input = AST6.identifier("str");
|
|
58371
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
58372
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
58373
|
+
);
|
|
58374
|
+
contents?.script.body.splice(
|
|
58375
|
+
i,
|
|
58376
|
+
0,
|
|
58377
|
+
AST6.exportNamedDeclaration(
|
|
58378
|
+
AST6.tsDeclareFunction(
|
|
58379
|
+
AST6.identifier("graphql"),
|
|
58380
|
+
[input],
|
|
58381
|
+
AST6.tsTypeAnnotation(
|
|
58382
|
+
AST6.tsTypeReference(AST6.identifier(returnValue))
|
|
58383
|
+
)
|
|
58384
|
+
)
|
|
58385
|
+
)
|
|
58386
|
+
);
|
|
58387
|
+
}
|
|
58388
|
+
break;
|
|
58389
|
+
}
|
|
58390
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
58391
|
+
}
|
|
58392
|
+
}
|
|
58272
58393
|
}
|
|
58273
58394
|
async function generatePluginRuntime(config2, plugin) {
|
|
58274
58395
|
if (houdini_mode.is_testing) {
|
|
@@ -58303,20 +58424,20 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
58303
58424
|
}
|
|
58304
58425
|
|
|
58305
58426
|
// src/codegen/generators/typescript/index.ts
|
|
58306
|
-
var
|
|
58427
|
+
var recast12 = __toESM(require_main2(), 1);
|
|
58307
58428
|
|
|
58308
58429
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58430
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
58431
|
+
var recast9 = __toESM(require_main2(), 1);
|
|
58432
|
+
|
|
58433
|
+
// src/codegen/generators/typescript/typeReference.ts
|
|
58309
58434
|
var graphql14 = __toESM(require_graphql2(), 1);
|
|
58310
58435
|
var recast8 = __toESM(require_main2(), 1);
|
|
58311
58436
|
|
|
58312
|
-
// src/codegen/generators/typescript/
|
|
58437
|
+
// src/codegen/generators/typescript/types.ts
|
|
58313
58438
|
var graphql13 = __toESM(require_graphql2(), 1);
|
|
58314
58439
|
var recast7 = __toESM(require_main2(), 1);
|
|
58315
|
-
|
|
58316
|
-
// src/codegen/generators/typescript/types.ts
|
|
58317
|
-
var graphql12 = __toESM(require_graphql2(), 1);
|
|
58318
|
-
var recast6 = __toESM(require_main2(), 1);
|
|
58319
|
-
var AST6 = recast6.types.builders;
|
|
58440
|
+
var AST7 = recast7.types.builders;
|
|
58320
58441
|
function readonlyProperty(prop, enable = true) {
|
|
58321
58442
|
if (enable) {
|
|
58322
58443
|
prop.readonly = true;
|
|
@@ -58324,31 +58445,31 @@ function readonlyProperty(prop, enable = true) {
|
|
|
58324
58445
|
return prop;
|
|
58325
58446
|
}
|
|
58326
58447
|
function nullableField(inner, input = false) {
|
|
58327
|
-
const members = [inner,
|
|
58448
|
+
const members = [inner, AST7.tsNullKeyword()];
|
|
58328
58449
|
if (input) {
|
|
58329
|
-
members.push(
|
|
58450
|
+
members.push(AST7.tsUndefinedKeyword());
|
|
58330
58451
|
}
|
|
58331
|
-
return
|
|
58452
|
+
return AST7.tsUnionType(members);
|
|
58332
58453
|
}
|
|
58333
58454
|
function scalarPropertyValue(config2, missingScalars, target) {
|
|
58334
58455
|
switch (target.name) {
|
|
58335
58456
|
case "String": {
|
|
58336
|
-
return
|
|
58457
|
+
return AST7.tsStringKeyword();
|
|
58337
58458
|
}
|
|
58338
58459
|
case "Int": {
|
|
58339
|
-
return
|
|
58460
|
+
return AST7.tsNumberKeyword();
|
|
58340
58461
|
}
|
|
58341
58462
|
case "Float": {
|
|
58342
|
-
return
|
|
58463
|
+
return AST7.tsNumberKeyword();
|
|
58343
58464
|
}
|
|
58344
58465
|
case "Boolean": {
|
|
58345
|
-
return
|
|
58466
|
+
return AST7.tsBooleanKeyword();
|
|
58346
58467
|
}
|
|
58347
58468
|
case "ID": {
|
|
58348
|
-
return
|
|
58469
|
+
return AST7.tsStringKeyword();
|
|
58349
58470
|
}
|
|
58350
58471
|
default: {
|
|
58351
|
-
if (
|
|
58472
|
+
if (graphql13.isNonNullType(target) && "ofType" in target) {
|
|
58352
58473
|
return scalarPropertyValue(
|
|
58353
58474
|
config2,
|
|
58354
58475
|
missingScalars,
|
|
@@ -58356,23 +58477,23 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
58356
58477
|
);
|
|
58357
58478
|
}
|
|
58358
58479
|
if (config2.scalars?.[target.name]) {
|
|
58359
|
-
return
|
|
58480
|
+
return AST7.tsTypeReference(AST7.identifier(config2.scalars?.[target.name].type));
|
|
58360
58481
|
}
|
|
58361
58482
|
missingScalars.add(target.name);
|
|
58362
|
-
return
|
|
58483
|
+
return AST7.tsAnyKeyword();
|
|
58363
58484
|
}
|
|
58364
58485
|
}
|
|
58365
58486
|
}
|
|
58366
58487
|
|
|
58367
58488
|
// src/codegen/generators/typescript/typeReference.ts
|
|
58368
|
-
var
|
|
58489
|
+
var AST8 = recast8.types.builders;
|
|
58369
58490
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
58370
58491
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
58371
58492
|
let result;
|
|
58372
|
-
if (
|
|
58493
|
+
if (graphql14.isScalarType(type)) {
|
|
58373
58494
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58374
58495
|
} else {
|
|
58375
|
-
result =
|
|
58496
|
+
result = AST8.tsTypeReference(AST8.identifier(type.name));
|
|
58376
58497
|
}
|
|
58377
58498
|
for (const toWrap of wrappers) {
|
|
58378
58499
|
if (toWrap === "NonNull" /* NonNull */) {
|
|
@@ -58380,27 +58501,27 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
58380
58501
|
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
58381
58502
|
result = nullableField(result, true);
|
|
58382
58503
|
} else if (toWrap === "List" /* List */) {
|
|
58383
|
-
result =
|
|
58504
|
+
result = AST8.tsArrayType(AST8.tsParenthesizedType(result));
|
|
58384
58505
|
}
|
|
58385
58506
|
}
|
|
58386
58507
|
return result;
|
|
58387
58508
|
}
|
|
58388
58509
|
|
|
58389
58510
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58390
|
-
var
|
|
58511
|
+
var AST9 = recast9.types.builders;
|
|
58391
58512
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
58392
58513
|
const { type } = unwrapType(config2, rootType);
|
|
58393
|
-
if (
|
|
58514
|
+
if (graphql15.isScalarType(type)) {
|
|
58394
58515
|
return;
|
|
58395
58516
|
}
|
|
58396
58517
|
if (visitedTypes.has(type.name)) {
|
|
58397
58518
|
return;
|
|
58398
58519
|
}
|
|
58399
|
-
if (
|
|
58520
|
+
if (graphql15.isUnionType(type)) {
|
|
58400
58521
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
58401
58522
|
}
|
|
58402
58523
|
visitedTypes.add(type.name);
|
|
58403
|
-
if (
|
|
58524
|
+
if (graphql15.isEnumType(type)) {
|
|
58404
58525
|
ensureImports({
|
|
58405
58526
|
config: config2,
|
|
58406
58527
|
body,
|
|
@@ -58414,20 +58535,267 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58414
58535
|
for (const field of Object.values(type.getFields())) {
|
|
58415
58536
|
addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, field.type);
|
|
58416
58537
|
members.push(
|
|
58417
|
-
|
|
58418
|
-
|
|
58419
|
-
|
|
58420
|
-
|
|
58538
|
+
AST9.tsPropertySignature(
|
|
58539
|
+
AST9.identifier(field.name),
|
|
58540
|
+
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
58541
|
+
graphql15.isNullableType(field.type)
|
|
58421
58542
|
)
|
|
58422
58543
|
);
|
|
58423
58544
|
}
|
|
58424
|
-
body.push(
|
|
58545
|
+
body.push(AST9.tsTypeAliasDeclaration(AST9.identifier(type.name), AST9.tsTypeLiteral(members)));
|
|
58546
|
+
}
|
|
58547
|
+
|
|
58548
|
+
// src/codegen/generators/typescript/imperativeCache.ts
|
|
58549
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
58550
|
+
var recast10 = __toESM(require_main2(), 1);
|
|
58551
|
+
var AST10 = recast10.types.builders;
|
|
58552
|
+
async function imperativeCacheTypef(config2, docs) {
|
|
58553
|
+
const target = path_exports.join(config2.runtimeDirectory, "generated.d.ts");
|
|
58554
|
+
const body = [];
|
|
58555
|
+
const declaration = AST10.tsTypeAliasDeclaration(
|
|
58556
|
+
AST10.identifier(CacheTypeDefName),
|
|
58557
|
+
AST10.tsTypeLiteral([
|
|
58558
|
+
AST10.tsPropertySignature(
|
|
58559
|
+
AST10.identifier("types"),
|
|
58560
|
+
AST10.tsTypeAnnotation(typeDefinitions(config2, body))
|
|
58561
|
+
),
|
|
58562
|
+
AST10.tsPropertySignature(
|
|
58563
|
+
AST10.identifier("lists"),
|
|
58564
|
+
AST10.tsTypeAnnotation(listDefinitions(config2, docs))
|
|
58565
|
+
)
|
|
58566
|
+
])
|
|
58567
|
+
);
|
|
58568
|
+
declaration.declare = true;
|
|
58569
|
+
const importRecord = AST10.importDeclaration(
|
|
58570
|
+
[AST10.importSpecifier(AST10.identifier("Record"))],
|
|
58571
|
+
AST10.stringLiteral("./public/record")
|
|
58572
|
+
);
|
|
58573
|
+
importRecord.importKind = "type";
|
|
58574
|
+
await fs_exports.writeFile(
|
|
58575
|
+
target,
|
|
58576
|
+
recast10.prettyPrint(
|
|
58577
|
+
AST10.program([importRecord, ...body, AST10.exportNamedDeclaration(declaration)])
|
|
58578
|
+
).code
|
|
58579
|
+
);
|
|
58580
|
+
}
|
|
58581
|
+
function typeDefinitions(config2, body) {
|
|
58582
|
+
const operationTypes = [config2.schema.getMutationType(), config2.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
58583
|
+
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58584
|
+
const types14 = Object.values(config2.schema.getTypeMap()).filter(
|
|
58585
|
+
(type) => !graphql16.isAbstractType(type) && !graphql16.isScalarType(type) && !graphql16.isEnumType(type) && !graphql16.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
58586
|
+
);
|
|
58587
|
+
return AST10.tsTypeLiteral(
|
|
58588
|
+
types14.map((type) => {
|
|
58589
|
+
let typeName = type.name;
|
|
58590
|
+
if (config2.schema.getQueryType() && config2.schema.getQueryType()?.name === type.name) {
|
|
58591
|
+
typeName = "__ROOT__";
|
|
58592
|
+
}
|
|
58593
|
+
let idFields = AST10.tsNeverKeyword();
|
|
58594
|
+
const keys = keyFieldsForType(config2.configFile, type.name);
|
|
58595
|
+
if (graphql16.isObjectType(type) && keys.length > 0 && keys.every((key) => type.getFields()[key])) {
|
|
58596
|
+
idFields = AST10.tsTypeLiteral(
|
|
58597
|
+
keys.map((key) => {
|
|
58598
|
+
const fieldType = type.getFields()[key];
|
|
58599
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
58600
|
+
return AST10.tsPropertySignature(
|
|
58601
|
+
AST10.identifier(key),
|
|
58602
|
+
AST10.tsTypeAnnotation(
|
|
58603
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
58604
|
+
)
|
|
58605
|
+
);
|
|
58606
|
+
})
|
|
58607
|
+
);
|
|
58608
|
+
} else if (typeName === "__ROOT__") {
|
|
58609
|
+
idFields = AST10.tsTypeLiteral([]);
|
|
58610
|
+
}
|
|
58611
|
+
let fields = AST10.tsTypeLiteral([]);
|
|
58612
|
+
if (graphql16.isObjectType(type)) {
|
|
58613
|
+
fields = AST10.tsTypeLiteral(
|
|
58614
|
+
Object.entries(type.getFields()).map(
|
|
58615
|
+
([key, fieldType]) => {
|
|
58616
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
58617
|
+
let typeOptions = AST10.tsUnionType([]);
|
|
58618
|
+
if (graphql16.isScalarType(unwrapped.type)) {
|
|
58619
|
+
typeOptions.types.push(
|
|
58620
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
58621
|
+
);
|
|
58622
|
+
} else if (graphql16.isEnumType(unwrapped.type)) {
|
|
58623
|
+
typeOptions.types.push(
|
|
58624
|
+
AST10.tsTypeReference(AST10.identifier(unwrapped.type.name))
|
|
58625
|
+
);
|
|
58626
|
+
} else if (!graphql16.isAbstractType(unwrapped.type)) {
|
|
58627
|
+
typeOptions.types.push(record(unwrapped.type.name));
|
|
58628
|
+
} else {
|
|
58629
|
+
typeOptions.types.push(
|
|
58630
|
+
...config2.schema.getPossibleTypes(unwrapped.type).map((type2) => record(type2.name))
|
|
58631
|
+
);
|
|
58632
|
+
}
|
|
58633
|
+
for (const wrapper of unwrapped.wrappers) {
|
|
58634
|
+
if (wrapper === "Nullable" /* Nullable */) {
|
|
58635
|
+
typeOptions = AST10.tsParenthesizedType(
|
|
58636
|
+
AST10.tsUnionType([typeOptions, AST10.tsNullKeyword()])
|
|
58637
|
+
);
|
|
58638
|
+
} else if (wrapper === "List" /* List */) {
|
|
58639
|
+
typeOptions = AST10.tsArrayType(
|
|
58640
|
+
AST10.tsParenthesizedType(typeOptions)
|
|
58641
|
+
);
|
|
58642
|
+
}
|
|
58643
|
+
}
|
|
58644
|
+
if (typeOptions.type === "TSParenthesizedType") {
|
|
58645
|
+
typeOptions = typeOptions.typeAnnotation;
|
|
58646
|
+
}
|
|
58647
|
+
let args = AST10.tsNeverKeyword();
|
|
58648
|
+
if (fieldType.args?.length > 0) {
|
|
58649
|
+
args = AST10.tsTypeLiteral(
|
|
58650
|
+
fieldType.args.map((arg) => {
|
|
58651
|
+
addReferencedInputTypes(
|
|
58652
|
+
config2,
|
|
58653
|
+
"",
|
|
58654
|
+
body,
|
|
58655
|
+
visitedTypes,
|
|
58656
|
+
/* @__PURE__ */ new Set(),
|
|
58657
|
+
arg.type
|
|
58658
|
+
);
|
|
58659
|
+
const prop = AST10.tsPropertySignature(
|
|
58660
|
+
AST10.identifier(arg.name),
|
|
58661
|
+
AST10.tsTypeAnnotation(
|
|
58662
|
+
tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
|
|
58663
|
+
)
|
|
58664
|
+
);
|
|
58665
|
+
const unwrapped2 = unwrapType(config2, arg.type);
|
|
58666
|
+
prop.optional = unwrapped2.wrappers[unwrapped2.wrappers.length - 1] === "Nullable" /* Nullable */;
|
|
58667
|
+
return prop;
|
|
58668
|
+
})
|
|
58669
|
+
);
|
|
58670
|
+
}
|
|
58671
|
+
return AST10.tsPropertySignature(
|
|
58672
|
+
AST10.identifier(key),
|
|
58673
|
+
AST10.tsTypeAnnotation(
|
|
58674
|
+
AST10.tsTypeLiteral([
|
|
58675
|
+
AST10.tsPropertySignature(
|
|
58676
|
+
AST10.identifier("type"),
|
|
58677
|
+
AST10.tsTypeAnnotation(typeOptions)
|
|
58678
|
+
),
|
|
58679
|
+
AST10.tsPropertySignature(
|
|
58680
|
+
AST10.identifier("args"),
|
|
58681
|
+
AST10.tsTypeAnnotation(args)
|
|
58682
|
+
)
|
|
58683
|
+
])
|
|
58684
|
+
)
|
|
58685
|
+
);
|
|
58686
|
+
}
|
|
58687
|
+
)
|
|
58688
|
+
);
|
|
58689
|
+
}
|
|
58690
|
+
return AST10.tsPropertySignature(
|
|
58691
|
+
AST10.identifier(typeName),
|
|
58692
|
+
AST10.tsTypeAnnotation(
|
|
58693
|
+
AST10.tsTypeLiteral([
|
|
58694
|
+
AST10.tsPropertySignature(
|
|
58695
|
+
AST10.identifier("idFields"),
|
|
58696
|
+
AST10.tsTypeAnnotation(idFields)
|
|
58697
|
+
),
|
|
58698
|
+
AST10.tsPropertySignature(
|
|
58699
|
+
AST10.identifier("fields"),
|
|
58700
|
+
AST10.tsTypeAnnotation(fields)
|
|
58701
|
+
)
|
|
58702
|
+
])
|
|
58703
|
+
)
|
|
58704
|
+
);
|
|
58705
|
+
})
|
|
58706
|
+
);
|
|
58707
|
+
}
|
|
58708
|
+
function listDefinitions(config2, docs) {
|
|
58709
|
+
const lists = [];
|
|
58710
|
+
const visitedLists = /* @__PURE__ */ new Set();
|
|
58711
|
+
for (const doc of docs) {
|
|
58712
|
+
graphql16.visit(doc.document, {
|
|
58713
|
+
Directive(node, key, parent, path2, ancestors) {
|
|
58714
|
+
if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
58715
|
+
return;
|
|
58716
|
+
}
|
|
58717
|
+
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
58718
|
+
const nameValue = nameArg?.value?.value || "";
|
|
58719
|
+
if (!nameValue || visitedLists.has(nameValue)) {
|
|
58720
|
+
return;
|
|
58721
|
+
}
|
|
58722
|
+
visitedLists.add(nameValue);
|
|
58723
|
+
const parentType = parentTypeFromAncestors(
|
|
58724
|
+
config2.schema,
|
|
58725
|
+
doc.filename,
|
|
58726
|
+
ancestors.slice(0, -1)
|
|
58727
|
+
);
|
|
58728
|
+
const targetField = ancestors[ancestors.length - 1];
|
|
58729
|
+
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
58730
|
+
const { type: listType } = unwrapType(config2, targetFieldDefinition.type);
|
|
58731
|
+
const possibleTypes = [];
|
|
58732
|
+
if (graphql16.isAbstractType(listType)) {
|
|
58733
|
+
possibleTypes.push(
|
|
58734
|
+
...config2.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
58735
|
+
);
|
|
58736
|
+
} else {
|
|
58737
|
+
possibleTypes.push(listType.name);
|
|
58738
|
+
}
|
|
58739
|
+
lists.push(
|
|
58740
|
+
AST10.tsPropertySignature(
|
|
58741
|
+
AST10.identifier(nameValue),
|
|
58742
|
+
AST10.tsTypeAnnotation(
|
|
58743
|
+
AST10.tsTypeLiteral([
|
|
58744
|
+
AST10.tsPropertySignature(
|
|
58745
|
+
AST10.identifier("type"),
|
|
58746
|
+
AST10.tsTypeAnnotation(
|
|
58747
|
+
AST10.tsUnionType(
|
|
58748
|
+
possibleTypes.map(
|
|
58749
|
+
(possible) => AST10.tsLiteralType(AST10.stringLiteral(possible))
|
|
58750
|
+
)
|
|
58751
|
+
)
|
|
58752
|
+
)
|
|
58753
|
+
),
|
|
58754
|
+
AST10.tsPropertySignature(
|
|
58755
|
+
AST10.identifier("filters"),
|
|
58756
|
+
AST10.tsTypeAnnotation(
|
|
58757
|
+
targetFieldDefinition.args.length === 0 ? AST10.tsNeverKeyword() : AST10.tsTypeLiteral(
|
|
58758
|
+
targetFieldDefinition.args.map((arg) => {
|
|
58759
|
+
const argDef = AST10.tsPropertySignature(
|
|
58760
|
+
AST10.identifier(arg.name),
|
|
58761
|
+
AST10.tsTypeAnnotation(
|
|
58762
|
+
tsTypeReference(
|
|
58763
|
+
config2,
|
|
58764
|
+
/* @__PURE__ */ new Set(),
|
|
58765
|
+
arg
|
|
58766
|
+
)
|
|
58767
|
+
)
|
|
58768
|
+
);
|
|
58769
|
+
argDef.optional = true;
|
|
58770
|
+
return argDef;
|
|
58771
|
+
})
|
|
58772
|
+
)
|
|
58773
|
+
)
|
|
58774
|
+
)
|
|
58775
|
+
])
|
|
58776
|
+
)
|
|
58777
|
+
)
|
|
58778
|
+
);
|
|
58779
|
+
}
|
|
58780
|
+
});
|
|
58781
|
+
}
|
|
58782
|
+
return AST10.tsTypeLiteral(lists);
|
|
58783
|
+
}
|
|
58784
|
+
var CacheTypeDefName = "CacheTypeDef";
|
|
58785
|
+
function record(name2) {
|
|
58786
|
+
return AST10.tsTypeReference(
|
|
58787
|
+
AST10.identifier("Record"),
|
|
58788
|
+
AST10.tsTypeParameterInstantiation([
|
|
58789
|
+
AST10.tsTypeReference(AST10.identifier(CacheTypeDefName)),
|
|
58790
|
+
AST10.tsLiteralType(AST10.stringLiteral(name2))
|
|
58791
|
+
])
|
|
58792
|
+
);
|
|
58425
58793
|
}
|
|
58426
58794
|
|
|
58427
58795
|
// src/codegen/generators/typescript/inlineType.ts
|
|
58428
|
-
var
|
|
58429
|
-
var
|
|
58430
|
-
var
|
|
58796
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
58797
|
+
var recast11 = __toESM(require_main2(), 1);
|
|
58798
|
+
var AST11 = recast11.types.builders;
|
|
58431
58799
|
var fragmentKey = "$fragments";
|
|
58432
58800
|
function inlineType({
|
|
58433
58801
|
config: config2,
|
|
@@ -58444,9 +58812,9 @@ function inlineType({
|
|
|
58444
58812
|
}) {
|
|
58445
58813
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
58446
58814
|
let result;
|
|
58447
|
-
if (
|
|
58815
|
+
if (graphql17.isScalarType(type)) {
|
|
58448
58816
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58449
|
-
} else if (
|
|
58817
|
+
} else if (graphql17.isEnumType(type)) {
|
|
58450
58818
|
if (!visitedTypes.has(type.name)) {
|
|
58451
58819
|
ensureImports({
|
|
58452
58820
|
config: config2,
|
|
@@ -58456,7 +58824,7 @@ function inlineType({
|
|
|
58456
58824
|
});
|
|
58457
58825
|
visitedTypes.add(type.name);
|
|
58458
58826
|
}
|
|
58459
|
-
result =
|
|
58827
|
+
result = AST11.tsTypeReference(AST11.identifier(type.name));
|
|
58460
58828
|
} else if (selections) {
|
|
58461
58829
|
const rootObj = type;
|
|
58462
58830
|
const inlineFragments = {};
|
|
@@ -58464,11 +58832,11 @@ function inlineType({
|
|
|
58464
58832
|
for (const selection2 of selections) {
|
|
58465
58833
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
58466
58834
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
58467
|
-
if (!
|
|
58835
|
+
if (!graphql17.isInterfaceType(type) && !graphql17.isUnionType(type)) {
|
|
58468
58836
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
58469
58837
|
continue;
|
|
58470
58838
|
}
|
|
58471
|
-
if (!
|
|
58839
|
+
if (!graphql17.isInterfaceType(fragmentType) && !graphql17.isUnionType(fragmentType)) {
|
|
58472
58840
|
if (!inlineFragments[fragmentType.name]) {
|
|
58473
58841
|
inlineFragments[fragmentType.name] = [];
|
|
58474
58842
|
}
|
|
@@ -58507,7 +58875,7 @@ function inlineType({
|
|
|
58507
58875
|
selectedFields.push(selection2);
|
|
58508
58876
|
}
|
|
58509
58877
|
}
|
|
58510
|
-
result =
|
|
58878
|
+
result = AST11.tsTypeLiteral([
|
|
58511
58879
|
...(selectedFields || []).filter(
|
|
58512
58880
|
(field) => field.kind === "Field"
|
|
58513
58881
|
).map((selection2) => {
|
|
@@ -58527,9 +58895,9 @@ function inlineType({
|
|
|
58527
58895
|
allOptional
|
|
58528
58896
|
});
|
|
58529
58897
|
const prop = readonlyProperty(
|
|
58530
|
-
|
|
58531
|
-
|
|
58532
|
-
|
|
58898
|
+
AST11.tsPropertySignature(
|
|
58899
|
+
AST11.identifier(attributeName),
|
|
58900
|
+
AST11.tsTypeAnnotation(attributeType)
|
|
58533
58901
|
),
|
|
58534
58902
|
allowReadonly
|
|
58535
58903
|
);
|
|
@@ -58543,15 +58911,15 @@ function inlineType({
|
|
|
58543
58911
|
if (includeFragments && fragmentSpreads && fragmentSpreads.length) {
|
|
58544
58912
|
result.members.push(
|
|
58545
58913
|
readonlyProperty(
|
|
58546
|
-
|
|
58547
|
-
|
|
58548
|
-
|
|
58549
|
-
|
|
58914
|
+
AST11.tsPropertySignature(
|
|
58915
|
+
AST11.identifier(fragmentKey),
|
|
58916
|
+
AST11.tsTypeAnnotation(
|
|
58917
|
+
AST11.tsTypeLiteral(
|
|
58550
58918
|
(fragmentSpreads || []).map(
|
|
58551
|
-
(fragmentSpread) =>
|
|
58552
|
-
|
|
58553
|
-
|
|
58554
|
-
|
|
58919
|
+
(fragmentSpread) => AST11.tsPropertySignature(
|
|
58920
|
+
AST11.identifier(fragmentSpread.name.value),
|
|
58921
|
+
AST11.tsTypeAnnotation(
|
|
58922
|
+
AST11.tsLiteralType(AST11.booleanLiteral(true))
|
|
58555
58923
|
)
|
|
58556
58924
|
)
|
|
58557
58925
|
)
|
|
@@ -58588,7 +58956,7 @@ function inlineType({
|
|
|
58588
58956
|
}
|
|
58589
58957
|
}
|
|
58590
58958
|
}
|
|
58591
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
58959
|
+
if (objectType.type === "TSTypeLiteral" && !graphql17.isInterfaceType(fragmentRootType) && !graphql17.isUnionType(fragmentRootType)) {
|
|
58592
58960
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
58593
58961
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
58594
58962
|
);
|
|
@@ -58597,9 +58965,9 @@ function inlineType({
|
|
|
58597
58965
|
}
|
|
58598
58966
|
objectType.members.push(
|
|
58599
58967
|
readonlyProperty(
|
|
58600
|
-
|
|
58601
|
-
|
|
58602
|
-
|
|
58968
|
+
AST11.tsPropertySignature(
|
|
58969
|
+
AST11.identifier("__typename"),
|
|
58970
|
+
AST11.tsTypeAnnotation(AST11.tsLiteralType(AST11.stringLiteral(typeName)))
|
|
58603
58971
|
),
|
|
58604
58972
|
allowReadonly
|
|
58605
58973
|
)
|
|
@@ -58610,8 +58978,8 @@ function inlineType({
|
|
|
58610
58978
|
if (Object.keys(inlineFragmentSelections).length > 0) {
|
|
58611
58979
|
let selectionTypes = Object.entries(inlineFragmentSelections).map(
|
|
58612
58980
|
([typeName, { type: type2, tsType }]) => {
|
|
58613
|
-
return
|
|
58614
|
-
|
|
58981
|
+
return AST11.tsParenthesizedType(
|
|
58982
|
+
AST11.tsIntersectionType(
|
|
58615
58983
|
[tsType].flatMap((type3) => {
|
|
58616
58984
|
if (type3.type === "TSUnionType") {
|
|
58617
58985
|
return type3.types.filter(
|
|
@@ -58624,9 +58992,9 @@ function inlineType({
|
|
|
58624
58992
|
);
|
|
58625
58993
|
}
|
|
58626
58994
|
);
|
|
58627
|
-
result =
|
|
58995
|
+
result = AST11.tsIntersectionType([
|
|
58628
58996
|
result,
|
|
58629
|
-
|
|
58997
|
+
AST11.tsParenthesizedType(AST11.tsUnionType(selectionTypes))
|
|
58630
58998
|
]);
|
|
58631
58999
|
}
|
|
58632
59000
|
} else {
|
|
@@ -58638,7 +59006,7 @@ function inlineType({
|
|
|
58638
59006
|
} else if (toWrap === "NonNull" /* NonNull */) {
|
|
58639
59007
|
continue;
|
|
58640
59008
|
} else if (toWrap === "List" /* List */) {
|
|
58641
|
-
result =
|
|
59009
|
+
result = AST11.tsArrayType(AST11.tsParenthesizedType(result));
|
|
58642
59010
|
}
|
|
58643
59011
|
}
|
|
58644
59012
|
return result;
|
|
@@ -58655,7 +59023,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58655
59023
|
},
|
|
58656
59024
|
type: schema.getType("String")
|
|
58657
59025
|
};
|
|
58658
|
-
} else if (
|
|
59026
|
+
} else if (graphql17.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
58659
59027
|
fields = rootType.ofType.getFields();
|
|
58660
59028
|
} else {
|
|
58661
59029
|
fields = rootType.getFields();
|
|
@@ -58667,7 +59035,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58667
59035
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
58668
59036
|
});
|
|
58669
59037
|
}
|
|
58670
|
-
const fieldType =
|
|
59038
|
+
const fieldType = graphql17.getNamedType(field.type);
|
|
58671
59039
|
if (!fieldType) {
|
|
58672
59040
|
throw new HoudiniError({
|
|
58673
59041
|
filepath,
|
|
@@ -58683,7 +59051,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58683
59051
|
}
|
|
58684
59052
|
|
|
58685
59053
|
// src/codegen/generators/typescript/index.ts
|
|
58686
|
-
var
|
|
59054
|
+
var AST12 = recast12.types.builders;
|
|
58687
59055
|
async function typescriptGenerator(config2, docs) {
|
|
58688
59056
|
const typePaths = [];
|
|
58689
59057
|
const fragmentDefinitions = {};
|
|
@@ -58701,7 +59069,7 @@ async function typescriptGenerator(config2, docs) {
|
|
|
58701
59069
|
return;
|
|
58702
59070
|
}
|
|
58703
59071
|
const typeDefPath = config2.artifactTypePath(originalDocument);
|
|
58704
|
-
const program =
|
|
59072
|
+
const program = AST12.program([]);
|
|
58705
59073
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58706
59074
|
let definition = originalDocument.definitions.find(
|
|
58707
59075
|
(def) => (def.kind === "OperationDefinition" || def.kind === "FragmentDefinition") && def.name?.value === name2
|
|
@@ -58734,21 +59102,21 @@ async function typescriptGenerator(config2, docs) {
|
|
|
58734
59102
|
missingScalars
|
|
58735
59103
|
);
|
|
58736
59104
|
}
|
|
58737
|
-
await fs_exports.writeFile(typeDefPath,
|
|
59105
|
+
await fs_exports.writeFile(typeDefPath, recast12.print(program).code);
|
|
58738
59106
|
typePaths.push(typeDefPath);
|
|
58739
59107
|
})
|
|
58740
59108
|
);
|
|
58741
|
-
const typeIndex =
|
|
59109
|
+
const typeIndex = AST12.program(
|
|
58742
59110
|
typePaths.sort((a, b) => a.localeCompare(b)).map((typePath) => {
|
|
58743
|
-
return
|
|
58744
|
-
|
|
59111
|
+
return AST12.exportAllDeclaration(
|
|
59112
|
+
AST12.literal(
|
|
58745
59113
|
"./" + path_exports.relative(path_exports.resolve(config2.typeIndexPath, ".."), typePath).replace(/\.[^/.]+\.[^/.]+$/, "")
|
|
58746
59114
|
),
|
|
58747
59115
|
null
|
|
58748
59116
|
);
|
|
58749
59117
|
}).concat([
|
|
58750
|
-
|
|
58751
|
-
|
|
59118
|
+
AST12.exportAllDeclaration(AST12.literal("./runtime"), null),
|
|
59119
|
+
AST12.exportAllDeclaration(AST12.literal("./graphql"), null)
|
|
58752
59120
|
])
|
|
58753
59121
|
);
|
|
58754
59122
|
const export_default_as = ({ module: module2, as }) => `
|
|
@@ -58757,7 +59125,7 @@ export { default as ${as} } from "${module2}"
|
|
|
58757
59125
|
const export_star_from = ({ module: module2 }) => `
|
|
58758
59126
|
export * from "${module2}"
|
|
58759
59127
|
`;
|
|
58760
|
-
let indexContent =
|
|
59128
|
+
let indexContent = recast12.print(typeIndex).code;
|
|
58761
59129
|
for (const plugin of config2.plugins) {
|
|
58762
59130
|
if (!plugin.index_file) {
|
|
58763
59131
|
continue;
|
|
@@ -58778,6 +59146,7 @@ export * from "${module2}"
|
|
|
58778
59146
|
}
|
|
58779
59147
|
}
|
|
58780
59148
|
await fs_exports.writeFile(config2.typeIndexPath, indexContent);
|
|
59149
|
+
await imperativeCacheTypef(config2, docs);
|
|
58781
59150
|
if (missingScalars.size > 0) {
|
|
58782
59151
|
console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
|
|
58783
59152
|
", "
|
|
@@ -58819,23 +59188,23 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
58819
59188
|
const optimisticTypeName = `${definition.name.value}$optimistic`;
|
|
58820
59189
|
const hasInputs = definition.variableDefinitions && definition.variableDefinitions.length > 0;
|
|
58821
59190
|
body.push(
|
|
58822
|
-
|
|
58823
|
-
|
|
58824
|
-
|
|
58825
|
-
|
|
59191
|
+
AST12.exportNamedDeclaration(
|
|
59192
|
+
AST12.tsTypeAliasDeclaration(
|
|
59193
|
+
AST12.identifier(definition.name.value),
|
|
59194
|
+
AST12.tsTypeLiteral([
|
|
58826
59195
|
readonlyProperty(
|
|
58827
|
-
|
|
58828
|
-
|
|
58829
|
-
|
|
59196
|
+
AST12.tsPropertySignature(
|
|
59197
|
+
AST12.stringLiteral("input"),
|
|
59198
|
+
AST12.tsTypeAnnotation(AST12.tsTypeReference(AST12.identifier(inputTypeName)))
|
|
58830
59199
|
)
|
|
58831
59200
|
),
|
|
58832
59201
|
readonlyProperty(
|
|
58833
|
-
|
|
58834
|
-
|
|
58835
|
-
|
|
58836
|
-
definition.operation === "mutation" ?
|
|
58837
|
-
|
|
58838
|
-
|
|
59202
|
+
AST12.tsPropertySignature(
|
|
59203
|
+
AST12.stringLiteral("result"),
|
|
59204
|
+
AST12.tsTypeAnnotation(
|
|
59205
|
+
definition.operation === "mutation" ? AST12.tsTypeReference(AST12.identifier(shapeTypeName)) : AST12.tsUnionType([
|
|
59206
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName)),
|
|
59207
|
+
AST12.tsUndefinedKeyword()
|
|
58839
59208
|
])
|
|
58840
59209
|
)
|
|
58841
59210
|
)
|
|
@@ -58843,9 +59212,9 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
58843
59212
|
])
|
|
58844
59213
|
)
|
|
58845
59214
|
),
|
|
58846
|
-
|
|
58847
|
-
|
|
58848
|
-
|
|
59215
|
+
AST12.exportNamedDeclaration(
|
|
59216
|
+
AST12.tsTypeAliasDeclaration(
|
|
59217
|
+
AST12.identifier(shapeTypeName),
|
|
58849
59218
|
inlineType({
|
|
58850
59219
|
config: config2,
|
|
58851
59220
|
filepath,
|
|
@@ -58873,15 +59242,15 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
58873
59242
|
);
|
|
58874
59243
|
}
|
|
58875
59244
|
body.push(
|
|
58876
|
-
|
|
58877
|
-
|
|
58878
|
-
|
|
58879
|
-
|
|
59245
|
+
AST12.exportNamedDeclaration(
|
|
59246
|
+
AST12.tsTypeAliasDeclaration(
|
|
59247
|
+
AST12.identifier(inputTypeName),
|
|
59248
|
+
AST12.tsTypeLiteral(
|
|
58880
59249
|
(definition.variableDefinitions || []).map(
|
|
58881
59250
|
(definition2) => {
|
|
58882
|
-
return
|
|
58883
|
-
|
|
58884
|
-
|
|
59251
|
+
return AST12.tsPropertySignature(
|
|
59252
|
+
AST12.identifier(definition2.variable.name.value),
|
|
59253
|
+
AST12.tsTypeAnnotation(
|
|
58885
59254
|
tsTypeReference(config2, missingScalars, definition2)
|
|
58886
59255
|
),
|
|
58887
59256
|
definition2.type.kind !== "NonNullType"
|
|
@@ -58894,16 +59263,16 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
58894
59263
|
);
|
|
58895
59264
|
} else {
|
|
58896
59265
|
body.push(
|
|
58897
|
-
|
|
58898
|
-
|
|
59266
|
+
AST12.exportNamedDeclaration(
|
|
59267
|
+
AST12.tsTypeAliasDeclaration(AST12.identifier(inputTypeName), AST12.tsNullKeyword())
|
|
58899
59268
|
)
|
|
58900
59269
|
);
|
|
58901
59270
|
}
|
|
58902
59271
|
if (definition.operation === "mutation") {
|
|
58903
59272
|
body.push(
|
|
58904
|
-
|
|
58905
|
-
|
|
58906
|
-
|
|
59273
|
+
AST12.exportNamedDeclaration(
|
|
59274
|
+
AST12.tsTypeAliasDeclaration(
|
|
59275
|
+
AST12.identifier(optimisticTypeName),
|
|
58907
59276
|
inlineType({
|
|
58908
59277
|
config: config2,
|
|
58909
59278
|
filepath,
|
|
@@ -58934,28 +59303,28 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
58934
59303
|
throw new Error("Should not get here");
|
|
58935
59304
|
}
|
|
58936
59305
|
body.push(
|
|
58937
|
-
|
|
58938
|
-
|
|
58939
|
-
|
|
58940
|
-
|
|
59306
|
+
AST12.exportNamedDeclaration(
|
|
59307
|
+
AST12.tsTypeAliasDeclaration(
|
|
59308
|
+
AST12.identifier(propTypeName),
|
|
59309
|
+
AST12.tsTypeLiteral([
|
|
58941
59310
|
readonlyProperty(
|
|
58942
|
-
|
|
58943
|
-
|
|
58944
|
-
|
|
58945
|
-
|
|
59311
|
+
AST12.tsPropertySignature(
|
|
59312
|
+
AST12.stringLiteral("shape"),
|
|
59313
|
+
AST12.tsTypeAnnotation(
|
|
59314
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName))
|
|
58946
59315
|
),
|
|
58947
59316
|
true
|
|
58948
59317
|
)
|
|
58949
59318
|
),
|
|
58950
59319
|
readonlyProperty(
|
|
58951
|
-
|
|
58952
|
-
|
|
58953
|
-
|
|
58954
|
-
|
|
58955
|
-
|
|
58956
|
-
|
|
58957
|
-
|
|
58958
|
-
|
|
59320
|
+
AST12.tsPropertySignature(
|
|
59321
|
+
AST12.stringLiteral(fragmentKey),
|
|
59322
|
+
AST12.tsTypeAnnotation(
|
|
59323
|
+
AST12.tsTypeLiteral([
|
|
59324
|
+
AST12.tsPropertySignature(
|
|
59325
|
+
AST12.stringLiteral(propTypeName),
|
|
59326
|
+
AST12.tsTypeAnnotation(
|
|
59327
|
+
AST12.tsLiteralType(AST12.booleanLiteral(true))
|
|
58959
59328
|
)
|
|
58960
59329
|
)
|
|
58961
59330
|
])
|
|
@@ -58965,9 +59334,9 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
58965
59334
|
])
|
|
58966
59335
|
)
|
|
58967
59336
|
),
|
|
58968
|
-
|
|
58969
|
-
|
|
58970
|
-
|
|
59337
|
+
AST12.exportNamedDeclaration(
|
|
59338
|
+
AST12.tsTypeAliasDeclaration(
|
|
59339
|
+
AST12.identifier(shapeTypeName),
|
|
58971
59340
|
inlineType({
|
|
58972
59341
|
config: config2,
|
|
58973
59342
|
filepath,
|
|
@@ -58987,7 +59356,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
58987
59356
|
}
|
|
58988
59357
|
|
|
58989
59358
|
// src/codegen/generators/persistedQueries/index.ts
|
|
58990
|
-
var
|
|
59359
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
58991
59360
|
async function persistOutputGenerator(config2, docs) {
|
|
58992
59361
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
58993
59362
|
return;
|
|
@@ -58999,8 +59368,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
58999
59368
|
if (!generateArtifact) {
|
|
59000
59369
|
return acc;
|
|
59001
59370
|
}
|
|
59002
|
-
let rawString =
|
|
59003
|
-
|
|
59371
|
+
let rawString = graphql18.print(
|
|
59372
|
+
graphql18.visit(document, {
|
|
59004
59373
|
Directive(node) {
|
|
59005
59374
|
if (config2.isInternalDirective(node)) {
|
|
59006
59375
|
return null;
|
|
@@ -59009,7 +59378,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59009
59378
|
})
|
|
59010
59379
|
);
|
|
59011
59380
|
const operations = document.definitions.filter(
|
|
59012
|
-
({ kind }) => kind ===
|
|
59381
|
+
({ kind }) => kind === graphql18.Kind.OPERATION_DEFINITION
|
|
59013
59382
|
);
|
|
59014
59383
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
59015
59384
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -59022,26 +59391,26 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59022
59391
|
}
|
|
59023
59392
|
|
|
59024
59393
|
// src/codegen/generators/definitions/enums.ts
|
|
59025
|
-
var
|
|
59026
|
-
var
|
|
59027
|
-
var
|
|
59394
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
59395
|
+
var recast13 = __toESM(require_main2(), 1);
|
|
59396
|
+
var AST13 = recast13.types.builders;
|
|
59028
59397
|
async function definitionsGenerator(config2) {
|
|
59029
|
-
const enums =
|
|
59398
|
+
const enums = graphql19.parse(graphql19.printSchema(config2.schema)).definitions.filter(
|
|
59030
59399
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
59031
59400
|
).filter((def) => !config2.isInternalEnum(def));
|
|
59032
|
-
const runtimeDefinitions =
|
|
59033
|
-
|
|
59401
|
+
const runtimeDefinitions = recast13.print(
|
|
59402
|
+
AST13.program(
|
|
59034
59403
|
enums.map((defn) => {
|
|
59035
59404
|
const name2 = defn.name.value;
|
|
59036
59405
|
return moduleExport(
|
|
59037
59406
|
config2,
|
|
59038
59407
|
name2,
|
|
59039
|
-
|
|
59408
|
+
AST13.objectExpression(
|
|
59040
59409
|
defn.values?.map((value) => {
|
|
59041
59410
|
const str = value.name.value;
|
|
59042
|
-
return
|
|
59043
|
-
|
|
59044
|
-
|
|
59411
|
+
return AST13.objectProperty(
|
|
59412
|
+
AST13.stringLiteral(str),
|
|
59413
|
+
AST13.stringLiteral(str)
|
|
59045
59414
|
);
|
|
59046
59415
|
}) || []
|
|
59047
59416
|
)
|
|
@@ -59049,7 +59418,7 @@ async function definitionsGenerator(config2) {
|
|
|
59049
59418
|
})
|
|
59050
59419
|
)
|
|
59051
59420
|
).code;
|
|
59052
|
-
const
|
|
59421
|
+
const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
|
|
59053
59422
|
(definition) => `
|
|
59054
59423
|
export declare enum ${definition.name.value} {
|
|
59055
59424
|
${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
|
|
@@ -59060,7 +59429,7 @@ ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.val
|
|
|
59060
59429
|
export * from './enums.js'
|
|
59061
59430
|
`;
|
|
59062
59431
|
await Promise.all([
|
|
59063
|
-
fs_exports.writeFile(config2.enumTypesDefinitionsPath,
|
|
59432
|
+
fs_exports.writeFile(config2.enumTypesDefinitionsPath, typeDefinitions2),
|
|
59064
59433
|
fs_exports.writeFile(config2.enumRuntimeDefinitionsPath, runtimeDefinitions),
|
|
59065
59434
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.js"), definitionsIndex),
|
|
59066
59435
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.d.ts"), definitionsIndex)
|
|
@@ -59199,7 +59568,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59199
59568
|
}
|
|
59200
59569
|
|
|
59201
59570
|
// src/codegen/transforms/schema.ts
|
|
59202
|
-
var
|
|
59571
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
59203
59572
|
async function graphqlExtensions(config2, documents) {
|
|
59204
59573
|
const internalSchema = `
|
|
59205
59574
|
enum CachePolicy {
|
|
@@ -59277,19 +59646,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59277
59646
|
"""
|
|
59278
59647
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59279
59648
|
`;
|
|
59280
|
-
let currentSchema =
|
|
59649
|
+
let currentSchema = graphql21.printSchema(config2.schema);
|
|
59281
59650
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59282
59651
|
currentSchema += internalSchema;
|
|
59283
59652
|
}
|
|
59284
59653
|
config2.newSchema += internalSchema;
|
|
59285
|
-
config2.schema =
|
|
59654
|
+
config2.schema = graphql21.buildSchema(currentSchema);
|
|
59286
59655
|
}
|
|
59287
59656
|
|
|
59288
59657
|
// src/codegen/transforms/typename.ts
|
|
59289
|
-
var
|
|
59658
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
59290
59659
|
async function addTypename(config2, documents) {
|
|
59291
59660
|
for (const doc of documents) {
|
|
59292
|
-
doc.document =
|
|
59661
|
+
doc.document = graphql22.visit(doc.document, {
|
|
59293
59662
|
Field(node, key, parent, path2, ancestors) {
|
|
59294
59663
|
if (!node.selectionSet) {
|
|
59295
59664
|
return;
|
|
@@ -59301,7 +59670,7 @@ async function addTypename(config2, documents) {
|
|
|
59301
59670
|
);
|
|
59302
59671
|
const field = type.getFields()[node.name.value];
|
|
59303
59672
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59304
|
-
if (
|
|
59673
|
+
if (graphql22.isInterfaceType(fieldType) || graphql22.isUnionType(fieldType)) {
|
|
59305
59674
|
return {
|
|
59306
59675
|
...node,
|
|
59307
59676
|
selectionSet: {
|
|
@@ -59309,9 +59678,9 @@ async function addTypename(config2, documents) {
|
|
|
59309
59678
|
selections: [
|
|
59310
59679
|
...node.selectionSet.selections,
|
|
59311
59680
|
{
|
|
59312
|
-
kind:
|
|
59681
|
+
kind: graphql22.Kind.FIELD,
|
|
59313
59682
|
name: {
|
|
59314
|
-
kind:
|
|
59683
|
+
kind: graphql22.Kind.NAME,
|
|
59315
59684
|
value: "__typename"
|
|
59316
59685
|
}
|
|
59317
59686
|
}
|
|
@@ -59325,10 +59694,10 @@ async function addTypename(config2, documents) {
|
|
|
59325
59694
|
}
|
|
59326
59695
|
|
|
59327
59696
|
// src/codegen/transforms/addID.ts
|
|
59328
|
-
var
|
|
59697
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
59329
59698
|
async function addID(config2, documents) {
|
|
59330
59699
|
for (const doc of documents) {
|
|
59331
|
-
doc.document =
|
|
59700
|
+
doc.document = graphql23.visit(doc.document, {
|
|
59332
59701
|
Field(node, key, parent, path2, ancestors) {
|
|
59333
59702
|
if (!node.selectionSet) {
|
|
59334
59703
|
return;
|
|
@@ -59341,7 +59710,7 @@ async function addID(config2, documents) {
|
|
|
59341
59710
|
const field = type.getFields()[node.name.value];
|
|
59342
59711
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59343
59712
|
if (node.selectionSet?.selections.length > 0) {
|
|
59344
|
-
if (!
|
|
59713
|
+
if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
|
|
59345
59714
|
return;
|
|
59346
59715
|
}
|
|
59347
59716
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -59356,9 +59725,9 @@ async function addID(config2, documents) {
|
|
|
59356
59725
|
continue;
|
|
59357
59726
|
}
|
|
59358
59727
|
selections.push({
|
|
59359
|
-
kind:
|
|
59728
|
+
kind: graphql23.Kind.FIELD,
|
|
59360
59729
|
name: {
|
|
59361
|
-
kind:
|
|
59730
|
+
kind: graphql23.Kind.NAME,
|
|
59362
59731
|
value: keyField
|
|
59363
59732
|
}
|
|
59364
59733
|
});
|
|
@@ -59377,8 +59746,8 @@ async function addID(config2, documents) {
|
|
|
59377
59746
|
}
|
|
59378
59747
|
|
|
59379
59748
|
// src/codegen/transforms/fragmentVariables.ts
|
|
59380
|
-
var
|
|
59381
|
-
var GraphqlKinds2 =
|
|
59749
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
59750
|
+
var GraphqlKinds2 = graphql24.Kind;
|
|
59382
59751
|
async function fragmentVariables(config2, documents) {
|
|
59383
59752
|
const fragments = collectFragments(config2, documents);
|
|
59384
59753
|
const generatedFragments = {};
|
|
@@ -59401,7 +59770,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
59401
59770
|
});
|
|
59402
59771
|
}
|
|
59403
59772
|
const doc = {
|
|
59404
|
-
kind:
|
|
59773
|
+
kind: graphql24.Kind.DOCUMENT,
|
|
59405
59774
|
definitions: Object.values(generatedFragments)
|
|
59406
59775
|
};
|
|
59407
59776
|
documents.push({
|
|
@@ -59437,7 +59806,7 @@ function inlineFragmentArgs({
|
|
|
59437
59806
|
filepath,
|
|
59438
59807
|
document
|
|
59439
59808
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
59440
|
-
const result =
|
|
59809
|
+
const result = graphql24.visit(document, {
|
|
59441
59810
|
FragmentSpread(node) {
|
|
59442
59811
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
59443
59812
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -59525,7 +59894,7 @@ function inlineFragmentArgs({
|
|
|
59525
59894
|
});
|
|
59526
59895
|
if (newName) {
|
|
59527
59896
|
result.name = {
|
|
59528
|
-
kind:
|
|
59897
|
+
kind: graphql24.Kind.NAME,
|
|
59529
59898
|
value: newName
|
|
59530
59899
|
};
|
|
59531
59900
|
}
|
|
@@ -59637,7 +60006,7 @@ function operationScope(operation) {
|
|
|
59637
60006
|
}
|
|
59638
60007
|
|
|
59639
60008
|
// src/codegen/validators/typeCheck.ts
|
|
59640
|
-
var
|
|
60009
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
59641
60010
|
async function typeCheck(config2, docs) {
|
|
59642
60011
|
const errors = [];
|
|
59643
60012
|
const freeLists = [];
|
|
@@ -59645,11 +60014,11 @@ async function typeCheck(config2, docs) {
|
|
|
59645
60014
|
const listTypes = [];
|
|
59646
60015
|
const fragments = {};
|
|
59647
60016
|
for (const { document: parsed, filename } of docs) {
|
|
59648
|
-
|
|
59649
|
-
[
|
|
60017
|
+
graphql25.visit(parsed, {
|
|
60018
|
+
[graphql25.Kind.FRAGMENT_DEFINITION](definition) {
|
|
59650
60019
|
fragments[definition.name.value] = definition;
|
|
59651
60020
|
},
|
|
59652
|
-
[
|
|
60021
|
+
[graphql25.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
59653
60022
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
59654
60023
|
return;
|
|
59655
60024
|
}
|
|
@@ -59695,14 +60064,14 @@ async function typeCheck(config2, docs) {
|
|
|
59695
60064
|
);
|
|
59696
60065
|
return;
|
|
59697
60066
|
}
|
|
59698
|
-
if (
|
|
60067
|
+
if (graphql25.isListType(rootType) || graphql25.isNonNullType(rootType) && graphql25.isListType(rootType.ofType)) {
|
|
59699
60068
|
needsParent = true;
|
|
59700
60069
|
break;
|
|
59701
60070
|
}
|
|
59702
|
-
if (
|
|
60071
|
+
if (graphql25.isNonNullType(rootType) && "ofType" in rootType) {
|
|
59703
60072
|
rootType = rootType.ofType;
|
|
59704
60073
|
}
|
|
59705
|
-
if (
|
|
60074
|
+
if (graphql25.isScalarType(rootType)) {
|
|
59706
60075
|
break;
|
|
59707
60076
|
}
|
|
59708
60077
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -59758,7 +60127,7 @@ async function typeCheck(config2, docs) {
|
|
|
59758
60127
|
);
|
|
59759
60128
|
const targetField = ancestors[ancestors.length - 1];
|
|
59760
60129
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
59761
|
-
const { type, error } = connectionSelection(
|
|
60130
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
59762
60131
|
config2,
|
|
59763
60132
|
targetFieldDefinition,
|
|
59764
60133
|
parentTypeFromAncestors(
|
|
@@ -59768,10 +60137,19 @@ async function typeCheck(config2, docs) {
|
|
|
59768
60137
|
),
|
|
59769
60138
|
targetField.selectionSet
|
|
59770
60139
|
);
|
|
60140
|
+
if (errorConnectionSelection && directive.name.value === config2.paginateDirective) {
|
|
60141
|
+
errors.push(
|
|
60142
|
+
new HoudiniError({
|
|
60143
|
+
filepath: filename,
|
|
60144
|
+
message: errorConnectionSelection,
|
|
60145
|
+
description: errorConnectionSelection
|
|
60146
|
+
})
|
|
60147
|
+
);
|
|
60148
|
+
}
|
|
59771
60149
|
let targetTypes = [type];
|
|
59772
|
-
if (
|
|
60150
|
+
if (graphql25.isUnionType(type)) {
|
|
59773
60151
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
59774
|
-
} else if (
|
|
60152
|
+
} else if (graphql25.isInterfaceType(type)) {
|
|
59775
60153
|
try {
|
|
59776
60154
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
59777
60155
|
if (!type.getFields()[key]) {
|
|
@@ -59785,23 +60163,16 @@ async function typeCheck(config2, docs) {
|
|
|
59785
60163
|
for (const targetType of targetTypes) {
|
|
59786
60164
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
59787
60165
|
if (missingIDFields.length > 0) {
|
|
59788
|
-
|
|
59789
|
-
|
|
59790
|
-
|
|
59791
|
-
|
|
59792
|
-
|
|
59793
|
-
|
|
59794
|
-
|
|
59795
|
-
|
|
59796
|
-
|
|
59797
|
-
|
|
59798
|
-
filepath: filename,
|
|
59799
|
-
message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
59800
|
-
", "
|
|
59801
|
-
)}.`
|
|
59802
|
-
})
|
|
59803
|
-
);
|
|
59804
|
-
}
|
|
60166
|
+
const message = `@${config2.listDirective} on ${logGreen(
|
|
60167
|
+
targetType.name
|
|
60168
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
60169
|
+
errors.push(
|
|
60170
|
+
new HoudiniError({
|
|
60171
|
+
filepath: filename,
|
|
60172
|
+
message,
|
|
60173
|
+
description: message
|
|
60174
|
+
})
|
|
60175
|
+
);
|
|
59805
60176
|
return;
|
|
59806
60177
|
}
|
|
59807
60178
|
}
|
|
@@ -59816,13 +60187,13 @@ async function typeCheck(config2, docs) {
|
|
|
59816
60187
|
if (errors.length > 0) {
|
|
59817
60188
|
throw errors;
|
|
59818
60189
|
}
|
|
59819
|
-
const rules = (filepath) => [...
|
|
60190
|
+
const rules = (filepath) => [...graphql25.specifiedRules].filter(
|
|
59820
60191
|
(rule) => ![
|
|
59821
|
-
|
|
59822
|
-
|
|
59823
|
-
|
|
59824
|
-
|
|
59825
|
-
|
|
60192
|
+
graphql25.NoUnusedFragmentsRule,
|
|
60193
|
+
graphql25.KnownFragmentNamesRule,
|
|
60194
|
+
graphql25.ExecutableDefinitionsRule,
|
|
60195
|
+
graphql25.KnownDirectivesRule,
|
|
60196
|
+
graphql25.KnownArgumentNamesRule
|
|
59826
60197
|
].includes(rule)
|
|
59827
60198
|
).concat(
|
|
59828
60199
|
validateLists({
|
|
@@ -59841,7 +60212,7 @@ async function typeCheck(config2, docs) {
|
|
|
59841
60212
|
noUnusedFragmentArguments(config2)
|
|
59842
60213
|
);
|
|
59843
60214
|
for (const { filename, document: parsed } of docs) {
|
|
59844
|
-
for (const error of
|
|
60215
|
+
for (const error of graphql25.validate(config2.schema, parsed, rules(filename))) {
|
|
59845
60216
|
errors.push(
|
|
59846
60217
|
new HoudiniError({
|
|
59847
60218
|
filepath: filename,
|
|
@@ -59867,7 +60238,7 @@ var validateLists = ({
|
|
|
59867
60238
|
if (!config2.isListFragment(node.name.value)) {
|
|
59868
60239
|
if (!fragments[node.name.value]) {
|
|
59869
60240
|
ctx.reportError(
|
|
59870
|
-
new
|
|
60241
|
+
new graphql25.GraphQLError(
|
|
59871
60242
|
"Encountered unknown fragment: " + node.name.value
|
|
59872
60243
|
)
|
|
59873
60244
|
);
|
|
@@ -59877,7 +60248,7 @@ var validateLists = ({
|
|
|
59877
60248
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
59878
60249
|
if (!lists.includes(listName)) {
|
|
59879
60250
|
ctx.reportError(
|
|
59880
|
-
new
|
|
60251
|
+
new graphql25.GraphQLError(
|
|
59881
60252
|
"Encountered fragment referencing unknown list: " + listName
|
|
59882
60253
|
)
|
|
59883
60254
|
);
|
|
@@ -59902,7 +60273,7 @@ var validateLists = ({
|
|
|
59902
60273
|
);
|
|
59903
60274
|
if (parentArg) {
|
|
59904
60275
|
ctx.reportError(
|
|
59905
|
-
new
|
|
60276
|
+
new graphql25.GraphQLError(
|
|
59906
60277
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
59907
60278
|
)
|
|
59908
60279
|
);
|
|
@@ -59918,7 +60289,7 @@ var validateLists = ({
|
|
|
59918
60289
|
return;
|
|
59919
60290
|
}
|
|
59920
60291
|
ctx.reportError(
|
|
59921
|
-
new
|
|
60292
|
+
new graphql25.GraphQLError(
|
|
59922
60293
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
59923
60294
|
)
|
|
59924
60295
|
);
|
|
@@ -59928,7 +60299,7 @@ var validateLists = ({
|
|
|
59928
60299
|
const directiveName = node.name.value;
|
|
59929
60300
|
if (directiveName === "connection") {
|
|
59930
60301
|
ctx.reportError(
|
|
59931
|
-
new
|
|
60302
|
+
new graphql25.GraphQLError(
|
|
59932
60303
|
"@connection was renamed to @list. Please change your components. If you were using `cache.connection` in your components, you will need to update that to `cache.list` too."
|
|
59933
60304
|
)
|
|
59934
60305
|
);
|
|
@@ -59937,7 +60308,7 @@ var validateLists = ({
|
|
|
59937
60308
|
if (!config2.isInternalDirective(node)) {
|
|
59938
60309
|
if (!config2.schema.getDirective(directiveName)) {
|
|
59939
60310
|
ctx.reportError(
|
|
59940
|
-
new
|
|
60311
|
+
new graphql25.GraphQLError(
|
|
59941
60312
|
"Encountered unknown directive: " + directiveName
|
|
59942
60313
|
)
|
|
59943
60314
|
);
|
|
@@ -59946,7 +60317,7 @@ var validateLists = ({
|
|
|
59946
60317
|
}
|
|
59947
60318
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
59948
60319
|
ctx.reportError(
|
|
59949
|
-
new
|
|
60320
|
+
new graphql25.GraphQLError(
|
|
59950
60321
|
"Encountered directive referencing unknown list: " + directiveName
|
|
59951
60322
|
)
|
|
59952
60323
|
);
|
|
@@ -59957,7 +60328,7 @@ var validateLists = ({
|
|
|
59957
60328
|
};
|
|
59958
60329
|
function knownArguments(config2) {
|
|
59959
60330
|
return function(ctx) {
|
|
59960
|
-
const nativeValidator =
|
|
60331
|
+
const nativeValidator = graphql25.KnownArgumentNamesRule(ctx);
|
|
59961
60332
|
return {
|
|
59962
60333
|
...nativeValidator,
|
|
59963
60334
|
Directive(directiveNode) {
|
|
@@ -59990,7 +60361,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
59990
60361
|
for (const arg of node.arguments || []) {
|
|
59991
60362
|
if (arg.value.kind !== "ObjectValue") {
|
|
59992
60363
|
ctx.reportError(
|
|
59993
|
-
new
|
|
60364
|
+
new graphql25.GraphQLError("values in @arguments must be an object")
|
|
59994
60365
|
);
|
|
59995
60366
|
return;
|
|
59996
60367
|
}
|
|
@@ -60000,13 +60371,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60000
60371
|
);
|
|
60001
60372
|
if (!typeArg) {
|
|
60002
60373
|
ctx.reportError(
|
|
60003
|
-
new
|
|
60374
|
+
new graphql25.GraphQLError("missing type field for @arguments directive")
|
|
60004
60375
|
);
|
|
60005
60376
|
return;
|
|
60006
60377
|
}
|
|
60007
|
-
if (typeArg.value.kind !==
|
|
60378
|
+
if (typeArg.value.kind !== graphql25.Kind.STRING) {
|
|
60008
60379
|
ctx.reportError(
|
|
60009
|
-
new
|
|
60380
|
+
new graphql25.GraphQLError("type field to @arguments must be a string")
|
|
60010
60381
|
);
|
|
60011
60382
|
return;
|
|
60012
60383
|
}
|
|
@@ -60019,7 +60390,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60019
60390
|
);
|
|
60020
60391
|
if (typeArg.value.value !== defaultValueType) {
|
|
60021
60392
|
ctx.reportError(
|
|
60022
|
-
new
|
|
60393
|
+
new graphql25.GraphQLError(
|
|
60023
60394
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60024
60395
|
)
|
|
60025
60396
|
);
|
|
@@ -60037,7 +60408,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60037
60408
|
try {
|
|
60038
60409
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60039
60410
|
} catch (e) {
|
|
60040
|
-
ctx.reportError(new
|
|
60411
|
+
ctx.reportError(new graphql25.GraphQLError(e.message));
|
|
60041
60412
|
return;
|
|
60042
60413
|
}
|
|
60043
60414
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60060,7 +60431,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60060
60431
|
);
|
|
60061
60432
|
if (missing.length > 0) {
|
|
60062
60433
|
ctx.reportError(
|
|
60063
|
-
new
|
|
60434
|
+
new graphql25.GraphQLError(
|
|
60064
60435
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60065
60436
|
)
|
|
60066
60437
|
);
|
|
@@ -60071,7 +60442,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60071
60442
|
);
|
|
60072
60443
|
if (unknown.length > 0) {
|
|
60073
60444
|
ctx.reportError(
|
|
60074
|
-
new
|
|
60445
|
+
new graphql25.GraphQLError(
|
|
60075
60446
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60076
60447
|
)
|
|
60077
60448
|
);
|
|
@@ -60083,7 +60454,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60083
60454
|
]
|
|
60084
60455
|
);
|
|
60085
60456
|
for (const [applied, target] of zipped) {
|
|
60086
|
-
if (applied.value.kind ===
|
|
60457
|
+
if (applied.value.kind === graphql25.Kind.VARIABLE || applied.value.kind === graphql25.Kind.LIST || applied.value.kind === graphql25.Kind.OBJECT) {
|
|
60087
60458
|
continue;
|
|
60088
60459
|
}
|
|
60089
60460
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60092,7 +60463,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60092
60463
|
);
|
|
60093
60464
|
if (appliedType !== target) {
|
|
60094
60465
|
ctx.reportError(
|
|
60095
|
-
new
|
|
60466
|
+
new graphql25.GraphQLError(
|
|
60096
60467
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60097
60468
|
)
|
|
60098
60469
|
);
|
|
@@ -60113,7 +60484,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60113
60484
|
}
|
|
60114
60485
|
if (alreadyPaginated) {
|
|
60115
60486
|
ctx.reportError(
|
|
60116
|
-
new
|
|
60487
|
+
new graphql25.GraphQLError(
|
|
60117
60488
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60118
60489
|
)
|
|
60119
60490
|
);
|
|
@@ -60128,7 +60499,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60128
60499
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60129
60500
|
if (hasRequiredArgs) {
|
|
60130
60501
|
ctx.reportError(
|
|
60131
|
-
new
|
|
60502
|
+
new graphql25.GraphQLError(
|
|
60132
60503
|
"@paginate cannot appear on a document with required args"
|
|
60133
60504
|
)
|
|
60134
60505
|
);
|
|
@@ -60160,14 +60531,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60160
60531
|
const backwards = appliedArgs.has("last");
|
|
60161
60532
|
if (!forward && !backwards) {
|
|
60162
60533
|
ctx.reportError(
|
|
60163
|
-
new
|
|
60534
|
+
new graphql25.GraphQLError(
|
|
60164
60535
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60165
60536
|
)
|
|
60166
60537
|
);
|
|
60167
60538
|
}
|
|
60168
60539
|
if (forward && backwards) {
|
|
60169
60540
|
ctx.reportError(
|
|
60170
|
-
new
|
|
60541
|
+
new graphql25.GraphQLError(
|
|
60171
60542
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60172
60543
|
)
|
|
60173
60544
|
);
|
|
@@ -60181,7 +60552,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60181
60552
|
);
|
|
60182
60553
|
if (!appliedLimitArg) {
|
|
60183
60554
|
ctx.reportError(
|
|
60184
|
-
new
|
|
60555
|
+
new graphql25.GraphQLError(
|
|
60185
60556
|
"A field with offset-based pagination must have a limit argument"
|
|
60186
60557
|
)
|
|
60187
60558
|
);
|
|
@@ -60197,20 +60568,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60197
60568
|
const args = /* @__PURE__ */ new Set();
|
|
60198
60569
|
return {
|
|
60199
60570
|
enter(node) {
|
|
60200
|
-
if (node.kind ===
|
|
60571
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
60201
60572
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60202
60573
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60203
60574
|
args.add(arg);
|
|
60204
60575
|
}
|
|
60205
|
-
} else if (node.kind ===
|
|
60576
|
+
} else if (node.kind === graphql25.Kind.VARIABLE) {
|
|
60206
60577
|
args.delete(node.name.value);
|
|
60207
60578
|
}
|
|
60208
60579
|
},
|
|
60209
60580
|
leave(node) {
|
|
60210
|
-
if (node.kind ===
|
|
60581
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
60211
60582
|
if (args.size > 0) {
|
|
60212
60583
|
ctx.reportError(
|
|
60213
|
-
new
|
|
60584
|
+
new graphql25.GraphQLError(
|
|
60214
60585
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60215
60586
|
)
|
|
60216
60587
|
);
|
|
@@ -60246,7 +60617,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60246
60617
|
if (definition.kind === "OperationDefinition") {
|
|
60247
60618
|
if (definition.operation !== "query") {
|
|
60248
60619
|
ctx.reportError(
|
|
60249
|
-
new
|
|
60620
|
+
new graphql25.GraphQLError(
|
|
60250
60621
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60251
60622
|
)
|
|
60252
60623
|
);
|
|
@@ -60258,7 +60629,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60258
60629
|
}
|
|
60259
60630
|
if (!possibleNodes.includes(definitionType)) {
|
|
60260
60631
|
ctx.reportError(
|
|
60261
|
-
new
|
|
60632
|
+
new graphql25.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60262
60633
|
);
|
|
60263
60634
|
}
|
|
60264
60635
|
}
|
|
@@ -60277,7 +60648,7 @@ function checkMutationOperation(config2) {
|
|
|
60277
60648
|
);
|
|
60278
60649
|
if (append && prepend) {
|
|
60279
60650
|
ctx.reportError(
|
|
60280
|
-
new
|
|
60651
|
+
new graphql25.GraphQLError(
|
|
60281
60652
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60282
60653
|
)
|
|
60283
60654
|
);
|
|
@@ -60291,7 +60662,7 @@ function checkMutationOperation(config2) {
|
|
|
60291
60662
|
);
|
|
60292
60663
|
if (parentId && allLists) {
|
|
60293
60664
|
ctx.reportError(
|
|
60294
|
-
new
|
|
60665
|
+
new graphql25.GraphQLError(
|
|
60295
60666
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60296
60667
|
)
|
|
60297
60668
|
);
|
|
@@ -60313,7 +60684,7 @@ function checkMaskDirective(config2) {
|
|
|
60313
60684
|
);
|
|
60314
60685
|
if (maskEnableDirective && maskDisableDirective) {
|
|
60315
60686
|
ctx.reportError(
|
|
60316
|
-
new
|
|
60687
|
+
new graphql25.GraphQLError(
|
|
60317
60688
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
60318
60689
|
)
|
|
60319
60690
|
);
|
|
@@ -60329,7 +60700,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
60329
60700
|
if (!nodeInterface) {
|
|
60330
60701
|
return null;
|
|
60331
60702
|
}
|
|
60332
|
-
if (!
|
|
60703
|
+
if (!graphql25.isInterfaceType(nodeInterface)) {
|
|
60333
60704
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
60334
60705
|
return null;
|
|
60335
60706
|
}
|
|
@@ -60427,11 +60798,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
60427
60798
|
}
|
|
60428
60799
|
|
|
60429
60800
|
// src/codegen/validators/noIDAlias.ts
|
|
60430
|
-
var
|
|
60801
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
60431
60802
|
async function noIDAlias(config2, docs) {
|
|
60432
60803
|
const errors = [];
|
|
60433
60804
|
for (const { filename, document } of docs) {
|
|
60434
|
-
|
|
60805
|
+
graphql26.visit(document, {
|
|
60435
60806
|
Field(node, _, __, ___, ancestors) {
|
|
60436
60807
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
60437
60808
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -60573,8 +60944,8 @@ async function collectDocuments(config2) {
|
|
|
60573
60944
|
}
|
|
60574
60945
|
}
|
|
60575
60946
|
}
|
|
60576
|
-
const graphql_extractor = (filepath, content) => [content];
|
|
60577
|
-
const javascript_extractor = (
|
|
60947
|
+
const graphql_extractor = (config3, filepath, content) => [content];
|
|
60948
|
+
const javascript_extractor = (fconfig, ilepath, content) => processJSFile(config2, content);
|
|
60578
60949
|
extractors[".ts"].push(javascript_extractor);
|
|
60579
60950
|
extractors[".js"].push(javascript_extractor);
|
|
60580
60951
|
extractors[".graphql"].push(graphql_extractor);
|
|
@@ -60598,7 +60969,7 @@ async function collectDocuments(config2) {
|
|
|
60598
60969
|
if (!extractor) {
|
|
60599
60970
|
continue;
|
|
60600
60971
|
}
|
|
60601
|
-
const found = await extractor(filepath, contents);
|
|
60972
|
+
const found = await extractor(config2, filepath, contents);
|
|
60602
60973
|
if (found.length > 0) {
|
|
60603
60974
|
documents.push(...found.map((document) => ({ filepath, document })));
|
|
60604
60975
|
}
|
|
@@ -60629,12 +61000,12 @@ async function processJSFile(config2, contents) {
|
|
|
60629
61000
|
return documents;
|
|
60630
61001
|
}
|
|
60631
61002
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
60632
|
-
const parsedDoc =
|
|
61003
|
+
const parsedDoc = graphql27.parse(document);
|
|
60633
61004
|
const operations = parsedDoc.definitions.filter(
|
|
60634
|
-
({ kind: kind2 }) => kind2 ===
|
|
61005
|
+
({ kind: kind2 }) => kind2 === graphql27.Kind.OPERATION_DEFINITION
|
|
60635
61006
|
);
|
|
60636
61007
|
const fragments = parsedDoc.definitions.filter(
|
|
60637
|
-
({ kind: kind2 }) => kind2 ===
|
|
61008
|
+
({ kind: kind2 }) => kind2 === graphql27.Kind.FRAGMENT_DEFINITION
|
|
60638
61009
|
);
|
|
60639
61010
|
if (operations.length > 1) {
|
|
60640
61011
|
throw new HoudiniError({
|