oneentry 1.0.158 → 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.
- package/README.md +20 -0
- package/changelog.md +35 -0
- package/dist/admins/adminsApi.js +36 -2
- package/dist/attribute-sets/attributeSetsApi.js +39 -5
- package/dist/auth-provider/authProviderApi.js +38 -4
- package/dist/base/asyncModules.d.ts +6 -4
- package/dist/base/asyncModules.js +44 -8
- package/dist/blocks/blocksApi.js +38 -4
- package/dist/file-uploading/fileUploadingApi.js +36 -2
- package/dist/filters/filtersApi.js +36 -2
- package/dist/forms/formsApi.js +37 -3
- package/dist/forms-data/formsDataApi.js +38 -4
- package/dist/general-types/generalTypesApi.js +36 -2
- package/dist/index.d.ts +2 -2
- package/dist/integration-collections/integrationCollectionsApi.js +43 -9
- package/dist/locales/localesApi.js +36 -2
- package/dist/menus/menusApi.js +36 -2
- package/dist/orders/ordersApi.js +39 -5
- package/dist/pages/pagesApi.js +42 -8
- package/dist/payments/paymentsApi.js +39 -5
- package/dist/product-statuses/productStatusesApi.js +38 -4
- package/dist/products/productsApi.js +41 -7
- package/dist/subscriptions/subscriptionsApi.js +38 -4
- package/dist/templates/templatesApi.js +38 -4
- package/dist/templates-preview/templatesPreviewApi.js +37 -3
- package/dist/users/usersApi.js +45 -11
- package/dist/web-socket/wsApi.d.ts +2 -0
- package/dist/web-socket/wsApi.js +47 -10
- package/package.json +6 -1
|
@@ -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
|
|
40
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
41
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./productStatusesSchemas'))));
|
|
8
42
|
/**
|
|
9
43
|
* Controllers for working with product statuses
|
|
10
44
|
* @handle /api/content/product-statuses
|
|
@@ -32,7 +66,7 @@ class ProductStatusesApi extends asyncModules_1.default {
|
|
|
32
66
|
async getProductStatuses(langCode = this.state.lang) {
|
|
33
67
|
const result = await this._fetchGet('');
|
|
34
68
|
// Validate response if validation is enabled
|
|
35
|
-
const validated = this._validateResponse(result,
|
|
69
|
+
const validated = await this._validateResponse(result, schema('ProductStatusesResponseSchema'));
|
|
36
70
|
return this._normalizeData(validated, langCode);
|
|
37
71
|
}
|
|
38
72
|
/**
|
|
@@ -48,7 +82,7 @@ class ProductStatusesApi extends asyncModules_1.default {
|
|
|
48
82
|
async getProductsByStatusMarker(marker, langCode = this.state.lang) {
|
|
49
83
|
const result = await this._fetchGet(`/marker/${marker}`);
|
|
50
84
|
// Validate response if validation is enabled
|
|
51
|
-
const validated = this._validateResponse(result,
|
|
85
|
+
const validated = await this._validateResponse(result, schema('ProductStatusEntitySchema'));
|
|
52
86
|
return this._normalizeData(validated, langCode);
|
|
53
87
|
}
|
|
54
88
|
/**
|
|
@@ -63,7 +97,7 @@ class ProductStatusesApi extends asyncModules_1.default {
|
|
|
63
97
|
async validateMarker(marker) {
|
|
64
98
|
const result = await this._fetchGet(`/marker-validation/${marker}`);
|
|
65
99
|
// Validate response if validation is enabled
|
|
66
|
-
const validated = this._validateResponse(result,
|
|
100
|
+
const validated = await this._validateResponse(result, schema('ValidateMarkerResponseSchema'));
|
|
67
101
|
// Extract the 'valid' boolean value from the response object
|
|
68
102
|
return typeof validated === 'object' && 'valid' in validated
|
|
69
103
|
? validated.valid
|
|
@@ -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
|
|
41
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
42
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./productsSchemas'))));
|
|
9
43
|
/**
|
|
10
44
|
* Controllers for working with product pages
|
|
11
45
|
* @handle /api/content/products
|
|
@@ -74,7 +108,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
74
108
|
};
|
|
75
109
|
const result = await this._fetchPost(`/all?` + this._queryParamsToString(query), { filter: body });
|
|
76
110
|
// Validate response if validation is enabled
|
|
77
|
-
const validated = this._validateResponse(result,
|
|
111
|
+
const validated = await this._validateResponse(result, schema('ProductsResponseSchema'));
|
|
78
112
|
return this._normalizeData(validated, langCode);
|
|
79
113
|
}
|
|
80
114
|
/**
|
|
@@ -149,7 +183,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
149
183
|
const query = { ...userQuery };
|
|
150
184
|
const result = await this._fetchPost(`/page/${id}?langCode=${langCode}&` + this._queryParamsToString(query), { filter: body });
|
|
151
185
|
// Validate response if validation is enabled
|
|
152
|
-
const validated = this._validateResponse(result,
|
|
186
|
+
const validated = await this._validateResponse(result, schema('ProductsResponseSchema'));
|
|
153
187
|
return this._normalizeData(validated, langCode);
|
|
154
188
|
}
|
|
155
189
|
/**
|
|
@@ -228,7 +262,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
228
262
|
const result = await this._fetchPost(`/page/url/${url}?langCode=${langCode}&` +
|
|
229
263
|
this._queryParamsToString(query), { filter: body });
|
|
230
264
|
// Validate response if validation is enabled
|
|
231
|
-
const validated = this._validateResponse(result,
|
|
265
|
+
const validated = await this._validateResponse(result, schema('ProductsResponseSchema'));
|
|
232
266
|
return this._normalizeData(validated, langCode);
|
|
233
267
|
}
|
|
234
268
|
/**
|
|
@@ -260,7 +294,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
260
294
|
const query = { ...userQuery };
|
|
261
295
|
const result = await this._fetchGet(`/${id}/related?langCode=${langCode}&` + this._queryParamsToString(query));
|
|
262
296
|
// Validate response if validation is enabled
|
|
263
|
-
const validated = this._validateResponse(result,
|
|
297
|
+
const validated = await this._validateResponse(result, schema('ProductsResponseSchema'));
|
|
264
298
|
return this._normalizeData(validated, langCode);
|
|
265
299
|
}
|
|
266
300
|
/**
|
|
@@ -309,7 +343,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
309
343
|
query.isNormalized = isNormalized;
|
|
310
344
|
const result = await this._fetchGet(`/${id}?` + this._queryParamsToString(query));
|
|
311
345
|
// Validate response if validation is enabled
|
|
312
|
-
const validated = this._validateResponse(result,
|
|
346
|
+
const validated = await this._validateResponse(result, schema('ProductEntitySchema'));
|
|
313
347
|
return this._normalizeData(validated, langCode);
|
|
314
348
|
}
|
|
315
349
|
/**
|
|
@@ -338,7 +372,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
338
372
|
async searchProduct(name, langCode = this.state.lang) {
|
|
339
373
|
const result = await this._fetchGet(`/quick/search?langCode=${encodeURIComponent(langCode)}&name=${encodeURIComponent(name)}`);
|
|
340
374
|
// Validate response if validation is enabled
|
|
341
|
-
const searchProducts = this._validateResponse(result,
|
|
375
|
+
const searchProducts = (await this._validateResponse(result, schema('ProductSearchResponseSchema')));
|
|
342
376
|
if (!this.state.traficLimit && Array.isArray(searchProducts)) {
|
|
343
377
|
if (searchProducts.length === 0)
|
|
344
378
|
return searchProducts;
|
|
@@ -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
|
|
40
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
41
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./subscriptionsSchemas'))));
|
|
8
42
|
/**
|
|
9
43
|
* Controllers for working with paid subscriptions.
|
|
10
44
|
* @handle /api/content/subscriptions
|
|
@@ -34,7 +68,7 @@ class SubscriptionsApi extends asyncModules_1.default {
|
|
|
34
68
|
*/
|
|
35
69
|
async subscribe(body) {
|
|
36
70
|
const data = await this._fetchPost(``, body);
|
|
37
|
-
const validated = this._validateResponse(data,
|
|
71
|
+
const validated = await this._validateResponse(data, schema('CreatedSubscriptionSchema'));
|
|
38
72
|
return this._normalizeData(validated);
|
|
39
73
|
}
|
|
40
74
|
/**
|
|
@@ -61,7 +95,7 @@ class SubscriptionsApi extends asyncModules_1.default {
|
|
|
61
95
|
*/
|
|
62
96
|
async getAllSubscriptions() {
|
|
63
97
|
const data = await this._fetchGet(``);
|
|
64
|
-
const validated = this._validateResponse(data,
|
|
98
|
+
const validated = await this._validateResponse(data, schema('SubscriptionsListSchema'));
|
|
65
99
|
return this._normalizeData(validated);
|
|
66
100
|
}
|
|
67
101
|
/**
|
|
@@ -75,7 +109,7 @@ class SubscriptionsApi extends asyncModules_1.default {
|
|
|
75
109
|
*/
|
|
76
110
|
async getActiveSubscriptions() {
|
|
77
111
|
const data = await this._fetchGet(`/active`);
|
|
78
|
-
const validated = this._validateResponse(data,
|
|
112
|
+
const validated = await this._validateResponse(data, schema('SubscriptionMarkersSchema'));
|
|
79
113
|
return this._normalizeData(validated);
|
|
80
114
|
}
|
|
81
115
|
/**
|
|
@@ -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 @typescript-eslint/no-explicit-any */
|
|
7
40
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
|
-
const
|
|
41
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
42
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./templatesSchemas'))));
|
|
9
43
|
/**
|
|
10
44
|
* Controllers for working with template objects
|
|
11
45
|
* @module TemplateController
|
|
@@ -34,7 +68,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
34
68
|
async getAllTemplates(langCode = this.state.lang) {
|
|
35
69
|
const response = await this._fetchGet(`/all?langCode=${langCode}`);
|
|
36
70
|
// Validate response if validation is enabled
|
|
37
|
-
const validated = this._validateResponse(response,
|
|
71
|
+
const validated = await this._validateResponse(response, schema('GroupedTemplatesResponseSchema'));
|
|
38
72
|
const result = {};
|
|
39
73
|
if (validated &&
|
|
40
74
|
typeof validated === 'object' &&
|
|
@@ -60,7 +94,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
60
94
|
async getTemplateByType(type, langCode = this.state.lang) {
|
|
61
95
|
const result = await this._fetchGet(`?type=${type}&langCode=${langCode}`);
|
|
62
96
|
// Validate response if validation is enabled
|
|
63
|
-
const validated = this._validateResponse(result,
|
|
97
|
+
const validated = await this._validateResponse(result, schema('TemplatesResponseSchema'));
|
|
64
98
|
return this._normalizeData(validated);
|
|
65
99
|
}
|
|
66
100
|
/**
|
|
@@ -76,7 +110,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
76
110
|
async getTemplateByMarker(marker, langCode = this.state.lang) {
|
|
77
111
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
78
112
|
// Validate response if validation is enabled
|
|
79
|
-
const validated = this._validateResponse(result,
|
|
113
|
+
const validated = await this._validateResponse(result, schema('TemplateEntitySchema'));
|
|
80
114
|
return this._normalizeData(validated);
|
|
81
115
|
}
|
|
82
116
|
}
|
|
@@ -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
|
|
40
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
41
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./templatesPreviewSchemas'))));
|
|
8
42
|
/**
|
|
9
43
|
* Controllers for working with template objects for preview.
|
|
10
44
|
* @handle /api/content/template-previews
|
|
@@ -32,7 +66,7 @@ class TemplatePreviewsApi extends asyncModules_1.default {
|
|
|
32
66
|
async getTemplatePreviews(langCode = this.state.lang) {
|
|
33
67
|
const result = await this._fetchGet(`?langCode=${langCode}`);
|
|
34
68
|
// Validate response if validation is enabled
|
|
35
|
-
const validated = this._validateResponse(result,
|
|
69
|
+
const validated = await this._validateResponse(result, schema('TemplatePreviewsResponseSchema'));
|
|
36
70
|
return this._normalizeData(validated, langCode);
|
|
37
71
|
}
|
|
38
72
|
/**
|
|
@@ -48,7 +82,7 @@ class TemplatePreviewsApi extends asyncModules_1.default {
|
|
|
48
82
|
async getTemplatePreviewByMarker(marker, langCode = this.state.lang) {
|
|
49
83
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
50
84
|
// Validate response if validation is enabled
|
|
51
|
-
const validated = this._validateResponse(result,
|
|
85
|
+
const validated = await this._validateResponse(result, schema('TemplatePreviewEntitySchema'));
|
|
52
86
|
return this._normalizeData(validated, langCode);
|
|
53
87
|
}
|
|
54
88
|
}
|
package/dist/users/usersApi.js
CHANGED
|
@@ -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
|
|
40
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
41
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./usersSchemas'))));
|
|
8
42
|
/**
|
|
9
43
|
* Controllers for working with users
|
|
10
44
|
* @handle /api/content/users
|
|
@@ -33,7 +67,7 @@ class UsersApi extends asyncModules_1.default {
|
|
|
33
67
|
async getUser(langCode = this.state.lang) {
|
|
34
68
|
const result = await this._fetchGet(`/me?langCode=${langCode}`);
|
|
35
69
|
// Validate response if validation is enabled
|
|
36
|
-
const validated = this._validateResponse(result,
|
|
70
|
+
const validated = await this._validateResponse(result, schema('UserResponseSchema'));
|
|
37
71
|
return this._normalizeData(validated);
|
|
38
72
|
}
|
|
39
73
|
/**
|
|
@@ -116,7 +150,7 @@ class UsersApi extends asyncModules_1.default {
|
|
|
116
150
|
if (!('langCode' in body))
|
|
117
151
|
body['langCode'] = langCode;
|
|
118
152
|
const result = await this._fetchPut('/me', this._normalizePostBody(body, langCode));
|
|
119
|
-
const validated = this._validateResponse(result,
|
|
153
|
+
const validated = await this._validateResponse(result, schema('UpdateUserResponseSchema'));
|
|
120
154
|
return validated;
|
|
121
155
|
}
|
|
122
156
|
/**
|
|
@@ -184,7 +218,7 @@ class UsersApi extends asyncModules_1.default {
|
|
|
184
218
|
*/
|
|
185
219
|
async getCart() {
|
|
186
220
|
const result = await this._fetchGet('/me/cart');
|
|
187
|
-
const validated = this._validateResponse(result,
|
|
221
|
+
const validated = await this._validateResponse(result, schema('CartResponseSchema'));
|
|
188
222
|
return this._normalizeData(validated);
|
|
189
223
|
}
|
|
190
224
|
/**
|
|
@@ -199,7 +233,7 @@ class UsersApi extends asyncModules_1.default {
|
|
|
199
233
|
*/
|
|
200
234
|
async setCart(body) {
|
|
201
235
|
const result = await this._fetchPut('/me/cart', body);
|
|
202
|
-
const validated = this._validateResponse(result,
|
|
236
|
+
const validated = await this._validateResponse(result, schema('CartResponseSchema'));
|
|
203
237
|
return this._normalizeData(validated);
|
|
204
238
|
}
|
|
205
239
|
/**
|
|
@@ -214,7 +248,7 @@ class UsersApi extends asyncModules_1.default {
|
|
|
214
248
|
*/
|
|
215
249
|
async addCartItem(body) {
|
|
216
250
|
const result = await this._fetchPost('/me/cart/items', body);
|
|
217
|
-
const validated = this._validateResponse(result,
|
|
251
|
+
const validated = await this._validateResponse(result, schema('CartResponseSchema'));
|
|
218
252
|
return this._normalizeData(validated);
|
|
219
253
|
}
|
|
220
254
|
/**
|
|
@@ -229,7 +263,7 @@ class UsersApi extends asyncModules_1.default {
|
|
|
229
263
|
*/
|
|
230
264
|
async removeCartItem(productId) {
|
|
231
265
|
const result = await this._fetchDelete(`/me/cart/items/${productId}`);
|
|
232
|
-
const validated = this._validateResponse(result,
|
|
266
|
+
const validated = await this._validateResponse(result, schema('CartResponseSchema'));
|
|
233
267
|
return this._normalizeData(validated);
|
|
234
268
|
}
|
|
235
269
|
/**
|
|
@@ -243,7 +277,7 @@ class UsersApi extends asyncModules_1.default {
|
|
|
243
277
|
*/
|
|
244
278
|
async getWishlist() {
|
|
245
279
|
const result = await this._fetchGet('/me/wishlist');
|
|
246
|
-
const validated = this._validateResponse(result,
|
|
280
|
+
const validated = await this._validateResponse(result, schema('WishlistResponseSchema'));
|
|
247
281
|
return this._normalizeData(validated);
|
|
248
282
|
}
|
|
249
283
|
/**
|
|
@@ -258,7 +292,7 @@ class UsersApi extends asyncModules_1.default {
|
|
|
258
292
|
*/
|
|
259
293
|
async setWishlist(body) {
|
|
260
294
|
const result = await this._fetchPut('/me/wishlist', body);
|
|
261
|
-
const validated = this._validateResponse(result,
|
|
295
|
+
const validated = await this._validateResponse(result, schema('WishlistResponseSchema'));
|
|
262
296
|
return this._normalizeData(validated);
|
|
263
297
|
}
|
|
264
298
|
/**
|
|
@@ -273,7 +307,7 @@ class UsersApi extends asyncModules_1.default {
|
|
|
273
307
|
*/
|
|
274
308
|
async addWishlistItem(body) {
|
|
275
309
|
const result = await this._fetchPost('/me/wishlist/items', body);
|
|
276
|
-
const validated = this._validateResponse(result,
|
|
310
|
+
const validated = await this._validateResponse(result, schema('WishlistResponseSchema'));
|
|
277
311
|
return this._normalizeData(validated);
|
|
278
312
|
}
|
|
279
313
|
/**
|
|
@@ -288,7 +322,7 @@ class UsersApi extends asyncModules_1.default {
|
|
|
288
322
|
*/
|
|
289
323
|
async removeWishlistItem(productId) {
|
|
290
324
|
const result = await this._fetchDelete(`/me/wishlist/items/${productId}`);
|
|
291
|
-
const validated = this._validateResponse(result,
|
|
325
|
+
const validated = await this._validateResponse(result, schema('WishlistResponseSchema'));
|
|
292
326
|
return this._normalizeData(validated);
|
|
293
327
|
}
|
|
294
328
|
}
|
|
@@ -19,6 +19,8 @@ export default class WsApi extends AsyncModules implements IWS {
|
|
|
19
19
|
* @handleName connect
|
|
20
20
|
* @returns {Socket} Returns a Socket instance.
|
|
21
21
|
* @description Creates an instance of an object Socket.io with a connection. This method requires user authorization.
|
|
22
|
+
* Socket.io is imported on demand, so projects that never open a socket do not bundle it; the returned
|
|
23
|
+
* value is usable immediately either way (see `createLazySocket`).
|
|
22
24
|
* @see {@link https://js-sdk.oneentry.cloud/docs/web-socket/connect connect} documentation.
|
|
23
25
|
*/
|
|
24
26
|
connect(): Socket;
|
package/dist/web-socket/wsApi.js
CHANGED
|
@@ -1,10 +1,43 @@
|
|
|
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
|
-
const socket_io_client_1 = require("socket.io-client");
|
|
7
39
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
40
|
+
const lazySocket_1 = __importDefault(require("./lazySocket"));
|
|
8
41
|
/**
|
|
9
42
|
* Controllers for working with users
|
|
10
43
|
* @handle /api/content/ws
|
|
@@ -23,6 +56,8 @@ class WsApi extends asyncModules_1.default {
|
|
|
23
56
|
* @handleName connect
|
|
24
57
|
* @returns {Socket} Returns a Socket instance.
|
|
25
58
|
* @description Creates an instance of an object Socket.io with a connection. This method requires user authorization.
|
|
59
|
+
* Socket.io is imported on demand, so projects that never open a socket do not bundle it; the returned
|
|
60
|
+
* value is usable immediately either way (see `createLazySocket`).
|
|
26
61
|
* @see {@link https://js-sdk.oneentry.cloud/docs/web-socket/connect connect} documentation.
|
|
27
62
|
*/
|
|
28
63
|
connect() {
|
|
@@ -30,16 +65,18 @@ class WsApi extends asyncModules_1.default {
|
|
|
30
65
|
// eslint-disable-next-line no-undef, no-console
|
|
31
66
|
console.error('User is unauthorized');
|
|
32
67
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
68
|
+
return (0, lazySocket_1.default)(async () => {
|
|
69
|
+
const { io } = await Promise.resolve().then(() => __importStar(require('socket.io-client')));
|
|
70
|
+
return io(this.state.url, {
|
|
71
|
+
autoConnect: true,
|
|
72
|
+
path: '/api/content/ws',
|
|
73
|
+
transports: ['websocket'],
|
|
74
|
+
extraHeaders: {
|
|
75
|
+
Authorization: 'Bearer ' + this.state.accessToken,
|
|
76
|
+
'x-app-token': this.state.token,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
41
79
|
});
|
|
42
|
-
return socket;
|
|
43
80
|
}
|
|
44
81
|
}
|
|
45
82
|
exports.default = WsApi;
|
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneentry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.159",
|
|
4
4
|
"description": "OneEntry NPM package",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"module": "esm/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
7
9
|
"files": [
|
|
8
10
|
"/dist",
|
|
11
|
+
"/esm",
|
|
12
|
+
"/types.js",
|
|
13
|
+
"/types.d.ts",
|
|
9
14
|
"/changelog.md"
|
|
10
15
|
],
|
|
11
16
|
"bin": {
|