@fern-api/fdr-sdk 1.2.33-fc1095cfbc → 1.2.34-5c94d72077
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/js/api-definition/index.js +167 -54
- package/dist/js/api-definition/index.js.map +1 -1
- package/dist/js/api-definition/index.mjs +166 -54
- package/dist/js/api-definition/index.mjs.map +1 -1
- package/dist/js/api-definition-lite/index.js.map +1 -1
- package/dist/js/client/FdrClient.js +14 -9
- package/dist/js/client/FdrClient.js.map +1 -1
- package/dist/js/client/FdrClient.mjs +14 -9
- package/dist/js/client/FdrClient.mjs.map +1 -1
- package/dist/js/client/types.js +18 -9
- package/dist/js/client/types.js.map +1 -1
- package/dist/js/client/types.mjs +18 -9
- package/dist/js/client/types.mjs.map +1 -1
- package/dist/js/converters/index.js +269 -71
- package/dist/js/converters/index.js.map +1 -1
- package/dist/js/converters/index.mjs +269 -71
- package/dist/js/converters/index.mjs.map +1 -1
- package/dist/js/index.js +269 -71
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +269 -71
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/index.js +268 -70
- package/dist/js/navigation/index.js.map +1 -1
- package/dist/js/navigation/index.mjs +268 -70
- package/dist/js/navigation/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +12 -8
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +12 -8
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/js/navigation/types/latest.js.map +1 -1
- package/dist/js/navigation/types/latest.mjs.map +1 -1
- package/dist/js/navigation/types/v1.js.map +1 -1
- package/dist/js/navigation/types/v1.mjs.map +1 -1
- package/dist/js/orpc-client.js +16 -9
- package/dist/js/orpc-client.js.map +1 -1
- package/dist/js/orpc-client.mjs +15 -9
- package/dist/js/orpc-client.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/api-definition/__test__/collect-type-tree.test.d.ts +2 -0
- package/dist/types/api-definition/__test__/collect-type-tree.test.d.ts.map +1 -0
- package/dist/types/api-definition/collect-referenced-types.d.ts.map +1 -1
- package/dist/types/api-definition/collect-type-tree.d.ts +4 -0
- package/dist/types/api-definition/collect-type-tree.d.ts.map +1 -1
- package/dist/types/api-definition/endpoint-context.d.ts +3 -0
- package/dist/types/api-definition/endpoint-context.d.ts.map +1 -1
- package/dist/types/api-definition/migrators/v1ToV2.d.ts +16 -7
- package/dist/types/api-definition/migrators/v1ToV2.d.ts.map +1 -1
- package/dist/types/api-definition/prune.d.ts +1 -0
- package/dist/types/api-definition/prune.d.ts.map +1 -1
- package/dist/types/api-definition/snippets/graphql-snippets.d.ts.map +1 -1
- package/dist/types/api-definition/typeid-visitor.d.ts.map +1 -1
- package/dist/types/api-definition-lite/index.d.ts +1 -1
- package/dist/types/api-definition-lite/index.d.ts.map +1 -1
- package/dist/types/converters/read/convertDbAPIDefinitionToRead.d.ts +46 -14
- package/dist/types/converters/read/convertDbAPIDefinitionToRead.d.ts.map +1 -1
- package/dist/types/navigation/ApiDefinitionPruner.d.ts.map +1 -1
- package/dist/types/navigation/ApiTypeIdVisitor.d.ts.map +1 -1
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/types/navigation/migrators/v1ToV2.d.ts.map +1 -1
- package/dist/types/navigation/types/latest.d.ts +18 -2
- package/dist/types/navigation/types/latest.d.ts.map +1 -1
- package/dist/types/navigation/types/v1.d.ts +2 -0
- package/dist/types/navigation/types/v1.d.ts.map +1 -1
- package/dist/types/navigation/utils/getApiReferenceId.d.ts.map +1 -1
- package/dist/types/navigation/utils/toApis.d.ts +2 -1
- package/dist/types/navigation/utils/toApis.d.ts.map +1 -1
- package/dist/types/navigation/versions/latest/NavigationNode.d.ts +1 -1
- package/dist/types/navigation/versions/latest/NavigationNode.d.ts.map +1 -1
- package/dist/types/navigation/versions/latest/NavigationNodeApiLeaf.d.ts +2 -2
- package/dist/types/navigation/versions/latest/NavigationNodeApiLeaf.d.ts.map +1 -1
- package/dist/types/navigation/versions/latest/__test__/GraphQlTypeNode.test.d.ts +2 -0
- package/dist/types/navigation/versions/latest/__test__/GraphQlTypeNode.test.d.ts.map +1 -0
- package/dist/types/navigation/versions/latest/getPageId.d.ts.map +1 -1
- package/dist/types/navigation/versions/v1/converters/ApiReferenceNavigationConverter.d.ts +1 -0
- package/dist/types/navigation/versions/v1/converters/ApiReferenceNavigationConverter.d.ts.map +1 -1
- package/dist/types/navigation/versions/v1/converters/__test__/ApiReferenceNavigationConverter.graphql.test.d.ts +2 -0
- package/dist/types/navigation/versions/v1/converters/__test__/ApiReferenceNavigationConverter.graphql.test.d.ts.map +1 -0
- package/dist/types/orpc-client/api/contract-db.d.ts +1848 -216
- package/dist/types/orpc-client/api/contract-db.d.ts.map +1 -1
- package/dist/types/orpc-client/api/contract-latest.d.ts +24 -10
- package/dist/types/orpc-client/api/contract-latest.d.ts.map +1 -1
- package/dist/types/orpc-client/api/contract-read.d.ts +1700 -216
- package/dist/types/orpc-client/api/contract-read.d.ts.map +1 -1
- package/dist/types/orpc-client/api/contract-register.d.ts +1878 -216
- package/dist/types/orpc-client/api/contract-register.d.ts.map +1 -1
- package/dist/types/orpc-client/api/shared.d.ts +99 -53
- package/dist/types/orpc-client/api/shared.d.ts.map +1 -1
- package/dist/types/orpc-client/files/contract.d.ts +5 -1
- package/dist/types/orpc-client/files/contract.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -96,6 +96,7 @@ __export(api_definition_exports, {
|
|
|
96
96
|
GraphQlOperationIdSchema: () => GraphQlOperationIdSchema,
|
|
97
97
|
GraphQlOperationSchema: () => LatestGraphQlOperationSchema,
|
|
98
98
|
GraphQlOperationTypeSchema: () => LatestGraphQlOperationTypeSchema,
|
|
99
|
+
GraphQlTypeCategorySchema: () => GraphQlTypeCategorySchema,
|
|
99
100
|
GrpcId: () => GrpcId,
|
|
100
101
|
GrpcIdSchema: () => GrpcIdSchema,
|
|
101
102
|
GrpcMethod: () => GrpcMethod,
|
|
@@ -1049,6 +1050,7 @@ var GraphQlOperationIdSchema = z2.string();
|
|
|
1049
1050
|
function GraphQlOperationId(value) {
|
|
1050
1051
|
return value;
|
|
1051
1052
|
}
|
|
1053
|
+
var GraphQlTypeCategorySchema = z2.enum(["object", "input", "enum", "scalar", "interface", "union"]);
|
|
1052
1054
|
var EnvironmentIdSchema = z2.string();
|
|
1053
1055
|
function EnvironmentId(value) {
|
|
1054
1056
|
return value;
|
|
@@ -1283,12 +1285,20 @@ var TypeReferenceSchema = z2.lazy(
|
|
|
1283
1285
|
})
|
|
1284
1286
|
])
|
|
1285
1287
|
);
|
|
1288
|
+
var GraphQlArgumentSchema = z2.object({
|
|
1289
|
+
description: z2.string().nullish(),
|
|
1290
|
+
availability: AvailabilitySchema.nullish(),
|
|
1291
|
+
name: z2.string(),
|
|
1292
|
+
type: TypeReferenceSchema,
|
|
1293
|
+
defaultValue: z2.unknown().nullish()
|
|
1294
|
+
});
|
|
1286
1295
|
var ObjectPropertySchema = z2.object({
|
|
1287
1296
|
description: z2.string().nullish(),
|
|
1288
1297
|
availability: AvailabilitySchema.nullish(),
|
|
1289
1298
|
key: PropertyKeySchema,
|
|
1290
1299
|
valueType: TypeReferenceSchema,
|
|
1291
|
-
propertyAccess: ObjectPropertyAccessSchema.nullish()
|
|
1300
|
+
propertyAccess: ObjectPropertyAccessSchema.nullish(),
|
|
1301
|
+
arguments: z2.array(GraphQlArgumentSchema).nullish()
|
|
1292
1302
|
});
|
|
1293
1303
|
var ObjectTypeSchema = z2.object({
|
|
1294
1304
|
extends: z2.array(TypeIdSchema),
|
|
@@ -1436,13 +1446,6 @@ var ErrorExampleSchema = z2.object({
|
|
|
1436
1446
|
responseBody: ExampleErrorResponseSchema
|
|
1437
1447
|
});
|
|
1438
1448
|
var GraphQlOperationTypeSchema = z2.enum(["QUERY", "MUTATION", "SUBSCRIPTION"]);
|
|
1439
|
-
var GraphQlArgumentSchema = z2.object({
|
|
1440
|
-
description: z2.string().nullish(),
|
|
1441
|
-
availability: AvailabilitySchema.nullish(),
|
|
1442
|
-
name: z2.string(),
|
|
1443
|
-
type: TypeReferenceSchema,
|
|
1444
|
-
defaultValue: z2.unknown().nullish()
|
|
1445
|
-
});
|
|
1446
1449
|
var GraphQlExampleSchema = z2.object({
|
|
1447
1450
|
description: z2.string().nullish(),
|
|
1448
1451
|
name: z2.string().nullish(),
|
|
@@ -1465,6 +1468,7 @@ var GraphQlOperationSchema = z2.object({
|
|
|
1465
1468
|
operationType: GraphQlOperationTypeSchema,
|
|
1466
1469
|
name: z2.string(),
|
|
1467
1470
|
displayName: z2.string().nullish(),
|
|
1471
|
+
fieldPath: z2.array(z2.string()).nullish(),
|
|
1468
1472
|
arguments: z2.array(GraphQlArgumentSchema).nullish(),
|
|
1469
1473
|
returnType: TypeReferenceSchema,
|
|
1470
1474
|
examples: z2.array(GraphQlExampleSchema).nullish(),
|
|
@@ -1912,7 +1916,8 @@ var LatestObjectPropertySchema = z4.lazy(
|
|
|
1912
1916
|
availability: AvailabilitySchema.nullish(),
|
|
1913
1917
|
key: PropertyKeySchema,
|
|
1914
1918
|
valueShape: LatestTypeShapeSchema,
|
|
1915
|
-
propertyAccess: LatestObjectPropertyAccessSchema.nullish()
|
|
1919
|
+
propertyAccess: LatestObjectPropertyAccessSchema.nullish(),
|
|
1920
|
+
arguments: z4.array(LatestGraphQlArgumentSchema).nullish()
|
|
1916
1921
|
})
|
|
1917
1922
|
);
|
|
1918
1923
|
var LatestParameterPropertySchema = z4.lazy(
|
|
@@ -2264,6 +2269,7 @@ var LatestGraphQlOperationSchema = z4.object({
|
|
|
2264
2269
|
description: z4.string().nullish(),
|
|
2265
2270
|
availability: AvailabilitySchema.nullish(),
|
|
2266
2271
|
namespace: z4.array(z4.string()).nullish(),
|
|
2272
|
+
fieldPath: z4.array(z4.string()).nullish(),
|
|
2267
2273
|
id: GraphQlOperationIdSchema,
|
|
2268
2274
|
operationType: LatestGraphQlOperationTypeSchema,
|
|
2269
2275
|
name: z4.string(),
|
|
@@ -2679,6 +2685,15 @@ function collectReferencedTypeIds(type, types, { maxDepth = 10 } = {}) {
|
|
|
2679
2685
|
visitedTypeIds,
|
|
2680
2686
|
depth: depth + 1
|
|
2681
2687
|
});
|
|
2688
|
+
if (property.arguments) {
|
|
2689
|
+
for (const arg of property.arguments) {
|
|
2690
|
+
stack.push({
|
|
2691
|
+
shape: arg.type,
|
|
2692
|
+
visitedTypeIds,
|
|
2693
|
+
depth: depth + 1
|
|
2694
|
+
});
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2682
2697
|
}
|
|
2683
2698
|
if (obj.extraProperties) {
|
|
2684
2699
|
stack.push({
|
|
@@ -2789,6 +2804,27 @@ function collectTypeDefinitionTree(type, types, { availability: rootAvailability
|
|
|
2789
2804
|
visitedTypeIds,
|
|
2790
2805
|
availability
|
|
2791
2806
|
});
|
|
2807
|
+
property.arguments?.forEach((arg) => {
|
|
2808
|
+
stack.push({
|
|
2809
|
+
type: arg.type,
|
|
2810
|
+
path: [
|
|
2811
|
+
...parentpath,
|
|
2812
|
+
{
|
|
2813
|
+
type: "objectProperty",
|
|
2814
|
+
key: property.key,
|
|
2815
|
+
optional: unwrapReference(property.valueShape, types).isOptional
|
|
2816
|
+
},
|
|
2817
|
+
{
|
|
2818
|
+
type: "graphqlArgument",
|
|
2819
|
+
name: arg.name,
|
|
2820
|
+
optional: unwrapReference(arg.type, types).isOptional
|
|
2821
|
+
}
|
|
2822
|
+
],
|
|
2823
|
+
descriptions: arg.description ? [arg.description] : [],
|
|
2824
|
+
visitedTypeIds,
|
|
2825
|
+
availability: coalesceAvailability([availability, property.availability, arg.availability])
|
|
2826
|
+
});
|
|
2827
|
+
});
|
|
2792
2828
|
});
|
|
2793
2829
|
if (obj.extraProperties) {
|
|
2794
2830
|
stack.push({
|
|
@@ -2896,7 +2932,43 @@ function collectTypeDefinitionTreeForObjectProperty(property, types, rootPath =
|
|
|
2896
2932
|
optional: unwrapReference(property.valueShape, types).isOptional
|
|
2897
2933
|
}
|
|
2898
2934
|
]
|
|
2899
|
-
})
|
|
2935
|
+
}),
|
|
2936
|
+
...(property.arguments ?? []).flatMap((arg) => [
|
|
2937
|
+
{
|
|
2938
|
+
path: [
|
|
2939
|
+
...rootPath,
|
|
2940
|
+
{
|
|
2941
|
+
type: "objectProperty",
|
|
2942
|
+
key: property.key,
|
|
2943
|
+
optional: unwrapReference(property.valueShape, types).isOptional
|
|
2944
|
+
},
|
|
2945
|
+
{
|
|
2946
|
+
type: "graphqlArgument",
|
|
2947
|
+
name: arg.name,
|
|
2948
|
+
optional: unwrapReference(arg.type, types).isOptional
|
|
2949
|
+
}
|
|
2950
|
+
],
|
|
2951
|
+
descriptions: arg.description ? [arg.description] : [],
|
|
2952
|
+
availability: coalesceAvailability([property.availability, arg.availability])
|
|
2953
|
+
},
|
|
2954
|
+
...collectTypeDefinitionTree(arg.type, types, {
|
|
2955
|
+
maxDepth: maxDepth - 1,
|
|
2956
|
+
availability: coalesceAvailability([property.availability, arg.availability]),
|
|
2957
|
+
path: [
|
|
2958
|
+
...rootPath,
|
|
2959
|
+
{
|
|
2960
|
+
type: "objectProperty",
|
|
2961
|
+
key: property.key,
|
|
2962
|
+
optional: unwrapReference(property.valueShape, types).isOptional
|
|
2963
|
+
},
|
|
2964
|
+
{
|
|
2965
|
+
type: "graphqlArgument",
|
|
2966
|
+
name: arg.name,
|
|
2967
|
+
optional: unwrapReference(arg.type, types).isOptional
|
|
2968
|
+
}
|
|
2969
|
+
]
|
|
2970
|
+
})
|
|
2971
|
+
])
|
|
2900
2972
|
];
|
|
2901
2973
|
}
|
|
2902
2974
|
|
|
@@ -3015,6 +3087,9 @@ var ApiTypeIdVisitor = class _ApiTypeIdVisitor {
|
|
|
3015
3087
|
typeShape.extends.forEach(visit);
|
|
3016
3088
|
typeShape.properties.forEach((property) => {
|
|
3017
3089
|
_ApiTypeIdVisitor.visitTypeShape(property.valueShape, visit);
|
|
3090
|
+
property.arguments?.forEach((arg) => {
|
|
3091
|
+
_ApiTypeIdVisitor.visitTypeShape(arg.type, visit);
|
|
3092
|
+
});
|
|
3018
3093
|
});
|
|
3019
3094
|
}
|
|
3020
3095
|
static visitTypeReference(typeReference, visit) {
|
|
@@ -3095,10 +3170,13 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
3095
3170
|
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
3096
3171
|
}
|
|
3097
3172
|
} else if (node.type === "graphql") {
|
|
3098
|
-
const
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
found
|
|
3173
|
+
const idsToInclude = node.graphqlOperationIds ?? [node.graphqlOperationId];
|
|
3174
|
+
for (const opId of idsToInclude) {
|
|
3175
|
+
const found = this.api.graphqlOperations[opId];
|
|
3176
|
+
if (found) {
|
|
3177
|
+
toRet.graphqlOperations[opId] = found;
|
|
3178
|
+
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
3179
|
+
}
|
|
3102
3180
|
}
|
|
3103
3181
|
}
|
|
3104
3182
|
}
|
|
@@ -3400,9 +3478,21 @@ function createGraphqlContext(node, apiDefinition) {
|
|
|
3400
3478
|
);
|
|
3401
3479
|
return void 0;
|
|
3402
3480
|
}
|
|
3481
|
+
const allIds = node.graphqlOperationIds ?? [node.graphqlOperationId];
|
|
3482
|
+
const operations = [];
|
|
3483
|
+
for (const id of allIds) {
|
|
3484
|
+
const op = api.graphqlOperations[id];
|
|
3485
|
+
if (op) {
|
|
3486
|
+
operations.push(op);
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
if (operations.length === 0) {
|
|
3490
|
+
operations.push(operation);
|
|
3491
|
+
}
|
|
3403
3492
|
return {
|
|
3404
3493
|
node,
|
|
3405
3494
|
operation,
|
|
3495
|
+
operations,
|
|
3406
3496
|
types: api.types
|
|
3407
3497
|
};
|
|
3408
3498
|
}
|
|
@@ -4572,7 +4662,8 @@ var ApiDefinitionV1ToLatest = class _ApiDefinitionV1ToLatest {
|
|
|
4572
4662
|
},
|
|
4573
4663
|
propertyAccess: value?.propertyAccess ?? void 0,
|
|
4574
4664
|
description: value?.description ?? void 0,
|
|
4575
|
-
availability: value?.availability ?? void 0
|
|
4665
|
+
availability: value?.availability ?? void 0,
|
|
4666
|
+
arguments: value?.arguments?.map((arg) => this.migrateGraphQlArgument(arg))
|
|
4576
4667
|
}));
|
|
4577
4668
|
},
|
|
4578
4669
|
[],
|
|
@@ -5013,6 +5104,7 @@ var ApiDefinitionV1ToLatest = class _ApiDefinitionV1ToLatest {
|
|
|
5013
5104
|
description: v1?.description,
|
|
5014
5105
|
availability: v1?.availability,
|
|
5015
5106
|
namespace,
|
|
5107
|
+
fieldPath: v1?.fieldPath,
|
|
5016
5108
|
arguments: v1?.arguments?.map((arg) => this.migrateGraphQlArgument(arg)),
|
|
5017
5109
|
returnType: {
|
|
5018
5110
|
type: "alias",
|
|
@@ -5309,7 +5401,10 @@ function generateGraphQlSnippet(context) {
|
|
|
5309
5401
|
return `$${arg.name}: ${graphqlType}`;
|
|
5310
5402
|
});
|
|
5311
5403
|
const argumentUsage = args.map((arg) => `${arg.name}: $${arg.name}`);
|
|
5312
|
-
const
|
|
5404
|
+
const fieldPath = operation.fieldPath;
|
|
5405
|
+
const hasFieldPath = fieldPath != null && fieldPath.length > 0;
|
|
5406
|
+
const selectionSetIndent = hasFieldPath ? 2 + fieldPath.length : 2;
|
|
5407
|
+
const selectionSet = generateSelectionSet(operation.returnType, types, 2, /* @__PURE__ */ new Set(), selectionSetIndent);
|
|
5313
5408
|
let query = operationKeyword;
|
|
5314
5409
|
if (operationName || variableDefinitions.length > 0) {
|
|
5315
5410
|
query += ` ${operationName}`;
|
|
@@ -5318,15 +5413,32 @@ function generateGraphQlSnippet(context) {
|
|
|
5318
5413
|
}
|
|
5319
5414
|
}
|
|
5320
5415
|
query += " {\n";
|
|
5321
|
-
|
|
5416
|
+
const baseIndent = 2;
|
|
5417
|
+
if (hasFieldPath) {
|
|
5418
|
+
for (let i = 0; i < fieldPath.length; i++) {
|
|
5419
|
+
const indent = " ".repeat(baseIndent + i * 2);
|
|
5420
|
+
query += `${indent}${fieldPath[i]} {
|
|
5421
|
+
`;
|
|
5422
|
+
}
|
|
5423
|
+
}
|
|
5424
|
+
const operationIndent = hasFieldPath ? " ".repeat(baseIndent + fieldPath.length * 2) : " ";
|
|
5425
|
+
query += `${operationIndent}${operation.name}`;
|
|
5322
5426
|
if (argumentUsage.length > 0) {
|
|
5323
5427
|
query += `(${argumentUsage.join(", ")})`;
|
|
5324
5428
|
}
|
|
5325
5429
|
if (selectionSet) {
|
|
5326
5430
|
query += ` ${selectionSet}`;
|
|
5327
5431
|
}
|
|
5328
|
-
query += "\n
|
|
5329
|
-
|
|
5432
|
+
query += "\n";
|
|
5433
|
+
if (hasFieldPath) {
|
|
5434
|
+
for (let i = fieldPath.length - 1; i >= 0; i--) {
|
|
5435
|
+
const indent = " ".repeat(baseIndent + i * 2);
|
|
5436
|
+
query += `${indent}}
|
|
5437
|
+
`;
|
|
5438
|
+
}
|
|
5439
|
+
}
|
|
5440
|
+
query += "}";
|
|
5441
|
+
const response = generateResponseExample(operation.name, operation.returnType, types, fieldPath);
|
|
5330
5442
|
const result = { query, variables, response };
|
|
5331
5443
|
snippetCache.set(operation, result);
|
|
5332
5444
|
return result;
|
|
@@ -5355,49 +5467,44 @@ function getExampleOperationName(operationType) {
|
|
|
5355
5467
|
return "ExampleQuery";
|
|
5356
5468
|
}
|
|
5357
5469
|
}
|
|
5358
|
-
function typeShapeToGraphQlType(shape, types) {
|
|
5470
|
+
function typeShapeToGraphQlType(shape, types, nonNull = true) {
|
|
5359
5471
|
if (shape.type === "alias") {
|
|
5360
|
-
return typeReferenceToGraphQlType(shape.value, types);
|
|
5361
|
-
}
|
|
5362
|
-
if (shape.type === "enum") {
|
|
5363
|
-
return "String";
|
|
5472
|
+
return typeReferenceToGraphQlType(shape.value, types, nonNull);
|
|
5364
5473
|
}
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
}
|
|
5368
|
-
if (shape.type === "undiscriminatedUnion" || shape.type === "discriminatedUnion") {
|
|
5369
|
-
return "Object";
|
|
5370
|
-
}
|
|
5371
|
-
return "String";
|
|
5474
|
+
const base = shape.type === "enum" ? "String" : shape.type === "object" || shape.type === "undiscriminatedUnion" || shape.type === "discriminatedUnion" ? "Object" : "String";
|
|
5475
|
+
return nonNull ? `${base}!` : base;
|
|
5372
5476
|
}
|
|
5373
|
-
function typeReferenceToGraphQlType(ref, types) {
|
|
5477
|
+
function typeReferenceToGraphQlType(ref, types, nonNull = true) {
|
|
5374
5478
|
switch (ref.type) {
|
|
5375
|
-
case "primitive":
|
|
5376
|
-
|
|
5479
|
+
case "primitive": {
|
|
5480
|
+
const base = primitiveToGraphQlType(ref.value);
|
|
5481
|
+
return nonNull ? `${base}!` : base;
|
|
5482
|
+
}
|
|
5377
5483
|
case "id": {
|
|
5378
5484
|
const typeDef = types[ref.id];
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
}
|
|
5382
|
-
return "Object";
|
|
5485
|
+
const base = typeDef ? typeDef.displayName ?? unnamespacedName(typeDef.name) ?? "Object" : "Object";
|
|
5486
|
+
return nonNull ? `${base}!` : base;
|
|
5383
5487
|
}
|
|
5384
5488
|
case "optional":
|
|
5385
|
-
return typeShapeToGraphQlType(ref.shape, types);
|
|
5489
|
+
return typeShapeToGraphQlType(ref.shape, types, false);
|
|
5386
5490
|
case "nullable":
|
|
5387
|
-
return typeShapeToGraphQlType(ref.shape, types);
|
|
5388
|
-
case "list":
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5491
|
+
return typeShapeToGraphQlType(ref.shape, types, false);
|
|
5492
|
+
case "list": {
|
|
5493
|
+
const inner = typeShapeToGraphQlType(ref.itemShape, types);
|
|
5494
|
+
return nonNull ? `[${inner}]!` : `[${inner}]`;
|
|
5495
|
+
}
|
|
5496
|
+
case "set": {
|
|
5497
|
+
const inner = typeShapeToGraphQlType(ref.itemShape, types);
|
|
5498
|
+
return nonNull ? `[${inner}]!` : `[${inner}]`;
|
|
5499
|
+
}
|
|
5392
5500
|
case "map":
|
|
5393
|
-
return "Object";
|
|
5394
|
-
// Maps don't have direct GraphQL equivalent
|
|
5501
|
+
return nonNull ? "Object!" : "Object";
|
|
5395
5502
|
case "literal":
|
|
5396
|
-
return "String";
|
|
5503
|
+
return nonNull ? "String!" : "String";
|
|
5397
5504
|
case "unknown":
|
|
5398
|
-
return "Object";
|
|
5505
|
+
return nonNull ? "Object!" : "Object";
|
|
5399
5506
|
default:
|
|
5400
|
-
return "String";
|
|
5507
|
+
return nonNull ? "String!" : "String";
|
|
5401
5508
|
}
|
|
5402
5509
|
}
|
|
5403
5510
|
function unnamespacedName(name) {
|
|
@@ -5615,13 +5722,18 @@ function generateSelectionSetFromReference(ref, types, depth, visited, indentLev
|
|
|
5615
5722
|
return "";
|
|
5616
5723
|
}
|
|
5617
5724
|
}
|
|
5618
|
-
function generateResponseExample(operationName, returnType, types) {
|
|
5725
|
+
function generateResponseExample(operationName, returnType, types, fieldPath) {
|
|
5619
5726
|
const data = generateResponseData(returnType, types, 3, /* @__PURE__ */ new Set());
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5727
|
+
let responseData = { [operationName]: data };
|
|
5728
|
+
if (fieldPath != null && fieldPath.length > 0) {
|
|
5729
|
+
for (let i = fieldPath.length - 1; i >= 0; i--) {
|
|
5730
|
+
const key = fieldPath[i];
|
|
5731
|
+
if (key != null) {
|
|
5732
|
+
responseData = { [key]: responseData };
|
|
5733
|
+
}
|
|
5623
5734
|
}
|
|
5624
|
-
}
|
|
5735
|
+
}
|
|
5736
|
+
return { data: responseData };
|
|
5625
5737
|
}
|
|
5626
5738
|
function generateResponseData(shape, types, depth, visited) {
|
|
5627
5739
|
if (depth <= 0) {
|
|
@@ -6582,6 +6694,7 @@ var Transformer = class _Transformer {
|
|
|
6582
6694
|
GraphQlOperationIdSchema,
|
|
6583
6695
|
GraphQlOperationSchema,
|
|
6584
6696
|
GraphQlOperationTypeSchema,
|
|
6697
|
+
GraphQlTypeCategorySchema,
|
|
6585
6698
|
GrpcId,
|
|
6586
6699
|
GrpcIdSchema,
|
|
6587
6700
|
GrpcMethod,
|