zudello-integration-sdk 1.0.53 → 1.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/package.json +1 -1
- package/src/integrations/samples/bc-zudello/purchaseInvoice.js +1 -1
- package/src/sdk/Dynamics365.js +1 -1
- package/src/sdk/submodules/dynamics365/Universal.js +11 -11
- package/src/sdk/submodules/sharepoint/Universal.js +14 -11
- package/src/utils/modelHelper.js +4 -4
package/README.md
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Integration SDK
|
|
2
|
+
|
|
3
|
+
## Update Flow
|
|
4
|
+
#### Integration SDK
|
|
5
|
+
- Increment version in package.json
|
|
6
|
+
- Commit changes
|
|
7
|
+
- Run: `npm publish`
|
|
8
|
+
|
|
9
|
+
#### Integration Local
|
|
10
|
+
- Update `zudello-integration-sdk` version in package.json
|
|
11
|
+
- Increment version in package.json
|
|
12
|
+
- Commit changes
|
|
13
|
+
- Run: `npm publish`
|
|
14
|
+
|
|
15
|
+
**NOTE:** Users will need to run the following to update their global install:
|
|
16
|
+
```
|
|
17
|
+
npm install -g zudello-execute-local@latest
|
|
18
|
+
```
|
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@ const handler = async (providedData) => {
|
|
|
27
27
|
"invoiceDate": moment(_.get(data, "data.date_issued")).format('YYYY-MM-DD'),
|
|
28
28
|
"postingDate": datePosted,
|
|
29
29
|
"pricesIncludeTax": _.get(data, "tax_included"),
|
|
30
|
-
"vendorInvoiceNumber":
|
|
30
|
+
"vendorInvoiceNumber": _.get(data, "data.document_number"), // Must be passed as a string regardless of type
|
|
31
31
|
"vendorNumber": _.get(data, "data.supplier.code") // Must be passed as a string regardless of type
|
|
32
32
|
}
|
|
33
33
|
|
package/src/sdk/Dynamics365.js
CHANGED
|
@@ -9,7 +9,7 @@ class Dynamic365SDK extends BaseSDK {
|
|
|
9
9
|
* @param {class} auth Auth class object with authorized api instance.
|
|
10
10
|
* @param {string} connectionUUID The UUID of the Connection we're working on.
|
|
11
11
|
*/
|
|
12
|
-
constructor
|
|
12
|
+
constructor(auth, connectionUUID, organizationUUID, apiURL, apiVersion, loggerClass = null) {
|
|
13
13
|
super({
|
|
14
14
|
auth,
|
|
15
15
|
connectionUUID,
|
|
@@ -5,7 +5,7 @@ class UniversalModule {
|
|
|
5
5
|
* Constructor.
|
|
6
6
|
* @param {class} parentModule Object of BusinessCentral class.
|
|
7
7
|
*/
|
|
8
|
-
constructor
|
|
8
|
+
constructor(parentModule) {
|
|
9
9
|
this.module = parentModule
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@ class UniversalModule {
|
|
|
19
19
|
* @param {string} apiGroup API Group.
|
|
20
20
|
* @returns {object} Universal Request Response.
|
|
21
21
|
*/
|
|
22
|
-
async request
|
|
22
|
+
async request({ url, method, qs = {}, body = {}, apiProvider = null, apiGroup = null }) {
|
|
23
23
|
const validateIsEmpty = this.module.validator.isEmpty({ url, method })
|
|
24
24
|
|
|
25
25
|
if (!validateIsEmpty.valid) {
|
|
@@ -60,13 +60,13 @@ class UniversalModule {
|
|
|
60
60
|
})
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
70
|
const validateIsEmpty = this.module.validator.isEmpty({ url, fileURL })
|
|
71
71
|
|
|
72
72
|
if (!validateIsEmpty.valid) {
|
|
@@ -108,7 +108,7 @@ class UniversalModule {
|
|
|
108
108
|
* @param {string} apiGroup API Group.
|
|
109
109
|
* @returns {object} Universal List Response.
|
|
110
110
|
*/
|
|
111
|
-
async list
|
|
111
|
+
async list({ url, method, qs = {}, apiProvider = null, apiGroup = null }) {
|
|
112
112
|
const validateIsEmpty = this.module.validator.isEmpty({ url, method })
|
|
113
113
|
|
|
114
114
|
if (!validateIsEmpty.valid) {
|
|
@@ -135,7 +135,7 @@ class UniversalModule {
|
|
|
135
135
|
* @param {string} apiGroup API Group.
|
|
136
136
|
* @returns {object} Auto Pagination responses.
|
|
137
137
|
*/
|
|
138
|
-
async * autoPaginationList
|
|
138
|
+
async * autoPaginationList({ url, method, qs = {}, apiProvider = null, apiGroup = null }) {
|
|
139
139
|
if (!qs.$skip) {
|
|
140
140
|
qs.$skip = 0
|
|
141
141
|
}
|
|
@@ -5,7 +5,7 @@ class UniversalModule {
|
|
|
5
5
|
* Constructor.
|
|
6
6
|
* @param {class} parentModule Object of BusinessCentral class.
|
|
7
7
|
*/
|
|
8
|
-
constructor
|
|
8
|
+
constructor(parentModule) {
|
|
9
9
|
this.module = parentModule
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@ class UniversalModule {
|
|
|
19
19
|
* @param {string} apiGroup API Group.
|
|
20
20
|
* @returns {object} Universal Request Response.
|
|
21
21
|
*/
|
|
22
|
-
async request
|
|
22
|
+
async request({ url, method, qs = {}, body = {} }) {
|
|
23
23
|
const validateIsEmpty = this.module.validator.isEmpty({ url, method })
|
|
24
24
|
|
|
25
25
|
if (!validateIsEmpty.valid) {
|
|
@@ -48,14 +48,17 @@ class UniversalModule {
|
|
|
48
48
|
})
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
* Attach a
|
|
53
|
-
* @param {string}
|
|
54
|
-
* @param {string}
|
|
51
|
+
/**
|
|
52
|
+
* Attach a file to SharePoint from a URL.
|
|
53
|
+
* @param {string} driveID The ID of the SharePoint drive.
|
|
54
|
+
* @param {string} folderID The ID of the folder where the file will be attached.
|
|
55
|
+
* @param {string} url URL of the file to be attached.
|
|
56
|
+
* @param {string} fileName The name to be given to the file when attached.
|
|
57
|
+
* @param {string} mimeType The MIME type of the file.
|
|
55
58
|
* @returns {object} Universal Request Response.
|
|
56
59
|
*/
|
|
57
|
-
|
|
58
|
-
const validateIsEmpty = this.module.validator.isEmpty({ url,
|
|
60
|
+
async attach({ driveID, folderID, url, fileName, mimeType }) {
|
|
61
|
+
const validateIsEmpty = this.module.validator.isEmpty({ driveID, folderID, url, fileName, mimeType })
|
|
59
62
|
|
|
60
63
|
if (!validateIsEmpty.valid) {
|
|
61
64
|
return this.module.responseHandler.error(validateIsEmpty.errors)
|
|
@@ -72,7 +75,7 @@ class UniversalModule {
|
|
|
72
75
|
value: url
|
|
73
76
|
},
|
|
74
77
|
fileName: {
|
|
75
|
-
value: fileName
|
|
78
|
+
value: fileName
|
|
76
79
|
},
|
|
77
80
|
mimeType: {
|
|
78
81
|
value: mimeType
|
|
@@ -93,7 +96,7 @@ class UniversalModule {
|
|
|
93
96
|
* @param {string} apiGroup API Group.
|
|
94
97
|
* @returns {object} Universal List Response.
|
|
95
98
|
*/
|
|
96
|
-
async list
|
|
99
|
+
async list({ url, method, qs = {}, apiProvider = null, apiGroup = null }) {
|
|
97
100
|
const validateIsEmpty = this.module.validator.isEmpty({ url, method })
|
|
98
101
|
|
|
99
102
|
if (!validateIsEmpty.valid) {
|
|
@@ -120,7 +123,7 @@ class UniversalModule {
|
|
|
120
123
|
* @param {string} apiGroup API Group.
|
|
121
124
|
* @returns {object} Auto Pagination responses.
|
|
122
125
|
*/
|
|
123
|
-
async * autoPaginationList
|
|
126
|
+
async * autoPaginationList({ url, method, qs = {}, apiProvider = null, apiGroup = null }) {
|
|
124
127
|
if (!qs.$skip) {
|
|
125
128
|
qs.$skip = 0
|
|
126
129
|
}
|
package/src/utils/modelHelper.js
CHANGED
|
@@ -111,12 +111,12 @@ class ModelHelper {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
async complete({ message = '', external_id = null, properties = {}, exit = false }) {
|
|
115
|
-
await this.response({ status:
|
|
114
|
+
async complete({ message = '', status = 'COMPLETE', external_id = null, properties = {}, exit = false }) {
|
|
115
|
+
await this.response({ status: status, message, external_id, properties, exit })
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
async fail({ message = '', external_id = null, properties = {}, exit = false }) {
|
|
119
|
-
await this.response({ status:
|
|
118
|
+
async fail({ message = '', status = 'UNABLE', external_id = null, properties = {}, exit = false }) {
|
|
119
|
+
await this.response({ status: status, message, external_id, properties, exit })
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
async completeIf(condition, { message = '', external_id = null, properties = {}, exit = false }) {
|