@contractspec/example.workflow-system 3.7.7 → 3.8.2
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/README.md +3 -0
- package/dist/browser/handlers/index.js +43 -43
- package/dist/browser/handlers/workflow.handlers.js +43 -43
- package/dist/browser/index.js +572 -183
- package/dist/browser/shared/demo-scenario.js +213 -0
- package/dist/browser/ui/WorkflowDashboard.visualizations.js +239 -0
- package/dist/browser/ui/hooks/index.js +0 -47
- package/dist/browser/ui/hooks/useWorkflowList.js +5 -3
- package/dist/browser/ui/index.js +5 -3
- package/dist/browser/ui/renderers/index.js +409 -73
- package/dist/browser/ui/renderers/workflow.markdown.js +409 -73
- package/dist/browser/visualizations/catalog.js +132 -0
- package/dist/browser/visualizations/index.js +133 -0
- package/dist/browser/visualizations/selectors.js +195 -0
- package/dist/example.test.d.ts +1 -0
- package/dist/handlers/index.js +43 -43
- package/dist/handlers/workflow.handlers.js +43 -43
- package/dist/index.d.ts +1 -0
- package/dist/index.js +572 -183
- package/dist/shared/demo-scenario.d.ts +43 -0
- package/dist/shared/demo-scenario.js +214 -0
- package/dist/ui/WorkflowDashboard.visualizations.d.ts +4 -0
- package/dist/ui/WorkflowDashboard.visualizations.js +240 -0
- package/dist/ui/hooks/index.js +0 -47
- package/dist/ui/hooks/useWorkflowList.d.ts +2 -1
- package/dist/ui/hooks/useWorkflowList.js +5 -3
- package/dist/ui/index.js +5 -3
- package/dist/ui/renderers/index.js +409 -73
- package/dist/ui/renderers/workflow.markdown.js +409 -73
- package/dist/visualizations/catalog.d.ts +11 -0
- package/dist/visualizations/catalog.js +133 -0
- package/dist/visualizations/index.d.ts +2 -0
- package/dist/visualizations/index.js +134 -0
- package/dist/visualizations/selectors.d.ts +11 -0
- package/dist/visualizations/selectors.js +196 -0
- package/dist/visualizations/selectors.test.d.ts +1 -0
- package/package.json +69 -8
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/visualizations/catalog.ts
|
|
3
|
+
import {
|
|
4
|
+
defineVisualization,
|
|
5
|
+
VisualizationRegistry
|
|
6
|
+
} from "@contractspec/lib.contracts-spec/visualizations";
|
|
7
|
+
var INSTANCE_LIST_REF = {
|
|
8
|
+
key: "workflow.instance.list",
|
|
9
|
+
version: "1.0.0"
|
|
10
|
+
};
|
|
11
|
+
var META = {
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
domain: "workflow",
|
|
14
|
+
stability: "experimental",
|
|
15
|
+
owners: ["@example.workflow-system"],
|
|
16
|
+
tags: ["workflow", "visualization", "operations"]
|
|
17
|
+
};
|
|
18
|
+
var WorkflowInstanceStatusVisualization = defineVisualization({
|
|
19
|
+
meta: {
|
|
20
|
+
...META,
|
|
21
|
+
key: "workflow-system.visualization.instance-status",
|
|
22
|
+
title: "Instance Status Breakdown",
|
|
23
|
+
description: "Distribution of workflow instance states.",
|
|
24
|
+
goal: "Surface the current workload mix.",
|
|
25
|
+
context: "Workflow operations overview."
|
|
26
|
+
},
|
|
27
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
28
|
+
visualization: {
|
|
29
|
+
kind: "pie",
|
|
30
|
+
nameDimension: "status",
|
|
31
|
+
valueMeasure: "instances",
|
|
32
|
+
dimensions: [
|
|
33
|
+
{ key: "status", label: "Status", dataPath: "status", type: "category" }
|
|
34
|
+
],
|
|
35
|
+
measures: [
|
|
36
|
+
{
|
|
37
|
+
key: "instances",
|
|
38
|
+
label: "Instances",
|
|
39
|
+
dataPath: "instances",
|
|
40
|
+
format: "number"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
table: { caption: "Workflow instance counts by status." }
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
var WorkflowThroughputVisualization = defineVisualization({
|
|
47
|
+
meta: {
|
|
48
|
+
...META,
|
|
49
|
+
key: "workflow-system.visualization.throughput",
|
|
50
|
+
title: "Run Throughput",
|
|
51
|
+
description: "Daily workflow instance starts.",
|
|
52
|
+
goal: "Show operational throughput over time.",
|
|
53
|
+
context: "Workflow trend monitoring."
|
|
54
|
+
},
|
|
55
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
56
|
+
visualization: {
|
|
57
|
+
kind: "cartesian",
|
|
58
|
+
variant: "line",
|
|
59
|
+
xDimension: "day",
|
|
60
|
+
yMeasures: ["instances"],
|
|
61
|
+
dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
|
|
62
|
+
measures: [
|
|
63
|
+
{
|
|
64
|
+
key: "instances",
|
|
65
|
+
label: "Instances",
|
|
66
|
+
dataPath: "instances",
|
|
67
|
+
format: "number",
|
|
68
|
+
color: "#0f766e"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
table: { caption: "Daily workflow instance starts." }
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
var WorkflowActiveMetricVisualization = defineVisualization({
|
|
75
|
+
meta: {
|
|
76
|
+
...META,
|
|
77
|
+
key: "workflow-system.visualization.active-work",
|
|
78
|
+
title: "Active Work",
|
|
79
|
+
description: "Current in-flight or pending workflow instances.",
|
|
80
|
+
goal: "Expose active operational workload.",
|
|
81
|
+
context: "Workflow workload comparison."
|
|
82
|
+
},
|
|
83
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
84
|
+
visualization: {
|
|
85
|
+
kind: "metric",
|
|
86
|
+
measure: "value",
|
|
87
|
+
measures: [
|
|
88
|
+
{ key: "value", label: "Instances", dataPath: "value", format: "number" }
|
|
89
|
+
],
|
|
90
|
+
table: { caption: "Active workflow count." }
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
var WorkflowCompletedMetricVisualization = defineVisualization({
|
|
94
|
+
meta: {
|
|
95
|
+
...META,
|
|
96
|
+
key: "workflow-system.visualization.completed-work",
|
|
97
|
+
title: "Completed Work",
|
|
98
|
+
description: "Completed workflow instances in the current sample.",
|
|
99
|
+
goal: "Show output against active workload.",
|
|
100
|
+
context: "Workflow workload comparison."
|
|
101
|
+
},
|
|
102
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
103
|
+
visualization: {
|
|
104
|
+
kind: "metric",
|
|
105
|
+
measure: "value",
|
|
106
|
+
measures: [
|
|
107
|
+
{ key: "value", label: "Instances", dataPath: "value", format: "number" }
|
|
108
|
+
],
|
|
109
|
+
table: { caption: "Completed workflow count." }
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
var WorkflowVisualizationSpecs = [
|
|
113
|
+
WorkflowInstanceStatusVisualization,
|
|
114
|
+
WorkflowThroughputVisualization,
|
|
115
|
+
WorkflowActiveMetricVisualization,
|
|
116
|
+
WorkflowCompletedMetricVisualization
|
|
117
|
+
];
|
|
118
|
+
var WorkflowVisualizationRegistry = new VisualizationRegistry([
|
|
119
|
+
...WorkflowVisualizationSpecs
|
|
120
|
+
]);
|
|
121
|
+
var WorkflowVisualizationRefs = WorkflowVisualizationSpecs.map((spec) => ({
|
|
122
|
+
key: spec.meta.key,
|
|
123
|
+
version: spec.meta.version
|
|
124
|
+
}));
|
|
125
|
+
export {
|
|
126
|
+
WorkflowVisualizationSpecs,
|
|
127
|
+
WorkflowVisualizationRegistry,
|
|
128
|
+
WorkflowVisualizationRefs,
|
|
129
|
+
WorkflowThroughputVisualization,
|
|
130
|
+
WorkflowInstanceStatusVisualization,
|
|
131
|
+
WorkflowCompletedMetricVisualization,
|
|
132
|
+
WorkflowActiveMetricVisualization
|
|
133
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/visualizations/catalog.ts
|
|
3
|
+
import {
|
|
4
|
+
defineVisualization,
|
|
5
|
+
VisualizationRegistry
|
|
6
|
+
} from "@contractspec/lib.contracts-spec/visualizations";
|
|
7
|
+
var INSTANCE_LIST_REF = {
|
|
8
|
+
key: "workflow.instance.list",
|
|
9
|
+
version: "1.0.0"
|
|
10
|
+
};
|
|
11
|
+
var META = {
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
domain: "workflow",
|
|
14
|
+
stability: "experimental",
|
|
15
|
+
owners: ["@example.workflow-system"],
|
|
16
|
+
tags: ["workflow", "visualization", "operations"]
|
|
17
|
+
};
|
|
18
|
+
var WorkflowInstanceStatusVisualization = defineVisualization({
|
|
19
|
+
meta: {
|
|
20
|
+
...META,
|
|
21
|
+
key: "workflow-system.visualization.instance-status",
|
|
22
|
+
title: "Instance Status Breakdown",
|
|
23
|
+
description: "Distribution of workflow instance states.",
|
|
24
|
+
goal: "Surface the current workload mix.",
|
|
25
|
+
context: "Workflow operations overview."
|
|
26
|
+
},
|
|
27
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
28
|
+
visualization: {
|
|
29
|
+
kind: "pie",
|
|
30
|
+
nameDimension: "status",
|
|
31
|
+
valueMeasure: "instances",
|
|
32
|
+
dimensions: [
|
|
33
|
+
{ key: "status", label: "Status", dataPath: "status", type: "category" }
|
|
34
|
+
],
|
|
35
|
+
measures: [
|
|
36
|
+
{
|
|
37
|
+
key: "instances",
|
|
38
|
+
label: "Instances",
|
|
39
|
+
dataPath: "instances",
|
|
40
|
+
format: "number"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
table: { caption: "Workflow instance counts by status." }
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
var WorkflowThroughputVisualization = defineVisualization({
|
|
47
|
+
meta: {
|
|
48
|
+
...META,
|
|
49
|
+
key: "workflow-system.visualization.throughput",
|
|
50
|
+
title: "Run Throughput",
|
|
51
|
+
description: "Daily workflow instance starts.",
|
|
52
|
+
goal: "Show operational throughput over time.",
|
|
53
|
+
context: "Workflow trend monitoring."
|
|
54
|
+
},
|
|
55
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
56
|
+
visualization: {
|
|
57
|
+
kind: "cartesian",
|
|
58
|
+
variant: "line",
|
|
59
|
+
xDimension: "day",
|
|
60
|
+
yMeasures: ["instances"],
|
|
61
|
+
dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
|
|
62
|
+
measures: [
|
|
63
|
+
{
|
|
64
|
+
key: "instances",
|
|
65
|
+
label: "Instances",
|
|
66
|
+
dataPath: "instances",
|
|
67
|
+
format: "number",
|
|
68
|
+
color: "#0f766e"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
table: { caption: "Daily workflow instance starts." }
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
var WorkflowActiveMetricVisualization = defineVisualization({
|
|
75
|
+
meta: {
|
|
76
|
+
...META,
|
|
77
|
+
key: "workflow-system.visualization.active-work",
|
|
78
|
+
title: "Active Work",
|
|
79
|
+
description: "Current in-flight or pending workflow instances.",
|
|
80
|
+
goal: "Expose active operational workload.",
|
|
81
|
+
context: "Workflow workload comparison."
|
|
82
|
+
},
|
|
83
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
84
|
+
visualization: {
|
|
85
|
+
kind: "metric",
|
|
86
|
+
measure: "value",
|
|
87
|
+
measures: [
|
|
88
|
+
{ key: "value", label: "Instances", dataPath: "value", format: "number" }
|
|
89
|
+
],
|
|
90
|
+
table: { caption: "Active workflow count." }
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
var WorkflowCompletedMetricVisualization = defineVisualization({
|
|
94
|
+
meta: {
|
|
95
|
+
...META,
|
|
96
|
+
key: "workflow-system.visualization.completed-work",
|
|
97
|
+
title: "Completed Work",
|
|
98
|
+
description: "Completed workflow instances in the current sample.",
|
|
99
|
+
goal: "Show output against active workload.",
|
|
100
|
+
context: "Workflow workload comparison."
|
|
101
|
+
},
|
|
102
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
103
|
+
visualization: {
|
|
104
|
+
kind: "metric",
|
|
105
|
+
measure: "value",
|
|
106
|
+
measures: [
|
|
107
|
+
{ key: "value", label: "Instances", dataPath: "value", format: "number" }
|
|
108
|
+
],
|
|
109
|
+
table: { caption: "Completed workflow count." }
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
var WorkflowVisualizationSpecs = [
|
|
113
|
+
WorkflowInstanceStatusVisualization,
|
|
114
|
+
WorkflowThroughputVisualization,
|
|
115
|
+
WorkflowActiveMetricVisualization,
|
|
116
|
+
WorkflowCompletedMetricVisualization
|
|
117
|
+
];
|
|
118
|
+
var WorkflowVisualizationRegistry = new VisualizationRegistry([
|
|
119
|
+
...WorkflowVisualizationSpecs
|
|
120
|
+
]);
|
|
121
|
+
var WorkflowVisualizationRefs = WorkflowVisualizationSpecs.map((spec) => ({
|
|
122
|
+
key: spec.meta.key,
|
|
123
|
+
version: spec.meta.version
|
|
124
|
+
}));
|
|
125
|
+
export {
|
|
126
|
+
createWorkflowVisualizationSections,
|
|
127
|
+
WorkflowVisualizationSpecs,
|
|
128
|
+
WorkflowVisualizationRegistry,
|
|
129
|
+
WorkflowVisualizationRefs,
|
|
130
|
+
WorkflowThroughputVisualization,
|
|
131
|
+
WorkflowInstanceStatusVisualization,
|
|
132
|
+
WorkflowCompletedMetricVisualization,
|
|
133
|
+
WorkflowActiveMetricVisualization
|
|
134
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { VisualizationSurfaceItem } from '@contractspec/lib.design-system';
|
|
2
|
+
import type { WorkflowInstance } from '../handlers/workflow.handlers';
|
|
3
|
+
type DateLike = Date | string;
|
|
4
|
+
interface WorkflowInstanceLike extends Pick<WorkflowInstance, 'status'> {
|
|
5
|
+
startedAt: DateLike;
|
|
6
|
+
}
|
|
7
|
+
export declare function createWorkflowVisualizationSections(instances: WorkflowInstanceLike[]): {
|
|
8
|
+
primaryItems: VisualizationSurfaceItem[];
|
|
9
|
+
comparisonItems: VisualizationSurfaceItem[];
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/visualizations/catalog.ts
|
|
3
|
+
import {
|
|
4
|
+
defineVisualization,
|
|
5
|
+
VisualizationRegistry
|
|
6
|
+
} from "@contractspec/lib.contracts-spec/visualizations";
|
|
7
|
+
var INSTANCE_LIST_REF = {
|
|
8
|
+
key: "workflow.instance.list",
|
|
9
|
+
version: "1.0.0"
|
|
10
|
+
};
|
|
11
|
+
var META = {
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
domain: "workflow",
|
|
14
|
+
stability: "experimental",
|
|
15
|
+
owners: ["@example.workflow-system"],
|
|
16
|
+
tags: ["workflow", "visualization", "operations"]
|
|
17
|
+
};
|
|
18
|
+
var WorkflowInstanceStatusVisualization = defineVisualization({
|
|
19
|
+
meta: {
|
|
20
|
+
...META,
|
|
21
|
+
key: "workflow-system.visualization.instance-status",
|
|
22
|
+
title: "Instance Status Breakdown",
|
|
23
|
+
description: "Distribution of workflow instance states.",
|
|
24
|
+
goal: "Surface the current workload mix.",
|
|
25
|
+
context: "Workflow operations overview."
|
|
26
|
+
},
|
|
27
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
28
|
+
visualization: {
|
|
29
|
+
kind: "pie",
|
|
30
|
+
nameDimension: "status",
|
|
31
|
+
valueMeasure: "instances",
|
|
32
|
+
dimensions: [
|
|
33
|
+
{ key: "status", label: "Status", dataPath: "status", type: "category" }
|
|
34
|
+
],
|
|
35
|
+
measures: [
|
|
36
|
+
{
|
|
37
|
+
key: "instances",
|
|
38
|
+
label: "Instances",
|
|
39
|
+
dataPath: "instances",
|
|
40
|
+
format: "number"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
table: { caption: "Workflow instance counts by status." }
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
var WorkflowThroughputVisualization = defineVisualization({
|
|
47
|
+
meta: {
|
|
48
|
+
...META,
|
|
49
|
+
key: "workflow-system.visualization.throughput",
|
|
50
|
+
title: "Run Throughput",
|
|
51
|
+
description: "Daily workflow instance starts.",
|
|
52
|
+
goal: "Show operational throughput over time.",
|
|
53
|
+
context: "Workflow trend monitoring."
|
|
54
|
+
},
|
|
55
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
56
|
+
visualization: {
|
|
57
|
+
kind: "cartesian",
|
|
58
|
+
variant: "line",
|
|
59
|
+
xDimension: "day",
|
|
60
|
+
yMeasures: ["instances"],
|
|
61
|
+
dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
|
|
62
|
+
measures: [
|
|
63
|
+
{
|
|
64
|
+
key: "instances",
|
|
65
|
+
label: "Instances",
|
|
66
|
+
dataPath: "instances",
|
|
67
|
+
format: "number",
|
|
68
|
+
color: "#0f766e"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
table: { caption: "Daily workflow instance starts." }
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
var WorkflowActiveMetricVisualization = defineVisualization({
|
|
75
|
+
meta: {
|
|
76
|
+
...META,
|
|
77
|
+
key: "workflow-system.visualization.active-work",
|
|
78
|
+
title: "Active Work",
|
|
79
|
+
description: "Current in-flight or pending workflow instances.",
|
|
80
|
+
goal: "Expose active operational workload.",
|
|
81
|
+
context: "Workflow workload comparison."
|
|
82
|
+
},
|
|
83
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
84
|
+
visualization: {
|
|
85
|
+
kind: "metric",
|
|
86
|
+
measure: "value",
|
|
87
|
+
measures: [
|
|
88
|
+
{ key: "value", label: "Instances", dataPath: "value", format: "number" }
|
|
89
|
+
],
|
|
90
|
+
table: { caption: "Active workflow count." }
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
var WorkflowCompletedMetricVisualization = defineVisualization({
|
|
94
|
+
meta: {
|
|
95
|
+
...META,
|
|
96
|
+
key: "workflow-system.visualization.completed-work",
|
|
97
|
+
title: "Completed Work",
|
|
98
|
+
description: "Completed workflow instances in the current sample.",
|
|
99
|
+
goal: "Show output against active workload.",
|
|
100
|
+
context: "Workflow workload comparison."
|
|
101
|
+
},
|
|
102
|
+
source: { primary: INSTANCE_LIST_REF, resultPath: "data" },
|
|
103
|
+
visualization: {
|
|
104
|
+
kind: "metric",
|
|
105
|
+
measure: "value",
|
|
106
|
+
measures: [
|
|
107
|
+
{ key: "value", label: "Instances", dataPath: "value", format: "number" }
|
|
108
|
+
],
|
|
109
|
+
table: { caption: "Completed workflow count." }
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
var WorkflowVisualizationSpecs = [
|
|
113
|
+
WorkflowInstanceStatusVisualization,
|
|
114
|
+
WorkflowThroughputVisualization,
|
|
115
|
+
WorkflowActiveMetricVisualization,
|
|
116
|
+
WorkflowCompletedMetricVisualization
|
|
117
|
+
];
|
|
118
|
+
var WorkflowVisualizationRegistry = new VisualizationRegistry([
|
|
119
|
+
...WorkflowVisualizationSpecs
|
|
120
|
+
]);
|
|
121
|
+
var WorkflowVisualizationRefs = WorkflowVisualizationSpecs.map((spec) => ({
|
|
122
|
+
key: spec.meta.key,
|
|
123
|
+
version: spec.meta.version
|
|
124
|
+
}));
|
|
125
|
+
|
|
126
|
+
// src/visualizations/selectors.ts
|
|
127
|
+
function toDayKey(value) {
|
|
128
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
129
|
+
return date.toISOString().slice(0, 10);
|
|
130
|
+
}
|
|
131
|
+
function createWorkflowVisualizationSections(instances) {
|
|
132
|
+
const statusCounts = new Map;
|
|
133
|
+
const throughput = new Map;
|
|
134
|
+
let activeCount = 0;
|
|
135
|
+
let completedCount = 0;
|
|
136
|
+
for (const instance of instances) {
|
|
137
|
+
statusCounts.set(instance.status, (statusCounts.get(instance.status) ?? 0) + 1);
|
|
138
|
+
const day = toDayKey(instance.startedAt);
|
|
139
|
+
throughput.set(day, (throughput.get(day) ?? 0) + 1);
|
|
140
|
+
if (instance.status === "PENDING" || instance.status === "IN_PROGRESS") {
|
|
141
|
+
activeCount += 1;
|
|
142
|
+
}
|
|
143
|
+
if (instance.status === "COMPLETED") {
|
|
144
|
+
completedCount += 1;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const primaryItems = [
|
|
148
|
+
{
|
|
149
|
+
key: "workflow-status",
|
|
150
|
+
spec: WorkflowInstanceStatusVisualization,
|
|
151
|
+
data: {
|
|
152
|
+
data: Array.from(statusCounts.entries()).map(([status, count]) => ({
|
|
153
|
+
status,
|
|
154
|
+
instances: count
|
|
155
|
+
}))
|
|
156
|
+
},
|
|
157
|
+
title: "Instance Status Breakdown",
|
|
158
|
+
description: "Status mix across workflow instances.",
|
|
159
|
+
height: 260
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
key: "workflow-throughput",
|
|
163
|
+
spec: WorkflowThroughputVisualization,
|
|
164
|
+
data: {
|
|
165
|
+
data: Array.from(throughput.entries()).sort(([left], [right]) => left.localeCompare(right)).map(([day, count]) => ({ day, instances: count }))
|
|
166
|
+
},
|
|
167
|
+
title: "Run Throughput",
|
|
168
|
+
description: "Daily workflow starts from current instances."
|
|
169
|
+
}
|
|
170
|
+
];
|
|
171
|
+
const comparisonItems = [
|
|
172
|
+
{
|
|
173
|
+
key: "workflow-active",
|
|
174
|
+
spec: WorkflowActiveMetricVisualization,
|
|
175
|
+
data: { data: [{ value: activeCount }] },
|
|
176
|
+
title: "Active Work",
|
|
177
|
+
description: "Pending and in-progress workflows.",
|
|
178
|
+
height: 200
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
key: "workflow-completed",
|
|
182
|
+
spec: WorkflowCompletedMetricVisualization,
|
|
183
|
+
data: { data: [{ value: completedCount }] },
|
|
184
|
+
title: "Completed Work",
|
|
185
|
+
description: "Completed workflows in the current sample.",
|
|
186
|
+
height: 200
|
|
187
|
+
}
|
|
188
|
+
];
|
|
189
|
+
return {
|
|
190
|
+
primaryItems,
|
|
191
|
+
comparisonItems
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
export {
|
|
195
|
+
createWorkflowVisualizationSections
|
|
196
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/example.workflow-system",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.2",
|
|
4
4
|
"description": "Workflow and approval system example for ContractSpec - State machine with role-based transitions",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -16,23 +16,24 @@
|
|
|
16
16
|
"lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
|
|
17
17
|
"lint:check": "biome check .",
|
|
18
18
|
"prebuild": "contractspec-bun-build prebuild",
|
|
19
|
+
"test": "bun test",
|
|
19
20
|
"typecheck": "tsc --noEmit"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@contractspec/lib.schema": "3.7.
|
|
23
|
-
"@contractspec/lib.contracts-spec": "4.
|
|
24
|
-
"@contractspec/lib.example-shared-ui": "6.0.
|
|
25
|
-
"@contractspec/lib.design-system": "3.8.
|
|
26
|
-
"@contractspec/lib.runtime-sandbox": "2.7.
|
|
23
|
+
"@contractspec/lib.schema": "3.7.8",
|
|
24
|
+
"@contractspec/lib.contracts-spec": "4.1.2",
|
|
25
|
+
"@contractspec/lib.example-shared-ui": "6.0.10",
|
|
26
|
+
"@contractspec/lib.design-system": "3.8.3",
|
|
27
|
+
"@contractspec/lib.runtime-sandbox": "2.7.9",
|
|
27
28
|
"react": "19.2.0",
|
|
28
29
|
"react-dom": "19.2.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@contractspec/tool.typescript": "3.7.
|
|
32
|
+
"@contractspec/tool.typescript": "3.7.8",
|
|
32
33
|
"typescript": "^5.9.3",
|
|
33
34
|
"@types/react": "^19.2.14",
|
|
34
35
|
"@types/react-dom": "^19.2.2",
|
|
35
|
-
"@contractspec/tool.bun": "3.7.
|
|
36
|
+
"@contractspec/tool.bun": "3.7.8"
|
|
36
37
|
},
|
|
37
38
|
"exports": {
|
|
38
39
|
".": {
|
|
@@ -191,6 +192,12 @@
|
|
|
191
192
|
"bun": "./dist/shared/index.js",
|
|
192
193
|
"default": "./dist/shared/index.js"
|
|
193
194
|
},
|
|
195
|
+
"./shared/demo-scenario": {
|
|
196
|
+
"types": "./dist/shared/demo-scenario.d.ts",
|
|
197
|
+
"browser": "./dist/browser/shared/demo-scenario.js",
|
|
198
|
+
"bun": "./dist/shared/demo-scenario.js",
|
|
199
|
+
"default": "./dist/shared/demo-scenario.js"
|
|
200
|
+
},
|
|
194
201
|
"./shared/mock-data": {
|
|
195
202
|
"types": "./dist/shared/mock-data.d.ts",
|
|
196
203
|
"browser": "./dist/browser/shared/mock-data.js",
|
|
@@ -251,6 +258,30 @@
|
|
|
251
258
|
"bun": "./dist/ui/WorkflowDashboard.js",
|
|
252
259
|
"default": "./dist/ui/WorkflowDashboard.js"
|
|
253
260
|
},
|
|
261
|
+
"./ui/WorkflowDashboard.visualizations": {
|
|
262
|
+
"types": "./dist/ui/WorkflowDashboard.visualizations.d.ts",
|
|
263
|
+
"browser": "./dist/browser/ui/WorkflowDashboard.visualizations.js",
|
|
264
|
+
"bun": "./dist/ui/WorkflowDashboard.visualizations.js",
|
|
265
|
+
"default": "./dist/ui/WorkflowDashboard.visualizations.js"
|
|
266
|
+
},
|
|
267
|
+
"./visualizations": {
|
|
268
|
+
"types": "./dist/visualizations/index.d.ts",
|
|
269
|
+
"browser": "./dist/browser/visualizations/index.js",
|
|
270
|
+
"bun": "./dist/visualizations/index.js",
|
|
271
|
+
"default": "./dist/visualizations/index.js"
|
|
272
|
+
},
|
|
273
|
+
"./visualizations/catalog": {
|
|
274
|
+
"types": "./dist/visualizations/catalog.d.ts",
|
|
275
|
+
"browser": "./dist/browser/visualizations/catalog.js",
|
|
276
|
+
"bun": "./dist/visualizations/catalog.js",
|
|
277
|
+
"default": "./dist/visualizations/catalog.js"
|
|
278
|
+
},
|
|
279
|
+
"./visualizations/selectors": {
|
|
280
|
+
"types": "./dist/visualizations/selectors.d.ts",
|
|
281
|
+
"browser": "./dist/browser/visualizations/selectors.js",
|
|
282
|
+
"bun": "./dist/visualizations/selectors.js",
|
|
283
|
+
"default": "./dist/visualizations/selectors.js"
|
|
284
|
+
},
|
|
254
285
|
"./workflow": {
|
|
255
286
|
"types": "./dist/workflow/index.d.ts",
|
|
256
287
|
"browser": "./dist/browser/workflow/index.js",
|
|
@@ -463,6 +494,12 @@
|
|
|
463
494
|
"bun": "./dist/shared/index.js",
|
|
464
495
|
"default": "./dist/shared/index.js"
|
|
465
496
|
},
|
|
497
|
+
"./shared/demo-scenario": {
|
|
498
|
+
"types": "./dist/shared/demo-scenario.d.ts",
|
|
499
|
+
"browser": "./dist/browser/shared/demo-scenario.js",
|
|
500
|
+
"bun": "./dist/shared/demo-scenario.js",
|
|
501
|
+
"default": "./dist/shared/demo-scenario.js"
|
|
502
|
+
},
|
|
466
503
|
"./shared/mock-data": {
|
|
467
504
|
"types": "./dist/shared/mock-data.d.ts",
|
|
468
505
|
"browser": "./dist/browser/shared/mock-data.js",
|
|
@@ -523,6 +560,30 @@
|
|
|
523
560
|
"bun": "./dist/ui/WorkflowDashboard.js",
|
|
524
561
|
"default": "./dist/ui/WorkflowDashboard.js"
|
|
525
562
|
},
|
|
563
|
+
"./ui/WorkflowDashboard.visualizations": {
|
|
564
|
+
"types": "./dist/ui/WorkflowDashboard.visualizations.d.ts",
|
|
565
|
+
"browser": "./dist/browser/ui/WorkflowDashboard.visualizations.js",
|
|
566
|
+
"bun": "./dist/ui/WorkflowDashboard.visualizations.js",
|
|
567
|
+
"default": "./dist/ui/WorkflowDashboard.visualizations.js"
|
|
568
|
+
},
|
|
569
|
+
"./visualizations": {
|
|
570
|
+
"types": "./dist/visualizations/index.d.ts",
|
|
571
|
+
"browser": "./dist/browser/visualizations/index.js",
|
|
572
|
+
"bun": "./dist/visualizations/index.js",
|
|
573
|
+
"default": "./dist/visualizations/index.js"
|
|
574
|
+
},
|
|
575
|
+
"./visualizations/catalog": {
|
|
576
|
+
"types": "./dist/visualizations/catalog.d.ts",
|
|
577
|
+
"browser": "./dist/browser/visualizations/catalog.js",
|
|
578
|
+
"bun": "./dist/visualizations/catalog.js",
|
|
579
|
+
"default": "./dist/visualizations/catalog.js"
|
|
580
|
+
},
|
|
581
|
+
"./visualizations/selectors": {
|
|
582
|
+
"types": "./dist/visualizations/selectors.d.ts",
|
|
583
|
+
"browser": "./dist/browser/visualizations/selectors.js",
|
|
584
|
+
"bun": "./dist/visualizations/selectors.js",
|
|
585
|
+
"default": "./dist/visualizations/selectors.js"
|
|
586
|
+
},
|
|
526
587
|
"./workflow": {
|
|
527
588
|
"types": "./dist/workflow/index.d.ts",
|
|
528
589
|
"browser": "./dist/browser/workflow/index.js",
|