@dudousxd/nestjs-durable 0.28.0 → 0.29.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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { StepError, WorkflowRef, SingletonConfig, StateStore, Transport, NamedTransport, ControlPlane, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowClass, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, RunDetail, RunQuery, WorkflowRun, EngineEvent, RunRequest, RunReply, StepInvocation, TenantEvent } from '@dudousxd/nestjs-durable-core';
1
+ import { StepError, WorkflowRef, SingletonConfig, StateStore, Transport, NamedTransport, ControlPlane, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowClass, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, RunDetail, RunQuery, WorkflowRun, GroupHealth, EngineEvent, RunRequest, RunReply, StepInvocation, TenantEvent } from '@dudousxd/nestjs-durable-core';
2
2
  import { z } from 'zod';
3
3
  import { ConcurrencyOption, StartRunDeps, RunRedisWorkerOptions, RunningWorker, DurableWorkerRuntime } from '@dudousxd/durable-worker';
4
4
  import { DynamicModule, InjectionToken, OnModuleInit, OnApplicationBootstrap, OnApplicationShutdown, Provider } from '@nestjs/common';
@@ -717,6 +717,8 @@ declare class ProxyRunGateway implements RunGateway {
717
717
  private request;
718
718
  getRunDetail(runId: string): Promise<RunDetail | null>;
719
719
  listRuns(query: RunQuery): Promise<WorkflowRun[]>;
720
+ /** Round-trips to the operator, which scopes the result to this tenant's own `@<tenant>` groups. */
721
+ workerHealth(): Promise<GroupHealth[]>;
720
722
  cancel(runId: string, opts?: {
721
723
  compensate?: boolean;
722
724
  }): Promise<RunResult | null>;
@@ -801,6 +803,9 @@ declare class StoreRunGateway implements RunGateway {
801
803
  constructor(store: StateStore, engine: WorkflowEngine);
802
804
  getRunDetail(runId: string): Promise<RunDetail | null>;
803
805
  listRuns(query: RunQuery): Promise<WorkflowRun[]>;
806
+ /** Every group the engine knows about — unscoped. A tenant proxy's request is scoped by the
807
+ * `RunRequestResponder` (to the requester's `@<tenant>` groups); the operator's own UI sees all. */
808
+ workerHealth(): Promise<GroupHealth[]>;
804
809
  cancel(runId: string, opts?: {
805
810
  compensate?: boolean;
806
811
  }): Promise<RunResult | null>;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { StepError, WorkflowRef, SingletonConfig, StateStore, Transport, NamedTransport, ControlPlane, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowClass, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, RunDetail, RunQuery, WorkflowRun, EngineEvent, RunRequest, RunReply, StepInvocation, TenantEvent } from '@dudousxd/nestjs-durable-core';
1
+ import { StepError, WorkflowRef, SingletonConfig, StateStore, Transport, NamedTransport, ControlPlane, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowClass, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, RunDetail, RunQuery, WorkflowRun, GroupHealth, EngineEvent, RunRequest, RunReply, StepInvocation, TenantEvent } from '@dudousxd/nestjs-durable-core';
2
2
  import { z } from 'zod';
3
3
  import { ConcurrencyOption, StartRunDeps, RunRedisWorkerOptions, RunningWorker, DurableWorkerRuntime } from '@dudousxd/durable-worker';
4
4
  import { DynamicModule, InjectionToken, OnModuleInit, OnApplicationBootstrap, OnApplicationShutdown, Provider } from '@nestjs/common';
@@ -717,6 +717,8 @@ declare class ProxyRunGateway implements RunGateway {
717
717
  private request;
718
718
  getRunDetail(runId: string): Promise<RunDetail | null>;
719
719
  listRuns(query: RunQuery): Promise<WorkflowRun[]>;
720
+ /** Round-trips to the operator, which scopes the result to this tenant's own `@<tenant>` groups. */
721
+ workerHealth(): Promise<GroupHealth[]>;
720
722
  cancel(runId: string, opts?: {
721
723
  compensate?: boolean;
722
724
  }): Promise<RunResult | null>;
@@ -801,6 +803,9 @@ declare class StoreRunGateway implements RunGateway {
801
803
  constructor(store: StateStore, engine: WorkflowEngine);
802
804
  getRunDetail(runId: string): Promise<RunDetail | null>;
803
805
  listRuns(query: RunQuery): Promise<WorkflowRun[]>;
806
+ /** Every group the engine knows about — unscoped. A tenant proxy's request is scoped by the
807
+ * `RunRequestResponder` (to the requester's `@<tenant>` groups); the operator's own UI sees all. */
808
+ workerHealth(): Promise<GroupHealth[]>;
804
809
  cancel(runId: string, opts?: {
805
810
  compensate?: boolean;
806
811
  }): Promise<RunResult | null>;
package/dist/index.js CHANGED
@@ -430,6 +430,9 @@ function unavailableRunGateway() {
430
430
  listRuns(_query) {
431
431
  return tenantGatewayUnavailable("listRuns");
432
432
  },
433
+ workerHealth() {
434
+ return tenantGatewayUnavailable("workerHealth");
435
+ },
433
436
  cancel(_runId) {
434
437
  return tenantGatewayUnavailable("cancel");
435
438
  },
@@ -827,6 +830,12 @@ var ProxyRunGateway = class {
827
830
  query
828
831
  });
829
832
  }
833
+ /** Round-trips to the operator, which scopes the result to this tenant's own `@<tenant>` groups. */
834
+ workerHealth() {
835
+ return this.request({
836
+ kind: "workerHealth"
837
+ });
838
+ }
830
839
  cancel(runId, opts) {
831
840
  return this.request(opts === void 0 ? {
832
841
  kind: "cancel",
@@ -1023,6 +1032,17 @@ var RunRequestResponder = class {
1023
1032
  }
1024
1033
  };
1025
1034
  }
1035
+ if (body.kind === "workerHealth") {
1036
+ const all = await this.gateway.workerHealth();
1037
+ const data = all.filter((h) => h.group.endsWith(`@${msg.tenant}`));
1038
+ return {
1039
+ requestId: msg.requestId,
1040
+ result: {
1041
+ ok: true,
1042
+ data
1043
+ }
1044
+ };
1045
+ }
1026
1046
  const detail = await this.gateway.getRunDetail(body.runId);
1027
1047
  if (detail && detail.run.namespace !== msg.tenant) {
1028
1048
  return {
@@ -1126,6 +1146,11 @@ var StoreRunGateway = class {
1126
1146
  listRuns(query) {
1127
1147
  return this.store.listRuns(query);
1128
1148
  }
1149
+ /** Every group the engine knows about — unscoped. A tenant proxy's request is scoped by the
1150
+ * `RunRequestResponder` (to the requester's `@<tenant>` groups); the operator's own UI sees all. */
1151
+ workerHealth() {
1152
+ return this.engine.workerHealth();
1153
+ }
1129
1154
  cancel(runId, opts) {
1130
1155
  return this.engine.cancel(runId, opts);
1131
1156
  }