zudello-integration-sdk 1.0.47 → 1.0.49

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudello-integration-sdk",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "description": "Zudello Integrations SDK",
5
5
  "main": "./src/index.js",
6
6
  "repository": {
package/src/index.js CHANGED
@@ -23,6 +23,10 @@ const SAPB1SDK = require('./sdk/SAPB1')
23
23
  const GPSDK = require('./sdk/GP')
24
24
  const EDISDK = require('./sdk/EDI')
25
25
  const SunSystemsSDK = require('./sdk/SunSystems')
26
+ const MAMSDK = require('./sdk/MAM')
27
+ const Dynamic365SDK = require('./sdk/Dynamics365')
28
+ const SharepointSDK = require('./sdk/Sharepoint')
29
+ const SFTPSDK = require('./sdk/SFTP')
26
30
 
27
31
  const AI = require('./utils/ai')
28
32
  const FileBucket = require('./utils/fileBucket')
@@ -67,6 +71,7 @@ module.exports = {
67
71
  NetsuiteSoapSDK,
68
72
  IntacctSDK,
69
73
  BusinessCentralSDK,
74
+ Dynamic365SDK,
70
75
  ZenotiSDK,
71
76
  DearSDK,
72
77
  NexviaSDK,
@@ -79,8 +84,11 @@ module.exports = {
79
84
  RetailExpressSDK,
80
85
  MYOBAcumaticaSDK,
81
86
  MYOBAccountRightSDK,
87
+ MAMSDK,
82
88
  SybizSDK,
83
89
  SunSystemsSDK,
90
+ SharepointSDK,
91
+ SFTPSDK,
84
92
  XeroSDK,
85
93
  JobReadySDK,
86
94
  Logger,
@@ -0,0 +1,31 @@
1
+ 'use strict'
2
+
3
+ const BaseSDK = require('./Base')
4
+ const UniversalModule = require('./submodules/dynamics365/Universal')
5
+
6
+ class Dynamic365SDK extends BaseSDK {
7
+ /**
8
+ * Constructor.
9
+ * @param {class} auth Auth class object with authorized api instance.
10
+ * @param {string} connectionUUID The UUID of the Connection we're working on.
11
+ */
12
+ constructor (auth, connectionUUID, organizationUUID, apiURL, apiVersion, loggerClass = null) {
13
+ super({
14
+ auth,
15
+ connectionUUID,
16
+ organizationUUID,
17
+ apiURL,
18
+ apiVersion,
19
+ appUUIDKey: 'dynamics365',
20
+ integrationName: 'Dynamics365',
21
+ loggerClass
22
+ })
23
+
24
+ /**
25
+ * Create submodule instances.
26
+ */
27
+ this.universal = new UniversalModule(this)
28
+ }
29
+ }
30
+
31
+ module.exports = Dynamic365SDK
package/src/sdk/MAM.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ const BaseSDK = require("./Base");
4
+ const CreateModule = require("./submodules/mam/Create");
5
+
6
+ class MAMSDK extends BaseSDK {
7
+ /**
8
+ * Constructor.
9
+ * @param {class} auth Auth class object with authorized api instance.
10
+ * @param {string} connectionUUID The UUID of the Connection we're working on.
11
+ */
12
+ constructor(auth, connectionUUID, organizationUUID, apiURL, apiVersion, loggerClass = null) {
13
+ super({
14
+ auth,
15
+ connectionUUID,
16
+ organizationUUID,
17
+ apiURL,
18
+ apiVersion,
19
+ appUUIDKey: "mam",
20
+ integrationName: "MAM",
21
+ loggerClass,
22
+ });
23
+
24
+ /**
25
+ * Create submodule instances.
26
+ */
27
+ this.create = new CreateModule(this);
28
+ }
29
+ }
30
+
31
+ module.exports = MAMSDK;
@@ -0,0 +1,31 @@
1
+ 'use strict'
2
+
3
+ const BaseSDK = require('./Base')
4
+ const UniversalModule = require('./submodules/sftp/Universal')
5
+
6
+ class SharepointSDK extends BaseSDK {
7
+ /**
8
+ * Constructor.
9
+ * @param {class} auth Auth class object with authorized api instance.
10
+ * @param {string} connectionUUID The UUID of the Connection we're working on.
11
+ */
12
+ constructor (auth, connectionUUID, organizationUUID, apiURL, apiVersion, loggerClass = null) {
13
+ super({
14
+ auth,
15
+ connectionUUID,
16
+ organizationUUID,
17
+ apiURL,
18
+ apiVersion,
19
+ appUUIDKey: 'sftp',
20
+ integrationName: 'SFTP',
21
+ loggerClass
22
+ })
23
+
24
+ /**
25
+ * Create submodule instances.
26
+ */
27
+ this.universal = new UniversalModule(this)
28
+ }
29
+ }
30
+
31
+ module.exports = SharepointSDK
@@ -0,0 +1,31 @@
1
+ 'use strict'
2
+
3
+ const BaseSDK = require('./Base')
4
+ const UniversalModule = require('./submodules/sharepoint/Universal')
5
+
6
+ class SharepointSDK extends BaseSDK {
7
+ /**
8
+ * Constructor.
9
+ * @param {class} auth Auth class object with authorized api instance.
10
+ * @param {string} connectionUUID The UUID of the Connection we're working on.
11
+ */
12
+ constructor (auth, connectionUUID, organizationUUID, apiURL, apiVersion, loggerClass = null) {
13
+ super({
14
+ auth,
15
+ connectionUUID,
16
+ organizationUUID,
17
+ apiURL,
18
+ apiVersion,
19
+ appUUIDKey: 'sharepoint',
20
+ integrationName: 'Sharepoint',
21
+ loggerClass
22
+ })
23
+
24
+ /**
25
+ * Create submodule instances.
26
+ */
27
+ this.universal = new UniversalModule(this)
28
+ }
29
+ }
30
+
31
+ module.exports = SharepointSDK
@@ -60,6 +60,45 @@ class UniversalModule {
60
60
  })
61
61
  }
62
62
 
63
+ /**
64
+ * Attach a File to Business Central.
65
+ * @param {string} fileURL URL of the file to be attached.
66
+ * @param {string} url URL of request.
67
+ * @returns {object} Universal Request Response.
68
+ */
69
+ async attach ({ fileURL, url, apiProvider = null, apiGroup = null }) {
70
+ const validateIsEmpty = this.module.validator.isEmpty({ url, fileURL })
71
+
72
+ if (!validateIsEmpty.valid) {
73
+ return this.module.responseHandler.error(validateIsEmpty.errors)
74
+ }
75
+
76
+ const mappableParams = {
77
+ url: {
78
+ value: url
79
+ },
80
+ fileURL: {
81
+ value: fileURL
82
+ }
83
+ }
84
+
85
+ if (apiProvider) {
86
+ mappableParams.apiProvider = {
87
+ value: apiProvider
88
+ }
89
+ }
90
+
91
+ if (apiGroup) {
92
+ mappableParams.apiGroup = {
93
+ value: apiGroup
94
+ }
95
+ }
96
+
97
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/ee6f62f5-9dda-48aa-bb8d-44c8b8455472`, {
98
+ mappable_parameters: mappableParams
99
+ })
100
+ }
101
+
63
102
  /**
64
103
  * Universal List By URL and Method.
65
104
  * @param {string} url URL of listed data.
@@ -0,0 +1,169 @@
1
+ 'use strict'
2
+
3
+ class UniversalModule {
4
+ /**
5
+ * Constructor.
6
+ * @param {class} parentModule Object of BusinessCentral class.
7
+ */
8
+ constructor (parentModule) {
9
+ this.module = parentModule
10
+ }
11
+
12
+ /**
13
+ * Universal Request By URL and Method.
14
+ * @param {string} url URL of request.
15
+ * @param {string} method Method of request.
16
+ * @param {object} qs Some available filters inside: $top, $skip, $filter, $extend.
17
+ * @param {object} body Some available data inside.
18
+ * @param {string} apiProvider API Provider.
19
+ * @param {string} apiGroup API Group.
20
+ * @returns {object} Universal Request Response.
21
+ */
22
+ async request ({ url, method, qs = {}, body = {}, apiProvider = null, apiGroup = null }) {
23
+ const validateIsEmpty = this.module.validator.isEmpty({ url, method })
24
+
25
+ if (!validateIsEmpty.valid) {
26
+ return this.module.responseHandler.error(validateIsEmpty.errors)
27
+ }
28
+
29
+ const mappableParams = {
30
+ url: {
31
+ value: url
32
+ },
33
+ method: {
34
+ value: method
35
+ },
36
+ qs: {
37
+ isMap: true,
38
+ value: JSON.stringify(qs)
39
+ },
40
+ body: {
41
+ isMap: true,
42
+ value: JSON.stringify(body)
43
+ }
44
+ }
45
+
46
+ if (apiProvider) {
47
+ mappableParams.apiProvider = {
48
+ value: apiProvider
49
+ }
50
+ }
51
+
52
+ if (apiGroup) {
53
+ mappableParams.apiGroup = {
54
+ value: apiGroup
55
+ }
56
+ }
57
+
58
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/6867a1bb-c6a3-428f-a5de-5cd1fdb7dd5d`, {
59
+ mappable_parameters: mappableParams
60
+ })
61
+ }
62
+
63
+ /**
64
+ * Attach a File to Business Central.
65
+ * @param {string} fileURL URL of the file to be attached.
66
+ * @param {string} url URL of request.
67
+ * @returns {object} Universal Request Response.
68
+ */
69
+ async attach ({ fileURL, url, apiProvider = null, apiGroup = null }) {
70
+ const validateIsEmpty = this.module.validator.isEmpty({ url, fileURL })
71
+
72
+ if (!validateIsEmpty.valid) {
73
+ return this.module.responseHandler.error(validateIsEmpty.errors)
74
+ }
75
+
76
+ const mappableParams = {
77
+ url: {
78
+ value: url
79
+ },
80
+ fileURL: {
81
+ value: fileURL
82
+ }
83
+ }
84
+
85
+ if (apiProvider) {
86
+ mappableParams.apiProvider = {
87
+ value: apiProvider
88
+ }
89
+ }
90
+
91
+ if (apiGroup) {
92
+ mappableParams.apiGroup = {
93
+ value: apiGroup
94
+ }
95
+ }
96
+
97
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/bafcc247-6936-4876-86e9-c84e919de101`, {
98
+ mappable_parameters: mappableParams
99
+ })
100
+ }
101
+
102
+ /**
103
+ * Universal List By URL and Method.
104
+ * @param {string} url URL of listed data.
105
+ * @param {string} method Method of listed data.
106
+ * @param {object} qs Some available filters inside: $top, $skip, $filter, $extend.
107
+ * @param {string} apiProvider API Provider.
108
+ * @param {string} apiGroup API Group.
109
+ * @returns {object} Universal List Response.
110
+ */
111
+ async list ({ url, method, qs = {}, apiProvider = null, apiGroup = null }) {
112
+ const validateIsEmpty = this.module.validator.isEmpty({ url, method })
113
+
114
+ if (!validateIsEmpty.valid) {
115
+ return this.module.responseHandler.error(validateIsEmpty.errors)
116
+ }
117
+
118
+ if (!qs.$skip) {
119
+ qs.$skip = 0
120
+ }
121
+
122
+ if (!qs.$top) {
123
+ qs.$top = 100
124
+ }
125
+
126
+ return await this.request({ url, method, qs, apiProvider, apiGroup })
127
+ }
128
+
129
+ /**
130
+ * Universal Auto Pagination Listing By URL and Method.
131
+ * @param {string} url URL of listed data.
132
+ * @param {string} method Method of listed data.
133
+ * @param {object} qs Some available filters inside: $top, $skip, $filter, $extend.
134
+ * @param {string} apiProvider API Provider.
135
+ * @param {string} apiGroup API Group.
136
+ * @returns {object} Auto Pagination responses.
137
+ */
138
+ async * autoPaginationList ({ url, method, qs = {}, apiProvider = null, apiGroup = null }) {
139
+ if (!qs.$skip) {
140
+ qs.$skip = 0
141
+ }
142
+
143
+ if (!qs.$top) {
144
+ qs.$top = 100
145
+ }
146
+
147
+ let response = await this.list({ url, method, qs, apiProvider, apiGroup })
148
+ let currentPageCount = response?.data?.value?.length
149
+ let currentOffset = qs.$skip
150
+
151
+ yield response
152
+
153
+ if (currentPageCount && currentPageCount === qs.$top) {
154
+ while (currentPageCount === qs.$top) {
155
+ currentOffset = currentOffset + qs.$top
156
+
157
+ qs.$skip = currentOffset
158
+
159
+ response = await this.list({ url, method, qs, apiProvider, apiGroup })
160
+ currentPageCount = response?.data?.value?.length
161
+
162
+ yield response
163
+ }
164
+ }
165
+ }
166
+
167
+ }
168
+
169
+ module.exports = UniversalModule
@@ -44,6 +44,46 @@ class UniversalModule {
44
44
  })
45
45
  }
46
46
 
47
+ /**
48
+ * Attach and Upload File.
49
+ * @param {string} dataAreaId Data Area ID.
50
+ * @param {string} headerReference Header Reference.
51
+ * @param {string} notes Notes.
52
+ * @param {string} fileName File Name.
53
+ * @param {string} fileType File Type.
54
+ * @returns {object} Universal Request Response.
55
+ */
56
+ async attach ({ url, dataAreaId, headerReference, notes, fileName, fileType }) {
57
+ const validateIsEmpty = this.module.validator.isEmpty({ url, dataAreaId, headerReference, notes, fileName, fileType })
58
+
59
+ if (!validateIsEmpty.valid) {
60
+ return this.module.responseHandler.error(validateIsEmpty.errors)
61
+ }
62
+
63
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/e9ef2f1f-e3d4-4f5e-bfe7-79aec4bb9b3f`, {
64
+ mappable_parameters: {
65
+ url: {
66
+ value: url
67
+ },
68
+ dataAreaId: {
69
+ value: dataAreaId
70
+ },
71
+ headerReference: {
72
+ value: headerReference
73
+ },
74
+ notes: {
75
+ value: notes
76
+ },
77
+ fileName: {
78
+ value: fileName
79
+ },
80
+ fileType: {
81
+ value: fileType
82
+ }
83
+ }
84
+ })
85
+ }
86
+
47
87
  /**
48
88
  * Universal List By URL and Method.
49
89
  * @param {string} url URL of listed data.
@@ -0,0 +1,64 @@
1
+ 'use strict'
2
+
3
+ class UniversalModule {
4
+ /**
5
+ * Constructor.
6
+ * @param {class} parentModule Object of MAM class.
7
+ */
8
+ constructor (parentModule) {
9
+ this.module = parentModule
10
+ }
11
+
12
+ /**
13
+ * Create XML File in MAM.
14
+ * @param {object} path Path of XML file.
15
+ * @param {object} data Data of XML file.
16
+ * @returns {object} Response.
17
+ */
18
+ async xml ({ path, data }) {
19
+ const validateIsEmpty = this.module.validator.isEmpty({ path, data })
20
+
21
+ if (!validateIsEmpty.valid) {
22
+ return this.module.responseHandler.error(validateIsEmpty.errors)
23
+ }
24
+
25
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/d1ef7870-834b-42d5-a82b-8d0d1e09f0ee`, {
26
+ mappable_parameters: {
27
+ path: {
28
+ value: path
29
+ },
30
+ data: {
31
+ value: data
32
+ }
33
+ }
34
+ })
35
+ }
36
+
37
+ /**
38
+ * Create CSV File in MAM.
39
+ * @param {object} path Path of CSV file.
40
+ * @param {object} data Data of CSV file.
41
+ * @returns {object} Response.
42
+ */
43
+ async csv ({ path, data }) {
44
+ const validateIsEmpty = this.module.validator.isEmpty({ path, data })
45
+
46
+ if (!validateIsEmpty.valid) {
47
+ return this.module.responseHandler.error(validateIsEmpty.errors)
48
+ }
49
+
50
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/f08a461d-b1eb-4342-b5f8-aeec1c78f810`, {
51
+ mappable_parameters: {
52
+ path: {
53
+ value: path
54
+ },
55
+ data: {
56
+ value: data
57
+ }
58
+ }
59
+ })
60
+ }
61
+
62
+ }
63
+
64
+ module.exports = UniversalModule
@@ -110,13 +110,13 @@ class UniversalModule {
110
110
  }
