@dudousxd/nestjs-durable-core 0.28.1 → 0.29.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/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -472,8 +472,9 @@ type WorkflowCommand =
|
|
|
472
472
|
interface WorkflowDecision {
|
|
473
473
|
taskId: string;
|
|
474
474
|
runId: string;
|
|
475
|
-
/** `continue` = produced `commands` and is blocked on an await; otherwise the run settles.
|
|
476
|
-
|
|
475
|
+
/** `continue` = produced `commands` and is blocked on an await; otherwise the run settles.
|
|
476
|
+
* `cancelled` = the worker bailed at an op boundary because the run was cancelled mid-turn. */
|
|
477
|
+
status: 'continue' | 'completed' | 'failed' | 'cancelled';
|
|
477
478
|
/** New durable ops the replay produced this turn (status === 'continue'), ordered by seq. */
|
|
478
479
|
commands: WorkflowCommand[];
|
|
479
480
|
/** Final workflow output (status === 'completed'). */
|
|
@@ -1984,6 +1985,16 @@ declare function attributeOperand(filter: AttributeFilter): string | number;
|
|
|
1984
1985
|
/**
|
|
1985
1986
|
* Dependency-injection tokens. Adapters bind their implementations to these so `core` and
|
|
1986
1987
|
* `@dudousxd/nestjs-durable` depend only on the interfaces in `./interfaces`.
|
|
1988
|
+
*
|
|
1989
|
+
* These use `Symbol.for(key)` (the global symbol registry), NOT `Symbol(key)`, so the token is the
|
|
1990
|
+
* SAME instance no matter how many times `core` is evaluated in a process. A consumer can hold more
|
|
1991
|
+
* than one physical copy of `core` at runtime — pnpm peer-dependency multiplexing installs a
|
|
1992
|
+
* separate virtual copy per distinct peer set, and the dual ESM/CJS build can be loaded once as
|
|
1993
|
+
* `import` (`index.js`) and once as `require` (`index.cjs`). A plain `Symbol()` would mint a
|
|
1994
|
+
* DISTINCT token per copy, so `DurableModule` (provider) and `DashboardService` / a store adapter
|
|
1995
|
+
* (injector) could resolve different symbols → Nest can't satisfy the dependency
|
|
1996
|
+
* (`STATE_STORE is not available in the DurableApiModule context`). A registered symbol collapses
|
|
1997
|
+
* them to one. Mirrors the `CONTEXT_ACCESSOR` token in `@dudousxd/nestjs-durable`'s `tokens.ts`.
|
|
1987
1998
|
*/
|
|
1988
1999
|
declare const STATE_STORE: unique symbol;
|
|
1989
2000
|
declare const TRANSPORT: unique symbol;
|
package/dist/index.d.ts
CHANGED
|
@@ -472,8 +472,9 @@ type WorkflowCommand =
|
|
|
472
472
|
interface WorkflowDecision {
|
|
473
473
|
taskId: string;
|
|
474
474
|
runId: string;
|
|
475
|
-
/** `continue` = produced `commands` and is blocked on an await; otherwise the run settles.
|
|
476
|
-
|
|
475
|
+
/** `continue` = produced `commands` and is blocked on an await; otherwise the run settles.
|
|
476
|
+
* `cancelled` = the worker bailed at an op boundary because the run was cancelled mid-turn. */
|
|
477
|
+
status: 'continue' | 'completed' | 'failed' | 'cancelled';
|
|
477
478
|
/** New durable ops the replay produced this turn (status === 'continue'), ordered by seq. */
|
|
478
479
|
commands: WorkflowCommand[];
|
|
479
480
|
/** Final workflow output (status === 'completed'). */
|
|
@@ -1984,6 +1985,16 @@ declare function attributeOperand(filter: AttributeFilter): string | number;
|
|
|
1984
1985
|
/**
|
|
1985
1986
|
* Dependency-injection tokens. Adapters bind their implementations to these so `core` and
|
|
1986
1987
|
* `@dudousxd/nestjs-durable` depend only on the interfaces in `./interfaces`.
|
|
1988
|
+
*
|
|
1989
|
+
* These use `Symbol.for(key)` (the global symbol registry), NOT `Symbol(key)`, so the token is the
|
|
1990
|
+
* SAME instance no matter how many times `core` is evaluated in a process. A consumer can hold more
|
|
1991
|
+
* than one physical copy of `core` at runtime — pnpm peer-dependency multiplexing installs a
|
|
1992
|
+
* separate virtual copy per distinct peer set, and the dual ESM/CJS build can be loaded once as
|
|
1993
|
+
* `import` (`index.js`) and once as `require` (`index.cjs`). A plain `Symbol()` would mint a
|
|
1994
|
+
* DISTINCT token per copy, so `DurableModule` (provider) and `DashboardService` / a store adapter
|
|
1995
|
+
* (injector) could resolve different symbols → Nest can't satisfy the dependency
|
|
1996
|
+
* (`STATE_STORE is not available in the DurableApiModule context`). A registered symbol collapses
|
|
1997
|
+
* them to one. Mirrors the `CONTEXT_ACCESSOR` token in `@dudousxd/nestjs-durable`'s `tokens.ts`.
|
|
1987
1998
|
*/
|
|
1988
1999
|
declare const STATE_STORE: unique symbol;
|
|
1989
2000
|
declare const TRANSPORT: unique symbol;
|
package/dist/index.js
CHANGED
|
@@ -2422,6 +2422,17 @@ var WorkflowEngine = class {
|
|
|
2422
2422
|
error
|
|
2423
2423
|
};
|
|
2424
2424
|
}
|
|
2425
|
+
if (decision.status === "cancelled") {
|
|
2426
|
+
await this.applyCommands(run, decision.commands);
|
|
2427
|
+
await this.store.updateRun(run.id, {
|
|
2428
|
+
status: "cancelled",
|
|
2429
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
2430
|
+
});
|
|
2431
|
+
return {
|
|
2432
|
+
runId: run.id,
|
|
2433
|
+
status: "cancelled"
|
|
2434
|
+
};
|
|
2435
|
+
}
|
|
2425
2436
|
const wakeAt = await this.applyCommands(run, decision.commands);
|
|
2426
2437
|
await this.store.updateRun(run.id, {
|
|
2427
2438
|
status: "suspended",
|
|
@@ -3565,9 +3576,9 @@ function attributeOperand(filter) {
|
|
|
3565
3576
|
__name(attributeOperand, "attributeOperand");
|
|
3566
3577
|
|
|
3567
3578
|
// src/tokens.ts
|
|
3568
|
-
var STATE_STORE = Symbol("nestjs-durable:STATE_STORE");
|
|
3569
|
-
var TRANSPORT = Symbol("nestjs-durable:TRANSPORT");
|
|
3570
|
-
var DURABLE_OPTIONS = Symbol("nestjs-durable:DURABLE_OPTIONS");
|
|
3579
|
+
var STATE_STORE = Symbol.for("nestjs-durable:STATE_STORE");
|
|
3580
|
+
var TRANSPORT = Symbol.for("nestjs-durable:TRANSPORT");
|
|
3581
|
+
var DURABLE_OPTIONS = Symbol.for("nestjs-durable:DURABLE_OPTIONS");
|
|
3571
3582
|
|
|
3572
3583
|
// src/testing/in-memory-state-store.ts
|
|
3573
3584
|
var InMemoryStateStore = class {
|