oneentry 1.0.136 → 1.0.138

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 (109) hide show
  1. package/README.md +15 -3
  2. package/configure.js +27 -3
  3. package/dist/admins/adminsApi.d.ts +2 -2
  4. package/dist/admins/adminsApi.js +6 -3
  5. package/dist/admins/adminsInterfaces.d.ts +2 -2
  6. package/dist/admins/adminsSchemas.d.ts +30 -0
  7. package/dist/admins/adminsSchemas.js +27 -0
  8. package/dist/attribute-sets/attributeSetsApi.d.ts +8 -8
  9. package/dist/attribute-sets/attributeSetsApi.js +21 -12
  10. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +3 -3
  11. package/dist/attribute-sets/attributeSetsSchemas.d.ts +90 -0
  12. package/dist/attribute-sets/attributeSetsSchemas.js +74 -0
  13. package/dist/auth-provider/authProviderApi.d.ts +44 -41
  14. package/dist/auth-provider/authProviderApi.js +58 -48
  15. package/dist/auth-provider/authProviderSchemas.d.ts +137 -0
  16. package/dist/auth-provider/authProviderSchemas.js +85 -0
  17. package/dist/auth-provider/authProvidersInterfaces.d.ts +17 -67
  18. package/dist/base/asyncModules.d.ts +25 -15
  19. package/dist/base/asyncModules.js +65 -44
  20. package/dist/base/stateModule.d.ts +8 -0
  21. package/dist/base/stateModule.js +27 -11
  22. package/dist/base/syncModules.d.ts +18 -0
  23. package/dist/base/syncModules.js +93 -99
  24. package/dist/base/utils.d.ts +56 -10
  25. package/dist/base/validation.d.ts +118 -0
  26. package/dist/base/validation.js +132 -0
  27. package/dist/blocks/blocksApi.d.ts +10 -10
  28. package/dist/blocks/blocksApi.js +26 -21
  29. package/dist/blocks/blocksInterfaces.d.ts +2 -1
  30. package/dist/blocks/blocksSchemas.d.ts +187 -0
  31. package/dist/blocks/blocksSchemas.js +43 -0
  32. package/dist/events/eventsApi.d.ts +5 -5
  33. package/dist/events/eventsApi.js +5 -5
  34. package/dist/events/eventsInterfaces.d.ts +25 -15
  35. package/dist/file-uploading/fileUploadingApi.d.ts +6 -6
  36. package/dist/file-uploading/fileUploadingApi.js +10 -7
  37. package/dist/file-uploading/fileUploadingSchemas.d.ts +22 -0
  38. package/dist/file-uploading/fileUploadingSchemas.js +21 -0
  39. package/dist/forms/formsApi.d.ts +4 -4
  40. package/dist/forms/formsApi.js +11 -6
  41. package/dist/forms/formsInterfaces.d.ts +21 -8
  42. package/dist/forms/formsSchemas.d.ts +65 -0
  43. package/dist/forms/formsSchemas.js +36 -0
  44. package/dist/forms-data/formsDataApi.d.ts +10 -10
  45. package/dist/forms-data/formsDataApi.js +20 -13
  46. package/dist/forms-data/formsDataInterfaces.d.ts +26 -26
  47. package/dist/forms-data/formsDataSchemas.d.ts +115 -0
  48. package/dist/forms-data/formsDataSchemas.js +86 -0
  49. package/dist/general-types/generalTypesApi.d.ts +2 -2
  50. package/dist/general-types/generalTypesApi.js +6 -3
  51. package/dist/general-types/generalTypesSchemas.d.ts +50 -0
  52. package/dist/general-types/generalTypesSchemas.js +35 -0
  53. package/dist/index.d.ts +23 -1
  54. package/dist/integration-collections/integrationCollectionsApi.d.ts +17 -17
  55. package/dist/integration-collections/integrationCollectionsApi.js +42 -26
  56. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +84 -0
  57. package/dist/integration-collections/integrationCollectionsSchemas.js +63 -0
  58. package/dist/locales/localesApi.d.ts +2 -2
  59. package/dist/locales/localesApi.js +6 -3
  60. package/dist/locales/localesSchemas.d.ts +32 -0
  61. package/dist/locales/localesSchemas.js +26 -0
  62. package/dist/menus/menusApi.d.ts +2 -2
  63. package/dist/menus/menusApi.js +6 -3
  64. package/dist/menus/menusInterfaces.d.ts +2 -2
  65. package/dist/menus/menusSchemas.d.ts +16 -0
  66. package/dist/menus/menusSchemas.js +28 -0
  67. package/dist/orders/ordersApi.d.ts +12 -12
  68. package/dist/orders/ordersApi.js +25 -16
  69. package/dist/orders/ordersInterfaces.d.ts +5 -4
  70. package/dist/orders/ordersSchemas.d.ts +158 -0
  71. package/dist/orders/ordersSchemas.js +120 -0
  72. package/dist/pages/pagesApi.d.ts +22 -21
  73. package/dist/pages/pagesApi.js +107 -54
  74. package/dist/pages/pagesInterfaces.d.ts +15 -11
  75. package/dist/pages/pagesSchemas.d.ts +85 -0
  76. package/dist/pages/pagesSchemas.js +46 -0
  77. package/dist/payments/paymentsApi.d.ts +13 -13
  78. package/dist/payments/paymentsApi.js +25 -16
  79. package/dist/payments/paymentsInterfaces.d.ts +11 -5
  80. package/dist/payments/paymentsSchemas.d.ts +137 -0
  81. package/dist/payments/paymentsSchemas.js +78 -0
  82. package/dist/product-statuses/productStatusesApi.d.ts +6 -6
  83. package/dist/product-statuses/productStatusesApi.js +19 -9
  84. package/dist/product-statuses/productStatusesSchemas.d.ts +34 -0
  85. package/dist/product-statuses/productStatusesSchemas.js +30 -0
  86. package/dist/products/productsApi.d.ts +29 -28
  87. package/dist/products/productsApi.js +50 -36
  88. package/dist/products/productsInterfaces.d.ts +27 -22
  89. package/dist/products/productsSchemas.d.ts +212 -0
  90. package/dist/products/productsSchemas.js +85 -0
  91. package/dist/system/systemApi.d.ts +10 -10
  92. package/dist/system/systemApi.js +10 -10
  93. package/dist/templates/templatesApi.d.ts +6 -6
  94. package/dist/templates/templatesApi.js +17 -10
  95. package/dist/templates/templatesSchemas.d.ts +48 -0
  96. package/dist/templates/templatesSchemas.js +31 -0
  97. package/dist/templates-preview/templatesPreviewApi.d.ts +3 -3
  98. package/dist/templates-preview/templatesPreviewApi.js +10 -5
  99. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +1 -0
  100. package/dist/templates-preview/templatesPreviewSchemas.d.ts +83 -0
  101. package/dist/templates-preview/templatesPreviewSchemas.js +48 -0
  102. package/dist/users/usersApi.d.ts +18 -18
  103. package/dist/users/usersApi.js +26 -23
  104. package/dist/users/usersInterfaces.d.ts +10 -11
  105. package/dist/users/usersSchemas.d.ts +38 -0
  106. package/dist/users/usersSchemas.js +28 -0
  107. package/package.json +36 -12
  108. package/dist/config.d.ts +0 -13
  109. package/dist/config.js +0 -32
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UploadResponseSchema = exports.UploadingReturnSchema = void 0;
4
+ /**
5
+ * Validation schemas for FileUploading module
6
+ * @description Zod schemas for validating file uploading-related API responses
7
+ */
8
+ const zod_1 = require("zod");
9
+ /**
10
+ * Upload return schema
11
+ * Includes filename, downloadLink, and size
12
+ */
13
+ exports.UploadingReturnSchema = zod_1.z.object({
14
+ filename: zod_1.z.string(),
15
+ downloadLink: zod_1.z.string(),
16
+ size: zod_1.z.number(),
17
+ });
18
+ /**
19
+ * Upload response schema (array of upload results)
20
+ */
21
+ exports.UploadResponseSchema = zod_1.z.array(exports.UploadingReturnSchema);
@@ -26,8 +26,8 @@ export default class FormsApi extends AsyncModules implements IForms {
26
26
  * @param {string} [langCode] - Language code. Default: "en_US".
27
27
  * @param {number} [offset] - Parameter for pagination. Default: 0.
28
28
  * @param {number} [limit] - Parameter for pagination. Default: 30.
29
- * @returns {IFormsEntity[]} Returns array for all objects of type FormEntity.
30
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
29
+ * @returns {Promise<IFormsEntity[] | IError>} Returns array for all objects of type FormEntity.
30
+ * @throws {IError} When isShell=false and an error occurs during the fetch
31
31
  */
32
32
  getAllForms(langCode?: string, offset?: number, limit?: number): Promise<IFormsEntity[] | IError>;
33
33
  /**
@@ -35,8 +35,8 @@ export default class FormsApi extends AsyncModules implements IForms {
35
35
  * @handleName getFormByMarker
36
36
  * @param {string} marker - Marker of form. Example: "contact_form".
37
37
  * @param {string} [langCode] - Language code. Default: "en_US".
38
- * @returns {IFormsEntity} Returns object of type FormEntity.
39
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
38
+ * @returns {Promise<IFormsEntity | IError>} Returns object of type FormEntity.
39
+ * @throws {IError} When isShell=false and an error occurs during the fetch
40
40
  */
41
41
  getFormByMarker(marker: string, langCode?: string): Promise<IFormsEntity | IError>;
42
42
  }
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
7
+ const formsSchemas_1 = require("./formsSchemas");
7
8
  /**
8
9
  * Controllers for forms objects
9
10
  * @class FormsApi
@@ -29,24 +30,28 @@ class FormsApi extends asyncModules_1.default {
29
30
  * @param {string} [langCode] - Language code. Default: "en_US".
30
31
  * @param {number} [offset] - Parameter for pagination. Default: 0.
31
32
  * @param {number} [limit] - Parameter for pagination. Default: 30.
32
- * @returns {IFormsEntity[]} Returns array for all objects of type FormEntity.
33
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
33
+ * @returns {Promise<IFormsEntity[] | IError>} Returns array for all objects of type FormEntity.
34
+ * @throws {IError} When isShell=false and an error occurs during the fetch
34
35
  */
