@gesslar/actioneer 0.2.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -20
- package/src/lib/ActionBuilder.js +21 -0
- package/src/lib/ActionHooks.js +2 -2
- package/src/lib/ActionRunner.js +11 -4
- package/src/lib/Activity.js +1 -1
- package/src/lib/Piper.js +3 -3
- package/src/types/lib/ActionBuilder.d.ts +20 -0
- package/src/types/lib/ActionBuilder.d.ts.map +1 -1
- package/src/types/lib/ActionRunner.d.ts +4 -2
- package/src/types/lib/ActionRunner.d.ts.map +1 -1
- package/src/types/lib/Activity.d.ts +54 -19
- package/src/types/lib/Activity.d.ts.map +1 -1
- package/src/types/lib/Piper.d.ts +6 -2
- package/src/types/lib/Piper.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gesslar/actioneer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Ready? Set?? ACTION!! pew! pew! pew!",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -19,16 +19,6 @@
|
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=22"
|
|
21
21
|
},
|
|
22
|
-
"scripts": {
|
|
23
|
-
"lint": "eslint src/",
|
|
24
|
-
"lint:fix": "eslint src/ --fix",
|
|
25
|
-
"types:build": "tsc -p tsconfig.types.json && eslint --fix \"src/types/**/*.d.ts\"",
|
|
26
|
-
"submit": "npm publish --access public --//registry.npmjs.org/:_authToken=\"${NPM_ACCESS_TOKEN}\"",
|
|
27
|
-
"update": "npx npm-check-updates -u && npm install",
|
|
28
|
-
"test": "node --test tests/unit/*.test.js",
|
|
29
|
-
"test:unit": "node --test tests/unit/*.test.js",
|
|
30
|
-
"pr": "gt submit --publish --restack --ai"
|
|
31
|
-
},
|
|
32
22
|
"repository": {
|
|
33
23
|
"type": "git",
|
|
34
24
|
"url": "git+https://github.com/gesslar/actioneer.git"
|
|
@@ -46,16 +36,23 @@
|
|
|
46
36
|
"author": "gesslar",
|
|
47
37
|
"license": "Unlicense",
|
|
48
38
|
"homepage": "https://github.com/gesslar/toolkit#readme",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@gesslar/toolkit": "^2.8.0"
|
|
41
|
+
},
|
|
49
42
|
"devDependencies": {
|
|
50
|
-
"@stylistic/eslint-plugin": "^5.6.1",
|
|
51
|
-
"@types/node": "^25.0.3",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
53
|
-
"@typescript-eslint/parser": "^8.50.1",
|
|
54
|
-
"eslint": "^9.39.2",
|
|
55
43
|
"eslint-plugin-jsdoc": "^61.5.0",
|
|
56
|
-
"typescript": "^5.9.3"
|
|
44
|
+
"typescript": "^5.9.3",
|
|
45
|
+
"@gesslar/uglier": "^0.0.8",
|
|
46
|
+
"eslint": "^9.39.2"
|
|
57
47
|
},
|
|
58
|
-
"
|
|
59
|
-
"
|
|
48
|
+
"scripts": {
|
|
49
|
+
"lint": "eslint src/",
|
|
50
|
+
"lint:fix": "eslint src/ --fix",
|
|
51
|
+
"types:build": "tsc -p tsconfig.types.json && eslint --fix \"src/types/**/*.d.ts\"",
|
|
52
|
+
"submit": "pnpm publish --access public --//registry.npmjs.org/:_authToken=\"${NPM_ACCESS_TOKEN}\"",
|
|
53
|
+
"update": "pnpm up -L",
|
|
54
|
+
"test": "node --test tests/unit/*.test.js",
|
|
55
|
+
"test:unit": "node --test tests/unit/*.test.js",
|
|
56
|
+
"pr": "gt submit --publish --restack --ai"
|
|
60
57
|
}
|
|
61
|
-
}
|
|
58
|
+
}
|
package/src/lib/ActionBuilder.js
CHANGED
|
@@ -225,6 +225,27 @@ export default class ActionBuilder {
|
|
|
225
225
|
return this
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Configure the action instance if not already set.
|
|
230
|
+
* Used to propagate parent action context to nested builders.
|
|
231
|
+
*
|
|
232
|
+
* @param {ActionBuilderAction} action The action instance to inherit.
|
|
233
|
+
* @returns {ActionBuilder} The builder instance for chaining.
|
|
234
|
+
*/
|
|
235
|
+
withAction(action) {
|
|
236
|
+
if(!this.#action && action) {
|
|
237
|
+
this.#action = action
|
|
238
|
+
|
|
239
|
+
// Update all existing activity definitions that don't have an action
|
|
240
|
+
for(const [, def] of this.#activities) {
|
|
241
|
+
if(!def.action)
|
|
242
|
+
def.action = action
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return this
|
|
247
|
+
}
|
|
248
|
+
|
|
228
249
|
/**
|
|
229
250
|
* Validates that an activity name has not been reused.
|
|
230
251
|
*
|
package/src/lib/ActionHooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {setTimeout as timeout} from "timers/promises"
|
|
2
|
-
import {Data, FileObject, Sass, Util, Valid} from "@gesslar/toolkit"
|
|
2
|
+
import {Data, FileObject, Sass, Promised, Util, Valid} from "@gesslar/toolkit"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @typedef {(message: string, level?: number, ...args: Array<unknown>) => void} DebugFn
|
|
@@ -203,7 +203,7 @@ export default class ActionHooks {
|
|
|
203
203
|
|
|
204
204
|
try {
|
|
205
205
|
debug("Starting Promise race for hook: %o", 4, hookName)
|
|
206
|
-
await
|
|
206
|
+
await Promised.race([
|
|
207
207
|
hookFunction(),
|
|
208
208
|
expireAsync
|
|
209
209
|
])
|
package/src/lib/ActionRunner.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Data, Sass,
|
|
1
|
+
import {Promised, Data, Sass, Valid} from "@gesslar/toolkit"
|
|
2
2
|
|
|
3
3
|
import ActionBuilder from "./ActionBuilder.js"
|
|
4
4
|
import {ACTIVITY} from "./Activity.js"
|
|
@@ -129,8 +129,9 @@ export default class ActionRunner extends Piper {
|
|
|
129
129
|
let settled
|
|
130
130
|
|
|
131
131
|
if(activity.opKind === "ActionBuilder") {
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
if(activity.action)
|
|
133
|
+
activity.op.withAction(activity.action)
|
|
134
|
+
|
|
134
135
|
if(activity.hooks)
|
|
135
136
|
activity.op.withHooks(activity.hooks)
|
|
136
137
|
|
|
@@ -142,7 +143,7 @@ export default class ActionRunner extends Piper {
|
|
|
142
143
|
settled = await runner.pipe(splitContexts)
|
|
143
144
|
} else {
|
|
144
145
|
// For plain functions, process each split context
|
|
145
|
-
settled = await
|
|
146
|
+
settled = await Promised.settle(
|
|
146
147
|
splitContexts.map(ctx => this.#execute(activity, ctx))
|
|
147
148
|
)
|
|
148
149
|
}
|
|
@@ -188,6 +189,9 @@ export default class ActionRunner extends Piper {
|
|
|
188
189
|
const opKind = activity.opKind
|
|
189
190
|
|
|
190
191
|
if(opKind === "ActionBuilder") {
|
|
192
|
+
if(activity.action)
|
|
193
|
+
activity.op.withAction(activity.action)
|
|
194
|
+
|
|
191
195
|
if(activity.hooks)
|
|
192
196
|
activity.op.withHooks(activity.hooks)
|
|
193
197
|
|
|
@@ -205,6 +209,9 @@ export default class ActionRunner extends Piper {
|
|
|
205
209
|
const result = await activity.run(context)
|
|
206
210
|
|
|
207
211
|
if(Data.isType(result, "ActionBuilder")) {
|
|
212
|
+
if(activity.action)
|
|
213
|
+
result.withAction(activity.action)
|
|
214
|
+
|
|
208
215
|
if(activity.hooks)
|
|
209
216
|
result.withHooks(activity.hooks)
|
|
210
217
|
|
package/src/lib/Activity.js
CHANGED
|
@@ -154,7 +154,7 @@ export default class Activity {
|
|
|
154
154
|
await this.#hooks?.callHook("before", this.#name, context)
|
|
155
155
|
|
|
156
156
|
// not a hook
|
|
157
|
-
const result = await this.#op.call(this.#action,context)
|
|
157
|
+
const result = await this.#op.call(this.#action, context)
|
|
158
158
|
|
|
159
159
|
// after hook
|
|
160
160
|
await this.#hooks?.callHook("after", this.#name, context)
|
package/src/lib/Piper.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - Error handling and reporting
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import {Sass, Tantrum
|
|
12
|
+
import {Promised, Sass, Tantrum} from "@gesslar/toolkit"
|
|
13
13
|
|
|
14
14
|
export default class Piper {
|
|
15
15
|
#debug
|
|
@@ -108,7 +108,7 @@ export default class Piper {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
const setupResult = await
|
|
111
|
+
const setupResult = await Promised.settle(
|
|
112
112
|
[...this.#lifeCycle.get("setup")].map(e => e())
|
|
113
113
|
)
|
|
114
114
|
|
|
@@ -126,7 +126,7 @@ export default class Piper {
|
|
|
126
126
|
await Promise.all(workers)
|
|
127
127
|
} finally {
|
|
128
128
|
// Run cleanup hooks
|
|
129
|
-
const teardownResult = await
|
|
129
|
+
const teardownResult = await Promised.settle(
|
|
130
130
|
[...this.#lifeCycle.get("teardown")].map(e => e())
|
|
131
131
|
)
|
|
132
132
|
|
|
@@ -53,12 +53,14 @@ export default class ActionBuilder {
|
|
|
53
53
|
* @param {ActionBuilderConfig} [config] Options
|
|
54
54
|
*/
|
|
55
55
|
constructor(action?: ActionBuilderAction, { tag, debug }?: ActionBuilderConfig)
|
|
56
|
+
get tag(): symbol | null
|
|
56
57
|
/**
|
|
57
58
|
* Register an activity that the runner can execute.
|
|
58
59
|
*
|
|
59
60
|
* Overloads:
|
|
60
61
|
* - do(name, op)
|
|
61
62
|
* - do(name, kind, pred, opOrWrapper)
|
|
63
|
+
* - do(name, kind, splitter, rejoiner, opOrWrapper)
|
|
62
64
|
*
|
|
63
65
|
* @overload
|
|
64
66
|
* @param {string|symbol} name Activity name
|
|
@@ -75,6 +77,16 @@ export default class ActionBuilder {
|
|
|
75
77
|
* @returns {ActionBuilder}
|
|
76
78
|
*/
|
|
77
79
|
do(name: string | symbol, kind: number, pred: (context: unknown) => boolean | Promise<boolean>, op: ActionFunction | import('./ActionWrapper.js').default): ActionBuilder
|
|
80
|
+
/**
|
|
81
|
+
* @overload
|
|
82
|
+
* @param {string|symbol} name Activity name
|
|
83
|
+
* @param {number} kind ACTIVITY.SPLIT flag.
|
|
84
|
+
* @param {(context: unknown) => unknown} splitter Splitter function for SPLIT mode.
|
|
85
|
+
* @param {(originalContext: unknown, splitResults: unknown) => unknown} rejoiner Rejoiner function for SPLIT mode.
|
|
86
|
+
* @param {ActionFunction|import("./ActionWrapper.js").default} op Operation or nested wrapper to execute.
|
|
87
|
+
* @returns {ActionBuilder}
|
|
88
|
+
*/
|
|
89
|
+
do(name: string | symbol, kind: number, splitter: (context: unknown) => unknown, rejoiner: (originalContext: unknown, splitResults: unknown) => unknown, op: ActionFunction | import('./ActionWrapper.js').default): ActionBuilder
|
|
78
90
|
/**
|
|
79
91
|
* Configure hooks to be loaded from a file when the action is built.
|
|
80
92
|
*
|
|
@@ -92,6 +104,14 @@ export default class ActionBuilder {
|
|
|
92
104
|
* @throws {Sass} If hooks have already been configured with a different instance.
|
|
93
105
|
*/
|
|
94
106
|
withHooks(hooks: import('./ActionHooks.js').default): ActionBuilder
|
|
107
|
+
/**
|
|
108
|
+
* Configure the action instance if not already set.
|
|
109
|
+
* Used to propagate parent action context to nested builders.
|
|
110
|
+
*
|
|
111
|
+
* @param {ActionBuilderAction} action The action instance to inherit.
|
|
112
|
+
* @returns {ActionBuilder} The builder instance for chaining.
|
|
113
|
+
*/
|
|
114
|
+
withAction(action: ActionBuilderAction): ActionBuilder
|
|
95
115
|
/**
|
|
96
116
|
* Finalises the builder and returns a payload that can be consumed by the
|
|
97
117
|
* runner.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBuilder.d.ts","sourceRoot":"","sources":["../../lib/ActionBuilder.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionBuilder.d.ts","sourceRoot":"","sources":["../../lib/ActionBuilder.js"],"names":[],"mappings":"AAMA,kEAAkE;AAClE,uEAAuE;AAE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AmB,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;;6BAI/C,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC"}
|
|
@@ -22,10 +22,12 @@ export default class ActionRunner extends Piper {
|
|
|
22
22
|
constructor(actionBuilder: import('./ActionBuilder.js').default | null, { debug }?: ActionRunnerOptions)
|
|
23
23
|
/**
|
|
24
24
|
* Executes the configured action pipeline.
|
|
25
|
+
* Builds the ActionWrapper on first run and caches it for subsequent calls.
|
|
26
|
+
* Supports WHILE, UNTIL, and SPLIT activity kinds.
|
|
25
27
|
*
|
|
26
28
|
* @param {unknown} context - Seed value passed to the first activity.
|
|
27
|
-
* @returns {Promise<unknown>} Final value produced by the pipeline
|
|
28
|
-
* @throws {Sass} When no activities are registered
|
|
29
|
+
* @returns {Promise<unknown>} Final value produced by the pipeline.
|
|
30
|
+
* @throws {Sass} When no activities are registered, conflicting activity kinds are used, or execution fails.
|
|
29
31
|
*/
|
|
30
32
|
run(context: unknown): Promise<unknown>
|
|
31
33
|
#private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRunner.d.ts","sourceRoot":"","sources":["../../lib/ActionRunner.js"],"names":[],"mappings":"AAMA;;GAEG;AAEH;;;GAGG;AACH;;;;;;GAMG;AACH;
|
|
1
|
+
{"version":3,"file":"ActionRunner.d.ts","sourceRoot":"","sources":["../../lib/ActionRunner.js"],"names":[],"mappings":"AAMA;;GAEG;AAEH;;;GAGG;AACH;;;;;;GAMG;AACH;IAaE;;;;;OAKG;IACH,2BAHW,OAAO,oBAAoB,EAAE,OAAO,GAAC,IAAI,cACzC,mBAAmB,EAkB7B;IAED;;;;;;;;OAQG;IACH,aAJW,OAAO,GACL,OAAO,CAAC,OAAO,CAAC,CAuG5B;;CA0FF;sBA1PY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI;;;;;;;kBAH7D,YAAY"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* loop semantics for an activity.
|
|
2
|
+
*
|
|
4
3
|
*/
|
|
5
4
|
export type ACTIVITY = number
|
|
6
5
|
/** @typedef {import("./ActionHooks.js").default} ActionHooks */
|
|
@@ -10,24 +9,38 @@ export type ACTIVITY = number
|
|
|
10
9
|
*
|
|
11
10
|
* @readonly
|
|
12
11
|
* @enum {number}
|
|
12
|
+
* @property {number} WHILE - Execute activity while predicate returns true (2)
|
|
13
|
+
* @property {number} UNTIL - Execute activity until predicate returns true (4)
|
|
14
|
+
* @property {number} SPLIT - Execute activity with split/rejoin pattern for parallel execution (8)
|
|
13
15
|
*/
|
|
14
16
|
export const ACTIVITY: Readonly<{
|
|
15
17
|
WHILE: number;
|
|
16
18
|
UNTIL: number;
|
|
19
|
+
SPLIT: number;
|
|
17
20
|
}>
|
|
18
21
|
export default class Activity {
|
|
19
22
|
/**
|
|
20
23
|
* Construct an Activity definition wrapper.
|
|
21
24
|
*
|
|
22
|
-
* @param {
|
|
25
|
+
* @param {object} init - Initial properties describing the activity operation, loop semantics, and predicate
|
|
26
|
+
* @param {unknown} init.action - Parent action instance
|
|
27
|
+
* @param {string|symbol} init.name - Activity identifier
|
|
28
|
+
* @param {(context: unknown) => unknown|Promise<unknown>|import("./ActionBuilder.js").default} init.op - Operation to execute
|
|
29
|
+
* @param {number} [init.kind] - Optional loop semantics flags
|
|
30
|
+
* @param {(context: unknown) => boolean|Promise<boolean>} [init.pred] - Optional predicate for WHILE/UNTIL
|
|
31
|
+
* @param {ActionHooks} [init.hooks] - Optional hooks instance
|
|
32
|
+
* @param {(context: unknown) => unknown} [init.splitter] - Optional splitter function for SPLIT activities
|
|
33
|
+
* @param {(originalContext: unknown, splitResults: unknown) => unknown} [init.rejoiner] - Optional rejoiner function for SPLIT activities
|
|
23
34
|
*/
|
|
24
|
-
constructor({ action, name, op, kind, pred, hooks }: {
|
|
35
|
+
constructor({ action, name, op, kind, pred, hooks, splitter, rejoiner }: {
|
|
25
36
|
action: unknown;
|
|
26
|
-
name: string;
|
|
27
|
-
op: (context: unknown) => unknown | Promise<unknown> |
|
|
28
|
-
kind?: number;
|
|
29
|
-
pred?: (context: unknown) => boolean | Promise<boolean
|
|
30
|
-
hooks?: ActionHooks;
|
|
37
|
+
name: string | symbol;
|
|
38
|
+
op: (context: unknown) => unknown | Promise<unknown> | import('./ActionBuilder.js').default;
|
|
39
|
+
kind?: number | undefined;
|
|
40
|
+
pred?: ((context: unknown) => boolean | Promise<boolean>) | undefined;
|
|
41
|
+
hooks?: import('./ActionHooks.js').default | undefined;
|
|
42
|
+
splitter?: ((context: unknown) => unknown) | undefined;
|
|
43
|
+
rejoiner?: ((originalContext: unknown, splitResults: unknown) => unknown) | undefined;
|
|
31
44
|
})
|
|
32
45
|
/**
|
|
33
46
|
* The activity name.
|
|
@@ -48,17 +61,35 @@ export default class Activity {
|
|
|
48
61
|
*/
|
|
49
62
|
get pred(): (context: unknown) => boolean | Promise<boolean> | undefined
|
|
50
63
|
/**
|
|
51
|
-
* The
|
|
64
|
+
* The current context (if set).
|
|
65
|
+
*
|
|
66
|
+
* @returns {unknown} Current context value
|
|
67
|
+
*/
|
|
68
|
+
get context(): unknown
|
|
69
|
+
/**
|
|
70
|
+
* The operator kind name (Function or ActionBuilder).
|
|
52
71
|
*
|
|
53
72
|
* @returns {string} - Kind name extracted via Data.typeOf
|
|
54
73
|
*/
|
|
55
74
|
get opKind(): string
|
|
56
75
|
/**
|
|
57
|
-
* The operator to execute (function or nested
|
|
76
|
+
* The operator to execute (function or nested ActionBuilder).
|
|
58
77
|
*
|
|
59
|
-
* @returns {unknown} - Activity operation
|
|
78
|
+
* @returns {(context: unknown) => unknown|Promise<unknown>|import("./ActionBuilder.js").default} - Activity operation
|
|
60
79
|
*/
|
|
61
|
-
get op(): unknown
|
|
80
|
+
get op(): (context: unknown) => unknown | Promise<unknown> | import('./ActionBuilder.js').default
|
|
81
|
+
/**
|
|
82
|
+
* The splitter function for SPLIT activities.
|
|
83
|
+
*
|
|
84
|
+
* @returns {((context: unknown) => unknown)|null} Splitter function or null
|
|
85
|
+
*/
|
|
86
|
+
get splitter(): ((context: unknown) => unknown) | null
|
|
87
|
+
/**
|
|
88
|
+
* The rejoiner function for SPLIT activities.
|
|
89
|
+
*
|
|
90
|
+
* @returns {((originalContext: unknown, splitResults: unknown) => unknown)|null} Rejoiner function or null
|
|
91
|
+
*/
|
|
92
|
+
get rejoiner(): ((originalContext: unknown, splitResults: unknown) => unknown) | null
|
|
62
93
|
/**
|
|
63
94
|
* The action instance this activity belongs to.
|
|
64
95
|
*
|
|
@@ -69,18 +100,22 @@ export default class Activity {
|
|
|
69
100
|
* Execute the activity with before/after hooks.
|
|
70
101
|
*
|
|
71
102
|
* @param {unknown} context - Mutable context flowing through the pipeline
|
|
72
|
-
* @returns {Promise<
|
|
103
|
+
* @returns {Promise<unknown>} - Activity result
|
|
73
104
|
*/
|
|
74
|
-
run(context: unknown): Promise<
|
|
75
|
-
activityResult: unknown;
|
|
76
|
-
}>
|
|
105
|
+
run(context: unknown): Promise<unknown>
|
|
77
106
|
/**
|
|
78
107
|
* Attach hooks to this activity instance.
|
|
79
108
|
*
|
|
80
|
-
* @param {
|
|
109
|
+
* @param {ActionHooks} hooks - Hooks instance with optional before$/after$ methods
|
|
81
110
|
* @returns {this} - This activity for chaining
|
|
82
111
|
*/
|
|
83
|
-
setActionHooks(hooks:
|
|
112
|
+
setActionHooks(hooks: ActionHooks): this
|
|
113
|
+
/**
|
|
114
|
+
* Get the hooks instance attached to this activity.
|
|
115
|
+
*
|
|
116
|
+
* @returns {ActionHooks|null} The hooks instance or null
|
|
117
|
+
*/
|
|
118
|
+
get hooks(): ActionHooks | null
|
|
84
119
|
#private
|
|
85
120
|
}
|
|
86
121
|
export type ActionHooks = import('./ActionHooks.js').default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Activity.d.ts","sourceRoot":"","sources":["../../lib/Activity.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Activity.d.ts","sourceRoot":"","sources":["../../lib/Activity.js"],"names":[],"mappings":";;;uBASU,MAAM;AAPhB,gEAAgE;AAEhE;;;;;;;;;GASG;AACH;;;;GAIE;AAEF;IAoBE;;;;;;;;;;;;OAYG;IACH,yEATG;QAAsB,MAAM,EAApB,OAAO;QACa,IAAI,EAAxB,MAAM,GAAC,MAAM;QAC6E,EAAE,EAA5F,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,GAAC,OAAO,oBAAoB,EAAE,OAAO;QACrE,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;KACtE,EAUA;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,OAAO,oBAAoB,EAAE,OAAO,CAI/F;IAED;;;;OAIG;IACH,gBAFa,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAC,IAAI,CAIhD;IAED;;;;OAIG;IACH,gBAFa,CAAC,CAAC,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,KAAK,OAAO,CAAC,GAAC,IAAI,CAI/E;IAED;;;;OAIG;IACH,cAFa,OAAO,CAInB;IAED;;;;;OAKG;IACH,aAHW,OAAO,GACL,OAAO,CAAC,OAAO,CAAC,CAa5B;IAED;;;;;OAKG;IACH,sBAHW,WAAW,GACT,IAAI,CAOhB;IAED;;;;OAIG;IACH,aAFa,WAAW,GAAC,IAAI,CAI5B;;CACF;0BAvLa,OAAO,kBAAkB,EAAE,OAAO"}
|
package/src/types/lib/Piper.d.ts
CHANGED
|
@@ -40,9 +40,13 @@ export default class Piper {
|
|
|
40
40
|
*
|
|
41
41
|
* @param {Array<unknown>|unknown} items - Items to process
|
|
42
42
|
* @param {number} maxConcurrent - Maximum concurrent items to process
|
|
43
|
-
* @returns {Promise<Array<unknown>>} -
|
|
43
|
+
* @returns {Promise<Array<{status: string, value?: unknown, reason?: unknown}>>} - Settled results from processing
|
|
44
44
|
*/
|
|
45
|
-
pipe(items: Array<unknown> | unknown, maxConcurrent?: number): Promise<Array<
|
|
45
|
+
pipe(items: Array<unknown> | unknown, maxConcurrent?: number): Promise<Array<{
|
|
46
|
+
status: string;
|
|
47
|
+
value?: unknown;
|
|
48
|
+
reason?: unknown;
|
|
49
|
+
}>>
|
|
46
50
|
#private
|
|
47
51
|
}
|
|
48
52
|
//# sourceMappingURL=Piper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Piper.d.ts","sourceRoot":"","sources":["../../lib/Piper.js"],"names":[],"mappings":"AAaA;IASE;;;;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,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