oneentry 1.0.165 → 1.0.167

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.
Files changed (59) hide show
  1. package/README.md +5 -1
  2. package/changelog.md +36 -0
  3. package/dist/base/utils.d.ts +5 -2
  4. package/dist/base/validation.d.ts +7 -5
  5. package/dist/base/validation.js +7 -4
  6. package/dist/file-uploading/fileUploadingApi.d.ts +27 -1
  7. package/dist/file-uploading/fileUploadingApi.js +42 -0
  8. package/dist/file-uploading/fileUploadingInterfaces.d.ts +102 -1
  9. package/dist/file-uploading/fileUploadingSchemas.d.ts +73 -0
  10. package/dist/file-uploading/fileUploadingSchemas.js +47 -1
  11. package/dist/forms-data/formsDataApi.d.ts +1 -1
  12. package/dist/forms-data/formsDataApi.js +1 -1
  13. package/dist/forms-data/formsDataInterfaces.d.ts +9 -2
  14. package/dist/index.d.ts +4 -0
  15. package/dist/index.js +3 -0
  16. package/dist/orders/ordersApi.d.ts +14 -0
  17. package/dist/orders/ordersApi.js +19 -0
  18. package/dist/orders/ordersInterfaces.d.ts +11 -0
  19. package/dist/payments/paymentsApi.d.ts +14 -1
  20. package/dist/payments/paymentsApi.js +18 -0
  21. package/dist/payments/paymentsInterfaces.d.ts +43 -1
  22. package/dist/payments/paymentsSchemas.d.ts +32 -0
  23. package/dist/payments/paymentsSchemas.js +20 -1
  24. package/dist/types.d.ts +1 -0
  25. package/dist/user-groups/userGroupsApi.d.ts +81 -0
  26. package/dist/user-groups/userGroupsApi.js +145 -0
  27. package/dist/user-groups/userGroupsInterfaces.d.ts +100 -0
  28. package/dist/user-groups/userGroupsInterfaces.js +2 -0
  29. package/dist/user-groups/userGroupsSchemas.d.ts +55 -0
  30. package/dist/user-groups/userGroupsSchemas.js +35 -0
  31. package/esm/base/utils.d.ts +5 -2
  32. package/esm/base/validation.d.ts +7 -5
  33. package/esm/base/validation.js +7 -4
  34. package/esm/file-uploading/fileUploadingApi.d.ts +27 -1
  35. package/esm/file-uploading/fileUploadingApi.js +42 -0
  36. package/esm/file-uploading/fileUploadingInterfaces.d.ts +102 -1
  37. package/esm/file-uploading/fileUploadingSchemas.d.ts +73 -0
  38. package/esm/file-uploading/fileUploadingSchemas.js +46 -0
  39. package/esm/forms-data/formsDataApi.d.ts +1 -1
  40. package/esm/forms-data/formsDataApi.js +1 -1
  41. package/esm/forms-data/formsDataInterfaces.d.ts +9 -2
  42. package/esm/index.d.ts +4 -0
  43. package/esm/index.js +3 -0
  44. package/esm/orders/ordersApi.d.ts +14 -0
  45. package/esm/orders/ordersApi.js +19 -0
  46. package/esm/orders/ordersInterfaces.d.ts +11 -0
  47. package/esm/payments/paymentsApi.d.ts +14 -1
  48. package/esm/payments/paymentsApi.js +18 -0
  49. package/esm/payments/paymentsInterfaces.d.ts +43 -1
  50. package/esm/payments/paymentsSchemas.d.ts +32 -0
  51. package/esm/payments/paymentsSchemas.js +19 -0
  52. package/esm/types.d.ts +1 -0
  53. package/esm/user-groups/userGroupsApi.d.ts +81 -0
  54. package/esm/user-groups/userGroupsApi.js +106 -0
  55. package/esm/user-groups/userGroupsInterfaces.d.ts +100 -0
  56. package/esm/user-groups/userGroupsInterfaces.js +1 -0
  57. package/esm/user-groups/userGroupsSchemas.d.ts +55 -0
  58. package/esm/user-groups/userGroupsSchemas.js +32 -0
  59. package/package.json +2 -2
