houdini 0.18.2 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cmd-cjs/index.js +1126 -706
- package/build/cmd-esm/index.js +1126 -706
- package/build/codegen/generators/artifacts/utils.d.ts +2 -1
- package/build/codegen/generators/runtime/index.d.ts +2 -2
- package/build/codegen/generators/typescript/addReferencedInputTypes.d.ts +1 -1
- package/build/codegen/generators/typescript/imperativeCache.d.ts +2 -0
- package/build/codegen/generators/typescript/typeReference.d.ts +1 -1
- package/build/codegen/utils/objectIdentificationSelection.d.ts +3 -0
- package/build/codegen-cjs/index.js +1026 -655
- package/build/codegen-esm/index.js +1026 -655
- package/build/lib/config.d.ts +27 -10
- package/build/lib-cjs/index.js +172 -64
- package/build/lib-esm/index.js +171 -64
- package/build/runtime/cache/cache.d.ts +5 -2
- package/build/runtime/cache/schema.d.ts +21 -0
- package/build/runtime/generated.d.ts +4 -0
- package/build/runtime/index.d.ts +6 -3
- package/build/runtime/lib/config.d.ts +8 -4
- package/build/runtime/lib/network.d.ts +2 -2
- package/build/runtime/lib/types.d.ts +2 -2
- package/build/runtime/public/cache.d.ts +19 -0
- package/build/runtime/public/index.d.ts +1 -0
- package/build/runtime/public/list.d.ts +18 -0
- package/build/runtime/public/record.d.ts +31 -0
- package/build/runtime/public/tests/test.d.ts +114 -0
- package/build/runtime/public/types.d.ts +36 -0
- package/build/runtime-cjs/cache/cache.d.ts +5 -2
- package/build/runtime-cjs/cache/cache.js +16 -5
- package/build/runtime-cjs/cache/schema.d.ts +21 -0
- package/build/runtime-cjs/cache/schema.js +66 -0
- package/build/runtime-cjs/generated.d.ts +4 -0
- package/build/runtime-cjs/generated.js +16 -0
- package/build/runtime-cjs/index.d.ts +6 -3
- package/build/runtime-cjs/index.js +4 -0
- package/build/runtime-cjs/lib/config.d.ts +8 -4
- package/build/runtime-cjs/lib/network.d.ts +2 -2
- package/build/runtime-cjs/lib/network.js +2 -2
- package/build/runtime-cjs/lib/types.d.ts +2 -2
- package/build/runtime-cjs/public/cache.d.ts +19 -0
- package/build/runtime-cjs/public/cache.js +97 -0
- package/build/runtime-cjs/public/index.d.ts +1 -0
- package/build/runtime-cjs/public/index.js +28 -0
- package/build/runtime-cjs/public/list.d.ts +18 -0
- package/build/runtime-cjs/public/list.js +163 -0
- package/build/runtime-cjs/public/record.d.ts +31 -0
- package/build/runtime-cjs/public/record.js +249 -0
- package/build/runtime-cjs/public/tests/test.d.ts +114 -0
- package/build/runtime-cjs/public/tests/test.js +31 -0
- package/build/runtime-cjs/public/types.d.ts +36 -0
- package/build/runtime-cjs/public/types.js +16 -0
- package/build/runtime-esm/cache/cache.d.ts +5 -2
- package/build/runtime-esm/cache/cache.js +16 -5
- package/build/runtime-esm/cache/schema.d.ts +21 -0
- package/build/runtime-esm/cache/schema.js +42 -0
- package/build/runtime-esm/generated.d.ts +4 -0
- package/build/runtime-esm/generated.js +0 -0
- package/build/runtime-esm/index.d.ts +6 -3
- package/build/runtime-esm/index.js +5 -2
- package/build/runtime-esm/lib/config.d.ts +8 -4
- package/build/runtime-esm/lib/network.d.ts +2 -2
- package/build/runtime-esm/lib/network.js +2 -2
- package/build/runtime-esm/lib/types.d.ts +2 -2
- package/build/runtime-esm/public/cache.d.ts +19 -0
- package/build/runtime-esm/public/cache.js +72 -0
- package/build/runtime-esm/public/index.d.ts +1 -0
- package/build/runtime-esm/public/index.js +4 -0
- package/build/runtime-esm/public/list.d.ts +18 -0
- package/build/runtime-esm/public/list.js +139 -0
- package/build/runtime-esm/public/record.d.ts +31 -0
- package/build/runtime-esm/public/record.js +222 -0
- package/build/runtime-esm/public/tests/test.d.ts +114 -0
- package/build/runtime-esm/public/tests/test.js +7 -0
- package/build/runtime-esm/public/types.d.ts +36 -0
- package/build/runtime-esm/public/types.js +0 -0
- package/build/test-cjs/index.js +1032 -638
- package/build/test-esm/index.js +1032 -638
- package/build/vite-cjs/index.js +1104 -699
- package/build/vite-esm/index.js +1104 -699
- package/package.json +2 -2
package/build/cmd-cjs/index.js
CHANGED
|
@@ -2282,7 +2282,7 @@ var require_kinds = __commonJS({
|
|
|
2282
2282
|
value: true
|
|
2283
2283
|
});
|
|
2284
2284
|
exports.Kind = void 0;
|
|
2285
|
-
var
|
|
2285
|
+
var Kind30 = Object.freeze({
|
|
2286
2286
|
NAME: "Name",
|
|
2287
2287
|
DOCUMENT: "Document",
|
|
2288
2288
|
OPERATION_DEFINITION: "OperationDefinition",
|
|
@@ -2327,7 +2327,7 @@ var require_kinds = __commonJS({
|
|
|
2327
2327
|
ENUM_TYPE_EXTENSION: "EnumTypeExtension",
|
|
2328
2328
|
INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension"
|
|
2329
2329
|
});
|
|
2330
|
-
exports.Kind =
|
|
2330
|
+
exports.Kind = Kind30;
|
|
2331
2331
|
}
|
|
2332
2332
|
});
|
|
2333
2333
|
|
|
@@ -3725,12 +3725,12 @@ var require_parser = __commonJS({
|
|
|
3725
3725
|
return [];
|
|
3726
3726
|
}
|
|
3727
3727
|
if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) {
|
|
3728
|
-
var
|
|
3728
|
+
var types16 = [];
|
|
3729
3729
|
this.expectOptionalToken(_tokenKind.TokenKind.AMP);
|
|
3730
3730
|
do {
|
|
3731
|
-
|
|
3731
|
+
types16.push(this.parseNamedType());
|
|
3732
3732
|
} while (this.expectOptionalToken(_tokenKind.TokenKind.AMP) || this.peek(_tokenKind.TokenKind.NAME));
|
|
3733
|
-
return
|
|
3733
|
+
return types16;
|
|
3734
3734
|
}
|
|
3735
3735
|
return this.delimitedMany(_tokenKind.TokenKind.AMP, this.parseNamedType);
|
|
3736
3736
|
};
|
|
@@ -3809,13 +3809,13 @@ var require_parser = __commonJS({
|
|
|
3809
3809
|
this.expectKeyword("union");
|
|
3810
3810
|
var name2 = this.parseName();
|
|
3811
3811
|
var directives = this.parseDirectives(true);
|
|
3812
|
-
var
|
|
3812
|
+
var types16 = this.parseUnionMemberTypes();
|
|
3813
3813
|
return {
|
|
3814
3814
|
kind: _kinds.Kind.UNION_TYPE_DEFINITION,
|
|
3815
3815
|
description,
|
|
3816
3816
|
name: name2,
|
|
3817
3817
|
directives,
|
|
3818
|
-
types:
|
|
3818
|
+
types: types16,
|
|
3819
3819
|
loc: this.loc(start)
|
|
3820
3820
|
};
|
|
3821
3821
|
};
|
|
@@ -3973,15 +3973,15 @@ var require_parser = __commonJS({
|
|
|
3973
3973
|
this.expectKeyword("union");
|
|
3974
3974
|
var name2 = this.parseName();
|
|
3975
3975
|
var directives = this.parseDirectives(true);
|
|
3976
|
-
var
|
|
3977
|
-
if (directives.length === 0 &&
|
|
3976
|
+
var types16 = this.parseUnionMemberTypes();
|
|
3977
|
+
if (directives.length === 0 && types16.length === 0) {
|
|
3978
3978
|
throw this.unexpected();
|
|
3979
3979
|
}
|
|
3980
3980
|
return {
|
|
3981
3981
|
kind: _kinds.Kind.UNION_TYPE_EXTENSION,
|
|
3982
3982
|
name: name2,
|
|
3983
3983
|
directives,
|
|
3984
|
-
types:
|
|
3984
|
+
types: types16,
|
|
3985
3985
|
loc: this.loc(start)
|
|
3986
3986
|
};
|
|
3987
3987
|
};
|
|
@@ -4151,7 +4151,7 @@ var require_visitor = __commonJS({
|
|
|
4151
4151
|
Object.defineProperty(exports, "__esModule", {
|
|
4152
4152
|
value: true
|
|
4153
4153
|
});
|
|
4154
|
-
exports.visit =
|
|
4154
|
+
exports.visit = visit13;
|
|
4155
4155
|
exports.visitInParallel = visitInParallel;
|
|
4156
4156
|
exports.getVisitFn = getVisitFn;
|
|
4157
4157
|
exports.BREAK = exports.QueryDocumentKeys = void 0;
|
|
@@ -4214,7 +4214,7 @@ var require_visitor = __commonJS({
|
|
|
4214
4214
|
exports.QueryDocumentKeys = QueryDocumentKeys;
|
|
4215
4215
|
var BREAK = Object.freeze({});
|
|
4216
4216
|
exports.BREAK = BREAK;
|
|
4217
|
-
function
|
|
4217
|
+
function visit13(root, visitor) {
|
|
4218
4218
|
var visitorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : QueryDocumentKeys;
|
|
4219
4219
|
var stack = void 0;
|
|
4220
4220
|
var inArray = Array.isArray(root);
|
|
@@ -4959,8 +4959,8 @@ var require_printer = __commonJS({
|
|
|
4959
4959
|
return join3(["interface", name2, wrap2("implements ", join3(interfaces, " & ")), join3(directives, " "), block2(fields)], " ");
|
|
4960
4960
|
}),
|
|
4961
4961
|
UnionTypeDefinition: addDescription2(function(_ref27) {
|
|
4962
|
-
var name2 = _ref27.name, directives = _ref27.directives,
|
|
4963
|
-
return join3(["union", name2, join3(directives, " "),
|
|
4962
|
+
var name2 = _ref27.name, directives = _ref27.directives, types16 = _ref27.types;
|
|
4963
|
+
return join3(["union", name2, join3(directives, " "), types16 && types16.length !== 0 ? "= " + join3(types16, " | ") : ""], " ");
|
|
4964
4964
|
}),
|
|
4965
4965
|
EnumTypeDefinition: addDescription2(function(_ref28) {
|
|
4966
4966
|
var name2 = _ref28.name, directives = _ref28.directives, values = _ref28.values;
|
|
@@ -4995,8 +4995,8 @@ var require_printer = __commonJS({
|
|
|
4995
4995
|
return join3(["extend interface", name2, wrap2("implements ", join3(interfaces, " & ")), join3(directives, " "), block2(fields)], " ");
|
|
4996
4996
|
},
|
|
4997
4997
|
UnionTypeExtension: function UnionTypeExtension(_ref36) {
|
|
4998
|
-
var name2 = _ref36.name, directives = _ref36.directives,
|
|
4999
|
-
return join3(["extend union", name2, join3(directives, " "),
|
|
4998
|
+
var name2 = _ref36.name, directives = _ref36.directives, types16 = _ref36.types;
|
|
4999
|
+
return join3(["extend union", name2, join3(directives, " "), types16 && types16.length !== 0 ? "= " + join3(types16, " | ") : ""], " ");
|
|
5000
5000
|
},
|
|
5001
5001
|
EnumTypeExtension: function EnumTypeExtension(_ref37) {
|
|
5002
5002
|
var name2 = _ref37.name, directives = _ref37.directives, values = _ref37.values;
|
|
@@ -5092,17 +5092,17 @@ var require_definition = __commonJS({
|
|
|
5092
5092
|
});
|
|
5093
5093
|
exports.isType = isType;
|
|
5094
5094
|
exports.assertType = assertType;
|
|
5095
|
-
exports.isScalarType =
|
|
5095
|
+
exports.isScalarType = isScalarType13;
|
|
5096
5096
|
exports.assertScalarType = assertScalarType;
|
|
5097
|
-
exports.isObjectType =
|
|
5097
|
+
exports.isObjectType = isObjectType12;
|
|
5098
5098
|
exports.assertObjectType = assertObjectType;
|
|
5099
5099
|
exports.isInterfaceType = isInterfaceType12;
|
|
5100
5100
|
exports.assertInterfaceType = assertInterfaceType;
|
|
5101
5101
|
exports.isUnionType = isUnionType13;
|
|
5102
5102
|
exports.assertUnionType = assertUnionType;
|
|
5103
|
-
exports.isEnumType =
|
|
5103
|
+
exports.isEnumType = isEnumType10;
|
|
5104
5104
|
exports.assertEnumType = assertEnumType;
|
|
5105
|
-
exports.isInputObjectType =
|
|
5105
|
+
exports.isInputObjectType = isInputObjectType8;
|
|
5106
5106
|
exports.assertInputObjectType = assertInputObjectType;
|
|
5107
5107
|
exports.isListType = isListType8;
|
|
5108
5108
|
exports.assertListType = assertListType;
|
|
@@ -5116,7 +5116,7 @@ var require_definition = __commonJS({
|
|
|
5116
5116
|
exports.assertLeafType = assertLeafType;
|
|
5117
5117
|
exports.isCompositeType = isCompositeType;
|
|
5118
5118
|
exports.assertCompositeType = assertCompositeType;
|
|
5119
|
-
exports.isAbstractType =
|
|
5119
|
+
exports.isAbstractType = isAbstractType3;
|
|
5120
5120
|
exports.assertAbstractType = assertAbstractType;
|
|
5121
5121
|
exports.GraphQLList = GraphQLList6;
|
|
5122
5122
|
exports.GraphQLNonNull = GraphQLNonNull6;
|
|
@@ -5171,7 +5171,7 @@ var require_definition = __commonJS({
|
|
|
5171
5171
|
return Constructor;
|
|
5172
5172
|
}
|
|
5173
5173
|
function isType(type) {
|
|
5174
|
-
return
|
|
5174
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isInputObjectType8(type) || isListType8(type) || isNonNullType10(type);
|
|
5175
5175
|
}
|
|
5176
5176
|
function assertType(type) {
|
|
5177
5177
|
if (!isType(type)) {
|
|
@@ -5179,20 +5179,20 @@ var require_definition = __commonJS({
|
|
|
5179
5179
|
}
|
|
5180
5180
|
return type;
|
|
5181
5181
|
}
|
|
5182
|
-
function
|
|
5182
|
+
function isScalarType13(type) {
|
|
5183
5183
|
return (0, _instanceOf.default)(type, GraphQLScalarType4);
|
|
5184
5184
|
}
|
|
5185
5185
|
function assertScalarType(type) {
|
|
5186
|
-
if (!
|
|
5186
|
+
if (!isScalarType13(type)) {
|
|
5187
5187
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Scalar type."));
|
|
5188
5188
|
}
|
|
5189
5189
|
return type;
|
|
5190
5190
|
}
|
|
5191
|
-
function
|
|
5191
|
+
function isObjectType12(type) {
|
|
5192
5192
|
return (0, _instanceOf.default)(type, GraphQLObjectType6);
|
|
5193
5193
|
}
|
|
5194
5194
|
function assertObjectType(type) {
|
|
5195
|
-
if (!
|
|
5195
|
+
if (!isObjectType12(type)) {
|
|
5196
5196
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Object type."));
|
|
5197
5197
|
}
|
|
5198
5198
|
return type;
|
|
@@ -5215,20 +5215,20 @@ var require_definition = __commonJS({
|
|
|
5215
5215
|
}
|
|
5216
5216
|
return type;
|
|
5217
5217
|
}
|
|
5218
|
-
function
|
|
5218
|
+
function isEnumType10(type) {
|
|
5219
5219
|
return (0, _instanceOf.default)(type, GraphQLEnumType4);
|
|
5220
5220
|
}
|
|
5221
5221
|
function assertEnumType(type) {
|
|
5222
|
-
if (!
|
|
5222
|
+
if (!isEnumType10(type)) {
|
|
5223
5223
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
|
|
5224
5224
|
}
|
|
5225
5225
|
return type;
|
|
5226
5226
|
}
|
|
5227
|
-
function
|
|
5227
|
+
function isInputObjectType8(type) {
|
|
5228
5228
|
return (0, _instanceOf.default)(type, GraphQLInputObjectType4);
|
|
5229
5229
|
}
|
|
5230
5230
|
function assertInputObjectType(type) {
|
|
5231
|
-
if (!
|
|
5231
|
+
if (!isInputObjectType8(type)) {
|
|
5232
5232
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Input Object type."));
|
|
5233
5233
|
}
|
|
5234
5234
|
return type;
|
|
@@ -5252,7 +5252,7 @@ var require_definition = __commonJS({
|
|
|
5252
5252
|
return type;
|
|
5253
5253
|
}
|
|
5254
5254
|
function isInputType(type) {
|
|
5255
|
-
return
|
|
5255
|
+
return isScalarType13(type) || isEnumType10(type) || isInputObjectType8(type) || isWrappingType(type) && isInputType(type.ofType);
|
|
5256
5256
|
}
|
|
5257
5257
|
function assertInputType(type) {
|
|
5258
5258
|
if (!isInputType(type)) {
|
|
@@ -5261,7 +5261,7 @@ var require_definition = __commonJS({
|
|
|
5261
5261
|
return type;
|
|
5262
5262
|
}
|
|
5263
5263
|
function isOutputType(type) {
|
|
5264
|
-
return
|
|
5264
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
5265
5265
|
}
|
|
5266
5266
|
function assertOutputType(type) {
|
|
5267
5267
|
if (!isOutputType(type)) {
|
|
@@ -5270,7 +5270,7 @@ var require_definition = __commonJS({
|
|
|
5270
5270
|
return type;
|
|
5271
5271
|
}
|
|
5272
5272
|
function isLeafType4(type) {
|
|
5273
|
-
return
|
|
5273
|
+
return isScalarType13(type) || isEnumType10(type);
|
|
5274
5274
|
}
|
|
5275
5275
|
function assertLeafType(type) {
|
|
5276
5276
|
if (!isLeafType4(type)) {
|
|
@@ -5279,7 +5279,7 @@ var require_definition = __commonJS({
|
|
|
5279
5279
|
return type;
|
|
5280
5280
|
}
|
|
5281
5281
|
function isCompositeType(type) {
|
|
5282
|
-
return
|
|
5282
|
+
return isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type);
|
|
5283
5283
|
}
|
|
5284
5284
|
function assertCompositeType(type) {
|
|
5285
5285
|
if (!isCompositeType(type)) {
|
|
@@ -5287,11 +5287,11 @@ var require_definition = __commonJS({
|
|
|
5287
5287
|
}
|
|
5288
5288
|
return type;
|
|
5289
5289
|
}
|
|
5290
|
-
function
|
|
5290
|
+
function isAbstractType3(type) {
|
|
5291
5291
|
return isInterfaceType12(type) || isUnionType13(type);
|
|
5292
5292
|
}
|
|
5293
5293
|
function assertAbstractType(type) {
|
|
5294
|
-
if (!
|
|
5294
|
+
if (!isAbstractType3(type)) {
|
|
5295
5295
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL abstract type."));
|
|
5296
5296
|
}
|
|
5297
5297
|
return type;
|
|
@@ -5358,7 +5358,7 @@ var require_definition = __commonJS({
|
|
|
5358
5358
|
}
|
|
5359
5359
|
}
|
|
5360
5360
|
function isNamedType4(type) {
|
|
5361
|
-
return
|
|
5361
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isInputObjectType8(type);
|
|
5362
5362
|
}
|
|
5363
5363
|
function assertNamedType(type) {
|
|
5364
5364
|
if (!isNamedType4(type)) {
|
|
@@ -5667,9 +5667,9 @@ var require_definition = __commonJS({
|
|
|
5667
5667
|
exports.GraphQLUnionType = GraphQLUnionType3;
|
|
5668
5668
|
(0, _defineInspect.default)(GraphQLUnionType3);
|
|
5669
5669
|
function defineTypes(config2) {
|
|
5670
|
-
var
|
|
5671
|
-
Array.isArray(
|
|
5672
|
-
return
|
|
5670
|
+
var types16 = resolveThunk(config2.types);
|
|
5671
|
+
Array.isArray(types16) || (0, _devAssert.default)(0, "Must provide Array of types or a function which returns such an array for Union ".concat(config2.name, "."));
|
|
5672
|
+
return types16;
|
|
5673
5673
|
}
|
|
5674
5674
|
var GraphQLEnumType4 = /* @__PURE__ */ function() {
|
|
5675
5675
|
function GraphQLEnumType5(config2) {
|
|
@@ -11507,7 +11507,7 @@ var require_graphql = __commonJS({
|
|
|
11507
11507
|
Object.defineProperty(exports, "__esModule", {
|
|
11508
11508
|
value: true
|
|
11509
11509
|
});
|
|
11510
|
-
exports.graphql =
|
|
11510
|
+
exports.graphql = graphql30;
|
|
11511
11511
|
exports.graphqlSync = graphqlSync;
|
|
11512
11512
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
11513
11513
|
var _parser = require_parser();
|
|
@@ -11517,7 +11517,7 @@ var require_graphql = __commonJS({
|
|
|
11517
11517
|
function _interopRequireDefault(obj) {
|
|
11518
11518
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
11519
11519
|
}
|
|
11520
|
-
function
|
|
11520
|
+
function graphql30(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
11521
11521
|
var _arguments = arguments;
|
|
11522
11522
|
return new Promise(function(resolve2) {
|
|
11523
11523
|
return resolve2(
|
|
@@ -13306,7 +13306,7 @@ var require_buildClientSchema = __commonJS({
|
|
|
13306
13306
|
return new _definition.GraphQLUnionType({
|
|
13307
13307
|
name: unionIntrospection.name,
|
|
13308
13308
|
description: unionIntrospection.description,
|
|
13309
|
-
types: function
|
|
13309
|
+
types: function types16() {
|
|
13310
13310
|
return unionIntrospection.possibleTypes.map(getObjectType);
|
|
13311
13311
|
}
|
|
13312
13312
|
});
|
|
@@ -13651,7 +13651,7 @@ var require_extendSchema = __commonJS({
|
|
|
13651
13651
|
var config2 = type.toConfig();
|
|
13652
13652
|
var extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config2.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : [];
|
|
13653
13653
|
return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, config2), {}, {
|
|
13654
|
-
types: function
|
|
13654
|
+
types: function types16() {
|
|
13655
13655
|
return [].concat(type.getTypes().map(replaceNamedType), buildUnionTypes(extensions));
|
|
13656
13656
|
},
|
|
13657
13657
|
extensionASTNodes: config2.extensionASTNodes.concat(extensions)
|
|
@@ -13799,17 +13799,17 @@ var require_extendSchema = __commonJS({
|
|
|
13799
13799
|
return interfaces;
|
|
13800
13800
|
}
|
|
13801
13801
|
function buildUnionTypes(nodes) {
|
|
13802
|
-
var
|
|
13802
|
+
var types16 = [];
|
|
13803
13803
|
for (var _i32 = 0; _i32 < nodes.length; _i32++) {
|
|
13804
13804
|
var _node$types;
|
|
13805
13805
|
var node = nodes[_i32];
|
|
13806
13806
|
var typeNodes = (_node$types = node.types) !== null && _node$types !== void 0 ? _node$types : [];
|
|
13807
13807
|
for (var _i34 = 0; _i34 < typeNodes.length; _i34++) {
|
|
13808
13808
|
var type = typeNodes[_i34];
|
|
13809
|
-
|
|
13809
|
+
types16.push(getNamedType5(type));
|
|
13810
13810
|
}
|
|
13811
13811
|
}
|
|
13812
|
-
return
|
|
13812
|
+
return types16;
|
|
13813
13813
|
}
|
|
13814
13814
|
function buildType(astNode) {
|
|
13815
13815
|
var _typeExtensionsMap$na;
|
|
@@ -13866,7 +13866,7 @@ var require_extendSchema = __commonJS({
|
|
|
13866
13866
|
return new _definition.GraphQLUnionType({
|
|
13867
13867
|
name: name3,
|
|
13868
13868
|
description,
|
|
13869
|
-
types: function
|
|
13869
|
+
types: function types16() {
|
|
13870
13870
|
return buildUnionTypes(_allNodes3);
|
|
13871
13871
|
},
|
|
13872
13872
|
astNode,
|
|
@@ -14164,7 +14164,7 @@ var require_lexicographicSortSchema = __commonJS({
|
|
|
14164
14164
|
if ((0, _definition.isUnionType)(type)) {
|
|
14165
14165
|
var _config22 = type.toConfig();
|
|
14166
14166
|
return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, _config22), {}, {
|
|
14167
|
-
types: function
|
|
14167
|
+
types: function types16() {
|
|
14168
14168
|
return sortTypes(_config22.types);
|
|
14169
14169
|
}
|
|
14170
14170
|
}));
|
|
@@ -14249,10 +14249,10 @@ var require_printSchema = __commonJS({
|
|
|
14249
14249
|
}
|
|
14250
14250
|
function printFilteredSchema(schema, directiveFilter, typeFilter, options) {
|
|
14251
14251
|
var directives = schema.getDirectives().filter(directiveFilter);
|
|
14252
|
-
var
|
|
14252
|
+
var types16 = (0, _objectValues.default)(schema.getTypeMap()).filter(typeFilter);
|
|
14253
14253
|
return [printSchemaDefinition(schema)].concat(directives.map(function(directive) {
|
|
14254
14254
|
return printDirective(directive, options);
|
|
14255
|
-
}),
|
|
14255
|
+
}), types16.map(function(type) {
|
|
14256
14256
|
return printType(type, options);
|
|
14257
14257
|
})).filter(Boolean).join("\n\n") + "\n";
|
|
14258
14258
|
}
|
|
@@ -14327,8 +14327,8 @@ var require_printSchema = __commonJS({
|
|
|
14327
14327
|
return printDescription(options, type) + "interface ".concat(type.name) + printImplementedInterfaces(type) + printFields(options, type);
|
|
14328
14328
|
}
|
|
14329
14329
|
function printUnion(type, options) {
|
|
14330
|
-
var
|
|
14331
|
-
var possibleTypes =
|
|
14330
|
+
var types16 = type.getTypes();
|
|
14331
|
+
var possibleTypes = types16.length ? " = " + types16.join(" | ") : "";
|
|
14332
14332
|
return printDescription(options, type) + "union " + type.name + possibleTypes;
|
|
14333
14333
|
}
|
|
14334
14334
|
function printEnum(type, options) {
|
|
@@ -30005,14 +30005,14 @@ var require_lib3 = __commonJS({
|
|
|
30005
30005
|
this.preserveSpace = !!preserveSpace;
|
|
30006
30006
|
}
|
|
30007
30007
|
};
|
|
30008
|
-
var
|
|
30008
|
+
var types16 = {
|
|
30009
30009
|
brace: new TokContext("{"),
|
|
30010
30010
|
j_oTag: new TokContext("<tag"),
|
|
30011
30011
|
j_cTag: new TokContext("</tag"),
|
|
30012
30012
|
j_expr: new TokContext("<tag>...</tag>", true)
|
|
30013
30013
|
};
|
|
30014
30014
|
{
|
|
30015
|
-
|
|
30015
|
+
types16.template = new TokContext("`", true);
|
|
30016
30016
|
}
|
|
30017
30017
|
var beforeExpr = true;
|
|
30018
30018
|
var startsExpr = true;
|
|
@@ -30544,17 +30544,17 @@ var require_lib3 = __commonJS({
|
|
|
30544
30544
|
context.pop();
|
|
30545
30545
|
};
|
|
30546
30546
|
tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = (context) => {
|
|
30547
|
-
context.push(
|
|
30547
|
+
context.push(types16.brace);
|
|
30548
30548
|
};
|
|
30549
30549
|
tokenTypes[22].updateContext = (context) => {
|
|
30550
|
-
if (context[context.length - 1] ===
|
|
30550
|
+
if (context[context.length - 1] === types16.template) {
|
|
30551
30551
|
context.pop();
|
|
30552
30552
|
} else {
|
|
30553
|
-
context.push(
|
|
30553
|
+
context.push(types16.template);
|
|
30554
30554
|
}
|
|
30555
30555
|
};
|
|
30556
30556
|
tokenTypes[140].updateContext = (context) => {
|
|
30557
|
-
context.push(
|
|
30557
|
+
context.push(types16.j_expr, types16.j_oTag);
|
|
30558
30558
|
};
|
|
30559
30559
|
}
|
|
30560
30560
|
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";
|
|
@@ -31195,7 +31195,7 @@ var require_lib3 = __commonJS({
|
|
|
31195
31195
|
this.lastTokEndLoc = null;
|
|
31196
31196
|
this.lastTokStartLoc = null;
|
|
31197
31197
|
this.lastTokStart = 0;
|
|
31198
|
-
this.context = [
|
|
31198
|
+
this.context = [types16.brace];
|
|
31199
31199
|
this.canStartJSXElement = true;
|
|
31200
31200
|
this.containsEsc = false;
|
|
31201
31201
|
this.firstInvalidTemplateEscapePos = null;
|
|
@@ -35119,7 +35119,7 @@ var require_lib3 = __commonJS({
|
|
|
35119
35119
|
context
|
|
35120
35120
|
} = this.state;
|
|
35121
35121
|
const currentContext = context[context.length - 1];
|
|
35122
|
-
if (currentContext ===
|
|
35122
|
+
if (currentContext === types16.j_oTag || currentContext === types16.j_expr) {
|
|
35123
35123
|
context.pop();
|
|
35124
35124
|
}
|
|
35125
35125
|
}
|
|
@@ -36179,9 +36179,9 @@ var require_lib3 = __commonJS({
|
|
|
36179
36179
|
switch (this.state.type) {
|
|
36180
36180
|
case 5:
|
|
36181
36181
|
node = this.startNode();
|
|
36182
|
-
this.setContext(
|
|
36182
|
+
this.setContext(types16.brace);
|
|
36183
36183
|
this.next();
|
|
36184
|
-
node = this.jsxParseExpressionContainer(node,
|
|
36184
|
+
node = this.jsxParseExpressionContainer(node, types16.j_oTag);
|
|
36185
36185
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
36186
36186
|
this.raise(JsxErrors.AttributeIsEmpty, {
|
|
36187
36187
|
at: node
|
|
@@ -36204,7 +36204,7 @@ var require_lib3 = __commonJS({
|
|
|
36204
36204
|
jsxParseSpreadChild(node) {
|
|
36205
36205
|
this.next();
|
|
36206
36206
|
node.expression = this.parseExpression();
|
|
36207
|
-
this.setContext(
|
|
36207
|
+
this.setContext(types16.j_expr);
|
|
36208
36208
|
this.state.canStartJSXElement = true;
|
|
36209
36209
|
this.expect(8);
|
|
36210
36210
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -36224,11 +36224,11 @@ var require_lib3 = __commonJS({
|
|
|
36224
36224
|
jsxParseAttribute() {
|
|
36225
36225
|
const node = this.startNode();
|
|
36226
36226
|
if (this.match(5)) {
|
|
36227
|
-
this.setContext(
|
|
36227
|
+
this.setContext(types16.brace);
|
|
36228
36228
|
this.next();
|
|
36229
36229
|
this.expect(21);
|
|
36230
36230
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
36231
|
-
this.setContext(
|
|
36231
|
+
this.setContext(types16.j_oTag);
|
|
36232
36232
|
this.state.canStartJSXElement = true;
|
|
36233
36233
|
this.expect(8);
|
|
36234
36234
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
@@ -36287,12 +36287,12 @@ var require_lib3 = __commonJS({
|
|
|
36287
36287
|
break;
|
|
36288
36288
|
case 5: {
|
|
36289
36289
|
const node2 = this.startNode();
|
|
36290
|
-
this.setContext(
|
|
36290
|
+
this.setContext(types16.brace);
|
|
36291
36291
|
this.next();
|
|
36292
36292
|
if (this.match(21)) {
|
|
36293
36293
|
children.push(this.jsxParseSpreadChild(node2));
|
|
36294
36294
|
} else {
|
|
36295
|
-
children.push(this.jsxParseExpressionContainer(node2,
|
|
36295
|
+
children.push(this.jsxParseExpressionContainer(node2, types16.j_expr));
|
|
36296
36296
|
}
|
|
36297
36297
|
break;
|
|
36298
36298
|
}
|
|
@@ -36363,10 +36363,10 @@ var require_lib3 = __commonJS({
|
|
|
36363
36363
|
}
|
|
36364
36364
|
getTokenFromCode(code) {
|
|
36365
36365
|
const context = this.curContext();
|
|
36366
|
-
if (context ===
|
|
36366
|
+
if (context === types16.j_expr) {
|
|
36367
36367
|
return this.jsxReadToken();
|
|
36368
36368
|
}
|
|
36369
|
-
if (context ===
|
|
36369
|
+
if (context === types16.j_oTag || context === types16.j_cTag) {
|
|
36370
36370
|
if (isIdentifierStart(code)) {
|
|
36371
36371
|
return this.jsxReadWord();
|
|
36372
36372
|
}
|
|
@@ -36374,7 +36374,7 @@ var require_lib3 = __commonJS({
|
|
|
36374
36374
|
++this.state.pos;
|
|
36375
36375
|
return this.finishToken(141);
|
|
36376
36376
|
}
|
|
36377
|
-
if ((code === 34 || code === 39) && context ===
|
|
36377
|
+
if ((code === 34 || code === 39) && context === types16.j_oTag) {
|
|
36378
36378
|
return this.jsxReadString(code);
|
|
36379
36379
|
}
|
|
36380
36380
|
}
|
|
@@ -36390,17 +36390,17 @@ var require_lib3 = __commonJS({
|
|
|
36390
36390
|
type
|
|
36391
36391
|
} = this.state;
|
|
36392
36392
|
if (type === 56 && prevType === 140) {
|
|
36393
|
-
context.splice(-2, 2,
|
|
36393
|
+
context.splice(-2, 2, types16.j_cTag);
|
|
36394
36394
|
this.state.canStartJSXElement = false;
|
|
36395
36395
|
} else if (type === 140) {
|
|
36396
|
-
context.push(
|
|
36396
|
+
context.push(types16.j_oTag);
|
|
36397
36397
|
} else if (type === 141) {
|
|
36398
36398
|
const out = context[context.length - 1];
|
|
36399
|
-
if (out ===
|
|
36399
|
+
if (out === types16.j_oTag && prevType === 56 || out === types16.j_cTag) {
|
|
36400
36400
|
context.pop();
|
|
36401
|
-
this.state.canStartJSXElement = context[context.length - 1] ===
|
|
36401
|
+
this.state.canStartJSXElement = context[context.length - 1] === types16.j_expr;
|
|
36402
36402
|
} else {
|
|
36403
|
-
this.setContext(
|
|
36403
|
+
this.setContext(types16.j_expr);
|
|
36404
36404
|
this.state.canStartJSXElement = true;
|
|
36405
36405
|
}
|
|
36406
36406
|
} else {
|
|
@@ -37407,14 +37407,14 @@ var require_lib3 = __commonJS({
|
|
|
37407
37407
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
37408
37408
|
const node = this.startNode();
|
|
37409
37409
|
const hasLeadingOperator = this.eat(operator);
|
|
37410
|
-
const
|
|
37410
|
+
const types17 = [];
|
|
37411
37411
|
do {
|
|
37412
|
-
|
|
37412
|
+
types17.push(parseConstituentType());
|
|
37413
37413
|
} while (this.eat(operator));
|
|
37414
|
-
if (
|
|
37415
|
-
return
|
|
37414
|
+
if (types17.length === 1 && !hasLeadingOperator) {
|
|
37415
|
+
return types17[0];
|
|
37416
37416
|
}
|
|
37417
|
-
node.types =
|
|
37417
|
+
node.types = types17;
|
|
37418
37418
|
return this.finishNode(node, kind);
|
|
37419
37419
|
}
|
|
37420
37420
|
tsParseIntersectionTypeOrHigher() {
|
|
@@ -38630,7 +38630,7 @@ var require_lib3 = __commonJS({
|
|
|
38630
38630
|
context
|
|
38631
38631
|
} = this.state;
|
|
38632
38632
|
const currentContext = context[context.length - 1];
|
|
38633
|
-
if (currentContext ===
|
|
38633
|
+
if (currentContext === types16.j_oTag || currentContext === types16.j_expr) {
|
|
38634
38634
|
context.pop();
|
|
38635
38635
|
}
|
|
38636
38636
|
}
|
|
@@ -44202,9 +44202,9 @@ var require_shared = __commonJS({
|
|
|
44202
44202
|
var tslib_1 = require_tslib();
|
|
44203
44203
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
44204
44204
|
function default_1(fork) {
|
|
44205
|
-
var
|
|
44206
|
-
var Type =
|
|
44207
|
-
var builtin =
|
|
44205
|
+
var types16 = fork.use(types_1.default);
|
|
44206
|
+
var Type = types16.Type;
|
|
44207
|
+
var builtin = types16.builtInTypes;
|
|
44208
44208
|
var isNumber = builtin.number;
|
|
44209
44209
|
function geq(than) {
|
|
44210
44210
|
return Type.from(function(value) {
|
|
@@ -44354,9 +44354,9 @@ var require_types = __commonJS({
|
|
|
44354
44354
|
}(BaseType);
|
|
44355
44355
|
var OrType = function(_super) {
|
|
44356
44356
|
tslib_1.__extends(OrType2, _super);
|
|
44357
|
-
function OrType2(
|
|
44357
|
+
function OrType2(types16) {
|
|
44358
44358
|
var _this = _super.call(this) || this;
|
|
44359
|
-
_this.types =
|
|
44359
|
+
_this.types = types16;
|
|
44360
44360
|
_this.kind = "OrType";
|
|
44361
44361
|
return _this;
|
|
44362
44362
|
}
|
|
@@ -44497,11 +44497,11 @@ var require_types = __commonJS({
|
|
|
44497
44497
|
function typesPlugin(_fork) {
|
|
44498
44498
|
var Type = {
|
|
44499
44499
|
or: function() {
|
|
44500
|
-
var
|
|
44500
|
+
var types16 = [];
|
|
44501
44501
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
44502
|
-
|
|
44502
|
+
types16[_i] = arguments[_i];
|
|
44503
44503
|
}
|
|
44504
|
-
return new OrType(
|
|
44504
|
+
return new OrType(types16.map(function(type) {
|
|
44505
44505
|
return Type.from(type);
|
|
44506
44506
|
}));
|
|
44507
44507
|
},
|
|
@@ -44946,9 +44946,9 @@ var require_path2 = __commonJS({
|
|
|
44946
44946
|
var Op = Object.prototype;
|
|
44947
44947
|
var hasOwn = Op.hasOwnProperty;
|
|
44948
44948
|
function pathPlugin(fork) {
|
|
44949
|
-
var
|
|
44950
|
-
var isArray =
|
|
44951
|
-
var isNumber =
|
|
44949
|
+
var types16 = fork.use(types_1.default);
|
|
44950
|
+
var isArray = types16.builtInTypes.array;
|
|
44951
|
+
var isNumber = types16.builtInTypes.number;
|
|
44952
44952
|
var Path = function Path2(value, parentPath, name2) {
|
|
44953
44953
|
if (!(this instanceof Path2)) {
|
|
44954
44954
|
throw new Error("Path constructor cannot be invoked without 'new'");
|
|
@@ -45250,13 +45250,13 @@ var require_scope = __commonJS({
|
|
|
45250
45250
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
45251
45251
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
45252
45252
|
function scopePlugin(fork) {
|
|
45253
|
-
var
|
|
45254
|
-
var Type =
|
|
45255
|
-
var namedTypes =
|
|
45253
|
+
var types16 = fork.use(types_1.default);
|
|
45254
|
+
var Type = types16.Type;
|
|
45255
|
+
var namedTypes = types16.namedTypes;
|
|
45256
45256
|
var Node = namedTypes.Node;
|
|
45257
45257
|
var Expression = namedTypes.Expression;
|
|
45258
|
-
var isArray =
|
|
45259
|
-
var b =
|
|
45258
|
+
var isArray = types16.builtInTypes.array;
|
|
45259
|
+
var b = types16.builders;
|
|
45260
45260
|
var Scope = function Scope2(path2, parentScope) {
|
|
45261
45261
|
if (!(this instanceof Scope2)) {
|
|
45262
45262
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
@@ -45319,7 +45319,7 @@ var require_scope = __commonJS({
|
|
|
45319
45319
|
++index;
|
|
45320
45320
|
}
|
|
45321
45321
|
var name2 = prefix + index;
|
|
45322
|
-
return this.bindings[name2] =
|
|
45322
|
+
return this.bindings[name2] = types16.builders.identifier(name2);
|
|
45323
45323
|
};
|
|
45324
45324
|
Sp.injectTemporary = function(identifier, init2) {
|
|
45325
45325
|
identifier || (identifier = this.declareTemporary());
|
|
@@ -45395,7 +45395,7 @@ var require_scope = __commonJS({
|
|
|
45395
45395
|
bindings
|
|
45396
45396
|
);
|
|
45397
45397
|
} else if (Node.check(node) && !Expression.check(node)) {
|
|
45398
|
-
|
|
45398
|
+
types16.eachField(node, function(name2, child) {
|
|
45399
45399
|
var childPath = path2.get(name2);
|
|
45400
45400
|
if (!pathHasValue(childPath, child)) {
|
|
45401
45401
|
throw new Error("");
|
|
@@ -45473,24 +45473,24 @@ var require_scope = __commonJS({
|
|
|
45473
45473
|
addPattern(patternPath.get("argument"), bindings);
|
|
45474
45474
|
}
|
|
45475
45475
|
}
|
|
45476
|
-
function addTypePattern(patternPath,
|
|
45476
|
+
function addTypePattern(patternPath, types17) {
|
|
45477
45477
|
var pattern = patternPath.value;
|
|
45478
45478
|
namedTypes.Pattern.assert(pattern);
|
|
45479
45479
|
if (namedTypes.Identifier.check(pattern)) {
|
|
45480
|
-
if (hasOwn.call(
|
|
45481
|
-
|
|
45480
|
+
if (hasOwn.call(types17, pattern.name)) {
|
|
45481
|
+
types17[pattern.name].push(patternPath);
|
|
45482
45482
|
} else {
|
|
45483
|
-
|
|
45483
|
+
types17[pattern.name] = [patternPath];
|
|
45484
45484
|
}
|
|
45485
45485
|
}
|
|
45486
45486
|
}
|
|
45487
|
-
function addTypeParameter(parameterPath,
|
|
45487
|
+
function addTypeParameter(parameterPath, types17) {
|
|
45488
45488
|
var parameter = parameterPath.value;
|
|
45489
45489
|
FlowOrTSTypeParameterType.assert(parameter);
|
|
45490
|
-
if (hasOwn.call(
|
|
45491
|
-
|
|
45490
|
+
if (hasOwn.call(types17, parameter.name)) {
|
|
45491
|
+
types17[parameter.name].push(parameterPath);
|
|
45492
45492
|
} else {
|
|
45493
|
-
|
|
45493
|
+
types17[parameter.name] = [parameterPath];
|
|
45494
45494
|
}
|
|
45495
45495
|
}
|
|
45496
45496
|
Sp.lookup = function(name2) {
|
|
@@ -45531,11 +45531,11 @@ var require_node_path = __commonJS({
|
|
|
45531
45531
|
var scope_1 = tslib_1.__importDefault(require_scope());
|
|
45532
45532
|
var shared_1 = require_shared();
|
|
45533
45533
|
function nodePathPlugin(fork) {
|
|
45534
|
-
var
|
|
45535
|
-
var n =
|
|
45536
|
-
var b =
|
|
45537
|
-
var isNumber =
|
|
45538
|
-
var isArray =
|
|
45534
|
+
var types16 = fork.use(types_1.default);
|
|
45535
|
+
var n = types16.namedTypes;
|
|
45536
|
+
var b = types16.builders;
|
|
45537
|
+
var isNumber = types16.builtInTypes.number;
|
|
45538
|
+
var isArray = types16.builtInTypes.array;
|
|
45539
45539
|
var Path = fork.use(path_1.default);
|
|
45540
45540
|
var Scope = fork.use(scope_1.default);
|
|
45541
45541
|
var NodePath = function NodePath2(value, parentPath, name2) {
|
|
@@ -45626,7 +45626,7 @@ var require_node_path = __commonJS({
|
|
|
45626
45626
|
return scope || null;
|
|
45627
45627
|
};
|
|
45628
45628
|
NPp.getValueProperty = function(name2) {
|
|
45629
|
-
return
|
|
45629
|
+
return types16.getFieldValue(this.value, name2);
|
|
45630
45630
|
};
|
|
45631
45631
|
NPp.needsParens = function(assumeExpressionContext) {
|
|
45632
45632
|
var pp = this.parentPath;
|
|
@@ -45768,7 +45768,7 @@ var require_node_path = __commonJS({
|
|
|
45768
45768
|
return node.some(containsCallExpression);
|
|
45769
45769
|
}
|
|
45770
45770
|
if (n.Node.check(node)) {
|
|
45771
|
-
return
|
|
45771
|
+
return types16.someField(node, function(_name, child) {
|
|
45772
45772
|
return containsCallExpression(child);
|
|
45773
45773
|
});
|
|
45774
45774
|
}
|
|
@@ -45889,11 +45889,11 @@ var require_path_visitor = __commonJS({
|
|
|
45889
45889
|
var shared_1 = require_shared();
|
|
45890
45890
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
45891
45891
|
function pathVisitorPlugin(fork) {
|
|
45892
|
-
var
|
|
45892
|
+
var types16 = fork.use(types_1.default);
|
|
45893
45893
|
var NodePath = fork.use(node_path_1.default);
|
|
45894
|
-
var isArray =
|
|
45895
|
-
var isObject2 =
|
|
45896
|
-
var isFunction =
|
|
45894
|
+
var isArray = types16.builtInTypes.array;
|
|
45895
|
+
var isObject2 = types16.builtInTypes.object;
|
|
45896
|
+
var isFunction = types16.builtInTypes.function;
|
|
45897
45897
|
var undefined2;
|
|
45898
45898
|
var PathVisitor = function PathVisitor2() {
|
|
45899
45899
|
if (!(this instanceof PathVisitor2)) {
|
|
@@ -45913,7 +45913,7 @@ var require_path_visitor = __commonJS({
|
|
|
45913
45913
|
typeNames[methodName.slice("visit".length)] = true;
|
|
45914
45914
|
}
|
|
45915
45915
|
}
|
|
45916
|
-
var supertypeTable =
|
|
45916
|
+
var supertypeTable = types16.computeSupertypeLookupTable(typeNames);
|
|
45917
45917
|
var methodNameTable = /* @__PURE__ */ Object.create(null);
|
|
45918
45918
|
var typeNameKeys = Object.keys(supertypeTable);
|
|
45919
45919
|
var typeNameCount = typeNameKeys.length;
|
|
@@ -45955,7 +45955,7 @@ var require_path_visitor = __commonJS({
|
|
|
45955
45955
|
}
|
|
45956
45956
|
return target;
|
|
45957
45957
|
}
|
|
45958
|
-
PathVisitor.visit = function
|
|
45958
|
+
PathVisitor.visit = function visit13(node, methods) {
|
|
45959
45959
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
45960
45960
|
};
|
|
45961
45961
|
var PVp = PathVisitor.prototype;
|
|
@@ -46032,7 +46032,7 @@ var require_path_visitor = __commonJS({
|
|
|
46032
46032
|
path2.each(visitor.visitWithoutReset, visitor);
|
|
46033
46033
|
} else if (!isObject2.check(value)) {
|
|
46034
46034
|
} else {
|
|
46035
|
-
var childNames =
|
|
46035
|
+
var childNames = types16.getFieldNames(value);
|
|
46036
46036
|
if (visitor._shouldVisitComments && value.comments && childNames.indexOf("comments") < 0) {
|
|
46037
46037
|
childNames.push("comments");
|
|
46038
46038
|
}
|
|
@@ -46041,7 +46041,7 @@ var require_path_visitor = __commonJS({
|
|
|
46041
46041
|
for (var i2 = 0; i2 < childCount; ++i2) {
|
|
46042
46042
|
var childName = childNames[i2];
|
|
46043
46043
|
if (!hasOwn.call(value, childName)) {
|
|
46044
|
-
value[childName] =
|
|
46044
|
+
value[childName] = types16.getFieldValue(value, childName);
|
|
46045
46045
|
}
|
|
46046
46046
|
childPaths.push(path2.get(childName));
|
|
46047
46047
|
}
|
|
@@ -46146,7 +46146,7 @@ var require_path_visitor = __commonJS({
|
|
|
46146
46146
|
this.needToCallTraverse = false;
|
|
46147
46147
|
return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
46148
46148
|
};
|
|
46149
|
-
sharedContextProtoMethods.visit = function
|
|
46149
|
+
sharedContextProtoMethods.visit = function visit13(path2, newVisitor) {
|
|
46150
46150
|
if (!(this instanceof this.Context)) {
|
|
46151
46151
|
throw new Error("");
|
|
46152
46152
|
}
|
|
@@ -46184,13 +46184,13 @@ var require_equiv = __commonJS({
|
|
|
46184
46184
|
var shared_1 = require_shared();
|
|
46185
46185
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
46186
46186
|
function default_1(fork) {
|
|
46187
|
-
var
|
|
46188
|
-
var getFieldNames =
|
|
46189
|
-
var getFieldValue =
|
|
46190
|
-
var isArray =
|
|
46191
|
-
var isObject2 =
|
|
46192
|
-
var isDate =
|
|
46193
|
-
var isRegExp =
|
|
46187
|
+
var types16 = fork.use(types_1.default);
|
|
46188
|
+
var getFieldNames = types16.getFieldNames;
|
|
46189
|
+
var getFieldValue = types16.getFieldValue;
|
|
46190
|
+
var isArray = types16.builtInTypes.array;
|
|
46191
|
+
var isObject2 = types16.builtInTypes.object;
|
|
46192
|
+
var isDate = types16.builtInTypes.Date;
|
|
46193
|
+
var isRegExp = types16.builtInTypes.RegExp;
|
|
46194
46194
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
46195
46195
|
function astNodesAreEquivalent(a, b, problemPath) {
|
|
46196
46196
|
if (isArray.check(problemPath)) {
|
|
@@ -46343,24 +46343,24 @@ var require_fork = __commonJS({
|
|
|
46343
46343
|
var shared_1 = require_shared();
|
|
46344
46344
|
function default_1(plugins) {
|
|
46345
46345
|
var fork = createFork();
|
|
46346
|
-
var
|
|
46346
|
+
var types16 = fork.use(types_1.default);
|
|
46347
46347
|
plugins.forEach(fork.use);
|
|
46348
|
-
|
|
46348
|
+
types16.finalize();
|
|
46349
46349
|
var PathVisitor = fork.use(path_visitor_1.default);
|
|
46350
46350
|
return {
|
|
46351
|
-
Type:
|
|
46352
|
-
builtInTypes:
|
|
46353
|
-
namedTypes:
|
|
46354
|
-
builders:
|
|
46355
|
-
defineMethod:
|
|
46356
|
-
getFieldNames:
|
|
46357
|
-
getFieldValue:
|
|
46358
|
-
eachField:
|
|
46359
|
-
someField:
|
|
46360
|
-
getSupertypeNames:
|
|
46361
|
-
getBuilderName:
|
|
46351
|
+
Type: types16.Type,
|
|
46352
|
+
builtInTypes: types16.builtInTypes,
|
|
46353
|
+
namedTypes: types16.namedTypes,
|
|
46354
|
+
builders: types16.builders,
|
|
46355
|
+
defineMethod: types16.defineMethod,
|
|
46356
|
+
getFieldNames: types16.getFieldNames,
|
|
46357
|
+
getFieldValue: types16.getFieldValue,
|
|
46358
|
+
eachField: types16.eachField,
|
|
46359
|
+
someField: types16.someField,
|
|
46360
|
+
getSupertypeNames: types16.getSupertypeNames,
|
|
46361
|
+
getBuilderName: types16.getBuilderName,
|
|
46362
46362
|
astNodesAreEquivalent: fork.use(equiv_1.default),
|
|
46363
|
-
finalize:
|
|
46363
|
+
finalize: types16.finalize,
|
|
46364
46364
|
Path: fork.use(path_1.default),
|
|
46365
46365
|
NodePath: fork.use(node_path_1.default),
|
|
46366
46366
|
PathVisitor,
|
|
@@ -46530,8 +46530,8 @@ var require_core2 = __commonJS({
|
|
|
46530
46530
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
46531
46531
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46532
46532
|
function default_1(fork) {
|
|
46533
|
-
var
|
|
46534
|
-
var Type =
|
|
46533
|
+
var types16 = fork.use(types_1.default);
|
|
46534
|
+
var Type = types16.Type;
|
|
46535
46535
|
var def = Type.def;
|
|
46536
46536
|
var or = Type.or;
|
|
46537
46537
|
var shared = fork.use(shared_1.default);
|
|
@@ -46623,9 +46623,9 @@ var require_es6 = __commonJS({
|
|
|
46623
46623
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46624
46624
|
function default_1(fork) {
|
|
46625
46625
|
fork.use(core_1.default);
|
|
46626
|
-
var
|
|
46627
|
-
var def =
|
|
46628
|
-
var or =
|
|
46626
|
+
var types16 = fork.use(types_1.default);
|
|
46627
|
+
var def = types16.Type.def;
|
|
46628
|
+
var or = types16.Type.or;
|
|
46629
46629
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46630
46630
|
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"]);
|
|
46631
46631
|
def("RestElement").bases("Pattern").build("argument").field("argument", def("Pattern")).field(
|
|
@@ -46715,8 +46715,8 @@ var require_es2017 = __commonJS({
|
|
|
46715
46715
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46716
46716
|
function default_1(fork) {
|
|
46717
46717
|
fork.use(es2016_1.default);
|
|
46718
|
-
var
|
|
46719
|
-
var def =
|
|
46718
|
+
var types16 = fork.use(types_1.default);
|
|
46719
|
+
var def = types16.Type.def;
|
|
46720
46720
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46721
46721
|
def("Function").field("async", Boolean, defaults["false"]);
|
|
46722
46722
|
def("AwaitExpression").bases("Expression").build("argument").field("argument", def("Expression"));
|
|
@@ -46739,9 +46739,9 @@ var require_es2018 = __commonJS({
|
|
|
46739
46739
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46740
46740
|
function default_1(fork) {
|
|
46741
46741
|
fork.use(es2017_1.default);
|
|
46742
|
-
var
|
|
46743
|
-
var def =
|
|
46744
|
-
var or =
|
|
46742
|
+
var types16 = fork.use(types_1.default);
|
|
46743
|
+
var def = types16.Type.def;
|
|
46744
|
+
var or = types16.Type.or;
|
|
46745
46745
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46746
46746
|
def("ForOfStatement").field("await", Boolean, defaults["false"]);
|
|
46747
46747
|
def("SpreadProperty").bases("Node").build("argument").field("argument", def("Expression"));
|
|
@@ -46772,9 +46772,9 @@ var require_es2019 = __commonJS({
|
|
|
46772
46772
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46773
46773
|
function default_1(fork) {
|
|
46774
46774
|
fork.use(es2018_1.default);
|
|
46775
|
-
var
|
|
46776
|
-
var def =
|
|
46777
|
-
var or =
|
|
46775
|
+
var types16 = fork.use(types_1.default);
|
|
46776
|
+
var def = types16.Type.def;
|
|
46777
|
+
var or = types16.Type.or;
|
|
46778
46778
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46779
46779
|
def("CatchClause").field("param", or(def("Pattern"), null), defaults["null"]);
|
|
46780
46780
|
}
|
|
@@ -46798,9 +46798,9 @@ var require_es20202 = __commonJS({
|
|
|
46798
46798
|
function default_1(fork) {
|
|
46799
46799
|
fork.use(es2020_1.default);
|
|
46800
46800
|
fork.use(es2019_1.default);
|
|
46801
|
-
var
|
|
46802
|
-
var def =
|
|
46803
|
-
var or =
|
|
46801
|
+
var types16 = fork.use(types_1.default);
|
|
46802
|
+
var def = types16.Type.def;
|
|
46803
|
+
var or = types16.Type.or;
|
|
46804
46804
|
var shared = fork.use(shared_1.default);
|
|
46805
46805
|
var defaults = shared.defaults;
|
|
46806
46806
|
def("ImportExpression").bases("Expression").build("source").field("source", def("Expression"));
|
|
@@ -46850,8 +46850,8 @@ var require_es2022 = __commonJS({
|
|
|
46850
46850
|
var shared_1 = require_shared();
|
|
46851
46851
|
function default_1(fork) {
|
|
46852
46852
|
fork.use(es2021_1.default);
|
|
46853
|
-
var
|
|
46854
|
-
var def =
|
|
46853
|
+
var types16 = fork.use(types_1.default);
|
|
46854
|
+
var def = types16.Type.def;
|
|
46855
46855
|
def("StaticBlock").bases("Declaration").build("body").field("body", [def("Statement")]);
|
|
46856
46856
|
}
|
|
46857
46857
|
exports.default = default_1;
|
|
@@ -46872,9 +46872,9 @@ var require_es_proposals = __commonJS({
|
|
|
46872
46872
|
var es2022_1 = tslib_1.__importDefault(require_es2022());
|
|
46873
46873
|
function default_1(fork) {
|
|
46874
46874
|
fork.use(es2022_1.default);
|
|
46875
|
-
var
|
|
46876
|
-
var Type =
|
|
46877
|
-
var def =
|
|
46875
|
+
var types16 = fork.use(types_1.default);
|
|
46876
|
+
var Type = types16.Type;
|
|
46877
|
+
var def = types16.Type.def;
|
|
46878
46878
|
var or = Type.or;
|
|
46879
46879
|
var shared = fork.use(shared_1.default);
|
|
46880
46880
|
var defaults = shared.defaults;
|
|
@@ -46914,9 +46914,9 @@ var require_jsx = __commonJS({
|
|
|
46914
46914
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46915
46915
|
function default_1(fork) {
|
|
46916
46916
|
fork.use(es_proposals_1.default);
|
|
46917
|
-
var
|
|
46918
|
-
var def =
|
|
46919
|
-
var or =
|
|
46917
|
+
var types16 = fork.use(types_1.default);
|
|
46918
|
+
var def = types16.Type.def;
|
|
46919
|
+
var or = types16.Type.or;
|
|
46920
46920
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46921
46921
|
def("JSXAttribute").bases("Node").build("name", "value").field("name", or(def("JSXIdentifier"), def("JSXNamespacedName"))).field("value", or(
|
|
46922
46922
|
def("Literal"),
|
|
@@ -46974,9 +46974,9 @@ var require_type_annotations = __commonJS({
|
|
|
46974
46974
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
46975
46975
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46976
46976
|
function default_1(fork) {
|
|
46977
|
-
var
|
|
46978
|
-
var def =
|
|
46979
|
-
var or =
|
|
46977
|
+
var types16 = fork.use(types_1.default);
|
|
46978
|
+
var def = types16.Type.def;
|
|
46979
|
+
var or = types16.Type.or;
|
|
46980
46980
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46981
46981
|
var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
|
|
46982
46982
|
var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
|
|
@@ -47011,9 +47011,9 @@ var require_flow = __commonJS({
|
|
|
47011
47011
|
function default_1(fork) {
|
|
47012
47012
|
fork.use(es_proposals_1.default);
|
|
47013
47013
|
fork.use(type_annotations_1.default);
|
|
47014
|
-
var
|
|
47015
|
-
var def =
|
|
47016
|
-
var or =
|
|
47014
|
+
var types16 = fork.use(types_1.default);
|
|
47015
|
+
var def = types16.Type.def;
|
|
47016
|
+
var or = types16.Type.or;
|
|
47017
47017
|
var defaults = fork.use(shared_1.default).defaults;
|
|
47018
47018
|
def("Flow").bases("Node");
|
|
47019
47019
|
def("FlowType").bases("Flow");
|
|
@@ -47127,10 +47127,10 @@ var require_esprima = __commonJS({
|
|
|
47127
47127
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
47128
47128
|
function default_1(fork) {
|
|
47129
47129
|
fork.use(es_proposals_1.default);
|
|
47130
|
-
var
|
|
47130
|
+
var types16 = fork.use(types_1.default);
|
|
47131
47131
|
var defaults = fork.use(shared_1.default).defaults;
|
|
47132
|
-
var def =
|
|
47133
|
-
var or =
|
|
47132
|
+
var def = types16.Type.def;
|
|
47133
|
+
var or = types16.Type.or;
|
|
47134
47134
|
def("VariableDeclaration").field("declarations", [or(
|
|
47135
47135
|
def("VariableDeclarator"),
|
|
47136
47136
|
def("Identifier")
|
|
@@ -47175,11 +47175,11 @@ var require_babel_core = __commonJS({
|
|
|
47175
47175
|
function default_1(fork) {
|
|
47176
47176
|
var _a, _b, _c, _d, _e;
|
|
47177
47177
|
fork.use(es_proposals_1.default);
|
|
47178
|
-
var
|
|
47178
|
+
var types16 = fork.use(types_1.default);
|
|
47179
47179
|
var defaults = fork.use(shared_1.default).defaults;
|
|
47180
|
-
var def =
|
|
47181
|
-
var or =
|
|
47182
|
-
var isUndefined =
|
|
47180
|
+
var def = types16.Type.def;
|
|
47181
|
+
var or = types16.Type.or;
|
|
47182
|
+
var isUndefined = types16.builtInTypes.undefined;
|
|
47183
47183
|
def("Noop").bases("Statement").build();
|
|
47184
47184
|
def("DoExpression").bases("Expression").build("body").field("body", [def("Statement")]);
|
|
47185
47185
|
def("BindExpression").bases("Expression").build("object", "callee").field("object", or(def("Expression"), null)).field("callee", def("Expression"));
|
|
@@ -47204,7 +47204,7 @@ var require_babel_core = __commonJS({
|
|
|
47204
47204
|
raw: String
|
|
47205
47205
|
},
|
|
47206
47206
|
function getDefault() {
|
|
47207
|
-
var value =
|
|
47207
|
+
var value = types16.getFieldValue(this, "value");
|
|
47208
47208
|
return {
|
|
47209
47209
|
rawValue: value,
|
|
47210
47210
|
raw: toRaw ? toRaw(value) : String(value)
|
|
@@ -47307,8 +47307,8 @@ var require_babel = __commonJS({
|
|
|
47307
47307
|
var flow_1 = tslib_1.__importDefault(require_flow());
|
|
47308
47308
|
var shared_1 = require_shared();
|
|
47309
47309
|
function default_1(fork) {
|
|
47310
|
-
var
|
|
47311
|
-
var def =
|
|
47310
|
+
var types16 = fork.use(types_1.default);
|
|
47311
|
+
var def = types16.Type.def;
|
|
47312
47312
|
fork.use(babel_core_1.default);
|
|
47313
47313
|
fork.use(flow_1.default);
|
|
47314
47314
|
def("V8IntrinsicIdentifier").bases("Expression").build("name").field("name", String);
|
|
@@ -47334,12 +47334,12 @@ var require_typescript = __commonJS({
|
|
|
47334
47334
|
function default_1(fork) {
|
|
47335
47335
|
fork.use(babel_core_1.default);
|
|
47336
47336
|
fork.use(type_annotations_1.default);
|
|
47337
|
-
var
|
|
47338
|
-
var n =
|
|
47339
|
-
var def =
|
|
47340
|
-
var or =
|
|
47337
|
+
var types16 = fork.use(types_1.default);
|
|
47338
|
+
var n = types16.namedTypes;
|
|
47339
|
+
var def = types16.Type.def;
|
|
47340
|
+
var or = types16.Type.or;
|
|
47341
47341
|
var defaults = fork.use(shared_1.default).defaults;
|
|
47342
|
-
var StringLiteral =
|
|
47342
|
+
var StringLiteral = types16.Type.from(function(value, deep) {
|
|
47343
47343
|
if (n.StringLiteral && n.StringLiteral.check(value, deep)) {
|
|
47344
47344
|
return true;
|
|
47345
47345
|
}
|
|
@@ -47539,7 +47539,7 @@ var require_main = __commonJS({
|
|
|
47539
47539
|
var someField = _a.someField;
|
|
47540
47540
|
var Type = _a.Type;
|
|
47541
47541
|
var use = _a.use;
|
|
47542
|
-
var
|
|
47542
|
+
var visit13 = _a.visit;
|
|
47543
47543
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
47544
47544
|
exports.builders = builders;
|
|
47545
47545
|
exports.builtInTypes = builtInTypes;
|
|
@@ -47556,7 +47556,7 @@ var require_main = __commonJS({
|
|
|
47556
47556
|
exports.someField = someField;
|
|
47557
47557
|
exports.Type = Type;
|
|
47558
47558
|
exports.use = use;
|
|
47559
|
-
exports.visit =
|
|
47559
|
+
exports.visit = visit13;
|
|
47560
47560
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
47561
47561
|
}
|
|
47562
47562
|
});
|
|
@@ -49315,8 +49315,8 @@ var require_util2 = __commonJS({
|
|
|
49315
49315
|
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;
|
|
49316
49316
|
var tslib_1 = require_tslib();
|
|
49317
49317
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
49318
|
-
var
|
|
49319
|
-
var n =
|
|
49318
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
49319
|
+
var n = types16.namedTypes;
|
|
49320
49320
|
var source_map_1 = tslib_1.__importDefault(require_source_map());
|
|
49321
49321
|
var SourceMapConsumer = source_map_1.default.SourceMapConsumer;
|
|
49322
49322
|
var SourceMapGenerator = source_map_1.default.SourceMapGenerator;
|
|
@@ -56634,10 +56634,10 @@ var require_comments = __commonJS({
|
|
|
56634
56634
|
exports.printComments = exports.attach = void 0;
|
|
56635
56635
|
var tslib_1 = require_tslib();
|
|
56636
56636
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
56637
|
-
var
|
|
56638
|
-
var n =
|
|
56639
|
-
var isArray =
|
|
56640
|
-
var isObject2 =
|
|
56637
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
56638
|
+
var n = types16.namedTypes;
|
|
56639
|
+
var isArray = types16.builtInTypes.array;
|
|
56640
|
+
var isObject2 = types16.builtInTypes.object;
|
|
56641
56641
|
var lines_1 = require_lines();
|
|
56642
56642
|
var util_1 = require_util2();
|
|
56643
56643
|
var childNodesCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -56668,7 +56668,7 @@ var require_comments = __commonJS({
|
|
|
56668
56668
|
if (isArray.check(node)) {
|
|
56669
56669
|
names = Object.keys(node);
|
|
56670
56670
|
} else if (isObject2.check(node)) {
|
|
56671
|
-
names =
|
|
56671
|
+
names = types16.getFieldNames(node);
|
|
56672
56672
|
} else {
|
|
56673
56673
|
return resultArray;
|
|
56674
56674
|
}
|
|
@@ -56846,7 +56846,7 @@ var require_comments = __commonJS({
|
|
|
56846
56846
|
function printComments(path2, print12) {
|
|
56847
56847
|
var value = path2.getValue();
|
|
56848
56848
|
var innerLines = print12(path2);
|
|
56849
|
-
var comments = n.Node.check(value) &&
|
|
56849
|
+
var comments = n.Node.check(value) && types16.getFieldValue(value, "comments");
|
|
56850
56850
|
if (!comments || comments.length === 0) {
|
|
56851
56851
|
return innerLines;
|
|
56852
56852
|
}
|
|
@@ -56854,8 +56854,8 @@ var require_comments = __commonJS({
|
|
|
56854
56854
|
var trailingParts = [innerLines];
|
|
56855
56855
|
path2.each(function(commentPath) {
|
|
56856
56856
|
var comment = commentPath.getValue();
|
|
56857
|
-
var leading =
|
|
56858
|
-
var trailing =
|
|
56857
|
+
var leading = types16.getFieldValue(comment, "leading");
|
|
56858
|
+
var trailing = types16.getFieldValue(comment, "trailing");
|
|
56859
56859
|
if (leading || trailing && !(n.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
56860
56860
|
leadingParts.push(printLeadingComment(commentPath, print12));
|
|
56861
56861
|
} else if (trailing) {
|
|
@@ -56877,10 +56877,10 @@ var require_parser2 = __commonJS({
|
|
|
56877
56877
|
exports.parse = void 0;
|
|
56878
56878
|
var tslib_1 = require_tslib();
|
|
56879
56879
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
56880
|
-
var
|
|
56881
|
-
var b =
|
|
56882
|
-
var isObject2 =
|
|
56883
|
-
var isArray =
|
|
56880
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
56881
|
+
var b = types16.builders;
|
|
56882
|
+
var isObject2 = types16.builtInTypes.object;
|
|
56883
|
+
var isArray = types16.builtInTypes.array;
|
|
56884
56884
|
var options_1 = require_options();
|
|
56885
56885
|
var lines_1 = require_lines();
|
|
56886
56886
|
var comments_1 = require_comments();
|
|
@@ -57066,11 +57066,11 @@ var require_fast_path = __commonJS({
|
|
|
57066
57066
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57067
57067
|
var tslib_1 = require_tslib();
|
|
57068
57068
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
57069
|
-
var
|
|
57069
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
57070
57070
|
var util = tslib_1.__importStar(require_util2());
|
|
57071
|
-
var n =
|
|
57072
|
-
var isArray =
|
|
57073
|
-
var isNumber =
|
|
57071
|
+
var n = types16.namedTypes;
|
|
57072
|
+
var isArray = types16.builtInTypes.array;
|
|
57073
|
+
var isNumber = types16.builtInTypes.number;
|
|
57074
57074
|
var PRECEDENCE = {};
|
|
57075
57075
|
[
|
|
57076
57076
|
["??"],
|
|
@@ -57099,7 +57099,7 @@ var require_fast_path = __commonJS({
|
|
|
57099
57099
|
if (obj instanceof FastPath) {
|
|
57100
57100
|
return obj.copy();
|
|
57101
57101
|
}
|
|
57102
|
-
if (obj instanceof
|
|
57102
|
+
if (obj instanceof types16.NodePath) {
|
|
57103
57103
|
var copy = Object.create(FastPath.prototype);
|
|
57104
57104
|
var stack = [obj.value];
|
|
57105
57105
|
for (var pp = void 0; pp = obj.parentPath; obj = pp)
|
|
@@ -57410,7 +57410,7 @@ var require_fast_path = __commonJS({
|
|
|
57410
57410
|
return node.some(containsCallExpression);
|
|
57411
57411
|
}
|
|
57412
57412
|
if (n.Node.check(node)) {
|
|
57413
|
-
return
|
|
57413
|
+
return types16.someField(node, function(_name, child) {
|
|
57414
57414
|
return containsCallExpression(child);
|
|
57415
57415
|
});
|
|
57416
57416
|
}
|
|
@@ -57500,16 +57500,16 @@ var require_patcher = __commonJS({
|
|
|
57500
57500
|
var tslib_1 = require_tslib();
|
|
57501
57501
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
57502
57502
|
var linesModule = tslib_1.__importStar(require_lines());
|
|
57503
|
-
var
|
|
57504
|
-
var Printable =
|
|
57505
|
-
var Expression =
|
|
57506
|
-
var ReturnStatement =
|
|
57507
|
-
var SourceLocation =
|
|
57503
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
57504
|
+
var Printable = types16.namedTypes.Printable;
|
|
57505
|
+
var Expression = types16.namedTypes.Expression;
|
|
57506
|
+
var ReturnStatement = types16.namedTypes.ReturnStatement;
|
|
57507
|
+
var SourceLocation = types16.namedTypes.SourceLocation;
|
|
57508
57508
|
var util_1 = require_util2();
|
|
57509
57509
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
57510
|
-
var isObject2 =
|
|
57511
|
-
var isArray =
|
|
57512
|
-
var isString =
|
|
57510
|
+
var isObject2 = types16.builtInTypes.object;
|
|
57511
|
+
var isArray = types16.builtInTypes.array;
|
|
57512
|
+
var isString = types16.builtInTypes.string;
|
|
57513
57513
|
var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
|
|
57514
57514
|
var Patcher = function Patcher2(lines) {
|
|
57515
57515
|
assert_1.default.ok(this instanceof Patcher2);
|
|
@@ -57779,8 +57779,8 @@ var require_patcher = __commonJS({
|
|
|
57779
57779
|
if (k.charAt(0) === "_") {
|
|
57780
57780
|
continue;
|
|
57781
57781
|
}
|
|
57782
|
-
newPath.stack.push(k,
|
|
57783
|
-
oldPath.stack.push(k,
|
|
57782
|
+
newPath.stack.push(k, types16.getFieldValue(newNode, k));
|
|
57783
|
+
oldPath.stack.push(k, types16.getFieldValue(oldNode, k));
|
|
57784
57784
|
var canReprint = findAnyReprints(newPath, oldPath, reprints);
|
|
57785
57785
|
newPath.stack.length -= 2;
|
|
57786
57786
|
oldPath.stack.length -= 2;
|
|
@@ -57804,16 +57804,16 @@ var require_printer2 = __commonJS({
|
|
|
57804
57804
|
exports.Printer = void 0;
|
|
57805
57805
|
var tslib_1 = require_tslib();
|
|
57806
57806
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
57807
|
-
var
|
|
57807
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
57808
57808
|
var comments_1 = require_comments();
|
|
57809
57809
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
57810
57810
|
var lines_1 = require_lines();
|
|
57811
57811
|
var options_1 = require_options();
|
|
57812
57812
|
var patcher_1 = require_patcher();
|
|
57813
57813
|
var util = tslib_1.__importStar(require_util2());
|
|
57814
|
-
var namedTypes =
|
|
57815
|
-
var isString =
|
|
57816
|
-
var isObject2 =
|
|
57814
|
+
var namedTypes = types16.namedTypes;
|
|
57815
|
+
var isString = types16.builtInTypes.string;
|
|
57816
|
+
var isObject2 = types16.builtInTypes.object;
|
|
57817
57817
|
var PrintResult = function PrintResult2(code, sourceMap) {
|
|
57818
57818
|
assert_1.default.ok(this instanceof PrintResult2);
|
|
57819
57819
|
isString.assert(code);
|
|
@@ -57975,7 +57975,7 @@ var require_printer2 = __commonJS({
|
|
|
57975
57975
|
case "OptionalMemberExpression": {
|
|
57976
57976
|
parts.push(path2.call(print12, "object"));
|
|
57977
57977
|
var property = path2.call(print12, "property");
|
|
57978
|
-
var optional =
|
|
57978
|
+
var optional = types16.getFieldValue(n, "optional");
|
|
57979
57979
|
if (n.computed) {
|
|
57980
57980
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
57981
57981
|
} else {
|
|
@@ -58246,7 +58246,7 @@ var require_printer2 = __commonJS({
|
|
|
58246
58246
|
if (n.typeArguments) {
|
|
58247
58247
|
parts.push(path2.call(print12, "typeArguments"));
|
|
58248
58248
|
}
|
|
58249
|
-
if (
|
|
58249
|
+
if (types16.getFieldValue(n, "optional")) {
|
|
58250
58250
|
parts.push("?.");
|
|
58251
58251
|
}
|
|
58252
58252
|
parts.push(printArgumentsList(path2, options, print12));
|
|
@@ -59925,8 +59925,8 @@ var require_printer2 = __commonJS({
|
|
|
59925
59925
|
});
|
|
59926
59926
|
}
|
|
59927
59927
|
function getPossibleRaw(node) {
|
|
59928
|
-
var value =
|
|
59929
|
-
var extra =
|
|
59928
|
+
var value = types16.getFieldValue(node, "value");
|
|
59929
|
+
var extra = types16.getFieldValue(node, "extra");
|
|
59930
59930
|
if (extra && typeof extra.raw === "string" && value == extra.rawValue) {
|
|
59931
59931
|
return extra.raw;
|
|
59932
59932
|
}
|
|
@@ -59974,8 +59974,8 @@ var require_main2 = __commonJS({
|
|
|
59974
59974
|
exports.run = exports.prettyPrint = exports.print = exports.visit = exports.types = exports.parse = void 0;
|
|
59975
59975
|
var tslib_1 = require_tslib();
|
|
59976
59976
|
var fs_1 = tslib_1.__importDefault(require("fs"));
|
|
59977
|
-
var
|
|
59978
|
-
exports.types =
|
|
59977
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
59978
|
+
exports.types = types16;
|
|
59979
59979
|
var parser_1 = require_parser2();
|
|
59980
59980
|
Object.defineProperty(exports, "parse", { enumerable: true, get: function() {
|
|
59981
59981
|
return parser_1.parse;
|
|
@@ -59989,10 +59989,10 @@ var require_main2 = __commonJS({
|
|
|
59989
59989
|
return new printer_1.Printer(options).print(node);
|
|
59990
59990
|
}
|
|
59991
59991
|
exports.print = print12;
|
|
59992
|
-
function
|
|
59992
|
+
function prettyPrint3(node, options) {
|
|
59993
59993
|
return new printer_1.Printer(options).printGenerically(node);
|
|
59994
59994
|
}
|
|
59995
|
-
exports.prettyPrint =
|
|
59995
|
+
exports.prettyPrint = prettyPrint3;
|
|
59996
59996
|
function run(transformer, options) {
|
|
59997
59997
|
return runFile(process.argv[2], transformer, options);
|
|
59998
59998
|
}
|
|
@@ -65948,7 +65948,7 @@ var printDocASTReducer = {
|
|
|
65948
65948
|
leave: ({ name: name2, interfaces, directives, fields }) => join(["interface", name2, wrap("implements ", join(interfaces, " & ")), join(directives, " "), block(fields)], " ")
|
|
65949
65949
|
},
|
|
65950
65950
|
UnionTypeDefinition: {
|
|
65951
|
-
leave: ({ name: name2, directives, types:
|
|
65951
|
+
leave: ({ name: name2, directives, types: types16 }) => join(["union", name2, join(directives, " "), wrap("= ", join(types16, " | "))], " ")
|
|
65952
65952
|
},
|
|
65953
65953
|
EnumTypeDefinition: {
|
|
65954
65954
|
leave: ({ name: name2, directives, values }) => join(["enum", name2, join(directives, " "), block(values)], " ")
|
|
@@ -65975,7 +65975,7 @@ var printDocASTReducer = {
|
|
|
65975
65975
|
leave: ({ name: name2, interfaces, directives, fields }) => join(["extend interface", name2, wrap("implements ", join(interfaces, " & ")), join(directives, " "), block(fields)], " ")
|
|
65976
65976
|
},
|
|
65977
65977
|
UnionTypeExtension: {
|
|
65978
|
-
leave: ({ name: name2, directives, types:
|
|
65978
|
+
leave: ({ name: name2, directives, types: types16 }) => join(["extend union", name2, join(directives, " "), wrap("= ", join(types16, " | "))], " ")
|
|
65979
65979
|
},
|
|
65980
65980
|
EnumTypeExtension: {
|
|
65981
65981
|
leave: ({ name: name2, directives, values }) => join(["extend enum", name2, join(directives, " "), block(values)], " ")
|
|
@@ -66855,8 +66855,8 @@ function healTypes(originalTypeMap, directives) {
|
|
|
66855
66855
|
}
|
|
66856
66856
|
}
|
|
66857
66857
|
function healUnderlyingTypes(type) {
|
|
66858
|
-
const
|
|
66859
|
-
|
|
66858
|
+
const types16 = type.getTypes();
|
|
66859
|
+
types16.push(...types16.splice(0).map((t2) => healType(t2)).filter(Boolean));
|
|
66860
66860
|
}
|
|
66861
66861
|
function healType(type) {
|
|
66862
66862
|
if ((0, import_graphql11.isListType)(type)) {
|
|
@@ -67640,11 +67640,11 @@ function mergeEnum(e1, e2, config2) {
|
|
|
67640
67640
|
|
|
67641
67641
|
// ../../node_modules/.pnpm/@graphql-tools+merge@8.3.14_graphql@15.8.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/utils.js
|
|
67642
67642
|
var import_graphql20 = __toESM(require_graphql2(), 1);
|
|
67643
|
-
function isStringTypes(
|
|
67644
|
-
return typeof
|
|
67643
|
+
function isStringTypes(types16) {
|
|
67644
|
+
return typeof types16 === "string";
|
|
67645
67645
|
}
|
|
67646
|
-
function isSourceTypes(
|
|
67647
|
-
return
|
|
67646
|
+
function isSourceTypes(types16) {
|
|
67647
|
+
return types16 instanceof import_graphql20.Source;
|
|
67648
67648
|
}
|
|
67649
67649
|
function extractType(type) {
|
|
67650
67650
|
let visitedType = type;
|
|
@@ -68670,8 +68670,8 @@ var List = class {
|
|
|
68670
68670
|
} else {
|
|
68671
68671
|
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
68672
68672
|
}
|
|
68673
|
-
for (let
|
|
68674
|
-
yield
|
|
68673
|
+
for (let record2 of entries) {
|
|
68674
|
+
yield record2;
|
|
68675
68675
|
}
|
|
68676
68676
|
}
|
|
68677
68677
|
};
|
|
@@ -68720,6 +68720,46 @@ var ListCollection = class {
|
|
|
68720
68720
|
}
|
|
68721
68721
|
};
|
|
68722
68722
|
|
|
68723
|
+
// src/runtime/cache/schema.ts
|
|
68724
|
+
var SchemaManager = class {
|
|
68725
|
+
cache;
|
|
68726
|
+
fieldTypes = {};
|
|
68727
|
+
constructor(cache) {
|
|
68728
|
+
this.cache = cache;
|
|
68729
|
+
}
|
|
68730
|
+
setFieldType({
|
|
68731
|
+
parent,
|
|
68732
|
+
key,
|
|
68733
|
+
type,
|
|
68734
|
+
nullable = false,
|
|
68735
|
+
link
|
|
68736
|
+
}) {
|
|
68737
|
+
let parensIndex = key.indexOf("(");
|
|
68738
|
+
if (parensIndex !== -1) {
|
|
68739
|
+
key = key.substring(0, parensIndex);
|
|
68740
|
+
}
|
|
68741
|
+
if (parent === rootID) {
|
|
68742
|
+
parent = "Query";
|
|
68743
|
+
} else if (parent.includes(":")) {
|
|
68744
|
+
parent = parent.substring(0, parent.indexOf(":"));
|
|
68745
|
+
}
|
|
68746
|
+
if (!this.fieldTypes[parent]) {
|
|
68747
|
+
this.fieldTypes[parent] = {};
|
|
68748
|
+
}
|
|
68749
|
+
this.fieldTypes[parent][key] = {
|
|
68750
|
+
type,
|
|
68751
|
+
nullable,
|
|
68752
|
+
link: !!link
|
|
68753
|
+
};
|
|
68754
|
+
}
|
|
68755
|
+
fieldType(type, field) {
|
|
68756
|
+
return this.fieldTypes[type]?.[field] || null;
|
|
68757
|
+
}
|
|
68758
|
+
get config() {
|
|
68759
|
+
return this.cache._internal_unstable.config;
|
|
68760
|
+
}
|
|
68761
|
+
};
|
|
68762
|
+
|
|
68723
68763
|
// src/runtime/cache/storage.ts
|
|
68724
68764
|
var InMemoryStorage = class {
|
|
68725
68765
|
data;
|
|
@@ -69287,7 +69327,7 @@ var InMemorySubscriptions = class {
|
|
|
69287
69327
|
};
|
|
69288
69328
|
|
|
69289
69329
|
// src/runtime/cache/cache.ts
|
|
69290
|
-
var
|
|
69330
|
+
var Cache3 = class {
|
|
69291
69331
|
_internal_unstable;
|
|
69292
69332
|
constructor(config2) {
|
|
69293
69333
|
this._internal_unstable = new CacheInternal({
|
|
@@ -69295,7 +69335,8 @@ var Cache2 = class {
|
|
|
69295
69335
|
storage: new InMemoryStorage(),
|
|
69296
69336
|
subscriptions: new InMemorySubscriptions(this),
|
|
69297
69337
|
lists: new ListManager(this, rootID),
|
|
69298
|
-
lifetimes: new GarbageCollector(this)
|
|
69338
|
+
lifetimes: new GarbageCollector(this),
|
|
69339
|
+
schema: new SchemaManager(this)
|
|
69299
69340
|
});
|
|
69300
69341
|
if (config2) {
|
|
69301
69342
|
this.setConfig(defaultConfigValues(config2));
|
|
@@ -69381,18 +69422,21 @@ var CacheInternal = class {
|
|
|
69381
69422
|
lists;
|
|
69382
69423
|
cache;
|
|
69383
69424
|
lifetimes;
|
|
69425
|
+
schema;
|
|
69384
69426
|
constructor({
|
|
69385
69427
|
storage,
|
|
69386
69428
|
subscriptions,
|
|
69387
69429
|
lists,
|
|
69388
69430
|
cache,
|
|
69389
|
-
lifetimes
|
|
69431
|
+
lifetimes,
|
|
69432
|
+
schema
|
|
69390
69433
|
}) {
|
|
69391
69434
|
this.storage = storage;
|
|
69392
69435
|
this.subscriptions = subscriptions;
|
|
69393
69436
|
this.lists = lists;
|
|
69394
69437
|
this.cache = cache;
|
|
69395
69438
|
this.lifetimes = lifetimes;
|
|
69439
|
+
this.schema = schema;
|
|
69396
69440
|
this._disabled = typeof globalThis.window === "undefined";
|
|
69397
69441
|
try {
|
|
69398
69442
|
if (process.env.HOUDINI_TEST === "true") {
|
|
@@ -69408,7 +69452,6 @@ var CacheInternal = class {
|
|
|
69408
69452
|
data,
|
|
69409
69453
|
selection: selection2,
|
|
69410
69454
|
variables = {},
|
|
69411
|
-
root = rootID,
|
|
69412
69455
|
parent = rootID,
|
|
69413
69456
|
applyUpdates = false,
|
|
69414
69457
|
layer,
|
|
@@ -69431,9 +69474,17 @@ var CacheInternal = class {
|
|
|
69431
69474
|
selection: fieldSelection,
|
|
69432
69475
|
operations,
|
|
69433
69476
|
abstract: isAbstract,
|
|
69434
|
-
update
|
|
69477
|
+
update,
|
|
69478
|
+
nullable
|
|
69435
69479
|
} = targetSelection[field];
|
|
69436
69480
|
const key = evaluateKey(keyRaw, variables);
|
|
69481
|
+
this.schema.setFieldType({
|
|
69482
|
+
parent,
|
|
69483
|
+
key: keyRaw,
|
|
69484
|
+
type: linkedType,
|
|
69485
|
+
nullable,
|
|
69486
|
+
link: !!fieldSelection
|
|
69487
|
+
});
|
|
69437
69488
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
69438
69489
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
69439
69490
|
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
@@ -69502,7 +69553,6 @@ var CacheInternal = class {
|
|
|
69502
69553
|
}
|
|
69503
69554
|
if (linkedID) {
|
|
69504
69555
|
this.writeSelection({
|
|
69505
|
-
root,
|
|
69506
69556
|
selection: fieldSelection,
|
|
69507
69557
|
parent: linkedID,
|
|
69508
69558
|
data: value,
|
|
@@ -69893,7 +69943,7 @@ var CacheInternal = class {
|
|
|
69893
69943
|
var rootID = "_ROOT_";
|
|
69894
69944
|
|
|
69895
69945
|
// src/runtime/cache/index.ts
|
|
69896
|
-
var cache_default = new
|
|
69946
|
+
var cache_default = new Cache3();
|
|
69897
69947
|
|
|
69898
69948
|
// src/runtime/lib/types.ts
|
|
69899
69949
|
var CompiledFragmentKind = "HoudiniFragment" /* Fragment */;
|
|
@@ -70085,6 +70135,7 @@ async function writeFile(filepath, data) {
|
|
|
70085
70135
|
return;
|
|
70086
70136
|
}
|
|
70087
70137
|
if (houdini_mode.is_testing) {
|
|
70138
|
+
import_memfs.fs.mkdirpSync(dirname(filepath));
|
|
70088
70139
|
return import_memfs.fs.writeFileSync(filepath, data);
|
|
70089
70140
|
}
|
|
70090
70141
|
return await import_promises.default.writeFile(filepath, data, "utf8");
|
|
@@ -71452,7 +71503,6 @@ var Config = class {
|
|
|
71452
71503
|
rootDir;
|
|
71453
71504
|
projectRoot;
|
|
71454
71505
|
schema;
|
|
71455
|
-
apiUrl;
|
|
71456
71506
|
schemaPath;
|
|
71457
71507
|
persistedQueryPath;
|
|
71458
71508
|
exclude;
|
|
@@ -71492,7 +71542,6 @@ var Config = class {
|
|
|
71492
71542
|
schema,
|
|
71493
71543
|
schemaPath = "./schema.graphql",
|
|
71494
71544
|
exclude = [],
|
|
71495
|
-
apiUrl,
|
|
71496
71545
|
module: module2 = "esm",
|
|
71497
71546
|
scalars,
|
|
71498
71547
|
cacheBufferSize,
|
|
@@ -71502,7 +71551,7 @@ var Config = class {
|
|
|
71502
71551
|
defaultListPosition = "append",
|
|
71503
71552
|
defaultListTarget = null,
|
|
71504
71553
|
defaultKeys,
|
|
71505
|
-
types:
|
|
71554
|
+
types: types16 = {},
|
|
71506
71555
|
logLevel,
|
|
71507
71556
|
defaultFragmentMasking = "enable",
|
|
71508
71557
|
schemaPollInterval = 2e3,
|
|
@@ -71523,11 +71572,6 @@ var Config = class {
|
|
|
71523
71572
|
logLevel = LogLevel.Summary;
|
|
71524
71573
|
}
|
|
71525
71574
|
this.schemaPath = schemaPath;
|
|
71526
|
-
if (apiUrl && apiUrl.startsWith("env:")) {
|
|
71527
|
-
this.apiUrl = process.env[apiUrl.slice("env:".length)];
|
|
71528
|
-
} else {
|
|
71529
|
-
this.apiUrl = apiUrl;
|
|
71530
|
-
}
|
|
71531
71575
|
this.filepath = filepath;
|
|
71532
71576
|
this.exclude = Array.isArray(exclude) ? exclude : [exclude];
|
|
71533
71577
|
this.module = module2;
|
|
@@ -71550,13 +71594,20 @@ var Config = class {
|
|
|
71550
71594
|
if (defaultKeys) {
|
|
71551
71595
|
this.defaultKeys = defaultKeys;
|
|
71552
71596
|
}
|
|
71553
|
-
if (
|
|
71597
|
+
if (types16) {
|
|
71554
71598
|
this.typeConfig = {
|
|
71555
71599
|
...this.typeConfig,
|
|
71556
|
-
...
|
|
71600
|
+
...types16
|
|
71557
71601
|
};
|
|
71558
71602
|
}
|
|
71559
71603
|
}
|
|
71604
|
+
async apiURL() {
|
|
71605
|
+
if (!this.configFile.apiUrl) {
|
|
71606
|
+
return "";
|
|
71607
|
+
}
|
|
71608
|
+
const env = await this.getEnv();
|
|
71609
|
+
return this.processEnvValues(env, this.configFile.apiUrl);
|
|
71610
|
+
}
|
|
71560
71611
|
get include() {
|
|
71561
71612
|
if (this.configFile.include) {
|
|
71562
71613
|
return Array.isArray(this.configFile.include) ? this.configFile.include : [this.configFile.include];
|
|
@@ -71569,23 +71620,43 @@ var Config = class {
|
|
|
71569
71620
|
pluginConfig(name2) {
|
|
71570
71621
|
return this.configFile.plugins?.[name2] ?? {};
|
|
71571
71622
|
}
|
|
71572
|
-
|
|
71573
|
-
|
|
71623
|
+
async getEnv() {
|
|
71624
|
+
let env = process.env;
|
|
71625
|
+
for (const plugin of this.plugins) {
|
|
71626
|
+
if (plugin.env) {
|
|
71627
|
+
env = {
|
|
71628
|
+
...await plugin.env({ config: this, env })
|
|
71629
|
+
};
|
|
71630
|
+
}
|
|
71631
|
+
}
|
|
71632
|
+
return env;
|
|
71633
|
+
}
|
|
71634
|
+
processEnvValues(env, value) {
|
|
71635
|
+
let headerValue;
|
|
71636
|
+
if (typeof value === "function") {
|
|
71637
|
+
headerValue = value(env);
|
|
71638
|
+
} else if (value.startsWith("env:")) {
|
|
71639
|
+
headerValue = env[value.slice("env:".length)];
|
|
71640
|
+
} else {
|
|
71641
|
+
headerValue = value;
|
|
71642
|
+
}
|
|
71643
|
+
return headerValue;
|
|
71644
|
+
}
|
|
71645
|
+
async pullHeaders() {
|
|
71646
|
+
const env = await this.getEnv();
|
|
71647
|
+
if (typeof this.schemaPollHeaders === "function") {
|
|
71648
|
+
return this.schemaPollHeaders(env);
|
|
71649
|
+
}
|
|
71650
|
+
const headers = Object.fromEntries(
|
|
71574
71651
|
Object.entries(this.schemaPollHeaders || {}).map(([key, value]) => {
|
|
71575
|
-
|
|
71576
|
-
if (typeof value === "function") {
|
|
71577
|
-
headerValue = value(process.env);
|
|
71578
|
-
} else if (value.startsWith("env:")) {
|
|
71579
|
-
headerValue = process.env[value.slice("env:".length)];
|
|
71580
|
-
} else {
|
|
71581
|
-
headerValue = value;
|
|
71582
|
-
}
|
|
71652
|
+
const headerValue = this.processEnvValues(env, value);
|
|
71583
71653
|
if (!headerValue) {
|
|
71584
71654
|
return [];
|
|
71585
71655
|
}
|
|
71586
71656
|
return [key, headerValue];
|
|
71587
|
-
})
|
|
71657
|
+
}).filter(([key]) => key)
|
|
71588
71658
|
);
|
|
71659
|
+
return headers;
|
|
71589
71660
|
}
|
|
71590
71661
|
async sourceFiles() {
|
|
71591
71662
|
return [
|
|
@@ -71991,9 +72062,10 @@ async function getConfig({
|
|
|
71991
72062
|
...extraConfig,
|
|
71992
72063
|
filepath: configPath
|
|
71993
72064
|
});
|
|
72065
|
+
const apiURL = await _config.apiURL();
|
|
71994
72066
|
if (_config.schemaPath && !_config.schema) {
|
|
71995
72067
|
let schemaOk = true;
|
|
71996
|
-
if (
|
|
72068
|
+
if (apiURL) {
|
|
71997
72069
|
if (glob.hasMagic(_config.schemaPath)) {
|
|
71998
72070
|
console.log(
|
|
71999
72071
|
`\u26A0\uFE0F Your houdini configuration contains an apiUrl and a path pointing to multiple files.
|
|
@@ -72001,7 +72073,7 @@ This will prevent your schema from being pulled.`
|
|
|
72001
72073
|
);
|
|
72002
72074
|
} else if (!await readFile(_config.schemaPath)) {
|
|
72003
72075
|
console.log("\u231B Pulling schema from api");
|
|
72004
|
-
schemaOk = await pullSchema(
|
|
72076
|
+
schemaOk = await pullSchema(apiURL, _config.schemaPath);
|
|
72005
72077
|
}
|
|
72006
72078
|
}
|
|
72007
72079
|
if (schemaOk && !noSchema) {
|
|
@@ -72012,10 +72084,11 @@ This will prevent your schema from being pulled.`
|
|
|
72012
72084
|
reject(e2);
|
|
72013
72085
|
throw e2;
|
|
72014
72086
|
}
|
|
72087
|
+
const plugins = [];
|
|
72015
72088
|
for (const [pluginName, plugin_config] of Object.entries(_config.configFile.plugins ?? {})) {
|
|
72016
72089
|
try {
|
|
72017
72090
|
const pluginDirectory = _config.findModule(pluginName);
|
|
72018
|
-
const { default:
|
|
72091
|
+
const { default: pluginFactory } = await import((0, import_url.pathToFileURL)(pluginDirectory).toString() + "/build/plugin-esm/index.js");
|
|
72019
72092
|
let include_runtime = false;
|
|
72020
72093
|
try {
|
|
72021
72094
|
await stat(join2(pluginDirectory, "build", "runtime-esm"));
|
|
@@ -72032,8 +72105,8 @@ This will prevent your schema from being pulled.`
|
|
|
72032
72105
|
version = packageJSON.version;
|
|
72033
72106
|
} catch {
|
|
72034
72107
|
}
|
|
72035
|
-
|
|
72036
|
-
...await
|
|
72108
|
+
plugins.push({
|
|
72109
|
+
...await pluginFactory(plugin_config),
|
|
72037
72110
|
name: pluginName,
|
|
72038
72111
|
include_runtime,
|
|
72039
72112
|
version,
|
|
@@ -72045,6 +72118,7 @@ This will prevent your schema from being pulled.`
|
|
|
72045
72118
|
);
|
|
72046
72119
|
}
|
|
72047
72120
|
}
|
|
72121
|
+
_config.plugins = orderedPlugins(plugins);
|
|
72048
72122
|
await Promise.all(_config.plugins.map((plugin) => plugin.after_load?.(_config)));
|
|
72049
72123
|
resolve2(_config);
|
|
72050
72124
|
return _config;
|
|
@@ -72056,6 +72130,16 @@ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
|
72056
72130
|
LogLevel2["Quiet"] = "quiet";
|
|
72057
72131
|
return LogLevel2;
|
|
72058
72132
|
})(LogLevel || {});
|
|
72133
|
+
var orderedPlugins = (plugins) => {
|
|
72134
|
+
const ordered = plugins.filter(
|
|
72135
|
+
(plugin) => plugin.order === "before" || plugin.order === void 0
|
|
72136
|
+
);
|
|
72137
|
+
ordered.push(
|
|
72138
|
+
...plugins.filter((plugin) => plugin.order === "core"),
|
|
72139
|
+
...plugins.filter((plugin) => plugin.order === "after")
|
|
72140
|
+
);
|
|
72141
|
+
return ordered;
|
|
72142
|
+
};
|
|
72059
72143
|
|
|
72060
72144
|
// src/lib/graphql.ts
|
|
72061
72145
|
var import_crypto = __toESM(require("crypto"), 1);
|
|
@@ -72343,56 +72427,78 @@ var graphql4 = __toESM(require_graphql2(), 1);
|
|
|
72343
72427
|
async function find_graphql(config2, parsedScript, walker) {
|
|
72344
72428
|
await asyncWalk(parsedScript, {
|
|
72345
72429
|
async enter(node, parent) {
|
|
72346
|
-
if (node.type
|
|
72430
|
+
if (node.type !== "TaggedTemplateExpression" && node.type !== "CallExpression") {
|
|
72431
|
+
return;
|
|
72432
|
+
}
|
|
72433
|
+
let documentString;
|
|
72434
|
+
if (node.type === "TaggedTemplateExpression") {
|
|
72347
72435
|
const expr = node;
|
|
72348
|
-
|
|
72349
|
-
const parsedTag = graphql4.parse(tagContent);
|
|
72350
|
-
if (walker.where && !walker.where(parsedTag)) {
|
|
72436
|
+
if (expr.tag.type !== "Identifier" || expr.tag.name !== "graphql") {
|
|
72351
72437
|
return;
|
|
72352
72438
|
}
|
|
72353
|
-
|
|
72354
|
-
|
|
72355
|
-
|
|
72356
|
-
|
|
72439
|
+
documentString = expr.quasi.quasis[0].value.raw;
|
|
72440
|
+
} else if (node.type === "CallExpression") {
|
|
72441
|
+
const expr = node;
|
|
72442
|
+
if (expr.callee.type !== "Identifier" || expr.callee.name !== "graphql" || expr.arguments.length !== 1) {
|
|
72443
|
+
return;
|
|
72357
72444
|
}
|
|
72358
|
-
|
|
72359
|
-
if (
|
|
72360
|
-
|
|
72445
|
+
const argument = expr.arguments[0];
|
|
72446
|
+
if (argument.type === "TemplateLiteral") {
|
|
72447
|
+
documentString = argument.quasis[0].value.raw;
|
|
72448
|
+
} else if (argument.type === "StringLiteral") {
|
|
72449
|
+
documentString = argument.value;
|
|
72361
72450
|
} else {
|
|
72362
|
-
|
|
72363
|
-
|
|
72364
|
-
|
|
72365
|
-
|
|
72366
|
-
|
|
72367
|
-
|
|
72368
|
-
|
|
72451
|
+
return;
|
|
72452
|
+
}
|
|
72453
|
+
} else {
|
|
72454
|
+
return;
|
|
72455
|
+
}
|
|
72456
|
+
const parsedTag = graphql4.parse(documentString);
|
|
72457
|
+
if (walker.where && !walker.where(parsedTag)) {
|
|
72458
|
+
return;
|
|
72459
|
+
}
|
|
72460
|
+
const definition = config2.extractDefinition(parsedTag);
|
|
72461
|
+
const name2 = definition.name?.value;
|
|
72462
|
+
if (!name2) {
|
|
72463
|
+
throw new Error("Could not find definition name");
|
|
72464
|
+
}
|
|
72465
|
+
let kind;
|
|
72466
|
+
if (definition.kind === "FragmentDefinition") {
|
|
72467
|
+
kind = CompiledFragmentKind;
|
|
72468
|
+
} else {
|
|
72469
|
+
if (definition.operation === "query") {
|
|
72470
|
+
kind = CompiledQueryKind;
|
|
72471
|
+
} else if (definition.operation === "mutation") {
|
|
72472
|
+
kind = CompiledMutationKind;
|
|
72473
|
+
} else {
|
|
72474
|
+
kind = CompiledSubscriptionKind;
|
|
72369
72475
|
}
|
|
72370
|
-
walker.dependency?.(config2.artifactPath(parsedTag));
|
|
72371
|
-
await walker.tag({
|
|
72372
|
-
parsedDocument: parsedTag,
|
|
72373
|
-
node: {
|
|
72374
|
-
...node,
|
|
72375
|
-
...this,
|
|
72376
|
-
remove: this.remove,
|
|
72377
|
-
replaceWith: this.replace
|
|
72378
|
-
},
|
|
72379
|
-
artifact: {
|
|
72380
|
-
name: name2,
|
|
72381
|
-
kind
|
|
72382
|
-
},
|
|
72383
|
-
parent,
|
|
72384
|
-
tagContent
|
|
72385
|
-
});
|
|
72386
72476
|
}
|
|
72477
|
+
walker.dependency?.(config2.artifactPath(parsedTag));
|
|
72478
|
+
await walker.tag({
|
|
72479
|
+
parsedDocument: parsedTag,
|
|
72480
|
+
node: {
|
|
72481
|
+
...node,
|
|
72482
|
+
...this,
|
|
72483
|
+
remove: this.remove,
|
|
72484
|
+
replaceWith: this.replace
|
|
72485
|
+
},
|
|
72486
|
+
artifact: {
|
|
72487
|
+
name: name2,
|
|
72488
|
+
kind
|
|
72489
|
+
},
|
|
72490
|
+
parent,
|
|
72491
|
+
tagContent: documentString
|
|
72492
|
+
});
|
|
72387
72493
|
}
|
|
72388
72494
|
});
|
|
72389
72495
|
}
|
|
72390
72496
|
|
|
72391
72497
|
// src/codegen/index.ts
|
|
72392
|
-
var
|
|
72498
|
+
var graphql29 = __toESM(require_graphql2(), 1);
|
|
72393
72499
|
|
|
72394
72500
|
// src/codegen/generators/artifacts/index.ts
|
|
72395
|
-
var
|
|
72501
|
+
var graphql14 = __toESM(require_graphql2(), 1);
|
|
72396
72502
|
var recast5 = __toESM(require_main2(), 1);
|
|
72397
72503
|
|
|
72398
72504
|
// src/codegen/utils/commonjs.ts
|
|
@@ -72809,7 +72915,7 @@ function deepMerge(filepath, ...targets) {
|
|
|
72809
72915
|
Object.entries(fields).map(([key, value]) => [key, deepMerge(filepath, ...value)])
|
|
72810
72916
|
);
|
|
72811
72917
|
}
|
|
72812
|
-
function convertValue(val) {
|
|
72918
|
+
function convertValue(config2, val) {
|
|
72813
72919
|
let value;
|
|
72814
72920
|
let kind;
|
|
72815
72921
|
if (val.kind === graphql7.Kind.INT) {
|
|
@@ -72941,7 +73047,7 @@ function operationObject({
|
|
|
72941
73047
|
operationWhen[i2 ? "must_not" : "must"] = arg.value.fields.reduce(
|
|
72942
73048
|
(obj, arg2) => ({
|
|
72943
73049
|
...obj,
|
|
72944
|
-
[arg2.name.value]: convertValue(arg2.value).value
|
|
73050
|
+
[arg2.name.value]: convertValue(config2, arg2.value).value
|
|
72945
73051
|
}),
|
|
72946
73052
|
{}
|
|
72947
73053
|
);
|
|
@@ -72957,7 +73063,7 @@ function operationObject({
|
|
|
72957
73063
|
operationWhen[which] = directive.arguments?.reduce(
|
|
72958
73064
|
(filters, argument) => ({
|
|
72959
73065
|
...filters,
|
|
72960
|
-
[argument.name.value]: convertValue(argument.value).value
|
|
73066
|
+
[argument.name.value]: convertValue(config2, argument.value).value
|
|
72961
73067
|
}),
|
|
72962
73068
|
{}
|
|
72963
73069
|
);
|
|
@@ -72996,7 +73102,7 @@ function ancestorKey(ancestors) {
|
|
|
72996
73102
|
}
|
|
72997
73103
|
|
|
72998
73104
|
// src/codegen/generators/artifacts/selection.ts
|
|
72999
|
-
var
|
|
73105
|
+
var graphql13 = __toESM(require_graphql2(), 1);
|
|
73000
73106
|
|
|
73001
73107
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
73002
73108
|
var config = {
|
|
@@ -73036,10 +73142,24 @@ function logYellow(str) {
|
|
|
73036
73142
|
}
|
|
73037
73143
|
|
|
73038
73144
|
// src/codegen/transforms/list.ts
|
|
73039
|
-
var
|
|
73145
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
73040
73146
|
|
|
73041
|
-
// src/codegen/
|
|
73147
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
73042
73148
|
var graphql9 = __toESM(require_graphql2(), 1);
|
|
73149
|
+
var objectIdentificationSelection = (config2, type) => {
|
|
73150
|
+
return config2.keyFieldsForType(type.name).map((key) => {
|
|
73151
|
+
return {
|
|
73152
|
+
kind: graphql9.Kind.FIELD,
|
|
73153
|
+
name: {
|
|
73154
|
+
kind: graphql9.Kind.NAME,
|
|
73155
|
+
value: key
|
|
73156
|
+
}
|
|
73157
|
+
};
|
|
73158
|
+
});
|
|
73159
|
+
};
|
|
73160
|
+
|
|
73161
|
+
// src/codegen/transforms/paginate.ts
|
|
73162
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
73043
73163
|
async function paginate(config2, documents) {
|
|
73044
73164
|
const newDocs = [];
|
|
73045
73165
|
for (const doc of documents) {
|
|
@@ -73072,7 +73192,7 @@ async function paginate(config2, documents) {
|
|
|
73072
73192
|
};
|
|
73073
73193
|
let cursorType = "String";
|
|
73074
73194
|
let paginationPath = [];
|
|
73075
|
-
doc.document =
|
|
73195
|
+
doc.document = graphql10.visit(doc.document, {
|
|
73076
73196
|
Field(node, _, __, ___, ancestors) {
|
|
73077
73197
|
const paginateDirective = node.directives?.find(
|
|
73078
73198
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -73099,7 +73219,7 @@ async function paginate(config2, documents) {
|
|
|
73099
73219
|
flags.offset.enabled = offsetPagination;
|
|
73100
73220
|
flags.limit.enabled = offsetPagination;
|
|
73101
73221
|
paginationPath = ancestors.filter(
|
|
73102
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
73222
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql10.Kind.FIELD
|
|
73103
73223
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
73104
73224
|
return {
|
|
73105
73225
|
...node,
|
|
@@ -73120,7 +73240,7 @@ async function paginate(config2, documents) {
|
|
|
73120
73240
|
refetchUpdate = "prepend" /* prepend */;
|
|
73121
73241
|
}
|
|
73122
73242
|
let fragment = "";
|
|
73123
|
-
doc.document =
|
|
73243
|
+
doc.document = graphql10.visit(doc.document, {
|
|
73124
73244
|
OperationDefinition(node) {
|
|
73125
73245
|
if (node.operation !== "query") {
|
|
73126
73246
|
throw new HoudiniError({
|
|
@@ -73174,9 +73294,9 @@ async function paginate(config2, documents) {
|
|
|
73174
73294
|
directives: [
|
|
73175
73295
|
...node.directives || [],
|
|
73176
73296
|
{
|
|
73177
|
-
kind:
|
|
73297
|
+
kind: graphql10.Kind.DIRECTIVE,
|
|
73178
73298
|
name: {
|
|
73179
|
-
kind:
|
|
73299
|
+
kind: graphql10.Kind.NAME,
|
|
73180
73300
|
value: config2.argumentsDirective
|
|
73181
73301
|
}
|
|
73182
73302
|
}
|
|
@@ -73239,16 +73359,16 @@ async function paginate(config2, documents) {
|
|
|
73239
73359
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
73240
73360
|
const fragmentSpreadSelection = [
|
|
73241
73361
|
{
|
|
73242
|
-
kind:
|
|
73362
|
+
kind: graphql10.Kind.FRAGMENT_SPREAD,
|
|
73243
73363
|
name: {
|
|
73244
|
-
kind:
|
|
73364
|
+
kind: graphql10.Kind.NAME,
|
|
73245
73365
|
value: fragmentName
|
|
73246
73366
|
},
|
|
73247
73367
|
directives: [
|
|
73248
73368
|
{
|
|
73249
|
-
kind:
|
|
73369
|
+
kind: graphql10.Kind.DIRECTIVE,
|
|
73250
73370
|
name: {
|
|
73251
|
-
kind:
|
|
73371
|
+
kind: graphql10.Kind.NAME,
|
|
73252
73372
|
value: config2.withDirective
|
|
73253
73373
|
},
|
|
73254
73374
|
["arguments"]: paginationArgs.map(
|
|
@@ -73276,29 +73396,29 @@ async function paginate(config2, documents) {
|
|
|
73276
73396
|
});
|
|
73277
73397
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
73278
73398
|
const queryDoc = {
|
|
73279
|
-
kind:
|
|
73399
|
+
kind: graphql10.Kind.DOCUMENT,
|
|
73280
73400
|
definitions: [
|
|
73281
73401
|
{
|
|
73282
|
-
kind:
|
|
73402
|
+
kind: graphql10.Kind.OPERATION_DEFINITION,
|
|
73283
73403
|
name: {
|
|
73284
|
-
kind:
|
|
73404
|
+
kind: graphql10.Kind.NAME,
|
|
73285
73405
|
value: refetchQueryName
|
|
73286
73406
|
},
|
|
73287
73407
|
operation: "query",
|
|
73288
73408
|
variableDefinitions: paginationArgs.map(
|
|
73289
73409
|
(arg) => ({
|
|
73290
|
-
kind:
|
|
73410
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73291
73411
|
type: {
|
|
73292
|
-
kind:
|
|
73412
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
73293
73413
|
name: {
|
|
73294
|
-
kind:
|
|
73414
|
+
kind: graphql10.Kind.NAME,
|
|
73295
73415
|
value: arg.type
|
|
73296
73416
|
}
|
|
73297
73417
|
},
|
|
73298
73418
|
variable: {
|
|
73299
|
-
kind:
|
|
73419
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73300
73420
|
name: {
|
|
73301
|
-
kind:
|
|
73421
|
+
kind: graphql10.Kind.NAME,
|
|
73302
73422
|
value: arg.name
|
|
73303
73423
|
}
|
|
73304
73424
|
},
|
|
@@ -73310,12 +73430,12 @@ async function paginate(config2, documents) {
|
|
|
73310
73430
|
).concat(
|
|
73311
73431
|
!nodeQuery ? [] : keys.map(
|
|
73312
73432
|
(key) => ({
|
|
73313
|
-
kind:
|
|
73433
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73314
73434
|
type: key.type,
|
|
73315
73435
|
variable: {
|
|
73316
|
-
kind:
|
|
73436
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73317
73437
|
name: {
|
|
73318
|
-
kind:
|
|
73438
|
+
kind: graphql10.Kind.NAME,
|
|
73319
73439
|
value: key.name
|
|
73320
73440
|
}
|
|
73321
73441
|
}
|
|
@@ -73323,42 +73443,42 @@ async function paginate(config2, documents) {
|
|
|
73323
73443
|
)
|
|
73324
73444
|
),
|
|
73325
73445
|
selectionSet: {
|
|
73326
|
-
kind:
|
|
73446
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73327
73447
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
73328
73448
|
{
|
|
73329
|
-
kind:
|
|
73449
|
+
kind: graphql10.Kind.FIELD,
|
|
73330
73450
|
name: {
|
|
73331
|
-
kind:
|
|
73451
|
+
kind: graphql10.Kind.NAME,
|
|
73332
73452
|
value: typeConfig?.resolve?.queryField || "node"
|
|
73333
73453
|
},
|
|
73334
73454
|
["arguments"]: keys.map((key) => ({
|
|
73335
|
-
kind:
|
|
73455
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73336
73456
|
name: {
|
|
73337
|
-
kind:
|
|
73457
|
+
kind: graphql10.Kind.NAME,
|
|
73338
73458
|
value: key.name
|
|
73339
73459
|
},
|
|
73340
73460
|
value: {
|
|
73341
|
-
kind:
|
|
73461
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73342
73462
|
name: {
|
|
73343
|
-
kind:
|
|
73463
|
+
kind: graphql10.Kind.NAME,
|
|
73344
73464
|
value: key.name
|
|
73345
73465
|
}
|
|
73346
73466
|
}
|
|
73347
73467
|
})),
|
|
73348
73468
|
selectionSet: {
|
|
73349
|
-
kind:
|
|
73469
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73350
73470
|
selections: [
|
|
73351
73471
|
{
|
|
73352
|
-
kind:
|
|
73472
|
+
kind: graphql10.Kind.FIELD,
|
|
73353
73473
|
name: {
|
|
73354
|
-
kind:
|
|
73474
|
+
kind: graphql10.Kind.NAME,
|
|
73355
73475
|
value: "__typename"
|
|
73356
73476
|
}
|
|
73357
73477
|
},
|
|
73358
73478
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
73359
|
-
kind:
|
|
73479
|
+
kind: graphql10.Kind.FIELD,
|
|
73360
73480
|
name: {
|
|
73361
|
-
kind:
|
|
73481
|
+
kind: graphql10.Kind.NAME,
|
|
73362
73482
|
value: key
|
|
73363
73483
|
}
|
|
73364
73484
|
})),
|
|
@@ -73420,15 +73540,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
73420
73540
|
}
|
|
73421
73541
|
function variableAsArgument(name2, variable) {
|
|
73422
73542
|
return {
|
|
73423
|
-
kind:
|
|
73543
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73424
73544
|
name: {
|
|
73425
|
-
kind:
|
|
73545
|
+
kind: graphql10.Kind.NAME,
|
|
73426
73546
|
value: name2
|
|
73427
73547
|
},
|
|
73428
73548
|
value: {
|
|
73429
|
-
kind:
|
|
73549
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73430
73550
|
name: {
|
|
73431
|
-
kind:
|
|
73551
|
+
kind: graphql10.Kind.NAME,
|
|
73432
73552
|
value: variable ?? name2
|
|
73433
73553
|
}
|
|
73434
73554
|
}
|
|
@@ -73436,18 +73556,18 @@ function variableAsArgument(name2, variable) {
|
|
|
73436
73556
|
}
|
|
73437
73557
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
73438
73558
|
return {
|
|
73439
|
-
kind:
|
|
73559
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73440
73560
|
type: {
|
|
73441
|
-
kind:
|
|
73561
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
73442
73562
|
name: {
|
|
73443
|
-
kind:
|
|
73563
|
+
kind: graphql10.Kind.NAME,
|
|
73444
73564
|
value: type
|
|
73445
73565
|
}
|
|
73446
73566
|
},
|
|
73447
73567
|
variable: {
|
|
73448
|
-
kind:
|
|
73568
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73449
73569
|
name: {
|
|
73450
|
-
kind:
|
|
73570
|
+
kind: graphql10.Kind.NAME,
|
|
73451
73571
|
value: variableName ?? name2
|
|
73452
73572
|
}
|
|
73453
73573
|
},
|
|
@@ -73459,9 +73579,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
73459
73579
|
}
|
|
73460
73580
|
function argumentNode(name2, value) {
|
|
73461
73581
|
return {
|
|
73462
|
-
kind:
|
|
73582
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73463
73583
|
name: {
|
|
73464
|
-
kind:
|
|
73584
|
+
kind: graphql10.Kind.NAME,
|
|
73465
73585
|
value: name2
|
|
73466
73586
|
},
|
|
73467
73587
|
value: objectNode(value)
|
|
@@ -73469,16 +73589,16 @@ function argumentNode(name2, value) {
|
|
|
73469
73589
|
}
|
|
73470
73590
|
function objectNode([type, defaultValue]) {
|
|
73471
73591
|
const node = {
|
|
73472
|
-
kind:
|
|
73592
|
+
kind: graphql10.Kind.OBJECT,
|
|
73473
73593
|
fields: [
|
|
73474
73594
|
{
|
|
73475
|
-
kind:
|
|
73595
|
+
kind: graphql10.Kind.OBJECT_FIELD,
|
|
73476
73596
|
name: {
|
|
73477
|
-
kind:
|
|
73597
|
+
kind: graphql10.Kind.NAME,
|
|
73478
73598
|
value: "type"
|
|
73479
73599
|
},
|
|
73480
73600
|
value: {
|
|
73481
|
-
kind:
|
|
73601
|
+
kind: graphql10.Kind.STRING,
|
|
73482
73602
|
value: type
|
|
73483
73603
|
}
|
|
73484
73604
|
}
|
|
@@ -73486,8 +73606,8 @@ function objectNode([type, defaultValue]) {
|
|
|
73486
73606
|
};
|
|
73487
73607
|
if (defaultValue) {
|
|
73488
73608
|
node.fields.push({
|
|
73489
|
-
kind:
|
|
73490
|
-
name: { kind:
|
|
73609
|
+
kind: graphql10.Kind.OBJECT_FIELD,
|
|
73610
|
+
name: { kind: graphql10.Kind.NAME, value: "default" },
|
|
73491
73611
|
value: {
|
|
73492
73612
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
73493
73613
|
value: defaultValue.toString()
|
|
@@ -73498,34 +73618,34 @@ function objectNode([type, defaultValue]) {
|
|
|
73498
73618
|
}
|
|
73499
73619
|
var pageInfoSelection = [
|
|
73500
73620
|
{
|
|
73501
|
-
kind:
|
|
73621
|
+
kind: graphql10.Kind.FIELD,
|
|
73502
73622
|
name: {
|
|
73503
|
-
kind:
|
|
73623
|
+
kind: graphql10.Kind.NAME,
|
|
73504
73624
|
value: "edges"
|
|
73505
73625
|
},
|
|
73506
73626
|
selectionSet: {
|
|
73507
|
-
kind:
|
|
73627
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73508
73628
|
selections: [
|
|
73509
73629
|
{
|
|
73510
|
-
kind:
|
|
73630
|
+
kind: graphql10.Kind.FIELD,
|
|
73511
73631
|
name: {
|
|
73512
|
-
kind:
|
|
73632
|
+
kind: graphql10.Kind.NAME,
|
|
73513
73633
|
value: "cursor"
|
|
73514
73634
|
}
|
|
73515
73635
|
},
|
|
73516
73636
|
{
|
|
73517
|
-
kind:
|
|
73637
|
+
kind: graphql10.Kind.FIELD,
|
|
73518
73638
|
name: {
|
|
73519
|
-
kind:
|
|
73639
|
+
kind: graphql10.Kind.NAME,
|
|
73520
73640
|
value: "node"
|
|
73521
73641
|
},
|
|
73522
73642
|
selectionSet: {
|
|
73523
|
-
kind:
|
|
73643
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73524
73644
|
selections: [
|
|
73525
73645
|
{
|
|
73526
|
-
kind:
|
|
73646
|
+
kind: graphql10.Kind.FIELD,
|
|
73527
73647
|
name: {
|
|
73528
|
-
kind:
|
|
73648
|
+
kind: graphql10.Kind.NAME,
|
|
73529
73649
|
value: "__typename"
|
|
73530
73650
|
}
|
|
73531
73651
|
}
|
|
@@ -73536,39 +73656,39 @@ var pageInfoSelection = [
|
|
|
73536
73656
|
}
|
|
73537
73657
|
},
|
|
73538
73658
|
{
|
|
73539
|
-
kind:
|
|
73659
|
+
kind: graphql10.Kind.FIELD,
|
|
73540
73660
|
name: {
|
|
73541
|
-
kind:
|
|
73661
|
+
kind: graphql10.Kind.NAME,
|
|
73542
73662
|
value: "pageInfo"
|
|
73543
73663
|
},
|
|
73544
73664
|
selectionSet: {
|
|
73545
|
-
kind:
|
|
73665
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73546
73666
|
selections: [
|
|
73547
73667
|
{
|
|
73548
|
-
kind:
|
|
73668
|
+
kind: graphql10.Kind.FIELD,
|
|
73549
73669
|
name: {
|
|
73550
|
-
kind:
|
|
73670
|
+
kind: graphql10.Kind.NAME,
|
|
73551
73671
|
value: "hasPreviousPage"
|
|
73552
73672
|
}
|
|
73553
73673
|
},
|
|
73554
73674
|
{
|
|
73555
|
-
kind:
|
|
73675
|
+
kind: graphql10.Kind.FIELD,
|
|
73556
73676
|
name: {
|
|
73557
|
-
kind:
|
|
73677
|
+
kind: graphql10.Kind.NAME,
|
|
73558
73678
|
value: "hasNextPage"
|
|
73559
73679
|
}
|
|
73560
73680
|
},
|
|
73561
73681
|
{
|
|
73562
|
-
kind:
|
|
73682
|
+
kind: graphql10.Kind.FIELD,
|
|
73563
73683
|
name: {
|
|
73564
|
-
kind:
|
|
73684
|
+
kind: graphql10.Kind.NAME,
|
|
73565
73685
|
value: "startCursor"
|
|
73566
73686
|
}
|
|
73567
73687
|
},
|
|
73568
73688
|
{
|
|
73569
|
-
kind:
|
|
73689
|
+
kind: graphql10.Kind.FIELD,
|
|
73570
73690
|
name: {
|
|
73571
|
-
kind:
|
|
73691
|
+
kind: graphql10.Kind.NAME,
|
|
73572
73692
|
value: "endCursor"
|
|
73573
73693
|
}
|
|
73574
73694
|
}
|
|
@@ -73582,15 +73702,15 @@ async function addListFragments(config2, documents) {
|
|
|
73582
73702
|
const lists = {};
|
|
73583
73703
|
const errors = [];
|
|
73584
73704
|
for (const doc of documents) {
|
|
73585
|
-
doc.document =
|
|
73705
|
+
doc.document = graphql11.visit(doc.document, {
|
|
73586
73706
|
Directive(node, key, parent, path2, ancestors) {
|
|
73587
73707
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
73588
73708
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
73589
73709
|
let error = {
|
|
73590
|
-
...new
|
|
73710
|
+
...new graphql11.GraphQLError(
|
|
73591
73711
|
"",
|
|
73592
73712
|
node,
|
|
73593
|
-
new
|
|
73713
|
+
new graphql11.Source(""),
|
|
73594
73714
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
73595
73715
|
path2
|
|
73596
73716
|
),
|
|
@@ -73642,7 +73762,7 @@ async function addListFragments(config2, documents) {
|
|
|
73642
73762
|
{
|
|
73643
73763
|
kind: "Argument",
|
|
73644
73764
|
name: {
|
|
73645
|
-
kind:
|
|
73765
|
+
kind: graphql11.Kind.NAME,
|
|
73646
73766
|
value: "connection"
|
|
73647
73767
|
},
|
|
73648
73768
|
value: {
|
|
@@ -73689,10 +73809,13 @@ async function addListFragments(config2, documents) {
|
|
|
73689
73809
|
if (errors.length > 0) {
|
|
73690
73810
|
throw errors;
|
|
73691
73811
|
}
|
|
73692
|
-
const
|
|
73812
|
+
const validDeletes = [
|
|
73693
73813
|
...new Set(
|
|
73694
73814
|
Object.values(lists).map(({ type }) => {
|
|
73695
|
-
if (!(type instanceof
|
|
73815
|
+
if (!(type instanceof graphql11.GraphQLObjectType)) {
|
|
73816
|
+
return "";
|
|
73817
|
+
}
|
|
73818
|
+
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
73696
73819
|
return "";
|
|
73697
73820
|
}
|
|
73698
73821
|
return type.name;
|
|
@@ -73703,7 +73826,7 @@ async function addListFragments(config2, documents) {
|
|
|
73703
73826
|
return;
|
|
73704
73827
|
}
|
|
73705
73828
|
const generatedDoc = {
|
|
73706
|
-
kind:
|
|
73829
|
+
kind: graphql11.Kind.DOCUMENT,
|
|
73707
73830
|
definitions: Object.entries(lists).flatMap(
|
|
73708
73831
|
([name2, { selection: selection2, type }]) => {
|
|
73709
73832
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -73711,35 +73834,29 @@ async function addListFragments(config2, documents) {
|
|
|
73711
73834
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
73712
73835
|
}
|
|
73713
73836
|
const fragmentSelection = {
|
|
73714
|
-
kind:
|
|
73837
|
+
kind: graphql11.Kind.SELECTION_SET,
|
|
73715
73838
|
selections: [...selection2.selections]
|
|
73716
73839
|
};
|
|
73717
73840
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
73718
|
-
(field) => field.kind === "Field" && field.name.value
|
|
73841
|
+
(field) => field.kind === "Field" && config2.keyFieldsForType(type.name).includes(field.name.value)
|
|
73719
73842
|
)) {
|
|
73720
73843
|
fragmentSelection.selections = [
|
|
73721
73844
|
...fragmentSelection.selections,
|
|
73722
|
-
|
|
73723
|
-
kind: graphql10.Kind.FIELD,
|
|
73724
|
-
name: {
|
|
73725
|
-
kind: graphql10.Kind.NAME,
|
|
73726
|
-
value: "id"
|
|
73727
|
-
}
|
|
73728
|
-
}
|
|
73845
|
+
...objectIdentificationSelection(config2, type)
|
|
73729
73846
|
];
|
|
73730
73847
|
}
|
|
73731
73848
|
return [
|
|
73732
73849
|
{
|
|
73733
73850
|
name: {
|
|
73734
73851
|
value: config2.listInsertFragment(name2),
|
|
73735
|
-
kind:
|
|
73852
|
+
kind: graphql11.Kind.NAME
|
|
73736
73853
|
},
|
|
73737
|
-
kind:
|
|
73854
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73738
73855
|
selectionSet: fragmentSelection,
|
|
73739
73856
|
typeCondition: {
|
|
73740
|
-
kind:
|
|
73857
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73741
73858
|
name: {
|
|
73742
|
-
kind:
|
|
73859
|
+
kind: graphql11.Kind.NAME,
|
|
73743
73860
|
value: type.name
|
|
73744
73861
|
}
|
|
73745
73862
|
}
|
|
@@ -73747,52 +73864,32 @@ async function addListFragments(config2, documents) {
|
|
|
73747
73864
|
{
|
|
73748
73865
|
name: {
|
|
73749
73866
|
value: config2.listToggleFragment(name2),
|
|
73750
|
-
kind:
|
|
73751
|
-
},
|
|
73752
|
-
kind: graphql10.Kind.FRAGMENT_DEFINITION,
|
|
73753
|
-
selectionSet: {
|
|
73754
|
-
...fragmentSelection,
|
|
73755
|
-
selections: [
|
|
73756
|
-
...fragmentSelection.selections,
|
|
73757
|
-
{
|
|
73758
|
-
kind: graphql10.Kind.FIELD,
|
|
73759
|
-
name: {
|
|
73760
|
-
kind: graphql10.Kind.NAME,
|
|
73761
|
-
value: "id"
|
|
73762
|
-
}
|
|
73763
|
-
}
|
|
73764
|
-
]
|
|
73867
|
+
kind: graphql11.Kind.NAME
|
|
73765
73868
|
},
|
|
73869
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73870
|
+
selectionSet: fragmentSelection,
|
|
73766
73871
|
typeCondition: {
|
|
73767
|
-
kind:
|
|
73872
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73768
73873
|
name: {
|
|
73769
|
-
kind:
|
|
73874
|
+
kind: graphql11.Kind.NAME,
|
|
73770
73875
|
value: type.name
|
|
73771
73876
|
}
|
|
73772
73877
|
}
|
|
73773
73878
|
},
|
|
73774
73879
|
{
|
|
73775
|
-
kind:
|
|
73880
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73776
73881
|
name: {
|
|
73777
73882
|
value: config2.listRemoveFragment(name2),
|
|
73778
|
-
kind:
|
|
73883
|
+
kind: graphql11.Kind.NAME
|
|
73779
73884
|
},
|
|
73780
73885
|
selectionSet: {
|
|
73781
|
-
kind:
|
|
73782
|
-
selections: [
|
|
73783
|
-
{
|
|
73784
|
-
kind: graphql10.Kind.FIELD,
|
|
73785
|
-
name: {
|
|
73786
|
-
kind: graphql10.Kind.NAME,
|
|
73787
|
-
value: "id"
|
|
73788
|
-
}
|
|
73789
|
-
}
|
|
73790
|
-
]
|
|
73886
|
+
kind: graphql11.Kind.SELECTION_SET,
|
|
73887
|
+
selections: [...objectIdentificationSelection(config2, type)]
|
|
73791
73888
|
},
|
|
73792
73889
|
typeCondition: {
|
|
73793
|
-
kind:
|
|
73890
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73794
73891
|
name: {
|
|
73795
|
-
kind:
|
|
73892
|
+
kind: graphql11.Kind.NAME,
|
|
73796
73893
|
value: type.name
|
|
73797
73894
|
}
|
|
73798
73895
|
}
|
|
@@ -73800,15 +73897,15 @@ async function addListFragments(config2, documents) {
|
|
|
73800
73897
|
];
|
|
73801
73898
|
}
|
|
73802
73899
|
).concat(
|
|
73803
|
-
...
|
|
73804
|
-
kind:
|
|
73900
|
+
...validDeletes.map((typeName) => ({
|
|
73901
|
+
kind: graphql11.Kind.DIRECTIVE_DEFINITION,
|
|
73805
73902
|
name: {
|
|
73806
|
-
kind:
|
|
73903
|
+
kind: graphql11.Kind.NAME,
|
|
73807
73904
|
value: config2.listDeleteDirective(typeName)
|
|
73808
73905
|
},
|
|
73809
73906
|
locations: [
|
|
73810
73907
|
{
|
|
73811
|
-
kind:
|
|
73908
|
+
kind: graphql11.Kind.NAME,
|
|
73812
73909
|
value: "FIELD"
|
|
73813
73910
|
}
|
|
73814
73911
|
],
|
|
@@ -73816,8 +73913,8 @@ async function addListFragments(config2, documents) {
|
|
|
73816
73913
|
}))
|
|
73817
73914
|
)
|
|
73818
73915
|
};
|
|
73819
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
73820
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
73916
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql11.print).join("\n\n");
|
|
73917
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql11.print).join("\n\n");
|
|
73821
73918
|
documents.push({
|
|
73822
73919
|
name: "generated::lists",
|
|
73823
73920
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -73902,11 +73999,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
73902
73999
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
73903
74000
|
|
|
73904
74001
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
73905
|
-
var
|
|
74002
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
73906
74003
|
function fieldKey(config2, field) {
|
|
73907
74004
|
const attributeName = field.alias?.value || field.name.value;
|
|
73908
|
-
const printed =
|
|
73909
|
-
const secondParse =
|
|
74005
|
+
const printed = graphql12.print(field);
|
|
74006
|
+
const secondParse = graphql12.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
73910
74007
|
const paginated = !!field.directives?.find(
|
|
73911
74008
|
(directive) => directive.name.value === config2.paginateDirective
|
|
73912
74009
|
);
|
|
@@ -73925,7 +74022,9 @@ function fieldKey(config2, field) {
|
|
|
73925
74022
|
[arg.name.value]: printed.substring(start - 1, end - 1)
|
|
73926
74023
|
};
|
|
73927
74024
|
}, {});
|
|
73928
|
-
|
|
74025
|
+
const args = Object.keys(argObj);
|
|
74026
|
+
args.sort();
|
|
74027
|
+
let key = Object.values(argObj).length > 0 ? `${attributeName}(${args.map((key2) => `${key2}: ${argObj[key2]}`).join(", ")})` : attributeName;
|
|
73929
74028
|
if (paginated) {
|
|
73930
74029
|
key = key + "::paginated";
|
|
73931
74030
|
}
|
|
@@ -73999,8 +74098,8 @@ function selection({
|
|
|
73999
74098
|
const typeConditionName = field.typeCondition.name.value;
|
|
74000
74099
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
74001
74100
|
const possibleTypes = [];
|
|
74002
|
-
if (!
|
|
74003
|
-
} else if (
|
|
74101
|
+
if (!graphql13.isAbstractType(typeCondition)) {
|
|
74102
|
+
} else if (graphql13.isAbstractType(parentType)) {
|
|
74004
74103
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
74005
74104
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
74006
74105
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -74048,7 +74147,7 @@ function selection({
|
|
|
74048
74147
|
} else {
|
|
74049
74148
|
let typeRef = type.getFields()[field.name.value].type;
|
|
74050
74149
|
fieldType = getRootType(typeRef);
|
|
74051
|
-
nullable = !
|
|
74150
|
+
nullable = !graphql13.isNonNullType(typeRef);
|
|
74052
74151
|
}
|
|
74053
74152
|
const typeName = fieldType.toString();
|
|
74054
74153
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -74108,12 +74207,12 @@ function selection({
|
|
|
74108
74207
|
fieldObj.filters = (field.arguments || []).reduce(
|
|
74109
74208
|
(filters, arg) => ({
|
|
74110
74209
|
...filters,
|
|
74111
|
-
[arg.name.value]: convertValue(arg.value)
|
|
74210
|
+
[arg.name.value]: convertValue(config2, arg.value)
|
|
74112
74211
|
}),
|
|
74113
74212
|
{}
|
|
74114
74213
|
);
|
|
74115
74214
|
}
|
|
74116
|
-
if (
|
|
74215
|
+
if (graphql13.isInterfaceType(fieldType) || graphql13.isUnionType(fieldType)) {
|
|
74117
74216
|
fieldObj.abstract = true;
|
|
74118
74217
|
}
|
|
74119
74218
|
object.fields = {
|
|
@@ -74170,7 +74269,7 @@ function artifactGenerator(stats) {
|
|
|
74170
74269
|
return async function(config2, docs) {
|
|
74171
74270
|
const filterTypes = {};
|
|
74172
74271
|
for (const doc of docs) {
|
|
74173
|
-
|
|
74272
|
+
graphql14.visit(doc.document, {
|
|
74174
74273
|
Directive(node, _, __, ___, ancestors) {
|
|
74175
74274
|
if (node.name.value !== config2.listDirective) {
|
|
74176
74275
|
return;
|
|
@@ -74229,7 +74328,7 @@ function artifactGenerator(stats) {
|
|
|
74229
74328
|
return;
|
|
74230
74329
|
}
|
|
74231
74330
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
74232
|
-
let documentWithoutInternalDirectives =
|
|
74331
|
+
let documentWithoutInternalDirectives = graphql14.visit(document, {
|
|
74233
74332
|
Directive(node) {
|
|
74234
74333
|
if (config2.isInternalDirective(node)) {
|
|
74235
74334
|
return null;
|
|
@@ -74242,7 +74341,7 @@ function artifactGenerator(stats) {
|
|
|
74242
74341
|
}
|
|
74243
74342
|
}
|
|
74244
74343
|
});
|
|
74245
|
-
let documentWithoutExtraVariables =
|
|
74344
|
+
let documentWithoutExtraVariables = graphql14.visit(
|
|
74246
74345
|
documentWithoutInternalDirectives,
|
|
74247
74346
|
{
|
|
74248
74347
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -74253,13 +74352,13 @@ function artifactGenerator(stats) {
|
|
|
74253
74352
|
}
|
|
74254
74353
|
}
|
|
74255
74354
|
);
|
|
74256
|
-
let rawString =
|
|
74355
|
+
let rawString = graphql14.print(documentWithoutExtraVariables);
|
|
74257
74356
|
let docKind = doc.kind;
|
|
74258
74357
|
const operations = document.definitions.filter(
|
|
74259
|
-
({ kind }) => kind ===
|
|
74358
|
+
({ kind }) => kind === graphql14.Kind.OPERATION_DEFINITION
|
|
74260
74359
|
);
|
|
74261
74360
|
const fragments = document.definitions.filter(
|
|
74262
|
-
({ kind }) => kind ===
|
|
74361
|
+
({ kind }) => kind === graphql14.Kind.FRAGMENT_DEFINITION
|
|
74263
74362
|
);
|
|
74264
74363
|
let rootType = "";
|
|
74265
74364
|
let selectionSet;
|
|
@@ -74395,7 +74494,9 @@ function artifactGenerator(stats) {
|
|
|
74395
74494
|
}
|
|
74396
74495
|
|
|
74397
74496
|
// src/codegen/generators/runtime/index.ts
|
|
74398
|
-
|
|
74497
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
74498
|
+
var AST6 = recast6.types.builders;
|
|
74499
|
+
async function runtimeGenerator(config2, docs) {
|
|
74399
74500
|
await Promise.all([
|
|
74400
74501
|
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
74401
74502
|
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
@@ -74409,6 +74510,59 @@ async function runtimeGenerator(config2) {
|
|
|
74409
74510
|
}),
|
|
74410
74511
|
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
74411
74512
|
]);
|
|
74513
|
+
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
74514
|
+
const contents = await parseJS(await fs_exports.readFile(indexPath) || "");
|
|
74515
|
+
const graphql_tag_return = config2.plugins.find(
|
|
74516
|
+
(plugin) => plugin.graphql_tag_return
|
|
74517
|
+
)?.graphql_tag_return;
|
|
74518
|
+
if (graphql_tag_return && contents) {
|
|
74519
|
+
const overloaded_returns = {};
|
|
74520
|
+
for (const doc of docs) {
|
|
74521
|
+
const return_value = graphql_tag_return({
|
|
74522
|
+
config: config2,
|
|
74523
|
+
doc,
|
|
74524
|
+
ensure_import({ identifier, module: module2 }) {
|
|
74525
|
+
ensureImports({
|
|
74526
|
+
config: config2,
|
|
74527
|
+
body: contents.script.body,
|
|
74528
|
+
sourceModule: module2,
|
|
74529
|
+
import: [identifier]
|
|
74530
|
+
});
|
|
74531
|
+
}
|
|
74532
|
+
});
|
|
74533
|
+
if (return_value) {
|
|
74534
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
74535
|
+
}
|
|
74536
|
+
}
|
|
74537
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
74538
|
+
for (const [i2, expression] of (contents?.script.body ?? []).entries()) {
|
|
74539
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
74540
|
+
continue;
|
|
74541
|
+
}
|
|
74542
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
74543
|
+
const input = AST6.identifier("str");
|
|
74544
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
74545
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
74546
|
+
);
|
|
74547
|
+
contents?.script.body.splice(
|
|
74548
|
+
i2,
|
|
74549
|
+
0,
|
|
74550
|
+
AST6.exportNamedDeclaration(
|
|
74551
|
+
AST6.tsDeclareFunction(
|
|
74552
|
+
AST6.identifier("graphql"),
|
|
74553
|
+
[input],
|
|
74554
|
+
AST6.tsTypeAnnotation(
|
|
74555
|
+
AST6.tsTypeReference(AST6.identifier(returnValue))
|
|
74556
|
+
)
|
|
74557
|
+
)
|
|
74558
|
+
)
|
|
74559
|
+
);
|
|
74560
|
+
}
|
|
74561
|
+
break;
|
|
74562
|
+
}
|
|
74563
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
74564
|
+
}
|
|
74565
|
+
}
|
|
74412
74566
|
}
|
|
74413
74567
|
async function generatePluginRuntime(config2, plugin) {
|
|
74414
74568
|
if (houdini_mode.is_testing) {
|
|
@@ -74443,20 +74597,20 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
74443
74597
|
}
|
|
74444
74598
|
|
|
74445
74599
|
// src/codegen/generators/typescript/index.ts
|
|
74446
|
-
var
|
|
74600
|
+
var recast12 = __toESM(require_main2(), 1);
|
|
74447
74601
|
|
|
74448
74602
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
74603
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
74604
|
+
var recast9 = __toESM(require_main2(), 1);
|
|
74605
|
+
|
|
74606
|
+
// src/codegen/generators/typescript/typeReference.ts
|
|
74449
74607
|
var graphql16 = __toESM(require_graphql2(), 1);
|
|
74450
74608
|
var recast8 = __toESM(require_main2(), 1);
|
|
74451
74609
|
|
|
74452
|
-
// src/codegen/generators/typescript/
|
|
74610
|
+
// src/codegen/generators/typescript/types.ts
|
|
74453
74611
|
var graphql15 = __toESM(require_graphql2(), 1);
|
|
74454
74612
|
var recast7 = __toESM(require_main2(), 1);
|
|
74455
|
-
|
|
74456
|
-
// src/codegen/generators/typescript/types.ts
|
|
74457
|
-
var graphql14 = __toESM(require_graphql2(), 1);
|
|
74458
|
-
var recast6 = __toESM(require_main2(), 1);
|
|
74459
|
-
var AST6 = recast6.types.builders;
|
|
74613
|
+
var AST7 = recast7.types.builders;
|
|
74460
74614
|
function readonlyProperty(prop, enable = true) {
|
|
74461
74615
|
if (enable) {
|
|
74462
74616
|
prop.readonly = true;
|
|
@@ -74464,31 +74618,31 @@ function readonlyProperty(prop, enable = true) {
|
|
|
74464
74618
|
return prop;
|
|
74465
74619
|
}
|
|
74466
74620
|
function nullableField(inner, input = false) {
|
|
74467
|
-
const members = [inner,
|
|
74621
|
+
const members = [inner, AST7.tsNullKeyword()];
|
|
74468
74622
|
if (input) {
|
|
74469
|
-
members.push(
|
|
74623
|
+
members.push(AST7.tsUndefinedKeyword());
|
|
74470
74624
|
}
|
|
74471
|
-
return
|
|
74625
|
+
return AST7.tsUnionType(members);
|
|
74472
74626
|
}
|
|
74473
74627
|
function scalarPropertyValue(config2, missingScalars, target) {
|
|
74474
74628
|
switch (target.name) {
|
|
74475
74629
|
case "String": {
|
|
74476
|
-
return
|
|
74630
|
+
return AST7.tsStringKeyword();
|
|
74477
74631
|
}
|
|
74478
74632
|
case "Int": {
|
|
74479
|
-
return
|
|
74633
|
+
return AST7.tsNumberKeyword();
|
|
74480
74634
|
}
|
|
74481
74635
|
case "Float": {
|
|
74482
|
-
return
|
|
74636
|
+
return AST7.tsNumberKeyword();
|
|
74483
74637
|
}
|
|
74484
74638
|
case "Boolean": {
|
|
74485
|
-
return
|
|
74639
|
+
return AST7.tsBooleanKeyword();
|
|
74486
74640
|
}
|
|
74487
74641
|
case "ID": {
|
|
74488
|
-
return
|
|
74642
|
+
return AST7.tsStringKeyword();
|
|
74489
74643
|
}
|
|
74490
74644
|
default: {
|
|
74491
|
-
if (
|
|
74645
|
+
if (graphql15.isNonNullType(target) && "ofType" in target) {
|
|
74492
74646
|
return scalarPropertyValue(
|
|
74493
74647
|
config2,
|
|
74494
74648
|
missingScalars,
|
|
@@ -74496,23 +74650,23 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
74496
74650
|
);
|
|
74497
74651
|
}
|
|
74498
74652
|
if (config2.scalars?.[target.name]) {
|
|
74499
|
-
return
|
|
74653
|
+
return AST7.tsTypeReference(AST7.identifier(config2.scalars?.[target.name].type));
|
|
74500
74654
|
}
|
|
74501
74655
|
missingScalars.add(target.name);
|
|
74502
|
-
return
|
|
74656
|
+
return AST7.tsAnyKeyword();
|
|
74503
74657
|
}
|
|
74504
74658
|
}
|
|
74505
74659
|
}
|
|
74506
74660
|
|
|
74507
74661
|
// src/codegen/generators/typescript/typeReference.ts
|
|
74508
|
-
var
|
|
74662
|
+
var AST8 = recast8.types.builders;
|
|
74509
74663
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
74510
74664
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
74511
74665
|
let result;
|
|
74512
|
-
if (
|
|
74666
|
+
if (graphql16.isScalarType(type)) {
|
|
74513
74667
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
74514
74668
|
} else {
|
|
74515
|
-
result =
|
|
74669
|
+
result = AST8.tsTypeReference(AST8.identifier(type.name));
|
|
74516
74670
|
}
|
|
74517
74671
|
for (const toWrap of wrappers) {
|
|
74518
74672
|
if (toWrap === "NonNull" /* NonNull */) {
|
|
@@ -74520,27 +74674,27 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
74520
74674
|
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
74521
74675
|
result = nullableField(result, true);
|
|
74522
74676
|
} else if (toWrap === "List" /* List */) {
|
|
74523
|
-
result =
|
|
74677
|
+
result = AST8.tsArrayType(AST8.tsParenthesizedType(result));
|
|
74524
74678
|
}
|
|
74525
74679
|
}
|
|
74526
74680
|
return result;
|
|
74527
74681
|
}
|
|
74528
74682
|
|
|
74529
74683
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
74530
|
-
var
|
|
74684
|
+
var AST9 = recast9.types.builders;
|
|
74531
74685
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
74532
74686
|
const { type } = unwrapType(config2, rootType);
|
|
74533
|
-
if (
|
|
74687
|
+
if (graphql17.isScalarType(type)) {
|
|
74534
74688
|
return;
|
|
74535
74689
|
}
|
|
74536
74690
|
if (visitedTypes.has(type.name)) {
|
|
74537
74691
|
return;
|
|
74538
74692
|
}
|
|
74539
|
-
if (
|
|
74693
|
+
if (graphql17.isUnionType(type)) {
|
|
74540
74694
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
74541
74695
|
}
|
|
74542
74696
|
visitedTypes.add(type.name);
|
|
74543
|
-
if (
|
|
74697
|
+
if (graphql17.isEnumType(type)) {
|
|
74544
74698
|
ensureImports({
|
|
74545
74699
|
config: config2,
|
|
74546
74700
|
body,
|
|
@@ -74554,20 +74708,267 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
74554
74708
|
for (const field of Object.values(type.getFields())) {
|
|
74555
74709
|
addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, field.type);
|
|
74556
74710
|
members.push(
|
|
74557
|
-
|
|
74558
|
-
|
|
74559
|
-
|
|
74560
|
-
|
|
74711
|
+
AST9.tsPropertySignature(
|
|
74712
|
+
AST9.identifier(field.name),
|
|
74713
|
+
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
74714
|
+
graphql17.isNullableType(field.type)
|
|
74561
74715
|
)
|
|
74562
74716
|
);
|
|
74563
74717
|
}
|
|
74564
|
-
body.push(
|
|
74718
|
+
body.push(AST9.tsTypeAliasDeclaration(AST9.identifier(type.name), AST9.tsTypeLiteral(members)));
|
|
74719
|
+
}
|
|
74720
|
+
|
|
74721
|
+
// src/codegen/generators/typescript/imperativeCache.ts
|
|
74722
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
74723
|
+
var recast10 = __toESM(require_main2(), 1);
|
|
74724
|
+
var AST10 = recast10.types.builders;
|
|
74725
|
+
async function imperativeCacheTypef(config2, docs) {
|
|
74726
|
+
const target = path_exports.join(config2.runtimeDirectory, "generated.d.ts");
|
|
74727
|
+
const body = [];
|
|
74728
|
+
const declaration = AST10.tsTypeAliasDeclaration(
|
|
74729
|
+
AST10.identifier(CacheTypeDefName),
|
|
74730
|
+
AST10.tsTypeLiteral([
|
|
74731
|
+
AST10.tsPropertySignature(
|
|
74732
|
+
AST10.identifier("types"),
|
|
74733
|
+
AST10.tsTypeAnnotation(typeDefinitions(config2, body))
|
|
74734
|
+
),
|
|
74735
|
+
AST10.tsPropertySignature(
|
|
74736
|
+
AST10.identifier("lists"),
|
|
74737
|
+
AST10.tsTypeAnnotation(listDefinitions(config2, docs))
|
|
74738
|
+
)
|
|
74739
|
+
])
|
|
74740
|
+
);
|
|
74741
|
+
declaration.declare = true;
|
|
74742
|
+
const importRecord = AST10.importDeclaration(
|
|
74743
|
+
[AST10.importSpecifier(AST10.identifier("Record"))],
|
|
74744
|
+
AST10.stringLiteral("./public/record")
|
|
74745
|
+
);
|
|
74746
|
+
importRecord.importKind = "type";
|
|
74747
|
+
await fs_exports.writeFile(
|
|
74748
|
+
target,
|
|
74749
|
+
recast10.prettyPrint(
|
|
74750
|
+
AST10.program([importRecord, ...body, AST10.exportNamedDeclaration(declaration)])
|
|
74751
|
+
).code
|
|
74752
|
+
);
|
|
74753
|
+
}
|
|
74754
|
+
function typeDefinitions(config2, body) {
|
|
74755
|
+
const operationTypes = [config2.schema.getMutationType(), config2.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
74756
|
+
const visitedTypes = /* @__PURE__ */ new Set();
|
|
74757
|
+
const types16 = Object.values(config2.schema.getTypeMap()).filter(
|
|
74758
|
+
(type) => !graphql18.isAbstractType(type) && !graphql18.isScalarType(type) && !graphql18.isEnumType(type) && !graphql18.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
74759
|
+
);
|
|
74760
|
+
return AST10.tsTypeLiteral(
|
|
74761
|
+
types16.map((type) => {
|
|
74762
|
+
let typeName = type.name;
|
|
74763
|
+
if (config2.schema.getQueryType() && config2.schema.getQueryType()?.name === type.name) {
|
|
74764
|
+
typeName = "__ROOT__";
|
|
74765
|
+
}
|
|
74766
|
+
let idFields = AST10.tsNeverKeyword();
|
|
74767
|
+
const keys = keyFieldsForType(config2.configFile, type.name);
|
|
74768
|
+
if (graphql18.isObjectType(type) && keys.length > 0 && keys.every((key) => type.getFields()[key])) {
|
|
74769
|
+
idFields = AST10.tsTypeLiteral(
|
|
74770
|
+
keys.map((key) => {
|
|
74771
|
+
const fieldType = type.getFields()[key];
|
|
74772
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
74773
|
+
return AST10.tsPropertySignature(
|
|
74774
|
+
AST10.identifier(key),
|
|
74775
|
+
AST10.tsTypeAnnotation(
|
|
74776
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
74777
|
+
)
|
|
74778
|
+
);
|
|
74779
|
+
})
|
|
74780
|
+
);
|
|
74781
|
+
} else if (typeName === "__ROOT__") {
|
|
74782
|
+
idFields = AST10.tsTypeLiteral([]);
|
|
74783
|
+
}
|
|
74784
|
+
let fields = AST10.tsTypeLiteral([]);
|
|
74785
|
+
if (graphql18.isObjectType(type)) {
|
|
74786
|
+
fields = AST10.tsTypeLiteral(
|
|
74787
|
+
Object.entries(type.getFields()).map(
|
|
74788
|
+
([key, fieldType]) => {
|
|
74789
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
74790
|
+
let typeOptions = AST10.tsUnionType([]);
|
|
74791
|
+
if (graphql18.isScalarType(unwrapped.type)) {
|
|
74792
|
+
typeOptions.types.push(
|
|
74793
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
74794
|
+
);
|
|
74795
|
+
} else if (graphql18.isEnumType(unwrapped.type)) {
|
|
74796
|
+
typeOptions.types.push(
|
|
74797
|
+
AST10.tsTypeReference(AST10.identifier(unwrapped.type.name))
|
|
74798
|
+
);
|
|
74799
|
+
} else if (!graphql18.isAbstractType(unwrapped.type)) {
|
|
74800
|
+
typeOptions.types.push(record(unwrapped.type.name));
|
|
74801
|
+
} else {
|
|
74802
|
+
typeOptions.types.push(
|
|
74803
|
+
...config2.schema.getPossibleTypes(unwrapped.type).map((type2) => record(type2.name))
|
|
74804
|
+
);
|
|
74805
|
+
}
|
|
74806
|
+
for (const wrapper of unwrapped.wrappers) {
|
|
74807
|
+
if (wrapper === "Nullable" /* Nullable */) {
|
|
74808
|
+
typeOptions = AST10.tsParenthesizedType(
|
|
74809
|
+
AST10.tsUnionType([typeOptions, AST10.tsNullKeyword()])
|
|
74810
|
+
);
|
|
74811
|
+
} else if (wrapper === "List" /* List */) {
|
|
74812
|
+
typeOptions = AST10.tsArrayType(
|
|
74813
|
+
AST10.tsParenthesizedType(typeOptions)
|
|
74814
|
+
);
|
|
74815
|
+
}
|
|
74816
|
+
}
|
|
74817
|
+
if (typeOptions.type === "TSParenthesizedType") {
|
|
74818
|
+
typeOptions = typeOptions.typeAnnotation;
|
|
74819
|
+
}
|
|
74820
|
+
let args = AST10.tsNeverKeyword();
|
|
74821
|
+
if (fieldType.args?.length > 0) {
|
|
74822
|
+
args = AST10.tsTypeLiteral(
|
|
74823
|
+
fieldType.args.map((arg) => {
|
|
74824
|
+
addReferencedInputTypes(
|
|
74825
|
+
config2,
|
|
74826
|
+
"",
|
|
74827
|
+
body,
|
|
74828
|
+
visitedTypes,
|
|
74829
|
+
/* @__PURE__ */ new Set(),
|
|
74830
|
+
arg.type
|
|
74831
|
+
);
|
|
74832
|
+
const prop = AST10.tsPropertySignature(
|
|
74833
|
+
AST10.identifier(arg.name),
|
|
74834
|
+
AST10.tsTypeAnnotation(
|
|
74835
|
+
tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
|
|
74836
|
+
)
|
|
74837
|
+
);
|
|
74838
|
+
const unwrapped2 = unwrapType(config2, arg.type);
|
|
74839
|
+
prop.optional = unwrapped2.wrappers[unwrapped2.wrappers.length - 1] === "Nullable" /* Nullable */;
|
|
74840
|
+
return prop;
|
|
74841
|
+
})
|
|
74842
|
+
);
|
|
74843
|
+
}
|
|
74844
|
+
return AST10.tsPropertySignature(
|
|
74845
|
+
AST10.identifier(key),
|
|
74846
|
+
AST10.tsTypeAnnotation(
|
|
74847
|
+
AST10.tsTypeLiteral([
|
|
74848
|
+
AST10.tsPropertySignature(
|
|
74849
|
+
AST10.identifier("type"),
|
|
74850
|
+
AST10.tsTypeAnnotation(typeOptions)
|
|
74851
|
+
),
|
|
74852
|
+
AST10.tsPropertySignature(
|
|
74853
|
+
AST10.identifier("args"),
|
|
74854
|
+
AST10.tsTypeAnnotation(args)
|
|
74855
|
+
)
|
|
74856
|
+
])
|
|
74857
|
+
)
|
|
74858
|
+
);
|
|
74859
|
+
}
|
|
74860
|
+
)
|
|
74861
|
+
);
|
|
74862
|
+
}
|
|
74863
|
+
return AST10.tsPropertySignature(
|
|
74864
|
+
AST10.identifier(typeName),
|
|
74865
|
+
AST10.tsTypeAnnotation(
|
|
74866
|
+
AST10.tsTypeLiteral([
|
|
74867
|
+
AST10.tsPropertySignature(
|
|
74868
|
+
AST10.identifier("idFields"),
|
|
74869
|
+
AST10.tsTypeAnnotation(idFields)
|
|
74870
|
+
),
|
|
74871
|
+
AST10.tsPropertySignature(
|
|
74872
|
+
AST10.identifier("fields"),
|
|
74873
|
+
AST10.tsTypeAnnotation(fields)
|
|
74874
|
+
)
|
|
74875
|
+
])
|
|
74876
|
+
)
|
|
74877
|
+
);
|
|
74878
|
+
})
|
|
74879
|
+
);
|
|
74880
|
+
}
|
|
74881
|
+
function listDefinitions(config2, docs) {
|
|
74882
|
+
const lists = [];
|
|
74883
|
+
const visitedLists = /* @__PURE__ */ new Set();
|
|
74884
|
+
for (const doc of docs) {
|
|
74885
|
+
graphql18.visit(doc.document, {
|
|
74886
|
+
Directive(node, key, parent, path2, ancestors) {
|
|
74887
|
+
if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
74888
|
+
return;
|
|
74889
|
+
}
|
|
74890
|
+
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
74891
|
+
const nameValue = nameArg?.value?.value || "";
|
|
74892
|
+
if (!nameValue || visitedLists.has(nameValue)) {
|
|
74893
|
+
return;
|
|
74894
|
+
}
|
|
74895
|
+
visitedLists.add(nameValue);
|
|
74896
|
+
const parentType = parentTypeFromAncestors(
|
|
74897
|
+
config2.schema,
|
|
74898
|
+
doc.filename,
|
|
74899
|
+
ancestors.slice(0, -1)
|
|
74900
|
+
);
|
|
74901
|
+
const targetField = ancestors[ancestors.length - 1];
|
|
74902
|
+
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
74903
|
+
const { type: listType } = unwrapType(config2, targetFieldDefinition.type);
|
|
74904
|
+
const possibleTypes = [];
|
|
74905
|
+
if (graphql18.isAbstractType(listType)) {
|
|
74906
|
+
possibleTypes.push(
|
|
74907
|
+
...config2.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
74908
|
+
);
|
|
74909
|
+
} else {
|
|
74910
|
+
possibleTypes.push(listType.name);
|
|
74911
|
+
}
|
|
74912
|
+
lists.push(
|
|
74913
|
+
AST10.tsPropertySignature(
|
|
74914
|
+
AST10.identifier(nameValue),
|
|
74915
|
+
AST10.tsTypeAnnotation(
|
|
74916
|
+
AST10.tsTypeLiteral([
|
|
74917
|
+
AST10.tsPropertySignature(
|
|
74918
|
+
AST10.identifier("type"),
|
|
74919
|
+
AST10.tsTypeAnnotation(
|
|
74920
|
+
AST10.tsUnionType(
|
|
74921
|
+
possibleTypes.map(
|
|
74922
|
+
(possible) => AST10.tsLiteralType(AST10.stringLiteral(possible))
|
|
74923
|
+
)
|
|
74924
|
+
)
|
|
74925
|
+
)
|
|
74926
|
+
),
|
|
74927
|
+
AST10.tsPropertySignature(
|
|
74928
|
+
AST10.identifier("filters"),
|
|
74929
|
+
AST10.tsTypeAnnotation(
|
|
74930
|
+
targetFieldDefinition.args.length === 0 ? AST10.tsNeverKeyword() : AST10.tsTypeLiteral(
|
|
74931
|
+
targetFieldDefinition.args.map((arg) => {
|
|
74932
|
+
const argDef = AST10.tsPropertySignature(
|
|
74933
|
+
AST10.identifier(arg.name),
|
|
74934
|
+
AST10.tsTypeAnnotation(
|
|
74935
|
+
tsTypeReference(
|
|
74936
|
+
config2,
|
|
74937
|
+
/* @__PURE__ */ new Set(),
|
|
74938
|
+
arg
|
|
74939
|
+
)
|
|
74940
|
+
)
|
|
74941
|
+
);
|
|
74942
|
+
argDef.optional = true;
|
|
74943
|
+
return argDef;
|
|
74944
|
+
})
|
|
74945
|
+
)
|
|
74946
|
+
)
|
|
74947
|
+
)
|
|
74948
|
+
])
|
|
74949
|
+
)
|
|
74950
|
+
)
|
|
74951
|
+
);
|
|
74952
|
+
}
|
|
74953
|
+
});
|
|
74954
|
+
}
|
|
74955
|
+
return AST10.tsTypeLiteral(lists);
|
|
74956
|
+
}
|
|
74957
|
+
var CacheTypeDefName = "CacheTypeDef";
|
|
74958
|
+
function record(name2) {
|
|
74959
|
+
return AST10.tsTypeReference(
|
|
74960
|
+
AST10.identifier("Record"),
|
|
74961
|
+
AST10.tsTypeParameterInstantiation([
|
|
74962
|
+
AST10.tsTypeReference(AST10.identifier(CacheTypeDefName)),
|
|
74963
|
+
AST10.tsLiteralType(AST10.stringLiteral(name2))
|
|
74964
|
+
])
|
|
74965
|
+
);
|
|
74565
74966
|
}
|
|
74566
74967
|
|
|
74567
74968
|
// src/codegen/generators/typescript/inlineType.ts
|
|
74568
|
-
var
|
|
74569
|
-
var
|
|
74570
|
-
var
|
|
74969
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
74970
|
+
var recast11 = __toESM(require_main2(), 1);
|
|
74971
|
+
var AST11 = recast11.types.builders;
|
|
74571
74972
|
var fragmentKey = "$fragments";
|
|
74572
74973
|
function inlineType({
|
|
74573
74974
|
config: config2,
|
|
@@ -74584,9 +74985,9 @@ function inlineType({
|
|
|
74584
74985
|
}) {
|
|
74585
74986
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
74586
74987
|
let result;
|
|
74587
|
-
if (
|
|
74988
|
+
if (graphql19.isScalarType(type)) {
|
|
74588
74989
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
74589
|
-
} else if (
|
|
74990
|
+
} else if (graphql19.isEnumType(type)) {
|
|
74590
74991
|
if (!visitedTypes.has(type.name)) {
|
|
74591
74992
|
ensureImports({
|
|
74592
74993
|
config: config2,
|
|
@@ -74596,7 +74997,7 @@ function inlineType({
|
|
|
74596
74997
|
});
|
|
74597
74998
|
visitedTypes.add(type.name);
|
|
74598
74999
|
}
|
|
74599
|
-
result =
|
|
75000
|
+
result = AST11.tsTypeReference(AST11.identifier(type.name));
|
|
74600
75001
|
} else if (selections) {
|
|
74601
75002
|
const rootObj = type;
|
|
74602
75003
|
const inlineFragments = {};
|
|
@@ -74604,11 +75005,11 @@ function inlineType({
|
|
|
74604
75005
|
for (const selection2 of selections) {
|
|
74605
75006
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
74606
75007
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
74607
|
-
if (!
|
|
75008
|
+
if (!graphql19.isInterfaceType(type) && !graphql19.isUnionType(type)) {
|
|
74608
75009
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
74609
75010
|
continue;
|
|
74610
75011
|
}
|
|
74611
|
-
if (!
|
|
75012
|
+
if (!graphql19.isInterfaceType(fragmentType) && !graphql19.isUnionType(fragmentType)) {
|
|
74612
75013
|
if (!inlineFragments[fragmentType.name]) {
|
|
74613
75014
|
inlineFragments[fragmentType.name] = [];
|
|
74614
75015
|
}
|
|
@@ -74647,7 +75048,7 @@ function inlineType({
|
|
|
74647
75048
|
selectedFields.push(selection2);
|
|
74648
75049
|
}
|
|
74649
75050
|
}
|
|
74650
|
-
result =
|
|
75051
|
+
result = AST11.tsTypeLiteral([
|
|
74651
75052
|
...(selectedFields || []).filter(
|
|
74652
75053
|
(field) => field.kind === "Field"
|
|
74653
75054
|
).map((selection2) => {
|
|
@@ -74667,9 +75068,9 @@ function inlineType({
|
|
|
74667
75068
|
allOptional
|
|
74668
75069
|
});
|
|
74669
75070
|
const prop = readonlyProperty(
|
|
74670
|
-
|
|
74671
|
-
|
|
74672
|
-
|
|
75071
|
+
AST11.tsPropertySignature(
|
|
75072
|
+
AST11.identifier(attributeName),
|
|
75073
|
+
AST11.tsTypeAnnotation(attributeType)
|
|
74673
75074
|
),
|
|
74674
75075
|
allowReadonly
|
|
74675
75076
|
);
|
|
@@ -74683,15 +75084,15 @@ function inlineType({
|
|
|
74683
75084
|
if (includeFragments && fragmentSpreads && fragmentSpreads.length) {
|
|
74684
75085
|
result.members.push(
|
|
74685
75086
|
readonlyProperty(
|
|
74686
|
-
|
|
74687
|
-
|
|
74688
|
-
|
|
74689
|
-
|
|
75087
|
+
AST11.tsPropertySignature(
|
|
75088
|
+
AST11.identifier(fragmentKey),
|
|
75089
|
+
AST11.tsTypeAnnotation(
|
|
75090
|
+
AST11.tsTypeLiteral(
|
|
74690
75091
|
(fragmentSpreads || []).map(
|
|
74691
|
-
(fragmentSpread) =>
|
|
74692
|
-
|
|
74693
|
-
|
|
74694
|
-
|
|
75092
|
+
(fragmentSpread) => AST11.tsPropertySignature(
|
|
75093
|
+
AST11.identifier(fragmentSpread.name.value),
|
|
75094
|
+
AST11.tsTypeAnnotation(
|
|
75095
|
+
AST11.tsLiteralType(AST11.booleanLiteral(true))
|
|
74695
75096
|
)
|
|
74696
75097
|
)
|
|
74697
75098
|
)
|
|
@@ -74728,7 +75129,7 @@ function inlineType({
|
|
|
74728
75129
|
}
|
|
74729
75130
|
}
|
|
74730
75131
|
}
|
|
74731
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
75132
|
+
if (objectType.type === "TSTypeLiteral" && !graphql19.isInterfaceType(fragmentRootType) && !graphql19.isUnionType(fragmentRootType)) {
|
|
74732
75133
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
74733
75134
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
74734
75135
|
);
|
|
@@ -74737,9 +75138,9 @@ function inlineType({
|
|
|
74737
75138
|
}
|
|
74738
75139
|
objectType.members.push(
|
|
74739
75140
|
readonlyProperty(
|
|
74740
|
-
|
|
74741
|
-
|
|
74742
|
-
|
|
75141
|
+
AST11.tsPropertySignature(
|
|
75142
|
+
AST11.identifier("__typename"),
|
|
75143
|
+
AST11.tsTypeAnnotation(AST11.tsLiteralType(AST11.stringLiteral(typeName)))
|
|
74743
75144
|
),
|
|
74744
75145
|
allowReadonly
|
|
74745
75146
|
)
|
|
@@ -74750,8 +75151,8 @@ function inlineType({
|
|
|
74750
75151
|
if (Object.keys(inlineFragmentSelections).length > 0) {
|
|
74751
75152
|
let selectionTypes = Object.entries(inlineFragmentSelections).map(
|
|
74752
75153
|
([typeName, { type: type2, tsType }]) => {
|
|
74753
|
-
return
|
|
74754
|
-
|
|
75154
|
+
return AST11.tsParenthesizedType(
|
|
75155
|
+
AST11.tsIntersectionType(
|
|
74755
75156
|
[tsType].flatMap((type3) => {
|
|
74756
75157
|
if (type3.type === "TSUnionType") {
|
|
74757
75158
|
return type3.types.filter(
|
|
@@ -74764,9 +75165,9 @@ function inlineType({
|
|
|
74764
75165
|
);
|
|
74765
75166
|
}
|
|
74766
75167
|
);
|
|
74767
|
-
result =
|
|
75168
|
+
result = AST11.tsIntersectionType([
|
|
74768
75169
|
result,
|
|
74769
|
-
|
|
75170
|
+
AST11.tsParenthesizedType(AST11.tsUnionType(selectionTypes))
|
|
74770
75171
|
]);
|
|
74771
75172
|
}
|
|
74772
75173
|
} else {
|
|
@@ -74778,7 +75179,7 @@ function inlineType({
|
|
|
74778
75179
|
} else if (toWrap === "NonNull" /* NonNull */) {
|
|
74779
75180
|
continue;
|
|
74780
75181
|
} else if (toWrap === "List" /* List */) {
|
|
74781
|
-
result =
|
|
75182
|
+
result = AST11.tsArrayType(AST11.tsParenthesizedType(result));
|
|
74782
75183
|
}
|
|
74783
75184
|
}
|
|
74784
75185
|
return result;
|
|
@@ -74795,7 +75196,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
74795
75196
|
},
|
|
74796
75197
|
type: schema.getType("String")
|
|
74797
75198
|
};
|
|
74798
|
-
} else if (
|
|
75199
|
+
} else if (graphql19.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
74799
75200
|
fields = rootType.ofType.getFields();
|
|
74800
75201
|
} else {
|
|
74801
75202
|
fields = rootType.getFields();
|
|
@@ -74807,7 +75208,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
74807
75208
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
74808
75209
|
});
|
|
74809
75210
|
}
|
|
74810
|
-
const fieldType =
|
|
75211
|
+
const fieldType = graphql19.getNamedType(field.type);
|
|
74811
75212
|
if (!fieldType) {
|
|
74812
75213
|
throw new HoudiniError({
|
|
74813
75214
|
filepath,
|
|
@@ -74823,7 +75224,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
74823
75224
|
}
|
|
74824
75225
|
|
|
74825
75226
|
// src/codegen/generators/typescript/index.ts
|
|
74826
|
-
var
|
|
75227
|
+
var AST12 = recast12.types.builders;
|
|
74827
75228
|
async function typescriptGenerator(config2, docs) {
|
|
74828
75229
|
const typePaths = [];
|
|
74829
75230
|
const fragmentDefinitions = {};
|
|
@@ -74841,7 +75242,7 @@ async function typescriptGenerator(config2, docs) {
|
|
|
74841
75242
|
return;
|
|
74842
75243
|
}
|
|
74843
75244
|
const typeDefPath = config2.artifactTypePath(originalDocument);
|
|
74844
|
-
const program3 =
|
|
75245
|
+
const program3 = AST12.program([]);
|
|
74845
75246
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
74846
75247
|
let definition = originalDocument.definitions.find(
|
|
74847
75248
|
(def) => (def.kind === "OperationDefinition" || def.kind === "FragmentDefinition") && def.name?.value === name2
|
|
@@ -74874,21 +75275,21 @@ async function typescriptGenerator(config2, docs) {
|
|
|
74874
75275
|
missingScalars
|
|
74875
75276
|
);
|
|
74876
75277
|
}
|
|
74877
|
-
await fs_exports.writeFile(typeDefPath,
|
|
75278
|
+
await fs_exports.writeFile(typeDefPath, recast12.print(program3).code);
|
|
74878
75279
|
typePaths.push(typeDefPath);
|
|
74879
75280
|
})
|
|
74880
75281
|
);
|
|
74881
|
-
const typeIndex =
|
|
75282
|
+
const typeIndex = AST12.program(
|
|
74882
75283
|
typePaths.sort((a, b) => a.localeCompare(b)).map((typePath) => {
|
|
74883
|
-
return
|
|
74884
|
-
|
|
75284
|
+
return AST12.exportAllDeclaration(
|
|
75285
|
+
AST12.literal(
|
|
74885
75286
|
"./" + path_exports.relative(path_exports.resolve(config2.typeIndexPath, ".."), typePath).replace(/\.[^/.]+\.[^/.]+$/, "")
|
|
74886
75287
|
),
|
|
74887
75288
|
null
|
|
74888
75289
|
);
|
|
74889
75290
|
}).concat([
|
|
74890
|
-
|
|
74891
|
-
|
|
75291
|
+
AST12.exportAllDeclaration(AST12.literal("./runtime"), null),
|
|
75292
|
+
AST12.exportAllDeclaration(AST12.literal("./graphql"), null)
|
|
74892
75293
|
])
|
|
74893
75294
|
);
|
|
74894
75295
|
const export_default_as = ({ module: module2, as }) => `
|
|
@@ -74897,7 +75298,7 @@ export { default as ${as} } from "${module2}"
|
|
|
74897
75298
|
const export_star_from = ({ module: module2 }) => `
|
|
74898
75299
|
export * from "${module2}"
|
|
74899
75300
|
`;
|
|
74900
|
-
let indexContent =
|
|
75301
|
+
let indexContent = recast12.print(typeIndex).code;
|
|
74901
75302
|
for (const plugin of config2.plugins) {
|
|
74902
75303
|
if (!plugin.index_file) {
|
|
74903
75304
|
continue;
|
|
@@ -74918,6 +75319,7 @@ export * from "${module2}"
|
|
|
74918
75319
|
}
|
|
74919
75320
|
}
|
|
74920
75321
|
await fs_exports.writeFile(config2.typeIndexPath, indexContent);
|
|
75322
|
+
await imperativeCacheTypef(config2, docs);
|
|
74921
75323
|
if (missingScalars.size > 0) {
|
|
74922
75324
|
console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
|
|
74923
75325
|
", "
|
|
@@ -74959,23 +75361,23 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
74959
75361
|
const optimisticTypeName = `${definition.name.value}$optimistic`;
|
|
74960
75362
|
const hasInputs = definition.variableDefinitions && definition.variableDefinitions.length > 0;
|
|
74961
75363
|
body.push(
|
|
74962
|
-
|
|
74963
|
-
|
|
74964
|
-
|
|
74965
|
-
|
|
75364
|
+
AST12.exportNamedDeclaration(
|
|
75365
|
+
AST12.tsTypeAliasDeclaration(
|
|
75366
|
+
AST12.identifier(definition.name.value),
|
|
75367
|
+
AST12.tsTypeLiteral([
|
|
74966
75368
|
readonlyProperty(
|
|
74967
|
-
|
|
74968
|
-
|
|
74969
|
-
|
|
75369
|
+
AST12.tsPropertySignature(
|
|
75370
|
+
AST12.stringLiteral("input"),
|
|
75371
|
+
AST12.tsTypeAnnotation(AST12.tsTypeReference(AST12.identifier(inputTypeName)))
|
|
74970
75372
|
)
|
|
74971
75373
|
),
|
|
74972
75374
|
readonlyProperty(
|
|
74973
|
-
|
|
74974
|
-
|
|
74975
|
-
|
|
74976
|
-
definition.operation === "mutation" ?
|
|
74977
|
-
|
|
74978
|
-
|
|
75375
|
+
AST12.tsPropertySignature(
|
|
75376
|
+
AST12.stringLiteral("result"),
|
|
75377
|
+
AST12.tsTypeAnnotation(
|
|
75378
|
+
definition.operation === "mutation" ? AST12.tsTypeReference(AST12.identifier(shapeTypeName)) : AST12.tsUnionType([
|
|
75379
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName)),
|
|
75380
|
+
AST12.tsUndefinedKeyword()
|
|
74979
75381
|
])
|
|
74980
75382
|
)
|
|
74981
75383
|
)
|
|
@@ -74983,9 +75385,9 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
74983
75385
|
])
|
|
74984
75386
|
)
|
|
74985
75387
|
),
|
|
74986
|
-
|
|
74987
|
-
|
|
74988
|
-
|
|
75388
|
+
AST12.exportNamedDeclaration(
|
|
75389
|
+
AST12.tsTypeAliasDeclaration(
|
|
75390
|
+
AST12.identifier(shapeTypeName),
|
|
74989
75391
|
inlineType({
|
|
74990
75392
|
config: config2,
|
|
74991
75393
|
filepath,
|
|
@@ -75013,15 +75415,15 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
75013
75415
|
);
|
|
75014
75416
|
}
|
|
75015
75417
|
body.push(
|
|
75016
|
-
|
|
75017
|
-
|
|
75018
|
-
|
|
75019
|
-
|
|
75418
|
+
AST12.exportNamedDeclaration(
|
|
75419
|
+
AST12.tsTypeAliasDeclaration(
|
|
75420
|
+
AST12.identifier(inputTypeName),
|
|
75421
|
+
AST12.tsTypeLiteral(
|
|
75020
75422
|
(definition.variableDefinitions || []).map(
|
|
75021
75423
|
(definition2) => {
|
|
75022
|
-
return
|
|
75023
|
-
|
|
75024
|
-
|
|
75424
|
+
return AST12.tsPropertySignature(
|
|
75425
|
+
AST12.identifier(definition2.variable.name.value),
|
|
75426
|
+
AST12.tsTypeAnnotation(
|
|
75025
75427
|
tsTypeReference(config2, missingScalars, definition2)
|
|
75026
75428
|
),
|
|
75027
75429
|
definition2.type.kind !== "NonNullType"
|
|
@@ -75034,16 +75436,16 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
75034
75436
|
);
|
|
75035
75437
|
} else {
|
|
75036
75438
|
body.push(
|
|
75037
|
-
|
|
75038
|
-
|
|
75439
|
+
AST12.exportNamedDeclaration(
|
|
75440
|
+
AST12.tsTypeAliasDeclaration(AST12.identifier(inputTypeName), AST12.tsNullKeyword())
|
|
75039
75441
|
)
|
|
75040
75442
|
);
|
|
75041
75443
|
}
|
|
75042
75444
|
if (definition.operation === "mutation") {
|
|
75043
75445
|
body.push(
|
|
75044
|
-
|
|
75045
|
-
|
|
75046
|
-
|
|
75446
|
+
AST12.exportNamedDeclaration(
|
|
75447
|
+
AST12.tsTypeAliasDeclaration(
|
|
75448
|
+
AST12.identifier(optimisticTypeName),
|
|
75047
75449
|
inlineType({
|
|
75048
75450
|
config: config2,
|
|
75049
75451
|
filepath,
|
|
@@ -75074,28 +75476,28 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
75074
75476
|
throw new Error("Should not get here");
|
|
75075
75477
|
}
|
|
75076
75478
|
body.push(
|
|
75077
|
-
|
|
75078
|
-
|
|
75079
|
-
|
|
75080
|
-
|
|
75479
|
+
AST12.exportNamedDeclaration(
|
|
75480
|
+
AST12.tsTypeAliasDeclaration(
|
|
75481
|
+
AST12.identifier(propTypeName),
|
|
75482
|
+
AST12.tsTypeLiteral([
|
|
75081
75483
|
readonlyProperty(
|
|
75082
|
-
|
|
75083
|
-
|
|
75084
|
-
|
|
75085
|
-
|
|
75484
|
+
AST12.tsPropertySignature(
|
|
75485
|
+
AST12.stringLiteral("shape"),
|
|
75486
|
+
AST12.tsTypeAnnotation(
|
|
75487
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName))
|
|
75086
75488
|
),
|
|
75087
75489
|
true
|
|
75088
75490
|
)
|
|
75089
75491
|
),
|
|
75090
75492
|
readonlyProperty(
|
|
75091
|
-
|
|
75092
|
-
|
|
75093
|
-
|
|
75094
|
-
|
|
75095
|
-
|
|
75096
|
-
|
|
75097
|
-
|
|
75098
|
-
|
|
75493
|
+
AST12.tsPropertySignature(
|
|
75494
|
+
AST12.stringLiteral(fragmentKey),
|
|
75495
|
+
AST12.tsTypeAnnotation(
|
|
75496
|
+
AST12.tsTypeLiteral([
|
|
75497
|
+
AST12.tsPropertySignature(
|
|
75498
|
+
AST12.stringLiteral(propTypeName),
|
|
75499
|
+
AST12.tsTypeAnnotation(
|
|
75500
|
+
AST12.tsLiteralType(AST12.booleanLiteral(true))
|
|
75099
75501
|
)
|
|
75100
75502
|
)
|
|
75101
75503
|
])
|
|
@@ -75105,9 +75507,9 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
75105
75507
|
])
|
|
75106
75508
|
)
|
|
75107
75509
|
),
|
|
75108
|
-
|
|
75109
|
-
|
|
75110
|
-
|
|
75510
|
+
AST12.exportNamedDeclaration(
|
|
75511
|
+
AST12.tsTypeAliasDeclaration(
|
|
75512
|
+
AST12.identifier(shapeTypeName),
|
|
75111
75513
|
inlineType({
|
|
75112
75514
|
config: config2,
|
|
75113
75515
|
filepath,
|
|
@@ -75127,7 +75529,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
75127
75529
|
}
|
|
75128
75530
|
|
|
75129
75531
|
// src/codegen/generators/persistedQueries/index.ts
|
|
75130
|
-
var
|
|
75532
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
75131
75533
|
async function persistOutputGenerator(config2, docs) {
|
|
75132
75534
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
75133
75535
|
return;
|
|
@@ -75139,8 +75541,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75139
75541
|
if (!generateArtifact) {
|
|
75140
75542
|
return acc;
|
|
75141
75543
|
}
|
|
75142
|
-
let rawString =
|
|
75143
|
-
|
|
75544
|
+
let rawString = graphql20.print(
|
|
75545
|
+
graphql20.visit(document, {
|
|
75144
75546
|
Directive(node) {
|
|
75145
75547
|
if (config2.isInternalDirective(node)) {
|
|
75146
75548
|
return null;
|
|
@@ -75149,7 +75551,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75149
75551
|
})
|
|
75150
75552
|
);
|
|
75151
75553
|
const operations = document.definitions.filter(
|
|
75152
|
-
({ kind }) => kind ===
|
|
75554
|
+
({ kind }) => kind === graphql20.Kind.OPERATION_DEFINITION
|
|
75153
75555
|
);
|
|
75154
75556
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
75155
75557
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -75162,26 +75564,26 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75162
75564
|
}
|
|
75163
75565
|
|
|
75164
75566
|
// src/codegen/generators/definitions/enums.ts
|
|
75165
|
-
var
|
|
75166
|
-
var
|
|
75167
|
-
var
|
|
75567
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
75568
|
+
var recast13 = __toESM(require_main2(), 1);
|
|
75569
|
+
var AST13 = recast13.types.builders;
|
|
75168
75570
|
async function definitionsGenerator(config2) {
|
|
75169
|
-
const enums =
|
|
75571
|
+
const enums = graphql21.parse(graphql21.printSchema(config2.schema)).definitions.filter(
|
|
75170
75572
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
75171
75573
|
).filter((def) => !config2.isInternalEnum(def));
|
|
75172
|
-
const runtimeDefinitions =
|
|
75173
|
-
|
|
75574
|
+
const runtimeDefinitions = recast13.print(
|
|
75575
|
+
AST13.program(
|
|
75174
75576
|
enums.map((defn) => {
|
|
75175
75577
|
const name2 = defn.name.value;
|
|
75176
75578
|
return moduleExport(
|
|
75177
75579
|
config2,
|
|
75178
75580
|
name2,
|
|
75179
|
-
|
|
75581
|
+
AST13.objectExpression(
|
|
75180
75582
|
defn.values?.map((value) => {
|
|
75181
75583
|
const str = value.name.value;
|
|
75182
|
-
return
|
|
75183
|
-
|
|
75184
|
-
|
|
75584
|
+
return AST13.objectProperty(
|
|
75585
|
+
AST13.stringLiteral(str),
|
|
75586
|
+
AST13.stringLiteral(str)
|
|
75185
75587
|
);
|
|
75186
75588
|
}) || []
|
|
75187
75589
|
)
|
|
@@ -75189,7 +75591,7 @@ async function definitionsGenerator(config2) {
|
|
|
75189
75591
|
})
|
|
75190
75592
|
)
|
|
75191
75593
|
).code;
|
|
75192
|
-
const
|
|
75594
|
+
const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
|
|
75193
75595
|
(definition) => `
|
|
75194
75596
|
export declare enum ${definition.name.value} {
|
|
75195
75597
|
${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
|
|
@@ -75200,7 +75602,7 @@ ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.val
|
|
|
75200
75602
|
export * from './enums.js'
|
|
75201
75603
|
`;
|
|
75202
75604
|
await Promise.all([
|
|
75203
|
-
fs_exports.writeFile(config2.enumTypesDefinitionsPath,
|
|
75605
|
+
fs_exports.writeFile(config2.enumTypesDefinitionsPath, typeDefinitions2),
|
|
75204
75606
|
fs_exports.writeFile(config2.enumRuntimeDefinitionsPath, runtimeDefinitions),
|
|
75205
75607
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.js"), definitionsIndex),
|
|
75206
75608
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.d.ts"), definitionsIndex)
|
|
@@ -75339,7 +75741,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
75339
75741
|
}
|
|
75340
75742
|
|
|
75341
75743
|
// src/codegen/transforms/schema.ts
|
|
75342
|
-
var
|
|
75744
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
75343
75745
|
async function graphqlExtensions(config2, documents) {
|
|
75344
75746
|
const internalSchema = `
|
|
75345
75747
|
enum CachePolicy {
|
|
@@ -75417,19 +75819,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
75417
75819
|
"""
|
|
75418
75820
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
75419
75821
|
`;
|
|
75420
|
-
let currentSchema =
|
|
75822
|
+
let currentSchema = graphql23.printSchema(config2.schema);
|
|
75421
75823
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
75422
75824
|
currentSchema += internalSchema;
|
|
75423
75825
|
}
|
|
75424
75826
|
config2.newSchema += internalSchema;
|
|
75425
|
-
config2.schema =
|
|
75827
|
+
config2.schema = graphql23.buildSchema(currentSchema);
|
|
75426
75828
|
}
|
|
75427
75829
|
|
|
75428
75830
|
// src/codegen/transforms/typename.ts
|
|
75429
|
-
var
|
|
75831
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
75430
75832
|
async function addTypename(config2, documents) {
|
|
75431
75833
|
for (const doc of documents) {
|
|
75432
|
-
doc.document =
|
|
75834
|
+
doc.document = graphql24.visit(doc.document, {
|
|
75433
75835
|
Field(node, key, parent, path2, ancestors) {
|
|
75434
75836
|
if (!node.selectionSet) {
|
|
75435
75837
|
return;
|
|
@@ -75441,7 +75843,7 @@ async function addTypename(config2, documents) {
|
|
|
75441
75843
|
);
|
|
75442
75844
|
const field = type.getFields()[node.name.value];
|
|
75443
75845
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75444
|
-
if (
|
|
75846
|
+
if (graphql24.isInterfaceType(fieldType) || graphql24.isUnionType(fieldType)) {
|
|
75445
75847
|
return {
|
|
75446
75848
|
...node,
|
|
75447
75849
|
selectionSet: {
|
|
@@ -75449,9 +75851,9 @@ async function addTypename(config2, documents) {
|
|
|
75449
75851
|
selections: [
|
|
75450
75852
|
...node.selectionSet.selections,
|
|
75451
75853
|
{
|
|
75452
|
-
kind:
|
|
75854
|
+
kind: graphql24.Kind.FIELD,
|
|
75453
75855
|
name: {
|
|
75454
|
-
kind:
|
|
75856
|
+
kind: graphql24.Kind.NAME,
|
|
75455
75857
|
value: "__typename"
|
|
75456
75858
|
}
|
|
75457
75859
|
}
|
|
@@ -75465,10 +75867,10 @@ async function addTypename(config2, documents) {
|
|
|
75465
75867
|
}
|
|
75466
75868
|
|
|
75467
75869
|
// src/codegen/transforms/addID.ts
|
|
75468
|
-
var
|
|
75870
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
75469
75871
|
async function addID(config2, documents) {
|
|
75470
75872
|
for (const doc of documents) {
|
|
75471
|
-
doc.document =
|
|
75873
|
+
doc.document = graphql25.visit(doc.document, {
|
|
75472
75874
|
Field(node, key, parent, path2, ancestors) {
|
|
75473
75875
|
if (!node.selectionSet) {
|
|
75474
75876
|
return;
|
|
@@ -75481,7 +75883,7 @@ async function addID(config2, documents) {
|
|
|
75481
75883
|
const field = type.getFields()[node.name.value];
|
|
75482
75884
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75483
75885
|
if (node.selectionSet?.selections.length > 0) {
|
|
75484
|
-
if (!
|
|
75886
|
+
if (!graphql25.isObjectType(fieldType) && !graphql25.isInterfaceType(fieldType)) {
|
|
75485
75887
|
return;
|
|
75486
75888
|
}
|
|
75487
75889
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -75496,9 +75898,9 @@ async function addID(config2, documents) {
|
|
|
75496
75898
|
continue;
|
|
75497
75899
|
}
|
|
75498
75900
|
selections.push({
|
|
75499
|
-
kind:
|
|
75901
|
+
kind: graphql25.Kind.FIELD,
|
|
75500
75902
|
name: {
|
|
75501
|
-
kind:
|
|
75903
|
+
kind: graphql25.Kind.NAME,
|
|
75502
75904
|
value: keyField
|
|
75503
75905
|
}
|
|
75504
75906
|
});
|
|
@@ -75517,8 +75919,8 @@ async function addID(config2, documents) {
|
|
|
75517
75919
|
}
|
|
75518
75920
|
|
|
75519
75921
|
// src/codegen/transforms/fragmentVariables.ts
|
|
75520
|
-
var
|
|
75521
|
-
var GraphqlKinds2 =
|
|
75922
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
75923
|
+
var GraphqlKinds2 = graphql26.Kind;
|
|
75522
75924
|
async function fragmentVariables(config2, documents) {
|
|
75523
75925
|
const fragments = collectFragments(config2, documents);
|
|
75524
75926
|
const generatedFragments = {};
|
|
@@ -75541,7 +75943,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
75541
75943
|
});
|
|
75542
75944
|
}
|
|
75543
75945
|
const doc = {
|
|
75544
|
-
kind:
|
|
75946
|
+
kind: graphql26.Kind.DOCUMENT,
|
|
75545
75947
|
definitions: Object.values(generatedFragments)
|
|
75546
75948
|
};
|
|
75547
75949
|
documents.push({
|
|
@@ -75577,7 +75979,7 @@ function inlineFragmentArgs({
|
|
|
75577
75979
|
filepath,
|
|
75578
75980
|
document
|
|
75579
75981
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
75580
|
-
const result =
|
|
75982
|
+
const result = graphql26.visit(document, {
|
|
75581
75983
|
FragmentSpread(node) {
|
|
75582
75984
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
75583
75985
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -75665,7 +76067,7 @@ function inlineFragmentArgs({
|
|
|
75665
76067
|
});
|
|
75666
76068
|
if (newName) {
|
|
75667
76069
|
result.name = {
|
|
75668
|
-
kind:
|
|
76070
|
+
kind: graphql26.Kind.NAME,
|
|
75669
76071
|
value: newName
|
|
75670
76072
|
};
|
|
75671
76073
|
}
|
|
@@ -75777,7 +76179,7 @@ function operationScope(operation) {
|
|
|
75777
76179
|
}
|
|
75778
76180
|
|
|
75779
76181
|
// src/codegen/validators/typeCheck.ts
|
|
75780
|
-
var
|
|
76182
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
75781
76183
|
async function typeCheck(config2, docs) {
|
|
75782
76184
|
const errors = [];
|
|
75783
76185
|
const freeLists = [];
|
|
@@ -75785,11 +76187,11 @@ async function typeCheck(config2, docs) {
|
|
|
75785
76187
|
const listTypes = [];
|
|
75786
76188
|
const fragments = {};
|
|
75787
76189
|
for (const { document: parsed, filename } of docs) {
|
|
75788
|
-
|
|
75789
|
-
[
|
|
76190
|
+
graphql27.visit(parsed, {
|
|
76191
|
+
[graphql27.Kind.FRAGMENT_DEFINITION](definition) {
|
|
75790
76192
|
fragments[definition.name.value] = definition;
|
|
75791
76193
|
},
|
|
75792
|
-
[
|
|
76194
|
+
[graphql27.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
75793
76195
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
75794
76196
|
return;
|
|
75795
76197
|
}
|
|
@@ -75835,14 +76237,14 @@ async function typeCheck(config2, docs) {
|
|
|
75835
76237
|
);
|
|
75836
76238
|
return;
|
|
75837
76239
|
}
|
|
75838
|
-
if (
|
|
76240
|
+
if (graphql27.isListType(rootType) || graphql27.isNonNullType(rootType) && graphql27.isListType(rootType.ofType)) {
|
|
75839
76241
|
needsParent = true;
|
|
75840
76242
|
break;
|
|
75841
76243
|
}
|
|
75842
|
-
if (
|
|
76244
|
+
if (graphql27.isNonNullType(rootType) && "ofType" in rootType) {
|
|
75843
76245
|
rootType = rootType.ofType;
|
|
75844
76246
|
}
|
|
75845
|
-
if (
|
|
76247
|
+
if (graphql27.isScalarType(rootType)) {
|
|
75846
76248
|
break;
|
|
75847
76249
|
}
|
|
75848
76250
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -75898,7 +76300,7 @@ async function typeCheck(config2, docs) {
|
|
|
75898
76300
|
);
|
|
75899
76301
|
const targetField = ancestors[ancestors.length - 1];
|
|
75900
76302
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
75901
|
-
const { type, error } = connectionSelection(
|
|
76303
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
75902
76304
|
config2,
|
|
75903
76305
|
targetFieldDefinition,
|
|
75904
76306
|
parentTypeFromAncestors(
|
|
@@ -75908,10 +76310,19 @@ async function typeCheck(config2, docs) {
|
|
|
75908
76310
|
),
|
|
75909
76311
|
targetField.selectionSet
|
|
75910
76312
|
);
|
|
76313
|
+
if (errorConnectionSelection && directive.name.value === config2.paginateDirective) {
|
|
76314
|
+
errors.push(
|
|
76315
|
+
new HoudiniError({
|
|
76316
|
+
filepath: filename,
|
|
76317
|
+
message: errorConnectionSelection,
|
|
76318
|
+
description: errorConnectionSelection
|
|
76319
|
+
})
|
|
76320
|
+
);
|
|
76321
|
+
}
|
|
75911
76322
|
let targetTypes = [type];
|
|
75912
|
-
if (
|
|
76323
|
+
if (graphql27.isUnionType(type)) {
|
|
75913
76324
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
75914
|
-
} else if (
|
|
76325
|
+
} else if (graphql27.isInterfaceType(type)) {
|
|
75915
76326
|
try {
|
|
75916
76327
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
75917
76328
|
if (!type.getFields()[key]) {
|
|
@@ -75925,23 +76336,16 @@ async function typeCheck(config2, docs) {
|
|
|
75925
76336
|
for (const targetType of targetTypes) {
|
|
75926
76337
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
75927
76338
|
if (missingIDFields.length > 0) {
|
|
75928
|
-
|
|
75929
|
-
|
|
75930
|
-
|
|
75931
|
-
|
|
75932
|
-
|
|
75933
|
-
|
|
75934
|
-
|
|
75935
|
-
|
|
75936
|
-
|
|
75937
|
-
|
|
75938
|
-
filepath: filename,
|
|
75939
|
-
message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
75940
|
-
", "
|
|
75941
|
-
)}.`
|
|
75942
|
-
})
|
|
75943
|
-
);
|
|
75944
|
-
}
|
|
76339
|
+
const message = `@${config2.listDirective} on ${logGreen(
|
|
76340
|
+
targetType.name
|
|
76341
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
76342
|
+
errors.push(
|
|
76343
|
+
new HoudiniError({
|
|
76344
|
+
filepath: filename,
|
|
76345
|
+
message,
|
|
76346
|
+
description: message
|
|
76347
|
+
})
|
|
76348
|
+
);
|
|
75945
76349
|
return;
|
|
75946
76350
|
}
|
|
75947
76351
|
}
|
|
@@ -75956,13 +76360,13 @@ async function typeCheck(config2, docs) {
|
|
|
75956
76360
|
if (errors.length > 0) {
|
|
75957
76361
|
throw errors;
|
|
75958
76362
|
}
|
|
75959
|
-
const rules = (filepath) => [...
|
|
76363
|
+
const rules = (filepath) => [...graphql27.specifiedRules].filter(
|
|
75960
76364
|
(rule) => ![
|
|
75961
|
-
|
|
75962
|
-
|
|
75963
|
-
|
|
75964
|
-
|
|
75965
|
-
|
|
76365
|
+
graphql27.NoUnusedFragmentsRule,
|
|
76366
|
+
graphql27.KnownFragmentNamesRule,
|
|
76367
|
+
graphql27.ExecutableDefinitionsRule,
|
|
76368
|
+
graphql27.KnownDirectivesRule,
|
|
76369
|
+
graphql27.KnownArgumentNamesRule
|
|
75966
76370
|
].includes(rule)
|
|
75967
76371
|
).concat(
|
|
75968
76372
|
validateLists({
|
|
@@ -75981,7 +76385,7 @@ async function typeCheck(config2, docs) {
|
|
|
75981
76385
|
noUnusedFragmentArguments(config2)
|
|
75982
76386
|
);
|
|
75983
76387
|
for (const { filename, document: parsed } of docs) {
|
|
75984
|
-
for (const error of
|
|
76388
|
+
for (const error of graphql27.validate(config2.schema, parsed, rules(filename))) {
|
|
75985
76389
|
errors.push(
|
|
75986
76390
|
new HoudiniError({
|
|
75987
76391
|
filepath: filename,
|
|
@@ -76007,7 +76411,7 @@ var validateLists = ({
|
|
|
76007
76411
|
if (!config2.isListFragment(node.name.value)) {
|
|
76008
76412
|
if (!fragments[node.name.value]) {
|
|
76009
76413
|
ctx.reportError(
|
|
76010
|
-
new
|
|
76414
|
+
new graphql27.GraphQLError(
|
|
76011
76415
|
"Encountered unknown fragment: " + node.name.value
|
|
76012
76416
|
)
|
|
76013
76417
|
);
|
|
@@ -76017,7 +76421,7 @@ var validateLists = ({
|
|
|
76017
76421
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
76018
76422
|
if (!lists.includes(listName)) {
|
|
76019
76423
|
ctx.reportError(
|
|
76020
|
-
new
|
|
76424
|
+
new graphql27.GraphQLError(
|
|
76021
76425
|
"Encountered fragment referencing unknown list: " + listName
|
|
76022
76426
|
)
|
|
76023
76427
|
);
|
|
@@ -76042,7 +76446,7 @@ var validateLists = ({
|
|
|
76042
76446
|
);
|
|
76043
76447
|
if (parentArg) {
|
|
76044
76448
|
ctx.reportError(
|
|
76045
|
-
new
|
|
76449
|
+
new graphql27.GraphQLError(
|
|
76046
76450
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
76047
76451
|
)
|
|
76048
76452
|
);
|
|
@@ -76058,7 +76462,7 @@ var validateLists = ({
|
|
|
76058
76462
|
return;
|
|
76059
76463
|
}
|
|
76060
76464
|
ctx.reportError(
|
|
76061
|
-
new
|
|
76465
|
+
new graphql27.GraphQLError(
|
|
76062
76466
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
76063
76467
|
)
|
|
76064
76468
|
);
|
|
@@ -76068,7 +76472,7 @@ var validateLists = ({
|
|
|
76068
76472
|
const directiveName = node.name.value;
|
|
76069
76473
|
if (directiveName === "connection") {
|
|
76070
76474
|
ctx.reportError(
|
|
76071
|
-
new
|
|
76475
|
+
new graphql27.GraphQLError(
|
|
76072
76476
|
"@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."
|
|
76073
76477
|
)
|
|
76074
76478
|
);
|
|
@@ -76077,7 +76481,7 @@ var validateLists = ({
|
|
|
76077
76481
|
if (!config2.isInternalDirective(node)) {
|
|
76078
76482
|
if (!config2.schema.getDirective(directiveName)) {
|
|
76079
76483
|
ctx.reportError(
|
|
76080
|
-
new
|
|
76484
|
+
new graphql27.GraphQLError(
|
|
76081
76485
|
"Encountered unknown directive: " + directiveName
|
|
76082
76486
|
)
|
|
76083
76487
|
);
|
|
@@ -76086,7 +76490,7 @@ var validateLists = ({
|
|
|
76086
76490
|
}
|
|
76087
76491
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
76088
76492
|
ctx.reportError(
|
|
76089
|
-
new
|
|
76493
|
+
new graphql27.GraphQLError(
|
|
76090
76494
|
"Encountered directive referencing unknown list: " + directiveName
|
|
76091
76495
|
)
|
|
76092
76496
|
);
|
|
@@ -76097,7 +76501,7 @@ var validateLists = ({
|
|
|
76097
76501
|
};
|
|
76098
76502
|
function knownArguments(config2) {
|
|
76099
76503
|
return function(ctx) {
|
|
76100
|
-
const nativeValidator =
|
|
76504
|
+
const nativeValidator = graphql27.KnownArgumentNamesRule(ctx);
|
|
76101
76505
|
return {
|
|
76102
76506
|
...nativeValidator,
|
|
76103
76507
|
Directive(directiveNode) {
|
|
@@ -76130,7 +76534,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76130
76534
|
for (const arg of node.arguments || []) {
|
|
76131
76535
|
if (arg.value.kind !== "ObjectValue") {
|
|
76132
76536
|
ctx.reportError(
|
|
76133
|
-
new
|
|
76537
|
+
new graphql27.GraphQLError("values in @arguments must be an object")
|
|
76134
76538
|
);
|
|
76135
76539
|
return;
|
|
76136
76540
|
}
|
|
@@ -76140,13 +76544,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76140
76544
|
);
|
|
76141
76545
|
if (!typeArg) {
|
|
76142
76546
|
ctx.reportError(
|
|
76143
|
-
new
|
|
76547
|
+
new graphql27.GraphQLError("missing type field for @arguments directive")
|
|
76144
76548
|
);
|
|
76145
76549
|
return;
|
|
76146
76550
|
}
|
|
76147
|
-
if (typeArg.value.kind !==
|
|
76551
|
+
if (typeArg.value.kind !== graphql27.Kind.STRING) {
|
|
76148
76552
|
ctx.reportError(
|
|
76149
|
-
new
|
|
76553
|
+
new graphql27.GraphQLError("type field to @arguments must be a string")
|
|
76150
76554
|
);
|
|
76151
76555
|
return;
|
|
76152
76556
|
}
|
|
@@ -76159,7 +76563,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76159
76563
|
);
|
|
76160
76564
|
if (typeArg.value.value !== defaultValueType) {
|
|
76161
76565
|
ctx.reportError(
|
|
76162
|
-
new
|
|
76566
|
+
new graphql27.GraphQLError(
|
|
76163
76567
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
76164
76568
|
)
|
|
76165
76569
|
);
|
|
@@ -76177,7 +76581,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76177
76581
|
try {
|
|
76178
76582
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
76179
76583
|
} catch (e2) {
|
|
76180
|
-
ctx.reportError(new
|
|
76584
|
+
ctx.reportError(new graphql27.GraphQLError(e2.message));
|
|
76181
76585
|
return;
|
|
76182
76586
|
}
|
|
76183
76587
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -76200,7 +76604,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76200
76604
|
);
|
|
76201
76605
|
if (missing.length > 0) {
|
|
76202
76606
|
ctx.reportError(
|
|
76203
|
-
new
|
|
76607
|
+
new graphql27.GraphQLError(
|
|
76204
76608
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
76205
76609
|
)
|
|
76206
76610
|
);
|
|
@@ -76211,7 +76615,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76211
76615
|
);
|
|
76212
76616
|
if (unknown.length > 0) {
|
|
76213
76617
|
ctx.reportError(
|
|
76214
|
-
new
|
|
76618
|
+
new graphql27.GraphQLError(
|
|
76215
76619
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
76216
76620
|
)
|
|
76217
76621
|
);
|
|
@@ -76223,7 +76627,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76223
76627
|
]
|
|
76224
76628
|
);
|
|
76225
76629
|
for (const [applied, target] of zipped) {
|
|
76226
|
-
if (applied.value.kind ===
|
|
76630
|
+
if (applied.value.kind === graphql27.Kind.VARIABLE || applied.value.kind === graphql27.Kind.LIST || applied.value.kind === graphql27.Kind.OBJECT) {
|
|
76227
76631
|
continue;
|
|
76228
76632
|
}
|
|
76229
76633
|
const appliedType = applied.value.kind.substring(
|
|
@@ -76232,7 +76636,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76232
76636
|
);
|
|
76233
76637
|
if (appliedType !== target) {
|
|
76234
76638
|
ctx.reportError(
|
|
76235
|
-
new
|
|
76639
|
+
new graphql27.GraphQLError(
|
|
76236
76640
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
76237
76641
|
)
|
|
76238
76642
|
);
|
|
@@ -76253,7 +76657,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76253
76657
|
}
|
|
76254
76658
|
if (alreadyPaginated) {
|
|
76255
76659
|
ctx.reportError(
|
|
76256
|
-
new
|
|
76660
|
+
new graphql27.GraphQLError(
|
|
76257
76661
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
76258
76662
|
)
|
|
76259
76663
|
);
|
|
@@ -76268,7 +76672,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76268
76672
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
76269
76673
|
if (hasRequiredArgs) {
|
|
76270
76674
|
ctx.reportError(
|
|
76271
|
-
new
|
|
76675
|
+
new graphql27.GraphQLError(
|
|
76272
76676
|
"@paginate cannot appear on a document with required args"
|
|
76273
76677
|
)
|
|
76274
76678
|
);
|
|
@@ -76300,14 +76704,14 @@ function paginateArgs(config2, filepath) {
|
|
|
76300
76704
|
const backwards = appliedArgs.has("last");
|
|
76301
76705
|
if (!forward && !backwards) {
|
|
76302
76706
|
ctx.reportError(
|
|
76303
|
-
new
|
|
76707
|
+
new graphql27.GraphQLError(
|
|
76304
76708
|
"A field with cursor-based pagination must have a first or last argument"
|
|
76305
76709
|
)
|
|
76306
76710
|
);
|
|
76307
76711
|
}
|
|
76308
76712
|
if (forward && backwards) {
|
|
76309
76713
|
ctx.reportError(
|
|
76310
|
-
new
|
|
76714
|
+
new graphql27.GraphQLError(
|
|
76311
76715
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
76312
76716
|
)
|
|
76313
76717
|
);
|
|
@@ -76321,7 +76725,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76321
76725
|
);
|
|
76322
76726
|
if (!appliedLimitArg) {
|
|
76323
76727
|
ctx.reportError(
|
|
76324
|
-
new
|
|
76728
|
+
new graphql27.GraphQLError(
|
|
76325
76729
|
"A field with offset-based pagination must have a limit argument"
|
|
76326
76730
|
)
|
|
76327
76731
|
);
|
|
@@ -76337,20 +76741,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
76337
76741
|
const args = /* @__PURE__ */ new Set();
|
|
76338
76742
|
return {
|
|
76339
76743
|
enter(node) {
|
|
76340
|
-
if (node.kind ===
|
|
76744
|
+
if (node.kind === graphql27.Kind.FRAGMENT_DEFINITION) {
|
|
76341
76745
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
76342
76746
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
76343
76747
|
args.add(arg);
|
|
76344
76748
|
}
|
|
76345
|
-
} else if (node.kind ===
|
|
76749
|
+
} else if (node.kind === graphql27.Kind.VARIABLE) {
|
|
76346
76750
|
args.delete(node.name.value);
|
|
76347
76751
|
}
|
|
76348
76752
|
},
|
|
76349
76753
|
leave(node) {
|
|
76350
|
-
if (node.kind ===
|
|
76754
|
+
if (node.kind === graphql27.Kind.FRAGMENT_DEFINITION) {
|
|
76351
76755
|
if (args.size > 0) {
|
|
76352
76756
|
ctx.reportError(
|
|
76353
|
-
new
|
|
76757
|
+
new graphql27.GraphQLError(
|
|
76354
76758
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
76355
76759
|
)
|
|
76356
76760
|
);
|
|
@@ -76386,7 +76790,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76386
76790
|
if (definition.kind === "OperationDefinition") {
|
|
76387
76791
|
if (definition.operation !== "query") {
|
|
76388
76792
|
ctx.reportError(
|
|
76389
|
-
new
|
|
76793
|
+
new graphql27.GraphQLError(
|
|
76390
76794
|
`@${node.name.value} must fall on a fragment or query document`
|
|
76391
76795
|
)
|
|
76392
76796
|
);
|
|
@@ -76398,7 +76802,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76398
76802
|
}
|
|
76399
76803
|
if (!possibleNodes.includes(definitionType)) {
|
|
76400
76804
|
ctx.reportError(
|
|
76401
|
-
new
|
|
76805
|
+
new graphql27.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
76402
76806
|
);
|
|
76403
76807
|
}
|
|
76404
76808
|
}
|
|
@@ -76417,7 +76821,7 @@ function checkMutationOperation(config2) {
|
|
|
76417
76821
|
);
|
|
76418
76822
|
if (append && prepend) {
|
|
76419
76823
|
ctx.reportError(
|
|
76420
|
-
new
|
|
76824
|
+
new graphql27.GraphQLError(
|
|
76421
76825
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
76422
76826
|
)
|
|
76423
76827
|
);
|
|
@@ -76431,7 +76835,7 @@ function checkMutationOperation(config2) {
|
|
|
76431
76835
|
);
|
|
76432
76836
|
if (parentId && allLists) {
|
|
76433
76837
|
ctx.reportError(
|
|
76434
|
-
new
|
|
76838
|
+
new graphql27.GraphQLError(
|
|
76435
76839
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
76436
76840
|
)
|
|
76437
76841
|
);
|
|
@@ -76453,7 +76857,7 @@ function checkMaskDirective(config2) {
|
|
|
76453
76857
|
);
|
|
76454
76858
|
if (maskEnableDirective && maskDisableDirective) {
|
|
76455
76859
|
ctx.reportError(
|
|
76456
|
-
new
|
|
76860
|
+
new graphql27.GraphQLError(
|
|
76457
76861
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
76458
76862
|
)
|
|
76459
76863
|
);
|
|
@@ -76469,7 +76873,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
76469
76873
|
if (!nodeInterface) {
|
|
76470
76874
|
return null;
|
|
76471
76875
|
}
|
|
76472
|
-
if (!
|
|
76876
|
+
if (!graphql27.isInterfaceType(nodeInterface)) {
|
|
76473
76877
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
76474
76878
|
return null;
|
|
76475
76879
|
}
|
|
@@ -76567,11 +76971,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
76567
76971
|
}
|
|
76568
76972
|
|
|
76569
76973
|
// src/codegen/validators/noIDAlias.ts
|
|
76570
|
-
var
|
|
76974
|
+
var graphql28 = __toESM(require_graphql2(), 1);
|
|
76571
76975
|
async function noIDAlias(config2, docs) {
|
|
76572
76976
|
const errors = [];
|
|
76573
76977
|
for (const { filename, document } of docs) {
|
|
76574
|
-
|
|
76978
|
+
graphql28.visit(document, {
|
|
76575
76979
|
Field(node, _, __, ___, ancestors) {
|
|
76576
76980
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
76577
76981
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -76713,8 +77117,8 @@ async function collectDocuments(config2) {
|
|
|
76713
77117
|
}
|
|
76714
77118
|
}
|
|
76715
77119
|
}
|
|
76716
|
-
const graphql_extractor = (filepath, content) => [content];
|
|
76717
|
-
const javascript_extractor = (
|
|
77120
|
+
const graphql_extractor = (config3, filepath, content) => [content];
|
|
77121
|
+
const javascript_extractor = (fconfig, ilepath, content) => processJSFile(config2, content);
|
|
76718
77122
|
extractors[".ts"].push(javascript_extractor);
|
|
76719
77123
|
extractors[".js"].push(javascript_extractor);
|
|
76720
77124
|
extractors[".graphql"].push(graphql_extractor);
|
|
@@ -76738,7 +77142,7 @@ async function collectDocuments(config2) {
|
|
|
76738
77142
|
if (!extractor) {
|
|
76739
77143
|
continue;
|
|
76740
77144
|
}
|
|
76741
|
-
const found = await extractor(filepath, contents);
|
|
77145
|
+
const found = await extractor(config2, filepath, contents);
|
|
76742
77146
|
if (found.length > 0) {
|
|
76743
77147
|
documents.push(...found.map((document) => ({ filepath, document })));
|
|
76744
77148
|
}
|
|
@@ -76769,12 +77173,12 @@ async function processJSFile(config2, contents) {
|
|
|
76769
77173
|
return documents;
|
|
76770
77174
|
}
|
|
76771
77175
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
76772
|
-
const parsedDoc =
|
|
77176
|
+
const parsedDoc = graphql29.parse(document);
|
|
76773
77177
|
const operations = parsedDoc.definitions.filter(
|
|
76774
|
-
({ kind: kind2 }) => kind2 ===
|
|
77178
|
+
({ kind: kind2 }) => kind2 === graphql29.Kind.OPERATION_DEFINITION
|
|
76775
77179
|
);
|
|
76776
77180
|
const fragments = parsedDoc.definitions.filter(
|
|
76777
|
-
({ kind: kind2 }) => kind2 ===
|
|
77181
|
+
({ kind: kind2 }) => kind2 === graphql29.Kind.FRAGMENT_DEFINITION
|
|
76778
77182
|
);
|
|
76779
77183
|
if (operations.length > 1) {
|
|
76780
77184
|
throw new HoudiniError({
|
|
@@ -76854,7 +77258,8 @@ function logStyled(kind, stat3, logLevel, plugin) {
|
|
|
76854
77258
|
// src/cmd/pullSchema.ts
|
|
76855
77259
|
async function pullSchema_default(args) {
|
|
76856
77260
|
const config2 = await getConfig({ noSchema: true });
|
|
76857
|
-
|
|
77261
|
+
const apiURL = await config2.apiURL();
|
|
77262
|
+
if (!apiURL) {
|
|
76858
77263
|
console.log(
|
|
76859
77264
|
"\u274C Your project does not have a remote endpoint configured. Please provide one with the `apiUrl` value in your houdini.config.js file."
|
|
76860
77265
|
);
|
|
@@ -76862,7 +77267,7 @@ async function pullSchema_default(args) {
|
|
|
76862
77267
|
return;
|
|
76863
77268
|
}
|
|
76864
77269
|
const targetPath = process.cwd();
|
|
76865
|
-
let headers = config2.pullHeaders;
|
|
77270
|
+
let headers = await config2.pullHeaders();
|
|
76866
77271
|
let headerStrings = [];
|
|
76867
77272
|
if (args.headers) {
|
|
76868
77273
|
headerStrings = args.headers;
|
|
@@ -76877,7 +77282,7 @@ async function pullSchema_default(args) {
|
|
|
76877
77282
|
}, headers);
|
|
76878
77283
|
}
|
|
76879
77284
|
await pullSchema(
|
|
76880
|
-
|
|
77285
|
+
apiURL,
|
|
76881
77286
|
config2.schemaPath ? config2.schemaPath : path_exports.resolve(targetPath, "schema.json"),
|
|
76882
77287
|
headers
|
|
76883
77288
|
);
|
|
@@ -76899,7 +77304,7 @@ async function generate(args = {
|
|
|
76899
77304
|
if (args.output) {
|
|
76900
77305
|
config2.persistedQueryPath = args.output;
|
|
76901
77306
|
}
|
|
76902
|
-
if (args.pullSchema && config2.
|
|
77307
|
+
if (args.pullSchema && await config2.apiURL()) {
|
|
76903
77308
|
if (args.pullHeader) {
|
|
76904
77309
|
console.log("\u26A0\uFE0F --pull-headers has been replaced by --headers (abbreviated -h)");
|
|
76905
77310
|
args.headers = args.pullHeader;
|
|
@@ -77075,7 +77480,7 @@ async function init(_path, args) {
|
|
|
77075
77480
|
await graphqlRCFile(targetPath);
|
|
77076
77481
|
await gitIgnore(targetPath);
|
|
77077
77482
|
if (framework === "kit") {
|
|
77078
|
-
await updateSvelteConfig(targetPath);
|
|
77483
|
+
await updateSvelteConfig(targetPath, typescript);
|
|
77079
77484
|
} else if (framework === "svelte") {
|
|
77080
77485
|
await updateSvelteMainJs(targetPath);
|
|
77081
77486
|
}
|
|
@@ -77098,14 +77503,15 @@ async function init(_path, args) {
|
|
|
77098
77503
|
2\uFE0F\u20E3 Start your application: ${logGreen(cmd_run)}
|
|
77099
77504
|
`);
|
|
77100
77505
|
}
|
|
77101
|
-
var networkFile = (url, typescript) => `import { HoudiniClient${typescript ? ", type
|
|
77506
|
+
var networkFile = (url, typescript) => `import { HoudiniClient${typescript ? ", type RequestHandler" : ""} } from '$houdini';
|
|
77102
77507
|
|
|
77103
|
-
|
|
77508
|
+
${typescript ? `const requestHandler: RequestHandler` : `/** @type {import('$houdini').RequestHandler<any>} */
|
|
77509
|
+
const requestHandler`} = async ({
|
|
77104
77510
|
fetch,
|
|
77105
77511
|
text = '',
|
|
77106
77512
|
variables = {},
|
|
77107
77513
|
metadata
|
|
77108
|
-
}
|
|
77514
|
+
}) => {
|
|
77109
77515
|
const url = '${url}';
|
|
77110
77516
|
const result = await fetch(url, {
|
|
77111
77517
|
method: 'POST',
|
|
@@ -77120,7 +77526,7 @@ async function fetchQuery({
|
|
|
77120
77526
|
return await result.json();
|
|
77121
77527
|
}
|
|
77122
77528
|
|
|
77123
|
-
export default new HoudiniClient(
|
|
77529
|
+
export default new HoudiniClient(requestHandler);
|
|
77124
77530
|
`;
|
|
77125
77531
|
var writeConfigFile = async ({
|
|
77126
77532
|
configPath,
|
|
@@ -77258,16 +77664,16 @@ export default config;
|
|
|
77258
77664
|
});
|
|
77259
77665
|
}
|
|
77260
77666
|
}
|
|
77261
|
-
async function updateSvelteConfig(targetPath) {
|
|
77667
|
+
async function updateSvelteConfig(targetPath, typescript) {
|
|
77262
77668
|
const svelteConfigPath = path_exports.join(targetPath, "svelte.config.js");
|
|
77263
|
-
const
|
|
77264
|
-
import
|
|
77669
|
+
const newContentTs = `import adapter from '@sveltejs/adapter-auto';
|
|
77670
|
+
import { vitePreprocess } from '@sveltejs/kit/vite';
|
|
77265
77671
|
|
|
77266
77672
|
/** @type {import('@sveltejs/kit').Config} */
|
|
77267
77673
|
const config = {
|
|
77268
|
-
// Consult https://
|
|
77674
|
+
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
|
77269
77675
|
// for more information about preprocessors
|
|
77270
|
-
preprocess:
|
|
77676
|
+
preprocess: vitePreprocess(),
|
|
77271
77677
|
|
|
77272
77678
|
kit: {
|
|
77273
77679
|
adapter: adapter(),
|
|
@@ -77277,11 +77683,25 @@ const config = {
|
|
|
77277
77683
|
}
|
|
77278
77684
|
};
|
|
77279
77685
|
|
|
77686
|
+
export default config;
|
|
77687
|
+
`;
|
|
77688
|
+
const newContentJs = `import adapter from '@sveltejs/adapter-auto';
|
|
77689
|
+
|
|
77690
|
+
/** @type {import('@sveltejs/kit').Config} */
|
|
77691
|
+
const config = {
|
|
77692
|
+
kit: {
|
|
77693
|
+
adapter: adapter(),
|
|
77694
|
+
alias: {
|
|
77695
|
+
$houdini: './$houdini',
|
|
77696
|
+
}
|
|
77697
|
+
}
|
|
77698
|
+
};
|
|
77699
|
+
|
|
77280
77700
|
export default config;
|
|
77281
77701
|
`;
|
|
77282
77702
|
await updateFile({
|
|
77283
77703
|
filepath: svelteConfigPath,
|
|
77284
|
-
content:
|
|
77704
|
+
content: typescript ? newContentTs : newContentJs
|
|
77285
77705
|
});
|
|
77286
77706
|
}
|
|
77287
77707
|
async function updateSvelteMainJs(targetPath) {
|
|
@@ -77313,8 +77733,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
77313
77733
|
}
|
|
77314
77734
|
packageJSON.devDependencies = {
|
|
77315
77735
|
...packageJSON.devDependencies,
|
|
77316
|
-
houdini: "^0.
|
|
77317
|
-
"houdini-svelte": "^0.
|
|
77736
|
+
houdini: "^0.19.0",
|
|
77737
|
+
"houdini-svelte": "^0.19.0",
|
|
77318
77738
|
graphql: "^15.8.0"
|
|
77319
77739
|
};
|
|
77320
77740
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|