@gesslar/actioneer 2.2.0 → 2.3.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.
@@ -1,6 +1,10 @@
1
1
  import {Data} from "@gesslar/toolkit"
2
2
 
3
- /** @typedef {import("./ActionHooks.js").default} ActionHooks */
3
+ /**
4
+ * @import {default as ActionBuilder} from "./ActionBuilder.js"
5
+ * @import {default as ActionHooks} from "./ActionHooks.js"
6
+ * @import {default as ActionWrapper} from "./ActionWrapper.js"
7
+ **/
4
8
 
5
9
  /**
6
10
  * Activity bit flags recognised by the builder. The flag decides
@@ -29,13 +33,13 @@ export default class Activity {
29
33
  #action = null
30
34
  /** @type {unknown} */
31
35
  #context = null
32
- /** @type {ActionHooks|null} */
36
+ /** @type {ActionHooks?} */
33
37
  #hooks = null
34
- /** @type {number|null} */
38
+ /** @type {number?} */
35
39
  #kind = null
36
40
  /** @type {string|symbol} */
37
41
  #name = null
38
- /** @type {((context: unknown) => unknown|Promise<unknown>)|import("./ActionBuilder.js").default} */
42
+ /** @type {((context: unknown) => unknown|Promise<unknown>)|ActionBuilder} */
39
43
  #op = null
40
44
  /** @type {((context: unknown) => boolean|Promise<boolean>)|null} */
41
45
  #pred = null
