@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/lowcode.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 "core/proxy" {
|
|
@@ -154,6 +270,32 @@ declare module "core/proxy" {
|
|
|
154
270
|
}
|
|
155
271
|
}
|
|
156
272
|
declare module "types/external" {
|
|
273
|
+
export type QueryResponse = {
|
|
274
|
+
items: any[];
|
|
275
|
+
total: number;
|
|
276
|
+
page?: number;
|
|
277
|
+
pageSize?: number;
|
|
278
|
+
};
|
|
279
|
+
export type BaseQueryOptions = {
|
|
280
|
+
searchValue?: string;
|
|
281
|
+
pageNumber?: number;
|
|
282
|
+
pageSize?: number;
|
|
283
|
+
};
|
|
284
|
+
export type PayloadSortItem = {
|
|
285
|
+
Id: string;
|
|
286
|
+
SortType: "ASC" | "DESC";
|
|
287
|
+
};
|
|
288
|
+
export type PayloadOptions = {
|
|
289
|
+
Columns?: any[];
|
|
290
|
+
Filters?: any;
|
|
291
|
+
Sort?: PayloadSortItem[];
|
|
292
|
+
FilterParam?: any;
|
|
293
|
+
};
|
|
294
|
+
export type ProcessPayloadOptions = {
|
|
295
|
+
Columns?: any[];
|
|
296
|
+
Filters?: any;
|
|
297
|
+
Sort?: PayloadSortItem[];
|
|
298
|
+
};
|
|
157
299
|
export type userObject = {
|
|
158
300
|
_id: string;
|
|
159
301
|
Name: string;
|
|
@@ -183,11 +325,138 @@ declare module "types/external" {
|
|
|
183
325
|
_id: string;
|
|
184
326
|
_activity_instance_id: string;
|
|
185
327
|
};
|
|
328
|
+
export type ProcessMyItemsOptions = BaseQueryOptions & {
|
|
329
|
+
status?: "draft" | "inprogress" | "completed" | "withdrawn" | "rejected" | "all";
|
|
330
|
+
payload?: ProcessPayloadOptions;
|
|
331
|
+
};
|
|
332
|
+
export type ProcessMyTasksOptions = BaseQueryOptions & {
|
|
333
|
+
activityId?: string;
|
|
334
|
+
payload?: ProcessPayloadOptions;
|
|
335
|
+
};
|
|
336
|
+
export type ProcessParticipatedOptions = BaseQueryOptions & {
|
|
337
|
+
activityId?: string;
|
|
338
|
+
payload?: ProcessPayloadOptions;
|
|
339
|
+
};
|
|
340
|
+
export type ProcessAdminOptions = BaseQueryOptions & {
|
|
341
|
+
payload?: ProcessPayloadOptions;
|
|
342
|
+
};
|
|
343
|
+
export type ProcessQueryResponse = QueryResponse;
|
|
344
|
+
export type ProcessGetItemOptions = {
|
|
345
|
+
instanceId: string;
|
|
346
|
+
};
|
|
347
|
+
export type ProcessCreateItemOptions = {
|
|
348
|
+
data?: object;
|
|
349
|
+
};
|
|
350
|
+
export type ProcessUpdateItemOptions = {
|
|
351
|
+
instanceId: string;
|
|
352
|
+
activityInstanceId: string;
|
|
353
|
+
data: object;
|
|
354
|
+
};
|
|
355
|
+
export type ProcessDeleteItemOptions = {
|
|
356
|
+
instanceId: string;
|
|
357
|
+
};
|
|
358
|
+
export type ProcessSubmitItemOptions = {
|
|
359
|
+
instanceId: string;
|
|
360
|
+
activityInstanceId: string;
|
|
361
|
+
comment?: string;
|
|
362
|
+
};
|
|
363
|
+
export type ProcessRejectItemOptions = {
|
|
364
|
+
instanceId: string;
|
|
365
|
+
activityInstanceId: string;
|
|
366
|
+
comment: string;
|
|
367
|
+
};
|
|
368
|
+
export type ProcessWithdrawItemOptions = {
|
|
369
|
+
instanceId: string;
|
|
370
|
+
comment?: string;
|
|
371
|
+
};
|
|
372
|
+
export type ProcessSendbackItemOptions = {
|
|
373
|
+
instanceId: string;
|
|
374
|
+
activityInstanceId: string;
|
|
375
|
+
stepId: string;
|
|
376
|
+
comment: string;
|
|
377
|
+
};
|
|
378
|
+
export type ProcessReassignItemOptions = {
|
|
379
|
+
instanceId: string;
|
|
380
|
+
activityInstanceId: string;
|
|
381
|
+
reassignTo: object;
|
|
382
|
+
comment: string;
|
|
383
|
+
reassignType?: "initiator" | "approver" | "admin";
|
|
384
|
+
reassignedFrom?: object[];
|
|
385
|
+
};
|
|
386
|
+
export type ProcessGetReassigneesOptions = {
|
|
387
|
+
instanceId: string;
|
|
388
|
+
activityInstanceId: string;
|
|
389
|
+
pageNumber?: number;
|
|
390
|
+
pageSize?: number;
|
|
391
|
+
query?: string;
|
|
392
|
+
};
|
|
393
|
+
export type ProcessRestartItemOptions = {
|
|
394
|
+
instanceId: string;
|
|
395
|
+
activityInstanceId: string;
|
|
396
|
+
};
|
|
397
|
+
export type ProcessDiscardItemOptions = {
|
|
398
|
+
instanceId: string;
|
|
399
|
+
};
|
|
186
400
|
export type FetchOptions = {
|
|
187
401
|
method?: string;
|
|
188
402
|
body?: string | object;
|
|
189
403
|
headers?: object;
|
|
190
404
|
};
|
|
405
|
+
export type DataformQueryOptions = BaseQueryOptions & {
|
|
406
|
+
viewId?: string;
|
|
407
|
+
payload?: PayloadOptions;
|
|
408
|
+
};
|
|
409
|
+
export type DataformQueryResponse = QueryResponse;
|
|
410
|
+
export type DataformCreateItemOptions = {
|
|
411
|
+
data?: object;
|
|
412
|
+
viewId?: string;
|
|
413
|
+
};
|
|
414
|
+
export type DataformUpdateItemOptions = {
|
|
415
|
+
itemId: string;
|
|
416
|
+
data: object;
|
|
417
|
+
viewId?: string;
|
|
418
|
+
};
|
|
419
|
+
export type DataformGetItemOptions = {
|
|
420
|
+
itemId: string;
|
|
421
|
+
viewId?: string;
|
|
422
|
+
};
|
|
423
|
+
export type DataformDeleteItemOptions = {
|
|
424
|
+
itemId: string;
|
|
425
|
+
viewId?: string;
|
|
426
|
+
};
|
|
427
|
+
export type DataformDiscardItemOptions = {
|
|
428
|
+
viewId?: string;
|
|
429
|
+
};
|
|
430
|
+
export type DataformSubmitItemOptions = {
|
|
431
|
+
itemId: string;
|
|
432
|
+
data?: object;
|
|
433
|
+
viewId?: string;
|
|
434
|
+
};
|
|
435
|
+
export type BoardGetItemsOptions = BaseQueryOptions & {
|
|
436
|
+
viewId?: string;
|
|
437
|
+
payload?: PayloadOptions;
|
|
438
|
+
};
|
|
439
|
+
export type BoardQueryResponse = QueryResponse;
|
|
440
|
+
export type BoardGetItemOptions = {
|
|
441
|
+
instanceId: string;
|
|
442
|
+
};
|
|
443
|
+
export type BoardCreateItemOptions = {
|
|
444
|
+
data?: object;
|
|
445
|
+
};
|
|
446
|
+
export type BoardUpdateItemOptions = {
|
|
447
|
+
instanceId: string;
|
|
448
|
+
data: object;
|
|
449
|
+
};
|
|
450
|
+
export type BoardDeleteItemOptions = {
|
|
451
|
+
instanceId: string;
|
|
452
|
+
};
|
|
453
|
+
export type BoardSubmitItemOptions = {
|
|
454
|
+
instanceId: string;
|
|
455
|
+
comment?: string;
|
|
456
|
+
};
|
|
457
|
+
export type BoardDiscardItemOptions = {
|
|
458
|
+
instanceId: string;
|
|
459
|
+
};
|
|
191
460
|
}
|
|
192
461
|
declare module "types/internal" {
|
|
193
462
|
import { userObject, accountObject, environmentObject } from "types/external";
|
|
@@ -287,33 +556,353 @@ declare module "app/decisiontable" {
|
|
|
287
556
|
evaluate(payload?: object): any;
|
|
288
557
|
}
|
|
289
558
|
}
|
|
290
|
-
declare module "
|
|
559
|
+
declare module "dataform/index" {
|
|
291
560
|
import { BaseSDK } from "core/index";
|
|
292
|
-
import { DataformItem } from "types/external";
|
|
561
|
+
import { DataformItem, DataformQueryOptions, DataformQueryResponse, DataformCreateItemOptions, DataformUpdateItemOptions, DataformGetItemOptions, DataformDeleteItemOptions, DataformDiscardItemOptions, DataformSubmitItemOptions } from "types/external";
|
|
293
562
|
export class Dataform extends BaseSDK {
|
|
294
563
|
private _id;
|
|
295
564
|
constructor(flowId: string);
|
|
565
|
+
/**
|
|
566
|
+
* Get all items from this dataform with optional filtering, sorting, and pagination
|
|
567
|
+
* @param options - Query options (searchValue, pageNumber, pageSize, payload)
|
|
568
|
+
* @returns Promise containing items and total count
|
|
569
|
+
*/
|
|
570
|
+
getItems(options?: DataformQueryOptions): Promise<DataformQueryResponse>;
|
|
571
|
+
/**
|
|
572
|
+
* Get a single item by ID from this dataform
|
|
573
|
+
* @param options - itemId (required), optional viewId
|
|
574
|
+
* @returns Promise containing the item data
|
|
575
|
+
*/
|
|
576
|
+
getItem(options: DataformGetItemOptions): Promise<DataformItem>;
|
|
577
|
+
/**
|
|
578
|
+
* Create a new item in this dataform
|
|
579
|
+
* @param options - Creation options (data: initial field values, viewId: optional view ID)
|
|
580
|
+
* @returns Promise containing the newly created item with _id
|
|
581
|
+
*/
|
|
582
|
+
createItem(options?: DataformCreateItemOptions): Promise<DataformItem>;
|
|
583
|
+
/**
|
|
584
|
+
* Update an existing item in this dataform
|
|
585
|
+
* @param options - Update options (itemId: required, data: required updated values, viewId: optional view ID)
|
|
586
|
+
* @returns Promise containing the updated item
|
|
587
|
+
*/
|
|
588
|
+
updateItem(options: DataformUpdateItemOptions): Promise<DataformItem>;
|
|
589
|
+
/**
|
|
590
|
+
* Import items from a CSV file into this dataform
|
|
591
|
+
* @param defaultValues - Optional default field values to apply to all imported items
|
|
592
|
+
*/
|
|
296
593
|
importCSV(defaultValues?: object): any;
|
|
594
|
+
/**
|
|
595
|
+
* Open the form UI for an existing dataform item
|
|
596
|
+
* @param item - Dataform item with _id
|
|
597
|
+
*/
|
|
297
598
|
openForm(item: DataformItem): any;
|
|
599
|
+
/**
|
|
600
|
+
* Delete an item from this dataform
|
|
601
|
+
* @param options - itemId (required), optional viewId
|
|
602
|
+
*
|
|
603
|
+
* @example
|
|
604
|
+
* await dataform.deleteItem({ itemId: "item_123" });
|
|
605
|
+
*/
|
|
606
|
+
deleteItem(options: DataformDeleteItemOptions): Promise<void>;
|
|
607
|
+
/**
|
|
608
|
+
* Discard the current draft for this dataform
|
|
609
|
+
* @param options - optional viewId
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* await dataform.discardItem();
|
|
613
|
+
*/
|
|
614
|
+
discardItem(options?: DataformDiscardItemOptions): Promise<void>;
|
|
615
|
+
/**
|
|
616
|
+
* Submit/finalize a dataform item
|
|
617
|
+
* @param options - itemId (required), optional data and viewId
|
|
618
|
+
*
|
|
619
|
+
* @example
|
|
620
|
+
* await dataform.submitItem({ itemId: "item_123" });
|
|
621
|
+
*/
|
|
622
|
+
submitItem(options: DataformSubmitItemOptions): Promise<void>;
|
|
623
|
+
/**
|
|
624
|
+
* Get field definitions for this dataform
|
|
625
|
+
* @param options - Optional viewId to scope fields to a specific view
|
|
626
|
+
*/
|
|
627
|
+
getFields(options?: {
|
|
628
|
+
viewId?: string;
|
|
629
|
+
}): Promise<any>;
|
|
298
630
|
}
|
|
299
631
|
}
|
|
300
632
|
declare module "board/index" {
|
|
301
633
|
import { BaseSDK } from "core/index";
|
|
302
|
-
import { BoardItem } from "types/external";
|
|
634
|
+
import { BoardItem, BoardGetItemOptions, BoardGetItemsOptions, BoardQueryResponse, BoardCreateItemOptions, BoardUpdateItemOptions, BoardDeleteItemOptions, BoardSubmitItemOptions, BoardDiscardItemOptions } from "types/external";
|
|
303
635
|
export class Board extends BaseSDK {
|
|
304
636
|
private _id;
|
|
305
637
|
constructor(flowId: string);
|
|
638
|
+
/**
|
|
639
|
+
* Import data from CSV file
|
|
640
|
+
* @param defaultValues - Optional default values to apply to imported items
|
|
641
|
+
*/
|
|
306
642
|
importCSV(defaultValues?: object): any;
|
|
643
|
+
/**
|
|
644
|
+
* Open the form UI for a board item
|
|
645
|
+
* @param item - Board item with _id and optional _view_id
|
|
646
|
+
*/
|
|
307
647
|
openForm(item: BoardItem): any;
|
|
648
|
+
/**
|
|
649
|
+
* Get items from a board view
|
|
650
|
+
* @param options - Query options (viewId, searchValue, pageNumber, pageSize, payload)
|
|
651
|
+
* @returns Promise containing items array and total count
|
|
652
|
+
*
|
|
653
|
+
* @example
|
|
654
|
+
* const board = kf.app.getBoard("Inventory");
|
|
655
|
+
* const { items } = await board.getItems({ viewId: "AllItems_View" });
|
|
656
|
+
*/
|
|
657
|
+
getItems(options?: BoardGetItemsOptions): Promise<BoardQueryResponse>;
|
|
658
|
+
/**
|
|
659
|
+
* Get a single board/case item by instance ID
|
|
660
|
+
* @param options - instanceId (required)
|
|
661
|
+
* @returns Promise containing the item data
|
|
662
|
+
*/
|
|
663
|
+
getItem(options: BoardGetItemOptions): Promise<BoardItem>;
|
|
664
|
+
/**
|
|
665
|
+
* Create a new board item
|
|
666
|
+
* @param options - Creation options (data: initial field values)
|
|
667
|
+
* @returns Promise containing the newly created item with _id
|
|
668
|
+
*
|
|
669
|
+
* @example
|
|
670
|
+
* const board = kf.app.getBoard("Inventory");
|
|
671
|
+
* const item = await board.createItem({ data: { Name: "New Item" } });
|
|
672
|
+
*/
|
|
673
|
+
createItem(options?: BoardCreateItemOptions): Promise<BoardItem>;
|
|
674
|
+
/**
|
|
675
|
+
* Update an existing board item
|
|
676
|
+
* @param options - Update options (instanceId, data)
|
|
677
|
+
* @returns Promise containing the updated item
|
|
678
|
+
*
|
|
679
|
+
* @example
|
|
680
|
+
* const board = kf.app.getBoard("Inventory");
|
|
681
|
+
* await board.updateItem({
|
|
682
|
+
* instanceId: "item_123",
|
|
683
|
+
* data: { Name: "Updated Item" }
|
|
684
|
+
* });
|
|
685
|
+
*/
|
|
686
|
+
updateItem(options: BoardUpdateItemOptions): Promise<BoardItem>;
|
|
687
|
+
/**
|
|
688
|
+
* Delete a board item
|
|
689
|
+
* @param options - Delete options (instanceId)
|
|
690
|
+
* @returns Promise resolving on successful deletion
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* const board = kf.app.getBoard("Inventory");
|
|
694
|
+
* await board.deleteItem({ instanceId: "item_123" });
|
|
695
|
+
*/
|
|
696
|
+
deleteItem(options: BoardDeleteItemOptions): Promise<void>;
|
|
697
|
+
/**
|
|
698
|
+
* Submit a board item
|
|
699
|
+
* @param options - instanceId
|
|
700
|
+
*/
|
|
701
|
+
submitItem(options: BoardSubmitItemOptions): Promise<void>;
|
|
702
|
+
/**
|
|
703
|
+
* Discard a board item
|
|
704
|
+
* @param options - instanceId
|
|
705
|
+
*/
|
|
706
|
+
discardItem(options: BoardDiscardItemOptions): Promise<void>;
|
|
707
|
+
/**
|
|
708
|
+
* Get field definitions for this board
|
|
709
|
+
* @param options - Optional viewId to scope fields to a specific view
|
|
710
|
+
*/
|
|
711
|
+
getFields(options?: {
|
|
712
|
+
viewId?: string;
|
|
713
|
+
}): Promise<any>;
|
|
308
714
|
}
|
|
309
715
|
}
|
|
310
716
|
declare module "process/index" {
|
|
311
717
|
import { BaseSDK } from "core/index";
|
|
312
|
-
import { ProcessItem } from "types/external";
|
|
718
|
+
import { ProcessItem, ProcessGetItemOptions, ProcessMyItemsOptions, ProcessMyTasksOptions, ProcessParticipatedOptions, ProcessAdminOptions, ProcessQueryResponse, ProcessCreateItemOptions, ProcessUpdateItemOptions, ProcessDeleteItemOptions, ProcessSubmitItemOptions, ProcessRejectItemOptions, ProcessWithdrawItemOptions, ProcessSendbackItemOptions, ProcessReassignItemOptions, ProcessGetReassigneesOptions, ProcessRestartItemOptions, ProcessDiscardItemOptions } from "types/external";
|
|
313
719
|
export class Process extends BaseSDK {
|
|
314
720
|
private _id;
|
|
315
721
|
constructor(flowId: string);
|
|
722
|
+
/**
|
|
723
|
+
* Get my items from this process (items I initiated)
|
|
724
|
+
* @param options - Query options (status, searchValue, pageNumber, pageSize, payload)
|
|
725
|
+
* @returns Promise containing items and total count
|
|
726
|
+
*
|
|
727
|
+
* @example
|
|
728
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
729
|
+
* // Get draft items
|
|
730
|
+
* const { items } = await process.getMyItems({ status: "draft" });
|
|
731
|
+
* // Get in-progress items
|
|
732
|
+
* const { items } = await process.getMyItems({ status: "inprogress" });
|
|
733
|
+
*/
|
|
734
|
+
getMyItems(options?: ProcessMyItemsOptions): Promise<ProcessQueryResponse>;
|
|
735
|
+
/**
|
|
736
|
+
* Get my pending tasks from this process (tasks assigned to me)
|
|
737
|
+
* @param options - Query options (activityId, searchValue, pageNumber, pageSize, payload)
|
|
738
|
+
* @returns Promise containing tasks and total count
|
|
739
|
+
*
|
|
740
|
+
* @example
|
|
741
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
742
|
+
* // Get all pending tasks
|
|
743
|
+
* const { items } = await process.getMyTasksItems();
|
|
744
|
+
* // Get tasks for specific activity/step
|
|
745
|
+
* const { items } = await process.getMyTasksItems({ activityId: "Approval_Step" });
|
|
746
|
+
*/
|
|
747
|
+
getMyTasksItems(options?: ProcessMyTasksOptions): Promise<ProcessQueryResponse>;
|
|
748
|
+
/**
|
|
749
|
+
* Get items I participated in (items where I took action)
|
|
750
|
+
* @param options - Query options (activityId, searchValue, pageNumber, pageSize, payload)
|
|
751
|
+
* @returns Promise containing items and total count
|
|
752
|
+
*
|
|
753
|
+
* @example
|
|
754
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
755
|
+
* const { items } = await process.getParticipatedItems();
|
|
756
|
+
*/
|
|
757
|
+
getParticipatedItems(options?: ProcessParticipatedOptions): Promise<ProcessQueryResponse>;
|
|
758
|
+
/**
|
|
759
|
+
* Get all items as admin (requires admin access)
|
|
760
|
+
* @param options - Query options (searchValue, pageNumber, pageSize, payload)
|
|
761
|
+
* @returns Promise containing items and total count
|
|
762
|
+
*
|
|
763
|
+
* @example
|
|
764
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
765
|
+
* const { items } = await process.getAdminItems();
|
|
766
|
+
*/
|
|
767
|
+
getAdminItems(options?: ProcessAdminOptions): Promise<ProcessQueryResponse>;
|
|
768
|
+
/**
|
|
769
|
+
* Get a single process instance by ID
|
|
770
|
+
* @param options - instanceId (required)
|
|
771
|
+
* @returns Promise containing the instance data
|
|
772
|
+
*/
|
|
773
|
+
getItem(options: ProcessGetItemOptions): Promise<ProcessItem>;
|
|
774
|
+
/**
|
|
775
|
+
* Create a new process instance (start a new process)
|
|
776
|
+
* @param options - Creation options (data: initial field values)
|
|
777
|
+
* @returns Promise containing the newly created process item with _id and _activity_instance_id
|
|
778
|
+
*
|
|
779
|
+
* @example
|
|
780
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
781
|
+
* const item = await process.createItem({ data: { LeaveType: "Annual" } });
|
|
782
|
+
*/
|
|
783
|
+
createItem(options?: ProcessCreateItemOptions): Promise<ProcessItem>;
|
|
784
|
+
/**
|
|
785
|
+
* Update an existing process instance
|
|
786
|
+
* @param options - Update options (instanceId, activityInstanceId, data)
|
|
787
|
+
* @returns Promise containing the updated item
|
|
788
|
+
*
|
|
789
|
+
* @example
|
|
790
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
791
|
+
* await process.updateItem({
|
|
792
|
+
* instanceId: "item_123",
|
|
793
|
+
* activityInstanceId: "activity_456",
|
|
794
|
+
* data: { LeaveType: "Sick" }
|
|
795
|
+
* });
|
|
796
|
+
*/
|
|
797
|
+
updateItem(options: ProcessUpdateItemOptions): Promise<ProcessItem>;
|
|
798
|
+
/**
|
|
799
|
+
* Delete a process instance
|
|
800
|
+
* @param options - Delete options (instanceId)
|
|
801
|
+
* @returns Promise resolving on successful deletion
|
|
802
|
+
*
|
|
803
|
+
* @example
|
|
804
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
805
|
+
* await process.deleteItem({ instanceId: "item_123" });
|
|
806
|
+
*/
|
|
807
|
+
deleteItem(options: ProcessDeleteItemOptions): Promise<void>;
|
|
808
|
+
/**
|
|
809
|
+
* Open the form UI for a process instance
|
|
810
|
+
* @param item - Process item with _id and _activity_instance_id
|
|
811
|
+
*/
|
|
316
812
|
openForm(item: ProcessItem): any;
|
|
813
|
+
/**
|
|
814
|
+
* Submit a process task
|
|
815
|
+
* @param options - instanceId, activityInstanceId, optional comment
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
818
|
+
* await process.submitItem({ instanceId: "item_123", activityInstanceId: "act_456" });
|
|
819
|
+
*/
|
|
820
|
+
submitItem(options: ProcessSubmitItemOptions): Promise<void>;
|
|
821
|
+
/**
|
|
822
|
+
* Reject a process task
|
|
823
|
+
* @param options - instanceId, activityInstanceId, comment (required)
|
|
824
|
+
*
|
|
825
|
+
* @example
|
|
826
|
+
* await process.reject({ instanceId: "item_123", activityInstanceId: "act_456", comment: "Not approved" });
|
|
827
|
+
*/
|
|
828
|
+
rejectItem(options: ProcessRejectItemOptions): Promise<void>;
|
|
829
|
+
/**
|
|
830
|
+
* Withdraw a process instance (initiator only)
|
|
831
|
+
* @param options - instanceId, optional comment
|
|
832
|
+
*
|
|
833
|
+
* @example
|
|
834
|
+
* await process.withdraw({ instanceId: "item_123", comment: "Withdrawing request" });
|
|
835
|
+
*/
|
|
836
|
+
withdrawItem(options: ProcessWithdrawItemOptions): Promise<void>;
|
|
837
|
+
/**
|
|
838
|
+
* Send back a process task to a previous step
|
|
839
|
+
* @param options - instanceId, activityInstanceId, stepId (target step), comment (required)
|
|
840
|
+
*
|
|
841
|
+
* @example
|
|
842
|
+
* await process.sendback({ instanceId: "item_123", activityInstanceId: "act_456", stepId: "step_789", comment: "Please revise" });
|
|
843
|
+
*/
|
|
844
|
+
sendbackItem(options: ProcessSendbackItemOptions): Promise<void>;
|
|
845
|
+
/**
|
|
846
|
+
* Reassign a process task to another user
|
|
847
|
+
* @param options - instanceId, activityInstanceId, reassignTo (user object), comment (required), optional reassignType and reassignedFrom
|
|
848
|
+
*
|
|
849
|
+
* @example
|
|
850
|
+
* await process.reassign({ instanceId: "item_123", activityInstanceId: "act_456", reassignTo: { _id: "user_789" }, comment: "Reassigning to manager" });
|
|
851
|
+
*/
|
|
852
|
+
reassignItem(options: ProcessReassignItemOptions): Promise<void>;
|
|
853
|
+
/**
|
|
854
|
+
* Get list of eligible reassignees for a process task
|
|
855
|
+
* @param options - instanceId, activityInstanceId, optional pageNumber, pageSize, query
|
|
856
|
+
*/
|
|
857
|
+
getReassignees(options: ProcessGetReassigneesOptions): Promise<any>;
|
|
858
|
+
/**
|
|
859
|
+
* Restart a rejected/withdrawn process instance
|
|
860
|
+
* @param options - instanceId, activityInstanceId
|
|
861
|
+
*
|
|
862
|
+
* @example
|
|
863
|
+
* await process.restart({ instanceId: "item_123", activityInstanceId: "act_456" });
|
|
864
|
+
*/
|
|
865
|
+
restartItem(options: ProcessRestartItemOptions): Promise<void>;
|
|
866
|
+
/**
|
|
867
|
+
* Discard a draft process instance
|
|
868
|
+
* @param options - instanceId
|
|
869
|
+
*
|
|
870
|
+
* @example
|
|
871
|
+
* await process.discard({ instanceId: "item_123" });
|
|
872
|
+
*/
|
|
873
|
+
discardItem(options: ProcessDiscardItemOptions): Promise<void>;
|
|
874
|
+
/**
|
|
875
|
+
* Get field definitions for this process
|
|
876
|
+
*/
|
|
877
|
+
getFields(): Promise<any>;
|
|
878
|
+
/**
|
|
879
|
+
* Get field definitions for a specific task step (my tasks view)
|
|
880
|
+
* @param options - activityId of the target step
|
|
881
|
+
*/
|
|
882
|
+
getMyTaskFields(options: {
|
|
883
|
+
activityId: string;
|
|
884
|
+
}): Promise<any>;
|
|
885
|
+
/**
|
|
886
|
+
* Get field definitions for a specific task step (participated view)
|
|
887
|
+
* @param options - activityId of the target step
|
|
888
|
+
*/
|
|
889
|
+
getParticipatedFields(options: {
|
|
890
|
+
activityId: string;
|
|
891
|
+
}): Promise<any>;
|
|
892
|
+
/**
|
|
893
|
+
* Get field definitions for the my items view filtered by status
|
|
894
|
+
* @param options - status filter (e.g. "draft", "inprogress", "all")
|
|
895
|
+
*/
|
|
896
|
+
getMyItemsFields(options: {
|
|
897
|
+
status: string;
|
|
898
|
+
}): Promise<any>;
|
|
899
|
+
/**
|
|
900
|
+
* Get the progress/timeline of a process instance
|
|
901
|
+
* @param options - instanceId (required)
|
|
902
|
+
*/
|
|
903
|
+
getProgress(options: {
|
|
904
|
+
instanceId: string;
|
|
905
|
+
}): Promise<any>;
|
|
317
906
|
}
|
|
318
907
|
}
|
|
319
908
|
declare module "app/index" {
|
|
@@ -321,7 +910,7 @@ declare module "app/index" {
|
|
|
321
910
|
import { Page } from "app/page";
|
|
322
911
|
import { AppContext } from "types/internal";
|
|
323
912
|
import { DecisionTable } from "app/decisiontable";
|
|
324
|
-
import { Dataform } from "
|
|
913
|
+
import { Dataform } from "dataform/index";
|
|
325
914
|
import { Board } from "board/index";
|
|
326
915
|
import { Process } from "process/index";
|
|
327
916
|
export class Application extends BaseSDK {
|