oneentry 1.0.136 → 1.0.137

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 (83) hide show
  1. package/README.md +15 -3
  2. package/configure.js +27 -3
  3. package/dist/admins/adminsApi.js +4 -1
  4. package/dist/admins/adminsInterfaces.d.ts +1 -1
  5. package/dist/admins/adminsSchemas.d.ts +30 -0
  6. package/dist/admins/adminsSchemas.js +27 -0
  7. package/dist/attribute-sets/attributeSetsApi.js +13 -4
  8. package/dist/attribute-sets/attributeSetsSchemas.d.ts +90 -0
  9. package/dist/attribute-sets/attributeSetsSchemas.js +74 -0
  10. package/dist/auth-provider/authProviderApi.d.ts +11 -8
  11. package/dist/auth-provider/authProviderApi.js +25 -15
  12. package/dist/auth-provider/authProviderSchemas.d.ts +137 -0
  13. package/dist/auth-provider/authProviderSchemas.js +85 -0
  14. package/dist/auth-provider/authProvidersInterfaces.d.ts +6 -6
  15. package/dist/base/asyncModules.d.ts +25 -15
  16. package/dist/base/asyncModules.js +91 -24
  17. package/dist/base/stateModule.d.ts +7 -0
  18. package/dist/base/stateModule.js +26 -11
  19. package/dist/base/syncModules.d.ts +12 -0
  20. package/dist/base/syncModules.js +45 -94
  21. package/dist/base/utils.d.ts +41 -2
  22. package/dist/base/validation.d.ts +118 -0
  23. package/dist/base/validation.js +132 -0
  24. package/dist/blocks/blocksApi.js +16 -11
  25. package/dist/blocks/blocksInterfaces.d.ts +1 -1
  26. package/dist/blocks/blocksSchemas.d.ts +187 -0
  27. package/dist/blocks/blocksSchemas.js +43 -0
  28. package/dist/config.d.ts +10 -2
  29. package/dist/config.js +20 -4
  30. package/dist/file-uploading/fileUploadingApi.js +4 -1
  31. package/dist/file-uploading/fileUploadingSchemas.d.ts +22 -0
  32. package/dist/file-uploading/fileUploadingSchemas.js +21 -0
  33. package/dist/forms/formsApi.js +7 -2
  34. package/dist/forms/formsInterfaces.d.ts +20 -8
  35. package/dist/forms/formsSchemas.d.ts +65 -0
  36. package/dist/forms/formsSchemas.js +36 -0
  37. package/dist/forms-data/formsDataApi.js +10 -3
  38. package/dist/forms-data/formsDataInterfaces.d.ts +2 -2
  39. package/dist/forms-data/formsDataSchemas.d.ts +107 -0
  40. package/dist/forms-data/formsDataSchemas.js +83 -0
  41. package/dist/general-types/generalTypesApi.js +4 -1
  42. package/dist/general-types/generalTypesSchemas.d.ts +50 -0
  43. package/dist/general-types/generalTypesSchemas.js +35 -0
  44. package/dist/integration-collections/integrationCollectionsApi.js +25 -9
  45. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +84 -0
  46. package/dist/integration-collections/integrationCollectionsSchemas.js +63 -0
  47. package/dist/locales/localesApi.js +4 -1
  48. package/dist/locales/localesSchemas.d.ts +32 -0
  49. package/dist/locales/localesSchemas.js +26 -0
  50. package/dist/menus/menusApi.js +4 -1
  51. package/dist/menus/menusSchemas.d.ts +16 -0
  52. package/dist/menus/menusSchemas.js +28 -0
  53. package/dist/orders/ordersApi.js +13 -4
  54. package/dist/orders/ordersInterfaces.d.ts +3 -3
  55. package/dist/orders/ordersSchemas.d.ts +158 -0
  56. package/dist/orders/ordersSchemas.js +120 -0
  57. package/dist/pages/pagesApi.d.ts +2 -1
  58. package/dist/pages/pagesApi.js +87 -34
  59. package/dist/pages/pagesInterfaces.d.ts +6 -5
  60. package/dist/pages/pagesSchemas.d.ts +85 -0
  61. package/dist/pages/pagesSchemas.js +46 -0
  62. package/dist/payments/paymentsApi.js +13 -4
  63. package/dist/payments/paymentsInterfaces.d.ts +3 -3
  64. package/dist/payments/paymentsSchemas.d.ts +121 -0
  65. package/dist/payments/paymentsSchemas.js +75 -0
  66. package/dist/product-statuses/productStatusesApi.js +13 -3
  67. package/dist/product-statuses/productStatusesSchemas.d.ts +34 -0
  68. package/dist/product-statuses/productStatusesSchemas.js +30 -0
  69. package/dist/products/productsApi.js +19 -6
  70. package/dist/products/productsInterfaces.d.ts +4 -4
  71. package/dist/products/productsSchemas.d.ts +212 -0
  72. package/dist/products/productsSchemas.js +85 -0
  73. package/dist/templates/templatesApi.js +11 -4
  74. package/dist/templates/templatesSchemas.d.ts +48 -0
  75. package/dist/templates/templatesSchemas.js +31 -0
  76. package/dist/templates-preview/templatesPreviewApi.js +7 -2
  77. package/dist/templates-preview/templatesPreviewSchemas.d.ts +83 -0
  78. package/dist/templates-preview/templatesPreviewSchemas.js +48 -0
  79. package/dist/users/usersApi.js +8 -5
  80. package/dist/users/usersInterfaces.d.ts +2 -1
  81. package/dist/users/usersSchemas.d.ts +38 -0
  82. package/dist/users/usersSchemas.js +28 -0
  83. package/package.json +5 -4
