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,212 @@
1
+ /**
2
+ * Validation schemas for Products module
3
+ * @description Zod schemas for validating products-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Product price schema
8
+ */
9
+ export declare const ProductPriceSchema: z.ZodObject<{
10
+ value: z.ZodNumber;
11
+ currency: z.ZodString;
12
+ compareValue: z.ZodOptional<z.ZodNumber>;
13
+ }, z.core.$strip>;
14
+ /**
15
+ * Product image schema
16
+ */
17
+ export declare const ProductImageSchema: z.ZodObject<{
18
+ id: z.ZodNumber;
19
+ filename: z.ZodString;
20
+ url: z.ZodString;
21
+ size: z.ZodOptional<z.ZodNumber>;
22
+ type: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strip>;
24
+ /**
25
+ * Product entity schema
26
+ * Includes all fields returned by the API
27
+ */
28
+ export declare const ProductEntitySchema: z.ZodObject<{
29
+ id: z.ZodNumber;
30
+ identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
31
+ attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
+ localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
33
+ statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
34
+ isVisible: z.ZodOptional<z.ZodBoolean>;
35
+ statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
36
+ position: z.ZodOptional<z.ZodNumber>;
37
+ isPositionLocked: z.ZodOptional<z.ZodBoolean>;
38
+ templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
39
+ shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
40
+ price: z.ZodNullable<z.ZodNumber>;
41
+ additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
42
+ sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
43
+ isSync: z.ZodOptional<z.ZodBoolean>;
44
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
45
+ attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
46
+ productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
47
+ blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
49
+ currency: z.ZodOptional<z.ZodString>;
50
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
51
+ id: z.ZodNumber;
52
+ filename: z.ZodString;
53
+ url: z.ZodString;
54
+ size: z.ZodOptional<z.ZodNumber>;
55
+ type: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$strip>>>;
57
+ relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
58
+ pageId: z.ZodOptional<z.ZodNumber>;
59
+ }, z.core.$strip>;
60
+ /**
61
+ * Products response schema
62
+ */
63
+ export declare const ProductsResponseSchema: z.ZodObject<{
64
+ items: z.ZodArray<z.ZodObject<{
65
+ id: z.ZodNumber;
66
+ identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
67
+ attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
68
+ localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
69
+ statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
70
+ isVisible: z.ZodOptional<z.ZodBoolean>;
71
+ statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
72
+ position: z.ZodOptional<z.ZodNumber>;
73
+ isPositionLocked: z.ZodOptional<z.ZodBoolean>;
74
+ templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
75
+ shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
76
+ price: z.ZodNullable<z.ZodNumber>;
77
+ additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
78
+ sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
79
+ isSync: z.ZodOptional<z.ZodBoolean>;
80
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
+ attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
82
+ productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
83
+ blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
84
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
85
+ currency: z.ZodOptional<z.ZodString>;
86
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
87
+ id: z.ZodNumber;
88
+ filename: z.ZodString;
89
+ url: z.ZodString;
90
+ size: z.ZodOptional<z.ZodNumber>;
91
+ type: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$strip>>>;
93
+ relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
94
+ pageId: z.ZodOptional<z.ZodNumber>;
95
+ }, z.core.$strip>>;
96
+ total: z.ZodNumber;
97
+ }, z.core.$strip>;
98
+ /**
99
+ * Single product response schema
100
+ */
101
+ export declare const SingleProductSchema: z.ZodObject<{
102
+ id: z.ZodNumber;
103
+ identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
104
+ attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
105
+ localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
106
+ statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
107
+ isVisible: z.ZodOptional<z.ZodBoolean>;
108
+ statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
109
+ position: z.ZodOptional<z.ZodNumber>;
110
+ isPositionLocked: z.ZodOptional<z.ZodBoolean>;
111
+ templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
112
+ shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
113
+ price: z.ZodNullable<z.ZodNumber>;
114
+ additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
115
+ sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
116
+ isSync: z.ZodOptional<z.ZodBoolean>;
117
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
+ attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
119
+ productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
120
+ blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
121
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
122
+ currency: z.ZodOptional<z.ZodString>;
123
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
124
+ id: z.ZodNumber;
125
+ filename: z.ZodString;
126
+ url: z.ZodString;
127
+ size: z.ZodOptional<z.ZodNumber>;
128
+ type: z.ZodOptional<z.ZodString>;
129
+ }, z.core.$strip>>>;
130
+ relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
131
+ pageId: z.ZodOptional<z.ZodNumber>;
132
+ }, z.core.$strip>;
133
+ /**
134
+ * Products count schema
135
+ */
136
+ export declare const ProductsCountSchema: z.ZodObject<{
137
+ total: z.ZodNumber;
138
+ }, z.core.$strip>;
139
+ /**
140
+ * Product block schema
141
+ */
142
+ export declare const ProductBlockSchema: z.ZodObject<{
143
+ id: z.ZodNumber;
144
+ marker: z.ZodString;
145
+ products: z.ZodArray<z.ZodObject<{
146
+ id: z.ZodNumber;
147
+ identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
148
+ attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
149
+ localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
150
+ statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
151
+ isVisible: z.ZodOptional<z.ZodBoolean>;
152
+ statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
153
+ position: z.ZodOptional<z.ZodNumber>;
154
+ isPositionLocked: z.ZodOptional<z.ZodBoolean>;
155
+ templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
156
+ shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
157
+ price: z.ZodNullable<z.ZodNumber>;
158
+ additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
159
+ sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
160
+ isSync: z.ZodOptional<z.ZodBoolean>;
161
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
162
+ attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
163
+ productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
164
+ blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
165
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
166
+ currency: z.ZodOptional<z.ZodString>;
167
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
168
+ id: z.ZodNumber;
169
+ filename: z.ZodString;
170
+ url: z.ZodString;
171
+ size: z.ZodOptional<z.ZodNumber>;
172
+ type: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$strip>>>;
174
+ relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
175
+ pageId: z.ZodOptional<z.ZodNumber>;
176
+ }, z.core.$strip>>;
177
+ }, z.core.$strip>;
178
+ /**
179
+ * Related products schema
180
+ */
181
+ export declare const RelatedProductsSchema: z.ZodArray<z.ZodObject<{
182
+ id: z.ZodNumber;
183
+ identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
184
+ attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
185
+ localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
186
+ statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
187
+ isVisible: z.ZodOptional<z.ZodBoolean>;
188
+ statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
189
+ position: z.ZodOptional<z.ZodNumber>;
190
+ isPositionLocked: z.ZodOptional<z.ZodBoolean>;
191
+ templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
192
+ shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
193
+ price: z.ZodNullable<z.ZodNumber>;
194
+ additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
195
+ sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
196
+ isSync: z.ZodOptional<z.ZodBoolean>;
197
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
198
+ attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
199
+ productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
200
+ blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
201
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
202
+ currency: z.ZodOptional<z.ZodString>;
203
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
204
+ id: z.ZodNumber;
205
+ filename: z.ZodString;
206
+ url: z.ZodString;
207
+ size: z.ZodOptional<z.ZodNumber>;
208
+ type: z.ZodOptional<z.ZodString>;
209
+ }, z.core.$strip>>>;
210
+ relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
211
+ pageId: z.ZodOptional<z.ZodNumber>;
212
+ }, z.core.$strip>>;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RelatedProductsSchema = exports.ProductBlockSchema = exports.ProductsCountSchema = exports.SingleProductSchema = exports.ProductsResponseSchema = exports.ProductEntitySchema = exports.ProductImageSchema = exports.ProductPriceSchema = void 0;
4
+ /**
5
+ * Validation schemas for Products module
6
+ * @description Zod schemas for validating products-related API responses
7
+ */
8
+ const zod_1 = require("zod");
9
+ /**
10
+ * Product price schema
11
+ */
12
+ exports.ProductPriceSchema = zod_1.z.object({
13
+ value: zod_1.z.number(),
14
+ currency: zod_1.z.string(),
15
+ compareValue: zod_1.z.number().optional(),
16
+ });
17
+ /**
18
+ * Product image schema
19
+ */
20
+ exports.ProductImageSchema = zod_1.z.object({
21
+ id: zod_1.z.number(),
22
+ filename: zod_1.z.string(),
23
+ url: zod_1.z.string(),
24
+ size: zod_1.z.number().optional(),
25
+ type: zod_1.z.string().optional(),
26
+ });
27
+ /**
28
+ * Product entity schema
29
+ * Includes all fields returned by the API
30
+ */
31
+ exports.ProductEntitySchema = zod_1.z.object({
32
+ id: zod_1.z.number(),
33
+ identifier: zod_1.z.string().optional().nullable(),
34
+ attributeSetIdentifier: zod_1.z.string().optional().nullable(),
35
+ localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
36
+ statusLocalizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
37
+ isVisible: zod_1.z.boolean().optional(),
38
+ statusIdentifier: zod_1.z.string().optional().nullable(),
39
+ position: zod_1.z.number().optional(),
40
+ isPositionLocked: zod_1.z.boolean().optional(),
41
+ templateIdentifier: zod_1.z.string().optional().nullable(),
42
+ shortDescTemplateIdentifier: zod_1.z.string().optional().nullable(),
43
+ price: zod_1.z.number().nullable(),
44
+ additional: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
45
+ sku: zod_1.z.string().optional().nullable(),
46
+ isSync: zod_1.z.boolean().optional(),
47
+ categories: zod_1.z.array(zod_1.z.string()).optional(),
48
+ attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
49
+ productPages: zod_1.z.array(zod_1.z.any()).optional(),
50
+ blocks: zod_1.z.array(zod_1.z.string()).optional(),
51
+ moduleFormConfigs: zod_1.z.array(zod_1.z.any()).optional(),
52
+ currency: zod_1.z.string().optional(),
53
+ images: zod_1.z.array(exports.ProductImageSchema).optional(),
54
+ relatedProducts: zod_1.z.array(zod_1.z.number()).optional(),
55
+ pageId: zod_1.z.number().optional(),
56
+ });
57
+ /**
58
+ * Products response schema
59
+ */
60
+ exports.ProductsResponseSchema = zod_1.z.object({
61
+ items: zod_1.z.array(exports.ProductEntitySchema),
62
+ total: zod_1.z.number(),
63
+ });
64
+ /**
65
+ * Single product response schema
66
+ */
67
+ exports.SingleProductSchema = exports.ProductEntitySchema;
68
+ /**
69
+ * Products count schema
70
+ */
71
+ exports.ProductsCountSchema = zod_1.z.object({
72
+ total: zod_1.z.number(),
73
+ });
74
+ /**
75
+ * Product block schema
76
+ */
77
+ exports.ProductBlockSchema = zod_1.z.object({
78
+ id: zod_1.z.number(),
79
+ marker: zod_1.z.string(),
80
+ products: zod_1.z.array(exports.ProductEntitySchema),
81
+ });
82
+ /**
83
+ * Related products schema
84
+ */
85
+ exports.RelatedProductsSchema = zod_1.z.array(exports.ProductEntitySchema);
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  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
+ const templatesSchemas_1 = require("./templatesSchemas");
8
9
  /**
9
10
  * Controllers for working with template objects
10
11
  * @module TemplateController
@@ -31,10 +32,12 @@ class TemplatesPreviewApi extends asyncModules_1.default {
31
32
  */
