oneentry 1.0.157 → 1.0.159

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 (48) hide show
  1. package/README.md +20 -0
  2. package/changelog.md +89 -0
  3. package/dist/admins/adminsApi.js +36 -2
  4. package/dist/attribute-sets/attributeSetsApi.d.ts +2 -2
  5. package/dist/attribute-sets/attributeSetsApi.js +40 -6
  6. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +19 -7
  7. package/dist/auth-provider/authProviderApi.js +38 -4
  8. package/dist/base/asyncModules.d.ts +6 -4
  9. package/dist/base/asyncModules.js +44 -8
  10. package/dist/base/syncModules.d.ts +2 -1
  11. package/dist/base/syncModules.js +10 -1
  12. package/dist/base/timeIntervals.js +6 -5
  13. package/dist/base/utils.d.ts +12 -8
  14. package/dist/blocks/blocksApi.d.ts +21 -21
  15. package/dist/blocks/blocksApi.js +48 -14
  16. package/dist/blocks/blocksInterfaces.d.ts +20 -20
  17. package/dist/blocks/blocksSchemas.d.ts +2 -0
  18. package/dist/discounts/discountsInterfaces.d.ts +4 -4
  19. package/dist/events/eventsApi.d.ts +3 -3
  20. package/dist/events/eventsApi.js +1 -1
  21. package/dist/events/eventsInterfaces.d.ts +16 -5
  22. package/dist/file-uploading/fileUploadingApi.js +36 -2
  23. package/dist/filters/filtersApi.js +36 -2
  24. package/dist/forms/formsApi.js +37 -3
  25. package/dist/forms/formsInterfaces.d.ts +22 -20
  26. package/dist/forms-data/formsDataApi.js +38 -4
  27. package/dist/general-types/generalTypesApi.js +36 -2
  28. package/dist/index.d.ts +2 -2
  29. package/dist/integration-collections/integrationCollectionsApi.js +43 -9
  30. package/dist/locales/localesApi.js +36 -2
  31. package/dist/menus/menusApi.js +36 -2
  32. package/dist/orders/ordersApi.js +39 -5
  33. package/dist/orders/ordersInterfaces.d.ts +11 -3
  34. package/dist/pages/pagesApi.js +42 -8
  35. package/dist/payments/paymentsApi.js +39 -5
  36. package/dist/product-statuses/productStatusesApi.js +38 -4
  37. package/dist/products/productsApi.d.ts +2 -2
  38. package/dist/products/productsApi.js +42 -8
  39. package/dist/products/productsInterfaces.d.ts +23 -15
  40. package/dist/products/productsSchemas.d.ts +1 -0
  41. package/dist/products/productsSchemas.js +1 -0
  42. package/dist/subscriptions/subscriptionsApi.js +38 -4
  43. package/dist/templates/templatesApi.js +38 -4
  44. package/dist/templates-preview/templatesPreviewApi.js +37 -3
  45. package/dist/users/usersApi.js +45 -11
  46. package/dist/web-socket/wsApi.d.ts +2 -0
  47. package/dist/web-socket/wsApi.js +47 -10
  48. package/package.json +6 -1