@@ -0,0 +1,107 @@
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.ZodNullable<z.ZodNumber>;
20
+ formIdentifier: z.ZodString;
21
+ depth: z.ZodNumber;
22
+ ip: z.ZodNullable<z.ZodString>;
23
+ fingerprint: z.ZodNullable<z.ZodString>;
24
+ status: z.ZodNullable<z.ZodString>;
25
+ userIdentifier: z.ZodNullable<z.ZodString>;
26
+ formData: 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>]>>;
31
+ attributeSetIdentifier: z.ZodNullable<z.ZodString>;
32
+ time: z.ZodUnion<readonly [z.ZodDate, z.ZodString]>;
33
+ entityIdentifier: z.ZodString;
34
+ isUserAdmin: z.ZodBoolean;
35
+ formModuleConfigId: z.ZodNumber;
36
+ moduleIdentifier: z.ZodString;
37
+ entityId: z.ZodNumber;
38
+ }, z.core.$strip>;
39
+ /**
40
+ * Forms by marker data response schema
41
+ */
42
+ export declare const FormsByMarkerDataResponseSchema: z.ZodObject<{
43
+ items: z.ZodArray<z.ZodObject<{
44
+ id: z.ZodNumber;
45
+ parentId: z.ZodNullable<z.ZodNumber>;
46
+ formIdentifier: z.ZodString;
47
+ depth: z.ZodNumber;
48
+ ip: z.ZodNullable<z.ZodString>;
49
+ fingerprint: z.ZodNullable<z.ZodString>;
50
+ status: z.ZodNullable<z.ZodString>;
51
+ userIdentifier: z.ZodNullable<z.ZodString>;
52
+ formData: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
53
+ marker: z.ZodString;
54
+ type: z.ZodString;
55
+ value: z.ZodAny;
56
+ }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
57
+ attributeSetIdentifier: z.ZodNullable<z.ZodString>;
58
+ time: z.ZodUnion<readonly [z.ZodDate, z.ZodString]>;
59
+ entityIdentifier: z.ZodString;
60
+ isUserAdmin: z.ZodBoolean;
61
+ formModuleConfigId: z.ZodNumber;
62
+ moduleIdentifier: z.ZodString;
63
+ entityId: z.ZodNumber;
64
+ }, z.core.$strip>>;
65
+ total: z.ZodNumber;
66
+ }, z.core.$strip>;
67
+ /**
68
+ * Post form response schema
69
+ */
70
+ export declare const PostFormResponseSchema: z.ZodObject<{
71
+ actionMessage: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>;
72
+ formData: z.ZodObject<{
73
+ id: z.ZodNumber;
74
+ formIdentifier: z.ZodString;
75
+ time: z.ZodString;
76
+ entityIdentifier: z.ZodString;
77
+ fingerprint: z.ZodString;
78
+ isUserAdmin: z.ZodBoolean;
79
+ formModuleId: z.ZodNumber;
80
+ userIdentifier: z.ZodAny;
81
+ parentId: z.ZodAny;
82
+ formData: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
83
+ marker: z.ZodString;
84
+ type: z.ZodString;
85
+ value: z.ZodAny;
86
+ }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
87
+ }, z.core.$strip>;
88
+ }, z.core.$strip>;
89
+ /**
90
+ * Update forms data response schema
91
+ */
92
+ export declare const UpdateFormsDataSchema: z.ZodObject<{
93
+ id: z.ZodNumber;
94
+ formIdentifier: z.ZodString;
95
+ time: z.ZodString;
96
+ formData: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
97
+ marker: z.ZodString;
98
+ type: z.ZodString;
99
+ value: z.ZodAny;
100
+ }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
101
+ userIdentifier: z.ZodString;
102
+ entityIdentifier: z.ZodString;
103
+ parentId: z.ZodNullable<z.ZodNumber>;
104
+ fingerprint: z.ZodNullable<z.ZodString>;
105
+ isUserAdmin: z.ZodBoolean;
106
+ formModuleId: z.ZodNumber;
107
+ }, z.core.$strip>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateFormsDataSchema = exports.PostFormResponseSchema = exports.FormsByMarkerDataResponseSchema = exports.FormByMarkerDataEntitySchema = exports.FormDataTypeSchema = void 0;
4
+ /**
5
+ * Validation schemas for FormsData module
6
+ * @description Zod schemas for validating forms data-related API responses
7
+ */
8
+ const zod_1 = require("zod");
9
+ /**
10
+ * Form data type schema (flexible structure)
11
+ */
12
+ exports.FormDataTypeSchema = zod_1.z.union([
13
+ zod_1.z.object({
14
+ marker: zod_1.z.string(),
15
+ type: zod_1.z.string(),
16
+ value: zod_1.z.any(),
17
+ }),
18
+ zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
19
+ ]);
20
+ /**
21
+ * Form by marker data entity schema
22
+ */
23
+ exports.FormByMarkerDataEntitySchema = zod_1.z.object({
24
+ id: zod_1.z.number(),
25
+ parentId: zod_1.z.number().nullable(),
26
+ formIdentifier: zod_1.z.string(),
27
+ depth: zod_1.z.number(),
28
+ ip: zod_1.z.string().nullable(),
29
+ fingerprint: zod_1.z.string().nullable(),
30
+ status: zod_1.z.string().nullable(),
31
+ userIdentifier: zod_1.z.string().nullable(),
32
+ formData: zod_1.z.array(exports.FormDataTypeSchema),
33
+ attributeSetIdentifier: zod_1.z.string().nullable(),
34
+ time: zod_1.z.union([zod_1.z.date(), zod_1.z.string()]),
35
+ entityIdentifier: zod_1.z.string(),
36
+ isUserAdmin: zod_1.z.boolean(),
37
+ formModuleConfigId: zod_1.z.number(),
38
+ moduleIdentifier: zod_1.z.string(),
39
+ entityId: zod_1.z.number(),
40
+ });
41
+ /**
42
+ * Forms by marker data response schema
43
+ */
44
+ exports.FormsByMarkerDataResponseSchema = zod_1.z.object({
45
+ items: zod_1.z.array(exports.FormByMarkerDataEntitySchema),
46
+ total: zod_1.z.number(),
47
+ });
48
+ /**
49
+ * Post form response schema
50
+ */
51
+ exports.PostFormResponseSchema = zod_1.z.object({
52
+ actionMessage: zod_1.z.union([zod_1.z.string(), zod_1.z.record(zod_1.z.string(), zod_1.z.any())]),
53
+ formData: zod_1.z.object({
54
+ id: zod_1.z.number(),
55
+ formIdentifier: zod_1.z.string(),
56
+ time: zod_1.z.string(),
57
+ entityIdentifier: zod_1.z.string(),
58
+ fingerprint: zod_1.z.string(),
59
+ isUserAdmin: zod_1.z.boolean(),
60
+ formModuleId: zod_1.z.number(),
61
+ userIdentifier: zod_1.z.any(),
62
+ parentId: zod_1.z.any(),
63
+ formData: zod_1.z.union([
64
+ zod_1.z.array(exports.FormDataTypeSchema),
65
+ zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
66
+ ]),
67
+ }),
68
+ });
69
+ /**
70
+ * Update forms data response schema
71
+ */
72
+ exports.UpdateFormsDataSchema = zod_1.z.object({
73
+ id: zod_1.z.number(),
74
+ formIdentifier: zod_1.z.string(),
75
+ time: zod_1.z.string(),
76
+ formData: zod_1.z.array(exports.FormDataTypeSchema),
77
+ userIdentifier: zod_1.z.string(),
78
+ entityIdentifier: zod_1.z.string(),
79
+ parentId: zod_1.z.number().nullable(),
80
+ fingerprint: zod_1.z.string().nullable(),
81
+ isUserAdmin: zod_1.z.boolean(),
82
+ formModuleId: zod_1.z.number(),
83
+ });
@@ -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 generalTypesSchemas_1 = require("./generalTypesSchemas");
7
8
  /**
8
9
  * Controllers for working with types
9
10
  * @handle /api/content/general-types
@@ -29,7 +30,9 @@ class GeneralTypesApi extends asyncModules_1.default {
29
30
  */