35
36
  async getAllForms(langCode = this.state.lang, offset = 0, limit = 30) {
36
37
  const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
37
- return this._dataPostProcess(result, langCode);
38
+ // Validate response if validation is enabled
39
+ const validated = this._validateResponse(result, formsSchemas_1.FormsResponseSchema);
40
+ return this._dataPostProcess(validated, langCode);
38
41
  }
39
42
  /**
40
43
  * Get one form by form marker.
41
44
  * @handleName getFormByMarker
42
45
  * @param {string} marker - Marker of form. Example: "contact_form".
43
46
  * @param {string} [langCode] - Language code. Default: "en_US".
44
- * @returns {IFormsEntity} Returns object of type FormEntity.
45
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
47
+ * @returns {Promise<IFormsEntity | IError>} Returns object of type FormEntity.
48
+ * @throws {IError} When isShell=false and an error occurs during the fetch
46
49
  */
47
50
  async getFormByMarker(marker, langCode = this.state.lang) {
48
51
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
49
- return this._dataPostProcess(result, langCode);
52
+ // Validate response if validation is enabled
53
+ const validated = this._validateResponse(result, formsSchemas_1.FormEntitySchema);
54
+ return this._dataPostProcess(validated, langCode);
50
55
  }
51
56
  }
52
57
  exports.default = FormsApi;
