@luna-park/plugin 1.8.0 → 2.0.1
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/dist/dist-BBW6rNSm.mjs +85 -0
- package/dist/dist-Dyisk4Ug.mjs +827 -0
- package/dist/eslint.d.mts +1 -2
- package/dist/eslint.mjs +11 -4
- package/dist/extractor.d.mts +3 -13
- package/dist/extractor.mjs +32 -40
- package/dist/{index-76yMHag4.d.mts → index-w5zIwwtu.d.mts} +164 -145
- package/dist/index.d.mts +538 -459
- package/dist/index.mjs +1350 -212
- package/dist/preview.d.mts +1 -3
- package/dist/preview.mjs +5 -6
- package/package.json +30 -23
- package/dist/dist-BoFOku7q.mjs +0 -608
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
2
|
-
|
|
3
|
-
type DeepPartial<T> = { [K in keyof T]?:
|
|
2
|
+
type TDeepPartialValue<T> = T extends Array<infer TItem> ? Array<TDeepPartialValue<TItem>> : T extends ((...args: Array<never>) => unknown) ? T : T extends object ? DeepPartial<T> : T;
|
|
3
|
+
type DeepPartial<T> = { [K in keyof T]?: TDeepPartialValue<T[K]>; };
|
|
4
4
|
type MaybePromise<T> = T | Promise<T>;
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/vector.d.ts
|
|
7
5
|
type TVector = {
|
|
8
6
|
x: number;
|
|
9
7
|
y: number;
|
|
@@ -27,10 +25,6 @@ declare class CVector {
|
|
|
27
25
|
getPointString(): string;
|
|
28
26
|
getMagnitude(): number;
|
|
29
27
|
}
|
|
30
|
-
//#endregion
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region ../logicnodes/dist/index.d.mts
|
|
33
|
-
//#region src/logic/type.d.ts
|
|
34
28
|
declare enum EVarType {
|
|
35
29
|
exec = "exec",
|
|
36
30
|
number = "number",
|
|
@@ -43,15 +37,47 @@ declare enum EVarType {
|
|
|
43
37
|
type = "type",
|
|
44
38
|
function = "function",
|
|
45
39
|
union = "union",
|
|
40
|
+
intersection = "intersection",
|
|
46
41
|
unknown = "unknown",
|
|
47
42
|
undefined = "undefined",
|
|
48
43
|
void = "void"
|
|
49
44
|
}
|
|
50
45
|
type TProperties = Record<string, TSchema>;
|
|
46
|
+
/** Schema options, augmentable by the packages that own each option with `declare module "@luna-park/logicnodes"`. Other keys are free for plugin inputs. */
|
|
47
|
+
interface TSchemaOptions {
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
access?: TSchema<TObject>;
|
|
50
|
+
clamp?: boolean;
|
|
51
|
+
clean?: boolean;
|
|
52
|
+
fixed?: number;
|
|
53
|
+
foreignKey?: boolean;
|
|
54
|
+
format?: (value: string) => string | number;
|
|
55
|
+
freeze?: boolean;
|
|
56
|
+
hidden?: boolean | TSchemaHiddenCallback;
|
|
57
|
+
index?: boolean;
|
|
58
|
+
input?: string;
|
|
59
|
+
insert?: number | "last";
|
|
60
|
+
max?: number;
|
|
61
|
+
min?: number;
|
|
62
|
+
multiplier?: number;
|
|
63
|
+
notNull?: boolean;
|
|
64
|
+
onDelete?: string;
|
|
65
|
+
readonly?: boolean;
|
|
66
|
+
search?: boolean;
|
|
67
|
+
step?: number;
|
|
68
|
+
suffix?: string;
|
|
69
|
+
template?: Array<TSchema>;
|
|
70
|
+
token?: string;
|
|
71
|
+
type?: string;
|
|
72
|
+
unique?: boolean;
|
|
73
|
+
watch?: boolean;
|
|
74
|
+
}
|
|
75
|
+
type TSchemaHiddenCallback = {
|
|
76
|
+
hidden(values: Record<string, unknown>): boolean;
|
|
77
|
+
}["hidden"];
|
|
51
78
|
interface TArguments<TType = unknown> {
|
|
52
|
-
build
|
|
79
|
+
build?(arg: unknown): unknown;
|
|
53
80
|
customizable?: boolean;
|
|
54
|
-
default?: TType | (() => TType);
|
|
55
81
|
defaultType?: TSchema;
|
|
56
82
|
description?: string;
|
|
57
83
|
dynamic?: ((arg: {
|
|
@@ -61,16 +87,13 @@ interface TArguments<TType = unknown> {
|
|
|
61
87
|
}) => TSchema);
|
|
62
88
|
enum?: TEnum<TType>;
|
|
63
89
|
example?: unknown;
|
|
64
|
-
format?: "date-time" | "email" | "color";
|
|
90
|
+
format?: "date-time" | "email" | "color" | "password";
|
|
65
91
|
multiple?: boolean;
|
|
66
92
|
name?: string;
|
|
93
|
+
nullable?: boolean;
|
|
67
94
|
optional?: boolean;
|
|
68
|
-
options?:
|
|
69
|
-
|
|
70
|
-
freeze?: boolean;
|
|
71
|
-
readonly?: boolean;
|
|
72
|
-
} & Record<string, unknown>;
|
|
73
|
-
parse?: (arg: unknown) => unknown;
|
|
95
|
+
options?: TSchemaOptions;
|
|
96
|
+
parse?(arg: unknown): unknown;
|
|
74
97
|
placeholder?: string;
|
|
75
98
|
priority?: boolean;
|
|
76
99
|
promise?: boolean;
|
|
@@ -79,89 +102,116 @@ interface TArguments<TType = unknown> {
|
|
|
79
102
|
sub?: TSchema;
|
|
80
103
|
}
|
|
81
104
|
type TEnum<TEnumType> = Array<TEnumType> | Record<string, TEnumType>;
|
|
105
|
+
type TSchemaArguments<TType = unknown> = TArguments<TType> & {
|
|
106
|
+
default?: TType;
|
|
107
|
+
};
|
|
82
108
|
interface TExec {
|
|
109
|
+
default?: never;
|
|
83
110
|
type: EVarType.exec;
|
|
84
111
|
}
|
|
85
112
|
interface TNumber {
|
|
113
|
+
default?: number;
|
|
86
114
|
static: number;
|
|
87
115
|
type: EVarType.number;
|
|
88
116
|
}
|
|
89
|
-
interface TString {
|
|
90
|
-
|
|
117
|
+
interface TString<T extends string = string> {
|
|
118
|
+
default?: T;
|
|
119
|
+
static: T;
|
|
91
120
|
type: EVarType.string;
|
|
92
121
|
}
|
|
93
122
|
interface TBoolean {
|
|
123
|
+
default?: boolean;
|
|
94
124
|
static: boolean;
|
|
95
125
|
type: EVarType.boolean;
|
|
96
126
|
}
|
|
97
|
-
interface TUnknown {
|
|
98
|
-
|
|
127
|
+
interface TUnknown<T = unknown> {
|
|
128
|
+
default?: T;
|
|
129
|
+
static: T;
|
|
99
130
|
type: EVarType.unknown;
|
|
100
131
|
}
|
|
101
132
|
interface TUndefined {
|
|
133
|
+
default?: undefined;
|
|
102
134
|
static: undefined;
|
|
103
135
|
type: EVarType.undefined;
|
|
104
136
|
}
|
|
105
137
|
interface TVoid {
|
|
138
|
+
default?: never;
|
|
106
139
|
static: void;
|
|
107
140
|
type: EVarType.void;
|
|
108
141
|
}
|
|
109
142
|
interface TObject<T extends TProperties = TProperties> {
|
|
143
|
+
default?: StaticObject<T>;
|
|
110
144
|
properties: T;
|
|
111
145
|
static: StaticObject<T>;
|
|
112
146
|
type: EVarType.object;
|
|
113
147
|
}
|
|
114
148
|
type TRecordKey = TString | TNumber;
|
|
115
149
|
interface TRecord<TKey extends TRecordKey = TString, TValue extends TSchema = TSchema> {
|
|
150
|
+
default?: StaticRecord<TKey, TValue>;
|
|
116
151
|
key: TKey;
|
|
117
152
|
static: StaticRecord<TKey, TValue>;
|
|
118
153
|
type: EVarType.record;
|
|
119
154
|
value: TValue;
|
|
120
155
|
}
|
|
121
156
|
interface TInterface<T = unknown> {
|
|
122
|
-
class?: new (...args: Array<
|
|
157
|
+
class?: new (...args: Array<never>) => T;
|
|
123
158
|
className: string;
|
|
159
|
+
default?: T;
|
|
124
160
|
static: T;
|
|
125
161
|
type: EVarType.interface;
|
|
126
162
|
}
|
|
127
163
|
interface TType<T = unknown> {
|
|
164
|
+
default?: T;
|
|
165
|
+
path?: Array<string>;
|
|
128
166
|
static: T;
|
|
129
167
|
target: Array<string>;
|
|
130
168
|
type: EVarType.type;
|
|
131
169
|
}
|
|
132
170
|
interface TArray<T extends TSchema = TSchema> {
|
|
171
|
+
default?: Array<StaticSchema<T>>;
|
|
133
172
|
items: T;
|
|
134
173
|
static: Array<StaticSchema<T>>;
|
|
135
174
|
type: EVarType.array;
|
|
136
175
|
}
|
|
137
176
|
interface TUnion<T extends ReadonlyArray<TSchema> = ReadonlyArray<TSchema>> {
|
|
177
|
+
default?: StaticUnion<T>;
|
|
138
178
|
elements: T;
|
|
139
179
|
static: StaticUnion<T>;
|
|
140
180
|
type: EVarType.union;
|
|
141
181
|
}
|
|
142
|
-
|
|
182
|
+
interface TIntersection<T extends ReadonlyArray<TSchema> = ReadonlyArray<TSchema>> {
|
|
183
|
+
default?: StaticIntersection<T>;
|
|
184
|
+
elements: T;
|
|
185
|
+
static: StaticIntersection<T>;
|
|
186
|
+
type: EVarType.intersection;
|
|
187
|
+
}
|
|
188
|
+
interface TFunction<TInputs extends TObject = TObject, TOutput extends TSchema = TSchema, TPromise extends boolean = false, TParameters extends ReadonlyArray<TSchema> = ReadonlyArray<TSchema>> {
|
|
189
|
+
default?: never;
|
|
143
190
|
inputs: TInputs;
|
|
144
191
|
output: TOutput;
|
|
145
192
|
static: StaticFunction<TParameters, TOutput, TPromise>;
|
|
146
193
|
type: EVarType.function;
|
|
147
|
-
}
|
|
148
|
-
type TAnyLogic = TExec | TObject | TRecord<TRecordKey> | TInterface | TType | TArray | TString | TNumber | TBoolean | TUnknown | TUndefined | TUnion | TFunction<TObject,
|
|
194
|
+
}
|
|
195
|
+
type TAnyLogic = TExec | TObject | TRecord<TRecordKey> | TInterface | TType | TArray | TString | TNumber | TBoolean | TUnknown | TUndefined | TUnion | TIntersection | TFunction<TObject, TAnyLogic & TArguments, boolean, ReadonlyArray<never>> | TVoid;
|
|
149
196
|
type TSchema<TLogic extends TAnyLogic = TAnyLogic> = TLogic & TArguments;
|
|
150
197
|
declare const LogicType: {
|
|
151
|
-
array: <T extends TSchema, TArgs extends
|
|
152
|
-
boolean: <TArgs extends
|
|
153
|
-
exec: <const TArgs extends TArguments = {}>(args?: TArgs) => TExec & TArgs
|
|
198
|
+
array: <T extends TSchema, TArgs extends TSchemaArguments<Array<StaticSchema<T>>>>(items: T, args?: TArgs) => TSchema<TArray<T>> & NoInfer<TArgs>;
|
|
199
|
+
boolean: <TArgs extends TSchemaArguments<boolean>>(args?: TArgs) => TSchema<TBoolean> & NoInfer<TArgs>;
|
|
200
|
+
exec: <const TArgs extends TArguments = {}>(args?: TArgs & TArguments) => TSchema<TExec> & NoInfer<TArgs>;
|
|
154
201
|
function: typeof createFunction;
|
|
155
|
-
interface: <T = unknown, TArgs extends
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
202
|
+
interface: <T = unknown, TArgs extends TSchemaArguments<T> = TSchemaArguments<T>>(interfaceClass: (new (...args: Array<never>) => T) | string, args?: TArgs) => TSchema<TInterface<T>> & NoInfer<TArgs>;
|
|
203
|
+
intersection: <const T extends ReadonlyArray<TSchema>, const TArgs extends TSchemaArguments<StaticIntersection<T>> = {}>(elements: T, args?: TArgs & TSchemaArguments<StaticIntersection<T>>) => TSchema<TIntersection<T>> & NoInfer<TArgs>;
|
|
204
|
+
number: <TArgs extends TSchemaArguments<number>>(args?: TArgs) => TSchema<TNumber> & NoInfer<TArgs>;
|
|
205
|
+
object: <T extends TProperties, TArgs extends TSchemaArguments<object>>(properties?: T, args?: TArgs) => TSchema<TObject<T>> & NoInfer<TArgs>;
|
|
206
|
+
record: <TKey extends TRecordKey, TValue extends TSchema, const TArgs extends TSchemaArguments<StaticRecord<TKey, TValue>> = {}>(key: TKey, value: TValue, args?: TArgs & TSchemaArguments<StaticRecord<TKey, TValue>>) => TSchema<TRecord<TKey, TValue>> & NoInfer<TArgs>;
|
|
207
|
+
string: <const TValue extends string = string, TArgs extends TSchemaArguments<string> = TSchemaArguments<string>>(args?: TArgs & {
|
|
208
|
+
enum?: TEnum<TValue>;
|
|
209
|
+
}) => TSchema<TString<TValue>> & NoInfer<TArgs>;
|
|
160
210
|
type: typeof createType;
|
|
161
|
-
undefined: <const TArgs extends
|
|
162
|
-
union: <const T extends ReadonlyArray<TSchema>, const TArgs extends
|
|
163
|
-
unknown: <TArgs extends
|
|
164
|
-
void: <const TArgs extends
|
|
211
|
+
undefined: <const TArgs extends TSchemaArguments<undefined> = {}>(args?: TArgs & TSchemaArguments<undefined>) => TSchema<TUndefined> & NoInfer<TArgs>;
|
|
212
|
+
union: <const T extends ReadonlyArray<TSchema>, const TArgs extends TSchemaArguments<StaticUnion<T>> = {}>(elements: T, args?: TArgs & TSchemaArguments<StaticUnion<T>>) => TSchema<TUnion<T>> & NoInfer<TArgs>;
|
|
213
|
+
unknown: <T = unknown, TArgs extends TSchemaArguments<T> = TSchemaArguments<T>>(args?: TArgs) => TSchema<TUnknown<T>> & NoInfer<TArgs>;
|
|
214
|
+
void: <const TArgs extends TSchemaArguments<void> = {}>(args?: TArgs & TSchemaArguments<void>) => TSchema<TVoid> & NoInfer<TArgs>;
|
|
165
215
|
};
|
|
166
216
|
type OptionalKeys<T extends TProperties> = { [K in keyof T]: T[K] extends {
|
|
167
217
|
optional: true;
|
|
@@ -170,9 +220,11 @@ type RequiredKeys<T extends TProperties> = Exclude<keyof T, OptionalKeys<T>>;
|
|
|
170
220
|
type StaticSchema<T extends TSchema> = [TSchema] extends [T] ? unknown : T extends {
|
|
171
221
|
static: unknown;
|
|
172
222
|
} ? Static<T> : unknown;
|
|
173
|
-
type StaticObject<T extends TProperties> = string extends keyof T ? Record<string, unknown> : { [K in RequiredKeys<T>]: StaticSchema<T[K]>; } & { [K in OptionalKeys<T>]?: StaticSchema<T[K]>; };
|
|
174
|
-
type StaticRecord<TKey extends
|
|
223
|
+
type StaticObject<T extends TProperties> = string extends keyof T ? Record<string, unknown> : keyof T extends never ? Record<string, unknown> : { [K in RequiredKeys<T>]: StaticSchema<T[K]>; } & { [K in OptionalKeys<T>]?: StaticSchema<T[K]>; };
|
|
224
|
+
type StaticRecord<TKey extends TRecordKey, TValue extends TSchema> = Record<TKey["static"] & (string | number), StaticSchema<TValue>>;
|
|
175
225
|
type StaticUnion<T extends ReadonlyArray<TSchema>> = StaticSchema<T[number]>;
|
|
226
|
+
type UnionToIntersection<T> = (T extends unknown ? (value: T) => void : never) extends ((value: infer TResult) => void) ? TResult : never;
|
|
227
|
+
type StaticIntersection<T extends ReadonlyArray<TSchema>> = UnionToIntersection<StaticSchema<T[number]>>;
|
|
176
228
|
type TStaticParameters<T extends ReadonlyArray<TSchema>> = number extends T["length"] ? Array<StaticSchema<T[number]>> : T extends readonly [...infer TRest extends ReadonlyArray<TSchema>, infer TLast extends TSchema] ? TLast extends {
|
|
177
229
|
optional: true;
|
|
178
230
|
} ? [...TStaticParameters<TRest>, StaticSchema<TLast>?] : [...TStaticParameters<TRest>, StaticSchema<TLast>] : [];
|
|
@@ -184,23 +236,30 @@ type TObjectParameters<T extends TObject> = keyof T["properties"] extends never
|
|
|
184
236
|
type TFunctionPromise<T extends TArguments> = "promise" extends keyof T ? Exclude<T["promise"], undefined> : false;
|
|
185
237
|
declare function createFunction<const TEntries extends TFunctionEntries = [], TOutput extends TSchema = TVoid, const TArgs extends TArguments = {}>(inputs?: TEntries, output?: TOutput, args?: TArgs): TFunction<TObject<TEntryProperties<TEntries>>, TOutput, TFunctionPromise<TArgs>, TEntryParameters<TEntries>> & TArgs;
|
|
186
238
|
declare function createFunction<TInputs extends TObject, TOutput extends TSchema = TVoid, const TArgs extends TArguments = {}>(inputs: TInputs, output?: TOutput, args?: TArgs): TFunction<TInputs, TOutput, TFunctionPromise<TArgs>, TObjectParameters<TInputs>> & TArgs;
|
|
187
|
-
declare function createType<T, const TArgs extends
|
|
239
|
+
declare function createType<T, const TArgs extends TSchemaArguments<T> & {
|
|
188
240
|
optional: true;
|
|
189
|
-
} =
|
|
241
|
+
} = TSchemaArguments<T> & {
|
|
190
242
|
optional: true;
|
|
191
243
|
}>(target: Array<string>, args: TArgs): TType<T> & TArgs;
|
|
192
|
-
declare function createType<T, const TArgs extends
|
|
244
|
+
declare function createType<T, const TArgs extends TSchemaArguments<T> = TSchemaArguments<T>>(target: Array<string>, args?: TArgs): TType<T> & TArgs;
|
|
193
245
|
type Static<T extends {
|
|
246
|
+
nullable?: boolean;
|
|
194
247
|
optional?: boolean;
|
|
195
|
-
static
|
|
248
|
+
static?: unknown;
|
|
196
249
|
}> = T extends {
|
|
197
250
|
optional: true;
|
|
198
|
-
} ? (T["static"] | undefined) : T
|
|
251
|
+
} ? (T["static"] | undefined) : T extends {
|
|
252
|
+
nullable: true;
|
|
253
|
+
} ? (T["static"] | null | undefined) : T["static"];
|
|
199
254
|
type TTransformedObject<TTarget extends TObject, T extends TProperties> = Omit<TTarget, "properties" | "static"> & TObject<T>;
|
|
200
255
|
type TWithOptional<T extends TSchema, TOptional extends boolean> = T extends TSchema ? Omit<T, "optional"> & {
|
|
201
256
|
optional: TOptional;
|
|
202
257
|
} : never;
|
|
203
|
-
type TPartialOptional<T extends TSchema> = T
|
|
258
|
+
type TPartialOptional<T extends TSchema> = T extends {
|
|
259
|
+
required: true;
|
|
260
|
+
} ? false : T extends {
|
|
261
|
+
required: boolean;
|
|
262
|
+
} ? (true extends T["required"] ? boolean : true) : true;
|
|
204
263
|
type TPartialProperties<T extends TProperties, TForce extends boolean> = TForce extends true ? { [K in keyof T]: TWithOptional<T[K], TPartialOptional<T[K]>>; } : { [K in keyof T]: TWithOptional<T[K], true>; };
|
|
205
264
|
type TRequiredProperties<T extends TProperties> = { [K in keyof T]: TWithOptional<T[K], false>; };
|
|
206
265
|
type TPickedProperties<T extends TProperties, TKeys extends ReadonlyArray<string>> = number extends TKeys["length"] ? TProperties : Pick<T, Extract<TKeys[number], keyof T>>;
|
|
@@ -212,8 +271,6 @@ declare const LogicUtil: {
|
|
|
212
271
|
promise(target: TSchema): TSchema;
|
|
213
272
|
required<TTarget extends TObject>(target: TTarget): TTransformedObject<TTarget, TRequiredProperties<TTarget["properties"]>>;
|
|
214
273
|
};
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region src/logic/interface.d.ts
|
|
217
274
|
type TInterfaceConstantValue = string | number | boolean | object;
|
|
218
275
|
type TInterfaceConstantConfig<TEditor = unknown> = {
|
|
219
276
|
build?: {
|
|
@@ -224,20 +281,18 @@ type TInterfaceConstantConfig<TEditor = unknown> = {
|
|
|
224
281
|
}>;
|
|
225
282
|
};
|
|
226
283
|
editor?: TEditor;
|
|
227
|
-
parse
|
|
284
|
+
parse?(value: TInterfaceConstantValue): unknown;
|
|
228
285
|
schema?: TSchema;
|
|
229
|
-
serialize
|
|
286
|
+
serialize?(instance: unknown): TInterfaceConstantValue;
|
|
230
287
|
};
|
|
231
288
|
type TInterfaceConfig<TEditor = unknown> = {
|
|
232
|
-
class?: new (...args: Array<
|
|
289
|
+
class?: new (...args: Array<never>) => unknown;
|
|
233
290
|
constant?: TInterfaceConstantConfig<TEditor>;
|
|
234
291
|
extends?: Array<string>;
|
|
235
292
|
name: string;
|
|
236
293
|
};
|
|
237
|
-
//#endregion
|
|
238
|
-
//#region src/logic/node.d.ts
|
|
239
294
|
type Component = {
|
|
240
|
-
name
|
|
295
|
+
name?: string;
|
|
241
296
|
};
|
|
242
297
|
type TNodeInterfaceDescriptor = Record<string, TSchema>;
|
|
243
298
|
declare enum ELogicType {
|
|
@@ -290,23 +345,19 @@ type TNodeIOSchema<TInterface extends TNodeInterfaceDescriptor> = { [TKey in key
|
|
|
290
345
|
schema: TOnlyVarsOf<TInterface>[TKey];
|
|
291
346
|
value: Static<TOnlyVarsOf<TInterface>[TKey]>;
|
|
292
347
|
}; };
|
|
293
|
-
type TNodeOptionals<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor> = { [TKey in keyof
|
|
348
|
+
type TNodeOptionals<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor> = { [TKey in keyof TOnlyVarsOf<TInputs> | keyof TOnlyVarsOf<TOutputs>]: boolean; };
|
|
294
349
|
type TNodeConfigSchema<TConfig extends TNodeConfigDescriptor> = {
|
|
295
350
|
internal?: unknown;
|
|
296
351
|
} & { [TKey in keyof TConfig]: Static<TConfig[TKey]>; };
|
|
297
|
-
type
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
inputs: TNodeIOSchema<TInputs>;
|
|
307
|
-
optionals: TNodeOptionals<TInputs, TOutputs>;
|
|
308
|
-
outputs: TNodeIOSchema<TOutputs>;
|
|
309
|
-
}) => Partial<TNodeInterfaceDescriptor>;
|
|
352
|
+
type TNodeDynamicsSchema<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor, TDynamicInputs extends TNodeInterfaceDescriptor, TDynamicOutputs extends TNodeInterfaceDescriptor> = {
|
|
353
|
+
config: TNodeConfigSchema<TConfig>;
|
|
354
|
+
inputs: TNodeIOSchema<TInputs> & Partial<TNodeIOSchema<TDynamicInputs>>;
|
|
355
|
+
optionals: TNodeOptionals<TInputs & TDynamicInputs, TOutputs & TDynamicOutputs>;
|
|
356
|
+
outputs: TNodeIOSchema<TOutputs> & Partial<TNodeIOSchema<TDynamicOutputs>>;
|
|
357
|
+
};
|
|
358
|
+
type TNodeDynamics<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor, TDynamicInputs extends TNodeInterfaceDescriptor = {}, TDynamicOutputs extends TNodeInterfaceDescriptor = {}> = {
|
|
359
|
+
inputs?(ioSchema: TNodeDynamicsSchema<TInputs, TOutputs, TConfig, TDynamicInputs, TDynamicOutputs>): Partial<TNodeInterfaceDescriptor>;
|
|
360
|
+
outputs?(ioSchema: TNodeDynamicsSchema<TInputs, TOutputs, TConfig, TDynamicInputs, TDynamicOutputs>): Partial<TNodeInterfaceDescriptor>;
|
|
310
361
|
};
|
|
311
362
|
type TDocumentation = {
|
|
312
363
|
description?: string;
|
|
@@ -329,99 +380,67 @@ type TDocumentation = {
|
|
|
329
380
|
};
|
|
330
381
|
type TOnlyExecOf<TNodeInterfaceDescriptor> = { [TAnchor in keyof TNodeInterfaceDescriptor as TNodeInterfaceDescriptor[TAnchor] extends TExec ? TAnchor : never]: TNodeInterfaceDescriptor[TAnchor]; };
|
|
331
382
|
type TOnlyVarsOf<TNodeInterfaceDescriptor> = { [TAnchor in keyof TNodeInterfaceDescriptor as TNodeInterfaceDescriptor[TAnchor] extends TExec ? never : TAnchor]: TNodeInterfaceDescriptor[TAnchor]; };
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
type
|
|
383
|
+
/** A node method, either a plain function or a pair of async/sync implementations. */
|
|
384
|
+
type TNodeMethod<T = unknown> = (() => MaybePromise<T>) | {
|
|
385
|
+
async: () => Promise<T>;
|
|
386
|
+
sync: () => MaybePromise<T>;
|
|
387
|
+
};
|
|
388
|
+
type TMethodsFrom<TInterface extends TNodeInterfaceDescriptor> = { [TKey in keyof TInterface]: TNodeMethod<Static<TInterface[TKey]>>; };
|
|
389
|
+
type TMethodsOf<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor> = TMethodsFrom<TOnlyExecOf<TInputs>> & TMethodsFrom<TOnlyVarsOf<TOutputs>>;
|
|
390
|
+
type TNodeMethods<TInputs extends TNodeInterfaceDescriptor = TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor = TNodeInterfaceDescriptor, TDynamicInputs extends TNodeInterfaceDescriptor = {}, TDynamicOutputs extends TNodeInterfaceDescriptor = {}> = string extends keyof TInputs ? Record<string, TNodeMethod> : Partial<TMethodsOf<TInputs, TOutputs> & TMethodsOf<TDynamicInputs, TDynamicOutputs>>;
|
|
391
|
+
type TExecCallbacksOf<TOutputs extends TNodeInterfaceDescriptor> = { [TKey in keyof TOnlyExecOf<TOutputs>]: (stack?: unknown) => Promise<void>; };
|
|
392
|
+
type TValuesOf<TInterface extends TNodeInterfaceDescriptor> = { [TKey in keyof TOnlyVarsOf<TInterface>]: Static<TInterface[TKey]>; };
|
|
393
|
+
type TNodeThis<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor, TDynamicInputs extends TNodeInterfaceDescriptor = {}, TDynamicOutputs extends TNodeInterfaceDescriptor = {}> = TExecCallbacksOf<TOutputs> & Partial<TExecCallbacksOf<TDynamicOutputs>> & TValuesOf<TInputs> & TValuesOf<TOutputs> & Partial<TValuesOf<TDynamicInputs>> & Partial<TValuesOf<TDynamicOutputs>> & Record<`internal_${string}` | `in_${string}` | `out_${string}`, unknown> & Record<`out_${string}exec`, (stack?: unknown) => Promise<void>> & {
|
|
338
394
|
arguments: Array<unknown>;
|
|
339
395
|
cache: Record<string, unknown>;
|
|
340
|
-
config:
|
|
396
|
+
config: TNodeConfigSchema<TConfig>;
|
|
341
397
|
instance: <TValue>(deps: Array<unknown>, factory: () => TValue, key?: string) => TValue;
|
|
342
398
|
properties: Record<string, {
|
|
343
399
|
name: string;
|
|
344
400
|
value: Promise<unknown>;
|
|
345
401
|
}>;
|
|
346
402
|
stack: any;
|
|
347
|
-
}
|
|
348
|
-
type
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
403
|
+
};
|
|
404
|
+
type TNodeDescriptor<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor, TDynamicInputs extends TNodeInterfaceDescriptor = {}, TDynamicOutputs extends TNodeInterfaceDescriptor = {}> = TNodeGenerated<TInputs, TOutputs, TConfig, TDynamicInputs, TDynamicOutputs> & ThisType<TNodeThis<TInputs, TOutputs, TConfig, TDynamicInputs, TDynamicOutputs>>;
|
|
405
|
+
type TNodeBuild<TInputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor> = {
|
|
406
|
+
define?: Array<{
|
|
407
|
+
id(data: {
|
|
408
|
+
input?: TOnlyVarsOf<TInputs>;
|
|
409
|
+
}): string;
|
|
410
|
+
values(data: {
|
|
411
|
+
input?: TOnlyVarsOf<TInputs>;
|
|
412
|
+
}): string;
|
|
413
|
+
}>;
|
|
414
|
+
entry?: boolean;
|
|
415
|
+
generate?(data: {
|
|
416
|
+
config: TNodeConfigSchema<TConfig>;
|
|
417
|
+
id?: string;
|
|
418
|
+
inputKeys: Array<string>;
|
|
419
|
+
key?: string;
|
|
420
|
+
}): string;
|
|
421
|
+
imports?: Array<{
|
|
422
|
+
name: string;
|
|
423
|
+
target: string;
|
|
424
|
+
}>;
|
|
425
|
+
};
|
|
426
|
+
type TNodeShape<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor, TDynamicInputs extends TNodeInterfaceDescriptor, TDynamicOutputs extends TNodeInterfaceDescriptor> = {
|
|
427
|
+
build?: TNodeBuild<TInputs, TConfig>;
|
|
370
428
|
config?: TConfig;
|
|
371
429
|
display?: TNodeDisplay;
|
|
372
430
|
documentation?: TDocumentation;
|
|
373
|
-
|
|
431
|
+
dynamicInputs?: TDynamicInputs;
|
|
432
|
+
dynamicOutputs?: TDynamicOutputs;
|
|
433
|
+
dynamics?: TNodeDynamics<TInputs, TOutputs, TConfig, TDynamicInputs, TDynamicOutputs>;
|
|
374
434
|
inputs: TInputs;
|
|
375
|
-
methods:
|
|
376
|
-
name?: string;
|
|
435
|
+
methods: TNodeMethods<TInputs, TOutputs, NoInfer<TDynamicInputs>, NoInfer<TDynamicOutputs>>;
|
|
377
436
|
outputs: TOutputs;
|
|
378
437
|
type?: ELogicType;
|
|
379
438
|
};
|
|
380
|
-
type
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
input?: Record<string, unknown>;
|
|
385
|
-
}) => string;
|
|
386
|
-
values: (data: {
|
|
387
|
-
input?: Record<string, unknown>;
|
|
388
|
-
}) => string;
|
|
389
|
-
}>;
|
|
390
|
-
entry?: boolean;
|
|
391
|
-
generate?: (options: {
|
|
392
|
-
config: Record<string, unknown>;
|
|
393
|
-
id?: string;
|
|
394
|
-
inputKeys: Array<string>;
|
|
395
|
-
key: string;
|
|
396
|
-
}) => string;
|
|
397
|
-
imports?: Array<{
|
|
398
|
-
name: string;
|
|
399
|
-
target: string;
|
|
400
|
-
}>;
|
|
401
|
-
};
|
|
402
|
-
config?: TNodeConfigDescriptor;
|
|
403
|
-
display?: TNodeDisplay;
|
|
404
|
-
documentation?: TDocumentation;
|
|
405
|
-
dynamics?: {
|
|
406
|
-
inputs?: (ioSchema: {
|
|
407
|
-
config: Record<string, unknown>;
|
|
408
|
-
inputs: Record<string, unknown>;
|
|
409
|
-
optionals: Record<string, boolean>;
|
|
410
|
-
outputs: Record<string, unknown>;
|
|
411
|
-
}) => TNodeInterfaceDescriptor;
|
|
412
|
-
outputs?: (ioSchema: {
|
|
413
|
-
config: Record<string, unknown>;
|
|
414
|
-
inputs: Record<string, unknown>;
|
|
415
|
-
optionals: Record<string, boolean>;
|
|
416
|
-
outputs: Record<string, unknown>;
|
|
417
|
-
}) => TNodeInterfaceDescriptor;
|
|
418
|
-
};
|
|
419
|
-
inputs: TNodeInterfaceDescriptor;
|
|
420
|
-
methods: Record<string, () => unknown>;
|
|
439
|
+
type TNodeGenerated<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor, TDynamicInputs extends TNodeInterfaceDescriptor = {}, TDynamicOutputs extends TNodeInterfaceDescriptor = {}> = TNodeShape<TInputs, TOutputs, TConfig, TDynamicInputs, TDynamicOutputs> & {
|
|
440
|
+
name?: string;
|
|
441
|
+
};
|
|
442
|
+
type TLogicNode<TInputs extends TNodeInterfaceDescriptor = TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor = TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor = TNodeConfigDescriptor, TDynamicInputs extends TNodeInterfaceDescriptor = TNodeInterfaceDescriptor, TDynamicOutputs extends TNodeInterfaceDescriptor = TNodeInterfaceDescriptor> = TNodeShape<TInputs, TOutputs, TConfig, TDynamicInputs, TDynamicOutputs> & {
|
|
421
443
|
name: string;
|
|
422
|
-
outputs: TNodeInterfaceDescriptor;
|
|
423
|
-
type?: ELogicType;
|
|
424
444
|
};
|
|
425
|
-
declare function makeLogicNode<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor>(node: TNodeDescriptor<TInputs, TOutputs, TConfig>): TLogicNode
|
|
426
|
-
//#endregion
|
|
445
|
+
declare function makeLogicNode<TInputs extends TNodeInterfaceDescriptor, TOutputs extends TNodeInterfaceDescriptor, TConfig extends TNodeConfigDescriptor, TDynamicInputs extends TNodeInterfaceDescriptor = {}, TDynamicOutputs extends TNodeInterfaceDescriptor = {}>(node: TNodeDescriptor<TInputs, TOutputs, TConfig, TDynamicInputs, TDynamicOutputs>): TLogicNode<TInputs, TOutputs, TConfig, NoInfer<TDynamicInputs>, NoInfer<TDynamicOutputs>>;
|
|
427
446
|
export { TVector as _, LogicUtil as a, TInterfaceConstantValue as c, TSchema as d, TVoid as f, MaybePromise as g, DeepPartial as h, LogicType as i, TLogicNode as l, CVector as m, ELogicType as n, Static as o, makeLogicNode as p, EVarType as r, TInterfaceConfig as s, ELogicScope as t, TObject as u };
|