30
31
  async getAllTypes() {
31
32
  const result = await this._fetchGet('');
32
- return result;
33
+ // Validate response if validation is enabled
34
+ const validated = this._validateResponse(result, generalTypesSchemas_1.GeneralTypesResponseSchema);
35
+ return validated;
33
36
  }
34
37
  }
35
38
  exports.default = GeneralTypesApi;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Validation schemas for GeneralTypes module
3
+ * @description Zod schemas for validating general types-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * General type entity schema
8
+ * Includes all fields returned by the API
9
+ */
10
+ export declare const GeneralTypeEntitySchema: z.ZodObject<{
11
+ id: z.ZodNumber;
12
+ type: z.ZodEnum<{
13
+ none: "none";
14
+ product: "product";
15
+ order: "order";
16
+ form: "form";
17
+ error_page: "error_page";
18
+ catalog_page: "catalog_page";
19
+ product_preview: "product_preview";
20
+ similar_products_block: "similar_products_block";
21
+ product_block: "product_block";
22
+ common_page: "common_page";
23
+ common_block: "common_block";
24
+ service: "service";
25
+ external_page: "external_page";
26
+ discount: "discount";
27
+ }>;
28
+ }, z.core.$strip>;
29
+ /**
30
+ * General types response schema (array of general types)
31
+ */
32
+ export declare const GeneralTypesResponseSchema: z.ZodArray<z.ZodObject<{
33
+ id: z.ZodNumber;
34
+ type: z.ZodEnum<{
35
+ none: "none";
36
+ product: "product";
37
+ order: "order";
38
+ form: "form";
39
+ error_page: "error_page";
40
+ catalog_page: "catalog_page";
41
+ product_preview: "product_preview";
42
+ similar_products_block: "similar_products_block";
43
+ product_block: "product_block";
44
+ common_page: "common_page";
45
+ common_block: "common_block";
46
+ service: "service";
47
+ external_page: "external_page";
48
+ discount: "discount";
49
+ }>;
50
+ }, z.core.$strip>>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeneralTypesResponseSchema = exports.GeneralTypeEntitySchema = void 0;
4
+ /**
5
+ * Validation schemas for GeneralTypes module
6
+ * @description Zod schemas for validating general types-related API responses
7
+ */
8
+ const zod_1 = require("zod");
9
+ /**
10
+ * General type entity schema
11
+ * Includes all fields returned by the API
12
+ */
13
+ exports.GeneralTypeEntitySchema = zod_1.z.object({
14
+ id: zod_1.z.number(),
15
+ type: zod_1.z.enum([
16
+ 'product',
17
+ 'error_page',
18
+ 'catalog_page',
19
+ 'product_preview',
20
+ 'similar_products_block',
21
+ 'product_block',
22
+ 'form',
23
+ 'common_page',
24
+ 'common_block',
25
+ 'order',
26
+ 'service',
27
+ 'external_page',
28
+ 'discount',
29
+ 'none',
30
+ ]),
31
+ });
32
+ /**
33
+ * General types response schema (array of general types)
34
+ */
35
+ exports.GeneralTypesResponseSchema = zod_1.z.array(exports.GeneralTypeEntitySchema);
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  /* eslint-disable jsdoc/reject-any-type */
7
7
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
8
+ const integrationCollectionsSchemas_1 = require("./integrationCollectionsSchemas");
8
9
  /**
9
10
  * Controllers for working with attributes.
10
11
  * @handle /api/content/integration-collections
@@ -19,7 +20,6 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
19
20
  */
