@dudousxd/nestjs-durable 0.27.0 → 0.28.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
@@ -40,6 +40,7 @@ __export(index_exports, {
40
40
  InAppWorkerBootstrap: () => InAppWorkerBootstrap,
41
41
  ON_EVENT_METADATA: () => ON_EVENT_METADATA,
42
42
  On: () => On,
43
+ OnDurableEvent: () => OnDurableEvent,
43
44
  OnEvent: () => OnEvent,
44
45
  ProxyRunGateway: () => ProxyRunGateway,
45
46
  RUN_GATEWAY: () => RUN_GATEWAY,
@@ -155,7 +156,7 @@ function isDeadLetterHandler(method) {
155
156
  }
156
157
  __name(isDeadLetterHandler, "isDeadLetterHandler");
157
158
  var ON_EVENT_METADATA = Symbol("nestjs-durable:on-event");
158
- function OnEvent(...events) {
159
+ function OnDurableEvent(...events) {
159
160
  return (target) => {
160
161
  const existing = Reflect.getMetadata(ON_EVENT_METADATA, target) ?? [];
161
162
  Reflect.defineMetadata(ON_EVENT_METADATA, [
@@ -164,7 +165,8 @@ function OnEvent(...events) {
164
165
  ], target);
165
166
  };
166
167
  }
167
- __name(OnEvent, "OnEvent");
168
+ __name(OnDurableEvent, "OnDurableEvent");
169
+ var OnEvent = OnDurableEvent;
168
170
  function getOnEvents(meta, target) {
169
171
  const fromDecorator = Reflect.getMetadata(ON_EVENT_METADATA, target) ?? [];
170
172
  return [
@@ -1488,6 +1490,10 @@ var WorkflowRegistrar = class {
1488
1490
  executor: new import_nestjs_durable_core10.RemoteWorkflowExecutor(this.inAppWorker.transport, meta.name, this.inAppWorker.partition)
1489
1491
  } : {}
1490
1492
  });
1493
+ (0, import_nestjs_durable_core10.bindWorkflowClass)(workflowCtor, {
1494
+ start: /* @__PURE__ */ __name((name, input, runId, opts) => this.engine.start(name, input, runId, opts), "start"),
1495
+ waitForRun: /* @__PURE__ */ __name((runId, opts) => this.engine.waitForRun(runId, opts), "waitForRun")
1496
+ });
1491
1497
  const inline = this.findDeadLetterHandler(workflow);
1492
1498
  if (inline && meta.deadLetterWorkflow) {
1493
1499
  throw new Error(`@Workflow ${meta.name} declares both an inline @DeadLetter() method and a deadLetterWorkflow option. Use one: the inline handler, or the reference.`);
@@ -1604,7 +1610,7 @@ var WorkflowService = class {
1604
1610
  }
1605
1611
  /**
1606
1612
  * Publish a named event. Resumes runs waiting on it via `ctx.waitForEvent(name, { match })` and
1607
- * starts a fresh run of every workflow subscribed via `@Workflow({ onEvent })` / `@OnEvent` (the
1613
+ * starts a fresh run of every workflow subscribed via `@Workflow({ onEvent })` / `@OnDurableEvent` (the
1608
1614
  * payload becomes its input). Pass `opts.id` to dedupe redeliveries. Returns how many runs it
1609
1615
  * touched (resumed + started).
1610
1616
  */
@@ -1939,6 +1945,7 @@ DurableModule = _ts_decorate12([
1939
1945
  InAppWorkerBootstrap,
1940
1946
  ON_EVENT_METADATA,
1941
1947
  On,
1948
+ OnDurableEvent,
1942
1949
  OnEvent,
1943
1950
  ProxyRunGateway,
1944
1951
  RUN_GATEWAY,