payload 3.80.0-internal.cdd7ef7 → 3.80.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/admin/elements/Nav.d.ts +0 -13
- package/dist/admin/elements/Nav.d.ts.map +1 -1
- package/dist/admin/elements/Nav.js.map +1 -1
- package/dist/admin/functions/index.d.ts +38 -1
- package/dist/admin/functions/index.d.ts.map +1 -1
- package/dist/admin/functions/index.js.map +1 -1
- package/dist/admin/types.d.ts +4 -5
- package/dist/admin/types.d.ts.map +1 -1
- package/dist/admin/types.js.map +1 -1
- package/dist/admin/views/folderList.d.ts +56 -0
- package/dist/admin/views/folderList.d.ts.map +1 -0
- package/dist/admin/views/folderList.js +3 -0
- package/dist/admin/views/folderList.js.map +1 -0
- package/dist/admin/views/index.d.ts +3 -1
- package/dist/admin/views/index.d.ts.map +1 -1
- package/dist/admin/views/index.js.map +1 -1
- package/dist/admin/views/list.d.ts +2 -43
- package/dist/admin/views/list.d.ts.map +1 -1
- package/dist/admin/views/list.js.map +1 -1
- package/dist/bin/generateImportMap/iterateCollections.d.ts.map +1 -1
- package/dist/bin/generateImportMap/iterateCollections.js +0 -1
- package/dist/bin/generateImportMap/iterateCollections.js.map +1 -1
- package/dist/bin/generateImportMap/iterateConfig.d.ts.map +1 -1
- package/dist/bin/generateImportMap/iterateConfig.js +0 -7
- package/dist/bin/generateImportMap/iterateConfig.js.map +1 -1
- package/dist/collections/config/client.d.ts +1 -3
- package/dist/collections/config/client.d.ts.map +1 -1
- package/dist/collections/config/client.js +0 -11
- package/dist/collections/config/client.js.map +1 -1
- package/dist/collections/config/defaults.js +1 -1
- package/dist/collections/config/defaults.js.map +1 -1
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js +7 -3
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/types.d.ts +7 -29
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/collections/operations/create.js +17 -17
- package/dist/collections/operations/create.js.map +1 -1
- package/dist/collections/operations/findByID.js +3 -3
- package/dist/collections/operations/findByID.js.map +1 -1
- package/dist/collections/operations/update.js +1 -1
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/operations/utilities/update.d.ts.map +1 -1
- package/dist/collections/operations/utilities/update.js +6 -6
- package/dist/collections/operations/utilities/update.js.map +1 -1
- package/dist/config/client.d.ts.map +1 -1
- package/dist/config/client.js +10 -0
- package/dist/config/client.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +15 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/config/sanitize.js +26 -3
- package/dist/config/sanitize.js.map +1 -1
- package/dist/config/types.d.ts +12 -26
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/exports/shared.d.ts +3 -2
- package/dist/exports/shared.d.ts.map +1 -1
- package/dist/exports/shared.js +2 -1
- package/dist/exports/shared.js.map +1 -1
- package/dist/fields/baseFields/slug/index.d.ts +7 -0
- package/dist/fields/baseFields/slug/index.d.ts.map +1 -1
- package/dist/fields/baseFields/slug/index.js +2 -2
- package/dist/fields/baseFields/slug/index.js.map +1 -1
- package/dist/fields/config/sanitize.d.ts.map +1 -1
- package/dist/fields/config/sanitize.js +0 -4
- package/dist/fields/config/sanitize.js.map +1 -1
- package/dist/fields/config/sanitizeJoinField.d.ts.map +1 -1
- package/dist/fields/config/sanitizeJoinField.js +0 -3
- package/dist/fields/config/sanitizeJoinField.js.map +1 -1
- package/dist/folders/addFolderCollection.d.ts +10 -0
- package/dist/folders/addFolderCollection.d.ts.map +1 -0
- package/dist/folders/addFolderCollection.js +26 -0
- package/dist/folders/addFolderCollection.js.map +1 -0
- package/dist/folders/addFolderFieldToCollection.d.ts +8 -0
- package/dist/folders/addFolderFieldToCollection.d.ts.map +1 -0
- package/dist/folders/addFolderFieldToCollection.js +20 -0
- package/dist/folders/addFolderFieldToCollection.js.map +1 -0
- package/dist/folders/buildFolderField.d.ts +8 -0
- package/dist/folders/buildFolderField.d.ts.map +1 -0
- package/dist/folders/buildFolderField.js +87 -0
- package/dist/folders/buildFolderField.js.map +1 -0
- package/dist/folders/constants.d.ts +3 -0
- package/dist/folders/constants.d.ts.map +1 -0
- package/dist/folders/constants.js +4 -0
- package/dist/folders/constants.js.map +1 -0
- package/dist/folders/createFolderCollection.d.ts +11 -0
- package/dist/folders/createFolderCollection.d.ts.map +1 -0
- package/dist/folders/createFolderCollection.js +115 -0
- package/dist/folders/createFolderCollection.js.map +1 -0
- package/dist/folders/hooks/deleteSubfoldersAfterDelete.d.ts +8 -0
- package/dist/folders/hooks/deleteSubfoldersAfterDelete.d.ts.map +1 -0
- package/dist/folders/hooks/deleteSubfoldersAfterDelete.js +15 -0
- package/dist/folders/hooks/deleteSubfoldersAfterDelete.js.map +1 -0
- package/dist/folders/hooks/dissasociateAfterDelete.d.ts +8 -0
- package/dist/folders/hooks/dissasociateAfterDelete.d.ts.map +1 -0
- package/dist/folders/hooks/dissasociateAfterDelete.js +20 -0
- package/dist/folders/hooks/dissasociateAfterDelete.js.map +1 -0
- package/dist/folders/hooks/ensureSafeCollectionsChange.d.ts +5 -0
- package/dist/folders/hooks/ensureSafeCollectionsChange.d.ts.map +1 -0
- package/dist/folders/hooks/ensureSafeCollectionsChange.js +107 -0
- package/dist/folders/hooks/ensureSafeCollectionsChange.js.map +1 -0
- package/dist/folders/hooks/reparentChildFolder.d.ts +24 -0
- package/dist/folders/hooks/reparentChildFolder.d.ts.map +1 -0
- package/dist/folders/hooks/reparentChildFolder.js +72 -0
- package/dist/folders/hooks/reparentChildFolder.js.map +1 -0
- package/dist/folders/types.d.ts +118 -0
- package/dist/folders/types.d.ts.map +1 -0
- package/dist/folders/types.js +3 -0
- package/dist/folders/types.js.map +1 -0
- package/dist/folders/utils/buildFolderWhereConstraints.d.ts +13 -0
- package/dist/folders/utils/buildFolderWhereConstraints.d.ts.map +1 -0
- package/dist/folders/utils/buildFolderWhereConstraints.js +45 -0
- package/dist/folders/utils/buildFolderWhereConstraints.js.map +1 -0
- package/dist/folders/utils/formatFolderOrDocumentItem.d.ts +12 -0
- package/dist/folders/utils/formatFolderOrDocumentItem.d.ts.map +1 -0
- package/dist/folders/utils/formatFolderOrDocumentItem.js +30 -0
- package/dist/folders/utils/formatFolderOrDocumentItem.js.map +1 -0
- package/dist/folders/utils/getFolderBreadcrumbs.d.ts +14 -0
- package/dist/folders/utils/getFolderBreadcrumbs.d.ts.map +1 -0
- package/dist/folders/utils/getFolderBreadcrumbs.js +45 -0
- package/dist/folders/utils/getFolderBreadcrumbs.js.map +1 -0
- package/dist/folders/utils/getFolderData.d.ts +33 -0
- package/dist/folders/utils/getFolderData.d.ts.map +1 -0
- package/dist/folders/utils/getFolderData.js +88 -0
- package/dist/folders/utils/getFolderData.js.map +1 -0
- package/dist/folders/utils/getFoldersAndDocumentsFromJoin.d.ts +24 -0
- package/dist/folders/utils/getFoldersAndDocumentsFromJoin.d.ts.map +1 -0
- package/dist/folders/utils/getFoldersAndDocumentsFromJoin.js +66 -0
- package/dist/folders/utils/getFoldersAndDocumentsFromJoin.js.map +1 -0
- package/dist/folders/utils/getOrphanedDocs.d.ts +15 -0
- package/dist/folders/utils/getOrphanedDocs.d.ts.map +1 -0
- package/dist/folders/utils/getOrphanedDocs.js +40 -0
- package/dist/folders/utils/getOrphanedDocs.js.map +1 -0
- package/dist/globals/config/types.d.ts +0 -4
- package/dist/globals/config/types.d.ts.map +1 -1
- package/dist/globals/config/types.js.map +1 -1
- package/dist/globals/operations/update.d.ts.map +1 -1
- package/dist/globals/operations/update.js +2 -1
- package/dist/globals/operations/update.js.map +1 -1
- package/dist/index.bundled.d.ts +288 -577
- package/dist/index.d.ts +9 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -13
- package/dist/index.js.map +1 -1
- package/dist/preferences/keys.d.ts +4 -8
- package/dist/preferences/keys.d.ts.map +1 -1
- package/dist/preferences/keys.js +4 -7
- package/dist/preferences/keys.js.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.js +7 -1
- package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
- package/dist/utilities/extractID.js +1 -1
- package/dist/utilities/extractID.js.map +1 -1
- package/dist/utilities/formatAdminURL.d.ts +2 -13
- package/dist/utilities/formatAdminURL.d.ts.map +1 -1
- package/dist/utilities/formatAdminURL.js.map +1 -1
- package/dist/versions/saveVersion.d.ts +1 -0
- package/dist/versions/saveVersion.d.ts.map +1 -1
- package/dist/versions/saveVersion.js +16 -66
- package/dist/versions/saveVersion.js.map +1 -1
- package/dist/versions/updateLatestVersion.d.ts +24 -0
- package/dist/versions/updateLatestVersion.d.ts.map +1 -0
- package/dist/versions/updateLatestVersion.js +64 -0
- package/dist/versions/updateLatestVersion.js.map +1 -0
- package/package.json +4 -4
- package/dist/admin/views/hierarchyList.d.ts +0 -9
- package/dist/admin/views/hierarchyList.d.ts.map +0 -1
- package/dist/admin/views/hierarchyList.js +0 -3
- package/dist/admin/views/hierarchyList.js.map +0 -1
- package/dist/hierarchy/addHierarchyToCollection.d.ts +0 -8
- package/dist/hierarchy/addHierarchyToCollection.d.ts.map +0 -1
- package/dist/hierarchy/addHierarchyToCollection.js +0 -62
- package/dist/hierarchy/addHierarchyToCollection.js.map +0 -1
- package/dist/hierarchy/buildParentField.d.ts +0 -11
- package/dist/hierarchy/buildParentField.d.ts.map +0 -1
- package/dist/hierarchy/buildParentField.js +0 -42
- package/dist/hierarchy/buildParentField.js.map +0 -1
- package/dist/hierarchy/constants.d.ts +0 -15
- package/dist/hierarchy/constants.d.ts.map +0 -1
- package/dist/hierarchy/constants.js +0 -11
- package/dist/hierarchy/constants.js.map +0 -1
- package/dist/hierarchy/createFolderField.d.ts +0 -39
- package/dist/hierarchy/createFolderField.d.ts.map +0 -1
- package/dist/hierarchy/createFolderField.js +0 -54
- package/dist/hierarchy/createFolderField.js.map +0 -1
- package/dist/hierarchy/createFoldersCollection.d.ts +0 -57
- package/dist/hierarchy/createFoldersCollection.d.ts.map +0 -1
- package/dist/hierarchy/createFoldersCollection.js +0 -63
- package/dist/hierarchy/createFoldersCollection.js.map +0 -1
- package/dist/hierarchy/createTagField.d.ts +0 -44
- package/dist/hierarchy/createTagField.d.ts.map +0 -1
- package/dist/hierarchy/createTagField.js +0 -48
- package/dist/hierarchy/createTagField.js.map +0 -1
- package/dist/hierarchy/createTagsCollection.d.ts +0 -54
- package/dist/hierarchy/createTagsCollection.d.ts.map +0 -1
- package/dist/hierarchy/createTagsCollection.js +0 -56
- package/dist/hierarchy/createTagsCollection.js.map +0 -1
- package/dist/hierarchy/getInitialTreeData.d.ts +0 -27
- package/dist/hierarchy/getInitialTreeData.d.ts.map +0 -1
- package/dist/hierarchy/getInitialTreeData.js +0 -125
- package/dist/hierarchy/getInitialTreeData.js.map +0 -1
- package/dist/hierarchy/hooks/collectionAfterDelete.d.ts +0 -14
- package/dist/hierarchy/hooks/collectionAfterDelete.d.ts.map +0 -1
- package/dist/hierarchy/hooks/collectionAfterDelete.js +0 -21
- package/dist/hierarchy/hooks/collectionAfterDelete.js.map +0 -1
- package/dist/hierarchy/hooks/collectionAfterRead.d.ts +0 -27
- package/dist/hierarchy/hooks/collectionAfterRead.d.ts.map +0 -1
- package/dist/hierarchy/hooks/collectionAfterRead.js +0 -64
- package/dist/hierarchy/hooks/collectionAfterRead.js.map +0 -1
- package/dist/hierarchy/hooks/collectionBeforeChange.d.ts +0 -19
- package/dist/hierarchy/hooks/collectionBeforeChange.d.ts.map +0 -1
- package/dist/hierarchy/hooks/collectionBeforeChange.js +0 -90
- package/dist/hierarchy/hooks/collectionBeforeChange.js.map +0 -1
- package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts +0 -15
- package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts.map +0 -1
- package/dist/hierarchy/hooks/collectionBeforeDelete.js +0 -20
- package/dist/hierarchy/hooks/collectionBeforeDelete.js.map +0 -1
- package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts +0 -8
- package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts.map +0 -1
- package/dist/hierarchy/hooks/ensureSafeCollectionsChange.js +0 -108
- package/dist/hierarchy/hooks/ensureSafeCollectionsChange.js.map +0 -1
- package/dist/hierarchy/injectHierarchyButton.d.ts +0 -14
- package/dist/hierarchy/injectHierarchyButton.d.ts.map +0 -1
- package/dist/hierarchy/injectHierarchyButton.js +0 -37
- package/dist/hierarchy/injectHierarchyButton.js.map +0 -1
- package/dist/hierarchy/resolveHierarchyCollections.d.ts +0 -23
- package/dist/hierarchy/resolveHierarchyCollections.d.ts.map +0 -1
- package/dist/hierarchy/resolveHierarchyCollections.js +0 -312
- package/dist/hierarchy/resolveHierarchyCollections.js.map +0 -1
- package/dist/hierarchy/sanitizeHierarchyCollection.d.ts +0 -14
- package/dist/hierarchy/sanitizeHierarchyCollection.d.ts.map +0 -1
- package/dist/hierarchy/sanitizeHierarchyCollection.js +0 -112
- package/dist/hierarchy/sanitizeHierarchyCollection.js.map +0 -1
- package/dist/hierarchy/types.d.ts +0 -137
- package/dist/hierarchy/types.d.ts.map +0 -1
- package/dist/hierarchy/types.js +0 -6
- package/dist/hierarchy/types.js.map +0 -1
- package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.d.ts +0 -71
- package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.d.ts.map +0 -1
- package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.js +0 -65
- package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.js.map +0 -1
- package/dist/hierarchy/utils/computePaths.d.ts +0 -31
- package/dist/hierarchy/utils/computePaths.d.ts.map +0 -1
- package/dist/hierarchy/utils/computePaths.js +0 -371
- package/dist/hierarchy/utils/computePaths.js.map +0 -1
- package/dist/hierarchy/utils/findUseAsTitle.d.ts +0 -6
- package/dist/hierarchy/utils/findUseAsTitle.d.ts.map +0 -1
- package/dist/hierarchy/utils/findUseAsTitle.js +0 -72
- package/dist/hierarchy/utils/findUseAsTitle.js.map +0 -1
- package/dist/hierarchy/utils/getAncestors.d.ts +0 -34
- package/dist/hierarchy/utils/getAncestors.d.ts.map +0 -1
- package/dist/hierarchy/utils/getAncestors.js +0 -94
- package/dist/hierarchy/utils/getAncestors.js.map +0 -1
- package/dist/hierarchy/utils/getLocalizedValue.d.ts +0 -30
- package/dist/hierarchy/utils/getLocalizedValue.d.ts.map +0 -1
- package/dist/hierarchy/utils/getLocalizedValue.js +0 -46
- package/dist/hierarchy/utils/getLocalizedValue.js.map +0 -1
- package/dist/hierarchy/utils/getLocalizedValue.spec.js +0 -250
- package/dist/hierarchy/utils/getLocalizedValue.spec.js.map +0 -1
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import type { PayloadComponent } from '../config/types.js';
|
|
2
|
-
import type { JoinField } from '../fields/config/types.js';
|
|
3
|
-
/**
|
|
4
|
-
* User-configurable options for the hierarchy join field.
|
|
5
|
-
* Excludes properties that are auto-generated: type, collection, on, hasMany
|
|
6
|
-
*/
|
|
7
|
-
export type HierarchyJoinFieldConfig = {
|
|
8
|
-
name: string;
|
|
9
|
-
} & Omit<Partial<JoinField>, 'collection' | 'hasMany' | 'name' | 'on' | 'type'>;
|
|
10
|
-
/**
|
|
11
|
-
* Configuration options for hierarchy feature
|
|
12
|
-
*
|
|
13
|
-
* Hierarchies are always self-referential - documents can only nest under other documents
|
|
14
|
-
* from the same collection.
|
|
15
|
-
*/
|
|
16
|
-
export type HierarchyConfig = {
|
|
17
|
-
/**
|
|
18
|
-
* UI configuration for hierarchy
|
|
19
|
-
*/
|
|
20
|
-
admin?: {
|
|
21
|
-
/**
|
|
22
|
-
* Custom components for hierarchy UI
|
|
23
|
-
*/
|
|
24
|
-
components?: {
|
|
25
|
-
/**
|
|
26
|
-
* Custom icon component for hierarchy items
|
|
27
|
-
*/
|
|
28
|
-
Icon?: PayloadComponent;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Maximum number of items to load in tree views
|
|
32
|
-
* @default 100
|
|
33
|
-
*/
|
|
34
|
-
treeLimit?: number;
|
|
35
|
-
/**
|
|
36
|
-
* Whether to use a header button for parent selection instead of inline field.
|
|
37
|
-
* When true, the parent field is hidden and a button is injected into the document header.
|
|
38
|
-
* @default true
|
|
39
|
-
*/
|
|
40
|
-
useHeaderButton?: boolean;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Whether related documents can have multiple values of this hierarchy
|
|
44
|
-
* Set to false for folder-like behavior (single parent), true for tag-like behavior (multiple)
|
|
45
|
-
* @default true
|
|
46
|
-
*/
|
|
47
|
-
allowHasMany?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Whether this hierarchy is scoped to specific collections
|
|
50
|
-
* When true or an object, hierarchy items can be restricted to certain collections
|
|
51
|
-
* @default false
|
|
52
|
-
*/
|
|
53
|
-
collectionSpecific?: {
|
|
54
|
-
/**
|
|
55
|
-
* Name of the select field for specifying allowed collections
|
|
56
|
-
* @default 'hierarchyType'
|
|
57
|
-
*/
|
|
58
|
-
fieldName?: string;
|
|
59
|
-
} | boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Configure a join field to query all children (nested hierarchy items and related documents)
|
|
62
|
-
* If not set, no join field is created.
|
|
63
|
-
* You can pass additional JoinField options (admin, defaultLimit, defaultSort, etc.)
|
|
64
|
-
* that will be merged with the auto-generated config.
|
|
65
|
-
*/
|
|
66
|
-
joinField?: HierarchyJoinFieldConfig;
|
|
67
|
-
/**
|
|
68
|
-
* Name of the field that references the parent document
|
|
69
|
-
* Will automatically create this field if it does not exist
|
|
70
|
-
* @default '_h_${collectionSlug}' (e.g., '_h_folders' for a collection with slug 'folders')
|
|
71
|
-
*/
|
|
72
|
-
parentFieldName: string;
|
|
73
|
-
/**
|
|
74
|
-
* Custom function to slugify text for path generation
|
|
75
|
-
* Used by computeSlugPath() utility for generating slug-based breadcrumb paths
|
|
76
|
-
* Defaults to internal slugify implementation
|
|
77
|
-
*/
|
|
78
|
-
slugify?: (text: string) => string;
|
|
79
|
-
/**
|
|
80
|
-
* Name of the virtual field that will contain the slug-based breadcrumb path
|
|
81
|
-
* @default HIERARCHY_SLUG_PATH_FIELD ('_h_slugPath')
|
|
82
|
-
*/
|
|
83
|
-
slugPathFieldName?: string;
|
|
84
|
-
/**
|
|
85
|
-
* Name of the virtual field that will contain the title-based breadcrumb path
|
|
86
|
-
* @default HIERARCHY_TITLE_PATH_FIELD ('_h_titlePath')
|
|
87
|
-
*/
|
|
88
|
-
titlePathFieldName?: string;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Sanitized hierarchy configuration with all defaults applied
|
|
92
|
-
*/
|
|
93
|
-
export type SanitizedHierarchyConfig = {
|
|
94
|
-
admin: {
|
|
95
|
-
components: {
|
|
96
|
-
Icon: PayloadComponent;
|
|
97
|
-
};
|
|
98
|
-
treeLimit: number;
|
|
99
|
-
useHeaderButton: boolean;
|
|
100
|
-
};
|
|
101
|
-
allowHasMany: boolean;
|
|
102
|
-
collectionSpecific: {
|
|
103
|
-
fieldName: string;
|
|
104
|
-
} | false;
|
|
105
|
-
/**
|
|
106
|
-
* Join field configuration, or undefined if not enabled
|
|
107
|
-
*/
|
|
108
|
-
joinField?: HierarchyJoinFieldConfig;
|
|
109
|
-
parentFieldName: string;
|
|
110
|
-
/**
|
|
111
|
-
* Auto-populated during validation - maps collection slug to field info
|
|
112
|
-
*/
|
|
113
|
-
relatedCollections: Record<string, SanitizedHierarchyRelatedCollection>;
|
|
114
|
-
slugify: (text: string) => string;
|
|
115
|
-
slugPathFieldName: string;
|
|
116
|
-
titlePathFieldName: string;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Information about how a collection relates to this hierarchy
|
|
120
|
-
*/
|
|
121
|
-
export type SanitizedHierarchyRelatedCollection = {
|
|
122
|
-
fieldName: string;
|
|
123
|
-
hasMany: boolean;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Client-safe hierarchy configuration (excludes functions that can't cross server-client boundary)
|
|
127
|
-
*/
|
|
128
|
-
export type ClientHierarchyConfig = Omit<SanitizedHierarchyConfig, 'slugify'>;
|
|
129
|
-
/**
|
|
130
|
-
* Breadcrumb item for folder hierarchies
|
|
131
|
-
* @deprecated Use hierarchy breadcrumbs instead
|
|
132
|
-
*/
|
|
133
|
-
export type FolderBreadcrumb = {
|
|
134
|
-
id: number | string;
|
|
135
|
-
name: string;
|
|
136
|
-
};
|
|
137
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hierarchy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAE1D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,CAAA;AAE/E;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE;QACN;;WAEG;QACH,UAAU,CAAC,EAAE;YACX;;eAEG;YACH,IAAI,CAAC,EAAE,gBAAgB,CAAA;SACxB,CAAA;QACD;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB;;;;WAIG;QACH,eAAe,CAAC,EAAE,OAAO,CAAA;KAC1B,CAAA;IACD;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;;OAIG;IACH,kBAAkB,CAAC,EACf;QACE;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,GACD,OAAO,CAAA;IACX;;;;;OAKG;IACH,SAAS,CAAC,EAAE,wBAAwB,CAAA;IACpC;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IAClC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE;QACL,UAAU,EAAE;YACV,IAAI,EAAE,gBAAgB,CAAA;SACvB,CAAA;QACD,SAAS,EAAE,MAAM,CAAA;QACjB,eAAe,EAAE,OAAO,CAAA;KACzB,CAAA;IACD,YAAY,EAAE,OAAO,CAAA;IACrB,kBAAkB,EACd;QACE,SAAS,EAAE,MAAM,CAAA;KAClB,GACD,KAAK,CAAA;IACT;;OAEG;IACH,SAAS,CAAC,EAAE,wBAAwB,CAAA;IACpC,eAAe,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,mCAAmC,CAAC,CAAA;IACvE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACjC,iBAAiB,EAAE,MAAM,CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAA;AAE7E;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA"}
|
package/dist/hierarchy/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hierarchy/types.ts"],"sourcesContent":["import type { PayloadComponent } from '../config/types.js'\nimport type { JoinField } from '../fields/config/types.js'\n\n/**\n * User-configurable options for the hierarchy join field.\n * Excludes properties that are auto-generated: type, collection, on, hasMany\n */\nexport type HierarchyJoinFieldConfig = {\n name: string\n} & Omit<Partial<JoinField>, 'collection' | 'hasMany' | 'name' | 'on' | 'type'>\n\n/**\n * Configuration options for hierarchy feature\n *\n * Hierarchies are always self-referential - documents can only nest under other documents\n * from the same collection.\n */\nexport type HierarchyConfig = {\n /**\n * UI configuration for hierarchy\n */\n admin?: {\n /**\n * Custom components for hierarchy UI\n */\n components?: {\n /**\n * Custom icon component for hierarchy items\n */\n Icon?: PayloadComponent\n }\n /**\n * Maximum number of items to load in tree views\n * @default 100\n */\n treeLimit?: number\n /**\n * Whether to use a header button for parent selection instead of inline field.\n * When true, the parent field is hidden and a button is injected into the document header.\n * @default true\n */\n useHeaderButton?: boolean\n }\n /**\n * Whether related documents can have multiple values of this hierarchy\n * Set to false for folder-like behavior (single parent), true for tag-like behavior (multiple)\n * @default true\n */\n allowHasMany?: boolean\n /**\n * Whether this hierarchy is scoped to specific collections\n * When true or an object, hierarchy items can be restricted to certain collections\n * @default false\n */\n collectionSpecific?:\n | {\n /**\n * Name of the select field for specifying allowed collections\n * @default 'hierarchyType'\n */\n fieldName?: string\n }\n | boolean\n /**\n * Configure a join field to query all children (nested hierarchy items and related documents)\n * If not set, no join field is created.\n * You can pass additional JoinField options (admin, defaultLimit, defaultSort, etc.)\n * that will be merged with the auto-generated config.\n */\n joinField?: HierarchyJoinFieldConfig\n /**\n * Name of the field that references the parent document\n * Will automatically create this field if it does not exist\n * @default '_h_${collectionSlug}' (e.g., '_h_folders' for a collection with slug 'folders')\n */\n parentFieldName: string\n /**\n * Custom function to slugify text for path generation\n * Used by computeSlugPath() utility for generating slug-based breadcrumb paths\n * Defaults to internal slugify implementation\n */\n slugify?: (text: string) => string\n /**\n * Name of the virtual field that will contain the slug-based breadcrumb path\n * @default HIERARCHY_SLUG_PATH_FIELD ('_h_slugPath')\n */\n slugPathFieldName?: string\n /**\n * Name of the virtual field that will contain the title-based breadcrumb path\n * @default HIERARCHY_TITLE_PATH_FIELD ('_h_titlePath')\n */\n titlePathFieldName?: string\n}\n\n/**\n * Sanitized hierarchy configuration with all defaults applied\n */\nexport type SanitizedHierarchyConfig = {\n admin: {\n components: {\n Icon: PayloadComponent\n }\n treeLimit: number\n useHeaderButton: boolean\n }\n allowHasMany: boolean\n collectionSpecific:\n | {\n fieldName: string\n }\n | false\n /**\n * Join field configuration, or undefined if not enabled\n */\n joinField?: HierarchyJoinFieldConfig\n parentFieldName: string\n /**\n * Auto-populated during validation - maps collection slug to field info\n */\n relatedCollections: Record<string, SanitizedHierarchyRelatedCollection>\n slugify: (text: string) => string\n slugPathFieldName: string\n titlePathFieldName: string\n}\n\n/**\n * Information about how a collection relates to this hierarchy\n */\nexport type SanitizedHierarchyRelatedCollection = {\n fieldName: string\n hasMany: boolean\n}\n\n/**\n * Client-safe hierarchy configuration (excludes functions that can't cross server-client boundary)\n */\nexport type ClientHierarchyConfig = Omit<SanitizedHierarchyConfig, 'slugify'>\n\n/**\n * Breadcrumb item for folder hierarchies\n * @deprecated Use hierarchy breadcrumbs instead\n */\nexport type FolderBreadcrumb = {\n id: number | string\n name: string\n}\n"],"names":[],"mappings":"AA0IA;;;CAGC,GACD,WAGC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { PayloadRequest } from '../../types/index.js';
|
|
2
|
-
type BuildLocalizedPathsArgs = {
|
|
3
|
-
/**
|
|
4
|
-
* Optional parent's slug paths by locale (e.g., { en: "/blog/tech", es: "/blog/tecnologia" })
|
|
5
|
-
* If provided, these paths will be prepended to the generated slug segments
|
|
6
|
-
*/
|
|
7
|
-
parentSlugPath?: Record<string, string>;
|
|
8
|
-
/**
|
|
9
|
-
* Optional parent's title paths by locale (e.g., { en: "Blog / Tech", es: "Blog / Tecnología" })
|
|
10
|
-
* If provided, these paths will be prepended to the generated title segments
|
|
11
|
-
*/
|
|
12
|
-
parentTitlePath?: Record<string, string>;
|
|
13
|
-
/**
|
|
14
|
-
* The Payload request object - used to access locale configuration and fallback settings
|
|
15
|
-
*/
|
|
16
|
-
req: PayloadRequest;
|
|
17
|
-
/**
|
|
18
|
-
* Function to convert title text into URL-safe slug segments
|
|
19
|
-
*/
|
|
20
|
-
slugify: (val: string) => string;
|
|
21
|
-
/**
|
|
22
|
-
* The localized title value object (e.g., { en: "Home", es: "Inicio", de: "Startseite" })
|
|
23
|
-
*/
|
|
24
|
-
titleValue: Record<string, string>;
|
|
25
|
-
};
|
|
26
|
-
type BuildLocalizedPathsResult = {
|
|
27
|
-
slugPath: Record<string, string>;
|
|
28
|
-
titlePath: Record<string, string>;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Builds localized slug and title paths for all configured locales.
|
|
32
|
-
* Applies proper fallback locale handling and optionally prepends parent paths.
|
|
33
|
-
*
|
|
34
|
-
* This utility is used when `locale: 'all'` is requested and the title field is localized,
|
|
35
|
-
* generating a path for each locale with proper fallback handling.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```ts
|
|
39
|
-
* // Without parent (root document)
|
|
40
|
-
* buildLocalizedPaths({
|
|
41
|
-
* req,
|
|
42
|
-
* slugify: (val) => val.toLowerCase().replace(/\s/g, '-'),
|
|
43
|
-
* titleValue: { en: "Home", es: "Inicio", de: "" }
|
|
44
|
-
* })
|
|
45
|
-
* // Returns:
|
|
46
|
-
* // {
|
|
47
|
-
* // slugPath: { en: "home", es: "inicio", de: "home" }, // 'de' falls back to 'en'
|
|
48
|
-
* // titlePath: { en: "Home", es: "Inicio", de: "Home" }
|
|
49
|
-
* // }
|
|
50
|
-
*
|
|
51
|
-
* // With parent paths
|
|
52
|
-
* buildLocalizedPaths({
|
|
53
|
-
* parentSlugPath: { en: "/blog", es: "/blog" },
|
|
54
|
-
* parentTitlePath: { en: "Blog", es: "Blog" },
|
|
55
|
-
* req,
|
|
56
|
-
* slugify: (val) => val.toLowerCase().replace(/\s/g, '-'),
|
|
57
|
-
* titleValue: { en: "Tech News", es: "Noticias Tecnológicas" }
|
|
58
|
-
* })
|
|
59
|
-
* // Returns:
|
|
60
|
-
* // {
|
|
61
|
-
* // slugPath: { en: "/blog/tech-news", es: "/blog/noticias-tecnologicas" },
|
|
62
|
-
* // titlePath: { en: "Blog / Tech News", es: "Blog / Noticias Tecnológicas" }
|
|
63
|
-
* // }
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* @param args - Configuration for building localized paths
|
|
67
|
-
* @returns Object containing slugPath and titlePath, each mapping locale codes to path strings
|
|
68
|
-
*/
|
|
69
|
-
export declare function buildLocalizedHierarchyPaths(args: BuildLocalizedPathsArgs): BuildLocalizedPathsResult;
|
|
70
|
-
export {};
|
|
71
|
-
//# sourceMappingURL=buildLocalizedHierarchyPaths.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildLocalizedHierarchyPaths.d.ts","sourceRoot":"","sources":["../../../src/hierarchy/utils/buildLocalizedHierarchyPaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAI1D,KAAK,uBAAuB,GAAG;IAC7B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC;;OAEG;IACH,GAAG,EAAE,cAAc,CAAA;IACnB;;OAEG;IACH,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;IAChC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACnC,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,uBAAuB,GAC5B,yBAAyB,CAiC3B"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { getLocalizedValue } from './getLocalizedValue.js';
|
|
2
|
-
/**
|
|
3
|
-
* Builds localized slug and title paths for all configured locales.
|
|
4
|
-
* Applies proper fallback locale handling and optionally prepends parent paths.
|
|
5
|
-
*
|
|
6
|
-
* This utility is used when `locale: 'all'` is requested and the title field is localized,
|
|
7
|
-
* generating a path for each locale with proper fallback handling.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* // Without parent (root document)
|
|
12
|
-
* buildLocalizedPaths({
|
|
13
|
-
* req,
|
|
14
|
-
* slugify: (val) => val.toLowerCase().replace(/\s/g, '-'),
|
|
15
|
-
* titleValue: { en: "Home", es: "Inicio", de: "" }
|
|
16
|
-
* })
|
|
17
|
-
* // Returns:
|
|
18
|
-
* // {
|
|
19
|
-
* // slugPath: { en: "home", es: "inicio", de: "home" }, // 'de' falls back to 'en'
|
|
20
|
-
* // titlePath: { en: "Home", es: "Inicio", de: "Home" }
|
|
21
|
-
* // }
|
|
22
|
-
*
|
|
23
|
-
* // With parent paths
|
|
24
|
-
* buildLocalizedPaths({
|
|
25
|
-
* parentSlugPath: { en: "/blog", es: "/blog" },
|
|
26
|
-
* parentTitlePath: { en: "Blog", es: "Blog" },
|
|
27
|
-
* req,
|
|
28
|
-
* slugify: (val) => val.toLowerCase().replace(/\s/g, '-'),
|
|
29
|
-
* titleValue: { en: "Tech News", es: "Noticias Tecnológicas" }
|
|
30
|
-
* })
|
|
31
|
-
* // Returns:
|
|
32
|
-
* // {
|
|
33
|
-
* // slugPath: { en: "/blog/tech-news", es: "/blog/noticias-tecnologicas" },
|
|
34
|
-
* // titlePath: { en: "Blog / Tech News", es: "Blog / Noticias Tecnológicas" }
|
|
35
|
-
* // }
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* @param args - Configuration for building localized paths
|
|
39
|
-
* @returns Object containing slugPath and titlePath, each mapping locale codes to path strings
|
|
40
|
-
*/ export function buildLocalizedHierarchyPaths(args) {
|
|
41
|
-
const { parentSlugPath, parentTitlePath, req, slugify, titleValue } = args;
|
|
42
|
-
const slugPathsByLocale = {};
|
|
43
|
-
const titlePathsByLocale = {};
|
|
44
|
-
const locales = req.payload.config.localization ? req.payload.config.localization.localeCodes : [];
|
|
45
|
-
for (const loc of locales){
|
|
46
|
-
const localizedTitle = getLocalizedValue({
|
|
47
|
-
fallbackLocale: req.fallbackLocale,
|
|
48
|
-
fieldType: 'text',
|
|
49
|
-
locale: loc,
|
|
50
|
-
value: titleValue
|
|
51
|
-
});
|
|
52
|
-
if (localizedTitle) {
|
|
53
|
-
const slugSegment = slugify(localizedTitle);
|
|
54
|
-
const titleSegment = localizedTitle;
|
|
55
|
-
slugPathsByLocale[loc] = parentSlugPath ? `${parentSlugPath[loc]}/${slugSegment}` : slugSegment;
|
|
56
|
-
titlePathsByLocale[loc] = parentTitlePath ? `${parentTitlePath[loc]}/${titleSegment}` : titleSegment;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
slugPath: slugPathsByLocale,
|
|
61
|
-
titlePath: titlePathsByLocale
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
//# sourceMappingURL=buildLocalizedHierarchyPaths.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hierarchy/utils/buildLocalizedHierarchyPaths.ts"],"sourcesContent":["import type { PayloadRequest } from '../../types/index.js'\n\nimport { getLocalizedValue } from './getLocalizedValue.js'\n\ntype BuildLocalizedPathsArgs = {\n /**\n * Optional parent's slug paths by locale (e.g., { en: \"/blog/tech\", es: \"/blog/tecnologia\" })\n * If provided, these paths will be prepended to the generated slug segments\n */\n parentSlugPath?: Record<string, string>\n /**\n * Optional parent's title paths by locale (e.g., { en: \"Blog / Tech\", es: \"Blog / Tecnología\" })\n * If provided, these paths will be prepended to the generated title segments\n */\n parentTitlePath?: Record<string, string>\n /**\n * The Payload request object - used to access locale configuration and fallback settings\n */\n req: PayloadRequest\n /**\n * Function to convert title text into URL-safe slug segments\n */\n slugify: (val: string) => string\n /**\n * The localized title value object (e.g., { en: \"Home\", es: \"Inicio\", de: \"Startseite\" })\n */\n titleValue: Record<string, string>\n}\n\ntype BuildLocalizedPathsResult = {\n slugPath: Record<string, string>\n titlePath: Record<string, string>\n}\n\n/**\n * Builds localized slug and title paths for all configured locales.\n * Applies proper fallback locale handling and optionally prepends parent paths.\n *\n * This utility is used when `locale: 'all'` is requested and the title field is localized,\n * generating a path for each locale with proper fallback handling.\n *\n * @example\n * ```ts\n * // Without parent (root document)\n * buildLocalizedPaths({\n * req,\n * slugify: (val) => val.toLowerCase().replace(/\\s/g, '-'),\n * titleValue: { en: \"Home\", es: \"Inicio\", de: \"\" }\n * })\n * // Returns:\n * // {\n * // slugPath: { en: \"home\", es: \"inicio\", de: \"home\" }, // 'de' falls back to 'en'\n * // titlePath: { en: \"Home\", es: \"Inicio\", de: \"Home\" }\n * // }\n *\n * // With parent paths\n * buildLocalizedPaths({\n * parentSlugPath: { en: \"/blog\", es: \"/blog\" },\n * parentTitlePath: { en: \"Blog\", es: \"Blog\" },\n * req,\n * slugify: (val) => val.toLowerCase().replace(/\\s/g, '-'),\n * titleValue: { en: \"Tech News\", es: \"Noticias Tecnológicas\" }\n * })\n * // Returns:\n * // {\n * // slugPath: { en: \"/blog/tech-news\", es: \"/blog/noticias-tecnologicas\" },\n * // titlePath: { en: \"Blog / Tech News\", es: \"Blog / Noticias Tecnológicas\" }\n * // }\n * ```\n *\n * @param args - Configuration for building localized paths\n * @returns Object containing slugPath and titlePath, each mapping locale codes to path strings\n */\nexport function buildLocalizedHierarchyPaths(\n args: BuildLocalizedPathsArgs,\n): BuildLocalizedPathsResult {\n const { parentSlugPath, parentTitlePath, req, slugify, titleValue } = args\n\n const slugPathsByLocale: Record<string, string> = {}\n const titlePathsByLocale: Record<string, string> = {}\n\n const locales = req.payload.config.localization ? req.payload.config.localization.localeCodes : []\n\n for (const loc of locales) {\n const localizedTitle = getLocalizedValue({\n fallbackLocale: req.fallbackLocale,\n fieldType: 'text',\n locale: loc,\n value: titleValue,\n })\n\n if (localizedTitle) {\n const slugSegment = slugify(localizedTitle)\n const titleSegment = localizedTitle\n\n slugPathsByLocale[loc] = parentSlugPath\n ? `${parentSlugPath[loc]}/${slugSegment}`\n : slugSegment\n titlePathsByLocale[loc] = parentTitlePath\n ? `${parentTitlePath[loc]}/${titleSegment}`\n : titleSegment\n }\n }\n\n return {\n slugPath: slugPathsByLocale,\n titlePath: titlePathsByLocale,\n }\n}\n"],"names":["getLocalizedValue","buildLocalizedHierarchyPaths","args","parentSlugPath","parentTitlePath","req","slugify","titleValue","slugPathsByLocale","titlePathsByLocale","locales","payload","config","localization","localeCodes","loc","localizedTitle","fallbackLocale","fieldType","locale","value","slugSegment","titleSegment","slugPath","titlePath"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,yBAAwB;AAgC1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCC,GACD,OAAO,SAASC,6BACdC,IAA6B;IAE7B,MAAM,EAAEC,cAAc,EAAEC,eAAe,EAAEC,GAAG,EAAEC,OAAO,EAAEC,UAAU,EAAE,GAAGL;IAEtE,MAAMM,oBAA4C,CAAC;IACnD,MAAMC,qBAA6C,CAAC;IAEpD,MAAMC,UAAUL,IAAIM,OAAO,CAACC,MAAM,CAACC,YAAY,GAAGR,IAAIM,OAAO,CAACC,MAAM,CAACC,YAAY,CAACC,WAAW,GAAG,EAAE;IAElG,KAAK,MAAMC,OAAOL,QAAS;QACzB,MAAMM,iBAAiBhB,kBAAkB;YACvCiB,gBAAgBZ,IAAIY,cAAc;YAClCC,WAAW;YACXC,QAAQJ;YACRK,OAAOb;QACT;QAEA,IAAIS,gBAAgB;YAClB,MAAMK,cAAcf,QAAQU;YAC5B,MAAMM,eAAeN;YAErBR,iBAAiB,CAACO,IAAI,GAAGZ,iBACrB,GAAGA,cAAc,CAACY,IAAI,CAAC,CAAC,EAAEM,aAAa,GACvCA;YACJZ,kBAAkB,CAACM,IAAI,GAAGX,kBACtB,GAAGA,eAAe,CAACW,IAAI,CAAC,CAAC,EAAEO,cAAc,GACzCA;QACN;IACF;IAEA,OAAO;QACLC,UAAUf;QACVgB,WAAWf;IACb;AACF"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { SanitizedCollectionConfig } from '../../collections/config/types.js';
|
|
2
|
-
import type { Document, PayloadRequest } from '../../types/index.js';
|
|
3
|
-
type ComputePathsArgs = {
|
|
4
|
-
collection: SanitizedCollectionConfig;
|
|
5
|
-
doc: Document;
|
|
6
|
-
draft?: boolean;
|
|
7
|
-
locale?: string;
|
|
8
|
-
parentFieldName: string;
|
|
9
|
-
req: PayloadRequest;
|
|
10
|
-
slugPathFieldName?: string;
|
|
11
|
-
titlePathFieldName?: string;
|
|
12
|
-
};
|
|
13
|
-
type ComputePathsResult = {
|
|
14
|
-
slugPath: Record<string, string> | string;
|
|
15
|
-
titlePath: Record<string, string> | string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Computes both slug and title breadcrumb paths for a document by walking up the parent chain.
|
|
19
|
-
* More efficient than computing them separately since it only walks the chain once.
|
|
20
|
-
*
|
|
21
|
-
* Note: Ancestor fetches always use `overrideAccess: true` to ensure paths are complete.
|
|
22
|
-
* If a user can read a document, they should see its full breadcrumb path even if they
|
|
23
|
-
* cannot read all ancestor documents. This prevents broken breadcrumbs and provides
|
|
24
|
-
* better UX at the cost of minimal information leakage (ancestor titles in paths).
|
|
25
|
-
*
|
|
26
|
-
* @param args - Configuration for path computation
|
|
27
|
-
* @returns Object with slugPath and titlePath
|
|
28
|
-
*/
|
|
29
|
-
export declare function computePaths(args: ComputePathsArgs): Promise<ComputePathsResult>;
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=computePaths.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"computePaths.d.ts","sourceRoot":"","sources":["../../../src/hierarchy/utils/computePaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAYpE,KAAK,gBAAgB,GAAG;IACtB,UAAU,EAAE,yBAAyB,CAAA;IACrC,GAAG,EAAE,QAAQ,CAAA;IACb,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAA;IACzC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAA;CAC3C,CAAA;AAyCD;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsZtF"}
|