20
21
  constructor(state) {
21
22
  super(state);
22
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
23
  this._defaultQuery = {
24
24
  langCode: 'en_US',
25
25
  offset: 0,
@@ -49,7 +49,9 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
49
49
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
50
  const query = { ...this._defaultQuery, ...userQuery, langCode };
51
51
  const result = await this._fetchGet(`?` + this._queryParamsToString(query));
52
- return this._dataPostProcess(result, langCode);
52
+ // Validate response if validation is enabled
53
+ const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionsResponseSchema);
54
+ return this._dataPostProcess(validated, langCode);
53
55
  }
54
56
  /**
55
57
  * Get a single collection object by id.
@@ -61,7 +63,9 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
61
63
  */
62
64
  async getICollectionById(id, langCode = this.state.lang) {
63
65
  const result = await this._fetchGet(`/${id}?` + this._queryParamsToString({ langCode }));
64
- return this._dataPostProcess(result, langCode);
66
+ // Validate response if validation is enabled
67
+ const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionEntitySchema);
68
+ return this._dataPostProcess(validated, langCode);
65
69
  }
66
70
  /**
67
71
  * Get all records belonging to the collection by collection id.
@@ -91,7 +95,9 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
91
95
  ...userQuery,
92
96
  langCode,
93
97
  }));
94
- return this._dataPostProcess(result, langCode);
98
+ // Validate response if validation is enabled
99
+ const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionRowsResponseSchema);
100
+ return this._dataPostProcess(validated, langCode);
95
101
  }
96
102
  /**
97
103
  * Check for the existence of a text identifier (marker).
@@ -107,7 +113,9 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
107
113
  */