@@ -66,6 +66,16 @@ interface IPaymentsApi {
66
66
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
67
67
  */
68
68
  getAccountById(id: number): Promise<IAccountsEntity | IError>;
69
+ /**
70
+ * Get the payment progress of an order: its stages and whether they are paid.
71
+ * @handleName getPaymentStagesByOrderId
72
+ * @param {number} id - ID of the order object. Example: 1.
73
+ * @returns {IPaymentProgress} Returns the payment progress of the order.
74
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
75
+ * @description This method gets the payment stages of an order. This method requires user authorization.
76
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
77
+ */
78
+ getPaymentStagesByOrderId(id: number): Promise<IPaymentProgress | IError>;
69
79
  }
70
80
  /**
71
81
  * @interface ISessionsEntity
@@ -186,4 +196,36 @@ interface IPaymentAccountTestSettings {
186
196
  signingSecretKey?: string;
187
197
  useWebHookValidation?: boolean;
188
198
  }
189
- export type { IAccountsEntity, IIntent, IPaymentAccountSettings, IPaymentAccountTestSettings, IPaymentsApi, ISessionEntity, ISessionsEntity, };
199
+ /**
200
+ * The `IPaymentProgress` interface describes the payment progress of an order.
201
+ * @interface IPaymentProgress
202
+ * @property {boolean} completed - True when every stage of the order has been paid. Example: false.
203
+ * @property {boolean} partial - True when the order is paid in stages rather than in one payment. Example: true.
204
+ * @property {IPaymentStage[]} stages - The stages themselves, in the order the API returns them.
205
+ * @description This interface describes the payment progress of an order — whether it is fully paid, whether it is split into stages, and the stages themselves.
206
+ */
207
+ interface IPaymentProgress {
208
+ completed: boolean;
209
+ partial: boolean;
210
+ stages: IPaymentStage[];
211
+ }
212
+ /**
213
+ * The `IPaymentStage` interface describes one payment stage of an order.
214
+ * @interface IPaymentStage
215
+ * @property {string} marker - Marker of the attribute that set the price of the stage. Example: "part_a".
216
+ * @property {number} sessionId - Identifier of the payment session bound to the stage. Example: 100.
217
+ * @property {number} productId - Identifier of the product the stage belongs to. Example: 200.
218
+ * @property {string} title - Title of the stage. Example: "Part A".
219
+ * @property {number} value - Price of the stage. Example: 150.
220
+ * @property {"planned" | "completed"} status - Stage status: "planned" — not paid yet, "completed" — paid. Example: "planned".
221
+ * @description This interface describes one payment stage of an order.
222
+ */
223
+ interface IPaymentStage {
224
+ marker: string;
225
+ sessionId: number;
226
+ productId: number;
227
+ title: string;
228
+ value: number;
229
+ status: 'planned' | 'completed';
230
+ }
231
+ export type { IAccountsEntity, IIntent, IPaymentAccountSettings, IPaymentAccountTestSettings, IPaymentProgress, IPaymentsApi, IPaymentStage, ISessionEntity, ISessionsEntity, };
@@ -92,3 +92,35 @@ export declare const PaymentAccountsResponseSchema: z.ZodArray<z.ZodObject<{
92
92
  localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
93
93
  updatedDate: z.ZodString;
94
94
  }, z.core.$strip>>;
