@fern-api/fdr-sdk 1.2.33-830bfae69e → 1.2.33-83d745d750
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 +56 -13
- package/dist/js/api-definition/index.js.map +1 -1
- package/dist/js/api-definition/index.mjs +56 -13
- package/dist/js/api-definition/index.mjs.map +1 -1
- package/dist/js/client/FdrClient.js +2 -0
- package/dist/js/client/FdrClient.js.map +1 -1
- package/dist/js/client/FdrClient.mjs +2 -0
- package/dist/js/client/FdrClient.mjs.map +1 -1
- package/dist/js/client/types.js +2 -0
- package/dist/js/client/types.js.map +1 -1
- package/dist/js/client/types.mjs +2 -0
- package/dist/js/client/types.mjs.map +1 -1
- package/dist/js/converters/index.js +144 -27
- package/dist/js/converters/index.js.map +1 -1
- package/dist/js/converters/index.mjs +144 -27
- package/dist/js/converters/index.mjs.map +1 -1
- package/dist/js/index.js +144 -27
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +144 -27
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/index.js +144 -27
- package/dist/js/navigation/index.js.map +1 -1
- package/dist/js/navigation/index.mjs +144 -27
- package/dist/js/navigation/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +2 -0
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +2 -0
- 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 +2 -0
- package/dist/js/orpc-client.js.map +1 -1
- package/dist/js/orpc-client.mjs +2 -0
- package/dist/js/orpc-client.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +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.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/converters/read/convertDbAPIDefinitionToRead.d.ts +2 -0
- 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/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 +2 -0
- 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/toApis.d.ts +1 -0
- package/dist/types/navigation/utils/toApis.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 +24 -0
- package/dist/types/orpc-client/api/contract-db.d.ts.map +1 -1
- package/dist/types/orpc-client/api/contract-latest.d.ts +13 -0
- package/dist/types/orpc-client/api/contract-latest.d.ts.map +1 -1
- package/dist/types/orpc-client/api/contract-read.d.ts +24 -0
- package/dist/types/orpc-client/api/contract-read.d.ts.map +1 -1
- package/dist/types/orpc-client/api/contract-register.d.ts +24 -0
- package/dist/types/orpc-client/api/contract-register.d.ts.map +1 -1
- package/dist/types/orpc-client/api/shared.d.ts +3 -0
- package/dist/types/orpc-client/api/shared.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1466,6 +1466,7 @@ var GraphQlOperationSchema = z2.object({
|
|
|
1466
1466
|
operationType: GraphQlOperationTypeSchema,
|
|
1467
1467
|
name: z2.string(),
|
|
1468
1468
|
displayName: z2.string().nullish(),
|
|
1469
|
+
fieldPath: z2.array(z2.string()).nullish(),
|
|
1469
1470
|
arguments: z2.array(GraphQlArgumentSchema).nullish(),
|
|
1470
1471
|
returnType: TypeReferenceSchema,
|
|
1471
1472
|
examples: z2.array(GraphQlExampleSchema).nullish(),
|
|
@@ -2266,6 +2267,7 @@ var LatestGraphQlOperationSchema = z4.object({
|
|
|
2266
2267
|
description: z4.string().nullish(),
|
|
2267
2268
|
availability: AvailabilitySchema.nullish(),
|
|
2268
2269
|
namespace: z4.array(z4.string()).nullish(),
|
|
2270
|
+
fieldPath: z4.array(z4.string()).nullish(),
|
|
2269
2271
|
id: GraphQlOperationIdSchema,
|
|
2270
2272
|
operationType: LatestGraphQlOperationTypeSchema,
|
|
2271
2273
|
name: z4.string(),
|
|
@@ -3166,10 +3168,13 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
3166
3168
|
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
3167
3169
|
}
|
|
3168
3170
|
} else if (node.type === "graphql") {
|
|
3169
|
-
const
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
found
|
|
3171
|
+
const idsToInclude = node.graphqlOperationIds ?? [node.graphqlOperationId];
|
|
3172
|
+
for (const opId of idsToInclude) {
|
|
3173
|
+
const found = this.api.graphqlOperations[opId];
|
|
3174
|
+
if (found) {
|
|
3175
|
+
toRet.graphqlOperations[opId] = found;
|
|
3176
|
+
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
3177
|
+
}
|
|
3173
3178
|
}
|
|
3174
3179
|
}
|
|
3175
3180
|
}
|
|
@@ -3471,9 +3476,21 @@ function createGraphqlContext(node, apiDefinition) {
|
|
|
3471
3476
|
);
|
|
3472
3477
|
return void 0;
|
|
3473
3478
|
}
|
|
3479
|
+
const allIds = node.graphqlOperationIds ?? [node.graphqlOperationId];
|
|
3480
|
+
const operations = [];
|
|
3481
|
+
for (const id of allIds) {
|
|
3482
|
+
const op = api.graphqlOperations[id];
|
|
3483
|
+
if (op) {
|
|
3484
|
+
operations.push(op);
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3487
|
+
if (operations.length === 0) {
|
|
3488
|
+
operations.push(operation);
|
|
3489
|
+
}
|
|
3474
3490
|
return {
|
|
3475
3491
|
node,
|
|
3476
3492
|
operation,
|
|
3493
|
+
operations,
|
|
3477
3494
|
types: api.types
|
|
3478
3495
|
};
|
|
3479
3496
|
}
|
|
@@ -5085,6 +5102,7 @@ var ApiDefinitionV1ToLatest = class _ApiDefinitionV1ToLatest {
|
|
|
5085
5102
|
description: v1?.description,
|
|
5086
5103
|
availability: v1?.availability,
|
|
5087
5104
|
namespace,
|
|
5105
|
+
fieldPath: v1?.fieldPath,
|
|
5088
5106
|
arguments: v1?.arguments?.map((arg) => this.migrateGraphQlArgument(arg)),
|
|
5089
5107
|
returnType: {
|
|
5090
5108
|
type: "alias",
|
|
@@ -5381,7 +5399,10 @@ function generateGraphQlSnippet(context) {
|
|
|
5381
5399
|
return `$${arg.name}: ${graphqlType}`;
|
|
5382
5400
|
});
|
|
5383
5401
|
const argumentUsage = args.map((arg) => `${arg.name}: $${arg.name}`);
|
|
5384
|
-
const
|
|
5402
|
+
const fieldPath = operation.fieldPath;
|
|
5403
|
+
const hasFieldPath = fieldPath != null && fieldPath.length > 0;
|
|
5404
|
+
const selectionSetIndent = hasFieldPath ? 2 + fieldPath.length : 2;
|
|
5405
|
+
const selectionSet = generateSelectionSet(operation.returnType, types, 2, /* @__PURE__ */ new Set(), selectionSetIndent);
|
|
5385
5406
|
let query = operationKeyword;
|
|
5386
5407
|
if (operationName || variableDefinitions.length > 0) {
|
|
5387
5408
|
query += ` ${operationName}`;
|
|
@@ -5390,15 +5411,32 @@ function generateGraphQlSnippet(context) {
|
|
|
5390
5411
|
}
|
|
5391
5412
|
}
|
|
5392
5413
|
query += " {\n";
|
|
5393
|
-
|
|
5414
|
+
const baseIndent = 2;
|
|
5415
|
+
if (hasFieldPath) {
|
|
5416
|
+
for (let i = 0; i < fieldPath.length; i++) {
|
|
5417
|
+
const indent = " ".repeat(baseIndent + i * 2);
|
|
5418
|
+
query += `${indent}${fieldPath[i]} {
|
|
5419
|
+
`;
|
|
5420
|
+
}
|
|
5421
|
+
}
|
|
5422
|
+
const operationIndent = hasFieldPath ? " ".repeat(baseIndent + fieldPath.length * 2) : " ";
|
|
5423
|
+
query += `${operationIndent}${operation.name}`;
|
|
5394
5424
|
if (argumentUsage.length > 0) {
|
|
5395
5425
|
query += `(${argumentUsage.join(", ")})`;
|
|
5396
5426
|
}
|
|
5397
5427
|
if (selectionSet) {
|
|
5398
5428
|
query += ` ${selectionSet}`;
|
|
5399
5429
|
}
|
|
5400
|
-
query += "\n
|
|
5401
|
-
|
|
5430
|
+
query += "\n";
|
|
5431
|
+
if (hasFieldPath) {
|
|
5432
|
+
for (let i = fieldPath.length - 1; i >= 0; i--) {
|
|
5433
|
+
const indent = " ".repeat(baseIndent + i * 2);
|
|
5434
|
+
query += `${indent}}
|
|
5435
|
+
`;
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5438
|
+
query += "}";
|
|
5439
|
+
const response = generateResponseExample(operation.name, operation.returnType, types, fieldPath);
|
|
5402
5440
|
const result = { query, variables, response };
|
|
5403
5441
|
snippetCache.set(operation, result);
|
|
5404
5442
|
return result;
|
|
@@ -5682,13 +5720,18 @@ function generateSelectionSetFromReference(ref, types, depth, visited, indentLev
|
|
|
5682
5720
|
return "";
|
|
5683
5721
|
}
|
|
5684
5722
|
}
|
|
5685
|
-
function generateResponseExample(operationName, returnType, types) {
|
|
5723
|
+
function generateResponseExample(operationName, returnType, types, fieldPath) {
|
|
5686
5724
|
const data = generateResponseData(returnType, types, 3, /* @__PURE__ */ new Set());
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5725
|
+
let responseData = { [operationName]: data };
|
|
5726
|
+
if (fieldPath != null && fieldPath.length > 0) {
|
|
5727
|
+
for (let i = fieldPath.length - 1; i >= 0; i--) {
|
|
5728
|
+
const key = fieldPath[i];
|
|
5729
|
+
if (key != null) {
|
|
5730
|
+
responseData = { [key]: responseData };
|
|
5731
|
+
}
|
|
5690
5732
|
}
|
|
5691
|
-
}
|
|
5733
|
+
}
|
|
5734
|
+
return { data: responseData };
|
|
5692
5735
|
}
|
|
5693
5736
|
function generateResponseData(shape, types, depth, visited) {
|
|
5694
5737
|
if (depth <= 0) {
|