108
114
  async validateICollectionMarker(marker) {
109
115
  const result = await this._fetchGet(`/marker-validation/${marker}`);
110
- return this._dataPostProcess(result);
116
+ // Validate response if validation is enabled
117
+ const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionIsValidSchema);
118
+ return this._dataPostProcess(validated);
111
119
  }
112
120
  /**
113
121
  * Getting all records from the collection.
@@ -119,7 +127,9 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
119
127
  */
120
128
  async getICollectionRowsByMarker(marker, langCode = this.state.lang) {
121
129
  const result = await this._fetchGet(`/marker/${marker}/rows?langCode=${langCode}`);
122
- return this._dataPostProcess(result, langCode);
130
+ // Validate response if validation is enabled
131
+ const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionRowsResponseSchema);
132
+ return this._dataPostProcess(validated, langCode);
123
133
  }
124
134
  /**
125
135
  * Getting one record from the collection.
@@ -132,7 +142,9 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
132
142
  */
133
143
  async getICollectionRowByMarkerAndId(marker, id, langCode = this.state.lang) {
134
144
  const result = await this._fetchGet(`/marker/${marker}/rows/${id}?langCode=${langCode}`);
135
- return this._dataPostProcess(result, langCode);
145
+ // Validate response if validation is enabled
146
+ const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionRowSchema);
147
+ return this._dataPostProcess(validated, langCode);
136
148
  }
