@fern-api/fdr-sdk 1.2.55-96e4dcb407 → 1.2.55-b3cd01f2cc
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/api-definition/prune.d.ts.map +1 -1
- package/dist/api-definition/prune.js +2 -2
- package/dist/api-definition/prune.js.map +1 -1
- package/dist/api-definition/snippets/graphql-snippets.d.ts.map +1 -1
- package/dist/api-definition/snippets/graphql-snippets.js +27 -3
- package/dist/api-definition/snippets/graphql-snippets.js.map +1 -1
- package/dist/api-definition/snippets/graphql-snippets.test.js +226 -3
- package/dist/api-definition/snippets/graphql-snippets.test.js.map +1 -1
- package/dist/js/api-definition/index.js +22 -3
- package/dist/js/api-definition/index.js.map +1 -1
- package/dist/js/api-definition/index.mjs +21 -3
- package/dist/js/api-definition/index.mjs.map +1 -1
- package/dist/js/client/FdrClient.js.map +1 -1
- package/dist/js/client/FdrClient.mjs.map +1 -1
- package/dist/js/client/types.js +12 -3
- package/dist/js/client/types.js.map +1 -1
- package/dist/js/client/types.mjs +12 -3
- package/dist/js/client/types.mjs.map +1 -1
- package/dist/js/converters/index.js +53 -16
- package/dist/js/converters/index.js.map +1 -1
- package/dist/js/converters/index.mjs +53 -16
- package/dist/js/converters/index.mjs.map +1 -1
- package/dist/js/index.js +53 -16
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +53 -16
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/index.js +54 -16
- package/dist/js/navigation/index.js.map +1 -1
- package/dist/js/navigation/index.mjs +54 -16
- package/dist/js/navigation/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/js/orpc-client.js +7 -0
- package/dist/js/orpc-client.js.map +1 -1
- package/dist/js/orpc-client.mjs +6 -0
- package/dist/js/orpc-client.mjs.map +1 -1
- package/dist/navigation/ApiDefinitionPruner.d.ts.map +1 -1
- package/dist/navigation/ApiDefinitionPruner.js +2 -1
- package/dist/navigation/ApiDefinitionPruner.js.map +1 -1
- package/dist/navigation/versions/v1/converters/ApiReferenceNavigationConverter.d.ts.map +1 -1
- package/dist/navigation/versions/v1/converters/ApiReferenceNavigationConverter.js +28 -13
- package/dist/navigation/versions/v1/converters/ApiReferenceNavigationConverter.js.map +1 -1
- package/dist/navigation/versions/v1/converters/__test__/ApiReferenceNavigationConverter.graphql.test.js +37 -8
- package/dist/navigation/versions/v1/converters/__test__/ApiReferenceNavigationConverter.graphql.test.js.map +1 -1
- package/dist/orpc-client/api/shared.d.ts +14 -0
- package/dist/orpc-client/api/shared.d.ts.map +1 -1
- package/dist/orpc-client/api/shared.js +15 -0
- package/dist/orpc-client/api/shared.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- 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/navigation/ApiDefinitionPruner.d.ts.map +1 -1
- package/dist/types/navigation/versions/v1/converters/ApiReferenceNavigationConverter.d.ts.map +1 -1
- package/dist/types/orpc-client/api/shared.d.ts +14 -0
- package/dist/types/orpc-client/api/shared.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/js/index.mjs
CHANGED
|
@@ -175,6 +175,7 @@ __export(api_definition_exports, {
|
|
|
175
175
|
generateHttpSnippets: () => generateHttpSnippets,
|
|
176
176
|
generateSdkSnippetForLanguage: () => generateSdkSnippetForLanguage,
|
|
177
177
|
generateSdkSnippets: () => generateSdkSnippets,
|
|
178
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
178
179
|
getHarRequest: () => getHarRequest,
|
|
179
180
|
getMessageForStatus: () => getMessageForStatus,
|
|
180
181
|
joiner: () => joiner,
|
|
@@ -1058,6 +1059,11 @@ var GraphQlOperationIdSchema = z2.string();
|
|
|
1058
1059
|
function GraphQlOperationId(value) {
|
|
1059
1060
|
return value;
|
|
1060
1061
|
}
|
|
1062
|
+
function getGraphqlOperationIds(node) {
|
|
1063
|
+
const ids = new Set(node.graphqlOperationIds ?? []);
|
|
1064
|
+
ids.add(node.graphqlOperationId);
|
|
1065
|
+
return [...ids];
|
|
1066
|
+
}
|
|
1061
1067
|
var GraphQlTypeCategorySchema = z2.enum(["object", "input", "enum", "scalar", "interface", "union"]);
|
|
1062
1068
|
var EnvironmentIdSchema = z2.string();
|
|
1063
1069
|
function EnvironmentId(value) {
|
|
@@ -3187,8 +3193,7 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
3187
3193
|
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
3188
3194
|
}
|
|
3189
3195
|
} else if (node.type === "graphql") {
|
|
3190
|
-
const
|
|
3191
|
-
for (const opId of idsToInclude) {
|
|
3196
|
+
for (const opId of getGraphqlOperationIds(node)) {
|
|
3192
3197
|
const found = this.api.graphqlOperations[opId];
|
|
3193
3198
|
if (found) {
|
|
3194
3199
|
toRet.graphqlOperations[opId] = found;
|
|
@@ -5426,7 +5431,8 @@ function generateGraphQlSnippet(context) {
|
|
|
5426
5431
|
const fieldPath = operation.fieldPath;
|
|
5427
5432
|
const hasFieldPath = fieldPath != null && fieldPath.length > 0;
|
|
5428
5433
|
const selectionSetIndent = hasFieldPath ? 2 + fieldPath.length : 2;
|
|
5429
|
-
const
|
|
5434
|
+
const initialDepth = isReturnTypeNamespace(operation.returnType, types) ? DEFAULT_MAX_DEPTH + 1 : DEFAULT_MAX_DEPTH;
|
|
5435
|
+
const selectionSet = generateSelectionSet(operation.returnType, types, initialDepth, /* @__PURE__ */ new Set(), selectionSetIndent);
|
|
5430
5436
|
let query = operationKeyword;
|
|
5431
5437
|
if (operationName || variableDefinitions.length > 0) {
|
|
5432
5438
|
query += ` ${operationName}`;
|
|
@@ -5676,6 +5682,18 @@ function generateExamplePrimitiveValue(primitive) {
|
|
|
5676
5682
|
return "example";
|
|
5677
5683
|
}
|
|
5678
5684
|
}
|
|
5685
|
+
var DEFAULT_MAX_DEPTH = 2;
|
|
5686
|
+
function isReturnTypeNamespace(returnType, types) {
|
|
5687
|
+
const { shape } = unwrapReference(returnType, types);
|
|
5688
|
+
if (shape.type !== "object") {
|
|
5689
|
+
return false;
|
|
5690
|
+
}
|
|
5691
|
+
const properties = shape.properties ?? [];
|
|
5692
|
+
if (properties.length === 0) {
|
|
5693
|
+
return false;
|
|
5694
|
+
}
|
|
5695
|
+
return properties.every((prop) => prop.arguments != null && prop.arguments.length > 0);
|
|
5696
|
+
}
|
|
5679
5697
|
function generateSelectionSet(shape, types, depth, visited = /* @__PURE__ */ new Set(), indentLevel = 2) {
|
|
5680
5698
|
if (depth <= 0) {
|
|
5681
5699
|
return "";
|
|
@@ -10886,7 +10904,8 @@ __export(APIV1Db_exports, {
|
|
|
10886
10904
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
10887
10905
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
10888
10906
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
10889
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
10907
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
10908
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
10890
10909
|
});
|
|
10891
10910
|
|
|
10892
10911
|
// src/orpc-client/api/contract-db.ts
|
|
@@ -11195,7 +11214,8 @@ __export(APIV1Read_exports, {
|
|
|
11195
11214
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
11196
11215
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
11197
11216
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
11198
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
11217
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
11218
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
11199
11219
|
});
|
|
11200
11220
|
var WebSocketMessageOrigin = {
|
|
11201
11221
|
Client: "client",
|
|
@@ -11387,7 +11407,8 @@ __export(APIV1Write_exports, {
|
|
|
11387
11407
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
11388
11408
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
11389
11409
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
11390
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
11410
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
11411
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
11391
11412
|
});
|
|
11392
11413
|
|
|
11393
11414
|
// src/client/DocsV1Db.ts
|
|
@@ -12392,6 +12413,7 @@ __export(FdrAPI_exports, {
|
|
|
12392
12413
|
WithNamespaceSchema: () => WithNamespaceSchema,
|
|
12393
12414
|
api: () => api,
|
|
12394
12415
|
docs: () => docs,
|
|
12416
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
12395
12417
|
libraryDocs: () => libraryDocs,
|
|
12396
12418
|
navigation: () => navigation,
|
|
12397
12419
|
sdks: () => sdks
|
|
@@ -15666,6 +15688,7 @@ __export(navigation_exports, {
|
|
|
15666
15688
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
15667
15689
|
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
15668
15690
|
getChildren: () => getChildren,
|
|
15691
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
15669
15692
|
getPageId: () => getPageId,
|
|
15670
15693
|
hasMarkdown: () => hasMarkdown,
|
|
15671
15694
|
hasMetadata: () => hasMetadata,
|
|
@@ -16302,7 +16325,7 @@ var ApiDefinitionPruner2 = class {
|
|
|
16302
16325
|
if (node.type !== "graphql" || graphqlOperations == null) {
|
|
16303
16326
|
return [];
|
|
16304
16327
|
}
|
|
16305
|
-
const idsToInclude = new Set(node
|
|
16328
|
+
const idsToInclude = new Set(getGraphqlOperationIds(node));
|
|
16306
16329
|
return graphqlOperations.filter((op) => idsToInclude.has(ApiDefinitionHolder.createGraphQlOperationId(op)));
|
|
16307
16330
|
}
|
|
16308
16331
|
};
|
|
@@ -16492,6 +16515,7 @@ __export(v1_exports2, {
|
|
|
16492
16515
|
convertAvailability: () => convertAvailability,
|
|
16493
16516
|
followRedirect: () => followRedirect,
|
|
16494
16517
|
followRedirects: () => followRedirects,
|
|
16518
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
16495
16519
|
getPageId: () => getPageId2,
|
|
16496
16520
|
hasMarkdown: () => hasMarkdown2,
|
|
16497
16521
|
hasMetadata: () => hasMetadata2,
|
|
@@ -17086,9 +17110,21 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
17086
17110
|
insertionOrder.push({ type: "flat", op });
|
|
17087
17111
|
}
|
|
17088
17112
|
}
|
|
17113
|
+
const parentOps = /* @__PURE__ */ new Map();
|
|
17114
|
+
const filteredInsertionOrder = insertionOrder.filter((entry) => {
|
|
17115
|
+
if (entry.type === "flat" && entry.op.operationType === "QUERY") {
|
|
17116
|
+
const fp = entry.op.fieldPath;
|
|
17117
|
+
const hasNoFieldPath = fp == null || fp.length === 0;
|
|
17118
|
+
if (hasNoFieldPath && groupedByParent.has(entry.op.name)) {
|
|
17119
|
+
parentOps.set(entry.op.name, entry.op);
|
|
17120
|
+
return false;
|
|
17121
|
+
}
|
|
17122
|
+
}
|
|
17123
|
+
return true;
|
|
17124
|
+
});
|
|
17089
17125
|
const children = [];
|
|
17090
17126
|
const allSlugs = /* @__PURE__ */ new Set();
|
|
17091
|
-
for (const entry of
|
|
17127
|
+
for (const entry of filteredInsertionOrder) {
|
|
17092
17128
|
if (entry.type === "flat") {
|
|
17093
17129
|
const fp = entry.op.fieldPath;
|
|
17094
17130
|
allSlugs.add(fp != null && fp.length > 0 ? [...fp, entry.op.name].join("-") : entry.op.name);
|
|
@@ -17096,7 +17132,7 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
17096
17132
|
allSlugs.add(entry.parentField);
|
|
17097
17133
|
}
|
|
17098
17134
|
}
|
|
17099
|
-
for (const entry of
|
|
17135
|
+
for (const entry of filteredInsertionOrder) {
|
|
17100
17136
|
if (entry.type === "flat") {
|
|
17101
17137
|
const opId = ApiDefinitionHolder.createGraphQlOperationId(entry.op);
|
|
17102
17138
|
children.push(this.convertGraphQlNode(opId, entry.op, parentSlug));
|
|
@@ -17105,11 +17141,12 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
17105
17141
|
if (operations == null) {
|
|
17106
17142
|
continue;
|
|
17107
17143
|
}
|
|
17108
|
-
const
|
|
17109
|
-
const
|
|
17110
|
-
const
|
|
17144
|
+
const parentOp = parentOps.get(entry.parentField);
|
|
17145
|
+
const primaryOp = parentOp ?? operations[0];
|
|
17146
|
+
const opId = ApiDefinitionHolder.createGraphQlOperationId(primaryOp);
|
|
17147
|
+
const childOpIds = operations.map((op) => ApiDefinitionHolder.createGraphQlOperationId(op));
|
|
17111
17148
|
let slugSegment = entry.parentField;
|
|
17112
|
-
const flatHasSameSlug =
|
|
17149
|
+
const flatHasSameSlug = filteredInsertionOrder.some(
|
|
17113
17150
|
(e) => e.type === "flat" && (() => {
|
|
17114
17151
|
const fp = e.op.fieldPath;
|
|
17115
17152
|
const s = fp != null && fp.length > 0 ? [...fp, e.op.name].join("-") : e.op.name;
|
|
@@ -17125,13 +17162,13 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
17125
17162
|
type: "graphql",
|
|
17126
17163
|
title: entry.parentField,
|
|
17127
17164
|
graphqlOperationId: opId,
|
|
17128
|
-
graphqlOperationIds:
|
|
17165
|
+
graphqlOperationIds: childOpIds.length > 0 ? childOpIds : void 0,
|
|
17129
17166
|
slug: parentSlug.apply({ urlSlug: slugSegment }).get(),
|
|
17130
17167
|
icon: void 0,
|
|
17131
17168
|
hidden: void 0,
|
|
17132
|
-
operationType:
|
|
17169
|
+
operationType: primaryOp.operationType,
|
|
17133
17170
|
apiDefinitionId: this.apiDefinitionId,
|
|
17134
|
-
availability: navigation_exports.V1.convertAvailability(
|
|
17171
|
+
availability: navigation_exports.V1.convertAvailability(primaryOp.availability),
|
|
17135
17172
|
playground: void 0,
|
|
17136
17173
|
authed: void 0,
|
|
17137
17174
|
collapsed: void 0,
|