oneentry 1.0.152 → 1.0.154

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 (70) hide show
  1. package/changelog.md +49 -0
  2. package/dist/admins/adminsApi.d.ts +2 -1
  3. package/dist/admins/adminsApi.js +2 -1
  4. package/dist/admins/adminsInterfaces.d.ts +1 -1
  5. package/dist/attribute-sets/attributeSetsApi.d.ts +4 -0
  6. package/dist/attribute-sets/attributeSetsApi.js +4 -0
  7. package/dist/auth-provider/authProviderApi.d.ts +14 -1
  8. package/dist/auth-provider/authProviderApi.js +14 -1
  9. package/dist/base/asyncModules.d.ts +21 -2
  10. package/dist/base/asyncModules.js +74 -225
  11. package/dist/base/stateModule.d.ts +4 -13
  12. package/dist/base/stateModule.js +12 -96
  13. package/dist/base/syncModules.d.ts +4 -0
  14. package/dist/base/syncModules.js +5 -1
  15. package/dist/blocks/blocksApi.d.ts +54 -11
  16. package/dist/blocks/blocksApi.js +90 -73
  17. package/dist/blocks/blocksInterfaces.d.ts +18 -9
  18. package/dist/discounts/discountsApi.d.ts +5 -0
  19. package/dist/discounts/discountsApi.js +5 -0
  20. package/dist/events/eventsApi.d.ts +7 -0
  21. package/dist/events/eventsApi.js +11 -28
  22. package/dist/file-uploading/fileUploadingApi.d.ts +4 -1
  23. package/dist/file-uploading/fileUploadingApi.js +4 -1
  24. package/dist/file-uploading/fileUploadingInterfaces.d.ts +1 -1
  25. package/dist/filters/filtersApi.d.ts +1 -0
  26. package/dist/filters/filtersApi.js +1 -0
  27. package/dist/forms/formsApi.d.ts +2 -0
  28. package/dist/forms/formsApi.js +2 -0
  29. package/dist/forms-data/formsDataApi.d.ts +5 -0
  30. package/dist/forms-data/formsDataApi.js +5 -0
  31. package/dist/general-types/generalTypesApi.d.ts +1 -0
  32. package/dist/general-types/generalTypesApi.js +1 -0
  33. package/dist/index.js +12 -0
  34. package/dist/integration-collections/integrationCollectionsApi.d.ts +10 -1
  35. package/dist/integration-collections/integrationCollectionsApi.js +10 -1
  36. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +1 -1
  37. package/dist/locales/localesApi.d.ts +1 -0
  38. package/dist/locales/localesApi.js +1 -0
  39. package/dist/menus/menusApi.d.ts +1 -0
  40. package/dist/menus/menusApi.js +1 -0
  41. package/dist/orders/ordersApi.d.ts +25 -1
  42. package/dist/orders/ordersApi.js +36 -12
  43. package/dist/orders/ordersInterfaces.d.ts +5 -2
  44. package/dist/pages/pagesApi.d.ts +9 -0
  45. package/dist/pages/pagesApi.js +35 -39
  46. package/dist/pages/pagesInterfaces.d.ts +5 -0
  47. package/dist/payments/paymentsApi.d.ts +6 -0
  48. package/dist/payments/paymentsApi.js +6 -0
  49. package/dist/product-statuses/productStatusesApi.d.ts +3 -0
  50. package/dist/product-statuses/productStatusesApi.js +3 -0
  51. package/dist/products/productsApi.d.ts +39 -64
  52. package/dist/products/productsApi.js +33 -61
  53. package/dist/products/productsInterfaces.d.ts +76 -72
  54. package/dist/sitemap/sitemapApi.d.ts +2 -0
  55. package/dist/sitemap/sitemapApi.js +2 -0
  56. package/dist/subscriptions/subscriptionsApi.d.ts +5 -0
  57. package/dist/subscriptions/subscriptionsApi.js +7 -14
  58. package/dist/system/systemApi.d.ts +3 -0
  59. package/dist/system/systemApi.js +3 -0
  60. package/dist/templates/templatesApi.d.ts +3 -0
  61. package/dist/templates/templatesApi.js +3 -0
  62. package/dist/templates-preview/templatesPreviewApi.d.ts +2 -0
  63. package/dist/templates-preview/templatesPreviewApi.js +2 -0
  64. package/dist/user-activity/userActivityApi.d.ts +1 -0
  65. package/dist/user-activity/userActivityApi.js +1 -0
  66. package/dist/users/usersApi.d.ts +14 -0
  67. package/dist/users/usersApi.js +14 -0
  68. package/dist/web-socket/wsApi.d.ts +1 -1
  69. package/dist/web-socket/wsApi.js +1 -1
  70. package/package.json +4 -1
