@fern-api/fdr-sdk 1.2.102-1e451b148c → 1.2.103-6f6c57cd35
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 +6 -6
|
@@ -7436,6 +7436,7 @@ __export(api_definition_exports, {
|
|
|
7436
7436
|
buildSdkSnippetRequest: () => buildSdkSnippetRequest,
|
|
7437
7437
|
cleanLanguage: () => cleanLanguage,
|
|
7438
7438
|
collectReferencedTypeIds: () => collectReferencedTypeIds,
|
|
7439
|
+
collectReferencingTypeIdsByTypeId: () => collectReferencingTypeIdsByTypeId,
|
|
7439
7440
|
collectTypeDefinitionTree: () => collectTypeDefinitionTree,
|
|
7440
7441
|
collectTypeDefinitionTreeForObjectProperty: () => collectTypeDefinitionTreeForObjectProperty,
|
|
7441
7442
|
convertToCurl: () => convertToCurl,
|
|
@@ -8338,6 +8339,7 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
8338
8339
|
};
|
|
8339
8340
|
const namespaces = /* @__PURE__ */ new Set();
|
|
8340
8341
|
const authSchemes = /* @__PURE__ */ new Set();
|
|
8342
|
+
const seedTypeIds = /* @__PURE__ */ new Set();
|
|
8341
8343
|
for (const node of nodes) {
|
|
8342
8344
|
if (node.type === "endpoint") {
|
|
8343
8345
|
const found = this.api.endpoints[node.endpointId];
|
|
@@ -8374,9 +8376,14 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
8374
8376
|
found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));
|
|
8375
8377
|
}
|
|
8376
8378
|
}
|
|
8379
|
+
} else if (node.type === "graphqlType") {
|
|
8380
|
+
const found = this.api.types[node.typeId];
|
|
8381
|
+
if (found) {
|
|
8382
|
+
seedTypeIds.add(node.typeId);
|
|
8383
|
+
}
|
|
8377
8384
|
}
|
|
8378
8385
|
}
|
|
8379
|
-
toRet.types = this.pruneTypes(toRet);
|
|
8386
|
+
toRet.types = this.pruneTypes(toRet, seedTypeIds);
|
|
8380
8387
|
namespaces.forEach((subpackageId) => {
|
|
8381
8388
|
const subpackage = this.api.subpackages[subpackageId];
|
|
8382
8389
|
if (subpackage) {
|
|
@@ -8391,8 +8398,8 @@ var ApiDefinitionPruner = class _ApiDefinitionPruner {
|
|
|
8391
8398
|
});
|
|
8392
8399
|
return toRet;
|
|
8393
8400
|
}
|
|
8394
|
-
pruneTypes(partiallyPrunedApi) {
|
|
8395
|
-
let typeIds =
|
|
8401
|
+
pruneTypes(partiallyPrunedApi, seedTypeIds = /* @__PURE__ */ new Set()) {
|
|
8402
|
+
let typeIds = new Set(seedTypeIds);
|
|
8396
8403
|
partiallyPrunedApi.globalHeaders?.forEach((header) => {
|
|
8397
8404
|
ApiTypeIdVisitor.visitTypeShape(header.valueShape, (typeId) => typeIds.add(typeId));
|
|
8398
8405
|
});
|
|
@@ -11907,6 +11914,28 @@ var Transformer = class _Transformer {
|
|
|
11907
11914
|
};
|
|
11908
11915
|
};
|
|
11909
11916
|
|
|
11917
|
+
// src/api-definition/type-back-references.ts
|
|
11918
|
+
function collectReferencingTypeIdsByTypeId(api2) {
|
|
11919
|
+
const byTypeId = /* @__PURE__ */ new Map();
|
|
11920
|
+
for (const [rawId, definition] of Object.entries(api2.types)) {
|
|
11921
|
+
const from = rawId;
|
|
11922
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11923
|
+
ApiTypeIdVisitor.visitTypeDefinition(definition, (to) => {
|
|
11924
|
+
if (to === from || seen.has(to) || api2.types[to] == null) {
|
|
11925
|
+
return;
|
|
11926
|
+
}
|
|
11927
|
+
seen.add(to);
|
|
11928
|
+
const existing = byTypeId.get(to);
|
|
11929
|
+
if (existing == null) {
|
|
11930
|
+
byTypeId.set(to, [from]);
|
|
11931
|
+
} else {
|
|
11932
|
+
existing.push(from);
|
|
11933
|
+
}
|
|
11934
|
+
});
|
|
11935
|
+
}
|
|
11936
|
+
return byTypeId;
|
|
11937
|
+
}
|
|
11938
|
+
|
|
11910
11939
|
// src/navigation/index.ts
|
|
11911
11940
|
var navigation_exports = {};
|
|
11912
11941
|
__export(navigation_exports, {
|
|
@@ -14388,6 +14417,7 @@ function followRedirect(nodeToFollow) {
|
|
|
14388
14417
|
webhook: (node) => node.slug,
|
|
14389
14418
|
grpc: (node) => node.slug,
|
|
14390
14419
|
graphql: (node) => node.slug,
|
|
14420
|
+
graphqlType: (node) => node.slug,
|
|
14391
14421
|
landingPage: (node) => node.slug,
|
|
14392
14422
|
// nodes with overview
|
|
14393
14423
|
apiPackage: (node) => node.overviewPageId != null ? node.slug : followRedirects(node.children),
|
|
@@ -14442,6 +14472,7 @@ function getPageId2(node) {
|
|
|
14442
14472
|
webhook: RETURN_UNDEFINED2,
|
|
14443
14473
|
grpc: RETURN_UNDEFINED2,
|
|
14444
14474
|
graphql: RETURN_UNDEFINED2,
|
|
14475
|
+
graphqlType: RETURN_UNDEFINED2,
|
|
14445
14476
|
changelogYear: RETURN_UNDEFINED2,
|
|
14446
14477
|
changelogMonth: RETURN_UNDEFINED2
|
|
14447
14478
|
});
|
|
@@ -14449,7 +14480,7 @@ function getPageId2(node) {
|
|
|
14449
14480
|
|
|
14450
14481
|
// src/navigation/versions/v1/NavigationNodeApiLeaf.ts
|
|
14451
14482
|
function isApiLeaf2(node) {
|
|
14452
|
-
return node.type === "endpoint" || node.type === "webSocket" || node.type === "webhook" || node.type === "grpc" || node.type === "graphql";
|
|
14483
|
+
return node.type === "endpoint" || node.type === "webSocket" || node.type === "webhook" || node.type === "grpc" || node.type === "graphql" || node.type === "graphqlType";
|
|
14453
14484
|
}
|
|
14454
14485
|
|
|
14455
14486
|
// src/navigation/versions/v1/NavigationNodePageLeaf.ts
|
|
@@ -14568,6 +14599,18 @@ function withCanonicalLookup(map) {
|
|
|
14568
14599
|
map.has = (key) => originalHas(key) || originalHas(canonicalSlugKey(key));
|
|
14569
14600
|
return map;
|
|
14570
14601
|
}
|
|
14602
|
+
function graphQlTypeKey(apiDefinitionId, typeId, versionId) {
|
|
14603
|
+
return `${apiDefinitionId}:${versionId ?? ""}:${typeId}`;
|
|
14604
|
+
}
|
|
14605
|
+
function versionIdOf(parents) {
|
|
14606
|
+
for (let i = parents.length - 1; i >= 0; i--) {
|
|
14607
|
+
const parent = parents[i];
|
|
14608
|
+
if (parent?.type === "version") {
|
|
14609
|
+
return parent.versionId;
|
|
14610
|
+
}
|
|
14611
|
+
}
|
|
14612
|
+
return void 0;
|
|
14613
|
+
}
|
|
14571
14614
|
var NodeCollectorInstances = /* @__PURE__ */ new WeakMap();
|
|
14572
14615
|
var NodeCollector = class _NodeCollector {
|
|
14573
14616
|
static EMPTY = new _NodeCollector(void 0);
|
|
@@ -14575,6 +14618,8 @@ var NodeCollector = class _NodeCollector {
|
|
|
14575
14618
|
idToNode = /* @__PURE__ */ new Map();
|
|
14576
14619
|
idToNodeParents = /* @__PURE__ */ new Map();
|
|
14577
14620
|
slugToNode = /* @__PURE__ */ new Map();
|
|
14621
|
+
/** Keyed by {@link graphQlTypeKey} -- `typeId` alone is only unique within one API definition. */
|
|
14622
|
+
typeIdToGraphQlTypeNode = /* @__PURE__ */ new Map();
|
|
14578
14623
|
orphanedNodes = [];
|
|
14579
14624
|
static collect(rootNode) {
|
|
14580
14625
|
if (rootNode == null) {
|
|
@@ -14644,6 +14689,13 @@ var NodeCollector = class _NodeCollector {
|
|
|
14644
14689
|
this.idToNodeParents.set(node.id, parents);
|
|
14645
14690
|
this.nodesInOrder.push(node);
|
|
14646
14691
|
}
|
|
14692
|
+
if (node.type === "graphqlType") {
|
|
14693
|
+
const key = graphQlTypeKey(node.apiDefinitionId, node.typeId, versionIdOf(parents));
|
|
14694
|
+
const existingTypeNode = this.typeIdToGraphQlTypeNode.get(key);
|
|
14695
|
+
if (existingTypeNode == null || existingTypeNode.hidden === true && node.hidden !== true) {
|
|
14696
|
+
this.typeIdToGraphQlTypeNode.set(key, node);
|
|
14697
|
+
}
|
|
14698
|
+
}
|
|
14647
14699
|
if (node.type === "sidebarRoot") {
|
|
14648
14700
|
this.#last = void 0;
|
|
14649
14701
|
this.#lastNeighboringNode = void 0;
|
|
@@ -14674,6 +14726,38 @@ var NodeCollector = class _NodeCollector {
|
|
|
14674
14726
|
get slugMap() {
|
|
14675
14727
|
return this.getSlugMap();
|
|
14676
14728
|
}
|
|
14729
|
+
/**
|
|
14730
|
+
* GraphQL schema types that have their own page, keyed by
|
|
14731
|
+
* {@link graphQlTypeKey} -- `apiDefinitionId` *and* `typeId`.
|
|
14732
|
+
*
|
|
14733
|
+
* Exists so that a field whose value is `Product` can be rendered as a link
|
|
14734
|
+
* to `Product`'s page without every consumer re-walking the tree and picking
|
|
14735
|
+
* its own winner when a type appears under multiple versions or products.
|
|
14736
|
+
*
|
|
14737
|
+
* The key includes the API definition because `typeId` is only unique within
|
|
14738
|
+
* one definition: a docs site with several GraphQL APIs can legitimately have
|
|
14739
|
+
* a `Product` in each, and keying on `typeId` alone would link an operation in
|
|
14740
|
+
* one API to a type page in another.
|
|
14741
|
+
*/
|
|
14742
|
+
getGraphQlTypeNodes = once(() => {
|
|
14743
|
+
return this.typeIdToGraphQlTypeNode;
|
|
14744
|
+
});
|
|
14745
|
+
/**
|
|
14746
|
+
* The type node documenting `typeId` within `apiDefinitionId` and `versionId`,
|
|
14747
|
+
* if one exists. Pass the version the caller is rendering in; undefined on an
|
|
14748
|
+
* unversioned site.
|
|
14749
|
+
*
|
|
14750
|
+
* There is deliberately no cross-version fallback: sending a reader in one
|
|
14751
|
+
* version to another version's type page is worse than not linking at all,
|
|
14752
|
+
* since the type may differ between versions.
|
|
14753
|
+
*/
|
|
14754
|
+
getGraphQlTypeNode = (apiDefinitionId, typeId, versionId) => {
|
|
14755
|
+
return this.typeIdToGraphQlTypeNode.get(graphQlTypeKey(apiDefinitionId, typeId, versionId));
|
|
14756
|
+
};
|
|
14757
|
+
/** Slug of the page documenting `typeId`, if one exists. See {@link getGraphQlTypeNode}. */
|
|
14758
|
+
getGraphQlTypeSlug = (apiDefinitionId, typeId, versionId) => {
|
|
14759
|
+
return this.getGraphQlTypeNode(apiDefinitionId, typeId, versionId)?.slug;
|
|
14760
|
+
};
|
|
14677
14761
|
get defaultVersionNode() {
|
|
14678
14762
|
return this.defaultVersion;
|
|
14679
14763
|
}
|
|
@@ -15623,6 +15707,36 @@ var FernNavigationV1ToLatest = class _FernNavigationV1ToLatest {
|
|
|
15623
15707
|
};
|
|
15624
15708
|
return latest;
|
|
15625
15709
|
};
|
|
15710
|
+
graphqlType = (node, parents) => {
|
|
15711
|
+
const apiDisambiguation = this.#createApiDisambiguationKey(parents);
|
|
15712
|
+
const slug = navigation_exports.Slug(node.slug);
|
|
15713
|
+
const canonicalSlug = this.#getAndSetCanonicalSlug(
|
|
15714
|
+
[
|
|
15715
|
+
`${apiDisambiguation}:api:graphqlType:${node.typeCategory}:${node.typeId}`,
|
|
15716
|
+
this.#createTitleDisambiguationKey(node, parents)
|
|
15717
|
+
],
|
|
15718
|
+
slug
|
|
15719
|
+
);
|
|
15720
|
+
const latest = {
|
|
15721
|
+
type: "graphqlType",
|
|
15722
|
+
id: navigation_exports.NodeId(node.id),
|
|
15723
|
+
title: node.title,
|
|
15724
|
+
slug,
|
|
15725
|
+
canonicalSlug,
|
|
15726
|
+
icon: node.icon,
|
|
15727
|
+
hidden: node.hidden,
|
|
15728
|
+
authed: node.authed,
|
|
15729
|
+
collapsed: node.collapsed,
|
|
15730
|
+
apiDefinitionId: node.apiDefinitionId,
|
|
15731
|
+
typeId: node.typeId,
|
|
15732
|
+
typeCategory: node.typeCategory,
|
|
15733
|
+
availability: this.#availability(node.availability),
|
|
15734
|
+
viewers: node.viewers,
|
|
15735
|
+
orphaned: node.orphaned,
|
|
15736
|
+
featureFlags: node.featureFlags
|
|
15737
|
+
};
|
|
15738
|
+
return latest;
|
|
15739
|
+
};
|
|
15626
15740
|
#variantChild = (child, parents) => {
|
|
15627
15741
|
return visitDiscriminatedUnion_default(child)._visit({
|
|
15628
15742
|
apiReference: (value) => this.apiReference(value, parents),
|
|
@@ -15653,7 +15767,8 @@ var FernNavigationV1ToLatest = class _FernNavigationV1ToLatest {
|
|
|
15653
15767
|
webSocket: (value) => this.webSocket(value, parents),
|
|
15654
15768
|
webhook: (value) => this.webhook(value, parents),
|
|
15655
15769
|
grpc: (value) => this.grpc(value, parents),
|
|
15656
|
-
graphql: (value) => this.graphql(value, parents)
|
|
15770
|
+
graphql: (value) => this.graphql(value, parents),
|
|
15771
|
+
graphqlType: (value) => this.graphqlType(value, parents)
|
|
15657
15772
|
});
|
|
15658
15773
|
};
|
|
15659
15774
|
/**
|