@dudousxd/nestjs-durable 0.62.0 → 0.64.0

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/dist/index.cjs CHANGED
@@ -70,6 +70,7 @@ __export(src_exports, {
70
70
  Step: () => Step,
71
71
  StepInterceptor: () => StepInterceptor,
72
72
  StoreRunGateway: () => StoreRunGateway,
73
+ TENANT_AUTH: () => TENANT_AUTH,
73
74
  TENANT_REPUBLISH_MAX_LIMIT: () => TENANT_REPUBLISH_MAX_LIMIT,
74
75
  TenantEventRepublisher: () => TenantEventRepublisher,
75
76
  ThinStepRegistrar: () => ThinStepRegistrar,
@@ -105,6 +106,7 @@ __export(src_exports, {
105
106
  scheduleRunIdAt: () => import_nestjs_durable_core21.scheduleRunIdAt,
106
107
  scheduledRunId: () => import_nestjs_durable_core21.scheduledRunId,
107
108
  signTenantToken: () => import_nestjs_durable_core21.signTenantToken,
109
+ tenantScheduleAnnouncement: () => tenantScheduleAnnouncement,
108
110
  thinWorkerProviders: () => thinWorkerProviders,
109
111
  triggeredRunsOf: () => import_nestjs_durable_core21.triggeredRunsOf,
110
112
  unavailableRunGateway: () => unavailableRunGateway
@@ -842,6 +844,19 @@ var DurableStartClient = class {
842
844
  ...opts?.searchAttributes !== void 0 ? {
843
845
  searchAttributes: opts.searchAttributes
844
846
  } : {},
847
+ // The start options the control plane applies (version pin, priority, delayed start, quota).
848
+ ...opts?.version !== void 0 ? {
849
+ version: opts.version
850
+ } : {},
851
+ ...opts?.priority !== void 0 ? {
852
+ priority: opts.priority
853
+ } : {},
854
+ ...opts?.startAt !== void 0 ? {
855
+ startAt: opts.startAt
856
+ } : {},
857
+ ...opts?.concurrency !== void 0 ? {
858
+ concurrency: opts.concurrency
859
+ } : {},
845
860
  ...tenant ? {
846
861
  tenantId: tenant.id,
847
862
  ...tenant.kind !== void 0 ? {
@@ -852,9 +867,10 @@ var DurableStartClient = class {
852
867
  deps: this.deps
853
868
  } : {}
854
869
  });
870
+ const startAtMs = opts?.startAt instanceof Date ? opts.startAt.getTime() : opts?.startAt;
855
871
  return {
856
872
  runId,
857
- status: "pending"
873
+ status: startAtMs !== void 0 && Number.isFinite(startAtMs) && startAtMs > Date.now() ? "suspended" : "pending"
858
874
  };
859
875
  }
860
876
  cancel(_runId) {
@@ -900,7 +916,7 @@ function tenantUnsupported(method) {
900
916
  __name(tenantUnsupported, "tenantUnsupported");
901
917
 
902
918
  // src/durable-worker.module.ts
903
- var import_nestjs_durable_core6 = require("@dudousxd/nestjs-durable-core");
919
+ var import_nestjs_durable_core7 = require("@dudousxd/nestjs-durable-core");
904
920
  var import_common2 = require("@nestjs/common");
905
921
  var import_core = require("@nestjs/core");
906
922
 
@@ -1097,6 +1113,12 @@ function registerOnRuntime(runtime, scanner, meta, instance, origin) {
1097
1113
  }
1098
1114
  __name(registerOnRuntime, "registerOnRuntime");
1099
1115
 
1116
+ // src/tokens.ts
1117
+ var import_nestjs_durable_core6 = require("@dudousxd/nestjs-durable-core");
1118
+ var CONTEXT_ACCESSOR = Symbol.for("@dudousxd/nestjs-context:accessor");
1119
+ var TENANT_AUTH = Symbol("nestjs-durable:tenant-auth");
1120
+ var RUN_GATEWAY = import_nestjs_durable_core6.RunGateway;
1121
+
1100
1122
  // src/durable-worker.module.ts
1101
1123
  function _ts_decorate2(decorators, target, key, desc) {
1102
1124
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1139,28 +1161,38 @@ var ThinWorkflowRegistrar = class {
1139
1161
  metadataScanner;
1140
1162
  runtime;
1141
1163
  options;
1142
- constructor(discovery, metadataScanner, runtime, options) {
1164
+ starter;
1165
+ constructor(discovery, metadataScanner, runtime, options, starter) {
1143
1166
  this.discovery = discovery;
1144
1167
  this.metadataScanner = metadataScanner;
1145
1168
  this.runtime = runtime;
1146
1169
  this.options = options;
1170
+ this.starter = starter;
1147
1171
  }
1148
1172
  onModuleInit() {
1149
1173
  const runtime = this.runtime;
1150
1174
  if (runtime === null || !isPureThinWorker(this.options)) return;
1151
- scanWorkflows(this.discovery, (meta, instance, origin) => registerOnRuntime(runtime, this.metadataScanner, meta, instance, origin));
1175
+ const starter = this.starter;
1176
+ scanWorkflows(this.discovery, (meta, instance, origin) => {
1177
+ registerOnRuntime(runtime, this.metadataScanner, meta, instance, origin);
1178
+ (0, import_nestjs_durable_core7.bindWorkflowClass)(instance.constructor, {
1179
+ start: /* @__PURE__ */ __name((name, input, runId, opts) => starter.start(name, input, runId, opts), "start")
1180
+ });
1181
+ });
1152
1182
  }
1153
1183
  };
1154
1184
  ThinWorkflowRegistrar = _ts_decorate2([
1155
1185
  (0, import_common2.Injectable)(),
1156
1186
  _ts_param(2, (0, import_common2.Inject)(DURABLE_WORKER_RUNTIME)),
1157
- _ts_param(3, (0, import_common2.Inject)(import_nestjs_durable_core6.DURABLE_OPTIONS_CANONICAL)),
1187
+ _ts_param(3, (0, import_common2.Inject)(import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL)),
1188
+ _ts_param(4, (0, import_common2.Inject)(import_nestjs_durable_core7.WorkflowEngine)),
1158
1189
  _ts_metadata2("design:type", Function),
1159
1190
  _ts_metadata2("design:paramtypes", [
1160
1191
  typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
1161
1192
  typeof import_core.MetadataScanner === "undefined" ? Object : import_core.MetadataScanner,
1162
1193
  Object,
1163
- typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions
1194
+ typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions,
1195
+ typeof WorkflowStartClient === "undefined" ? Object : WorkflowStartClient
1164
1196
  ])
1165
1197
  ], ThinWorkflowRegistrar);
1166
1198
  var ThinStepRegistrar = class {
@@ -1186,7 +1218,7 @@ var ThinStepRegistrar = class {
1186
1218
  ThinStepRegistrar = _ts_decorate2([
1187
1219
  (0, import_common2.Injectable)(),
1188
1220
  _ts_param(2, (0, import_common2.Inject)(DURABLE_WORKER_RUNTIME)),
1189
- _ts_param(3, (0, import_common2.Inject)(import_nestjs_durable_core6.DURABLE_OPTIONS_CANONICAL)),
1221
+ _ts_param(3, (0, import_common2.Inject)(import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL)),
1190
1222
  _ts_metadata2("design:type", Function),
1191
1223
  _ts_metadata2("design:paramtypes", [
1192
1224
  typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
@@ -1203,18 +1235,25 @@ var ThinWorkerBootstrap = class {
1203
1235
  options;
1204
1236
  runRedisWorker;
1205
1237
  runnersSink;
1238
+ auth;
1206
1239
  runners = [];
1207
- constructor(runtime, options, runRedisWorker2, runnersSink) {
1240
+ constructor(runtime, options, runRedisWorker2, runnersSink, auth) {
1208
1241
  this.runtime = runtime;
1209
1242
  this.options = options;
1210
1243
  this.runRedisWorker = runRedisWorker2;
1211
1244
  this.runnersSink = runnersSink;
1245
+ this.auth = auth;
1212
1246
  }
1213
1247
  async onApplicationBootstrap() {
1214
1248
  const options = this.options;
1215
1249
  const runtime = this.runtime;
1216
1250
  if (runtime === null || !isPureThinWorker(options) || options.connection === void 0) return;
1217
- if (options.consumers === false) return;
1251
+ if (options.consumers === false) {
1252
+ if ((options.schedules?.length ?? 0) > 0) {
1253
+ console.warn("[nestjs-durable] `schedules` on a tenant with `consumers: false` are not announced: a tenant announces its schedules on its worker descriptor, so declare them on the processes that run its workers.");
1254
+ }
1255
+ return;
1256
+ }
1218
1257
  const handle = await this.runRedisWorker({
1219
1258
  runtime,
1220
1259
  connection: options.connection,
@@ -1229,7 +1268,10 @@ var ThinWorkerBootstrap = class {
1229
1268
  } : {},
1230
1269
  ...options.concurrency !== void 0 ? {
1231
1270
  concurrency: options.concurrency
1232
- } : {}
1271
+ } : {},
1272
+ // Announce the app's schedules (an empty list too) so the control plane adopts, updates and
1273
+ // withdraws them: a tenant has no store to fire them from.
1274
+ ...await tenantScheduleAnnouncement(options, this.auth.tenantToken)
1233
1275
  });
1234
1276
  this.runners.push(handle);
1235
1277
  this.runnersSink.push(handle);
@@ -1241,17 +1283,50 @@ var ThinWorkerBootstrap = class {
1241
1283
  ThinWorkerBootstrap = _ts_decorate2([
1242
1284
  (0, import_common2.Injectable)(),
1243
1285
  _ts_param(0, (0, import_common2.Inject)(DURABLE_WORKER_RUNTIME)),
1244
- _ts_param(1, (0, import_common2.Inject)(import_nestjs_durable_core6.DURABLE_OPTIONS_CANONICAL)),
1286
+ _ts_param(1, (0, import_common2.Inject)(import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL)),
1245
1287
  _ts_param(2, (0, import_common2.Inject)(RUN_REDIS_WORKER)),
1246
1288
  _ts_param(3, (0, import_common2.Inject)(DURABLE_WORKER_RUNNERS)),
1289
+ _ts_param(4, (0, import_common2.Inject)(TENANT_AUTH)),
1247
1290
  _ts_metadata2("design:type", Function),
1248
1291
  _ts_metadata2("design:paramtypes", [
1249
1292
  Object,
1250
1293
  typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions,
1251
1294
  typeof RunRedisWorkerFn === "undefined" ? Object : RunRedisWorkerFn,
1252
- Array
1295
+ Array,
1296
+ typeof ResolvedTenantAuth === "undefined" ? Object : ResolvedTenantAuth
1253
1297
  ])
1254
1298
  ], ThinWorkerBootstrap);
1299
+ async function tenantScheduleAnnouncement(options, tenantToken) {
1300
+ let tenant;
1301
+ try {
1302
+ tenant = tenantToken !== void 0 ? await (0, import_nestjs_durable_core7.resolveTenantToken)(tenantToken) : options.partition ?? "default";
1303
+ } catch (error) {
1304
+ console.warn(`[nestjs-durable] this worker announces no schedules: its tenantToken failed (${error instanceof Error ? error.message : String(error)})`);
1305
+ return {};
1306
+ }
1307
+ return {
1308
+ schedules: {
1309
+ tenant,
1310
+ items: (options.schedules ?? []).map(announcedSchedule)
1311
+ }
1312
+ };
1313
+ }
1314
+ __name(tenantScheduleAnnouncement, "tenantScheduleAnnouncement");
1315
+ function announcedSchedule(s) {
1316
+ const item = {
1317
+ key: s.key,
1318
+ workflow: (0, import_nestjs_durable_core7.workflowName)(s.workflow)
1319
+ };
1320
+ if (s.input !== void 0) item.input = s.input;
1321
+ if (s.everyMs !== void 0) item.everyMs = s.everyMs;
1322
+ if (s.cron !== void 0) item.cron = s.cron;
1323
+ if (s.timezone !== void 0) item.timezone = s.timezone;
1324
+ if (s.paused === true) item.paused = true;
1325
+ if (s.overlap !== void 0) item.overlap = s.overlap;
1326
+ if (s.jitter !== void 0 && s.jitter > 0) item.jitterMs = s.jitter;
1327
+ return item;
1328
+ }
1329
+ __name(announcedSchedule, "announcedSchedule");
1255
1330
  function thinWorkerProviders() {
1256
1331
  return [
1257
1332
  {
@@ -1271,7 +1346,7 @@ function thinWorkerProviders() {
1271
1346
  workflowGroup: options.partition ?? ""
1272
1347
  }) : null, "useFactory"),
1273
1348
  inject: [
1274
- import_nestjs_durable_core6.DURABLE_OPTIONS_CANONICAL
1349
+ import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL
1275
1350
  ]
1276
1351
  },
1277
1352
  {
@@ -1346,7 +1421,7 @@ var import_common13 = require("@nestjs/common");
1346
1421
  var import_core6 = require("@nestjs/core");
1347
1422
 
1348
1423
  // src/durable-step.registrar.ts
1349
- var import_nestjs_durable_core7 = require("@dudousxd/nestjs-durable-core");
1424
+ var import_nestjs_durable_core8 = require("@dudousxd/nestjs-durable-core");
1350
1425
  var import_common3 = require("@nestjs/common");
1351
1426
  var import_core2 = require("@nestjs/core");
1352
1427
 
@@ -1414,8 +1489,8 @@ var DurableStepRegistrar = class {
1414
1489
  };
1415
1490
  DurableStepRegistrar = _ts_decorate3([
1416
1491
  (0, import_common3.Injectable)(),
1417
- _ts_param2(2, (0, import_common3.Inject)(import_nestjs_durable_core7.TRANSPORT_CANONICAL)),
1418
- _ts_param2(3, (0, import_common3.Inject)(import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL)),
1492
+ _ts_param2(2, (0, import_common3.Inject)(import_nestjs_durable_core8.TRANSPORT_CANONICAL)),
1493
+ _ts_param2(3, (0, import_common3.Inject)(import_nestjs_durable_core8.DURABLE_OPTIONS_CANONICAL)),
1419
1494
  _ts_metadata3("design:type", Function),
1420
1495
  _ts_metadata3("design:paramtypes", [
1421
1496
  typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
@@ -1426,7 +1501,7 @@ DurableStepRegistrar = _ts_decorate3([
1426
1501
  ], DurableStepRegistrar);
1427
1502
 
1428
1503
  // src/entity.ts
1429
- var import_nestjs_durable_core8 = require("@dudousxd/nestjs-durable-core");
1504
+ var import_nestjs_durable_core9 = require("@dudousxd/nestjs-durable-core");
1430
1505
  var import_common4 = require("@nestjs/common");
1431
1506
  var import_reflect_metadata2 = require("reflect-metadata");
1432
1507
  function _ts_decorate4(decorators, target, key, desc) {
@@ -1509,12 +1584,12 @@ EntityService = _ts_decorate4([
1509
1584
  (0, import_common4.Injectable)(),
1510
1585
  _ts_metadata4("design:type", Function),
1511
1586
  _ts_metadata4("design:paramtypes", [
1512
- typeof import_nestjs_durable_core8.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core8.WorkflowEngine
1587
+ typeof import_nestjs_durable_core9.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core9.WorkflowEngine
1513
1588
  ])
1514
1589
  ], EntityService);
1515
1590
 
1516
1591
  // src/in-app-worker.ts
1517
- var import_nestjs_durable_core9 = require("@dudousxd/nestjs-durable-core");
1592
+ var import_nestjs_durable_core10 = require("@dudousxd/nestjs-durable-core");
1518
1593
  var import_common5 = require("@nestjs/common");
1519
1594
  var import_core3 = require("@nestjs/core");
1520
1595
  function _ts_decorate5(decorators, target, key, desc) {
@@ -1619,7 +1694,7 @@ var InAppWorkerBootstrap = class {
1619
1694
  };
1620
1695
  InAppWorkerBootstrap = _ts_decorate5([
1621
1696
  (0, import_common5.Injectable)(),
1622
- _ts_param3(2, (0, import_common5.Inject)(import_nestjs_durable_core9.DURABLE_OPTIONS_CANONICAL)),
1697
+ _ts_param3(2, (0, import_common5.Inject)(import_nestjs_durable_core10.DURABLE_OPTIONS_CANONICAL)),
1623
1698
  _ts_param3(3, (0, import_common5.Inject)(IN_APP_WORKER_RUNTIME)),
1624
1699
  _ts_param3(4, (0, import_common5.Inject)(IN_APP_RUN_REDIS_WORKER)),
1625
1700
  _ts_param3(5, (0, import_common5.Inject)(IN_APP_WORKER_RUNNERS)),
@@ -1639,8 +1714,8 @@ function inAppWorkerProviders() {
1639
1714
  provide: IN_APP_WORKER_BINDING,
1640
1715
  useFactory: /* @__PURE__ */ __name((transport, options) => inAppWorkerBinding(transport, options), "useFactory"),
1641
1716
  inject: [
1642
- import_nestjs_durable_core9.TRANSPORT_CANONICAL,
1643
- import_nestjs_durable_core9.DURABLE_OPTIONS_CANONICAL
1717
+ import_nestjs_durable_core10.TRANSPORT_CANONICAL,
1718
+ import_nestjs_durable_core10.DURABLE_OPTIONS_CANONICAL
1644
1719
  ]
1645
1720
  },
1646
1721
  {
@@ -1660,7 +1735,7 @@ function inAppWorkerProviders() {
1660
1735
  workflowGroup: options.partition ?? ""
1661
1736
  }) : null, "useFactory"),
1662
1737
  inject: [
1663
- import_nestjs_durable_core9.DURABLE_OPTIONS_CANONICAL
1738
+ import_nestjs_durable_core10.DURABLE_OPTIONS_CANONICAL
1664
1739
  ]
1665
1740
  },
1666
1741
  {
@@ -1677,11 +1752,11 @@ function inAppWorkerProviders() {
1677
1752
  __name(inAppWorkerProviders, "inAppWorkerProviders");
1678
1753
 
1679
1754
  // src/proxy-run-gateway.ts
1680
- var import_nestjs_durable_core11 = require("@dudousxd/nestjs-durable-core");
1755
+ var import_nestjs_durable_core12 = require("@dudousxd/nestjs-durable-core");
1681
1756
  var import_common6 = require("@nestjs/common");
1682
1757
 
1683
1758
  // src/run-request-responder.ts
1684
- var import_nestjs_durable_core10 = require("@dudousxd/nestjs-durable-core");
1759
+ var import_nestjs_durable_core11 = require("@dudousxd/nestjs-durable-core");
1685
1760
  var UNSUPPORTED_RUN_REQUEST = "unsupported-request";
1686
1761
  var BAD_RUN_REQUEST = "bad-request";
1687
1762
  var TENANT_REPUBLISH_MAX_LIMIT = 1e3;
@@ -1778,7 +1853,7 @@ var RunRequestResponder = class {
1778
1853
  });
1779
1854
  }
1780
1855
  async handle(wire) {
1781
- const tenant = await (0, import_nestjs_durable_core10.resolveWireTenant)(wire.tenant, this.verifyTenant);
1856
+ const tenant = await (0, import_nestjs_durable_core11.resolveWireTenant)(wire.tenant, this.verifyTenant);
1782
1857
  if (tenant === null) {
1783
1858
  return {
1784
1859
  requestId: wire.requestId,
@@ -2006,7 +2081,7 @@ var RunRequestResponder = class {
2006
2081
  };
2007
2082
  }
2008
2083
  if (body.kind === "republishLifecycle" && "runId" in body.target && run) {
2009
- const kind = (0, import_nestjs_durable_core10.lifecycleKindOf)(run.status);
2084
+ const kind = (0, import_nestjs_durable_core11.lifecycleKindOf)(run.status);
2010
2085
  const refused = kind ? await this.refuseSubscriber(run.workflow, kind, body.target.subscriber, msg.tenant) : void 0;
2011
2086
  if (refused) return badRequest(msg.requestId, refused);
2012
2087
  }
@@ -2072,7 +2147,7 @@ var RunRequestResponder = class {
2072
2147
  namespace: tenant
2073
2148
  });
2074
2149
  if (!links) return rest;
2075
- const kind = (0, import_nestjs_durable_core10.lifecycleKindOf)(detail.run.status);
2150
+ const kind = (0, import_nestjs_durable_core11.lifecycleKindOf)(detail.run.status);
2076
2151
  const subscribers = kind ? [
2077
2152
  ...new Set(links.startsOnSettle.filter((l) => l.kind === kind).map((l) => l.workflow))
2078
2153
  ] : [];
@@ -2249,12 +2324,12 @@ var ProxyRunGateway = class {
2249
2324
  } catch (err) {
2250
2325
  return Promise.reject(err);
2251
2326
  }
2252
- return send(filter ? (0, import_nestjs_durable_core11.scopeTenantQuery)(query, filter) : query);
2327
+ return send(filter ? (0, import_nestjs_durable_core12.scopeTenantQuery)(query, filter) : query);
2253
2328
  }
2254
2329
  /** `run` when the request may see it, else null (an invisible run reads like a missing one). */
2255
2330
  visible(run, filter = this.restrictive()) {
2256
2331
  if (!run) return null;
2257
- return !filter || (0, import_nestjs_durable_core11.tenantVisible)(run, filter) ? run : null;
2332
+ return !filter || (0, import_nestjs_durable_core12.tenantVisible)(run, filter) ? run : null;
2258
2333
  }
2259
2334
  /** Run a control call unless the request may not act on `runId` (then `null`, like a missing run).
2260
2335
  * Sent at once when nothing narrows the request. */
@@ -2290,7 +2365,7 @@ var ProxyRunGateway = class {
2290
2365
  request(body) {
2291
2366
  const source = this.tenantToken;
2292
2367
  if (typeof source !== "function") return this.send(source ?? this.tenant, body);
2293
- return (0, import_nestjs_durable_core11.resolveTenantToken)(source).then((tenant) => this.send(tenant, body));
2368
+ return (0, import_nestjs_durable_core12.resolveTenantToken)(source).then((tenant) => this.send(tenant, body));
2294
2369
  }
2295
2370
  send(tenant, body) {
2296
2371
  return new Promise((resolve, reject) => {
@@ -2340,12 +2415,12 @@ var ProxyRunGateway = class {
2340
2415
  if (detail && filter && !this.visible(detail.run, filter)) return null;
2341
2416
  const over = options?.summarizeFansOver;
2342
2417
  if (over === void 0 || !detail || detail.fans !== void 0) return detail;
2343
- const { timeline, fans } = (0, import_nestjs_durable_core11.summarizeTimeline)(detail.timeline, over);
2344
- const ids = (0, import_nestjs_durable_core11.childIdsOf)(detail.timeline);
2418
+ const { timeline, fans } = (0, import_nestjs_durable_core12.summarizeTimeline)(detail.timeline, over);
2419
+ const ids = (0, import_nestjs_durable_core12.childIdsOf)(detail.timeline);
2345
2420
  return {
2346
2421
  ...detail,
2347
2422
  timeline,
2348
- children: ids.slice(0, import_nestjs_durable_core11.SUMMARY_CHILD_LIMIT),
2423
+ children: ids.slice(0, import_nestjs_durable_core12.SUMMARY_CHILD_LIMIT),
2349
2424
  fans,
2350
2425
  childCount: ids.length
2351
2426
  };
@@ -2371,7 +2446,7 @@ var ProxyRunGateway = class {
2371
2446
  kind: "getRunDetail",
2372
2447
  runId
2373
2448
  });
2374
- return detail ? (0, import_nestjs_durable_core11.pageFan)(detail.timeline, group, query) : null;
2449
+ return detail ? (0, import_nestjs_durable_core12.pageFan)(detail.timeline, group, query) : null;
2375
2450
  }
2376
2451
  /**
2377
2452
  * The run alone, without its timeline. Read from the full detail when the control plane is too old
@@ -2538,7 +2613,7 @@ ProxyRunGateway = _ts_decorate6([
2538
2613
  ], ProxyRunGateway);
2539
2614
 
2540
2615
  // src/retention-poller.ts
2541
- var import_nestjs_durable_core13 = require("@dudousxd/nestjs-durable-core");
2616
+ var import_nestjs_durable_core14 = require("@dudousxd/nestjs-durable-core");
2542
2617
  var import_common8 = require("@nestjs/common");
2543
2618
 
2544
2619
  // src/settle-within.ts
@@ -2565,7 +2640,7 @@ async function settleWithin(p, timeoutMs) {
2565
2640
  __name(settleWithin, "settleWithin");
2566
2641
 
2567
2642
  // src/sweep-leases.ts
2568
- var import_nestjs_durable_core12 = require("@dudousxd/nestjs-durable-core");
2643
+ var import_nestjs_durable_core13 = require("@dudousxd/nestjs-durable-core");
2569
2644
  var import_common7 = require("@nestjs/common");
2570
2645
  var import_core4 = require("@nestjs/core");
2571
2646
  function _ts_decorate7(decorators, target, key, desc) {
@@ -2663,7 +2738,7 @@ SweepLeases = _ts_decorate7([
2663
2738
  (0, import_common7.Injectable)(),
2664
2739
  _ts_param4(0, (0, import_common7.Optional)()),
2665
2740
  _ts_param4(1, (0, import_common7.Optional)()),
2666
- _ts_param4(1, (0, import_common7.Inject)(import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL)),
2741
+ _ts_param4(1, (0, import_common7.Inject)(import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL)),
2667
2742
  _ts_metadata7("design:type", Function),
2668
2743
  _ts_metadata7("design:paramtypes", [
2669
2744
  typeof import_core4.ModuleRef === "undefined" ? Object : import_core4.ModuleRef,
@@ -2711,10 +2786,10 @@ function validateRetention(retention) {
2711
2786
  if (policy.maxAge == null && policy.maxCount == null) {
2712
2787
  throw new Error("durable retention: each policy must set maxAge and/or maxCount");
2713
2788
  }
2714
- if (policy.maxAge != null) (0, import_nestjs_durable_core13.parseDuration)(policy.maxAge);
2789
+ if (policy.maxAge != null) (0, import_nestjs_durable_core14.parseDuration)(policy.maxAge);
2715
2790
  for (const status of policy.statuses) {
2716
- if (!import_nestjs_durable_core13.TERMINAL_RUN_STATUSES.includes(status)) {
2717
- throw new Error(`durable retention: status "${status}" is not terminal; only ${import_nestjs_durable_core13.TERMINAL_RUN_STATUSES.join(", ")} can be pruned`);
2791
+ if (!import_nestjs_durable_core14.TERMINAL_RUN_STATUSES.includes(status)) {
2792
+ throw new Error(`durable retention: status "${status}" is not terminal; only ${import_nestjs_durable_core14.TERMINAL_RUN_STATUSES.join(", ")} can be pruned`);
2718
2793
  }
2719
2794
  const key = `${scopeKey}|${status}`;
2720
2795
  if (seen.has(key)) {
@@ -2768,7 +2843,7 @@ var RetentionPoller = class {
2768
2843
  return;
2769
2844
  }
2770
2845
  void this.sweep();
2771
- const intervalMs = retention.sweepInterval != null ? (0, import_nestjs_durable_core13.parseDuration)(retention.sweepInterval) : DEFAULT_SWEEP_INTERVAL_MS;
2846
+ const intervalMs = retention.sweepInterval != null ? (0, import_nestjs_durable_core14.parseDuration)(retention.sweepInterval) : DEFAULT_SWEEP_INTERVAL_MS;
2772
2847
  if (intervalMs > 0) {
2773
2848
  this.timer = setInterval(() => void this.sweep(), intervalMs);
2774
2849
  this.timer.unref?.();
@@ -2832,8 +2907,8 @@ var RetentionPoller = class {
2832
2907
  };
2833
2908
  RetentionPoller = _ts_decorate8([
2834
2909
  (0, import_common8.Injectable)(),
2835
- _ts_param5(0, (0, import_common8.Inject)(import_nestjs_durable_core13.STATE_STORE_CANONICAL)),
2836
- _ts_param5(1, (0, import_common8.Inject)(import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL)),
2910
+ _ts_param5(0, (0, import_common8.Inject)(import_nestjs_durable_core14.STATE_STORE_CANONICAL)),
2911
+ _ts_param5(1, (0, import_common8.Inject)(import_nestjs_durable_core14.DURABLE_OPTIONS_CANONICAL)),
2837
2912
  _ts_param5(2, (0, import_common8.Optional)()),
2838
2913
  _ts_metadata8("design:type", Function),
2839
2914
  _ts_metadata8("design:paramtypes", [
@@ -2844,7 +2919,7 @@ RetentionPoller = _ts_decorate8([
2844
2919
  ], RetentionPoller);
2845
2920
 
2846
2921
  // src/store-run-gateway.ts
2847
- var import_nestjs_durable_core14 = require("@dudousxd/nestjs-durable-core");
2922
+ var import_nestjs_durable_core15 = require("@dudousxd/nestjs-durable-core");
2848
2923
  var import_common9 = require("@nestjs/common");
2849
2924
  function _ts_decorate9(decorators, target, key, desc) {
2850
2925
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -2887,14 +2962,14 @@ function detailExtras(links) {
2887
2962
  }
2888
2963
  __name(detailExtras, "detailExtras");
2889
2964
  function withoutRegistry(query) {
2890
- if (query.workflow === import_nestjs_durable_core14.LIFECYCLE_REGISTRY_WORKFLOW || query.workflows?.includes(import_nestjs_durable_core14.LIFECYCLE_REGISTRY_WORKFLOW)) {
2965
+ if (query.workflow === import_nestjs_durable_core15.LIFECYCLE_REGISTRY_WORKFLOW || query.workflows?.includes(import_nestjs_durable_core15.LIFECYCLE_REGISTRY_WORKFLOW)) {
2891
2966
  return query;
2892
2967
  }
2893
2968
  return {
2894
2969
  ...query,
2895
2970
  excludeWorkflows: [
2896
2971
  ...query.excludeWorkflows ?? [],
2897
- import_nestjs_durable_core14.LIFECYCLE_REGISTRY_WORKFLOW
2972
+ import_nestjs_durable_core15.LIFECYCLE_REGISTRY_WORKFLOW
2898
2973
  ]
2899
2974
  };
2900
2975
  }
@@ -2945,10 +3020,10 @@ var StoreRunGateway = class {
2945
3020
  ...links
2946
3021
  };
2947
3022
  }
2948
- if ((0, import_nestjs_durable_core14.aggregatesCheckpoints)(this.store)) {
3023
+ if ((0, import_nestjs_durable_core15.aggregatesCheckpoints)(this.store)) {
2949
3024
  const stats = await this.store.checkpointStats(runId);
2950
- const etag = (0, import_nestjs_durable_core14.extendEtag)((0, import_nestjs_durable_core14.runDetailEtag)(run, stats, over), detailExtras(links));
2951
- if ((0, import_nestjs_durable_core14.etagMatches)(options?.ifNoneMatch, etag)) {
3025
+ const etag = (0, import_nestjs_durable_core15.extendEtag)((0, import_nestjs_durable_core15.runDetailEtag)(run, stats, over), detailExtras(links));
3026
+ if ((0, import_nestjs_durable_core15.etagMatches)(options?.ifNoneMatch, etag)) {
2952
3027
  return {
2953
3028
  run,
2954
3029
  timeline: [],
@@ -2959,18 +3034,18 @@ var StoreRunGateway = class {
2959
3034
  }
2960
3035
  return {
2961
3036
  run,
2962
- ...await (0, import_nestjs_durable_core14.summarizeRunFromStore)(this.store, runId, over, stats),
3037
+ ...await (0, import_nestjs_durable_core15.summarizeRunFromStore)(this.store, runId, over, stats),
2963
3038
  etag,
2964
3039
  ...links
2965
3040
  };
2966
3041
  }
2967
3042
  const full = await this.store.listCheckpoints(runId);
2968
- const { timeline, fans } = (0, import_nestjs_durable_core14.summarizeTimeline)(full, over);
2969
- const ids = (0, import_nestjs_durable_core14.childIdsOf)(full);
3043
+ const { timeline, fans } = (0, import_nestjs_durable_core15.summarizeTimeline)(full, over);
3044
+ const ids = (0, import_nestjs_durable_core15.childIdsOf)(full);
2970
3045
  return {
2971
3046
  run,
2972
3047
  timeline,
2973
- children: ids.slice(0, import_nestjs_durable_core14.SUMMARY_CHILD_LIMIT),
3048
+ children: ids.slice(0, import_nestjs_durable_core15.SUMMARY_CHILD_LIMIT),
2974
3049
  fans,
2975
3050
  childCount: ids.length,
2976
3051
  ...links
@@ -2985,24 +3060,24 @@ var StoreRunGateway = class {
2985
3060
  */
2986
3061
  async lifecycleLinks(run) {
2987
3062
  const triggered = await this.engine.triggeredRuns(run);
2988
- const source = (0, import_nestjs_durable_core14.lifecycleSourceOf)(run);
2989
- const kind = (0, import_nestjs_durable_core14.lifecycleKindOf)(run.status);
3063
+ const source = (0, import_nestjs_durable_core15.lifecycleSourceOf)(run);
3064
+ const kind = (0, import_nestjs_durable_core15.lifecycleKindOf)(run.status);
2990
3065
  const subscribers = kind ? await this.engine.lifecycleSubscribers(run.workflow, kind, run.namespace || "default") : [];
2991
3066
  const workflowLifecycle = await this.engine.workflowLifecycle(run.workflow);
2992
3067
  const linked = workflowLifecycle.startsOnSettle.length > 0 || workflowLifecycle.startedBy.length > 0;
2993
- const deliveries = kind ? (0, import_nestjs_durable_core14.lifecycleDeliveriesOf)(run, {
3068
+ const deliveries = kind ? (0, import_nestjs_durable_core15.lifecycleDeliveriesOf)(run, {
2994
3069
  subscribers,
2995
3070
  live: new Set(subscribers),
2996
3071
  coalesced: this.engine.coalescedSubscribers(run)
2997
3072
  }) : [];
2998
3073
  const [own, onIt] = await Promise.all([
2999
- run.status === "suspended" ? (0, import_nestjs_durable_core14.listSignalWaitersOfRuns)(this.store, [
3074
+ run.status === "suspended" ? (0, import_nestjs_durable_core15.listSignalWaitersOfRuns)(this.store, [
3000
3075
  run.id
3001
3076
  ]) : [],
3002
- run.workflow.startsWith("__") ? [] : this.store.listSignalWaiters((0, import_nestjs_durable_core14.runWaitPrefix)(run.id))
3077
+ run.workflow.startsWith("__") ? [] : this.store.listSignalWaiters((0, import_nestjs_durable_core15.runWaitPrefix)(run.id))
3003
3078
  ]);
3004
3079
  const waitsFor = own.flatMap((w) => {
3005
- const target = (0, import_nestjs_durable_core14.runWaitTargetOf)(w);
3080
+ const target = (0, import_nestjs_durable_core15.runWaitTargetOf)(w);
3006
3081
  return target !== void 0 ? [
3007
3082
  {
3008
3083
  runId: target,
@@ -3010,14 +3085,14 @@ var StoreRunGateway = class {
3010
3085
  }
3011
3086
  ] : [];
3012
3087
  });
3013
- const awaitedBy = onIt.filter((w) => (0, import_nestjs_durable_core14.runWaitTargetOf)(w) === run.id).map((w) => ({
3088
+ const awaitedBy = onIt.filter((w) => (0, import_nestjs_durable_core15.runWaitTargetOf)(w) === run.id).map((w) => ({
3014
3089
  runId: w.runId,
3015
3090
  seq: w.seq
3016
3091
  }));
3017
3092
  const started = deliveries.flatMap((d) => d.state === "started" && d.runId !== void 0 ? [
3018
3093
  d.runId
3019
3094
  ] : []);
3020
- const { runs } = await (0, import_nestjs_durable_core14.readRunsByIds)(this.store, [
3095
+ const { runs } = await (0, import_nestjs_durable_core15.readRunsByIds)(this.store, [
3021
3096
  ...source ? [
3022
3097
  source.runId
3023
3098
  ] : [],
@@ -3034,7 +3109,7 @@ var StoreRunGateway = class {
3034
3109
  } : link;
3035
3110
  }, "withRun");
3036
3111
  const sourceRun = source ? runs.get(source.runId) : void 0;
3037
- const traceId = (0, import_nestjs_durable_core14.traceIdOfTraceparent)((0, import_nestjs_durable_core14.lifecycleTraceparentOf)(sourceRun?.tags));
3112
+ const traceId = (0, import_nestjs_durable_core15.traceIdOfTraceparent)((0, import_nestjs_durable_core15.lifecycleTraceparentOf)(sourceRun?.tags));
3038
3113
  return {
3039
3114
  ...triggered.length > 0 ? {
3040
3115
  triggered
@@ -3079,12 +3154,12 @@ var StoreRunGateway = class {
3079
3154
  }
3080
3155
  async getFanMembers(runId, group, query) {
3081
3156
  if (!await this.visibleRun(runId)) return null;
3082
- if ((0, import_nestjs_durable_core14.aggregatesCheckpoints)(this.store)) {
3157
+ if ((0, import_nestjs_durable_core15.aggregatesCheckpoints)(this.store)) {
3083
3158
  const stats = await this.store.checkpointStats(runId, {
3084
3159
  group
3085
3160
  });
3086
- const etag = (0, import_nestjs_durable_core14.fanPageEtag)(group, stats, query);
3087
- if ((0, import_nestjs_durable_core14.etagMatches)(query.ifNoneMatch, etag)) {
3161
+ const etag = (0, import_nestjs_durable_core15.fanPageEtag)(group, stats, query);
3162
+ if ((0, import_nestjs_durable_core15.etagMatches)(query.ifNoneMatch, etag)) {
3088
3163
  return {
3089
3164
  items: [],
3090
3165
  total: 0,
@@ -3093,17 +3168,17 @@ var StoreRunGateway = class {
3093
3168
  };
3094
3169
  }
3095
3170
  return {
3096
- ...await (0, import_nestjs_durable_core14.pageFanFromStore)(this.store, runId, group, query, stats),
3171
+ ...await (0, import_nestjs_durable_core15.pageFanFromStore)(this.store, runId, group, query, stats),
3097
3172
  etag
3098
3173
  };
3099
3174
  }
3100
- return (0, import_nestjs_durable_core14.pageFan)(await this.store.listCheckpoints(runId), group, query);
3175
+ return (0, import_nestjs_durable_core15.pageFan)(await this.store.listCheckpoints(runId), group, query);
3101
3176
  }
3102
3177
  async listRuns(query) {
3103
3178
  const runs = await this.store.listRuns(this.scoped(withoutRegistry(query)));
3104
- const waiterByRun = (0, import_nestjs_durable_core14.indexWaitersByRun)(await (0, import_nestjs_durable_core14.listSignalWaitersOfRuns)(this.store, runs.filter((run) => run.status === "suspended").map((run) => run.id)));
3179
+ const waiterByRun = (0, import_nestjs_durable_core15.indexWaitersByRun)(await (0, import_nestjs_durable_core15.listSignalWaitersOfRuns)(this.store, runs.filter((run) => run.status === "suspended").map((run) => run.id)));
3105
3180
  return runs.map((run) => {
3106
- const waiting = (0, import_nestjs_durable_core14.resolveRunWaiting)(run, waiterByRun);
3181
+ const waiting = (0, import_nestjs_durable_core15.resolveRunWaiting)(run, waiterByRun);
3107
3182
  return waiting ? {
3108
3183
  ...run,
3109
3184
  waiting
@@ -3120,7 +3195,7 @@ var StoreRunGateway = class {
3120
3195
  const scoped = this.scoped(withoutRegistry(query));
3121
3196
  if (this.store.runFacets) return this.store.runFacets(scoped);
3122
3197
  const runs = await this.store.listRuns(scoped);
3123
- return (0, import_nestjs_durable_core14.mergeRunFacetRows)(runs.map((r) => ({
3198
+ return (0, import_nestjs_durable_core15.mergeRunFacetRows)(runs.map((r) => ({
3124
3199
  status: r.status,
3125
3200
  origin: r.origin,
3126
3201
  count: 1
@@ -3155,13 +3230,13 @@ var StoreRunGateway = class {
3155
3230
  "suspended"
3156
3231
  ]
3157
3232
  })),
3158
- (0, import_nestjs_durable_core14.listSignalWaitersOfRuns)(this.store, runIds)
3233
+ (0, import_nestjs_durable_core15.listSignalWaitersOfRuns)(this.store, runIds)
3159
3234
  ]);
3160
- const waiterByRun = (0, import_nestjs_durable_core14.indexWaitersByRun)(waiters);
3235
+ const waiterByRun = (0, import_nestjs_durable_core15.indexWaitersByRun)(waiters);
3161
3236
  const result = {};
3162
3237
  for (const run of suspended) {
3163
3238
  if (!idSet.has(run.id)) continue;
3164
- const waiting = (0, import_nestjs_durable_core14.resolveRunWaiting)(run, waiterByRun);
3239
+ const waiting = (0, import_nestjs_durable_core15.resolveRunWaiting)(run, waiterByRun);
3165
3240
  if (waiting) result[run.id] = waiting;
3166
3241
  }
3167
3242
  return result;
@@ -3253,11 +3328,11 @@ var StoreRunGateway = class {
3253
3328
  };
3254
3329
  StoreRunGateway = _ts_decorate9([
3255
3330
  (0, import_common9.Injectable)(),
3256
- _ts_param6(0, (0, import_common9.Inject)(import_nestjs_durable_core14.STATE_STORE_CANONICAL)),
3331
+ _ts_param6(0, (0, import_common9.Inject)(import_nestjs_durable_core15.STATE_STORE_CANONICAL)),
3257
3332
  _ts_metadata9("design:type", Function),
3258
3333
  _ts_metadata9("design:paramtypes", [
3259
3334
  typeof StateStore === "undefined" ? Object : StateStore,
3260
- typeof import_nestjs_durable_core14.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core14.WorkflowEngine
3335
+ typeof import_nestjs_durable_core15.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core15.WorkflowEngine
3261
3336
  ])
3262
3337
  ], StoreRunGateway);
3263
3338
 
@@ -3304,7 +3379,7 @@ var TenantEventRepublisher = class {
3304
3379
 
3305
3380
  // src/timer-poller.ts
3306
3381
  var durableCore = __toESM(require("@dudousxd/nestjs-durable-core"), 1);
3307
- var import_nestjs_durable_core15 = require("@dudousxd/nestjs-durable-core");
3382
+ var import_nestjs_durable_core16 = require("@dudousxd/nestjs-durable-core");
3308
3383
  var import_common10 = require("@nestjs/common");
3309
3384
  function _ts_decorate10(decorators, target, key, desc) {
3310
3385
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3355,13 +3430,15 @@ var TimerPoller = class {
3355
3430
  endWait;
3356
3431
  /** When the owed-lifecycle listing last succeeded (see {@link owedSweepDue}). */
3357
3432
  owedSweptAt;
3433
+ /** When the tenant schedule announcements were last reconciled (see {@link announcedSchedules}). */
3434
+ announcedSyncedAt;
3358
3435
  constructor(engine, options, leases = new SweepLeases()) {
3359
3436
  this.engine = engine;
3360
3437
  this.options = options;
3361
3438
  this.leases = leases;
3362
3439
  }
3363
3440
  async onApplicationBootstrap() {
3364
- for (const s of this.options.schedules ?? []) (0, import_nestjs_durable_core15.workflowName)(s.workflow);
3441
+ for (const s of this.options.schedules ?? []) (0, import_nestjs_durable_core16.workflowName)(s.workflow);
3365
3442
  if (!isDrivingOperator(this.options)) return;
3366
3443
  this.engine.consumeRuns?.();
3367
3444
  this.unsubscribeEnqueued = this.engine.onEnqueued((runId) => {
@@ -3444,7 +3521,8 @@ var TimerPoller = class {
3444
3521
  try {
3445
3522
  const now = Date.now();
3446
3523
  const stored = await this.engine.nextDueAt(now + wait, {
3447
- persistedSchedules: this.options.persistedSchedules === true
3524
+ persistedSchedules: this.options.persistedSchedules === true,
3525
+ announcedSchedules: this.announcedSchedules() !== void 0
3448
3526
  });
3449
3527
  const schedules = this.options.schedules;
3450
3528
  const scheduled = schedules && schedules.length > 0 && nextScheduleFireAt2 ? nextScheduleFireAt2(this.engine, schedules, now) : void 0;
@@ -3461,6 +3539,22 @@ var TimerPoller = class {
3461
3539
  }
3462
3540
  }
3463
3541
  /**
3542
+ * The tenant schedule adoption settings when it is on (see
3543
+ * {@link DurableModuleOptions.announcedSchedules}), else undefined: off by option, on a core
3544
+ * without it, or on a store that does not persist schedules.
3545
+ */
3546
+ announcedSchedules() {
3547
+ const option = this.options.announcedSchedules;
3548
+ if (option === false) return void 0;
3549
+ if (typeof this.engine.syncAnnouncedSchedules !== "function") return void 0;
3550
+ if (this.engine.schedules?.supported !== true) return void 0;
3551
+ const settings = typeof option === "object" ? option : {};
3552
+ return {
3553
+ syncMs: settings.syncMs ?? 15e3,
3554
+ graceMs: settings.graceMs
3555
+ };
3556
+ }
3557
+ /**
3464
3558
  * Whether this poll lists the owed lifecycle runs: until a sweep that listed them succeeded, then
3465
3559
  * once per `owedLifecycleSweepMs` (a clock that went back lists them again).
3466
3560
  */
@@ -3541,10 +3635,29 @@ var TimerPoller = class {
3541
3635
  }));
3542
3636
  const schedules = this.options.schedules;
3543
3637
  if (schedules && schedules.length > 0) {
3544
- note(await this.sweep("schedules", () => (0, import_nestjs_durable_core15.runSchedules)(this.engine, schedules, Date.now())));
3638
+ note(await this.sweep("schedules", () => (0, import_nestjs_durable_core16.runSchedules)(this.engine, schedules, Date.now())));
3639
+ }
3640
+ const announced = this.announcedSchedules();
3641
+ if (announced) {
3642
+ const at = Date.now();
3643
+ const last = this.announcedSyncedAt;
3644
+ if (last === void 0 || at < last || at - last >= announced.syncMs) {
3645
+ await this.sweep("announcedSchedules", () => this.leases.run("announced-schedules", async () => {
3646
+ await this.engine.syncAnnouncedSchedules({
3647
+ ...announced.graceMs !== void 0 ? {
3648
+ graceMs: announced.graceMs
3649
+ } : {}
3650
+ });
3651
+ this.announcedSyncedAt = at;
3652
+ }));
3653
+ }
3545
3654
  }
3546
3655
  if (this.options.persistedSchedules) {
3547
3656
  note(await this.sweep("persistedSchedules", () => this.engine.schedules.tick()));
3657
+ } else if (announced) {
3658
+ note(await this.sweep("announcedScheduleFires", () => this.engine.schedules.tick(Date.now(), {
3659
+ tag: import_nestjs_durable_core16.ANNOUNCED_SCHEDULE_TAG
3660
+ })));
3548
3661
  }
3549
3662
  return worked;
3550
3663
  }
@@ -3560,21 +3673,16 @@ var TimerPoller = class {
3560
3673
  };
3561
3674
  TimerPoller = _ts_decorate10([
3562
3675
  (0, import_common10.Injectable)(),
3563
- _ts_param7(1, (0, import_common10.Inject)(import_nestjs_durable_core15.DURABLE_OPTIONS_CANONICAL)),
3676
+ _ts_param7(1, (0, import_common10.Inject)(import_nestjs_durable_core16.DURABLE_OPTIONS_CANONICAL)),
3564
3677
  _ts_param7(2, (0, import_common10.Optional)()),
3565
3678
  _ts_metadata10("design:type", Function),
3566
3679
  _ts_metadata10("design:paramtypes", [
3567
- typeof import_nestjs_durable_core15.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core15.WorkflowEngine,
3680
+ typeof import_nestjs_durable_core16.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core16.WorkflowEngine,
3568
3681
  typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions,
3569
3682
  typeof SweepLeases === "undefined" ? Object : SweepLeases
3570
3683
  ])
3571
3684
  ], TimerPoller);
3572
3685
 
3573
- // src/tokens.ts
3574
- var import_nestjs_durable_core16 = require("@dudousxd/nestjs-durable-core");
3575
- var CONTEXT_ACCESSOR = Symbol.for("@dudousxd/nestjs-context:accessor");
3576
- var RUN_GATEWAY = import_nestjs_durable_core16.RunGateway;
3577
-
3578
3686
  // src/workflow.registrar.ts
3579
3687
  var import_nestjs_durable_core17 = require("@dudousxd/nestjs-durable-core");
3580
3688
  var import_common11 = require("@nestjs/common");
@@ -4093,7 +4201,6 @@ function resolveTopologyPreset(options) {
4093
4201
  };
4094
4202
  }
4095
4203
  __name(resolveTopologyPreset, "resolveTopologyPreset");
4096
- var TENANT_AUTH = Symbol("nestjs-durable:tenant-auth");
4097
4204
  var RunGatewayBootstrap = class RunGatewayBootstrap2 {
4098
4205
  static {
4099
4206
  __name(this, "RunGatewayBootstrap");
@@ -4717,6 +4824,7 @@ var import_nestjs_durable_core21 = require("@dudousxd/nestjs-durable-core");
4717
4824
  Step,
4718
4825
  StepInterceptor,
4719
4826
  StoreRunGateway,
4827
+ TENANT_AUTH,
4720
4828
  TENANT_REPUBLISH_MAX_LIMIT,
4721
4829
  TenantEventRepublisher,
4722
4830
  ThinStepRegistrar,
@@ -4752,6 +4860,7 @@ var import_nestjs_durable_core21 = require("@dudousxd/nestjs-durable-core");
4752
4860
  scheduleRunIdAt,
4753
4861
  scheduledRunId,
4754
4862
  signTenantToken,
4863
+ tenantScheduleAnnouncement,
4755
4864
  thinWorkerProviders,
4756
4865
  triggeredRunsOf,
4757
4866
  unavailableRunGateway