@medusajs/types 2.18.0 → 2.19.0-preview-20260811102316
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/cart/workflows.d.ts +54 -0
- package/dist/cart/workflows.d.ts.map +1 -1
- package/dist/common/config-module.d.ts +1 -1
- package/dist/dml/index.d.ts +5 -1
- package/dist/dml/index.d.ts.map +1 -1
- package/dist/fulfillment/mutations/fulfillment.d.ts +6 -0
- package/dist/fulfillment/mutations/fulfillment.d.ts.map +1 -1
- package/dist/fulfillment/provider.d.ts +1 -1
- package/dist/fulfillment/provider.d.ts.map +1 -1
- package/dist/http/cart/store/payloads.d.ts +14 -4
- package/dist/http/cart/store/payloads.d.ts.map +1 -1
- package/dist/http/common/request.d.ts +1 -1
- package/dist/http/index.d.ts +1 -0
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +1 -0
- package/dist/http/index.js.map +1 -1
- package/dist/http/inventory/admin/payloads.d.ts +2 -0
- package/dist/http/inventory/admin/payloads.d.ts.map +1 -1
- package/dist/http/inventory/admin/queries.d.ts +2 -0
- package/dist/http/inventory/admin/queries.d.ts.map +1 -1
- package/dist/http/inventory/admin/responses.d.ts +6 -0
- package/dist/http/inventory/admin/responses.d.ts.map +1 -1
- package/dist/http/invite/admin/entities.d.ts +2 -0
- package/dist/http/invite/admin/entities.d.ts.map +1 -1
- package/dist/http/order/admin/payloads.d.ts +6 -0
- package/dist/http/order/admin/payloads.d.ts.map +1 -1
- package/dist/http/order/common.d.ts +4 -0
- package/dist/http/order/common.d.ts.map +1 -1
- package/dist/http/order-edit/admin/payloads.d.ts +10 -0
- package/dist/http/order-edit/admin/payloads.d.ts.map +1 -1
- package/dist/http/product/common.d.ts +2 -2
- package/dist/http/search/admin/queries.d.ts +17 -0
- package/dist/http/search/admin/queries.d.ts.map +1 -0
- package/dist/{search/settings.js → http/search/admin/queries.js} +1 -1
- package/dist/http/search/admin/queries.js.map +1 -0
- package/dist/http/search/admin/responses.d.ts +18 -0
- package/dist/http/search/admin/responses.d.ts.map +1 -0
- package/dist/{search/interface.js → http/search/admin/responses.js} +1 -1
- package/dist/http/search/admin/responses.js.map +1 -0
- package/dist/http/search/index.d.ts +3 -0
- package/dist/http/search/index.d.ts.map +1 -0
- package/dist/http/search/index.js +19 -0
- package/dist/http/search/index.js.map +1 -0
- package/dist/http/shipping-option/store/entities.d.ts +1 -1
- package/dist/modules-sdk/remote-query.d.ts +20 -0
- package/dist/modules-sdk/remote-query.d.ts.map +1 -1
- package/dist/order/common.d.ts +4 -0
- package/dist/order/common.d.ts.map +1 -1
- package/dist/order/mutations.d.ts +8 -0
- package/dist/order/mutations.d.ts.map +1 -1
- package/dist/order/service.d.ts +16 -1
- package/dist/order/service.d.ts.map +1 -1
- package/dist/search/common.d.ts +26 -0
- package/dist/search/common.d.ts.map +1 -0
- package/dist/search/common.js +3 -0
- package/dist/search/common.js.map +1 -0
- package/dist/search/field.d.ts +40 -0
- package/dist/search/field.d.ts.map +1 -0
- package/dist/search/field.js +3 -0
- package/dist/search/field.js.map +1 -0
- package/dist/search/filters.d.ts +39 -0
- package/dist/search/filters.d.ts.map +1 -0
- package/dist/search/filters.js +3 -0
- package/dist/search/filters.js.map +1 -0
- package/dist/search/index-definition.d.ts +84 -0
- package/dist/search/index-definition.d.ts.map +1 -0
- package/dist/search/index-definition.js +3 -0
- package/dist/search/index-definition.js.map +1 -0
- package/dist/search/index.d.ts +9 -16
- package/dist/search/index.d.ts.map +1 -1
- package/dist/search/index.js +9 -2
- package/dist/search/index.js.map +1 -1
- package/dist/search/migration.d.ts +42 -0
- package/dist/search/migration.d.ts.map +1 -0
- package/dist/search/migration.js +3 -0
- package/dist/search/migration.js.map +1 -0
- package/dist/search/provider.d.ts +93 -0
- package/dist/search/provider.d.ts.map +1 -0
- package/dist/search/provider.js +3 -0
- package/dist/search/provider.js.map +1 -0
- package/dist/search/query.d.ts +86 -0
- package/dist/search/query.d.ts.map +1 -0
- package/dist/search/query.js +6 -0
- package/dist/search/query.js.map +1 -0
- package/dist/search/result.d.ts +48 -0
- package/dist/search/result.d.ts.map +1 -0
- package/dist/search/result.js +3 -0
- package/dist/search/result.js.map +1 -0
- package/dist/search/service.d.ts +71 -0
- package/dist/search/service.d.ts.map +1 -0
- package/dist/search/service.js +3 -0
- package/dist/search/service.js.map +1 -0
- package/dist/settings/service.d.ts +903 -2
- package/dist/settings/service.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/workflow/fulfillment/create-fulfillment.d.ts +6 -0
- package/dist/workflow/fulfillment/create-fulfillment.d.ts.map +1 -1
- package/dist/workflow/inventory/export-inventory-items.d.ts +25 -0
- package/dist/workflow/inventory/export-inventory-items.d.ts.map +1 -0
- package/dist/workflow/inventory/export-inventory-items.js +3 -0
- package/dist/workflow/inventory/export-inventory-items.js.map +1 -0
- package/dist/workflow/inventory/index.d.ts +1 -0
- package/dist/workflow/inventory/index.d.ts.map +1 -1
- package/dist/workflow/inventory/index.js +1 -0
- package/dist/workflow/inventory/index.js.map +1 -1
- package/dist/workflow/order/create-fulfillment.d.ts +7 -1
- package/dist/workflow/order/create-fulfillment.d.ts.map +1 -1
- package/dist/workflow/order/items.d.ts +5 -0
- package/dist/workflow/order/items.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/search/interface.d.ts +0 -63
- package/dist/search/interface.d.ts.map +0 -1
- package/dist/search/interface.js.map +0 -1
- package/dist/search/settings.d.ts +0 -15
- package/dist/search/settings.d.ts.map +0 -1
- package/dist/search/settings.js.map +0 -1
|
@@ -17,8 +17,21 @@ export interface ISettingsModuleService extends IModuleService {
|
|
|
17
17
|
* @returns {Promise<ViewConfigurationDTO>} The retrieved view configuration.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
|
+
* A simple example that retrieves a view configuration by its ID:
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
20
23
|
* const viewConfiguration =
|
|
21
24
|
* await settingsModuleService.retrieveViewConfiguration("viewcfg_123")
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* To specify the fields to retrieve:
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* const viewConfiguration =
|
|
31
|
+
* await settingsModuleService.retrieveViewConfiguration("viewcfg_123", {
|
|
32
|
+
* select: ["id", "name", "configuration"],
|
|
33
|
+
* })
|
|
34
|
+
* ```
|
|
22
35
|
*/
|
|
23
36
|
retrieveViewConfiguration(id: string, config?: FindConfig<ViewConfigurationDTO>, sharedContext?: Context): Promise<ViewConfigurationDTO>;
|
|
24
37
|
/**
|
|
@@ -30,96 +43,924 @@ export interface ISettingsModuleService extends IModuleService {
|
|
|
30
43
|
* @returns {Promise<ViewConfigurationDTO[]>} The list of view configurations.
|
|
31
44
|
*
|
|
32
45
|
* @example
|
|
46
|
+
* To retrieve a list of view configurations using their IDs:
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
33
49
|
* const viewConfigurations =
|
|
34
50
|
* await settingsModuleService.listViewConfigurations({
|
|
35
|
-
*
|
|
36
|
-
* user_id: "user_123",
|
|
51
|
+
* id: ["viewcfg_123", "viewcfg_321"],
|
|
37
52
|
* })
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* To specify the fields to retrieve in each view configuration:
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* const viewConfigurations =
|
|
59
|
+
* await settingsModuleService.listViewConfigurations(
|
|
60
|
+
* {
|
|
61
|
+
* id: ["viewcfg_123", "viewcfg_321"],
|
|
62
|
+
* },
|
|
63
|
+
* {
|
|
64
|
+
* select: ["id", "name", "configuration"],
|
|
65
|
+
* }
|
|
66
|
+
* )
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* const viewConfigurations =
|
|
73
|
+
* await settingsModuleService.listViewConfigurations(
|
|
74
|
+
* {
|
|
75
|
+
* entity: "product",
|
|
76
|
+
* },
|
|
77
|
+
* {
|
|
78
|
+
* take: 20,
|
|
79
|
+
* skip: 2,
|
|
80
|
+
* }
|
|
81
|
+
* )
|
|
82
|
+
* ```
|
|
38
83
|
*/
|
|
39
84
|
listViewConfigurations(filters?: FilterableViewConfigurationProps, config?: FindConfig<ViewConfigurationDTO>, sharedContext?: Context): Promise<ViewConfigurationDTO[]>;
|
|
85
|
+
/**
|
|
86
|
+
* This method retrieves a paginated list of view configurations along with the total count of available view configurations satisfying the provided filters.
|
|
87
|
+
*
|
|
88
|
+
* @param {FilterableViewConfigurationProps} filters - The filters to apply on the retrieved view configurations.
|
|
89
|
+
* @param {FindConfig<ViewConfigurationDTO>} config - The configurations determining how the view configurations are retrieved.
|
|
90
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
91
|
+
* @returns {Promise<[ViewConfigurationDTO[], number]>} The list of view configurations along with their total count.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* To retrieve a list of view configurations using their IDs:
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
97
|
+
* const [viewConfigurations, count] =
|
|
98
|
+
* await settingsModuleService.listAndCountViewConfigurations({
|
|
99
|
+
* id: ["viewcfg_123", "viewcfg_321"],
|
|
100
|
+
* })
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* To specify the fields to retrieve in each view configuration:
|
|
104
|
+
*
|
|
105
|
+
* ```ts
|
|
106
|
+
* const [viewConfigurations, count] =
|
|
107
|
+
* await settingsModuleService.listAndCountViewConfigurations(
|
|
108
|
+
* {
|
|
109
|
+
* id: ["viewcfg_123", "viewcfg_321"],
|
|
110
|
+
* },
|
|
111
|
+
* {
|
|
112
|
+
* select: ["id", "name", "configuration"],
|
|
113
|
+
* }
|
|
114
|
+
* )
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
118
|
+
*
|
|
119
|
+
* ```ts
|
|
120
|
+
* const [viewConfigurations, count] =
|
|
121
|
+
* await settingsModuleService.listAndCountViewConfigurations(
|
|
122
|
+
* {
|
|
123
|
+
* entity: "product",
|
|
124
|
+
* },
|
|
125
|
+
* {
|
|
126
|
+
* take: 20,
|
|
127
|
+
* skip: 2,
|
|
128
|
+
* }
|
|
129
|
+
* )
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
40
132
|
listAndCountViewConfigurations(filters?: FilterableViewConfigurationProps, config?: FindConfig<ViewConfigurationDTO>, sharedContext?: Context): Promise<[ViewConfigurationDTO[], number]>;
|
|
133
|
+
/**
|
|
134
|
+
* This method creates view configurations.
|
|
135
|
+
*
|
|
136
|
+
* @param {CreateViewConfigurationDTO[]} data - The view configurations to create.
|
|
137
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
138
|
+
* @returns {Promise<ViewConfigurationDTO[]>} The created view configurations.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* const viewConfigurations =
|
|
142
|
+
* await settingsModuleService.createViewConfigurations([
|
|
143
|
+
* {
|
|
144
|
+
* entity: "product",
|
|
145
|
+
* name: "My Products View",
|
|
146
|
+
* configuration: {
|
|
147
|
+
* visible_columns: ["title", "status"],
|
|
148
|
+
* column_order: ["title", "status"],
|
|
149
|
+
* },
|
|
150
|
+
* },
|
|
151
|
+
* ])
|
|
152
|
+
*/
|
|
41
153
|
createViewConfigurations(data: CreateViewConfigurationDTO[], sharedContext?: Context): Promise<ViewConfigurationDTO[]>;
|
|
154
|
+
/**
|
|
155
|
+
* This method creates a view configuration.
|
|
156
|
+
*
|
|
157
|
+
* @param {CreateViewConfigurationDTO} data - The view configuration to create.
|
|
158
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
159
|
+
* @returns {Promise<ViewConfigurationDTO>} The created view configuration.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* const viewConfiguration =
|
|
163
|
+
* await settingsModuleService.createViewConfigurations({
|
|
164
|
+
* entity: "product",
|
|
165
|
+
* name: "My Products View",
|
|
166
|
+
* configuration: {
|
|
167
|
+
* visible_columns: ["title", "status"],
|
|
168
|
+
* column_order: ["title", "status"],
|
|
169
|
+
* },
|
|
170
|
+
* })
|
|
171
|
+
*/
|
|
42
172
|
createViewConfigurations(data: CreateViewConfigurationDTO, sharedContext?: Context): Promise<ViewConfigurationDTO>;
|
|
173
|
+
/**
|
|
174
|
+
* This method updates an existing view configuration by its ID.
|
|
175
|
+
*
|
|
176
|
+
* @param {string} idOrSelector - The ID of the view configuration to update.
|
|
177
|
+
* @param {UpdateViewConfigurationDTO} data - The attributes to update in the view configuration.
|
|
178
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
179
|
+
* @returns {Promise<ViewConfigurationDTO>} The updated view configuration.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* const viewConfiguration =
|
|
183
|
+
* await settingsModuleService.updateViewConfigurations("viewcfg_123", {
|
|
184
|
+
* name: "Updated View",
|
|
185
|
+
* })
|
|
186
|
+
*/
|
|
43
187
|
updateViewConfigurations(idOrSelector: string, data: UpdateViewConfigurationDTO, sharedContext?: Context): Promise<ViewConfigurationDTO>;
|
|
188
|
+
/**
|
|
189
|
+
* This method updates the view configurations matching the specified filters.
|
|
190
|
+
*
|
|
191
|
+
* @param {FilterableViewConfigurationProps} idOrSelector - The filters specifying which view configurations to update.
|
|
192
|
+
* @param {UpdateViewConfigurationDTO} data - The attributes to update in the view configurations.
|
|
193
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
194
|
+
* @returns {Promise<ViewConfigurationDTO[]>} The updated view configurations.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* const viewConfigurations =
|
|
198
|
+
* await settingsModuleService.updateViewConfigurations(
|
|
199
|
+
* { entity: "product" },
|
|
200
|
+
* { name: "Updated View" }
|
|
201
|
+
* )
|
|
202
|
+
*/
|
|
44
203
|
updateViewConfigurations(idOrSelector: FilterableViewConfigurationProps, data: UpdateViewConfigurationDTO, sharedContext?: Context): Promise<ViewConfigurationDTO[]>;
|
|
204
|
+
/**
|
|
205
|
+
* This method deletes view configurations by their IDs.
|
|
206
|
+
*
|
|
207
|
+
* @param {string | string[]} ids - The ID(s) of the view configuration(s) to delete.
|
|
208
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
209
|
+
* @returns {Promise<void>} Resolves when the view configurations are deleted.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* await settingsModuleService.deleteViewConfigurations("viewcfg_123")
|
|
213
|
+
*/
|
|
45
214
|
deleteViewConfigurations(ids: string | string[], sharedContext?: Context): Promise<void>;
|
|
215
|
+
/**
|
|
216
|
+
* This method retrieves a user preference by its ID.
|
|
217
|
+
*
|
|
218
|
+
* @param {string} id - The ID of the user preference to retrieve.
|
|
219
|
+
* @param {FindConfig<UserPreferenceDTO>} config - The configurations determining how the user preference is retrieved.
|
|
220
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
221
|
+
* @returns {Promise<UserPreferenceDTO>} The retrieved user preference.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* A simple example that retrieves a user preference by its ID:
|
|
225
|
+
*
|
|
226
|
+
* ```ts
|
|
227
|
+
* const userPreference =
|
|
228
|
+
* await settingsModuleService.retrieveUserPreference("uspref_123")
|
|
229
|
+
* ```
|
|
230
|
+
*
|
|
231
|
+
* To specify the fields to retrieve:
|
|
232
|
+
*
|
|
233
|
+
* ```ts
|
|
234
|
+
* const userPreference =
|
|
235
|
+
* await settingsModuleService.retrieveUserPreference("uspref_123", {
|
|
236
|
+
* select: ["id", "key", "value"],
|
|
237
|
+
* })
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
46
240
|
retrieveUserPreference(id: string, config?: FindConfig<UserPreferenceDTO>, sharedContext?: Context): Promise<UserPreferenceDTO>;
|
|
241
|
+
/**
|
|
242
|
+
* This method retrieves a list of user preferences based on optional filters and configuration.
|
|
243
|
+
*
|
|
244
|
+
* @param {FilterableUserPreferenceProps} filters - The filters to apply on the retrieved user preferences.
|
|
245
|
+
* @param {FindConfig<UserPreferenceDTO>} config - The configurations determining how the user preferences are retrieved.
|
|
246
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
247
|
+
* @returns {Promise<UserPreferenceDTO[]>} The list of user preferences.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* To retrieve a list of user preferences using their IDs:
|
|
251
|
+
*
|
|
252
|
+
* ```ts
|
|
253
|
+
* const userPreferences =
|
|
254
|
+
* await settingsModuleService.listUserPreferences({
|
|
255
|
+
* id: ["uspref_123", "uspref_321"],
|
|
256
|
+
* })
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
259
|
+
* To specify the fields to retrieve in each user preference:
|
|
260
|
+
*
|
|
261
|
+
* ```ts
|
|
262
|
+
* const userPreferences =
|
|
263
|
+
* await settingsModuleService.listUserPreferences(
|
|
264
|
+
* {
|
|
265
|
+
* id: ["uspref_123", "uspref_321"],
|
|
266
|
+
* },
|
|
267
|
+
* {
|
|
268
|
+
* select: ["id", "key", "value"],
|
|
269
|
+
* }
|
|
270
|
+
* )
|
|
271
|
+
* ```
|
|
272
|
+
*
|
|
273
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
274
|
+
*
|
|
275
|
+
* ```ts
|
|
276
|
+
* const userPreferences =
|
|
277
|
+
* await settingsModuleService.listUserPreferences(
|
|
278
|
+
* {
|
|
279
|
+
* user_id: "user_123",
|
|
280
|
+
* },
|
|
281
|
+
* {
|
|
282
|
+
* take: 20,
|
|
283
|
+
* skip: 2,
|
|
284
|
+
* }
|
|
285
|
+
* )
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
47
288
|
listUserPreferences(filters?: FilterableUserPreferenceProps, config?: FindConfig<UserPreferenceDTO>, sharedContext?: Context): Promise<UserPreferenceDTO[]>;
|
|
289
|
+
/**
|
|
290
|
+
* This method retrieves a paginated list of user preferences along with the total count of available user preferences satisfying the provided filters.
|
|
291
|
+
*
|
|
292
|
+
* @param {FilterableUserPreferenceProps} filters - The filters to apply on the retrieved user preferences.
|
|
293
|
+
* @param {FindConfig<UserPreferenceDTO>} config - The configurations determining how the user preferences are retrieved.
|
|
294
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
295
|
+
* @returns {Promise<[UserPreferenceDTO[], number]>} The list of user preferences along with their total count.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* To retrieve a list of user preferences using their IDs:
|
|
299
|
+
*
|
|
300
|
+
* ```ts
|
|
301
|
+
* const [userPreferences, count] =
|
|
302
|
+
* await settingsModuleService.listAndCountUserPreferences({
|
|
303
|
+
* id: ["uspref_123", "uspref_321"],
|
|
304
|
+
* })
|
|
305
|
+
* ```
|
|
306
|
+
*
|
|
307
|
+
* To specify the fields to retrieve in each user preference:
|
|
308
|
+
*
|
|
309
|
+
* ```ts
|
|
310
|
+
* const [userPreferences, count] =
|
|
311
|
+
* await settingsModuleService.listAndCountUserPreferences(
|
|
312
|
+
* {
|
|
313
|
+
* id: ["uspref_123", "uspref_321"],
|
|
314
|
+
* },
|
|
315
|
+
* {
|
|
316
|
+
* select: ["id", "key", "value"],
|
|
317
|
+
* }
|
|
318
|
+
* )
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
322
|
+
*
|
|
323
|
+
* ```ts
|
|
324
|
+
* const [userPreferences, count] =
|
|
325
|
+
* await settingsModuleService.listAndCountUserPreferences(
|
|
326
|
+
* {
|
|
327
|
+
* user_id: "user_123",
|
|
328
|
+
* },
|
|
329
|
+
* {
|
|
330
|
+
* take: 20,
|
|
331
|
+
* skip: 2,
|
|
332
|
+
* }
|
|
333
|
+
* )
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
48
336
|
listAndCountUserPreferences(filters?: FilterableUserPreferenceProps, config?: FindConfig<UserPreferenceDTO>, sharedContext?: Context): Promise<[UserPreferenceDTO[], number]>;
|
|
337
|
+
/**
|
|
338
|
+
* This method creates a user preference.
|
|
339
|
+
*
|
|
340
|
+
* @param {object} data - The user preference to create.
|
|
341
|
+
* @param {string} data.user_id - The ID of the user the preference belongs to.
|
|
342
|
+
* @param {string} data.key - The preference's key.
|
|
343
|
+
* @param {any} data.value - The preference's value.
|
|
344
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
345
|
+
* @returns {Promise<UserPreferenceDTO>} The created user preference.
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* const userPreference =
|
|
349
|
+
* await settingsModuleService.createUserPreferences({
|
|
350
|
+
* user_id: "user_123",
|
|
351
|
+
* key: "theme",
|
|
352
|
+
* value: "dark",
|
|
353
|
+
* })
|
|
354
|
+
*/
|
|
49
355
|
createUserPreferences(data: {
|
|
50
356
|
user_id: string;
|
|
51
357
|
key: string;
|
|
52
358
|
value: any;
|
|
53
359
|
}, sharedContext?: Context): Promise<UserPreferenceDTO>;
|
|
360
|
+
/**
|
|
361
|
+
* This method creates user preferences.
|
|
362
|
+
*
|
|
363
|
+
* @param {object[]} data - The user preferences to create.
|
|
364
|
+
* @param {string} data.user_id - The ID of the user the preference belongs to.
|
|
365
|
+
* @param {string} data.key - The preference's key.
|
|
366
|
+
* @param {any} data.value - The preference's value.
|
|
367
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
368
|
+
* @returns {Promise<UserPreferenceDTO[]>} The created user preferences.
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* const userPreferences =
|
|
372
|
+
* await settingsModuleService.createUserPreferences([
|
|
373
|
+
* {
|
|
374
|
+
* user_id: "user_123",
|
|
375
|
+
* key: "theme",
|
|
376
|
+
* value: "dark",
|
|
377
|
+
* },
|
|
378
|
+
* ])
|
|
379
|
+
*/
|
|
54
380
|
createUserPreferences(data: {
|
|
55
381
|
user_id: string;
|
|
56
382
|
key: string;
|
|
57
383
|
value: any;
|
|
58
384
|
}[], sharedContext?: Context): Promise<UserPreferenceDTO[]>;
|
|
385
|
+
/**
|
|
386
|
+
* This method updates existing user preferences.
|
|
387
|
+
*
|
|
388
|
+
* @param {object[]} data - The user preferences to update.
|
|
389
|
+
* @param {string} data.id - The ID of the user preference to update.
|
|
390
|
+
* @param {any} data.value - The preference's new value.
|
|
391
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
392
|
+
* @returns {Promise<UserPreferenceDTO[]>} The updated user preferences.
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* const userPreferences =
|
|
396
|
+
* await settingsModuleService.updateUserPreferences([
|
|
397
|
+
* {
|
|
398
|
+
* id: "uspref_123",
|
|
399
|
+
* value: "light",
|
|
400
|
+
* },
|
|
401
|
+
* ])
|
|
402
|
+
*/
|
|
59
403
|
updateUserPreferences(data: {
|
|
60
404
|
id: string;
|
|
61
405
|
value?: any;
|
|
62
406
|
}[], sharedContext?: Context): Promise<UserPreferenceDTO[]>;
|
|
407
|
+
/**
|
|
408
|
+
* This method retrieves a user preference by the user's ID and the preference's key.
|
|
409
|
+
*
|
|
410
|
+
* @param {string} userId - The ID of the user the preference belongs to.
|
|
411
|
+
* @param {string} key - The preference's key.
|
|
412
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
413
|
+
* @returns {Promise<UserPreferenceDTO | null>} The user preference, or `null` if none exists for the specified user and key.
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* const userPreference = await settingsModuleService.getUserPreference(
|
|
417
|
+
* "user_123",
|
|
418
|
+
* "theme"
|
|
419
|
+
* )
|
|
420
|
+
*/
|
|
63
421
|
getUserPreference(userId: string, key: string, sharedContext?: Context): Promise<UserPreferenceDTO | null>;
|
|
422
|
+
/**
|
|
423
|
+
* This method sets the value of a user preference, creating it if it doesn't exist or updating it otherwise.
|
|
424
|
+
*
|
|
425
|
+
* @param {string} userId - The ID of the user the preference belongs to.
|
|
426
|
+
* @param {string} key - The preference's key.
|
|
427
|
+
* @param {any} value - The preference's value.
|
|
428
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
429
|
+
* @returns {Promise<UserPreferenceDTO>} The created or updated user preference.
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* const userPreference = await settingsModuleService.setUserPreference(
|
|
433
|
+
* "user_123",
|
|
434
|
+
* "theme",
|
|
435
|
+
* "dark"
|
|
436
|
+
* )
|
|
437
|
+
*/
|
|
64
438
|
setUserPreference(userId: string, key: string, value: any, sharedContext?: Context): Promise<UserPreferenceDTO>;
|
|
439
|
+
/**
|
|
440
|
+
* This method deletes user preferences by their IDs.
|
|
441
|
+
*
|
|
442
|
+
* @param {string | string[]} ids - The ID(s) of the user preference(s) to delete.
|
|
443
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
444
|
+
* @returns {Promise<void>} Resolves when the user preferences are deleted.
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* await settingsModuleService.deleteUserPreferences("uspref_123")
|
|
448
|
+
*/
|
|
65
449
|
deleteUserPreferences(ids: string | string[], sharedContext?: Context): Promise<void>;
|
|
450
|
+
/**
|
|
451
|
+
* This method retrieves the active view configuration set for a user and entity.
|
|
452
|
+
*
|
|
453
|
+
* @param {string} entity - The entity to retrieve the active view configuration for.
|
|
454
|
+
* @param {string} userId - The ID of the user to retrieve the active view configuration for.
|
|
455
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
456
|
+
* @returns {Promise<ViewConfigurationDTO | null>} The active view configuration, or `null` if the user has no active view for the entity.
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* const viewConfiguration =
|
|
460
|
+
* await settingsModuleService.getActiveViewConfiguration(
|
|
461
|
+
* "product",
|
|
462
|
+
* "user_123"
|
|
463
|
+
* )
|
|
464
|
+
*/
|
|
66
465
|
getActiveViewConfiguration(entity: string, userId: string, sharedContext?: Context): Promise<ViewConfigurationDTO | null>;
|
|
466
|
+
/**
|
|
467
|
+
* This method sets the active view configuration for a user and entity.
|
|
468
|
+
*
|
|
469
|
+
* @param {string} entity - The entity to set the active view configuration for.
|
|
470
|
+
* @param {string} userId - The ID of the user to set the active view configuration for.
|
|
471
|
+
* @param {string} viewConfigurationId - The ID of the view configuration to set as active.
|
|
472
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
473
|
+
* @returns {Promise<void>} Resolves when the active view configuration is set.
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* await settingsModuleService.setActiveViewConfiguration(
|
|
477
|
+
* "product",
|
|
478
|
+
* "user_123",
|
|
479
|
+
* "viewcfg_123"
|
|
480
|
+
* )
|
|
481
|
+
*/
|
|
67
482
|
setActiveViewConfiguration(entity: string, userId: string, viewConfigurationId: string, sharedContext?: Context): Promise<void>;
|
|
483
|
+
/**
|
|
484
|
+
* This method retrieves the system default view configuration for an entity.
|
|
485
|
+
*
|
|
486
|
+
* @param {string} entity - The entity to retrieve the system default view configuration for.
|
|
487
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
488
|
+
* @returns {Promise<ViewConfigurationDTO | null>} The system default view configuration, or `null` if none is set for the entity.
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* const viewConfiguration =
|
|
492
|
+
* await settingsModuleService.getSystemDefaultViewConfiguration("product")
|
|
493
|
+
*/
|
|
68
494
|
getSystemDefaultViewConfiguration(entity: string, sharedContext?: Context): Promise<ViewConfigurationDTO | null>;
|
|
495
|
+
/**
|
|
496
|
+
* This method clears the active view configuration set for a user and entity, reverting to the default view.
|
|
497
|
+
*
|
|
498
|
+
* @param {string} entity - The entity to clear the active view configuration for.
|
|
499
|
+
* @param {string} userId - The ID of the user to clear the active view configuration for.
|
|
500
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
501
|
+
* @returns {Promise<void>} Resolves when the active view configuration is cleared.
|
|
502
|
+
*
|
|
503
|
+
* @example
|
|
504
|
+
* await settingsModuleService.clearActiveViewConfiguration(
|
|
505
|
+
* "product",
|
|
506
|
+
* "user_123"
|
|
507
|
+
* )
|
|
508
|
+
*/
|
|
69
509
|
clearActiveViewConfiguration(entity: string, userId: string, sharedContext?: Context): Promise<void>;
|
|
510
|
+
/**
|
|
511
|
+
* This method retrieves a layout configuration by its ID.
|
|
512
|
+
*
|
|
513
|
+
* @param {string} id - The ID of the layout configuration to retrieve.
|
|
514
|
+
* @param {FindConfig<LayoutConfigurationDTO>} config - The configurations determining how the layout configuration is retrieved.
|
|
515
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
516
|
+
* @returns {Promise<LayoutConfigurationDTO>} The retrieved layout configuration.
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* A simple example that retrieves a layout configuration by its ID:
|
|
520
|
+
*
|
|
521
|
+
* ```ts
|
|
522
|
+
* const layoutConfiguration =
|
|
523
|
+
* await settingsModuleService.retrieveLayoutConfiguration("laycfg_123")
|
|
524
|
+
* ```
|
|
525
|
+
*
|
|
526
|
+
* To specify the fields to retrieve:
|
|
527
|
+
*
|
|
528
|
+
* ```ts
|
|
529
|
+
* const layoutConfiguration =
|
|
530
|
+
* await settingsModuleService.retrieveLayoutConfiguration("laycfg_123", {
|
|
531
|
+
* select: ["id", "zone", "configuration"],
|
|
532
|
+
* })
|
|
533
|
+
* ```
|
|
534
|
+
*/
|
|
70
535
|
retrieveLayoutConfiguration(id: string, config?: FindConfig<LayoutConfigurationDTO>, sharedContext?: Context): Promise<LayoutConfigurationDTO>;
|
|
536
|
+
/**
|
|
537
|
+
* This method retrieves a list of layout configurations based on optional filters and configuration.
|
|
538
|
+
*
|
|
539
|
+
* @param {FilterableLayoutConfigurationProps} filters - The filters to apply on the retrieved layout configurations.
|
|
540
|
+
* @param {FindConfig<LayoutConfigurationDTO>} config - The configurations determining how the layout configurations are retrieved.
|
|
541
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
542
|
+
* @returns {Promise<LayoutConfigurationDTO[]>} The list of layout configurations.
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* To retrieve a list of layout configurations using their IDs:
|
|
546
|
+
*
|
|
547
|
+
* ```ts
|
|
548
|
+
* const layoutConfigurations =
|
|
549
|
+
* await settingsModuleService.listLayoutConfigurations({
|
|
550
|
+
* id: ["laycfg_123", "laycfg_321"],
|
|
551
|
+
* })
|
|
552
|
+
* ```
|
|
553
|
+
*
|
|
554
|
+
* To specify the fields to retrieve in each layout configuration:
|
|
555
|
+
*
|
|
556
|
+
* ```ts
|
|
557
|
+
* const layoutConfigurations =
|
|
558
|
+
* await settingsModuleService.listLayoutConfigurations(
|
|
559
|
+
* {
|
|
560
|
+
* id: ["laycfg_123", "laycfg_321"],
|
|
561
|
+
* },
|
|
562
|
+
* {
|
|
563
|
+
* select: ["id", "zone", "configuration"],
|
|
564
|
+
* }
|
|
565
|
+
* )
|
|
566
|
+
* ```
|
|
567
|
+
*
|
|
568
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
569
|
+
*
|
|
570
|
+
* ```ts
|
|
571
|
+
* const layoutConfigurations =
|
|
572
|
+
* await settingsModuleService.listLayoutConfigurations(
|
|
573
|
+
* {
|
|
574
|
+
* zone: "product.details",
|
|
575
|
+
* },
|
|
576
|
+
* {
|
|
577
|
+
* take: 20,
|
|
578
|
+
* skip: 2,
|
|
579
|
+
* }
|
|
580
|
+
* )
|
|
581
|
+
* ```
|
|
582
|
+
*/
|
|
71
583
|
listLayoutConfigurations(filters?: FilterableLayoutConfigurationProps, config?: FindConfig<LayoutConfigurationDTO>, sharedContext?: Context): Promise<LayoutConfigurationDTO[]>;
|
|
584
|
+
/**
|
|
585
|
+
* This method retrieves a paginated list of layout configurations along with the total count of available layout configurations satisfying the provided filters.
|
|
586
|
+
*
|
|
587
|
+
* @param {FilterableLayoutConfigurationProps} filters - The filters to apply on the retrieved layout configurations.
|
|
588
|
+
* @param {FindConfig<LayoutConfigurationDTO>} config - The configurations determining how the layout configurations are retrieved.
|
|
589
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
590
|
+
* @returns {Promise<[LayoutConfigurationDTO[], number]>} The list of layout configurations along with their total count.
|
|
591
|
+
*
|
|
592
|
+
* @example
|
|
593
|
+
* To retrieve a list of layout configurations using their IDs:
|
|
594
|
+
*
|
|
595
|
+
* ```ts
|
|
596
|
+
* const [layoutConfigurations, count] =
|
|
597
|
+
* await settingsModuleService.listAndCountLayoutConfigurations({
|
|
598
|
+
* id: ["laycfg_123", "laycfg_321"],
|
|
599
|
+
* })
|
|
600
|
+
* ```
|
|
601
|
+
*
|
|
602
|
+
* To specify the fields to retrieve in each layout configuration:
|
|
603
|
+
*
|
|
604
|
+
* ```ts
|
|
605
|
+
* const [layoutConfigurations, count] =
|
|
606
|
+
* await settingsModuleService.listAndCountLayoutConfigurations(
|
|
607
|
+
* {
|
|
608
|
+
* id: ["laycfg_123", "laycfg_321"],
|
|
609
|
+
* },
|
|
610
|
+
* {
|
|
611
|
+
* select: ["id", "zone", "configuration"],
|
|
612
|
+
* }
|
|
613
|
+
* )
|
|
614
|
+
* ```
|
|
615
|
+
*
|
|
616
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
617
|
+
*
|
|
618
|
+
* ```ts
|
|
619
|
+
* const [layoutConfigurations, count] =
|
|
620
|
+
* await settingsModuleService.listAndCountLayoutConfigurations(
|
|
621
|
+
* {
|
|
622
|
+
* zone: "product.details",
|
|
623
|
+
* },
|
|
624
|
+
* {
|
|
625
|
+
* take: 20,
|
|
626
|
+
* skip: 2,
|
|
627
|
+
* }
|
|
628
|
+
* )
|
|
629
|
+
* ```
|
|
630
|
+
*/
|
|
72
631
|
listAndCountLayoutConfigurations(filters?: FilterableLayoutConfigurationProps, config?: FindConfig<LayoutConfigurationDTO>, sharedContext?: Context): Promise<[LayoutConfigurationDTO[], number]>;
|
|
632
|
+
/**
|
|
633
|
+
* This method creates layout configurations.
|
|
634
|
+
*
|
|
635
|
+
* @param {CreateLayoutConfigurationDTO[]} data - The layout configurations to create.
|
|
636
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
637
|
+
* @returns {Promise<LayoutConfigurationDTO[]>} The created layout configurations.
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* const layoutConfigurations =
|
|
641
|
+
* await settingsModuleService.createLayoutConfigurations([
|
|
642
|
+
* {
|
|
643
|
+
* zone: "product.details",
|
|
644
|
+
* configuration: { widgets: {} },
|
|
645
|
+
* },
|
|
646
|
+
* ])
|
|
647
|
+
*/
|
|
73
648
|
createLayoutConfigurations(data: CreateLayoutConfigurationDTO[], sharedContext?: Context): Promise<LayoutConfigurationDTO[]>;
|
|
649
|
+
/**
|
|
650
|
+
* This method creates a layout configuration.
|
|
651
|
+
*
|
|
652
|
+
* @param {CreateLayoutConfigurationDTO} data - The layout configuration to create.
|
|
653
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
654
|
+
* @returns {Promise<LayoutConfigurationDTO>} The created layout configuration.
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* const layoutConfiguration =
|
|
658
|
+
* await settingsModuleService.createLayoutConfigurations({
|
|
659
|
+
* zone: "product.details",
|
|
660
|
+
* configuration: { widgets: {} },
|
|
661
|
+
* })
|
|
662
|
+
*/
|
|
74
663
|
createLayoutConfigurations(data: CreateLayoutConfigurationDTO, sharedContext?: Context): Promise<LayoutConfigurationDTO>;
|
|
664
|
+
/**
|
|
665
|
+
* This method deletes layout configurations by their IDs.
|
|
666
|
+
*
|
|
667
|
+
* @param {string | string[]} ids - The ID(s) of the layout configuration(s) to delete.
|
|
668
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
669
|
+
* @returns {Promise<void>} Resolves when the layout configurations are deleted.
|
|
670
|
+
*
|
|
671
|
+
* @example
|
|
672
|
+
* await settingsModuleService.deleteLayoutConfigurations("laycfg_123")
|
|
673
|
+
*/
|
|
75
674
|
deleteLayoutConfigurations(ids: string | string[], sharedContext?: Context): Promise<void>;
|
|
76
675
|
/**
|
|
77
676
|
* Retrieve the system default layout configuration for a zone, if any.
|
|
677
|
+
*
|
|
678
|
+
* @param {string} zone - The zone to retrieve the system default layout configuration for.
|
|
679
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
680
|
+
* @returns {Promise<LayoutConfigurationDTO | null>} The system default layout configuration, or `null` if none is set for the zone.
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* const layoutConfiguration =
|
|
684
|
+
* await settingsModuleService.getSystemDefaultLayoutConfiguration(
|
|
685
|
+
* "product.details"
|
|
686
|
+
* )
|
|
78
687
|
*/
|
|
79
688
|
getSystemDefaultLayoutConfiguration(zone: string, sharedContext?: Context): Promise<LayoutConfigurationDTO | null>;
|
|
80
689
|
/**
|
|
81
690
|
* Create or replace the single layout configuration for a `(zone, user)`
|
|
82
691
|
* pair. The configuration JSON is replaced, not merged.
|
|
692
|
+
*
|
|
693
|
+
* @param {string} zone - The zone to set the layout configuration for.
|
|
694
|
+
* @param {string} userId - The ID of the user the layout configuration belongs to.
|
|
695
|
+
* @param {LayoutConfigurationData} data - The layout configuration data. It replaces the existing configuration rather than being merged into it.
|
|
696
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
697
|
+
* @returns {Promise<LayoutConfigurationDTO>} The created or updated layout configuration.
|
|
698
|
+
*
|
|
699
|
+
* @example
|
|
700
|
+
* const layoutConfiguration =
|
|
701
|
+
* await settingsModuleService.setLayoutConfiguration(
|
|
702
|
+
* "product.details",
|
|
703
|
+
* "user_123",
|
|
704
|
+
* { widgets: {} }
|
|
705
|
+
* )
|
|
83
706
|
*/
|
|
84
707
|
setLayoutConfiguration(zone: string, userId: string, data: LayoutConfigurationData, sharedContext?: Context): Promise<LayoutConfigurationDTO>;
|
|
85
708
|
/**
|
|
86
709
|
* Create or replace the single system default layout configuration for a
|
|
87
710
|
* zone. The configuration JSON is replaced, not merged.
|
|
711
|
+
*
|
|
712
|
+
* @param {string} zone - The zone to set the system default layout configuration for.
|
|
713
|
+
* @param {LayoutConfigurationData} data - The layout configuration data. It replaces the existing configuration rather than being merged into it.
|
|
714
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
715
|
+
* @returns {Promise<LayoutConfigurationDTO>} The created or updated system default layout configuration.
|
|
716
|
+
*
|
|
717
|
+
* @example
|
|
718
|
+
* const layoutConfiguration =
|
|
719
|
+
* await settingsModuleService.setSystemDefaultLayoutConfiguration(
|
|
720
|
+
* "product.details",
|
|
721
|
+
* { widgets: {} }
|
|
722
|
+
* )
|
|
88
723
|
*/
|
|
89
724
|
setSystemDefaultLayoutConfiguration(zone: string, data: LayoutConfigurationData, sharedContext?: Context): Promise<LayoutConfigurationDTO>;
|
|
90
725
|
/**
|
|
91
726
|
* Remove a user's personal layout configuration for a zone, falling back to
|
|
92
727
|
* the system default.
|
|
728
|
+
*
|
|
729
|
+
* @param {string} zone - The zone to clear the user's layout configuration for.
|
|
730
|
+
* @param {string} userId - The ID of the user whose layout configuration is cleared.
|
|
731
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
732
|
+
* @returns {Promise<void>} Resolves when the user's layout configuration is cleared.
|
|
733
|
+
*
|
|
734
|
+
* @example
|
|
735
|
+
* await settingsModuleService.clearLayoutConfiguration(
|
|
736
|
+
* "product.details",
|
|
737
|
+
* "user_123"
|
|
738
|
+
* )
|
|
93
739
|
*/
|
|
94
740
|
clearLayoutConfiguration(zone: string, userId: string, sharedContext?: Context): Promise<void>;
|
|
95
741
|
/**
|
|
96
742
|
* Retrieve the scope a user is actively viewing for a zone, as persisted via
|
|
97
743
|
* their preferences. Returns null when they have made no explicit choice.
|
|
744
|
+
*
|
|
745
|
+
* @param {string} zone - The zone to retrieve the active layout scope for.
|
|
746
|
+
* @param {string} userId - The ID of the user to retrieve the active layout scope for.
|
|
747
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
748
|
+
* @returns {Promise<"personal" | "default" | null>} The active layout scope, or `null` when the user has made no explicit choice.
|
|
749
|
+
*
|
|
750
|
+
* @example
|
|
751
|
+
* const scope = await settingsModuleService.getActiveLayoutScope(
|
|
752
|
+
* "product.details",
|
|
753
|
+
* "user_123"
|
|
754
|
+
* )
|
|
98
755
|
*/
|
|
99
756
|
getActiveLayoutScope(zone: string, userId: string, sharedContext?: Context): Promise<"personal" | "default" | null>;
|
|
100
757
|
/**
|
|
101
758
|
* Persist the scope a user is actively viewing for a zone. Pass null to
|
|
102
759
|
* clear an explicit choice and fall back to the natural resolution.
|
|
760
|
+
*
|
|
761
|
+
* @param {string} zone - The zone to set the active layout scope for.
|
|
762
|
+
* @param {string} userId - The ID of the user to set the active layout scope for.
|
|
763
|
+
* @param {"personal" | "default" | null} scope - The scope to persist, or `null` to clear the explicit choice.
|
|
764
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
765
|
+
* @returns {Promise<void>} Resolves when the active layout scope is set.
|
|
766
|
+
*
|
|
767
|
+
* @example
|
|
768
|
+
* await settingsModuleService.setActiveLayoutScope(
|
|
769
|
+
* "product.details",
|
|
770
|
+
* "user_123",
|
|
771
|
+
* "personal"
|
|
772
|
+
* )
|
|
103
773
|
*/
|
|
104
774
|
setActiveLayoutScope(zone: string, userId: string, scope: "personal" | "default" | null, sharedContext?: Context): Promise<void>;
|
|
775
|
+
/**
|
|
776
|
+
* This method retrieves a property label by its ID.
|
|
777
|
+
*
|
|
778
|
+
* @param {string} id - The ID of the property label to retrieve.
|
|
779
|
+
* @param {FindConfig<PropertyLabelDTO>} config - The configurations determining how the property label is retrieved.
|
|
780
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
781
|
+
* @returns {Promise<PropertyLabelDTO>} The retrieved property label.
|
|
782
|
+
*
|
|
783
|
+
* @example
|
|
784
|
+
* A simple example that retrieves a property label by its ID:
|
|
785
|
+
*
|
|
786
|
+
* ```ts
|
|
787
|
+
* const propertyLabel =
|
|
788
|
+
* await settingsModuleService.retrievePropertyLabel("prlbl_123")
|
|
789
|
+
* ```
|
|
790
|
+
*
|
|
791
|
+
* To specify the fields to retrieve:
|
|
792
|
+
*
|
|
793
|
+
* ```ts
|
|
794
|
+
* const propertyLabel =
|
|
795
|
+
* await settingsModuleService.retrievePropertyLabel("prlbl_123", {
|
|
796
|
+
* select: ["id", "entity", "property", "label"],
|
|
797
|
+
* })
|
|
798
|
+
* ```
|
|
799
|
+
*/
|
|
105
800
|
retrievePropertyLabel(id: string, config?: FindConfig<PropertyLabelDTO>, sharedContext?: Context): Promise<PropertyLabelDTO>;
|
|
801
|
+
/**
|
|
802
|
+
* This method retrieves a list of property labels based on optional filters and configuration.
|
|
803
|
+
*
|
|
804
|
+
* @param {PropertyLabelFilterableFields} filters - The filters to apply on the retrieved property labels.
|
|
805
|
+
* @param {FindConfig<PropertyLabelDTO>} config - The configurations determining how the property labels are retrieved.
|
|
806
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
807
|
+
* @returns {Promise<PropertyLabelDTO[]>} The list of property labels.
|
|
808
|
+
*
|
|
809
|
+
* @example
|
|
810
|
+
* To retrieve a list of property labels using their IDs:
|
|
811
|
+
*
|
|
812
|
+
* ```ts
|
|
813
|
+
* const propertyLabels =
|
|
814
|
+
* await settingsModuleService.listPropertyLabels({
|
|
815
|
+
* id: ["prlbl_123", "prlbl_321"],
|
|
816
|
+
* })
|
|
817
|
+
* ```
|
|
818
|
+
*
|
|
819
|
+
* To specify the fields to retrieve in each property label:
|
|
820
|
+
*
|
|
821
|
+
* ```ts
|
|
822
|
+
* const propertyLabels =
|
|
823
|
+
* await settingsModuleService.listPropertyLabels(
|
|
824
|
+
* {
|
|
825
|
+
* id: ["prlbl_123", "prlbl_321"],
|
|
826
|
+
* },
|
|
827
|
+
* {
|
|
828
|
+
* select: ["id", "entity", "property", "label"],
|
|
829
|
+
* }
|
|
830
|
+
* )
|
|
831
|
+
* ```
|
|
832
|
+
*
|
|
833
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
834
|
+
*
|
|
835
|
+
* ```ts
|
|
836
|
+
* const propertyLabels =
|
|
837
|
+
* await settingsModuleService.listPropertyLabels(
|
|
838
|
+
* {
|
|
839
|
+
* entity: "Product",
|
|
840
|
+
* },
|
|
841
|
+
* {
|
|
842
|
+
* take: 20,
|
|
843
|
+
* skip: 2,
|
|
844
|
+
* }
|
|
845
|
+
* )
|
|
846
|
+
* ```
|
|
847
|
+
*/
|
|
106
848
|
listPropertyLabels(filters?: PropertyLabelFilterableFields, config?: FindConfig<PropertyLabelDTO>, sharedContext?: Context): Promise<PropertyLabelDTO[]>;
|
|
849
|
+
/**
|
|
850
|
+
* This method retrieves a paginated list of property labels along with the total count of available property labels satisfying the provided filters.
|
|
851
|
+
*
|
|
852
|
+
* @param {PropertyLabelFilterableFields} filters - The filters to apply on the retrieved property labels.
|
|
853
|
+
* @param {FindConfig<PropertyLabelDTO>} config - The configurations determining how the property labels are retrieved.
|
|
854
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
855
|
+
* @returns {Promise<[PropertyLabelDTO[], number]>} The list of property labels along with their total count.
|
|
856
|
+
*
|
|
857
|
+
* @example
|
|
858
|
+
* To retrieve a list of property labels using their IDs:
|
|
859
|
+
*
|
|
860
|
+
* ```ts
|
|
861
|
+
* const [propertyLabels, count] =
|
|
862
|
+
* await settingsModuleService.listAndCountPropertyLabels({
|
|
863
|
+
* id: ["prlbl_123", "prlbl_321"],
|
|
864
|
+
* })
|
|
865
|
+
* ```
|
|
866
|
+
*
|
|
867
|
+
* To specify the fields to retrieve in each property label:
|
|
868
|
+
*
|
|
869
|
+
* ```ts
|
|
870
|
+
* const [propertyLabels, count] =
|
|
871
|
+
* await settingsModuleService.listAndCountPropertyLabels(
|
|
872
|
+
* {
|
|
873
|
+
* id: ["prlbl_123", "prlbl_321"],
|
|
874
|
+
* },
|
|
875
|
+
* {
|
|
876
|
+
* select: ["id", "entity", "property", "label"],
|
|
877
|
+
* }
|
|
878
|
+
* )
|
|
879
|
+
* ```
|
|
880
|
+
*
|
|
881
|
+
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
882
|
+
*
|
|
883
|
+
* ```ts
|
|
884
|
+
* const [propertyLabels, count] =
|
|
885
|
+
* await settingsModuleService.listAndCountPropertyLabels(
|
|
886
|
+
* {
|
|
887
|
+
* entity: "Product",
|
|
888
|
+
* },
|
|
889
|
+
* {
|
|
890
|
+
* take: 20,
|
|
891
|
+
* skip: 2,
|
|
892
|
+
* }
|
|
893
|
+
* )
|
|
894
|
+
* ```
|
|
895
|
+
*/
|
|
107
896
|
listAndCountPropertyLabels(filters?: PropertyLabelFilterableFields, config?: FindConfig<PropertyLabelDTO>, sharedContext?: Context): Promise<[PropertyLabelDTO[], number]>;
|
|
108
897
|
/**
|
|
109
898
|
* Create a property label.
|
|
899
|
+
*
|
|
900
|
+
* @param {CreatePropertyLabelDTO} data - The property label to create.
|
|
901
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
902
|
+
* @returns {Promise<PropertyLabelDTO>} The created property label.
|
|
903
|
+
*
|
|
904
|
+
* @example
|
|
905
|
+
* const propertyLabel =
|
|
906
|
+
* await settingsModuleService.createPropertyLabels({
|
|
907
|
+
* entity: "Product",
|
|
908
|
+
* property: "title",
|
|
909
|
+
* label: "Name",
|
|
910
|
+
* })
|
|
110
911
|
*/
|
|
111
912
|
createPropertyLabels(data: CreatePropertyLabelDTO, sharedContext?: Context): Promise<PropertyLabelDTO>;
|
|
112
913
|
/**
|
|
113
914
|
* Create multiple property labels.
|
|
915
|
+
*
|
|
916
|
+
* @param {CreatePropertyLabelDTO[]} data - The property labels to create.
|
|
917
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
918
|
+
* @returns {Promise<PropertyLabelDTO[]>} The created property labels.
|
|
919
|
+
*
|
|
920
|
+
* @example
|
|
921
|
+
* const propertyLabels =
|
|
922
|
+
* await settingsModuleService.createPropertyLabels([
|
|
923
|
+
* {
|
|
924
|
+
* entity: "Product",
|
|
925
|
+
* property: "title",
|
|
926
|
+
* label: "Name",
|
|
927
|
+
* },
|
|
928
|
+
* ])
|
|
114
929
|
*/
|
|
115
930
|
createPropertyLabels(data: CreatePropertyLabelDTO[], sharedContext?: Context): Promise<PropertyLabelDTO[]>;
|
|
116
931
|
/**
|
|
117
932
|
* Update property labels.
|
|
118
933
|
* Pass data objects with 'id' field to update specific labels.
|
|
934
|
+
*
|
|
935
|
+
* @param {UpdatePropertyLabelDTO[]} data - The property labels to update, each identified by its `id`.
|
|
936
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
937
|
+
* @returns {Promise<PropertyLabelDTO[]>} The updated property labels.
|
|
938
|
+
*
|
|
939
|
+
* @example
|
|
940
|
+
* const propertyLabels =
|
|
941
|
+
* await settingsModuleService.updatePropertyLabels([
|
|
942
|
+
* {
|
|
943
|
+
* id: "prlbl_123",
|
|
944
|
+
* label: "Product Name",
|
|
945
|
+
* },
|
|
946
|
+
* ])
|
|
119
947
|
*/
|
|
120
948
|
updatePropertyLabels(data: UpdatePropertyLabelDTO[], sharedContext?: Context): Promise<PropertyLabelDTO[]>;
|
|
121
949
|
/**
|
|
122
950
|
* Update property labels by selector.
|
|
951
|
+
*
|
|
952
|
+
* @param {object} options - The update options.
|
|
953
|
+
* @param {PropertyLabelFilterableFields} options.selector - The filters specifying which property labels to update.
|
|
954
|
+
* @param {UpdatePropertyLabelDTO} options.data - The attributes to update in the matching property labels.
|
|
955
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
956
|
+
* @returns {Promise<PropertyLabelDTO[]>} The updated property labels.
|
|
957
|
+
*
|
|
958
|
+
* @example
|
|
959
|
+
* const propertyLabels =
|
|
960
|
+
* await settingsModuleService.updatePropertyLabels({
|
|
961
|
+
* selector: { entity: "Product" },
|
|
962
|
+
* data: { description: "The product's title." },
|
|
963
|
+
* })
|
|
123
964
|
*/
|
|
124
965
|
updatePropertyLabels(options: {
|
|
125
966
|
selector: PropertyLabelFilterableFields;
|
|
@@ -127,6 +968,19 @@ export interface ISettingsModuleService extends IModuleService {
|
|
|
127
968
|
}, sharedContext?: Context): Promise<PropertyLabelDTO[]>;
|
|
128
969
|
/**
|
|
129
970
|
* Retrieve a property label by entity and property.
|
|
971
|
+
*
|
|
972
|
+
* @param {object} selector - The entity and property to retrieve the label for.
|
|
973
|
+
* @param {string} selector.entity - The entity the label applies to.
|
|
974
|
+
* @param {string} [selector.property] - The property path the label applies to.
|
|
975
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
976
|
+
* @returns {Promise<PropertyLabelDTO>} The retrieved property label.
|
|
977
|
+
*
|
|
978
|
+
* @example
|
|
979
|
+
* const propertyLabel =
|
|
980
|
+
* await settingsModuleService.retrievePropertyLabel({
|
|
981
|
+
* entity: "Product",
|
|
982
|
+
* property: "title",
|
|
983
|
+
* })
|
|
130
984
|
*/
|
|
131
985
|
retrievePropertyLabel({ entity, property }: {
|
|
132
986
|
entity: string;
|
|
@@ -135,27 +989,74 @@ export interface ISettingsModuleService extends IModuleService {
|
|
|
135
989
|
/**
|
|
136
990
|
* Create or update a property label.
|
|
137
991
|
* If a label already exists for the entity.property combination, it will be updated.
|
|
992
|
+
*
|
|
993
|
+
* @param {UpsertPropertyLabelDTO[]} data - The property labels to create or update.
|
|
994
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
995
|
+
* @returns {Promise<PropertyLabelDTO[]>} The created or updated property labels.
|
|
996
|
+
*
|
|
997
|
+
* @example
|
|
998
|
+
* const propertyLabels =
|
|
999
|
+
* await settingsModuleService.upsertPropertyLabels([
|
|
1000
|
+
* {
|
|
1001
|
+
* entity: "Product",
|
|
1002
|
+
* property: "title",
|
|
1003
|
+
* label: "Name",
|
|
1004
|
+
* },
|
|
1005
|
+
* ])
|
|
138
1006
|
*/
|
|
139
1007
|
upsertPropertyLabels(data: UpsertPropertyLabelDTO[], sharedContext?: Context): Promise<PropertyLabelDTO[]>;
|
|
1008
|
+
/**
|
|
1009
|
+
* This method deletes property labels by their IDs.
|
|
1010
|
+
*
|
|
1011
|
+
* @param {string | string[]} ids - The ID(s) of the property label(s) to delete.
|
|
1012
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1013
|
+
* @returns {Promise<void>} Resolves when the property labels are deleted.
|
|
1014
|
+
*
|
|
1015
|
+
* @example
|
|
1016
|
+
* await settingsModuleService.deletePropertyLabels("prlbl_123")
|
|
1017
|
+
*/
|
|
140
1018
|
deletePropertyLabels(ids: string | string[], sharedContext?: Context): Promise<void>;
|
|
141
1019
|
/**
|
|
142
1020
|
* List all discoverable entities from joiner configs.
|
|
143
1021
|
* Returns brief info about each entity.
|
|
1022
|
+
*
|
|
1023
|
+
* @returns {Promise<AdminEntityInfo[]>} The list of discoverable entities.
|
|
1024
|
+
*
|
|
1025
|
+
* @example
|
|
1026
|
+
* const entities = await settingsModuleService.listDiscoverableEntities()
|
|
144
1027
|
*/
|
|
145
1028
|
listDiscoverableEntities(): Promise<AdminEntityInfo[]>;
|
|
146
1029
|
/**
|
|
147
1030
|
* Check if an entity exists by name.
|
|
148
1031
|
* Supports PascalCase, kebab-case, snake_case, and plural forms.
|
|
1032
|
+
*
|
|
1033
|
+
* @param {string} name - The name of the entity to check for.
|
|
1034
|
+
* @returns {boolean} Whether an entity with the specified name exists.
|
|
1035
|
+
*
|
|
1036
|
+
* @example
|
|
1037
|
+
* const exists = settingsModuleService.hasEntity("product")
|
|
149
1038
|
*/
|
|
150
1039
|
hasEntity(name: string): boolean;
|
|
151
1040
|
/**
|
|
152
1041
|
* Generate columns for an entity.
|
|
153
1042
|
* Returns null if the entity is not found.
|
|
1043
|
+
*
|
|
1044
|
+
* @param {string} entityKey - The key of the entity to generate columns for.
|
|
1045
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1046
|
+
* @returns {Promise<AdminColumn[] | null>} The generated columns, or `null` if the entity is not found.
|
|
1047
|
+
*
|
|
1048
|
+
* @example
|
|
1049
|
+
* const columns = await settingsModuleService.generateEntityColumns("product")
|
|
154
1050
|
*/
|
|
155
1051
|
generateEntityColumns(entityKey: string, sharedContext?: Context): Promise<AdminColumn[] | null>;
|
|
156
1052
|
/**
|
|
157
1053
|
* Check if entity discovery has been initialized.
|
|
158
1054
|
* Entity discovery is initialized during application start.
|
|
1055
|
+
*
|
|
1056
|
+
* @returns {boolean} Whether entity discovery has been initialized.
|
|
1057
|
+
*
|
|
1058
|
+
* @example
|
|
1059
|
+
* const initialized = settingsModuleService.isEntityDiscoveryInitialized()
|
|
159
1060
|
*/
|
|
160
1061
|
isEntityDiscoveryInitialized(): boolean;
|
|
161
1062
|
}
|