@websolutespa/payload-plugin-bowl 1.7.7 → 1.7.9

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/CHANGELOG.md CHANGED
@@ -1,225 +1,239 @@
1
- # @websolutespa/payload-plugin-bowl
2
-
3
- ## 1.7.7
4
-
5
- ### Patch Changes
6
-
7
- - Added: isomorphic-fetch
8
- - Updating: dependencies
9
- - Updated dependencies
10
- - @websolutespa/bom-core@1.7.3
11
-
12
- ## 1.7.6
13
-
14
- ### Patch Changes
15
-
16
- - Added: beforeDuplicateCollectionHook
17
- - Fixing: decorateNav\_ link href issue
18
-
19
- ## 1.7.5
20
-
21
- ### Patch Changes
22
-
23
- - Modified: Label collection title -> text
24
-
25
- ## 1.7.4
26
-
27
- ### Patch Changes
28
-
29
- - Fixing: findRoute redirects
30
-
31
- ## 1.7.3
32
-
33
- ### Patch Changes
34
-
35
- - Added: WhereService, StaticService, localize decorator
36
- - Modified: withCollection, withStaticCollection, withAction, CollectionService, PageService
37
-
38
- ## 1.7.2
39
-
40
- ### Patch Changes
41
-
42
- - Fixing: setMixerContext
43
-
44
- ## 1.7.1
45
-
46
- ### Patch Changes
47
-
48
- - Fixing: MenuService & CategoryTree
49
-
50
- ## 1.7.0
51
-
52
- ### Minor Changes
53
-
54
- - 28e86bd: Modified: IPage, Store services & decorators
55
- - Updated dependencies [28e86bd]
56
- - @websolutespa/bom-core@1.7.0
57
-
58
- ## 1.6.0
59
-
60
- ### Minor Changes
61
-
62
- - 6707ca2: Upgrading Payload 2.11.2
63
-
64
- ### Patch Changes
65
-
66
- - f664993: Added: useLivePreview
67
- - Updated dependencies [6cbf4cb]
68
- - @websolutespa/bom-core@0.6.7
69
-
70
- ## 1.3.6
71
-
72
- ### Patch Changes
73
-
74
- - Fixing: afterPageReadHook
75
-
76
- ## 1.3.5
77
-
78
- ### Patch Changes
79
-
80
- - Added: afterPageReadHook, MixerContext, getGlobalItems
81
- - Modified: getCollectionItems, getCollectionItem
82
-
83
- ## 1.3.4
84
-
85
- ### Patch Changes
86
-
87
- - Added: user roles and user actions
88
- - Added: main menu sortByGroup
89
-
90
- ## 1.3.3
91
-
92
- ### Patch Changes
93
-
94
- - Fixing: PageService decorators
95
-
96
- ## 1.3.2
97
-
98
- ### Patch Changes
99
-
100
- - 8776e50b: Modified: PageService decorators
101
-
102
- ## 1.3.1
103
-
104
- ### Patch Changes
105
-
106
- - Added: configuration option plugins
107
-
108
- ## 1.3.0
109
-
110
- ### Minor Changes
111
-
112
- - c7a99a2b: Added tests
113
-
114
- ### Patch Changes
115
-
116
- - dad63747: Added defaultMarket, defaultLocale
117
- - 11b63e3b: Fixed test config
118
- - c7a99a2b: Fixed collection bulk patch handler
119
- - Updated dependencies [dad63747]
120
- - @websolutespa/bom-core@0.6.1
121
-
122
- ## 1.2.0
123
-
124
- ### Minor Changes
125
-
126
- - Added: MenuItem extra
127
-
128
- ## 1.1.0
129
-
130
- ### Minor Changes
131
-
132
- - Updating: dependencies
133
-
134
- ## 1.0.6
135
-
136
- ### Patch Changes
137
-
138
- - Fixing: validateHexColor import
139
-
140
- ## 1.0.5
141
-
142
- ### Patch Changes
143
-
144
- - Fixing: check redirects by pattern
145
-
146
- ## 1.0.4
147
-
148
- ### Patch Changes
149
-
150
- - Fixing: storeGet endpoint locale
151
-
152
- ## 1.0.3
153
-
154
- ### Patch Changes
155
-
156
- - Modified: withPage preview, getApiUrl
157
-
158
- ## 1.0.2
159
-
160
- ### Patch Changes
161
-
162
- - Added: duration to withStaticCollection
163
- - Fixing: eachField
164
-
165
- ## 1.0.1
166
-
167
- ### Minor Changes
168
-
169
- - Added: CategoryTree
170
- - Fixing: sass
171
-
172
- ## 0.5.0
173
-
174
- ### Minor Changes
175
-
176
- - Modified routes, added redirects
177
-
178
- ## 0.4.0
179
-
180
- ### Minor Changes
181
-
182
- - Removed: external dependency @websolutespa/payload-plugin-localization
183
-
184
- ## 0.3.2
185
-
186
- ### Patch Changes
187
-
188
- - Fixing: avoid categories circular reference
189
-
190
- ## 0.3.1
191
-
192
- ### Patch Changes
193
-
194
- - Modified: ILocalizable
195
-
196
- ## 0.3.0
197
-
198
- ### Minor Changes
199
-
200
- - Added: splat routes
201
-
202
- ## 0.2.0
203
-
204
- ### Minor Changes
205
-
206
- - Added: menu, @websolutespa/bom-core
207
-
208
- ## 0.1.1
209
-
210
- ### Patch Changes
211
-
212
- - Modified: route service
213
- - Added: white label
214
-
215
- ## 0.1.0
216
-
217
- ### Minor Changes
218
-
219
- - mock refactor
220
-
221
- ## 0.0.1
222
-
223
- ### Patch Changes
224
-
225
- - Added: first release
1
+ # @websolutespa/payload-plugin-bowl
2
+
3
+ ## 1.7.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 37d1729: Modified: endpoint store handling user
8
+ - Updated dependencies
9
+ - @websolutespa/bom-core@1.7.4
10
+
11
+ ## 1.7.8
12
+
13
+ ### Patch Changes
14
+
15
+ - Fixing: withStaticCollection.getCollection fetch
16
+
17
+ ## 1.7.7
18
+
19
+ ### Patch Changes
20
+
21
+ - Added: isomorphic-fetch
22
+ - Updating: dependencies
23
+ - Updated dependencies
24
+ - @websolutespa/bom-core@1.7.3
25
+
26
+ ## 1.7.6
27
+
28
+ ### Patch Changes
29
+
30
+ - Added: beforeDuplicateCollectionHook
31
+ - Fixing: decorateNav\_ link href issue
32
+
33
+ ## 1.7.5
34
+
35
+ ### Patch Changes
36
+
37
+ - Modified: Label collection title -> text
38
+
39
+ ## 1.7.4
40
+
41
+ ### Patch Changes
42
+
43
+ - Fixing: findRoute redirects
44
+
45
+ ## 1.7.3
46
+
47
+ ### Patch Changes
48
+
49
+ - Added: WhereService, StaticService, localize decorator
50
+ - Modified: withCollection, withStaticCollection, withAction, CollectionService, PageService
51
+
52
+ ## 1.7.2
53
+
54
+ ### Patch Changes
55
+
56
+ - Fixing: setMixerContext
57
+
58
+ ## 1.7.1
59
+
60
+ ### Patch Changes
61
+
62
+ - Fixing: MenuService & CategoryTree
63
+
64
+ ## 1.7.0
65
+
66
+ ### Minor Changes
67
+
68
+ - 28e86bd: Modified: IPage, Store services & decorators
69
+ - Updated dependencies [28e86bd]
70
+ - @websolutespa/bom-core@1.7.0
71
+
72
+ ## 1.6.0
73
+
74
+ ### Minor Changes
75
+
76
+ - 6707ca2: Upgrading Payload 2.11.2
77
+
78
+ ### Patch Changes
79
+
80
+ - f664993: Added: useLivePreview
81
+ - Updated dependencies [6cbf4cb]
82
+ - @websolutespa/bom-core@0.6.7
83
+
84
+ ## 1.3.6
85
+
86
+ ### Patch Changes
87
+
88
+ - Fixing: afterPageReadHook
89
+
90
+ ## 1.3.5
91
+
92
+ ### Patch Changes
93
+
94
+ - Added: afterPageReadHook, MixerContext, getGlobalItems
95
+ - Modified: getCollectionItems, getCollectionItem
96
+
97
+ ## 1.3.4
98
+
99
+ ### Patch Changes
100
+
101
+ - Added: user roles and user actions
102
+ - Added: main menu sortByGroup
103
+
104
+ ## 1.3.3
105
+
106
+ ### Patch Changes
107
+
108
+ - Fixing: PageService decorators
109
+
110
+ ## 1.3.2
111
+
112
+ ### Patch Changes
113
+
114
+ - 8776e50b: Modified: PageService decorators
115
+
116
+ ## 1.3.1
117
+
118
+ ### Patch Changes
119
+
120
+ - Added: configuration option plugins
121
+
122
+ ## 1.3.0
123
+
124
+ ### Minor Changes
125
+
126
+ - c7a99a2b: Added tests
127
+
128
+ ### Patch Changes
129
+
130
+ - dad63747: Added defaultMarket, defaultLocale
131
+ - 11b63e3b: Fixed test config
132
+ - c7a99a2b: Fixed collection bulk patch handler
133
+ - Updated dependencies [dad63747]
134
+ - @websolutespa/bom-core@0.6.1
135
+
136
+ ## 1.2.0
137
+
138
+ ### Minor Changes
139
+
140
+ - Added: MenuItem extra
141
+
142
+ ## 1.1.0
143
+
144
+ ### Minor Changes
145
+
146
+ - Updating: dependencies
147
+
148
+ ## 1.0.6
149
+
150
+ ### Patch Changes
151
+
152
+ - Fixing: validateHexColor import
153
+
154
+ ## 1.0.5
155
+
156
+ ### Patch Changes
157
+
158
+ - Fixing: check redirects by pattern
159
+
160
+ ## 1.0.4
161
+
162
+ ### Patch Changes
163
+
164
+ - Fixing: storeGet endpoint locale
165
+
166
+ ## 1.0.3
167
+
168
+ ### Patch Changes
169
+
170
+ - Modified: withPage preview, getApiUrl
171
+
172
+ ## 1.0.2
173
+
174
+ ### Patch Changes
175
+
176
+ - Added: duration to withStaticCollection
177
+ - Fixing: eachField
178
+
179
+ ## 1.0.1
180
+
181
+ ### Minor Changes
182
+
183
+ - Added: CategoryTree
184
+ - Fixing: sass
185
+
186
+ ## 0.5.0
187
+
188
+ ### Minor Changes
189
+
190
+ - Modified routes, added redirects
191
+
192
+ ## 0.4.0
193
+
194
+ ### Minor Changes
195
+
196
+ - Removed: external dependency @websolutespa/payload-plugin-localization
197
+
198
+ ## 0.3.2
199
+
200
+ ### Patch Changes
201
+
202
+ - Fixing: avoid categories circular reference
203
+
204
+ ## 0.3.1
205
+
206
+ ### Patch Changes
207
+
208
+ - Modified: ILocalizable
209
+
210
+ ## 0.3.0
211
+
212
+ ### Minor Changes
213
+
214
+ - Added: splat routes
215
+
216
+ ## 0.2.0
217
+
218
+ ### Minor Changes
219
+
220
+ - Added: menu, @websolutespa/bom-core
221
+
222
+ ## 0.1.1
223
+
224
+ ### Patch Changes
225
+
226
+ - Modified: route service
227
+ - Added: white label
228
+
229
+ ## 0.1.0
230
+
231
+ ### Minor Changes
232
+
233
+ - mock refactor
234
+
235
+ ## 0.0.1
236
+
237
+ ### Patch Changes
238
+
239
+ - Added: first release
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Resource } from 'i18next';
2
2
  import { Endpoint, AdminView, Locale as Locale$1, Config } from 'payload/config';
