@lssm/example.workflow-system 0.0.0-canary-20251217083314 → 1.41.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/approval/approval.contracts.js +1 -250
- package/dist/approval/approval.enum.js +1 -29
- package/dist/approval/approval.event.js +1 -186
- package/dist/approval/approval.handler.js +1 -71
- package/dist/approval/approval.schema.js +1 -111
- package/dist/approval/index.js +1 -6
- package/dist/docs/index.js +1 -1
- package/dist/docs/workflow-system.docblock.js +5 -61
- package/dist/entities/approval.js +1 -128
- package/dist/entities/index.js +1 -31
- package/dist/entities/instance.js +1 -168
- package/dist/entities/step.js +1 -135
- package/dist/entities/workflow.js +1 -102
- package/dist/example.js +1 -50
- package/dist/index.js +1 -19
- package/dist/instance/index.js +1 -6
- package/dist/instance/instance.contracts.js +1 -334
- package/dist/instance/instance.enum.js +1 -20
- package/dist/instance/instance.event.js +1 -214
- package/dist/instance/instance.handler.js +1 -93
- package/dist/instance/instance.schema.js +1 -173
- package/dist/presentations/index.js +1 -291
- package/dist/shared/index.js +1 -3
- package/dist/shared/mock-data.js +1 -11
- package/dist/state-machine/index.js +1 -157
- package/dist/workflow/index.js +1 -6
- package/dist/workflow/workflow.contracts.js +1 -239
- package/dist/workflow/workflow.enum.js +1 -47
- package/dist/workflow/workflow.event.js +1 -116
- package/dist/workflow/workflow.handler.js +1 -65
- package/dist/workflow/workflow.schema.js +1 -250
- package/dist/workflow-system.feature.js +1 -337
- package/package.json +44 -44
- package/dist/approval/approval.contracts.d.ts +0 -534
- package/dist/approval/approval.enum.d.ts +0 -13
- package/dist/approval/approval.event.d.ts +0 -130
- package/dist/approval/approval.handler.d.ts +0 -22
- package/dist/approval/approval.schema.d.ts +0 -99
- package/dist/approval/index.d.ts +0 -5
- package/dist/docs/index.d.ts +0 -1
- package/dist/docs/workflow-system.docblock.d.ts +0 -1
- package/dist/entities/approval.d.ts +0 -57
- package/dist/entities/index.d.ts +0 -138
- package/dist/entities/instance.d.ts +0 -68
- package/dist/entities/step.d.ts +0 -49
- package/dist/entities/workflow.d.ts +0 -40
- package/dist/example.d.ts +0 -39
- package/dist/index.d.ts +0 -16
- package/dist/instance/index.d.ts +0 -5
- package/dist/instance/instance.contracts.d.ts +0 -1023
- package/dist/instance/instance.enum.d.ts +0 -9
- package/dist/instance/instance.event.d.ts +0 -355
- package/dist/instance/instance.handler.d.ts +0 -26
- package/dist/instance/instance.schema.d.ts +0 -222
- package/dist/libs/contracts/dist/capabilities/openbanking.js +0 -88
- package/dist/libs/contracts/dist/client/index.js +0 -5
- package/dist/libs/contracts/dist/client/react/feature-render.js +0 -2
- package/dist/libs/contracts/dist/client/react/form-render.js +0 -4
- package/dist/libs/contracts/dist/client/react/index.js +0 -4
- package/dist/libs/contracts/dist/contract-registry/index.js +0 -1
- package/dist/libs/contracts/dist/contract-registry/schemas.js +0 -60
- package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/index.js +0 -29
- package/dist/libs/contracts/dist/docs/presentations.js +0 -71
- package/dist/libs/contracts/dist/docs/registry.js +0 -44
- package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
- package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
- package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
- package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
- package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
- package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
- package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
- package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
- package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
- package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
- package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
- package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
- package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
- package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
- package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
- package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
- package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
- package/dist/libs/contracts/dist/events.js +0 -10
- package/dist/libs/contracts/dist/experiments/evaluator.js +0 -1
- package/dist/libs/contracts/dist/index.js +0 -71
- package/dist/libs/contracts/dist/install.js +0 -2
- package/dist/libs/contracts/dist/integrations/contracts.js +0 -377
- package/dist/libs/contracts/dist/integrations/index.js +0 -18
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +0 -242
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +0 -13
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +0 -52
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +0 -75
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +0 -87
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +0 -66
- package/dist/libs/contracts/dist/integrations/providers/index.js +0 -11
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +0 -68
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +0 -68
- package/dist/libs/contracts/dist/integrations/providers/powens.js +0 -116
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +0 -73
- package/dist/libs/contracts/dist/integrations/providers/registry.js +0 -10
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +0 -83
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +0 -61
- package/dist/libs/contracts/dist/jsonschema.js +0 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js +0 -306
- package/dist/libs/contracts/dist/knowledge/index.js +0 -7
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +0 -6
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +0 -37
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
- package/dist/libs/contracts/dist/llm/exporters.js +0 -19
- package/dist/libs/contracts/dist/llm/index.js +0 -2
- package/dist/libs/contracts/dist/llm/prompts.js +0 -1
- package/dist/libs/contracts/dist/onboarding-base.js +0 -196
- package/dist/libs/contracts/dist/openapi.js +0 -1
- package/dist/libs/contracts/dist/ownership.js +0 -21
- package/dist/libs/contracts/dist/presentations.js +0 -1
- package/dist/libs/contracts/dist/presentations.v2.js +0 -11
- package/dist/libs/contracts/dist/prompt.js +0 -1
- package/dist/libs/contracts/dist/promptRegistry.js +0 -1
- package/dist/libs/contracts/dist/regenerator/index.js +0 -1
- package/dist/libs/contracts/dist/regenerator/service.js +0 -6
- package/dist/libs/contracts/dist/registry.js +0 -2
- package/dist/libs/contracts/dist/resources.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +0 -2
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +0 -49
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +0 -39
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +0 -2
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/index.js +0 -6
- package/dist/libs/contracts/dist/server/graphql-pothos.js +0 -6
- package/dist/libs/contracts/dist/server/index.js +0 -8
- package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +0 -4
- package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +0 -2
- package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +0 -1
- package/dist/libs/contracts/dist/server/mcp/registerResources.js +0 -2
- package/dist/libs/contracts/dist/server/mcp/registerTools.js +0 -1
- package/dist/libs/contracts/dist/server/provider-mcp.js +0 -1
- package/dist/libs/contracts/dist/server/rest-elysia.js +0 -1
- package/dist/libs/contracts/dist/server/rest-express.js +0 -1
- package/dist/libs/contracts/dist/server/rest-generic.js +0 -1
- package/dist/libs/contracts/dist/server/rest-next-app.js +0 -1
- package/dist/libs/contracts/dist/server/rest-next-pages.js +0 -1
- package/dist/libs/contracts/dist/spec.js +0 -34
- package/dist/libs/contracts/dist/telemetry/index.js +0 -1
- package/dist/libs/contracts/dist/telemetry/tracker.js +0 -1
- package/dist/libs/contracts/dist/tests/index.js +0 -1
- package/dist/libs/contracts/dist/tests/runner.js +0 -2
- package/dist/libs/contracts/dist/workflow/index.js +0 -1
- package/dist/libs/contracts/dist/workflow/runner.js +0 -1
- package/dist/libs/schema/dist/EnumType.js +0 -56
- package/dist/libs/schema/dist/FieldType.js +0 -49
- package/dist/libs/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/libs/schema/dist/SchemaModel.js +0 -39
- package/dist/libs/schema/dist/entity/defineEntity.js +0 -236
- package/dist/libs/schema/dist/entity/index.js +0 -2
- package/dist/libs/schema/dist/entity/types.js +0 -1
- package/dist/libs/schema/dist/index.js +0 -6
- package/dist/presentations/index.d.ts +0 -63
- package/dist/shared/index.d.ts +0 -3
- package/dist/shared/mock-data.d.ts +0 -18
- package/dist/shared/types.d.ts +0 -80
- package/dist/state-machine/index.d.ts +0 -147
- package/dist/workflow/index.d.ts +0 -5
- package/dist/workflow/workflow.contracts.d.ts +0 -1010
- package/dist/workflow/workflow.enum.d.ts +0 -21
- package/dist/workflow/workflow.event.d.ts +0 -134
- package/dist/workflow/workflow.handler.d.ts +0 -28
- package/dist/workflow/workflow.schema.d.ts +0 -264
- package/dist/workflow-system.feature.d.ts +0 -11
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { PresentationDescriptorV2 } from "@lssm/lib.contracts";
|
|
2
|
-
|
|
3
|
-
//#region src/presentations/index.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Workflow designer canvas for building workflows.
|
|
7
|
-
*/
|
|
8
|
-
declare const WorkflowDesignerPresentation: PresentationDescriptorV2;
|
|
9
|
-
/**
|
|
10
|
-
* List of workflow definitions.
|
|
11
|
-
*/
|
|
12
|
-
declare const WorkflowListPresentation: PresentationDescriptorV2;
|
|
13
|
-
/**
|
|
14
|
-
* Workflow definition detail view.
|
|
15
|
-
*/
|
|
16
|
-
declare const WorkflowDetailPresentation: PresentationDescriptorV2;
|
|
17
|
-
/**
|
|
18
|
-
* List of running workflow instances.
|
|
19
|
-
*/
|
|
20
|
-
declare const InstanceListPresentation: PresentationDescriptorV2;
|
|
21
|
-
/**
|
|
22
|
-
* Workflow instance detail view with timeline.
|
|
23
|
-
*/
|
|
24
|
-
declare const InstanceDetailPresentation: PresentationDescriptorV2;
|
|
25
|
-
/**
|
|
26
|
-
* Workflow progress tracker widget.
|
|
27
|
-
*/
|
|
28
|
-
declare const ProgressTrackerPresentation: PresentationDescriptorV2;
|
|
29
|
-
/**
|
|
30
|
-
* Approval inbox - list of pending approvals.
|
|
31
|
-
*/
|
|
32
|
-
declare const ApprovalInboxPresentation: PresentationDescriptorV2;
|
|
33
|
-
/**
|
|
34
|
-
* Approval request detail view.
|
|
35
|
-
*/
|
|
36
|
-
declare const ApprovalDetailPresentation: PresentationDescriptorV2;
|
|
37
|
-
/**
|
|
38
|
-
* Approval decision form.
|
|
39
|
-
*/
|
|
40
|
-
declare const ApprovalFormPresentation: PresentationDescriptorV2;
|
|
41
|
-
/**
|
|
42
|
-
* Pending approvals count badge.
|
|
43
|
-
*/
|
|
44
|
-
declare const PendingApprovalsBadgePresentation: PresentationDescriptorV2;
|
|
45
|
-
/**
|
|
46
|
-
* Workflow metrics dashboard widget.
|
|
47
|
-
*/
|
|
48
|
-
declare const WorkflowMetricsPresentation: PresentationDescriptorV2;
|
|
49
|
-
declare const WorkflowSystemPresentations: {
|
|
50
|
-
WorkflowDesignerPresentation: PresentationDescriptorV2;
|
|
51
|
-
WorkflowListPresentation: PresentationDescriptorV2;
|
|
52
|
-
WorkflowDetailPresentation: PresentationDescriptorV2;
|
|
53
|
-
InstanceListPresentation: PresentationDescriptorV2;
|
|
54
|
-
InstanceDetailPresentation: PresentationDescriptorV2;
|
|
55
|
-
ProgressTrackerPresentation: PresentationDescriptorV2;
|
|
56
|
-
ApprovalInboxPresentation: PresentationDescriptorV2;
|
|
57
|
-
ApprovalDetailPresentation: PresentationDescriptorV2;
|
|
58
|
-
ApprovalFormPresentation: PresentationDescriptorV2;
|
|
59
|
-
PendingApprovalsBadgePresentation: PresentationDescriptorV2;
|
|
60
|
-
WorkflowMetricsPresentation: PresentationDescriptorV2;
|
|
61
|
-
};
|
|
62
|
-
//#endregion
|
|
63
|
-
export { ApprovalDetailPresentation, ApprovalFormPresentation, ApprovalInboxPresentation, InstanceDetailPresentation, InstanceListPresentation, PendingApprovalsBadgePresentation, ProgressTrackerPresentation, WorkflowDesignerPresentation, WorkflowDetailPresentation, WorkflowListPresentation, WorkflowMetricsPresentation, WorkflowSystemPresentations };
|
package/dist/shared/index.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ApprovalRequestRecord, HandlerContext, WorkflowDefinitionRecord, WorkflowInstanceRecord, WorkflowStepRecord } from "./types.js";
|
|
2
|
-
import { mockDataStore } from "./mock-data.js";
|
|
3
|
-
export { ApprovalRequestRecord, HandlerContext, WorkflowDefinitionRecord, WorkflowInstanceRecord, WorkflowStepRecord, mockDataStore };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ApprovalRequestRecord, WorkflowDefinitionRecord, WorkflowInstanceRecord, WorkflowStepRecord } from "./types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/shared/mock-data.d.ts
|
|
4
|
-
|
|
5
|
-
declare const mockDataStore: {
|
|
6
|
-
workflows: Map<string, WorkflowDefinitionRecord>;
|
|
7
|
-
steps: Map<string, WorkflowStepRecord>;
|
|
8
|
-
instances: Map<string, WorkflowInstanceRecord>;
|
|
9
|
-
approvals: Map<string, ApprovalRequestRecord>;
|
|
10
|
-
stepExecutions: Map<string, {
|
|
11
|
-
id: string;
|
|
12
|
-
instanceId: string;
|
|
13
|
-
stepId: string;
|
|
14
|
-
status: string;
|
|
15
|
-
}>;
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
export { mockDataStore };
|
package/dist/shared/types.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
//#region src/shared/types.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Shared types for workflow system handlers.
|
|
4
|
-
*/
|
|
5
|
-
interface WorkflowDefinitionRecord {
|
|
6
|
-
id: string;
|
|
7
|
-
key: string;
|
|
8
|
-
name: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
version: number;
|
|
11
|
-
status: 'DRAFT' | 'ACTIVE' | 'DEPRECATED' | 'ARCHIVED';
|
|
12
|
-
triggerType: 'MANUAL' | 'EVENT' | 'SCHEDULED' | 'API';
|
|
13
|
-
initialStepId?: string;
|
|
14
|
-
featureFlagKey?: string;
|
|
15
|
-
organizationId: string;
|
|
16
|
-
createdBy: string;
|
|
17
|
-
createdAt: Date;
|
|
18
|
-
updatedAt: Date;
|
|
19
|
-
publishedAt?: Date;
|
|
20
|
-
}
|
|
21
|
-
interface WorkflowStepRecord {
|
|
22
|
-
id: string;
|
|
23
|
-
workflowDefinitionId: string;
|
|
24
|
-
key: string;
|
|
25
|
-
name: string;
|
|
26
|
-
description?: string;
|
|
27
|
-
type: 'START' | 'APPROVAL' | 'TASK' | 'CONDITION' | 'PARALLEL' | 'WAIT' | 'ACTION' | 'END';
|
|
28
|
-
position: number;
|
|
29
|
-
transitions: Record<string, string>;
|
|
30
|
-
approvalMode?: 'ANY' | 'ALL' | 'MAJORITY' | 'SEQUENTIAL';
|
|
31
|
-
approverRoles: string[];
|
|
32
|
-
timeoutSeconds?: number;
|
|
33
|
-
createdAt: Date;
|
|
34
|
-
updatedAt: Date;
|
|
35
|
-
}
|
|
36
|
-
interface WorkflowInstanceRecord {
|
|
37
|
-
id: string;
|
|
38
|
-
workflowDefinitionId: string;
|
|
39
|
-
referenceId?: string;
|
|
40
|
-
referenceType?: string;
|
|
41
|
-
status: 'PENDING' | 'RUNNING' | 'WAITING' | 'PAUSED' | 'COMPLETED' | 'CANCELLED' | 'FAILED' | 'TIMEOUT';
|
|
42
|
-
currentStepId?: string;
|
|
43
|
-
contextData: Record<string, unknown>;
|
|
44
|
-
triggeredBy: string;
|
|
45
|
-
organizationId: string;
|
|
46
|
-
priority: number;
|
|
47
|
-
dueAt?: Date;
|
|
48
|
-
outcome?: string;
|
|
49
|
-
resultData?: Record<string, unknown>;
|
|
50
|
-
errorMessage?: string;
|
|
51
|
-
createdAt: Date;
|
|
52
|
-
updatedAt: Date;
|
|
53
|
-
startedAt?: Date;
|
|
54
|
-
completedAt?: Date;
|
|
55
|
-
}
|
|
56
|
-
interface ApprovalRequestRecord {
|
|
57
|
-
id: string;
|
|
58
|
-
workflowInstanceId: string;
|
|
59
|
-
stepExecutionId: string;
|
|
60
|
-
approverId: string;
|
|
61
|
-
approverRole?: string;
|
|
62
|
-
title: string;
|
|
63
|
-
description?: string;
|
|
64
|
-
status: 'PENDING' | 'APPROVED' | 'REJECTED' | 'DELEGATED' | 'ESCALATED' | 'WITHDRAWN' | 'EXPIRED';
|
|
65
|
-
decision?: 'APPROVE' | 'REJECT' | 'REQUEST_CHANGES' | 'DELEGATE' | 'ABSTAIN';
|
|
66
|
-
decisionComment?: string;
|
|
67
|
-
decidedAt?: Date;
|
|
68
|
-
dueAt?: Date;
|
|
69
|
-
contextSnapshot?: Record<string, unknown>;
|
|
70
|
-
sequenceOrder: number;
|
|
71
|
-
createdAt: Date;
|
|
72
|
-
updatedAt: Date;
|
|
73
|
-
}
|
|
74
|
-
interface HandlerContext {
|
|
75
|
-
userId: string;
|
|
76
|
-
userRoles: string[];
|
|
77
|
-
organizationId: string;
|
|
78
|
-
}
|
|
79
|
-
//#endregion
|
|
80
|
-
export { ApprovalRequestRecord, HandlerContext, WorkflowDefinitionRecord, WorkflowInstanceRecord, WorkflowStepRecord };
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
//#region src/state-machine/index.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Workflow State Machine Engine
|
|
4
|
-
*
|
|
5
|
-
* Provides state machine logic for workflow transitions.
|
|
6
|
-
* This is a spec-level abstraction that defines the interface
|
|
7
|
-
* for workflow state transitions.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Represents a transition definition in a workflow step.
|
|
11
|
-
*/
|
|
12
|
-
interface TransitionDefinition {
|
|
13
|
-
/** The action that triggers this transition (e.g., "approve", "reject") */
|
|
14
|
-
action: string;
|
|
15
|
-
/** The target step key to transition to */
|
|
16
|
-
targetStepKey: string;
|
|
17
|
-
/** Optional condition expression for conditional transitions */
|
|
18
|
-
condition?: string;
|
|
19
|
-
/** Optional guard roles - only users with these roles can take this action */
|
|
20
|
-
allowedRoles?: string[];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Step definition for state machine.
|
|
24
|
-
*/
|
|
25
|
-
interface StateMachineStep {
|
|
26
|
-
key: string;
|
|
27
|
-
name: string;
|
|
28
|
-
type: 'START' | 'APPROVAL' | 'TASK' | 'CONDITION' | 'PARALLEL' | 'WAIT' | 'ACTION' | 'END';
|
|
29
|
-
/** Map of action -> transition definition */
|
|
30
|
-
transitions: Record<string, string | TransitionDefinition>;
|
|
31
|
-
/** For approval steps: how approvals are handled */
|
|
32
|
-
approvalMode?: 'ANY' | 'ALL' | 'MAJORITY' | 'SEQUENTIAL';
|
|
33
|
-
/** Roles that can approve/act on this step */
|
|
34
|
-
allowedRoles?: string[];
|
|
35
|
-
/** Timeout in seconds */
|
|
36
|
-
timeoutSeconds?: number;
|
|
37
|
-
/** Condition expression for CONDITION type */
|
|
38
|
-
conditionExpression?: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Workflow state machine definition.
|
|
42
|
-
*/
|
|
43
|
-
interface StateMachineDefinition {
|
|
44
|
-
key: string;
|
|
45
|
-
name: string;
|
|
46
|
-
version: number;
|
|
47
|
-
initialStepKey: string;
|
|
48
|
-
steps: Record<string, StateMachineStep>;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Current state of an instance.
|
|
52
|
-
*/
|
|
53
|
-
interface StateMachineState {
|
|
54
|
-
currentStepKey: string;
|
|
55
|
-
status: 'PENDING' | 'RUNNING' | 'WAITING' | 'PAUSED' | 'COMPLETED' | 'CANCELLED' | 'FAILED' | 'TIMEOUT';
|
|
56
|
-
contextData: Record<string, unknown>;
|
|
57
|
-
history: {
|
|
58
|
-
stepKey: string;
|
|
59
|
-
action: string;
|
|
60
|
-
timestamp: Date;
|
|
61
|
-
executedBy: string;
|
|
62
|
-
}[];
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Result of a transition attempt.
|
|
66
|
-
*/
|
|
67
|
-
interface TransitionResult {
|
|
68
|
-
success: boolean;
|
|
69
|
-
previousStepKey: string;
|
|
70
|
-
currentStepKey: string | null;
|
|
71
|
-
status: StateMachineState['status'];
|
|
72
|
-
error?: string;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Context for transition validation.
|
|
76
|
-
*/
|
|
77
|
-
interface TransitionContext {
|
|
78
|
-
userId: string;
|
|
79
|
-
userRoles: string[];
|
|
80
|
-
data?: Record<string, unknown>;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* State machine engine interface.
|
|
84
|
-
* Implementation should be provided at runtime.
|
|
85
|
-
*/
|
|
86
|
-
interface IStateMachineEngine {
|
|
87
|
-
/**
|
|
88
|
-
* Validate that a transition is allowed.
|
|
89
|
-
*/
|
|
90
|
-
canTransition(definition: StateMachineDefinition, state: StateMachineState, action: string, context: TransitionContext): {
|
|
91
|
-
allowed: boolean;
|
|
92
|
-
reason?: string;
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Get available actions for the current step.
|
|
96
|
-
*/
|
|
97
|
-
getAvailableActions(definition: StateMachineDefinition, state: StateMachineState, context: TransitionContext): string[];
|
|
98
|
-
/**
|
|
99
|
-
* Execute a transition.
|
|
100
|
-
*/
|
|
101
|
-
transition(definition: StateMachineDefinition, state: StateMachineState, action: string, context: TransitionContext): TransitionResult;
|
|
102
|
-
/**
|
|
103
|
-
* Evaluate a condition expression.
|
|
104
|
-
*/
|
|
105
|
-
evaluateCondition(expression: string, contextData: Record<string, unknown>): boolean;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Basic state machine engine implementation.
|
|
109
|
-
* This is a reference implementation for spec validation.
|
|
110
|
-
*/
|
|
111
|
-
declare class BasicStateMachineEngine implements IStateMachineEngine {
|
|
112
|
-
canTransition(definition: StateMachineDefinition, state: StateMachineState, action: string, context: TransitionContext): {
|
|
113
|
-
allowed: boolean;
|
|
114
|
-
reason?: string;
|
|
115
|
-
};
|
|
116
|
-
getAvailableActions(definition: StateMachineDefinition, state: StateMachineState, context: TransitionContext): string[];
|
|
117
|
-
transition(definition: StateMachineDefinition, state: StateMachineState, action: string, context: TransitionContext): TransitionResult;
|
|
118
|
-
evaluateCondition(expression: string, contextData: Record<string, unknown>): boolean;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Create a new state machine engine instance.
|
|
122
|
-
*/
|
|
123
|
-
declare function createStateMachineEngine(): IStateMachineEngine;
|
|
124
|
-
/**
|
|
125
|
-
* Build a state machine definition from workflow entities.
|
|
126
|
-
*/
|
|
127
|
-
declare function buildStateMachineDefinition(workflow: {
|
|
128
|
-
key: string;
|
|
129
|
-
name: string;
|
|
130
|
-
version: number;
|
|
131
|
-
initialStepId: string | null;
|
|
132
|
-
}, steps: {
|
|
133
|
-
key: string;
|
|
134
|
-
name: string;
|
|
135
|
-
type: string;
|
|
136
|
-
transitions: Record<string, string | TransitionDefinition>;
|
|
137
|
-
approvalMode?: string;
|
|
138
|
-
approverRoles?: string[];
|
|
139
|
-
timeoutSeconds?: number;
|
|
140
|
-
conditionExpression?: string;
|
|
141
|
-
}[]): StateMachineDefinition;
|
|
142
|
-
/**
|
|
143
|
-
* Create initial state for a new workflow instance.
|
|
144
|
-
*/
|
|
145
|
-
declare function createInitialState(definition: StateMachineDefinition, contextData?: Record<string, unknown>): StateMachineState;
|
|
146
|
-
//#endregion
|
|
147
|
-
export { BasicStateMachineEngine, IStateMachineEngine, StateMachineDefinition, StateMachineState, StateMachineStep, TransitionContext, TransitionDefinition, TransitionResult, buildStateMachineDefinition, createInitialState, createStateMachineEngine };
|
package/dist/workflow/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ApprovalModeEnum, StepTypeEnum, TriggerTypeEnum, WorkflowStatusEnum } from "./workflow.enum.js";
|
|
2
|
-
import { AddStepInputModel, CreateWorkflowInputModel, UpdateWorkflowInputModel, WorkflowDefinitionModel, WorkflowStepModel } from "./workflow.schema.js";
|
|
3
|
-
import { AddStepContract, CreateWorkflowContract, GetWorkflowContract, ListWorkflowsContract, PublishWorkflowContract, UpdateWorkflowContract } from "./workflow.contracts.js";
|
|
4
|
-
import { StepAddedEvent, WorkflowCreatedEvent, WorkflowPublishedEvent, WorkflowUpdatedEvent } from "./workflow.event.js";
|
|
5
|
-
export { AddStepContract, AddStepInputModel, ApprovalModeEnum, CreateWorkflowContract, CreateWorkflowInputModel, GetWorkflowContract, ListWorkflowsContract, PublishWorkflowContract, StepAddedEvent, StepTypeEnum, TriggerTypeEnum, UpdateWorkflowContract, UpdateWorkflowInputModel, WorkflowCreatedEvent, WorkflowDefinitionModel, WorkflowPublishedEvent, WorkflowStatusEnum, WorkflowStepModel, WorkflowUpdatedEvent };
|