32
33
  async getAllTemplates(langCode = this.state.lang) {
33
34
  const response = await this._fetchGet(`/all?langCode=${langCode}`);
35
+ // Validate response if validation is enabled
36
+ const validated = this._validateResponse(response, templatesSchemas_1.GroupedTemplatesResponseSchema);
34
37
  const result = {};
35
38
  // eslint-disable-next-line no-restricted-syntax
36
- for (const item in response) {
37
- result[item] = this._normalizeData(response[item], langCode);
39
+ for (const item in validated) {
40
+ result[item] = this._normalizeData(validated[item], langCode);
38
41
  }
39
42
  return result;
40
43
  }
@@ -49,7 +52,9 @@ class TemplatesPreviewApi extends asyncModules_1.default {
49
52
  */
50
53
  async getTemplateByType(type, langCode = this.state.lang) {
51
54
  const result = await this._fetchGet(`?type=${type}&langCode=${langCode}`);
52
- return this._normalizeData(result);
55
+ // Validate response if validation is enabled
56
+ const validated = this._validateResponse(result, templatesSchemas_1.TemplatesResponseSchema);
57
+ return this._normalizeData(validated);
53
58
  }
54
59
  /**
55
60
  * Get one template object by marker.
@@ -62,7 +67,9 @@ class TemplatesPreviewApi extends asyncModules_1.default {
62
67
  */
63
68
  async getTemplateByMarker(marker, langCode = this.state.lang) {
64
69
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
65
- return this._normalizeData(result);
70
+ // Validate response if validation is enabled
71
+ const validated = this._validateResponse(result, templatesSchemas_1.TemplateEntitySchema);
72
+ return this._normalizeData(validated);
66
73
  }
67
74
  }
68
75
  exports.default = TemplatesPreviewApi;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Validation schemas for Templates module
3
+ * @description Zod schemas for validating templates-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Template entity schema
8
+ * Includes all fields returned by the API
9
+ */
10
+ export declare const TemplateEntitySchema: z.ZodObject<{
11
+ id: z.ZodNumber;
12
+ attributeSetIdentifier: z.ZodNullable<z.ZodString>;
13
+ title: z.ZodString;
14
+ generalTypeId: z.ZodNumber;
15
+ identifier: z.ZodString;
16
+ version: z.ZodNumber;
17
+ generalTypeName: z.ZodString;
18
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
19
+ position: z.ZodNumber;
20
+ }, z.core.$strip>;
21
+ /**
22
+ * Templates response schema (array of templates)
23
+ */
24
+ export declare const TemplatesResponseSchema: z.ZodArray<z.ZodObject<{
25
+ id: z.ZodNumber;
26
+ attributeSetIdentifier: z.ZodNullable<z.ZodString>;
27
+ title: z.ZodString;
28
+ generalTypeId: z.ZodNumber;
29
+ identifier: z.ZodString;
30
+ version: z.ZodNumber;
31
+ generalTypeName: z.ZodString;
32
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
33
+ position: z.ZodNumber;
34
+ }, z.core.$strip>>;
35
+ /**
36
+ * Grouped templates response schema (by type)
37
+ */
38
+ export declare const GroupedTemplatesResponseSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
39
+ id: z.ZodNumber;
40
+ attributeSetIdentifier: z.ZodNullable<z.ZodString>;
41
+ title: z.ZodString;
42
+ generalTypeId: z.ZodNumber;
43
+ identifier: z.ZodString;
44
+ version: z.ZodNumber;
45
+ generalTypeName: z.ZodString;
46
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
47
+ position: z.ZodNumber;
48
+ }, z.core.$strip>>>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GroupedTemplatesResponseSchema = exports.TemplatesResponseSchema = exports.TemplateEntitySchema = void 0;
4
+ /**
5
+ * Validation schemas for Templates module
6
+ * @description Zod schemas for validating templates-related API responses
7
+ */
8
+ const zod_1 = require("zod");
9
+ /**
10
+ * Template entity schema
11
+ * Includes all fields returned by the API
12
+ */
13
+ exports.TemplateEntitySchema = zod_1.z.object({
14
+ id: zod_1.z.number(),
15
+ attributeSetIdentifier: zod_1.z.string().nullable(),
16
+ title: zod_1.z.string(),
17
+ generalTypeId: zod_1.z.number(),
18
+ identifier: zod_1.z.string(),
19
+ version: zod_1.z.number(),
20
+ generalTypeName: zod_1.z.string(),
21
+ attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
22
+ position: zod_1.z.number(),
23
+ });
24
+ /**
25
+ * Templates response schema (array of templates)
26
+ */
27
+ exports.TemplatesResponseSchema = zod_1.z.array(exports.TemplateEntitySchema);
28
+ /**
29
+ * Grouped templates response schema (by type)
30
+ */
31
+ exports.GroupedTemplatesResponseSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.array(exports.TemplateEntitySchema));
@@ -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 templatesPreviewSchemas_1 = require("./templatesPreviewSchemas");
7
8
  /**
8
9
  * Controllers for working with template objects for preview.
9
10
  * @handle /api/content/template-previews
@@ -29,7 +30,9 @@ class TemplatePreviewsApi extends asyncModules_1.default {
29
30
  */