3
3
  import { Field, FieldBase, Tab, JSONField, Block as Block$1, FieldAffectingData, HookName, FieldHook as FieldHook$1, UIField as UIField$1 } from 'payload/dist/fields/config/types';
4
4
  import * as payload_types from 'payload/types';
5
- import { PayloadRequest, CollectionAfterChangeHook, CollectionAfterDeleteHook, TypeWithID, CollectionConfig, BeforeDuplicate, Block, GlobalConfig, RichTextField, RelationshipField, CheckboxField, BlockField, DateField, TextField, GroupField, Field as Field$1, UploadField, ArrayField, NumberField, FieldHook, SelectField, CollapsibleField, RowField, TabsField, UIField, EmailField, TextareaField, RadioField, CodeField, PointField, SanitizedCollectionConfig } from 'payload/types';
5
+ import { PayloadRequest, CollectionAfterChangeHook, CollectionAfterDeleteHook, TypeWithID, CollectionConfig, BeforeDuplicate, Where, Block, GlobalConfig, RichTextField, RelationshipField, CheckboxField, BlockField, DateField, TextField, GroupField, Field as Field$1, UploadField, ArrayField, NumberField, FieldHook, SelectField, CollapsibleField, RowField, TabsField, UIField, EmailField, TextareaField, RadioField, CodeField, PointField, SanitizedCollectionConfig } from 'payload/types';
6
6
  import { IEntity, ILocale, ICategorized, IRoute, ICategory, IMarket, IMemoryStore, ILocalizable, IEquatable, IMedia, IPageRelation, ISchema, IMenuItem, IMenu } from '@websolutespa/bom-core';
