@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.
Files changed (29) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/runtime/subsystems/bridge/bridge.module.d.ts +1 -0
  3. package/dist/runtime/subsystems/bridge/bridge.module.js +38 -21
  4. package/dist/runtime/subsystems/bridge/bridge.module.js.map +1 -1
  5. package/dist/runtime/subsystems/bridge/index.d.ts +1 -0
  6. package/dist/runtime/subsystems/bridge/index.js +29 -12
  7. package/dist/runtime/subsystems/bridge/index.js.map +1 -1
  8. package/dist/runtime/subsystems/index.js +31 -14
  9. package/dist/runtime/subsystems/index.js.map +1 -1
  10. package/dist/runtime/subsystems/jobs/index.d.ts +1 -0
  11. package/dist/runtime/subsystems/jobs/index.js +27 -10
  12. package/dist/runtime/subsystems/jobs/index.js.map +1 -1
  13. package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.d.ts +3 -1
  14. package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js +9 -4
  15. package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js.map +1 -1
  16. package/dist/runtime/subsystems/jobs/job-worker.d.ts +3 -1
  17. package/dist/runtime/subsystems/jobs/job-worker.js +6 -2
  18. package/dist/runtime/subsystems/jobs/job-worker.js.map +1 -1
  19. package/dist/runtime/subsystems/jobs/job-worker.module.d.ts +3 -1
  20. package/dist/runtime/subsystems/jobs/job-worker.module.js +27 -10
  21. package/dist/runtime/subsystems/jobs/job-worker.module.js.map +1 -1
  22. package/dist/runtime/subsystems/jobs/jobs-domain.module.js +9 -4
  23. package/dist/runtime/subsystems/jobs/jobs-domain.module.js.map +1 -1
  24. package/dist/src/cli/index.js +29 -2
  25. package/dist/src/cli/index.js.map +1 -1
  26. package/package.json +1 -1
  27. package/runtime/subsystems/jobs/job-orchestrator.memory-backend.ts +12 -2
  28. package/runtime/subsystems/jobs/job-worker.module.ts +10 -0
  29. package/runtime/subsystems/jobs/job-worker.ts +12 -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,9 @@ var JobWorker = class {
1864
1866
  }
1865
1867
  const meta = registryEntry.meta;
1866
1868
  const HandlerClass = registryEntry.handlerClass;