30
31
  async getTemplatePreviews(langCode = this.state.lang) {
31
32
  const result = await this._fetchGet(`?langCode=${langCode}`);
32
- return this._normalizeData(result, langCode);
33
+ // Validate response if validation is enabled
34
+ const validated = this._validateResponse(result, templatesPreviewSchemas_1.TemplatePreviewsResponseSchema);
35
+ return this._normalizeData(validated, langCode);
33
36
  }
34
37
  /**
35
38
  * Retrieves a template object by its marker.
@@ -42,7 +45,9 @@ class TemplatePreviewsApi extends asyncModules_1.default {
42
45
  */
43
46
  async getTemplatePreviewByMarker(marker, langCode = this.state.lang) {
44
47
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
45
- return this._normalizeData(result, langCode);
48
+ // Validate response if validation is enabled
49
+ const validated = this._validateResponse(result, templatesPreviewSchemas_1.TemplatePreviewEntitySchema);
50
+ return this._normalizeData(validated, langCode);
46
51
  }
47
52
  }
48
53
  exports.default = TemplatePreviewsApi;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Validation schemas for TemplatesPreviews module
3
+ * @description Zod schemas for validating templates previews-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Proportion schema
8
+ */
9
+ export declare const ProportionSchema: z.ZodObject<{
10
+ width: z.ZodNullable<z.ZodNumber>;
11
+ height: z.ZodNullable<z.ZodNumber>;
12
+ alignmentType: z.ZodString;
13
+ }, z.core.$strip>;
14
+ /**
15
+ * Square schema
16
+ */
17
+ export declare const SquareSchema: z.ZodObject<{
18
+ side: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
19
+ alignmentType: z.ZodString;
20
+ }, z.core.$strip>;
21
+ /**
22
+ * Template preview entity schema
23
+ * Includes all fields returned by the API
24
+ */
25
+ export declare const TemplatePreviewEntitySchema: z.ZodObject<{
26
+ id: z.ZodNumber;
27
+ title: z.ZodString;
28
+ proportions: z.ZodObject<{
29
+ default: z.ZodObject<{
30
+ horizontal: z.ZodNullable<z.ZodObject<{
31
+ width: z.ZodNullable<z.ZodNumber>;
32
+ height: z.ZodNullable<z.ZodNumber>;
33
+ alignmentType: z.ZodString;
34
+ }, z.core.$strip>>;
35
+ vertical: z.ZodNullable<z.ZodObject<{
36
+ width: z.ZodNullable<z.ZodNumber>;
37
+ height: z.ZodNullable<z.ZodNumber>;
38
+ alignmentType: z.ZodString;
39
+ }, z.core.$strip>>;
40
+ square: z.ZodObject<{
41
+ side: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
42
+ alignmentType: z.ZodString;
43
+ }, z.core.$strip>;
44
+ }, z.core.$strip>;
45
+ }, z.core.$strip>;
46
+ identifier: z.ZodString;
47
+ version: z.ZodNumber;
48
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
49
+ position: z.ZodNumber;
50
+ isUsed: z.ZodBoolean;
51
+ attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ }, z.core.$strip>;
53
+ /**
54
+ * Template previews response schema (array of template previews)
55
+ */
56
+ export declare const TemplatePreviewsResponseSchema: z.ZodArray<z.ZodObject<{
57
+ id: z.ZodNumber;
58
+ title: z.ZodString;
59
+ proportions: z.ZodObject<{
60
+ default: z.ZodObject<{
61
+ horizontal: z.ZodNullable<z.ZodObject<{
62
+ width: z.ZodNullable<z.ZodNumber>;
63
+ height: z.ZodNullable<z.ZodNumber>;
64
+ alignmentType: z.ZodString;
65
+ }, z.core.$strip>>;
66
+ vertical: z.ZodNullable<z.ZodObject<{
67
+ width: z.ZodNullable<z.ZodNumber>;
68
+ height: z.ZodNullable<z.ZodNumber>;
69
+ alignmentType: z.ZodString;
70
+ }, z.core.$strip>>;
71
+ square: z.ZodObject<{
72
+ side: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
73
+ alignmentType: z.ZodString;
74
+ }, z.core.$strip>;
75
+ }, z.core.$strip>;
76
+ }, z.core.$strip>;
77
+ identifier: z.ZodString;
78
+ version: z.ZodNumber;
79
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
80
+ position: z.ZodNumber;
81
+ isUsed: z.ZodBoolean;
82
+ attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
+ }, z.core.$strip>>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplatePreviewsResponseSchema = exports.TemplatePreviewEntitySchema = exports.SquareSchema = exports.ProportionSchema = void 0;
4
+ /**
5
+ * Validation schemas for TemplatesPreviews module
6
+ * @description Zod schemas for validating templates previews-related API responses
7
+ */
8
+ const zod_1 = require("zod");
9
+ /**
10
+ * Proportion schema
11
+ */
12
+ exports.ProportionSchema = zod_1.z.object({
13
+ width: zod_1.z.number().nullable(),
14
+ height: zod_1.z.number().nullable(),
15
+ alignmentType: zod_1.z.string(),
16
+ });
17
+ /**
18
+ * Square schema
19
+ */
20
+ exports.SquareSchema = zod_1.z.object({
21
+ side: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]),
22
+ alignmentType: zod_1.z.string(),
23
+ });
24
+ /**
25
+ * Template preview entity schema
26
+ * Includes all fields returned by the API
27
+ */
28
+ exports.TemplatePreviewEntitySchema = zod_1.z.object({
29
+ id: zod_1.z.number(),
30
+ title: zod_1.z.string(),
31
+ proportions: zod_1.z.object({
32
+ default: zod_1.z.object({
33
+ horizontal: exports.ProportionSchema.nullable(),
34
+ vertical: exports.ProportionSchema.nullable(),
35
+ square: exports.SquareSchema,
36
+ }),
37
+ }),
38
+ identifier: zod_1.z.string(),
39
+ version: zod_1.z.number(),
40
+ attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
41
+ position: zod_1.z.number(),
42
+ isUsed: zod_1.z.boolean(),
43
+ attributeSetIdentifier: zod_1.z.string().nullable().optional(),
44
+ });
45
+ /**
46
+ * Template previews response schema (array of template previews)
47
+ */
48
+ exports.TemplatePreviewsResponseSchema = zod_1.z.array(exports.TemplatePreviewEntitySchema);
@@ -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 usersSchemas_1 = require("./usersSchemas");
7
8
  /**
8
9
  * Controllers for working with users
9
10
  * @handle /api/content/users
@@ -30,7 +31,9 @@ class UsersApi extends asyncModules_1.default {
30
31
  */
