@codemation/core 0.13.0 → 0.13.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.
- package/CHANGELOG.md +9 -0
- package/dist/bootstrap/index.cjs +2 -2
- package/dist/bootstrap/index.d.cts +11 -0
- package/dist/bootstrap/index.d.ts +1 -1
- package/dist/bootstrap/index.js +2 -2
- package/dist/{bootstrap-CSeInbj1.js → bootstrap-DB3jpo8F.js} +2 -2
- package/dist/{bootstrap-CSeInbj1.js.map → bootstrap-DB3jpo8F.js.map} +1 -1
- package/dist/{bootstrap-BEu1fJBM.cjs → bootstrap-UDyH8OfK.cjs} +2 -2
- package/dist/{bootstrap-BEu1fJBM.cjs.map → bootstrap-UDyH8OfK.cjs.map} +1 -1
- package/dist/{index-CqZeNGAp.d.ts → index-C2P-fOAx.d.ts} +12 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{runtime-6-U2Cou5.js → runtime-iHBN1jyD.js} +21 -3
- package/dist/{runtime-6-U2Cou5.js.map → runtime-iHBN1jyD.js.map} +1 -1
- package/dist/{runtime-DjYXgOo0.cjs → runtime-rrH8-Ouq.cjs} +21 -3
- package/dist/{runtime-DjYXgOo0.cjs.map → runtime-rrH8-Ouq.cjs.map} +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.js +2 -2
- package/package.json +1 -1
- package/src/scheduler/InlineDrivingScheduler.ts +23 -2
package/dist/testing.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_di = require('./di-C-2ep8NZ.cjs');
|
|
2
2
|
require('./contracts-CK0x6w_G.cjs');
|
|
3
|
-
const require_runtime = require('./runtime-
|
|
3
|
+
const require_runtime = require('./runtime-rrH8-Ouq.cjs');
|
|
4
4
|
const require_InMemoryRunEventBusRegistry = require('./InMemoryRunEventBusRegistry-Sa86VxuV.cjs');
|
|
5
|
-
const require_bootstrap = require('./bootstrap-
|
|
5
|
+
const require_bootstrap = require('./bootstrap-UDyH8OfK.cjs');
|
|
6
6
|
let tsyringe = require("tsyringe");
|
|
7
7
|
tsyringe = require_di.__toESM(tsyringe);
|
|
8
8
|
|
package/dist/testing.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { d as CoreTokens } from "./di-D9Mv3kF3.js";
|
|
2
2
|
import "./contracts-DXdfTdpW.js";
|
|
3
|
-
import { A as PersistedWorkflowTokenRegistry, C as DefaultDrivingScheduler, G as AllWorkflowsActiveWorkflowActivationPolicy, N as NodeExecutor, O as NodeInstanceFactory, S as HintOnlyOffloadPolicy, V as DefaultExecutionContextFactory, a as InMemoryLiveWorkflowRepository, i as RunIntentService, it as emitPorts, k as WorkflowSnapshotCodec, l as Engine, p as InMemoryRunDataFactory, st as DefaultAsyncSleeper, x as InlineDrivingScheduler, yt as WorkflowBuilder, z as InProcessRetryRunner } from "./runtime-
|
|
3
|
+
import { A as PersistedWorkflowTokenRegistry, C as DefaultDrivingScheduler, G as AllWorkflowsActiveWorkflowActivationPolicy, N as NodeExecutor, O as NodeInstanceFactory, S as HintOnlyOffloadPolicy, V as DefaultExecutionContextFactory, a as InMemoryLiveWorkflowRepository, i as RunIntentService, it as emitPorts, k as WorkflowSnapshotCodec, l as Engine, p as InMemoryRunDataFactory, st as DefaultAsyncSleeper, x as InlineDrivingScheduler, yt as WorkflowBuilder, z as InProcessRetryRunner } from "./runtime-iHBN1jyD.js";
|
|
4
4
|
import { t as InMemoryRunEventBus } from "./InMemoryRunEventBusRegistry-Bwunvt1T.js";
|
|
5
|
-
import { a as InMemoryWorkflowExecutionRepository, t as EngineRuntimeRegistrar } from "./bootstrap-
|
|
5
|
+
import { a as InMemoryWorkflowExecutionRepository, t as EngineRuntimeRegistrar } from "./bootstrap-DB3jpo8F.js";
|
|
6
6
|
import { container } from "tsyringe";
|
|
7
7
|
|
|
8
8
|
//#region src/testing/RejectingCredentialSessionService.ts
|
package/package.json
CHANGED
|
@@ -15,6 +15,8 @@ export class InlineDrivingScheduler implements NodeActivationScheduler {
|
|
|
15
15
|
Array<Readonly<{ request: NodeActivationRequest; receipt: NodeActivationReceipt }>>
|
|
16
16
|
>();
|
|
17
17
|
private readonly scheduledRuns = new Set<string>();
|
|
18
|
+
private stopped = false;
|
|
19
|
+
private readonly activeDrainPromises = new Set<Promise<void>>();
|
|
18
20
|
|
|
19
21
|
constructor(private readonly nodeExecutor: NodeExecutor) {}
|
|
20
22
|
|
|
@@ -22,6 +24,21 @@ export class InlineDrivingScheduler implements NodeActivationScheduler {
|
|
|
22
24
|
this.continuation = continuation;
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Prevents new drain cycles from being scheduled and waits for all currently-running
|
|
29
|
+
* drains to complete. Call before closing the DB connection or rolling back test transactions
|
|
30
|
+
* to ensure no in-flight writes hit a closed/rolled-back connection.
|
|
31
|
+
*
|
|
32
|
+
* Bounded: only the drains already in-flight at call time are awaited. Runs that keep
|
|
33
|
+
* re-scheduling will not schedule new work once stopped is set.
|
|
34
|
+
*/
|
|
35
|
+
async stop(): Promise<void> {
|
|
36
|
+
this.stopped = true;
|
|
37
|
+
if (this.activeDrainPromises.size > 0) {
|
|
38
|
+
await Promise.allSettled(this.activeDrainPromises);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
25
42
|
async prepareDispatch(request: NodeActivationRequest): Promise<PreparedNodeActivationDispatch> {
|
|
26
43
|
const receipt: NodeActivationReceipt = { receiptId: request.activationId, mode: "local" };
|
|
27
44
|
return {
|
|
@@ -77,7 +94,7 @@ export class InlineDrivingScheduler implements NodeActivationScheduler {
|
|
|
77
94
|
}
|
|
78
95
|
|
|
79
96
|
private scheduleDrain(runId: string): void {
|
|
80
|
-
if (this.drainingRuns.has(runId) || this.scheduledRuns.has(runId)) {
|
|
97
|
+
if (this.stopped || this.drainingRuns.has(runId) || this.scheduledRuns.has(runId)) {
|
|
81
98
|
return;
|
|
82
99
|
}
|
|
83
100
|
this.scheduledRuns.add(runId);
|
|
@@ -85,7 +102,11 @@ export class InlineDrivingScheduler implements NodeActivationScheduler {
|
|
|
85
102
|
// giving queued HTTP writes and WS frames a chance to flush between activations.
|
|
86
103
|
setImmediate(() => {
|
|
87
104
|
this.scheduledRuns.delete(runId);
|
|
88
|
-
|
|
105
|
+
if (this.stopped) return;
|
|
106
|
+
const p = this.drainRun(runId).finally(() => {
|
|
107
|
+
this.activeDrainPromises.delete(p);
|
|
108
|
+
});
|
|
109
|
+
this.activeDrainPromises.add(p);
|
|
89
110
|
});
|
|
90
111
|
}
|
|
91
112
|
|