1867
- const handler = new HandlerClass();
1869
+ const handler = await this.moduleRef.create(
1870
+ HandlerClass
1871
+ );
1868
1872
  const ctx = {
1869
1873
  input: claimed.input,
1870
1874
  run: claimed,
@@ -2038,7 +2042,7 @@ var MemoryJobStore = class {
2038
2042
 
2039
2043
  // runtime/subsystems/jobs/job-orchestrator.memory-backend.ts
2040
2044
  import { randomUUID as randomUUID3 } from "crypto";
2041
- import { Inject as Inject9, Injectable as Injectable9, Logger as Logger6 } from "@nestjs/common";
2045
+ import { Inject as Inject9, Injectable as Injectable9, Logger as Logger6, Optional as Optional3 } from "@nestjs/common";
2042
2046
  var QUEUED_RUN_AT = /* @__PURE__ */ new Date(864e13);
2043
2047
  var TERMINAL_STATUSES2 = [
2044
2048
  "completed",
@@ -2075,14 +2079,16 @@ var PromiseMutex = class {
2075
2079
  }
2076
2080
  };
2077
2081
  var MemoryJobOrchestrator = class {
2078
- constructor(store, stepService, multiTenant) {
2082
+ constructor(store, stepService, multiTenant, moduleRef) {
2079
2083
  this.store = store;
2080
2084
  this.stepService = stepService;
2081
2085
  this.multiTenant = multiTenant;
2086
+ this.moduleRef = moduleRef;
2082
2087
  }
2083
2088
  store;
2084
2089
  stepService;
2085
2090
  multiTenant;
2091
+ moduleRef;
2086
2092
  logger = new Logger6(MemoryJobOrchestrator.name);
2087
2093
  mutex = new PromiseMutex();
2088
2094
  handlerRegistry = /* @__PURE__ */ new Map();
@@ -2423,7 +2429,9 @@ var MemoryJobOrchestrator = class {
2423
2429
  }
2424
2430
  const meta = registration.meta;
2425
2431
  const HandlerClass = registration.handlerClass;
2426
- const handler = new HandlerClass();
2432
+ const handler = this.moduleRef ? await this.moduleRef.create(
2433
+ HandlerClass
2434
+ ) : new HandlerClass();
2427
2435
  const ctx = {
2428
2436
  input: run.input,
2429
2437
  run,
@@ -2603,7 +2611,8 @@ var MemoryJobOrchestrator = class {
2603
2611
  };
2604
2612
  MemoryJobOrchestrator = __decorateClass([
2605
2613
  Injectable9(),
2606
- __decorateParam(2, Inject9(JOBS_MULTI_TENANT))
2614
+ __decorateParam(2, Inject9(JOBS_MULTI_TENANT)),
2615
+ __decorateParam(3, Optional3())
2607
2616
  ], MemoryJobOrchestrator);
2608
2617
  function classifyError2(err, policy, currentAttempts) {
2609
2618
  if (!policy) return "fail";
@@ -2898,7 +2907,7 @@ import {
2898
2907
  Injectable as Injectable12,
2899
2908
  Logger as Logger7,
2900
2909
  Module as Module3,
2901
- Optional as Optional3
2910
+ Optional as Optional4
2902
2911
  } from "@nestjs/common";
2903
2912
 
2904
2913
  // runtime/subsystems/jobs/pool-config.loader.ts
@@ -3024,18 +3033,20 @@ function extractUserPools(raw) {
3024
3033
  var DEFAULT_SHUTDOWN_TIMEOUT_MS2 = 3e4;
3025
3034
  var JOB_WORKER_MODULE_OPTIONS = /* @__PURE__ */ Symbol("JOB_WORKER_MODULE_OPTIONS");
3026
3035
  var JobWorkerOrchestrator = class {
3027
- constructor(orchestrator, runService, stepService, options, db = null) {
3036
+ constructor(orchestrator, runService, stepService, options, db = null, moduleRef) {
3028
3037
  this.orchestrator = orchestrator;
3029
3038
  this.runService = runService;
3030
3039
  this.stepService = stepService;
3031
3040
  this.options = options;
3032
3041
  this.db = db;
3042
+ this.moduleRef = moduleRef;
3033
3043
  }
3034
3044
  orchestrator;
3035
3045
  runService;
3036
3046
  stepService;
3037
3047
  options;
3038
3048
  db;
3049
+ moduleRef;
3039
3050
  logger = new Logger7(JobWorkerOrchestrator.name);
3040
3051
  workers = [];
3041
3052
  // ============================================================================
@@ -3134,12 +3145,18 @@ var JobWorkerOrchestrator = class {
3134
3145
  `JobWorkerModule: in-process worker spawning requires the Drizzle backend (no DRIZZLE provider available). Memory-mode tests must pass 'workerFactory' to inject a stub.`
3135
3146
  );
3136
3147
  }
3148
+ if (!this.moduleRef) {
3149
+ throw new Error(
3150
+ `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).`
3151
+ );
3152
+ }
3137
3153
  return new JobWorker(
3138
3154
  this.db,
3139
3155
  this.orchestrator,
3140
3156
  this.runService,
3141
3157
  this.stepService,
3142
- workerOptions
3158
+ workerOptions,
3159
+ this.moduleRef
3143
3160
  );
3144
3161
  }
3145
3162
  };
@@ -3149,7 +3166,7 @@ JobWorkerOrchestrator = __decorateClass([
3149
3166
  __decorateParam(1, Inject11(JOB_RUN_SERVICE)),
3150
3167
  __decorateParam(2, Inject11(JOB_STEP_SERVICE)),
3151
3168
  __decorateParam(3, Inject11(JOB_WORKER_MODULE_OPTIONS)),
3152
- __decorateParam(4, Optional3()),
3169
+ __decorateParam(4, Optional4()),
3153
3170
  __decorateParam(4, Inject11(DRIZZLE))
3154
3171
  ], JobWorkerOrchestrator);
3155
3172
  var JobWorkerModule = class {
@@ -3183,7 +3200,7 @@ var CACHE_DEFAULT_TTL = /* @__PURE__ */ Symbol("CACHE_DEFAULT_TTL");
3183
3200
  import { Module as Module4 } from "@nestjs/common";
3184
3201
 
3185
3202
  // runtime/subsystems/cache/cache.drizzle-backend.ts
3186
- import { Injectable as Injectable13, Inject as Inject12, Optional as Optional4 } from "@nestjs/common";
3203
+ import { Injectable as Injectable13, Inject as Inject12, Optional as Optional5 } from "@nestjs/common";
3187
3204
  import { gt as gt2, or, like, sql as sql4, eq as eq6 } from "drizzle-orm";
3188
3205
 
3189
3206
  // runtime/subsystems/cache/cache.schema.ts
@@ -3289,12 +3306,12 @@ var DrizzleCacheService = class {
3289
3306
  DrizzleCacheService = __decorateClass([
3290
3307
  Injectable13(),
3291
3308
  __decorateParam(0, Inject12(DRIZZLE)),
3292
- __decorateParam(1, Optional4()),
3309
+ __decorateParam(1, Optional5()),
3293
3310
  __decorateParam(1, Inject12(CACHE_DEFAULT_TTL))
3294
3311
  ], DrizzleCacheService);
3295
3312
 
3296
3313
  // runtime/subsystems/cache/cache.memory-backend.ts
3297
- import { Injectable as Injectable14, Inject as Inject13, Optional as Optional5 } from "@nestjs/common";
3314
+ import { Injectable as Injectable14, Inject as Inject13, Optional as Optional6 } from "@nestjs/common";
3298
3315
  var MemoryCacheService = class {
3299
3316
  constructor(defaultTtl = null) {
3300
3317
  this.defaultTtl = defaultTtl;
@@ -3369,7 +3386,7 @@ var MemoryCacheService = class {
3369
3386
  };
3370
3387
  MemoryCacheService = __decorateClass([
3371
3388
  Injectable14(),
3372
- __decorateParam(0, Optional5()),
3389
+ __decorateParam(0, Optional6()),
3373
3390
  __decorateParam(0, Inject13(CACHE_DEFAULT_TTL))
3374
3391
  ], MemoryCacheService);
3375
3392