@@ -61,12 +61,12 @@ interface IEvents {
61
61
  * @handleName getFormSubscriptions
62
62
  * @param {number} [offset] - Optional offset for pagination. Default: 0.
63
63
  * @param {number} [limit] - Optional limit for pagination. Default: 30.
64
- * @returns {Promise<IListFormSubscription[] | IError>} A promise that resolves to an array of form subscriptions or an error.
64
+ * @returns {Promise<IFormSubscriptionsResponse | IError>} A promise that resolves to an object with an array of form subscriptions and total count, or an error.
65
65
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
66
66
  * @description This method returns all form subscriptions. This method requires user authorization.
67
67
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
68
68
  */
69
- getFormSubscriptions(offset?: number, limit?: number): Promise<IListFormSubscription[] | IError>;
69
+ getFormSubscriptions(offset?: number, limit?: number): Promise<IFormSubscriptionsResponse | IError>;
70
70
  /**
71
71
  * Unsubscribe from form notifications by marker.
72
72
  * @handleName unsubscribeFromForm
@@ -131,14 +131,14 @@ interface ISubscribeBody {
131
131
  * @property {number} id - Event identifier. Example: 1.
132
132
  * @property {string} identifier - Event text identifier. Example: "price_change".
133
133
  * @property {Record<string, unknown>} localizeInfos - Localized info of the event.
134
- * @property {string} module - Module the event belongs to. Example: "catalog".
134
+ * @property {string} [module] - Module the event belongs to; absent on system events not bound to a module (e.g. "send_code"). Example: "catalog".
135
135
  * @description Represents a single available event.
136
136
  */
137
137
  interface IContentApiEvent {
138
138
  id: number;
139
139
  identifier: string;
140
140
  localizeInfos: Record<string, unknown>;
141
- module: string;
141
+ module?: string;
142
142
  }
143
143
  /**
144
144
  * Represents a form subscription item.
@@ -151,6 +151,17 @@ interface IListFormSubscription {
151
151
  eventMarker: string;
152
152
  formDataId: number;
153
153
  }
154
+ /**
155
+ * Represents the response of the form subscriptions list endpoint.
156
+ * @interface IFormSubscriptionsResponse
157
+ * @property {IListFormSubscription[]} items - Array of form subscriptions.
158
+ * @property {number} total - Total number of subscriptions. Example: 0.
159
+ * @description Container returned by `getFormSubscriptions`.
160
+ */
161
+ interface IFormSubscriptionsResponse {
162
+ items: IListFormSubscription[];
163
+ total: number;
164
+ }
154
165
  /**
155
166
  * Body for subscribing to / unsubscribing from a form event.
156
167
  * @interface ISubscribeFormEvent
@@ -162,4 +173,4 @@ interface ISubscribeFormEvent {
162
173
  formDataId: number;
163
174
  status?: string;
164
175
  }
165
- export type { IContentApiEvent, IEvents, IListFormSubscription, ISubscribeBody, ISubscribeFormEvent, ISubscriptions, };
176
+ export type { IContentApiEvent, IEvents, IFormSubscriptionsResponse, IListFormSubscription, ISubscribeBody, ISubscribeFormEvent, ISubscriptions, };
@@ -1,11 +1,45 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
40
+ const lazySchema_1 = __importDefault(require("../base/lazySchema"));
41
+ const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./fileUploadingSchemas'))));
7
42
  // import { IFileEntity } from './fileUploadingInterfaces';
8
- const fileUploadingSchemas_1 = require("./fileUploadingSchemas");
9
43
  /**
10
44
  * Controllers for working with file uploading
11
45
  * @handle /api/content/files
@@ -63,7 +97,7 @@ class FileUploadingApi extends asyncModules_1.default {
63
97
  body.append('files', file);
64
98
  const result = await this._fetchPost('?' + this._queryParamsToString(query), body);
65
99
  // Validate response if validation is enabled
66
- const validated = this._validateResponse(result, fileUploadingSchemas_1.UploadResponseSchema);
100
+ const validated = await this._validateResponse(result, schema('UploadResponseSchema'));
67
101
  return validated;
68
102
  }
69
103
  /**
@@ -1,10 +1,44 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
7
- const filtersSchemas_1 = require("./filtersSchemas");
40
+ const lazySchema_1 = __importDefault(require("../base/lazySchema"));
41
+ const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./filtersSchemas'))));
8
42
  /**
9
43
  * Controllers for working with content filters.
10
44
  * @handle /api/content/filters
@@ -34,7 +68,7 @@ class FiltersApi extends asyncModules_1.default {
34
68
  */
35
69
  async getFilterByMarker(marker, langCode = this.state.lang) {
36
70
  const data = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
37
- const validated = this._validateResponse(data, filtersSchemas_1.ContentFilterSchema);
71
+ const validated = await this._validateResponse(data, schema('ContentFilterSchema'));
38
72
  return this._normalizeData(validated);
39
73
  }
40
74
  }
