@pattern-stack/codegen 0.4.2 → 0.4.3
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 +6 -0
- package/dist/runtime/subsystems/bridge/bridge.module.d.ts +1 -0
- package/dist/runtime/subsystems/bridge/bridge.module.js +38 -21
- package/dist/runtime/subsystems/bridge/bridge.module.js.map +1 -1
- package/dist/runtime/subsystems/bridge/index.d.ts +1 -0
- package/dist/runtime/subsystems/bridge/index.js +29 -12
- package/dist/runtime/subsystems/bridge/index.js.map +1 -1
- package/dist/runtime/subsystems/index.js +31 -14
- package/dist/runtime/subsystems/index.js.map +1 -1
- package/dist/runtime/subsystems/jobs/index.d.ts +1 -0
- package/dist/runtime/subsystems/jobs/index.js +27 -10
- package/dist/runtime/subsystems/jobs/index.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.d.ts +3 -1
- package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js +9 -4
- package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-worker.d.ts +3 -1
- package/dist/runtime/subsystems/jobs/job-worker.js +6 -2
- package/dist/runtime/subsystems/jobs/job-worker.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-worker.module.d.ts +3 -1
- package/dist/runtime/subsystems/jobs/job-worker.module.js +27 -10
- package/dist/runtime/subsystems/jobs/job-worker.module.js.map +1 -1
- package/dist/runtime/subsystems/jobs/jobs-domain.module.js +9 -4
- package/dist/runtime/subsystems/jobs/jobs-domain.module.js.map +1 -1
- package/dist/src/cli/index.js +29 -2
- package/dist/src/cli/index.js.map +1 -1
- package/package.json +1 -1
- package/runtime/subsystems/jobs/job-orchestrator.memory-backend.ts +12 -2
- package/runtime/subsystems/jobs/job-worker.module.ts +10 -0
- package/runtime/subsystems/jobs/job-worker.ts +12 -3
|
@@ -20,6 +20,7 @@ import '../../../job-orchestrator.protocol-BwsBd37o.js';
|
|
|
20
20
|
import '../jobs/job-orchestration.schema.js';
|
|
21
21
|
import '@nestjs/common';
|
|
22
22
|
import '../jobs/job-worker.module.js';
|
|
23
|
+
import '@nestjs/core';
|
|
23
24
|
import '../jobs/jobs-domain.module.js';
|
|
24
25
|
import '../jobs/job-run-service.protocol.js';
|
|
25
26
|
import '../jobs/job-step-service.protocol.js';
|
|
@@ -807,7 +807,7 @@ EventFlowService = __decorateClass([
|
|
|
807
807
|
import {
|
|
808
808
|
Inject as Inject12,
|
|
809
809
|
Module as Module3,
|
|
810
|
-
Optional as
|
|
810
|
+
Optional as Optional7
|
|
811
811
|
} from "@nestjs/common";
|
|
812
812
|
|
|
813
813
|
// runtime/subsystems/jobs/job-worker.module.ts
|
|
@@ -816,7 +816,7 @@ import {
|
|
|
816
816
|
Injectable as Injectable12,
|
|
817
817
|
Logger as Logger6,
|
|
818
818
|
Module as Module2,
|
|
819
|
-
Optional as
|
|
819
|
+
Optional as Optional6
|
|
820
820
|
} from "@nestjs/common";
|
|
821
821
|
|
|
822
822
|
// runtime/subsystems/jobs/jobs-domain.module.ts
|
|
@@ -1387,7 +1387,7 @@ DrizzleJobStepService = __decorateClass([
|
|
|
1387
1387
|
|
|
1388
1388
|
// runtime/subsystems/jobs/job-orchestrator.memory-backend.ts
|
|
1389
1389
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
1390
|
-
import { Inject as Inject8, Injectable as Injectable8, Logger as Logger4 } from "@nestjs/common";
|
|
1390
|
+
import { Inject as Inject8, Injectable as Injectable8, Logger as Logger4, Optional as Optional5 } from "@nestjs/common";
|
|
1391
1391
|
var QUEUED_RUN_AT = /* @__PURE__ */ new Date(864e13);
|
|
1392
1392
|
var TERMINAL_STATUSES2 = [
|
|
1393
1393
|
"completed",
|
|
@@ -1424,14 +1424,16 @@ var PromiseMutex = class {
|
|
|
1424
1424
|
}
|
|
1425
1425
|
};
|
|
1426
1426
|
var MemoryJobOrchestrator = class {
|
|
1427
|
-
constructor(store, stepService, multiTenant) {
|
|
1427
|
+
constructor(store, stepService, multiTenant, moduleRef) {
|
|
1428
1428
|
this.store = store;
|
|
1429
1429
|
this.stepService = stepService;
|
|
1430
1430
|
this.multiTenant = multiTenant;
|
|
1431
|
+
this.moduleRef = moduleRef;
|
|
1431
1432
|
}
|
|
1432
1433
|
store;
|
|
1433
1434
|
stepService;
|
|
1434
1435
|
multiTenant;
|
|
1436
|
+
moduleRef;
|
|
1435
1437
|
logger = new Logger4(MemoryJobOrchestrator.name);
|
|
1436
1438
|
mutex = new PromiseMutex();
|
|
1437
1439
|
handlerRegistry = /* @__PURE__ */ new Map();
|
|
@@ -1772,7 +1774,9 @@ var MemoryJobOrchestrator = class {
|
|
|
1772
1774
|
}
|
|
1773
1775
|
const meta = registration.meta;
|
|
1774
1776
|
const HandlerClass = registration.handlerClass;
|
|
1775
|
-
const handler =
|
|
1777
|
+
const handler = this.moduleRef ? await this.moduleRef.create(
|
|
1778
|
+
HandlerClass
|
|
1779
|
+
) : new HandlerClass();
|
|
1776
1780
|
const ctx = {
|
|
1777
1781
|
input: run.input,
|
|
1778
1782
|
run,
|
|
@@ -1952,7 +1956,8 @@ var MemoryJobOrchestrator = class {
|
|
|
1952
1956
|
};
|
|
1953
1957
|
MemoryJobOrchestrator = __decorateClass([
|
|
1954
1958
|
Injectable8(),
|
|
1955
|
-
__decorateParam(2, Inject8(JOBS_MULTI_TENANT))
|
|
1959
|
+
__decorateParam(2, Inject8(JOBS_MULTI_TENANT)),
|
|
1960
|
+
__decorateParam(3, Optional5())
|
|
1956
1961
|
], MemoryJobOrchestrator);
|
|
1957
1962
|
function classifyError(err, policy, currentAttempts) {
|
|
1958
1963
|
if (!policy) return "fail";
|
|
@@ -2416,12 +2421,13 @@ function serialiseError2(err, attempt, retryable) {
|
|
|
2416
2421
|
};
|
|
2417
2422
|
}
|
|
2418
2423
|
var JobWorker = class {
|
|
2419
|
-
constructor(db, orchestrator, runService, stepService, options) {
|
|
2424
|
+
constructor(db, orchestrator, runService, stepService, options, moduleRef) {
|
|
2420
2425
|
this.db = db;
|
|
2421
2426
|
this.orchestrator = orchestrator;
|
|
2422
2427
|
this.runService = runService;
|
|
2423
2428
|
this.stepService = stepService;
|
|
2424
2429
|
this.options = options;
|
|
2430
|
+
this.moduleRef = moduleRef;
|
|
2425
2431
|
this.pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
2426
2432
|
this.staleSweeperIntervalMs = options.staleSweeperIntervalMs ?? DEFAULT_STALE_SWEEPER_INTERVAL_MS;
|
|
2427
2433
|
this.staleThresholdMs = options.staleThresholdMs ?? DEFAULT_STALE_THRESHOLD_MS;
|
|
@@ -2438,6 +2444,7 @@ var JobWorker = class {
|
|
|
2438
2444
|
runService;
|
|
2439
2445
|
stepService;
|
|
2440
2446
|
options;
|
|
2447
|
+
moduleRef;
|
|
2441
2448
|
logger = new Logger5(JobWorker.name);
|
|
2442
2449
|
shuttingDown = false;
|
|
2443
2450
|
inFlight = /* @__PURE__ */ new Set();
|
|
@@ -2609,7 +2616,9 @@ var JobWorker = class {
|
|
|
2609
2616
|
}
|
|
2610
2617
|
const meta = registryEntry.meta;
|
|
2611
2618
|
const HandlerClass = registryEntry.handlerClass;
|
|
2612
|
-
const handler =
|
|
2619
|
+
const handler = await this.moduleRef.create(
|
|
2620
|
+
HandlerClass
|
|
2621
|
+
);
|
|
2613
2622
|
const ctx = {
|
|
2614
2623
|
input: claimed.input,
|
|
2615
2624
|
run: claimed,
|
|
@@ -2769,18 +2778,20 @@ JobWorker = __decorateClass([
|
|
|
2769
2778
|
var DEFAULT_SHUTDOWN_TIMEOUT_MS2 = 3e4;
|
|
2770
2779
|
var JOB_WORKER_MODULE_OPTIONS = /* @__PURE__ */ Symbol("JOB_WORKER_MODULE_OPTIONS");
|
|
2771
2780
|
var JobWorkerOrchestrator = class {
|
|
2772
|
-
constructor(orchestrator, runService, stepService, options, db = null) {
|
|
2781
|
+
constructor(orchestrator, runService, stepService, options, db = null, moduleRef) {
|
|
2773
2782
|
this.orchestrator = orchestrator;
|
|
2774
2783
|
this.runService = runService;
|
|
2775
2784
|
this.stepService = stepService;
|
|
2776
2785
|
this.options = options;
|
|
2777
2786
|
this.db = db;
|
|
2787
|
+
this.moduleRef = moduleRef;
|
|
2778
2788
|
}
|
|
2779
2789
|
orchestrator;
|
|
2780
2790
|
runService;
|
|
2781
2791
|
stepService;
|
|
2782
2792
|
options;
|
|
2783
2793
|
db;
|
|
2794
|
+
moduleRef;
|
|
2784
2795
|
logger = new Logger6(JobWorkerOrchestrator.name);
|
|
2785
2796
|
workers = [];
|
|
2786
2797
|
// ============================================================================
|
|
@@ -2879,12 +2890,18 @@ var JobWorkerOrchestrator = class {
|
|
|
2879
2890
|
`JobWorkerModule: in-process worker spawning requires the Drizzle backend (no DRIZZLE provider available). Memory-mode tests must pass 'workerFactory' to inject a stub.`
|
|
2880
2891
|
);
|
|
2881
2892
|
}
|
|
2893
|
+
if (!this.moduleRef) {
|
|
2894
|
+
throw new Error(
|
|
2895
|
+
`JobWorkerModule: ModuleRef not available \u2014 cannot construct JobWorker with handler DI support. Ensure the orchestrator is resolved through the Nest container (not instantiated manually in tests).`
|
|
2896
|
+
);
|
|
2897
|
+
}
|
|
2882
2898
|
return new JobWorker(
|
|
2883
2899
|
this.db,
|
|
2884
2900
|
this.orchestrator,
|
|
2885
2901
|
this.runService,
|
|
2886
2902
|
this.stepService,
|
|
2887
|
-
workerOptions
|
|
2903
|
+
workerOptions,
|
|
2904
|
+
this.moduleRef
|
|
2888
2905
|
);
|
|
2889
2906
|
}
|
|
2890
2907
|
};
|
|
@@ -2894,7 +2911,7 @@ JobWorkerOrchestrator = __decorateClass([
|
|
|
2894
2911
|
__decorateParam(1, Inject11(JOB_RUN_SERVICE)),
|
|
2895
2912
|
__decorateParam(2, Inject11(JOB_STEP_SERVICE)),
|
|
2896
2913
|
__decorateParam(3, Inject11(JOB_WORKER_MODULE_OPTIONS)),
|
|
2897
|
-
__decorateParam(4,
|
|
2914
|
+
__decorateParam(4, Optional6()),
|
|
2898
2915
|
__decorateParam(4, Inject11(DRIZZLE))
|
|
2899
2916
|
], JobWorkerOrchestrator);
|
|
2900
2917
|
var JobWorkerModule = class {
|
|
@@ -2987,7 +3004,7 @@ var BridgeModule = class {
|
|
|
2987
3004
|
};
|
|
2988
3005
|
BridgeModule = __decorateClass([
|
|
2989
3006
|
Module3({}),
|
|
2990
|
-
__decorateParam(0,
|
|
3007
|
+
__decorateParam(0, Optional7()),
|
|
2991
3008
|
__decorateParam(0, Inject12(JOB_WORKER_MODULE_OPTIONS))
|
|
2992
3009
|
], BridgeModule);
|
|
2993
3010
|
export {
|