@@ -43,7 +47,7 @@ export default class Activity {
43
47
  #rejoiner = null
44
48
  /** @type {((context: unknown) => unknown)|null} */
45
49
  #splitter = null
46
- /** @type {import("./ActionWrapper.js").default|null} */
50
+ /** @type {ActionWrapper?} */
47
51
  #wrapper = null
48
52
  /** @type {symbol} */
49
53
  #id = Symbol(performance.now())
@@ -54,13 +58,13 @@ export default class Activity {
54
58
  * @param {object} init - Initial properties describing the activity operation, loop semantics, and predicate
55
59
  * @param {unknown} init.action - Parent action instance
56
60
  * @param {string|symbol} init.name - Activity identifier
57
- * @param {(context: unknown) => unknown|Promise<unknown>|import("./ActionBuilder.js").default} init.op - Operation to execute
61
+ * @param {(context: unknown) => unknown|Promise<unknown>|ActionBuilder} init.op - Operation to execute
58
62
  * @param {number} [init.kind] - Optional loop semantics flags
59
63
  * @param {(context: unknown) => boolean|Promise<boolean>} [init.pred] - Optional predicate for WHILE/UNTIL
60
64
  * @param {ActionHooks} [init.hooks] - Optional hooks instance
61
65
  * @param {(context: unknown) => unknown} [init.splitter] - Optional splitter function for SPLIT activities
62
66
  * @param {(originalContext: unknown, splitResults: unknown) => unknown} [init.rejoiner] - Optional rejoiner function for SPLIT activities
63
- * @param {import("./ActionWrapper.js").default} [init.wrapper] - Optional wrapper containing this activity
67
+ * @param {ActionWrapper} [init.wrapper] - Optional wrapper containing this activity
64
68
  */
65
69
  constructor({action,name,op,kind,pred,hooks,splitter,rejoiner,wrapper}) {
66
70
  this.#action = action
@@ -131,7 +135,7 @@ export default class Activity {
131
135
  /**
132
136
  * The operator to execute (function or nested ActionBuilder).
133
137
  *
134
- * @returns {(context: unknown) => unknown|Promise<unknown>|import("./ActionBuilder.js").default} - Activity operation
138
+ * @returns {(context: unknown) => unknown|Promise<unknown>|ActionBuilder} - Activity operation
135
139
  */
136
140
  get op() {
137
141
  return this.#op
@@ -140,7 +144,7 @@ export default class Activity {
140
144
  /**
141
145
  * The splitter function for SPLIT activities.
142
146
  *
143
- * @returns {((context: unknown) => unknown)|null} Splitter function or null
147
+ * @returns {((context: unknown) => unknown)?} Splitter function or null
144
148
  */
145
149
  get splitter() {
146
150
  return this.#splitter
@@ -149,7 +153,7 @@ export default class Activity {
149
153
  /**
150
154
  * The rejoiner function for SPLIT activities.
151
155
  *
152
- * @returns {((originalContext: unknown, splitResults: unknown) => unknown)|null} Rejoiner function or null
156
+ * @returns {((originalContext: unknown, splitResults: unknown) => unknown)?} Rejoiner function or null
153
157
  */
154
158
  get rejoiner() {
155
159
  return this.#rejoiner
@@ -168,7 +172,7 @@ export default class Activity {
168
172
  * Get the ActionWrapper containing this activity.
169
173
  * Used by BREAK/CONTINUE to signal the parent loop.
170
174
  *
171
- * @returns {import("./ActionWrapper.js").default|null} The wrapper or null
175
+ * @returns {ActionWrapper?} The wrapper or null
172
176
  */
173
177
  get wrapper() {
174
178
  return this.#wrapper ?? null
@@ -209,7 +213,7 @@ export default class Activity {
209
213
  /**
210
214
  * Get the hooks instance attached to this activity.
211
215
  *
212
- * @returns {ActionHooks|null} The hooks instance or null
216
+ * @returns {ActionHooks?} The hooks instance or null
213
217
  */
214
218
  get hooks() {
215
219
  return this.#hooks
@@ -9,10 +9,12 @@
9
9
  * - Error handling and reporting
10
10
  */
11
11
 
12
- import {Promised, Sass, Tantrum} from "@gesslar/toolkit"
12
+ import {Data, Disposer, NotifyClass, Promised, Sass, Tantrum} from "@gesslar/toolkit"
13
13
 
14
- export default class Piper {
14
+ export default class Piper extends NotifyClass {
15
15
  #debug
16
+ #disposer = Disposer
17
+ #abortedReason
16
18
 
17
19
  #lifeCycle = new Map([
18
20
  ["setup", new Set()],
@@ -23,18 +25,32 @@ export default class Piper {
23
25
  /**
24
26
  * Create a Piper instance.
25
27
  *
26
- * @param {{debug?: (message: string, level?: number, ...args: Array<unknown>) => void}} [config] Optional configuration with debug function
28
+ * @param {{debug?: (message: string, level?: number, ...args: Array<unknown>) => void}} [config] - Optional configuration with debug function
27
29
  */
28
30
  constructor({debug = (() => {})} = {}) {
31
+ super()
32
+
29
33
  this.#debug = debug
34
+
35
+ this.#disposer.register(
36
+ this.on("abort", this.#abortCalled.bind(this))
37
+ )
38
+ }
39
+
40
+ #abortCalled(reason) {
41
+ this.#abortedReason = reason
42
+ }
43
+
44
+ get reason() {
45
+ return this.#abortedReason
30
46
  }
31
47
 
32
48
  /**
33
49
  * Add a processing step to the pipeline
34
50
  *
35
- * @param {(context: unknown) => Promise<unknown>|unknown} fn Function that processes an item
36
- * @param {{name?: string, required?: boolean}} [options] Step options
37
- * @param {unknown} [newThis] Optional this binding
51
+ * @param {(context: unknown) => Promise<unknown>|unknown} fn - Function that processes an item
52
+ * @param {{name?: string, required?: boolean}} [options] - Step options
53
+ * @param {unknown} [newThis] - Optional this binding
38
54
  * @returns {Piper} The pipeline instance (for chaining)
39
55
  */
40
56
  addStep(fn, options = {}, newThis) {
@@ -90,7 +106,7 @@ export default class Piper {
90
106
  const allResults = new Array(items.length)
91
107
 
92
108
  const processWorker = async() => {
93
- while(true) {
109
+ while(true && !this.reason) {
94
110
  const currentIndex = itemIndex++
95
111
 
96
112
  if(currentIndex >= items.length)
@@ -101,7 +117,10 @@ export default class Piper {
101
117
  try {
102
118
  const result = await this.#processItem(item)
103
119
 
104
- allResults[currentIndex] = {status: "fulfilled", value: result}
120
+ if(Data.isType(result, "Error"))
121
+ allResults[currentIndex] = {status: "rejected", reason: result}
122
+ else
123
+ allResults[currentIndex] = {status: "fulfilled", value: result}
105
124
  } catch(error) {
106
125
  allResults[currentIndex] = {status: "rejected", reason: error}
107
126
  }
@@ -133,30 +152,31 @@ export default class Piper {
133
152
  this.#processResult("Tearing down the pipeline.", teardownResult)
134
153
  }
135
154
 
155
+ if(this.reason)
156
+ this.emit("aborted", this.reason)
157
+
136
158
  return allResults
137
159
  }
138
160
 
139
161
  /**
140
162
  * Validate settleAll results and throw a combined error when rejected.
141
163
  *
142
- * @param {string} message Context message
143
- * @param {Array<unknown>} settled Results from settleAll
144
164
  * @private
165
+ * @param {string} message - Context message
166
+ * @param {Array<unknown>} settled - Results from settleAll
167
+ * @throws {Tantrum} - If any rejected
145
168
  */
146
169
  #processResult(message, settled) {
147
- if(settled.some(r => r.status === "rejected"))
148
- throw Tantrum.new(
149
- message,
150
- settled.filter(r => r.status==="rejected").map(r => r.reason)
151
- )
170
+ if(Promised.hasRejected(settled))
171
+ Promised.throw(settled)
152
172
  }
153
173
 
154
174
  /**
155
175
  * Process a single item through all pipeline steps
156
176
  *
157
- * @param {unknown} item The item to process
158
- * @returns {Promise<unknown>} Result from the final step
159
177
  * @private
178
+ * @param {unknown} item - The item to process
179
+ * @returns {Promise<unknown>} Result from the final step
160
180
  */
161
181
  async #processItem(item) {
162
182
  // Execute each step in sequence
@@ -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#build} to register activities.
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 ActivityFlags}.
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 ActivityFlags}.
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 {import("./ActionHooks.js").default} hooks An already-instantiated hooks instance.
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: import("./ActionHooks.js").default): ActionBuilder;
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,74 @@ 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
- * @returns {Promise<import("./ActionWrapper.js").default>} Payload consumed by the {@link ActionRunner} constructor.
133
+ * @returns {Promise<ActionWrapper>} Payload consumed by the {@link ActionRunner} constructor.
136
134
  */
137
- build(): Promise<import("./ActionWrapper.js").default>;
135
+ build(runner: any): Promise<ActionWrapper>;
138
136
  #private;
139
137
  }
140
- export type ActionRunner = import("./ActionRunner.js").default;
141
- export type ActivityFlags = typeof import("./Activity.js").ACTIVITY;
138
+ /**
139
+ * Type imports and definitions.
140
+ */
142
141
  export type DebugFn = (message: string, level?: number, ...args: Array<unknown>) => void;
142
+ /**
143
+ * Type imports and definitions.
144
+ */
143
145
  export type ActionBuilderAction = {
144
146
  /**
145
- * Function invoked during {@link ActionBuilder#build} to register activities.
147
+ * - Function invoked during {@link ActionBuilder} to register activities.
146
148
  */
147
149
  setup: (builder: ActionBuilder) => void;
148
150
  /**
149
- * Optional tag to reuse when reconstructing builders.
151
+ * - Optional tag to reuse when reconstructing builders.
150
152
  */
151
153
  tag?: symbol | undefined;
152
154
  };
155
+ /**
156
+ * Type imports and definitions.
157
+ */
153
158
  export type ActionBuilderConfig = {
154
159
  /**
155
- * Optional tag for the builder instance.
160
+ * - Optional tag for the builder instance.
156
161
  */
157
162
  tag?: symbol | undefined;
158
163
  /**
159
- * Logger used by the pipeline internals.
164
+ * - Logger used by the pipeline internals.
160
165
  */
161
166
  debug?: DebugFn | undefined;
162
167
  };
168
+ /**
169
+ * Type imports and definitions.
170
+ */
163
171
  export type ActivityDefinition = {
164
172
  /**
165
- * Parent action instance when available.
173
+ * - Parent action instance when available.
166
174
  */
167
175
  action: ActionBuilderAction | null;
168
176
  /**
169
- * Logger function.
177
+ * - Logger function.
170
178
  */
171
179
  debug: DebugFn | null;
172
180
  /**
173
- * Activity identifier.
181
+ * - Activity identifier.
174
182
  */
175
183
  name: string | symbol;
176
184
  /**
177
- * Operation to execute.
185
+ * - Operation to execute.
178
186
  */
179
187
  op: ActionFunction | import("./ActionWrapper.js").default;
180
188
  /**
181
- * Optional kind flags from {@link ActivityFlags}.
189
+ * - Optional kind flags from {@link ACTIVITY}.
182
190
  */
183
191
  kind?: number | undefined;
184
192
  /**
185
- * Loop predicate.
193
+ * - Loop predicate.
186
194
  */
187
195
  pred?: ((context: unknown) => boolean | Promise<boolean>) | undefined;
188
196
  };
197
+ /**
198
+ * Type imports and definitions.
199
+ */
189
200
  export type ActionFunction = (context: unknown) => unknown | Promise<unknown>;
201
+ import ActionHooks from "./ActionHooks.js";
202
+ import ActionWrapper from "./ActionWrapper.js";
190
203
  //# sourceMappingURL=ActionBuilder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionBuilder.d.ts","sour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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;;;;;OAKG;IACH,oBAFa,OAAO,CAAC,aAAa,CAAC,CAoClC;;CAqBF;;;;sBAtVY,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;0BADhB,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 {unknown} hooks - Already-instantiated hooks implementation.
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|null>} Initialized hook manager or null if no hooks provided
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
  /**
@@ -43,7 +42,7 @@ export default class ActionHooks {
43
42
  /**
44
43
  * Gets the loaded hooks object.
45
44
  *
46
- * @returns {object|null} Hooks object or null if not loaded
45
+ * @returns {object?} Hooks object or null if not loaded
47
46
  */
48
47
  get hooks(): object | null;
49
48
  /**
@@ -55,44 +54,44 @@ export default class ActionHooks {
55
54
  /**
56
55
  * Gets the setup hook function if available.
57
56
  *
58
- * @returns {(args: object) => unknown|null} Setup hook function or null
57
+ * @returns {(args: object) => unknown} Setup hook function or null
59
58
  */
60
- get setup(): (args: object) => unknown | null;
59
+ get setup(): (args: object) => unknown;
61
60
  /**
62
61
  * Gets the cleanup hook function if available.
63
62
  *
64
- * @returns {(args: object) => unknown|null} Cleanup hook function or null
63
+ * @returns {(args: object) => unknown} Cleanup hook function or null
65
64
  */
66
- get cleanup(): (args: object) => unknown | null;
65
+ get cleanup(): (args: object) => unknown;
67
66
  /**
68
67
  * Invoke a dynamically-named hook such as `before$foo`.
69
68
  *
70
- * @param {'before'|'after'|'setup'|'cleanup'|string} kind Hook namespace.
71
- * @param {string|symbol} activityName Activity identifier.
72
- * @param {unknown} context Pipeline context supplied to the hook.
69
+ * @param {string} kind - Hook namespace.
70
+ * @param {string|symbol} activityName - Activity identifier.
71
+ * @param {unknown} context - Pipeline context supplied to the hook.
73
72
  * @returns {Promise<void>}
74
73
  */
75
- callHook(kind: "before" | "after" | "setup" | "cleanup" | string, activityName: string | symbol, context: unknown): Promise<void>;
74
+ callHook(kind: string, activityName: string | symbol, context: unknown): Promise<void>;
76
75
  #private;
77
76
  }
78
77
  export type DebugFn = (message: string, level?: number, ...args: Array<unknown>) => void;
78
+ export type HookModule = Record<string, (context: unknown) => Promise<unknown> | unknown>;
79
79
  export type ActionHooksConfig = {
80
80
  /**
81
- * Action identifier shared between runner and hooks.
81
+ * - Action identifier shared between runner and hooks.
82
82
  */
83
83
  actionKind: string;
84
84
  /**
85
- * Already-instantiated hooks implementation.
85
+ * - Already-instantiated hooks implementation.
86
86
  */
87
87
  hooks: unknown;
88
88
  /**
89
- * Timeout applied to hook execution in milliseconds.
89
+ * - Timeout applied to hook execution in milliseconds.
90
90
  */
91
91
  hookTimeout?: number | undefined;
92
92
  /**
93
- * Logger to emit diagnostics.
93
+ * - Logger to emit diagnostics.
94
94
  */
95
95
  debug: DebugFn;
96
96
  };
97
- export type HookModule = Record<string, (context: unknown) => Promise<unknown> | unknown>;
98
97
  //# sourceMappingURL=ActionHooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionHooks.d.ts","sourceRoot":"","sources":["../../../browser/lib/ActionHooks.js"],"names":[],"mappings":"AAEA;;GAEG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OAIG;IACH,kBAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,aAFa,MAAM,OAAC,CAInB;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;;;;;;;OAOG;IACH,eALW,MAAM,gBACN,MAAM,GAAC,MAAM,WACb,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CAwDzB;;CAmBF;sBAhMY,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,OAAO;;;;;;;;WAEP,OAAO"}
@@ -1,10 +1,12 @@
1
1
  /**
2
- * @typedef {(message: string, level?: number, ...args: Array<unknown>) => void} DebugFn
3
- */
4
- /**
5
- * @typedef {import("./ActionBuilder.js").default} ActionBuilder
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;;GAEG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;;;;GAMG;AACH;IAoBE;;;;;OAKG;IACH,2BAHW,OAAO,oBAAoB,EAAE,OAAO,GAAC,IAAI,cACzC,mBAAmB,EAkB7B;IAED;;;;;;;;;OASG;IACH,aALW,OAAO,kBACP,OAAO,oBAAoB,EAAE,OAAO,GAAC,IAAI,GACvC,OAAO,CAAC,OAAO,CAAC,CA4I5B;;CAyFF;sBA3SY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI;4BAIlE,OAAO,oBAAoB,EAAE,OAAO;;;;;;;kBAP/B,YAAY"}
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,EAkB7B;IAED;;;;;;;;;;OAUG;IACH,aANW,OAAO,kBACP,OAAO,oBAAoB,EAAE,OAAO,GAAC,IAAI,GACvC,OAAO,CAAC,OAAO,CAAC,CAoJ5B;;CAiGF;sBA9SY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI;;;;;;;kBAT7D,YAAY"}
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Type imports
3
+ *
4
+ * @import {default as ActionHooks} from "./ActionHooks.js"
5
+ * @import {default as ActionRunner} from "./ActionRunner.js"
6
+ */
1
7
  /**
2
8
  * @typedef {object} WrappedActivityConfig
3
9
  * @property {string|symbol} name Activity identifier used by hooks/logs.
@@ -7,9 +13,6 @@
7
13
  * @property {unknown} [action] Parent action instance supplied when invoking the op.
8
14
  * @property {(message: string, level?: number, ...args: Array<unknown>) => void} [debug] Optional logger reference.
9
15
  */
10
- /**
11
- * @typedef {import("@gesslar/toolkit").Generator<Activity, void, unknown>} ActivityIterator
12
- */
13
16
  /**
14
17
  * Thin wrapper that materialises {@link Activity} instances on demand.
15
18
  */
@@ -76,6 +79,5 @@ export type WrappedActivityConfig = {
76
79
  */
77
80
  debug?: ((message: string, level?: number, ...args: Array<unknown>) => void) | undefined;
78
81
  };
79
- export type ActivityIterator = import("@gesslar/toolkit").Generator<Activity, void, unknown>;
80
82
  import Activity from "./Activity.js";
81
83
  //# 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;AAEH;;GAEG;AACH;IAwBE;;;;OAIG;IACH,sEAFW;QAAC,UAAU,EAAE,GAAG,CAAC,MAAM,GAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;QAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;KAAC,EAwB5I;IAED;;;;;OAKG;IACH,UAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,kBAFa,QAAQ,CAAC,QAAQ,CAAC,CAI9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