@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.
@@ -73,15 +73,335 @@ declare class DecisionTable {
73
73
  evaluate(payload?: object): any;
74
74
  }
75
75
  declare class Dataform {
76
- importCSV(defaultValues?: object): any;
77
- openForm(item: DataformItem): any;
76
+ /**
77
+ * Get all items from this dataform with optional filtering, sorting, and pagination
78
+ * @param options - Query options (searchValue, pageNumber, pageSize, payload)
79
+ * @returns Promise containing items and total count
80
+ */
81
+ getItems(options?: DataformQueryOptions): Promise<DataformQueryResponse>;
82
+ /**
83
+ * Get a single item by ID from this dataform
84
+ * @param options - itemId (required), optional viewId
85
+ * @returns Promise containing the item data
86
+ */
87
+ getItem(options: DataformGetItemOptions): Promise<DataformItem>;
88
+ /**
89
+ * Create a new item in this dataform
90
+ * @param options - Creation options (data: initial field values, viewId: optional view ID)
91
+ * @returns Promise containing the newly created item with _id
92
+ */
93
+ createItem(options?: DataformCreateItemOptions): Promise<DataformItem>;
94
+ /**
95
+ * Update an existing item in this dataform
96
+ * @param options - Update options (itemId: required, data: required updated values, viewId: optional view ID)
97
+ * @returns Promise containing the updated item
98
+ */
99
+ updateItem(options: DataformUpdateItemOptions): Promise<DataformItem>;
100
+ /**
101
+ * Import items from a CSV file into this dataform
102
+ * @param defaultValues - Optional default field values to apply to all imported items
103
+ */
104
+ importCSV(defaultValues?: object): any;
105
+ /**
106
+ * Open the form UI for an existing dataform item
107
+ * @param item - Dataform item with _id
108
+ */
109
+ openForm(item: DataformItem): any;
110
+ /**
111
+ * Delete an item from this dataform
112
+ * @param options - itemId (required), optional viewId
113
+ *
114
+ * @example
115
+ * await dataform.deleteItem({ itemId: "item_123" });
116
+ */
117
+ deleteItem(options: DataformDeleteItemOptions): Promise<void>;
118
+ /**
119
+ * Discard the current draft for this dataform
120
+ * @param options - optional viewId
121
+ *
122
+ * @example
123
+ * await dataform.discardItem();
124
+ */
125
+ discardItem(options?: DataformDiscardItemOptions): Promise<void>;
126
+ /**
127
+ * Submit/finalize a dataform item
128
+ * @param options - itemId (required), optional data and viewId
129
+ *
130
+ * @example
131
+ * await dataform.submitItem({ itemId: "item_123" });
132
+ */
133
+ submitItem(options: DataformSubmitItemOptions): Promise<void>;
134
+ /**
135
+ * Get field definitions for this dataform
136
+ * @param options - Optional viewId to scope fields to a specific view
137
+ */
138
+ getFields(options?: {
139
+ viewId?: string;
140
+ }): Promise<any>;
78
141
  }
