@fern-api/fdr-sdk 1.2.101-d2c863c843 → 1.2.102-07ddc01b9b
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/js/api-definition/index.js +33 -3
- package/dist/js/api-definition/index.js.map +1 -1
- package/dist/js/api-definition/index.mjs +32 -3
- package/dist/js/api-definition/index.mjs.map +1 -1
- package/dist/js/client/FdrClient.js +28 -1
- package/dist/js/client/FdrClient.js.map +1 -1
- package/dist/js/client/FdrClient.mjs +28 -1
- package/dist/js/client/FdrClient.mjs.map +1 -1
- package/dist/js/client/types.js.map +1 -1
- package/dist/js/client/types.mjs.map +1 -1
- package/dist/js/converters/index.js +120 -5
- package/dist/js/converters/index.js.map +1 -1
- package/dist/js/converters/index.mjs +120 -5
- package/dist/js/converters/index.mjs.map +1 -1
- package/dist/js/index.js +148 -6
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +148 -6
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/index.js +120 -5
- package/dist/js/navigation/index.js.map +1 -1
- package/dist/js/navigation/index.mjs +120 -5
- package/dist/js/navigation/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +40 -1
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +40 -1
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/js/navigation/types/v1.js.map +1 -1
- package/dist/js/navigation/types/v1.mjs.map +1 -1
- package/dist/js/orpc-client.js +31 -1
- package/dist/js/orpc-client.js.map +1 -1
- package/dist/js/orpc-client.mjs +30 -1
- package/dist/js/orpc-client.mjs.map +1 -1
- package/dist/types/api-definition/__test__/type-back-references.test.d.ts +2 -0
- package/dist/types/api-definition/__test__/type-back-references.test.d.ts.map +1 -0
- package/dist/types/api-definition/index.d.ts +1 -0
- package/dist/types/api-definition/index.d.ts.map +1 -1
- package/dist/types/api-definition/prune.d.ts +3 -0
- package/dist/types/api-definition/prune.d.ts.map +1 -1
- package/dist/types/api-definition/type-back-references.d.ts +23 -0
- package/dist/types/api-definition/type-back-references.d.ts.map +1 -0
- package/dist/types/navigation/NodeCollector.d.ts +41 -0
- package/dist/types/navigation/NodeCollector.d.ts.map +1 -1
- package/dist/types/navigation/__test__/NodeCollector.graphqlTypeIndex.test.d.ts +2 -0
- package/dist/types/navigation/__test__/NodeCollector.graphqlTypeIndex.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts +1 -1
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/types/navigation/migrators/__test__/graphqlType.test.d.ts +2 -0
- package/dist/types/navigation/migrators/__test__/graphqlType.test.d.ts.map +1 -0
- package/dist/types/navigation/migrators/v1ToV2.d.ts +1 -0
- package/dist/types/navigation/migrators/v1ToV2.d.ts.map +1 -1
- package/dist/types/navigation/types/v1.d.ts +14 -2
- package/dist/types/navigation/types/v1.d.ts.map +1 -1
- package/dist/types/navigation/versions/v1/NavigationNode.d.ts +1 -1
- package/dist/types/navigation/versions/v1/NavigationNode.d.ts.map +1 -1
- package/dist/types/navigation/versions/v1/NavigationNodeApiLeaf.d.ts +2 -2
- package/dist/types/navigation/versions/v1/NavigationNodeApiLeaf.d.ts.map +1 -1
- package/dist/types/navigation/versions/v1/followRedirect.d.ts.map +1 -1
- package/dist/types/navigation/versions/v1/getPageId.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/contract.d.ts +4258 -948
- package/dist/types/orpc-client/docs-ledger/contract.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/ledger-manifest.d.ts +2792 -232
- package/dist/types/orpc-client/docs-ledger/ledger-manifest.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -7475,6 +7475,7 @@ __export(api_definition_exports, {
|
|
|
7475
7475
|
buildSdkSnippetRequest: () => buildSdkSnippetRequest,
|
|
7476
7476
|
cleanLanguage: () => cleanLanguage,
|
|
7477
7477
|
collectReferencedTypeIds: () => collectReferencedTypeIds,
|
|
7478
|
+
collectReferencingTypeIdsByTypeId: () => collectReferencingTypeIdsByTypeId,
|
|
7478
7479
|
collectTypeDefinitionTree: () => collectTypeDefinitionTree,
|
|
7479
7480
|
collectTypeDefinitionTreeForObjectProperty: () => collectTypeDefinitionTreeForObjectProperty,
|
|
7480
7481
|
convertToCurl: () => convertToCurl,
|
|
@@ -8377,6 +8378,7 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
8377
8378
|
};
|
|
8378
8379
|
const namespaces = /* @__PURE__ */ new Set();
|
|
8379
8380
|
const authSchemes = /* @__PURE__ */ new Set();
|
|
8381
|
+
const seedTypeIds = /* @__PURE__ */ new Set();
|
|
8380
8382
|
for (const node of nodes) {
|
|
8381
8383
|
if (node.type === "endpoint") {
|
|
8382
8384
|
const found = this.api.endpoints[node.endpointId];
|
|
@@ -8413,9 +8415,14 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
8413
8415
|
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
8414
8416
|
}
|
|
8415
8417
|
}
|
|
8418
|
+
} else if (node.type === "graphqlType") {
|
|
8419
|
+
const found = this.api.types[node.typeId];
|
|
8420
|
+
if (found) {
|
|
8421
|
+
seedTypeIds.add(node.typeId);
|
|
8422
|
+
}
|
|
8416
8423
|
}
|
|
8417
8424
|
}
|
|
8418
|
-
toRet.types = this.pruneTypes(toRet);
|
|
8425
|
+
toRet.types = this.pruneTypes(toRet, seedTypeIds);
|
|
8419
8426
|
namespaces.forEach((subpackageId) => {
|
|
8420
8427
|
const subpackage = this.api.subpackages[subpackageId];
|
|
8421
8428
|
if (subpackage) {
|
|
@@ -8430,8 +8437,8 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
8430
8437
|
});
|
|
8431
8438
|
return toRet;
|
|
8432
8439
|
}
|
|
8433
|
-
pruneTypes(partiallyPrunedApi) {
|
|
8434
|
-
let typeIds =
|
|
8440
|
+
pruneTypes(partiallyPrunedApi, seedTypeIds = /* @__PURE__ */ new Set()) {
|
|
8441
|
+
let typeIds = new Set(seedTypeIds);
|
|
8435
8442
|
partiallyPrunedApi.globalHeaders?.forEach((header) => {
|
|
8436
8443
|
ApiTypeIdVisitor.visitTypeShape(header.valueShape, (typeId) => typeIds.add(typeId));
|
|
8437
8444
|
});
|
|
@@ -11946,6 +11953,28 @@ var Transformer = class _Transformer {
|
|
|
11946
11953
|
};
|
|
11947
11954
|
};
|
|
11948
11955
|
|
|
11956
|
+
// src/api-definition/type-back-references.ts
|
|
11957
|
+
function collectReferencingTypeIdsByTypeId(api2) {
|
|
11958
|
+
const byTypeId = /* @__PURE__ */ new Map();
|
|
11959
|
+
for (const [rawId, definition] of Object.entries(api2.types)) {
|
|
11960
|
+
const from = rawId;
|
|
11961
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11962
|
+
ApiTypeIdVisitor.visitTypeDefinition(definition, (to) => {
|
|
11963
|
+
if (to === from || seen.has(to) || api2.types[to] == null) {
|
|
11964
|
+
return;
|
|
11965
|
+
}
|
|
11966
|
+
seen.add(to);
|
|
11967
|
+
const existing = byTypeId.get(to);
|
|
11968
|
+
if (existing == null) {
|
|
11969
|
+
byTypeId.set(to, [from]);
|
|
11970
|
+
} else {
|
|
11971
|
+
existing.push(from);
|
|
11972
|
+
}
|
|
11973
|
+
});
|
|
11974
|
+
}
|
|
11975
|
+
return byTypeId;
|
|
11976
|
+
}
|
|
11977
|
+
|
|
11949
11978
|
// src/navigation/index.ts
|
|
11950
11979
|
var navigation_exports = {};
|
|
11951
11980
|
__export(navigation_exports, {
|
|
@@ -14427,6 +14456,7 @@ function followRedirect(nodeToFollow) {
|
|
|
14427
14456
|
webhook: (node) => node.slug,
|
|
14428
14457
|
grpc: (node) => node.slug,
|
|
14429
14458
|
graphql: (node) => node.slug,
|
|
14459
|
+
graphqlType: (node) => node.slug,
|
|
14430
14460
|
landingPage: (node) => node.slug,
|
|
14431
14461
|
// nodes with overview
|
|
14432
14462
|
apiPackage: (node) => node.overviewPageId != null ? node.slug : followRedirects(node.children),
|
|
@@ -14481,6 +14511,7 @@ function getPageId2(node) {
|
|
|
14481
14511
|
webhook: RETURN_UNDEFINED2,
|
|
14482
14512
|
grpc: RETURN_UNDEFINED2,
|
|
14483
14513
|
graphql: RETURN_UNDEFINED2,
|
|
14514
|
+
graphqlType: RETURN_UNDEFINED2,
|
|
14484
14515
|
changelogYear: RETURN_UNDEFINED2,
|
|
14485
14516
|
changelogMonth: RETURN_UNDEFINED2
|
|
14486
14517
|
});
|
|
@@ -14488,7 +14519,7 @@ function getPageId2(node) {
|
|
|
14488
14519
|
|
|
14489
14520
|
// src/navigation/versions/v1/NavigationNodeApiLeaf.ts
|
|
14490
14521
|
function isApiLeaf2(node) {
|
|
14491
|
-
return node.type === "endpoint" || node.type === "webSocket" || node.type === "webhook" || node.type === "grpc" || node.type === "graphql";
|
|
14522
|
+
return node.type === "endpoint" || node.type === "webSocket" || node.type === "webhook" || node.type === "grpc" || node.type === "graphql" || node.type === "graphqlType";
|
|
14492
14523
|
}
|
|
14493
14524
|
|
|
14494
14525
|
// src/navigation/versions/v1/NavigationNodePageLeaf.ts
|
|
@@ -14607,6 +14638,18 @@ function withCanonicalLookup(map) {
|
|
|
14607
14638
|
map.has = (key) => originalHas(key) || originalHas(canonicalSlugKey(key));
|
|
14608
14639
|
return map;
|
|
14609
14640
|
}
|
|
14641
|
+
function graphQlTypeKey(apiDefinitionId, typeId, versionId) {
|
|
14642
|
+
return `${apiDefinitionId}:${versionId ?? ""}:${typeId}`;
|
|
14643
|
+
}
|
|
14644
|
+
function versionIdOf(parents) {
|
|
14645
|
+
for (let i = parents.length - 1; i >= 0; i--) {
|
|
14646
|
+
const parent = parents[i];
|
|
14647
|
+
if (parent?.type === "version") {
|
|
14648
|
+
return parent.versionId;
|
|
14649
|
+
}
|
|
14650
|
+
}
|
|
14651
|
+
return void 0;
|
|
14652
|
+
}
|
|
14610
14653
|
var NodeCollectorInstances = /* @__PURE__ */ new WeakMap();
|
|
14611
14654
|
var NodeCollector = class _NodeCollector {
|
|
14612
14655
|
static EMPTY = new _NodeCollector(void 0);
|
|
@@ -14614,6 +14657,8 @@ var NodeCollector = class _NodeCollector {
|
|
|
14614
14657
|
idToNode = /* @__PURE__ */ new Map();
|
|
14615
14658
|
idToNodeParents = /* @__PURE__ */ new Map();
|
|
14616
14659
|
slugToNode = /* @__PURE__ */ new Map();
|
|
14660
|
+
/** Keyed by {@link graphQlTypeKey} -- `typeId` alone is only unique within one API definition. */
|
|
14661
|
+
typeIdToGraphQlTypeNode = /* @__PURE__ */ new Map();
|
|
14617
14662
|
orphanedNodes = [];
|
|
14618
14663
|
static collect(rootNode) {
|
|
14619
14664
|
if (rootNode == null) {
|
|
@@ -14683,6 +14728,13 @@ var NodeCollector = class _NodeCollector {
|
|
|
14683
14728
|
this.idToNodeParents.set(node.id, parents);
|
|
14684
14729
|
this.nodesInOrder.push(node);
|
|
14685
14730
|
}
|
|
14731
|
+
if (node.type === "graphqlType") {
|
|
14732
|
+
const key = graphQlTypeKey(node.apiDefinitionId, node.typeId, versionIdOf(parents));
|
|
14733
|
+
const existingTypeNode = this.typeIdToGraphQlTypeNode.get(key);
|
|
14734
|
+
if (existingTypeNode == null || existingTypeNode.hidden === true && node.hidden !== true) {
|
|
14735
|
+
this.typeIdToGraphQlTypeNode.set(key, node);
|
|
14736
|
+
}
|
|
14737
|
+
}
|
|
14686
14738
|
if (node.type === "sidebarRoot") {
|
|
14687
14739
|
this.#last = void 0;
|
|
14688
14740
|
this.#lastNeighboringNode = void 0;
|
|
@@ -14713,6 +14765,38 @@ var NodeCollector = class _NodeCollector {
|
|
|
14713
14765
|
get slugMap() {
|
|
14714
14766
|
return this.getSlugMap();
|
|
14715
14767
|
}
|
|
14768
|
+
/**
|
|
14769
|
+
* GraphQL schema types that have their own page, keyed by
|
|
14770
|
+
* {@link graphQlTypeKey} -- `apiDefinitionId` *and* `typeId`.
|
|
14771
|
+
*
|
|
14772
|
+
* Exists so that a field whose value is `Product` can be rendered as a link
|
|
14773
|
+
* to `Product`'s page without every consumer re-walking the tree and picking
|
|
14774
|
+
* its own winner when a type appears under multiple versions or products.
|
|
14775
|
+
*
|
|
14776
|
+
* The key includes the API definition because `typeId` is only unique within
|
|
14777
|
+
* one definition: a docs site with several GraphQL APIs can legitimately have
|
|
14778
|
+
* a `Product` in each, and keying on `typeId` alone would link an operation in
|
|
14779
|
+
* one API to a type page in another.
|
|
14780
|
+
*/
|
|
14781
|
+
getGraphQlTypeNodes = (0, import_function.once)(() => {
|
|
14782
|
+
return this.typeIdToGraphQlTypeNode;
|
|
14783
|
+
});
|
|
14784
|
+
/**
|
|
14785
|
+
* The type node documenting `typeId` within `apiDefinitionId` and `versionId`,
|
|
14786
|
+
* if one exists. Pass the version the caller is rendering in; undefined on an
|
|
14787
|
+
* unversioned site.
|
|
14788
|
+
*
|
|
14789
|
+
* There is deliberately no cross-version fallback: sending a reader in one
|
|
14790
|
+
* version to another version's type page is worse than not linking at all,
|
|
14791
|
+
* since the type may differ between versions.
|
|
14792
|
+
*/
|
|
14793
|
+
getGraphQlTypeNode = (apiDefinitionId, typeId, versionId) => {
|
|
14794
|
+
return this.typeIdToGraphQlTypeNode.get(graphQlTypeKey(apiDefinitionId, typeId, versionId));
|
|
14795
|
+
};
|
|
14796
|
+
/** Slug of the page documenting `typeId`, if one exists. See {@link getGraphQlTypeNode}. */
|
|
14797
|
+
getGraphQlTypeSlug = (apiDefinitionId, typeId, versionId) => {
|
|
14798
|
+
return this.getGraphQlTypeNode(apiDefinitionId, typeId, versionId)?.slug;
|
|
14799
|
+
};
|
|
14716
14800
|
get defaultVersionNode() {
|
|
14717
14801
|
return this.defaultVersion;
|
|
14718
14802
|
}
|
|
@@ -15662,6 +15746,36 @@ var FernNavigationV1ToLatest = class _FernNavigationV1ToLatest {
|
|
|
15662
15746
|
};
|
|
15663
15747
|
return latest;
|
|
15664
15748
|
};
|
|
15749
|
+
graphqlType = (node, parents) => {
|
|
15750
|
+
const apiDisambiguation = this.#createApiDisambiguationKey(parents);
|
|
15751
|
+
const slug = navigation_exports.Slug(node.slug);
|
|
15752
|
+
const canonicalSlug = this.#getAndSetCanonicalSlug(
|
|
15753
|
+
[
|
|
15754
|
+
`${apiDisambiguation}:api:graphqlType:${node.typeCategory}:${node.typeId}`,
|
|
15755
|
+
this.#createTitleDisambiguationKey(node, parents)
|
|
15756
|
+
],
|
|
15757
|
+
slug
|
|
15758
|
+
);
|
|
15759
|
+
const latest = {
|
|
15760
|
+
type: "graphqlType",
|
|
15761
|
+
id: navigation_exports.NodeId(node.id),
|
|
15762
|
+
title: node.title,
|
|
15763
|
+
slug,
|
|
15764
|
+
canonicalSlug,
|
|
15765
|
+
icon: node.icon,
|
|
15766
|
+
hidden: node.hidden,
|
|
15767
|
+
authed: node.authed,
|
|
15768
|
+
collapsed: node.collapsed,
|
|
15769
|
+
apiDefinitionId: node.apiDefinitionId,
|
|
15770
|
+
typeId: node.typeId,
|
|
15771
|
+
typeCategory: node.typeCategory,
|
|
15772
|
+
availability: this.#availability(node.availability),
|
|
15773
|
+
viewers: node.viewers,
|
|
15774
|
+
orphaned: node.orphaned,
|
|
15775
|
+
featureFlags: node.featureFlags
|
|
15776
|
+
};
|
|
15777
|
+
return latest;
|
|
15778
|
+
};
|
|
15665
15779
|
#variantChild = (child, parents) => {
|
|
15666
15780
|
return visitDiscriminatedUnion_default(child)._visit({
|
|
15667
15781
|
apiReference: (value) => this.apiReference(value, parents),
|
|
@@ -15692,7 +15806,8 @@ var FernNavigationV1ToLatest = class _FernNavigationV1ToLatest {
|
|
|
15692
15806
|
webSocket: (value) => this.webSocket(value, parents),
|
|
15693
15807
|
webhook: (value) => this.webhook(value, parents),
|
|
15694
15808
|
grpc: (value) => this.grpc(value, parents),
|
|
15695
|
-
graphql: (value) => this.graphql(value, parents)
|
|
15809
|
+
graphql: (value) => this.graphql(value, parents),
|
|
15810
|
+
graphqlType: (value) => this.graphqlType(value, parents)
|
|
15696
15811
|
});
|
|
15697
15812
|
};
|
|
15698
15813
|
/**
|