@gesslar/actioneer 2.2.0 → 2.4.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/package.json +16 -17
- package/src/browser/lib/ActionBuilder.js +87 -65
- package/src/browser/lib/ActionHooks.js +35 -27
- package/src/browser/lib/ActionRunner.js +85 -40
- package/src/browser/lib/ActionWrapper.js +13 -6
- package/src/browser/lib/Activity.js +17 -13
- package/src/browser/lib/Piper.js +46 -22
- package/src/types/browser/lib/ActionBuilder.d.ts +80 -58
- package/src/types/browser/lib/ActionBuilder.d.ts.map +1 -1
- package/src/types/browser/lib/ActionHooks.d.ts +28 -26
- package/src/types/browser/lib/ActionHooks.d.ts.map +1 -1
- package/src/types/browser/lib/ActionRunner.d.ts +7 -5
- package/src/types/browser/lib/ActionRunner.d.ts.map +1 -1
- package/src/types/browser/lib/ActionWrapper.d.ts +14 -5
- package/src/types/browser/lib/ActionWrapper.d.ts.map +1 -1
- package/src/types/browser/lib/Activity.d.ts +20 -14
- package/src/types/browser/lib/Activity.d.ts.map +1 -1
- package/src/types/browser/lib/Piper.d.ts +14 -9
- package/src/types/browser/lib/Piper.d.ts.map +1 -1
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
/** @typedef {import("./ActionRunner.js").default} ActionRunner */
|
|
2
|
-
/** @typedef {typeof import("./Activity.js").ACTIVITY} ActivityFlags */
|
|
3
1
|
/**
|
|
2
|
+
* Type imports and definitions.
|
|
3
|
+
*
|
|
4
|
+
* @import {default as ActionRunner} from "./ActionRunner.js"
|
|
5
|
+
*
|
|
4
6
|
* @typedef {(message: string, level?: number, ...args: Array<unknown>) => void} DebugFn
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
+
*
|
|
7
8
|
* @typedef {object} ActionBuilderAction
|
|
8
|
-
* @property {(builder: ActionBuilder) => void} setup Function invoked during {@link ActionBuilder
|
|
9
|
-
* @property {symbol} [tag] Optional tag to reuse when reconstructing builders.
|
|
10
|
-
|
|
11
|
-
/**
|
|
9
|
+
* @property {(builder: ActionBuilder) => void} setup - Function invoked during {@link ActionBuilder} to register activities.
|
|
10
|
+
* @property {symbol} [tag] - Optional tag to reuse when reconstructing builders.
|
|
11
|
+
*
|
|
12
12
|
* @typedef {object} ActionBuilderConfig
|
|
13
|
-
* @property {symbol} [tag] Optional tag for the builder instance.
|
|
14
|
-
* @property {DebugFn} [debug] Logger used by the pipeline internals.
|
|
15
|
-
|
|
16
|
-
/**
|
|
13
|
+
* @property {symbol} [tag] - Optional tag for the builder instance.
|
|
14
|
+
* @property {DebugFn} [debug] - Logger used by the pipeline internals.
|
|
15
|
+
*
|
|
17
16
|
* @typedef {object} ActivityDefinition
|
|
18
|
-
* @property {ActionBuilderAction|null} action Parent action instance when available.
|
|
19
|
-
* @property {DebugFn|null} debug Logger function.
|
|
20
|
-
* @property {string|symbol} name Activity identifier.
|
|
21
|
-
* @property {ActionFunction|import("./ActionWrapper.js").default} op Operation to execute.
|
|
22
|
-
* @property {number} [kind] Optional kind flags from {@link
|
|
23
|
-
* @property {(context: unknown) => boolean|Promise<boolean>} [pred] Loop predicate.
|
|
24
|
-
|
|
25
|
-
/**
|
|
17
|
+
* @property {ActionBuilderAction|null} action - Parent action instance when available.
|
|
18
|
+
* @property {DebugFn|null} debug - Logger function.
|
|
19
|
+
* @property {string|symbol} name - Activity identifier.
|
|
20
|
+
* @property {ActionFunction|import("./ActionWrapper.js").default} op - Operation to execute.
|
|
21
|
+
* @property {number} [kind] - Optional kind flags from {@link ACTIVITY}.
|
|
22
|
+
* @property {(context: unknown) => boolean|Promise<boolean>} [pred] - Loop predicate.
|
|
23
|
+
*
|
|
26
24
|
* @typedef {(context: unknown) => unknown|Promise<unknown>} ActionFunction
|
|
27
25
|
*/
|
|
28
26
|
/**
|
|
@@ -49,8 +47,8 @@ export default class ActionBuilder {
|
|
|
49
47
|
/**
|
|
50
48
|
* Creates a new ActionBuilder instance with the provided action callback.
|
|
51
49
|
*
|
|
52
|
-
* @param {ActionBuilderAction} [action] Base action invoked by the runner when a block satisfies the configured structure.
|
|
53
|
-
* @param {ActionBuilderConfig} [config] Options
|
|
50
|
+
* @param {ActionBuilderAction} [action] - Base action invoked by the runner when a block satisfies the configured structure.
|
|
51
|
+
* @param {ActionBuilderConfig} [config] - Options
|
|
54
52
|
*/
|
|
55
53
|
constructor(action?: ActionBuilderAction, { tag, debug }?: ActionBuilderConfig);
|
|
56
54
|
get tag(): symbol | null;
|
|
@@ -64,67 +62,67 @@ export default class ActionBuilder {
|
|
|
64
62
|
* - do(name, kind, splitter, rejoiner, opOrWrapper) - SPLIT with parallel execution
|
|
65
63
|
*
|
|
66
64
|
* @overload
|
|
67
|
-
* @param {string|symbol} name Activity name
|
|
68
|
-
* @param {ActionFunction} op Operation to execute once.
|
|
65
|
+
* @param {string|symbol} name - Activity name
|
|
66
|
+
* @param {ActionFunction} op - Operation to execute once.
|
|
69
67
|
* @returns {ActionBuilder}
|
|
70
68
|
*/
|
|
71
69
|
do(name: string | symbol, op: ActionFunction): ActionBuilder;
|
|
72
70
|
/**
|
|
73
71
|
* @overload
|
|
74
|
-
* @param {string|symbol} name Activity name
|
|
75
|
-
* @param {number} kind ACTIVITY.BREAK or ACTIVITY.CONTINUE flag.
|
|
76
|
-
* @param {(context: unknown) => boolean|Promise<boolean>} pred Predicate to evaluate for control flow.
|
|
72
|
+
* @param {string|symbol} name - Activity name
|
|
73
|
+
* @param {number} kind - ACTIVITY.BREAK or ACTIVITY.CONTINUE flag.
|
|
74
|
+
* @param {(context: unknown) => boolean|Promise<boolean>} pred - Predicate to evaluate for control flow.
|
|
77
75
|
* @returns {ActionBuilder}
|
|
78
76
|
*/
|
|
79
77
|
do(name: string | symbol, kind: number, pred: (context: unknown) => boolean | Promise<boolean>): ActionBuilder;
|
|
80
78
|
/**
|
|
81
79
|
* @overload
|
|
82
|
-
* @param {string|symbol} name Activity name
|
|
83
|
-
* @param {number} kind Activity kind (WHILE, UNTIL, or IF) from {@link
|
|
84
|
-
* @param {(context: unknown) => boolean|Promise<boolean>} pred Predicate executed before/after the op.
|
|
85
|
-
* @param {ActionFunction|ActionBuilder} op Operation or nested builder to execute.
|
|
80
|
+
* @param {string|symbol} name - Activity name
|
|
81
|
+
* @param {number} kind - Activity kind (WHILE, UNTIL, or IF) from {@link ACTIVITY}.
|
|
82
|
+
* @param {(context: unknown) => boolean|Promise<boolean>} pred - Predicate executed before/after the op.
|
|
83
|
+
* @param {ActionFunction|ActionBuilder} op - Operation or nested builder to execute.
|
|
86
84
|
* @returns {ActionBuilder}
|
|
87
85
|
*/
|
|
88
86
|
do(name: string | symbol, kind: number, pred: (context: unknown) => boolean | Promise<boolean>, op: ActionFunction | ActionBuilder): ActionBuilder;
|
|
89
87
|
/**
|
|
90
88
|
* @overload
|
|
91
|
-
* @param {string|symbol} name Activity name
|
|
92
|
-
* @param {number} kind ACTIVITY.SPLIT flag.
|
|
93
|
-
* @param {(context: unknown) => unknown} splitter Splitter function for SPLIT mode.
|
|
94
|
-
* @param {(originalContext: unknown, splitResults: unknown) => unknown} rejoiner Rejoiner function for SPLIT mode.
|
|
95
|
-
* @param {ActionFunction|ActionBuilder} op Operation or nested builder to execute.
|
|
89
|
+
* @param {string|symbol} name - Activity name
|
|
90
|
+
* @param {number} kind - ACTIVITY.SPLIT flag.
|
|
91
|
+
* @param {(context: unknown) => unknown} splitter - Splitter function for SPLIT mode.
|
|
92
|
+
* @param {(originalContext: unknown, splitResults: unknown) => unknown} rejoiner - Rejoiner function for SPLIT mode.
|
|
93
|
+
* @param {ActionFunction|ActionBuilder} op - Operation or nested builder to execute.
|
|
96
94
|
* @returns {ActionBuilder}
|
|
97
95
|
*/
|
|
98
96
|
do(name: string | symbol, kind: number, splitter: (context: unknown) => unknown, rejoiner: (originalContext: unknown, splitResults: unknown) => unknown, op: ActionFunction | ActionBuilder): ActionBuilder;
|
|
99
97
|
/**
|
|
100
98
|
* Configure hooks to be loaded from a file when the action is built.
|
|
101
99
|
*
|
|
102
|
-
* @param {string} hooksFile Path to the hooks module file.
|
|
103
|
-
* @param {string} hooksKind Name of the exported hooks class to instantiate.
|
|
104
|
-
* @returns {ActionBuilder} The builder instance for chaining.
|
|
100
|
+
* @param {string} hooksFile - Path to the hooks module file.
|
|
101
|
+
* @param {string} hooksKind - Name of the exported hooks class to instantiate.
|
|
102
|
+
* @returns {ActionBuilder} - The builder instance for chaining.
|
|
105
103
|
* @throws {Sass} If hooks have already been configured.
|
|
106
104
|
*/
|
|
107
105
|
withHooksFile(hooksFile: string, hooksKind: string): ActionBuilder;
|
|
108
106
|
/**
|
|
109
107
|
* Configure hooks using a pre-instantiated hooks object.
|
|
110
108
|
*
|
|
111
|
-
* @param {
|
|
112
|
-
* @returns {ActionBuilder} The builder instance for chaining.
|
|
109
|
+
* @param {ActionHooks} hooks - An already-instantiated hooks instance.
|
|
110
|
+
* @returns {ActionBuilder} - The builder instance for chaining.
|
|
113
111
|
* @throws {Sass} If hooks have already been configured with a different instance.
|
|
114
112
|
*/
|
|
115
|
-
withHooks(hooks:
|
|
113
|
+
withHooks(hooks: ActionHooks): ActionBuilder;
|
|
116
114
|
/**
|
|
117
115
|
* Configure the action instance if not already set.
|
|
118
116
|
* Used to propagate parent action context to nested builders.
|
|
119
117
|
*
|
|
120
|
-
* @param {ActionBuilderAction} action The action instance to inherit.
|
|
118
|
+
* @param {ActionBuilderAction} action - The action instance to inherit.
|
|
121
119
|
* @returns {ActionBuilder} The builder instance for chaining.
|
|
122
120
|
*/
|
|
123
121
|
withAction(action: ActionBuilderAction): ActionBuilder;
|
|
124
122
|
/**
|
|
125
123
|
* Register a callback to be executed after all activities complete.
|
|
126
124
|
*
|
|
127
|
-
* @param {ActionFunction} callback Function to execute at the end of the pipeline.
|
|
125
|
+
* @param {ActionFunction} callback - Function to execute at the end of the pipeline.
|
|
128
126
|
* @returns {ActionBuilder} The builder instance for chaining.
|
|
129
127
|
*/
|
|
130
128
|
done(callback: ActionFunction): ActionBuilder;
|
|
@@ -132,59 +130,83 @@ export default class ActionBuilder {
|
|
|
132
130
|
* Finalises the builder and returns a payload that can be consumed by the
|
|
133
131
|
* runner.
|
|
134
132
|
*
|
|
135
|
-
* @
|
|
133
|
+
* @param {ActionRunner} runner - The runner invoking the build.
|
|
134
|
+
* @returns {Promise<ActionWrapper>} Payload consumed by the {@link ActionRunner} constructor.
|
|
135
|
+
*/
|
|
136
|
+
build(runner: ActionRunner): Promise<ActionWrapper>;
|
|
137
|
+
/**
|
|
138
|
+
* Returns the raw hooks value configured on this builder.
|
|
139
|
+
* Used by {@link ActionRunner} to access setup/cleanup lifecycle hooks.
|
|
140
|
+
*
|
|
141
|
+
* @returns {object|Function|null} Raw hooks value, or null if not configured.
|
|
136
142
|
*/
|
|
137
|
-
|
|
143
|
+
get hooks(): object | Function | null;
|
|
138
144
|
#private;
|
|
139
145
|
}
|
|
140
|
-
|
|
141
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Type imports and definitions.
|
|
148
|
+
*/
|
|
142
149
|
export type DebugFn = (message: string, level?: number, ...args: Array<unknown>) => void;
|
|
150
|
+
/**
|
|
151
|
+
* Type imports and definitions.
|
|
152
|
+
*/
|
|
143
153
|
export type ActionBuilderAction = {
|
|
144
154
|
/**
|
|
145
|
-
* Function invoked during {@link ActionBuilder
|
|
155
|
+
* - Function invoked during {@link ActionBuilder} to register activities.
|
|
146
156
|
*/
|
|
147
157
|
setup: (builder: ActionBuilder) => void;
|
|
148
158
|
/**
|
|
149
|
-
* Optional tag to reuse when reconstructing builders.
|
|
159
|
+
* - Optional tag to reuse when reconstructing builders.
|
|
150
160
|
*/
|
|
151
161
|
tag?: symbol | undefined;
|
|
152
162
|
};
|
|
163
|
+
/**
|
|
164
|
+
* Type imports and definitions.
|
|
165
|
+
*/
|
|
153
166
|
export type ActionBuilderConfig = {
|
|
154
167
|
/**
|
|
155
|
-
* Optional tag for the builder instance.
|
|
168
|
+
* - Optional tag for the builder instance.
|
|
156
169
|
*/
|
|
157
170
|
tag?: symbol | undefined;
|
|
158
171
|
/**
|
|
159
|
-
* Logger used by the pipeline internals.
|
|
172
|
+
* - Logger used by the pipeline internals.
|
|
160
173
|
*/
|
|
161
174
|
debug?: DebugFn | undefined;
|
|
162
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* Type imports and definitions.
|
|
178
|
+
*/
|
|
163
179
|
export type ActivityDefinition = {
|
|
164
180
|
/**
|
|
165
|
-
* Parent action instance when available.
|
|
181
|
+
* - Parent action instance when available.
|
|
166
182
|
*/
|
|
167
183
|
action: ActionBuilderAction | null;
|
|
168
184
|
/**
|
|
169
|
-
* Logger function.
|
|
185
|
+
* - Logger function.
|
|
170
186
|
*/
|
|
171
187
|
debug: DebugFn | null;
|
|
172
188
|
/**
|
|
173
|
-
* Activity identifier.
|
|
189
|
+
* - Activity identifier.
|
|
174
190
|
*/
|
|
175
191
|
name: string | symbol;
|
|
176
192
|
/**
|
|
177
|
-
* Operation to execute.
|
|
193
|
+
* - Operation to execute.
|
|
178
194
|
*/
|
|
179
195
|
op: ActionFunction | import("./ActionWrapper.js").default;
|
|
180
196
|
/**
|
|
181
|
-
* Optional kind flags from {@link
|
|
197
|
+
* - Optional kind flags from {@link ACTIVITY}.
|
|
182
198
|
*/
|
|
183
199
|
kind?: number | undefined;
|
|
184
200
|
/**
|
|
185
|
-
* Loop predicate.
|
|
201
|
+
* - Loop predicate.
|
|
186
202
|
*/
|
|
187
203
|
pred?: ((context: unknown) => boolean | Promise<boolean>) | undefined;
|
|
188
204
|
};
|
|
205
|
+
/**
|
|
206
|
+
* Type imports and definitions.
|
|
207
|
+
*/
|
|
189
208
|
export type ActionFunction = (context: unknown) => unknown | Promise<unknown>;
|
|
209
|
+
import ActionHooks from "./ActionHooks.js";
|
|
210
|
+
import type { default as ActionRunner } from "./ActionRunner.js";
|
|
211
|
+
import ActionWrapper from "./ActionWrapper.js";
|
|
190
212
|
//# sourceMappingURL=ActionBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBuilder.d.ts","sourceRoot":"","sources":["../../../browser/lib/ActionBuilder.js"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"ActionBuilder.d.ts","sourceRoot":"","sources":["../../../browser/lib/ActionBuilder.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAkBE;;;;;OAKG;IACH,qBAHW,mBAAmB,mBACnB,mBAAmB,EAkB7B;IAED,yBAEC;;;;;;;;;;;;;;;IAWE,SACQ,MAAM,GAAC,MAAM,MACb,cAAc,GACZ,aAAa,CACzB;;;;;;;;IAGE,SACQ,MAAM,GAAC,MAAM,QACb,MAAM,QACN,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,GAC5C,aAAa,CACzB;;;;;;;;;IAGE,SACQ,MAAM,GAAC,MAAM,QACb,MAAM,QACN,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,MAC9C,cAAc,GAAC,aAAa,GAC1B,aAAa,CACzB;;;;;;;;;;IAGE,SACQ,MAAM,GAAC,MAAM,QACb,MAAM,YACN,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,YAC7B,CAAC,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,KAAK,OAAO,MAC5D,cAAc,GAAC,aAAa,GAC1B,aAAa,CACzB;IAkED;;;;;;;OAOG;IACH,yBALW,MAAM,aACN,MAAM,GACJ,aAAa,CAYzB;IAED;;;;;;OAMG;IACH,iBAJW,WAAW,GACT,aAAa,CAgBzB;IAED;;;;;;OAMG;IACH,mBAHW,mBAAmB,GACjB,aAAa,CAczB;IAED;;;;;OAKG;IACH,eAHW,cAAc,GACZ,aAAa,CAOzB;IAeD;;;;;;OAMG;IACH,cAHW,YAAY,GACV,OAAO,CAAC,aAAa,CAAC,CAoClC;IAsBD;;;;;OAKG;IACH,aAFa,MAAM,cAAU,IAAI,CAIhC;;CACF;;;;sBAjWY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI;;;;;;;;WAGjE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;YAQhC,mBAAmB,GAAC,IAAI;;;;WACxB,OAAO,GAAC,IAAI;;;;UACZ,MAAM,GAAC,MAAM;;;;QACb,cAAc,GAAC,OAAO,oBAAoB,EAAE,OAAO;;;;;;;;sBAEzC,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC;;;;;6BAE/C,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC;wBA1BnC,kBAAkB;6CAMA,mBAAmB;0BAPnC,oBAAoB"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {(message: string, level?: number, ...args: Array<unknown>) => void} DebugFn
|
|
3
3
|
*/
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {object} ActionHooksConfig
|
|
6
|
-
* @property {string} actionKind Action identifier shared between runner and hooks.
|
|
7
|
-
* @property {unknown} hooks Already-instantiated hooks implementation.
|
|
8
|
-
* @property {number} [hookTimeout] Timeout applied to hook execution in milliseconds.
|
|
9
|
-
* @property {DebugFn} debug Logger to emit diagnostics.
|
|
10
|
-
*/
|
|
11
4
|
/**
|
|
12
5
|
* @typedef {Record<string, (context: unknown) => Promise<unknown>|unknown>} HookModule
|
|
6
|
+
*
|
|
7
|
+
* @typedef {object} ActionHooksConfig
|
|
8
|
+
* @property {string} actionKind - Action identifier shared between runner and hooks.
|
|
9
|
+
* @property {object|Function|null} hooks - Pre-instantiated hooks object, a constructor to instantiate, or null.
|
|
10
|
+
* @property {number} [hookTimeout] - Timeout applied to hook execution in milliseconds.
|
|
11
|
+
* @property {DebugFn} debug - Logger to emit diagnostics.
|
|
13
12
|
*/
|
|
14
13
|
/**
|
|
15
14
|
* Generic base class for managing hooks with configurable event types.
|
|
@@ -23,15 +22,15 @@ export default class ActionHooks {
|
|
|
23
22
|
* Static factory method to create and initialize a hook manager.
|
|
24
23
|
* Browser version: Only works with pre-instantiated hooks passed via config.hooks.
|
|
25
24
|
*
|
|
26
|
-
* @param {ActionHooksConfig} config Configuration object with hooks property
|
|
27
|
-
* @param {DebugFn} debug The debug function.
|
|
28
|
-
* @returns {Promise<ActionHooks
|
|
25
|
+
* @param {ActionHooksConfig} config - Configuration object with hooks property
|
|
26
|
+
* @param {DebugFn} debug - The debug function.
|
|
27
|
+
* @returns {Promise<ActionHooks?>} Initialized hook manager or null if no hooks provided
|
|
29
28
|
*/
|
|
30
29
|
static "new"(config: ActionHooksConfig, debug: DebugFn): Promise<ActionHooks | null>;
|
|
31
30
|
/**
|
|
32
31
|
* Creates a new ActionHook instance.
|
|
33
32
|
*
|
|
34
|
-
* @param {ActionHooksConfig} config Configuration values describing how to load the hooks.
|
|
33
|
+
* @param {ActionHooksConfig} config - Configuration values describing how to load the hooks.
|
|
35
34
|
*/
|
|
36
35
|
constructor({ actionKind, hooks, hookTimeout, debug }: ActionHooksConfig);
|
|
37
36
|
/**
|
|
@@ -42,8 +41,10 @@ export default class ActionHooks {
|
|
|
42
41
|
get actionKind(): string;
|
|
43
42
|
/**
|
|
44
43
|
* Gets the loaded hooks object.
|
|
44
|
+
* If the stored value is a plain object it is returned as-is.
|
|
45
|
+
* If it is a constructor function a new instance is created and returned.
|
|
45
46
|
*
|
|
46
|
-
* @returns {object
|
|
47
|
+
* @returns {object?} Hooks object or null if not loaded
|
|
47
48
|
*/
|
|
48
49
|
get hooks(): object | null;
|
|
49
50
|
/**
|
|
@@ -55,44 +56,45 @@ export default class ActionHooks {
|
|
|
55
56
|
/**
|
|
56
57
|
* Gets the setup hook function if available.
|
|
57
58
|
*
|
|
58
|
-
* @returns {(args: object) => unknown
|
|
59
|
+
* @returns {(args: object) => unknown} Setup hook function or null
|
|
59
60
|
*/
|
|
60
|
-
get setup(): (args: object) => unknown
|
|
61
|
+
get setup(): (args: object) => unknown;
|
|
61
62
|
/**
|
|
62
63
|
* Gets the cleanup hook function if available.
|
|
63
64
|
*
|
|
64
|
-
* @returns {(args: object) => unknown
|
|
65
|
+
* @returns {(args: object) => unknown} Cleanup hook function or null
|
|
65
66
|
*/
|
|
66
|
-
get cleanup(): (args: object) => unknown
|
|
67
|
+
get cleanup(): (args: object) => unknown;
|
|
67
68
|
/**
|
|
68
69
|
* Invoke a dynamically-named hook such as `before$foo`.
|
|
69
70
|
*
|
|
70
|
-
* @param {
|
|
71
|
-
* @param {string|symbol} activityName Activity identifier.
|
|
72
|
-
* @param {unknown}
|
|
71
|
+
* @param {string} kind - Hook namespace.
|
|
72
|
+
* @param {string|symbol} activityName - Activity identifier.
|
|
73
|
+
* @param {unknown} oldContext - Pipeline context supplied to the hook.
|
|
74
|
+
* @param {unknown} newContext - For after$ hooks, the result of the op
|
|
73
75
|
* @returns {Promise<void>}
|
|
74
76
|
*/
|
|
75
|
-
callHook(kind:
|
|
77
|
+
callHook(kind: string, activityName: string | symbol, oldContext: unknown, newContext: unknown): Promise<void>;
|
|
76
78
|
#private;
|
|
77
79
|
}
|
|
78
80
|
export type DebugFn = (message: string, level?: number, ...args: Array<unknown>) => void;
|
|
81
|
+
export type HookModule = Record<string, (context: unknown) => Promise<unknown> | unknown>;
|
|
79
82
|
export type ActionHooksConfig = {
|
|
80
83
|
/**
|
|
81
|
-
* Action identifier shared between runner and hooks.
|
|
84
|
+
* - Action identifier shared between runner and hooks.
|
|
82
85
|
*/
|
|
83
86
|
actionKind: string;
|
|
84
87
|
/**
|
|
85
|
-
*
|
|
88
|
+
* - Pre-instantiated hooks object, a constructor to instantiate, or null.
|
|
86
89
|
*/
|
|
87
|
-
hooks:
|
|
90
|
+
hooks: object | Function | null;
|
|
88
91
|
/**
|
|
89
|
-
* Timeout applied to hook execution in milliseconds.
|
|
92
|
+
* - Timeout applied to hook execution in milliseconds.
|
|
90
93
|
*/
|
|
91
94
|
hookTimeout?: number | undefined;
|
|
92
95
|
/**
|
|
93
|
-
* Logger to emit diagnostics.
|
|
96
|
+
* - Logger to emit diagnostics.
|
|
94
97
|
*/
|
|
95
98
|
debug: DebugFn;
|
|
96
99
|
};
|
|
97
|
-
export type HookModule = Record<string, (context: unknown) => Promise<unknown> | unknown>;
|
|
98
100
|
//# sourceMappingURL=ActionHooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionHooks.d.ts","sourceRoot":"","sources":["../../../browser/lib/ActionHooks.js"],"names":[],"mappings":"AAEA;;GAEG;AAEH
|
|
1
|
+
{"version":3,"file":"ActionHooks.d.ts","sourceRoot":"","sources":["../../../browser/lib/ActionHooks.js"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;;;;;GAMG;AACH;IA2EE;;;;;;;OAOG;IACH,qBAJW,iBAAiB,SACjB,OAAO,GACL,OAAO,CAAC,WAAW,OAAC,CAAC,CAgBjC;IAvFD;;;;OAIG;IACH,uDAFW,iBAAiB,EAO3B;IAED;;;;OAIG;IACH,kBAFa,MAAM,CAIlB;IAED;;;;;;OAMG;IACH,aAFa,MAAM,OAAC,CAUnB;IAED;;;;OAIG;IACH,eAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,aAFa,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAIrC;IAED;;;;OAIG;IACH,eAFa,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAIrC;IA0BD;;;;;;;;OAQG;IACH,eANW,MAAM,gBACN,MAAM,GAAC,MAAM,cACb,OAAO,cACP,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CAyDzB;;CAmBF;sBA1MY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI;yBAIlE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAAC,OAAO,CAAC;;;;;gBAG7D,MAAM;;;;WACN,MAAM,cAAU,IAAI;;;;;;;;WAEpB,OAAO"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @
|
|
2
|
+
* Types
|
|
3
|
+
*
|
|
4
|
+
* @import {default as ActionBuilder} from "./ActionBuilder.js"
|
|
5
|
+
* @import {default as ActionWrapper} from "./ActionWrapper.js"
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
+
* @typedef {(message: string, level?: number, ...args: Array<unknown>) => void} DebugFn
|
|
9
|
+
*
|
|
8
10
|
* @typedef {object} ActionRunnerOptions
|
|
9
11
|
* @property {DebugFn} [debug] Logger function.
|
|
10
12
|
*/
|
|
@@ -32,12 +34,12 @@ export default class ActionRunner extends Piper {
|
|
|
32
34
|
* @param {import("./ActionWrapper.js").default|null} [parentWrapper] - Parent wrapper for BREAK/CONTINUE signaling.
|
|
33
35
|
* @returns {Promise<unknown>} Final value produced by the pipeline.
|
|
34
36
|
* @throws {Sass} When no activities are registered, conflicting activity kinds are used, or execution fails.
|
|
37
|
+
* @throws {Tantrum} When both an activity and the done callback fail.
|
|
35
38
|
*/
|
|
36
39
|
run(context: unknown, parentWrapper?: import("./ActionWrapper.js").default | null): Promise<unknown>;
|
|
37
40
|
#private;
|
|
38
41
|
}
|
|
39
42
|
export type DebugFn = (message: string, level?: number, ...args: Array<unknown>) => void;
|
|
40
|
-
export type ActionBuilder = import("./ActionBuilder.js").default;
|
|
41
43
|
export type ActionRunnerOptions = {
|
|
42
44
|
/**
|
|
43
45
|
* Logger function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRunner.d.ts","sourceRoot":"","sources":["../../../browser/lib/ActionRunner.js"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"ActionRunner.d.ts","sourceRoot":"","sources":["../../../browser/lib/ActionRunner.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH;;;;;GAKG;AAEH;;;;;;GAMG;AACH;IAaE;;;;;OAKG;IACH,2BAHW,OAAO,oBAAoB,EAAE,OAAO,GAAC,IAAI,cACzC,mBAAmB,EAoB7B;IAoCD;;;;;;;;;;OAUG;IACH,aANW,OAAO,kBACP,OAAO,oBAAoB,EAAE,OAAO,GAAC,IAAI,GACvC,OAAO,CAAC,OAAO,CAAC,CAoJ5B;;CAiGF;sBAlVY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI;;;;;;;kBAT7D,YAAY"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type imports
|
|
3
|
+
*
|
|
4
|
+
* @import {default as ActionHooks} from "./ActionHooks.js"
|
|
5
|
+
*/
|
|
1
6
|
/**
|
|
2
7
|
* @typedef {object} WrappedActivityConfig
|
|
3
8
|
* @property {string|symbol} name Activity identifier used by hooks/logs.
|
|
@@ -7,9 +12,6 @@
|
|
|
7
12
|
* @property {unknown} [action] Parent action instance supplied when invoking the op.
|
|
8
13
|
* @property {(message: string, level?: number, ...args: Array<unknown>) => void} [debug] Optional logger reference.
|
|
9
14
|
*/
|
|
10
|
-
/**
|
|
11
|
-
* @typedef {import("@gesslar/toolkit").Generator<Activity, void, unknown>} ActivityIterator
|
|
12
|
-
*/
|
|
13
15
|
/**
|
|
14
16
|
* Thin wrapper that materialises {@link Activity} instances on demand.
|
|
15
17
|
*/
|
|
@@ -17,11 +19,19 @@ export default class ActionWrapper {
|
|
|
17
19
|
/**
|
|
18
20
|
* Create a wrapper from the builder payload.
|
|
19
21
|
*
|
|
20
|
-
* @param {
|
|
22
|
+
* @param {object} init - Builder payload.
|
|
23
|
+
* @param {Map<string|symbol, WrappedActivityConfig>} init.activities - Registered activities.
|
|
24
|
+
* @param {(message: string, level?: number, ...args: Array<unknown>) => void} init.debug - Logger.
|
|
25
|
+
* @param {import("./ActionHooks.js").default?} init.hooks - Optional hooks instance.
|
|
26
|
+
* @param {((context: unknown) => unknown|Promise<unknown>)|null} [init.done] - Optional done callback.
|
|
27
|
+
* @param {unknown} [init.action] - Optional parent action instance.
|
|
21
28
|
*/
|
|
22
29
|
constructor({ activities, hooks, debug, done: doneCallback, action }: {
|
|
23
30
|
activities: Map<string | symbol, WrappedActivityConfig>;
|
|
24
31
|
debug: (message: string, level?: number, ...args: Array<unknown>) => void;
|
|
32
|
+
hooks: import("./ActionHooks.js").default | null;
|
|
33
|
+
done?: ((context: unknown) => unknown | Promise<unknown>) | null | undefined;
|
|
34
|
+
action?: unknown;
|
|
25
35
|
});
|
|
26
36
|
/**
|
|
27
37
|
* Unique identifier for this wrapper instance.
|
|
@@ -76,6 +86,5 @@ export type WrappedActivityConfig = {
|
|
|
76
86
|
*/
|
|
77
87
|
debug?: ((message: string, level?: number, ...args: Array<unknown>) => void) | undefined;
|
|
78
88
|
};
|
|
79
|
-
export type ActivityIterator = import("@gesslar/toolkit").Generator<Activity, void, unknown>;
|
|
80
89
|
import Activity from "./Activity.js";
|
|
81
90
|
//# sourceMappingURL=ActionWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionWrapper.d.ts","sourceRoot":"","sources":["../../../browser/lib/ActionWrapper.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH;;GAEG;
|
|
1
|
+
{"version":3,"file":"ActionWrapper.d.ts","sourceRoot":"","sources":["../../../browser/lib/ActionWrapper.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;;GAEG;AACH;IAwBE;;;;;;;;;OASG;IACH,sEANG;QAAwD,UAAU,EAA1D,GAAG,CAAC,MAAM,GAAC,MAAM,EAAE,qBAAqB,CAAC;QACgC,KAAK,EAA9E,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI;QACxB,KAAK,EAA/C,OAAO,kBAAkB,EAAE,OAAO,OAAC;QAC0B,IAAI,cAAtD,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC;QAChC,MAAM,GAArB,OAAO;KACjB,EAuBA;IAED;;;;;OAKG;IACH,UAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,kBAFa,QAAQ,CAAC,QAAQ,CAAC,CAI9B;IAED;;;;OAIG;IACH,YAFa,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAC,IAAI,CAIjE;IAED;;;;OAIG;IACH,cAFa,OAAO,GAAC,IAAI,CAIxB;;CACF;;;;;UAzGa,MAAM,GAAC,MAAM;;;;QACb,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,GAAC,aAAa;;;;;;;;sBAElD,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC;;;;aAC9C,OAAO;;;;uBACG,MAAM,UAAU,MAAM,WAAW,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI;;qBAf3D,eAAe"}
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
* *
|
|
3
3
|
*/
|
|
4
4
|
export type ACTIVITY = number;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* @import {default as ActionBuilder} from "./ActionBuilder.js"
|
|
7
|
+
* @import {default as ActionHooks} from "./ActionHooks.js"
|
|
8
|
+
* @import {default as ActionWrapper} from "./ActionWrapper.js"
|
|
9
|
+
**/
|
|
6
10
|
/**
|
|
7
11
|
* Activity bit flags recognised by the builder. The flag decides
|
|
8
12
|
* loop semantics for an activity.
|
|
@@ -31,24 +35,24 @@ export default class Activity {
|
|
|
31
35
|
* @param {object} init - Initial properties describing the activity operation, loop semantics, and predicate
|
|
32
36
|
* @param {unknown} init.action - Parent action instance
|
|
33
37
|
* @param {string|symbol} init.name - Activity identifier
|
|
34
|
-
* @param {(context: unknown) => unknown|Promise<unknown>|
|
|
38
|
+
* @param {(context: unknown) => unknown|Promise<unknown>|ActionBuilder} init.op - Operation to execute
|
|
35
39
|
* @param {number} [init.kind] - Optional loop semantics flags
|
|
36
40
|
* @param {(context: unknown) => boolean|Promise<boolean>} [init.pred] - Optional predicate for WHILE/UNTIL
|
|
37
41
|
* @param {ActionHooks} [init.hooks] - Optional hooks instance
|
|
38
42
|
* @param {(context: unknown) => unknown} [init.splitter] - Optional splitter function for SPLIT activities
|
|
39
43
|
* @param {(originalContext: unknown, splitResults: unknown) => unknown} [init.rejoiner] - Optional rejoiner function for SPLIT activities
|
|
40
|
-
* @param {
|
|
44
|
+
* @param {ActionWrapper} [init.wrapper] - Optional wrapper containing this activity
|
|
41
45
|
*/
|
|
42
46
|
constructor({ action, name, op, kind, pred, hooks, splitter, rejoiner, wrapper }: {
|
|
43
47
|
action: unknown;
|
|
44
48
|
name: string | symbol;
|
|
45
|
-
op: (context: unknown) => unknown | Promise<unknown> |
|
|
49
|
+
op: (context: unknown) => unknown | Promise<unknown> | ActionBuilder;
|
|
46
50
|
kind?: number | undefined;
|
|
47
51
|
pred?: ((context: unknown) => boolean | Promise<boolean>) | undefined;
|
|
48
|
-
hooks?:
|
|
52
|
+
hooks?: ActionHooks | undefined;
|
|
49
53
|
splitter?: ((context: unknown) => unknown) | undefined;
|
|
50
54
|
rejoiner?: ((originalContext: unknown, splitResults: unknown) => unknown) | undefined;
|
|
51
|
-
wrapper?:
|
|
55
|
+
wrapper?: ActionWrapper | undefined;
|
|
52
56
|
});
|
|
53
57
|
/**
|
|
54
58
|
* Unique identifier for this activity instance.
|
|
@@ -89,19 +93,19 @@ export default class Activity {
|
|
|
89
93
|
/**
|
|
90
94
|
* The operator to execute (function or nested ActionBuilder).
|
|
91
95
|
*
|
|
92
|
-
* @returns {(context: unknown) => unknown|Promise<unknown>|
|
|
96
|
+
* @returns {(context: unknown) => unknown|Promise<unknown>|ActionBuilder} - Activity operation
|
|
93
97
|
*/
|
|
94
|
-
get op(): (context: unknown) => unknown | Promise<unknown> |
|
|
98
|
+
get op(): (context: unknown) => unknown | Promise<unknown> | ActionBuilder;
|
|
95
99
|
/**
|
|
96
100
|
* The splitter function for SPLIT activities.
|
|
97
101
|
*
|
|
98
|
-
* @returns {((context: unknown) => unknown)
|
|
102
|
+
* @returns {((context: unknown) => unknown)?} Splitter function or null
|
|
99
103
|
*/
|
|
100
104
|
get splitter(): ((context: unknown) => unknown) | null;
|
|
101
105
|
/**
|
|
102
106
|
* The rejoiner function for SPLIT activities.
|
|
103
107
|
*
|
|
104
|
-
* @returns {((originalContext: unknown, splitResults: unknown) => unknown)
|
|
108
|
+
* @returns {((originalContext: unknown, splitResults: unknown) => unknown)?} Rejoiner function or null
|
|
105
109
|
*/
|
|
106
110
|
get rejoiner(): ((originalContext: unknown, splitResults: unknown) => unknown) | null;
|
|
107
111
|
/**
|
|
@@ -114,9 +118,9 @@ export default class Activity {
|
|
|
114
118
|
* Get the ActionWrapper containing this activity.
|
|
115
119
|
* Used by BREAK/CONTINUE to signal the parent loop.
|
|
116
120
|
*
|
|
117
|
-
* @returns {
|
|
121
|
+
* @returns {ActionWrapper?} The wrapper or null
|
|
118
122
|
*/
|
|
119
|
-
get wrapper():
|
|
123
|
+
get wrapper(): ActionWrapper | null;
|
|
120
124
|
/**
|
|
121
125
|
* Execute the activity with before/after hooks.
|
|
122
126
|
*
|
|
@@ -134,10 +138,12 @@ export default class Activity {
|
|
|
134
138
|
/**
|
|
135
139
|
* Get the hooks instance attached to this activity.
|
|
136
140
|
*
|
|
137
|
-
* @returns {ActionHooks
|
|
141
|
+
* @returns {ActionHooks?} The hooks instance or null
|
|
138
142
|
*/
|
|
139
143
|
get hooks(): ActionHooks | null;
|
|
140
144
|
#private;
|
|
141
145
|
}
|
|
142
|
-
|
|
146
|
+
import type { default as ActionBuilder } from "./ActionBuilder.js";
|
|
147
|
+
import type { default as ActionWrapper } from "./ActionWrapper.js";
|
|
148
|
+
import type { default as ActionHooks } from "./ActionHooks.js";
|
|
143
149
|
//# sourceMappingURL=Activity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Activity.d.ts","sourceRoot":"","sources":["../../../browser/lib/Activity.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Activity.d.ts","sourceRoot":"","sources":["../../../browser/lib/Activity.js"],"names":[],"mappings":";;;uBAaU,MAAM;AAXhB;;;;IAII;AAEJ;;;;;;;;;;;;GAYG;AACH;;;;;;;GAOE;AAEF;IAwBE;;;;;;;;;;;;;OAaG;IACH,kFAVG;QAAsB,MAAM,EAApB,OAAO;QACa,IAAI,EAAxB,MAAM,GAAC,MAAM;QACsD,EAAE,EAArE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,GAAC,aAAa;QAC9C,IAAI;QACoC,IAAI,cAAhD,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC;QAC3B,KAAK;QACa,QAAQ,cAAnC,OAAO,KAAK,OAAO;QACuC,QAAQ,sBAA1D,OAAO,gBAAgB,OAAO,KAAK,OAAO;QACvC,OAAO;KACtC,EAWA;IAED;;;;OAIG;IACH,UAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,YAFa,MAAM,GAAC,IAAI,CAIvB;IAED;;;;OAIG;IACH,YAFa,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,GAAC,SAAS,CAIpE;IAED;;;;OAIG;IACH,eAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,cAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,UAFa,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,GAAC,aAAa,CAIxE;IAED;;;;OAIG;IACH,gBAFa,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAC,CAI5C;IAED;;;;OAIG;IACH,gBAFa,CAAC,CAAC,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,KAAK,OAAO,CAAC,OAAC,CAI3E;IAED;;;;OAIG;IACH,cAFa,OAAO,CAInB;IAED;;;;;OAKG;IACH,eAFa,aAAa,OAAC,CAI1B;IAED;;;;;OAKG;IACH,aAHW,OAAO,GACL,OAAO,CAAC,OAAO,CAAC,CAa5B;IAED;;;;;OAKG;IACH,sBAHW,WAAW,GACT,IAAI,CAOhB;IAED;;;;OAIG;IACH,aAFa,WAAW,OAAC,CAIxB;;CACF;8CAzN0C,oBAAoB;8CAEpB,oBAAoB;4CADtB,kBAAkB"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @import {Tantrum} from "@gesslar/toolkit"
|
|
3
|
+
*/
|
|
4
|
+
export default class Piper extends NotifyClass {
|
|
2
5
|
/**
|
|
3
6
|
* Create a Piper instance.
|
|
4
7
|
*
|
|
5
|
-
* @param {{debug?: (message: string, level?: number, ...args: Array<unknown>) => void}} [config] Optional configuration with debug function
|
|
8
|
+
* @param {{debug?: (message: string, level?: number, ...args: Array<unknown>) => void}} [config] - Optional configuration with debug function
|
|
6
9
|
*/
|
|
7
10
|
constructor({ debug }?: {
|
|
8
11
|
debug?: (message: string, level?: number, ...args: Array<unknown>) => void;
|
|
9
12
|
});
|
|
13
|
+
get reason(): any;
|
|
10
14
|
/**
|
|
11
15
|
* Add a processing step to the pipeline
|
|
12
16
|
*
|
|
13
|
-
* @param {(context: unknown) => Promise<unknown>|unknown} fn Function that processes an item
|
|
14
|
-
* @param {{name?: string, required?: boolean}} [options] Step options
|
|
15
|
-
* @param {unknown} [newThis] Optional this binding
|
|
17
|
+
* @param {(context: unknown) => Promise<unknown>|unknown} fn - Function that processes an item
|
|
18
|
+
* @param {{name?: string, required?: boolean}} [options] - Step options
|
|
19
|
+
* @param {unknown} [newThis] - Optional this binding
|
|
16
20
|
* @returns {Piper} The pipeline instance (for chaining)
|
|
17
21
|
*/
|
|
18
22
|
addStep(fn: (context: unknown) => Promise<unknown> | unknown, options?: {
|
|
@@ -22,19 +26,19 @@ export default class Piper {
|
|
|
22
26
|
/**
|
|
23
27
|
* Add setup hook that runs before processing starts.
|
|
24
28
|
*
|
|
25
|
-
* @param {() => Promise<void>|void} fn - Setup function executed before processing
|
|
29
|
+
* @param {(items: Array<unknown>) => Promise<void>|void} fn - Setup function executed before processing; receives the full items array.
|
|
26
30
|
* @param {unknown} [thisArg] - Optional this binding for the setup function
|
|
27
31
|
* @returns {Piper} - The pipeline instance
|
|
28
32
|
*/
|
|
29
|
-
addSetup(fn: () => Promise<void> | void, thisArg?: unknown): Piper;
|
|
33
|
+
addSetup(fn: (items: Array<unknown>) => Promise<void> | void, thisArg?: unknown): Piper;
|
|
30
34
|
/**
|
|
31
35
|
* Add cleanup hook that runs after processing completes
|
|
32
36
|
*
|
|
33
|
-
* @param {() => Promise<void>|void} fn - Cleanup function executed after processing
|
|
37
|
+
* @param {(items: Array<unknown>) => Promise<void>|void} fn - Cleanup function executed after processing; receives the full items array.
|
|
34
38
|
* @param {unknown} [thisArg] - Optional this binding for the cleanup function
|
|
35
39
|
* @returns {Piper} - The pipeline instance
|
|
36
40
|
*/
|
|
37
|
-
addCleanup(fn: () => Promise<void> | void, thisArg?: unknown): Piper;
|
|
41
|
+
addCleanup(fn: (items: Array<unknown>) => Promise<void> | void, thisArg?: unknown): Piper;
|
|
38
42
|
/**
|
|
39
43
|
* Process items through the pipeline with concurrency control
|
|
40
44
|
*
|
|
@@ -49,4 +53,5 @@ export default class Piper {
|
|
|
49
53
|
}>>;
|
|
50
54
|
#private;
|
|
51
55
|
}
|
|
56
|
+
import { NotifyClass } from "@gesslar/toolkit";
|
|
52
57
|
//# sourceMappingURL=Piper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Piper.d.ts","sourceRoot":"","sources":["../../../browser/lib/Piper.js"],"names":[],"mappings":"AAaA;
|
|
1
|
+
{"version":3,"file":"Piper.d.ts","sourceRoot":"","sources":["../../../browser/lib/Piper.js"],"names":[],"mappings":"AAaA;;GAEG;AAEH;IAWE;;;;OAIG;IACH,wBAFW;QAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;KAAC,EAUtF;IAMD,kBAEC;IAED;;;;;;;OAOG;IACH,YALW,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAAC,OAAO,YAC9C;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAC,YACnC,OAAO,GACL,KAAK,CAWjB;IAED;;;;;;OAMG;IACH,aAJW,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAC,IAAI,YAC7C,OAAO,GACL,KAAK,CAMjB;IAED;;;;;;OAMG;IACH,eAJW,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAC,IAAI,YAC7C,OAAO,GACL,KAAK,CAMjB;IAED;;;;;;OAMG;IACH,YAJW,KAAK,CAAC,OAAO,CAAC,GAAC,OAAO,kBACtB,MAAM,GACJ,OAAO,CAAC,KAAK,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC,CAAC,CA6D/E;;CAuCF;4BA9LyD,kBAAkB"}
|