@contractspec/example.workflow-system 1.57.0 → 1.58.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.
Files changed (209) hide show
  1. package/dist/approval/approval.enum.d.ts +2 -7
  2. package/dist/approval/approval.enum.d.ts.map +1 -1
  3. package/dist/approval/approval.enum.js +20 -26
  4. package/dist/approval/approval.event.d.ts +108 -114
  5. package/dist/approval/approval.event.d.ts.map +1 -1
  6. package/dist/approval/approval.event.js +103 -210
  7. package/dist/approval/approval.handler.d.ts +17 -18
  8. package/dist/approval/approval.handler.d.ts.map +1 -1
  9. package/dist/approval/approval.operations.d.ts +429 -435
  10. package/dist/approval/approval.operations.d.ts.map +1 -1
  11. package/dist/approval/approval.operations.js +364 -339
  12. package/dist/approval/approval.schema.d.ts +86 -91
  13. package/dist/approval/approval.schema.d.ts.map +1 -1
  14. package/dist/approval/approval.schema.js +71 -107
  15. package/dist/approval/index.d.ts +8 -5
  16. package/dist/approval/index.d.ts.map +1 -0
  17. package/dist/approval/index.js +484 -5
  18. package/dist/browser/approval/approval.enum.js +22 -0
  19. package/dist/browser/approval/approval.event.js +112 -0
  20. package/dist/browser/approval/approval.operations.js +369 -0
  21. package/dist/browser/approval/approval.schema.js +73 -0
  22. package/dist/browser/approval/index.js +484 -0
  23. package/dist/browser/docs/index.js +103 -0
  24. package/dist/browser/docs/workflow-system.docblock.js +103 -0
  25. package/dist/browser/entities/approval.js +119 -0
  26. package/dist/browser/entities/index.js +508 -0
  27. package/dist/browser/entities/instance.js +161 -0
  28. package/dist/browser/entities/step.js +124 -0
  29. package/dist/browser/entities/workflow.js +82 -0
  30. package/dist/browser/example.js +42 -0
  31. package/dist/browser/handlers/index.js +253 -0
  32. package/dist/browser/handlers/workflow.handlers.js +253 -0
  33. package/dist/browser/index.js +3120 -0
  34. package/dist/browser/instance/index.js +677 -0
  35. package/dist/browser/instance/instance.enum.js +15 -0
  36. package/dist/browser/instance/instance.event.js +164 -0
  37. package/dist/browser/instance/instance.handler.js +356 -0
  38. package/dist/browser/instance/instance.operations.js +9 -0
  39. package/dist/browser/instance/instance.schema.js +101 -0
  40. package/dist/browser/presentations/index.js +109 -0
  41. package/dist/browser/seeders/index.js +3 -0
  42. package/dist/browser/shared/index.js +3 -0
  43. package/dist/browser/shared/mock-data.js +11 -0
  44. package/dist/browser/shared/types.js +0 -0
  45. package/dist/browser/state-machine/index.js +6 -0
  46. package/dist/browser/tests/operations.test-spec.js +6 -0
  47. package/dist/browser/ui/WorkflowDashboard.js +3 -0
  48. package/dist/browser/ui/hooks/index.js +50 -0
  49. package/dist/browser/ui/hooks/useWorkflowList.js +50 -0
  50. package/dist/browser/ui/index.js +54 -0
  51. package/dist/browser/ui/renderers/index.js +227 -0
  52. package/dist/browser/ui/renderers/workflow.markdown.js +227 -0
  53. package/dist/browser/workflow/index.js +21 -0
  54. package/dist/browser/workflow/workflow.enum.js +36 -0
  55. package/dist/browser/workflow/workflow.event.js +6 -0
  56. package/dist/browser/workflow/workflow.handler.js +5 -0
  57. package/dist/browser/workflow/workflow.operations.js +8 -0
  58. package/dist/browser/workflow/workflow.schema.js +151 -0
  59. package/dist/browser/workflow-system.capability.js +5 -0
  60. package/dist/browser/workflow-system.feature.js +3 -0
  61. package/dist/docs/index.d.ts +2 -1
  62. package/dist/docs/index.d.ts.map +1 -0
  63. package/dist/docs/index.js +104 -1
  64. package/dist/docs/workflow-system.docblock.d.ts +2 -1
  65. package/dist/docs/workflow-system.docblock.d.ts.map +1 -0
  66. package/dist/docs/workflow-system.docblock.js +45 -56
  67. package/dist/entities/approval.d.ts +35 -40
  68. package/dist/entities/approval.d.ts.map +1 -1
  69. package/dist/entities/approval.js +116 -124
  70. package/dist/entities/index.d.ts +132 -137
  71. package/dist/entities/index.d.ts.map +1 -1
  72. package/dist/entities/index.js +506 -29
  73. package/dist/entities/instance.d.ts +46 -51
  74. package/dist/entities/instance.d.ts.map +1 -1
  75. package/dist/entities/instance.js +158 -164
  76. package/dist/entities/step.d.ts +31 -36
  77. package/dist/entities/step.d.ts.map +1 -1
  78. package/dist/entities/step.js +122 -132
  79. package/dist/entities/workflow.d.ts +22 -27
  80. package/dist/entities/workflow.d.ts.map +1 -1
  81. package/dist/entities/workflow.js +80 -99
  82. package/dist/example.d.ts +2 -6
  83. package/dist/example.d.ts.map +1 -1
  84. package/dist/example.js +41 -55
  85. package/dist/handlers/index.d.ts +2 -2
  86. package/dist/handlers/index.d.ts.map +1 -0
  87. package/dist/handlers/index.js +254 -3
  88. package/dist/handlers/workflow.handlers.d.ts +107 -106
  89. package/dist/handlers/workflow.handlers.d.ts.map +1 -1
  90. package/dist/handlers/workflow.handlers.js +237 -246
  91. package/dist/index.d.ts +15 -26
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +3121 -26
  94. package/dist/instance/index.d.ts +8 -5
  95. package/dist/instance/index.d.ts.map +1 -0
  96. package/dist/instance/index.js +677 -5
  97. package/dist/instance/instance.enum.d.ts +1 -6
  98. package/dist/instance/instance.enum.d.ts.map +1 -1
  99. package/dist/instance/instance.enum.js +14 -18
  100. package/dist/instance/instance.event.d.ts +313 -319
  101. package/dist/instance/instance.event.d.ts.map +1 -1
  102. package/dist/instance/instance.event.js +151 -279
  103. package/dist/instance/instance.handler.d.ts +21 -22
  104. package/dist/instance/instance.handler.d.ts.map +1 -1
  105. package/dist/instance/instance.handler.js +352 -89
  106. package/dist/instance/instance.operations.d.ts +819 -825
  107. package/dist/instance/instance.operations.d.ts.map +1 -1
  108. package/dist/instance/instance.operations.js +10 -464
  109. package/dist/instance/instance.schema.d.ts +196 -201
  110. package/dist/instance/instance.schema.d.ts.map +1 -1
  111. package/dist/instance/instance.schema.js +97 -167
  112. package/dist/presentations/index.d.ts +23 -28
  113. package/dist/presentations/index.d.ts.map +1 -1
  114. package/dist/presentations/index.js +104 -334
  115. package/dist/seeders/index.d.ts +4 -8
  116. package/dist/seeders/index.d.ts.map +1 -1
  117. package/dist/seeders/index.js +4 -19
  118. package/dist/shared/index.d.ts +6 -3
  119. package/dist/shared/index.d.ts.map +1 -0
  120. package/dist/shared/index.js +4 -3
  121. package/dist/shared/mock-data.d.ts +16 -16
  122. package/dist/shared/mock-data.d.ts.map +1 -1
  123. package/dist/shared/mock-data.js +11 -11
  124. package/dist/shared/types.d.ts +69 -72
  125. package/dist/shared/types.d.ts.map +1 -1
  126. package/dist/shared/types.js +1 -0
  127. package/dist/state-machine/index.d.ts +92 -95
  128. package/dist/state-machine/index.d.ts.map +1 -1
  129. package/dist/state-machine/index.js +6 -157
  130. package/dist/tests/operations.test-spec.d.ts +4 -9
  131. package/dist/tests/operations.test-spec.d.ts.map +1 -1
  132. package/dist/tests/operations.test-spec.js +7 -123
  133. package/dist/ui/WorkflowDashboard.d.ts +1 -6
  134. package/dist/ui/WorkflowDashboard.d.ts.map +1 -1
  135. package/dist/ui/WorkflowDashboard.js +3 -222
  136. package/dist/ui/hooks/index.d.ts +2 -2
  137. package/dist/ui/hooks/index.d.ts.map +1 -0
  138. package/dist/ui/hooks/index.js +51 -5
  139. package/dist/ui/hooks/useWorkflowList.d.ts +15 -19
  140. package/dist/ui/hooks/useWorkflowList.d.ts.map +1 -1
  141. package/dist/ui/hooks/useWorkflowList.js +47 -51
  142. package/dist/ui/index.d.ts +7 -6
  143. package/dist/ui/index.d.ts.map +1 -0
  144. package/dist/ui/index.js +55 -6
  145. package/dist/ui/renderers/index.d.ts +2 -2
  146. package/dist/ui/renderers/index.d.ts.map +1 -0
  147. package/dist/ui/renderers/index.js +227 -2
  148. package/dist/ui/renderers/workflow.markdown.d.ts +13 -14
  149. package/dist/ui/renderers/workflow.markdown.d.ts.map +1 -1
  150. package/dist/ui/renderers/workflow.markdown.js +223 -229
  151. package/dist/workflow/index.d.ts +8 -5
  152. package/dist/workflow/index.d.ts.map +1 -0
  153. package/dist/workflow/index.js +22 -6
  154. package/dist/workflow/workflow.enum.d.ts +4 -9
  155. package/dist/workflow/workflow.enum.d.ts.map +1 -1
  156. package/dist/workflow/workflow.enum.js +32 -42
  157. package/dist/workflow/workflow.event.d.ts +112 -118
  158. package/dist/workflow/workflow.event.d.ts.map +1 -1
  159. package/dist/workflow/workflow.event.js +7 -150
  160. package/dist/workflow/workflow.handler.d.ts +23 -24
  161. package/dist/workflow/workflow.handler.d.ts.map +1 -1
  162. package/dist/workflow/workflow.handler.js +6 -66
  163. package/dist/workflow/workflow.operations.d.ts +847 -853
  164. package/dist/workflow/workflow.operations.d.ts.map +1 -1
  165. package/dist/workflow/workflow.operations.js +9 -345
  166. package/dist/workflow/workflow.schema.d.ts +229 -234
  167. package/dist/workflow/workflow.schema.d.ts.map +1 -1
  168. package/dist/workflow/workflow.schema.js +146 -243
  169. package/dist/workflow-system.capability.d.ts +3 -8
  170. package/dist/workflow-system.capability.d.ts.map +1 -1
  171. package/dist/workflow-system.capability.js +6 -34
  172. package/dist/workflow-system.feature.d.ts +1 -6
  173. package/dist/workflow-system.feature.d.ts.map +1 -1
  174. package/dist/workflow-system.feature.js +4 -346
  175. package/package.json +415 -93
  176. package/dist/approval/approval.enum.js.map +0 -1
  177. package/dist/approval/approval.event.js.map +0 -1
  178. package/dist/approval/approval.handler.js +0 -72
  179. package/dist/approval/approval.handler.js.map +0 -1
  180. package/dist/approval/approval.operations.js.map +0 -1
  181. package/dist/approval/approval.schema.js.map +0 -1
  182. package/dist/docs/workflow-system.docblock.js.map +0 -1
  183. package/dist/entities/approval.js.map +0 -1
  184. package/dist/entities/index.js.map +0 -1
  185. package/dist/entities/instance.js.map +0 -1
  186. package/dist/entities/step.js.map +0 -1
  187. package/dist/entities/workflow.js.map +0 -1
  188. package/dist/example.js.map +0 -1
  189. package/dist/handlers/workflow.handlers.js.map +0 -1
  190. package/dist/instance/instance.enum.js.map +0 -1
  191. package/dist/instance/instance.event.js.map +0 -1
  192. package/dist/instance/instance.handler.js.map +0 -1
  193. package/dist/instance/instance.operations.js.map +0 -1
  194. package/dist/instance/instance.schema.js.map +0 -1
  195. package/dist/presentations/index.js.map +0 -1
  196. package/dist/seeders/index.js.map +0 -1
  197. package/dist/shared/mock-data.js.map +0 -1
  198. package/dist/state-machine/index.js.map +0 -1
  199. package/dist/tests/operations.test-spec.js.map +0 -1
  200. package/dist/ui/WorkflowDashboard.js.map +0 -1
  201. package/dist/ui/hooks/useWorkflowList.js.map +0 -1
  202. package/dist/ui/renderers/workflow.markdown.js.map +0 -1
  203. package/dist/workflow/workflow.enum.js.map +0 -1
  204. package/dist/workflow/workflow.event.js.map +0 -1
  205. package/dist/workflow/workflow.handler.js.map +0 -1
  206. package/dist/workflow/workflow.operations.js.map +0 -1
  207. package/dist/workflow/workflow.schema.js.map +0 -1
  208. package/dist/workflow-system.capability.js.map +0 -1
  209. package/dist/workflow-system.feature.js.map +0 -1