79
142
  declare class Board {
80
- importCSV(defaultValues?: object): any;
81
- openForm(item: BoardItem): any;
143
+ /**
144
+ * Import data from CSV file
145
+ * @param defaultValues - Optional default values to apply to imported items
146
+ */
147
+ importCSV(defaultValues?: object): any;
148
+ /**
149
+ * Open the form UI for a board item
150
+ * @param item - Board item with _id and optional _view_id
151
+ */
152
+ openForm(item: BoardItem): any;
153
+ /**
154
+ * Get items from a board view
155
+ * @param options - Query options (viewId, searchValue, pageNumber, pageSize, payload)
156
+ * @returns Promise containing items array and total count
157
+ *
158
+ * @example
159
+ * const board = kf.app.getBoard("Inventory");
160
+ * const { items } = await board.getItems({ viewId: "AllItems_View" });
161
+ */
162
+ getItems(options?: BoardGetItemsOptions): Promise<BoardQueryResponse>;
163
+ /**
164
+ * Get a single board/case item by instance ID
165
+ * @param options - instanceId (required)
166
+ * @returns Promise containing the item data
167
+ */
168
+ getItem(options: BoardGetItemOptions): Promise<BoardItem>;
169
+ /**
170
+ * Create a new board item
171
+ * @param options - Creation options (data: initial field values)
172
+ * @returns Promise containing the newly created item with _id
173
+ *
174
+ * @example
175
+ * const board = kf.app.getBoard("Inventory");
176
+ * const item = await board.createItem({ data: { Name: "New Item" } });
177
+ */
178
+ createItem(options?: BoardCreateItemOptions): Promise<BoardItem>;
179
+ /**
180
+ * Update an existing board item
181
+ * @param options - Update options (instanceId, data)
182
+ * @returns Promise containing the updated item
183
+ *
184
+ * @example
185
+ * const board = kf.app.getBoard("Inventory");
186
+ * await board.updateItem({
187
+ * instanceId: "item_123",
188
+ * data: { Name: "Updated Item" }
189
+ * });
190
+ */
191
+ updateItem(options: BoardUpdateItemOptions): Promise<BoardItem>;
192
+ /**
193
+ * Delete a board item
194
+ * @param options - Delete options (instanceId)
195
+ * @returns Promise resolving on successful deletion
196
+ *
197
+ * @example
198
+ * const board = kf.app.getBoard("Inventory");
199
+ * await board.deleteItem({ instanceId: "item_123" });
200
+ */
201
+ deleteItem(options: BoardDeleteItemOptions): Promise<void>;
202
+ /**
203
+ * Submit a board item
204
+ * @param options - instanceId
205
+ */
206
+ submitItem(options: BoardSubmitItemOptions): Promise<void>;
207
+ /**
208
+ * Discard a board item
209
+ * @param options - instanceId
210
+ */
211
+ discardItem(options: BoardDiscardItemOptions): Promise<void>;
212
+ /**
213
+ * Get field definitions for this board
214
+ * @param options - Optional viewId to scope fields to a specific view
215
+ */
216
+ getFields(options?: {
217
+ viewId?: string;
218
+ }): Promise<any>;
82
219
  }