@@ -18,7 +18,7 @@ interface IForms {
18
18
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
19
19
  * @description This method retrieves all forms in the system.
20
20
  */
21
- getAllForms(langCode: string, offset?: number, limit?: number): Promise<IFormsEntity[] | IError>;
21
+ getAllForms(langCode?: string, offset?: number, limit?: number): Promise<IFormsEntity[] | IError>;
22
22
  /**
23
23
  * Retrieves a form by its marker.
24
24
  * @handleName getFormByMarker
@@ -28,7 +28,7 @@ interface IForms {
28
28
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
29
29
  * @description This method retrieves a form by its marker.
30
30
  */
31
- getFormByMarker(marker: string, langCode: string): Promise<IFormsEntity | IError>;
31
+ getFormByMarker(marker: string, langCode?: string): Promise<IFormsEntity | IError>;
32
32
  }
33
33
  /**
34
34
  * Represents the structure of a form page.
@@ -77,6 +77,7 @@ interface IFromPages {
77
77
  {
78
78
  "key": "value"
79
79
  }
80
+ * @property {Array<IFormConfig>} [moduleFormConfigs] - Module form configurations linked to the form.
80
81
  * @description This interface defines the structure of a form entity, including its identifiers, attributes, and processing data.
81
82
  */
82
83
  interface IFormsEntity {
@@ -96,24 +97,36 @@ interface IFormsEntity {
96
97
  * Represents the structure of a form configuration.
97
98
  * @interface IFormConfig
98
99
  * @property {number} id - The identifier of the form configuration. Example: 123.
100
+ * @property {string} [formIdentifier] - The form identifier (only in products/pages API). Example: "review".
99
101
  * @property {string} moduleIdentifier - The identifier of the module associated with the form configuration. Example: "module_identifier".
100
102
  * @property {boolean} isGlobal - Indicates whether the form configuration is global. Example: true.
101
103
  * @property {boolean} isClosed - Indicates whether the form configuration is closed. Example: true.
102
- * @property {boolean} viewOnlyUserData - Indicates whether the form configuration allows viewing user data. Example: true.
103
- * @property {boolean} commentOnlyUserData - Indicates whether the form configuration allows commenting on user data. Example: true.
104
- * @property {string[]} entityIdentifiers - An array of entity identifiers associated with the form configuration. Example: ["entity_identifier_1", "entity_identifier_2"].
105
- * @description This interface defines the structure of a form configuration, including its identifiers, module association, and entity identifiers.
104
+ * @property {boolean} [isModerate] - Indicates whether the form requires moderation (only in products/pages API). Example: false.
105
+ * @property {boolean} [viewOnlyUserData] - Indicates whether the form configuration allows viewing user data (used in forms API). Example: true.
106
+ * @property {boolean} [commentOnlyUserData] - Indicates whether the form configuration allows commenting on user data (used in forms API). Example: true.
107
+ * @property {boolean} [viewOnlyMyData] - Indicates whether the form configuration allows viewing my data (used in products/pages API). Example: false.
108
+ * @property {boolean} [commentOnlyMyData] - Indicates whether the form configuration allows commenting on my data (used in products/pages API). Example: false.
109
+ * @property {object[]} entityIdentifiers - An array of entity identifiers associated with the form configuration.
110
+ * @property {string} entityIdentifiers[].id - Entity identifier. Example: "catalog".
111
+ * @property {boolean} entityIdentifiers[].isNested - Indicates if entity is nested. Example: false.
112
+ * @property {string[]} [nestedEntityIdentifiers] - An array of nested entity identifier strings (only in products/pages API). Example: ["catalog"].
113
+ * @description This interface defines the structure of a form configuration, including its identifiers, module association, and entity identifiers. Different APIs return different field variants.
106
114
  */
107
115
  interface IFormConfig {
108
116
  id: number;
117
+ formIdentifier?: string;
109
118
  moduleIdentifier: string;
110
119
  isGlobal: boolean;
111
120
  isClosed: boolean;
112
- viewOnlyUserData: boolean;
113
- commentOnlyUserData: boolean;
121
+ isModerate?: boolean;
122
+ viewOnlyUserData?: boolean;
123
+ commentOnlyUserData?: boolean;
124
+ viewOnlyMyData?: boolean;
125
+ commentOnlyMyData?: boolean;
114
126
  entityIdentifiers: {
115
127
  id: string;
116
128
  isNested: boolean;
117
129
  }[];
130
+ nestedEntityIdentifiers?: string[];
118
131
  }
119
132
  export type { IFormConfig, IForms, IFormsEntity, IFromPages };
@@ -0,0 +1,65 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Form entity schema
4
+ * Includes all fields returned by the API
5
+ */
6
+ export declare const FormEntitySchema: z.ZodObject<{
7
+ id: z.ZodNumber;
8
+ identifier: z.ZodString;
9
+ localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
10
+ attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
11
+ version: z.ZodOptional<z.ZodNumber>;
12
+ processingPersonalData: z.ZodOptional<z.ZodBoolean>;
13
+ active: z.ZodOptional<z.ZodBoolean>;
14
+ isAuthenticated: z.ZodOptional<z.ZodBoolean>;
15
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
16
+ attributes: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
17
+ attributeSetId: z.ZodOptional<z.ZodNumber>;
18
+ position: z.ZodOptional<z.ZodNumber>;
19
+ processingType: z.ZodOptional<z.ZodString>;
20
+ templateId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
21
+ type: z.ZodOptional<z.ZodString>;
22
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
23
+ }, z.core.$strip>;
24
+ /**
25
+ * Forms response schema (array of forms)
26
+ */
27
+ export declare const FormsResponseSchema: z.ZodArray<z.ZodObject<{
28
+ id: z.ZodNumber;
29
+ identifier: z.ZodString;
30
+ localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
31
+ attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
32
+ version: z.ZodOptional<z.ZodNumber>;
33
+ processingPersonalData: z.ZodOptional<z.ZodBoolean>;
34
+ active: z.ZodOptional<z.ZodBoolean>;
35
+ isAuthenticated: z.ZodOptional<z.ZodBoolean>;
36
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
37
+ attributes: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
38
+ attributeSetId: z.ZodOptional<z.ZodNumber>;
39
+ position: z.ZodOptional<z.ZodNumber>;
40
+ processingType: z.ZodOptional<z.ZodString>;
41
+ templateId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
42
+ type: z.ZodOptional<z.ZodString>;
43
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
44
+ }, z.core.$strip>>;
45
+ /**
46
+ * Single form response schema
47
+ */
48
+ export declare const SingleFormSchema: z.ZodObject<{
49
+ id: z.ZodNumber;
50
+ identifier: z.ZodString;
51
+ localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
52
+ attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
53
+ version: z.ZodOptional<z.ZodNumber>;
54
+ processingPersonalData: z.ZodOptional<z.ZodBoolean>;
55
+ active: z.ZodOptional<z.ZodBoolean>;
56
+ isAuthenticated: z.ZodOptional<z.ZodBoolean>;
57
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
58
+ attributes: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
59
+ attributeSetId: z.ZodOptional<z.ZodNumber>;
60
+ position: z.ZodOptional<z.ZodNumber>;
61
+ processingType: z.ZodOptional<z.ZodString>;
62
+ templateId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
63
+ type: z.ZodOptional<z.ZodString>;
64
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
65
+ }, z.core.$strip>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SingleFormSchema = exports.FormsResponseSchema = exports.FormEntitySchema = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * Form entity schema
7
+ * Includes all fields returned by the API
8
+ */
9
+ exports.FormEntitySchema = zod_1.z.object({
10
+ id: zod_1.z.number(),
11
+ identifier: zod_1.z.string(),
12
+ localizeInfos: zod_1.z.union([zod_1.z.record(zod_1.z.string(), zod_1.z.any()), zod_1.z.array(zod_1.z.any())]),
13
+ attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
14
+ version: zod_1.z.number().optional(),
15
+ processingPersonalData: zod_1.z.boolean().optional(),
16
+ active: zod_1.z.boolean().optional(),
17
+ isAuthenticated: zod_1.z.boolean().optional(),
18
+ config: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
19
+ attributes: zod_1.z
20
+ .union([zod_1.z.array(zod_1.z.any()), zod_1.z.record(zod_1.z.string(), zod_1.z.any())])
21
+ .optional(),
22
+ attributeSetId: zod_1.z.number().optional(),
23
+ position: zod_1.z.number().optional(),
24
+ processingType: zod_1.z.string().optional(),
25
+ templateId: zod_1.z.number().nullable().optional(),
26
+ type: zod_1.z.string().optional(),
27
+ moduleFormConfigs: zod_1.z.array(zod_1.z.any()).optional(),
28
+ });
29
+ /**
30
+ * Forms response schema (array of forms)
31
+ */
32
+ exports.FormsResponseSchema = zod_1.z.array(exports.FormEntitySchema);
33
+ /**
34
+ * Single form response schema
35
+ */
36
+ exports.SingleFormSchema = exports.FormEntitySchema;
@@ -54,8 +54,8 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
54
54
  * @param {string} body.formData[].type - The type of the form field. Example: "string".
55
55
  * @param {string} body.formData[].value - The value of the form field. Example: "Jack".
56
56
  * @param {string} [langCode] - Language code. Default: "en_US".
57
- * @returns {IPostFormResponse} Returns an object containing the created form data entry and message.
58
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
57
+ * @returns {Promise<IPostFormResponse | IError>} Returns an object containing the created form data entry and message.
58
+ * @throws {IError} When isShell=false and an error occurs during the fetch
59
59
  */
60
60
  postFormsData(body: IBodyPostFormData, langCode?: string): Promise<IPostFormResponse | IError>;
61
61
  /**
@@ -77,30 +77,30 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
77
77
  * @param {string} [langCode] - Language code. Default: "en_US".
78
78
  * @param {number} [offset] - Parameter for pagination. Default: 0.
79
79
  * @param {number} [limit] - Parameter for pagination. Default: 30.
80
- * @returns {IFormsByMarkerDataEntity} Returns an object containing the form data or an error object if there was an issue.
81
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
80
+ * @returns {Promise<IFormsByMarkerDataEntity | IError>} Returns an object containing the form data or an error object if there was an issue.
81
+ * @throws {IError} When isShell=false and an error occurs during the fetch
82
82
  */
83
83
  getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: object, isExtended?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsByMarkerDataEntity | IError>;
84
84
  /**
85
- * Update one object of form data by id.
85
+ * Update one object of form data by id. Requires user authentication.
86
86
  * @handleName updateFormsDataByid
87
87
  * @param {number} id - ID of the form data. Example: 1.
88
- * @returns {IUpdateFormsData | IError} Returns an object containing the updated form data or an error object if there was an issue.
88
+ * @returns {Promise<IUpdateFormsData | IError>} Returns an object containing the updated form data or an error object if there was an issue.
89
89
  */
90
90
  updateFormsDataByid(id: number, body?: object): Promise<IUpdateFormsData | IError>;
91
91
  /**
92
- * Update form data status by id.
92
+ * Update form data status by id. Requires user authentication.
93
93
  * @handleName updateFormsDataStatusByid
94
94
  * @param {number} id - ID of the form data. Example: 1.
95
95
  * @param {object} body - Request body.
96
- * @returns {boolean | IError} Returns an object containing the updated form data or an error object if there was an issue.
96
+ * @returns {Promise<boolean | IError>} Returns an object containing the updated form data or an error object if there was an issue.
97
97
  */
98
98
  updateFormsDataStatusByid(id: number, body?: object): Promise<boolean | IError>;
99
99
  /**
100
- * Delete one object of form data by id.
100
+ * Delete one object of form data by id. Requires user authentication.
101
101
  * @handleName deleteFormsDataByid
102
102
  * @param {number} id - ID of the form data. Example: 1.
103
- * @returns {boolean | IError} Returns an object containing the deleted form data or an error object if there was an issue.
103
+ * @returns {Promise<boolean | IError>} Returns an object containing the deleted form data or an error object if there was an issue.
104
104
  */
105
105
  deleteFormsDataByid(id: number): Promise<boolean | IError>;
106
106
  }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  /* eslint-disable @typescript-eslint/no-explicit-any */
7
7
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
8
8
  const fileUploadingApi_1 = __importDefault(require("../file-uploading/fileUploadingApi"));
9
+ const formsDataSchemas_1 = require("./formsDataSchemas");
9
10
  /**
10
11
  * Controllers for working with form data
11
12
  * @handle /api/content/form-data
@@ -59,8 +60,8 @@ class FormsDataApi extends asyncModules_1.default {
59
60
  * @param {string} body.formData[].type - The type of the form field. Example: "string".
60
61
  * @param {string} body.formData[].value - The value of the form field. Example: "Jack".
61
62
  * @param {string} [langCode] - Language code. Default: "en_US".
62
- * @returns {IPostFormResponse} Returns an object containing the created form data entry and message.
63
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
63
+ * @returns {Promise<IPostFormResponse | IError>} Returns an object containing the created form data entry and message.
64
+ * @throws {IError} When isShell=false and an error occurs during the fetch
64
65
  */
65
66
  async postFormsData(body, langCode = this.state.lang) {
66
67
  const formData = {};
@@ -119,7 +120,9 @@ class FormsDataApi extends asyncModules_1.default {
119
120
  }
120
121
  body.formData = formData;
121
122
  const result = await this._fetchPost(``, body);
122
- return this._dataPostProcess(result);
123
+ // Validate response if validation is enabled
124
+ const validated = this._validateResponse(result, formsDataSchemas_1.PostFormResponseSchema);
125
+ return this._dataPostProcess(validated);
123
126
  }
124
127
  /**
125
128
  * Get one object of form data by marker.
@@ -140,39 +143,43 @@ class FormsDataApi extends asyncModules_1.default {
140
143
  * @param {string} [langCode] - Language code. Default: "en_US".
141
144
  * @param {number} [offset] - Parameter for pagination. Default: 0.
142
145
  * @param {number} [limit] - Parameter for pagination. Default: 30.
143
- * @returns {IFormsByMarkerDataEntity} Returns an object containing the form data or an error object if there was an issue.
144
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
146
+ * @returns {Promise<IFormsByMarkerDataEntity | IError>} Returns an object containing the form data or an error object if there was an issue.
147
+ * @throws {IError} When isShell=false and an error occurs during the fetch
145
148
  */
146
149
  async getFormsDataByMarker(marker, formModuleConfigId, body = {}, isExtended = 0, langCode = this.state.lang, offset = 0, limit = 30) {
147
150
  const result = await this._fetchPost(`/marker/${marker}?formModuleConfigId=${formModuleConfigId}&isExtended=${isExtended}&langCode=${langCode}&offset=${offset}&limit=${limit}`, body);
148
- return this._dataPostProcess(result, langCode);
151
+ // Validate response if validation is enabled
152
+ const validated = this._validateResponse(result, formsDataSchemas_1.FormsByMarkerDataResponseSchema);
153
+ return this._dataPostProcess(validated, langCode);
149
154
  }
150
155
  /**
151
- * Update one object of form data by id.
156
+ * Update one object of form data by id. Requires user authentication.
152
157
  * @handleName updateFormsDataByid
153
158
  * @param {number} id - ID of the form data. Example: 1.
154
- * @returns {IUpdateFormsData | IError} Returns an object containing the updated form data or an error object if there was an issue.
159
+ * @returns {Promise<IUpdateFormsData | IError>} Returns an object containing the updated form data or an error object if there was an issue.
155
160
  */
156
161
  async updateFormsDataByid(id, body = {}) {
157
162
  const result = await this._fetchPut(`/${id}`, body);
158
- return result;
163
+ // Validate response if validation is enabled
164
+ const validated = this._validateResponse(result, formsDataSchemas_1.UpdateFormsDataSchema);
165
+ return validated;
159
166
  }
160
167
  /**
161
- * Update form data status by id.
168
+ * Update form data status by id. Requires user authentication.
162
169
  * @handleName updateFormsDataStatusByid
163
170
  * @param {number} id - ID of the form data. Example: 1.
164
171
  * @param {object} body - Request body.
165
- * @returns {boolean | IError} Returns an object containing the updated form data or an error object if there was an issue.
172
+ * @returns {Promise<boolean | IError>} Returns an object containing the updated form data or an error object if there was an issue.
166
173
  */
167
174
  async updateFormsDataStatusByid(id, body = {}) {
168
175
  const result = await this._fetchPut(`/${id}/update-status`, body);
169
176
  return result;
170
177
  }
171
178
  /**
172
- * Delete one object of form data by id.
179
+ * Delete one object of form data by id. Requires user authentication.
173
180
  * @handleName deleteFormsDataByid
174
181
  * @param {number} id - ID of the form data. Example: 1.
175
- * @returns {boolean | IError} Returns an object containing the deleted form data or an error object if there was an issue.
182
+ * @returns {Promise<boolean | IError>} Returns an object containing the deleted form data or an error object if there was an issue.
176
183
  */
177
184
  async deleteFormsDataByid(id) {
178
185
  const result = await this._fetchDelete(`/${id}`);
@@ -64,7 +64,7 @@ interface IFormsData {
64
64
  "dateFrom": "2025-08-11",
65
65
  "dateTo": ""
66
66
  }
67
- * @param {any} [isNested] - Flag for getting hierarchical data. Example: 1.
67
+ * @param {number} [isNested] - Flag for getting hierarchical data. Example: 1.
68
68
  * @param {string} [langCode] - The language code for localization. Default: "en_US".
69
69
  * @param {number} [offset] - Optional offset for pagination. Default: 0.
70
70
  * @param {number} [limit] - Optional limit for pagination. Default: 30.
@@ -90,7 +90,7 @@ interface IFormsData {
90
90
  }
91
91
  ]
92
92
  * @property {string | null} [attributeSetIdentifier] - Text identifier (marker) of the used attribute set. Example: "product_attributes".
93
- * @property {string | null} [actionMessage] - Action message for the form data. Example: "Form submitted successfully".
93
+ * @property {string} [moduleIdentifier] - Module identifier. Example: "blog".
94
94
  * @description This interface defines the structure of a form data entity, including its identifiers, form data, and optional attributes.
95
95
  */
96
96
  interface IFormDataEntity {
@@ -98,8 +98,8 @@ interface IFormDataEntity {
98
98
  formIdentifier: string;
99
99
  time: Date | string;
100
100
  formData: FormDataType[];
101
- attributeSetIdentifier?: string | null;
102
- actionMessage?: string | null;
101
+ attributeSetIdentifier: string | null;
102
+ moduleIdentifier?: string;
103
103
  }
104
104
  /**
105
105
  * Represents a collection of form data entities.
@@ -148,27 +148,27 @@ interface IFormsDataEntity {
148
148
  * @property {string} entityIdentifier - Text identifier (marker) of the entity. Example: "test".
149
149
  * @property {boolean} isUserAdmin - Is user admin. Example: true.
150
150
  * @property {number} formModuleConfigId - Form module config Id. Example: 2.
151
- * @property {number} moduleIdentifier - Form module config Id. Example: 2.
151
+ * @property {string} [moduleIdentifier] - Module identifier. Example: "blog".
152
152
  * @property {number} entityId - Form module config Id. Example: 2.
153
153
  * @description This interface defines the structure of a form data entity, including its identifiers, form data, and optional attributes.
154
154
  */
155
155
  interface IFormByMarkerDataEntity {
156
156
  id: number;
157
- parentId: null | number;
157
+ parentId?: null | number;
158
158
  formIdentifier: string;
159
- depth: number;
160
- ip: string | null;
161
- fingerprint: string | null;
162
- status: string | null;
163
- userIdentifier: string | null;
159
+ depth?: number;
160
+ ip?: string | null;
161
+ fingerprint?: string | null;
162
+ status?: string | null;
163
+ userIdentifier?: string | null;
164
164
  formData: FormDataType[];
165
- attributeSetIdentifier: string | null;
165
+ attributeSetIdentifier?: string | null;
166
166
  time: Date | string;
167
- entityIdentifier: string;
168
- isUserAdmin: boolean;
169
- formModuleConfigId: number;
170
- moduleIdentifier: string;
171
- entityId: number;
167
+ entityIdentifier?: string;
168
+ isUserAdmin?: boolean;
169
+ formModuleConfigId?: number;
170
+ moduleIdentifier?: string;
171
+ entityId?: number;
172
172
  }
173
173
  /**
174
174
  * Represents a collection of form data entities.
@@ -233,8 +233,8 @@ interface IFormsByMarkerDataEntity {
233
233
  * @property {string} formData.entityIdentifier - The entity identifier. Example: "blog".
234
234
  * @property {boolean} formData.isUserAdmin - Is user admin. Example: false.
235
235
  * @property {number} formData.formModuleId - The form module identifier. Example: 2.
236
- * @property {any} formData.parentId - The parent identifier. Example: null.
237
- * @property {any} formData.userIdentifier - The user identifier. Example: null.
236
+ * @property {string | null} formData.userIdentifier - The user identifier. Example: null.
237
+ * @property {number | null} formData.parentId - The parent identifier. Example: null.
238
238
  * @property {FormDataType[]} formData.formData - Form fields data.
239
239
  * @example
240
240
  [
@@ -256,8 +256,8 @@ interface IPostFormResponse {
256
256
  fingerprint: string;
257
257
  isUserAdmin: boolean;
258
258
  formModuleId: number;
259
- userIdentifier: any;
260
- parentId: any;
259
+ userIdentifier: string | null;
260
+ parentId: number | null;
261
261
  formData: FormDataType[];
262
262
  };
263
263
  }
@@ -270,8 +270,8 @@ interface IPostFormResponse {
270
270
  * @property {FormDataType[]} formData - Form fields data.
271
271
  * @property {string} userIdentifier - The user identifier. Example: null.
272
272
  * @property {string} entityIdentifier - The entity identifier. Example: "blog".
273
- * @property {any} parentId - The parent identifier. Example: null.
274
- * @property {string} fingerprint - The fingerprint of the form. Example: null.
273
+ * @property {null | number} parentId - The parent identifier. Example: null.
274
+ * @property {null | string} fingerprint - The fingerprint of the form. Example: null.
275
275
  * @property {boolean} isUserAdmin - Is user admin. Example: false.
276
276
  * @property {number} formModuleId - The form module identifier. Example: 2.
277
277
  */
@@ -308,9 +308,9 @@ type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeTe
308
308
  "value": "Jack"
309
309
  }
310
310
  ]
