@pattern-stack/codegen 0.4.2 → 0.4.4
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 +17 -0
- package/dist/runtime/subsystems/bridge/bridge.module.d.ts +1 -0
- package/dist/runtime/subsystems/bridge/bridge.module.js +42 -23
- 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 +33 -14
- package/dist/runtime/subsystems/bridge/index.js.map +1 -1
- package/dist/runtime/subsystems/index.js +35 -16
- 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 +31 -12
- 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 +10 -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 +7 -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 +31 -12
- package/dist/runtime/subsystems/jobs/job-worker.module.js.map +1 -1
- package/dist/runtime/subsystems/jobs/jobs-domain.module.js +10 -4
- package/dist/runtime/subsystems/jobs/jobs-domain.module.js.map +1 -1
- package/dist/src/cli/index.js +71 -7
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/index.js +27 -2
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
- package/runtime/subsystems/jobs/job-orchestrator.memory-backend.ts +16 -2
- package/runtime/subsystems/jobs/job-worker.module.ts +20 -2
- package/runtime/subsystems/jobs/job-worker.ts +18 -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,10 @@ 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 ? this.moduleRef.get(
|
|
1778
|
+
HandlerClass,
|
|
1779
|
+
{ strict: false }
|
|
1780
|
+
) : new HandlerClass();
|
|
1776
1781
|
const ctx = {
|
|
1777
1782
|
input: run.input,
|
|
1778
1783
|
run,
|
|
@@ -1952,7 +1957,8 @@ var MemoryJobOrchestrator = class {
|
|
|
1952
1957
|
};
|
|
1953
1958
|
MemoryJobOrchestrator = __decorateClass([
|
|
1954
1959
|
Injectable8(),
|
|
1955
|
-
__decorateParam(2, Inject8(JOBS_MULTI_TENANT))
|
|
1960
|
+
__decorateParam(2, Inject8(JOBS_MULTI_TENANT)),
|
|
1961
|
+
__decorateParam(3, Optional5())
|
|
1956
1962
|
], MemoryJobOrchestrator);
|
|
1957
1963
|
function classifyError(err, policy, currentAttempts) {
|
|
1958
1964
|
if (!policy) return "fail";
|
|
@@ -2416,12 +2422,13 @@ function serialiseError2(err, attempt, retryable) {
|
|
|
2416
2422
|
};
|
|
2417
2423
|
}
|
|
2418
2424
|
var JobWorker = class {
|
|
2419
|
-
constructor(db, orchestrator, runService, stepService, options) {
|
|
2425
|
+
constructor(db, orchestrator, runService, stepService, options, moduleRef) {
|
|
2420
2426
|
this.db = db;
|
|
2421
2427
|
this.orchestrator = orchestrator;
|
|
2422
2428
|
this.runService = runService;
|
|
2423
2429
|
this.stepService = stepService;
|
|
2424
2430
|
this.options = options;
|
|
2431
|
+
this.moduleRef = moduleRef;
|
|
2425
2432
|
this.pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
2426
2433
|
this.staleSweeperIntervalMs = options.staleSweeperIntervalMs ?? DEFAULT_STALE_SWEEPER_INTERVAL_MS;
|
|
2427
2434
|
this.staleThresholdMs = options.staleThresholdMs ?? DEFAULT_STALE_THRESHOLD_MS;
|
|
@@ -2438,6 +2445,7 @@ var JobWorker = class {
|
|
|
2438
2445
|
runService;
|
|
2439
2446
|
stepService;
|
|
2440
2447
|
options;
|
|
2448
|
+
moduleRef;
|
|
2441
2449
|
logger = new Logger5(JobWorker.name);
|
|
2442
2450
|
shuttingDown = false;
|
|
2443
2451
|
inFlight = /* @__PURE__ */ new Set();
|
|
@@ -2609,7 +2617,10 @@ var JobWorker = class {
|
|
|
2609
2617
|
}
|
|
2610
2618
|
const meta = registryEntry.meta;
|
|
2611
2619
|
const HandlerClass = registryEntry.handlerClass;
|
|
2612
|
-
const handler =
|
|
2620
|
+
const handler = this.moduleRef.get(
|
|
2621
|
+
HandlerClass,
|
|
2622
|
+
{ strict: false }
|
|
2623
|
+
);
|
|
2613
2624
|
const ctx = {
|
|
2614
2625
|
input: claimed.input,
|
|
2615
2626
|
run: claimed,
|
|
@@ -2769,18 +2780,20 @@ JobWorker = __decorateClass([
|
|
|
2769
2780
|
var DEFAULT_SHUTDOWN_TIMEOUT_MS2 = 3e4;
|
|
2770
2781
|
var JOB_WORKER_MODULE_OPTIONS = /* @__PURE__ */ Symbol("JOB_WORKER_MODULE_OPTIONS");
|
|
2771
2782
|
var JobWorkerOrchestrator = class {
|
|
2772
|
-
constructor(orchestrator, runService, stepService, options, db = null) {
|
|
2783
|
+
constructor(orchestrator, runService, stepService, options, db = null, moduleRef) {
|
|
2773
2784
|
this.orchestrator = orchestrator;
|
|
2774
2785
|
this.runService = runService;
|
|
2775
2786
|
this.stepService = stepService;
|
|
2776
2787
|
this.options = options;
|
|
2777
2788
|
this.db = db;
|
|
2789
|
+
this.moduleRef = moduleRef;
|
|
2778
2790
|
}
|
|
2779
2791
|
orchestrator;
|
|
2780
2792
|
runService;
|
|
2781
2793
|
stepService;
|
|
2782
2794
|
options;
|
|
2783
2795
|
db;
|
|
2796
|
+
moduleRef;
|
|
2784
2797
|
logger = new Logger6(JobWorkerOrchestrator.name);
|
|
2785
2798
|
workers = [];
|
|
2786
2799
|
// ============================================================================
|
|
@@ -2807,7 +2820,7 @@ var JobWorkerOrchestrator = class {
|
|
|
2807
2820
|
);
|
|
2808
2821
|
}
|
|
2809
2822
|
const workerOptions = {
|
|
2810
|
-
pool:
|
|
2823
|
+
pool: poolName,
|
|
2811
2824
|
concurrency: def.concurrency,
|
|
2812
2825
|
shutdownTimeoutMs: this.options.shutdownTimeoutMs ?? DEFAULT_SHUTDOWN_TIMEOUT_MS2
|
|
2813
2826
|
};
|
|
@@ -2815,7 +2828,7 @@ var JobWorkerOrchestrator = class {
|
|
|
2815
2828
|
worker.onModuleInit();
|
|
2816
2829
|
this.workers.push(worker);
|
|
2817
2830
|
this.logger.log(
|
|
2818
|
-
`JobWorker started: pool='${def.queue}' concurrency=${def.concurrency}`
|
|
2831
|
+
`JobWorker started: pool='${poolName}' (queue='${def.queue}') concurrency=${def.concurrency}`
|
|
2819
2832
|
);
|
|
2820
2833
|
}
|
|
2821
2834
|
}
|
|
@@ -2879,12 +2892,18 @@ var JobWorkerOrchestrator = class {
|
|
|
2879
2892
|
`JobWorkerModule: in-process worker spawning requires the Drizzle backend (no DRIZZLE provider available). Memory-mode tests must pass 'workerFactory' to inject a stub.`
|
|
2880
2893
|
);
|
|
2881
2894
|
}
|
|
2895
|
+
if (!this.moduleRef) {
|
|
2896
|
+
throw new Error(
|
|
2897
|
+
`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).`
|
|
2898
|
+
);
|
|
2899
|
+
}
|
|
2882
2900
|
return new JobWorker(
|
|
2883
2901
|
this.db,
|
|
2884
2902
|
this.orchestrator,
|
|
2885
2903
|
this.runService,
|
|
2886
2904
|
this.stepService,
|
|
2887
|
-
workerOptions
|
|
2905
|
+
workerOptions,
|
|
2906
|
+
this.moduleRef
|
|
2888
2907
|
);
|
|
2889
2908
|
}
|
|
2890
2909
|
};
|
|
@@ -2894,7 +2913,7 @@ JobWorkerOrchestrator = __decorateClass([
|
|
|
2894
2913
|
__decorateParam(1, Inject11(JOB_RUN_SERVICE)),
|
|
2895
2914
|
__decorateParam(2, Inject11(JOB_STEP_SERVICE)),
|
|
2896
2915
|
__decorateParam(3, Inject11(JOB_WORKER_MODULE_OPTIONS)),
|
|
2897
|
-
__decorateParam(4,
|
|
2916
|
+
__decorateParam(4, Optional6()),
|
|
2898
2917
|
__decorateParam(4, Inject11(DRIZZLE))
|
|
2899
2918
|
], JobWorkerOrchestrator);
|
|
2900
2919
|
var JobWorkerModule = class {
|
|
@@ -2987,7 +3006,7 @@ var BridgeModule = class {
|
|
|
2987
3006
|
};
|
|
2988
3007
|
BridgeModule = __decorateClass([
|
|
2989
3008
|
Module3({}),
|
|
2990
|
-
__decorateParam(0,
|
|
3009
|
+
__decorateParam(0, Optional7()),
|
|
2991
3010
|
__decorateParam(0, Inject12(JOB_WORKER_MODULE_OPTIONS))
|
|
2992
3011
|
], BridgeModule);
|
|
2993
3012
|
export {
|