@@ -1,123 +1,7 @@
1
- import { defineTestSpec } from "@contractspec/lib.contracts";
2
-
3
- //#region src/tests/operations.test-spec.ts
4
- const DefinitionListTest = defineTestSpec({
5
- meta: {
6
- key: "workflow.definition.list.test",
7
- version: "1.0.0",
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
- import * as react_jsx_runtime0 from "react/jsx-runtime";
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","names":[],"sources":["../../src/ui/WorkflowDashboard.tsx"],"mappings":";;;iBAmCgB,iBAAA,CAAA,GAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
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
- 'use client';
2
-
3
- import { useWorkflowList } from "./hooks/useWorkflowList.js";
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
@@ -1,2 +1,2 @@
1
- import { WorkflowStats, useWorkflowList } from "./useWorkflowList.js";
2
- export { type WorkflowStats, useWorkflowList };
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"}
@@ -1,5 +1,51 @@
1
- 'use client';
2
-
3
- import { useWorkflowList } from "./useWorkflowList.js";
4
-
5
- export { useWorkflowList };
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 "../../handlers/workflow.handlers.js";
2
-
3
- //#region src/ui/hooks/useWorkflowList.d.ts
4
- interface WorkflowStats {
5
- totalDefinitions: number;
6
- activeDefinitions: number;
7
- totalInstances: number;
8
- pendingInstances: number;
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
- definitions: WorkflowDefinition[];
14
- instances: WorkflowInstance[];
15
- loading: boolean;
16
- error: Error | null;
17
- stats: WorkflowStats;
18
- refetch: () => Promise<void>;
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","names":[],"sources":["../../../src/ui/hooks/useWorkflowList.ts"],"mappings":";;;UAUiB,aAAA;EACf,gBAAA;EACA,iBAAA;EACA,cAAA;EACA,gBAAA;EACA,kBAAA;EACA,iBAAA;AAAA;AAAA,iBAGc,eAAA,CAAgB,SAAA"}
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
- 'use client';
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
- const { handlers } = useTemplateRuntime();
9
- const workflow = handlers.workflow;
10
- const [definitions, setDefinitions] = useState([]);
11
- const [instances, setInstances] = useState([]);
12
- const [loading, setLoading] = useState(true);
13
- const [error, setError] = useState(null);
14
- const fetchData = useCallback(async () => {
15
- try {
16
- setLoading(true);
17
- setError(null);
18
- const [defResult, instResult] = await Promise.all([workflow.listDefinitions({
19
- projectId,
20
- limit: 100
21
- }), workflow.listInstances({
22
- projectId,
23
- limit: 100
24
- })]);
25
- setDefinitions(defResult.definitions);
26
- setInstances(instResult.instances);
27
- } catch (err) {
28
- setError(err instanceof Error ? err : /* @__PURE__ */ new Error("Failed to load workflows"));
29
- } finally {
30
- setLoading(false);
31
- }
32
- }, [handlers, projectId]);
33
- useEffect(() => {
34
- fetchData();
35
- }, [fetchData]);
36
- return {
37
- definitions,
38
- instances,
39
- loading,
40
- error,
41
- stats: {
42
- totalDefinitions: definitions.length,
43
- activeDefinitions: definitions.filter((d) => d.status === "ACTIVE").length,
44
- totalInstances: instances.length,
45
- pendingInstances: instances.filter((i) => i.status === "PENDING").length,
46
- completedInstances: instances.filter((i) => i.status === "COMPLETED").length,
47
- rejectedInstances: instances.filter((i) => i.status === "REJECTED").length
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
- //#endregion
54
- export { useWorkflowList };
55
- //# sourceMappingURL=useWorkflowList.js.map
49
+ export {
50
+ useWorkflowList
51
+ };
@@ -1,6 +1,7 @@
1
- import { workflowDashboardMarkdownRenderer, workflowDefinitionListMarkdownRenderer, workflowInstanceDetailMarkdownRenderer } from "./renderers/workflow.markdown.js";
2
- import "./renderers/index.js";
3
- import { WorkflowDashboard } from "./WorkflowDashboard.js";
4
- import { WorkflowStats, useWorkflowList } from "./hooks/useWorkflowList.js";
5
- import "./hooks/index.js";
6
- export { WorkflowDashboard, WorkflowStats, useWorkflowList, workflowDashboardMarkdownRenderer, workflowDefinitionListMarkdownRenderer, workflowInstanceDetailMarkdownRenderer };
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
- import { workflowDashboardMarkdownRenderer, workflowDefinitionListMarkdownRenderer, workflowInstanceDetailMarkdownRenderer } from "./renderers/workflow.markdown.js";
2
- import { useWorkflowList } from "./hooks/useWorkflowList.js";
3
- import { WorkflowDashboard } from "./WorkflowDashboard.js";
4
- import "./hooks/index.js";
5
-
6
- export { WorkflowDashboard, useWorkflowList, workflowDashboardMarkdownRenderer, workflowDefinitionListMarkdownRenderer, workflowInstanceDetailMarkdownRenderer };
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
+ };