n8n-nodes-nextcloud-ext 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 wdebonne
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,357 @@
1
+ # n8n-nodes-nextcloud
2
+
3
+ [![npm version](https://img.shields.io/npm/v/n8n-nodes-nextcloud.svg)](https://www.npmjs.com/package/n8n-nodes-nextcloud)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5
+ [![n8n community node](https://img.shields.io/badge/n8n-community%20node-orange)](https://docs.n8n.io/integrations/community-nodes/)
6
+
7
+ Nodes n8n communautaires pour **Nextcloud** — l'équivalent self-hosted des nodes Microsoft 365 (OneDrive + Excel) intégrés à n8n.
8
+
9
+ > Gérez vos fichiers Nextcloud et manipulez vos feuilles de calcul (`.xlsx`, `.ods`, `.csv`) — y compris les **tables Excel nommées** — directement depuis vos workflows n8n, sans aucune dépendance au cloud Microsoft.
10
+
11
+ ---
12
+
13
+ ## Nodes inclus
14
+
15
+ | Node | Équivalent Microsoft 365 | Description |
16
+ |---|---|---|
17
+ | **Nextcloud** | OneDrive | Gestion de fichiers et dossiers via WebDAV |
18
+ | **Nextcloud Spreadsheet** | Excel | Lecture/écriture de fichiers tableur + tables nommées |
19
+
20
+ ---
21
+
22
+ ## Prérequis
23
+
24
+ - n8n **≥ 1.0.0**
25
+ - Instance Nextcloud **≥ 20** accessible en HTTPS
26
+ - Node.js **≥ 18.10**
27
+
28
+ ---
29
+
30
+ ## Installation
31
+
32
+ ### Via l'interface n8n (recommandé)
33
+
34
+ 1. Ouvrez n8n → **Settings** → **Community Nodes**
35
+ 2. Cliquez **Install a community node**
36
+ 3. Entrez `n8n-nodes-nextcloud`
37
+ 4. Cliquez **Install**
38
+
39
+ ### Installation manuelle
40
+
41
+ ```bash
42
+ # Dans le répertoire de données n8n
43
+ npm install n8n-nodes-nextcloud
44
+ ```
45
+
46
+ Puis redémarrez n8n.
47
+
48
+ ---
49
+
50
+ ## Configuration des credentials
51
+
52
+ 1. Dans n8n → **Credentials** → **New** → cherchez **Nextcloud API**
53
+ 2. Renseignez les trois champs :
54
+
55
+ | Champ | Description | Exemple |
56
+ |---|---|---|
57
+ | **Server URL** | URL de base de votre Nextcloud (sans slash final) | `https://cloud.mondomaine.fr` |
58
+ | **Username** | Votre identifiant Nextcloud | `admin` |
59
+ | **Password / App Password** | Mot de passe ou mot de passe d'application | `xxxx-xxxx-xxxx-xxxx` |
60
+
61
+ > **Recommandé** : créez un **mot de passe d'application** dans Nextcloud → *Paramètres → Sécurité → Mots de passe d'application* pour ne pas exposer votre mot de passe principal.
62
+
63
+ ---
64
+
65
+ ## Node — Nextcloud
66
+
67
+ Gestion de fichiers, dossiers et partages via l'API WebDAV de Nextcloud.
68
+
69
+ ### Resource : File
70
+
71
+ | Opération | Description |
72
+ |---|---|
73
+ | **List** | Liste les fichiers d'un dossier |
74
+ | **Download** | Télécharge un fichier (sortie binaire) |
75
+ | **Upload** | Envoie un fichier binaire vers Nextcloud |
76
+ | **Delete** | Supprime un fichier |
77
+ | **Move** | Déplace ou renomme un fichier |
78
+ | **Copy** | Copie un fichier vers un autre chemin |
79
+
80
+ **Exemple — List**
81
+ ```
82
+ Folder Path : /Documents/Factures
83
+ ```
84
+ Retourne pour chaque fichier :
85
+ ```json
86
+ {
87
+ "name": "facture-2024-01.pdf",
88
+ "path": "/Documents/Factures/facture-2024-01.pdf",
89
+ "isDirectory": false,
90
+ "size": 245120,
91
+ "contentType": "application/pdf",
92
+ "lastModified": "Mon, 15 Jan 2024 10:30:00 GMT",
93
+ "fileId": "12345"
94
+ }
95
+ ```
96
+
97
+ **Exemple — Upload** (après un node qui produit des données binaires)
98
+ ```
99
+ File Path : /Rapports/rapport-{{ $now.format('yyyy-MM') }}.xlsx
100
+ Binary Property : data
101
+ ```
102
+
103
+ ---
104
+
105
+ ### Resource : Folder
106
+
107
+ | Opération | Description |
108
+ |---|---|
109
+ | **List** | Liste le contenu d'un dossier |
110
+ | **Create** | Crée un dossier |
111
+ | **Delete** | Supprime un dossier et son contenu |
112
+
113
+ ---
114
+
115
+ ### Resource : Share
116
+
117
+ | Opération | Description |
118
+ |---|---|
119
+ | **Create** | Crée un lien de partage public ou vers un utilisateur/groupe |
120
+ | **Delete** | Supprime un partage par son ID |
121
+ | **Get All** | Liste tous vos partages actifs |
122
+
123
+ **Exemple — Créer un lien public protégé par mot de passe**
124
+ ```
125
+ Path : /Documents/rapport-annuel.pdf
126
+ Share Type : Public Link
127
+ Permissions : Read Only (1)
128
+ Password : MonMotDePasse
129
+ Expiry Date : 2025-12-31
130
+ ```
131
+ Retourne :
132
+ ```json
133
+ {
134
+ "data": {
135
+ "id": 42,
136
+ "url": "https://cloud.mondomaine.fr/s/AbCdEfGh",
137
+ "token": "AbCdEfGh"
138
+ }
139
+ }
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Node — Nextcloud Spreadsheet
145
+
146
+ Lit et écrit dans des fichiers tableur stockés sur Nextcloud. Supporte `.xlsx`, `.xls`, `.ods` et `.csv`.
147
+
148
+ **Principe** : le node télécharge le fichier depuis Nextcloud via WebDAV, applique l'opération en mémoire (via [SheetJS](https://sheetjs.com/)), puis ré-uploade le fichier modifié. Aucune donnée n'est stockée en dehors de votre instance.
149
+
150
+ ### Sélection du fichier, de la feuille et de la table
151
+
152
+ Chaque sélecteur propose deux modes :
153
+
154
+ | Mode | Description |
155
+ |---|---|
156
+ | **From List** | Menu déroulant chargé dynamiquement depuis votre Nextcloud |
157
+ | **By Path / By Name** | Saisie libre ou expression n8n (`{{ $json.filePath }}`) |
158
+
159
+ ---
160
+
161
+ ### Resource : Sheet
162
+
163
+ Travaille sur les données d'une feuille de calcul. La **première ligne est traitée comme les en-têtes de colonnes**.
164
+
165
+ | Opération | Description |
166
+ |---|---|
167
+ | **Get Rows** | Retourne toutes les lignes en tant qu'items n8n (filtres disponibles) |
168
+ | **Append Row** | Ajoute une nouvelle ligne à la fin de la feuille |
169
+ | **Update Row** | Modifie une ligne existante par son numéro (1 = première ligne de données) |
170
+ | **Delete Row** | Supprime une ligne par son numéro |
171
+ | **Get Columns** | Retourne la liste des en-têtes de colonnes |
172
+ | **Clear** | Supprime toutes les lignes de données en conservant l'en-tête |
173
+
174
+ **Exemple — Get Rows avec filtre**
175
+ ```
176
+ File : /Tableaux/Arrêtés.xlsx (From list)
177
+ Sheet : Suivi (From list)
178
+
179
+ Filters:
180
+ Column : Statut
181
+ Value : En attente
182
+ ```
183
+ Retourne chaque ligne correspondante :
184
+ ```json
185
+ {
186
+ "N°": "2024-001",
187
+ "Objet": "Arrêté municipal",
188
+ "Date": "2024-01-15",
189
+ "Statut": "En attente"
190
+ }
191
+ ```
192
+
193
+ **Exemple — Append Row**
194
+ ```
195
+ File : /Tableaux/Suivi.xlsx
196
+ Sheet : Feuil1
197
+
198
+ Column Values:
199
+ N° → {{ $json.numero }}
200
+ Objet → {{ $json.objet }}
201
+ Date → {{ $now.format('dd/MM/yyyy') }}
202
+ Statut → Nouveau
203
+ ```
204
+
205
+ **Exemple — Update Row**
206
+ ```
207
+ File : /Tableaux/Suivi.xlsx
208
+ Sheet : Feuil1
209
+ Row Number : {{ $json.rowIndex }}
210
+
211
+ Column Values:
212
+ Statut → Validé
213
+ ```
214
+
215
+ ---
216
+
217
+ ### Resource : Table
218
+
219
+ Travaille sur une **table Excel nommée** (créée via *Insertion → Tableau* dans Excel, ou `Ctrl+T`).
220
+
221
+ Contrairement à la resource Sheet, les opérations Table maintiennent automatiquement la **plage de la table** : Append étend le `ref` de la table, Delete le rétracte. Les filtres automatiques et styles Excel sont préservés.
222
+
223
+ | Opération | Description |
224
+ |---|---|
225
+ | **List** | Liste toutes les tables nommées du classeur (nom, feuille, plage, colonnes, nb de lignes) |
226
+ | **Get Rows** | Retourne les lignes de la table comme items n8n (filtres disponibles) |
227
+ | **Append Row** | Ajoute une ligne à la fin **et étend la plage de la table** |
228
+ | **Update Row** | Modifie une ligne existante par son numéro dans la table |
229
+ | **Delete Row** | Supprime une ligne et **rétracte la plage de la table** |
230
+ | **Get Columns** | Retourne les en-têtes de colonnes de la table |
231
+
232
+ **Exemple — List** (retourne une ligne par table)
233
+ ```json
234
+ {
235
+ "name": "Tableau1",
236
+ "displayName": "Tableau1",
237
+ "sheetName": "Suivi",
238
+ "ref": "A1:E42",
239
+ "columns": ["N°", "Objet", "Date", "Responsable", "Statut"],
240
+ "dataRowCount": 41
241
+ }
242
+ ```
243
+
244
+ **Exemple — Get Rows avec filtre**
245
+ ```
246
+ File : /Tableaux/Arrêtés.xlsx
247
+ Table : Tableau1 (From list : "Tableau1 [Suivi · A1:E42 · 41 rows]")
248
+
249
+ Filters:
250
+ Column : Statut
251
+ Value : Validé
252
+ ```
253
+
254
+ **Exemple — Append Row**
255
+ ```
256
+ File : /Tableaux/Suivi.xlsx
257
+ Table : Tableau1
258
+
259
+ Column Values:
260
+ N° → {{ $json.numero }}
261
+ Objet → Arrêté de voirie
262
+ Date → {{ $now.format('dd/MM/yyyy') }}
263
+ Responsable → {{ $json.agent }}
264
+ Statut → Nouveau
265
+ ```
266
+ → La table passe automatiquement de `A1:E42` à `A1:E43`.
267
+
268
+ ---
269
+
270
+ ### Resource : Workbook
271
+
272
+ Inspecte la structure du classeur sans lire les données.
273
+
274
+ | Opération | Description |
275
+ |---|---|
276
+ | **Get Sheets** | Retourne tous les noms de feuilles du classeur |
277
+ | **Get Tables** | Retourne toutes les tables nommées de toutes les feuilles |
278
+
279
+ ---
280
+
281
+ ## Structure des chemins
282
+
283
+ Tous les chemins sont **relatifs à la racine de votre espace Nextcloud** :
284
+
285
+ ```
286
+ / → racine
287
+ /Documents/ → dossier Documents
288
+ /Documents/rapport.xlsx → fichier rapport.xlsx dans Documents
289
+ /Tableaux/Arrêtés/suivi.xlsx → sous-dossier
290
+ ```
291
+
292
+ ---
293
+
294
+ ## Développement local
295
+
296
+ ```bash
297
+ git clone https://github.com/wdebonne/n8n-nodes-nextcloud-ext.git
298
+ cd n8n-nodes-nextcloud
299
+
300
+ # Installer les dépendances
301
+ # Sur Windows avec proxy SSL (antivirus, Zscaler, etc.) :
302
+ NODE_OPTIONS=--use-system-ca npm install
303
+ # Sinon :
304
+ npm install
305
+
306
+ # Compiler TypeScript → dist/
307
+ npm run build
308
+
309
+ # Vérification des types seule (sans émettre)
310
+ npx tsc --noEmit
311
+
312
+ # Linter
313
+ npm run lint
314
+
315
+ # Mode watch (recompile à chaque sauvegarde)
316
+ npm run dev
317
+ ```
318
+
319
+ ### Tester dans n8n en local
320
+
321
+ ```bash
322
+ # Dans ce répertoire :
323
+ npm run build
324
+ npm link
325
+
326
+ # Dans le répertoire de données n8n :
327
+ npm link n8n-nodes-nextcloud
328
+
329
+ # Redémarrer n8n — le node apparaît dans la palette
330
+ ```
331
+
332
+ ---
333
+
334
+ ## Roadmap
335
+
336
+ - [ ] Support OAuth2 Nextcloud (PKCE)
337
+ - [ ] Node **Nextcloud Talk** (messages, salons)
338
+ - [ ] Node **Nextcloud Contacts** (CardDAV)
339
+ - [ ] Node **Nextcloud Calendar** (CalDAV)
340
+ - [ ] Pagination automatique pour les grands dossiers
341
+ - [ ] Filtre de comparaison avancé (>, <, contains, regex)
342
+
343
+ ---
344
+
345
+ ## Licence
346
+
347
+ [MIT](LICENSE) — © 2025 wdebonne
348
+
349
+ ---
350
+
351
+ ## Liens utiles
352
+
353
+ - [Documentation n8n — Community Nodes](https://docs.n8n.io/integrations/community-nodes/)
354
+ - [Documentation WebDAV Nextcloud](https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html)
355
+ - [API OCS Partage Nextcloud](https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-share-api.html)
356
+ - [SheetJS (xlsx)](https://sheetjs.com/)
357
+ - [Guide de déploiement npm](DEPLOY.md)
@@ -0,0 +1,9 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class NextCloudApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NextCloudApi = void 0;
4
+ class NextCloudApi {
5
+ constructor() {
6
+ this.name = 'nextCloudApi';
7
+ this.displayName = 'Nextcloud API';
8
+ this.documentationUrl = 'https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html';
9
+ this.properties = [
10
+ {
11
+ displayName: 'Server URL',
12
+ name: 'serverUrl',
13
+ type: 'string',
14
+ default: '',
15
+ placeholder: 'https://nextcloud.example.com',
16
+ description: 'The base URL of your Nextcloud instance (no trailing slash)',
17
+ required: true,
18
+ },
19
+ {
20
+ displayName: 'Username',
21
+ name: 'user',
22
+ type: 'string',
23
+ default: '',
24
+ required: true,
25
+ },
26
+ {
27
+ displayName: 'Password / App Password',
28
+ name: 'password',
29
+ type: 'string',
30
+ typeOptions: { password: true },
31
+ default: '',
32
+ description: 'Your Nextcloud password or an app password generated in Settings → Security',
33
+ required: true,
34
+ },
35
+ ];
36
+ this.authenticate = {
37
+ type: 'generic',
38
+ properties: {
39
+ auth: {
40
+ username: '={{$credentials.user}}',
41
+ password: '={{$credentials.password}}',
42
+ },
43
+ },
44
+ };
45
+ this.test = {
46
+ request: {
47
+ baseURL: '={{$credentials.serverUrl}}',
48
+ url: '/ocs/v1.php/cloud/capabilities?format=json',
49
+ headers: {
50
+ 'OCS-APIREQUEST': 'true',
51
+ },
52
+ },
53
+ };
54
+ }
55
+ }
56
+ exports.NextCloudApi = NextCloudApi;
57
+ //# sourceMappingURL=NextCloudApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NextCloudApi.credentials.js","sourceRoot":"","sources":["../../credentials/NextCloudApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,YAAY;IAAzB;QACC,SAAI,GAAG,cAAc,CAAC;QACtB,gBAAW,GAAG,eAAe,CAAC;QAC9B,qBAAgB,GAAG,yFAAyF,CAAC;QAC7G,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,+BAA+B;gBAC5C,WAAW,EAAE,6DAA6D;gBAC1E,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,yBAAyB;gBACtC,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,6EAA6E;gBAC1F,QAAQ,EAAE,IAAI;aACd;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,IAAI,EAAE;oBACL,QAAQ,EAAE,wBAAwB;oBAClC,QAAQ,EAAE,4BAA4B;iBACtC;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,6BAA6B;gBACtC,GAAG,EAAE,4CAA4C;gBACjD,OAAO,EAAE;oBACR,gBAAgB,EAAE,MAAM;iBACxB;aACD;SACD,CAAC;IACH,CAAC;CAAA;AAnDD,oCAmDC"}
@@ -0,0 +1,3 @@
1
+ export { NextCloudApi } from './credentials/NextCloudApi.credentials';
2
+ export { NextCloud } from './nodes/NextCloud/NextCloud.node';
3
+ export { NextCloudSpreadsheet } from './nodes/NextCloudSpreadsheet/NextCloudSpreadsheet.node';
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NextCloudSpreadsheet = exports.NextCloud = exports.NextCloudApi = void 0;
4
+ var NextCloudApi_credentials_1 = require("./credentials/NextCloudApi.credentials");
5
+ Object.defineProperty(exports, "NextCloudApi", { enumerable: true, get: function () { return NextCloudApi_credentials_1.NextCloudApi; } });
6
+ var NextCloud_node_1 = require("./nodes/NextCloud/NextCloud.node");
7
+ Object.defineProperty(exports, "NextCloud", { enumerable: true, get: function () { return NextCloud_node_1.NextCloud; } });
8
+ var NextCloudSpreadsheet_node_1 = require("./nodes/NextCloudSpreadsheet/NextCloudSpreadsheet.node");
9
+ Object.defineProperty(exports, "NextCloudSpreadsheet", { enumerable: true, get: function () { return NextCloudSpreadsheet_node_1.NextCloudSpreadsheet; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,mFAAsE;AAA7D,wHAAA,YAAY,OAAA;AACrB,mEAA6D;AAApD,2GAAA,SAAS,OAAA;AAClB,oGAA8F;AAArF,iIAAA,oBAAoB,OAAA"}
@@ -0,0 +1,10 @@
1
+ import { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class NextCloud implements INodeType {
3
+ description: INodeTypeDescription;
4
+ methods: {
5
+ loadOptions: {
6
+ getFolderFiles(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
7
+ };
8
+ };
9
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
10
+ }