@contractspec/example.workflow-system 3.8.8 → 3.8.10
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.js +1 -22
- package/dist/approval/approval.event.js +1 -112
- package/dist/approval/approval.operations.js +1 -369
- package/dist/approval/approval.schema.js +1 -73
- package/dist/approval/index.js +1 -484
- package/dist/browser/approval/approval.enum.js +1 -22
- package/dist/browser/approval/approval.event.js +1 -112
- package/dist/browser/approval/approval.operations.js +1 -369
- package/dist/browser/approval/approval.schema.js +1 -73
- package/dist/browser/approval/index.js +1 -484
- package/dist/browser/docs/index.js +5 -49
- package/dist/browser/docs/workflow-system.docblock.js +5 -49
- package/dist/browser/entities/approval.js +1 -119
- package/dist/browser/entities/index.js +1 -508
- package/dist/browser/entities/instance.js +1 -161
- package/dist/browser/entities/step.js +1 -124
- package/dist/browser/entities/workflow.js +1 -82
- package/dist/browser/example.js +1 -42
- package/dist/browser/handlers/index.js +8 -253
- package/dist/browser/handlers/workflow.handlers.js +8 -253
- package/dist/browser/index.js +13 -3524
- package/dist/browser/instance/index.js +1 -677
- package/dist/browser/instance/instance.enum.js +1 -15
- package/dist/browser/instance/instance.event.js +1 -164
- package/dist/browser/instance/instance.handler.js +1 -356
- package/dist/browser/instance/instance.operations.js +1 -9
- package/dist/browser/instance/instance.schema.js +1 -101
- package/dist/browser/presentations/index.js +1 -109
- package/dist/browser/seeders/index.js +1 -3
- package/dist/browser/shared/demo-scenario.js +1 -213
- package/dist/browser/shared/index.js +1 -3
- package/dist/browser/shared/mock-data.js +1 -11
- package/dist/browser/state-machine/index.js +1 -6
- package/dist/browser/tests/operations.test-spec.js +1 -6
- package/dist/browser/ui/WorkflowDashboard.js +1 -3
- package/dist/browser/ui/WorkflowDashboard.visualizations.js +1 -239
- package/dist/browser/ui/hooks/index.js +1 -3
- package/dist/browser/ui/hooks/useWorkflowList.js +1 -52
- package/dist/browser/ui/index.js +1 -56
- package/dist/browser/ui/renderers/index.js +5 -562
- package/dist/browser/ui/renderers/workflow.markdown.js +5 -562
- package/dist/browser/visualizations/catalog.js +1 -132
- package/dist/browser/visualizations/index.js +1 -133
- package/dist/browser/visualizations/selectors.js +1 -195
- package/dist/browser/workflow/index.js +1 -21
- package/dist/browser/workflow/workflow.enum.js +1 -36
- package/dist/browser/workflow/workflow.event.js +1 -6
- package/dist/browser/workflow/workflow.handler.js +1 -5
- package/dist/browser/workflow/workflow.operations.js +1 -8
- package/dist/browser/workflow/workflow.schema.js +1 -151
- package/dist/browser/workflow-system.capability.js +1 -5
- package/dist/browser/workflow-system.feature.js +1 -3
- package/dist/docs/index.js +5 -49
- package/dist/docs/workflow-system.docblock.js +5 -49
- package/dist/entities/approval.js +1 -119
- package/dist/entities/index.js +1 -508
- package/dist/entities/instance.js +1 -161
- package/dist/entities/step.js +1 -124
- package/dist/entities/workflow.js +1 -82
- package/dist/example.js +1 -42
- package/dist/handlers/index.js +8 -253
- package/dist/handlers/workflow.handlers.js +8 -253
- package/dist/index.js +13 -3524
- package/dist/instance/index.js +1 -677
- package/dist/instance/instance.enum.js +1 -15
- package/dist/instance/instance.event.js +1 -164
- package/dist/instance/instance.handler.js +1 -356
- package/dist/instance/instance.operations.js +1 -9
- package/dist/instance/instance.schema.js +1 -101
- package/dist/presentations/index.js +1 -109
- package/dist/seeders/index.js +1 -3
- package/dist/shared/demo-scenario.js +1 -213
- package/dist/shared/index.js +1 -3
- package/dist/shared/mock-data.js +1 -11
- package/dist/state-machine/index.js +1 -6
- package/dist/tests/operations.test-spec.js +1 -6
- package/dist/ui/WorkflowDashboard.js +1 -3
- package/dist/ui/WorkflowDashboard.visualizations.js +1 -239
- package/dist/ui/hooks/index.js +1 -3
- package/dist/ui/hooks/useWorkflowList.js +1 -52
- package/dist/ui/index.js +1 -56
- package/dist/ui/renderers/index.js +5 -562
- package/dist/ui/renderers/workflow.markdown.js +5 -562
- package/dist/visualizations/catalog.js +1 -132
- package/dist/visualizations/index.js +1 -133
- package/dist/visualizations/selectors.js +1 -195
- package/dist/workflow/index.js +1 -21
- package/dist/workflow/workflow.enum.js +1 -36
- package/dist/workflow/workflow.event.js +1 -6
- package/dist/workflow/workflow.handler.js +1 -5
- package/dist/workflow/workflow.operations.js +1 -8
- package/dist/workflow/workflow.schema.js +1 -151
- package/dist/workflow-system.capability.js +1 -5
- package/dist/workflow-system.feature.js +1 -3
- package/package.json +11 -11
|
@@ -1,52 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
3
|
-
import { useCallback, useEffect, useState } from "react";
|
|
4
|
-
"use client";
|
|
5
|
-
function useWorkflowList(projectIdOverride) {
|
|
6
|
-
const { handlers, projectId: runtimeProjectId } = useTemplateRuntime();
|
|
7
|
-
const projectId = projectIdOverride ?? runtimeProjectId;
|
|
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
|
-
}, [projectId, workflow]);
|
|
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
|
-
inProgressInstances: instances.filter((i) => i.status === "IN_PROGRESS").length,
|
|
38
|
-
completedInstances: instances.filter((i) => i.status === "COMPLETED").length,
|
|
39
|
-
rejectedInstances: instances.filter((i) => i.status === "REJECTED").length
|
|
40
|
-
};
|
|
41
|
-
return {
|
|
42
|
-
definitions,
|
|
43
|
-
instances,
|
|
44
|
-
loading,
|
|
45
|
-
error,
|
|
46
|
-
stats,
|
|
47
|
-
refetch: fetchData
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
export {
|
|
51
|
-
useWorkflowList
|
|
52
|
-
};
|
|
1
|
+
import{useTemplateRuntime as Z}from"@contractspec/lib.example-shared-ui";import{useCallback as _,useEffect as $,useState as z}from"react";function P(K){let{handlers:M,projectId:N}=Z(),A=K??N,B=M.workflow,[F,Q]=z([]),[y,U]=z([]),[V,H]=z(!0),[W,J]=z(null),G=_(async()=>{try{H(!0),J(null);let[q,Y]=await Promise.all([B.listDefinitions({projectId:A,limit:100}),B.listInstances({projectId:A,limit:100})]);Q(q.definitions),U(Y.instances)}catch(q){J(q instanceof Error?q:Error("Failed to load workflows"))}finally{H(!1)}},[A,B]);$(()=>{G()},[G]);let X={totalDefinitions:F.length,activeDefinitions:F.filter((q)=>q.status==="ACTIVE").length,totalInstances:y.length,pendingInstances:y.filter((q)=>q.status==="PENDING").length,inProgressInstances:y.filter((q)=>q.status==="IN_PROGRESS").length,completedInstances:y.filter((q)=>q.status==="COMPLETED").length,rejectedInstances:y.filter((q)=>q.status==="REJECTED").length};return{definitions:F,instances:y,loading:V,error:W,stats:X,refetch:G}}export{P as useWorkflowList};
|
package/dist/browser/ui/index.js
CHANGED
|
@@ -1,56 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
3
|
-
import { useCallback, useEffect, useState } from "react";
|
|
4
|
-
"use client";
|
|
5
|
-
function useWorkflowList(projectIdOverride) {
|
|
6
|
-
const { handlers, projectId: runtimeProjectId } = useTemplateRuntime();
|
|
7
|
-
const projectId = projectIdOverride ?? runtimeProjectId;
|
|
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
|
-
}, [projectId, workflow]);
|
|
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
|
-
inProgressInstances: instances.filter((i) => i.status === "IN_PROGRESS").length,
|
|
38
|
-
completedInstances: instances.filter((i) => i.status === "COMPLETED").length,
|
|
39
|
-
rejectedInstances: instances.filter((i) => i.status === "REJECTED").length
|
|
40
|
-
};
|
|
41
|
-
return {
|
|
42
|
-
definitions,
|
|
43
|
-
instances,
|
|
44
|
-
loading,
|
|
45
|
-
error,
|
|
46
|
-
stats,
|
|
47
|
-
refetch: fetchData
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
export {
|
|
51
|
-
workflowInstanceDetailMarkdownRenderer,
|
|
52
|
-
workflowDefinitionListMarkdownRenderer,
|
|
53
|
-
workflowDashboardMarkdownRenderer,
|
|
54
|
-
useWorkflowList,
|
|
55
|
-
WorkflowDashboard
|
|
56
|
-
};
|
|
1
|
+
import{useTemplateRuntime as Z}from"@contractspec/lib.example-shared-ui";import{useCallback as _,useEffect as $,useState as z}from"react";function P(K){let{handlers:M,projectId:N}=Z(),A=K??N,B=M.workflow,[F,Q]=z([]),[y,U]=z([]),[V,H]=z(!0),[W,J]=z(null),G=_(async()=>{try{H(!0),J(null);let[q,Y]=await Promise.all([B.listDefinitions({projectId:A,limit:100}),B.listInstances({projectId:A,limit:100})]);Q(q.definitions),U(Y.instances)}catch(q){J(q instanceof Error?q:Error("Failed to load workflows"))}finally{H(!1)}},[A,B]);$(()=>{G()},[G]);let X={totalDefinitions:F.length,activeDefinitions:F.filter((q)=>q.status==="ACTIVE").length,totalInstances:y.length,pendingInstances:y.filter((q)=>q.status==="PENDING").length,inProgressInstances:y.filter((q)=>q.status==="IN_PROGRESS").length,completedInstances:y.filter((q)=>q.status==="COMPLETED").length,rejectedInstances:y.filter((q)=>q.status==="REJECTED").length};return{definitions:F,instances:y,loading:V,error:W,stats:X,refetch:G}}export{workflowInstanceDetailMarkdownRenderer,workflowDefinitionListMarkdownRenderer,workflowDashboardMarkdownRenderer,P as useWorkflowList,WorkflowDashboard};
|