oneentry 1.0.42 → 1.0.44

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 CHANGED
@@ -37,7 +37,7 @@ const {
37
37
  Menus,
38
38
  Pages,
39
39
  Products,
40
- ProductStatuses,
40
+ ProductstatusesSpec,
41
41
  System,
42
42
  Templates,
43
43
  TemplatePreviews
@@ -85,7 +85,7 @@ Now you can use the following links to jump to specific entries:
85
85
  - [Menus](#menus)
86
86
  - [Pages](#pages)
87
87
  - [Products](#products)
88
- - [ProductStatuses](#productstatuses)
88
+ - [ProductstatusesSpec](#productstatuses)
89
89
  - [System](#system)
90
90
  - [Templates](#templates)
91
91
  - [TemplatePreviews](#templatepreviews)
@@ -1152,7 +1152,6 @@ example: OrderedMap { "en_US": OrderedMap { "title": "My marker" } }
1152
1152
 
1153
1153
  ## <h2 id="menus"> Menus </h2>
1154
1154
 
1155
- ## Menus
1156
1155
 
1157
1156
  ```js
1158
1157
  const { Menus } = defineOneEntry('your-url')
@@ -3040,17 +3039,17 @@ example: my-template-short
3040
3039
  ---
3041
3040
 
3042
3041
 
3043
- ## <h2 id="productstatuses"> ProductStatuses </h2>
3042
+ ## <h2 id="productstatuses"> ProductstatusesSpec </h2>
3044
3043
 
3045
3044
 
3046
3045
  ```js
3047
- const { ProductStatuses } = defineOneEntry('your-url');
3046
+ const { ProductstatusesSpec } = defineOneEntry('your-url');
3048
3047
  ```
3049
3048
 
3050
- ### ProductStatuses.getProductStatuses()
3049
+ ### ProductstatusesSpec.getProductStatuses()
3051
3050
 
3052
3051
  ```js
3053
- const value = await ProductStatuses.getProductStatuses()
3052
+ const value = await ProductstatusesSpec.getProductStatuses()
3054
3053
  ```
3055
3054
 
3056
3055
  > This method searches for all product status objects from the API. It returns a Promise that resolves to an array of product status objects.
@@ -3094,10 +3093,10 @@ example: OrderedMap { "en_US": OrderedMap { "title": "Catalog", "plainContent":
3094
3093
 
3095
3094
  </details>
3096
3095
 
3097
- ### ProductStatuses.getProductStatusesById(id)
3096
+ ### ProductstatusesSpec.getProductStatusesById(id)
3098
3097
 
3099
3098
  ```js
3100
- const value = await ProductStatuses.getProductStatusesById(1)
3099
+ const value = await ProductstatusesSpec.getProductStatusesById(1)
3101
3100
  ```
3102
3101
 
3103
3102
  > This method searches for a product status object based on its identifier (id) from the API. It returns a Promise that resolves to a product status object.
@@ -3139,10 +3138,10 @@ example: OrderedMap { "en_US": OrderedMap { "title": "Catalog", "plainContent":
3139
3138
 
3140
3139
  </details>
3141
3140
 
3142
- ### ProductStatuses.getProductsByStatusMarker(marker)
3141
+ ### ProductstatusesSpec.getProductsByStatusMarker(marker)
3143
3142
 
3144
3143
  ```js
3145
- const value = await ProductStatuses.getProductsByStatusMarker('my-marker')
3144
+ const value = await ProductstatusesSpec.getProductsByStatusMarker('my-marker')
3146
3145
  ```
3147
3146
 
3148
3147
  > This method searches for a product status object based on its textual identifier (marker) from the API. It returns a Promise that resolves to a product status object.
@@ -3184,10 +3183,10 @@ example: OrderedMap { "en_US": OrderedMap { "title": "Catalog", "plainContent":
3184
3183
 
3185
3184
  </details>
3186
3185
 
3187
- ### ProductStatuses.validateMarker(marker)
3186
+ ### ProductstatusesSpec.validateMarker(marker)
3188
3187
 
3189
3188
  ```js
3190
- const value = await ProductStatuses.validateMarker('marker')
3189
+ const value = await ProductstatusesSpec.validateMarker('marker')
3191
3190
  ```
3192
3191
 
3193
3192
  > This method checks the existence of a textual identifier (marker). It takes a marker parameter as input, representing the product marker to validate. It returns a Promise that resolves to true if the textual identifier (marker) exists or false if it doesn't.
@@ -3203,7 +3202,6 @@ true
3203
3202
 
3204
3203
  ## <h2 id="system"> System </h2>
3205
3204
 
3206
- ## System
3207
3205
 
3208
3206
  ```js
3209
3207
  const { System } = defineOneEntry('your-url')
@@ -3228,7 +3226,6 @@ const value = await System.test500()
3228
3226
 
3229
3227
  ## <h2 id="templates"> Templates </h2>
3230
3228
 
3231
- ## Templates
3232
3229
 
3233
3230
  ```js
3234
3231
  const { Templates } = defineOneEntry('your-url')
@@ -3391,7 +3388,6 @@ general type name
3391
3388
 
3392
3389
  ## <h2 id="templatepreviews"> TemplatePreviews </h2>
3393
3390
 
3394
- ## TemplatePreviews
3395
3391
 
3396
3392
  ```js
3397
3393
  const { TemplatePreviews } = defineOneEntry('your-url')
@@ -1,4 +1,4 @@
1
- import { IAttributeValues } from "../base/utils";
1
+ import { AttributeType } from "../base/utils";
2
2
  /**
3
3
  * Represents a interface object of Admins Api.
4
4
  *
@@ -39,7 +39,7 @@ interface IPosition {
39
39
  */
40
40
  interface IAdminEntity {
41
41
  attributeSetId: number | null;
42
- attributeValues: IAttributeValues;
42
+ attributeValues: AttributeType;
43
43
  id: number;
44
44
  identifier: string;
45
45
  isSync: boolean;
@@ -1,4 +1,4 @@
1
- import { IAttributeValues, ILocalizeInfos } from "../base/utils";
1
+ import { IAttributeValues, LocalizeType } from "../base/utils";
2
2
  /**
3
3
  * Represents a interface object of Blocks Api.
4
4
  *
@@ -10,11 +10,12 @@ interface IBlocks {
10
10
  }
11
11
  interface IBlocksEntity {
12
12
  id: number;
13
- attributeSetId: number;
14
- localizeInfos: ILocalizeInfos;
15
- customSettings: ICustomSetting;
13
+ attributeSetId: number | null;
14
+ localizeInfos: LocalizeType;
15
+ customSettings: ICustomSetting | null;
16
16
  version: number;
17
17
  identifier: string;
18
+ isVisible: boolean;
18
19
  position: number;
19
20
  attributeValues: IAttributeValues;
20
21
  type: string;
@@ -1,5 +1,5 @@
1
1
  import OneEntry from '../base/oneEntry';
2
- import { IUploadingQuery, IUploadingReturns, IFileUploading, IFileEntity } from "./fileUploadingInterfaces";
2
+ import { IUploadingQuery, IUploadingReturns, IFileUploading } from "./fileUploadingInterfaces";
3
3
  import { IConfig } from "../base/utils";
4
4
  /**
5
5
  * Controllers for working with file uploading
@@ -47,5 +47,5 @@ export default class FileUploadingApi extends OneEntry implements IFileUploading
47
47
  *
48
48
  * @returns Return file as File object
49
49
  */
50
- getFile(id: number, type: string, entity: string, filename?: string): Promise<IFileEntity>;
50
+ getFile(id: number, type: string, entity: string, filename?: string): Promise<Blob>;
51
51
  }
@@ -37,7 +37,7 @@ class FileUploadingApi extends oneEntry_1.default {
37
37
  const body = new FormData();
38
38
  body.append('files', data);
39
39
  const result = await this._fetchPost('?' + this._queryParamsToString(query), body);
40
- return result;
40
+ return result.json();
41
41
  }
42
42
  /**
43
43
  * Deletes a file from the cloud file storage.
@@ -54,7 +54,7 @@ class FileUploadingApi extends oneEntry_1.default {
54
54
  async delete(filename, fileQuery) {
55
55
  const query = { ...this._defaultQuery, ...fileQuery };
56
56
  const result = await this._fetchDelete(`?filename=${filename}&` + this._queryParamsToString(query));
57
- return result;
57
+ return result.json();
58
58
  }
59
59
  /**
60
60
  * Get file by parameters.
@@ -68,8 +68,15 @@ class FileUploadingApi extends oneEntry_1.default {
68
68
  * @returns Return file as File object
69
69
  */
70
70
  async getFile(id, type, entity, filename) {
71
- const result = await this._fetchGet(`?id=${id}&type=${type}&entity=${entity}${filename ? `&filename=${filename}` : ''}`);
72
- return result;
71
+ const options = {
72
+ method: 'GET',
73
+ headers: {
74
+ 'Content-Type': 'application/json',
75
+ 'x-app-token': this._token,
76
+ }
77
+ };
78
+ const response = await fetch(this._getFullPath(`?id=${id}&type=${type}&entity=${entity}${filename ? `&filename=${filename}` : ''}`), options);
79
+ return response.blob();
73
80
  }
74
81
  }
75
82
  exports.default = FileUploadingApi;
@@ -8,7 +8,7 @@
8
8
  interface IFileUploading {
9
9
  upload(data: File, fileQuery?: IUploadingQuery): Promise<IUploadingReturns>;
10
10
  delete(filename: string, fileQuery?: IUploadingQuery): Promise<any>;
11
- getFile(id: number, type: string, entity: string, filename?: string): Promise<IFileEntity>;
11
+ getFile(id: number, type: string, entity: string, filename?: string): Promise<Blob>;
12
12
  }
13
13
  interface IFileEntity {
14
14
  file: File | string | null;
@@ -1,4 +1,4 @@
1
- import { IAttributes, ILocalizeInfos } from "../base/utils";
1
+ import { IAttributes, LocalizeType } from "../base/utils";
2
2
  /**
3
3
  * Represents an interface object of Forms Api.
4
4
  *
@@ -25,11 +25,11 @@ interface IForms {
25
25
  * @property {number} position - The position of the object.
26
26
  */
27
27
  interface IFormsEntity {
28
- attributeSetId: number;
29
- attributes: Array<IAttributes>;
28
+ attributeSetId: number | null;
29
+ attributes: Array<IAttributes> | Object;
30
30
  id: number;
31
31
  identifier: string;
32
- localizeInfos: ILocalizeInfos;
32
+ localizeInfos: LocalizeType;
33
33
  position: number;
34
34
  processingData: object | string;
35
35
  processingType: string;
@@ -55,7 +55,7 @@ class FormsDataApi extends oneEntry_1.default {
55
55
  * @returns Returns array of object FormDataEntity
56
56
  */
57
57
  async getFormsDataByMarker(marker, langCode = this._defaultLangCode, offset = 0, limit = 30) {
58
- const result = await this._fetchGet(`/${marker}?langCode=${langCode}&offset=${offset}&limit=${limit}`);
58
+ const result = await this._fetchGet(`marker/${marker}?langCode=${langCode}&offset=${offset}&limit=${limit}`);
59
59
  return this._normalizeData(result);
60
60
  }
61
61
  }
@@ -27,7 +27,6 @@ interface IFormsDataEntity {
27
27
  formIdentifier: string;
28
28
  time: Date | string;
29
29
  formData: IFormData;
30
- attributeSetIdentifier: string;
31
30
  }
32
31
  /**
33
32
  * @property {string} [formIdentifier] - Text identifier of the form object (marker)
@@ -58,9 +57,9 @@ interface IFormData {
58
57
  * @property {IFormData} formData - The identifier of the page.
59
58
  */
60
59
  interface IFormsPost {
61
- id: number;
60
+ id?: number;
62
61
  formIdentifier: string;
63
- time: Date | string;
62
+ time?: Date | string;
64
63
  formData: IFormData;
65
64
  }
66
65
  export { IFormsPost, IFormsData, IFormsDataEntity };
@@ -26,7 +26,7 @@ interface ILocalEntity {
26
26
  name: string;
27
27
  nativeName: string;
28
28
  isActive: boolean;
29
- image: string;
29
+ image: string | null;
30
30
  position: number;
31
31
  }
32
32
  export { ILocales, ILocalEntity };
@@ -33,7 +33,7 @@ export default class PageApi extends OneEntry implements IPageApi {
33
33
  *
34
34
  * @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
35
35
  */
36
- getPages(langCode: string): Promise<Array<IPagesEntity>>;
36
+ getPages(langCode?: string): Promise<Array<IPagesEntity>>;
37
37
  /**
38
38
  * Get page object with information about forms, blocks, menus, linked to the page.
39
39
  *
@@ -42,9 +42,9 @@ class PageApi extends oneEntry_1.default {
42
42
  *
43
43
  * @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
44
44
  */
45
- async getPages(langCode) {
45
+ async getPages(langCode = this._defaultLangCode) {
46
46
  const result = await this._fetchGet(`?langCode=${langCode}`);
47
- return this._normalizeData(result.items);
47
+ return this._normalizeData(result);
48
48
  }
49
49
  /**
50
50
  * Get page object with information about forms, blocks, menus, linked to the page.
@@ -96,7 +96,7 @@ class PageApi extends oneEntry_1.default {
96
96
  */
97
97
  async getFormsByPageUrl(url, langCode = this._defaultLangCode) {
98
98
  const result = await this._fetchGet(`/${url}/forms?langCode=${langCode}`);
99
- return this._normalizeData(result.items);
99
+ return this._normalizeData(result);
100
100
  }
101
101
  /**
102
102
  * Get all blocks by page url.
@@ -109,7 +109,7 @@ class PageApi extends oneEntry_1.default {
109
109
  */
110
110
  async getBlocksByPageUrl(url, langCode = this._defaultLangCode) {
111
111
  const result = await this._fetchGet(`/${url}/blocks?langCode=${langCode}`);
112
- return this._normalizeData(result.items);
112
+ return this._normalizeData(result);
113
113
  }
114
114
  /**
115
115
  * Get settings for the page.
@@ -133,7 +133,7 @@ class PageApi extends oneEntry_1.default {
133
133
  */
134
134
  async searchPage(name, langCode = this._defaultLangCode) {
135
135
  const result = await this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
136
- return this._normalizeData(result.items);
136
+ return this._normalizeData(result);
137
137
  }
138
138
  }
139
139
  exports.default = PageApi;
@@ -140,17 +140,19 @@ interface IPagesEntity {
140
140
  * @property {langCode.<object>}
141
141
  */
142
142
  attributeValues: AttributeType;
143
- childrenCount: number;
144
- config: Record<string, number>;
143
+ childrenCount?: number;
144
+ config?: Record<string, number>;
145
145
  depth: number;
146
146
  id: number;
147
147
  isSync: boolean;
148
148
  isVisible: boolean;
149
+ forms?: Record<string, any>;
150
+ blocks?: Record<string, any>;
149
151
  localizeInfos: LocalizeType;
150
152
  pageUrl: string;
151
153
  parentId: number | null;
152
- position: number;
153
- products: number;
154
+ position?: number;
155
+ products?: number;
154
156
  templateIdentifier: string;
155
157
  type: Types;
156
158
  }
@@ -16,7 +16,7 @@ class ProductStatusesApi extends oneEntry_1.default {
16
16
  */
17
17
  async getProductStatuses() {
18
18
  const result = await this._fetchGet('');
19
- return result;
19
+ return this._normalizeData(result);
20
20
  }
21
21
  /**
22
22
  * Search for a product status object by identifier.
@@ -27,7 +27,7 @@ class ProductStatusesApi extends oneEntry_1.default {
27
27
  */
28
28
  async getProductStatusesById(id) {
29
29
  const result = await this._fetchGet(`/${id}`);
30
- return result;
30
+ return this._normalizeData(result);
31
31
  }
32
32
  /**
33
33
  * Search for a product status object by its textual identifier (marker).
@@ -38,7 +38,7 @@ class ProductStatusesApi extends oneEntry_1.default {
38
38
  */
39
39
  async getProductsByStatusMarker(marker) {
40
40
  const result = await this._fetchGet(`/marker/${marker}`);
41
- return result;
41
+ return this._normalizeData(result);
42
42
  }
43
43
  /**
44
44
  * Check the existence of a textual identifier.
@@ -1,4 +1,4 @@
1
- import { ILocalizeInfos } from "../base/utils";
1
+ import { LocalizeType } from "../base/utils";
2
2
  /**
3
3
  * Represents an interface object of Product Statuses Api.
4
4
  *
@@ -32,6 +32,6 @@ interface IProductStatusEntity {
32
32
  updatedDate: string | Date;
33
33
  version: number;
34
34
  identifier: string;
35
- localizeInfos: ILocalizeInfos;
35
+ localizeInfos: LocalizeType;
36
36
  }
37
37
  export { IProductStatuses, IProductStatusEntity };
@@ -120,7 +120,7 @@ interface IProductsEntity {
120
120
  attributeSetId: number;
121
121
  isSync: number | boolean;
122
122
  price: number;
123
- templateIdentifier: string;
123
+ templateIdentifier: string | null;
124
124
  shortDescTemplateIdentifier: string;
125
125
  /**
126
126
  * Language-specific attribute values.
@@ -130,5 +130,6 @@ interface IProductsEntity {
130
130
  */
131
131
  attributeValues: AttributeType;
132
132
  position: number;
133
+ productPages: Array<Object>;
133
134
  }
134
135
  export { IFilterParams, IProductsQuery, IProductApi, IProductsEntity };
@@ -16,7 +16,7 @@ class TemplatesPreviewApi extends oneEntry_1.default {
16
16
  */
17
17
  async getAllTemplates() {
18
18
  const result = await this._fetchGet('/all');
19
- return result;
19
+ return this._normalizeData(result);
20
20
  }
21
21
  /**
22
22
  * Get template objects by type.
@@ -27,7 +27,7 @@ class TemplatesPreviewApi extends oneEntry_1.default {
27
27
  */
28
28
  async getTemplateByType(type) {
29
29
  const result = await this._fetchGet(`?type=${type}`);
30
- return result;
30
+ return this._normalizeData(result);
31
31
  }
32
32
  }
33
33
  exports.default = TemplatesPreviewApi;
@@ -29,14 +29,14 @@ interface ITemplatesApi {
29
29
  */
30
30
  interface ITemplateEntity {
31
31
  id: number;
32
- updateDate: string | Date;
32
+ updateDate?: string | Date;
33
33
  version: number;
34
34
  identifier: string;
35
- generalType: IGeneralTypesEntity;
35
+ generalType?: IGeneralTypesEntity;
36
36
  generalTypeId: number;
37
37
  localizeInfos: ILocalizeInfos;
38
38
  position: number;
39
- positionId: number;
39
+ positionId?: number;
40
40
  generalTypeName: Types;
41
41
  }
42
42
  export { ITemplatesApi, ITemplateEntity };
@@ -16,7 +16,7 @@ class TemplatePreviewsApi extends oneEntry_1.default {
16
16
  */
17
17
  async getTemplatePreviews() {
18
18
  const result = await this._fetchGet('');
19
- return result;
19
+ return this._normalizeData(result);
20
20
  }
21
21
  /**
22
22
  * Get one template object by id.
@@ -27,7 +27,7 @@ class TemplatePreviewsApi extends oneEntry_1.default {
27
27
  */
28
28
  async getTemplatePreviewById(id) {
29
29
  const result = await this._fetchGet(`/${id}`);
30
- return result;
30
+ return this._normalizeData(result);
31
31
  }
32
32
  /**
33
33
  * Get one template object by marker.
@@ -38,7 +38,7 @@ class TemplatePreviewsApi extends oneEntry_1.default {
38
38
  */
39
39
  async getTemplatePreviewByMarker(marker) {
40
40
  const result = await this._fetchGet(`/marker/${marker}`);
41
- return result;
41
+ return this._normalizeData(result);
42
42
  }
43
43
  }
44
44
  exports.default = TemplatePreviewsApi;
package/package.json CHANGED
@@ -1,19 +1,25 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
8
  "/dist"
9
9
  ],
10
+ "scripts": {
11
+ "test": "jest"
12
+ },
10
13
  "author": "ONEENTRY PORTAL CO.",
11
14
  "license": "ISC",
12
15
  "dependencies": {
13
- "jsdoc": "^4.0.2",
14
- "typescript": "^5.2.2"
16
+ "jsdoc": "^4.0.2"
15
17
  },
16
18
  "devDependencies": {
17
- "@types/node": "^20.10.4"
19
+ "@types/jest": "^29.5.11",
20
+ "@types/node": "^20.10.5",
21
+ "jest": "^29.7.0",
22
+ "ts-jest": "^29.1.1",
23
+ "typescript": "^5.3.3"
18
24
  }
19
25
  }