n8n-nodes-sqlaccounting 1.0.0 → 1.1.1
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/README.md +119 -93
- package/dist/credentials/SqlAccountingApi.credentials.d.ts.map +1 -1
- package/dist/credentials/SqlAccountingApi.credentials.js +32 -27
- package/dist/nodes/SqlAccounting/SqlAccounting.node.d.ts +3 -0
- package/dist/nodes/SqlAccounting/SqlAccounting.node.d.ts.map +1 -1
- package/dist/nodes/SqlAccounting/SqlAccounting.node.js +23 -318
- package/dist/nodes/SqlAccounting/config.d.ts +8 -0
- package/dist/nodes/SqlAccounting/config.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/config.js +12 -0
- package/dist/nodes/SqlAccounting/contractTypes.d.ts +48 -0
- package/dist/nodes/SqlAccounting/contractTypes.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/contractTypes.js +12 -0
- package/dist/nodes/SqlAccounting/errors.d.ts +17 -0
- package/dist/nodes/SqlAccounting/errors.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/errors.js +47 -0
- package/dist/nodes/SqlAccounting/execute/readBody.d.ts +6 -0
- package/dist/nodes/SqlAccounting/execute/readBody.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/execute/readBody.js +67 -0
- package/dist/nodes/SqlAccounting/execute/readFilters.d.ts +4 -0
- package/dist/nodes/SqlAccounting/execute/readFilters.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/execute/readFilters.js +11 -0
- package/dist/nodes/SqlAccounting/execute/runOperation.d.ts +13 -0
- package/dist/nodes/SqlAccounting/execute/runOperation.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/execute/runOperation.js +68 -0
- package/dist/nodes/SqlAccounting/lookups.d.ts +6 -0
- package/dist/nodes/SqlAccounting/lookups.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/lookups.js +53 -0
- package/dist/nodes/SqlAccounting/normalize.d.ts +5 -0
- package/dist/nodes/SqlAccounting/normalize.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/normalize.js +18 -0
- package/dist/nodes/SqlAccounting/pagination.d.ts +10 -0
- package/dist/nodes/SqlAccounting/pagination.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/pagination.js +29 -0
- package/dist/nodes/SqlAccounting/registry.d.ts +30 -0
- package/dist/nodes/SqlAccounting/registry.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/registry.generated.d.ts +17 -0
- package/dist/nodes/SqlAccounting/registry.generated.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/registry.generated.js +1251 -0
- package/dist/nodes/SqlAccounting/registry.js +61 -0
- package/dist/nodes/SqlAccounting/request.d.ts +9 -0
- package/dist/nodes/SqlAccounting/request.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/request.js +44 -0
- package/dist/nodes/SqlAccounting/schema/assets.d.ts +3 -0
- package/dist/nodes/SqlAccounting/schema/assets.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/schema/assets.js +34 -0
- package/dist/nodes/SqlAccounting/schema/cast.d.ts +5 -0
- package/dist/nodes/SqlAccounting/schema/cast.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/schema/cast.js +99 -0
- package/dist/nodes/SqlAccounting/schema/documents.d.ts +3 -0
- package/dist/nodes/SqlAccounting/schema/documents.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/schema/documents.js +93 -0
- package/dist/nodes/SqlAccounting/schema/finance.d.ts +3 -0
- package/dist/nodes/SqlAccounting/schema/finance.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/schema/finance.js +81 -0
- package/dist/nodes/SqlAccounting/schema/index.d.ts +8 -0
- package/dist/nodes/SqlAccounting/schema/index.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/schema/index.js +48 -0
- package/dist/nodes/SqlAccounting/schema/parties.d.ts +3 -0
- package/dist/nodes/SqlAccounting/schema/parties.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/schema/parties.js +64 -0
- package/dist/nodes/SqlAccounting/schema/simple.d.ts +11 -0
- package/dist/nodes/SqlAccounting/schema/simple.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/schema/simple.js +41 -0
- package/dist/nodes/SqlAccounting/schema/stock.d.ts +3 -0
- package/dist/nodes/SqlAccounting/schema/stock.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/schema/stock.js +46 -0
- package/dist/nodes/SqlAccounting/schema/types.d.ts +31 -0
- package/dist/nodes/SqlAccounting/schema/types.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/schema/types.js +3 -0
- package/dist/nodes/SqlAccounting/templates.d.ts +2 -0
- package/dist/nodes/SqlAccounting/templates.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/templates.js +50 -0
- package/dist/nodes/SqlAccounting/transport.d.ts +6 -0
- package/dist/nodes/SqlAccounting/transport.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/transport.js +30 -0
- package/dist/nodes/SqlAccounting/ui/fieldProps.d.ts +5 -0
- package/dist/nodes/SqlAccounting/ui/fieldProps.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/ui/fieldProps.js +35 -0
- package/dist/nodes/SqlAccounting/ui/names.d.ts +15 -0
- package/dist/nodes/SqlAccounting/ui/names.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/ui/names.js +28 -0
- package/dist/nodes/SqlAccounting/ui/properties.d.ts +3 -0
- package/dist/nodes/SqlAccounting/ui/properties.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/ui/properties.js +296 -0
- package/dist/nodes/SqlAccounting/validation.d.ts +7 -0
- package/dist/nodes/SqlAccounting/validation.d.ts.map +1 -0
- package/dist/nodes/SqlAccounting/validation.js +74 -0
- package/package.json +22 -8
- package/dist/nodes/SqlAccounting/operations.d.ts +0 -34
- package/dist/nodes/SqlAccounting/operations.d.ts.map +0 -1
- package/dist/nodes/SqlAccounting/operations.js +0 -177
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
An [n8n](https://n8n.io) community node for the [SQL Accounting](https://www.sql.com.my) REST API (Malaysia).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It connects n8n to SQL Accounting through the SQL Accounting n8n Node service: a subscription proxy that signs your requests (AWS SigV4), enforces fair use and forwards them to `api.sql.my`.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/n8n-nodes-sqlaccounting)
|
|
8
8
|
[](LICENSE)
|
|
@@ -11,153 +11,179 @@ Connects SQL Accounting to any automation via the SQL Accounting n8n Node platfo
|
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
- **81
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
18
|
-
- **
|
|
14
|
+
- **81 resources**: master data, sales, purchase, AR, AP, GL, stock and reports.
|
|
15
|
+
- **Typed fields.** Required inputs are shown as real fields. Integers, booleans, dates and decimals are sent in the type the API expects. Enumerations (account type, journal, term type) are dropdowns.
|
|
16
|
+
- **Dropdowns that load from your company.** Fields such as Currency, Terms, Tax, Account, Customer, Supplier, Stock Item and Location list your own records.
|
|
17
|
+
- **Line-item editor** for sales, purchase, stock and journal documents. A raw JSON mode (pre-filled with a template) is available for every document.
|
|
18
|
+
- **Validation before sending.** Missing required fields, bad dates, missing lines, unbalanced journals and non-numeric IDs are reported all at once, before any request is made.
|
|
19
|
+
- **Return All** with correct 50-record paging, a Limit option and a Max Pages safety cap.
|
|
20
|
+
- **Filters** with a per-resource field list. Wildcards (`*term*`) and ranges (`2025-01-01~2025-01-31`) work on SQL Account 5.2025.1061.890 and later.
|
|
21
|
+
- **Zero runtime dependencies.**
|
|
19
22
|
|
|
20
23
|
---
|
|
21
24
|
|
|
22
25
|
## Prerequisites
|
|
23
26
|
|
|
24
|
-
1.
|
|
25
|
-
2. A SQL Accounting API access key and secret key (
|
|
26
|
-
3. A
|
|
27
|
+
1. SQL Accounting with the REST API enabled.
|
|
28
|
+
2. A SQL Accounting API **access key** and **secret key** (SQL Account API settings).
|
|
29
|
+
3. A **subscription token** (`sqlnode_...`) from the SQL Accounting n8n Node portal.
|
|
27
30
|
|
|
28
31
|
---
|
|
29
32
|
|
|
30
33
|
## Installation
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
In n8n: **Settings → Community Nodes → Install** → `n8n-nodes-sqlaccounting`.
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
Settings → Community Nodes → Install → n8n-nodes-sqlaccounting
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Self-hosted via CLI
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm install n8n-nodes-sqlaccounting
|
|
42
|
-
```
|
|
37
|
+
Self-hosted via CLI: `npm install n8n-nodes-sqlaccounting`.
|
|
43
38
|
|
|
44
39
|
---
|
|
45
40
|
|
|
46
41
|
## Credentials
|
|
47
42
|
|
|
48
|
-
|
|
43
|
+
Create a **SQL Accounting API** credential:
|
|
49
44
|
|
|
50
45
|
| Field | Description | Default |
|
|
51
46
|
|-------|-------------|---------|
|
|
52
|
-
| Platform
|
|
53
|
-
| SQL Access Key | From SQL Account API settings |
|
|
54
|
-
| SQL Secret Key | From SQL Account API settings
|
|
47
|
+
| Platform Token | Your `sqlnode_...` subscription token | none |
|
|
48
|
+
| SQL Access Key | From SQL Account API settings, format `<key_id>.sql.my/APIUSER` | none |
|
|
49
|
+
| SQL Secret Key | From SQL Account API settings | none |
|
|
55
50
|
| Service | SigV4 service name | `sqlaccount` |
|
|
56
51
|
| Region | SigV4 region | `ap-southeast-5` |
|
|
52
|
+
| Proxy URL | Advanced. Only for self-hosting or local testing | service URL |
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Credit Costs
|
|
54
|
+
**Test credential** calls `profile.get` and checks the token, the subscription and your SQL keys at once.
|
|
63
55
|
|
|
64
|
-
|
|
65
|
-
|----------------|-----------------|
|
|
66
|
-
| List / Get / Report | 1 |
|
|
67
|
-
| Create | 3 |
|
|
68
|
-
| Update (auto GET + PUT) | 4 total |
|
|
69
|
-
| Delete | 5 |
|
|
56
|
+
### How your SQL keys are handled
|
|
70
57
|
|
|
71
|
-
|
|
58
|
+
The node cannot sign requests itself, so your SQL access and secret keys are sent with each request over HTTPS to the proxy. The proxy holds them in memory only long enough to sign that single request. They are never stored and never logged, and request and response bodies are not logged either. The proxy sees the accounting data in transit, so use a SQL Account API user with the minimum rights you need.
|
|
72
59
|
|
|
73
60
|
---
|
|
74
61
|
|
|
75
|
-
##
|
|
62
|
+
## Using the node
|
|
76
63
|
|
|
77
|
-
###
|
|
64
|
+
### Records (master data)
|
|
78
65
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
66
|
+
1. Pick a **Resource** (for example Currency) and an **Operation**.
|
|
67
|
+
2. **Create** shows the required fields as inputs. Everything else is under **Additional Fields**. Use **Extra Fields (JSON)** for anything not listed, such as the `sdsbranch` sub-array on a customer.
|
|
68
|
+
3. **Update** shows **Fields to Update**. Only what you set is sent.
|
|
69
|
+
4. **Get / Update / Delete** need a record identifier. The field is labelled by what the resource uses:
|
|
70
|
+
- **Code**: the record code, for example `USD`.
|
|
71
|
+
- **DocKey / AutoKey**: SQL Account's internal numeric ID, for example for Tax, Shipper, Tariff, Batch, Stock Item and Asset records. This is not the code. Use **List** with a filter (for example `code=ST-6%`) and read `autokey` or `dockey` from the result.
|
|
82
72
|
|
|
83
|
-
###
|
|
73
|
+
### Documents (invoices, orders, journals, payments)
|
|
84
74
|
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
1. Fill the required header fields (customer or supplier code, date).
|
|
76
|
+
2. Add **Line Items**.
|
|
77
|
+
3. Or switch on **Use Raw JSON Instead**. The body is pre-filled with a template for that document type.
|
|
87
78
|
|
|
88
|
-
|
|
79
|
+
Example, a journal entry: set Document Date, add two lines (`Account`, `Debit`/`Credit`). Totals must balance, otherwise the node tells you before sending.
|
|
89
80
|
|
|
90
|
-
|
|
91
|
-
`purchasedebitnote` `purchasecancellednote` `cashpurchase` `goodsreceived`
|
|
92
|
-
`extragoodsreceived`
|
|
81
|
+
### Lists, filters and paging
|
|
93
82
|
|
|
94
|
-
|
|
83
|
+
- **Return All** fetches every page (50 records each), up to **Max Pages**.
|
|
84
|
+
- Without Return All, **Limit** (1 to 50) and **Offset** apply.
|
|
85
|
+
- **Filters** lists the fields of the resource. **Custom Filters** takes any API field name.
|
|
95
86
|
|
|
96
|
-
|
|
97
|
-
`customerpayment` `customerdeposit` `customerrefund` `customercontra`
|
|
87
|
+
### Deleting
|
|
98
88
|
|
|
99
|
-
|
|
89
|
+
Delete returns `{ "success": true, "resource": "...", "deleted": <id> }`.
|
|
100
90
|
|
|
101
|
-
|
|
102
|
-
`supplierpayment` `supplierdeposit` `supplierrefund` `suppliercontra`
|
|
103
|
-
|
|
104
|
-
### Transactional — GL / Stock / Manufacturing
|
|
105
|
-
|
|
106
|
-
`journalentry` `paymentvoucher` `receiptvoucher` `bankadjustment` `stockitem`
|
|
107
|
-
`stockadjustment` `stockissue` `stockreceived` `stocktransfer` `assembly`
|
|
108
|
-
`disassembly` `joborder` `itemtemplate` `currency`
|
|
91
|
+
---
|
|
109
92
|
|
|
110
|
-
|
|
93
|
+
## Example workflows
|
|
111
94
|
|
|
112
|
-
|
|
113
|
-
`stockbatchexpiry` `stockcard` `stockcardqty` `stockmonthendbalance`
|
|
114
|
-
`stockphysicalworksheet` `stockreorderadvice` `stockserialnumberconflict`
|
|
115
|
-
`stockserialnumberoutstanding`
|
|
95
|
+
Import with **Workflow menu → Import from URL/File** (or paste into the canvas), then pick your **SQL Accounting API** credential on the node.
|
|
116
96
|
|
|
117
|
-
|
|
97
|
+
**1. List every currency**
|
|
118
98
|
|
|
119
|
-
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"nodes": [
|
|
102
|
+
{ "parameters": {}, "name": "Manual Trigger", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [0, 0] },
|
|
103
|
+
{
|
|
104
|
+
"parameters": { "resource": "currency", "operation": "currency.list", "returnAll": true },
|
|
105
|
+
"name": "List currencies",
|
|
106
|
+
"type": "n8n-nodes-sqlaccounting.sqlAccounting",
|
|
107
|
+
"typeVersion": 1,
|
|
108
|
+
"position": [220, 0],
|
|
109
|
+
"credentials": { "sqlAccountingApi": { "id": "", "name": "SQL Accounting API" } }
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"connections": { "Manual Trigger": { "main": [[{ "node": "List currencies", "type": "main", "index": 0 }]] } }
|
|
113
|
+
}
|
|
114
|
+
```
|
|
120
115
|
|
|
121
|
-
|
|
116
|
+
**2. Create a sales quotation with one line**
|
|
122
117
|
|
|
123
118
|
```json
|
|
124
119
|
{
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
"code": "CUSTOMER001",
|
|
128
|
-
"description": "Monthly consulting services",
|
|
129
|
-
"currencycode": "MYR",
|
|
130
|
-
"currencyrate": 1,
|
|
131
|
-
"docamt": 1060.00,
|
|
132
|
-
"sdsdocdetail": [
|
|
120
|
+
"nodes": [
|
|
121
|
+
{ "parameters": {}, "name": "Manual Trigger", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [0, 0] },
|
|
133
122
|
{
|
|
134
|
-
"
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
"
|
|
142
|
-
"
|
|
123
|
+
"parameters": {
|
|
124
|
+
"resource": "salesquotation",
|
|
125
|
+
"operation": "salesquotation.create",
|
|
126
|
+
"salesquotation__code": "CUS-01",
|
|
127
|
+
"salesquotation__docdate": "={{ $today.toISODate() }}",
|
|
128
|
+
"salesquotation__lines": { "line": [{ "itemcode": "STK-001", "qty": "1", "unitprice": "100.00" }] }
|
|
129
|
+
},
|
|
130
|
+
"name": "Create quotation",
|
|
131
|
+
"type": "n8n-nodes-sqlaccounting.sqlAccounting",
|
|
132
|
+
"typeVersion": 1,
|
|
133
|
+
"position": [220, 0],
|
|
134
|
+
"credentials": { "sqlAccountingApi": { "id": "", "name": "SQL Accounting API" } }
|
|
143
135
|
}
|
|
144
|
-
]
|
|
136
|
+
],
|
|
137
|
+
"connections": { "Manual Trigger": { "main": [[{ "node": "Create quotation", "type": "main", "index": 0 }]] } }
|
|
145
138
|
}
|
|
146
139
|
```
|
|
147
140
|
|
|
141
|
+
The customer `CUS-01` and the stock item `STK-001` must already exist in SQL Account.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Troubleshooting
|
|
146
|
+
|
|
147
|
+
| Error code | Meaning | Fix |
|
|
148
|
+
|------------|---------|-----|
|
|
149
|
+
| `invalid_token` | Token wrong or revoked | Check Platform Token in the credential, or generate a new one in the portal |
|
|
150
|
+
| `subscription_inactive` | No active subscription | Renew in the portal |
|
|
151
|
+
| `rate_limited` | Over 120 requests per minute per token | Wait and retry, or slow the workflow |
|
|
152
|
+
| `sql_auth_failed` | SQL Account rejected the keys | Check SQL Access Key and Secret Key |
|
|
153
|
+
| `validation_failed` | Input rejected (field and hint are shown) | Fix the named field |
|
|
154
|
+
| `upstream_error` | SQL Account returned an error | Read the message and the upstream status |
|
|
155
|
+
| `unsupported_version` | Node and proxy versions differ | Update the node |
|
|
156
|
+
| `internal_error` | Proxy bug | Report it with the request id |
|
|
157
|
+
|
|
158
|
+
Common SQL Account messages:
|
|
159
|
+
|
|
160
|
+
- `not a valid floating point value`: a code was used where an AutoKey or DocKey is required.
|
|
161
|
+
- Empty bodies crash the SQL Account backend, so the node never sends them.
|
|
162
|
+
|
|
148
163
|
---
|
|
149
164
|
|
|
150
|
-
##
|
|
165
|
+
## Development
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
npm install --legacy-peer-deps
|
|
169
|
+
npm test # unit and integration tests
|
|
170
|
+
npm run test:cov # with coverage
|
|
171
|
+
npm run lint
|
|
172
|
+
npm run build
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Local testing without the cloud service:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
npm run mock-proxy # contract-compliant mock on http://localhost:8787, token sqlnode_test
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Then create a credential with Platform Token `sqlnode_test`, any SQL keys, and Proxy URL `http://localhost:8787`.
|
|
151
182
|
|
|
152
|
-
|
|
153
|
-
|-------|-------|-----|
|
|
154
|
-
| Authentication failed | Invalid platform API key | Check the Platform API Key in your credential |
|
|
155
|
-
| Insufficient credits | Balance is zero | Top up at the portal |
|
|
156
|
-
| 4xx from SQL Accounting | Bad request data | Check your JSON body or Record ID |
|
|
157
|
-
| 5xx from SQL Accounting | SQL Accounting server error | No credit charged — retry later |
|
|
183
|
+
The contract between the node and the proxy is in [contract/CONTRACT.md](contract/CONTRACT.md). The resource and operation list is generated from [contract/operations.json](contract/operations.json) (`npm run gen:registry`); tests fail if the two drift.
|
|
158
184
|
|
|
159
185
|
---
|
|
160
186
|
|
|
161
187
|
## License
|
|
162
188
|
|
|
163
|
-
|
|
189
|
+
MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqlAccountingApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/SqlAccountingApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SqlAccountingApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/SqlAccountingApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAGtB,qBAAa,gBAAiB,YAAW,eAAe;IACvD,IAAI,SAAsB;IAC1B,WAAW,SAAwB;IACnC,gBAAgB,SAA2D;IAG3E,YAAY,EAAE,oBAAoB,CAOhC;IAGF,IAAI,EAAE,sBAAsB,CAoB1B;IAEF,UAAU,EAAE,eAAe,EAAE,CAuD3B;CACF"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SqlAccountingApi = void 0;
|
|
4
|
-
|
|
5
|
-
const EDGE_FUNCTION_BASE = 'https://cqcxkvptxgslpneeobhv.supabase.co/functions/v1';
|
|
4
|
+
const config_1 = require("../nodes/SqlAccounting/config");
|
|
6
5
|
class SqlAccountingApi {
|
|
7
6
|
constructor() {
|
|
8
7
|
this.name = 'sqlAccountingApi';
|
|
9
8
|
this.displayName = 'SQL Accounting API';
|
|
10
9
|
this.documentationUrl = 'https://github.com/laurentyew/n8n-nodes-sqlaccounting';
|
|
11
|
-
//
|
|
12
|
-
// This is what allows httpRequestWithAuthentication() to work correctly
|
|
13
|
-
// and satisfies the no-http-request-with-manual-auth linter rule.
|
|
10
|
+
// Injects the platform token as a Bearer header on every request made with this credential.
|
|
14
11
|
this.authenticate = {
|
|
15
12
|
type: 'generic',
|
|
16
13
|
properties: {
|
|
@@ -19,37 +16,37 @@ class SqlAccountingApi {
|
|
|
19
16
|
},
|
|
20
17
|
},
|
|
21
18
|
};
|
|
22
|
-
//
|
|
23
|
-
// Calls profile.get (1 credit) to verify both the platform key AND
|
|
24
|
-
// the SQL Accounting credentials are valid.
|
|
19
|
+
// Powers the "Test credential" button: calls profile.get to verify both the token and the SQL keys.
|
|
25
20
|
this.test = {
|
|
26
21
|
request: {
|
|
27
|
-
baseURL:
|
|
28
|
-
url: '/sqlaccount',
|
|
22
|
+
baseURL: '={{$credentials.proxyBaseUrl}}',
|
|
23
|
+
url: '/functions/v1/sqlaccount',
|
|
29
24
|
method: 'POST',
|
|
30
25
|
body: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
contract_version: 1,
|
|
27
|
+
sql: {
|
|
28
|
+
access_key: '={{$credentials.sqlAccessKey}}',
|
|
29
|
+
secret_key: '={{$credentials.sqlSecretKey}}',
|
|
30
|
+
region: '={{$credentials.region}}',
|
|
31
|
+
service: '={{$credentials.service}}',
|
|
32
|
+
},
|
|
35
33
|
operation: 'profile.get',
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
body: '',
|
|
34
|
+
path_param: null,
|
|
35
|
+
query: {},
|
|
36
|
+
body: null,
|
|
40
37
|
},
|
|
41
38
|
json: true,
|
|
42
39
|
},
|
|
43
40
|
};
|
|
44
41
|
this.properties = [
|
|
45
42
|
{
|
|
46
|
-
displayName: 'Platform
|
|
43
|
+
displayName: 'Platform Token',
|
|
47
44
|
name: 'platformApiKey',
|
|
48
45
|
type: 'string',
|
|
49
46
|
typeOptions: { password: true },
|
|
50
47
|
default: '',
|
|
51
48
|
required: true,
|
|
52
|
-
description: 'Your
|
|
49
|
+
description: 'Your subscription token from the SQL Accounting n8n Node portal. Starts with sqlnode_.',
|
|
53
50
|
placeholder: 'sqlnode_...',
|
|
54
51
|
},
|
|
55
52
|
{
|
|
@@ -60,7 +57,7 @@ class SqlAccountingApi {
|
|
|
60
57
|
default: '',
|
|
61
58
|
required: true,
|
|
62
59
|
description: 'Your SQL Accounting API access key from the SQL Account API settings page',
|
|
63
|
-
placeholder: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.sql.my/
|
|
60
|
+
placeholder: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.sql.my/APIUSER',
|
|
64
61
|
},
|
|
65
62
|
{
|
|
66
63
|
displayName: 'SQL Secret Key',
|
|
@@ -69,26 +66,34 @@ class SqlAccountingApi {
|
|
|
69
66
|
typeOptions: { password: true },
|
|
70
67
|
default: '',
|
|
71
68
|
required: true,
|
|
72
|
-
description: 'Your SQL Accounting API secret key.
|
|
69
|
+
description: 'Your SQL Accounting API secret key. It is sent with each request over HTTPS, used in memory to sign that single request, and never stored or logged.',
|
|
73
70
|
},
|
|
74
71
|
{
|
|
75
72
|
displayName: 'Service',
|
|
76
73
|
name: 'service',
|
|
77
74
|
type: 'string',
|
|
78
|
-
default:
|
|
75
|
+
default: config_1.DEFAULT_SERVICE,
|
|
79
76
|
required: true,
|
|
80
|
-
description: 'SigV4 service name.
|
|
77
|
+
description: 'SigV4 service name. Only change if instructed by SQL Accounting support.',
|
|
81
78
|
},
|
|
82
79
|
{
|
|
83
80
|
displayName: 'Region',
|
|
84
81
|
name: 'region',
|
|
85
82
|
type: 'string',
|
|
86
|
-
default:
|
|
83
|
+
default: config_1.DEFAULT_REGION,
|
|
87
84
|
required: true,
|
|
88
|
-
description: 'SigV4 region.
|
|
85
|
+
description: 'SigV4 region. Only change if instructed by SQL Accounting support.',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
displayName: 'Proxy URL',
|
|
89
|
+
name: 'proxyBaseUrl',
|
|
90
|
+
type: 'string',
|
|
91
|
+
default: config_1.PROXY_BASE_URL,
|
|
92
|
+
required: true,
|
|
93
|
+
description: 'Advanced. Only change to self-host the proxy or for local testing.',
|
|
89
94
|
},
|
|
90
95
|
];
|
|
91
96
|
}
|
|
92
97
|
}
|
|
93
98
|
exports.SqlAccountingApi = SqlAccountingApi;
|
|
94
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
99
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU3FsQWNjb3VudGluZ0FwaS5jcmVkZW50aWFscy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL2NyZWRlbnRpYWxzL1NxbEFjY291bnRpbmdBcGkuY3JlZGVudGlhbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBTUEsMERBQWdHO0FBRWhHLE1BQWEsZ0JBQWdCO0lBQTdCO1FBQ0MsU0FBSSxHQUFHLGtCQUFrQixDQUFDO1FBQzFCLGdCQUFXLEdBQUcsb0JBQW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QUFJLEVBQUUsUUFBUTtnQkFDZCxPQUFPLEVBQUUsdUJBQWM7Z0JBQ3ZCLFFBQVEsRUFBRSxJQUFJO2dCQUNkLFdBQVcsRUFBRSxvRUFBb0U7YUFDakY7U0FDRCxDQUFDO0lBQ0gsQ0FBQztDQUFBO0FBOUZELDRDQThGQyJ9
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
2
|
export declare class SqlAccounting implements INodeType {
|
|
3
3
|
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
loadOptions: Record<string, (this: import("n8n-workflow").ILoadOptionsFunctions) => Promise<import("n8n-workflow").INodePropertyOptions[]>>;
|
|
6
|
+
};
|
|
4
7
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
8
|
}
|
|
6
9
|
//# sourceMappingURL=SqlAccounting.node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqlAccounting.node.d.ts","sourceRoot":"","sources":["../../../nodes/SqlAccounting/SqlAccounting.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"SqlAccounting.node.d.ts","sourceRoot":"","sources":["../../../nodes/SqlAccounting/SqlAccounting.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAQ3G,qBAAa,aAAc,YAAW,SAAS;IAC9C,WAAW,EAAE,oBAAoB,CAa/B;IAEF,OAAO;;MAAkC;IAEnC,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CA0BvE"}
|