@duraflows/nestjs 6.0.0 → 7.0.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/cjs/filters/workflow-exception.filter.js +2 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/services/workflow.service.d.ts +2 -1
- package/dist/cjs/services/workflow.service.js +3 -0
- package/dist/cjs/workflow.module.d.ts +16 -1
- package/dist/cjs/workflow.module.js +2 -0
- package/dist/filters/workflow-exception.filter.js +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/services/workflow.service.d.ts +2 -1
- package/dist/services/workflow.service.js +3 -0
- package/dist/workflow.module.d.ts +16 -1
- package/dist/workflow.module.js +2 -0
- package/package.json +3 -3
|
@@ -28,7 +28,8 @@ let WorkflowExceptionFilter = WorkflowExceptionFilter_1 = class WorkflowExceptio
|
|
|
28
28
|
});
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
// Both mean the instance's state doesn't fit the governing definition.
|
|
32
|
+
if (exception instanceof core_1.InvalidEventError || exception instanceof core_1.IncompatibleDefinitionError) {
|
|
32
33
|
response.status(common_1.HttpStatus.CONFLICT).send({
|
|
33
34
|
statusCode: common_1.HttpStatus.CONFLICT,
|
|
34
35
|
error: "Conflict",
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ export { WorkflowQueryController } from "./controllers/workflow-query.controller
|
|
|
12
12
|
export { WorkflowTimeoutController } from "./controllers/workflow-timeout.controller.js";
|
|
13
13
|
export { WorkflowExceptionFilter } from "./filters/workflow-exception.filter.js";
|
|
14
14
|
export { TriggerEventDto, TriggerEventParamsDto, HistoryQueryDto, HistoryParamsDto, AvailableEventsParamsDto, TimeoutProcessQueryDto, CreateInstanceDto, } from "./controllers/dto/index.js";
|
|
15
|
-
export type { WorkflowDefinition, WorkflowStateDefinition, WorkflowEventDefinition, WorkflowOnEnterDefinition, WorkflowCommandRef, WorkflowTimeoutDefinition, CommandResult, WorkflowExecutionContext, WorkflowInstance, WorkflowExecutionResult, AvailableWorkflowEvent, CreateWorkflowInstanceInput, TriggerWorkflowEventInput, ProcessExpiredWorkflowsInput, ProcessExpiredWorkflowsResult, GetAvailableEventsInput, WorkflowInstanceStore, WorkflowHistoryStore, WorkflowHistoryRecord, WorkflowTransactionRunner, WorkflowClock, WorkflowPersistenceProvider, WorkflowDefinitionRegistry, WorkflowCommandRegistry, ValidationResult, ValidationError, CompiledWorkflow, OnEnterChainResult, OnEnterHopResult, WorkflowRuntimeClient, } from "@duraflows/core";
|
|
16
|
-
export { WorkflowError, WorkflowDefinitionError, WorkflowInstanceNotFoundError, InvalidEventError, CommandFailureError, OnEnterDepthExceededError, WorkflowValidator, WorkflowCompiler, CommandExecutor, EventExecutor, OnEnterExecutor, TimeoutResolver, WorkflowRuntime, WorkflowHandle, InMemoryDefinitionRegistry, InMemoryCommandRegistry, InMemoryGuardRegistry, } from "@duraflows/core";
|
|
15
|
+
export type { WorkflowDefinition, WorkflowStateDefinition, WorkflowEventDefinition, WorkflowOnEnterDefinition, WorkflowCommandRef, WorkflowTimeoutDefinition, CommandResult, WorkflowExecutionContext, WorkflowInstance, WorkflowExecutionResult, AvailableWorkflowEvent, CreateWorkflowInstanceInput, TriggerWorkflowEventInput, ProcessExpiredWorkflowsInput, ProcessExpiredWorkflowsResult, FindParkedTimeoutsInput, WorkflowTimeoutRetry, WorkflowTimeoutRetryOptions, GetAvailableEventsInput, WorkflowInstanceStore, WorkflowHistoryStore, WorkflowHistoryRecord, DefinitionVersionSummary, WorkflowTransactionRunner, WorkflowClock, WorkflowPersistenceProvider, WorkflowDefinitionRegistry, WorkflowCommandRegistry, ValidationResult, ValidationError, CompiledWorkflow, OnEnterChainResult, OnEnterHopResult, WorkflowRuntimeClient, } from "@duraflows/core";
|
|
16
|
+
export { WorkflowError, WorkflowDefinitionError, WorkflowInstanceNotFoundError, InvalidEventError, IncompatibleDefinitionError, CommandFailureError, OnEnterDepthExceededError, WorkflowValidator, WorkflowCompiler, CommandExecutor, EventExecutor, OnEnterExecutor, TimeoutResolver, WorkflowRuntime, WorkflowHandle, InMemoryDefinitionRegistry, InMemoryCommandRegistry, InMemoryGuardRegistry, } from "@duraflows/core";
|
|
17
17
|
export type { WorkflowObserver, StateEnterEvent, ObserverErrorHandler } from "@duraflows/core";
|
|
18
18
|
export type { WorkflowGuard, WorkflowGuardRef, WorkflowGuardRegistry } from "@duraflows/core";
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InMemoryGuardRegistry = exports.InMemoryCommandRegistry = exports.InMemoryDefinitionRegistry = exports.WorkflowHandle = exports.WorkflowRuntime = exports.TimeoutResolver = exports.OnEnterExecutor = exports.EventExecutor = exports.CommandExecutor = exports.WorkflowCompiler = exports.WorkflowValidator = exports.OnEnterDepthExceededError = exports.CommandFailureError = exports.InvalidEventError = exports.WorkflowInstanceNotFoundError = exports.WorkflowDefinitionError = exports.WorkflowError = exports.CreateInstanceDto = exports.TimeoutProcessQueryDto = exports.AvailableEventsParamsDto = exports.HistoryParamsDto = exports.HistoryQueryDto = exports.TriggerEventParamsDto = exports.TriggerEventDto = exports.WorkflowExceptionFilter = exports.WorkflowTimeoutController = exports.WorkflowQueryController = exports.WorkflowEventController = exports.WorkflowInstanceController = exports.WORKFLOW_COMMAND_METADATA_KEY = exports.WorkflowCommand = exports.NestCommandRegistry = exports.WORKFLOW_DEFINITION_STORE = exports.WORKFLOW_CLOCK = exports.WORKFLOW_TRANSACTION_RUNNER = exports.WORKFLOW_DEFINITION_REGISTRY = exports.WORKFLOW_GUARD_REGISTRY = exports.WORKFLOW_COMMAND_REGISTRY = exports.WORKFLOW_HISTORY_STORE = exports.WORKFLOW_INSTANCE_STORE = exports.WORKFLOW_RUNTIME = exports.WorkflowTimeoutService = exports.WorkflowService = exports.WorkflowModule = void 0;
|
|
3
|
+
exports.InMemoryGuardRegistry = exports.InMemoryCommandRegistry = exports.InMemoryDefinitionRegistry = exports.WorkflowHandle = exports.WorkflowRuntime = exports.TimeoutResolver = exports.OnEnterExecutor = exports.EventExecutor = exports.CommandExecutor = exports.WorkflowCompiler = exports.WorkflowValidator = exports.OnEnterDepthExceededError = exports.CommandFailureError = exports.IncompatibleDefinitionError = exports.InvalidEventError = exports.WorkflowInstanceNotFoundError = exports.WorkflowDefinitionError = exports.WorkflowError = exports.CreateInstanceDto = exports.TimeoutProcessQueryDto = exports.AvailableEventsParamsDto = exports.HistoryParamsDto = exports.HistoryQueryDto = exports.TriggerEventParamsDto = exports.TriggerEventDto = exports.WorkflowExceptionFilter = exports.WorkflowTimeoutController = exports.WorkflowQueryController = exports.WorkflowEventController = exports.WorkflowInstanceController = exports.WORKFLOW_COMMAND_METADATA_KEY = exports.WorkflowCommand = exports.NestCommandRegistry = exports.WORKFLOW_DEFINITION_STORE = exports.WORKFLOW_CLOCK = exports.WORKFLOW_TRANSACTION_RUNNER = exports.WORKFLOW_DEFINITION_REGISTRY = exports.WORKFLOW_GUARD_REGISTRY = exports.WORKFLOW_COMMAND_REGISTRY = exports.WORKFLOW_HISTORY_STORE = exports.WORKFLOW_INSTANCE_STORE = exports.WORKFLOW_RUNTIME = exports.WorkflowTimeoutService = exports.WorkflowService = exports.WorkflowModule = void 0;
|
|
4
4
|
// Module
|
|
5
5
|
var workflow_module_js_1 = require("./workflow.module.js");
|
|
6
6
|
Object.defineProperty(exports, "WorkflowModule", { enumerable: true, get: function () { return workflow_module_js_1.WorkflowModule; } });
|
|
@@ -52,6 +52,7 @@ Object.defineProperty(exports, "WorkflowError", { enumerable: true, get: functio
|
|
|
52
52
|
Object.defineProperty(exports, "WorkflowDefinitionError", { enumerable: true, get: function () { return core_1.WorkflowDefinitionError; } });
|
|
53
53
|
Object.defineProperty(exports, "WorkflowInstanceNotFoundError", { enumerable: true, get: function () { return core_1.WorkflowInstanceNotFoundError; } });
|
|
54
54
|
Object.defineProperty(exports, "InvalidEventError", { enumerable: true, get: function () { return core_1.InvalidEventError; } });
|
|
55
|
+
Object.defineProperty(exports, "IncompatibleDefinitionError", { enumerable: true, get: function () { return core_1.IncompatibleDefinitionError; } });
|
|
55
56
|
Object.defineProperty(exports, "CommandFailureError", { enumerable: true, get: function () { return core_1.CommandFailureError; } });
|
|
56
57
|
Object.defineProperty(exports, "OnEnterDepthExceededError", { enumerable: true, get: function () { return core_1.OnEnterDepthExceededError; } });
|
|
57
58
|
Object.defineProperty(exports, "WorkflowValidator", { enumerable: true, get: function () { return core_1.WorkflowValidator; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkflowHandle } from "@duraflows/core";
|
|
2
|
-
import type { WorkflowRuntime, CreateWorkflowInstanceInput, TriggerWorkflowEventInput, GetAvailableEventsInput, WorkflowDefinition, WorkflowInstance, WorkflowExecutionResult, AvailableWorkflowEvent, WorkflowHistoryRecord } from "@duraflows/core";
|
|
2
|
+
import type { WorkflowRuntime, CreateWorkflowInstanceInput, TriggerWorkflowEventInput, GetAvailableEventsInput, WorkflowDefinition, WorkflowInstance, WorkflowExecutionResult, AvailableWorkflowEvent, WorkflowHistoryRecord, DefinitionVersionSummary } from "@duraflows/core";
|
|
3
3
|
export declare class WorkflowService {
|
|
4
4
|
private readonly runtime;
|
|
5
5
|
constructor(runtime: WorkflowRuntime);
|
|
@@ -32,6 +32,7 @@ export declare class WorkflowService {
|
|
|
32
32
|
limit?: number;
|
|
33
33
|
offset?: number;
|
|
34
34
|
}): Promise<WorkflowHistoryRecord[]>;
|
|
35
|
+
listDefinitionVersions(workflowName: string): Promise<DefinitionVersionSummary[]>;
|
|
35
36
|
getHandle(uuid: string): WorkflowHandle;
|
|
36
37
|
}
|
|
37
38
|
//# sourceMappingURL=workflow.service.d.ts.map
|
|
@@ -71,6 +71,9 @@ let WorkflowService = class WorkflowService {
|
|
|
71
71
|
async getHistory(workflowInstanceUuid, options) {
|
|
72
72
|
return this.runtime.getHistory(workflowInstanceUuid, options);
|
|
73
73
|
}
|
|
74
|
+
async listDefinitionVersions(workflowName) {
|
|
75
|
+
return this.runtime.listDefinitionVersions(workflowName);
|
|
76
|
+
}
|
|
74
77
|
getHandle(uuid) {
|
|
75
78
|
return new core_1.WorkflowHandle(uuid, this);
|
|
76
79
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DynamicModule, type Type, type InjectionToken, type OptionalFactoryDependency } from "@nestjs/common";
|
|
2
|
-
import type { WorkflowDefinition, WorkflowClock, WorkflowPersistenceProvider, WorkflowObserver, ObserverErrorHandler, WorkflowGuard, WorkflowGuardRegistry } from "@duraflows/core";
|
|
2
|
+
import type { WorkflowDefinition, WorkflowClock, WorkflowPersistenceProvider, WorkflowObserver, ObserverErrorHandler, WorkflowGuard, WorkflowGuardRegistry, WorkflowTimeoutRetryOptions } from "@duraflows/core";
|
|
3
3
|
import { type WorkflowCommandRegistration } from "./providers/nest-command-registry.js";
|
|
4
4
|
export interface WorkflowModuleOptions {
|
|
5
5
|
workflows: WorkflowDefinition[];
|
|
@@ -10,6 +10,17 @@ export interface WorkflowModuleOptions {
|
|
|
10
10
|
onObserverError?: ObserverErrorHandler;
|
|
11
11
|
persistence: WorkflowPersistenceProvider;
|
|
12
12
|
clock?: WorkflowClock;
|
|
13
|
+
/**
|
|
14
|
+
* How `processExpiredWorkflows` retries an instance whose timeout processing
|
|
15
|
+
* fails: exponential backoff, then parking. Defaults apply when omitted.
|
|
16
|
+
*/
|
|
17
|
+
timeoutRetry?: WorkflowTimeoutRetryOptions;
|
|
18
|
+
/**
|
|
19
|
+
* What module init does when a stored definition version that still has
|
|
20
|
+
* active instances references an unregistered command or guard: `"fail"`
|
|
21
|
+
* (default) fails application startup, `"warn"` logs and continues.
|
|
22
|
+
*/
|
|
23
|
+
onUnresolvable?: "fail" | "warn";
|
|
13
24
|
enableControllers?: boolean;
|
|
14
25
|
}
|
|
15
26
|
export interface WorkflowModuleFactoryConfig {
|
|
@@ -20,6 +31,10 @@ export interface WorkflowModuleFactoryConfig {
|
|
|
20
31
|
guardRegistry?: WorkflowGuardRegistry;
|
|
21
32
|
observers?: WorkflowObserver[];
|
|
22
33
|
onObserverError?: ObserverErrorHandler;
|
|
34
|
+
/** See {@link WorkflowModuleOptions.timeoutRetry}. */
|
|
35
|
+
timeoutRetry?: WorkflowTimeoutRetryOptions;
|
|
36
|
+
/** See {@link WorkflowModuleOptions.onUnresolvable}. */
|
|
37
|
+
onUnresolvable?: "fail" | "warn";
|
|
23
38
|
}
|
|
24
39
|
export interface WorkflowModuleAsyncOptions<TArgs extends unknown[] = unknown[]> {
|
|
25
40
|
imports?: Type<unknown>[];
|
|
@@ -153,6 +153,8 @@ function buildWorkflowProviders(explicitCommands) {
|
|
|
153
153
|
definitionStore: definitionStore ?? undefined,
|
|
154
154
|
observers: config.observers,
|
|
155
155
|
onObserverError: config.onObserverError,
|
|
156
|
+
timeoutRetry: config.timeoutRetry,
|
|
157
|
+
onUnresolvable: config.onUnresolvable,
|
|
156
158
|
}),
|
|
157
159
|
inject: [
|
|
158
160
|
injection_tokens_js_1.WORKFLOW_MODULE_OPTIONS,
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
var WorkflowExceptionFilter_1;
|
|
8
8
|
import { Catch, HttpStatus, Logger } from "@nestjs/common";
|
|
9
|
-
import { WorkflowError, WorkflowInstanceNotFoundError, InvalidEventError, InvalidArgumentError } from "@duraflows/core";
|
|
9
|
+
import { WorkflowError, WorkflowInstanceNotFoundError, InvalidEventError, InvalidArgumentError, IncompatibleDefinitionError, } from "@duraflows/core";
|
|
10
10
|
/**
|
|
11
11
|
* Maps duraflows domain errors to HTTP statuses for the optional REST
|
|
12
12
|
* controllers. Without this filter, a missing instance or an event invalid
|
|
@@ -25,7 +25,8 @@ let WorkflowExceptionFilter = WorkflowExceptionFilter_1 = class WorkflowExceptio
|
|
|
25
25
|
});
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
// Both mean the instance's state doesn't fit the governing definition.
|
|
29
|
+
if (exception instanceof InvalidEventError || exception instanceof IncompatibleDefinitionError) {
|
|
29
30
|
response.status(HttpStatus.CONFLICT).send({
|
|
30
31
|
statusCode: HttpStatus.CONFLICT,
|
|
31
32
|
error: "Conflict",
|
package/dist/index.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ export { WorkflowQueryController } from "./controllers/workflow-query.controller
|
|
|
12
12
|
export { WorkflowTimeoutController } from "./controllers/workflow-timeout.controller.js";
|
|
13
13
|
export { WorkflowExceptionFilter } from "./filters/workflow-exception.filter.js";
|
|
14
14
|
export { TriggerEventDto, TriggerEventParamsDto, HistoryQueryDto, HistoryParamsDto, AvailableEventsParamsDto, TimeoutProcessQueryDto, CreateInstanceDto, } from "./controllers/dto/index.js";
|
|
15
|
-
export type { WorkflowDefinition, WorkflowStateDefinition, WorkflowEventDefinition, WorkflowOnEnterDefinition, WorkflowCommandRef, WorkflowTimeoutDefinition, CommandResult, WorkflowExecutionContext, WorkflowInstance, WorkflowExecutionResult, AvailableWorkflowEvent, CreateWorkflowInstanceInput, TriggerWorkflowEventInput, ProcessExpiredWorkflowsInput, ProcessExpiredWorkflowsResult, GetAvailableEventsInput, WorkflowInstanceStore, WorkflowHistoryStore, WorkflowHistoryRecord, WorkflowTransactionRunner, WorkflowClock, WorkflowPersistenceProvider, WorkflowDefinitionRegistry, WorkflowCommandRegistry, ValidationResult, ValidationError, CompiledWorkflow, OnEnterChainResult, OnEnterHopResult, WorkflowRuntimeClient, } from "@duraflows/core";
|
|
16
|
-
export { WorkflowError, WorkflowDefinitionError, WorkflowInstanceNotFoundError, InvalidEventError, CommandFailureError, OnEnterDepthExceededError, WorkflowValidator, WorkflowCompiler, CommandExecutor, EventExecutor, OnEnterExecutor, TimeoutResolver, WorkflowRuntime, WorkflowHandle, InMemoryDefinitionRegistry, InMemoryCommandRegistry, InMemoryGuardRegistry, } from "@duraflows/core";
|
|
15
|
+
export type { WorkflowDefinition, WorkflowStateDefinition, WorkflowEventDefinition, WorkflowOnEnterDefinition, WorkflowCommandRef, WorkflowTimeoutDefinition, CommandResult, WorkflowExecutionContext, WorkflowInstance, WorkflowExecutionResult, AvailableWorkflowEvent, CreateWorkflowInstanceInput, TriggerWorkflowEventInput, ProcessExpiredWorkflowsInput, ProcessExpiredWorkflowsResult, FindParkedTimeoutsInput, WorkflowTimeoutRetry, WorkflowTimeoutRetryOptions, GetAvailableEventsInput, WorkflowInstanceStore, WorkflowHistoryStore, WorkflowHistoryRecord, DefinitionVersionSummary, WorkflowTransactionRunner, WorkflowClock, WorkflowPersistenceProvider, WorkflowDefinitionRegistry, WorkflowCommandRegistry, ValidationResult, ValidationError, CompiledWorkflow, OnEnterChainResult, OnEnterHopResult, WorkflowRuntimeClient, } from "@duraflows/core";
|
|
16
|
+
export { WorkflowError, WorkflowDefinitionError, WorkflowInstanceNotFoundError, InvalidEventError, IncompatibleDefinitionError, CommandFailureError, OnEnterDepthExceededError, WorkflowValidator, WorkflowCompiler, CommandExecutor, EventExecutor, OnEnterExecutor, TimeoutResolver, WorkflowRuntime, WorkflowHandle, InMemoryDefinitionRegistry, InMemoryCommandRegistry, InMemoryGuardRegistry, } from "@duraflows/core";
|
|
17
17
|
export type { WorkflowObserver, StateEnterEvent, ObserverErrorHandler } from "@duraflows/core";
|
|
18
18
|
export type { WorkflowGuard, WorkflowGuardRef, WorkflowGuardRegistry } from "@duraflows/core";
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -17,5 +17,5 @@ export { WorkflowTimeoutController } from "./controllers/workflow-timeout.contro
|
|
|
17
17
|
export { WorkflowExceptionFilter } from "./filters/workflow-exception.filter.js";
|
|
18
18
|
// DTOs
|
|
19
19
|
export { TriggerEventDto, TriggerEventParamsDto, HistoryQueryDto, HistoryParamsDto, AvailableEventsParamsDto, TimeoutProcessQueryDto, CreateInstanceDto, } from "./controllers/dto/index.js";
|
|
20
|
-
export { WorkflowError, WorkflowDefinitionError, WorkflowInstanceNotFoundError, InvalidEventError, CommandFailureError, OnEnterDepthExceededError, WorkflowValidator, WorkflowCompiler, CommandExecutor, EventExecutor, OnEnterExecutor, TimeoutResolver, WorkflowRuntime, WorkflowHandle, InMemoryDefinitionRegistry, InMemoryCommandRegistry, InMemoryGuardRegistry, } from "@duraflows/core";
|
|
20
|
+
export { WorkflowError, WorkflowDefinitionError, WorkflowInstanceNotFoundError, InvalidEventError, IncompatibleDefinitionError, CommandFailureError, OnEnterDepthExceededError, WorkflowValidator, WorkflowCompiler, CommandExecutor, EventExecutor, OnEnterExecutor, TimeoutResolver, WorkflowRuntime, WorkflowHandle, InMemoryDefinitionRegistry, InMemoryCommandRegistry, InMemoryGuardRegistry, } from "@duraflows/core";
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkflowHandle } from "@duraflows/core";
|
|
2
|
-
import type { WorkflowRuntime, CreateWorkflowInstanceInput, TriggerWorkflowEventInput, GetAvailableEventsInput, WorkflowDefinition, WorkflowInstance, WorkflowExecutionResult, AvailableWorkflowEvent, WorkflowHistoryRecord } from "@duraflows/core";
|
|
2
|
+
import type { WorkflowRuntime, CreateWorkflowInstanceInput, TriggerWorkflowEventInput, GetAvailableEventsInput, WorkflowDefinition, WorkflowInstance, WorkflowExecutionResult, AvailableWorkflowEvent, WorkflowHistoryRecord, DefinitionVersionSummary } from "@duraflows/core";
|
|
3
3
|
export declare class WorkflowService {
|
|
4
4
|
private readonly runtime;
|
|
5
5
|
constructor(runtime: WorkflowRuntime);
|
|
@@ -32,6 +32,7 @@ export declare class WorkflowService {
|
|
|
32
32
|
limit?: number;
|
|
33
33
|
offset?: number;
|
|
34
34
|
}): Promise<WorkflowHistoryRecord[]>;
|
|
35
|
+
listDefinitionVersions(workflowName: string): Promise<DefinitionVersionSummary[]>;
|
|
35
36
|
getHandle(uuid: string): WorkflowHandle;
|
|
36
37
|
}
|
|
37
38
|
//# sourceMappingURL=workflow.service.d.ts.map
|
|
@@ -68,6 +68,9 @@ let WorkflowService = class WorkflowService {
|
|
|
68
68
|
async getHistory(workflowInstanceUuid, options) {
|
|
69
69
|
return this.runtime.getHistory(workflowInstanceUuid, options);
|
|
70
70
|
}
|
|
71
|
+
async listDefinitionVersions(workflowName) {
|
|
72
|
+
return this.runtime.listDefinitionVersions(workflowName);
|
|
73
|
+
}
|
|
71
74
|
getHandle(uuid) {
|
|
72
75
|
return new WorkflowHandle(uuid, this);
|
|
73
76
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DynamicModule, type Type, type InjectionToken, type OptionalFactoryDependency } from "@nestjs/common";
|
|
2
|
-
import type { WorkflowDefinition, WorkflowClock, WorkflowPersistenceProvider, WorkflowObserver, ObserverErrorHandler, WorkflowGuard, WorkflowGuardRegistry } from "@duraflows/core";
|
|
2
|
+
import type { WorkflowDefinition, WorkflowClock, WorkflowPersistenceProvider, WorkflowObserver, ObserverErrorHandler, WorkflowGuard, WorkflowGuardRegistry, WorkflowTimeoutRetryOptions } from "@duraflows/core";
|
|
3
3
|
import { type WorkflowCommandRegistration } from "./providers/nest-command-registry.js";
|
|
4
4
|
export interface WorkflowModuleOptions {
|
|
5
5
|
workflows: WorkflowDefinition[];
|
|
@@ -10,6 +10,17 @@ export interface WorkflowModuleOptions {
|
|
|
10
10
|
onObserverError?: ObserverErrorHandler;
|
|
11
11
|
persistence: WorkflowPersistenceProvider;
|
|
12
12
|
clock?: WorkflowClock;
|
|
13
|
+
/**
|
|
14
|
+
* How `processExpiredWorkflows` retries an instance whose timeout processing
|
|
15
|
+
* fails: exponential backoff, then parking. Defaults apply when omitted.
|
|
16
|
+
*/
|
|
17
|
+
timeoutRetry?: WorkflowTimeoutRetryOptions;
|
|
18
|
+
/**
|
|
19
|
+
* What module init does when a stored definition version that still has
|
|
20
|
+
* active instances references an unregistered command or guard: `"fail"`
|
|
21
|
+
* (default) fails application startup, `"warn"` logs and continues.
|
|
22
|
+
*/
|
|
23
|
+
onUnresolvable?: "fail" | "warn";
|
|
13
24
|
enableControllers?: boolean;
|
|
14
25
|
}
|
|
15
26
|
export interface WorkflowModuleFactoryConfig {
|
|
@@ -20,6 +31,10 @@ export interface WorkflowModuleFactoryConfig {
|
|
|
20
31
|
guardRegistry?: WorkflowGuardRegistry;
|
|
21
32
|
observers?: WorkflowObserver[];
|
|
22
33
|
onObserverError?: ObserverErrorHandler;
|
|
34
|
+
/** See {@link WorkflowModuleOptions.timeoutRetry}. */
|
|
35
|
+
timeoutRetry?: WorkflowTimeoutRetryOptions;
|
|
36
|
+
/** See {@link WorkflowModuleOptions.onUnresolvable}. */
|
|
37
|
+
onUnresolvable?: "fail" | "warn";
|
|
23
38
|
}
|
|
24
39
|
export interface WorkflowModuleAsyncOptions<TArgs extends unknown[] = unknown[]> {
|
|
25
40
|
imports?: Type<unknown>[];
|
package/dist/workflow.module.js
CHANGED
|
@@ -150,6 +150,8 @@ function buildWorkflowProviders(explicitCommands) {
|
|
|
150
150
|
definitionStore: definitionStore ?? undefined,
|
|
151
151
|
observers: config.observers,
|
|
152
152
|
onObserverError: config.onObserverError,
|
|
153
|
+
timeoutRetry: config.timeoutRetry,
|
|
154
|
+
onUnresolvable: config.onUnresolvable,
|
|
153
155
|
}),
|
|
154
156
|
inject: [
|
|
155
157
|
WORKFLOW_MODULE_OPTIONS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duraflows/nestjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "NestJS integration for duraflows: dependency injection, services, optional REST controllers, and @WorkflowCommand decorator for DI-backed command handlers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"duraflows",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"class-validator": "^0.15.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@duraflows/core": "^
|
|
57
|
+
"@duraflows/core": "^7.0.0",
|
|
58
58
|
"@nestjs/common": "^11.0.0 || ^12.0.0",
|
|
59
59
|
"@nestjs/core": "^11.0.0 || ^12.0.0",
|
|
60
60
|
"reflect-metadata": "^0.2.0"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@nestjs/platform-express": "^12.1.0",
|
|
66
66
|
"@nestjs/testing": "^12.1.0",
|
|
67
67
|
"reflect-metadata": "^0.2.2",
|
|
68
|
-
"@duraflows/core": "
|
|
68
|
+
"@duraflows/core": "7.0.0"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "tsc --build"
|