n8n-nodes-slatebox 0.0.0-stage → 0.1.3

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.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Slatebox LLC and Slatebox contributors
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,142 @@
1
- # Temporary Holding Version
1
+ # n8n-nodes-slatebox
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
+ n8n nodes for [Slatebox](https://slatebox.com), the free, open-source canvas for your team and
4
+ agents. Make slates from text or outlines, add sticky notes and board rows, ask the Slatebox agent
5
+ to draw, make presentations, and start a workflow when a slate is made.
6
+
7
+ The nodes work with Slatebox Cloud (`https://app.slatebox.com`) and with your own Slatebox server.
8
+
9
+ [Installation](#installation) ·
10
+ [Credentials](#credentials) ·
11
+ [Operations](#operations) ·
12
+ [Trigger](#trigger) ·
13
+ [Example workflows](#example-workflows) ·
14
+ [Compatibility](#compatibility) ·
15
+ [Development](#development) ·
16
+ [Publishing](#publishing-maintainers)
17
+
18
+ ## Installation
19
+
20
+ On self-hosted n8n, follow n8n's
21
+ [community nodes installation guide](https://docs.n8n.io/integrations/community-nodes/installation/):
22
+ in **Settings → Community Nodes**, choose **Install** and enter `n8n-nodes-slatebox`.
23
+
24
+ On n8n Cloud, community nodes install from the nodes panel once n8n has verified them.
25
+
26
+ ## Credentials
27
+
28
+ The nodes sign in with a Slatebox personal API token.
29
+
30
+ 1. In Slatebox, open your profile, then **Developer access**, and create a token.
31
+ 2. In n8n, create a **Slatebox API** credential:
32
+ - **API Token**: the token you created.
33
+ - **Server Address**: keep `https://app.slatebox.com` for Slatebox Cloud, or enter the address
34
+ of your own Slatebox server.
35
+ 3. Save. n8n checks the token by reading your account (`GET /api/v1/me`).
36
+
37
+ The token acts as you: the nodes can open and change only the slates you can. Revoke it in
38
+ Slatebox at any time, under Developer access.
39
+
40
+ ## Operations
41
+
42
+ Pick a slate from the list, or give its ID or its address (`…/canvas/<id>`).
43
+
44
+ | Resource | Operation | What it does |
45
+ | --- | --- | --- |
46
+ | Slate | Create From Text | Makes a diagram slate from plain-text steps (up to 1,200 characters and 24 notes; join two steps with `→` or `->`). |
47
+ | Slate | Create From Outline | Makes a mind map slate from an indented outline: one idea per line, nested by spaces, tabs or Markdown bullets. The name becomes the central idea. |
48
+ | Slate | Get Many | Finds slates by name: yours, your team's, or a project's, newest first (up to 100). |
49
+ | Slate | Get Share Link | Returns the slate's address, who can open it and its embed. With **Turn On Link Sharing**, turns on a link anyone holding can open, as reader, commenter or editor (slate owners only). |
50
+ | Sticky Note | Create | Adds sticky notes to a slate, one per line (up to 50), in a row. Optional fill color, and a note to start beside. |
51
+ | Board | Add Row | Adds a card to a lane of a board on a slate (a team board, a pipeline, a budget …), with an amount on pipeline and budget boards. Name the board when the slate holds more than one. |
52
+ | Agent | Ask To Draw | Asks the Slatebox agent to draw or change something on a slate, in plain words. The agent works in the open on the slate; removals wait for a person to approve them. On Slatebox Cloud it counts toward your agent use, as asking in the app does. |
53
+ | Presentation | Create | Plans a presentation of a slate, in a style you choose (or one the agent picks), with an optional brief. |
54
+
55
+ Each operation returns Slatebox's answer, including the slate's `shareId` and `url`, so the next
56
+ node can use them. The Slatebox node can also be used as a tool by n8n's AI Agent node.
57
+
58
+ When Slatebox refuses a change (for example, a lane that is full), the node fails with
59
+ Slatebox's own explanation. Turn on **Continue On Fail** to receive it as an `error` field
60
+ instead. If a board changes between reading it and adding the row, the node reads it again and
61
+ tries once more.
62
+
63
+ ## Trigger
64
+
65
+ **Slatebox Trigger** starts a workflow when a slate is made: yours, your team's, or one
66
+ project's. It checks on n8n's polling schedule (for example every minute) and returns each new
67
+ slate once, oldest first. When you test the node, it returns your newest slate as a sample.
68
+
69
+ ## Example workflows
70
+
71
+ Import these from the [`examples`](examples) folder (**Workflows → Import from File**), then pick
72
+ your Slatebox API credential in each Slatebox node:
73
+
74
+ - [`form-to-sticky-notes.json`](examples/form-to-sticky-notes.json): every answer to an n8n form
75
+ becomes a sticky note on a slate.
76
+ - [`outline-to-mind-map.json`](examples/outline-to-mind-map.json): a webhook receives meeting
77
+ notes as an outline, makes a mind map slate, and adds a "Review" row to a team board.
78
+ - [`new-slate-to-presentation.json`](examples/new-slate-to-presentation.json): each new slate of
79
+ yours gets a presentation.
80
+
81
+ ## Compatibility
82
+
83
+ Built and tested with n8n node API version 1 and `@n8n/node-cli` 0.58. Requires a Slatebox server
84
+ with the `/api/v1` API (Slatebox Cloud, or a self-hosted Slatebox of the same release). The
85
+ trigger lists slates newest made first (`GET /api/v1/slates?sort=created`), which arrives in the
86
+ same Slatebox release as the Zapier app; until a server has it, the trigger reports the server's
87
+ error. Only slates made after the trigger starts count as new: an old slate that is edited, moved
88
+ into the project or shared with you does not start the workflow.
89
+
90
+ Sign-in is by API token only for now: Slatebox has no sign-in (OAuth) client for n8n yet. The
91
+ trigger polls, because Slatebox does not yet offer webhooks for new slates.
92
+
93
+ ## Development
94
+
95
+ ```sh
96
+ npm install
97
+ npm run build
98
+ npm test # builds, then runs the tests (node:test, no network)
99
+ npm run lint # n8n's community node rules
100
+ npm run dev # n8n with these nodes loaded (needs Docker or Podman)
101
+ ```
102
+
103
+ The tests replace n8n's HTTP layer with recorded answers. Inside the Slatebox repository they also
104
+ check every request body against the app's API description
105
+ (`web/app/server/actions/generated/openapi.json`) and read every outline back with the app's
106
+ Mermaid reader.
107
+
108
+ This package is not an npm workspace of the Slatebox repository (the root `package.json` excludes
109
+ it), so its tooling never enters the app's install.
110
+
111
+ ## Publishing (maintainers)
112
+
113
+ n8n verifies only packages published from GitHub Actions with npm provenance. The workflow is
114
+ [`.github/workflows/n8n-nodes-slatebox-publish.yml`](../../.github/workflows/n8n-nodes-slatebox-publish.yml)
115
+ in the repository root. It publishes when a tag `n8n-nodes-slatebox@X.Y.Z` is pushed, after
116
+ checking that the tag matches `package.json` and running lint, build and tests.
117
+
118
+ One-time setup (owner). npm signs the workflow in with Trusted Publishing (GitHub Actions OIDC):
119
+ there is no npm token and no one-time password. npm can only add a trusted publisher to a package
120
+ that already exists, so:
121
+
122
+ 1. Publish the first version by hand, from a clean checkout of `main` in this folder:
123
+ `npm ci && npm test && RELEASE_MODE=true npm publish --access public` (npm asks for the
124
+ one-time password). That version has no provenance; n8n verifies the next one.
125
+ 2. On npmjs.com, open the package, **Settings → Trusted Publisher → GitHub Actions**:
126
+ organization or user `Slatebox`, repository `slatebox`, workflow filename
127
+ `n8n-nodes-slatebox-publish.yml`, environment empty. A new trusted publisher expires unless it
128
+ publishes within 2 days, so add it just before pushing the next release tag.
129
+ 3. Then, under **Settings → Publishing access**, require two-factor authentication and disallow
130
+ tokens.
131
+
132
+ Each release:
133
+
134
+ 1. Bump `version` in `package.json` and add a `CHANGELOG.md` entry; ship it to main.
135
+ 2. Push the tag `n8n-nodes-slatebox@X.Y.Z` on that commit. The workflow publishes it.
136
+ 3. Check the published package: `npx @n8n/scan-community-package n8n-nodes-slatebox`.
137
+ 4. Submit it for verification at [creators.n8n.io/nodes](https://creators.n8n.io/nodes). n8n's
138
+ review can take a few weeks. Once verified, it installs from the nodes panel on n8n Cloud too.
139
+
140
+ ## License
141
+
142
+ [MIT](LICENSE.md)
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class SlateboxApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: Icon;
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ authenticate: IAuthenticateGeneric;
9
+ test: ICredentialTestRequest;
10
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SlateboxApi = void 0;
4
+ class SlateboxApi {
5
+ constructor() {
6
+ this.name = 'slateboxApi';
7
+ this.displayName = 'Slatebox API';
8
+ this.icon = { light: 'file:slatebox.svg', dark: 'file:slatebox.dark.svg' };
9
+ this.documentationUrl = 'https://github.com/Slatebox/slatebox/tree/main/packages/n8n-nodes-slatebox#credentials';
10
+ this.properties = [
11
+ {
12
+ displayName: 'API Token',
13
+ name: 'apiToken',
14
+ type: 'string',
15
+ typeOptions: { password: true },
16
+ default: '',
17
+ required: true,
18
+ description: 'A personal API token. In Slatebox, open your profile, then Developer access, and create a token.',
19
+ },
20
+ {
21
+ displayName: 'Server Address',
22
+ name: 'baseUrl',
23
+ type: 'string',
24
+ default: 'https://app.slatebox.com',
25
+ required: true,
26
+ description: 'Where your Slatebox runs. Keep the default for Slatebox Cloud, or enter the address of your own Slatebox.',
27
+ },
28
+ ];
29
+ this.authenticate = {
30
+ type: 'generic',
31
+ properties: {
32
+ headers: {
33
+ Authorization: '=Bearer {{$credentials.apiToken}}',
34
+ },
35
+ },
36
+ };
37
+ this.test = {
38
+ request: {
39
+ baseURL: '={{$credentials.baseUrl.replace(/\\/+$/, "")}}/api/v1',
40
+ url: '/me',
41
+ method: 'GET',
42
+ },
43
+ };
44
+ }
45
+ }
46
+ exports.SlateboxApi = SlateboxApi;
47
+ //# sourceMappingURL=SlateboxApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlateboxApi.credentials.js","sourceRoot":"","sources":["../../credentials/SlateboxApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QAErB,gBAAW,GAAG,cAAc,CAAC;QAE7B,SAAI,GAAS,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;QAE5E,qBAAgB,GACf,wFAAwF,CAAC;QAE1F,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EACV,kGAAkG;aACnG;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,0BAA0B;gBACnC,QAAQ,EAAE,IAAI;gBACd,WAAW,EACV,2GAA2G;aAC5G;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,mCAAmC;iBAClD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,uDAAuD;gBAChE,GAAG,EAAE,KAAK;gBACV,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAhDD,kCAgDC"}
@@ -0,0 +1,10 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60">
2
+ <rect width="60" height="60" rx="12" fill="#2f5a4c" stroke="#fbcc88" stroke-opacity="0.35" stroke-width="1"/>
3
+ <g transform="translate(30 30) scale(0.86)" fill="#fbcc88">
4
+ <path d="M 16.489 15.372 L 1.596 15.372 L 1.596 22.819 L 16.489 22.819 Z"/>
5
+ <path d="M -1.596 -18.032 L -16.489 -18.032 L -16.489 -10.585 L -1.596 -10.585 Z"/>
6
+ <path d="M 16.489 -2.606 L 1.596 -2.606 L 1.596 12.287 L 16.489 12.287 Z"/>
7
+ <path d="M -1.596 -7.394 L -25 -7.394 L -25 13.883 L -1.596 13.883 Z"/>
8
+ <path d="M 25 -22.819 L 1.596 -22.819 L 1.596 -5.798 L 25 -5.798 Z"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,10 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60">
2
+ <rect width="60" height="60" rx="12" fill="#24443a"/>
3
+ <g transform="translate(30 30) scale(0.86)" fill="#fbcc88">
4
+ <path d="M 16.489 15.372 L 1.596 15.372 L 1.596 22.819 L 16.489 22.819 Z"/>
5
+ <path d="M -1.596 -18.032 L -16.489 -18.032 L -16.489 -10.585 L -1.596 -10.585 Z"/>
6
+ <path d="M 16.489 -2.606 L 1.596 -2.606 L 1.596 12.287 L 16.489 12.287 Z"/>
7
+ <path d="M -1.596 -7.394 L -25 -7.394 L -25 13.883 L -1.596 13.883 Z"/>
8
+ <path d="M 25 -22.819 L 1.596 -22.819 L 1.596 -5.798 L 25 -5.798 Z"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,35 @@
1
+ import type { IDataObject, IExecuteFunctions, IHttpRequestMethods, ILoadOptionsFunctions, IPollFunctions } from 'n8n-workflow';
2
+ type SlateboxContext = IExecuteFunctions | IPollFunctions | ILoadOptionsFunctions;
3
+ export declare const CREDENTIAL = "slateboxApi";
4
+ export declare function apiBase(baseUrl: unknown): string;
5
+ export declare function idempotencyKey(): string;
6
+ export declare function slateboxErrorOf(error: unknown): {
7
+ code?: string;
8
+ message?: string;
9
+ details?: IDataObject;
10
+ };
11
+ export declare function slateboxApiRequest(this: SlateboxContext, method: IHttpRequestMethods, path: string, body?: IDataObject, qs?: IDataObject, headers?: IDataObject): Promise<IDataObject>;
12
+ export declare function mermaidLabel(text: string): string;
13
+ export declare function outlineToMermaid(title: string, outline: string): string;
14
+ export declare function noteLines(text: string): string[];
15
+ export declare function stickyNotesPlan(texts: string[], options?: {
16
+ color?: string;
17
+ nextTo?: string;
18
+ prefix?: string;
19
+ }): IDataObject;
20
+ export interface BoardRef {
21
+ id?: string;
22
+ title?: string;
23
+ kind?: string;
24
+ revision?: number;
25
+ }
26
+ export declare function pickBoard(slate: IDataObject, boardId?: string): {
27
+ boardId?: string;
28
+ revision: number;
29
+ };
30
+ export declare function boardRowPlan(lane: string, label: string, revision: number, extra?: {
31
+ boardId?: string;
32
+ amount?: number;
33
+ }): IDataObject;
34
+ export declare function shareIdOf(value: string): string;
35
+ export {};
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CREDENTIAL = void 0;
4
+ exports.apiBase = apiBase;
5
+ exports.idempotencyKey = idempotencyKey;
6
+ exports.slateboxErrorOf = slateboxErrorOf;
7
+ exports.slateboxApiRequest = slateboxApiRequest;
8
+ exports.mermaidLabel = mermaidLabel;
9
+ exports.outlineToMermaid = outlineToMermaid;
10
+ exports.noteLines = noteLines;
11
+ exports.stickyNotesPlan = stickyNotesPlan;
12
+ exports.pickBoard = pickBoard;
13
+ exports.boardRowPlan = boardRowPlan;
14
+ exports.shareIdOf = shareIdOf;
15
+ const n8n_workflow_1 = require("n8n-workflow");
16
+ exports.CREDENTIAL = 'slateboxApi';
17
+ function apiBase(baseUrl) {
18
+ const origin = `${baseUrl || 'https://app.slatebox.com'}`.trim().replace(/\/+$/, '');
19
+ return `${origin}/api/v1`;
20
+ }
21
+ function idempotencyKey() {
22
+ return `n8n-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
23
+ }
24
+ function slateboxErrorOf(error) {
25
+ var _a, _b, _c, _d, _e, _f, _g;
26
+ const err = error;
27
+ const candidates = [
28
+ (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.body,
29
+ (_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.data,
30
+ (_d = (_c = err === null || err === void 0 ? void 0 : err.cause) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.body,
31
+ (_f = (_e = err === null || err === void 0 ? void 0 : err.cause) === null || _e === void 0 ? void 0 : _e.response) === null || _f === void 0 ? void 0 : _f.data,
32
+ err === null || err === void 0 ? void 0 : err.error,
33
+ err === null || err === void 0 ? void 0 : err.description,
34
+ ];
35
+ for (let body of candidates) {
36
+ if (typeof body === 'string') {
37
+ try {
38
+ body = JSON.parse(body);
39
+ }
40
+ catch {
41
+ continue;
42
+ }
43
+ }
44
+ const inner = body === null || body === void 0 ? void 0 : body.error;
45
+ if (inner && typeof inner === 'object' && typeof inner.message === 'string') {
46
+ return {
47
+ code: typeof inner.code === 'string' ? inner.code : undefined,
48
+ message: inner.message,
49
+ details: (_g = inner.details) !== null && _g !== void 0 ? _g : undefined,
50
+ };
51
+ }
52
+ }
53
+ return {};
54
+ }
55
+ async function slateboxApiRequest(method, path, body, qs, headers) {
56
+ var _a;
57
+ const credentials = await this.getCredentials(exports.CREDENTIAL);
58
+ const options = {
59
+ method,
60
+ url: `${apiBase(credentials.baseUrl)}${path}`,
61
+ headers: { Accept: 'application/json', ...(headers !== null && headers !== void 0 ? headers : {}) },
62
+ json: true,
63
+ };
64
+ if (body !== undefined)
65
+ options.body = body;
66
+ if (qs && Object.keys(qs).length)
67
+ options.qs = qs;
68
+ if (method !== 'GET' &&
69
+ method !== 'DELETE' &&
70
+ !options.headers['Idempotency-Key']) {
71
+ options.headers['Idempotency-Key'] = idempotencyKey();
72
+ }
73
+ try {
74
+ return (await this.helpers.httpRequestWithAuthentication.call(this, exports.CREDENTIAL, options));
75
+ }
76
+ catch (error) {
77
+ const found = slateboxErrorOf(error);
78
+ const apiError = new n8n_workflow_1.NodeApiError(this.getNode(), error, {
79
+ message: (_a = found.message) !== null && _a !== void 0 ? _a : error.message,
80
+ description: found.code ? `Slatebox answered ${found.code}` : undefined,
81
+ });
82
+ if (found.code)
83
+ apiError.context.slateboxCode = found.code;
84
+ throw apiError;
85
+ }
86
+ }
87
+ const CODES = [
88
+ ['#', '#35;'],
89
+ ['"', '#quot;'],
90
+ ['&', '#amp;'],
91
+ ['<', '#lt;'],
92
+ ['>', '#gt;'],
93
+ ['`', '#96;'],
94
+ ['|', '#124;'],
95
+ ['%', '#37;'],
96
+ ['\\', '#92;'],
97
+ ];
98
+ function mermaidLabel(text) {
99
+ let out = `${text !== null && text !== void 0 ? text : ''}`.replace(/\r\n?/g, '\n');
100
+ for (const [from, to] of CODES)
101
+ out = out.split(from).join(to);
102
+ out = out.replace(/\n/g, '<br>');
103
+ out = out.replace(/style/g, '#115;tyle').replace(/classDef/g, '#99;lassDef');
104
+ return `"${out.trim() === '' ? ' ' : out}"`;
105
+ }
106
+ const BULLET = /^(?:[-*+•]|\d+[.)])\s+/;
107
+ function outlineToMermaid(title, outline) {
108
+ const lines = `${outline !== null && outline !== void 0 ? outline : ''}`.replace(/\r\n?/g, '\n').split('\n');
109
+ const out = ['mindmap', ` ${mermaidLabel(title.trim() || 'Outline')}`];
110
+ const stack = [];
111
+ let ideas = 0;
112
+ for (const raw of lines) {
113
+ const expanded = raw.replace(/\t/g, ' ');
114
+ const text = expanded.trim().replace(BULLET, '').trim();
115
+ if (!text)
116
+ continue;
117
+ const indent = expanded.length - expanded.trimStart().length;
118
+ while (stack.length && stack[stack.length - 1] >= indent)
119
+ stack.pop();
120
+ stack.push(indent);
121
+ ideas += 1;
122
+ out.push(`${' '.repeat(stack.length + 1)}${mermaidLabel(text)}`);
123
+ }
124
+ if (!ideas)
125
+ throw new Error('The outline has no ideas: write one idea per line.');
126
+ return out.join('\n');
127
+ }
128
+ function noteLines(text) {
129
+ return `${text !== null && text !== void 0 ? text : ''}`
130
+ .replace(/\r\n?/g, '\n')
131
+ .split('\n')
132
+ .map((line) => line.trim().replace(BULLET, '').trim())
133
+ .filter(Boolean);
134
+ }
135
+ function stickyNotesPlan(texts, options = {}) {
136
+ var _a;
137
+ const prefix = (_a = options.prefix) !== null && _a !== void 0 ? _a : `n8n${Math.random().toString(36).slice(2, 8)}`;
138
+ const operations = texts.map((text, index) => {
139
+ const id = `${prefix}-${index + 1}`;
140
+ const op = { kind: 'add_nodes', count: 1, ids: [id], preset: 'sticky', text };
141
+ const relativeTo = index === 0 ? options.nextTo : `${prefix}-${index}`;
142
+ if (relativeTo)
143
+ op.placement = { relativeTo, direction: 'right', arrangement: 'row', gap: 24 };
144
+ if (options.color)
145
+ op.style = { backgroundColor: options.color };
146
+ return op;
147
+ });
148
+ return {
149
+ message: `Add ${texts.length} sticky note${texts.length === 1 ? '' : 's'}.`,
150
+ operations,
151
+ };
152
+ }
153
+ function pickBoard(slate, boardId) {
154
+ var _a, _b;
155
+ const boards = (Array.isArray(slate.boards) ? slate.boards : []);
156
+ const workshop = slate.workshop;
157
+ if (boardId) {
158
+ const board = boards.find((b) => b.id === boardId || b.title === boardId);
159
+ if (!board) {
160
+ throw new Error(`This slate has no board "${boardId}". Its boards: ${boards.map((b) => `${b.id} (${b.title})`).join(', ') || 'none'}.`);
161
+ }
162
+ return { boardId: board.id, revision: Number((_a = board.revision) !== null && _a !== void 0 ? _a : 0) };
163
+ }
164
+ if (boards.length > 1) {
165
+ throw new Error(`This slate holds ${boards.length} boards; say which one in Board. Its boards: ${boards
166
+ .map((b) => `${b.id} (${b.title})`)
167
+ .join(', ')}.`);
168
+ }
169
+ if (boards.length === 1)
170
+ return { boardId: undefined, revision: Number((_b = boards[0].revision) !== null && _b !== void 0 ? _b : 0) };
171
+ if (workshop && typeof workshop.revision === 'number')
172
+ return { revision: workshop.revision };
173
+ throw new Error('This slate has no board. Add a board (for example a team board) first.');
174
+ }
175
+ function boardRowPlan(lane, label, revision, extra = {}) {
176
+ const edit = { kind: 'add_card', lane, label };
177
+ if (typeof extra.amount === 'number' && Number.isFinite(extra.amount))
178
+ edit.amount = extra.amount;
179
+ const op = { kind: 'workshop_edits', expectedRevision: revision, edits: [edit] };
180
+ if (extra.boardId)
181
+ op.boardId = extra.boardId;
182
+ return { message: `Add "${label}" to ${lane}.`, operations: [op] };
183
+ }
184
+ function shareIdOf(value) {
185
+ const text = `${value !== null && value !== void 0 ? value : ''}`.trim();
186
+ const match = text.match(/\/canvas\/([A-Za-z0-9_-]+)/);
187
+ return match ? match[1] : text;
188
+ }
189
+ //# sourceMappingURL=GenericFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Slatebox/GenericFunctions.ts"],"names":[],"mappings":";;;AAgBA,0BAGC;AAOD,wCAEC;AAGD,0CAgCC;AAED,gDAwCC;AAkBD,oCAMC;AAQD,4CAiBC;AAGD,8BAMC;AAGD,0CAiBC;AAaD,8BAyBC;AAGD,oCAWC;AAGD,8BAIC;AAzOD,+CAA4C;AAI/B,QAAA,UAAU,GAAG,aAAa,CAAC;AAGxC,SAAgB,OAAO,CAAC,OAAgB;IACvC,MAAM,MAAM,GAAG,GAAI,OAAkB,IAAI,0BAA0B,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACjG,OAAO,GAAG,MAAM,SAAS,CAAC;AAC3B,CAAC;AAOD,SAAgB,cAAc;IAC7B,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAA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G,KAAK,CAAC,OAAO,CAAC;IAC9C,OAAO,EAAE,OAAO,EAAE,QAAQ,KAAK,QAAQ,IAAI,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpE,CAAC;AAGD,SAAgB,SAAS,CAAC,KAAa;IACtC,MAAM,IAAI,GAAG,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACvD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAChC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodeListSearchResult, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class Slatebox implements INodeType {
3
+ description: INodeTypeDescription;
4
+ methods: {
5
+ listSearch: {
6
+ searchSlates(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
7
+ };
8
+ };
9
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
10
+ }