n8n-nodes-abysshub 0.0.0-stage → 0.1.2-dev.10

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) 2026 Abyss
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 CHANGED
@@ -1,3 +1,34 @@
1
- # Temporary Holding Version
1
+ # n8n-nodes-abysshub
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Pre-release: the Abyss API opens soon. Until then, try the node as `n8n-nodes-abysshub@next`; n8n has not verified it yet.
4
+
5
+ An [n8n](https://n8n.io) community node that runs an [Abyss](https://abysshub.com) Widget as a step in a workflow. It gives n8n one node, **Abyss**, with one credential.
6
+
7
+ ## Credentials
8
+
9
+ **Abyss API** takes:
10
+
11
+ - **API Key:** an API key from your Cave, starting `abyss_sk_`.
12
+ - **API URL:** `https://api.abysshub.com` by default. A key starting `abyss_sk_dev_` needs `https://api.dev.abysshub.com`.
13
+
14
+ Saving the credential tests it with `GET /v1/key`.
15
+
16
+ ## Operations
17
+
18
+ - **Run a Widget** takes a **Widget ID** (`widget_<id>`, or an unlisted Widget's private token) and its **Input** as a JSON object of its fields by name, and returns the run object.
19
+ - **Wait for Result**, on by default, ends the step when the run ends. A failed run fails the step with the run's error message. Off, the step returns the queued run at once: read it later with **Get a Run**.
20
+ - **Options:** **Max Price**, the most you will pay for the run, and **Idempotency Key**: a press repeated with the same key and input within 24 hours returns the same run.
21
+ - **Get a Run** takes a **Run ID** and returns the run object as it is now.
22
+
23
+ ## Files
24
+
25
+ - **Input files:** give a file field an `https` link to the file, as a string in the input.
26
+ - **Output files:** the run object lists them in `output_files`, each with a signed `url` that expires. **Download Output Files** also attaches every one to the item as binary data, `file_0`, `file_1` and so on in that order, so the next node can mail or store them. A run whose files are asleep fails the download: wake it with `POST /v1/runs/{id}/wake` first.
27
+
28
+ ## Errors
29
+
30
+ An error from the API fails the step with the API's message. Its description gives the error's `code` and the `request_id` to quote to support. With **Continue On Fail**, the item carries `{ "error": message }` instead.
31
+
32
+ ## Development
33
+
34
+ `npm test` builds the package, replays the recorded exchanges in [`exchanges/`](../exchanges) through the node, and runs `npm run scan`. The scan applies the rules of `npx @n8n/scan-community-package`, which only scans a published package, to the sources and to the built package. Installing the dev tools runs no install scripts (`.npmrc`), since one of the scanner's dependencies builds only on Node 22.
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class AbyssApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: "file:../nodes/Abyss/abyss.svg";
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ authenticate: IAuthenticateGeneric;
9
+ test: ICredentialTestRequest;
10
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbyssApi = void 0;
4
+ class AbyssApi {
5
+ name = 'abyssApi';
6
+ displayName = 'Abyss API';
7
+ icon = 'file:../nodes/Abyss/abyss.svg';
8
+ documentationUrl = 'https://github.com/Abysshub/abysshub-sdk/tree/main/n8n#credentials';
9
+ properties = [
10
+ {
11
+ displayName: 'API Key',
12
+ name: 'apiKey',
13
+ type: 'string',
14
+ typeOptions: { password: true },
15
+ required: true,
16
+ default: '',
17
+ description: 'An API key from your Cave, starting with abyss_sk_',
18
+ },
19
+ {
20
+ displayName: 'API URL',
21
+ name: 'url',
22
+ type: 'string',
23
+ default: 'https://api.abysshub.com',
24
+ description: 'Where the Abyss API is. Keep the default, or use https://api.dev.abysshub.com with a key starting with abyss_sk_dev_.',
25
+ },
26
+ ];
27
+ authenticate = {
28
+ type: 'generic',
29
+ properties: {
30
+ headers: {
31
+ Authorization: '=Bearer {{$credentials.apiKey}}',
32
+ },
33
+ },
34
+ };
35
+ test = {
36
+ request: {
37
+ baseURL: '={{$credentials.url}}',
38
+ url: '/v1/key',
39
+ },
40
+ };
41
+ }
42
+ exports.AbyssApi = AbyssApi;
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class Abyss implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Abyss = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const api_1 = require("./api");
6
+ class Abyss {
7
+ description = {
8
+ displayName: 'Abyss',
9
+ name: 'abyss',
10
+ icon: 'file:abyss.svg',
11
+ group: ['transform'],
12
+ version: 1,
13
+ subtitle: '={{$parameter["operation"] === "get" ? "Get a run" : "Run a Widget"}}',
14
+ description: 'Run an Abyss Widget and read its runs',
15
+ defaults: {
16
+ name: 'Abyss',
17
+ },
18
+ usableAsTool: true,
19
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
20
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
21
+ credentials: [
22
+ {
23
+ name: 'abyssApi',
24
+ required: true,
25
+ },
26
+ ],
27
+ properties: [
28
+ {
29
+ displayName: 'Operation',
30
+ name: 'operation',
31
+ type: 'options',
32
+ noDataExpression: true,
33
+ options: [
34
+ {
35
+ name: 'Run a Widget',
36
+ value: 'run',
37
+ description: 'Start a run of a Widget and return the run',
38
+ action: 'Run a widget',
39
+ },
40
+ {
41
+ name: 'Get a Run',
42
+ value: 'get',
43
+ description: 'Return a run as it is now',
44
+ action: 'Get a run',
45
+ },
46
+ ],
47
+ default: 'run',
48
+ },
49
+ {
50
+ displayName: 'Widget ID',
51
+ name: 'widgetId',
52
+ type: 'string',
53
+ required: true,
54
+ default: '',
55
+ placeholder: 'widget_131',
56
+ description: 'The Widget to run: its ID, or the private token of an unlisted Widget',
57
+ displayOptions: { show: { operation: ['run'] } },
58
+ },
59
+ {
60
+ displayName: 'Input',
61
+ name: 'input',
62
+ type: 'json',
63
+ default: '{}',
64
+ description: "The Widget's input as a JSON object of its fields by name. A file field takes an https link to the file.",
65
+ displayOptions: { show: { operation: ['run'] } },
66
+ },
67
+ {
68
+ displayName: 'Wait for Result',
69
+ name: 'waitForResult',
70
+ type: 'boolean',
71
+ default: true,
72
+ description: 'Whether to end the step when the run ends, returning the ended run. Off, the step returns the queued run at once.',
73
+ displayOptions: { show: { operation: ['run'] } },
74
+ },
75
+ {
76
+ displayName: 'Run ID',
77
+ name: 'runId',
78
+ type: 'string',
79
+ required: true,
80
+ default: '',
81
+ placeholder: 'run_8fK2mQx7Lp3Rz9Tb4Wc6Yd1N',
82
+ description: 'The ID of the run to return',
83
+ displayOptions: { show: { operation: ['get'] } },
84
+ },
85
+ {
86
+ displayName: 'Download Output Files',
87
+ name: 'downloadOutputFiles',
88
+ type: 'boolean',
89
+ default: false,
90
+ description: 'Whether to attach every output file of the run to the item as binary data, as file_0, file_1 and so on',
91
+ },
92
+ {
93
+ displayName: 'Options',
94
+ name: 'options',
95
+ type: 'collection',
96
+ placeholder: 'Add Option',
97
+ default: {},
98
+ displayOptions: { show: { operation: ['run'] } },
99
+ options: [
100
+ {
101
+ displayName: 'Idempotency Key',
102
+ name: 'idempotencyKey',
103
+ type: 'string',
104
+ default: '',
105
+ description: 'A key of your own for this press. A press repeated with the same key and input within 24 hours returns the same run instead of starting another.',
106
+ },
107
+ {
108
+ displayName: 'Max Price',
109
+ name: 'maxPrice',
110
+ type: 'number',
111
+ default: 0,
112
+ typeOptions: { minValue: 0, numberPrecision: 2 },
113
+ description: "The most you will pay for this run, in Byssium. If the Widget's price has risen above it, nothing runs and nothing is charged.",
114
+ },
115
+ ],
116
+ },
117
+ ],
118
+ };
119
+ async execute() {
120
+ const items = this.getInputData();
121
+ const returnData = [];
122
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
123
+ try {
124
+ const operation = this.getNodeParameter('operation', itemIndex);
125
+ const run = operation === 'get'
126
+ ? await (0, api_1.getRun)(this, itemIndex, this.getNodeParameter('runId', itemIndex).trim())
127
+ : await (0, api_1.runWidget)(this, itemIndex, this.getNodeParameter('widgetId', itemIndex).trim(), input(this, itemIndex), pressOptions(this, itemIndex));
128
+ const item = { json: run, pairedItem: { item: itemIndex } };
129
+ if (this.getNodeParameter('downloadOutputFiles', itemIndex, false)) {
130
+ item.binary = await (0, api_1.downloadOutputFiles)(this, itemIndex, run);
131
+ }
132
+ returnData.push(item);
133
+ }
134
+ catch (error) {
135
+ if (this.continueOnFail()) {
136
+ returnData.push({ json: { error: error.message }, pairedItem: { item: itemIndex } });
137
+ continue;
138
+ }
139
+ throw error instanceof n8n_workflow_1.NodeApiError ? error : new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
140
+ }
141
+ }
142
+ return [returnData];
143
+ }
144
+ }
145
+ exports.Abyss = Abyss;
146
+ /** The Widget's input: a JSON object of its fields by name, whose names are sent as they are. */
147
+ function input(ctx, itemIndex) {
148
+ const raw = ctx.getNodeParameter('input', itemIndex, '{}');
149
+ const value = typeof raw === 'string'
150
+ ? (0, n8n_workflow_1.jsonParse)(raw.trim() === '' ? '{}' : raw, { fallbackValue: null })
151
+ : raw;
152
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
153
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), "Input must be a JSON object of the Widget's fields by name.", {
154
+ itemIndex,
155
+ });
156
+ }
157
+ return value;
158
+ }
159
+ function pressOptions(ctx, itemIndex) {
160
+ const options = ctx.getNodeParameter('options', itemIndex, {});
161
+ const press = { wait: ctx.getNodeParameter('waitForResult', itemIndex, true) };
162
+ if (options.maxPrice !== undefined)
163
+ press.maxPrice = options.maxPrice;
164
+ if (options.idempotencyKey)
165
+ press.idempotencyKey = options.idempotencyKey;
166
+ return press;
167
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "node": "n8n-nodes-abysshub.abyss",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Development", "Utility"],
6
+ "resources": {
7
+ "primaryDocumentation": [
8
+ {
9
+ "url": "https://github.com/Abysshub/abysshub-sdk/tree/main/n8n#readme"
10
+ }
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"><circle cx="32" cy="32" r="30" fill="#0b1f3a"/><circle cx="32" cy="32" r="20" fill="none" stroke="#3b82f6" stroke-width="4"/><circle cx="32" cy="32" r="9" fill="#93c5fd"/></svg>
@@ -0,0 +1,37 @@
1
+ import type { IBinaryKeyData, IDataObject, IExecuteFunctions } from 'n8n-workflow';
2
+ /** One file a run wrote, as `/v1` answers it. */
3
+ export interface RunFile extends IDataObject {
4
+ path: string;
5
+ size: number;
6
+ content_type: string;
7
+ url: string;
8
+ }
9
+ /** A run, as `/v1` answers it. */
10
+ export interface Run extends IDataObject {
11
+ id: string;
12
+ status: 'queued' | 'running' | 'succeeded' | 'failed';
13
+ output_files: RunFile[];
14
+ files: 'ready' | 'asleep' | 'waking';
15
+ error: {
16
+ code: string;
17
+ message: string;
18
+ } | null;
19
+ }
20
+ export interface PressOptions {
21
+ wait: boolean;
22
+ maxPrice?: number;
23
+ idempotencyKey?: string;
24
+ }
25
+ /**
26
+ * Presses a Widget. With `wait`, the press holds until the run ends; a `202` or a `200`
27
+ * still `running` is followed by `GET /v1/runs/{id}?wait=true`, read again with no limit
28
+ * until the run ends, and a failed run raises. Without `wait`, it answers the queued run.
29
+ */
30
+ export declare function runWidget(ctx: IExecuteFunctions, itemIndex: number, widget: string, input: IDataObject, options: PressOptions): Promise<Run>;
31
+ /** Reads a run as it is now, with `GET /v1/runs/{id}`. */
32
+ export declare function getRun(ctx: IExecuteFunctions, itemIndex: number, id: string): Promise<Run>;
33
+ /**
34
+ * Downloads every output file of the run as binary data, `file_0`, `file_1`, … in the
35
+ * order of `output_files`. An expired URL is refreshed once by reading the run again.
36
+ */
37
+ export declare function downloadOutputFiles(ctx: IExecuteFunctions, itemIndex: number, run: Run): Promise<IBinaryKeyData>;
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runWidget = runWidget;
4
+ exports.getRun = getRun;
5
+ exports.downloadOutputFiles = downloadOutputFiles;
6
+ const crypto_1 = require("crypto");
7
+ const n8n_workflow_1 = require("n8n-workflow");
8
+ const DEFAULT_URL = 'https://api.abysshub.com';
9
+ /** A press and a read are sent again at most this many times. */
10
+ const MAX_RETRIES = 2;
11
+ /** The pause between two re-attaches that both ended without the run's ending. */
12
+ const REATTACH_PAUSE_MS = 1_000;
13
+ /** The first pause before a retry after a drop or a 5xx; it doubles with each retry. */
14
+ const RETRY_PAUSE_MS = 500;
15
+ /** The longest pause between two tries, which only re-attaching, with no limit, reaches. */
16
+ const RETRY_PAUSE_CEILING_MS = 10_000;
17
+ /**
18
+ * Presses a Widget. With `wait`, the press holds until the run ends; a `202` or a `200`
19
+ * still `running` is followed by `GET /v1/runs/{id}?wait=true`, read again with no limit
20
+ * until the run ends, and a failed run raises. Without `wait`, it answers the queued run.
21
+ */
22
+ async function runWidget(ctx, itemIndex, widget, input, options) {
23
+ const base = await baseUrl(ctx);
24
+ const body = { input };
25
+ if (options.maxPrice !== undefined)
26
+ body.max_price = options.maxPrice;
27
+ if (!options.wait)
28
+ body.wait = false;
29
+ // One Idempotency-Key for every try: a press sent again after a drop or a cut hold
30
+ // answers the same run, and holds again.
31
+ const headers = { 'Idempotency-Key': options.idempotencyKey ?? (0, crypto_1.randomUUID)() };
32
+ const url = `${base}/v1/widgets/${encodeURIComponent(widget)}/runs`;
33
+ let answer = await send(ctx, itemIndex, 'POST', url, MAX_RETRIES, body, headers);
34
+ let run = expectRun(ctx, itemIndex, answer);
35
+ if (!options.wait)
36
+ return run;
37
+ const waitUrl = `${base}/v1/runs/${encodeURIComponent(run.id)}?wait=true`;
38
+ for (let reattach = 0; !hasEnded(run); reattach++) {
39
+ if (reattach > 0)
40
+ await (0, n8n_workflow_1.sleepWithAbort)(REATTACH_PAUSE_MS, ctx.getExecutionCancelSignal());
41
+ answer = await send(ctx, itemIndex, 'GET', waitUrl, Infinity);
42
+ run = expectRun(ctx, itemIndex, answer);
43
+ }
44
+ if (run.status === 'failed') {
45
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), run.error?.message ?? 'The run failed.', {
46
+ description: describe(run.error?.code ?? 'platform_fault', run.id, answer.headers['request-id']),
47
+ itemIndex,
48
+ });
49
+ }
50
+ return run;
51
+ }
52
+ /** Reads a run as it is now, with `GET /v1/runs/{id}`. */
53
+ async function getRun(ctx, itemIndex, id) {
54
+ const url = `${await baseUrl(ctx)}/v1/runs/${encodeURIComponent(id)}`;
55
+ return expectRun(ctx, itemIndex, await send(ctx, itemIndex, 'GET', url, MAX_RETRIES));
56
+ }
57
+ /**
58
+ * Downloads every output file of the run as binary data, `file_0`, `file_1`, … in the
59
+ * order of `output_files`. An expired URL is refreshed once by reading the run again.
60
+ */
61
+ async function downloadOutputFiles(ctx, itemIndex, run) {
62
+ if (run.files === 'asleep' || run.files === 'waking') {
63
+ const message = run.files === 'asleep'
64
+ ? `The files of run ${run.id} are asleep. Wake the run with POST /v1/runs/${run.id}/wake: they are back within 12 hours.`
65
+ : `The files of run ${run.id} are waking: they are back within 12 hours.`;
66
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), message, { description: `files_${run.files}`, itemIndex });
67
+ }
68
+ const binary = {};
69
+ let files = run.output_files;
70
+ let refreshed = false;
71
+ for (let index = 0; index < files.length; index++) {
72
+ let file = files[index];
73
+ let answer = await download(ctx, file.url);
74
+ if (answer.statusCode === 403 && !refreshed) {
75
+ refreshed = true;
76
+ files = (await getRun(ctx, itemIndex, run.id)).output_files;
77
+ file = files.find(({ path }) => path === file.path) ?? file;
78
+ answer = await download(ctx, file.url);
79
+ }
80
+ if (answer.statusCode !== 200) {
81
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Could not download ${file.path}: storage answered ${answer.statusCode}.`, {
82
+ itemIndex,
83
+ });
84
+ }
85
+ binary[`file_${index}`] = await ctx.helpers.prepareBinaryData(Buffer.from(answer.body), file.path, file.content_type);
86
+ }
87
+ return binary;
88
+ }
89
+ async function baseUrl(ctx) {
90
+ const credentials = await ctx.getCredentials('abyssApi');
91
+ const url = typeof credentials.url === 'string' && credentials.url.trim() !== '' ? credentials.url.trim() : DEFAULT_URL;
92
+ return url.replace(/\/+$/, '');
93
+ }
94
+ /** An output file's signed URL is storage's, not `/v1`'s: it is read without the API key. */
95
+ function download(ctx, url) {
96
+ return ctx.helpers.httpRequest({
97
+ method: 'GET',
98
+ url,
99
+ encoding: 'arraybuffer',
100
+ returnFullResponse: true,
101
+ ignoreHttpStatusErrors: true,
102
+ abortSignal: ctx.getExecutionCancelSignal(),
103
+ });
104
+ }
105
+ /**
106
+ * Sends one request to `/v1`. A drop or a cut, a `429`, a `409` and a `5xx` are sent
107
+ * again, at most `retries` times; every other refusal raises at once with the API's message.
108
+ */
109
+ async function send(ctx, itemIndex, method, url, retries, body, headers) {
110
+ const signal = ctx.getExecutionCancelSignal();
111
+ for (let attempt = 0;; attempt++) {
112
+ let response;
113
+ try {
114
+ response = (await ctx.helpers.httpRequestWithAuthentication.call(ctx, 'abyssApi', {
115
+ method,
116
+ url,
117
+ headers: { Accept: 'application/json', ...headers },
118
+ ...(body === undefined ? {} : { body }),
119
+ json: true,
120
+ returnFullResponse: true,
121
+ ignoreHttpStatusErrors: true,
122
+ abortSignal: signal,
123
+ }));
124
+ }
125
+ catch (error) {
126
+ if (signal?.aborted || attempt >= retries) {
127
+ throw new n8n_workflow_1.NodeApiError(ctx.getNode(), error, {
128
+ message: 'The connection to the Abyss API dropped before it answered.',
129
+ itemIndex,
130
+ });
131
+ }
132
+ await (0, n8n_workflow_1.sleepWithAbort)(backoff(attempt), signal);
133
+ continue;
134
+ }
135
+ const answer = { status: response.statusCode, headers: response.headers, body: parse(response.body) };
136
+ if (answer.status < 400)
137
+ return answer;
138
+ const pause = retryPause(answer, attempt);
139
+ if (pause === null || attempt >= retries)
140
+ throw refusal(ctx, itemIndex, answer);
141
+ await (0, n8n_workflow_1.sleepWithAbort)(pause, signal);
142
+ }
143
+ }
144
+ /** How long to wait before sending a refused request again, or null when it is not retried. */
145
+ function retryPause(answer, attempt) {
146
+ if (answer.status === 429 || answer.status === 409) {
147
+ const seconds = Number(answer.headers['retry-after'] ?? Number.NaN);
148
+ return Number.isFinite(seconds) && seconds >= 0 ? seconds * 1_000 : backoff(attempt);
149
+ }
150
+ return answer.status >= 500 ? backoff(attempt) : null;
151
+ }
152
+ function backoff(attempt) {
153
+ return Math.min(RETRY_PAUSE_MS * 2 ** attempt, RETRY_PAUSE_CEILING_MS);
154
+ }
155
+ /** A refusal as an n8n error carrying the API's message, its code and its request id. */
156
+ function refusal(ctx, itemIndex, answer) {
157
+ const body = isObject(answer.body) ? answer.body : {};
158
+ const error = isObject(body.error) ? body.error : {};
159
+ const requestId = typeof body.request_id === 'string' ? body.request_id : answer.headers['request-id'];
160
+ const description = describe(error.code, undefined, requestId);
161
+ return new n8n_workflow_1.NodeApiError(ctx.getNode(), body, {
162
+ message: typeof error.message === 'string' ? error.message : `The Abyss API answered ${answer.status}.`,
163
+ ...(description === '' ? {} : { description }),
164
+ httpCode: String(answer.status),
165
+ itemIndex,
166
+ });
167
+ }
168
+ /** An error's description, such as `invalid_input · request req_…`, from the parts it has. */
169
+ function describe(code, runId, requestId) {
170
+ const parts = [code, runId && `run ${runId}`, requestId && `request ${String(requestId)}`];
171
+ return parts.filter((part) => typeof part === 'string' && part !== '').join(' · ');
172
+ }
173
+ function expectRun(ctx, itemIndex, answer) {
174
+ const { body } = answer;
175
+ if (isObject(body) && typeof body.id === 'string' && typeof body.status === 'string' && Array.isArray(body.output_files)) {
176
+ return body;
177
+ }
178
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'The Abyss API answered without a run.', { itemIndex });
179
+ }
180
+ function hasEnded(run) {
181
+ return run.status === 'succeeded' || run.status === 'failed';
182
+ }
183
+ /** A held answer starts with spaces; JSON allows them, but a body left as text is parsed here. */
184
+ function parse(body) {
185
+ if (typeof body !== 'string')
186
+ return body;
187
+ try {
188
+ return JSON.parse(body);
189
+ }
190
+ catch {
191
+ return body;
192
+ }
193
+ }
194
+ function isObject(value) {
195
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
196
+ }
package/package.json CHANGED
@@ -1,6 +1,56 @@
1
1
  {
2
2
  "name": "n8n-nodes-abysshub",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.2-dev.10",
4
+ "description": "Run an Abyss Widget as a step in an n8n workflow.",
5
+ "keywords": [
6
+ "n8n-community-node-package",
7
+ "abyss",
8
+ "abysshub"
9
+ ],
10
+ "license": "MIT",
11
+ "homepage": "https://github.com/Abysshub/abysshub-sdk/tree/main/n8n#readme",
12
+ "author": {
13
+ "name": "Abysshub",
14
+ "email": "r.aliev@abysshub.com"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/Abysshub/abysshub-sdk.git",
19
+ "directory": "n8n"
20
+ },
21
+ "bugs": "https://github.com/Abysshub/abysshub-sdk/issues",
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "publishConfig": {
26
+ "provenance": true
27
+ },
28
+ "engines": {
29
+ "node": ">=20"
30
+ },
31
+ "scripts": {
32
+ "build": "tsc && node scripts/copy-assets.mjs",
33
+ "prepack": "npm run build",
34
+ "scan": "npm run build && node scripts/scan.mjs",
35
+ "test": "npm run build && node --test test/*.test.mjs && node scripts/scan.mjs"
36
+ },
37
+ "n8n": {
38
+ "n8nNodesApiVersion": 1,
39
+ "strict": true,
40
+ "credentials": [
41
+ "dist/credentials/AbyssApi.credentials.js"
42
+ ],
43
+ "nodes": [
44
+ "dist/nodes/Abyss/Abyss.node.js"
45
+ ]
46
+ },
47
+ "peerDependencies": {
48
+ "n8n-workflow": "*"
49
+ },
50
+ "devDependencies": {
51
+ "@n8n/scan-community-package": "^0.39.0",
52
+ "@types/node": "^20.19.43",
53
+ "n8n-workflow": "^1.120.33",
54
+ "typescript": "^5.9.3"
55
+ }
56
+ }