zudello-integration-sdk 1.0.94 → 1.0.96
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
package/src/sdk/NetsuiteSOAP.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
const _ = require(
|
|
3
|
+
const _ = require("lodash");
|
|
4
4
|
|
|
5
|
-
const BaseSDK = require(
|
|
6
|
-
const VendorBillModule = require(
|
|
7
|
-
const VendorCreditModule = require(
|
|
8
|
-
const UniversalModule = require(
|
|
9
|
-
const UniversalTransactionModule = require(
|
|
10
|
-
const PurchaseOrderModule = require(
|
|
11
|
-
const ReceiptModule = require(
|
|
12
|
-
const AttachmentModule = require(
|
|
13
|
-
const JournalEntryModule = require(
|
|
5
|
+
const BaseSDK = require("./Base");
|
|
6
|
+
const VendorBillModule = require("./submodules/netsuite-soap/VendorBill");
|
|
7
|
+
const VendorCreditModule = require("./submodules/netsuite-soap/VendorCredit");
|
|
8
|
+
const UniversalModule = require("./submodules/netsuite-soap/Universal");
|
|
9
|
+
const UniversalTransactionModule = require("./submodules/netsuite-soap/UniversalTransaction");
|
|
10
|
+
const PurchaseOrderModule = require("./submodules/netsuite-soap/PurchaseOrder");
|
|
11
|
+
const ReceiptModule = require("./submodules/netsuite-soap/Receipt");
|
|
12
|
+
const AttachmentModule = require("./submodules/netsuite-soap/Attachment");
|
|
13
|
+
const JournalEntryModule = require("./submodules/netsuite-soap/JournalEntry");
|
|
14
14
|
|
|
15
15
|
class NetsuiteSoapSDK extends BaseSDK {
|
|
16
16
|
/**
|
|
@@ -20,23 +20,23 @@ class NetsuiteSoapSDK extends BaseSDK {
|
|
|
20
20
|
constructor(connectionUUID = null) {
|
|
21
21
|
super({
|
|
22
22
|
connectionUUID,
|
|
23
|
-
appUUIDKey:
|
|
24
|
-
integrationName:
|
|
25
|
-
})
|
|
23
|
+
appUUIDKey: "netsuite",
|
|
24
|
+
integrationName: "NetsuiteSOAP",
|
|
25
|
+
});
|
|
26
26
|
|
|
27
|
-
this.transformToTypes = [
|
|
27
|
+
this.transformToTypes = ["vendorBill", "itemReceipt"];
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Create submodule instances.
|
|
31
31
|
*/
|
|
32
|
-
this.vendorBill = new VendorBillModule(this)
|
|
33
|
-
this.vendorCredit = new VendorCreditModule(this)
|
|
34
|
-
this.universal = new UniversalModule(this)
|
|
35
|
-
this.universalTransaction = new UniversalTransactionModule(this)
|
|
36
|
-
this.purchaseOrder = new PurchaseOrderModule(this)
|
|
37
|
-
this.receipt = new ReceiptModule(this)
|
|
38
|
-
this.attach = new AttachmentModule(this)
|
|
39
|
-
this.journalEntry = new JournalEntryModule(this)
|
|
32
|
+
this.vendorBill = new VendorBillModule(this);
|
|
33
|
+
this.vendorCredit = new VendorCreditModule(this);
|
|
34
|
+
this.universal = new UniversalModule(this);
|
|
35
|
+
this.universalTransaction = new UniversalTransactionModule(this);
|
|
36
|
+
this.purchaseOrder = new PurchaseOrderModule(this);
|
|
37
|
+
this.receipt = new ReceiptModule(this);
|
|
38
|
+
this.attach = new AttachmentModule(this);
|
|
39
|
+
this.journalEntry = new JournalEntryModule(this);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -46,20 +46,23 @@ class NetsuiteSoapSDK extends BaseSDK {
|
|
|
46
46
|
* @returns {object} Transformed Response.
|
|
47
47
|
*/
|
|
48
48
|
async transform({ transformFrom, transformTo }) {
|
|
49
|
-
const validateIncludes = this.validator.includes(
|
|
49
|
+
const validateIncludes = this.validator.includes(
|
|
50
|
+
this.transformToTypes,
|
|
51
|
+
transformTo,
|
|
52
|
+
);
|
|
50
53
|
|
|
51
54
|
if (!validateIncludes.valid) {
|
|
52
|
-
return this.responseHandler.error(validateIncludes.errors)
|
|
55
|
+
return this.responseHandler.error(validateIncludes.errors);
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
const validateIsEmpty = this.validator.isEmpty({ transformFrom })
|
|
58
|
+
const validateIsEmpty = this.validator.isEmpty({ transformFrom });
|
|
56
59
|
|
|
57
60
|
if (!validateIsEmpty.valid) {
|
|
58
|
-
return this.responseHandler.error(validateIsEmpty.errors)
|
|
61
|
+
return this.responseHandler.error(validateIsEmpty.errors);
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
return await this.makeRequest(
|
|
62
|
-
|
|
65
|
+
"POST",
|
|
63
66
|
`${this.apiURL}/zintegrations/action/d751e693-6bbb-4c93-aff4-6561bba29f03`,
|
|
64
67
|
{
|
|
65
68
|
mappable_parameters: {
|
|
@@ -70,9 +73,11 @@ class NetsuiteSoapSDK extends BaseSDK {
|
|
|
70
73
|
value: transformTo,
|
|
71
74
|
},
|
|
72
75
|
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
73
78
|
_debug: true,
|
|
74
|
-
}
|
|
75
|
-
)
|
|
79
|
+
},
|
|
80
|
+
);
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
parseFilters(entries) {
|
|
@@ -87,9 +92,9 @@ class NetsuiteSoapSDK extends BaseSDK {
|
|
|
87
92
|
value: {
|
|
88
93
|
value: entry.value,
|
|
89
94
|
},
|
|
90
|
-
}
|
|
91
|
-
})
|
|
95
|
+
};
|
|
96
|
+
});
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
module.exports = NetsuiteSoapSDK
|
|
100
|
+
module.exports = NetsuiteSoapSDK;
|
package/src/sdk/Unleashed.js
CHANGED
|
@@ -9,6 +9,28 @@ class TaskModule {
|
|
|
9
9
|
this.module = parentModule
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Creates Tasks.
|
|
14
|
+
* @returns {object} Create Task Response.
|
|
15
|
+
*/
|
|
16
|
+
async create({ ...fields }) {
|
|
17
|
+
return await this.module.makeRequest(
|
|
18
|
+
"POST",
|
|
19
|
+
`${this.module.apiURL}/zintegrations/action/c71ef5b8-c3a9-49e0-b282-fe575effa18b`,
|
|
20
|
+
{
|
|
21
|
+
mappable_parameters: {
|
|
22
|
+
debug: {
|
|
23
|
+
value: false,
|
|
24
|
+
},
|
|
25
|
+
...fields,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
_debug: true,
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
12
34
|
/**
|
|
13
35
|
* Reuse Universal Listing with type TASK.
|
|
14
36
|
* @returns {object} List Response.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
class VendorCreditModule {
|
|
4
4
|
/**
|
|
5
5
|
* Constructor.
|
|
6
6
|
* @param {class} parentModule Object of Netsuite class.
|
|
7
7
|
*/
|
|
8
|
-
constructor
|
|
9
|
-
this.module = parentModule
|
|
8
|
+
constructor(parentModule) {
|
|
9
|
+
this.module = parentModule;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -16,24 +16,31 @@ class VendorCreditModule {
|
|
|
16
16
|
* @param {string} customForm Custom credit form.
|
|
17
17
|
* @returns {object} Response.
|
|
18
18
|
*/
|
|
19
|
-
async create
|
|
20
|
-
return await this.module.makeRequest(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
async create({ body, memo, customForm }) {
|
|
20
|
+
return await this.module.makeRequest(
|
|
21
|
+
"POST",
|
|
22
|
+
`${this.module.apiURL}/zintegrations/action/cdb6be5c-1137-425e-a162-76cfdbc8e65b`,
|
|
23
|
+
{
|
|
24
|
+
mappable_parameters: {
|
|
25
|
+
debug: {
|
|
26
|
+
value: false,
|
|
27
|
+
},
|
|
28
|
+
body: {
|
|
29
|
+
value: body,
|
|
30
|
+
},
|
|
31
|
+
memo: {
|
|
32
|
+
value: memo,
|
|
33
|
+
},
|
|
34
|
+
customForm: {
|
|
35
|
+
value: customForm,
|
|
36
|
+
},
|
|
24
37
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
memo: {
|
|
29
|
-
value: memo
|
|
30
|
-
},
|
|
31
|
-
customForm: {
|
|
32
|
-
value: customForm
|
|
33
|
-
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
_debug: true,
|
|
34
41
|
}
|
|
35
|
-
|
|
42
|
+
);
|
|
36
43
|
}
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
module.exports = VendorCreditModule
|
|
46
|
+
module.exports = VendorCreditModule;
|
|
@@ -3,22 +3,22 @@ const _ = require("lodash");
|
|
|
3
3
|
|
|
4
4
|
class UniversalModule {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
* Constructor.
|
|
7
|
+
* @param {class} parentModule Object of Unleashed class.
|
|
8
|
+
*/
|
|
9
9
|
constructor(parentModule) {
|
|
10
10
|
this.module = parentModule;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
async request({ url, method, qs =
|
|
14
|
+
* Universal Request By URL and Method.
|
|
15
|
+
* @param {string} url URL of request.
|
|
16
|
+
* @param {string} method Method of request.
|
|
17
|
+
* @param {object} qs Some available filters for listed data.
|
|
18
|
+
* @param {object} body Some available data inside.
|
|
19
|
+
* @returns {object} Universal Request Response.
|
|
20
|
+
*/
|
|
21
|
+
async request({ url, method, qs = "", body = {} }) {
|
|
22
22
|
const validateIsEmpty = this.module.validator.isEmpty({ url, method });
|
|
23
23
|
|
|
24
24
|
if (!validateIsEmpty.valid) {
|
|
@@ -32,7 +32,10 @@ class UniversalModule {
|
|
|
32
32
|
mappable_parameters: {
|
|
33
33
|
url: `${url}?`,
|
|
34
34
|
method,
|
|
35
|
-
qs
|
|
35
|
+
qs: {
|
|
36
|
+
isMap: true,
|
|
37
|
+
value: JSON.stringify(qs),
|
|
38
|
+
},
|
|
36
39
|
body: {
|
|
37
40
|
isMap: true,
|
|
38
41
|
value: JSON.stringify(body),
|
|
@@ -45,7 +48,7 @@ class UniversalModule {
|
|
|
45
48
|
);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
validNumbers(number) {
|
|
51
|
+
validNumbers(number) {
|
|
49
52
|
if (!_.isInteger(number) || number < 1) {
|
|
50
53
|
throw new Error(
|
|
51
54
|
"Page number and page size must be positive numbers greater than zero."
|
|
@@ -55,42 +58,49 @@ class UniversalModule {
|
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
async list({ url, pageNumber = 1, pageSize = 100, qs =
|
|
67
|
-
if (!this.validNumbers(pageSize) && !this.validNumbers(pageNumber)) {
|
|
61
|
+
* Universal List By URL.
|
|
62
|
+
* @param {string} url URL of listed data.
|
|
63
|
+
* @param {number} pageNumber Page number of listed data.
|
|
64
|
+
* @param {number} pageSize Page size of listed data.
|
|
65
|
+
* @param {object} qs Some available filters for listed data.
|
|
66
|
+
* @param {object} body Some available data inside.
|
|
67
|
+
* @returns {object} Universal List Response.
|
|
68
|
+
*/
|
|
69
|
+
async list({ url, pageNumber = 1, pageSize = 100, qs = "", body = "" }) {
|
|
70
|
+
if (!this.validNumbers(pageSize) && !this.validNumbers(pageNumber)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
68
73
|
|
|
69
74
|
return await this.request({
|
|
70
75
|
url: `${url}/${pageNumber}`,
|
|
71
76
|
method: "GET",
|
|
72
|
-
qs: qs ? `${qs}&PageSize=${pageSize}` :
|
|
73
|
-
body:
|
|
74
|
-
q: query,
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
+
qs: qs ? `${qs}&PageSize=${pageSize}` : `PageSize=${pageSize}`,
|
|
78
|
+
body: body,
|
|
77
79
|
appendLimit: true,
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
async *autoPaginationList({
|
|
91
|
-
|
|
84
|
+
* Universal Auto Pagination Listing.
|
|
85
|
+
* @param {string} url URL of listed data.
|
|
86
|
+
* @param {number} pageNumber Page number of listed data.
|
|
87
|
+
* @param {number} pageSize Page size of listed data.
|
|
88
|
+
* @param {object} qs Some available filters for listed data.
|
|
89
|
+
* @param {object} body Some available data inside.
|
|
90
|
+
* @returns {object} Auto Pagination responses.
|
|
91
|
+
*/
|
|
92
|
+
async *autoPaginationList({
|
|
93
|
+
url,
|
|
94
|
+
pageNumber = 1,
|
|
95
|
+
pageSize = 100,
|
|
96
|
+
qs = "",
|
|
97
|
+
body = "",
|
|
98
|
+
}) {
|
|
99
|
+
if (!this.validNumbers(pageSize) || !this.validNumbers(pageNumber)) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
92
102
|
|
|
93
|
-
let response = await this.list({ url, pageNumber, pageSize, qs,
|
|
103
|
+
let response = await this.list({ url, pageNumber, pageSize, qs, body });
|
|
94
104
|
let currentPageNumber = pageNumber;
|
|
95
105
|
yield response;
|
|
96
106
|
|
|
@@ -104,7 +114,7 @@ class UniversalModule {
|
|
|
104
114
|
pageNumber: currentPageNumber,
|
|
105
115
|
pageSize,
|
|
106
116
|
qs,
|
|
107
|
-
|
|
117
|
+
body,
|
|
108
118
|
});
|
|
109
119
|
|
|
110
120
|
yield response;
|