@bonsae/nrg 0.6.3 → 0.8.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 +6 -4
- package/package.json +1 -1
- package/server/index.cjs +100 -85
- package/server/resources/nrg-client.js +2308 -2220
- package/types/server.d.ts +45 -32
package/types/server.d.ts
CHANGED
|
@@ -1716,33 +1716,6 @@ declare const TYPED_INPUT_TYPES: readonly [
|
|
|
1716
1716
|
"node",
|
|
1717
1717
|
"cred"
|
|
1718
1718
|
];
|
|
1719
|
-
export interface TNodeRef<T = any> extends TSchema {
|
|
1720
|
-
[Kind]: "NodeRef";
|
|
1721
|
-
static: T;
|
|
1722
|
-
type: "string";
|
|
1723
|
-
"x-nrg-node-type"?: string;
|
|
1724
|
-
}
|
|
1725
|
-
export type ResolveNodeRefs<T> = T extends TNodeRef<infer N> ? N : T extends (...args: any[]) => any ? T : T extends Array<infer Item> ? ResolveNodeRefs<Item>[] : T extends object ? {
|
|
1726
|
-
[K in keyof T]: ResolveNodeRefs<T[K]>;
|
|
1727
|
-
} : T;
|
|
1728
|
-
export type Infer<T extends TSchema> = ResolveNodeRefs<Static<T>>;
|
|
1729
|
-
export type TypedInputType = (typeof TYPED_INPUT_TYPES)[number];
|
|
1730
|
-
export interface TTypedInput extends TSchema {
|
|
1731
|
-
[Kind]: "TypedInput";
|
|
1732
|
-
static: {
|
|
1733
|
-
value: string | number | boolean | null;
|
|
1734
|
-
type: TypedInputType;
|
|
1735
|
-
};
|
|
1736
|
-
}
|
|
1737
|
-
export interface NrgFormOptions {
|
|
1738
|
-
icon?: string;
|
|
1739
|
-
typedInputTypes?: string[];
|
|
1740
|
-
editorLanguage?: string;
|
|
1741
|
-
toggle?: boolean;
|
|
1742
|
-
}
|
|
1743
|
-
export interface Schema<T extends TProperties = TProperties> extends TObject<T> {
|
|
1744
|
-
$id: string;
|
|
1745
|
-
}
|
|
1746
1719
|
export interface NodeRedRuntimeSettings {
|
|
1747
1720
|
userDir?: string;
|
|
1748
1721
|
nodesDir?: string | string[];
|
|
@@ -2072,6 +2045,48 @@ export interface NodeRedContextStore {
|
|
|
2072
2045
|
set(key: string, value: any, store: string | undefined, callback: (err: Error | null) => void): void;
|
|
2073
2046
|
keys(store: string | undefined, callback: (err: Error | null, keys: string[]) => void): void;
|
|
2074
2047
|
}
|
|
2048
|
+
declare class TypedInput<T = unknown> {
|
|
2049
|
+
private readonly RED;
|
|
2050
|
+
private readonly node;
|
|
2051
|
+
private readonly input;
|
|
2052
|
+
private readonly resolvers;
|
|
2053
|
+
constructor(RED: RED, node: NodeRedNode, input: {
|
|
2054
|
+
value: unknown;
|
|
2055
|
+
type: TypedInputType;
|
|
2056
|
+
});
|
|
2057
|
+
get type(): TypedInputType;
|
|
2058
|
+
get value(): unknown;
|
|
2059
|
+
resolve(msg?: Record<string, any>): Promise<T>;
|
|
2060
|
+
}
|
|
2061
|
+
export interface TNodeRef<T = any> extends TSchema {
|
|
2062
|
+
[Kind]: "NodeRef";
|
|
2063
|
+
static: T;
|
|
2064
|
+
type: "string";
|
|
2065
|
+
"x-nrg-node-type"?: string;
|
|
2066
|
+
}
|
|
2067
|
+
export type ResolveNodeRefs<T> = T extends TypedInput<any> ? T : T extends (...args: any[]) => any ? T : T extends Array<infer Item> ? ResolveNodeRefs<Item>[] : T extends object ? {
|
|
2068
|
+
[K in keyof T]: ResolveNodeRefs<T[K]>;
|
|
2069
|
+
} : T;
|
|
2070
|
+
export type Infer<T extends TSchema> = ResolveNodeRefs<Static<T>>;
|
|
2071
|
+
export type TypedInputType = (typeof TYPED_INPUT_TYPES)[number];
|
|
2072
|
+
export interface TTypedInput<T = unknown> extends TSchema {
|
|
2073
|
+
[Kind]: "TypedInput";
|
|
2074
|
+
static: TypedInput<T>;
|
|
2075
|
+
}
|
|
2076
|
+
export interface NrgFormOptions {
|
|
2077
|
+
icon?: string;
|
|
2078
|
+
typedInputTypes?: string[];
|
|
2079
|
+
editorLanguage?: string;
|
|
2080
|
+
toggle?: boolean;
|
|
2081
|
+
}
|
|
2082
|
+
export interface NrgSchemaOptions extends SchemaOptions {
|
|
2083
|
+
exportable?: boolean;
|
|
2084
|
+
"x-nrg-node-type"?: string;
|
|
2085
|
+
"x-nrg-form"?: NrgFormOptions;
|
|
2086
|
+
}
|
|
2087
|
+
export interface Schema<T extends TProperties = TProperties> extends TObject<T> {
|
|
2088
|
+
$id: string;
|
|
2089
|
+
}
|
|
2075
2090
|
declare const NodeConfigSchema: TObject<{
|
|
2076
2091
|
id: TString;
|
|
2077
2092
|
type: TString;
|
|
@@ -2095,11 +2110,11 @@ declare const IONodeConfigSchema: TObject<{
|
|
|
2095
2110
|
name: TString;
|
|
2096
2111
|
z: TOptional<TString>;
|
|
2097
2112
|
}>;
|
|
2098
|
-
declare function NodeRef<T extends new (...args: any[]) => any>(nodeClass: T, options?:
|
|
2099
|
-
declare function TypedInput(options?:
|
|
2113
|
+
declare function NodeRef<T extends new (...args: any[]) => any>(nodeClass: T, options?: NrgSchemaOptions): TNodeRef<InstanceType<T>>;
|
|
2114
|
+
declare function TypedInput$1<T = unknown>(options?: NrgSchemaOptions): TTypedInput<T>;
|
|
2100
2115
|
export declare const SchemaType: JavaScriptTypeBuilder & {
|
|
2101
2116
|
NodeRef: typeof NodeRef;
|
|
2102
|
-
TypedInput: typeof TypedInput;
|
|
2117
|
+
TypedInput: typeof TypedInput$1;
|
|
2103
2118
|
};
|
|
2104
2119
|
export declare function defineSchema<T extends TProperties>(properties: T, options: ObjectOptions & {
|
|
2105
2120
|
$id: string;
|
|
@@ -2112,7 +2127,6 @@ export interface NodeContextStore {
|
|
|
2112
2127
|
}
|
|
2113
2128
|
export type NodeConfig<TConfig = any> = TConfig & Static<typeof NodeConfigSchema>;
|
|
2114
2129
|
export type NodeCredentials<TCredentials = any> = TCredentials;
|
|
2115
|
-
type TypedInput$1 = Static<TTypedInput>;
|
|
2116
2130
|
export type IONodeContextScope = NodeContextScope;
|
|
2117
2131
|
export type IONodeConfig<TConfig = any> = NodeConfig<TConfig> & Static<typeof IONodeConfigSchema> & {
|
|
2118
2132
|
validateInput?: boolean;
|
|
@@ -2257,7 +2271,6 @@ declare abstract class Node$1<TConfig = any, TCredentials = any, TSettings = any
|
|
|
2257
2271
|
clearInterval(interval: NodeJS.Timeout): void;
|
|
2258
2272
|
created?(): void | Promise<void>;
|
|
2259
2273
|
closed?(removed?: boolean): void | Promise<void>;
|
|
2260
|
-
resolveTypedInput<T = any>(typedInput: TypedInput$1, msg?: Record<string, any>): Promise<T>;
|
|
2261
2274
|
on(event: string, callback: (...args: any[]) => void): void;
|
|
2262
2275
|
log(msg: any): void;
|
|
2263
2276
|
warn(message: string): void;
|