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,187 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Block entity schema
4
+ * Includes all fields returned by the API
5
+ */
6
+ export declare const BlockEntitySchema: z.ZodObject<{
7
+ id: z.ZodNumber;
8
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
9
+ version: z.ZodNumber;
10
+ position: z.ZodNumber;
11
+ identifier: z.ZodString;
12
+ type: z.ZodString;
13
+ templateIdentifier: z.ZodNullable<z.ZodString>;
14
+ isVisible: z.ZodBoolean;
15
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
16
+ similarProducts: z.ZodOptional<z.ZodObject<{
17
+ items: z.ZodArray<z.ZodObject<{
18
+ id: z.ZodNumber;
19
+ identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
20
+ attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
21
+ localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
22
+ statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
23
+ isVisible: z.ZodOptional<z.ZodBoolean>;
24
+ statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
25
+ position: z.ZodOptional<z.ZodNumber>;
26
+ isPositionLocked: z.ZodOptional<z.ZodBoolean>;
27
+ templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
28
+ shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
29
+ price: z.ZodNullable<z.ZodNumber>;
30
+ additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
31
+ sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
+ isSync: z.ZodOptional<z.ZodBoolean>;
33
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
34
+ attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
35
+ productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
36
+ blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
38
+ currency: z.ZodOptional<z.ZodString>;
39
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
40
+ id: z.ZodNumber;
41
+ filename: z.ZodString;
42
+ url: z.ZodString;
43
+ size: z.ZodOptional<z.ZodNumber>;
44
+ type: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$strip>>>;
46
+ relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
47
+ pageId: z.ZodOptional<z.ZodNumber>;
48
+ }, z.core.$strip>>;
49
+ total: z.ZodNumber;
50
+ }, z.core.$strip>>;
51
+ countElementsPerRow: z.ZodOptional<z.ZodNumber>;
52
+ quantity: z.ZodOptional<z.ZodNumber>;
53
+ products: z.ZodOptional<z.ZodArray<z.ZodObject<{
54
+ id: z.ZodNumber;
55
+ identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
56
+ attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
57
+ localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
58
+ statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
59
+ isVisible: z.ZodOptional<z.ZodBoolean>;
60
+ statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
61
+ position: z.ZodOptional<z.ZodNumber>;
62
+ isPositionLocked: z.ZodOptional<z.ZodBoolean>;
63
+ templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
64
+ shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
65
+ price: z.ZodNullable<z.ZodNumber>;
66
+ additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
67
+ sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
68
+ isSync: z.ZodOptional<z.ZodBoolean>;
69
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
70
+ attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
71
+ productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
72
+ blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
74
+ currency: z.ZodOptional<z.ZodString>;
75
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
76
+ id: z.ZodNumber;
77
+ filename: z.ZodString;
78
+ url: z.ZodString;
79
+ size: z.ZodOptional<z.ZodNumber>;
80
+ type: z.ZodOptional<z.ZodString>;
81
+ }, z.core.$strip>>>;
82
+ relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
83
+ pageId: z.ZodOptional<z.ZodNumber>;
84
+ }, z.core.$strip>>>;
85
+ }, z.core.$strip>;
86
+ /**
87
+ * Blocks response schema
88
+ */
89
+ export declare const BlocksResponseSchema: z.ZodObject<{
90
+ items: z.ZodArray<z.ZodObject<{
91
+ id: z.ZodNumber;
92
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
93
+ version: z.ZodNumber;
94
+ position: z.ZodNumber;
95
+ identifier: z.ZodString;
96
+ type: z.ZodString;
97
+ templateIdentifier: z.ZodNullable<z.ZodString>;
98
+ isVisible: z.ZodBoolean;
99
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
100
+ similarProducts: z.ZodOptional<z.ZodObject<{
101
+ items: z.ZodArray<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
+ total: z.ZodNumber;
134
+ }, z.core.$strip>>;
135
+ countElementsPerRow: z.ZodOptional<z.ZodNumber>;
136
+ quantity: z.ZodOptional<z.ZodNumber>;
137
+ products: z.ZodOptional<z.ZodArray<z.ZodObject<{
138
+ id: z.ZodNumber;
139
+ identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
140
+ attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
141
+ localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
142
+ statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
143
+ isVisible: z.ZodOptional<z.ZodBoolean>;
144
+ statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
145
+ position: z.ZodOptional<z.ZodNumber>;
146
+ isPositionLocked: z.ZodOptional<z.ZodBoolean>;
147
+ templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
148
+ shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
149
+ price: z.ZodNullable<z.ZodNumber>;
150
+ additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
151
+ sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
152
+ isSync: z.ZodOptional<z.ZodBoolean>;
153
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
154
+ attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
155
+ productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
156
+ blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
158
+ currency: z.ZodOptional<z.ZodString>;
159
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
160
+ id: z.ZodNumber;
161
+ filename: z.ZodString;
162
+ url: z.ZodString;
163
+ size: z.ZodOptional<z.ZodNumber>;
164
+ type: z.ZodOptional<z.ZodString>;
165
+ }, z.core.$strip>>>;
166
+ relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
167
+ pageId: z.ZodOptional<z.ZodNumber>;
168
+ }, z.core.$strip>>>;
169
+ }, z.core.$strip>>;
170
+ total: z.ZodNumber;
171
+ }, z.core.$strip>;
172
+ /**
173
+ * Search block schema
174
+ */
175
+ export declare const SearchBlockSchema: z.ZodObject<{
176
+ id: z.ZodNumber;
177
+ identifier: z.ZodString;
178
+ name: z.ZodString;
179
+ }, z.core.$strip>;
180
+ /**
181
+ * Search blocks response schema
182
+ */
183
+ export declare const SearchBlocksResponseSchema: z.ZodArray<z.ZodObject<{
184
+ id: z.ZodNumber;
185
+ identifier: z.ZodString;
186
+ name: z.ZodString;
187
+ }, z.core.$strip>>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchBlocksResponseSchema = exports.SearchBlockSchema = exports.BlocksResponseSchema = exports.BlockEntitySchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const productsSchemas_1 = require("../products/productsSchemas");
6
+ /**
7
+ * Block entity schema
8
+ * Includes all fields returned by the API
9
+ */
10
+ exports.BlockEntitySchema = zod_1.z.object({
11
+ id: zod_1.z.number(),
12
+ localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
13
+ version: zod_1.z.number(),
14
+ position: zod_1.z.number(),
15
+ identifier: zod_1.z.string(),
16
+ type: zod_1.z.string(),
17
+ templateIdentifier: zod_1.z.string().nullable(),
18
+ isVisible: zod_1.z.boolean(),
19
+ attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
20
+ similarProducts: productsSchemas_1.ProductsResponseSchema.optional(),
21
+ countElementsPerRow: zod_1.z.number().optional(),
22
+ quantity: zod_1.z.number().optional(),
23
+ products: zod_1.z.array(productsSchemas_1.ProductEntitySchema).optional(),
24
+ });
25
+ /**
26
+ * Blocks response schema
27
+ */
28
+ exports.BlocksResponseSchema = zod_1.z.object({
29
+ items: zod_1.z.array(exports.BlockEntitySchema),
30
+ total: zod_1.z.number(),
31
+ });
32
+ /**
33
+ * Search block schema
34
+ */
35
+ exports.SearchBlockSchema = zod_1.z.object({
36
+ id: zod_1.z.number(),
37
+ identifier: zod_1.z.string(),
38
+ name: zod_1.z.string(),
39
+ });
40
+ /**
41
+ * Search blocks response schema
42
+ */
43
+ exports.SearchBlocksResponseSchema = zod_1.z.array(exports.SearchBlockSchema);
package/dist/config.d.ts CHANGED
@@ -1,5 +1,13 @@
1
- export declare const projectUrl = "https://js-sdk-tests.oneentry.cloud";
2
- export declare const projectToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk";
1
+ /**
2
+ * OneEntry SDK Configuration
3
+ * Uses environment variables when available, falls back to test defaults
4
+ *
5
+ * Environment variables (Node.js only):
6
+ * - ONEENTRY_PROJECT_URL: Your OneEntry project URL
7
+ * - ONEENTRY_API_TOKEN: Your OneEntry API token (JWT)
8
+ */
9
+ export declare const projectUrl: string;
10
+ export declare const projectToken: string;
3
11
  /**
4
12
  * authData
5
13
  */