31
32
  async getUser(langCode = this.state.lang) {
32
33
  const result = await this._fetchGet(`/me?langCode=${langCode}`);
33
- return this._normalizeData(result);
34
+ // Validate response if validation is enabled
35
+ const validated = this._validateResponse(result, usersSchemas_1.UserResponseSchema);
36
+ return this._normalizeData(validated);
34
37
  }
35
38
  /**
36
39
  * Updating a single user object.
@@ -110,12 +113,12 @@ class UsersApi extends asyncModules_1.default {
110
113
  async updateUser(body, langCode = this.state.lang) {
111
114
  if (!('langCode' in body))
112
115
  body['langCode'] = langCode;
113
- const result = await this._fetchPut('/me',
114
- // eslint-disable-next-line no-prototype-builtins
115
- body.hasOwnProperty('formData')
116
+ const result = await this._fetchPut('/me', Object.prototype.hasOwnProperty.call(body, 'formData')
116
117
  ? this._normalizePostBody(body, langCode)
117
118
  : body);
118
- return result;
119
+ // Validate response if validation is enabled
120
+ const validated = this._validateResponse(result, usersSchemas_1.UpdateUserResponseSchema);
121
+ return validated;
119
122
  }
120
123
  /**
121
124
  * Archiving one user object (marked for deletion).
@@ -165,6 +165,7 @@ interface IUsers {
165
165
  {
166
166
  "key": "value"
167
167
  }
168
+ * @property {Array<IFormConfig>} [moduleFormConfigs] - Optional array of form configuration objects associated with the user.
168
169
  * @description Represents a user entity with various properties, including identifiers, form data, and user groups.
169
170
  */
