houdini 0.18.3 → 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 +961 -534
- package/build/cmd-esm/index.js +961 -534
- 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-cjs/index.js +861 -483
- package/build/codegen-esm/index.js +861 -483
- 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 +7 -3
- 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 +7 -3
- 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 +7 -3
- 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 +857 -466
- package/build/test-esm/index.js +857 -466
- package/build/vite-cjs/index.js +939 -527
- package/build/vite-esm/index.js +939 -527
- package/package.json +2 -2
package/build/test-esm/index.js
CHANGED
|
@@ -1977,12 +1977,12 @@ var require_parser = __commonJS({
|
|
|
1977
1977
|
return [];
|
|
1978
1978
|
}
|
|
1979
1979
|
if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) {
|
|
1980
|
-
var
|
|
1980
|
+
var types14 = [];
|
|
1981
1981
|
this.expectOptionalToken(_tokenKind.TokenKind.AMP);
|
|
1982
1982
|
do {
|
|
1983
|
-
|
|
1983
|
+
types14.push(this.parseNamedType());
|
|
1984
1984
|
} while (this.expectOptionalToken(_tokenKind.TokenKind.AMP) || this.peek(_tokenKind.TokenKind.NAME));
|
|
1985
|
-
return
|
|
1985
|
+
return types14;
|
|
1986
1986
|
}
|
|
1987
1987
|
return this.delimitedMany(_tokenKind.TokenKind.AMP, this.parseNamedType);
|
|
1988
1988
|
};
|
|
@@ -2061,13 +2061,13 @@ var require_parser = __commonJS({
|
|
|
2061
2061
|
this.expectKeyword("union");
|
|
2062
2062
|
var name2 = this.parseName();
|
|
2063
2063
|
var directives = this.parseDirectives(true);
|
|
2064
|
-
var
|
|
2064
|
+
var types14 = this.parseUnionMemberTypes();
|
|
2065
2065
|
return {
|
|
2066
2066
|
kind: _kinds.Kind.UNION_TYPE_DEFINITION,
|
|
2067
2067
|
description,
|
|
2068
2068
|
name: name2,
|
|
2069
2069
|
directives,
|
|
2070
|
-
types:
|
|
2070
|
+
types: types14,
|
|
2071
2071
|
loc: this.loc(start)
|
|
2072
2072
|
};
|
|
2073
2073
|
};
|
|
@@ -2225,15 +2225,15 @@ var require_parser = __commonJS({
|
|
|
2225
2225
|
this.expectKeyword("union");
|
|
2226
2226
|
var name2 = this.parseName();
|
|
2227
2227
|
var directives = this.parseDirectives(true);
|
|
2228
|
-
var
|
|
2229
|
-
if (directives.length === 0 &&
|
|
2228
|
+
var types14 = this.parseUnionMemberTypes();
|
|
2229
|
+
if (directives.length === 0 && types14.length === 0) {
|
|
2230
2230
|
throw this.unexpected();
|
|
2231
2231
|
}
|
|
2232
2232
|
return {
|
|
2233
2233
|
kind: _kinds.Kind.UNION_TYPE_EXTENSION,
|
|
2234
2234
|
name: name2,
|
|
2235
2235
|
directives,
|
|
2236
|
-
types:
|
|
2236
|
+
types: types14,
|
|
2237
2237
|
loc: this.loc(start)
|
|
2238
2238
|
};
|
|
2239
2239
|
};
|
|
@@ -2403,7 +2403,7 @@ var require_visitor = __commonJS({
|
|
|
2403
2403
|
Object.defineProperty(exports, "__esModule", {
|
|
2404
2404
|
value: true
|
|
2405
2405
|
});
|
|
2406
|
-
exports.visit =
|
|
2406
|
+
exports.visit = visit12;
|
|
2407
2407
|
exports.visitInParallel = visitInParallel;
|
|
2408
2408
|
exports.getVisitFn = getVisitFn;
|
|
2409
2409
|
exports.BREAK = exports.QueryDocumentKeys = void 0;
|
|
@@ -2466,7 +2466,7 @@ var require_visitor = __commonJS({
|
|
|
2466
2466
|
exports.QueryDocumentKeys = QueryDocumentKeys;
|
|
2467
2467
|
var BREAK = Object.freeze({});
|
|
2468
2468
|
exports.BREAK = BREAK;
|
|
2469
|
-
function
|
|
2469
|
+
function visit12(root, visitor) {
|
|
2470
2470
|
var visitorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : QueryDocumentKeys;
|
|
2471
2471
|
var stack = void 0;
|
|
2472
2472
|
var inArray = Array.isArray(root);
|
|
@@ -3211,8 +3211,8 @@ var require_printer = __commonJS({
|
|
|
3211
3211
|
return join2(["interface", name2, wrap("implements ", join2(interfaces, " & ")), join2(directives, " "), block(fields)], " ");
|
|
3212
3212
|
}),
|
|
3213
3213
|
UnionTypeDefinition: addDescription(function(_ref27) {
|
|
3214
|
-
var name2 = _ref27.name, directives = _ref27.directives,
|
|
3215
|
-
return join2(["union", name2, join2(directives, " "),
|
|
3214
|
+
var name2 = _ref27.name, directives = _ref27.directives, types14 = _ref27.types;
|
|
3215
|
+
return join2(["union", name2, join2(directives, " "), types14 && types14.length !== 0 ? "= " + join2(types14, " | ") : ""], " ");
|
|
3216
3216
|
}),
|
|
3217
3217
|
EnumTypeDefinition: addDescription(function(_ref28) {
|
|
3218
3218
|
var name2 = _ref28.name, directives = _ref28.directives, values = _ref28.values;
|
|
@@ -3247,8 +3247,8 @@ var require_printer = __commonJS({
|
|
|
3247
3247
|
return join2(["extend interface", name2, wrap("implements ", join2(interfaces, " & ")), join2(directives, " "), block(fields)], " ");
|
|
3248
3248
|
},
|
|
3249
3249
|
UnionTypeExtension: function UnionTypeExtension(_ref36) {
|
|
3250
|
-
var name2 = _ref36.name, directives = _ref36.directives,
|
|
3251
|
-
return join2(["extend union", name2, join2(directives, " "),
|
|
3250
|
+
var name2 = _ref36.name, directives = _ref36.directives, types14 = _ref36.types;
|
|
3251
|
+
return join2(["extend union", name2, join2(directives, " "), types14 && types14.length !== 0 ? "= " + join2(types14, " | ") : ""], " ");
|
|
3252
3252
|
},
|
|
3253
3253
|
EnumTypeExtension: function EnumTypeExtension(_ref37) {
|
|
3254
3254
|
var name2 = _ref37.name, directives = _ref37.directives, values = _ref37.values;
|
|
@@ -3344,17 +3344,17 @@ var require_definition = __commonJS({
|
|
|
3344
3344
|
});
|
|
3345
3345
|
exports.isType = isType;
|
|
3346
3346
|
exports.assertType = assertType;
|
|
3347
|
-
exports.isScalarType =
|
|
3347
|
+
exports.isScalarType = isScalarType7;
|
|
3348
3348
|
exports.assertScalarType = assertScalarType;
|
|
3349
|
-
exports.isObjectType =
|
|
3349
|
+
exports.isObjectType = isObjectType3;
|
|
3350
3350
|
exports.assertObjectType = assertObjectType;
|
|
3351
3351
|
exports.isInterfaceType = isInterfaceType6;
|
|
3352
3352
|
exports.assertInterfaceType = assertInterfaceType;
|
|
3353
3353
|
exports.isUnionType = isUnionType7;
|
|
3354
3354
|
exports.assertUnionType = assertUnionType;
|
|
3355
|
-
exports.isEnumType =
|
|
3355
|
+
exports.isEnumType = isEnumType5;
|
|
3356
3356
|
exports.assertEnumType = assertEnumType;
|
|
3357
|
-
exports.isInputObjectType =
|
|
3357
|
+
exports.isInputObjectType = isInputObjectType2;
|
|
3358
3358
|
exports.assertInputObjectType = assertInputObjectType;
|
|
3359
3359
|
exports.isListType = isListType3;
|
|
3360
3360
|
exports.assertListType = assertListType;
|
|
@@ -3368,7 +3368,7 @@ var require_definition = __commonJS({
|
|
|
3368
3368
|
exports.assertLeafType = assertLeafType;
|
|
3369
3369
|
exports.isCompositeType = isCompositeType;
|
|
3370
3370
|
exports.assertCompositeType = assertCompositeType;
|
|
3371
|
-
exports.isAbstractType =
|
|
3371
|
+
exports.isAbstractType = isAbstractType3;
|
|
3372
3372
|
exports.assertAbstractType = assertAbstractType;
|
|
3373
3373
|
exports.GraphQLList = GraphQLList2;
|
|
3374
3374
|
exports.GraphQLNonNull = GraphQLNonNull2;
|
|
@@ -3423,7 +3423,7 @@ var require_definition = __commonJS({
|
|
|
3423
3423
|
return Constructor;
|
|
3424
3424
|
}
|
|
3425
3425
|
function isType(type) {
|
|
3426
|
-
return
|
|
3426
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isInputObjectType2(type) || isListType3(type) || isNonNullType6(type);
|
|
3427
3427
|
}
|
|
3428
3428
|
function assertType(type) {
|
|
3429
3429
|
if (!isType(type)) {
|
|
@@ -3431,20 +3431,20 @@ var require_definition = __commonJS({
|
|
|
3431
3431
|
}
|
|
3432
3432
|
return type;
|
|
3433
3433
|
}
|
|
3434
|
-
function
|
|
3434
|
+
function isScalarType7(type) {
|
|
3435
3435
|
return (0, _instanceOf.default)(type, GraphQLScalarType);
|
|
3436
3436
|
}
|
|
3437
3437
|
function assertScalarType(type) {
|
|
3438
|
-
if (!
|
|
3438
|
+
if (!isScalarType7(type)) {
|
|
3439
3439
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Scalar type."));
|
|
3440
3440
|
}
|
|
3441
3441
|
return type;
|
|
3442
3442
|
}
|
|
3443
|
-
function
|
|
3443
|
+
function isObjectType3(type) {
|
|
3444
3444
|
return (0, _instanceOf.default)(type, GraphQLObjectType2);
|
|
3445
3445
|
}
|
|
3446
3446
|
function assertObjectType(type) {
|
|
3447
|
-
if (!
|
|
3447
|
+
if (!isObjectType3(type)) {
|
|
3448
3448
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Object type."));
|
|
3449
3449
|
}
|
|
3450
3450
|
return type;
|
|
@@ -3467,20 +3467,20 @@ var require_definition = __commonJS({
|
|
|
3467
3467
|
}
|
|
3468
3468
|
return type;
|
|
3469
3469
|
}
|
|
3470
|
-
function
|
|
3470
|
+
function isEnumType5(type) {
|
|
3471
3471
|
return (0, _instanceOf.default)(type, GraphQLEnumType);
|
|
3472
3472
|
}
|
|
3473
3473
|
function assertEnumType(type) {
|
|
3474
|
-
if (!
|
|
3474
|
+
if (!isEnumType5(type)) {
|
|
3475
3475
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
|
|
3476
3476
|
}
|
|
3477
3477
|
return type;
|
|
3478
3478
|
}
|
|
3479
|
-
function
|
|
3479
|
+
function isInputObjectType2(type) {
|
|
3480
3480
|
return (0, _instanceOf.default)(type, GraphQLInputObjectType);
|
|
3481
3481
|
}
|
|
3482
3482
|
function assertInputObjectType(type) {
|
|
3483
|
-
if (!
|
|
3483
|
+
if (!isInputObjectType2(type)) {
|
|
3484
3484
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Input Object type."));
|
|
3485
3485
|
}
|
|
3486
3486
|
return type;
|
|
@@ -3504,7 +3504,7 @@ var require_definition = __commonJS({
|
|
|
3504
3504
|
return type;
|
|
3505
3505
|
}
|
|
3506
3506
|
function isInputType(type) {
|
|
3507
|
-
return
|
|
3507
|
+
return isScalarType7(type) || isEnumType5(type) || isInputObjectType2(type) || isWrappingType(type) && isInputType(type.ofType);
|
|
3508
3508
|
}
|
|
3509
3509
|
function assertInputType(type) {
|
|
3510
3510
|
if (!isInputType(type)) {
|
|
@@ -3513,7 +3513,7 @@ var require_definition = __commonJS({
|
|
|
3513
3513
|
return type;
|
|
3514
3514
|
}
|
|
3515
3515
|
function isOutputType(type) {
|
|
3516
|
-
return
|
|
3516
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
3517
3517
|
}
|
|
3518
3518
|
function assertOutputType(type) {
|
|
3519
3519
|
if (!isOutputType(type)) {
|
|
@@ -3522,7 +3522,7 @@ var require_definition = __commonJS({
|
|
|
3522
3522
|
return type;
|
|
3523
3523
|
}
|
|
3524
3524
|
function isLeafType(type) {
|
|
3525
|
-
return
|
|
3525
|
+
return isScalarType7(type) || isEnumType5(type);
|
|
3526
3526
|
}
|
|
3527
3527
|
function assertLeafType(type) {
|
|
3528
3528
|
if (!isLeafType(type)) {
|
|
@@ -3531,7 +3531,7 @@ var require_definition = __commonJS({
|
|
|
3531
3531
|
return type;
|
|
3532
3532
|
}
|
|
3533
3533
|
function isCompositeType(type) {
|
|
3534
|
-
return
|
|
3534
|
+
return isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type);
|
|
3535
3535
|
}
|
|
3536
3536
|
function assertCompositeType(type) {
|
|
3537
3537
|
if (!isCompositeType(type)) {
|
|
@@ -3539,11 +3539,11 @@ var require_definition = __commonJS({
|
|
|
3539
3539
|
}
|
|
3540
3540
|
return type;
|
|
3541
3541
|
}
|
|
3542
|
-
function
|
|
3542
|
+
function isAbstractType3(type) {
|
|
3543
3543
|
return isInterfaceType6(type) || isUnionType7(type);
|
|
3544
3544
|
}
|
|
3545
3545
|
function assertAbstractType(type) {
|
|
3546
|
-
if (!
|
|
3546
|
+
if (!isAbstractType3(type)) {
|
|
3547
3547
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL abstract type."));
|
|
3548
3548
|
}
|
|
3549
3549
|
return type;
|
|
@@ -3610,7 +3610,7 @@ var require_definition = __commonJS({
|
|
|
3610
3610
|
}
|
|
3611
3611
|
}
|
|
3612
3612
|
function isNamedType(type) {
|
|
3613
|
-
return
|
|
3613
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isInputObjectType2(type);
|
|
3614
3614
|
}
|
|
3615
3615
|
function assertNamedType(type) {
|
|
3616
3616
|
if (!isNamedType(type)) {
|
|
@@ -3919,9 +3919,9 @@ var require_definition = __commonJS({
|
|
|
3919
3919
|
exports.GraphQLUnionType = GraphQLUnionType;
|
|
3920
3920
|
(0, _defineInspect.default)(GraphQLUnionType);
|
|
3921
3921
|
function defineTypes(config2) {
|
|
3922
|
-
var
|
|
3923
|
-
Array.isArray(
|
|
3924
|
-
return
|
|
3922
|
+
var types14 = resolveThunk(config2.types);
|
|
3923
|
+
Array.isArray(types14) || (0, _devAssert.default)(0, "Must provide Array of types or a function which returns such an array for Union ".concat(config2.name, "."));
|
|
3924
|
+
return types14;
|
|
3925
3925
|
}
|
|
3926
3926
|
var GraphQLEnumType = /* @__PURE__ */ function() {
|
|
3927
3927
|
function GraphQLEnumType2(config2) {
|
|
@@ -9759,7 +9759,7 @@ var require_graphql = __commonJS({
|
|
|
9759
9759
|
Object.defineProperty(exports, "__esModule", {
|
|
9760
9760
|
value: true
|
|
9761
9761
|
});
|
|
9762
|
-
exports.graphql =
|
|
9762
|
+
exports.graphql = graphql28;
|
|
9763
9763
|
exports.graphqlSync = graphqlSync;
|
|
9764
9764
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
9765
9765
|
var _parser = require_parser();
|
|
@@ -9769,7 +9769,7 @@ var require_graphql = __commonJS({
|
|
|
9769
9769
|
function _interopRequireDefault(obj) {
|
|
9770
9770
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
9771
9771
|
}
|
|
9772
|
-
function
|
|
9772
|
+
function graphql28(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
9773
9773
|
var _arguments = arguments;
|
|
9774
9774
|
return new Promise(function(resolve2) {
|
|
9775
9775
|
return resolve2(
|
|
@@ -11558,7 +11558,7 @@ var require_buildClientSchema = __commonJS({
|
|
|
11558
11558
|
return new _definition.GraphQLUnionType({
|
|
11559
11559
|
name: unionIntrospection.name,
|
|
11560
11560
|
description: unionIntrospection.description,
|
|
11561
|
-
types: function
|
|
11561
|
+
types: function types14() {
|
|
11562
11562
|
return unionIntrospection.possibleTypes.map(getObjectType);
|
|
11563
11563
|
}
|
|
11564
11564
|
});
|
|
@@ -11903,7 +11903,7 @@ var require_extendSchema = __commonJS({
|
|
|
11903
11903
|
var config2 = type.toConfig();
|
|
11904
11904
|
var extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config2.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : [];
|
|
11905
11905
|
return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, config2), {}, {
|
|
11906
|
-
types: function
|
|
11906
|
+
types: function types14() {
|
|
11907
11907
|
return [].concat(type.getTypes().map(replaceNamedType), buildUnionTypes(extensions));
|
|
11908
11908
|
},
|
|
11909
11909
|
extensionASTNodes: config2.extensionASTNodes.concat(extensions)
|
|
@@ -12051,17 +12051,17 @@ var require_extendSchema = __commonJS({
|
|
|
12051
12051
|
return interfaces;
|
|
12052
12052
|
}
|
|
12053
12053
|
function buildUnionTypes(nodes) {
|
|
12054
|
-
var
|
|
12054
|
+
var types14 = [];
|
|
12055
12055
|
for (var _i32 = 0; _i32 < nodes.length; _i32++) {
|
|
12056
12056
|
var _node$types;
|
|
12057
12057
|
var node = nodes[_i32];
|
|
12058
12058
|
var typeNodes = (_node$types = node.types) !== null && _node$types !== void 0 ? _node$types : [];
|
|
12059
12059
|
for (var _i34 = 0; _i34 < typeNodes.length; _i34++) {
|
|
12060
12060
|
var type = typeNodes[_i34];
|
|
12061
|
-
|
|
12061
|
+
types14.push(getNamedType2(type));
|
|
12062
12062
|
}
|
|
12063
12063
|
}
|
|
12064
|
-
return
|
|
12064
|
+
return types14;
|
|
12065
12065
|
}
|
|
12066
12066
|
function buildType(astNode) {
|
|
12067
12067
|
var _typeExtensionsMap$na;
|
|
@@ -12118,7 +12118,7 @@ var require_extendSchema = __commonJS({
|
|
|
12118
12118
|
return new _definition.GraphQLUnionType({
|
|
12119
12119
|
name: name3,
|
|
12120
12120
|
description,
|
|
12121
|
-
types: function
|
|
12121
|
+
types: function types14() {
|
|
12122
12122
|
return buildUnionTypes(_allNodes3);
|
|
12123
12123
|
},
|
|
12124
12124
|
astNode,
|
|
@@ -12416,7 +12416,7 @@ var require_lexicographicSortSchema = __commonJS({
|
|
|
12416
12416
|
if ((0, _definition.isUnionType)(type)) {
|
|
12417
12417
|
var _config2 = type.toConfig();
|
|
12418
12418
|
return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, _config2), {}, {
|
|
12419
|
-
types: function
|
|
12419
|
+
types: function types14() {
|
|
12420
12420
|
return sortTypes(_config2.types);
|
|
12421
12421
|
}
|
|
12422
12422
|
}));
|
|
@@ -12501,10 +12501,10 @@ var require_printSchema = __commonJS({
|
|
|
12501
12501
|
}
|
|
12502
12502
|
function printFilteredSchema(schema, directiveFilter, typeFilter, options) {
|
|
12503
12503
|
var directives = schema.getDirectives().filter(directiveFilter);
|
|
12504
|
-
var
|
|
12504
|
+
var types14 = (0, _objectValues.default)(schema.getTypeMap()).filter(typeFilter);
|
|
12505
12505
|
return [printSchemaDefinition(schema)].concat(directives.map(function(directive) {
|
|
12506
12506
|
return printDirective(directive, options);
|
|
12507
|
-
}),
|
|
12507
|
+
}), types14.map(function(type) {
|
|
12508
12508
|
return printType(type, options);
|
|
12509
12509
|
})).filter(Boolean).join("\n\n") + "\n";
|
|
12510
12510
|
}
|
|
@@ -12579,8 +12579,8 @@ var require_printSchema = __commonJS({
|
|
|
12579
12579
|
return printDescription(options, type) + "interface ".concat(type.name) + printImplementedInterfaces(type) + printFields(options, type);
|
|
12580
12580
|
}
|
|
12581
12581
|
function printUnion(type, options) {
|
|
12582
|
-
var
|
|
12583
|
-
var possibleTypes =
|
|
12582
|
+
var types14 = type.getTypes();
|
|
12583
|
+
var possibleTypes = types14.length ? " = " + types14.join(" | ") : "";
|
|
12584
12584
|
return printDescription(options, type) + "union " + type.name + possibleTypes;
|
|
12585
12585
|
}
|
|
12586
12586
|
function printEnum(type, options) {
|
|
@@ -23908,14 +23908,14 @@ var require_lib3 = __commonJS({
|
|
|
23908
23908
|
this.preserveSpace = !!preserveSpace;
|
|
23909
23909
|
}
|
|
23910
23910
|
};
|
|
23911
|
-
var
|
|
23911
|
+
var types14 = {
|
|
23912
23912
|
brace: new TokContext("{"),
|
|
23913
23913
|
j_oTag: new TokContext("<tag"),
|
|
23914
23914
|
j_cTag: new TokContext("</tag"),
|
|
23915
23915
|
j_expr: new TokContext("<tag>...</tag>", true)
|
|
23916
23916
|
};
|
|
23917
23917
|
{
|
|
23918
|
-
|
|
23918
|
+
types14.template = new TokContext("`", true);
|
|
23919
23919
|
}
|
|
23920
23920
|
var beforeExpr = true;
|
|
23921
23921
|
var startsExpr = true;
|
|
@@ -24447,17 +24447,17 @@ var require_lib3 = __commonJS({
|
|
|
24447
24447
|
context.pop();
|
|
24448
24448
|
};
|
|
24449
24449
|
tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = (context) => {
|
|
24450
|
-
context.push(
|
|
24450
|
+
context.push(types14.brace);
|
|
24451
24451
|
};
|
|
24452
24452
|
tokenTypes[22].updateContext = (context) => {
|
|
24453
|
-
if (context[context.length - 1] ===
|
|
24453
|
+
if (context[context.length - 1] === types14.template) {
|
|
24454
24454
|
context.pop();
|
|
24455
24455
|
} else {
|
|
24456
|
-
context.push(
|
|
24456
|
+
context.push(types14.template);
|
|
24457
24457
|
}
|
|
24458
24458
|
};
|
|
24459
24459
|
tokenTypes[140].updateContext = (context) => {
|
|
24460
|
-
context.push(
|
|
24460
|
+
context.push(types14.j_expr, types14.j_oTag);
|
|
24461
24461
|
};
|
|
24462
24462
|
}
|
|
24463
24463
|
var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
|
|
@@ -25098,7 +25098,7 @@ var require_lib3 = __commonJS({
|
|
|
25098
25098
|
this.lastTokEndLoc = null;
|
|
25099
25099
|
this.lastTokStartLoc = null;
|
|
25100
25100
|
this.lastTokStart = 0;
|
|
25101
|
-
this.context = [
|
|
25101
|
+
this.context = [types14.brace];
|
|
25102
25102
|
this.canStartJSXElement = true;
|
|
25103
25103
|
this.containsEsc = false;
|
|
25104
25104
|
this.firstInvalidTemplateEscapePos = null;
|
|
@@ -29022,7 +29022,7 @@ var require_lib3 = __commonJS({
|
|
|
29022
29022
|
context
|
|
29023
29023
|
} = this.state;
|
|
29024
29024
|
const currentContext = context[context.length - 1];
|
|
29025
|
-
if (currentContext ===
|
|
29025
|
+
if (currentContext === types14.j_oTag || currentContext === types14.j_expr) {
|
|
29026
29026
|
context.pop();
|
|
29027
29027
|
}
|
|
29028
29028
|
}
|
|
@@ -30082,9 +30082,9 @@ var require_lib3 = __commonJS({
|
|
|
30082
30082
|
switch (this.state.type) {
|
|
30083
30083
|
case 5:
|
|
30084
30084
|
node = this.startNode();
|
|
30085
|
-
this.setContext(
|
|
30085
|
+
this.setContext(types14.brace);
|
|
30086
30086
|
this.next();
|
|
30087
|
-
node = this.jsxParseExpressionContainer(node,
|
|
30087
|
+
node = this.jsxParseExpressionContainer(node, types14.j_oTag);
|
|
30088
30088
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
30089
30089
|
this.raise(JsxErrors.AttributeIsEmpty, {
|
|
30090
30090
|
at: node
|
|
@@ -30107,7 +30107,7 @@ var require_lib3 = __commonJS({
|
|
|
30107
30107
|
jsxParseSpreadChild(node) {
|
|
30108
30108
|
this.next();
|
|
30109
30109
|
node.expression = this.parseExpression();
|
|
30110
|
-
this.setContext(
|
|
30110
|
+
this.setContext(types14.j_expr);
|
|
30111
30111
|
this.state.canStartJSXElement = true;
|
|
30112
30112
|
this.expect(8);
|
|
30113
30113
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -30127,11 +30127,11 @@ var require_lib3 = __commonJS({
|
|
|
30127
30127
|
jsxParseAttribute() {
|
|
30128
30128
|
const node = this.startNode();
|
|
30129
30129
|
if (this.match(5)) {
|
|
30130
|
-
this.setContext(
|
|
30130
|
+
this.setContext(types14.brace);
|
|
30131
30131
|
this.next();
|
|
30132
30132
|
this.expect(21);
|
|
30133
30133
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
30134
|
-
this.setContext(
|
|
30134
|
+
this.setContext(types14.j_oTag);
|
|
30135
30135
|
this.state.canStartJSXElement = true;
|
|
30136
30136
|
this.expect(8);
|
|
30137
30137
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
@@ -30190,12 +30190,12 @@ var require_lib3 = __commonJS({
|
|
|
30190
30190
|
break;
|
|
30191
30191
|
case 5: {
|
|
30192
30192
|
const node2 = this.startNode();
|
|
30193
|
-
this.setContext(
|
|
30193
|
+
this.setContext(types14.brace);
|
|
30194
30194
|
this.next();
|
|
30195
30195
|
if (this.match(21)) {
|
|
30196
30196
|
children.push(this.jsxParseSpreadChild(node2));
|
|
30197
30197
|
} else {
|
|
30198
|
-
children.push(this.jsxParseExpressionContainer(node2,
|
|
30198
|
+
children.push(this.jsxParseExpressionContainer(node2, types14.j_expr));
|
|
30199
30199
|
}
|
|
30200
30200
|
break;
|
|
30201
30201
|
}
|
|
@@ -30266,10 +30266,10 @@ var require_lib3 = __commonJS({
|
|
|
30266
30266
|
}
|
|
30267
30267
|
getTokenFromCode(code) {
|
|
30268
30268
|
const context = this.curContext();
|
|
30269
|
-
if (context ===
|
|
30269
|
+
if (context === types14.j_expr) {
|
|
30270
30270
|
return this.jsxReadToken();
|
|
30271
30271
|
}
|
|
30272
|
-
if (context ===
|
|
30272
|
+
if (context === types14.j_oTag || context === types14.j_cTag) {
|
|
30273
30273
|
if (isIdentifierStart(code)) {
|
|
30274
30274
|
return this.jsxReadWord();
|
|
30275
30275
|
}
|
|
@@ -30277,7 +30277,7 @@ var require_lib3 = __commonJS({
|
|
|
30277
30277
|
++this.state.pos;
|
|
30278
30278
|
return this.finishToken(141);
|
|
30279
30279
|
}
|
|
30280
|
-
if ((code === 34 || code === 39) && context ===
|
|
30280
|
+
if ((code === 34 || code === 39) && context === types14.j_oTag) {
|
|
30281
30281
|
return this.jsxReadString(code);
|
|
30282
30282
|
}
|
|
30283
30283
|
}
|
|
@@ -30293,17 +30293,17 @@ var require_lib3 = __commonJS({
|
|
|
30293
30293
|
type
|
|
30294
30294
|
} = this.state;
|
|
30295
30295
|
if (type === 56 && prevType === 140) {
|
|
30296
|
-
context.splice(-2, 2,
|
|
30296
|
+
context.splice(-2, 2, types14.j_cTag);
|
|
30297
30297
|
this.state.canStartJSXElement = false;
|
|
30298
30298
|
} else if (type === 140) {
|
|
30299
|
-
context.push(
|
|
30299
|
+
context.push(types14.j_oTag);
|
|
30300
30300
|
} else if (type === 141) {
|
|
30301
30301
|
const out = context[context.length - 1];
|
|
30302
|
-
if (out ===
|
|
30302
|
+
if (out === types14.j_oTag && prevType === 56 || out === types14.j_cTag) {
|
|
30303
30303
|
context.pop();
|
|
30304
|
-
this.state.canStartJSXElement = context[context.length - 1] ===
|
|
30304
|
+
this.state.canStartJSXElement = context[context.length - 1] === types14.j_expr;
|
|
30305
30305
|
} else {
|
|
30306
|
-
this.setContext(
|
|
30306
|
+
this.setContext(types14.j_expr);
|
|
30307
30307
|
this.state.canStartJSXElement = true;
|
|
30308
30308
|
}
|
|
30309
30309
|
} else {
|
|
@@ -31310,14 +31310,14 @@ var require_lib3 = __commonJS({
|
|
|
31310
31310
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
31311
31311
|
const node = this.startNode();
|
|
31312
31312
|
const hasLeadingOperator = this.eat(operator);
|
|
31313
|
-
const
|
|
31313
|
+
const types15 = [];
|
|
31314
31314
|
do {
|
|
31315
|
-
|
|
31315
|
+
types15.push(parseConstituentType());
|
|
31316
31316
|
} while (this.eat(operator));
|
|
31317
|
-
if (
|
|
31318
|
-
return
|
|
31317
|
+
if (types15.length === 1 && !hasLeadingOperator) {
|
|
31318
|
+
return types15[0];
|
|
31319
31319
|
}
|
|
31320
|
-
node.types =
|
|
31320
|
+
node.types = types15;
|
|
31321
31321
|
return this.finishNode(node, kind);
|
|
31322
31322
|
}
|
|
31323
31323
|
tsParseIntersectionTypeOrHigher() {
|
|
@@ -32533,7 +32533,7 @@ var require_lib3 = __commonJS({
|
|
|
32533
32533
|
context
|
|
32534
32534
|
} = this.state;
|
|
32535
32535
|
const currentContext = context[context.length - 1];
|
|
32536
|
-
if (currentContext ===
|
|
32536
|
+
if (currentContext === types14.j_oTag || currentContext === types14.j_expr) {
|
|
32537
32537
|
context.pop();
|
|
32538
32538
|
}
|
|
32539
32539
|
}
|
|
@@ -38105,9 +38105,9 @@ var require_shared = __commonJS({
|
|
|
38105
38105
|
var tslib_1 = require_tslib();
|
|
38106
38106
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
38107
38107
|
function default_1(fork) {
|
|
38108
|
-
var
|
|
38109
|
-
var Type =
|
|
38110
|
-
var builtin =
|
|
38108
|
+
var types14 = fork.use(types_1.default);
|
|
38109
|
+
var Type = types14.Type;
|
|
38110
|
+
var builtin = types14.builtInTypes;
|
|
38111
38111
|
var isNumber = builtin.number;
|
|
38112
38112
|
function geq(than) {
|
|
38113
38113
|
return Type.from(function(value) {
|
|
@@ -38257,9 +38257,9 @@ var require_types = __commonJS({
|
|
|
38257
38257
|
}(BaseType);
|
|
38258
38258
|
var OrType = function(_super) {
|
|
38259
38259
|
tslib_1.__extends(OrType2, _super);
|
|
38260
|
-
function OrType2(
|
|
38260
|
+
function OrType2(types14) {
|
|
38261
38261
|
var _this = _super.call(this) || this;
|
|
38262
|
-
_this.types =
|
|
38262
|
+
_this.types = types14;
|
|
38263
38263
|
_this.kind = "OrType";
|
|
38264
38264
|
return _this;
|
|
38265
38265
|
}
|
|
@@ -38400,11 +38400,11 @@ var require_types = __commonJS({
|
|
|
38400
38400
|
function typesPlugin(_fork) {
|
|
38401
38401
|
var Type = {
|
|
38402
38402
|
or: function() {
|
|
38403
|
-
var
|
|
38403
|
+
var types14 = [];
|
|
38404
38404
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
38405
|
-
|
|
38405
|
+
types14[_i] = arguments[_i];
|
|
38406
38406
|
}
|
|
38407
|
-
return new OrType(
|
|
38407
|
+
return new OrType(types14.map(function(type) {
|
|
38408
38408
|
return Type.from(type);
|
|
38409
38409
|
}));
|
|
38410
38410
|
},
|
|
@@ -38849,9 +38849,9 @@ var require_path2 = __commonJS({
|
|
|
38849
38849
|
var Op = Object.prototype;
|
|
38850
38850
|
var hasOwn = Op.hasOwnProperty;
|
|
38851
38851
|
function pathPlugin(fork) {
|
|
38852
|
-
var
|
|
38853
|
-
var isArray =
|
|
38854
|
-
var isNumber =
|
|
38852
|
+
var types14 = fork.use(types_1.default);
|
|
38853
|
+
var isArray = types14.builtInTypes.array;
|
|
38854
|
+
var isNumber = types14.builtInTypes.number;
|
|
38855
38855
|
var Path = function Path2(value, parentPath, name2) {
|
|
38856
38856
|
if (!(this instanceof Path2)) {
|
|
38857
38857
|
throw new Error("Path constructor cannot be invoked without 'new'");
|
|
@@ -39153,13 +39153,13 @@ var require_scope = __commonJS({
|
|
|
39153
39153
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
39154
39154
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
39155
39155
|
function scopePlugin(fork) {
|
|
39156
|
-
var
|
|
39157
|
-
var Type =
|
|
39158
|
-
var namedTypes =
|
|
39156
|
+
var types14 = fork.use(types_1.default);
|
|
39157
|
+
var Type = types14.Type;
|
|
39158
|
+
var namedTypes = types14.namedTypes;
|
|
39159
39159
|
var Node = namedTypes.Node;
|
|
39160
39160
|
var Expression = namedTypes.Expression;
|
|
39161
|
-
var isArray =
|
|
39162
|
-
var b =
|
|
39161
|
+
var isArray = types14.builtInTypes.array;
|
|
39162
|
+
var b = types14.builders;
|
|
39163
39163
|
var Scope = function Scope2(path2, parentScope) {
|
|
39164
39164
|
if (!(this instanceof Scope2)) {
|
|
39165
39165
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
@@ -39222,7 +39222,7 @@ var require_scope = __commonJS({
|
|
|
39222
39222
|
++index;
|
|
39223
39223
|
}
|
|
39224
39224
|
var name2 = prefix + index;
|
|
39225
|
-
return this.bindings[name2] =
|
|
39225
|
+
return this.bindings[name2] = types14.builders.identifier(name2);
|
|
39226
39226
|
};
|
|
39227
39227
|
Sp.injectTemporary = function(identifier, init) {
|
|
39228
39228
|
identifier || (identifier = this.declareTemporary());
|
|
@@ -39298,7 +39298,7 @@ var require_scope = __commonJS({
|
|
|
39298
39298
|
bindings
|
|
39299
39299
|
);
|
|
39300
39300
|
} else if (Node.check(node) && !Expression.check(node)) {
|
|
39301
|
-
|
|
39301
|
+
types14.eachField(node, function(name2, child) {
|
|
39302
39302
|
var childPath = path2.get(name2);
|
|
39303
39303
|
if (!pathHasValue(childPath, child)) {
|
|
39304
39304
|
throw new Error("");
|
|
@@ -39376,24 +39376,24 @@ var require_scope = __commonJS({
|
|
|
39376
39376
|
addPattern(patternPath.get("argument"), bindings);
|
|
39377
39377
|
}
|
|
39378
39378
|
}
|
|
39379
|
-
function addTypePattern(patternPath,
|
|
39379
|
+
function addTypePattern(patternPath, types15) {
|
|
39380
39380
|
var pattern = patternPath.value;
|
|
39381
39381
|
namedTypes.Pattern.assert(pattern);
|
|
39382
39382
|
if (namedTypes.Identifier.check(pattern)) {
|
|
39383
|
-
if (hasOwn.call(
|
|
39384
|
-
|
|
39383
|
+
if (hasOwn.call(types15, pattern.name)) {
|
|
39384
|
+
types15[pattern.name].push(patternPath);
|
|
39385
39385
|
} else {
|
|
39386
|
-
|
|
39386
|
+
types15[pattern.name] = [patternPath];
|
|
39387
39387
|
}
|
|
39388
39388
|
}
|
|
39389
39389
|
}
|
|
39390
|
-
function addTypeParameter(parameterPath,
|
|
39390
|
+
function addTypeParameter(parameterPath, types15) {
|
|
39391
39391
|
var parameter = parameterPath.value;
|
|
39392
39392
|
FlowOrTSTypeParameterType.assert(parameter);
|
|
39393
|
-
if (hasOwn.call(
|
|
39394
|
-
|
|
39393
|
+
if (hasOwn.call(types15, parameter.name)) {
|
|
39394
|
+
types15[parameter.name].push(parameterPath);
|
|
39395
39395
|
} else {
|
|
39396
|
-
|
|
39396
|
+
types15[parameter.name] = [parameterPath];
|
|
39397
39397
|
}
|
|
39398
39398
|
}
|
|
39399
39399
|
Sp.lookup = function(name2) {
|
|
@@ -39434,11 +39434,11 @@ var require_node_path = __commonJS({
|
|
|
39434
39434
|
var scope_1 = tslib_1.__importDefault(require_scope());
|
|
39435
39435
|
var shared_1 = require_shared();
|
|
39436
39436
|
function nodePathPlugin(fork) {
|
|
39437
|
-
var
|
|
39438
|
-
var n =
|
|
39439
|
-
var b =
|
|
39440
|
-
var isNumber =
|
|
39441
|
-
var isArray =
|
|
39437
|
+
var types14 = fork.use(types_1.default);
|
|
39438
|
+
var n = types14.namedTypes;
|
|
39439
|
+
var b = types14.builders;
|
|
39440
|
+
var isNumber = types14.builtInTypes.number;
|
|
39441
|
+
var isArray = types14.builtInTypes.array;
|
|
39442
39442
|
var Path = fork.use(path_1.default);
|
|
39443
39443
|
var Scope = fork.use(scope_1.default);
|
|
39444
39444
|
var NodePath = function NodePath2(value, parentPath, name2) {
|
|
@@ -39529,7 +39529,7 @@ var require_node_path = __commonJS({
|
|
|
39529
39529
|
return scope || null;
|
|
39530
39530
|
};
|
|
39531
39531
|
NPp.getValueProperty = function(name2) {
|
|
39532
|
-
return
|
|
39532
|
+
return types14.getFieldValue(this.value, name2);
|
|
39533
39533
|
};
|
|
39534
39534
|
NPp.needsParens = function(assumeExpressionContext) {
|
|
39535
39535
|
var pp = this.parentPath;
|
|
@@ -39671,7 +39671,7 @@ var require_node_path = __commonJS({
|
|
|
39671
39671
|
return node.some(containsCallExpression);
|
|
39672
39672
|
}
|
|
39673
39673
|
if (n.Node.check(node)) {
|
|
39674
|
-
return
|
|
39674
|
+
return types14.someField(node, function(_name, child) {
|
|
39675
39675
|
return containsCallExpression(child);
|
|
39676
39676
|
});
|
|
39677
39677
|
}
|
|
@@ -39792,11 +39792,11 @@ var require_path_visitor = __commonJS({
|
|
|
39792
39792
|
var shared_1 = require_shared();
|
|
39793
39793
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
39794
39794
|
function pathVisitorPlugin(fork) {
|
|
39795
|
-
var
|
|
39795
|
+
var types14 = fork.use(types_1.default);
|
|
39796
39796
|
var NodePath = fork.use(node_path_1.default);
|
|
39797
|
-
var isArray =
|
|
39798
|
-
var isObject =
|
|
39799
|
-
var isFunction =
|
|
39797
|
+
var isArray = types14.builtInTypes.array;
|
|
39798
|
+
var isObject = types14.builtInTypes.object;
|
|
39799
|
+
var isFunction = types14.builtInTypes.function;
|
|
39800
39800
|
var undefined2;
|
|
39801
39801
|
var PathVisitor = function PathVisitor2() {
|
|
39802
39802
|
if (!(this instanceof PathVisitor2)) {
|
|
@@ -39816,7 +39816,7 @@ var require_path_visitor = __commonJS({
|
|
|
39816
39816
|
typeNames[methodName.slice("visit".length)] = true;
|
|
39817
39817
|
}
|
|
39818
39818
|
}
|
|
39819
|
-
var supertypeTable =
|
|
39819
|
+
var supertypeTable = types14.computeSupertypeLookupTable(typeNames);
|
|
39820
39820
|
var methodNameTable = /* @__PURE__ */ Object.create(null);
|
|
39821
39821
|
var typeNameKeys = Object.keys(supertypeTable);
|
|
39822
39822
|
var typeNameCount = typeNameKeys.length;
|
|
@@ -39858,7 +39858,7 @@ var require_path_visitor = __commonJS({
|
|
|
39858
39858
|
}
|
|
39859
39859
|
return target;
|
|
39860
39860
|
}
|
|
39861
|
-
PathVisitor.visit = function
|
|
39861
|
+
PathVisitor.visit = function visit12(node, methods) {
|
|
39862
39862
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
39863
39863
|
};
|
|
39864
39864
|
var PVp = PathVisitor.prototype;
|
|
@@ -39935,7 +39935,7 @@ var require_path_visitor = __commonJS({
|
|
|
39935
39935
|
path2.each(visitor.visitWithoutReset, visitor);
|
|
39936
39936
|
} else if (!isObject.check(value)) {
|
|
39937
39937
|
} else {
|
|
39938
|
-
var childNames =
|
|
39938
|
+
var childNames = types14.getFieldNames(value);
|
|
39939
39939
|
if (visitor._shouldVisitComments && value.comments && childNames.indexOf("comments") < 0) {
|
|
39940
39940
|
childNames.push("comments");
|
|
39941
39941
|
}
|
|
@@ -39944,7 +39944,7 @@ var require_path_visitor = __commonJS({
|
|
|
39944
39944
|
for (var i = 0; i < childCount; ++i) {
|
|
39945
39945
|
var childName = childNames[i];
|
|
39946
39946
|
if (!hasOwn.call(value, childName)) {
|
|
39947
|
-
value[childName] =
|
|
39947
|
+
value[childName] = types14.getFieldValue(value, childName);
|
|
39948
39948
|
}
|
|
39949
39949
|
childPaths.push(path2.get(childName));
|
|
39950
39950
|
}
|
|
@@ -40049,7 +40049,7 @@ var require_path_visitor = __commonJS({
|
|
|
40049
40049
|
this.needToCallTraverse = false;
|
|
40050
40050
|
return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
40051
40051
|
};
|
|
40052
|
-
sharedContextProtoMethods.visit = function
|
|
40052
|
+
sharedContextProtoMethods.visit = function visit12(path2, newVisitor) {
|
|
40053
40053
|
if (!(this instanceof this.Context)) {
|
|
40054
40054
|
throw new Error("");
|
|
40055
40055
|
}
|
|
@@ -40087,13 +40087,13 @@ var require_equiv = __commonJS({
|
|
|
40087
40087
|
var shared_1 = require_shared();
|
|
40088
40088
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
40089
40089
|
function default_1(fork) {
|
|
40090
|
-
var
|
|
40091
|
-
var getFieldNames =
|
|
40092
|
-
var getFieldValue =
|
|
40093
|
-
var isArray =
|
|
40094
|
-
var isObject =
|
|
40095
|
-
var isDate =
|
|
40096
|
-
var isRegExp =
|
|
40090
|
+
var types14 = fork.use(types_1.default);
|
|
40091
|
+
var getFieldNames = types14.getFieldNames;
|
|
40092
|
+
var getFieldValue = types14.getFieldValue;
|
|
40093
|
+
var isArray = types14.builtInTypes.array;
|
|
40094
|
+
var isObject = types14.builtInTypes.object;
|
|
40095
|
+
var isDate = types14.builtInTypes.Date;
|
|
40096
|
+
var isRegExp = types14.builtInTypes.RegExp;
|
|
40097
40097
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
40098
40098
|
function astNodesAreEquivalent(a, b, problemPath) {
|
|
40099
40099
|
if (isArray.check(problemPath)) {
|
|
@@ -40246,24 +40246,24 @@ var require_fork = __commonJS({
|
|
|
40246
40246
|
var shared_1 = require_shared();
|
|
40247
40247
|
function default_1(plugins) {
|
|
40248
40248
|
var fork = createFork();
|
|
40249
|
-
var
|
|
40249
|
+
var types14 = fork.use(types_1.default);
|
|
40250
40250
|
plugins.forEach(fork.use);
|
|
40251
|
-
|
|
40251
|
+
types14.finalize();
|
|
40252
40252
|
var PathVisitor = fork.use(path_visitor_1.default);
|
|
40253
40253
|
return {
|
|
40254
|
-
Type:
|
|
40255
|
-
builtInTypes:
|
|
40256
|
-
namedTypes:
|
|
40257
|
-
builders:
|
|
40258
|
-
defineMethod:
|
|
40259
|
-
getFieldNames:
|
|
40260
|
-
getFieldValue:
|
|
40261
|
-
eachField:
|
|
40262
|
-
someField:
|
|
40263
|
-
getSupertypeNames:
|
|
40264
|
-
getBuilderName:
|
|
40254
|
+
Type: types14.Type,
|
|
40255
|
+
builtInTypes: types14.builtInTypes,
|
|
40256
|
+
namedTypes: types14.namedTypes,
|
|
40257
|
+
builders: types14.builders,
|
|
40258
|
+
defineMethod: types14.defineMethod,
|
|
40259
|
+
getFieldNames: types14.getFieldNames,
|
|
40260
|
+
getFieldValue: types14.getFieldValue,
|
|
40261
|
+
eachField: types14.eachField,
|
|
40262
|
+
someField: types14.someField,
|
|
40263
|
+
getSupertypeNames: types14.getSupertypeNames,
|
|
40264
|
+
getBuilderName: types14.getBuilderName,
|
|
40265
40265
|
astNodesAreEquivalent: fork.use(equiv_1.default),
|
|
40266
|
-
finalize:
|
|
40266
|
+
finalize: types14.finalize,
|
|
40267
40267
|
Path: fork.use(path_1.default),
|
|
40268
40268
|
NodePath: fork.use(node_path_1.default),
|
|
40269
40269
|
PathVisitor,
|
|
@@ -40433,8 +40433,8 @@ var require_core2 = __commonJS({
|
|
|
40433
40433
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
40434
40434
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40435
40435
|
function default_1(fork) {
|
|
40436
|
-
var
|
|
40437
|
-
var Type =
|
|
40436
|
+
var types14 = fork.use(types_1.default);
|
|
40437
|
+
var Type = types14.Type;
|
|
40438
40438
|
var def = Type.def;
|
|
40439
40439
|
var or = Type.or;
|
|
40440
40440
|
var shared = fork.use(shared_1.default);
|
|
@@ -40526,9 +40526,9 @@ var require_es6 = __commonJS({
|
|
|
40526
40526
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40527
40527
|
function default_1(fork) {
|
|
40528
40528
|
fork.use(core_1.default);
|
|
40529
|
-
var
|
|
40530
|
-
var def =
|
|
40531
|
-
var or =
|
|
40529
|
+
var types14 = fork.use(types_1.default);
|
|
40530
|
+
var def = types14.Type.def;
|
|
40531
|
+
var or = types14.Type.or;
|
|
40532
40532
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40533
40533
|
def("Function").field("generator", Boolean, defaults["false"]).field("expression", Boolean, defaults["false"]).field("defaults", [or(def("Expression"), null)], defaults.emptyArray).field("rest", or(def("Identifier"), null), defaults["null"]);
|
|
40534
40534
|
def("RestElement").bases("Pattern").build("argument").field("argument", def("Pattern")).field(
|
|
@@ -40618,8 +40618,8 @@ var require_es2017 = __commonJS({
|
|
|
40618
40618
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40619
40619
|
function default_1(fork) {
|
|
40620
40620
|
fork.use(es2016_1.default);
|
|
40621
|
-
var
|
|
40622
|
-
var def =
|
|
40621
|
+
var types14 = fork.use(types_1.default);
|
|
40622
|
+
var def = types14.Type.def;
|
|
40623
40623
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40624
40624
|
def("Function").field("async", Boolean, defaults["false"]);
|
|
40625
40625
|
def("AwaitExpression").bases("Expression").build("argument").field("argument", def("Expression"));
|
|
@@ -40642,9 +40642,9 @@ var require_es2018 = __commonJS({
|
|
|
40642
40642
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40643
40643
|
function default_1(fork) {
|
|
40644
40644
|
fork.use(es2017_1.default);
|
|
40645
|
-
var
|
|
40646
|
-
var def =
|
|
40647
|
-
var or =
|
|
40645
|
+
var types14 = fork.use(types_1.default);
|
|
40646
|
+
var def = types14.Type.def;
|
|
40647
|
+
var or = types14.Type.or;
|
|
40648
40648
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40649
40649
|
def("ForOfStatement").field("await", Boolean, defaults["false"]);
|
|
40650
40650
|
def("SpreadProperty").bases("Node").build("argument").field("argument", def("Expression"));
|
|
@@ -40675,9 +40675,9 @@ var require_es2019 = __commonJS({
|
|
|
40675
40675
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40676
40676
|
function default_1(fork) {
|
|
40677
40677
|
fork.use(es2018_1.default);
|
|
40678
|
-
var
|
|
40679
|
-
var def =
|
|
40680
|
-
var or =
|
|
40678
|
+
var types14 = fork.use(types_1.default);
|
|
40679
|
+
var def = types14.Type.def;
|
|
40680
|
+
var or = types14.Type.or;
|
|
40681
40681
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40682
40682
|
def("CatchClause").field("param", or(def("Pattern"), null), defaults["null"]);
|
|
40683
40683
|
}
|
|
@@ -40701,9 +40701,9 @@ var require_es20202 = __commonJS({
|
|
|
40701
40701
|
function default_1(fork) {
|
|
40702
40702
|
fork.use(es2020_1.default);
|
|
40703
40703
|
fork.use(es2019_1.default);
|
|
40704
|
-
var
|
|
40705
|
-
var def =
|
|
40706
|
-
var or =
|
|
40704
|
+
var types14 = fork.use(types_1.default);
|
|
40705
|
+
var def = types14.Type.def;
|
|
40706
|
+
var or = types14.Type.or;
|
|
40707
40707
|
var shared = fork.use(shared_1.default);
|
|
40708
40708
|
var defaults = shared.defaults;
|
|
40709
40709
|
def("ImportExpression").bases("Expression").build("source").field("source", def("Expression"));
|
|
@@ -40753,8 +40753,8 @@ var require_es2022 = __commonJS({
|
|
|
40753
40753
|
var shared_1 = require_shared();
|
|
40754
40754
|
function default_1(fork) {
|
|
40755
40755
|
fork.use(es2021_1.default);
|
|
40756
|
-
var
|
|
40757
|
-
var def =
|
|
40756
|
+
var types14 = fork.use(types_1.default);
|
|
40757
|
+
var def = types14.Type.def;
|
|
40758
40758
|
def("StaticBlock").bases("Declaration").build("body").field("body", [def("Statement")]);
|
|
40759
40759
|
}
|
|
40760
40760
|
exports.default = default_1;
|
|
@@ -40775,9 +40775,9 @@ var require_es_proposals = __commonJS({
|
|
|
40775
40775
|
var es2022_1 = tslib_1.__importDefault(require_es2022());
|
|
40776
40776
|
function default_1(fork) {
|
|
40777
40777
|
fork.use(es2022_1.default);
|
|
40778
|
-
var
|
|
40779
|
-
var Type =
|
|
40780
|
-
var def =
|
|
40778
|
+
var types14 = fork.use(types_1.default);
|
|
40779
|
+
var Type = types14.Type;
|
|
40780
|
+
var def = types14.Type.def;
|
|
40781
40781
|
var or = Type.or;
|
|
40782
40782
|
var shared = fork.use(shared_1.default);
|
|
40783
40783
|
var defaults = shared.defaults;
|
|
@@ -40817,9 +40817,9 @@ var require_jsx = __commonJS({
|
|
|
40817
40817
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40818
40818
|
function default_1(fork) {
|
|
40819
40819
|
fork.use(es_proposals_1.default);
|
|
40820
|
-
var
|
|
40821
|
-
var def =
|
|
40822
|
-
var or =
|
|
40820
|
+
var types14 = fork.use(types_1.default);
|
|
40821
|
+
var def = types14.Type.def;
|
|
40822
|
+
var or = types14.Type.or;
|
|
40823
40823
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40824
40824
|
def("JSXAttribute").bases("Node").build("name", "value").field("name", or(def("JSXIdentifier"), def("JSXNamespacedName"))).field("value", or(
|
|
40825
40825
|
def("Literal"),
|
|
@@ -40877,9 +40877,9 @@ var require_type_annotations = __commonJS({
|
|
|
40877
40877
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
40878
40878
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
40879
40879
|
function default_1(fork) {
|
|
40880
|
-
var
|
|
40881
|
-
var def =
|
|
40882
|
-
var or =
|
|
40880
|
+
var types14 = fork.use(types_1.default);
|
|
40881
|
+
var def = types14.Type.def;
|
|
40882
|
+
var or = types14.Type.or;
|
|
40883
40883
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40884
40884
|
var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
|
|
40885
40885
|
var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
|
|
@@ -40914,9 +40914,9 @@ var require_flow = __commonJS({
|
|
|
40914
40914
|
function default_1(fork) {
|
|
40915
40915
|
fork.use(es_proposals_1.default);
|
|
40916
40916
|
fork.use(type_annotations_1.default);
|
|
40917
|
-
var
|
|
40918
|
-
var def =
|
|
40919
|
-
var or =
|
|
40917
|
+
var types14 = fork.use(types_1.default);
|
|
40918
|
+
var def = types14.Type.def;
|
|
40919
|
+
var or = types14.Type.or;
|
|
40920
40920
|
var defaults = fork.use(shared_1.default).defaults;
|
|
40921
40921
|
def("Flow").bases("Node");
|
|
40922
40922
|
def("FlowType").bases("Flow");
|
|
@@ -41030,10 +41030,10 @@ var require_esprima = __commonJS({
|
|
|
41030
41030
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
41031
41031
|
function default_1(fork) {
|
|
41032
41032
|
fork.use(es_proposals_1.default);
|
|
41033
|
-
var
|
|
41033
|
+
var types14 = fork.use(types_1.default);
|
|
41034
41034
|
var defaults = fork.use(shared_1.default).defaults;
|
|
41035
|
-
var def =
|
|
41036
|
-
var or =
|
|
41035
|
+
var def = types14.Type.def;
|
|
41036
|
+
var or = types14.Type.or;
|
|
41037
41037
|
def("VariableDeclaration").field("declarations", [or(
|
|
41038
41038
|
def("VariableDeclarator"),
|
|
41039
41039
|
def("Identifier")
|
|
@@ -41078,11 +41078,11 @@ var require_babel_core = __commonJS({
|
|
|
41078
41078
|
function default_1(fork) {
|
|
41079
41079
|
var _a, _b, _c, _d, _e;
|
|
41080
41080
|
fork.use(es_proposals_1.default);
|
|
41081
|
-
var
|
|
41081
|
+
var types14 = fork.use(types_1.default);
|
|
41082
41082
|
var defaults = fork.use(shared_1.default).defaults;
|
|
41083
|
-
var def =
|
|
41084
|
-
var or =
|
|
41085
|
-
var isUndefined =
|
|
41083
|
+
var def = types14.Type.def;
|
|
41084
|
+
var or = types14.Type.or;
|
|
41085
|
+
var isUndefined = types14.builtInTypes.undefined;
|
|
41086
41086
|
def("Noop").bases("Statement").build();
|
|
41087
41087
|
def("DoExpression").bases("Expression").build("body").field("body", [def("Statement")]);
|
|
41088
41088
|
def("BindExpression").bases("Expression").build("object", "callee").field("object", or(def("Expression"), null)).field("callee", def("Expression"));
|
|
@@ -41107,7 +41107,7 @@ var require_babel_core = __commonJS({
|
|
|
41107
41107
|
raw: String
|
|
41108
41108
|
},
|
|
41109
41109
|
function getDefault() {
|
|
41110
|
-
var value =
|
|
41110
|
+
var value = types14.getFieldValue(this, "value");
|
|
41111
41111
|
return {
|
|
41112
41112
|
rawValue: value,
|
|
41113
41113
|
raw: toRaw ? toRaw(value) : String(value)
|
|
@@ -41210,8 +41210,8 @@ var require_babel = __commonJS({
|
|
|
41210
41210
|
var flow_1 = tslib_1.__importDefault(require_flow());
|
|
41211
41211
|
var shared_1 = require_shared();
|
|
41212
41212
|
function default_1(fork) {
|
|
41213
|
-
var
|
|
41214
|
-
var def =
|
|
41213
|
+
var types14 = fork.use(types_1.default);
|
|
41214
|
+
var def = types14.Type.def;
|
|
41215
41215
|
fork.use(babel_core_1.default);
|
|
41216
41216
|
fork.use(flow_1.default);
|
|
41217
41217
|
def("V8IntrinsicIdentifier").bases("Expression").build("name").field("name", String);
|
|
@@ -41237,12 +41237,12 @@ var require_typescript = __commonJS({
|
|
|
41237
41237
|
function default_1(fork) {
|
|
41238
41238
|
fork.use(babel_core_1.default);
|
|
41239
41239
|
fork.use(type_annotations_1.default);
|
|
41240
|
-
var
|
|
41241
|
-
var n =
|
|
41242
|
-
var def =
|
|
41243
|
-
var or =
|
|
41240
|
+
var types14 = fork.use(types_1.default);
|
|
41241
|
+
var n = types14.namedTypes;
|
|
41242
|
+
var def = types14.Type.def;
|
|
41243
|
+
var or = types14.Type.or;
|
|
41244
41244
|
var defaults = fork.use(shared_1.default).defaults;
|
|
41245
|
-
var StringLiteral =
|
|
41245
|
+
var StringLiteral = types14.Type.from(function(value, deep) {
|
|
41246
41246
|
if (n.StringLiteral && n.StringLiteral.check(value, deep)) {
|
|
41247
41247
|
return true;
|
|
41248
41248
|
}
|
|
@@ -41442,7 +41442,7 @@ var require_main = __commonJS({
|
|
|
41442
41442
|
var someField = _a.someField;
|
|
41443
41443
|
var Type = _a.Type;
|
|
41444
41444
|
var use = _a.use;
|
|
41445
|
-
var
|
|
41445
|
+
var visit12 = _a.visit;
|
|
41446
41446
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
41447
41447
|
exports.builders = builders;
|
|
41448
41448
|
exports.builtInTypes = builtInTypes;
|
|
@@ -41459,7 +41459,7 @@ var require_main = __commonJS({
|
|
|
41459
41459
|
exports.someField = someField;
|
|
41460
41460
|
exports.Type = Type;
|
|
41461
41461
|
exports.use = use;
|
|
41462
|
-
exports.visit =
|
|
41462
|
+
exports.visit = visit12;
|
|
41463
41463
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
41464
41464
|
}
|
|
41465
41465
|
});
|
|
@@ -43218,8 +43218,8 @@ var require_util2 = __commonJS({
|
|
|
43218
43218
|
exports.isTrailingCommaEnabled = exports.getParentExportDeclaration = exports.isExportDeclaration = exports.fixFaultyLocations = exports.getTrueLoc = exports.composeSourceMaps = exports.copyPos = exports.comparePos = exports.getUnionOfKeys = exports.getOption = exports.isBrowser = exports.getLineTerminator = void 0;
|
|
43219
43219
|
var tslib_1 = require_tslib();
|
|
43220
43220
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
43221
|
-
var
|
|
43222
|
-
var n =
|
|
43221
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
43222
|
+
var n = types14.namedTypes;
|
|
43223
43223
|
var source_map_1 = tslib_1.__importDefault(require_source_map());
|
|
43224
43224
|
var SourceMapConsumer = source_map_1.default.SourceMapConsumer;
|
|
43225
43225
|
var SourceMapGenerator = source_map_1.default.SourceMapGenerator;
|
|
@@ -50537,10 +50537,10 @@ var require_comments = __commonJS({
|
|
|
50537
50537
|
exports.printComments = exports.attach = void 0;
|
|
50538
50538
|
var tslib_1 = require_tslib();
|
|
50539
50539
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
50540
|
-
var
|
|
50541
|
-
var n =
|
|
50542
|
-
var isArray =
|
|
50543
|
-
var isObject =
|
|
50540
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
50541
|
+
var n = types14.namedTypes;
|
|
50542
|
+
var isArray = types14.builtInTypes.array;
|
|
50543
|
+
var isObject = types14.builtInTypes.object;
|
|
50544
50544
|
var lines_1 = require_lines();
|
|
50545
50545
|
var util_1 = require_util2();
|
|
50546
50546
|
var childNodesCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -50571,7 +50571,7 @@ var require_comments = __commonJS({
|
|
|
50571
50571
|
if (isArray.check(node)) {
|
|
50572
50572
|
names = Object.keys(node);
|
|
50573
50573
|
} else if (isObject.check(node)) {
|
|
50574
|
-
names =
|
|
50574
|
+
names = types14.getFieldNames(node);
|
|
50575
50575
|
} else {
|
|
50576
50576
|
return resultArray;
|
|
50577
50577
|
}
|
|
@@ -50749,7 +50749,7 @@ var require_comments = __commonJS({
|
|
|
50749
50749
|
function printComments(path2, print10) {
|
|
50750
50750
|
var value = path2.getValue();
|
|
50751
50751
|
var innerLines = print10(path2);
|
|
50752
|
-
var comments = n.Node.check(value) &&
|
|
50752
|
+
var comments = n.Node.check(value) && types14.getFieldValue(value, "comments");
|
|
50753
50753
|
if (!comments || comments.length === 0) {
|
|
50754
50754
|
return innerLines;
|
|
50755
50755
|
}
|
|
@@ -50757,8 +50757,8 @@ var require_comments = __commonJS({
|
|
|
50757
50757
|
var trailingParts = [innerLines];
|
|
50758
50758
|
path2.each(function(commentPath) {
|
|
50759
50759
|
var comment = commentPath.getValue();
|
|
50760
|
-
var leading =
|
|
50761
|
-
var trailing =
|
|
50760
|
+
var leading = types14.getFieldValue(comment, "leading");
|
|
50761
|
+
var trailing = types14.getFieldValue(comment, "trailing");
|
|
50762
50762
|
if (leading || trailing && !(n.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
50763
50763
|
leadingParts.push(printLeadingComment(commentPath, print10));
|
|
50764
50764
|
} else if (trailing) {
|
|
@@ -50780,10 +50780,10 @@ var require_parser2 = __commonJS({
|
|
|
50780
50780
|
exports.parse = void 0;
|
|
50781
50781
|
var tslib_1 = require_tslib();
|
|
50782
50782
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
50783
|
-
var
|
|
50784
|
-
var b =
|
|
50785
|
-
var isObject =
|
|
50786
|
-
var isArray =
|
|
50783
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
50784
|
+
var b = types14.builders;
|
|
50785
|
+
var isObject = types14.builtInTypes.object;
|
|
50786
|
+
var isArray = types14.builtInTypes.array;
|
|
50787
50787
|
var options_1 = require_options();
|
|
50788
50788
|
var lines_1 = require_lines();
|
|
50789
50789
|
var comments_1 = require_comments();
|
|
@@ -50969,11 +50969,11 @@ var require_fast_path = __commonJS({
|
|
|
50969
50969
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50970
50970
|
var tslib_1 = require_tslib();
|
|
50971
50971
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
50972
|
-
var
|
|
50972
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
50973
50973
|
var util = tslib_1.__importStar(require_util2());
|
|
50974
|
-
var n =
|
|
50975
|
-
var isArray =
|
|
50976
|
-
var isNumber =
|
|
50974
|
+
var n = types14.namedTypes;
|
|
50975
|
+
var isArray = types14.builtInTypes.array;
|
|
50976
|
+
var isNumber = types14.builtInTypes.number;
|
|
50977
50977
|
var PRECEDENCE = {};
|
|
50978
50978
|
[
|
|
50979
50979
|
["??"],
|
|
@@ -51002,7 +51002,7 @@ var require_fast_path = __commonJS({
|
|
|
51002
51002
|
if (obj instanceof FastPath) {
|
|
51003
51003
|
return obj.copy();
|
|
51004
51004
|
}
|
|
51005
|
-
if (obj instanceof
|
|
51005
|
+
if (obj instanceof types14.NodePath) {
|
|
51006
51006
|
var copy = Object.create(FastPath.prototype);
|
|
51007
51007
|
var stack = [obj.value];
|
|
51008
51008
|
for (var pp = void 0; pp = obj.parentPath; obj = pp)
|
|
@@ -51313,7 +51313,7 @@ var require_fast_path = __commonJS({
|
|
|
51313
51313
|
return node.some(containsCallExpression);
|
|
51314
51314
|
}
|
|
51315
51315
|
if (n.Node.check(node)) {
|
|
51316
|
-
return
|
|
51316
|
+
return types14.someField(node, function(_name, child) {
|
|
51317
51317
|
return containsCallExpression(child);
|
|
51318
51318
|
});
|
|
51319
51319
|
}
|
|
@@ -51403,16 +51403,16 @@ var require_patcher = __commonJS({
|
|
|
51403
51403
|
var tslib_1 = require_tslib();
|
|
51404
51404
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
51405
51405
|
var linesModule = tslib_1.__importStar(require_lines());
|
|
51406
|
-
var
|
|
51407
|
-
var Printable =
|
|
51408
|
-
var Expression =
|
|
51409
|
-
var ReturnStatement =
|
|
51410
|
-
var SourceLocation =
|
|
51406
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
51407
|
+
var Printable = types14.namedTypes.Printable;
|
|
51408
|
+
var Expression = types14.namedTypes.Expression;
|
|
51409
|
+
var ReturnStatement = types14.namedTypes.ReturnStatement;
|
|
51410
|
+
var SourceLocation = types14.namedTypes.SourceLocation;
|
|
51411
51411
|
var util_1 = require_util2();
|
|
51412
51412
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
51413
|
-
var isObject =
|
|
51414
|
-
var isArray =
|
|
51415
|
-
var isString =
|
|
51413
|
+
var isObject = types14.builtInTypes.object;
|
|
51414
|
+
var isArray = types14.builtInTypes.array;
|
|
51415
|
+
var isString = types14.builtInTypes.string;
|
|
51416
51416
|
var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
|
|
51417
51417
|
var Patcher = function Patcher2(lines) {
|
|
51418
51418
|
assert_1.default.ok(this instanceof Patcher2);
|
|
@@ -51682,8 +51682,8 @@ var require_patcher = __commonJS({
|
|
|
51682
51682
|
if (k.charAt(0) === "_") {
|
|
51683
51683
|
continue;
|
|
51684
51684
|
}
|
|
51685
|
-
newPath.stack.push(k,
|
|
51686
|
-
oldPath.stack.push(k,
|
|
51685
|
+
newPath.stack.push(k, types14.getFieldValue(newNode, k));
|
|
51686
|
+
oldPath.stack.push(k, types14.getFieldValue(oldNode, k));
|
|
51687
51687
|
var canReprint = findAnyReprints(newPath, oldPath, reprints);
|
|
51688
51688
|
newPath.stack.length -= 2;
|
|
51689
51689
|
oldPath.stack.length -= 2;
|
|
@@ -51707,16 +51707,16 @@ var require_printer2 = __commonJS({
|
|
|
51707
51707
|
exports.Printer = void 0;
|
|
51708
51708
|
var tslib_1 = require_tslib();
|
|
51709
51709
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
51710
|
-
var
|
|
51710
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
51711
51711
|
var comments_1 = require_comments();
|
|
51712
51712
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
51713
51713
|
var lines_1 = require_lines();
|
|
51714
51714
|
var options_1 = require_options();
|
|
51715
51715
|
var patcher_1 = require_patcher();
|
|
51716
51716
|
var util = tslib_1.__importStar(require_util2());
|
|
51717
|
-
var namedTypes =
|
|
51718
|
-
var isString =
|
|
51719
|
-
var isObject =
|
|
51717
|
+
var namedTypes = types14.namedTypes;
|
|
51718
|
+
var isString = types14.builtInTypes.string;
|
|
51719
|
+
var isObject = types14.builtInTypes.object;
|
|
51720
51720
|
var PrintResult = function PrintResult2(code, sourceMap) {
|
|
51721
51721
|
assert_1.default.ok(this instanceof PrintResult2);
|
|
51722
51722
|
isString.assert(code);
|
|
@@ -51878,7 +51878,7 @@ var require_printer2 = __commonJS({
|
|
|
51878
51878
|
case "OptionalMemberExpression": {
|
|
51879
51879
|
parts.push(path2.call(print10, "object"));
|
|
51880
51880
|
var property = path2.call(print10, "property");
|
|
51881
|
-
var optional =
|
|
51881
|
+
var optional = types14.getFieldValue(n, "optional");
|
|
51882
51882
|
if (n.computed) {
|
|
51883
51883
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
51884
51884
|
} else {
|
|
@@ -52149,7 +52149,7 @@ var require_printer2 = __commonJS({
|
|
|
52149
52149
|
if (n.typeArguments) {
|
|
52150
52150
|
parts.push(path2.call(print10, "typeArguments"));
|
|
52151
52151
|
}
|
|
52152
|
-
if (
|
|
52152
|
+
if (types14.getFieldValue(n, "optional")) {
|
|
52153
52153
|
parts.push("?.");
|
|
52154
52154
|
}
|
|
52155
52155
|
parts.push(printArgumentsList(path2, options, print10));
|
|
@@ -53828,8 +53828,8 @@ var require_printer2 = __commonJS({
|
|
|
53828
53828
|
});
|
|
53829
53829
|
}
|
|
53830
53830
|
function getPossibleRaw(node) {
|
|
53831
|
-
var value =
|
|
53832
|
-
var extra =
|
|
53831
|
+
var value = types14.getFieldValue(node, "value");
|
|
53832
|
+
var extra = types14.getFieldValue(node, "extra");
|
|
53833
53833
|
if (extra && typeof extra.raw === "string" && value == extra.rawValue) {
|
|
53834
53834
|
return extra.raw;
|
|
53835
53835
|
}
|
|
@@ -53877,8 +53877,8 @@ var require_main2 = __commonJS({
|
|
|
53877
53877
|
exports.run = exports.prettyPrint = exports.print = exports.visit = exports.types = exports.parse = void 0;
|
|
53878
53878
|
var tslib_1 = require_tslib();
|
|
53879
53879
|
var fs_1 = tslib_1.__importDefault(__require("fs"));
|
|
53880
|
-
var
|
|
53881
|
-
exports.types =
|
|
53880
|
+
var types14 = tslib_1.__importStar(require_main());
|
|
53881
|
+
exports.types = types14;
|
|
53882
53882
|
var parser_1 = require_parser2();
|
|
53883
53883
|
Object.defineProperty(exports, "parse", { enumerable: true, get: function() {
|
|
53884
53884
|
return parser_1.parse;
|
|
@@ -53892,10 +53892,10 @@ var require_main2 = __commonJS({
|
|
|
53892
53892
|
return new printer_1.Printer(options).print(node);
|
|
53893
53893
|
}
|
|
53894
53894
|
exports.print = print10;
|
|
53895
|
-
function
|
|
53895
|
+
function prettyPrint3(node, options) {
|
|
53896
53896
|
return new printer_1.Printer(options).printGenerically(node);
|
|
53897
53897
|
}
|
|
53898
|
-
exports.prettyPrint =
|
|
53898
|
+
exports.prettyPrint = prettyPrint3;
|
|
53899
53899
|
function run(transformer, options) {
|
|
53900
53900
|
return runFile(process.argv[2], transformer, options);
|
|
53901
53901
|
}
|
|
@@ -53922,7 +53922,7 @@ var require_main2 = __commonJS({
|
|
|
53922
53922
|
});
|
|
53923
53923
|
|
|
53924
53924
|
// src/test/index.ts
|
|
53925
|
-
var
|
|
53925
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
53926
53926
|
var import_memfs2 = __toESM(require_lib(), 1);
|
|
53927
53927
|
|
|
53928
53928
|
// src/lib/pipeline.ts
|
|
@@ -54404,8 +54404,8 @@ var List = class {
|
|
|
54404
54404
|
} else {
|
|
54405
54405
|
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
54406
54406
|
}
|
|
54407
|
-
for (let
|
|
54408
|
-
yield
|
|
54407
|
+
for (let record2 of entries) {
|
|
54408
|
+
yield record2;
|
|
54409
54409
|
}
|
|
54410
54410
|
}
|
|
54411
54411
|
};
|
|
@@ -54454,6 +54454,46 @@ var ListCollection = class {
|
|
|
54454
54454
|
}
|
|
54455
54455
|
};
|
|
54456
54456
|
|
|
54457
|
+
// src/runtime/cache/schema.ts
|
|
54458
|
+
var SchemaManager = class {
|
|
54459
|
+
cache;
|
|
54460
|
+
fieldTypes = {};
|
|
54461
|
+
constructor(cache) {
|
|
54462
|
+
this.cache = cache;
|
|
54463
|
+
}
|
|
54464
|
+
setFieldType({
|
|
54465
|
+
parent,
|
|
54466
|
+
key,
|
|
54467
|
+
type,
|
|
54468
|
+
nullable = false,
|
|
54469
|
+
link
|
|
54470
|
+
}) {
|
|
54471
|
+
let parensIndex = key.indexOf("(");
|
|
54472
|
+
if (parensIndex !== -1) {
|
|
54473
|
+
key = key.substring(0, parensIndex);
|
|
54474
|
+
}
|
|
54475
|
+
if (parent === rootID) {
|
|
54476
|
+
parent = "Query";
|
|
54477
|
+
} else if (parent.includes(":")) {
|
|
54478
|
+
parent = parent.substring(0, parent.indexOf(":"));
|
|
54479
|
+
}
|
|
54480
|
+
if (!this.fieldTypes[parent]) {
|
|
54481
|
+
this.fieldTypes[parent] = {};
|
|
54482
|
+
}
|
|
54483
|
+
this.fieldTypes[parent][key] = {
|
|
54484
|
+
type,
|
|
54485
|
+
nullable,
|
|
54486
|
+
link: !!link
|
|
54487
|
+
};
|
|
54488
|
+
}
|
|
54489
|
+
fieldType(type, field) {
|
|
54490
|
+
return this.fieldTypes[type]?.[field] || null;
|
|
54491
|
+
}
|
|
54492
|
+
get config() {
|
|
54493
|
+
return this.cache._internal_unstable.config;
|
|
54494
|
+
}
|
|
54495
|
+
};
|
|
54496
|
+
|
|
54457
54497
|
// src/runtime/cache/storage.ts
|
|
54458
54498
|
var InMemoryStorage = class {
|
|
54459
54499
|
data;
|
|
@@ -55021,7 +55061,7 @@ var InMemorySubscriptions = class {
|
|
|
55021
55061
|
};
|
|
55022
55062
|
|
|
55023
55063
|
// src/runtime/cache/cache.ts
|
|
55024
|
-
var
|
|
55064
|
+
var Cache3 = class {
|
|
55025
55065
|
_internal_unstable;
|
|
55026
55066
|
constructor(config2) {
|
|
55027
55067
|
this._internal_unstable = new CacheInternal({
|
|
@@ -55029,7 +55069,8 @@ var Cache2 = class {
|
|
|
55029
55069
|
storage: new InMemoryStorage(),
|
|
55030
55070
|
subscriptions: new InMemorySubscriptions(this),
|
|
55031
55071
|
lists: new ListManager(this, rootID),
|
|
55032
|
-
lifetimes: new GarbageCollector(this)
|
|
55072
|
+
lifetimes: new GarbageCollector(this),
|
|
55073
|
+
schema: new SchemaManager(this)
|
|
55033
55074
|
});
|
|
55034
55075
|
if (config2) {
|
|
55035
55076
|
this.setConfig(defaultConfigValues(config2));
|
|
@@ -55115,18 +55156,21 @@ var CacheInternal = class {
|
|
|
55115
55156
|
lists;
|
|
55116
55157
|
cache;
|
|
55117
55158
|
lifetimes;
|
|
55159
|
+
schema;
|
|
55118
55160
|
constructor({
|
|
55119
55161
|
storage,
|
|
55120
55162
|
subscriptions,
|
|
55121
55163
|
lists,
|
|
55122
55164
|
cache,
|
|
55123
|
-
lifetimes
|
|
55165
|
+
lifetimes,
|
|
55166
|
+
schema
|
|
55124
55167
|
}) {
|
|
55125
55168
|
this.storage = storage;
|
|
55126
55169
|
this.subscriptions = subscriptions;
|
|
55127
55170
|
this.lists = lists;
|
|
55128
55171
|
this.cache = cache;
|
|
55129
55172
|
this.lifetimes = lifetimes;
|
|
55173
|
+
this.schema = schema;
|
|
55130
55174
|
this._disabled = typeof globalThis.window === "undefined";
|
|
55131
55175
|
try {
|
|
55132
55176
|
if (process.env.HOUDINI_TEST === "true") {
|
|
@@ -55142,7 +55186,6 @@ var CacheInternal = class {
|
|
|
55142
55186
|
data,
|
|
55143
55187
|
selection: selection2,
|
|
55144
55188
|
variables = {},
|
|
55145
|
-
root = rootID,
|
|
55146
55189
|
parent = rootID,
|
|
55147
55190
|
applyUpdates = false,
|
|
55148
55191
|
layer,
|
|
@@ -55165,9 +55208,17 @@ var CacheInternal = class {
|
|
|
55165
55208
|
selection: fieldSelection,
|
|
55166
55209
|
operations,
|
|
55167
55210
|
abstract: isAbstract,
|
|
55168
|
-
update
|
|
55211
|
+
update,
|
|
55212
|
+
nullable
|
|
55169
55213
|
} = targetSelection[field];
|
|
55170
55214
|
const key = evaluateKey(keyRaw, variables);
|
|
55215
|
+
this.schema.setFieldType({
|
|
55216
|
+
parent,
|
|
55217
|
+
key: keyRaw,
|
|
55218
|
+
type: linkedType,
|
|
55219
|
+
nullable,
|
|
55220
|
+
link: !!fieldSelection
|
|
55221
|
+
});
|
|
55171
55222
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
55172
55223
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
55173
55224
|
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
@@ -55236,7 +55287,6 @@ var CacheInternal = class {
|
|
|
55236
55287
|
}
|
|
55237
55288
|
if (linkedID) {
|
|
55238
55289
|
this.writeSelection({
|
|
55239
|
-
root,
|
|
55240
55290
|
selection: fieldSelection,
|
|
55241
55291
|
parent: linkedID,
|
|
55242
55292
|
data: value,
|
|
@@ -55627,7 +55677,7 @@ var CacheInternal = class {
|
|
|
55627
55677
|
var rootID = "_ROOT_";
|
|
55628
55678
|
|
|
55629
55679
|
// src/runtime/cache/index.ts
|
|
55630
|
-
var cache_default = new
|
|
55680
|
+
var cache_default = new Cache3();
|
|
55631
55681
|
|
|
55632
55682
|
// src/lib/constants.ts
|
|
55633
55683
|
var siteURL = "https://houdinigraphql.com";
|
|
@@ -55813,6 +55863,7 @@ async function writeFile(filepath, data) {
|
|
|
55813
55863
|
return;
|
|
55814
55864
|
}
|
|
55815
55865
|
if (houdini_mode.is_testing) {
|
|
55866
|
+
import_memfs.fs.mkdirpSync(dirname(filepath));
|
|
55816
55867
|
return import_memfs.fs.writeFileSync(filepath, data);
|
|
55817
55868
|
}
|
|
55818
55869
|
return await fs.writeFile(filepath, data, "utf8");
|
|
@@ -55939,7 +55990,6 @@ var Config = class {
|
|
|
55939
55990
|
rootDir;
|
|
55940
55991
|
projectRoot;
|
|
55941
55992
|
schema;
|
|
55942
|
-
apiUrl;
|
|
55943
55993
|
schemaPath;
|
|
55944
55994
|
persistedQueryPath;
|
|
55945
55995
|
exclude;
|
|
@@ -55979,7 +56029,6 @@ var Config = class {
|
|
|
55979
56029
|
schema,
|
|
55980
56030
|
schemaPath = "./schema.graphql",
|
|
55981
56031
|
exclude = [],
|
|
55982
|
-
apiUrl,
|
|
55983
56032
|
module = "esm",
|
|
55984
56033
|
scalars,
|
|
55985
56034
|
cacheBufferSize,
|
|
@@ -55989,7 +56038,7 @@ var Config = class {
|
|
|
55989
56038
|
defaultListPosition = "append",
|
|
55990
56039
|
defaultListTarget = null,
|
|
55991
56040
|
defaultKeys,
|
|
55992
|
-
types:
|
|
56041
|
+
types: types14 = {},
|
|
55993
56042
|
logLevel,
|
|
55994
56043
|
defaultFragmentMasking = "enable",
|
|
55995
56044
|
schemaPollInterval = 2e3,
|
|
@@ -56010,11 +56059,6 @@ var Config = class {
|
|
|
56010
56059
|
logLevel = LogLevel.Summary;
|
|
56011
56060
|
}
|
|
56012
56061
|
this.schemaPath = schemaPath;
|
|
56013
|
-
if (apiUrl && apiUrl.startsWith("env:")) {
|
|
56014
|
-
this.apiUrl = process.env[apiUrl.slice("env:".length)];
|
|
56015
|
-
} else {
|
|
56016
|
-
this.apiUrl = apiUrl;
|
|
56017
|
-
}
|
|
56018
56062
|
this.filepath = filepath;
|
|
56019
56063
|
this.exclude = Array.isArray(exclude) ? exclude : [exclude];
|
|
56020
56064
|
this.module = module;
|
|
@@ -56037,13 +56081,20 @@ var Config = class {
|
|
|
56037
56081
|
if (defaultKeys) {
|
|
56038
56082
|
this.defaultKeys = defaultKeys;
|
|
56039
56083
|
}
|
|
56040
|
-
if (
|
|
56084
|
+
if (types14) {
|
|
56041
56085
|
this.typeConfig = {
|
|
56042
56086
|
...this.typeConfig,
|
|
56043
|
-
...
|
|
56087
|
+
...types14
|
|
56044
56088
|
};
|
|
56045
56089
|
}
|
|
56046
56090
|
}
|
|
56091
|
+
async apiURL() {
|
|
56092
|
+
if (!this.configFile.apiUrl) {
|
|
56093
|
+
return "";
|
|
56094
|
+
}
|
|
56095
|
+
const env = await this.getEnv();
|
|
56096
|
+
return this.processEnvValues(env, this.configFile.apiUrl);
|
|
56097
|
+
}
|
|
56047
56098
|
get include() {
|
|
56048
56099
|
if (this.configFile.include) {
|
|
56049
56100
|
return Array.isArray(this.configFile.include) ? this.configFile.include : [this.configFile.include];
|
|
@@ -56056,23 +56107,43 @@ var Config = class {
|
|
|
56056
56107
|
pluginConfig(name2) {
|
|
56057
56108
|
return this.configFile.plugins?.[name2] ?? {};
|
|
56058
56109
|
}
|
|
56059
|
-
|
|
56060
|
-
|
|
56110
|
+
async getEnv() {
|
|
56111
|
+
let env = process.env;
|
|
56112
|
+
for (const plugin of this.plugins) {
|
|
56113
|
+
if (plugin.env) {
|
|
56114
|
+
env = {
|
|
56115
|
+
...await plugin.env({ config: this, env })
|
|
56116
|
+
};
|
|
56117
|
+
}
|
|
56118
|
+
}
|
|
56119
|
+
return env;
|
|
56120
|
+
}
|
|
56121
|
+
processEnvValues(env, value) {
|
|
56122
|
+
let headerValue;
|
|
56123
|
+
if (typeof value === "function") {
|
|
56124
|
+
headerValue = value(env);
|
|
56125
|
+
} else if (value.startsWith("env:")) {
|
|
56126
|
+
headerValue = env[value.slice("env:".length)];
|
|
56127
|
+
} else {
|
|
56128
|
+
headerValue = value;
|
|
56129
|
+
}
|
|
56130
|
+
return headerValue;
|
|
56131
|
+
}
|
|
56132
|
+
async pullHeaders() {
|
|
56133
|
+
const env = await this.getEnv();
|
|
56134
|
+
if (typeof this.schemaPollHeaders === "function") {
|
|
56135
|
+
return this.schemaPollHeaders(env);
|
|
56136
|
+
}
|
|
56137
|
+
const headers = Object.fromEntries(
|
|
56061
56138
|
Object.entries(this.schemaPollHeaders || {}).map(([key, value]) => {
|
|
56062
|
-
|
|
56063
|
-
if (typeof value === "function") {
|
|
56064
|
-
headerValue = value(process.env);
|
|
56065
|
-
} else if (value.startsWith("env:")) {
|
|
56066
|
-
headerValue = process.env[value.slice("env:".length)];
|
|
56067
|
-
} else {
|
|
56068
|
-
headerValue = value;
|
|
56069
|
-
}
|
|
56139
|
+
const headerValue = this.processEnvValues(env, value);
|
|
56070
56140
|
if (!headerValue) {
|
|
56071
56141
|
return [];
|
|
56072
56142
|
}
|
|
56073
56143
|
return [key, headerValue];
|
|
56074
|
-
})
|
|
56144
|
+
}).filter(([key]) => key)
|
|
56075
56145
|
);
|
|
56146
|
+
return headers;
|
|
56076
56147
|
}
|
|
56077
56148
|
async sourceFiles() {
|
|
56078
56149
|
return [
|
|
@@ -56498,6 +56569,16 @@ function definitionFromAncestors(ancestors) {
|
|
|
56498
56569
|
|
|
56499
56570
|
// src/lib/parse.ts
|
|
56500
56571
|
var import_parser = __toESM(require_lib3(), 1);
|
|
56572
|
+
async function parseJS(str) {
|
|
56573
|
+
return {
|
|
56574
|
+
start: 0,
|
|
56575
|
+
script: (0, import_parser.parse)(str || "", {
|
|
56576
|
+
plugins: ["typescript"],
|
|
56577
|
+
sourceType: "module"
|
|
56578
|
+
}).program,
|
|
56579
|
+
end: str.length
|
|
56580
|
+
};
|
|
56581
|
+
}
|
|
56501
56582
|
|
|
56502
56583
|
// src/lib/imports.ts
|
|
56503
56584
|
var recast = __toESM(require_main2(), 1);
|
|
@@ -56962,7 +57043,7 @@ function deepMerge(filepath, ...targets) {
|
|
|
56962
57043
|
Object.entries(fields).map(([key, value]) => [key, deepMerge(filepath, ...value)])
|
|
56963
57044
|
);
|
|
56964
57045
|
}
|
|
56965
|
-
function convertValue(val) {
|
|
57046
|
+
function convertValue(config2, val) {
|
|
56966
57047
|
let value;
|
|
56967
57048
|
let kind;
|
|
56968
57049
|
if (val.kind === graphql5.Kind.INT) {
|
|
@@ -57094,7 +57175,7 @@ function operationObject({
|
|
|
57094
57175
|
operationWhen[i ? "must_not" : "must"] = arg.value.fields.reduce(
|
|
57095
57176
|
(obj, arg2) => ({
|
|
57096
57177
|
...obj,
|
|
57097
|
-
[arg2.name.value]: convertValue(arg2.value).value
|
|
57178
|
+
[arg2.name.value]: convertValue(config2, arg2.value).value
|
|
57098
57179
|
}),
|
|
57099
57180
|
{}
|
|
57100
57181
|
);
|
|
@@ -57110,7 +57191,7 @@ function operationObject({
|
|
|
57110
57191
|
operationWhen[which] = directive.arguments?.reduce(
|
|
57111
57192
|
(filters, argument) => ({
|
|
57112
57193
|
...filters,
|
|
57113
|
-
[argument.name.value]: convertValue(argument.value).value
|
|
57194
|
+
[argument.name.value]: convertValue(config2, argument.value).value
|
|
57114
57195
|
}),
|
|
57115
57196
|
{}
|
|
57116
57197
|
);
|
|
@@ -58069,7 +58150,9 @@ function fieldKey(config2, field) {
|
|
|
58069
58150
|
[arg.name.value]: printed.substring(start - 1, end - 1)
|
|
58070
58151
|
};
|
|
58071
58152
|
}, {});
|
|
58072
|
-
|
|
58153
|
+
const args = Object.keys(argObj);
|
|
58154
|
+
args.sort();
|
|
58155
|
+
let key = Object.values(argObj).length > 0 ? `${attributeName}(${args.map((key2) => `${key2}: ${argObj[key2]}`).join(", ")})` : attributeName;
|
|
58073
58156
|
if (paginated) {
|
|
58074
58157
|
key = key + "::paginated";
|
|
58075
58158
|
}
|
|
@@ -58252,7 +58335,7 @@ function selection({
|
|
|
58252
58335
|
fieldObj.filters = (field.arguments || []).reduce(
|
|
58253
58336
|
(filters, arg) => ({
|
|
58254
58337
|
...filters,
|
|
58255
|
-
[arg.name.value]: convertValue(arg.value)
|
|
58338
|
+
[arg.name.value]: convertValue(config2, arg.value)
|
|
58256
58339
|
}),
|
|
58257
58340
|
{}
|
|
58258
58341
|
);
|
|
@@ -58539,7 +58622,9 @@ function artifactGenerator(stats) {
|
|
|
58539
58622
|
}
|
|
58540
58623
|
|
|
58541
58624
|
// src/codegen/generators/runtime/index.ts
|
|
58542
|
-
|
|
58625
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
58626
|
+
var AST6 = recast6.types.builders;
|
|
58627
|
+
async function runtimeGenerator(config2, docs) {
|
|
58543
58628
|
await Promise.all([
|
|
58544
58629
|
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
58545
58630
|
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
@@ -58553,6 +58638,59 @@ async function runtimeGenerator(config2) {
|
|
|
58553
58638
|
}),
|
|
58554
58639
|
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
58555
58640
|
]);
|
|
58641
|
+
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
58642
|
+
const contents = await parseJS(await fs_exports.readFile(indexPath) || "");
|
|
58643
|
+
const graphql_tag_return = config2.plugins.find(
|
|
58644
|
+
(plugin) => plugin.graphql_tag_return
|
|
58645
|
+
)?.graphql_tag_return;
|
|
58646
|
+
if (graphql_tag_return && contents) {
|
|
58647
|
+
const overloaded_returns = {};
|
|
58648
|
+
for (const doc of docs) {
|
|
58649
|
+
const return_value = graphql_tag_return({
|
|
58650
|
+
config: config2,
|
|
58651
|
+
doc,
|
|
58652
|
+
ensure_import({ identifier, module }) {
|
|
58653
|
+
ensureImports({
|
|
58654
|
+
config: config2,
|
|
58655
|
+
body: contents.script.body,
|
|
58656
|
+
sourceModule: module,
|
|
58657
|
+
import: [identifier]
|
|
58658
|
+
});
|
|
58659
|
+
}
|
|
58660
|
+
});
|
|
58661
|
+
if (return_value) {
|
|
58662
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
58663
|
+
}
|
|
58664
|
+
}
|
|
58665
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
58666
|
+
for (const [i, expression] of (contents?.script.body ?? []).entries()) {
|
|
58667
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
58668
|
+
continue;
|
|
58669
|
+
}
|
|
58670
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
58671
|
+
const input = AST6.identifier("str");
|
|
58672
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
58673
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
58674
|
+
);
|
|
58675
|
+
contents?.script.body.splice(
|
|
58676
|
+
i,
|
|
58677
|
+
0,
|
|
58678
|
+
AST6.exportNamedDeclaration(
|
|
58679
|
+
AST6.tsDeclareFunction(
|
|
58680
|
+
AST6.identifier("graphql"),
|
|
58681
|
+
[input],
|
|
58682
|
+
AST6.tsTypeAnnotation(
|
|
58683
|
+
AST6.tsTypeReference(AST6.identifier(returnValue))
|
|
58684
|
+
)
|
|
58685
|
+
)
|
|
58686
|
+
)
|
|
58687
|
+
);
|
|
58688
|
+
}
|
|
58689
|
+
break;
|
|
58690
|
+
}
|
|
58691
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
58692
|
+
}
|
|
58693
|
+
}
|
|
58556
58694
|
}
|
|
58557
58695
|
async function generatePluginRuntime(config2, plugin) {
|
|
58558
58696
|
if (houdini_mode.is_testing) {
|
|
@@ -58587,20 +58725,20 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
58587
58725
|
}
|
|
58588
58726
|
|
|
58589
58727
|
// src/codegen/generators/typescript/index.ts
|
|
58590
|
-
var
|
|
58728
|
+
var recast12 = __toESM(require_main2(), 1);
|
|
58591
58729
|
|
|
58592
58730
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58593
58731
|
var graphql15 = __toESM(require_graphql2(), 1);
|
|
58594
|
-
var
|
|
58732
|
+
var recast9 = __toESM(require_main2(), 1);
|
|
58595
58733
|
|
|
58596
58734
|
// src/codegen/generators/typescript/typeReference.ts
|
|
58597
58735
|
var graphql14 = __toESM(require_graphql2(), 1);
|
|
58598
|
-
var
|
|
58736
|
+
var recast8 = __toESM(require_main2(), 1);
|
|
58599
58737
|
|
|
58600
58738
|
// src/codegen/generators/typescript/types.ts
|
|
58601
58739
|
var graphql13 = __toESM(require_graphql2(), 1);
|
|
58602
|
-
var
|
|
58603
|
-
var
|
|
58740
|
+
var recast7 = __toESM(require_main2(), 1);
|
|
58741
|
+
var AST7 = recast7.types.builders;
|
|
58604
58742
|
function readonlyProperty(prop, enable = true) {
|
|
58605
58743
|
if (enable) {
|
|
58606
58744
|
prop.readonly = true;
|
|
@@ -58608,28 +58746,28 @@ function readonlyProperty(prop, enable = true) {
|
|
|
58608
58746
|
return prop;
|
|
58609
58747
|
}
|
|
58610
58748
|
function nullableField(inner, input = false) {
|
|
58611
|
-
const members = [inner,
|
|
58749
|
+
const members = [inner, AST7.tsNullKeyword()];
|
|
58612
58750
|
if (input) {
|
|
58613
|
-
members.push(
|
|
58751
|
+
members.push(AST7.tsUndefinedKeyword());
|
|
58614
58752
|
}
|
|
58615
|
-
return
|
|
58753
|
+
return AST7.tsUnionType(members);
|
|
58616
58754
|
}
|
|
58617
58755
|
function scalarPropertyValue(config2, missingScalars, target) {
|
|
58618
58756
|
switch (target.name) {
|
|
58619
58757
|
case "String": {
|
|
58620
|
-
return
|
|
58758
|
+
return AST7.tsStringKeyword();
|
|
58621
58759
|
}
|
|
58622
58760
|
case "Int": {
|
|
58623
|
-
return
|
|
58761
|
+
return AST7.tsNumberKeyword();
|
|
58624
58762
|
}
|
|
58625
58763
|
case "Float": {
|
|
58626
|
-
return
|
|
58764
|
+
return AST7.tsNumberKeyword();
|
|
58627
58765
|
}
|
|
58628
58766
|
case "Boolean": {
|
|
58629
|
-
return
|
|
58767
|
+
return AST7.tsBooleanKeyword();
|
|
58630
58768
|
}
|
|
58631
58769
|
case "ID": {
|
|
58632
|
-
return
|
|
58770
|
+
return AST7.tsStringKeyword();
|
|
58633
58771
|
}
|
|
58634
58772
|
default: {
|
|
58635
58773
|
if (graphql13.isNonNullType(target) && "ofType" in target) {
|
|
@@ -58640,23 +58778,23 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
58640
58778
|
);
|
|
58641
58779
|
}
|
|
58642
58780
|
if (config2.scalars?.[target.name]) {
|
|
58643
|
-
return
|
|
58781
|
+
return AST7.tsTypeReference(AST7.identifier(config2.scalars?.[target.name].type));
|
|
58644
58782
|
}
|
|
58645
58783
|
missingScalars.add(target.name);
|
|
58646
|
-
return
|
|
58784
|
+
return AST7.tsAnyKeyword();
|
|
58647
58785
|
}
|
|
58648
58786
|
}
|
|
58649
58787
|
}
|
|
58650
58788
|
|
|
58651
58789
|
// src/codegen/generators/typescript/typeReference.ts
|
|
58652
|
-
var
|
|
58790
|
+
var AST8 = recast8.types.builders;
|
|
58653
58791
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
58654
58792
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
58655
58793
|
let result;
|
|
58656
58794
|
if (graphql14.isScalarType(type)) {
|
|
58657
58795
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58658
58796
|
} else {
|
|
58659
|
-
result =
|
|
58797
|
+
result = AST8.tsTypeReference(AST8.identifier(type.name));
|
|
58660
58798
|
}
|
|
58661
58799
|
for (const toWrap of wrappers) {
|
|
58662
58800
|
if (toWrap === "NonNull" /* NonNull */) {
|
|
@@ -58664,14 +58802,14 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
58664
58802
|
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
58665
58803
|
result = nullableField(result, true);
|
|
58666
58804
|
} else if (toWrap === "List" /* List */) {
|
|
58667
|
-
result =
|
|
58805
|
+
result = AST8.tsArrayType(AST8.tsParenthesizedType(result));
|
|
58668
58806
|
}
|
|
58669
58807
|
}
|
|
58670
58808
|
return result;
|
|
58671
58809
|
}
|
|
58672
58810
|
|
|
58673
58811
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58674
|
-
var
|
|
58812
|
+
var AST9 = recast9.types.builders;
|
|
58675
58813
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
58676
58814
|
const { type } = unwrapType(config2, rootType);
|
|
58677
58815
|
if (graphql15.isScalarType(type)) {
|
|
@@ -58698,20 +58836,267 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58698
58836
|
for (const field of Object.values(type.getFields())) {
|
|
58699
58837
|
addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, field.type);
|
|
58700
58838
|
members.push(
|
|
58701
|
-
|
|
58702
|
-
|
|
58703
|
-
|
|
58839
|
+
AST9.tsPropertySignature(
|
|
58840
|
+
AST9.identifier(field.name),
|
|
58841
|
+
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
58704
58842
|
graphql15.isNullableType(field.type)
|
|
58705
58843
|
)
|
|
58706
58844
|
);
|
|
58707
58845
|
}
|
|
58708
|
-
body.push(
|
|
58846
|
+
body.push(AST9.tsTypeAliasDeclaration(AST9.identifier(type.name), AST9.tsTypeLiteral(members)));
|
|
58709
58847
|
}
|
|
58710
58848
|
|
|
58711
|
-
// src/codegen/generators/typescript/
|
|
58849
|
+
// src/codegen/generators/typescript/imperativeCache.ts
|
|
58712
58850
|
var graphql16 = __toESM(require_graphql2(), 1);
|
|
58713
|
-
var
|
|
58714
|
-
var
|
|
58851
|
+
var recast10 = __toESM(require_main2(), 1);
|
|
58852
|
+
var AST10 = recast10.types.builders;
|
|
58853
|
+
async function imperativeCacheTypef(config2, docs) {
|
|
58854
|
+
const target = path_exports.join(config2.runtimeDirectory, "generated.d.ts");
|
|
58855
|
+
const body = [];
|
|
58856
|
+
const declaration = AST10.tsTypeAliasDeclaration(
|
|
58857
|
+
AST10.identifier(CacheTypeDefName),
|
|
58858
|
+
AST10.tsTypeLiteral([
|
|
58859
|
+
AST10.tsPropertySignature(
|
|
58860
|
+
AST10.identifier("types"),
|
|
58861
|
+
AST10.tsTypeAnnotation(typeDefinitions(config2, body))
|
|
58862
|
+
),
|
|
58863
|
+
AST10.tsPropertySignature(
|
|
58864
|
+
AST10.identifier("lists"),
|
|
58865
|
+
AST10.tsTypeAnnotation(listDefinitions(config2, docs))
|
|
58866
|
+
)
|
|
58867
|
+
])
|
|
58868
|
+
);
|
|
58869
|
+
declaration.declare = true;
|
|
58870
|
+
const importRecord = AST10.importDeclaration(
|
|
58871
|
+
[AST10.importSpecifier(AST10.identifier("Record"))],
|
|
58872
|
+
AST10.stringLiteral("./public/record")
|
|
58873
|
+
);
|
|
58874
|
+
importRecord.importKind = "type";
|
|
58875
|
+
await fs_exports.writeFile(
|
|
58876
|
+
target,
|
|
58877
|
+
recast10.prettyPrint(
|
|
58878
|
+
AST10.program([importRecord, ...body, AST10.exportNamedDeclaration(declaration)])
|
|
58879
|
+
).code
|
|
58880
|
+
);
|
|
58881
|
+
}
|
|
58882
|
+
function typeDefinitions(config2, body) {
|
|
58883
|
+
const operationTypes = [config2.schema.getMutationType(), config2.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
58884
|
+
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58885
|
+
const types14 = Object.values(config2.schema.getTypeMap()).filter(
|
|
58886
|
+
(type) => !graphql16.isAbstractType(type) && !graphql16.isScalarType(type) && !graphql16.isEnumType(type) && !graphql16.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
58887
|
+
);
|
|
58888
|
+
return AST10.tsTypeLiteral(
|
|
58889
|
+
types14.map((type) => {
|
|
58890
|
+
let typeName = type.name;
|
|
58891
|
+
if (config2.schema.getQueryType() && config2.schema.getQueryType()?.name === type.name) {
|
|
58892
|
+
typeName = "__ROOT__";
|
|
58893
|
+
}
|
|
58894
|
+
let idFields = AST10.tsNeverKeyword();
|
|
58895
|
+
const keys = keyFieldsForType(config2.configFile, type.name);
|
|
58896
|
+
if (graphql16.isObjectType(type) && keys.length > 0 && keys.every((key) => type.getFields()[key])) {
|
|
58897
|
+
idFields = AST10.tsTypeLiteral(
|
|
58898
|
+
keys.map((key) => {
|
|
58899
|
+
const fieldType = type.getFields()[key];
|
|
58900
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
58901
|
+
return AST10.tsPropertySignature(
|
|
58902
|
+
AST10.identifier(key),
|
|
58903
|
+
AST10.tsTypeAnnotation(
|
|
58904
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
58905
|
+
)
|
|
58906
|
+
);
|
|
58907
|
+
})
|
|
58908
|
+
);
|
|
58909
|
+
} else if (typeName === "__ROOT__") {
|
|
58910
|
+
idFields = AST10.tsTypeLiteral([]);
|
|
58911
|
+
}
|
|
58912
|
+
let fields = AST10.tsTypeLiteral([]);
|
|
58913
|
+
if (graphql16.isObjectType(type)) {
|
|
58914
|
+
fields = AST10.tsTypeLiteral(
|
|
58915
|
+
Object.entries(type.getFields()).map(
|
|
58916
|
+
([key, fieldType]) => {
|
|
58917
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
58918
|
+
let typeOptions = AST10.tsUnionType([]);
|
|
58919
|
+
if (graphql16.isScalarType(unwrapped.type)) {
|
|
58920
|
+
typeOptions.types.push(
|
|
58921
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
58922
|
+
);
|
|
58923
|
+
} else if (graphql16.isEnumType(unwrapped.type)) {
|
|
58924
|
+
typeOptions.types.push(
|
|
58925
|
+
AST10.tsTypeReference(AST10.identifier(unwrapped.type.name))
|
|
58926
|
+
);
|
|
58927
|
+
} else if (!graphql16.isAbstractType(unwrapped.type)) {
|
|
58928
|
+
typeOptions.types.push(record(unwrapped.type.name));
|
|
58929
|
+
} else {
|
|
58930
|
+
typeOptions.types.push(
|
|
58931
|
+
...config2.schema.getPossibleTypes(unwrapped.type).map((type2) => record(type2.name))
|
|
58932
|
+
);
|
|
58933
|
+
}
|
|
58934
|
+
for (const wrapper of unwrapped.wrappers) {
|
|
58935
|
+
if (wrapper === "Nullable" /* Nullable */) {
|
|
58936
|
+
typeOptions = AST10.tsParenthesizedType(
|
|
58937
|
+
AST10.tsUnionType([typeOptions, AST10.tsNullKeyword()])
|
|
58938
|
+
);
|
|
58939
|
+
} else if (wrapper === "List" /* List */) {
|
|
58940
|
+
typeOptions = AST10.tsArrayType(
|
|
58941
|
+
AST10.tsParenthesizedType(typeOptions)
|
|
58942
|
+
);
|
|
58943
|
+
}
|
|
58944
|
+
}
|
|
58945
|
+
if (typeOptions.type === "TSParenthesizedType") {
|
|
58946
|
+
typeOptions = typeOptions.typeAnnotation;
|
|
58947
|
+
}
|
|
58948
|
+
let args = AST10.tsNeverKeyword();
|
|
58949
|
+
if (fieldType.args?.length > 0) {
|
|
58950
|
+
args = AST10.tsTypeLiteral(
|
|
58951
|
+
fieldType.args.map((arg) => {
|
|
58952
|
+
addReferencedInputTypes(
|
|
58953
|
+
config2,
|
|
58954
|
+
"",
|
|
58955
|
+
body,
|
|
58956
|
+
visitedTypes,
|
|
58957
|
+
/* @__PURE__ */ new Set(),
|
|
58958
|
+
arg.type
|
|
58959
|
+
);
|
|
58960
|
+
const prop = AST10.tsPropertySignature(
|
|
58961
|
+
AST10.identifier(arg.name),
|
|
58962
|
+
AST10.tsTypeAnnotation(
|
|
58963
|
+
tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
|
|
58964
|
+
)
|
|
58965
|
+
);
|
|
58966
|
+
const unwrapped2 = unwrapType(config2, arg.type);
|
|
58967
|
+
prop.optional = unwrapped2.wrappers[unwrapped2.wrappers.length - 1] === "Nullable" /* Nullable */;
|
|
58968
|
+
return prop;
|
|
58969
|
+
})
|
|
58970
|
+
);
|
|
58971
|
+
}
|
|
58972
|
+
return AST10.tsPropertySignature(
|
|
58973
|
+
AST10.identifier(key),
|
|
58974
|
+
AST10.tsTypeAnnotation(
|
|
58975
|
+
AST10.tsTypeLiteral([
|
|
58976
|
+
AST10.tsPropertySignature(
|
|
58977
|
+
AST10.identifier("type"),
|
|
58978
|
+
AST10.tsTypeAnnotation(typeOptions)
|
|
58979
|
+
),
|
|
58980
|
+
AST10.tsPropertySignature(
|
|
58981
|
+
AST10.identifier("args"),
|
|
58982
|
+
AST10.tsTypeAnnotation(args)
|
|
58983
|
+
)
|
|
58984
|
+
])
|
|
58985
|
+
)
|
|
58986
|
+
);
|
|
58987
|
+
}
|
|
58988
|
+
)
|
|
58989
|
+
);
|
|
58990
|
+
}
|
|
58991
|
+
return AST10.tsPropertySignature(
|
|
58992
|
+
AST10.identifier(typeName),
|
|
58993
|
+
AST10.tsTypeAnnotation(
|
|
58994
|
+
AST10.tsTypeLiteral([
|
|
58995
|
+
AST10.tsPropertySignature(
|
|
58996
|
+
AST10.identifier("idFields"),
|
|
58997
|
+
AST10.tsTypeAnnotation(idFields)
|
|
58998
|
+
),
|
|
58999
|
+
AST10.tsPropertySignature(
|
|
59000
|
+
AST10.identifier("fields"),
|
|
59001
|
+
AST10.tsTypeAnnotation(fields)
|
|
59002
|
+
)
|
|
59003
|
+
])
|
|
59004
|
+
)
|
|
59005
|
+
);
|
|
59006
|
+
})
|
|
59007
|
+
);
|
|
59008
|
+
}
|
|
59009
|
+
function listDefinitions(config2, docs) {
|
|
59010
|
+
const lists = [];
|
|
59011
|
+
const visitedLists = /* @__PURE__ */ new Set();
|
|
59012
|
+
for (const doc of docs) {
|
|
59013
|
+
graphql16.visit(doc.document, {
|
|
59014
|
+
Directive(node, key, parent, path2, ancestors) {
|
|
59015
|
+
if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
59016
|
+
return;
|
|
59017
|
+
}
|
|
59018
|
+
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
59019
|
+
const nameValue = nameArg?.value?.value || "";
|
|
59020
|
+
if (!nameValue || visitedLists.has(nameValue)) {
|
|
59021
|
+
return;
|
|
59022
|
+
}
|
|
59023
|
+
visitedLists.add(nameValue);
|
|
59024
|
+
const parentType = parentTypeFromAncestors(
|
|
59025
|
+
config2.schema,
|
|
59026
|
+
doc.filename,
|
|
59027
|
+
ancestors.slice(0, -1)
|
|
59028
|
+
);
|
|
59029
|
+
const targetField = ancestors[ancestors.length - 1];
|
|
59030
|
+
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
59031
|
+
const { type: listType } = unwrapType(config2, targetFieldDefinition.type);
|
|
59032
|
+
const possibleTypes = [];
|
|
59033
|
+
if (graphql16.isAbstractType(listType)) {
|
|
59034
|
+
possibleTypes.push(
|
|
59035
|
+
...config2.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
59036
|
+
);
|
|
59037
|
+
} else {
|
|
59038
|
+
possibleTypes.push(listType.name);
|
|
59039
|
+
}
|
|
59040
|
+
lists.push(
|
|
59041
|
+
AST10.tsPropertySignature(
|
|
59042
|
+
AST10.identifier(nameValue),
|
|
59043
|
+
AST10.tsTypeAnnotation(
|
|
59044
|
+
AST10.tsTypeLiteral([
|
|
59045
|
+
AST10.tsPropertySignature(
|
|
59046
|
+
AST10.identifier("type"),
|
|
59047
|
+
AST10.tsTypeAnnotation(
|
|
59048
|
+
AST10.tsUnionType(
|
|
59049
|
+
possibleTypes.map(
|
|
59050
|
+
(possible) => AST10.tsLiteralType(AST10.stringLiteral(possible))
|
|
59051
|
+
)
|
|
59052
|
+
)
|
|
59053
|
+
)
|
|
59054
|
+
),
|
|
59055
|
+
AST10.tsPropertySignature(
|
|
59056
|
+
AST10.identifier("filters"),
|
|
59057
|
+
AST10.tsTypeAnnotation(
|
|
59058
|
+
targetFieldDefinition.args.length === 0 ? AST10.tsNeverKeyword() : AST10.tsTypeLiteral(
|
|
59059
|
+
targetFieldDefinition.args.map((arg) => {
|
|
59060
|
+
const argDef = AST10.tsPropertySignature(
|
|
59061
|
+
AST10.identifier(arg.name),
|
|
59062
|
+
AST10.tsTypeAnnotation(
|
|
59063
|
+
tsTypeReference(
|
|
59064
|
+
config2,
|
|
59065
|
+
/* @__PURE__ */ new Set(),
|
|
59066
|
+
arg
|
|
59067
|
+
)
|
|
59068
|
+
)
|
|
59069
|
+
);
|
|
59070
|
+
argDef.optional = true;
|
|
59071
|
+
return argDef;
|
|
59072
|
+
})
|
|
59073
|
+
)
|
|
59074
|
+
)
|
|
59075
|
+
)
|
|
59076
|
+
])
|
|
59077
|
+
)
|
|
59078
|
+
)
|
|
59079
|
+
);
|
|
59080
|
+
}
|
|
59081
|
+
});
|
|
59082
|
+
}
|
|
59083
|
+
return AST10.tsTypeLiteral(lists);
|
|
59084
|
+
}
|
|
59085
|
+
var CacheTypeDefName = "CacheTypeDef";
|
|
59086
|
+
function record(name2) {
|
|
59087
|
+
return AST10.tsTypeReference(
|
|
59088
|
+
AST10.identifier("Record"),
|
|
59089
|
+
AST10.tsTypeParameterInstantiation([
|
|
59090
|
+
AST10.tsTypeReference(AST10.identifier(CacheTypeDefName)),
|
|
59091
|
+
AST10.tsLiteralType(AST10.stringLiteral(name2))
|
|
59092
|
+
])
|
|
59093
|
+
);
|
|
59094
|
+
}
|
|
59095
|
+
|
|
59096
|
+
// src/codegen/generators/typescript/inlineType.ts
|
|
59097
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
59098
|
+
var recast11 = __toESM(require_main2(), 1);
|
|
59099
|
+
var AST11 = recast11.types.builders;
|
|
58715
59100
|
var fragmentKey = "$fragments";
|
|
58716
59101
|
function inlineType({
|
|
58717
59102
|
config: config2,
|
|
@@ -58728,9 +59113,9 @@ function inlineType({
|
|
|
58728
59113
|
}) {
|
|
58729
59114
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
58730
59115
|
let result;
|
|
58731
|
-
if (
|
|
59116
|
+
if (graphql17.isScalarType(type)) {
|
|
58732
59117
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58733
|
-
} else if (
|
|
59118
|
+
} else if (graphql17.isEnumType(type)) {
|
|
58734
59119
|
if (!visitedTypes.has(type.name)) {
|
|
58735
59120
|
ensureImports({
|
|
58736
59121
|
config: config2,
|
|
@@ -58740,7 +59125,7 @@ function inlineType({
|
|
|
58740
59125
|
});
|
|
58741
59126
|
visitedTypes.add(type.name);
|
|
58742
59127
|
}
|
|
58743
|
-
result =
|
|
59128
|
+
result = AST11.tsTypeReference(AST11.identifier(type.name));
|
|
58744
59129
|
} else if (selections) {
|
|
58745
59130
|
const rootObj = type;
|
|
58746
59131
|
const inlineFragments = {};
|
|
@@ -58748,11 +59133,11 @@ function inlineType({
|
|
|
58748
59133
|
for (const selection2 of selections) {
|
|
58749
59134
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
58750
59135
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
58751
|
-
if (!
|
|
59136
|
+
if (!graphql17.isInterfaceType(type) && !graphql17.isUnionType(type)) {
|
|
58752
59137
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
58753
59138
|
continue;
|
|
58754
59139
|
}
|
|
58755
|
-
if (!
|
|
59140
|
+
if (!graphql17.isInterfaceType(fragmentType) && !graphql17.isUnionType(fragmentType)) {
|
|
58756
59141
|
if (!inlineFragments[fragmentType.name]) {
|
|
58757
59142
|
inlineFragments[fragmentType.name] = [];
|
|
58758
59143
|
}
|
|
@@ -58791,7 +59176,7 @@ function inlineType({
|
|
|
58791
59176
|
selectedFields.push(selection2);
|
|
58792
59177
|
}
|
|
58793
59178
|
}
|
|
58794
|
-
result =
|
|
59179
|
+
result = AST11.tsTypeLiteral([
|
|
58795
59180
|
...(selectedFields || []).filter(
|
|
58796
59181
|
(field) => field.kind === "Field"
|
|
58797
59182
|
).map((selection2) => {
|
|
@@ -58811,9 +59196,9 @@ function inlineType({
|
|
|
58811
59196
|
allOptional
|
|
58812
59197
|
});
|
|
58813
59198
|
const prop = readonlyProperty(
|
|
58814
|
-
|
|
58815
|
-
|
|
58816
|
-
|
|
59199
|
+
AST11.tsPropertySignature(
|
|
59200
|
+
AST11.identifier(attributeName),
|
|
59201
|
+
AST11.tsTypeAnnotation(attributeType)
|
|
58817
59202
|
),
|
|
58818
59203
|
allowReadonly
|
|
58819
59204
|
);
|
|
@@ -58827,15 +59212,15 @@ function inlineType({
|
|
|
58827
59212
|
if (includeFragments && fragmentSpreads && fragmentSpreads.length) {
|
|
58828
59213
|
result.members.push(
|
|
58829
59214
|
readonlyProperty(
|
|
58830
|
-
|
|
58831
|
-
|
|
58832
|
-
|
|
58833
|
-
|
|
59215
|
+
AST11.tsPropertySignature(
|
|
59216
|
+
AST11.identifier(fragmentKey),
|
|
59217
|
+
AST11.tsTypeAnnotation(
|
|
59218
|
+
AST11.tsTypeLiteral(
|
|
58834
59219
|
(fragmentSpreads || []).map(
|
|
58835
|
-
(fragmentSpread) =>
|
|
58836
|
-
|
|
58837
|
-
|
|
58838
|
-
|
|
59220
|
+
(fragmentSpread) => AST11.tsPropertySignature(
|
|
59221
|
+
AST11.identifier(fragmentSpread.name.value),
|
|
59222
|
+
AST11.tsTypeAnnotation(
|
|
59223
|
+
AST11.tsLiteralType(AST11.booleanLiteral(true))
|
|
58839
59224
|
)
|
|
58840
59225
|
)
|
|
58841
59226
|
)
|
|
@@ -58872,7 +59257,7 @@ function inlineType({
|
|
|
58872
59257
|
}
|
|
58873
59258
|
}
|
|
58874
59259
|
}
|
|
58875
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
59260
|
+
if (objectType.type === "TSTypeLiteral" && !graphql17.isInterfaceType(fragmentRootType) && !graphql17.isUnionType(fragmentRootType)) {
|
|
58876
59261
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
58877
59262
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
58878
59263
|
);
|
|
@@ -58881,9 +59266,9 @@ function inlineType({
|
|
|
58881
59266
|
}
|
|
58882
59267
|
objectType.members.push(
|
|
58883
59268
|
readonlyProperty(
|
|
58884
|
-
|
|
58885
|
-
|
|
58886
|
-
|
|
59269
|
+
AST11.tsPropertySignature(
|
|
59270
|
+
AST11.identifier("__typename"),
|
|
59271
|
+
AST11.tsTypeAnnotation(AST11.tsLiteralType(AST11.stringLiteral(typeName)))
|
|
58887
59272
|
),
|
|
58888
59273
|
allowReadonly
|
|
58889
59274
|
)
|
|
@@ -58894,8 +59279,8 @@ function inlineType({
|
|
|
58894
59279
|
if (Object.keys(inlineFragmentSelections).length > 0) {
|
|
58895
59280
|
let selectionTypes = Object.entries(inlineFragmentSelections).map(
|
|
58896
59281
|
([typeName, { type: type2, tsType }]) => {
|
|
58897
|
-
return
|
|
58898
|
-
|
|
59282
|
+
return AST11.tsParenthesizedType(
|
|
59283
|
+
AST11.tsIntersectionType(
|
|
58899
59284
|
[tsType].flatMap((type3) => {
|
|
58900
59285
|
if (type3.type === "TSUnionType") {
|
|
58901
59286
|
return type3.types.filter(
|
|
@@ -58908,9 +59293,9 @@ function inlineType({
|
|
|
58908
59293
|
);
|
|
58909
59294
|
}
|
|
58910
59295
|
);
|
|
58911
|
-
result =
|
|
59296
|
+
result = AST11.tsIntersectionType([
|
|
58912
59297
|
result,
|
|
58913
|
-
|
|
59298
|
+
AST11.tsParenthesizedType(AST11.tsUnionType(selectionTypes))
|
|
58914
59299
|
]);
|
|
58915
59300
|
}
|
|
58916
59301
|
} else {
|
|
@@ -58922,7 +59307,7 @@ function inlineType({
|
|
|
58922
59307
|
} else if (toWrap === "NonNull" /* NonNull */) {
|
|
58923
59308
|
continue;
|
|
58924
59309
|
} else if (toWrap === "List" /* List */) {
|
|
58925
|
-
result =
|
|
59310
|
+
result = AST11.tsArrayType(AST11.tsParenthesizedType(result));
|
|
58926
59311
|
}
|
|
58927
59312
|
}
|
|
58928
59313
|
return result;
|
|
@@ -58939,7 +59324,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58939
59324
|
},
|
|
58940
59325
|
type: schema.getType("String")
|
|
58941
59326
|
};
|
|
58942
|
-
} else if (
|
|
59327
|
+
} else if (graphql17.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
58943
59328
|
fields = rootType.ofType.getFields();
|
|
58944
59329
|
} else {
|
|
58945
59330
|
fields = rootType.getFields();
|
|
@@ -58951,7 +59336,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58951
59336
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
58952
59337
|
});
|
|
58953
59338
|
}
|
|
58954
|
-
const fieldType =
|
|
59339
|
+
const fieldType = graphql17.getNamedType(field.type);
|
|
58955
59340
|
if (!fieldType) {
|
|
58956
59341
|
throw new HoudiniError({
|
|
58957
59342
|
filepath,
|
|
@@ -58967,7 +59352,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58967
59352
|
}
|
|
58968
59353
|
|
|
58969
59354
|
// src/codegen/generators/typescript/index.ts
|
|
58970
|
-
var
|
|
59355
|
+
var AST12 = recast12.types.builders;
|
|
58971
59356
|
async function typescriptGenerator(config2, docs) {
|
|
58972
59357
|
const typePaths = [];
|
|
58973
59358
|
const fragmentDefinitions = {};
|
|
@@ -58985,7 +59370,7 @@ async function typescriptGenerator(config2, docs) {
|
|
|
58985
59370
|
return;
|
|
58986
59371
|
}
|
|
58987
59372
|
const typeDefPath = config2.artifactTypePath(originalDocument);
|
|
58988
|
-
const program =
|
|
59373
|
+
const program = AST12.program([]);
|
|
58989
59374
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58990
59375
|
let definition = originalDocument.definitions.find(
|
|
58991
59376
|
(def) => (def.kind === "OperationDefinition" || def.kind === "FragmentDefinition") && def.name?.value === name2
|
|
@@ -59018,21 +59403,21 @@ async function typescriptGenerator(config2, docs) {
|
|
|
59018
59403
|
missingScalars
|
|
59019
59404
|
);
|
|
59020
59405
|
}
|
|
59021
|
-
await fs_exports.writeFile(typeDefPath,
|
|
59406
|
+
await fs_exports.writeFile(typeDefPath, recast12.print(program).code);
|
|
59022
59407
|
typePaths.push(typeDefPath);
|
|
59023
59408
|
})
|
|
59024
59409
|
);
|
|
59025
|
-
const typeIndex =
|
|
59410
|
+
const typeIndex = AST12.program(
|
|
59026
59411
|
typePaths.sort((a, b) => a.localeCompare(b)).map((typePath) => {
|
|
59027
|
-
return
|
|
59028
|
-
|
|
59412
|
+
return AST12.exportAllDeclaration(
|
|
59413
|
+
AST12.literal(
|
|
59029
59414
|
"./" + path_exports.relative(path_exports.resolve(config2.typeIndexPath, ".."), typePath).replace(/\.[^/.]+\.[^/.]+$/, "")
|
|
59030
59415
|
),
|
|
59031
59416
|
null
|
|
59032
59417
|
);
|
|
59033
59418
|
}).concat([
|
|
59034
|
-
|
|
59035
|
-
|
|
59419
|
+
AST12.exportAllDeclaration(AST12.literal("./runtime"), null),
|
|
59420
|
+
AST12.exportAllDeclaration(AST12.literal("./graphql"), null)
|
|
59036
59421
|
])
|
|
59037
59422
|
);
|
|
59038
59423
|
const export_default_as = ({ module, as }) => `
|
|
@@ -59041,7 +59426,7 @@ export { default as ${as} } from "${module}"
|
|
|
59041
59426
|
const export_star_from = ({ module }) => `
|
|
59042
59427
|
export * from "${module}"
|
|
59043
59428
|
`;
|
|
59044
|
-
let indexContent =
|
|
59429
|
+
let indexContent = recast12.print(typeIndex).code;
|
|
59045
59430
|
for (const plugin of config2.plugins) {
|
|
59046
59431
|
if (!plugin.index_file) {
|
|
59047
59432
|
continue;
|
|
@@ -59062,6 +59447,7 @@ export * from "${module}"
|
|
|
59062
59447
|
}
|
|
59063
59448
|
}
|
|
59064
59449
|
await fs_exports.writeFile(config2.typeIndexPath, indexContent);
|
|
59450
|
+
await imperativeCacheTypef(config2, docs);
|
|
59065
59451
|
if (missingScalars.size > 0) {
|
|
59066
59452
|
console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
|
|
59067
59453
|
", "
|
|
@@ -59103,23 +59489,23 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59103
59489
|
const optimisticTypeName = `${definition.name.value}$optimistic`;
|
|
59104
59490
|
const hasInputs = definition.variableDefinitions && definition.variableDefinitions.length > 0;
|
|
59105
59491
|
body.push(
|
|
59106
|
-
|
|
59107
|
-
|
|
59108
|
-
|
|
59109
|
-
|
|
59492
|
+
AST12.exportNamedDeclaration(
|
|
59493
|
+
AST12.tsTypeAliasDeclaration(
|
|
59494
|
+
AST12.identifier(definition.name.value),
|
|
59495
|
+
AST12.tsTypeLiteral([
|
|
59110
59496
|
readonlyProperty(
|
|
59111
|
-
|
|
59112
|
-
|
|
59113
|
-
|
|
59497
|
+
AST12.tsPropertySignature(
|
|
59498
|
+
AST12.stringLiteral("input"),
|
|
59499
|
+
AST12.tsTypeAnnotation(AST12.tsTypeReference(AST12.identifier(inputTypeName)))
|
|
59114
59500
|
)
|
|
59115
59501
|
),
|
|
59116
59502
|
readonlyProperty(
|
|
59117
|
-
|
|
59118
|
-
|
|
59119
|
-
|
|
59120
|
-
definition.operation === "mutation" ?
|
|
59121
|
-
|
|
59122
|
-
|
|
59503
|
+
AST12.tsPropertySignature(
|
|
59504
|
+
AST12.stringLiteral("result"),
|
|
59505
|
+
AST12.tsTypeAnnotation(
|
|
59506
|
+
definition.operation === "mutation" ? AST12.tsTypeReference(AST12.identifier(shapeTypeName)) : AST12.tsUnionType([
|
|
59507
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName)),
|
|
59508
|
+
AST12.tsUndefinedKeyword()
|
|
59123
59509
|
])
|
|
59124
59510
|
)
|
|
59125
59511
|
)
|
|
@@ -59127,9 +59513,9 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59127
59513
|
])
|
|
59128
59514
|
)
|
|
59129
59515
|
),
|
|
59130
|
-
|
|
59131
|
-
|
|
59132
|
-
|
|
59516
|
+
AST12.exportNamedDeclaration(
|
|
59517
|
+
AST12.tsTypeAliasDeclaration(
|
|
59518
|
+
AST12.identifier(shapeTypeName),
|
|
59133
59519
|
inlineType({
|
|
59134
59520
|
config: config2,
|
|
59135
59521
|
filepath,
|
|
@@ -59157,15 +59543,15 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59157
59543
|
);
|
|
59158
59544
|
}
|
|
59159
59545
|
body.push(
|
|
59160
|
-
|
|
59161
|
-
|
|
59162
|
-
|
|
59163
|
-
|
|
59546
|
+
AST12.exportNamedDeclaration(
|
|
59547
|
+
AST12.tsTypeAliasDeclaration(
|
|
59548
|
+
AST12.identifier(inputTypeName),
|
|
59549
|
+
AST12.tsTypeLiteral(
|
|
59164
59550
|
(definition.variableDefinitions || []).map(
|
|
59165
59551
|
(definition2) => {
|
|
59166
|
-
return
|
|
59167
|
-
|
|
59168
|
-
|
|
59552
|
+
return AST12.tsPropertySignature(
|
|
59553
|
+
AST12.identifier(definition2.variable.name.value),
|
|
59554
|
+
AST12.tsTypeAnnotation(
|
|
59169
59555
|
tsTypeReference(config2, missingScalars, definition2)
|
|
59170
59556
|
),
|
|
59171
59557
|
definition2.type.kind !== "NonNullType"
|
|
@@ -59178,16 +59564,16 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
59178
59564
|
);
|
|
59179
59565
|
} else {
|
|
59180
59566
|
body.push(
|
|
59181
|
-
|
|
59182
|
-
|
|
59567
|
+
AST12.exportNamedDeclaration(
|
|
59568
|
+
AST12.tsTypeAliasDeclaration(AST12.identifier(inputTypeName), AST12.tsNullKeyword())
|
|
59183
59569
|
)
|
|
59184
59570
|
);
|
|
59185
59571
|
}
|
|
59186
59572
|
if (definition.operation === "mutation") {
|
|
59187
59573
|
body.push(
|
|
59188
|
-
|
|
59189
|
-
|
|
59190
|
-
|
|
59574
|
+
AST12.exportNamedDeclaration(
|
|
59575
|
+
AST12.tsTypeAliasDeclaration(
|
|
59576
|
+
AST12.identifier(optimisticTypeName),
|
|
59191
59577
|
inlineType({
|
|
59192
59578
|
config: config2,
|
|
59193
59579
|
filepath,
|
|
@@ -59218,28 +59604,28 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59218
59604
|
throw new Error("Should not get here");
|
|
59219
59605
|
}
|
|
59220
59606
|
body.push(
|
|
59221
|
-
|
|
59222
|
-
|
|
59223
|
-
|
|
59224
|
-
|
|
59607
|
+
AST12.exportNamedDeclaration(
|
|
59608
|
+
AST12.tsTypeAliasDeclaration(
|
|
59609
|
+
AST12.identifier(propTypeName),
|
|
59610
|
+
AST12.tsTypeLiteral([
|
|
59225
59611
|
readonlyProperty(
|
|
59226
|
-
|
|
59227
|
-
|
|
59228
|
-
|
|
59229
|
-
|
|
59612
|
+
AST12.tsPropertySignature(
|
|
59613
|
+
AST12.stringLiteral("shape"),
|
|
59614
|
+
AST12.tsTypeAnnotation(
|
|
59615
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName))
|
|
59230
59616
|
),
|
|
59231
59617
|
true
|
|
59232
59618
|
)
|
|
59233
59619
|
),
|
|
59234
59620
|
readonlyProperty(
|
|
59235
|
-
|
|
59236
|
-
|
|
59237
|
-
|
|
59238
|
-
|
|
59239
|
-
|
|
59240
|
-
|
|
59241
|
-
|
|
59242
|
-
|
|
59621
|
+
AST12.tsPropertySignature(
|
|
59622
|
+
AST12.stringLiteral(fragmentKey),
|
|
59623
|
+
AST12.tsTypeAnnotation(
|
|
59624
|
+
AST12.tsTypeLiteral([
|
|
59625
|
+
AST12.tsPropertySignature(
|
|
59626
|
+
AST12.stringLiteral(propTypeName),
|
|
59627
|
+
AST12.tsTypeAnnotation(
|
|
59628
|
+
AST12.tsLiteralType(AST12.booleanLiteral(true))
|
|
59243
59629
|
)
|
|
59244
59630
|
)
|
|
59245
59631
|
])
|
|
@@ -59249,9 +59635,9 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59249
59635
|
])
|
|
59250
59636
|
)
|
|
59251
59637
|
),
|
|
59252
|
-
|
|
59253
|
-
|
|
59254
|
-
|
|
59638
|
+
AST12.exportNamedDeclaration(
|
|
59639
|
+
AST12.tsTypeAliasDeclaration(
|
|
59640
|
+
AST12.identifier(shapeTypeName),
|
|
59255
59641
|
inlineType({
|
|
59256
59642
|
config: config2,
|
|
59257
59643
|
filepath,
|
|
@@ -59271,7 +59657,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59271
59657
|
}
|
|
59272
59658
|
|
|
59273
59659
|
// src/codegen/generators/persistedQueries/index.ts
|
|
59274
|
-
var
|
|
59660
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
59275
59661
|
async function persistOutputGenerator(config2, docs) {
|
|
59276
59662
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
59277
59663
|
return;
|
|
@@ -59283,8 +59669,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59283
59669
|
if (!generateArtifact) {
|
|
59284
59670
|
return acc;
|
|
59285
59671
|
}
|
|
59286
|
-
let rawString =
|
|
59287
|
-
|
|
59672
|
+
let rawString = graphql18.print(
|
|
59673
|
+
graphql18.visit(document, {
|
|
59288
59674
|
Directive(node) {
|
|
59289
59675
|
if (config2.isInternalDirective(node)) {
|
|
59290
59676
|
return null;
|
|
@@ -59293,7 +59679,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59293
59679
|
})
|
|
59294
59680
|
);
|
|
59295
59681
|
const operations = document.definitions.filter(
|
|
59296
|
-
({ kind }) => kind ===
|
|
59682
|
+
({ kind }) => kind === graphql18.Kind.OPERATION_DEFINITION
|
|
59297
59683
|
);
|
|
59298
59684
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
59299
59685
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -59306,26 +59692,26 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59306
59692
|
}
|
|
59307
59693
|
|
|
59308
59694
|
// src/codegen/generators/definitions/enums.ts
|
|
59309
|
-
var
|
|
59310
|
-
var
|
|
59311
|
-
var
|
|
59695
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
59696
|
+
var recast13 = __toESM(require_main2(), 1);
|
|
59697
|
+
var AST13 = recast13.types.builders;
|
|
59312
59698
|
async function definitionsGenerator(config2) {
|
|
59313
|
-
const enums =
|
|
59699
|
+
const enums = graphql19.parse(graphql19.printSchema(config2.schema)).definitions.filter(
|
|
59314
59700
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
59315
59701
|
).filter((def) => !config2.isInternalEnum(def));
|
|
59316
|
-
const runtimeDefinitions =
|
|
59317
|
-
|
|
59702
|
+
const runtimeDefinitions = recast13.print(
|
|
59703
|
+
AST13.program(
|
|
59318
59704
|
enums.map((defn) => {
|
|
59319
59705
|
const name2 = defn.name.value;
|
|
59320
59706
|
return moduleExport(
|
|
59321
59707
|
config2,
|
|
59322
59708
|
name2,
|
|
59323
|
-
|
|
59709
|
+
AST13.objectExpression(
|
|
59324
59710
|
defn.values?.map((value) => {
|
|
59325
59711
|
const str = value.name.value;
|
|
59326
|
-
return
|
|
59327
|
-
|
|
59328
|
-
|
|
59712
|
+
return AST13.objectProperty(
|
|
59713
|
+
AST13.stringLiteral(str),
|
|
59714
|
+
AST13.stringLiteral(str)
|
|
59329
59715
|
);
|
|
59330
59716
|
}) || []
|
|
59331
59717
|
)
|
|
@@ -59333,7 +59719,7 @@ async function definitionsGenerator(config2) {
|
|
|
59333
59719
|
})
|
|
59334
59720
|
)
|
|
59335
59721
|
).code;
|
|
59336
|
-
const
|
|
59722
|
+
const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
|
|
59337
59723
|
(definition) => `
|
|
59338
59724
|
export declare enum ${definition.name.value} {
|
|
59339
59725
|
${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
|
|
@@ -59344,7 +59730,7 @@ ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.val
|
|
|
59344
59730
|
export * from './enums.js'
|
|
59345
59731
|
`;
|
|
59346
59732
|
await Promise.all([
|
|
59347
|
-
fs_exports.writeFile(config2.enumTypesDefinitionsPath,
|
|
59733
|
+
fs_exports.writeFile(config2.enumTypesDefinitionsPath, typeDefinitions2),
|
|
59348
59734
|
fs_exports.writeFile(config2.enumRuntimeDefinitionsPath, runtimeDefinitions),
|
|
59349
59735
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.js"), definitionsIndex),
|
|
59350
59736
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.d.ts"), definitionsIndex)
|
|
@@ -59483,7 +59869,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59483
59869
|
}
|
|
59484
59870
|
|
|
59485
59871
|
// src/codegen/transforms/schema.ts
|
|
59486
|
-
var
|
|
59872
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
59487
59873
|
async function graphqlExtensions(config2, documents) {
|
|
59488
59874
|
const internalSchema = `
|
|
59489
59875
|
enum CachePolicy {
|
|
@@ -59561,19 +59947,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59561
59947
|
"""
|
|
59562
59948
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59563
59949
|
`;
|
|
59564
|
-
let currentSchema =
|
|
59950
|
+
let currentSchema = graphql21.printSchema(config2.schema);
|
|
59565
59951
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59566
59952
|
currentSchema += internalSchema;
|
|
59567
59953
|
}
|
|
59568
59954
|
config2.newSchema += internalSchema;
|
|
59569
|
-
config2.schema =
|
|
59955
|
+
config2.schema = graphql21.buildSchema(currentSchema);
|
|
59570
59956
|
}
|
|
59571
59957
|
|
|
59572
59958
|
// src/codegen/transforms/typename.ts
|
|
59573
|
-
var
|
|
59959
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
59574
59960
|
async function addTypename(config2, documents) {
|
|
59575
59961
|
for (const doc of documents) {
|
|
59576
|
-
doc.document =
|
|
59962
|
+
doc.document = graphql22.visit(doc.document, {
|
|
59577
59963
|
Field(node, key, parent, path2, ancestors) {
|
|
59578
59964
|
if (!node.selectionSet) {
|
|
59579
59965
|
return;
|
|
@@ -59585,7 +59971,7 @@ async function addTypename(config2, documents) {
|
|
|
59585
59971
|
);
|
|
59586
59972
|
const field = type.getFields()[node.name.value];
|
|
59587
59973
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59588
|
-
if (
|
|
59974
|
+
if (graphql22.isInterfaceType(fieldType) || graphql22.isUnionType(fieldType)) {
|
|
59589
59975
|
return {
|
|
59590
59976
|
...node,
|
|
59591
59977
|
selectionSet: {
|
|
@@ -59593,9 +59979,9 @@ async function addTypename(config2, documents) {
|
|
|
59593
59979
|
selections: [
|
|
59594
59980
|
...node.selectionSet.selections,
|
|
59595
59981
|
{
|
|
59596
|
-
kind:
|
|
59982
|
+
kind: graphql22.Kind.FIELD,
|
|
59597
59983
|
name: {
|
|
59598
|
-
kind:
|
|
59984
|
+
kind: graphql22.Kind.NAME,
|
|
59599
59985
|
value: "__typename"
|
|
59600
59986
|
}
|
|
59601
59987
|
}
|
|
@@ -59609,10 +59995,10 @@ async function addTypename(config2, documents) {
|
|
|
59609
59995
|
}
|
|
59610
59996
|
|
|
59611
59997
|
// src/codegen/transforms/addID.ts
|
|
59612
|
-
var
|
|
59998
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
59613
59999
|
async function addID(config2, documents) {
|
|
59614
60000
|
for (const doc of documents) {
|
|
59615
|
-
doc.document =
|
|
60001
|
+
doc.document = graphql23.visit(doc.document, {
|
|
59616
60002
|
Field(node, key, parent, path2, ancestors) {
|
|
59617
60003
|
if (!node.selectionSet) {
|
|
59618
60004
|
return;
|
|
@@ -59625,7 +60011,7 @@ async function addID(config2, documents) {
|
|
|
59625
60011
|
const field = type.getFields()[node.name.value];
|
|
59626
60012
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59627
60013
|
if (node.selectionSet?.selections.length > 0) {
|
|
59628
|
-
if (!
|
|
60014
|
+
if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
|
|
59629
60015
|
return;
|
|
59630
60016
|
}
|
|
59631
60017
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -59640,9 +60026,9 @@ async function addID(config2, documents) {
|
|
|
59640
60026
|
continue;
|
|
59641
60027
|
}
|
|
59642
60028
|
selections.push({
|
|
59643
|
-
kind:
|
|
60029
|
+
kind: graphql23.Kind.FIELD,
|
|
59644
60030
|
name: {
|
|
59645
|
-
kind:
|
|
60031
|
+
kind: graphql23.Kind.NAME,
|
|
59646
60032
|
value: keyField
|
|
59647
60033
|
}
|
|
59648
60034
|
});
|
|
@@ -59661,8 +60047,8 @@ async function addID(config2, documents) {
|
|
|
59661
60047
|
}
|
|
59662
60048
|
|
|
59663
60049
|
// src/codegen/transforms/fragmentVariables.ts
|
|
59664
|
-
var
|
|
59665
|
-
var GraphqlKinds2 =
|
|
60050
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
60051
|
+
var GraphqlKinds2 = graphql24.Kind;
|
|
59666
60052
|
async function fragmentVariables(config2, documents) {
|
|
59667
60053
|
const fragments = collectFragments(config2, documents);
|
|
59668
60054
|
const generatedFragments = {};
|
|
@@ -59685,7 +60071,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
59685
60071
|
});
|
|
59686
60072
|
}
|
|
59687
60073
|
const doc = {
|
|
59688
|
-
kind:
|
|
60074
|
+
kind: graphql24.Kind.DOCUMENT,
|
|
59689
60075
|
definitions: Object.values(generatedFragments)
|
|
59690
60076
|
};
|
|
59691
60077
|
documents.push({
|
|
@@ -59721,7 +60107,7 @@ function inlineFragmentArgs({
|
|
|
59721
60107
|
filepath,
|
|
59722
60108
|
document
|
|
59723
60109
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
59724
|
-
const result =
|
|
60110
|
+
const result = graphql24.visit(document, {
|
|
59725
60111
|
FragmentSpread(node) {
|
|
59726
60112
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
59727
60113
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -59809,7 +60195,7 @@ function inlineFragmentArgs({
|
|
|
59809
60195
|
});
|
|
59810
60196
|
if (newName) {
|
|
59811
60197
|
result.name = {
|
|
59812
|
-
kind:
|
|
60198
|
+
kind: graphql24.Kind.NAME,
|
|
59813
60199
|
value: newName
|
|
59814
60200
|
};
|
|
59815
60201
|
}
|
|
@@ -59921,7 +60307,7 @@ function operationScope(operation) {
|
|
|
59921
60307
|
}
|
|
59922
60308
|
|
|
59923
60309
|
// src/codegen/validators/typeCheck.ts
|
|
59924
|
-
var
|
|
60310
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
59925
60311
|
async function typeCheck(config2, docs) {
|
|
59926
60312
|
const errors = [];
|
|
59927
60313
|
const freeLists = [];
|
|
@@ -59929,11 +60315,11 @@ async function typeCheck(config2, docs) {
|
|
|
59929
60315
|
const listTypes = [];
|
|
59930
60316
|
const fragments = {};
|
|
59931
60317
|
for (const { document: parsed, filename } of docs) {
|
|
59932
|
-
|
|
59933
|
-
[
|
|
60318
|
+
graphql25.visit(parsed, {
|
|
60319
|
+
[graphql25.Kind.FRAGMENT_DEFINITION](definition) {
|
|
59934
60320
|
fragments[definition.name.value] = definition;
|
|
59935
60321
|
},
|
|
59936
|
-
[
|
|
60322
|
+
[graphql25.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
59937
60323
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
59938
60324
|
return;
|
|
59939
60325
|
}
|
|
@@ -59979,14 +60365,14 @@ async function typeCheck(config2, docs) {
|
|
|
59979
60365
|
);
|
|
59980
60366
|
return;
|
|
59981
60367
|
}
|
|
59982
|
-
if (
|
|
60368
|
+
if (graphql25.isListType(rootType) || graphql25.isNonNullType(rootType) && graphql25.isListType(rootType.ofType)) {
|
|
59983
60369
|
needsParent = true;
|
|
59984
60370
|
break;
|
|
59985
60371
|
}
|
|
59986
|
-
if (
|
|
60372
|
+
if (graphql25.isNonNullType(rootType) && "ofType" in rootType) {
|
|
59987
60373
|
rootType = rootType.ofType;
|
|
59988
60374
|
}
|
|
59989
|
-
if (
|
|
60375
|
+
if (graphql25.isScalarType(rootType)) {
|
|
59990
60376
|
break;
|
|
59991
60377
|
}
|
|
59992
60378
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -60062,9 +60448,9 @@ async function typeCheck(config2, docs) {
|
|
|
60062
60448
|
);
|
|
60063
60449
|
}
|
|
60064
60450
|
let targetTypes = [type];
|
|
60065
|
-
if (
|
|
60451
|
+
if (graphql25.isUnionType(type)) {
|
|
60066
60452
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
60067
|
-
} else if (
|
|
60453
|
+
} else if (graphql25.isInterfaceType(type)) {
|
|
60068
60454
|
try {
|
|
60069
60455
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
60070
60456
|
if (!type.getFields()[key]) {
|
|
@@ -60102,13 +60488,13 @@ async function typeCheck(config2, docs) {
|
|
|
60102
60488
|
if (errors.length > 0) {
|
|
60103
60489
|
throw errors;
|
|
60104
60490
|
}
|
|
60105
|
-
const rules = (filepath) => [...
|
|
60491
|
+
const rules = (filepath) => [...graphql25.specifiedRules].filter(
|
|
60106
60492
|
(rule) => ![
|
|
60107
|
-
|
|
60108
|
-
|
|
60109
|
-
|
|
60110
|
-
|
|
60111
|
-
|
|
60493
|
+
graphql25.NoUnusedFragmentsRule,
|
|
60494
|
+
graphql25.KnownFragmentNamesRule,
|
|
60495
|
+
graphql25.ExecutableDefinitionsRule,
|
|
60496
|
+
graphql25.KnownDirectivesRule,
|
|
60497
|
+
graphql25.KnownArgumentNamesRule
|
|
60112
60498
|
].includes(rule)
|
|
60113
60499
|
).concat(
|
|
60114
60500
|
validateLists({
|
|
@@ -60127,7 +60513,7 @@ async function typeCheck(config2, docs) {
|
|
|
60127
60513
|
noUnusedFragmentArguments(config2)
|
|
60128
60514
|
);
|
|
60129
60515
|
for (const { filename, document: parsed } of docs) {
|
|
60130
|
-
for (const error of
|
|
60516
|
+
for (const error of graphql25.validate(config2.schema, parsed, rules(filename))) {
|
|
60131
60517
|
errors.push(
|
|
60132
60518
|
new HoudiniError({
|
|
60133
60519
|
filepath: filename,
|
|
@@ -60153,7 +60539,7 @@ var validateLists = ({
|
|
|
60153
60539
|
if (!config2.isListFragment(node.name.value)) {
|
|
60154
60540
|
if (!fragments[node.name.value]) {
|
|
60155
60541
|
ctx.reportError(
|
|
60156
|
-
new
|
|
60542
|
+
new graphql25.GraphQLError(
|
|
60157
60543
|
"Encountered unknown fragment: " + node.name.value
|
|
60158
60544
|
)
|
|
60159
60545
|
);
|
|
@@ -60163,7 +60549,7 @@ var validateLists = ({
|
|
|
60163
60549
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
60164
60550
|
if (!lists.includes(listName)) {
|
|
60165
60551
|
ctx.reportError(
|
|
60166
|
-
new
|
|
60552
|
+
new graphql25.GraphQLError(
|
|
60167
60553
|
"Encountered fragment referencing unknown list: " + listName
|
|
60168
60554
|
)
|
|
60169
60555
|
);
|
|
@@ -60188,7 +60574,7 @@ var validateLists = ({
|
|
|
60188
60574
|
);
|
|
60189
60575
|
if (parentArg) {
|
|
60190
60576
|
ctx.reportError(
|
|
60191
|
-
new
|
|
60577
|
+
new graphql25.GraphQLError(
|
|
60192
60578
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
60193
60579
|
)
|
|
60194
60580
|
);
|
|
@@ -60204,7 +60590,7 @@ var validateLists = ({
|
|
|
60204
60590
|
return;
|
|
60205
60591
|
}
|
|
60206
60592
|
ctx.reportError(
|
|
60207
|
-
new
|
|
60593
|
+
new graphql25.GraphQLError(
|
|
60208
60594
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
60209
60595
|
)
|
|
60210
60596
|
);
|
|
@@ -60214,7 +60600,7 @@ var validateLists = ({
|
|
|
60214
60600
|
const directiveName = node.name.value;
|
|
60215
60601
|
if (directiveName === "connection") {
|
|
60216
60602
|
ctx.reportError(
|
|
60217
|
-
new
|
|
60603
|
+
new graphql25.GraphQLError(
|
|
60218
60604
|
"@connection was renamed to @list. Please change your components. If you were using `cache.connection` in your components, you will need to update that to `cache.list` too."
|
|
60219
60605
|
)
|
|
60220
60606
|
);
|
|
@@ -60223,7 +60609,7 @@ var validateLists = ({
|
|
|
60223
60609
|
if (!config2.isInternalDirective(node)) {
|
|
60224
60610
|
if (!config2.schema.getDirective(directiveName)) {
|
|
60225
60611
|
ctx.reportError(
|
|
60226
|
-
new
|
|
60612
|
+
new graphql25.GraphQLError(
|
|
60227
60613
|
"Encountered unknown directive: " + directiveName
|
|
60228
60614
|
)
|
|
60229
60615
|
);
|
|
@@ -60232,7 +60618,7 @@ var validateLists = ({
|
|
|
60232
60618
|
}
|
|
60233
60619
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
60234
60620
|
ctx.reportError(
|
|
60235
|
-
new
|
|
60621
|
+
new graphql25.GraphQLError(
|
|
60236
60622
|
"Encountered directive referencing unknown list: " + directiveName
|
|
60237
60623
|
)
|
|
60238
60624
|
);
|
|
@@ -60243,7 +60629,7 @@ var validateLists = ({
|
|
|
60243
60629
|
};
|
|
60244
60630
|
function knownArguments(config2) {
|
|
60245
60631
|
return function(ctx) {
|
|
60246
|
-
const nativeValidator =
|
|
60632
|
+
const nativeValidator = graphql25.KnownArgumentNamesRule(ctx);
|
|
60247
60633
|
return {
|
|
60248
60634
|
...nativeValidator,
|
|
60249
60635
|
Directive(directiveNode) {
|
|
@@ -60276,7 +60662,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60276
60662
|
for (const arg of node.arguments || []) {
|
|
60277
60663
|
if (arg.value.kind !== "ObjectValue") {
|
|
60278
60664
|
ctx.reportError(
|
|
60279
|
-
new
|
|
60665
|
+
new graphql25.GraphQLError("values in @arguments must be an object")
|
|
60280
60666
|
);
|
|
60281
60667
|
return;
|
|
60282
60668
|
}
|
|
@@ -60286,13 +60672,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60286
60672
|
);
|
|
60287
60673
|
if (!typeArg) {
|
|
60288
60674
|
ctx.reportError(
|
|
60289
|
-
new
|
|
60675
|
+
new graphql25.GraphQLError("missing type field for @arguments directive")
|
|
60290
60676
|
);
|
|
60291
60677
|
return;
|
|
60292
60678
|
}
|
|
60293
|
-
if (typeArg.value.kind !==
|
|
60679
|
+
if (typeArg.value.kind !== graphql25.Kind.STRING) {
|
|
60294
60680
|
ctx.reportError(
|
|
60295
|
-
new
|
|
60681
|
+
new graphql25.GraphQLError("type field to @arguments must be a string")
|
|
60296
60682
|
);
|
|
60297
60683
|
return;
|
|
60298
60684
|
}
|
|
@@ -60305,7 +60691,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60305
60691
|
);
|
|
60306
60692
|
if (typeArg.value.value !== defaultValueType) {
|
|
60307
60693
|
ctx.reportError(
|
|
60308
|
-
new
|
|
60694
|
+
new graphql25.GraphQLError(
|
|
60309
60695
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60310
60696
|
)
|
|
60311
60697
|
);
|
|
@@ -60323,7 +60709,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60323
60709
|
try {
|
|
60324
60710
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60325
60711
|
} catch (e) {
|
|
60326
|
-
ctx.reportError(new
|
|
60712
|
+
ctx.reportError(new graphql25.GraphQLError(e.message));
|
|
60327
60713
|
return;
|
|
60328
60714
|
}
|
|
60329
60715
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60346,7 +60732,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60346
60732
|
);
|
|
60347
60733
|
if (missing.length > 0) {
|
|
60348
60734
|
ctx.reportError(
|
|
60349
|
-
new
|
|
60735
|
+
new graphql25.GraphQLError(
|
|
60350
60736
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60351
60737
|
)
|
|
60352
60738
|
);
|
|
@@ -60357,7 +60743,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60357
60743
|
);
|
|
60358
60744
|
if (unknown.length > 0) {
|
|
60359
60745
|
ctx.reportError(
|
|
60360
|
-
new
|
|
60746
|
+
new graphql25.GraphQLError(
|
|
60361
60747
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60362
60748
|
)
|
|
60363
60749
|
);
|
|
@@ -60369,7 +60755,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60369
60755
|
]
|
|
60370
60756
|
);
|
|
60371
60757
|
for (const [applied, target] of zipped) {
|
|
60372
|
-
if (applied.value.kind ===
|
|
60758
|
+
if (applied.value.kind === graphql25.Kind.VARIABLE || applied.value.kind === graphql25.Kind.LIST || applied.value.kind === graphql25.Kind.OBJECT) {
|
|
60373
60759
|
continue;
|
|
60374
60760
|
}
|
|
60375
60761
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60378,7 +60764,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60378
60764
|
);
|
|
60379
60765
|
if (appliedType !== target) {
|
|
60380
60766
|
ctx.reportError(
|
|
60381
|
-
new
|
|
60767
|
+
new graphql25.GraphQLError(
|
|
60382
60768
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60383
60769
|
)
|
|
60384
60770
|
);
|
|
@@ -60399,7 +60785,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60399
60785
|
}
|
|
60400
60786
|
if (alreadyPaginated) {
|
|
60401
60787
|
ctx.reportError(
|
|
60402
|
-
new
|
|
60788
|
+
new graphql25.GraphQLError(
|
|
60403
60789
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60404
60790
|
)
|
|
60405
60791
|
);
|
|
@@ -60414,7 +60800,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60414
60800
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60415
60801
|
if (hasRequiredArgs) {
|
|
60416
60802
|
ctx.reportError(
|
|
60417
|
-
new
|
|
60803
|
+
new graphql25.GraphQLError(
|
|
60418
60804
|
"@paginate cannot appear on a document with required args"
|
|
60419
60805
|
)
|
|
60420
60806
|
);
|
|
@@ -60446,14 +60832,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60446
60832
|
const backwards = appliedArgs.has("last");
|
|
60447
60833
|
if (!forward && !backwards) {
|
|
60448
60834
|
ctx.reportError(
|
|
60449
|
-
new
|
|
60835
|
+
new graphql25.GraphQLError(
|
|
60450
60836
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60451
60837
|
)
|
|
60452
60838
|
);
|
|
60453
60839
|
}
|
|
60454
60840
|
if (forward && backwards) {
|
|
60455
60841
|
ctx.reportError(
|
|
60456
|
-
new
|
|
60842
|
+
new graphql25.GraphQLError(
|
|
60457
60843
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60458
60844
|
)
|
|
60459
60845
|
);
|
|
@@ -60467,7 +60853,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60467
60853
|
);
|
|
60468
60854
|
if (!appliedLimitArg) {
|
|
60469
60855
|
ctx.reportError(
|
|
60470
|
-
new
|
|
60856
|
+
new graphql25.GraphQLError(
|
|
60471
60857
|
"A field with offset-based pagination must have a limit argument"
|
|
60472
60858
|
)
|
|
60473
60859
|
);
|
|
@@ -60483,20 +60869,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60483
60869
|
const args = /* @__PURE__ */ new Set();
|
|
60484
60870
|
return {
|
|
60485
60871
|
enter(node) {
|
|
60486
|
-
if (node.kind ===
|
|
60872
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
60487
60873
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60488
60874
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60489
60875
|
args.add(arg);
|
|
60490
60876
|
}
|
|
60491
|
-
} else if (node.kind ===
|
|
60877
|
+
} else if (node.kind === graphql25.Kind.VARIABLE) {
|
|
60492
60878
|
args.delete(node.name.value);
|
|
60493
60879
|
}
|
|
60494
60880
|
},
|
|
60495
60881
|
leave(node) {
|
|
60496
|
-
if (node.kind ===
|
|
60882
|
+
if (node.kind === graphql25.Kind.FRAGMENT_DEFINITION) {
|
|
60497
60883
|
if (args.size > 0) {
|
|
60498
60884
|
ctx.reportError(
|
|
60499
|
-
new
|
|
60885
|
+
new graphql25.GraphQLError(
|
|
60500
60886
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60501
60887
|
)
|
|
60502
60888
|
);
|
|
@@ -60532,7 +60918,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60532
60918
|
if (definition.kind === "OperationDefinition") {
|
|
60533
60919
|
if (definition.operation !== "query") {
|
|
60534
60920
|
ctx.reportError(
|
|
60535
|
-
new
|
|
60921
|
+
new graphql25.GraphQLError(
|
|
60536
60922
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60537
60923
|
)
|
|
60538
60924
|
);
|
|
@@ -60544,7 +60930,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60544
60930
|
}
|
|
60545
60931
|
if (!possibleNodes.includes(definitionType)) {
|
|
60546
60932
|
ctx.reportError(
|
|
60547
|
-
new
|
|
60933
|
+
new graphql25.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60548
60934
|
);
|
|
60549
60935
|
}
|
|
60550
60936
|
}
|
|
@@ -60563,7 +60949,7 @@ function checkMutationOperation(config2) {
|
|
|
60563
60949
|
);
|
|
60564
60950
|
if (append && prepend) {
|
|
60565
60951
|
ctx.reportError(
|
|
60566
|
-
new
|
|
60952
|
+
new graphql25.GraphQLError(
|
|
60567
60953
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60568
60954
|
)
|
|
60569
60955
|
);
|
|
@@ -60577,7 +60963,7 @@ function checkMutationOperation(config2) {
|
|
|
60577
60963
|
);
|
|
60578
60964
|
if (parentId && allLists) {
|
|
60579
60965
|
ctx.reportError(
|
|
60580
|
-
new
|
|
60966
|
+
new graphql25.GraphQLError(
|
|
60581
60967
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60582
60968
|
)
|
|
60583
60969
|
);
|
|
@@ -60599,7 +60985,7 @@ function checkMaskDirective(config2) {
|
|
|
60599
60985
|
);
|
|
60600
60986
|
if (maskEnableDirective && maskDisableDirective) {
|
|
60601
60987
|
ctx.reportError(
|
|
60602
|
-
new
|
|
60988
|
+
new graphql25.GraphQLError(
|
|
60603
60989
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
60604
60990
|
)
|
|
60605
60991
|
);
|
|
@@ -60615,7 +61001,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
60615
61001
|
if (!nodeInterface) {
|
|
60616
61002
|
return null;
|
|
60617
61003
|
}
|
|
60618
|
-
if (!
|
|
61004
|
+
if (!graphql25.isInterfaceType(nodeInterface)) {
|
|
60619
61005
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
60620
61006
|
return null;
|
|
60621
61007
|
}
|
|
@@ -60713,11 +61099,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
60713
61099
|
}
|
|
60714
61100
|
|
|
60715
61101
|
// src/codegen/validators/noIDAlias.ts
|
|
60716
|
-
var
|
|
61102
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
60717
61103
|
async function noIDAlias(config2, docs) {
|
|
60718
61104
|
const errors = [];
|
|
60719
61105
|
for (const { filename, document } of docs) {
|
|
60720
|
-
|
|
61106
|
+
graphql26.visit(document, {
|
|
60721
61107
|
Field(node, _, __, ___, ancestors) {
|
|
60722
61108
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
60723
61109
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -60885,11 +61271,12 @@ function testConfigFile(config2 = {}) {
|
|
|
60885
61271
|
return {
|
|
60886
61272
|
schema: `
|
|
60887
61273
|
scalar Cursor
|
|
60888
|
-
|
|
61274
|
+
scalar DateTime
|
|
60889
61275
|
|
|
60890
61276
|
type User implements Node & Friend & CatOwner {
|
|
60891
61277
|
id: ID!
|
|
60892
61278
|
name: String!
|
|
61279
|
+
birthday: DateTime!
|
|
60893
61280
|
firstName: String!
|
|
60894
61281
|
friends: [User!]!
|
|
60895
61282
|
friendsByCursor(first: Int, after: String, last: Int, before: String, filter: String): UserConnection!
|
|
@@ -61086,6 +61473,9 @@ function testConfigFile(config2 = {}) {
|
|
|
61086
61473
|
DateTime: {
|
|
61087
61474
|
type: "Date",
|
|
61088
61475
|
unmarshal(val) {
|
|
61476
|
+
if (typeof val !== "number") {
|
|
61477
|
+
throw new Error("unmarshaling not a number");
|
|
61478
|
+
}
|
|
61089
61479
|
return new Date(val);
|
|
61090
61480
|
},
|
|
61091
61481
|
marshal(date) {
|
|
@@ -61111,6 +61501,7 @@ function testConfigFile(config2 = {}) {
|
|
|
61111
61501
|
client: "./my/client/path"
|
|
61112
61502
|
}
|
|
61113
61503
|
},
|
|
61504
|
+
acceptImperativeInstability: true,
|
|
61114
61505
|
...config2
|
|
61115
61506
|
};
|
|
61116
61507
|
}
|
|
@@ -61142,7 +61533,7 @@ function pipelineTest(config2, documents, shouldPass, testBody) {
|
|
|
61142
61533
|
};
|
|
61143
61534
|
}
|
|
61144
61535
|
function mockCollectedDoc(query) {
|
|
61145
|
-
const parsed =
|
|
61536
|
+
const parsed = graphql27.parse(query);
|
|
61146
61537
|
const name2 = parsed.definitions[0].name.value;
|
|
61147
61538
|
const operations = parsed.definitions;
|
|
61148
61539
|
let kind = "HoudiniFragment" /* Fragment */;
|