@dudousxd/nestjs-durable 0.62.0 → 0.63.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
@@ -842,6 +842,19 @@ var DurableStartClient = class {
842
842
  ...opts?.searchAttributes !== void 0 ? {
843
843
  searchAttributes: opts.searchAttributes
844
844
  } : {},
845
+ // The start options the control plane applies (version pin, priority, delayed start, quota).
846
+ ...opts?.version !== void 0 ? {
847
+ version: opts.version
848
+ } : {},
849
+ ...opts?.priority !== void 0 ? {
850
+ priority: opts.priority
851
+ } : {},
852
+ ...opts?.startAt !== void 0 ? {
853
+ startAt: opts.startAt
854
+ } : {},
855
+ ...opts?.concurrency !== void 0 ? {
856
+ concurrency: opts.concurrency
857
+ } : {},
845
858
  ...tenant ? {
846
859
  tenantId: tenant.id,
847
860
  ...tenant.kind !== void 0 ? {
@@ -852,9 +865,10 @@ var DurableStartClient = class {
852
865
  deps: this.deps
853
866
  } : {}
854
867
  });
868
+ const startAtMs = opts?.startAt instanceof Date ? opts.startAt.getTime() : opts?.startAt;
855
869
  return {
856
870
  runId,
857
- status: "pending"
871
+ status: startAtMs !== void 0 && Number.isFinite(startAtMs) && startAtMs > Date.now() ? "suspended" : "pending"
858
872
  };
859
873
  }
860
874
  cancel(_runId) {
@@ -1139,28 +1153,38 @@ var ThinWorkflowRegistrar = class {
1139
1153
  metadataScanner;
1140
1154
  runtime;
1141
1155
  options;
1142
- constructor(discovery, metadataScanner, runtime, options) {
1156
+ starter;
1157
+ constructor(discovery, metadataScanner, runtime, options, starter) {
1143
1158
  this.discovery = discovery;
1144
1159
  this.metadataScanner = metadataScanner;
1145
1160
  this.runtime = runtime;
1146
1161
  this.options = options;
1162
+ this.starter = starter;
1147
1163
  }
1148
1164
  onModuleInit() {
1149
1165
  const runtime = this.runtime;
1150
1166
  if (runtime === null || !isPureThinWorker(this.options)) return;
1151
- scanWorkflows(this.discovery, (meta, instance, origin) => registerOnRuntime(runtime, this.metadataScanner, meta, instance, origin));
1167
+ const starter = this.starter;
1168
+ scanWorkflows(this.discovery, (meta, instance, origin) => {
1169
+ registerOnRuntime(runtime, this.metadataScanner, meta, instance, origin);
1170
+ (0, import_nestjs_durable_core6.bindWorkflowClass)(instance.constructor, {
1171
+ start: /* @__PURE__ */ __name((name, input, runId, opts) => starter.start(name, input, runId, opts), "start")
1172
+ });
1173
+ });
1152
1174
  }
1153
1175
  };
1154
1176
  ThinWorkflowRegistrar = _ts_decorate2([
1155
1177
  (0, import_common2.Injectable)(),
1156
1178
  _ts_param(2, (0, import_common2.Inject)(DURABLE_WORKER_RUNTIME)),
1157
1179
  _ts_param(3, (0, import_common2.Inject)(import_nestjs_durable_core6.DURABLE_OPTIONS_CANONICAL)),
1180
+ _ts_param(4, (0, import_common2.Inject)(import_nestjs_durable_core6.WorkflowEngine)),
1158
1181
  _ts_metadata2("design:type", Function),
1159
1182
  _ts_metadata2("design:paramtypes", [
1160
1183
  typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
1161
1184
  typeof import_core.MetadataScanner === "undefined" ? Object : import_core.MetadataScanner,
1162
1185
  Object,
1163
- typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions
1186
+ typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions,
1187
+ typeof WorkflowStartClient === "undefined" ? Object : WorkflowStartClient
1164
1188
  ])
1165
1189
  ], ThinWorkflowRegistrar);
1166
1190
  var ThinStepRegistrar = class {