@contractspec/example.workflow-system 1.46.1 → 1.48.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/approval/approval.enum.d.ts +3 -3
- package/dist/approval/approval.enum.d.ts.map +1 -1
- package/dist/approval/approval.event.d.ts +32 -32
- package/dist/approval/approval.event.d.ts.map +1 -1
- package/dist/approval/approval.event.js +5 -5
- package/dist/approval/approval.event.js.map +1 -1
- package/dist/approval/approval.handler.js.map +1 -1
- package/dist/approval/approval.operations.d.ts +134 -134
- package/dist/approval/approval.operations.d.ts.map +1 -1
- package/dist/approval/approval.schema.d.ts +24 -24
- package/dist/entities/approval.d.ts +36 -36
- package/dist/entities/approval.d.ts.map +1 -1
- package/dist/entities/index.d.ts +127 -127
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js.map +1 -1
- package/dist/entities/instance.d.ts +47 -47
- package/dist/entities/step.d.ts +32 -32
- package/dist/entities/workflow.d.ts +23 -23
- package/dist/example.d.ts +2 -2
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +4 -2
- package/dist/example.js.map +1 -1
- package/dist/handlers/index.d.ts +2 -0
- package/dist/handlers/index.js +3 -0
- package/dist/handlers/workflow.handlers.d.ts +122 -0
- package/dist/handlers/workflow.handlers.d.ts.map +1 -0
- package/dist/handlers/workflow.handlers.js +263 -0
- package/dist/handlers/workflow.handlers.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/instance/instance.enum.d.ts +2 -2
- package/dist/instance/instance.event.d.ts +87 -87
- package/dist/instance/instance.event.d.ts.map +1 -1
- package/dist/instance/instance.event.js +4 -4
- package/dist/instance/instance.event.js.map +1 -1
- package/dist/instance/instance.handler.js.map +1 -1
- package/dist/instance/instance.operations.d.ts +256 -256
- package/dist/instance/instance.schema.d.ts +54 -54
- package/dist/presentations/index.d.ts +23 -24
- package/dist/presentations/index.d.ts.map +1 -1
- package/dist/presentations/index.js +26 -23
- package/dist/presentations/index.js.map +1 -1
- package/dist/seeders/index.d.ts +10 -0
- package/dist/seeders/index.d.ts.map +1 -0
- package/dist/seeders/index.js +19 -0
- package/dist/seeders/index.js.map +1 -0
- package/dist/state-machine/index.js.map +1 -1
- package/dist/tests/operations.test-spec.d.ts +10 -0
- package/dist/tests/operations.test-spec.d.ts.map +1 -0
- package/dist/tests/operations.test-spec.js +123 -0
- package/dist/tests/operations.test-spec.js.map +1 -0
- package/dist/ui/WorkflowDashboard.d.ts +7 -0
- package/dist/ui/WorkflowDashboard.d.ts.map +1 -0
- package/dist/ui/WorkflowDashboard.js +223 -0
- package/dist/ui/WorkflowDashboard.js.map +1 -0
- package/dist/ui/hooks/index.d.ts +2 -0
- package/dist/ui/hooks/index.js +5 -0
- package/dist/ui/hooks/useWorkflowList.d.ts +22 -0
- package/dist/ui/hooks/useWorkflowList.d.ts.map +1 -0
- package/dist/ui/hooks/useWorkflowList.js +55 -0
- package/dist/ui/hooks/useWorkflowList.js.map +1 -0
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/renderers/index.d.ts +2 -0
- package/dist/ui/renderers/index.js +3 -0
- package/dist/ui/renderers/workflow.markdown.d.ts +28 -0
- package/dist/ui/renderers/workflow.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/workflow.markdown.js +234 -0
- package/dist/ui/renderers/workflow.markdown.js.map +1 -0
- package/dist/workflow/workflow.enum.d.ts +5 -5
- package/dist/workflow/workflow.event.d.ts +33 -33
- package/dist/workflow/workflow.event.d.ts.map +1 -1
- package/dist/workflow/workflow.event.js +3 -3
- package/dist/workflow/workflow.event.js.map +1 -1
- package/dist/workflow/workflow.handler.js.map +1 -1
- package/dist/workflow/workflow.operations.d.ts +246 -246
- package/dist/workflow/workflow.schema.d.ts +63 -63
- package/dist/workflow/workflow.schema.d.ts.map +1 -1
- package/dist/workflow-system.capability.d.ts +9 -0
- package/dist/workflow-system.capability.d.ts.map +1 -0
- package/dist/workflow-system.capability.js +34 -0
- package/dist/workflow-system.capability.js.map +1 -0
- package/dist/workflow-system.feature.d.ts +2 -2
- package/dist/workflow-system.feature.d.ts.map +1 -1
- package/dist/workflow-system.feature.js +9 -2
- package/dist/workflow-system.feature.js.map +1 -1
- package/package.json +24 -8
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _contractspec_lib_schema160 from "@contractspec/lib.schema";
|
|
2
2
|
|
|
3
3
|
//#region src/entities/instance.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Instance status enum - lifecycle of a workflow instance.
|
|
6
6
|
*/
|
|
7
|
-
declare const InstanceStatusEnum:
|
|
7
|
+
declare const InstanceStatusEnum: _contractspec_lib_schema160.EntityEnumDef;
|
|
8
8
|
/**
|
|
9
9
|
* Step execution status enum.
|
|
10
10
|
*/
|
|
11
|
-
declare const StepExecutionStatusEnum:
|
|
11
|
+
declare const StepExecutionStatusEnum: _contractspec_lib_schema160.EntityEnumDef;
|
|
12
12
|
/**
|
|
13
13
|
* WorkflowInstance entity - a running instance of a workflow.
|
|
14
14
|
*
|
|
15
15
|
* When a workflow is triggered, an instance is created. The instance
|
|
16
16
|
* tracks the current state and all data associated with this execution.
|
|
17
17
|
*/
|
|
18
|
-
declare const WorkflowInstanceEntity:
|
|
19
|
-
id:
|
|
20
|
-
workflowDefinitionId:
|
|
21
|
-
referenceId:
|
|
22
|
-
referenceType:
|
|
23
|
-
status:
|
|
24
|
-
currentStepId:
|
|
25
|
-
contextData:
|
|
26
|
-
triggeredBy:
|
|
27
|
-
triggerSource:
|
|
28
|
-
organizationId:
|
|
29
|
-
priority:
|
|
30
|
-
dueAt:
|
|
31
|
-
outcome:
|
|
32
|
-
resultData:
|
|
33
|
-
errorMessage:
|
|
34
|
-
createdAt:
|
|
35
|
-
updatedAt:
|
|
36
|
-
startedAt:
|
|
37
|
-
completedAt:
|
|
38
|
-
workflowDefinition:
|
|
39
|
-
currentStep:
|
|
40
|
-
stepExecutions:
|
|
41
|
-
approvalRequests:
|
|
18
|
+
declare const WorkflowInstanceEntity: _contractspec_lib_schema160.EntitySpec<{
|
|
19
|
+
id: _contractspec_lib_schema160.EntityScalarField;
|
|
20
|
+
workflowDefinitionId: _contractspec_lib_schema160.EntityScalarField;
|
|
21
|
+
referenceId: _contractspec_lib_schema160.EntityScalarField;
|
|
22
|
+
referenceType: _contractspec_lib_schema160.EntityScalarField;
|
|
23
|
+
status: _contractspec_lib_schema160.EntityEnumField;
|
|
24
|
+
currentStepId: _contractspec_lib_schema160.EntityScalarField;
|
|
25
|
+
contextData: _contractspec_lib_schema160.EntityScalarField;
|
|
26
|
+
triggeredBy: _contractspec_lib_schema160.EntityScalarField;
|
|
27
|
+
triggerSource: _contractspec_lib_schema160.EntityScalarField;
|
|
28
|
+
organizationId: _contractspec_lib_schema160.EntityScalarField;
|
|
29
|
+
priority: _contractspec_lib_schema160.EntityScalarField;
|
|
30
|
+
dueAt: _contractspec_lib_schema160.EntityScalarField;
|
|
31
|
+
outcome: _contractspec_lib_schema160.EntityScalarField;
|
|
32
|
+
resultData: _contractspec_lib_schema160.EntityScalarField;
|
|
33
|
+
errorMessage: _contractspec_lib_schema160.EntityScalarField;
|
|
34
|
+
createdAt: _contractspec_lib_schema160.EntityScalarField;
|
|
35
|
+
updatedAt: _contractspec_lib_schema160.EntityScalarField;
|
|
36
|
+
startedAt: _contractspec_lib_schema160.EntityScalarField;
|
|
37
|
+
completedAt: _contractspec_lib_schema160.EntityScalarField;
|
|
38
|
+
workflowDefinition: _contractspec_lib_schema160.EntityRelationField;
|
|
39
|
+
currentStep: _contractspec_lib_schema160.EntityRelationField;
|
|
40
|
+
stepExecutions: _contractspec_lib_schema160.EntityRelationField;
|
|
41
|
+
approvalRequests: _contractspec_lib_schema160.EntityRelationField;
|
|
42
42
|
}>;
|
|
43
43
|
/**
|
|
44
44
|
* StepExecution entity - tracks execution of a step within an instance.
|
|
45
45
|
*/
|
|
46
|
-
declare const StepExecutionEntity:
|
|
47
|
-
id:
|
|
48
|
-
workflowInstanceId:
|
|
49
|
-
workflowStepId:
|
|
50
|
-
status:
|
|
51
|
-
executionOrder:
|
|
52
|
-
inputData:
|
|
53
|
-
outputData:
|
|
54
|
-
actionTaken:
|
|
55
|
-
transitionedTo:
|
|
56
|
-
executedBy:
|
|
57
|
-
errorMessage:
|
|
58
|
-
errorDetails:
|
|
59
|
-
retryCount:
|
|
60
|
-
createdAt:
|
|
61
|
-
updatedAt:
|
|
62
|
-
startedAt:
|
|
63
|
-
completedAt:
|
|
64
|
-
workflowInstance:
|
|
65
|
-
workflowStep:
|
|
46
|
+
declare const StepExecutionEntity: _contractspec_lib_schema160.EntitySpec<{
|
|
47
|
+
id: _contractspec_lib_schema160.EntityScalarField;
|
|
48
|
+
workflowInstanceId: _contractspec_lib_schema160.EntityScalarField;
|
|
49
|
+
workflowStepId: _contractspec_lib_schema160.EntityScalarField;
|
|
50
|
+
status: _contractspec_lib_schema160.EntityEnumField;
|
|
51
|
+
executionOrder: _contractspec_lib_schema160.EntityScalarField;
|
|
52
|
+
inputData: _contractspec_lib_schema160.EntityScalarField;
|
|
53
|
+
outputData: _contractspec_lib_schema160.EntityScalarField;
|
|
54
|
+
actionTaken: _contractspec_lib_schema160.EntityScalarField;
|
|
55
|
+
transitionedTo: _contractspec_lib_schema160.EntityScalarField;
|
|
56
|
+
executedBy: _contractspec_lib_schema160.EntityScalarField;
|
|
57
|
+
errorMessage: _contractspec_lib_schema160.EntityScalarField;
|
|
58
|
+
errorDetails: _contractspec_lib_schema160.EntityScalarField;
|
|
59
|
+
retryCount: _contractspec_lib_schema160.EntityScalarField;
|
|
60
|
+
createdAt: _contractspec_lib_schema160.EntityScalarField;
|
|
61
|
+
updatedAt: _contractspec_lib_schema160.EntityScalarField;
|
|
62
|
+
startedAt: _contractspec_lib_schema160.EntityScalarField;
|
|
63
|
+
completedAt: _contractspec_lib_schema160.EntityScalarField;
|
|
64
|
+
workflowInstance: _contractspec_lib_schema160.EntityRelationField;
|
|
65
|
+
workflowStep: _contractspec_lib_schema160.EntityRelationField;
|
|
66
66
|
}>;
|
|
67
67
|
//#endregion
|
|
68
68
|
export { InstanceStatusEnum, StepExecutionEntity, StepExecutionStatusEnum, WorkflowInstanceEntity };
|
package/dist/entities/step.d.ts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _contractspec_lib_schema208 from "@contractspec/lib.schema";
|
|
2
2
|
|
|
3
3
|
//#region src/entities/step.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Step type enum - what kind of step this is.
|
|
6
6
|
*/
|
|
7
|
-
declare const StepTypeEnum:
|
|
7
|
+
declare const StepTypeEnum: _contractspec_lib_schema208.EntityEnumDef;
|
|
8
8
|
/**
|
|
9
9
|
* Approval mode enum - how approvals are handled.
|
|
10
10
|
*/
|
|
11
|
-
declare const ApprovalModeEnum:
|
|
11
|
+
declare const ApprovalModeEnum: _contractspec_lib_schema208.EntityEnumDef;
|
|
12
12
|
/**
|
|
13
13
|
* WorkflowStep entity - defines a step in a workflow.
|
|
14
14
|
*
|
|
15
15
|
* Each step represents a state in the workflow state machine,
|
|
16
16
|
* with transitions defined by the `transitions` JSON field.
|
|
17
17
|
*/
|
|
18
|
-
declare const WorkflowStepEntity:
|
|
19
|
-
id:
|
|
20
|
-
workflowDefinitionId:
|
|
21
|
-
name:
|
|
22
|
-
key:
|
|
23
|
-
description:
|
|
24
|
-
type:
|
|
25
|
-
position:
|
|
26
|
-
transitions:
|
|
27
|
-
approvalMode:
|
|
28
|
-
approverRoles:
|
|
29
|
-
approverUserIds:
|
|
30
|
-
escalationConfig:
|
|
31
|
-
assigneeRoles:
|
|
32
|
-
taskTemplate:
|
|
33
|
-
conditionExpression:
|
|
34
|
-
waitDuration:
|
|
35
|
-
waitForEvent:
|
|
36
|
-
actionType:
|
|
37
|
-
actionConfig:
|
|
38
|
-
timeoutSeconds:
|
|
39
|
-
slaSeconds:
|
|
40
|
-
notifyOnEnter:
|
|
41
|
-
notifyOnExit:
|
|
42
|
-
metadata:
|
|
43
|
-
createdAt:
|
|
44
|
-
updatedAt:
|
|
45
|
-
workflowDefinition:
|
|
46
|
-
executions:
|
|
18
|
+
declare const WorkflowStepEntity: _contractspec_lib_schema208.EntitySpec<{
|
|
19
|
+
id: _contractspec_lib_schema208.EntityScalarField;
|
|
20
|
+
workflowDefinitionId: _contractspec_lib_schema208.EntityScalarField;
|
|
21
|
+
name: _contractspec_lib_schema208.EntityScalarField;
|
|
22
|
+
key: _contractspec_lib_schema208.EntityScalarField;
|
|
23
|
+
description: _contractspec_lib_schema208.EntityScalarField;
|
|
24
|
+
type: _contractspec_lib_schema208.EntityEnumField;
|
|
25
|
+
position: _contractspec_lib_schema208.EntityScalarField;
|
|
26
|
+
transitions: _contractspec_lib_schema208.EntityScalarField;
|
|
27
|
+
approvalMode: _contractspec_lib_schema208.EntityEnumField;
|
|
28
|
+
approverRoles: _contractspec_lib_schema208.EntityScalarField;
|
|
29
|
+
approverUserIds: _contractspec_lib_schema208.EntityScalarField;
|
|
30
|
+
escalationConfig: _contractspec_lib_schema208.EntityScalarField;
|
|
31
|
+
assigneeRoles: _contractspec_lib_schema208.EntityScalarField;
|
|
32
|
+
taskTemplate: _contractspec_lib_schema208.EntityScalarField;
|
|
33
|
+
conditionExpression: _contractspec_lib_schema208.EntityScalarField;
|
|
34
|
+
waitDuration: _contractspec_lib_schema208.EntityScalarField;
|
|
35
|
+
waitForEvent: _contractspec_lib_schema208.EntityScalarField;
|
|
36
|
+
actionType: _contractspec_lib_schema208.EntityScalarField;
|
|
37
|
+
actionConfig: _contractspec_lib_schema208.EntityScalarField;
|
|
38
|
+
timeoutSeconds: _contractspec_lib_schema208.EntityScalarField;
|
|
39
|
+
slaSeconds: _contractspec_lib_schema208.EntityScalarField;
|
|
40
|
+
notifyOnEnter: _contractspec_lib_schema208.EntityScalarField;
|
|
41
|
+
notifyOnExit: _contractspec_lib_schema208.EntityScalarField;
|
|
42
|
+
metadata: _contractspec_lib_schema208.EntityScalarField;
|
|
43
|
+
createdAt: _contractspec_lib_schema208.EntityScalarField;
|
|
44
|
+
updatedAt: _contractspec_lib_schema208.EntityScalarField;
|
|
45
|
+
workflowDefinition: _contractspec_lib_schema208.EntityRelationField;
|
|
46
|
+
executions: _contractspec_lib_schema208.EntityRelationField;
|
|
47
47
|
}>;
|
|
48
48
|
//#endregion
|
|
49
49
|
export { ApprovalModeEnum, StepTypeEnum, WorkflowStepEntity };
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _contractspec_lib_schema269 from "@contractspec/lib.schema";
|
|
2
2
|
|
|
3
3
|
//#region src/entities/workflow.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Workflow status enum - the lifecycle state of a workflow definition.
|
|
6
6
|
*/
|
|
7
|
-
declare const WorkflowStatusEnum:
|
|
7
|
+
declare const WorkflowStatusEnum: _contractspec_lib_schema269.EntityEnumDef;
|
|
8
8
|
/**
|
|
9
9
|
* Workflow trigger type enum - what initiates a workflow.
|
|
10
10
|
*/
|
|
11
|
-
declare const WorkflowTriggerTypeEnum:
|
|
11
|
+
declare const WorkflowTriggerTypeEnum: _contractspec_lib_schema269.EntityEnumDef;
|
|
12
12
|
/**
|
|
13
13
|
* WorkflowDefinition entity - defines a workflow blueprint.
|
|
14
14
|
*
|
|
15
15
|
* A workflow definition specifies the structure, steps, and rules
|
|
16
16
|
* for a business process. Instances are created from definitions.
|
|
17
17
|
*/
|
|
18
|
-
declare const WorkflowDefinitionEntity:
|
|
19
|
-
id:
|
|
20
|
-
name:
|
|
21
|
-
key:
|
|
22
|
-
description:
|
|
23
|
-
version:
|
|
24
|
-
status:
|
|
25
|
-
triggerType:
|
|
26
|
-
triggerConfig:
|
|
27
|
-
initialStepId:
|
|
28
|
-
featureFlagKey:
|
|
29
|
-
settings:
|
|
30
|
-
metadata:
|
|
31
|
-
organizationId:
|
|
32
|
-
createdBy:
|
|
33
|
-
createdAt:
|
|
34
|
-
updatedAt:
|
|
35
|
-
publishedAt:
|
|
36
|
-
steps:
|
|
37
|
-
instances:
|
|
18
|
+
declare const WorkflowDefinitionEntity: _contractspec_lib_schema269.EntitySpec<{
|
|
19
|
+
id: _contractspec_lib_schema269.EntityScalarField;
|
|
20
|
+
name: _contractspec_lib_schema269.EntityScalarField;
|
|
21
|
+
key: _contractspec_lib_schema269.EntityScalarField;
|
|
22
|
+
description: _contractspec_lib_schema269.EntityScalarField;
|
|
23
|
+
version: _contractspec_lib_schema269.EntityScalarField;
|
|
24
|
+
status: _contractspec_lib_schema269.EntityEnumField;
|
|
25
|
+
triggerType: _contractspec_lib_schema269.EntityEnumField;
|
|
26
|
+
triggerConfig: _contractspec_lib_schema269.EntityScalarField;
|
|
27
|
+
initialStepId: _contractspec_lib_schema269.EntityScalarField;
|
|
28
|
+
featureFlagKey: _contractspec_lib_schema269.EntityScalarField;
|
|
29
|
+
settings: _contractspec_lib_schema269.EntityScalarField;
|
|
30
|
+
metadata: _contractspec_lib_schema269.EntityScalarField;
|
|
31
|
+
organizationId: _contractspec_lib_schema269.EntityScalarField;
|
|
32
|
+
createdBy: _contractspec_lib_schema269.EntityScalarField;
|
|
33
|
+
createdAt: _contractspec_lib_schema269.EntityScalarField;
|
|
34
|
+
updatedAt: _contractspec_lib_schema269.EntityScalarField;
|
|
35
|
+
publishedAt: _contractspec_lib_schema269.EntityScalarField;
|
|
36
|
+
steps: _contractspec_lib_schema269.EntityRelationField;
|
|
37
|
+
instances: _contractspec_lib_schema269.EntityRelationField;
|
|
38
38
|
}>;
|
|
39
39
|
//#endregion
|
|
40
40
|
export { WorkflowDefinitionEntity, WorkflowStatusEnum, WorkflowTriggerTypeEnum };
|
package/dist/example.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
|
|
2
2
|
|
|
3
3
|
//#region src/example.d.ts
|
|
4
|
-
declare const example: ExampleSpec;
|
|
4
|
+
declare const example: _contractspec_lib_contracts0.ExampleSpec;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { example as default };
|
|
7
7
|
//# sourceMappingURL=example.d.ts.map
|
package/dist/example.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,
|
|
1
|
+
{"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,SAoCJ,4BAAA,CApCW"}
|
package/dist/example.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { defineExample } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
1
3
|
//#region src/example.ts
|
|
2
|
-
const example = {
|
|
4
|
+
const example = defineExample({
|
|
3
5
|
meta: {
|
|
4
6
|
key: "workflow-system",
|
|
5
7
|
version: "1.0.0",
|
|
@@ -48,7 +50,7 @@ const example = {
|
|
|
48
50
|
},
|
|
49
51
|
mcp: { enabled: true }
|
|
50
52
|
}
|
|
51
|
-
};
|
|
53
|
+
});
|
|
52
54
|
var example_default = example;
|
|
53
55
|
|
|
54
56
|
//#endregion
|
package/dist/example.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.js","names":[
|
|
1
|
+
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'workflow-system',\n version: '1.0.0',\n title: 'Workflow / Approval System',\n description:\n 'State-machine driven approvals with RBAC, audit trail, notifications, and jobs.',\n kind: 'template',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['workflow', 'approval', 'state-machine', 'rbac'],\n },\n docs: {\n rootDocId: 'docs.examples.workflow-system',\n goalDocId: 'docs.examples.workflow-system.goal',\n usageDocId: 'docs.examples.workflow-system.usage',\n constraintsDocId: 'docs.examples.workflow-system.constraints',\n },\n entrypoints: {\n packageName: '@contractspec/example.workflow-system',\n feature: './feature',\n contracts: './contracts',\n presentations: './presentations',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: {\n enabled: true,\n modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],\n },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAY;GAAY;GAAiB;GAAO;EACxD;CACD,MAAM;EACJ,WAAW;EACX,WAAW;EACX,YAAY;EACZ,kBAAkB;EACnB;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,eAAe;EACf,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GACP,SAAS;GACT,OAAO;IAAC;IAAc;IAAS;IAAW;IAAY;IAAY;GACnE;EACD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC;AAEF,sBAAe"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AddWorkflowStepInput, ApproveStepInput, CreateWorkflowDefinitionInput, ListWorkflowDefinitionsInput, ListWorkflowDefinitionsOutput, ListWorkflowInstancesInput, ListWorkflowInstancesOutput, RejectStepInput, StartWorkflowInput, WorkflowApproval, WorkflowDefinition, WorkflowHandlers, WorkflowInstance, WorkflowStep, createWorkflowHandlers } from "./workflow.handlers.js";
|
|
2
|
+
export { AddWorkflowStepInput, ApproveStepInput, CreateWorkflowDefinitionInput, ListWorkflowDefinitionsInput, ListWorkflowDefinitionsOutput, ListWorkflowInstancesInput, ListWorkflowInstancesOutput, RejectStepInput, StartWorkflowInput, WorkflowApproval, WorkflowDefinition, WorkflowHandlers, WorkflowInstance, WorkflowStep, createWorkflowHandlers };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { DatabasePort } from "@contractspec/lib.runtime-sandbox";
|
|
2
|
+
|
|
3
|
+
//#region src/handlers/workflow.handlers.d.ts
|
|
4
|
+
|
|
5
|
+
interface WorkflowDefinition {
|
|
6
|
+
id: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
organizationId: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
type: 'APPROVAL' | 'SEQUENTIAL' | 'PARALLEL';
|
|
12
|
+
status: 'DRAFT' | 'ACTIVE' | 'ARCHIVED';
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
}
|
|
16
|
+
interface WorkflowStep {
|
|
17
|
+
id: string;
|
|
18
|
+
definitionId: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
stepOrder: number;
|
|
22
|
+
type: 'APPROVAL' | 'TASK' | 'NOTIFICATION';
|
|
23
|
+
requiredRoles: string[];
|
|
24
|
+
autoApproveCondition?: string;
|
|
25
|
+
timeoutHours?: number;
|
|
26
|
+
createdAt: Date;
|
|
27
|
+
}
|
|
28
|
+
interface WorkflowInstance {
|
|
29
|
+
id: string;
|
|
30
|
+
projectId: string;
|
|
31
|
+
definitionId: string;
|
|
32
|
+
status: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'REJECTED' | 'CANCELLED';
|
|
33
|
+
currentStepId?: string;
|
|
34
|
+
data?: Record<string, unknown>;
|
|
35
|
+
requestedBy: string;
|
|
36
|
+
startedAt: Date;
|
|
37
|
+
completedAt?: Date;
|
|
38
|
+
}
|
|
39
|
+
interface WorkflowApproval {
|
|
40
|
+
id: string;
|
|
41
|
+
instanceId: string;
|
|
42
|
+
stepId: string;
|
|
43
|
+
status: 'PENDING' | 'APPROVED' | 'REJECTED' | 'DELEGATED';
|
|
44
|
+
actorId?: string;
|
|
45
|
+
comment?: string;
|
|
46
|
+
decidedAt?: Date;
|
|
47
|
+
createdAt: Date;
|
|
48
|
+
}
|
|
49
|
+
interface CreateWorkflowDefinitionInput {
|
|
50
|
+
name: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
type?: 'APPROVAL' | 'SEQUENTIAL' | 'PARALLEL';
|
|
53
|
+
}
|
|
54
|
+
interface AddWorkflowStepInput {
|
|
55
|
+
definitionId: string;
|
|
56
|
+
name: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
type?: 'APPROVAL' | 'TASK' | 'NOTIFICATION';
|
|
59
|
+
requiredRoles: string[];
|
|
60
|
+
autoApproveCondition?: string;
|
|
61
|
+
timeoutHours?: number;
|
|
62
|
+
}
|
|
63
|
+
interface StartWorkflowInput {
|
|
64
|
+
definitionId: string;
|
|
65
|
+
data?: Record<string, unknown>;
|
|
66
|
+
}
|
|
67
|
+
interface ApproveStepInput {
|
|
68
|
+
instanceId: string;
|
|
69
|
+
comment?: string;
|
|
70
|
+
}
|
|
71
|
+
interface RejectStepInput {
|
|
72
|
+
instanceId: string;
|
|
73
|
+
reason: string;
|
|
74
|
+
}
|
|
75
|
+
interface ListWorkflowDefinitionsInput {
|
|
76
|
+
projectId: string;
|
|
77
|
+
status?: 'DRAFT' | 'ACTIVE' | 'ARCHIVED' | 'all';
|
|
78
|
+
search?: string;
|
|
79
|
+
limit?: number;
|
|
80
|
+
offset?: number;
|
|
81
|
+
}
|
|
82
|
+
interface ListWorkflowDefinitionsOutput {
|
|
83
|
+
definitions: WorkflowDefinition[];
|
|
84
|
+
total: number;
|
|
85
|
+
}
|
|
86
|
+
interface ListWorkflowInstancesInput {
|
|
87
|
+
projectId: string;
|
|
88
|
+
definitionId?: string;
|
|
89
|
+
status?: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'REJECTED' | 'CANCELLED' | 'all';
|
|
90
|
+
requestedBy?: string;
|
|
91
|
+
limit?: number;
|
|
92
|
+
offset?: number;
|
|
93
|
+
}
|
|
94
|
+
interface ListWorkflowInstancesOutput {
|
|
95
|
+
instances: WorkflowInstance[];
|
|
96
|
+
total: number;
|
|
97
|
+
}
|
|
98
|
+
declare function createWorkflowHandlers(db: DatabasePort): {
|
|
99
|
+
listDefinitions: (input: ListWorkflowDefinitionsInput) => Promise<ListWorkflowDefinitionsOutput>;
|
|
100
|
+
createDefinition: (input: CreateWorkflowDefinitionInput, context: {
|
|
101
|
+
projectId: string;
|
|
102
|
+
organizationId: string;
|
|
103
|
+
}) => Promise<WorkflowDefinition>;
|
|
104
|
+
addStep: (input: AddWorkflowStepInput) => Promise<WorkflowStep>;
|
|
105
|
+
getSteps: (definitionId: string) => Promise<WorkflowStep[]>;
|
|
106
|
+
listInstances: (input: ListWorkflowInstancesInput) => Promise<ListWorkflowInstancesOutput>;
|
|
107
|
+
startInstance: (input: StartWorkflowInput, context: {
|
|
108
|
+
projectId: string;
|
|
109
|
+
requestedBy: string;
|
|
110
|
+
}) => Promise<WorkflowInstance>;
|
|
111
|
+
approveStep: (input: ApproveStepInput, context: {
|
|
112
|
+
actorId: string;
|
|
113
|
+
}) => Promise<WorkflowInstance>;
|
|
114
|
+
rejectStep: (input: RejectStepInput, context: {
|
|
115
|
+
actorId: string;
|
|
116
|
+
}) => Promise<WorkflowInstance>;
|
|
117
|
+
getApprovals: (instanceId: string) => Promise<WorkflowApproval[]>;
|
|
118
|
+
};
|
|
119
|
+
type WorkflowHandlers = ReturnType<typeof createWorkflowHandlers>;
|
|
120
|
+
//#endregion
|
|
121
|
+
export { AddWorkflowStepInput, ApproveStepInput, CreateWorkflowDefinitionInput, ListWorkflowDefinitionsInput, ListWorkflowDefinitionsOutput, ListWorkflowInstancesInput, ListWorkflowInstancesOutput, RejectStepInput, StartWorkflowInput, WorkflowApproval, WorkflowDefinition, WorkflowHandlers, WorkflowInstance, WorkflowStep, createWorkflowHandlers };
|
|
122
|
+
//# sourceMappingURL=workflow.handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.handlers.d.ts","names":[],"sources":["../../src/handlers/workflow.handlers.ts"],"sourcesContent":[],"mappings":";;;;AA2CS,UA/BQ,kBAAA,CA+BR;EAEI,EAAA,EAAA,MAAA;EACG,SAAA,EAAA,MAAA;EAAI,cAAA,EAAA,MAAA;EAGH,IAAA,EAAA,MAAA;EAWA,WAAA,CAAA,EAAA,MAAA;EAMA,IAAA,EAAA,UAAA,GAAA,YAAoB,GAAA,UAAA;EAUpB,MAAA,EAAA,OAAA,GAAA,QAAkB,GAAA,UAE1B;EAGQ,SAAA,EA7DJ,IA6DI;EAKA,SAAA,EAjEJ,IAiEI;AAKjB;AAQiB,UA3EA,YAAA,CA2EA;EAKA,EAAA,EAAA,MAAA;EAeA,YAAA,EAAA,MAAA;EAiHD,IAAA,EAAA,MAAA;EAA2B,WAAA,CAAA,EAAA,MAAA;EAKhC,SAAA,EAAA,MAAA;EACE,IAAA,EAAA,UAAA,GAAA,MAAA,GAAA,cAAA;EAAR,aAAA,EAAA,MAAA,EAAA;EAyCM,oBAAA,CAAA,EAAA,MAAA;EAEE,YAAA,CAAA,EAAA,MAAA;EAAR,SAAA,EAvPQ,IAuPR;;AA8B0D,UAlR9C,gBAAA,CAkR8C;EAAR,EAAA,EAAA,MAAA;EAwCE,SAAA,EAAA,MAAA;EAAR,YAAA,EAAA,MAAA;EAetC,MAAA,EAAA,SAAA,GAAA,aAAA,GAAA,WAAA,GAAA,UAAA,GAAA,WAAA;EACE,aAAA,CAAA,EAAA,MAAA;EAAR,IAAA,CAAA,EApUI,MAoUJ,CAAA,MAAA,EAAA,OAAA,CAAA;EAqDM,WAAA,EAAA,MAAA;EAEE,SAAA,EAzXA,IAyXA;EAAR,WAAA,CAAA,EAxXW,IAwXX;;AAmDQ,UAxaI,gBAAA,CAwaJ;EAAR,EAAA,EAAA,MAAA;EAmFM,UAAA,EAAA,MAAA;EAEE,MAAA,EAAA,MAAA;EAAR,MAAA,EAAA,SAAA,GAAA,UAAA,GAAA,UAAA,GAAA,WAAA;EA6CsD,OAAA,CAAA,EAAA,MAAA;EAAR,OAAA,CAAA,EAAA,MAAA;EAAO,SAAA,CAAA,EAniB5C,IAmiB4C;EAwB9C,SAAA,EA1jBC,IA0jBD;;UAvjBK,6BAAA;;;;;UAMA,oBAAA;;;;;;;;;UAUA,kBAAA;;SAER;;UAGQ,gBAAA;;;;UAKA,eAAA;;;;UAKA,4BAAA;;;;;;;UAQA,6BAAA;eACF;;;UAIE,0BAAA;;;;;;;;UAeA,2BAAA;aACJ;;;iBAgHG,sBAAA,KAA2B;2BAKhC,iCACN,QAAQ;4BAyCF;;;QAEN,QAAQ;mBA8BmB,yBAAuB,QAAQ;sCAwCd,QAAQ;yBAe9C,+BACN,QAAQ;yBAqDF;;;QAEN,QAAQ;uBAiDF;;QAEN,QAAQ;sBAmFF;;QAEN,QAAQ;wCA6CsC,QAAQ;;KAwB/C,gBAAA,GAAmB,kBAAkB"}
|