@bonsae/nrg 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.
Files changed (70) hide show
  1. package/README.md +130 -0
  2. package/build/server/index.cjs +910 -0
  3. package/build/server/resources/nrg-client.js +6530 -0
  4. package/build/server/resources/vue.esm-browser.prod.js +13 -0
  5. package/build/vite/index.js +1893 -0
  6. package/build/vite/utils.js +60 -0
  7. package/package.json +110 -0
  8. package/src/core/client/api/index.ts +17 -0
  9. package/src/core/client/app.vue +201 -0
  10. package/src/core/client/components/node-red-config-input.vue +57 -0
  11. package/src/core/client/components/node-red-editor-input.vue +283 -0
  12. package/src/core/client/components/node-red-input.vue +71 -0
  13. package/src/core/client/components/node-red-json-schema-form.vue +369 -0
  14. package/src/core/client/components/node-red-select-input.vue +86 -0
  15. package/src/core/client/components/node-red-typed-input.vue +130 -0
  16. package/src/core/client/components.d.ts +18 -0
  17. package/src/core/client/globals.d.ts +17 -0
  18. package/src/core/client/index.ts +504 -0
  19. package/src/core/client/shims-vue.d.ts +5 -0
  20. package/src/core/client/tsconfig.json +18 -0
  21. package/src/core/client/virtual.d.ts +5 -0
  22. package/src/core/constants.ts +18 -0
  23. package/src/core/server/index.ts +209 -0
  24. package/src/core/server/nodes/config-node.ts +67 -0
  25. package/src/core/server/nodes/index.ts +4 -0
  26. package/src/core/server/nodes/io-node.ts +178 -0
  27. package/src/core/server/nodes/node.ts +255 -0
  28. package/src/core/server/nodes/types/config-node.ts +28 -0
  29. package/src/core/server/nodes/types/index.ts +3 -0
  30. package/src/core/server/nodes/types/io-node.ts +37 -0
  31. package/src/core/server/nodes/types/node.ts +41 -0
  32. package/src/core/server/nodes/utils.ts +83 -0
  33. package/src/core/server/schemas/base.ts +66 -0
  34. package/src/core/server/schemas/index.ts +3 -0
  35. package/src/core/server/schemas/type.ts +95 -0
  36. package/src/core/server/schemas/types/index.ts +73 -0
  37. package/src/core/server/tsconfig.json +17 -0
  38. package/src/core/server/types/index.ts +73 -0
  39. package/src/core/server/utils.ts +56 -0
  40. package/src/core/server/validator.ts +32 -0
  41. package/src/core/validator.ts +222 -0
  42. package/src/tsconfig/base.json +23 -0
  43. package/src/tsconfig/client.json +11 -0
  44. package/src/tsconfig/server.json +6 -0
  45. package/src/vite/async-utils.ts +61 -0
  46. package/src/vite/client/build.ts +223 -0
  47. package/src/vite/client/index.ts +1 -0
  48. package/src/vite/client/plugins/html-generator.ts +75 -0
  49. package/src/vite/client/plugins/index.ts +5 -0
  50. package/src/vite/client/plugins/locales-generator.ts +126 -0
  51. package/src/vite/client/plugins/minifier.ts +22 -0
  52. package/src/vite/client/plugins/node-definitions-inliner.ts +224 -0
  53. package/src/vite/client/plugins/static-copy.ts +43 -0
  54. package/src/vite/defaults.ts +77 -0
  55. package/src/vite/errors.ts +37 -0
  56. package/src/vite/index.ts +3 -0
  57. package/src/vite/logger.ts +94 -0
  58. package/src/vite/node-red-launcher.ts +344 -0
  59. package/src/vite/plugin.ts +61 -0
  60. package/src/vite/plugins/build.ts +73 -0
  61. package/src/vite/plugins/index.ts +2 -0
  62. package/src/vite/plugins/server.ts +267 -0
  63. package/src/vite/server/build.ts +124 -0
  64. package/src/vite/server/index.ts +1 -0
  65. package/src/vite/server/plugins/index.ts +3 -0
  66. package/src/vite/server/plugins/output-wrapper.ts +109 -0
  67. package/src/vite/server/plugins/package-json-generator.ts +203 -0
  68. package/src/vite/server/plugins/type-generator.ts +285 -0
  69. package/src/vite/types.ts +369 -0
  70. package/src/vite/utils.ts +103 -0
