oneentry 1.0.123 → 1.0.125

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 (76) hide show
  1. package/README.md +24 -22
  2. package/dist/admins/adminsApi.d.ts +30 -9
  3. package/dist/admins/adminsApi.js +30 -9
  4. package/dist/admins/adminsInterfaces.d.ts +77 -32
  5. package/dist/attribute-sets/attributeSetsApi.d.ts +36 -22
  6. package/dist/attribute-sets/attributeSetsApi.js +41 -25
  7. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +133 -39
  8. package/dist/auth-provider/authProviderApi.d.ts +209 -88
  9. package/dist/auth-provider/authProviderApi.js +226 -87
  10. package/dist/auth-provider/authProvidersInterfaces.d.ts +345 -18
  11. package/dist/base/asyncModules.d.ts +38 -28
  12. package/dist/base/asyncModules.js +178 -47
  13. package/dist/base/result.js +23 -0
  14. package/dist/base/syncModules.d.ts +48 -44
  15. package/dist/base/syncModules.js +84 -64
  16. package/dist/base/utils.d.ts +1 -1
  17. package/dist/blocks/blocksApi.d.ts +48 -27
  18. package/dist/blocks/blocksApi.js +48 -27
  19. package/dist/blocks/blocksInterfaces.d.ts +126 -32
  20. package/dist/events/eventsApi.d.ts +45 -12
  21. package/dist/events/eventsApi.js +47 -12
  22. package/dist/events/eventsInterfaces.d.ts +50 -3
  23. package/dist/file-uploading/fileUploadingApi.d.ts +57 -29
  24. package/dist/file-uploading/fileUploadingApi.js +57 -30
  25. package/dist/file-uploading/fileUploadingInterfaces.d.ts +90 -17
  26. package/dist/forms/formsApi.d.ts +20 -9
  27. package/dist/forms/formsApi.js +19 -8
  28. package/dist/forms/formsInterfaces.d.ts +86 -23
  29. package/dist/formsData/formsDataApi.d.ts +33 -21
  30. package/dist/formsData/formsDataApi.js +33 -21
  31. package/dist/formsData/formsDataInterfaces.d.ts +212 -41
  32. package/dist/general-types/generalTypesApi.d.ts +11 -2
  33. package/dist/general-types/generalTypesApi.js +10 -1
  34. package/dist/general-types/generalTypesInterfaces.d.ts +17 -6
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.js +2 -2
  37. package/dist/integration-collections/integrationCollectionsApi.d.ts +134 -81
  38. package/dist/integration-collections/integrationCollectionsApi.js +135 -83
  39. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +246 -43
  40. package/dist/locales/localesApi.d.ts +5 -1
  41. package/dist/locales/localesApi.js +5 -1
  42. package/dist/locales/localesInterfaces.d.ts +19 -12
  43. package/dist/menus/menusApi.d.ts +6 -3
  44. package/dist/menus/menusApi.js +6 -3
  45. package/dist/menus/menusInterfaces.d.ts +60 -21
  46. package/dist/orders/ordersApi.d.ts +84 -66
  47. package/dist/orders/ordersApi.js +91 -71
  48. package/dist/orders/ordersInterfaces.d.ts +282 -86
  49. package/dist/pages/pagesApi.d.ts +101 -42
  50. package/dist/pages/pagesApi.js +93 -39
  51. package/dist/pages/pagesInterfaces.d.ts +218 -75
  52. package/dist/payments/paymentsApi.d.ts +53 -39
  53. package/dist/payments/paymentsApi.js +55 -40
  54. package/dist/payments/paymentsInterfaces.d.ts +121 -56
  55. package/dist/product-statuses/productStatusesApi.d.ts +17 -17
  56. package/dist/product-statuses/productStatusesApi.js +16 -19
  57. package/dist/product-statuses/productStatusesInterfaces.d.ts +43 -14
  58. package/dist/products/productsApi.d.ts +309 -177
  59. package/dist/products/productsApi.js +313 -167
  60. package/dist/products/productsInterfaces.d.ts +447 -81
  61. package/dist/system/systemApi.d.ts +42 -12
  62. package/dist/system/systemApi.js +43 -10
  63. package/dist/system/systemInterfaces.d.ts +7 -0
  64. package/dist/templates/templatesApi.d.ts +24 -20
  65. package/dist/templates/templatesApi.js +22 -21
  66. package/dist/templates/templatesInterfaces.d.ts +48 -22
  67. package/dist/templates-preview/templatesPreviewApi.d.ts +17 -17
  68. package/dist/templates-preview/templatesPreviewApi.js +16 -19
  69. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +85 -32
  70. package/dist/users/usersApi.d.ts +59 -35
  71. package/dist/users/usersApi.js +62 -35
  72. package/dist/users/usersInterfaces.d.ts +136 -14
  73. package/dist/web-socket/wsApi.d.ts +4 -5
  74. package/dist/web-socket/wsApi.js +4 -5
  75. package/dist/web-socket/wsInterfaces.d.ts +2 -1
  76. package/package.json +20 -18
