@brokenrubik/n8n-nodes-ns 1.0.0
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/LICENSE.md +19 -0
- package/README.md +235 -0
- package/dist/credentials/NetSuiteApi.credentials.d.ts +8 -0
- package/dist/credentials/NetSuiteApi.credentials.js +59 -0
- package/dist/credentials/NetSuiteApi.credentials.js.map +1 -0
- package/dist/nodes/NetSuite/NetSuite.node.d.ts +5 -0
- package/dist/nodes/NetSuite/NetSuite.node.js +82 -0
- package/dist/nodes/NetSuite/NetSuite.node.js.map +1 -0
- package/dist/nodes/NetSuite/NetSuite.node.json +20 -0
- package/dist/nodes/NetSuite/NetSuite.node.options.d.ts +2 -0
- package/dist/nodes/NetSuite/NetSuite.node.options.js +397 -0
- package/dist/nodes/NetSuite/NetSuite.node.options.js.map +1 -0
- package/dist/nodes/NetSuite/NetSuite.service.d.ts +31 -0
- package/dist/nodes/NetSuite/NetSuite.service.js +196 -0
- package/dist/nodes/NetSuite/NetSuite.service.js.map +1 -0
- package/dist/nodes/NetSuite/netsuite.svg +1 -0
- package/dist/nodes/NetSuite/operations/getRecord.d.ts +3 -0
- package/dist/nodes/NetSuite/operations/getRecord.js +46 -0
- package/dist/nodes/NetSuite/operations/getRecord.js.map +1 -0
- package/dist/nodes/NetSuite/operations/index.d.ts +7 -0
- package/dist/nodes/NetSuite/operations/index.js +18 -0
- package/dist/nodes/NetSuite/operations/index.js.map +1 -0
- package/dist/nodes/NetSuite/operations/insertRecord.d.ts +3 -0
- package/dist/nodes/NetSuite/operations/insertRecord.js +29 -0
- package/dist/nodes/NetSuite/operations/insertRecord.js.map +1 -0
- package/dist/nodes/NetSuite/operations/listRecords.d.ts +3 -0
- package/dist/nodes/NetSuite/operations/listRecords.js +71 -0
- package/dist/nodes/NetSuite/operations/listRecords.js.map +1 -0
- package/dist/nodes/NetSuite/operations/rawRequest.d.ts +3 -0
- package/dist/nodes/NetSuite/operations/rawRequest.js +48 -0
- package/dist/nodes/NetSuite/operations/rawRequest.js.map +1 -0
- package/dist/nodes/NetSuite/operations/removeRecord.d.ts +3 -0
- package/dist/nodes/NetSuite/operations/removeRecord.js +29 -0
- package/dist/nodes/NetSuite/operations/removeRecord.js.map +1 -0
- package/dist/nodes/NetSuite/operations/runSuiteQL.d.ts +3 -0
- package/dist/nodes/NetSuite/operations/runSuiteQL.js +66 -0
- package/dist/nodes/NetSuite/operations/runSuiteQL.js.map +1 -0
- package/dist/nodes/NetSuite/operations/updateRecord.d.ts +3 -0
- package/dist/nodes/NetSuite/operations/updateRecord.js +30 -0
- package/dist/nodes/NetSuite/operations/updateRecord.js.map +1 -0
- package/dist/nodes/NetSuite/types/auth.types.d.ts +6 -0
- package/dist/nodes/NetSuite/types/auth.types.js +3 -0
- package/dist/nodes/NetSuite/types/auth.types.js.map +1 -0
- package/dist/nodes/NetSuite/types/index.d.ts +8 -0
- package/dist/nodes/NetSuite/types/index.js +24 -0
- package/dist/nodes/NetSuite/types/index.js.map +1 -0
- package/dist/nodes/NetSuite/types/operation.types.d.ts +21 -0
- package/dist/nodes/NetSuite/types/operation.types.js +3 -0
- package/dist/nodes/NetSuite/types/operation.types.js.map +1 -0
- package/dist/nodes/NetSuite/types/request.types.d.ts +26 -0
- package/dist/nodes/NetSuite/types/request.types.js +11 -0
- package/dist/nodes/NetSuite/types/request.types.js.map +1 -0
- package/dist/nodes/NetSuite/types/response.types.d.ts +28 -0
- package/dist/nodes/NetSuite/types/response.types.js +3 -0
- package/dist/nodes/NetSuite/types/response.types.js.map +1 -0
- package/dist/nodes/NetSuite/utils/helpers.d.ts +2 -0
- package/dist/nodes/NetSuite/utils/helpers.js +11 -0
- package/dist/nodes/NetSuite/utils/helpers.js.map +1 -0
- package/dist/nodes/NetSuite/utils/response-handler.d.ts +5 -0
- package/dist/nodes/NetSuite/utils/response-handler.js +87 -0
- package/dist/nodes/NetSuite/utils/response-handler.js.map +1 -0
- package/dist/package.json +69 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.js +0 -0
- package/package.json +69 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2022 n8n
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# n8n-node-netsuite
|
|
2
|
+
|
|
3
|
+
A comprehensive n8n node for NetSuite integration, providing full access to NetSuite's SuiteTalk REST API with OAuth 2.0 M2M authentication.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### 🔐 **Secure Authentication**
|
|
8
|
+
|
|
9
|
+
- OAuth 2.0 Machine-to-Machine (M2M) authentication
|
|
10
|
+
- JWT token-based authentication with PS256 algorithm
|
|
11
|
+
- Automatic token caching and refresh
|
|
12
|
+
- Certificate-based security
|
|
13
|
+
|
|
14
|
+
### 📊 **Complete CRUD Operations**
|
|
15
|
+
|
|
16
|
+
- **List Records**: Retrieve multiple records with pagination support
|
|
17
|
+
- **Get Record**: Fetch individual records by ID
|
|
18
|
+
- **Insert Record**: Create new records
|
|
19
|
+
- **Update Record**: Modify existing records
|
|
20
|
+
- **Remove Record**: Delete records
|
|
21
|
+
|
|
22
|
+
### 🔍 **Advanced Query Capabilities**
|
|
23
|
+
|
|
24
|
+
- **SuiteQL Support**: Execute SQL-like queries against NetSuite data
|
|
25
|
+
- **Raw API Requests**: Direct access to any NetSuite REST endpoint
|
|
26
|
+
- **Pagination Handling**: Automatic handling of large result sets
|
|
27
|
+
- **Query Parameters**: Support for filters, limits, and offsets
|
|
28
|
+
|
|
29
|
+
### 🛠️ **Developer-Friendly Features**
|
|
30
|
+
|
|
31
|
+
- **Modular Architecture**: Clean, maintainable code structure
|
|
32
|
+
- **Comprehensive Error Handling**: NetSuite-specific error parsing and reporting
|
|
33
|
+
- **TypeScript Support**: Full type safety and IntelliSense
|
|
34
|
+
- **Extensive Documentation**: Detailed comments and examples
|
|
35
|
+
|
|
36
|
+
## Prerequisites
|
|
37
|
+
|
|
38
|
+
### System Requirements
|
|
39
|
+
|
|
40
|
+
- Node.js 20+ and npm
|
|
41
|
+
- n8n installed globally: `npm install n8n -g`
|
|
42
|
+
|
|
43
|
+
### NetSuite Requirements
|
|
44
|
+
|
|
45
|
+
- NetSuite account with REST API access
|
|
46
|
+
- OAuth 2.0 Application configured in NetSuite
|
|
47
|
+
- Certificate and private key for M2M authentication
|
|
48
|
+
- Appropriate permissions for the operations you want to perform
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
### For Development
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Clone the repository
|
|
56
|
+
git clone https://github.com/BrokenRubik/n8n-netsuite-node
|
|
57
|
+
cd n8n-netsuite-node
|
|
58
|
+
|
|
59
|
+
# Install dependencies
|
|
60
|
+
npm install
|
|
61
|
+
|
|
62
|
+
# Build the project
|
|
63
|
+
npm run build
|
|
64
|
+
|
|
65
|
+
# Link for local development
|
|
66
|
+
npm link
|
|
67
|
+
|
|
68
|
+
# Restart n8n to load the new node: https://docs.n8n.io/integrations/creating-nodes/test/run-node-locally/
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Setup Instructions
|
|
72
|
+
|
|
73
|
+
### Step 1: Create NetSuite Integration Record
|
|
74
|
+
|
|
75
|
+
1. **Navigate to Integration Setup**:
|
|
76
|
+
- Log into your NetSuite account
|
|
77
|
+
- Go to **Setup → Integration → Manage Integrations → New**
|
|
78
|
+
|
|
79
|
+
2. **Configure Integration**:
|
|
80
|
+
- Enter a **Name** for your integration (e.g., "n8n NetSuite Integration")
|
|
81
|
+
- Set **State** to "Enabled"
|
|
82
|
+
- Under **Client Credentials (M2M)**, check **"Client Credentials (Machine To Machine) Grant"**
|
|
83
|
+
- Leave all other checkboxes unchecked
|
|
84
|
+
- Click **Save**
|
|
85
|
+
|
|
86
|
+
3. **Copy Integration Client ID**:
|
|
87
|
+
- ⚠️ **Important**: After saving, immediately copy the **Integration Client ID**
|
|
88
|
+
- This ID will disappear if you close the tab or navigate away
|
|
89
|
+
- Store it securely as you'll need it for the n8n credentials
|
|
90
|
+
|
|
91
|
+
### Step 2: Generate Certificate and Private Key
|
|
92
|
+
|
|
93
|
+
1. **Create Certificate Pair**:
|
|
94
|
+
- Open a terminal/command prompt
|
|
95
|
+
- Generate a private key and certificate using OpenSSL:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
openssl req -x509 -newkey rsa:3072 -keyout n8n_key.pem -out n8n_cert.pem -days 365 -nodes\n
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
2. **Alternative: Using NetSuite's Guide**:
|
|
102
|
+
- Follow NetSuite's official certificate generation guide: [Creating Certificates for OAuth 2.0](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_162686838198.html)
|
|
103
|
+
|
|
104
|
+
### Step 3: Upload Certificate to NetSuite
|
|
105
|
+
|
|
106
|
+
1. **Navigate to Certificate Setup**:
|
|
107
|
+
- Go to **Setup → Integration → Manage Authentication → OAuth 2.0 Client Credentials (M2M) Setup**
|
|
108
|
+
|
|
109
|
+
2. **Upload Certificate**:
|
|
110
|
+
- Click **"New"** to create a new certificate entry
|
|
111
|
+
- Enter a **Name** for the certificate (e.g., "n8n Integration Certificate")
|
|
112
|
+
- Upload the **certificate file** (`n8n_cert.pem`) - not the private key
|
|
113
|
+
- Click **Save**
|
|
114
|
+
|
|
115
|
+
3. **Copy Certificate ID**:
|
|
116
|
+
- After saving, copy the generated **Certificate ID**
|
|
117
|
+
- You'll need this for the n8n credentials
|
|
118
|
+
|
|
119
|
+
### Step 4: Set Up n8n Credentials
|
|
120
|
+
|
|
121
|
+
1. **Open n8n**:
|
|
122
|
+
- Navigate to **Credentials** in n8n
|
|
123
|
+
- Click **"Add Credential"**
|
|
124
|
+
- Select **"NetSuite API"**
|
|
125
|
+
|
|
126
|
+
2. **Enter Credential Information**:
|
|
127
|
+
- **Account ID**: Your NetSuite account ID (e.g., "1234567" or "1234567_SB1" for sandbox)
|
|
128
|
+
- **Integration Client ID**: The ID copied from Step 1
|
|
129
|
+
- **Certificate ID (M2M)**: The ID copied from Step 3
|
|
130
|
+
- **PEM Content**: Copy and paste the entire content of your private key file (`n8n_key.pem`)
|
|
131
|
+
|
|
132
|
+
3. **PEM Content Format**:
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
-----BEGIN PRIVATE KEY-----
|
|
136
|
+
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC...
|
|
137
|
+
... (your private key content) ...
|
|
138
|
+
-----END PRIVATE KEY-----
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Step 5: Test the Connection
|
|
142
|
+
|
|
143
|
+
1. **Create a Test Workflow**:
|
|
144
|
+
- Create a new workflow in n8n
|
|
145
|
+
- Add a **NetSuite** node
|
|
146
|
+
- Configure it to list a simple record type (e.g., Customer)
|
|
147
|
+
- Execute the workflow to verify the connection
|
|
148
|
+
|
|
149
|
+
## Usage Examples
|
|
150
|
+
|
|
151
|
+
### List Sales Orders
|
|
152
|
+
|
|
153
|
+
```javascript
|
|
154
|
+
// Operation: List Records
|
|
155
|
+
// Record Type: Sales Order
|
|
156
|
+
// Query: status:pendingFulfillment
|
|
157
|
+
// Limit: 100
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Create Customer Record
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
// Operation: Insert Record
|
|
164
|
+
// Record Type: Customer
|
|
165
|
+
// Input data:
|
|
166
|
+
{
|
|
167
|
+
"companyName": "Acme Corp",
|
|
168
|
+
"email": "contact@acme.com",
|
|
169
|
+
"phone": "+1-555-0123"
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Execute SuiteQL Query
|
|
174
|
+
|
|
175
|
+
```javascript
|
|
176
|
+
// Operation: Execute SuiteQL
|
|
177
|
+
// Query: SELECT id, companyName FROM customer WHERE dateCreated >= '2024-01-01'
|
|
178
|
+
// Limit: 1000
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Raw API Request
|
|
182
|
+
|
|
183
|
+
```javascript
|
|
184
|
+
// Operation: Raw Request
|
|
185
|
+
// Method: GET
|
|
186
|
+
// Path: /services/rest/record/v1/customer/123
|
|
187
|
+
// Full Response: true
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Architecture
|
|
191
|
+
|
|
192
|
+
### Modular Design
|
|
193
|
+
|
|
194
|
+
- **Main Node**: Orchestrates operations and handles authentication
|
|
195
|
+
- **Service Layer**: Manages API communication and token handling
|
|
196
|
+
- **Operation Modules**: Individual handlers for each operation type
|
|
197
|
+
- **Type System**: Comprehensive TypeScript definitions
|
|
198
|
+
- **Utilities**: Shared helper functions and response handlers
|
|
199
|
+
|
|
200
|
+
### Error Handling
|
|
201
|
+
|
|
202
|
+
- Follows NetSuite's official error format documentation
|
|
203
|
+
- Provides detailed error messages with context
|
|
204
|
+
- Supports graceful degradation with "Continue on Fail"
|
|
205
|
+
- Includes error codes, paths, and actionable guidance
|
|
206
|
+
|
|
207
|
+
## Development
|
|
208
|
+
|
|
209
|
+
### Project Structure
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
├── nodes/NetSuite/
|
|
213
|
+
│ ├── types/ # TypeScript type definitions
|
|
214
|
+
│ ├── utils/ # Utility functions
|
|
215
|
+
│ ├── operations/ # Operation implementations
|
|
216
|
+
│ ├── NetSuite.node.ts # Main node class
|
|
217
|
+
│ └── NetSuite.service.ts # API service layer
|
|
218
|
+
├── credentials/ # Authentication configuration
|
|
219
|
+
└── dist/ # Built output
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Adding New Operations
|
|
223
|
+
|
|
224
|
+
1. Create operation file in `operations/` directory
|
|
225
|
+
2. Export function from `operations/index.ts`
|
|
226
|
+
3. Add case to switch statement in `NetSuite.node.ts`
|
|
227
|
+
4. Add UI configuration to `NetSuite.node.options.ts`
|
|
228
|
+
|
|
229
|
+
## Troubleshooting
|
|
230
|
+
|
|
231
|
+
### Debug Information
|
|
232
|
+
|
|
233
|
+
- Enable debug logging with `DEBUG=n8n-nodes-netsuite`
|
|
234
|
+
- Check n8n logs for detailed error messages
|
|
235
|
+
- Verify NetSuite audit trail for failed requests
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class NetSuiteApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NetSuiteApi = void 0;
|
|
4
|
+
class NetSuiteApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'netSuiteApi';
|
|
7
|
+
this.displayName = 'NetSuite API';
|
|
8
|
+
this.documentationUrl = 'https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/chapter_1540391670.html';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Account ID',
|
|
12
|
+
name: 'accountId',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: '',
|
|
15
|
+
required: true,
|
|
16
|
+
description: 'NetSuite Account ID',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
displayName: 'Integration Client ID',
|
|
20
|
+
name: 'integrationClientId',
|
|
21
|
+
type: 'string',
|
|
22
|
+
default: '',
|
|
23
|
+
required: true,
|
|
24
|
+
description: 'OAuth 2.0 Integration Client ID',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Certificate ID (M2M)',
|
|
28
|
+
name: 'certificateId',
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: '',
|
|
31
|
+
required: true,
|
|
32
|
+
description: 'OAuth 2.0 Certificate ID for M2M authentication',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
displayName: 'PEM Content',
|
|
36
|
+
name: 'pemContent',
|
|
37
|
+
type: 'string',
|
|
38
|
+
default: '',
|
|
39
|
+
typeOptions: {
|
|
40
|
+
multiline: true,
|
|
41
|
+
rows: 10,
|
|
42
|
+
},
|
|
43
|
+
required: true,
|
|
44
|
+
placeholder: '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----',
|
|
45
|
+
description: 'Paste your PEM file content here (private key, certificate, etc.)',
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
this.authenticate = {
|
|
49
|
+
type: 'generic',
|
|
50
|
+
properties: {
|
|
51
|
+
headers: {
|
|
52
|
+
'Content-Type': 'application/json',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.NetSuiteApi = NetSuiteApi;
|
|
59
|
+
//# sourceMappingURL=NetSuiteApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetSuiteApi.credentials.js","sourceRoot":"","sources":["../../credentials/NetSuiteApi.credentials.ts"],"names":[],"mappings":";;;AAMA,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,cAAc,CAAC;QAC7B,qBAAgB,GACf,uFAAuF,CAAC;QAEzF,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,qBAAqB;aAClC;YACD;gBACC,WAAW,EAAE,uBAAuB;gBACpC,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,iCAAiC;aAC9C;YACD;gBACC,WAAW,EAAE,sBAAsB;gBACnC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,iDAAiD;aAC9D;YACD;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE;oBACZ,SAAS,EAAE,IAAI;oBACf,IAAI,EAAE,EAAE;iBACR;gBACD,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,6DAA6D;gBAC1E,WAAW,EAAE,mEAAmE;aAChF;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,cAAc,EAAE,kBAAkB;iBAClC;aACD;SACD,CAAC;IAEH,CAAC;CAAA;AAvDD,kCAuDC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class NetSuite implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NetSuite = void 0;
|
|
4
|
+
const util_1 = require("util");
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const NetSuite_node_options_1 = require("./NetSuite.node.options");
|
|
7
|
+
const operations_1 = require("./operations");
|
|
8
|
+
const debug = (0, util_1.debuglog)('n8n-nodes-netsuite');
|
|
9
|
+
class NetSuite {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.description = NetSuite_node_options_1.nodeDescription;
|
|
12
|
+
}
|
|
13
|
+
async execute() {
|
|
14
|
+
const credentials = (await this.getCredentials('netSuiteApi'));
|
|
15
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
16
|
+
const items = this.getInputData();
|
|
17
|
+
const returnData = [];
|
|
18
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
19
|
+
const item = items[itemIndex];
|
|
20
|
+
let data;
|
|
21
|
+
try {
|
|
22
|
+
debug(`Processing ${operation} for ${itemIndex + 1} of ${items.length}`);
|
|
23
|
+
const options = { item, fns: this, credentials, itemIndex };
|
|
24
|
+
switch (operation) {
|
|
25
|
+
case 'getRecord':
|
|
26
|
+
data = await (0, operations_1.getRecord)(options);
|
|
27
|
+
break;
|
|
28
|
+
case 'listRecords':
|
|
29
|
+
data = await (0, operations_1.listRecords)(options);
|
|
30
|
+
break;
|
|
31
|
+
case 'removeRecord':
|
|
32
|
+
data = await (0, operations_1.removeRecord)(options);
|
|
33
|
+
break;
|
|
34
|
+
case 'insertRecord':
|
|
35
|
+
data = await (0, operations_1.insertRecord)(options);
|
|
36
|
+
break;
|
|
37
|
+
case 'updateRecord':
|
|
38
|
+
data = await (0, operations_1.updateRecord)(options);
|
|
39
|
+
break;
|
|
40
|
+
case 'rawRequest':
|
|
41
|
+
data = await (0, operations_1.rawRequest)(options);
|
|
42
|
+
break;
|
|
43
|
+
case 'runSuiteQL':
|
|
44
|
+
data = await (0, operations_1.runSuiteQL)(options);
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
const error = `The operation "${operation}" is not supported!`;
|
|
48
|
+
if (this.continueOnFail() !== true) {
|
|
49
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
data = { json: { error } };
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
if (Array.isArray(data)) {
|
|
57
|
+
returnData.push(...data);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
returnData.push(data);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
if (this.continueOnFail()) {
|
|
65
|
+
returnData.push({
|
|
66
|
+
json: {
|
|
67
|
+
error: error.message,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, {
|
|
73
|
+
itemIndex,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return this.prepareOutputData(returnData);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.NetSuite = NetSuite;
|
|
82
|
+
//# sourceMappingURL=NetSuite.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetSuite.node.js","sourceRoot":"","sources":["../../../nodes/NetSuite/NetSuite.node.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-base.NetSuite",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": [
|
|
6
|
+
"ERP"
|
|
7
|
+
],
|
|
8
|
+
"resources": {
|
|
9
|
+
"credentialDocumentation": [
|
|
10
|
+
{
|
|
11
|
+
"url": ""
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"primaryDocumentation": [
|
|
15
|
+
{
|
|
16
|
+
"url": ""
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|