oneentry 1.0.65 → 1.0.67

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 (59) hide show
  1. package/README.md +304 -243
  2. package/dist/_cjs/admins/adminsApi.d.ts +1 -1
  3. package/dist/admins/adminsApi.d.ts +6 -4
  4. package/dist/admins/adminsApi.js +6 -6
  5. package/dist/attribute-sets/attributeSetsApi.d.ts +6 -4
  6. package/dist/attribute-sets/attributeSetsApi.js +7 -7
  7. package/dist/auth-provider/authProviderApi.d.ts +6 -4
  8. package/dist/auth-provider/authProviderApi.js +14 -10
  9. package/dist/auth-provider/authProvidersInterfaces.d.ts +2 -2
  10. package/dist/base/asyncModules.d.ts +16 -0
  11. package/dist/base/asyncModules.js +164 -0
  12. package/dist/base/modules.d.ts +14 -0
  13. package/dist/base/modules.js +173 -0
  14. package/dist/base/oneEntry.d.ts +0 -23
  15. package/dist/base/oneEntry.js +74 -236
  16. package/dist/base/stateModule.d.ts +10 -0
  17. package/dist/base/stateModule.js +13 -0
  18. package/dist/base/syncModules.d.ts +14 -0
  19. package/dist/base/syncModules.js +72 -0
  20. package/dist/blocks/blocksApi.d.ts +9 -6
  21. package/dist/blocks/blocksApi.js +17 -16
  22. package/dist/blocks/blocksInterfaces.d.ts +3 -2
  23. package/dist/events/eventsApi.d.ts +6 -4
  24. package/dist/events/eventsApi.js +5 -5
  25. package/dist/file-uploding/fileUploadingApi.d.ts +6 -4
  26. package/dist/file-uploding/fileUploadingApi.js +6 -6
  27. package/dist/forms/formsApi.d.ts +7 -5
  28. package/dist/forms/formsApi.js +8 -8
  29. package/dist/formsData/formsDataApi.d.ts +8 -6
  30. package/dist/formsData/formsDataApi.js +10 -10
  31. package/dist/general-types/typesApi.d.ts +6 -4
  32. package/dist/general-types/typesApi.js +5 -5
  33. package/dist/index.js +22 -20
  34. package/dist/locales/localesApi.d.ts +6 -4
  35. package/dist/locales/localesApi.js +5 -5
  36. package/dist/menus/menusApi.d.ts +7 -5
  37. package/dist/menus/menusApi.js +7 -7
  38. package/dist/orders/ordersApi.d.ts +6 -4
  39. package/dist/orders/ordersApi.js +10 -10
  40. package/dist/pages/pagesApi.d.ts +6 -4
  41. package/dist/pages/pagesApi.js +16 -19
  42. package/dist/payments/paymentsApi.d.ts +6 -10
  43. package/dist/payments/paymentsApi.js +5 -14
  44. package/dist/payments/paymentsInterfaces.d.ts +0 -2
  45. package/dist/product-statuses/productStatusesApi.d.ts +6 -4
  46. package/dist/product-statuses/productStatusesApi.js +8 -8
  47. package/dist/products/productsApi.d.ts +107 -52
  48. package/dist/products/productsApi.js +119 -65
  49. package/dist/products/productsInterfaces.d.ts +16 -8
  50. package/dist/system/systemApi.d.ts +6 -4
  51. package/dist/system/systemApi.js +5 -5
  52. package/dist/templates/templatesApi.d.ts +9 -6
  53. package/dist/templates/templatesApi.js +9 -9
  54. package/dist/templates/templatesInterfaces.d.ts +2 -1
  55. package/dist/templates-preview/templatesPreviewApi.d.ts +8 -6
  56. package/dist/templates-preview/templatesPreviewApi.js +10 -10
  57. package/dist/users/usersApi.d.ts +6 -4
  58. package/dist/users/usersApi.js +7 -7
  59. package/package.json +1 -1
@@ -1,11 +1,13 @@
1
- import OneEntry from "../base/oneEntry";
1
+ import AsyncModules from "../base/asyncModules";
2
2
  import { ISystem } from "./systemInterfaces";