@@ -1,9 +1,16 @@
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 { IFileUploading, IUploadingQuery, IUploadingReturns } from './fileUploadingInterfaces';
4
+ import type { IFileUploading, IUploadingQuery, IUploadingReturn } from './fileUploadingInterfaces';
5
5
  /**
6
6
  * Controllers for working with file uploading
7
+ *
8
+ * @handle /api/content/files
9
+ * @class FileUploadingApi
10
+ * @extends AsyncModules
11
+ * @implements {IFileUploading}
12
+ *
13
+ * @description This class provides methods to upload and delete files in a cloud file storage, as well as retrieve files by parameters.
7
14
  */
8
15
  export default class FileUploadingApi extends AsyncModules implements IFileUploading {
9
16
  protected state: StateModule;
@@ -13,45 +20,66 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
13
20
  /**
14
21
  * Upload file function.
15
22
  *
16
- * @param {File} [data] File objects. Get data as File from your unput as e.target.files[0]
23
+ * @handleName upload
17
24
  *
18
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
19
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
20
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
21
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
22
- * @param {number} [fileQuery.width] - Optional width parameter. Example: 0
23
- * @param {number} [fileQuery.height] - Optional height parameter. Example: 0
24
- * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true
25
- * @param {boolean} [fileQuery.template] - preview template identifier. Example: 1
26
- *
27
- * @returns Uploads a file to an Amazon S3-compatible cloud file storage
25
+ * @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
26
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
27
+ {
28
+ "type": "page",
29
+ "entity": "editor",
30
+ "id": 3787,
31
+ "width": 0,
32
+ "height": 0,
33
+ "compress": true,
34
+ "template": 1
35
+ }
36
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
37
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
38
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
39
+ * @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
40
+ * @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
41
+ * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
42
+ * @param {any} [fileQuery.template] - preview template identifier. Example: 1.
43
+ * @return {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
44
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
45
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
28
46
  */
29
- upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturns | IError>;
47
+ upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
30
48
  /**
31
49
  * Deletes a file from the cloud file storage.
32
50
  *
33
- * @param {string} [filename] File name. Example "file.png"
34
- *
35
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
36
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
37
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
38
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
39
- * @param {number} [fileQuery.template] - preview template identifier. Example: 1
51
+ * @handleName delete
40
52
  *
41
- * @returns Deletes a file from the cloud file storage
53
+ * @param {string} [filename] - File name. Example: "file.png".
54
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
55
+ {
56
+ "type": "page",
57
+ "entity": "editor",
58
+ "id": 3787,
59
+ "template": 1
60
+ }
61
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
62
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
63
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
64
+ * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
65
+ * @return {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
66
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
67
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
42
68
  */
43
69
  delete(filename: string, fileQuery?: IUploadingQuery): Promise<any | IError>;
44
70
  /**
45
71
  * Get file by parameters.
46
72
  *
47
- * @param {number} [id] - Object identifier, from which the file is uploaded, determines the folder name in the storage
48
- *
49
- * @param {string} [type] - Type, determines the folder name in the storage
50
- * @param {string} [entity] - entity name, from which the file is uploaded, determines the folder name in the storage
51
- * @param {string} [filename] - Filename. Example "file.png"
52
- * @param {string} [template] - preview template identifier. Example 1
73
+ * @handleName getFile
53
74
  *
54
- * @returns Return file as File object
75
+ * @param {number} [id] - Object identifier, from which the file is uploaded, determines the folder name in the storage. Example: 3787.
76
+ * @param {string} [type] - Type, determines the folder name in the storage. Example: "page".
77
+ * @param {string} [entity] - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
78
+ * @param {string} [filename] - Filename. Example: "file.png".
79
+ * @param {string} [template] - Preview template identifier. Example: 1.
80
+ * @return {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
81
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
82
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
55
83
  */
56
- getFile(id: number, type: string, entity: string, filename?: string, template?: string): Promise<Blob | IError>;
84
+ getFile(id: number, type: string, entity: string, filename: string, template?: string): Promise<any | IError>;
57
85
  }
