@rytass/bpm-core-shared 0.3.0 → 0.5.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/CHANGELOG.md +12 -0
- package/eslint.config.mjs +19 -0
- package/jest.config.cts +10 -0
- package/package.json +2 -3
- package/project.json +49 -0
- package/src/lib/condition.ts +55 -0
- package/src/lib/form.ts +77 -0
- package/src/lib/identity.ts +25 -0
- package/src/lib/organization.ts +52 -0
- package/src/lib/shared.spec.ts +13 -0
- package/src/lib/status.ts +29 -0
- package/src/lib/workflow-command.spec.ts +278 -0
- package/src/lib/workflow-command.ts +848 -0
- package/src/lib/workflow-graph.ts +974 -0
- package/src/lib/workflow-toolset.spec.ts +230 -0
- package/src/lib/workflow-toolset.ts +1083 -0
- package/src/lib/workflow.ts +216 -0
- package/tsconfig.json +23 -0
- package/tsconfig.lib.json +16 -0
- package/tsconfig.spec.json +16 -0
- package/src/index.js +0 -13
- package/src/index.js.map +0 -1
- package/src/lib/condition.d.ts +0 -43
- package/src/lib/condition.js +0 -3
- package/src/lib/condition.js.map +0 -1
- package/src/lib/form.d.ts +0 -48
- package/src/lib/form.js +0 -3
- package/src/lib/form.js.map +0 -1
- package/src/lib/identity.d.ts +0 -24
- package/src/lib/identity.js +0 -3
- package/src/lib/identity.js.map +0 -1
- package/src/lib/organization.d.ts +0 -47
- package/src/lib/organization.js +0 -3
- package/src/lib/organization.js.map +0 -1
- package/src/lib/status.d.ts +0 -7
- package/src/lib/status.js +0 -3
- package/src/lib/status.js.map +0 -1
- package/src/lib/workflow-command.d.ts +0 -156
- package/src/lib/workflow-command.js +0 -292
- package/src/lib/workflow-command.js.map +0 -1
- package/src/lib/workflow-graph.d.ts +0 -96
- package/src/lib/workflow-graph.js +0 -605
- package/src/lib/workflow-graph.js.map +0 -1
- package/src/lib/workflow-toolset.d.ts +0 -105
- package/src/lib/workflow-toolset.js +0 -702
- package/src/lib/workflow-toolset.js.map +0 -1
- package/src/lib/workflow.d.ts +0 -160
- package/src/lib/workflow.js +0 -3
- package/src/lib/workflow.js.map +0 -1
- /package/src/{index.d.ts → index.ts} +0 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
export interface WorkflowDefinition {
|
|
2
|
+
readonly edges: readonly WorkflowEdge[];
|
|
3
|
+
readonly meta: WorkflowDefinitionMeta;
|
|
4
|
+
readonly nodes: readonly WorkflowNode[];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface WorkflowDefinitionMeta {
|
|
8
|
+
readonly diagramVersion?: string;
|
|
9
|
+
readonly schemaVersion: 1;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type WorkflowNode =
|
|
13
|
+
| StartEventNode
|
|
14
|
+
| EndEventNode
|
|
15
|
+
| UserTaskNode
|
|
16
|
+
| ServiceTaskNode
|
|
17
|
+
| ExclusiveGatewayNode
|
|
18
|
+
| ParallelGatewayNode;
|
|
19
|
+
|
|
20
|
+
export interface NodePosition {
|
|
21
|
+
readonly x: number;
|
|
22
|
+
readonly y: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface BaseNodeData {
|
|
26
|
+
readonly label: string;
|
|
27
|
+
readonly triggerMode?: WorkflowNodeTriggerMode;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type WorkflowNodeTriggerMode = 'AND' | 'OR';
|
|
31
|
+
|
|
32
|
+
export interface BaseWorkflowNode<
|
|
33
|
+
TType extends string,
|
|
34
|
+
TData extends BaseNodeData,
|
|
35
|
+
> {
|
|
36
|
+
readonly data: TData;
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly position: NodePosition;
|
|
39
|
+
readonly type: TType;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type StartEventNode = BaseWorkflowNode<'startEvent', BaseNodeData>;
|
|
43
|
+
|
|
44
|
+
export type EndEventNode = BaseWorkflowNode<
|
|
45
|
+
'endEvent',
|
|
46
|
+
BaseNodeData & {
|
|
47
|
+
readonly endState?: 'APPROVED' | 'REJECTED';
|
|
48
|
+
}
|
|
49
|
+
>;
|
|
50
|
+
|
|
51
|
+
export type UserTaskNode = BaseWorkflowNode<'userTask', UserTaskNodeData>;
|
|
52
|
+
|
|
53
|
+
export interface UserTaskNodeData extends BaseNodeData {
|
|
54
|
+
readonly allowAddSigner: boolean;
|
|
55
|
+
readonly allowReject: boolean;
|
|
56
|
+
readonly allowTransfer: boolean;
|
|
57
|
+
readonly approverResolver: ApproverResolver;
|
|
58
|
+
readonly decisionPolicy: DecisionPolicy;
|
|
59
|
+
readonly description?: string;
|
|
60
|
+
readonly entryCondition?: string;
|
|
61
|
+
readonly fieldPermissions?: readonly FieldPermission[];
|
|
62
|
+
readonly notification?: NotificationOverride;
|
|
63
|
+
readonly returnBehavior: ReturnBehavior;
|
|
64
|
+
readonly sla?: SlaConfig;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type ApproverResolver =
|
|
68
|
+
| { readonly memberIds: readonly string[]; readonly type: 'DIRECT' }
|
|
69
|
+
| { readonly positionId: string; readonly type: 'POSITION' }
|
|
70
|
+
| {
|
|
71
|
+
readonly includeDescendants?: boolean;
|
|
72
|
+
readonly orgUnitId: string;
|
|
73
|
+
readonly type: 'ORG_UNIT_MEMBER';
|
|
74
|
+
}
|
|
75
|
+
| {
|
|
76
|
+
readonly includeDescendants?: boolean;
|
|
77
|
+
readonly orgUnitId: string;
|
|
78
|
+
readonly positionId: string;
|
|
79
|
+
readonly type: 'ORG_UNIT_POSITION';
|
|
80
|
+
}
|
|
81
|
+
| {
|
|
82
|
+
readonly baseFromInitiator: boolean;
|
|
83
|
+
readonly fallback?: ApproverResolverFallback;
|
|
84
|
+
readonly levelsUp: number;
|
|
85
|
+
readonly type: 'ORG_MANAGER';
|
|
86
|
+
}
|
|
87
|
+
| {
|
|
88
|
+
readonly fallback?: ApproverResolverFallback;
|
|
89
|
+
readonly orgUnitId: string;
|
|
90
|
+
readonly type: 'ORG_UNIT_MANAGER';
|
|
91
|
+
}
|
|
92
|
+
| { readonly formPath: string; readonly type: 'DYNAMIC_FORM' }
|
|
93
|
+
| { readonly expression: string; readonly type: 'EXPRESSION' };
|
|
94
|
+
|
|
95
|
+
export type ApproverResolverFallback =
|
|
96
|
+
| { readonly type: 'NONE' }
|
|
97
|
+
| {
|
|
98
|
+
readonly allowInitiatorSelfApproval?: boolean;
|
|
99
|
+
readonly memberId: string;
|
|
100
|
+
readonly type: 'DIRECT';
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export type DecisionPolicy =
|
|
104
|
+
| { readonly type: 'SINGLE' }
|
|
105
|
+
| { readonly type: 'SEQUENTIAL' }
|
|
106
|
+
| { readonly type: 'PARALLEL_ALL' }
|
|
107
|
+
| { readonly type: 'PARALLEL_ANY' }
|
|
108
|
+
| {
|
|
109
|
+
readonly threshold: number;
|
|
110
|
+
readonly thresholdType: 'COUNT' | 'PERCENTAGE';
|
|
111
|
+
readonly type: 'QUORUM';
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export interface ReturnBehavior {
|
|
115
|
+
readonly allowReturn: boolean;
|
|
116
|
+
readonly allowedTargets: 'PREVIOUS' | 'INITIATOR' | 'ANY';
|
|
117
|
+
readonly resubmitStrategy?: ReturnResubmitStrategy;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type ReturnResubmitStrategy = 'FROM_RETURN_POINT' | 'RESTART';
|
|
121
|
+
|
|
122
|
+
export interface SlaConfig {
|
|
123
|
+
readonly duration: string;
|
|
124
|
+
readonly escalateLevelsUp?: number;
|
|
125
|
+
readonly onTimeout:
|
|
126
|
+
| 'REMIND'
|
|
127
|
+
| 'AUTO_APPROVE'
|
|
128
|
+
| 'ESCALATE'
|
|
129
|
+
| 'TERMINATE_INSTANCE';
|
|
130
|
+
readonly warningAt?: number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface FieldPermission {
|
|
134
|
+
readonly editable: boolean;
|
|
135
|
+
readonly fieldPath: string;
|
|
136
|
+
readonly visible: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface NotificationOverride {
|
|
140
|
+
readonly channels?: readonly NotificationChannel[];
|
|
141
|
+
readonly customTemplate?: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type NotificationChannel = 'IN_APP' | 'EMAIL' | 'WEBHOOK';
|
|
145
|
+
|
|
146
|
+
export type ServiceTaskNode = BaseWorkflowNode<
|
|
147
|
+
'serviceTask',
|
|
148
|
+
BaseNodeData & {
|
|
149
|
+
readonly action: ServiceAction;
|
|
150
|
+
readonly entryCondition?: string;
|
|
151
|
+
}
|
|
152
|
+
>;
|
|
153
|
+
|
|
154
|
+
export type ServiceAction =
|
|
155
|
+
| {
|
|
156
|
+
readonly channels: readonly Exclude<NotificationChannel, 'WEBHOOK'>[];
|
|
157
|
+
readonly recipients: ApproverResolver;
|
|
158
|
+
readonly template?: string;
|
|
159
|
+
readonly type: 'NOTIFY';
|
|
160
|
+
}
|
|
161
|
+
| {
|
|
162
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
163
|
+
readonly payload?: string;
|
|
164
|
+
readonly type: 'WEBHOOK';
|
|
165
|
+
readonly url: string;
|
|
166
|
+
}
|
|
167
|
+
| {
|
|
168
|
+
readonly fieldPath: string;
|
|
169
|
+
readonly type: 'SET_FORM_FIELD';
|
|
170
|
+
readonly value: string;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export type ExclusiveGatewayNode = BaseWorkflowNode<
|
|
174
|
+
'exclusiveGateway',
|
|
175
|
+
BaseNodeData & {
|
|
176
|
+
readonly direction: GatewayDirection;
|
|
177
|
+
}
|
|
178
|
+
>;
|
|
179
|
+
|
|
180
|
+
export type ParallelGatewayNode = BaseWorkflowNode<
|
|
181
|
+
'parallelGateway',
|
|
182
|
+
BaseNodeData & {
|
|
183
|
+
readonly direction: GatewayDirection;
|
|
184
|
+
}
|
|
185
|
+
>;
|
|
186
|
+
|
|
187
|
+
export type GatewayDirection = 'split' | 'join';
|
|
188
|
+
|
|
189
|
+
export interface WorkflowEdge {
|
|
190
|
+
readonly data: WorkflowEdgeData;
|
|
191
|
+
readonly id: string;
|
|
192
|
+
readonly source: string;
|
|
193
|
+
readonly sourceHandle?: string | null;
|
|
194
|
+
readonly target: string;
|
|
195
|
+
readonly targetHandle?: string | null;
|
|
196
|
+
readonly type?: 'smoothstep';
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface WorkflowEdgeData {
|
|
200
|
+
readonly condition?: string;
|
|
201
|
+
readonly conditionFieldKey?: string;
|
|
202
|
+
readonly conditionOperator?: WorkflowEdgeConditionOperator;
|
|
203
|
+
readonly conditionValue?: string;
|
|
204
|
+
readonly isDefault?: boolean;
|
|
205
|
+
readonly label?: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export type WorkflowEdgeConditionOperator =
|
|
209
|
+
| 'EQUALS'
|
|
210
|
+
| 'GREATER_THAN'
|
|
211
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
212
|
+
| 'IS_EMPTY'
|
|
213
|
+
| 'IS_FILLED'
|
|
214
|
+
| 'LESS_THAN'
|
|
215
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
216
|
+
| 'NOT_EQUALS';
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"forceConsistentCasingInFileNames": true,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"importHelpers": true,
|
|
8
|
+
"noImplicitOverride": true,
|
|
9
|
+
"noImplicitReturns": true,
|
|
10
|
+
"noFallthroughCasesInSwitch": true,
|
|
11
|
+
"noPropertyAccessFromIndexSignature": true
|
|
12
|
+
},
|
|
13
|
+
"files": [],
|
|
14
|
+
"include": [],
|
|
15
|
+
"references": [
|
|
16
|
+
{
|
|
17
|
+
"path": "./tsconfig.lib.json"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"path": "./tsconfig.spec.json"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"outDir": "../../dist/out-tsc",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"types": ["node"]
|
|
8
|
+
},
|
|
9
|
+
"include": ["src/**/*.ts"],
|
|
10
|
+
"exclude": [
|
|
11
|
+
"jest.config.ts",
|
|
12
|
+
"jest.config.cts",
|
|
13
|
+
"src/**/*.spec.ts",
|
|
14
|
+
"src/**/*.test.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"moduleResolution": "node10",
|
|
7
|
+
"types": ["jest", "node"]
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"jest.config.ts",
|
|
11
|
+
"jest.config.cts",
|
|
12
|
+
"src/**/*.test.ts",
|
|
13
|
+
"src/**/*.spec.ts",
|
|
14
|
+
"src/**/*.d.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
package/src/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./lib/condition"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./lib/form"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./lib/identity"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./lib/organization"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./lib/status"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./lib/workflow"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./lib/workflow-graph"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./lib/workflow-command"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./lib/workflow-toolset"), exports);
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/shared/src/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,qDAA2B;AAC3B,yDAA+B;AAC/B,6DAAmC;AACnC,uDAA6B;AAC7B,yDAA+B;AAC/B,+DAAqC;AACrC,iEAAuC;AACvC,iEAAuC"}
|
package/src/lib/condition.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export type ConditionContextType = 'INITIATOR_POLICY' | 'ENTRY_CONDITION' | 'FLOW_CONDITION' | 'APPROVER_RESOLVER' | 'FORM_FIELD_CONDITION' | 'DELEGATION_CONDITION';
|
|
2
|
-
export interface SubjectContext {
|
|
3
|
-
readonly customFields: Readonly<Record<string, unknown>>;
|
|
4
|
-
readonly email: string;
|
|
5
|
-
readonly memberId: string;
|
|
6
|
-
readonly name: string;
|
|
7
|
-
readonly org: OrgContext;
|
|
8
|
-
readonly position: PositionContext;
|
|
9
|
-
readonly roles: readonly string[];
|
|
10
|
-
}
|
|
11
|
-
export interface OrgContext {
|
|
12
|
-
readonly code: string;
|
|
13
|
-
readonly costCenter?: string;
|
|
14
|
-
readonly id: string;
|
|
15
|
-
readonly location?: string;
|
|
16
|
-
readonly name: string;
|
|
17
|
-
readonly parentId: string | null;
|
|
18
|
-
readonly path: readonly string[];
|
|
19
|
-
readonly type: string;
|
|
20
|
-
}
|
|
21
|
-
export interface PositionContext {
|
|
22
|
-
readonly code: string;
|
|
23
|
-
readonly id: string;
|
|
24
|
-
readonly level: number;
|
|
25
|
-
readonly name: string;
|
|
26
|
-
}
|
|
27
|
-
export interface EnvContext {
|
|
28
|
-
readonly now: string;
|
|
29
|
-
}
|
|
30
|
-
export interface InstanceContext {
|
|
31
|
-
readonly id: string;
|
|
32
|
-
readonly startedAt: string;
|
|
33
|
-
readonly templateId: string;
|
|
34
|
-
readonly templateVersion: number;
|
|
35
|
-
}
|
|
36
|
-
export interface LastDecisionContext {
|
|
37
|
-
readonly action: 'approved' | 'rejected' | 'returned';
|
|
38
|
-
readonly comment: string;
|
|
39
|
-
readonly decidedAt: string;
|
|
40
|
-
readonly decidedBy: SubjectContext;
|
|
41
|
-
readonly nodeId: string;
|
|
42
|
-
readonly taskId: string;
|
|
43
|
-
}
|
package/src/lib/condition.js
DELETED
package/src/lib/condition.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../../../libs/shared/src/lib/condition.ts"],"names":[],"mappings":""}
|
package/src/lib/form.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export interface FormDefinitionSchema {
|
|
2
|
-
readonly fields: readonly FormFieldDefinition[];
|
|
3
|
-
readonly schemaVersion: 1;
|
|
4
|
-
}
|
|
5
|
-
export type FormFieldDefinition = TextFieldDefinition | NumberFieldDefinition | DateFieldDefinition | SelectFieldDefinition | BooleanFieldDefinition | FileUploadFieldDefinition;
|
|
6
|
-
interface BaseFormFieldDefinition<TType extends string> {
|
|
7
|
-
readonly defaultValue?: FormFieldValue;
|
|
8
|
-
readonly description?: string;
|
|
9
|
-
readonly fieldKey: string;
|
|
10
|
-
readonly label: string;
|
|
11
|
-
readonly placeholder?: string;
|
|
12
|
-
readonly readonlyWhen?: string;
|
|
13
|
-
readonly required: boolean;
|
|
14
|
-
readonly requiredWhen?: string;
|
|
15
|
-
readonly type: TType;
|
|
16
|
-
readonly visibleWhen?: string;
|
|
17
|
-
}
|
|
18
|
-
export type FormFieldValue = boolean | number | string | readonly string[] | null;
|
|
19
|
-
export type TextFieldDefinition = BaseFormFieldDefinition<'text' | 'textarea'> & {
|
|
20
|
-
readonly maxLength?: number;
|
|
21
|
-
readonly minLength?: number;
|
|
22
|
-
};
|
|
23
|
-
export type NumberFieldDefinition = BaseFormFieldDefinition<'number' | 'money'> & {
|
|
24
|
-
readonly maximum?: number;
|
|
25
|
-
readonly minimum?: number;
|
|
26
|
-
};
|
|
27
|
-
export type DateFieldDefinition = BaseFormFieldDefinition<'date' | 'datetime'>;
|
|
28
|
-
export type SelectFieldDefinition = BaseFormFieldDefinition<'select' | 'radio' | 'checkbox'> & {
|
|
29
|
-
readonly options: readonly FormFieldOption[];
|
|
30
|
-
};
|
|
31
|
-
export interface FormFieldOption {
|
|
32
|
-
readonly label: string;
|
|
33
|
-
readonly value: string;
|
|
34
|
-
}
|
|
35
|
-
export type BooleanFieldDefinition = BaseFormFieldDefinition<'boolean'>;
|
|
36
|
-
export type FileUploadFieldDefinition = BaseFormFieldDefinition<'file_upload'> & {
|
|
37
|
-
readonly acceptedMimeTypes?: readonly string[];
|
|
38
|
-
readonly maxFiles?: number;
|
|
39
|
-
};
|
|
40
|
-
export interface FormUiSchema {
|
|
41
|
-
readonly layout: readonly FormLayoutItem[];
|
|
42
|
-
readonly schemaVersion: 1;
|
|
43
|
-
}
|
|
44
|
-
export interface FormLayoutItem {
|
|
45
|
-
readonly fieldKey: string;
|
|
46
|
-
readonly width: 'FULL' | 'HALF' | 'THIRD';
|
|
47
|
-
}
|
|
48
|
-
export {};
|
package/src/lib/form.js
DELETED
package/src/lib/form.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../../../../libs/shared/src/lib/form.ts"],"names":[],"mappings":""}
|
package/src/lib/identity.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface MemberMetadata {
|
|
2
|
-
readonly memberId: string;
|
|
3
|
-
readonly name: string;
|
|
4
|
-
readonly email: string;
|
|
5
|
-
/**
|
|
6
|
-
* Opaque host-shaped JSON. BPM stores the object verbatim, serializes
|
|
7
|
-
* it back to GraphQL clients as `MemberProfile.customFieldsJson`, and
|
|
8
|
-
* never introspects keys — anything the host puts here flows through
|
|
9
|
-
* unchanged. Hosts using `createBPMMemberBaseResolverProvider` populate
|
|
10
|
-
* this field via the `options.readCustomFields?.(member)` hook;
|
|
11
|
-
* standalone `BPMMemberResolver` implementations return whatever shape
|
|
12
|
-
* the consumer UI needs. Use it as a side channel for picker labels,
|
|
13
|
-
* org context strings, avatar URLs, or any other host-specific
|
|
14
|
-
* metadata that should appear in member-display UIs.
|
|
15
|
-
*/
|
|
16
|
-
readonly customFields: Readonly<Record<string, unknown>>;
|
|
17
|
-
}
|
|
18
|
-
export interface MemberMetadataCacheEntry {
|
|
19
|
-
readonly id: string;
|
|
20
|
-
readonly memberId: string;
|
|
21
|
-
readonly metadata: MemberMetadata;
|
|
22
|
-
readonly fetchedAt: string;
|
|
23
|
-
readonly expiresAt: string;
|
|
24
|
-
}
|
package/src/lib/identity.js
DELETED
package/src/lib/identity.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../../../libs/shared/src/lib/identity.ts"],"names":[],"mappings":""}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Org-unit type — matches the BPM GraphQL `OrgUnitType` enum SDL names
|
|
3
|
-
* (UPPERCASE). The server stores the value lower-cased internally
|
|
4
|
-
* (`'company'` etc. in the database row), but every read and write
|
|
5
|
-
* across the GraphQL wire and the REST surface uses the UPPERCASE form.
|
|
6
|
-
*
|
|
7
|
-
* Consumers of `@rytass/bpm-core-client/organization` must pass these
|
|
8
|
-
* UPPERCASE literals to `createOrgUnit` / `updateOrgUnit` (and the
|
|
9
|
-
* `readOrganizationDashboard` `orgUnitType` filter), and will receive
|
|
10
|
-
* UPPERCASE values back on `OrgUnitRecord.type`.
|
|
11
|
-
*/
|
|
12
|
-
export type OrgUnitType = 'COMPANY' | 'DIVISION' | 'DEPARTMENT' | 'TEAM';
|
|
13
|
-
export type ManagerResolutionScopeType = 'MEMBER' | 'ORG_UNIT' | 'POSITION';
|
|
14
|
-
export interface OrgUnit {
|
|
15
|
-
readonly id: string;
|
|
16
|
-
readonly parentId: string | null;
|
|
17
|
-
readonly code: string;
|
|
18
|
-
readonly name: string;
|
|
19
|
-
readonly type: OrgUnitType;
|
|
20
|
-
readonly path: string;
|
|
21
|
-
readonly metadata: Readonly<Record<string, unknown>>;
|
|
22
|
-
}
|
|
23
|
-
export interface Position {
|
|
24
|
-
readonly id: string;
|
|
25
|
-
readonly code: string;
|
|
26
|
-
readonly name: string;
|
|
27
|
-
readonly level: number;
|
|
28
|
-
readonly metadata: Readonly<Record<string, unknown>>;
|
|
29
|
-
}
|
|
30
|
-
export interface Membership {
|
|
31
|
-
readonly id: string;
|
|
32
|
-
readonly memberId: string;
|
|
33
|
-
readonly orgUnitId: string;
|
|
34
|
-
readonly positionId: string | null;
|
|
35
|
-
readonly isPrimary: boolean;
|
|
36
|
-
readonly effectiveFrom: string;
|
|
37
|
-
readonly effectiveTo: string | null;
|
|
38
|
-
}
|
|
39
|
-
export interface ManagerResolution {
|
|
40
|
-
readonly id: string;
|
|
41
|
-
readonly scopeType: ManagerResolutionScopeType;
|
|
42
|
-
readonly scopeId: string;
|
|
43
|
-
readonly managerMemberId: string;
|
|
44
|
-
readonly priority: number;
|
|
45
|
-
readonly effectiveFrom: string;
|
|
46
|
-
readonly effectiveTo: string | null;
|
|
47
|
-
}
|
package/src/lib/organization.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../../../../../libs/shared/src/lib/organization.ts"],"names":[],"mappings":""}
|
package/src/lib/status.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type VersionStatus = 'DRAFT' | 'PUBLISHED' | 'ARCHIVED';
|
|
2
|
-
export type ApprovalInstanceState = 'DRAFT' | 'RUNNING' | 'APPROVED' | 'REJECTED' | 'RETURNED' | 'CANCELLED' | 'EXPIRED';
|
|
3
|
-
export type WorkflowTokenStatus = 'ACTIVE' | 'WAITING' | 'CONSUMED';
|
|
4
|
-
export type TaskStatus = 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'TRANSFERRED' | 'CANCELLED';
|
|
5
|
-
export type TaskDecisionAction = 'APPROVED' | 'REJECTED' | 'RETURNED' | 'TRANSFERRED';
|
|
6
|
-
export type DelegationRuleStatus = 'ACTIVE' | 'REVOKED' | 'EXPIRED';
|
|
7
|
-
export type DelegationScopeType = 'ALL' | 'TEMPLATE_LIST' | 'CONDITION_BASED';
|
package/src/lib/status.js
DELETED
package/src/lib/status.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../../libs/shared/src/lib/status.ts"],"names":[],"mappings":""}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { FormDefinitionSchema } from './form';
|
|
2
|
-
import { ApproverResolver, ReturnResubmitStrategy, ServiceAction, WorkflowDefinition, WorkflowEdgeConditionOperator, WorkflowNodeTriggerMode } from './workflow';
|
|
3
|
-
import { NodePaletteType, WorkflowEdgeIdFactory } from './workflow-graph';
|
|
4
|
-
/**
|
|
5
|
-
* The serialisable command layer that the template designer — and the LLM
|
|
6
|
-
* assistant — drive the workflow through. Every mutation a user can perform on
|
|
7
|
-
* the canvas, node palette, or property form is expressed as one of these
|
|
8
|
-
* commands, and {@link applyWorkflowCommand} is the single pure reducer that
|
|
9
|
-
* applies them. The React controller and the LLM tool runtime both dispatch the
|
|
10
|
-
* exact same commands, guaranteeing the assistant can do anything a user can.
|
|
11
|
-
*/
|
|
12
|
-
/** Everything the reducer needs as the single source of truth. */
|
|
13
|
-
export interface WorkflowDesignerState {
|
|
14
|
-
/** Form schema bound to the template; needed to compile edge conditions. */
|
|
15
|
-
readonly formSchema: FormDefinitionSchema | null;
|
|
16
|
-
readonly definition: WorkflowDefinition;
|
|
17
|
-
readonly editingEdgeId: string | null;
|
|
18
|
-
readonly formDefinitionVersionId: string | null;
|
|
19
|
-
readonly initiatorPolicyCel: string | null;
|
|
20
|
-
readonly selectedEdgeIds: readonly string[];
|
|
21
|
-
readonly selectedNodeId: string | null;
|
|
22
|
-
}
|
|
23
|
-
/** Where a newly added node should be wired in. */
|
|
24
|
-
export interface WorkflowNodeAnchor {
|
|
25
|
-
/** Insert the node onto this edge, splitting it. */
|
|
26
|
-
readonly edgeId?: string | null;
|
|
27
|
-
/** Insert the node after this node. */
|
|
28
|
-
readonly afterNodeId?: string | null;
|
|
29
|
-
}
|
|
30
|
-
export type WorkflowCommand = {
|
|
31
|
-
readonly type: 'addNode';
|
|
32
|
-
readonly nodeType: NodePaletteType;
|
|
33
|
-
readonly anchor?: WorkflowNodeAnchor;
|
|
34
|
-
} | {
|
|
35
|
-
readonly type: 'renameNode';
|
|
36
|
-
readonly nodeId: string;
|
|
37
|
-
readonly label: string;
|
|
38
|
-
} | {
|
|
39
|
-
readonly type: 'deleteNode';
|
|
40
|
-
readonly nodeId: string;
|
|
41
|
-
} | {
|
|
42
|
-
readonly type: 'setNodeTriggerMode';
|
|
43
|
-
readonly nodeId: string;
|
|
44
|
-
readonly triggerMode: WorkflowNodeTriggerMode;
|
|
45
|
-
} | {
|
|
46
|
-
readonly type: 'setUserTaskApprover';
|
|
47
|
-
readonly nodeId: string;
|
|
48
|
-
readonly approverResolver: ApproverResolver;
|
|
49
|
-
} | {
|
|
50
|
-
readonly type: 'setUserTaskReturnResubmitStrategy';
|
|
51
|
-
readonly nodeId: string;
|
|
52
|
-
readonly resubmitStrategy: ReturnResubmitStrategy;
|
|
53
|
-
} | {
|
|
54
|
-
readonly type: 'setUserTaskOptions';
|
|
55
|
-
readonly nodeId: string;
|
|
56
|
-
readonly allowAddSigner?: boolean;
|
|
57
|
-
readonly allowReject?: boolean;
|
|
58
|
-
readonly allowTransfer?: boolean;
|
|
59
|
-
readonly description?: string;
|
|
60
|
-
} | {
|
|
61
|
-
readonly type: 'setServiceAction';
|
|
62
|
-
readonly nodeId: string;
|
|
63
|
-
readonly action: ServiceAction;
|
|
64
|
-
} | {
|
|
65
|
-
readonly type: 'setEndState';
|
|
66
|
-
readonly nodeId: string;
|
|
67
|
-
readonly endState: 'APPROVED' | 'REJECTED';
|
|
68
|
-
} | {
|
|
69
|
-
readonly type: 'connectEdge';
|
|
70
|
-
readonly source: string;
|
|
71
|
-
readonly target: string;
|
|
72
|
-
} | {
|
|
73
|
-
readonly type: 'deleteEdge';
|
|
74
|
-
readonly edgeId: string;
|
|
75
|
-
} | {
|
|
76
|
-
readonly type: 'setEdgeCondition';
|
|
77
|
-
readonly edgeId: string;
|
|
78
|
-
readonly fieldKey?: string | null;
|
|
79
|
-
readonly operator?: WorkflowEdgeConditionOperator | null;
|
|
80
|
-
readonly value?: string | null;
|
|
81
|
-
} | {
|
|
82
|
-
readonly type: 'setEdgeDefault';
|
|
83
|
-
readonly edgeId: string;
|
|
84
|
-
readonly isDefault: boolean;
|
|
85
|
-
} | {
|
|
86
|
-
readonly type: 'bindForm';
|
|
87
|
-
readonly formDefinitionVersionId: string | null;
|
|
88
|
-
readonly formSchema: FormDefinitionSchema | null;
|
|
89
|
-
} | {
|
|
90
|
-
readonly type: 'setInitiatorPolicyCel';
|
|
91
|
-
readonly cel: string | null;
|
|
92
|
-
} | {
|
|
93
|
-
readonly type: 'selectNode';
|
|
94
|
-
readonly nodeId: string | null;
|
|
95
|
-
} | {
|
|
96
|
-
readonly type: 'selectEdges';
|
|
97
|
-
readonly edgeIds: readonly string[];
|
|
98
|
-
} | {
|
|
99
|
-
readonly type: 'autoLayout';
|
|
100
|
-
};
|
|
101
|
-
/** High-level intents that fold into a sequence of primitive commands. */
|
|
102
|
-
export type WorkflowMacroCommand = {
|
|
103
|
-
readonly type: 'insertApprovalStep';
|
|
104
|
-
readonly approverResolver: ApproverResolver;
|
|
105
|
-
readonly label?: string;
|
|
106
|
-
readonly anchor?: WorkflowNodeAnchor;
|
|
107
|
-
} | {
|
|
108
|
-
readonly type: 'insertNotification';
|
|
109
|
-
readonly action: ServiceAction;
|
|
110
|
-
readonly label?: string;
|
|
111
|
-
readonly anchor?: WorkflowNodeAnchor;
|
|
112
|
-
} | {
|
|
113
|
-
readonly type: 'insertConditionalBranch';
|
|
114
|
-
readonly label?: string;
|
|
115
|
-
readonly anchor?: WorkflowNodeAnchor;
|
|
116
|
-
};
|
|
117
|
-
export type AnyWorkflowCommand = WorkflowCommand | WorkflowMacroCommand;
|
|
118
|
-
/** Side-effect hints for the React controller (pixel layout/viewport). */
|
|
119
|
-
export interface WorkflowCommandEffects {
|
|
120
|
-
/** Topology changed — controller should re-run dagre layout + viewport. */
|
|
121
|
-
readonly layout: boolean;
|
|
122
|
-
}
|
|
123
|
-
export interface WorkflowCommandResult {
|
|
124
|
-
readonly state: WorkflowDesignerState;
|
|
125
|
-
/** Whether the command actually changed state. */
|
|
126
|
-
readonly changed: boolean;
|
|
127
|
-
/** Human-facing reason the command was a no-op / rejected, else null. */
|
|
128
|
-
readonly error: string | null;
|
|
129
|
-
/** Post-apply validation issue (same text the Save button uses), else null. */
|
|
130
|
-
readonly issue: string | null;
|
|
131
|
-
readonly effects: WorkflowCommandEffects;
|
|
132
|
-
}
|
|
133
|
-
export interface WorkflowCommandOptions {
|
|
134
|
-
/** Injectable edge id factory for deterministic runs (tests, replay). */
|
|
135
|
-
readonly createEdgeId?: WorkflowEdgeIdFactory;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Apply a single primitive command. Pure: same input → same output (given a
|
|
139
|
-
* deterministic edge id factory). Topology-changing commands set
|
|
140
|
-
* `effects.layout` so the controller can run dagre afterwards.
|
|
141
|
-
*/
|
|
142
|
-
export declare function applyWorkflowCommand(state: WorkflowDesignerState, command: WorkflowCommand, options?: WorkflowCommandOptions): WorkflowCommandResult;
|
|
143
|
-
/**
|
|
144
|
-
* Apply a high-level macro by expanding it into primitive commands. The added
|
|
145
|
-
* node's id is deterministic (`<nodeType>_<nextIndex>`), so follow-up commands
|
|
146
|
-
* can target it without depending on the post-insert selection.
|
|
147
|
-
*/
|
|
148
|
-
export declare function applyWorkflowMacroCommand(state: WorkflowDesignerState, command: WorkflowMacroCommand, options?: WorkflowCommandOptions): WorkflowCommandResult;
|
|
149
|
-
/** Apply a batch of primitive commands in order, threading state. */
|
|
150
|
-
export declare function applyWorkflowCommands(state: WorkflowDesignerState, commands: readonly WorkflowCommand[], options?: WorkflowCommandOptions): WorkflowCommandResult;
|
|
151
|
-
/**
|
|
152
|
-
* Expand a high-level macro into the primitive command sequence that realises
|
|
153
|
-
* it. The next node id is derived from the same deterministic rule
|
|
154
|
-
* {@link applyAddNode} uses, so post-add commands can target it directly.
|
|
155
|
-
*/
|
|
156
|
-
export declare function expandMacroCommand(state: WorkflowDesignerState, command: WorkflowMacroCommand): readonly WorkflowCommand[];
|