@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
@@ -0,0 +1,165 @@
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: ["formProcess"], ...(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: "listTemplates",
19
+ options: [
20
+ // Reads
21
+ { name: "List Templates", value: "listTemplates", action: "List templates" },
22
+ { name: "Get Template", value: "getTemplate", action: "Get template" },
23
+ { name: "List Instances", value: "listInstances", action: "List instances" },
24
+ { name: "Get Instance", value: "getInstance", action: "Get instance" },
25
+ // Native verbs
26
+ { name: "Trigger", value: "trigger", description: "Fire a new form-process instance from a published template", action: "Trigger an instance" },
27
+ { name: "Fire Action", value: "fireAction", description: "Advance / approve / reject / cancel a stage", action: "Fire a stage action" },
28
+ { name: "Transition", value: "transition", description: "Admin direct status set", action: "Transition instance status" },
29
+ { name: "Clone Template", value: "cloneTemplate", description: "Clone a template into a new draft", action: "Clone a template" },
30
+ { name: "Archive Template", value: "archiveTemplate", description: "Mark a template as archived", action: "Archive a template" },
31
+ ],
32
+ },
33
+ {
34
+ displayName: "Template ID",
35
+ name: "templateId",
36
+ type: "string",
37
+ required: true,
38
+ default: "",
39
+ description: "The id of the form-process template",
40
+ displayOptions: show(["getTemplate", "listInstances", "trigger", "cloneTemplate", "archiveTemplate"]),
41
+ },
42
+ {
43
+ displayName: "Instance ID",
44
+ name: "instanceId",
45
+ type: "string",
46
+ required: true,
47
+ default: "",
48
+ description: "The id of the form-process instance",
49
+ displayOptions: show(["getInstance", "fireAction", "transition"]),
50
+ },
51
+ {
52
+ displayName: "Trigger Payload (JSON)",
53
+ name: "triggerPayload",
54
+ type: "json",
55
+ default: "{}",
56
+ required: true,
57
+ description: "Field values for the form that triggers this process",
58
+ displayOptions: show(["trigger"]),
59
+ },
60
+ {
61
+ displayName: "Action",
62
+ name: "stageAction",
63
+ type: "options",
64
+ required: true,
65
+ default: "approve",
66
+ description: "Which stage action to fire on the current node",
67
+ options: [
68
+ { name: "Approve / Complete", value: "approve" },
69
+ { name: "Reject", value: "reject" },
70
+ { name: "Cancel", value: "cancel" },
71
+ { name: "Request", value: "request" },
72
+ { name: "Review", value: "review" },
73
+ ],
74
+ displayOptions: show(["fireAction"]),
75
+ },
76
+ {
77
+ displayName: "Action Note (optional)",
78
+ name: "actionNote",
79
+ type: "string",
80
+ default: "",
81
+ description: "Optional note attached to the action",
82
+ displayOptions: show(["fireAction"]),
83
+ },
84
+ {
85
+ displayName: "New Status",
86
+ name: "newStatus",
87
+ type: "options",
88
+ required: true,
89
+ default: "running",
90
+ description: "Status to set on the instance (admin override)",
91
+ options: [
92
+ { name: "Running", value: "running" },
93
+ { name: "Completed", value: "completed" },
94
+ { name: "Rejected", value: "rejected" },
95
+ { name: "Cancelled", value: "cancelled" },
96
+ ],
97
+ displayOptions: show(["transition"]),
98
+ },
99
+ ];
100
+ async function listTemplates() {
101
+ await scopeGuard_js_1.assertScope.call(this, "processes.read");
102
+ const items = await (0, paginate_js_1.paginate)(this, "/form-process-templates");
103
+ return items.map((t) => ({ json: t }));
104
+ }
105
+ async function getTemplate(i) {
106
+ await scopeGuard_js_1.assertScope.call(this, "processes.read");
107
+ const id = this.getNodeParameter("templateId", i);
108
+ const res = (await apiRequest_js_1.apiRequest.call(this, "GET", `/form-process-templates/${id}`));
109
+ return [{ json: (res.data ?? res) }];
110
+ }
111
+ async function listInstances(i) {
112
+ await scopeGuard_js_1.assertScope.call(this, "processes.read");
113
+ const templateId = this.getNodeParameter("templateId", i, "");
114
+ const qs = templateId ? { templateId } : {};
115
+ const items = await (0, paginate_js_1.paginate)(this, "/form-process-instances", qs);
116
+ return items.map((t) => ({ json: t }));
117
+ }
118
+ async function getInstance(i) {
119
+ await scopeGuard_js_1.assertScope.call(this, "processes.read");
120
+ const id = this.getNodeParameter("instanceId", i);
121
+ const res = (await apiRequest_js_1.apiRequest.call(this, "GET", `/form-process-instances/${id}`));
122
+ return [{ json: (res.data ?? res) }];
123
+ }
124
+ async function trigger(i) {
125
+ await scopeGuard_js_1.assertScope.call(this, "processes.write");
126
+ const templateId = this.getNodeParameter("templateId", i);
127
+ const payload = this.getNodeParameter("triggerPayload", i);
128
+ const key = (0, idempotency_js_1.deriveIdempotencyKey)(this, i, "process.trigger");
129
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", `/form-process-templates/${templateId}/trigger`, { body: { payload }, idempotencyKey: key }));
130
+ return [{ json: (res.data ?? res) }];
131
+ }
132
+ async function fireAction(i) {
133
+ await scopeGuard_js_1.assertScope.call(this, "processes.write");
134
+ const instanceId = this.getNodeParameter("instanceId", i);
135
+ const action = this.getNodeParameter("stageAction", i);
136
+ const note = this.getNodeParameter("actionNote", i, "");
137
+ const body = { action };
138
+ if (note)
139
+ body.note = note;
140
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", `/form-process-instances/${instanceId}/actions`, { body }));
141
+ return [{ json: (res.data ?? res) }];
142
+ }
143
+ async function transition(i) {
144
+ await scopeGuard_js_1.assertScope.call(this, "processes.write");
145
+ const instanceId = this.getNodeParameter("instanceId", i);
146
+ const newStatus = this.getNodeParameter("newStatus", i);
147
+ const res = (await apiRequest_js_1.apiRequest.call(this, "PATCH", `/form-process-instances/${instanceId}/status`, { body: { status: newStatus } }));
148
+ return [{ json: (res.data ?? res) }];
149
+ }
150
+ async function cloneTemplate(i) {
151
+ await scopeGuard_js_1.assertScope.call(this, "processes.write");
152
+ const templateId = this.getNodeParameter("templateId", i);
153
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", `/form-process-templates/${templateId}/clone`));
154
+ return [{ json: (res.data ?? res) }];
155
+ }
156
+ async function archiveTemplate(i) {
157
+ await scopeGuard_js_1.assertScope.call(this, "processes.write");
158
+ const templateId = this.getNodeParameter("templateId", i);
159
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", `/form-process-templates/${templateId}/archive`));
160
+ return [{ json: (res.data ?? res) }];
161
+ }
162
+ exports.handlers = {
163
+ listTemplates, getTemplate, listInstances, getInstance,
164
+ trigger, fireAction, transition, cloneTemplate, archiveTemplate,
165
+ };
@@ -0,0 +1,15 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from "n8n-workflow";
2
+ export declare const properties: INodeProperties[];
3
+ declare function get(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
4
+ declare function list(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
5
+ declare function listSubmissions(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
6
+ declare function submit(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
7
+ declare function deleteSubmission(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
8
+ export declare const handlers: {
9
+ get: typeof get;
10
+ list: typeof list;
11
+ listSubmissions: typeof listSubmissions;
12
+ submit: typeof submit;
13
+ deleteSubmission: typeof deleteSubmission;
14
+ };
15
+ export {};
@@ -0,0 +1,86 @@
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: ["form"], ...(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: "list",
19
+ options: [
20
+ { name: "Get", value: "get", action: "Get a form" },
21
+ { name: "List", value: "list", action: "List forms" },
22
+ { name: "List Submissions", value: "listSubmissions", action: "List form submissions" },
23
+ { name: "Submit", value: "submit", action: "Server-side submit a form" },
24
+ { name: "Delete Submission", value: "deleteSubmission", action: "Delete a submission" },
25
+ ],
26
+ },
27
+ {
28
+ displayName: "Form ID",
29
+ name: "formId",
30
+ type: "string",
31
+ required: true,
32
+ default: "",
33
+ description: "The id of the form",
34
+ displayOptions: show(["get", "listSubmissions", "submit"]),
35
+ },
36
+ {
37
+ displayName: "Submission ID",
38
+ name: "submissionId",
39
+ type: "string",
40
+ required: true,
41
+ default: "",
42
+ description: "The id of the submission",
43
+ displayOptions: show(["deleteSubmission"]),
44
+ },
45
+ {
46
+ displayName: "Submission Values (JSON)",
47
+ name: "submissionValues",
48
+ type: "json",
49
+ default: "{}",
50
+ required: true,
51
+ description: "Object mapping form field keys to values, e.g. { name: 'Alice', amount: 42 }",
52
+ displayOptions: show(["submit"]),
53
+ },
54
+ ];
55
+ async function get(i) {
56
+ await scopeGuard_js_1.assertScope.call(this, "forms.read");
57
+ const id = this.getNodeParameter("formId", i);
58
+ const res = (await apiRequest_js_1.apiRequest.call(this, "GET", `/forms/${id}`));
59
+ return [{ json: (res.data ?? res) }];
60
+ }
61
+ async function list() {
62
+ await scopeGuard_js_1.assertScope.call(this, "forms.read");
63
+ const items = await (0, paginate_js_1.paginate)(this, "/forms");
64
+ return items.map((f) => ({ json: f }));
65
+ }
66
+ async function listSubmissions(i) {
67
+ await scopeGuard_js_1.assertScope.call(this, "forms.read");
68
+ const formId = this.getNodeParameter("formId", i);
69
+ const items = await (0, paginate_js_1.paginate)(this, `/forms/${formId}/submissions`);
70
+ return items.map((s) => ({ json: s }));
71
+ }
72
+ async function submit(i) {
73
+ await scopeGuard_js_1.assertScope.call(this, "forms.write");
74
+ const formId = this.getNodeParameter("formId", i);
75
+ const values = this.getNodeParameter("submissionValues", i);
76
+ const key = (0, idempotency_js_1.deriveIdempotencyKey)(this, i, "form.submit");
77
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", `/forms/${formId}/submissions`, { body: { values }, idempotencyKey: key }));
78
+ return [{ json: (res.data ?? res) }];
79
+ }
80
+ async function deleteSubmission(i) {
81
+ await scopeGuard_js_1.assertScope.call(this, "forms.write");
82
+ const id = this.getNodeParameter("submissionId", i);
83
+ await apiRequest_js_1.apiRequest.call(this, "DELETE", `/form-submissions/${id}`);
84
+ return [{ json: { ok: true, id, deleted: true } }];
85
+ }
86
+ exports.handlers = { get, list, listSubmissions, submit, deleteSubmission };
@@ -0,0 +1,19 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from "n8n-workflow";
2
+ export declare const properties: INodeProperties[];
3
+ declare function get(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
4
+ declare function list(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
5
+ declare function search(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
6
+ declare function create(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
7
+ declare function update(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
8
+ declare function del(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
9
+ declare function appendBlocks(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
10
+ export declare const handlers: {
11
+ get: typeof get;
12
+ list: typeof list;
13
+ search: typeof search;
14
+ create: typeof create;
15
+ update: typeof update;
16
+ delete: typeof del;
17
+ appendBlocks: typeof appendBlocks;
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: ["page"], ...(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: "list",
19
+ options: [
20
+ { name: "Get", value: "get", action: "Get a page" },
21
+ { name: "List", value: "list", action: "List pages" },
22
+ { name: "Search", value: "search", action: "Search pages" },
23
+ { name: "Create", value: "create", action: "Create a page" },
24
+ { name: "Update", value: "update", action: "Update a page" },
25
+ { name: "Delete", value: "delete", action: "Soft-delete a page" },
26
+ { name: "Append Blocks", value: "appendBlocks", action: "Append blocks to a page" },
27
+ ],
28
+ },
29
+ {
30
+ displayName: "Page ID",
31
+ name: "pageId",
32
+ type: "string",
33
+ required: true,
34
+ default: "",
35
+ description: "The id of the page",
36
+ displayOptions: show(["get", "update", "delete", "appendBlocks"]),
37
+ },
38
+ {
39
+ displayName: "Search Query",
40
+ name: "q",
41
+ type: "string",
42
+ required: true,
43
+ default: "",
44
+ description: "Text to search for",
45
+ displayOptions: show(["search"]),
46
+ },
47
+ {
48
+ displayName: "Include Blocks",
49
+ name: "includeBlocks",
50
+ type: "boolean",
51
+ default: false,
52
+ description: "Whether to include the full block tree in the response",
53
+ displayOptions: show(["get"]),
54
+ },
55
+ {
56
+ displayName: "Page Body (JSON)",
57
+ name: "pageBody",
58
+ type: "json",
59
+ default: '{\n "title": "",\n "parentPageId": null\n}',
60
+ required: true,
61
+ description: "Page fields: title, parentPageId, icon, properties (object).",
62
+ displayOptions: show(["create", "update"]),
63
+ },
64
+ {
65
+ displayName: "Blocks (JSON Array)",
66
+ name: "blocksJson",
67
+ type: "json",
68
+ default: "[]",
69
+ required: true,
70
+ description: 'Array of block objects to append, e.g. [{"type":"paragraph","content":"Hello"}]',
71
+ displayOptions: show(["appendBlocks"]),
72
+ },
73
+ ];
74
+ async function get(i) {
75
+ await scopeGuard_js_1.assertScope.call(this, "pages.read");
76
+ const id = this.getNodeParameter("pageId", i);
77
+ const includeBlocks = this.getNodeParameter("includeBlocks", i, false);
78
+ const qs = includeBlocks ? { includeBlocks: "true" } : {};
79
+ const res = (await apiRequest_js_1.apiRequest.call(this, "GET", `/pages/${id}`, { qs }));
80
+ return [{ json: (res.data ?? res) }];
81
+ }
82
+ async function list() {
83
+ await scopeGuard_js_1.assertScope.call(this, "pages.read");
84
+ const items = await (0, paginate_js_1.paginate)(this, "/pages");
85
+ return items.map((p) => ({ json: p }));
86
+ }
87
+ async function search(i) {
88
+ await scopeGuard_js_1.assertScope.call(this, "pages.read");
89
+ const q = this.getNodeParameter("q", i);
90
+ const items = await (0, paginate_js_1.paginate)(this, "/pages/search", { q });
91
+ return items.map((p) => ({ json: p }));
92
+ }
93
+ async function create(i) {
94
+ await scopeGuard_js_1.assertScope.call(this, "pages.write");
95
+ const body = this.getNodeParameter("pageBody", i);
96
+ const key = (0, idempotency_js_1.deriveIdempotencyKey)(this, i, "page.create");
97
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", "/pages", { body, idempotencyKey: key }));
98
+ return [{ json: (res.data ?? res) }];
99
+ }
100
+ async function update(i) {
101
+ await scopeGuard_js_1.assertScope.call(this, "pages.write");
102
+ const id = this.getNodeParameter("pageId", i);
103
+ const body = this.getNodeParameter("pageBody", i);
104
+ const res = (await apiRequest_js_1.apiRequest.call(this, "PATCH", `/pages/${id}`, { body }));
105
+ return [{ json: (res.data ?? res) }];
106
+ }
107
+ async function del(i) {
108
+ await scopeGuard_js_1.assertScope.call(this, "pages.write");
109
+ const id = this.getNodeParameter("pageId", i);
110
+ await apiRequest_js_1.apiRequest.call(this, "DELETE", `/pages/${id}`);
111
+ return [{ json: { ok: true, id, deleted: true } }];
112
+ }
113
+ async function appendBlocks(i) {
114
+ await scopeGuard_js_1.assertScope.call(this, "pages.write");
115
+ const id = this.getNodeParameter("pageId", i);
116
+ const blocks = this.getNodeParameter("blocksJson", i);
117
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", `/pages/${id}/blocks`, { body: { blocks } }));
118
+ return [{ json: (res.data ?? res) }];
119
+ }
120
+ exports.handlers = { get, list, search, create, update, "delete": del, appendBlocks };
@@ -0,0 +1,15 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from "n8n-workflow";
2
+ export declare const properties: INodeProperties[];
3
+ declare function get(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
4
+ declare function list(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
5
+ declare function create(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
6
+ declare function update(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
7
+ declare function del(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
8
+ export declare const handlers: {
9
+ get: typeof get;
10
+ list: typeof list;
11
+ create: typeof create;
12
+ update: typeof update;
13
+ delete: typeof del;
14
+ };
15
+ export {};
@@ -0,0 +1,77 @@
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: ["project"], ...(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: "list",
19
+ options: [
20
+ { name: "Get", value: "get", action: "Get a project" },
21
+ { name: "List", value: "list", action: "List projects" },
22
+ { name: "Create", value: "create", action: "Create a project" },
23
+ { name: "Update", value: "update", action: "Update a project" },
24
+ { name: "Delete", value: "delete", action: "Delete a project" },
25
+ ],
26
+ },
27
+ {
28
+ displayName: "Project ID",
29
+ name: "projectId",
30
+ type: "string",
31
+ required: true,
32
+ default: "",
33
+ description: "The id (or slug) of the project",
34
+ displayOptions: show(["get", "update", "delete"]),
35
+ },
36
+ {
37
+ displayName: "Project Body (JSON)",
38
+ name: "projectBody",
39
+ type: "json",
40
+ default: '{\n "name": "",\n "color": null,\n "description": null\n}',
41
+ required: true,
42
+ description: "Project fields: name (required for create), color, description, ownerId, status, dueDate.",
43
+ displayOptions: show(["create", "update"]),
44
+ },
45
+ ];
46
+ async function get(i) {
47
+ await scopeGuard_js_1.assertScope.call(this, "projects.read");
48
+ const id = this.getNodeParameter("projectId", i);
49
+ const res = (await apiRequest_js_1.apiRequest.call(this, "GET", `/projects/${id}`));
50
+ return [{ json: (res.data ?? res) }];
51
+ }
52
+ async function list() {
53
+ await scopeGuard_js_1.assertScope.call(this, "projects.read");
54
+ const items = await (0, paginate_js_1.paginate)(this, "/projects");
55
+ return items.map((p) => ({ json: p }));
56
+ }
57
+ async function create(i) {
58
+ await scopeGuard_js_1.assertScope.call(this, "projects.write");
59
+ const body = this.getNodeParameter("projectBody", i);
60
+ const key = (0, idempotency_js_1.deriveIdempotencyKey)(this, i, "project.create");
61
+ const res = (await apiRequest_js_1.apiRequest.call(this, "POST", "/projects", { body, idempotencyKey: key }));
62
+ return [{ json: (res.data ?? res) }];
63
+ }
64
+ async function update(i) {
65
+ await scopeGuard_js_1.assertScope.call(this, "projects.write");
66
+ const id = this.getNodeParameter("projectId", i);
67
+ const body = this.getNodeParameter("projectBody", i);
68
+ const res = (await apiRequest_js_1.apiRequest.call(this, "PATCH", `/projects/${id}`, { body }));
69
+ return [{ json: (res.data ?? res) }];
70
+ }
71
+ async function del(i) {
72
+ await scopeGuard_js_1.assertScope.call(this, "projects.write");
73
+ const id = this.getNodeParameter("projectId", i);
74
+ await apiRequest_js_1.apiRequest.call(this, "DELETE", `/projects/${id}`);
75
+ return [{ json: { ok: true, id, deleted: true } }];
76
+ }
77
+ exports.handlers = { get, list, create, update, "delete": del };
@@ -0,0 +1,7 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from "n8n-workflow";
2
+ export declare const properties: INodeProperties[];
3
+ declare function request(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
4
+ export declare const handlers: {
5
+ request: typeof request;
6
+ };
7
+ export {};
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ // Raw HTTP escape-hatch. Lets power users hit any Axon API endpoint that
3
+ // the wrapper doesn't surface yet, using the same OAuth credential. The
4
+ // request is scoped to whatever the credential's granted scopes allow —
5
+ // no extra privilege escalation possible.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.handlers = exports.properties = void 0;
8
+ const apiRequest_js_1 = require("../helpers/apiRequest.js");
9
+ const show = (ops) => ({
10
+ show: { resource: ["raw"], ...(ops ? { operation: ops } : {}) },
11
+ });
12
+ exports.properties = [
13
+ {
14
+ displayName: "Operation",
15
+ name: "operation",
16
+ type: "options",
17
+ noDataExpression: true,
18
+ displayOptions: show(),
19
+ default: "request",
20
+ options: [{ name: "Request", value: "request", action: "Make a raw API request" }],
21
+ },
22
+ {
23
+ displayName: "Method",
24
+ name: "method",
25
+ type: "options",
26
+ default: "GET",
27
+ options: [
28
+ { name: "GET", value: "GET" },
29
+ { name: "POST", value: "POST" },
30
+ { name: "PATCH", value: "PATCH" },
31
+ { name: "PUT", value: "PUT" },
32
+ { name: "DELETE", value: "DELETE" },
33
+ ],
34
+ displayOptions: show(["request"]),
35
+ },
36
+ {
37
+ displayName: "Path",
38
+ name: "path",
39
+ type: "string",
40
+ required: true,
41
+ default: "/tasks",
42
+ description: "API path starting with /. e.g. /workspaces/<id>/projects or /form-process-templates/<id>",
43
+ displayOptions: show(["request"]),
44
+ },
45
+ {
46
+ displayName: "Body (JSON)",
47
+ name: "rawBody",
48
+ type: "json",
49
+ default: "{}",
50
+ description: "Request body for POST / PATCH / PUT. Leave default {} for GET / DELETE.",
51
+ displayOptions: show(["request"]),
52
+ },
53
+ ];
54
+ async function request(i) {
55
+ const method = this.getNodeParameter("method", i);
56
+ const path = this.getNodeParameter("path", i);
57
+ const body = this.getNodeParameter("rawBody", i, undefined);
58
+ const opts = method === "GET" || method === "DELETE" ? {} : { body };
59
+ const res = (await apiRequest_js_1.apiRequest.call(this, method, path, opts));
60
+ if (Array.isArray(res))
61
+ return res.map((r) => ({ json: r }));
62
+ if (res && typeof res === "object" && "data" in res) {
63
+ const data = res.data;
64
+ if (Array.isArray(data))
65
+ return data.map((r) => ({ json: r }));
66
+ return [{ json: data }];
67
+ }
68
+ return [{ json: res ?? {} }];
69
+ }
70
+ exports.handlers = { request };
@@ -0,0 +1,15 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from "n8n-workflow";
2
+ export declare const properties: INodeProperties[];
3
+ declare function get(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
4
+ declare function list(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
5
+ declare function listRuns(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
6
+ declare function submitTaskValue(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
7
+ declare function updateRoutineTask(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
8
+ export declare const handlers: {
9
+ get: typeof get;
10
+ list: typeof list;
11
+ listRuns: typeof listRuns;
12
+ submitTaskValue: typeof submitTaskValue;
13
+ updateRoutineTask: typeof updateRoutineTask;
14
+ };
15
+ export {};