zudello-integration-sdk 1.0.43 → 1.0.45

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.43",
3
+ "version": "1.0.45",
4
4
  "description": "Zudello Integrations SDK",
5
5
  "main": "./src/index.js",
6
6
  "repository": {
@@ -1,93 +1,99 @@
1
- 'use strict'
1
+ "use strict";
2
2
 
3
- const _ = require('lodash')
3
+ const _ = require("lodash");
4
4
 
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')
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");
12
13
 
13
14
  class NetsuiteSoapSDK extends BaseSDK {
14
- /**
15
- * Constructor.
16
- * @param {class} auth Auth class object with authorized api instance.
17
- * @param {string} connectionUUID The UUID of the Connection we're working on.
18
- */
19
- constructor (auth, connectionUUID, organizationUUID, apiURL, apiVersion, loggerClass = null) {
20
- super({
21
- auth,
22
- connectionUUID,
23
- organizationUUID,
24
- apiURL,
25
- apiVersion,
26
- appUUIDKey: 'netsuite',
27
- integrationName: 'NetsuiteSOAP',
28
- loggerClass
29
- })
15
+ /**
16
+ * Constructor.
17
+ * @param {class} auth Auth class object with authorized api instance.
18
+ * @param {string} connectionUUID The UUID of the Connection we're working on.
19
+ */
20
+ constructor(auth, connectionUUID, organizationUUID, apiURL, apiVersion, loggerClass = null) {
21
+ super({
22
+ auth,
23
+ connectionUUID,
24
+ organizationUUID,
25
+ apiURL,
26
+ apiVersion,
27
+ appUUIDKey: "netsuite",
28
+ integrationName: "NetsuiteSOAP",
29
+ loggerClass,
30
+ });
30
31
 
31
- this.transformToTypes = ['vendorBill', 'itemReceipt']
32
+ this.transformToTypes = ["vendorBill", "itemReceipt"];
32
33
 
33
- /**
34
- * Create submodule instances.
35
- */
36
- this.vendorBill = new VendorBillModule(this)
37
- this.vendorCredit = new VendorCreditModule(this)
38
- this.universal = new UniversalModule(this)
39
- this.universalTransaction = new UniversalTransactionModule(this)
40
- this.purchaseOrder = new PurchaseOrderModule(this)
41
- this.receipt = new ReceiptModule(this)
42
- }
34
+ /**
35
+ * Create submodule instances.
36
+ */
37
+ this.vendorBill = new VendorBillModule(this);
38
+ this.vendorCredit = new VendorCreditModule(this);
39
+ this.universal = new UniversalModule(this);
40
+ this.universalTransaction = new UniversalTransactionModule(this);
41
+ this.purchaseOrder = new PurchaseOrderModule(this);
42
+ this.receipt = new ReceiptModule(this);
43
+ this.attach = new AttachmentModule(this);
44
+ }
43
45
 
44
- /**
45
- * Transaction transform FROM.
46
- * @param {array} transformFrom.
47
- * @param {string} transformTo.
48
- * @returns {object} Transformed Response.
49
- */
50
- async transform ({ transformFrom, transformTo }) {
51
- const validateIncludes = this.validator.includes(this.transformToTypes, transformTo)
46
+ /**
47
+ * Transaction transform FROM.
48
+ * @param {array} transformFrom.
49
+ * @param {string} transformTo.
50
+ * @returns {object} Transformed Response.
51
+ */
52
+ async transform({ transformFrom, transformTo }) {
53
+ const validateIncludes = this.validator.includes(this.transformToTypes, transformTo);
52
54
 
53
- if (!validateIncludes.valid) {
54
- return this.responseHandler.error(validateIncludes.errors)
55
- }
55
+ if (!validateIncludes.valid) {
56
+ return this.responseHandler.error(validateIncludes.errors);
57
+ }
56
58
 
57
- const validateIsEmpty = this.validator.isEmpty({ transformFrom })
59
+ const validateIsEmpty = this.validator.isEmpty({ transformFrom });
58
60
 
59
- if (!validateIsEmpty.valid) {
60
- return this.responseHandler.error(validateIsEmpty.errors)
61
- }
61
+ if (!validateIsEmpty.valid) {
62
+ return this.responseHandler.error(validateIsEmpty.errors);
63
+ }
62
64
 
63
- return await this.makeRequest('GET', `${this.apiURL}/zintegrations/action/d751e693-6bbb-4c93-aff4-6561bba29f03`, {
64
- mappable_parameters: {
65
- transformFrom: {
66
- value: transformFrom
67
- },
68
- transformTo: {
69
- value: transformTo
70
- }
71
- },
72
- _debug: true
73
- })
74
- }
65
+ return await this.makeRequest(
66
+ "GET",
67
+ `${this.apiURL}/zintegrations/action/d751e693-6bbb-4c93-aff4-6561bba29f03`,
68
+ {
69
+ mappable_parameters: {
70
+ transformFrom: {
71
+ value: transformFrom,
72
+ },
73
+ transformTo: {
74
+ value: transformTo,
75
+ },
76
+ },
77
+ _debug: true,
78
+ }
79
+ );
80
+ }
75
81
 
76
- parseFilters (entries) {
77
- return _.map(entries, entry => {
78
- return {
79
- field: {
80
- value: entry.field
81
- },
82
- operator: {
83
- value: entry.operator
84
- },
85
- value: {
86
- value: entry.value
87
- }
88
- }
89
- })
90
- }
82
+ parseFilters(entries) {
83
+ return _.map(entries, (entry) => {
84
+ return {
85
+ field: {
86
+ value: entry.field,
87
+ },
88
+ operator: {
89
+ value: entry.operator,
90
+ },
91
+ value: {
92
+ value: entry.value,
93
+ },
94
+ };
95
+ });
96
+ }
91
97
  }
92
98
 
93
- module.exports = NetsuiteSoapSDK
99
+ module.exports = NetsuiteSoapSDK;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ class AttachmentModule {
4
+ /**
5
+ * Constructor.
6
+ * @param {class} parentModule Object of Netsuite class.
7
+ */
8
+ constructor(parentModule) {
9
+ this.module = parentModule;
10
+ }
11
+
12
+ /**
13
+ * Create attachment.
14
+ * @param {object} body Body of attachment. And should contain the following fields: record_type, record_id, folder_id, s3_signed_url, file_name
15
+ * @returns {object} Response.
16
+ */
17
+ async create({ body }) {
18
+ return await this.module.makeRequest(
19
+ "POST",
20
+ `${this.module.apiURL}/zintegrations/action/621f658e-96e6-4e5a-b6c3-716cd5bbbcf8`,
21
+ {
22
+ mappable_parameters: {
23
+ debug: {
24
+ value: false,
25
+ },
26
+ body: {
27
+ value: body,
28
+ },
29
+ },
30
+ },
31
+ {
32
+ _debug: true,
33
+ }
34
+ );
35
+ }
36
+ }
37
+
38
+ module.exports = AttachmentModule;