@twec/node-suite
v0.1.2
Published
Generic functionality for connecting to NetSuite Web Services from Node
Downloads
6
Readme
Node-Suite
(Node + NetSuite)
This package contains functionality for connecting to NetSuite Web Services from Node, handling token authorization and SOAP XML parsing, and allows fetching records and uploading files.
Install
npm install @twec/node-suite
Use in your node app
Import
const NetSuite = require('node-suite');
// or: import NetSuite from 'node-suite';
Instantiate
When instatiating your netsuite object, you'll need to provide a config object with connection details. See config.json.example.
const netSuiteConfig = {
// various properties
// see config.json.example
// or the defaultConfig in index.js
};
const ns = new NetSuite(netSuiteConfig);
Get a record
const record = await ns.get({
// Specify one or more of these properties
type: '',
internalId: '',
externalId: ''
});
Upload a file
const fileRef = await ns.upload(
'./some/local/dir/my-file.csv', // local file
'uploads/my-file.csv', // NetSuite target file path
);
Other
Checkout other methods: look at the netsuite object console.log(ns);
and read index.js.
Limitations
Currently you can only fetch records (get
operation), upload a file (upsert
operation), and fetch folders.
Unit Testing
npm test
will run both the AVA unit tests and ESLint.
Test it out locally
- Create a
config.json
in the root of the package directory; seeconfig.json.example
for an example of the format expected. - Modify
config.json
to have the appropriate connection strings (likely pointing to sandbox) - Modify
test.js
to comment-out code to run a specific test - Run
node test.js