@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
|
@@ -1249,6 +1249,7 @@ var GraphQlOperationSchema = z2.object({
|
|
|
1249
1249
|
operationType: GraphQlOperationTypeSchema,
|
|
1250
1250
|
name: z2.string(),
|
|
1251
1251
|
displayName: z2.string().nullish(),
|
|
1252
|
+
fieldPath: z2.array(z2.string()).nullish(),
|
|
1252
1253
|
arguments: z2.array(GraphQlArgumentSchema).nullish(),
|
|
1253
1254
|
returnType: TypeReferenceSchema,
|
|
1254
1255
|
examples: z2.array(GraphQlExampleSchema).nullish(),
|
|
@@ -2049,6 +2050,7 @@ var LatestGraphQlOperationSchema = z4.object({
|
|
|
2049
2050
|
description: z4.string().nullish(),
|
|
2050
2051
|
availability: AvailabilitySchema.nullish(),
|
|
2051
2052
|
namespace: z4.array(z4.string()).nullish(),
|
|
2053
|
+
fieldPath: z4.array(z4.string()).nullish(),
|
|
2052
2054
|
id: GraphQlOperationIdSchema,
|
|
2053
2055
|
operationType: LatestGraphQlOperationTypeSchema,
|
|
2054
2056
|
name: z4.string(),
|
|
@@ -2949,10 +2951,13 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
2949
2951
|
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
2950
2952
|
}
|
|
2951
2953
|
} else if (node.type === "graphql") {
|
|
2952
|
-
const
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
found
|
|
2954
|
+
const idsToInclude = node.graphqlOperationIds ?? [node.graphqlOperationId];
|
|
2955
|
+
for (const opId of idsToInclude) {
|
|
2956
|
+
const found = this.api.graphqlOperations[opId];
|
|
2957
|
+
if (found) {
|
|
2958
|
+
toRet.graphqlOperations[opId] = found;
|
|
2959
|
+
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
2960
|
+
}
|
|
2956
2961
|
}
|
|
2957
2962
|
}
|
|
2958
2963
|
}
|
|
@@ -3254,9 +3259,21 @@ function createGraphqlContext(node, apiDefinition) {
|
|
|
3254
3259
|
);
|
|
3255
3260
|
return void 0;
|
|
3256
3261
|
}
|
|
3262
|
+
const allIds = node.graphqlOperationIds ?? [node.graphqlOperationId];
|
|
3263
|
+
const operations = [];
|
|
3264
|
+
for (const id of allIds) {
|
|
3265
|
+
const op = api.graphqlOperations[id];
|
|
3266
|
+
if (op) {
|
|
3267
|
+
operations.push(op);
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
if (operations.length === 0) {
|
|
3271
|
+
operations.push(operation);
|
|
3272
|
+
}
|
|
3257
3273
|
return {
|
|
3258
3274
|
node,
|
|
3259
3275
|
operation,
|
|
3276
|
+
operations,
|
|
3260
3277
|
types: api.types
|
|
3261
3278
|
};
|
|
3262
3279
|
}
|
|
@@ -4868,6 +4885,7 @@ var ApiDefinitionV1ToLatest = class _ApiDefinitionV1ToLatest {
|
|
|
4868
4885
|
description: v1?.description,
|
|
4869
4886
|
availability: v1?.availability,
|
|
4870
4887
|
namespace,
|
|
4888
|
+
fieldPath: v1?.fieldPath,
|
|
4871
4889
|
arguments: v1?.arguments?.map((arg) => this.migrateGraphQlArgument(arg)),
|
|
4872
4890
|
returnType: {
|
|
4873
4891
|
type: "alias",
|
|
@@ -5164,7 +5182,10 @@ function generateGraphQlSnippet(context) {
|
|
|
5164
5182
|
return `$${arg.name}: ${graphqlType}`;
|
|
5165
5183
|
});
|
|
5166
5184
|
const argumentUsage = args.map((arg) => `${arg.name}: $${arg.name}`);
|
|
5167
|
-
const
|
|
5185
|
+
const fieldPath = operation.fieldPath;
|
|
5186
|
+
const hasFieldPath = fieldPath != null && fieldPath.length > 0;
|
|
5187
|
+
const selectionSetIndent = hasFieldPath ? 2 + fieldPath.length : 2;
|
|
5188
|
+
const selectionSet = generateSelectionSet(operation.returnType, types, 2, /* @__PURE__ */ new Set(), selectionSetIndent);
|
|
5168
5189
|
let query = operationKeyword;
|
|
5169
5190
|
if (operationName || variableDefinitions.length > 0) {
|
|
5170
5191
|
query += ` ${operationName}`;
|
|
@@ -5173,15 +5194,32 @@ function generateGraphQlSnippet(context) {
|
|
|
5173
5194
|
}
|
|
5174
5195
|
}
|
|
5175
5196
|
query += " {\n";
|
|
5176
|
-
|
|
5197
|
+
const baseIndent = 2;
|
|
5198
|
+
if (hasFieldPath) {
|
|
5199
|
+
for (let i = 0; i < fieldPath.length; i++) {
|
|
5200
|
+
const indent = " ".repeat(baseIndent + i * 2);
|
|
5201
|
+
query += `${indent}${fieldPath[i]} {
|
|
5202
|
+
`;
|
|
5203
|
+
}
|
|
5204
|
+
}
|
|
5205
|
+
const operationIndent = hasFieldPath ? " ".repeat(baseIndent + fieldPath.length * 2) : " ";
|
|
5206
|
+
query += `${operationIndent}${operation.name}`;
|
|
5177
5207
|
if (argumentUsage.length > 0) {
|
|
5178
5208
|
query += `(${argumentUsage.join(", ")})`;
|
|
5179
5209
|
}
|
|
5180
5210
|
if (selectionSet) {
|
|
5181
5211
|
query += ` ${selectionSet}`;
|
|
5182
5212
|
}
|
|
5183
|
-
query += "\n
|
|
5184
|
-
|
|
5213
|
+
query += "\n";
|
|
5214
|
+
if (hasFieldPath) {
|
|
5215
|
+
for (let i = fieldPath.length - 1; i >= 0; i--) {
|
|
5216
|
+
const indent = " ".repeat(baseIndent + i * 2);
|
|
5217
|
+
query += `${indent}}
|
|
5218
|
+
`;
|
|
5219
|
+
}
|
|
5220
|
+
}
|
|
5221
|
+
query += "}";
|
|
5222
|
+
const response = generateResponseExample(operation.name, operation.returnType, types, fieldPath);
|
|
5185
5223
|
const result = { query, variables, response };
|
|
5186
5224
|
snippetCache.set(operation, result);
|
|
5187
5225
|
return result;
|
|
@@ -5465,13 +5503,18 @@ function generateSelectionSetFromReference(ref, types, depth, visited, indentLev
|
|
|
5465
5503
|
return "";
|
|
5466
5504
|
}
|
|
5467
5505
|
}
|
|
5468
|
-
function generateResponseExample(operationName, returnType, types) {
|
|
5506
|
+
function generateResponseExample(operationName, returnType, types, fieldPath) {
|
|
5469
5507
|
const data = generateResponseData(returnType, types, 3, /* @__PURE__ */ new Set());
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5508
|
+
let responseData = { [operationName]: data };
|
|
5509
|
+
if (fieldPath != null && fieldPath.length > 0) {
|
|
5510
|
+
for (let i = fieldPath.length - 1; i >= 0; i--) {
|
|
5511
|
+
const key = fieldPath[i];
|
|
5512
|
+
if (key != null) {
|
|
5513
|
+
responseData = { [key]: responseData };
|
|
5514
|
+
}
|
|
5473
5515
|
}
|
|
5474
|
-
}
|
|
5516
|
+
}
|
|
5517
|
+
return { data: responseData };
|
|
5475
5518
|
}
|
|
5476
5519
|
function generateResponseData(shape, types, depth, visited) {
|
|
5477
5520
|
if (depth <= 0) {
|