@rytass/bpm-core-client 0.5.0 → 0.6.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 +28 -0
- package/package.json +4 -3
- package/src/index.js +8 -0
- package/src/index.js.map +1 -0
- package/src/lib/api-auth-client.d.ts +73 -0
- package/src/lib/api-auth-client.js +129 -0
- package/src/lib/api-auth-client.js.map +1 -0
- package/src/lib/client-config.d.ts +81 -0
- package/src/lib/client-config.js +63 -0
- package/src/lib/client-config.js.map +1 -0
- package/src/lib/form/form-api.d.ts +54 -0
- package/src/lib/form/form-api.js +240 -0
- package/src/lib/form/form-api.js.map +1 -0
- package/src/lib/form/form-rendering.d.ts +52 -0
- package/src/lib/form/form-rendering.js +351 -0
- package/src/lib/form/form-rendering.js.map +1 -0
- package/src/lib/form/index.js +6 -0
- package/src/lib/form/index.js.map +1 -0
- package/src/lib/graphql-client.d.ts +45 -0
- package/src/lib/graphql-client.js +101 -0
- package/src/lib/graphql-client.js.map +1 -0
- package/src/lib/member-api.d.ts +49 -0
- package/src/lib/member-api.js +72 -0
- package/src/lib/member-api.js.map +1 -0
- package/src/lib/organization/index.js +5 -0
- package/src/lib/organization/index.js.map +1 -0
- package/src/lib/organization/organization-api.d.ts +173 -0
- package/src/lib/organization/organization-api.js +394 -0
- package/src/lib/organization/organization-api.js.map +1 -0
- package/src/lib/template/index.js +5 -0
- package/src/lib/template/index.js.map +1 -0
- package/src/lib/template/template-api.d.ts +174 -0
- package/src/lib/template/template-api.js +469 -0
- package/src/lib/template/template-api.js.map +1 -0
- package/src/lib/workflow/index.js +5 -0
- package/src/lib/workflow/index.js.map +1 -0
- package/src/lib/workflow/workflow-api.d.ts +517 -0
- package/src/lib/workflow/workflow-api.js +1068 -0
- package/src/lib/workflow/workflow-api.js.map +1 -0
- package/eslint.config.mjs +0 -19
- package/jest.config.cts +0 -10
- package/project.json +0 -66
- package/src/lib/api-auth-client.ts +0 -182
- package/src/lib/client-config.ts +0 -99
- package/src/lib/form/form-api.spec.ts +0 -81
- package/src/lib/form/form-api.ts +0 -402
- package/src/lib/form/form-rendering.ts +0 -580
- package/src/lib/graphql-client.spec.ts +0 -65
- package/src/lib/graphql-client.ts +0 -128
- package/src/lib/member-api.ts +0 -129
- package/src/lib/organization/organization-api.spec.ts +0 -90
- package/src/lib/organization/organization-api.ts +0 -711
- package/src/lib/template/template-api.spec.ts +0 -88
- package/src/lib/template/template-api.ts +0 -894
- package/src/lib/workflow/workflow-api.spec.ts +0 -132
- package/src/lib/workflow/workflow-api.ts +0 -2124
- package/tsconfig.json +0 -27
- package/tsconfig.lib.json +0 -16
- package/tsconfig.spec.json +0 -16
- /package/src/{index.ts → index.d.ts} +0 -0
- /package/src/lib/form/{index.ts → index.d.ts} +0 -0
- /package/src/lib/organization/{index.ts → index.d.ts} +0 -0
- /package/src/lib/template/{index.ts → index.d.ts} +0 -0
- /package/src/lib/workflow/{index.ts → index.d.ts} +0 -0
|
@@ -1,894 +0,0 @@
|
|
|
1
|
-
import { FormDefinitionSchema, FormUiSchema } from '@rytass/bpm-core-shared/form';
|
|
2
|
-
import { WorkflowDefinition } from '@rytass/bpm-core-shared/workflow';
|
|
3
|
-
import { requestGraphQl } from '../graphql-client';
|
|
4
|
-
|
|
5
|
-
export interface ApprovalTemplateRecord {
|
|
6
|
-
readonly category: string | null;
|
|
7
|
-
readonly categoryDetail: ApprovalTemplateCategoryRecord | null;
|
|
8
|
-
readonly categoryId: string | null;
|
|
9
|
-
readonly currentVersionId: string | null;
|
|
10
|
-
readonly description: string | null;
|
|
11
|
-
readonly id: string;
|
|
12
|
-
readonly name: string;
|
|
13
|
-
readonly updatedAt: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type ApprovalTemplateListStatus = 'DRAFT' | 'PUBLISHED';
|
|
17
|
-
export type ApprovalTemplateCategoryStatus = 'ACTIVE' | 'ALL' | 'INACTIVE';
|
|
18
|
-
|
|
19
|
-
export interface ApprovalTemplateCategoryRecord {
|
|
20
|
-
readonly createdAt: string;
|
|
21
|
-
readonly description: string | null;
|
|
22
|
-
readonly id: string;
|
|
23
|
-
readonly isActive: boolean;
|
|
24
|
-
readonly name: string;
|
|
25
|
-
readonly sortOrder: number;
|
|
26
|
-
readonly updatedAt: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface ApprovalTemplateVersionRecord {
|
|
30
|
-
readonly archivedAt: string | null;
|
|
31
|
-
readonly formDefinitionVersionId: string | null;
|
|
32
|
-
readonly id: string;
|
|
33
|
-
readonly initiatorPolicyCel: string | null;
|
|
34
|
-
readonly notificationConfigJson: string | null;
|
|
35
|
-
readonly publishedAt: string | null;
|
|
36
|
-
readonly slaDefaultsJson: string | null;
|
|
37
|
-
readonly status: 'ARCHIVED' | 'DRAFT' | 'PUBLISHED';
|
|
38
|
-
readonly updatedAt: string;
|
|
39
|
-
readonly version: number;
|
|
40
|
-
readonly workflowDefinition: WorkflowDefinition;
|
|
41
|
-
readonly workflowDefinitionJson: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface FormDefinitionRecord {
|
|
45
|
-
readonly currentVersionId: string | null;
|
|
46
|
-
readonly id: string;
|
|
47
|
-
readonly name: string;
|
|
48
|
-
readonly updatedAt: string;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface FormDefinitionVersionRecord {
|
|
52
|
-
readonly formDefinitionId: string;
|
|
53
|
-
readonly id: string;
|
|
54
|
-
readonly publishedAt: string | null;
|
|
55
|
-
readonly schema: FormDefinitionSchema;
|
|
56
|
-
readonly schemaJson: string;
|
|
57
|
-
readonly status: 'ARCHIVED' | 'DRAFT' | 'PUBLISHED';
|
|
58
|
-
readonly version: number;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface PublishedFormVersionOption {
|
|
62
|
-
readonly formDefinitionId: string;
|
|
63
|
-
readonly formName: string;
|
|
64
|
-
readonly id: string;
|
|
65
|
-
readonly label: string;
|
|
66
|
-
readonly schema: FormDefinitionSchema;
|
|
67
|
-
readonly version: number;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface MemberProfileRecord {
|
|
71
|
-
readonly email: string;
|
|
72
|
-
readonly memberId: string;
|
|
73
|
-
readonly name: string;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface WorkflowDryRunStepRecord {
|
|
77
|
-
readonly assigneeMemberId: string | null;
|
|
78
|
-
readonly edgeDefault: boolean | null;
|
|
79
|
-
readonly edgeId: string | null;
|
|
80
|
-
readonly edgeLabel: string | null;
|
|
81
|
-
readonly edgeMatched: boolean | null;
|
|
82
|
-
readonly edgeReason: string | null;
|
|
83
|
-
readonly entryCondition: string | null;
|
|
84
|
-
readonly entryConditionMatched: boolean | null;
|
|
85
|
-
readonly id: string;
|
|
86
|
-
readonly message: string;
|
|
87
|
-
readonly nodeId: string;
|
|
88
|
-
readonly nodeLabel: string;
|
|
89
|
-
readonly nodeType: string;
|
|
90
|
-
readonly status: string;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export interface WorkflowDryRunResultRecord {
|
|
94
|
-
readonly errors: readonly string[];
|
|
95
|
-
readonly steps: readonly WorkflowDryRunStepRecord[];
|
|
96
|
-
readonly valid: boolean;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface TemplateDesignerRecord {
|
|
100
|
-
readonly formVersions: readonly PublishedFormVersionOption[];
|
|
101
|
-
readonly template: ApprovalTemplateRecord;
|
|
102
|
-
readonly versions: readonly ApprovalTemplateVersionRecord[];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface ApprovalTemplatesPage {
|
|
106
|
-
readonly templates: readonly ApprovalTemplateRecord[];
|
|
107
|
-
readonly totalCount: number;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export interface ApprovalTemplateCategoriesPage {
|
|
111
|
-
readonly categories: readonly ApprovalTemplateCategoryRecord[];
|
|
112
|
-
readonly totalCount: number;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
interface ApprovalTemplatesQueryData {
|
|
116
|
-
readonly approvalTemplates: readonly ApprovalTemplateRecord[];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
interface ApprovalTemplatesPageQueryData extends ApprovalTemplatesQueryData {
|
|
120
|
-
readonly approvalTemplateCount: number;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
interface ApprovalTemplateCategoriesPageQueryData {
|
|
124
|
-
readonly approvalTemplateCategories: readonly ApprovalTemplateCategoryRecord[];
|
|
125
|
-
readonly approvalTemplateCategoryCount: number;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
interface CreateApprovalTemplateMutationData {
|
|
129
|
-
readonly createApprovalTemplate: Pick<ApprovalTemplateRecord, 'id'>;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
interface CreateApprovalTemplateCategoryMutationData {
|
|
133
|
-
readonly createApprovalTemplateCategory: ApprovalTemplateCategoryRecord;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
interface DeleteApprovalTemplateCategoryMutationData {
|
|
137
|
-
readonly deleteApprovalTemplateCategory: Pick<
|
|
138
|
-
ApprovalTemplateCategoryRecord,
|
|
139
|
-
'id'
|
|
140
|
-
>;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
interface UpdateApprovalTemplateCategoryMutationData {
|
|
144
|
-
readonly updateApprovalTemplateCategory: ApprovalTemplateCategoryRecord;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
interface TemplateDesignerQueryData {
|
|
148
|
-
readonly approvalTemplate: ApprovalTemplateRecord;
|
|
149
|
-
readonly approvalTemplateVersions: readonly VersionJsonRecord[];
|
|
150
|
-
readonly formDefinitions: readonly FormDefinitionRecord[];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
interface FormVersionsQueryData {
|
|
154
|
-
readonly formDefinitionVersions: readonly FormDefinitionVersionRecord[];
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
interface MembersQueryData {
|
|
158
|
-
readonly members: readonly MemberProfileRecord[];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
interface SearchMembersQueryData {
|
|
162
|
-
readonly searchMembers: readonly MemberProfileRecord[];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
interface UpdateTemplateDraftMutationData {
|
|
166
|
-
readonly updateApprovalTemplateDraft: VersionJsonRecord;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
interface PublishTemplateVersionMutationData {
|
|
170
|
-
readonly publishApprovalTemplateVersion: VersionJsonRecord;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
interface RollbackTemplateVersionMutationData {
|
|
174
|
-
readonly rollbackApprovalTemplateVersion: VersionJsonRecord;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
interface ForkTemplateMutationData {
|
|
178
|
-
readonly forkApprovalTemplate: VersionJsonRecord;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
interface DryRunApprovalWorkflowMutationData {
|
|
182
|
-
readonly dryRunApprovalWorkflow: WorkflowDryRunResultRecord;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
interface ComposeApprovalTemplateWithFormMutationData {
|
|
186
|
-
readonly composeApprovalTemplateWithForm: {
|
|
187
|
-
readonly formDefinition: Pick<
|
|
188
|
-
FormDefinitionRecord,
|
|
189
|
-
'currentVersionId' | 'id'
|
|
190
|
-
>;
|
|
191
|
-
readonly formDefinitionVersion: Pick<
|
|
192
|
-
FormDefinitionVersionRecord,
|
|
193
|
-
'id' | 'status' | 'version'
|
|
194
|
-
>;
|
|
195
|
-
readonly published: boolean;
|
|
196
|
-
readonly template: Pick<ApprovalTemplateRecord, 'currentVersionId' | 'id'>;
|
|
197
|
-
readonly templateVersion: VersionJsonRecord;
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export interface ComposeApprovalTemplateWithFormResult {
|
|
202
|
-
readonly formDefinitionId: string;
|
|
203
|
-
readonly formDefinitionVersionId: string;
|
|
204
|
-
readonly published: boolean;
|
|
205
|
-
readonly templateId: string;
|
|
206
|
-
readonly templateVersion: ApprovalTemplateVersionRecord;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
interface VersionJsonRecord extends Omit<
|
|
210
|
-
ApprovalTemplateVersionRecord,
|
|
211
|
-
'workflowDefinition'
|
|
212
|
-
> {
|
|
213
|
-
readonly workflowDefinitionJson: string;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export async function listApprovalTemplates(): Promise<
|
|
217
|
-
readonly ApprovalTemplateRecord[]
|
|
218
|
-
> {
|
|
219
|
-
const data = await requestGraphQl<ApprovalTemplatesQueryData>(
|
|
220
|
-
`query ApprovalTemplates {
|
|
221
|
-
approvalTemplates {
|
|
222
|
-
category
|
|
223
|
-
categoryId
|
|
224
|
-
categoryDetail {
|
|
225
|
-
id
|
|
226
|
-
isActive
|
|
227
|
-
name
|
|
228
|
-
}
|
|
229
|
-
currentVersionId
|
|
230
|
-
description
|
|
231
|
-
id
|
|
232
|
-
name
|
|
233
|
-
updatedAt
|
|
234
|
-
}
|
|
235
|
-
}`,
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
return data.approvalTemplates;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export async function listApprovalTemplatesPage({
|
|
242
|
-
page,
|
|
243
|
-
pageSize,
|
|
244
|
-
searchText,
|
|
245
|
-
status,
|
|
246
|
-
categoryId,
|
|
247
|
-
}: {
|
|
248
|
-
readonly categoryId?: string | null;
|
|
249
|
-
readonly page: number;
|
|
250
|
-
readonly pageSize: number;
|
|
251
|
-
readonly searchText?: string;
|
|
252
|
-
readonly status?: ApprovalTemplateListStatus | null;
|
|
253
|
-
}): Promise<ApprovalTemplatesPage> {
|
|
254
|
-
const data = await requestGraphQl<ApprovalTemplatesPageQueryData>(
|
|
255
|
-
`query ApprovalTemplatesPage(
|
|
256
|
-
$page: Int
|
|
257
|
-
$pageSize: Int
|
|
258
|
-
$searchText: String
|
|
259
|
-
$status: ApprovalTemplateListStatus
|
|
260
|
-
$categoryId: String
|
|
261
|
-
) {
|
|
262
|
-
approvalTemplates(
|
|
263
|
-
categoryId: $categoryId
|
|
264
|
-
page: $page
|
|
265
|
-
pageSize: $pageSize
|
|
266
|
-
searchText: $searchText
|
|
267
|
-
status: $status
|
|
268
|
-
) {
|
|
269
|
-
category
|
|
270
|
-
categoryId
|
|
271
|
-
categoryDetail {
|
|
272
|
-
id
|
|
273
|
-
isActive
|
|
274
|
-
name
|
|
275
|
-
}
|
|
276
|
-
currentVersionId
|
|
277
|
-
description
|
|
278
|
-
id
|
|
279
|
-
name
|
|
280
|
-
updatedAt
|
|
281
|
-
}
|
|
282
|
-
approvalTemplateCount(
|
|
283
|
-
categoryId: $categoryId
|
|
284
|
-
searchText: $searchText
|
|
285
|
-
status: $status
|
|
286
|
-
)
|
|
287
|
-
}`,
|
|
288
|
-
{
|
|
289
|
-
categoryId: categoryId ?? null,
|
|
290
|
-
page,
|
|
291
|
-
pageSize,
|
|
292
|
-
searchText,
|
|
293
|
-
status: status ?? null,
|
|
294
|
-
},
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
return {
|
|
298
|
-
templates: data.approvalTemplates,
|
|
299
|
-
totalCount: data.approvalTemplateCount,
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
export async function listApprovalTemplateCategoriesPage({
|
|
304
|
-
page,
|
|
305
|
-
pageSize,
|
|
306
|
-
searchText,
|
|
307
|
-
status,
|
|
308
|
-
}: {
|
|
309
|
-
readonly page: number;
|
|
310
|
-
readonly pageSize: number;
|
|
311
|
-
readonly searchText?: string;
|
|
312
|
-
readonly status?: ApprovalTemplateCategoryStatus | null;
|
|
313
|
-
}): Promise<ApprovalTemplateCategoriesPage> {
|
|
314
|
-
const data = await requestGraphQl<ApprovalTemplateCategoriesPageQueryData>(
|
|
315
|
-
`query ApprovalTemplateCategoriesPage(
|
|
316
|
-
$page: Int
|
|
317
|
-
$pageSize: Int
|
|
318
|
-
$searchText: String
|
|
319
|
-
$status: ApprovalTemplateCategoryStatus
|
|
320
|
-
) {
|
|
321
|
-
approvalTemplateCategories(
|
|
322
|
-
page: $page
|
|
323
|
-
pageSize: $pageSize
|
|
324
|
-
searchText: $searchText
|
|
325
|
-
status: $status
|
|
326
|
-
) {
|
|
327
|
-
createdAt
|
|
328
|
-
description
|
|
329
|
-
id
|
|
330
|
-
isActive
|
|
331
|
-
name
|
|
332
|
-
sortOrder
|
|
333
|
-
updatedAt
|
|
334
|
-
}
|
|
335
|
-
approvalTemplateCategoryCount(
|
|
336
|
-
searchText: $searchText
|
|
337
|
-
status: $status
|
|
338
|
-
)
|
|
339
|
-
}`,
|
|
340
|
-
{ page, pageSize, searchText, status: status ?? null },
|
|
341
|
-
);
|
|
342
|
-
|
|
343
|
-
return {
|
|
344
|
-
categories: data.approvalTemplateCategories,
|
|
345
|
-
totalCount: data.approvalTemplateCategoryCount,
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
export async function createApprovalTemplate({
|
|
350
|
-
categoryId,
|
|
351
|
-
name,
|
|
352
|
-
}: {
|
|
353
|
-
readonly categoryId: string | null;
|
|
354
|
-
readonly name: string;
|
|
355
|
-
}): Promise<string> {
|
|
356
|
-
const data = await requestGraphQl<CreateApprovalTemplateMutationData>(
|
|
357
|
-
`mutation CreateApprovalTemplate($input: CreateApprovalTemplateInput!) {
|
|
358
|
-
createApprovalTemplate(input: $input) {
|
|
359
|
-
id
|
|
360
|
-
}
|
|
361
|
-
}`,
|
|
362
|
-
{
|
|
363
|
-
input: {
|
|
364
|
-
category: null,
|
|
365
|
-
categoryId,
|
|
366
|
-
createdByMemberId: null,
|
|
367
|
-
description: null,
|
|
368
|
-
formDefinitionVersionId: null,
|
|
369
|
-
name,
|
|
370
|
-
},
|
|
371
|
-
},
|
|
372
|
-
);
|
|
373
|
-
|
|
374
|
-
return data.createApprovalTemplate.id;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
export async function createApprovalTemplateCategory({
|
|
378
|
-
description,
|
|
379
|
-
isActive,
|
|
380
|
-
name,
|
|
381
|
-
sortOrder,
|
|
382
|
-
}: {
|
|
383
|
-
readonly description: string | null;
|
|
384
|
-
readonly isActive: boolean;
|
|
385
|
-
readonly name: string;
|
|
386
|
-
readonly sortOrder: number;
|
|
387
|
-
}): Promise<ApprovalTemplateCategoryRecord> {
|
|
388
|
-
const data = await requestGraphQl<CreateApprovalTemplateCategoryMutationData>(
|
|
389
|
-
`mutation CreateApprovalTemplateCategory($input: CreateApprovalTemplateCategoryInput!) {
|
|
390
|
-
createApprovalTemplateCategory(input: $input) {
|
|
391
|
-
createdAt
|
|
392
|
-
description
|
|
393
|
-
id
|
|
394
|
-
isActive
|
|
395
|
-
name
|
|
396
|
-
sortOrder
|
|
397
|
-
updatedAt
|
|
398
|
-
}
|
|
399
|
-
}`,
|
|
400
|
-
{ input: { description, isActive, name, sortOrder } },
|
|
401
|
-
);
|
|
402
|
-
|
|
403
|
-
return data.createApprovalTemplateCategory;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
export async function updateApprovalTemplateCategory({
|
|
407
|
-
description,
|
|
408
|
-
id,
|
|
409
|
-
isActive,
|
|
410
|
-
name,
|
|
411
|
-
sortOrder,
|
|
412
|
-
}: {
|
|
413
|
-
readonly description: string | null;
|
|
414
|
-
readonly id: string;
|
|
415
|
-
readonly isActive: boolean;
|
|
416
|
-
readonly name: string;
|
|
417
|
-
readonly sortOrder: number;
|
|
418
|
-
}): Promise<ApprovalTemplateCategoryRecord> {
|
|
419
|
-
const data = await requestGraphQl<UpdateApprovalTemplateCategoryMutationData>(
|
|
420
|
-
`mutation UpdateApprovalTemplateCategory($input: UpdateApprovalTemplateCategoryInput!) {
|
|
421
|
-
updateApprovalTemplateCategory(input: $input) {
|
|
422
|
-
createdAt
|
|
423
|
-
description
|
|
424
|
-
id
|
|
425
|
-
isActive
|
|
426
|
-
name
|
|
427
|
-
sortOrder
|
|
428
|
-
updatedAt
|
|
429
|
-
}
|
|
430
|
-
}`,
|
|
431
|
-
{ input: { description, id, isActive, name, sortOrder } },
|
|
432
|
-
);
|
|
433
|
-
|
|
434
|
-
return data.updateApprovalTemplateCategory;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
export async function deleteApprovalTemplateCategory(
|
|
438
|
-
id: string,
|
|
439
|
-
): Promise<void> {
|
|
440
|
-
await requestGraphQl<DeleteApprovalTemplateCategoryMutationData>(
|
|
441
|
-
`mutation DeleteApprovalTemplateCategory($id: String!) {
|
|
442
|
-
deleteApprovalTemplateCategory(id: $id) {
|
|
443
|
-
id
|
|
444
|
-
}
|
|
445
|
-
}`,
|
|
446
|
-
{ id },
|
|
447
|
-
);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
export async function readTemplateDesigner(
|
|
451
|
-
templateId: string,
|
|
452
|
-
): Promise<TemplateDesignerRecord> {
|
|
453
|
-
const data = await requestGraphQl<TemplateDesignerQueryData>(
|
|
454
|
-
`query TemplateDesigner($id: String!) {
|
|
455
|
-
approvalTemplate(id: $id) {
|
|
456
|
-
category
|
|
457
|
-
categoryId
|
|
458
|
-
categoryDetail {
|
|
459
|
-
id
|
|
460
|
-
isActive
|
|
461
|
-
name
|
|
462
|
-
}
|
|
463
|
-
currentVersionId
|
|
464
|
-
description
|
|
465
|
-
id
|
|
466
|
-
name
|
|
467
|
-
updatedAt
|
|
468
|
-
}
|
|
469
|
-
approvalTemplateVersions(templateId: $id) {
|
|
470
|
-
archivedAt
|
|
471
|
-
formDefinitionVersionId
|
|
472
|
-
id
|
|
473
|
-
initiatorPolicyCel
|
|
474
|
-
notificationConfigJson
|
|
475
|
-
publishedAt
|
|
476
|
-
slaDefaultsJson
|
|
477
|
-
status
|
|
478
|
-
updatedAt
|
|
479
|
-
version
|
|
480
|
-
workflowDefinitionJson
|
|
481
|
-
}
|
|
482
|
-
formDefinitions {
|
|
483
|
-
currentVersionId
|
|
484
|
-
id
|
|
485
|
-
name
|
|
486
|
-
updatedAt
|
|
487
|
-
}
|
|
488
|
-
}`,
|
|
489
|
-
{ id: templateId },
|
|
490
|
-
);
|
|
491
|
-
const formVersionLists = await Promise.all(
|
|
492
|
-
data.formDefinitions.map((definition) =>
|
|
493
|
-
readFormDefinitionVersions(definition.id),
|
|
494
|
-
),
|
|
495
|
-
);
|
|
496
|
-
|
|
497
|
-
return {
|
|
498
|
-
formVersions: data.formDefinitions.flatMap((definition, index) =>
|
|
499
|
-
formVersionLists[index]
|
|
500
|
-
.filter((version) => version.status === 'PUBLISHED')
|
|
501
|
-
.map((version) => ({
|
|
502
|
-
formDefinitionId: definition.id,
|
|
503
|
-
formName: definition.name,
|
|
504
|
-
id: version.id,
|
|
505
|
-
label: `${definition.name} v${version.version}`,
|
|
506
|
-
schema: version.schema,
|
|
507
|
-
version: version.version,
|
|
508
|
-
})),
|
|
509
|
-
),
|
|
510
|
-
template: data.approvalTemplate,
|
|
511
|
-
versions: data.approvalTemplateVersions.map(parseVersionJson),
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
export async function searchPublishedFormVersionOptions(
|
|
516
|
-
searchText: string,
|
|
517
|
-
): Promise<readonly PublishedFormVersionOption[]> {
|
|
518
|
-
const data = await requestGraphQl<
|
|
519
|
-
Pick<TemplateDesignerQueryData, 'formDefinitions'>
|
|
520
|
-
>(
|
|
521
|
-
`query PublishedFormVersionOptions {
|
|
522
|
-
formDefinitions {
|
|
523
|
-
currentVersionId
|
|
524
|
-
id
|
|
525
|
-
name
|
|
526
|
-
updatedAt
|
|
527
|
-
}
|
|
528
|
-
}`,
|
|
529
|
-
);
|
|
530
|
-
const normalizedSearchText = searchText.trim().toLocaleLowerCase();
|
|
531
|
-
const matchedDefinitions = data.formDefinitions.filter((definition) =>
|
|
532
|
-
normalizedSearchText
|
|
533
|
-
? definition.name.toLocaleLowerCase().includes(normalizedSearchText)
|
|
534
|
-
: true,
|
|
535
|
-
);
|
|
536
|
-
const formVersionLists = await Promise.all(
|
|
537
|
-
matchedDefinitions.map((definition) =>
|
|
538
|
-
readFormDefinitionVersions(definition.id),
|
|
539
|
-
),
|
|
540
|
-
);
|
|
541
|
-
|
|
542
|
-
return matchedDefinitions.flatMap((definition, index) =>
|
|
543
|
-
formVersionLists[index]
|
|
544
|
-
.filter((version) => version.status === 'PUBLISHED')
|
|
545
|
-
.map((version) => ({
|
|
546
|
-
formDefinitionId: definition.id,
|
|
547
|
-
formName: definition.name,
|
|
548
|
-
id: version.id,
|
|
549
|
-
label: `${definition.name} v${version.version}`,
|
|
550
|
-
schema: version.schema,
|
|
551
|
-
version: version.version,
|
|
552
|
-
})),
|
|
553
|
-
);
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
export async function resolveMemberOptions(
|
|
557
|
-
memberIds: readonly string[],
|
|
558
|
-
): Promise<readonly MemberProfileRecord[]> {
|
|
559
|
-
if (memberIds.length === 0) {
|
|
560
|
-
return [];
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
const data = await requestGraphQl<MembersQueryData>(
|
|
564
|
-
`query SelectedMembers($memberIds: [String!]!) {
|
|
565
|
-
members(memberIds: $memberIds) {
|
|
566
|
-
email
|
|
567
|
-
memberId
|
|
568
|
-
name
|
|
569
|
-
}
|
|
570
|
-
}`,
|
|
571
|
-
{ memberIds },
|
|
572
|
-
);
|
|
573
|
-
|
|
574
|
-
return data.members;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
export async function searchMemberOptions(
|
|
578
|
-
searchText: string,
|
|
579
|
-
): Promise<readonly MemberProfileRecord[]> {
|
|
580
|
-
const data = await requestGraphQl<SearchMembersQueryData>(
|
|
581
|
-
`query MemberOptions($searchText: String!) {
|
|
582
|
-
searchMembers(searchText: $searchText) {
|
|
583
|
-
email
|
|
584
|
-
memberId
|
|
585
|
-
name
|
|
586
|
-
}
|
|
587
|
-
}`,
|
|
588
|
-
{ searchText },
|
|
589
|
-
);
|
|
590
|
-
|
|
591
|
-
return data.searchMembers;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
export async function updateApprovalTemplateDraft({
|
|
595
|
-
formDefinitionVersionId,
|
|
596
|
-
initiatorPolicyCel,
|
|
597
|
-
versionId,
|
|
598
|
-
workflowDefinition,
|
|
599
|
-
}: {
|
|
600
|
-
readonly formDefinitionVersionId: string | null;
|
|
601
|
-
readonly initiatorPolicyCel: string | null;
|
|
602
|
-
readonly versionId: string;
|
|
603
|
-
readonly workflowDefinition: WorkflowDefinition;
|
|
604
|
-
}): Promise<ApprovalTemplateVersionRecord> {
|
|
605
|
-
const data = await requestGraphQl<UpdateTemplateDraftMutationData>(
|
|
606
|
-
`mutation UpdateApprovalTemplateDraft($input: UpdateApprovalTemplateDraftInput!) {
|
|
607
|
-
updateApprovalTemplateDraft(input: $input) {
|
|
608
|
-
archivedAt
|
|
609
|
-
formDefinitionVersionId
|
|
610
|
-
id
|
|
611
|
-
initiatorPolicyCel
|
|
612
|
-
notificationConfigJson
|
|
613
|
-
publishedAt
|
|
614
|
-
slaDefaultsJson
|
|
615
|
-
status
|
|
616
|
-
updatedAt
|
|
617
|
-
version
|
|
618
|
-
workflowDefinitionJson
|
|
619
|
-
}
|
|
620
|
-
}`,
|
|
621
|
-
{
|
|
622
|
-
input: {
|
|
623
|
-
formDefinitionVersionId,
|
|
624
|
-
initiatorPolicyCel,
|
|
625
|
-
notificationConfigJson: null,
|
|
626
|
-
slaDefaultsJson: null,
|
|
627
|
-
versionId,
|
|
628
|
-
workflowDefinitionJson: JSON.stringify(workflowDefinition),
|
|
629
|
-
},
|
|
630
|
-
},
|
|
631
|
-
);
|
|
632
|
-
|
|
633
|
-
return parseVersionJson(data.updateApprovalTemplateDraft);
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
export async function forkApprovalTemplate(
|
|
637
|
-
templateId: string,
|
|
638
|
-
): Promise<ApprovalTemplateVersionRecord> {
|
|
639
|
-
const data = await requestGraphQl<ForkTemplateMutationData>(
|
|
640
|
-
`mutation ForkApprovalTemplate($templateId: String!) {
|
|
641
|
-
forkApprovalTemplate(templateId: $templateId) {
|
|
642
|
-
archivedAt
|
|
643
|
-
formDefinitionVersionId
|
|
644
|
-
id
|
|
645
|
-
initiatorPolicyCel
|
|
646
|
-
notificationConfigJson
|
|
647
|
-
publishedAt
|
|
648
|
-
slaDefaultsJson
|
|
649
|
-
status
|
|
650
|
-
updatedAt
|
|
651
|
-
version
|
|
652
|
-
workflowDefinitionJson
|
|
653
|
-
}
|
|
654
|
-
}`,
|
|
655
|
-
{ templateId },
|
|
656
|
-
);
|
|
657
|
-
|
|
658
|
-
return parseVersionJson(data.forkApprovalTemplate);
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
export async function publishApprovalTemplateVersion(
|
|
662
|
-
versionId: string,
|
|
663
|
-
): Promise<ApprovalTemplateVersionRecord> {
|
|
664
|
-
const data = await requestGraphQl<PublishTemplateVersionMutationData>(
|
|
665
|
-
`mutation PublishApprovalTemplateVersion($versionId: String!) {
|
|
666
|
-
publishApprovalTemplateVersion(versionId: $versionId) {
|
|
667
|
-
archivedAt
|
|
668
|
-
formDefinitionVersionId
|
|
669
|
-
id
|
|
670
|
-
initiatorPolicyCel
|
|
671
|
-
notificationConfigJson
|
|
672
|
-
publishedAt
|
|
673
|
-
slaDefaultsJson
|
|
674
|
-
status
|
|
675
|
-
updatedAt
|
|
676
|
-
version
|
|
677
|
-
workflowDefinitionJson
|
|
678
|
-
}
|
|
679
|
-
}`,
|
|
680
|
-
{ versionId },
|
|
681
|
-
);
|
|
682
|
-
|
|
683
|
-
return parseVersionJson(data.publishApprovalTemplateVersion);
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
export async function rollbackApprovalTemplateVersion(
|
|
687
|
-
versionId: string,
|
|
688
|
-
): Promise<ApprovalTemplateVersionRecord> {
|
|
689
|
-
const data = await requestGraphQl<RollbackTemplateVersionMutationData>(
|
|
690
|
-
`mutation RollbackApprovalTemplateVersion($versionId: String!) {
|
|
691
|
-
rollbackApprovalTemplateVersion(versionId: $versionId) {
|
|
692
|
-
archivedAt
|
|
693
|
-
formDefinitionVersionId
|
|
694
|
-
id
|
|
695
|
-
initiatorPolicyCel
|
|
696
|
-
notificationConfigJson
|
|
697
|
-
publishedAt
|
|
698
|
-
slaDefaultsJson
|
|
699
|
-
status
|
|
700
|
-
updatedAt
|
|
701
|
-
version
|
|
702
|
-
workflowDefinitionJson
|
|
703
|
-
}
|
|
704
|
-
}`,
|
|
705
|
-
{ versionId },
|
|
706
|
-
);
|
|
707
|
-
|
|
708
|
-
return parseVersionJson(data.rollbackApprovalTemplateVersion);
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
export async function dryRunApprovalWorkflow({
|
|
712
|
-
formData,
|
|
713
|
-
initiatorMemberId,
|
|
714
|
-
initiatorMetadataSnapshot,
|
|
715
|
-
workflowDefinition,
|
|
716
|
-
}: {
|
|
717
|
-
readonly formData: Readonly<Record<string, unknown>>;
|
|
718
|
-
readonly initiatorMemberId: string;
|
|
719
|
-
readonly initiatorMetadataSnapshot: Readonly<Record<string, unknown>> | null;
|
|
720
|
-
readonly workflowDefinition: WorkflowDefinition;
|
|
721
|
-
}): Promise<WorkflowDryRunResultRecord> {
|
|
722
|
-
const data = await requestGraphQl<DryRunApprovalWorkflowMutationData>(
|
|
723
|
-
`mutation DryRunApprovalWorkflow($input: DryRunApprovalWorkflowInput!) {
|
|
724
|
-
dryRunApprovalWorkflow(input: $input) {
|
|
725
|
-
errors
|
|
726
|
-
valid
|
|
727
|
-
steps {
|
|
728
|
-
assigneeMemberId
|
|
729
|
-
edgeDefault
|
|
730
|
-
edgeId
|
|
731
|
-
edgeLabel
|
|
732
|
-
edgeMatched
|
|
733
|
-
edgeReason
|
|
734
|
-
entryCondition
|
|
735
|
-
entryConditionMatched
|
|
736
|
-
id
|
|
737
|
-
message
|
|
738
|
-
nodeId
|
|
739
|
-
nodeLabel
|
|
740
|
-
nodeType
|
|
741
|
-
status
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
}`,
|
|
745
|
-
{
|
|
746
|
-
input: {
|
|
747
|
-
formDataJson: JSON.stringify(formData),
|
|
748
|
-
initiatorMemberId,
|
|
749
|
-
initiatorMetadataSnapshotJson: initiatorMetadataSnapshot
|
|
750
|
-
? JSON.stringify(initiatorMetadataSnapshot)
|
|
751
|
-
: null,
|
|
752
|
-
workflowDefinitionJson: JSON.stringify(workflowDefinition),
|
|
753
|
-
},
|
|
754
|
-
},
|
|
755
|
-
);
|
|
756
|
-
|
|
757
|
-
return data.dryRunApprovalWorkflow;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
export async function composeApprovalTemplateWithForm({
|
|
761
|
-
category,
|
|
762
|
-
categoryId,
|
|
763
|
-
formDefinitionId,
|
|
764
|
-
formDescription,
|
|
765
|
-
formName,
|
|
766
|
-
initiatorPolicyCel,
|
|
767
|
-
notificationConfig,
|
|
768
|
-
publish,
|
|
769
|
-
schema,
|
|
770
|
-
slaDefaults,
|
|
771
|
-
templateDescription,
|
|
772
|
-
templateId,
|
|
773
|
-
templateName,
|
|
774
|
-
uiSchema,
|
|
775
|
-
workflowDefinition,
|
|
776
|
-
}: {
|
|
777
|
-
readonly category: string | null;
|
|
778
|
-
readonly categoryId: string | null;
|
|
779
|
-
readonly formDefinitionId: string | null;
|
|
780
|
-
readonly formDescription: string | null;
|
|
781
|
-
readonly formName: string;
|
|
782
|
-
readonly initiatorPolicyCel: string | null;
|
|
783
|
-
readonly notificationConfig: Readonly<Record<string, unknown>> | null;
|
|
784
|
-
readonly publish: boolean;
|
|
785
|
-
readonly schema: FormDefinitionSchema;
|
|
786
|
-
readonly slaDefaults: Readonly<Record<string, unknown>> | null;
|
|
787
|
-
readonly templateDescription: string | null;
|
|
788
|
-
readonly templateId: string | null;
|
|
789
|
-
readonly templateName: string;
|
|
790
|
-
readonly uiSchema: FormUiSchema;
|
|
791
|
-
readonly workflowDefinition: WorkflowDefinition;
|
|
792
|
-
}): Promise<ComposeApprovalTemplateWithFormResult> {
|
|
793
|
-
const data = await requestGraphQl<ComposeApprovalTemplateWithFormMutationData>(
|
|
794
|
-
`mutation ComposeApprovalTemplateWithForm($input: ComposeApprovalTemplateWithFormInput!) {
|
|
795
|
-
composeApprovalTemplateWithForm(input: $input) {
|
|
796
|
-
formDefinition {
|
|
797
|
-
currentVersionId
|
|
798
|
-
id
|
|
799
|
-
}
|
|
800
|
-
formDefinitionVersion {
|
|
801
|
-
id
|
|
802
|
-
status
|
|
803
|
-
version
|
|
804
|
-
}
|
|
805
|
-
published
|
|
806
|
-
template {
|
|
807
|
-
currentVersionId
|
|
808
|
-
id
|
|
809
|
-
}
|
|
810
|
-
templateVersion {
|
|
811
|
-
archivedAt
|
|
812
|
-
formDefinitionVersionId
|
|
813
|
-
id
|
|
814
|
-
initiatorPolicyCel
|
|
815
|
-
notificationConfigJson
|
|
816
|
-
publishedAt
|
|
817
|
-
slaDefaultsJson
|
|
818
|
-
status
|
|
819
|
-
updatedAt
|
|
820
|
-
version
|
|
821
|
-
workflowDefinitionJson
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}`,
|
|
825
|
-
{
|
|
826
|
-
input: {
|
|
827
|
-
category,
|
|
828
|
-
categoryId,
|
|
829
|
-
formDefinitionId,
|
|
830
|
-
formDescription,
|
|
831
|
-
formName,
|
|
832
|
-
initiatorPolicyCel,
|
|
833
|
-
notificationConfigJson: notificationConfig
|
|
834
|
-
? JSON.stringify(notificationConfig)
|
|
835
|
-
: null,
|
|
836
|
-
publish,
|
|
837
|
-
schemaJson: JSON.stringify(schema),
|
|
838
|
-
slaDefaultsJson: slaDefaults ? JSON.stringify(slaDefaults) : null,
|
|
839
|
-
templateDescription,
|
|
840
|
-
templateId,
|
|
841
|
-
templateName,
|
|
842
|
-
uiSchemaJson: JSON.stringify(uiSchema),
|
|
843
|
-
workflowDefinitionJson: JSON.stringify(workflowDefinition),
|
|
844
|
-
},
|
|
845
|
-
},
|
|
846
|
-
);
|
|
847
|
-
const result = data.composeApprovalTemplateWithForm;
|
|
848
|
-
|
|
849
|
-
return {
|
|
850
|
-
formDefinitionId: result.formDefinition.id,
|
|
851
|
-
formDefinitionVersionId: result.formDefinitionVersion.id,
|
|
852
|
-
published: result.published,
|
|
853
|
-
templateId: result.template.id,
|
|
854
|
-
templateVersion: parseVersionJson(result.templateVersion),
|
|
855
|
-
};
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
async function readFormDefinitionVersions(
|
|
859
|
-
formDefinitionId: string,
|
|
860
|
-
): Promise<readonly FormDefinitionVersionRecord[]> {
|
|
861
|
-
const data = await requestGraphQl<FormVersionsQueryData>(
|
|
862
|
-
`query FormVersions($formDefinitionId: String!) {
|
|
863
|
-
formDefinitionVersions(formDefinitionId: $formDefinitionId) {
|
|
864
|
-
formDefinitionId
|
|
865
|
-
id
|
|
866
|
-
publishedAt
|
|
867
|
-
schemaJson
|
|
868
|
-
status
|
|
869
|
-
version
|
|
870
|
-
}
|
|
871
|
-
}`,
|
|
872
|
-
{ formDefinitionId },
|
|
873
|
-
);
|
|
874
|
-
|
|
875
|
-
return data.formDefinitionVersions.map((version) => ({
|
|
876
|
-
...version,
|
|
877
|
-
schema: parseFormDefinitionSchema(version.schemaJson),
|
|
878
|
-
}));
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
function parseVersionJson(
|
|
882
|
-
version: VersionJsonRecord,
|
|
883
|
-
): ApprovalTemplateVersionRecord {
|
|
884
|
-
return {
|
|
885
|
-
...version,
|
|
886
|
-
workflowDefinition: JSON.parse(
|
|
887
|
-
version.workflowDefinitionJson,
|
|
888
|
-
) as WorkflowDefinition,
|
|
889
|
-
};
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
function parseFormDefinitionSchema(schemaJson: string): FormDefinitionSchema {
|
|
893
|
-
return JSON.parse(schemaJson) as FormDefinitionSchema;
|
|
894
|
-
}
|