n8n-nodes-moca 0.1.1 → 0.2.5
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 +171 -30
- package/dist/credentials/MocaApi.credentials.js +17 -1
- package/dist/credentials/MocaApi.credentials.js.map +1 -1
- package/dist/nodes/Moca/Moca.node.js +2 -4
- package/dist/nodes/Moca/Moca.node.js.map +1 -1
- package/dist/nodes/Moca/MocaDescription.js +6 -23
- package/dist/nodes/Moca/MocaDescription.js.map +1 -1
- package/dist/nodes/Moca/transport/index.d.ts +11 -3
- package/dist/nodes/Moca/transport/index.js +0 -0
- package/dist/nodes/Moca/transport/index.js.map +1 -1
- package/dist/nodes/Moca/transport/protocol.d.ts +0 -1
- package/dist/nodes/Moca/transport/protocol.js +0 -7
- package/dist/nodes/Moca/transport/protocol.js.map +1 -1
- package/dist/package.json +17 -5
- package/package.json +17 -5
package/README.md
CHANGED
|
@@ -4,7 +4,9 @@ An [n8n](https://n8n.io) community node for **MOCA** — the command server behi
|
|
|
4
4
|
|
|
5
5
|
It connects to a MOCA service over the `application/moca-xml` protocol and runs MOCA syntax commands, including MOCA **local syntax** (native SQL in square brackets), with credentials managed by n8n.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
No runtime dependencies.
|
|
8
|
+
|
|
9
|
+
[Installation](#installation) · [Credentials](#credentials) · [Operations](#operations) · [Result shape](#result-shape) · [Status codes](#status-codes) · [Examples](#examples) · [How it works](#how-it-works)
|
|
8
10
|
|
|
9
11
|
## Installation
|
|
10
12
|
|
|
@@ -15,6 +17,12 @@ It connects to a MOCA service over the `application/moca-xml` protocol and runs
|
|
|
15
17
|
3. Enter `n8n-nodes-moca` and confirm that you understand the risks of installing community nodes.
|
|
16
18
|
4. Select **Install**.
|
|
17
19
|
|
|
20
|
+
To use the node as an AI Agent tool, the instance also needs:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
|
|
24
|
+
```
|
|
25
|
+
|
|
18
26
|
### Manual install
|
|
19
27
|
|
|
20
28
|
```bash
|
|
@@ -42,13 +50,18 @@ Create a **MOCA API** credential:
|
|
|
42
50
|
| Password | yes | Password for that user |
|
|
43
51
|
| Warehouse ID | no | Sent as `WH_ID` with every command |
|
|
44
52
|
| Device | no | Sent as `DEVCOD` with every command |
|
|
45
|
-
| Locale | no | Sent as `LOCALE_ID`. Leave empty to use the locale returned at login. |
|
|
53
|
+
| Locale | no | Sent as `LOCALE_ID`, e.g. `US_ENGLISH`. Leave empty to use the locale returned at login. |
|
|
46
54
|
| Ignore SSL Issues | no | Accept self-signed certificates |
|
|
47
55
|
| Request Timeout (Ms) | no | Defaults to 300000 |
|
|
56
|
+
| Reuse Session | no | Reuse a MOCA session across executions instead of logging in every time. On by default. |
|
|
57
|
+
| Session Max Age (Minutes) | no | How long a cached session may be reused. `0` reuses it until the server rejects it. Defaults to 30. |
|
|
48
58
|
|
|
49
59
|
Use the credential's **Test** button to verify the connection: the node performs a real `login user` call and reports the MOCA error message if it fails.
|
|
50
60
|
|
|
51
|
-
|
|
61
|
+
Warehouse, Device and Locale are sent with every command and can be read back inside one as
|
|
62
|
+
[`@@` globals](#credential-values-in-a-command).
|
|
63
|
+
|
|
64
|
+
The password is only ever used for the login command. Every later command authenticates with the session key MOCA returns, and that session key never reaches workflow data.
|
|
52
65
|
|
|
53
66
|
## Operations
|
|
54
67
|
|
|
@@ -57,28 +70,37 @@ The password is only ever used for the login command. Every later command authen
|
|
|
57
70
|
Runs a MOCA syntax command and returns one item per result row.
|
|
58
71
|
|
|
59
72
|
```
|
|
60
|
-
list warehouses
|
|
73
|
+
list warehouses
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
list orders where ordnum = @ordnum
|
|
61
78
|
```
|
|
62
79
|
|
|
63
|
-
###
|
|
80
|
+
### Local syntax (native SQL)
|
|
64
81
|
|
|
65
|
-
|
|
82
|
+
MOCA local syntax is native SQL in square brackets, written inside an ordinary command. There is no separate operation for it — put the brackets in the command text:
|
|
66
83
|
|
|
67
|
-
```
|
|
68
|
-
select
|
|
84
|
+
```
|
|
85
|
+
[select ordnum, ordtyp from ord where wh_id = @wh_id]
|
|
69
86
|
```
|
|
70
87
|
|
|
71
|
-
is
|
|
88
|
+
Commands and SQL compose in one pipeline, which is the point of MOCA syntax. `@name` refers to a column produced by the previous step:
|
|
72
89
|
|
|
73
90
|
```
|
|
74
|
-
[
|
|
75
|
-
|
|
76
|
-
|
|
91
|
+
[select ship_id from shipment_line where ordnum = @ordnum]
|
|
92
|
+
|
|
|
93
|
+
list shipments where ship_id = @ship_id
|
|
77
94
|
```
|
|
78
95
|
|
|
96
|
+
> **A MOCA command and its underlying table are not the same thing.** Commands join in
|
|
97
|
+
> descriptions, localisation and related records, so they return columns the base table does not
|
|
98
|
+
> have. `list warehouses` returns `lngdsc`, `short_dsc` and `longdsc`; the `wh` table itself has
|
|
99
|
+
> none of them. Check the command output before assuming a column exists in SQL.
|
|
100
|
+
|
|
79
101
|
### Test Connection
|
|
80
102
|
|
|
81
|
-
Logs in and returns the session details (user, name, warehouse, locale). Useful as a health check at the top of a workflow.
|
|
103
|
+
Logs in and returns the session details (user, name, warehouse, locale). Useful as a health check at the top of a workflow, and it always contacts the server rather than reporting a cached session.
|
|
82
104
|
|
|
83
105
|
### Arguments
|
|
84
106
|
|
|
@@ -101,41 +123,115 @@ publish data
|
|
|
101
123
|
list warehouses where wh_id = @wh_id
|
|
102
124
|
```
|
|
103
125
|
|
|
104
|
-
Single quotes inside values are doubled, so a value
|
|
126
|
+
Single quotes inside values are doubled, so a value containing an apostrophe — `O'Brien`, or a
|
|
127
|
+
crafted string designed to close the literal early and append its own clause — cannot break out
|
|
128
|
+
of it. **Use this for anything arriving from a webhook or an AI agent**, rather than building the
|
|
129
|
+
command with expressions.
|
|
130
|
+
|
|
131
|
+
### Credential values in a command
|
|
132
|
+
|
|
133
|
+
Credential fields are sent as MOCA environment variables, so a command can read them directly
|
|
134
|
+
as `@@` globals. Nothing needs to be passed in:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
list orders where wh_id = @@wh_id
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
[select ordnum from ord where wh_id = @@wh_id]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
| Credential field | Sent as | Reference as |
|
|
145
|
+
| --- | --- | --- |
|
|
146
|
+
| User ID | `USR_ID` | `@@usr_id` |
|
|
147
|
+
| Warehouse ID | `WH_ID` | `@@wh_id` |
|
|
148
|
+
| Device | `DEVCOD` | `@@devcod` |
|
|
149
|
+
| Locale | `LOCALE_ID` | `@@locale_id` |
|
|
150
|
+
| *(session, managed by the node)* | `SESSION_KEY` | `@@session_key` |
|
|
151
|
+
|
|
152
|
+
The password is never sent as an environment variable; it is only used by the login command.
|
|
153
|
+
|
|
154
|
+
**`@@name` and `@name` are different things**, and mixing them up is the most common cause of a
|
|
155
|
+
confusing `511` error:
|
|
156
|
+
|
|
157
|
+
| | Source | Scope |
|
|
158
|
+
| --- | --- | --- |
|
|
159
|
+
| `@@name` | Credential, as an environment variable | The whole request, including after a `\|` |
|
|
160
|
+
| `@name` | A column published by the previous pipeline step, which is what **Arguments** generates | From that step onward |
|
|
161
|
+
|
|
162
|
+
So credential constants use `@@`, and per-execution values use Arguments and `@`:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
[select ordnum from ord where wh_id = @@wh_id and ordnum = @ordnum]
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Two things to watch:
|
|
169
|
+
|
|
170
|
+
- **Do not quote it.** `'@@wh_id'` is the literal string `@@wh_id`, not the warehouse — inside a
|
|
171
|
+
SQL string literal it is just text.
|
|
172
|
+
- **An unset variable is `null`, not an error.** Leaving *Device* empty makes `@@devcod` null and
|
|
173
|
+
the command still succeeds, so a misspelt name such as `@@wh_di` fails silently rather than
|
|
174
|
+
loudly. If a filtered query returns no rows unexpectedly, check the spelling first.
|
|
105
175
|
|
|
106
176
|
### Options
|
|
107
177
|
|
|
108
178
|
| Option | Default | Description |
|
|
109
179
|
| --- | --- | --- |
|
|
110
|
-
| Autocommit | `true` | Whether MOCA commits when the command succeeds |
|
|
180
|
+
| Autocommit | `true` | Whether MOCA commits when the command succeeds. Turning it off does **not** roll back — see [Transactions](#transactions). |
|
|
111
181
|
| Convert Numeric Columns | `false` | Convert columns the server reports as numeric into numbers. Off by default so identifiers such as `0042` keep their leading zeros. |
|
|
112
182
|
| Simplify | `true` | One item per row. Turn off to get a single item with `status`, `message`, `columns` and `rows`. |
|
|
113
183
|
| Treat Empty Result as Error | `false` | Whether MOCA status `510` (no rows found) should fail the node |
|
|
114
184
|
|
|
185
|
+
## Result shape
|
|
186
|
+
|
|
187
|
+
With **Simplify** on (the default), each result row becomes one n8n item.
|
|
188
|
+
|
|
189
|
+
- **Values are strings**, matching what MOCA sends, unless *Convert Numeric Columns* is on. Dates arrive in MOCA's own format, e.g. `20250429045411`.
|
|
190
|
+
- **Empty fields become `null`**, not empty strings.
|
|
191
|
+
- **Repeated column names get a numeric suffix.** MOCA joins can return the same column twice — `list warehouses` returns `is_purged` twice — so the second occurrence becomes `is_purged_2`. Without this the first value would be silently overwritten.
|
|
192
|
+
- **Nested result sets** become nested objects with their own `columns` and `rows`.
|
|
193
|
+
- **No rows** produces a single item with `status`, `message`, `command` and `rowCount: 0`, so downstream nodes can tell "nothing matched" from "never ran".
|
|
194
|
+
|
|
195
|
+
With **Simplify** off, one item is returned holding `status`, `message`, `command`, `rowCount`, `columns` (with each column's MOCA `type`) and `rows`.
|
|
196
|
+
|
|
197
|
+
## Status codes
|
|
198
|
+
|
|
199
|
+
| Status | Meaning | What the node does |
|
|
200
|
+
| --- | --- | --- |
|
|
201
|
+
| `0` | Success | Returns the rows |
|
|
202
|
+
| `510` | No rows found | Returns an empty result. Not an error unless *Treat Empty Result as Error* is on. |
|
|
203
|
+
| `523` | Session expired | Logs in again and retries once, transparently |
|
|
204
|
+
| anything else | Server or database error | Fails the node with MOCA's own `message`, e.g. `501 - Command (...) not found` or `511 - Invalid column name '...'.` |
|
|
205
|
+
|
|
115
206
|
## Examples
|
|
116
207
|
|
|
117
|
-
**Look up inventory
|
|
208
|
+
**Look up inventory from an incoming webhook**
|
|
118
209
|
|
|
119
|
-
Operation `Execute Command`, argument `
|
|
210
|
+
Operation `Execute Command`, argument `prtnum` → `{{ $json.body.sku }}`:
|
|
120
211
|
|
|
121
212
|
```
|
|
122
|
-
list inventory where
|
|
213
|
+
list inventory where prtnum = @prtnum
|
|
123
214
|
```
|
|
124
215
|
|
|
125
216
|
**Read straight from the database**
|
|
126
217
|
|
|
127
|
-
|
|
218
|
+
```
|
|
219
|
+
[select ordnum, ordtyp, client_id
|
|
220
|
+
from ord
|
|
221
|
+
where wh_id = @wh_id]
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Chain SQL into a command**
|
|
128
225
|
|
|
129
|
-
```
|
|
130
|
-
select
|
|
131
|
-
|
|
132
|
-
where
|
|
133
|
-
and stat_code < 90
|
|
226
|
+
```
|
|
227
|
+
[select ship_id from shipment_line where ordnum = @ordnum]
|
|
228
|
+
|
|
|
229
|
+
list shipments where ship_id = @ship_id
|
|
134
230
|
```
|
|
135
231
|
|
|
136
232
|
**Use it as an AI agent tool**
|
|
137
233
|
|
|
138
|
-
The node has `usableAsTool` enabled, so it can be attached to an AI Agent to let the agent query the WMS.
|
|
234
|
+
The node has `usableAsTool` enabled, so it can be attached to an AI Agent to let the agent query the WMS. Give the agent a MOCA user whose database grants are read-only — a system prompt telling it to avoid writes is not a security control.
|
|
139
235
|
|
|
140
236
|
### Running the local MOCA client (`msql`)
|
|
141
237
|
|
|
@@ -147,7 +243,7 @@ msql -c "list warehouses"
|
|
|
147
243
|
|
|
148
244
|
## How it works
|
|
149
245
|
|
|
150
|
-
Each
|
|
246
|
+
Each command posts a `moca-request` document to the service URL with the `application/moca-xml` content type:
|
|
151
247
|
|
|
152
248
|
```xml
|
|
153
249
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -156,18 +252,45 @@ Each execution posts a `moca-request` document to the service URL with the `appl
|
|
|
156
252
|
<var name="USR_ID" value="SUPER"/>
|
|
157
253
|
<var name="SESSION_KEY" value="..."/>
|
|
158
254
|
<var name="WH_ID" value="WMD1"/>
|
|
255
|
+
<var name="LOCALE_ID" value="US_ENGLISH"/>
|
|
159
256
|
</environment>
|
|
160
257
|
<query>list warehouses</query>
|
|
161
258
|
</moca-request>
|
|
162
259
|
```
|
|
163
260
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
- Any other status fails the node with the `message` the server returned.
|
|
167
|
-
- Result values are returned as strings, matching what MOCA sends, unless *Convert Numeric Columns* is enabled. Empty fields become `null`, and nested result sets are returned as nested objects.
|
|
261
|
+
Those `var` entries are what a command reads as [`@@` globals](#credential-values-in-a-command).
|
|
262
|
+
Empty credential fields are omitted from the document entirely.
|
|
168
263
|
|
|
169
264
|
The XML is built and parsed in-package, so **n8n-nodes-moca has no runtime dependencies**.
|
|
170
265
|
|
|
266
|
+
### Session handling
|
|
267
|
+
|
|
268
|
+
Logging in costs a full round trip, so the session key is cached in memory and shared by every MOCA node in the n8n process, keyed by service URL, user and password. Changing any of those starts a new session.
|
|
269
|
+
|
|
270
|
+
The cache never has to be right, only usually right. A session the server has already dropped comes back as status 523, which triggers a fresh login and a retry, so a stale entry costs one extra round trip — exactly what happens with no cache at all. When several executions start at once against a cold cache they share a single login rather than one each.
|
|
271
|
+
|
|
272
|
+
Measured against a real MOCA server, three executions cost 4 HTTP round trips instead of 6, and five concurrent executions made one login instead of five.
|
|
273
|
+
|
|
274
|
+
Sessions are held **in memory only**. A session key is a live credential, so it is never written to workflow static data, which n8n persists to its database. It is also stripped from the Test Connection output.
|
|
275
|
+
|
|
276
|
+
Turn it off per credential with **Reuse Session** if a server needs a fresh login every time.
|
|
277
|
+
|
|
278
|
+
### Transactions
|
|
279
|
+
|
|
280
|
+
A session lasts for one node execution, so **a transaction cannot span two MOCA nodes**. Turning *Autocommit* off does not roll anything back either — the node sends no `commit` and no `rollback`, so an uncommitted write may hold database locks until the session ends, and nothing can reach back to commit it.
|
|
281
|
+
|
|
282
|
+
If you want a dry run, say so explicitly in the command:
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
[select ship_id from shipment_line where ordnum = @ordnum]
|
|
286
|
+
|
|
|
287
|
+
change shipment where ship_id = @ship_id and early_dlvdte = @expected_date
|
|
288
|
+
|
|
|
289
|
+
rollback
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
For write protection, use a MOCA user without write grants. That is the only control that holds.
|
|
293
|
+
|
|
171
294
|
## Compatibility
|
|
172
295
|
|
|
173
296
|
Tested against n8n's node API version 1 with `n8n-workflow` 2.x. Requires Node.js 20.19 or newer.
|
|
@@ -182,6 +305,24 @@ npm run build
|
|
|
182
305
|
npm run dev # runs a local n8n with this node linked in
|
|
183
306
|
```
|
|
184
307
|
|
|
308
|
+
### Releasing
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
npm run release # patch, e.g. 0.2.0 -> 0.2.1
|
|
312
|
+
npm run release:minor # breaking or new operations
|
|
313
|
+
npm run release:major
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Each one builds, lints, tests and verifies the package first, then bumps the version, commits,
|
|
317
|
+
tags and pushes. Pushing the tag is what triggers the GitHub Actions publish, so that single
|
|
318
|
+
command is the whole release. The tag carries no `v` prefix; that is set in `.npmrc` rather than
|
|
319
|
+
as a flag, because npm scripts run through `cmd.exe` on Windows where `''` is not quoting and
|
|
320
|
+
would end up inside the tag name.
|
|
321
|
+
|
|
322
|
+
`npm version` refuses to run with uncommitted changes, so commit first.
|
|
323
|
+
|
|
324
|
+
`npm run live-check` exercises the compiled transport against a real MOCA server — login, a command, local syntax, the no-rows path, an error path and argument binding. Configure it with `moca.local.json` (gitignored) or `MOCA_URL` / `MOCA_USER` / `MOCA_PASSWORD`. Passwords and session keys are masked in its output.
|
|
325
|
+
|
|
185
326
|
## Resources
|
|
186
327
|
|
|
187
328
|
- [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
@@ -54,7 +54,7 @@ class MocaApi {
|
|
|
54
54
|
name: 'locale',
|
|
55
55
|
type: 'string',
|
|
56
56
|
default: '',
|
|
57
|
-
placeholder: '
|
|
57
|
+
placeholder: 'US_ENGLISH',
|
|
58
58
|
description: 'Optional LOCALE_ID environment variable. Leave empty to use the locale returned at login.',
|
|
59
59
|
},
|
|
60
60
|
{
|
|
@@ -72,6 +72,22 @@ class MocaApi {
|
|
|
72
72
|
typeOptions: { minValue: 1000 },
|
|
73
73
|
description: 'How long to wait for the MOCA server before failing the request',
|
|
74
74
|
},
|
|
75
|
+
{
|
|
76
|
+
displayName: 'Reuse Session',
|
|
77
|
+
name: 'reuseSession',
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
default: true,
|
|
80
|
+
description: 'Whether to reuse a MOCA session across executions instead of logging in every time. Sessions are held in memory only. An expired session is detected and replaced automatically, so turning this off only costs an extra login per execution.',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
displayName: 'Session Max Age (Minutes)',
|
|
84
|
+
name: 'sessionMaxAgeMinutes',
|
|
85
|
+
type: 'number',
|
|
86
|
+
default: 30,
|
|
87
|
+
typeOptions: { minValue: 0 },
|
|
88
|
+
description: 'How long a cached session may be reused before logging in again. Set to 0 to reuse it until the server rejects it.',
|
|
89
|
+
displayOptions: { show: { reuseSession: [true] } },
|
|
90
|
+
},
|
|
75
91
|
];
|
|
76
92
|
}
|
|
77
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MocaApi.credentials.js","sourceRoot":"","sources":["../../credentials/MocaApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,OAAO;IAApB;QACC,SAAI,GAAG,SAAS,CAAC;QAEjB,gBAAW,GAAG,UAAU,CAAC;QAEzB,SAAI,G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2FAA2F;aAC5F;YACD;gBACC,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,KAAK;gBACd,WAAW,EACV,gIAAgI;aACjI;YACD;gBACC,WAAW,EAAE,sBAAsB;gBACnC,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;gBACf,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,WAAW,EAAE,iEAAiE;aAC9E;YACD;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,IAAI;gBACb,WAAW,EACV,+OAA+O;aAChP;YACD;gBACC,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,sBAAsB;gBAC5B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;gBAC5B,WAAW,EACV,oHAAoH;gBACrH,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE;aAClD;SACD,CAAC;IACH,CAAC;CAAA;AAhGD,0BAgGC"}
|
|
@@ -148,13 +148,11 @@ class Moca {
|
|
|
148
148
|
});
|
|
149
149
|
continue;
|
|
150
150
|
}
|
|
151
|
-
if (operation !== 'execute'
|
|
151
|
+
if (operation !== 'execute') {
|
|
152
152
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not supported`, { itemIndex });
|
|
153
153
|
}
|
|
154
154
|
const options = this.getNodeParameter('options', itemIndex, {});
|
|
155
|
-
const command =
|
|
156
|
-
? (0, protocol_1.asLocalSyntax)(this.getNodeParameter('sql', itemIndex))
|
|
157
|
-
: this.getNodeParameter('command', itemIndex).trim();
|
|
155
|
+
const command = this.getNodeParameter('command', itemIndex).trim();
|
|
158
156
|
const publishData = collectArguments(this.getNodeParameter('publishData', itemIndex, {}));
|
|
159
157
|
const response = await connection.execute((0, protocol_1.withPublishedData)(command, publishData), {
|
|
160
158
|
autocommit: options.autocommit !== false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Moca.node.js","sourceRoot":"","sources":["../../../nodes/Moca/Moca.node.ts"],"names":[],"mappings":";;;AAUA,+CAAuE;AAEvE,uDAA+D;AAE/D,2CAAmG;AAEnG,
|
|
1
|
+
{"version":3,"file":"Moca.node.js","sourceRoot":"","sources":["../../../nodes/Moca/Moca.node.ts"],"names":[],"mappings":";;;AAUA,+CAAuE;AAEvE,uDAA+D;AAE/D,2CAAmG;AAEnG,mDAM8B;AAO9B,SAAS,gBAAgB,CAAC,GAAgB;;IACzC,MAAM,OAAO,GAAG,MAAC,GAAG,CAAC,QAAwC,mCAAI,EAAE,CAAC;IACpE,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,SAAS;QACpE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAA,KAAK,CAAC,KAAK,mCAAI,EAAE,CAAC;IAC3C,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,SAAS,OAAO,CACf,QAAsB,EACtB,OAAe,EACf,OAAoB,EACpB,SAAiB;IAEjB,MAAM,IAAI,GACT,OAAO,CAAC,cAAc,KAAK,IAAI,CAAC,CAAC,CAAC,IAAA,gCAAqB,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;IAEnF,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;QAChC,OAAO;YACN;gBACC,IAAI,EAAE;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execute Command',
|
|
14
14
|
value: 'execute',
|
|
15
|
-
description: 'Run a MOCA syntax command on the MOCA server',
|
|
15
|
+
description: 'Run a MOCA syntax command on the MOCA server. Wrap native SQL in square brackets to use MOCA local syntax.',
|
|
16
16
|
action: 'Execute a MOCA command',
|
|
17
17
|
},
|
|
18
|
-
{
|
|
19
|
-
name: 'Execute Local Syntax',
|
|
20
|
-
value: 'executeSql',
|
|
21
|
-
description: 'Run a native SQL statement through MOCA local syntax, the square bracket form MOCA passes straight to the database',
|
|
22
|
-
action: 'Execute local syntax through MOCA',
|
|
23
|
-
},
|
|
24
18
|
{
|
|
25
19
|
name: 'Test Connection',
|
|
26
20
|
value: 'login',
|
|
@@ -35,24 +29,13 @@ exports.mocaFields = [
|
|
|
35
29
|
displayName: 'Command',
|
|
36
30
|
name: 'command',
|
|
37
31
|
type: 'string',
|
|
38
|
-
typeOptions: { rows:
|
|
32
|
+
typeOptions: { rows: 8 },
|
|
39
33
|
default: '',
|
|
40
34
|
required: true,
|
|
41
35
|
placeholder: "list warehouses where wh_id like 'W%'",
|
|
42
|
-
description: 'MOCA syntax command to run. Use the Arguments section to bind values safely.',
|
|
36
|
+
description: 'MOCA syntax command to run. Native SQL goes in square brackets, for example [select wh_id from wh]. Use the Arguments section to bind values safely rather than building the command with expressions.',
|
|
43
37
|
displayOptions: { show: { operation: ['execute'] } },
|
|
44
38
|
},
|
|
45
|
-
{
|
|
46
|
-
displayName: 'Local Syntax',
|
|
47
|
-
name: 'sql',
|
|
48
|
-
type: 'string',
|
|
49
|
-
typeOptions: { rows: 6, editor: 'sqlEditor' },
|
|
50
|
-
default: '',
|
|
51
|
-
required: true,
|
|
52
|
-
placeholder: 'select wh_id, wh_nam from wh',
|
|
53
|
-
description: 'Native SQL statement. It is wrapped in MOCA local syntax brackets before being sent to the server.',
|
|
54
|
-
displayOptions: { show: { operation: ['executeSql'] } },
|
|
55
|
-
},
|
|
56
39
|
{
|
|
57
40
|
displayName: 'Arguments',
|
|
58
41
|
name: 'publishData',
|
|
@@ -61,7 +44,7 @@ exports.mocaFields = [
|
|
|
61
44
|
typeOptions: { multipleValues: true },
|
|
62
45
|
default: {},
|
|
63
46
|
description: 'Values published to the command with a "publish data" clause, so they are bound instead of being concatenated into the command text',
|
|
64
|
-
displayOptions: { show: { operation: ['execute'
|
|
47
|
+
displayOptions: { show: { operation: ['execute'] } },
|
|
65
48
|
options: [
|
|
66
49
|
{
|
|
67
50
|
name: 'argument',
|
|
@@ -91,14 +74,14 @@ exports.mocaFields = [
|
|
|
91
74
|
type: 'collection',
|
|
92
75
|
placeholder: 'Add option',
|
|
93
76
|
default: {},
|
|
94
|
-
displayOptions: { show: { operation: ['execute'
|
|
77
|
+
displayOptions: { show: { operation: ['execute'] } },
|
|
95
78
|
options: [
|
|
96
79
|
{
|
|
97
80
|
displayName: 'Autocommit',
|
|
98
81
|
name: 'autocommit',
|
|
99
82
|
type: 'boolean',
|
|
100
83
|
default: true,
|
|
101
|
-
description: 'Whether the MOCA server commits the transaction when the command succeeds',
|
|
84
|
+
description: 'Whether the MOCA server commits the transaction when the command succeeds. Turning this off does not roll the transaction back, so a write can hold database locks until the session ends.',
|
|
102
85
|
},
|
|
103
86
|
{
|
|
104
87
|
displayName: 'Convert Numeric Columns',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MocaDescription.js","sourceRoot":"","sources":["../../../nodes/Moca/MocaDescription.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAsB;IAChD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,iBAAiB;gBACvB,KAAK,EAAE,SAAS;gBAChB,WAAW,
|
|
1
|
+
{"version":3,"file":"MocaDescription.js","sourceRoot":"","sources":["../../../nodes/Moca/MocaDescription.ts"],"names":[],"mappings":";;;AAE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AE,EAAE;wBACX,WAAW,EAAE,OAAO;wBACpB,WAAW,EACV,4EAA4E;qBAC7E;oBACD;wBACC,WAAW,EAAE,OAAO;wBACpB,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;qBACX;iBACD;aACD;SACD;KACD;IACD;QACC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE;QACpD,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,IAAI;gBACb,WAAW,EACV,4LAA4L;aAC7L;YACD;gBACC,WAAW,EAAE,yBAAyB;gBACtC,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,KAAK;gBACd,WAAW,EACV,0HAA0H;aAC3H;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,IAAI;gBACb,WAAW,EACV,yIAAyI;aAC1I;YACD;gBACC,WAAW,EAAE,6BAA6B;gBAC1C,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,KAAK;gBACd,WAAW,EACV,mGAAmG;aACpG;SACD;KACD;CACD,CAAC"}
|
|
@@ -9,10 +9,14 @@ export interface MocaCredentials {
|
|
|
9
9
|
locale?: string;
|
|
10
10
|
ignoreSslIssues?: boolean;
|
|
11
11
|
timeout?: number;
|
|
12
|
+
reuseSession?: boolean;
|
|
13
|
+
sessionMaxAgeMinutes?: number;
|
|
12
14
|
}
|
|
13
15
|
export declare const MOCA_CONTENT_TYPE = "application/moca-xml";
|
|
14
|
-
export declare function buildLoginQuery(username: string, password: string): string;
|
|
15
16
|
export type MocaHttpRequester = (options: IHttpRequestOptions) => Promise<unknown>;
|
|
17
|
+
export declare function buildLoginQuery(username: string, password: string): string;
|
|
18
|
+
export declare function clearSessionCache(): void;
|
|
19
|
+
export declare function cachedSessionCount(): number;
|
|
16
20
|
export interface ExecuteOptions {
|
|
17
21
|
autocommit?: boolean;
|
|
18
22
|
environment?: MocaEnvironment;
|
|
@@ -21,13 +25,17 @@ export declare class MocaConnection {
|
|
|
21
25
|
private readonly request;
|
|
22
26
|
private readonly node;
|
|
23
27
|
private readonly credentials;
|
|
24
|
-
private
|
|
25
|
-
private sessionLocale;
|
|
28
|
+
private session;
|
|
26
29
|
constructor(request: MocaHttpRequester, node: INode, credentials: MocaCredentials);
|
|
30
|
+
private get cacheKey();
|
|
31
|
+
private get maxAgeMs();
|
|
32
|
+
private isFresh;
|
|
27
33
|
get environment(): MocaEnvironment;
|
|
28
34
|
get isLoggedIn(): boolean;
|
|
29
35
|
private post;
|
|
36
|
+
private requestLogin;
|
|
30
37
|
login(): Promise<MocaResponse>;
|
|
38
|
+
private ensureSession;
|
|
31
39
|
execute(command: string, options?: ExecuteOptions): Promise<MocaResponse>;
|
|
32
40
|
}
|
|
33
41
|
export declare function createConnection(context: IExecuteFunctions, credentials: MocaCredentials): MocaConnection;
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/Moca/transport/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/Moca/transport/index.ts"],"names":[],"mappings":";;;AA2BA,0CAIC;AA4BD,8CAGC;AAGD,gDAEC;AAoOD,4CAMC;AA7SD,mCAAoC;AAGpC,+CAAgE;AAGhE,yCAAgG;AAenF,QAAA,iBAAiB,GAAG,sBAAsB,CAAC;AAMxD,SAAgB,eAAe,CAAC,QAAgB,EAAE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CAAC,CAAC;YAC/B,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD;AAhMD,wCAgMC;AAED,SAAgB,gBAAgB,CAC/B,OAA0B,EAC1B,WAA4B;IAE5B,MAAM,OAAO,GAAsB,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjG,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -28,6 +28,5 @@ export interface BuildRequestOptions {
|
|
|
28
28
|
export declare function buildMocaRequest(options: BuildRequestOptions): string;
|
|
29
29
|
export declare function quoteMocaLiteral(value: string): string;
|
|
30
30
|
export declare function withPublishedData(command: string, data: Record<string, string>): string;
|
|
31
|
-
export declare function asLocalSyntax(sql: string): string;
|
|
32
31
|
export declare function parseMocaResponse(xml: string): MocaResponse;
|
|
33
32
|
export declare function convertNumericColumns(resultSet: MocaResultSet): Array<Record<string, MocaValue>>;
|
|
@@ -4,7 +4,6 @@ exports.MOCA_STATUS = void 0;
|
|
|
4
4
|
exports.buildMocaRequest = buildMocaRequest;
|
|
5
5
|
exports.quoteMocaLiteral = quoteMocaLiteral;
|
|
6
6
|
exports.withPublishedData = withPublishedData;
|
|
7
|
-
exports.asLocalSyntax = asLocalSyntax;
|
|
8
7
|
exports.parseMocaResponse = parseMocaResponse;
|
|
9
8
|
exports.convertNumericColumns = convertNumericColumns;
|
|
10
9
|
const xml_1 = require("./xml");
|
|
@@ -41,12 +40,6 @@ function withPublishedData(command, data) {
|
|
|
41
40
|
.join('\n and ');
|
|
42
41
|
return `publish data\n where ${assignments}\n|\n${command}`;
|
|
43
42
|
}
|
|
44
|
-
function asLocalSyntax(sql) {
|
|
45
|
-
const trimmed = sql.trim().replace(/;\s*$/, '');
|
|
46
|
-
if (trimmed.startsWith('[') && trimmed.endsWith(']'))
|
|
47
|
-
return trimmed;
|
|
48
|
-
return `[\n${trimmed}\n]`;
|
|
49
|
-
}
|
|
50
43
|
function parseColumns(metadata) {
|
|
51
44
|
if (metadata === undefined)
|
|
52
45
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../../nodes/Moca/transport/protocol.ts"],"names":[],"mappings":";;;AAsDA,4CAoBC;AAMD,4CAEC;AAMD,8CASC;
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../../nodes/Moca/transport/protocol.ts"],"names":[],"mappings":";;;AAsDA,4CAoBC;AAMD,4CAEC;AAMD,8CASC;AAmDD,8CAcC;AAkBD,sDAqBC;AAxMD,+BAOe;AAGF,QAAA,WAAW,GAAG;IAE1B,EAAE,EAAE,CAAC;IAEL,OAAO,EAAE,GAAG;IAEZ,eAAe,EAAE,GAAG;CACX,CAAC;AAoCX,SAAgB,gBAAgB,CAAC,OAA4B;IAC5D,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,EAAE,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAE/D,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;SACtC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;SAC5E,GAAG,CACH,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CACjB,kBAAkB,IAAA,wBAAkB,EAAC,IAAI,CAAC,YAAY,IAAA,wBAAkB,EAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAC7F,CAAC;IAEH,OAAO;QACN,wCAAwC;QACxC,6BAA6B,UAAU,CAAC,CAAC,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gBAC/B,SAAS,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;YAC5D,CAAC;iBAAM,CAAC;gBACP,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACxB,CAAC;QACF,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-moca",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "n8n community node to connect to a MOCA server (Blue Yonder / RedPrairie WMS) and run MOCA syntax commands
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"description": "n8n community node to connect to a MOCA server (Blue Yonder / RedPrairie WMS) and run MOCA syntax commands and native (local) SQL",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/rnsaway/n8n-nodes-moca#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/rnsaway/n8n-nodes-moca.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/rnsaway/n8n-nodes-moca/issues"
|
|
13
|
+
},
|
|
6
14
|
"keywords": [
|
|
7
15
|
"n8n-community-node-package",
|
|
8
16
|
"n8n",
|
|
@@ -26,10 +34,14 @@
|
|
|
26
34
|
"lint": "n8n-node lint",
|
|
27
35
|
"lint:fix": "n8n-node lint --fix",
|
|
28
36
|
"test": "vitest run",
|
|
29
|
-
"
|
|
37
|
+
"verify": "node scripts/verify-package.js",
|
|
38
|
+
"preversion": "npm run build && npm run lint && npm test && npm run verify",
|
|
39
|
+
"postversion": "git push origin main --follow-tags",
|
|
40
|
+
"release": "npm version patch",
|
|
41
|
+
"release:minor": "npm version minor",
|
|
42
|
+
"release:major": "npm version major",
|
|
30
43
|
"prepublishOnly": "npm run build && npm test && npm run verify && n8n-node prerelease",
|
|
31
|
-
"live-check": "node scripts/live-check.js"
|
|
32
|
-
"verify": "node scripts/verify-package.js"
|
|
44
|
+
"live-check": "node scripts/live-check.js"
|
|
33
45
|
},
|
|
34
46
|
"files": [
|
|
35
47
|
"dist"
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-moca",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "n8n community node to connect to a MOCA server (Blue Yonder / RedPrairie WMS) and run MOCA syntax commands
|
|
3
|
+
"version": "0.2.5",
|
|
4
|
+
"description": "n8n community node to connect to a MOCA server (Blue Yonder / RedPrairie WMS) and run MOCA syntax commands and native (local) SQL",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/rnsaway/n8n-nodes-moca#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/rnsaway/n8n-nodes-moca.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/rnsaway/n8n-nodes-moca/issues"
|
|
13
|
+
},
|
|
6
14
|
"keywords": [
|
|
7
15
|
"n8n-community-node-package",
|
|
8
16
|
"n8n",
|
|
@@ -26,10 +34,14 @@
|
|
|
26
34
|
"lint": "n8n-node lint",
|
|
27
35
|
"lint:fix": "n8n-node lint --fix",
|
|
28
36
|
"test": "vitest run",
|
|
29
|
-
"
|
|
37
|
+
"verify": "node scripts/verify-package.js",
|
|
38
|
+
"preversion": "npm run build && npm run lint && npm test && npm run verify",
|
|
39
|
+
"postversion": "git push origin main --follow-tags",
|
|
40
|
+
"release": "npm version patch",
|
|
41
|
+
"release:minor": "npm version minor",
|
|
42
|
+
"release:major": "npm version major",
|
|
30
43
|
"prepublishOnly": "npm run build && npm test && npm run verify && n8n-node prerelease",
|
|
31
|
-
"live-check": "node scripts/live-check.js"
|
|
32
|
-
"verify": "node scripts/verify-package.js"
|
|
44
|
+
"live-check": "node scripts/live-check.js"
|
|
33
45
|
},
|
|
34
46
|
"files": [
|
|
35
47
|
"dist"
|