95
+ /**
96
+ * Payment stage schema
97
+ */
98
+ export declare const PaymentStageSchema: z.ZodObject<{
99
+ marker: z.ZodString;
100
+ sessionId: z.ZodNumber;
101
+ productId: z.ZodNumber;
102
+ title: z.ZodString;
103
+ value: z.ZodNumber;
104
+ status: z.ZodEnum<{
105
+ completed: "completed";
106
+ planned: "planned";
107
+ }>;
108
+ }, z.core.$strip>;
109
+ /**
110
+ * Payment progress schema — stages of one order plus their aggregate state
111
+ */
112
+ export declare const PaymentProgressSchema: z.ZodObject<{
113
+ completed: z.ZodBoolean;
114
+ partial: z.ZodBoolean;
115
+ stages: z.ZodArray<z.ZodObject<{
116
+ marker: z.ZodString;
117
+ sessionId: z.ZodNumber;
118
+ productId: z.ZodNumber;
119
+ title: z.ZodString;
120
+ value: z.ZodNumber;
121
+ status: z.ZodEnum<{
122
+ completed: "completed";
123
+ planned: "planned";
124
+ }>;
125
+ }, z.core.$strip>>;
126
+ }, z.core.$strip>;
@@ -51,3 +51,22 @@ export const PaymentAccountSchema = z.object({
51
51
  * Payment accounts response schema
52
52
  */
53
53
  export const PaymentAccountsResponseSchema = z.array(PaymentAccountSchema);
54
+ /**
55
+ * Payment stage schema
56
+ */
57
+ export const PaymentStageSchema = z.object({
58
+ marker: z.string(),
59
+ sessionId: z.number(),
60
+ productId: z.number(),
61
+ title: z.string(),
62
+ value: z.number(),
63
+ status: z.enum(['planned', 'completed']),
64
+ });
65
+ /**
66
+ * Payment progress schema — stages of one order plus their aggregate state
67
+ */
68
+ export const PaymentProgressSchema = z.object({
69
+ completed: z.boolean(),
70
+ partial: z.boolean(),
71
+ stages: z.array(PaymentStageSchema),
72
+ });
package/esm/types.d.ts CHANGED
@@ -31,5 +31,6 @@ export type * from './system/systemInterfaces.js';
31
31
  export type * from './templates/templatesInterfaces.js';
32
32
  export type * from './templates-preview/templatesPreviewInterfaces.js';
33
33
  export type * from './user-activity/userActivityInterfaces.js';
34
+ export type * from './user-groups/userGroupsInterfaces.js';
34
35
  export type * from './users/usersInterfaces.js';
35
36
  export type * from './web-socket/wsInterfaces.js';
@@ -0,0 +1,81 @@
1
+ import AsyncModules from '../base/asyncModules.js';
2
+ import type StateModule from '../base/stateModule.js';
3
+ import type { IError } from '../base/utils.js';
4
+ import type { IUserGroupEntity, IUserGroups } from './userGroupsInterfaces.js';
5
+ /**
6
+ * Controllers for working with user groups
7
+ * @handle /api/content/user-groups
8
+ * @class UserGroupsApi
9
+ * @augments AsyncModules
10
+ * @implements {IUserGroups}
11
+ * @description User groups form a tree — a group may have a parent and children. The flat list
12
+ * comes from `getUserGroups`, the top level from `getRootUserGroups`, and the tree is walked
13
+ * downwards with `getChildUserGroupsByMarker`.
14
+ * @example
15
+ * const { UserGroups } = defineOneEntry('your-url', { token: 'your-app-token' });
16
+ * const roots = await UserGroups.getRootUserGroups();
17
+ */
18
+ export default class UserGroupsApi extends AsyncModules implements IUserGroups {
19
+ protected state: StateModule;
20
+ protected _url: string;
21
+ /**
22
+ * Constructor
23
+ * @param {StateModule} state - StateModule instance
24
+ * @description Constructor initializes the UserGroupsApi with a given state.
25
+ */
26
+ constructor(state: StateModule);
27
+ /**
28
+ * Get all user group objects.
29
+ * @handleName getUserGroups
30
+ * @param {string} [langCode] - Language code. Default: "en_US".
31
+ * @returns {Promise<IUserGroupEntity[] | IError>} Returns an array of user group objects.
32
+ * @throws {IError} When isShell=false and an error occurs during the fetch
33
+ * @description Returns every group as a flat array, regardless of nesting.
34
+ * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroups getUserGroups} documentation.
35
+ */
36
+ getUserGroups(langCode?: string): Promise<IUserGroupEntity[] | IError>;
37
+ /**
38
+ * Get all top-level user group objects.
39
+ * @handleName getRootUserGroups
40
+ * @param {string} [langCode] - Language code. Default: "en_US".
41
+ * @returns {Promise<IUserGroupEntity[] | IError>} Returns an array of user group objects with `parentId: null`.
42
+ * @throws {IError} When isShell=false and an error occurs during the fetch
43
+ * @description Returns the groups of the top level — those without a parent.
44
+ * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getRootUserGroups getRootUserGroups} documentation.
45
+ */
46
+ getRootUserGroups(langCode?: string): Promise<IUserGroupEntity[] | IError>;
47
+ /**
48
+ * Get a single user group object by its identifier.
49
+ * @handleName getUserGroupById
50
+ * @param {number} id - Identifier of the user group. Example: 1.
51
+ * @param {string} [langCode] - Language code. Default: "en_US".
52
+ * @returns {Promise<IUserGroupEntity | IError>} Returns a single user group object.
53
+ * @throws {IError} When isShell=false and an error occurs during the fetch
54
+ * @description Get a single user group object by its identifier.
55
+ * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroupById getUserGroupById} documentation.
56
+ */
57
+ getUserGroupById(id: number, langCode?: string): Promise<IUserGroupEntity | IError>;
58
+ /**
59
+ * Get a single user group object by its marker.
60
+ * @handleName getUserGroupByMarker
61
+ * @param {string} marker - Text identifier of the user group. Example: "guest".
62
+ * @param {string} [langCode] - Language code. Default: "en_US".
63
+ * @returns {Promise<IUserGroupEntity | IError>} Returns a single user group object.
64
+ * @throws {IError} When isShell=false and an error occurs during the fetch
65
+ * @description Get a single user group object by its marker.
66
+ * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroupByMarker getUserGroupByMarker} documentation.
67
+ */
68
+ getUserGroupByMarker(marker: string, langCode?: string): Promise<IUserGroupEntity | IError>;
69
+ /**
70
+ * Get the child groups of a user group.
71
+ * @handleName getChildUserGroupsByMarker
72
+ * @param {string} marker - Text identifier of the parent user group. Example: "guest".
73
+ * @param {string} [langCode] - Language code. Default: "en_US".
74
+ * @returns {Promise<IUserGroupEntity[] | IError>} Returns an array of child user group objects, empty when the group has none.
75
+ * @throws {IError} When isShell=false and an error occurs during the fetch
76
+ * @description Get the child groups of a user group by the parent marker. The nesting is walked
77
+ * with this method rather than through `parentId`.
78
+ * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getChildUserGroupsByMarker getChildUserGroupsByMarker} documentation.
79
+ */
80
+ getChildUserGroupsByMarker(marker: string, langCode?: string): Promise<IUserGroupEntity[] | IError>;
81
+ }
@@ -0,0 +1,106 @@
1
+ import AsyncModules from '../base/asyncModules.js';
2
+ import createSchemaLoader from '../base/lazySchema.js';
3
+ const schema = createSchemaLoader(() => import('./userGroupsSchemas.js'));
4
+ /**
5
+ * Controllers for working with user groups
6
+ * @handle /api/content/user-groups
7
+ * @class UserGroupsApi
8
+ * @augments AsyncModules
9
+ * @implements {IUserGroups}
10
+ * @description User groups form a tree — a group may have a parent and children. The flat list
11
+ * comes from `getUserGroups`, the top level from `getRootUserGroups`, and the tree is walked
12
+ * downwards with `getChildUserGroupsByMarker`.
13
+ * @example
14
+ * const { UserGroups } = defineOneEntry('your-url', { token: 'your-app-token' });
15
+ * const roots = await UserGroups.getRootUserGroups();
16
+ */
17
+ export default class UserGroupsApi extends AsyncModules {
18
+ /**
19
+ * Constructor
20
+ * @param {StateModule} state - StateModule instance
21
+ * @description Constructor initializes the UserGroupsApi with a given state.
22
+ */
23
+ constructor(state) {
24
+ super(state);
25
+ this._url = state.url + '/api/content/user-groups';
26
+ }
27
+ /**
28
+ * Get all user group objects.
29
+ * @handleName getUserGroups
30
+ * @param {string} [langCode] - Language code. Default: "en_US".
31
+ * @returns {Promise<IUserGroupEntity[] | IError>} Returns an array of user group objects.
32
+ * @throws {IError} When isShell=false and an error occurs during the fetch
33
+ * @description Returns every group as a flat array, regardless of nesting.
34
+ * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroups getUserGroups} documentation.
35
+ */
36
+ async getUserGroups(langCode = this.state.lang) {
37
+ const result = await this._fetchGet(`/?langCode=${langCode}`);
38
+ // Validate response if validation is enabled
39
+ const validated = await this._validateResponse(result, schema('UserGroupsResponseSchema'));
40
+ return this._normalizeData(validated, langCode);
41
+ }
42
+ /**
43
+ * Get all top-level user group objects.
44
+ * @handleName getRootUserGroups
45
+ * @param {string} [langCode] - Language code. Default: "en_US".
46
+ * @returns {Promise<IUserGroupEntity[] | IError>} Returns an array of user group objects with `parentId: null`.
47
+ * @throws {IError} When isShell=false and an error occurs during the fetch
48
+ * @description Returns the groups of the top level — those without a parent.
49
+ * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getRootUserGroups getRootUserGroups} documentation.
50
+ */
51
+ async getRootUserGroups(langCode = this.state.lang) {
52
+ const result = await this._fetchGet(`/root?langCode=${langCode}`);
53
+ // Validate response if validation is enabled
54
+ const validated = await this._validateResponse(result, schema('UserGroupsResponseSchema'));
55
+ return this._normalizeData(validated, langCode);
56
+ }
57
+ /**
58
+ * Get a single user group object by its identifier.
59
+ * @handleName getUserGroupById
60
+ * @param {number} id - Identifier of the user group. Example: 1.
61
+ * @param {string} [langCode] - Language code. Default: "en_US".
62
+ * @returns {Promise<IUserGroupEntity | IError>} Returns a single user group object.
63
+ * @throws {IError} When isShell=false and an error occurs during the fetch
64
+ * @description Get a single user group object by its identifier.
65
+ * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroupById getUserGroupById} documentation.
66
+ */
67
+ async getUserGroupById(id, langCode = this.state.lang) {
68
+ const result = await this._fetchGet(`/${id}?langCode=${langCode}`);
69
+ // Validate response if validation is enabled
70
+ const validated = await this._validateResponse(result, schema('UserGroupEntitySchema'));
71
+ return this._normalizeData(validated, langCode);
72
+ }
73
+ /**
74
+ * Get a single user group object by its marker.
75
+ * @handleName getUserGroupByMarker
76
+ * @param {string} marker - Text identifier of the user group. Example: "guest".
77
+ * @param {string} [langCode] - Language code. Default: "en_US".
78
+ * @returns {Promise<IUserGroupEntity | IError>} Returns a single user group object.
79
+ * @throws {IError} When isShell=false and an error occurs during the fetch
80
+ * @description Get a single user group object by its marker.
81
+ * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroupByMarker getUserGroupByMarker} documentation.
82
+ */
83
+ async getUserGroupByMarker(marker, langCode = this.state.lang) {
84
+ const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
85
+ // Validate response if validation is enabled
86
+ const validated = await this._validateResponse(result, schema('UserGroupEntitySchema'));
87
+ return this._normalizeData(validated, langCode);
88
+ }
89
+ /**
90
+ * Get the child groups of a user group.
91
+ * @handleName getChildUserGroupsByMarker
92
+ * @param {string} marker - Text identifier of the parent user group. Example: "guest".
93
+ * @param {string} [langCode] - Language code. Default: "en_US".
94
+ * @returns {Promise<IUserGroupEntity[] | IError>} Returns an array of child user group objects, empty when the group has none.
95
+ * @throws {IError} When isShell=false and an error occurs during the fetch
96
+ * @description Get the child groups of a user group by the parent marker. The nesting is walked
97
+ * with this method rather than through `parentId`.
98
+ * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getChildUserGroupsByMarker getChildUserGroupsByMarker} documentation.
99
+ */
100
+ async getChildUserGroupsByMarker(marker, langCode = this.state.lang) {
101
+ const result = await this._fetchGet(`/marker/${marker}/children?langCode=${langCode}`);
102
+ // Validate response if validation is enabled
103
+ const validated = await this._validateResponse(result, schema('UserGroupsResponseSchema'));
104
+ return this._normalizeData(validated, langCode);
105
+ }
106
+ }
@@ -0,0 +1,100 @@
1
+ import type { IAttributeValues, IError, ILocalizeInfo } from '../base/utils.js';
2
+ /**
3
+ * The `IUserGroups` interface defines methods for reading user groups.
4
+ * @interface IUserGroups
5
+ * @description User groups form a tree: a group may have a parent and children, and the tree is
6
+ * walked through the marker-based methods. Every method requires the project token.
7
+ */
8
+ interface IUserGroups {
9
+ /**
10
+ * Get all user group objects.
11
+ * @handleName getUserGroups
12
+ * @param {string} [langCode] - Language code. Default: "en_US".
13
+ * @returns {IUserGroupEntity[]} Returns an array of user group objects.
14
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
15
+ * @description This method gets all user group objects, flat, regardless of nesting.
16
+ */
17
+ getUserGroups(langCode?: string): Promise<IUserGroupEntity[] | IError>;
18
+ /**
19
+ * Get all top-level user group objects.
20
+ * @handleName getRootUserGroups
21
+ * @param {string} [langCode] - Language code. Default: "en_US".
22
+ * @returns {IUserGroupEntity[]} Returns an array of user group objects with `parentId: null`.
23
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
24
+ * @description This method gets the user groups of the top level — those without a parent.
25
+ */
26
+ getRootUserGroups(langCode?: string): Promise<IUserGroupEntity[] | IError>;
27
+ /**
28
+ * Get a single user group object by its identifier.
29
+ * @handleName getUserGroupById
30
+ * @param {number} id - Identifier of the user group. Example: 1.
31
+ * @param {string} [langCode] - Language code. Default: "en_US".
32
+ * @returns {IUserGroupEntity} Returns a single user group object.
33
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
34
+ * @description This method gets a single user group object by its identifier.
35
+ */
36
+ getUserGroupById(id: number, langCode?: string): Promise<IUserGroupEntity | IError>;
37
+ /**
38
+ * Get a single user group object by its marker.
39
+ * @handleName getUserGroupByMarker
40
+ * @param {string} marker - Text identifier of the user group. Example: "guest".
41
+ * @param {string} [langCode] - Language code. Default: "en_US".
42
+ * @returns {IUserGroupEntity} Returns a single user group object.
43
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
44
+ * @description This method gets a single user group object by its marker.
45
+ */
46
+ getUserGroupByMarker(marker: string, langCode?: string): Promise<IUserGroupEntity | IError>;
47
+ /**
48
+ * Get the child groups of a user group.
49
+ * @handleName getChildUserGroupsByMarker
50
+ * @param {string} marker - Text identifier of the parent user group. Example: "guest".
51
+ * @param {string} [langCode] - Language code. Default: "en_US".
52
+ * @returns {IUserGroupEntity[]} Returns an array of child user group objects, empty when the group has none.
53
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
54
+ * @description This method gets the child groups of a user group by the parent marker.
55
+ */
56
+ getChildUserGroupsByMarker(marker: string, langCode?: string): Promise<IUserGroupEntity[] | IError>;
57
+ }
58
+ /**
59
+ * The `IUserGroupEntity` interface defines the structure of a user group object.
60
+ * @interface IUserGroupEntity
61
+ * @property {number} id - Identifier of the user group. Example: 1.
62
+ * @property {number} depth - Nesting depth relative to the parent. Example: 0.
63
+ * @property {number | null} parentId - Identifier of the parent group, `null` for a top-level group. Example: null.
64
+ * @property {ILocalizeInfo} localizeInfos - Title of the group, taking localization into account.
65
+ * @property {boolean} isVisible - Visibility flag. Example: true.
66
+ * @property {string} childrenCount - Number of child groups. The API sends it as a **string**, not a number. Example: "0".
67
+ * @property {string} identifier - Text identifier (marker) of the group. Example: "guest".
68
+ * @property {boolean} isSync - Synchronization flag. Example: false.
69
+ * @property {IAttributeValues} attributeValues - Attribute values of the group.
70
+ * @property {number} [version] - Version of the object. Not present on every stand. Example: 0.
71
+ * @description Structure of a user group object.
72
+ * @example
73
+ * ```json
74
+ * {
75
+ * "id": 1,
76
+ * "depth": 0,
77
+ * "parentId": null,
78
+ * "localizeInfos": { "title": "Guest" },
79
+ * "isVisible": true,
80
+ * "childrenCount": "0",
81
+ * "identifier": "guest",
82
+ * "isSync": false,
83
+ * "attributeValues": {},
84
+ * "version": 0
85
+ * }
86
+ * ```
87
+ */
88
+ interface IUserGroupEntity {
89
+ id: number;
90
+ depth: number;
91
+ parentId: number | null;
92
+ localizeInfos: ILocalizeInfo;
93
+ isVisible: boolean;
94
+ childrenCount: string;
95
+ identifier: string;
96
+ isSync: boolean;
97
+ attributeValues: IAttributeValues;
98
+ version?: number;
99
+ }
100
+ export type { IUserGroupEntity, IUserGroups };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Validation schemas for UserGroups module
3
+ * @description Zod schemas for validating user-group API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * User group entity schema.
8
+ *
9
+ * `childrenCount` is a **string** here because that is what the API sends
10
+ * (`"0"`), even though the platform DTO declares it a number. The schema
11
+ * describes the raw response, so it follows the response.
12
+ */
13
+ export declare const UserGroupEntitySchema: z.ZodObject<{
14
+ id: z.ZodNumber;
15
+ depth: z.ZodNumber;
16
+ parentId: z.ZodNullable<z.ZodNumber>;
17
+ localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodObject<{
18
+ title: z.ZodString;
19
+ content: z.ZodOptional<z.ZodString>;
20
+ menuTitle: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>>, z.ZodObject<{
22
+ title: z.ZodString;
23
+ content: z.ZodOptional<z.ZodString>;
24
+ menuTitle: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strip>]>;
26
+ isVisible: z.ZodBoolean;
27
+ childrenCount: z.ZodString;
28
+ identifier: z.ZodString;
29
+ isSync: z.ZodBoolean;
30
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
31
+ version: z.ZodOptional<z.ZodNumber>;
32
+ }, z.core.$strip>;
33
+ /**
34
+ * User groups response schema (array of groups)
35
+ */
36
+ export declare const UserGroupsResponseSchema: z.ZodArray<z.ZodObject<{
37
+ id: z.ZodNumber;
38
+ depth: z.ZodNumber;
39
+ parentId: z.ZodNullable<z.ZodNumber>;
40
+ localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodObject<{
41
+ title: z.ZodString;
42
+ content: z.ZodOptional<z.ZodString>;
43
+ menuTitle: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strip>>, z.ZodObject<{
45
+ title: z.ZodString;
46
+ content: z.ZodOptional<z.ZodString>;
47
+ menuTitle: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>]>;
49
+ isVisible: z.ZodBoolean;
50
+ childrenCount: z.ZodString;
51
+ identifier: z.ZodString;
52
+ isSync: z.ZodBoolean;
53
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
54
+ version: z.ZodOptional<z.ZodNumber>;
55
+ }, z.core.$strip>>;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Validation schemas for UserGroups module
3
+ * @description Zod schemas for validating user-group API responses
4
+ */
5
+ import { z } from 'zod';
6
+ import { AttributeValuesSchema, LocalizeInfoSchema } from '../base/validation.js';
7
+ /**
8
+ * User group entity schema.
9
+ *
10
+ * `childrenCount` is a **string** here because that is what the API sends
11
+ * (`"0"`), even though the platform DTO declares it a number. The schema
12
+ * describes the raw response, so it follows the response.
13
+ */
14
+ export const UserGroupEntitySchema = z.object({
15
+ id: z.number(),
16
+ depth: z.number(),
17
+ parentId: z.number().nullable(),
18
+ localizeInfos: z.union([
19
+ z.record(z.string(), LocalizeInfoSchema),
20
+ LocalizeInfoSchema,
21
+ ]),
22
+ isVisible: z.boolean(),
23
+ childrenCount: z.string(),
24
+ identifier: z.string(),
25
+ isSync: z.boolean(),
26
+ attributeValues: AttributeValuesSchema,
27
+ version: z.number().optional(),
28
+ });
29
+ /**
30
+ * User groups response schema (array of groups)
31
+ */
32
+ export const UserGroupsResponseSchema = z.array(UserGroupEntitySchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.165",
3
+ "version": "1.0.167",
4
4
  "description": "OneEntry NPM package",
5
5
  "main": "dist/index.js",
6
6
  "module": "esm/index.js",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "scripts": {
50
50
  "prepublishOnly": "node ../scripts/smoke-pack.js --files-only",
51
- "postpublish": "node ../scripts/verify-published.js --named defineOneEntry --expect 1.0.165"
51
+ "postpublish": "node ../scripts/verify-published.js --named defineOneEntry --expect 1.0.167"
52
52
  },
53
53
  "sideEffects": false,
54
54
  "files": [