@kissflow/lowcode-client-sdk 1.0.39 → 1.0.41
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 +594 -5
- package/dist/kf.lowcodeworkersdk.es.js +433 -16
- package/dist/kf.nocodeworkersdk.es.js +43 -1
- package/dist/kfsdk.es.js +432 -16
- package/dist/kfsdk.umd.js +1 -1
- package/dist/lowcode.d.ts +594 -5
- package/dist/lowcode.types.d.ts +598 -8
- package/dist/nocode.d.ts +602 -13
- package/dist/nocode.types.d.ts +273 -3
- package/package.json +1 -1
package/dist/nocode.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ declare module "core/constants" {
|
|
|
18
18
|
ALERT: string;
|
|
19
19
|
REDIRECT: string;
|
|
20
20
|
OPEN_PAGE: string;
|
|
21
|
+
GET_IMAGE_URL: string;
|
|
21
22
|
FORMAT_DATE: string;
|
|
22
23
|
FORMAT_DATE_TIME: string;
|
|
23
24
|
FORMAT_NUMBER: string;
|
|
@@ -50,9 +51,46 @@ declare module "core/constants" {
|
|
|
50
51
|
DECISION_TABLE_EXECUTE: string;
|
|
51
52
|
DATAFORM_IMPORT_CSV: string;
|
|
52
53
|
DATAFORM_OPEN_FORM: string;
|
|
54
|
+
DATAFORM_GET_FIELDS: string;
|
|
55
|
+
DATAFORM_GET_ITEMS: string;
|
|
56
|
+
DATAFORM_CREATE_ITEM: string;
|
|
57
|
+
DATAFORM_UPDATE_ITEM: string;
|
|
58
|
+
DATAFORM_GET_ITEM: string;
|
|
59
|
+
DATAFORM_DELETE_ITEM: string;
|
|
60
|
+
DATAFORM_DISCARD_ITEM: string;
|
|
61
|
+
DATAFORM_SUBMIT_ITEM: string;
|
|
53
62
|
PROCESS_OPEN_FORM: string;
|
|
63
|
+
PROCESS_GET_FIELDS: string;
|
|
64
|
+
PROCESS_GET_MYTASK_FIELDS: string;
|
|
65
|
+
PROCESS_GET_PARTICIPATED_FIELDS: string;
|
|
66
|
+
PROCESS_GET_MY_ITEMS_FIELDS: string;
|
|
67
|
+
PROCESS_GET_MY_ITEMS: string;
|
|
68
|
+
PROCESS_GET_MY_TASKS_ITEMS: string;
|
|
69
|
+
PROCESS_GET_PARTICIPATED_ITEMS: string;
|
|
70
|
+
PROCESS_GET_ADMIN_ITEMS: string;
|
|
71
|
+
PROCESS_CREATE_ITEM: string;
|
|
72
|
+
PROCESS_UPDATE_ITEM: string;
|
|
73
|
+
PROCESS_GET_ITEM: string;
|
|
74
|
+
PROCESS_DELETE_ITEM: string;
|
|
75
|
+
PROCESS_SUBMIT_ITEM: string;
|
|
76
|
+
PROCESS_REJECT_ITEM: string;
|
|
77
|
+
PROCESS_WITHDRAW_ITEM: string;
|
|
78
|
+
PROCESS_SENDBACK_ITEM: string;
|
|
79
|
+
PROCESS_REASSIGN_ITEM: string;
|
|
80
|
+
PROCESS_GET_REASSIGNEES: string;
|
|
81
|
+
PROCESS_RESTART_ITEM: string;
|
|
82
|
+
PROCESS_DISCARD_ITEM: string;
|
|
83
|
+
PROCESS_GET_PROGRESS: string;
|
|
54
84
|
BOARD_IMPORT_CSV: string;
|
|
55
85
|
BOARD_OPEN_FORM: string;
|
|
86
|
+
BOARD_GET_FIELDS: string;
|
|
87
|
+
BOARD_GET_ITEMS: string;
|
|
88
|
+
BOARD_CREATE_ITEM: string;
|
|
89
|
+
BOARD_UPDATE_ITEM: string;
|
|
90
|
+
BOARD_GET_ITEM: string;
|
|
91
|
+
BOARD_DELETE_ITEM: string;
|
|
92
|
+
BOARD_SUBMIT_ITEM: string;
|
|
93
|
+
BOARD_DISCARD_ITEM: string;
|
|
56
94
|
};
|
|
57
95
|
export const EVENT_TYPES: {
|
|
58
96
|
COMPONENT_ON_MOUNT: string;
|
|
@@ -119,14 +157,69 @@ declare module "form/index" {
|
|
|
119
157
|
declare module "utils/client" {
|
|
120
158
|
import { BaseSDK } from "core/index";
|
|
121
159
|
export class Client extends BaseSDK {
|
|
160
|
+
/**
|
|
161
|
+
* Display an info message toast in the platform.
|
|
162
|
+
*
|
|
163
|
+
* @param message - The message to display. Accepts a string or object (serialized to JSON).
|
|
164
|
+
* @returns A promise that resolves when the message is shown.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* await kf.client.showInfo("Record saved successfully");
|
|
168
|
+
*/
|
|
122
169
|
showInfo(message: string | object): any;
|
|
170
|
+
/**
|
|
171
|
+
* Display a confirmation dialog and wait for the user's response.
|
|
172
|
+
*
|
|
173
|
+
* @param args - Dialog configuration.
|
|
174
|
+
* @param args.title - Dialog title.
|
|
175
|
+
* @param args.content - Body text of the dialog.
|
|
176
|
+
* @param args.okText - Label for the confirm button (default: "Ok").
|
|
177
|
+
* @param args.cancelText - Label for the cancel button (default: "Cancel").
|
|
178
|
+
* @returns A promise that resolves with `{ action: "OK" }` or `{ action: "CANCEL" }`.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* const { action } = await kf.client.showConfirm({
|
|
182
|
+
* title: "Delete record?",
|
|
183
|
+
* content: "This cannot be undone.",
|
|
184
|
+
* okText: "Delete",
|
|
185
|
+
* cancelText: "Cancel",
|
|
186
|
+
* });
|
|
187
|
+
* if (action === "OK") { ... }
|
|
188
|
+
*/
|
|
123
189
|
showConfirm(args: {
|
|
124
190
|
title: string;
|
|
125
191
|
content: string;
|
|
126
192
|
okText: string;
|
|
127
193
|
cancelText: string;
|
|
128
194
|
}): any;
|
|
195
|
+
/**
|
|
196
|
+
* Navigate the platform to the given URL.
|
|
197
|
+
*
|
|
198
|
+
* @param url - The URL to navigate to.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* kf.client.redirect("https://example.com");
|
|
202
|
+
*/
|
|
129
203
|
redirect(url: string): any;
|
|
204
|
+
/**
|
|
205
|
+
* Resolve a Kissflow image field value to a base64 data URL.
|
|
206
|
+
*
|
|
207
|
+
* Custom components (iframes) cannot load Kissflow-hosted images directly due to
|
|
208
|
+
* CORS restrictions and 302 redirects to signed S3 URLs. This method fetches the
|
|
209
|
+
* image in the parent window (which has the required session cookies) and returns
|
|
210
|
+
* a self-contained `data:image/...;base64,...` URL that can be used as `<img src>`
|
|
211
|
+
* without any CORS issues.
|
|
212
|
+
*
|
|
213
|
+
* @param imageValue - The image field value must contain a `key` property and
|
|
214
|
+
* optionally a `photos` array. Uses `photos[1]` (preview resolution) when available,
|
|
215
|
+
* falls back to `key`.
|
|
216
|
+
* @returns A promise that resolves with the base64 data URL string.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* const dataUrl = await kf.client.getImageUrl(imageFieldValue);
|
|
220
|
+
* document.querySelector("#avatar").src = dataUrl;
|
|
221
|
+
*/
|
|
222
|
+
getImageUrl(imageValue: Record<string, unknown>): any;
|
|
130
223
|
}
|
|
131
224
|
}
|
|
132
225
|
declare module "utils/formatter" {
|
|
@@ -139,9 +232,32 @@ declare module "utils/formatter" {
|
|
|
139
232
|
toBoolean(value: string): any;
|
|
140
233
|
}
|
|
141
234
|
}
|
|
235
|
+
declare module "utils/validation" {
|
|
236
|
+
/**
|
|
237
|
+
* Validation utilities for SDK methods
|
|
238
|
+
*/
|
|
239
|
+
/**
|
|
240
|
+
* Throws error if value is falsy
|
|
241
|
+
*/
|
|
242
|
+
export function requireField(value: any, fieldName: string): void;
|
|
243
|
+
/**
|
|
244
|
+
* Returns a rejected promise if value is falsy, null otherwise
|
|
245
|
+
* Use for async validation in SDK methods
|
|
246
|
+
*/
|
|
247
|
+
export function requireFieldAsync(value: any, fieldName: string): Promise<never> | null;
|
|
248
|
+
/**
|
|
249
|
+
* Returns a rejected promise if any of the values are falsy
|
|
250
|
+
* Use for validating multiple required fields
|
|
251
|
+
*/
|
|
252
|
+
export function requireFieldsAsync(fields: Array<{
|
|
253
|
+
value: any;
|
|
254
|
+
name: string;
|
|
255
|
+
}>): Promise<never> | null;
|
|
256
|
+
}
|
|
142
257
|
declare module "utils/index" {
|
|
143
258
|
export * from "utils/client";
|
|
144
259
|
export * from "utils/formatter";
|
|
260
|
+
export * from "utils/validation";
|
|
145
261
|
export const isObject: (value: any) => boolean;
|
|
146
262
|
}
|
|
147
263
|
declare module "window/NDEFReader" {
|
|
@@ -163,6 +279,32 @@ declare module "window/index" {
|
|
|
163
279
|
};
|
|
164
280
|
}
|
|
165
281
|
declare module "types/external" {
|
|
282
|
+
export type QueryResponse = {
|
|
283
|
+
items: any[];
|
|
284
|
+
total: number;
|
|
285
|
+
page?: number;
|
|
286
|
+
pageSize?: number;
|
|
287
|
+
};
|
|
288
|
+
export type BaseQueryOptions = {
|
|
289
|
+
searchValue?: string;
|
|
290
|
+
pageNumber?: number;
|
|
291
|
+
pageSize?: number;
|
|
292
|
+
};
|
|
293
|
+
export type PayloadSortItem = {
|
|
294
|
+
Id: string;
|
|
295
|
+
SortType: "ASC" | "DESC";
|
|
296
|
+
};
|
|
297
|
+
export type PayloadOptions = {
|
|
298
|
+
Columns?: any[];
|
|
299
|
+
Filters?: any;
|
|
300
|
+
Sort?: PayloadSortItem[];
|
|
301
|
+
FilterParam?: any;
|
|
302
|
+
};
|
|
303
|
+
export type ProcessPayloadOptions = {
|
|
304
|
+
Columns?: any[];
|
|
305
|
+
Filters?: any;
|
|
306
|
+
Sort?: PayloadSortItem[];
|
|
307
|
+
};
|
|
166
308
|
export type userObject = {
|
|
167
309
|
_id: string;
|
|
168
310
|
Name: string;
|
|
@@ -192,11 +334,138 @@ declare module "types/external" {
|
|
|
192
334
|
_id: string;
|
|
193
335
|
_activity_instance_id: string;
|
|
194
336
|
};
|
|
337
|
+
export type ProcessMyItemsOptions = BaseQueryOptions & {
|
|
338
|
+
status?: "draft" | "inprogress" | "completed" | "withdrawn" | "rejected" | "all";
|
|
339
|
+
payload?: ProcessPayloadOptions;
|
|
340
|
+
};
|
|
341
|
+
export type ProcessMyTasksOptions = BaseQueryOptions & {
|
|
342
|
+
activityId?: string;
|
|
343
|
+
payload?: ProcessPayloadOptions;
|
|
344
|
+
};
|
|
345
|
+
export type ProcessParticipatedOptions = BaseQueryOptions & {
|
|
346
|
+
activityId?: string;
|
|
347
|
+
payload?: ProcessPayloadOptions;
|
|
348
|
+
};
|
|
349
|
+
export type ProcessAdminOptions = BaseQueryOptions & {
|
|
350
|
+
payload?: ProcessPayloadOptions;
|
|
351
|
+
};
|
|
352
|
+
export type ProcessQueryResponse = QueryResponse;
|
|
353
|
+
export type ProcessGetItemOptions = {
|
|
354
|
+
instanceId: string;
|
|
355
|
+
};
|
|
356
|
+
export type ProcessCreateItemOptions = {
|
|
357
|
+
data?: object;
|
|
358
|
+
};
|
|
359
|
+
export type ProcessUpdateItemOptions = {
|
|
360
|
+
instanceId: string;
|
|
361
|
+
activityInstanceId: string;
|
|
362
|
+
data: object;
|
|
363
|
+
};
|
|
364
|
+
export type ProcessDeleteItemOptions = {
|
|
365
|
+
instanceId: string;
|
|
366
|
+
};
|
|
367
|
+
export type ProcessSubmitItemOptions = {
|
|
368
|
+
instanceId: string;
|
|
369
|
+
activityInstanceId: string;
|
|
370
|
+
comment?: string;
|
|
371
|
+
};
|
|
372
|
+
export type ProcessRejectItemOptions = {
|
|
373
|
+
instanceId: string;
|
|
374
|
+
activityInstanceId: string;
|
|
375
|
+
comment: string;
|
|
376
|
+
};
|
|
377
|
+
export type ProcessWithdrawItemOptions = {
|
|
378
|
+
instanceId: string;
|
|
379
|
+
comment?: string;
|
|
380
|
+
};
|
|
381
|
+
export type ProcessSendbackItemOptions = {
|
|
382
|
+
instanceId: string;
|
|
383
|
+
activityInstanceId: string;
|
|
384
|
+
stepId: string;
|
|
385
|
+
comment: string;
|
|
386
|
+
};
|
|
387
|
+
export type ProcessReassignItemOptions = {
|
|
388
|
+
instanceId: string;
|
|
389
|
+
activityInstanceId: string;
|
|
390
|
+
reassignTo: object;
|
|
391
|
+
comment: string;
|
|
392
|
+
reassignType?: "initiator" | "approver" | "admin";
|
|
393
|
+
reassignedFrom?: object[];
|
|
394
|
+
};
|
|
395
|
+
export type ProcessGetReassigneesOptions = {
|
|
396
|
+
instanceId: string;
|
|
397
|
+
activityInstanceId: string;
|
|
398
|
+
pageNumber?: number;
|
|
399
|
+
pageSize?: number;
|
|
400
|
+
query?: string;
|
|
401
|
+
};
|
|
402
|
+
export type ProcessRestartItemOptions = {
|
|
403
|
+
instanceId: string;
|
|
404
|
+
activityInstanceId: string;
|
|
405
|
+
};
|
|
406
|
+
export type ProcessDiscardItemOptions = {
|
|
407
|
+
instanceId: string;
|
|
408
|
+
};
|
|
195
409
|
export type FetchOptions = {
|
|
196
410
|
method?: string;
|
|
197
411
|
body?: string | object;
|
|
198
412
|
headers?: object;
|
|
199
413
|
};
|
|
414
|
+
export type DataformQueryOptions = BaseQueryOptions & {
|
|
415
|
+
viewId?: string;
|
|
416
|
+
payload?: PayloadOptions;
|
|
417
|
+
};
|
|
418
|
+
export type DataformQueryResponse = QueryResponse;
|
|
419
|
+
export type DataformCreateItemOptions = {
|
|
420
|
+
data?: object;
|
|
421
|
+
viewId?: string;
|
|
422
|
+
};
|
|
423
|
+
export type DataformUpdateItemOptions = {
|
|
424
|
+
itemId: string;
|
|
425
|
+
data: object;
|
|
426
|
+
viewId?: string;
|
|
427
|
+
};
|
|
428
|
+
export type DataformGetItemOptions = {
|
|
429
|
+
itemId: string;
|
|
430
|
+
viewId?: string;
|
|
431
|
+
};
|
|
432
|
+
export type DataformDeleteItemOptions = {
|
|
433
|
+
itemId: string;
|
|
434
|
+
viewId?: string;
|
|
435
|
+
};
|
|
436
|
+
export type DataformDiscardItemOptions = {
|
|
437
|
+
viewId?: string;
|
|
438
|
+
};
|
|
439
|
+
export type DataformSubmitItemOptions = {
|
|
440
|
+
itemId: string;
|
|
441
|
+
data?: object;
|
|
442
|
+
viewId?: string;
|
|
443
|
+
};
|
|
444
|
+
export type BoardGetItemsOptions = BaseQueryOptions & {
|
|
445
|
+
viewId?: string;
|
|
446
|
+
payload?: PayloadOptions;
|
|
447
|
+
};
|
|
448
|
+
export type BoardQueryResponse = QueryResponse;
|
|
449
|
+
export type BoardGetItemOptions = {
|
|
450
|
+
instanceId: string;
|
|
451
|
+
};
|
|
452
|
+
export type BoardCreateItemOptions = {
|
|
453
|
+
data?: object;
|
|
454
|
+
};
|
|
455
|
+
export type BoardUpdateItemOptions = {
|
|
456
|
+
instanceId: string;
|
|
457
|
+
data: object;
|
|
458
|
+
};
|
|
459
|
+
export type BoardDeleteItemOptions = {
|
|
460
|
+
instanceId: string;
|
|
461
|
+
};
|
|
462
|
+
export type BoardSubmitItemOptions = {
|
|
463
|
+
instanceId: string;
|
|
464
|
+
comment?: string;
|
|
465
|
+
};
|
|
466
|
+
export type BoardDiscardItemOptions = {
|
|
467
|
+
instanceId: string;
|
|
468
|
+
};
|
|
200
469
|
}
|
|
201
470
|
declare module "types/internal" {
|
|
202
471
|
import { userObject, accountObject, environmentObject } from "types/external";
|
|
@@ -277,16 +546,6 @@ declare module "app/component" {
|
|
|
277
546
|
watchParams(callBack: (data: any) => any): void;
|
|
278
547
|
}
|
|
279
548
|
}
|
|
280
|
-
declare module "app/dataform" {
|
|
281
|
-
import { BaseSDK } from "core/index";
|
|
282
|
-
import { DataformItem } from "types/external";
|
|
283
|
-
export class Dataform extends BaseSDK {
|
|
284
|
-
private _id;
|
|
285
|
-
constructor(flowId: string);
|
|
286
|
-
importCSV(defaultValues?: object): any;
|
|
287
|
-
openForm(item: DataformItem): any;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
549
|
declare module "app/decisiontable" {
|
|
291
550
|
import { BaseSDK } from "core/index";
|
|
292
551
|
export class DecisionTable extends BaseSDK {
|
|
@@ -336,23 +595,353 @@ declare module "app/page" {
|
|
|
336
595
|
getComponent(componentId: string): Component;
|
|
337
596
|
}
|
|
338
597
|
}
|
|
598
|
+
declare module "dataform/index" {
|
|
599
|
+
import { BaseSDK } from "core/index";
|
|
600
|
+
import { DataformItem, DataformQueryOptions, DataformQueryResponse, DataformCreateItemOptions, DataformUpdateItemOptions, DataformGetItemOptions, DataformDeleteItemOptions, DataformDiscardItemOptions, DataformSubmitItemOptions } from "types/external";
|
|
601
|
+
export class Dataform extends BaseSDK {
|
|
602
|
+
private _id;
|
|
603
|
+
constructor(flowId: string);
|
|
604
|
+
/**
|
|
605
|
+
* Get all items from this dataform with optional filtering, sorting, and pagination
|
|
606
|
+
* @param options - Query options (searchValue, pageNumber, pageSize, payload)
|
|
607
|
+
* @returns Promise containing items and total count
|
|
608
|
+
*/
|
|
609
|
+
getItems(options?: DataformQueryOptions): Promise<DataformQueryResponse>;
|
|
610
|
+
/**
|
|
611
|
+
* Get a single item by ID from this dataform
|
|
612
|
+
* @param options - itemId (required), optional viewId
|
|
613
|
+
* @returns Promise containing the item data
|
|
614
|
+
*/
|
|
615
|
+
getItem(options: DataformGetItemOptions): Promise<DataformItem>;
|
|
616
|
+
/**
|
|
617
|
+
* Create a new item in this dataform
|
|
618
|
+
* @param options - Creation options (data: initial field values, viewId: optional view ID)
|
|
619
|
+
* @returns Promise containing the newly created item with _id
|
|
620
|
+
*/
|
|
621
|
+
createItem(options?: DataformCreateItemOptions): Promise<DataformItem>;
|
|
622
|
+
/**
|
|
623
|
+
* Update an existing item in this dataform
|
|
624
|
+
* @param options - Update options (itemId: required, data: required updated values, viewId: optional view ID)
|
|
625
|
+
* @returns Promise containing the updated item
|
|
626
|
+
*/
|
|
627
|
+
updateItem(options: DataformUpdateItemOptions): Promise<DataformItem>;
|
|
628
|
+
/**
|
|
629
|
+
* Import items from a CSV file into this dataform
|
|
630
|
+
* @param defaultValues - Optional default field values to apply to all imported items
|
|
631
|
+
*/
|
|
632
|
+
importCSV(defaultValues?: object): any;
|
|
633
|
+
/**
|
|
634
|
+
* Open the form UI for an existing dataform item
|
|
635
|
+
* @param item - Dataform item with _id
|
|
636
|
+
*/
|
|
637
|
+
openForm(item: DataformItem): any;
|
|
638
|
+
/**
|
|
639
|
+
* Delete an item from this dataform
|
|
640
|
+
* @param options - itemId (required), optional viewId
|
|
641
|
+
*
|
|
642
|
+
* @example
|
|
643
|
+
* await dataform.deleteItem({ itemId: "item_123" });
|
|
644
|
+
*/
|
|
645
|
+
deleteItem(options: DataformDeleteItemOptions): Promise<void>;
|
|
646
|
+
/**
|
|
647
|
+
* Discard the current draft for this dataform
|
|
648
|
+
* @param options - optional viewId
|
|
649
|
+
*
|
|
650
|
+
* @example
|
|
651
|
+
* await dataform.discardItem();
|
|
652
|
+
*/
|
|
653
|
+
discardItem(options?: DataformDiscardItemOptions): Promise<void>;
|
|
654
|
+
/**
|
|
655
|
+
* Submit/finalize a dataform item
|
|
656
|
+
* @param options - itemId (required), optional data and viewId
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* await dataform.submitItem({ itemId: "item_123" });
|
|
660
|
+
*/
|
|
661
|
+
submitItem(options: DataformSubmitItemOptions): Promise<void>;
|
|
662
|
+
/**
|
|
663
|
+
* Get field definitions for this dataform
|
|
664
|
+
* @param options - Optional viewId to scope fields to a specific view
|
|
665
|
+
*/
|
|
666
|
+
getFields(options?: {
|
|
667
|
+
viewId?: string;
|
|
668
|
+
}): Promise<any>;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
339
671
|
declare module "board/index" {
|
|
340
672
|
import { BaseSDK } from "core/index";
|
|
341
|
-
import { BoardItem } from "types/external";
|
|
673
|
+
import { BoardItem, BoardGetItemOptions, BoardGetItemsOptions, BoardQueryResponse, BoardCreateItemOptions, BoardUpdateItemOptions, BoardDeleteItemOptions, BoardSubmitItemOptions, BoardDiscardItemOptions } from "types/external";
|
|
342
674
|
export class Board extends BaseSDK {
|
|
343
675
|
private _id;
|
|
344
676
|
constructor(flowId: string);
|
|
677
|
+
/**
|
|
678
|
+
* Import data from CSV file
|
|
679
|
+
* @param defaultValues - Optional default values to apply to imported items
|
|
680
|
+
*/
|
|
345
681
|
importCSV(defaultValues?: object): any;
|
|
682
|
+
/**
|
|
683
|
+
* Open the form UI for a board item
|
|
684
|
+
* @param item - Board item with _id and optional _view_id
|
|
685
|
+
*/
|
|
346
686
|
openForm(item: BoardItem): any;
|
|
687
|
+
/**
|
|
688
|
+
* Get items from a board view
|
|
689
|
+
* @param options - Query options (viewId, searchValue, pageNumber, pageSize, payload)
|
|
690
|
+
* @returns Promise containing items array and total count
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* const board = kf.app.getBoard("Inventory");
|
|
694
|
+
* const { items } = await board.getItems({ viewId: "AllItems_View" });
|
|
695
|
+
*/
|
|
696
|
+
getItems(options?: BoardGetItemsOptions): Promise<BoardQueryResponse>;
|
|
697
|
+
/**
|
|
698
|
+
* Get a single board/case item by instance ID
|
|
699
|
+
* @param options - instanceId (required)
|
|
700
|
+
* @returns Promise containing the item data
|
|
701
|
+
*/
|
|
702
|
+
getItem(options: BoardGetItemOptions): Promise<BoardItem>;
|
|
703
|
+
/**
|
|
704
|
+
* Create a new board item
|
|
705
|
+
* @param options - Creation options (data: initial field values)
|
|
706
|
+
* @returns Promise containing the newly created item with _id
|
|
707
|
+
*
|
|
708
|
+
* @example
|
|
709
|
+
* const board = kf.app.getBoard("Inventory");
|
|
710
|
+
* const item = await board.createItem({ data: { Name: "New Item" } });
|
|
711
|
+
*/
|
|
712
|
+
createItem(options?: BoardCreateItemOptions): Promise<BoardItem>;
|
|
713
|
+
/**
|
|
714
|
+
* Update an existing board item
|
|
715
|
+
* @param options - Update options (instanceId, data)
|
|
716
|
+
* @returns Promise containing the updated item
|
|
717
|
+
*
|
|
718
|
+
* @example
|
|
719
|
+
* const board = kf.app.getBoard("Inventory");
|
|
720
|
+
* await board.updateItem({
|
|
721
|
+
* instanceId: "item_123",
|
|
722
|
+
* data: { Name: "Updated Item" }
|
|
723
|
+
* });
|
|
724
|
+
*/
|
|
725
|
+
updateItem(options: BoardUpdateItemOptions): Promise<BoardItem>;
|
|
726
|
+
/**
|
|
727
|
+
* Delete a board item
|
|
728
|
+
* @param options - Delete options (instanceId)
|
|
729
|
+
* @returns Promise resolving on successful deletion
|
|
730
|
+
*
|
|
731
|
+
* @example
|
|
732
|
+
* const board = kf.app.getBoard("Inventory");
|
|
733
|
+
* await board.deleteItem({ instanceId: "item_123" });
|
|
734
|
+
*/
|
|
735
|
+
deleteItem(options: BoardDeleteItemOptions): Promise<void>;
|
|
736
|
+
/**
|
|
737
|
+
* Submit a board item
|
|
738
|
+
* @param options - instanceId
|
|
739
|
+
*/
|
|
740
|
+
submitItem(options: BoardSubmitItemOptions): Promise<void>;
|
|
741
|
+
/**
|
|
742
|
+
* Discard a board item
|
|
743
|
+
* @param options - instanceId
|
|
744
|
+
*/
|
|
745
|
+
discardItem(options: BoardDiscardItemOptions): Promise<void>;
|
|
746
|
+
/**
|
|
747
|
+
* Get field definitions for this board
|
|
748
|
+
* @param options - Optional viewId to scope fields to a specific view
|
|
749
|
+
*/
|
|
750
|
+
getFields(options?: {
|
|
751
|
+
viewId?: string;
|
|
752
|
+
}): Promise<any>;
|
|
347
753
|
}
|
|
348
754
|
}
|
|
349
755
|
declare module "process/index" {
|
|
350
756
|
import { BaseSDK } from "core/index";
|
|
351
|
-
import { ProcessItem } from "types/external";
|
|
757
|
+
import { ProcessItem, ProcessGetItemOptions, ProcessMyItemsOptions, ProcessMyTasksOptions, ProcessParticipatedOptions, ProcessAdminOptions, ProcessQueryResponse, ProcessCreateItemOptions, ProcessUpdateItemOptions, ProcessDeleteItemOptions, ProcessSubmitItemOptions, ProcessRejectItemOptions, ProcessWithdrawItemOptions, ProcessSendbackItemOptions, ProcessReassignItemOptions, ProcessGetReassigneesOptions, ProcessRestartItemOptions, ProcessDiscardItemOptions } from "types/external";
|
|
352
758
|
export class Process extends BaseSDK {
|
|
353
759
|
private _id;
|
|
354
760
|
constructor(flowId: string);
|
|
761
|
+
/**
|
|
762
|
+
* Get my items from this process (items I initiated)
|
|
763
|
+
* @param options - Query options (status, searchValue, pageNumber, pageSize, payload)
|
|
764
|
+
* @returns Promise containing items and total count
|
|
765
|
+
*
|
|
766
|
+
* @example
|
|
767
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
768
|
+
* // Get draft items
|
|
769
|
+
* const { items } = await process.getMyItems({ status: "draft" });
|
|
770
|
+
* // Get in-progress items
|
|
771
|
+
* const { items } = await process.getMyItems({ status: "inprogress" });
|
|
772
|
+
*/
|
|
773
|
+
getMyItems(options?: ProcessMyItemsOptions): Promise<ProcessQueryResponse>;
|
|
774
|
+
/**
|
|
775
|
+
* Get my pending tasks from this process (tasks assigned to me)
|
|
776
|
+
* @param options - Query options (activityId, searchValue, pageNumber, pageSize, payload)
|
|
777
|
+
* @returns Promise containing tasks and total count
|
|
778
|
+
*
|
|
779
|
+
* @example
|
|
780
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
781
|
+
* // Get all pending tasks
|
|
782
|
+
* const { items } = await process.getMyTasksItems();
|
|
783
|
+
* // Get tasks for specific activity/step
|
|
784
|
+
* const { items } = await process.getMyTasksItems({ activityId: "Approval_Step" });
|
|
785
|
+
*/
|
|
786
|
+
getMyTasksItems(options?: ProcessMyTasksOptions): Promise<ProcessQueryResponse>;
|
|
787
|
+
/**
|
|
788
|
+
* Get items I participated in (items where I took action)
|
|
789
|
+
* @param options - Query options (activityId, searchValue, pageNumber, pageSize, payload)
|
|
790
|
+
* @returns Promise containing items and total count
|
|
791
|
+
*
|
|
792
|
+
* @example
|
|
793
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
794
|
+
* const { items } = await process.getParticipatedItems();
|
|
795
|
+
*/
|
|
796
|
+
getParticipatedItems(options?: ProcessParticipatedOptions): Promise<ProcessQueryResponse>;
|
|
797
|
+
/**
|
|
798
|
+
* Get all items as admin (requires admin access)
|
|
799
|
+
* @param options - Query options (searchValue, pageNumber, pageSize, payload)
|
|
800
|
+
* @returns Promise containing items and total count
|
|
801
|
+
*
|
|
802
|
+
* @example
|
|
803
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
804
|
+
* const { items } = await process.getAdminItems();
|
|
805
|
+
*/
|
|
806
|
+
getAdminItems(options?: ProcessAdminOptions): Promise<ProcessQueryResponse>;
|
|
807
|
+
/**
|
|
808
|
+
* Get a single process instance by ID
|
|
809
|
+
* @param options - instanceId (required)
|
|
810
|
+
* @returns Promise containing the instance data
|
|
811
|
+
*/
|
|
812
|
+
getItem(options: ProcessGetItemOptions): Promise<ProcessItem>;
|
|
813
|
+
/**
|
|
814
|
+
* Create a new process instance (start a new process)
|
|
815
|
+
* @param options - Creation options (data: initial field values)
|
|
816
|
+
* @returns Promise containing the newly created process item with _id and _activity_instance_id
|
|
817
|
+
*
|
|
818
|
+
* @example
|
|
819
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
820
|
+
* const item = await process.createItem({ data: { LeaveType: "Annual" } });
|
|
821
|
+
*/
|
|
822
|
+
createItem(options?: ProcessCreateItemOptions): Promise<ProcessItem>;
|
|
823
|
+
/**
|
|
824
|
+
* Update an existing process instance
|
|
825
|
+
* @param options - Update options (instanceId, activityInstanceId, data)
|
|
826
|
+
* @returns Promise containing the updated item
|
|
827
|
+
*
|
|
828
|
+
* @example
|
|
829
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
830
|
+
* await process.updateItem({
|
|
831
|
+
* instanceId: "item_123",
|
|
832
|
+
* activityInstanceId: "activity_456",
|
|
833
|
+
* data: { LeaveType: "Sick" }
|
|
834
|
+
* });
|
|
835
|
+
*/
|
|
836
|
+
updateItem(options: ProcessUpdateItemOptions): Promise<ProcessItem>;
|
|
837
|
+
/**
|
|
838
|
+
* Delete a process instance
|
|
839
|
+
* @param options - Delete options (instanceId)
|
|
840
|
+
* @returns Promise resolving on successful deletion
|
|
841
|
+
*
|
|
842
|
+
* @example
|
|
843
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
844
|
+
* await process.deleteItem({ instanceId: "item_123" });
|
|
845
|
+
*/
|
|
846
|
+
deleteItem(options: ProcessDeleteItemOptions): Promise<void>;
|
|
847
|
+
/**
|
|
848
|
+
* Open the form UI for a process instance
|
|
849
|
+
* @param item - Process item with _id and _activity_instance_id
|
|
850
|
+
*/
|
|
355
851
|
openForm(item: ProcessItem): any;
|
|
852
|
+
/**
|
|
853
|
+
* Submit a process task
|
|
854
|
+
* @param options - instanceId, activityInstanceId, optional comment
|
|
855
|
+
*
|
|
856
|
+
* @example
|
|
857
|
+
* await process.submitItem({ instanceId: "item_123", activityInstanceId: "act_456" });
|
|
858
|
+
*/
|
|
859
|
+
submitItem(options: ProcessSubmitItemOptions): Promise<void>;
|
|
860
|
+
/**
|
|
861
|
+
* Reject a process task
|
|
862
|
+
* @param options - instanceId, activityInstanceId, comment (required)
|
|
863
|
+
*
|
|
864
|
+
* @example
|
|
865
|
+
* await process.reject({ instanceId: "item_123", activityInstanceId: "act_456", comment: "Not approved" });
|
|
866
|
+
*/
|
|
867
|
+
rejectItem(options: ProcessRejectItemOptions): Promise<void>;
|
|
868
|
+
/**
|
|
869
|
+
* Withdraw a process instance (initiator only)
|
|
870
|
+
* @param options - instanceId, optional comment
|
|
871
|
+
*
|
|
872
|
+
* @example
|
|
873
|
+
* await process.withdraw({ instanceId: "item_123", comment: "Withdrawing request" });
|
|
874
|
+
*/
|
|
875
|
+
withdrawItem(options: ProcessWithdrawItemOptions): Promise<void>;
|
|
876
|
+
/**
|
|
877
|
+
* Send back a process task to a previous step
|
|
878
|
+
* @param options - instanceId, activityInstanceId, stepId (target step), comment (required)
|
|
879
|
+
*
|
|
880
|
+
* @example
|
|
881
|
+
* await process.sendback({ instanceId: "item_123", activityInstanceId: "act_456", stepId: "step_789", comment: "Please revise" });
|
|
882
|
+
*/
|
|
883
|
+
sendbackItem(options: ProcessSendbackItemOptions): Promise<void>;
|
|
884
|
+
/**
|
|
885
|
+
* Reassign a process task to another user
|
|
886
|
+
* @param options - instanceId, activityInstanceId, reassignTo (user object), comment (required), optional reassignType and reassignedFrom
|
|
887
|
+
*
|
|
888
|
+
* @example
|
|
889
|
+
* await process.reassign({ instanceId: "item_123", activityInstanceId: "act_456", reassignTo: { _id: "user_789" }, comment: "Reassigning to manager" });
|
|
890
|
+
*/
|
|
891
|
+
reassignItem(options: ProcessReassignItemOptions): Promise<void>;
|
|
892
|
+
/**
|
|
893
|
+
* Get list of eligible reassignees for a process task
|
|
894
|
+
* @param options - instanceId, activityInstanceId, optional pageNumber, pageSize, query
|
|
895
|
+
*/
|
|
896
|
+
getReassignees(options: ProcessGetReassigneesOptions): Promise<any>;
|
|
897
|
+
/**
|
|
898
|
+
* Restart a rejected/withdrawn process instance
|
|
899
|
+
* @param options - instanceId, activityInstanceId
|
|
900
|
+
*
|
|
901
|
+
* @example
|
|
902
|
+
* await process.restart({ instanceId: "item_123", activityInstanceId: "act_456" });
|
|
903
|
+
*/
|
|
904
|
+
restartItem(options: ProcessRestartItemOptions): Promise<void>;
|
|
905
|
+
/**
|
|
906
|
+
* Discard a draft process instance
|
|
907
|
+
* @param options - instanceId
|
|
908
|
+
*
|
|
909
|
+
* @example
|
|
910
|
+
* await process.discard({ instanceId: "item_123" });
|
|
911
|
+
*/
|
|
912
|
+
discardItem(options: ProcessDiscardItemOptions): Promise<void>;
|
|
913
|
+
/**
|
|
914
|
+
* Get field definitions for this process
|
|
915
|
+
*/
|
|
916
|
+
getFields(): Promise<any>;
|
|
917
|
+
/**
|
|
918
|
+
* Get field definitions for a specific task step (my tasks view)
|
|
919
|
+
* @param options - activityId of the target step
|
|
920
|
+
*/
|
|
921
|
+
getMyTaskFields(options: {
|
|
922
|
+
activityId: string;
|
|
923
|
+
}): Promise<any>;
|
|
924
|
+
/**
|
|
925
|
+
* Get field definitions for a specific task step (participated view)
|
|
926
|
+
* @param options - activityId of the target step
|
|
927
|
+
*/
|
|
928
|
+
getParticipatedFields(options: {
|
|
929
|
+
activityId: string;
|
|
930
|
+
}): Promise<any>;
|
|
931
|
+
/**
|
|
932
|
+
* Get field definitions for the my items view filtered by status
|
|
933
|
+
* @param options - status filter (e.g. "draft", "inprogress", "all")
|
|
934
|
+
*/
|
|
935
|
+
getMyItemsFields(options: {
|
|
936
|
+
status: string;
|
|
937
|
+
}): Promise<any>;
|
|
938
|
+
/**
|
|
939
|
+
* Get the progress/timeline of a process instance
|
|
940
|
+
* @param options - instanceId (required)
|
|
941
|
+
*/
|
|
942
|
+
getProgress(options: {
|
|
943
|
+
instanceId: string;
|
|
944
|
+
}): Promise<any>;
|
|
356
945
|
}
|
|
357
946
|
}
|
|
358
947
|
declare module "app/index" {
|
|
@@ -360,7 +949,7 @@ declare module "app/index" {
|
|
|
360
949
|
import { Page } from "app/page";
|
|
361
950
|
import { AppContext } from "types/internal";
|
|
362
951
|
import { DecisionTable } from "app/decisiontable";
|
|
363
|
-
import { Dataform } from "
|
|
952
|
+
import { Dataform } from "dataform/index";
|
|
364
953
|
import { Board } from "board/index";
|
|
365
954
|
import { Process } from "process/index";
|
|
366
955
|
export class Application extends BaseSDK {
|