zudello-integration-sdk 1.0.30 → 1.0.33

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.30",
3
+ "version": "1.0.33",
4
4
  "description": "Zudello Integrations SDK",
5
5
  "main": "./src/index.js",
6
6
  "repository": {
@@ -15,6 +15,7 @@
15
15
  "axios": "^1.6.7",
16
16
  "circular-json": "^0.5.9",
17
17
  "dotenv": "^16.4.5",
18
+ "https": "^1.0.0",
18
19
  "lodash": "^4.17.21",
19
20
  "moment-timezone": "^0.5.45",
20
21
  "perf_hooks": "^0.0.1",
@@ -36,6 +36,7 @@ const PoDocumentModule = require("./submodules/intacct/PoDocument");
36
36
  const ArTermModule = require("./submodules/intacct/ArTerm");
37
37
  const ArInvoiceModule = require("./submodules/intacct/ArInvoice");
38
38
  const ArAdjustmentModule = require("./submodules/intacct/ArAdjustment");
39
+ const JournalModule = require("./submodules/intacct/Journal");
39
40
  const FileModule = require("./submodules/intacct/File");
40
41
  const ZoneModule = require("./submodules/intacct/Zone");
41
42
 
@@ -95,6 +96,7 @@ class IntacctSDK extends BaseSDK {
95
96
  this.arTerm = new ArTermModule(this);
96
97
  this.arInvoice = new ArInvoiceModule(this);
97
98
  this.arAdjustment = new ArAdjustmentModule(this);
99
+ this.journal = new JournalModule(this);
98
100
  this.zone = new ZoneModule(this);
99
101
  this.file = new FileModule(this);
100
102
  }
@@ -13,6 +13,23 @@ class ApAdjustmentModule {
13
13
  this.item = new ApAdjustmentItemModule(parentModule)
14
14
  }
15
15
 
16
+ /**
17
+ * Creates AP Adjustment.
18
+ * @returns {object} Create AP Adjustmnet Response.
19
+ */
20
+ async create ({ ...fields }) {
21
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/c1da53d1-140f-4476-8d74-42558d1d8fab`, {
22
+ mappable_parameters: {
23
+ debug: {
24
+ value: false
25
+ },
26
+ ...fields
27
+ }
28
+ }, {
29
+ _debug: true
30
+ })
31
+ }
32
+
16
33
  /**
17
34
  * Reuse Universal Listing with type APADJUSTMENT.
18
35
  * @returns {object} List Response.
@@ -0,0 +1,48 @@
1
+ 'use strict'
2
+
3
+ class JournalModule {
4
+ /**
5
+ * Constructor.
6
+ * @param {class} parentModule Object of Intacct class.
7
+ */
8
+ constructor (parentModule) {
9
+ this.module = parentModule
10
+ }
11
+
12
+ /**
13
+ * Creates Journal.
14
+ * @returns {object} Create Journal Response.
15
+ */
16
+ async create ({ ...fields }) {
17
+ return await this.module.makeRequest('POST', `${this.module.apiURL}/zintegrations/action/3b8a9f62-0a3f-472e-b7ad-c01af6b5c6e3`, {
18
+ mappable_parameters: {
19
+ debug: {
20
+ value: false
21
+ },
22
+ ...fields
23
+ }
24
+ }, {
25
+ _debug: true
26
+ })
27
+ }
28
+
29
+ /**
30
+ * Reuse Universal Listing with type JOURNAL.
31
+ * @returns {object} List Response.
32
+ */
33
+ async list ({ include = [], exclude = [], filters, orderBy = null, entity = null, showPrivate = false, pageSize = 1000, offset = 0, returnFormat = 'json' }) {
34
+ return await this.module.universal.list({ type: 'GLBATCH', include, exclude, filters, orderBy, entity, showPrivate, pageSize, offset, returnFormat })
35
+ }
36
+
37
+ /**
38
+ * Reuse Universal Auto Pagination Listing with type GLACCOUNT.
39
+ * @returns {object} Auto Pagination responses.
40
+ */
41
+ async * autoPaginationList ({ include = [], exclude = [], filters, orderBy = null, entity = null, showPrivate = false, pageSize = 1000, offset = 0, returnFormat = 'json' }) {
42
+ for await (const response of this.module.universal.autoPaginationList({ type: 'GLBATCH', include, exclude, filters, orderBy, entity, showPrivate, pageSize, offset, returnFormat })) {
43
+ yield response
44
+ }
45
+ }
46
+ }
47
+
48
+ module.exports = JournalModule
@@ -115,7 +115,7 @@ class UniversalModule {
115
115
  * @returns {object} Universal Request Response.
116
116
  */
117
117
  async attach({ url, method, qs = {}, body = {} }) {
118
- const validateIsEmpty = this.module.validator.isEmpty({ url, attachment });
118
+ const validateIsEmpty = this.module.validator.isEmpty({ url, body });
119
119
 
120
120
  if (!validateIsEmpty.valid) {
121
121
  return this.module.responseHandler.error(validateIsEmpty.errors);
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const axios = require('axios')
4
+ const https = require('https')
4
5
  const CircularJSON = require('circular-json')
5
6
  const ResponseHandler = require('./responseHandler')
6
7
 
@@ -14,7 +15,9 @@ class ApiInstance {
14
15
 
15
16
  this.responseHandler = new ResponseHandler()
16
17
 
17
- this.axiosInstance = axios.create()
18
+ this.axiosInstance = axios.create({
19
+ httpsAgent: new https.Agent({ keepAlive: true })
20
+ })
18
21
  this.axiosInstance.interceptors.request.use((config) => {
19
22
  if (this.bearerToken) {
20
23
  config.headers.Authorization = `Bearer ${this.bearerToken}`