@@ -1,10 +1,44 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
7
- const formsSchemas_1 = require("./formsSchemas");
40
+ const lazySchema_1 = __importDefault(require("../base/lazySchema"));
41
+ const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./formsSchemas'))));
8
42
  /**
9
43
  * Controllers for forms objects
10
44
  * @class FormsApi
@@ -37,7 +71,7 @@ class FormsApi extends asyncModules_1.default {
37
71
  async getAllForms(langCode = this.state.lang, offset = 0, limit = 30) {
38
72
  const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
39
73
  // Validate response if validation is enabled
40
- const validated = this._validateResponse(result, formsSchemas_1.FormsResponseSchema);
74
+ const validated = await this._validateResponse(result, schema('FormsResponseSchema'));
41
75
  return this._normalizeData(validated, langCode);
42
76
  }
43
77
  /**
@@ -52,7 +86,7 @@ class FormsApi extends asyncModules_1.default {
52
86
  async getFormByMarker(marker, langCode = this.state.lang) {
53
87
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
54
88
  // Validate response if validation is enabled
55
- const validated = this._validateResponse(result, formsSchemas_1.FormEntitySchema);
89
+ const validated = await this._validateResponse(result, schema('FormEntitySchema'));
56
90
  return this._normalizeData(validated, langCode);
57
91
  }
58
92
  }
@@ -71,7 +71,7 @@ interface IFromPages {
71
71
  * @property {string} identifier - The textual identifier for the record field. Example: "form_contact_us".
72
72
  * @property {string} processingType - Type of form processing. Example: "async".
73
73
  * @property {number | null} templateId - The identifier of the template used by the form, or null if no template is used. Example: 6789.
74
- * @property {IFormAttribute[]} attributes - Form fields with their localization, validators and form-specific flags, sorted by `position`.
74
+ * @property {IFormAttribute[]} attributes - Form fields with their localization, validators and form-specific flags, sorted by `position`. The API returns an empty object for forms with no attributes — the SDK normalizes it to an empty array.
75
75
  * @property {number | string} [total] - Total count of related entries. Example: "1".
76
76
  * @property {IFormConfig[]} [moduleFormConfigs] - Array of module form configurations associated with the form.
77
77
  * @description This interface defines the structure of a form entity, including its identifiers, attributes, and processing data.
@@ -92,15 +92,17 @@ interface IFormsEntity {
92
92
  }
93
93
  /**
94
94
  * @interface IFormLocalizeInfo
95
+ * @property {string} [title] - Localized name of the form. Optional — the payload is an empty object when the form has no localization for the requested language (e.g. in list responses). Example: "Contact form".
95
96
  * @property {string} [titleForSite] - Public-facing title shown on the website. Example: "Form title (for application)".
96
97
  * @property {string} [successMessage] - Message shown to the user after successful submission.
97
98
  * @property {string} [unsuccessMessage] - Message shown to the user after a failed submission.
98
99
  * @property {string} [urlAddress] - URL where the form data is sent for processing (used by `processingType: "url"`).
99
100
  * @property {string} [database] - Database flag/id used by the form processor (stringly-typed in the API: "0" / "1" / id).
100
101
  * @property {string} [script] - Script flag/id used by the form processor (stringly-typed in the API: "0" / "1" / id).
101
- * @description Localization payload of a form — extends {@link ILocalizeInfo} with form-side fields (messages, processing config).
102
+ * @description Localization payload of a form — extends {@link ILocalizeInfo} with form-side fields (messages, processing config). Unlike the base type, `title` is optional here.
102
103
  */
