@kissflow/lowcode-client-sdk 1.0.36 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +538 -5
- package/dist/kf.lowcodeworkersdk.es.js +429 -16
- package/dist/kf.nocodeworkersdk.es.js +39 -1
- package/dist/kfsdk.es.js +428 -16
- package/dist/kfsdk.umd.js +1 -1
- package/dist/lowcode.d.ts +538 -5
- package/dist/lowcode.types.d.ts +540 -5
- package/dist/nocode.d.ts +546 -13
- package/dist/nocode.types.d.ts +215 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -50,9 +50,46 @@ declare module "core/constants" {
|
|
|
50
50
|
DECISION_TABLE_EXECUTE: string;
|
|
51
51
|
DATAFORM_IMPORT_CSV: string;
|
|
52
52
|
DATAFORM_OPEN_FORM: string;
|
|
53
|
+
DATAFORM_GET_FIELDS: string;
|
|
54
|
+
DATAFORM_GET_ITEMS: string;
|
|
55
|
+
DATAFORM_CREATE_ITEM: string;
|
|
56
|
+
DATAFORM_UPDATE_ITEM: string;
|
|
57
|
+
DATAFORM_GET_ITEM: string;
|
|
58
|
+
DATAFORM_DELETE_ITEM: string;
|
|
59
|
+
DATAFORM_DISCARD_ITEM: string;
|
|
60
|
+
DATAFORM_SUBMIT_ITEM: string;
|
|
53
61
|
PROCESS_OPEN_FORM: string;
|
|
62
|
+
PROCESS_GET_FIELDS: string;
|
|
63
|
+
PROCESS_GET_MYTASK_FIELDS: string;
|
|
64
|
+
PROCESS_GET_PARTICIPATED_FIELDS: string;
|
|
65
|
+
PROCESS_GET_MY_ITEMS_FIELDS: string;
|
|
66
|
+
PROCESS_GET_MY_ITEMS: string;
|
|
67
|
+
PROCESS_GET_MY_TASKS_ITEMS: string;
|
|
68
|
+
PROCESS_GET_PARTICIPATED_ITEMS: string;
|
|
69
|
+
PROCESS_GET_ADMIN_ITEMS: string;
|
|
70
|
+
PROCESS_CREATE_ITEM: string;
|
|
71
|
+
PROCESS_UPDATE_ITEM: string;
|
|
72
|
+
PROCESS_GET_ITEM: string;
|
|
73
|
+
PROCESS_DELETE_ITEM: string;
|
|
74
|
+
PROCESS_SUBMIT_ITEM: string;
|
|
75
|
+
PROCESS_REJECT_ITEM: string;
|
|
76
|
+
PROCESS_WITHDRAW_ITEM: string;
|
|
77
|
+
PROCESS_SENDBACK_ITEM: string;
|
|
78
|
+
PROCESS_REASSIGN_ITEM: string;
|
|
79
|
+
PROCESS_GET_REASSIGNEES: string;
|
|
80
|
+
PROCESS_RESTART_ITEM: string;
|
|
81
|
+
PROCESS_DISCARD_ITEM: string;
|
|
82
|
+
PROCESS_GET_PROGRESS: string;
|
|
54
83
|
BOARD_IMPORT_CSV: string;
|
|
55
84
|
BOARD_OPEN_FORM: string;
|
|
85
|
+
BOARD_GET_FIELDS: string;
|
|
86
|
+
BOARD_GET_ITEMS: string;
|
|
87
|
+
BOARD_CREATE_ITEM: string;
|
|
88
|
+
BOARD_UPDATE_ITEM: string;
|
|
89
|
+
BOARD_GET_ITEM: string;
|
|
90
|
+
BOARD_DELETE_ITEM: string;
|
|
91
|
+
BOARD_SUBMIT_ITEM: string;
|
|
92
|
+
BOARD_DISCARD_ITEM: string;
|
|
56
93
|
};
|
|
57
94
|
export const EVENT_TYPES: {
|
|
58
95
|
COMPONENT_ON_MOUNT: string;
|
|
@@ -103,9 +140,32 @@ declare module "utils/formatter" {
|
|
|
103
140
|
toBoolean(value: string): any;
|
|
104
141
|
}
|
|
105
142
|
}
|
|
143
|
+
declare module "utils/validation" {
|
|
144
|
+
/**
|
|
145
|
+
* Validation utilities for SDK methods
|
|
146
|
+
*/
|
|
147
|
+
/**
|
|
148
|
+
* Throws error if value is falsy
|
|
149
|
+
*/
|
|
150
|
+
export function requireField(value: any, fieldName: string): void;
|
|
151
|
+
/**
|
|
152
|
+
* Returns a rejected promise if value is falsy, null otherwise
|
|
153
|
+
* Use for async validation in SDK methods
|
|
154
|
+
*/
|
|
155
|
+
export function requireFieldAsync(value: any, fieldName: string): Promise<never> | null;
|
|
156
|
+
/**
|
|
157
|
+
* Returns a rejected promise if any of the values are falsy
|
|
158
|
+
* Use for validating multiple required fields
|
|
159
|
+
*/
|
|
160
|
+
export function requireFieldsAsync(fields: Array<{
|
|
161
|
+
value: any;
|
|
162
|
+
name: string;
|
|
163
|
+
}>): Promise<never> | null;
|
|
164
|
+
}
|
|
106
165
|
declare module "utils/index" {
|
|
107
166
|
export * from "utils/client";
|
|
108
167
|
export * from "utils/formatter";
|
|
168
|
+
export * from "utils/validation";
|
|
109
169
|
export const isObject: (value: any) => boolean;
|
|
110
170
|
}
|
|
111
171
|
declare module "core/proxy" {
|
|
@@ -118,6 +178,32 @@ declare module "core/proxy" {
|
|
|
118
178
|
}
|
|
119
179
|
}
|
|
120
180
|
declare module "types/external" {
|
|
181
|
+
export type QueryResponse = {
|
|
182
|
+
items: any[];
|
|
183
|
+
total: number;
|
|
184
|
+
page?: number;
|
|
185
|
+
pageSize?: number;
|
|
186
|
+
};
|
|
187
|
+
export type BaseQueryOptions = {
|
|
188
|
+
searchValue?: string;
|
|
189
|
+
pageNumber?: number;
|
|
190
|
+
pageSize?: number;
|
|
191
|
+
};
|
|
192
|
+
export type PayloadSortItem = {
|
|
193
|
+
Id: string;
|
|
194
|
+
SortType: "ASC" | "DESC";
|
|
195
|
+
};
|
|
196
|
+
export type PayloadOptions = {
|
|
197
|
+
Columns?: any[];
|
|
198
|
+
Filters?: any;
|
|
199
|
+
Sort?: PayloadSortItem[];
|
|
200
|
+
FilterParam?: any;
|
|
201
|
+
};
|
|
202
|
+
export type ProcessPayloadOptions = {
|
|
203
|
+
Columns?: any[];
|
|
204
|
+
Filters?: any;
|
|
205
|
+
Sort?: PayloadSortItem[];
|
|
206
|
+
};
|
|
121
207
|
export type userObject = {
|
|
122
208
|
_id: string;
|
|
123
209
|
Name: string;
|
|
@@ -147,11 +233,138 @@ declare module "types/external" {
|
|
|
147
233
|
_id: string;
|
|
148
234
|
_activity_instance_id: string;
|
|
149
235
|
};
|
|
236
|
+
export type ProcessMyItemsOptions = BaseQueryOptions & {
|
|
237
|
+
status?: "draft" | "inprogress" | "completed" | "withdrawn" | "rejected" | "all";
|
|
238
|
+
payload?: ProcessPayloadOptions;
|
|
239
|
+
};
|
|
240
|
+
export type ProcessMyTasksOptions = BaseQueryOptions & {
|
|
241
|
+
activityId?: string;
|
|
242
|
+
payload?: ProcessPayloadOptions;
|
|
243
|
+
};
|
|
244
|
+
export type ProcessParticipatedOptions = BaseQueryOptions & {
|
|
245
|
+
activityId?: string;
|
|
246
|
+
payload?: ProcessPayloadOptions;
|
|
247
|
+
};
|
|
248
|
+
export type ProcessAdminOptions = BaseQueryOptions & {
|
|
249
|
+
payload?: ProcessPayloadOptions;
|
|
250
|
+
};
|
|
251
|
+
export type ProcessQueryResponse = QueryResponse;
|
|
252
|
+
export type ProcessGetItemOptions = {
|
|
253
|
+
instanceId: string;
|
|
254
|
+
};
|
|
255
|
+
export type ProcessCreateItemOptions = {
|
|
256
|
+
data?: object;
|
|
257
|
+
};
|
|
258
|
+
export type ProcessUpdateItemOptions = {
|
|
259
|
+
instanceId: string;
|
|
260
|
+
activityInstanceId: string;
|
|
261
|
+
data: object;
|
|
262
|
+
};
|
|
263
|
+
export type ProcessDeleteItemOptions = {
|
|
264
|
+
instanceId: string;
|
|
265
|
+
};
|
|
266
|
+
export type ProcessSubmitItemOptions = {
|
|
267
|
+
instanceId: string;
|
|
268
|
+
activityInstanceId: string;
|
|
269
|
+
comment?: string;
|
|
270
|
+
};
|
|
271
|
+
export type ProcessRejectItemOptions = {
|
|
272
|
+
instanceId: string;
|
|
273
|
+
activityInstanceId: string;
|
|
274
|
+
comment: string;
|
|
275
|
+
};
|
|
276
|
+
export type ProcessWithdrawItemOptions = {
|
|
277
|
+
instanceId: string;
|
|
278
|
+
comment?: string;
|
|
279
|
+
};
|
|
280
|
+
export type ProcessSendbackItemOptions = {
|
|
281
|
+
instanceId: string;
|
|
282
|
+
activityInstanceId: string;
|
|
283
|
+
stepId: string;
|
|
284
|
+
comment: string;
|
|
285
|
+
};
|
|
286
|
+
export type ProcessReassignItemOptions = {
|
|
287
|
+
instanceId: string;
|
|
288
|
+
activityInstanceId: string;
|
|
289
|
+
reassignTo: object;
|
|
290
|
+
comment: string;
|
|
291
|
+
reassignType?: "initiator" | "approver" | "admin";
|
|
292
|
+
reassignedFrom?: object[];
|
|
293
|
+
};
|
|
294
|
+
export type ProcessGetReassigneesOptions = {
|
|
295
|
+
instanceId: string;
|
|
296
|
+
activityInstanceId: string;
|
|
297
|
+
pageNumber?: number;
|
|
298
|
+
pageSize?: number;
|
|
299
|
+
query?: string;
|
|
300
|
+
};
|
|
301
|
+
export type ProcessRestartItemOptions = {
|
|
302
|
+
instanceId: string;
|
|
303
|
+
activityInstanceId: string;
|
|
304
|
+
};
|
|
305
|
+
export type ProcessDiscardItemOptions = {
|
|
306
|
+
instanceId: string;
|
|
307
|
+
};
|
|
150
308
|
export type FetchOptions = {
|
|
151
309
|
method?: string;
|
|
152
310
|
body?: string | object;
|
|
153
311
|
headers?: object;
|
|
154
312
|
};
|
|
313
|
+
export type DataformQueryOptions = BaseQueryOptions & {
|
|
314
|
+
viewId?: string;
|
|
315
|
+
payload?: PayloadOptions;
|
|
316
|
+
};
|
|
317
|
+
export type DataformQueryResponse = QueryResponse;
|
|
318
|
+
export type DataformCreateItemOptions = {
|
|
319
|
+
data?: object;
|
|
320
|
+
viewId?: string;
|
|
321
|
+
};
|
|
322
|
+
export type DataformUpdateItemOptions = {
|
|
323
|
+
itemId: string;
|
|
324
|
+
data: object;
|
|
325
|
+
viewId?: string;
|
|
326
|
+
};
|
|
327
|
+
export type DataformGetItemOptions = {
|
|
328
|
+
itemId: string;
|
|
329
|
+
viewId?: string;
|
|
330
|
+
};
|
|
331
|
+
export type DataformDeleteItemOptions = {
|
|
332
|
+
itemId: string;
|
|
333
|
+
viewId?: string;
|
|
334
|
+
};
|
|
335
|
+
export type DataformDiscardItemOptions = {
|
|
336
|
+
viewId?: string;
|
|
337
|
+
};
|
|
338
|
+
export type DataformSubmitItemOptions = {
|
|
339
|
+
itemId: string;
|
|
340
|
+
data?: object;
|
|
341
|
+
viewId?: string;
|
|
342
|
+
};
|
|
343
|
+
export type BoardGetItemsOptions = BaseQueryOptions & {
|
|
344
|
+
viewId?: string;
|
|
345
|
+
payload?: PayloadOptions;
|
|
346
|
+
};
|
|
347
|
+
export type BoardQueryResponse = QueryResponse;
|
|
348
|
+
export type BoardGetItemOptions = {
|
|
349
|
+
instanceId: string;
|
|
350
|
+
};
|
|
351
|
+
export type BoardCreateItemOptions = {
|
|
352
|
+
data?: object;
|
|
353
|
+
};
|
|
354
|
+
export type BoardUpdateItemOptions = {
|
|
355
|
+
instanceId: string;
|
|
356
|
+
data: object;
|
|
357
|
+
};
|
|
358
|
+
export type BoardDeleteItemOptions = {
|
|
359
|
+
instanceId: string;
|
|
360
|
+
};
|
|
361
|
+
export type BoardSubmitItemOptions = {
|
|
362
|
+
instanceId: string;
|
|
363
|
+
comment?: string;
|
|
364
|
+
};
|
|
365
|
+
export type BoardDiscardItemOptions = {
|
|
366
|
+
instanceId: string;
|
|
367
|
+
};
|
|
155
368
|
}
|
|
156
369
|
declare module "types/internal" {
|
|
157
370
|
import { userObject, accountObject, environmentObject } from "types/external";
|
|
@@ -251,33 +464,353 @@ declare module "app/decisiontable" {
|
|
|
251
464
|
evaluate(payload?: object): any;
|
|
252
465
|
}
|
|
253
466
|
}
|
|
254
|
-
declare module "
|
|
467
|
+
declare module "dataform/index" {
|
|
255
468
|
import { BaseSDK } from "core/index";
|
|
256
|
-
import { DataformItem } from "types/external";
|
|
469
|
+
import { DataformItem, DataformQueryOptions, DataformQueryResponse, DataformCreateItemOptions, DataformUpdateItemOptions, DataformGetItemOptions, DataformDeleteItemOptions, DataformDiscardItemOptions, DataformSubmitItemOptions } from "types/external";
|
|
257
470
|
export class Dataform extends BaseSDK {
|
|
258
471
|
private _id;
|
|
259
472
|
constructor(flowId: string);
|
|
473
|
+
/**
|
|
474
|
+
* Get all items from this dataform with optional filtering, sorting, and pagination
|
|
475
|
+
* @param options - Query options (searchValue, pageNumber, pageSize, payload)
|
|
476
|
+
* @returns Promise containing items and total count
|
|
477
|
+
*/
|
|
478
|
+
getItems(options?: DataformQueryOptions): Promise<DataformQueryResponse>;
|
|
479
|
+
/**
|
|
480
|
+
* Get a single item by ID from this dataform
|
|
481
|
+
* @param options - itemId (required), optional viewId
|
|
482
|
+
* @returns Promise containing the item data
|
|
483
|
+
*/
|
|
484
|
+
getItem(options: DataformGetItemOptions): Promise<DataformItem>;
|
|
485
|
+
/**
|
|
486
|
+
* Create a new item in this dataform
|
|
487
|
+
* @param options - Creation options (data: initial field values, viewId: optional view ID)
|
|
488
|
+
* @returns Promise containing the newly created item with _id
|
|
489
|
+
*/
|
|
490
|
+
createItem(options?: DataformCreateItemOptions): Promise<DataformItem>;
|
|
491
|
+
/**
|
|
492
|
+
* Update an existing item in this dataform
|
|
493
|
+
* @param options - Update options (itemId: required, data: required updated values, viewId: optional view ID)
|
|
494
|
+
* @returns Promise containing the updated item
|
|
495
|
+
*/
|
|
496
|
+
updateItem(options: DataformUpdateItemOptions): Promise<DataformItem>;
|
|
497
|
+
/**
|
|
498
|
+
* Import items from a CSV file into this dataform
|
|
499
|
+
* @param defaultValues - Optional default field values to apply to all imported items
|
|
500
|
+
*/
|
|
260
501
|
importCSV(defaultValues?: object): any;
|
|
502
|
+
/**
|
|
503
|
+
* Open the form UI for an existing dataform item
|
|
504
|
+
* @param item - Dataform item with _id
|
|
505
|
+
*/
|
|
261
506
|
openForm(item: DataformItem): any;
|
|
507
|
+
/**
|
|
508
|
+
* Delete an item from this dataform
|
|
509
|
+
* @param options - itemId (required), optional viewId
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
* await dataform.deleteItem({ itemId: "item_123" });
|
|
513
|
+
*/
|
|
514
|
+
deleteItem(options: DataformDeleteItemOptions): Promise<void>;
|
|
515
|
+
/**
|
|
516
|
+
* Discard the current draft for this dataform
|
|
517
|
+
* @param options - optional viewId
|
|
518
|
+
*
|
|
519
|
+
* @example
|
|
520
|
+
* await dataform.discardItem();
|
|
521
|
+
*/
|
|
522
|
+
discardItem(options?: DataformDiscardItemOptions): Promise<void>;
|
|
523
|
+
/**
|
|
524
|
+
* Submit/finalize a dataform item
|
|
525
|
+
* @param options - itemId (required), optional data and viewId
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* await dataform.submitItem({ itemId: "item_123" });
|
|
529
|
+
*/
|
|
530
|
+
submitItem(options: DataformSubmitItemOptions): Promise<void>;
|
|
531
|
+
/**
|
|
532
|
+
* Get field definitions for this dataform
|
|
533
|
+
* @param options - Optional viewId to scope fields to a specific view
|
|
534
|
+
*/
|
|
535
|
+
getFields(options?: {
|
|
536
|
+
viewId?: string;
|
|
537
|
+
}): Promise<any>;
|
|
262
538
|
}
|
|
263
539
|
}
|
|
264
540
|
declare module "board/index" {
|
|
265
541
|
import { BaseSDK } from "core/index";
|
|
266
|
-
import { BoardItem } from "types/external";
|
|
542
|
+
import { BoardItem, BoardGetItemOptions, BoardGetItemsOptions, BoardQueryResponse, BoardCreateItemOptions, BoardUpdateItemOptions, BoardDeleteItemOptions, BoardSubmitItemOptions, BoardDiscardItemOptions } from "types/external";
|
|
267
543
|
export class Board extends BaseSDK {
|
|
268
544
|
private _id;
|
|
269
545
|
constructor(flowId: string);
|
|
546
|
+
/**
|
|
547
|
+
* Import data from CSV file
|
|
548
|
+
* @param defaultValues - Optional default values to apply to imported items
|
|
549
|
+
*/
|
|
270
550
|
importCSV(defaultValues?: object): any;
|
|
551
|
+
/**
|
|
552
|
+
* Open the form UI for a board item
|
|
553
|
+
* @param item - Board item with _id and optional _view_id
|
|
554
|
+
*/
|
|
271
555
|
openForm(item: BoardItem): any;
|
|
556
|
+
/**
|
|
557
|
+
* Get items from a board view
|
|
558
|
+
* @param options - Query options (viewId, searchValue, pageNumber, pageSize, payload)
|
|
559
|
+
* @returns Promise containing items array and total count
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
* const board = kf.app.getBoard("Inventory");
|
|
563
|
+
* const { items } = await board.getItems({ viewId: "AllItems_View" });
|
|
564
|
+
*/
|
|
565
|
+
getItems(options?: BoardGetItemsOptions): Promise<BoardQueryResponse>;
|
|
566
|
+
/**
|
|
567
|
+
* Get a single board/case item by instance ID
|
|
568
|
+
* @param options - instanceId (required)
|
|
569
|
+
* @returns Promise containing the item data
|
|
570
|
+
*/
|
|
571
|
+
getItem(options: BoardGetItemOptions): Promise<BoardItem>;
|
|
572
|
+
/**
|
|
573
|
+
* Create a new board item
|
|
574
|
+
* @param options - Creation options (data: initial field values)
|
|
575
|
+
* @returns Promise containing the newly created item with _id
|
|
576
|
+
*
|
|
577
|
+
* @example
|
|
578
|
+
* const board = kf.app.getBoard("Inventory");
|
|
579
|
+
* const item = await board.createItem({ data: { Name: "New Item" } });
|
|
580
|
+
*/
|
|
581
|
+
createItem(options?: BoardCreateItemOptions): Promise<BoardItem>;
|
|
582
|
+
/**
|
|
583
|
+
* Update an existing board item
|
|
584
|
+
* @param options - Update options (instanceId, data)
|
|
585
|
+
* @returns Promise containing the updated item
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* const board = kf.app.getBoard("Inventory");
|
|
589
|
+
* await board.updateItem({
|
|
590
|
+
* instanceId: "item_123",
|
|
591
|
+
* data: { Name: "Updated Item" }
|
|
592
|
+
* });
|
|
593
|
+
*/
|
|
594
|
+
updateItem(options: BoardUpdateItemOptions): Promise<BoardItem>;
|
|
595
|
+
/**
|
|
596
|
+
* Delete a board item
|
|
597
|
+
* @param options - Delete options (instanceId)
|
|
598
|
+
* @returns Promise resolving on successful deletion
|
|
599
|
+
*
|
|
600
|
+
* @example
|
|
601
|
+
* const board = kf.app.getBoard("Inventory");
|
|
602
|
+
* await board.deleteItem({ instanceId: "item_123" });
|
|
603
|
+
*/
|
|
604
|
+
deleteItem(options: BoardDeleteItemOptions): Promise<void>;
|
|
605
|
+
/**
|
|
606
|
+
* Submit a board item
|
|
607
|
+
* @param options - instanceId
|
|
608
|
+
*/
|
|
609
|
+
submitItem(options: BoardSubmitItemOptions): Promise<void>;
|
|
610
|
+
/**
|
|
611
|
+
* Discard a board item
|
|
612
|
+
* @param options - instanceId
|
|
613
|
+
*/
|
|
614
|
+
discardItem(options: BoardDiscardItemOptions): Promise<void>;
|
|
615
|
+
/**
|
|
616
|
+
* Get field definitions for this board
|
|
617
|
+
* @param options - Optional viewId to scope fields to a specific view
|
|
618
|
+
*/
|
|
619
|
+
getFields(options?: {
|
|
620
|
+
viewId?: string;
|
|
621
|
+
}): Promise<any>;
|
|
272
622
|
}
|
|
273
623
|
}
|
|
274
624
|
declare module "process/index" {
|
|
275
625
|
import { BaseSDK } from "core/index";
|
|
276
|
-
import { ProcessItem } from "types/external";
|
|
626
|
+
import { ProcessItem, ProcessGetItemOptions, ProcessMyItemsOptions, ProcessMyTasksOptions, ProcessParticipatedOptions, ProcessAdminOptions, ProcessQueryResponse, ProcessCreateItemOptions, ProcessUpdateItemOptions, ProcessDeleteItemOptions, ProcessSubmitItemOptions, ProcessRejectItemOptions, ProcessWithdrawItemOptions, ProcessSendbackItemOptions, ProcessReassignItemOptions, ProcessGetReassigneesOptions, ProcessRestartItemOptions, ProcessDiscardItemOptions } from "types/external";
|
|
277
627
|
export class Process extends BaseSDK {
|
|
278
628
|
private _id;
|
|
279
629
|
constructor(flowId: string);
|
|
630
|
+
/**
|
|
631
|
+
* Get my items from this process (items I initiated)
|
|
632
|
+
* @param options - Query options (status, searchValue, pageNumber, pageSize, payload)
|
|
633
|
+
* @returns Promise containing items and total count
|
|
634
|
+
*
|
|
635
|
+
* @example
|
|
636
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
637
|
+
* // Get draft items
|
|
638
|
+
* const { items } = await process.getMyItems({ status: "draft" });
|
|
639
|
+
* // Get in-progress items
|
|
640
|
+
* const { items } = await process.getMyItems({ status: "inprogress" });
|
|
641
|
+
*/
|
|
642
|
+
getMyItems(options?: ProcessMyItemsOptions): Promise<ProcessQueryResponse>;
|
|
643
|
+
/**
|
|
644
|
+
* Get my pending tasks from this process (tasks assigned to me)
|
|
645
|
+
* @param options - Query options (activityId, searchValue, pageNumber, pageSize, payload)
|
|
646
|
+
* @returns Promise containing tasks and total count
|
|
647
|
+
*
|
|
648
|
+
* @example
|
|
649
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
650
|
+
* // Get all pending tasks
|
|
651
|
+
* const { items } = await process.getMyTasksItems();
|
|
652
|
+
* // Get tasks for specific activity/step
|
|
653
|
+
* const { items } = await process.getMyTasksItems({ activityId: "Approval_Step" });
|
|
654
|
+
*/
|
|
655
|
+
getMyTasksItems(options?: ProcessMyTasksOptions): Promise<ProcessQueryResponse>;
|
|
656
|
+
/**
|
|
657
|
+
* Get items I participated in (items where I took action)
|
|
658
|
+
* @param options - Query options (activityId, searchValue, pageNumber, pageSize, payload)
|
|
659
|
+
* @returns Promise containing items and total count
|
|
660
|
+
*
|
|
661
|
+
* @example
|
|
662
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
663
|
+
* const { items } = await process.getParticipatedItems();
|
|
664
|
+
*/
|
|
665
|
+
getParticipatedItems(options?: ProcessParticipatedOptions): Promise<ProcessQueryResponse>;
|
|
666
|
+
/**
|
|
667
|
+
* Get all items as admin (requires admin access)
|
|
668
|
+
* @param options - Query options (searchValue, pageNumber, pageSize, payload)
|
|
669
|
+
* @returns Promise containing items and total count
|
|
670
|
+
*
|
|
671
|
+
* @example
|
|
672
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
673
|
+
* const { items } = await process.getAdminItems();
|
|
674
|
+
*/
|
|
675
|
+
getAdminItems(options?: ProcessAdminOptions): Promise<ProcessQueryResponse>;
|
|
676
|
+
/**
|
|
677
|
+
* Get a single process instance by ID
|
|
678
|
+
* @param options - instanceId (required)
|
|
679
|
+
* @returns Promise containing the instance data
|
|
680
|
+
*/
|
|
681
|
+
getItem(options: ProcessGetItemOptions): Promise<ProcessItem>;
|
|
682
|
+
/**
|
|
683
|
+
* Create a new process instance (start a new process)
|
|
684
|
+
* @param options - Creation options (data: initial field values)
|
|
685
|
+
* @returns Promise containing the newly created process item with _id and _activity_instance_id
|
|
686
|
+
*
|
|
687
|
+
* @example
|
|
688
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
689
|
+
* const item = await process.createItem({ data: { LeaveType: "Annual" } });
|
|
690
|
+
*/
|
|
691
|
+
createItem(options?: ProcessCreateItemOptions): Promise<ProcessItem>;
|
|
692
|
+
/**
|
|
693
|
+
* Update an existing process instance
|
|
694
|
+
* @param options - Update options (instanceId, activityInstanceId, data)
|
|
695
|
+
* @returns Promise containing the updated item
|
|
696
|
+
*
|
|
697
|
+
* @example
|
|
698
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
699
|
+
* await process.updateItem({
|
|
700
|
+
* instanceId: "item_123",
|
|
701
|
+
* activityInstanceId: "activity_456",
|
|
702
|
+
* data: { LeaveType: "Sick" }
|
|
703
|
+
* });
|
|
704
|
+
*/
|
|
705
|
+
updateItem(options: ProcessUpdateItemOptions): Promise<ProcessItem>;
|
|
706
|
+
/**
|
|
707
|
+
* Delete a process instance
|
|
708
|
+
* @param options - Delete options (instanceId)
|
|
709
|
+
* @returns Promise resolving on successful deletion
|
|
710
|
+
*
|
|
711
|
+
* @example
|
|
712
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
713
|
+
* await process.deleteItem({ instanceId: "item_123" });
|
|
714
|
+
*/
|
|
715
|
+
deleteItem(options: ProcessDeleteItemOptions): Promise<void>;
|
|
716
|
+
/**
|
|
717
|
+
* Open the form UI for a process instance
|
|
718
|
+
* @param item - Process item with _id and _activity_instance_id
|
|
719
|
+
*/
|
|
280
720
|
openForm(item: ProcessItem): any;
|
|
721
|
+
/**
|
|
722
|
+
* Submit a process task
|
|
723
|
+
* @param options - instanceId, activityInstanceId, optional comment
|
|
724
|
+
*
|
|
725
|
+
* @example
|
|
726
|
+
* await process.submitItem({ instanceId: "item_123", activityInstanceId: "act_456" });
|
|
727
|
+
*/
|
|
728
|
+
submitItem(options: ProcessSubmitItemOptions): Promise<void>;
|
|
729
|
+
/**
|
|
730
|
+
* Reject a process task
|
|
731
|
+
* @param options - instanceId, activityInstanceId, comment (required)
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* await process.reject({ instanceId: "item_123", activityInstanceId: "act_456", comment: "Not approved" });
|
|
735
|
+
*/
|
|
736
|
+
rejectItem(options: ProcessRejectItemOptions): Promise<void>;
|
|
737
|
+
/**
|
|
738
|
+
* Withdraw a process instance (initiator only)
|
|
739
|
+
* @param options - instanceId, optional comment
|
|
740
|
+
*
|
|
741
|
+
* @example
|
|
742
|
+
* await process.withdraw({ instanceId: "item_123", comment: "Withdrawing request" });
|
|
743
|
+
*/
|
|
744
|
+
withdrawItem(options: ProcessWithdrawItemOptions): Promise<void>;
|
|
745
|
+
/**
|
|
746
|
+
* Send back a process task to a previous step
|
|
747
|
+
* @param options - instanceId, activityInstanceId, stepId (target step), comment (required)
|
|
748
|
+
*
|
|
749
|
+
* @example
|
|
750
|
+
* await process.sendback({ instanceId: "item_123", activityInstanceId: "act_456", stepId: "step_789", comment: "Please revise" });
|
|
751
|
+
*/
|
|
752
|
+
sendbackItem(options: ProcessSendbackItemOptions): Promise<void>;
|
|
753
|
+
/**
|
|
754
|
+
* Reassign a process task to another user
|
|
755
|
+
* @param options - instanceId, activityInstanceId, reassignTo (user object), comment (required), optional reassignType and reassignedFrom
|
|
756
|
+
*
|
|
757
|
+
* @example
|
|
758
|
+
* await process.reassign({ instanceId: "item_123", activityInstanceId: "act_456", reassignTo: { _id: "user_789" }, comment: "Reassigning to manager" });
|
|
759
|
+
*/
|
|
760
|
+
reassignItem(options: ProcessReassignItemOptions): Promise<void>;
|
|
761
|
+
/**
|
|
762
|
+
* Get list of eligible reassignees for a process task
|
|
763
|
+
* @param options - instanceId, activityInstanceId, optional pageNumber, pageSize, query
|
|
764
|
+
*/
|
|
765
|
+
getReassignees(options: ProcessGetReassigneesOptions): Promise<any>;
|
|
766
|
+
/**
|
|
767
|
+
* Restart a rejected/withdrawn process instance
|
|
768
|
+
* @param options - instanceId, activityInstanceId
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
* await process.restart({ instanceId: "item_123", activityInstanceId: "act_456" });
|
|
772
|
+
*/
|
|
773
|
+
restartItem(options: ProcessRestartItemOptions): Promise<void>;
|
|
774
|
+
/**
|
|
775
|
+
* Discard a draft process instance
|
|
776
|
+
* @param options - instanceId
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* await process.discard({ instanceId: "item_123" });
|
|
780
|
+
*/
|
|
781
|
+
discardItem(options: ProcessDiscardItemOptions): Promise<void>;
|
|
782
|
+
/**
|
|
783
|
+
* Get field definitions for this process
|
|
784
|
+
*/
|
|
785
|
+
getFields(): Promise<any>;
|
|
786
|
+
/**
|
|
787
|
+
* Get field definitions for a specific task step (my tasks view)
|
|
788
|
+
* @param options - activityId of the target step
|
|
789
|
+
*/
|
|
790
|
+
getMyTaskFields(options: {
|
|
791
|
+
activityId: string;
|
|
792
|
+
}): Promise<any>;
|
|
793
|
+
/**
|
|
794
|
+
* Get field definitions for a specific task step (participated view)
|
|
795
|
+
* @param options - activityId of the target step
|
|
796
|
+
*/
|
|
797
|
+
getParticipatedFields(options: {
|
|
798
|
+
activityId: string;
|
|
799
|
+
}): Promise<any>;
|
|
800
|
+
/**
|
|
801
|
+
* Get field definitions for the my items view filtered by status
|
|
802
|
+
* @param options - status filter (e.g. "draft", "inprogress", "all")
|
|
803
|
+
*/
|
|
804
|
+
getMyItemsFields(options: {
|
|
805
|
+
status: string;
|
|
806
|
+
}): Promise<any>;
|
|
807
|
+
/**
|
|
808
|
+
* Get the progress/timeline of a process instance
|
|
809
|
+
* @param options - instanceId (required)
|
|
810
|
+
*/
|
|
811
|
+
getProgress(options: {
|
|
812
|
+
instanceId: string;
|
|
813
|
+
}): Promise<any>;
|
|
281
814
|
}
|
|
282
815
|
}
|
|
283
816
|
declare module "app/index" {
|
|
@@ -285,7 +818,7 @@ declare module "app/index" {
|
|
|
285
818
|
import { Page } from "app/page";
|
|
286
819
|
import { AppContext } from "types/internal";
|
|
287
820
|
import { DecisionTable } from "app/decisiontable";
|
|
288
|
-
import { Dataform } from "
|
|
821
|
+
import { Dataform } from "dataform/index";
|
|
289
822
|
import { Board } from "board/index";
|
|
290
823
|
import { Process } from "process/index";
|
|
291
824
|
export class Application extends BaseSDK {
|