@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
|
@@ -815,6 +815,11 @@ var GraphQlOperationIdSchema = z2.string();
|
|
|
815
815
|
function GraphQlOperationId(value) {
|
|
816
816
|
return value;
|
|
817
817
|
}
|
|
818
|
+
function getGraphqlOperationIds(node) {
|
|
819
|
+
const ids = new Set(node.graphqlOperationIds ?? []);
|
|
820
|
+
ids.add(node.graphqlOperationId);
|
|
821
|
+
return [...ids];
|
|
822
|
+
}
|
|
818
823
|
var GraphQlTypeCategorySchema = z2.enum(["object", "input", "enum", "scalar", "interface", "union"]);
|
|
819
824
|
var EnvironmentIdSchema = z2.string();
|
|
820
825
|
function EnvironmentId(value) {
|
|
@@ -4017,7 +4022,8 @@ __export(APIV1Db_exports, {
|
|
|
4017
4022
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
4018
4023
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
4019
4024
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
4020
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
4025
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
4026
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
4021
4027
|
});
|
|
4022
4028
|
|
|
4023
4029
|
// src/orpc-client/api/contract-db.ts
|
|
@@ -4326,7 +4332,8 @@ __export(APIV1Read_exports, {
|
|
|
4326
4332
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
4327
4333
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
4328
4334
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
4329
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
4335
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
4336
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
4330
4337
|
});
|
|
4331
4338
|
var WebSocketMessageOrigin = {
|
|
4332
4339
|
Client: "client",
|
|
@@ -4518,7 +4525,8 @@ __export(APIV1Write_exports, {
|
|
|
4518
4525
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
4519
4526
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
4520
4527
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
4521
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
4528
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
4529
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
4522
4530
|
});
|
|
4523
4531
|
|
|
4524
4532
|
// src/client/DocsV1Db.ts
|
|
@@ -5523,6 +5531,7 @@ __export(FdrAPI_exports, {
|
|
|
5523
5531
|
WithNamespaceSchema: () => WithNamespaceSchema,
|
|
5524
5532
|
api: () => api,
|
|
5525
5533
|
docs: () => docs,
|
|
5534
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
5526
5535
|
libraryDocs: () => libraryDocs,
|
|
5527
5536
|
navigation: () => navigation,
|
|
5528
5537
|
sdks: () => sdks
|
|
@@ -7447,6 +7456,7 @@ __export(api_definition_exports, {
|
|
|
7447
7456
|
generateHttpSnippets: () => generateHttpSnippets,
|
|
7448
7457
|
generateSdkSnippetForLanguage: () => generateSdkSnippetForLanguage,
|
|
7449
7458
|
generateSdkSnippets: () => generateSdkSnippets,
|
|
7459
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
7450
7460
|
getHarRequest: () => getHarRequest,
|
|
7451
7461
|
getMessageForStatus: () => getMessageForStatus,
|
|
7452
7462
|
joiner: () => joiner,
|
|
@@ -8363,8 +8373,7 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
8363
8373
|
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
8364
8374
|
}
|
|
8365
8375
|
} else if (node.type === "graphql") {
|
|
8366
|
-
const
|
|
8367
|
-
for (const opId of idsToInclude) {
|
|
8376
|
+
for (const opId of getGraphqlOperationIds(node)) {
|
|
8368
8377
|
const found = this.api.graphqlOperations[opId];
|
|
8369
8378
|
if (found) {
|
|
8370
8379
|
toRet.graphqlOperations[opId] = found;
|
|
@@ -10602,7 +10611,8 @@ function generateGraphQlSnippet(context) {
|
|
|
10602
10611
|
const fieldPath = operation.fieldPath;
|
|
10603
10612
|
const hasFieldPath = fieldPath != null && fieldPath.length > 0;
|
|
10604
10613
|
const selectionSetIndent = hasFieldPath ? 2 + fieldPath.length : 2;
|
|
10605
|
-
const
|
|
10614
|
+
const initialDepth = isReturnTypeNamespace(operation.returnType, types) ? DEFAULT_MAX_DEPTH + 1 : DEFAULT_MAX_DEPTH;
|
|
10615
|
+
const selectionSet = generateSelectionSet(operation.returnType, types, initialDepth, /* @__PURE__ */ new Set(), selectionSetIndent);
|
|
10606
10616
|
let query = operationKeyword;
|
|
10607
10617
|
if (operationName || variableDefinitions.length > 0) {
|
|
10608
10618
|
query += ` ${operationName}`;
|
|
@@ -10852,6 +10862,18 @@ function generateExamplePrimitiveValue(primitive) {
|
|
|
10852
10862
|
return "example";
|
|
10853
10863
|
}
|
|
10854
10864
|
}
|
|
10865
|
+
var DEFAULT_MAX_DEPTH = 2;
|
|
10866
|
+
function isReturnTypeNamespace(returnType, types) {
|
|
10867
|
+
const { shape } = unwrapReference(returnType, types);
|
|
10868
|
+
if (shape.type !== "object") {
|
|
10869
|
+
return false;
|
|
10870
|
+
}
|
|
10871
|
+
const properties = shape.properties ?? [];
|
|
10872
|
+
if (properties.length === 0) {
|
|
10873
|
+
return false;
|
|
10874
|
+
}
|
|
10875
|
+
return properties.every((prop) => prop.arguments != null && prop.arguments.length > 0);
|
|
10876
|
+
}
|
|
10855
10877
|
function generateSelectionSet(shape, types, depth, visited = /* @__PURE__ */ new Set(), indentLevel = 2) {
|
|
10856
10878
|
if (depth <= 0) {
|
|
10857
10879
|
return "";
|
|
@@ -11977,6 +11999,7 @@ __export(navigation_exports, {
|
|
|
11977
11999
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
11978
12000
|
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
11979
12001
|
getChildren: () => getChildren,
|
|
12002
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
11980
12003
|
getPageId: () => getPageId,
|
|
11981
12004
|
hasMarkdown: () => hasMarkdown,
|
|
11982
12005
|
hasMetadata: () => hasMetadata,
|
|
@@ -12613,7 +12636,7 @@ var ApiDefinitionPruner2 = class {
|
|
|
12613
12636
|
if (node.type !== "graphql" || graphqlOperations == null) {
|
|
12614
12637
|
return [];
|
|
12615
12638
|
}
|
|
12616
|
-
const idsToInclude = new Set(node
|
|
12639
|
+
const idsToInclude = new Set(getGraphqlOperationIds(node));
|
|
12617
12640
|
return graphqlOperations.filter((op) => idsToInclude.has(ApiDefinitionHolder.createGraphQlOperationId(op)));
|
|
12618
12641
|
}
|
|
12619
12642
|
};
|
|
@@ -12803,6 +12826,7 @@ __export(v1_exports2, {
|
|
|
12803
12826
|
convertAvailability: () => convertAvailability,
|
|
12804
12827
|
followRedirect: () => followRedirect,
|
|
12805
12828
|
followRedirects: () => followRedirects,
|
|
12829
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
12806
12830
|
getPageId: () => getPageId2,
|
|
12807
12831
|
hasMarkdown: () => hasMarkdown2,
|
|
12808
12832
|
hasMetadata: () => hasMetadata2,
|
|
@@ -13397,9 +13421,21 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
13397
13421
|
insertionOrder.push({ type: "flat", op });
|
|
13398
13422
|
}
|
|
13399
13423
|
}
|
|
13424
|
+
const parentOps = /* @__PURE__ */ new Map();
|
|
13425
|
+
const filteredInsertionOrder = insertionOrder.filter((entry) => {
|
|
13426
|
+
if (entry.type === "flat" && entry.op.operationType === "QUERY") {
|
|
13427
|
+
const fp = entry.op.fieldPath;
|
|
13428
|
+
const hasNoFieldPath = fp == null || fp.length === 0;
|
|
13429
|
+
if (hasNoFieldPath && groupedByParent.has(entry.op.name)) {
|
|
13430
|
+
parentOps.set(entry.op.name, entry.op);
|
|
13431
|
+
return false;
|
|
13432
|
+
}
|
|
13433
|
+
}
|
|
13434
|
+
return true;
|
|
13435
|
+
});
|
|
13400
13436
|
const children = [];
|
|
13401
13437
|
const allSlugs = /* @__PURE__ */ new Set();
|
|
13402
|
-
for (const entry of
|
|
13438
|
+
for (const entry of filteredInsertionOrder) {
|
|
13403
13439
|
if (entry.type === "flat") {
|
|
13404
13440
|
const fp = entry.op.fieldPath;
|
|
13405
13441
|
allSlugs.add(fp != null && fp.length > 0 ? [...fp, entry.op.name].join("-") : entry.op.name);
|
|
@@ -13407,7 +13443,7 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
13407
13443
|
allSlugs.add(entry.parentField);
|
|
13408
13444
|
}
|
|
13409
13445
|
}
|
|
13410
|
-
for (const entry of
|
|
13446
|
+
for (const entry of filteredInsertionOrder) {
|
|
13411
13447
|
if (entry.type === "flat") {
|
|
13412
13448
|
const opId = ApiDefinitionHolder.createGraphQlOperationId(entry.op);
|
|
13413
13449
|
children.push(this.convertGraphQlNode(opId, entry.op, parentSlug));
|
|
@@ -13416,11 +13452,12 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
13416
13452
|
if (operations == null) {
|
|
13417
13453
|
continue;
|
|
13418
13454
|
}
|
|
13419
|
-
const
|
|
13420
|
-
const
|
|
13421
|
-
const
|
|
13455
|
+
const parentOp = parentOps.get(entry.parentField);
|
|
13456
|
+
const primaryOp = parentOp ?? operations[0];
|
|
13457
|
+
const opId = ApiDefinitionHolder.createGraphQlOperationId(primaryOp);
|
|
13458
|
+
const childOpIds = operations.map((op) => ApiDefinitionHolder.createGraphQlOperationId(op));
|
|
13422
13459
|
let slugSegment = entry.parentField;
|
|
13423
|
-
const flatHasSameSlug =
|
|
13460
|
+
const flatHasSameSlug = filteredInsertionOrder.some(
|
|
13424
13461
|
(e) => e.type === "flat" && (() => {
|
|
13425
13462
|
const fp = e.op.fieldPath;
|
|
13426
13463
|
const s = fp != null && fp.length > 0 ? [...fp, e.op.name].join("-") : e.op.name;
|
|
@@ -13436,13 +13473,13 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
13436
13473
|
type: "graphql",
|
|
13437
13474
|
title: entry.parentField,
|
|
13438
13475
|
graphqlOperationId: opId,
|
|
13439
|
-
graphqlOperationIds:
|
|
13476
|
+
graphqlOperationIds: childOpIds.length > 0 ? childOpIds : void 0,
|
|
13440
13477
|
slug: parentSlug.apply({ urlSlug: slugSegment }).get(),
|
|
13441
13478
|
icon: void 0,
|
|
13442
13479
|
hidden: void 0,
|
|
13443
|
-
operationType:
|
|
13480
|
+
operationType: primaryOp.operationType,
|
|
13444
13481
|
apiDefinitionId: this.apiDefinitionId,
|
|
13445
|
-
availability: navigation_exports.V1.convertAvailability(
|
|
13482
|
+
availability: navigation_exports.V1.convertAvailability(primaryOp.availability),
|
|
13446
13483
|
playground: void 0,
|
|
13447
13484
|
authed: void 0,
|
|
13448
13485
|
collapsed: void 0,
|