n8n-nodes-vestaboard-note 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +74 -0
- package/dist/credentials/VestaboardCloudApi.credentials.d.ts +10 -0
- package/dist/credentials/VestaboardCloudApi.credentials.js +39 -0
- package/dist/credentials/VestaboardCloudApi.credentials.js.map +1 -0
- package/dist/nodes/VestaboardNote/VestaboardNote.node.d.ts +5 -0
- package/dist/nodes/VestaboardNote/VestaboardNote.node.js +237 -0
- package/dist/nodes/VestaboardNote/VestaboardNote.node.js.map +1 -0
- package/dist/nodes/VestaboardNote/VestaboardNote.node.json +18 -0
- package/dist/nodes/VestaboardNote/api.d.ts +6 -0
- package/dist/nodes/VestaboardNote/api.js +91 -0
- package/dist/nodes/VestaboardNote/api.js.map +1 -0
- package/dist/nodes/VestaboardNote/characterCodes.d.ts +11 -0
- package/dist/nodes/VestaboardNote/characterCodes.js +99 -0
- package/dist/nodes/VestaboardNote/characterCodes.js.map +1 -0
- package/dist/nodes/VestaboardNote/render.d.ts +2 -0
- package/dist/nodes/VestaboardNote/render.js +56 -0
- package/dist/nodes/VestaboardNote/render.js.map +1 -0
- package/dist/nodes/VestaboardNote/types.d.ts +12 -0
- package/dist/nodes/VestaboardNote/types.js +3 -0
- package/dist/nodes/VestaboardNote/types.js.map +1 -0
- package/dist/nodes/VestaboardNote/vestaboardNote.dark.svg +14 -0
- package/dist/nodes/VestaboardNote/vestaboardNote.svg +14 -0
- package/dist/package.json +63 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +63 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Irving Derin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# n8n-nodes-vestaboard-note
|
|
2
|
+
|
|
3
|
+
This is an n8n community node for controlling a single Vestaboard Note through the Vestaboard Cloud API.
|
|
4
|
+
|
|
5
|
+
It formats plain text or VBML for the Note's 3x15 display, sends the exact rendered character matrix, retrieves the current display, and creates a simple SVG grid preview without changing the board.
|
|
6
|
+
|
|
7
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
|
|
8
|
+
|
|
9
|
+
[Installation](#installation)
|
|
10
|
+
[Operations](#operations)
|
|
11
|
+
[Credentials](#credentials)
|
|
12
|
+
[Compatibility](#compatibility)
|
|
13
|
+
[Usage](#usage)
|
|
14
|
+
[Resources](#resources)
|
|
15
|
+
[Version history](#version-history)
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
20
|
+
|
|
21
|
+
## Operations
|
|
22
|
+
|
|
23
|
+
- **Get Current** retrieves the Note's current 3x15 character matrix and decoded text.
|
|
24
|
+
- **Render** converts plain text, VBML, or a raw matrix into the exact 3x15 matrix and an SVG preview without changing the Note.
|
|
25
|
+
- **Send** converts plain text, VBML, or a raw matrix into a 3x15 matrix and sends that exact matrix to the Note.
|
|
26
|
+
|
|
27
|
+
## Credentials
|
|
28
|
+
|
|
29
|
+
Create a Cloud API token in the API tab at [web.vestaboard.com](https://web.vestaboard.com/) or in the Vestaboard mobile app under **Settings > Advanced Settings**.
|
|
30
|
+
|
|
31
|
+
The token needs:
|
|
32
|
+
|
|
33
|
+
- **Read** permission for Get Current and the credential test.
|
|
34
|
+
- **Write** permission for Send.
|
|
35
|
+
|
|
36
|
+
Store the token in the **Vestaboard Cloud API** credential in n8n. The token is sent only in the `X-Vestaboard-Token` header to `https://cloud.vestaboard.com`.
|
|
37
|
+
|
|
38
|
+
## Compatibility
|
|
39
|
+
|
|
40
|
+
This package targets n8n 2.x and Node.js 22 or newer. It uses version 1 of the n8n community-node API.
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
### Exact previews
|
|
45
|
+
|
|
46
|
+
Text and VBML are first composed into a 3x15 character matrix. Render previews that matrix, and Send transmits the same matrix, so formatting does not change between preview and delivery.
|
|
47
|
+
|
|
48
|
+
### Input modes
|
|
49
|
+
|
|
50
|
+
- **Plain Text** uses Vestaboard's format endpoint with 3 rows and 15 columns.
|
|
51
|
+
- **VBML** accepts a complete VBML object. The node enforces a 3x15 output size while preserving components, props, and other options.
|
|
52
|
+
- **Character Matrix** accepts exactly three arrays of fifteen integer character codes from 0 through 71.
|
|
53
|
+
|
|
54
|
+
### Preview output
|
|
55
|
+
|
|
56
|
+
Render returns normal JSON containing `characters` and `decodedText`, plus a binary property named `preview` containing `vestaboard-note.svg`.
|
|
57
|
+
|
|
58
|
+
### Rate limit
|
|
59
|
+
|
|
60
|
+
Vestaboard may drop messages sent more frequently than once every 15 seconds. Space Send executions accordingly.
|
|
61
|
+
|
|
62
|
+
_By the time users are looking for community nodes, they probably already know n8n basics. But if you expect new users, you can link to the [Try it out](https://docs.n8n.io/try-it-out/) documentation to help them get started._
|
|
63
|
+
|
|
64
|
+
## Resources
|
|
65
|
+
|
|
66
|
+
- [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
67
|
+
- [Vestaboard Cloud API](https://docs.vestaboard.com/docs/read-write-api/introduction/)
|
|
68
|
+
- [Vestaboard endpoints](https://docs.vestaboard.com/docs/read-write-api/endpoints/)
|
|
69
|
+
- [VBML](https://docs.vestaboard.com/docs/vbml/)
|
|
70
|
+
- [Vestaboard character codes](https://docs.vestaboard.com/docs/charactercodes/)
|
|
71
|
+
|
|
72
|
+
## Version history
|
|
73
|
+
|
|
74
|
+
- **0.1.0**: Initial development release with Get Current, Render, and Send operations for a single Vestaboard Note.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class VestaboardCloudApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
icon: "file:../nodes/VestaboardNote/vestaboardNote.svg";
|
|
6
|
+
documentationUrl: string;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VestaboardCloudApi = void 0;
|
|
4
|
+
class VestaboardCloudApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'vestaboardCloudApi';
|
|
7
|
+
this.displayName = 'Vestaboard Cloud API';
|
|
8
|
+
this.icon = 'file:../nodes/VestaboardNote/vestaboardNote.svg';
|
|
9
|
+
this.documentationUrl = 'https://docs.vestaboard.com/docs/read-write-api/authentication/';
|
|
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 board-specific Cloud API token with Read and Write permissions',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
this.authenticate = {
|
|
22
|
+
type: 'generic',
|
|
23
|
+
properties: {
|
|
24
|
+
headers: {
|
|
25
|
+
'X-Vestaboard-Token': '={{$credentials.apiToken}}',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
this.test = {
|
|
30
|
+
request: {
|
|
31
|
+
baseURL: 'https://cloud.vestaboard.com',
|
|
32
|
+
url: '/',
|
|
33
|
+
method: 'GET',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.VestaboardCloudApi = VestaboardCloudApi;
|
|
39
|
+
//# sourceMappingURL=VestaboardCloudApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VestaboardCloudApi.credentials.js","sourceRoot":"","sources":["../../credentials/VestaboardCloudApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,kBAAkB;IAA/B;QACC,SAAI,GAAG,oBAAoB,CAAC;QAE5B,gBAAW,GAAG,sBAAsB,CAAC;QAErC,SAAI,GAAG,iDAA0D,CAAC;QAElE,qBAAgB,GAAG,iEAAiE,CAAC;QAErF,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,EAAE,kEAAkE;aAC/E;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,oBAAoB,EAAE,4BAA4B;iBAClD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,8BAA8B;gBACvC,GAAG,EAAE,GAAG;gBACR,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AArCD,gDAqCC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class VestaboardNote implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VestaboardNote = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const api_1 = require("./api");
|
|
6
|
+
const characterCodes_1 = require("./characterCodes");
|
|
7
|
+
const render_1 = require("./render");
|
|
8
|
+
const EMPTY_MATRIX = JSON.stringify(Array.from({ length: 3 }, () => Array(15).fill(0)));
|
|
9
|
+
async function compileMessage(context, itemIndex, inputMode) {
|
|
10
|
+
if (inputMode === 'text') {
|
|
11
|
+
const message = context.getNodeParameter('message', itemIndex);
|
|
12
|
+
return await (0, api_1.formatText)(context, message, itemIndex);
|
|
13
|
+
}
|
|
14
|
+
if (inputMode === 'vbml') {
|
|
15
|
+
const vbml = context.getNodeParameter('vbml', itemIndex);
|
|
16
|
+
return await (0, api_1.composeVbml)(context, vbml, itemIndex);
|
|
17
|
+
}
|
|
18
|
+
const rawCharacters = context.getNodeParameter('characters', itemIndex);
|
|
19
|
+
return (0, characterCodes_1.validateCharacterMatrix)((0, characterCodes_1.parseJsonParameter)(rawCharacters, 'Character matrix', context.getNode(), itemIndex), context.getNode(), itemIndex);
|
|
20
|
+
}
|
|
21
|
+
class VestaboardNote {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.description = {
|
|
24
|
+
displayName: 'Vestaboard Note',
|
|
25
|
+
name: 'vestaboardNote',
|
|
26
|
+
icon: { light: 'file:vestaboardNote.svg', dark: 'file:vestaboardNote.dark.svg' },
|
|
27
|
+
group: ['output'],
|
|
28
|
+
version: 1,
|
|
29
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
30
|
+
description: 'Send, retrieve, and preview messages on a Vestaboard Note',
|
|
31
|
+
usableAsTool: true,
|
|
32
|
+
defaults: {
|
|
33
|
+
name: 'Vestaboard Note',
|
|
34
|
+
},
|
|
35
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
36
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
37
|
+
credentials: [
|
|
38
|
+
{
|
|
39
|
+
name: 'vestaboardCloudApi',
|
|
40
|
+
required: true,
|
|
41
|
+
displayOptions: {
|
|
42
|
+
show: {
|
|
43
|
+
operation: ['get', 'send'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
properties: [
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Resource',
|
|
51
|
+
name: 'resource',
|
|
52
|
+
type: 'options',
|
|
53
|
+
noDataExpression: true,
|
|
54
|
+
options: [{ name: 'Display', value: 'display' }],
|
|
55
|
+
default: 'display',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
displayName: 'Operation',
|
|
59
|
+
name: 'operation',
|
|
60
|
+
type: 'options',
|
|
61
|
+
noDataExpression: true,
|
|
62
|
+
displayOptions: {
|
|
63
|
+
show: {
|
|
64
|
+
resource: ['display'],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
options: [
|
|
68
|
+
{
|
|
69
|
+
name: 'Get Current',
|
|
70
|
+
value: 'get',
|
|
71
|
+
description: 'Retrieve the message currently displayed on the Note',
|
|
72
|
+
action: 'Get the current message',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'Render',
|
|
76
|
+
value: 'render',
|
|
77
|
+
description: 'Create a 3x15 SVG preview without changing the Note',
|
|
78
|
+
action: 'Render a message',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'Send',
|
|
82
|
+
value: 'send',
|
|
83
|
+
description: 'Send a message to the Note',
|
|
84
|
+
action: 'Send a message',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
default: 'send',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
displayName: 'Input Mode',
|
|
91
|
+
name: 'inputMode',
|
|
92
|
+
type: 'options',
|
|
93
|
+
noDataExpression: true,
|
|
94
|
+
displayOptions: {
|
|
95
|
+
show: {
|
|
96
|
+
operation: ['render', 'send'],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
options: [
|
|
100
|
+
{
|
|
101
|
+
name: 'Character Matrix',
|
|
102
|
+
value: 'characters',
|
|
103
|
+
description: 'Provide an exact 3x15 array of Vestaboard character codes',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'Plain Text',
|
|
107
|
+
value: 'text',
|
|
108
|
+
description: 'Let Vestaboard format plain text for the Note',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'VBML',
|
|
112
|
+
value: 'vbml',
|
|
113
|
+
description: 'Compose a Vestaboard Markup Language payload for the Note',
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
default: 'text',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
displayName: 'Message',
|
|
120
|
+
name: 'message',
|
|
121
|
+
type: 'string',
|
|
122
|
+
typeOptions: { rows: 3 },
|
|
123
|
+
displayOptions: {
|
|
124
|
+
show: {
|
|
125
|
+
operation: ['render', 'send'],
|
|
126
|
+
inputMode: ['text'],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
default: '',
|
|
130
|
+
required: true,
|
|
131
|
+
placeholder: 'Hello from n8n',
|
|
132
|
+
description: 'Plain text to format into the Note\'s 3x15 display',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
displayName: 'VBML',
|
|
136
|
+
name: 'vbml',
|
|
137
|
+
type: 'json',
|
|
138
|
+
displayOptions: {
|
|
139
|
+
show: {
|
|
140
|
+
operation: ['render', 'send'],
|
|
141
|
+
inputMode: ['vbml'],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
default: '{"components":[{"template":"Hello from n8n"}]}',
|
|
145
|
+
required: true,
|
|
146
|
+
description: 'A complete VBML object; output dimensions are always forced to 3x15',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
displayName: 'Character Matrix',
|
|
150
|
+
name: 'characters',
|
|
151
|
+
type: 'json',
|
|
152
|
+
displayOptions: {
|
|
153
|
+
show: {
|
|
154
|
+
operation: ['render', 'send'],
|
|
155
|
+
inputMode: ['characters'],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
default: EMPTY_MATRIX,
|
|
159
|
+
required: true,
|
|
160
|
+
description: 'Exactly three rows of fifteen integer character codes from 0 through 71',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
displayName: 'Force During Quiet Hours',
|
|
164
|
+
name: 'forced',
|
|
165
|
+
type: 'boolean',
|
|
166
|
+
displayOptions: {
|
|
167
|
+
show: {
|
|
168
|
+
operation: ['send'],
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
default: false,
|
|
172
|
+
description: 'Whether to override the quiet hours configured for the Note',
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
async execute() {
|
|
178
|
+
const items = this.getInputData();
|
|
179
|
+
const returnData = [];
|
|
180
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
181
|
+
try {
|
|
182
|
+
const operation = this.getNodeParameter('operation', itemIndex);
|
|
183
|
+
if (operation === 'get') {
|
|
184
|
+
const currentMessage = await (0, api_1.getCurrentMessage)(this, itemIndex);
|
|
185
|
+
returnData.push({
|
|
186
|
+
json: {
|
|
187
|
+
operation,
|
|
188
|
+
id: currentMessage.id,
|
|
189
|
+
characters: currentMessage.characters,
|
|
190
|
+
decodedText: (0, characterCodes_1.decodeCharacterMatrix)(currentMessage.characters),
|
|
191
|
+
},
|
|
192
|
+
pairedItem: { item: itemIndex },
|
|
193
|
+
});
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
const inputMode = this.getNodeParameter('inputMode', itemIndex);
|
|
197
|
+
const characters = await compileMessage(this, itemIndex, inputMode);
|
|
198
|
+
const decodedText = (0, characterCodes_1.decodeCharacterMatrix)(characters);
|
|
199
|
+
if (operation === 'render') {
|
|
200
|
+
const svg = (0, render_1.renderSvgGrid)(characters);
|
|
201
|
+
const preview = await this.helpers.prepareBinaryData(Buffer.from(svg, 'utf8'), 'vestaboard-note.svg', 'image/svg+xml');
|
|
202
|
+
returnData.push({
|
|
203
|
+
json: { operation, inputMode, characters, decodedText },
|
|
204
|
+
binary: { preview },
|
|
205
|
+
pairedItem: { item: itemIndex },
|
|
206
|
+
});
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if ((0, characterCodes_1.isBlankMatrix)(characters)) {
|
|
210
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Vestaboard Cloud API does not accept a blank message', { itemIndex });
|
|
211
|
+
}
|
|
212
|
+
const forced = this.getNodeParameter('forced', itemIndex, false);
|
|
213
|
+
const response = await (0, api_1.sendMessage)(this, characters, forced, itemIndex);
|
|
214
|
+
returnData.push({
|
|
215
|
+
json: { ...response, operation, inputMode, characters, decodedText },
|
|
216
|
+
pairedItem: { item: itemIndex },
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
if (this.continueOnFail()) {
|
|
221
|
+
returnData.push({
|
|
222
|
+
json: { error: error instanceof Error ? error.message : String(error) },
|
|
223
|
+
pairedItem: { item: itemIndex },
|
|
224
|
+
});
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (error instanceof n8n_workflow_1.NodeApiError) {
|
|
228
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { itemIndex });
|
|
229
|
+
}
|
|
230
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return [returnData];
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
exports.VestaboardNote = VestaboardNote;
|
|
237
|
+
//# sourceMappingURL=VestaboardNote.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VestaboardNote.node.js","sourceRoot":"","sources":["../../../nodes/VestaboardNote/VestaboardNote.node.ts"],"names":[],"mappings":";;;AAOA,+CAAqF;AAErF,+BAAgF;AAChF,qDAK0B;AAC1B,qCAAyC;AAGzC,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAExF,KAAK,UAAU,cAAc,CAC5B,OAA0B,EAC1B,SAAiB,EACjB,SAAoB;IAEpB,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QAC1B,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAW,CAAC;QACzE,OAAO,MAAM,IAAA,gBAAU,EAAC,OAAO,EAAE,OAAO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B,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBAED,IAAI,KAAK,YAAY,2BAAY,EAAE,CAAC;oBACnC,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAA8B,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;gBACvF,CAAC;gBAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAc,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YAC7E,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AArOD,wCAqOC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-vestaboard-note",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Communication", "Productivity"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://github.com/Scarzer/n8n-nodes-vestaboard-note#credentials"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://github.com/Scarzer/n8n-nodes-vestaboard-note#readme"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import type { CharacterMatrix, CurrentMessage, SendMessageResponse } from './types';
|
|
3
|
+
export declare function formatText(context: IExecuteFunctions, message: string, itemIndex: number): Promise<CharacterMatrix>;
|
|
4
|
+
export declare function composeVbml(context: IExecuteFunctions, vbmlValue: unknown, itemIndex: number): Promise<CharacterMatrix>;
|
|
5
|
+
export declare function getCurrentMessage(context: IExecuteFunctions, itemIndex: number): Promise<CurrentMessage>;
|
|
6
|
+
export declare function sendMessage(context: IExecuteFunctions, characters: CharacterMatrix, forced: boolean, itemIndex: number): Promise<SendMessageResponse>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatText = formatText;
|
|
4
|
+
exports.composeVbml = composeVbml;
|
|
5
|
+
exports.getCurrentMessage = getCurrentMessage;
|
|
6
|
+
exports.sendMessage = sendMessage;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
const characterCodes_1 = require("./characterCodes");
|
|
9
|
+
const CLOUD_API_URL = 'https://cloud.vestaboard.com';
|
|
10
|
+
async function publicApiRequest(context, method, path, body, itemIndex) {
|
|
11
|
+
try {
|
|
12
|
+
return await context.helpers.httpRequest({
|
|
13
|
+
method,
|
|
14
|
+
url: `${CLOUD_API_URL}${path}`,
|
|
15
|
+
body,
|
|
16
|
+
json: true,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw new n8n_workflow_1.NodeApiError(context.getNode(), error, { itemIndex });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function authenticatedApiRequest(context, method, body, itemIndex) {
|
|
24
|
+
const options = {
|
|
25
|
+
method,
|
|
26
|
+
url: `${CLOUD_API_URL}/`,
|
|
27
|
+
json: true,
|
|
28
|
+
};
|
|
29
|
+
if (body !== undefined) {
|
|
30
|
+
options.body = body;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
return await context.helpers.httpRequestWithAuthentication.call(context, 'vestaboardCloudApi', options);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
throw new n8n_workflow_1.NodeApiError(context.getNode(), error, { itemIndex });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function formatText(context, message, itemIndex) {
|
|
40
|
+
const response = await publicApiRequest(context, 'POST', '/vbml/format', { message, rows: characterCodes_1.NOTE_ROWS, columns: characterCodes_1.NOTE_COLUMNS }, itemIndex);
|
|
41
|
+
return (0, characterCodes_1.validateCharacterMatrix)(response, context.getNode(), itemIndex);
|
|
42
|
+
}
|
|
43
|
+
async function composeVbml(context, vbmlValue, itemIndex) {
|
|
44
|
+
const parsed = (0, characterCodes_1.parseJsonParameter)(vbmlValue, 'VBML', context.getNode(), itemIndex);
|
|
45
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
46
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), 'VBML must be a JSON object', { itemIndex });
|
|
47
|
+
}
|
|
48
|
+
const vbml = parsed;
|
|
49
|
+
if (!Array.isArray(vbml.components) || vbml.components.length === 0) {
|
|
50
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), 'VBML must contain at least one component', {
|
|
51
|
+
itemIndex,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const existingStyle = vbml.style !== null && typeof vbml.style === 'object' && !Array.isArray(vbml.style)
|
|
55
|
+
? vbml.style
|
|
56
|
+
: {};
|
|
57
|
+
const payload = {
|
|
58
|
+
...vbml,
|
|
59
|
+
style: {
|
|
60
|
+
...existingStyle,
|
|
61
|
+
height: characterCodes_1.NOTE_ROWS,
|
|
62
|
+
width: characterCodes_1.NOTE_COLUMNS,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
const response = await publicApiRequest(context, 'POST', '/vbml/compose', payload, itemIndex);
|
|
66
|
+
return (0, characterCodes_1.validateCharacterMatrix)(response, context.getNode(), itemIndex);
|
|
67
|
+
}
|
|
68
|
+
async function getCurrentMessage(context, itemIndex) {
|
|
69
|
+
const response = await authenticatedApiRequest(context, 'GET', undefined, itemIndex);
|
|
70
|
+
if (response === null || typeof response !== 'object' || Array.isArray(response)) {
|
|
71
|
+
throw new n8n_workflow_1.NodeApiError(context.getNode(), { message: 'Vestaboard returned an invalid current-message response' }, { itemIndex });
|
|
72
|
+
}
|
|
73
|
+
const currentMessage = response.currentMessage;
|
|
74
|
+
if (currentMessage === null || typeof currentMessage !== 'object' || Array.isArray(currentMessage)) {
|
|
75
|
+
throw new n8n_workflow_1.NodeApiError(context.getNode(), { message: 'Vestaboard response did not contain currentMessage' }, { itemIndex });
|
|
76
|
+
}
|
|
77
|
+
const message = currentMessage;
|
|
78
|
+
const layout = (0, characterCodes_1.parseJsonParameter)(message.layout, 'Current message layout', context.getNode(), itemIndex);
|
|
79
|
+
return {
|
|
80
|
+
id: typeof message.id === 'string' ? message.id : undefined,
|
|
81
|
+
characters: (0, characterCodes_1.validateCharacterMatrix)(layout, context.getNode(), itemIndex),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async function sendMessage(context, characters, forced, itemIndex) {
|
|
85
|
+
const response = await authenticatedApiRequest(context, 'POST', { characters, forced }, itemIndex);
|
|
86
|
+
if (response === null || typeof response !== 'object' || Array.isArray(response)) {
|
|
87
|
+
throw new n8n_workflow_1.NodeApiError(context.getNode(), { message: 'Vestaboard returned an invalid send response' }, { itemIndex });
|
|
88
|
+
}
|
|
89
|
+
return response;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../nodes/VestaboardNote/api.ts"],"names":[],"mappings":";;AA2DA,gCAcC;AAED,kCAsCC;AAED,8CAkCC;AAED,kCAsBC;AA5KD,+CAAgE;AAEhE,qDAK0B;AAG1B,MAAM,aAAa,GAAG,8BAA8B,CAAC;AAErD,KAAK,UAAU,gBAAgB,CAC9B,OAA0B,EAC1B,MAA2B,EAC3B,IAAY,EACZ,IAAY,EACZ,SAAiB;IAEjB,IAAI,CAAC;QACJ,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;YACxC,MAAM;YACN,GAAG,EAAE,GAAG,aAAa,GAAG,IAAI,EAAE;YAC9B,IAAI;YACJ,IAAI,EAAE,IAAI;SACV,CAAC,CAAC;IACJ,CAAC;IAA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QAAQ,KAAK,IAAI,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClF,MAAM,IAAI,2BAAY,CACrB,OAAO,CAAC,OAAO,EAAE,EACjB,EAAE,OAAO,EAAE,8CAA8C,EAAE,EAC3D,EAAE,SAAS,EAAE,CACb,CAAC;IACH,CAAC;IAED,OAAO,QAA+B,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { INode } from 'n8n-workflow';
|
|
2
|
+
import type { CharacterMatrix } from './types';
|
|
3
|
+
export declare const NOTE_ROWS = 3;
|
|
4
|
+
export declare const NOTE_COLUMNS = 15;
|
|
5
|
+
export declare const MIN_CHARACTER_CODE = 0;
|
|
6
|
+
export declare const MAX_CHARACTER_CODE = 71;
|
|
7
|
+
export declare function parseJsonParameter(value: unknown, label: string, node: INode, itemIndex: number): unknown;
|
|
8
|
+
export declare function validateCharacterMatrix(value: unknown, node: INode, itemIndex: number): CharacterMatrix;
|
|
9
|
+
export declare function decodeCharacterCode(code: number): string;
|
|
10
|
+
export declare function decodeCharacterMatrix(characters: CharacterMatrix): string;
|
|
11
|
+
export declare function isBlankMatrix(characters: CharacterMatrix): boolean;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAX_CHARACTER_CODE = exports.MIN_CHARACTER_CODE = exports.NOTE_COLUMNS = exports.NOTE_ROWS = void 0;
|
|
4
|
+
exports.parseJsonParameter = parseJsonParameter;
|
|
5
|
+
exports.validateCharacterMatrix = validateCharacterMatrix;
|
|
6
|
+
exports.decodeCharacterCode = decodeCharacterCode;
|
|
7
|
+
exports.decodeCharacterMatrix = decodeCharacterMatrix;
|
|
8
|
+
exports.isBlankMatrix = isBlankMatrix;
|
|
9
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
10
|
+
exports.NOTE_ROWS = 3;
|
|
11
|
+
exports.NOTE_COLUMNS = 15;
|
|
12
|
+
exports.MIN_CHARACTER_CODE = 0;
|
|
13
|
+
exports.MAX_CHARACTER_CODE = 71;
|
|
14
|
+
const CHARACTER_GLYPHS = {
|
|
15
|
+
0: ' ',
|
|
16
|
+
27: '1',
|
|
17
|
+
28: '2',
|
|
18
|
+
29: '3',
|
|
19
|
+
30: '4',
|
|
20
|
+
31: '5',
|
|
21
|
+
32: '6',
|
|
22
|
+
33: '7',
|
|
23
|
+
34: '8',
|
|
24
|
+
35: '9',
|
|
25
|
+
36: '0',
|
|
26
|
+
37: '!',
|
|
27
|
+
38: '@',
|
|
28
|
+
39: '#',
|
|
29
|
+
40: '$',
|
|
30
|
+
41: '(',
|
|
31
|
+
42: ')',
|
|
32
|
+
44: '-',
|
|
33
|
+
46: '+',
|
|
34
|
+
47: '&',
|
|
35
|
+
48: '=',
|
|
36
|
+
49: ';',
|
|
37
|
+
50: ':',
|
|
38
|
+
52: "'",
|
|
39
|
+
53: '"',
|
|
40
|
+
54: '%',
|
|
41
|
+
55: ',',
|
|
42
|
+
56: '.',
|
|
43
|
+
59: '/',
|
|
44
|
+
60: '?',
|
|
45
|
+
62: '♥',
|
|
46
|
+
63: '🟥',
|
|
47
|
+
64: '🟧',
|
|
48
|
+
65: '🟨',
|
|
49
|
+
66: '🟩',
|
|
50
|
+
67: '🟦',
|
|
51
|
+
68: '🟪',
|
|
52
|
+
69: '⬜',
|
|
53
|
+
70: '⬛',
|
|
54
|
+
71: '■',
|
|
55
|
+
};
|
|
56
|
+
for (let code = 1; code <= 26; code++) {
|
|
57
|
+
CHARACTER_GLYPHS[code] = String.fromCharCode(64 + code);
|
|
58
|
+
}
|
|
59
|
+
function parseJsonParameter(value, label, node, itemIndex) {
|
|
60
|
+
if (typeof value !== 'string') {
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
return JSON.parse(value);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
throw new n8n_workflow_1.NodeOperationError(node, `${label} must be valid JSON`, { itemIndex });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function validateCharacterMatrix(value, node, itemIndex) {
|
|
71
|
+
if (!Array.isArray(value) || value.length !== exports.NOTE_ROWS) {
|
|
72
|
+
throw new n8n_workflow_1.NodeOperationError(node, `Character matrix must contain exactly ${exports.NOTE_ROWS} rows`, { itemIndex });
|
|
73
|
+
}
|
|
74
|
+
return value.map((row, rowIndex) => {
|
|
75
|
+
if (!Array.isArray(row) || row.length !== exports.NOTE_COLUMNS) {
|
|
76
|
+
throw new n8n_workflow_1.NodeOperationError(node, `Character matrix row ${rowIndex + 1} must contain exactly ${exports.NOTE_COLUMNS} columns`, { itemIndex });
|
|
77
|
+
}
|
|
78
|
+
return row.map((code, columnIndex) => {
|
|
79
|
+
if (typeof code !== 'number' ||
|
|
80
|
+
!Number.isInteger(code) ||
|
|
81
|
+
code < exports.MIN_CHARACTER_CODE ||
|
|
82
|
+
code > exports.MAX_CHARACTER_CODE) {
|
|
83
|
+
throw new n8n_workflow_1.NodeOperationError(node, `Character at row ${rowIndex + 1}, column ${columnIndex + 1} must be an integer from ${exports.MIN_CHARACTER_CODE} through ${exports.MAX_CHARACTER_CODE}`, { itemIndex });
|
|
84
|
+
}
|
|
85
|
+
return code;
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function decodeCharacterCode(code) {
|
|
90
|
+
var _a;
|
|
91
|
+
return (_a = CHARACTER_GLYPHS[code]) !== null && _a !== void 0 ? _a : '�';
|
|
92
|
+
}
|
|
93
|
+
function decodeCharacterMatrix(characters) {
|
|
94
|
+
return characters.map((row) => row.map(decodeCharacterCode).join('')).join('\n');
|
|
95
|
+
}
|
|
96
|
+
function isBlankMatrix(characters) {
|
|
97
|
+
return characters.every((row) => row.every((code) => code === 0));
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=characterCodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"characterCodes.js","sourceRoot":"","sources":["../../../nodes/VestaboardNote/characterCodes.ts"],"names":[],"mappings":";;;AAyDA,gDAeC;AAED,0DAuCC;AAED,kDAEC;AAED,sDAEC;AAED,sCAEC;AA5HD,+CAAkD;AAIrC,QAAA,SAAS,GAAG,CAAC,CAAC;AACd,QAAA,YAAY,GAAG,EAAE,CAAC;AAClB,QAAA,kBAAkB,GAAG,CAAC,CAAC;AACvB,QAAA,kBAAkB,GAAG,EAAE,CAAC;AAErC,MAAM,gBAAgB,GAA2B;IAChD,CAAC,EAAE,GAAG;IACN,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE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