@dudousxd/nestjs-durable 0.46.2 → 0.47.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 +52 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +53 -13
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/skills/durable-workflows/SKILL.md +12 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkflowCtx, SearchAttributes, WorkflowClass, StepError, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, StateStore, Transport, NamedTransport, ControlPlane, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, DurableTopology, RunDetail, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, GroupHealth, RunWaiting, EngineEvent, RunRequest, RunReply, StepInvocation, TenantEvent } from '@dudousxd/nestjs-durable-core';
|
|
1
|
+
import { WorkflowCtx, SearchAttributes, WorkflowClass, StepError, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, StateStore, Transport, NamedTransport, ControlPlane, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, DurableTopology, RunDetailOptions, RunDetail, FanPageQuery, FanPage, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, GroupHealth, RunWaiting, EngineEvent, RunRequest, RunReply, StepInvocation, WorkflowRun, TenantEvent } from '@dudousxd/nestjs-durable-core';
|
|
2
2
|
export { AttributeFilter, DynamicWorkflowCtx, EngineEvent, InferSearchAttributes, RunDetail, RunGateway, RunListItem, RunQuery, RunStatus, RunWaiting, SearchAttributes, SearchAttributesSchema, StepCheckpoint, StepEvent, StepLogger, WorkflowCtx, WorkflowEngine, WorkflowHandler, WorkflowRun, readSearchAttributes } from '@dudousxd/nestjs-durable-core';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { ConcurrencyOption, StartRunDeps, RunRedisWorkerOptions, RunningWorker, DurableWorkerRuntime } from '@dudousxd/durable-worker';
|
|
@@ -945,7 +945,8 @@ declare class ProxyRunGateway implements RunGateway {
|
|
|
945
945
|
private handleReply;
|
|
946
946
|
private request;
|
|
947
947
|
topology(): DurableTopology;
|
|
948
|
-
getRunDetail(runId: string): Promise<RunDetail | null>;
|
|
948
|
+
getRunDetail(runId: string, options?: RunDetailOptions): Promise<RunDetail | null>;
|
|
949
|
+
getFanMembers(runId: string, group: string, query: FanPageQuery): Promise<FanPage | null>;
|
|
949
950
|
/** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
|
|
950
951
|
* it through as plain JSON, so a tenant's list rows name the wait too. */
|
|
951
952
|
listRuns(query: RunQuery): Promise<RunListItem[]>;
|
|
@@ -1045,7 +1046,9 @@ declare class StoreRunGateway implements RunGateway {
|
|
|
1045
1046
|
private readonly engine;
|
|
1046
1047
|
constructor(store: StateStore, engine: WorkflowEngine);
|
|
1047
1048
|
topology(): DurableTopology;
|
|
1048
|
-
getRunDetail(runId: string): Promise<RunDetail | null>;
|
|
1049
|
+
getRunDetail(runId: string, options?: RunDetailOptions): Promise<RunDetail | null>;
|
|
1050
|
+
getRun(runId: string): Promise<WorkflowRun | null>;
|
|
1051
|
+
getFanMembers(runId: string, group: string, query: FanPageQuery): Promise<FanPage | null>;
|
|
1049
1052
|
listRuns(query: RunQuery): Promise<RunListItem[]>;
|
|
1050
1053
|
/**
|
|
1051
1054
|
* The `(status, origin)` counts behind a console's chips, straight off the store's aggregate. The
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkflowCtx, SearchAttributes, WorkflowClass, StepError, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, StateStore, Transport, NamedTransport, ControlPlane, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, DurableTopology, RunDetail, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, GroupHealth, RunWaiting, EngineEvent, RunRequest, RunReply, StepInvocation, TenantEvent } from '@dudousxd/nestjs-durable-core';
|
|
1
|
+
import { WorkflowCtx, SearchAttributes, WorkflowClass, StepError, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, StateStore, Transport, NamedTransport, ControlPlane, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, DurableTopology, RunDetailOptions, RunDetail, FanPageQuery, FanPage, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, GroupHealth, RunWaiting, EngineEvent, RunRequest, RunReply, StepInvocation, WorkflowRun, TenantEvent } from '@dudousxd/nestjs-durable-core';
|
|
2
2
|
export { AttributeFilter, DynamicWorkflowCtx, EngineEvent, InferSearchAttributes, RunDetail, RunGateway, RunListItem, RunQuery, RunStatus, RunWaiting, SearchAttributes, SearchAttributesSchema, StepCheckpoint, StepEvent, StepLogger, WorkflowCtx, WorkflowEngine, WorkflowHandler, WorkflowRun, readSearchAttributes } from '@dudousxd/nestjs-durable-core';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { ConcurrencyOption, StartRunDeps, RunRedisWorkerOptions, RunningWorker, DurableWorkerRuntime } from '@dudousxd/durable-worker';
|
|
@@ -945,7 +945,8 @@ declare class ProxyRunGateway implements RunGateway {
|
|
|
945
945
|
private handleReply;
|
|
946
946
|
private request;
|
|
947
947
|
topology(): DurableTopology;
|
|
948
|
-
getRunDetail(runId: string): Promise<RunDetail | null>;
|
|
948
|
+
getRunDetail(runId: string, options?: RunDetailOptions): Promise<RunDetail | null>;
|
|
949
|
+
getFanMembers(runId: string, group: string, query: FanPageQuery): Promise<FanPage | null>;
|
|
949
950
|
/** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
|
|
950
951
|
* it through as plain JSON, so a tenant's list rows name the wait too. */
|
|
951
952
|
listRuns(query: RunQuery): Promise<RunListItem[]>;
|
|
@@ -1045,7 +1046,9 @@ declare class StoreRunGateway implements RunGateway {
|
|
|
1045
1046
|
private readonly engine;
|
|
1046
1047
|
constructor(store: StateStore, engine: WorkflowEngine);
|
|
1047
1048
|
topology(): DurableTopology;
|
|
1048
|
-
getRunDetail(runId: string): Promise<RunDetail | null>;
|
|
1049
|
+
getRunDetail(runId: string, options?: RunDetailOptions): Promise<RunDetail | null>;
|
|
1050
|
+
getRun(runId: string): Promise<WorkflowRun | null>;
|
|
1051
|
+
getFanMembers(runId: string, group: string, query: FanPageQuery): Promise<FanPage | null>;
|
|
1049
1052
|
listRuns(query: RunQuery): Promise<RunListItem[]>;
|
|
1050
1053
|
/**
|
|
1051
1054
|
* The `(status, origin)` counts behind a console's chips, straight off the store's aggregate. The
|
package/dist/index.js
CHANGED
|
@@ -1072,10 +1072,19 @@ var ProxyRunGateway = class {
|
|
|
1072
1072
|
tenant: this.tenant
|
|
1073
1073
|
};
|
|
1074
1074
|
}
|
|
1075
|
-
getRunDetail(runId) {
|
|
1075
|
+
getRunDetail(runId, options) {
|
|
1076
1076
|
return this.request({
|
|
1077
1077
|
kind: "getRunDetail",
|
|
1078
|
-
runId
|
|
1078
|
+
runId,
|
|
1079
|
+
options
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
getFanMembers(runId, group, query) {
|
|
1083
|
+
return this.request({
|
|
1084
|
+
kind: "getFanMembers",
|
|
1085
|
+
runId,
|
|
1086
|
+
group,
|
|
1087
|
+
query
|
|
1079
1088
|
});
|
|
1080
1089
|
}
|
|
1081
1090
|
/** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
|
|
@@ -1437,8 +1446,8 @@ var RunRequestResponder = class {
|
|
|
1437
1446
|
if (body.kind === "waitingFor") {
|
|
1438
1447
|
const all = await this.gateway.waitingFor(body.runIds);
|
|
1439
1448
|
const owned = await Promise.all(Object.entries(all).map(async ([runId, waiting]) => {
|
|
1440
|
-
const
|
|
1441
|
-
return
|
|
1449
|
+
const owner = this.gateway.getRun ? await this.gateway.getRun(runId) : (await this.gateway.getRunDetail(runId))?.run;
|
|
1450
|
+
return owner && owner.namespace === msg.tenant ? [
|
|
1442
1451
|
runId,
|
|
1443
1452
|
waiting
|
|
1444
1453
|
] : void 0;
|
|
@@ -1455,8 +1464,9 @@ var RunRequestResponder = class {
|
|
|
1455
1464
|
}
|
|
1456
1465
|
};
|
|
1457
1466
|
}
|
|
1458
|
-
const detail = await this.gateway.getRunDetail(body.runId);
|
|
1459
|
-
|
|
1467
|
+
const detail = body.kind === "getRunDetail" || !this.gateway.getRun ? await this.gateway.getRunDetail(body.runId, body.kind === "getRunDetail" ? body.options : void 0) : void 0;
|
|
1468
|
+
const run = detail !== void 0 ? detail?.run ?? null : await this.gateway.getRun?.(body.runId);
|
|
1469
|
+
if (run && run.namespace !== msg.tenant) {
|
|
1460
1470
|
return {
|
|
1461
1471
|
requestId: msg.requestId,
|
|
1462
1472
|
result: {
|
|
@@ -1477,6 +1487,16 @@ var RunRequestResponder = class {
|
|
|
1477
1487
|
}
|
|
1478
1488
|
};
|
|
1479
1489
|
}
|
|
1490
|
+
if (body.kind === "getFanMembers") {
|
|
1491
|
+
const data = run ? await this.gateway.getFanMembers?.(body.runId, body.group, body.query) ?? null : null;
|
|
1492
|
+
return {
|
|
1493
|
+
requestId: msg.requestId,
|
|
1494
|
+
result: {
|
|
1495
|
+
ok: true,
|
|
1496
|
+
data
|
|
1497
|
+
}
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1480
1500
|
try {
|
|
1481
1501
|
const data = await this.callVerb(body);
|
|
1482
1502
|
return {
|
|
@@ -1515,7 +1535,7 @@ var RunRequestResponder = class {
|
|
|
1515
1535
|
};
|
|
1516
1536
|
|
|
1517
1537
|
// src/store-run-gateway.ts
|
|
1518
|
-
import { STATE_STORE_CANONICAL as STATE_STORE_CANONICAL2, WorkflowEngine as WorkflowEngine2, indexWaitersByRun, listSignalWaitersOfRuns, mergeRunFacetRows, resolveRunWaiting } from "@dudousxd/nestjs-durable-core";
|
|
1538
|
+
import { STATE_STORE_CANONICAL as STATE_STORE_CANONICAL2, SUMMARY_CHILD_LIMIT, WorkflowEngine as WorkflowEngine2, childIdsOf, indexWaitersByRun, listSignalWaitersOfRuns, mergeRunFacetRows, pageFan, resolveRunWaiting, summarizeTimeline } from "@dudousxd/nestjs-durable-core";
|
|
1519
1539
|
import { Inject as Inject5, Injectable as Injectable8 } from "@nestjs/common";
|
|
1520
1540
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
1521
1541
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1558,19 +1578,39 @@ var StoreRunGateway = class {
|
|
|
1558
1578
|
role: "control-plane"
|
|
1559
1579
|
};
|
|
1560
1580
|
}
|
|
1561
|
-
async getRunDetail(runId) {
|
|
1581
|
+
async getRunDetail(runId, options) {
|
|
1562
1582
|
const run = await this.store.getRun(runId);
|
|
1563
1583
|
if (!run) return null;
|
|
1564
|
-
const
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1584
|
+
const over = options?.summarizeFansOver;
|
|
1585
|
+
if (over === void 0) {
|
|
1586
|
+
const [timeline2, children] = await Promise.all([
|
|
1587
|
+
this.store.listCheckpoints(runId),
|
|
1588
|
+
this.engine.getRunChildren(runId)
|
|
1589
|
+
]);
|
|
1590
|
+
return {
|
|
1591
|
+
run,
|
|
1592
|
+
timeline: timeline2,
|
|
1593
|
+
children
|
|
1594
|
+
};
|
|
1595
|
+
}
|
|
1596
|
+
const full = await this.store.listCheckpoints(runId);
|
|
1597
|
+
const { timeline, fans } = summarizeTimeline(full, over);
|
|
1598
|
+
const ids = childIdsOf(full);
|
|
1568
1599
|
return {
|
|
1569
1600
|
run,
|
|
1570
1601
|
timeline,
|
|
1571
|
-
children
|
|
1602
|
+
children: ids.slice(0, SUMMARY_CHILD_LIMIT),
|
|
1603
|
+
fans,
|
|
1604
|
+
childCount: ids.length
|
|
1572
1605
|
};
|
|
1573
1606
|
}
|
|
1607
|
+
getRun(runId) {
|
|
1608
|
+
return this.store.getRun(runId);
|
|
1609
|
+
}
|
|
1610
|
+
async getFanMembers(runId, group, query) {
|
|
1611
|
+
if (!await this.store.getRun(runId)) return null;
|
|
1612
|
+
return pageFan(await this.store.listCheckpoints(runId), group, query);
|
|
1613
|
+
}
|
|
1574
1614
|
async listRuns(query) {
|
|
1575
1615
|
const runs = await this.store.listRuns(query);
|
|
1576
1616
|
const waiterByRun = indexWaitersByRun(await listSignalWaitersOfRuns(this.store, runs.filter((run) => run.status === "suspended").map((run) => run.id)));
|