@contractspec/example.workflow-system 1.57.0 → 1.59.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 +2 -7
- package/dist/approval/approval.enum.d.ts.map +1 -1
- package/dist/approval/approval.enum.js +20 -26
- package/dist/approval/approval.event.d.ts +108 -114
- package/dist/approval/approval.event.d.ts.map +1 -1
- package/dist/approval/approval.event.js +103 -210
- package/dist/approval/approval.handler.d.ts +17 -18
- package/dist/approval/approval.handler.d.ts.map +1 -1
- package/dist/approval/approval.operations.d.ts +429 -435
- package/dist/approval/approval.operations.d.ts.map +1 -1
- package/dist/approval/approval.operations.js +364 -339
- package/dist/approval/approval.schema.d.ts +86 -91
- package/dist/approval/approval.schema.d.ts.map +1 -1
- package/dist/approval/approval.schema.js +71 -107
- package/dist/approval/index.d.ts +8 -5
- package/dist/approval/index.d.ts.map +1 -0
- package/dist/approval/index.js +484 -5
- package/dist/browser/approval/approval.enum.js +22 -0
- package/dist/browser/approval/approval.event.js +112 -0
- package/dist/browser/approval/approval.operations.js +369 -0
- package/dist/browser/approval/approval.schema.js +73 -0
- package/dist/browser/approval/index.js +484 -0
- package/dist/browser/docs/index.js +103 -0
- package/dist/browser/docs/workflow-system.docblock.js +103 -0
- package/dist/browser/entities/approval.js +119 -0
- package/dist/browser/entities/index.js +508 -0
- package/dist/browser/entities/instance.js +161 -0
- package/dist/browser/entities/step.js +124 -0
- package/dist/browser/entities/workflow.js +82 -0
- package/dist/browser/example.js +42 -0
- package/dist/browser/handlers/index.js +253 -0
- package/dist/browser/handlers/workflow.handlers.js +253 -0
- package/dist/browser/index.js +3120 -0
- package/dist/browser/instance/index.js +677 -0
- package/dist/browser/instance/instance.enum.js +15 -0
- package/dist/browser/instance/instance.event.js +164 -0
- package/dist/browser/instance/instance.handler.js +356 -0
- package/dist/browser/instance/instance.operations.js +9 -0
- package/dist/browser/instance/instance.schema.js +101 -0
- package/dist/browser/presentations/index.js +109 -0
- package/dist/browser/seeders/index.js +3 -0
- package/dist/browser/shared/index.js +3 -0
- package/dist/browser/shared/mock-data.js +11 -0
- package/dist/browser/shared/types.js +0 -0
- package/dist/browser/state-machine/index.js +6 -0
- package/dist/browser/tests/operations.test-spec.js +6 -0
- package/dist/browser/ui/WorkflowDashboard.js +3 -0
- package/dist/browser/ui/hooks/index.js +50 -0
- package/dist/browser/ui/hooks/useWorkflowList.js +50 -0
- package/dist/browser/ui/index.js +54 -0
- package/dist/browser/ui/renderers/index.js +227 -0
- package/dist/browser/ui/renderers/workflow.markdown.js +227 -0
- package/dist/browser/workflow/index.js +21 -0
- package/dist/browser/workflow/workflow.enum.js +36 -0
- package/dist/browser/workflow/workflow.event.js +6 -0
- package/dist/browser/workflow/workflow.handler.js +5 -0
- package/dist/browser/workflow/workflow.operations.js +8 -0
- package/dist/browser/workflow/workflow.schema.js +151 -0
- package/dist/browser/workflow-system.capability.js +5 -0
- package/dist/browser/workflow-system.feature.js +3 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +104 -1
- package/dist/docs/workflow-system.docblock.d.ts +2 -1
- package/dist/docs/workflow-system.docblock.d.ts.map +1 -0
- package/dist/docs/workflow-system.docblock.js +45 -56
- package/dist/entities/approval.d.ts +35 -40
- package/dist/entities/approval.d.ts.map +1 -1
- package/dist/entities/approval.js +116 -124
- package/dist/entities/index.d.ts +132 -137
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +506 -29
- package/dist/entities/instance.d.ts +46 -51
- package/dist/entities/instance.d.ts.map +1 -1
- package/dist/entities/instance.js +158 -164
- package/dist/entities/step.d.ts +31 -36
- package/dist/entities/step.d.ts.map +1 -1
- package/dist/entities/step.js +122 -132
- package/dist/entities/workflow.d.ts +22 -27
- package/dist/entities/workflow.d.ts.map +1 -1
- package/dist/entities/workflow.js +80 -99
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +41 -55
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +254 -3
- package/dist/handlers/workflow.handlers.d.ts +107 -106
- package/dist/handlers/workflow.handlers.d.ts.map +1 -1
- package/dist/handlers/workflow.handlers.js +237 -246
- package/dist/index.d.ts +15 -26
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3121 -26
- package/dist/instance/index.d.ts +8 -5
- package/dist/instance/index.d.ts.map +1 -0
- package/dist/instance/index.js +677 -5
- package/dist/instance/instance.enum.d.ts +1 -6
- package/dist/instance/instance.enum.d.ts.map +1 -1
- package/dist/instance/instance.enum.js +14 -18
- package/dist/instance/instance.event.d.ts +313 -319
- package/dist/instance/instance.event.d.ts.map +1 -1
- package/dist/instance/instance.event.js +151 -279
- package/dist/instance/instance.handler.d.ts +21 -22
- package/dist/instance/instance.handler.d.ts.map +1 -1
- package/dist/instance/instance.handler.js +352 -89
- package/dist/instance/instance.operations.d.ts +819 -825
- package/dist/instance/instance.operations.d.ts.map +1 -1
- package/dist/instance/instance.operations.js +10 -464
- package/dist/instance/instance.schema.d.ts +196 -201
- package/dist/instance/instance.schema.d.ts.map +1 -1
- package/dist/instance/instance.schema.js +97 -167
- package/dist/presentations/index.d.ts +23 -28
- package/dist/presentations/index.d.ts.map +1 -1
- package/dist/presentations/index.js +104 -334
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +4 -19
- package/dist/shared/index.d.ts +6 -3
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +4 -3
- package/dist/shared/mock-data.d.ts +16 -16
- package/dist/shared/mock-data.d.ts.map +1 -1
- package/dist/shared/mock-data.js +11 -11
- package/dist/shared/types.d.ts +69 -72
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js +1 -0
- package/dist/state-machine/index.d.ts +92 -95
- package/dist/state-machine/index.d.ts.map +1 -1
- package/dist/state-machine/index.js +6 -157
- package/dist/tests/operations.test-spec.d.ts +4 -9
- package/dist/tests/operations.test-spec.d.ts.map +1 -1
- package/dist/tests/operations.test-spec.js +7 -123
- package/dist/ui/WorkflowDashboard.d.ts +1 -6
- package/dist/ui/WorkflowDashboard.d.ts.map +1 -1
- package/dist/ui/WorkflowDashboard.js +3 -222
- package/dist/ui/hooks/index.d.ts +2 -2
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +51 -5
- package/dist/ui/hooks/useWorkflowList.d.ts +15 -19
- package/dist/ui/hooks/useWorkflowList.d.ts.map +1 -1
- package/dist/ui/hooks/useWorkflowList.js +47 -51
- package/dist/ui/index.d.ts +7 -6
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +55 -6
- package/dist/ui/renderers/index.d.ts +2 -2
- package/dist/ui/renderers/index.d.ts.map +1 -0
- package/dist/ui/renderers/index.js +227 -2
- package/dist/ui/renderers/workflow.markdown.d.ts +13 -14
- package/dist/ui/renderers/workflow.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/workflow.markdown.js +223 -229
- package/dist/workflow/index.d.ts +8 -5
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +22 -6
- package/dist/workflow/workflow.enum.d.ts +4 -9
- package/dist/workflow/workflow.enum.d.ts.map +1 -1
- package/dist/workflow/workflow.enum.js +32 -42
- package/dist/workflow/workflow.event.d.ts +112 -118
- package/dist/workflow/workflow.event.d.ts.map +1 -1
- package/dist/workflow/workflow.event.js +7 -150
- package/dist/workflow/workflow.handler.d.ts +23 -24
- package/dist/workflow/workflow.handler.d.ts.map +1 -1
- package/dist/workflow/workflow.handler.js +6 -66
- package/dist/workflow/workflow.operations.d.ts +847 -853
- package/dist/workflow/workflow.operations.d.ts.map +1 -1
- package/dist/workflow/workflow.operations.js +9 -345
- package/dist/workflow/workflow.schema.d.ts +229 -234
- package/dist/workflow/workflow.schema.d.ts.map +1 -1
- package/dist/workflow/workflow.schema.js +146 -243
- package/dist/workflow-system.capability.d.ts +3 -8
- package/dist/workflow-system.capability.d.ts.map +1 -1
- package/dist/workflow-system.capability.js +6 -34
- package/dist/workflow-system.feature.d.ts +1 -6
- package/dist/workflow-system.feature.d.ts.map +1 -1
- package/dist/workflow-system.feature.js +4 -346
- package/package.json +415 -93
- package/dist/approval/approval.enum.js.map +0 -1
- package/dist/approval/approval.event.js.map +0 -1
- package/dist/approval/approval.handler.js +0 -72
- package/dist/approval/approval.handler.js.map +0 -1
- package/dist/approval/approval.operations.js.map +0 -1
- package/dist/approval/approval.schema.js.map +0 -1
- package/dist/docs/workflow-system.docblock.js.map +0 -1
- package/dist/entities/approval.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/entities/instance.js.map +0 -1
- package/dist/entities/step.js.map +0 -1
- package/dist/entities/workflow.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/workflow.handlers.js.map +0 -1
- package/dist/instance/instance.enum.js.map +0 -1
- package/dist/instance/instance.event.js.map +0 -1
- package/dist/instance/instance.handler.js.map +0 -1
- package/dist/instance/instance.operations.js.map +0 -1
- package/dist/instance/instance.schema.js.map +0 -1
- package/dist/presentations/index.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/shared/mock-data.js.map +0 -1
- package/dist/state-machine/index.js.map +0 -1
- package/dist/tests/operations.test-spec.js.map +0 -1
- package/dist/ui/WorkflowDashboard.js.map +0 -1
- package/dist/ui/hooks/useWorkflowList.js.map +0 -1
- package/dist/ui/renderers/workflow.markdown.js.map +0 -1
- package/dist/workflow/workflow.enum.js.map +0 -1
- package/dist/workflow/workflow.event.js.map +0 -1
- package/dist/workflow/workflow.handler.js.map +0 -1
- package/dist/workflow/workflow.operations.js.map +0 -1
- package/dist/workflow/workflow.schema.js.map +0 -1
- package/dist/workflow-system.capability.js.map +0 -1
- package/dist/workflow-system.feature.js.map +0 -1
|
@@ -1,123 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
stability: "experimental",
|
|
9
|
-
owners: ["@example.workflow-system"],
|
|
10
|
-
description: "Test for listing workflow definitions",
|
|
11
|
-
tags: ["test"]
|
|
12
|
-
},
|
|
13
|
-
target: {
|
|
14
|
-
type: "operation",
|
|
15
|
-
operation: {
|
|
16
|
-
key: "workflow.definition.list",
|
|
17
|
-
version: "1.0.0"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
scenarios: [{
|
|
21
|
-
key: "success",
|
|
22
|
-
when: { operation: { key: "workflow.definition.list" } },
|
|
23
|
-
then: [{
|
|
24
|
-
type: "expectOutput",
|
|
25
|
-
match: {}
|
|
26
|
-
}]
|
|
27
|
-
}, {
|
|
28
|
-
key: "error",
|
|
29
|
-
when: { operation: { key: "workflow.definition.list" } },
|
|
30
|
-
then: [{ type: "expectError" }]
|
|
31
|
-
}]
|
|
32
|
-
});
|
|
33
|
-
const InstanceListTest = defineTestSpec({
|
|
34
|
-
meta: {
|
|
35
|
-
key: "workflow.instance.list.test",
|
|
36
|
-
version: "1.0.0",
|
|
37
|
-
stability: "experimental",
|
|
38
|
-
owners: ["@example.workflow-system"],
|
|
39
|
-
description: "Test for listing workflow instances",
|
|
40
|
-
tags: ["test"]
|
|
41
|
-
},
|
|
42
|
-
target: {
|
|
43
|
-
type: "operation",
|
|
44
|
-
operation: {
|
|
45
|
-
key: "workflow.instance.list",
|
|
46
|
-
version: "1.0.0"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
scenarios: [{
|
|
50
|
-
key: "success",
|
|
51
|
-
when: { operation: { key: "workflow.instance.list" } },
|
|
52
|
-
then: [{
|
|
53
|
-
type: "expectOutput",
|
|
54
|
-
match: {}
|
|
55
|
-
}]
|
|
56
|
-
}, {
|
|
57
|
-
key: "error",
|
|
58
|
-
when: { operation: { key: "workflow.instance.list" } },
|
|
59
|
-
then: [{ type: "expectError" }]
|
|
60
|
-
}]
|
|
61
|
-
});
|
|
62
|
-
const ApprovalListMineTest = defineTestSpec({
|
|
63
|
-
meta: {
|
|
64
|
-
key: "workflow.approval.list.mine.test",
|
|
65
|
-
version: "1.0.0",
|
|
66
|
-
stability: "experimental",
|
|
67
|
-
owners: ["@example.workflow-system"],
|
|
68
|
-
description: "Test for listing my approvals",
|
|
69
|
-
tags: ["test"]
|
|
70
|
-
},
|
|
71
|
-
target: {
|
|
72
|
-
type: "operation",
|
|
73
|
-
operation: {
|
|
74
|
-
key: "workflow.approval.list.mine",
|
|
75
|
-
version: "1.0.0"
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
scenarios: [{
|
|
79
|
-
key: "success",
|
|
80
|
-
when: { operation: { key: "workflow.approval.list.mine" } },
|
|
81
|
-
then: [{
|
|
82
|
-
type: "expectOutput",
|
|
83
|
-
match: {}
|
|
84
|
-
}]
|
|
85
|
-
}, {
|
|
86
|
-
key: "error",
|
|
87
|
-
when: { operation: { key: "workflow.approval.list.mine" } },
|
|
88
|
-
then: [{ type: "expectError" }]
|
|
89
|
-
}]
|
|
90
|
-
});
|
|
91
|
-
const ApprovalDecideTest = defineTestSpec({
|
|
92
|
-
meta: {
|
|
93
|
-
key: "workflow.approval.decide.test",
|
|
94
|
-
version: "1.0.0",
|
|
95
|
-
stability: "experimental",
|
|
96
|
-
owners: ["@example.workflow-system"],
|
|
97
|
-
description: "Test for deciding on approval",
|
|
98
|
-
tags: ["test"]
|
|
99
|
-
},
|
|
100
|
-
target: {
|
|
101
|
-
type: "operation",
|
|
102
|
-
operation: {
|
|
103
|
-
key: "workflow.approval.decide",
|
|
104
|
-
version: "1.0.0"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
scenarios: [{
|
|
108
|
-
key: "success",
|
|
109
|
-
when: { operation: { key: "workflow.approval.decide" } },
|
|
110
|
-
then: [{
|
|
111
|
-
type: "expectOutput",
|
|
112
|
-
match: {}
|
|
113
|
-
}]
|
|
114
|
-
}, {
|
|
115
|
-
key: "error",
|
|
116
|
-
when: { operation: { key: "workflow.approval.decide" } },
|
|
117
|
-
then: [{ type: "expectError" }]
|
|
118
|
-
}]
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
//#endregion
|
|
122
|
-
export { ApprovalDecideTest, ApprovalListMineTest, DefinitionListTest, InstanceListTest };
|
|
123
|
-
//# sourceMappingURL=operations.test-spec.js.map
|
|
1
|
+
// @bun
|
|
2
|
+
export {
|
|
3
|
+
InstanceListTest,
|
|
4
|
+
DefinitionListTest,
|
|
5
|
+
ApprovalListMineTest,
|
|
6
|
+
ApprovalDecideTest
|
|
7
|
+
};
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
//#region src/ui/WorkflowDashboard.d.ts
|
|
4
|
-
declare function WorkflowDashboard(): react_jsx_runtime0.JSX.Element;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { WorkflowDashboard };
|
|
1
|
+
export declare function WorkflowDashboard(): import("react/jsx-runtime").JSX.Element;
|
|
7
2
|
//# sourceMappingURL=WorkflowDashboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowDashboard.d.ts","
|
|
1
|
+
{"version":3,"file":"WorkflowDashboard.d.ts","sourceRoot":"","sources":["../../src/ui/WorkflowDashboard.tsx"],"names":[],"mappings":"AAmCA,wBAAgB,iBAAiB,4CA+LhC"}
|
|
@@ -1,223 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { useState } from "react";
|
|
5
|
-
import { Button, ErrorState, LoaderBlock, StatCard, StatCardGroup } from "@contractspec/lib.design-system";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
8
|
-
//#region src/ui/WorkflowDashboard.tsx
|
|
9
|
-
/**
|
|
10
|
-
* Workflow Dashboard
|
|
11
|
-
*
|
|
12
|
-
* Interactive dashboard for the workflow-system template.
|
|
13
|
-
* Displays workflow definitions and instances with stats.
|
|
14
|
-
*/
|
|
15
|
-
const STATUS_COLORS = {
|
|
16
|
-
ACTIVE: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
|
|
17
|
-
DRAFT: "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",
|
|
18
|
-
ARCHIVED: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",
|
|
19
|
-
PENDING: "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",
|
|
20
|
-
IN_PROGRESS: "bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-400",
|
|
21
|
-
COMPLETED: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
|
|
22
|
-
REJECTED: "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",
|
|
23
|
-
CANCELLED: "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400"
|
|
1
|
+
// @bun
|
|
2
|
+
export {
|
|
3
|
+
WorkflowDashboard
|
|
24
4
|
};
|
|
25
|
-
function WorkflowDashboard() {
|
|
26
|
-
const [activeTab, setActiveTab] = useState("definitions");
|
|
27
|
-
const { definitions, instances, loading, error, stats, refetch } = useWorkflowList();
|
|
28
|
-
const tabs = [{
|
|
29
|
-
id: "definitions",
|
|
30
|
-
label: "Definitions",
|
|
31
|
-
icon: "📋"
|
|
32
|
-
}, {
|
|
33
|
-
id: "instances",
|
|
34
|
-
label: "Instances",
|
|
35
|
-
icon: "🔄"
|
|
36
|
-
}];
|
|
37
|
-
if (loading) return /* @__PURE__ */ jsx(LoaderBlock, { label: "Loading Workflows..." });
|
|
38
|
-
if (error) return /* @__PURE__ */ jsx(ErrorState, {
|
|
39
|
-
title: "Failed to load Workflows",
|
|
40
|
-
description: error.message,
|
|
41
|
-
onRetry: refetch,
|
|
42
|
-
retryLabel: "Retry"
|
|
43
|
-
});
|
|
44
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
45
|
-
className: "space-y-6",
|
|
46
|
-
children: [
|
|
47
|
-
/* @__PURE__ */ jsxs("div", {
|
|
48
|
-
className: "flex items-center justify-between",
|
|
49
|
-
children: [/* @__PURE__ */ jsx("h2", {
|
|
50
|
-
className: "text-2xl font-bold",
|
|
51
|
-
children: "Workflow System"
|
|
52
|
-
}), /* @__PURE__ */ jsxs(Button, {
|
|
53
|
-
onClick: () => alert("Create workflow modal"),
|
|
54
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
55
|
-
className: "mr-2",
|
|
56
|
-
children: "+"
|
|
57
|
-
}), " New Workflow"]
|
|
58
|
-
})]
|
|
59
|
-
}),
|
|
60
|
-
/* @__PURE__ */ jsxs(StatCardGroup, { children: [
|
|
61
|
-
/* @__PURE__ */ jsx(StatCard, {
|
|
62
|
-
label: "Workflows",
|
|
63
|
-
value: stats.totalDefinitions,
|
|
64
|
-
hint: `${stats.activeDefinitions} active`
|
|
65
|
-
}),
|
|
66
|
-
/* @__PURE__ */ jsx(StatCard, {
|
|
67
|
-
label: "Instances",
|
|
68
|
-
value: stats.totalInstances,
|
|
69
|
-
hint: "total runs"
|
|
70
|
-
}),
|
|
71
|
-
/* @__PURE__ */ jsx(StatCard, {
|
|
72
|
-
label: "Pending",
|
|
73
|
-
value: stats.pendingInstances,
|
|
74
|
-
hint: "awaiting action"
|
|
75
|
-
}),
|
|
76
|
-
/* @__PURE__ */ jsx(StatCard, {
|
|
77
|
-
label: "Completed",
|
|
78
|
-
value: stats.completedInstances,
|
|
79
|
-
hint: "finished"
|
|
80
|
-
})
|
|
81
|
-
] }),
|
|
82
|
-
/* @__PURE__ */ jsx("nav", {
|
|
83
|
-
className: "bg-muted flex gap-1 rounded-lg p-1",
|
|
84
|
-
role: "tablist",
|
|
85
|
-
children: tabs.map((tab) => /* @__PURE__ */ jsxs(Button, {
|
|
86
|
-
type: "button",
|
|
87
|
-
role: "tab",
|
|
88
|
-
"aria-selected": activeTab === tab.id,
|
|
89
|
-
onClick: () => setActiveTab(tab.id),
|
|
90
|
-
className: `flex flex-1 items-center justify-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors ${activeTab === tab.id ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
|
|
91
|
-
children: [/* @__PURE__ */ jsx("span", { children: tab.icon }), tab.label]
|
|
92
|
-
}, tab.id))
|
|
93
|
-
}),
|
|
94
|
-
/* @__PURE__ */ jsxs("div", {
|
|
95
|
-
className: "min-h-[400px]",
|
|
96
|
-
role: "tabpanel",
|
|
97
|
-
children: [activeTab === "definitions" && /* @__PURE__ */ jsx("div", {
|
|
98
|
-
className: "border-border rounded-lg border",
|
|
99
|
-
children: /* @__PURE__ */ jsxs("table", {
|
|
100
|
-
className: "w-full",
|
|
101
|
-
children: [/* @__PURE__ */ jsx("thead", {
|
|
102
|
-
className: "border-border bg-muted/30 border-b",
|
|
103
|
-
children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
104
|
-
/* @__PURE__ */ jsx("th", {
|
|
105
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
106
|
-
children: "Name"
|
|
107
|
-
}),
|
|
108
|
-
/* @__PURE__ */ jsx("th", {
|
|
109
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
110
|
-
children: "Type"
|
|
111
|
-
}),
|
|
112
|
-
/* @__PURE__ */ jsx("th", {
|
|
113
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
114
|
-
children: "Status"
|
|
115
|
-
}),
|
|
116
|
-
/* @__PURE__ */ jsx("th", {
|
|
117
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
118
|
-
children: "Created"
|
|
119
|
-
})
|
|
120
|
-
] })
|
|
121
|
-
}), /* @__PURE__ */ jsxs("tbody", {
|
|
122
|
-
className: "divide-border divide-y",
|
|
123
|
-
children: [definitions.map((def) => /* @__PURE__ */ jsxs("tr", {
|
|
124
|
-
className: "hover:bg-muted/50",
|
|
125
|
-
children: [
|
|
126
|
-
/* @__PURE__ */ jsxs("td", {
|
|
127
|
-
className: "px-4 py-3",
|
|
128
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
129
|
-
className: "font-medium",
|
|
130
|
-
children: def.name
|
|
131
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
132
|
-
className: "text-muted-foreground text-sm",
|
|
133
|
-
children: def.description
|
|
134
|
-
})]
|
|
135
|
-
}),
|
|
136
|
-
/* @__PURE__ */ jsx("td", {
|
|
137
|
-
className: "px-4 py-3 font-mono text-sm",
|
|
138
|
-
children: def.type
|
|
139
|
-
}),
|
|
140
|
-
/* @__PURE__ */ jsx("td", {
|
|
141
|
-
className: "px-4 py-3",
|
|
142
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
143
|
-
className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[def.status] ?? ""}`,
|
|
144
|
-
children: def.status
|
|
145
|
-
})
|
|
146
|
-
}),
|
|
147
|
-
/* @__PURE__ */ jsx("td", {
|
|
148
|
-
className: "text-muted-foreground px-4 py-3 text-sm",
|
|
149
|
-
children: def.createdAt.toLocaleDateString()
|
|
150
|
-
})
|
|
151
|
-
]
|
|
152
|
-
}, def.id)), definitions.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
153
|
-
colSpan: 4,
|
|
154
|
-
className: "text-muted-foreground px-4 py-8 text-center",
|
|
155
|
-
children: "No workflow definitions found"
|
|
156
|
-
}) })]
|
|
157
|
-
})]
|
|
158
|
-
})
|
|
159
|
-
}), activeTab === "instances" && /* @__PURE__ */ jsx("div", {
|
|
160
|
-
className: "border-border rounded-lg border",
|
|
161
|
-
children: /* @__PURE__ */ jsxs("table", {
|
|
162
|
-
className: "w-full",
|
|
163
|
-
children: [/* @__PURE__ */ jsx("thead", {
|
|
164
|
-
className: "border-border bg-muted/30 border-b",
|
|
165
|
-
children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
166
|
-
/* @__PURE__ */ jsx("th", {
|
|
167
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
168
|
-
children: "Instance ID"
|
|
169
|
-
}),
|
|
170
|
-
/* @__PURE__ */ jsx("th", {
|
|
171
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
172
|
-
children: "Status"
|
|
173
|
-
}),
|
|
174
|
-
/* @__PURE__ */ jsx("th", {
|
|
175
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
176
|
-
children: "Requested By"
|
|
177
|
-
}),
|
|
178
|
-
/* @__PURE__ */ jsx("th", {
|
|
179
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
180
|
-
children: "Started"
|
|
181
|
-
})
|
|
182
|
-
] })
|
|
183
|
-
}), /* @__PURE__ */ jsxs("tbody", {
|
|
184
|
-
className: "divide-border divide-y",
|
|
185
|
-
children: [instances.map((inst) => /* @__PURE__ */ jsxs("tr", {
|
|
186
|
-
className: "hover:bg-muted/50",
|
|
187
|
-
children: [
|
|
188
|
-
/* @__PURE__ */ jsx("td", {
|
|
189
|
-
className: "px-4 py-3 font-mono text-sm",
|
|
190
|
-
children: inst.id
|
|
191
|
-
}),
|
|
192
|
-
/* @__PURE__ */ jsx("td", {
|
|
193
|
-
className: "px-4 py-3",
|
|
194
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
195
|
-
className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[inst.status] ?? ""}`,
|
|
196
|
-
children: inst.status
|
|
197
|
-
})
|
|
198
|
-
}),
|
|
199
|
-
/* @__PURE__ */ jsx("td", {
|
|
200
|
-
className: "px-4 py-3 text-sm",
|
|
201
|
-
children: inst.requestedBy
|
|
202
|
-
}),
|
|
203
|
-
/* @__PURE__ */ jsx("td", {
|
|
204
|
-
className: "text-muted-foreground px-4 py-3 text-sm",
|
|
205
|
-
children: inst.startedAt.toLocaleDateString()
|
|
206
|
-
})
|
|
207
|
-
]
|
|
208
|
-
}, inst.id)), instances.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
209
|
-
colSpan: 4,
|
|
210
|
-
className: "text-muted-foreground px-4 py-8 text-center",
|
|
211
|
-
children: "No workflow instances found"
|
|
212
|
-
}) })]
|
|
213
|
-
})]
|
|
214
|
-
})
|
|
215
|
-
})]
|
|
216
|
-
})
|
|
217
|
-
]
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
//#endregion
|
|
222
|
-
export { WorkflowDashboard };
|
|
223
|
-
//# sourceMappingURL=WorkflowDashboard.js.map
|
package/dist/ui/hooks/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { useWorkflowList, type WorkflowStats } from './useWorkflowList';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/hooks/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/ui/hooks/index.js
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/ui/hooks/useWorkflowList.ts
|
|
3
|
+
import { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
5
|
+
"use client";
|
|
6
|
+
function useWorkflowList(projectId = "local-project") {
|
|
7
|
+
const { handlers } = useTemplateRuntime();
|
|
8
|
+
const workflow = handlers.workflow;
|
|
9
|
+
const [definitions, setDefinitions] = useState([]);
|
|
10
|
+
const [instances, setInstances] = useState([]);
|
|
11
|
+
const [loading, setLoading] = useState(true);
|
|
12
|
+
const [error, setError] = useState(null);
|
|
13
|
+
const fetchData = useCallback(async () => {
|
|
14
|
+
try {
|
|
15
|
+
setLoading(true);
|
|
16
|
+
setError(null);
|
|
17
|
+
const [defResult, instResult] = await Promise.all([
|
|
18
|
+
workflow.listDefinitions({ projectId, limit: 100 }),
|
|
19
|
+
workflow.listInstances({ projectId, limit: 100 })
|
|
20
|
+
]);
|
|
21
|
+
setDefinitions(defResult.definitions);
|
|
22
|
+
setInstances(instResult.instances);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
setError(err instanceof Error ? err : new Error("Failed to load workflows"));
|
|
25
|
+
} finally {
|
|
26
|
+
setLoading(false);
|
|
27
|
+
}
|
|
28
|
+
}, [handlers, projectId]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
fetchData();
|
|
31
|
+
}, [fetchData]);
|
|
32
|
+
const stats = {
|
|
33
|
+
totalDefinitions: definitions.length,
|
|
34
|
+
activeDefinitions: definitions.filter((d) => d.status === "ACTIVE").length,
|
|
35
|
+
totalInstances: instances.length,
|
|
36
|
+
pendingInstances: instances.filter((i) => i.status === "PENDING").length,
|
|
37
|
+
completedInstances: instances.filter((i) => i.status === "COMPLETED").length,
|
|
38
|
+
rejectedInstances: instances.filter((i) => i.status === "REJECTED").length
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
definitions,
|
|
42
|
+
instances,
|
|
43
|
+
loading,
|
|
44
|
+
error,
|
|
45
|
+
stats,
|
|
46
|
+
refetch: fetchData
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
useWorkflowList
|
|
51
|
+
};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import { WorkflowDefinition, WorkflowInstance } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
completedInstances: number;
|
|
10
|
-
rejectedInstances: number;
|
|
1
|
+
import type { WorkflowDefinition, WorkflowInstance } from '../../handlers/workflow.handlers';
|
|
2
|
+
export interface WorkflowStats {
|
|
3
|
+
totalDefinitions: number;
|
|
4
|
+
activeDefinitions: number;
|
|
5
|
+
totalInstances: number;
|
|
6
|
+
pendingInstances: number;
|
|
7
|
+
completedInstances: number;
|
|
8
|
+
rejectedInstances: number;
|
|
11
9
|
}
|
|
12
|
-
declare function useWorkflowList(projectId?: string): {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
export declare function useWorkflowList(projectId?: string): {
|
|
11
|
+
definitions: WorkflowDefinition[];
|
|
12
|
+
instances: WorkflowInstance[];
|
|
13
|
+
loading: boolean;
|
|
14
|
+
error: Error | null;
|
|
15
|
+
stats: WorkflowStats;
|
|
16
|
+
refetch: () => Promise<void>;
|
|
19
17
|
};
|
|
20
|
-
//#endregion
|
|
21
|
-
export { WorkflowStats, useWorkflowList };
|
|
22
18
|
//# sourceMappingURL=useWorkflowList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWorkflowList.d.ts","
|
|
1
|
+
{"version":3,"file":"useWorkflowList.d.ts","sourceRoot":"","sources":["../../../src/ui/hooks/useWorkflowList.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAEjB,MAAM,kCAAkC,CAAC;AAG1C,MAAM,WAAW,aAAa;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,SAAS,SAAkB;;;;;;;EAmD1D"}
|
|
@@ -1,55 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/ui/hooks/useWorkflowList.ts
|
|
3
3
|
import { useCallback, useEffect, useState } from "react";
|
|
4
4
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
5
|
-
|
|
6
|
-
//#region src/ui/hooks/useWorkflowList.ts
|
|
5
|
+
"use client";
|
|
7
6
|
function useWorkflowList(projectId = "local-project") {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
refetch: fetchData
|
|
50
|
-
};
|
|
7
|
+
const { handlers } = useTemplateRuntime();
|
|
8
|
+
const workflow = handlers.workflow;
|
|
9
|
+
const [definitions, setDefinitions] = useState([]);
|
|
10
|
+
const [instances, setInstances] = useState([]);
|
|
11
|
+
const [loading, setLoading] = useState(true);
|
|
12
|
+
const [error, setError] = useState(null);
|
|
13
|
+
const fetchData = useCallback(async () => {
|
|
14
|
+
try {
|
|
15
|
+
setLoading(true);
|
|
16
|
+
setError(null);
|
|
17
|
+
const [defResult, instResult] = await Promise.all([
|
|
18
|
+
workflow.listDefinitions({ projectId, limit: 100 }),
|
|
19
|
+
workflow.listInstances({ projectId, limit: 100 })
|
|
20
|
+
]);
|
|
21
|
+
setDefinitions(defResult.definitions);
|
|
22
|
+
setInstances(instResult.instances);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
setError(err instanceof Error ? err : new Error("Failed to load workflows"));
|
|
25
|
+
} finally {
|
|
26
|
+
setLoading(false);
|
|
27
|
+
}
|
|
28
|
+
}, [handlers, projectId]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
fetchData();
|
|
31
|
+
}, [fetchData]);
|
|
32
|
+
const stats = {
|
|
33
|
+
totalDefinitions: definitions.length,
|
|
34
|
+
activeDefinitions: definitions.filter((d) => d.status === "ACTIVE").length,
|
|
35
|
+
totalInstances: instances.length,
|
|
36
|
+
pendingInstances: instances.filter((i) => i.status === "PENDING").length,
|
|
37
|
+
completedInstances: instances.filter((i) => i.status === "COMPLETED").length,
|
|
38
|
+
rejectedInstances: instances.filter((i) => i.status === "REJECTED").length
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
definitions,
|
|
42
|
+
instances,
|
|
43
|
+
loading,
|
|
44
|
+
error,
|
|
45
|
+
stats,
|
|
46
|
+
refetch: fetchData
|
|
47
|
+
};
|
|
51
48
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
//# sourceMappingURL=useWorkflowList.js.map
|
|
49
|
+
export {
|
|
50
|
+
useWorkflowList
|
|
51
|
+
};
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
1
|
+
/**
|
|
2
|
+
* Workflow System Template Components
|
|
3
|
+
*/
|
|
4
|
+
export * from './renderers';
|
|
5
|
+
export { WorkflowDashboard } from './WorkflowDashboard';
|
|
6
|
+
export * from './hooks';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,cAAc,SAAS,CAAC"}
|
package/dist/ui/index.js
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/ui/hooks/useWorkflowList.ts
|
|
3
|
+
import { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
5
|
+
"use client";
|
|
6
|
+
function useWorkflowList(projectId = "local-project") {
|
|
7
|
+
const { handlers } = useTemplateRuntime();
|
|
8
|
+
const workflow = handlers.workflow;
|
|
9
|
+
const [definitions, setDefinitions] = useState([]);
|
|
10
|
+
const [instances, setInstances] = useState([]);
|
|
11
|
+
const [loading, setLoading] = useState(true);
|
|
12
|
+
const [error, setError] = useState(null);
|
|
13
|
+
const fetchData = useCallback(async () => {
|
|
14
|
+
try {
|
|
15
|
+
setLoading(true);
|
|
16
|
+
setError(null);
|
|
17
|
+
const [defResult, instResult] = await Promise.all([
|
|
18
|
+
workflow.listDefinitions({ projectId, limit: 100 }),
|
|
19
|
+
workflow.listInstances({ projectId, limit: 100 })
|
|
20
|
+
]);
|
|
21
|
+
setDefinitions(defResult.definitions);
|
|
22
|
+
setInstances(instResult.instances);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
setError(err instanceof Error ? err : new Error("Failed to load workflows"));
|
|
25
|
+
} finally {
|
|
26
|
+
setLoading(false);
|
|
27
|
+
}
|
|
28
|
+
}, [handlers, projectId]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
fetchData();
|
|
31
|
+
}, [fetchData]);
|
|
32
|
+
const stats = {
|
|
33
|
+
totalDefinitions: definitions.length,
|
|
34
|
+
activeDefinitions: definitions.filter((d) => d.status === "ACTIVE").length,
|
|
35
|
+
totalInstances: instances.length,
|
|
36
|
+
pendingInstances: instances.filter((i) => i.status === "PENDING").length,
|
|
37
|
+
completedInstances: instances.filter((i) => i.status === "COMPLETED").length,
|
|
38
|
+
rejectedInstances: instances.filter((i) => i.status === "REJECTED").length
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
definitions,
|
|
42
|
+
instances,
|
|
43
|
+
loading,
|
|
44
|
+
error,
|
|
45
|
+
stats,
|
|
46
|
+
refetch: fetchData
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
workflowInstanceDetailMarkdownRenderer,
|
|
51
|
+
workflowDefinitionListMarkdownRenderer,
|
|
52
|
+
workflowDashboardMarkdownRenderer,
|
|
53
|
+
useWorkflowList,
|
|
54
|
+
WorkflowDashboard
|
|
55
|
+
};
|