@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
|
@@ -1671,12 +1671,13 @@ function serialiseError(err, attempt, retryable) {
|
|
|
1671
1671
|
};
|
|
1672
1672
|
}
|
|
1673
1673
|
var JobWorker = class {
|
|
1674
|
-
constructor(db, orchestrator, runService, stepService, options) {
|
|
1674
|
+
constructor(db, orchestrator, runService, stepService, options, moduleRef) {
|
|
1675
1675
|
this.db = db;
|
|
1676
1676
|
this.orchestrator = orchestrator;
|
|
1677
1677
|
this.runService = runService;
|
|
1678
1678
|
this.stepService = stepService;
|
|
1679
1679
|
this.options = options;
|
|
1680
|
+
this.moduleRef = moduleRef;
|
|
1680
1681
|
this.pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
1681
1682
|
this.staleSweeperIntervalMs = options.staleSweeperIntervalMs ?? DEFAULT_STALE_SWEEPER_INTERVAL_MS;
|
|
1682
1683
|
this.staleThresholdMs = options.staleThresholdMs ?? DEFAULT_STALE_THRESHOLD_MS;
|
|
@@ -1693,6 +1694,7 @@ var JobWorker = class {
|
|
|
1693
1694
|
runService;
|
|
1694
1695
|
stepService;
|
|
1695
1696
|
options;
|
|
1697
|
+
moduleRef;
|
|
1696
1698
|
logger = new Logger5(JobWorker.name);
|
|
1697
1699
|
shuttingDown = false;
|
|
1698
1700
|
inFlight = /* @__PURE__ */ new Set();
|
|
@@ -1864,7 +1866,10 @@ var JobWorker = class {
|
|
|
1864
1866
|
}
|
|
1865
1867
|
const meta = registryEntry.meta;
|
|
1866
1868
|
const HandlerClass = registryEntry.handlerClass;
|
|
1867
|
-
const handler =
|
|
1869
|
+
const handler = this.moduleRef.get(
|
|
1870
|
+
HandlerClass,
|
|
1871
|
+
{ strict: false }
|
|
1872
|
+
);
|
|
1868
1873
|
const ctx = {
|
|
1869
1874
|
input: claimed.input,
|
|
1870
1875
|
run: claimed,
|
|
@@ -2038,7 +2043,7 @@ var MemoryJobStore = class {
|
|
|
2038
2043
|
|
|
2039
2044
|
// runtime/subsystems/jobs/job-orchestrator.memory-backend.ts
|
|
2040
2045
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
2041
|
-
import { Inject as Inject9, Injectable as Injectable9, Logger as Logger6 } from "@nestjs/common";
|
|
2046
|
+
import { Inject as Inject9, Injectable as Injectable9, Logger as Logger6, Optional as Optional3 } from "@nestjs/common";
|
|
2042
2047
|
var QUEUED_RUN_AT = /* @__PURE__ */ new Date(864e13);
|
|
2043
2048
|
var TERMINAL_STATUSES2 = [
|
|
2044
2049
|
"completed",
|
|
@@ -2075,14 +2080,16 @@ var PromiseMutex = class {
|
|
|
2075
2080
|
}
|
|
2076
2081
|
};
|
|
2077
2082
|
var MemoryJobOrchestrator = class {
|
|
2078
|
-
constructor(store, stepService, multiTenant) {
|
|
2083
|
+
constructor(store, stepService, multiTenant, moduleRef) {
|
|
2079
2084
|
this.store = store;
|
|
2080
2085
|
this.stepService = stepService;
|
|
2081
2086
|
this.multiTenant = multiTenant;
|
|
2087
|
+
this.moduleRef = moduleRef;
|
|
2082
2088
|
}
|
|
2083
2089
|
store;
|
|
2084
2090
|
stepService;
|
|
2085
2091
|
multiTenant;
|
|
2092
|
+
moduleRef;
|
|
2086
2093
|
logger = new Logger6(MemoryJobOrchestrator.name);
|
|
2087
2094
|
mutex = new PromiseMutex();
|
|
2088
2095
|
handlerRegistry = /* @__PURE__ */ new Map();
|
|
@@ -2423,7 +2430,10 @@ var MemoryJobOrchestrator = class {
|
|
|
2423
2430
|
}
|
|
2424
2431
|
const meta = registration.meta;
|
|
2425
2432
|
const HandlerClass = registration.handlerClass;
|
|
2426
|
-
const handler =
|
|
2433
|
+
const handler = this.moduleRef ? this.moduleRef.get(
|
|
2434
|
+
HandlerClass,
|
|
2435
|
+
{ strict: false }
|
|
2436
|
+
) : new HandlerClass();
|
|
2427
2437
|
const ctx = {
|
|
2428
2438
|
input: run.input,
|
|
2429
2439
|
run,
|
|
@@ -2603,7 +2613,8 @@ var MemoryJobOrchestrator = class {
|
|
|
2603
2613
|
};
|
|
2604
2614
|
MemoryJobOrchestrator = __decorateClass([
|
|
2605
2615
|
Injectable9(),
|
|
2606
|
-
__decorateParam(2, Inject9(JOBS_MULTI_TENANT))
|
|
2616
|
+
__decorateParam(2, Inject9(JOBS_MULTI_TENANT)),
|
|
2617
|
+
__decorateParam(3, Optional3())
|
|
2607
2618
|
], MemoryJobOrchestrator);
|
|
2608
2619
|
function classifyError2(err, policy, currentAttempts) {
|
|
2609
2620
|
if (!policy) return "fail";
|
|
@@ -2898,7 +2909,7 @@ import {
|
|
|
2898
2909
|
Injectable as Injectable12,
|
|
2899
2910
|
Logger as Logger7,
|
|
2900
2911
|
Module as Module3,
|
|
2901
|
-
Optional as
|
|
2912
|
+
Optional as Optional4
|
|
2902
2913
|
} from "@nestjs/common";
|
|
2903
2914
|
|
|
2904
2915
|
// runtime/subsystems/jobs/pool-config.loader.ts
|
|
@@ -3024,18 +3035,20 @@ function extractUserPools(raw) {
|
|
|
3024
3035
|
var DEFAULT_SHUTDOWN_TIMEOUT_MS2 = 3e4;
|
|
3025
3036
|
var JOB_WORKER_MODULE_OPTIONS = /* @__PURE__ */ Symbol("JOB_WORKER_MODULE_OPTIONS");
|
|
3026
3037
|
var JobWorkerOrchestrator = class {
|
|
3027
|
-
constructor(orchestrator, runService, stepService, options, db = null) {
|
|
3038
|
+
constructor(orchestrator, runService, stepService, options, db = null, moduleRef) {
|
|
3028
3039
|
this.orchestrator = orchestrator;
|
|
3029
3040
|
this.runService = runService;
|
|
3030
3041
|
this.stepService = stepService;
|
|
3031
3042
|
this.options = options;
|
|
3032
3043
|
this.db = db;
|
|
3044
|
+
this.moduleRef = moduleRef;
|
|
3033
3045
|
}
|
|
3034
3046
|
orchestrator;
|
|
3035
3047
|
runService;
|
|
3036
3048
|
stepService;
|
|
3037
3049
|
options;
|
|
3038
3050
|
db;
|
|
3051
|
+
moduleRef;
|
|
3039
3052
|
logger = new Logger7(JobWorkerOrchestrator.name);
|
|
3040
3053
|
workers = [];
|
|
3041
3054
|
// ============================================================================
|
|
@@ -3062,7 +3075,7 @@ var JobWorkerOrchestrator = class {
|
|
|
3062
3075
|
);
|
|
3063
3076
|
}
|
|
3064
3077
|
const workerOptions = {
|
|
3065
|
-
pool:
|
|
3078
|
+
pool: poolName,
|
|
3066
3079
|
concurrency: def.concurrency,
|
|
3067
3080
|
shutdownTimeoutMs: this.options.shutdownTimeoutMs ?? DEFAULT_SHUTDOWN_TIMEOUT_MS2
|
|
3068
3081
|
};
|
|
@@ -3070,7 +3083,7 @@ var JobWorkerOrchestrator = class {
|
|
|
3070
3083
|
worker.onModuleInit();
|
|
3071
3084
|
this.workers.push(worker);
|
|
3072
3085
|
this.logger.log(
|
|
3073
|
-
`JobWorker started: pool='${def.queue}' concurrency=${def.concurrency}`
|
|
3086
|
+
`JobWorker started: pool='${poolName}' (queue='${def.queue}') concurrency=${def.concurrency}`
|
|
3074
3087
|
);
|
|
3075
3088
|
}
|
|
3076
3089
|
}
|
|
@@ -3134,12 +3147,18 @@ var JobWorkerOrchestrator = class {
|
|
|
3134
3147
|
`JobWorkerModule: in-process worker spawning requires the Drizzle backend (no DRIZZLE provider available). Memory-mode tests must pass 'workerFactory' to inject a stub.`
|
|
3135
3148
|
);
|
|
3136
3149
|
}
|
|
3150
|
+
if (!this.moduleRef) {
|
|
3151
|
+
throw new Error(
|
|
3152
|
+
`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).`
|
|
3153
|
+
);
|
|
3154
|
+
}
|
|
3137
3155
|
return new JobWorker(
|
|
3138
3156
|
this.db,
|
|
3139
3157
|
this.orchestrator,
|
|
3140
3158
|
this.runService,
|
|
3141
3159
|
this.stepService,
|
|
3142
|
-
workerOptions
|
|
3160
|
+
workerOptions,
|
|
3161
|
+
this.moduleRef
|
|
3143
3162
|
);
|
|
3144
3163
|
}
|
|
3145
3164
|
};
|
|
@@ -3149,7 +3168,7 @@ JobWorkerOrchestrator = __decorateClass([
|
|
|
3149
3168
|
__decorateParam(1, Inject11(JOB_RUN_SERVICE)),
|
|
3150
3169
|
__decorateParam(2, Inject11(JOB_STEP_SERVICE)),
|
|
3151
3170
|
__decorateParam(3, Inject11(JOB_WORKER_MODULE_OPTIONS)),
|
|
3152
|
-
__decorateParam(4,
|
|
3171
|
+
__decorateParam(4, Optional4()),
|
|
3153
3172
|
__decorateParam(4, Inject11(DRIZZLE))
|
|
3154
3173
|
], JobWorkerOrchestrator);
|
|
3155
3174
|
var JobWorkerModule = class {
|
|
@@ -3183,7 +3202,7 @@ var CACHE_DEFAULT_TTL = /* @__PURE__ */ Symbol("CACHE_DEFAULT_TTL");
|
|
|
3183
3202
|
import { Module as Module4 } from "@nestjs/common";
|
|
3184
3203
|
|
|
3185
3204
|
// runtime/subsystems/cache/cache.drizzle-backend.ts
|
|
3186
|
-
import { Injectable as Injectable13, Inject as Inject12, Optional as
|
|
3205
|
+
import { Injectable as Injectable13, Inject as Inject12, Optional as Optional5 } from "@nestjs/common";
|
|
3187
3206
|
import { gt as gt2, or, like, sql as sql4, eq as eq6 } from "drizzle-orm";
|
|
3188
3207
|
|
|
3189
3208
|
// runtime/subsystems/cache/cache.schema.ts
|
|
@@ -3289,12 +3308,12 @@ var DrizzleCacheService = class {
|
|
|
3289
3308
|
DrizzleCacheService = __decorateClass([
|
|
3290
3309
|
Injectable13(),
|
|
3291
3310
|
__decorateParam(0, Inject12(DRIZZLE)),
|
|
3292
|
-
__decorateParam(1,
|
|
3311
|
+
__decorateParam(1, Optional5()),
|
|
3293
3312
|
__decorateParam(1, Inject12(CACHE_DEFAULT_TTL))
|
|
3294
3313
|
], DrizzleCacheService);
|
|
3295
3314
|
|
|
3296
3315
|
// runtime/subsystems/cache/cache.memory-backend.ts
|
|
3297
|
-
import { Injectable as Injectable14, Inject as Inject13, Optional as
|
|
3316
|
+
import { Injectable as Injectable14, Inject as Inject13, Optional as Optional6 } from "@nestjs/common";
|
|
3298
3317
|
var MemoryCacheService = class {
|
|
3299
3318
|
constructor(defaultTtl = null) {
|
|
3300
3319
|
this.defaultTtl = defaultTtl;
|
|
@@ -3369,7 +3388,7 @@ var MemoryCacheService = class {
|
|
|
3369
3388
|
};
|
|
3370
3389
|
MemoryCacheService = __decorateClass([
|
|
3371
3390
|
Injectable14(),
|
|
3372
|
-
__decorateParam(0,
|
|
3391
|
+
__decorateParam(0, Optional6()),
|
|
3373
3392
|
__decorateParam(0, Inject13(CACHE_DEFAULT_TTL))
|
|
3374
3393
|
], MemoryCacheService);
|
|
3375
3394
|
|