137
149
  /**
138
150
  * Create a record in the collection.
@@ -157,7 +169,9 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
157
169
  */
158
170
  async createICollectionRow(marker, body, langCode = this.state.lang) {
159
171
  const response = await this._fetchPost(`/marker/${marker}/rows?langCode=${langCode}`, body);
160
- return this._normalizeData(response, langCode);
172
+ // Validate response if validation is enabled
173
+ const validated = this._validateResponse(response, integrationCollectionsSchemas_1.CollectionRowSchema);
174
+ return this._normalizeData(validated, langCode);
161
175
  }
162
176
  /**
163
177
  * Edit a record in the collection.
@@ -185,7 +199,9 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
185
199
  */
186
200
  async updateICollectionRow(marker, id, body, langCode = this.state.lang) {
187
201
  const response = await this._fetchPut(`/marker/${marker}/rows/${id}?` + `langCode=${langCode}`, body);
188
- return this._normalizeData(response, langCode);
202
+ // Validate response if validation is enabled
203
+ const validated = this._validateResponse(response, integrationCollectionsSchemas_1.CollectionRowSchema);
204
+ return this._normalizeData(validated, langCode);
189
205
  }
190
206
  /**
191
207
  * Deletion of collection record object
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Validation schemas for IntegrationCollections module
3
+ * @description Zod schemas for validating integration collections-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Collection entity schema
8
+ */
9
+ export declare const CollectionEntitySchema: z.ZodObject<{
10
+ id: z.ZodNumber;
11
+ identifier: z.ZodNullable<z.ZodString>;
12
+ formId: z.ZodNullable<z.ZodNumber>;
13
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
14
+ attributeSetId: z.ZodNullable<z.ZodString>;
15
+ selectedAttributeMarkers: z.ZodNullable<z.ZodString>;
16
+ }, z.core.$strip>;
17
+ /**
18
+ * Collections response schema (array of collections)
19
+ */
20
+ export declare const CollectionsResponseSchema: z.ZodArray<z.ZodObject<{
21
+ id: z.ZodNumber;
22
+ identifier: z.ZodNullable<z.ZodString>;
23
+ formId: z.ZodNullable<z.ZodNumber>;
24
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
25
+ attributeSetId: z.ZodNullable<z.ZodString>;
26
+ selectedAttributeMarkers: z.ZodNullable<z.ZodString>;
27
+ }, z.core.$strip>>;
28
+ /**
29
+ * Collection form data schema
30
+ */
31
+ export declare const CollectionFormDataSchema: z.ZodObject<{
32
+ marker: z.ZodString;
33
+ type: z.ZodString;
34
+ value: z.ZodString;
35
+ }, z.core.$strip>;
36
+ /**
37
+ * Collection row schema
38
+ */
39
+ export declare const CollectionRowSchema: z.ZodObject<{
40
+ id: z.ZodNumber;
41
+ createdDate: z.ZodString;
42
+ updatedDate: z.ZodString;
43
+ collectionId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
44
+ formData: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
45
+ marker: z.ZodString;
46
+ type: z.ZodString;
47
+ value: z.ZodString;
48
+ }, z.core.$strip>>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
49
+ entityType: z.ZodNullable<z.ZodString>;
50
+ entityId: z.ZodNullable<z.ZodNumber>;
51
+ attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ total: z.ZodOptional<z.ZodString>;
53
+ langCode: z.ZodOptional<z.ZodString>;
54
+ formIdentifier: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strip>;
56
+ /**
57
+ * Collection rows response schema
58
+ */
59
+ export declare const CollectionRowsResponseSchema: z.ZodObject<{
60
+ items: z.ZodArray<z.ZodObject<{
61
+ id: z.ZodNumber;
62
+ createdDate: z.ZodString;
63
+ updatedDate: z.ZodString;
64
+ collectionId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
65
+ formData: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
66
+ marker: z.ZodString;
67
+ type: z.ZodString;
68
+ value: z.ZodString;
69
+ }, z.core.$strip>>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
70
+ entityType: z.ZodNullable<z.ZodString>;
71
+ entityId: z.ZodNullable<z.ZodNumber>;
72
+ attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
+ total: z.ZodOptional<z.ZodString>;
74
+ langCode: z.ZodOptional<z.ZodString>;
75
+ formIdentifier: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strip>>;
77
+ total: z.ZodNumber;
78
+ }, z.core.$strip>;
79
+ /**
80
+ * Collection is valid schema
81
+ */
82
+ export declare const CollectionIsValidSchema: z.ZodObject<{
83
+ valid: z.ZodBoolean;
84
+ }, z.core.$strip>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CollectionIsValidSchema = exports.CollectionRowsResponseSchema = exports.CollectionRowSchema = exports.CollectionFormDataSchema = exports.CollectionsResponseSchema = exports.CollectionEntitySchema = void 0;
4
+ /**
5
+ * Validation schemas for IntegrationCollections module
6
+ * @description Zod schemas for validating integration collections-related API responses
7
+ */
8
+ const zod_1 = require("zod");
9
+ /**
10
+ * Collection entity schema
11
+ */
12
+ exports.CollectionEntitySchema = zod_1.z.object({
13
+ id: zod_1.z.number(),
14
+ identifier: zod_1.z.string().nullable(),
15
+ formId: zod_1.z.number().nullable(),
16
+ localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
17
+ attributeSetId: zod_1.z.string().nullable(),
18
+ selectedAttributeMarkers: zod_1.z.string().nullable(),
19
+ });
20
+ /**
21
+ * Collections response schema (array of collections)
22
+ */
23
+ exports.CollectionsResponseSchema = zod_1.z.array(exports.CollectionEntitySchema);
24
+ /**
25
+ * Collection form data schema
26
+ */
27
+ exports.CollectionFormDataSchema = zod_1.z.object({
28
+ marker: zod_1.z.string(),
29
+ type: zod_1.z.string(),
30
+ value: zod_1.z.string(),
31
+ });
32
+ /**
33
+ * Collection row schema
34
+ */
35
+ exports.CollectionRowSchema = zod_1.z.object({
36
+ id: zod_1.z.number(),
37
+ createdDate: zod_1.z.string(),
38
+ updatedDate: zod_1.z.string(),
39
+ collectionId: zod_1.z.number().nullable().optional(),
40
+ formData: zod_1.z.union([
41
+ zod_1.z.array(exports.CollectionFormDataSchema),
42
+ zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
43
+ ]),
44
+ entityType: zod_1.z.string().nullable(),
45
+ entityId: zod_1.z.number().nullable(),
46
+ attributeSetIdentifier: zod_1.z.string().nullable().optional(),
47
+ total: zod_1.z.string().optional(),
48
+ langCode: zod_1.z.string().optional(),
49
+ formIdentifier: zod_1.z.string().optional(),
50
+ });
51
+ /**
52
+ * Collection rows response schema
53
+ */
54
+ exports.CollectionRowsResponseSchema = zod_1.z.object({
55
+ items: zod_1.z.array(exports.CollectionRowSchema),
56
+ total: zod_1.z.number(),
57
+ });
58
+ /**
59
+ * Collection is valid schema
60
+ */
61
+ exports.CollectionIsValidSchema = zod_1.z.object({
62
+ valid: zod_1.z.boolean(),
63
+ });
@@ -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 localesSchemas_1 = require("./localesSchemas");
7
8
  /**
8
9
  * Controllers for working with localizations (content language)
9
10
  * @handle /api/content/locales
@@ -28,7 +29,9 @@ class LocalesApi extends asyncModules_1.default {
28
29
  */