83
220
  declare class Process {
84
- openForm(item: ProcessItem): any;
221
+ /**
222
+ * Get my items from this process (items I initiated)
223
+ * @param options - Query options (status, searchValue, pageNumber, pageSize, payload)
224
+ * @returns Promise containing items and total count
225
+ *
226
+ * @example
227
+ * const process = kf.app.getProcess("LeaveRequest");
228
+ * // Get draft items
229
+ * const { items } = await process.getMyItems({ status: "draft" });
230
+ * // Get in-progress items
231
+ * const { items } = await process.getMyItems({ status: "inprogress" });
232
+ */
233
+ getMyItems(options?: ProcessMyItemsOptions): Promise<ProcessQueryResponse>;
234
+ /**
235
+ * Get my pending tasks from this process (tasks assigned to me)
236
+ * @param options - Query options (activityId, searchValue, pageNumber, pageSize, payload)
237
+ * @returns Promise containing tasks and total count
238
+ *
239
+ * @example
240
+ * const process = kf.app.getProcess("LeaveRequest");
241
+ * // Get all pending tasks
242
+ * const { items } = await process.getMyTasksItems();
243
+ * // Get tasks for specific activity/step
244
+ * const { items } = await process.getMyTasksItems({ activityId: "Approval_Step" });
245
+ */
246
+ getMyTasksItems(options?: ProcessMyTasksOptions): Promise<ProcessQueryResponse>;
247
+ /**
248
+ * Get items I participated in (items where I took action)
249
+ * @param options - Query options (activityId, searchValue, pageNumber, pageSize, payload)
250
+ * @returns Promise containing items and total count
251
+ *
252
+ * @example
253
+ * const process = kf.app.getProcess("LeaveRequest");
254
+ * const { items } = await process.getParticipatedItems();
255
+ */
256
+ getParticipatedItems(options?: ProcessParticipatedOptions): Promise<ProcessQueryResponse>;
257
+ /**
258
+ * Get all items as admin (requires admin access)
259
+ * @param options - Query options (searchValue, pageNumber, pageSize, payload)
260
+ * @returns Promise containing items and total count
261
+ *
262
+ * @example
263
+ * const process = kf.app.getProcess("LeaveRequest");
264
+ * const { items } = await process.getAdminItems();
265
+ */
266
+ getAdminItems(options?: ProcessAdminOptions): Promise<ProcessQueryResponse>;
267
+ /**
268
+ * Get a single process instance by ID
269
+ * @param options - instanceId (required)
270
+ * @returns Promise containing the instance data
271
+ */
272
+ getItem(options: ProcessGetItemOptions): Promise<ProcessItem>;
273
+ /**
274
+ * Create a new process instance (start a new process)
275
+ * @param options - Creation options (data: initial field values)
276
+ * @returns Promise containing the newly created process item with _id and _activity_instance_id
277
+ *
278
+ * @example
279
+ * const process = kf.app.getProcess("LeaveRequest");
280
+ * const item = await process.createItem({ data: { LeaveType: "Annual" } });
281
+ */
282
+ createItem(options?: ProcessCreateItemOptions): Promise<ProcessItem>;
283
+ /**
284
+ * Update an existing process instance
285
+ * @param options - Update options (instanceId, activityInstanceId, data)
286
+ * @returns Promise containing the updated item
287
+ *
288
+ * @example
289
+ * const process = kf.app.getProcess("LeaveRequest");
290
+ * await process.updateItem({
291
+ * instanceId: "item_123",
292
+ * activityInstanceId: "activity_456",
293
+ * data: { LeaveType: "Sick" }
294
+ * });
295
+ */
296
+ updateItem(options: ProcessUpdateItemOptions): Promise<ProcessItem>;
297
+ /**
298
+ * Delete a process instance
299
+ * @param options - Delete options (instanceId)
300
+ * @returns Promise resolving on successful deletion
301
+ *
302
+ * @example
303
+ * const process = kf.app.getProcess("LeaveRequest");
304
+ * await process.deleteItem({ instanceId: "item_123" });
305
+ */
306
+ deleteItem(options: ProcessDeleteItemOptions): Promise<void>;
307
+ /**
308
+ * Open the form UI for a process instance
309
+ * @param item - Process item with _id and _activity_instance_id
310
+ */
311
+ openForm(item: ProcessItem): any;
312
+ /**
313
+ * Submit a process task
314
+ * @param options - instanceId, activityInstanceId, optional comment
315
+ *
316
+ * @example
317
+ * await process.submitItem({ instanceId: "item_123", activityInstanceId: "act_456" });
318
+ */
319
+ submitItem(options: ProcessSubmitItemOptions): Promise<void>;
320
+ /**
321
+ * Reject a process task
322
+ * @param options - instanceId, activityInstanceId, comment (required)
323
+ *
324
+ * @example
325
+ * await process.reject({ instanceId: "item_123", activityInstanceId: "act_456", comment: "Not approved" });
326
+ */
327
+ rejectItem(options: ProcessRejectItemOptions): Promise<void>;
328
+ /**
329
+ * Withdraw a process instance (initiator only)
330
+ * @param options - instanceId, optional comment
331
+ *
332
+ * @example
333
+ * await process.withdraw({ instanceId: "item_123", comment: "Withdrawing request" });
334
+ */
335
+ withdrawItem(options: ProcessWithdrawItemOptions): Promise<void>;
336
+ /**
337
+ * Send back a process task to a previous step
338
+ * @param options - instanceId, activityInstanceId, stepId (target step), comment (required)
339
+ *
340
+ * @example
341
+ * await process.sendback({ instanceId: "item_123", activityInstanceId: "act_456", stepId: "step_789", comment: "Please revise" });
342
+ */
343
+ sendbackItem(options: ProcessSendbackItemOptions): Promise<void>;
344
+ /**
345
+ * Reassign a process task to another user
346
+ * @param options - instanceId, activityInstanceId, reassignTo (user object), comment (required), optional reassignType and reassignedFrom
347
+ *
348
+ * @example
349
+ * await process.reassign({ instanceId: "item_123", activityInstanceId: "act_456", reassignTo: { _id: "user_789" }, comment: "Reassigning to manager" });
350
+ */
351
+ reassignItem(options: ProcessReassignItemOptions): Promise<void>;
352
+ /**
353
+ * Get list of eligible reassignees for a process task
354
+ * @param options - instanceId, activityInstanceId, optional pageNumber, pageSize, query
355
+ */
356
+ getReassignees(options: ProcessGetReassigneesOptions): Promise<any>;
357
+ /**
358
+ * Restart a rejected/withdrawn process instance
359
+ * @param options - instanceId, activityInstanceId
360
+ *
361
+ * @example
362
+ * await process.restart({ instanceId: "item_123", activityInstanceId: "act_456" });
363
+ */
364
+ restartItem(options: ProcessRestartItemOptions): Promise<void>;
365
+ /**
366
+ * Discard a draft process instance
367
+ * @param options - instanceId
368
+ *
369
+ * @example
370
+ * await process.discard({ instanceId: "item_123" });
371
+ */
372
+ discardItem(options: ProcessDiscardItemOptions): Promise<void>;
373
+ /**
374
+ * Get field definitions for this process
375
+ */
376
+ getFields(): Promise<any>;
377
+ /**
378
+ * Get field definitions for a specific task step (my tasks view)
379
+ * @param options - activityId of the target step
380
+ */
381
+ getMyTaskFields(options: {
382
+ activityId: string;
383
+ }): Promise<any>;
384
+ /**
385
+ * Get field definitions for a specific task step (participated view)
386
+ * @param options - activityId of the target step
387
+ */
388
+ getParticipatedFields(options: {
389
+ activityId: string;
390
+ }): Promise<any>;
391
+ /**
392
+ * Get field definitions for the my items view filtered by status
393
+ * @param options - status filter (e.g. "draft", "inprogress", "all")
394
+ */
395
+ getMyItemsFields(options: {
396
+ status: string;
397
+ }): Promise<any>;
398
+ /**
399
+ * Get the progress/timeline of a process instance
400
+ * @param options - instanceId (required)
401
+ */
402
+ getProgress(options: {
403
+ instanceId: string;
404
+ }): Promise<any>;
85
405
  }
