@vef-framework-react/approval 2.12.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/LICENSE +201 -0
- package/dist/cjs/_internal/_rolldown/runtime.cjs +1 -0
- package/dist/cjs/api/admin-api.cjs +1 -0
- package/dist/cjs/api/category-api.cjs +1 -0
- package/dist/cjs/api/delegation-api.cjs +1 -0
- package/dist/cjs/api/flow-api.cjs +1 -0
- package/dist/cjs/api/index.cjs +1 -0
- package/dist/cjs/api/instance-api.cjs +1 -0
- package/dist/cjs/api/my-api.cjs +1 -0
- package/dist/cjs/api/query.cjs +1 -0
- package/dist/cjs/components/detail/action-modals.cjs +1 -0
- package/dist/cjs/components/detail/admin.cjs +1 -0
- package/dist/cjs/components/detail/drawer.cjs +1 -0
- package/dist/cjs/components/detail/index.cjs +1 -0
- package/dist/cjs/components/flow-graph/index.cjs +1 -0
- package/dist/cjs/components/form-panel/index.cjs +1 -0
- package/dist/cjs/components/format.cjs +1 -0
- package/dist/cjs/components/icon.cjs +1 -0
- package/dist/cjs/components/index.cjs +1 -0
- package/dist/cjs/components/principal/index.cjs +1 -0
- package/dist/cjs/components/status/colors.cjs +1 -0
- package/dist/cjs/components/status/index.cjs +1 -0
- package/dist/cjs/components/status/labels.cjs +1 -0
- package/dist/cjs/components/timeline/index.cjs +1 -0
- package/dist/cjs/components/user/index.cjs +1 -0
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/pages/admin-page/index.cjs +1 -0
- package/dist/cjs/pages/admin-page/instances.cjs +1 -0
- package/dist/cjs/pages/admin-page/metrics.cjs +1 -0
- package/dist/cjs/pages/admin-page/projections.cjs +1 -0
- package/dist/cjs/pages/admin-page/tasks.cjs +1 -0
- package/dist/cjs/pages/category-page/columns.cjs +1 -0
- package/dist/cjs/pages/category-page/form.cjs +1 -0
- package/dist/cjs/pages/category-page/index.cjs +1 -0
- package/dist/cjs/pages/delegation-page/columns.cjs +1 -0
- package/dist/cjs/pages/delegation-page/form.cjs +1 -0
- package/dist/cjs/pages/delegation-page/index.cjs +1 -0
- package/dist/cjs/pages/flow-page/columns.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/basic-step.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/flow-step.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/form-step.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/index.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/review-step.cjs +1 -0
- package/dist/cjs/pages/flow-page/designer/types.cjs +1 -0
- package/dist/cjs/pages/flow-page/index.cjs +1 -0
- package/dist/cjs/pages/flow-page/search.cjs +1 -0
- package/dist/cjs/pages/flow-page/versions.cjs +1 -0
- package/dist/cjs/pages/index.cjs +1 -0
- package/dist/cjs/pages/initiate-page/index.cjs +1 -0
- package/dist/cjs/pages/initiate-page/start-drawer.cjs +1 -0
- package/dist/cjs/pages/my-instances-page/index.cjs +1 -0
- package/dist/cjs/pages/task-center-page/index.cjs +1 -0
- package/dist/cjs/permissions.cjs +1 -0
- package/dist/cjs/plugins/index.cjs +1 -0
- package/dist/cjs/types/enums.cjs +1 -0
- package/dist/cjs/types/index.cjs +1 -0
- package/dist/es/api/admin-api.js +33 -0
- package/dist/es/api/category-api.js +17 -0
- package/dist/es/api/delegation-api.js +21 -0
- package/dist/es/api/flow-api.js +22 -0
- package/dist/es/api/index.js +9 -0
- package/dist/es/api/instance-api.js +27 -0
- package/dist/es/api/my-api.js +29 -0
- package/dist/es/api/query.js +14 -0
- package/dist/es/components/detail/action-modals.js +280 -0
- package/dist/es/components/detail/admin.js +147 -0
- package/dist/es/components/detail/drawer.js +21 -0
- package/dist/es/components/detail/index.js +392 -0
- package/dist/es/components/flow-graph/index.js +218 -0
- package/dist/es/components/form-panel/index.js +23 -0
- package/dist/es/components/format.js +16 -0
- package/dist/es/components/icon.js +13 -0
- package/dist/es/components/index.js +14 -0
- package/dist/es/components/principal/index.js +31 -0
- package/dist/es/components/status/colors.js +39 -0
- package/dist/es/components/status/index.js +41 -0
- package/dist/es/components/status/labels.js +94 -0
- package/dist/es/components/timeline/index.js +173 -0
- package/dist/es/components/user/index.js +64 -0
- package/dist/es/index.js +34 -0
- package/dist/es/pages/admin-page/index.js +67 -0
- package/dist/es/pages/admin-page/instances.js +148 -0
- package/dist/es/pages/admin-page/metrics.js +153 -0
- package/dist/es/pages/admin-page/projections.js +122 -0
- package/dist/es/pages/admin-page/tasks.js +170 -0
- package/dist/es/pages/category-page/columns.js +56 -0
- package/dist/es/pages/category-page/form.js +106 -0
- package/dist/es/pages/category-page/index.js +136 -0
- package/dist/es/pages/delegation-page/columns.js +60 -0
- package/dist/es/pages/delegation-page/form.js +117 -0
- package/dist/es/pages/delegation-page/index.js +122 -0
- package/dist/es/pages/flow-page/columns.js +81 -0
- package/dist/es/pages/flow-page/designer/basic-step.js +396 -0
- package/dist/es/pages/flow-page/designer/flow-step.js +41 -0
- package/dist/es/pages/flow-page/designer/form-step.js +87 -0
- package/dist/es/pages/flow-page/designer/index.js +294 -0
- package/dist/es/pages/flow-page/designer/review-step.js +132 -0
- package/dist/es/pages/flow-page/designer/types.js +40 -0
- package/dist/es/pages/flow-page/index.js +99 -0
- package/dist/es/pages/flow-page/search.js +53 -0
- package/dist/es/pages/flow-page/versions.js +94 -0
- package/dist/es/pages/index.js +12 -0
- package/dist/es/pages/initiate-page/index.js +168 -0
- package/dist/es/pages/initiate-page/start-drawer.js +118 -0
- package/dist/es/pages/my-instances-page/index.js +223 -0
- package/dist/es/pages/task-center-page/index.js +182 -0
- package/dist/es/permissions.js +48 -0
- package/dist/es/plugins/index.js +34 -0
- package/dist/es/types/enums.js +12 -0
- package/dist/es/types/index.js +3 -0
- package/dist/types/api/admin-api.d.ts +30 -0
- package/dist/types/api/category-api.d.ts +17 -0
- package/dist/types/api/delegation-api.d.ts +18 -0
- package/dist/types/api/flow-api.d.ts +34 -0
- package/dist/types/api/index.d.ts +7 -0
- package/dist/types/api/instance-api.d.ts +22 -0
- package/dist/types/api/my-api.d.ts +29 -0
- package/dist/types/api/query.d.ts +15 -0
- package/dist/types/components/detail/action-modals.d.ts +82 -0
- package/dist/types/components/detail/admin.d.ts +11 -0
- package/dist/types/components/detail/drawer.d.ts +17 -0
- package/dist/types/components/detail/index.d.ts +36 -0
- package/dist/types/components/flow-graph/index.d.ts +17 -0
- package/dist/types/components/form-panel/index.d.ts +38 -0
- package/dist/types/components/format.d.ts +10 -0
- package/dist/types/components/icon.d.ts +15 -0
- package/dist/types/components/index.d.ts +12 -0
- package/dist/types/components/principal/index.d.ts +18 -0
- package/dist/types/components/status/colors.d.ts +13 -0
- package/dist/types/components/status/index.d.ts +37 -0
- package/dist/types/components/status/labels.d.ts +34 -0
- package/dist/types/components/timeline/index.d.ts +11 -0
- package/dist/types/components/user/index.d.ts +38 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/pages/admin-page/index.d.ts +31 -0
- package/dist/types/pages/admin-page/instances.d.ts +9 -0
- package/dist/types/pages/admin-page/metrics.d.ts +9 -0
- package/dist/types/pages/admin-page/projections.d.ts +8 -0
- package/dist/types/pages/admin-page/tasks.d.ts +7 -0
- package/dist/types/pages/category-page/columns.d.ts +3 -0
- package/dist/types/pages/category-page/form.d.ts +25 -0
- package/dist/types/pages/category-page/index.d.ts +8 -0
- package/dist/types/pages/category-page/props.d.ts +24 -0
- package/dist/types/pages/delegation-page/columns.d.ts +3 -0
- package/dist/types/pages/delegation-page/form.d.ts +6 -0
- package/dist/types/pages/delegation-page/index.d.ts +7 -0
- package/dist/types/pages/delegation-page/props.d.ts +17 -0
- package/dist/types/pages/flow-page/columns.d.ts +12 -0
- package/dist/types/pages/flow-page/designer/basic-step.d.ts +20 -0
- package/dist/types/pages/flow-page/designer/flow-step.d.ts +16 -0
- package/dist/types/pages/flow-page/designer/form-step.d.ts +31 -0
- package/dist/types/pages/flow-page/designer/index.d.ts +20 -0
- package/dist/types/pages/flow-page/designer/review-step.d.ts +18 -0
- package/dist/types/pages/flow-page/designer/types.d.ts +52 -0
- package/dist/types/pages/flow-page/index.d.ts +11 -0
- package/dist/types/pages/flow-page/props.d.ts +24 -0
- package/dist/types/pages/flow-page/search.d.ts +8 -0
- package/dist/types/pages/flow-page/versions.d.ts +16 -0
- package/dist/types/pages/index.d.ts +8 -0
- package/dist/types/pages/initiate-page/index.d.ts +28 -0
- package/dist/types/pages/initiate-page/start-drawer.d.ts +23 -0
- package/dist/types/pages/my-instances-page/index.d.ts +16 -0
- package/dist/types/pages/task-center-page/index.d.ts +17 -0
- package/dist/types/permissions.d.ts +68 -0
- package/dist/types/plugins/index.d.ts +61 -0
- package/dist/types/types/admin.d.ts +185 -0
- package/dist/types/types/base.d.ts +36 -0
- package/dist/types/types/category.d.ts +37 -0
- package/dist/types/types/delegation.d.ts +38 -0
- package/dist/types/types/detail.d.ts +129 -0
- package/dist/types/types/enums.d.ts +81 -0
- package/dist/types/types/flow.d.ts +192 -0
- package/dist/types/types/index.d.ts +9 -0
- package/dist/types/types/instance.d.ts +83 -0
- package/dist/types/types/my.d.ts +203 -0
- package/package.json +71 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime enums of the approval engine, mirroring `approval/enums.go`
|
|
3
|
+
* verbatim. Designer-side enums (node kinds, pass rules, …) live in
|
|
4
|
+
* `@vef-framework-react/approval-flow-editor`; this file only carries the
|
|
5
|
+
* vocabulary the runtime pages consume.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Lifecycle status of an approval instance.
|
|
9
|
+
*/
|
|
10
|
+
export type InstanceStatus = "running" | "approved" | "rejected" | "withdrawn" | "returned" | "terminated";
|
|
11
|
+
/**
|
|
12
|
+
* The instance statuses that are final — no further transition can occur.
|
|
13
|
+
*/
|
|
14
|
+
export declare const FINAL_INSTANCE_STATUSES: readonly ["approved", "rejected", "terminated"];
|
|
15
|
+
/**
|
|
16
|
+
* Whether an instance status is final, mirroring `InstanceStatus.IsFinal`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isFinalInstanceStatus(status: InstanceStatus): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Lifecycle status of an approval task.
|
|
21
|
+
*/
|
|
22
|
+
export type TaskStatus = "waiting" | "pending" | "approved" | "rejected" | "handled" | "transferred" | "rolled_back" | "canceled" | "removed" | "skipped";
|
|
23
|
+
/**
|
|
24
|
+
* Lifecycle status of one node traversal (visit) by an instance.
|
|
25
|
+
*/
|
|
26
|
+
export type NodeVisitStatus = "active" | "passed" | "rejected" | "returned" | "canceled";
|
|
27
|
+
/**
|
|
28
|
+
* Progress status of a node in the instance flow graph projection.
|
|
29
|
+
*/
|
|
30
|
+
export type NodeProgressStatus = "pending" | "active" | "passed" | "rejected" | "returned" | "canceled";
|
|
31
|
+
/**
|
|
32
|
+
* Action types recorded in the action log, mirroring `approval.ActionType`.
|
|
33
|
+
*/
|
|
34
|
+
export type ActionType = "submit" | "approve" | "handle" | "reject" | "transfer" | "withdraw" | "cancel" | "rollback" | "add_assignee" | "remove_assignee" | "execute" | "resubmit" | "reassign" | "terminate" | "add_cc";
|
|
35
|
+
/**
|
|
36
|
+
* The activity vocabulary of timeline / flow-graph projections: every
|
|
37
|
+
* `ActionType` plus `urge` (persisted as urge records, not action logs).
|
|
38
|
+
*/
|
|
39
|
+
export type ActivityAction = ActionType | "urge";
|
|
40
|
+
/**
|
|
41
|
+
* The actions `approval/instance.process_task` accepts for a task decision.
|
|
42
|
+
*/
|
|
43
|
+
export type ProcessTaskAction = "approve" | "reject" | "transfer" | "rollback" | "handle";
|
|
44
|
+
/**
|
|
45
|
+
* Position of a dynamically added assignee relative to the anchor task.
|
|
46
|
+
*/
|
|
47
|
+
export type AddAssigneeType = "before" | "after" | "parallel";
|
|
48
|
+
/**
|
|
49
|
+
* Status of a flow version.
|
|
50
|
+
*/
|
|
51
|
+
export type VersionStatus = "draft" | "published" | "archived";
|
|
52
|
+
/**
|
|
53
|
+
* Flow-level binding mode: `standalone` stores form data in the approval
|
|
54
|
+
* tables, `business` write-backs into an existing business table.
|
|
55
|
+
*/
|
|
56
|
+
export type BindingMode = "standalone" | "business";
|
|
57
|
+
/**
|
|
58
|
+
* Version-level physical storage mode of form data.
|
|
59
|
+
*/
|
|
60
|
+
export type StorageMode = "json" | "table";
|
|
61
|
+
/**
|
|
62
|
+
* Kind of a flow initiator rule.
|
|
63
|
+
*/
|
|
64
|
+
export type InitiatorKind = "user" | "role" | "department";
|
|
65
|
+
/**
|
|
66
|
+
* Convergence state of one business-record projection.
|
|
67
|
+
*/
|
|
68
|
+
export type BindingProjectionStatus = "pending" | "processing" | "applied" | "failed";
|
|
69
|
+
/**
|
|
70
|
+
* Viewer-scoped field interactivity, as resolved by the server for
|
|
71
|
+
* `my.get_instance_detail`. Matches the form-editor renderer's
|
|
72
|
+
* `FieldPermission` vocabulary.
|
|
73
|
+
*/
|
|
74
|
+
export type FieldPermission = "visible" | "editable" | "hidden" | "required";
|
|
75
|
+
/**
|
|
76
|
+
* The self-service actions `my.get_instance_detail` may offer the viewer,
|
|
77
|
+
* derived server-side from the instance state machine, the viewer's pending
|
|
78
|
+
* task, and the node's permission toggles (`computeActions` in
|
|
79
|
+
* `get_my_instance_detail.go` is the source of truth).
|
|
80
|
+
*/
|
|
81
|
+
export type InstanceAction = "approve" | "reject" | "handle" | "transfer" | "rollback" | "withdraw" | "resubmit" | "add_assignee" | "remove_assignee" | "add_cc" | "urge";
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { FlowDefinition, FormFieldDefinition } from '@vef-framework-react/approval-flow-editor';
|
|
2
|
+
import { FormSchema } from '@vef-framework-react/form-editor';
|
|
3
|
+
import { FullAudited } from './base';
|
|
4
|
+
import { BindingMode, InitiatorKind, InstanceStatus, StorageMode, VersionStatus } from './enums';
|
|
5
|
+
/**
|
|
6
|
+
* Business binding for a `business`-mode flow, mirroring the Go
|
|
7
|
+
* `approval.BusinessBindingConfig`. All table / column names must be plain
|
|
8
|
+
* SQL identifiers; `keyColumns` must exactly match a complete, non-null
|
|
9
|
+
* primary or unique key on `tableName`.
|
|
10
|
+
*/
|
|
11
|
+
export interface BusinessBindingConfig {
|
|
12
|
+
tableName: string;
|
|
13
|
+
keyColumns: string[];
|
|
14
|
+
statusColumn: string;
|
|
15
|
+
/**
|
|
16
|
+
* Mandatory for business bindings: the engine uses it as a compare-and-set
|
|
17
|
+
* fence so a stale instance cannot overwrite the state owned by a newer
|
|
18
|
+
* approval round.
|
|
19
|
+
*/
|
|
20
|
+
instanceIdColumn?: string;
|
|
21
|
+
startedAtColumn?: string;
|
|
22
|
+
finishedAtColumn?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Translates instance statuses into host business status values. Missing
|
|
25
|
+
* entries fall back to the instance-status string itself.
|
|
26
|
+
*/
|
|
27
|
+
statusMapping?: Partial<Record<InstanceStatus, string>>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A flow definition record, mirroring the Go `approval.Flow`.
|
|
31
|
+
*/
|
|
32
|
+
export interface Flow extends FullAudited {
|
|
33
|
+
tenantId: string;
|
|
34
|
+
categoryId: string;
|
|
35
|
+
code: string;
|
|
36
|
+
name: string;
|
|
37
|
+
icon?: string | null;
|
|
38
|
+
description?: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Host-owned selection metadata (e.g. which app a flow belongs to, mobile
|
|
41
|
+
* availability). The framework stores them verbatim and offers equality
|
|
42
|
+
* filtering in the flow list queries; keys are restricted server-side to
|
|
43
|
+
* `^[A-Za-z0-9]([A-Za-z0-9_-]*[A-Za-z0-9])?$` (≤63 chars), values to 256
|
|
44
|
+
* characters.
|
|
45
|
+
*/
|
|
46
|
+
labels?: Record<string, string>;
|
|
47
|
+
bindingMode: BindingMode;
|
|
48
|
+
businessBinding?: BusinessBindingConfig | null;
|
|
49
|
+
adminUserIds: string[];
|
|
50
|
+
isAllInitiationAllowed: boolean;
|
|
51
|
+
instanceTitleTemplate: string;
|
|
52
|
+
isActive: boolean;
|
|
53
|
+
currentVersion: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A versioned snapshot of a flow definition, mirroring `approval.FlowVersion`.
|
|
57
|
+
*/
|
|
58
|
+
export interface FlowVersion extends FullAudited {
|
|
59
|
+
flowId: string;
|
|
60
|
+
version: number;
|
|
61
|
+
status: VersionStatus;
|
|
62
|
+
description?: string | null;
|
|
63
|
+
storageMode: StorageMode;
|
|
64
|
+
flowSchema?: FlowDefinition | null;
|
|
65
|
+
/**
|
|
66
|
+
* The host-owned form designer document, returned verbatim.
|
|
67
|
+
*/
|
|
68
|
+
formSchema?: FormSchema | null;
|
|
69
|
+
/**
|
|
70
|
+
* The flat field list derived from `formSchema` at deploy — the only form
|
|
71
|
+
* shape the framework itself consumes.
|
|
72
|
+
*/
|
|
73
|
+
formFields?: FormFieldDefinition[] | null;
|
|
74
|
+
publishedAt?: string | null;
|
|
75
|
+
publishedBy?: string | null;
|
|
76
|
+
businessBinding?: BusinessBindingConfig | null;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The version-list projection of a flow version, mirroring
|
|
80
|
+
* `shared.FlowVersionSummary`: identity and lifecycle metadata without the
|
|
81
|
+
* definition payloads. A single version's full definition is fetched through
|
|
82
|
+
* `get_graph` with an explicit `versionId`.
|
|
83
|
+
*/
|
|
84
|
+
export interface FlowVersionSummary {
|
|
85
|
+
id: string;
|
|
86
|
+
flowId: string;
|
|
87
|
+
version: number;
|
|
88
|
+
status: VersionStatus;
|
|
89
|
+
description?: string | null;
|
|
90
|
+
storageMode: StorageMode;
|
|
91
|
+
publishedAt?: string | null;
|
|
92
|
+
publishedBy?: string | null;
|
|
93
|
+
createdAt: string;
|
|
94
|
+
createdBy: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A flow initiator rule, mirroring `approval.FlowInitiator`.
|
|
98
|
+
*/
|
|
99
|
+
export interface FlowInitiator {
|
|
100
|
+
id: string;
|
|
101
|
+
flowId: string;
|
|
102
|
+
kind: InitiatorKind;
|
|
103
|
+
ids: string[];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* An initiator rule as submitted with create/update.
|
|
107
|
+
*/
|
|
108
|
+
export interface InitiatorParams {
|
|
109
|
+
kind: InitiatorKind;
|
|
110
|
+
ids: string[];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Parameters for `approval/flow.create`.
|
|
114
|
+
*/
|
|
115
|
+
export interface CreateFlowParams {
|
|
116
|
+
tenantId: string;
|
|
117
|
+
code: string;
|
|
118
|
+
name: string;
|
|
119
|
+
categoryId: string;
|
|
120
|
+
icon?: string;
|
|
121
|
+
description?: string;
|
|
122
|
+
labels?: Record<string, string>;
|
|
123
|
+
bindingMode: BindingMode;
|
|
124
|
+
businessBinding?: BusinessBindingConfig;
|
|
125
|
+
adminUserIds?: string[];
|
|
126
|
+
isAllInitiationAllowed: boolean;
|
|
127
|
+
instanceTitleTemplate: string;
|
|
128
|
+
initiators?: InitiatorParams[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Parameters for `approval/flow.update`. Omitted `labels` clears the stored
|
|
132
|
+
* set (full replace semantics).
|
|
133
|
+
*/
|
|
134
|
+
export interface UpdateFlowParams {
|
|
135
|
+
flowId: string;
|
|
136
|
+
name: string;
|
|
137
|
+
icon?: string;
|
|
138
|
+
description?: string;
|
|
139
|
+
labels?: Record<string, string>;
|
|
140
|
+
bindingMode: BindingMode;
|
|
141
|
+
businessBinding?: BusinessBindingConfig;
|
|
142
|
+
adminUserIds?: string[];
|
|
143
|
+
isAllInitiationAllowed: boolean;
|
|
144
|
+
instanceTitleTemplate: string;
|
|
145
|
+
initiators?: InitiatorParams[];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Parameters for `approval/flow.deploy` — creates a new draft version from
|
|
149
|
+
* the designed definition. `formSchema` is the host-owned designer document,
|
|
150
|
+
* passed through opaque and optional (flows without forms exist).
|
|
151
|
+
*/
|
|
152
|
+
export interface DeployFlowParams {
|
|
153
|
+
flowId: string;
|
|
154
|
+
description?: string;
|
|
155
|
+
storageMode?: StorageMode;
|
|
156
|
+
flowDefinition: FlowDefinition;
|
|
157
|
+
formSchema?: FormSchema;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Parameters for `approval/flow.publish_version`.
|
|
161
|
+
*/
|
|
162
|
+
export interface PublishVersionParams {
|
|
163
|
+
versionId: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Parameters for `approval/flow.toggle_active`.
|
|
167
|
+
*/
|
|
168
|
+
export interface ToggleFlowActiveParams {
|
|
169
|
+
flowId: string;
|
|
170
|
+
isActive: boolean;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Search parameters for `approval/flow.find_flows`. Label filters are
|
|
174
|
+
* equality predicates, AND-combined across pairs.
|
|
175
|
+
*/
|
|
176
|
+
export interface FlowSearch {
|
|
177
|
+
tenantId?: string;
|
|
178
|
+
categoryId?: string;
|
|
179
|
+
keyword?: string;
|
|
180
|
+
isActive?: boolean;
|
|
181
|
+
labels?: Record<string, string>;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The definition bundle returned by `approval/flow.get_graph`: the flow
|
|
185
|
+
* record and the resolved version (carrying `flowSchema` / `formSchema`) —
|
|
186
|
+
* the latest published version by default, or the version named by
|
|
187
|
+
* `versionId` (the designer's edit seed).
|
|
188
|
+
*/
|
|
189
|
+
export interface FlowGraphBundle {
|
|
190
|
+
flow: Flow | null;
|
|
191
|
+
version: FlowVersion | null;
|
|
192
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type * from './admin';
|
|
2
|
+
export type * from './base';
|
|
3
|
+
export type * from './category';
|
|
4
|
+
export type * from './delegation';
|
|
5
|
+
export type * from './detail';
|
|
6
|
+
export * from './enums';
|
|
7
|
+
export type * from './flow';
|
|
8
|
+
export type * from './instance';
|
|
9
|
+
export type * from './my';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AddAssigneeType, ProcessTaskAction } from './enums';
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for `approval/instance.start`. `formData` is the form
|
|
4
|
+
* renderer's submit payload, validated server-side against the version's
|
|
5
|
+
* derived field list.
|
|
6
|
+
*/
|
|
7
|
+
export interface StartInstanceParams {
|
|
8
|
+
tenantId: string;
|
|
9
|
+
flowCode: string;
|
|
10
|
+
/**
|
|
11
|
+
* Opaque reference to the bound business record; required by convention for
|
|
12
|
+
* business-bound flows unless the host's `BusinessRefProvider` derives one.
|
|
13
|
+
*/
|
|
14
|
+
businessRef?: string;
|
|
15
|
+
formData?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Parameters for `approval/instance.process_task` — the per-task decision
|
|
19
|
+
* endpoint bundling approve / reject / transfer / rollback / handle.
|
|
20
|
+
*/
|
|
21
|
+
export interface ProcessTaskParams {
|
|
22
|
+
taskId: string;
|
|
23
|
+
action: ProcessTaskAction;
|
|
24
|
+
opinion?: string;
|
|
25
|
+
formData?: Record<string, unknown>;
|
|
26
|
+
attachments?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* Required for `transfer`.
|
|
29
|
+
*/
|
|
30
|
+
transferToId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Required for `rollback`: the flow-node id to send the instance back to.
|
|
33
|
+
*/
|
|
34
|
+
targetNodeId?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parameters for `approval/instance.withdraw`.
|
|
38
|
+
*/
|
|
39
|
+
export interface WithdrawInstanceParams {
|
|
40
|
+
instanceId: string;
|
|
41
|
+
reason?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parameters for `approval/instance.resubmit`.
|
|
45
|
+
*/
|
|
46
|
+
export interface ResubmitInstanceParams {
|
|
47
|
+
instanceId: string;
|
|
48
|
+
formData?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Parameters for `approval/instance.add_cc`.
|
|
52
|
+
*/
|
|
53
|
+
export interface AddCCParams {
|
|
54
|
+
instanceId: string;
|
|
55
|
+
ccUserIds: string[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parameters for `approval/instance.mark_cc_read`.
|
|
59
|
+
*/
|
|
60
|
+
export interface MarkCCReadParams {
|
|
61
|
+
instanceId: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Parameters for `approval/instance.add_assignee`.
|
|
65
|
+
*/
|
|
66
|
+
export interface AddAssigneeParams {
|
|
67
|
+
taskId: string;
|
|
68
|
+
userIds: string[];
|
|
69
|
+
addType: AddAssigneeType;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parameters for `approval/instance.remove_assignee`.
|
|
73
|
+
*/
|
|
74
|
+
export interface RemoveAssigneeParams {
|
|
75
|
+
taskId: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Parameters for `approval/instance.urge_task`.
|
|
79
|
+
*/
|
|
80
|
+
export interface UrgeTaskParams {
|
|
81
|
+
taskId: string;
|
|
82
|
+
message?: string;
|
|
83
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { FormSchema } from '@vef-framework-react/form-editor';
|
|
2
|
+
import { FormData, UserInfo } from './base';
|
|
3
|
+
import { InstanceFlowGraph, TimelineEntry } from './detail';
|
|
4
|
+
import { AddAssigneeType, FieldPermission, InstanceAction, InstanceStatus } from './enums';
|
|
5
|
+
/**
|
|
6
|
+
* A flow the current user is allowed to initiate, mirroring
|
|
7
|
+
* `my.AvailableFlow`.
|
|
8
|
+
*/
|
|
9
|
+
export interface AvailableFlow {
|
|
10
|
+
flowId: string;
|
|
11
|
+
flowCode: string;
|
|
12
|
+
flowName: string;
|
|
13
|
+
flowIcon?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
labels?: Record<string, string>;
|
|
16
|
+
categoryId: string;
|
|
17
|
+
categoryName: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The pre-submission view of a flow for an applicant, mirroring
|
|
21
|
+
* `my.StartForm`: identity fields plus the published version's host
|
|
22
|
+
* form-designer document, returned verbatim. Loading it is gated exactly
|
|
23
|
+
* like starting the instance.
|
|
24
|
+
*/
|
|
25
|
+
export interface StartForm {
|
|
26
|
+
flowId: string;
|
|
27
|
+
flowCode: string;
|
|
28
|
+
flowName: string;
|
|
29
|
+
flowIcon?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
versionId: string;
|
|
32
|
+
version: number;
|
|
33
|
+
formSchema?: FormSchema;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* An approval instance submitted by the current user, mirroring
|
|
37
|
+
* `my.InitiatedInstance`.
|
|
38
|
+
*/
|
|
39
|
+
export interface InitiatedInstance {
|
|
40
|
+
instanceId: string;
|
|
41
|
+
instanceNo: string;
|
|
42
|
+
title: string;
|
|
43
|
+
flowName: string;
|
|
44
|
+
flowIcon?: string;
|
|
45
|
+
status: InstanceStatus;
|
|
46
|
+
currentNodeName?: string;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
finishedAt?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A task awaiting the current user's action, mirroring `my.PendingTask`.
|
|
52
|
+
*/
|
|
53
|
+
export interface PendingTask {
|
|
54
|
+
taskId: string;
|
|
55
|
+
instanceId: string;
|
|
56
|
+
instanceTitle: string;
|
|
57
|
+
instanceNo: string;
|
|
58
|
+
flowName: string;
|
|
59
|
+
flowIcon?: string;
|
|
60
|
+
applicant: UserInfo;
|
|
61
|
+
nodeName: string;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
deadline?: string;
|
|
64
|
+
isTimeout: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A task the current user has already processed, mirroring
|
|
68
|
+
* `my.CompletedTask`.
|
|
69
|
+
*/
|
|
70
|
+
export interface CompletedTask {
|
|
71
|
+
taskId: string;
|
|
72
|
+
instanceId: string;
|
|
73
|
+
instanceTitle: string;
|
|
74
|
+
instanceNo: string;
|
|
75
|
+
flowName: string;
|
|
76
|
+
flowIcon?: string;
|
|
77
|
+
applicant: UserInfo;
|
|
78
|
+
nodeName: string;
|
|
79
|
+
status: string;
|
|
80
|
+
finishedAt?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A CC notification addressed to the current user, mirroring `my.CCRecord`.
|
|
84
|
+
*/
|
|
85
|
+
export interface MyCCRecord {
|
|
86
|
+
ccRecordId: string;
|
|
87
|
+
instanceId: string;
|
|
88
|
+
instanceTitle: string;
|
|
89
|
+
instanceNo: string;
|
|
90
|
+
flowName: string;
|
|
91
|
+
flowIcon?: string;
|
|
92
|
+
applicant: UserInfo;
|
|
93
|
+
nodeName?: string;
|
|
94
|
+
isRead: boolean;
|
|
95
|
+
createdAt: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Counts of pending actions for the current user, mirroring
|
|
99
|
+
* `my.PendingCounts`.
|
|
100
|
+
*/
|
|
101
|
+
export interface PendingCounts {
|
|
102
|
+
pendingTaskCount: number;
|
|
103
|
+
unreadCcCount: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The instance's runtime state within a self-service detail view, mirroring
|
|
107
|
+
* `my.InstanceInfo`. `formData` is already stripped of the fields this
|
|
108
|
+
* viewer may not see. `labels` are the flow's host-owned selection metadata,
|
|
109
|
+
* read from the mutable flow at query time (display identity, not a
|
|
110
|
+
* version-pinned snapshot).
|
|
111
|
+
*/
|
|
112
|
+
export interface MyInstanceInfo {
|
|
113
|
+
instanceId: string;
|
|
114
|
+
instanceNo: string;
|
|
115
|
+
title: string;
|
|
116
|
+
flowName: string;
|
|
117
|
+
flowIcon?: string;
|
|
118
|
+
labels?: Record<string, string>;
|
|
119
|
+
applicant: UserInfo;
|
|
120
|
+
status: InstanceStatus;
|
|
121
|
+
currentNodeId?: string;
|
|
122
|
+
currentNodeName?: string;
|
|
123
|
+
businessRef?: string;
|
|
124
|
+
formData?: FormData;
|
|
125
|
+
createdAt: string;
|
|
126
|
+
finishedAt?: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* One valid rollback destination, resolved server-side from the node's
|
|
130
|
+
* rollback config and the instance's visit trail.
|
|
131
|
+
*/
|
|
132
|
+
export interface RollbackTarget {
|
|
133
|
+
nodeId: string;
|
|
134
|
+
name: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* One peer task eligible for removal, mirroring `my.RemovableAssignee`.
|
|
138
|
+
* `status` is the peer task's status verbatim (`pending` / `waiting`).
|
|
139
|
+
*/
|
|
140
|
+
export interface RemovableAssignee {
|
|
141
|
+
taskId: string;
|
|
142
|
+
assignee: UserInfo;
|
|
143
|
+
status: string;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The viewer's pending task within a detail view, mirroring `my.ViewerTask`:
|
|
147
|
+
* what `process_task` should target plus the node-level action configuration
|
|
148
|
+
* — the client never re-derives engine semantics.
|
|
149
|
+
*/
|
|
150
|
+
export interface ViewerTask {
|
|
151
|
+
taskId: string;
|
|
152
|
+
nodeId: string;
|
|
153
|
+
isOpinionRequired: boolean;
|
|
154
|
+
addAssigneeTypes?: AddAssigneeType[];
|
|
155
|
+
rollbackTargets?: RollbackTarget[];
|
|
156
|
+
removableAssignees?: RemovableAssignee[];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The self-service detail view of an approval instance, mirroring
|
|
160
|
+
* `my.InstanceDetail`: runtime state, the version-pinned form document, the
|
|
161
|
+
* node-by-node timeline, the progress-annotated flow graph, and the
|
|
162
|
+
* viewer-specific action set. `fieldPermissions` is materialized for every
|
|
163
|
+
* top-level form field — apply it verbatim, no default resolution.
|
|
164
|
+
*/
|
|
165
|
+
export interface MyInstanceDetail {
|
|
166
|
+
instance: MyInstanceInfo;
|
|
167
|
+
formSchema?: FormSchema;
|
|
168
|
+
timeline: TimelineEntry[];
|
|
169
|
+
flowGraph: InstanceFlowGraph;
|
|
170
|
+
availableActions: InstanceAction[];
|
|
171
|
+
fieldPermissions?: Record<string, FieldPermission>;
|
|
172
|
+
myTask?: ViewerTask;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Search parameters for `approval/my.find_available_flows`.
|
|
176
|
+
*/
|
|
177
|
+
export interface AvailableFlowSearch {
|
|
178
|
+
tenantId?: string;
|
|
179
|
+
keyword?: string;
|
|
180
|
+
labels?: Record<string, string>;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Search parameters for `approval/my.find_initiated`.
|
|
184
|
+
*/
|
|
185
|
+
export interface InitiatedInstanceSearch {
|
|
186
|
+
tenantId?: string;
|
|
187
|
+
status?: InstanceStatus;
|
|
188
|
+
keyword?: string;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Search parameters for `approval/my.find_pending_tasks` and
|
|
192
|
+
* `approval/my.find_completed_tasks`.
|
|
193
|
+
*/
|
|
194
|
+
export interface MyTaskSearch {
|
|
195
|
+
tenantId?: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Search parameters for `approval/my.find_cc_records`.
|
|
199
|
+
*/
|
|
200
|
+
export interface MyCCRecordSearch {
|
|
201
|
+
tenantId?: string;
|
|
202
|
+
isRead?: boolean;
|
|
203
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vef-framework-react/approval",
|
|
3
|
+
"version": "2.12.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Approval engine pages and runtime components for VEF framework",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"vef",
|
|
8
|
+
"framework",
|
|
9
|
+
"react",
|
|
10
|
+
"approval",
|
|
11
|
+
"workflow"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://vef.ilxqx.com",
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Venus",
|
|
17
|
+
"email": "iweixiaopeng@163.com",
|
|
18
|
+
"url": "https://github.com/ilxqx"
|
|
19
|
+
},
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"vef": "./src/index.ts",
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/types/index.d.ts",
|
|
27
|
+
"default": "./dist/es/index.js"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./dist/types/index.d.ts",
|
|
31
|
+
"default": "./dist/cjs/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
"main": "dist/cjs/index.cjs",
|
|
37
|
+
"module": "dist/es/index.js",
|
|
38
|
+
"types": "dist/types/index.d.ts",
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
],
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@emotion/react": "^11.14.0",
|
|
44
|
+
"@xyflow/react": "^12.11.1",
|
|
45
|
+
"dayjs": "^1.11.0",
|
|
46
|
+
"lucide-react": "^1.23.0",
|
|
47
|
+
"@vef-framework-react/approval-flow-editor": "2.12.0",
|
|
48
|
+
"@vef-framework-react/components": "2.12.0",
|
|
49
|
+
"@vef-framework-react/core": "2.12.0",
|
|
50
|
+
"@vef-framework-react/shared": "2.12.0",
|
|
51
|
+
"@vef-framework-react/form-editor": "2.12.0",
|
|
52
|
+
"@vef-framework-react/approval-form-bridge": "2.12.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"react": "^19.2.7"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"react": ">=19"
|
|
59
|
+
},
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=22.x"
|
|
62
|
+
},
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "vite build",
|
|
68
|
+
"clean": "rimraf dist",
|
|
69
|
+
"typecheck": "tsc --noEmit"
|
|
70
|
+
}
|
|
71
|
+
}
|