oneentry 1.0.166 → 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.
- package/README.md +5 -1
- package/changelog.md +28 -0
- package/dist/base/utils.d.ts +5 -2
- package/dist/base/validation.d.ts +7 -5
- package/dist/base/validation.js +7 -4
- package/dist/file-uploading/fileUploadingApi.d.ts +27 -1
- package/dist/file-uploading/fileUploadingApi.js +42 -0
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +102 -1
- package/dist/file-uploading/fileUploadingSchemas.d.ts +73 -0
- package/dist/file-uploading/fileUploadingSchemas.js +47 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/orders/ordersApi.d.ts +14 -0
- package/dist/orders/ordersApi.js +19 -0
- package/dist/orders/ordersInterfaces.d.ts +11 -0
- package/dist/payments/paymentsApi.d.ts +14 -1
- package/dist/payments/paymentsApi.js +18 -0
- package/dist/payments/paymentsInterfaces.d.ts +43 -1
- package/dist/payments/paymentsSchemas.d.ts +32 -0
- package/dist/payments/paymentsSchemas.js +20 -1
- package/dist/types.d.ts +1 -0
- package/dist/user-groups/userGroupsApi.d.ts +81 -0
- package/dist/user-groups/userGroupsApi.js +145 -0
- package/dist/user-groups/userGroupsInterfaces.d.ts +100 -0
- package/dist/user-groups/userGroupsInterfaces.js +2 -0
- package/dist/user-groups/userGroupsSchemas.d.ts +55 -0
- package/dist/user-groups/userGroupsSchemas.js +35 -0
- package/esm/base/utils.d.ts +5 -2
- package/esm/base/validation.d.ts +7 -5
- package/esm/base/validation.js +7 -4
- package/esm/file-uploading/fileUploadingApi.d.ts +27 -1
- package/esm/file-uploading/fileUploadingApi.js +42 -0
- package/esm/file-uploading/fileUploadingInterfaces.d.ts +102 -1
- package/esm/file-uploading/fileUploadingSchemas.d.ts +73 -0
- package/esm/file-uploading/fileUploadingSchemas.js +46 -0
- package/esm/index.d.ts +4 -0
- package/esm/index.js +3 -0
- package/esm/orders/ordersApi.d.ts +14 -0
- package/esm/orders/ordersApi.js +19 -0
- package/esm/orders/ordersInterfaces.d.ts +11 -0
- package/esm/payments/paymentsApi.d.ts +14 -1
- package/esm/payments/paymentsApi.js +18 -0
- package/esm/payments/paymentsInterfaces.d.ts +43 -1
- package/esm/payments/paymentsSchemas.d.ts +32 -0
- package/esm/payments/paymentsSchemas.js +19 -0
- package/esm/types.d.ts +1 -0
- package/esm/user-groups/userGroupsApi.d.ts +81 -0
- package/esm/user-groups/userGroupsApi.js +106 -0
- package/esm/user-groups/userGroupsInterfaces.d.ts +100 -0
- package/esm/user-groups/userGroupsInterfaces.js +1 -0
- package/esm/user-groups/userGroupsSchemas.d.ts +55 -0
- package/esm/user-groups/userGroupsSchemas.js +32 -0
- package/package.json +2 -2
|
@@ -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.
|
|
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.
|
|
51
|
+
"postpublish": "node ../scripts/verify-published.js --named defineOneEntry --expect 1.0.167"
|
|
52
52
|
},
|
|
53
53
|
"sideEffects": false,
|
|
54
54
|
"files": [
|