@bonsae/nrg 0.17.0 → 0.18.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/README.md +2 -2
- package/package.json +1 -1
- package/server/resources/nrg-client.js +3393 -3307
- package/test/client/component/index.js +10 -0
- package/test/client/component/setup.js +10 -0
- package/test/client/e2e/index.js +4 -4
- package/test/client/unit/index.js +10 -0
- package/test/client/unit/setup.js +10 -0
- package/test/server/unit/index.js +16 -2
- package/types/client.d.ts +66 -0
- package/types/server.d.ts +7 -2
- package/types/shims/form/components/node-red-config-input.vue.d.ts +3 -1
- package/types/shims/form/components/node-red-editor-input.vue.d.ts +4 -1
- package/types/shims/form/components/node-red-json-schema-form.vue.d.ts +38 -10
- package/types/shims/form/components/node-red-select-input.vue.d.ts +3 -1
- package/types/shims/form/components/node-red-typed-input.vue.d.ts +28 -7
- package/types/test-server-unit.d.ts +7 -0
- package/vite/index.js +10 -6
|
@@ -103,6 +103,16 @@ function createJQ(el) {
|
|
|
103
103
|
state.listeners[event].push(cb);
|
|
104
104
|
return jq;
|
|
105
105
|
},
|
|
106
|
+
off(event) {
|
|
107
|
+
if (event) {
|
|
108
|
+
delete state.listeners[event];
|
|
109
|
+
} else {
|
|
110
|
+
for (const key of Object.keys(state.listeners)) {
|
|
111
|
+
delete state.listeners[key];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return jq;
|
|
115
|
+
},
|
|
106
116
|
val(value) {
|
|
107
117
|
if (value !== void 0) {
|
|
108
118
|
if (el instanceof HTMLInputElement || el instanceof HTMLSelectElement || el instanceof HTMLTextAreaElement) {
|
|
@@ -104,6 +104,16 @@ function createJQ(el) {
|
|
|
104
104
|
state.listeners[event].push(cb);
|
|
105
105
|
return jq;
|
|
106
106
|
},
|
|
107
|
+
off(event) {
|
|
108
|
+
if (event) {
|
|
109
|
+
delete state.listeners[event];
|
|
110
|
+
} else {
|
|
111
|
+
for (const key of Object.keys(state.listeners)) {
|
|
112
|
+
delete state.listeners[key];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return jq;
|
|
116
|
+
},
|
|
107
117
|
val(value) {
|
|
108
118
|
if (value !== void 0) {
|
|
109
119
|
if (el instanceof HTMLInputElement || el instanceof HTMLSelectElement || el instanceof HTMLTextAreaElement) {
|
package/test/client/e2e/index.js
CHANGED
|
@@ -1929,7 +1929,7 @@ async function build2(clientBuildOptions, buildContext) {
|
|
|
1929
1929
|
const config = {
|
|
1930
1930
|
configFile: false,
|
|
1931
1931
|
logLevel: "warn",
|
|
1932
|
-
base:
|
|
1932
|
+
base: `/resources/${buildContext.packageName}`,
|
|
1933
1933
|
publicDir: path9.resolve(srcDir, "public"),
|
|
1934
1934
|
resolve: {
|
|
1935
1935
|
alias: {
|
|
@@ -1959,9 +1959,9 @@ async function build2(clientBuildOptions, buildContext) {
|
|
|
1959
1959
|
external,
|
|
1960
1960
|
treeshake: false,
|
|
1961
1961
|
output: {
|
|
1962
|
-
entryFileNames:
|
|
1963
|
-
chunkFileNames:
|
|
1964
|
-
assetFileNames:
|
|
1962
|
+
entryFileNames: "resources/index.[hash].js",
|
|
1963
|
+
chunkFileNames: "resources/vendor.[hash].js",
|
|
1964
|
+
assetFileNames: "resources/[name].[hash].[ext]",
|
|
1965
1965
|
globals,
|
|
1966
1966
|
paths: {
|
|
1967
1967
|
vue: "/nrg/assets/vue.esm-browser.prod.js",
|
|
@@ -100,6 +100,16 @@ function createJQ(el) {
|
|
|
100
100
|
state.listeners[event].push(cb);
|
|
101
101
|
return jq;
|
|
102
102
|
},
|
|
103
|
+
off(event) {
|
|
104
|
+
if (event) {
|
|
105
|
+
delete state.listeners[event];
|
|
106
|
+
} else {
|
|
107
|
+
for (const key of Object.keys(state.listeners)) {
|
|
108
|
+
delete state.listeners[key];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return jq;
|
|
112
|
+
},
|
|
103
113
|
val(value) {
|
|
104
114
|
if (value !== void 0) {
|
|
105
115
|
if (el instanceof HTMLInputElement || el instanceof HTMLSelectElement || el instanceof HTMLTextAreaElement) {
|
|
@@ -103,6 +103,16 @@ function createJQ(el) {
|
|
|
103
103
|
state.listeners[event].push(cb);
|
|
104
104
|
return jq;
|
|
105
105
|
},
|
|
106
|
+
off(event) {
|
|
107
|
+
if (event) {
|
|
108
|
+
delete state.listeners[event];
|
|
109
|
+
} else {
|
|
110
|
+
for (const key of Object.keys(state.listeners)) {
|
|
111
|
+
delete state.listeners[key];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return jq;
|
|
115
|
+
},
|
|
106
116
|
val(value) {
|
|
107
117
|
if (value !== void 0) {
|
|
108
118
|
if (el instanceof HTMLInputElement || el instanceof HTMLSelectElement || el instanceof HTMLTextAreaElement) {
|
|
@@ -399,6 +399,7 @@ function initValidator(RED) {
|
|
|
399
399
|
var WIRE_HANDLERS = Symbol.for("nrg.wireHandlers");
|
|
400
400
|
|
|
401
401
|
// src/test/server/unit/index.ts
|
|
402
|
+
import { Kind } from "@sinclair/typebox";
|
|
402
403
|
function buildConfig(NodeClass, userConfig = {}) {
|
|
403
404
|
const defaults = {};
|
|
404
405
|
if (NodeClass.configSchema?.properties) {
|
|
@@ -413,7 +414,7 @@ function buildConfig(NodeClass, userConfig = {}) {
|
|
|
413
414
|
}
|
|
414
415
|
return { ...defaults, ...userConfig };
|
|
415
416
|
}
|
|
416
|
-
function attachHelpers(node, nodeRedNode) {
|
|
417
|
+
function attachHelpers(node, nodeRedNode, NodeClass) {
|
|
417
418
|
const sentMessages = [];
|
|
418
419
|
const statusCalls = [];
|
|
419
420
|
nodeRedNode.send.mockImplementation((msg) => {
|
|
@@ -449,6 +450,15 @@ function attachHelpers(node, nodeRedNode) {
|
|
|
449
450
|
},
|
|
450
451
|
sent(port) {
|
|
451
452
|
if (port === void 0) return [...sentMessages];
|
|
453
|
+
if (typeof port === "string") {
|
|
454
|
+
const schema = NodeClass.outputsSchema;
|
|
455
|
+
if (!schema || Array.isArray(schema) || typeof schema === "object" && Kind in schema) {
|
|
456
|
+
return [];
|
|
457
|
+
}
|
|
458
|
+
const idx = Object.keys(schema).indexOf(port);
|
|
459
|
+
if (idx === -1) return [];
|
|
460
|
+
return sentMessages.map((msg) => Array.isArray(msg) ? msg[idx] : void 0).filter((msg) => msg != null);
|
|
461
|
+
}
|
|
452
462
|
return sentMessages.map(
|
|
453
463
|
(msg) => Array.isArray(msg) ? msg[port] : port === 0 ? msg : void 0
|
|
454
464
|
).filter((msg) => msg != null);
|
|
@@ -523,7 +533,11 @@ async function createNode(NodeClass, options = {}) {
|
|
|
523
533
|
NodeClass.validateSettings(RED);
|
|
524
534
|
await Promise.resolve(NodeClass.registered?.(RED));
|
|
525
535
|
const node = new NodeClass(RED, nodeRedNode, config, credentials);
|
|
526
|
-
const augmented = attachHelpers(
|
|
536
|
+
const augmented = attachHelpers(
|
|
537
|
+
node,
|
|
538
|
+
nodeRedNode,
|
|
539
|
+
NodeClass
|
|
540
|
+
);
|
|
527
541
|
const createdPromise = Promise.resolve(node.created?.());
|
|
528
542
|
node[WIRE_HANDLERS](nodeRedNode, createdPromise);
|
|
529
543
|
await createdPromise;
|
package/types/client.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
+
import { SchemaOptions, Static, TSchema } from '@sinclair/typebox';
|
|
3
4
|
import { App, Component } from 'vue';
|
|
4
5
|
|
|
6
|
+
interface NodeRefResolved<T = any> {
|
|
7
|
+
readonly __nrg_node_ref: true;
|
|
8
|
+
readonly __instance: T;
|
|
9
|
+
}
|
|
5
10
|
export interface NodeStateCredentials {
|
|
6
11
|
[key: string]: any;
|
|
7
12
|
}
|
|
@@ -87,13 +92,74 @@ export interface NodeDefinition {
|
|
|
87
92
|
onPaletteRemove?: (this: NodeRedNode) => void;
|
|
88
93
|
form?: NodeFormDefinition;
|
|
89
94
|
}
|
|
95
|
+
export interface NodeDefaults {
|
|
96
|
+
[key: string]: {
|
|
97
|
+
value: any;
|
|
98
|
+
type?: string;
|
|
99
|
+
label?: string;
|
|
100
|
+
required?: boolean;
|
|
101
|
+
validate?: (this: NodeRedNode, value: any, opt: any) => any;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export interface NodeCredentials {
|
|
105
|
+
[key: string]: {
|
|
106
|
+
value?: string;
|
|
107
|
+
type?: "password" | "text";
|
|
108
|
+
label?: string;
|
|
109
|
+
required?: boolean;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export interface MergedNodeDefinition extends NodeDefinition {
|
|
113
|
+
defaults?: NodeDefaults;
|
|
114
|
+
credentials?: NodeCredentials;
|
|
115
|
+
configSchema?: Record<string, any>;
|
|
116
|
+
credentialsSchema?: {
|
|
117
|
+
properties?: Record<string, any>;
|
|
118
|
+
};
|
|
119
|
+
outputsSchema?: Record<string, any>;
|
|
120
|
+
inputSchema?: Record<string, any>;
|
|
121
|
+
}
|
|
90
122
|
export interface NodeFeatures {
|
|
91
123
|
hasInputSchema: boolean;
|
|
92
124
|
hasOutputSchema: boolean;
|
|
93
125
|
}
|
|
126
|
+
/** Client-side representation of a TypedInput field: the raw value string and its type selector. */
|
|
127
|
+
export interface TypedInputValue {
|
|
128
|
+
value: string;
|
|
129
|
+
type: string;
|
|
130
|
+
}
|
|
131
|
+
type _ToClient<T> = T extends NodeRefResolved<any> ? string : T extends {
|
|
132
|
+
resolve(...args: any[]): any;
|
|
133
|
+
value: unknown;
|
|
134
|
+
type: string;
|
|
135
|
+
} ? TypedInputValue : T extends (...args: any[]) => any ? T : T extends Array<infer I> ? _ToClient<I>[] : T extends object ? {
|
|
136
|
+
[K in keyof T]: _ToClient<T[K]>;
|
|
137
|
+
} : T;
|
|
138
|
+
/**
|
|
139
|
+
* Infers the client-side TypeScript type from a TypeBox schema.
|
|
140
|
+
*
|
|
141
|
+
* Resolves schema types to their client form representations:
|
|
142
|
+
* - `NodeRef<T>` → `string` (node ID in the editor)
|
|
143
|
+
* - `TypedInput<T>` → `{ value: string; type: string }`
|
|
144
|
+
* - All other types resolve via TypeBox's `Static<T>`
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* import type { Infer } from "@bonsae/nrg/client";
|
|
149
|
+
* import type { ConfigSchema } from "../schemas/my-node";
|
|
150
|
+
*
|
|
151
|
+
* type Config = Infer<typeof ConfigSchema>;
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export type Infer<T extends TSchema> = _ToClient<Static<T>>;
|
|
94
155
|
|
|
95
156
|
export {};
|
|
96
157
|
|
|
97
158
|
export declare function defineNode<T extends NodeDefinition>(options: T): T;
|
|
98
159
|
export declare function registerType(definition: NodeDefinition): Promise<void>;
|
|
99
160
|
export declare function registerTypes(nodes: NodeDefinition[]): Promise<void>;
|
|
161
|
+
export declare function useFormNode<TConfig extends TSchema = TSchema, TCredentials extends TSchema = TSchema>(): {
|
|
162
|
+
node: NodeRedNode & Infer<TConfig> & { credentials: Infer<TCredentials> & Record<string, any> };
|
|
163
|
+
schema: Record<string, any>;
|
|
164
|
+
errors: Record<string, string>;
|
|
165
|
+
};
|
package/types/server.d.ts
CHANGED
|
@@ -432,15 +432,19 @@ export declare const StatusPortSchema: import("@sinclair/typebox").TObject<{
|
|
|
432
432
|
name: import("@sinclair/typebox").TString;
|
|
433
433
|
}>;
|
|
434
434
|
}>;
|
|
435
|
+
interface NodeRefResolved<T = any> {
|
|
436
|
+
readonly __nrg_node_ref: true;
|
|
437
|
+
readonly __instance: T;
|
|
438
|
+
}
|
|
435
439
|
/** Schema type representing a reference to a config node. Resolves to the node instance at runtime. */
|
|
436
440
|
export interface TNodeRef<T = any> extends TSchema {
|
|
437
441
|
[Kind]: "NodeRef";
|
|
438
|
-
static: T
|
|
442
|
+
static: NodeRefResolved<T>;
|
|
439
443
|
type: "string";
|
|
440
444
|
format: "node-id";
|
|
441
445
|
"x-nrg-node-type"?: string;
|
|
442
446
|
}
|
|
443
|
-
type ResolveNodeRefs<T> = T extends TypedInput<any> ? T : T extends (...args: any[]) => any ? T : T extends Array<infer Item> ? ResolveNodeRefs<Item>[] : T extends object ? {
|
|
447
|
+
type ResolveNodeRefs<T> = T extends NodeRefResolved<infer I> ? I : T extends TypedInput<any> ? T : T extends (...args: any[]) => any ? T : T extends Array<infer Item> ? ResolveNodeRefs<Item>[] : T extends object ? {
|
|
444
448
|
[K in keyof T]: ResolveNodeRefs<T[K]>;
|
|
445
449
|
} : T;
|
|
446
450
|
/**
|
|
@@ -460,6 +464,7 @@ type TypedInputType = (typeof TYPED_INPUT_TYPES)[number];
|
|
|
460
464
|
export interface TTypedInput<T = unknown> extends TSchema {
|
|
461
465
|
[Kind]: "TypedInput";
|
|
462
466
|
static: TypedInput<T>;
|
|
467
|
+
"x-nrg-typed-input": true;
|
|
463
468
|
}
|
|
464
469
|
interface NrgSchemaOptions extends SchemaOptions, NrgSchemaExtensions {
|
|
465
470
|
}
|
|
@@ -35,7 +35,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
35
35
|
type: StringConstructor;
|
|
36
36
|
default: string;
|
|
37
37
|
};
|
|
38
|
-
}>, {
|
|
38
|
+
}>, {
|
|
39
|
+
jqInput: import("vue").ShallowRef<any, any>;
|
|
40
|
+
}, {}, {
|
|
39
41
|
inputId(): string;
|
|
40
42
|
effectiveValue(): string;
|
|
41
43
|
}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:value")[], "update:modelValue" | "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -28,7 +28,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
28
28
|
type: StringConstructor;
|
|
29
29
|
default: string;
|
|
30
30
|
};
|
|
31
|
-
}>, {
|
|
31
|
+
}>, {
|
|
32
|
+
editor: import("vue").ShallowRef<any, any>;
|
|
33
|
+
expandedEditorTray: import("vue").ShallowRef<any, any>;
|
|
34
|
+
}, {
|
|
32
35
|
editorId: string;
|
|
33
36
|
stateId: string;
|
|
34
37
|
trayElement: HTMLElement | null;
|
|
@@ -263,7 +263,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
263
263
|
type: StringConstructor;
|
|
264
264
|
default: string;
|
|
265
265
|
};
|
|
266
|
-
}>, {
|
|
266
|
+
}>, {
|
|
267
|
+
selectWidget: import("vue").ShallowRef<any, any>;
|
|
268
|
+
}, {}, {
|
|
267
269
|
effectiveValue(): string | unknown[];
|
|
268
270
|
}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:value")[], "update:modelValue" | "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
269
271
|
modelValue: {
|
|
@@ -353,7 +355,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
353
355
|
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
354
356
|
NodeRedTypedInput: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
355
357
|
modelValue: {
|
|
356
|
-
type:
|
|
358
|
+
type: PropType<{
|
|
359
|
+
value: string;
|
|
360
|
+
type: string;
|
|
361
|
+
} | undefined>;
|
|
357
362
|
default: undefined;
|
|
358
363
|
validator: (obj: {
|
|
359
364
|
value: string;
|
|
@@ -361,7 +366,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
361
366
|
} | undefined) => boolean;
|
|
362
367
|
};
|
|
363
368
|
value: {
|
|
364
|
-
type:
|
|
369
|
+
type: PropType<{
|
|
370
|
+
value: string;
|
|
371
|
+
type: string;
|
|
372
|
+
} | undefined>;
|
|
365
373
|
default: undefined;
|
|
366
374
|
validator: (obj: {
|
|
367
375
|
value: string;
|
|
@@ -388,7 +396,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
388
396
|
type: StringConstructor;
|
|
389
397
|
default: string;
|
|
390
398
|
};
|
|
391
|
-
}>, {
|
|
399
|
+
}>, {
|
|
400
|
+
inputWidget: import("vue").ShallowRef<any, any>;
|
|
401
|
+
mutationObserver: import("vue").ShallowRef<MutationObserver | null, MutationObserver | null>;
|
|
402
|
+
}, {}, {
|
|
392
403
|
effectiveValue(): {
|
|
393
404
|
value: string;
|
|
394
405
|
type: string;
|
|
@@ -398,7 +409,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
398
409
|
onChange(): void;
|
|
399
410
|
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:value")[], "update:modelValue" | "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
400
411
|
modelValue: {
|
|
401
|
-
type:
|
|
412
|
+
type: PropType<{
|
|
413
|
+
value: string;
|
|
414
|
+
type: string;
|
|
415
|
+
} | undefined>;
|
|
402
416
|
default: undefined;
|
|
403
417
|
validator: (obj: {
|
|
404
418
|
value: string;
|
|
@@ -406,7 +420,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
406
420
|
} | undefined) => boolean;
|
|
407
421
|
};
|
|
408
422
|
value: {
|
|
409
|
-
type:
|
|
423
|
+
type: PropType<{
|
|
424
|
+
value: string;
|
|
425
|
+
type: string;
|
|
426
|
+
} | undefined>;
|
|
410
427
|
default: undefined;
|
|
411
428
|
validator: (obj: {
|
|
412
429
|
value: string;
|
|
@@ -440,8 +457,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
440
457
|
label: string;
|
|
441
458
|
icon: string;
|
|
442
459
|
required: boolean;
|
|
443
|
-
modelValue:
|
|
444
|
-
|
|
460
|
+
modelValue: {
|
|
461
|
+
value: string;
|
|
462
|
+
type: string;
|
|
463
|
+
} | undefined;
|
|
464
|
+
value: {
|
|
465
|
+
value: string;
|
|
466
|
+
type: string;
|
|
467
|
+
} | undefined;
|
|
445
468
|
error: string;
|
|
446
469
|
types: ("msg" | "flow" | "global" | "str" | "num" | "bool" | "json" | "bin" | "re" | "jsonata" | "date" | "env" | "node" | "cred" | NodeRED.TypedInputTypeDefinition)[];
|
|
447
470
|
}, {}, {
|
|
@@ -516,7 +539,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
516
539
|
type: StringConstructor;
|
|
517
540
|
default: string;
|
|
518
541
|
};
|
|
519
|
-
}>, {
|
|
542
|
+
}>, {
|
|
543
|
+
jqInput: import("vue").ShallowRef<any, any>;
|
|
544
|
+
}, {}, {
|
|
520
545
|
inputId(): string;
|
|
521
546
|
effectiveValue(): string;
|
|
522
547
|
}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:value")[], "update:modelValue" | "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -631,7 +656,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
631
656
|
type: StringConstructor;
|
|
632
657
|
default: string;
|
|
633
658
|
};
|
|
634
|
-
}>, {
|
|
659
|
+
}>, {
|
|
660
|
+
editor: import("vue").ShallowRef<any, any>;
|
|
661
|
+
expandedEditorTray: import("vue").ShallowRef<any, any>;
|
|
662
|
+
}, {
|
|
635
663
|
editorId: string;
|
|
636
664
|
stateId: string;
|
|
637
665
|
trayElement: HTMLElement | null;
|
|
@@ -38,7 +38,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
38
38
|
type: StringConstructor;
|
|
39
39
|
default: string;
|
|
40
40
|
};
|
|
41
|
-
}>, {
|
|
41
|
+
}>, {
|
|
42
|
+
selectWidget: import("vue").ShallowRef<any, any>;
|
|
43
|
+
}, {}, {
|
|
42
44
|
effectiveValue(): string | unknown[];
|
|
43
45
|
}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:value")[], "update:modelValue" | "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
46
|
modelValue: {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
2
|
modelValue: {
|
|
3
|
-
type:
|
|
3
|
+
type: PropType<{
|
|
4
|
+
value: string;
|
|
5
|
+
type: string;
|
|
6
|
+
} | undefined>;
|
|
4
7
|
default: undefined;
|
|
5
8
|
validator: (obj: {
|
|
6
9
|
value: string;
|
|
@@ -8,7 +11,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
8
11
|
} | undefined) => boolean;
|
|
9
12
|
};
|
|
10
13
|
value: {
|
|
11
|
-
type:
|
|
14
|
+
type: PropType<{
|
|
15
|
+
value: string;
|
|
16
|
+
type: string;
|
|
17
|
+
} | undefined>;
|
|
12
18
|
default: undefined;
|
|
13
19
|
validator: (obj: {
|
|
14
20
|
value: string;
|
|
@@ -35,7 +41,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
35
41
|
type: StringConstructor;
|
|
36
42
|
default: string;
|
|
37
43
|
};
|
|
38
|
-
}>, {
|
|
44
|
+
}>, {
|
|
45
|
+
inputWidget: import("vue").ShallowRef<any, any>;
|
|
46
|
+
mutationObserver: import("vue").ShallowRef<MutationObserver | null, MutationObserver | null>;
|
|
47
|
+
}, {}, {
|
|
39
48
|
effectiveValue(): {
|
|
40
49
|
value: string;
|
|
41
50
|
type: string;
|
|
@@ -45,7 +54,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
45
54
|
onChange(): void;
|
|
46
55
|
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:value")[], "update:modelValue" | "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
47
56
|
modelValue: {
|
|
48
|
-
type:
|
|
57
|
+
type: PropType<{
|
|
58
|
+
value: string;
|
|
59
|
+
type: string;
|
|
60
|
+
} | undefined>;
|
|
49
61
|
default: undefined;
|
|
50
62
|
validator: (obj: {
|
|
51
63
|
value: string;
|
|
@@ -53,7 +65,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
53
65
|
} | undefined) => boolean;
|
|
54
66
|
};
|
|
55
67
|
value: {
|
|
56
|
-
type:
|
|
68
|
+
type: PropType<{
|
|
69
|
+
value: string;
|
|
70
|
+
type: string;
|
|
71
|
+
} | undefined>;
|
|
57
72
|
default: undefined;
|
|
58
73
|
validator: (obj: {
|
|
59
74
|
value: string;
|
|
@@ -87,8 +102,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
87
102
|
label: string;
|
|
88
103
|
icon: string;
|
|
89
104
|
required: boolean;
|
|
90
|
-
modelValue:
|
|
91
|
-
|
|
105
|
+
modelValue: {
|
|
106
|
+
value: string;
|
|
107
|
+
type: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
value: {
|
|
110
|
+
value: string;
|
|
111
|
+
type: string;
|
|
112
|
+
} | undefined;
|
|
92
113
|
error: string;
|
|
93
114
|
types: ("msg" | "flow" | "global" | "str" | "num" | "bool" | "json" | "bin" | "re" | "jsonata" | "date" | "env" | "node" | "cred" | NodeRED.TypedInputTypeDefinition)[];
|
|
94
115
|
}, {}, {
|
|
@@ -390,11 +390,18 @@ type ExtractInput<T> = T extends {
|
|
|
390
390
|
type ExtractOutput<T> = T extends {
|
|
391
391
|
send(msg: infer O): any;
|
|
392
392
|
} ? O : any;
|
|
393
|
+
type PortNames<T> = [
|
|
394
|
+
T
|
|
395
|
+
] extends [
|
|
396
|
+
Record<string, Record<string, any>>
|
|
397
|
+
] ? string extends keyof T ? never : keyof T & string : never;
|
|
398
|
+
type PortMessage<T, P extends string> = T extends Record<string, any> ? (P extends keyof T ? T[P] : never) : never;
|
|
393
399
|
interface TestNodeHelpers<TInput = any, TOutput = any> {
|
|
394
400
|
receive(msg: TInput): Promise<void>;
|
|
395
401
|
close(removed?: boolean): Promise<void>;
|
|
396
402
|
reset(): void;
|
|
397
403
|
sent(): TOutput[];
|
|
404
|
+
sent<P extends PortNames<TOutput>>(port: P): PortMessage<TOutput, P>[];
|
|
398
405
|
sent(port: number): any[];
|
|
399
406
|
statuses(): any[];
|
|
400
407
|
logged(level?: "info" | "warn" | "error" | "debug"): string[];
|
package/vite/index.js
CHANGED
|
@@ -77,8 +77,12 @@ function copyFiles(targets, outDir) {
|
|
|
77
77
|
function getPackageName() {
|
|
78
78
|
const pkgPath = path.resolve("./package.json");
|
|
79
79
|
if (fs.existsSync(pkgPath)) {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
try {
|
|
81
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
82
|
+
return pkg.name;
|
|
83
|
+
} catch {
|
|
84
|
+
return "node-red-nodes";
|
|
85
|
+
}
|
|
82
86
|
}
|
|
83
87
|
return "node-red-nodes";
|
|
84
88
|
}
|
|
@@ -2375,7 +2379,7 @@ async function build2(clientBuildOptions, buildContext) {
|
|
|
2375
2379
|
const config = {
|
|
2376
2380
|
configFile: false,
|
|
2377
2381
|
logLevel: "warn",
|
|
2378
|
-
base:
|
|
2382
|
+
base: `/resources/${buildContext.packageName}`,
|
|
2379
2383
|
publicDir: path11.resolve(srcDir, "public"),
|
|
2380
2384
|
resolve: {
|
|
2381
2385
|
alias: {
|
|
@@ -2405,9 +2409,9 @@ async function build2(clientBuildOptions, buildContext) {
|
|
|
2405
2409
|
external,
|
|
2406
2410
|
treeshake: false,
|
|
2407
2411
|
output: {
|
|
2408
|
-
entryFileNames:
|
|
2409
|
-
chunkFileNames:
|
|
2410
|
-
assetFileNames:
|
|
2412
|
+
entryFileNames: "resources/index.[hash].js",
|
|
2413
|
+
chunkFileNames: "resources/vendor.[hash].js",
|
|
2414
|
+
assetFileNames: "resources/[name].[hash].[ext]",
|
|
2411
2415
|
globals,
|
|
2412
2416
|
paths: {
|
|
2413
2417
|
vue: "/nrg/assets/vue.esm-browser.prod.js",
|