@tellzm/n8n-nodes 0.1.0-beta.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.
Files changed (42) hide show
  1. package/README.md +32 -0
  2. package/dist/credentials/AxonOAuth2Api.credentials.d.ts +9 -0
  3. package/dist/credentials/AxonOAuth2Api.credentials.js +78 -0
  4. package/dist/nodes/Axon/Axon.node.d.ts +5 -0
  5. package/dist/nodes/Axon/Axon.node.js +101 -0
  6. package/dist/nodes/Axon/descriptions/_index.d.ts +2 -0
  7. package/dist/nodes/Axon/descriptions/_index.js +32 -0
  8. package/dist/nodes/Axon/descriptions/_shared.d.ts +5 -0
  9. package/dist/nodes/Axon/descriptions/_shared.js +30 -0
  10. package/dist/nodes/Axon/descriptions/calendar.d.ts +19 -0
  11. package/dist/nodes/Axon/descriptions/calendar.js +120 -0
  12. package/dist/nodes/Axon/descriptions/data-tables.d.ts +23 -0
  13. package/dist/nodes/Axon/descriptions/data-tables.js +154 -0
  14. package/dist/nodes/Axon/descriptions/form-process.d.ts +23 -0
  15. package/dist/nodes/Axon/descriptions/form-process.js +165 -0
  16. package/dist/nodes/Axon/descriptions/forms.d.ts +15 -0
  17. package/dist/nodes/Axon/descriptions/forms.js +86 -0
  18. package/dist/nodes/Axon/descriptions/pages.d.ts +19 -0
  19. package/dist/nodes/Axon/descriptions/pages.js +120 -0
  20. package/dist/nodes/Axon/descriptions/projects.d.ts +15 -0
  21. package/dist/nodes/Axon/descriptions/projects.js +77 -0
  22. package/dist/nodes/Axon/descriptions/raw.d.ts +7 -0
  23. package/dist/nodes/Axon/descriptions/raw.js +70 -0
  24. package/dist/nodes/Axon/descriptions/routines.d.ts +15 -0
  25. package/dist/nodes/Axon/descriptions/routines.js +105 -0
  26. package/dist/nodes/Axon/descriptions/tasks.d.ts +19 -0
  27. package/dist/nodes/Axon/descriptions/tasks.js +144 -0
  28. package/dist/nodes/Axon/helpers/apiRequest.d.ts +10 -0
  29. package/dist/nodes/Axon/helpers/apiRequest.js +86 -0
  30. package/dist/nodes/Axon/helpers/idempotency.d.ts +2 -0
  31. package/dist/nodes/Axon/helpers/idempotency.js +15 -0
  32. package/dist/nodes/Axon/helpers/paginate.d.ts +2 -0
  33. package/dist/nodes/Axon/helpers/paginate.js +26 -0
  34. package/dist/nodes/Axon/helpers/scopeGuard.d.ts +12 -0
  35. package/dist/nodes/Axon/helpers/scopeGuard.js +24 -0
  36. package/dist/nodes/AxonTrigger/AxonTrigger.node.d.ts +12 -0
  37. package/dist/nodes/AxonTrigger/AxonTrigger.node.js +131 -0
  38. package/dist/nodes/AxonTrigger/eventTypes.d.ts +2 -0
  39. package/dist/nodes/AxonTrigger/eventTypes.js +22 -0
  40. package/dist/nodes/AxonTrigger/helpers/signatureVerify.d.ts +1 -0
  41. package/dist/nodes/AxonTrigger/helpers/signatureVerify.js +20 -0
  42. package/package.json +56 -0
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @axon/n8n-nodes
2
+
3
+ Community n8n nodes for orchestrating the [Axon](https://tellzm.com) platform.
4
+
5
+ Exposes Tasks, Projects, Forms, Form-Processes, Pages, Data Tables, Calendar, and Routines (v1 launch) as first-class n8n actions and triggers. Authentication is OAuth 2.0 + PKCE — same flow Claude.ai uses to act on your Axon workspace.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ cd ~/.n8n/custom
11
+ npm install @axon/n8n-nodes
12
+ ```
13
+
14
+ Restart n8n. You should see **Axon** and **Axon Trigger** in the node palette.
15
+
16
+ ## Quickstart
17
+
18
+ See [docs.tellzm.com/n8n](https://docs.tellzm.com/n8n) for the full guide. Outline:
19
+
20
+ 1. Register an OAuth client with `npx @axon/register-oauth-client --token <admin-token> --redirect-uri <n8n-callback>`.
21
+ 2. Create an "Axon OAuth2 API" credential in n8n, paste the client id, click Connect.
22
+ 3. Complete consent on tellzm.com — pick a workspace + scopes.
23
+ 4. Drop any Axon node, pick a resource + operation, run.
24
+
25
+ ## Modules at v1
26
+
27
+ **Action + Trigger**: Task, Project, Form, Form-Process, Page, Data Table, Calendar, Routine.
28
+ **Patch release**: Space, Whiteboard, Diagram, App.
29
+
30
+ ## License
31
+
32
+ MIT.
@@ -0,0 +1,9 @@
1
+ import type { ICredentialTestRequest, ICredentialType, INodeProperties } from "n8n-workflow";
2
+ export declare class AxonOAuth2Api implements ICredentialType {
3
+ name: string;
4
+ extends: string[];
5
+ displayName: string;
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ test: ICredentialTestRequest;
9
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ // Axon OAuth2 API credential. Extends n8n's built-in oauth2Api credential
3
+ // type and configures the platform's OAuth + PKCE authorization endpoints.
4
+ // The Test Connection button on the credential dialog calls /mcp/whoami to
5
+ // confirm the round-trip succeeded.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AxonOAuth2Api = void 0;
8
+ const SCOPE_DEFAULTS = [
9
+ "tasks.read", "tasks.write",
10
+ "projects.read", "projects.write",
11
+ "routines.read", "routines.write",
12
+ "base.read", "base.write",
13
+ "reports.read", "reports.write",
14
+ "pages.read", "pages.write",
15
+ "forms.read", "forms.write",
16
+ "calendar.read", "calendar.write",
17
+ "apps.read", "apps.write",
18
+ "teams.read", "teams.write",
19
+ "diagrams.read", "diagrams.write",
20
+ "audit.read",
21
+ ].join(" ");
22
+ class AxonOAuth2Api {
23
+ constructor() {
24
+ this.name = "axonOAuth2Api";
25
+ this.extends = ["oAuth2Api"];
26
+ this.displayName = "Axon OAuth2 API";
27
+ this.documentationUrl = "https://docs.tellzm.com/n8n/credentials";
28
+ this.properties = [
29
+ {
30
+ displayName: "Grant Type",
31
+ name: "grantType",
32
+ type: "hidden",
33
+ default: "pkce",
34
+ },
35
+ {
36
+ displayName: "Authorization URL",
37
+ name: "authUrl",
38
+ type: "hidden",
39
+ default: "https://tellzm.com/oauth/authorize",
40
+ },
41
+ {
42
+ displayName: "Access Token URL",
43
+ name: "accessTokenUrl",
44
+ type: "hidden",
45
+ default: "https://api.tellzm.com/oauth/token",
46
+ },
47
+ {
48
+ displayName: "Scope",
49
+ name: "scope",
50
+ type: "string",
51
+ default: SCOPE_DEFAULTS,
52
+ description: "Space-separated scopes from the catalog. Trim to limit credential capabilities.",
53
+ },
54
+ {
55
+ displayName: "Auth URI Query Parameters",
56
+ name: "authQueryParameters",
57
+ type: "hidden",
58
+ default: "resource=https%3A%2F%2Fmcp.tellzm.com%2F",
59
+ },
60
+ {
61
+ displayName: "Authentication",
62
+ name: "authentication",
63
+ type: "hidden",
64
+ default: "header",
65
+ },
66
+ ];
67
+ // Wires the "Test Connection" button: n8n issues a request with the
68
+ // credential's bearer token and considers the credential healthy on 2xx.
69
+ this.test = {
70
+ request: {
71
+ baseURL: "https://api.tellzm.com",
72
+ url: "/mcp/whoami",
73
+ method: "GET",
74
+ },
75
+ };
76
+ }
77
+ }
78
+ exports.AxonOAuth2Api = AxonOAuth2Api;
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from "n8n-workflow";
2
+ export declare class Axon implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ // Main Axon action node. Resource × Operation dropdown that dispatches into
3
+ // per-module handlers. Each module's INodeProperties[] lives in
4
+ // descriptions/<module>.ts; aggregated through descriptions/_index.ts.
5
+ //
6
+ // Operation handler dispatch table: { [resource]: { [operation]: handler } }.
7
+ // Handlers receive (this, itemIndex) and return one or more output items.
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.Axon = void 0;
43
+ const _index_js_1 = require("./descriptions/_index.js");
44
+ const tasks = __importStar(require("./descriptions/tasks.js"));
45
+ const projects = __importStar(require("./descriptions/projects.js"));
46
+ const forms = __importStar(require("./descriptions/forms.js"));
47
+ const formProcess = __importStar(require("./descriptions/form-process.js"));
48
+ const pages = __importStar(require("./descriptions/pages.js"));
49
+ const dataTables = __importStar(require("./descriptions/data-tables.js"));
50
+ const calendar = __importStar(require("./descriptions/calendar.js"));
51
+ const routines = __importStar(require("./descriptions/routines.js"));
52
+ const raw = __importStar(require("./descriptions/raw.js"));
53
+ const DISPATCH = {
54
+ task: tasks.handlers,
55
+ project: projects.handlers,
56
+ form: forms.handlers,
57
+ formProcess: formProcess.handlers,
58
+ page: pages.handlers,
59
+ dataTable: dataTables.handlers,
60
+ calendar: calendar.handlers,
61
+ routine: routines.handlers,
62
+ raw: raw.handlers,
63
+ };
64
+ class Axon {
65
+ constructor() {
66
+ this.description = {
67
+ displayName: "Axon",
68
+ name: "axon",
69
+ icon: "file:axon.svg",
70
+ group: ["transform"],
71
+ version: 1,
72
+ subtitle: '={{$parameter.operation + ": " + $parameter.resource}}',
73
+ description: "Read, create, update, and act on Axon entities.",
74
+ defaults: { name: "Axon" },
75
+ inputs: ["main"],
76
+ outputs: ["main"],
77
+ credentials: [{ name: "axonOAuth2Api", required: true }],
78
+ properties: _index_js_1.axonNodeProperties,
79
+ };
80
+ }
81
+ async execute() {
82
+ const items = this.getInputData();
83
+ const returnData = [];
84
+ for (let i = 0; i < items.length; i++) {
85
+ const resource = this.getNodeParameter("resource", i);
86
+ const operation = this.getNodeParameter("operation", i);
87
+ const resourceHandlers = DISPATCH[resource];
88
+ if (!resourceHandlers) {
89
+ throw new Error(`Unknown resource: ${resource}`);
90
+ }
91
+ const handler = resourceHandlers[operation];
92
+ if (!handler) {
93
+ throw new Error(`Unknown operation "${operation}" for resource "${resource}"`);
94
+ }
95
+ const out = await handler.call(this, i);
96
+ returnData.push(...out);
97
+ }
98
+ return [returnData];
99
+ }
100
+ }
101
+ exports.Axon = Axon;
@@ -0,0 +1,2 @@
1
+ import type { INodeProperties } from "n8n-workflow";
2
+ export declare const axonNodeProperties: INodeProperties[];
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // Barrel for all per-module description files. The main Axon.node.ts
3
+ // imports this single file and uses both `axonNodeProperties` (the
4
+ // concatenated INodeProperties for the n8n UI) and the per-module handler
5
+ // dispatch tables (imported directly from each module file).
6
+ //
7
+ // v1 launch modules: Task, Project, Form, Form-Process, Page, Data Table,
8
+ // Calendar, Routine. Patch release: Space, Whiteboard, Diagram, App.
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.axonNodeProperties = void 0;
11
+ const _shared_js_1 = require("./_shared.js");
12
+ const tasks_js_1 = require("./tasks.js");
13
+ const projects_js_1 = require("./projects.js");
14
+ const forms_js_1 = require("./forms.js");
15
+ const form_process_js_1 = require("./form-process.js");
16
+ const pages_js_1 = require("./pages.js");
17
+ const data_tables_js_1 = require("./data-tables.js");
18
+ const calendar_js_1 = require("./calendar.js");
19
+ const routines_js_1 = require("./routines.js");
20
+ const raw_js_1 = require("./raw.js");
21
+ exports.axonNodeProperties = [
22
+ _shared_js_1.RESOURCE_OPTIONS,
23
+ ...tasks_js_1.properties,
24
+ ...projects_js_1.properties,
25
+ ...forms_js_1.properties,
26
+ ...form_process_js_1.properties,
27
+ ...pages_js_1.properties,
28
+ ...data_tables_js_1.properties,
29
+ ...calendar_js_1.properties,
30
+ ...routines_js_1.properties,
31
+ ...raw_js_1.properties,
32
+ ];
@@ -0,0 +1,5 @@
1
+ import type { INodeProperties } from "n8n-workflow";
2
+ export declare const RESOURCE_OPTIONS: INodeProperties;
3
+ export type ModuleDescription = {
4
+ properties: INodeProperties[];
5
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ // Shared property fragments used by every per-module description file.
3
+ // Keeping these centralized so adding a new module is "register the resource
4
+ // + ship operations" without rebuilding the resource dropdown.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RESOURCE_OPTIONS = void 0;
7
+ // Master resource dropdown. Order is the n8n display order — group by domain.
8
+ exports.RESOURCE_OPTIONS = {
9
+ displayName: "Resource",
10
+ name: "resource",
11
+ type: "options",
12
+ noDataExpression: true,
13
+ default: "task",
14
+ options: [
15
+ // Work
16
+ { name: "Task", value: "task", description: "Tasks within projects, with assignees, due dates, status, priority, tags." },
17
+ { name: "Project", value: "project", description: "Containers for tasks and sections." },
18
+ { name: "Routine", value: "routine", description: "Recurring rituals — daily standups, weekly retros, etc." },
19
+ { name: "Calendar", value: "calendar", description: "Sub-calendars + calendar events." },
20
+ // Knowledge
21
+ { name: "Page", value: "page", description: "Pages with blocks, comments, version history." },
22
+ // Data
23
+ { name: "Form", value: "form", description: "Custom forms + their submissions." },
24
+ { name: "Data Table", value: "dataTable", description: "Bases / data tables with views and records." },
25
+ // Automation
26
+ { name: "Form-Process", value: "formProcess", description: "Multi-stage processes triggered by forms." },
27
+ // Power-user
28
+ { name: "Raw API", value: "raw", description: "Make any HTTP request the credential's scopes allow." },
29
+ ],
30
+ };
@@ -0,0 +1,19 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from "n8n-workflow";
2
+ export declare const properties: INodeProperties[];
3
+ declare function listSubCalendars(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
4
+ declare function getEvent(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
5
+ declare function listEvents(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
6
+ declare function queryRange(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
7
+ declare function createEvent(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
8
+ declare function updateEvent(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
9
+ declare function deleteEvent(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
10
+ export declare const handlers: {
11
+ listSubCalendars: typeof listSubCalendars;
12
+ getEvent: typeof getEvent;
13
+ listEvents: typeof listEvents;
14
+ queryRange: typeof queryRange;
15
+ createEvent: typeof createEvent;
16
+ updateEvent: typeof updateEvent;
17
+ deleteEvent: typeof deleteEvent;
18
+ };
19
+ export {};
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handlers = exports.properties = void 0;
4
+ const apiRequest_js_1 = require("../helpers/apiRequest.js");
5
+ const paginate_js_1 = require("../helpers/paginate.js");
6
+ const scopeGuard_js_1 = require("../helpers/scopeGuard.js");
7
+ const idempotency_js_1 = require("../helpers/idempotency.js");
8
+ const show = (ops) => ({
9
+ show: { resource: ["calendar"], ...(ops ? { operation: ops } : {}) },
10
+ });
11
+ exports.properties = [
12
+ {
13
+ displayName: "Operation",
14
+ name: "operation",
15
+ type: "options",
16
+ noDataExpression: true,
17
+ displayOptions: show(),
18
+ default: "listSubCalendars",
19
+ options: [
20
+ { name: "List Sub-Calendars", value: "listSubCalendars", action: "List sub-calendars" },
21
+ { name: "Get Event", value: "getEvent", action: "Get event" },
22
+ { name: "List Events", value: "listEvents", action: "List events" },
23
+ { name: "Query Range", value: "queryRange", action: "Query date range" },
24
+ { name: "Create Event", value: "createEvent", action: "Create an event" },
25
+ { name: "Update Event", value: "updateEvent", action: "Update an event" },
26
+ { name: "Delete Event", value: "deleteEvent", action: "Delete an event" },
27
+ ],
28
+ },
29
+ {
30
+ displayName: "Sub-Calendar ID",
31
+ name: "subCalendarId",
32
+ type: "string",
33
+ required: true,
34
+ default: "",
35
+ description: "The id of the sub-calendar",
36
+ displayOptions: show(["listEvents", "createEvent"]),
37
+ },
38
+ {
39
+ displayName: "Event ID",
40
+ name: "eventId",
41
+ type: "string",
42
+ required: true,
43
+ default: "",
44
+ description: "The id of the event",
45
+ displayOptions: show(["getEvent", "updateEvent", "deleteEvent"]),
46
+ },
47
+ {
48
+ displayName: "Start (ISO-8601)",
49
+ name: "startAt",
50
+ type: "string",
51
+ required: true,
52
+ default: "",
53
+ description: "Inclusive start",
54
+ displayOptions: show(["queryRange"]),
55
+ },
56
+ {
57
+ displayName: "End (ISO-8601)",
58
+ name: "endAt",
59
+ type: "string",
60
+ required: true,
61
+ default: "",
62
+ description: "Exclusive end",
63
+ displayOptions: show(["queryRange"]),
64
+ },
65
+ {
66
+ displayName: "Event Body (JSON)",
67
+ name: "eventBody",
68
+ type: "json",
69
+ default: '{\n "title": "",\n "startAt": "",\n "endAt": ""\n}',
70
+ required: true,
71
+ description: "Event fields: title, startAt, endAt, location, attendees[], recurrence.",
72
+ displayOptions: show(["createEvent", "updateEvent"]),
73
+ },
74
+ ];
75
+ async function listSubCalendars() {
76
+ await scopeGuard_js_1.assertScope.call(this, "calendar.read");
77
+ const items = await (0, paginate_js_1.paginate)(this, "/sub-calendars");
78
+ return items.map((c) => ({ json: c }));
79
+ }
80
+ async function getEvent(i) {
81
+ await scopeGuard_js_1.assertScope.call(this, "calendar.read");
82
+ const id = this.getNodeParameter("eventId", i);
83
+ const res = (await apiRequest_js_1.apiRequest.call(this, "GET", `/calendar-events/${id}`));
84
+ return [{ json: (res.data ?? res) }];
85
+ }
86
+ async function listEvents(i) {
87
+ await scopeGuard_js_1.assertScope.call(this, "calendar.read");
88
+ const subCalendarId = this.getNodeParameter("subCalendarId", i);
89
+ const items = await (0, paginate_js_1.paginate)(this, `/sub-calendars/${subCalendarId}/events`);
90
+ return items.map((e) => ({ json: e }));
91
+ }
92
+ async function queryRange(i) {
93
+ await scopeGuard_js_1.assertScope.call(this, "calendar.read");
94
+ const startAt = this.getNodeParameter("startAt", i);
95
+ const endAt = this.getNodeParameter("endAt", i);
96
+ const items = await (0, paginate_js_1.paginate)(this, "/calendar/range", { startAt, endAt });
97
+ return items.map((e) => ({ json: e }));
98
+ }
99
+ async function createEvent(i) {
100
+ await scopeGuard_js_1.assertScope.call(this, "calendar.write");
101
+ const subCalendarId = this.getNodeParameter("subCalendarId", i);
102
+ const body = this.getNodeParameter("eventBody", i);
103
+ const key = (0, idempotency_js_1.deriveIdempotencyKey)(this, i, "calendar.create");
104
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", `/sub-calendars/${subCalendarId}/events`, { body, idempotencyKey: key }));
105
+ return [{ json: (res.data ?? res) }];
106
+ }
107
+ async function updateEvent(i) {
108
+ await scopeGuard_js_1.assertScope.call(this, "calendar.write");
109
+ const id = this.getNodeParameter("eventId", i);
110
+ const body = this.getNodeParameter("eventBody", i);
111
+ const res = (await apiRequest_js_1.apiRequest.call(this, "PATCH", `/calendar-events/${id}`, { body }));
112
+ return [{ json: (res.data ?? res) }];
113
+ }
114
+ async function deleteEvent(i) {
115
+ await scopeGuard_js_1.assertScope.call(this, "calendar.write");
116
+ const id = this.getNodeParameter("eventId", i);
117
+ await apiRequest_js_1.apiRequest.call(this, "DELETE", `/calendar-events/${id}`);
118
+ return [{ json: { ok: true, id, deleted: true } }];
119
+ }
120
+ exports.handlers = { listSubCalendars, getEvent, listEvents, queryRange, createEvent, updateEvent, deleteEvent };
@@ -0,0 +1,23 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from "n8n-workflow";
2
+ export declare const properties: INodeProperties[];
3
+ declare function listTables(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
4
+ declare function getTable(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
5
+ declare function listRecords(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
6
+ declare function getRecord(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
7
+ declare function createRecord(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
8
+ declare function updateRecord(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
9
+ declare function upsertRecord(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
10
+ declare function deleteRecord(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
11
+ declare function bulkRecords(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
12
+ export declare const handlers: {
13
+ listTables: typeof listTables;
14
+ getTable: typeof getTable;
15
+ listRecords: typeof listRecords;
16
+ getRecord: typeof getRecord;
17
+ createRecord: typeof createRecord;
18
+ updateRecord: typeof updateRecord;
19
+ upsertRecord: typeof upsertRecord;
20
+ deleteRecord: typeof deleteRecord;
21
+ bulkRecords: typeof bulkRecords;
22
+ };
23
+ export {};
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handlers = exports.properties = void 0;
4
+ const apiRequest_js_1 = require("../helpers/apiRequest.js");
5
+ const paginate_js_1 = require("../helpers/paginate.js");
6
+ const scopeGuard_js_1 = require("../helpers/scopeGuard.js");
7
+ const idempotency_js_1 = require("../helpers/idempotency.js");
8
+ const show = (ops) => ({
9
+ show: { resource: ["dataTable"], ...(ops ? { operation: ops } : {}) },
10
+ });
11
+ exports.properties = [
12
+ {
13
+ displayName: "Operation",
14
+ name: "operation",
15
+ type: "options",
16
+ noDataExpression: true,
17
+ displayOptions: show(),
18
+ default: "listTables",
19
+ options: [
20
+ { name: "List Tables", value: "listTables", action: "List tables" },
21
+ { name: "Get Table", value: "getTable", action: "Get table" },
22
+ { name: "List Records", value: "listRecords", action: "List records" },
23
+ { name: "Get Record", value: "getRecord", action: "Get record" },
24
+ { name: "Create Record", value: "createRecord", action: "Create a record" },
25
+ { name: "Update Record", value: "updateRecord", action: "Update a record" },
26
+ { name: "Upsert Record", value: "upsertRecord", action: "Upsert by primary field" },
27
+ { name: "Delete Record", value: "deleteRecord", action: "Delete a record" },
28
+ { name: "Bulk Records", value: "bulkRecords", action: "Bulk upsert / delete records" },
29
+ ],
30
+ },
31
+ {
32
+ displayName: "Table ID",
33
+ name: "tableId",
34
+ type: "string",
35
+ required: true,
36
+ default: "",
37
+ description: "The id of the data table",
38
+ displayOptions: show([
39
+ "getTable", "listRecords", "getRecord", "createRecord", "updateRecord",
40
+ "upsertRecord", "deleteRecord", "bulkRecords",
41
+ ]),
42
+ },
43
+ {
44
+ displayName: "Record ID",
45
+ name: "recordId",
46
+ type: "string",
47
+ required: true,
48
+ default: "",
49
+ description: "The id of the record",
50
+ displayOptions: show(["getRecord", "updateRecord", "deleteRecord"]),
51
+ },
52
+ {
53
+ displayName: "Record Values (JSON)",
54
+ name: "recordValues",
55
+ type: "json",
56
+ default: "{}",
57
+ required: true,
58
+ description: "Object mapping field keys to values",
59
+ displayOptions: show(["createRecord", "updateRecord", "upsertRecord"]),
60
+ },
61
+ {
62
+ displayName: "Upsert Key Field",
63
+ name: "upsertKeyField",
64
+ type: "string",
65
+ required: true,
66
+ default: "",
67
+ description: "Field name used to look up the existing record (must be unique)",
68
+ displayOptions: show(["upsertRecord"]),
69
+ },
70
+ {
71
+ displayName: "Bulk Operations (JSON Array)",
72
+ name: "bulkOps",
73
+ type: "json",
74
+ default: "[]",
75
+ required: true,
76
+ description: 'Array of operations: [{ op: "create" | "update" | "delete", id?, values? }]',
77
+ displayOptions: show(["bulkRecords"]),
78
+ },
79
+ ];
80
+ async function listTables() {
81
+ await scopeGuard_js_1.assertScope.call(this, "base.read");
82
+ const items = await (0, paginate_js_1.paginate)(this, "/base-tables");
83
+ return items.map((t) => ({ json: t }));
84
+ }
85
+ async function getTable(i) {
86
+ await scopeGuard_js_1.assertScope.call(this, "base.read");
87
+ const id = this.getNodeParameter("tableId", i);
88
+ const res = (await apiRequest_js_1.apiRequest.call(this, "GET", `/base-tables/${id}`));
89
+ return [{ json: (res.data ?? res) }];
90
+ }
91
+ async function listRecords(i) {
92
+ await scopeGuard_js_1.assertScope.call(this, "base.read");
93
+ const tableId = this.getNodeParameter("tableId", i);
94
+ const items = await (0, paginate_js_1.paginate)(this, `/base-tables/${tableId}/records`);
95
+ return items.map((r) => ({ json: r }));
96
+ }
97
+ async function getRecord(i) {
98
+ await scopeGuard_js_1.assertScope.call(this, "base.read");
99
+ const tableId = this.getNodeParameter("tableId", i);
100
+ const recordId = this.getNodeParameter("recordId", i);
101
+ const res = (await apiRequest_js_1.apiRequest.call(this, "GET", `/base-tables/${tableId}/records/${recordId}`));
102
+ return [{ json: (res.data ?? res) }];
103
+ }
104
+ async function createRecord(i) {
105
+ await scopeGuard_js_1.assertScope.call(this, "base.write");
106
+ const tableId = this.getNodeParameter("tableId", i);
107
+ const values = this.getNodeParameter("recordValues", i);
108
+ const key = (0, idempotency_js_1.deriveIdempotencyKey)(this, i, "record.create");
109
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", `/base-tables/${tableId}/records`, { body: { values }, idempotencyKey: key }));
110
+ return [{ json: (res.data ?? res) }];
111
+ }
112
+ async function updateRecord(i) {
113
+ await scopeGuard_js_1.assertScope.call(this, "base.write");
114
+ const tableId = this.getNodeParameter("tableId", i);
115
+ const recordId = this.getNodeParameter("recordId", i);
116
+ const values = this.getNodeParameter("recordValues", i);
117
+ const res = (await apiRequest_js_1.apiRequest.call(this, "PATCH", `/base-tables/${tableId}/records/${recordId}`, { body: { values } }));
118
+ return [{ json: (res.data ?? res) }];
119
+ }
120
+ async function upsertRecord(i) {
121
+ await scopeGuard_js_1.assertScope.call(this, "base.write");
122
+ const tableId = this.getNodeParameter("tableId", i);
123
+ const values = this.getNodeParameter("recordValues", i);
124
+ const keyField = this.getNodeParameter("upsertKeyField", i);
125
+ const idemp = (0, idempotency_js_1.deriveIdempotencyKey)(this, i, "record.upsert");
126
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", `/base-tables/${tableId}/records:upsert`, { body: { keyField, values }, idempotencyKey: idemp }));
127
+ return [{ json: (res.data ?? res) }];
128
+ }
129
+ async function deleteRecord(i) {
130
+ await scopeGuard_js_1.assertScope.call(this, "base.write");
131
+ const tableId = this.getNodeParameter("tableId", i);
132
+ const recordId = this.getNodeParameter("recordId", i);
133
+ await apiRequest_js_1.apiRequest.call(this, "DELETE", `/base-tables/${tableId}/records/${recordId}`);
134
+ return [{ json: { ok: true, id: recordId, deleted: true } }];
135
+ }
136
+ async function bulkRecords(i) {
137
+ await scopeGuard_js_1.assertScope.call(this, "base.write");
138
+ const tableId = this.getNodeParameter("tableId", i);
139
+ const ops = this.getNodeParameter("bulkOps", i);
140
+ // Chunk at 100 ops per request.
141
+ const chunkSize = 100;
142
+ const results = [];
143
+ for (let off = 0; off < ops.length; off += chunkSize) {
144
+ const chunk = ops.slice(off, off + chunkSize);
145
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", `/base-tables/${tableId}/records:bulk`, { body: { ops: chunk } }));
146
+ const arr = (res.data ?? res);
147
+ results.push(...arr);
148
+ }
149
+ return results.map((r) => ({ json: r }));
150
+ }
151
+ exports.handlers = {
152
+ listTables, getTable, listRecords, getRecord,
153
+ createRecord, updateRecord, upsertRecord, deleteRecord, bulkRecords,
154
+ };
@@ -0,0 +1,23 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from "n8n-workflow";
2
+ export declare const properties: INodeProperties[];
3
+ declare function listTemplates(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
4
+ declare function getTemplate(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
5
+ declare function listInstances(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
6
+ declare function getInstance(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
7
+ declare function trigger(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
8
+ declare function fireAction(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
9
+ declare function transition(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
10
+ declare function cloneTemplate(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
11
+ declare function archiveTemplate(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
12
+ export declare const handlers: {
13
+ listTemplates: typeof listTemplates;
14
+ getTemplate: typeof getTemplate;
15
+ listInstances: typeof listInstances;
16
+ getInstance: typeof getInstance;
17
+ trigger: typeof trigger;
18
+ fireAction: typeof fireAction;
19
+ transition: typeof transition;
20
+ cloneTemplate: typeof cloneTemplate;
21
+ archiveTemplate: typeof archiveTemplate;
22
+ };
23
+ export {};