3
- import { IConfig } from "../base/utils";
3
+ import StateModule from "../base/stateModule";
4
4
  /**
5
5
  * Controllers for working with system - system
6
6
  */
7
- export default class SystemApi extends OneEntry implements ISystem {
8
- constructor(url: string, config: IConfig);
7
+ export default class SystemApi extends AsyncModules implements ISystem {
8
+ protected state: StateModule;
9
+ protected _url: string;
10
+ constructor(state: StateModule);
9
11
  test404(): Promise<any>;
10
12
  test500(): Promise<any>;
11
13
  }
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const oneEntry_1 = require("../base/oneEntry");
3
+ const asyncModules_1 = require("../base/asyncModules");
4
4
  /**
5
5
  * Controllers for working with system - system
6
6
  */
7
- class SystemApi extends oneEntry_1.default {
8
- constructor(url, config) {
9
- super(url, config);
10
- this._url += '/api/content/system';
7
+ class SystemApi extends asyncModules_1.default {
8
+ constructor(state) {
9
+ super(state);
10
+ this._url = state.url + '/api/content/system';
11
11
  }
12
12
  async test404() {
13
13
  const result = await this._fetchGet('/test404');
@@ -1,11 +1,14 @@
1
- import OneEntry from '../base/oneEntry';
1
+ import AsyncModules from '../base/asyncModules';
2
2
  import { ITemplatesApi, ITemplateEntity, ITemplateList } from './templatesInterfaces';
3
- import { IConfig, Types } from "../base/utils";
3
+ import StateModule from "../base/stateModule";
4
+ import { BlockType } from "../blocks/blocksInterfaces";
4
5
  /**
5
6
  * Controllers for working with template objects
6
7
  */
7
- export default class TemplatesPreviewApi extends OneEntry implements ITemplatesApi {
8
- constructor(url: string, config: IConfig);
8
+ export default class TemplatesPreviewApi extends AsyncModules implements ITemplatesApi {
9
+ protected state: StateModule;
10
+ protected _url: string;
11
+ constructor(state: StateModule);
9
12
  /**
10
13
  * Get all template objects grouped by types.
11
14
  * @param {string} [langCode] - Optional parameter language code
@@ -16,12 +19,12 @@ export default class TemplatesPreviewApi extends OneEntry implements ITemplatesA
16
19
  /**
17
20
  * Get template objects by type.
18
21
  *
19
- * @param {Types} type - Product marker
22
+ * @param {BlockType} type - Product marker
20
23
  * @param {string} [langCode] - Optional parameter language code
21
24
  *
22
25
  * @returns Returns a TemplateEntity object
23
26
  */
24
- getTemplateByType(type: Types, langCode?: string): Promise<Array<ITemplateEntity>>;
27
+ getTemplateByType(type: BlockType): Promise<Array<ITemplateEntity>>;
25
28
  /**
26
29
  * Get one template object by id.
27
30
  *
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const oneEntry_1 = require("../base/oneEntry");
3
+ const asyncModules_1 = require("../base/asyncModules");
4
4
  /**
5
5
  * Controllers for working with template objects
6
6
  */
7
- class TemplatesPreviewApi extends oneEntry_1.default {
8
- constructor(url, config) {
9
- super(url, config);
10
- this._url += '/api/content/templates';
7
+ class TemplatesPreviewApi extends asyncModules_1.default {
8
+ constructor(state) {
9
+ super(state);
10
+ this._url = state.url + '/api/content/templates';
11
11
  }
12
12
  /**
13
13
  * Get all template objects grouped by types.
@@ -15,7 +15,7 @@ class TemplatesPreviewApi extends oneEntry_1.default {
15
15
  *
16
16
  * @returns Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
17
17
  */
18
- async getAllTemplates(langCode = this._defaultLangCode) {
18
+ async getAllTemplates(langCode = this.state.lang) {
19
19
  const response = await this._fetchGet('/all');
20
20
  const result = {};
21
21
  for (let item in response) {
@@ -26,14 +26,14 @@ class TemplatesPreviewApi extends oneEntry_1.default {
26
26
  /**
27
27
  * Get template objects by type.
28
28
  *
29
- * @param {Types} type - Product marker
29
+ * @param {BlockType} type - Product marker
30
30
  * @param {string} [langCode] - Optional parameter language code
31
31
  *
32
32
  * @returns Returns a TemplateEntity object
33
33
  */
34
- async getTemplateByType(type, langCode = this._defaultLangCode) {
34
+ async getTemplateByType(type) {
35
35
  const result = await this._fetchGet(`?type=${type}`);
36
- return this._normalizeData(result, langCode);
36
+ return result;
37
37
  }
38
38
  /**
39
39
  * Get one template object by id.
@@ -1,5 +1,6 @@
1
1
  import { IGeneralTypesEntity } from "../general-types/generalTypesInterfaces";
2
2
  import { Types } from "../base/utils";
3
+ import { BlockType } from "../blocks/blocksInterfaces";
3
4
  /**
4
5
  * Represents an interface object of Templates Api.
5
6
  *
@@ -9,7 +10,7 @@ import { Types } from "../base/utils";
9
10
  */
10
11
  interface ITemplatesApi {
11
12
  getAllTemplates(langCode: string): Promise<ITemplateList>;
12
- getTemplateByType(type: Types, langCode: string): Promise<Array<ITemplateEntity>>;
13
+ getTemplateByType(type: BlockType, langCode: string): Promise<Array<ITemplateEntity>>;
13
14
  getTemplateById(id: string): Promise<ITemplateList>;
14
15
  }
15
16
  /**
@@ -1,11 +1,13 @@
1
- import OneEntry from "../base/oneEntry";
1
+ import AsyncModules from "../base/asyncModules";
2
2
  import { ITemplatesPreview, ITemplatesPreviewEntity } from "./templatesPreviewInterfaces";
3
- import { IConfig } from "../base/utils";
3
+ import StateModule from "../base/stateModule";
4
4
  /**
5
5
  * Controllers for working with template objects for preview
6
6
  */
7
- export default class TemplatePreviewsApi extends OneEntry implements ITemplatesPreview {
8
- constructor(url: string, config: IConfig);
7
+ export default class TemplatePreviewsApi extends AsyncModules implements ITemplatesPreview {
8
+ protected state: StateModule;
9
+ protected _url: string;
10
+ constructor(state: StateModule);
9
11
  /**
10
12
  * Get all template objects.
11
13
  * @param {string} [langCode] - Optional parameter language code
@@ -16,7 +18,7 @@ export default class TemplatePreviewsApi extends OneEntry implements ITemplatesP
16
18
  /**
17
19
  * Get one template object by id.
18
20
  *
19
- * @param {number} [id] - Product marker
21
+ * @param {number} id - Product marker
20
22
  * @param {string} [langCode] - Optional parameter language code
21
23
  *
22
24
  * @returns Returns a TemplatePreviewsEntity object
@@ -25,7 +27,7 @@ export default class TemplatePreviewsApi extends OneEntry implements ITemplatesP
25
27
  /**
26
28
  * Get one template object by marker.
27
29
  *
28
- * @param {string} [marker] - Product marker
30
+ * @param {string} marker - Product marker
29
31
  * @param {string} [langCode] - Optional parameter language code
30
32
  *
31
33
  * @returns Returns a TemplatePreviewsEntity object
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const oneEntry_1 = require("../base/oneEntry");
3
+ const asyncModules_1 = require("../base/asyncModules");
4
4
  /**
5
5
  * Controllers for working with template objects for preview
6
6
  */
7
- class TemplatePreviewsApi extends oneEntry_1.default {
8
- constructor(url, config) {
9
- super(url, config);
10
- this._url += '/api/content/template-previews';
7
+ class TemplatePreviewsApi extends asyncModules_1.default {
8
+ constructor(state) {
9
+ super(state);
10
+ this._url = state.url + '/api/content/template-previews';
11
11
  }
12
12
  /**
13
13
  * Get all template objects.
@@ -15,31 +15,31 @@ class TemplatePreviewsApi extends oneEntry_1.default {
15
15
  *
16
16
  * @returns Returns all TemplatePreviewsEntity template objects
17
17
  */
18
- async getTemplatePreviews(langCode = this._defaultLangCode) {
18
+ async getTemplatePreviews(langCode = this.state.lang) {
19
19
  const result = await this._fetchGet('');
20
20
  return this._normalizeData(result, langCode);
21
21
  }
22
22
  /**
23
23
  * Get one template object by id.
24
24
  *
25
- * @param {number} [id] - Product marker
25
+ * @param {number} id - Product marker
26
26
  * @param {string} [langCode] - Optional parameter language code
27
27
  *
28
28
  * @returns Returns a TemplatePreviewsEntity object
29
29
  */
30
- async getTemplatePreviewById(id, langCode = this._defaultLangCode) {
30
+ async getTemplatePreviewById(id, langCode = this.state.lang) {
31
31
  const result = await this._fetchGet(`/${id}`);
32
32
  return this._normalizeData(result, langCode);
33
33
  }
34
34
  /**
35
35
  * Get one template object by marker.
36
36
  *
37
- * @param {string} [marker] - Product marker
37
+ * @param {string} marker - Product marker
38
38
  * @param {string} [langCode] - Optional parameter language code
39
39
  *
40
40
  * @returns Returns a TemplatePreviewsEntity object
41
41
  */
42
- async getTemplatePreviewByMarker(marker, langCode = this._defaultLangCode) {
42
+ async getTemplatePreviewByMarker(marker, langCode = this.state.lang) {
43
43
  const result = await this._fetchGet(`/marker/${marker}`);
44
44
  return this._normalizeData(result, langCode);
45
45
  }
@@ -1,11 +1,13 @@
1
- import OneEntry from "../base/oneEntry";
2
- import { IConfig } from "../base/utils";
1
+ import AsyncModules from "../base/asyncModules";
3
2
  import { IUserBody, IUserEntity, IUsers } from "./usersInterfaces";
3
+ import StateModule from "../base/stateModule";
4
4
  /**
5
5
  * Controllers for working with users
6
6
  */
7
- export default class UsersApi extends OneEntry implements IUsers {
8
- constructor(url: string, config: IConfig);
7
+ export default class UsersApi extends AsyncModules implements IUsers {
8
+ protected state: StateModule;
9
+ protected _url: string;
10
+ constructor(state: StateModule);
9
11
  /**
10
12
  * Getting the data of an authorized user.
11
13
  * @param {string} [langCode] Required parameter lang code.
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const oneEntry_1 = require("../base/oneEntry");
3
+ const asyncModules_1 = require("../base/asyncModules");
4
4
  /**
5
5
  * Controllers for working with users
6
6
  */
7
- class UsersApi extends oneEntry_1.default {
8
- constructor(url, config) {
9
- super(url, config);
10
- this._url += '/api/content/users';
7
+ class UsersApi extends asyncModules_1.default {
8
+ constructor(state) {
9
+ super(state);
10
+ this._url = state.url + '/api/content/users';
11
11
  }
12
12
  /**
13
13
  * Getting the data of an authorized user.
14
14
  * @param {string} [langCode] Required parameter lang code.
15
15
  */
16
- async getUser(langCode = this._defaultLangCode) {
16
+ async getUser(langCode = this.state.lang) {
17
17
  const result = await this._fetchGet(`/me?langCode=${langCode}`);
18
18
  return result;
19
19
  }
@@ -43,7 +43,7 @@ class UsersApi extends oneEntry_1.default {
43
43
  * }
44
44
  * }
45
45
  */
46
- async updateUser(data, langCode = this._defaultLangCode) {
46
+ async updateUser(data, langCode = this.state.lang) {
47
47
  const result = await this._fetchPut('', this._normalizePostBody(data));
48
48
  return result;
49
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.65",
3
+ "version": "1.0.67",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",