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