@@ -0,0 +1,504 @@
1
+ import type { Component, App } from "vue";
2
+ import { createApp } from "vue";
3
+ import { cloneDeep, isEqual } from "es-toolkit";
4
+ import type { JSONSchemaType } from "ajv";
5
+ import NodeRedVueApp from "./app.vue";
6
+ import NodeRedInput from "./components/node-red-input.vue";
7
+ import NodeRedTypedInput from "./components/node-red-typed-input.vue";
8
+ import NodeRedConfigInput from "./components/node-red-config-input.vue";
9
+ import NodeRedSelectInput from "./components/node-red-select-input.vue";
10
+ import NodeRedEditorInput from "./components/node-red-editor-input.vue";
11
+ import NodeRedJsonSchemaForm from "./components/node-red-json-schema-form.vue";
12
+
13
+ const _schemas: Record<string, any> = {};
14
+ const _forms: Record<string, Component> = {};
15
+
16
+ function __setSchemas(schemas: Record<string, any>): void {
17
+ Object.assign(_schemas, schemas);
18
+ }
19
+
20
+ function __setForms(forms: Record<string, Component>): void {
21
+ Object.assign(_forms, forms);
22
+ }
23
+
24
+ interface NodeStateCredentials {
25
+ [key: string]: any;
26
+ }
27
+
28
+ interface NodeState {
29
+ credentials: NodeStateCredentials;
30
+ [key: string]: any;
31
+ }
32
+
33
+ interface Node {
34
+ id: string;
35
+ type: string;
36
+ name: string;
37
+ category: string;
38
+ x: string;
39
+ y: string;
40
+ g: string;
41
+ z: string;
42
+ credentials: Record<string, any>;
43
+ _def: {
44
+ defaults: Record<
45
+ string,
46
+ { value: string; type?: string; label?: string; required?: boolean }
47
+ >;
48
+ credentials: Record<
49
+ string,
50
+ {
51
+ value: string;
52
+ type?: "password" | "text";
53
+ label?: string;
54
+ required?: boolean;
55
+ }
56
+ >;
57
+ category: string;
58
+ color?: string;
59
+ icon?: string;
60
+ label?: ((this: Node) => string) | string;
61
+ inputs?: number;
62
+ outputs?: number;
63
+ paletteLabel?: ((this: Node) => string) | string;
64
+ labelStyle?: ((this: Node) => string) | string;
65
+ inputLabels?: ((this: Node) => string) | string;
66
+ outputLabels?: ((this: Node) => string) | string;
67
+ align?: "left" | "right";
68
+ button?: NodeButtonDefinition;
69
+ onPaletteAdd?: (this: Node) => void;
70
+ onPaletteRemove?: (this: Node) => void;
71
+ form: NodeFormDefinition;
72
+ };
73
+ _newState?: Node;
74
+ _app?: App | null;
75
+ _: (str: string) => string;
76
+ [key: string]: any;
77
+ }
78
+
79
+ /**
80
+ * Interface representing the button configuration for a Node.
81
+ *
82
+ * @interface NodeButtonDefinition
83
+ * @property {string} toggle - Text to display when toggling the button.
84
+ * @property {function(): void} onclick - Function to execute when the button is clicked.
85
+ * @property {function(): boolean} [enabled] - Function that determines whether the button should be
86
+ * enabled. Returns true if the button should be enabled, false otherwise.
87
+ * @property {function(): boolean} [visible] - Function that determines whether the button should be
88
+ * visible. Returns true if the button should be visible, false otherwise.
89
+ */
90
+ interface NodeButtonDefinition {
91
+ toggle: string;
92
+ onclick: () => void;
93
+ enabled?: () => boolean;
94
+ visible?: () => boolean;
95
+ }
96
+
97
+ /**
98
+ * Interface representing the form configuration for a Node.
99
+ *
100
+ * @interface NodeFormDefinition
101
+ * @property {Component} [component] - Vue 3 component.
102
+ */
103
+ interface NodeFormDefinition {
104
+ component?: Component;
105
+ }
106
+
107
+ /**
108
+ * Interface representing the Node options used during registration
109
+ *
110
+ * @type NodeDefinition
111
+ * @property {string} type - The unique identifier for this node type.
112
+ * @property {string} category - The category this node belongs to in the palette.
113
+ * @property {string} [color] - The color associated with this node, in hex format.
114
+ * @property {string} [icon] - The icon to display for this node.
115
+ * @property {(function(): string)|string} [label] - The label to display on the node. Can be a static string or a function returning a string.
116
+ * @property {number} [inputs] - Number of input ports the node should have.
117
+ * @property {number} [outputs] - Number of output ports the node should have.
118
+ * @property {(function(): string)|string} [paletteLabel] - The label to show in the palette. Can be a static string or a function returning a string.
119
+ * @property {(function(): string)|string} [labelStyle] - CSS style to apply to the node label. Can be a static string or a function returning a string.
120
+ * @property {(function(): string)|string} [inputLabels] - Labels for the input ports. Can be a static string or a function returning a string.
121
+ * @property {(function(): string)|string} [outputLabels] - Labels for the output ports. Can be a static string or a function returning a string.
122
+ * @property {"left"|"right"} [align] - Alignment of the node content.
123
+ * @property {NodeButtonDefinition} [button] - Configuration for a button on the node.
124
+ * @property {function(): void} [onPaletteAdd] - Function called when the node is added to the palette.
125
+ * @property {function(): void} [onPaletteRemove] - Function called when the node is removed from the palette.
126
+ * @property {NodeFormDefinition} form - The form component to use for configuring the node.
127
+ * @property {JSONSchemaType} [schema] - Schema definition for validation.
128
+ */
129
+ interface NodeDefinition {
130
+ type: string;
131
+ category?: string;
132
+ color?: string;
133
+ icon?: ((this: Node) => string) | string;
134
+ label?: ((this: Node) => string) | string;
135
+ inputs?: number;
136
+ outputs?: number;
137
+ paletteLabel?: ((this: Node) => string) | string;
138
+ labelStyle?: ((this: Node) => string) | string;
139
+ inputLabels?: ((this: Node) => string) | string;
140
+ outputLabels?: ((this: Node) => string) | string;
141
+ align?: "left" | "right";
142
+ button?: NodeButtonDefinition;
143
+ onEditResize?: (this: Node, size: { width: number; height: number }) => void;
144
+ onPaletteAdd?: (this: Node) => void;
145
+ onPaletteRemove?: (this: Node) => void;
146
+ form?: NodeFormDefinition;
147
+ }
148
+
149
+ interface NodeFeatures {
150
+ hasInputSchema: boolean;
151
+ hasOutputSchema: boolean;
152
+ }
153
+
154
+ function createNodeRedVueApp(
155
+ node: Node,
156
+ form: NodeFormDefinition | undefined,
157
+ schema: JSONSchemaType<any>,
158
+ features: NodeFeatures,
159
+ ): App<Element> {
160
+ const app = createApp(NodeRedVueApp, {
161
+ node,
162
+ schema,
163
+ features,
164
+ });
165
+
166
+ app.component("NodeRedInput", NodeRedInput);
167
+ app.component("NodeRedTypedInput", NodeRedTypedInput);
168
+ app.component("NodeRedConfigInput", NodeRedConfigInput);
169
+ app.component("NodeRedSelectInput", NodeRedSelectInput);
170
+ app.component("NodeRedEditorInput", NodeRedEditorInput);
171
+ app.component("NodeRedJsonSchemaForm", NodeRedJsonSchemaForm);
172
+ app.component("NodeRedNodeForm", form?.component ?? NodeRedJsonSchemaForm);
173
+
174
+ // NOTE: now every form can use $i18n to access Node-RED built in i18n features
175
+ app.config.globalProperties.$i18n = (label: string) =>
176
+ node._(`${node.type}.${label}`);
177
+ return app;
178
+ }
179
+
180
+ function mountApp(
181
+ node: Node,
182
+ form: NodeFormDefinition | undefined,
183
+ schema: JSONSchemaType<any>,
184
+ features: NodeFeatures,
185
+ containerId: string,
186
+ ) {
187
+ $(`#${containerId}`).empty();
188
+ node._newState = cloneDeep(node);
189
+ node._app = createNodeRedVueApp(node._newState, form, schema, features);
190
+ node._app.mount(`#${containerId}`);
191
+ }
192
+
193
+ function unmountApp(node: Node) {
194
+ if (node._app) {
195
+ node._app.unmount();
196
+ node._app = null;
197
+ }
198
+ }
199
+
200
+ function getNodeState(node: Node): NodeState {
201
+ const state: NodeState = {
202
+ credentials: {},
203
+ };
204
+ Object.keys(node._def.defaults).forEach((prop) => {
205
+ state[prop] = node[prop];
206
+ });
207
+ if (node._def.credentials) {
208
+ Object.keys(node._def.credentials).forEach((prop) => {
209
+ state.credentials[prop] = node.credentials?.[prop];
210
+
211
+ if (node._def.credentials[prop].type === "password") {
212
+ state.credentials[`has_${prop}`] =
213
+ node.credentials?.[`has_${prop}`] || false;
214
+ }
215
+ });
216
+ }
217
+
218
+ return state;
219
+ }
220
+
221
+ function getChanges(
222
+ o: Record<any, any>,
223
+ n: Record<any, any>,
224
+ ): Record<string, any> {
225
+ const changes: Record<string, any> = {};
226
+
227
+ const allKeys = new Set([...Object.keys(o), ...Object.keys(n ?? {})]);
228
+ allKeys.forEach((prop) => {
229
+ const _o = o[prop];
230
+ const _n = (n ?? {})[prop];
231
+
232
+ if (!Array.isArray(_o) && typeof _o === "object" && _o !== null) {
233
+ const _changes = getChanges(_o, _n);
234
+ if (Object.keys(_changes).length) {
235
+ changes[prop] = _changes;
236
+ }
237
+ } else if (!isEqual(_o, _n)) {
238
+ changes[prop] = _o;
239
+ }
240
+ });
241
+
242
+ return changes;
243
+ }
244
+
245
+ // Deep-merge source into target, but replace arrays wholesale instead of
246
+ // merging them element-by-element (es-toolkit merge keeps old array items
247
+ // when the source is shorter, e.g. going from ["a","b"] to [] keeps ["a","b"]).
248
+ function applyState(target: any, source: any): void {
249
+ for (const key of Object.keys(source)) {
250
+ const srcVal = source[key];
251
+ if (Array.isArray(srcVal)) {
252
+ target[key] = [...srcVal];
253
+ } else if (srcVal !== null && typeof srcVal === "object") {
254
+ if (
255
+ !target[key] ||
256
+ typeof target[key] !== "object" ||
257
+ Array.isArray(target[key])
258
+ ) {
259
+ target[key] = {};
260
+ }
261
+ applyState(target[key], srcVal);
262
+ } else {
263
+ target[key] = srcVal;
264
+ }
265
+ }
266
+ }
267
+
268
+ function defineNode<T extends NodeDefinition>(options: T): T {
269
+ return options;
270
+ }
271
+
272
+ /**
273
+ * Prepares a node registration function using the provided base configuration.
274
+ *
275
+ * This is a higher-order function that returns a function which can be used
276
+ * to register the node with a specific type at runtime.
277
+ *
278
+ * @param {Object} options - The static configuration shared by all nodes of this kind
279
+ * @param {string} [options.category="undefined"] - The category this node belongs to in the palette
280
+ * @param {string} [options.color="#FFFFFF"] - The color associated with this node, in hex format
281
+ * @param {string} [options.icon] - The icon to display for this node
282
+ * @param {(function(): string)|string} [options.label] - The label to display on the node
283
+ * @param {number} [options.inputs=0] - Number of input ports the node should have
284
+ * @param {number} [options.outputs=0] - Number of output ports the node should have
285
+ * @param {(function(): string)|string} [options.paletteLabel] - The label to show in the palette
286
+ * @param {(function(): string)|string} [options.labelStyle] - CSS style to apply to the node label
287
+ * @param {(function(): string)|string} [options.inputLabels] - Labels for the input ports
288
+ * @param {(function(): string)|string} [options.outputLabels] - Labels for the output ports
289
+ * @param {"left"|"right"} [options.align="left"] - Alignment of the node content
290
+ * @param {NodeButtonDefinition} [options.button] - Configuration for a button on the node
291
+ * @param {function(): void} [options.onPaletteAdd] - Function called when the node is added to the palette
292
+ * @param {function(): void} [options.onPaletteRemove] - Function called when the node is removed from the palette
293
+ * @param {Component} options.form - The form component to use for configuring the node
294
+ * @param {JSONSchemaType} [options.schema] - Schema definition for validation
295
+ *
296
+ * @returns A function that registers the node with the specified type
297
+ */
298
+ async function registerType(definition: NodeDefinition): Promise<void> {
299
+ const { type } = definition;
300
+ try {
301
+ console.log(`Registering node type: ${type}`);
302
+
303
+ const nodeDefinition = {
304
+ ...(_schemas[type] ?? {}),
305
+ ...definition,
306
+ };
307
+
308
+ // defaults and credentials are pre-computed at build time by the inliner
309
+ const defaults = nodeDefinition.defaults ?? undefined;
310
+ const credentials = nodeDefinition.credentials ?? undefined;
311
+
312
+ console.log("defaults", defaults);
313
+ console.log("credentials", credentials);
314
+
315
+ const appContainerId = `nrg-app-${type}`;
316
+
317
+ $("<script>", {
318
+ type: "text/html",
319
+ "data-template-name": type,
320
+ html: `<div id="${appContainerId}"></div>`,
321
+ }).appendTo("body");
322
+
323
+ function oneditprepare(this: Node) {
324
+ console.log("oneditprepare");
325
+ console.log(this);
326
+
327
+ const validationSchema = nodeDefinition.credentialsSchema?.properties
328
+ ? {
329
+ ...nodeDefinition.configSchema,
330
+ properties: {
331
+ ...nodeDefinition.configSchema.properties,
332
+ credentials: {
333
+ type: "object",
334
+ properties: nodeDefinition.credentialsSchema.properties,
335
+ },
336
+ },
337
+ }
338
+ : nodeDefinition.configSchema;
339
+
340
+ const form =
341
+ definition.form ??
342
+ (_forms[type] ? { component: _forms[type] } : undefined);
343
+ const features: NodeFeatures = {
344
+ hasInputSchema: !!nodeDefinition.inputSchema,
345
+ hasOutputSchema: !!nodeDefinition.outputsSchema,
346
+ };
347
+ mountApp(this, form, validationSchema, features, appContainerId);
348
+ }
349
+
350
+ function oneditsave(this: Node) {
351
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
352
+ const node = this;
353
+ unmountApp(node);
354
+
355
+ const newState = getNodeState(node._newState!);
356
+ const oldState = getNodeState(node);
357
+ const changes = getChanges(oldState, newState);
358
+ const changed = !!Object.keys(changes)?.length;
359
+ if (!changed) return false;
360
+
361
+ Object.keys(node._def.defaults).forEach((prop) => {
362
+ if (!node._def.defaults?.[prop]?.type) return;
363
+ const oldConfigNodeId: string = node[prop] as string;
364
+ const newConfigNodeId: string = node._newState![prop] as string;
365
+ if (oldConfigNodeId === newConfigNodeId) return;
366
+ const oldConfigNode = RED.nodes.node(oldConfigNodeId);
367
+ if (oldConfigNode && oldConfigNode._def.category === "config") {
368
+ const idx = oldConfigNode.users.findIndex(
369
+ (_node) => _node.id === node.id,
370
+ );
371
+ if (idx !== -1) {
372
+ oldConfigNode.users.splice(idx, 1);
373
+ }
374
+ }
375
+ });
376
+
377
+ Object.keys(node._def.defaults).forEach((prop) => {
378
+ if (!node._def.defaults?.[prop]?.type) return;
379
+ const newConfigNodeId: string = node._newState![prop] as string;
380
+ if (!newConfigNodeId) return;
381
+ const newConfigNode = RED.nodes.node(newConfigNodeId);
382
+ if (newConfigNode && newConfigNode._def.category === "config") {
383
+ const idx = newConfigNode.users.findIndex(
384
+ (_node) => _node.id === node.id,
385
+ );
386
+ if (idx === -1) {
387
+ newConfigNode.users.push(node);
388
+ }
389
+ }
390
+ });
391
+
392
+ applyState(node, newState);
393
+
394
+ // For config nodes, populate the standard Node-RED input elements so
395
+ // pane.apply() can read the new values after oneditsave returns.
396
+ // Regular nodes must NOT have hidden inputs created here: pane.apply()
397
+ // reads them back via input.val() which coerces arrays/objects to strings,
398
+ // overwriting the correctly-typed values already set by merge() above.
399
+ const isConfigNode = definition.category === "config";
400
+ if (isConfigNode) {
401
+ Object.keys(node._def.defaults).forEach((prop) => {
402
+ if (node._def.defaults[prop].type) return; // config-node refs handled separately
403
+ const inputId = `node-config-input-${prop}`;
404
+ let input = $(`#${inputId}`);
405
+ if (!input.length) {
406
+ input = $("<input>", { type: "hidden", id: inputId });
407
+ $(`#${appContainerId}`).append(input);
408
+ }
409
+ input.val(newState[prop] ?? "");
410
+ });
411
+ return undefined;
412
+ }
413
+
414
+ return {
415
+ changed,
416
+ history: [
417
+ {
418
+ t: "edit",
419
+ node,
420
+ changes,
421
+ links: [],
422
+ dirty: RED.nodes.dirty(),
423
+ changed,
424
+ },
425
+ ],
426
+ };
427
+ }
428
+
429
+ function oneditcancel(this: Node) {
430
+ unmountApp(this);
431
+ }
432
+
433
+ function oneditdelete(this: Node) {
434
+ unmountApp(this);
435
+ }
436
+
437
+ RED.nodes.registerType(type, {
438
+ type,
439
+ defaults,
440
+ credentials,
441
+ category: nodeDefinition.category,
442
+ color: nodeDefinition.color || "#FFFFFF",
443
+ icon: nodeDefinition.icon,
444
+ inputs: nodeDefinition.inputs || 0,
445
+ outputs: nodeDefinition.outputs || 0,
446
+ label:
447
+ nodeDefinition.label ||
448
+ function (this: Node) {
449
+ return this.name || this._(`${type}.label`);
450
+ },
451
+ paletteLabel: nodeDefinition.paletteLabel || type,
452
+ labelStyle: nodeDefinition.labelStyle,
453
+ inputLabels: nodeDefinition.inputLabels,
454
+ outputLabels: nodeDefinition.outputLabels,
455
+ align: nodeDefinition.align || "left",
456
+ button: nodeDefinition.button,
457
+ oneditprepare,
458
+ oneditsave,
459
+ oneditcancel,
460
+ oneditdelete,
461
+ oneditresize: nodeDefinition.onEditResize,
462
+ onpaletteadd: nodeDefinition.onPaletteAdd,
463
+ onpaletteremove: nodeDefinition.onPaletteRemove,
464
+ });
465
+ } catch (error) {
466
+ console.error(`Error while registering node type ${type}:`, error);
467
+ throw error;
468
+ }
469
+ }
470
+
471
+ /**
472
+ * Registers multiple nodes with Node-RED in parallel.
473
+ *
474
+ * @param {Array<[string, NodeDefinition]>} nodes - Array of tuples containing node type and definition
475
+ * @returns Resolves when all nodes are registered
476
+ *
477
+ * @example
478
+ * await registerTypes([
479
+ * ["remote-server", remoteServer],
480
+ * ["your-node", yourNode],
481
+ * ]);
482
+ */
483
+ async function registerTypes(nodes: NodeDefinition[]): Promise<void> {
484
+ try {
485
+ console.log("Registering node types in parallel");
486
+ await Promise.all(nodes.map((definition) => registerType(definition)));
487
+ console.log("All node types registered in parallel");
488
+ } catch (error) {
489
+ console.error("Error registering node types:", error);
490
+ throw error;
491
+ }
492
+ }
493
+
494
+ export {
495
+ __setSchemas,
496
+ __setForms,
497
+ defineNode,
498
+ registerType,
499
+ registerTypes,
500
+ NodeDefinition,
501
+ NodeButtonDefinition,
502
+ NodeFormDefinition,
503
+ Node,
504
+ };
@@ -0,0 +1,5 @@
1
+ declare module "*.vue" {
2
+ import type { DefineComponent } from "vue";
3
+ const component: DefineComponent<any, any, any>;
4
+ export default component;
5
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "noEmit": true,
11
+ "noImplicitAny": false,
12
+ "noImplicitOverride": true,
13
+ "resolveJsonModule": true
14
+ },
15
+ "files": ["shims-vue.d.ts", "components.d.ts", "globals.d.ts"],
16
+ "include": ["**/*.ts", "**/*.vue", "../constants.ts", "../validator.ts"],
17
+ "exclude": ["node_modules"]
18
+ }
@@ -0,0 +1,5 @@
1
+ declare module "virtual:nrg/node-definitions" {
2
+ import type { NodeDefinitionApiResponse } from "../server/types";
3
+ const definitions: Record<string, NodeDefinitionApiResponse>;
4
+ export default definitions;
5
+ }
@@ -0,0 +1,18 @@
1
+ const TYPED_INPUT_TYPES = [
2
+ "msg",
3
+ "flow",
4
+ "global",
5
+ "str",
6
+ "num",
7
+ "bool",
8
+ "json",
9
+ "bin",
10
+ "re",
11
+ "jsonata",
12
+ "date",
13
+ "env",
14
+ "node",
15
+ "cred",
16
+ ] as const;
17
+
18
+ export { TYPED_INPUT_TYPES };