@dudousxd/nestjs-durable-dashboard 0.52.1 → 0.54.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/client/durable-client.d.ts +61 -2
- package/dist/client/durable-client.d.ts.map +1 -1
- package/dist/client/durable-client.js +17 -0
- package/dist/client/durable-client.js.map +1 -1
- package/dist/client/event-tail.d.ts +25 -0
- package/dist/client/event-tail.d.ts.map +1 -0
- package/dist/client/event-tail.js +30 -0
- package/dist/client/event-tail.js.map +1 -0
- package/dist/server/index.cjs +103 -0
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +49 -2
- package/dist/server/index.d.ts +49 -2
- package/dist/server/index.js +106 -3
- package/dist/server/index.js.map +1 -1
- package/dist/spa/assets/{bench-Db-gqOEF.js → bench-Dee6-QN_.js} +1 -1
- package/dist/spa/assets/index-CJdk28vt.css +1 -0
- package/dist/spa/assets/{index-4tEXGRlA.js → index-RjxbO7dU.js} +1 -1
- package/dist/spa/assets/index-VXNPW483.js +66 -0
- package/dist/spa/assets/{preview-BvCp1zR5.js → preview-BscU9n0o.js} +1 -1
- package/dist/spa/bench.html +3 -3
- package/dist/spa/index.html +3 -3
- package/dist/spa/preview.html +3 -3
- package/package.json +4 -3
- package/dist/spa/assets/index-BbR4CZ1K.css +0 -1
- package/dist/spa/assets/index-CEV7yPmk.js +0 -66
package/dist/server/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _dudousxd_nestjs_durable_core from '@dudousxd/nestjs-durable-core';
|
|
2
|
-
import { RunGateway, StateStore, WorkflowEngine, ScheduleListQuery, ScheduleDescription, RunResult, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, DurableTopology, GroupHealth, RunDetailOptions, RunDetail, FanPageQuery, FanPage, UpdateResult, EngineEvent, AttributeFilter } from '@dudousxd/nestjs-durable-core';
|
|
2
|
+
import { RunGateway, StateStore, WorkflowEngine, ScheduleListQuery, ScheduleDescription, RunResult, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, DurableTopology, GroupHealth, RunDetailOptions, RunDetail, FanPageQuery, FanPage, RepublishLifecycleResult, WorkflowLifecycleLinks, UpdateResult, EngineEvent, AttributeFilter } from '@dudousxd/nestjs-durable-core';
|
|
3
3
|
export { RunDetail } from '@dudousxd/nestjs-durable-core';
|
|
4
4
|
import * as rxjs from 'rxjs';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
@@ -113,6 +113,17 @@ interface ResolvedDashboardAuth {
|
|
|
113
113
|
* Operator-only ops (metrics/deliverWebhook/getEvent/update) still need direct `store`/`engine`
|
|
114
114
|
* access; they stay `@Optional()` and throw a clear error when absent.
|
|
115
115
|
*/
|
|
116
|
+
/**
|
|
117
|
+
* A workflow's lifecycle links as `GET workflows/:name/lifecycle` answers them, plus `triggerCounts`:
|
|
118
|
+
* per subscriber of `startsOnSettle`, how many runs it was started for (`triggered`) and how many
|
|
119
|
+
* times starting it failed (`failed`), counted by this process's metrics since it started.
|
|
120
|
+
*/
|
|
121
|
+
interface WorkflowLifecyclePage extends WorkflowLifecycleLinks {
|
|
122
|
+
triggerCounts?: Record<string, {
|
|
123
|
+
triggered: number;
|
|
124
|
+
failed: number;
|
|
125
|
+
}> | undefined;
|
|
126
|
+
}
|
|
116
127
|
declare class DashboardService {
|
|
117
128
|
private readonly gateway;
|
|
118
129
|
private readonly store?;
|
|
@@ -176,6 +187,23 @@ declare class DashboardService {
|
|
|
176
187
|
cancel(runId: string, opts?: {
|
|
177
188
|
compensate?: boolean;
|
|
178
189
|
}): Promise<RunResult | null>;
|
|
190
|
+
/**
|
|
191
|
+
* Publish a settled run's lifecycle event again, to its subscribers that have not started (or to
|
|
192
|
+
* `subscriber` alone). Undefined when the gateway cannot republish (a tenant proxy).
|
|
193
|
+
*/
|
|
194
|
+
republishLifecycle(runId: string, subscriber?: string): Promise<RepublishLifecycleResult | undefined>;
|
|
195
|
+
/**
|
|
196
|
+
* Who starts whom through lifecycle events, for `workflow`, plus `triggerCounts` when this process
|
|
197
|
+
* counts the engine's events (the control plane) and the workflow has subscribers. Undefined when
|
|
198
|
+
* the gateway cannot answer.
|
|
199
|
+
*/
|
|
200
|
+
workflowLifecycle(workflow: string): Promise<WorkflowLifecyclePage | undefined>;
|
|
201
|
+
/**
|
|
202
|
+
* How many runs each subscriber of `links.workflow` was started for and how many times starting it
|
|
203
|
+
* failed, counted by this process's metrics since it started. Undefined without metrics (a tenant)
|
|
204
|
+
* or without subscribers.
|
|
205
|
+
*/
|
|
206
|
+
private triggerCountsOf;
|
|
179
207
|
/**
|
|
180
208
|
* Apply `retry` or `cancel` to every run matching a filter (status / tag / workflow / namespace /
|
|
181
209
|
* origin) — e.g. "retry every `dead` run tagged `type:mel`". The filter is the same one the run
|
|
@@ -318,6 +346,11 @@ declare class DurableApiController {
|
|
|
318
346
|
resumeSchedule(id: string): Promise<_dudousxd_nestjs_durable_core.ScheduleDescription>;
|
|
319
347
|
/** Start one run of the schedule now, outside its cadence. */
|
|
320
348
|
triggerSchedule(id: string): Promise<_dudousxd_nestjs_durable_core.RunResult>;
|
|
349
|
+
/**
|
|
350
|
+
* Who starts whom through lifecycle events, for one workflow: the workflows that start when it
|
|
351
|
+
* settles, and the ones whose settling starts it. What the console's workflow page lists.
|
|
352
|
+
*/
|
|
353
|
+
workflowLifecycle(name: string): Promise<WorkflowLifecyclePage>;
|
|
321
354
|
/** This deployment's durable role (control plane vs tenant) + tenant name — for the header badge. */
|
|
322
355
|
topology(): _dudousxd_nestjs_durable_core.DurableTopology;
|
|
323
356
|
/**
|
|
@@ -334,6 +367,13 @@ declare class DurableApiController {
|
|
|
334
367
|
children: string[];
|
|
335
368
|
fans?: _dudousxd_nestjs_durable_core.FanSummary[] | undefined;
|
|
336
369
|
childCount?: number | undefined;
|
|
370
|
+
triggered?: string[] | undefined;
|
|
371
|
+
triggeredBy?: _dudousxd_nestjs_durable_core.LifecycleSource | undefined;
|
|
372
|
+
lifecycleSubscribers?: string[] | undefined;
|
|
373
|
+
workflowLifecycle?: _dudousxd_nestjs_durable_core.WorkflowLifecycleLinks | undefined;
|
|
374
|
+
lifecycleDeliveries?: _dudousxd_nestjs_durable_core.LifecycleDelivery[] | undefined;
|
|
375
|
+
waitsFor?: _dudousxd_nestjs_durable_core.RunWaitLink[] | undefined;
|
|
376
|
+
awaitedBy?: _dudousxd_nestjs_durable_core.RunWaitLink[] | undefined;
|
|
337
377
|
}>;
|
|
338
378
|
/** One page of a summarized fan's members, in seq order. Versioned like {@link run}. */
|
|
339
379
|
fanMembers(id: string, group: string, offset?: string, limit?: string, failed?: string, ifNoneMatch?: string, response?: unknown): Promise<{
|
|
@@ -362,6 +402,13 @@ declare class DurableApiController {
|
|
|
362
402
|
applied: number;
|
|
363
403
|
}>;
|
|
364
404
|
cancel(id: string, compensate?: string): Promise<_dudousxd_nestjs_durable_core.RunResult>;
|
|
405
|
+
/**
|
|
406
|
+
* Publish a settled run's lifecycle event again, to the subscribers that have not started from it
|
|
407
|
+
* (or only `subscriber`). Same gate as retry/cancel.
|
|
408
|
+
*/
|
|
409
|
+
republishLifecycle(id: string, body?: {
|
|
410
|
+
subscriber?: string;
|
|
411
|
+
}): Promise<_dudousxd_nestjs_durable_core.RepublishLifecycleResult>;
|
|
365
412
|
continue(id: string): Promise<_dudousxd_nestjs_durable_core.RunResult>;
|
|
366
413
|
/** Re-dispatch a run's stuck `pending` remote steps — recovery for a lost step dispatch. */
|
|
367
414
|
redispatch(id: string): Promise<_dudousxd_nestjs_durable_core.RunResult & {
|
|
@@ -732,4 +779,4 @@ declare class DurableUiController {
|
|
|
732
779
|
asset(file: string): StreamableFile;
|
|
733
780
|
}
|
|
734
781
|
|
|
735
|
-
export { DASHBOARD_API_PATH, DASHBOARD_BASE_PATH, DASHBOARD_GATE, DURABLE_DASHBOARD_TOKEN_ENV, type DashboardAuthOptions, type DashboardGate, type DashboardGateMode, type DashboardGateOptions, DashboardService, type DashboardSessionUser, DurableApiController, DurableApiModule, DurableApiSessionGuard, DurableAuthController, type DurableDashboardAsyncOptions, DurableDashboardGateGuard, DurableDashboardModule, type DurableDashboardOptions, DurableUiController, DurableUiSessionGuard, type UnauthenticatedPageContext, type UnauthenticatedPageHook, dashboardGateProvider, readDashboardToken, reportDashboardGate, resolveDashboardGate };
|
|
782
|
+
export { DASHBOARD_API_PATH, DASHBOARD_BASE_PATH, DASHBOARD_GATE, DURABLE_DASHBOARD_TOKEN_ENV, type DashboardAuthOptions, type DashboardGate, type DashboardGateMode, type DashboardGateOptions, DashboardService, type DashboardSessionUser, DurableApiController, DurableApiModule, DurableApiSessionGuard, DurableAuthController, type DurableDashboardAsyncOptions, DurableDashboardGateGuard, DurableDashboardModule, type DurableDashboardOptions, DurableUiController, DurableUiSessionGuard, type UnauthenticatedPageContext, type UnauthenticatedPageHook, type WorkflowLifecyclePage, dashboardGateProvider, readDashboardToken, reportDashboardGate, resolveDashboardGate };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _dudousxd_nestjs_durable_core from '@dudousxd/nestjs-durable-core';
|
|
2
|
-
import { RunGateway, StateStore, WorkflowEngine, ScheduleListQuery, ScheduleDescription, RunResult, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, DurableTopology, GroupHealth, RunDetailOptions, RunDetail, FanPageQuery, FanPage, UpdateResult, EngineEvent, AttributeFilter } from '@dudousxd/nestjs-durable-core';
|
|
2
|
+
import { RunGateway, StateStore, WorkflowEngine, ScheduleListQuery, ScheduleDescription, RunResult, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, DurableTopology, GroupHealth, RunDetailOptions, RunDetail, FanPageQuery, FanPage, RepublishLifecycleResult, WorkflowLifecycleLinks, UpdateResult, EngineEvent, AttributeFilter } from '@dudousxd/nestjs-durable-core';
|
|
3
3
|
export { RunDetail } from '@dudousxd/nestjs-durable-core';
|
|
4
4
|
import * as rxjs from 'rxjs';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
@@ -113,6 +113,17 @@ interface ResolvedDashboardAuth {
|
|
|
113
113
|
* Operator-only ops (metrics/deliverWebhook/getEvent/update) still need direct `store`/`engine`
|
|
114
114
|
* access; they stay `@Optional()` and throw a clear error when absent.
|
|
115
115
|
*/
|
|
116
|
+
/**
|
|
117
|
+
* A workflow's lifecycle links as `GET workflows/:name/lifecycle` answers them, plus `triggerCounts`:
|
|
118
|
+
* per subscriber of `startsOnSettle`, how many runs it was started for (`triggered`) and how many
|
|
119
|
+
* times starting it failed (`failed`), counted by this process's metrics since it started.
|
|
120
|
+
*/
|
|
121
|
+
interface WorkflowLifecyclePage extends WorkflowLifecycleLinks {
|
|
122
|
+
triggerCounts?: Record<string, {
|
|
123
|
+
triggered: number;
|
|
124
|
+
failed: number;
|
|
125
|
+
}> | undefined;
|
|
126
|
+
}
|
|
116
127
|
declare class DashboardService {
|
|
117
128
|
private readonly gateway;
|
|
118
129
|
private readonly store?;
|
|
@@ -176,6 +187,23 @@ declare class DashboardService {
|
|
|
176
187
|
cancel(runId: string, opts?: {
|
|
177
188
|
compensate?: boolean;
|
|
178
189
|
}): Promise<RunResult | null>;
|
|
190
|
+
/**
|
|
191
|
+
* Publish a settled run's lifecycle event again, to its subscribers that have not started (or to
|
|
192
|
+
* `subscriber` alone). Undefined when the gateway cannot republish (a tenant proxy).
|
|
193
|
+
*/
|
|
194
|
+
republishLifecycle(runId: string, subscriber?: string): Promise<RepublishLifecycleResult | undefined>;
|
|
195
|
+
/**
|
|
196
|
+
* Who starts whom through lifecycle events, for `workflow`, plus `triggerCounts` when this process
|
|
197
|
+
* counts the engine's events (the control plane) and the workflow has subscribers. Undefined when
|
|
198
|
+
* the gateway cannot answer.
|
|
199
|
+
*/
|
|
200
|
+
workflowLifecycle(workflow: string): Promise<WorkflowLifecyclePage | undefined>;
|
|
201
|
+
/**
|
|
202
|
+
* How many runs each subscriber of `links.workflow` was started for and how many times starting it
|
|
203
|
+
* failed, counted by this process's metrics since it started. Undefined without metrics (a tenant)
|
|
204
|
+
* or without subscribers.
|
|
205
|
+
*/
|
|
206
|
+
private triggerCountsOf;
|
|
179
207
|
/**
|
|
180
208
|
* Apply `retry` or `cancel` to every run matching a filter (status / tag / workflow / namespace /
|
|
181
209
|
* origin) — e.g. "retry every `dead` run tagged `type:mel`". The filter is the same one the run
|
|
@@ -318,6 +346,11 @@ declare class DurableApiController {
|
|
|
318
346
|
resumeSchedule(id: string): Promise<_dudousxd_nestjs_durable_core.ScheduleDescription>;
|
|
319
347
|
/** Start one run of the schedule now, outside its cadence. */
|
|
320
348
|
triggerSchedule(id: string): Promise<_dudousxd_nestjs_durable_core.RunResult>;
|
|
349
|
+
/**
|
|
350
|
+
* Who starts whom through lifecycle events, for one workflow: the workflows that start when it
|
|
351
|
+
* settles, and the ones whose settling starts it. What the console's workflow page lists.
|
|
352
|
+
*/
|
|
353
|
+
workflowLifecycle(name: string): Promise<WorkflowLifecyclePage>;
|
|
321
354
|
/** This deployment's durable role (control plane vs tenant) + tenant name — for the header badge. */
|
|
322
355
|
topology(): _dudousxd_nestjs_durable_core.DurableTopology;
|
|
323
356
|
/**
|
|
@@ -334,6 +367,13 @@ declare class DurableApiController {
|
|
|
334
367
|
children: string[];
|
|
335
368
|
fans?: _dudousxd_nestjs_durable_core.FanSummary[] | undefined;
|
|
336
369
|
childCount?: number | undefined;
|
|
370
|
+
triggered?: string[] | undefined;
|
|
371
|
+
triggeredBy?: _dudousxd_nestjs_durable_core.LifecycleSource | undefined;
|
|
372
|
+
lifecycleSubscribers?: string[] | undefined;
|
|
373
|
+
workflowLifecycle?: _dudousxd_nestjs_durable_core.WorkflowLifecycleLinks | undefined;
|
|
374
|
+
lifecycleDeliveries?: _dudousxd_nestjs_durable_core.LifecycleDelivery[] | undefined;
|
|
375
|
+
waitsFor?: _dudousxd_nestjs_durable_core.RunWaitLink[] | undefined;
|
|
376
|
+
awaitedBy?: _dudousxd_nestjs_durable_core.RunWaitLink[] | undefined;
|
|
337
377
|
}>;
|
|
338
378
|
/** One page of a summarized fan's members, in seq order. Versioned like {@link run}. */
|
|
339
379
|
fanMembers(id: string, group: string, offset?: string, limit?: string, failed?: string, ifNoneMatch?: string, response?: unknown): Promise<{
|
|
@@ -362,6 +402,13 @@ declare class DurableApiController {
|
|
|
362
402
|
applied: number;
|
|
363
403
|
}>;
|
|
364
404
|
cancel(id: string, compensate?: string): Promise<_dudousxd_nestjs_durable_core.RunResult>;
|
|
405
|
+
/**
|
|
406
|
+
* Publish a settled run's lifecycle event again, to the subscribers that have not started from it
|
|
407
|
+
* (or only `subscriber`). Same gate as retry/cancel.
|
|
408
|
+
*/
|
|
409
|
+
republishLifecycle(id: string, body?: {
|
|
410
|
+
subscriber?: string;
|
|
411
|
+
}): Promise<_dudousxd_nestjs_durable_core.RepublishLifecycleResult>;
|
|
365
412
|
continue(id: string): Promise<_dudousxd_nestjs_durable_core.RunResult>;
|
|
366
413
|
/** Re-dispatch a run's stuck `pending` remote steps — recovery for a lost step dispatch. */
|
|
367
414
|
redispatch(id: string): Promise<_dudousxd_nestjs_durable_core.RunResult & {
|
|
@@ -732,4 +779,4 @@ declare class DurableUiController {
|
|
|
732
779
|
asset(file: string): StreamableFile;
|
|
733
780
|
}
|
|
734
781
|
|
|
735
|
-
export { DASHBOARD_API_PATH, DASHBOARD_BASE_PATH, DASHBOARD_GATE, DURABLE_DASHBOARD_TOKEN_ENV, type DashboardAuthOptions, type DashboardGate, type DashboardGateMode, type DashboardGateOptions, DashboardService, type DashboardSessionUser, DurableApiController, DurableApiModule, DurableApiSessionGuard, DurableAuthController, type DurableDashboardAsyncOptions, DurableDashboardGateGuard, DurableDashboardModule, type DurableDashboardOptions, DurableUiController, DurableUiSessionGuard, type UnauthenticatedPageContext, type UnauthenticatedPageHook, dashboardGateProvider, readDashboardToken, reportDashboardGate, resolveDashboardGate };
|
|
782
|
+
export { DASHBOARD_API_PATH, DASHBOARD_BASE_PATH, DASHBOARD_GATE, DURABLE_DASHBOARD_TOKEN_ENV, type DashboardAuthOptions, type DashboardGate, type DashboardGateMode, type DashboardGateOptions, DashboardService, type DashboardSessionUser, DurableApiController, DurableApiModule, DurableApiSessionGuard, DurableAuthController, type DurableDashboardAsyncOptions, DurableDashboardGateGuard, DurableDashboardModule, type DurableDashboardOptions, DurableUiController, DurableUiSessionGuard, type UnauthenticatedPageContext, type UnauthenticatedPageHook, type WorkflowLifecyclePage, dashboardGateProvider, readDashboardToken, reportDashboardGate, resolveDashboardGate };
|
package/dist/server/index.js
CHANGED
|
@@ -174,6 +174,51 @@ var DashboardService = class {
|
|
|
174
174
|
return this.gateway.cancel(runId, opts);
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
|
+
* Publish a settled run's lifecycle event again, to its subscribers that have not started (or to
|
|
178
|
+
* `subscriber` alone). Undefined when the gateway cannot republish (a tenant proxy).
|
|
179
|
+
*/
|
|
180
|
+
async republishLifecycle(runId, subscriber) {
|
|
181
|
+
return this.gateway.republishLifecycle?.({
|
|
182
|
+
runId,
|
|
183
|
+
...subscriber !== void 0 ? {
|
|
184
|
+
subscriber
|
|
185
|
+
} : {}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Who starts whom through lifecycle events, for `workflow`, plus `triggerCounts` when this process
|
|
190
|
+
* counts the engine's events (the control plane) and the workflow has subscribers. Undefined when
|
|
191
|
+
* the gateway cannot answer.
|
|
192
|
+
*/
|
|
193
|
+
async workflowLifecycle(workflow) {
|
|
194
|
+
const links = await this.gateway.workflowLifecycle?.(workflow);
|
|
195
|
+
if (!links) return links;
|
|
196
|
+
const counts = this.triggerCountsOf(links);
|
|
197
|
+
return counts ? {
|
|
198
|
+
...links,
|
|
199
|
+
triggerCounts: counts
|
|
200
|
+
} : links;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* How many runs each subscriber of `links.workflow` was started for and how many times starting it
|
|
204
|
+
* failed, counted by this process's metrics since it started. Undefined without metrics (a tenant)
|
|
205
|
+
* or without subscribers.
|
|
206
|
+
*/
|
|
207
|
+
triggerCountsOf(links) {
|
|
208
|
+
const snapshot = this.metricsCollector?.snapshot();
|
|
209
|
+
if (!snapshot || links.startsOnSettle.length === 0) return void 0;
|
|
210
|
+
const triggered = snapshot.triggeredBySubscriber[links.workflow] ?? {};
|
|
211
|
+
const failed = snapshot.triggerFailedBySubscriber[links.workflow] ?? {};
|
|
212
|
+
const counts = {};
|
|
213
|
+
for (const { workflow } of links.startsOnSettle) {
|
|
214
|
+
counts[workflow] = {
|
|
215
|
+
triggered: triggered[workflow] ?? 0,
|
|
216
|
+
failed: failed[workflow] ?? 0
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
return counts;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
177
222
|
* Apply `retry` or `cancel` to every run matching a filter (status / tag / workflow / namespace /
|
|
178
223
|
* origin) — e.g. "retry every `dead` run tagged `type:mel`". The filter is the same one the run
|
|
179
224
|
* list uses, so a bulk action can never reach wider than the list it was launched from — but note
|
|
@@ -274,7 +319,7 @@ DashboardService = _ts_decorate([
|
|
|
274
319
|
|
|
275
320
|
// src/server/durable-api.controller.ts
|
|
276
321
|
import { ApplyFilter, ApplyFilterInterceptor, FilterRunner } from "@dudousxd/nestjs-filter";
|
|
277
|
-
import { Body, Controller, Get, Header, Headers, NotFoundException, Param, Post, Query, Res, Sse, UseFilters, UseInterceptors } from "@nestjs/common";
|
|
322
|
+
import { BadRequestException as BadRequestException2, Body, Controller, Get, Header, Headers, NotFoundException, NotImplementedException, Param, Post, Query, Res, Sse, UseFilters, UseInterceptors } from "@nestjs/common";
|
|
278
323
|
|
|
279
324
|
// src/server/durable-run.ts
|
|
280
325
|
var DurableRun = class {
|
|
@@ -1202,6 +1247,15 @@ var DurableApiController = class {
|
|
|
1202
1247
|
triggerSchedule(id) {
|
|
1203
1248
|
return this.dashboard.triggerSchedule(id).catch(notFound);
|
|
1204
1249
|
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Who starts whom through lifecycle events, for one workflow: the workflows that start when it
|
|
1252
|
+
* settles, and the ones whose settling starts it. What the console's workflow page lists.
|
|
1253
|
+
*/
|
|
1254
|
+
async workflowLifecycle(name) {
|
|
1255
|
+
const links = await this.dashboard.workflowLifecycle(name).catch(notSupportedByServer);
|
|
1256
|
+
if (!links) throw new NotImplementedException("workflow lifecycle links need the control plane");
|
|
1257
|
+
return links;
|
|
1258
|
+
}
|
|
1205
1259
|
/** This deployment's durable role (control plane vs tenant) + tenant name — for the header badge. */
|
|
1206
1260
|
topology() {
|
|
1207
1261
|
return this.dashboard.topology();
|
|
@@ -1277,6 +1331,28 @@ var DurableApiController = class {
|
|
|
1277
1331
|
if (!result) throw new NotFoundException(`run ${id} not found`);
|
|
1278
1332
|
return result;
|
|
1279
1333
|
}
|
|
1334
|
+
/**
|
|
1335
|
+
* Publish a settled run's lifecycle event again, to the subscribers that have not started from it
|
|
1336
|
+
* (or only `subscriber`). Same gate as retry/cancel.
|
|
1337
|
+
*/
|
|
1338
|
+
async republishLifecycle(id, body) {
|
|
1339
|
+
let result;
|
|
1340
|
+
try {
|
|
1341
|
+
result = await this.dashboard.republishLifecycle(id, body?.subscriber || void 0);
|
|
1342
|
+
} catch (error) {
|
|
1343
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1344
|
+
if (/^run .* not found$/.test(message)) throw new NotFoundException(message);
|
|
1345
|
+
if (/^run .* has not settled/.test(message)) throw new BadRequestException2(message);
|
|
1346
|
+
if (error?.code === "bad-request") {
|
|
1347
|
+
throw new BadRequestException2(message);
|
|
1348
|
+
}
|
|
1349
|
+
return notSupportedByServer(error);
|
|
1350
|
+
}
|
|
1351
|
+
if (!result) {
|
|
1352
|
+
throw new NotImplementedException("republishing lifecycle events needs the control plane");
|
|
1353
|
+
}
|
|
1354
|
+
return result;
|
|
1355
|
+
}
|
|
1280
1356
|
async continue(id) {
|
|
1281
1357
|
const result = await this.dashboard.continue(id);
|
|
1282
1358
|
if (!result) throw new NotFoundException(`run ${id} is not paused at a breakpoint`);
|
|
@@ -1392,6 +1468,15 @@ _ts_decorate5([
|
|
|
1392
1468
|
]),
|
|
1393
1469
|
_ts_metadata4("design:returntype", void 0)
|
|
1394
1470
|
], DurableApiController.prototype, "triggerSchedule", null);
|
|
1471
|
+
_ts_decorate5([
|
|
1472
|
+
Get("workflows/:name/lifecycle"),
|
|
1473
|
+
_ts_param2(0, Param("name")),
|
|
1474
|
+
_ts_metadata4("design:type", Function),
|
|
1475
|
+
_ts_metadata4("design:paramtypes", [
|
|
1476
|
+
String
|
|
1477
|
+
]),
|
|
1478
|
+
_ts_metadata4("design:returntype", Promise)
|
|
1479
|
+
], DurableApiController.prototype, "workflowLifecycle", null);
|
|
1395
1480
|
_ts_decorate5([
|
|
1396
1481
|
Get("topology"),
|
|
1397
1482
|
_ts_metadata4("design:type", Function),
|
|
@@ -1491,6 +1576,17 @@ _ts_decorate5([
|
|
|
1491
1576
|
]),
|
|
1492
1577
|
_ts_metadata4("design:returntype", Promise)
|
|
1493
1578
|
], DurableApiController.prototype, "cancel", null);
|
|
1579
|
+
_ts_decorate5([
|
|
1580
|
+
Post("runs/:id/republish-lifecycle"),
|
|
1581
|
+
_ts_param2(0, Param("id")),
|
|
1582
|
+
_ts_param2(1, Body()),
|
|
1583
|
+
_ts_metadata4("design:type", Function),
|
|
1584
|
+
_ts_metadata4("design:paramtypes", [
|
|
1585
|
+
String,
|
|
1586
|
+
Object
|
|
1587
|
+
]),
|
|
1588
|
+
_ts_metadata4("design:returntype", Promise)
|
|
1589
|
+
], DurableApiController.prototype, "republishLifecycle", null);
|
|
1494
1590
|
_ts_decorate5([
|
|
1495
1591
|
Post("runs/:id/continue"),
|
|
1496
1592
|
_ts_param2(0, Param("id")),
|
|
@@ -1561,9 +1657,16 @@ function notFound(error) {
|
|
|
1561
1657
|
throw error;
|
|
1562
1658
|
}
|
|
1563
1659
|
__name(notFound, "notFound");
|
|
1660
|
+
function notSupportedByServer(error) {
|
|
1661
|
+
if (error?.code === "unsupported-request") {
|
|
1662
|
+
throw new NotImplementedException(error instanceof Error ? error.message : String(error));
|
|
1663
|
+
}
|
|
1664
|
+
throw error;
|
|
1665
|
+
}
|
|
1666
|
+
__name(notSupportedByServer, "notSupportedByServer");
|
|
1564
1667
|
|
|
1565
1668
|
// src/server/durable-auth.controller.ts
|
|
1566
|
-
import { BadRequestException as
|
|
1669
|
+
import { BadRequestException as BadRequestException3, Body as Body2, Controller as Controller3, Get as Get3, Header as Header3, HttpCode, Inject as Inject4, Logger as Logger2, NotFoundException as NotFoundException3, Optional as Optional3, Post as Post2, Req, Res as Res2, UnauthorizedException } from "@nestjs/common";
|
|
1567
1670
|
|
|
1568
1671
|
// src/server/auth/dashboard-auth-config.ts
|
|
1569
1672
|
var DASHBOARD_AUTH = Symbol("DASHBOARD_AUTH");
|
|
@@ -2346,7 +2449,7 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2346
2449
|
const auth = this.requireAuth();
|
|
2347
2450
|
if (!auth.modes.includes("login")) throw new NotFoundException3();
|
|
2348
2451
|
if (!isString(body?.username) || !isString(body?.password)) {
|
|
2349
|
-
throw new
|
|
2452
|
+
throw new BadRequestException3("Body must include string `username` and `password`.");
|
|
2350
2453
|
}
|
|
2351
2454
|
const { username, password } = body;
|
|
2352
2455
|
const user = await this.runHook("login", () => auth.login?.(username, password) ?? null);
|