n8n-nodes-datatable-manager 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) 2025 Your Name
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,186 @@
1
+ # n8n-nodes-datatable-manager
2
+
3
+ [![npm version](https://badge.fury.io/js/n8n-nodes-datatable-manager.svg)](https://badge.fury.io/js/n8n-nodes-datatable-manager)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![n8n Community Node](https://img.shields.io/badge/n8n-Community%20Node-ff6d5a)](https://n8n.io)
6
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org)
7
+
8
+ **[Deutsch](#deutsch) | [English](#english)**
9
+
10
+ ---
11
+
12
+ ## Deutsch
13
+
14
+ Ein n8n Community Node zur Verwaltung von internen n8n Data Tables direkt aus Workflows heraus.
15
+
16
+ ### Screenshots
17
+
18
+ <!-- Screenshots hier einfuegen -->
19
+ ![Data Table Manager Node](./screenshots/node-overview.png)
20
+ *Node-Uebersicht im n8n Editor*
21
+
22
+ ![Table Operations](./screenshots/table-operations.png)
23
+ *Tabellen-Operationen*
24
+
25
+ ### Features
26
+
27
+ #### Table Operations (Tabellen-Operationen)
28
+ - **Create** - Neue Tabelle mit Spalten erstellen
29
+ - **Get All** - Alle Tabellen auflisten
30
+ - **Update** - Tabelle umbenennen
31
+ - **Delete** - Tabelle loeschen
32
+
33
+ #### Column Operations (Spalten-Operationen)
34
+ - **Add** - Spalte zu einer Tabelle hinzufuegen
35
+ - **Get All** - Alle Spalten einer Tabelle auflisten
36
+ - **Delete** - Spalte loeschen
37
+ - **Rename** - Spalte umbenennen
38
+
39
+ #### Unterstuetzte Spaltentypen
40
+ - `string` - Text
41
+ - `number` - Zahlen
42
+ - `boolean` - Wahr/Falsch
43
+ - `date` - Datum
44
+
45
+ ### Schnellstart
46
+
47
+ 1. Node installieren (siehe [Installationsanleitung](#installation))
48
+ 2. n8n neu starten
49
+ 3. "Data Table Manager" Node zum Workflow hinzufuegen
50
+ 4. Verbindungsdaten konfigurieren (Base URL, Email, Passwort)
51
+ 5. Gewuenschte Operation auswaehlen
52
+
53
+ ### Installation
54
+
55
+ #### Via npm (empfohlen)
56
+
57
+ ```bash
58
+ npm install n8n-nodes-datatable-manager
59
+ ```
60
+
61
+ #### Via n8n Community Nodes
62
+
63
+ 1. In n8n zu **Settings** > **Community Nodes** navigieren
64
+ 2. **Install** klicken
65
+ 3. `n8n-nodes-datatable-manager` eingeben
66
+ 4. **Install** bestaetigen
67
+
68
+ #### Manuelle Installation
69
+
70
+ Siehe [DOCS_DE.md](./DOCS_DE.md) fuer detaillierte Installationsanweisungen.
71
+
72
+ ### Dokumentation
73
+
74
+ Die vollstaendige deutsche Dokumentation finden Sie in [DOCS_DE.md](./DOCS_DE.md).
75
+
76
+ ---
77
+
78
+ ## English
79
+
80
+ An n8n Community Node for managing internal n8n Data Tables directly from your workflows.
81
+
82
+ ### Screenshots
83
+
84
+ <!-- Add screenshots here -->
85
+ ![Data Table Manager Node](./screenshots/node-overview.png)
86
+ *Node overview in n8n Editor*
87
+
88
+ ![Table Operations](./screenshots/table-operations.png)
89
+ *Table operations*
90
+
91
+ ### Features
92
+
93
+ #### Table Operations
94
+ - **Create** - Create a new table with columns
95
+ - **Get All** - List all tables
96
+ - **Update** - Rename a table
97
+ - **Delete** - Delete a table
98
+
99
+ #### Column Operations
100
+ - **Add** - Add a column to a table
101
+ - **Get All** - List all columns of a table
102
+ - **Delete** - Delete a column
103
+ - **Rename** - Rename a column
104
+
105
+ #### Supported Column Types
106
+ - `string` - Text
107
+ - `number` - Numbers
108
+ - `boolean` - True/False
109
+ - `date` - Date
110
+
111
+ ### Quick Start
112
+
113
+ 1. Install the node (see [Installation](#installation-1))
114
+ 2. Restart n8n
115
+ 3. Add "Data Table Manager" node to your workflow
116
+ 4. Configure connection settings (Base URL, Email, Password)
117
+ 5. Select the desired operation
118
+
119
+ ### Installation
120
+
121
+ #### Via npm (recommended)
122
+
123
+ ```bash
124
+ npm install n8n-nodes-datatable-manager
125
+ ```
126
+
127
+ #### Via n8n Community Nodes
128
+
129
+ 1. Navigate to **Settings** > **Community Nodes** in n8n
130
+ 2. Click **Install**
131
+ 3. Enter `n8n-nodes-datatable-manager`
132
+ 4. Confirm **Install**
133
+
134
+ #### Manual Installation
135
+
136
+ See [DOCS_EN.md](./DOCS_EN.md) for detailed installation instructions.
137
+
138
+ ### Documentation
139
+
140
+ Complete English documentation is available in [DOCS_EN.md](./DOCS_EN.md).
141
+
142
+ ---
143
+
144
+ ## Requirements
145
+
146
+ - n8n version 1.0.0 or higher
147
+ - Node.js 18.0.0 or higher
148
+ - Data Tables feature enabled (`N8N_ENABLED_MODULES=data-table`)
149
+
150
+ ## Important Notes
151
+
152
+ - This node uses the **internal n8n API** which is not officially documented
153
+ - Breaking changes may occur with n8n updates
154
+ - Tested with n8n v1.113+
155
+ - Requires valid n8n login credentials
156
+
157
+ ## Contributing
158
+
159
+ Contributions are welcome! Please feel free to submit a Pull Request.
160
+
161
+ 1. Fork the repository
162
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
163
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
164
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
165
+ 5. Open a Pull Request
166
+
167
+ ## Changelog
168
+
169
+ See [CHANGELOG.md](./CHANGELOG.md) for a list of changes.
170
+
171
+ ## License
172
+
173
+ This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
174
+
175
+ ## Support
176
+
177
+ - [GitHub Issues](https://github.com/your-username/n8n-nodes-datatable-manager/issues)
178
+ - [n8n Community Forum](https://community.n8n.io/)
179
+
180
+ ## Author
181
+
182
+ Your Name - your-email@example.com
183
+
184
+ ---
185
+
186
+ Made with love for the n8n community
@@ -0,0 +1,7 @@
1
+ import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class N8nInternalApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.N8nInternalApi = void 0;
4
+ class N8nInternalApi {
5
+ name = 'n8nInternalApi';
6
+ displayName = 'n8n Internal API';
7
+ documentationUrl = 'https://docs.n8n.io/api/';
8
+ properties = [
9
+ {
10
+ displayName: 'Base URL',
11
+ name: 'baseUrl',
12
+ type: 'string',
13
+ default: 'http://localhost:5678',
14
+ placeholder: 'http://localhost:5678',
15
+ description: 'The base URL of your n8n instance',
16
+ },
17
+ {
18
+ displayName: 'Email',
19
+ name: 'email',
20
+ type: 'string',
21
+ default: '',
22
+ placeholder: 'admin@example.com',
23
+ description: 'Your n8n login email',
24
+ },
25
+ {
26
+ displayName: 'Password',
27
+ name: 'password',
28
+ type: 'string',
29
+ typeOptions: {
30
+ password: true,
31
+ },
32
+ default: '',
33
+ description: 'Your n8n login password',
34
+ },
35
+ ];
36
+ }
37
+ exports.N8nInternalApi = N8nInternalApi;
@@ -0,0 +1,5 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class DataTableManager implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,511 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataTableManager = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ class DataTableManager {
6
+ description = {
7
+ displayName: 'Data Table Manager',
8
+ name: 'dataTableManager',
9
+ icon: 'file:datatable.svg',
10
+ group: ['transform'],
11
+ version: 1,
12
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
13
+ description: 'Manage n8n internal Data Tables (Create, List, Update, Delete)',
14
+ defaults: {
15
+ name: 'Data Table Manager',
16
+ },
17
+ inputs: ['main'],
18
+ outputs: ['main'],
19
+ properties: [
20
+ // ========== CONNECTION SETTINGS ==========
21
+ {
22
+ displayName: 'Base URL',
23
+ name: 'baseUrl',
24
+ type: 'string',
25
+ default: 'http://localhost:5678',
26
+ placeholder: 'http://localhost:5678',
27
+ description: 'The base URL of your n8n instance',
28
+ required: true,
29
+ },
30
+ {
31
+ displayName: 'Email',
32
+ name: 'email',
33
+ type: 'string',
34
+ default: '',
35
+ placeholder: 'admin@example.com',
36
+ description: 'Your n8n login email',
37
+ required: true,
38
+ },
39
+ {
40
+ displayName: 'Password',
41
+ name: 'password',
42
+ type: 'string',
43
+ typeOptions: {
44
+ password: true,
45
+ },
46
+ default: '',
47
+ description: 'Your n8n login password',
48
+ required: true,
49
+ },
50
+ // Resource
51
+ {
52
+ displayName: 'Resource',
53
+ name: 'resource',
54
+ type: 'options',
55
+ noDataExpression: true,
56
+ options: [
57
+ {
58
+ name: 'Table',
59
+ value: 'table',
60
+ },
61
+ {
62
+ name: 'Column',
63
+ value: 'column',
64
+ },
65
+ ],
66
+ default: 'table',
67
+ },
68
+ // ========== TABLE OPERATIONS ==========
69
+ {
70
+ displayName: 'Operation',
71
+ name: 'operation',
72
+ type: 'options',
73
+ noDataExpression: true,
74
+ displayOptions: {
75
+ show: {
76
+ resource: ['table'],
77
+ },
78
+ },
79
+ options: [
80
+ {
81
+ name: 'Create',
82
+ value: 'create',
83
+ description: 'Create a new data table with columns',
84
+ action: 'Create a table',
85
+ },
86
+ {
87
+ name: 'Delete',
88
+ value: 'delete',
89
+ description: 'Delete a data table',
90
+ action: 'Delete a table',
91
+ },
92
+ {
93
+ name: 'Get All',
94
+ value: 'getAll',
95
+ description: 'Get all data tables',
96
+ action: 'Get all tables',
97
+ },
98
+ {
99
+ name: 'Update',
100
+ value: 'update',
101
+ description: 'Update/rename a data table',
102
+ action: 'Update a table',
103
+ },
104
+ ],
105
+ default: 'create',
106
+ },
107
+ // Table Create - Name
108
+ {
109
+ displayName: 'Table Name',
110
+ name: 'tableName',
111
+ type: 'string',
112
+ required: true,
113
+ default: '',
114
+ displayOptions: {
115
+ show: {
116
+ resource: ['table'],
117
+ operation: ['create'],
118
+ },
119
+ },
120
+ description: 'The name of the new data table',
121
+ },
122
+ // Table Create - Columns
123
+ {
124
+ displayName: 'Columns',
125
+ name: 'columns',
126
+ type: 'fixedCollection',
127
+ typeOptions: {
128
+ multipleValues: true,
129
+ },
130
+ default: {},
131
+ displayOptions: {
132
+ show: {
133
+ resource: ['table'],
134
+ operation: ['create'],
135
+ },
136
+ },
137
+ options: [
138
+ {
139
+ name: 'columnValues',
140
+ displayName: 'Column',
141
+ values: [
142
+ {
143
+ displayName: 'Column Name',
144
+ name: 'name',
145
+ type: 'string',
146
+ default: '',
147
+ description: 'Name of the column',
148
+ },
149
+ {
150
+ displayName: 'Column Type',
151
+ name: 'type',
152
+ type: 'options',
153
+ options: [
154
+ {
155
+ name: 'String',
156
+ value: 'string',
157
+ },
158
+ {
159
+ name: 'Number',
160
+ value: 'number',
161
+ },
162
+ {
163
+ name: 'Boolean',
164
+ value: 'boolean',
165
+ },
166
+ {
167
+ name: 'Date',
168
+ value: 'date',
169
+ },
170
+ ],
171
+ default: 'string',
172
+ description: 'Data type of the column',
173
+ },
174
+ ],
175
+ },
176
+ ],
177
+ description: 'Columns to create in the table',
178
+ },
179
+ // Table ID (for update/delete)
180
+ {
181
+ displayName: 'Table ID',
182
+ name: 'tableId',
183
+ type: 'string',
184
+ required: true,
185
+ default: '',
186
+ displayOptions: {
187
+ show: {
188
+ resource: ['table'],
189
+ operation: ['update', 'delete'],
190
+ },
191
+ },
192
+ description: 'The ID of the data table',
193
+ },
194
+ // Table Update - New Name
195
+ {
196
+ displayName: 'New Table Name',
197
+ name: 'newTableName',
198
+ type: 'string',
199
+ required: true,
200
+ default: '',
201
+ displayOptions: {
202
+ show: {
203
+ resource: ['table'],
204
+ operation: ['update'],
205
+ },
206
+ },
207
+ description: 'The new name for the data table',
208
+ },
209
+ // ========== COLUMN OPERATIONS ==========
210
+ {
211
+ displayName: 'Operation',
212
+ name: 'operation',
213
+ type: 'options',
214
+ noDataExpression: true,
215
+ displayOptions: {
216
+ show: {
217
+ resource: ['column'],
218
+ },
219
+ },
220
+ options: [
221
+ {
222
+ name: 'Add',
223
+ value: 'add',
224
+ description: 'Add a column to a table',
225
+ action: 'Add a column',
226
+ },
227
+ {
228
+ name: 'Delete',
229
+ value: 'delete',
230
+ description: 'Delete a column from a table',
231
+ action: 'Delete a column',
232
+ },
233
+ {
234
+ name: 'Get All',
235
+ value: 'getAll',
236
+ description: 'Get all columns of a table',
237
+ action: 'Get all columns',
238
+ },
239
+ {
240
+ name: 'Rename',
241
+ value: 'rename',
242
+ description: 'Rename a column',
243
+ action: 'Rename a column',
244
+ },
245
+ ],
246
+ default: 'add',
247
+ },
248
+ // Column - Table ID
249
+ {
250
+ displayName: 'Table ID',
251
+ name: 'tableId',
252
+ type: 'string',
253
+ required: true,
254
+ default: '',
255
+ displayOptions: {
256
+ show: {
257
+ resource: ['column'],
258
+ },
259
+ },
260
+ description: 'The ID of the data table',
261
+ },
262
+ // Column Add - Name
263
+ {
264
+ displayName: 'Column Name',
265
+ name: 'columnName',
266
+ type: 'string',
267
+ required: true,
268
+ default: '',
269
+ displayOptions: {
270
+ show: {
271
+ resource: ['column'],
272
+ operation: ['add'],
273
+ },
274
+ },
275
+ description: 'Name of the new column',
276
+ },
277
+ // Column Add - Type
278
+ {
279
+ displayName: 'Column Type',
280
+ name: 'columnType',
281
+ type: 'options',
282
+ required: true,
283
+ options: [
284
+ {
285
+ name: 'String',
286
+ value: 'string',
287
+ },
288
+ {
289
+ name: 'Number',
290
+ value: 'number',
291
+ },
292
+ {
293
+ name: 'Boolean',
294
+ value: 'boolean',
295
+ },
296
+ {
297
+ name: 'Date',
298
+ value: 'date',
299
+ },
300
+ ],
301
+ default: 'string',
302
+ displayOptions: {
303
+ show: {
304
+ resource: ['column'],
305
+ operation: ['add'],
306
+ },
307
+ },
308
+ description: 'Data type of the column',
309
+ },
310
+ // Column ID (for delete/rename)
311
+ {
312
+ displayName: 'Column ID',
313
+ name: 'columnId',
314
+ type: 'string',
315
+ required: true,
316
+ default: '',
317
+ displayOptions: {
318
+ show: {
319
+ resource: ['column'],
320
+ operation: ['delete', 'rename'],
321
+ },
322
+ },
323
+ description: 'The ID of the column',
324
+ },
325
+ // Column Rename - New Name
326
+ {
327
+ displayName: 'New Column Name',
328
+ name: 'newColumnName',
329
+ type: 'string',
330
+ required: true,
331
+ default: '',
332
+ displayOptions: {
333
+ show: {
334
+ resource: ['column'],
335
+ operation: ['rename'],
336
+ },
337
+ },
338
+ description: 'The new name for the column',
339
+ },
340
+ ],
341
+ };
342
+ async execute() {
343
+ const items = this.getInputData();
344
+ const returnData = [];
345
+ const resource = this.getNodeParameter('resource', 0);
346
+ const operation = this.getNodeParameter('operation', 0);
347
+ // Get connection settings
348
+ const baseUrl = this.getNodeParameter('baseUrl', 0).replace(/\/$/, '');
349
+ const email = this.getNodeParameter('email', 0);
350
+ const password = this.getNodeParameter('password', 0);
351
+ // Login to n8n and get session cookie
352
+ let sessionCookie = '';
353
+ try {
354
+ const loginResponse = await this.helpers.httpRequest({
355
+ method: 'POST',
356
+ url: `${baseUrl}/rest/login`,
357
+ body: { emailOrLdapLoginId: email, password },
358
+ json: true,
359
+ skipSslCertificateValidation: true,
360
+ returnFullResponse: true,
361
+ });
362
+ // Extract session cookie from response headers
363
+ const setCookieHeader = loginResponse.headers?.['set-cookie'];
364
+ if (setCookieHeader) {
365
+ const cookies = Array.isArray(setCookieHeader) ? setCookieHeader : [setCookieHeader];
366
+ sessionCookie = cookies
367
+ .map((c) => c.split(';')[0])
368
+ .join('; ');
369
+ }
370
+ }
371
+ catch (error) {
372
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to login to n8n: ${error.message}. Please check your credentials.`);
373
+ }
374
+ // Get Project ID from API (required for data-tables endpoint)
375
+ let projectId = '';
376
+ try {
377
+ const projectsResponse = await this.helpers.httpRequest({
378
+ method: 'GET',
379
+ url: `${baseUrl}/rest/projects`,
380
+ json: true,
381
+ skipSslCertificateValidation: true,
382
+ headers: {
383
+ Cookie: sessionCookie,
384
+ },
385
+ });
386
+ // Find personal project or use first available
387
+ let projects = projectsResponse;
388
+ if (projectsResponse?.data) {
389
+ projects = projectsResponse.data;
390
+ }
391
+ if (Array.isArray(projects) && projects.length > 0) {
392
+ const personalProject = projects.find((p) => p.type === 'personal' || p.name?.toLowerCase().includes('personal'));
393
+ projectId = personalProject?.id || projects[0]?.id;
394
+ }
395
+ }
396
+ catch (error) {
397
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to get projects: ${error.message}`);
398
+ }
399
+ if (!projectId) {
400
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No project found. Please create a project in n8n first.');
401
+ }
402
+ // Build the API URL - n8n uses /rest/projects/:projectId/data-tables
403
+ const apiBaseUrl = `${baseUrl}/rest/projects/${projectId}/data-tables`;
404
+ // Helper function to make internal API requests with session cookie
405
+ const makeInternalRequest = async (method, url, body) => {
406
+ const requestOptions = {
407
+ method,
408
+ url,
409
+ json: true,
410
+ skipSslCertificateValidation: true,
411
+ headers: {
412
+ 'Content-Type': 'application/json',
413
+ Cookie: sessionCookie,
414
+ },
415
+ };
416
+ if (body) {
417
+ requestOptions.body = body;
418
+ }
419
+ try {
420
+ return await this.helpers.httpRequest(requestOptions);
421
+ }
422
+ catch (error) {
423
+ const errorMessage = error?.message || String(error);
424
+ throw new Error(`Data Tables API request failed. ` +
425
+ `URL: ${url}. ` +
426
+ `Error: ${errorMessage}.`);
427
+ }
428
+ };
429
+ for (let i = 0; i < items.length; i++) {
430
+ try {
431
+ let responseData;
432
+ if (resource === 'table') {
433
+ if (operation === 'create') {
434
+ const tableName = this.getNodeParameter('tableName', i);
435
+ const columnsData = this.getNodeParameter('columns', i);
436
+ const columns = columnsData.columnValues || [];
437
+ responseData = await makeInternalRequest('POST', apiBaseUrl, {
438
+ name: tableName,
439
+ columns: columns.map((col, index) => ({
440
+ name: col.name,
441
+ type: col.type,
442
+ index,
443
+ })),
444
+ });
445
+ }
446
+ else if (operation === 'getAll') {
447
+ responseData = await makeInternalRequest('GET', apiBaseUrl);
448
+ }
449
+ else if (operation === 'update') {
450
+ const tableId = this.getNodeParameter('tableId', i);
451
+ const newTableName = this.getNodeParameter('newTableName', i);
452
+ responseData = await makeInternalRequest('PATCH', `${apiBaseUrl}/${tableId}`, {
453
+ name: newTableName,
454
+ });
455
+ }
456
+ else if (operation === 'delete') {
457
+ const tableId = this.getNodeParameter('tableId', i);
458
+ await makeInternalRequest('DELETE', `${apiBaseUrl}/${tableId}`);
459
+ responseData = { success: true, deletedTableId: tableId };
460
+ }
461
+ }
462
+ else if (resource === 'column') {
463
+ const tableId = this.getNodeParameter('tableId', i);
464
+ if (operation === 'add') {
465
+ const columnName = this.getNodeParameter('columnName', i);
466
+ const columnType = this.getNodeParameter('columnType', i);
467
+ responseData = await makeInternalRequest('POST', `${apiBaseUrl}/${tableId}/columns`, {
468
+ name: columnName,
469
+ type: columnType,
470
+ });
471
+ }
472
+ else if (operation === 'getAll') {
473
+ responseData = await makeInternalRequest('GET', `${apiBaseUrl}/${tableId}/columns`);
474
+ }
475
+ else if (operation === 'delete') {
476
+ const columnId = this.getNodeParameter('columnId', i);
477
+ await makeInternalRequest('DELETE', `${apiBaseUrl}/${tableId}/columns/${columnId}`);
478
+ responseData = { success: true, deletedColumnId: columnId };
479
+ }
480
+ else if (operation === 'rename') {
481
+ const columnId = this.getNodeParameter('columnId', i);
482
+ const newColumnName = this.getNodeParameter('newColumnName', i);
483
+ responseData = await makeInternalRequest('PATCH', `${apiBaseUrl}/${tableId}/columns/${columnId}/rename`, {
484
+ name: newColumnName,
485
+ });
486
+ }
487
+ }
488
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
489
+ returnData.push(...executionData);
490
+ }
491
+ catch (error) {
492
+ const errorMessage = error instanceof Error ? error.message : String(error);
493
+ if (this.continueOnFail()) {
494
+ returnData.push({
495
+ json: {
496
+ error: errorMessage,
497
+ },
498
+ pairedItem: { item: i },
499
+ });
500
+ continue;
501
+ }
502
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), errorMessage, {
503
+ itemIndex: i,
504
+ description: `Error during ${resource} ${operation}: ${errorMessage}`,
505
+ });
506
+ }
507
+ }
508
+ return [returnData];
509
+ }
510
+ }
511
+ exports.DataTableManager = DataTableManager;
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2" fill="#ff6d5a" stroke="#ff6d5a"/>
3
+ <line x1="3" y1="9" x2="21" y2="9" stroke="white"/>
4
+ <line x1="3" y1="15" x2="21" y2="15" stroke="white"/>
5
+ <line x1="9" y1="3" x2="9" y2="21" stroke="white"/>
6
+ <line x1="15" y1="3" x2="15" y2="21" stroke="white"/>
7
+ </svg>
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ const { DataTableManager } = require('./dist/nodes/DataTableManager/DataTableManager.node');
2
+
3
+ module.exports = {
4
+ DataTableManager,
5
+ };
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "n8n-nodes-datatable-manager",
3
+ "version": "1.0.0",
4
+ "description": "n8n Community Node to manage internal Data Tables - Create, List, Update, Delete tables and columns",
5
+ "keywords": [
6
+ "n8n-community-node-package",
7
+ "n8n",
8
+ "n8n-node",
9
+ "datatable",
10
+ "data-table",
11
+ "database",
12
+ "table-management",
13
+ "automation",
14
+ "workflow"
15
+ ],
16
+ "license": "MIT",
17
+ "homepage": "https://github.com/your-username/n8n-nodes-datatable-manager#readme",
18
+ "author": {
19
+ "name": "Thomas Braun",
20
+ "email": "thomas.braun.web@googlemail.com"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/thomasbraun2014/n8n-nodes-datatable-manager.git"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/thomasbraun2014/n8n-nodes-datatable-manager/issues"
28
+ },
29
+ "engines": {
30
+ "node": ">=18.0.0"
31
+ },
32
+ "main": "index.js",
33
+ "scripts": {
34
+ "build": "tsc && gulp build:icons",
35
+ "dev": "tsc --watch",
36
+ "format": "prettier nodes --write",
37
+ "lint": "eslint nodes --ext .ts",
38
+ "lintfix": "eslint nodes --ext .ts --fix",
39
+ "prepublishOnly": "npm run build",
40
+ "test": "echo \"No tests specified\" && exit 0"
41
+ },
42
+ "files": [
43
+ "dist"
44
+ ],
45
+ "n8n": {
46
+ "n8nNodesApiVersion": 1,
47
+ "nodes": [
48
+ "dist/nodes/DataTableManager/DataTableManager.node.js"
49
+ ]
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^20.10.0",
53
+ "eslint": "^8.56.0",
54
+ "gulp": "^4.0.2",
55
+ "n8n-workflow": "^1.0.0",
56
+ "prettier": "^3.1.0",
57
+ "typescript": "^5.3.0"
58
+ },
59
+ "peerDependencies": {
60
+ "n8n-workflow": "*"
61
+ }
62
+ }