n8n-nodes-smbclient 1.0.2 → 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/.github/workflows/npm-publish.yml +38 -32
- package/.github/workflows/one-shot-npm-publish.yml +36 -30
- package/CLAUDE.md +59 -0
- package/dist/nodes/Smb2/Smb2.node.js +33 -1
- package/dist/nodes/Smb2/Smb2.node.js.map +1 -1
- package/dist/nodes/Smb2/SmbClientWrapper.d.ts +2 -0
- package/dist/nodes/Smb2/SmbClientWrapper.js +23 -30
- package/dist/nodes/Smb2/SmbClientWrapper.js.map +1 -1
- package/dist/nodes/Smb2/SmbEntryHelpers.js +22 -0
- package/dist/nodes/Smb2/SmbEntryHelpers.js.map +1 -1
- package/dist/nodes/Smb2/interfaces.d.ts +1 -1
- package/dist/package.json +12 -18
- package/nodes/Smb2/Smb2.node.ts +34 -1
- package/nodes/Smb2/SmbClientWrapper.ts +38 -41
- package/nodes/Smb2/SmbEntryHelpers.ts +28 -0
- package/nodes/Smb2/interfaces.ts +1 -1
- package/package.json +24 -28
- package/pnpm-workspace.yaml +18 -0
- package/renovate.json +2 -1
- package/tsconfig.json +1 -1
|
@@ -1,32 +1,38 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Build and Publish Node.js Package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
release:
|
|
8
|
-
types: [created]
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
build:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v6
|
|
15
|
-
- uses:
|
|
16
|
-
with:
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Build and Publish Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v6
|
|
15
|
+
- uses: pnpm/action-setup@v6
|
|
16
|
+
with:
|
|
17
|
+
version: latest
|
|
18
|
+
- uses: actions/setup-node@v6
|
|
19
|
+
with:
|
|
20
|
+
node-version: 24
|
|
21
|
+
- run: pnpm install --frozen-lockfile
|
|
22
|
+
|
|
23
|
+
publish-npm:
|
|
24
|
+
needs: build
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v6
|
|
28
|
+
- uses: pnpm/action-setup@v6
|
|
29
|
+
with:
|
|
30
|
+
version: latest
|
|
31
|
+
- uses: actions/setup-node@v6
|
|
32
|
+
with:
|
|
33
|
+
node-version: 24
|
|
34
|
+
registry-url: https://registry.npmjs.org/
|
|
35
|
+
- run: pnpm install --frozen-lockfile
|
|
36
|
+
- run: pnpm publish --no-git-checks
|
|
37
|
+
env:
|
|
38
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Build and Publish Node.js Package
|
|
5
|
-
|
|
6
|
-
on: workflow_dispatch
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
steps:
|
|
12
|
-
- uses: actions/checkout@v6
|
|
13
|
-
- uses:
|
|
14
|
-
with:
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Build and Publish Node.js Package
|
|
5
|
+
|
|
6
|
+
on: workflow_dispatch
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v6
|
|
13
|
+
- uses: pnpm/action-setup@v6
|
|
14
|
+
with:
|
|
15
|
+
version: latest
|
|
16
|
+
- uses: actions/setup-node@v6
|
|
17
|
+
with:
|
|
18
|
+
node-version: 24
|
|
19
|
+
- run: pnpm install --frozen-lockfile
|
|
20
|
+
|
|
21
|
+
publish-npm:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v6
|
|
26
|
+
- uses: pnpm/action-setup@v6
|
|
27
|
+
with:
|
|
28
|
+
version: latest
|
|
29
|
+
- uses: actions/setup-node@v6
|
|
30
|
+
with:
|
|
31
|
+
node-version: 24
|
|
32
|
+
registry-url: https://registry.npmjs.org/
|
|
33
|
+
- run: pnpm install --frozen-lockfile
|
|
34
|
+
- run: pnpm publish --no-git-checks
|
|
35
|
+
env:
|
|
36
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## What this is
|
|
6
|
+
|
|
7
|
+
An [n8n](https://n8n.io/) community node package that lets workflows interact with SMB2/SMB3 file shares. Unlike most SMB libraries, this implementation **shells out to the `smbclient` CLI** (the Samba `samba-client` package) rather than speaking the SMB protocol in JS. The `smbclient` binary must be installed in the n8n runtime/container — without it the node fails at runtime.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm run build # rimraf dist + tsc compile + gulp copies icons into dist/
|
|
13
|
+
npm run dev # tsc --watch
|
|
14
|
+
npm run lint # eslint on nodes, credentials, package.json (n8n-nodes-base rules)
|
|
15
|
+
npm run lintfix # eslint --fix
|
|
16
|
+
npm run format # prettier --write on nodes and credentials
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
There is **no test suite** and no test runner configured. Verification is manual against a live SMB server / n8n instance (see "Local development" below).
|
|
20
|
+
|
|
21
|
+
Package manager is **pnpm** (see `pnpm-lock.yaml`), though npm scripts work too.
|
|
22
|
+
|
|
23
|
+
## Architecture
|
|
24
|
+
|
|
25
|
+
The build entrypoints n8n loads are declared in `package.json` under the `n8n` key — they point at compiled files in `dist/`, so you must `npm run build` before n8n can see changes.
|
|
26
|
+
|
|
27
|
+
Source is split into two halves:
|
|
28
|
+
|
|
29
|
+
- **`credentials/Smb2Api.credentials.ts`** — the `smb2Api` credential type (host, share, username, password, domain, port, timeouts). Note: several credential fields (`port`, timeouts, `maxProtocol`) are collected in the UI but **not actually passed to `smbclient`** — `buildBaseArgs()` only uses host/share/username/password/domain. Be aware of this gap when touching connection logic.
|
|
30
|
+
|
|
31
|
+
- **`nodes/Smb2/`** — the node itself, in three layers:
|
|
32
|
+
- **`Smb2.node.ts`** — n8n node definition (all UI properties, operation list) and `execute()`. `execute()` looks up a handler from the `handlers` map by operation name, builds one client, then loops over input items calling the handler per item. The client is closed in a `finally` (currently a no-op, see below).
|
|
33
|
+
- **`SmbEntryHelpers.ts`** — one `OpHandler` function per operation (`handleStat`, `handleList`, `handleGet`, etc.) plus the `handlers` map and `buildClient`. Handlers translate n8n params ↔ `SmbClientWrapper` calls. File transfers (`get`/`put`) go through a **temp file** in `os.tmpdir()` (n8n binary data ⇄ disk ⇄ smbclient), cleaned up after.
|
|
34
|
+
- **`SmbClientWrapper.ts`** — the only place that spawns a process. Each method (`stat`, `list`, `get`, `put`, `mkdir`, `rmdir`, `del`, `rename`) builds an `smbclient` invocation and runs it via `runOne()` → `execFile`. Every command is a **separate process**; there is no persistent connection, so `close()` is intentionally a no-op (kept for API parity).
|
|
35
|
+
|
|
36
|
+
### Key cross-cutting concerns
|
|
37
|
+
|
|
38
|
+
- **`smbclient` invocation shape**: `runOne()` runs `smbclient \\\\host\\share -U user%pass -g -c "<cmd>"`. The `-g` flag forces machine-parseable (pipe-delimited) output. Anonymous access uses `-U %` when no username is given.
|
|
39
|
+
- **Output parsing is fragile by nature** — `list()` parses `smbclient` text output and handles *multiple* formats (pipe-delimited and space-aligned columns) plus footer/artifact filtering, because output varies across Samba builds. If list parsing breaks, this is the place to look, and add a new format branch rather than rewriting.
|
|
40
|
+
- **Secret redaction**: `runOne()` never lets raw credentials reach error messages or logs. `redactCmd()` strips `-U`/`-A` args and host paths; `maskSecrets()` replaces username/password/domain substrings with `***`. **Any new code that surfaces command strings or stderr must route through these helpers.**
|
|
41
|
+
- **Error mapping**: `getReadableError()` + the `SMB_ERROR_HINTS` regex table translate raw errno/NT_STATUS strings into friendly messages. Errors are thrown as `NodeOperationError` / `NodeApiError`.
|
|
42
|
+
- **Debug logging** uses Node's `debuglog('n8n-nodes-smbclient')` — enable with `NODE_DEBUG=n8n-nodes-smbclient`.
|
|
43
|
+
|
|
44
|
+
### Adding a new operation
|
|
45
|
+
|
|
46
|
+
1. Add the value to the `Operation` union in `interfaces.ts`.
|
|
47
|
+
2. Add a method on `SmbClientWrapper` that builds the `smbclient -c` command (quote/escape paths; reuse `escapeSmbArg`).
|
|
48
|
+
3. Add an `OpHandler` in `SmbEntryHelpers.ts` and register it in the `handlers` map.
|
|
49
|
+
4. Add the operation to the `options` list and any UI params (with `displayOptions.show`) in `Smb2.node.ts`.
|
|
50
|
+
|
|
51
|
+
## Local development
|
|
52
|
+
|
|
53
|
+
Build, then mount this repo into an n8n container and reference it from `~/.n8n/nodes/package.json` as `"n8n-nodes-smbclient": "file:/opt/code-temp"`, then restart. Full steps and a docker-compose volume example are in `Readme.md` ("Running local"). Verify the binary with `smbclient --version` inside the container.
|
|
54
|
+
|
|
55
|
+
## Conventions
|
|
56
|
+
|
|
57
|
+
- Tabs for indentation, single quotes, semicolons, 100-char width (`.prettierrc.js` / `.editorconfig`).
|
|
58
|
+
- Lint enforces `eslint-plugin-n8n-nodes-base` community-node rules — run `npm run lint` before publishing; `prepublishOnly` also runs a stricter lint config.
|
|
59
|
+
- Some inline comments are in French (legacy); match the surrounding language when editing nearby, otherwise prefer English.
|
|
@@ -67,6 +67,12 @@ class Smb2 {
|
|
|
67
67
|
description: 'Remove a directory',
|
|
68
68
|
action: 'Remove a directory',
|
|
69
69
|
},
|
|
70
|
+
{
|
|
71
|
+
name: 'Rename / Move File',
|
|
72
|
+
value: 'rename',
|
|
73
|
+
description: 'Rename or move a file or folder',
|
|
74
|
+
action: 'Rename or move a file or folder',
|
|
75
|
+
},
|
|
70
76
|
{
|
|
71
77
|
name: 'Stat',
|
|
72
78
|
value: 'stat',
|
|
@@ -89,7 +95,7 @@ class Smb2 {
|
|
|
89
95
|
default: '/',
|
|
90
96
|
displayOptions: {
|
|
91
97
|
show: {
|
|
92
|
-
operation: ['stat', 'get', 'put', 'del'],
|
|
98
|
+
operation: ['stat', 'get', 'put', 'del', 'rename'],
|
|
93
99
|
},
|
|
94
100
|
},
|
|
95
101
|
},
|
|
@@ -104,6 +110,32 @@ class Smb2 {
|
|
|
104
110
|
},
|
|
105
111
|
},
|
|
106
112
|
},
|
|
113
|
+
{
|
|
114
|
+
displayName: 'New Path',
|
|
115
|
+
name: 'newPath',
|
|
116
|
+
type: 'string',
|
|
117
|
+
default: '',
|
|
118
|
+
placeholder: '/folder/newname.txt',
|
|
119
|
+
description: 'New path or name for the renamed/moved file or folder',
|
|
120
|
+
displayOptions: {
|
|
121
|
+
show: {
|
|
122
|
+
operation: ['rename'],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
displayName: 'Overwrite If Exists',
|
|
128
|
+
name: 'overwriteIfExists',
|
|
129
|
+
type: 'boolean',
|
|
130
|
+
default: false,
|
|
131
|
+
description: 'If the destination path already exists, delete it before renaming. ' +
|
|
132
|
+
'Only works for files — overwriting an existing directory is not supported.',
|
|
133
|
+
displayOptions: {
|
|
134
|
+
show: {
|
|
135
|
+
operation: ['rename'],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
107
139
|
{
|
|
108
140
|
displayName: 'Source',
|
|
109
141
|
name: 'putSource',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Smb2.node.js","sourceRoot":"","sources":["../../../nodes/Smb2/Smb2.node.ts"],"names":[],"mappings":";;;AAOA,uDAA0D;AAC1D,+CAAkD;AAClD,MAAa,IAAI;IAAjB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,sBAAsB;YACnC,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,kDAAkD;YAC/D,QAAQ,EAAE;gBACT,IAAI,EAAE,sBAAsB;aAC5B;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBAC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W,EAAC,IAAI,CAAC,CAAC;QAEvC,MAAM,GAAG,GAAyB,EAAE,CAAC;QACrC,IAAI,CAAC;YACJ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACvC,GAAG,CAAC,IAAI,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;YAC1C,CAAC;QACF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,MAAM,IAAI,iCAAkB,CAC3B,IAAI,CAAC,OAAO,EAAE,EACd,CAAC,GAAa,aAAb,GAAG,uBAAH,GAAG,CAAY,OAAO,KAAI,sBAAsB,CACjD,CAAC;QACH,CAAC;gBAAS,CAAC;YACV,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;CACD;AAhOD,oBAgOC"}
|
|
@@ -7,6 +7,7 @@ export declare class SmbClientWrapper {
|
|
|
7
7
|
private node;
|
|
8
8
|
constructor(auth: Smb2Credentials, smbclientPath: string | undefined, node: INode);
|
|
9
9
|
private buildBaseArgs;
|
|
10
|
+
private fail;
|
|
10
11
|
private runOne;
|
|
11
12
|
stat(remotePath: string): Promise<SmbStat>;
|
|
12
13
|
list(dir: string): Promise<SmbListEntry[]>;
|
|
@@ -15,6 +16,7 @@ export declare class SmbClientWrapper {
|
|
|
15
16
|
mkdir(remoteDir: string): Promise<void>;
|
|
16
17
|
rmdir(remoteDir: string): Promise<void>;
|
|
17
18
|
del(remotePath: string): Promise<void>;
|
|
19
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
18
20
|
close(): Promise<void>;
|
|
19
21
|
private escapeSmbArg;
|
|
20
22
|
}
|
|
@@ -8,6 +8,7 @@ const node_util_1 = require("node:util");
|
|
|
8
8
|
const node_child_process_1 = require("node:child_process");
|
|
9
9
|
const util_1 = require("util");
|
|
10
10
|
const debug = (0, util_1.debuglog)('n8n-nodes-smbclient');
|
|
11
|
+
const SMB_FAILURE_RE = /NT_STATUS_(?!OK\b)[A-Z0-9_]+/;
|
|
11
12
|
const SMB_ERROR_HINTS = [
|
|
12
13
|
[/EACCES/i, 'Access Denied - Check your permissions for this file/folder'],
|
|
13
14
|
[/ENOENT/i, 'File/Path Not Found'],
|
|
@@ -65,30 +66,35 @@ class SmbClientWrapper {
|
|
|
65
66
|
const hostPart = `\\\\${host}\\${share}`;
|
|
66
67
|
return [hostPart, '-U', userPart, '-g'];
|
|
67
68
|
}
|
|
69
|
+
fail(safeCmd, detail) {
|
|
70
|
+
const { username, password, domain } = this.auth;
|
|
71
|
+
const safeErr = maskSecrets((detail || '').trim() || 'smbclient command failed', [
|
|
72
|
+
username,
|
|
73
|
+
password,
|
|
74
|
+
domain,
|
|
75
|
+
]);
|
|
76
|
+
throw new n8n_workflow_1.NodeOperationError(this.node, `smbclient failed. cmd="${safeCmd}" stderr="${safeErr}"`);
|
|
77
|
+
}
|
|
68
78
|
async runOne(cmd) {
|
|
69
79
|
var _a, _b;
|
|
70
80
|
const args = [...this.buildBaseArgs(), '-c', cmd];
|
|
71
81
|
const { username, password, domain } = this.auth;
|
|
72
82
|
const rawCmd = [this.smbclientPath, ...args].join(' ');
|
|
73
83
|
const safeCmd = maskSecrets(redactCmd(rawCmd), [username, password, domain]);
|
|
84
|
+
let stdout = '';
|
|
85
|
+
let stderr = '';
|
|
74
86
|
try {
|
|
75
|
-
|
|
87
|
+
({ stdout, stderr } = await execFileAsync(this.smbclientPath, args, {
|
|
76
88
|
maxBuffer: 10 * 1024 * 1024,
|
|
77
|
-
});
|
|
78
|
-
if (stderr && /NT_STATUS|Error|failed/i.test(stderr)) {
|
|
79
|
-
const safeErr = maskSecrets(stderr.trim(), [username, password, domain]);
|
|
80
|
-
throw new n8n_workflow_1.NodeOperationError(this.node, {
|
|
81
|
-
message: `smbclient failed. cmd="${safeCmd}" stderr="${safeErr}"`,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return stdout !== null && stdout !== void 0 ? stdout : '';
|
|
89
|
+
}));
|
|
85
90
|
}
|
|
86
91
|
catch (err) {
|
|
87
|
-
|
|
88
|
-
throw new n8n_workflow_1.NodeOperationError(this.node, {
|
|
89
|
-
message: `smbclient failed. cmd="${safeCmd}" stderr="${safeErr}"`,
|
|
90
|
-
});
|
|
92
|
+
this.fail(safeCmd, ((_b = (_a = err === null || err === void 0 ? void 0 : err.stderr) === null || _a === void 0 ? void 0 : _a.trim) === null || _b === void 0 ? void 0 : _b.call(_a)) || (err === null || err === void 0 ? void 0 : err.message));
|
|
91
93
|
}
|
|
94
|
+
if (stderr && SMB_FAILURE_RE.test(stderr)) {
|
|
95
|
+
this.fail(safeCmd, stderr);
|
|
96
|
+
}
|
|
97
|
+
return stdout !== null && stdout !== void 0 ? stdout : '';
|
|
92
98
|
}
|
|
93
99
|
async stat(remotePath) {
|
|
94
100
|
var _a, _b, _c, _d, _e;
|
|
@@ -122,7 +128,7 @@ class SmbClientWrapper {
|
|
|
122
128
|
.map((l) => l.trim())
|
|
123
129
|
.filter(Boolean);
|
|
124
130
|
const parsed = lines.map((line) => {
|
|
125
|
-
var _a
|
|
131
|
+
var _a;
|
|
126
132
|
if (line.includes('|')) {
|
|
127
133
|
const parts = line.split('|');
|
|
128
134
|
if (parts.length >= 5 && /^\d+$/.test(parts[1])) {
|
|
@@ -141,22 +147,6 @@ class SmbClientWrapper {
|
|
|
141
147
|
isDirectory: attributes.includes('D'),
|
|
142
148
|
};
|
|
143
149
|
}
|
|
144
|
-
if (parts.length >= 5 && /^\d+$/.test(parts[1])) {
|
|
145
|
-
const attr = (_b = parts[0]) !== null && _b !== void 0 ? _b : '';
|
|
146
|
-
const size = Number(parts[1]) || 0;
|
|
147
|
-
const date = parts[2];
|
|
148
|
-
const time = parts[3];
|
|
149
|
-
const name = parts.slice(4).join('|');
|
|
150
|
-
const attributes = attr.split('').filter(Boolean);
|
|
151
|
-
return {
|
|
152
|
-
name,
|
|
153
|
-
size,
|
|
154
|
-
date,
|
|
155
|
-
time,
|
|
156
|
-
attributes,
|
|
157
|
-
isDirectory: attributes.includes('D'),
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
150
|
return {
|
|
161
151
|
name: line,
|
|
162
152
|
size: 0,
|
|
@@ -222,6 +212,9 @@ class SmbClientWrapper {
|
|
|
222
212
|
async del(remotePath) {
|
|
223
213
|
await this.runOne(`del "${remotePath}"`);
|
|
224
214
|
}
|
|
215
|
+
async rename(oldPath, newPath) {
|
|
216
|
+
await this.runOne(`rename "${oldPath}" "${newPath}"`);
|
|
217
|
+
}
|
|
225
218
|
async close() {
|
|
226
219
|
}
|
|
227
220
|
escapeSmbArg(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmbClientWrapper.js","sourceRoot":"","sources":["../../../nodes/Smb2/SmbClientWrapper.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SmbClientWrapper.js","sourceRoot":"","sources":["../../../nodes/Smb2/SmbClientWrapper.ts"],"names":[],"mappings":";;;AA+BA,4CAQC;AAoPD,gDA2BC;AAtTD,+CAMsB;AACtB,yCAAsC;AACtC,2DAA8C;AAE9C,+BAAgC;AAEhC,MAAM,KAAK,GAAG,IAAA,eAAQ,EAAC,qBAAqB,CAAC,CAAC;AAM9C,MAAM,cAAc,GAAG,8BAA8B,CAAC;AAEtD,MAAM,eAAe,GAA4B;IAChD,CAAC,SAAS,EAAE,6DAA6D,CAAC;IAC1E,CAAC,SAAS,EAAE,qBAAqB,CAAC;IAClC,CAAC,UAAU,EAAE,iBAAiB,CAAC;IAC/B,CAAC,WAAW,EAAE,sBAAsB,CAAC;IACrC,CAAC,eAAe,EAAE,sDA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,eAAe,EAAE,CAAC,EAAE,WAAW,CAAW,CAAC;QACvF,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,WAAW,EAAE,aAAa,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAGhF,MAAM,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEtB,OAAO,EAAE,MAAM,EAAE,CAAC;IACnB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACrB,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QAClC,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC9C,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE;YAC7C,OAAO,EAAE,oCAAoC,aAAa,EAAE;SAC5D,CAAC,CAAC;IACJ,CAAC;AACF,CAAC"}
|
|
@@ -87,6 +87,27 @@ const handleDel = async (ctx, i, client) => {
|
|
|
87
87
|
await client.del(remotePath);
|
|
88
88
|
return { json: { remotePath, deleted: true } };
|
|
89
89
|
};
|
|
90
|
+
const NOT_FOUND_STATUSES = /NT_STATUS_NO_SUCH_FILE|NT_STATUS_OBJECT_NAME_NOT_FOUND|NT_STATUS_OBJECT_PATH_NOT_FOUND/i;
|
|
91
|
+
const handleRename = async (ctx, i, client) => {
|
|
92
|
+
var _a;
|
|
93
|
+
const oldPath = str(ctx, i, 'remotePath');
|
|
94
|
+
const newPath = str(ctx, i, 'newPath');
|
|
95
|
+
const overwriteIfExists = ctx.getNodeParameter('overwriteIfExists', i, false);
|
|
96
|
+
let overwritten = false;
|
|
97
|
+
if (overwriteIfExists) {
|
|
98
|
+
try {
|
|
99
|
+
await client.del(newPath);
|
|
100
|
+
overwritten = true;
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
if (!NOT_FOUND_STATUSES.test((_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : '')) {
|
|
104
|
+
throw err;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
await client.rename(oldPath, newPath);
|
|
109
|
+
return { json: { oldPath, newPath, renamed: true, overwritten } };
|
|
110
|
+
};
|
|
90
111
|
const handlers = {
|
|
91
112
|
stat: handleStat,
|
|
92
113
|
list: handleList,
|
|
@@ -95,6 +116,7 @@ const handlers = {
|
|
|
95
116
|
mkdir: handleMkdir,
|
|
96
117
|
rmdir: handleRmdir,
|
|
97
118
|
del: handleDel,
|
|
119
|
+
rename: handleRename,
|
|
98
120
|
};
|
|
99
121
|
exports.handlers = handlers;
|
|
100
122
|
//# sourceMappingURL=SmbEntryHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmbEntryHelpers.js","sourceRoot":"","sources":["../../../nodes/Smb2/SmbEntryHelpers.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAgC;AAChC,+CAAyF;AACzF,0DAA6B;AAC7B,sDAAyB;AACzB,8DAAiC;AACjC,yDAAsD;AAEtD,gEAAkC;AAElC,MAAM,KAAK,GAAG,IAAA,eAAQ,EAAC,qBAAqB,CAAC,CAAC;AAC9C,MAAM,GAAG,GAAG,CAAC,GAAsB,EAAE,CAAS,EAAE,IAAY,EAAE,GAAG,GAAG,EAAE,EAAU,EAAE,CACjF,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAW,CAAC;AAE9C,MAAM,OAAO,GAAG,CAAC,MAAqB,EAAE,EAAE,CACzC,mBAAI,CAAC,IAAI,CAAC,iBAAE,CAAC,MAAM,EAAE,EAAE,WAAW,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,qBAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAElF,MAAM,QAAQ,GAAG,KAAK,EACrB,GAAsB,EACtB,GAAW,EACX,QAAgB,EAChB,IAAY,EACZ,OAAe,EACf,YAAqC,EAAE,EACT,EAAE;IAChC,MAAM,MAAM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,uBAAH,GAAG,CAAE,OAAO,mCAAI,EAAE,CAAC,EAAE,CAAC;gBAClD,MAAM,GAAG,CAAC;YACX,CAAC;QACF,CAAC;IACF,CAAC;IAED,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtC,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,CAAC;AACnE,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAiC;IAC9C,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,WAAW;IAClB,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,YAAY;CACpB,CAAC;AAEO,4BAAQ"}
|
|
@@ -26,6 +26,6 @@ type SmbStat = {
|
|
|
26
26
|
attributes?: string[];
|
|
27
27
|
isDirectory?: boolean;
|
|
28
28
|
};
|
|
29
|
-
type Operation = 'stat' | 'list' | 'get' | 'put' | 'mkdir' | 'rmdir' | 'del';
|
|
29
|
+
type Operation = 'stat' | 'list' | 'get' | 'put' | 'mkdir' | 'rmdir' | 'del' | 'rename';
|
|
30
30
|
type OpHandler = (ctx: IExecuteFunctions, i: number, client: SmbClientWrapper) => Promise<INodeExecutionData>;
|
|
31
31
|
export { SmbStat, SmbListEntry, Smb2Credentials, Operation, OpHandler };
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-smbclient",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Transfer files via Samba (SMB2) and smbclient package with n8n, some of the base work are based on https://github.com/drudge/n8n-nodes-smb work.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
]
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@eslint/compat": "^2.0.
|
|
42
|
-
"@eslint/eslintrc": "^3.3.
|
|
43
|
-
"@eslint/js": "^10.0.
|
|
44
|
-
"@types/node": "^24.
|
|
45
|
-
"@typescript-eslint/parser": "^8.
|
|
46
|
-
"eslint": "^10.
|
|
47
|
-
"eslint-plugin-n8n-nodes-base": "^1.16.
|
|
48
|
-
"globals": "^17.
|
|
41
|
+
"@eslint/compat": "^2.0.5",
|
|
42
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
43
|
+
"@eslint/js": "^10.0.1",
|
|
44
|
+
"@types/node": "^24.12.4",
|
|
45
|
+
"@typescript-eslint/parser": "^8.59.1",
|
|
46
|
+
"eslint": "^10.3.0",
|
|
47
|
+
"eslint-plugin-n8n-nodes-base": "^1.16.6",
|
|
48
|
+
"globals": "^17.6.0",
|
|
49
49
|
"gulp": "^5.0.1",
|
|
50
|
-
"prettier": "^3.
|
|
51
|
-
"typescript": "^
|
|
50
|
+
"prettier": "^3.8.3",
|
|
51
|
+
"typescript": "^6.0.3"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"n8n-workflow": "^1.115.0 || ^2.0.0"
|
|
@@ -58,12 +58,6 @@
|
|
|
58
58
|
},
|
|
59
59
|
"overrides": {
|
|
60
60
|
"form-data": "^4.0.4",
|
|
61
|
-
"axios": "1.
|
|
62
|
-
},
|
|
63
|
-
"pnpm": {
|
|
64
|
-
"onlyBuiltDependencies": [
|
|
65
|
-
"eslint-plugin-n8n-nodes-base",
|
|
66
|
-
"isolated-vm"
|
|
67
|
-
]
|
|
61
|
+
"axios": "1.17.0"
|
|
68
62
|
}
|
|
69
63
|
}
|
package/nodes/Smb2/Smb2.node.ts
CHANGED
|
@@ -73,6 +73,12 @@ export class Smb2 implements INodeType {
|
|
|
73
73
|
description: 'Remove a directory',
|
|
74
74
|
action: 'Remove a directory',
|
|
75
75
|
},
|
|
76
|
+
{
|
|
77
|
+
name: 'Rename / Move File',
|
|
78
|
+
value: 'rename',
|
|
79
|
+
description: 'Rename or move a file or folder',
|
|
80
|
+
action: 'Rename or move a file or folder',
|
|
81
|
+
},
|
|
76
82
|
{
|
|
77
83
|
name: 'Stat',
|
|
78
84
|
value: 'stat',
|
|
@@ -97,7 +103,7 @@ export class Smb2 implements INodeType {
|
|
|
97
103
|
default: '/',
|
|
98
104
|
displayOptions: {
|
|
99
105
|
show: {
|
|
100
|
-
operation: ['stat', 'get', 'put', 'del'],
|
|
106
|
+
operation: ['stat', 'get', 'put', 'del', 'rename'],
|
|
101
107
|
},
|
|
102
108
|
},
|
|
103
109
|
},
|
|
@@ -112,6 +118,33 @@ export class Smb2 implements INodeType {
|
|
|
112
118
|
},
|
|
113
119
|
},
|
|
114
120
|
},
|
|
121
|
+
{
|
|
122
|
+
displayName: 'New Path',
|
|
123
|
+
name: 'newPath',
|
|
124
|
+
type: 'string',
|
|
125
|
+
default: '',
|
|
126
|
+
placeholder: '/folder/newname.txt',
|
|
127
|
+
description: 'New path or name for the renamed/moved file or folder',
|
|
128
|
+
displayOptions: {
|
|
129
|
+
show: {
|
|
130
|
+
operation: ['rename'],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
displayName: 'Overwrite If Exists',
|
|
136
|
+
name: 'overwriteIfExists',
|
|
137
|
+
type: 'boolean',
|
|
138
|
+
default: false,
|
|
139
|
+
description:
|
|
140
|
+
'If the destination path already exists, delete it before renaming. ' +
|
|
141
|
+
'Only works for files — overwriting an existing directory is not supported.',
|
|
142
|
+
displayOptions: {
|
|
143
|
+
show: {
|
|
144
|
+
operation: ['rename'],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
115
148
|
|
|
116
149
|
/* Put options */
|
|
117
150
|
{
|
|
@@ -11,7 +11,13 @@ import { Smb2Credentials, SmbListEntry, SmbStat } from './interfaces';
|
|
|
11
11
|
import { debuglog } from 'util';
|
|
12
12
|
|
|
13
13
|
const debug = debuglog('n8n-nodes-smbclient');
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
// smbclient reports genuine failures as NT_STATUS_* codes (anything other than
|
|
16
|
+
// NT_STATUS_OK). We use this to catch failures that smbclient prints to stderr
|
|
17
|
+
// while still exiting with code 0, without tripping on benign diagnostics such
|
|
18
|
+
// as deprecation notices or the "Domain=[...] OS=[...]" connection banner.
|
|
19
|
+
const SMB_FAILURE_RE = /NT_STATUS_(?!OK\b)[A-Z0-9_]+/;
|
|
20
|
+
|
|
15
21
|
const SMB_ERROR_HINTS: Array<[RegExp, string]> = [
|
|
16
22
|
[/EACCES/i, 'Access Denied - Check your permissions for this file/folder'],
|
|
17
23
|
[/ENOENT/i, 'File/Path Not Found'],
|
|
@@ -74,6 +80,18 @@ export class SmbClientWrapper {
|
|
|
74
80
|
return [hostPart, '-U', userPart, '-g'];
|
|
75
81
|
}
|
|
76
82
|
|
|
83
|
+
private fail(safeCmd: string, detail: string): never {
|
|
84
|
+
const { username, password, domain } = this.auth;
|
|
85
|
+
const safeErr = maskSecrets((detail || '').trim() || 'smbclient command failed', [
|
|
86
|
+
username,
|
|
87
|
+
password,
|
|
88
|
+
domain,
|
|
89
|
+
]);
|
|
90
|
+
// The message must be passed as a string (or via options.message); passing a
|
|
91
|
+
// `{ message }` object as the second arg leaves NodeOperationError.message empty.
|
|
92
|
+
throw new NodeOperationError(this.node, `smbclient failed. cmd="${safeCmd}" stderr="${safeErr}"`);
|
|
93
|
+
}
|
|
94
|
+
|
|
77
95
|
private async runOne(cmd: string): Promise<string> {
|
|
78
96
|
const args = [...this.buildBaseArgs(), '-c', cmd];
|
|
79
97
|
|
|
@@ -82,31 +100,25 @@ export class SmbClientWrapper {
|
|
|
82
100
|
const rawCmd = [this.smbclientPath, ...args].join(' ');
|
|
83
101
|
const safeCmd = maskSecrets(redactCmd(rawCmd), [username, password, domain]);
|
|
84
102
|
|
|
103
|
+
let stdout = '';
|
|
104
|
+
let stderr = '';
|
|
85
105
|
try {
|
|
86
|
-
|
|
106
|
+
({ stdout, stderr } = await execFileAsync(this.smbclientPath, args, {
|
|
87
107
|
maxBuffer: 10 * 1024 * 1024,
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// smbclient sometimes prints warnings to stderr; detect real errors
|
|
91
|
-
if (stderr && /NT_STATUS|Error|failed/i.test(stderr)) {
|
|
92
|
-
const safeErr = maskSecrets(stderr.trim(), [username, password, domain]);
|
|
93
|
-
|
|
94
|
-
throw new NodeOperationError(this.node, {
|
|
95
|
-
message: `smbclient failed. cmd="${safeCmd}" stderr="${safeErr}"`,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return stdout ?? '';
|
|
108
|
+
}));
|
|
100
109
|
} catch (err: any) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
// Non-zero exit code: smbclient genuinely failed.
|
|
111
|
+
this.fail(safeCmd, err?.stderr?.trim?.() || err?.message);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Exit code 0, but smbclient occasionally reports a failed `-c` command on
|
|
115
|
+
// stderr while still exiting cleanly. Only treat real NT_STATUS_* failures as
|
|
116
|
+
// errors; benign warnings (e.g. on a successful delete) must pass through.
|
|
117
|
+
if (stderr && SMB_FAILURE_RE.test(stderr)) {
|
|
118
|
+
this.fail(safeCmd, stderr);
|
|
109
119
|
}
|
|
120
|
+
|
|
121
|
+
return stdout ?? '';
|
|
110
122
|
}
|
|
111
123
|
|
|
112
124
|
async stat(remotePath: string): Promise<SmbStat> {
|
|
@@ -129,7 +141,6 @@ export class SmbClientWrapper {
|
|
|
129
141
|
}
|
|
130
142
|
|
|
131
143
|
async list(dir: string): Promise<SmbListEntry[]> {
|
|
132
|
-
// const out = await this.runOne(`ls "${dir}"`);
|
|
133
144
|
const normalizedDir = (dir ?? '').trim();
|
|
134
145
|
const safeDir = this.escapeSmbArg(normalizedDir);
|
|
135
146
|
|
|
@@ -168,24 +179,6 @@ export class SmbClientWrapper {
|
|
|
168
179
|
} as SmbListEntry;
|
|
169
180
|
}
|
|
170
181
|
|
|
171
|
-
// Alternate pattern seen on some builds: attr|size|date|time|name
|
|
172
|
-
if (parts.length >= 5 && /^\d+$/.test(parts[1])) {
|
|
173
|
-
const attr = parts[0] ?? '';
|
|
174
|
-
const size = Number(parts[1]) || 0;
|
|
175
|
-
const date = parts[2];
|
|
176
|
-
const time = parts[3];
|
|
177
|
-
const name = parts.slice(4).join('|'); // keep any extra pipes in name
|
|
178
|
-
const attributes = attr.split('').filter(Boolean);
|
|
179
|
-
return {
|
|
180
|
-
name,
|
|
181
|
-
size,
|
|
182
|
-
date,
|
|
183
|
-
time,
|
|
184
|
-
attributes,
|
|
185
|
-
isDirectory: attributes.includes('D'),
|
|
186
|
-
} as SmbListEntry;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
182
|
// Fallback if unexpected pipe layout: treat whole line as name
|
|
190
183
|
return {
|
|
191
184
|
name: line,
|
|
@@ -274,6 +267,10 @@ export class SmbClientWrapper {
|
|
|
274
267
|
await this.runOne(`del "${remotePath}"`);
|
|
275
268
|
}
|
|
276
269
|
|
|
270
|
+
async rename(oldPath: string, newPath: string): Promise<void> {
|
|
271
|
+
await this.runOne(`rename "${oldPath}" "${newPath}"`);
|
|
272
|
+
}
|
|
273
|
+
|
|
277
274
|
// No persistent connection to close for smbclient CLI, but keep API parity.
|
|
278
275
|
async close(): Promise<void> {
|
|
279
276
|
/* no-op */
|
|
@@ -117,6 +117,33 @@ const handleDel: OpHandler = async (ctx, i, client) => {
|
|
|
117
117
|
return { json: { remotePath, deleted: true } };
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
+
const NOT_FOUND_STATUSES =
|
|
121
|
+
/NT_STATUS_NO_SUCH_FILE|NT_STATUS_OBJECT_NAME_NOT_FOUND|NT_STATUS_OBJECT_PATH_NOT_FOUND/i;
|
|
122
|
+
|
|
123
|
+
const handleRename: OpHandler = async (ctx, i, client) => {
|
|
124
|
+
const oldPath = str(ctx, i, 'remotePath');
|
|
125
|
+
const newPath = str(ctx, i, 'newPath');
|
|
126
|
+
const overwriteIfExists = ctx.getNodeParameter('overwriteIfExists', i, false) as boolean;
|
|
127
|
+
|
|
128
|
+
let overwritten = false;
|
|
129
|
+
|
|
130
|
+
if (overwriteIfExists) {
|
|
131
|
+
try {
|
|
132
|
+
await client.del(newPath);
|
|
133
|
+
overwritten = true;
|
|
134
|
+
} catch (err: any) {
|
|
135
|
+
// Swallow only "file not found" errors — the destination simply didn't exist.
|
|
136
|
+
// Any other error (e.g. NT_STATUS_ACCESS_DENIED) must propagate.
|
|
137
|
+
if (!NOT_FOUND_STATUSES.test(err?.message ?? '')) {
|
|
138
|
+
throw err;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
await client.rename(oldPath, newPath);
|
|
144
|
+
return { json: { oldPath, newPath, renamed: true, overwritten } };
|
|
145
|
+
};
|
|
146
|
+
|
|
120
147
|
const handlers: Record<Operation, OpHandler> = {
|
|
121
148
|
stat: handleStat,
|
|
122
149
|
list: handleList,
|
|
@@ -125,6 +152,7 @@ const handlers: Record<Operation, OpHandler> = {
|
|
|
125
152
|
mkdir: handleMkdir,
|
|
126
153
|
rmdir: handleRmdir,
|
|
127
154
|
del: handleDel,
|
|
155
|
+
rename: handleRename,
|
|
128
156
|
};
|
|
129
157
|
|
|
130
158
|
export { handlers, buildClient };
|
package/nodes/Smb2/interfaces.ts
CHANGED
|
@@ -30,7 +30,7 @@ type SmbStat = {
|
|
|
30
30
|
attributes?: string[];
|
|
31
31
|
isDirectory?: boolean;
|
|
32
32
|
};
|
|
33
|
-
type Operation = 'stat' | 'list' | 'get' | 'put' | 'mkdir' | 'rmdir' | 'del';
|
|
33
|
+
type Operation = 'stat' | 'list' | 'get' | 'put' | 'mkdir' | 'rmdir' | 'del' | 'rename';
|
|
34
34
|
type OpHandler = (
|
|
35
35
|
ctx: IExecuteFunctions,
|
|
36
36
|
i: number,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-smbclient",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Transfer files via Samba (SMB2) and smbclient package with n8n, some of the base work are based on https://github.com/drudge/n8n-nodes-smb work.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -17,17 +17,11 @@
|
|
|
17
17
|
"engines": {
|
|
18
18
|
"node": ">=20.15"
|
|
19
19
|
},
|
|
20
|
-
"repository":
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"build": "npx rimraf dist && tsc && gulp build:icons",
|
|
24
|
-
"dev": "tsc --watch",
|
|
25
|
-
"format": "prettier nodes credentials --write",
|
|
26
|
-
"lint": "eslint nodes credentials package.json",
|
|
27
|
-
"lintfix": "eslint nodes credentials package.json --fix",
|
|
28
|
-
"prepublishOnly": "npm run build && npm run lint -c .eslintrc.prepublish.js nodes credentials package.json",
|
|
29
|
-
"release": "npx standard-version"
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/JimmyMtl/n8n-nodes-smbclient"
|
|
30
23
|
},
|
|
24
|
+
"main": "index.js",
|
|
31
25
|
"n8n": {
|
|
32
26
|
"n8nNodesApiVersion": 1,
|
|
33
27
|
"credentials": [
|
|
@@ -38,17 +32,17 @@
|
|
|
38
32
|
]
|
|
39
33
|
},
|
|
40
34
|
"devDependencies": {
|
|
41
|
-
"@eslint/compat": "^2.0.
|
|
42
|
-
"@eslint/eslintrc": "^3.3.
|
|
43
|
-
"@eslint/js": "^10.0.
|
|
44
|
-
"@types/node": "^24.
|
|
45
|
-
"@typescript-eslint/parser": "^8.
|
|
46
|
-
"eslint": "^10.
|
|
47
|
-
"eslint-plugin-n8n-nodes-base": "^1.16.
|
|
48
|
-
"globals": "^17.
|
|
35
|
+
"@eslint/compat": "^2.0.5",
|
|
36
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
37
|
+
"@eslint/js": "^10.0.1",
|
|
38
|
+
"@types/node": "^24.12.4",
|
|
39
|
+
"@typescript-eslint/parser": "^8.59.1",
|
|
40
|
+
"eslint": "^10.3.0",
|
|
41
|
+
"eslint-plugin-n8n-nodes-base": "^1.16.6",
|
|
42
|
+
"globals": "^17.6.0",
|
|
49
43
|
"gulp": "^5.0.1",
|
|
50
|
-
"prettier": "^3.
|
|
51
|
-
"typescript": "^
|
|
44
|
+
"prettier": "^3.8.3",
|
|
45
|
+
"typescript": "^6.0.3"
|
|
52
46
|
},
|
|
53
47
|
"peerDependencies": {
|
|
54
48
|
"n8n-workflow": "^1.115.0 || ^2.0.0"
|
|
@@ -58,12 +52,14 @@
|
|
|
58
52
|
},
|
|
59
53
|
"overrides": {
|
|
60
54
|
"form-data": "^4.0.4",
|
|
61
|
-
"axios": "1.
|
|
55
|
+
"axios": "1.17.0"
|
|
62
56
|
},
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "npx rimraf dist && tsc && gulp build:icons",
|
|
59
|
+
"dev": "tsc --watch",
|
|
60
|
+
"format": "prettier nodes credentials --write",
|
|
61
|
+
"lint": "eslint nodes credentials package.json",
|
|
62
|
+
"lintfix": "eslint nodes credentials package.json --fix",
|
|
63
|
+
"release": "npx standard-version"
|
|
68
64
|
}
|
|
69
|
-
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# pnpm settings (moved out of the deprecated `pnpm` field in package.json).
|
|
2
|
+
|
|
3
|
+
# Refuse to resolve/lock any package version published less than this many
|
|
4
|
+
# minutes ago. Mirrors the CI supply-chain policy so `pnpm install` locally
|
|
5
|
+
# picks the same compliant versions CI will accept, instead of the newest
|
|
6
|
+
# release (which may still be inside the cutoff and fail --frozen-lockfile).
|
|
7
|
+
minimumReleaseAge: 1440
|
|
8
|
+
|
|
9
|
+
# Packages allowed to run install scripts.
|
|
10
|
+
# pnpm 10 reads `onlyBuiltDependencies`; pnpm 11 renamed it to `allowBuilds`.
|
|
11
|
+
# We keep both so the install passes regardless of the pnpm version CI uses
|
|
12
|
+
# (the workflows pin `pnpm/action-setup` to `version: latest`).
|
|
13
|
+
onlyBuiltDependencies:
|
|
14
|
+
- eslint-plugin-n8n-nodes-base
|
|
15
|
+
- isolated-vm
|
|
16
|
+
allowBuilds:
|
|
17
|
+
eslint-plugin-n8n-nodes-base: true
|
|
18
|
+
isolated-vm: true
|
package/renovate.json
CHANGED