@dudousxd/nestjs-durable 0.29.0 → 0.30.1
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 +29 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +30 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
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,
|
|
1
|
+
import { StepError, WorkflowRef, SingletonConfig, StateStore, Transport, NamedTransport, ControlPlane, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowClass, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, DurableTopology, RunDetail, RunQuery, RunListItem, 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';
|
|
@@ -715,8 +715,11 @@ declare class ProxyRunGateway implements RunGateway {
|
|
|
715
715
|
constructor(transport: Transport, tenant: string, timeoutMs?: number);
|
|
716
716
|
private handleReply;
|
|
717
717
|
private request;
|
|
718
|
+
topology(): DurableTopology;
|
|
718
719
|
getRunDetail(runId: string): Promise<RunDetail | null>;
|
|
719
|
-
|
|
720
|
+
/** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
|
|
721
|
+
* it through as plain JSON, so a tenant's list rows name the wait too. */
|
|
722
|
+
listRuns(query: RunQuery): Promise<RunListItem[]>;
|
|
720
723
|
/** Round-trips to the operator, which scopes the result to this tenant's own `@<tenant>` groups. */
|
|
721
724
|
workerHealth(): Promise<GroupHealth[]>;
|
|
722
725
|
cancel(runId: string, opts?: {
|
|
@@ -801,8 +804,9 @@ declare class StoreRunGateway implements RunGateway {
|
|
|
801
804
|
private readonly store;
|
|
802
805
|
private readonly engine;
|
|
803
806
|
constructor(store: StateStore, engine: WorkflowEngine);
|
|
807
|
+
topology(): DurableTopology;
|
|
804
808
|
getRunDetail(runId: string): Promise<RunDetail | null>;
|
|
805
|
-
listRuns(query: RunQuery): Promise<
|
|
809
|
+
listRuns(query: RunQuery): Promise<RunListItem[]>;
|
|
806
810
|
/** Every group the engine knows about — unscoped. A tenant proxy's request is scoped by the
|
|
807
811
|
* `RunRequestResponder` (to the requester's `@<tenant>` groups); the operator's own UI sees all. */
|
|
808
812
|
workerHealth(): Promise<GroupHealth[]>;
|
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,
|
|
1
|
+
import { StepError, WorkflowRef, SingletonConfig, StateStore, Transport, NamedTransport, ControlPlane, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowClass, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, DurableTopology, RunDetail, RunQuery, RunListItem, 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';
|
|
@@ -715,8 +715,11 @@ declare class ProxyRunGateway implements RunGateway {
|
|
|
715
715
|
constructor(transport: Transport, tenant: string, timeoutMs?: number);
|
|
716
716
|
private handleReply;
|
|
717
717
|
private request;
|
|
718
|
+
topology(): DurableTopology;
|
|
718
719
|
getRunDetail(runId: string): Promise<RunDetail | null>;
|
|
719
|
-
|
|
720
|
+
/** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
|
|
721
|
+
* it through as plain JSON, so a tenant's list rows name the wait too. */
|
|
722
|
+
listRuns(query: RunQuery): Promise<RunListItem[]>;
|
|
720
723
|
/** Round-trips to the operator, which scopes the result to this tenant's own `@<tenant>` groups. */
|
|
721
724
|
workerHealth(): Promise<GroupHealth[]>;
|
|
722
725
|
cancel(runId: string, opts?: {
|
|
@@ -801,8 +804,9 @@ declare class StoreRunGateway implements RunGateway {
|
|
|
801
804
|
private readonly store;
|
|
802
805
|
private readonly engine;
|
|
803
806
|
constructor(store: StateStore, engine: WorkflowEngine);
|
|
807
|
+
topology(): DurableTopology;
|
|
804
808
|
getRunDetail(runId: string): Promise<RunDetail | null>;
|
|
805
|
-
listRuns(query: RunQuery): Promise<
|
|
809
|
+
listRuns(query: RunQuery): Promise<RunListItem[]>;
|
|
806
810
|
/** Every group the engine knows about — unscoped. A tenant proxy's request is scoped by the
|
|
807
811
|
* `RunRequestResponder` (to the requester's `@<tenant>` groups); the operator's own UI sees all. */
|
|
808
812
|
workerHealth(): Promise<GroupHealth[]>;
|
package/dist/index.js
CHANGED
|
@@ -424,6 +424,12 @@ function tenantGatewayUnavailable(method) {
|
|
|
424
424
|
__name(tenantGatewayUnavailable, "tenantGatewayUnavailable");
|
|
425
425
|
function unavailableRunGateway() {
|
|
426
426
|
return {
|
|
427
|
+
// Topology is local metadata, always answerable — a thin worker with no transport is still a tenant.
|
|
428
|
+
topology() {
|
|
429
|
+
return {
|
|
430
|
+
role: "tenant"
|
|
431
|
+
};
|
|
432
|
+
},
|
|
427
433
|
getRunDetail(_runId) {
|
|
428
434
|
return tenantGatewayUnavailable("getRunDetail");
|
|
429
435
|
},
|
|
@@ -818,12 +824,20 @@ var ProxyRunGateway = class {
|
|
|
818
824
|
});
|
|
819
825
|
});
|
|
820
826
|
}
|
|
827
|
+
topology() {
|
|
828
|
+
return {
|
|
829
|
+
role: "tenant",
|
|
830
|
+
tenant: this.tenant
|
|
831
|
+
};
|
|
832
|
+
}
|
|
821
833
|
getRunDetail(runId) {
|
|
822
834
|
return this.request({
|
|
823
835
|
kind: "getRunDetail",
|
|
824
836
|
runId
|
|
825
837
|
});
|
|
826
838
|
}
|
|
839
|
+
/** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
|
|
840
|
+
* it through as plain JSON, so a tenant's list rows name the wait too. */
|
|
827
841
|
listRuns(query) {
|
|
828
842
|
return this.request({
|
|
829
843
|
kind: "listRuns",
|
|
@@ -1101,7 +1115,7 @@ var RunRequestResponder = class {
|
|
|
1101
1115
|
};
|
|
1102
1116
|
|
|
1103
1117
|
// src/store-run-gateway.ts
|
|
1104
|
-
import { STATE_STORE_CANONICAL as STATE_STORE_CANONICAL2, WorkflowEngine as WorkflowEngine2 } from "@dudousxd/nestjs-durable-core";
|
|
1118
|
+
import { STATE_STORE_CANONICAL as STATE_STORE_CANONICAL2, WorkflowEngine as WorkflowEngine2, indexWaitersByRun, resolveRunWaiting } from "@dudousxd/nestjs-durable-core";
|
|
1105
1119
|
import { Inject as Inject5, Injectable as Injectable8 } from "@nestjs/common";
|
|
1106
1120
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
1107
1121
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1130,6 +1144,11 @@ var StoreRunGateway = class {
|
|
|
1130
1144
|
this.store = store;
|
|
1131
1145
|
this.engine = engine;
|
|
1132
1146
|
}
|
|
1147
|
+
topology() {
|
|
1148
|
+
return {
|
|
1149
|
+
role: "control-plane"
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1133
1152
|
async getRunDetail(runId) {
|
|
1134
1153
|
const run = await this.store.getRun(runId);
|
|
1135
1154
|
if (!run) return null;
|
|
@@ -1143,8 +1162,16 @@ var StoreRunGateway = class {
|
|
|
1143
1162
|
children
|
|
1144
1163
|
};
|
|
1145
1164
|
}
|
|
1146
|
-
listRuns(query) {
|
|
1147
|
-
|
|
1165
|
+
async listRuns(query) {
|
|
1166
|
+
const runs = await this.store.listRuns(query);
|
|
1167
|
+
const waiterByRun = indexWaitersByRun(await this.store.listSignalWaiters(""));
|
|
1168
|
+
return runs.map((run) => {
|
|
1169
|
+
const waiting = resolveRunWaiting(run, waiterByRun);
|
|
1170
|
+
return waiting ? {
|
|
1171
|
+
...run,
|
|
1172
|
+
waiting
|
|
1173
|
+
} : run;
|
|
1174
|
+
});
|
|
1148
1175
|
}
|
|
1149
1176
|
/** Every group the engine knows about — unscoped. A tenant proxy's request is scoped by the
|
|
1150
1177
|
* `RunRequestResponder` (to the requester's `@<tenant>` groups); the operator's own UI sees all. */
|