n8n-nodes-moca 0.1.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 +21 -0
- package/README.md +192 -0
- package/dist/credentials/MocaApi.credentials.d.ts +8 -0
- package/dist/credentials/MocaApi.credentials.js +79 -0
- package/dist/credentials/MocaApi.credentials.js.map +1 -0
- package/dist/nodes/Moca/Moca.node.d.ts +10 -0
- package/dist/nodes/Moca/Moca.node.js +190 -0
- package/dist/nodes/Moca/Moca.node.js.map +1 -0
- package/dist/nodes/Moca/Moca.node.json +6 -0
- package/dist/nodes/Moca/MocaDescription.d.ts +3 -0
- package/dist/nodes/Moca/MocaDescription.js +127 -0
- package/dist/nodes/Moca/MocaDescription.js.map +1 -0
- package/dist/nodes/Moca/moca.dark.svg +5 -0
- package/dist/nodes/Moca/moca.svg +5 -0
- package/dist/nodes/Moca/transport/index.d.ts +33 -0
- package/dist/nodes/Moca/transport/index.js +117 -0
- package/dist/nodes/Moca/transport/index.js.map +1 -0
- package/dist/nodes/Moca/transport/protocol.d.ts +33 -0
- package/dist/nodes/Moca/transport/protocol.js +133 -0
- package/dist/nodes/Moca/transport/protocol.js.map +1 -0
- package/dist/nodes/Moca/transport/xml.d.ts +14 -0
- package/dist/nodes/Moca/transport/xml.js +156 -0
- package/dist/nodes/Moca/transport/xml.js.map +1 -0
- package/dist/package.json +58 -0
- package/package.json +58 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 n8n-nodes-moca contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# n8n-nodes-moca
|
|
2
|
+
|
|
3
|
+
An [n8n](https://n8n.io) community node for **MOCA** — the command server behind Blue Yonder / JDA / RedPrairie warehouse management systems.
|
|
4
|
+
|
|
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
|
+
|
|
7
|
+
[Installation](#installation) · [Credentials](#credentials) · [Operations](#operations) · [Examples](#examples) · [How it works](#how-it-works) · [Development](#development)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
### Community nodes panel (self-hosted n8n)
|
|
12
|
+
|
|
13
|
+
1. Go to **Settings → Community Nodes**.
|
|
14
|
+
2. Select **Install**.
|
|
15
|
+
3. Enter `n8n-nodes-moca` and confirm that you understand the risks of installing community nodes.
|
|
16
|
+
4. Select **Install**.
|
|
17
|
+
|
|
18
|
+
### Manual install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cd ~/.n8n
|
|
22
|
+
npm install n8n-nodes-moca
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Restart n8n afterwards. For Docker, install into the mounted `.n8n` volume or bake it into a custom image:
|
|
26
|
+
|
|
27
|
+
```dockerfile
|
|
28
|
+
FROM n8nio/n8n
|
|
29
|
+
USER root
|
|
30
|
+
RUN cd /usr/local/lib/node_modules/n8n && npm install n8n-nodes-moca
|
|
31
|
+
USER node
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Credentials
|
|
35
|
+
|
|
36
|
+
Create a **MOCA API** credential:
|
|
37
|
+
|
|
38
|
+
| Field | Required | Description |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| Service URL | yes | Full URL of the MOCA endpoint, e.g. `https://moca.example.com:4700/service` |
|
|
41
|
+
| User ID | yes | MOCA user, sent as the `USR_ID` environment variable |
|
|
42
|
+
| Password | yes | Password for that user |
|
|
43
|
+
| Warehouse ID | no | Sent as `WH_ID` with every command |
|
|
44
|
+
| Device | no | Sent as `DEVCOD` with every command |
|
|
45
|
+
| Locale | no | Sent as `LOCALE_ID`. Leave empty to use the locale returned at login. |
|
|
46
|
+
| Ignore SSL Issues | no | Accept self-signed certificates |
|
|
47
|
+
| Request Timeout (Ms) | no | Defaults to 300000 |
|
|
48
|
+
|
|
49
|
+
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
|
+
|
|
51
|
+
The password is only ever used for the login command. Every later command authenticates with the session key MOCA returns, and that session key is never written into workflow data.
|
|
52
|
+
|
|
53
|
+
## Operations
|
|
54
|
+
|
|
55
|
+
### Execute Command
|
|
56
|
+
|
|
57
|
+
Runs a MOCA syntax command and returns one item per result row.
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
list warehouses where wh_id like 'W%'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Execute Local Syntax
|
|
64
|
+
|
|
65
|
+
Runs a native SQL statement through MOCA local syntax. The statement is wrapped in square brackets so MOCA passes it straight to the database:
|
|
66
|
+
|
|
67
|
+
```sql
|
|
68
|
+
select wh_id, wh_nam from wh where wh_id = @wh_id
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
is sent as
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
[
|
|
75
|
+
select wh_id, wh_nam from wh where wh_id = @wh_id
|
|
76
|
+
]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Test Connection
|
|
80
|
+
|
|
81
|
+
Logs in and returns the session details (user, name, warehouse, locale). Useful as a health check at the top of a workflow.
|
|
82
|
+
|
|
83
|
+
### Arguments
|
|
84
|
+
|
|
85
|
+
Rather than pasting expression results into the command text, add **Arguments**. They are published ahead of the command with a `publish data` clause and referenced with `@name`:
|
|
86
|
+
|
|
87
|
+
| Name | Value |
|
|
88
|
+
| --- | --- |
|
|
89
|
+
| `wh_id` | `{{ $json.warehouse }}` |
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
list warehouses where wh_id = @wh_id
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
is sent as
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
publish data
|
|
99
|
+
where wh_id = 'WMD1'
|
|
100
|
+
|
|
|
101
|
+
list warehouses where wh_id = @wh_id
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Single quotes inside values are doubled, so a value such as `O'Brien` cannot break out of the literal.
|
|
105
|
+
|
|
106
|
+
### Options
|
|
107
|
+
|
|
108
|
+
| Option | Default | Description |
|
|
109
|
+
| --- | --- | --- |
|
|
110
|
+
| Autocommit | `true` | Whether MOCA commits when the command succeeds |
|
|
111
|
+
| 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
|
+
| Simplify | `true` | One item per row. Turn off to get a single item with `status`, `message`, `columns` and `rows`. |
|
|
113
|
+
| Treat Empty Result as Error | `false` | Whether MOCA status `510` (no rows found) should fail the node |
|
|
114
|
+
|
|
115
|
+
## Examples
|
|
116
|
+
|
|
117
|
+
**Look up inventory for an item from an incoming webhook**
|
|
118
|
+
|
|
119
|
+
Operation `Execute Command`, argument `item` → `{{ $json.body.sku }}`:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
list inventory where item = @item
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Read straight from the database**
|
|
126
|
+
|
|
127
|
+
Operation `Execute Local Syntax`:
|
|
128
|
+
|
|
129
|
+
```sql
|
|
130
|
+
select ord_num, ord_typ, stat_code
|
|
131
|
+
from ord
|
|
132
|
+
where wh_id = @wh_id
|
|
133
|
+
and stat_code < 90
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Use it as an AI agent tool**
|
|
137
|
+
|
|
138
|
+
The node has `usableAsTool` enabled, so it can be attached to an AI Agent to let the agent query the WMS.
|
|
139
|
+
|
|
140
|
+
### Running the local MOCA client (`msql`)
|
|
141
|
+
|
|
142
|
+
Community nodes are not allowed to spawn OS processes, so this package does not shell out. To run a command through the MOCA client installed on the n8n host, use n8n's built-in **Execute Command** node:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
msql -c "list warehouses"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## How it works
|
|
149
|
+
|
|
150
|
+
Each execution posts a `moca-request` document to the service URL with the `application/moca-xml` content type:
|
|
151
|
+
|
|
152
|
+
```xml
|
|
153
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
154
|
+
<moca-request autocommit="true">
|
|
155
|
+
<environment>
|
|
156
|
+
<var name="USR_ID" value="SUPER"/>
|
|
157
|
+
<var name="SESSION_KEY" value="..."/>
|
|
158
|
+
<var name="WH_ID" value="WMD1"/>
|
|
159
|
+
</environment>
|
|
160
|
+
<query>list warehouses</query>
|
|
161
|
+
</moca-request>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
- The node logs in once per execution and reuses the session key for every item.
|
|
165
|
+
- Status `0` is success, `510` (no rows found) returns an empty result, and `523` (session expired) triggers a single automatic re-login and retry.
|
|
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.
|
|
168
|
+
|
|
169
|
+
The XML is built and parsed in-package, so **n8n-nodes-moca has no runtime dependencies**.
|
|
170
|
+
|
|
171
|
+
## Compatibility
|
|
172
|
+
|
|
173
|
+
Tested against n8n's node API version 1 with `n8n-workflow` 2.x. Requires Node.js 20.19 or newer.
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
npm install # add --ignore-scripts if you have no C++ toolchain
|
|
179
|
+
npm run lint
|
|
180
|
+
npm test
|
|
181
|
+
npm run build
|
|
182
|
+
npm run dev # runs a local n8n with this node linked in
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Resources
|
|
186
|
+
|
|
187
|
+
- [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
188
|
+
- [mocanexion](https://github.com/chainreaktive/mocanexion) — the Python MOCA client this protocol implementation follows
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
[MIT](LICENSE.md)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MocaApi = void 0;
|
|
4
|
+
class MocaApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'mocaApi';
|
|
7
|
+
this.displayName = 'MOCA API';
|
|
8
|
+
this.icon = { light: 'file:../nodes/Moca/moca.svg', dark: 'file:../nodes/Moca/moca.dark.svg' };
|
|
9
|
+
this.documentationUrl = 'https://docs.n8n.io/integrations/community-nodes/';
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'Service URL',
|
|
13
|
+
name: 'url',
|
|
14
|
+
type: 'string',
|
|
15
|
+
default: '',
|
|
16
|
+
required: true,
|
|
17
|
+
placeholder: 'https://moca.example.com:4700/service',
|
|
18
|
+
description: 'Full URL of the MOCA server endpoint that accepts application/moca-xml requests',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'User ID',
|
|
22
|
+
name: 'username',
|
|
23
|
+
type: 'string',
|
|
24
|
+
default: '',
|
|
25
|
+
required: true,
|
|
26
|
+
description: 'MOCA user ID (USR_ID) used to log in',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
displayName: 'Password',
|
|
30
|
+
name: 'password',
|
|
31
|
+
type: 'string',
|
|
32
|
+
typeOptions: { password: true },
|
|
33
|
+
default: '',
|
|
34
|
+
required: true,
|
|
35
|
+
description: 'Password for the MOCA user',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
displayName: 'Warehouse ID',
|
|
39
|
+
name: 'warehouse',
|
|
40
|
+
type: 'string',
|
|
41
|
+
default: '',
|
|
42
|
+
placeholder: 'WMD1',
|
|
43
|
+
description: 'Optional WH_ID environment variable sent with every command',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
displayName: 'Device',
|
|
47
|
+
name: 'device',
|
|
48
|
+
type: 'string',
|
|
49
|
+
default: '',
|
|
50
|
+
description: 'Optional DEVCOD environment variable sent with every command',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
displayName: 'Locale',
|
|
54
|
+
name: 'locale',
|
|
55
|
+
type: 'string',
|
|
56
|
+
default: '',
|
|
57
|
+
placeholder: 'en_US',
|
|
58
|
+
description: 'Optional LOCALE_ID environment variable. Leave empty to use the locale returned at login.',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
displayName: 'Ignore SSL Issues',
|
|
62
|
+
name: 'ignoreSslIssues',
|
|
63
|
+
type: 'boolean',
|
|
64
|
+
default: false,
|
|
65
|
+
description: 'Whether to connect even when SSL certificate validation fails, which is common for MOCA servers using self-signed certificates',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
displayName: 'Request Timeout (Ms)',
|
|
69
|
+
name: 'timeout',
|
|
70
|
+
type: 'number',
|
|
71
|
+
default: 300000,
|
|
72
|
+
typeOptions: { minValue: 1000 },
|
|
73
|
+
description: 'How long to wait for the MOCA server before failing the request',
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.MocaApi = MocaApi;
|
|
79
|
+
//# sourceMappingURL=MocaApi.credentials.js.map
|
|
@@ -0,0 +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,GAAS,EAAE,KAAK,EAAE,6BAA6B,EAAE,IAAI,EAAE,kCAAkC,EAAE,CAAC;QAEhG,qBAAgB,GAAG,mDAAmD,CAAC;QAEvE,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,uCAAuC;gBACpD,WAAW,EACV,iFAAiF;aAClF;YACD;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,sCAAsC;aACnD;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,4BAA4B;aACzC;YACD;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,MAAM;gBACnB,WAAW,EAAE,6DAA6D;aAC1E;YACD;gBACC,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,8DAA8D;aAC3E;YACD;gBACC,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,OAAO;gBACpB,WAAW,EACV,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;SACD,CAAC;IACH,CAAC;CAAA;AA9ED,0BA8EC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ICredentialsDecrypted, ICredentialTestFunctions, IExecuteFunctions, INodeCredentialTestResult, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class Moca implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
credentialTest: {
|
|
6
|
+
mocaApiTest(this: ICredentialTestFunctions, credential: ICredentialsDecrypted): Promise<INodeCredentialTestResult>;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Moca = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const MocaDescription_1 = require("./MocaDescription");
|
|
6
|
+
const transport_1 = require("./transport");
|
|
7
|
+
const protocol_1 = require("./transport/protocol");
|
|
8
|
+
function collectArguments(raw) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const entries = (_a = raw.argument) !== null && _a !== void 0 ? _a : [];
|
|
11
|
+
const collected = {};
|
|
12
|
+
for (const entry of entries) {
|
|
13
|
+
if ((entry === null || entry === void 0 ? void 0 : entry.name) === undefined || entry.name.trim() === '')
|
|
14
|
+
continue;
|
|
15
|
+
collected[entry.name] = (_b = entry.value) !== null && _b !== void 0 ? _b : '';
|
|
16
|
+
}
|
|
17
|
+
return collected;
|
|
18
|
+
}
|
|
19
|
+
function toItems(response, command, options, itemIndex) {
|
|
20
|
+
const rows = options.convertNumeric === true ? (0, protocol_1.convertNumericColumns)(response) : response.rows;
|
|
21
|
+
if (options.simplify === false) {
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
json: {
|
|
25
|
+
status: response.status,
|
|
26
|
+
message: response.message,
|
|
27
|
+
command,
|
|
28
|
+
rowCount: rows.length,
|
|
29
|
+
columns: response.columns,
|
|
30
|
+
rows: rows,
|
|
31
|
+
},
|
|
32
|
+
pairedItem: { item: itemIndex },
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
if (rows.length === 0) {
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
json: {
|
|
40
|
+
status: response.status,
|
|
41
|
+
message: response.message,
|
|
42
|
+
command,
|
|
43
|
+
rowCount: 0,
|
|
44
|
+
},
|
|
45
|
+
pairedItem: { item: itemIndex },
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
return rows.map((row) => ({
|
|
50
|
+
json: row,
|
|
51
|
+
pairedItem: { item: itemIndex },
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
class Moca {
|
|
55
|
+
constructor() {
|
|
56
|
+
this.description = {
|
|
57
|
+
displayName: 'MOCA',
|
|
58
|
+
name: 'moca',
|
|
59
|
+
icon: { light: 'file:moca.svg', dark: 'file:moca.dark.svg' },
|
|
60
|
+
group: ['transform'],
|
|
61
|
+
version: 1,
|
|
62
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
63
|
+
description: 'Run MOCA syntax commands against a MOCA server (Blue Yonder / RedPrairie WMS)',
|
|
64
|
+
defaults: {
|
|
65
|
+
name: 'MOCA',
|
|
66
|
+
},
|
|
67
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
68
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
69
|
+
usableAsTool: true,
|
|
70
|
+
credentials: [
|
|
71
|
+
{
|
|
72
|
+
name: 'mocaApi',
|
|
73
|
+
required: true,
|
|
74
|
+
testedBy: 'mocaApiTest',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
properties: [...MocaDescription_1.mocaOperations, ...MocaDescription_1.mocaFields],
|
|
78
|
+
};
|
|
79
|
+
this.methods = {
|
|
80
|
+
credentialTest: {
|
|
81
|
+
async mocaApiTest(credential) {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
const credentials = credential.data;
|
|
84
|
+
if ((credentials === null || credentials === void 0 ? void 0 : credentials.url) === undefined || credentials.url.trim() === '') {
|
|
85
|
+
return { status: 'Error', message: 'No MOCA service URL is configured' };
|
|
86
|
+
}
|
|
87
|
+
const body = (0, protocol_1.buildMocaRequest)({
|
|
88
|
+
query: (0, transport_1.buildLoginQuery)(credentials.username, credentials.password),
|
|
89
|
+
environment: { USR_ID: credentials.username },
|
|
90
|
+
autocommit: false,
|
|
91
|
+
});
|
|
92
|
+
try {
|
|
93
|
+
const raw = await this.helpers.request({
|
|
94
|
+
method: 'POST',
|
|
95
|
+
uri: credentials.url,
|
|
96
|
+
headers: { 'Content-Type': transport_1.MOCA_CONTENT_TYPE, Accept: transport_1.MOCA_CONTENT_TYPE },
|
|
97
|
+
body,
|
|
98
|
+
json: false,
|
|
99
|
+
rejectUnauthorized: credentials.ignoreSslIssues !== true,
|
|
100
|
+
timeout: (_a = credentials.timeout) !== null && _a !== void 0 ? _a : 300000,
|
|
101
|
+
});
|
|
102
|
+
const response = (0, protocol_1.parseMocaResponse)(String(raw !== null && raw !== void 0 ? raw : ''));
|
|
103
|
+
if (response.status === protocol_1.MOCA_STATUS.OK) {
|
|
104
|
+
return { status: 'OK', message: 'Connection successful' };
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
status: 'Error',
|
|
108
|
+
message: (_b = response.message) !== null && _b !== void 0 ? _b : `MOCA rejected the login with status ${response.status}`,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
return { status: 'Error', message: error.message };
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
async execute() {
|
|
119
|
+
var _a, _b, _c;
|
|
120
|
+
const items = this.getInputData();
|
|
121
|
+
const returnData = [];
|
|
122
|
+
const credentials = (await this.getCredentials('mocaApi'));
|
|
123
|
+
let connection;
|
|
124
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
125
|
+
try {
|
|
126
|
+
const operation = this.getNodeParameter('operation', itemIndex);
|
|
127
|
+
if (connection === undefined)
|
|
128
|
+
connection = (0, transport_1.createConnection)(this, credentials);
|
|
129
|
+
if (operation === 'login') {
|
|
130
|
+
const response = await connection.login();
|
|
131
|
+
const row = (_a = response.rows[0]) !== null && _a !== void 0 ? _a : {};
|
|
132
|
+
const safeRow = {};
|
|
133
|
+
for (const [key, value] of Object.entries(row)) {
|
|
134
|
+
if (key.toLowerCase().includes('session'))
|
|
135
|
+
continue;
|
|
136
|
+
safeRow[key] = value;
|
|
137
|
+
}
|
|
138
|
+
returnData.push({
|
|
139
|
+
json: {
|
|
140
|
+
connected: true,
|
|
141
|
+
status: response.status,
|
|
142
|
+
message: response.message,
|
|
143
|
+
url: credentials.url,
|
|
144
|
+
user: credentials.username,
|
|
145
|
+
...safeRow,
|
|
146
|
+
},
|
|
147
|
+
pairedItem: { item: itemIndex },
|
|
148
|
+
});
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (operation !== 'execute' && operation !== 'executeSql') {
|
|
152
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not supported`, { itemIndex });
|
|
153
|
+
}
|
|
154
|
+
const options = this.getNodeParameter('options', itemIndex, {});
|
|
155
|
+
const command = operation === 'executeSql'
|
|
156
|
+
? (0, protocol_1.asLocalSyntax)(this.getNodeParameter('sql', itemIndex))
|
|
157
|
+
: this.getNodeParameter('command', itemIndex).trim();
|
|
158
|
+
const publishData = collectArguments(this.getNodeParameter('publishData', itemIndex, {}));
|
|
159
|
+
const response = await connection.execute((0, protocol_1.withPublishedData)(command, publishData), {
|
|
160
|
+
autocommit: options.autocommit !== false,
|
|
161
|
+
});
|
|
162
|
+
const emptyResultIsFine = response.status === protocol_1.MOCA_STATUS.NO_ROWS && options.errorOnNoRows !== true;
|
|
163
|
+
if (response.status !== protocol_1.MOCA_STATUS.OK && !emptyResultIsFine) {
|
|
164
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `MOCA command failed with status ${response.status}`, {
|
|
165
|
+
description: (_b = response.message) !== null && _b !== void 0 ? _b : undefined,
|
|
166
|
+
itemIndex,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
returnData.push(...toItems(response, command, options, itemIndex));
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
if (this.continueOnFail()) {
|
|
173
|
+
returnData.push({
|
|
174
|
+
json: { error: error.message },
|
|
175
|
+
error: error,
|
|
176
|
+
pairedItem: { item: itemIndex },
|
|
177
|
+
});
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
|
|
181
|
+
itemIndex,
|
|
182
|
+
description: (_c = error.description) !== null && _c !== void 0 ? _c : undefined,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return [returnData];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.Moca = Moca;
|
|
190
|
+
//# sourceMappingURL=Moca.node.js.map
|
|
@@ -0,0 +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,mDAO8B;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,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AAE,KAAc,EAAE;oBAC5D,SAAS;oBACT,WAAW,EAAE,MAAC,KAA4B,CAAC,WAAW,mCAAI,SAAS;iBACnE,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AArKD,oBAqKC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mocaFields = exports.mocaOperations = void 0;
|
|
4
|
+
exports.mocaOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
default: 'execute',
|
|
11
|
+
options: [
|
|
12
|
+
{
|
|
13
|
+
name: 'Execute Command',
|
|
14
|
+
value: 'execute',
|
|
15
|
+
description: 'Run a MOCA syntax command on the MOCA server',
|
|
16
|
+
action: 'Execute a MOCA command',
|
|
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
|
+
{
|
|
25
|
+
name: 'Test Connection',
|
|
26
|
+
value: 'login',
|
|
27
|
+
description: 'Log in to the MOCA server and return the session details',
|
|
28
|
+
action: 'Test the MOCA connection',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
exports.mocaFields = [
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Command',
|
|
36
|
+
name: 'command',
|
|
37
|
+
type: 'string',
|
|
38
|
+
typeOptions: { rows: 6 },
|
|
39
|
+
default: '',
|
|
40
|
+
required: true,
|
|
41
|
+
placeholder: "list warehouses where wh_id like 'W%'",
|
|
42
|
+
description: 'MOCA syntax command to run. Use the Arguments section to bind values safely.',
|
|
43
|
+
displayOptions: { show: { operation: ['execute'] } },
|
|
44
|
+
},
|
|
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
|
+
{
|
|
57
|
+
displayName: 'Arguments',
|
|
58
|
+
name: 'publishData',
|
|
59
|
+
placeholder: 'Add Argument',
|
|
60
|
+
type: 'fixedCollection',
|
|
61
|
+
typeOptions: { multipleValues: true },
|
|
62
|
+
default: {},
|
|
63
|
+
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', 'executeSql'] } },
|
|
65
|
+
options: [
|
|
66
|
+
{
|
|
67
|
+
name: 'argument',
|
|
68
|
+
displayName: 'Argument',
|
|
69
|
+
values: [
|
|
70
|
+
{
|
|
71
|
+
displayName: 'Name',
|
|
72
|
+
name: 'name',
|
|
73
|
+
type: 'string',
|
|
74
|
+
default: '',
|
|
75
|
+
placeholder: 'wh_id',
|
|
76
|
+
description: 'Name the value is published under. Reference it with @name in the command.',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
displayName: 'Value',
|
|
80
|
+
name: 'value',
|
|
81
|
+
type: 'string',
|
|
82
|
+
default: '',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
displayName: 'Options',
|
|
90
|
+
name: 'options',
|
|
91
|
+
type: 'collection',
|
|
92
|
+
placeholder: 'Add option',
|
|
93
|
+
default: {},
|
|
94
|
+
displayOptions: { show: { operation: ['execute', 'executeSql'] } },
|
|
95
|
+
options: [
|
|
96
|
+
{
|
|
97
|
+
displayName: 'Autocommit',
|
|
98
|
+
name: 'autocommit',
|
|
99
|
+
type: 'boolean',
|
|
100
|
+
default: true,
|
|
101
|
+
description: 'Whether the MOCA server commits the transaction when the command succeeds',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
displayName: 'Convert Numeric Columns',
|
|
105
|
+
name: 'convertNumeric',
|
|
106
|
+
type: 'boolean',
|
|
107
|
+
default: false,
|
|
108
|
+
description: 'Whether to convert columns the server reports as numeric into numbers. All values are returned as strings when disabled.',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
displayName: 'Simplify',
|
|
112
|
+
name: 'simplify',
|
|
113
|
+
type: 'boolean',
|
|
114
|
+
default: true,
|
|
115
|
+
description: 'Whether to return one item per result row. When disabled, a single item with the status, message, column metadata and rows is returned.',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
displayName: 'Treat Empty Result as Error',
|
|
119
|
+
name: 'errorOnNoRows',
|
|
120
|
+
type: 'boolean',
|
|
121
|
+
default: false,
|
|
122
|
+
description: 'Whether MOCA status 510 (no rows found) should fail the node instead of returning an empty result',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
//# sourceMappingURL=MocaDescription.js.map
|
|
@@ -0,0 +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,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