@@ -32,6 +32,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
32
32
  * @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
33
33
  * @throws {IError} When isShell=false and an error occurs during the fetch
34
34
  * @description Fetches all discounts from the server.
35
+ * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getAllDiscounts getAllDiscounts} documentation.
35
36
  */
36
37
  getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?: IDiscountType): Promise<IDiscountsResponse | IError>;
37
38
  /**
@@ -42,6 +43,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
42
43
  * @returns {Promise<IDiscountsEntity | IError>} Returns an object containing discount by marker or an error object if there was an issue.
43
44
  * @throws {IError} When isShell=false and an error occurs during the fetch
44
45
  * @description Fetches a discount by its marker.
46
+ * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getDiscountByMarker getDiscountByMarker} documentation.
45
47
  */
46
48
  getDiscountByMarker(marker: string, langCode?: string): Promise<IDiscountsEntity | IError>;
47
49
  /**
@@ -49,6 +51,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
49
51
  * @handleName getBonusBalance
50
52
  * @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
51
53
  * @throws {IError} When isShell=false and an error occurs during the fetch
54
+ * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusBalance getBonusBalance} documentation.
52
55
  */
53
56
  getBonusBalance(): Promise<IBonusBalanceEntity | IError>;
54
57
  /**
@@ -62,6 +65,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
62
65
  * @param {boolean} [isAdmin] - Admin filter.
63
66
  * @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
64
67
  * @throws {IError} When isShell=false and an error occurs during the fetch
68
+ * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusHistory getBonusHistory} documentation.
65
69
  */
66
70
  getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
67
71
  /**
@@ -71,6 +75,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
71
75
  * @returns {Promise<ICouponValidationResult | IError>} Returns an coupon validation result or an error object if there was an issue.
72
76
  * @throws {IError} When isShell=false and an error occurs during the fetch
73
77
  * @description This function validates a coupon code and returns the result.
78
+ * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/validateDiscountsCoupon validateDiscountsCoupon} documentation.
74
79
  */
75
80
  validateDiscountsCoupon(code: string): Promise<ICouponValidationResult | IError>;
76
81
  }
@@ -35,6 +35,7 @@ class DiscountsApi extends asyncModules_1.default {
35
35
  * @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
36
36
  * @throws {IError} When isShell=false and an error occurs during the fetch
37
37
  * @description Fetches all discounts from the server.
38
+ * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getAllDiscounts getAllDiscounts} documentation.
38
39
  */