package/dist/config.js CHANGED
@@ -1,10 +1,26 @@
1
1
  "use strict";
2
+ /**
3
+ * OneEntry SDK Configuration
4
+ * Uses environment variables when available, falls back to test defaults
5
+ *
6
+ * Environment variables (Node.js only):
7
+ * - ONEENTRY_PROJECT_URL: Your OneEntry project URL
8
+ * - ONEENTRY_API_TOKEN: Your OneEntry API token (JWT)
9
+ */
2
10
  Object.defineProperty(exports, "__esModule", { value: true });
3
11
  exports.authData2 = exports.authData = exports.projectToken = exports.projectUrl = void 0;
4
- // export const projectUrl = 'https://stage.oneentry.cloud';
5
- // export const projectToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk';
6
- exports.projectUrl = 'https://js-sdk-tests.oneentry.cloud';
7
- exports.projectToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk';
12
+ // Helper to safely get environment variable (works in both Node.js and browser)
13
+ const getEnv = (key) => {
14
+ if (typeof process !== 'undefined' && (process === null || process === void 0 ? void 0 : process.env)) {
15
+ return process.env[key];
16
+ }
17
+ return undefined;
18
+ };
19
+ // Project URL - uses environment variable or falls back to test server
20
+ exports.projectUrl = getEnv('ONEENTRY_PROJECT_URL') || 'https://js-sdk-tests.oneentry.cloud';
21
+ // API Token - uses environment variable or falls back to test token
22
+ exports.projectToken = getEnv('ONEENTRY_API_TOKEN') ||
23
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk';
8
24
  /**
9
25
  * authData
10
26
  */
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  /// <reference lib="dom" />
9
9
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
10
10
  // import { IFileEntity } from './fileUploadingInterfaces';
