@fern-api/fdr-sdk 1.2.55-46f658b255 → 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
|
@@ -179,6 +179,7 @@ __export(navigation_exports, {
|
|
|
179
179
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
180
180
|
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
181
181
|
getChildren: () => getChildren,
|
|
182
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
182
183
|
getPageId: () => getPageId,
|
|
183
184
|
hasMarkdown: () => hasMarkdown,
|
|
184
185
|
hasMetadata: () => hasMetadata,
|
|
@@ -383,6 +384,11 @@ var GraphQlOperationIdSchema = z2.string();
|
|
|
383
384
|
function GraphQlOperationId(value) {
|
|
384
385
|
return value;
|
|
385
386
|
}
|
|
387
|
+
function getGraphqlOperationIds(node) {
|
|
388
|
+
const ids = new Set(node.graphqlOperationIds ?? []);
|
|
389
|
+
ids.add(node.graphqlOperationId);
|
|
390
|
+
return [...ids];
|
|
391
|
+
}
|
|
386
392
|
var GraphQlTypeCategorySchema = z2.enum(["object", "input", "enum", "scalar", "interface", "union"]);
|
|
387
393
|
var EnvironmentIdSchema = z2.string();
|
|
388
394
|
function EnvironmentId(value) {
|
|
@@ -2217,7 +2223,7 @@ var ApiDefinitionPruner = class {
|
|
|
2217
2223
|
if (node.type !== "graphql" || graphqlOperations == null) {
|
|
2218
2224
|
return [];
|
|
2219
2225
|
}
|
|
2220
|
-
const idsToInclude = new Set(node
|
|
2226
|
+
const idsToInclude = new Set(getGraphqlOperationIds(node));
|
|
2221
2227
|
return graphqlOperations.filter((op) => idsToInclude.has(ApiDefinitionHolder.createGraphQlOperationId(op)));
|
|
2222
2228
|
}
|
|
2223
2229
|
};
|
|
@@ -2396,6 +2402,7 @@ __export(api_definition_exports, {
|
|
|
2396
2402
|
generateHttpSnippets: () => generateHttpSnippets,
|
|
2397
2403
|
generateSdkSnippetForLanguage: () => generateSdkSnippetForLanguage,
|
|
2398
2404
|
generateSdkSnippets: () => generateSdkSnippets,
|
|
2405
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
2399
2406
|
getHarRequest: () => getHarRequest,
|
|
2400
2407
|
getMessageForStatus: () => getMessageForStatus,
|
|
2401
2408
|
joiner: () => joiner,
|
|
@@ -4035,8 +4042,7 @@ var ApiDefinitionPruner2 = class _ApiDefinitionPruner {
|
|
|
4035
4042
|
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
4036
4043
|
}
|
|
4037
4044
|
} else if (node.type === "graphql") {
|
|
4038
|
-
const
|
|
4039
|
-
for (const opId of idsToInclude) {
|
|
4045
|
+
for (const opId of getGraphqlOperationIds(node)) {
|
|
4040
4046
|
const found = this.api.graphqlOperations[opId];
|
|
4041
4047
|
if (found) {
|
|
4042
4048
|
toRet.graphqlOperations[opId] = found;
|
|
@@ -6271,7 +6277,8 @@ function generateGraphQlSnippet(context) {
|
|
|
6271
6277
|
const fieldPath = operation.fieldPath;
|
|
6272
6278
|
const hasFieldPath = fieldPath != null && fieldPath.length > 0;
|
|
6273
6279
|
const selectionSetIndent = hasFieldPath ? 2 + fieldPath.length : 2;
|
|
6274
|
-
const
|
|
6280
|
+
const initialDepth = isReturnTypeNamespace(operation.returnType, types) ? DEFAULT_MAX_DEPTH + 1 : DEFAULT_MAX_DEPTH;
|
|
6281
|
+
const selectionSet = generateSelectionSet(operation.returnType, types, initialDepth, /* @__PURE__ */ new Set(), selectionSetIndent);
|
|
6275
6282
|
let query = operationKeyword;
|
|
6276
6283
|
if (operationName || variableDefinitions.length > 0) {
|
|
6277
6284
|
query += ` ${operationName}`;
|
|
@@ -6521,6 +6528,18 @@ function generateExamplePrimitiveValue(primitive) {
|
|
|
6521
6528
|
return "example";
|
|
6522
6529
|
}
|
|
6523
6530
|
}
|
|
6531
|
+
var DEFAULT_MAX_DEPTH = 2;
|
|
6532
|
+
function isReturnTypeNamespace(returnType, types) {
|
|
6533
|
+
const { shape } = unwrapReference(returnType, types);
|
|
6534
|
+
if (shape.type !== "object") {
|
|
6535
|
+
return false;
|
|
6536
|
+
}
|
|
6537
|
+
const properties = shape.properties ?? [];
|
|
6538
|
+
if (properties.length === 0) {
|
|
6539
|
+
return false;
|
|
6540
|
+
}
|
|
6541
|
+
return properties.every((prop) => prop.arguments != null && prop.arguments.length > 0);
|
|
6542
|
+
}
|
|
6524
6543
|
function generateSelectionSet(shape, types, depth, visited = /* @__PURE__ */ new Set(), indentLevel = 2) {
|
|
6525
6544
|
if (depth <= 0) {
|
|
6526
6545
|
return "";
|
|
@@ -9368,7 +9387,8 @@ __export(APIV1Db_exports, {
|
|
|
9368
9387
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
9369
9388
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
9370
9389
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
9371
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
9390
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
9391
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
9372
9392
|
});
|
|
9373
9393
|
|
|
9374
9394
|
// src/orpc-client/api/contract-db.ts
|
|
@@ -9677,7 +9697,8 @@ __export(APIV1Read_exports, {
|
|
|
9677
9697
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
9678
9698
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
9679
9699
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
9680
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
9700
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
9701
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
9681
9702
|
});
|
|
9682
9703
|
var WebSocketMessageOrigin = {
|
|
9683
9704
|
Client: "client",
|
|
@@ -9869,7 +9890,8 @@ __export(APIV1Write_exports, {
|
|
|
9869
9890
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
9870
9891
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
9871
9892
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
9872
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
9893
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
9894
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
9873
9895
|
});
|
|
9874
9896
|
|
|
9875
9897
|
// src/client/DocsV1Db.ts
|
|
@@ -10874,6 +10896,7 @@ __export(FdrAPI_exports, {
|
|
|
10874
10896
|
WithNamespaceSchema: () => WithNamespaceSchema,
|
|
10875
10897
|
api: () => api,
|
|
10876
10898
|
docs: () => docs,
|
|
10899
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
10877
10900
|
libraryDocs: () => libraryDocs,
|
|
10878
10901
|
navigation: () => navigation,
|
|
10879
10902
|
sdks: () => sdks
|
|
@@ -11489,6 +11512,7 @@ __export(v1_exports2, {
|
|
|
11489
11512
|
convertAvailability: () => convertAvailability,
|
|
11490
11513
|
followRedirect: () => followRedirect,
|
|
11491
11514
|
followRedirects: () => followRedirects,
|
|
11515
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
11492
11516
|
getPageId: () => getPageId2,
|
|
11493
11517
|
hasMarkdown: () => hasMarkdown2,
|
|
11494
11518
|
hasMetadata: () => hasMetadata2,
|
|
@@ -12083,9 +12107,21 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
12083
12107
|
insertionOrder.push({ type: "flat", op });
|
|
12084
12108
|
}
|
|
12085
12109
|
}
|
|
12110
|
+
const parentOps = /* @__PURE__ */ new Map();
|
|
12111
|
+
const filteredInsertionOrder = insertionOrder.filter((entry) => {
|
|
12112
|
+
if (entry.type === "flat" && entry.op.operationType === "QUERY") {
|
|
12113
|
+
const fp = entry.op.fieldPath;
|
|
12114
|
+
const hasNoFieldPath = fp == null || fp.length === 0;
|
|
12115
|
+
if (hasNoFieldPath && groupedByParent.has(entry.op.name)) {
|
|
12116
|
+
parentOps.set(entry.op.name, entry.op);
|
|
12117
|
+
return false;
|
|
12118
|
+
}
|
|
12119
|
+
}
|
|
12120
|
+
return true;
|
|
12121
|
+
});
|
|
12086
12122
|
const children = [];
|
|
12087
12123
|
const allSlugs = /* @__PURE__ */ new Set();
|
|
12088
|
-
for (const entry of
|
|
12124
|
+
for (const entry of filteredInsertionOrder) {
|
|
12089
12125
|
if (entry.type === "flat") {
|
|
12090
12126
|
const fp = entry.op.fieldPath;
|
|
12091
12127
|
allSlugs.add(fp != null && fp.length > 0 ? [...fp, entry.op.name].join("-") : entry.op.name);
|
|
@@ -12093,7 +12129,7 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
12093
12129
|
allSlugs.add(entry.parentField);
|
|
12094
12130
|
}
|
|
12095
12131
|
}
|
|
12096
|
-
for (const entry of
|
|
12132
|
+
for (const entry of filteredInsertionOrder) {
|
|
12097
12133
|
if (entry.type === "flat") {
|
|
12098
12134
|
const opId = ApiDefinitionHolder.createGraphQlOperationId(entry.op);
|
|
12099
12135
|
children.push(this.convertGraphQlNode(opId, entry.op, parentSlug));
|
|
@@ -12102,11 +12138,12 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
12102
12138
|
if (operations == null) {
|
|
12103
12139
|
continue;
|
|
12104
12140
|
}
|
|
12105
|
-
const
|
|
12106
|
-
const
|
|
12107
|
-
const
|
|
12141
|
+
const parentOp = parentOps.get(entry.parentField);
|
|
12142
|
+
const primaryOp = parentOp ?? operations[0];
|
|
12143
|
+
const opId = ApiDefinitionHolder.createGraphQlOperationId(primaryOp);
|
|
12144
|
+
const childOpIds = operations.map((op) => ApiDefinitionHolder.createGraphQlOperationId(op));
|
|
12108
12145
|
let slugSegment = entry.parentField;
|
|
12109
|
-
const flatHasSameSlug =
|
|
12146
|
+
const flatHasSameSlug = filteredInsertionOrder.some(
|
|
12110
12147
|
(e) => e.type === "flat" && (() => {
|
|
12111
12148
|
const fp = e.op.fieldPath;
|
|
12112
12149
|
const s = fp != null && fp.length > 0 ? [...fp, e.op.name].join("-") : e.op.name;
|
|
@@ -12122,13 +12159,13 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
12122
12159
|
type: "graphql",
|
|
12123
12160
|
title: entry.parentField,
|
|
12124
12161
|
graphqlOperationId: opId,
|
|
12125
|
-
graphqlOperationIds:
|
|
12162
|
+
graphqlOperationIds: childOpIds.length > 0 ? childOpIds : void 0,
|
|
12126
12163
|
slug: parentSlug.apply({ urlSlug: slugSegment }).get(),
|
|
12127
12164
|
icon: void 0,
|
|
12128
12165
|
hidden: void 0,
|
|
12129
|
-
operationType:
|
|
12166
|
+
operationType: primaryOp.operationType,
|
|
12130
12167
|
apiDefinitionId: this.apiDefinitionId,
|
|
12131
|
-
availability: navigation_exports.V1.convertAvailability(
|
|
12168
|
+
availability: navigation_exports.V1.convertAvailability(primaryOp.availability),
|
|
12132
12169
|
playground: void 0,
|
|
12133
12170
|
authed: void 0,
|
|
12134
12171
|
collapsed: void 0,
|
|
@@ -15142,6 +15179,7 @@ var Pruner = class _Pruner {
|
|
|
15142
15179
|
WithAvailabilitySchema,
|
|
15143
15180
|
WithDescriptionSchema,
|
|
15144
15181
|
getChildren,
|
|
15182
|
+
getGraphqlOperationIds,
|
|
15145
15183
|
getPageId,
|
|
15146
15184
|
hasMarkdown,
|
|
15147
15185
|
hasMetadata,
|