39
40
  async getAllDiscounts(langCode = this.state.lang, offset = 0, limit = 30, type) {
40
41
  const query = {
@@ -54,6 +55,7 @@ class DiscountsApi extends asyncModules_1.default {
54
55
  * @returns {Promise<IDiscountsEntity | IError>} Returns an object containing discount by marker or an error object if there was an issue.
55
56
  * @throws {IError} When isShell=false and an error occurs during the fetch
56
57
  * @description Fetches a discount by its marker.
58
+ * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getDiscountByMarker getDiscountByMarker} documentation.
57
59
  */
58
60
  async getDiscountByMarker(marker, langCode = this.state.lang) {
59
61
  const query = {
@@ -68,6 +70,7 @@ class DiscountsApi extends asyncModules_1.default {
68
70
  * @handleName getBonusBalance
69
71
  * @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
70
72
  * @throws {IError} When isShell=false and an error occurs during the fetch
73
+ * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusBalance getBonusBalance} documentation.
71
74
  */
72
75
  async getBonusBalance() {
73
76
  const data = await this._fetchGet(`/bonus-balance`);
@@ -84,6 +87,7 @@ class DiscountsApi extends asyncModules_1.default {
84
87
  * @param {boolean} [isAdmin] - Admin filter.
85
88
  * @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
86
89
  * @throws {IError} When isShell=false and an error occurs during the fetch
90
+ * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusHistory getBonusHistory} documentation.
87
91
  */
88
92
  async getBonusHistory(type, dateFrom, dateTo, discountId, moduleId, isAdmin) {
89
93
  const query = {
@@ -104,6 +108,7 @@ class DiscountsApi extends asyncModules_1.default {
104
108
  * @returns {Promise<ICouponValidationResult | IError>} Returns an coupon validation result or an error object if there was an issue.
105
109
  * @throws {IError} When isShell=false and an error occurs during the fetch
106
110
  * @description This function validates a coupon code and returns the result.
111
+ * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/validateDiscountsCoupon validateDiscountsCoupon} documentation.
107
112
  */
108
113
  async validateDiscountsCoupon(code) {
109
114
  const query = {
@@ -31,6 +31,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
31
31
  * @throws {IError} When isShell=false and an error occurs during the fetch
32
32
  * @description This method requires user authorization.
33
33
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
34
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/getAllSubscriptions getAllSubscriptions} documentation.
34
35
  */
35
36
  getAllSubscriptions(offset?: number, limit?: number): Promise<ISubscriptions | IError>;
36
37
  /**
@@ -43,6 +44,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
43
44
  * @throws {IError} When isShell=false and an error occurs during the fetch
44
45
  * @description This method requires user authorization.
45
46
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
47
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/subscribeByMarker subscribeByMarker} documentation.
46
48
  */
47
49
  subscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
48
50
  /**
@@ -55,6 +57,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
55
57
  * @throws {IError} When isShell=false and an error occurs during the fetch
56
58
  * @description This method requires user authorization.
57
59
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
60
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/unsubscribeByMarker unsubscribeByMarker} documentation.
58
61
  */
59
62
  unsubscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
60
63
  /**
@@ -63,6 +66,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
63
66
  * @returns {Promise<IContentApiEvent[] | IError>} Returns an array of available events.
64
67
  * @throws {IError} When isShell=false and an error occurs during the fetch
65
68
  * @description This method returns all available events.
69
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/getAllEvents getAllEvents} documentation.
66
70
  */
67
71
  getAllEvents(): Promise<IContentApiEvent[] | IError>;
68
72
  /**
@@ -74,6 +78,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
74
78
  * @throws {IError} When isShell=false and an error occurs during the fetch
75
79
  * @description This method requires user authorization.
76
80
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
81
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/subscribeToForm subscribeToForm} documentation.
77
82
  */
78
83
  subscribeToForm(marker: string, body: ISubscribeFormEvent): Promise<boolean | IError>;
79
84
  /**
@@ -85,6 +90,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
85
90
  * @throws {IError} When isShell=false and an error occurs during the fetch
86
91
  * @description This method requires user authorization.
87
92
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
93
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/getFormSubscriptions getFormSubscriptions} documentation.
88
94
  */
89
95
  getFormSubscriptions(offset?: number, limit?: number): Promise<IListFormSubscription[] | IError>;
90
96
  /**
@@ -96,6 +102,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
96
102
  * @throws {IError} When isShell=false and an error occurs during the fetch
97
103
  * @description This method requires user authorization.
98
104
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
105
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/unsubscribeFromForm unsubscribeFromForm} documentation.
99
106
  */
100
107
  unsubscribeFromForm(marker: string, body: ISubscribeFormEvent): Promise<boolean | IError>;
101
108
  }
@@ -36,6 +36,7 @@ class EventsApi extends asyncModules_1.default {
36
36
  * @throws {IError} When isShell=false and an error occurs during the fetch
37
37
  * @description This method requires user authorization.
38
38
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
39
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/getAllSubscriptions getAllSubscriptions} documentation.
39
40
  */
40
41
  async getAllSubscriptions(offset = 0, limit = 30) {
41
42
  const query = {
@@ -55,19 +56,14 @@ class EventsApi extends asyncModules_1.default {
55
56
  * @throws {IError} When isShell=false and an error occurs during the fetch
56
57
  * @description This method requires user authorization.
57
58
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
59
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/subscribeByMarker subscribeByMarker} documentation.
58
60
  */
59
61
  async subscribeByMarker(marker, productId, langCode = this.state.lang) {
60
62
  const body = {
61
63
  locale: langCode,
62
64
  productId,
63
65
  };
64
- try {
65
- await this._fetchPost(`/subscribe/marker/${marker}`, body);
66
- return true;
67
- }
68
- catch (e) {
69
- return e;
70
- }
66
+ return this._fetchBoolean(() => this._fetchPost(`/subscribe/marker/${marker}`, body));
71
67
  }
72
68
  /**
73
69
  * Unsubscribing to an event on a product.
@@ -79,19 +75,14 @@ class EventsApi extends asyncModules_1.default {
79
75
  * @throws {IError} When isShell=false and an error occurs during the fetch
80
76
  * @description This method requires user authorization.
81
77
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
78
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/unsubscribeByMarker unsubscribeByMarker} documentation.
82
79
  */
83
80
  async unsubscribeByMarker(marker, productId, langCode = this.state.lang) {
84
81
  const body = {
85
82
  productId: productId,
86
83
  locale: langCode,
87
84
  };
88
- try {
89
- await this._fetchDelete(`/unsubscribe/marker/${marker}`, body);
90
- return true;
91
- }
92
- catch (e) {
93
- return e;
94
- }
85
+ return this._fetchBoolean(() => this._fetchDelete(`/unsubscribe/marker/${marker}`, body));
95
86
  }
96
87
  /**
97
88
  * Returns all available events.
@@ -99,6 +90,7 @@ class EventsApi extends asyncModules_1.default {
99
90
  * @returns {Promise<IContentApiEvent[] | IError>} Returns an array of available events.
100
91
  * @throws {IError} When isShell=false and an error occurs during the fetch
101
92
  * @description This method returns all available events.
93
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/getAllEvents getAllEvents} documentation.
102
94
  */
103
95
  async getAllEvents() {
104
96
  const data = await this._fetchGet(`/all`);
@@ -113,15 +105,10 @@ class EventsApi extends asyncModules_1.default {
113
105
  * @throws {IError} When isShell=false and an error occurs during the fetch
114
106
  * @description This method requires user authorization.
115
107
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
108
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/subscribeToForm subscribeToForm} documentation.
116
109
  */
117
110
  async subscribeToForm(marker, body) {
118
- try {
119
- await this._fetchPost(`/forms/subscribe/marker/${marker}`, body);
120
- return true;
121
- }
122
- catch (e) {
123
- return e;
124
- }
111
+ return this._fetchBoolean(() => this._fetchPost(`/forms/subscribe/marker/${marker}`, body));
125
112
  }
126
113
  /**
127
114
  * Returns all form subscriptions.
@@ -132,6 +119,7 @@ class EventsApi extends asyncModules_1.default {
132
119
  * @throws {IError} When isShell=false and an error occurs during the fetch
133
120
  * @description This method requires user authorization.
134
121
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
122
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/getFormSubscriptions getFormSubscriptions} documentation.
135
123
  */
136
124
  async getFormSubscriptions(offset = 0, limit = 30) {
137
125
  const query = {
@@ -150,15 +138,10 @@ class EventsApi extends asyncModules_1.default {
150
138
  * @throws {IError} When isShell=false and an error occurs during the fetch
151
139
  * @description This method requires user authorization.
152
140
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
141
+ * @see {@link https://js-sdk.oneentry.cloud/docs/events/unsubscribeFromForm unsubscribeFromForm} documentation.
153
142
  */
154
143
  async unsubscribeFromForm(marker, body) {
155
- try {
156
- await this._fetchDelete(`/forms/unsubscribe/marker/${marker}`, body);
157
- return true;
158
- }
159
- catch (e) {
160
- return e;
161
- }
144
+ return this._fetchBoolean(() => this._fetchDelete(`/forms/unsubscribe/marker/${marker}`, body));
162
145
  }
163
146
  }
164
147
  exports.default = EventsApi;
@@ -43,6 +43,7 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
43
43
  * @param {string | number} [fileQuery.template] - preview template identifier. Example: 1.
44
44
  * @returns {Promise<IUploadingReturn[] | IError>} Uploads a file to an Amazon S3-compatible cloud file storage.
45
45
  * @throws {IError} When isShell=false and an error occurs during the fetch
46
+ * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/upload upload} documentation.
46
47
  */
47
48
  upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
48
49
  /**
@@ -63,6 +64,7 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
63
64
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
64
65
  * @returns {Promise<boolean | IError>} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
65
66
  * @throws {IError} When isShell=false and an error occurs during the fetch
67
+ * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/delete delete} documentation.
66
68
  */
67
69
  delete(filename: string, fileQuery?: IUploadingQuery): Promise<boolean | IError>;
68
70
  /**
@@ -80,9 +82,10 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
80
82
  * @param {string} type - Type, determines the folder name in the storage. Example: "page".
81
83
  * @param {string} entity - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
82
84
  * @param {string} filename - Filename. Example: "file.png".
83
- * @param {string} [template] - Preview template identifier. Example: 1.
85
+ * @param {string} [template] - Preview template identifier. Example: "preview_template".
84
86
  * @returns {Promise<Response | IError>} Returns a promise that resolves to a Response object containing the file data or an error object if there was an issue.
85
87
  * @throws {IError} When isShell=false and an error occurs during the fetch
88
+ * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/getFile getFile} documentation.
86
89
  */
87
90
  getFile(id: number, type: string, entity: string, filename: string, template?: string): Promise<Response | IError>;
88
91
  }
@@ -55,6 +55,7 @@ class FileUploadingApi extends asyncModules_1.default {
55
55
  * @param {string | number} [fileQuery.template] - preview template identifier. Example: 1.
56
56
  * @returns {Promise<IUploadingReturn[] | IError>} Uploads a file to an Amazon S3-compatible cloud file storage.
57
57
  * @throws {IError} When isShell=false and an error occurs during the fetch
58
+ * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/upload upload} documentation.
58
59
  */
59
60
  async upload(file, fileQuery) {
60
61
  const query = { ...this._defaultQuery, ...fileQuery };
@@ -83,6 +84,7 @@ class FileUploadingApi extends asyncModules_1.default {
83
84
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
84
85
  * @returns {Promise<boolean | IError>} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
85
86
  * @throws {IError} When isShell=false and an error occurs during the fetch
87
+ * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/delete delete} documentation.
86
88
  */
87
89
  async delete(filename, fileQuery) {
88
90
  const query = { ...this._defaultQuery, ...fileQuery };
@@ -110,9 +112,10 @@ class FileUploadingApi extends asyncModules_1.default {
110
112
  * @param {string} type - Type, determines the folder name in the storage. Example: "page".
111
113
  * @param {string} entity - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
112
114
  * @param {string} filename - Filename. Example: "file.png".
113
- * @param {string} [template] - Preview template identifier. Example: 1.
115
+ * @param {string} [template] - Preview template identifier. Example: "preview_template".
114
116
  * @returns {Promise<Response | IError>} Returns a promise that resolves to a Response object containing the file data or an error object if there was an issue.
115
117
  * @throws {IError} When isShell=false and an error occurs during the fetch
118
+ * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/getFile getFile} documentation.
116
119
  */
117
120
  async getFile(id, type, entity, filename, template) {
118
121
  // eslint-disable-next-line no-undef
@@ -66,7 +66,7 @@ interface IFileUploading {
66
66
  * @param {string} type - Type, determines the folder name in the storage. Example: "page".
67
67
  * @param {string} entity - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
68
68
  * @param {string} filename - Filename. Example: "file.png".
69
- * @param {string} [template] - Preview template identifier. Example: 1.
69
+ * @param {string} [template] - Preview template identifier. Example: "1".
70
70
  * @returns {Response | IError} Returns a promise that resolves to a Response object containing the file data or an error object if there was an issue.
71
71
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
72
72
  */
@@ -26,6 +26,7 @@ export default class FiltersApi extends AsyncModules implements IFiltersApi {
26
26
  * @returns {Promise<IContentFilter | IError>} Returns the filter with its items tree.
27
27
  * @throws {IError} When isShell=false and an error occurs during the fetch
28
28
  * @description Retrieves a single content filter by marker.
29
+ * @see {@link https://js-sdk.oneentry.cloud/docs/filters/getFilterByMarker getFilterByMarker} documentation.
29
30
  */
30
31
  getFilterByMarker(marker: string, langCode?: string): Promise<IContentFilter | IError>;
31
32
  }
@@ -30,6 +30,7 @@ class FiltersApi extends asyncModules_1.default {
30
30
  * @returns {Promise<IContentFilter | IError>} Returns the filter with its items tree.
31
31
  * @throws {IError} When isShell=false and an error occurs during the fetch
32
32
  * @description Retrieves a single content filter by marker.
33
+ * @see {@link https://js-sdk.oneentry.cloud/docs/filters/getFilterByMarker getFilterByMarker} documentation.
33
34
  */
34
35
  async getFilterByMarker(marker, langCode = this.state.lang) {
35
36
  const data = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
@@ -28,6 +28,7 @@ export default class FormsApi extends AsyncModules implements IForms {
28
28
  * @param {number} [limit] - Parameter for pagination. Default: 30.
29
29
  * @returns {Promise<IFormsResponse | IError>} Returns paginated object with array of FormEntity and total count.
30
30
  * @throws {IError} When isShell=false and an error occurs during the fetch
31
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms/getAllForms getAllForms} documentation.
31
32
  */
32
33
  getAllForms(langCode?: string, offset?: number, limit?: number): Promise<IFormsResponse | IError>;
33
34
  /**
@@ -37,6 +38,7 @@ export default class FormsApi extends AsyncModules implements IForms {
37
38
  * @param {string} [langCode] - Language code. Default: "en_US".
38
39
  * @returns {Promise<IFormsEntity | IError>} Returns object of type FormEntity.
39
40
  * @throws {IError} When isShell=false and an error occurs during the fetch
41
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms/getFormByMarker getFormByMarker} documentation.
40
42
  */
41
43
  getFormByMarker(marker: string, langCode?: string): Promise<IFormsEntity | IError>;
42
44
  }
@@ -32,6 +32,7 @@ class FormsApi extends asyncModules_1.default {
32
32
  * @param {number} [limit] - Parameter for pagination. Default: 30.
33
33
  * @returns {Promise<IFormsResponse | IError>} Returns paginated object with array of FormEntity and total count.
34
34
  * @throws {IError} When isShell=false and an error occurs during the fetch
35
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms/getAllForms getAllForms} documentation.
35
36
  */
36
37
  async getAllForms(langCode = this.state.lang, offset = 0, limit = 30) {
37
38
  const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
@@ -46,6 +47,7 @@ class FormsApi extends asyncModules_1.default {
46
47
  * @param {string} [langCode] - Language code. Default: "en_US".
47
48
  * @returns {Promise<IFormsEntity | IError>} Returns object of type FormEntity.
48
49
  * @throws {IError} When isShell=false and an error occurs during the fetch
50
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms/getFormByMarker getFormByMarker} documentation.
49
51
  */
50
52
  async getFormByMarker(marker, langCode = this.state.lang) {
51
53
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
@@ -56,6 +56,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
56
56
  * @param {string} [langCode] - Language code. Default: "en_US".
57
57
  * @returns {Promise<IPostFormResponse | IError>} Returns an object containing the created form data entry and message.
58
58
  * @throws {IError} When isShell=false and an error occurs during the fetch
59
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/postFormsData postFormsData} documentation.
59
60
  */
60
61
  postFormsData(body: IBodyPostFormData, langCode?: string): Promise<IPostFormResponse | IError>;
61
62
  /**
@@ -79,6 +80,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
79
80
  * @param {number} [limit] - Parameter for pagination. Default: 30.
80
81
  * @returns {Promise<IFormsByMarkerDataEntity | IError>} Returns an object containing the form data or an error object if there was an issue.
81
82
  * @throws {IError} When isShell=false and an error occurs during the fetch
83
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByMarker getFormsDataByMarker} documentation.
82
84
  */
83
85
  getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: object, isExtended?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsByMarkerDataEntity | IError>;
84
86
  /**
@@ -86,6 +88,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
86
88
  * @handleName updateFormsDataByid
87
89
  * @param {number} id - ID of the form data. Example: 1.
88
90
  * @returns {Promise<IUpdateFormsData | IError>} Returns an object containing the updated form data or an error object if there was an issue.
91
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/updateFormsDataByid updateFormsDataByid} documentation.
89
92
  */
90
93
  updateFormsDataByid(id: number, body?: object): Promise<IUpdateFormsData | IError>;
91
94
  /**
@@ -94,6 +97,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
94
97
  * @param {number} id - ID of the form data. Example: 1.
95
98
  * @param {object} body - Request body.
96
99
  * @returns {Promise<boolean | IError>} Returns an object containing the updated form data or an error object if there was an issue.
100
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/updateFormsDataStatusByid updateFormsDataStatusByid} documentation.
97
101
  */
98
102
  updateFormsDataStatusByid(id: number, body?: object): Promise<boolean | IError>;
99
103
  /**
@@ -101,6 +105,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
101
105
  * @handleName deleteFormsDataByid
102
106
  * @param {number} id - ID of the form data. Example: 1.
103
107
  * @returns {Promise<boolean | IError>} Returns an object containing the deleted form data or an error object if there was an issue.
108
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/deleteFormsDataByid deleteFormsDataByid} documentation.
104
109
  */
105
110
  deleteFormsDataByid(id: number): Promise<boolean | IError>;
106
111
  }
@@ -62,6 +62,7 @@ class FormsDataApi extends asyncModules_1.default {
62
62
  * @param {string} [langCode] - Language code. Default: "en_US".
63
63
  * @returns {Promise<IPostFormResponse | IError>} Returns an object containing the created form data entry and message.
64
64
  * @throws {IError} When isShell=false and an error occurs during the fetch
65
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/postFormsData postFormsData} documentation.
65
66
  */
66
67
  async postFormsData(body, langCode = this.state.lang) {
67
68
  const formData = {};
@@ -145,6 +146,7 @@ class FormsDataApi extends asyncModules_1.default {
145
146
  * @param {number} [limit] - Parameter for pagination. Default: 30.
146
147
  * @returns {Promise<IFormsByMarkerDataEntity | IError>} Returns an object containing the form data or an error object if there was an issue.
147
148
  * @throws {IError} When isShell=false and an error occurs during the fetch
149
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByMarker getFormsDataByMarker} documentation.
148
150
  */
149
151
  async getFormsDataByMarker(marker, formModuleConfigId, body = {}, isExtended = 0, langCode = this.state.lang, offset = 0, limit = 30) {
150
152
  const result = await this._fetchPost(`/marker/${marker}?formModuleConfigId=${formModuleConfigId}&isExtended=${isExtended}&langCode=${langCode}&offset=${offset}&limit=${limit}`, body);
@@ -157,6 +159,7 @@ class FormsDataApi extends asyncModules_1.default {
157
159
  * @handleName updateFormsDataByid
158
160
  * @param {number} id - ID of the form data. Example: 1.
159
161
  * @returns {Promise<IUpdateFormsData | IError>} Returns an object containing the updated form data or an error object if there was an issue.
162
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/updateFormsDataByid updateFormsDataByid} documentation.
160
163
  */
161
164
  async updateFormsDataByid(id, body = {}) {
162
165
  const result = await this._fetchPut(`/${id}`, body);
@@ -170,6 +173,7 @@ class FormsDataApi extends asyncModules_1.default {
170
173
  * @param {number} id - ID of the form data. Example: 1.
171
174
  * @param {object} body - Request body.
172
175
  * @returns {Promise<boolean | IError>} Returns an object containing the updated form data or an error object if there was an issue.
176
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/updateFormsDataStatusByid updateFormsDataStatusByid} documentation.
173
177
  */
174
178
  async updateFormsDataStatusByid(id, body = {}) {
175
179
  const result = await this._fetchPut(`/${id}/update-status`, body);
@@ -180,6 +184,7 @@ class FormsDataApi extends asyncModules_1.default {
180
184
  * @handleName deleteFormsDataByid
181
185
  * @param {number} id - ID of the form data. Example: 1.
182
186
  * @returns {Promise<boolean | IError>} Returns an object containing the deleted form data or an error object if there was an issue.
187
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/deleteFormsDataByid deleteFormsDataByid} documentation.
183
188
  */
184
189
  async deleteFormsDataByid(id) {
185
190
  const result = await this._fetchDelete(`/${id}`);
@@ -23,6 +23,7 @@ export default class GeneralTypesApi extends AsyncModules implements IGeneralTyp
23
23
  * @returns {Promise<IGeneralTypesEntity[] | IError>} Returns an array of general types or an error object if there was an issue.
24
24
  * @throws {IError} When isShell=false and an error occurs during the fetch
25
25
  * @description This method retrieves all general types available in the system.
26
+ * @see {@link https://js-sdk.oneentry.cloud/docs/general-types/getAllTypes getAllTypes} documentation.
26
27
  */
27
28
  getAllTypes(): Promise<IGeneralTypesEntity[] | IError>;
28
29
  }
@@ -27,6 +27,7 @@ class GeneralTypesApi extends asyncModules_1.default {
27
27
  * @returns {Promise<IGeneralTypesEntity[] | IError>} Returns an array of general types or an error object if there was an issue.
28
28
  * @throws {IError} When isShell=false and an error occurs during the fetch
29
29
  * @description This method retrieves all general types available in the system.
30
+ * @see {@link https://js-sdk.oneentry.cloud/docs/general-types/getAllTypes getAllTypes} documentation.
30
31
  */
31
32
  async getAllTypes() {
32
33
  const result = await this._fetchGet('');
package/dist/index.js CHANGED
@@ -53,6 +53,18 @@ const wsApi_1 = __importDefault(require("./web-socket/wsApi"));
53
53
  * @description Define API.
54
54
  */
55
55
  function defineOneEntry(url, config) {
56
+ if (typeof url !== 'string' || url.trim() === '') {
57
+ throw new Error('OneEntry SDK: project URL is required to initialize the SDK. ' +
58
+ 'Pass a non-empty URL as the first argument of defineOneEntry, e.g. ' +
59
+ 'defineOneEntry("https://your-project.oneentry.cloud", { token: "your-app-token" }).');
60
+ }
61
+ if (!config ||
62
+ typeof config.token !== 'string' ||
63
+ config.token.trim() === '') {
64
+ throw new Error('OneEntry SDK: app token is required to initialize the SDK. ' +
65
+ 'Pass it via config, e.g. ' +
66
+ 'defineOneEntry("https://your-project.oneentry.cloud", { token: "your-app-token" }).');
67
+ }
56
68
  const stateModule = new stateModule_1.default(url.endsWith('/') ? url.slice(0, -1) : url, config);
57
69
  const Admins = new adminsApi_1.default(stateModule);
58
70
  const AttributesSets = new attributeSetsApi_1.default(stateModule);
@@ -35,6 +35,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
35
35
  * @param {string} [userQuery.entityType] - Entity type. Example: "orders".
36
36
  * @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
37
37
  * @returns {Promise<ICollectionEntity[] | IError>} Returns an array of ICollection objects or an error object if there was an issue.
38
+ * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollections getICollections} documentation.
38
39
  */
39
40
  getICollections(langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionEntity[] | IError>;
40
41
  /**
@@ -44,6 +45,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
44
45
  * @param {string} [langCode] - Language code. Default: "en_US".
45
46
  * @returns {Promise<ICollectionEntity | IError>} Returns an ICollection object or an error object if there was an issue.
46
47
  * @throws {IError} When isShell=false and an error occurs during the fetch
48
+ * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionById getICollectionById} documentation.
47
49
  */
48
50
  getICollectionById(id: number, langCode?: string): Promise<ICollectionEntity | IError>;
49
51
  /**
@@ -61,11 +63,12 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
61
63
  }
62
64
  * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
63
65
  * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
64
- * @param {number} [userQuery.entityType] - Entity type. Example: "orders".
66
+ * @param {string} [userQuery.entityType] - Entity type. Example: "orders".
65
67
  * @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
66
68
  * @returns {Promise<ICollectionRowsResponce | IError>} Returns object ItemsWithTotal, where items is an array of requested objects.
67
69
  * @throws {IError} When isShell=false and an error occurs during the fetch
68
70
  * @description Get all records belonging to the collection by collection id.
71
+ * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsById getICollectionRowsById} documentation.
69
72
  */
70
73
  getICollectionRowsById(id: number, langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionRowsResponce | IError>;
71
74
  /**
@@ -79,6 +82,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
79
82
  }
80
83
  * @throws {IError} When isShell=false and an error occurs during the fetch
81
84
  * @description Check for the existence of a text identifier (marker).
85
+ * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/validateICollectionMarker validateICollectionMarker} documentation.
82
86
  */
83
87
  validateICollectionMarker(marker: string): Promise<ICollectionIsValid | IError>;
84
88
  /**
@@ -88,6 +92,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
88
92
  * @param {string} [langCode] - Language code. Default: "en_US".
89
93
  * @returns {Promise<ICollectionRowsResponce | IError>} Returns CollectionRowEntity object.
90
94
  * @throws {IError} When isShell=false and an error occurs during the fetch
95
+ * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsByMarker getICollectionRowsByMarker} documentation.
91
96
  */
92
97
  getICollectionRowsByMarker(marker: string, langCode?: string): Promise<ICollectionRowsResponce | IError>;
93
98
  /**
@@ -98,6 +103,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
98
103
  * @param {string} [langCode] - Language code. Default: "en_US".
99
104
  * @returns {Promise<ICollectionRow | IError>} Returns CollectionRowEntity object.
100
105
  * @throws {IError} When isShell=false and an error occurs during the fetch
106
+ * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowByMarkerAndId getICollectionRowByMarkerAndId} documentation.
101
107
  */
102
108
  getICollectionRowByMarkerAndId(marker: string, id: number, langCode?: string): Promise<ICollectionRow | IError>;
103
109
  /**
@@ -120,6 +126,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
120
126
  * @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
121
127
  * @throws {IError} When isShell=false and an error occurs during the fetch
122
128
  * @description Create a record in the collection.
129
+ * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/createICollectionRow createICollectionRow} documentation.
123
130
  */
124
131
  createICollectionRow(marker: string, body: ICollectionFormObject, langCode?: string): Promise<ICollectionRow | IError>;
125
132
  /**
@@ -145,6 +152,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
145
152
  * @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
146
153
  * @throws {IError} When isShell=false and an error occurs during the fetch
147
154
  * @description Edit a record in the collection.
155
+ * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/updateICollectionRow updateICollectionRow} documentation.
148
156
  */
149
157
  updateICollectionRow(marker: string, id: number, body: {
150
158
  formIdentifier: string;
@@ -158,6 +166,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
158
166
  * @returns {Promise<boolean | IError>} Returns true (in case of successful deletion) or false (in case of unsuccessful deletion) (permission "collections.row.delete" required for access)
159
167
  * @throws {IError} When isShell=false and an error occurs during the fetch
160
168
  * @description Deletion of collection record object
169
+ * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/deleteICollectionRowByMarkerAndId deleteICollectionRowByMarkerAndId} documentation.
161
170
  */
162
171
  deleteICollectionRowByMarkerAndId(marker: string, id: number): Promise<boolean | IError>;
163
172
  }