29
30
  async getLocales() {
30
31
  const result = await this._fetchGet('/active/all');
31
- return result;
32
+ // Validate response if validation is enabled
33
+ const validated = this._validateResponse(result, localesSchemas_1.LocalesResponseSchema);
34
+ return validated;
32
35
  }
33
36
  }
34
37
  exports.default = LocalesApi;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Validation schemas for Locales module
3
+ * @description Zod schemas for validating locales-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Locale entity schema
8
+ * Includes all fields returned by the API
9
+ */
10
+ export declare const LocaleEntitySchema: z.ZodObject<{
11
+ id: z.ZodNumber;
12
+ shortCode: z.ZodString;
13
+ code: z.ZodString;
14
+ name: z.ZodString;
15
+ nativeName: z.ZodString;
16
+ isActive: z.ZodBoolean;
17
+ image: z.ZodNullable<z.ZodString>;
18
+ position: z.ZodNumber;
19
+ }, z.core.$strip>;
20
+ /**
21
+ * Locales response schema (array of locales)
22
+ */
23
+ export declare const LocalesResponseSchema: z.ZodArray<z.ZodObject<{
24
+ id: z.ZodNumber;
25
+ shortCode: z.ZodString;
26
+ code: z.ZodString;
27
+ name: z.ZodString;
28
+ nativeName: z.ZodString;
29
+ isActive: z.ZodBoolean;
30
+ image: z.ZodNullable<z.ZodString>;
31
+ position: z.ZodNumber;
32
+ }, z.core.$strip>>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LocalesResponseSchema = exports.LocaleEntitySchema = void 0;
4
+ /**
5
+ * Validation schemas for Locales module
6
+ * @description Zod schemas for validating locales-related API responses
7
+ */
8
+ const zod_1 = require("zod");
9
+ /**
10
+ * Locale entity schema
11
+ * Includes all fields returned by the API
12
+ */
13
+ exports.LocaleEntitySchema = zod_1.z.object({
14
+ id: zod_1.z.number(),
15
+ shortCode: zod_1.z.string(),
16
+ code: zod_1.z.string(),
17
+ name: zod_1.z.string(),
18
+ nativeName: zod_1.z.string(),
19
+ isActive: zod_1.z.boolean(),
20
+ image: zod_1.z.string().nullable(),
21
+ position: zod_1.z.number(),
22
+ });
23
+ /**
24
+ * Locales response schema (array of locales)
25
+ */
26
+ exports.LocalesResponseSchema = zod_1.z.array(exports.LocaleEntitySchema);
@@ -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 menusSchemas_1 = require("./menusSchemas");
7
8
  /**
8
9
  * Controllers for working with menu objects
9
10
  * @handle /api/content/menus
@@ -30,7 +31,9 @@ class MenusApi extends asyncModules_1.default {
30
31
  */
31
32
  async getMenusByMarker(marker, langCode = this.state.lang) {
32
33
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
33
- return this._dataPostProcess(result, langCode);
34
+ // Validate response if validation is enabled
35
+ const validated = this._validateResponse(result, menusSchemas_1.MenuEntitySchema);
36
+ return this._dataPostProcess(validated, langCode);
34
37
  }
35
38
  }
36
39
  exports.default = MenusApi;
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Menu pages schema (recursive)
4
+ * Can have children that are also menu pages
5
+ */
6
+ export declare const MenusPagesSchema: z.ZodType<any>;
7
+ /**
8
+ * Menu entity schema
9
+ * Includes all fields returned by the API
10
+ */
11
+ export declare const MenuEntitySchema: z.ZodObject<{
12
+ id: z.ZodNumber;
13
+ identifier: z.ZodString;
14
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
15
+ pages: z.ZodUnion<readonly [z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>]>;
16
+ }, z.core.$strip>;