@uniformdev/project-map 19.186.4-alpha.3 → 19.187.0
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/index.d.mts +122 -8
- package/dist/index.d.ts +122 -8
- package/dist/index.esm.js +67 -0
- package/dist/index.js +69 -0
- package/dist/index.mjs +67 -0
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -193,7 +193,7 @@ interface paths {
|
|
|
193
193
|
id?: string;
|
|
194
194
|
/** The path of the root node to retrieve, cannot have both this parameter and `id` */
|
|
195
195
|
path?: string;
|
|
196
|
-
/** Composition id to find associated
|
|
196
|
+
/** Composition id to find associated project map node for */
|
|
197
197
|
compositionId?: string;
|
|
198
198
|
/** Limit the number or records returned by a number */
|
|
199
199
|
limit?: number;
|
|
@@ -412,18 +412,27 @@ interface components {
|
|
|
412
412
|
*/
|
|
413
413
|
id?: string;
|
|
414
414
|
}[];
|
|
415
|
-
/**
|
|
415
|
+
/**
|
|
416
|
+
* @description Basic information about the linked composition from the context of a project map node.
|
|
417
|
+
* If the linked composition has editions, the editions are included in the `editions` property.
|
|
418
|
+
*/
|
|
416
419
|
ProjectMapNodeCompositionData: {
|
|
417
|
-
/** @description Type of the composition
|
|
420
|
+
/** @description Type of the linked composition (id of its definition) */
|
|
418
421
|
type: string;
|
|
419
422
|
/**
|
|
420
423
|
* Format: uuid
|
|
421
|
-
* @description The
|
|
424
|
+
* @description The UUID of the linked composition
|
|
422
425
|
*/
|
|
423
426
|
id: string;
|
|
424
|
-
/**
|
|
427
|
+
/**
|
|
428
|
+
* Format: uuid
|
|
429
|
+
* @description The edition UUID underneath the linked composition
|
|
430
|
+
* This is only present if the composition has not been published, but an edition has
|
|
431
|
+
*/
|
|
432
|
+
editionId?: string;
|
|
433
|
+
/** @description Slug pattern of the linked composition or edition */
|
|
425
434
|
slug?: string | null;
|
|
426
|
-
/** @description Friendly name of this composition */
|
|
435
|
+
/** @description Friendly name of this composition or edition */
|
|
427
436
|
name: string;
|
|
428
437
|
/**
|
|
429
438
|
* @deprecated
|
|
@@ -438,7 +447,61 @@ interface components {
|
|
|
438
447
|
icon?: string;
|
|
439
448
|
/** @description Friendly name of this Composition's Definition */
|
|
440
449
|
typeName?: string;
|
|
441
|
-
/**
|
|
450
|
+
/**
|
|
451
|
+
* @description List of locales that the composition _or any of its editions_ is available in.
|
|
452
|
+
* If empty, available in all locales.
|
|
453
|
+
*/
|
|
454
|
+
locales: string[];
|
|
455
|
+
/** @description Priority of the composition relative to any editions */
|
|
456
|
+
editionPriority?: number;
|
|
457
|
+
/** @description Friendly name of the edition */
|
|
458
|
+
editionName?: string;
|
|
459
|
+
/**
|
|
460
|
+
* @deprecated
|
|
461
|
+
* @description List of editions available for this composition. The composition is included in the list, it is the edition
|
|
462
|
+
* where the editionID equals the node's compositionID.
|
|
463
|
+
*/
|
|
464
|
+
editions?: components["schemas"]["ProjectMapNodeCompositionEditionData"][];
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* @deprecated
|
|
468
|
+
* @description Basic information about a composition edition from the context of a project map node
|
|
469
|
+
*/
|
|
470
|
+
ProjectMapNodeCompositionEditionData: {
|
|
471
|
+
/**
|
|
472
|
+
* Format: uuid
|
|
473
|
+
* @description The UUID of the linked composition
|
|
474
|
+
*/
|
|
475
|
+
id: string;
|
|
476
|
+
/** @description Type of the edition instance (public_id of its definition) */
|
|
477
|
+
type: string;
|
|
478
|
+
/**
|
|
479
|
+
* Format: uuid
|
|
480
|
+
* @description The edition UUID underneath the linked composition
|
|
481
|
+
*/
|
|
482
|
+
editionId?: string;
|
|
483
|
+
/** @description Slug pattern of this edition */
|
|
484
|
+
slug?: string | null;
|
|
485
|
+
/** @description Friendly name of the linked composition */
|
|
486
|
+
name: string;
|
|
487
|
+
/** @description Friendly name of the edition */
|
|
488
|
+
editionName?: string;
|
|
489
|
+
/** @description Priority of the edition */
|
|
490
|
+
editionPriority?: number;
|
|
491
|
+
/**
|
|
492
|
+
* @deprecated
|
|
493
|
+
* @description UI status value. Subject to change without notice; do not rely on this value. Only present when `withCompositionUIStatus` option is true
|
|
494
|
+
* @enum {string}
|
|
495
|
+
*/
|
|
496
|
+
uiStatus?: "Draft" | "Modified" | "Published" | "Orphan";
|
|
497
|
+
/**
|
|
498
|
+
* @description Icon name or URL for the composition edition (e.g. 'screen' or 'https://s3/my-component.jpg')
|
|
499
|
+
* @default screen
|
|
500
|
+
*/
|
|
501
|
+
icon?: string;
|
|
502
|
+
/** @description Friendly name of this edition's definition */
|
|
503
|
+
typeName?: string;
|
|
504
|
+
/** @description List of locales that the edition is available in. If empty, available in all locales */
|
|
442
505
|
locales: string[];
|
|
443
506
|
/**
|
|
444
507
|
* Format: date-time
|
|
@@ -571,6 +634,8 @@ type ProjectMapNodeGetResponse = paths['/api/v1/project-map-nodes']['get']['resp
|
|
|
571
634
|
type ProjectMapNode = NonNullable<ProjectMapNodeGetResponse['nodes']>[0];
|
|
572
635
|
type ProjectMapNodeLocale = NonNullable<ProjectMapNode['locales']>[string];
|
|
573
636
|
type ProjectMapNodeWithId = ProjectMapNode & Required<Pick<ProjectMapNode, 'id' | 'name'>>;
|
|
637
|
+
type ProjectMapNodeCompositionData = NonNullable<ProjectMapNode['compositionData']>;
|
|
638
|
+
type ProjectMapNodeCompositionEditionData = NonNullable<NonNullable<ProjectMapNode['compositionData']>['editions']>[0];
|
|
574
639
|
type ProjectMapGetRequest = paths$1['/api/v1/project-map']['get']['parameters']['query'];
|
|
575
640
|
type ProjectMapGetResponse = paths$1['/api/v1/project-map']['get']['responses']['200']['content']['application/json'];
|
|
576
641
|
type ProjectMapUpsertRequest = paths$1['/api/v1/project-map']['put']['requestBody']['content']['application/json'];
|
|
@@ -664,6 +729,55 @@ declare class UncachedProjectMapClient extends ProjectMapClient {
|
|
|
664
729
|
*/
|
|
665
730
|
declare const __INTERNAL_MISSING_PARENT_NODE_ERROR = "Upsert failed, parent node not found.";
|
|
666
731
|
|
|
732
|
+
interface ObjectWithEditionMetadata {
|
|
733
|
+
editionId?: string;
|
|
734
|
+
editionPriority?: number;
|
|
735
|
+
editionName?: string;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* @deprecated pre-release functionality subject to change
|
|
739
|
+
*/
|
|
740
|
+
interface GetActiveEditionOptions<T> {
|
|
741
|
+
/** Node to pick the active edition for */
|
|
742
|
+
editions: Array<T>;
|
|
743
|
+
/** Selects the composition/entry ID from the edition */
|
|
744
|
+
selectId: (edition: T) => string;
|
|
745
|
+
/** Selects locales that are enabled on an edition */
|
|
746
|
+
selectEnabledLocales: (edition: T) => string[];
|
|
747
|
+
selectEdition: (edition: T) => ObjectWithEditionMetadata;
|
|
748
|
+
/**
|
|
749
|
+
* The current locale to resolve an edition for.
|
|
750
|
+
* When undefined, the default edition/composition is always matched if it exists.
|
|
751
|
+
*/
|
|
752
|
+
targetLocale: string | undefined;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Finds the active edition for a given locale in an array of all editions.
|
|
756
|
+
* The active edition is the highest priority edition that enables the target locale.
|
|
757
|
+
* If there is no target locale, then the default edition is returned if there is one.
|
|
758
|
+
* Otherwise, undefined is returned (no edition matches).
|
|
759
|
+
* @deprecated pre-release functionality subject to change
|
|
760
|
+
*/
|
|
761
|
+
declare function getActiveEdition<T>({ editions, selectEdition, selectId, selectEnabledLocales, targetLocale, }: GetActiveEditionOptions<T>): T | undefined;
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Finds the active edition for a given locale in a node's compositionData.
|
|
765
|
+
* Note: All editions, including the composition, are stored in the editions array when it is present.
|
|
766
|
+
* @deprecated pre-release functionality subject to change
|
|
767
|
+
*/
|
|
768
|
+
declare function getNodeActiveCompositionEdition({ node, targetLocale, fallbackWhenLocaleNotMatched, }: {
|
|
769
|
+
/** Node to pick the active edition for */
|
|
770
|
+
node: Pick<ProjectMapNode, 'compositionData'>;
|
|
771
|
+
/** The current locale to resolve an edition for. When undefined, the compositionData is always matched. */
|
|
772
|
+
targetLocale: string | undefined;
|
|
773
|
+
/**
|
|
774
|
+
* Whether to fallback to the composition if nothing enables the target locale
|
|
775
|
+
* false (default): return undefined if nothing enables the target locale
|
|
776
|
+
* true: return the composition if nothing enables the target locale
|
|
777
|
+
*/
|
|
778
|
+
fallbackWhenLocaleNotMatched?: boolean;
|
|
779
|
+
}): ProjectMapNode['compositionData'] | undefined;
|
|
780
|
+
|
|
667
781
|
type LocalePathNode = Pick<ProjectMapNode, 'path'> & {
|
|
668
782
|
locales?: Record<string, {
|
|
669
783
|
path?: string | undefined;
|
|
@@ -728,4 +842,4 @@ declare class Route {
|
|
|
728
842
|
static dynamicSegmentPrefix: string;
|
|
729
843
|
}
|
|
730
844
|
|
|
731
|
-
export { type AlternateLocaleUrls, type ExpandOptions, type LocalePathNode, type MatchedRoute, type NodeType, ProjectMapClient, type ProjectMapClientOptions, type ProjectMapDefinition, type ProjectMapDefinitionWithId, type ProjectMapDefinitions, type ProjectMapDeleteRequest, type ProjectMapGetRequest, type ProjectMapGetResponse, type ProjectMapNode, type ProjectMapNodeAllowedQueryString, type ProjectMapNodeData, type ProjectMapNodeDeleteRequest, type ProjectMapNodeGetRequest, type ProjectMapNodeGetResponse, type ProjectMapNodeLocale, type ProjectMapNodeUpsertRequest, type ProjectMapNodeUpsertRequestNode, type ProjectMapNodeUpsertRequestNodeLocale, type ProjectMapNodeWithId, type ProjectMapNodeWithProjectMapReference, type ProjectMapSubtree, type ProjectMapUpsertRequest, type ProjectMapUpsertResponse, ROOT_NODE_PATH, Route, UncachedProjectMapClient, type UnmatchedRoute, __INTERNAL_MISSING_PARENT_NODE_ERROR, getNodeLocalePath, getRouteAlternateLocalesUrls };
|
|
845
|
+
export { type AlternateLocaleUrls, type ExpandOptions, type GetActiveEditionOptions, type LocalePathNode, type MatchedRoute, type NodeType, type ObjectWithEditionMetadata, ProjectMapClient, type ProjectMapClientOptions, type ProjectMapDefinition, type ProjectMapDefinitionWithId, type ProjectMapDefinitions, type ProjectMapDeleteRequest, type ProjectMapGetRequest, type ProjectMapGetResponse, type ProjectMapNode, type ProjectMapNodeAllowedQueryString, type ProjectMapNodeCompositionData, type ProjectMapNodeCompositionEditionData, type ProjectMapNodeData, type ProjectMapNodeDeleteRequest, type ProjectMapNodeGetRequest, type ProjectMapNodeGetResponse, type ProjectMapNodeLocale, type ProjectMapNodeUpsertRequest, type ProjectMapNodeUpsertRequestNode, type ProjectMapNodeUpsertRequestNodeLocale, type ProjectMapNodeWithId, type ProjectMapNodeWithProjectMapReference, type ProjectMapSubtree, type ProjectMapUpsertRequest, type ProjectMapUpsertResponse, ROOT_NODE_PATH, Route, UncachedProjectMapClient, type UnmatchedRoute, __INTERNAL_MISSING_PARENT_NODE_ERROR, getActiveEdition, getNodeActiveCompositionEdition, getNodeLocalePath, getRouteAlternateLocalesUrls };
|
package/dist/index.d.ts
CHANGED
|
@@ -193,7 +193,7 @@ interface paths {
|
|
|
193
193
|
id?: string;
|
|
194
194
|
/** The path of the root node to retrieve, cannot have both this parameter and `id` */
|
|
195
195
|
path?: string;
|
|
196
|
-
/** Composition id to find associated
|
|
196
|
+
/** Composition id to find associated project map node for */
|
|
197
197
|
compositionId?: string;
|
|
198
198
|
/** Limit the number or records returned by a number */
|
|
199
199
|
limit?: number;
|
|
@@ -412,18 +412,27 @@ interface components {
|
|
|
412
412
|
*/
|
|
413
413
|
id?: string;
|
|
414
414
|
}[];
|
|
415
|
-
/**
|
|
415
|
+
/**
|
|
416
|
+
* @description Basic information about the linked composition from the context of a project map node.
|
|
417
|
+
* If the linked composition has editions, the editions are included in the `editions` property.
|
|
418
|
+
*/
|
|
416
419
|
ProjectMapNodeCompositionData: {
|
|
417
|
-
/** @description Type of the composition
|
|
420
|
+
/** @description Type of the linked composition (id of its definition) */
|
|
418
421
|
type: string;
|
|
419
422
|
/**
|
|
420
423
|
* Format: uuid
|
|
421
|
-
* @description The
|
|
424
|
+
* @description The UUID of the linked composition
|
|
422
425
|
*/
|
|
423
426
|
id: string;
|
|
424
|
-
/**
|
|
427
|
+
/**
|
|
428
|
+
* Format: uuid
|
|
429
|
+
* @description The edition UUID underneath the linked composition
|
|
430
|
+
* This is only present if the composition has not been published, but an edition has
|
|
431
|
+
*/
|
|
432
|
+
editionId?: string;
|
|
433
|
+
/** @description Slug pattern of the linked composition or edition */
|
|
425
434
|
slug?: string | null;
|
|
426
|
-
/** @description Friendly name of this composition */
|
|
435
|
+
/** @description Friendly name of this composition or edition */
|
|
427
436
|
name: string;
|
|
428
437
|
/**
|
|
429
438
|
* @deprecated
|
|
@@ -438,7 +447,61 @@ interface components {
|
|
|
438
447
|
icon?: string;
|
|
439
448
|
/** @description Friendly name of this Composition's Definition */
|
|
440
449
|
typeName?: string;
|
|
441
|
-
/**
|
|
450
|
+
/**
|
|
451
|
+
* @description List of locales that the composition _or any of its editions_ is available in.
|
|
452
|
+
* If empty, available in all locales.
|
|
453
|
+
*/
|
|
454
|
+
locales: string[];
|
|
455
|
+
/** @description Priority of the composition relative to any editions */
|
|
456
|
+
editionPriority?: number;
|
|
457
|
+
/** @description Friendly name of the edition */
|
|
458
|
+
editionName?: string;
|
|
459
|
+
/**
|
|
460
|
+
* @deprecated
|
|
461
|
+
* @description List of editions available for this composition. The composition is included in the list, it is the edition
|
|
462
|
+
* where the editionID equals the node's compositionID.
|
|
463
|
+
*/
|
|
464
|
+
editions?: components["schemas"]["ProjectMapNodeCompositionEditionData"][];
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* @deprecated
|
|
468
|
+
* @description Basic information about a composition edition from the context of a project map node
|
|
469
|
+
*/
|
|
470
|
+
ProjectMapNodeCompositionEditionData: {
|
|
471
|
+
/**
|
|
472
|
+
* Format: uuid
|
|
473
|
+
* @description The UUID of the linked composition
|
|
474
|
+
*/
|
|
475
|
+
id: string;
|
|
476
|
+
/** @description Type of the edition instance (public_id of its definition) */
|
|
477
|
+
type: string;
|
|
478
|
+
/**
|
|
479
|
+
* Format: uuid
|
|
480
|
+
* @description The edition UUID underneath the linked composition
|
|
481
|
+
*/
|
|
482
|
+
editionId?: string;
|
|
483
|
+
/** @description Slug pattern of this edition */
|
|
484
|
+
slug?: string | null;
|
|
485
|
+
/** @description Friendly name of the linked composition */
|
|
486
|
+
name: string;
|
|
487
|
+
/** @description Friendly name of the edition */
|
|
488
|
+
editionName?: string;
|
|
489
|
+
/** @description Priority of the edition */
|
|
490
|
+
editionPriority?: number;
|
|
491
|
+
/**
|
|
492
|
+
* @deprecated
|
|
493
|
+
* @description UI status value. Subject to change without notice; do not rely on this value. Only present when `withCompositionUIStatus` option is true
|
|
494
|
+
* @enum {string}
|
|
495
|
+
*/
|
|
496
|
+
uiStatus?: "Draft" | "Modified" | "Published" | "Orphan";
|
|
497
|
+
/**
|
|
498
|
+
* @description Icon name or URL for the composition edition (e.g. 'screen' or 'https://s3/my-component.jpg')
|
|
499
|
+
* @default screen
|
|
500
|
+
*/
|
|
501
|
+
icon?: string;
|
|
502
|
+
/** @description Friendly name of this edition's definition */
|
|
503
|
+
typeName?: string;
|
|
504
|
+
/** @description List of locales that the edition is available in. If empty, available in all locales */
|
|
442
505
|
locales: string[];
|
|
443
506
|
/**
|
|
444
507
|
* Format: date-time
|
|
@@ -571,6 +634,8 @@ type ProjectMapNodeGetResponse = paths['/api/v1/project-map-nodes']['get']['resp
|
|
|
571
634
|
type ProjectMapNode = NonNullable<ProjectMapNodeGetResponse['nodes']>[0];
|
|
572
635
|
type ProjectMapNodeLocale = NonNullable<ProjectMapNode['locales']>[string];
|
|
573
636
|
type ProjectMapNodeWithId = ProjectMapNode & Required<Pick<ProjectMapNode, 'id' | 'name'>>;
|
|
637
|
+
type ProjectMapNodeCompositionData = NonNullable<ProjectMapNode['compositionData']>;
|
|
638
|
+
type ProjectMapNodeCompositionEditionData = NonNullable<NonNullable<ProjectMapNode['compositionData']>['editions']>[0];
|
|
574
639
|
type ProjectMapGetRequest = paths$1['/api/v1/project-map']['get']['parameters']['query'];
|
|
575
640
|
type ProjectMapGetResponse = paths$1['/api/v1/project-map']['get']['responses']['200']['content']['application/json'];
|
|
576
641
|
type ProjectMapUpsertRequest = paths$1['/api/v1/project-map']['put']['requestBody']['content']['application/json'];
|
|
@@ -664,6 +729,55 @@ declare class UncachedProjectMapClient extends ProjectMapClient {
|
|
|
664
729
|
*/
|
|
665
730
|
declare const __INTERNAL_MISSING_PARENT_NODE_ERROR = "Upsert failed, parent node not found.";
|
|
666
731
|
|
|
732
|
+
interface ObjectWithEditionMetadata {
|
|
733
|
+
editionId?: string;
|
|
734
|
+
editionPriority?: number;
|
|
735
|
+
editionName?: string;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* @deprecated pre-release functionality subject to change
|
|
739
|
+
*/
|
|
740
|
+
interface GetActiveEditionOptions<T> {
|
|
741
|
+
/** Node to pick the active edition for */
|
|
742
|
+
editions: Array<T>;
|
|
743
|
+
/** Selects the composition/entry ID from the edition */
|
|
744
|
+
selectId: (edition: T) => string;
|
|
745
|
+
/** Selects locales that are enabled on an edition */
|
|
746
|
+
selectEnabledLocales: (edition: T) => string[];
|
|
747
|
+
selectEdition: (edition: T) => ObjectWithEditionMetadata;
|
|
748
|
+
/**
|
|
749
|
+
* The current locale to resolve an edition for.
|
|
750
|
+
* When undefined, the default edition/composition is always matched if it exists.
|
|
751
|
+
*/
|
|
752
|
+
targetLocale: string | undefined;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Finds the active edition for a given locale in an array of all editions.
|
|
756
|
+
* The active edition is the highest priority edition that enables the target locale.
|
|
757
|
+
* If there is no target locale, then the default edition is returned if there is one.
|
|
758
|
+
* Otherwise, undefined is returned (no edition matches).
|
|
759
|
+
* @deprecated pre-release functionality subject to change
|
|
760
|
+
*/
|
|
761
|
+
declare function getActiveEdition<T>({ editions, selectEdition, selectId, selectEnabledLocales, targetLocale, }: GetActiveEditionOptions<T>): T | undefined;
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Finds the active edition for a given locale in a node's compositionData.
|
|
765
|
+
* Note: All editions, including the composition, are stored in the editions array when it is present.
|
|
766
|
+
* @deprecated pre-release functionality subject to change
|
|
767
|
+
*/
|
|
768
|
+
declare function getNodeActiveCompositionEdition({ node, targetLocale, fallbackWhenLocaleNotMatched, }: {
|
|
769
|
+
/** Node to pick the active edition for */
|
|
770
|
+
node: Pick<ProjectMapNode, 'compositionData'>;
|
|
771
|
+
/** The current locale to resolve an edition for. When undefined, the compositionData is always matched. */
|
|
772
|
+
targetLocale: string | undefined;
|
|
773
|
+
/**
|
|
774
|
+
* Whether to fallback to the composition if nothing enables the target locale
|
|
775
|
+
* false (default): return undefined if nothing enables the target locale
|
|
776
|
+
* true: return the composition if nothing enables the target locale
|
|
777
|
+
*/
|
|
778
|
+
fallbackWhenLocaleNotMatched?: boolean;
|
|
779
|
+
}): ProjectMapNode['compositionData'] | undefined;
|
|
780
|
+
|
|
667
781
|
type LocalePathNode = Pick<ProjectMapNode, 'path'> & {
|
|
668
782
|
locales?: Record<string, {
|
|
669
783
|
path?: string | undefined;
|
|
@@ -728,4 +842,4 @@ declare class Route {
|
|
|
728
842
|
static dynamicSegmentPrefix: string;
|
|
729
843
|
}
|
|
730
844
|
|
|
731
|
-
export { type AlternateLocaleUrls, type ExpandOptions, type LocalePathNode, type MatchedRoute, type NodeType, ProjectMapClient, type ProjectMapClientOptions, type ProjectMapDefinition, type ProjectMapDefinitionWithId, type ProjectMapDefinitions, type ProjectMapDeleteRequest, type ProjectMapGetRequest, type ProjectMapGetResponse, type ProjectMapNode, type ProjectMapNodeAllowedQueryString, type ProjectMapNodeData, type ProjectMapNodeDeleteRequest, type ProjectMapNodeGetRequest, type ProjectMapNodeGetResponse, type ProjectMapNodeLocale, type ProjectMapNodeUpsertRequest, type ProjectMapNodeUpsertRequestNode, type ProjectMapNodeUpsertRequestNodeLocale, type ProjectMapNodeWithId, type ProjectMapNodeWithProjectMapReference, type ProjectMapSubtree, type ProjectMapUpsertRequest, type ProjectMapUpsertResponse, ROOT_NODE_PATH, Route, UncachedProjectMapClient, type UnmatchedRoute, __INTERNAL_MISSING_PARENT_NODE_ERROR, getNodeLocalePath, getRouteAlternateLocalesUrls };
|
|
845
|
+
export { type AlternateLocaleUrls, type ExpandOptions, type GetActiveEditionOptions, type LocalePathNode, type MatchedRoute, type NodeType, type ObjectWithEditionMetadata, ProjectMapClient, type ProjectMapClientOptions, type ProjectMapDefinition, type ProjectMapDefinitionWithId, type ProjectMapDefinitions, type ProjectMapDeleteRequest, type ProjectMapGetRequest, type ProjectMapGetResponse, type ProjectMapNode, type ProjectMapNodeAllowedQueryString, type ProjectMapNodeCompositionData, type ProjectMapNodeCompositionEditionData, type ProjectMapNodeData, type ProjectMapNodeDeleteRequest, type ProjectMapNodeGetRequest, type ProjectMapNodeGetResponse, type ProjectMapNodeLocale, type ProjectMapNodeUpsertRequest, type ProjectMapNodeUpsertRequestNode, type ProjectMapNodeUpsertRequestNodeLocale, type ProjectMapNodeWithId, type ProjectMapNodeWithProjectMapReference, type ProjectMapSubtree, type ProjectMapUpsertRequest, type ProjectMapUpsertResponse, ROOT_NODE_PATH, Route, UncachedProjectMapClient, type UnmatchedRoute, __INTERNAL_MISSING_PARENT_NODE_ERROR, getActiveEdition, getNodeActiveCompositionEdition, getNodeLocalePath, getRouteAlternateLocalesUrls };
|
package/dist/index.esm.js
CHANGED
|
@@ -180,6 +180,71 @@ var cutReferences = (node) => node ? {
|
|
|
180
180
|
} : void 0;
|
|
181
181
|
var __INTERNAL_MISSING_PARENT_NODE_ERROR = "Upsert failed, parent node not found.";
|
|
182
182
|
|
|
183
|
+
// src/util/getActiveEdition.ts
|
|
184
|
+
function getActiveEdition({
|
|
185
|
+
editions,
|
|
186
|
+
selectEdition,
|
|
187
|
+
selectId,
|
|
188
|
+
selectEnabledLocales,
|
|
189
|
+
targetLocale
|
|
190
|
+
}) {
|
|
191
|
+
if (!editions || !editions.length) {
|
|
192
|
+
return void 0;
|
|
193
|
+
}
|
|
194
|
+
if (!targetLocale) {
|
|
195
|
+
return editions.find((t) => {
|
|
196
|
+
const edition = selectEdition(t);
|
|
197
|
+
return !edition.editionId || edition.editionId === selectId(t);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
let activeT = void 0;
|
|
201
|
+
editions.forEach((t) => {
|
|
202
|
+
var _a, _b, _c, _d;
|
|
203
|
+
const edition = selectEdition(t);
|
|
204
|
+
const activeEdition = activeT ? selectEdition(activeT) : void 0;
|
|
205
|
+
const editionPriority = (_a = edition.editionPriority) != null ? _a : 0;
|
|
206
|
+
const activeEditionPriority = (_b = activeEdition == null ? void 0 : activeEdition.editionPriority) != null ? _b : Number.MIN_SAFE_INTEGER;
|
|
207
|
+
if (selectEnabledLocales(t).includes(targetLocale) && (editionPriority > activeEditionPriority || editionPriority === activeEditionPriority && ((_c = edition.editionName) != null ? _c : "").localeCompare((_d = activeEdition == null ? void 0 : activeEdition.editionName) != null ? _d : "", "en", {
|
|
208
|
+
sensitivity: "base"
|
|
209
|
+
}) < 0)) {
|
|
210
|
+
activeT = t;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
return activeT;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// src/util/getNodeActiveCompositionEdition.ts
|
|
217
|
+
function getNodeActiveCompositionEdition({
|
|
218
|
+
node,
|
|
219
|
+
targetLocale,
|
|
220
|
+
fallbackWhenLocaleNotMatched = false
|
|
221
|
+
}) {
|
|
222
|
+
var _a;
|
|
223
|
+
if (!node.compositionData) {
|
|
224
|
+
return void 0;
|
|
225
|
+
}
|
|
226
|
+
if (!targetLocale) {
|
|
227
|
+
return node.compositionData;
|
|
228
|
+
}
|
|
229
|
+
const activeEdition = getActiveEdition({
|
|
230
|
+
editions: (_a = node.compositionData.editions) != null ? _a : [],
|
|
231
|
+
selectId: (edition) => {
|
|
232
|
+
var _a2;
|
|
233
|
+
return (_a2 = edition.editionId) != null ? _a2 : "";
|
|
234
|
+
},
|
|
235
|
+
selectEnabledLocales: (edition) => edition.locales,
|
|
236
|
+
selectEdition: (edition) => edition,
|
|
237
|
+
targetLocale
|
|
238
|
+
});
|
|
239
|
+
if (!node.compositionData.editions && node.compositionData.locales.includes(targetLocale)) {
|
|
240
|
+
return node.compositionData;
|
|
241
|
+
}
|
|
242
|
+
if (fallbackWhenLocaleNotMatched && !activeEdition) {
|
|
243
|
+
return node.compositionData;
|
|
244
|
+
}
|
|
245
|
+
return activeEdition;
|
|
246
|
+
}
|
|
247
|
+
|
|
183
248
|
// src/util/getNodeLocalePath.ts
|
|
184
249
|
function getNodeLocalePath(node, locale) {
|
|
185
250
|
var _a, _b;
|
|
@@ -343,6 +408,8 @@ export {
|
|
|
343
408
|
Route,
|
|
344
409
|
UncachedProjectMapClient,
|
|
345
410
|
__INTERNAL_MISSING_PARENT_NODE_ERROR,
|
|
411
|
+
getActiveEdition,
|
|
412
|
+
getNodeActiveCompositionEdition,
|
|
346
413
|
getNodeLocalePath,
|
|
347
414
|
getRouteAlternateLocalesUrls
|
|
348
415
|
};
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,8 @@ __export(src_exports, {
|
|
|
33
33
|
Route: () => Route,
|
|
34
34
|
UncachedProjectMapClient: () => UncachedProjectMapClient,
|
|
35
35
|
__INTERNAL_MISSING_PARENT_NODE_ERROR: () => __INTERNAL_MISSING_PARENT_NODE_ERROR,
|
|
36
|
+
getActiveEdition: () => getActiveEdition,
|
|
37
|
+
getNodeActiveCompositionEdition: () => getNodeActiveCompositionEdition,
|
|
36
38
|
getNodeLocalePath: () => getNodeLocalePath,
|
|
37
39
|
getRouteAlternateLocalesUrls: () => getRouteAlternateLocalesUrls
|
|
38
40
|
});
|
|
@@ -211,6 +213,71 @@ var cutReferences = (node) => node ? {
|
|
|
211
213
|
} : void 0;
|
|
212
214
|
var __INTERNAL_MISSING_PARENT_NODE_ERROR = "Upsert failed, parent node not found.";
|
|
213
215
|
|
|
216
|
+
// src/util/getActiveEdition.ts
|
|
217
|
+
function getActiveEdition({
|
|
218
|
+
editions,
|
|
219
|
+
selectEdition,
|
|
220
|
+
selectId,
|
|
221
|
+
selectEnabledLocales,
|
|
222
|
+
targetLocale
|
|
223
|
+
}) {
|
|
224
|
+
if (!editions || !editions.length) {
|
|
225
|
+
return void 0;
|
|
226
|
+
}
|
|
227
|
+
if (!targetLocale) {
|
|
228
|
+
return editions.find((t) => {
|
|
229
|
+
const edition = selectEdition(t);
|
|
230
|
+
return !edition.editionId || edition.editionId === selectId(t);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
let activeT = void 0;
|
|
234
|
+
editions.forEach((t) => {
|
|
235
|
+
var _a, _b, _c, _d;
|
|
236
|
+
const edition = selectEdition(t);
|
|
237
|
+
const activeEdition = activeT ? selectEdition(activeT) : void 0;
|
|
238
|
+
const editionPriority = (_a = edition.editionPriority) != null ? _a : 0;
|
|
239
|
+
const activeEditionPriority = (_b = activeEdition == null ? void 0 : activeEdition.editionPriority) != null ? _b : Number.MIN_SAFE_INTEGER;
|
|
240
|
+
if (selectEnabledLocales(t).includes(targetLocale) && (editionPriority > activeEditionPriority || editionPriority === activeEditionPriority && ((_c = edition.editionName) != null ? _c : "").localeCompare((_d = activeEdition == null ? void 0 : activeEdition.editionName) != null ? _d : "", "en", {
|
|
241
|
+
sensitivity: "base"
|
|
242
|
+
}) < 0)) {
|
|
243
|
+
activeT = t;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
return activeT;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// src/util/getNodeActiveCompositionEdition.ts
|
|
250
|
+
function getNodeActiveCompositionEdition({
|
|
251
|
+
node,
|
|
252
|
+
targetLocale,
|
|
253
|
+
fallbackWhenLocaleNotMatched = false
|
|
254
|
+
}) {
|
|
255
|
+
var _a;
|
|
256
|
+
if (!node.compositionData) {
|
|
257
|
+
return void 0;
|
|
258
|
+
}
|
|
259
|
+
if (!targetLocale) {
|
|
260
|
+
return node.compositionData;
|
|
261
|
+
}
|
|
262
|
+
const activeEdition = getActiveEdition({
|
|
263
|
+
editions: (_a = node.compositionData.editions) != null ? _a : [],
|
|
264
|
+
selectId: (edition) => {
|
|
265
|
+
var _a2;
|
|
266
|
+
return (_a2 = edition.editionId) != null ? _a2 : "";
|
|
267
|
+
},
|
|
268
|
+
selectEnabledLocales: (edition) => edition.locales,
|
|
269
|
+
selectEdition: (edition) => edition,
|
|
270
|
+
targetLocale
|
|
271
|
+
});
|
|
272
|
+
if (!node.compositionData.editions && node.compositionData.locales.includes(targetLocale)) {
|
|
273
|
+
return node.compositionData;
|
|
274
|
+
}
|
|
275
|
+
if (fallbackWhenLocaleNotMatched && !activeEdition) {
|
|
276
|
+
return node.compositionData;
|
|
277
|
+
}
|
|
278
|
+
return activeEdition;
|
|
279
|
+
}
|
|
280
|
+
|
|
214
281
|
// src/util/getNodeLocalePath.ts
|
|
215
282
|
function getNodeLocalePath(node, locale) {
|
|
216
283
|
var _a, _b;
|
|
@@ -375,6 +442,8 @@ function getRouteAlternateLocalesUrls(routeResponse) {
|
|
|
375
442
|
Route,
|
|
376
443
|
UncachedProjectMapClient,
|
|
377
444
|
__INTERNAL_MISSING_PARENT_NODE_ERROR,
|
|
445
|
+
getActiveEdition,
|
|
446
|
+
getNodeActiveCompositionEdition,
|
|
378
447
|
getNodeLocalePath,
|
|
379
448
|
getRouteAlternateLocalesUrls
|
|
380
449
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -180,6 +180,71 @@ var cutReferences = (node) => node ? {
|
|
|
180
180
|
} : void 0;
|
|
181
181
|
var __INTERNAL_MISSING_PARENT_NODE_ERROR = "Upsert failed, parent node not found.";
|
|
182
182
|
|
|
183
|
+
// src/util/getActiveEdition.ts
|
|
184
|
+
function getActiveEdition({
|
|
185
|
+
editions,
|
|
186
|
+
selectEdition,
|
|
187
|
+
selectId,
|
|
188
|
+
selectEnabledLocales,
|
|
189
|
+
targetLocale
|
|
190
|
+
}) {
|
|
191
|
+
if (!editions || !editions.length) {
|
|
192
|
+
return void 0;
|
|
193
|
+
}
|
|
194
|
+
if (!targetLocale) {
|
|
195
|
+
return editions.find((t) => {
|
|
196
|
+
const edition = selectEdition(t);
|
|
197
|
+
return !edition.editionId || edition.editionId === selectId(t);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
let activeT = void 0;
|
|
201
|
+
editions.forEach((t) => {
|
|
202
|
+
var _a, _b, _c, _d;
|
|
203
|
+
const edition = selectEdition(t);
|
|
204
|
+
const activeEdition = activeT ? selectEdition(activeT) : void 0;
|
|
205
|
+
const editionPriority = (_a = edition.editionPriority) != null ? _a : 0;
|
|
206
|
+
const activeEditionPriority = (_b = activeEdition == null ? void 0 : activeEdition.editionPriority) != null ? _b : Number.MIN_SAFE_INTEGER;
|
|
207
|
+
if (selectEnabledLocales(t).includes(targetLocale) && (editionPriority > activeEditionPriority || editionPriority === activeEditionPriority && ((_c = edition.editionName) != null ? _c : "").localeCompare((_d = activeEdition == null ? void 0 : activeEdition.editionName) != null ? _d : "", "en", {
|
|
208
|
+
sensitivity: "base"
|
|
209
|
+
}) < 0)) {
|
|
210
|
+
activeT = t;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
return activeT;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// src/util/getNodeActiveCompositionEdition.ts
|
|
217
|
+
function getNodeActiveCompositionEdition({
|
|
218
|
+
node,
|
|
219
|
+
targetLocale,
|
|
220
|
+
fallbackWhenLocaleNotMatched = false
|
|
221
|
+
}) {
|
|
222
|
+
var _a;
|
|
223
|
+
if (!node.compositionData) {
|
|
224
|
+
return void 0;
|
|
225
|
+
}
|
|
226
|
+
if (!targetLocale) {
|
|
227
|
+
return node.compositionData;
|
|
228
|
+
}
|
|
229
|
+
const activeEdition = getActiveEdition({
|
|
230
|
+
editions: (_a = node.compositionData.editions) != null ? _a : [],
|
|
231
|
+
selectId: (edition) => {
|
|
232
|
+
var _a2;
|
|
233
|
+
return (_a2 = edition.editionId) != null ? _a2 : "";
|
|
234
|
+
},
|
|
235
|
+
selectEnabledLocales: (edition) => edition.locales,
|
|
236
|
+
selectEdition: (edition) => edition,
|
|
237
|
+
targetLocale
|
|
238
|
+
});
|
|
239
|
+
if (!node.compositionData.editions && node.compositionData.locales.includes(targetLocale)) {
|
|
240
|
+
return node.compositionData;
|
|
241
|
+
}
|
|
242
|
+
if (fallbackWhenLocaleNotMatched && !activeEdition) {
|
|
243
|
+
return node.compositionData;
|
|
244
|
+
}
|
|
245
|
+
return activeEdition;
|
|
246
|
+
}
|
|
247
|
+
|
|
183
248
|
// src/util/getNodeLocalePath.ts
|
|
184
249
|
function getNodeLocalePath(node, locale) {
|
|
185
250
|
var _a, _b;
|
|
@@ -343,6 +408,8 @@ export {
|
|
|
343
408
|
Route,
|
|
344
409
|
UncachedProjectMapClient,
|
|
345
410
|
__INTERNAL_MISSING_PARENT_NODE_ERROR,
|
|
411
|
+
getActiveEdition,
|
|
412
|
+
getNodeActiveCompositionEdition,
|
|
346
413
|
getNodeLocalePath,
|
|
347
414
|
getRouteAlternateLocalesUrls
|
|
348
415
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/project-map",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.187.0",
|
|
4
4
|
"description": "Uniform Project Map",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dev": "run-s update-openapi dev:ts",
|
|
24
24
|
"dev:ts": "tsup --watch",
|
|
25
25
|
"clean": "rimraf dist",
|
|
26
|
-
"test": "jest --
|
|
26
|
+
"test": "jest --passWithNoTests",
|
|
27
27
|
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
|
|
28
28
|
"format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
|
|
29
29
|
"update-openapi": "tsx ./scripts/update-openapi.cts",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"/dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@uniformdev/canvas": "19.
|
|
37
|
-
"@uniformdev/context": "19.
|
|
36
|
+
"@uniformdev/canvas": "19.187.0",
|
|
37
|
+
"@uniformdev/context": "19.187.0"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "9ccfdb652e2d67d66fe90e2df1845c3c2e3bee8b"
|
|
43
43
|
}
|