311
- * @property {string} formData[index].marker - The marker identifying the form field. Example: "name".
312
- * @property {string} formData[index].type - The type of the form field. Example: "string".
313
- * @property {string} formData[index].value - The value of the form field. Example: "name".
311
+ * @property {string} formData[].marker - The marker identifying the form field. Example: "name".
312
+ * @property {string} formData[].type - The type of the form field. Example: "string".
313
+ * @property {string} formData[].value - The value of the form field. Example: "name".
314
314
  * @property {IUploadingQuery} [fileQuery] - Optional file query for uploading files.
315
315
  * @example
316
316
  {
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Validation schemas for FormsData module
3
+ * @description Zod schemas for validating forms data-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Form data type schema (flexible structure)
8
+ */
9
+ export declare const FormDataTypeSchema: z.ZodUnion<readonly [z.ZodObject<{
10
+ marker: z.ZodString;
11
+ type: z.ZodString;
12
+ value: z.ZodAny;
13
+ }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
14
+ /**
15
+ * Form by marker data entity schema
16
+ */
17
+ export declare const FormByMarkerDataEntitySchema: z.ZodObject<{
18
+ id: z.ZodNumber;
19
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
20
+ formIdentifier: z.ZodString;
21
+ depth: z.ZodOptional<z.ZodNumber>;
22
+ ip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ userIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
+ formData: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
27
+ marker: z.ZodString;
28
+ type: z.ZodString;
29
+ value: z.ZodAny;
30
+ }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
31
+ marker: z.ZodString;
32
+ type: z.ZodString;
33
+ value: z.ZodAny;
34
+ }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>>]>;
35
+ attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ time: z.ZodUnion<readonly [z.ZodDate, z.ZodString]>;
37
+ entityIdentifier: z.ZodOptional<z.ZodString>;
38
+ isUserAdmin: z.ZodOptional<z.ZodBoolean>;
39
+ formModuleConfigId: z.ZodOptional<z.ZodNumber>;
40
+ moduleIdentifier: z.ZodOptional<z.ZodString>;
41
+ entityId: z.ZodOptional<z.ZodNumber>;
42
+ }, z.core.$strip>;
43
+ /**
44
+ * Forms by marker data response schema
45
+ */
46
+ export declare const FormsByMarkerDataResponseSchema: z.ZodObject<{
47
+ items: z.ZodArray<z.ZodObject<{
48
+ id: z.ZodNumber;
49
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
50
+ formIdentifier: z.ZodString;
51
+ depth: z.ZodOptional<z.ZodNumber>;
52
+ ip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
+ userIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
56
+ formData: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
57
+ marker: z.ZodString;
58
+ type: z.ZodString;
59
+ value: z.ZodAny;
60
+ }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
61
+ marker: z.ZodString;
62
+ type: z.ZodString;
63
+ value: z.ZodAny;
64
+ }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>>]>;
65
+ attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
+ time: z.ZodUnion<readonly [z.ZodDate, z.ZodString]>;
67
+ entityIdentifier: z.ZodOptional<z.ZodString>;
68
+ isUserAdmin: z.ZodOptional<z.ZodBoolean>;
69
+ formModuleConfigId: z.ZodOptional<z.ZodNumber>;
70
+ moduleIdentifier: z.ZodOptional<z.ZodString>;
71
+ entityId: z.ZodOptional<z.ZodNumber>;
72
+ }, z.core.$strip>>;
73
+ total: z.ZodNumber;
74
+ }, z.core.$strip>;
75
+ /**
76
+ * Post form response schema
77
+ */
78
+ export declare const PostFormResponseSchema: z.ZodObject<{
79
+ actionMessage: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>;
80
+ formData: z.ZodObject<{
81
+ id: z.ZodNumber;
82
+ formIdentifier: z.ZodString;
83
+ time: z.ZodString;
84
+ entityIdentifier: z.ZodString;
85
+ fingerprint: z.ZodString;
86
+ isUserAdmin: z.ZodBoolean;
87
+ formModuleId: z.ZodNumber;
88
+ userIdentifier: z.ZodAny;
89
+ parentId: z.ZodAny;
90
+ formData: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
91
+ marker: z.ZodString;
92
+ type: z.ZodString;
93
+ value: z.ZodAny;
94
+ }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
95
+ }, z.core.$strip>;
96
+ }, z.core.$strip>;
97
+ /**
98
+ * Update forms data response schema
99
+ */
100
+ export declare const UpdateFormsDataSchema: z.ZodObject<{
101
+ id: z.ZodNumber;
102
+ formIdentifier: z.ZodString;
103
+ time: z.ZodString;
104
+ formData: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
105
+ marker: z.ZodString;
106
+ type: z.ZodString;
107
+ value: z.ZodAny;
108
+ }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
109
+ userIdentifier: z.ZodString;
110
+ entityIdentifier: z.ZodString;
111
+ parentId: z.ZodNullable<z.ZodNumber>;
112
+ fingerprint: z.ZodNullable<z.ZodString>;
113
+ isUserAdmin: z.ZodBoolean;
114
+ formModuleId: z.ZodNumber;
115
+ }, z.core.$strip>;