111
111
 
112
112
  /**
113
- * Attachment Request By URL and Method.
113
+ * Attach file to Record.
114
114
  * @param {string} url URL of request.
115
- * @param {string} attachment URL of the attachment.
115
+ * @param {string} fileURL URL of file.
116
116
  * @returns {object} Universal Request Response.
117
117
  */
118
- async attach({ url, method, qs = {}, body = {} }) {
119
- const validateIsEmpty = this.module.validator.isEmpty({ url, attachment });
118
+ async attach({ url, fileURL }) {
119
+ const validateIsEmpty = this.module.validator.isEmpty({ url, fileURL });
120
120
 
121
121
  if (!validateIsEmpty.valid) {
122
122
  return this.module.responseHandler.error(validateIsEmpty.errors);
@@ -130,8 +130,8 @@ class UniversalModule {
130
130
  url: {
131
131
  value: url,
132
132
  },
133
- attachment: {
134
- value: attachment,
133
+ fileURL: {
134
+ value: fileURL,
135
135
  },
136
136
  },
137
137
  }
@@ -66,6 +66,46 @@ class UniversalModule {
66
66
 
67
67
  return await this.request({ command, qs, body })
68
68
  }
69
+
70
+ /**
71
+ * Attach file to SAP B1.
72
+ * @param {string} fileName File name.
73
+ * @param {string} url URL of orignal file.
74
+ * @param {string} type Type of transaction.
75
+ * @param {number} number Number of transaction.
76
+ * @returns {object} Universal Request Response.
77
+ */
78
+ async attach({ url, fileName, type, number }) {
79
+ const validateIsEmpty = this.module.validator.isEmpty({ fileURL, fileName, type, number })
80
+
81
+ if (!validateIsEmpty.valid) {
82
+ return this.module.responseHandler.error(validateIsEmpty.errors)
83
+ }
84
+
85
+ return await this.module.makeRequest(
86
+ 'POST',
87
+ `${this.module.apiURL}/zintegrations/action/981fd907-2037-4e4c-8244-3124cecc4e45`,
88
+ {
89
+ mappable_parameters: {
90
+ url: {
91
+ value: fileURL
92
+ },
93
+ fileName: {
94
+ value: fileName
95
+ },
96
+ type: {
97
+ value: type
98
+ },
99
+ number: {
100
+ value: number
101
+ }
102
+ }
103
+ },
104
+ {
105
+ _debug: true
106
+ }
107
+ )
108
+ }
69
109
  }
70
110
 
71
111
  module.exports = UniversalModule
@@ -0,0 +1,110 @@
1
+ 'use strict'
2
+
3
+ class UniversalModule {
4
+ /**
5
+ * Constructor.
6
+ * @param {class} parentModule Object of BusinessCentral class.
7
+ */
8
+ constructor (parentModule) {
9
+ this.module = parentModule
10
+ }
11
+
12
+ /**
13
+ * List Files in SFTP.
14
+ * @param {string} path Path of SFTP.
15
+ * @returns {object} Universal Request Response.
16
+ */
17
+ async list ({ path }) {
18
+ const validateIsEmpty = this.module.validator.isEmpty({ path })
19
+
20
+ if (!validateIsEmpty.valid) {
21
+ return this.module.responseHandler.error(validateIsEmpty.errors)
22
+ }
23
+
24
+ const mappableParams = {
25
+ path: {
26
+ value: path
27
+ }
28
+ }
29
+
30
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/d9b6bd51-ef34-4671-a8ae-7a88630ceb79`, {
31
+ mappable_parameters: mappableParams
32
+ })
33
+ }
34
+
35
+ /**
36
+ * Get File from SFTP.
37
+ * @param {string} path Path of file.
38
+ * @returns {object} Universal Request Response.
39
+ */
40
+ async list ({ path }) {
41
+ const validateIsEmpty = this.module.validator.isEmpty({ path })
42
+
43
+ if (!validateIsEmpty.valid) {
44
+ return this.module.responseHandler.error(validateIsEmpty.errors)
45
+ }
46
+
47
+ const mappableParams = {
48
+ path: {
49
+ value: path
50
+ }
51
+ }
52
+
53
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/db1b1ae3-a028-44bf-9b64-ba8fad2ad1d4`, {
54
+ mappable_parameters: mappableParams
55
+ })
56
+ }
57
+
58
+ /**
59
+ * Put File in SFTP.
60
+ * @param {string} path Path of file.
61
+ * @param {object} data Data of file.
62
+ * @returns {object} Universal Request Response.
63
+ */
64
+ async list ({ path, data }) {
65
+ const validateIsEmpty = this.module.validator.isEmpty({ path, data })
66
+
67
+ if (!validateIsEmpty.valid) {
68
+ return this.module.responseHandler.error(validateIsEmpty.errors)
69
+ }
70
+
71
+ const mappableParams = {
72
+ path: {
73
+ value: path
74
+ },
75
+ data: {
76
+ value: data
77
+ }
78
+ }
79
+
80
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/e0fbebc4-1ae1-4e87-b139-4feb4569ecb6`, {
81
+ mappable_parameters: mappableParams
82
+ })
83
+ }
84
+
85
+ /**
86
+ * Delete File from SFTP.
87
+ * @param {string} path Path of file.
88
+ * @returns {object} Universal Request Response.
89
+ */
90
+ async delete ({ path }) {
91
+ const validateIsEmpty = this.module.validator.isEmpty({ path })
92
+
93
+ if (!validateIsEmpty.valid) {
94
+ return this.module.responseHandler.error(validateIsEmpty.errors)
95
+ }
96
+
97
+ const mappableParams = {
98
+ path: {
99
+ value: path
100
+ }
101
+ }
102
+
103
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/0f22f5ae-a06d-497c-aeda-1671e5bbc1a9`, {
104
+ mappable_parameters: mappableParams
105
+ })
106
+ }
107
+
108
+ }
109
+
110
+ module.exports = UniversalModule
@@ -0,0 +1,153 @@
1
+ 'use strict'
2
+
3
+ class UniversalModule {
4
+ /**
5
+ * Constructor.
6
+ * @param {class} parentModule Object of BusinessCentral class.
7
+ */
8
+ constructor (parentModule) {
9
+ this.module = parentModule
10
+ }
11
+
12
+ /**
13
+ * Universal Request By URL and Method.
14
+ * @param {string} url URL of request.
15
+ * @param {string} method Method of request.
16
+ * @param {object} qs Some available filters inside: $top, $skip, $filter, $extend.
17
+ * @param {object} body Some available data inside.
18
+ * @param {string} apiProvider API Provider.
19
+ * @param {string} apiGroup API Group.
20
+ * @returns {object} Universal Request Response.
21
+ */
22
+ async request ({ url, method, qs = {}, body = {} }) {
23
+ const validateIsEmpty = this.module.validator.isEmpty({ url, method })
24
+
25
+ if (!validateIsEmpty.valid) {
26
+ return this.module.responseHandler.error(validateIsEmpty.errors)
27
+ }
28
+
29
+ const mappableParams = {
30
+ url: {
31
+ value: url
32
+ },
33
+ method: {
34
+ value: method
35
+ },
36
+ qs: {
37
+ isMap: true,
38
+ value: JSON.stringify(qs)
39
+ },
40
+ body: {
41
+ isMap: true,
42
+ value: JSON.stringify(body)
43
+ }
44
+ }
45
+
46
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/838d55d9-5ddb-470b-a346-7cfea19b3798`, {
47
+ mappable_parameters: mappableParams
48
+ })
49
+ }
50
+
51
+ /**
52
+ * Attach a File to Business Central.
53
+ * @param {string} fileURL URL of the file to be attached.
54
+ * @param {string} url URL of request.
55
+ * @returns {object} Universal Request Response.
56
+ */
57
+ async attach ({ driveID, folderID, url, fileName, mimeType }) {
58
+ const validateIsEmpty = this.module.validator.isEmpty({ url, fileURL })
59
+
60
+ if (!validateIsEmpty.valid) {
61
+ return this.module.responseHandler.error(validateIsEmpty.errors)
62
+ }
63
+
64
+ const mappableParams = {
65
+ driveID: {
66
+ value: driveID
67
+ },
68
+ folderID: {
69
+ value: folderID
70
+ },
71
+ url: {
72
+ value: url
73
+ },
74
+ fileName: {
75
+ value: fileName
76
+ },
77
+ mimeType: {
78
+ value: mimeType
79
+ }
80
+ }
81
+
82
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/644f4323-df65-4579-bce0-e9aee0389d3a`, {
83
+ mappable_parameters: mappableParams
84
+ })
85
+ }
86
+
87
+ /**
88
+ * Universal List By URL and Method.
89
+ * @param {string} url URL of listed data.
90
+ * @param {string} method Method of listed data.
91
+ * @param {object} qs Some available filters inside: $top, $skip, $filter, $extend.
92
+ * @param {string} apiProvider API Provider.
93
+ * @param {string} apiGroup API Group.
94
+ * @returns {object} Universal List Response.
95
+ */
96
+ async list ({ url, method, qs = {}, apiProvider = null, apiGroup = null }) {
97
+ const validateIsEmpty = this.module.validator.isEmpty({ url, method })
98
+
99
+ if (!validateIsEmpty.valid) {
100
+ return this.module.responseHandler.error(validateIsEmpty.errors)
101
+ }
102
+
103
+ if (!qs.$skip) {
104
+ qs.$skip = 0
105
+ }
106
+
107
+ if (!qs.$top) {
108
+ qs.$top = 100
109
+ }
110
+
111
+ return await this.request({ url, method, qs, apiProvider, apiGroup })
112
+ }
113
+
114
+ /**
115
+ * Universal Auto Pagination Listing By URL and Method.
116
+ * @param {string} url URL of listed data.
117
+ * @param {string} method Method of listed data.
118
+ * @param {object} qs Some available filters inside: $top, $skip, $filter, $extend.
119
+ * @param {string} apiProvider API Provider.
120
+ * @param {string} apiGroup API Group.
121
+ * @returns {object} Auto Pagination responses.
122
+ */
123
+ async * autoPaginationList ({ url, method, qs = {}, apiProvider = null, apiGroup = null }) {
124
+ if (!qs.$skip) {
125
+ qs.$skip = 0
126
+ }
127
+
128
+ if (!qs.$top) {
129
+ qs.$top = 100
130
+ }
131
+
132
+ let response = await this.list({ url, method, qs, apiProvider, apiGroup })
133
+ let currentPageCount = response?.data?.value?.length
134
+ let currentOffset = qs.$skip
135
+
136
+ yield response
137
+
138
+ if (currentPageCount && currentPageCount === qs.$top) {
139
+ while (currentPageCount === qs.$top) {
140
+ currentOffset = currentOffset + qs.$top
141
+
142
+ qs.$skip = currentOffset
143
+
144
+ response = await this.list({ url, method, qs, apiProvider, apiGroup })
145
+ currentPageCount = response?.data?.value?.length
146
+
147
+ yield response
148
+ }
149
+ }
150
+ }
151
+ }
152
+
153
+ module.exports = UniversalModule
@@ -6,6 +6,7 @@ module.exports = {
6
6
  netsuite: "010d0262-fa01-43eb-9e35-1b49e131c1ba",
7
7
  intacct: "a8bbbc60-2409-49e8-adfb-72fc79658dd6",
8
8
  bc: "ee6f62f5-9dda-48aa-bb8d-44c8b8455472",
9
+ dynamics365: "0d4161d5-5803-4cf9-8669-4d415a9be9f0",
9
10
  zenoti: "967a0844-6a9d-4979-a298-427259eafad8",
10
11
  dear: "0e456359-fe0d-4b01-9662-08bba1bdce63",
11
12
  nexvia: "5f693545-3be0-4798-bb3b-3af0b7ee2e96",
@@ -13,6 +14,8 @@ module.exports = {
13
14
  navision: "",
14
15
  retailExpress: "49584664-65a5-4b76-ba62-a73f7b7b3885",
15
16
  myobAcumatica: "8fd5015c-a200-4675-9e03-2047807c5693",
17
+ sharepoint: "30e57b25-4aa3-4b4e-9d9a-edc8932108da",
18
+ sftp: "506bd61e-54b2-4f4d-9641-907ec679afc6",
16
19
  myobAccountRight: "",
17
20
  sybiz: "ead57add-301e-4b29-881b-1bc331c101a5",
18
21
  xero: "71648f29-7867-40d8-ac68-651b53cb3c49",
@@ -21,6 +24,7 @@ module.exports = {
21
24
  sapb1: "de1ee5bd-d3ec-41cf-83f9-dcd2f51fcccd",
22
25
  gp: "c1fb133b-73f6-4b85-9362-59c7c2d9017f",
23
26
  edi: "6b3a284f-ca06-435c-bdf1-ad59c577a6a7",
27
+ mam: "acb7938a-06ba-4c6e-80e4-2bde7b0145a3",
24
28
  sunsystems: "",
25
29
  },
26
30
  };