@meshflow/core 0.1.7 → 0.2.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/README.md CHANGED
@@ -61,7 +61,7 @@ const engine = useMeshFlow<Ref<number,number>,AllPath>('main',schema, {
61
61
  // useGreedy:true
62
62
  // },
63
63
  UITrigger:{//以vue为例
64
- signalCreateor: () => ref(0),
64
+ signalCreator: () => ref(0),
65
65
  signalTrigger(signal) {
66
66
  signal.value++;
67
67
  },
package/index.d.mts CHANGED
@@ -3,50 +3,67 @@ interface MeshErrorContext {
3
3
  error: any;
4
4
  }
5
5
 
6
+ declare enum DefaultStarategy {
7
+ OR = "OR",
8
+ PRIORITY = "PRIORITY"
9
+ }
10
+
11
+ type Unwrap<T> = T extends ReadonlyArray<infer U> ? U : T;
12
+ type InferLeafPath<T, Prefix extends string = ""> = Unwrap<T> extends infer Node ? Node extends {
13
+ readonly name: infer N;
14
+ } ? N extends string ? N extends "" ? Node extends {
15
+ readonly children: infer C;
16
+ } ? InferLeafPath<C, Prefix> : never : (Node extends {
17
+ readonly children: infer C;
18
+ } ? InferLeafPath<C, Prefix extends "" ? N : `${Prefix}.${N}`> : (Prefix extends "" ? N : `${Prefix}.${N}`)) : N extends number | symbol ? Node extends {
19
+ readonly children: infer C;
20
+ } ? InferLeafPath<C, Prefix> : N : never : never : never;
21
+ type KeysOfUnion<T> = T extends any ? keyof T : never;
22
+
6
23
  interface MeshEvents {
7
24
  'node:start': {
8
- path: string;
25
+ path: MeshPath;
9
26
  };
10
27
  'node:success': {
11
- path: string;
28
+ path: MeshPath;
12
29
  };
13
30
  'node:bucket:success': {
14
- path: string;
31
+ path: MeshPath;
15
32
  key: string;
16
33
  value: any;
17
34
  };
18
35
  'node:error': {
19
- path: string;
36
+ path: MeshPath;
20
37
  error: any;
21
38
  };
22
39
  'node:intercept': {
23
- path: string;
40
+ path: MeshPath;
24
41
  type: number;
25
42
  detail?: any;
26
43
  };
27
44
  'node:release': {
28
- path: string;
45
+ path: MeshPath;
29
46
  type: number;
30
47
  detail?: any;
31
48
  };
32
49
  'node:stagnate': {
33
- path: string;
50
+ path: MeshPath;
34
51
  type: number;
35
52
  };
36
53
  'node:processing': {
37
- path: string;
54
+ path: MeshPath;
38
55
  };
39
56
  'flow:wait': {
40
57
  type: number;
41
58
  detail?: any;
42
59
  };
43
60
  'flow:fire': {
44
- path: string;
61
+ path: MeshPath;
45
62
  type: number;
46
63
  detail?: any;
47
64
  };
48
65
  'flow:start': {
49
- path: string;
66
+ path: MeshPath;
50
67
  };
51
68
  'flow:success': {
52
69
  duration: string;
@@ -55,165 +72,115 @@ interface MeshEvents {
55
72
  type: number;
56
73
  };
57
74
  'node:pending': {
58
- path: string;
75
+ path: MeshPath;
59
76
  };
60
77
  }
61
78
  type MeshEventName = keyof MeshEvents;
62
-
63
- type ContractType = 'boolean' | 'scalar' | 'array' | 'object';
64
- declare enum DefaultStarategy {
65
- OR = "OR",
66
- PRIORITY = "PRIORITY"
67
- }
68
- declare class SchemaBucket<P> {
69
- private path;
70
- private strategy;
71
- contract: ContractType;
72
- private rules;
73
- private isValue;
74
- private id;
75
- private cache;
76
- private pendingPromise;
77
- private version;
78
- private deps;
79
- private _forceNotify;
80
- promiseToken: any;
81
- private effectArray;
82
- constructor(baseValue: any, key: string, path: P);
83
- forceNotify(): void;
84
- isForceNotify(): boolean;
85
- setStrategy(type: DefaultStarategy): void;
86
- updateInputValueRule(newVal: any): void;
87
- setDefaultRule(value: any): void;
88
- setRules(value: any, DepsArray?: Array<[P, any]>): () => void;
89
- updateDeps(DepsArray: Array<[P, any]>): void;
90
- setRule(value: any, DepsArray?: Array<[P, any]>): (() => void) | undefined;
91
- setSideEffect(data: {
92
- fn: (args: any[]) => any;
93
- args: any[];
94
- }): void;
95
- getSideEffect(): {
96
- fn: (args: any) => any;
97
- args: any[];
98
- }[];
99
- evaluate(api: any): any;
100
- private finalizeSync;
101
- private inferType;
102
- }
103
-
104
- type FinalFlatten<T> = T extends infer O ? {
105
- [K in keyof O]: O[K];
106
- } : never;
107
- type KeysOfUnion<T> = T extends any ? keyof T : never;
108
-
109
- type BaseField = {
110
- label: string;
111
- name: string;
112
- placeholder?: string;
113
- disabled: boolean;
114
- readonly: boolean;
115
- hidden?: boolean;
116
- validators?: any;
117
- theme?: string;
118
- };
119
- type InputField = BaseField & {
120
- type: "input" | "number";
121
- required: boolean;
122
- min?: number;
123
- maxLength: number;
124
- value: string | number;
125
- };
126
- type CheckboxField = BaseField & {
127
- type: "checkbox";
128
- description?: string;
129
- required: boolean;
130
- value: boolean;
79
+ type MeshEmit = <K extends MeshEventName>(event: K, data: MeshEvents[K]) => void;
80
+ type HistoryActionItem = {
81
+ undoAction: () => void;
82
+ redoAction: () => void;
131
83
  };
132
- type SelectField = BaseField & {
133
- type: "select";
134
- required: boolean;
135
- options: {
136
- label: string;
137
- value: any;
138
- }[];
139
- value: any;
140
- };
141
- type GroupField = Omit<BaseField, "label" | "name" | "placeholder" | "validators"> & {
142
- type: "group";
143
- name?: string;
144
- children: FormFieldSchema[];
84
+ type MeshFlowHistory = {
85
+ Undo: () => void;
86
+ Redo: () => void;
87
+ initCanUndo: any;
88
+ initCanRedo: any;
89
+ PushIntoHistory: (action: HistoryActionItem, cleanRedo?: boolean) => void;
90
+ CreateHistoryAction: (metadata: [
91
+ {
92
+ path: string;
93
+ value: any;
94
+ },
95
+ {
96
+ path: string;
97
+ value: any;
98
+ }
99
+ ], cb: any) => {
100
+ undoAction: () => any;
101
+ redoAction: () => any;
102
+ };
145
103
  };
146
- type FormFieldSchema = InputField | CheckboxField | SelectField | GroupField;
147
- type RenderSchemaExtraCommonType<P = any> = {
104
+ interface MeshFlowEngineMap {
105
+ }
106
+ type MeshPath = string | number | symbol;
107
+ interface MeshBucket<P> {
108
+ evaluate: (context: any) => Promise<any> | any;
109
+ [key: string]: any;
110
+ }
111
+ interface MeshFlowTaskNode<P extends MeshPath = MeshPath, V = any, S = any> {
148
112
  path: P;
113
+ uid: number;
114
+ type: string;
115
+ state: {
116
+ value: V;
117
+ };
118
+ nodeBucket: Record<keyof S, MeshBucket<P>>;
119
+ notifyKeys: Set<keyof S>;
149
120
  dirtySignal: any;
121
+ meta: S;
122
+ dependOn: (cb: (val: V) => V) => void;
123
+ createView: (extraProps?: Record<string, any>) => any;
124
+ }
125
+ interface MeshFlowGroupNode<P extends MeshPath = MeshPath> {
126
+ path: P;
150
127
  uid: number;
151
- nodeBucket: Record<string, SchemaBucket<P>>;
152
- dependOn: (cb: (...args: any) => void) => void;
153
- };
154
- type RenderSchemaFn<T> = FinalFlatten<T extends GroupField ? Omit<T, "children"> & RenderSchemaExtraCommonType & {
155
- children: Array<RenderSchemaFn<FormFieldSchema>>;
156
- } : T & RenderSchemaExtraCommonType>;
157
- type RenderSchema = RenderSchemaFn<FormFieldSchema>;
158
-
128
+ type: 'group';
129
+ children: Array<P>;
130
+ dirtySignal: any;
131
+ meta: Record<string, any>;
132
+ }
133
+ interface DependOnContext<P extends MeshPath> {
134
+ path: P;
135
+ getNode: (path: P) => MeshFlowTaskNode<P>;
136
+ }
159
137
  interface logicApi {
160
138
  slot: {
161
139
  triggerTargets: any;
162
140
  affectedTatget: any;
163
141
  };
164
142
  }
143
+ interface SetRuleOptions<NM> {
144
+ value?: any;
145
+ priority?: number;
146
+ forceNotify?: boolean;
147
+ logic: (api: logicApi) => any;
148
+ effect?: (args: any) => any;
149
+ effectArgs?: Array<KeysOfUnion<NM>>;
150
+ }
165
151
 
166
- type GetType<T, P> = P extends keyof T ? T[P] : never;
167
- type Engine<T> = {
168
- data: {
169
- [K in "schema" | "GetFormData" | "AddNewSchema" | 'SetValue' | 'GetValue' | 'GetGroupByPath']: GetType<T, K>;
170
- };
152
+ /**
153
+ * 🌟 入口函数
154
+ * @template T - UI 信号类型 (Signal)
155
+ * @template P - 路径联合类型 ("user.name" | "user.age") 也支持number或者symbol
156
+ * @template S - 业务元数据类型 (默认使用表单的 Meta,但也允许传入 any)
157
+ */
158
+ declare function useEngineInstance<T, P extends MeshPath, S = any, NM = any>(data: S, options: {
171
159
  config: {
172
- [K in "SetRule" | "SetRules" | "SetStrategy" | "SetValidators" | "notifyAll" | "SetTrace" | "usePlugin"]: GetType<T, K>;
173
- };
174
- dependency: {
175
- [K in 'GetAllDependency' | 'GetDependencyOrder']: GetType<T, K>;
176
- };
177
- history: {
178
- [K in "Undo" | "Redo" | "initCanUndo" | "initCanRedo"]: GetType<T, K>;
179
- };
180
- hooks: {
181
- [K in "onError" | "onSuccess" | "onStart"]: GetType<T, K>;
182
- };
183
- };
184
- /** @deprecated 请使用新的 useMeshFlow 别名 */
185
- declare const useEngineManager: <T, P extends string>(id: string | symbol, Schema: any, options: {
186
- config?: {
187
160
  useGreedy: boolean;
188
161
  };
189
162
  UITrigger: {
190
- signalCreateor: () => T;
163
+ signalCreator: () => T;
191
164
  signalTrigger: (signal: T) => void;
192
165
  };
193
- }) => Engine<{
194
- schema: RenderSchema;
195
- SetRule: (outDegreePath: P, inDegreePath: P, key: KeysOfUnion<InputField | CheckboxField | SelectField>, options?: {
196
- value?: any;
197
- priority?: number;
198
- forceNotify?: boolean;
199
- logic: (api: logicApi) => any;
200
- effect?: ((args: any) => any) | undefined;
201
- effectArgs?: Array<KeysOfUnion<Exclude<FormFieldSchema, GroupField>>>;
202
- } | undefined) => void;
203
- SetRules: (outDegreePaths: P[], inDegreePath: P, key: KeysOfUnion<InputField | CheckboxField | SelectField>, options?: {
204
- value?: any;
205
- priority?: number;
206
- forceNotify?: boolean;
207
- logic: (api: logicApi) => any;
208
- effect?: ((args: any) => any) | undefined;
209
- effectArgs?: Array<KeysOfUnion<Exclude<FormFieldSchema, GroupField>>>;
210
- } | undefined) => void;
211
- SetStrategy: (path: unknown, key: KeysOfUnion<Exclude<FormFieldSchema, GroupField>>, strategy: DefaultStarategy) => void;
212
- SetValidators: (path: P, options: {
213
- logic: (val: any, GetByPath: any) => any;
214
- condition: (data: any) => boolean;
215
- }) => void;
216
- SetTrace: (myPath: P, onUpdate: (newStatus: "idle" | "pending" | "calculating" | "calculated" | "error" | "canceled") => void) => () => void;
166
+ modules: {
167
+ useHistory?: () => MeshFlowHistory;
168
+ useInternalForm?: <T, P>(scheduler: any, data: any) => any;
169
+ useSchemaValidators?: <P>(Finder: (path: P) => any) => {
170
+ SetValidators: (path: P, options: {
171
+ logic: (val: any, GetByPath: any) => any;
172
+ condition: (data: any) => boolean;
173
+ }) => void;
174
+ };
175
+ };
176
+ plugins: {};
177
+ }): {
178
+ SetRule: <K extends KeysOfUnion<NM>>(outDegreePath: P, inDegreePath: P, key: K, options: SetRuleOptions<NM>) => void;
179
+ SetRules: <K extends KeysOfUnion<NM>>(outDegreePaths: P[], inDegreePath: P, key: K, options: SetRuleOptions<NM>) => void;
180
+ SetStrategy: (path: P, key: KeysOfUnion<NM>, strategy: DefaultStarategy) => void;
181
+ SetTrace: (myPath: P, onUpdate: (newStatus: "idle" | "pending" | "calculating" | "calculated" | "error" | "canceled") => void) => {
182
+ cancel: () => void;
183
+ };
217
184
  usePlugin: (plugin: {
218
185
  apply: (api: {
219
186
  on: (event: MeshEventName, cb: Function) => () => boolean;
@@ -221,46 +188,108 @@ declare const useEngineManager: <T, P extends string>(id: string | symbol, Schem
221
188
  }) => () => void;
222
189
  SetValue: (path: P, value: any) => void;
223
190
  GetValue: (path: P, key?: string) => any;
224
- GetFormData: () => any;
225
- GetGroupByPath: (path: string) => RenderSchema | undefined;
191
+ GetGroupByPath: (path: MeshPath) => MeshFlowGroupNode<MeshPath> | undefined;
226
192
  notifyAll: () => Promise<void>;
227
- AddNewSchema: (path: string, data: any) => RenderSchema;
228
193
  GetAllDependency: () => Map<P, Set<P>>;
229
194
  GetDependencyOrder: () => P[][];
230
- Undo: () => void;
231
- Redo: () => void;
232
- initCanUndo: (cb: (newVal: number) => any) => void;
233
- initCanRedo: (cb: (newVal: number) => any) => void;
195
+ historyExports: Partial<MeshFlowHistory>;
196
+ formExports: {};
197
+ validatorExports: {
198
+ SetValidators?: (path: P, options: {
199
+ logic: (val: any, GetByPath: any) => any;
200
+ condition: (data: any) => boolean;
201
+ }) => void;
202
+ };
234
203
  onError: (cb: (error: MeshErrorContext) => void) => () => void;
235
204
  onSuccess: (cb: (data: unknown) => void) => () => void;
236
205
  onStart: (cb: (data: {
237
206
  path: P;
238
207
  }) => void) => () => void;
239
- }>;
240
- declare const useEngine: <T = any, P extends string = string>(id: string | symbol) => Engine<{
241
- schema: RenderSchema;
242
- SetRule: (outDegreePath: P, inDegreePath: P, key: KeysOfUnion<InputField | CheckboxField | SelectField>, options?: {
243
- value?: any;
244
- priority?: number;
245
- forceNotify?: boolean;
246
- logic: (api: logicApi) => any;
247
- effect?: ((args: any) => any) | undefined;
248
- effectArgs?: Array<KeysOfUnion<Exclude<FormFieldSchema, GroupField>>>;
249
- } | undefined) => void;
250
- SetRules: (outDegreePaths: P[], inDegreePath: P, key: KeysOfUnion<InputField | CheckboxField | SelectField>, options?: {
251
- value?: any;
252
- priority?: number;
253
- forceNotify?: boolean;
254
- logic: (api: logicApi) => any;
255
- effect?: ((args: any) => any) | undefined;
256
- effectArgs?: Array<KeysOfUnion<Exclude<FormFieldSchema, GroupField>>>;
257
- } | undefined) => void;
258
- SetStrategy: (path: unknown, key: KeysOfUnion<Exclude<FormFieldSchema, GroupField>>, strategy: DefaultStarategy) => void;
208
+ };
209
+
210
+ type SchedulerType<T, P extends MeshPath, S, NM> = ReturnType<typeof useEngineInstance<T, P, S, NM>>;
211
+ type BaseEngine<T> = {
212
+ data: {
213
+ SetValue: T extends {
214
+ SetValue: infer F;
215
+ } ? F : never;
216
+ GetValue: T extends {
217
+ GetValue: infer F;
218
+ } ? F : never;
219
+ GetGroupByPath: T extends {
220
+ GetGroupByPath: infer F;
221
+ } ? F : never;
222
+ };
223
+ config: {
224
+ SetRule: T extends {
225
+ SetRule: infer F;
226
+ } ? F : never;
227
+ SetRules: T extends {
228
+ SetRules: infer F;
229
+ } ? F : never;
230
+ SetStrategy: T extends {
231
+ SetStrategy: infer F;
232
+ } ? F : never;
233
+ notifyAll: T extends {
234
+ notifyAll: infer F;
235
+ } ? F : never;
236
+ SetTrace: T extends {
237
+ SetTrace: infer F;
238
+ } ? F : never;
239
+ usePlugin: T extends {
240
+ usePlugin: infer F;
241
+ } ? F : never;
242
+ };
243
+ dependency: {
244
+ GetAllDependency: T extends {
245
+ GetAllDependency: infer F;
246
+ } ? F : never;
247
+ GetDependencyOrder: T extends {
248
+ GetDependencyOrder: infer F;
249
+ } ? F : never;
250
+ };
251
+ hooks: {
252
+ onError: T extends {
253
+ onError: infer F;
254
+ } ? F : never;
255
+ onSuccess: T extends {
256
+ onSuccess: infer F;
257
+ } ? F : never;
258
+ onStart: T extends {
259
+ onStart: infer F;
260
+ } ? F : never;
261
+ };
262
+ };
263
+ type TransformModuleKey<T> = T extends `use${infer Rest}` ? Uncapitalize<Rest> : T;
264
+ type MapModuleToReturn<K, F, P extends MeshPath> = K extends 'useSchemaValidators' | 'schemaValidators' ? {
259
265
  SetValidators: (path: P, options: {
260
- logic: (val: any, GetByPath: any) => any;
266
+ logic: (val: any, GetByPath: (path: P) => any) => any;
261
267
  condition: (data: any) => boolean;
262
268
  }) => void;
263
- SetTrace: (myPath: P, onUpdate: (newStatus: "idle" | "pending" | "calculating" | "calculated" | "error" | "canceled") => void) => () => void;
269
+ } : F extends (...args: any) => infer R ? R : any;
270
+ type EngineModules<M, P extends MeshPath> = {
271
+ [K in keyof M as TransformModuleKey<string & K>]: MapModuleToReturn<K, M[K], P>;
272
+ };
273
+ type Engine<T, M, P extends MeshPath> = BaseEngine<T> & EngineModules<M, P>;
274
+ /** @deprecated 请使用新的 useMeshFlow 别名 */
275
+ declare const useEngineManager: <const S extends Record<string, any>, T, //UITrigger的类型
276
+ M extends Record<string, any>, NM extends Record<string, any> = Record<string, any>, P extends MeshPath = [InferLeafPath<S>] extends [never] ? MeshPath : InferLeafPath<S> | (string & {})>(id: MeshPath, Schema: S, options: {
277
+ metaType?: NM;
278
+ config?: {
279
+ useGreedy: boolean;
280
+ };
281
+ modules?: M;
282
+ UITrigger: {
283
+ signalCreator: () => T;
284
+ signalTrigger: (signal: T) => void;
285
+ };
286
+ }) => Engine<{
287
+ SetRule: <K extends KeysOfUnion<NM>>(outDegreePath: P, inDegreePath: P, key: K, options: SetRuleOptions<NM>) => void;
288
+ SetRules: <K extends KeysOfUnion<NM>>(outDegreePaths: P[], inDegreePath: P, key: K, options: SetRuleOptions<NM>) => void;
289
+ SetStrategy: (path: P, key: KeysOfUnion<NM>, strategy: DefaultStarategy) => void;
290
+ SetTrace: (myPath: P, onUpdate: (newStatus: "idle" | "pending" | "calculating" | "calculated" | "error" | "canceled") => void) => {
291
+ cancel: () => void;
292
+ };
264
293
  usePlugin: (plugin: {
265
294
  apply: (api: {
266
295
  on: (event: MeshEventName, cb: Function) => () => boolean;
@@ -268,55 +297,57 @@ declare const useEngine: <T = any, P extends string = string>(id: string | symbo
268
297
  }) => () => void;
269
298
  SetValue: (path: P, value: any) => void;
270
299
  GetValue: (path: P, key?: string) => any;
271
- GetFormData: () => any;
272
- GetGroupByPath: (path: string) => RenderSchema | undefined;
300
+ GetGroupByPath: (path: MeshPath) => MeshFlowGroupNode<MeshPath> | undefined;
273
301
  notifyAll: () => Promise<void>;
274
- AddNewSchema: (path: string, data: any) => RenderSchema;
275
302
  GetAllDependency: () => Map<P, Set<P>>;
276
303
  GetDependencyOrder: () => P[][];
277
- Undo: () => void;
278
- Redo: () => void;
279
- initCanUndo: (cb: (newVal: number) => any) => void;
280
- initCanRedo: (cb: (newVal: number) => any) => void;
304
+ historyExports: Partial<MeshFlowHistory>;
305
+ formExports: {};
306
+ validatorExports: {
307
+ SetValidators?: ((path: P, options: {
308
+ logic: (val: any, GetByPath: any) => any;
309
+ condition: (data: any) => boolean;
310
+ }) => void) | undefined;
311
+ };
281
312
  onError: (cb: (error: MeshErrorContext) => void) => () => void;
282
313
  onSuccess: (cb: (data: unknown) => void) => () => void;
283
314
  onStart: (cb: (data: {
284
315
  path: P;
285
316
  }) => void) => () => void;
286
- }>;
287
- declare const deleteEngine: (id: string | symbol) => void;
288
- declare const useMeshFlow: <T, P extends string>(id: string | symbol, Schema: any, options: {
317
+ }, M, P>;
318
+ declare const useMeshFlowDefiner: <P extends MeshPath, NM extends Record<string, any> = any>() => <T, M extends Record<string, any>>(id: MeshPath, schema: any, options: {
319
+ metaType?: NM;
320
+ UITrigger: {
321
+ signalCreator: () => T;
322
+ signalTrigger: (s: T) => void;
323
+ };
324
+ modules?: M;
325
+ config?: any;
326
+ }) => Engine<SchedulerType<T, P, any, NM>, M, P>;
327
+ /**
328
+ * 获取 Engine 实例
329
+ * @template M 手动注入的模块映射 (例如 { useHistory: typeof useHistory })
330
+ * @template P ID 类型 (支持 string | number | symbol)
331
+ */
332
+ declare const useEngine: <M, P extends MeshPath = any, NM = any, S = any, ID extends keyof MeshFlowEngineMap | (MeshPath & {}) = MeshPath>(id: ID) => [M] extends [never] ? (ID extends keyof MeshFlowEngineMap ? MeshFlowEngineMap[ID] : Engine<SchedulerType<any, any, any, any>, {}, P>) : Engine<SchedulerType<any, P, S, NM>, M, P>;
333
+ declare const deleteEngine: (id: MeshPath) => void;
334
+ declare const useMeshFlow: <const S extends Record<string, any>, T, M extends Record<string, any>, NM extends Record<string, any> = Record<string, any>, P extends MeshPath = [InferLeafPath<S>] extends [never] ? MeshPath : InferLeafPath<S> | (string & {})>(id: MeshPath, Schema: S, options: {
335
+ metaType?: NM;
289
336
  config?: {
290
337
  useGreedy: boolean;
291
338
  };
339
+ modules?: M;
292
340
  UITrigger: {
293
- signalCreateor: () => T;
341
+ signalCreator: () => T;
294
342
  signalTrigger: (signal: T) => void;
295
343
  };
296
344
  }) => Engine<{
297
- schema: RenderSchema;
298
- SetRule: (outDegreePath: P, inDegreePath: P, key: KeysOfUnion<InputField | CheckboxField | SelectField>, options?: {
299
- value?: any;
300
- priority?: number;
301
- forceNotify?: boolean;
302
- logic: (api: logicApi) => any;
303
- effect?: ((args: any) => any) | undefined;
304
- effectArgs?: Array<KeysOfUnion<Exclude<FormFieldSchema, GroupField>>>;
305
- } | undefined) => void;
306
- SetRules: (outDegreePaths: P[], inDegreePath: P, key: KeysOfUnion<InputField | CheckboxField | SelectField>, options?: {
307
- value?: any;
308
- priority?: number;
309
- forceNotify?: boolean;
310
- logic: (api: logicApi) => any;
311
- effect?: ((args: any) => any) | undefined;
312
- effectArgs?: Array<KeysOfUnion<Exclude<FormFieldSchema, GroupField>>>;
313
- } | undefined) => void;
314
- SetStrategy: (path: unknown, key: KeysOfUnion<Exclude<FormFieldSchema, GroupField>>, strategy: DefaultStarategy) => void;
315
- SetValidators: (path: P, options: {
316
- logic: (val: any, GetByPath: any) => any;
317
- condition: (data: any) => boolean;
318
- }) => void;
319
- SetTrace: (myPath: P, onUpdate: (newStatus: "idle" | "pending" | "calculating" | "calculated" | "error" | "canceled") => void) => () => void;
345
+ SetRule: <K extends KeysOfUnion<NM>>(outDegreePath: P, inDegreePath: P, key: K, options: SetRuleOptions<NM>) => void;
346
+ SetRules: <K extends KeysOfUnion<NM>>(outDegreePaths: P[], inDegreePath: P, key: K, options: SetRuleOptions<NM>) => void;
347
+ SetStrategy: (path: P, key: KeysOfUnion<NM>, strategy: DefaultStarategy) => void;
348
+ SetTrace: (myPath: P, onUpdate: (newStatus: "idle" | "pending" | "calculating" | "calculated" | "error" | "canceled") => void) => {
349
+ cancel: () => void;
350
+ };
320
351
  usePlugin: (plugin: {
321
352
  apply: (api: {
322
353
  on: (event: MeshEventName, cb: Function) => () => boolean;
@@ -324,21 +355,23 @@ declare const useMeshFlow: <T, P extends string>(id: string | symbol, Schema: an
324
355
  }) => () => void;
325
356
  SetValue: (path: P, value: any) => void;
326
357
  GetValue: (path: P, key?: string) => any;
327
- GetFormData: () => any;
328
- GetGroupByPath: (path: string) => RenderSchema | undefined;
358
+ GetGroupByPath: (path: MeshPath) => MeshFlowGroupNode<MeshPath> | undefined;
329
359
  notifyAll: () => Promise<void>;
330
- AddNewSchema: (path: string, data: any) => RenderSchema;
331
360
  GetAllDependency: () => Map<P, Set<P>>;
332
361
  GetDependencyOrder: () => P[][];
333
- Undo: () => void;
334
- Redo: () => void;
335
- initCanUndo: (cb: (newVal: number) => any) => void;
336
- initCanRedo: (cb: (newVal: number) => any) => void;
362
+ historyExports: Partial<MeshFlowHistory>;
363
+ formExports: {};
364
+ validatorExports: {
365
+ SetValidators?: ((path: P, options: {
366
+ logic: (val: any, GetByPath: any) => any;
367
+ condition: (data: any) => boolean;
368
+ }) => void) | undefined;
369
+ };
337
370
  onError: (cb: (error: MeshErrorContext) => void) => () => void;
338
371
  onSuccess: (cb: (data: unknown) => void) => () => void;
339
372
  onStart: (cb: (data: {
340
373
  path: P;
341
374
  }) => void) => () => void;
342
- }>;
375
+ }, M, P>;
343
376
 
344
- export { deleteEngine, useEngine, useEngineManager, useMeshFlow };
377
+ export { type DependOnContext, type HistoryActionItem, type MeshBucket, type MeshEmit, type MeshEventName, type MeshEvents, type MeshFlowEngineMap, type MeshFlowGroupNode, type MeshFlowHistory, type MeshFlowTaskNode, type MeshPath, type SetRuleOptions, deleteEngine, type logicApi, useEngine, useEngineManager, useMeshFlow, useMeshFlowDefiner };