zudello-integration-sdk 1.0.80 → 1.0.82
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
|
@@ -10,6 +10,7 @@ const UniversalTransactionModule = require("./submodules/netsuite-soap/Universal
|
|
|
10
10
|
const PurchaseOrderModule = require("./submodules/netsuite-soap/PurchaseOrder");
|
|
11
11
|
const ReceiptModule = require("./submodules/netsuite-soap/Receipt");
|
|
12
12
|
const AttachmentModule = require("./submodules/netsuite-soap/Attachment");
|
|
13
|
+
const JournalEntryModule = require("./submodules/netsuite-soap/JournalEntry");
|
|
13
14
|
|
|
14
15
|
class NetsuiteSoapSDK extends BaseSDK {
|
|
15
16
|
/**
|
|
@@ -41,6 +42,7 @@ class NetsuiteSoapSDK extends BaseSDK {
|
|
|
41
42
|
this.purchaseOrder = new PurchaseOrderModule(this);
|
|
42
43
|
this.receipt = new ReceiptModule(this);
|
|
43
44
|
this.attach = new AttachmentModule(this);
|
|
45
|
+
this.journalEntry = new JournalEntryModule(this);
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
/**
|
|
@@ -77,12 +77,12 @@ class UniversalModule {
|
|
|
77
77
|
/**
|
|
78
78
|
* Auto-pagination generator using cursor-based pagination (recommended).
|
|
79
79
|
* @param {string} sql Base SQL Query.
|
|
80
|
-
* @param {object} options Cursor options: { cursorField, limit, orderBy }.
|
|
80
|
+
* @param {object} options Cursor options: { cursorField, cursorFieldAlias, limit, orderBy }.
|
|
81
81
|
* @param {object} queryParams Query parameters.
|
|
82
82
|
* @returns {AsyncGenerator} Yields cursor-based responses.
|
|
83
83
|
*/
|
|
84
84
|
async *autoCursorQuery({ sql, options = {}, queryParams = {} }) {
|
|
85
|
-
const { cursorField, limit = 100, orderBy } = options;
|
|
85
|
+
const { cursorField, cursorFieldAlias, limit = 100, orderBy } = options;
|
|
86
86
|
|
|
87
87
|
let cursorValue = null;
|
|
88
88
|
let hasMoreData = true;
|
|
@@ -98,7 +98,8 @@ class UniversalModule {
|
|
|
98
98
|
|
|
99
99
|
const records = response?.data || [];
|
|
100
100
|
if (records.length > 0 && cursorField) {
|
|
101
|
-
|
|
101
|
+
const fieldToExtract = cursorFieldAlias || cursorField;
|
|
102
|
+
cursorValue = records[records.length - 1][fieldToExtract];
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
hasMoreData = records.length === limit;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
class JournalEntryModule {
|
|
4
|
+
/**
|
|
5
|
+
* Constructor.
|
|
6
|
+
* @param {class} parentModule Object of Netsuite class.
|
|
7
|
+
*/
|
|
8
|
+
constructor (parentModule) {
|
|
9
|
+
this.module = parentModule
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create journal entry.
|
|
14
|
+
* @param {object} body Body of journal entry.
|
|
15
|
+
* @returns {object} Response.
|
|
16
|
+
*/
|
|
17
|
+
async create ({ body }) {
|
|
18
|
+
return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/5c57e1c0-b0c4-4f24-a2a3-291683b67c65`, {
|
|
19
|
+
mappable_parameters: {
|
|
20
|
+
debug: {
|
|
21
|
+
value: false
|
|
22
|
+
},
|
|
23
|
+
body: {
|
|
24
|
+
value: body
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
_debug: true
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = JournalEntryModule
|
package/src/utils/trigger.js
CHANGED
|
@@ -6,7 +6,7 @@ class Trigger {
|
|
|
6
6
|
this.teamUUID = teamUUID
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
async run(uuid, data = {}) {
|
|
9
|
+
async run(uuid, data = {}, teamUUID = null) {
|
|
10
10
|
if (!this.apiInstance || !this.teamUUID || !uuid || !process.env.ZUDELLO_API_URL) {
|
|
11
11
|
return
|
|
12
12
|
}
|
|
@@ -19,7 +19,7 @@ class Trigger {
|
|
|
19
19
|
data
|
|
20
20
|
}
|
|
21
21
|
}, {
|
|
22
|
-
'x-team': this.teamUUID
|
|
22
|
+
'x-team': teamUUID || this.teamUUID
|
|
23
23
|
})
|
|
24
24
|
}
|
|
25
25
|
}
|