103
- interface IFormLocalizeInfo extends ILocalizeInfo {
104
+ interface IFormLocalizeInfo extends Omit<ILocalizeInfo, 'title'> {
105
+ title?: string;
104
106
  titleForSite?: string;
105
107
  successMessage?: string;
106
108
  unsuccessMessage?: string;
@@ -120,14 +122,14 @@ interface IFormLocalizeInfo extends ILocalizeInfo {
120
122
  * @property {IAttributeValidators} validators - Validation rules; empty object when no validators are configured.
121
123
  * @property {Record<string, unknown>} settings - Field-specific configuration; empty object by default.
122
124
  * @property {Record<string, IFormAttributeAdditionalField>} additionalFields - Nested sub-fields keyed by marker; empty object when none.
123
- * @property {boolean} isLogin - Whether this field carries the login value used for authentication. Example: false.
124
- * @property {boolean} isSignUp - Whether this field is required during sign-up. Example: false.
125
- * @property {boolean} isPassword - Whether this field carries the password value used for authentication. Example: false.
126
- * @property {boolean} isSignUpRequired - Whether this field is required during sign-up. Example: false.
127
- * @property {boolean} isNotificationEmail - Whether this field stores the email used for notifications. Example: false.
128
- * @property {boolean} isNotificationPhonePush - Whether this field stores the phone number used for push notifications. Example: false.
129
- * @property {boolean} isNotificationPhoneSMS - Whether this field stores the phone number used for SMS notifications. Example: false.
130
- * @description Definition of a single field inside a form — extends a generic attribute with form-specific authentication / notification flags.
125
+ * @property {boolean} [isLogin] - Whether this field carries the login value used for authentication. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
126
+ * @property {boolean} [isSignUp] - Whether this field is required during sign-up. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
127
+ * @property {boolean} [isPassword] - Whether this field carries the password value used for authentication. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
128
+ * @property {boolean} [isSignUpRequired] - Whether this field is required during sign-up. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
129
+ * @property {boolean} [isNotificationEmail] - Whether this field stores the email used for notifications. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
130
+ * @property {boolean} [isNotificationPhonePush] - Whether this field stores the phone number used for push notifications. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
131
+ * @property {boolean} [isNotificationPhoneSMS] - Whether this field stores the phone number used for SMS notifications. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
132
+ * @description Definition of a single field inside a form — extends a generic attribute with form-specific authentication / notification flags (returned only for sign-in/sign-up forms).
131
133
  */
132
134
  interface IFormAttribute {
133
135
  marker: string;
@@ -140,24 +142,24 @@ interface IFormAttribute {
140
142
  validators: IAttributeValidators;
141
143
  settings: Record<string, unknown>;
142
144
  additionalFields: Record<string, IFormAttributeAdditionalField>;
143
- isLogin: boolean;
144
- isSignUp: boolean;
145
- isPassword: boolean;
146
- isSignUpRequired: boolean;
147
- isNotificationEmail: boolean;
148
- isNotificationPhonePush: boolean;
149
- isNotificationPhoneSMS: boolean;
145
+ isLogin?: boolean;
146
+ isSignUp?: boolean;
147
+ isPassword?: boolean;
148
+ isSignUpRequired?: boolean;
149
+ isNotificationEmail?: boolean;
150
+ isNotificationPhonePush?: boolean;
151
+ isNotificationPhoneSMS?: boolean;
150
152
  [key: string]: unknown;
151
153
  }
152
154
  /**
153
155
  * @interface IFormAttributeAdditionalField
154
- * @property {string} marker - Marker of the additional field. Example: "additional_field".
156
+ * @property {string} [marker] - Marker of the additional field. Optional — the API returns entries as `{ type, value }`, the marker itself is the key of the `additionalFields` map. Example: "additional_field".
155
157
  * @property {string} type - Type of the additional field. Example: "string".
156
158
  * @property {unknown} value - Value of the additional field, normalized like any other attribute value: `number | null` for numeric types, the file object itself for a single-file `image`/`file`, `null` when empty. Example: "Additional field data".
157
159
  * @description A single nested entry inside {@link IFormAttribute}'s `additionalFields` map.
158
160
  */
159
161
  interface IFormAttributeAdditionalField {
160
- marker: string;
162
+ marker?: string;
161
163
  type: string;
162
164
  value: unknown;
163
165
  }
@@ -1,12 +1,46 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  /* eslint-disable @typescript-eslint/no-explicit-any */
7
40
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
41
+ const lazySchema_1 = __importDefault(require("../base/lazySchema"));
8
42
  const fileUploadingApi_1 = __importDefault(require("../file-uploading/fileUploadingApi"));
9
- const formsDataSchemas_1 = require("./formsDataSchemas");
43
+ const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./formsDataSchemas'))));
10
44
  /**
11
45
  * Controllers for working with form data
12
46
  * @handle /api/content/form-data
@@ -122,7 +156,7 @@ class FormsDataApi extends asyncModules_1.default {
122
156
  body.formData = formData;
123
157
  const result = await this._fetchPost(``, body);
124
158
  // Validate response if validation is enabled
125
- const validated = this._validateResponse(result, formsDataSchemas_1.PostFormResponseSchema);
159
+ const validated = await this._validateResponse(result, schema('PostFormResponseSchema'));
126
160
  return this._normalizeData(validated);
127
161
  }
128
162
  /**
@@ -151,7 +185,7 @@ class FormsDataApi extends asyncModules_1.default {
151
185
  async getFormsDataByMarker(marker, formModuleConfigId, body = {}, isExtended = 0, langCode = this.state.lang, offset = 0, limit = 30) {
152
186
  const result = await this._fetchPost(`/marker/${marker}?formModuleConfigId=${formModuleConfigId}&isExtended=${isExtended}&langCode=${langCode}&offset=${offset}&limit=${limit}`, body);
153
187
  // Validate response if validation is enabled
154
- const validated = this._validateResponse(result, formsDataSchemas_1.FormsByMarkerDataResponseSchema);
188
+ const validated = await this._validateResponse(result, schema('FormsByMarkerDataResponseSchema'));
155
189
  return this._normalizeData(validated, langCode);
156
190
  }
157
191
  /**
@@ -164,7 +198,7 @@ class FormsDataApi extends asyncModules_1.default {
164
198
  async updateFormsDataByid(id, body = {}) {
165
199
  const result = await this._fetchPut(`/${id}`, body);
166
200
  // Validate response if validation is enabled
167
- const validated = this._validateResponse(result, formsDataSchemas_1.UpdateFormsDataSchema);
201
+ const validated = await this._validateResponse(result, schema('UpdateFormsDataSchema'));
168
202
  return validated;
169
203
  }
170
204
  /**
@@ -1,10 +1,44 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
7
- const generalTypesSchemas_1 = require("./generalTypesSchemas");
40
+ const lazySchema_1 = __importDefault(require("../base/lazySchema"));
41
+ const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./generalTypesSchemas'))));
8
42
  /**
9
43
  * Controllers for working with types
10
44
  * @handle /api/content/general-types
@@ -32,7 +66,7 @@ class GeneralTypesApi extends asyncModules_1.default {
32
66
  async getAllTypes() {
33
67
  const result = await this._fetchGet('');
34
68
  // Validate response if validation is enabled
35
- const validated = this._validateResponse(result, generalTypesSchemas_1.GeneralTypesResponseSchema);
69
+ const validated = await this._validateResponse(result, schema('GeneralTypesResponseSchema'));
36
70
  return validated;
37
71
  }
38
72
  }
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  import AdminsApi from './admins/adminsApi';
5
5
  import AttributesSetsApi from './attribute-sets/attributeSetsApi';
6
6
  import AuthProviderApi from './auth-provider/authProviderApi';
7
- import type { IAttributeValue, IConfig, ITimeIntervalAttributeValue, ITimeIntervalEntitySchedule, ITimeIntervalGroup, ITimeIntervalSchedule, ITimeIntervalWindow, TimeIntervalPair } from './base/utils';
7
+ import type { IConfig } from './base/utils';
8
8
  import BlocksApi from './blocks/blocksApi';
9
9
  import DiscountsApi from './discounts/discountsApi';
10
10
  import EventsApi from './events/eventsApi';
@@ -30,7 +30,7 @@ import UserActivityApi from './user-activity/userActivityApi';
30
30
  import UsersApi from './users/usersApi';
31
31
  import WsApi from './web-socket/wsApi';
32
32
  export { expandAttributeTimeIntervals, expandTimeIntervals, isTimeIntervalAttribute, } from './base/timeIntervals';
33
- export type { IAttributeValue, ITimeIntervalAttributeValue, ITimeIntervalEntitySchedule, ITimeIntervalGroup, ITimeIntervalSchedule, ITimeIntervalWindow, TimeIntervalPair, };
33
+ export type * from './types';
34
34
  /**
35
35
  * IDefineApi interface
36
36
  * @interface IDefineApi
@@ -1,11 +1,45 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  /* eslint-disable jsdoc/reject-any-type */
7
40
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
8
- const integrationCollectionsSchemas_1 = require("./integrationCollectionsSchemas");
41
+ const lazySchema_1 = __importDefault(require("../base/lazySchema"));
42
+ const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./integrationCollectionsSchemas'))));
9
43
  /**
10
44
  * Controllers for working with attributes.
11
45
  * @handle /api/content/integration-collections
@@ -51,7 +85,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
51
85
  const query = { ...this._defaultQuery, ...userQuery, langCode };
52
86
  const result = await this._fetchGet(`?` + this._queryParamsToString(query));
53
87
  // Validate response if validation is enabled
54
- const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionsResponseSchema);
88
+ const validated = await this._validateResponse(result, schema('CollectionsResponseSchema'));
55
89
  return this._normalizeData(validated, langCode);
56
90
  }
57
91
  /**
@@ -66,7 +100,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
66
100
  async getICollectionById(id, langCode = this.state.lang) {
67
101
  const result = await this._fetchGet(`/${id}?` + this._queryParamsToString({ langCode }));
68
102
  // Validate response if validation is enabled
69
- const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionEntitySchema);
103
+ const validated = await this._validateResponse(result, schema('CollectionEntitySchema'));
70
104
  return this._normalizeData(validated, langCode);
71
105
  }
72
106
  /**
@@ -99,7 +133,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
99
133
  langCode,
100
134
  }));
101
135
  // Validate response if validation is enabled
102
- const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionRowsResponseSchema);
136
+ const validated = await this._validateResponse(result, schema('CollectionRowsResponseSchema'));
103
137
  return this._normalizeData(validated, langCode);
104
138
  }
105
139
  /**
@@ -118,7 +152,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
118
152
  async validateICollectionMarker(marker) {
119
153
  const result = await this._fetchGet(`/marker-validation/${marker}`);
120
154
  // Validate response if validation is enabled
121
- const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionIsValidSchema);
155
+ const validated = await this._validateResponse(result, schema('CollectionIsValidSchema'));
122
156
  return this._normalizeData(validated);
123
157
  }
124
158
  /**
@@ -133,7 +167,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
133
167
  async getICollectionRowsByMarker(marker, langCode = this.state.lang) {
134
168
  const result = await this._fetchGet(`/marker/${marker}/rows?langCode=${langCode}`);
135
169
  // Validate response if validation is enabled
136
- const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionRowsResponseSchema);
170
+ const validated = await this._validateResponse(result, schema('CollectionRowsResponseSchema'));
137
171
  return this._normalizeData(validated, langCode);
138
172
  }
139
173
  /**
@@ -149,7 +183,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
149
183
  async getICollectionRowByMarkerAndId(marker, id, langCode = this.state.lang) {
150
184
  const result = await this._fetchGet(`/marker/${marker}/rows/${id}?langCode=${langCode}`);
151
185
  // Validate response if validation is enabled
152
- const validated = this._validateResponse(result, integrationCollectionsSchemas_1.CollectionRowSchema);
186
+ const validated = await this._validateResponse(result, schema('CollectionRowSchema'));
153
187
  return this._normalizeData(validated, langCode);
154
188
  }
155
189
  /**
@@ -177,7 +211,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
177
211
  async createICollectionRow(marker, body, langCode = this.state.lang) {
178
212
  const response = await this._fetchPost(`/marker/${marker}/rows?langCode=${langCode}`, body);
179
213
  // Validate response if validation is enabled
180
- const validated = this._validateResponse(response, integrationCollectionsSchemas_1.CollectionRowSchema);
214
+ const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
181
215
  return this._normalizeData(validated, langCode);
182
216
  }
183
217
  /**
@@ -208,7 +242,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
208
242
  async updateICollectionRow(marker, id, body, langCode = this.state.lang) {
209
243
  const response = await this._fetchPut(`/marker/${marker}/rows/${id}?` + `langCode=${langCode}`, body);
210
244
  // Validate response if validation is enabled
211
- const validated = this._validateResponse(response, integrationCollectionsSchemas_1.CollectionRowSchema);
245
+ const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
212
246
  return this._normalizeData(validated, langCode);
213
247
  }
214
248
  /**
@@ -1,10 +1,44 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
7
- const localesSchemas_1 = require("./localesSchemas");
40
+ const lazySchema_1 = __importDefault(require("../base/lazySchema"));
41
+ const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./localesSchemas'))));
8
42
  /**
9
43
  * Controllers for working with localizations (content language)
10
44
  * @handle /api/content/locales
@@ -31,7 +65,7 @@ class LocalesApi extends asyncModules_1.default {
31
65
  async getLocales() {
32
66
  const result = await this._fetchGet('/active/all');
33
67
  // Validate response if validation is enabled
34
- const validated = this._validateResponse(result, localesSchemas_1.LocalesResponseSchema);
68
+ const validated = await this._validateResponse(result, schema('LocalesResponseSchema'));
35
69
  return validated;
36
70
  }
37
71
  }