@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/index.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;
|
|
@@ -83,14 +121,69 @@ declare module "core/index" {
|
|
|
83
121
|
declare module "utils/client" {
|
|
84
122
|
import { BaseSDK } from "core/index";
|
|
85
123
|
export class Client extends BaseSDK {
|
|
124
|
+
/**
|
|
125
|
+
* Display an info message toast in the platform.
|
|
126
|
+
*
|
|
127
|
+
* @param message - The message to display. Accepts a string or object (serialized to JSON).
|
|
128
|
+
* @returns A promise that resolves when the message is shown.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* await kf.client.showInfo("Record saved successfully");
|
|
132
|
+
*/
|
|
86
133
|
showInfo(message: string | object): any;
|
|
134
|
+
/**
|
|
135
|
+
* Display a confirmation dialog and wait for the user's response.
|
|
136
|
+
*
|
|
137
|
+
* @param args - Dialog configuration.
|
|
138
|
+
* @param args.title - Dialog title.
|
|
139
|
+
* @param args.content - Body text of the dialog.
|
|
140
|
+
* @param args.okText - Label for the confirm button (default: "Ok").
|
|
141
|
+
* @param args.cancelText - Label for the cancel button (default: "Cancel").
|
|
142
|
+
* @returns A promise that resolves with `{ action: "OK" }` or `{ action: "CANCEL" }`.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* const { action } = await kf.client.showConfirm({
|
|
146
|
+
* title: "Delete record?",
|
|
147
|
+
* content: "This cannot be undone.",
|
|
148
|
+
* okText: "Delete",
|
|
149
|
+
* cancelText: "Cancel",
|
|
150
|
+
* });
|
|
151
|
+
* if (action === "OK") { ... }
|
|
152
|
+
*/
|
|
87
153
|
showConfirm(args: {
|
|
88
154
|
title: string;
|
|
89
155
|
content: string;
|
|
90
156
|
okText: string;
|
|
91
157
|
cancelText: string;
|
|
92
158
|
}): any;
|
|
159
|
+
/**
|
|
160
|
+
* Navigate the platform to the given URL.
|
|
161
|
+
*
|
|
162
|
+
* @param url - The URL to navigate to.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* kf.client.redirect("https://example.com");
|
|
166
|
+
*/
|
|
93
167
|
redirect(url: string): any;
|
|
168
|
+
/**
|
|
169
|
+
* Resolve a Kissflow image field value to a base64 data URL.
|
|
170
|
+
*
|
|
171
|
+
* Custom components (iframes) cannot load Kissflow-hosted images directly due to
|
|
172
|
+
* CORS restrictions and 302 redirects to signed S3 URLs. This method fetches the
|
|
173
|
+
* image in the parent window (which has the required session cookies) and returns
|
|
174
|
+
* a self-contained `data:image/...;base64,...` URL that can be used as `<img src>`
|
|
175
|
+
* without any CORS issues.
|
|
176
|
+
*
|
|
177
|
+
* @param imageValue - The image field value must contain a `key` property and
|
|
178
|
+
* optionally a `photos` array. Uses `photos[1]` (preview resolution) when available,
|
|
179
|
+
* falls back to `key`.
|
|
180
|
+
* @returns A promise that resolves with the base64 data URL string.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* const dataUrl = await kf.client.getImageUrl(imageFieldValue);
|
|
184
|
+
* document.querySelector("#avatar").src = dataUrl;
|
|
185
|
+
*/
|
|
186
|
+
getImageUrl(imageValue: Record<string, unknown>): any;
|
|
94
187
|
}
|
|
95
188
|
}
|
|
96
189
|
declare module "utils/formatter" {
|
|
@@ -103,9 +196,32 @@ declare module "utils/formatter" {
|
|
|
103
196
|
toBoolean(value: string): any;
|
|
104
197
|
}
|
|
105
198
|
}
|
|
199
|
+
declare module "utils/validation" {
|
|
200
|
+
/**
|
|
201
|
+
* Validation utilities for SDK methods
|
|
202
|
+
*/
|
|
203
|
+
/**
|
|
204
|
+
* Throws error if value is falsy
|
|
205
|
+
*/
|
|
206
|
+
export function requireField(value: any, fieldName: string): void;
|
|
207
|
+
/**
|
|
208
|
+
* Returns a rejected promise if value is falsy, null otherwise
|
|
209
|
+
* Use for async validation in SDK methods
|
|
210
|
+
*/
|
|
211
|
+
export function requireFieldAsync(value: any, fieldName: string): Promise<never> | null;
|
|
212
|
+
/**
|
|
213
|
+
* Returns a rejected promise if any of the values are falsy
|
|
214
|
+
* Use for validating multiple required fields
|
|
215
|
+
*/
|
|
216
|
+
export function requireFieldsAsync(fields: Array<{
|
|
217
|
+
value: any;
|
|
218
|
+
name: string;
|
|
219
|
+
}>): Promise<never> | null;
|
|
220
|
+
}
|
|
106
221
|
declare module "utils/index" {
|
|
107
222
|
export * from "utils/client";
|
|
108
223
|
export * from "utils/formatter";
|
|
224
|
+
export * from "utils/validation";
|
|
109
225
|
export const isObject: (value: any) => boolean;
|
|
110
226
|
}
|
|
111
227
|
declare module "core/proxy" {
|
|
@@ -118,6 +234,32 @@ declare module "core/proxy" {
|
|
|
118
234
|
}
|
|
119
235
|
}
|
|
120
236
|
declare module "types/external" {
|
|
237
|
+
export type QueryResponse = {
|
|
238
|
+
items: any[];
|
|
239
|
+
total: number;
|
|
240
|
+
page?: number;
|
|
241
|
+
pageSize?: number;
|
|
242
|
+
};
|
|
243
|
+
export type BaseQueryOptions = {
|
|
244
|
+
searchValue?: string;
|
|
245
|
+
pageNumber?: number;
|
|
246
|
+
pageSize?: number;
|
|
247
|
+
};
|
|
248
|
+
export type PayloadSortItem = {
|
|
249
|
+
Id: string;
|
|
250
|
+
SortType: "ASC" | "DESC";
|
|
251
|
+
};
|
|
252
|
+
export type PayloadOptions = {
|
|
253
|
+
Columns?: any[];
|
|
254
|
+
Filters?: any;
|
|
255
|
+
Sort?: PayloadSortItem[];
|
|
256
|
+
FilterParam?: any;
|
|
257
|
+
};
|
|
258
|
+
export type ProcessPayloadOptions = {
|
|
259
|
+
Columns?: any[];
|
|
260
|
+
Filters?: any;
|
|
261
|
+
Sort?: PayloadSortItem[];
|
|
262
|
+
};
|
|
121
263
|
export type userObject = {
|
|
122
264
|
_id: string;
|
|
123
265
|
Name: string;
|
|
@@ -147,11 +289,138 @@ declare module "types/external" {
|
|
|
147
289
|
_id: string;
|
|
148
290
|
_activity_instance_id: string;
|
|
149
291
|
};
|
|
292
|
+
export type ProcessMyItemsOptions = BaseQueryOptions & {
|
|
293
|
+
status?: "draft" | "inprogress" | "completed" | "withdrawn" | "rejected" | "all";
|
|
294
|
+
payload?: ProcessPayloadOptions;
|
|
295
|
+
};
|
|
296
|
+
export type ProcessMyTasksOptions = BaseQueryOptions & {
|
|
297
|
+
activityId?: string;
|
|
298
|
+
payload?: ProcessPayloadOptions;
|
|
299
|
+
};
|
|
300
|
+
export type ProcessParticipatedOptions = BaseQueryOptions & {
|
|
301
|
+
activityId?: string;
|
|
302
|
+
payload?: ProcessPayloadOptions;
|
|
303
|
+
};
|
|
304
|
+
export type ProcessAdminOptions = BaseQueryOptions & {
|
|
305
|
+
payload?: ProcessPayloadOptions;
|
|
306
|
+
};
|
|
307
|
+
export type ProcessQueryResponse = QueryResponse;
|
|
308
|
+
export type ProcessGetItemOptions = {
|
|
309
|
+
instanceId: string;
|
|
310
|
+
};
|
|
311
|
+
export type ProcessCreateItemOptions = {
|
|
312
|
+
data?: object;
|
|
313
|
+
};
|
|
314
|
+
export type ProcessUpdateItemOptions = {
|
|
315
|
+
instanceId: string;
|
|
316
|
+
activityInstanceId: string;
|
|
317
|
+
data: object;
|
|
318
|
+
};
|
|
319
|
+
export type ProcessDeleteItemOptions = {
|
|
320
|
+
instanceId: string;
|
|
321
|
+
};
|
|
322
|
+
export type ProcessSubmitItemOptions = {
|
|
323
|
+
instanceId: string;
|
|
324
|
+
activityInstanceId: string;
|
|
325
|
+
comment?: string;
|
|
326
|
+
};
|
|
327
|
+
export type ProcessRejectItemOptions = {
|
|
328
|
+
instanceId: string;
|
|
329
|
+
activityInstanceId: string;
|
|
330
|
+
comment: string;
|
|
331
|
+
};
|
|
332
|
+
export type ProcessWithdrawItemOptions = {
|
|
333
|
+
instanceId: string;
|
|
334
|
+
comment?: string;
|
|
335
|
+
};
|
|
336
|
+
export type ProcessSendbackItemOptions = {
|
|
337
|
+
instanceId: string;
|
|
338
|
+
activityInstanceId: string;
|
|
339
|
+
stepId: string;
|
|
340
|
+
comment: string;
|
|
341
|
+
};
|
|
342
|
+
export type ProcessReassignItemOptions = {
|
|
343
|
+
instanceId: string;
|
|
344
|
+
activityInstanceId: string;
|
|
345
|
+
reassignTo: object;
|
|
346
|
+
comment: string;
|
|
347
|
+
reassignType?: "initiator" | "approver" | "admin";
|
|
348
|
+
reassignedFrom?: object[];
|
|
349
|
+
};
|
|
350
|
+
export type ProcessGetReassigneesOptions = {
|
|
351
|
+
instanceId: string;
|
|
352
|
+
activityInstanceId: string;
|
|
353
|
+
pageNumber?: number;
|
|
354
|
+
pageSize?: number;
|
|
355
|
+
query?: string;
|
|
356
|
+
};
|
|
357
|
+
export type ProcessRestartItemOptions = {
|
|
358
|
+
instanceId: string;
|
|
359
|
+
activityInstanceId: string;
|
|
360
|
+
};
|
|
361
|
+
export type ProcessDiscardItemOptions = {
|
|
362
|
+
instanceId: string;
|
|
363
|
+
};
|
|
150
364
|
export type FetchOptions = {
|
|
151
365
|
method?: string;
|
|
152
366
|
body?: string | object;
|
|
153
367
|
headers?: object;
|
|
154
368
|
};
|
|
369
|
+
export type DataformQueryOptions = BaseQueryOptions & {
|
|
370
|
+
viewId?: string;
|
|
371
|
+
payload?: PayloadOptions;
|
|
372
|
+
};
|
|
373
|
+
export type DataformQueryResponse = QueryResponse;
|
|
374
|
+
export type DataformCreateItemOptions = {
|
|
375
|
+
data?: object;
|
|
376
|
+
viewId?: string;
|
|
377
|
+
};
|
|
378
|
+
export type DataformUpdateItemOptions = {
|
|
379
|
+
itemId: string;
|
|
380
|
+
data: object;
|
|
381
|
+
viewId?: string;
|
|
382
|
+
};
|
|
383
|
+
export type DataformGetItemOptions = {
|
|
384
|
+
itemId: string;
|
|
385
|
+
viewId?: string;
|
|
386
|
+
};
|
|
387
|
+
export type DataformDeleteItemOptions = {
|
|
388
|
+
itemId: string;
|
|
389
|
+
viewId?: string;
|
|
390
|
+
};
|
|
391
|
+
export type DataformDiscardItemOptions = {
|
|
392
|
+
viewId?: string;
|
|
393
|
+
};
|
|
394
|
+
export type DataformSubmitItemOptions = {
|
|
395
|
+
itemId: string;
|
|
396
|
+
data?: object;
|
|
397
|
+
viewId?: string;
|
|
398
|
+
};
|
|
399
|
+
export type BoardGetItemsOptions = BaseQueryOptions & {
|
|
400
|
+
viewId?: string;
|
|
401
|
+
payload?: PayloadOptions;
|
|
402
|
+
};
|
|
403
|
+
export type BoardQueryResponse = QueryResponse;
|
|
404
|
+
export type BoardGetItemOptions = {
|
|
405
|
+
instanceId: string;
|
|
406
|
+
};
|
|
407
|
+
export type BoardCreateItemOptions = {
|
|
408
|
+
data?: object;
|
|
409
|
+
};
|
|
410
|
+
export type BoardUpdateItemOptions = {
|
|
411
|
+
instanceId: string;
|
|
412
|
+
data: object;
|
|
413
|
+
};
|
|
414
|
+
export type BoardDeleteItemOptions = {
|
|
415
|
+
instanceId: string;
|
|
416
|
+
};
|
|
417
|
+
export type BoardSubmitItemOptions = {
|
|
418
|
+
instanceId: string;
|
|
419
|
+
comment?: string;
|
|
420
|
+
};
|
|
421
|
+
export type BoardDiscardItemOptions = {
|
|
422
|
+
instanceId: string;
|
|
423
|
+
};
|
|
155
424
|
}
|
|
156
425
|
declare module "types/internal" {
|
|
157
426
|
import { userObject, accountObject, environmentObject } from "types/external";
|
|
@@ -251,33 +520,353 @@ declare module "app/decisiontable" {
|
|
|
251
520
|
evaluate(payload?: object): any;
|
|
252
521
|
}
|
|
253
522
|
}
|
|
254
|
-
declare module "
|
|
523
|
+
declare module "dataform/index" {
|
|
255
524
|
import { BaseSDK } from "core/index";
|
|
256
|
-
import { DataformItem } from "types/external";
|
|
525
|
+
import { DataformItem, DataformQueryOptions, DataformQueryResponse, DataformCreateItemOptions, DataformUpdateItemOptions, DataformGetItemOptions, DataformDeleteItemOptions, DataformDiscardItemOptions, DataformSubmitItemOptions } from "types/external";
|
|
257
526
|
export class Dataform extends BaseSDK {
|
|
258
527
|
private _id;
|
|
259
528
|
constructor(flowId: string);
|
|
529
|
+
/**
|
|
530
|
+
* Get all items from this dataform with optional filtering, sorting, and pagination
|
|
531
|
+
* @param options - Query options (searchValue, pageNumber, pageSize, payload)
|
|
532
|
+
* @returns Promise containing items and total count
|
|
533
|
+
*/
|
|
534
|
+
getItems(options?: DataformQueryOptions): Promise<DataformQueryResponse>;
|
|
535
|
+
/**
|
|
536
|
+
* Get a single item by ID from this dataform
|
|
537
|
+
* @param options - itemId (required), optional viewId
|
|
538
|
+
* @returns Promise containing the item data
|
|
539
|
+
*/
|
|
540
|
+
getItem(options: DataformGetItemOptions): Promise<DataformItem>;
|
|
541
|
+
/**
|
|
542
|
+
* Create a new item in this dataform
|
|
543
|
+
* @param options - Creation options (data: initial field values, viewId: optional view ID)
|
|
544
|
+
* @returns Promise containing the newly created item with _id
|
|
545
|
+
*/
|
|
546
|
+
createItem(options?: DataformCreateItemOptions): Promise<DataformItem>;
|
|
547
|
+
/**
|
|
548
|
+
* Update an existing item in this dataform
|
|
549
|
+
* @param options - Update options (itemId: required, data: required updated values, viewId: optional view ID)
|
|
550
|
+
* @returns Promise containing the updated item
|
|
551
|
+
*/
|
|
552
|
+
updateItem(options: DataformUpdateItemOptions): Promise<DataformItem>;
|
|
553
|
+
/**
|
|
554
|
+
* Import items from a CSV file into this dataform
|
|
555
|
+
* @param defaultValues - Optional default field values to apply to all imported items
|
|
556
|
+
*/
|
|
260
557
|
importCSV(defaultValues?: object): any;
|
|
558
|
+
/**
|
|
559
|
+
* Open the form UI for an existing dataform item
|
|
560
|
+
* @param item - Dataform item with _id
|
|
561
|
+
*/
|
|
261
562
|
openForm(item: DataformItem): any;
|
|
563
|
+
/**
|
|
564
|
+
* Delete an item from this dataform
|
|
565
|
+
* @param options - itemId (required), optional viewId
|
|
566
|
+
*
|
|
567
|
+
* @example
|
|
568
|
+
* await dataform.deleteItem({ itemId: "item_123" });
|
|
569
|
+
*/
|
|
570
|
+
deleteItem(options: DataformDeleteItemOptions): Promise<void>;
|
|
571
|
+
/**
|
|
572
|
+
* Discard the current draft for this dataform
|
|
573
|
+
* @param options - optional viewId
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* await dataform.discardItem();
|
|
577
|
+
*/
|
|
578
|
+
discardItem(options?: DataformDiscardItemOptions): Promise<void>;
|
|
579
|
+
/**
|
|
580
|
+
* Submit/finalize a dataform item
|
|
581
|
+
* @param options - itemId (required), optional data and viewId
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* await dataform.submitItem({ itemId: "item_123" });
|
|
585
|
+
*/
|
|
586
|
+
submitItem(options: DataformSubmitItemOptions): Promise<void>;
|
|
587
|
+
/**
|
|
588
|
+
* Get field definitions for this dataform
|
|
589
|
+
* @param options - Optional viewId to scope fields to a specific view
|
|
590
|
+
*/
|
|
591
|
+
getFields(options?: {
|
|
592
|
+
viewId?: string;
|
|
593
|
+
}): Promise<any>;
|
|
262
594
|
}
|
|
263
595
|
}
|
|
264
596
|
declare module "board/index" {
|
|
265
597
|
import { BaseSDK } from "core/index";
|
|
266
|
-
import { BoardItem } from "types/external";
|
|
598
|
+
import { BoardItem, BoardGetItemOptions, BoardGetItemsOptions, BoardQueryResponse, BoardCreateItemOptions, BoardUpdateItemOptions, BoardDeleteItemOptions, BoardSubmitItemOptions, BoardDiscardItemOptions } from "types/external";
|
|
267
599
|
export class Board extends BaseSDK {
|
|
268
600
|
private _id;
|
|
269
601
|
constructor(flowId: string);
|
|
602
|
+
/**
|
|
603
|
+
* Import data from CSV file
|
|
604
|
+
* @param defaultValues - Optional default values to apply to imported items
|
|
605
|
+
*/
|
|
270
606
|
importCSV(defaultValues?: object): any;
|
|
607
|
+
/**
|
|
608
|
+
* Open the form UI for a board item
|
|
609
|
+
* @param item - Board item with _id and optional _view_id
|
|
610
|
+
*/
|
|
271
611
|
openForm(item: BoardItem): any;
|
|
612
|
+
/**
|
|
613
|
+
* Get items from a board view
|
|
614
|
+
* @param options - Query options (viewId, searchValue, pageNumber, pageSize, payload)
|
|
615
|
+
* @returns Promise containing items array and total count
|
|
616
|
+
*
|
|
617
|
+
* @example
|
|
618
|
+
* const board = kf.app.getBoard("Inventory");
|
|
619
|
+
* const { items } = await board.getItems({ viewId: "AllItems_View" });
|
|
620
|
+
*/
|
|
621
|
+
getItems(options?: BoardGetItemsOptions): Promise<BoardQueryResponse>;
|
|
622
|
+
/**
|
|
623
|
+
* Get a single board/case item by instance ID
|
|
624
|
+
* @param options - instanceId (required)
|
|
625
|
+
* @returns Promise containing the item data
|
|
626
|
+
*/
|
|
627
|
+
getItem(options: BoardGetItemOptions): Promise<BoardItem>;
|
|
628
|
+
/**
|
|
629
|
+
* Create a new board item
|
|
630
|
+
* @param options - Creation options (data: initial field values)
|
|
631
|
+
* @returns Promise containing the newly created item with _id
|
|
632
|
+
*
|
|
633
|
+
* @example
|
|
634
|
+
* const board = kf.app.getBoard("Inventory");
|
|
635
|
+
* const item = await board.createItem({ data: { Name: "New Item" } });
|
|
636
|
+
*/
|
|
637
|
+
createItem(options?: BoardCreateItemOptions): Promise<BoardItem>;
|
|
638
|
+
/**
|
|
639
|
+
* Update an existing board item
|
|
640
|
+
* @param options - Update options (instanceId, data)
|
|
641
|
+
* @returns Promise containing the updated item
|
|
642
|
+
*
|
|
643
|
+
* @example
|
|
644
|
+
* const board = kf.app.getBoard("Inventory");
|
|
645
|
+
* await board.updateItem({
|
|
646
|
+
* instanceId: "item_123",
|
|
647
|
+
* data: { Name: "Updated Item" }
|
|
648
|
+
* });
|
|
649
|
+
*/
|
|
650
|
+
updateItem(options: BoardUpdateItemOptions): Promise<BoardItem>;
|
|
651
|
+
/**
|
|
652
|
+
* Delete a board item
|
|
653
|
+
* @param options - Delete options (instanceId)
|
|
654
|
+
* @returns Promise resolving on successful deletion
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* const board = kf.app.getBoard("Inventory");
|
|
658
|
+
* await board.deleteItem({ instanceId: "item_123" });
|
|
659
|
+
*/
|
|
660
|
+
deleteItem(options: BoardDeleteItemOptions): Promise<void>;
|
|
661
|
+
/**
|
|
662
|
+
* Submit a board item
|
|
663
|
+
* @param options - instanceId
|
|
664
|
+
*/
|
|
665
|
+
submitItem(options: BoardSubmitItemOptions): Promise<void>;
|
|
666
|
+
/**
|
|
667
|
+
* Discard a board item
|
|
668
|
+
* @param options - instanceId
|
|
669
|
+
*/
|
|
670
|
+
discardItem(options: BoardDiscardItemOptions): Promise<void>;
|
|
671
|
+
/**
|
|
672
|
+
* Get field definitions for this board
|
|
673
|
+
* @param options - Optional viewId to scope fields to a specific view
|
|
674
|
+
*/
|
|
675
|
+
getFields(options?: {
|
|
676
|
+
viewId?: string;
|
|
677
|
+
}): Promise<any>;
|
|
272
678
|
}
|
|
273
679
|
}
|
|
274
680
|
declare module "process/index" {
|
|
275
681
|
import { BaseSDK } from "core/index";
|
|
276
|
-
import { ProcessItem } from "types/external";
|
|
682
|
+
import { ProcessItem, ProcessGetItemOptions, ProcessMyItemsOptions, ProcessMyTasksOptions, ProcessParticipatedOptions, ProcessAdminOptions, ProcessQueryResponse, ProcessCreateItemOptions, ProcessUpdateItemOptions, ProcessDeleteItemOptions, ProcessSubmitItemOptions, ProcessRejectItemOptions, ProcessWithdrawItemOptions, ProcessSendbackItemOptions, ProcessReassignItemOptions, ProcessGetReassigneesOptions, ProcessRestartItemOptions, ProcessDiscardItemOptions } from "types/external";
|
|
277
683
|
export class Process extends BaseSDK {
|
|
278
684
|
private _id;
|
|
279
685
|
constructor(flowId: string);
|
|
686
|
+
/**
|
|
687
|
+
* Get my items from this process (items I initiated)
|
|
688
|
+
* @param options - Query options (status, searchValue, pageNumber, pageSize, payload)
|
|
689
|
+
* @returns Promise containing items and total count
|
|
690
|
+
*
|
|
691
|
+
* @example
|
|
692
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
693
|
+
* // Get draft items
|
|
694
|
+
* const { items } = await process.getMyItems({ status: "draft" });
|
|
695
|
+
* // Get in-progress items
|
|
696
|
+
* const { items } = await process.getMyItems({ status: "inprogress" });
|
|
697
|
+
*/
|
|
698
|
+
getMyItems(options?: ProcessMyItemsOptions): Promise<ProcessQueryResponse>;
|
|
699
|
+
/**
|
|
700
|
+
* Get my pending tasks from this process (tasks assigned to me)
|
|
701
|
+
* @param options - Query options (activityId, searchValue, pageNumber, pageSize, payload)
|
|
702
|
+
* @returns Promise containing tasks and total count
|
|
703
|
+
*
|
|
704
|
+
* @example
|
|
705
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
706
|
+
* // Get all pending tasks
|
|
707
|
+
* const { items } = await process.getMyTasksItems();
|
|
708
|
+
* // Get tasks for specific activity/step
|
|
709
|
+
* const { items } = await process.getMyTasksItems({ activityId: "Approval_Step" });
|
|
710
|
+
*/
|
|
711
|
+
getMyTasksItems(options?: ProcessMyTasksOptions): Promise<ProcessQueryResponse>;
|
|
712
|
+
/**
|
|
713
|
+
* Get items I participated in (items where I took action)
|
|
714
|
+
* @param options - Query options (activityId, searchValue, pageNumber, pageSize, payload)
|
|
715
|
+
* @returns Promise containing items and total count
|
|
716
|
+
*
|
|
717
|
+
* @example
|
|
718
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
719
|
+
* const { items } = await process.getParticipatedItems();
|
|
720
|
+
*/
|
|
721
|
+
getParticipatedItems(options?: ProcessParticipatedOptions): Promise<ProcessQueryResponse>;
|
|
722
|
+
/**
|
|
723
|
+
* Get all items as admin (requires admin access)
|
|
724
|
+
* @param options - Query options (searchValue, pageNumber, pageSize, payload)
|
|
725
|
+
* @returns Promise containing items and total count
|
|
726
|
+
*
|
|
727
|
+
* @example
|
|
728
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
729
|
+
* const { items } = await process.getAdminItems();
|
|
730
|
+
*/
|
|
731
|
+
getAdminItems(options?: ProcessAdminOptions): Promise<ProcessQueryResponse>;
|
|
732
|
+
/**
|
|
733
|
+
* Get a single process instance by ID
|
|
734
|
+
* @param options - instanceId (required)
|
|
735
|
+
* @returns Promise containing the instance data
|
|
736
|
+
*/
|
|
737
|
+
getItem(options: ProcessGetItemOptions): Promise<ProcessItem>;
|
|
738
|
+
/**
|
|
739
|
+
* Create a new process instance (start a new process)
|
|
740
|
+
* @param options - Creation options (data: initial field values)
|
|
741
|
+
* @returns Promise containing the newly created process item with _id and _activity_instance_id
|
|
742
|
+
*
|
|
743
|
+
* @example
|
|
744
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
745
|
+
* const item = await process.createItem({ data: { LeaveType: "Annual" } });
|
|
746
|
+
*/
|
|
747
|
+
createItem(options?: ProcessCreateItemOptions): Promise<ProcessItem>;
|
|
748
|
+
/**
|
|
749
|
+
* Update an existing process instance
|
|
750
|
+
* @param options - Update options (instanceId, activityInstanceId, data)
|
|
751
|
+
* @returns Promise containing the updated item
|
|
752
|
+
*
|
|
753
|
+
* @example
|
|
754
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
755
|
+
* await process.updateItem({
|
|
756
|
+
* instanceId: "item_123",
|
|
757
|
+
* activityInstanceId: "activity_456",
|
|
758
|
+
* data: { LeaveType: "Sick" }
|
|
759
|
+
* });
|
|
760
|
+
*/
|
|
761
|
+
updateItem(options: ProcessUpdateItemOptions): Promise<ProcessItem>;
|
|
762
|
+
/**
|
|
763
|
+
* Delete a process instance
|
|
764
|
+
* @param options - Delete options (instanceId)
|
|
765
|
+
* @returns Promise resolving on successful deletion
|
|
766
|
+
*
|
|
767
|
+
* @example
|
|
768
|
+
* const process = kf.app.getProcess("LeaveRequest");
|
|
769
|
+
* await process.deleteItem({ instanceId: "item_123" });
|
|
770
|
+
*/
|
|
771
|
+
deleteItem(options: ProcessDeleteItemOptions): Promise<void>;
|
|
772
|
+
/**
|
|
773
|
+
* Open the form UI for a process instance
|
|
774
|
+
* @param item - Process item with _id and _activity_instance_id
|
|
775
|
+
*/
|
|
280
776
|
openForm(item: ProcessItem): any;
|
|
777
|
+
/**
|
|
778
|
+
* Submit a process task
|
|
779
|
+
* @param options - instanceId, activityInstanceId, optional comment
|
|
780
|
+
*
|
|
781
|
+
* @example
|
|
782
|
+
* await process.submitItem({ instanceId: "item_123", activityInstanceId: "act_456" });
|
|
783
|
+
*/
|
|
784
|
+
submitItem(options: ProcessSubmitItemOptions): Promise<void>;
|
|
785
|
+
/**
|
|
786
|
+
* Reject a process task
|
|
787
|
+
* @param options - instanceId, activityInstanceId, comment (required)
|
|
788
|
+
*
|
|
789
|
+
* @example
|
|
790
|
+
* await process.reject({ instanceId: "item_123", activityInstanceId: "act_456", comment: "Not approved" });
|
|
791
|
+
*/
|
|
792
|
+
rejectItem(options: ProcessRejectItemOptions): Promise<void>;
|
|
793
|
+
/**
|
|
794
|
+
* Withdraw a process instance (initiator only)
|
|
795
|
+
* @param options - instanceId, optional comment
|
|
796
|
+
*
|
|
797
|
+
* @example
|
|
798
|
+
* await process.withdraw({ instanceId: "item_123", comment: "Withdrawing request" });
|
|
799
|
+
*/
|
|
800
|
+
withdrawItem(options: ProcessWithdrawItemOptions): Promise<void>;
|
|
801
|
+
/**
|
|
802
|
+
* Send back a process task to a previous step
|
|
803
|
+
* @param options - instanceId, activityInstanceId, stepId (target step), comment (required)
|
|
804
|
+
*
|
|
805
|
+
* @example
|
|
806
|
+
* await process.sendback({ instanceId: "item_123", activityInstanceId: "act_456", stepId: "step_789", comment: "Please revise" });
|
|
807
|
+
*/
|
|
808
|
+
sendbackItem(options: ProcessSendbackItemOptions): Promise<void>;
|
|
809
|
+
/**
|
|
810
|
+
* Reassign a process task to another user
|
|
811
|
+
* @param options - instanceId, activityInstanceId, reassignTo (user object), comment (required), optional reassignType and reassignedFrom
|
|
812
|
+
*
|
|
813
|
+
* @example
|
|
814
|
+
* await process.reassign({ instanceId: "item_123", activityInstanceId: "act_456", reassignTo: { _id: "user_789" }, comment: "Reassigning to manager" });
|
|
815
|
+
*/
|
|
816
|
+
reassignItem(options: ProcessReassignItemOptions): Promise<void>;
|
|
817
|
+
/**
|
|
818
|
+
* Get list of eligible reassignees for a process task
|
|
819
|
+
* @param options - instanceId, activityInstanceId, optional pageNumber, pageSize, query
|
|
820
|
+
*/
|
|
821
|
+
getReassignees(options: ProcessGetReassigneesOptions): Promise<any>;
|
|
822
|
+
/**
|
|
823
|
+
* Restart a rejected/withdrawn process instance
|
|
824
|
+
* @param options - instanceId, activityInstanceId
|
|
825
|
+
*
|
|
826
|
+
* @example
|
|
827
|
+
* await process.restart({ instanceId: "item_123", activityInstanceId: "act_456" });
|
|
828
|
+
*/
|
|
829
|
+
restartItem(options: ProcessRestartItemOptions): Promise<void>;
|
|
830
|
+
/**
|
|
831
|
+
* Discard a draft process instance
|
|
832
|
+
* @param options - instanceId
|
|
833
|
+
*
|
|
834
|
+
* @example
|
|
835
|
+
* await process.discard({ instanceId: "item_123" });
|
|
836
|
+
*/
|
|
837
|
+
discardItem(options: ProcessDiscardItemOptions): Promise<void>;
|
|
838
|
+
/**
|
|
839
|
+
* Get field definitions for this process
|
|
840
|
+
*/
|
|
841
|
+
getFields(): Promise<any>;
|
|
842
|
+
/**
|
|
843
|
+
* Get field definitions for a specific task step (my tasks view)
|
|
844
|
+
* @param options - activityId of the target step
|
|
845
|
+
*/
|
|
846
|
+
getMyTaskFields(options: {
|
|
847
|
+
activityId: string;
|
|
848
|
+
}): Promise<any>;
|
|
849
|
+
/**
|
|
850
|
+
* Get field definitions for a specific task step (participated view)
|
|
851
|
+
* @param options - activityId of the target step
|
|
852
|
+
*/
|
|
853
|
+
getParticipatedFields(options: {
|
|
854
|
+
activityId: string;
|
|
855
|
+
}): Promise<any>;
|
|
856
|
+
/**
|
|
857
|
+
* Get field definitions for the my items view filtered by status
|
|
858
|
+
* @param options - status filter (e.g. "draft", "inprogress", "all")
|
|
859
|
+
*/
|
|
860
|
+
getMyItemsFields(options: {
|
|
861
|
+
status: string;
|
|
862
|
+
}): Promise<any>;
|
|
863
|
+
/**
|
|
864
|
+
* Get the progress/timeline of a process instance
|
|
865
|
+
* @param options - instanceId (required)
|
|
866
|
+
*/
|
|
867
|
+
getProgress(options: {
|
|
868
|
+
instanceId: string;
|
|
869
|
+
}): Promise<any>;
|
|
281
870
|
}
|
|
282
871
|
}
|
|
283
872
|
declare module "app/index" {
|
|
@@ -285,7 +874,7 @@ declare module "app/index" {
|
|
|
285
874
|
import { Page } from "app/page";
|
|
286
875
|
import { AppContext } from "types/internal";
|
|
287
876
|
import { DecisionTable } from "app/decisiontable";
|
|
288
|
-
import { Dataform } from "
|
|
877
|
+
import { Dataform } from "dataform/index";
|
|
289
878
|
import { Board } from "board/index";
|
|
290
879
|
import { Process } from "process/index";
|
|
291
880
|
export class Application extends BaseSDK {
|