@fern-api/fdr-sdk 0.139.5-1605edfbc → 0.139.5-2c30cfa75
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/client/generated/api/resources/api/resources/v1/resources/register/client/Client.d.ts +2 -1
- package/dist/client/generated/api/resources/api/resources/v1/resources/register/client/Client.d.ts.map +1 -1
- package/dist/client/generated/api/resources/api/resources/v1/resources/register/client/Client.js +2 -1
- package/dist/client/generated/api/resources/api/resources/v1/resources/register/client/requests/RegisterApiDefinitionRequest.d.ts +3 -1
- package/dist/client/generated/api/resources/api/resources/v1/resources/register/client/requests/RegisterApiDefinitionRequest.d.ts.map +1 -1
- package/dist/client/generated/api/resources/api/resources/v1/resources/register/types/DynamicIr.d.ts +9 -0
- package/dist/client/generated/api/resources/api/resources/v1/resources/register/types/DynamicIr.d.ts.map +1 -0
- package/dist/client/generated/api/resources/api/resources/v1/resources/register/types/DynamicIr.js +4 -0
- package/dist/client/generated/api/resources/api/resources/v1/resources/register/types/index.d.ts +1 -0
- package/dist/client/generated/api/resources/api/resources/v1/resources/register/types/index.d.ts.map +1 -1
- package/dist/client/generated/api/resources/api/resources/v1/resources/register/types/index.js +1 -0
- package/dist/navigation/utils/__test__/pruneNavigationTree.test.js +304 -0
- package/dist/navigation/utils/updatePointsTo.d.ts.map +1 -1
- package/dist/navigation/utils/updatePointsTo.js +20 -1
- package/package.json +3 -3
package/dist/client/generated/api/resources/api/resources/v1/resources/register/client/Client.d.ts
CHANGED
|
@@ -35,7 +35,8 @@ export declare class Register {
|
|
|
35
35
|
* apiId: FernRegistry.ApiId("apiId"),
|
|
36
36
|
* definition: undefined,
|
|
37
37
|
* definitionV2: undefined,
|
|
38
|
-
* sources: undefined
|
|
38
|
+
* sources: undefined,
|
|
39
|
+
* dynamicIr: undefined
|
|
39
40
|
* })
|
|
40
41
|
*/
|
|
41
42
|
registerApiDefinition(request: FernRegistry.api.v1.register.RegisterApiDefinitionRequest, requestOptions?: Register.RequestOptions): core.HttpResponsePromise<core.APIResponse<FernRegistry.api.v1.register.RegisterApiDefinitionResponse, FernRegistry.api.v1.register.registerApiDefinition.Error>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../src/client/generated/api/resources/api/resources/v1/resources/register/client/Client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,YAAY,MAAM,yCAAyC,CAAC;AACxE,OAAO,KAAK,IAAI,MAAM,uCAAuC,CAAC;AAC9D,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAG9D,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAC9B,UAAiB,OAAO;QACpB,WAAW,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,uBAAuB,GAAG,MAAM,CAAC,CAAC;QAC3E,qDAAqD;QACrD,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAChC,KAAK,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;KACvD;IAED,UAAiB,cAAc;QAC3B,0DAA0D;QAC1D,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,+DAA+D;QAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,mCAAmC;QACnC,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,oDAAoD;QACpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACpC;CACJ;AAED,qBAAa,QAAQ;IACL,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,OAAO;gBAA1B,QAAQ,GAAE,QAAQ,CAAC,OAAY;IAE9D
|
|
1
|
+
{"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../src/client/generated/api/resources/api/resources/v1/resources/register/client/Client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,YAAY,MAAM,yCAAyC,CAAC;AACxE,OAAO,KAAK,IAAI,MAAM,uCAAuC,CAAC;AAC9D,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAG9D,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAC9B,UAAiB,OAAO;QACpB,WAAW,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,uBAAuB,GAAG,MAAM,CAAC,CAAC;QAC3E,qDAAqD;QACrD,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAChC,KAAK,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;KACvD;IAED,UAAiB,cAAc;QAC3B,0DAA0D;QAC1D,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,+DAA+D;QAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,mCAAmC;QACnC,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,oDAAoD;QACpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACpC;CACJ;AAED,qBAAa,QAAQ;IACL,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,OAAO;gBAA1B,QAAQ,GAAE,QAAQ,CAAC,OAAY;IAE9D;;;;;;;;;;;;;OAaG;IACI,qBAAqB,CACxB,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,4BAA4B,EAClE,cAAc,CAAC,EAAE,QAAQ,CAAC,cAAc,GACzC,IAAI,CAAC,mBAAmB,CACvB,IAAI,CAAC,WAAW,CACZ,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,6BAA6B,EAC1D,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAC3D,CACJ;YAIa,uBAAuB;cAsErB,uBAAuB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAQzE"}
|
package/dist/client/generated/api/resources/api/resources/v1/resources/register/client/Client.js
CHANGED
|
@@ -20,7 +20,8 @@ export class Register {
|
|
|
20
20
|
* apiId: FernRegistry.ApiId("apiId"),
|
|
21
21
|
* definition: undefined,
|
|
22
22
|
* definitionV2: undefined,
|
|
23
|
-
* sources: undefined
|
|
23
|
+
* sources: undefined,
|
|
24
|
+
* dynamicIr: undefined
|
|
24
25
|
* })
|
|
25
26
|
*/
|
|
26
27
|
registerApiDefinition(request, requestOptions) {
|
|
@@ -9,7 +9,8 @@ import * as FernRegistry from "../../../../../../../../index.js";
|
|
|
9
9
|
* apiId: FernRegistry.ApiId("apiId"),
|
|
10
10
|
* definition: undefined,
|
|
11
11
|
* definitionV2: undefined,
|
|
12
|
-
* sources: undefined
|
|
12
|
+
* sources: undefined,
|
|
13
|
+
* dynamicIr: undefined
|
|
13
14
|
* }
|
|
14
15
|
*/
|
|
15
16
|
export interface RegisterApiDefinitionRequest {
|
|
@@ -18,5 +19,6 @@ export interface RegisterApiDefinitionRequest {
|
|
|
18
19
|
definition?: FernRegistry.api.v1.register.ApiDefinition;
|
|
19
20
|
definitionV2?: FernRegistry.api.latest.ApiDefinition;
|
|
20
21
|
sources?: Record<FernRegistry.api.v1.register.SourceId, FernRegistry.api.v1.register.Source>;
|
|
22
|
+
dynamicIr?: FernRegistry.api.v1.register.DynamicIr[];
|
|
21
23
|
}
|
|
22
24
|
//# sourceMappingURL=RegisterApiDefinitionRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegisterApiDefinitionRequest.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../../src/client/generated/api/resources/api/resources/v1/resources/register/client/requests/RegisterApiDefinitionRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,YAAY,MAAM,kCAAkC,CAAC;AAEjE
|
|
1
|
+
{"version":3,"file":"RegisterApiDefinitionRequest.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../../src/client/generated/api/resources/api/resources/v1/resources/register/client/requests/RegisterApiDefinitionRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,YAAY,MAAM,kCAAkC,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,4BAA4B;IACzC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;IAC1B,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;IAC1B,UAAU,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;IACxD,YAAY,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7F,SAAS,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;CACxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicIr.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../src/client/generated/api/resources/api/resources/v1/resources/register/types/DynamicIr.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,SAAS;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,SAAS,EAAE,OAAO,CAAC;CACtB"}
|
package/dist/client/generated/api/resources/api/resources/v1/resources/register/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../src/client/generated/api/resources/api/resources/v1/resources/register/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,yCAAyC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../src/client/generated/api/resources/api/resources/v1/resources/register/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oCAAoC,CAAC;AACnD,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,yCAAyC,CAAC"}
|
|
@@ -435,4 +435,308 @@ describe("pruneNavigationTree", () => {
|
|
|
435
435
|
pointsTo: "root/page",
|
|
436
436
|
});
|
|
437
437
|
});
|
|
438
|
+
it("should handle versioned root with landing pages and no pointsTo field", () => {
|
|
439
|
+
const root = {
|
|
440
|
+
type: "root",
|
|
441
|
+
id: FernNavigation.NodeId("root"),
|
|
442
|
+
slug: FernNavigation.Slug(""),
|
|
443
|
+
title: "Root",
|
|
444
|
+
version: "v2",
|
|
445
|
+
roles: undefined,
|
|
446
|
+
child: {
|
|
447
|
+
type: "versioned",
|
|
448
|
+
id: FernNavigation.NodeId("versioned"),
|
|
449
|
+
children: [
|
|
450
|
+
{
|
|
451
|
+
type: "version",
|
|
452
|
+
id: FernNavigation.NodeId("v1"),
|
|
453
|
+
slug: FernNavigation.Slug("v1"),
|
|
454
|
+
title: "Version 1",
|
|
455
|
+
default: false,
|
|
456
|
+
versionId: FernNavigation.VersionId("v1"),
|
|
457
|
+
landingPage: {
|
|
458
|
+
type: "landingPage",
|
|
459
|
+
id: FernNavigation.NodeId("v1-landing"),
|
|
460
|
+
slug: FernNavigation.Slug("v1/welcome"),
|
|
461
|
+
title: "V1 Landing",
|
|
462
|
+
pageId: FernNavigation.PageId("index.mdx"),
|
|
463
|
+
canonicalSlug: FernNavigation.Slug("welcome"),
|
|
464
|
+
icon: undefined,
|
|
465
|
+
hidden: undefined,
|
|
466
|
+
authed: undefined,
|
|
467
|
+
noindex: undefined,
|
|
468
|
+
viewers: undefined,
|
|
469
|
+
orphaned: undefined,
|
|
470
|
+
featureFlags: undefined,
|
|
471
|
+
},
|
|
472
|
+
child: {
|
|
473
|
+
type: "sidebarRoot",
|
|
474
|
+
id: FernNavigation.NodeId("v1-sidebar"),
|
|
475
|
+
children: [
|
|
476
|
+
{
|
|
477
|
+
type: "section",
|
|
478
|
+
id: FernNavigation.NodeId("v1-section"),
|
|
479
|
+
slug: FernNavigation.Slug("v1"),
|
|
480
|
+
title: "V1 Section",
|
|
481
|
+
overviewPageId: undefined,
|
|
482
|
+
children: [
|
|
483
|
+
{
|
|
484
|
+
type: "page",
|
|
485
|
+
id: FernNavigation.NodeId("v1-page"),
|
|
486
|
+
slug: FernNavigation.Slug("v1/page"),
|
|
487
|
+
title: "V1 Page",
|
|
488
|
+
pageId: FernNavigation.PageId("v1-page.mdx"),
|
|
489
|
+
canonicalSlug: undefined,
|
|
490
|
+
icon: undefined,
|
|
491
|
+
hidden: undefined,
|
|
492
|
+
authed: undefined,
|
|
493
|
+
noindex: undefined,
|
|
494
|
+
viewers: undefined,
|
|
495
|
+
orphaned: undefined,
|
|
496
|
+
featureFlags: undefined,
|
|
497
|
+
},
|
|
498
|
+
],
|
|
499
|
+
collapsed: undefined,
|
|
500
|
+
canonicalSlug: undefined,
|
|
501
|
+
icon: undefined,
|
|
502
|
+
hidden: undefined,
|
|
503
|
+
authed: undefined,
|
|
504
|
+
noindex: undefined,
|
|
505
|
+
pointsTo: undefined, // no pointsTo field
|
|
506
|
+
viewers: undefined,
|
|
507
|
+
orphaned: undefined,
|
|
508
|
+
featureFlags: undefined,
|
|
509
|
+
},
|
|
510
|
+
],
|
|
511
|
+
},
|
|
512
|
+
availability: undefined,
|
|
513
|
+
canonicalSlug: undefined,
|
|
514
|
+
icon: undefined,
|
|
515
|
+
hidden: undefined,
|
|
516
|
+
authed: undefined,
|
|
517
|
+
pointsTo: undefined, // no pointsTo field
|
|
518
|
+
viewers: undefined,
|
|
519
|
+
orphaned: undefined,
|
|
520
|
+
featureFlags: undefined,
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
type: "version",
|
|
524
|
+
id: FernNavigation.NodeId("v2"),
|
|
525
|
+
slug: FernNavigation.Slug("v2"),
|
|
526
|
+
title: "Version 2",
|
|
527
|
+
default: true,
|
|
528
|
+
versionId: FernNavigation.VersionId("v2"),
|
|
529
|
+
landingPage: {
|
|
530
|
+
type: "landingPage",
|
|
531
|
+
id: FernNavigation.NodeId("v2-landing"),
|
|
532
|
+
slug: FernNavigation.Slug("v2/welcome"),
|
|
533
|
+
title: "V2 Landing",
|
|
534
|
+
pageId: FernNavigation.PageId("index.mdx"),
|
|
535
|
+
canonicalSlug: FernNavigation.Slug("welcome"),
|
|
536
|
+
icon: undefined,
|
|
537
|
+
hidden: undefined,
|
|
538
|
+
authed: undefined,
|
|
539
|
+
noindex: undefined,
|
|
540
|
+
viewers: undefined,
|
|
541
|
+
orphaned: undefined,
|
|
542
|
+
featureFlags: undefined,
|
|
543
|
+
},
|
|
544
|
+
child: {
|
|
545
|
+
type: "sidebarRoot",
|
|
546
|
+
id: FernNavigation.NodeId("v2-sidebar"),
|
|
547
|
+
children: [
|
|
548
|
+
{
|
|
549
|
+
type: "section",
|
|
550
|
+
id: FernNavigation.NodeId("v2-section"),
|
|
551
|
+
slug: FernNavigation.Slug("welcome"),
|
|
552
|
+
title: "V2 Section",
|
|
553
|
+
overviewPageId: undefined,
|
|
554
|
+
children: [
|
|
555
|
+
{
|
|
556
|
+
type: "page",
|
|
557
|
+
id: FernNavigation.NodeId("v2-page"),
|
|
558
|
+
slug: FernNavigation.Slug("page"),
|
|
559
|
+
title: "V2 Page",
|
|
560
|
+
pageId: FernNavigation.PageId("v2-page.mdx"),
|
|
561
|
+
canonicalSlug: undefined,
|
|
562
|
+
icon: undefined,
|
|
563
|
+
hidden: undefined,
|
|
564
|
+
authed: undefined,
|
|
565
|
+
noindex: undefined,
|
|
566
|
+
viewers: undefined,
|
|
567
|
+
orphaned: undefined,
|
|
568
|
+
featureFlags: undefined,
|
|
569
|
+
},
|
|
570
|
+
],
|
|
571
|
+
collapsed: undefined,
|
|
572
|
+
canonicalSlug: undefined,
|
|
573
|
+
icon: undefined,
|
|
574
|
+
hidden: undefined,
|
|
575
|
+
authed: undefined,
|
|
576
|
+
noindex: undefined,
|
|
577
|
+
pointsTo: undefined, // no pointsTo field
|
|
578
|
+
viewers: undefined,
|
|
579
|
+
orphaned: undefined,
|
|
580
|
+
featureFlags: undefined,
|
|
581
|
+
},
|
|
582
|
+
],
|
|
583
|
+
},
|
|
584
|
+
availability: undefined,
|
|
585
|
+
canonicalSlug: undefined,
|
|
586
|
+
icon: undefined,
|
|
587
|
+
hidden: undefined,
|
|
588
|
+
authed: undefined,
|
|
589
|
+
pointsTo: undefined, // no pointsTo field
|
|
590
|
+
viewers: undefined,
|
|
591
|
+
orphaned: undefined,
|
|
592
|
+
featureFlags: undefined,
|
|
593
|
+
},
|
|
594
|
+
],
|
|
595
|
+
},
|
|
596
|
+
canonicalSlug: undefined,
|
|
597
|
+
icon: undefined,
|
|
598
|
+
hidden: undefined,
|
|
599
|
+
authed: undefined,
|
|
600
|
+
pointsTo: undefined, // no pointsTo field
|
|
601
|
+
viewers: undefined,
|
|
602
|
+
orphaned: undefined,
|
|
603
|
+
featureFlags: undefined,
|
|
604
|
+
};
|
|
605
|
+
const result = Pruner.from(root)
|
|
606
|
+
.keep((node) => node.id !== "v1-page")
|
|
607
|
+
.get();
|
|
608
|
+
// structuredClone should duplicate the object
|
|
609
|
+
expect(result === root).toBe(false);
|
|
610
|
+
expect(result).toStrictEqual({
|
|
611
|
+
type: "root",
|
|
612
|
+
id: FernNavigation.NodeId("root"),
|
|
613
|
+
slug: FernNavigation.Slug(""),
|
|
614
|
+
title: "Root",
|
|
615
|
+
version: "v2",
|
|
616
|
+
roles: undefined,
|
|
617
|
+
child: {
|
|
618
|
+
type: "versioned",
|
|
619
|
+
id: FernNavigation.NodeId("versioned"),
|
|
620
|
+
children: [
|
|
621
|
+
{
|
|
622
|
+
type: "version",
|
|
623
|
+
id: FernNavigation.NodeId("v1"),
|
|
624
|
+
slug: FernNavigation.Slug("v1"),
|
|
625
|
+
title: "Version 1",
|
|
626
|
+
default: false,
|
|
627
|
+
versionId: FernNavigation.VersionId("v1"),
|
|
628
|
+
landingPage: {
|
|
629
|
+
type: "landingPage",
|
|
630
|
+
id: FernNavigation.NodeId("v1-landing"),
|
|
631
|
+
slug: FernNavigation.Slug("v1/welcome"),
|
|
632
|
+
title: "V1 Landing",
|
|
633
|
+
pageId: FernNavigation.PageId("index.mdx"),
|
|
634
|
+
canonicalSlug: FernNavigation.Slug("welcome"),
|
|
635
|
+
icon: undefined,
|
|
636
|
+
hidden: undefined,
|
|
637
|
+
authed: undefined,
|
|
638
|
+
noindex: undefined,
|
|
639
|
+
viewers: undefined,
|
|
640
|
+
orphaned: undefined,
|
|
641
|
+
featureFlags: undefined,
|
|
642
|
+
},
|
|
643
|
+
child: {
|
|
644
|
+
type: "sidebarRoot",
|
|
645
|
+
id: FernNavigation.NodeId("v1-sidebar"),
|
|
646
|
+
children: [],
|
|
647
|
+
},
|
|
648
|
+
availability: undefined,
|
|
649
|
+
canonicalSlug: undefined,
|
|
650
|
+
icon: undefined,
|
|
651
|
+
hidden: undefined,
|
|
652
|
+
authed: undefined,
|
|
653
|
+
pointsTo: "v1/welcome",
|
|
654
|
+
viewers: undefined,
|
|
655
|
+
orphaned: undefined,
|
|
656
|
+
featureFlags: undefined,
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
type: "version",
|
|
660
|
+
id: FernNavigation.NodeId("v2"),
|
|
661
|
+
slug: FernNavigation.Slug("v2"),
|
|
662
|
+
title: "Version 2",
|
|
663
|
+
default: true,
|
|
664
|
+
versionId: FernNavigation.VersionId("v2"),
|
|
665
|
+
landingPage: {
|
|
666
|
+
type: "landingPage",
|
|
667
|
+
id: FernNavigation.NodeId("v2-landing"),
|
|
668
|
+
slug: FernNavigation.Slug("v2/welcome"),
|
|
669
|
+
title: "V2 Landing",
|
|
670
|
+
pageId: FernNavigation.PageId("index.mdx"),
|
|
671
|
+
canonicalSlug: FernNavigation.Slug("welcome"),
|
|
672
|
+
icon: undefined,
|
|
673
|
+
hidden: undefined,
|
|
674
|
+
authed: undefined,
|
|
675
|
+
noindex: undefined,
|
|
676
|
+
viewers: undefined,
|
|
677
|
+
orphaned: undefined,
|
|
678
|
+
featureFlags: undefined,
|
|
679
|
+
},
|
|
680
|
+
child: {
|
|
681
|
+
type: "sidebarRoot",
|
|
682
|
+
id: FernNavigation.NodeId("v2-sidebar"),
|
|
683
|
+
children: [
|
|
684
|
+
{
|
|
685
|
+
type: "section",
|
|
686
|
+
id: FernNavigation.NodeId("v2-section"),
|
|
687
|
+
slug: FernNavigation.Slug("welcome"),
|
|
688
|
+
title: "V2 Section",
|
|
689
|
+
overviewPageId: undefined,
|
|
690
|
+
children: [
|
|
691
|
+
{
|
|
692
|
+
type: "page",
|
|
693
|
+
id: FernNavigation.NodeId("v2-page"),
|
|
694
|
+
slug: FernNavigation.Slug("page"),
|
|
695
|
+
title: "V2 Page",
|
|
696
|
+
pageId: FernNavigation.PageId("v2-page.mdx"),
|
|
697
|
+
canonicalSlug: undefined,
|
|
698
|
+
icon: undefined,
|
|
699
|
+
hidden: undefined,
|
|
700
|
+
authed: undefined,
|
|
701
|
+
noindex: undefined,
|
|
702
|
+
viewers: undefined,
|
|
703
|
+
orphaned: undefined,
|
|
704
|
+
featureFlags: undefined,
|
|
705
|
+
},
|
|
706
|
+
],
|
|
707
|
+
collapsed: undefined,
|
|
708
|
+
canonicalSlug: undefined,
|
|
709
|
+
icon: undefined,
|
|
710
|
+
hidden: undefined,
|
|
711
|
+
authed: undefined,
|
|
712
|
+
noindex: undefined,
|
|
713
|
+
pointsTo: "page",
|
|
714
|
+
viewers: undefined,
|
|
715
|
+
orphaned: undefined,
|
|
716
|
+
featureFlags: undefined,
|
|
717
|
+
},
|
|
718
|
+
],
|
|
719
|
+
},
|
|
720
|
+
availability: undefined,
|
|
721
|
+
canonicalSlug: undefined,
|
|
722
|
+
icon: undefined,
|
|
723
|
+
hidden: undefined,
|
|
724
|
+
authed: undefined,
|
|
725
|
+
pointsTo: "v2/welcome",
|
|
726
|
+
viewers: undefined,
|
|
727
|
+
orphaned: undefined,
|
|
728
|
+
featureFlags: undefined,
|
|
729
|
+
},
|
|
730
|
+
],
|
|
731
|
+
},
|
|
732
|
+
canonicalSlug: undefined,
|
|
733
|
+
icon: undefined,
|
|
734
|
+
hidden: undefined,
|
|
735
|
+
authed: undefined,
|
|
736
|
+
pointsTo: "welcome", // unversioned pointsTo field
|
|
737
|
+
viewers: undefined,
|
|
738
|
+
orphaned: undefined,
|
|
739
|
+
featureFlags: undefined,
|
|
740
|
+
});
|
|
741
|
+
});
|
|
438
742
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updatePointsTo.d.ts","sourceRoot":"","sources":["../../../src/navigation/utils/updatePointsTo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"updatePointsTo.d.ts","sourceRoot":"","sources":["../../../src/navigation/utils/updatePointsTo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAIvC;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,cAAc,CAAC,cAAc,GACnC,IAAI,CAwBN"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FernNavigation } from "../..";
|
|
2
|
+
import { NodeCollector } from "../NodeCollector";
|
|
2
3
|
import { followRedirect } from "./followRedirect";
|
|
3
4
|
/**
|
|
4
5
|
* Uses depth-first traversal to update the pointsTo property of all nodes in the tree.
|
|
@@ -6,10 +7,28 @@ import { followRedirect } from "./followRedirect";
|
|
|
6
7
|
* @param input will be mutated
|
|
7
8
|
*/
|
|
8
9
|
export function mutableUpdatePointsTo(input) {
|
|
10
|
+
const collector = NodeCollector.collect(input);
|
|
11
|
+
const slugMap = collector.getSlugMapWithParents();
|
|
9
12
|
FernNavigation.traverseDF(input, (node) => {
|
|
10
13
|
if (FernNavigation.hasPointsTo(node)) {
|
|
11
14
|
const pointsTo = followRedirect(node);
|
|
12
|
-
|
|
15
|
+
if (pointsTo != null) {
|
|
16
|
+
if (node.type === "root") {
|
|
17
|
+
const targetNode = slugMap.get(pointsTo)?.node;
|
|
18
|
+
// if the node we should redirect to has a canonical url, default to that
|
|
19
|
+
if (targetNode != null) {
|
|
20
|
+
node.pointsTo =
|
|
21
|
+
targetNode.canonicalSlug ??
|
|
22
|
+
(node.slug === targetNode.slug ? undefined : targetNode.slug);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
node.pointsTo = node.slug === pointsTo ? undefined : pointsTo;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
node.pointsTo = undefined;
|
|
31
|
+
}
|
|
13
32
|
}
|
|
14
33
|
});
|
|
15
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fern-api/fdr-sdk",
|
|
3
|
-
"version": "0.139.5-
|
|
3
|
+
"version": "0.139.5-2c30cfa75",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"test:update": "vitest --run --passWithNoTests --globals -u"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@fern-api/ui-core-utils": "0.139.5-
|
|
52
|
+
"@fern-api/ui-core-utils": "0.139.5-2c30cfa75*",
|
|
53
53
|
"@ungap/structured-clone": "^1.2.0",
|
|
54
54
|
"dayjs": "^1.11.11",
|
|
55
55
|
"es-toolkit": "^1.32.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@babel/core": "^7.26.9",
|
|
69
69
|
"@babel/preset-env": "^7.26.0",
|
|
70
70
|
"@babel/preset-typescript": "^7.26.0",
|
|
71
|
-
"@fern-platform/configs": "0.139.5-
|
|
71
|
+
"@fern-platform/configs": "0.139.5-2c30cfa75*",
|
|
72
72
|
"@types/node-fetch": "2.6.9",
|
|
73
73
|
"@types/qs": "6.9.14",
|
|
74
74
|
"@types/tinycolor2": "^1.4.6",
|