oneentry 1.0.139 → 1.0.141
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 +16 -1
- package/configure.js +40 -21
- package/dist/auth-provider/authProviderSchemas.d.ts +24 -30
- package/dist/auth-provider/authProviderSchemas.js +12 -15
- package/dist/auth-provider/authProvidersInterfaces.d.ts +10 -2
- package/dist/base/syncModules.js +1 -1
- package/dist/blocks/blocksApi.d.ts +2 -0
- package/dist/blocks/blocksApi.js +6 -2
- package/dist/discounts/discountsApi.d.ts +56 -0
- package/dist/discounts/discountsApi.js +82 -0
- package/dist/discounts/discountsInterfaces.d.ts +145 -0
- package/dist/discounts/discountsInterfaces.js +2 -0
- package/dist/forms/formsSchemas.d.ts +18 -33
- package/dist/forms/formsSchemas.js +6 -11
- package/dist/index.d.ts +11 -5
- package/dist/index.js +6 -0
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +2 -2
- package/dist/integration-collections/integrationCollectionsSchemas.d.ts +2 -6
- package/dist/integration-collections/integrationCollectionsSchemas.js +1 -3
- package/dist/orders/ordersApi.d.ts +26 -3
- package/dist/orders/ordersApi.js +36 -2
- package/dist/orders/ordersInterfaces.d.ts +104 -4
- package/dist/orders/ordersSchemas.d.ts +34 -72
- package/dist/orders/ordersSchemas.js +16 -35
- package/dist/pages/pagesApi.d.ts +2 -2
- package/dist/pages/pagesApi.js +3 -3
- package/dist/pages/pagesInterfaces.d.ts +3 -3
- package/dist/payments/paymentsInterfaces.d.ts +1 -1
- package/dist/payments/paymentsSchemas.d.ts +53 -90
- package/dist/payments/paymentsSchemas.js +21 -34
- package/dist/product-statuses/productStatusesApi.d.ts +2 -2
- package/dist/product-statuses/productStatusesInterfaces.d.ts +2 -2
- package/dist/products/productsApi.d.ts +5 -4
- package/dist/products/productsApi.js +9 -5
- package/dist/products/productsInterfaces.d.ts +11 -8
- package/dist/products/productsSchemas.d.ts +14 -34
- package/dist/products/productsSchemas.js +14 -3
- package/dist/sitemap/sitemapApi.d.ts +35 -0
- package/dist/sitemap/sitemapApi.js +45 -0
- package/dist/sitemap/sitemapInterfaces.d.ts +40 -0
- package/dist/sitemap/sitemapInterfaces.js +2 -0
- package/dist/system/systemApi.d.ts +3 -25
- package/dist/system/systemApi.js +0 -24
- package/dist/system/systemInterfaces.d.ts +13 -5
- package/dist/system/systemInterfaces.js +3 -0
- package/dist/templates-preview/templatesPreviewApi.d.ts +2 -2
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +3 -3
- package/dist/users/usersApi.d.ts +2 -2
- package/dist/users/usersApi.js +0 -1
- package/dist/users/usersInterfaces.d.ts +3 -3
- package/dist/users/usersSchemas.d.ts +1 -1
- package/dist/users/usersSchemas.js +1 -1
- package/package.json +3 -78
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import AsyncModules from '../base/asyncModules';
|
|
2
2
|
import type StateModule from '../base/stateModule';
|
|
3
3
|
import type { IError } from '../base/utils';
|
|
4
|
-
import type { IFilterParams,
|
|
4
|
+
import type { IFilterParams, IProductBlock, IProductsApi, IProductsCount, IProductsEntity, IProductsInfo, IProductsQuery, IProductsResponse } from './productsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with product pages
|
|
7
7
|
* @handle /api/content/products
|
|
8
8
|
* @description Controllers for working with product pages
|
|
9
9
|
*/
|
|
10
|
-
export default class
|
|
10
|
+
export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
11
11
|
protected state: StateModule;
|
|
12
12
|
protected _url: string;
|
|
13
13
|
/**
|
|
14
14
|
* Constructor
|
|
15
15
|
* @param {StateModule} state - StateModule instance
|
|
16
|
-
* @description Constructor initializes the
|
|
16
|
+
* @description Constructor initializes the ProductsApi with a given state.
|
|
17
17
|
*/
|
|
18
18
|
constructor(state: StateModule);
|
|
19
19
|
/**
|
|
@@ -269,11 +269,12 @@ export default class ProductApi extends AsyncModules implements IProductApi {
|
|
|
269
269
|
* @handleName getProductById
|
|
270
270
|
* @param {number} id - Product id. Example: 12345.
|
|
271
271
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
272
|
+
* @param {boolean} [isNormalized] - If true, the product object will be normalized.
|
|
272
273
|
* @returns {Promise<IProductsEntity | IError>} ProductEntity object.
|
|
273
274
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
274
275
|
* @description Retrieve one product object.
|
|
275
276
|
*/
|
|
276
|
-
getProductById(id: number, langCode?: string): Promise<IProductsEntity | IError>;
|
|
277
|
+
getProductById(id: number, langCode?: string, isNormalized?: boolean): Promise<IProductsEntity | IError>;
|
|
277
278
|
/**
|
|
278
279
|
* Getting a product block object by product id.
|
|
279
280
|
* @handleName getProductBlockById
|
|
@@ -11,11 +11,11 @@ const productsSchemas_1 = require("./productsSchemas");
|
|
|
11
11
|
* @handle /api/content/products
|
|
12
12
|
* @description Controllers for working with product pages
|
|
13
13
|
*/
|
|
14
|
-
class
|
|
14
|
+
class ProductsApi extends asyncModules_1.default {
|
|
15
15
|
/**
|
|
16
16
|
* Constructor
|
|
17
17
|
* @param {StateModule} state - StateModule instance
|
|
18
|
-
* @description Constructor initializes the
|
|
18
|
+
* @description Constructor initializes the ProductsApi with a given state.
|
|
19
19
|
*/
|
|
20
20
|
constructor(state) {
|
|
21
21
|
super(state);
|
|
@@ -323,12 +323,16 @@ class ProductApi extends asyncModules_1.default {
|
|
|
323
323
|
* @handleName getProductById
|
|
324
324
|
* @param {number} id - Product id. Example: 12345.
|
|
325
325
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
326
|
+
* @param {boolean} [isNormalized] - If true, the product object will be normalized.
|
|
326
327
|
* @returns {Promise<IProductsEntity | IError>} ProductEntity object.
|
|
327
328
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
328
329
|
* @description Retrieve one product object.
|
|
329
330
|
*/
|
|
330
|
-
async getProductById(id, langCode = this.state.lang) {
|
|
331
|
-
const
|
|
331
|
+
async getProductById(id, langCode = this.state.lang, isNormalized) {
|
|
332
|
+
const query = { langCode };
|
|
333
|
+
if (isNormalized !== undefined)
|
|
334
|
+
query.isNormalized = isNormalized;
|
|
335
|
+
const result = await this._fetchGet(`/${id}?` + this._queryParamsToString(query));
|
|
332
336
|
// Validate response if validation is enabled
|
|
333
337
|
const validated = this._validateResponse(result, productsSchemas_1.ProductEntitySchema);
|
|
334
338
|
return this._dataPostProcess(validated, langCode);
|
|
@@ -452,4 +456,4 @@ class ProductApi extends asyncModules_1.default {
|
|
|
452
456
|
return result;
|
|
453
457
|
}
|
|
454
458
|
}
|
|
455
|
-
exports.default =
|
|
459
|
+
exports.default = ProductsApi;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AttributeType, IError, ILocalizeInfo, LangType, Types } from '../base/utils';
|
|
2
2
|
import type { IFormConfig } from '../forms/formsInterfaces';
|
|
3
3
|
/**
|
|
4
|
-
* @interface
|
|
4
|
+
* @interface IProductsApi
|
|
5
5
|
* @property {Function} getProducts - Search for all product page objects with pagination and filtering.
|
|
6
6
|
* @property {Function} getProductsEmptyPage - Search for all product page objects with pagination that do not have a category.
|
|
7
7
|
* @property {Function} getProductsByPageId - Search for all products with pagination for the selected category.
|
|
@@ -17,7 +17,7 @@ import type { IFormConfig } from '../forms/formsInterfaces';
|
|
|
17
17
|
* @property {Function} getProductsCountByPageUrl - Retrieves the number of products on a specific catalog page identified by its URL.
|
|
18
18
|
* @description This interface defines methods for retrieving and managing products in the system.
|
|
19
19
|
*/
|
|
20
|
-
interface
|
|
20
|
+
interface IProductsApi {
|
|
21
21
|
/**
|
|
22
22
|
* Search for all products with pagination and filter.
|
|
23
23
|
* @handleName getProducts
|
|
@@ -208,11 +208,12 @@ interface IProductApi {
|
|
|
208
208
|
* @handleName getProductById
|
|
209
209
|
* @param {number} id - Product id. Example: 12345.
|
|
210
210
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
211
|
+
* @param {boolean} [isNormalized] - If true, the product object will be normalized.
|
|
211
212
|
* @returns {IProductsEntity} ProductEntity object.
|
|
212
213
|
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
213
214
|
* @description This method retrieves one product object.
|
|
214
215
|
*/
|
|
215
|
-
getProductById(id: number, langCode?: string): Promise<IProductsEntity | IError>;
|
|
216
|
+
getProductById(id: number, langCode?: string, isNormalized?: boolean): Promise<IProductsEntity | IError>;
|
|
216
217
|
/**
|
|
217
218
|
* Getting a product block object by product id.
|
|
218
219
|
* @handleName getProductBlockById
|
|
@@ -364,6 +365,7 @@ interface IProductsQuery {
|
|
|
364
365
|
* @property {string | null} [conditionMarker] - Id of the filter condition by which the values are filtered. Default: null. Example: "equals".
|
|
365
366
|
* @property {number | null} conditionValue - The value that is being searched for, default null. Example: "new".
|
|
366
367
|
* @property {string | null} [pageUrl] - Url of the category page object. Example: ["23-laminat-floorwood-maxima"].
|
|
368
|
+
* @property {string[] | null} [pageUrls] - Url of the category page object. Example: ["23-laminat-floorwood-maxima"].
|
|
367
369
|
* @property {string | null} [statusMarker] - Text identifier of the product page status (default not set). Example: "in_stock".
|
|
368
370
|
* @property {string | null} [title] - Product name. Example: "Laminatboden Maxima".
|
|
369
371
|
* @property {boolean} [isNested] - Flag for nested attributes, default false. Example: true.
|
|
@@ -374,6 +376,7 @@ interface IFilterParams {
|
|
|
374
376
|
conditionMarker?: 'in' /** 'in' - Contains */ | 'nin' /** 'nin' - Does not contain */ | 'eq' /** 'eq' - Equal */ | 'neq' /** 'neq' - Not equal */ | 'mth' /** 'mth' - Greater than */ | 'lth' /** 'lth' - Less than */ | 'exs' /** 'exs' - Exists */ | 'nexs' /** 'nexs' - Does not exist */ | null;
|
|
375
377
|
conditionValue: number | string | null;
|
|
376
378
|
pageUrl?: string | null;
|
|
379
|
+
pageUrls?: string[] | null;
|
|
377
380
|
statusMarker?: string;
|
|
378
381
|
title?: string;
|
|
379
382
|
isNested?: boolean;
|
|
@@ -394,7 +397,7 @@ interface IFilterParams {
|
|
|
394
397
|
"de": "Auf Lager"
|
|
395
398
|
}
|
|
396
399
|
* @property {string | null} sku - Product SKU (Stock Keeping Unit), may be null. Example: "SKU_12345".
|
|
397
|
-
* @property {
|
|
400
|
+
* @property {boolean} isSync - Indication of page indexing. Example: true.
|
|
398
401
|
* @property {AttributeType} attributeValues - Array of attribute values from the index, represented.
|
|
399
402
|
* @example
|
|
400
403
|
[
|
|
@@ -446,7 +449,7 @@ interface IProductsEntity {
|
|
|
446
449
|
};
|
|
447
450
|
};
|
|
448
451
|
sku: string | null;
|
|
449
|
-
isSync:
|
|
452
|
+
isSync: boolean;
|
|
450
453
|
attributeValues: AttributeType;
|
|
451
454
|
categories: string[];
|
|
452
455
|
isVisible: boolean;
|
|
@@ -526,7 +529,7 @@ interface IProductInfo {
|
|
|
526
529
|
/**
|
|
527
530
|
* @interface IProductBlock
|
|
528
531
|
* @property {number} id - Unique identifier of the product block. Example: 3289.
|
|
529
|
-
* @property {
|
|
532
|
+
* @property {string | null} attributeSetIdentifier - Identifier of the attribute set used in the product block, or null if not applicable. Example: "product_block".
|
|
530
533
|
* @property {ILocalizeInfo} localizeInfos - Localization information for the product block.
|
|
531
534
|
* @example
|
|
532
535
|
{
|
|
@@ -552,7 +555,7 @@ interface IProductInfo {
|
|
|
552
555
|
*/
|
|
553
556
|
interface IProductBlock {
|
|
554
557
|
id: number;
|
|
555
|
-
attributeSetIdentifier:
|
|
558
|
+
attributeSetIdentifier: string | null;
|
|
556
559
|
localizeInfos: ILocalizeInfo;
|
|
557
560
|
version: number;
|
|
558
561
|
position: number;
|
|
@@ -580,4 +583,4 @@ interface IProductBlock {
|
|
|
580
583
|
isSync: boolean;
|
|
581
584
|
attributeValues: AttributeType;
|
|
582
585
|
}
|
|
583
|
-
export type { IFilterParams,
|
|
586
|
+
export type { IFilterParams, IProductBlock, IProductInfo, IProductsApi, IProductsCount, IProductsEntity, IProductsInfo, IProductsQuery, IProductsResponse, };
|
|
@@ -134,46 +134,26 @@ export declare const SingleProductSchema: z.ZodObject<{
|
|
|
134
134
|
* Products count schema
|
|
135
135
|
*/
|
|
136
136
|
export declare const ProductsCountSchema: z.ZodObject<{
|
|
137
|
-
|
|
137
|
+
totalAll: z.ZodNumber;
|
|
138
|
+
totalInCategory: z.ZodNumber;
|
|
139
|
+
totalInCategoryWithNested: z.ZodNumber;
|
|
138
140
|
}, z.core.$strip>;
|
|
139
141
|
/**
|
|
140
142
|
* Product block schema
|
|
141
143
|
*/
|
|
142
144
|
export declare const ProductBlockSchema: z.ZodObject<{
|
|
143
145
|
id: z.ZodNumber;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
156
|
-
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
157
|
-
price: z.ZodNullable<z.ZodNumber>;
|
|
158
|
-
additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
159
|
-
sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
160
|
-
isSync: z.ZodOptional<z.ZodBoolean>;
|
|
161
|
-
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
162
|
-
attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
163
|
-
productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
164
|
-
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
165
|
-
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
166
|
-
currency: z.ZodOptional<z.ZodString>;
|
|
167
|
-
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
168
|
-
id: z.ZodNumber;
|
|
169
|
-
filename: z.ZodString;
|
|
170
|
-
url: z.ZodString;
|
|
171
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
172
|
-
type: z.ZodOptional<z.ZodString>;
|
|
173
|
-
}, z.core.$strip>>>;
|
|
174
|
-
relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
175
|
-
pageId: z.ZodOptional<z.ZodNumber>;
|
|
176
|
-
}, z.core.$strip>>;
|
|
146
|
+
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
147
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
148
|
+
version: z.ZodNumber;
|
|
149
|
+
position: z.ZodNumber;
|
|
150
|
+
identifier: z.ZodString;
|
|
151
|
+
type: z.ZodString;
|
|
152
|
+
customSettings: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
153
|
+
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
154
|
+
isVisible: z.ZodBoolean;
|
|
155
|
+
isSync: z.ZodBoolean;
|
|
156
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
177
157
|
}, z.core.$strip>;
|
|
178
158
|
/**
|
|
179
159
|
* Related products schema
|
|
@@ -69,15 +69,26 @@ exports.SingleProductSchema = exports.ProductEntitySchema;
|
|
|
69
69
|
* Products count schema
|
|
70
70
|
*/
|
|
71
71
|
exports.ProductsCountSchema = zod_1.z.object({
|
|
72
|
-
|
|
72
|
+
totalAll: zod_1.z.number(),
|
|
73
|
+
totalInCategory: zod_1.z.number(),
|
|
74
|
+
totalInCategoryWithNested: zod_1.z.number(),
|
|
73
75
|
});
|
|
74
76
|
/**
|
|
75
77
|
* Product block schema
|
|
76
78
|
*/
|
|
77
79
|
exports.ProductBlockSchema = zod_1.z.object({
|
|
78
80
|
id: zod_1.z.number(),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
attributeSetIdentifier: zod_1.z.string().nullable(),
|
|
82
|
+
localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
83
|
+
version: zod_1.z.number(),
|
|
84
|
+
position: zod_1.z.number(),
|
|
85
|
+
identifier: zod_1.z.string(),
|
|
86
|
+
type: zod_1.z.string(),
|
|
87
|
+
customSettings: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
88
|
+
templateIdentifier: zod_1.z.string().nullable(),
|
|
89
|
+
isVisible: zod_1.z.boolean(),
|
|
90
|
+
isSync: zod_1.z.boolean(),
|
|
91
|
+
attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
81
92
|
});
|
|
82
93
|
/**
|
|
83
94
|
* Related products schema
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules';
|
|
2
|
+
import type StateModule from '../base/stateModule';
|
|
3
|
+
import type { IError } from '../base/utils';
|
|
4
|
+
import type { ISitemapApi, ISitemapEntity, ISitemapQuery } from './sitemapInterfaces';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with sitemaps.
|
|
7
|
+
* @handle /api/content/sitemap
|
|
8
|
+
* @class SitemapApi
|
|
9
|
+
* @augments AsyncModules
|
|
10
|
+
* @implements {ISitemapApi}
|
|
11
|
+
*/
|
|
12
|
+
export default class SitemapApi extends AsyncModules implements ISitemapApi {
|
|
13
|
+
protected state: StateModule;
|
|
14
|
+
protected _url: string;
|
|
15
|
+
/**
|
|
16
|
+
* Constructor for SitemapApi class.
|
|
17
|
+
* @param {StateModule} state - The state module.
|
|
18
|
+
*/
|
|
19
|
+
constructor(state: StateModule);
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the set of sitemaps.
|
|
22
|
+
* @handleName getSitemap
|
|
23
|
+
* @returns {Promise<string[] | IError>} Returns an array of sitemap URLs.
|
|
24
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
25
|
+
*/
|
|
26
|
+
getSitemap(): Promise<ISitemapEntity[] | IError>;
|
|
27
|
+
/**
|
|
28
|
+
* Generates a new set of sitemaps.
|
|
29
|
+
* @handleName updateSitemap
|
|
30
|
+
* @param {ISitemapQuery} body - Sitemap body params.
|
|
31
|
+
* @returns {Promise<string[] | IError>} Returns an array of sitemap URLs.
|
|
32
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
33
|
+
*/
|
|
34
|
+
updateSitemap(body: ISitemapQuery): Promise<ISitemapEntity[] | IError>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
|
+
/**
|
|
8
|
+
* Controllers for working with sitemaps.
|
|
9
|
+
* @handle /api/content/sitemap
|
|
10
|
+
* @class SitemapApi
|
|
11
|
+
* @augments AsyncModules
|
|
12
|
+
* @implements {ISitemapApi}
|
|
13
|
+
*/
|
|
14
|
+
class SitemapApi extends asyncModules_1.default {
|
|
15
|
+
/**
|
|
16
|
+
* Constructor for SitemapApi class.
|
|
17
|
+
* @param {StateModule} state - The state module.
|
|
18
|
+
*/
|
|
19
|
+
constructor(state) {
|
|
20
|
+
super(state);
|
|
21
|
+
this._url = state.url + '/api/content/sitemap';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the set of sitemaps.
|
|
25
|
+
* @handleName getSitemap
|
|
26
|
+
* @returns {Promise<string[] | IError>} Returns an array of sitemap URLs.
|
|
27
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
28
|
+
*/
|
|
29
|
+
async getSitemap() {
|
|
30
|
+
const data = await this._fetchGet(`/`);
|
|
31
|
+
return this._normalizeData(data);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generates a new set of sitemaps.
|
|
35
|
+
* @handleName updateSitemap
|
|
36
|
+
* @param {ISitemapQuery} body - Sitemap body params.
|
|
37
|
+
* @returns {Promise<string[] | IError>} Returns an array of sitemap URLs.
|
|
38
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
39
|
+
*/
|
|
40
|
+
async updateSitemap(body) {
|
|
41
|
+
const data = await this._fetchPost(`/`, body);
|
|
42
|
+
return this._normalizeData(data);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = SitemapApi;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { IError } from '../base/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Query parameters for sitemap requests.
|
|
4
|
+
* @interface ISitemapQuery
|
|
5
|
+
*/
|
|
6
|
+
interface ISitemapQuery {
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Entity interface for sitemap.
|
|
11
|
+
* @property {string} url - URL of the sitemap.
|
|
12
|
+
* @property {string} lastmod - Last modification date of the sitemap.
|
|
13
|
+
* @property {string} changefreq - Frequency of changes for the sitemap.
|
|
14
|
+
* @property {string} priority - Priority of the sitemap.
|
|
15
|
+
* @interface ISitemapEntity
|
|
16
|
+
*/
|
|
17
|
+
interface ISitemapEntity {
|
|
18
|
+
url: string;
|
|
19
|
+
lastmod: string;
|
|
20
|
+
changefreq: string;
|
|
21
|
+
priority: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Interface for the Sitemap API module.
|
|
25
|
+
* @interface ISitemapApi
|
|
26
|
+
*/
|
|
27
|
+
interface ISitemapApi {
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves the set of sitemaps.
|
|
30
|
+
* @returns {Promise<ISitemapEntity[] | IError>}
|
|
31
|
+
*/
|
|
32
|
+
getSitemap(): Promise<ISitemapEntity[] | IError>;
|
|
33
|
+
/**
|
|
34
|
+
* Generates a new set of sitemaps.
|
|
35
|
+
* @param {ISitemapQuery} body - Sitemap body params.
|
|
36
|
+
* @returns {Promise<ISitemapEntity[] | IError>}
|
|
37
|
+
*/
|
|
38
|
+
updateSitemap(body: ISitemapQuery): Promise<ISitemapEntity[] | IError>;
|
|
39
|
+
}
|
|
40
|
+
export type { ISitemapApi, ISitemapEntity, ISitemapQuery };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import AsyncModules from '../base/asyncModules';
|
|
2
2
|
import type StateModule from '../base/stateModule';
|
|
3
3
|
import type { IError } from '../base/utils';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ISystemApi } from './systemInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with system - system
|
|
7
7
|
* @handle /api/content/system
|
|
8
8
|
* @description Controllers for working with system - system
|
|
9
9
|
*/
|
|
10
|
-
export default class SystemApi extends AsyncModules implements
|
|
10
|
+
export default class SystemApi extends AsyncModules implements ISystemApi {
|
|
11
11
|
protected state: StateModule;
|
|
12
12
|
protected _url: string;
|
|
13
13
|
/**
|
|
@@ -32,28 +32,6 @@ export default class SystemApi extends AsyncModules implements ISystem {
|
|
|
32
32
|
* @description This method is used to test the 500 error handling by sending a GET request to a specific endpoint.
|
|
33
33
|
*/
|
|
34
34
|
test500(): Promise<any | IError>;
|
|
35
|
-
/**
|
|
36
|
-
* Validates a CAPTCHA token by sending it to the server for verification.
|
|
37
|
-
* @handleName validateCaptcha
|
|
38
|
-
* @param {object} event - The event object containing CAPTCHA data.
|
|
39
|
-
* @example
|
|
40
|
-
{
|
|
41
|
-
"token": "03AGdBq24...",
|
|
42
|
-
"expectedAction": "login",
|
|
43
|
-
"siteKey": "6Lc_aCMTAAAAAB..."
|
|
44
|
-
}
|
|
45
|
-
* @param {string} event.token - The CAPTCHA token to be validated. Example: "03AGdBq24...".
|
|
46
|
-
* @param {string} event.expectedAction - The expected action associated with the CAPTCHA. Example: "login".
|
|
47
|
-
* @param {string} event.siteKey - The site key used for the CAPTCHA. Example: "6Lc_aCMTAAAAAB...".
|
|
48
|
-
* @returns {Promise<any | IError>} The response from the server after validating the CAPTCHA, or an error object if validation fails.
|
|
49
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
50
|
-
* @description This method sends the CAPTCHA token and related information to the server endpoint '/captcha/validate' to verify its validity.
|
|
51
|
-
*/
|
|
52
|
-
validateCaptcha(event: {
|
|
53
|
-
token: string;
|
|
54
|
-
expectedAction: string;
|
|
55
|
-
siteKey: string;
|
|
56
|
-
}): Promise<any | IError>;
|
|
57
35
|
/**
|
|
58
36
|
* Getting the number of requests to API.
|
|
59
37
|
* @handleName getApiStat
|
|
@@ -61,5 +39,5 @@ export default class SystemApi extends AsyncModules implements ISystem {
|
|
|
61
39
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
62
40
|
* @description Getting the number of requests to API.
|
|
63
41
|
*/
|
|
64
|
-
getApiStat(): Promise<any
|
|
42
|
+
getApiStat(): Promise<any>;
|
|
65
43
|
}
|
package/dist/system/systemApi.js
CHANGED
|
@@ -43,30 +43,6 @@ class SystemApi extends asyncModules_1.default {
|
|
|
43
43
|
const result = await this._fetchGet('/test500');
|
|
44
44
|
return result;
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Validates a CAPTCHA token by sending it to the server for verification.
|
|
48
|
-
* @handleName validateCaptcha
|
|
49
|
-
* @param {object} event - The event object containing CAPTCHA data.
|
|
50
|
-
* @example
|
|
51
|
-
{
|
|
52
|
-
"token": "03AGdBq24...",
|
|
53
|
-
"expectedAction": "login",
|
|
54
|
-
"siteKey": "6Lc_aCMTAAAAAB..."
|
|
55
|
-
}
|
|
56
|
-
* @param {string} event.token - The CAPTCHA token to be validated. Example: "03AGdBq24...".
|
|
57
|
-
* @param {string} event.expectedAction - The expected action associated with the CAPTCHA. Example: "login".
|
|
58
|
-
* @param {string} event.siteKey - The site key used for the CAPTCHA. Example: "6Lc_aCMTAAAAAB...".
|
|
59
|
-
* @returns {Promise<any | IError>} The response from the server after validating the CAPTCHA, or an error object if validation fails.
|
|
60
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
61
|
-
* @description This method sends the CAPTCHA token and related information to the server endpoint '/captcha/validate' to verify its validity.
|
|
62
|
-
*/
|
|
63
|
-
async validateCaptcha(event) {
|
|
64
|
-
const data = {
|
|
65
|
-
event,
|
|
66
|
-
};
|
|
67
|
-
const result = await this._fetchPost('/captcha/validate', data);
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
46
|
/**
|
|
71
47
|
* Getting the number of requests to API.
|
|
72
48
|
* @handleName getApiStat
|
|
@@ -1,23 +1,31 @@
|
|
|
1
|
+
import type { IError } from 'base/utils';
|
|
1
2
|
/**
|
|
2
|
-
* @interface
|
|
3
|
+
* @interface ISystemApi
|
|
3
4
|
* @property {Function} test404 - Test 404 error.
|
|
4
5
|
* @property {Function} test500 - Test 500 error.
|
|
5
6
|
* @description Represents a interface object of System Api.
|
|
6
7
|
*/
|
|
7
|
-
interface
|
|
8
|
+
interface ISystemApi {
|
|
8
9
|
/**
|
|
9
10
|
* Test 404 error.
|
|
10
11
|
* @handleName test404
|
|
11
12
|
* @returns {any} Returns a Promise that resolves with any data.
|
|
12
13
|
* @description This method tests 404 error.
|
|
13
14
|
*/
|
|
14
|
-
test404(): Promise<any>;
|
|
15
|
+
test404(): Promise<any | IError>;
|
|
15
16
|
/**
|
|
16
17
|
* Test 500 error.
|
|
17
18
|
* @handleName test500
|
|
18
19
|
* @returns {any} Returns a Promise that resolves with any data.
|
|
19
20
|
* @description This method tests 500 error.
|
|
20
21
|
*/
|
|
21
|
-
test500(): Promise<any>;
|
|
22
|
+
test500(): Promise<any | IError>;
|
|
23
|
+
/**
|
|
24
|
+
* getApiStat
|
|
25
|
+
* @handleName getApiStat
|
|
26
|
+
* @returns {any} Returns a Promise that resolves with any data.
|
|
27
|
+
* @description This method getApiStat.
|
|
28
|
+
*/
|
|
29
|
+
getApiStat(): Promise<any>;
|
|
22
30
|
}
|
|
23
|
-
export type {
|
|
31
|
+
export type { ISystemApi };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import AsyncModules from '../base/asyncModules';
|
|
2
2
|
import type StateModule from '../base/stateModule';
|
|
3
3
|
import type { IError } from '../base/utils';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ITemplatesPreviewApi, ITemplatesPreviewEntity } from './templatesPreviewInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with template objects for preview.
|
|
7
7
|
* @handle /api/content/template-previews
|
|
8
8
|
* @description This module provides a set of controllers for managing and retrieving template objects designed for preview purposes.
|
|
9
9
|
*/
|
|
10
|
-
export default class TemplatePreviewsApi extends AsyncModules implements
|
|
10
|
+
export default class TemplatePreviewsApi extends AsyncModules implements ITemplatesPreviewApi {
|
|
11
11
|
protected state: StateModule;
|
|
12
12
|
protected _url: string;
|
|
13
13
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { AttributeType, IError } from '../base/utils';
|
|
2
2
|
/**
|
|
3
|
-
* @interface
|
|
3
|
+
* @interface ITemplatesPreviewApi
|
|
4
4
|
* @property {Function} getTemplatePreviews - Get all template preview objects.
|
|
5
5
|
* @property {Function} getTemplatePreviewByMarker - Get one template preview object by marker.
|
|
6
6
|
* @description This interface defines methods for retrieving template previews in the system, including fetching all previews, specific previews by marker.
|
|
7
7
|
*/
|
|
8
|
-
interface
|
|
8
|
+
interface ITemplatesPreviewApi {
|
|
9
9
|
/**
|
|
10
10
|
* Retrieves all template preview objects.
|
|
11
11
|
* @param {string} langCode - Language code for localization. Default: "en_US".
|
|
@@ -118,4 +118,4 @@ interface ISquare {
|
|
|
118
118
|
side: number | string;
|
|
119
119
|
alignmentType: string;
|
|
120
120
|
}
|
|
121
|
-
export type { IProportion, ISquare,
|
|
121
|
+
export type { IProportion, ISquare, ITemplatesPreviewApi, ITemplatesPreviewEntity, };
|
package/dist/users/usersApi.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import AsyncModules from '../base/asyncModules';
|
|
2
2
|
import type StateModule from '../base/stateModule';
|
|
3
3
|
import type { IError } from '../base/utils';
|
|
4
|
-
import type { IUserBody, IUserEntity,
|
|
4
|
+
import type { IUserBody, IUserEntity, IUsersApi } from './usersInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with users
|
|
7
7
|
* @handle /api/content/users
|
|
8
8
|
* @description This module provides various methods to manage users, including creating, retrieving, updating, and deleting user data. It requires proper authorization to access these endpoints.
|
|
9
9
|
*/
|
|
10
|
-
export default class UsersApi extends AsyncModules implements
|
|
10
|
+
export default class UsersApi extends AsyncModules implements IUsersApi {
|
|
11
11
|
protected state: StateModule;
|
|
12
12
|
protected _url: string;
|
|
13
13
|
/**
|
package/dist/users/usersApi.js
CHANGED
|
@@ -116,7 +116,6 @@ class UsersApi extends asyncModules_1.default {
|
|
|
116
116
|
const result = await this._fetchPut('/me', Object.prototype.hasOwnProperty.call(body, 'formData')
|
|
117
117
|
? this._normalizePostBody(body, langCode)
|
|
118
118
|
: body);
|
|
119
|
-
// Validate response if validation is enabled
|
|
120
119
|
const validated = this._validateResponse(result, usersSchemas_1.UpdateUserResponseSchema);
|
|
121
120
|
return validated;
|
|
122
121
|
}
|
|
@@ -4,7 +4,7 @@ import type { IFormConfig } from '../forms/formsInterfaces';
|
|
|
4
4
|
import type { FormDataType } from '../forms-data/formsDataInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Interface representing user-related operations.
|
|
7
|
-
* @interface
|
|
7
|
+
* @interface IUsersApi
|
|
8
8
|
* @property {Function} getUser - Retrieves the data of an authorized user, optionally based on a language code.
|
|
9
9
|
* @property {Function} updateUser - Updates the user's data with the provided information.
|
|
10
10
|
* @property {Function} archiveUser - Archiving one user object (marked for deletion).
|
|
@@ -13,7 +13,7 @@ import type { FormDataType } from '../forms-data/formsDataInterfaces';
|
|
|
13
13
|
* @property {Function} deleteFCMToken - Deletes an existing FCM token.
|
|
14
14
|
* @description This interface defines methods for managing user data and handling Firebase Cloud Messaging tokens.
|
|
15
15
|
*/
|
|
16
|
-
interface
|
|
16
|
+
interface IUsersApi {
|
|
17
17
|
/**
|
|
18
18
|
* Retrieves the data of an authorized user.
|
|
19
19
|
* @handleName getUser
|
|
@@ -232,4 +232,4 @@ interface IUserBody {
|
|
|
232
232
|
};
|
|
233
233
|
state?: Record<string, any>;
|
|
234
234
|
}
|
|
235
|
-
export type { IUserBody, IUserEntity,
|
|
235
|
+
export type { IUserBody, IUserEntity, IUsersApi };
|
|
@@ -26,7 +26,7 @@ export declare const UserResponseSchema: z.ZodObject<{
|
|
|
26
26
|
updatedAt: z.ZodOptional<z.ZodString>;
|
|
27
27
|
}, z.core.$strip>;
|
|
28
28
|
/**
|
|
29
|
-
* Update user response schema (returns
|
|
29
|
+
* Update user response schema (returns true on success)
|
|
30
30
|
*/
|
|
31
31
|
export declare const UpdateUserResponseSchema: z.ZodBoolean;
|
|
32
32
|
/**
|
|
@@ -16,7 +16,7 @@ exports.UserResponseSchema = validation_1.UserEntitySchema.extend({
|
|
|
16
16
|
updatedAt: zod_1.z.string().optional(),
|
|
17
17
|
});
|
|
18
18
|
/**
|
|
19
|
-
* Update user response schema (returns
|
|
19
|
+
* Update user response schema (returns true on success)
|
|
20
20
|
*/
|
|
21
21
|
exports.UpdateUserResponseSchema = zod_1.z.boolean();
|
|
22
22
|
/**
|