@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
|
@@ -156,6 +156,7 @@ __export(navigation_exports, {
|
|
|
156
156
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
157
157
|
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
158
158
|
getChildren: () => getChildren,
|
|
159
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
159
160
|
getPageId: () => getPageId,
|
|
160
161
|
hasMarkdown: () => hasMarkdown,
|
|
161
162
|
hasMetadata: () => hasMetadata,
|
|
@@ -359,6 +360,11 @@ var GraphQlOperationIdSchema = z2.string();
|
|
|
359
360
|
function GraphQlOperationId(value) {
|
|
360
361
|
return value;
|
|
361
362
|
}
|
|
363
|
+
function getGraphqlOperationIds(node) {
|
|
364
|
+
const ids = new Set(node.graphqlOperationIds ?? []);
|
|
365
|
+
ids.add(node.graphqlOperationId);
|
|
366
|
+
return [...ids];
|
|
367
|
+
}
|
|
362
368
|
var GraphQlTypeCategorySchema = z2.enum(["object", "input", "enum", "scalar", "interface", "union"]);
|
|
363
369
|
var EnvironmentIdSchema = z2.string();
|
|
364
370
|
function EnvironmentId(value) {
|
|
@@ -2193,7 +2199,7 @@ var ApiDefinitionPruner = class {
|
|
|
2193
2199
|
if (node.type !== "graphql" || graphqlOperations == null) {
|
|
2194
2200
|
return [];
|
|
2195
2201
|
}
|
|
2196
|
-
const idsToInclude = new Set(node
|
|
2202
|
+
const idsToInclude = new Set(getGraphqlOperationIds(node));
|
|
2197
2203
|
return graphqlOperations.filter((op) => idsToInclude.has(ApiDefinitionHolder.createGraphQlOperationId(op)));
|
|
2198
2204
|
}
|
|
2199
2205
|
};
|
|
@@ -2372,6 +2378,7 @@ __export(api_definition_exports, {
|
|
|
2372
2378
|
generateHttpSnippets: () => generateHttpSnippets,
|
|
2373
2379
|
generateSdkSnippetForLanguage: () => generateSdkSnippetForLanguage,
|
|
2374
2380
|
generateSdkSnippets: () => generateSdkSnippets,
|
|
2381
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
2375
2382
|
getHarRequest: () => getHarRequest,
|
|
2376
2383
|
getMessageForStatus: () => getMessageForStatus,
|
|
2377
2384
|
joiner: () => joiner,
|
|
@@ -4011,8 +4018,7 @@ var ApiDefinitionPruner2 = class _ApiDefinitionPruner {
|
|
|
4011
4018
|
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
4012
4019
|
}
|
|
4013
4020
|
} else if (node.type === "graphql") {
|
|
4014
|
-
const
|
|
4015
|
-
for (const opId of idsToInclude) {
|
|
4021
|
+
for (const opId of getGraphqlOperationIds(node)) {
|
|
4016
4022
|
const found = this.api.graphqlOperations[opId];
|
|
4017
4023
|
if (found) {
|
|
4018
4024
|
toRet.graphqlOperations[opId] = found;
|
|
@@ -6247,7 +6253,8 @@ function generateGraphQlSnippet(context) {
|
|
|
6247
6253
|
const fieldPath = operation.fieldPath;
|
|
6248
6254
|
const hasFieldPath = fieldPath != null && fieldPath.length > 0;
|
|
6249
6255
|
const selectionSetIndent = hasFieldPath ? 2 + fieldPath.length : 2;
|
|
6250
|
-
const
|
|
6256
|
+
const initialDepth = isReturnTypeNamespace(operation.returnType, types) ? DEFAULT_MAX_DEPTH + 1 : DEFAULT_MAX_DEPTH;
|
|
6257
|
+
const selectionSet = generateSelectionSet(operation.returnType, types, initialDepth, /* @__PURE__ */ new Set(), selectionSetIndent);
|
|
6251
6258
|
let query = operationKeyword;
|
|
6252
6259
|
if (operationName || variableDefinitions.length > 0) {
|
|
6253
6260
|
query += ` ${operationName}`;
|
|
@@ -6497,6 +6504,18 @@ function generateExamplePrimitiveValue(primitive) {
|
|
|
6497
6504
|
return "example";
|
|
6498
6505
|
}
|
|
6499
6506
|
}
|
|
6507
|
+
var DEFAULT_MAX_DEPTH = 2;
|
|
6508
|
+
function isReturnTypeNamespace(returnType, types) {
|
|
6509
|
+
const { shape } = unwrapReference(returnType, types);
|
|
6510
|
+
if (shape.type !== "object") {
|
|
6511
|
+
return false;
|
|
6512
|
+
}
|
|
6513
|
+
const properties = shape.properties ?? [];
|
|
6514
|
+
if (properties.length === 0) {
|
|
6515
|
+
return false;
|
|
6516
|
+
}
|
|
6517
|
+
return properties.every((prop) => prop.arguments != null && prop.arguments.length > 0);
|
|
6518
|
+
}
|
|
6500
6519
|
function generateSelectionSet(shape, types, depth, visited = /* @__PURE__ */ new Set(), indentLevel = 2) {
|
|
6501
6520
|
if (depth <= 0) {
|
|
6502
6521
|
return "";
|
|
@@ -9344,7 +9363,8 @@ __export(APIV1Db_exports, {
|
|
|
9344
9363
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
9345
9364
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
9346
9365
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
9347
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
9366
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
9367
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
9348
9368
|
});
|
|
9349
9369
|
|
|
9350
9370
|
// src/orpc-client/api/contract-db.ts
|
|
@@ -9653,7 +9673,8 @@ __export(APIV1Read_exports, {
|
|
|
9653
9673
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
9654
9674
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
9655
9675
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
9656
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
9676
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
9677
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
9657
9678
|
});
|
|
9658
9679
|
var WebSocketMessageOrigin = {
|
|
9659
9680
|
Client: "client",
|
|
@@ -9845,7 +9866,8 @@ __export(APIV1Write_exports, {
|
|
|
9845
9866
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
9846
9867
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
9847
9868
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
9848
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
9869
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
9870
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
9849
9871
|
});
|
|
9850
9872
|
|
|
9851
9873
|
// src/client/DocsV1Db.ts
|
|
@@ -10850,6 +10872,7 @@ __export(FdrAPI_exports, {
|
|
|
10850
10872
|
WithNamespaceSchema: () => WithNamespaceSchema,
|
|
10851
10873
|
api: () => api,
|
|
10852
10874
|
docs: () => docs,
|
|
10875
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
10853
10876
|
libraryDocs: () => libraryDocs,
|
|
10854
10877
|
navigation: () => navigation,
|
|
10855
10878
|
sdks: () => sdks
|
|
@@ -11465,6 +11488,7 @@ __export(v1_exports2, {
|
|
|
11465
11488
|
convertAvailability: () => convertAvailability,
|
|
11466
11489
|
followRedirect: () => followRedirect,
|
|
11467
11490
|
followRedirects: () => followRedirects,
|
|
11491
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
11468
11492
|
getPageId: () => getPageId2,
|
|
11469
11493
|
hasMarkdown: () => hasMarkdown2,
|
|
11470
11494
|
hasMetadata: () => hasMetadata2,
|
|
@@ -12059,9 +12083,21 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
12059
12083
|
insertionOrder.push({ type: "flat", op });
|
|
12060
12084
|
}
|
|
12061
12085
|
}
|
|
12086
|
+
const parentOps = /* @__PURE__ */ new Map();
|
|
12087
|
+
const filteredInsertionOrder = insertionOrder.filter((entry) => {
|
|
12088
|
+
if (entry.type === "flat" && entry.op.operationType === "QUERY") {
|
|
12089
|
+
const fp = entry.op.fieldPath;
|
|
12090
|
+
const hasNoFieldPath = fp == null || fp.length === 0;
|
|
12091
|
+
if (hasNoFieldPath && groupedByParent.has(entry.op.name)) {
|
|
12092
|
+
parentOps.set(entry.op.name, entry.op);
|
|
12093
|
+
return false;
|
|
12094
|
+
}
|
|
12095
|
+
}
|
|
12096
|
+
return true;
|
|
12097
|
+
});
|
|
12062
12098
|
const children = [];
|
|
12063
12099
|
const allSlugs = /* @__PURE__ */ new Set();
|
|
12064
|
-
for (const entry of
|
|
12100
|
+
for (const entry of filteredInsertionOrder) {
|
|
12065
12101
|
if (entry.type === "flat") {
|
|
12066
12102
|
const fp = entry.op.fieldPath;
|
|
12067
12103
|
allSlugs.add(fp != null && fp.length > 0 ? [...fp, entry.op.name].join("-") : entry.op.name);
|
|
@@ -12069,7 +12105,7 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
12069
12105
|
allSlugs.add(entry.parentField);
|
|
12070
12106
|
}
|
|
12071
12107
|
}
|
|
12072
|
-
for (const entry of
|
|
12108
|
+
for (const entry of filteredInsertionOrder) {
|
|
12073
12109
|
if (entry.type === "flat") {
|
|
12074
12110
|
const opId = ApiDefinitionHolder.createGraphQlOperationId(entry.op);
|
|
12075
12111
|
children.push(this.convertGraphQlNode(opId, entry.op, parentSlug));
|
|
@@ -12078,11 +12114,12 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
12078
12114
|
if (operations == null) {
|
|
12079
12115
|
continue;
|
|
12080
12116
|
}
|
|
12081
|
-
const
|
|
12082
|
-
const
|
|
12083
|
-
const
|
|
12117
|
+
const parentOp = parentOps.get(entry.parentField);
|
|
12118
|
+
const primaryOp = parentOp ?? operations[0];
|
|
12119
|
+
const opId = ApiDefinitionHolder.createGraphQlOperationId(primaryOp);
|
|
12120
|
+
const childOpIds = operations.map((op) => ApiDefinitionHolder.createGraphQlOperationId(op));
|
|
12084
12121
|
let slugSegment = entry.parentField;
|
|
12085
|
-
const flatHasSameSlug =
|
|
12122
|
+
const flatHasSameSlug = filteredInsertionOrder.some(
|
|
12086
12123
|
(e) => e.type === "flat" && (() => {
|
|
12087
12124
|
const fp = e.op.fieldPath;
|
|
12088
12125
|
const s = fp != null && fp.length > 0 ? [...fp, e.op.name].join("-") : e.op.name;
|
|
@@ -12098,13 +12135,13 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
12098
12135
|
type: "graphql",
|
|
12099
12136
|
title: entry.parentField,
|
|
12100
12137
|
graphqlOperationId: opId,
|
|
12101
|
-
graphqlOperationIds:
|
|
12138
|
+
graphqlOperationIds: childOpIds.length > 0 ? childOpIds : void 0,
|
|
12102
12139
|
slug: parentSlug.apply({ urlSlug: slugSegment }).get(),
|
|
12103
12140
|
icon: void 0,
|
|
12104
12141
|
hidden: void 0,
|
|
12105
|
-
operationType:
|
|
12142
|
+
operationType: primaryOp.operationType,
|
|
12106
12143
|
apiDefinitionId: this.apiDefinitionId,
|
|
12107
|
-
availability: navigation_exports.V1.convertAvailability(
|
|
12144
|
+
availability: navigation_exports.V1.convertAvailability(primaryOp.availability),
|
|
12108
12145
|
playground: void 0,
|
|
12109
12146
|
authed: void 0,
|
|
12110
12147
|
collapsed: void 0,
|
|
@@ -15117,6 +15154,7 @@ export {
|
|
|
15117
15154
|
WithAvailabilitySchema,
|
|
15118
15155
|
WithDescriptionSchema,
|
|
15119
15156
|
getChildren,
|
|
15157
|
+
getGraphqlOperationIds,
|
|
15120
15158
|
getPageId,
|
|
15121
15159
|
hasMarkdown,
|
|
15122
15160
|
hasMetadata,
|