@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.js
CHANGED
|
@@ -238,6 +238,7 @@ __export(api_definition_exports, {
|
|
|
238
238
|
generateHttpSnippets: () => generateHttpSnippets,
|
|
239
239
|
generateSdkSnippetForLanguage: () => generateSdkSnippetForLanguage,
|
|
240
240
|
generateSdkSnippets: () => generateSdkSnippets,
|
|
241
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
241
242
|
getHarRequest: () => getHarRequest,
|
|
242
243
|
getMessageForStatus: () => getMessageForStatus,
|
|
243
244
|
joiner: () => joiner,
|
|
@@ -1121,6 +1122,11 @@ var GraphQlOperationIdSchema = z2.string();
|
|
|
1121
1122
|
function GraphQlOperationId(value) {
|
|
1122
1123
|
return value;
|
|
1123
1124
|
}
|
|
1125
|
+
function getGraphqlOperationIds(node) {
|
|
1126
|
+
const ids = new Set(node.graphqlOperationIds ?? []);
|
|
1127
|
+
ids.add(node.graphqlOperationId);
|
|
1128
|
+
return [...ids];
|
|
1129
|
+
}
|
|
1124
1130
|
var GraphQlTypeCategorySchema = z2.enum(["object", "input", "enum", "scalar", "interface", "union"]);
|
|
1125
1131
|
var EnvironmentIdSchema = z2.string();
|
|
1126
1132
|
function EnvironmentId(value) {
|
|
@@ -3250,8 +3256,7 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
3250
3256
|
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
3251
3257
|
}
|
|
3252
3258
|
} else if (node.type === "graphql") {
|
|
3253
|
-
const
|
|
3254
|
-
for (const opId of idsToInclude) {
|
|
3259
|
+
for (const opId of getGraphqlOperationIds(node)) {
|
|
3255
3260
|
const found = this.api.graphqlOperations[opId];
|
|
3256
3261
|
if (found) {
|
|
3257
3262
|
toRet.graphqlOperations[opId] = found;
|
|
@@ -5489,7 +5494,8 @@ function generateGraphQlSnippet(context) {
|
|
|
5489
5494
|
const fieldPath = operation.fieldPath;
|
|
5490
5495
|
const hasFieldPath = fieldPath != null && fieldPath.length > 0;
|
|
5491
5496
|
const selectionSetIndent = hasFieldPath ? 2 + fieldPath.length : 2;
|
|
5492
|
-
const
|
|
5497
|
+
const initialDepth = isReturnTypeNamespace(operation.returnType, types) ? DEFAULT_MAX_DEPTH + 1 : DEFAULT_MAX_DEPTH;
|
|
5498
|
+
const selectionSet = generateSelectionSet(operation.returnType, types, initialDepth, /* @__PURE__ */ new Set(), selectionSetIndent);
|
|
5493
5499
|
let query = operationKeyword;
|
|
5494
5500
|
if (operationName || variableDefinitions.length > 0) {
|
|
5495
5501
|
query += ` ${operationName}`;
|
|
@@ -5739,6 +5745,18 @@ function generateExamplePrimitiveValue(primitive) {
|
|
|
5739
5745
|
return "example";
|
|
5740
5746
|
}
|
|
5741
5747
|
}
|
|
5748
|
+
var DEFAULT_MAX_DEPTH = 2;
|
|
5749
|
+
function isReturnTypeNamespace(returnType, types) {
|
|
5750
|
+
const { shape } = unwrapReference(returnType, types);
|
|
5751
|
+
if (shape.type !== "object") {
|
|
5752
|
+
return false;
|
|
5753
|
+
}
|
|
5754
|
+
const properties = shape.properties ?? [];
|
|
5755
|
+
if (properties.length === 0) {
|
|
5756
|
+
return false;
|
|
5757
|
+
}
|
|
5758
|
+
return properties.every((prop) => prop.arguments != null && prop.arguments.length > 0);
|
|
5759
|
+
}
|
|
5742
5760
|
function generateSelectionSet(shape, types, depth, visited = /* @__PURE__ */ new Set(), indentLevel = 2) {
|
|
5743
5761
|
if (depth <= 0) {
|
|
5744
5762
|
return "";
|
|
@@ -10949,7 +10967,8 @@ __export(APIV1Db_exports, {
|
|
|
10949
10967
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
10950
10968
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
10951
10969
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
10952
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
10970
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
10971
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
10953
10972
|
});
|
|
10954
10973
|
|
|
10955
10974
|
// src/orpc-client/api/contract-db.ts
|
|
@@ -11258,7 +11277,8 @@ __export(APIV1Read_exports, {
|
|
|
11258
11277
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
11259
11278
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
11260
11279
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
11261
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
11280
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
11281
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
11262
11282
|
});
|
|
11263
11283
|
var WebSocketMessageOrigin = {
|
|
11264
11284
|
Client: "client",
|
|
@@ -11450,7 +11470,8 @@ __export(APIV1Write_exports, {
|
|
|
11450
11470
|
WebhookPayloadSchema: () => WebhookPayloadSchema,
|
|
11451
11471
|
WebhookPayloadShapeSchema: () => WebhookPayloadShapeSchema,
|
|
11452
11472
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
11453
|
-
WithDescriptionSchema: () => WithDescriptionSchema
|
|
11473
|
+
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
11474
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds
|
|
11454
11475
|
});
|
|
11455
11476
|
|
|
11456
11477
|
// src/client/DocsV1Db.ts
|
|
@@ -12455,6 +12476,7 @@ __export(FdrAPI_exports, {
|
|
|
12455
12476
|
WithNamespaceSchema: () => WithNamespaceSchema,
|
|
12456
12477
|
api: () => api,
|
|
12457
12478
|
docs: () => docs,
|
|
12479
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
12458
12480
|
libraryDocs: () => libraryDocs,
|
|
12459
12481
|
navigation: () => navigation,
|
|
12460
12482
|
sdks: () => sdks
|
|
@@ -15729,6 +15751,7 @@ __export(navigation_exports, {
|
|
|
15729
15751
|
WithAvailabilitySchema: () => WithAvailabilitySchema,
|
|
15730
15752
|
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
15731
15753
|
getChildren: () => getChildren,
|
|
15754
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
15732
15755
|
getPageId: () => getPageId,
|
|
15733
15756
|
hasMarkdown: () => hasMarkdown,
|
|
15734
15757
|
hasMetadata: () => hasMetadata,
|
|
@@ -16365,7 +16388,7 @@ var ApiDefinitionPruner2 = class {
|
|
|
16365
16388
|
if (node.type !== "graphql" || graphqlOperations == null) {
|
|
16366
16389
|
return [];
|
|
16367
16390
|
}
|
|
16368
|
-
const idsToInclude = new Set(node
|
|
16391
|
+
const idsToInclude = new Set(getGraphqlOperationIds(node));
|
|
16369
16392
|
return graphqlOperations.filter((op) => idsToInclude.has(ApiDefinitionHolder.createGraphQlOperationId(op)));
|
|
16370
16393
|
}
|
|
16371
16394
|
};
|
|
@@ -16555,6 +16578,7 @@ __export(v1_exports2, {
|
|
|
16555
16578
|
convertAvailability: () => convertAvailability,
|
|
16556
16579
|
followRedirect: () => followRedirect,
|
|
16557
16580
|
followRedirects: () => followRedirects,
|
|
16581
|
+
getGraphqlOperationIds: () => getGraphqlOperationIds,
|
|
16558
16582
|
getPageId: () => getPageId2,
|
|
16559
16583
|
hasMarkdown: () => hasMarkdown2,
|
|
16560
16584
|
hasMetadata: () => hasMetadata2,
|
|
@@ -17149,9 +17173,21 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
17149
17173
|
insertionOrder.push({ type: "flat", op });
|
|
17150
17174
|
}
|
|
17151
17175
|
}
|
|
17176
|
+
const parentOps = /* @__PURE__ */ new Map();
|
|
17177
|
+
const filteredInsertionOrder = insertionOrder.filter((entry) => {
|
|
17178
|
+
if (entry.type === "flat" && entry.op.operationType === "QUERY") {
|
|
17179
|
+
const fp = entry.op.fieldPath;
|
|
17180
|
+
const hasNoFieldPath = fp == null || fp.length === 0;
|
|
17181
|
+
if (hasNoFieldPath && groupedByParent.has(entry.op.name)) {
|
|
17182
|
+
parentOps.set(entry.op.name, entry.op);
|
|
17183
|
+
return false;
|
|
17184
|
+
}
|
|
17185
|
+
}
|
|
17186
|
+
return true;
|
|
17187
|
+
});
|
|
17152
17188
|
const children = [];
|
|
17153
17189
|
const allSlugs = /* @__PURE__ */ new Set();
|
|
17154
|
-
for (const entry of
|
|
17190
|
+
for (const entry of filteredInsertionOrder) {
|
|
17155
17191
|
if (entry.type === "flat") {
|
|
17156
17192
|
const fp = entry.op.fieldPath;
|
|
17157
17193
|
allSlugs.add(fp != null && fp.length > 0 ? [...fp, entry.op.name].join("-") : entry.op.name);
|
|
@@ -17159,7 +17195,7 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
17159
17195
|
allSlugs.add(entry.parentField);
|
|
17160
17196
|
}
|
|
17161
17197
|
}
|
|
17162
|
-
for (const entry of
|
|
17198
|
+
for (const entry of filteredInsertionOrder) {
|
|
17163
17199
|
if (entry.type === "flat") {
|
|
17164
17200
|
const opId = ApiDefinitionHolder.createGraphQlOperationId(entry.op);
|
|
17165
17201
|
children.push(this.convertGraphQlNode(opId, entry.op, parentSlug));
|
|
@@ -17168,11 +17204,12 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
17168
17204
|
if (operations == null) {
|
|
17169
17205
|
continue;
|
|
17170
17206
|
}
|
|
17171
|
-
const
|
|
17172
|
-
const
|
|
17173
|
-
const
|
|
17207
|
+
const parentOp = parentOps.get(entry.parentField);
|
|
17208
|
+
const primaryOp = parentOp ?? operations[0];
|
|
17209
|
+
const opId = ApiDefinitionHolder.createGraphQlOperationId(primaryOp);
|
|
17210
|
+
const childOpIds = operations.map((op) => ApiDefinitionHolder.createGraphQlOperationId(op));
|
|
17174
17211
|
let slugSegment = entry.parentField;
|
|
17175
|
-
const flatHasSameSlug =
|
|
17212
|
+
const flatHasSameSlug = filteredInsertionOrder.some(
|
|
17176
17213
|
(e) => e.type === "flat" && (() => {
|
|
17177
17214
|
const fp = e.op.fieldPath;
|
|
17178
17215
|
const s = fp != null && fp.length > 0 ? [...fp, e.op.name].join("-") : e.op.name;
|
|
@@ -17188,13 +17225,13 @@ var ApiReferenceNavigationConverter = class _ApiReferenceNavigationConverter {
|
|
|
17188
17225
|
type: "graphql",
|
|
17189
17226
|
title: entry.parentField,
|
|
17190
17227
|
graphqlOperationId: opId,
|
|
17191
|
-
graphqlOperationIds:
|
|
17228
|
+
graphqlOperationIds: childOpIds.length > 0 ? childOpIds : void 0,
|
|
17192
17229
|
slug: parentSlug.apply({ urlSlug: slugSegment }).get(),
|
|
17193
17230
|
icon: void 0,
|
|
17194
17231
|
hidden: void 0,
|
|
17195
|
-
operationType:
|
|
17232
|
+
operationType: primaryOp.operationType,
|
|
17196
17233
|
apiDefinitionId: this.apiDefinitionId,
|
|
17197
|
-
availability: navigation_exports.V1.convertAvailability(
|
|
17234
|
+
availability: navigation_exports.V1.convertAvailability(primaryOp.availability),
|
|
17198
17235
|
playground: void 0,
|
|
17199
17236
|
authed: void 0,
|
|
17200
17237
|
collapsed: void 0,
|