86
406
  declare class Application {
87
407
  page: Page
@@ -105,6 +425,45 @@ declare class kf {
105
425
  static eventParameters: any
106
426
  static api(url: string, args?: FetchOptions): Promise<any>;
107
427
  }
428
+ // ============================================
429
+ // Shared Base Types
430
+ // ============================================
431
+
432
+ declare type QueryResponse = {
433
+ items: any[];
434
+ total: number;
435
+ page?: number;
436
+ pageSize?: number;
437
+ };
438
+
439
+ declare type BaseQueryOptions = {
440
+ searchValue?: string;
441
+ pageNumber?: number;
442
+ pageSize?: number;
443
+ };
444
+
445
+ declare type PayloadSortItem = {
446
+ Id: string;
447
+ SortType: "ASC" | "DESC";
448
+ };
449
+
450
+ declare type PayloadOptions = {
451
+ Columns?: any[];
452
+ Filters?: any;
453
+ Sort?: PayloadSortItem[];
454
+ FilterParam?: any;
455
+ };
456
+
457
+ declare type ProcessPayloadOptions = {
458
+ Columns?: any[];
459
+ Filters?: any;
460
+ Sort?: PayloadSortItem[];
461
+ };
462
+
463
+ // ============================================
464
+ // Core Types
465
+ // ============================================
466
+
108
467
  declare type userObject = {
109
468
  _id: string;
110
469
  Name: string;
@@ -136,13 +495,189 @@ declare type DataformItem = {
136
495
  _id: string;
137
496
  };
138
497
 
498
+
139
499
  declare type ProcessItem = {
140
500
  _id: string;
141
501
  _activity_instance_id: string;
142
502
  };
143
503
 
504
+ // ============================================
505
+ // Process Types
506
+ // ============================================
507
+
508
+ declare type ProcessMyItemsOptions = BaseQueryOptions & {
509
+ status?: "draft" | "inprogress" | "completed" | "withdrawn" | "rejected" | "all";
510
+ payload?: ProcessPayloadOptions;
511
+ };
512
+
513
+ declare type ProcessMyTasksOptions = BaseQueryOptions & {
514
+ activityId?: string;
515
+ payload?: ProcessPayloadOptions;
516
+ };
517
+
518
+ declare type ProcessParticipatedOptions = BaseQueryOptions & {
519
+ activityId?: string;
520
+ payload?: ProcessPayloadOptions;
521
+ };
522
+
523
+ declare type ProcessAdminOptions = BaseQueryOptions & {
524
+ payload?: ProcessPayloadOptions;
525
+ };
526
+
527
+ declare type ProcessQueryResponse = QueryResponse;
528
+
529
+ declare type ProcessGetItemOptions = {
530
+ instanceId: string;
531
+ };
532
+
533
+ declare type ProcessCreateItemOptions = {
534
+ data?: object;
535
+ };
536
+
537
+ declare type ProcessUpdateItemOptions = {
538
+ instanceId: string;
539
+ activityInstanceId: string;
540
+ data: object;
541
+ };
542
+
543
+ declare type ProcessDeleteItemOptions = {
544
+ instanceId: string;
545
+ };
546
+
547
+ declare type ProcessSubmitItemOptions = {
548
+ instanceId: string;
549
+ activityInstanceId: string;
550
+ comment?: string;
551
+ };
552
+
553
+ declare type ProcessRejectItemOptions = {
554
+ instanceId: string;
555
+ activityInstanceId: string;
556
+ comment: string;
557
+ };
558
+
559
+ declare type ProcessWithdrawItemOptions = {
560
+ instanceId: string;
561
+ comment?: string;
562
+ };
563
+
564
+ declare type ProcessSendbackItemOptions = {
565
+ instanceId: string;
566
+ activityInstanceId: string;
567
+ stepId: string;
568
+ comment: string;
569
+ };
570
+
571
+ declare type ProcessReassignItemOptions = {
572
+ instanceId: string;
573
+ activityInstanceId: string;
574
+ reassignTo: object;
575
+ comment: string;
576
+ reassignType?: "initiator" | "approver" | "admin";
577
+ reassignedFrom?: object[];
578
+ };
579
+
580
+ declare type ProcessGetReassigneesOptions = {
581
+ instanceId: string;
582
+ activityInstanceId: string;
583
+ pageNumber?: number;
584
+ pageSize?: number;
585
+ query?: string;
586
+ };
587
+
588
+ declare type ProcessRestartItemOptions = {
589
+ instanceId: string;
590
+ activityInstanceId: string;
591
+ };
592
+
593
+ declare type ProcessDiscardItemOptions = {
594
+ instanceId: string;
595
+ };
596
+
144
597
  declare type FetchOptions = {
145
598
  method?: string;
146
599
  body?: string | object;
147
600
  headers?: object;
148
601
  };
602
+
603
+ // ============================================
604
+ // Dataform Types
605
+ // ============================================
606
+
607
+ declare type DataformQueryOptions = BaseQueryOptions & {
608
+ viewId?: string;
609
+ payload?: PayloadOptions;
610
+ };
611
+
612
+ declare type DataformQueryResponse = QueryResponse;
613
+
614
+ declare type DataformCreateItemOptions = {
615
+ data?: object;
616
+ viewId?: string;
617
+ };
618
+
619
+ declare type DataformUpdateItemOptions = {
620
+ itemId: string; // Required: the _id of the item to update
621
+ data: object; // Required: the updated field values
622
+ viewId?: string; // Optional: view ID for view-specific update
623
+ };
624
+
625
+ declare type DataformGetItemOptions = {
626
+ itemId: string;
627
+ viewId?: string;
628
+ };
629
+
630
+ declare type DataformDeleteItemOptions = {
631
+ itemId: string;
632
+ viewId?: string;
633
+ };
634
+
635
+ declare type DataformDiscardItemOptions = {
636
+ viewId?: string;
637
+ };
638
+
639
+ declare type DataformSubmitItemOptions = {
640
+ itemId: string;
641
+ data?: object;
642
+ viewId?: string;
643
+ };
644
+
645
+ // ============================================
646
+ // Board Types
647
+ // ============================================
648
+
649
+ declare type BoardGetItemsOptions = BaseQueryOptions & {
650
+ viewId?: string;
651
+ payload?: PayloadOptions;
652
+ };
653
+
654
+ declare type BoardQueryResponse = QueryResponse;
655
+
656
+ declare type BoardGetItemOptions = {
657
+ instanceId: string;
658
+ };
659
+
660
+ declare type BoardCreateItemOptions = {
661
+ data?: object;
662
+ };
663
+
664
+ declare type BoardUpdateItemOptions = {
665
+ instanceId: string; // Required: the _id of the item to update
666
+ data: object; // Required: the updated field values
667
+ };
668
+
669
+ declare type BoardDeleteItemOptions = {
670
+ instanceId: string; // Required: the _id of the item to delete
671
+ };
672
+
673
+ declare type BoardSubmitItemOptions = {
674
+ instanceId: string;
675
+ comment?: string;
676
+ };
677
+
678
+ declare type BoardDiscardItemOptions = {
679
+ instanceId: string;
680
+ };
681
+
682
+
683
+