@wooksjs/event-wf 0.7.16 → 0.7.17
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/dist/index.cjs +5 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.mjs +5 -0
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -451,6 +451,11 @@ var WooksWf = class extends wooks.WooksAdapterBase {
|
|
|
451
451
|
/** Registers a workflow step with the given id and handler. */
|
|
452
452
|
step(id, opts) {
|
|
453
453
|
const step = (0, _prostojs_wf.createStep)(id, opts);
|
|
454
|
+
const stepIdNorm = `/${id}`.replace(/^\/+/u, "/");
|
|
455
|
+
if (this.wooks.getRouter().lookup("WF_STEP", stepIdNorm)?.route?.handlers.length) {
|
|
456
|
+
if (this.opts?.strictStepIds) throw new Error(`WF step "${id}" already registered. Step ids must be unique (strictStepIds enabled).`);
|
|
457
|
+
this.logger.warn(`WF step "${id}" registered more than once — the first registration wins. In tests, reset the shared router with clearGlobalWooks() in beforeEach().`);
|
|
458
|
+
}
|
|
454
459
|
return this.on("WF_STEP", id, () => step);
|
|
455
460
|
}
|
|
456
461
|
/** Registers a workflow flow schema with the given id. */
|
package/dist/index.d.ts
CHANGED
|
@@ -323,6 +323,17 @@ interface TWooksWfOptions {
|
|
|
323
323
|
logger?: TConsoleBase;
|
|
324
324
|
eventOptions?: EventContextOptions;
|
|
325
325
|
router?: TWooksOptions['router'];
|
|
326
|
+
/**
|
|
327
|
+
* When `true`, registering a `WF_STEP` id that is already registered throws
|
|
328
|
+
* instead of warning. Useful in CI to fail loudly on step-id collisions.
|
|
329
|
+
* Mirrors the router's `disableDuplicatePath`.
|
|
330
|
+
*
|
|
331
|
+
* Default (`false`) keeps the permissive behavior — a duplicate id logs a
|
|
332
|
+
* warning and the **first** registration wins — so HMR / dev-restart flows
|
|
333
|
+
* that re-register steps (and reset the shared router via `clearGlobalWooks()`)
|
|
334
|
+
* are not broken.
|
|
335
|
+
*/
|
|
336
|
+
strictStepIds?: boolean;
|
|
326
337
|
}
|
|
327
338
|
/** Options for {@link WooksWf.start} and {@link WooksWf.resume}. */
|
|
328
339
|
interface TWfRunOptions<I = unknown, T = unknown, IR = unknown> {
|
package/dist/index.mjs
CHANGED
|
@@ -450,6 +450,11 @@ var WooksWf = class extends WooksAdapterBase {
|
|
|
450
450
|
/** Registers a workflow step with the given id and handler. */
|
|
451
451
|
step(id, opts) {
|
|
452
452
|
const step = createStep(id, opts);
|
|
453
|
+
const stepIdNorm = `/${id}`.replace(/^\/+/u, "/");
|
|
454
|
+
if (this.wooks.getRouter().lookup("WF_STEP", stepIdNorm)?.route?.handlers.length) {
|
|
455
|
+
if (this.opts?.strictStepIds) throw new Error(`WF step "${id}" already registered. Step ids must be unique (strictStepIds enabled).`);
|
|
456
|
+
this.logger.warn(`WF step "${id}" registered more than once — the first registration wins. In tests, reset the shared router with clearGlobalWooks() in beforeEach().`);
|
|
457
|
+
}
|
|
453
458
|
return this.on("WF_STEP", id, () => step);
|
|
454
459
|
}
|
|
455
460
|
/** Registers a workflow flow schema with the given id. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/event-wf",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.17",
|
|
4
4
|
"description": "@wooksjs/event-wf",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -42,17 +42,17 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"typescript": "^5.9.3",
|
|
44
44
|
"vitest": "^3.2.4",
|
|
45
|
-
"@wooksjs/event-core": "^0.7.
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"@wooksjs/http
|
|
45
|
+
"@wooksjs/event-core": "^0.7.17",
|
|
46
|
+
"wooks": "^0.7.17",
|
|
47
|
+
"@wooksjs/http-body": "^0.7.17",
|
|
48
|
+
"@wooksjs/event-http": "^0.7.17"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@prostojs/logger": "^0.4.3",
|
|
52
|
-
"@wooksjs/event-
|
|
53
|
-
"@wooksjs/http-body": "^0.7.
|
|
54
|
-
"
|
|
55
|
-
"
|
|
52
|
+
"@wooksjs/event-http": "^0.7.17",
|
|
53
|
+
"@wooksjs/http-body": "^0.7.17",
|
|
54
|
+
"@wooksjs/event-core": "^0.7.17",
|
|
55
|
+
"wooks": "^0.7.17"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"@wooksjs/event-http": {
|