170
171
  interface IUserEntity {
@@ -176,7 +177,7 @@ interface IUserEntity {
176
177
  total: string;
177
178
  groups: Array<string | number>;
178
179
  state: Record<string, any>;
179
- moduleFormConfigs: IFormConfig;
180
+ moduleFormConfigs?: Array<IFormConfig>;
180
181
  }
181
182
  /**
182
183
  * @interface IUserBody
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Validation schemas for Users module
3
+ * @description Zod schemas for validating users-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * User response schema (extends base UserEntitySchema)
8
+ * formData can be array or object (inherited from UserEntitySchema)
9
+ */
10
+ export declare const UserResponseSchema: z.ZodObject<{
11
+ id: z.ZodNumber;
12
+ identifier: z.ZodOptional<z.ZodString>;
13
+ email: z.ZodOptional<z.ZodString>;
14
+ phoneMask: z.ZodOptional<z.ZodString>;
15
+ phoneCode: z.ZodOptional<z.ZodString>;
16
+ phoneNumber: z.ZodOptional<z.ZodString>;
17
+ statusMarker: z.ZodOptional<z.ZodString>;
18
+ formData: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
19
+ total: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
20
+ authProviderIdentifier: z.ZodOptional<z.ZodString>;
21
+ formIdentifier: z.ZodOptional<z.ZodString>;
22
+ groups: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
23
+ state: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
24
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
25
+ createdAt: z.ZodOptional<z.ZodString>;
26
+ updatedAt: z.ZodOptional<z.ZodString>;
27
+ }, z.core.$strip>;
28
+ /**
29
+ * Update user response schema (returns boolean)
30
+ */
31
+ export declare const UpdateUserResponseSchema: z.ZodBoolean;
32
+ /**
33
+ * Delete user response schema
34
+ */
35
+ export declare const DeleteUserResponseSchema: z.ZodObject<{
36
+ success: z.ZodBoolean;
37
+ message: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>;