@@ -3,11 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- /* eslint-disable @typescript-eslint/no-explicit-any */
7
6
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
8
7
  // import { IFileEntity } from './fileUploadingInterfaces';
9
8
  /**
10
9
  * Controllers for working with file uploading
10
+ *
11
+ * @handle /api/content/files
12
+ * @class FileUploadingApi
13
+ * @extends AsyncModules
14
+ * @implements {IFileUploading}
15
+ *
16
+ * @description This class provides methods to upload and delete files in a cloud file storage, as well as retrieve files by parameters.
11
17
  */
12
18
  class FileUploadingApi extends asyncModules_1.default {
13
19
  constructor(state) {
@@ -25,18 +31,29 @@ class FileUploadingApi extends asyncModules_1.default {
25
31
  /**
26
32
  * Upload file function.
27
33
  *
28
- * @param {File} [data] File objects. Get data as File from your unput as e.target.files[0]
34
+ * @handleName upload
29
35
  *
30
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
31
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
32
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
33
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
34
- * @param {number} [fileQuery.width] - Optional width parameter. Example: 0
35
- * @param {number} [fileQuery.height] - Optional height parameter. Example: 0
36
- * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true
37
- * @param {boolean} [fileQuery.template] - preview template identifier. Example: 1
38
- *
39
- * @returns Uploads a file to an Amazon S3-compatible cloud file storage
36
+ * @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
37
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
38
+ {
39
+ "type": "page",
40
+ "entity": "editor",
41
+ "id": 3787,
42
+ "width": 0,
43
+ "height": 0,
44
+ "compress": true,
45
+ "template": 1
46
+ }
47
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
48
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
49
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
50
+ * @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
51
+ * @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
52
+ * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
53
+ * @param {any} [fileQuery.template] - preview template identifier. Example: 1.
54
+ * @return {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
55
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
56
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
40
57
  */
41
58
  async upload(file, fileQuery) {
42
59
  const query = { ...this._defaultQuery, ...fileQuery };
@@ -48,42 +65,52 @@ class FileUploadingApi extends asyncModules_1.default {
48
65
  /**
49
66
  * Deletes a file from the cloud file storage.
50
67
  *
51
- * @param {string} [filename] File name. Example "file.png"
52
- *
53
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
54
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
55
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
56
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
57
- * @param {number} [fileQuery.template] - preview template identifier. Example: 1
68
+ * @handleName delete
58
69
  *
59
- * @returns Deletes a file from the cloud file storage
70
+ * @param {string} [filename] - File name. Example: "file.png".
71
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
72
+ {
73
+ "type": "page",
74
+ "entity": "editor",
75
+ "id": 3787,
76
+ "template": 1
77
+ }
78
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
79
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
80
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
81
+ * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
82
+ * @return {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
83
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
84
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
60
85
  */
61
86
  async delete(filename, fileQuery) {
62
87
  const query = { ...this._defaultQuery, ...fileQuery };
63
88
  const result = await this._fetchDelete(`?filename=${filename}&` + this._queryParamsToString(query));
64
- return result.json();
89
+ return result;
65
90
  }
66
91
  /**
67
92
  * Get file by parameters.
68
93
  *
69
- * @param {number} [id] - Object identifier, from which the file is uploaded, determines the folder name in the storage
70
- *
71
- * @param {string} [type] - Type, determines the folder name in the storage
72
- * @param {string} [entity] - entity name, from which the file is uploaded, determines the folder name in the storage
73
- * @param {string} [filename] - Filename. Example "file.png"
74
- * @param {string} [template] - preview template identifier. Example 1
94
+ * @handleName getFile
75
95
  *
76
- * @returns Return file as File object
96
+ * @param {number} [id] - Object identifier, from which the file is uploaded, determines the folder name in the storage. Example: 3787.
97
+ * @param {string} [type] - Type, determines the folder name in the storage. Example: "page".
98
+ * @param {string} [entity] - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
99
+ * @param {string} [filename] - Filename. Example: "file.png".
100
+ * @param {string} [template] - Preview template identifier. Example: 1.
101
+ * @return {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
102
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
103
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
77
104
  */
78
105
  async getFile(id, type, entity, filename, template) {
79
- const response = await fetch(this._getFullPath(`?id=${id}&type=${type}&entity=${entity}${filename ? `&filename=${filename}` : ''}${template ? `&template=${template}` : ''}`), {
106
+ const response = await fetch(this._getFullPath(`?id=${id}&type=${type}&entity=${entity}${`&filename=${filename}`}${template ? `&template=${template}` : ''}`), {
80
107
  method: 'GET',
81
108
  headers: {
82
109
  'Content-Type': 'application/json',
83
110
  'x-app-token': this.state.token,
84
111
  },
85
112
  });
86
- return response.blob();
113
+ return response;
87
114
  }
88
115
  }
89
116
  exports.default = FileUploadingApi;
@@ -1,30 +1,100 @@
1
1
  import type { IError } from '../base/utils';
2
2
  /**
3
- * Represents a interface object of File Uploading Api.
3
+ * Interface for uploading, deleting, and retrieving files in the CMS.
4
+ *
5
+ * @interface IFileUploading
4
6
  *
5
7
  * @property {function} upload - Upload file from CMS.
6
8
  * @property {function} delete - Delete file from CMS.
7
9
  * @property {function} getFile - Get file by parameters.
10
+ * @description This interface defines methods for uploading, deleting, and retrieving files in the CMS.
8
11
  */
9
12
  interface IFileUploading {
10
- upload(data: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturns | IError>;
13
+ /**
14
+ * Upload file function.
15
+ *
16
+ * @handleName upload
17
+ *
18
+ * @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
19
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
20
+ {
21
+ "type": "page",
22
+ "entity": "editor",
23
+ "id": 3787,
24
+ "width": 0,
25
+ "height": 0,
26
+ "compress": true,
27
+ "template": 1
28
+ }
29
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
30
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
31
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
32
+ * @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
33
+ * @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
34
+ * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
35
+ * @param {any} [fileQuery.template] - preview template identifier. Example: 1.
36
+ * @return {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
37
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
38
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
39
+ */
40
+ upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
41
+ /**
42
+ * Deletes a file from the cloud file storage.
43
+ *
44
+ * @handleName delete
45
+ *
46
+ * @param {string} [filename] - File name. Example: "file.png".
47
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
48
+ {
49
+ "type": "page",
50
+ "entity": "editor",
51
+ "id": 3787,
52
+ "template": 1
53
+ }
54
+ * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
55
+ * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
56
+ * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
57
+ * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
58
+ * @return {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
59
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
60
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
61
+ */
11
62
  delete(filename: string, fileQuery?: IUploadingQuery): Promise<any | IError>;
12
- getFile(id: number, type: string, entity: string, filename?: string): Promise<Blob | IError>;
63
+ /**
64
+ * Retrieves a file by its parameters.
65
+ *
66
+ * @param {number} id - The ID of the file entity. Example: 3787.
67
+ * @param {string} type - The type of the file. Example: "page".
68
+ * @param {string} entity - The entity associated with the file. Example: "editor".
69
+ * @param {string} [filename] - Optional filename to retrieve. Example: "file.png".
70
+ * @return {Blob} A promise that resolves to a Blob object or an error.
71
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
72
+ */
73
+ getFile(id: number, type: string, entity: string, filename?: string): Promise<any | IError>;
13
74
  }
14
75
  /**
15
- * IFileEntity
76
+ * Represents a file entity with a file object or string path.
77
+ *
78
+ * @interface IFileEntity
79
+ *
80
+ * @property {File | string | null} file - File object or string representing the file path. Example: new File(["content"], "file.png", { "type": "image/png" }) or "/path/to/file.png".
81
+ * @description Represents a file entity that may contain a file object or a path as a string.
16
82
  */
17
83
  interface IFileEntity {
18
84
  file: File | string | null;
19
85
  }
20
86
  /**
21
- * @interface
22
- * @property {string} type - Type, determines the folder name in the storage.
23
- * @property {string} entity - Entity name from which the file is uploaded, determines the folder name in the storage.
24
- * @property {number} id - Identifier of the object from which the file is uploaded, determines the folder name in the storage.
25
- * @property {number} [width] - Width parameter.
26
- * @property {number} [height] - Height parameter.
27
- * @property {boolean} [compress] - Flag of optimization (compression) for images.
87
+ * Represents a query for uploading files, including type, entity, and optional parameters like width, height, and compression.
88
+ *
89
+ * @interface IUploadingQuery
90
+ *
91
+ * @property {string} type - Type, determines the folder name in the storage. Example: "page".
92
+ * @property {string} entity - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
93
+ * @property {number} id - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
94
+ * @property {number} [width] - Width parameter. Example: 0.
95
+ * @property {number} [height] - Height parameter. Example: 0.
96
+ * @property {boolean} [compress] - Flag of optimization (compression) for images. Example: true.
97
+ * @description Represents a query for uploading files, including type, entity, and optional parameters like width, height, and compression.
28
98
  */
29
99
  interface IUploadingQuery {
30
100
  type: string | null;
@@ -33,15 +103,18 @@ interface IUploadingQuery {
33
103
  [key: string]: string | number | boolean | null;
34
104
  }
35
105
  /**
36
- * @interface
37
- * @property {string} filename - Filename with relative path.
38
- * @property {string} downloadLink - Link for downloading the file.
39
- * @property {number} size - Size of the file in bytes.
106
+ * Represents the return value of an uploading operation, including the filename, download link, and file size.
107
+ *
108
+ * @interface IUploadingReturn
109
+ *
110
+ * @property {string} filename - Filename with relative path. Example: "uploads/file.png".
111
+ * @property {string} downloadLink - Link for downloading the file. Example: "https://example.com/uploads/file.png".
112
+ * @property {number} size - Size of the file in bytes. Example: 1024.
113
+ * @description Represents the return value of an uploading operation, including the filename, download link, and file size.
40
114
  */
41
115
  interface IUploadingReturn {
42
116
  filename: string;
43
117
  downloadLink: string;
44
118
  size: number;
45
119
  }
46
- type IUploadingReturns = IUploadingReturn[];
47
- export type { IFileEntity, IFileUploading, IUploadingQuery, IUploadingReturns };
120
+ export type { IFileEntity, IFileUploading, IUploadingQuery, IUploadingReturn };
@@ -4,7 +4,12 @@ import type { IError } from '../base/utils';
4
4
  import type { IForms, IFormsEntity } from './formsInterfaces';
5
5
  /**
6
6
  * Controllers for forms objects
7
- * @handle /api/content/forms
7
+ *
8
+ * @class FormsApi
9
+ * @extends AsyncModules
10
+ * @implements {IForms}
11
+ *
12
+ * @description This class provides methods to interact with forms, including retrieving all forms and getting a form by its marker.
8
13
  */
9
14
  export default class FormsApi extends AsyncModules implements IForms {
10
15
  protected state: StateModule;
@@ -13,20 +18,26 @@ export default class FormsApi extends AsyncModules implements IForms {
13
18
  /**
14
19
  * Get all forms.
15
20
  *
16
- * @param {string} [langCode] - Language code. Default "en_US"
17
- * @param {number} [offset] - Parameter for pagination. Default 0
18
- * @param {number} [limit] - Parameter for pagination. Default 30
21
+ * @handleName getAllForms
19
22
  *
20
- * @returns Returns array for all objects of type FormEntity
23
+ * @param {string} [langCode] - Language code. Default: "en_US".
24
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
25
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
26
+ * @return {IFormsEntity[]} Returns array for all objects of type FormEntity.
27
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
28
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
21
29
  */
22
- getAllForms(langCode?: string, offset?: number, limit?: number): Promise<Array<IFormsEntity> | IError>;
30
+ getAllForms(langCode?: string, offset?: number, limit?: number): Promise<IFormsEntity[] | IError>;
23
31
  /**
24
32
  * Get one form by form marker.
25
33
  *
26
- * @param {string} [marker] - Marker of form.
27
- * @param {string} [langCode] - Language code. Default "en_US"
34
+ * @handleName getFormByMarker
28
35
  *
29
- * @returns Returns object of type FormEntity
36
+ * @param {string} marker - Marker of form. Example: "contact_form".
37
+ * @param {string} [langCode] - Language code. Default: "en_US".
38
+ * @return {IFormsEntity} Returns object of type FormEntity.
39
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
40
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
30
41
  */
31
42
  getFormByMarker(marker: string, langCode?: string): Promise<IFormsEntity | IError>;
32
43
  }
@@ -6,7 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
7
7
  /**
8
8
  * Controllers for forms objects
9
- * @handle /api/content/forms
9
+ *
10
+ * @class FormsApi
11
+ * @extends AsyncModules
12
+ * @implements {IForms}
13
+ *
14
+ * @description This class provides methods to interact with forms, including retrieving all forms and getting a form by its marker.
10
15
  */
11
16
  class FormsApi extends asyncModules_1.default {
12
17
  constructor(state) {
@@ -16,11 +21,14 @@ class FormsApi extends asyncModules_1.default {
16
21
  /**
17
22
  * Get all forms.
18
23
  *
19
- * @param {string} [langCode] - Language code. Default "en_US"
20
- * @param {number} [offset] - Parameter for pagination. Default 0
21
- * @param {number} [limit] - Parameter for pagination. Default 30
24
+ * @handleName getAllForms
22
25
  *
23
- * @returns Returns array for all objects of type FormEntity
26
+ * @param {string} [langCode] - Language code. Default: "en_US".
27
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
28
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
29
+ * @return {IFormsEntity[]} Returns array for all objects of type FormEntity.
30
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
31
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
24
32
  */
25
33
  async getAllForms(langCode = this.state.lang, offset = 0, limit = 30) {
26
34
  const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
@@ -29,10 +37,13 @@ class FormsApi extends asyncModules_1.default {
29
37
  /**
30
38
  * Get one form by form marker.
31
39
  *
32
- * @param {string} [marker] - Marker of form.
33
- * @param {string} [langCode] - Language code. Default "en_US"
40
+ * @handleName getFormByMarker
34
41
  *
35
- * @returns Returns object of type FormEntity
42
+ * @param {string} marker - Marker of form. Example: "contact_form".
43
+ * @param {string} [langCode] - Language code. Default: "en_US".
44
+ * @return {IFormsEntity} Returns object of type FormEntity.
45
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
46
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
36
47
  */
37
48
  async getFormByMarker(marker, langCode = this.state.lang) {
38
49
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
@@ -1,39 +1,102 @@
1
- import type { IAttributes, IError } from '../base/utils';
1
+ import type { IPosition } from '../admins/adminsInterfaces';
2
+ import type { IAttributes, IError, ILocalizeInfo } from '../base/utils';
2
3
  /**
3
- * Represents an interface object of Forms Api.
4
+ * Interface for retrieving forms in the system.
5
+ *
6
+ * @interface IForms
4
7
  *
5
8
  * @property {function} getAllForms - Get all forms in array.
6
9
  * @property {function} getFormByMarker - Get one form by form marker.
10
+ * @description This interface defines methods for retrieving forms in the system.
7
11
  */
8
12
  interface IForms {
9
- getAllForms(langCode: string, offset?: number, limit?: number): Promise<Array<IFormsEntity> | IError>;
13
+ /**
14
+ * Retrieves all forms in the system.
15
+ *
16
+ * @param {string} [langCode] - The language code for localization. Default: "en_US".
17
+ * @param {number} [offset] - Optional offset for pagination. Default: 0.
18
+ * @param {number} [limit] - Optional limit for pagination. Default: 30.
19
+ * @return {IFormsEntity[]} A promise that resolves to an array of form entities or an error.
20
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
21
+ */
22
+ getAllForms(langCode: string, offset?: number, limit?: number): Promise<IFormsEntity[] | IError>;
23
+ /**
24
+ * Retrieves a form by its marker.
25
+ *
26
+ * @param {string} marker - The marker identifying the form. Example: "contact_form".
27
+ * @param {string} [langCode] - The language code for localization. Default: "en_US".
28
+ * @return {IFormsEntity} A promise that resolves to a form entity or an error.
29
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
30
+ */
10
31
  getFormByMarker(marker: string, langCode: string): Promise<IFormsEntity | IError>;
11
32
  }
12
33
  /**
13
- * Represents an object with various properties.
34
+ * Represents the structure of a form page.
35
+ *
36
+ * @interface IFromPages
37
+ *
38
+ * @property {number} id - The unique identifier of the form page. Example: 123.
39
+ * @property {number} pageId - The identifier of the page. Example: 12.
40
+ * @property {number} formId - The identifier of the form. Example: 321.
41
+ * @property {number} positionId - The identifier of the position. Example: 1.
42
+ * @property {IPosition} position - The position object. Example:
43
+ {
44
+ "id": 1,
45
+ "position": 1,
46
+ "objectId": 2,
47
+ "objectType": "admin",
48
+ "isLocked": false,
49
+ "objectCategoryId": 1
50
+ }
51
+ * @description This interface defines the structure of a form page.
52
+ */
53
+ interface IFromPages {
54
+ id: number;
55
+ pageId: number;
56
+ formId: number;
57
+ positionId: number;
58
+ position: IPosition;
59
+ }
60
+ /**
61
+ * Represents the structure of a form entity.
62
+ *
63
+ * @interface IFormsEntity
14
64
  *
15
- * @interface
16
- * @property {number} id - The identifier of the object.
17
- * @property {number} attributeSetId - The identifier of the attribute set being used.
18
- * @property {string} processingType - Type of form processing.
19
- * @property {Record<string, any>} localizeInfos - The name of the form, taking into account localization.
20
- * @property {object} processingData - Form data.
21
- * @property {Array<IAttributes>} attribute - Array of attribute values from the used attribute set for displaying the form (taking into account the specified language)
22
- * @property {number} version - The version number of the object.
23
- * @property {string} type - Form type.
24
- * @property {string} identifier - The textual identifier for the record field.
25
- * @property {number} position - The position of the object.
65
+ * @property {number} id - The identifier of the object. Example: 12345.
66
+ * @property {number | null} attributeSetId - The identifier of the attribute set being used, or null if not applicable. Example: 1234.
67
+ * @property {string | null} type - Form type. Example: "contact".
68
+ * @property {ILocalizeInfo} localizeInfos - The name of the form, taking into account localization. Example: {"key": "value"}.
69
+ * @property {number} version - The version number of the object. Example: 1.
70
+ * @property {number} position - The position of the object. Example: 1.
71
+ * @property {string} identifier - The textual identifier for the record field. Example: "form_contact_us".
72
+ * @property {string} processingType - Type of form processing. Example: "async".
73
+ * @property {number | null} templateId - The identifier of the template used by the form, or null if no template is used. Example: 6789.
74
+ * @property {IAttributes[] | Record<string, any>} attributes - The attributes of the form, which can be an array of attribute objects or a record of key-value pairs. Example: {"key": "value"}.
75
+ * @description This interface defines the structure of a form entity, including its identifiers, attributes, and processing data.
26
76
  */
27
77
  interface IFormsEntity {
28
- attributeSetId: number | null;
29
- attributes: Array<IAttributes> | Record<string, any>;
30
78
  id: number;
31
- identifier: string;
32
- localizeInfos: Record<string, any>;
33
- templateId: number | null;
34
- position: number;
79
+ attributeSetId: number | null;
35
80
  type: string | null;
36
- processingType: string;
81
+ localizeInfos: ILocalizeInfo;
37
82
  version: number;
83
+ position: number;
84
+ identifier: string;
85
+ processingType: string;
86
+ templateId: number | null;
87
+ attributes: IAttributes[] | Record<string, any>;
88
+ moduleFormConfigs?: Array<IFormConfig>;
89
+ }
90
+ interface IFormConfig {
91
+ id: number;
92
+ moduleIdentifier: string;
93
+ isGlobal: boolean;
94
+ isClosed: boolean;
95
+ viewOnlyUserData: boolean;
96
+ commentOnlyUserData: boolean;
97
+ entityIdentifiers: {
98
+ id: string;
99
+ isNested: boolean;
100
+ }[];
38
101
  }
39
- export type { IForms, IFormsEntity };
102
+ export type { IFormConfig, IForms, IFormsEntity, IFromPages };