7
7
  import * as payload_dist_admin_components_forms_FieldDescription_types from 'payload/dist/admin/components/forms/FieldDescription/types';
8
8
  import * as React from 'react';
@@ -14,6 +14,7 @@ import { Props as Props$4 } from 'payload/dist/admin/components/views/collection
14
14
  import { User } from 'payload/dist/auth';
15
15
  import { PaginatedDocs } from 'payload/database';
16
16
  import { Response, NextFunction } from 'express';
17
+ import { RequestContext } from 'payload';
17
18
  import { ContextType } from 'payload/dist/admin/components/utilities/DocumentInfo/types';
18
19
  import { Props as Props$2 } from 'payload/components/views/Cell';
19
20
  import { Props as Props$3 } from 'payload/components/fields/Text';
@@ -198,6 +199,25 @@ declare function populateStaticFields<T = IEntity>(item: T, fields: Field[], loc
198
199
  declare function getStaticLoader(slug: string): () => Promise<Option[]>;
199
200
 
200
201
  declare function getStore(req: PayloadRequest): Promise<IMemoryStore>;
202
+ type FindOptions = {
203
+ context?: RequestContext;
204
+ currentDepth?: number;
205
+ depth?: number;
206
+ disableErrors?: boolean;
207
+ draft?: boolean;
208
+ fallbackLocale?: string;
209
+ limit?: number;
210
+ locale?: string;
211
+ overrideAccess?: boolean;
212
+ page?: number;
213
+ pagination?: boolean;
214
+ req?: PayloadRequest;
215
+ showHiddenFields?: boolean;
216
+ sort?: string;
217
+ user?: any;
218
+ where?: Where;
219
+ };
220
+ declare function findCollection<T>(req: PayloadRequest, collection: string, options?: Omit<FindOptions, 'req'>): Promise<PaginatedDocs<T>>;
201
221
  declare function getApiUrl(req: PayloadRequest): string;
202
222
  declare function getSearchUrl(req: PayloadRequest, overrideQuery?: {}): string;
203
223
  declare function fetchEndpoint<T>(req: PayloadRequest, endpoint: string, query?: {}): Promise<T>;
@@ -662,7 +682,7 @@ declare const richTextAfterReadHook: FieldBase['hooks']['afterRead'][number];
662
682
  declare const RichTextDefaults: RichTextField;
663
683
  declare const withRichText: (options?: Partial<RichTextField>) => RichTextField;
664
684
  declare const withRichTextRequired: (options?: Partial<RichTextField>) => RichTextField;
665
- declare function richTextSerialize(children?: any[]): string;
685
+ declare function richTextSerialize(children?: any[], includeHtmlTags?: boolean): string;
666
686
 
667
687
  type WithRolesProps = (Omit<SelectField, 'type' | 'name' | 'options'> & {
668
688
  name?: string;
@@ -972,6 +992,8 @@ declare const roles: {
972
992
  type Values<T> = T[keyof T];
973
993
  type BowlRole = Values<typeof roles> | string;
974
994
  type BowlOptions = {
995
+ bowlCollections: BowlCollection[];
996
+ bowlGlobals: BowlGlobal[];
975
997
  collections: string[];
976
998
  defaultLocale: string;
977
999
  defaultMarket: string;
@@ -981,13 +1003,13 @@ type BowlOptions = {
981
1003
  blocks: BowlBlock[];
982
1004
  };
983
1005
  pages: string[];
984
- slug: BowlSlug;
985
- translations: Resource;
986
1006
  plugins: BowlPlugin[];
987
1007
  roles: typeof roles & Record<string, string>;
988
- rolesUser: BowlRole[];
989
1008
  rolesEndUser: BowlRole[];
990
1009
  rolesList: BowlRole[];
1010
+ rolesUser: BowlRole[];
1011
+ slug: BowlSlug;
1012
+ translations: Resource;
991
1013
  };
992
1014
  type BowlInitOptions = {
993
1015
  defaultMarket?: string;
@@ -1128,4 +1150,4 @@ declare const Logo: React__default.FC;
1128
1150
 
1129
1151
  declare function webpack(sourceConfig: BowlConfig): (config: any) => any;
1130
1152
 
1131
- export { ActionDefault, BlockDefaults, BowlArrayField, BowlBlock, BowlBlockField, BowlCollapsibleField, BowlCollection, BowlConfig, BowlField, BowlGlobal, BowlGroup, BowlGroupField, BowlInitOptions, BowlOptions, BowlPlugin, BowlRole, BowlRowField, BowlSlug, BowlTab, BowlTabsField, CategoryDefaults, CategoryMenu, CategoryMenuProps, CategoryTree, CategoryTreeProps, CheckboxDefaults, CollectionDefault, CollectionHelper, CollectionHook, CollectionHookName, CollectionHooks, ColorCell, ColorConfig, ColorField, ComponentsDefaults, CustomEditModal, CustomEditModalProps, DataField, DataTree, DataTreeDragItem, DataTreeItem, DataTreeItemLi, DataTreeItemProps, DataTreeProps, DataTreeProvider, DataTreeRenameItem, DateDefaults, DebugField, DecoratedList, DecoratedListProps, GlobalDefault, GlobalHelper, GlobalHook, GlobalHookName, GlobalHooks, GroupKey, IBulkAction, IBulkRecord, ICache, IImportItem, IPage, IPageFull, IPagination, IRelation, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, IUndecoratedNavItem, Icon, ImportExportList, ImportExportListProps, ImportExportRedirectList, ImportLogInvalidTypes, ImportLogType, ImportMode, InMemoryCache, InMemoryCacheOptions, KeyMapper, LeaveModal, LeaveWithoutSavingModal, LeaveWithoutSavingModalProps, LocalizedDescription, LocalizedDescriptionProps, Logo, MAX_INT, MarketDefaults, MediaDefaults, MediasDefaults, MenuItem, MixerContext, Option, OrderDefaults, PRESENTATION_FIELDS, PageDefault, PresentationField, PublicURL, Publish, RelatedDefaults, RichTextDefaults, Save, SaveDraft, SelectDefaults, StaticCollectionConfig, StaticCollectionDefault, TemplateDefaults, TextDefaults, TreeItems, UIStaticCell, UIStaticField, UserRolesDefaults, WithAbstract, WithAbstractProps, WithAction, WithActionProps, WithBlock, WithBlockProps, WithCategory, WithCategoryProps, WithCheckbox, WithCheckboxProps, WithCollection, WithCollectionProps, WithColor, WithColorProps, WithComponents, WithComponentsProps, WithDate, WithDateProps, WithDescription, WithDescriptionProps, WithGlobal, WithGlobalProps, WithId, WithIdProps, WithIsActive, WithIsActiveProps, WithIsDefault, WithIsDefaultProps, WithLink, WithLinkOptions, WithLinkProps, WithMarkets, WithMarketsProps, WithMedia, WithMediaProps, WithMedias, WithMediasProps, WithMenu, WithMenuProps, WithName, WithNameProps, WithOrder, WithOrderProps, WithPage, WithPageProps, WithRelated, WithRelatedProps, WithRichText, WithRichTextProps, WithRoles, WithRolesProps, WithSelect, WithSelectProps, WithSlug, WithSlugProps, WithStatic, WithStaticProps, WithTemplate, WithTemplateProps, WithText, WithTextProps, WithTitle, WithTitleProps, afterCategoryChangeHook, afterCategoryDeleteHook, afterCollectionReadHook, afterMenuReadHook, afterPageChangeHook, afterPageDeleteHook, afterPageReadHook, appearanceOptions, beforeDuplicateCollectionHook, beforeValidate, bowl, collectionBulkPatch, collectionExportGet, collectionImportPost, collectionIndexGet, collectionUpdatePatch, debugField, decorateCategories_, decorateCategory_, decorateHref_, decorateHrefs_, decorateMenuCategory_, decorateMenuGroup_, decorateMenuItem_, decorateMenuLink_, decorateMenuPage_, decorateMenuRoute_, decorateMenu_, decorateNavItem_, decorateNav_, decorateNavs_, decorateSchema_, decorateSchemas_, deepMerge, bowl as default, defaultGroup, defaultLocale, defaultLocales, defaultMarket, defaultSlug, eachDataField, eachField, encryptData, fetchCollection, fetchCollectionItems, fetchEndpoint, fetchGlobal, fetchGlobalItems, formatSlug, getApiUrl, getCollectionItem, getCollectionItems, getEachMarketLocale, getGlobalItems, getLivePreviewURL, getLocale, getNumericParam, getObjectParam, getPages, getPagination, getPreviewURL, getPublicURL, getRoute, getRouteByCategoryAndLocale, getRouteByItemAndLocale, getRoutes, getSearchUrl, getStaticLoader, getStore, getStringParam, getSubRequest, getTranslation, getTranslations, getTreeItemClassName, hasMarket, hasRole, importExportListWithParser, internalSlugs, isAdmin, isDataField, isObject, isPresentationField, isRelation, isRole, isUndecoratedNavItem, keyWithRequest, localeGet, localizeCollection, localizeItem, log, logMissingTranslations, menuDetailGet, menuIndexGet, modalSlug, optinPost, options, pageDetailGet, pageIndexGet, parseDepth, populateStaticFields, redirectParser, richTextAfterReadHook, richTextSerialize, roles, routeGet, routePost, routePostHandler, setMixerContext, slugToLabel, slugToLabels, sortByGroup, sortCollection, staticCollectionLoaders, staticCollections, staticDetailGet, staticIndexGet, storeGet, textToSlug, toBlock, toCollection, toField, toGlobal, toTab, translateBlock, translateBlocks, translateCollection, translateField, translateFields, translateGlobal, translateTab, translateTabs, webpack, whereCollection, withAbstract, withAbstractRequired, withAction, withBlock, withCategory, withCategoryRequired, withCheckbox, withCheckboxRequired, withCollection, withCollectionHook, withColor, withColorRequired, withComponents, withDate, withDateRequired, withDescription, withDescriptionRequired, withFieldHook, withGlobal, withGlobalHook, withId, withIdRequired, withIsActive, withIsActiveRequired, withIsDefault, withIsDefaultRequired, withLink, withLocalizedDescription, withMarkets, withMarketsRequired, withMedia, withMediaRequired, withMedias, withMediasRequired, withMenu, withName, withNameRequired, withOrder, withOrderRequired, withPage, withRelated, withRichText, withRichTextRequired, withRoles, withSelect, withSelectRequired, withSlug, withSlugRequired, withStaticCollection, withTemplate, withTemplateRequired, withText, withTextRequired, withTitle, withTitleRequired, withUIStatic };
1153
+ export { ActionDefault, BlockDefaults, BowlArrayField, BowlBlock, BowlBlockField, BowlCollapsibleField, BowlCollection, BowlConfig, BowlField, BowlGlobal, BowlGroup, BowlGroupField, BowlInitOptions, BowlOptions, BowlPlugin, BowlRole, BowlRowField, BowlSlug, BowlTab, BowlTabsField, CategoryDefaults, CategoryMenu, CategoryMenuProps, CategoryTree, CategoryTreeProps, CheckboxDefaults, CollectionDefault, CollectionHelper, CollectionHook, CollectionHookName, CollectionHooks, ColorCell, ColorConfig, ColorField, ComponentsDefaults, CustomEditModal, CustomEditModalProps, DataField, DataTree, DataTreeDragItem, DataTreeItem, DataTreeItemLi, DataTreeItemProps, DataTreeProps, DataTreeProvider, DataTreeRenameItem, DateDefaults, DebugField, DecoratedList, DecoratedListProps, FindOptions, GlobalDefault, GlobalHelper, GlobalHook, GlobalHookName, GlobalHooks, GroupKey, IBulkAction, IBulkRecord, ICache, IImportItem, IPage, IPageFull, IPagination, IRelation, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, IUndecoratedNavItem, Icon, ImportExportList, ImportExportListProps, ImportExportRedirectList, ImportLogInvalidTypes, ImportLogType, ImportMode, InMemoryCache, InMemoryCacheOptions, KeyMapper, LeaveModal, LeaveWithoutSavingModal, LeaveWithoutSavingModalProps, LocalizedDescription, LocalizedDescriptionProps, Logo, MAX_INT, MarketDefaults, MediaDefaults, MediasDefaults, MenuItem, MixerContext, Option, OrderDefaults, PRESENTATION_FIELDS, PageDefault, PresentationField, PublicURL, Publish, RelatedDefaults, RichTextDefaults, Save, SaveDraft, SelectDefaults, StaticCollectionConfig, StaticCollectionDefault, TemplateDefaults, TextDefaults, TreeItems, UIStaticCell, UIStaticField, UserRolesDefaults, WithAbstract, WithAbstractProps, WithAction, WithActionProps, WithBlock, WithBlockProps, WithCategory, WithCategoryProps, WithCheckbox, WithCheckboxProps, WithCollection, WithCollectionProps, WithColor, WithColorProps, WithComponents, WithComponentsProps, WithDate, WithDateProps, WithDescription, WithDescriptionProps, WithGlobal, WithGlobalProps, WithId, WithIdProps, WithIsActive, WithIsActiveProps, WithIsDefault, WithIsDefaultProps, WithLink, WithLinkOptions, WithLinkProps, WithMarkets, WithMarketsProps, WithMedia, WithMediaProps, WithMedias, WithMediasProps, WithMenu, WithMenuProps, WithName, WithNameProps, WithOrder, WithOrderProps, WithPage, WithPageProps, WithRelated, WithRelatedProps, WithRichText, WithRichTextProps, WithRoles, WithRolesProps, WithSelect, WithSelectProps, WithSlug, WithSlugProps, WithStatic, WithStaticProps, WithTemplate, WithTemplateProps, WithText, WithTextProps, WithTitle, WithTitleProps, afterCategoryChangeHook, afterCategoryDeleteHook, afterCollectionReadHook, afterMenuReadHook, afterPageChangeHook, afterPageDeleteHook, afterPageReadHook, appearanceOptions, beforeDuplicateCollectionHook, beforeValidate, bowl, collectionBulkPatch, collectionExportGet, collectionImportPost, collectionIndexGet, collectionUpdatePatch, debugField, decorateCategories_, decorateCategory_, decorateHref_, decorateHrefs_, decorateMenuCategory_, decorateMenuGroup_, decorateMenuItem_, decorateMenuLink_, decorateMenuPage_, decorateMenuRoute_, decorateMenu_, decorateNavItem_, decorateNav_, decorateNavs_, decorateSchema_, decorateSchemas_, deepMerge, bowl as default, defaultGroup, defaultLocale, defaultLocales, defaultMarket, defaultSlug, eachDataField, eachField, encryptData, fetchCollection, fetchCollectionItems, fetchEndpoint, fetchGlobal, fetchGlobalItems, findCollection, formatSlug, getApiUrl, getCollectionItem, getCollectionItems, getEachMarketLocale, getGlobalItems, getLivePreviewURL, getLocale, getNumericParam, getObjectParam, getPages, getPagination, getPreviewURL, getPublicURL, getRoute, getRouteByCategoryAndLocale, getRouteByItemAndLocale, getRoutes, getSearchUrl, getStaticLoader, getStore, getStringParam, getSubRequest, getTranslation, getTranslations, getTreeItemClassName, hasMarket, hasRole, importExportListWithParser, internalSlugs, isAdmin, isDataField, isObject, isPresentationField, isRelation, isRole, isUndecoratedNavItem, keyWithRequest, localeGet, localizeCollection, localizeItem, log, logMissingTranslations, menuDetailGet, menuIndexGet, modalSlug, optinPost, options, pageDetailGet, pageIndexGet, parseDepth, populateStaticFields, redirectParser, richTextAfterReadHook, richTextSerialize, roles, routeGet, routePost, routePostHandler, setMixerContext, slugToLabel, slugToLabels, sortByGroup, sortCollection, staticCollectionLoaders, staticCollections, staticDetailGet, staticIndexGet, storeGet, textToSlug, toBlock, toCollection, toField, toGlobal, toTab, translateBlock, translateBlocks, translateCollection, translateField, translateFields, translateGlobal, translateTab, translateTabs, webpack, whereCollection, withAbstract, withAbstractRequired, withAction, withBlock, withCategory, withCategoryRequired, withCheckbox, withCheckboxRequired, withCollection, withCollectionHook, withColor, withColorRequired, withComponents, withDate, withDateRequired, withDescription, withDescriptionRequired, withFieldHook, withGlobal, withGlobalHook, withId, withIdRequired, withIsActive, withIsActiveRequired, withIsDefault, withIsDefaultRequired, withLink, withLocalizedDescription, withMarkets, withMarketsRequired, withMedia, withMediaRequired, withMedias, withMediasRequired, withMenu, withName, withNameRequired, withOrder, withOrderRequired, withPage, withRelated, withRichText, withRichTextRequired, withRoles, withSelect, withSelectRequired, withSlug, withSlugRequired, withStaticCollection, withTemplate, withTemplateRequired, withText, withTextRequired, withTitle, withTitleRequired, withUIStatic };
package/dist/index.js CHANGED
@@ -287,6 +287,7 @@ __export(src_exports, {
287
287
  fetchEndpoint: () => fetchEndpoint,
288
288
  fetchGlobal: () => fetchGlobal,
289
289
  fetchGlobalItems: () => fetchGlobalItems,
290
+ findCollection: () => findCollection,
290
291
  formatSlug: () => formatSlug,
291
292
  getApiUrl: () => getApiUrl,
292
293
  getCollectionItem: () => getCollectionItem,
@@ -1110,6 +1111,8 @@ var defaultLocales = ["en", "it"];
1110
1111
  var defaultLocale = process.env.DEFAULT_LOCALE || "en";
1111
1112
  var defaultMarket = process.env.DEFAULT_MARKET || "ww";
1112
1113
  var options = {
1114
+ bowlCollections: [],
1115
+ bowlGlobals: [],
1113
1116
  collections: [],
1114
1117
  defaultLocale,
1115
1118
  defaultMarket,
@@ -1120,12 +1123,12 @@ var options = {
1120
1123
  },
1121
1124
  pages: [],
1122
1125
  plugins: [],
1123
- slug: defaultSlug,
1124
- translations,
1125
1126
  roles,
1126
- rolesUser: [roles.Admin, roles.Editor],
1127
1127
  rolesEndUser: [roles.User],
1128
- rolesList: Object.values(roles)
1128
+ rolesList: Object.values(roles),
1129
+ rolesUser: [roles.Admin, roles.Editor],
1130
+ slug: defaultSlug,
1131
+ translations
1129
1132
  };
1130
1133
  var internalSlugs = Object.entries(defaultSlug).map((x) => x[1]);
1131
1134
 
@@ -1623,9 +1626,22 @@ async function getEachMarketLocale(req, callback) {
1623
1626
  __name(getEachMarketLocale, "getEachMarketLocale");
1624
1627
  async function getPages(req) {
1625
1628
  const store = {};
1629
+ const where = typeof req.query.where === "object" ? req.query.where : {};
1630
+ const subRequest = {
1631
+ ...req,
1632
+ query: {
1633
+ ...req.query,
1634
+ where: {
1635
+ ...where,
1636
+ _status: {
1637
+ equals: "published"
1638
+ }
1639
+ }
1640
+ }
1641
+ };
1626
1642
  const keys = options.pages;
1627
1643
  for (const key of keys) {
1628
- const items = await getCollectionItems(req, key, 0);
1644
+ const items = await getCollectionItems(subRequest, key, 0);
1629
1645
  store[key] = items;
1630
1646
  }
1631
1647
  return store;
@@ -3973,6 +3989,13 @@ var pageIndexGet = /* @__PURE__ */ __name((slug) => ({
3973
3989
  }
3974
3990
  const { locale, market, pagination } = query;
3975
3991
  if (typeof market === "string" && typeof locale === "string") {
3992
+ const where = typeof req.query.where === "object" ? req.query.where : {};
3993
+ req.query.where = {
3994
+ ...where,
3995
+ _status: {
3996
+ equals: "published"
3997
+ }
3998
+ };
3976
3999
  const context = await setMixerContext(req, market, locale);
3977
4000
  if (pagination === "true") {
3978
4001
  return next();
@@ -4004,6 +4027,13 @@ var pageDetailGet = /* @__PURE__ */ __name((slug) => ({
4004
4027
  if (!(typeof market === "string" && typeof locale === "string")) {
4005
4028
  return next();
4006
4029
  }
4030
+ const where = typeof req.query.where === "object" ? req.query.where : {};
4031
+ req.query.where = {
4032
+ ...where,
4033
+ _status: {
4034
+ equals: "published"
4035
+ }
4036
+ };
4007
4037
  const context = await setMixerContext(req, market, locale);
4008
4038
  return next();
4009
4039
  } catch (error) {
@@ -4075,8 +4105,38 @@ async function getStore(req) {
4075
4105
  const store = {};
4076
4106
  for (const slug of options.collections) {
4077
4107
  try {
4078
- const collection = await fetchCollection(req, slug, { richText: false });
4079
- store[slug] = collection.docs;
4108
+ const collection = req.payload.collections[slug];
4109
+ if (!collection) {
4110
+ throw `collection '${slug}' not found`;
4111
+ }
4112
+ const bowlCollection = options.bowlCollections.find((x) => x.slug === slug);
4113
+ const type = bowlCollection?.type;
4114
+ let items = [];
4115
+ switch (type) {
4116
+ case "withStatic":
4117
+ {
4118
+ const response = await fetchCollection(req, slug, { richText: false });
4119
+ items = response.docs;
4120
+ }
4121
+ break;
4122
+ case "withPage":
4123
+ {
4124
+ const response = await findCollection(req, slug, {
4125
+ where: {
4126
+ _status: {
4127
+ equals: "published"
4128
+ }
4129
+ }
4130
+ });
4131
+ items = response.docs;
4132
+ }
4133
+ break;
4134
+ default: {
4135
+ const response = await findCollection(req, slug);
4136
+ items = response.docs;
4137
+ }
4138
+ }
4139
+ store[slug] = items;
4080
4140
  } catch (error) {
4081
4141
  if (error.status !== 403) {
4082
4142
  throw error;
@@ -4091,6 +4151,21 @@ async function getStore(req) {
4091
4151
  return store;
4092
4152
  }
4093
4153
  __name(getStore, "getStore");
4154
+ async function findCollection(req, collection, options2) {
4155
+ const newRequest = { ...req };
4156
+ newRequest.query.richText = "false";
4157
+ const items = await req.payload.find({
4158
+ collection,
4159
+ depth: 1,
4160
+ limit: 1e4,
4161
+ locale: "*",
4162
+ req: newRequest,
4163
+ user: req.user,
4164
+ ...options2
4165
+ });
4166
+ return items;
4167
+ }
4168
+ __name(findCollection, "findCollection");
4094
4169
  function getApiUrl(req) {
4095
4170
  const { payload } = req;
4096
4171
  const { config } = payload;
@@ -4121,7 +4196,10 @@ async function fetchEndpoint(req, endpoint, query) {
4121
4196
  const httpGetResponse = await fetch(url, {
4122
4197
  method: "GET",
4123
4198
  headers: {
4124
- "Content-Type": "application/json"
4199
+ "Content-Type": "application/json",
4200
+ ...req.headers.authorization ? {
4201
+ "Authorization": req.headers.authorization
4202
+ } : {}
4125
4203
  }
4126
4204
  });
4127
4205
  if (!httpGetResponse.ok) {
@@ -4130,7 +4208,7 @@ async function fetchEndpoint(req, endpoint, query) {
4130
4208
  const json = await httpGetResponse.json();
4131
4209
  return json;
4132
4210
  } catch (error) {
4133
- console.log("StoreService.fetchEndpoint.error", error.statusText);
4211
+ console.log("StoreService.fetchEndpoint.error", endpoint, error.statusText);
4134
4212
  throw error;
4135
4213
  }
4136
4214
  }
@@ -5315,8 +5393,7 @@ var withAction = /* @__PURE__ */ __name((config) => {
5315
5393
  name: "endUser",
5316
5394
  label: "End user",
5317
5395
  type: "relationship",
5318
- relationTo: options.slug.endUsers,
5319
- required: true
5396
+ relationTo: options.slug.endUsers
5320
5397
  }
5321
5398
  ];
5322
5399
  if (!actionConfig.endpoints) {
@@ -5515,11 +5592,14 @@ var withRichTextRequired = /* @__PURE__ */ __name((options2 = {}) => {
5515
5592
  }, options2);
5516
5593
  return field;
5517
5594
  }, "withRichTextRequired");
5518
- function richTextSerialize(children) {
5595
+ function richTextSerialize(children, includeHtmlTags = true) {
5519
5596
  if (Array.isArray(children)) {
5520
5597
  return children.map((node, i) => {
5521
5598
  if (import_slate.Text.isText(node)) {
5522
5599
  let text = node.text;
5600
+ if (!includeHtmlTags) {
5601
+ return text;
5602
+ }
5523
5603
  if (node.bold) {
5524
5604
  text = `<strong>${text}</strong>`;
5525
5605
  }
@@ -5534,6 +5614,9 @@ function richTextSerialize(children) {
5534
5614
  if (!node) {
5535
5615
  return null;
5536
5616
  }
5617
+ if (!includeHtmlTags) {
5618
+ return richTextSerialize(node.children, includeHtmlTags);
5619
+ }
5537
5620
  switch (node.type) {
5538
5621
  case "h1":
5539
5622
  return `<h1>${richTextSerialize(node.children)}</h1>`;
@@ -6204,8 +6287,17 @@ var import_isomorphic_fetch = require("isomorphic-fetch");
6204
6287
  var ID = 0;
6205
6288
  var CACHE_3 = {};
6206
6289
  async function getCollection(url) {
6207
- const response = await fetch(url, { method: "GET" }).then((response2) => response2.json());
6208
- const items = response.data.items;
6290
+ let items = [];
6291
+ try {
6292
+ const httpResponse = await fetch(url, { method: "GET" });
6293
+ if (!httpResponse.ok) {
6294
+ throw httpResponse;
6295
+ }
6296
+ const response = await httpResponse.json();
6297
+ items = response.items;
6298
+ } catch (error) {
6299
+ console.error("withStaticCollection.getCollection.error", error);
6300
+ }
6209
6301
  return items;
6210
6302
  }
6211
6303
  __name(getCollection, "getCollection");
@@ -6840,6 +6932,8 @@ var bowl = /* @__PURE__ */ __name((sourceOptions = {}) => (sourceConfig) => {
6840
6932
  ...filteredGlobals,
6841
6933
  ...bowlGlobals.map((x) => x(options))
6842
6934
  ];
6935
+ options.bowlCollections = unmappedCollections;
6936
+ options.bowlGlobals = unmappedGlobals;
6843
6937
  const adminViews = {};
6844
6938
  unmappedCollections.forEach((x) => {
6845
6939
  if (x.views) {
@@ -7054,6 +7148,7 @@ var src_default = bowl;
7054
7148
  fetchEndpoint,
7055
7149
  fetchGlobal,
7056
7150
  fetchGlobalItems,
7151
+ findCollection,
7057
7152
  formatSlug,
7058
7153
  getApiUrl,
7059
7154
  getCollectionItem,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/payload-plugin-bowl",
3
- "version": "1.7.7",
3
+ "version": "1.7.9",
4
4
  "description": "Bowl PayloadCms plugin of the BOM Repository",
5
5
  "keywords": [
6
6
  "payload",