11
+ const fileUploadingSchemas_1 = require("./fileUploadingSchemas");
11
12
  /**
12
13
  * Controllers for working with file uploading
13
14
  * @handle /api/content/files
@@ -63,7 +64,9 @@ class FileUploadingApi extends asyncModules_1.default {
63
64
  const body = new FormData();
64
65
  body.append('files', file);
65
66
  const result = await this._fetchPost('?' + this._queryParamsToString(query), body);
66
- return result;
67
+ // Validate response if validation is enabled
68
+ const validated = this._validateResponse(result, fileUploadingSchemas_1.UploadResponseSchema);
69
+ return validated;
67
70
  }
68
71
  /**
69
72
  * Deletes a file from the cloud file storage.
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Validation schemas for FileUploading module
3
+ * @description Zod schemas for validating file uploading-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Upload return schema
8
+ * Includes filename, downloadLink, and size
9
+ */
10
+ export declare const UploadingReturnSchema: z.ZodObject<{
11
+ filename: z.ZodString;
12
+ downloadLink: z.ZodString;
13
+ size: z.ZodNumber;
14
+ }, z.core.$strip>;
15
+ /**
16
+ * Upload response schema (array of upload results)
17
+ */
18
+ export declare const UploadResponseSchema: z.ZodArray<z.ZodObject<{
19
+ filename: z.ZodString;
20
+ downloadLink: z.ZodString;
21
+ size: z.ZodNumber;
22
+ }, z.core.$strip>>;
@@ -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);
@@ -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
@@ -34,7 +35,9 @@ class FormsApi extends asyncModules_1.default {
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.
@@ -46,7 +49,9 @@ class FormsApi extends asyncModules_1.default {
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.
@@ -96,24 +96,36 @@ interface IFormsEntity {
96
96
  * Represents the structure of a form configuration.
97
97
  * @interface IFormConfig
98
98
  * @property {number} id - The identifier of the form configuration. Example: 123.
99
+ * @property {string} [formIdentifier] - The form identifier (only in products/pages API). Example: "review".
99
100
  * @property {string} moduleIdentifier - The identifier of the module associated with the form configuration. Example: "module_identifier".
100
101
  * @property {boolean} isGlobal - Indicates whether the form configuration is global. Example: true.
101
102
  * @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.
103
+ * @property {boolean} [isModerate] - Indicates whether the form requires moderation (only in products/pages API). Example: false.
104
+ * @property {boolean} [viewOnlyUserData] - Indicates whether the form configuration allows viewing user data (used in forms API). Example: true.
105
+ * @property {boolean} [commentOnlyUserData] - Indicates whether the form configuration allows commenting on user data (used in forms API). Example: true.
106
+ * @property {boolean} [viewOnlyMyData] - Indicates whether the form configuration allows viewing my data (used in products/pages API). Example: false.
107
+ * @property {boolean} [commentOnlyMyData] - Indicates whether the form configuration allows commenting on my data (used in products/pages API). Example: false.
108
+ * @property {object[]} entityIdentifiers - An array of entity identifiers associated with the form configuration.
109
+ * @property {string} entityIdentifiers[].id - Entity identifier. Example: "catalog".
110
+ * @property {boolean} entityIdentifiers[].isNested - Indicates if entity is nested. Example: false.
111
+ * @property {string[]} [nestedEntityIdentifiers] - An array of nested entity identifier strings (only in products/pages API). Example: ["catalog"].
112
+ * @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
113
  */
107
114
  interface IFormConfig {
108
115
  id: number;
116
+ formIdentifier?: string;
109
117
  moduleIdentifier: string;
110
118
  isGlobal: boolean;
111
119
  isClosed: boolean;
112
- viewOnlyUserData: boolean;
113
- commentOnlyUserData: boolean;
120
+ isModerate?: boolean;
121
+ viewOnlyUserData?: boolean;
122
+ commentOnlyUserData?: boolean;
123
+ viewOnlyMyData?: boolean;
124
+ commentOnlyMyData?: boolean;
114
125
  entityIdentifiers: {
115
126
  id: string;
116
127
  isNested: boolean;
117
128
  }[];
129
+ nestedEntityIdentifiers?: string[];
118
130
  }
119
131
  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;
@@ -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
@@ -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.
@@ -145,7 +148,9 @@ class FormsDataApi extends asyncModules_1.default {
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
156
  * Update one object of form data by id.
@@ -155,7 +160,9 @@ class FormsDataApi extends asyncModules_1.default {
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
168
  * Update form data status by id.
@@ -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.