@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
|
@@ -776,6 +776,11 @@ var GraphQlOperationIdSchema = z2.string();
|
|
|
776
776
|
function GraphQlOperationId(value) {
|
|
777
777
|
return value;
|
|
778
778
|
}
|
|
779
|
+
function getGraphqlOperationIds(node) {
|
|
780
|
+
const ids = new Set(node.graphqlOperationIds ?? []);
|
|
781
|
+
ids.add(node.graphqlOperationId);
|
|
782
|
+
return [...ids];
|
|
783
|
+
}
|
|
779
784
|
var GraphQlTypeCategorySchema = z2.enum(["object", "input", "enum", "scalar", "interface", "union"]);
|
|
780
785
|
var EnvironmentIdSchema = z2.string();
|
|
781
786
|
function EnvironmentId(value) {
|
|
@@ -3978,7 +3983,8 @@ __export(APIV1Db_exports, {
|
|
|
3978
3983
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
3979
3984
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
3980
3985
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
3981
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
3986
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
3987
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
3982
3988
|
});
|
|
3983
3989
|
|
|
3984
3990
|
// src/orpc-client/api/contract-db.ts
|
|
@@ -4287,7 +4293,8 @@ __export(APIV1Read_exports, {
|
|
|
4287
4293
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
4288
4294
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
4289
4295
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
4290
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
4296
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
4297
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
4291
4298
|
});
|
|
4292
4299
|
var WebSocketMessageOrigin = {
|
|
4293
4300
|
Client: "client",
|
|
@@ -4479,7 +4486,8 @@ __export(APIV1Write_exports, {
|
|
|
4479
4486
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
4480
4487
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
4481
4488
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
4482
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
4489
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
4490
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
4483
4491
|
});
|
|
4484
4492
|
|
|
4485
4493
|
// src/client/DocsV1Db.ts
|
|
@@ -5484,6 +5492,7 @@ __export(FdrAPI_exports, {
|
|
|
5484
5492
|
WithNamespaceSchema: () => WithNamespaceSchema,
|
|
5485
5493
|
api: () => api,
|
|
5486
5494
|
docs: () => docs,
|
|
5495
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
5487
5496
|
libraryDocs: () => libraryDocs,
|
|
5488
5497
|
navigation: () => navigation,
|
|
5489
5498
|
sdks: () => sdks
|
|
@@ -7408,6 +7417,7 @@ __export(api_definition_exports, {
|
|
|
7408
7417
|
generateHttpSnippets: () => generateHttpSnippets,
|
|
7409
7418
|
generateSdkSnippetForLanguage: () => generateSdkSnippetForLanguage,
|
|
7410
7419
|
generateSdkSnippets: () => generateSdkSnippets,
|
|
7420
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
7411
7421
|
getHarRequest: () => getHarRequest,
|
|
7412
7422
|
getMessageForStatus: () => getMessageForStatus,
|
|
7413
7423
|
joiner: () => joiner,
|
|
@@ -8324,8 +8334,7 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
8324
8334
|
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
8325
8335
|
}
|
|
8326
8336
|
} else if (node.type === "graphql") {
|
|
8327
|
-
const
|
|
8328
|
-
for (const opId of idsToInclude) {
|
|
8337
|
+
for (const opId of getGraphqlOperationIds(node)) {
|
|
8329
8338
|
const found = this.api.graphqlOperations[opId];
|
|
8330
8339
|
if (found) {
|
|
8331
8340
|
toRet.graphqlOperations[opId] = found;
|
|
@@ -10563,7 +10572,8 @@ function generateGraphQlSnippet(context) {
|
|
|
10563
10572
|
const fieldPath = operation.fieldPath;
|
|
10564
10573
|
const hasFieldPath = fieldPath != null && fieldPath.length > 0;
|
|
10565
10574
|
const selectionSetIndent = hasFieldPath ? 2 + fieldPath.length : 2;
|
|
10566
|
-
const
|
|
10575
|
+
const initialDepth = isReturnTypeNamespace(operation.returnType, types) ? DEFAULT_MAX_DEPTH + 1 : DEFAULT_MAX_DEPTH;
|
|
10576
|
+
const selectionSet = generateSelectionSet(operation.returnType, types, initialDepth, /* @__PURE__ */ new Set(), selectionSetIndent);
|
|
10567
10577
|
let query = operationKeyword;
|
|
10568
10578
|
if (operationName || variableDefinitions.length > 0) {
|
|
10569
10579
|
query += ` ${operationName}`;
|
|
@@ -10813,6 +10823,18 @@ function generateExamplePrimitiveValue(primitive) {
|
|
|
10813
10823
|
return "example";
|
|
10814
10824
|
}
|
|
10815
10825
|
}
|
|
10826
|
+
var DEFAULT_MAX_DEPTH = 2;
|
|
10827
|
+
function isReturnTypeNamespace(returnType, types) {
|
|
10828
|
+
const { shape } = unwrapReference(returnType, types);
|
|
10829
|
+
if (shape.type !== "object") {
|
|
10830
|
+
return false;
|
|
10831
|
+
}
|
|
10832
|
+
const properties = shape.properties ?? [];
|
|
10833
|
+
if (properties.length === 0) {
|
|
10834
|
+
return false;
|
|
10835
|
+
}
|
|
10836
|
+
return properties.every((prop) => prop.arguments != null && prop.arguments.length > 0);
|
|
10837
|
+
}
|
|
10816
10838
|
function generateSelectionSet(shape, types, depth, visited = /* @__PURE__ */ new Set(), indentLevel = 2) {
|
|
10817
10839
|
if (depth <= 0) {
|
|
10818
10840
|
return "";
|
|
@@ -11938,6 +11960,7 @@ __export(navigation_exports, {
|
|
|
11938
11960
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
11939
11961
|
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
11940
11962
|
getChildren: () => getChildren,
|
|
11963
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
11941
11964
|
getPageId: () => getPageId,
|
|
11942
11965
|
hasMarkdown: () => hasMarkdown,
|
|
11943
11966
|
hasMetadata: () => hasMetadata,
|
|
@@ -12574,7 +12597,7 @@ var ApiDefinitionPruner2 = class {
|
|
|
12574
12597
|
if (node.type !== "graphql" || graphqlOperations == null) {
|
|
12575
12598
|
return [];
|
|
12576
12599
|
}
|
|
12577
|
-
const idsToInclude = new Set(node
|
|
12600
|
+
const idsToInclude = new Set(getGraphqlOperationIds(node));
|
|
12578
12601
|
return graphqlOperations.filter((op) => idsToInclude.has(ApiDefinitionHolder.createGraphQlOperationId(op)));
|
|
12579
12602
|
}
|
|
12580
12603
|
};
|
|
@@ -12764,6 +12787,7 @@ __export(v1_exports2, {
|
|
|
12764
12787
|
convertAvailability: () => convertAvailability,
|
|
12765
12788
|
followRedirect: () => followRedirect,
|
|
12766
12789
|
followRedirects: () => followRedirects,
|
|
12790
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
12767
12791
|
getPageId: () => getPageId2,
|
|
12768
12792
|
hasMarkdown: () => hasMarkdown2,
|
|
12769
12793
|
hasMetadata: () => hasMetadata2,
|
|
@@ -13358,9 +13382,21 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
13358
13382
|
insertionOrder.push({ type: "flat", op });
|
|
13359
13383
|
}
|
|
13360
13384
|
}
|
|
13385
|
+
const parentOps = /* @__PURE__ */ new Map();
|
|
13386
|
+
const filteredInsertionOrder = insertionOrder.filter((entry) => {
|
|
13387
|
+
if (entry.type === "flat" && entry.op.operationType === "QUERY") {
|
|
13388
|
+
const fp = entry.op.fieldPath;
|
|
13389
|
+
const hasNoFieldPath = fp == null || fp.length === 0;
|
|
13390
|
+
if (hasNoFieldPath && groupedByParent.has(entry.op.name)) {
|
|
13391
|
+
parentOps.set(entry.op.name, entry.op);
|
|
13392
|
+
return false;
|
|
13393
|
+
}
|
|
13394
|
+
}
|
|
13395
|
+
return true;
|
|
13396
|
+
});
|
|
13361
13397
|
const children = [];
|
|
13362
13398
|
const allSlugs = /* @__PURE__ */ new Set();
|
|
13363
|
-
for (const entry of
|
|
13399
|
+
for (const entry of filteredInsertionOrder) {
|
|
13364
13400
|
if (entry.type === "flat") {
|
|
13365
13401
|
const fp = entry.op.fieldPath;
|
|
13366
13402
|
allSlugs.add(fp != null && fp.length > 0 ? [...fp, entry.op.name].join("-") : entry.op.name);
|
|
@@ -13368,7 +13404,7 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
13368
13404
|
allSlugs.add(entry.parentField);
|
|
13369
13405
|
}
|
|
13370
13406
|
}
|
|
13371
|
-
for (const entry of
|
|
13407
|
+
for (const entry of filteredInsertionOrder) {
|
|
13372
13408
|
if (entry.type === "flat") {
|
|
13373
13409
|
const opId = ApiDefinitionHolder.createGraphQlOperationId(entry.op);
|
|
13374
13410
|
children.push(this.convertGraphQlNode(opId, entry.op, parentSlug));
|
|
@@ -13377,11 +13413,12 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
13377
13413
|
if (operations == null) {
|
|
13378
13414
|
continue;
|
|
13379
13415
|
}
|
|
13380
|
-
const
|
|
13381
|
-
const
|
|
13382
|
-
const
|
|
13416
|
+
const parentOp = parentOps.get(entry.parentField);
|
|
13417
|
+
const primaryOp = parentOp ?? operations[0];
|
|
13418
|
+
const opId = ApiDefinitionHolder.createGraphQlOperationId(primaryOp);
|
|
13419
|
+
const childOpIds = operations.map((op) => ApiDefinitionHolder.createGraphQlOperationId(op));
|
|
13383
13420
|
let slugSegment = entry.parentField;
|
|
13384
|
-
const flatHasSameSlug =
|
|
13421
|
+
const flatHasSameSlug = filteredInsertionOrder.some(
|
|
13385
13422
|
(e) => e.type === "flat" && (() => {
|
|
13386
13423
|
const fp = e.op.fieldPath;
|
|
13387
13424
|
const s = fp != null && fp.length > 0 ? [...fp, e.op.name].join("-") : e.op.name;
|
|
@@ -13397,13 +13434,13 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
13397
13434
|
type: "graphql",
|
|
13398
13435
|
title: entry.parentField,
|
|
13399
13436
|
graphqlOperationId: opId,
|
|
13400
|
-
graphqlOperationIds:
|
|
13437
|
+
graphqlOperationIds: childOpIds.length > 0 ? childOpIds : void 0,
|
|
13401
13438
|
slug: parentSlug.apply({ urlSlug: slugSegment }).get(),
|
|
13402
13439
|
icon: void 0,
|
|
13403
13440
|
hidden: void 0,
|
|
13404
|
-
operationType:
|
|
13441
|
+
operationType: primaryOp.operationType,
|
|
13405
13442
|
apiDefinitionId: this.apiDefinitionId,
|
|
13406
|
-
availability: navigation_exports.V1.convertAvailability(
|
|
13443
|
+
availability: navigation_exports.V1.convertAvailability(primaryOp.availability),
|
|
13407
13444
|
playground: void 0,
|
|
13408
13445
|
authed: void 0,
|
|
13409
13446
|
collapsed: void 0,
|