@skilder-ai/runtime 0.7.6 → 0.7.7
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/dist/index.js +864 -750
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4094,9 +4094,9 @@ var require_parser = __commonJS({
|
|
|
4094
4094
|
function parseType(source, options) {
|
|
4095
4095
|
const parser = new Parser(source, options);
|
|
4096
4096
|
parser.expectToken(_tokenKind.TokenKind.SOF);
|
|
4097
|
-
const
|
|
4097
|
+
const type22 = parser.parseTypeReference();
|
|
4098
4098
|
parser.expectToken(_tokenKind.TokenKind.EOF);
|
|
4099
|
-
return
|
|
4099
|
+
return type22;
|
|
4100
4100
|
}
|
|
4101
4101
|
function parseSchemaCoordinate(source) {
|
|
4102
4102
|
const sourceObj = (0, _source.isSource)(source) ? source : new _source.Source(source);
|
|
@@ -4629,24 +4629,24 @@ var require_parser = __commonJS({
|
|
|
4629
4629
|
*/
|
|
4630
4630
|
parseTypeReference() {
|
|
4631
4631
|
const start2 = this._lexer.token;
|
|
4632
|
-
let
|
|
4632
|
+
let type22;
|
|
4633
4633
|
if (this.expectOptionalToken(_tokenKind.TokenKind.BRACKET_L)) {
|
|
4634
4634
|
const innerType = this.parseTypeReference();
|
|
4635
4635
|
this.expectToken(_tokenKind.TokenKind.BRACKET_R);
|
|
4636
|
-
|
|
4636
|
+
type22 = this.node(start2, {
|
|
4637
4637
|
kind: _kinds.Kind.LIST_TYPE,
|
|
4638
4638
|
type: innerType
|
|
4639
4639
|
});
|
|
4640
4640
|
} else {
|
|
4641
|
-
|
|
4641
|
+
type22 = this.parseNamedType();
|
|
4642
4642
|
}
|
|
4643
4643
|
if (this.expectOptionalToken(_tokenKind.TokenKind.BANG)) {
|
|
4644
4644
|
return this.node(start2, {
|
|
4645
4645
|
kind: _kinds.Kind.NON_NULL_TYPE,
|
|
4646
|
-
type:
|
|
4646
|
+
type: type22
|
|
4647
4647
|
});
|
|
4648
4648
|
}
|
|
4649
|
-
return
|
|
4649
|
+
return type22;
|
|
4650
4650
|
}
|
|
4651
4651
|
/**
|
|
4652
4652
|
* NamedType : Name
|
|
@@ -4698,11 +4698,11 @@ var require_parser = __commonJS({
|
|
|
4698
4698
|
const start2 = this._lexer.token;
|
|
4699
4699
|
const operation = this.parseOperationType();
|
|
4700
4700
|
this.expectToken(_tokenKind.TokenKind.COLON);
|
|
4701
|
-
const
|
|
4701
|
+
const type22 = this.parseNamedType();
|
|
4702
4702
|
return this.node(start2, {
|
|
4703
4703
|
kind: _kinds.Kind.OPERATION_TYPE_DEFINITION,
|
|
4704
4704
|
operation,
|
|
4705
|
-
type:
|
|
4705
|
+
type: type22
|
|
4706
4706
|
});
|
|
4707
4707
|
}
|
|
4708
4708
|
/**
|
|
@@ -4773,14 +4773,14 @@ var require_parser = __commonJS({
|
|
|
4773
4773
|
const name21 = this.parseName();
|
|
4774
4774
|
const args = this.parseArgumentDefs();
|
|
4775
4775
|
this.expectToken(_tokenKind.TokenKind.COLON);
|
|
4776
|
-
const
|
|
4776
|
+
const type22 = this.parseTypeReference();
|
|
4777
4777
|
const directives = this.parseConstDirectives();
|
|
4778
4778
|
return this.node(start2, {
|
|
4779
4779
|
kind: _kinds.Kind.FIELD_DEFINITION,
|
|
4780
4780
|
description,
|
|
4781
4781
|
name: name21,
|
|
4782
4782
|
arguments: args,
|
|
4783
|
-
type:
|
|
4783
|
+
type: type22,
|
|
4784
4784
|
directives
|
|
4785
4785
|
});
|
|
4786
4786
|
}
|
|
@@ -4803,7 +4803,7 @@ var require_parser = __commonJS({
|
|
|
4803
4803
|
const description = this.parseDescription();
|
|
4804
4804
|
const name21 = this.parseName();
|
|
4805
4805
|
this.expectToken(_tokenKind.TokenKind.COLON);
|
|
4806
|
-
const
|
|
4806
|
+
const type22 = this.parseTypeReference();
|
|
4807
4807
|
let defaultValue;
|
|
4808
4808
|
if (this.expectOptionalToken(_tokenKind.TokenKind.EQUALS)) {
|
|
4809
4809
|
defaultValue = this.parseConstValueLiteral();
|
|
@@ -4813,7 +4813,7 @@ var require_parser = __commonJS({
|
|
|
4813
4813
|
kind: _kinds.Kind.INPUT_VALUE_DEFINITION,
|
|
4814
4814
|
description,
|
|
4815
4815
|
name: name21,
|
|
4816
|
-
type:
|
|
4816
|
+
type: type22,
|
|
4817
4817
|
defaultValue,
|
|
4818
4818
|
directives
|
|
4819
4819
|
});
|
|
@@ -6165,7 +6165,7 @@ var require_printer = __commonJS({
|
|
|
6165
6165
|
}
|
|
6166
6166
|
},
|
|
6167
6167
|
VariableDefinition: {
|
|
6168
|
-
leave: ({ variable, type:
|
|
6168
|
+
leave: ({ variable, type: type22, defaultValue, directives, description }) => wrap("", description, "\n") + variable + ": " + type22 + wrap(" = ", defaultValue) + wrap(" ", join6(directives, " "))
|
|
6169
6169
|
},
|
|
6170
6170
|
SelectionSet: {
|
|
6171
6171
|
leave: ({ selections }) => block(selections)
|
|
@@ -6247,17 +6247,17 @@ var require_printer = __commonJS({
|
|
|
6247
6247
|
leave: ({ name: name21 }) => name21
|
|
6248
6248
|
},
|
|
6249
6249
|
ListType: {
|
|
6250
|
-
leave: ({ type:
|
|
6250
|
+
leave: ({ type: type22 }) => "[" + type22 + "]"
|
|
6251
6251
|
},
|
|
6252
6252
|
NonNullType: {
|
|
6253
|
-
leave: ({ type:
|
|
6253
|
+
leave: ({ type: type22 }) => type22 + "!"
|
|
6254
6254
|
},
|
|
6255
6255
|
// Type System Definitions
|
|
6256
6256
|
SchemaDefinition: {
|
|
6257
6257
|
leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join6(["schema", join6(directives, " "), block(operationTypes)], " ")
|
|
6258
6258
|
},
|
|
6259
6259
|
OperationTypeDefinition: {
|
|
6260
|
-
leave: ({ operation, type:
|
|
6260
|
+
leave: ({ operation, type: type22 }) => operation + ": " + type22
|
|
6261
6261
|
},
|
|
6262
6262
|
ScalarTypeDefinition: {
|
|
6263
6263
|
leave: ({ description, name: name21, directives }) => wrap("", description, "\n") + join6(["scalar", name21, join6(directives, " ")], " ")
|
|
@@ -6275,11 +6275,11 @@ var require_printer = __commonJS({
|
|
|
6275
6275
|
)
|
|
6276
6276
|
},
|
|
6277
6277
|
FieldDefinition: {
|
|
6278
|
-
leave: ({ description, name: name21, arguments: args, type:
|
|
6278
|
+
leave: ({ description, name: name21, arguments: args, type: type22, directives }) => wrap("", description, "\n") + name21 + (hasMultilineItems(args) ? wrap("(\n", indent(join6(args, "\n")), "\n)") : wrap("(", join6(args, ", "), ")")) + ": " + type22 + wrap(" ", join6(directives, " "))
|
|
6279
6279
|
},
|
|
6280
6280
|
InputValueDefinition: {
|
|
6281
|
-
leave: ({ description, name: name21, type:
|
|
6282
|
-
[name21 + ": " +
|
|
6281
|
+
leave: ({ description, name: name21, type: type22, defaultValue, directives }) => wrap("", description, "\n") + join6(
|
|
6282
|
+
[name21 + ": " + type22, wrap("= ", defaultValue), join6(directives, " ")],
|
|
6283
6283
|
" "
|
|
6284
6284
|
)
|
|
6285
6285
|
},
|
|
@@ -6550,161 +6550,161 @@ var require_definition = __commonJS({
|
|
|
6550
6550
|
var _printer = require_printer();
|
|
6551
6551
|
var _valueFromASTUntyped = require_valueFromASTUntyped();
|
|
6552
6552
|
var _assertName = require_assertName();
|
|
6553
|
-
function isType(
|
|
6554
|
-
return isScalarType(
|
|
6553
|
+
function isType(type22) {
|
|
6554
|
+
return isScalarType(type22) || isObjectType(type22) || isInterfaceType(type22) || isUnionType(type22) || isEnumType(type22) || isInputObjectType(type22) || isListType(type22) || isNonNullType(type22);
|
|
6555
6555
|
}
|
|
6556
|
-
function assertType(
|
|
6557
|
-
if (!isType(
|
|
6556
|
+
function assertType(type22) {
|
|
6557
|
+
if (!isType(type22)) {
|
|
6558
6558
|
throw new Error(
|
|
6559
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6559
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL type.`
|
|
6560
6560
|
);
|
|
6561
6561
|
}
|
|
6562
|
-
return
|
|
6562
|
+
return type22;
|
|
6563
6563
|
}
|
|
6564
|
-
function isScalarType(
|
|
6565
|
-
return (0, _instanceOf.instanceOf)(
|
|
6564
|
+
function isScalarType(type22) {
|
|
6565
|
+
return (0, _instanceOf.instanceOf)(type22, GraphQLScalarType);
|
|
6566
6566
|
}
|
|
6567
|
-
function assertScalarType(
|
|
6568
|
-
if (!isScalarType(
|
|
6567
|
+
function assertScalarType(type22) {
|
|
6568
|
+
if (!isScalarType(type22)) {
|
|
6569
6569
|
throw new Error(
|
|
6570
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6570
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL Scalar type.`
|
|
6571
6571
|
);
|
|
6572
6572
|
}
|
|
6573
|
-
return
|
|
6573
|
+
return type22;
|
|
6574
6574
|
}
|
|
6575
|
-
function isObjectType(
|
|
6576
|
-
return (0, _instanceOf.instanceOf)(
|
|
6575
|
+
function isObjectType(type22) {
|
|
6576
|
+
return (0, _instanceOf.instanceOf)(type22, GraphQLObjectType);
|
|
6577
6577
|
}
|
|
6578
|
-
function assertObjectType(
|
|
6579
|
-
if (!isObjectType(
|
|
6578
|
+
function assertObjectType(type22) {
|
|
6579
|
+
if (!isObjectType(type22)) {
|
|
6580
6580
|
throw new Error(
|
|
6581
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6581
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL Object type.`
|
|
6582
6582
|
);
|
|
6583
6583
|
}
|
|
6584
|
-
return
|
|
6584
|
+
return type22;
|
|
6585
6585
|
}
|
|
6586
|
-
function isInterfaceType(
|
|
6587
|
-
return (0, _instanceOf.instanceOf)(
|
|
6586
|
+
function isInterfaceType(type22) {
|
|
6587
|
+
return (0, _instanceOf.instanceOf)(type22, GraphQLInterfaceType);
|
|
6588
6588
|
}
|
|
6589
|
-
function assertInterfaceType(
|
|
6590
|
-
if (!isInterfaceType(
|
|
6589
|
+
function assertInterfaceType(type22) {
|
|
6590
|
+
if (!isInterfaceType(type22)) {
|
|
6591
6591
|
throw new Error(
|
|
6592
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6592
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL Interface type.`
|
|
6593
6593
|
);
|
|
6594
6594
|
}
|
|
6595
|
-
return
|
|
6595
|
+
return type22;
|
|
6596
6596
|
}
|
|
6597
|
-
function isUnionType(
|
|
6598
|
-
return (0, _instanceOf.instanceOf)(
|
|
6597
|
+
function isUnionType(type22) {
|
|
6598
|
+
return (0, _instanceOf.instanceOf)(type22, GraphQLUnionType);
|
|
6599
6599
|
}
|
|
6600
|
-
function assertUnionType(
|
|
6601
|
-
if (!isUnionType(
|
|
6600
|
+
function assertUnionType(type22) {
|
|
6601
|
+
if (!isUnionType(type22)) {
|
|
6602
6602
|
throw new Error(
|
|
6603
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6603
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL Union type.`
|
|
6604
6604
|
);
|
|
6605
6605
|
}
|
|
6606
|
-
return
|
|
6606
|
+
return type22;
|
|
6607
6607
|
}
|
|
6608
|
-
function isEnumType(
|
|
6609
|
-
return (0, _instanceOf.instanceOf)(
|
|
6608
|
+
function isEnumType(type22) {
|
|
6609
|
+
return (0, _instanceOf.instanceOf)(type22, GraphQLEnumType);
|
|
6610
6610
|
}
|
|
6611
|
-
function assertEnumType(
|
|
6612
|
-
if (!isEnumType(
|
|
6611
|
+
function assertEnumType(type22) {
|
|
6612
|
+
if (!isEnumType(type22)) {
|
|
6613
6613
|
throw new Error(
|
|
6614
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6614
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL Enum type.`
|
|
6615
6615
|
);
|
|
6616
6616
|
}
|
|
6617
|
-
return
|
|
6617
|
+
return type22;
|
|
6618
6618
|
}
|
|
6619
|
-
function isInputObjectType(
|
|
6620
|
-
return (0, _instanceOf.instanceOf)(
|
|
6619
|
+
function isInputObjectType(type22) {
|
|
6620
|
+
return (0, _instanceOf.instanceOf)(type22, GraphQLInputObjectType);
|
|
6621
6621
|
}
|
|
6622
|
-
function assertInputObjectType(
|
|
6623
|
-
if (!isInputObjectType(
|
|
6622
|
+
function assertInputObjectType(type22) {
|
|
6623
|
+
if (!isInputObjectType(type22)) {
|
|
6624
6624
|
throw new Error(
|
|
6625
6625
|
`Expected ${(0, _inspect.inspect)(
|
|
6626
|
-
|
|
6626
|
+
type22
|
|
6627
6627
|
)} to be a GraphQL Input Object type.`
|
|
6628
6628
|
);
|
|
6629
6629
|
}
|
|
6630
|
-
return
|
|
6630
|
+
return type22;
|
|
6631
6631
|
}
|
|
6632
|
-
function isListType(
|
|
6633
|
-
return (0, _instanceOf.instanceOf)(
|
|
6632
|
+
function isListType(type22) {
|
|
6633
|
+
return (0, _instanceOf.instanceOf)(type22, GraphQLList);
|
|
6634
6634
|
}
|
|
6635
|
-
function assertListType(
|
|
6636
|
-
if (!isListType(
|
|
6635
|
+
function assertListType(type22) {
|
|
6636
|
+
if (!isListType(type22)) {
|
|
6637
6637
|
throw new Error(
|
|
6638
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6638
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL List type.`
|
|
6639
6639
|
);
|
|
6640
6640
|
}
|
|
6641
|
-
return
|
|
6641
|
+
return type22;
|
|
6642
6642
|
}
|
|
6643
|
-
function isNonNullType(
|
|
6644
|
-
return (0, _instanceOf.instanceOf)(
|
|
6643
|
+
function isNonNullType(type22) {
|
|
6644
|
+
return (0, _instanceOf.instanceOf)(type22, GraphQLNonNull);
|
|
6645
6645
|
}
|
|
6646
|
-
function assertNonNullType(
|
|
6647
|
-
if (!isNonNullType(
|
|
6646
|
+
function assertNonNullType(type22) {
|
|
6647
|
+
if (!isNonNullType(type22)) {
|
|
6648
6648
|
throw new Error(
|
|
6649
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6649
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL Non-Null type.`
|
|
6650
6650
|
);
|
|
6651
6651
|
}
|
|
6652
|
-
return
|
|
6652
|
+
return type22;
|
|
6653
6653
|
}
|
|
6654
|
-
function isInputType(
|
|
6655
|
-
return isScalarType(
|
|
6654
|
+
function isInputType(type22) {
|
|
6655
|
+
return isScalarType(type22) || isEnumType(type22) || isInputObjectType(type22) || isWrappingType(type22) && isInputType(type22.ofType);
|
|
6656
6656
|
}
|
|
6657
|
-
function assertInputType(
|
|
6658
|
-
if (!isInputType(
|
|
6657
|
+
function assertInputType(type22) {
|
|
6658
|
+
if (!isInputType(type22)) {
|
|
6659
6659
|
throw new Error(
|
|
6660
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6660
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL input type.`
|
|
6661
6661
|
);
|
|
6662
6662
|
}
|
|
6663
|
-
return
|
|
6663
|
+
return type22;
|
|
6664
6664
|
}
|
|
6665
|
-
function isOutputType(
|
|
6666
|
-
return isScalarType(
|
|
6665
|
+
function isOutputType(type22) {
|
|
6666
|
+
return isScalarType(type22) || isObjectType(type22) || isInterfaceType(type22) || isUnionType(type22) || isEnumType(type22) || isWrappingType(type22) && isOutputType(type22.ofType);
|
|
6667
6667
|
}
|
|
6668
|
-
function assertOutputType(
|
|
6669
|
-
if (!isOutputType(
|
|
6668
|
+
function assertOutputType(type22) {
|
|
6669
|
+
if (!isOutputType(type22)) {
|
|
6670
6670
|
throw new Error(
|
|
6671
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6671
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL output type.`
|
|
6672
6672
|
);
|
|
6673
6673
|
}
|
|
6674
|
-
return
|
|
6674
|
+
return type22;
|
|
6675
6675
|
}
|
|
6676
|
-
function isLeafType(
|
|
6677
|
-
return isScalarType(
|
|
6676
|
+
function isLeafType(type22) {
|
|
6677
|
+
return isScalarType(type22) || isEnumType(type22);
|
|
6678
6678
|
}
|
|
6679
|
-
function assertLeafType(
|
|
6680
|
-
if (!isLeafType(
|
|
6679
|
+
function assertLeafType(type22) {
|
|
6680
|
+
if (!isLeafType(type22)) {
|
|
6681
6681
|
throw new Error(
|
|
6682
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6682
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL leaf type.`
|
|
6683
6683
|
);
|
|
6684
6684
|
}
|
|
6685
|
-
return
|
|
6685
|
+
return type22;
|
|
6686
6686
|
}
|
|
6687
|
-
function isCompositeType(
|
|
6688
|
-
return isObjectType(
|
|
6687
|
+
function isCompositeType(type22) {
|
|
6688
|
+
return isObjectType(type22) || isInterfaceType(type22) || isUnionType(type22);
|
|
6689
6689
|
}
|
|
6690
|
-
function assertCompositeType(
|
|
6691
|
-
if (!isCompositeType(
|
|
6690
|
+
function assertCompositeType(type22) {
|
|
6691
|
+
if (!isCompositeType(type22)) {
|
|
6692
6692
|
throw new Error(
|
|
6693
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6693
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL composite type.`
|
|
6694
6694
|
);
|
|
6695
6695
|
}
|
|
6696
|
-
return
|
|
6696
|
+
return type22;
|
|
6697
6697
|
}
|
|
6698
|
-
function isAbstractType(
|
|
6699
|
-
return isInterfaceType(
|
|
6698
|
+
function isAbstractType(type22) {
|
|
6699
|
+
return isInterfaceType(type22) || isUnionType(type22);
|
|
6700
6700
|
}
|
|
6701
|
-
function assertAbstractType(
|
|
6702
|
-
if (!isAbstractType(
|
|
6701
|
+
function assertAbstractType(type22) {
|
|
6702
|
+
if (!isAbstractType(type22)) {
|
|
6703
6703
|
throw new Error(
|
|
6704
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6704
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL abstract type.`
|
|
6705
6705
|
);
|
|
6706
6706
|
}
|
|
6707
|
-
return
|
|
6707
|
+
return type22;
|
|
6708
6708
|
}
|
|
6709
6709
|
var GraphQLList = class {
|
|
6710
6710
|
constructor(ofType) {
|
|
@@ -6746,47 +6746,47 @@ var require_definition = __commonJS({
|
|
|
6746
6746
|
}
|
|
6747
6747
|
};
|
|
6748
6748
|
exports2.GraphQLNonNull = GraphQLNonNull;
|
|
6749
|
-
function isWrappingType(
|
|
6750
|
-
return isListType(
|
|
6749
|
+
function isWrappingType(type22) {
|
|
6750
|
+
return isListType(type22) || isNonNullType(type22);
|
|
6751
6751
|
}
|
|
6752
|
-
function assertWrappingType(
|
|
6753
|
-
if (!isWrappingType(
|
|
6752
|
+
function assertWrappingType(type22) {
|
|
6753
|
+
if (!isWrappingType(type22)) {
|
|
6754
6754
|
throw new Error(
|
|
6755
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6755
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL wrapping type.`
|
|
6756
6756
|
);
|
|
6757
6757
|
}
|
|
6758
|
-
return
|
|
6758
|
+
return type22;
|
|
6759
6759
|
}
|
|
6760
|
-
function isNullableType(
|
|
6761
|
-
return isType(
|
|
6760
|
+
function isNullableType(type22) {
|
|
6761
|
+
return isType(type22) && !isNonNullType(type22);
|
|
6762
6762
|
}
|
|
6763
|
-
function assertNullableType(
|
|
6764
|
-
if (!isNullableType(
|
|
6763
|
+
function assertNullableType(type22) {
|
|
6764
|
+
if (!isNullableType(type22)) {
|
|
6765
6765
|
throw new Error(
|
|
6766
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6766
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL nullable type.`
|
|
6767
6767
|
);
|
|
6768
6768
|
}
|
|
6769
|
-
return
|
|
6769
|
+
return type22;
|
|
6770
6770
|
}
|
|
6771
|
-
function getNullableType(
|
|
6772
|
-
if (
|
|
6773
|
-
return isNonNullType(
|
|
6771
|
+
function getNullableType(type22) {
|
|
6772
|
+
if (type22) {
|
|
6773
|
+
return isNonNullType(type22) ? type22.ofType : type22;
|
|
6774
6774
|
}
|
|
6775
6775
|
}
|
|
6776
|
-
function isNamedType(
|
|
6777
|
-
return isScalarType(
|
|
6776
|
+
function isNamedType(type22) {
|
|
6777
|
+
return isScalarType(type22) || isObjectType(type22) || isInterfaceType(type22) || isUnionType(type22) || isEnumType(type22) || isInputObjectType(type22);
|
|
6778
6778
|
}
|
|
6779
|
-
function assertNamedType(
|
|
6780
|
-
if (!isNamedType(
|
|
6779
|
+
function assertNamedType(type22) {
|
|
6780
|
+
if (!isNamedType(type22)) {
|
|
6781
6781
|
throw new Error(
|
|
6782
|
-
`Expected ${(0, _inspect.inspect)(
|
|
6782
|
+
`Expected ${(0, _inspect.inspect)(type22)} to be a GraphQL named type.`
|
|
6783
6783
|
);
|
|
6784
6784
|
}
|
|
6785
|
-
return
|
|
6785
|
+
return type22;
|
|
6786
6786
|
}
|
|
6787
|
-
function getNamedType(
|
|
6788
|
-
if (
|
|
6789
|
-
let unwrappedType =
|
|
6787
|
+
function getNamedType(type22) {
|
|
6788
|
+
if (type22) {
|
|
6789
|
+
let unwrappedType = type22;
|
|
6790
6790
|
while (isWrappingType(unwrappedType)) {
|
|
6791
6791
|
unwrappedType = unwrappedType.ofType;
|
|
6792
6792
|
}
|
|
@@ -7365,7 +7365,7 @@ var require_typeComparators = __commonJS({
|
|
|
7365
7365
|
}
|
|
7366
7366
|
if ((0, _definition.isAbstractType)(typeA)) {
|
|
7367
7367
|
if ((0, _definition.isAbstractType)(typeB)) {
|
|
7368
|
-
return schema.getPossibleTypes(typeA).some((
|
|
7368
|
+
return schema.getPossibleTypes(typeA).some((type22) => schema.isSubType(typeB, type22));
|
|
7369
7369
|
}
|
|
7370
7370
|
return schema.isSubType(typeA, typeB);
|
|
7371
7371
|
}
|
|
@@ -7638,8 +7638,8 @@ var require_scalars = __commonJS({
|
|
|
7638
7638
|
GraphQLID
|
|
7639
7639
|
]);
|
|
7640
7640
|
exports2.specifiedScalarTypes = specifiedScalarTypes;
|
|
7641
|
-
function isSpecifiedScalarType(
|
|
7642
|
-
return specifiedScalarTypes.some(({ name: name21 }) =>
|
|
7641
|
+
function isSpecifiedScalarType(type22) {
|
|
7642
|
+
return specifiedScalarTypes.some(({ name: name21 }) => type22.name === name21);
|
|
7643
7643
|
}
|
|
7644
7644
|
function serializeObject(outputValue) {
|
|
7645
7645
|
if ((0, _isObjectLike.isObjectLike)(outputValue)) {
|
|
@@ -7846,9 +7846,9 @@ var require_astFromValue = __commonJS({
|
|
|
7846
7846
|
var _kinds = require_kinds();
|
|
7847
7847
|
var _definition = require_definition();
|
|
7848
7848
|
var _scalars = require_scalars();
|
|
7849
|
-
function astFromValue(value,
|
|
7850
|
-
if ((0, _definition.isNonNullType)(
|
|
7851
|
-
const astValue = astFromValue(value,
|
|
7849
|
+
function astFromValue(value, type22) {
|
|
7850
|
+
if ((0, _definition.isNonNullType)(type22)) {
|
|
7851
|
+
const astValue = astFromValue(value, type22.ofType);
|
|
7852
7852
|
if ((astValue === null || astValue === void 0 ? void 0 : astValue.kind) === _kinds.Kind.NULL) {
|
|
7853
7853
|
return null;
|
|
7854
7854
|
}
|
|
@@ -7862,8 +7862,8 @@ var require_astFromValue = __commonJS({
|
|
|
7862
7862
|
if (value === void 0) {
|
|
7863
7863
|
return null;
|
|
7864
7864
|
}
|
|
7865
|
-
if ((0, _definition.isListType)(
|
|
7866
|
-
const itemType =
|
|
7865
|
+
if ((0, _definition.isListType)(type22)) {
|
|
7866
|
+
const itemType = type22.ofType;
|
|
7867
7867
|
if ((0, _isIterableObject.isIterableObject)(value)) {
|
|
7868
7868
|
const valuesNodes = [];
|
|
7869
7869
|
for (const item of value) {
|
|
@@ -7879,12 +7879,12 @@ var require_astFromValue = __commonJS({
|
|
|
7879
7879
|
}
|
|
7880
7880
|
return astFromValue(value, itemType);
|
|
7881
7881
|
}
|
|
7882
|
-
if ((0, _definition.isInputObjectType)(
|
|
7882
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
7883
7883
|
if (!(0, _isObjectLike.isObjectLike)(value)) {
|
|
7884
7884
|
return null;
|
|
7885
7885
|
}
|
|
7886
7886
|
const fieldNodes = [];
|
|
7887
|
-
for (const field of Object.values(
|
|
7887
|
+
for (const field of Object.values(type22.getFields())) {
|
|
7888
7888
|
const fieldValue = astFromValue(value[field.name], field.type);
|
|
7889
7889
|
if (fieldValue) {
|
|
7890
7890
|
fieldNodes.push({
|
|
@@ -7902,8 +7902,8 @@ var require_astFromValue = __commonJS({
|
|
|
7902
7902
|
fields: fieldNodes
|
|
7903
7903
|
};
|
|
7904
7904
|
}
|
|
7905
|
-
if ((0, _definition.isLeafType)(
|
|
7906
|
-
const serialized =
|
|
7905
|
+
if ((0, _definition.isLeafType)(type22)) {
|
|
7906
|
+
const serialized = type22.serialize(value);
|
|
7907
7907
|
if (serialized == null) {
|
|
7908
7908
|
return null;
|
|
7909
7909
|
}
|
|
@@ -7924,13 +7924,13 @@ var require_astFromValue = __commonJS({
|
|
|
7924
7924
|
};
|
|
7925
7925
|
}
|
|
7926
7926
|
if (typeof serialized === "string") {
|
|
7927
|
-
if ((0, _definition.isEnumType)(
|
|
7927
|
+
if ((0, _definition.isEnumType)(type22)) {
|
|
7928
7928
|
return {
|
|
7929
7929
|
kind: _kinds.Kind.ENUM,
|
|
7930
7930
|
value: serialized
|
|
7931
7931
|
};
|
|
7932
7932
|
}
|
|
7933
|
-
if (
|
|
7933
|
+
if (type22 === _scalars.GraphQLID && integerStringRegExp.test(serialized)) {
|
|
7934
7934
|
return {
|
|
7935
7935
|
kind: _kinds.Kind.INT,
|
|
7936
7936
|
value: serialized
|
|
@@ -7947,7 +7947,7 @@ var require_astFromValue = __commonJS({
|
|
|
7947
7947
|
}
|
|
7948
7948
|
(0, _invariant.invariant)(
|
|
7949
7949
|
false,
|
|
7950
|
-
"Unexpected input type: " + (0, _inspect.inspect)(
|
|
7950
|
+
"Unexpected input type: " + (0, _inspect.inspect)(type22)
|
|
7951
7951
|
);
|
|
7952
7952
|
}
|
|
7953
7953
|
var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;
|
|
@@ -8146,46 +8146,46 @@ var require_introspection = __commonJS({
|
|
|
8146
8146
|
fields: () => ({
|
|
8147
8147
|
kind: {
|
|
8148
8148
|
type: new _definition.GraphQLNonNull(__TypeKind),
|
|
8149
|
-
resolve(
|
|
8150
|
-
if ((0, _definition.isScalarType)(
|
|
8149
|
+
resolve(type22) {
|
|
8150
|
+
if ((0, _definition.isScalarType)(type22)) {
|
|
8151
8151
|
return TypeKind.SCALAR;
|
|
8152
8152
|
}
|
|
8153
|
-
if ((0, _definition.isObjectType)(
|
|
8153
|
+
if ((0, _definition.isObjectType)(type22)) {
|
|
8154
8154
|
return TypeKind.OBJECT;
|
|
8155
8155
|
}
|
|
8156
|
-
if ((0, _definition.isInterfaceType)(
|
|
8156
|
+
if ((0, _definition.isInterfaceType)(type22)) {
|
|
8157
8157
|
return TypeKind.INTERFACE;
|
|
8158
8158
|
}
|
|
8159
|
-
if ((0, _definition.isUnionType)(
|
|
8159
|
+
if ((0, _definition.isUnionType)(type22)) {
|
|
8160
8160
|
return TypeKind.UNION;
|
|
8161
8161
|
}
|
|
8162
|
-
if ((0, _definition.isEnumType)(
|
|
8162
|
+
if ((0, _definition.isEnumType)(type22)) {
|
|
8163
8163
|
return TypeKind.ENUM;
|
|
8164
8164
|
}
|
|
8165
|
-
if ((0, _definition.isInputObjectType)(
|
|
8165
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
8166
8166
|
return TypeKind.INPUT_OBJECT;
|
|
8167
8167
|
}
|
|
8168
|
-
if ((0, _definition.isListType)(
|
|
8168
|
+
if ((0, _definition.isListType)(type22)) {
|
|
8169
8169
|
return TypeKind.LIST;
|
|
8170
8170
|
}
|
|
8171
|
-
if ((0, _definition.isNonNullType)(
|
|
8171
|
+
if ((0, _definition.isNonNullType)(type22)) {
|
|
8172
8172
|
return TypeKind.NON_NULL;
|
|
8173
8173
|
}
|
|
8174
8174
|
(0, _invariant.invariant)(
|
|
8175
8175
|
false,
|
|
8176
|
-
`Unexpected type: "${(0, _inspect.inspect)(
|
|
8176
|
+
`Unexpected type: "${(0, _inspect.inspect)(type22)}".`
|
|
8177
8177
|
);
|
|
8178
8178
|
}
|
|
8179
8179
|
},
|
|
8180
8180
|
name: {
|
|
8181
8181
|
type: _scalars.GraphQLString,
|
|
8182
|
-
resolve: (
|
|
8182
|
+
resolve: (type22) => "name" in type22 ? type22.name : void 0
|
|
8183
8183
|
},
|
|
8184
8184
|
description: {
|
|
8185
8185
|
type: _scalars.GraphQLString,
|
|
8186
|
-
resolve: (
|
|
8186
|
+
resolve: (type22) => (
|
|
8187
8187
|
/* c8 ignore next */
|
|
8188
|
-
"description" in
|
|
8188
|
+
"description" in type22 ? type22.description : void 0
|
|
8189
8189
|
)
|
|
8190
8190
|
},
|
|
8191
8191
|
specifiedByURL: {
|
|
@@ -8202,26 +8202,26 @@ var require_introspection = __commonJS({
|
|
|
8202
8202
|
defaultValue: false
|
|
8203
8203
|
}
|
|
8204
8204
|
},
|
|
8205
|
-
resolve(
|
|
8206
|
-
if ((0, _definition.isObjectType)(
|
|
8207
|
-
const fields = Object.values(
|
|
8205
|
+
resolve(type22, { includeDeprecated }) {
|
|
8206
|
+
if ((0, _definition.isObjectType)(type22) || (0, _definition.isInterfaceType)(type22)) {
|
|
8207
|
+
const fields = Object.values(type22.getFields());
|
|
8208
8208
|
return includeDeprecated ? fields : fields.filter((field) => field.deprecationReason == null);
|
|
8209
8209
|
}
|
|
8210
8210
|
}
|
|
8211
8211
|
},
|
|
8212
8212
|
interfaces: {
|
|
8213
8213
|
type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)),
|
|
8214
|
-
resolve(
|
|
8215
|
-
if ((0, _definition.isObjectType)(
|
|
8216
|
-
return
|
|
8214
|
+
resolve(type22) {
|
|
8215
|
+
if ((0, _definition.isObjectType)(type22) || (0, _definition.isInterfaceType)(type22)) {
|
|
8216
|
+
return type22.getInterfaces();
|
|
8217
8217
|
}
|
|
8218
8218
|
}
|
|
8219
8219
|
},
|
|
8220
8220
|
possibleTypes: {
|
|
8221
8221
|
type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)),
|
|
8222
|
-
resolve(
|
|
8223
|
-
if ((0, _definition.isAbstractType)(
|
|
8224
|
-
return schema.getPossibleTypes(
|
|
8222
|
+
resolve(type22, _args, _context, { schema }) {
|
|
8223
|
+
if ((0, _definition.isAbstractType)(type22)) {
|
|
8224
|
+
return schema.getPossibleTypes(type22);
|
|
8225
8225
|
}
|
|
8226
8226
|
}
|
|
8227
8227
|
},
|
|
@@ -8235,9 +8235,9 @@ var require_introspection = __commonJS({
|
|
|
8235
8235
|
defaultValue: false
|
|
8236
8236
|
}
|
|
8237
8237
|
},
|
|
8238
|
-
resolve(
|
|
8239
|
-
if ((0, _definition.isEnumType)(
|
|
8240
|
-
const values =
|
|
8238
|
+
resolve(type22, { includeDeprecated }) {
|
|
8239
|
+
if ((0, _definition.isEnumType)(type22)) {
|
|
8240
|
+
const values = type22.getValues();
|
|
8241
8241
|
return includeDeprecated ? values : values.filter((field) => field.deprecationReason == null);
|
|
8242
8242
|
}
|
|
8243
8243
|
}
|
|
@@ -8252,22 +8252,22 @@ var require_introspection = __commonJS({
|
|
|
8252
8252
|
defaultValue: false
|
|
8253
8253
|
}
|
|
8254
8254
|
},
|
|
8255
|
-
resolve(
|
|
8256
|
-
if ((0, _definition.isInputObjectType)(
|
|
8257
|
-
const values = Object.values(
|
|
8255
|
+
resolve(type22, { includeDeprecated }) {
|
|
8256
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
8257
|
+
const values = Object.values(type22.getFields());
|
|
8258
8258
|
return includeDeprecated ? values : values.filter((field) => field.deprecationReason == null);
|
|
8259
8259
|
}
|
|
8260
8260
|
}
|
|
8261
8261
|
},
|
|
8262
8262
|
ofType: {
|
|
8263
8263
|
type: __Type,
|
|
8264
|
-
resolve: (
|
|
8264
|
+
resolve: (type22) => "ofType" in type22 ? type22.ofType : void 0
|
|
8265
8265
|
},
|
|
8266
8266
|
isOneOf: {
|
|
8267
8267
|
type: _scalars.GraphQLBoolean,
|
|
8268
|
-
resolve: (
|
|
8269
|
-
if ((0, _definition.isInputObjectType)(
|
|
8270
|
-
return
|
|
8268
|
+
resolve: (type22) => {
|
|
8269
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
8270
|
+
return type22.isOneOf;
|
|
8271
8271
|
}
|
|
8272
8272
|
}
|
|
8273
8273
|
}
|
|
@@ -8337,8 +8337,8 @@ var require_introspection = __commonJS({
|
|
|
8337
8337
|
type: _scalars.GraphQLString,
|
|
8338
8338
|
description: "A GraphQL-formatted string representing the default value for this input value.",
|
|
8339
8339
|
resolve(inputValue) {
|
|
8340
|
-
const { type:
|
|
8341
|
-
const valueAST = (0, _astFromValue.astFromValue)(defaultValue,
|
|
8340
|
+
const { type: type22, defaultValue } = inputValue;
|
|
8341
|
+
const valueAST = (0, _astFromValue.astFromValue)(defaultValue, type22);
|
|
8342
8342
|
return valueAST ? (0, _printer.print)(valueAST) : null;
|
|
8343
8343
|
}
|
|
8344
8344
|
},
|
|
@@ -8481,8 +8481,8 @@ var require_introspection = __commonJS({
|
|
|
8481
8481
|
__TypeKind
|
|
8482
8482
|
]);
|
|
8483
8483
|
exports2.introspectionTypes = introspectionTypes;
|
|
8484
|
-
function isIntrospectionType(
|
|
8485
|
-
return introspectionTypes.some(({ name: name21 }) =>
|
|
8484
|
+
function isIntrospectionType(type22) {
|
|
8485
|
+
return introspectionTypes.some(({ name: name21 }) => type22.name === name21);
|
|
8486
8486
|
}
|
|
8487
8487
|
}
|
|
8488
8488
|
});
|
|
@@ -8543,9 +8543,9 @@ var require_schema = __commonJS({
|
|
|
8543
8543
|
this._directives = (_config$directives = config2.directives) !== null && _config$directives !== void 0 ? _config$directives : _directives.specifiedDirectives;
|
|
8544
8544
|
const allReferencedTypes = new Set(config2.types);
|
|
8545
8545
|
if (config2.types != null) {
|
|
8546
|
-
for (const
|
|
8547
|
-
allReferencedTypes.delete(
|
|
8548
|
-
collectReferencedTypes(
|
|
8546
|
+
for (const type22 of config2.types) {
|
|
8547
|
+
allReferencedTypes.delete(type22);
|
|
8548
|
+
collectReferencedTypes(type22, allReferencedTypes);
|
|
8549
8549
|
}
|
|
8550
8550
|
}
|
|
8551
8551
|
if (this._queryType != null) {
|
|
@@ -8655,16 +8655,16 @@ var require_schema = __commonJS({
|
|
|
8655
8655
|
if (map2 === void 0) {
|
|
8656
8656
|
map2 = /* @__PURE__ */ Object.create(null);
|
|
8657
8657
|
if ((0, _definition.isUnionType)(abstractType)) {
|
|
8658
|
-
for (const
|
|
8659
|
-
map2[
|
|
8658
|
+
for (const type22 of abstractType.getTypes()) {
|
|
8659
|
+
map2[type22.name] = true;
|
|
8660
8660
|
}
|
|
8661
8661
|
} else {
|
|
8662
8662
|
const implementations = this.getImplementations(abstractType);
|
|
8663
|
-
for (const
|
|
8664
|
-
map2[
|
|
8663
|
+
for (const type22 of implementations.objects) {
|
|
8664
|
+
map2[type22.name] = true;
|
|
8665
8665
|
}
|
|
8666
|
-
for (const
|
|
8667
|
-
map2[
|
|
8666
|
+
for (const type22 of implementations.interfaces) {
|
|
8667
|
+
map2[type22.name] = true;
|
|
8668
8668
|
}
|
|
8669
8669
|
}
|
|
8670
8670
|
this._subTypeMap[abstractType.name] = map2;
|
|
@@ -8693,8 +8693,8 @@ var require_schema = __commonJS({
|
|
|
8693
8693
|
}
|
|
8694
8694
|
};
|
|
8695
8695
|
exports2.GraphQLSchema = GraphQLSchema;
|
|
8696
|
-
function collectReferencedTypes(
|
|
8697
|
-
const namedType = (0, _definition.getNamedType)(
|
|
8696
|
+
function collectReferencedTypes(type22, typeSet) {
|
|
8697
|
+
const namedType = (0, _definition.getNamedType)(type22);
|
|
8698
8698
|
if (!typeSet.has(namedType)) {
|
|
8699
8699
|
typeSet.add(namedType);
|
|
8700
8700
|
if ((0, _definition.isUnionType)(namedType)) {
|
|
@@ -8874,39 +8874,39 @@ var require_validate = __commonJS({
|
|
|
8874
8874
|
function validateTypes2(context2) {
|
|
8875
8875
|
const validateInputObjectCircularRefs = createInputObjectCircularRefsValidator(context2);
|
|
8876
8876
|
const typeMap = context2.schema.getTypeMap();
|
|
8877
|
-
for (const
|
|
8878
|
-
if (!(0, _definition.isNamedType)(
|
|
8877
|
+
for (const type22 of Object.values(typeMap)) {
|
|
8878
|
+
if (!(0, _definition.isNamedType)(type22)) {
|
|
8879
8879
|
context2.reportError(
|
|
8880
|
-
`Expected GraphQL named type but got: ${(0, _inspect.inspect)(
|
|
8881
|
-
|
|
8880
|
+
`Expected GraphQL named type but got: ${(0, _inspect.inspect)(type22)}.`,
|
|
8881
|
+
type22.astNode
|
|
8882
8882
|
);
|
|
8883
8883
|
continue;
|
|
8884
8884
|
}
|
|
8885
|
-
if (!(0, _introspection.isIntrospectionType)(
|
|
8886
|
-
validateName(context2,
|
|
8885
|
+
if (!(0, _introspection.isIntrospectionType)(type22)) {
|
|
8886
|
+
validateName(context2, type22);
|
|
8887
8887
|
}
|
|
8888
|
-
if ((0, _definition.isObjectType)(
|
|
8889
|
-
validateFields(context2,
|
|
8890
|
-
validateInterfaces(context2,
|
|
8891
|
-
} else if ((0, _definition.isInterfaceType)(
|
|
8892
|
-
validateFields(context2,
|
|
8893
|
-
validateInterfaces(context2,
|
|
8894
|
-
} else if ((0, _definition.isUnionType)(
|
|
8895
|
-
validateUnionMembers(context2,
|
|
8896
|
-
} else if ((0, _definition.isEnumType)(
|
|
8897
|
-
validateEnumValues(context2,
|
|
8898
|
-
} else if ((0, _definition.isInputObjectType)(
|
|
8899
|
-
validateInputFields(context2,
|
|
8900
|
-
validateInputObjectCircularRefs(
|
|
8888
|
+
if ((0, _definition.isObjectType)(type22)) {
|
|
8889
|
+
validateFields(context2, type22);
|
|
8890
|
+
validateInterfaces(context2, type22);
|
|
8891
|
+
} else if ((0, _definition.isInterfaceType)(type22)) {
|
|
8892
|
+
validateFields(context2, type22);
|
|
8893
|
+
validateInterfaces(context2, type22);
|
|
8894
|
+
} else if ((0, _definition.isUnionType)(type22)) {
|
|
8895
|
+
validateUnionMembers(context2, type22);
|
|
8896
|
+
} else if ((0, _definition.isEnumType)(type22)) {
|
|
8897
|
+
validateEnumValues(context2, type22);
|
|
8898
|
+
} else if ((0, _definition.isInputObjectType)(type22)) {
|
|
8899
|
+
validateInputFields(context2, type22);
|
|
8900
|
+
validateInputObjectCircularRefs(type22);
|
|
8901
8901
|
}
|
|
8902
8902
|
}
|
|
8903
8903
|
}
|
|
8904
|
-
function validateFields(context2,
|
|
8905
|
-
const fields = Object.values(
|
|
8904
|
+
function validateFields(context2, type22) {
|
|
8905
|
+
const fields = Object.values(type22.getFields());
|
|
8906
8906
|
if (fields.length === 0) {
|
|
8907
|
-
context2.reportError(`Type ${
|
|
8908
|
-
|
|
8909
|
-
...
|
|
8907
|
+
context2.reportError(`Type ${type22.name} must define one or more fields.`, [
|
|
8908
|
+
type22.astNode,
|
|
8909
|
+
...type22.extensionASTNodes
|
|
8910
8910
|
]);
|
|
8911
8911
|
}
|
|
8912
8912
|
for (const field of fields) {
|
|
@@ -8914,7 +8914,7 @@ var require_validate = __commonJS({
|
|
|
8914
8914
|
if (!(0, _definition.isOutputType)(field.type)) {
|
|
8915
8915
|
var _field$astNode;
|
|
8916
8916
|
context2.reportError(
|
|
8917
|
-
`The type of ${
|
|
8917
|
+
`The type of ${type22.name}.${field.name} must be Output Type but got: ${(0, _inspect.inspect)(field.type)}.`,
|
|
8918
8918
|
(_field$astNode = field.astNode) === null || _field$astNode === void 0 ? void 0 : _field$astNode.type
|
|
8919
8919
|
);
|
|
8920
8920
|
}
|
|
@@ -8924,14 +8924,14 @@ var require_validate = __commonJS({
|
|
|
8924
8924
|
if (!(0, _definition.isInputType)(arg.type)) {
|
|
8925
8925
|
var _arg$astNode2;
|
|
8926
8926
|
context2.reportError(
|
|
8927
|
-
`The type of ${
|
|
8927
|
+
`The type of ${type22.name}.${field.name}(${argName}:) must be Input Type but got: ${(0, _inspect.inspect)(arg.type)}.`,
|
|
8928
8928
|
(_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 ? void 0 : _arg$astNode2.type
|
|
8929
8929
|
);
|
|
8930
8930
|
}
|
|
8931
8931
|
if ((0, _definition.isRequiredArgument)(arg) && arg.deprecationReason != null) {
|
|
8932
8932
|
var _arg$astNode3;
|
|
8933
8933
|
context2.reportError(
|
|
8934
|
-
`Required argument ${
|
|
8934
|
+
`Required argument ${type22.name}.${field.name}(${argName}:) cannot be deprecated.`,
|
|
8935
8935
|
[
|
|
8936
8936
|
getDeprecatedDirectiveNode(arg.astNode),
|
|
8937
8937
|
(_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0 ? void 0 : _arg$astNode3.type
|
|
@@ -8941,46 +8941,46 @@ var require_validate = __commonJS({
|
|
|
8941
8941
|
}
|
|
8942
8942
|
}
|
|
8943
8943
|
}
|
|
8944
|
-
function validateInterfaces(context2,
|
|
8944
|
+
function validateInterfaces(context2, type22) {
|
|
8945
8945
|
const ifaceTypeNames = /* @__PURE__ */ Object.create(null);
|
|
8946
|
-
for (const iface of
|
|
8946
|
+
for (const iface of type22.getInterfaces()) {
|
|
8947
8947
|
if (!(0, _definition.isInterfaceType)(iface)) {
|
|
8948
8948
|
context2.reportError(
|
|
8949
8949
|
`Type ${(0, _inspect.inspect)(
|
|
8950
|
-
|
|
8950
|
+
type22
|
|
8951
8951
|
)} must only implement Interface types, it cannot implement ${(0, _inspect.inspect)(iface)}.`,
|
|
8952
|
-
getAllImplementsInterfaceNodes(
|
|
8952
|
+
getAllImplementsInterfaceNodes(type22, iface)
|
|
8953
8953
|
);
|
|
8954
8954
|
continue;
|
|
8955
8955
|
}
|
|
8956
|
-
if (
|
|
8956
|
+
if (type22 === iface) {
|
|
8957
8957
|
context2.reportError(
|
|
8958
|
-
`Type ${
|
|
8959
|
-
getAllImplementsInterfaceNodes(
|
|
8958
|
+
`Type ${type22.name} cannot implement itself because it would create a circular reference.`,
|
|
8959
|
+
getAllImplementsInterfaceNodes(type22, iface)
|
|
8960
8960
|
);
|
|
8961
8961
|
continue;
|
|
8962
8962
|
}
|
|
8963
8963
|
if (ifaceTypeNames[iface.name]) {
|
|
8964
8964
|
context2.reportError(
|
|
8965
|
-
`Type ${
|
|
8966
|
-
getAllImplementsInterfaceNodes(
|
|
8965
|
+
`Type ${type22.name} can only implement ${iface.name} once.`,
|
|
8966
|
+
getAllImplementsInterfaceNodes(type22, iface)
|
|
8967
8967
|
);
|
|
8968
8968
|
continue;
|
|
8969
8969
|
}
|
|
8970
8970
|
ifaceTypeNames[iface.name] = true;
|
|
8971
|
-
validateTypeImplementsAncestors(context2,
|
|
8972
|
-
validateTypeImplementsInterface(context2,
|
|
8971
|
+
validateTypeImplementsAncestors(context2, type22, iface);
|
|
8972
|
+
validateTypeImplementsInterface(context2, type22, iface);
|
|
8973
8973
|
}
|
|
8974
8974
|
}
|
|
8975
|
-
function validateTypeImplementsInterface(context2,
|
|
8976
|
-
const typeFieldMap =
|
|
8975
|
+
function validateTypeImplementsInterface(context2, type22, iface) {
|
|
8976
|
+
const typeFieldMap = type22.getFields();
|
|
8977
8977
|
for (const ifaceField of Object.values(iface.getFields())) {
|
|
8978
8978
|
const fieldName = ifaceField.name;
|
|
8979
8979
|
const typeField = typeFieldMap[fieldName];
|
|
8980
8980
|
if (!typeField) {
|
|
8981
8981
|
context2.reportError(
|
|
8982
|
-
`Interface field ${iface.name}.${fieldName} expected but ${
|
|
8983
|
-
[ifaceField.astNode,
|
|
8982
|
+
`Interface field ${iface.name}.${fieldName} expected but ${type22.name} does not provide it.`,
|
|
8983
|
+
[ifaceField.astNode, type22.astNode, ...type22.extensionASTNodes]
|
|
8984
8984
|
);
|
|
8985
8985
|
continue;
|
|
8986
8986
|
}
|
|
@@ -8991,7 +8991,7 @@ var require_validate = __commonJS({
|
|
|
8991
8991
|
)) {
|
|
8992
8992
|
var _ifaceField$astNode, _typeField$astNode;
|
|
8993
8993
|
context2.reportError(
|
|
8994
|
-
`Interface field ${iface.name}.${fieldName} expects type ${(0, _inspect.inspect)(ifaceField.type)} but ${
|
|
8994
|
+
`Interface field ${iface.name}.${fieldName} expects type ${(0, _inspect.inspect)(ifaceField.type)} but ${type22.name}.${fieldName} is type ${(0, _inspect.inspect)(typeField.type)}.`,
|
|
8995
8995
|
[
|
|
8996
8996
|
(_ifaceField$astNode = ifaceField.astNode) === null || _ifaceField$astNode === void 0 ? void 0 : _ifaceField$astNode.type,
|
|
8997
8997
|
(_typeField$astNode = typeField.astNode) === null || _typeField$astNode === void 0 ? void 0 : _typeField$astNode.type
|
|
@@ -9003,7 +9003,7 @@ var require_validate = __commonJS({
|
|
|
9003
9003
|
const typeArg = typeField.args.find((arg) => arg.name === argName);
|
|
9004
9004
|
if (!typeArg) {
|
|
9005
9005
|
context2.reportError(
|
|
9006
|
-
`Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${
|
|
9006
|
+
`Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${type22.name}.${fieldName} does not provide it.`,
|
|
9007
9007
|
[ifaceArg.astNode, typeField.astNode]
|
|
9008
9008
|
);
|
|
9009
9009
|
continue;
|
|
@@ -9011,7 +9011,7 @@ var require_validate = __commonJS({
|
|
|
9011
9011
|
if (!(0, _typeComparators.isEqualType)(ifaceArg.type, typeArg.type)) {
|
|
9012
9012
|
var _ifaceArg$astNode, _typeArg$astNode;
|
|
9013
9013
|
context2.reportError(
|
|
9014
|
-
`Interface field argument ${iface.name}.${fieldName}(${argName}:) expects type ${(0, _inspect.inspect)(ifaceArg.type)} but ${
|
|
9014
|
+
`Interface field argument ${iface.name}.${fieldName}(${argName}:) expects type ${(0, _inspect.inspect)(ifaceArg.type)} but ${type22.name}.${fieldName}(${argName}:) is type ${(0, _inspect.inspect)(typeArg.type)}.`,
|
|
9015
9015
|
[
|
|
9016
9016
|
(_ifaceArg$astNode = ifaceArg.astNode) === null || _ifaceArg$astNode === void 0 ? void 0 : _ifaceArg$astNode.type,
|
|
9017
9017
|
(_typeArg$astNode = typeArg.astNode) === null || _typeArg$astNode === void 0 ? void 0 : _typeArg$astNode.type
|
|
@@ -9024,22 +9024,22 @@ var require_validate = __commonJS({
|
|
|
9024
9024
|
const ifaceArg = ifaceField.args.find((arg) => arg.name === argName);
|
|
9025
9025
|
if (!ifaceArg && (0, _definition.isRequiredArgument)(typeArg)) {
|
|
9026
9026
|
context2.reportError(
|
|
9027
|
-
`Object field ${
|
|
9027
|
+
`Object field ${type22.name}.${fieldName} includes required argument ${argName} that is missing from the Interface field ${iface.name}.${fieldName}.`,
|
|
9028
9028
|
[typeArg.astNode, ifaceField.astNode]
|
|
9029
9029
|
);
|
|
9030
9030
|
}
|
|
9031
9031
|
}
|
|
9032
9032
|
}
|
|
9033
9033
|
}
|
|
9034
|
-
function validateTypeImplementsAncestors(context2,
|
|
9035
|
-
const ifaceInterfaces =
|
|
9034
|
+
function validateTypeImplementsAncestors(context2, type22, iface) {
|
|
9035
|
+
const ifaceInterfaces = type22.getInterfaces();
|
|
9036
9036
|
for (const transitive of iface.getInterfaces()) {
|
|
9037
9037
|
if (!ifaceInterfaces.includes(transitive)) {
|
|
9038
9038
|
context2.reportError(
|
|
9039
|
-
transitive ===
|
|
9039
|
+
transitive === type22 ? `Type ${type22.name} cannot implement ${iface.name} because it would create a circular reference.` : `Type ${type22.name} must implement ${transitive.name} because it is implemented by ${iface.name}.`,
|
|
9040
9040
|
[
|
|
9041
9041
|
...getAllImplementsInterfaceNodes(iface, transitive),
|
|
9042
|
-
...getAllImplementsInterfaceNodes(
|
|
9042
|
+
...getAllImplementsInterfaceNodes(type22, iface)
|
|
9043
9043
|
]
|
|
9044
9044
|
);
|
|
9045
9045
|
}
|
|
@@ -9115,17 +9115,17 @@ var require_validate = __commonJS({
|
|
|
9115
9115
|
}
|
|
9116
9116
|
}
|
|
9117
9117
|
}
|
|
9118
|
-
function validateOneOfInputObjectField(
|
|
9118
|
+
function validateOneOfInputObjectField(type22, field, context2) {
|
|
9119
9119
|
if ((0, _definition.isNonNullType)(field.type)) {
|
|
9120
9120
|
var _field$astNode4;
|
|
9121
9121
|
context2.reportError(
|
|
9122
|
-
`OneOf input field ${
|
|
9122
|
+
`OneOf input field ${type22.name}.${field.name} must be nullable.`,
|
|
9123
9123
|
(_field$astNode4 = field.astNode) === null || _field$astNode4 === void 0 ? void 0 : _field$astNode4.type
|
|
9124
9124
|
);
|
|
9125
9125
|
}
|
|
9126
9126
|
if (field.defaultValue !== void 0) {
|
|
9127
9127
|
context2.reportError(
|
|
9128
|
-
`OneOf input field ${
|
|
9128
|
+
`OneOf input field ${type22.name}.${field.name} cannot have a default value.`,
|
|
9129
9129
|
field.astNode
|
|
9130
9130
|
);
|
|
9131
9131
|
}
|
|
@@ -9163,8 +9163,8 @@ var require_validate = __commonJS({
|
|
|
9163
9163
|
fieldPathIndexByTypeName[inputObj.name] = void 0;
|
|
9164
9164
|
}
|
|
9165
9165
|
}
|
|
9166
|
-
function getAllImplementsInterfaceNodes(
|
|
9167
|
-
const { astNode, extensionASTNodes } =
|
|
9166
|
+
function getAllImplementsInterfaceNodes(type22, iface) {
|
|
9167
|
+
const { astNode, extensionASTNodes } = type22;
|
|
9168
9168
|
const nodes = astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes;
|
|
9169
9169
|
return nodes.flatMap((typeNode) => {
|
|
9170
9170
|
var _typeNode$interfaces;
|
|
@@ -9603,24 +9603,24 @@ var require_FieldsOnCorrectTypeRule = __commonJS({
|
|
|
9603
9603
|
function FieldsOnCorrectTypeRule(context2) {
|
|
9604
9604
|
return {
|
|
9605
9605
|
Field(node) {
|
|
9606
|
-
const
|
|
9607
|
-
if (
|
|
9606
|
+
const type22 = context2.getParentType();
|
|
9607
|
+
if (type22) {
|
|
9608
9608
|
const fieldDef = context2.getFieldDef();
|
|
9609
9609
|
if (!fieldDef) {
|
|
9610
9610
|
const schema = context2.getSchema();
|
|
9611
9611
|
const fieldName = node.name.value;
|
|
9612
9612
|
let suggestion = (0, _didYouMean.didYouMean)(
|
|
9613
9613
|
"to use an inline fragment on",
|
|
9614
|
-
getSuggestedTypeNames(schema,
|
|
9614
|
+
getSuggestedTypeNames(schema, type22, fieldName)
|
|
9615
9615
|
);
|
|
9616
9616
|
if (suggestion === "") {
|
|
9617
9617
|
suggestion = (0, _didYouMean.didYouMean)(
|
|
9618
|
-
getSuggestedFieldNames(
|
|
9618
|
+
getSuggestedFieldNames(type22, fieldName)
|
|
9619
9619
|
);
|
|
9620
9620
|
}
|
|
9621
9621
|
context2.reportError(
|
|
9622
9622
|
new _GraphQLError.GraphQLError(
|
|
9623
|
-
`Cannot query field "${fieldName}" on type "${
|
|
9623
|
+
`Cannot query field "${fieldName}" on type "${type22.name}".` + suggestion,
|
|
9624
9624
|
{
|
|
9625
9625
|
nodes: node
|
|
9626
9626
|
}
|
|
@@ -9631,13 +9631,13 @@ var require_FieldsOnCorrectTypeRule = __commonJS({
|
|
|
9631
9631
|
}
|
|
9632
9632
|
};
|
|
9633
9633
|
}
|
|
9634
|
-
function getSuggestedTypeNames(schema,
|
|
9635
|
-
if (!(0, _definition.isAbstractType)(
|
|
9634
|
+
function getSuggestedTypeNames(schema, type22, fieldName) {
|
|
9635
|
+
if (!(0, _definition.isAbstractType)(type22)) {
|
|
9636
9636
|
return [];
|
|
9637
9637
|
}
|
|
9638
9638
|
const suggestedTypes = /* @__PURE__ */ new Set();
|
|
9639
9639
|
const usageCount = /* @__PURE__ */ Object.create(null);
|
|
9640
|
-
for (const possibleType of schema.getPossibleTypes(
|
|
9640
|
+
for (const possibleType of schema.getPossibleTypes(type22)) {
|
|
9641
9641
|
if (!possibleType.getFields()[fieldName]) {
|
|
9642
9642
|
continue;
|
|
9643
9643
|
}
|
|
@@ -9666,9 +9666,9 @@ var require_FieldsOnCorrectTypeRule = __commonJS({
|
|
|
9666
9666
|
return (0, _naturalCompare.naturalCompare)(typeA.name, typeB.name);
|
|
9667
9667
|
}).map((x3) => x3.name);
|
|
9668
9668
|
}
|
|
9669
|
-
function getSuggestedFieldNames(
|
|
9670
|
-
if ((0, _definition.isObjectType)(
|
|
9671
|
-
const possibleFieldNames = Object.keys(
|
|
9669
|
+
function getSuggestedFieldNames(type22, fieldName) {
|
|
9670
|
+
if ((0, _definition.isObjectType)(type22) || (0, _definition.isInterfaceType)(type22)) {
|
|
9671
|
+
const possibleFieldNames = Object.keys(type22.getFields());
|
|
9672
9672
|
return (0, _suggestionList.suggestionList)(fieldName, possibleFieldNames);
|
|
9673
9673
|
}
|
|
9674
9674
|
return [];
|
|
@@ -9693,11 +9693,11 @@ var require_FragmentsOnCompositeTypesRule = __commonJS({
|
|
|
9693
9693
|
InlineFragment(node) {
|
|
9694
9694
|
const typeCondition = node.typeCondition;
|
|
9695
9695
|
if (typeCondition) {
|
|
9696
|
-
const
|
|
9696
|
+
const type22 = (0, _typeFromAST.typeFromAST)(
|
|
9697
9697
|
context2.getSchema(),
|
|
9698
9698
|
typeCondition
|
|
9699
9699
|
);
|
|
9700
|
-
if (
|
|
9700
|
+
if (type22 && !(0, _definition.isCompositeType)(type22)) {
|
|
9701
9701
|
const typeStr = (0, _printer.print)(typeCondition);
|
|
9702
9702
|
context2.reportError(
|
|
9703
9703
|
new _GraphQLError.GraphQLError(
|
|
@@ -9711,11 +9711,11 @@ var require_FragmentsOnCompositeTypesRule = __commonJS({
|
|
|
9711
9711
|
}
|
|
9712
9712
|
},
|
|
9713
9713
|
FragmentDefinition(node) {
|
|
9714
|
-
const
|
|
9714
|
+
const type22 = (0, _typeFromAST.typeFromAST)(
|
|
9715
9715
|
context2.getSchema(),
|
|
9716
9716
|
node.typeCondition
|
|
9717
9717
|
);
|
|
9718
|
-
if (
|
|
9718
|
+
if (type22 && !(0, _definition.isCompositeType)(type22)) {
|
|
9719
9719
|
const typeStr = (0, _printer.print)(node.typeCondition);
|
|
9720
9720
|
context2.reportError(
|
|
9721
9721
|
new _GraphQLError.GraphQLError(
|
|
@@ -10026,7 +10026,7 @@ var require_KnownTypeNamesRule = __commonJS({
|
|
|
10026
10026
|
var standardTypeNames = [
|
|
10027
10027
|
..._scalars.specifiedScalarTypes,
|
|
10028
10028
|
..._introspection.introspectionTypes
|
|
10029
|
-
].map((
|
|
10029
|
+
].map((type22) => type22.name);
|
|
10030
10030
|
function isSDLNode(value) {
|
|
10031
10031
|
return "kind" in value && ((0, _predicates.isTypeSystemDefinitionNode)(value) || (0, _predicates.isTypeSystemExtensionNode)(value));
|
|
10032
10032
|
}
|
|
@@ -11002,12 +11002,12 @@ var require_PossibleFragmentSpreadsRule = __commonJS({
|
|
|
11002
11002
|
function getFragmentType(context2, name21) {
|
|
11003
11003
|
const frag = context2.getFragment(name21);
|
|
11004
11004
|
if (frag) {
|
|
11005
|
-
const
|
|
11005
|
+
const type22 = (0, _typeFromAST.typeFromAST)(
|
|
11006
11006
|
context2.getSchema(),
|
|
11007
11007
|
frag.typeCondition
|
|
11008
11008
|
);
|
|
11009
|
-
if ((0, _definition.isCompositeType)(
|
|
11010
|
-
return
|
|
11009
|
+
if ((0, _definition.isCompositeType)(type22)) {
|
|
11010
|
+
return type22;
|
|
11011
11011
|
}
|
|
11012
11012
|
}
|
|
11013
11013
|
}
|
|
@@ -11096,28 +11096,28 @@ var require_PossibleTypeExtensionsRule = __commonJS({
|
|
|
11096
11096
|
[_kinds.Kind.ENUM_TYPE_DEFINITION]: _kinds.Kind.ENUM_TYPE_EXTENSION,
|
|
11097
11097
|
[_kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION]: _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION
|
|
11098
11098
|
};
|
|
11099
|
-
function typeToExtKind(
|
|
11100
|
-
if ((0, _definition.isScalarType)(
|
|
11099
|
+
function typeToExtKind(type22) {
|
|
11100
|
+
if ((0, _definition.isScalarType)(type22)) {
|
|
11101
11101
|
return _kinds.Kind.SCALAR_TYPE_EXTENSION;
|
|
11102
11102
|
}
|
|
11103
|
-
if ((0, _definition.isObjectType)(
|
|
11103
|
+
if ((0, _definition.isObjectType)(type22)) {
|
|
11104
11104
|
return _kinds.Kind.OBJECT_TYPE_EXTENSION;
|
|
11105
11105
|
}
|
|
11106
|
-
if ((0, _definition.isInterfaceType)(
|
|
11106
|
+
if ((0, _definition.isInterfaceType)(type22)) {
|
|
11107
11107
|
return _kinds.Kind.INTERFACE_TYPE_EXTENSION;
|
|
11108
11108
|
}
|
|
11109
|
-
if ((0, _definition.isUnionType)(
|
|
11109
|
+
if ((0, _definition.isUnionType)(type22)) {
|
|
11110
11110
|
return _kinds.Kind.UNION_TYPE_EXTENSION;
|
|
11111
11111
|
}
|
|
11112
|
-
if ((0, _definition.isEnumType)(
|
|
11112
|
+
if ((0, _definition.isEnumType)(type22)) {
|
|
11113
11113
|
return _kinds.Kind.ENUM_TYPE_EXTENSION;
|
|
11114
11114
|
}
|
|
11115
|
-
if ((0, _definition.isInputObjectType)(
|
|
11115
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
11116
11116
|
return _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION;
|
|
11117
11117
|
}
|
|
11118
11118
|
(0, _invariant.invariant)(
|
|
11119
11119
|
false,
|
|
11120
|
-
"Unexpected type: " + (0, _inspect.inspect)(
|
|
11120
|
+
"Unexpected type: " + (0, _inspect.inspect)(type22)
|
|
11121
11121
|
);
|
|
11122
11122
|
}
|
|
11123
11123
|
function extensionKindToTypeName(kind) {
|
|
@@ -11266,13 +11266,13 @@ var require_ScalarLeafsRule = __commonJS({
|
|
|
11266
11266
|
function ScalarLeafsRule(context2) {
|
|
11267
11267
|
return {
|
|
11268
11268
|
Field(node) {
|
|
11269
|
-
const
|
|
11269
|
+
const type22 = context2.getType();
|
|
11270
11270
|
const selectionSet = node.selectionSet;
|
|
11271
|
-
if (
|
|
11272
|
-
if ((0, _definition.isLeafType)((0, _definition.getNamedType)(
|
|
11271
|
+
if (type22) {
|
|
11272
|
+
if ((0, _definition.isLeafType)((0, _definition.getNamedType)(type22))) {
|
|
11273
11273
|
if (selectionSet) {
|
|
11274
11274
|
const fieldName = node.name.value;
|
|
11275
|
-
const typeStr = (0, _inspect.inspect)(
|
|
11275
|
+
const typeStr = (0, _inspect.inspect)(type22);
|
|
11276
11276
|
context2.reportError(
|
|
11277
11277
|
new _GraphQLError.GraphQLError(
|
|
11278
11278
|
`Field "${fieldName}" must not have a selection since type "${typeStr}" has no subfields.`,
|
|
@@ -11284,7 +11284,7 @@ var require_ScalarLeafsRule = __commonJS({
|
|
|
11284
11284
|
}
|
|
11285
11285
|
} else if (!selectionSet) {
|
|
11286
11286
|
const fieldName = node.name.value;
|
|
11287
|
-
const typeStr = (0, _inspect.inspect)(
|
|
11287
|
+
const typeStr = (0, _inspect.inspect)(type22);
|
|
11288
11288
|
context2.reportError(
|
|
11289
11289
|
new _GraphQLError.GraphQLError(
|
|
11290
11290
|
`Field "${fieldName}" of type "${typeStr}" must have a selection of subfields. Did you mean "${fieldName} { ... }"?`,
|
|
@@ -11295,7 +11295,7 @@ var require_ScalarLeafsRule = __commonJS({
|
|
|
11295
11295
|
);
|
|
11296
11296
|
} else if (selectionSet.selections.length === 0) {
|
|
11297
11297
|
const fieldName = node.name.value;
|
|
11298
|
-
const typeStr = (0, _inspect.inspect)(
|
|
11298
|
+
const typeStr = (0, _inspect.inspect)(type22);
|
|
11299
11299
|
context2.reportError(
|
|
11300
11300
|
new _GraphQLError.GraphQLError(
|
|
11301
11301
|
`Field "${fieldName}" of type "${typeStr}" must have at least one field selected.`,
|
|
@@ -11374,8 +11374,8 @@ var require_coerceInputValue = __commonJS({
|
|
|
11374
11374
|
var _suggestionList = require_suggestionList();
|
|
11375
11375
|
var _GraphQLError = require_GraphQLError();
|
|
11376
11376
|
var _definition = require_definition();
|
|
11377
|
-
function coerceInputValue(inputValue,
|
|
11378
|
-
return coerceInputValueImpl(inputValue,
|
|
11377
|
+
function coerceInputValue(inputValue, type22, onError = defaultOnError) {
|
|
11378
|
+
return coerceInputValueImpl(inputValue, type22, onError, void 0);
|
|
11379
11379
|
}
|
|
11380
11380
|
function defaultOnError(path4, invalidValue, error48) {
|
|
11381
11381
|
let errorPrefix = "Invalid value " + (0, _inspect.inspect)(invalidValue);
|
|
@@ -11385,17 +11385,17 @@ var require_coerceInputValue = __commonJS({
|
|
|
11385
11385
|
error48.message = errorPrefix + ": " + error48.message;
|
|
11386
11386
|
throw error48;
|
|
11387
11387
|
}
|
|
11388
|
-
function coerceInputValueImpl(inputValue,
|
|
11389
|
-
if ((0, _definition.isNonNullType)(
|
|
11388
|
+
function coerceInputValueImpl(inputValue, type22, onError, path4) {
|
|
11389
|
+
if ((0, _definition.isNonNullType)(type22)) {
|
|
11390
11390
|
if (inputValue != null) {
|
|
11391
|
-
return coerceInputValueImpl(inputValue,
|
|
11391
|
+
return coerceInputValueImpl(inputValue, type22.ofType, onError, path4);
|
|
11392
11392
|
}
|
|
11393
11393
|
onError(
|
|
11394
11394
|
(0, _Path.pathToArray)(path4),
|
|
11395
11395
|
inputValue,
|
|
11396
11396
|
new _GraphQLError.GraphQLError(
|
|
11397
11397
|
`Expected non-nullable type "${(0, _inspect.inspect)(
|
|
11398
|
-
|
|
11398
|
+
type22
|
|
11399
11399
|
)}" not to be null.`
|
|
11400
11400
|
)
|
|
11401
11401
|
);
|
|
@@ -11404,8 +11404,8 @@ var require_coerceInputValue = __commonJS({
|
|
|
11404
11404
|
if (inputValue == null) {
|
|
11405
11405
|
return null;
|
|
11406
11406
|
}
|
|
11407
|
-
if ((0, _definition.isListType)(
|
|
11408
|
-
const itemType =
|
|
11407
|
+
if ((0, _definition.isListType)(type22)) {
|
|
11408
|
+
const itemType = type22.ofType;
|
|
11409
11409
|
if ((0, _isIterableObject.isIterableObject)(inputValue)) {
|
|
11410
11410
|
return Array.from(inputValue, (itemValue, index) => {
|
|
11411
11411
|
const itemPath = (0, _Path.addPath)(path4, index, void 0);
|
|
@@ -11414,19 +11414,19 @@ var require_coerceInputValue = __commonJS({
|
|
|
11414
11414
|
}
|
|
11415
11415
|
return [coerceInputValueImpl(inputValue, itemType, onError, path4)];
|
|
11416
11416
|
}
|
|
11417
|
-
if ((0, _definition.isInputObjectType)(
|
|
11417
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
11418
11418
|
if (!(0, _isObjectLike.isObjectLike)(inputValue) || Array.isArray(inputValue)) {
|
|
11419
11419
|
onError(
|
|
11420
11420
|
(0, _Path.pathToArray)(path4),
|
|
11421
11421
|
inputValue,
|
|
11422
11422
|
new _GraphQLError.GraphQLError(
|
|
11423
|
-
`Expected type "${
|
|
11423
|
+
`Expected type "${type22.name}" to be an object.`
|
|
11424
11424
|
)
|
|
11425
11425
|
);
|
|
11426
11426
|
return;
|
|
11427
11427
|
}
|
|
11428
11428
|
const coercedValue = {};
|
|
11429
|
-
const fieldDefs =
|
|
11429
|
+
const fieldDefs = type22.getFields();
|
|
11430
11430
|
for (const field of Object.values(fieldDefs)) {
|
|
11431
11431
|
const fieldValue = inputValue[field.name];
|
|
11432
11432
|
if (fieldValue === void 0) {
|
|
@@ -11448,32 +11448,32 @@ var require_coerceInputValue = __commonJS({
|
|
|
11448
11448
|
fieldValue,
|
|
11449
11449
|
field.type,
|
|
11450
11450
|
onError,
|
|
11451
|
-
(0, _Path.addPath)(path4, field.name,
|
|
11451
|
+
(0, _Path.addPath)(path4, field.name, type22.name)
|
|
11452
11452
|
);
|
|
11453
11453
|
}
|
|
11454
11454
|
for (const fieldName of Object.keys(inputValue)) {
|
|
11455
11455
|
if (!fieldDefs[fieldName]) {
|
|
11456
11456
|
const suggestions = (0, _suggestionList.suggestionList)(
|
|
11457
11457
|
fieldName,
|
|
11458
|
-
Object.keys(
|
|
11458
|
+
Object.keys(type22.getFields())
|
|
11459
11459
|
);
|
|
11460
11460
|
onError(
|
|
11461
11461
|
(0, _Path.pathToArray)(path4),
|
|
11462
11462
|
inputValue,
|
|
11463
11463
|
new _GraphQLError.GraphQLError(
|
|
11464
|
-
`Field "${fieldName}" is not defined by type "${
|
|
11464
|
+
`Field "${fieldName}" is not defined by type "${type22.name}".` + (0, _didYouMean.didYouMean)(suggestions)
|
|
11465
11465
|
)
|
|
11466
11466
|
);
|
|
11467
11467
|
}
|
|
11468
11468
|
}
|
|
11469
|
-
if (
|
|
11469
|
+
if (type22.isOneOf) {
|
|
11470
11470
|
const keys = Object.keys(coercedValue);
|
|
11471
11471
|
if (keys.length !== 1) {
|
|
11472
11472
|
onError(
|
|
11473
11473
|
(0, _Path.pathToArray)(path4),
|
|
11474
11474
|
inputValue,
|
|
11475
11475
|
new _GraphQLError.GraphQLError(
|
|
11476
|
-
`Exactly one key must be specified for OneOf type "${
|
|
11476
|
+
`Exactly one key must be specified for OneOf type "${type22.name}".`
|
|
11477
11477
|
)
|
|
11478
11478
|
);
|
|
11479
11479
|
}
|
|
@@ -11489,10 +11489,10 @@ var require_coerceInputValue = __commonJS({
|
|
|
11489
11489
|
}
|
|
11490
11490
|
return coercedValue;
|
|
11491
11491
|
}
|
|
11492
|
-
if ((0, _definition.isLeafType)(
|
|
11492
|
+
if ((0, _definition.isLeafType)(type22)) {
|
|
11493
11493
|
let parseResult;
|
|
11494
11494
|
try {
|
|
11495
|
-
parseResult =
|
|
11495
|
+
parseResult = type22.parseValue(inputValue);
|
|
11496
11496
|
} catch (error48) {
|
|
11497
11497
|
if (error48 instanceof _GraphQLError.GraphQLError) {
|
|
11498
11498
|
onError((0, _Path.pathToArray)(path4), inputValue, error48);
|
|
@@ -11501,7 +11501,7 @@ var require_coerceInputValue = __commonJS({
|
|
|
11501
11501
|
(0, _Path.pathToArray)(path4),
|
|
11502
11502
|
inputValue,
|
|
11503
11503
|
new _GraphQLError.GraphQLError(
|
|
11504
|
-
`Expected type "${
|
|
11504
|
+
`Expected type "${type22.name}". ` + error48.message,
|
|
11505
11505
|
{
|
|
11506
11506
|
originalError: error48
|
|
11507
11507
|
}
|
|
@@ -11514,14 +11514,14 @@ var require_coerceInputValue = __commonJS({
|
|
|
11514
11514
|
onError(
|
|
11515
11515
|
(0, _Path.pathToArray)(path4),
|
|
11516
11516
|
inputValue,
|
|
11517
|
-
new _GraphQLError.GraphQLError(`Expected type "${
|
|
11517
|
+
new _GraphQLError.GraphQLError(`Expected type "${type22.name}".`)
|
|
11518
11518
|
);
|
|
11519
11519
|
}
|
|
11520
11520
|
return parseResult;
|
|
11521
11521
|
}
|
|
11522
11522
|
(0, _invariant.invariant)(
|
|
11523
11523
|
false,
|
|
11524
|
-
"Unexpected input type: " + (0, _inspect.inspect)(
|
|
11524
|
+
"Unexpected input type: " + (0, _inspect.inspect)(type22)
|
|
11525
11525
|
);
|
|
11526
11526
|
}
|
|
11527
11527
|
}
|
|
@@ -11540,7 +11540,7 @@ var require_valueFromAST = __commonJS({
|
|
|
11540
11540
|
var _keyMap = require_keyMap();
|
|
11541
11541
|
var _kinds = require_kinds();
|
|
11542
11542
|
var _definition = require_definition();
|
|
11543
|
-
function valueFromAST(valueNode,
|
|
11543
|
+
function valueFromAST(valueNode, type22, variables) {
|
|
11544
11544
|
if (!valueNode) {
|
|
11545
11545
|
return;
|
|
11546
11546
|
}
|
|
@@ -11550,22 +11550,22 @@ var require_valueFromAST = __commonJS({
|
|
|
11550
11550
|
return;
|
|
11551
11551
|
}
|
|
11552
11552
|
const variableValue = variables[variableName];
|
|
11553
|
-
if (variableValue === null && (0, _definition.isNonNullType)(
|
|
11553
|
+
if (variableValue === null && (0, _definition.isNonNullType)(type22)) {
|
|
11554
11554
|
return;
|
|
11555
11555
|
}
|
|
11556
11556
|
return variableValue;
|
|
11557
11557
|
}
|
|
11558
|
-
if ((0, _definition.isNonNullType)(
|
|
11558
|
+
if ((0, _definition.isNonNullType)(type22)) {
|
|
11559
11559
|
if (valueNode.kind === _kinds.Kind.NULL) {
|
|
11560
11560
|
return;
|
|
11561
11561
|
}
|
|
11562
|
-
return valueFromAST(valueNode,
|
|
11562
|
+
return valueFromAST(valueNode, type22.ofType, variables);
|
|
11563
11563
|
}
|
|
11564
11564
|
if (valueNode.kind === _kinds.Kind.NULL) {
|
|
11565
11565
|
return null;
|
|
11566
11566
|
}
|
|
11567
|
-
if ((0, _definition.isListType)(
|
|
11568
|
-
const itemType =
|
|
11567
|
+
if ((0, _definition.isListType)(type22)) {
|
|
11568
|
+
const itemType = type22.ofType;
|
|
11569
11569
|
if (valueNode.kind === _kinds.Kind.LIST) {
|
|
11570
11570
|
const coercedValues = [];
|
|
11571
11571
|
for (const itemNode of valueNode.values) {
|
|
@@ -11590,7 +11590,7 @@ var require_valueFromAST = __commonJS({
|
|
|
11590
11590
|
}
|
|
11591
11591
|
return [coercedValue];
|
|
11592
11592
|
}
|
|
11593
|
-
if ((0, _definition.isInputObjectType)(
|
|
11593
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
11594
11594
|
if (valueNode.kind !== _kinds.Kind.OBJECT) {
|
|
11595
11595
|
return;
|
|
11596
11596
|
}
|
|
@@ -11599,7 +11599,7 @@ var require_valueFromAST = __commonJS({
|
|
|
11599
11599
|
valueNode.fields,
|
|
11600
11600
|
(field) => field.name.value
|
|
11601
11601
|
);
|
|
11602
|
-
for (const field of Object.values(
|
|
11602
|
+
for (const field of Object.values(type22.getFields())) {
|
|
11603
11603
|
const fieldNode = fieldNodes[field.name];
|
|
11604
11604
|
if (!fieldNode || isMissingVariable(fieldNode.value, variables)) {
|
|
11605
11605
|
if (field.defaultValue !== void 0) {
|
|
@@ -11615,7 +11615,7 @@ var require_valueFromAST = __commonJS({
|
|
|
11615
11615
|
}
|
|
11616
11616
|
coercedObj[field.name] = fieldValue;
|
|
11617
11617
|
}
|
|
11618
|
-
if (
|
|
11618
|
+
if (type22.isOneOf) {
|
|
11619
11619
|
const keys = Object.keys(coercedObj);
|
|
11620
11620
|
if (keys.length !== 1) {
|
|
11621
11621
|
return;
|
|
@@ -11626,10 +11626,10 @@ var require_valueFromAST = __commonJS({
|
|
|
11626
11626
|
}
|
|
11627
11627
|
return coercedObj;
|
|
11628
11628
|
}
|
|
11629
|
-
if ((0, _definition.isLeafType)(
|
|
11629
|
+
if ((0, _definition.isLeafType)(type22)) {
|
|
11630
11630
|
let result;
|
|
11631
11631
|
try {
|
|
11632
|
-
result =
|
|
11632
|
+
result = type22.parseLiteral(valueNode, variables);
|
|
11633
11633
|
} catch (_error) {
|
|
11634
11634
|
return;
|
|
11635
11635
|
}
|
|
@@ -11640,7 +11640,7 @@ var require_valueFromAST = __commonJS({
|
|
|
11640
11640
|
}
|
|
11641
11641
|
(0, _invariant.invariant)(
|
|
11642
11642
|
false,
|
|
11643
|
-
"Unexpected input type: " + (0, _inspect.inspect)(
|
|
11643
|
+
"Unexpected input type: " + (0, _inspect.inspect)(type22)
|
|
11644
11644
|
);
|
|
11645
11645
|
}
|
|
11646
11646
|
function isMissingVariable(valueNode, variables) {
|
|
@@ -11979,7 +11979,7 @@ var require_collectFields = __commonJS({
|
|
|
11979
11979
|
}
|
|
11980
11980
|
return true;
|
|
11981
11981
|
}
|
|
11982
|
-
function doesFragmentConditionMatch(schema, fragment,
|
|
11982
|
+
function doesFragmentConditionMatch(schema, fragment, type22) {
|
|
11983
11983
|
const typeConditionNode = fragment.typeCondition;
|
|
11984
11984
|
if (!typeConditionNode) {
|
|
11985
11985
|
return true;
|
|
@@ -11988,11 +11988,11 @@ var require_collectFields = __commonJS({
|
|
|
11988
11988
|
schema,
|
|
11989
11989
|
typeConditionNode
|
|
11990
11990
|
);
|
|
11991
|
-
if (conditionalType ===
|
|
11991
|
+
if (conditionalType === type22) {
|
|
11992
11992
|
return true;
|
|
11993
11993
|
}
|
|
11994
11994
|
if ((0, _definition.isAbstractType)(conditionalType)) {
|
|
11995
|
-
return schema.isSubType(conditionalType,
|
|
11995
|
+
return schema.isSubType(conditionalType, type22);
|
|
11996
11996
|
}
|
|
11997
11997
|
return false;
|
|
11998
11998
|
}
|
|
@@ -12420,9 +12420,9 @@ var require_UniqueFieldDefinitionNamesRule = __commonJS({
|
|
|
12420
12420
|
return false;
|
|
12421
12421
|
}
|
|
12422
12422
|
}
|
|
12423
|
-
function hasField(
|
|
12424
|
-
if ((0, _definition.isObjectType)(
|
|
12425
|
-
return
|
|
12423
|
+
function hasField(type22, fieldName) {
|
|
12424
|
+
if ((0, _definition.isObjectType)(type22) || (0, _definition.isInterfaceType)(type22) || (0, _definition.isInputObjectType)(type22)) {
|
|
12425
|
+
return type22.getFields()[fieldName] != null;
|
|
12426
12426
|
}
|
|
12427
12427
|
return false;
|
|
12428
12428
|
}
|
|
@@ -12718,17 +12718,17 @@ var require_ValuesOfCorrectTypeRule = __commonJS({
|
|
|
12718
12718
|
variableDefinitions[definition.variable.name.value] = definition;
|
|
12719
12719
|
},
|
|
12720
12720
|
ListValue(node) {
|
|
12721
|
-
const
|
|
12721
|
+
const type22 = (0, _definition.getNullableType)(
|
|
12722
12722
|
context2.getParentInputType()
|
|
12723
12723
|
);
|
|
12724
|
-
if (!(0, _definition.isListType)(
|
|
12724
|
+
if (!(0, _definition.isListType)(type22)) {
|
|
12725
12725
|
isValidValueNode(context2, node);
|
|
12726
12726
|
return false;
|
|
12727
12727
|
}
|
|
12728
12728
|
},
|
|
12729
12729
|
ObjectValue(node) {
|
|
12730
|
-
const
|
|
12731
|
-
if (!(0, _definition.isInputObjectType)(
|
|
12730
|
+
const type22 = (0, _definition.getNamedType)(context2.getInputType());
|
|
12731
|
+
if (!(0, _definition.isInputObjectType)(type22)) {
|
|
12732
12732
|
isValidValueNode(context2, node);
|
|
12733
12733
|
return false;
|
|
12734
12734
|
}
|
|
@@ -12736,13 +12736,13 @@ var require_ValuesOfCorrectTypeRule = __commonJS({
|
|
|
12736
12736
|
node.fields,
|
|
12737
12737
|
(field) => field.name.value
|
|
12738
12738
|
);
|
|
12739
|
-
for (const fieldDef of Object.values(
|
|
12739
|
+
for (const fieldDef of Object.values(type22.getFields())) {
|
|
12740
12740
|
const fieldNode = fieldNodeMap[fieldDef.name];
|
|
12741
12741
|
if (!fieldNode && (0, _definition.isRequiredInputField)(fieldDef)) {
|
|
12742
12742
|
const typeStr = (0, _inspect.inspect)(fieldDef.type);
|
|
12743
12743
|
context2.reportError(
|
|
12744
12744
|
new _GraphQLError.GraphQLError(
|
|
12745
|
-
`Field "${
|
|
12745
|
+
`Field "${type22.name}.${fieldDef.name}" of required type "${typeStr}" was not provided.`,
|
|
12746
12746
|
{
|
|
12747
12747
|
nodes: node
|
|
12748
12748
|
}
|
|
@@ -12750,8 +12750,8 @@ var require_ValuesOfCorrectTypeRule = __commonJS({
|
|
|
12750
12750
|
);
|
|
12751
12751
|
}
|
|
12752
12752
|
}
|
|
12753
|
-
if (
|
|
12754
|
-
validateOneOfInputObject(context2, node,
|
|
12753
|
+
if (type22.isOneOf) {
|
|
12754
|
+
validateOneOfInputObject(context2, node, type22, fieldNodeMap);
|
|
12755
12755
|
}
|
|
12756
12756
|
},
|
|
12757
12757
|
ObjectField(node) {
|
|
@@ -12775,12 +12775,12 @@ var require_ValuesOfCorrectTypeRule = __commonJS({
|
|
|
12775
12775
|
}
|
|
12776
12776
|
},
|
|
12777
12777
|
NullValue(node) {
|
|
12778
|
-
const
|
|
12779
|
-
if ((0, _definition.isNonNullType)(
|
|
12778
|
+
const type22 = context2.getInputType();
|
|
12779
|
+
if ((0, _definition.isNonNullType)(type22)) {
|
|
12780
12780
|
context2.reportError(
|
|
12781
12781
|
new _GraphQLError.GraphQLError(
|
|
12782
12782
|
`Expected value of type "${(0, _inspect.inspect)(
|
|
12783
|
-
|
|
12783
|
+
type22
|
|
12784
12784
|
)}", found ${(0, _printer.print)(node)}.`,
|
|
12785
12785
|
{
|
|
12786
12786
|
nodes: node
|
|
@@ -12801,8 +12801,8 @@ var require_ValuesOfCorrectTypeRule = __commonJS({
|
|
|
12801
12801
|
if (!locationType) {
|
|
12802
12802
|
return;
|
|
12803
12803
|
}
|
|
12804
|
-
const
|
|
12805
|
-
if (!(0, _definition.isLeafType)(
|
|
12804
|
+
const type22 = (0, _definition.getNamedType)(locationType);
|
|
12805
|
+
if (!(0, _definition.isLeafType)(type22)) {
|
|
12806
12806
|
const typeStr = (0, _inspect.inspect)(locationType);
|
|
12807
12807
|
context2.reportError(
|
|
12808
12808
|
new _GraphQLError.GraphQLError(
|
|
@@ -12817,7 +12817,7 @@ var require_ValuesOfCorrectTypeRule = __commonJS({
|
|
|
12817
12817
|
return;
|
|
12818
12818
|
}
|
|
12819
12819
|
try {
|
|
12820
|
-
const parseResult =
|
|
12820
|
+
const parseResult = type22.parseLiteral(
|
|
12821
12821
|
node,
|
|
12822
12822
|
void 0
|
|
12823
12823
|
/* variables */
|
|
@@ -12854,14 +12854,14 @@ var require_ValuesOfCorrectTypeRule = __commonJS({
|
|
|
12854
12854
|
}
|
|
12855
12855
|
}
|
|
12856
12856
|
}
|
|
12857
|
-
function validateOneOfInputObject(context2, node,
|
|
12857
|
+
function validateOneOfInputObject(context2, node, type22, fieldNodeMap) {
|
|
12858
12858
|
var _fieldNodeMap$keys$;
|
|
12859
12859
|
const keys = Object.keys(fieldNodeMap);
|
|
12860
12860
|
const isNotExactlyOneField = keys.length !== 1;
|
|
12861
12861
|
if (isNotExactlyOneField) {
|
|
12862
12862
|
context2.reportError(
|
|
12863
12863
|
new _GraphQLError.GraphQLError(
|
|
12864
|
-
`OneOf Input Object "${
|
|
12864
|
+
`OneOf Input Object "${type22.name}" must specify exactly one key.`,
|
|
12865
12865
|
{
|
|
12866
12866
|
nodes: [node]
|
|
12867
12867
|
}
|
|
@@ -12874,7 +12874,7 @@ var require_ValuesOfCorrectTypeRule = __commonJS({
|
|
|
12874
12874
|
if (isNullLiteral) {
|
|
12875
12875
|
context2.reportError(
|
|
12876
12876
|
new _GraphQLError.GraphQLError(
|
|
12877
|
-
`Field "${
|
|
12877
|
+
`Field "${type22.name}.${keys[0]}" must be non-null.`,
|
|
12878
12878
|
{
|
|
12879
12879
|
nodes: [node]
|
|
12880
12880
|
}
|
|
@@ -12900,11 +12900,11 @@ var require_VariablesAreInputTypesRule = __commonJS({
|
|
|
12900
12900
|
function VariablesAreInputTypesRule(context2) {
|
|
12901
12901
|
return {
|
|
12902
12902
|
VariableDefinition(node) {
|
|
12903
|
-
const
|
|
12903
|
+
const type22 = (0, _typeFromAST.typeFromAST)(
|
|
12904
12904
|
context2.getSchema(),
|
|
12905
12905
|
node.type
|
|
12906
12906
|
);
|
|
12907
|
-
if (
|
|
12907
|
+
if (type22 !== void 0 && !(0, _definition.isInputType)(type22)) {
|
|
12908
12908
|
const variableName = node.variable.name.value;
|
|
12909
12909
|
const typeName = (0, _printer.print)(node.type);
|
|
12910
12910
|
context2.reportError(
|
|
@@ -12945,21 +12945,21 @@ var require_VariablesInAllowedPositionRule = __commonJS({
|
|
|
12945
12945
|
},
|
|
12946
12946
|
leave(operation) {
|
|
12947
12947
|
const usages = context2.getRecursiveVariableUsages(operation);
|
|
12948
|
-
for (const { node, type:
|
|
12948
|
+
for (const { node, type: type22, defaultValue, parentType } of usages) {
|
|
12949
12949
|
const varName = node.name.value;
|
|
12950
12950
|
const varDef = varDefMap[varName];
|
|
12951
|
-
if (varDef &&
|
|
12951
|
+
if (varDef && type22) {
|
|
12952
12952
|
const schema = context2.getSchema();
|
|
12953
12953
|
const varType = (0, _typeFromAST.typeFromAST)(schema, varDef.type);
|
|
12954
12954
|
if (varType && !allowedVariableUsage(
|
|
12955
12955
|
schema,
|
|
12956
12956
|
varType,
|
|
12957
12957
|
varDef.defaultValue,
|
|
12958
|
-
|
|
12958
|
+
type22,
|
|
12959
12959
|
defaultValue
|
|
12960
12960
|
)) {
|
|
12961
12961
|
const varTypeStr = (0, _inspect.inspect)(varType);
|
|
12962
|
-
const typeStr = (0, _inspect.inspect)(
|
|
12962
|
+
const typeStr = (0, _inspect.inspect)(type22);
|
|
12963
12963
|
context2.reportError(
|
|
12964
12964
|
new _GraphQLError.GraphQLError(
|
|
12965
12965
|
`Variable "$${varName}" of type "${varTypeStr}" used in position expecting type "${typeStr}".`,
|
|
@@ -14086,9 +14086,9 @@ var require_execute = __commonJS({
|
|
|
14086
14086
|
const possibleTypes = info.schema.getPossibleTypes(abstractType);
|
|
14087
14087
|
const promisedIsTypeOfResults = [];
|
|
14088
14088
|
for (let i2 = 0; i2 < possibleTypes.length; i2++) {
|
|
14089
|
-
const
|
|
14090
|
-
if (
|
|
14091
|
-
const isTypeOfResult =
|
|
14089
|
+
const type22 = possibleTypes[i2];
|
|
14090
|
+
if (type22.isTypeOf) {
|
|
14091
|
+
const isTypeOfResult = type22.isTypeOf(value, contextValue, info);
|
|
14092
14092
|
if ((0, _isPromise.isPromise)(isTypeOfResult)) {
|
|
14093
14093
|
promisedIsTypeOfResults[i2] = isTypeOfResult;
|
|
14094
14094
|
} else if (isTypeOfResult) {
|
|
@@ -14096,7 +14096,7 @@ var require_execute = __commonJS({
|
|
|
14096
14096
|
Promise.allSettled(promisedIsTypeOfResults).catch(() => {
|
|
14097
14097
|
});
|
|
14098
14098
|
}
|
|
14099
|
-
return
|
|
14099
|
+
return type22.name;
|
|
14100
14100
|
}
|
|
14101
14101
|
}
|
|
14102
14102
|
}
|
|
@@ -15374,8 +15374,8 @@ var require_NoSchemaIntrospectionCustomRule = __commonJS({
|
|
|
15374
15374
|
function NoSchemaIntrospectionCustomRule(context2) {
|
|
15375
15375
|
return {
|
|
15376
15376
|
Field(node) {
|
|
15377
|
-
const
|
|
15378
|
-
if (
|
|
15377
|
+
const type22 = (0, _definition.getNamedType)(context2.getType());
|
|
15378
|
+
if (type22 && (0, _introspection.isIntrospectionType)(type22)) {
|
|
15379
15379
|
context2.reportError(
|
|
15380
15380
|
new _GraphQLError.GraphQLError(
|
|
15381
15381
|
`GraphQL introspection has been disabled, but the requested query contained the field "${node.name.value}".`,
|
|
@@ -16064,13 +16064,13 @@ var require_buildClientSchema = __commonJS({
|
|
|
16064
16064
|
`Unknown type reference: ${(0, _inspect.inspect)(typeRef)}.`
|
|
16065
16065
|
);
|
|
16066
16066
|
}
|
|
16067
|
-
const
|
|
16068
|
-
if (!
|
|
16067
|
+
const type22 = typeMap[typeName];
|
|
16068
|
+
if (!type22) {
|
|
16069
16069
|
throw new Error(
|
|
16070
16070
|
`Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema.`
|
|
16071
16071
|
);
|
|
16072
16072
|
}
|
|
16073
|
-
return
|
|
16073
|
+
return type22;
|
|
16074
16074
|
}
|
|
16075
16075
|
function getObjectType(typeRef) {
|
|
16076
16076
|
return (0, _definition.assertObjectType)(getNamedType(typeRef));
|
|
@@ -16078,24 +16078,24 @@ var require_buildClientSchema = __commonJS({
|
|
|
16078
16078
|
function getInterfaceType(typeRef) {
|
|
16079
16079
|
return (0, _definition.assertInterfaceType)(getNamedType(typeRef));
|
|
16080
16080
|
}
|
|
16081
|
-
function buildType(
|
|
16082
|
-
if (
|
|
16083
|
-
switch (
|
|
16081
|
+
function buildType(type22) {
|
|
16082
|
+
if (type22 != null && type22.name != null && type22.kind != null) {
|
|
16083
|
+
switch (type22.kind) {
|
|
16084
16084
|
case _introspection.TypeKind.SCALAR:
|
|
16085
|
-
return buildScalarDef(
|
|
16085
|
+
return buildScalarDef(type22);
|
|
16086
16086
|
case _introspection.TypeKind.OBJECT:
|
|
16087
|
-
return buildObjectDef(
|
|
16087
|
+
return buildObjectDef(type22);
|
|
16088
16088
|
case _introspection.TypeKind.INTERFACE:
|
|
16089
|
-
return buildInterfaceDef(
|
|
16089
|
+
return buildInterfaceDef(type22);
|
|
16090
16090
|
case _introspection.TypeKind.UNION:
|
|
16091
|
-
return buildUnionDef(
|
|
16091
|
+
return buildUnionDef(type22);
|
|
16092
16092
|
case _introspection.TypeKind.ENUM:
|
|
16093
|
-
return buildEnumDef(
|
|
16093
|
+
return buildEnumDef(type22);
|
|
16094
16094
|
case _introspection.TypeKind.INPUT_OBJECT:
|
|
16095
|
-
return buildInputObjectDef(
|
|
16095
|
+
return buildInputObjectDef(type22);
|
|
16096
16096
|
}
|
|
16097
16097
|
}
|
|
16098
|
-
const typeStr = (0, _inspect.inspect)(
|
|
16098
|
+
const typeStr = (0, _inspect.inspect)(type22);
|
|
16099
16099
|
throw new Error(
|
|
16100
16100
|
`Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${typeStr}.`
|
|
16101
16101
|
);
|
|
@@ -16201,9 +16201,9 @@ var require_buildClientSchema = __commonJS({
|
|
|
16201
16201
|
);
|
|
16202
16202
|
}
|
|
16203
16203
|
function buildField(fieldIntrospection) {
|
|
16204
|
-
const
|
|
16205
|
-
if (!(0, _definition.isOutputType)(
|
|
16206
|
-
const typeStr = (0, _inspect.inspect)(
|
|
16204
|
+
const type22 = getType(fieldIntrospection.type);
|
|
16205
|
+
if (!(0, _definition.isOutputType)(type22)) {
|
|
16206
|
+
const typeStr = (0, _inspect.inspect)(type22);
|
|
16207
16207
|
throw new Error(
|
|
16208
16208
|
`Introspection must provide output type for fields, but received: ${typeStr}.`
|
|
16209
16209
|
);
|
|
@@ -16217,7 +16217,7 @@ var require_buildClientSchema = __commonJS({
|
|
|
16217
16217
|
return {
|
|
16218
16218
|
description: fieldIntrospection.description,
|
|
16219
16219
|
deprecationReason: fieldIntrospection.deprecationReason,
|
|
16220
|
-
type:
|
|
16220
|
+
type: type22,
|
|
16221
16221
|
args: buildInputValueDefMap(fieldIntrospection.args)
|
|
16222
16222
|
};
|
|
16223
16223
|
}
|
|
@@ -16229,20 +16229,20 @@ var require_buildClientSchema = __commonJS({
|
|
|
16229
16229
|
);
|
|
16230
16230
|
}
|
|
16231
16231
|
function buildInputValue(inputValueIntrospection) {
|
|
16232
|
-
const
|
|
16233
|
-
if (!(0, _definition.isInputType)(
|
|
16234
|
-
const typeStr = (0, _inspect.inspect)(
|
|
16232
|
+
const type22 = getType(inputValueIntrospection.type);
|
|
16233
|
+
if (!(0, _definition.isInputType)(type22)) {
|
|
16234
|
+
const typeStr = (0, _inspect.inspect)(type22);
|
|
16235
16235
|
throw new Error(
|
|
16236
16236
|
`Introspection must provide input type for arguments, but received: ${typeStr}.`
|
|
16237
16237
|
);
|
|
16238
16238
|
}
|
|
16239
16239
|
const defaultValue = inputValueIntrospection.defaultValue != null ? (0, _valueFromAST.valueFromAST)(
|
|
16240
16240
|
(0, _parser2.parseValue)(inputValueIntrospection.defaultValue),
|
|
16241
|
-
|
|
16241
|
+
type22
|
|
16242
16242
|
) : void 0;
|
|
16243
16243
|
return {
|
|
16244
16244
|
description: inputValueIntrospection.description,
|
|
16245
|
-
type:
|
|
16245
|
+
type: type22,
|
|
16246
16246
|
defaultValue,
|
|
16247
16247
|
deprecationReason: inputValueIntrospection.deprecationReason
|
|
16248
16248
|
};
|
|
@@ -16366,17 +16366,17 @@ var require_extendSchema = __commonJS({
|
|
|
16366
16366
|
extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions),
|
|
16367
16367
|
assumeValid: (_options$assumeValid = options === null || options === void 0 ? void 0 : options.assumeValid) !== null && _options$assumeValid !== void 0 ? _options$assumeValid : false
|
|
16368
16368
|
};
|
|
16369
|
-
function replaceType(
|
|
16370
|
-
if ((0, _definition.isListType)(
|
|
16371
|
-
return new _definition.GraphQLList(replaceType(
|
|
16369
|
+
function replaceType(type22) {
|
|
16370
|
+
if ((0, _definition.isListType)(type22)) {
|
|
16371
|
+
return new _definition.GraphQLList(replaceType(type22.ofType));
|
|
16372
16372
|
}
|
|
16373
|
-
if ((0, _definition.isNonNullType)(
|
|
16374
|
-
return new _definition.GraphQLNonNull(replaceType(
|
|
16373
|
+
if ((0, _definition.isNonNullType)(type22)) {
|
|
16374
|
+
return new _definition.GraphQLNonNull(replaceType(type22.ofType));
|
|
16375
16375
|
}
|
|
16376
|
-
return replaceNamedType(
|
|
16376
|
+
return replaceNamedType(type22);
|
|
16377
16377
|
}
|
|
16378
|
-
function replaceNamedType(
|
|
16379
|
-
return typeMap[
|
|
16378
|
+
function replaceNamedType(type22) {
|
|
16379
|
+
return typeMap[type22.name];
|
|
16380
16380
|
}
|
|
16381
16381
|
function replaceDirective(directive) {
|
|
16382
16382
|
const config2 = directive.toConfig();
|
|
@@ -16385,36 +16385,36 @@ var require_extendSchema = __commonJS({
|
|
|
16385
16385
|
args: (0, _mapValue.mapValue)(config2.args, extendArg)
|
|
16386
16386
|
});
|
|
16387
16387
|
}
|
|
16388
|
-
function extendNamedType(
|
|
16389
|
-
if ((0, _introspection.isIntrospectionType)(
|
|
16390
|
-
return
|
|
16388
|
+
function extendNamedType(type22) {
|
|
16389
|
+
if ((0, _introspection.isIntrospectionType)(type22) || (0, _scalars.isSpecifiedScalarType)(type22)) {
|
|
16390
|
+
return type22;
|
|
16391
16391
|
}
|
|
16392
|
-
if ((0, _definition.isScalarType)(
|
|
16393
|
-
return extendScalarType(
|
|
16392
|
+
if ((0, _definition.isScalarType)(type22)) {
|
|
16393
|
+
return extendScalarType(type22);
|
|
16394
16394
|
}
|
|
16395
|
-
if ((0, _definition.isObjectType)(
|
|
16396
|
-
return extendObjectType(
|
|
16395
|
+
if ((0, _definition.isObjectType)(type22)) {
|
|
16396
|
+
return extendObjectType(type22);
|
|
16397
16397
|
}
|
|
16398
|
-
if ((0, _definition.isInterfaceType)(
|
|
16399
|
-
return extendInterfaceType(
|
|
16398
|
+
if ((0, _definition.isInterfaceType)(type22)) {
|
|
16399
|
+
return extendInterfaceType(type22);
|
|
16400
16400
|
}
|
|
16401
|
-
if ((0, _definition.isUnionType)(
|
|
16402
|
-
return extendUnionType(
|
|
16401
|
+
if ((0, _definition.isUnionType)(type22)) {
|
|
16402
|
+
return extendUnionType(type22);
|
|
16403
16403
|
}
|
|
16404
|
-
if ((0, _definition.isEnumType)(
|
|
16405
|
-
return extendEnumType(
|
|
16404
|
+
if ((0, _definition.isEnumType)(type22)) {
|
|
16405
|
+
return extendEnumType(type22);
|
|
16406
16406
|
}
|
|
16407
|
-
if ((0, _definition.isInputObjectType)(
|
|
16408
|
-
return extendInputObjectType(
|
|
16407
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
16408
|
+
return extendInputObjectType(type22);
|
|
16409
16409
|
}
|
|
16410
16410
|
(0, _invariant.invariant)(
|
|
16411
16411
|
false,
|
|
16412
|
-
"Unexpected type: " + (0, _inspect.inspect)(
|
|
16412
|
+
"Unexpected type: " + (0, _inspect.inspect)(type22)
|
|
16413
16413
|
);
|
|
16414
16414
|
}
|
|
16415
|
-
function extendInputObjectType(
|
|
16415
|
+
function extendInputObjectType(type22) {
|
|
16416
16416
|
var _typeExtensionsMap$co;
|
|
16417
|
-
const config2 =
|
|
16417
|
+
const config2 = type22.toConfig();
|
|
16418
16418
|
const extensions = (_typeExtensionsMap$co = typeExtensionsMap[config2.name]) !== null && _typeExtensionsMap$co !== void 0 ? _typeExtensionsMap$co : [];
|
|
16419
16419
|
return new _definition.GraphQLInputObjectType({
|
|
16420
16420
|
...config2,
|
|
@@ -16428,19 +16428,19 @@ var require_extendSchema = __commonJS({
|
|
|
16428
16428
|
extensionASTNodes: config2.extensionASTNodes.concat(extensions)
|
|
16429
16429
|
});
|
|
16430
16430
|
}
|
|
16431
|
-
function extendEnumType(
|
|
16431
|
+
function extendEnumType(type22) {
|
|
16432
16432
|
var _typeExtensionsMap$ty;
|
|
16433
|
-
const config2 =
|
|
16434
|
-
const extensions = (_typeExtensionsMap$ty = typeExtensionsMap[
|
|
16433
|
+
const config2 = type22.toConfig();
|
|
16434
|
+
const extensions = (_typeExtensionsMap$ty = typeExtensionsMap[type22.name]) !== null && _typeExtensionsMap$ty !== void 0 ? _typeExtensionsMap$ty : [];
|
|
16435
16435
|
return new _definition.GraphQLEnumType({
|
|
16436
16436
|
...config2,
|
|
16437
16437
|
values: { ...config2.values, ...buildEnumValueMap(extensions) },
|
|
16438
16438
|
extensionASTNodes: config2.extensionASTNodes.concat(extensions)
|
|
16439
16439
|
});
|
|
16440
16440
|
}
|
|
16441
|
-
function extendScalarType(
|
|
16441
|
+
function extendScalarType(type22) {
|
|
16442
16442
|
var _typeExtensionsMap$co2;
|
|
16443
|
-
const config2 =
|
|
16443
|
+
const config2 = type22.toConfig();
|
|
16444
16444
|
const extensions = (_typeExtensionsMap$co2 = typeExtensionsMap[config2.name]) !== null && _typeExtensionsMap$co2 !== void 0 ? _typeExtensionsMap$co2 : [];
|
|
16445
16445
|
let specifiedByURL = config2.specifiedByURL;
|
|
16446
16446
|
for (const extensionNode of extensions) {
|
|
@@ -16453,14 +16453,14 @@ var require_extendSchema = __commonJS({
|
|
|
16453
16453
|
extensionASTNodes: config2.extensionASTNodes.concat(extensions)
|
|
16454
16454
|
});
|
|
16455
16455
|
}
|
|
16456
|
-
function extendObjectType(
|
|
16456
|
+
function extendObjectType(type22) {
|
|
16457
16457
|
var _typeExtensionsMap$co3;
|
|
16458
|
-
const config2 =
|
|
16458
|
+
const config2 = type22.toConfig();
|
|
16459
16459
|
const extensions = (_typeExtensionsMap$co3 = typeExtensionsMap[config2.name]) !== null && _typeExtensionsMap$co3 !== void 0 ? _typeExtensionsMap$co3 : [];
|
|
16460
16460
|
return new _definition.GraphQLObjectType({
|
|
16461
16461
|
...config2,
|
|
16462
16462
|
interfaces: () => [
|
|
16463
|
-
...
|
|
16463
|
+
...type22.getInterfaces().map(replaceNamedType),
|
|
16464
16464
|
...buildInterfaces(extensions)
|
|
16465
16465
|
],
|
|
16466
16466
|
fields: () => ({
|
|
@@ -16470,14 +16470,14 @@ var require_extendSchema = __commonJS({
|
|
|
16470
16470
|
extensionASTNodes: config2.extensionASTNodes.concat(extensions)
|
|
16471
16471
|
});
|
|
16472
16472
|
}
|
|
16473
|
-
function extendInterfaceType(
|
|
16473
|
+
function extendInterfaceType(type22) {
|
|
16474
16474
|
var _typeExtensionsMap$co4;
|
|
16475
|
-
const config2 =
|
|
16475
|
+
const config2 = type22.toConfig();
|
|
16476
16476
|
const extensions = (_typeExtensionsMap$co4 = typeExtensionsMap[config2.name]) !== null && _typeExtensionsMap$co4 !== void 0 ? _typeExtensionsMap$co4 : [];
|
|
16477
16477
|
return new _definition.GraphQLInterfaceType({
|
|
16478
16478
|
...config2,
|
|
16479
16479
|
interfaces: () => [
|
|
16480
|
-
...
|
|
16480
|
+
...type22.getInterfaces().map(replaceNamedType),
|
|
16481
16481
|
...buildInterfaces(extensions)
|
|
16482
16482
|
],
|
|
16483
16483
|
fields: () => ({
|
|
@@ -16487,14 +16487,14 @@ var require_extendSchema = __commonJS({
|
|
|
16487
16487
|
extensionASTNodes: config2.extensionASTNodes.concat(extensions)
|
|
16488
16488
|
});
|
|
16489
16489
|
}
|
|
16490
|
-
function extendUnionType(
|
|
16490
|
+
function extendUnionType(type22) {
|
|
16491
16491
|
var _typeExtensionsMap$co5;
|
|
16492
|
-
const config2 =
|
|
16492
|
+
const config2 = type22.toConfig();
|
|
16493
16493
|
const extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config2.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : [];
|
|
16494
16494
|
return new _definition.GraphQLUnionType({
|
|
16495
16495
|
...config2,
|
|
16496
16496
|
types: () => [
|
|
16497
|
-
...
|
|
16497
|
+
...type22.getTypes().map(replaceNamedType),
|
|
16498
16498
|
...buildUnionTypes(extensions)
|
|
16499
16499
|
],
|
|
16500
16500
|
extensionASTNodes: config2.extensionASTNodes.concat(extensions)
|
|
@@ -16527,11 +16527,11 @@ var require_extendSchema = __commonJS({
|
|
|
16527
16527
|
function getNamedType(node) {
|
|
16528
16528
|
var _stdTypeMap$name2;
|
|
16529
16529
|
const name21 = node.name.value;
|
|
16530
|
-
const
|
|
16531
|
-
if (
|
|
16530
|
+
const type22 = (_stdTypeMap$name2 = stdTypeMap[name21]) !== null && _stdTypeMap$name2 !== void 0 ? _stdTypeMap$name2 : typeMap[name21];
|
|
16531
|
+
if (type22 === void 0) {
|
|
16532
16532
|
throw new Error(`Unknown type: "${name21}".`);
|
|
16533
16533
|
}
|
|
16534
|
-
return
|
|
16534
|
+
return type22;
|
|
16535
16535
|
}
|
|
16536
16536
|
function getWrappedType(node) {
|
|
16537
16537
|
if (node.kind === _kinds.Kind.LIST_TYPE) {
|
|
@@ -16586,11 +16586,11 @@ var require_extendSchema = __commonJS({
|
|
|
16586
16586
|
const argConfigMap = /* @__PURE__ */ Object.create(null);
|
|
16587
16587
|
for (const arg of argsNodes) {
|
|
16588
16588
|
var _arg$description;
|
|
16589
|
-
const
|
|
16589
|
+
const type22 = getWrappedType(arg.type);
|
|
16590
16590
|
argConfigMap[arg.name.value] = {
|
|
16591
|
-
type:
|
|
16591
|
+
type: type22,
|
|
16592
16592
|
description: (_arg$description = arg.description) === null || _arg$description === void 0 ? void 0 : _arg$description.value,
|
|
16593
|
-
defaultValue: (0, _valueFromAST.valueFromAST)(arg.defaultValue,
|
|
16593
|
+
defaultValue: (0, _valueFromAST.valueFromAST)(arg.defaultValue, type22),
|
|
16594
16594
|
deprecationReason: getDeprecationReason(arg),
|
|
16595
16595
|
astNode: arg
|
|
16596
16596
|
};
|
|
@@ -16607,13 +16607,13 @@ var require_extendSchema = __commonJS({
|
|
|
16607
16607
|
);
|
|
16608
16608
|
for (const field of fieldsNodes) {
|
|
16609
16609
|
var _field$description2;
|
|
16610
|
-
const
|
|
16610
|
+
const type22 = getWrappedType(field.type);
|
|
16611
16611
|
inputFieldMap[field.name.value] = {
|
|
16612
|
-
type:
|
|
16612
|
+
type: type22,
|
|
16613
16613
|
description: (_field$description2 = field.description) === null || _field$description2 === void 0 ? void 0 : _field$description2.value,
|
|
16614
16614
|
defaultValue: (0, _valueFromAST.valueFromAST)(
|
|
16615
16615
|
field.defaultValue,
|
|
16616
|
-
|
|
16616
|
+
type22
|
|
16617
16617
|
),
|
|
16618
16618
|
deprecationReason: getDeprecationReason(field),
|
|
16619
16619
|
astNode: field
|
|
@@ -16743,7 +16743,7 @@ var require_extendSchema = __commonJS({
|
|
|
16743
16743
|
}
|
|
16744
16744
|
var stdTypeMap = (0, _keyMap.keyMap)(
|
|
16745
16745
|
[..._scalars.specifiedScalarTypes, ..._introspection.introspectionTypes],
|
|
16746
|
-
(
|
|
16746
|
+
(type22) => type22.name
|
|
16747
16747
|
);
|
|
16748
16748
|
function getDeprecationReason(node) {
|
|
16749
16749
|
const deprecated = (0, _values.getDirectiveValues)(
|
|
@@ -16802,19 +16802,19 @@ var require_buildASTSchema = __commonJS({
|
|
|
16802
16802
|
options
|
|
16803
16803
|
);
|
|
16804
16804
|
if (config2.astNode == null) {
|
|
16805
|
-
for (const
|
|
16806
|
-
switch (
|
|
16805
|
+
for (const type22 of config2.types) {
|
|
16806
|
+
switch (type22.name) {
|
|
16807
16807
|
// Note: While this could make early assertions to get the correctly
|
|
16808
16808
|
// typed values below, that would throw immediately while type system
|
|
16809
16809
|
// validation with validateSchema() will produce more actionable results.
|
|
16810
16810
|
case "Query":
|
|
16811
|
-
config2.query =
|
|
16811
|
+
config2.query = type22;
|
|
16812
16812
|
break;
|
|
16813
16813
|
case "Mutation":
|
|
16814
|
-
config2.mutation =
|
|
16814
|
+
config2.mutation = type22;
|
|
16815
16815
|
break;
|
|
16816
16816
|
case "Subscription":
|
|
16817
|
-
config2.subscription =
|
|
16817
|
+
config2.subscription = type22;
|
|
16818
16818
|
break;
|
|
16819
16819
|
}
|
|
16820
16820
|
}
|
|
@@ -16863,7 +16863,7 @@ var require_lexicographicSortSchema = __commonJS({
|
|
|
16863
16863
|
const schemaConfig = schema.toConfig();
|
|
16864
16864
|
const typeMap = (0, _keyValMap.keyValMap)(
|
|
16865
16865
|
sortByName(schemaConfig.types),
|
|
16866
|
-
(
|
|
16866
|
+
(type22) => type22.name,
|
|
16867
16867
|
sortNamedType
|
|
16868
16868
|
);
|
|
16869
16869
|
return new _schema.GraphQLSchema({
|
|
@@ -16874,16 +16874,16 @@ var require_lexicographicSortSchema = __commonJS({
|
|
|
16874
16874
|
mutation: replaceMaybeType(schemaConfig.mutation),
|
|
16875
16875
|
subscription: replaceMaybeType(schemaConfig.subscription)
|
|
16876
16876
|
});
|
|
16877
|
-
function replaceType(
|
|
16878
|
-
if ((0, _definition.isListType)(
|
|
16879
|
-
return new _definition.GraphQLList(replaceType(
|
|
16880
|
-
} else if ((0, _definition.isNonNullType)(
|
|
16881
|
-
return new _definition.GraphQLNonNull(replaceType(
|
|
16877
|
+
function replaceType(type22) {
|
|
16878
|
+
if ((0, _definition.isListType)(type22)) {
|
|
16879
|
+
return new _definition.GraphQLList(replaceType(type22.ofType));
|
|
16880
|
+
} else if ((0, _definition.isNonNullType)(type22)) {
|
|
16881
|
+
return new _definition.GraphQLNonNull(replaceType(type22.ofType));
|
|
16882
16882
|
}
|
|
16883
|
-
return replaceNamedType(
|
|
16883
|
+
return replaceNamedType(type22);
|
|
16884
16884
|
}
|
|
16885
|
-
function replaceNamedType(
|
|
16886
|
-
return typeMap[
|
|
16885
|
+
function replaceNamedType(type22) {
|
|
16886
|
+
return typeMap[type22.name];
|
|
16887
16887
|
}
|
|
16888
16888
|
function replaceMaybeType(maybeType) {
|
|
16889
16889
|
return maybeType && replaceNamedType(maybeType);
|
|
@@ -16915,42 +16915,42 @@ var require_lexicographicSortSchema = __commonJS({
|
|
|
16915
16915
|
function sortTypes(array3) {
|
|
16916
16916
|
return sortByName(array3).map(replaceNamedType);
|
|
16917
16917
|
}
|
|
16918
|
-
function sortNamedType(
|
|
16919
|
-
if ((0, _definition.isScalarType)(
|
|
16920
|
-
return
|
|
16918
|
+
function sortNamedType(type22) {
|
|
16919
|
+
if ((0, _definition.isScalarType)(type22) || (0, _introspection.isIntrospectionType)(type22)) {
|
|
16920
|
+
return type22;
|
|
16921
16921
|
}
|
|
16922
|
-
if ((0, _definition.isObjectType)(
|
|
16923
|
-
const config2 =
|
|
16922
|
+
if ((0, _definition.isObjectType)(type22)) {
|
|
16923
|
+
const config2 = type22.toConfig();
|
|
16924
16924
|
return new _definition.GraphQLObjectType({
|
|
16925
16925
|
...config2,
|
|
16926
16926
|
interfaces: () => sortTypes(config2.interfaces),
|
|
16927
16927
|
fields: () => sortFields(config2.fields)
|
|
16928
16928
|
});
|
|
16929
16929
|
}
|
|
16930
|
-
if ((0, _definition.isInterfaceType)(
|
|
16931
|
-
const config2 =
|
|
16930
|
+
if ((0, _definition.isInterfaceType)(type22)) {
|
|
16931
|
+
const config2 = type22.toConfig();
|
|
16932
16932
|
return new _definition.GraphQLInterfaceType({
|
|
16933
16933
|
...config2,
|
|
16934
16934
|
interfaces: () => sortTypes(config2.interfaces),
|
|
16935
16935
|
fields: () => sortFields(config2.fields)
|
|
16936
16936
|
});
|
|
16937
16937
|
}
|
|
16938
|
-
if ((0, _definition.isUnionType)(
|
|
16939
|
-
const config2 =
|
|
16938
|
+
if ((0, _definition.isUnionType)(type22)) {
|
|
16939
|
+
const config2 = type22.toConfig();
|
|
16940
16940
|
return new _definition.GraphQLUnionType({
|
|
16941
16941
|
...config2,
|
|
16942
16942
|
types: () => sortTypes(config2.types)
|
|
16943
16943
|
});
|
|
16944
16944
|
}
|
|
16945
|
-
if ((0, _definition.isEnumType)(
|
|
16946
|
-
const config2 =
|
|
16945
|
+
if ((0, _definition.isEnumType)(type22)) {
|
|
16946
|
+
const config2 = type22.toConfig();
|
|
16947
16947
|
return new _definition.GraphQLEnumType({
|
|
16948
16948
|
...config2,
|
|
16949
16949
|
values: sortObjMap(config2.values, (value) => value)
|
|
16950
16950
|
});
|
|
16951
16951
|
}
|
|
16952
|
-
if ((0, _definition.isInputObjectType)(
|
|
16953
|
-
const config2 =
|
|
16952
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
16953
|
+
const config2 = type22.toConfig();
|
|
16954
16954
|
return new _definition.GraphQLInputObjectType({
|
|
16955
16955
|
...config2,
|
|
16956
16956
|
fields: () => sortInputFields(config2.fields)
|
|
@@ -16958,7 +16958,7 @@ var require_lexicographicSortSchema = __commonJS({
|
|
|
16958
16958
|
}
|
|
16959
16959
|
(0, _invariant.invariant)(
|
|
16960
16960
|
false,
|
|
16961
|
-
"Unexpected type: " + (0, _inspect.inspect)(
|
|
16961
|
+
"Unexpected type: " + (0, _inspect.inspect)(type22)
|
|
16962
16962
|
);
|
|
16963
16963
|
}
|
|
16964
16964
|
}
|
|
@@ -17016,8 +17016,8 @@ var require_printSchema = __commonJS({
|
|
|
17016
17016
|
_introspection.isIntrospectionType
|
|
17017
17017
|
);
|
|
17018
17018
|
}
|
|
17019
|
-
function isDefinedType(
|
|
17020
|
-
return !(0, _scalars.isSpecifiedScalarType)(
|
|
17019
|
+
function isDefinedType(type22) {
|
|
17020
|
+
return !(0, _scalars.isSpecifiedScalarType)(type22) && !(0, _introspection.isIntrospectionType)(type22);
|
|
17021
17021
|
}
|
|
17022
17022
|
function printFilteredSchema(schema, directiveFilter, typeFilter) {
|
|
17023
17023
|
const directives = schema.getDirectives().filter(directiveFilter);
|
|
@@ -17025,7 +17025,7 @@ var require_printSchema = __commonJS({
|
|
|
17025
17025
|
return [
|
|
17026
17026
|
printSchemaDefinition(schema),
|
|
17027
17027
|
...directives.map((directive) => printDirective(directive)),
|
|
17028
|
-
...types.map((
|
|
17028
|
+
...types.map((type22) => printType(type22))
|
|
17029
17029
|
].filter(Boolean).join("\n\n");
|
|
17030
17030
|
}
|
|
17031
17031
|
function printSchemaDefinition(schema) {
|
|
@@ -17064,62 +17064,62 @@ ${operationTypes.join("\n")}
|
|
|
17064
17064
|
}
|
|
17065
17065
|
return true;
|
|
17066
17066
|
}
|
|
17067
|
-
function printType(
|
|
17068
|
-
if ((0, _definition.isScalarType)(
|
|
17069
|
-
return printScalar(
|
|
17067
|
+
function printType(type22) {
|
|
17068
|
+
if ((0, _definition.isScalarType)(type22)) {
|
|
17069
|
+
return printScalar(type22);
|
|
17070
17070
|
}
|
|
17071
|
-
if ((0, _definition.isObjectType)(
|
|
17072
|
-
return printObject(
|
|
17071
|
+
if ((0, _definition.isObjectType)(type22)) {
|
|
17072
|
+
return printObject(type22);
|
|
17073
17073
|
}
|
|
17074
|
-
if ((0, _definition.isInterfaceType)(
|
|
17075
|
-
return printInterface(
|
|
17074
|
+
if ((0, _definition.isInterfaceType)(type22)) {
|
|
17075
|
+
return printInterface(type22);
|
|
17076
17076
|
}
|
|
17077
|
-
if ((0, _definition.isUnionType)(
|
|
17078
|
-
return printUnion(
|
|
17077
|
+
if ((0, _definition.isUnionType)(type22)) {
|
|
17078
|
+
return printUnion(type22);
|
|
17079
17079
|
}
|
|
17080
|
-
if ((0, _definition.isEnumType)(
|
|
17081
|
-
return printEnum(
|
|
17080
|
+
if ((0, _definition.isEnumType)(type22)) {
|
|
17081
|
+
return printEnum(type22);
|
|
17082
17082
|
}
|
|
17083
|
-
if ((0, _definition.isInputObjectType)(
|
|
17084
|
-
return printInputObject(
|
|
17083
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
17084
|
+
return printInputObject(type22);
|
|
17085
17085
|
}
|
|
17086
17086
|
(0, _invariant.invariant)(
|
|
17087
17087
|
false,
|
|
17088
|
-
"Unexpected type: " + (0, _inspect.inspect)(
|
|
17088
|
+
"Unexpected type: " + (0, _inspect.inspect)(type22)
|
|
17089
17089
|
);
|
|
17090
17090
|
}
|
|
17091
|
-
function printScalar(
|
|
17092
|
-
return printDescription(
|
|
17091
|
+
function printScalar(type22) {
|
|
17092
|
+
return printDescription(type22) + `scalar ${type22.name}` + printSpecifiedByURL(type22);
|
|
17093
17093
|
}
|
|
17094
|
-
function printImplementedInterfaces(
|
|
17095
|
-
const interfaces =
|
|
17094
|
+
function printImplementedInterfaces(type22) {
|
|
17095
|
+
const interfaces = type22.getInterfaces();
|
|
17096
17096
|
return interfaces.length ? " implements " + interfaces.map((i2) => i2.name).join(" & ") : "";
|
|
17097
17097
|
}
|
|
17098
|
-
function printObject(
|
|
17099
|
-
return printDescription(
|
|
17098
|
+
function printObject(type22) {
|
|
17099
|
+
return printDescription(type22) + `type ${type22.name}` + printImplementedInterfaces(type22) + printFields(type22);
|
|
17100
17100
|
}
|
|
17101
|
-
function printInterface(
|
|
17102
|
-
return printDescription(
|
|
17101
|
+
function printInterface(type22) {
|
|
17102
|
+
return printDescription(type22) + `interface ${type22.name}` + printImplementedInterfaces(type22) + printFields(type22);
|
|
17103
17103
|
}
|
|
17104
|
-
function printUnion(
|
|
17105
|
-
const types =
|
|
17104
|
+
function printUnion(type22) {
|
|
17105
|
+
const types = type22.getTypes();
|
|
17106
17106
|
const possibleTypes = types.length ? " = " + types.join(" | ") : "";
|
|
17107
|
-
return printDescription(
|
|
17107
|
+
return printDescription(type22) + "union " + type22.name + possibleTypes;
|
|
17108
17108
|
}
|
|
17109
|
-
function printEnum(
|
|
17110
|
-
const values =
|
|
17109
|
+
function printEnum(type22) {
|
|
17110
|
+
const values = type22.getValues().map(
|
|
17111
17111
|
(value, i2) => printDescription(value, " ", !i2) + " " + value.name + printDeprecated(value.deprecationReason)
|
|
17112
17112
|
);
|
|
17113
|
-
return printDescription(
|
|
17113
|
+
return printDescription(type22) + `enum ${type22.name}` + printBlock(values);
|
|
17114
17114
|
}
|
|
17115
|
-
function printInputObject(
|
|
17116
|
-
const fields = Object.values(
|
|
17115
|
+
function printInputObject(type22) {
|
|
17116
|
+
const fields = Object.values(type22.getFields()).map(
|
|
17117
17117
|
(f2, i2) => printDescription(f2, " ", !i2) + " " + printInputValue(f2)
|
|
17118
17118
|
);
|
|
17119
|
-
return printDescription(
|
|
17119
|
+
return printDescription(type22) + `input ${type22.name}` + (type22.isOneOf ? " @oneOf" : "") + printBlock(fields);
|
|
17120
17120
|
}
|
|
17121
|
-
function printFields(
|
|
17122
|
-
const fields = Object.values(
|
|
17121
|
+
function printFields(type22) {
|
|
17122
|
+
const fields = Object.values(type22.getFields()).map(
|
|
17123
17123
|
(f2, i2) => printDescription(f2, " ", !i2) + " " + f2.name + printArgs(f2.args, " ") + ": " + String(f2.type) + printDeprecated(f2.deprecationReason)
|
|
17124
17124
|
);
|
|
17125
17125
|
return printBlock(fields);
|
|
@@ -17714,32 +17714,32 @@ var require_findBreakingChanges = __commonJS({
|
|
|
17714
17714
|
}
|
|
17715
17715
|
return (0, _definition.isNamedType)(newType) && oldType.name === newType.name;
|
|
17716
17716
|
}
|
|
17717
|
-
function typeKindName(
|
|
17718
|
-
if ((0, _definition.isScalarType)(
|
|
17717
|
+
function typeKindName(type22) {
|
|
17718
|
+
if ((0, _definition.isScalarType)(type22)) {
|
|
17719
17719
|
return "a Scalar type";
|
|
17720
17720
|
}
|
|
17721
|
-
if ((0, _definition.isObjectType)(
|
|
17721
|
+
if ((0, _definition.isObjectType)(type22)) {
|
|
17722
17722
|
return "an Object type";
|
|
17723
17723
|
}
|
|
17724
|
-
if ((0, _definition.isInterfaceType)(
|
|
17724
|
+
if ((0, _definition.isInterfaceType)(type22)) {
|
|
17725
17725
|
return "an Interface type";
|
|
17726
17726
|
}
|
|
17727
|
-
if ((0, _definition.isUnionType)(
|
|
17727
|
+
if ((0, _definition.isUnionType)(type22)) {
|
|
17728
17728
|
return "a Union type";
|
|
17729
17729
|
}
|
|
17730
|
-
if ((0, _definition.isEnumType)(
|
|
17730
|
+
if ((0, _definition.isEnumType)(type22)) {
|
|
17731
17731
|
return "an Enum type";
|
|
17732
17732
|
}
|
|
17733
|
-
if ((0, _definition.isInputObjectType)(
|
|
17733
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
17734
17734
|
return "an Input type";
|
|
17735
17735
|
}
|
|
17736
17736
|
(0, _invariant.invariant)(
|
|
17737
17737
|
false,
|
|
17738
|
-
"Unexpected type: " + (0, _inspect.inspect)(
|
|
17738
|
+
"Unexpected type: " + (0, _inspect.inspect)(type22)
|
|
17739
17739
|
);
|
|
17740
17740
|
}
|
|
17741
|
-
function stringifyValue(value,
|
|
17742
|
-
const ast = (0, _astFromValue.astFromValue)(value,
|
|
17741
|
+
function stringifyValue(value, type22) {
|
|
17742
|
+
const ast = (0, _astFromValue.astFromValue)(value, type22);
|
|
17743
17743
|
ast != null || (0, _invariant.invariant)(false);
|
|
17744
17744
|
return (0, _printer.print)((0, _sortValueNode.sortValueNode)(ast));
|
|
17745
17745
|
}
|
|
@@ -17792,78 +17792,78 @@ var require_resolveSchemaCoordinate = __commonJS({
|
|
|
17792
17792
|
}
|
|
17793
17793
|
function resolveTypeCoordinate(schema, schemaCoordinate) {
|
|
17794
17794
|
const typeName = schemaCoordinate.name.value;
|
|
17795
|
-
const
|
|
17796
|
-
if (
|
|
17795
|
+
const type22 = schema.getType(typeName);
|
|
17796
|
+
if (type22 == null) {
|
|
17797
17797
|
return;
|
|
17798
17798
|
}
|
|
17799
17799
|
return {
|
|
17800
17800
|
kind: "NamedType",
|
|
17801
|
-
type:
|
|
17801
|
+
type: type22
|
|
17802
17802
|
};
|
|
17803
17803
|
}
|
|
17804
17804
|
function resolveMemberCoordinate(schema, schemaCoordinate) {
|
|
17805
17805
|
const typeName = schemaCoordinate.name.value;
|
|
17806
|
-
const
|
|
17807
|
-
if (!
|
|
17806
|
+
const type22 = schema.getType(typeName);
|
|
17807
|
+
if (!type22) {
|
|
17808
17808
|
throw new Error(
|
|
17809
17809
|
`Expected ${(0, _inspect.inspect)(
|
|
17810
17810
|
typeName
|
|
17811
17811
|
)} to be defined as a type in the schema.`
|
|
17812
17812
|
);
|
|
17813
17813
|
}
|
|
17814
|
-
if (!(0, _definition.isEnumType)(
|
|
17814
|
+
if (!(0, _definition.isEnumType)(type22) && !(0, _definition.isInputObjectType)(type22) && !(0, _definition.isObjectType)(type22) && !(0, _definition.isInterfaceType)(type22)) {
|
|
17815
17815
|
throw new Error(
|
|
17816
17816
|
`Expected ${(0, _inspect.inspect)(
|
|
17817
17817
|
typeName
|
|
17818
17818
|
)} to be an Enum, Input Object, Object or Interface type.`
|
|
17819
17819
|
);
|
|
17820
17820
|
}
|
|
17821
|
-
if ((0, _definition.isEnumType)(
|
|
17821
|
+
if ((0, _definition.isEnumType)(type22)) {
|
|
17822
17822
|
const enumValueName = schemaCoordinate.memberName.value;
|
|
17823
|
-
const enumValue =
|
|
17823
|
+
const enumValue = type22.getValue(enumValueName);
|
|
17824
17824
|
if (enumValue == null) {
|
|
17825
17825
|
return;
|
|
17826
17826
|
}
|
|
17827
17827
|
return {
|
|
17828
17828
|
kind: "EnumValue",
|
|
17829
|
-
type:
|
|
17829
|
+
type: type22,
|
|
17830
17830
|
enumValue
|
|
17831
17831
|
};
|
|
17832
17832
|
}
|
|
17833
|
-
if ((0, _definition.isInputObjectType)(
|
|
17833
|
+
if ((0, _definition.isInputObjectType)(type22)) {
|
|
17834
17834
|
const inputFieldName = schemaCoordinate.memberName.value;
|
|
17835
|
-
const inputField =
|
|
17835
|
+
const inputField = type22.getFields()[inputFieldName];
|
|
17836
17836
|
if (inputField == null) {
|
|
17837
17837
|
return;
|
|
17838
17838
|
}
|
|
17839
17839
|
return {
|
|
17840
17840
|
kind: "InputField",
|
|
17841
|
-
type:
|
|
17841
|
+
type: type22,
|
|
17842
17842
|
inputField
|
|
17843
17843
|
};
|
|
17844
17844
|
}
|
|
17845
17845
|
const fieldName = schemaCoordinate.memberName.value;
|
|
17846
|
-
const field =
|
|
17846
|
+
const field = type22.getFields()[fieldName];
|
|
17847
17847
|
if (field == null) {
|
|
17848
17848
|
return;
|
|
17849
17849
|
}
|
|
17850
17850
|
return {
|
|
17851
17851
|
kind: "Field",
|
|
17852
|
-
type:
|
|
17852
|
+
type: type22,
|
|
17853
17853
|
field
|
|
17854
17854
|
};
|
|
17855
17855
|
}
|
|
17856
17856
|
function resolveArgumentCoordinate(schema, schemaCoordinate) {
|
|
17857
17857
|
const typeName = schemaCoordinate.name.value;
|
|
17858
|
-
const
|
|
17859
|
-
if (
|
|
17858
|
+
const type22 = schema.getType(typeName);
|
|
17859
|
+
if (type22 == null) {
|
|
17860
17860
|
throw new Error(
|
|
17861
17861
|
`Expected ${(0, _inspect.inspect)(
|
|
17862
17862
|
typeName
|
|
17863
17863
|
)} to be defined as a type in the schema.`
|
|
17864
17864
|
);
|
|
17865
17865
|
}
|
|
17866
|
-
if (!(0, _definition.isObjectType)(
|
|
17866
|
+
if (!(0, _definition.isObjectType)(type22) && !(0, _definition.isInterfaceType)(type22)) {
|
|
17867
17867
|
throw new Error(
|
|
17868
17868
|
`Expected ${(0, _inspect.inspect)(
|
|
17869
17869
|
typeName
|
|
@@ -17871,7 +17871,7 @@ var require_resolveSchemaCoordinate = __commonJS({
|
|
|
17871
17871
|
);
|
|
17872
17872
|
}
|
|
17873
17873
|
const fieldName = schemaCoordinate.fieldName.value;
|
|
17874
|
-
const field =
|
|
17874
|
+
const field = type22.getFields()[fieldName];
|
|
17875
17875
|
if (field == null) {
|
|
17876
17876
|
throw new Error(
|
|
17877
17877
|
`Expected ${(0, _inspect.inspect)(
|
|
@@ -17890,7 +17890,7 @@ var require_resolveSchemaCoordinate = __commonJS({
|
|
|
17890
17890
|
}
|
|
17891
17891
|
return {
|
|
17892
17892
|
kind: "FieldArgument",
|
|
17893
|
-
type:
|
|
17893
|
+
type: type22,
|
|
17894
17894
|
field,
|
|
17895
17895
|
fieldArgument
|
|
17896
17896
|
};
|
|
@@ -20573,14 +20573,14 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
20573
20573
|
if (args[a3] === void 0) break;
|
|
20574
20574
|
if (lastPos < i2)
|
|
20575
20575
|
str += f2.slice(lastPos, i2);
|
|
20576
|
-
var
|
|
20577
|
-
if (
|
|
20576
|
+
var type22 = typeof args[a3];
|
|
20577
|
+
if (type22 === "string") {
|
|
20578
20578
|
str += "'" + args[a3] + "'";
|
|
20579
20579
|
lastPos = i2 + 2;
|
|
20580
20580
|
i2++;
|
|
20581
20581
|
break;
|
|
20582
20582
|
}
|
|
20583
|
-
if (
|
|
20583
|
+
if (type22 === "function") {
|
|
20584
20584
|
str += args[a3].name || "<anonymous>";
|
|
20585
20585
|
lastPos = i2 + 2;
|
|
20586
20586
|
i2++;
|
|
@@ -24752,8 +24752,8 @@ var require_cjs = __commonJS({
|
|
|
24752
24752
|
if (stringTag) {
|
|
24753
24753
|
return stringTag;
|
|
24754
24754
|
}
|
|
24755
|
-
const
|
|
24756
|
-
return
|
|
24755
|
+
const type22 = toStringObject.call(value);
|
|
24756
|
+
return type22.substring(8, type22.length - 1);
|
|
24757
24757
|
}
|
|
24758
24758
|
var { hasOwnProperty, propertyIsEnumerable } = Object.prototype;
|
|
24759
24759
|
function copyOwnDescriptor(original, clone2, property, state) {
|
|
@@ -42489,8 +42489,8 @@ var require_applicability = __commonJS({
|
|
|
42489
42489
|
"use strict";
|
|
42490
42490
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
42491
42491
|
exports2.shouldUseRule = exports2.shouldUseGroup = exports2.schemaHasRulesForType = void 0;
|
|
42492
|
-
function schemaHasRulesForType({ schema, self: self2 },
|
|
42493
|
-
const group = self2.RULES.types[
|
|
42492
|
+
function schemaHasRulesForType({ schema, self: self2 }, type22) {
|
|
42493
|
+
const group = self2.RULES.types[type22];
|
|
42494
42494
|
return group && group !== true && shouldUseGroup(schema, group);
|
|
42495
42495
|
}
|
|
42496
42496
|
exports2.schemaHasRulesForType = schemaHasRulesForType;
|
|
@@ -43591,9 +43591,9 @@ var require_validate3 = __commonJS({
|
|
|
43591
43591
|
for (const keyword in rules) {
|
|
43592
43592
|
const rule = rules[keyword];
|
|
43593
43593
|
if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it2.schema, rule)) {
|
|
43594
|
-
const { type:
|
|
43595
|
-
if (
|
|
43596
|
-
strictTypesError(it2, `missing type "${
|
|
43594
|
+
const { type: type22 } = rule.definition;
|
|
43595
|
+
if (type22.length && !type22.some((t4) => hasApplicableType(ts, t4))) {
|
|
43596
|
+
strictTypesError(it2, `missing type "${type22.join(",")}" for keyword "${keyword}"`);
|
|
43597
43597
|
}
|
|
43598
43598
|
}
|
|
43599
43599
|
}
|
|
@@ -60015,7 +60015,7 @@ var require_server = __commonJS({
|
|
|
60015
60015
|
session.once("close", function() {
|
|
60016
60016
|
http2Server[kHttp2ServerSessions].delete(session);
|
|
60017
60017
|
});
|
|
60018
|
-
session.once("frameError", function(
|
|
60018
|
+
session.once("frameError", function(type22, code, streamId) {
|
|
60019
60019
|
if (streamId === 0) {
|
|
60020
60020
|
http2Server[kHttp2ServerSessions].delete(session);
|
|
60021
60021
|
}
|
|
@@ -61859,8 +61859,8 @@ var require_reply = __commonJS({
|
|
|
61859
61859
|
this[kReplySerializer] = fn;
|
|
61860
61860
|
return this;
|
|
61861
61861
|
};
|
|
61862
|
-
Reply.prototype.type = function(
|
|
61863
|
-
this[kReplyHeaders]["content-type"] =
|
|
61862
|
+
Reply.prototype.type = function(type22) {
|
|
61863
|
+
this[kReplyHeaders]["content-type"] = type22;
|
|
61864
61864
|
return this;
|
|
61865
61865
|
};
|
|
61866
61866
|
Reply.prototype.redirect = function(url2, code) {
|
|
@@ -64610,7 +64610,7 @@ var require_content_type_parser = __commonJS({
|
|
|
64610
64610
|
if (!opts) opts = {};
|
|
64611
64611
|
if (!opts.bodyLimit) opts.bodyLimit = this[kBodyLimit];
|
|
64612
64612
|
if (Array.isArray(contentType2)) {
|
|
64613
|
-
contentType2.forEach((
|
|
64613
|
+
contentType2.forEach((type22) => this[kContentTypeParser].add(type22, opts, parser));
|
|
64614
64614
|
} else {
|
|
64615
64615
|
this[kContentTypeParser].add(contentType2, opts, parser);
|
|
64616
64616
|
}
|
|
@@ -64624,8 +64624,8 @@ var require_content_type_parser = __commonJS({
|
|
|
64624
64624
|
throw new FST_ERR_CTP_INSTANCE_ALREADY_STARTED("removeContentTypeParser");
|
|
64625
64625
|
}
|
|
64626
64626
|
if (Array.isArray(contentType2)) {
|
|
64627
|
-
for (const
|
|
64628
|
-
this[kContentTypeParser].remove(
|
|
64627
|
+
for (const type22 of contentType2) {
|
|
64628
|
+
this[kContentTypeParser].remove(type22);
|
|
64629
64629
|
}
|
|
64630
64630
|
} else {
|
|
64631
64631
|
this[kContentTypeParser].remove(contentType2);
|
|
@@ -67154,9 +67154,9 @@ ${contextFunctionCode}`,
|
|
|
67154
67154
|
context2.functions.push(functionCode);
|
|
67155
67155
|
return functionName;
|
|
67156
67156
|
}
|
|
67157
|
-
function buildArrayTypeCondition(
|
|
67157
|
+
function buildArrayTypeCondition(type22, accessor) {
|
|
67158
67158
|
let condition;
|
|
67159
|
-
switch (
|
|
67159
|
+
switch (type22) {
|
|
67160
67160
|
case "null":
|
|
67161
67161
|
condition = "value === null";
|
|
67162
67162
|
break;
|
|
@@ -67187,8 +67187,8 @@ ${contextFunctionCode}`,
|
|
|
67187
67187
|
condition = "Array.isArray(value)";
|
|
67188
67188
|
break;
|
|
67189
67189
|
default:
|
|
67190
|
-
if (Array.isArray(
|
|
67191
|
-
const conditions =
|
|
67190
|
+
if (Array.isArray(type22)) {
|
|
67191
|
+
const conditions = type22.map((subType) => {
|
|
67192
67192
|
return buildArrayTypeCondition(subType, accessor);
|
|
67193
67193
|
});
|
|
67194
67194
|
condition = `(${conditions.join(" || ")})`;
|
|
@@ -67203,11 +67203,11 @@ ${contextFunctionCode}`,
|
|
|
67203
67203
|
const schema = location.schema;
|
|
67204
67204
|
const types = schema.type.sort((t1) => t1 === "null" ? -1 : 1);
|
|
67205
67205
|
let code = "";
|
|
67206
|
-
types.forEach((
|
|
67207
|
-
location.schema = { ...location.schema, type:
|
|
67206
|
+
types.forEach((type22, index) => {
|
|
67207
|
+
location.schema = { ...location.schema, type: type22 };
|
|
67208
67208
|
const nestedResult = buildSingleTypeSerializer(context2, location, input);
|
|
67209
67209
|
const statement = index === 0 ? "if" : "else if";
|
|
67210
|
-
switch (
|
|
67210
|
+
switch (type22) {
|
|
67211
67211
|
case "null":
|
|
67212
67212
|
code += `
|
|
67213
67213
|
${statement} (${input} === null)
|
|
@@ -67247,7 +67247,7 @@ ${contextFunctionCode}`,
|
|
|
67247
67247
|
}
|
|
67248
67248
|
default: {
|
|
67249
67249
|
code += `
|
|
67250
|
-
${statement}(typeof ${input} === "${
|
|
67250
|
+
${statement}(typeof ${input} === "${type22}" || ${input} === null)
|
|
67251
67251
|
${nestedResult}
|
|
67252
67252
|
`;
|
|
67253
67253
|
break;
|
|
@@ -67317,8 +67317,8 @@ ${contextFunctionCode}`,
|
|
|
67317
67317
|
}
|
|
67318
67318
|
function buildConstSerializer(location, input) {
|
|
67319
67319
|
const schema = location.schema;
|
|
67320
|
-
const
|
|
67321
|
-
const hasNullType = Array.isArray(
|
|
67320
|
+
const type22 = schema.type;
|
|
67321
|
+
const hasNullType = Array.isArray(type22) && type22.includes("null");
|
|
67322
67322
|
let code = "";
|
|
67323
67323
|
if (hasNullType) {
|
|
67324
67324
|
code += `
|
|
@@ -67362,14 +67362,14 @@ ${contextFunctionCode}`,
|
|
|
67362
67362
|
function buildOneOf(context2, location, input) {
|
|
67363
67363
|
context2.validatorSchemasIds.add(location.schemaId);
|
|
67364
67364
|
const schema = location.schema;
|
|
67365
|
-
const
|
|
67366
|
-
const { [
|
|
67365
|
+
const type22 = schema.anyOf ? "anyOf" : "oneOf";
|
|
67366
|
+
const { [type22]: oneOfs, ...schemaWithoutAnyOf } = location.schema;
|
|
67367
67367
|
const locationWithoutOneOf = new Location(
|
|
67368
67368
|
schemaWithoutAnyOf,
|
|
67369
67369
|
location.schemaId,
|
|
67370
67370
|
location.jsonPointer
|
|
67371
67371
|
);
|
|
67372
|
-
const oneOfsLocation = location.getPropertyLocation(
|
|
67372
|
+
const oneOfsLocation = location.getPropertyLocation(type22);
|
|
67373
67373
|
let code = "";
|
|
67374
67374
|
for (let index = 0; index < oneOfs.length; index++) {
|
|
67375
67375
|
const optionLocation = oneOfsLocation.getPropertyLocation(index);
|
|
@@ -67485,7 +67485,7 @@ ${contextFunctionCode}`,
|
|
|
67485
67485
|
}
|
|
67486
67486
|
}
|
|
67487
67487
|
let code = "";
|
|
67488
|
-
const
|
|
67488
|
+
const type22 = schema.type;
|
|
67489
67489
|
const nullable2 = schema.nullable === true;
|
|
67490
67490
|
if (nullable2) {
|
|
67491
67491
|
code += `
|
|
@@ -67496,7 +67496,7 @@ ${contextFunctionCode}`,
|
|
|
67496
67496
|
}
|
|
67497
67497
|
if (schema.const !== void 0) {
|
|
67498
67498
|
code += buildConstSerializer(location, input);
|
|
67499
|
-
} else if (Array.isArray(
|
|
67499
|
+
} else if (Array.isArray(type22)) {
|
|
67500
67500
|
code += buildMultiTypeSerializer(context2, location, input);
|
|
67501
67501
|
} else {
|
|
67502
67502
|
code += buildSingleTypeSerializer(context2, location, input);
|
|
@@ -72155,9 +72155,9 @@ var require_fast_decode_uri_component = __commonJS({
|
|
|
72155
72155
|
var high = hexCodeToInt(uri[percentPosition + 1], 4);
|
|
72156
72156
|
var low = hexCodeToInt(uri[percentPosition + 2], 0);
|
|
72157
72157
|
var byte = high | low;
|
|
72158
|
-
var
|
|
72159
|
-
state = UTF8_DATA[256 + state +
|
|
72160
|
-
codepoint = codepoint << 6 | byte & UTF8_DATA[364 +
|
|
72158
|
+
var type22 = UTF8_DATA[byte];
|
|
72159
|
+
state = UTF8_DATA[256 + state + type22];
|
|
72160
|
+
codepoint = codepoint << 6 | byte & UTF8_DATA[364 + type22];
|
|
72161
72161
|
if (state === UTF8_ACCEPT) {
|
|
72162
72162
|
decoded += uri.slice(last, startOfOctets);
|
|
72163
72163
|
decoded += codepoint <= 65535 ? String.fromCharCode(codepoint) : String.fromCharCode(
|
|
@@ -72498,14 +72498,14 @@ var require_stringify = __commonJS({
|
|
|
72498
72498
|
"use strict";
|
|
72499
72499
|
var { encodeString } = require_querystring();
|
|
72500
72500
|
function getAsPrimitive(value) {
|
|
72501
|
-
const
|
|
72502
|
-
if (
|
|
72501
|
+
const type22 = typeof value;
|
|
72502
|
+
if (type22 === "string") {
|
|
72503
72503
|
return encodeString(value);
|
|
72504
|
-
} else if (
|
|
72504
|
+
} else if (type22 === "bigint") {
|
|
72505
72505
|
return value.toString();
|
|
72506
|
-
} else if (
|
|
72506
|
+
} else if (type22 === "boolean") {
|
|
72507
72507
|
return value ? "true" : "false";
|
|
72508
|
-
} else if (
|
|
72508
|
+
} else if (type22 === "number" && Number.isFinite(value)) {
|
|
72509
72509
|
return value < 1e21 ? "" + value : encodeString("" + value);
|
|
72510
72510
|
}
|
|
72511
72511
|
return "";
|
|
@@ -73343,11 +73343,11 @@ var require_http_method = __commonJS({
|
|
|
73343
73343
|
storage: function() {
|
|
73344
73344
|
const handlers = /* @__PURE__ */ new Map();
|
|
73345
73345
|
return {
|
|
73346
|
-
get: (
|
|
73347
|
-
return handlers.get(
|
|
73346
|
+
get: (type22) => {
|
|
73347
|
+
return handlers.get(type22) || null;
|
|
73348
73348
|
},
|
|
73349
|
-
set: (
|
|
73350
|
-
handlers.set(
|
|
73349
|
+
set: (type22, store) => {
|
|
73350
|
+
handlers.set(type22, store);
|
|
73351
73351
|
}
|
|
73352
73352
|
};
|
|
73353
73353
|
},
|
|
@@ -80130,8 +80130,8 @@ var require_depd = __commonJS({
|
|
|
80130
80130
|
deprecate.property = wrapproperty;
|
|
80131
80131
|
return deprecate;
|
|
80132
80132
|
}
|
|
80133
|
-
function eehaslisteners(emitter,
|
|
80134
|
-
var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(
|
|
80133
|
+
function eehaslisteners(emitter, type22) {
|
|
80134
|
+
var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type22).length : emitter.listenerCount(type22);
|
|
80135
80135
|
return count > 0;
|
|
80136
80136
|
}
|
|
80137
80137
|
function isignored(namespace) {
|
|
@@ -80611,18 +80611,18 @@ var require_http_errors = __commonJS({
|
|
|
80611
80611
|
var props = {};
|
|
80612
80612
|
for (var i2 = 0; i2 < arguments.length; i2++) {
|
|
80613
80613
|
var arg = arguments[i2];
|
|
80614
|
-
var
|
|
80615
|
-
if (
|
|
80614
|
+
var type22 = typeof arg;
|
|
80615
|
+
if (type22 === "object" && arg instanceof Error) {
|
|
80616
80616
|
err = arg;
|
|
80617
80617
|
status = err.status || err.statusCode || status;
|
|
80618
|
-
} else if (
|
|
80618
|
+
} else if (type22 === "number" && i2 === 0) {
|
|
80619
80619
|
status = arg;
|
|
80620
|
-
} else if (
|
|
80620
|
+
} else if (type22 === "string") {
|
|
80621
80621
|
msg = arg;
|
|
80622
|
-
} else if (
|
|
80622
|
+
} else if (type22 === "object") {
|
|
80623
80623
|
props = arg;
|
|
80624
80624
|
} else {
|
|
80625
|
-
throw new TypeError("argument #" + (i2 + 1) + " unsupported type " +
|
|
80625
|
+
throw new TypeError("argument #" + (i2 + 1) + " unsupported type " + type22);
|
|
80626
80626
|
}
|
|
80627
80627
|
}
|
|
80628
80628
|
if (typeof status === "number" && (status < 400 || status >= 600)) {
|
|
@@ -84779,11 +84779,11 @@ var require_content_type = __commonJS({
|
|
|
84779
84779
|
throw new TypeError("argument obj is required");
|
|
84780
84780
|
}
|
|
84781
84781
|
var parameters = obj.parameters;
|
|
84782
|
-
var
|
|
84783
|
-
if (!
|
|
84782
|
+
var type22 = obj.type;
|
|
84783
|
+
if (!type22 || !TYPE_REGEXP.test(type22)) {
|
|
84784
84784
|
throw new TypeError("invalid type");
|
|
84785
84785
|
}
|
|
84786
|
-
var string4 =
|
|
84786
|
+
var string4 = type22;
|
|
84787
84787
|
if (parameters && typeof parameters === "object") {
|
|
84788
84788
|
var param;
|
|
84789
84789
|
var params = Object.keys(parameters).sort();
|
|
@@ -84806,11 +84806,11 @@ var require_content_type = __commonJS({
|
|
|
84806
84806
|
throw new TypeError("argument string is required to be a string");
|
|
84807
84807
|
}
|
|
84808
84808
|
var index = header.indexOf(";");
|
|
84809
|
-
var
|
|
84810
|
-
if (!TYPE_REGEXP.test(
|
|
84809
|
+
var type22 = index !== -1 ? header.slice(0, index).trim() : header.trim();
|
|
84810
|
+
if (!TYPE_REGEXP.test(type22)) {
|
|
84811
84811
|
throw new TypeError("invalid media type");
|
|
84812
84812
|
}
|
|
84813
|
-
var obj = new ContentType(
|
|
84813
|
+
var obj = new ContentType(type22.toLowerCase());
|
|
84814
84814
|
if (index !== -1) {
|
|
84815
84815
|
var key;
|
|
84816
84816
|
var match;
|
|
@@ -84859,9 +84859,9 @@ var require_content_type = __commonJS({
|
|
|
84859
84859
|
}
|
|
84860
84860
|
return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
|
|
84861
84861
|
}
|
|
84862
|
-
function ContentType(
|
|
84862
|
+
function ContentType(type22) {
|
|
84863
84863
|
this.parameters = /* @__PURE__ */ Object.create(null);
|
|
84864
|
-
this.type =
|
|
84864
|
+
this.type = type22;
|
|
84865
84865
|
}
|
|
84866
84866
|
}
|
|
84867
84867
|
});
|
|
@@ -101695,9 +101695,9 @@ function convertBaseSchema(schema, ctx) {
|
|
|
101695
101695
|
if (schema.const !== void 0) {
|
|
101696
101696
|
return z3.literal(schema.const);
|
|
101697
101697
|
}
|
|
101698
|
-
const
|
|
101699
|
-
if (Array.isArray(
|
|
101700
|
-
const typeSchemas =
|
|
101698
|
+
const type22 = schema.type;
|
|
101699
|
+
if (Array.isArray(type22)) {
|
|
101700
|
+
const typeSchemas = type22.map((t4) => {
|
|
101701
101701
|
const typeSchema = { ...schema, type: t4 };
|
|
101702
101702
|
return convertBaseSchema(typeSchema, ctx);
|
|
101703
101703
|
});
|
|
@@ -101709,11 +101709,11 @@ function convertBaseSchema(schema, ctx) {
|
|
|
101709
101709
|
}
|
|
101710
101710
|
return z3.union(typeSchemas);
|
|
101711
101711
|
}
|
|
101712
|
-
if (!
|
|
101712
|
+
if (!type22) {
|
|
101713
101713
|
return z3.any();
|
|
101714
101714
|
}
|
|
101715
101715
|
let zodSchema2;
|
|
101716
|
-
switch (
|
|
101716
|
+
switch (type22) {
|
|
101717
101717
|
case "string": {
|
|
101718
101718
|
let stringSchema = z3.string();
|
|
101719
101719
|
if (schema.format) {
|
|
@@ -101780,7 +101780,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
101780
101780
|
}
|
|
101781
101781
|
case "number":
|
|
101782
101782
|
case "integer": {
|
|
101783
|
-
let numberSchema =
|
|
101783
|
+
let numberSchema = type22 === "integer" ? z3.number().int() : z3.number();
|
|
101784
101784
|
if (typeof schema.minimum === "number") {
|
|
101785
101785
|
numberSchema = numberSchema.min(schema.minimum);
|
|
101786
101786
|
}
|
|
@@ -101915,7 +101915,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
101915
101915
|
break;
|
|
101916
101916
|
}
|
|
101917
101917
|
default:
|
|
101918
|
-
throw new Error(`Unsupported type: ${
|
|
101918
|
+
throw new Error(`Unsupported type: ${type22}`);
|
|
101919
101919
|
}
|
|
101920
101920
|
if (schema.description) {
|
|
101921
101921
|
zodSchema2 = zodSchema2.describe(schema.description);
|
|
@@ -104704,33 +104704,33 @@ ZodUnion2.create = (types, params) => {
|
|
|
104704
104704
|
...processCreateParams(params)
|
|
104705
104705
|
});
|
|
104706
104706
|
};
|
|
104707
|
-
var getDiscriminator = (
|
|
104708
|
-
if (
|
|
104709
|
-
return getDiscriminator(
|
|
104710
|
-
} else if (
|
|
104711
|
-
return getDiscriminator(
|
|
104712
|
-
} else if (
|
|
104713
|
-
return [
|
|
104714
|
-
} else if (
|
|
104715
|
-
return
|
|
104716
|
-
} else if (
|
|
104717
|
-
return util.objectValues(
|
|
104718
|
-
} else if (
|
|
104719
|
-
return getDiscriminator(
|
|
104720
|
-
} else if (
|
|
104707
|
+
var getDiscriminator = (type22) => {
|
|
104708
|
+
if (type22 instanceof ZodLazy2) {
|
|
104709
|
+
return getDiscriminator(type22.schema);
|
|
104710
|
+
} else if (type22 instanceof ZodEffects) {
|
|
104711
|
+
return getDiscriminator(type22.innerType());
|
|
104712
|
+
} else if (type22 instanceof ZodLiteral2) {
|
|
104713
|
+
return [type22.value];
|
|
104714
|
+
} else if (type22 instanceof ZodEnum2) {
|
|
104715
|
+
return type22.options;
|
|
104716
|
+
} else if (type22 instanceof ZodNativeEnum) {
|
|
104717
|
+
return util.objectValues(type22.enum);
|
|
104718
|
+
} else if (type22 instanceof ZodDefault2) {
|
|
104719
|
+
return getDiscriminator(type22._def.innerType);
|
|
104720
|
+
} else if (type22 instanceof ZodUndefined2) {
|
|
104721
104721
|
return [void 0];
|
|
104722
|
-
} else if (
|
|
104722
|
+
} else if (type22 instanceof ZodNull2) {
|
|
104723
104723
|
return [null];
|
|
104724
|
-
} else if (
|
|
104725
|
-
return [void 0, ...getDiscriminator(
|
|
104726
|
-
} else if (
|
|
104727
|
-
return [null, ...getDiscriminator(
|
|
104728
|
-
} else if (
|
|
104729
|
-
return getDiscriminator(
|
|
104730
|
-
} else if (
|
|
104731
|
-
return getDiscriminator(
|
|
104732
|
-
} else if (
|
|
104733
|
-
return getDiscriminator(
|
|
104724
|
+
} else if (type22 instanceof ZodOptional2) {
|
|
104725
|
+
return [void 0, ...getDiscriminator(type22.unwrap())];
|
|
104726
|
+
} else if (type22 instanceof ZodNullable2) {
|
|
104727
|
+
return [null, ...getDiscriminator(type22.unwrap())];
|
|
104728
|
+
} else if (type22 instanceof ZodBranded) {
|
|
104729
|
+
return getDiscriminator(type22.unwrap());
|
|
104730
|
+
} else if (type22 instanceof ZodReadonly2) {
|
|
104731
|
+
return getDiscriminator(type22.unwrap());
|
|
104732
|
+
} else if (type22 instanceof ZodCatch2) {
|
|
104733
|
+
return getDiscriminator(type22._def.innerType);
|
|
104734
104734
|
} else {
|
|
104735
104735
|
return [];
|
|
104736
104736
|
}
|
|
@@ -104790,8 +104790,8 @@ var ZodDiscriminatedUnion2 = class _ZodDiscriminatedUnion extends ZodType2 {
|
|
|
104790
104790
|
*/
|
|
104791
104791
|
static create(discriminator, options, params) {
|
|
104792
104792
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
104793
|
-
for (const
|
|
104794
|
-
const discriminatorValues = getDiscriminator(
|
|
104793
|
+
for (const type22 of options) {
|
|
104794
|
+
const discriminatorValues = getDiscriminator(type22.shape[discriminator]);
|
|
104795
104795
|
if (!discriminatorValues.length) {
|
|
104796
104796
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
104797
104797
|
}
|
|
@@ -104799,7 +104799,7 @@ var ZodDiscriminatedUnion2 = class _ZodDiscriminatedUnion extends ZodType2 {
|
|
|
104799
104799
|
if (optionsMap.has(value)) {
|
|
104800
104800
|
throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
|
|
104801
104801
|
}
|
|
104802
|
-
optionsMap.set(value,
|
|
104802
|
+
optionsMap.set(value, type22);
|
|
104803
104803
|
}
|
|
104804
104804
|
}
|
|
104805
104805
|
return new _ZodDiscriminatedUnion({
|
|
@@ -105610,9 +105610,9 @@ var ZodOptional2 = class extends ZodType2 {
|
|
|
105610
105610
|
return this._def.innerType;
|
|
105611
105611
|
}
|
|
105612
105612
|
};
|
|
105613
|
-
ZodOptional2.create = (
|
|
105613
|
+
ZodOptional2.create = (type22, params) => {
|
|
105614
105614
|
return new ZodOptional2({
|
|
105615
|
-
innerType:
|
|
105615
|
+
innerType: type22,
|
|
105616
105616
|
typeName: ZodFirstPartyTypeKind2.ZodOptional,
|
|
105617
105617
|
...processCreateParams(params)
|
|
105618
105618
|
});
|
|
@@ -105629,9 +105629,9 @@ var ZodNullable2 = class extends ZodType2 {
|
|
|
105629
105629
|
return this._def.innerType;
|
|
105630
105630
|
}
|
|
105631
105631
|
};
|
|
105632
|
-
ZodNullable2.create = (
|
|
105632
|
+
ZodNullable2.create = (type22, params) => {
|
|
105633
105633
|
return new ZodNullable2({
|
|
105634
|
-
innerType:
|
|
105634
|
+
innerType: type22,
|
|
105635
105635
|
typeName: ZodFirstPartyTypeKind2.ZodNullable,
|
|
105636
105636
|
...processCreateParams(params)
|
|
105637
105637
|
});
|
|
@@ -105653,9 +105653,9 @@ var ZodDefault2 = class extends ZodType2 {
|
|
|
105653
105653
|
return this._def.innerType;
|
|
105654
105654
|
}
|
|
105655
105655
|
};
|
|
105656
|
-
ZodDefault2.create = (
|
|
105656
|
+
ZodDefault2.create = (type22, params) => {
|
|
105657
105657
|
return new ZodDefault2({
|
|
105658
|
-
innerType:
|
|
105658
|
+
innerType: type22,
|
|
105659
105659
|
typeName: ZodFirstPartyTypeKind2.ZodDefault,
|
|
105660
105660
|
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
105661
105661
|
...processCreateParams(params)
|
|
@@ -105706,9 +105706,9 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
105706
105706
|
return this._def.innerType;
|
|
105707
105707
|
}
|
|
105708
105708
|
};
|
|
105709
|
-
ZodCatch2.create = (
|
|
105709
|
+
ZodCatch2.create = (type22, params) => {
|
|
105710
105710
|
return new ZodCatch2({
|
|
105711
|
-
innerType:
|
|
105711
|
+
innerType: type22,
|
|
105712
105712
|
typeName: ZodFirstPartyTypeKind2.ZodCatch,
|
|
105713
105713
|
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
105714
105714
|
...processCreateParams(params)
|
|
@@ -105819,9 +105819,9 @@ var ZodReadonly2 = class extends ZodType2 {
|
|
|
105819
105819
|
return this._def.innerType;
|
|
105820
105820
|
}
|
|
105821
105821
|
};
|
|
105822
|
-
ZodReadonly2.create = (
|
|
105822
|
+
ZodReadonly2.create = (type22, params) => {
|
|
105823
105823
|
return new ZodReadonly2({
|
|
105824
|
-
innerType:
|
|
105824
|
+
innerType: type22,
|
|
105825
105825
|
typeName: ZodFirstPartyTypeKind2.ZodReadonly,
|
|
105826
105826
|
...processCreateParams(params)
|
|
105827
105827
|
});
|
|
@@ -106832,9 +106832,9 @@ function parseEnumDef(def) {
|
|
|
106832
106832
|
enum: Array.from(def.values)
|
|
106833
106833
|
};
|
|
106834
106834
|
}
|
|
106835
|
-
var isJsonSchema7AllOfType = (
|
|
106836
|
-
if ("type" in
|
|
106837
|
-
return "allOf" in
|
|
106835
|
+
var isJsonSchema7AllOfType = (type22) => {
|
|
106836
|
+
if ("type" in type22 && type22.type === "string") return false;
|
|
106837
|
+
return "allOf" in type22;
|
|
106838
106838
|
};
|
|
106839
106839
|
function parseIntersectionDef(def, refs) {
|
|
106840
106840
|
const allOf = [
|
|
@@ -107218,7 +107218,7 @@ function parseRecordDef(def, refs) {
|
|
|
107218
107218
|
})) != null ? _a210 : refs.allowedAdditionalProperties
|
|
107219
107219
|
};
|
|
107220
107220
|
if (((_b210 = def.keyType) == null ? void 0 : _b210._def.typeName) === ZodFirstPartyTypeKind2.ZodString && ((_c10 = def.keyType._def.checks) == null ? void 0 : _c10.length)) {
|
|
107221
|
-
const { type:
|
|
107221
|
+
const { type: type22, ...keyType } = parseStringDef(def.keyType._def, refs);
|
|
107222
107222
|
return {
|
|
107223
107223
|
...schema,
|
|
107224
107224
|
propertyNames: keyType
|
|
@@ -107231,7 +107231,7 @@ function parseRecordDef(def, refs) {
|
|
|
107231
107231
|
}
|
|
107232
107232
|
};
|
|
107233
107233
|
} else if (((_e7 = def.keyType) == null ? void 0 : _e7._def.typeName) === ZodFirstPartyTypeKind2.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind2.ZodString && ((_f2 = def.keyType._def.type._def.checks) == null ? void 0 : _f2.length)) {
|
|
107234
|
-
const { type:
|
|
107234
|
+
const { type: type22, ...keyType } = parseBrandedDef(
|
|
107235
107235
|
def.keyType._def,
|
|
107236
107236
|
refs
|
|
107237
107237
|
);
|
|
@@ -107300,8 +107300,8 @@ function parseUnionDef(def, refs) {
|
|
|
107300
107300
|
(x3) => x3._def.typeName in primitiveMappings && (!x3._def.checks || !x3._def.checks.length)
|
|
107301
107301
|
)) {
|
|
107302
107302
|
const types = options.reduce((types2, x3) => {
|
|
107303
|
-
const
|
|
107304
|
-
return
|
|
107303
|
+
const type22 = primitiveMappings[x3._def.typeName];
|
|
107304
|
+
return type22 && !types2.includes(type22) ? [...types2, type22] : types2;
|
|
107305
107305
|
}, []);
|
|
107306
107306
|
return {
|
|
107307
107307
|
type: types.length > 1 ? types : types[0]
|
|
@@ -107309,12 +107309,12 @@ function parseUnionDef(def, refs) {
|
|
|
107309
107309
|
} else if (options.every((x3) => x3._def.typeName === "ZodLiteral" && !x3.description)) {
|
|
107310
107310
|
const types = options.reduce(
|
|
107311
107311
|
(acc, x3) => {
|
|
107312
|
-
const
|
|
107313
|
-
switch (
|
|
107312
|
+
const type22 = typeof x3._def.value;
|
|
107313
|
+
switch (type22) {
|
|
107314
107314
|
case "string":
|
|
107315
107315
|
case "number":
|
|
107316
107316
|
case "boolean":
|
|
107317
|
-
return [...acc,
|
|
107317
|
+
return [...acc, type22];
|
|
107318
107318
|
case "bigint":
|
|
107319
107319
|
return [...acc, "integer"];
|
|
107320
107320
|
case "object":
|
|
@@ -108796,8 +108796,8 @@ function extractResourceMetadataUrl(response) {
|
|
|
108796
108796
|
if (!header) {
|
|
108797
108797
|
return void 0;
|
|
108798
108798
|
}
|
|
108799
|
-
const [
|
|
108800
|
-
if (
|
|
108799
|
+
const [type22, scheme] = header.split(" ");
|
|
108800
|
+
if (type22.toLowerCase() !== "bearer" || !scheme) {
|
|
108801
108801
|
return void 0;
|
|
108802
108802
|
}
|
|
108803
108803
|
const regex = /resource_metadata="([^"]*)"/;
|
|
@@ -108928,7 +108928,7 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, {
|
|
|
108928
108928
|
var _a310;
|
|
108929
108929
|
const headers = { "MCP-Protocol-Version": protocolVersion };
|
|
108930
108930
|
const urlsToTry = buildDiscoveryUrls(authorizationServerUrl);
|
|
108931
|
-
for (const { url: endpointUrl, type:
|
|
108931
|
+
for (const { url: endpointUrl, type: type22 } of urlsToTry) {
|
|
108932
108932
|
const response = await fetchWithCorsRetry(endpointUrl, headers, fetchFn);
|
|
108933
108933
|
if (!response) {
|
|
108934
108934
|
continue;
|
|
@@ -108938,10 +108938,10 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, {
|
|
|
108938
108938
|
continue;
|
|
108939
108939
|
}
|
|
108940
108940
|
throw new Error(
|
|
108941
|
-
`HTTP ${response.status} trying to load ${
|
|
108941
|
+
`HTTP ${response.status} trying to load ${type22 === "oauth" ? "OAuth" : "OpenID provider"} metadata from ${endpointUrl}`
|
|
108942
108942
|
);
|
|
108943
108943
|
}
|
|
108944
|
-
if (
|
|
108944
|
+
if (type22 === "oauth") {
|
|
108945
108945
|
return OAuthMetadataSchema.parse(await response.json());
|
|
108946
108946
|
} else {
|
|
108947
108947
|
const metadata = OpenIdProviderDiscoveryMetadataSchema.parse(
|
|
@@ -112822,7 +112822,7 @@ var isCompatible = _makeCompatibilityCheck(VERSION4);
|
|
|
112822
112822
|
var major = VERSION4.split(".")[0];
|
|
112823
112823
|
var GLOBAL_OPENTELEMETRY_API_KEY = /* @__PURE__ */ Symbol.for("opentelemetry.js.api." + major);
|
|
112824
112824
|
var _global = _globalThis;
|
|
112825
|
-
function registerGlobal(
|
|
112825
|
+
function registerGlobal(type22, instance, diag, allowOverride) {
|
|
112826
112826
|
var _a47;
|
|
112827
112827
|
if (allowOverride === void 0) {
|
|
112828
112828
|
allowOverride = false;
|
|
@@ -112830,33 +112830,33 @@ function registerGlobal(type21, instance, diag, allowOverride) {
|
|
|
112830
112830
|
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a47 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a47 !== void 0 ? _a47 : {
|
|
112831
112831
|
version: VERSION4
|
|
112832
112832
|
};
|
|
112833
|
-
if (!allowOverride && api[
|
|
112834
|
-
var err = new Error("@opentelemetry/api: Attempted duplicate registration of API: " +
|
|
112833
|
+
if (!allowOverride && api[type22]) {
|
|
112834
|
+
var err = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + type22);
|
|
112835
112835
|
diag.error(err.stack || err.message);
|
|
112836
112836
|
return false;
|
|
112837
112837
|
}
|
|
112838
112838
|
if (api.version !== VERSION4) {
|
|
112839
|
-
var err = new Error("@opentelemetry/api: Registration of version v" + api.version + " for " +
|
|
112839
|
+
var err = new Error("@opentelemetry/api: Registration of version v" + api.version + " for " + type22 + " does not match previously registered API v" + VERSION4);
|
|
112840
112840
|
diag.error(err.stack || err.message);
|
|
112841
112841
|
return false;
|
|
112842
112842
|
}
|
|
112843
|
-
api[
|
|
112844
|
-
diag.debug("@opentelemetry/api: Registered a global for " +
|
|
112843
|
+
api[type22] = instance;
|
|
112844
|
+
diag.debug("@opentelemetry/api: Registered a global for " + type22 + " v" + VERSION4 + ".");
|
|
112845
112845
|
return true;
|
|
112846
112846
|
}
|
|
112847
|
-
function getGlobal(
|
|
112847
|
+
function getGlobal(type22) {
|
|
112848
112848
|
var _a47, _b36;
|
|
112849
112849
|
var globalVersion = (_a47 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a47 === void 0 ? void 0 : _a47.version;
|
|
112850
112850
|
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
112851
112851
|
return;
|
|
112852
112852
|
}
|
|
112853
|
-
return (_b36 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b36 === void 0 ? void 0 : _b36[
|
|
112853
|
+
return (_b36 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b36 === void 0 ? void 0 : _b36[type22];
|
|
112854
112854
|
}
|
|
112855
|
-
function unregisterGlobal(
|
|
112856
|
-
diag.debug("@opentelemetry/api: Unregistering a global for " +
|
|
112855
|
+
function unregisterGlobal(type22, diag) {
|
|
112856
|
+
diag.debug("@opentelemetry/api: Unregistering a global for " + type22 + " v" + VERSION4 + ".");
|
|
112857
112857
|
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
|
112858
112858
|
if (api) {
|
|
112859
|
-
delete api[
|
|
112859
|
+
delete api[type22];
|
|
112860
112860
|
}
|
|
112861
112861
|
}
|
|
112862
112862
|
|
|
@@ -114497,8 +114497,8 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
|
114497
114497
|
};
|
|
114498
114498
|
}
|
|
114499
114499
|
let originalData;
|
|
114500
|
-
const
|
|
114501
|
-
switch (
|
|
114500
|
+
const type22 = part.type;
|
|
114501
|
+
switch (type22) {
|
|
114502
114502
|
case "image":
|
|
114503
114503
|
originalData = part.image;
|
|
114504
114504
|
break;
|
|
@@ -114506,7 +114506,7 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
|
114506
114506
|
originalData = part.data;
|
|
114507
114507
|
break;
|
|
114508
114508
|
default:
|
|
114509
|
-
throw new Error(`Unsupported part type: ${
|
|
114509
|
+
throw new Error(`Unsupported part type: ${type22}`);
|
|
114510
114510
|
}
|
|
114511
114511
|
const { data: convertedData, mediaType: convertedMediaType } = convertToLanguageModelV3DataContent(originalData);
|
|
114512
114512
|
let mediaType = convertedMediaType != null ? convertedMediaType : part.mediaType;
|
|
@@ -114518,7 +114518,7 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
|
114518
114518
|
mediaType != null ? mediaType : mediaType = downloadedFile.mediaType;
|
|
114519
114519
|
}
|
|
114520
114520
|
}
|
|
114521
|
-
switch (
|
|
114521
|
+
switch (type22) {
|
|
114522
114522
|
case "image": {
|
|
114523
114523
|
if (data instanceof Uint8Array || typeof data === "string") {
|
|
114524
114524
|
mediaType = (_a212 = detectMediaType({ data, signatures: imageMediaTypeSignatures })) != null ? _a212 : mediaType;
|
|
@@ -121470,12 +121470,12 @@ function prepareChatTools({
|
|
|
121470
121470
|
if (toolChoice == null) {
|
|
121471
121471
|
return { tools: openaiTools2, toolChoice: void 0, toolWarnings };
|
|
121472
121472
|
}
|
|
121473
|
-
const
|
|
121474
|
-
switch (
|
|
121473
|
+
const type22 = toolChoice.type;
|
|
121474
|
+
switch (type22) {
|
|
121475
121475
|
case "auto":
|
|
121476
121476
|
case "none":
|
|
121477
121477
|
case "required":
|
|
121478
|
-
return { tools: openaiTools2, toolChoice:
|
|
121478
|
+
return { tools: openaiTools2, toolChoice: type22, toolWarnings };
|
|
121479
121479
|
case "tool":
|
|
121480
121480
|
return {
|
|
121481
121481
|
tools: openaiTools2,
|
|
@@ -121488,7 +121488,7 @@ function prepareChatTools({
|
|
|
121488
121488
|
toolWarnings
|
|
121489
121489
|
};
|
|
121490
121490
|
default: {
|
|
121491
|
-
const _exhaustiveCheck =
|
|
121491
|
+
const _exhaustiveCheck = type22;
|
|
121492
121492
|
throw new UnsupportedFunctionalityError({
|
|
121493
121493
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
121494
121494
|
});
|
|
@@ -125045,12 +125045,12 @@ async function prepareResponsesTools({
|
|
|
125045
125045
|
if (toolChoice == null) {
|
|
125046
125046
|
return { tools: openaiTools2, toolChoice: void 0, toolWarnings };
|
|
125047
125047
|
}
|
|
125048
|
-
const
|
|
125049
|
-
switch (
|
|
125048
|
+
const type22 = toolChoice.type;
|
|
125049
|
+
switch (type22) {
|
|
125050
125050
|
case "auto":
|
|
125051
125051
|
case "none":
|
|
125052
125052
|
case "required":
|
|
125053
|
-
return { tools: openaiTools2, toolChoice:
|
|
125053
|
+
return { tools: openaiTools2, toolChoice: type22, toolWarnings };
|
|
125054
125054
|
case "tool": {
|
|
125055
125055
|
const resolvedToolName = (_a47 = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _a47 : toolChoice.toolName;
|
|
125056
125056
|
return {
|
|
@@ -125060,7 +125060,7 @@ async function prepareResponsesTools({
|
|
|
125060
125060
|
};
|
|
125061
125061
|
}
|
|
125062
125062
|
default: {
|
|
125063
|
-
const _exhaustiveCheck =
|
|
125063
|
+
const _exhaustiveCheck = type22;
|
|
125064
125064
|
throw new UnsupportedFunctionalityError({
|
|
125065
125065
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
125066
125066
|
});
|
|
@@ -128405,8 +128405,8 @@ async function prepareTools({
|
|
|
128405
128405
|
betas
|
|
128406
128406
|
};
|
|
128407
128407
|
}
|
|
128408
|
-
const
|
|
128409
|
-
switch (
|
|
128408
|
+
const type22 = toolChoice.type;
|
|
128409
|
+
switch (type22) {
|
|
128410
128410
|
case "auto":
|
|
128411
128411
|
return {
|
|
128412
128412
|
tools: anthropicTools2,
|
|
@@ -128441,7 +128441,7 @@ async function prepareTools({
|
|
|
128441
128441
|
betas
|
|
128442
128442
|
};
|
|
128443
128443
|
default: {
|
|
128444
|
-
const _exhaustiveCheck =
|
|
128444
|
+
const _exhaustiveCheck = type22;
|
|
128445
128445
|
throw new UnsupportedFunctionalityError({
|
|
128446
128446
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
128447
128447
|
});
|
|
@@ -128723,8 +128723,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
128723
128723
|
for (let i2 = 0; i2 < blocks.length; i2++) {
|
|
128724
128724
|
const block = blocks[i2];
|
|
128725
128725
|
const isLastBlock = i2 === blocks.length - 1;
|
|
128726
|
-
const
|
|
128727
|
-
switch (
|
|
128726
|
+
const type22 = block.type;
|
|
128727
|
+
switch (type22) {
|
|
128728
128728
|
case "system": {
|
|
128729
128729
|
if (system != null) {
|
|
128730
128730
|
throw new UnsupportedFunctionalityError({
|
|
@@ -129396,7 +129396,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
129396
129396
|
break;
|
|
129397
129397
|
}
|
|
129398
129398
|
default: {
|
|
129399
|
-
const _exhaustiveCheck =
|
|
129399
|
+
const _exhaustiveCheck = type22;
|
|
129400
129400
|
throw new Error(`content type: ${_exhaustiveCheck}`);
|
|
129401
129401
|
}
|
|
129402
129402
|
}
|
|
@@ -132004,7 +132004,7 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema2, isRoot = true) {
|
|
|
132004
132004
|
return { type: "boolean", properties: {} };
|
|
132005
132005
|
}
|
|
132006
132006
|
const {
|
|
132007
|
-
type:
|
|
132007
|
+
type: type22,
|
|
132008
132008
|
description,
|
|
132009
132009
|
required: required2,
|
|
132010
132010
|
properties,
|
|
@@ -132024,10 +132024,10 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema2, isRoot = true) {
|
|
|
132024
132024
|
if (constValue !== void 0) {
|
|
132025
132025
|
result.enum = [constValue];
|
|
132026
132026
|
}
|
|
132027
|
-
if (
|
|
132028
|
-
if (Array.isArray(
|
|
132029
|
-
const hasNull =
|
|
132030
|
-
const nonNullTypes =
|
|
132027
|
+
if (type22) {
|
|
132028
|
+
if (Array.isArray(type22)) {
|
|
132029
|
+
const hasNull = type22.includes("null");
|
|
132030
|
+
const nonNullTypes = type22.filter((t4) => t4 !== "null");
|
|
132031
132031
|
if (nonNullTypes.length === 0) {
|
|
132032
132032
|
result.type = "null";
|
|
132033
132033
|
} else {
|
|
@@ -132037,7 +132037,7 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema2, isRoot = true) {
|
|
|
132037
132037
|
}
|
|
132038
132038
|
}
|
|
132039
132039
|
} else {
|
|
132040
|
-
result.type =
|
|
132040
|
+
result.type = type22;
|
|
132041
132041
|
}
|
|
132042
132042
|
}
|
|
132043
132043
|
if (enumValues !== void 0) {
|
|
@@ -132552,8 +132552,8 @@ function prepareTools2({
|
|
|
132552
132552
|
toolWarnings
|
|
132553
132553
|
};
|
|
132554
132554
|
}
|
|
132555
|
-
const
|
|
132556
|
-
switch (
|
|
132555
|
+
const type22 = toolChoice.type;
|
|
132556
|
+
switch (type22) {
|
|
132557
132557
|
case "auto":
|
|
132558
132558
|
return {
|
|
132559
132559
|
tools: [{ functionDeclarations }],
|
|
@@ -132584,7 +132584,7 @@ function prepareTools2({
|
|
|
132584
132584
|
toolWarnings
|
|
132585
132585
|
};
|
|
132586
132586
|
default: {
|
|
132587
|
-
const _exhaustiveCheck =
|
|
132587
|
+
const _exhaustiveCheck = type22;
|
|
132588
132588
|
throw new UnsupportedFunctionalityError({
|
|
132589
132589
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
132590
132590
|
});
|
|
@@ -134983,12 +134983,12 @@ function prepareResponsesTools2({
|
|
|
134983
134983
|
if (toolChoice == null) {
|
|
134984
134984
|
return { tools: ollamaTools, toolChoice: void 0, toolWarnings };
|
|
134985
134985
|
}
|
|
134986
|
-
const
|
|
134987
|
-
switch (
|
|
134986
|
+
const type22 = toolChoice.type;
|
|
134987
|
+
switch (type22) {
|
|
134988
134988
|
case "auto":
|
|
134989
134989
|
case "none":
|
|
134990
134990
|
case "required":
|
|
134991
|
-
return { tools: ollamaTools, toolChoice:
|
|
134991
|
+
return { tools: ollamaTools, toolChoice: type22, toolWarnings };
|
|
134992
134992
|
case "tool":
|
|
134993
134993
|
return {
|
|
134994
134994
|
tools: ollamaTools,
|
|
@@ -134996,7 +134996,7 @@ function prepareResponsesTools2({
|
|
|
134996
134996
|
toolWarnings
|
|
134997
134997
|
};
|
|
134998
134998
|
default: {
|
|
134999
|
-
const _exhaustiveCheck =
|
|
134999
|
+
const _exhaustiveCheck = type22;
|
|
135000
135000
|
throw new UnsupportedFunctionalityError({
|
|
135001
135001
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
135002
135002
|
});
|
|
@@ -135646,12 +135646,12 @@ function prepareTools3({
|
|
|
135646
135646
|
if (toolChoice == null) {
|
|
135647
135647
|
return { tools: openaiCompatTools, toolChoice: void 0, toolWarnings };
|
|
135648
135648
|
}
|
|
135649
|
-
const
|
|
135650
|
-
switch (
|
|
135649
|
+
const type22 = toolChoice.type;
|
|
135650
|
+
switch (type22) {
|
|
135651
135651
|
case "auto":
|
|
135652
135652
|
case "none":
|
|
135653
135653
|
case "required":
|
|
135654
|
-
return { tools: openaiCompatTools, toolChoice:
|
|
135654
|
+
return { tools: openaiCompatTools, toolChoice: type22, toolWarnings };
|
|
135655
135655
|
case "tool":
|
|
135656
135656
|
return {
|
|
135657
135657
|
tools: openaiCompatTools,
|
|
@@ -135662,7 +135662,7 @@ function prepareTools3({
|
|
|
135662
135662
|
toolWarnings
|
|
135663
135663
|
};
|
|
135664
135664
|
default: {
|
|
135665
|
-
const _exhaustiveCheck =
|
|
135665
|
+
const _exhaustiveCheck = type22;
|
|
135666
135666
|
throw new UnsupportedFunctionalityError({
|
|
135667
135667
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
135668
135668
|
});
|
|
@@ -138145,13 +138145,13 @@ var UserListToolsPublish = class extends NatsPublish {
|
|
|
138145
138145
|
this.type = type10;
|
|
138146
138146
|
}
|
|
138147
138147
|
validate(data) {
|
|
138148
|
-
return data.userId
|
|
138148
|
+
return !!data.userId && !!data.workspaceId && data.mcpTools !== void 0;
|
|
138149
138149
|
}
|
|
138150
138150
|
getSubject() {
|
|
138151
|
-
return `${this.data.userId}.${type10}`;
|
|
138151
|
+
return `${this.data.userId}.${this.data.workspaceId}.${type10}`;
|
|
138152
138152
|
}
|
|
138153
|
-
static subscribeToUser(userId) {
|
|
138154
|
-
return `${userId}.${type10}`;
|
|
138153
|
+
static subscribeToUser(userId, workspaceId) {
|
|
138154
|
+
return `${userId}.${workspaceId}.${type10}`;
|
|
138155
138155
|
}
|
|
138156
138156
|
};
|
|
138157
138157
|
NatsMessage.register(UserListToolsPublish);
|
|
@@ -138365,6 +138365,30 @@ var DelegateAIConfigResponse = class extends NatsResponse {
|
|
|
138365
138365
|
};
|
|
138366
138366
|
NatsMessage.register(DelegateAIConfigResponse);
|
|
138367
138367
|
|
|
138368
|
+
// ../common/src/messages/workspace.tool-catalog.publish.ts
|
|
138369
|
+
var type21 = "workspace-tool-catalog";
|
|
138370
|
+
var WorkspaceToolCatalogPublish = class extends NatsPublish {
|
|
138371
|
+
constructor() {
|
|
138372
|
+
super(...arguments);
|
|
138373
|
+
this.type = type21;
|
|
138374
|
+
}
|
|
138375
|
+
static {
|
|
138376
|
+
this.type = type21;
|
|
138377
|
+
}
|
|
138378
|
+
validate(data) {
|
|
138379
|
+
return typeof data.workspaceId === "string" && data.workspaceId.length > 0 && Array.isArray(data.entries) && data.entries.every(
|
|
138380
|
+
(e2) => typeof e2.toolId === "string" && e2.toolId.length > 0 && typeof e2.toolName === "string" && e2.toolName.length > 0 && typeof e2.runtimeId === "string" && e2.runtimeId.length > 0 && typeof e2.mcpServerId === "string" && e2.mcpServerId.length > 0
|
|
138381
|
+
);
|
|
138382
|
+
}
|
|
138383
|
+
getSubject() {
|
|
138384
|
+
return `${this.data.workspaceId}.${type21}`;
|
|
138385
|
+
}
|
|
138386
|
+
static subscribeToWorkspace(workspaceId) {
|
|
138387
|
+
return `${workspaceId}.${type21}`;
|
|
138388
|
+
}
|
|
138389
|
+
};
|
|
138390
|
+
NatsMessage.register(WorkspaceToolCatalogPublish);
|
|
138391
|
+
|
|
138368
138392
|
// ../common/src/graphql/dgraph.resolvers.types.ts
|
|
138369
138393
|
var dgraph_resolvers_types_exports = {};
|
|
138370
138394
|
__export(dgraph_resolvers_types_exports, {
|
|
@@ -140904,10 +140928,10 @@ function parseEnumDef2(def) {
|
|
|
140904
140928
|
}
|
|
140905
140929
|
|
|
140906
140930
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
140907
|
-
var isJsonSchema7AllOfType2 = (
|
|
140908
|
-
if ("type" in
|
|
140931
|
+
var isJsonSchema7AllOfType2 = (type22) => {
|
|
140932
|
+
if ("type" in type22 && type22.type === "string")
|
|
140909
140933
|
return false;
|
|
140910
|
-
return "allOf" in
|
|
140934
|
+
return "allOf" in type22;
|
|
140911
140935
|
};
|
|
140912
140936
|
function parseIntersectionDef2(def, refs) {
|
|
140913
140937
|
const allOf = [
|
|
@@ -141320,7 +141344,7 @@ function parseRecordDef2(def, refs) {
|
|
|
141320
141344
|
return schema;
|
|
141321
141345
|
}
|
|
141322
141346
|
if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
|
|
141323
|
-
const { type:
|
|
141347
|
+
const { type: type22, ...keyType } = parseStringDef2(def.keyType._def, refs);
|
|
141324
141348
|
return {
|
|
141325
141349
|
...schema,
|
|
141326
141350
|
propertyNames: keyType
|
|
@@ -141333,7 +141357,7 @@ function parseRecordDef2(def, refs) {
|
|
|
141333
141357
|
}
|
|
141334
141358
|
};
|
|
141335
141359
|
} else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
|
|
141336
|
-
const { type:
|
|
141360
|
+
const { type: type22, ...keyType } = parseBrandedDef2(def.keyType._def, refs);
|
|
141337
141361
|
return {
|
|
141338
141362
|
...schema,
|
|
141339
141363
|
propertyNames: keyType
|
|
@@ -141415,20 +141439,20 @@ function parseUnionDef2(def, refs) {
|
|
|
141415
141439
|
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
141416
141440
|
if (options.every((x3) => x3._def.typeName in primitiveMappings2 && (!x3._def.checks || !x3._def.checks.length))) {
|
|
141417
141441
|
const types = options.reduce((types2, x3) => {
|
|
141418
|
-
const
|
|
141419
|
-
return
|
|
141442
|
+
const type22 = primitiveMappings2[x3._def.typeName];
|
|
141443
|
+
return type22 && !types2.includes(type22) ? [...types2, type22] : types2;
|
|
141420
141444
|
}, []);
|
|
141421
141445
|
return {
|
|
141422
141446
|
type: types.length > 1 ? types : types[0]
|
|
141423
141447
|
};
|
|
141424
141448
|
} else if (options.every((x3) => x3._def.typeName === "ZodLiteral" && !x3.description)) {
|
|
141425
141449
|
const types = options.reduce((acc, x3) => {
|
|
141426
|
-
const
|
|
141427
|
-
switch (
|
|
141450
|
+
const type22 = typeof x3._def.value;
|
|
141451
|
+
switch (type22) {
|
|
141428
141452
|
case "string":
|
|
141429
141453
|
case "number":
|
|
141430
141454
|
case "boolean":
|
|
141431
|
-
return [...acc,
|
|
141455
|
+
return [...acc, type22];
|
|
141432
141456
|
case "bigint":
|
|
141433
141457
|
return [...acc, "integer"];
|
|
141434
141458
|
case "object":
|
|
@@ -144156,15 +144180,20 @@ var _b25;
|
|
|
144156
144180
|
var ScriptService = class ScriptService2 {
|
|
144157
144181
|
constructor(loggerService, natsService) {
|
|
144158
144182
|
this.natsService = natsService;
|
|
144159
|
-
this.
|
|
144183
|
+
this.catalogs = /* @__PURE__ */ new Map();
|
|
144160
144184
|
this.logger = loggerService.getLogger("script");
|
|
144161
144185
|
}
|
|
144162
144186
|
/**
|
|
144163
144187
|
* Update the skill catalog used for script resolution.
|
|
144164
144188
|
* Called by SkillService when catalog updates arrive.
|
|
144189
|
+
* Catalogs are stored per-workspace to prevent cross-workspace leakage.
|
|
144165
144190
|
*/
|
|
144166
|
-
setCatalog(catalog) {
|
|
144167
|
-
|
|
144191
|
+
setCatalog(catalog, workspaceId) {
|
|
144192
|
+
if (catalog) {
|
|
144193
|
+
this.catalogs.set(workspaceId, catalog);
|
|
144194
|
+
} else {
|
|
144195
|
+
this.catalogs.delete(workspaceId);
|
|
144196
|
+
}
|
|
144168
144197
|
}
|
|
144169
144198
|
/**
|
|
144170
144199
|
* Execute a script by path.
|
|
@@ -144220,9 +144249,13 @@ For other resources, use the \`learn\` tool instead.`
|
|
|
144220
144249
|
isError: true
|
|
144221
144250
|
};
|
|
144222
144251
|
}
|
|
144223
|
-
const
|
|
144252
|
+
const catalog = this.catalogs.get(workspaceId);
|
|
144253
|
+
if (!catalog) {
|
|
144254
|
+
this.logger.warn({ workspaceId, availableWorkspaces: Array.from(this.catalogs.keys()) }, "No catalog loaded for workspace");
|
|
144255
|
+
}
|
|
144256
|
+
const skill = catalog?.skills.find((s) => s.name === parsedPath.skillName);
|
|
144224
144257
|
if (!skill) {
|
|
144225
|
-
const availableSkills =
|
|
144258
|
+
const availableSkills = catalog?.skills.map((s) => s.name).join(", ") || "none";
|
|
144226
144259
|
return {
|
|
144227
144260
|
content: [
|
|
144228
144261
|
{
|
|
@@ -144401,7 +144434,7 @@ var SkillService = class SkillService2 extends Service {
|
|
|
144401
144434
|
this.cacheSubscriptions = [];
|
|
144402
144435
|
}
|
|
144403
144436
|
async subscribeToTools() {
|
|
144404
|
-
const userSubject = UserListToolsPublish.subscribeToUser(this.identity.id);
|
|
144437
|
+
const userSubject = UserListToolsPublish.subscribeToUser(this.identity.id, this.identity.workspaceId);
|
|
144405
144438
|
this.logger.info(`Subscribing to List Tools for user: ${userSubject}`);
|
|
144406
144439
|
const subscription = await this.cacheService.watch(CACHE_BUCKETS.EPHEMERAL, { key: userSubject });
|
|
144407
144440
|
this.cacheSubscriptions.push(subscription);
|
|
@@ -144415,7 +144448,7 @@ var SkillService = class SkillService2 extends Service {
|
|
|
144415
144448
|
if (message instanceof UserListToolsPublish) {
|
|
144416
144449
|
const mcpTools = message.data.mcpTools.map((tool2) => this.parseMcpTool(tool2));
|
|
144417
144450
|
this.catalog = message.data.catalog ?? null;
|
|
144418
|
-
this.scriptService.setCatalog(this.catalog);
|
|
144451
|
+
this.scriptService.setCatalog(this.catalog, this.identity.workspaceId);
|
|
144419
144452
|
if (this.catalog) {
|
|
144420
144453
|
this.buildSkillToolMap(this.catalog);
|
|
144421
144454
|
}
|
|
@@ -151170,8 +151203,8 @@ function extractWWWAuthenticateParams(res) {
|
|
|
151170
151203
|
if (!authenticateHeader) {
|
|
151171
151204
|
return {};
|
|
151172
151205
|
}
|
|
151173
|
-
const [
|
|
151174
|
-
if (
|
|
151206
|
+
const [type22, scheme] = authenticateHeader.split(" ");
|
|
151207
|
+
if (type22.toLowerCase() !== "bearer" || !scheme) {
|
|
151175
151208
|
return {};
|
|
151176
151209
|
}
|
|
151177
151210
|
const resourceMetadataMatch = extractFieldFromWwwAuth(res, "resource_metadata") || void 0;
|
|
@@ -151303,7 +151336,7 @@ async function discoverAuthorizationServerMetadata2(authorizationServerUrl, { fe
|
|
|
151303
151336
|
Accept: "application/json"
|
|
151304
151337
|
};
|
|
151305
151338
|
const urlsToTry = buildDiscoveryUrls2(authorizationServerUrl);
|
|
151306
|
-
for (const { url: endpointUrl, type:
|
|
151339
|
+
for (const { url: endpointUrl, type: type22 } of urlsToTry) {
|
|
151307
151340
|
const response = await fetchWithCorsRetry2(endpointUrl, headers, fetchFn);
|
|
151308
151341
|
if (!response) {
|
|
151309
151342
|
continue;
|
|
@@ -151313,9 +151346,9 @@ async function discoverAuthorizationServerMetadata2(authorizationServerUrl, { fe
|
|
|
151313
151346
|
if (response.status >= 400 && response.status < 500) {
|
|
151314
151347
|
continue;
|
|
151315
151348
|
}
|
|
151316
|
-
throw new Error(`HTTP ${response.status} trying to load ${
|
|
151349
|
+
throw new Error(`HTTP ${response.status} trying to load ${type22 === "oauth" ? "OAuth" : "OpenID provider"} metadata from ${endpointUrl}`);
|
|
151317
151350
|
}
|
|
151318
|
-
if (
|
|
151351
|
+
if (type22 === "oauth") {
|
|
151319
151352
|
return OAuthMetadataSchema2.parse(await response.json());
|
|
151320
151353
|
} else {
|
|
151321
151354
|
return OpenIdProviderDiscoveryMetadataSchema2.parse(await response.json());
|
|
@@ -151881,9 +151914,9 @@ var ErrorEvent = class extends Event {
|
|
|
151881
151914
|
* @param type - The type of the event (should be "error")
|
|
151882
151915
|
* @param errorEventInitDict - Optional properties to include in the error event
|
|
151883
151916
|
*/
|
|
151884
|
-
constructor(
|
|
151917
|
+
constructor(type22, errorEventInitDict) {
|
|
151885
151918
|
var _a47, _b36;
|
|
151886
|
-
super(
|
|
151919
|
+
super(type22), this.code = (_a47 = errorEventInitDict == null ? void 0 : errorEventInitDict.code) != null ? _a47 : void 0, this.message = (_b36 = errorEventInitDict == null ? void 0 : errorEventInitDict.message) != null ? _b36 : void 0;
|
|
151887
151920
|
}
|
|
151888
151921
|
/**
|
|
151889
151922
|
* Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -152078,13 +152111,13 @@ var EventSource = class extends EventTarget {
|
|
|
152078
152111
|
set onopen(value) {
|
|
152079
152112
|
__privateSet(this, _onOpen, value);
|
|
152080
152113
|
}
|
|
152081
|
-
addEventListener(
|
|
152114
|
+
addEventListener(type22, listener, options) {
|
|
152082
152115
|
const listen = listener;
|
|
152083
|
-
super.addEventListener(
|
|
152116
|
+
super.addEventListener(type22, listen, options);
|
|
152084
152117
|
}
|
|
152085
|
-
removeEventListener(
|
|
152118
|
+
removeEventListener(type22, listener, options) {
|
|
152086
152119
|
const listen = listener;
|
|
152087
|
-
super.removeEventListener(
|
|
152120
|
+
super.removeEventListener(type22, listen, options);
|
|
152088
152121
|
}
|
|
152089
152122
|
/**
|
|
152090
152123
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -152843,6 +152876,8 @@ var ToolService = class ToolService2 extends Service {
|
|
|
152843
152876
|
this.rxSubscriptions = [];
|
|
152844
152877
|
this.sdkBundleContent = null;
|
|
152845
152878
|
this.sdkBundleLoadPromise = null;
|
|
152879
|
+
this.workspaceToolCatalog = /* @__PURE__ */ new Map();
|
|
152880
|
+
this.workspaceToolsByName = /* @__PURE__ */ new Map();
|
|
152846
152881
|
this.dormantConfigs = /* @__PURE__ */ new Map();
|
|
152847
152882
|
this.idleTimers = /* @__PURE__ */ new Map();
|
|
152848
152883
|
this.startingServers = /* @__PURE__ */ new Map();
|
|
@@ -152870,6 +152905,7 @@ var ToolService = class ToolService2 extends Service {
|
|
|
152870
152905
|
await this.natsService.waitForStarted();
|
|
152871
152906
|
await this.healthService.waitForStarted();
|
|
152872
152907
|
this.startObserveMCPServers().catch((err) => this.logger.error({ event: "mcp_servers_watcher_died", err }, "MCP servers watcher died unexpectedly"));
|
|
152908
|
+
this.startObserveWorkspaceToolCatalog().catch((err) => this.logger.error({ event: "workspace_tool_catalog_watcher_died", err }, "Workspace tool catalog watcher died unexpectedly"));
|
|
152873
152909
|
const identity = this.authService.getIdentity();
|
|
152874
152910
|
if (identity?.nature === "runtime" && identity.id) {
|
|
152875
152911
|
this.subscribeToScriptCalls(identity.id);
|
|
@@ -152998,6 +153034,60 @@ var ToolService = class ToolService2 extends Service {
|
|
|
152998
153034
|
clearTimeout(timer);
|
|
152999
153035
|
}
|
|
153000
153036
|
this.idleTimers.clear();
|
|
153037
|
+
this.workspaceToolCatalog.clear();
|
|
153038
|
+
this.workspaceToolsByName.clear();
|
|
153039
|
+
}
|
|
153040
|
+
/**
|
|
153041
|
+
* Watch the workspace-wide tool catalog published by the backend.
|
|
153042
|
+
* This gives every runtime visibility into tools on all other runtimes
|
|
153043
|
+
* in the same workspace, enabling cross-runtime tool call proxying.
|
|
153044
|
+
*/
|
|
153045
|
+
async startObserveWorkspaceToolCatalog() {
|
|
153046
|
+
const identity = this.authService.getIdentity();
|
|
153047
|
+
if (!identity?.workspaceId) {
|
|
153048
|
+
this.logger.debug("No workspaceId available, skipping workspace tool catalog observation");
|
|
153049
|
+
return;
|
|
153050
|
+
}
|
|
153051
|
+
const subject = WorkspaceToolCatalogPublish.subscribeToWorkspace(identity.workspaceId);
|
|
153052
|
+
this.logger.debug(`Observing workspace tool catalog: ${subject}`);
|
|
153053
|
+
const subscription = await this.cacheService.watch(CACHE_BUCKETS.EPHEMERAL, { key: subject });
|
|
153054
|
+
this.cacheSubscriptions.push(subscription);
|
|
153055
|
+
for await (const event of subscription) {
|
|
153056
|
+
if (this.state === "STOPPING")
|
|
153057
|
+
break;
|
|
153058
|
+
try {
|
|
153059
|
+
if (event.operation !== "PUT" || !event.value)
|
|
153060
|
+
continue;
|
|
153061
|
+
const msg = NatsMessage.fromRawData(event.value);
|
|
153062
|
+
if (msg instanceof WorkspaceToolCatalogPublish) {
|
|
153063
|
+
this.workspaceToolCatalog.clear();
|
|
153064
|
+
this.workspaceToolsByName.clear();
|
|
153065
|
+
for (const entry of msg.data.entries) {
|
|
153066
|
+
if (this.workspaceToolsByName.has(entry.toolName)) {
|
|
153067
|
+
const existing = this.workspaceToolsByName.get(entry.toolName);
|
|
153068
|
+
this.logger.warn({ toolName: entry.toolName, existingToolId: existing.toolId, newToolId: entry.toolId }, "Tool name collision in workspace catalog \u2014 later entry wins");
|
|
153069
|
+
}
|
|
153070
|
+
this.workspaceToolCatalog.set(entry.toolId, entry);
|
|
153071
|
+
this.workspaceToolsByName.set(entry.toolName, entry);
|
|
153072
|
+
}
|
|
153073
|
+
this.logger.debug({ toolCount: msg.data.entries.length }, "Updated workspace tool catalog");
|
|
153074
|
+
if (msg.data.catalog && this.scriptService) {
|
|
153075
|
+
try {
|
|
153076
|
+
this.scriptService.setCatalog(msg.data.catalog, identity.workspaceId);
|
|
153077
|
+
this.logger.debug({ skillCount: msg.data.catalog.skills.length }, "Updated workspace skill catalog for ScriptService");
|
|
153078
|
+
} catch (setCatalogErr) {
|
|
153079
|
+
this.logger.error({ event: "script_service_set_catalog_failed", err: setCatalogErr, workspaceId: identity.workspaceId }, "Failed to update ScriptService with workspace skill catalog");
|
|
153080
|
+
}
|
|
153081
|
+
}
|
|
153082
|
+
} else if (msg instanceof ErrorResponse) {
|
|
153083
|
+
this.logger.error(`Failed to parse workspace tool catalog: ${msg.data.error}`);
|
|
153084
|
+
} else {
|
|
153085
|
+
this.logger.warn({ msgType: msg?.type ?? "unknown" }, "Unexpected message type on workspace tool catalog subject");
|
|
153086
|
+
}
|
|
153087
|
+
} catch (err) {
|
|
153088
|
+
this.logger.error({ event: "workspace_tool_catalog_event_error", err }, "Error processing workspace tool catalog event");
|
|
153089
|
+
}
|
|
153090
|
+
}
|
|
153001
153091
|
}
|
|
153002
153092
|
/**
|
|
153003
153093
|
* Register an MCP Server. For STDIO servers with lazy-start enabled, the server is registered
|
|
@@ -153092,6 +153182,11 @@ var ToolService = class ToolService2 extends Service {
|
|
|
153092
153182
|
}
|
|
153093
153183
|
}
|
|
153094
153184
|
}
|
|
153185
|
+
if (!mcpServer.workspace?.id) {
|
|
153186
|
+
this.logger.error({ mcpServerId: mcpServer.id, mcpServerName: mcpServer.name }, "MCP Server has no workspace association \u2014 tools will not be routable.");
|
|
153187
|
+
this.publishMCPServerStatus(void 0, mcpServer.id, "ERROR", "Server has no workspace association");
|
|
153188
|
+
throw new Error(`MCP Server ${mcpServer.name} has no workspace association`);
|
|
153189
|
+
}
|
|
153095
153190
|
const mcpServerService = this.toolServerServiceFactory(mcpServer, roots, authProvider);
|
|
153096
153191
|
this.logger.info(`Activating MCPServer: ${mcpServer.name} with ${mcpServer.tools?.length ?? 0} tools, and roots: ${JSON.stringify(roots)}`);
|
|
153097
153192
|
if (this.mcpServers.has(mcpServer.id)) {
|
|
@@ -153099,10 +153194,8 @@ var ToolService = class ToolService2 extends Service {
|
|
|
153099
153194
|
await this.stopMCPServer(mcpServer);
|
|
153100
153195
|
}
|
|
153101
153196
|
this.mcpServers.set(mcpServer.id, mcpServerService);
|
|
153102
|
-
|
|
153103
|
-
|
|
153104
|
-
}
|
|
153105
|
-
this.publishMCPServerStatus(mcpServer.workspace?.id, mcpServer.id, "STARTING");
|
|
153197
|
+
this.mcpServerWorkspaces.set(mcpServer.id, mcpServer.workspace.id);
|
|
153198
|
+
this.publishMCPServerStatus(mcpServer.workspace.id, mcpServer.id, "STARTING");
|
|
153106
153199
|
try {
|
|
153107
153200
|
await this.startService(mcpServerService);
|
|
153108
153201
|
} catch (error48) {
|
|
@@ -153330,6 +153423,11 @@ var ToolService = class ToolService2 extends Service {
|
|
|
153330
153423
|
if (!tool2) {
|
|
153331
153424
|
continue;
|
|
153332
153425
|
}
|
|
153426
|
+
const serverWorkspaceId = this.mcpServerWorkspaces.get(mcpServerId);
|
|
153427
|
+
if (!serverWorkspaceId || serverWorkspaceId !== msg.data.workspaceId) {
|
|
153428
|
+
this.logger.debug({ toolId, mcpServerId, serverWorkspaceId, requestedWorkspaceId: msg.data.workspaceId }, "Tool found but rejected due to workspace mismatch");
|
|
153429
|
+
continue;
|
|
153430
|
+
}
|
|
153333
153431
|
this.logger.debug(`Found tool ${tool2.name} in MCP Server ${mcpServerId}`);
|
|
153334
153432
|
let mcpServer = this.mcpServers.get(mcpServerId);
|
|
153335
153433
|
if (!mcpServer && this.dormantConfigs.has(mcpServerId)) {
|
|
@@ -153516,10 +153614,18 @@ var ToolService = class ToolService2 extends Service {
|
|
|
153516
153614
|
toolCalled = true;
|
|
153517
153615
|
}
|
|
153518
153616
|
if (!toolCalled) {
|
|
153519
|
-
this.
|
|
153520
|
-
|
|
153521
|
-
|
|
153522
|
-
|
|
153617
|
+
const catalogEntry = this.workspaceToolCatalog.get(toolId);
|
|
153618
|
+
if (catalogEntry) {
|
|
153619
|
+
this.logger.warn({ toolId, ownerRuntimeId: catalogEntry.runtimeId }, "Tool call arrived at wrong runtime \u2014 tool belongs to another runtime");
|
|
153620
|
+
msg.respond(new ErrorResponse({
|
|
153621
|
+
error: `Tool ${toolId} is served by runtime ${catalogEntry.runtimeId}, not this runtime. The request was misrouted.`
|
|
153622
|
+
}));
|
|
153623
|
+
} else {
|
|
153624
|
+
this.logger.warn(`Tool ${toolId} not found in any MCP Server or workspace catalog`);
|
|
153625
|
+
msg.respond(new ErrorResponse({
|
|
153626
|
+
error: `Tool ${toolId} not found in any MCP Server`
|
|
153627
|
+
}));
|
|
153628
|
+
}
|
|
153523
153629
|
}
|
|
153524
153630
|
}
|
|
153525
153631
|
}
|
|
@@ -153792,6 +153898,39 @@ ${cleanError}` : cleanError;
|
|
|
153792
153898
|
delegateDepth: delegateDepth ?? 0
|
|
153793
153899
|
});
|
|
153794
153900
|
}
|
|
153901
|
+
/**
|
|
153902
|
+
* Send a tool call request via NATS and handle the response.
|
|
153903
|
+
*/
|
|
153904
|
+
async sendToolCallRequest(toolId, toolName, workspaceId, runtimeId, userId, userKey, args, errorPrefix, logContext) {
|
|
153905
|
+
const message = SkillCallToolRequest.create({
|
|
153906
|
+
type: "mcp-tool",
|
|
153907
|
+
workspaceId,
|
|
153908
|
+
from: runtimeId ?? "script",
|
|
153909
|
+
id: toolId,
|
|
153910
|
+
userId,
|
|
153911
|
+
userKey,
|
|
153912
|
+
arguments: args
|
|
153913
|
+
});
|
|
153914
|
+
let response;
|
|
153915
|
+
try {
|
|
153916
|
+
response = await this.natsService.request(message, {
|
|
153917
|
+
timeout: MCP_CALL_TOOL_TIMEOUT,
|
|
153918
|
+
retryOnTimeout: true
|
|
153919
|
+
});
|
|
153920
|
+
} catch (error48) {
|
|
153921
|
+
this.logger.error({ error: error48, toolName, ...logContext }, `${errorPrefix} failed`);
|
|
153922
|
+
return {
|
|
153923
|
+
content: [{ type: "text", text: `Error: ${errorPrefix} failed: ${error48 instanceof Error ? error48.message : "Unknown error"}` }],
|
|
153924
|
+
isError: true
|
|
153925
|
+
};
|
|
153926
|
+
}
|
|
153927
|
+
if (response instanceof ErrorResponse) {
|
|
153928
|
+
return { content: [{ type: "text", text: `Error: ${response.data.error}` }], isError: true };
|
|
153929
|
+
} else if (response instanceof RuntimeCallToolResponse) {
|
|
153930
|
+
return response.data.result;
|
|
153931
|
+
}
|
|
153932
|
+
return { content: [{ type: "text", text: `Error: Invalid response from tool server` }], isError: true };
|
|
153933
|
+
}
|
|
153795
153934
|
/**
|
|
153796
153935
|
* Route a tool call from a script to the appropriate MCP server via NATS.
|
|
153797
153936
|
*/
|
|
@@ -153801,47 +153940,22 @@ ${cleanError}` : cleanError;
|
|
|
153801
153940
|
if (!tool2)
|
|
153802
153941
|
continue;
|
|
153803
153942
|
const serverWorkspaceId = this.mcpServerWorkspaces.get(mcpServerId);
|
|
153804
|
-
if (serverWorkspaceId
|
|
153943
|
+
if (!serverWorkspaceId || serverWorkspaceId !== workspaceId) {
|
|
153944
|
+
this.logger.debug({ toolName, mcpServerId, serverWorkspaceId, requestedWorkspaceId: workspaceId }, "Tool found but rejected due to workspace mismatch");
|
|
153805
153945
|
continue;
|
|
153806
|
-
const message = SkillCallToolRequest.create({
|
|
153807
|
-
type: "mcp-tool",
|
|
153808
|
-
workspaceId,
|
|
153809
|
-
from: runtimeId ?? "script",
|
|
153810
|
-
id: tool2.id,
|
|
153811
|
-
userId,
|
|
153812
|
-
userKey,
|
|
153813
|
-
arguments: args
|
|
153814
|
-
});
|
|
153815
|
-
let response;
|
|
153816
|
-
try {
|
|
153817
|
-
response = await this.natsService.request(message, {
|
|
153818
|
-
timeout: MCP_CALL_TOOL_TIMEOUT,
|
|
153819
|
-
retryOnTimeout: true
|
|
153820
|
-
});
|
|
153821
|
-
} catch (error48) {
|
|
153822
|
-
this.logger.error({ error: error48, toolName, mcpServerId }, "NATS request failed for script tool call");
|
|
153823
|
-
return {
|
|
153824
|
-
content: [
|
|
153825
|
-
{
|
|
153826
|
-
type: "text",
|
|
153827
|
-
text: `Error: Tool call failed: ${error48 instanceof Error ? error48.message : "Unknown error"}`
|
|
153828
|
-
}
|
|
153829
|
-
],
|
|
153830
|
-
isError: true
|
|
153831
|
-
};
|
|
153832
|
-
}
|
|
153833
|
-
if (response instanceof ErrorResponse) {
|
|
153834
|
-
return { content: [{ type: "text", text: `Error: ${response.data.error}` }], isError: true };
|
|
153835
|
-
} else if (response instanceof RuntimeCallToolResponse) {
|
|
153836
|
-
return response.data.result;
|
|
153837
153946
|
}
|
|
153838
|
-
return
|
|
153947
|
+
return this.sendToolCallRequest(tool2.id, toolName, workspaceId, runtimeId, userId, userKey, args, "Tool call", { mcpServerId });
|
|
153948
|
+
}
|
|
153949
|
+
const catalogEntry = this.workspaceToolsByName.get(toolName);
|
|
153950
|
+
if (catalogEntry) {
|
|
153951
|
+
this.logger.info({ toolName, toolId: catalogEntry.toolId, ownerRuntimeId: catalogEntry.runtimeId }, "Proxying tool call to remote runtime via workspace catalog");
|
|
153952
|
+
return this.sendToolCallRequest(catalogEntry.toolId, toolName, workspaceId, runtimeId, userId, userKey, args, "Cross-runtime tool call", { ownerRuntimeId: catalogEntry.runtimeId });
|
|
153839
153953
|
}
|
|
153840
153954
|
return {
|
|
153841
153955
|
content: [
|
|
153842
153956
|
{
|
|
153843
153957
|
type: "text",
|
|
153844
|
-
text: `Error: Tool '${toolName}' not found
|
|
153958
|
+
text: `Error: Tool '${toolName}' not found on this runtime or any other runtime in the workspace.`
|
|
153845
153959
|
}
|
|
153846
153960
|
],
|
|
153847
153961
|
isError: true
|