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-esm/index.js
CHANGED
|
@@ -2288,7 +2288,7 @@ var require_kinds = __commonJS({
|
|
|
2288
2288
|
value: true
|
|
2289
2289
|
});
|
|
2290
2290
|
exports.Kind = void 0;
|
|
2291
|
-
var
|
|
2291
|
+
var Kind30 = Object.freeze({
|
|
2292
2292
|
NAME: "Name",
|
|
2293
2293
|
DOCUMENT: "Document",
|
|
2294
2294
|
OPERATION_DEFINITION: "OperationDefinition",
|
|
@@ -2333,7 +2333,7 @@ var require_kinds = __commonJS({
|
|
|
2333
2333
|
ENUM_TYPE_EXTENSION: "EnumTypeExtension",
|
|
2334
2334
|
INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension"
|
|
2335
2335
|
});
|
|
2336
|
-
exports.Kind =
|
|
2336
|
+
exports.Kind = Kind30;
|
|
2337
2337
|
}
|
|
2338
2338
|
});
|
|
2339
2339
|
|
|
@@ -3731,12 +3731,12 @@ var require_parser = __commonJS({
|
|
|
3731
3731
|
return [];
|
|
3732
3732
|
}
|
|
3733
3733
|
if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) {
|
|
3734
|
-
var
|
|
3734
|
+
var types16 = [];
|
|
3735
3735
|
this.expectOptionalToken(_tokenKind.TokenKind.AMP);
|
|
3736
3736
|
do {
|
|
3737
|
-
|
|
3737
|
+
types16.push(this.parseNamedType());
|
|
3738
3738
|
} while (this.expectOptionalToken(_tokenKind.TokenKind.AMP) || this.peek(_tokenKind.TokenKind.NAME));
|
|
3739
|
-
return
|
|
3739
|
+
return types16;
|
|
3740
3740
|
}
|
|
3741
3741
|
return this.delimitedMany(_tokenKind.TokenKind.AMP, this.parseNamedType);
|
|
3742
3742
|
};
|
|
@@ -3815,13 +3815,13 @@ var require_parser = __commonJS({
|
|
|
3815
3815
|
this.expectKeyword("union");
|
|
3816
3816
|
var name2 = this.parseName();
|
|
3817
3817
|
var directives = this.parseDirectives(true);
|
|
3818
|
-
var
|
|
3818
|
+
var types16 = this.parseUnionMemberTypes();
|
|
3819
3819
|
return {
|
|
3820
3820
|
kind: _kinds.Kind.UNION_TYPE_DEFINITION,
|
|
3821
3821
|
description,
|
|
3822
3822
|
name: name2,
|
|
3823
3823
|
directives,
|
|
3824
|
-
types:
|
|
3824
|
+
types: types16,
|
|
3825
3825
|
loc: this.loc(start)
|
|
3826
3826
|
};
|
|
3827
3827
|
};
|
|
@@ -3979,15 +3979,15 @@ var require_parser = __commonJS({
|
|
|
3979
3979
|
this.expectKeyword("union");
|
|
3980
3980
|
var name2 = this.parseName();
|
|
3981
3981
|
var directives = this.parseDirectives(true);
|
|
3982
|
-
var
|
|
3983
|
-
if (directives.length === 0 &&
|
|
3982
|
+
var types16 = this.parseUnionMemberTypes();
|
|
3983
|
+
if (directives.length === 0 && types16.length === 0) {
|
|
3984
3984
|
throw this.unexpected();
|
|
3985
3985
|
}
|
|
3986
3986
|
return {
|
|
3987
3987
|
kind: _kinds.Kind.UNION_TYPE_EXTENSION,
|
|
3988
3988
|
name: name2,
|
|
3989
3989
|
directives,
|
|
3990
|
-
types:
|
|
3990
|
+
types: types16,
|
|
3991
3991
|
loc: this.loc(start)
|
|
3992
3992
|
};
|
|
3993
3993
|
};
|
|
@@ -4157,7 +4157,7 @@ var require_visitor = __commonJS({
|
|
|
4157
4157
|
Object.defineProperty(exports, "__esModule", {
|
|
4158
4158
|
value: true
|
|
4159
4159
|
});
|
|
4160
|
-
exports.visit =
|
|
4160
|
+
exports.visit = visit13;
|
|
4161
4161
|
exports.visitInParallel = visitInParallel;
|
|
4162
4162
|
exports.getVisitFn = getVisitFn;
|
|
4163
4163
|
exports.BREAK = exports.QueryDocumentKeys = void 0;
|
|
@@ -4220,7 +4220,7 @@ var require_visitor = __commonJS({
|
|
|
4220
4220
|
exports.QueryDocumentKeys = QueryDocumentKeys;
|
|
4221
4221
|
var BREAK = Object.freeze({});
|
|
4222
4222
|
exports.BREAK = BREAK;
|
|
4223
|
-
function
|
|
4223
|
+
function visit13(root, visitor) {
|
|
4224
4224
|
var visitorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : QueryDocumentKeys;
|
|
4225
4225
|
var stack = void 0;
|
|
4226
4226
|
var inArray = Array.isArray(root);
|
|
@@ -4965,8 +4965,8 @@ var require_printer = __commonJS({
|
|
|
4965
4965
|
return join3(["interface", name2, wrap2("implements ", join3(interfaces, " & ")), join3(directives, " "), block2(fields)], " ");
|
|
4966
4966
|
}),
|
|
4967
4967
|
UnionTypeDefinition: addDescription2(function(_ref27) {
|
|
4968
|
-
var name2 = _ref27.name, directives = _ref27.directives,
|
|
4969
|
-
return join3(["union", name2, join3(directives, " "),
|
|
4968
|
+
var name2 = _ref27.name, directives = _ref27.directives, types16 = _ref27.types;
|
|
4969
|
+
return join3(["union", name2, join3(directives, " "), types16 && types16.length !== 0 ? "= " + join3(types16, " | ") : ""], " ");
|
|
4970
4970
|
}),
|
|
4971
4971
|
EnumTypeDefinition: addDescription2(function(_ref28) {
|
|
4972
4972
|
var name2 = _ref28.name, directives = _ref28.directives, values = _ref28.values;
|
|
@@ -5001,8 +5001,8 @@ var require_printer = __commonJS({
|
|
|
5001
5001
|
return join3(["extend interface", name2, wrap2("implements ", join3(interfaces, " & ")), join3(directives, " "), block2(fields)], " ");
|
|
5002
5002
|
},
|
|
5003
5003
|
UnionTypeExtension: function UnionTypeExtension(_ref36) {
|
|
5004
|
-
var name2 = _ref36.name, directives = _ref36.directives,
|
|
5005
|
-
return join3(["extend union", name2, join3(directives, " "),
|
|
5004
|
+
var name2 = _ref36.name, directives = _ref36.directives, types16 = _ref36.types;
|
|
5005
|
+
return join3(["extend union", name2, join3(directives, " "), types16 && types16.length !== 0 ? "= " + join3(types16, " | ") : ""], " ");
|
|
5006
5006
|
},
|
|
5007
5007
|
EnumTypeExtension: function EnumTypeExtension(_ref37) {
|
|
5008
5008
|
var name2 = _ref37.name, directives = _ref37.directives, values = _ref37.values;
|
|
@@ -5098,17 +5098,17 @@ var require_definition = __commonJS({
|
|
|
5098
5098
|
});
|
|
5099
5099
|
exports.isType = isType;
|
|
5100
5100
|
exports.assertType = assertType;
|
|
5101
|
-
exports.isScalarType =
|
|
5101
|
+
exports.isScalarType = isScalarType13;
|
|
5102
5102
|
exports.assertScalarType = assertScalarType;
|
|
5103
|
-
exports.isObjectType =
|
|
5103
|
+
exports.isObjectType = isObjectType12;
|
|
5104
5104
|
exports.assertObjectType = assertObjectType;
|
|
5105
5105
|
exports.isInterfaceType = isInterfaceType12;
|
|
5106
5106
|
exports.assertInterfaceType = assertInterfaceType;
|
|
5107
5107
|
exports.isUnionType = isUnionType13;
|
|
5108
5108
|
exports.assertUnionType = assertUnionType;
|
|
5109
|
-
exports.isEnumType =
|
|
5109
|
+
exports.isEnumType = isEnumType10;
|
|
5110
5110
|
exports.assertEnumType = assertEnumType;
|
|
5111
|
-
exports.isInputObjectType =
|
|
5111
|
+
exports.isInputObjectType = isInputObjectType8;
|
|
5112
5112
|
exports.assertInputObjectType = assertInputObjectType;
|
|
5113
5113
|
exports.isListType = isListType8;
|
|
5114
5114
|
exports.assertListType = assertListType;
|
|
@@ -5122,7 +5122,7 @@ var require_definition = __commonJS({
|
|
|
5122
5122
|
exports.assertLeafType = assertLeafType;
|
|
5123
5123
|
exports.isCompositeType = isCompositeType;
|
|
5124
5124
|
exports.assertCompositeType = assertCompositeType;
|
|
5125
|
-
exports.isAbstractType =
|
|
5125
|
+
exports.isAbstractType = isAbstractType3;
|
|
5126
5126
|
exports.assertAbstractType = assertAbstractType;
|
|
5127
5127
|
exports.GraphQLList = GraphQLList6;
|
|
5128
5128
|
exports.GraphQLNonNull = GraphQLNonNull6;
|
|
@@ -5177,7 +5177,7 @@ var require_definition = __commonJS({
|
|
|
5177
5177
|
return Constructor;
|
|
5178
5178
|
}
|
|
5179
5179
|
function isType(type) {
|
|
5180
|
-
return
|
|
5180
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isInputObjectType8(type) || isListType8(type) || isNonNullType10(type);
|
|
5181
5181
|
}
|
|
5182
5182
|
function assertType(type) {
|
|
5183
5183
|
if (!isType(type)) {
|
|
@@ -5185,20 +5185,20 @@ var require_definition = __commonJS({
|
|
|
5185
5185
|
}
|
|
5186
5186
|
return type;
|
|
5187
5187
|
}
|
|
5188
|
-
function
|
|
5188
|
+
function isScalarType13(type) {
|
|
5189
5189
|
return (0, _instanceOf.default)(type, GraphQLScalarType4);
|
|
5190
5190
|
}
|
|
5191
5191
|
function assertScalarType(type) {
|
|
5192
|
-
if (!
|
|
5192
|
+
if (!isScalarType13(type)) {
|
|
5193
5193
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Scalar type."));
|
|
5194
5194
|
}
|
|
5195
5195
|
return type;
|
|
5196
5196
|
}
|
|
5197
|
-
function
|
|
5197
|
+
function isObjectType12(type) {
|
|
5198
5198
|
return (0, _instanceOf.default)(type, GraphQLObjectType6);
|
|
5199
5199
|
}
|
|
5200
5200
|
function assertObjectType(type) {
|
|
5201
|
-
if (!
|
|
5201
|
+
if (!isObjectType12(type)) {
|
|
5202
5202
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Object type."));
|
|
5203
5203
|
}
|
|
5204
5204
|
return type;
|
|
@@ -5221,20 +5221,20 @@ var require_definition = __commonJS({
|
|
|
5221
5221
|
}
|
|
5222
5222
|
return type;
|
|
5223
5223
|
}
|
|
5224
|
-
function
|
|
5224
|
+
function isEnumType10(type) {
|
|
5225
5225
|
return (0, _instanceOf.default)(type, GraphQLEnumType4);
|
|
5226
5226
|
}
|
|
5227
5227
|
function assertEnumType(type) {
|
|
5228
|
-
if (!
|
|
5228
|
+
if (!isEnumType10(type)) {
|
|
5229
5229
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
|
|
5230
5230
|
}
|
|
5231
5231
|
return type;
|
|
5232
5232
|
}
|
|
5233
|
-
function
|
|
5233
|
+
function isInputObjectType8(type) {
|
|
5234
5234
|
return (0, _instanceOf.default)(type, GraphQLInputObjectType4);
|
|
5235
5235
|
}
|
|
5236
5236
|
function assertInputObjectType(type) {
|
|
5237
|
-
if (!
|
|
5237
|
+
if (!isInputObjectType8(type)) {
|
|
5238
5238
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Input Object type."));
|
|
5239
5239
|
}
|
|
5240
5240
|
return type;
|
|
@@ -5258,7 +5258,7 @@ var require_definition = __commonJS({
|
|
|
5258
5258
|
return type;
|
|
5259
5259
|
}
|
|
5260
5260
|
function isInputType(type) {
|
|
5261
|
-
return
|
|
5261
|
+
return isScalarType13(type) || isEnumType10(type) || isInputObjectType8(type) || isWrappingType(type) && isInputType(type.ofType);
|
|
5262
5262
|
}
|
|
5263
5263
|
function assertInputType(type) {
|
|
5264
5264
|
if (!isInputType(type)) {
|
|
@@ -5267,7 +5267,7 @@ var require_definition = __commonJS({
|
|
|
5267
5267
|
return type;
|
|
5268
5268
|
}
|
|
5269
5269
|
function isOutputType(type) {
|
|
5270
|
-
return
|
|
5270
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
5271
5271
|
}
|
|
5272
5272
|
function assertOutputType(type) {
|
|
5273
5273
|
if (!isOutputType(type)) {
|
|
@@ -5276,7 +5276,7 @@ var require_definition = __commonJS({
|
|
|
5276
5276
|
return type;
|
|
5277
5277
|
}
|
|
5278
5278
|
function isLeafType4(type) {
|
|
5279
|
-
return
|
|
5279
|
+
return isScalarType13(type) || isEnumType10(type);
|
|
5280
5280
|
}
|
|
5281
5281
|
function assertLeafType(type) {
|
|
5282
5282
|
if (!isLeafType4(type)) {
|
|
@@ -5285,7 +5285,7 @@ var require_definition = __commonJS({
|
|
|
5285
5285
|
return type;
|
|
5286
5286
|
}
|
|
5287
5287
|
function isCompositeType(type) {
|
|
5288
|
-
return
|
|
5288
|
+
return isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type);
|
|
5289
5289
|
}
|
|
5290
5290
|
function assertCompositeType(type) {
|
|
5291
5291
|
if (!isCompositeType(type)) {
|
|
@@ -5293,11 +5293,11 @@ var require_definition = __commonJS({
|
|
|
5293
5293
|
}
|
|
5294
5294
|
return type;
|
|
5295
5295
|
}
|
|
5296
|
-
function
|
|
5296
|
+
function isAbstractType3(type) {
|
|
5297
5297
|
return isInterfaceType12(type) || isUnionType13(type);
|
|
5298
5298
|
}
|
|
5299
5299
|
function assertAbstractType(type) {
|
|
5300
|
-
if (!
|
|
5300
|
+
if (!isAbstractType3(type)) {
|
|
5301
5301
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL abstract type."));
|
|
5302
5302
|
}
|
|
5303
5303
|
return type;
|
|
@@ -5364,7 +5364,7 @@ var require_definition = __commonJS({
|
|
|
5364
5364
|
}
|
|
5365
5365
|
}
|
|
5366
5366
|
function isNamedType4(type) {
|
|
5367
|
-
return
|
|
5367
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isInputObjectType8(type);
|
|
5368
5368
|
}
|
|
5369
5369
|
function assertNamedType(type) {
|
|
5370
5370
|
if (!isNamedType4(type)) {
|
|
@@ -5673,9 +5673,9 @@ var require_definition = __commonJS({
|
|
|
5673
5673
|
exports.GraphQLUnionType = GraphQLUnionType3;
|
|
5674
5674
|
(0, _defineInspect.default)(GraphQLUnionType3);
|
|
5675
5675
|
function defineTypes(config2) {
|
|
5676
|
-
var
|
|
5677
|
-
Array.isArray(
|
|
5678
|
-
return
|
|
5676
|
+
var types16 = resolveThunk(config2.types);
|
|
5677
|
+
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, "."));
|
|
5678
|
+
return types16;
|
|
5679
5679
|
}
|
|
5680
5680
|
var GraphQLEnumType4 = /* @__PURE__ */ function() {
|
|
5681
5681
|
function GraphQLEnumType5(config2) {
|
|
@@ -11513,7 +11513,7 @@ var require_graphql = __commonJS({
|
|
|
11513
11513
|
Object.defineProperty(exports, "__esModule", {
|
|
11514
11514
|
value: true
|
|
11515
11515
|
});
|
|
11516
|
-
exports.graphql =
|
|
11516
|
+
exports.graphql = graphql30;
|
|
11517
11517
|
exports.graphqlSync = graphqlSync;
|
|
11518
11518
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
11519
11519
|
var _parser = require_parser();
|
|
@@ -11523,7 +11523,7 @@ var require_graphql = __commonJS({
|
|
|
11523
11523
|
function _interopRequireDefault(obj) {
|
|
11524
11524
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
11525
11525
|
}
|
|
11526
|
-
function
|
|
11526
|
+
function graphql30(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
11527
11527
|
var _arguments = arguments;
|
|
11528
11528
|
return new Promise(function(resolve2) {
|
|
11529
11529
|
return resolve2(
|
|
@@ -13312,7 +13312,7 @@ var require_buildClientSchema = __commonJS({
|
|
|
13312
13312
|
return new _definition.GraphQLUnionType({
|
|
13313
13313
|
name: unionIntrospection.name,
|
|
13314
13314
|
description: unionIntrospection.description,
|
|
13315
|
-
types: function
|
|
13315
|
+
types: function types16() {
|
|
13316
13316
|
return unionIntrospection.possibleTypes.map(getObjectType);
|
|
13317
13317
|
}
|
|
13318
13318
|
});
|
|
@@ -13657,7 +13657,7 @@ var require_extendSchema = __commonJS({
|
|
|
13657
13657
|
var config2 = type.toConfig();
|
|
13658
13658
|
var extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config2.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : [];
|
|
13659
13659
|
return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, config2), {}, {
|
|
13660
|
-
types: function
|
|
13660
|
+
types: function types16() {
|
|
13661
13661
|
return [].concat(type.getTypes().map(replaceNamedType), buildUnionTypes(extensions));
|
|
13662
13662
|
},
|
|
13663
13663
|
extensionASTNodes: config2.extensionASTNodes.concat(extensions)
|
|
@@ -13805,17 +13805,17 @@ var require_extendSchema = __commonJS({
|
|
|
13805
13805
|
return interfaces;
|
|
13806
13806
|
}
|
|
13807
13807
|
function buildUnionTypes(nodes) {
|
|
13808
|
-
var
|
|
13808
|
+
var types16 = [];
|
|
13809
13809
|
for (var _i32 = 0; _i32 < nodes.length; _i32++) {
|
|
13810
13810
|
var _node$types;
|
|
13811
13811
|
var node = nodes[_i32];
|
|
13812
13812
|
var typeNodes = (_node$types = node.types) !== null && _node$types !== void 0 ? _node$types : [];
|
|
13813
13813
|
for (var _i34 = 0; _i34 < typeNodes.length; _i34++) {
|
|
13814
13814
|
var type = typeNodes[_i34];
|
|
13815
|
-
|
|
13815
|
+
types16.push(getNamedType5(type));
|
|
13816
13816
|
}
|
|
13817
13817
|
}
|
|
13818
|
-
return
|
|
13818
|
+
return types16;
|
|
13819
13819
|
}
|
|
13820
13820
|
function buildType(astNode) {
|
|
13821
13821
|
var _typeExtensionsMap$na;
|
|
@@ -13872,7 +13872,7 @@ var require_extendSchema = __commonJS({
|
|
|
13872
13872
|
return new _definition.GraphQLUnionType({
|
|
13873
13873
|
name: name3,
|
|
13874
13874
|
description,
|
|
13875
|
-
types: function
|
|
13875
|
+
types: function types16() {
|
|
13876
13876
|
return buildUnionTypes(_allNodes3);
|
|
13877
13877
|
},
|
|
13878
13878
|
astNode,
|
|
@@ -14170,7 +14170,7 @@ var require_lexicographicSortSchema = __commonJS({
|
|
|
14170
14170
|
if ((0, _definition.isUnionType)(type)) {
|
|
14171
14171
|
var _config22 = type.toConfig();
|
|
14172
14172
|
return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, _config22), {}, {
|
|
14173
|
-
types: function
|
|
14173
|
+
types: function types16() {
|
|
14174
14174
|
return sortTypes(_config22.types);
|
|
14175
14175
|
}
|
|
14176
14176
|
}));
|
|
@@ -14255,10 +14255,10 @@ var require_printSchema = __commonJS({
|
|
|
14255
14255
|
}
|
|
14256
14256
|
function printFilteredSchema(schema, directiveFilter, typeFilter, options) {
|
|
14257
14257
|
var directives = schema.getDirectives().filter(directiveFilter);
|
|
14258
|
-
var
|
|
14258
|
+
var types16 = (0, _objectValues.default)(schema.getTypeMap()).filter(typeFilter);
|
|
14259
14259
|
return [printSchemaDefinition(schema)].concat(directives.map(function(directive) {
|
|
14260
14260
|
return printDirective(directive, options);
|
|
14261
|
-
}),
|
|
14261
|
+
}), types16.map(function(type) {
|
|
14262
14262
|
return printType(type, options);
|
|
14263
14263
|
})).filter(Boolean).join("\n\n") + "\n";
|
|
14264
14264
|
}
|
|
@@ -14333,8 +14333,8 @@ var require_printSchema = __commonJS({
|
|
|
14333
14333
|
return printDescription(options, type) + "interface ".concat(type.name) + printImplementedInterfaces(type) + printFields(options, type);
|
|
14334
14334
|
}
|
|
14335
14335
|
function printUnion(type, options) {
|
|
14336
|
-
var
|
|
14337
|
-
var possibleTypes =
|
|
14336
|
+
var types16 = type.getTypes();
|
|
14337
|
+
var possibleTypes = types16.length ? " = " + types16.join(" | ") : "";
|
|
14338
14338
|
return printDescription(options, type) + "union " + type.name + possibleTypes;
|
|
14339
14339
|
}
|
|
14340
14340
|
function printEnum(type, options) {
|
|
@@ -30011,14 +30011,14 @@ var require_lib3 = __commonJS({
|
|
|
30011
30011
|
this.preserveSpace = !!preserveSpace;
|
|
30012
30012
|
}
|
|
30013
30013
|
};
|
|
30014
|
-
var
|
|
30014
|
+
var types16 = {
|
|
30015
30015
|
brace: new TokContext("{"),
|
|
30016
30016
|
j_oTag: new TokContext("<tag"),
|
|
30017
30017
|
j_cTag: new TokContext("</tag"),
|
|
30018
30018
|
j_expr: new TokContext("<tag>...</tag>", true)
|
|
30019
30019
|
};
|
|
30020
30020
|
{
|
|
30021
|
-
|
|
30021
|
+
types16.template = new TokContext("`", true);
|
|
30022
30022
|
}
|
|
30023
30023
|
var beforeExpr = true;
|
|
30024
30024
|
var startsExpr = true;
|
|
@@ -30550,17 +30550,17 @@ var require_lib3 = __commonJS({
|
|
|
30550
30550
|
context.pop();
|
|
30551
30551
|
};
|
|
30552
30552
|
tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = (context) => {
|
|
30553
|
-
context.push(
|
|
30553
|
+
context.push(types16.brace);
|
|
30554
30554
|
};
|
|
30555
30555
|
tokenTypes[22].updateContext = (context) => {
|
|
30556
|
-
if (context[context.length - 1] ===
|
|
30556
|
+
if (context[context.length - 1] === types16.template) {
|
|
30557
30557
|
context.pop();
|
|
30558
30558
|
} else {
|
|
30559
|
-
context.push(
|
|
30559
|
+
context.push(types16.template);
|
|
30560
30560
|
}
|
|
30561
30561
|
};
|
|
30562
30562
|
tokenTypes[140].updateContext = (context) => {
|
|
30563
|
-
context.push(
|
|
30563
|
+
context.push(types16.j_expr, types16.j_oTag);
|
|
30564
30564
|
};
|
|
30565
30565
|
}
|
|
30566
30566
|
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";
|
|
@@ -31201,7 +31201,7 @@ var require_lib3 = __commonJS({
|
|
|
31201
31201
|
this.lastTokEndLoc = null;
|
|
31202
31202
|
this.lastTokStartLoc = null;
|
|
31203
31203
|
this.lastTokStart = 0;
|
|
31204
|
-
this.context = [
|
|
31204
|
+
this.context = [types16.brace];
|
|
31205
31205
|
this.canStartJSXElement = true;
|
|
31206
31206
|
this.containsEsc = false;
|
|
31207
31207
|
this.firstInvalidTemplateEscapePos = null;
|
|
@@ -35125,7 +35125,7 @@ var require_lib3 = __commonJS({
|
|
|
35125
35125
|
context
|
|
35126
35126
|
} = this.state;
|
|
35127
35127
|
const currentContext = context[context.length - 1];
|
|
35128
|
-
if (currentContext ===
|
|
35128
|
+
if (currentContext === types16.j_oTag || currentContext === types16.j_expr) {
|
|
35129
35129
|
context.pop();
|
|
35130
35130
|
}
|
|
35131
35131
|
}
|
|
@@ -36185,9 +36185,9 @@ var require_lib3 = __commonJS({
|
|
|
36185
36185
|
switch (this.state.type) {
|
|
36186
36186
|
case 5:
|
|
36187
36187
|
node = this.startNode();
|
|
36188
|
-
this.setContext(
|
|
36188
|
+
this.setContext(types16.brace);
|
|
36189
36189
|
this.next();
|
|
36190
|
-
node = this.jsxParseExpressionContainer(node,
|
|
36190
|
+
node = this.jsxParseExpressionContainer(node, types16.j_oTag);
|
|
36191
36191
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
36192
36192
|
this.raise(JsxErrors.AttributeIsEmpty, {
|
|
36193
36193
|
at: node
|
|
@@ -36210,7 +36210,7 @@ var require_lib3 = __commonJS({
|
|
|
36210
36210
|
jsxParseSpreadChild(node) {
|
|
36211
36211
|
this.next();
|
|
36212
36212
|
node.expression = this.parseExpression();
|
|
36213
|
-
this.setContext(
|
|
36213
|
+
this.setContext(types16.j_expr);
|
|
36214
36214
|
this.state.canStartJSXElement = true;
|
|
36215
36215
|
this.expect(8);
|
|
36216
36216
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -36230,11 +36230,11 @@ var require_lib3 = __commonJS({
|
|
|
36230
36230
|
jsxParseAttribute() {
|
|
36231
36231
|
const node = this.startNode();
|
|
36232
36232
|
if (this.match(5)) {
|
|
36233
|
-
this.setContext(
|
|
36233
|
+
this.setContext(types16.brace);
|
|
36234
36234
|
this.next();
|
|
36235
36235
|
this.expect(21);
|
|
36236
36236
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
36237
|
-
this.setContext(
|
|
36237
|
+
this.setContext(types16.j_oTag);
|
|
36238
36238
|
this.state.canStartJSXElement = true;
|
|
36239
36239
|
this.expect(8);
|
|
36240
36240
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
@@ -36293,12 +36293,12 @@ var require_lib3 = __commonJS({
|
|
|
36293
36293
|
break;
|
|
36294
36294
|
case 5: {
|
|
36295
36295
|
const node2 = this.startNode();
|
|
36296
|
-
this.setContext(
|
|
36296
|
+
this.setContext(types16.brace);
|
|
36297
36297
|
this.next();
|
|
36298
36298
|
if (this.match(21)) {
|
|
36299
36299
|
children.push(this.jsxParseSpreadChild(node2));
|
|
36300
36300
|
} else {
|
|
36301
|
-
children.push(this.jsxParseExpressionContainer(node2,
|
|
36301
|
+
children.push(this.jsxParseExpressionContainer(node2, types16.j_expr));
|
|
36302
36302
|
}
|
|
36303
36303
|
break;
|
|
36304
36304
|
}
|
|
@@ -36369,10 +36369,10 @@ var require_lib3 = __commonJS({
|
|
|
36369
36369
|
}
|
|
36370
36370
|
getTokenFromCode(code) {
|
|
36371
36371
|
const context = this.curContext();
|
|
36372
|
-
if (context ===
|
|
36372
|
+
if (context === types16.j_expr) {
|
|
36373
36373
|
return this.jsxReadToken();
|
|
36374
36374
|
}
|
|
36375
|
-
if (context ===
|
|
36375
|
+
if (context === types16.j_oTag || context === types16.j_cTag) {
|
|
36376
36376
|
if (isIdentifierStart(code)) {
|
|
36377
36377
|
return this.jsxReadWord();
|
|
36378
36378
|
}
|
|
@@ -36380,7 +36380,7 @@ var require_lib3 = __commonJS({
|
|
|
36380
36380
|
++this.state.pos;
|
|
36381
36381
|
return this.finishToken(141);
|
|
36382
36382
|
}
|
|
36383
|
-
if ((code === 34 || code === 39) && context ===
|
|
36383
|
+
if ((code === 34 || code === 39) && context === types16.j_oTag) {
|
|
36384
36384
|
return this.jsxReadString(code);
|
|
36385
36385
|
}
|
|
36386
36386
|
}
|
|
@@ -36396,17 +36396,17 @@ var require_lib3 = __commonJS({
|
|
|
36396
36396
|
type
|
|
36397
36397
|
} = this.state;
|
|
36398
36398
|
if (type === 56 && prevType === 140) {
|
|
36399
|
-
context.splice(-2, 2,
|
|
36399
|
+
context.splice(-2, 2, types16.j_cTag);
|
|
36400
36400
|
this.state.canStartJSXElement = false;
|
|
36401
36401
|
} else if (type === 140) {
|
|
36402
|
-
context.push(
|
|
36402
|
+
context.push(types16.j_oTag);
|
|
36403
36403
|
} else if (type === 141) {
|
|
36404
36404
|
const out = context[context.length - 1];
|
|
36405
|
-
if (out ===
|
|
36405
|
+
if (out === types16.j_oTag && prevType === 56 || out === types16.j_cTag) {
|
|
36406
36406
|
context.pop();
|
|
36407
|
-
this.state.canStartJSXElement = context[context.length - 1] ===
|
|
36407
|
+
this.state.canStartJSXElement = context[context.length - 1] === types16.j_expr;
|
|
36408
36408
|
} else {
|
|
36409
|
-
this.setContext(
|
|
36409
|
+
this.setContext(types16.j_expr);
|
|
36410
36410
|
this.state.canStartJSXElement = true;
|
|
36411
36411
|
}
|
|
36412
36412
|
} else {
|
|
@@ -37413,14 +37413,14 @@ var require_lib3 = __commonJS({
|
|
|
37413
37413
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
37414
37414
|
const node = this.startNode();
|
|
37415
37415
|
const hasLeadingOperator = this.eat(operator);
|
|
37416
|
-
const
|
|
37416
|
+
const types17 = [];
|
|
37417
37417
|
do {
|
|
37418
|
-
|
|
37418
|
+
types17.push(parseConstituentType());
|
|
37419
37419
|
} while (this.eat(operator));
|
|
37420
|
-
if (
|
|
37421
|
-
return
|
|
37420
|
+
if (types17.length === 1 && !hasLeadingOperator) {
|
|
37421
|
+
return types17[0];
|
|
37422
37422
|
}
|
|
37423
|
-
node.types =
|
|
37423
|
+
node.types = types17;
|
|
37424
37424
|
return this.finishNode(node, kind);
|
|
37425
37425
|
}
|
|
37426
37426
|
tsParseIntersectionTypeOrHigher() {
|
|
@@ -38636,7 +38636,7 @@ var require_lib3 = __commonJS({
|
|
|
38636
38636
|
context
|
|
38637
38637
|
} = this.state;
|
|
38638
38638
|
const currentContext = context[context.length - 1];
|
|
38639
|
-
if (currentContext ===
|
|
38639
|
+
if (currentContext === types16.j_oTag || currentContext === types16.j_expr) {
|
|
38640
38640
|
context.pop();
|
|
38641
38641
|
}
|
|
38642
38642
|
}
|
|
@@ -44208,9 +44208,9 @@ var require_shared = __commonJS({
|
|
|
44208
44208
|
var tslib_1 = require_tslib();
|
|
44209
44209
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
44210
44210
|
function default_1(fork) {
|
|
44211
|
-
var
|
|
44212
|
-
var Type =
|
|
44213
|
-
var builtin =
|
|
44211
|
+
var types16 = fork.use(types_1.default);
|
|
44212
|
+
var Type = types16.Type;
|
|
44213
|
+
var builtin = types16.builtInTypes;
|
|
44214
44214
|
var isNumber = builtin.number;
|
|
44215
44215
|
function geq(than) {
|
|
44216
44216
|
return Type.from(function(value) {
|
|
@@ -44360,9 +44360,9 @@ var require_types = __commonJS({
|
|
|
44360
44360
|
}(BaseType);
|
|
44361
44361
|
var OrType = function(_super) {
|
|
44362
44362
|
tslib_1.__extends(OrType2, _super);
|
|
44363
|
-
function OrType2(
|
|
44363
|
+
function OrType2(types16) {
|
|
44364
44364
|
var _this = _super.call(this) || this;
|
|
44365
|
-
_this.types =
|
|
44365
|
+
_this.types = types16;
|
|
44366
44366
|
_this.kind = "OrType";
|
|
44367
44367
|
return _this;
|
|
44368
44368
|
}
|
|
@@ -44503,11 +44503,11 @@ var require_types = __commonJS({
|
|
|
44503
44503
|
function typesPlugin(_fork) {
|
|
44504
44504
|
var Type = {
|
|
44505
44505
|
or: function() {
|
|
44506
|
-
var
|
|
44506
|
+
var types16 = [];
|
|
44507
44507
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
44508
|
-
|
|
44508
|
+
types16[_i] = arguments[_i];
|
|
44509
44509
|
}
|
|
44510
|
-
return new OrType(
|
|
44510
|
+
return new OrType(types16.map(function(type) {
|
|
44511
44511
|
return Type.from(type);
|
|
44512
44512
|
}));
|
|
44513
44513
|
},
|
|
@@ -44952,9 +44952,9 @@ var require_path2 = __commonJS({
|
|
|
44952
44952
|
var Op = Object.prototype;
|
|
44953
44953
|
var hasOwn = Op.hasOwnProperty;
|
|
44954
44954
|
function pathPlugin(fork) {
|
|
44955
|
-
var
|
|
44956
|
-
var isArray =
|
|
44957
|
-
var isNumber =
|
|
44955
|
+
var types16 = fork.use(types_1.default);
|
|
44956
|
+
var isArray = types16.builtInTypes.array;
|
|
44957
|
+
var isNumber = types16.builtInTypes.number;
|
|
44958
44958
|
var Path = function Path2(value, parentPath, name2) {
|
|
44959
44959
|
if (!(this instanceof Path2)) {
|
|
44960
44960
|
throw new Error("Path constructor cannot be invoked without 'new'");
|
|
@@ -45256,13 +45256,13 @@ var require_scope = __commonJS({
|
|
|
45256
45256
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
45257
45257
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
45258
45258
|
function scopePlugin(fork) {
|
|
45259
|
-
var
|
|
45260
|
-
var Type =
|
|
45261
|
-
var namedTypes =
|
|
45259
|
+
var types16 = fork.use(types_1.default);
|
|
45260
|
+
var Type = types16.Type;
|
|
45261
|
+
var namedTypes = types16.namedTypes;
|
|
45262
45262
|
var Node = namedTypes.Node;
|
|
45263
45263
|
var Expression = namedTypes.Expression;
|
|
45264
|
-
var isArray =
|
|
45265
|
-
var b =
|
|
45264
|
+
var isArray = types16.builtInTypes.array;
|
|
45265
|
+
var b = types16.builders;
|
|
45266
45266
|
var Scope = function Scope2(path2, parentScope) {
|
|
45267
45267
|
if (!(this instanceof Scope2)) {
|
|
45268
45268
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
@@ -45325,7 +45325,7 @@ var require_scope = __commonJS({
|
|
|
45325
45325
|
++index;
|
|
45326
45326
|
}
|
|
45327
45327
|
var name2 = prefix + index;
|
|
45328
|
-
return this.bindings[name2] =
|
|
45328
|
+
return this.bindings[name2] = types16.builders.identifier(name2);
|
|
45329
45329
|
};
|
|
45330
45330
|
Sp.injectTemporary = function(identifier, init2) {
|
|
45331
45331
|
identifier || (identifier = this.declareTemporary());
|
|
@@ -45401,7 +45401,7 @@ var require_scope = __commonJS({
|
|
|
45401
45401
|
bindings
|
|
45402
45402
|
);
|
|
45403
45403
|
} else if (Node.check(node) && !Expression.check(node)) {
|
|
45404
|
-
|
|
45404
|
+
types16.eachField(node, function(name2, child) {
|
|
45405
45405
|
var childPath = path2.get(name2);
|
|
45406
45406
|
if (!pathHasValue(childPath, child)) {
|
|
45407
45407
|
throw new Error("");
|
|
@@ -45479,24 +45479,24 @@ var require_scope = __commonJS({
|
|
|
45479
45479
|
addPattern(patternPath.get("argument"), bindings);
|
|
45480
45480
|
}
|
|
45481
45481
|
}
|
|
45482
|
-
function addTypePattern(patternPath,
|
|
45482
|
+
function addTypePattern(patternPath, types17) {
|
|
45483
45483
|
var pattern = patternPath.value;
|
|
45484
45484
|
namedTypes.Pattern.assert(pattern);
|
|
45485
45485
|
if (namedTypes.Identifier.check(pattern)) {
|
|
45486
|
-
if (hasOwn.call(
|
|
45487
|
-
|
|
45486
|
+
if (hasOwn.call(types17, pattern.name)) {
|
|
45487
|
+
types17[pattern.name].push(patternPath);
|
|
45488
45488
|
} else {
|
|
45489
|
-
|
|
45489
|
+
types17[pattern.name] = [patternPath];
|
|
45490
45490
|
}
|
|
45491
45491
|
}
|
|
45492
45492
|
}
|
|
45493
|
-
function addTypeParameter(parameterPath,
|
|
45493
|
+
function addTypeParameter(parameterPath, types17) {
|
|
45494
45494
|
var parameter = parameterPath.value;
|
|
45495
45495
|
FlowOrTSTypeParameterType.assert(parameter);
|
|
45496
|
-
if (hasOwn.call(
|
|
45497
|
-
|
|
45496
|
+
if (hasOwn.call(types17, parameter.name)) {
|
|
45497
|
+
types17[parameter.name].push(parameterPath);
|
|
45498
45498
|
} else {
|
|
45499
|
-
|
|
45499
|
+
types17[parameter.name] = [parameterPath];
|
|
45500
45500
|
}
|
|
45501
45501
|
}
|
|
45502
45502
|
Sp.lookup = function(name2) {
|
|
@@ -45537,11 +45537,11 @@ var require_node_path = __commonJS({
|
|
|
45537
45537
|
var scope_1 = tslib_1.__importDefault(require_scope());
|
|
45538
45538
|
var shared_1 = require_shared();
|
|
45539
45539
|
function nodePathPlugin(fork) {
|
|
45540
|
-
var
|
|
45541
|
-
var n =
|
|
45542
|
-
var b =
|
|
45543
|
-
var isNumber =
|
|
45544
|
-
var isArray =
|
|
45540
|
+
var types16 = fork.use(types_1.default);
|
|
45541
|
+
var n = types16.namedTypes;
|
|
45542
|
+
var b = types16.builders;
|
|
45543
|
+
var isNumber = types16.builtInTypes.number;
|
|
45544
|
+
var isArray = types16.builtInTypes.array;
|
|
45545
45545
|
var Path = fork.use(path_1.default);
|
|
45546
45546
|
var Scope = fork.use(scope_1.default);
|
|
45547
45547
|
var NodePath = function NodePath2(value, parentPath, name2) {
|
|
@@ -45632,7 +45632,7 @@ var require_node_path = __commonJS({
|
|
|
45632
45632
|
return scope || null;
|
|
45633
45633
|
};
|
|
45634
45634
|
NPp.getValueProperty = function(name2) {
|
|
45635
|
-
return
|
|
45635
|
+
return types16.getFieldValue(this.value, name2);
|
|
45636
45636
|
};
|
|
45637
45637
|
NPp.needsParens = function(assumeExpressionContext) {
|
|
45638
45638
|
var pp = this.parentPath;
|
|
@@ -45774,7 +45774,7 @@ var require_node_path = __commonJS({
|
|
|
45774
45774
|
return node.some(containsCallExpression);
|
|
45775
45775
|
}
|
|
45776
45776
|
if (n.Node.check(node)) {
|
|
45777
|
-
return
|
|
45777
|
+
return types16.someField(node, function(_name, child) {
|
|
45778
45778
|
return containsCallExpression(child);
|
|
45779
45779
|
});
|
|
45780
45780
|
}
|
|
@@ -45895,11 +45895,11 @@ var require_path_visitor = __commonJS({
|
|
|
45895
45895
|
var shared_1 = require_shared();
|
|
45896
45896
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
45897
45897
|
function pathVisitorPlugin(fork) {
|
|
45898
|
-
var
|
|
45898
|
+
var types16 = fork.use(types_1.default);
|
|
45899
45899
|
var NodePath = fork.use(node_path_1.default);
|
|
45900
|
-
var isArray =
|
|
45901
|
-
var isObject2 =
|
|
45902
|
-
var isFunction =
|
|
45900
|
+
var isArray = types16.builtInTypes.array;
|
|
45901
|
+
var isObject2 = types16.builtInTypes.object;
|
|
45902
|
+
var isFunction = types16.builtInTypes.function;
|
|
45903
45903
|
var undefined2;
|
|
45904
45904
|
var PathVisitor = function PathVisitor2() {
|
|
45905
45905
|
if (!(this instanceof PathVisitor2)) {
|
|
@@ -45919,7 +45919,7 @@ var require_path_visitor = __commonJS({
|
|
|
45919
45919
|
typeNames[methodName.slice("visit".length)] = true;
|
|
45920
45920
|
}
|
|
45921
45921
|
}
|
|
45922
|
-
var supertypeTable =
|
|
45922
|
+
var supertypeTable = types16.computeSupertypeLookupTable(typeNames);
|
|
45923
45923
|
var methodNameTable = /* @__PURE__ */ Object.create(null);
|
|
45924
45924
|
var typeNameKeys = Object.keys(supertypeTable);
|
|
45925
45925
|
var typeNameCount = typeNameKeys.length;
|
|
@@ -45961,7 +45961,7 @@ var require_path_visitor = __commonJS({
|
|
|
45961
45961
|
}
|
|
45962
45962
|
return target;
|
|
45963
45963
|
}
|
|
45964
|
-
PathVisitor.visit = function
|
|
45964
|
+
PathVisitor.visit = function visit13(node, methods) {
|
|
45965
45965
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
45966
45966
|
};
|
|
45967
45967
|
var PVp = PathVisitor.prototype;
|
|
@@ -46038,7 +46038,7 @@ var require_path_visitor = __commonJS({
|
|
|
46038
46038
|
path2.each(visitor.visitWithoutReset, visitor);
|
|
46039
46039
|
} else if (!isObject2.check(value)) {
|
|
46040
46040
|
} else {
|
|
46041
|
-
var childNames =
|
|
46041
|
+
var childNames = types16.getFieldNames(value);
|
|
46042
46042
|
if (visitor._shouldVisitComments && value.comments && childNames.indexOf("comments") < 0) {
|
|
46043
46043
|
childNames.push("comments");
|
|
46044
46044
|
}
|
|
@@ -46047,7 +46047,7 @@ var require_path_visitor = __commonJS({
|
|
|
46047
46047
|
for (var i2 = 0; i2 < childCount; ++i2) {
|
|
46048
46048
|
var childName = childNames[i2];
|
|
46049
46049
|
if (!hasOwn.call(value, childName)) {
|
|
46050
|
-
value[childName] =
|
|
46050
|
+
value[childName] = types16.getFieldValue(value, childName);
|
|
46051
46051
|
}
|
|
46052
46052
|
childPaths.push(path2.get(childName));
|
|
46053
46053
|
}
|
|
@@ -46152,7 +46152,7 @@ var require_path_visitor = __commonJS({
|
|
|
46152
46152
|
this.needToCallTraverse = false;
|
|
46153
46153
|
return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
46154
46154
|
};
|
|
46155
|
-
sharedContextProtoMethods.visit = function
|
|
46155
|
+
sharedContextProtoMethods.visit = function visit13(path2, newVisitor) {
|
|
46156
46156
|
if (!(this instanceof this.Context)) {
|
|
46157
46157
|
throw new Error("");
|
|
46158
46158
|
}
|
|
@@ -46190,13 +46190,13 @@ var require_equiv = __commonJS({
|
|
|
46190
46190
|
var shared_1 = require_shared();
|
|
46191
46191
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
46192
46192
|
function default_1(fork) {
|
|
46193
|
-
var
|
|
46194
|
-
var getFieldNames =
|
|
46195
|
-
var getFieldValue =
|
|
46196
|
-
var isArray =
|
|
46197
|
-
var isObject2 =
|
|
46198
|
-
var isDate =
|
|
46199
|
-
var isRegExp =
|
|
46193
|
+
var types16 = fork.use(types_1.default);
|
|
46194
|
+
var getFieldNames = types16.getFieldNames;
|
|
46195
|
+
var getFieldValue = types16.getFieldValue;
|
|
46196
|
+
var isArray = types16.builtInTypes.array;
|
|
46197
|
+
var isObject2 = types16.builtInTypes.object;
|
|
46198
|
+
var isDate = types16.builtInTypes.Date;
|
|
46199
|
+
var isRegExp = types16.builtInTypes.RegExp;
|
|
46200
46200
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
46201
46201
|
function astNodesAreEquivalent(a, b, problemPath) {
|
|
46202
46202
|
if (isArray.check(problemPath)) {
|
|
@@ -46349,24 +46349,24 @@ var require_fork = __commonJS({
|
|
|
46349
46349
|
var shared_1 = require_shared();
|
|
46350
46350
|
function default_1(plugins) {
|
|
46351
46351
|
var fork = createFork();
|
|
46352
|
-
var
|
|
46352
|
+
var types16 = fork.use(types_1.default);
|
|
46353
46353
|
plugins.forEach(fork.use);
|
|
46354
|
-
|
|
46354
|
+
types16.finalize();
|
|
46355
46355
|
var PathVisitor = fork.use(path_visitor_1.default);
|
|
46356
46356
|
return {
|
|
46357
|
-
Type:
|
|
46358
|
-
builtInTypes:
|
|
46359
|
-
namedTypes:
|
|
46360
|
-
builders:
|
|
46361
|
-
defineMethod:
|
|
46362
|
-
getFieldNames:
|
|
46363
|
-
getFieldValue:
|
|
46364
|
-
eachField:
|
|
46365
|
-
someField:
|
|
46366
|
-
getSupertypeNames:
|
|
46367
|
-
getBuilderName:
|
|
46357
|
+
Type: types16.Type,
|
|
46358
|
+
builtInTypes: types16.builtInTypes,
|
|
46359
|
+
namedTypes: types16.namedTypes,
|
|
46360
|
+
builders: types16.builders,
|
|
46361
|
+
defineMethod: types16.defineMethod,
|
|
46362
|
+
getFieldNames: types16.getFieldNames,
|
|
46363
|
+
getFieldValue: types16.getFieldValue,
|
|
46364
|
+
eachField: types16.eachField,
|
|
46365
|
+
someField: types16.someField,
|
|
46366
|
+
getSupertypeNames: types16.getSupertypeNames,
|
|
46367
|
+
getBuilderName: types16.getBuilderName,
|
|
46368
46368
|
astNodesAreEquivalent: fork.use(equiv_1.default),
|
|
46369
|
-
finalize:
|
|
46369
|
+
finalize: types16.finalize,
|
|
46370
46370
|
Path: fork.use(path_1.default),
|
|
46371
46371
|
NodePath: fork.use(node_path_1.default),
|
|
46372
46372
|
PathVisitor,
|
|
@@ -46536,8 +46536,8 @@ var require_core2 = __commonJS({
|
|
|
46536
46536
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
46537
46537
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46538
46538
|
function default_1(fork) {
|
|
46539
|
-
var
|
|
46540
|
-
var Type =
|
|
46539
|
+
var types16 = fork.use(types_1.default);
|
|
46540
|
+
var Type = types16.Type;
|
|
46541
46541
|
var def = Type.def;
|
|
46542
46542
|
var or = Type.or;
|
|
46543
46543
|
var shared = fork.use(shared_1.default);
|
|
@@ -46629,9 +46629,9 @@ var require_es6 = __commonJS({
|
|
|
46629
46629
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46630
46630
|
function default_1(fork) {
|
|
46631
46631
|
fork.use(core_1.default);
|
|
46632
|
-
var
|
|
46633
|
-
var def =
|
|
46634
|
-
var or =
|
|
46632
|
+
var types16 = fork.use(types_1.default);
|
|
46633
|
+
var def = types16.Type.def;
|
|
46634
|
+
var or = types16.Type.or;
|
|
46635
46635
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46636
46636
|
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"]);
|
|
46637
46637
|
def("RestElement").bases("Pattern").build("argument").field("argument", def("Pattern")).field(
|
|
@@ -46721,8 +46721,8 @@ var require_es2017 = __commonJS({
|
|
|
46721
46721
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46722
46722
|
function default_1(fork) {
|
|
46723
46723
|
fork.use(es2016_1.default);
|
|
46724
|
-
var
|
|
46725
|
-
var def =
|
|
46724
|
+
var types16 = fork.use(types_1.default);
|
|
46725
|
+
var def = types16.Type.def;
|
|
46726
46726
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46727
46727
|
def("Function").field("async", Boolean, defaults["false"]);
|
|
46728
46728
|
def("AwaitExpression").bases("Expression").build("argument").field("argument", def("Expression"));
|
|
@@ -46745,9 +46745,9 @@ var require_es2018 = __commonJS({
|
|
|
46745
46745
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46746
46746
|
function default_1(fork) {
|
|
46747
46747
|
fork.use(es2017_1.default);
|
|
46748
|
-
var
|
|
46749
|
-
var def =
|
|
46750
|
-
var or =
|
|
46748
|
+
var types16 = fork.use(types_1.default);
|
|
46749
|
+
var def = types16.Type.def;
|
|
46750
|
+
var or = types16.Type.or;
|
|
46751
46751
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46752
46752
|
def("ForOfStatement").field("await", Boolean, defaults["false"]);
|
|
46753
46753
|
def("SpreadProperty").bases("Node").build("argument").field("argument", def("Expression"));
|
|
@@ -46778,9 +46778,9 @@ var require_es2019 = __commonJS({
|
|
|
46778
46778
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46779
46779
|
function default_1(fork) {
|
|
46780
46780
|
fork.use(es2018_1.default);
|
|
46781
|
-
var
|
|
46782
|
-
var def =
|
|
46783
|
-
var or =
|
|
46781
|
+
var types16 = fork.use(types_1.default);
|
|
46782
|
+
var def = types16.Type.def;
|
|
46783
|
+
var or = types16.Type.or;
|
|
46784
46784
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46785
46785
|
def("CatchClause").field("param", or(def("Pattern"), null), defaults["null"]);
|
|
46786
46786
|
}
|
|
@@ -46804,9 +46804,9 @@ var require_es20202 = __commonJS({
|
|
|
46804
46804
|
function default_1(fork) {
|
|
46805
46805
|
fork.use(es2020_1.default);
|
|
46806
46806
|
fork.use(es2019_1.default);
|
|
46807
|
-
var
|
|
46808
|
-
var def =
|
|
46809
|
-
var or =
|
|
46807
|
+
var types16 = fork.use(types_1.default);
|
|
46808
|
+
var def = types16.Type.def;
|
|
46809
|
+
var or = types16.Type.or;
|
|
46810
46810
|
var shared = fork.use(shared_1.default);
|
|
46811
46811
|
var defaults = shared.defaults;
|
|
46812
46812
|
def("ImportExpression").bases("Expression").build("source").field("source", def("Expression"));
|
|
@@ -46856,8 +46856,8 @@ var require_es2022 = __commonJS({
|
|
|
46856
46856
|
var shared_1 = require_shared();
|
|
46857
46857
|
function default_1(fork) {
|
|
46858
46858
|
fork.use(es2021_1.default);
|
|
46859
|
-
var
|
|
46860
|
-
var def =
|
|
46859
|
+
var types16 = fork.use(types_1.default);
|
|
46860
|
+
var def = types16.Type.def;
|
|
46861
46861
|
def("StaticBlock").bases("Declaration").build("body").field("body", [def("Statement")]);
|
|
46862
46862
|
}
|
|
46863
46863
|
exports.default = default_1;
|
|
@@ -46878,9 +46878,9 @@ var require_es_proposals = __commonJS({
|
|
|
46878
46878
|
var es2022_1 = tslib_1.__importDefault(require_es2022());
|
|
46879
46879
|
function default_1(fork) {
|
|
46880
46880
|
fork.use(es2022_1.default);
|
|
46881
|
-
var
|
|
46882
|
-
var Type =
|
|
46883
|
-
var def =
|
|
46881
|
+
var types16 = fork.use(types_1.default);
|
|
46882
|
+
var Type = types16.Type;
|
|
46883
|
+
var def = types16.Type.def;
|
|
46884
46884
|
var or = Type.or;
|
|
46885
46885
|
var shared = fork.use(shared_1.default);
|
|
46886
46886
|
var defaults = shared.defaults;
|
|
@@ -46920,9 +46920,9 @@ var require_jsx = __commonJS({
|
|
|
46920
46920
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46921
46921
|
function default_1(fork) {
|
|
46922
46922
|
fork.use(es_proposals_1.default);
|
|
46923
|
-
var
|
|
46924
|
-
var def =
|
|
46925
|
-
var or =
|
|
46923
|
+
var types16 = fork.use(types_1.default);
|
|
46924
|
+
var def = types16.Type.def;
|
|
46925
|
+
var or = types16.Type.or;
|
|
46926
46926
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46927
46927
|
def("JSXAttribute").bases("Node").build("name", "value").field("name", or(def("JSXIdentifier"), def("JSXNamespacedName"))).field("value", or(
|
|
46928
46928
|
def("Literal"),
|
|
@@ -46980,9 +46980,9 @@ var require_type_annotations = __commonJS({
|
|
|
46980
46980
|
var types_1 = tslib_1.__importDefault(require_types());
|
|
46981
46981
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
46982
46982
|
function default_1(fork) {
|
|
46983
|
-
var
|
|
46984
|
-
var def =
|
|
46985
|
-
var or =
|
|
46983
|
+
var types16 = fork.use(types_1.default);
|
|
46984
|
+
var def = types16.Type.def;
|
|
46985
|
+
var or = types16.Type.or;
|
|
46986
46986
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46987
46987
|
var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
|
|
46988
46988
|
var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
|
|
@@ -47017,9 +47017,9 @@ var require_flow = __commonJS({
|
|
|
47017
47017
|
function default_1(fork) {
|
|
47018
47018
|
fork.use(es_proposals_1.default);
|
|
47019
47019
|
fork.use(type_annotations_1.default);
|
|
47020
|
-
var
|
|
47021
|
-
var def =
|
|
47022
|
-
var or =
|
|
47020
|
+
var types16 = fork.use(types_1.default);
|
|
47021
|
+
var def = types16.Type.def;
|
|
47022
|
+
var or = types16.Type.or;
|
|
47023
47023
|
var defaults = fork.use(shared_1.default).defaults;
|
|
47024
47024
|
def("Flow").bases("Node");
|
|
47025
47025
|
def("FlowType").bases("Flow");
|
|
@@ -47133,10 +47133,10 @@ var require_esprima = __commonJS({
|
|
|
47133
47133
|
var shared_1 = tslib_1.__importStar(require_shared());
|
|
47134
47134
|
function default_1(fork) {
|
|
47135
47135
|
fork.use(es_proposals_1.default);
|
|
47136
|
-
var
|
|
47136
|
+
var types16 = fork.use(types_1.default);
|
|
47137
47137
|
var defaults = fork.use(shared_1.default).defaults;
|
|
47138
|
-
var def =
|
|
47139
|
-
var or =
|
|
47138
|
+
var def = types16.Type.def;
|
|
47139
|
+
var or = types16.Type.or;
|
|
47140
47140
|
def("VariableDeclaration").field("declarations", [or(
|
|
47141
47141
|
def("VariableDeclarator"),
|
|
47142
47142
|
def("Identifier")
|
|
@@ -47181,11 +47181,11 @@ var require_babel_core = __commonJS({
|
|
|
47181
47181
|
function default_1(fork) {
|
|
47182
47182
|
var _a, _b, _c, _d, _e;
|
|
47183
47183
|
fork.use(es_proposals_1.default);
|
|
47184
|
-
var
|
|
47184
|
+
var types16 = fork.use(types_1.default);
|
|
47185
47185
|
var defaults = fork.use(shared_1.default).defaults;
|
|
47186
|
-
var def =
|
|
47187
|
-
var or =
|
|
47188
|
-
var isUndefined =
|
|
47186
|
+
var def = types16.Type.def;
|
|
47187
|
+
var or = types16.Type.or;
|
|
47188
|
+
var isUndefined = types16.builtInTypes.undefined;
|
|
47189
47189
|
def("Noop").bases("Statement").build();
|
|
47190
47190
|
def("DoExpression").bases("Expression").build("body").field("body", [def("Statement")]);
|
|
47191
47191
|
def("BindExpression").bases("Expression").build("object", "callee").field("object", or(def("Expression"), null)).field("callee", def("Expression"));
|
|
@@ -47210,7 +47210,7 @@ var require_babel_core = __commonJS({
|
|
|
47210
47210
|
raw: String
|
|
47211
47211
|
},
|
|
47212
47212
|
function getDefault() {
|
|
47213
|
-
var value =
|
|
47213
|
+
var value = types16.getFieldValue(this, "value");
|
|
47214
47214
|
return {
|
|
47215
47215
|
rawValue: value,
|
|
47216
47216
|
raw: toRaw ? toRaw(value) : String(value)
|
|
@@ -47313,8 +47313,8 @@ var require_babel = __commonJS({
|
|
|
47313
47313
|
var flow_1 = tslib_1.__importDefault(require_flow());
|
|
47314
47314
|
var shared_1 = require_shared();
|
|
47315
47315
|
function default_1(fork) {
|
|
47316
|
-
var
|
|
47317
|
-
var def =
|
|
47316
|
+
var types16 = fork.use(types_1.default);
|
|
47317
|
+
var def = types16.Type.def;
|
|
47318
47318
|
fork.use(babel_core_1.default);
|
|
47319
47319
|
fork.use(flow_1.default);
|
|
47320
47320
|
def("V8IntrinsicIdentifier").bases("Expression").build("name").field("name", String);
|
|
@@ -47340,12 +47340,12 @@ var require_typescript = __commonJS({
|
|
|
47340
47340
|
function default_1(fork) {
|
|
47341
47341
|
fork.use(babel_core_1.default);
|
|
47342
47342
|
fork.use(type_annotations_1.default);
|
|
47343
|
-
var
|
|
47344
|
-
var n =
|
|
47345
|
-
var def =
|
|
47346
|
-
var or =
|
|
47343
|
+
var types16 = fork.use(types_1.default);
|
|
47344
|
+
var n = types16.namedTypes;
|
|
47345
|
+
var def = types16.Type.def;
|
|
47346
|
+
var or = types16.Type.or;
|
|
47347
47347
|
var defaults = fork.use(shared_1.default).defaults;
|
|
47348
|
-
var StringLiteral =
|
|
47348
|
+
var StringLiteral = types16.Type.from(function(value, deep) {
|
|
47349
47349
|
if (n.StringLiteral && n.StringLiteral.check(value, deep)) {
|
|
47350
47350
|
return true;
|
|
47351
47351
|
}
|
|
@@ -47545,7 +47545,7 @@ var require_main = __commonJS({
|
|
|
47545
47545
|
var someField = _a.someField;
|
|
47546
47546
|
var Type = _a.Type;
|
|
47547
47547
|
var use = _a.use;
|
|
47548
|
-
var
|
|
47548
|
+
var visit13 = _a.visit;
|
|
47549
47549
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
47550
47550
|
exports.builders = builders;
|
|
47551
47551
|
exports.builtInTypes = builtInTypes;
|
|
@@ -47562,7 +47562,7 @@ var require_main = __commonJS({
|
|
|
47562
47562
|
exports.someField = someField;
|
|
47563
47563
|
exports.Type = Type;
|
|
47564
47564
|
exports.use = use;
|
|
47565
|
-
exports.visit =
|
|
47565
|
+
exports.visit = visit13;
|
|
47566
47566
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
47567
47567
|
}
|
|
47568
47568
|
});
|
|
@@ -49321,8 +49321,8 @@ var require_util2 = __commonJS({
|
|
|
49321
49321
|
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;
|
|
49322
49322
|
var tslib_1 = require_tslib();
|
|
49323
49323
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
49324
|
-
var
|
|
49325
|
-
var n =
|
|
49324
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
49325
|
+
var n = types16.namedTypes;
|
|
49326
49326
|
var source_map_1 = tslib_1.__importDefault(require_source_map());
|
|
49327
49327
|
var SourceMapConsumer = source_map_1.default.SourceMapConsumer;
|
|
49328
49328
|
var SourceMapGenerator = source_map_1.default.SourceMapGenerator;
|
|
@@ -56640,10 +56640,10 @@ var require_comments = __commonJS({
|
|
|
56640
56640
|
exports.printComments = exports.attach = void 0;
|
|
56641
56641
|
var tslib_1 = require_tslib();
|
|
56642
56642
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
56643
|
-
var
|
|
56644
|
-
var n =
|
|
56645
|
-
var isArray =
|
|
56646
|
-
var isObject2 =
|
|
56643
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
56644
|
+
var n = types16.namedTypes;
|
|
56645
|
+
var isArray = types16.builtInTypes.array;
|
|
56646
|
+
var isObject2 = types16.builtInTypes.object;
|
|
56647
56647
|
var lines_1 = require_lines();
|
|
56648
56648
|
var util_1 = require_util2();
|
|
56649
56649
|
var childNodesCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -56674,7 +56674,7 @@ var require_comments = __commonJS({
|
|
|
56674
56674
|
if (isArray.check(node)) {
|
|
56675
56675
|
names = Object.keys(node);
|
|
56676
56676
|
} else if (isObject2.check(node)) {
|
|
56677
|
-
names =
|
|
56677
|
+
names = types16.getFieldNames(node);
|
|
56678
56678
|
} else {
|
|
56679
56679
|
return resultArray;
|
|
56680
56680
|
}
|
|
@@ -56852,7 +56852,7 @@ var require_comments = __commonJS({
|
|
|
56852
56852
|
function printComments(path2, print12) {
|
|
56853
56853
|
var value = path2.getValue();
|
|
56854
56854
|
var innerLines = print12(path2);
|
|
56855
|
-
var comments = n.Node.check(value) &&
|
|
56855
|
+
var comments = n.Node.check(value) && types16.getFieldValue(value, "comments");
|
|
56856
56856
|
if (!comments || comments.length === 0) {
|
|
56857
56857
|
return innerLines;
|
|
56858
56858
|
}
|
|
@@ -56860,8 +56860,8 @@ var require_comments = __commonJS({
|
|
|
56860
56860
|
var trailingParts = [innerLines];
|
|
56861
56861
|
path2.each(function(commentPath) {
|
|
56862
56862
|
var comment = commentPath.getValue();
|
|
56863
|
-
var leading =
|
|
56864
|
-
var trailing =
|
|
56863
|
+
var leading = types16.getFieldValue(comment, "leading");
|
|
56864
|
+
var trailing = types16.getFieldValue(comment, "trailing");
|
|
56865
56865
|
if (leading || trailing && !(n.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
56866
56866
|
leadingParts.push(printLeadingComment(commentPath, print12));
|
|
56867
56867
|
} else if (trailing) {
|
|
@@ -56883,10 +56883,10 @@ var require_parser2 = __commonJS({
|
|
|
56883
56883
|
exports.parse = void 0;
|
|
56884
56884
|
var tslib_1 = require_tslib();
|
|
56885
56885
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
56886
|
-
var
|
|
56887
|
-
var b =
|
|
56888
|
-
var isObject2 =
|
|
56889
|
-
var isArray =
|
|
56886
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
56887
|
+
var b = types16.builders;
|
|
56888
|
+
var isObject2 = types16.builtInTypes.object;
|
|
56889
|
+
var isArray = types16.builtInTypes.array;
|
|
56890
56890
|
var options_1 = require_options();
|
|
56891
56891
|
var lines_1 = require_lines();
|
|
56892
56892
|
var comments_1 = require_comments();
|
|
@@ -57072,11 +57072,11 @@ var require_fast_path = __commonJS({
|
|
|
57072
57072
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57073
57073
|
var tslib_1 = require_tslib();
|
|
57074
57074
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
57075
|
-
var
|
|
57075
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
57076
57076
|
var util = tslib_1.__importStar(require_util2());
|
|
57077
|
-
var n =
|
|
57078
|
-
var isArray =
|
|
57079
|
-
var isNumber =
|
|
57077
|
+
var n = types16.namedTypes;
|
|
57078
|
+
var isArray = types16.builtInTypes.array;
|
|
57079
|
+
var isNumber = types16.builtInTypes.number;
|
|
57080
57080
|
var PRECEDENCE = {};
|
|
57081
57081
|
[
|
|
57082
57082
|
["??"],
|
|
@@ -57105,7 +57105,7 @@ var require_fast_path = __commonJS({
|
|
|
57105
57105
|
if (obj instanceof FastPath) {
|
|
57106
57106
|
return obj.copy();
|
|
57107
57107
|
}
|
|
57108
|
-
if (obj instanceof
|
|
57108
|
+
if (obj instanceof types16.NodePath) {
|
|
57109
57109
|
var copy = Object.create(FastPath.prototype);
|
|
57110
57110
|
var stack = [obj.value];
|
|
57111
57111
|
for (var pp = void 0; pp = obj.parentPath; obj = pp)
|
|
@@ -57416,7 +57416,7 @@ var require_fast_path = __commonJS({
|
|
|
57416
57416
|
return node.some(containsCallExpression);
|
|
57417
57417
|
}
|
|
57418
57418
|
if (n.Node.check(node)) {
|
|
57419
|
-
return
|
|
57419
|
+
return types16.someField(node, function(_name, child) {
|
|
57420
57420
|
return containsCallExpression(child);
|
|
57421
57421
|
});
|
|
57422
57422
|
}
|
|
@@ -57506,16 +57506,16 @@ var require_patcher = __commonJS({
|
|
|
57506
57506
|
var tslib_1 = require_tslib();
|
|
57507
57507
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
57508
57508
|
var linesModule = tslib_1.__importStar(require_lines());
|
|
57509
|
-
var
|
|
57510
|
-
var Printable =
|
|
57511
|
-
var Expression =
|
|
57512
|
-
var ReturnStatement =
|
|
57513
|
-
var SourceLocation =
|
|
57509
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
57510
|
+
var Printable = types16.namedTypes.Printable;
|
|
57511
|
+
var Expression = types16.namedTypes.Expression;
|
|
57512
|
+
var ReturnStatement = types16.namedTypes.ReturnStatement;
|
|
57513
|
+
var SourceLocation = types16.namedTypes.SourceLocation;
|
|
57514
57514
|
var util_1 = require_util2();
|
|
57515
57515
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
57516
|
-
var isObject2 =
|
|
57517
|
-
var isArray =
|
|
57518
|
-
var isString =
|
|
57516
|
+
var isObject2 = types16.builtInTypes.object;
|
|
57517
|
+
var isArray = types16.builtInTypes.array;
|
|
57518
|
+
var isString = types16.builtInTypes.string;
|
|
57519
57519
|
var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
|
|
57520
57520
|
var Patcher = function Patcher2(lines) {
|
|
57521
57521
|
assert_1.default.ok(this instanceof Patcher2);
|
|
@@ -57785,8 +57785,8 @@ var require_patcher = __commonJS({
|
|
|
57785
57785
|
if (k.charAt(0) === "_") {
|
|
57786
57786
|
continue;
|
|
57787
57787
|
}
|
|
57788
|
-
newPath.stack.push(k,
|
|
57789
|
-
oldPath.stack.push(k,
|
|
57788
|
+
newPath.stack.push(k, types16.getFieldValue(newNode, k));
|
|
57789
|
+
oldPath.stack.push(k, types16.getFieldValue(oldNode, k));
|
|
57790
57790
|
var canReprint = findAnyReprints(newPath, oldPath, reprints);
|
|
57791
57791
|
newPath.stack.length -= 2;
|
|
57792
57792
|
oldPath.stack.length -= 2;
|
|
@@ -57810,16 +57810,16 @@ var require_printer2 = __commonJS({
|
|
|
57810
57810
|
exports.Printer = void 0;
|
|
57811
57811
|
var tslib_1 = require_tslib();
|
|
57812
57812
|
var assert_1 = tslib_1.__importDefault(__require("assert"));
|
|
57813
|
-
var
|
|
57813
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
57814
57814
|
var comments_1 = require_comments();
|
|
57815
57815
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
57816
57816
|
var lines_1 = require_lines();
|
|
57817
57817
|
var options_1 = require_options();
|
|
57818
57818
|
var patcher_1 = require_patcher();
|
|
57819
57819
|
var util = tslib_1.__importStar(require_util2());
|
|
57820
|
-
var namedTypes =
|
|
57821
|
-
var isString =
|
|
57822
|
-
var isObject2 =
|
|
57820
|
+
var namedTypes = types16.namedTypes;
|
|
57821
|
+
var isString = types16.builtInTypes.string;
|
|
57822
|
+
var isObject2 = types16.builtInTypes.object;
|
|
57823
57823
|
var PrintResult = function PrintResult2(code, sourceMap) {
|
|
57824
57824
|
assert_1.default.ok(this instanceof PrintResult2);
|
|
57825
57825
|
isString.assert(code);
|
|
@@ -57981,7 +57981,7 @@ var require_printer2 = __commonJS({
|
|
|
57981
57981
|
case "OptionalMemberExpression": {
|
|
57982
57982
|
parts.push(path2.call(print12, "object"));
|
|
57983
57983
|
var property = path2.call(print12, "property");
|
|
57984
|
-
var optional =
|
|
57984
|
+
var optional = types16.getFieldValue(n, "optional");
|
|
57985
57985
|
if (n.computed) {
|
|
57986
57986
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
57987
57987
|
} else {
|
|
@@ -58252,7 +58252,7 @@ var require_printer2 = __commonJS({
|
|
|
58252
58252
|
if (n.typeArguments) {
|
|
58253
58253
|
parts.push(path2.call(print12, "typeArguments"));
|
|
58254
58254
|
}
|
|
58255
|
-
if (
|
|
58255
|
+
if (types16.getFieldValue(n, "optional")) {
|
|
58256
58256
|
parts.push("?.");
|
|
58257
58257
|
}
|
|
58258
58258
|
parts.push(printArgumentsList(path2, options, print12));
|
|
@@ -59931,8 +59931,8 @@ var require_printer2 = __commonJS({
|
|
|
59931
59931
|
});
|
|
59932
59932
|
}
|
|
59933
59933
|
function getPossibleRaw(node) {
|
|
59934
|
-
var value =
|
|
59935
|
-
var extra =
|
|
59934
|
+
var value = types16.getFieldValue(node, "value");
|
|
59935
|
+
var extra = types16.getFieldValue(node, "extra");
|
|
59936
59936
|
if (extra && typeof extra.raw === "string" && value == extra.rawValue) {
|
|
59937
59937
|
return extra.raw;
|
|
59938
59938
|
}
|
|
@@ -59980,8 +59980,8 @@ var require_main2 = __commonJS({
|
|
|
59980
59980
|
exports.run = exports.prettyPrint = exports.print = exports.visit = exports.types = exports.parse = void 0;
|
|
59981
59981
|
var tslib_1 = require_tslib();
|
|
59982
59982
|
var fs_1 = tslib_1.__importDefault(__require("fs"));
|
|
59983
|
-
var
|
|
59984
|
-
exports.types =
|
|
59983
|
+
var types16 = tslib_1.__importStar(require_main());
|
|
59984
|
+
exports.types = types16;
|
|
59985
59985
|
var parser_1 = require_parser2();
|
|
59986
59986
|
Object.defineProperty(exports, "parse", { enumerable: true, get: function() {
|
|
59987
59987
|
return parser_1.parse;
|
|
@@ -59995,10 +59995,10 @@ var require_main2 = __commonJS({
|
|
|
59995
59995
|
return new printer_1.Printer(options).print(node);
|
|
59996
59996
|
}
|
|
59997
59997
|
exports.print = print12;
|
|
59998
|
-
function
|
|
59998
|
+
function prettyPrint3(node, options) {
|
|
59999
59999
|
return new printer_1.Printer(options).printGenerically(node);
|
|
60000
60000
|
}
|
|
60001
|
-
exports.prettyPrint =
|
|
60001
|
+
exports.prettyPrint = prettyPrint3;
|
|
60002
60002
|
function run(transformer, options) {
|
|
60003
60003
|
return runFile(process.argv[2], transformer, options);
|
|
60004
60004
|
}
|
|
@@ -65954,7 +65954,7 @@ var printDocASTReducer = {
|
|
|
65954
65954
|
leave: ({ name: name2, interfaces, directives, fields }) => join(["interface", name2, wrap("implements ", join(interfaces, " & ")), join(directives, " "), block(fields)], " ")
|
|
65955
65955
|
},
|
|
65956
65956
|
UnionTypeDefinition: {
|
|
65957
|
-
leave: ({ name: name2, directives, types:
|
|
65957
|
+
leave: ({ name: name2, directives, types: types16 }) => join(["union", name2, join(directives, " "), wrap("= ", join(types16, " | "))], " ")
|
|
65958
65958
|
},
|
|
65959
65959
|
EnumTypeDefinition: {
|
|
65960
65960
|
leave: ({ name: name2, directives, values }) => join(["enum", name2, join(directives, " "), block(values)], " ")
|
|
@@ -65981,7 +65981,7 @@ var printDocASTReducer = {
|
|
|
65981
65981
|
leave: ({ name: name2, interfaces, directives, fields }) => join(["extend interface", name2, wrap("implements ", join(interfaces, " & ")), join(directives, " "), block(fields)], " ")
|
|
65982
65982
|
},
|
|
65983
65983
|
UnionTypeExtension: {
|
|
65984
|
-
leave: ({ name: name2, directives, types:
|
|
65984
|
+
leave: ({ name: name2, directives, types: types16 }) => join(["extend union", name2, join(directives, " "), wrap("= ", join(types16, " | "))], " ")
|
|
65985
65985
|
},
|
|
65986
65986
|
EnumTypeExtension: {
|
|
65987
65987
|
leave: ({ name: name2, directives, values }) => join(["extend enum", name2, join(directives, " "), block(values)], " ")
|
|
@@ -66861,8 +66861,8 @@ function healTypes(originalTypeMap, directives) {
|
|
|
66861
66861
|
}
|
|
66862
66862
|
}
|
|
66863
66863
|
function healUnderlyingTypes(type) {
|
|
66864
|
-
const
|
|
66865
|
-
|
|
66864
|
+
const types16 = type.getTypes();
|
|
66865
|
+
types16.push(...types16.splice(0).map((t2) => healType(t2)).filter(Boolean));
|
|
66866
66866
|
}
|
|
66867
66867
|
function healType(type) {
|
|
66868
66868
|
if ((0, import_graphql11.isListType)(type)) {
|
|
@@ -67646,11 +67646,11 @@ function mergeEnum(e1, e2, config2) {
|
|
|
67646
67646
|
|
|
67647
67647
|
// ../../node_modules/.pnpm/@graphql-tools+merge@8.3.14_graphql@15.8.0/node_modules/@graphql-tools/merge/esm/typedefs-mergers/utils.js
|
|
67648
67648
|
var import_graphql20 = __toESM(require_graphql2(), 1);
|
|
67649
|
-
function isStringTypes(
|
|
67650
|
-
return typeof
|
|
67649
|
+
function isStringTypes(types16) {
|
|
67650
|
+
return typeof types16 === "string";
|
|
67651
67651
|
}
|
|
67652
|
-
function isSourceTypes(
|
|
67653
|
-
return
|
|
67652
|
+
function isSourceTypes(types16) {
|
|
67653
|
+
return types16 instanceof import_graphql20.Source;
|
|
67654
67654
|
}
|
|
67655
67655
|
function extractType(type) {
|
|
67656
67656
|
let visitedType = type;
|
|
@@ -68676,8 +68676,8 @@ var List = class {
|
|
|
68676
68676
|
} else {
|
|
68677
68677
|
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
68678
68678
|
}
|
|
68679
|
-
for (let
|
|
68680
|
-
yield
|
|
68679
|
+
for (let record2 of entries) {
|
|
68680
|
+
yield record2;
|
|
68681
68681
|
}
|
|
68682
68682
|
}
|
|
68683
68683
|
};
|
|
@@ -68726,6 +68726,46 @@ var ListCollection = class {
|
|
|
68726
68726
|
}
|
|
68727
68727
|
};
|
|
68728
68728
|
|
|
68729
|
+
// src/runtime/cache/schema.ts
|
|
68730
|
+
var SchemaManager = class {
|
|
68731
|
+
cache;
|
|
68732
|
+
fieldTypes = {};
|
|
68733
|
+
constructor(cache) {
|
|
68734
|
+
this.cache = cache;
|
|
68735
|
+
}
|
|
68736
|
+
setFieldType({
|
|
68737
|
+
parent,
|
|
68738
|
+
key,
|
|
68739
|
+
type,
|
|
68740
|
+
nullable = false,
|
|
68741
|
+
link
|
|
68742
|
+
}) {
|
|
68743
|
+
let parensIndex = key.indexOf("(");
|
|
68744
|
+
if (parensIndex !== -1) {
|
|
68745
|
+
key = key.substring(0, parensIndex);
|
|
68746
|
+
}
|
|
68747
|
+
if (parent === rootID) {
|
|
68748
|
+
parent = "Query";
|
|
68749
|
+
} else if (parent.includes(":")) {
|
|
68750
|
+
parent = parent.substring(0, parent.indexOf(":"));
|
|
68751
|
+
}
|
|
68752
|
+
if (!this.fieldTypes[parent]) {
|
|
68753
|
+
this.fieldTypes[parent] = {};
|
|
68754
|
+
}
|
|
68755
|
+
this.fieldTypes[parent][key] = {
|
|
68756
|
+
type,
|
|
68757
|
+
nullable,
|
|
68758
|
+
link: !!link
|
|
68759
|
+
};
|
|
68760
|
+
}
|
|
68761
|
+
fieldType(type, field) {
|
|
68762
|
+
return this.fieldTypes[type]?.[field] || null;
|
|
68763
|
+
}
|
|
68764
|
+
get config() {
|
|
68765
|
+
return this.cache._internal_unstable.config;
|
|
68766
|
+
}
|
|
68767
|
+
};
|
|
68768
|
+
|
|
68729
68769
|
// src/runtime/cache/storage.ts
|
|
68730
68770
|
var InMemoryStorage = class {
|
|
68731
68771
|
data;
|
|
@@ -69293,7 +69333,7 @@ var InMemorySubscriptions = class {
|
|
|
69293
69333
|
};
|
|
69294
69334
|
|
|
69295
69335
|
// src/runtime/cache/cache.ts
|
|
69296
|
-
var
|
|
69336
|
+
var Cache3 = class {
|
|
69297
69337
|
_internal_unstable;
|
|
69298
69338
|
constructor(config2) {
|
|
69299
69339
|
this._internal_unstable = new CacheInternal({
|
|
@@ -69301,7 +69341,8 @@ var Cache2 = class {
|
|
|
69301
69341
|
storage: new InMemoryStorage(),
|
|
69302
69342
|
subscriptions: new InMemorySubscriptions(this),
|
|
69303
69343
|
lists: new ListManager(this, rootID),
|
|
69304
|
-
lifetimes: new GarbageCollector(this)
|
|
69344
|
+
lifetimes: new GarbageCollector(this),
|
|
69345
|
+
schema: new SchemaManager(this)
|
|
69305
69346
|
});
|
|
69306
69347
|
if (config2) {
|
|
69307
69348
|
this.setConfig(defaultConfigValues(config2));
|
|
@@ -69387,18 +69428,21 @@ var CacheInternal = class {
|
|
|
69387
69428
|
lists;
|
|
69388
69429
|
cache;
|
|
69389
69430
|
lifetimes;
|
|
69431
|
+
schema;
|
|
69390
69432
|
constructor({
|
|
69391
69433
|
storage,
|
|
69392
69434
|
subscriptions,
|
|
69393
69435
|
lists,
|
|
69394
69436
|
cache,
|
|
69395
|
-
lifetimes
|
|
69437
|
+
lifetimes,
|
|
69438
|
+
schema
|
|
69396
69439
|
}) {
|
|
69397
69440
|
this.storage = storage;
|
|
69398
69441
|
this.subscriptions = subscriptions;
|
|
69399
69442
|
this.lists = lists;
|
|
69400
69443
|
this.cache = cache;
|
|
69401
69444
|
this.lifetimes = lifetimes;
|
|
69445
|
+
this.schema = schema;
|
|
69402
69446
|
this._disabled = typeof globalThis.window === "undefined";
|
|
69403
69447
|
try {
|
|
69404
69448
|
if (process.env.HOUDINI_TEST === "true") {
|
|
@@ -69414,7 +69458,6 @@ var CacheInternal = class {
|
|
|
69414
69458
|
data,
|
|
69415
69459
|
selection: selection2,
|
|
69416
69460
|
variables = {},
|
|
69417
|
-
root = rootID,
|
|
69418
69461
|
parent = rootID,
|
|
69419
69462
|
applyUpdates = false,
|
|
69420
69463
|
layer,
|
|
@@ -69437,9 +69480,17 @@ var CacheInternal = class {
|
|
|
69437
69480
|
selection: fieldSelection,
|
|
69438
69481
|
operations,
|
|
69439
69482
|
abstract: isAbstract,
|
|
69440
|
-
update
|
|
69483
|
+
update,
|
|
69484
|
+
nullable
|
|
69441
69485
|
} = targetSelection[field];
|
|
69442
69486
|
const key = evaluateKey(keyRaw, variables);
|
|
69487
|
+
this.schema.setFieldType({
|
|
69488
|
+
parent,
|
|
69489
|
+
key: keyRaw,
|
|
69490
|
+
type: linkedType,
|
|
69491
|
+
nullable,
|
|
69492
|
+
link: !!fieldSelection
|
|
69493
|
+
});
|
|
69443
69494
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
69444
69495
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
69445
69496
|
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
@@ -69508,7 +69559,6 @@ var CacheInternal = class {
|
|
|
69508
69559
|
}
|
|
69509
69560
|
if (linkedID) {
|
|
69510
69561
|
this.writeSelection({
|
|
69511
|
-
root,
|
|
69512
69562
|
selection: fieldSelection,
|
|
69513
69563
|
parent: linkedID,
|
|
69514
69564
|
data: value,
|
|
@@ -69899,7 +69949,7 @@ var CacheInternal = class {
|
|
|
69899
69949
|
var rootID = "_ROOT_";
|
|
69900
69950
|
|
|
69901
69951
|
// src/runtime/cache/index.ts
|
|
69902
|
-
var cache_default = new
|
|
69952
|
+
var cache_default = new Cache3();
|
|
69903
69953
|
|
|
69904
69954
|
// src/runtime/lib/types.ts
|
|
69905
69955
|
var CompiledFragmentKind = "HoudiniFragment" /* Fragment */;
|
|
@@ -70091,6 +70141,7 @@ async function writeFile(filepath, data) {
|
|
|
70091
70141
|
return;
|
|
70092
70142
|
}
|
|
70093
70143
|
if (houdini_mode.is_testing) {
|
|
70144
|
+
import_memfs.fs.mkdirpSync(dirname(filepath));
|
|
70094
70145
|
return import_memfs.fs.writeFileSync(filepath, data);
|
|
70095
70146
|
}
|
|
70096
70147
|
return await fs.writeFile(filepath, data, "utf8");
|
|
@@ -71457,7 +71508,6 @@ var Config = class {
|
|
|
71457
71508
|
rootDir;
|
|
71458
71509
|
projectRoot;
|
|
71459
71510
|
schema;
|
|
71460
|
-
apiUrl;
|
|
71461
71511
|
schemaPath;
|
|
71462
71512
|
persistedQueryPath;
|
|
71463
71513
|
exclude;
|
|
@@ -71497,7 +71547,6 @@ var Config = class {
|
|
|
71497
71547
|
schema,
|
|
71498
71548
|
schemaPath = "./schema.graphql",
|
|
71499
71549
|
exclude = [],
|
|
71500
|
-
apiUrl,
|
|
71501
71550
|
module = "esm",
|
|
71502
71551
|
scalars,
|
|
71503
71552
|
cacheBufferSize,
|
|
@@ -71507,7 +71556,7 @@ var Config = class {
|
|
|
71507
71556
|
defaultListPosition = "append",
|
|
71508
71557
|
defaultListTarget = null,
|
|
71509
71558
|
defaultKeys,
|
|
71510
|
-
types:
|
|
71559
|
+
types: types16 = {},
|
|
71511
71560
|
logLevel,
|
|
71512
71561
|
defaultFragmentMasking = "enable",
|
|
71513
71562
|
schemaPollInterval = 2e3,
|
|
@@ -71528,11 +71577,6 @@ var Config = class {
|
|
|
71528
71577
|
logLevel = LogLevel.Summary;
|
|
71529
71578
|
}
|
|
71530
71579
|
this.schemaPath = schemaPath;
|
|
71531
|
-
if (apiUrl && apiUrl.startsWith("env:")) {
|
|
71532
|
-
this.apiUrl = process.env[apiUrl.slice("env:".length)];
|
|
71533
|
-
} else {
|
|
71534
|
-
this.apiUrl = apiUrl;
|
|
71535
|
-
}
|
|
71536
71580
|
this.filepath = filepath;
|
|
71537
71581
|
this.exclude = Array.isArray(exclude) ? exclude : [exclude];
|
|
71538
71582
|
this.module = module;
|
|
@@ -71555,13 +71599,20 @@ var Config = class {
|
|
|
71555
71599
|
if (defaultKeys) {
|
|
71556
71600
|
this.defaultKeys = defaultKeys;
|
|
71557
71601
|
}
|
|
71558
|
-
if (
|
|
71602
|
+
if (types16) {
|
|
71559
71603
|
this.typeConfig = {
|
|
71560
71604
|
...this.typeConfig,
|
|
71561
|
-
...
|
|
71605
|
+
...types16
|
|
71562
71606
|
};
|
|
71563
71607
|
}
|
|
71564
71608
|
}
|
|
71609
|
+
async apiURL() {
|
|
71610
|
+
if (!this.configFile.apiUrl) {
|
|
71611
|
+
return "";
|
|
71612
|
+
}
|
|
71613
|
+
const env = await this.getEnv();
|
|
71614
|
+
return this.processEnvValues(env, this.configFile.apiUrl);
|
|
71615
|
+
}
|
|
71565
71616
|
get include() {
|
|
71566
71617
|
if (this.configFile.include) {
|
|
71567
71618
|
return Array.isArray(this.configFile.include) ? this.configFile.include : [this.configFile.include];
|
|
@@ -71574,23 +71625,43 @@ var Config = class {
|
|
|
71574
71625
|
pluginConfig(name2) {
|
|
71575
71626
|
return this.configFile.plugins?.[name2] ?? {};
|
|
71576
71627
|
}
|
|
71577
|
-
|
|
71578
|
-
|
|
71628
|
+
async getEnv() {
|
|
71629
|
+
let env = process.env;
|
|
71630
|
+
for (const plugin of this.plugins) {
|
|
71631
|
+
if (plugin.env) {
|
|
71632
|
+
env = {
|
|
71633
|
+
...await plugin.env({ config: this, env })
|
|
71634
|
+
};
|
|
71635
|
+
}
|
|
71636
|
+
}
|
|
71637
|
+
return env;
|
|
71638
|
+
}
|
|
71639
|
+
processEnvValues(env, value) {
|
|
71640
|
+
let headerValue;
|
|
71641
|
+
if (typeof value === "function") {
|
|
71642
|
+
headerValue = value(env);
|
|
71643
|
+
} else if (value.startsWith("env:")) {
|
|
71644
|
+
headerValue = env[value.slice("env:".length)];
|
|
71645
|
+
} else {
|
|
71646
|
+
headerValue = value;
|
|
71647
|
+
}
|
|
71648
|
+
return headerValue;
|
|
71649
|
+
}
|
|
71650
|
+
async pullHeaders() {
|
|
71651
|
+
const env = await this.getEnv();
|
|
71652
|
+
if (typeof this.schemaPollHeaders === "function") {
|
|
71653
|
+
return this.schemaPollHeaders(env);
|
|
71654
|
+
}
|
|
71655
|
+
const headers = Object.fromEntries(
|
|
71579
71656
|
Object.entries(this.schemaPollHeaders || {}).map(([key, value]) => {
|
|
71580
|
-
|
|
71581
|
-
if (typeof value === "function") {
|
|
71582
|
-
headerValue = value(process.env);
|
|
71583
|
-
} else if (value.startsWith("env:")) {
|
|
71584
|
-
headerValue = process.env[value.slice("env:".length)];
|
|
71585
|
-
} else {
|
|
71586
|
-
headerValue = value;
|
|
71587
|
-
}
|
|
71657
|
+
const headerValue = this.processEnvValues(env, value);
|
|
71588
71658
|
if (!headerValue) {
|
|
71589
71659
|
return [];
|
|
71590
71660
|
}
|
|
71591
71661
|
return [key, headerValue];
|
|
71592
|
-
})
|
|
71662
|
+
}).filter(([key]) => key)
|
|
71593
71663
|
);
|
|
71664
|
+
return headers;
|
|
71594
71665
|
}
|
|
71595
71666
|
async sourceFiles() {
|
|
71596
71667
|
return [
|
|
@@ -71996,9 +72067,10 @@ async function getConfig({
|
|
|
71996
72067
|
...extraConfig,
|
|
71997
72068
|
filepath: configPath
|
|
71998
72069
|
});
|
|
72070
|
+
const apiURL = await _config.apiURL();
|
|
71999
72071
|
if (_config.schemaPath && !_config.schema) {
|
|
72000
72072
|
let schemaOk = true;
|
|
72001
|
-
if (
|
|
72073
|
+
if (apiURL) {
|
|
72002
72074
|
if (glob.hasMagic(_config.schemaPath)) {
|
|
72003
72075
|
console.log(
|
|
72004
72076
|
`\u26A0\uFE0F Your houdini configuration contains an apiUrl and a path pointing to multiple files.
|
|
@@ -72006,7 +72078,7 @@ This will prevent your schema from being pulled.`
|
|
|
72006
72078
|
);
|
|
72007
72079
|
} else if (!await readFile(_config.schemaPath)) {
|
|
72008
72080
|
console.log("\u231B Pulling schema from api");
|
|
72009
|
-
schemaOk = await pullSchema(
|
|
72081
|
+
schemaOk = await pullSchema(apiURL, _config.schemaPath);
|
|
72010
72082
|
}
|
|
72011
72083
|
}
|
|
72012
72084
|
if (schemaOk && !noSchema) {
|
|
@@ -72017,10 +72089,11 @@ This will prevent your schema from being pulled.`
|
|
|
72017
72089
|
reject(e2);
|
|
72018
72090
|
throw e2;
|
|
72019
72091
|
}
|
|
72092
|
+
const plugins = [];
|
|
72020
72093
|
for (const [pluginName, plugin_config] of Object.entries(_config.configFile.plugins ?? {})) {
|
|
72021
72094
|
try {
|
|
72022
72095
|
const pluginDirectory = _config.findModule(pluginName);
|
|
72023
|
-
const { default:
|
|
72096
|
+
const { default: pluginFactory } = await import(pathToFileURL(pluginDirectory).toString() + "/build/plugin-esm/index.js");
|
|
72024
72097
|
let include_runtime = false;
|
|
72025
72098
|
try {
|
|
72026
72099
|
await stat(join2(pluginDirectory, "build", "runtime-esm"));
|
|
@@ -72037,8 +72110,8 @@ This will prevent your schema from being pulled.`
|
|
|
72037
72110
|
version = packageJSON.version;
|
|
72038
72111
|
} catch {
|
|
72039
72112
|
}
|
|
72040
|
-
|
|
72041
|
-
...await
|
|
72113
|
+
plugins.push({
|
|
72114
|
+
...await pluginFactory(plugin_config),
|
|
72042
72115
|
name: pluginName,
|
|
72043
72116
|
include_runtime,
|
|
72044
72117
|
version,
|
|
@@ -72050,6 +72123,7 @@ This will prevent your schema from being pulled.`
|
|
|
72050
72123
|
);
|
|
72051
72124
|
}
|
|
72052
72125
|
}
|
|
72126
|
+
_config.plugins = orderedPlugins(plugins);
|
|
72053
72127
|
await Promise.all(_config.plugins.map((plugin) => plugin.after_load?.(_config)));
|
|
72054
72128
|
resolve2(_config);
|
|
72055
72129
|
return _config;
|
|
@@ -72061,6 +72135,16 @@ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
|
72061
72135
|
LogLevel2["Quiet"] = "quiet";
|
|
72062
72136
|
return LogLevel2;
|
|
72063
72137
|
})(LogLevel || {});
|
|
72138
|
+
var orderedPlugins = (plugins) => {
|
|
72139
|
+
const ordered = plugins.filter(
|
|
72140
|
+
(plugin) => plugin.order === "before" || plugin.order === void 0
|
|
72141
|
+
);
|
|
72142
|
+
ordered.push(
|
|
72143
|
+
...plugins.filter((plugin) => plugin.order === "core"),
|
|
72144
|
+
...plugins.filter((plugin) => plugin.order === "after")
|
|
72145
|
+
);
|
|
72146
|
+
return ordered;
|
|
72147
|
+
};
|
|
72064
72148
|
|
|
72065
72149
|
// src/lib/graphql.ts
|
|
72066
72150
|
var graphql3 = __toESM(require_graphql2(), 1);
|
|
@@ -72348,56 +72432,78 @@ var graphql4 = __toESM(require_graphql2(), 1);
|
|
|
72348
72432
|
async function find_graphql(config2, parsedScript, walker) {
|
|
72349
72433
|
await asyncWalk(parsedScript, {
|
|
72350
72434
|
async enter(node, parent) {
|
|
72351
|
-
if (node.type
|
|
72435
|
+
if (node.type !== "TaggedTemplateExpression" && node.type !== "CallExpression") {
|
|
72436
|
+
return;
|
|
72437
|
+
}
|
|
72438
|
+
let documentString;
|
|
72439
|
+
if (node.type === "TaggedTemplateExpression") {
|
|
72352
72440
|
const expr = node;
|
|
72353
|
-
|
|
72354
|
-
const parsedTag = graphql4.parse(tagContent);
|
|
72355
|
-
if (walker.where && !walker.where(parsedTag)) {
|
|
72441
|
+
if (expr.tag.type !== "Identifier" || expr.tag.name !== "graphql") {
|
|
72356
72442
|
return;
|
|
72357
72443
|
}
|
|
72358
|
-
|
|
72359
|
-
|
|
72360
|
-
|
|
72361
|
-
|
|
72444
|
+
documentString = expr.quasi.quasis[0].value.raw;
|
|
72445
|
+
} else if (node.type === "CallExpression") {
|
|
72446
|
+
const expr = node;
|
|
72447
|
+
if (expr.callee.type !== "Identifier" || expr.callee.name !== "graphql" || expr.arguments.length !== 1) {
|
|
72448
|
+
return;
|
|
72362
72449
|
}
|
|
72363
|
-
|
|
72364
|
-
if (
|
|
72365
|
-
|
|
72450
|
+
const argument = expr.arguments[0];
|
|
72451
|
+
if (argument.type === "TemplateLiteral") {
|
|
72452
|
+
documentString = argument.quasis[0].value.raw;
|
|
72453
|
+
} else if (argument.type === "StringLiteral") {
|
|
72454
|
+
documentString = argument.value;
|
|
72366
72455
|
} else {
|
|
72367
|
-
|
|
72368
|
-
|
|
72369
|
-
|
|
72370
|
-
|
|
72371
|
-
|
|
72372
|
-
|
|
72373
|
-
|
|
72456
|
+
return;
|
|
72457
|
+
}
|
|
72458
|
+
} else {
|
|
72459
|
+
return;
|
|
72460
|
+
}
|
|
72461
|
+
const parsedTag = graphql4.parse(documentString);
|
|
72462
|
+
if (walker.where && !walker.where(parsedTag)) {
|
|
72463
|
+
return;
|
|
72464
|
+
}
|
|
72465
|
+
const definition = config2.extractDefinition(parsedTag);
|
|
72466
|
+
const name2 = definition.name?.value;
|
|
72467
|
+
if (!name2) {
|
|
72468
|
+
throw new Error("Could not find definition name");
|
|
72469
|
+
}
|
|
72470
|
+
let kind;
|
|
72471
|
+
if (definition.kind === "FragmentDefinition") {
|
|
72472
|
+
kind = CompiledFragmentKind;
|
|
72473
|
+
} else {
|
|
72474
|
+
if (definition.operation === "query") {
|
|
72475
|
+
kind = CompiledQueryKind;
|
|
72476
|
+
} else if (definition.operation === "mutation") {
|
|
72477
|
+
kind = CompiledMutationKind;
|
|
72478
|
+
} else {
|
|
72479
|
+
kind = CompiledSubscriptionKind;
|
|
72374
72480
|
}
|
|
72375
|
-
walker.dependency?.(config2.artifactPath(parsedTag));
|
|
72376
|
-
await walker.tag({
|
|
72377
|
-
parsedDocument: parsedTag,
|
|
72378
|
-
node: {
|
|
72379
|
-
...node,
|
|
72380
|
-
...this,
|
|
72381
|
-
remove: this.remove,
|
|
72382
|
-
replaceWith: this.replace
|
|
72383
|
-
},
|
|
72384
|
-
artifact: {
|
|
72385
|
-
name: name2,
|
|
72386
|
-
kind
|
|
72387
|
-
},
|
|
72388
|
-
parent,
|
|
72389
|
-
tagContent
|
|
72390
|
-
});
|
|
72391
72481
|
}
|
|
72482
|
+
walker.dependency?.(config2.artifactPath(parsedTag));
|
|
72483
|
+
await walker.tag({
|
|
72484
|
+
parsedDocument: parsedTag,
|
|
72485
|
+
node: {
|
|
72486
|
+
...node,
|
|
72487
|
+
...this,
|
|
72488
|
+
remove: this.remove,
|
|
72489
|
+
replaceWith: this.replace
|
|
72490
|
+
},
|
|
72491
|
+
artifact: {
|
|
72492
|
+
name: name2,
|
|
72493
|
+
kind
|
|
72494
|
+
},
|
|
72495
|
+
parent,
|
|
72496
|
+
tagContent: documentString
|
|
72497
|
+
});
|
|
72392
72498
|
}
|
|
72393
72499
|
});
|
|
72394
72500
|
}
|
|
72395
72501
|
|
|
72396
72502
|
// src/codegen/index.ts
|
|
72397
|
-
var
|
|
72503
|
+
var graphql29 = __toESM(require_graphql2(), 1);
|
|
72398
72504
|
|
|
72399
72505
|
// src/codegen/generators/artifacts/index.ts
|
|
72400
|
-
var
|
|
72506
|
+
var graphql14 = __toESM(require_graphql2(), 1);
|
|
72401
72507
|
var recast5 = __toESM(require_main2(), 1);
|
|
72402
72508
|
|
|
72403
72509
|
// src/codegen/utils/commonjs.ts
|
|
@@ -72814,7 +72920,7 @@ function deepMerge(filepath, ...targets) {
|
|
|
72814
72920
|
Object.entries(fields).map(([key, value]) => [key, deepMerge(filepath, ...value)])
|
|
72815
72921
|
);
|
|
72816
72922
|
}
|
|
72817
|
-
function convertValue(val) {
|
|
72923
|
+
function convertValue(config2, val) {
|
|
72818
72924
|
let value;
|
|
72819
72925
|
let kind;
|
|
72820
72926
|
if (val.kind === graphql7.Kind.INT) {
|
|
@@ -72946,7 +73052,7 @@ function operationObject({
|
|
|
72946
73052
|
operationWhen[i2 ? "must_not" : "must"] = arg.value.fields.reduce(
|
|
72947
73053
|
(obj, arg2) => ({
|
|
72948
73054
|
...obj,
|
|
72949
|
-
[arg2.name.value]: convertValue(arg2.value).value
|
|
73055
|
+
[arg2.name.value]: convertValue(config2, arg2.value).value
|
|
72950
73056
|
}),
|
|
72951
73057
|
{}
|
|
72952
73058
|
);
|
|
@@ -72962,7 +73068,7 @@ function operationObject({
|
|
|
72962
73068
|
operationWhen[which] = directive.arguments?.reduce(
|
|
72963
73069
|
(filters, argument) => ({
|
|
72964
73070
|
...filters,
|
|
72965
|
-
[argument.name.value]: convertValue(argument.value).value
|
|
73071
|
+
[argument.name.value]: convertValue(config2, argument.value).value
|
|
72966
73072
|
}),
|
|
72967
73073
|
{}
|
|
72968
73074
|
);
|
|
@@ -73001,7 +73107,7 @@ function ancestorKey(ancestors) {
|
|
|
73001
73107
|
}
|
|
73002
73108
|
|
|
73003
73109
|
// src/codegen/generators/artifacts/selection.ts
|
|
73004
|
-
var
|
|
73110
|
+
var graphql13 = __toESM(require_graphql2(), 1);
|
|
73005
73111
|
|
|
73006
73112
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
73007
73113
|
var config = {
|
|
@@ -73041,10 +73147,24 @@ function logYellow(str) {
|
|
|
73041
73147
|
}
|
|
73042
73148
|
|
|
73043
73149
|
// src/codegen/transforms/list.ts
|
|
73044
|
-
var
|
|
73150
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
73045
73151
|
|
|
73046
|
-
// src/codegen/
|
|
73152
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
73047
73153
|
var graphql9 = __toESM(require_graphql2(), 1);
|
|
73154
|
+
var objectIdentificationSelection = (config2, type) => {
|
|
73155
|
+
return config2.keyFieldsForType(type.name).map((key) => {
|
|
73156
|
+
return {
|
|
73157
|
+
kind: graphql9.Kind.FIELD,
|
|
73158
|
+
name: {
|
|
73159
|
+
kind: graphql9.Kind.NAME,
|
|
73160
|
+
value: key
|
|
73161
|
+
}
|
|
73162
|
+
};
|
|
73163
|
+
});
|
|
73164
|
+
};
|
|
73165
|
+
|
|
73166
|
+
// src/codegen/transforms/paginate.ts
|
|
73167
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
73048
73168
|
async function paginate(config2, documents) {
|
|
73049
73169
|
const newDocs = [];
|
|
73050
73170
|
for (const doc of documents) {
|
|
@@ -73077,7 +73197,7 @@ async function paginate(config2, documents) {
|
|
|
73077
73197
|
};
|
|
73078
73198
|
let cursorType = "String";
|
|
73079
73199
|
let paginationPath = [];
|
|
73080
|
-
doc.document =
|
|
73200
|
+
doc.document = graphql10.visit(doc.document, {
|
|
73081
73201
|
Field(node, _, __, ___, ancestors) {
|
|
73082
73202
|
const paginateDirective = node.directives?.find(
|
|
73083
73203
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -73104,7 +73224,7 @@ async function paginate(config2, documents) {
|
|
|
73104
73224
|
flags.offset.enabled = offsetPagination;
|
|
73105
73225
|
flags.limit.enabled = offsetPagination;
|
|
73106
73226
|
paginationPath = ancestors.filter(
|
|
73107
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
73227
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql10.Kind.FIELD
|
|
73108
73228
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
73109
73229
|
return {
|
|
73110
73230
|
...node,
|
|
@@ -73125,7 +73245,7 @@ async function paginate(config2, documents) {
|
|
|
73125
73245
|
refetchUpdate = "prepend" /* prepend */;
|
|
73126
73246
|
}
|
|
73127
73247
|
let fragment = "";
|
|
73128
|
-
doc.document =
|
|
73248
|
+
doc.document = graphql10.visit(doc.document, {
|
|
73129
73249
|
OperationDefinition(node) {
|
|
73130
73250
|
if (node.operation !== "query") {
|
|
73131
73251
|
throw new HoudiniError({
|
|
@@ -73179,9 +73299,9 @@ async function paginate(config2, documents) {
|
|
|
73179
73299
|
directives: [
|
|
73180
73300
|
...node.directives || [],
|
|
73181
73301
|
{
|
|
73182
|
-
kind:
|
|
73302
|
+
kind: graphql10.Kind.DIRECTIVE,
|
|
73183
73303
|
name: {
|
|
73184
|
-
kind:
|
|
73304
|
+
kind: graphql10.Kind.NAME,
|
|
73185
73305
|
value: config2.argumentsDirective
|
|
73186
73306
|
}
|
|
73187
73307
|
}
|
|
@@ -73244,16 +73364,16 @@ async function paginate(config2, documents) {
|
|
|
73244
73364
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
73245
73365
|
const fragmentSpreadSelection = [
|
|
73246
73366
|
{
|
|
73247
|
-
kind:
|
|
73367
|
+
kind: graphql10.Kind.FRAGMENT_SPREAD,
|
|
73248
73368
|
name: {
|
|
73249
|
-
kind:
|
|
73369
|
+
kind: graphql10.Kind.NAME,
|
|
73250
73370
|
value: fragmentName
|
|
73251
73371
|
},
|
|
73252
73372
|
directives: [
|
|
73253
73373
|
{
|
|
73254
|
-
kind:
|
|
73374
|
+
kind: graphql10.Kind.DIRECTIVE,
|
|
73255
73375
|
name: {
|
|
73256
|
-
kind:
|
|
73376
|
+
kind: graphql10.Kind.NAME,
|
|
73257
73377
|
value: config2.withDirective
|
|
73258
73378
|
},
|
|
73259
73379
|
["arguments"]: paginationArgs.map(
|
|
@@ -73281,29 +73401,29 @@ async function paginate(config2, documents) {
|
|
|
73281
73401
|
});
|
|
73282
73402
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
73283
73403
|
const queryDoc = {
|
|
73284
|
-
kind:
|
|
73404
|
+
kind: graphql10.Kind.DOCUMENT,
|
|
73285
73405
|
definitions: [
|
|
73286
73406
|
{
|
|
73287
|
-
kind:
|
|
73407
|
+
kind: graphql10.Kind.OPERATION_DEFINITION,
|
|
73288
73408
|
name: {
|
|
73289
|
-
kind:
|
|
73409
|
+
kind: graphql10.Kind.NAME,
|
|
73290
73410
|
value: refetchQueryName
|
|
73291
73411
|
},
|
|
73292
73412
|
operation: "query",
|
|
73293
73413
|
variableDefinitions: paginationArgs.map(
|
|
73294
73414
|
(arg) => ({
|
|
73295
|
-
kind:
|
|
73415
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73296
73416
|
type: {
|
|
73297
|
-
kind:
|
|
73417
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
73298
73418
|
name: {
|
|
73299
|
-
kind:
|
|
73419
|
+
kind: graphql10.Kind.NAME,
|
|
73300
73420
|
value: arg.type
|
|
73301
73421
|
}
|
|
73302
73422
|
},
|
|
73303
73423
|
variable: {
|
|
73304
|
-
kind:
|
|
73424
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73305
73425
|
name: {
|
|
73306
|
-
kind:
|
|
73426
|
+
kind: graphql10.Kind.NAME,
|
|
73307
73427
|
value: arg.name
|
|
73308
73428
|
}
|
|
73309
73429
|
},
|
|
@@ -73315,12 +73435,12 @@ async function paginate(config2, documents) {
|
|
|
73315
73435
|
).concat(
|
|
73316
73436
|
!nodeQuery ? [] : keys.map(
|
|
73317
73437
|
(key) => ({
|
|
73318
|
-
kind:
|
|
73438
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73319
73439
|
type: key.type,
|
|
73320
73440
|
variable: {
|
|
73321
|
-
kind:
|
|
73441
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73322
73442
|
name: {
|
|
73323
|
-
kind:
|
|
73443
|
+
kind: graphql10.Kind.NAME,
|
|
73324
73444
|
value: key.name
|
|
73325
73445
|
}
|
|
73326
73446
|
}
|
|
@@ -73328,42 +73448,42 @@ async function paginate(config2, documents) {
|
|
|
73328
73448
|
)
|
|
73329
73449
|
),
|
|
73330
73450
|
selectionSet: {
|
|
73331
|
-
kind:
|
|
73451
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73332
73452
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
73333
73453
|
{
|
|
73334
|
-
kind:
|
|
73454
|
+
kind: graphql10.Kind.FIELD,
|
|
73335
73455
|
name: {
|
|
73336
|
-
kind:
|
|
73456
|
+
kind: graphql10.Kind.NAME,
|
|
73337
73457
|
value: typeConfig?.resolve?.queryField || "node"
|
|
73338
73458
|
},
|
|
73339
73459
|
["arguments"]: keys.map((key) => ({
|
|
73340
|
-
kind:
|
|
73460
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73341
73461
|
name: {
|
|
73342
|
-
kind:
|
|
73462
|
+
kind: graphql10.Kind.NAME,
|
|
73343
73463
|
value: key.name
|
|
73344
73464
|
},
|
|
73345
73465
|
value: {
|
|
73346
|
-
kind:
|
|
73466
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73347
73467
|
name: {
|
|
73348
|
-
kind:
|
|
73468
|
+
kind: graphql10.Kind.NAME,
|
|
73349
73469
|
value: key.name
|
|
73350
73470
|
}
|
|
73351
73471
|
}
|
|
73352
73472
|
})),
|
|
73353
73473
|
selectionSet: {
|
|
73354
|
-
kind:
|
|
73474
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73355
73475
|
selections: [
|
|
73356
73476
|
{
|
|
73357
|
-
kind:
|
|
73477
|
+
kind: graphql10.Kind.FIELD,
|
|
73358
73478
|
name: {
|
|
73359
|
-
kind:
|
|
73479
|
+
kind: graphql10.Kind.NAME,
|
|
73360
73480
|
value: "__typename"
|
|
73361
73481
|
}
|
|
73362
73482
|
},
|
|
73363
73483
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
73364
|
-
kind:
|
|
73484
|
+
kind: graphql10.Kind.FIELD,
|
|
73365
73485
|
name: {
|
|
73366
|
-
kind:
|
|
73486
|
+
kind: graphql10.Kind.NAME,
|
|
73367
73487
|
value: key
|
|
73368
73488
|
}
|
|
73369
73489
|
})),
|
|
@@ -73425,15 +73545,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
73425
73545
|
}
|
|
73426
73546
|
function variableAsArgument(name2, variable) {
|
|
73427
73547
|
return {
|
|
73428
|
-
kind:
|
|
73548
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73429
73549
|
name: {
|
|
73430
|
-
kind:
|
|
73550
|
+
kind: graphql10.Kind.NAME,
|
|
73431
73551
|
value: name2
|
|
73432
73552
|
},
|
|
73433
73553
|
value: {
|
|
73434
|
-
kind:
|
|
73554
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73435
73555
|
name: {
|
|
73436
|
-
kind:
|
|
73556
|
+
kind: graphql10.Kind.NAME,
|
|
73437
73557
|
value: variable ?? name2
|
|
73438
73558
|
}
|
|
73439
73559
|
}
|
|
@@ -73441,18 +73561,18 @@ function variableAsArgument(name2, variable) {
|
|
|
73441
73561
|
}
|
|
73442
73562
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
73443
73563
|
return {
|
|
73444
|
-
kind:
|
|
73564
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
73445
73565
|
type: {
|
|
73446
|
-
kind:
|
|
73566
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
73447
73567
|
name: {
|
|
73448
|
-
kind:
|
|
73568
|
+
kind: graphql10.Kind.NAME,
|
|
73449
73569
|
value: type
|
|
73450
73570
|
}
|
|
73451
73571
|
},
|
|
73452
73572
|
variable: {
|
|
73453
|
-
kind:
|
|
73573
|
+
kind: graphql10.Kind.VARIABLE,
|
|
73454
73574
|
name: {
|
|
73455
|
-
kind:
|
|
73575
|
+
kind: graphql10.Kind.NAME,
|
|
73456
73576
|
value: variableName ?? name2
|
|
73457
73577
|
}
|
|
73458
73578
|
},
|
|
@@ -73464,9 +73584,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
73464
73584
|
}
|
|
73465
73585
|
function argumentNode(name2, value) {
|
|
73466
73586
|
return {
|
|
73467
|
-
kind:
|
|
73587
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
73468
73588
|
name: {
|
|
73469
|
-
kind:
|
|
73589
|
+
kind: graphql10.Kind.NAME,
|
|
73470
73590
|
value: name2
|
|
73471
73591
|
},
|
|
73472
73592
|
value: objectNode(value)
|
|
@@ -73474,16 +73594,16 @@ function argumentNode(name2, value) {
|
|
|
73474
73594
|
}
|
|
73475
73595
|
function objectNode([type, defaultValue]) {
|
|
73476
73596
|
const node = {
|
|
73477
|
-
kind:
|
|
73597
|
+
kind: graphql10.Kind.OBJECT,
|
|
73478
73598
|
fields: [
|
|
73479
73599
|
{
|
|
73480
|
-
kind:
|
|
73600
|
+
kind: graphql10.Kind.OBJECT_FIELD,
|
|
73481
73601
|
name: {
|
|
73482
|
-
kind:
|
|
73602
|
+
kind: graphql10.Kind.NAME,
|
|
73483
73603
|
value: "type"
|
|
73484
73604
|
},
|
|
73485
73605
|
value: {
|
|
73486
|
-
kind:
|
|
73606
|
+
kind: graphql10.Kind.STRING,
|
|
73487
73607
|
value: type
|
|
73488
73608
|
}
|
|
73489
73609
|
}
|
|
@@ -73491,8 +73611,8 @@ function objectNode([type, defaultValue]) {
|
|
|
73491
73611
|
};
|
|
73492
73612
|
if (defaultValue) {
|
|
73493
73613
|
node.fields.push({
|
|
73494
|
-
kind:
|
|
73495
|
-
name: { kind:
|
|
73614
|
+
kind: graphql10.Kind.OBJECT_FIELD,
|
|
73615
|
+
name: { kind: graphql10.Kind.NAME, value: "default" },
|
|
73496
73616
|
value: {
|
|
73497
73617
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
73498
73618
|
value: defaultValue.toString()
|
|
@@ -73503,34 +73623,34 @@ function objectNode([type, defaultValue]) {
|
|
|
73503
73623
|
}
|
|
73504
73624
|
var pageInfoSelection = [
|
|
73505
73625
|
{
|
|
73506
|
-
kind:
|
|
73626
|
+
kind: graphql10.Kind.FIELD,
|
|
73507
73627
|
name: {
|
|
73508
|
-
kind:
|
|
73628
|
+
kind: graphql10.Kind.NAME,
|
|
73509
73629
|
value: "edges"
|
|
73510
73630
|
},
|
|
73511
73631
|
selectionSet: {
|
|
73512
|
-
kind:
|
|
73632
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73513
73633
|
selections: [
|
|
73514
73634
|
{
|
|
73515
|
-
kind:
|
|
73635
|
+
kind: graphql10.Kind.FIELD,
|
|
73516
73636
|
name: {
|
|
73517
|
-
kind:
|
|
73637
|
+
kind: graphql10.Kind.NAME,
|
|
73518
73638
|
value: "cursor"
|
|
73519
73639
|
}
|
|
73520
73640
|
},
|
|
73521
73641
|
{
|
|
73522
|
-
kind:
|
|
73642
|
+
kind: graphql10.Kind.FIELD,
|
|
73523
73643
|
name: {
|
|
73524
|
-
kind:
|
|
73644
|
+
kind: graphql10.Kind.NAME,
|
|
73525
73645
|
value: "node"
|
|
73526
73646
|
},
|
|
73527
73647
|
selectionSet: {
|
|
73528
|
-
kind:
|
|
73648
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73529
73649
|
selections: [
|
|
73530
73650
|
{
|
|
73531
|
-
kind:
|
|
73651
|
+
kind: graphql10.Kind.FIELD,
|
|
73532
73652
|
name: {
|
|
73533
|
-
kind:
|
|
73653
|
+
kind: graphql10.Kind.NAME,
|
|
73534
73654
|
value: "__typename"
|
|
73535
73655
|
}
|
|
73536
73656
|
}
|
|
@@ -73541,39 +73661,39 @@ var pageInfoSelection = [
|
|
|
73541
73661
|
}
|
|
73542
73662
|
},
|
|
73543
73663
|
{
|
|
73544
|
-
kind:
|
|
73664
|
+
kind: graphql10.Kind.FIELD,
|
|
73545
73665
|
name: {
|
|
73546
|
-
kind:
|
|
73666
|
+
kind: graphql10.Kind.NAME,
|
|
73547
73667
|
value: "pageInfo"
|
|
73548
73668
|
},
|
|
73549
73669
|
selectionSet: {
|
|
73550
|
-
kind:
|
|
73670
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73551
73671
|
selections: [
|
|
73552
73672
|
{
|
|
73553
|
-
kind:
|
|
73673
|
+
kind: graphql10.Kind.FIELD,
|
|
73554
73674
|
name: {
|
|
73555
|
-
kind:
|
|
73675
|
+
kind: graphql10.Kind.NAME,
|
|
73556
73676
|
value: "hasPreviousPage"
|
|
73557
73677
|
}
|
|
73558
73678
|
},
|
|
73559
73679
|
{
|
|
73560
|
-
kind:
|
|
73680
|
+
kind: graphql10.Kind.FIELD,
|
|
73561
73681
|
name: {
|
|
73562
|
-
kind:
|
|
73682
|
+
kind: graphql10.Kind.NAME,
|
|
73563
73683
|
value: "hasNextPage"
|
|
73564
73684
|
}
|
|
73565
73685
|
},
|
|
73566
73686
|
{
|
|
73567
|
-
kind:
|
|
73687
|
+
kind: graphql10.Kind.FIELD,
|
|
73568
73688
|
name: {
|
|
73569
|
-
kind:
|
|
73689
|
+
kind: graphql10.Kind.NAME,
|
|
73570
73690
|
value: "startCursor"
|
|
73571
73691
|
}
|
|
73572
73692
|
},
|
|
73573
73693
|
{
|
|
73574
|
-
kind:
|
|
73694
|
+
kind: graphql10.Kind.FIELD,
|
|
73575
73695
|
name: {
|
|
73576
|
-
kind:
|
|
73696
|
+
kind: graphql10.Kind.NAME,
|
|
73577
73697
|
value: "endCursor"
|
|
73578
73698
|
}
|
|
73579
73699
|
}
|
|
@@ -73587,15 +73707,15 @@ async function addListFragments(config2, documents) {
|
|
|
73587
73707
|
const lists = {};
|
|
73588
73708
|
const errors = [];
|
|
73589
73709
|
for (const doc of documents) {
|
|
73590
|
-
doc.document =
|
|
73710
|
+
doc.document = graphql11.visit(doc.document, {
|
|
73591
73711
|
Directive(node, key, parent, path2, ancestors) {
|
|
73592
73712
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
73593
73713
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
73594
73714
|
let error = {
|
|
73595
|
-
...new
|
|
73715
|
+
...new graphql11.GraphQLError(
|
|
73596
73716
|
"",
|
|
73597
73717
|
node,
|
|
73598
|
-
new
|
|
73718
|
+
new graphql11.Source(""),
|
|
73599
73719
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
73600
73720
|
path2
|
|
73601
73721
|
),
|
|
@@ -73647,7 +73767,7 @@ async function addListFragments(config2, documents) {
|
|
|
73647
73767
|
{
|
|
73648
73768
|
kind: "Argument",
|
|
73649
73769
|
name: {
|
|
73650
|
-
kind:
|
|
73770
|
+
kind: graphql11.Kind.NAME,
|
|
73651
73771
|
value: "connection"
|
|
73652
73772
|
},
|
|
73653
73773
|
value: {
|
|
@@ -73694,10 +73814,13 @@ async function addListFragments(config2, documents) {
|
|
|
73694
73814
|
if (errors.length > 0) {
|
|
73695
73815
|
throw errors;
|
|
73696
73816
|
}
|
|
73697
|
-
const
|
|
73817
|
+
const validDeletes = [
|
|
73698
73818
|
...new Set(
|
|
73699
73819
|
Object.values(lists).map(({ type }) => {
|
|
73700
|
-
if (!(type instanceof
|
|
73820
|
+
if (!(type instanceof graphql11.GraphQLObjectType)) {
|
|
73821
|
+
return "";
|
|
73822
|
+
}
|
|
73823
|
+
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
73701
73824
|
return "";
|
|
73702
73825
|
}
|
|
73703
73826
|
return type.name;
|
|
@@ -73708,7 +73831,7 @@ async function addListFragments(config2, documents) {
|
|
|
73708
73831
|
return;
|
|
73709
73832
|
}
|
|
73710
73833
|
const generatedDoc = {
|
|
73711
|
-
kind:
|
|
73834
|
+
kind: graphql11.Kind.DOCUMENT,
|
|
73712
73835
|
definitions: Object.entries(lists).flatMap(
|
|
73713
73836
|
([name2, { selection: selection2, type }]) => {
|
|
73714
73837
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -73716,35 +73839,29 @@ async function addListFragments(config2, documents) {
|
|
|
73716
73839
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
73717
73840
|
}
|
|
73718
73841
|
const fragmentSelection = {
|
|
73719
|
-
kind:
|
|
73842
|
+
kind: graphql11.Kind.SELECTION_SET,
|
|
73720
73843
|
selections: [...selection2.selections]
|
|
73721
73844
|
};
|
|
73722
73845
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
73723
|
-
(field) => field.kind === "Field" && field.name.value
|
|
73846
|
+
(field) => field.kind === "Field" && config2.keyFieldsForType(type.name).includes(field.name.value)
|
|
73724
73847
|
)) {
|
|
73725
73848
|
fragmentSelection.selections = [
|
|
73726
73849
|
...fragmentSelection.selections,
|
|
73727
|
-
|
|
73728
|
-
kind: graphql10.Kind.FIELD,
|
|
73729
|
-
name: {
|
|
73730
|
-
kind: graphql10.Kind.NAME,
|
|
73731
|
-
value: "id"
|
|
73732
|
-
}
|
|
73733
|
-
}
|
|
73850
|
+
...objectIdentificationSelection(config2, type)
|
|
73734
73851
|
];
|
|
73735
73852
|
}
|
|
73736
73853
|
return [
|
|
73737
73854
|
{
|
|
73738
73855
|
name: {
|
|
73739
73856
|
value: config2.listInsertFragment(name2),
|
|
73740
|
-
kind:
|
|
73857
|
+
kind: graphql11.Kind.NAME
|
|
73741
73858
|
},
|
|
73742
|
-
kind:
|
|
73859
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73743
73860
|
selectionSet: fragmentSelection,
|
|
73744
73861
|
typeCondition: {
|
|
73745
|
-
kind:
|
|
73862
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73746
73863
|
name: {
|
|
73747
|
-
kind:
|
|
73864
|
+
kind: graphql11.Kind.NAME,
|
|
73748
73865
|
value: type.name
|
|
73749
73866
|
}
|
|
73750
73867
|
}
|
|
@@ -73752,52 +73869,32 @@ async function addListFragments(config2, documents) {
|
|
|
73752
73869
|
{
|
|
73753
73870
|
name: {
|
|
73754
73871
|
value: config2.listToggleFragment(name2),
|
|
73755
|
-
kind:
|
|
73756
|
-
},
|
|
73757
|
-
kind: graphql10.Kind.FRAGMENT_DEFINITION,
|
|
73758
|
-
selectionSet: {
|
|
73759
|
-
...fragmentSelection,
|
|
73760
|
-
selections: [
|
|
73761
|
-
...fragmentSelection.selections,
|
|
73762
|
-
{
|
|
73763
|
-
kind: graphql10.Kind.FIELD,
|
|
73764
|
-
name: {
|
|
73765
|
-
kind: graphql10.Kind.NAME,
|
|
73766
|
-
value: "id"
|
|
73767
|
-
}
|
|
73768
|
-
}
|
|
73769
|
-
]
|
|
73872
|
+
kind: graphql11.Kind.NAME
|
|
73770
73873
|
},
|
|
73874
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73875
|
+
selectionSet: fragmentSelection,
|
|
73771
73876
|
typeCondition: {
|
|
73772
|
-
kind:
|
|
73877
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73773
73878
|
name: {
|
|
73774
|
-
kind:
|
|
73879
|
+
kind: graphql11.Kind.NAME,
|
|
73775
73880
|
value: type.name
|
|
73776
73881
|
}
|
|
73777
73882
|
}
|
|
73778
73883
|
},
|
|
73779
73884
|
{
|
|
73780
|
-
kind:
|
|
73885
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
73781
73886
|
name: {
|
|
73782
73887
|
value: config2.listRemoveFragment(name2),
|
|
73783
|
-
kind:
|
|
73888
|
+
kind: graphql11.Kind.NAME
|
|
73784
73889
|
},
|
|
73785
73890
|
selectionSet: {
|
|
73786
|
-
kind:
|
|
73787
|
-
selections: [
|
|
73788
|
-
{
|
|
73789
|
-
kind: graphql10.Kind.FIELD,
|
|
73790
|
-
name: {
|
|
73791
|
-
kind: graphql10.Kind.NAME,
|
|
73792
|
-
value: "id"
|
|
73793
|
-
}
|
|
73794
|
-
}
|
|
73795
|
-
]
|
|
73891
|
+
kind: graphql11.Kind.SELECTION_SET,
|
|
73892
|
+
selections: [...objectIdentificationSelection(config2, type)]
|
|
73796
73893
|
},
|
|
73797
73894
|
typeCondition: {
|
|
73798
|
-
kind:
|
|
73895
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
73799
73896
|
name: {
|
|
73800
|
-
kind:
|
|
73897
|
+
kind: graphql11.Kind.NAME,
|
|
73801
73898
|
value: type.name
|
|
73802
73899
|
}
|
|
73803
73900
|
}
|
|
@@ -73805,15 +73902,15 @@ async function addListFragments(config2, documents) {
|
|
|
73805
73902
|
];
|
|
73806
73903
|
}
|
|
73807
73904
|
).concat(
|
|
73808
|
-
...
|
|
73809
|
-
kind:
|
|
73905
|
+
...validDeletes.map((typeName) => ({
|
|
73906
|
+
kind: graphql11.Kind.DIRECTIVE_DEFINITION,
|
|
73810
73907
|
name: {
|
|
73811
|
-
kind:
|
|
73908
|
+
kind: graphql11.Kind.NAME,
|
|
73812
73909
|
value: config2.listDeleteDirective(typeName)
|
|
73813
73910
|
},
|
|
73814
73911
|
locations: [
|
|
73815
73912
|
{
|
|
73816
|
-
kind:
|
|
73913
|
+
kind: graphql11.Kind.NAME,
|
|
73817
73914
|
value: "FIELD"
|
|
73818
73915
|
}
|
|
73819
73916
|
],
|
|
@@ -73821,8 +73918,8 @@ async function addListFragments(config2, documents) {
|
|
|
73821
73918
|
}))
|
|
73822
73919
|
)
|
|
73823
73920
|
};
|
|
73824
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
73825
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
73921
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql11.print).join("\n\n");
|
|
73922
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql11.print).join("\n\n");
|
|
73826
73923
|
documents.push({
|
|
73827
73924
|
name: "generated::lists",
|
|
73828
73925
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -73907,11 +74004,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
73907
74004
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
73908
74005
|
|
|
73909
74006
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
73910
|
-
var
|
|
74007
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
73911
74008
|
function fieldKey(config2, field) {
|
|
73912
74009
|
const attributeName = field.alias?.value || field.name.value;
|
|
73913
|
-
const printed =
|
|
73914
|
-
const secondParse =
|
|
74010
|
+
const printed = graphql12.print(field);
|
|
74011
|
+
const secondParse = graphql12.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
73915
74012
|
const paginated = !!field.directives?.find(
|
|
73916
74013
|
(directive) => directive.name.value === config2.paginateDirective
|
|
73917
74014
|
);
|
|
@@ -73930,7 +74027,9 @@ function fieldKey(config2, field) {
|
|
|
73930
74027
|
[arg.name.value]: printed.substring(start - 1, end - 1)
|
|
73931
74028
|
};
|
|
73932
74029
|
}, {});
|
|
73933
|
-
|
|
74030
|
+
const args = Object.keys(argObj);
|
|
74031
|
+
args.sort();
|
|
74032
|
+
let key = Object.values(argObj).length > 0 ? `${attributeName}(${args.map((key2) => `${key2}: ${argObj[key2]}`).join(", ")})` : attributeName;
|
|
73934
74033
|
if (paginated) {
|
|
73935
74034
|
key = key + "::paginated";
|
|
73936
74035
|
}
|
|
@@ -74004,8 +74103,8 @@ function selection({
|
|
|
74004
74103
|
const typeConditionName = field.typeCondition.name.value;
|
|
74005
74104
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
74006
74105
|
const possibleTypes = [];
|
|
74007
|
-
if (!
|
|
74008
|
-
} else if (
|
|
74106
|
+
if (!graphql13.isAbstractType(typeCondition)) {
|
|
74107
|
+
} else if (graphql13.isAbstractType(parentType)) {
|
|
74009
74108
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
74010
74109
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
74011
74110
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -74053,7 +74152,7 @@ function selection({
|
|
|
74053
74152
|
} else {
|
|
74054
74153
|
let typeRef = type.getFields()[field.name.value].type;
|
|
74055
74154
|
fieldType = getRootType(typeRef);
|
|
74056
|
-
nullable = !
|
|
74155
|
+
nullable = !graphql13.isNonNullType(typeRef);
|
|
74057
74156
|
}
|
|
74058
74157
|
const typeName = fieldType.toString();
|
|
74059
74158
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -74113,12 +74212,12 @@ function selection({
|
|
|
74113
74212
|
fieldObj.filters = (field.arguments || []).reduce(
|
|
74114
74213
|
(filters, arg) => ({
|
|
74115
74214
|
...filters,
|
|
74116
|
-
[arg.name.value]: convertValue(arg.value)
|
|
74215
|
+
[arg.name.value]: convertValue(config2, arg.value)
|
|
74117
74216
|
}),
|
|
74118
74217
|
{}
|
|
74119
74218
|
);
|
|
74120
74219
|
}
|
|
74121
|
-
if (
|
|
74220
|
+
if (graphql13.isInterfaceType(fieldType) || graphql13.isUnionType(fieldType)) {
|
|
74122
74221
|
fieldObj.abstract = true;
|
|
74123
74222
|
}
|
|
74124
74223
|
object.fields = {
|
|
@@ -74175,7 +74274,7 @@ function artifactGenerator(stats) {
|
|
|
74175
74274
|
return async function(config2, docs) {
|
|
74176
74275
|
const filterTypes = {};
|
|
74177
74276
|
for (const doc of docs) {
|
|
74178
|
-
|
|
74277
|
+
graphql14.visit(doc.document, {
|
|
74179
74278
|
Directive(node, _, __, ___, ancestors) {
|
|
74180
74279
|
if (node.name.value !== config2.listDirective) {
|
|
74181
74280
|
return;
|
|
@@ -74234,7 +74333,7 @@ function artifactGenerator(stats) {
|
|
|
74234
74333
|
return;
|
|
74235
74334
|
}
|
|
74236
74335
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
74237
|
-
let documentWithoutInternalDirectives =
|
|
74336
|
+
let documentWithoutInternalDirectives = graphql14.visit(document, {
|
|
74238
74337
|
Directive(node) {
|
|
74239
74338
|
if (config2.isInternalDirective(node)) {
|
|
74240
74339
|
return null;
|
|
@@ -74247,7 +74346,7 @@ function artifactGenerator(stats) {
|
|
|
74247
74346
|
}
|
|
74248
74347
|
}
|
|
74249
74348
|
});
|
|
74250
|
-
let documentWithoutExtraVariables =
|
|
74349
|
+
let documentWithoutExtraVariables = graphql14.visit(
|
|
74251
74350
|
documentWithoutInternalDirectives,
|
|
74252
74351
|
{
|
|
74253
74352
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -74258,13 +74357,13 @@ function artifactGenerator(stats) {
|
|
|
74258
74357
|
}
|
|
74259
74358
|
}
|
|
74260
74359
|
);
|
|
74261
|
-
let rawString =
|
|
74360
|
+
let rawString = graphql14.print(documentWithoutExtraVariables);
|
|
74262
74361
|
let docKind = doc.kind;
|
|
74263
74362
|
const operations = document.definitions.filter(
|
|
74264
|
-
({ kind }) => kind ===
|
|
74363
|
+
({ kind }) => kind === graphql14.Kind.OPERATION_DEFINITION
|
|
74265
74364
|
);
|
|
74266
74365
|
const fragments = document.definitions.filter(
|
|
74267
|
-
({ kind }) => kind ===
|
|
74366
|
+
({ kind }) => kind === graphql14.Kind.FRAGMENT_DEFINITION
|
|
74268
74367
|
);
|
|
74269
74368
|
let rootType = "";
|
|
74270
74369
|
let selectionSet;
|
|
@@ -74400,7 +74499,9 @@ function artifactGenerator(stats) {
|
|
|
74400
74499
|
}
|
|
74401
74500
|
|
|
74402
74501
|
// src/codegen/generators/runtime/index.ts
|
|
74403
|
-
|
|
74502
|
+
var recast6 = __toESM(require_main2(), 1);
|
|
74503
|
+
var AST6 = recast6.types.builders;
|
|
74504
|
+
async function runtimeGenerator(config2, docs) {
|
|
74404
74505
|
await Promise.all([
|
|
74405
74506
|
fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
|
|
74406
74507
|
[path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
|
|
@@ -74414,6 +74515,59 @@ async function runtimeGenerator(config2) {
|
|
|
74414
74515
|
}),
|
|
74415
74516
|
...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
|
|
74416
74517
|
]);
|
|
74518
|
+
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
74519
|
+
const contents = await parseJS(await fs_exports.readFile(indexPath) || "");
|
|
74520
|
+
const graphql_tag_return = config2.plugins.find(
|
|
74521
|
+
(plugin) => plugin.graphql_tag_return
|
|
74522
|
+
)?.graphql_tag_return;
|
|
74523
|
+
if (graphql_tag_return && contents) {
|
|
74524
|
+
const overloaded_returns = {};
|
|
74525
|
+
for (const doc of docs) {
|
|
74526
|
+
const return_value = graphql_tag_return({
|
|
74527
|
+
config: config2,
|
|
74528
|
+
doc,
|
|
74529
|
+
ensure_import({ identifier, module }) {
|
|
74530
|
+
ensureImports({
|
|
74531
|
+
config: config2,
|
|
74532
|
+
body: contents.script.body,
|
|
74533
|
+
sourceModule: module,
|
|
74534
|
+
import: [identifier]
|
|
74535
|
+
});
|
|
74536
|
+
}
|
|
74537
|
+
});
|
|
74538
|
+
if (return_value) {
|
|
74539
|
+
overloaded_returns[doc.originalString] = return_value;
|
|
74540
|
+
}
|
|
74541
|
+
}
|
|
74542
|
+
if (Object.keys(overloaded_returns).length > 0) {
|
|
74543
|
+
for (const [i2, expression] of (contents?.script.body ?? []).entries()) {
|
|
74544
|
+
if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
|
|
74545
|
+
continue;
|
|
74546
|
+
}
|
|
74547
|
+
for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
|
|
74548
|
+
const input = AST6.identifier("str");
|
|
74549
|
+
input.typeAnnotation = AST6.tsTypeAnnotation(
|
|
74550
|
+
AST6.tsLiteralType(AST6.stringLiteral(queryString))
|
|
74551
|
+
);
|
|
74552
|
+
contents?.script.body.splice(
|
|
74553
|
+
i2,
|
|
74554
|
+
0,
|
|
74555
|
+
AST6.exportNamedDeclaration(
|
|
74556
|
+
AST6.tsDeclareFunction(
|
|
74557
|
+
AST6.identifier("graphql"),
|
|
74558
|
+
[input],
|
|
74559
|
+
AST6.tsTypeAnnotation(
|
|
74560
|
+
AST6.tsTypeReference(AST6.identifier(returnValue))
|
|
74561
|
+
)
|
|
74562
|
+
)
|
|
74563
|
+
)
|
|
74564
|
+
);
|
|
74565
|
+
}
|
|
74566
|
+
break;
|
|
74567
|
+
}
|
|
74568
|
+
await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
|
|
74569
|
+
}
|
|
74570
|
+
}
|
|
74417
74571
|
}
|
|
74418
74572
|
async function generatePluginRuntime(config2, plugin) {
|
|
74419
74573
|
if (houdini_mode.is_testing) {
|
|
@@ -74448,20 +74602,20 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
74448
74602
|
}
|
|
74449
74603
|
|
|
74450
74604
|
// src/codegen/generators/typescript/index.ts
|
|
74451
|
-
var
|
|
74605
|
+
var recast12 = __toESM(require_main2(), 1);
|
|
74452
74606
|
|
|
74453
74607
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
74608
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
74609
|
+
var recast9 = __toESM(require_main2(), 1);
|
|
74610
|
+
|
|
74611
|
+
// src/codegen/generators/typescript/typeReference.ts
|
|
74454
74612
|
var graphql16 = __toESM(require_graphql2(), 1);
|
|
74455
74613
|
var recast8 = __toESM(require_main2(), 1);
|
|
74456
74614
|
|
|
74457
|
-
// src/codegen/generators/typescript/
|
|
74615
|
+
// src/codegen/generators/typescript/types.ts
|
|
74458
74616
|
var graphql15 = __toESM(require_graphql2(), 1);
|
|
74459
74617
|
var recast7 = __toESM(require_main2(), 1);
|
|
74460
|
-
|
|
74461
|
-
// src/codegen/generators/typescript/types.ts
|
|
74462
|
-
var graphql14 = __toESM(require_graphql2(), 1);
|
|
74463
|
-
var recast6 = __toESM(require_main2(), 1);
|
|
74464
|
-
var AST6 = recast6.types.builders;
|
|
74618
|
+
var AST7 = recast7.types.builders;
|
|
74465
74619
|
function readonlyProperty(prop, enable = true) {
|
|
74466
74620
|
if (enable) {
|
|
74467
74621
|
prop.readonly = true;
|
|
@@ -74469,31 +74623,31 @@ function readonlyProperty(prop, enable = true) {
|
|
|
74469
74623
|
return prop;
|
|
74470
74624
|
}
|
|
74471
74625
|
function nullableField(inner, input = false) {
|
|
74472
|
-
const members = [inner,
|
|
74626
|
+
const members = [inner, AST7.tsNullKeyword()];
|
|
74473
74627
|
if (input) {
|
|
74474
|
-
members.push(
|
|
74628
|
+
members.push(AST7.tsUndefinedKeyword());
|
|
74475
74629
|
}
|
|
74476
|
-
return
|
|
74630
|
+
return AST7.tsUnionType(members);
|
|
74477
74631
|
}
|
|
74478
74632
|
function scalarPropertyValue(config2, missingScalars, target) {
|
|
74479
74633
|
switch (target.name) {
|
|
74480
74634
|
case "String": {
|
|
74481
|
-
return
|
|
74635
|
+
return AST7.tsStringKeyword();
|
|
74482
74636
|
}
|
|
74483
74637
|
case "Int": {
|
|
74484
|
-
return
|
|
74638
|
+
return AST7.tsNumberKeyword();
|
|
74485
74639
|
}
|
|
74486
74640
|
case "Float": {
|
|
74487
|
-
return
|
|
74641
|
+
return AST7.tsNumberKeyword();
|
|
74488
74642
|
}
|
|
74489
74643
|
case "Boolean": {
|
|
74490
|
-
return
|
|
74644
|
+
return AST7.tsBooleanKeyword();
|
|
74491
74645
|
}
|
|
74492
74646
|
case "ID": {
|
|
74493
|
-
return
|
|
74647
|
+
return AST7.tsStringKeyword();
|
|
74494
74648
|
}
|
|
74495
74649
|
default: {
|
|
74496
|
-
if (
|
|
74650
|
+
if (graphql15.isNonNullType(target) && "ofType" in target) {
|
|
74497
74651
|
return scalarPropertyValue(
|
|
74498
74652
|
config2,
|
|
74499
74653
|
missingScalars,
|
|
@@ -74501,23 +74655,23 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
74501
74655
|
);
|
|
74502
74656
|
}
|
|
74503
74657
|
if (config2.scalars?.[target.name]) {
|
|
74504
|
-
return
|
|
74658
|
+
return AST7.tsTypeReference(AST7.identifier(config2.scalars?.[target.name].type));
|
|
74505
74659
|
}
|
|
74506
74660
|
missingScalars.add(target.name);
|
|
74507
|
-
return
|
|
74661
|
+
return AST7.tsAnyKeyword();
|
|
74508
74662
|
}
|
|
74509
74663
|
}
|
|
74510
74664
|
}
|
|
74511
74665
|
|
|
74512
74666
|
// src/codegen/generators/typescript/typeReference.ts
|
|
74513
|
-
var
|
|
74667
|
+
var AST8 = recast8.types.builders;
|
|
74514
74668
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
74515
74669
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
74516
74670
|
let result;
|
|
74517
|
-
if (
|
|
74671
|
+
if (graphql16.isScalarType(type)) {
|
|
74518
74672
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
74519
74673
|
} else {
|
|
74520
|
-
result =
|
|
74674
|
+
result = AST8.tsTypeReference(AST8.identifier(type.name));
|
|
74521
74675
|
}
|
|
74522
74676
|
for (const toWrap of wrappers) {
|
|
74523
74677
|
if (toWrap === "NonNull" /* NonNull */) {
|
|
@@ -74525,27 +74679,27 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
74525
74679
|
} else if (toWrap === "Nullable" /* Nullable */) {
|
|
74526
74680
|
result = nullableField(result, true);
|
|
74527
74681
|
} else if (toWrap === "List" /* List */) {
|
|
74528
|
-
result =
|
|
74682
|
+
result = AST8.tsArrayType(AST8.tsParenthesizedType(result));
|
|
74529
74683
|
}
|
|
74530
74684
|
}
|
|
74531
74685
|
return result;
|
|
74532
74686
|
}
|
|
74533
74687
|
|
|
74534
74688
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
74535
|
-
var
|
|
74689
|
+
var AST9 = recast9.types.builders;
|
|
74536
74690
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
74537
74691
|
const { type } = unwrapType(config2, rootType);
|
|
74538
|
-
if (
|
|
74692
|
+
if (graphql17.isScalarType(type)) {
|
|
74539
74693
|
return;
|
|
74540
74694
|
}
|
|
74541
74695
|
if (visitedTypes.has(type.name)) {
|
|
74542
74696
|
return;
|
|
74543
74697
|
}
|
|
74544
|
-
if (
|
|
74698
|
+
if (graphql17.isUnionType(type)) {
|
|
74545
74699
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
74546
74700
|
}
|
|
74547
74701
|
visitedTypes.add(type.name);
|
|
74548
|
-
if (
|
|
74702
|
+
if (graphql17.isEnumType(type)) {
|
|
74549
74703
|
ensureImports({
|
|
74550
74704
|
config: config2,
|
|
74551
74705
|
body,
|
|
@@ -74559,20 +74713,267 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
74559
74713
|
for (const field of Object.values(type.getFields())) {
|
|
74560
74714
|
addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, field.type);
|
|
74561
74715
|
members.push(
|
|
74562
|
-
|
|
74563
|
-
|
|
74564
|
-
|
|
74565
|
-
|
|
74716
|
+
AST9.tsPropertySignature(
|
|
74717
|
+
AST9.identifier(field.name),
|
|
74718
|
+
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
74719
|
+
graphql17.isNullableType(field.type)
|
|
74566
74720
|
)
|
|
74567
74721
|
);
|
|
74568
74722
|
}
|
|
74569
|
-
body.push(
|
|
74723
|
+
body.push(AST9.tsTypeAliasDeclaration(AST9.identifier(type.name), AST9.tsTypeLiteral(members)));
|
|
74724
|
+
}
|
|
74725
|
+
|
|
74726
|
+
// src/codegen/generators/typescript/imperativeCache.ts
|
|
74727
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
74728
|
+
var recast10 = __toESM(require_main2(), 1);
|
|
74729
|
+
var AST10 = recast10.types.builders;
|
|
74730
|
+
async function imperativeCacheTypef(config2, docs) {
|
|
74731
|
+
const target = path_exports.join(config2.runtimeDirectory, "generated.d.ts");
|
|
74732
|
+
const body = [];
|
|
74733
|
+
const declaration = AST10.tsTypeAliasDeclaration(
|
|
74734
|
+
AST10.identifier(CacheTypeDefName),
|
|
74735
|
+
AST10.tsTypeLiteral([
|
|
74736
|
+
AST10.tsPropertySignature(
|
|
74737
|
+
AST10.identifier("types"),
|
|
74738
|
+
AST10.tsTypeAnnotation(typeDefinitions(config2, body))
|
|
74739
|
+
),
|
|
74740
|
+
AST10.tsPropertySignature(
|
|
74741
|
+
AST10.identifier("lists"),
|
|
74742
|
+
AST10.tsTypeAnnotation(listDefinitions(config2, docs))
|
|
74743
|
+
)
|
|
74744
|
+
])
|
|
74745
|
+
);
|
|
74746
|
+
declaration.declare = true;
|
|
74747
|
+
const importRecord = AST10.importDeclaration(
|
|
74748
|
+
[AST10.importSpecifier(AST10.identifier("Record"))],
|
|
74749
|
+
AST10.stringLiteral("./public/record")
|
|
74750
|
+
);
|
|
74751
|
+
importRecord.importKind = "type";
|
|
74752
|
+
await fs_exports.writeFile(
|
|
74753
|
+
target,
|
|
74754
|
+
recast10.prettyPrint(
|
|
74755
|
+
AST10.program([importRecord, ...body, AST10.exportNamedDeclaration(declaration)])
|
|
74756
|
+
).code
|
|
74757
|
+
);
|
|
74758
|
+
}
|
|
74759
|
+
function typeDefinitions(config2, body) {
|
|
74760
|
+
const operationTypes = [config2.schema.getMutationType(), config2.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
74761
|
+
const visitedTypes = /* @__PURE__ */ new Set();
|
|
74762
|
+
const types16 = Object.values(config2.schema.getTypeMap()).filter(
|
|
74763
|
+
(type) => !graphql18.isAbstractType(type) && !graphql18.isScalarType(type) && !graphql18.isEnumType(type) && !graphql18.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
74764
|
+
);
|
|
74765
|
+
return AST10.tsTypeLiteral(
|
|
74766
|
+
types16.map((type) => {
|
|
74767
|
+
let typeName = type.name;
|
|
74768
|
+
if (config2.schema.getQueryType() && config2.schema.getQueryType()?.name === type.name) {
|
|
74769
|
+
typeName = "__ROOT__";
|
|
74770
|
+
}
|
|
74771
|
+
let idFields = AST10.tsNeverKeyword();
|
|
74772
|
+
const keys = keyFieldsForType(config2.configFile, type.name);
|
|
74773
|
+
if (graphql18.isObjectType(type) && keys.length > 0 && keys.every((key) => type.getFields()[key])) {
|
|
74774
|
+
idFields = AST10.tsTypeLiteral(
|
|
74775
|
+
keys.map((key) => {
|
|
74776
|
+
const fieldType = type.getFields()[key];
|
|
74777
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
74778
|
+
return AST10.tsPropertySignature(
|
|
74779
|
+
AST10.identifier(key),
|
|
74780
|
+
AST10.tsTypeAnnotation(
|
|
74781
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
74782
|
+
)
|
|
74783
|
+
);
|
|
74784
|
+
})
|
|
74785
|
+
);
|
|
74786
|
+
} else if (typeName === "__ROOT__") {
|
|
74787
|
+
idFields = AST10.tsTypeLiteral([]);
|
|
74788
|
+
}
|
|
74789
|
+
let fields = AST10.tsTypeLiteral([]);
|
|
74790
|
+
if (graphql18.isObjectType(type)) {
|
|
74791
|
+
fields = AST10.tsTypeLiteral(
|
|
74792
|
+
Object.entries(type.getFields()).map(
|
|
74793
|
+
([key, fieldType]) => {
|
|
74794
|
+
const unwrapped = unwrapType(config2, fieldType.type);
|
|
74795
|
+
let typeOptions = AST10.tsUnionType([]);
|
|
74796
|
+
if (graphql18.isScalarType(unwrapped.type)) {
|
|
74797
|
+
typeOptions.types.push(
|
|
74798
|
+
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
74799
|
+
);
|
|
74800
|
+
} else if (graphql18.isEnumType(unwrapped.type)) {
|
|
74801
|
+
typeOptions.types.push(
|
|
74802
|
+
AST10.tsTypeReference(AST10.identifier(unwrapped.type.name))
|
|
74803
|
+
);
|
|
74804
|
+
} else if (!graphql18.isAbstractType(unwrapped.type)) {
|
|
74805
|
+
typeOptions.types.push(record(unwrapped.type.name));
|
|
74806
|
+
} else {
|
|
74807
|
+
typeOptions.types.push(
|
|
74808
|
+
...config2.schema.getPossibleTypes(unwrapped.type).map((type2) => record(type2.name))
|
|
74809
|
+
);
|
|
74810
|
+
}
|
|
74811
|
+
for (const wrapper of unwrapped.wrappers) {
|
|
74812
|
+
if (wrapper === "Nullable" /* Nullable */) {
|
|
74813
|
+
typeOptions = AST10.tsParenthesizedType(
|
|
74814
|
+
AST10.tsUnionType([typeOptions, AST10.tsNullKeyword()])
|
|
74815
|
+
);
|
|
74816
|
+
} else if (wrapper === "List" /* List */) {
|
|
74817
|
+
typeOptions = AST10.tsArrayType(
|
|
74818
|
+
AST10.tsParenthesizedType(typeOptions)
|
|
74819
|
+
);
|
|
74820
|
+
}
|
|
74821
|
+
}
|
|
74822
|
+
if (typeOptions.type === "TSParenthesizedType") {
|
|
74823
|
+
typeOptions = typeOptions.typeAnnotation;
|
|
74824
|
+
}
|
|
74825
|
+
let args = AST10.tsNeverKeyword();
|
|
74826
|
+
if (fieldType.args?.length > 0) {
|
|
74827
|
+
args = AST10.tsTypeLiteral(
|
|
74828
|
+
fieldType.args.map((arg) => {
|
|
74829
|
+
addReferencedInputTypes(
|
|
74830
|
+
config2,
|
|
74831
|
+
"",
|
|
74832
|
+
body,
|
|
74833
|
+
visitedTypes,
|
|
74834
|
+
/* @__PURE__ */ new Set(),
|
|
74835
|
+
arg.type
|
|
74836
|
+
);
|
|
74837
|
+
const prop = AST10.tsPropertySignature(
|
|
74838
|
+
AST10.identifier(arg.name),
|
|
74839
|
+
AST10.tsTypeAnnotation(
|
|
74840
|
+
tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
|
|
74841
|
+
)
|
|
74842
|
+
);
|
|
74843
|
+
const unwrapped2 = unwrapType(config2, arg.type);
|
|
74844
|
+
prop.optional = unwrapped2.wrappers[unwrapped2.wrappers.length - 1] === "Nullable" /* Nullable */;
|
|
74845
|
+
return prop;
|
|
74846
|
+
})
|
|
74847
|
+
);
|
|
74848
|
+
}
|
|
74849
|
+
return AST10.tsPropertySignature(
|
|
74850
|
+
AST10.identifier(key),
|
|
74851
|
+
AST10.tsTypeAnnotation(
|
|
74852
|
+
AST10.tsTypeLiteral([
|
|
74853
|
+
AST10.tsPropertySignature(
|
|
74854
|
+
AST10.identifier("type"),
|
|
74855
|
+
AST10.tsTypeAnnotation(typeOptions)
|
|
74856
|
+
),
|
|
74857
|
+
AST10.tsPropertySignature(
|
|
74858
|
+
AST10.identifier("args"),
|
|
74859
|
+
AST10.tsTypeAnnotation(args)
|
|
74860
|
+
)
|
|
74861
|
+
])
|
|
74862
|
+
)
|
|
74863
|
+
);
|
|
74864
|
+
}
|
|
74865
|
+
)
|
|
74866
|
+
);
|
|
74867
|
+
}
|
|
74868
|
+
return AST10.tsPropertySignature(
|
|
74869
|
+
AST10.identifier(typeName),
|
|
74870
|
+
AST10.tsTypeAnnotation(
|
|
74871
|
+
AST10.tsTypeLiteral([
|
|
74872
|
+
AST10.tsPropertySignature(
|
|
74873
|
+
AST10.identifier("idFields"),
|
|
74874
|
+
AST10.tsTypeAnnotation(idFields)
|
|
74875
|
+
),
|
|
74876
|
+
AST10.tsPropertySignature(
|
|
74877
|
+
AST10.identifier("fields"),
|
|
74878
|
+
AST10.tsTypeAnnotation(fields)
|
|
74879
|
+
)
|
|
74880
|
+
])
|
|
74881
|
+
)
|
|
74882
|
+
);
|
|
74883
|
+
})
|
|
74884
|
+
);
|
|
74885
|
+
}
|
|
74886
|
+
function listDefinitions(config2, docs) {
|
|
74887
|
+
const lists = [];
|
|
74888
|
+
const visitedLists = /* @__PURE__ */ new Set();
|
|
74889
|
+
for (const doc of docs) {
|
|
74890
|
+
graphql18.visit(doc.document, {
|
|
74891
|
+
Directive(node, key, parent, path2, ancestors) {
|
|
74892
|
+
if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
74893
|
+
return;
|
|
74894
|
+
}
|
|
74895
|
+
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
74896
|
+
const nameValue = nameArg?.value?.value || "";
|
|
74897
|
+
if (!nameValue || visitedLists.has(nameValue)) {
|
|
74898
|
+
return;
|
|
74899
|
+
}
|
|
74900
|
+
visitedLists.add(nameValue);
|
|
74901
|
+
const parentType = parentTypeFromAncestors(
|
|
74902
|
+
config2.schema,
|
|
74903
|
+
doc.filename,
|
|
74904
|
+
ancestors.slice(0, -1)
|
|
74905
|
+
);
|
|
74906
|
+
const targetField = ancestors[ancestors.length - 1];
|
|
74907
|
+
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
74908
|
+
const { type: listType } = unwrapType(config2, targetFieldDefinition.type);
|
|
74909
|
+
const possibleTypes = [];
|
|
74910
|
+
if (graphql18.isAbstractType(listType)) {
|
|
74911
|
+
possibleTypes.push(
|
|
74912
|
+
...config2.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
74913
|
+
);
|
|
74914
|
+
} else {
|
|
74915
|
+
possibleTypes.push(listType.name);
|
|
74916
|
+
}
|
|
74917
|
+
lists.push(
|
|
74918
|
+
AST10.tsPropertySignature(
|
|
74919
|
+
AST10.identifier(nameValue),
|
|
74920
|
+
AST10.tsTypeAnnotation(
|
|
74921
|
+
AST10.tsTypeLiteral([
|
|
74922
|
+
AST10.tsPropertySignature(
|
|
74923
|
+
AST10.identifier("type"),
|
|
74924
|
+
AST10.tsTypeAnnotation(
|
|
74925
|
+
AST10.tsUnionType(
|
|
74926
|
+
possibleTypes.map(
|
|
74927
|
+
(possible) => AST10.tsLiteralType(AST10.stringLiteral(possible))
|
|
74928
|
+
)
|
|
74929
|
+
)
|
|
74930
|
+
)
|
|
74931
|
+
),
|
|
74932
|
+
AST10.tsPropertySignature(
|
|
74933
|
+
AST10.identifier("filters"),
|
|
74934
|
+
AST10.tsTypeAnnotation(
|
|
74935
|
+
targetFieldDefinition.args.length === 0 ? AST10.tsNeverKeyword() : AST10.tsTypeLiteral(
|
|
74936
|
+
targetFieldDefinition.args.map((arg) => {
|
|
74937
|
+
const argDef = AST10.tsPropertySignature(
|
|
74938
|
+
AST10.identifier(arg.name),
|
|
74939
|
+
AST10.tsTypeAnnotation(
|
|
74940
|
+
tsTypeReference(
|
|
74941
|
+
config2,
|
|
74942
|
+
/* @__PURE__ */ new Set(),
|
|
74943
|
+
arg
|
|
74944
|
+
)
|
|
74945
|
+
)
|
|
74946
|
+
);
|
|
74947
|
+
argDef.optional = true;
|
|
74948
|
+
return argDef;
|
|
74949
|
+
})
|
|
74950
|
+
)
|
|
74951
|
+
)
|
|
74952
|
+
)
|
|
74953
|
+
])
|
|
74954
|
+
)
|
|
74955
|
+
)
|
|
74956
|
+
);
|
|
74957
|
+
}
|
|
74958
|
+
});
|
|
74959
|
+
}
|
|
74960
|
+
return AST10.tsTypeLiteral(lists);
|
|
74961
|
+
}
|
|
74962
|
+
var CacheTypeDefName = "CacheTypeDef";
|
|
74963
|
+
function record(name2) {
|
|
74964
|
+
return AST10.tsTypeReference(
|
|
74965
|
+
AST10.identifier("Record"),
|
|
74966
|
+
AST10.tsTypeParameterInstantiation([
|
|
74967
|
+
AST10.tsTypeReference(AST10.identifier(CacheTypeDefName)),
|
|
74968
|
+
AST10.tsLiteralType(AST10.stringLiteral(name2))
|
|
74969
|
+
])
|
|
74970
|
+
);
|
|
74570
74971
|
}
|
|
74571
74972
|
|
|
74572
74973
|
// src/codegen/generators/typescript/inlineType.ts
|
|
74573
|
-
var
|
|
74574
|
-
var
|
|
74575
|
-
var
|
|
74974
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
74975
|
+
var recast11 = __toESM(require_main2(), 1);
|
|
74976
|
+
var AST11 = recast11.types.builders;
|
|
74576
74977
|
var fragmentKey = "$fragments";
|
|
74577
74978
|
function inlineType({
|
|
74578
74979
|
config: config2,
|
|
@@ -74589,9 +74990,9 @@ function inlineType({
|
|
|
74589
74990
|
}) {
|
|
74590
74991
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
74591
74992
|
let result;
|
|
74592
|
-
if (
|
|
74993
|
+
if (graphql19.isScalarType(type)) {
|
|
74593
74994
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
74594
|
-
} else if (
|
|
74995
|
+
} else if (graphql19.isEnumType(type)) {
|
|
74595
74996
|
if (!visitedTypes.has(type.name)) {
|
|
74596
74997
|
ensureImports({
|
|
74597
74998
|
config: config2,
|
|
@@ -74601,7 +75002,7 @@ function inlineType({
|
|
|
74601
75002
|
});
|
|
74602
75003
|
visitedTypes.add(type.name);
|
|
74603
75004
|
}
|
|
74604
|
-
result =
|
|
75005
|
+
result = AST11.tsTypeReference(AST11.identifier(type.name));
|
|
74605
75006
|
} else if (selections) {
|
|
74606
75007
|
const rootObj = type;
|
|
74607
75008
|
const inlineFragments = {};
|
|
@@ -74609,11 +75010,11 @@ function inlineType({
|
|
|
74609
75010
|
for (const selection2 of selections) {
|
|
74610
75011
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
74611
75012
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
74612
|
-
if (!
|
|
75013
|
+
if (!graphql19.isInterfaceType(type) && !graphql19.isUnionType(type)) {
|
|
74613
75014
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
74614
75015
|
continue;
|
|
74615
75016
|
}
|
|
74616
|
-
if (!
|
|
75017
|
+
if (!graphql19.isInterfaceType(fragmentType) && !graphql19.isUnionType(fragmentType)) {
|
|
74617
75018
|
if (!inlineFragments[fragmentType.name]) {
|
|
74618
75019
|
inlineFragments[fragmentType.name] = [];
|
|
74619
75020
|
}
|
|
@@ -74652,7 +75053,7 @@ function inlineType({
|
|
|
74652
75053
|
selectedFields.push(selection2);
|
|
74653
75054
|
}
|
|
74654
75055
|
}
|
|
74655
|
-
result =
|
|
75056
|
+
result = AST11.tsTypeLiteral([
|
|
74656
75057
|
...(selectedFields || []).filter(
|
|
74657
75058
|
(field) => field.kind === "Field"
|
|
74658
75059
|
).map((selection2) => {
|
|
@@ -74672,9 +75073,9 @@ function inlineType({
|
|
|
74672
75073
|
allOptional
|
|
74673
75074
|
});
|
|
74674
75075
|
const prop = readonlyProperty(
|
|
74675
|
-
|
|
74676
|
-
|
|
74677
|
-
|
|
75076
|
+
AST11.tsPropertySignature(
|
|
75077
|
+
AST11.identifier(attributeName),
|
|
75078
|
+
AST11.tsTypeAnnotation(attributeType)
|
|
74678
75079
|
),
|
|
74679
75080
|
allowReadonly
|
|
74680
75081
|
);
|
|
@@ -74688,15 +75089,15 @@ function inlineType({
|
|
|
74688
75089
|
if (includeFragments && fragmentSpreads && fragmentSpreads.length) {
|
|
74689
75090
|
result.members.push(
|
|
74690
75091
|
readonlyProperty(
|
|
74691
|
-
|
|
74692
|
-
|
|
74693
|
-
|
|
74694
|
-
|
|
75092
|
+
AST11.tsPropertySignature(
|
|
75093
|
+
AST11.identifier(fragmentKey),
|
|
75094
|
+
AST11.tsTypeAnnotation(
|
|
75095
|
+
AST11.tsTypeLiteral(
|
|
74695
75096
|
(fragmentSpreads || []).map(
|
|
74696
|
-
(fragmentSpread) =>
|
|
74697
|
-
|
|
74698
|
-
|
|
74699
|
-
|
|
75097
|
+
(fragmentSpread) => AST11.tsPropertySignature(
|
|
75098
|
+
AST11.identifier(fragmentSpread.name.value),
|
|
75099
|
+
AST11.tsTypeAnnotation(
|
|
75100
|
+
AST11.tsLiteralType(AST11.booleanLiteral(true))
|
|
74700
75101
|
)
|
|
74701
75102
|
)
|
|
74702
75103
|
)
|
|
@@ -74733,7 +75134,7 @@ function inlineType({
|
|
|
74733
75134
|
}
|
|
74734
75135
|
}
|
|
74735
75136
|
}
|
|
74736
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
75137
|
+
if (objectType.type === "TSTypeLiteral" && !graphql19.isInterfaceType(fragmentRootType) && !graphql19.isUnionType(fragmentRootType)) {
|
|
74737
75138
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
74738
75139
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
74739
75140
|
);
|
|
@@ -74742,9 +75143,9 @@ function inlineType({
|
|
|
74742
75143
|
}
|
|
74743
75144
|
objectType.members.push(
|
|
74744
75145
|
readonlyProperty(
|
|
74745
|
-
|
|
74746
|
-
|
|
74747
|
-
|
|
75146
|
+
AST11.tsPropertySignature(
|
|
75147
|
+
AST11.identifier("__typename"),
|
|
75148
|
+
AST11.tsTypeAnnotation(AST11.tsLiteralType(AST11.stringLiteral(typeName)))
|
|
74748
75149
|
),
|
|
74749
75150
|
allowReadonly
|
|
74750
75151
|
)
|
|
@@ -74755,8 +75156,8 @@ function inlineType({
|
|
|
74755
75156
|
if (Object.keys(inlineFragmentSelections).length > 0) {
|
|
74756
75157
|
let selectionTypes = Object.entries(inlineFragmentSelections).map(
|
|
74757
75158
|
([typeName, { type: type2, tsType }]) => {
|
|
74758
|
-
return
|
|
74759
|
-
|
|
75159
|
+
return AST11.tsParenthesizedType(
|
|
75160
|
+
AST11.tsIntersectionType(
|
|
74760
75161
|
[tsType].flatMap((type3) => {
|
|
74761
75162
|
if (type3.type === "TSUnionType") {
|
|
74762
75163
|
return type3.types.filter(
|
|
@@ -74769,9 +75170,9 @@ function inlineType({
|
|
|
74769
75170
|
);
|
|
74770
75171
|
}
|
|
74771
75172
|
);
|
|
74772
|
-
result =
|
|
75173
|
+
result = AST11.tsIntersectionType([
|
|
74773
75174
|
result,
|
|
74774
|
-
|
|
75175
|
+
AST11.tsParenthesizedType(AST11.tsUnionType(selectionTypes))
|
|
74775
75176
|
]);
|
|
74776
75177
|
}
|
|
74777
75178
|
} else {
|
|
@@ -74783,7 +75184,7 @@ function inlineType({
|
|
|
74783
75184
|
} else if (toWrap === "NonNull" /* NonNull */) {
|
|
74784
75185
|
continue;
|
|
74785
75186
|
} else if (toWrap === "List" /* List */) {
|
|
74786
|
-
result =
|
|
75187
|
+
result = AST11.tsArrayType(AST11.tsParenthesizedType(result));
|
|
74787
75188
|
}
|
|
74788
75189
|
}
|
|
74789
75190
|
return result;
|
|
@@ -74800,7 +75201,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
74800
75201
|
},
|
|
74801
75202
|
type: schema.getType("String")
|
|
74802
75203
|
};
|
|
74803
|
-
} else if (
|
|
75204
|
+
} else if (graphql19.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
74804
75205
|
fields = rootType.ofType.getFields();
|
|
74805
75206
|
} else {
|
|
74806
75207
|
fields = rootType.getFields();
|
|
@@ -74812,7 +75213,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
74812
75213
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
74813
75214
|
});
|
|
74814
75215
|
}
|
|
74815
|
-
const fieldType =
|
|
75216
|
+
const fieldType = graphql19.getNamedType(field.type);
|
|
74816
75217
|
if (!fieldType) {
|
|
74817
75218
|
throw new HoudiniError({
|
|
74818
75219
|
filepath,
|
|
@@ -74828,7 +75229,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
74828
75229
|
}
|
|
74829
75230
|
|
|
74830
75231
|
// src/codegen/generators/typescript/index.ts
|
|
74831
|
-
var
|
|
75232
|
+
var AST12 = recast12.types.builders;
|
|
74832
75233
|
async function typescriptGenerator(config2, docs) {
|
|
74833
75234
|
const typePaths = [];
|
|
74834
75235
|
const fragmentDefinitions = {};
|
|
@@ -74846,7 +75247,7 @@ async function typescriptGenerator(config2, docs) {
|
|
|
74846
75247
|
return;
|
|
74847
75248
|
}
|
|
74848
75249
|
const typeDefPath = config2.artifactTypePath(originalDocument);
|
|
74849
|
-
const program3 =
|
|
75250
|
+
const program3 = AST12.program([]);
|
|
74850
75251
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
74851
75252
|
let definition = originalDocument.definitions.find(
|
|
74852
75253
|
(def) => (def.kind === "OperationDefinition" || def.kind === "FragmentDefinition") && def.name?.value === name2
|
|
@@ -74879,21 +75280,21 @@ async function typescriptGenerator(config2, docs) {
|
|
|
74879
75280
|
missingScalars
|
|
74880
75281
|
);
|
|
74881
75282
|
}
|
|
74882
|
-
await fs_exports.writeFile(typeDefPath,
|
|
75283
|
+
await fs_exports.writeFile(typeDefPath, recast12.print(program3).code);
|
|
74883
75284
|
typePaths.push(typeDefPath);
|
|
74884
75285
|
})
|
|
74885
75286
|
);
|
|
74886
|
-
const typeIndex =
|
|
75287
|
+
const typeIndex = AST12.program(
|
|
74887
75288
|
typePaths.sort((a, b) => a.localeCompare(b)).map((typePath) => {
|
|
74888
|
-
return
|
|
74889
|
-
|
|
75289
|
+
return AST12.exportAllDeclaration(
|
|
75290
|
+
AST12.literal(
|
|
74890
75291
|
"./" + path_exports.relative(path_exports.resolve(config2.typeIndexPath, ".."), typePath).replace(/\.[^/.]+\.[^/.]+$/, "")
|
|
74891
75292
|
),
|
|
74892
75293
|
null
|
|
74893
75294
|
);
|
|
74894
75295
|
}).concat([
|
|
74895
|
-
|
|
74896
|
-
|
|
75296
|
+
AST12.exportAllDeclaration(AST12.literal("./runtime"), null),
|
|
75297
|
+
AST12.exportAllDeclaration(AST12.literal("./graphql"), null)
|
|
74897
75298
|
])
|
|
74898
75299
|
);
|
|
74899
75300
|
const export_default_as = ({ module, as }) => `
|
|
@@ -74902,7 +75303,7 @@ export { default as ${as} } from "${module}"
|
|
|
74902
75303
|
const export_star_from = ({ module }) => `
|
|
74903
75304
|
export * from "${module}"
|
|
74904
75305
|
`;
|
|
74905
|
-
let indexContent =
|
|
75306
|
+
let indexContent = recast12.print(typeIndex).code;
|
|
74906
75307
|
for (const plugin of config2.plugins) {
|
|
74907
75308
|
if (!plugin.index_file) {
|
|
74908
75309
|
continue;
|
|
@@ -74923,6 +75324,7 @@ export * from "${module}"
|
|
|
74923
75324
|
}
|
|
74924
75325
|
}
|
|
74925
75326
|
await fs_exports.writeFile(config2.typeIndexPath, indexContent);
|
|
75327
|
+
await imperativeCacheTypef(config2, docs);
|
|
74926
75328
|
if (missingScalars.size > 0) {
|
|
74927
75329
|
console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
|
|
74928
75330
|
", "
|
|
@@ -74964,23 +75366,23 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
74964
75366
|
const optimisticTypeName = `${definition.name.value}$optimistic`;
|
|
74965
75367
|
const hasInputs = definition.variableDefinitions && definition.variableDefinitions.length > 0;
|
|
74966
75368
|
body.push(
|
|
74967
|
-
|
|
74968
|
-
|
|
74969
|
-
|
|
74970
|
-
|
|
75369
|
+
AST12.exportNamedDeclaration(
|
|
75370
|
+
AST12.tsTypeAliasDeclaration(
|
|
75371
|
+
AST12.identifier(definition.name.value),
|
|
75372
|
+
AST12.tsTypeLiteral([
|
|
74971
75373
|
readonlyProperty(
|
|
74972
|
-
|
|
74973
|
-
|
|
74974
|
-
|
|
75374
|
+
AST12.tsPropertySignature(
|
|
75375
|
+
AST12.stringLiteral("input"),
|
|
75376
|
+
AST12.tsTypeAnnotation(AST12.tsTypeReference(AST12.identifier(inputTypeName)))
|
|
74975
75377
|
)
|
|
74976
75378
|
),
|
|
74977
75379
|
readonlyProperty(
|
|
74978
|
-
|
|
74979
|
-
|
|
74980
|
-
|
|
74981
|
-
definition.operation === "mutation" ?
|
|
74982
|
-
|
|
74983
|
-
|
|
75380
|
+
AST12.tsPropertySignature(
|
|
75381
|
+
AST12.stringLiteral("result"),
|
|
75382
|
+
AST12.tsTypeAnnotation(
|
|
75383
|
+
definition.operation === "mutation" ? AST12.tsTypeReference(AST12.identifier(shapeTypeName)) : AST12.tsUnionType([
|
|
75384
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName)),
|
|
75385
|
+
AST12.tsUndefinedKeyword()
|
|
74984
75386
|
])
|
|
74985
75387
|
)
|
|
74986
75388
|
)
|
|
@@ -74988,9 +75390,9 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
74988
75390
|
])
|
|
74989
75391
|
)
|
|
74990
75392
|
),
|
|
74991
|
-
|
|
74992
|
-
|
|
74993
|
-
|
|
75393
|
+
AST12.exportNamedDeclaration(
|
|
75394
|
+
AST12.tsTypeAliasDeclaration(
|
|
75395
|
+
AST12.identifier(shapeTypeName),
|
|
74994
75396
|
inlineType({
|
|
74995
75397
|
config: config2,
|
|
74996
75398
|
filepath,
|
|
@@ -75018,15 +75420,15 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
75018
75420
|
);
|
|
75019
75421
|
}
|
|
75020
75422
|
body.push(
|
|
75021
|
-
|
|
75022
|
-
|
|
75023
|
-
|
|
75024
|
-
|
|
75423
|
+
AST12.exportNamedDeclaration(
|
|
75424
|
+
AST12.tsTypeAliasDeclaration(
|
|
75425
|
+
AST12.identifier(inputTypeName),
|
|
75426
|
+
AST12.tsTypeLiteral(
|
|
75025
75427
|
(definition.variableDefinitions || []).map(
|
|
75026
75428
|
(definition2) => {
|
|
75027
|
-
return
|
|
75028
|
-
|
|
75029
|
-
|
|
75429
|
+
return AST12.tsPropertySignature(
|
|
75430
|
+
AST12.identifier(definition2.variable.name.value),
|
|
75431
|
+
AST12.tsTypeAnnotation(
|
|
75030
75432
|
tsTypeReference(config2, missingScalars, definition2)
|
|
75031
75433
|
),
|
|
75032
75434
|
definition2.type.kind !== "NonNullType"
|
|
@@ -75039,16 +75441,16 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
75039
75441
|
);
|
|
75040
75442
|
} else {
|
|
75041
75443
|
body.push(
|
|
75042
|
-
|
|
75043
|
-
|
|
75444
|
+
AST12.exportNamedDeclaration(
|
|
75445
|
+
AST12.tsTypeAliasDeclaration(AST12.identifier(inputTypeName), AST12.tsNullKeyword())
|
|
75044
75446
|
)
|
|
75045
75447
|
);
|
|
75046
75448
|
}
|
|
75047
75449
|
if (definition.operation === "mutation") {
|
|
75048
75450
|
body.push(
|
|
75049
|
-
|
|
75050
|
-
|
|
75051
|
-
|
|
75451
|
+
AST12.exportNamedDeclaration(
|
|
75452
|
+
AST12.tsTypeAliasDeclaration(
|
|
75453
|
+
AST12.identifier(optimisticTypeName),
|
|
75052
75454
|
inlineType({
|
|
75053
75455
|
config: config2,
|
|
75054
75456
|
filepath,
|
|
@@ -75079,28 +75481,28 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
75079
75481
|
throw new Error("Should not get here");
|
|
75080
75482
|
}
|
|
75081
75483
|
body.push(
|
|
75082
|
-
|
|
75083
|
-
|
|
75084
|
-
|
|
75085
|
-
|
|
75484
|
+
AST12.exportNamedDeclaration(
|
|
75485
|
+
AST12.tsTypeAliasDeclaration(
|
|
75486
|
+
AST12.identifier(propTypeName),
|
|
75487
|
+
AST12.tsTypeLiteral([
|
|
75086
75488
|
readonlyProperty(
|
|
75087
|
-
|
|
75088
|
-
|
|
75089
|
-
|
|
75090
|
-
|
|
75489
|
+
AST12.tsPropertySignature(
|
|
75490
|
+
AST12.stringLiteral("shape"),
|
|
75491
|
+
AST12.tsTypeAnnotation(
|
|
75492
|
+
AST12.tsTypeReference(AST12.identifier(shapeTypeName))
|
|
75091
75493
|
),
|
|
75092
75494
|
true
|
|
75093
75495
|
)
|
|
75094
75496
|
),
|
|
75095
75497
|
readonlyProperty(
|
|
75096
|
-
|
|
75097
|
-
|
|
75098
|
-
|
|
75099
|
-
|
|
75100
|
-
|
|
75101
|
-
|
|
75102
|
-
|
|
75103
|
-
|
|
75498
|
+
AST12.tsPropertySignature(
|
|
75499
|
+
AST12.stringLiteral(fragmentKey),
|
|
75500
|
+
AST12.tsTypeAnnotation(
|
|
75501
|
+
AST12.tsTypeLiteral([
|
|
75502
|
+
AST12.tsPropertySignature(
|
|
75503
|
+
AST12.stringLiteral(propTypeName),
|
|
75504
|
+
AST12.tsTypeAnnotation(
|
|
75505
|
+
AST12.tsLiteralType(AST12.booleanLiteral(true))
|
|
75104
75506
|
)
|
|
75105
75507
|
)
|
|
75106
75508
|
])
|
|
@@ -75110,9 +75512,9 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
75110
75512
|
])
|
|
75111
75513
|
)
|
|
75112
75514
|
),
|
|
75113
|
-
|
|
75114
|
-
|
|
75115
|
-
|
|
75515
|
+
AST12.exportNamedDeclaration(
|
|
75516
|
+
AST12.tsTypeAliasDeclaration(
|
|
75517
|
+
AST12.identifier(shapeTypeName),
|
|
75116
75518
|
inlineType({
|
|
75117
75519
|
config: config2,
|
|
75118
75520
|
filepath,
|
|
@@ -75132,7 +75534,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
75132
75534
|
}
|
|
75133
75535
|
|
|
75134
75536
|
// src/codegen/generators/persistedQueries/index.ts
|
|
75135
|
-
var
|
|
75537
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
75136
75538
|
async function persistOutputGenerator(config2, docs) {
|
|
75137
75539
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
75138
75540
|
return;
|
|
@@ -75144,8 +75546,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75144
75546
|
if (!generateArtifact) {
|
|
75145
75547
|
return acc;
|
|
75146
75548
|
}
|
|
75147
|
-
let rawString =
|
|
75148
|
-
|
|
75549
|
+
let rawString = graphql20.print(
|
|
75550
|
+
graphql20.visit(document, {
|
|
75149
75551
|
Directive(node) {
|
|
75150
75552
|
if (config2.isInternalDirective(node)) {
|
|
75151
75553
|
return null;
|
|
@@ -75154,7 +75556,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75154
75556
|
})
|
|
75155
75557
|
);
|
|
75156
75558
|
const operations = document.definitions.filter(
|
|
75157
|
-
({ kind }) => kind ===
|
|
75559
|
+
({ kind }) => kind === graphql20.Kind.OPERATION_DEFINITION
|
|
75158
75560
|
);
|
|
75159
75561
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
75160
75562
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -75167,26 +75569,26 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75167
75569
|
}
|
|
75168
75570
|
|
|
75169
75571
|
// src/codegen/generators/definitions/enums.ts
|
|
75170
|
-
var
|
|
75171
|
-
var
|
|
75172
|
-
var
|
|
75572
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
75573
|
+
var recast13 = __toESM(require_main2(), 1);
|
|
75574
|
+
var AST13 = recast13.types.builders;
|
|
75173
75575
|
async function definitionsGenerator(config2) {
|
|
75174
|
-
const enums =
|
|
75576
|
+
const enums = graphql21.parse(graphql21.printSchema(config2.schema)).definitions.filter(
|
|
75175
75577
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
75176
75578
|
).filter((def) => !config2.isInternalEnum(def));
|
|
75177
|
-
const runtimeDefinitions =
|
|
75178
|
-
|
|
75579
|
+
const runtimeDefinitions = recast13.print(
|
|
75580
|
+
AST13.program(
|
|
75179
75581
|
enums.map((defn) => {
|
|
75180
75582
|
const name2 = defn.name.value;
|
|
75181
75583
|
return moduleExport(
|
|
75182
75584
|
config2,
|
|
75183
75585
|
name2,
|
|
75184
|
-
|
|
75586
|
+
AST13.objectExpression(
|
|
75185
75587
|
defn.values?.map((value) => {
|
|
75186
75588
|
const str = value.name.value;
|
|
75187
|
-
return
|
|
75188
|
-
|
|
75189
|
-
|
|
75589
|
+
return AST13.objectProperty(
|
|
75590
|
+
AST13.stringLiteral(str),
|
|
75591
|
+
AST13.stringLiteral(str)
|
|
75190
75592
|
);
|
|
75191
75593
|
}) || []
|
|
75192
75594
|
)
|
|
@@ -75194,7 +75596,7 @@ async function definitionsGenerator(config2) {
|
|
|
75194
75596
|
})
|
|
75195
75597
|
)
|
|
75196
75598
|
).code;
|
|
75197
|
-
const
|
|
75599
|
+
const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
|
|
75198
75600
|
(definition) => `
|
|
75199
75601
|
export declare enum ${definition.name.value} {
|
|
75200
75602
|
${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
|
|
@@ -75205,7 +75607,7 @@ ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.val
|
|
|
75205
75607
|
export * from './enums.js'
|
|
75206
75608
|
`;
|
|
75207
75609
|
await Promise.all([
|
|
75208
|
-
fs_exports.writeFile(config2.enumTypesDefinitionsPath,
|
|
75610
|
+
fs_exports.writeFile(config2.enumTypesDefinitionsPath, typeDefinitions2),
|
|
75209
75611
|
fs_exports.writeFile(config2.enumRuntimeDefinitionsPath, runtimeDefinitions),
|
|
75210
75612
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.js"), definitionsIndex),
|
|
75211
75613
|
fs_exports.writeFile(path_exports.join(config2.definitionsDirectory, "index.d.ts"), definitionsIndex)
|
|
@@ -75344,7 +75746,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
75344
75746
|
}
|
|
75345
75747
|
|
|
75346
75748
|
// src/codegen/transforms/schema.ts
|
|
75347
|
-
var
|
|
75749
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
75348
75750
|
async function graphqlExtensions(config2, documents) {
|
|
75349
75751
|
const internalSchema = `
|
|
75350
75752
|
enum CachePolicy {
|
|
@@ -75422,19 +75824,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
75422
75824
|
"""
|
|
75423
75825
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
75424
75826
|
`;
|
|
75425
|
-
let currentSchema =
|
|
75827
|
+
let currentSchema = graphql23.printSchema(config2.schema);
|
|
75426
75828
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
75427
75829
|
currentSchema += internalSchema;
|
|
75428
75830
|
}
|
|
75429
75831
|
config2.newSchema += internalSchema;
|
|
75430
|
-
config2.schema =
|
|
75832
|
+
config2.schema = graphql23.buildSchema(currentSchema);
|
|
75431
75833
|
}
|
|
75432
75834
|
|
|
75433
75835
|
// src/codegen/transforms/typename.ts
|
|
75434
|
-
var
|
|
75836
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
75435
75837
|
async function addTypename(config2, documents) {
|
|
75436
75838
|
for (const doc of documents) {
|
|
75437
|
-
doc.document =
|
|
75839
|
+
doc.document = graphql24.visit(doc.document, {
|
|
75438
75840
|
Field(node, key, parent, path2, ancestors) {
|
|
75439
75841
|
if (!node.selectionSet) {
|
|
75440
75842
|
return;
|
|
@@ -75446,7 +75848,7 @@ async function addTypename(config2, documents) {
|
|
|
75446
75848
|
);
|
|
75447
75849
|
const field = type.getFields()[node.name.value];
|
|
75448
75850
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75449
|
-
if (
|
|
75851
|
+
if (graphql24.isInterfaceType(fieldType) || graphql24.isUnionType(fieldType)) {
|
|
75450
75852
|
return {
|
|
75451
75853
|
...node,
|
|
75452
75854
|
selectionSet: {
|
|
@@ -75454,9 +75856,9 @@ async function addTypename(config2, documents) {
|
|
|
75454
75856
|
selections: [
|
|
75455
75857
|
...node.selectionSet.selections,
|
|
75456
75858
|
{
|
|
75457
|
-
kind:
|
|
75859
|
+
kind: graphql24.Kind.FIELD,
|
|
75458
75860
|
name: {
|
|
75459
|
-
kind:
|
|
75861
|
+
kind: graphql24.Kind.NAME,
|
|
75460
75862
|
value: "__typename"
|
|
75461
75863
|
}
|
|
75462
75864
|
}
|
|
@@ -75470,10 +75872,10 @@ async function addTypename(config2, documents) {
|
|
|
75470
75872
|
}
|
|
75471
75873
|
|
|
75472
75874
|
// src/codegen/transforms/addID.ts
|
|
75473
|
-
var
|
|
75875
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
75474
75876
|
async function addID(config2, documents) {
|
|
75475
75877
|
for (const doc of documents) {
|
|
75476
|
-
doc.document =
|
|
75878
|
+
doc.document = graphql25.visit(doc.document, {
|
|
75477
75879
|
Field(node, key, parent, path2, ancestors) {
|
|
75478
75880
|
if (!node.selectionSet) {
|
|
75479
75881
|
return;
|
|
@@ -75486,7 +75888,7 @@ async function addID(config2, documents) {
|
|
|
75486
75888
|
const field = type.getFields()[node.name.value];
|
|
75487
75889
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75488
75890
|
if (node.selectionSet?.selections.length > 0) {
|
|
75489
|
-
if (!
|
|
75891
|
+
if (!graphql25.isObjectType(fieldType) && !graphql25.isInterfaceType(fieldType)) {
|
|
75490
75892
|
return;
|
|
75491
75893
|
}
|
|
75492
75894
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -75501,9 +75903,9 @@ async function addID(config2, documents) {
|
|
|
75501
75903
|
continue;
|
|
75502
75904
|
}
|
|
75503
75905
|
selections.push({
|
|
75504
|
-
kind:
|
|
75906
|
+
kind: graphql25.Kind.FIELD,
|
|
75505
75907
|
name: {
|
|
75506
|
-
kind:
|
|
75908
|
+
kind: graphql25.Kind.NAME,
|
|
75507
75909
|
value: keyField
|
|
75508
75910
|
}
|
|
75509
75911
|
});
|
|
@@ -75522,8 +75924,8 @@ async function addID(config2, documents) {
|
|
|
75522
75924
|
}
|
|
75523
75925
|
|
|
75524
75926
|
// src/codegen/transforms/fragmentVariables.ts
|
|
75525
|
-
var
|
|
75526
|
-
var GraphqlKinds2 =
|
|
75927
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
75928
|
+
var GraphqlKinds2 = graphql26.Kind;
|
|
75527
75929
|
async function fragmentVariables(config2, documents) {
|
|
75528
75930
|
const fragments = collectFragments(config2, documents);
|
|
75529
75931
|
const generatedFragments = {};
|
|
@@ -75546,7 +75948,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
75546
75948
|
});
|
|
75547
75949
|
}
|
|
75548
75950
|
const doc = {
|
|
75549
|
-
kind:
|
|
75951
|
+
kind: graphql26.Kind.DOCUMENT,
|
|
75550
75952
|
definitions: Object.values(generatedFragments)
|
|
75551
75953
|
};
|
|
75552
75954
|
documents.push({
|
|
@@ -75582,7 +75984,7 @@ function inlineFragmentArgs({
|
|
|
75582
75984
|
filepath,
|
|
75583
75985
|
document
|
|
75584
75986
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
75585
|
-
const result =
|
|
75987
|
+
const result = graphql26.visit(document, {
|
|
75586
75988
|
FragmentSpread(node) {
|
|
75587
75989
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
75588
75990
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -75670,7 +76072,7 @@ function inlineFragmentArgs({
|
|
|
75670
76072
|
});
|
|
75671
76073
|
if (newName) {
|
|
75672
76074
|
result.name = {
|
|
75673
|
-
kind:
|
|
76075
|
+
kind: graphql26.Kind.NAME,
|
|
75674
76076
|
value: newName
|
|
75675
76077
|
};
|
|
75676
76078
|
}
|
|
@@ -75782,7 +76184,7 @@ function operationScope(operation) {
|
|
|
75782
76184
|
}
|
|
75783
76185
|
|
|
75784
76186
|
// src/codegen/validators/typeCheck.ts
|
|
75785
|
-
var
|
|
76187
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
75786
76188
|
async function typeCheck(config2, docs) {
|
|
75787
76189
|
const errors = [];
|
|
75788
76190
|
const freeLists = [];
|
|
@@ -75790,11 +76192,11 @@ async function typeCheck(config2, docs) {
|
|
|
75790
76192
|
const listTypes = [];
|
|
75791
76193
|
const fragments = {};
|
|
75792
76194
|
for (const { document: parsed, filename } of docs) {
|
|
75793
|
-
|
|
75794
|
-
[
|
|
76195
|
+
graphql27.visit(parsed, {
|
|
76196
|
+
[graphql27.Kind.FRAGMENT_DEFINITION](definition) {
|
|
75795
76197
|
fragments[definition.name.value] = definition;
|
|
75796
76198
|
},
|
|
75797
|
-
[
|
|
76199
|
+
[graphql27.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
75798
76200
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
75799
76201
|
return;
|
|
75800
76202
|
}
|
|
@@ -75840,14 +76242,14 @@ async function typeCheck(config2, docs) {
|
|
|
75840
76242
|
);
|
|
75841
76243
|
return;
|
|
75842
76244
|
}
|
|
75843
|
-
if (
|
|
76245
|
+
if (graphql27.isListType(rootType) || graphql27.isNonNullType(rootType) && graphql27.isListType(rootType.ofType)) {
|
|
75844
76246
|
needsParent = true;
|
|
75845
76247
|
break;
|
|
75846
76248
|
}
|
|
75847
|
-
if (
|
|
76249
|
+
if (graphql27.isNonNullType(rootType) && "ofType" in rootType) {
|
|
75848
76250
|
rootType = rootType.ofType;
|
|
75849
76251
|
}
|
|
75850
|
-
if (
|
|
76252
|
+
if (graphql27.isScalarType(rootType)) {
|
|
75851
76253
|
break;
|
|
75852
76254
|
}
|
|
75853
76255
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -75903,7 +76305,7 @@ async function typeCheck(config2, docs) {
|
|
|
75903
76305
|
);
|
|
75904
76306
|
const targetField = ancestors[ancestors.length - 1];
|
|
75905
76307
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
75906
|
-
const { type, error } = connectionSelection(
|
|
76308
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
75907
76309
|
config2,
|
|
75908
76310
|
targetFieldDefinition,
|
|
75909
76311
|
parentTypeFromAncestors(
|
|
@@ -75913,10 +76315,19 @@ async function typeCheck(config2, docs) {
|
|
|
75913
76315
|
),
|
|
75914
76316
|
targetField.selectionSet
|
|
75915
76317
|
);
|
|
76318
|
+
if (errorConnectionSelection && directive.name.value === config2.paginateDirective) {
|
|
76319
|
+
errors.push(
|
|
76320
|
+
new HoudiniError({
|
|
76321
|
+
filepath: filename,
|
|
76322
|
+
message: errorConnectionSelection,
|
|
76323
|
+
description: errorConnectionSelection
|
|
76324
|
+
})
|
|
76325
|
+
);
|
|
76326
|
+
}
|
|
75916
76327
|
let targetTypes = [type];
|
|
75917
|
-
if (
|
|
76328
|
+
if (graphql27.isUnionType(type)) {
|
|
75918
76329
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
75919
|
-
} else if (
|
|
76330
|
+
} else if (graphql27.isInterfaceType(type)) {
|
|
75920
76331
|
try {
|
|
75921
76332
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
75922
76333
|
if (!type.getFields()[key]) {
|
|
@@ -75930,23 +76341,16 @@ async function typeCheck(config2, docs) {
|
|
|
75930
76341
|
for (const targetType of targetTypes) {
|
|
75931
76342
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
75932
76343
|
if (missingIDFields.length > 0) {
|
|
75933
|
-
|
|
75934
|
-
|
|
75935
|
-
|
|
75936
|
-
|
|
75937
|
-
|
|
75938
|
-
|
|
75939
|
-
|
|
75940
|
-
|
|
75941
|
-
|
|
75942
|
-
|
|
75943
|
-
filepath: filename,
|
|
75944
|
-
message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
75945
|
-
", "
|
|
75946
|
-
)}.`
|
|
75947
|
-
})
|
|
75948
|
-
);
|
|
75949
|
-
}
|
|
76344
|
+
const message = `@${config2.listDirective} on ${logGreen(
|
|
76345
|
+
targetType.name
|
|
76346
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
76347
|
+
errors.push(
|
|
76348
|
+
new HoudiniError({
|
|
76349
|
+
filepath: filename,
|
|
76350
|
+
message,
|
|
76351
|
+
description: message
|
|
76352
|
+
})
|
|
76353
|
+
);
|
|
75950
76354
|
return;
|
|
75951
76355
|
}
|
|
75952
76356
|
}
|
|
@@ -75961,13 +76365,13 @@ async function typeCheck(config2, docs) {
|
|
|
75961
76365
|
if (errors.length > 0) {
|
|
75962
76366
|
throw errors;
|
|
75963
76367
|
}
|
|
75964
|
-
const rules = (filepath) => [...
|
|
76368
|
+
const rules = (filepath) => [...graphql27.specifiedRules].filter(
|
|
75965
76369
|
(rule) => ![
|
|
75966
|
-
|
|
75967
|
-
|
|
75968
|
-
|
|
75969
|
-
|
|
75970
|
-
|
|
76370
|
+
graphql27.NoUnusedFragmentsRule,
|
|
76371
|
+
graphql27.KnownFragmentNamesRule,
|
|
76372
|
+
graphql27.ExecutableDefinitionsRule,
|
|
76373
|
+
graphql27.KnownDirectivesRule,
|
|
76374
|
+
graphql27.KnownArgumentNamesRule
|
|
75971
76375
|
].includes(rule)
|
|
75972
76376
|
).concat(
|
|
75973
76377
|
validateLists({
|
|
@@ -75986,7 +76390,7 @@ async function typeCheck(config2, docs) {
|
|
|
75986
76390
|
noUnusedFragmentArguments(config2)
|
|
75987
76391
|
);
|
|
75988
76392
|
for (const { filename, document: parsed } of docs) {
|
|
75989
|
-
for (const error of
|
|
76393
|
+
for (const error of graphql27.validate(config2.schema, parsed, rules(filename))) {
|
|
75990
76394
|
errors.push(
|
|
75991
76395
|
new HoudiniError({
|
|
75992
76396
|
filepath: filename,
|
|
@@ -76012,7 +76416,7 @@ var validateLists = ({
|
|
|
76012
76416
|
if (!config2.isListFragment(node.name.value)) {
|
|
76013
76417
|
if (!fragments[node.name.value]) {
|
|
76014
76418
|
ctx.reportError(
|
|
76015
|
-
new
|
|
76419
|
+
new graphql27.GraphQLError(
|
|
76016
76420
|
"Encountered unknown fragment: " + node.name.value
|
|
76017
76421
|
)
|
|
76018
76422
|
);
|
|
@@ -76022,7 +76426,7 @@ var validateLists = ({
|
|
|
76022
76426
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
76023
76427
|
if (!lists.includes(listName)) {
|
|
76024
76428
|
ctx.reportError(
|
|
76025
|
-
new
|
|
76429
|
+
new graphql27.GraphQLError(
|
|
76026
76430
|
"Encountered fragment referencing unknown list: " + listName
|
|
76027
76431
|
)
|
|
76028
76432
|
);
|
|
@@ -76047,7 +76451,7 @@ var validateLists = ({
|
|
|
76047
76451
|
);
|
|
76048
76452
|
if (parentArg) {
|
|
76049
76453
|
ctx.reportError(
|
|
76050
|
-
new
|
|
76454
|
+
new graphql27.GraphQLError(
|
|
76051
76455
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
76052
76456
|
)
|
|
76053
76457
|
);
|
|
@@ -76063,7 +76467,7 @@ var validateLists = ({
|
|
|
76063
76467
|
return;
|
|
76064
76468
|
}
|
|
76065
76469
|
ctx.reportError(
|
|
76066
|
-
new
|
|
76470
|
+
new graphql27.GraphQLError(
|
|
76067
76471
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
76068
76472
|
)
|
|
76069
76473
|
);
|
|
@@ -76073,7 +76477,7 @@ var validateLists = ({
|
|
|
76073
76477
|
const directiveName = node.name.value;
|
|
76074
76478
|
if (directiveName === "connection") {
|
|
76075
76479
|
ctx.reportError(
|
|
76076
|
-
new
|
|
76480
|
+
new graphql27.GraphQLError(
|
|
76077
76481
|
"@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."
|
|
76078
76482
|
)
|
|
76079
76483
|
);
|
|
@@ -76082,7 +76486,7 @@ var validateLists = ({
|
|
|
76082
76486
|
if (!config2.isInternalDirective(node)) {
|
|
76083
76487
|
if (!config2.schema.getDirective(directiveName)) {
|
|
76084
76488
|
ctx.reportError(
|
|
76085
|
-
new
|
|
76489
|
+
new graphql27.GraphQLError(
|
|
76086
76490
|
"Encountered unknown directive: " + directiveName
|
|
76087
76491
|
)
|
|
76088
76492
|
);
|
|
@@ -76091,7 +76495,7 @@ var validateLists = ({
|
|
|
76091
76495
|
}
|
|
76092
76496
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
76093
76497
|
ctx.reportError(
|
|
76094
|
-
new
|
|
76498
|
+
new graphql27.GraphQLError(
|
|
76095
76499
|
"Encountered directive referencing unknown list: " + directiveName
|
|
76096
76500
|
)
|
|
76097
76501
|
);
|
|
@@ -76102,7 +76506,7 @@ var validateLists = ({
|
|
|
76102
76506
|
};
|
|
76103
76507
|
function knownArguments(config2) {
|
|
76104
76508
|
return function(ctx) {
|
|
76105
|
-
const nativeValidator =
|
|
76509
|
+
const nativeValidator = graphql27.KnownArgumentNamesRule(ctx);
|
|
76106
76510
|
return {
|
|
76107
76511
|
...nativeValidator,
|
|
76108
76512
|
Directive(directiveNode) {
|
|
@@ -76135,7 +76539,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76135
76539
|
for (const arg of node.arguments || []) {
|
|
76136
76540
|
if (arg.value.kind !== "ObjectValue") {
|
|
76137
76541
|
ctx.reportError(
|
|
76138
|
-
new
|
|
76542
|
+
new graphql27.GraphQLError("values in @arguments must be an object")
|
|
76139
76543
|
);
|
|
76140
76544
|
return;
|
|
76141
76545
|
}
|
|
@@ -76145,13 +76549,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76145
76549
|
);
|
|
76146
76550
|
if (!typeArg) {
|
|
76147
76551
|
ctx.reportError(
|
|
76148
|
-
new
|
|
76552
|
+
new graphql27.GraphQLError("missing type field for @arguments directive")
|
|
76149
76553
|
);
|
|
76150
76554
|
return;
|
|
76151
76555
|
}
|
|
76152
|
-
if (typeArg.value.kind !==
|
|
76556
|
+
if (typeArg.value.kind !== graphql27.Kind.STRING) {
|
|
76153
76557
|
ctx.reportError(
|
|
76154
|
-
new
|
|
76558
|
+
new graphql27.GraphQLError("type field to @arguments must be a string")
|
|
76155
76559
|
);
|
|
76156
76560
|
return;
|
|
76157
76561
|
}
|
|
@@ -76164,7 +76568,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76164
76568
|
);
|
|
76165
76569
|
if (typeArg.value.value !== defaultValueType) {
|
|
76166
76570
|
ctx.reportError(
|
|
76167
|
-
new
|
|
76571
|
+
new graphql27.GraphQLError(
|
|
76168
76572
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
76169
76573
|
)
|
|
76170
76574
|
);
|
|
@@ -76182,7 +76586,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76182
76586
|
try {
|
|
76183
76587
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
76184
76588
|
} catch (e2) {
|
|
76185
|
-
ctx.reportError(new
|
|
76589
|
+
ctx.reportError(new graphql27.GraphQLError(e2.message));
|
|
76186
76590
|
return;
|
|
76187
76591
|
}
|
|
76188
76592
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -76205,7 +76609,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76205
76609
|
);
|
|
76206
76610
|
if (missing.length > 0) {
|
|
76207
76611
|
ctx.reportError(
|
|
76208
|
-
new
|
|
76612
|
+
new graphql27.GraphQLError(
|
|
76209
76613
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
76210
76614
|
)
|
|
76211
76615
|
);
|
|
@@ -76216,7 +76620,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76216
76620
|
);
|
|
76217
76621
|
if (unknown.length > 0) {
|
|
76218
76622
|
ctx.reportError(
|
|
76219
|
-
new
|
|
76623
|
+
new graphql27.GraphQLError(
|
|
76220
76624
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
76221
76625
|
)
|
|
76222
76626
|
);
|
|
@@ -76228,7 +76632,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76228
76632
|
]
|
|
76229
76633
|
);
|
|
76230
76634
|
for (const [applied, target] of zipped) {
|
|
76231
|
-
if (applied.value.kind ===
|
|
76635
|
+
if (applied.value.kind === graphql27.Kind.VARIABLE || applied.value.kind === graphql27.Kind.LIST || applied.value.kind === graphql27.Kind.OBJECT) {
|
|
76232
76636
|
continue;
|
|
76233
76637
|
}
|
|
76234
76638
|
const appliedType = applied.value.kind.substring(
|
|
@@ -76237,7 +76641,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76237
76641
|
);
|
|
76238
76642
|
if (appliedType !== target) {
|
|
76239
76643
|
ctx.reportError(
|
|
76240
|
-
new
|
|
76644
|
+
new graphql27.GraphQLError(
|
|
76241
76645
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
76242
76646
|
)
|
|
76243
76647
|
);
|
|
@@ -76258,7 +76662,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76258
76662
|
}
|
|
76259
76663
|
if (alreadyPaginated) {
|
|
76260
76664
|
ctx.reportError(
|
|
76261
|
-
new
|
|
76665
|
+
new graphql27.GraphQLError(
|
|
76262
76666
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
76263
76667
|
)
|
|
76264
76668
|
);
|
|
@@ -76273,7 +76677,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76273
76677
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
76274
76678
|
if (hasRequiredArgs) {
|
|
76275
76679
|
ctx.reportError(
|
|
76276
|
-
new
|
|
76680
|
+
new graphql27.GraphQLError(
|
|
76277
76681
|
"@paginate cannot appear on a document with required args"
|
|
76278
76682
|
)
|
|
76279
76683
|
);
|
|
@@ -76305,14 +76709,14 @@ function paginateArgs(config2, filepath) {
|
|
|
76305
76709
|
const backwards = appliedArgs.has("last");
|
|
76306
76710
|
if (!forward && !backwards) {
|
|
76307
76711
|
ctx.reportError(
|
|
76308
|
-
new
|
|
76712
|
+
new graphql27.GraphQLError(
|
|
76309
76713
|
"A field with cursor-based pagination must have a first or last argument"
|
|
76310
76714
|
)
|
|
76311
76715
|
);
|
|
76312
76716
|
}
|
|
76313
76717
|
if (forward && backwards) {
|
|
76314
76718
|
ctx.reportError(
|
|
76315
|
-
new
|
|
76719
|
+
new graphql27.GraphQLError(
|
|
76316
76720
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
76317
76721
|
)
|
|
76318
76722
|
);
|
|
@@ -76326,7 +76730,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76326
76730
|
);
|
|
76327
76731
|
if (!appliedLimitArg) {
|
|
76328
76732
|
ctx.reportError(
|
|
76329
|
-
new
|
|
76733
|
+
new graphql27.GraphQLError(
|
|
76330
76734
|
"A field with offset-based pagination must have a limit argument"
|
|
76331
76735
|
)
|
|
76332
76736
|
);
|
|
@@ -76342,20 +76746,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
76342
76746
|
const args = /* @__PURE__ */ new Set();
|
|
76343
76747
|
return {
|
|
76344
76748
|
enter(node) {
|
|
76345
|
-
if (node.kind ===
|
|
76749
|
+
if (node.kind === graphql27.Kind.FRAGMENT_DEFINITION) {
|
|
76346
76750
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
76347
76751
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
76348
76752
|
args.add(arg);
|
|
76349
76753
|
}
|
|
76350
|
-
} else if (node.kind ===
|
|
76754
|
+
} else if (node.kind === graphql27.Kind.VARIABLE) {
|
|
76351
76755
|
args.delete(node.name.value);
|
|
76352
76756
|
}
|
|
76353
76757
|
},
|
|
76354
76758
|
leave(node) {
|
|
76355
|
-
if (node.kind ===
|
|
76759
|
+
if (node.kind === graphql27.Kind.FRAGMENT_DEFINITION) {
|
|
76356
76760
|
if (args.size > 0) {
|
|
76357
76761
|
ctx.reportError(
|
|
76358
|
-
new
|
|
76762
|
+
new graphql27.GraphQLError(
|
|
76359
76763
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
76360
76764
|
)
|
|
76361
76765
|
);
|
|
@@ -76391,7 +76795,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76391
76795
|
if (definition.kind === "OperationDefinition") {
|
|
76392
76796
|
if (definition.operation !== "query") {
|
|
76393
76797
|
ctx.reportError(
|
|
76394
|
-
new
|
|
76798
|
+
new graphql27.GraphQLError(
|
|
76395
76799
|
`@${node.name.value} must fall on a fragment or query document`
|
|
76396
76800
|
)
|
|
76397
76801
|
);
|
|
@@ -76403,7 +76807,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76403
76807
|
}
|
|
76404
76808
|
if (!possibleNodes.includes(definitionType)) {
|
|
76405
76809
|
ctx.reportError(
|
|
76406
|
-
new
|
|
76810
|
+
new graphql27.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
76407
76811
|
);
|
|
76408
76812
|
}
|
|
76409
76813
|
}
|
|
@@ -76422,7 +76826,7 @@ function checkMutationOperation(config2) {
|
|
|
76422
76826
|
);
|
|
76423
76827
|
if (append && prepend) {
|
|
76424
76828
|
ctx.reportError(
|
|
76425
|
-
new
|
|
76829
|
+
new graphql27.GraphQLError(
|
|
76426
76830
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
76427
76831
|
)
|
|
76428
76832
|
);
|
|
@@ -76436,7 +76840,7 @@ function checkMutationOperation(config2) {
|
|
|
76436
76840
|
);
|
|
76437
76841
|
if (parentId && allLists) {
|
|
76438
76842
|
ctx.reportError(
|
|
76439
|
-
new
|
|
76843
|
+
new graphql27.GraphQLError(
|
|
76440
76844
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
76441
76845
|
)
|
|
76442
76846
|
);
|
|
@@ -76458,7 +76862,7 @@ function checkMaskDirective(config2) {
|
|
|
76458
76862
|
);
|
|
76459
76863
|
if (maskEnableDirective && maskDisableDirective) {
|
|
76460
76864
|
ctx.reportError(
|
|
76461
|
-
new
|
|
76865
|
+
new graphql27.GraphQLError(
|
|
76462
76866
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
76463
76867
|
)
|
|
76464
76868
|
);
|
|
@@ -76474,7 +76878,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
76474
76878
|
if (!nodeInterface) {
|
|
76475
76879
|
return null;
|
|
76476
76880
|
}
|
|
76477
|
-
if (!
|
|
76881
|
+
if (!graphql27.isInterfaceType(nodeInterface)) {
|
|
76478
76882
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
76479
76883
|
return null;
|
|
76480
76884
|
}
|
|
@@ -76572,11 +76976,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
76572
76976
|
}
|
|
76573
76977
|
|
|
76574
76978
|
// src/codegen/validators/noIDAlias.ts
|
|
76575
|
-
var
|
|
76979
|
+
var graphql28 = __toESM(require_graphql2(), 1);
|
|
76576
76980
|
async function noIDAlias(config2, docs) {
|
|
76577
76981
|
const errors = [];
|
|
76578
76982
|
for (const { filename, document } of docs) {
|
|
76579
|
-
|
|
76983
|
+
graphql28.visit(document, {
|
|
76580
76984
|
Field(node, _, __, ___, ancestors) {
|
|
76581
76985
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
76582
76986
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -76718,8 +77122,8 @@ async function collectDocuments(config2) {
|
|
|
76718
77122
|
}
|
|
76719
77123
|
}
|
|
76720
77124
|
}
|
|
76721
|
-
const graphql_extractor = (filepath, content) => [content];
|
|
76722
|
-
const javascript_extractor = (
|
|
77125
|
+
const graphql_extractor = (config3, filepath, content) => [content];
|
|
77126
|
+
const javascript_extractor = (fconfig, ilepath, content) => processJSFile(config2, content);
|
|
76723
77127
|
extractors[".ts"].push(javascript_extractor);
|
|
76724
77128
|
extractors[".js"].push(javascript_extractor);
|
|
76725
77129
|
extractors[".graphql"].push(graphql_extractor);
|
|
@@ -76743,7 +77147,7 @@ async function collectDocuments(config2) {
|
|
|
76743
77147
|
if (!extractor) {
|
|
76744
77148
|
continue;
|
|
76745
77149
|
}
|
|
76746
|
-
const found = await extractor(filepath, contents);
|
|
77150
|
+
const found = await extractor(config2, filepath, contents);
|
|
76747
77151
|
if (found.length > 0) {
|
|
76748
77152
|
documents.push(...found.map((document) => ({ filepath, document })));
|
|
76749
77153
|
}
|
|
@@ -76774,12 +77178,12 @@ async function processJSFile(config2, contents) {
|
|
|
76774
77178
|
return documents;
|
|
76775
77179
|
}
|
|
76776
77180
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
76777
|
-
const parsedDoc =
|
|
77181
|
+
const parsedDoc = graphql29.parse(document);
|
|
76778
77182
|
const operations = parsedDoc.definitions.filter(
|
|
76779
|
-
({ kind: kind2 }) => kind2 ===
|
|
77183
|
+
({ kind: kind2 }) => kind2 === graphql29.Kind.OPERATION_DEFINITION
|
|
76780
77184
|
);
|
|
76781
77185
|
const fragments = parsedDoc.definitions.filter(
|
|
76782
|
-
({ kind: kind2 }) => kind2 ===
|
|
77186
|
+
({ kind: kind2 }) => kind2 === graphql29.Kind.FRAGMENT_DEFINITION
|
|
76783
77187
|
);
|
|
76784
77188
|
if (operations.length > 1) {
|
|
76785
77189
|
throw new HoudiniError({
|
|
@@ -76859,7 +77263,8 @@ function logStyled(kind, stat3, logLevel, plugin) {
|
|
|
76859
77263
|
// src/cmd/pullSchema.ts
|
|
76860
77264
|
async function pullSchema_default(args) {
|
|
76861
77265
|
const config2 = await getConfig({ noSchema: true });
|
|
76862
|
-
|
|
77266
|
+
const apiURL = await config2.apiURL();
|
|
77267
|
+
if (!apiURL) {
|
|
76863
77268
|
console.log(
|
|
76864
77269
|
"\u274C Your project does not have a remote endpoint configured. Please provide one with the `apiUrl` value in your houdini.config.js file."
|
|
76865
77270
|
);
|
|
@@ -76867,7 +77272,7 @@ async function pullSchema_default(args) {
|
|
|
76867
77272
|
return;
|
|
76868
77273
|
}
|
|
76869
77274
|
const targetPath = process.cwd();
|
|
76870
|
-
let headers = config2.pullHeaders;
|
|
77275
|
+
let headers = await config2.pullHeaders();
|
|
76871
77276
|
let headerStrings = [];
|
|
76872
77277
|
if (args.headers) {
|
|
76873
77278
|
headerStrings = args.headers;
|
|
@@ -76882,7 +77287,7 @@ async function pullSchema_default(args) {
|
|
|
76882
77287
|
}, headers);
|
|
76883
77288
|
}
|
|
76884
77289
|
await pullSchema(
|
|
76885
|
-
|
|
77290
|
+
apiURL,
|
|
76886
77291
|
config2.schemaPath ? config2.schemaPath : path_exports.resolve(targetPath, "schema.json"),
|
|
76887
77292
|
headers
|
|
76888
77293
|
);
|
|
@@ -76904,7 +77309,7 @@ async function generate(args = {
|
|
|
76904
77309
|
if (args.output) {
|
|
76905
77310
|
config2.persistedQueryPath = args.output;
|
|
76906
77311
|
}
|
|
76907
|
-
if (args.pullSchema && config2.
|
|
77312
|
+
if (args.pullSchema && await config2.apiURL()) {
|
|
76908
77313
|
if (args.pullHeader) {
|
|
76909
77314
|
console.log("\u26A0\uFE0F --pull-headers has been replaced by --headers (abbreviated -h)");
|
|
76910
77315
|
args.headers = args.pullHeader;
|
|
@@ -77080,7 +77485,7 @@ async function init(_path, args) {
|
|
|
77080
77485
|
await graphqlRCFile(targetPath);
|
|
77081
77486
|
await gitIgnore(targetPath);
|
|
77082
77487
|
if (framework === "kit") {
|
|
77083
|
-
await updateSvelteConfig(targetPath);
|
|
77488
|
+
await updateSvelteConfig(targetPath, typescript);
|
|
77084
77489
|
} else if (framework === "svelte") {
|
|
77085
77490
|
await updateSvelteMainJs(targetPath);
|
|
77086
77491
|
}
|
|
@@ -77103,14 +77508,15 @@ async function init(_path, args) {
|
|
|
77103
77508
|
2\uFE0F\u20E3 Start your application: ${logGreen(cmd_run)}
|
|
77104
77509
|
`);
|
|
77105
77510
|
}
|
|
77106
|
-
var networkFile = (url, typescript) => `import { HoudiniClient${typescript ? ", type
|
|
77511
|
+
var networkFile = (url, typescript) => `import { HoudiniClient${typescript ? ", type RequestHandler" : ""} } from '$houdini';
|
|
77107
77512
|
|
|
77108
|
-
|
|
77513
|
+
${typescript ? `const requestHandler: RequestHandler` : `/** @type {import('$houdini').RequestHandler<any>} */
|
|
77514
|
+
const requestHandler`} = async ({
|
|
77109
77515
|
fetch,
|
|
77110
77516
|
text = '',
|
|
77111
77517
|
variables = {},
|
|
77112
77518
|
metadata
|
|
77113
|
-
}
|
|
77519
|
+
}) => {
|
|
77114
77520
|
const url = '${url}';
|
|
77115
77521
|
const result = await fetch(url, {
|
|
77116
77522
|
method: 'POST',
|
|
@@ -77125,7 +77531,7 @@ async function fetchQuery({
|
|
|
77125
77531
|
return await result.json();
|
|
77126
77532
|
}
|
|
77127
77533
|
|
|
77128
|
-
export default new HoudiniClient(
|
|
77534
|
+
export default new HoudiniClient(requestHandler);
|
|
77129
77535
|
`;
|
|
77130
77536
|
var writeConfigFile = async ({
|
|
77131
77537
|
configPath,
|
|
@@ -77263,16 +77669,16 @@ export default config;
|
|
|
77263
77669
|
});
|
|
77264
77670
|
}
|
|
77265
77671
|
}
|
|
77266
|
-
async function updateSvelteConfig(targetPath) {
|
|
77672
|
+
async function updateSvelteConfig(targetPath, typescript) {
|
|
77267
77673
|
const svelteConfigPath = path_exports.join(targetPath, "svelte.config.js");
|
|
77268
|
-
const
|
|
77269
|
-
import
|
|
77674
|
+
const newContentTs = `import adapter from '@sveltejs/adapter-auto';
|
|
77675
|
+
import { vitePreprocess } from '@sveltejs/kit/vite';
|
|
77270
77676
|
|
|
77271
77677
|
/** @type {import('@sveltejs/kit').Config} */
|
|
77272
77678
|
const config = {
|
|
77273
|
-
// Consult https://
|
|
77679
|
+
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
|
77274
77680
|
// for more information about preprocessors
|
|
77275
|
-
preprocess:
|
|
77681
|
+
preprocess: vitePreprocess(),
|
|
77276
77682
|
|
|
77277
77683
|
kit: {
|
|
77278
77684
|
adapter: adapter(),
|
|
@@ -77282,11 +77688,25 @@ const config = {
|
|
|
77282
77688
|
}
|
|
77283
77689
|
};
|
|
77284
77690
|
|
|
77691
|
+
export default config;
|
|
77692
|
+
`;
|
|
77693
|
+
const newContentJs = `import adapter from '@sveltejs/adapter-auto';
|
|
77694
|
+
|
|
77695
|
+
/** @type {import('@sveltejs/kit').Config} */
|
|
77696
|
+
const config = {
|
|
77697
|
+
kit: {
|
|
77698
|
+
adapter: adapter(),
|
|
77699
|
+
alias: {
|
|
77700
|
+
$houdini: './$houdini',
|
|
77701
|
+
}
|
|
77702
|
+
}
|
|
77703
|
+
};
|
|
77704
|
+
|
|
77285
77705
|
export default config;
|
|
77286
77706
|
`;
|
|
77287
77707
|
await updateFile({
|
|
77288
77708
|
filepath: svelteConfigPath,
|
|
77289
|
-
content:
|
|
77709
|
+
content: typescript ? newContentTs : newContentJs
|
|
77290
77710
|
});
|
|
77291
77711
|
}
|
|
77292
77712
|
async function updateSvelteMainJs(targetPath) {
|
|
@@ -77318,8 +77738,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
77318
77738
|
}
|
|
77319
77739
|
packageJSON.devDependencies = {
|
|
77320
77740
|
...packageJSON.devDependencies,
|
|
77321
|
-
houdini: "^0.
|
|
77322
|
-
"houdini-svelte": "^0.
|
|
77741
|
+
houdini: "^0.19.0",
|
|
77742
|
+
"houdini-svelte": "^0.19.0",
|
|
77323
77743
|
graphql: "^15.8.0"
|
|
77324
77744
|
};
|
|
77325
77745
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|