@kissflow/lowcode-client-sdk 1.0.51 → 1.0.53
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 +244 -127
- package/dist/kf.lowcodeworkersdk.es.js +1856 -0
- package/dist/kf.nocodeworkersdk.es.js +761 -0
- package/dist/kfsdk.es.js +301 -205
- package/dist/kfsdk.umd.js +1 -1
- package/dist/lowcode.d.ts +242 -125
- package/dist/lowcode.types.d.ts +127 -125
- package/dist/nocode.d.ts +181 -64
- package/dist/nocode.types.d.ts +53 -9
- package/dist/snippets.json +5 -0
- package/package.json +1 -1
package/dist/lowcode.d.ts
CHANGED
|
@@ -70,6 +70,9 @@ declare module "core/constants" {
|
|
|
70
70
|
CUSTOM_FUNCTION_ON_RUN_COMPLETE: string;
|
|
71
71
|
CUSTOM_FUNCTION_STOP_WATCH: string;
|
|
72
72
|
DECISION_TABLE_EXECUTE: string;
|
|
73
|
+
REPORT_GET_DATA: string;
|
|
74
|
+
REPORT_GET_COUNT: string;
|
|
75
|
+
REPORT_GET_FIELDS: string;
|
|
73
76
|
DATAFORM_IMPORT_CSV: string;
|
|
74
77
|
DATAFORM_OPEN_FORM: string;
|
|
75
78
|
DATAFORM_GET_FIELDS: string;
|
|
@@ -169,7 +172,7 @@ declare module "core/index" {
|
|
|
169
172
|
declare module "form/index" {
|
|
170
173
|
import { BaseSDK } from "core/index";
|
|
171
174
|
export class Form extends BaseSDK {
|
|
172
|
-
|
|
175
|
+
protected storeId: string;
|
|
173
176
|
private flowId;
|
|
174
177
|
type: string;
|
|
175
178
|
instanceId: string;
|
|
@@ -178,37 +181,49 @@ declare module "form/index" {
|
|
|
178
181
|
toJSON(): any;
|
|
179
182
|
getField(fieldId: string): any;
|
|
180
183
|
updateField(args: object): any;
|
|
184
|
+
getTable(tableId: string): Table<this>;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Form with custom-component-only capabilities.
|
|
188
|
+
*
|
|
189
|
+
* Returned by `initForm()` on the custom-component Board/Dataform/Process
|
|
190
|
+
* accessors. Adds the form-state readers (`getValidationErrors`,
|
|
191
|
+
* `getFormConfiguration`, `getFieldState`), which are not available on the
|
|
192
|
+
* base `Form` exposed via `kf.context` in the Low/No-code (Run Script) SDKs.
|
|
193
|
+
*/
|
|
194
|
+
export class CustomComponentForm extends Form {
|
|
181
195
|
getValidationErrors(): any;
|
|
182
196
|
getFormConfiguration(): any;
|
|
183
197
|
getFieldState(): any;
|
|
184
|
-
getTable(tableId: string): Table;
|
|
185
198
|
}
|
|
186
|
-
class Table extends BaseSDK {
|
|
199
|
+
class Table<F extends Form = Form> extends BaseSDK {
|
|
187
200
|
private storeId;
|
|
188
201
|
private flowId;
|
|
189
202
|
private instanceId;
|
|
190
203
|
private tableId;
|
|
191
204
|
private activityInstanceId?;
|
|
192
|
-
|
|
205
|
+
private parent?;
|
|
206
|
+
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, activityInstanceId?: string, parent?: F);
|
|
193
207
|
toJSON(): any;
|
|
194
208
|
getSelectedRows(): any;
|
|
195
|
-
getRows(): TableForm[]
|
|
196
|
-
getRow(rowId: string): TableForm
|
|
209
|
+
getRows(): Promise<TableForm<F>[]>;
|
|
210
|
+
getRow(rowId: string): TableForm<F>;
|
|
197
211
|
addRow(rowObject: object): any;
|
|
198
212
|
addRows(rows: object[]): any;
|
|
199
213
|
deleteRow(rowId: string): any;
|
|
200
214
|
deleteRows(rows: string[]): any;
|
|
201
215
|
}
|
|
202
|
-
export class TableForm extends BaseSDK {
|
|
216
|
+
export class TableForm<F extends Form = Form> extends BaseSDK {
|
|
203
217
|
private storeId;
|
|
204
218
|
private flowId;
|
|
205
219
|
private instanceId;
|
|
206
220
|
private tableId;
|
|
207
221
|
private rowId;
|
|
208
222
|
private activityInstanceId?;
|
|
223
|
+
private parent?;
|
|
209
224
|
type: string;
|
|
210
|
-
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, rowId: string, activityInstanceId?: string);
|
|
211
|
-
getParent():
|
|
225
|
+
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, rowId: string, activityInstanceId?: string, parent?: F);
|
|
226
|
+
getParent(): F;
|
|
212
227
|
toJSON(): any;
|
|
213
228
|
getField(fieldId: string): any;
|
|
214
229
|
updateField(args: object): any;
|
|
@@ -232,13 +247,13 @@ declare module "types/external" {
|
|
|
232
247
|
};
|
|
233
248
|
export type PayloadOptions = {
|
|
234
249
|
Columns?: any[];
|
|
235
|
-
|
|
250
|
+
Filter?: any;
|
|
236
251
|
Sort?: PayloadSortItem[];
|
|
237
252
|
FilterParam?: any;
|
|
238
253
|
};
|
|
239
254
|
export type ProcessPayloadOptions = {
|
|
240
255
|
Columns?: any[];
|
|
241
|
-
|
|
256
|
+
Filter?: any;
|
|
242
257
|
Sort?: PayloadSortItem[];
|
|
243
258
|
};
|
|
244
259
|
export type userObject = {
|
|
@@ -362,7 +377,7 @@ declare module "types/external" {
|
|
|
362
377
|
export type ProcessDiscardItemOptions = {
|
|
363
378
|
instanceId: string;
|
|
364
379
|
};
|
|
365
|
-
export type ProcessFieldOptions = {
|
|
380
|
+
export type ProcessFieldOptions = BaseQueryOptions & {
|
|
366
381
|
instanceId: string;
|
|
367
382
|
activityInstanceId: string;
|
|
368
383
|
fieldId: string;
|
|
@@ -398,6 +413,34 @@ declare module "types/external" {
|
|
|
398
413
|
payload?: PayloadOptions;
|
|
399
414
|
};
|
|
400
415
|
export type DataformQueryResponse = QueryResponse;
|
|
416
|
+
export type ReportFlowType = "Form" | "Process" | "Case";
|
|
417
|
+
export type ReportPayload = {
|
|
418
|
+
FilterParam?: Record<string, string | string[] | object>;
|
|
419
|
+
};
|
|
420
|
+
export type ReportQueryOptions = {
|
|
421
|
+
pageNumber?: number;
|
|
422
|
+
pageSize?: number;
|
|
423
|
+
payload?: ReportPayload;
|
|
424
|
+
};
|
|
425
|
+
export type ReportCountOptions = {
|
|
426
|
+
payload?: ReportPayload;
|
|
427
|
+
};
|
|
428
|
+
export type ReportField = {
|
|
429
|
+
Id: string;
|
|
430
|
+
Name: string;
|
|
431
|
+
[key: string]: any;
|
|
432
|
+
};
|
|
433
|
+
export type ReportDataResponse = {
|
|
434
|
+
Data: any[];
|
|
435
|
+
Columns?: any[];
|
|
436
|
+
Rows?: any[];
|
|
437
|
+
Values?: any[];
|
|
438
|
+
FieldMapping?: any[];
|
|
439
|
+
Formatting?: any[];
|
|
440
|
+
Id?: string;
|
|
441
|
+
Name?: string;
|
|
442
|
+
[key: string]: any;
|
|
443
|
+
};
|
|
401
444
|
export type DataformCreateItemOptions = {
|
|
402
445
|
data?: object;
|
|
403
446
|
viewId?: string;
|
|
@@ -423,7 +466,7 @@ declare module "types/external" {
|
|
|
423
466
|
data?: object;
|
|
424
467
|
viewId?: string;
|
|
425
468
|
};
|
|
426
|
-
export type DataformFieldOptions = {
|
|
469
|
+
export type DataformFieldOptions = BaseQueryOptions & {
|
|
427
470
|
instanceId: string;
|
|
428
471
|
fieldId: string;
|
|
429
472
|
/** Skip the server-side model lookup by supplying the field's type directly. */
|
|
@@ -438,6 +481,7 @@ declare module "types/external" {
|
|
|
438
481
|
export type BoardQueryResponse = QueryResponse;
|
|
439
482
|
export type BoardGetItemOptions = {
|
|
440
483
|
instanceId: string;
|
|
484
|
+
viewId?: string;
|
|
441
485
|
};
|
|
442
486
|
export type BoardCreateItemOptions = {
|
|
443
487
|
data?: object;
|
|
@@ -456,7 +500,7 @@ declare module "types/external" {
|
|
|
456
500
|
export type BoardDiscardItemOptions = {
|
|
457
501
|
instanceId: string;
|
|
458
502
|
};
|
|
459
|
-
export type BoardFieldOptions = {
|
|
503
|
+
export type BoardFieldOptions = BaseQueryOptions & {
|
|
460
504
|
instanceId: string;
|
|
461
505
|
fieldId: string;
|
|
462
506
|
/** Skip the server-side model lookup by supplying the field's type directly. */
|
|
@@ -960,73 +1004,12 @@ declare module "app/decisiontable" {
|
|
|
960
1004
|
evaluate(payload?: object): any;
|
|
961
1005
|
}
|
|
962
1006
|
}
|
|
963
|
-
declare module "app/agent" {
|
|
964
|
-
import { BaseSDK } from "core/index";
|
|
965
|
-
import { AgentContract, AgentError, AgentExecuteOptions, AgentExecution, AgentExecutionAccepted } from "types/external";
|
|
966
|
-
/**
|
|
967
|
-
* A published Custom Agent of the current app.
|
|
968
|
-
*
|
|
969
|
-
* Get one with `kf.app.getAgent(agentId)`. Calls run as the signed-in user, against the Agent's
|
|
970
|
-
* published (Live) definition.
|
|
971
|
-
*/
|
|
972
|
-
export class Agent extends BaseSDK {
|
|
973
|
-
private agentId;
|
|
974
|
-
private _id;
|
|
975
|
-
private activeWatches;
|
|
976
|
-
constructor(agentId: string);
|
|
977
|
-
/**
|
|
978
|
-
* Read the Agent's published contract: its inputs, outputs and readiness.
|
|
979
|
-
*
|
|
980
|
-
* @example
|
|
981
|
-
* const { Definition } = await kf.app.getAgent("AgXXXXXXXXXX").getContract();
|
|
982
|
-
*/
|
|
983
|
-
getContract(): Promise<AgentContract>;
|
|
984
|
-
/**
|
|
985
|
-
* Start a run. Resolves once the run is accepted (`ExecutionId`, `Status`), not when it finishes;
|
|
986
|
-
* use {@link onExecutionComplete} or {@link getExecution} for the result.
|
|
987
|
-
*
|
|
988
|
-
* Never retried: if the call fails with `AGENT_EXECUTE_OUTCOME_UNKNOWN`, a run may still have
|
|
989
|
-
* started, and app code cannot list runs to find it: tell the user the request may still be in
|
|
990
|
-
* progress instead of starting another. `AGENT_EXECUTE_NOT_SENT` means it was not sent (for
|
|
991
|
-
* example, the user is offline).
|
|
992
|
-
*
|
|
993
|
-
* @example
|
|
994
|
-
* const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks", amount: 54000 } });
|
|
995
|
-
*/
|
|
996
|
-
execute(options: AgentExecuteOptions): Promise<AgentExecutionAccepted>;
|
|
997
|
-
/**
|
|
998
|
-
* Read a run's current state, with its `Output` once `Completed` or its `Error` once `Failed`.
|
|
999
|
-
* Callers who are not the App's authors can read only their own runs.
|
|
1000
|
-
*/
|
|
1001
|
-
getExecution(executionId: string): Promise<AgentExecution>;
|
|
1002
|
-
/**
|
|
1003
|
-
* Be told once when a run finishes. `onComplete` gets the run on `Completed` or `Failed` (read
|
|
1004
|
-
* `Status`: a failed run is a result, not an error). `onWatchError` gets what stopped the
|
|
1005
|
-
* observation instead: an unsupported host, an access or network failure, or the observation limit
|
|
1006
|
-
* (`AGENT_OBSERVATION_STOPPED`, after about six minutes; the run may still finish, so read it later
|
|
1007
|
-
* with {@link getExecution}). At most one of the two is called, at most once.
|
|
1008
|
-
*
|
|
1009
|
-
* Neither is called if the script that registered them stops first: form, field, gallery and
|
|
1010
|
-
* table scripts stop after one minute, and they and page event scripts stop when the next script
|
|
1011
|
-
* starts on the same form, component or page. In those scripts, keep the `ExecutionId` and read
|
|
1012
|
-
* it later with {@link getExecution}.
|
|
1013
|
-
*
|
|
1014
|
-
* Returns a function that stops observing. It never cancels the run.
|
|
1015
|
-
*
|
|
1016
|
-
* @example
|
|
1017
|
-
* const stop = agent.onExecutionComplete(ExecutionId, (run) => show(run), (err) => warn(err));
|
|
1018
|
-
* // later, e.g. on unmount
|
|
1019
|
-
* stop();
|
|
1020
|
-
*/
|
|
1021
|
-
onExecutionComplete(executionId: string, onComplete: (execution: AgentExecution) => void, onWatchError?: (error: AgentError) => void): () => void;
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
1007
|
declare module "dataform/index" {
|
|
1025
1008
|
import { BaseSDK } from "core/index";
|
|
1026
|
-
import {
|
|
1009
|
+
import { CustomComponentForm } from "form/index";
|
|
1027
1010
|
import { DataformItem, DataformQueryOptions, DataformQueryResponse, DataformCreateItemOptions, DataformUpdateItemOptions, DataformGetItemOptions, DataformDeleteItemOptions, DataformDiscardItemOptions, DataformSubmitItemOptions, DataformFieldOptions } from "types/external";
|
|
1028
1011
|
export class Dataform extends BaseSDK {
|
|
1029
|
-
|
|
1012
|
+
protected _id: string;
|
|
1030
1013
|
constructor(flowId: string);
|
|
1031
1014
|
/**
|
|
1032
1015
|
* Get all items from this dataform with optional filtering, sorting, and pagination
|
|
@@ -1093,6 +1076,15 @@ declare module "dataform/index" {
|
|
|
1093
1076
|
getFields(options?: {
|
|
1094
1077
|
viewId?: string;
|
|
1095
1078
|
}): Promise<any>;
|
|
1079
|
+
getFieldOptions(options: DataformFieldOptions): Promise<DataformQueryResponse>;
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Dataform with custom-component-only capabilities.
|
|
1083
|
+
*
|
|
1084
|
+
* Returned by `kf.app.getDataform()` inside a custom component. Adds `initForm`,
|
|
1085
|
+
* which is not available in the Low/No-code (Run Script) SDKs.
|
|
1086
|
+
*/
|
|
1087
|
+
export class CustomComponentDataform extends Dataform {
|
|
1096
1088
|
/**
|
|
1097
1089
|
* Initialize a form with all necessary data (schema, item data, form store)
|
|
1098
1090
|
* This is the recommended way to create a custom form for dataform records
|
|
@@ -1115,16 +1107,15 @@ declare module "dataform/index" {
|
|
|
1115
1107
|
* const form = await dataform.initForm();
|
|
1116
1108
|
* await form.updateField({ firstName: "John" });
|
|
1117
1109
|
*/
|
|
1118
|
-
initForm(instanceId?: string, viewId?: string): Promise<
|
|
1119
|
-
getFieldOptions(options?: DataformFieldOptions): Promise<DataformQueryResponse>;
|
|
1110
|
+
initForm(instanceId?: string, viewId?: string): Promise<CustomComponentForm>;
|
|
1120
1111
|
}
|
|
1121
1112
|
}
|
|
1122
1113
|
declare module "board/index" {
|
|
1123
1114
|
import { BaseSDK } from "core/index";
|
|
1124
|
-
import {
|
|
1115
|
+
import { CustomComponentForm } from "form/index";
|
|
1125
1116
|
import { BoardItem, BoardGetItemOptions, BoardGetItemsOptions, BoardQueryResponse, BoardCreateItemOptions, BoardUpdateItemOptions, BoardDeleteItemOptions, BoardSubmitItemOptions, BoardDiscardItemOptions, BoardFieldOptions } from "types/external";
|
|
1126
1117
|
export class Board extends BaseSDK {
|
|
1127
|
-
|
|
1118
|
+
protected _id: string;
|
|
1128
1119
|
constructor(flowId: string);
|
|
1129
1120
|
/**
|
|
1130
1121
|
* Import data from CSV file
|
|
@@ -1148,7 +1139,7 @@ declare module "board/index" {
|
|
|
1148
1139
|
getItems(options?: BoardGetItemsOptions): Promise<BoardQueryResponse>;
|
|
1149
1140
|
/**
|
|
1150
1141
|
* Get a single board/case item by instance ID
|
|
1151
|
-
* @param options - instanceId (required)
|
|
1142
|
+
* @param options - instanceId (required), optional viewId
|
|
1152
1143
|
* @returns Promise containing the item data
|
|
1153
1144
|
*/
|
|
1154
1145
|
getItem(options: BoardGetItemOptions): Promise<BoardItem>;
|
|
@@ -1159,7 +1150,7 @@ declare module "board/index" {
|
|
|
1159
1150
|
*
|
|
1160
1151
|
* @example
|
|
1161
1152
|
* const board = kf.app.getBoard("Inventory");
|
|
1162
|
-
* const item = await board.createItem({ data: {
|
|
1153
|
+
* const item = await board.createItem({ data: { itemType: "New Item" } });
|
|
1163
1154
|
*/
|
|
1164
1155
|
createItem(options?: BoardCreateItemOptions): Promise<BoardItem>;
|
|
1165
1156
|
/**
|
|
@@ -1171,7 +1162,7 @@ declare module "board/index" {
|
|
|
1171
1162
|
* const board = kf.app.getBoard("Inventory");
|
|
1172
1163
|
* await board.updateItem({
|
|
1173
1164
|
* instanceId: "item_123",
|
|
1174
|
-
* data: {
|
|
1165
|
+
* data: { itemType: "Updated Item" }
|
|
1175
1166
|
* });
|
|
1176
1167
|
*/
|
|
1177
1168
|
updateItem(options: BoardUpdateItemOptions): Promise<BoardItem>;
|
|
@@ -1202,6 +1193,27 @@ declare module "board/index" {
|
|
|
1202
1193
|
getFields(options?: {
|
|
1203
1194
|
viewId?: string;
|
|
1204
1195
|
}): Promise<any>;
|
|
1196
|
+
/**
|
|
1197
|
+
* Get field options for dropdown/lookup fields
|
|
1198
|
+
* @param options - Field options (instanceId, fieldId)
|
|
1199
|
+
* @returns Promise containing the field options
|
|
1200
|
+
*
|
|
1201
|
+
* @example
|
|
1202
|
+
* const board = kf.app.getBoard("Inventory");
|
|
1203
|
+
* const options = await board.getFieldOptions({
|
|
1204
|
+
* instanceId: "item_123",
|
|
1205
|
+
* fieldId: "Category"
|
|
1206
|
+
* });
|
|
1207
|
+
*/
|
|
1208
|
+
getFieldOptions(options: BoardFieldOptions): Promise<any>;
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Board with custom-component-only capabilities.
|
|
1212
|
+
*
|
|
1213
|
+
* Returned by `kf.app.getBoard()` inside a custom component. Adds `initForm`,
|
|
1214
|
+
* which is not available in the Low/No-code (Run Script) SDKs.
|
|
1215
|
+
*/
|
|
1216
|
+
export class CustomComponentBoard extends Board {
|
|
1205
1217
|
/**
|
|
1206
1218
|
* Initialize a form for a board item with all necessary setup
|
|
1207
1219
|
* Fetches schema, item data, creates and initializes the form store
|
|
@@ -1214,7 +1226,7 @@ declare module "board/index" {
|
|
|
1214
1226
|
* // Create new board item
|
|
1215
1227
|
* const board = kf.app.getBoard("Inventory");
|
|
1216
1228
|
* const form = await board.initForm();
|
|
1217
|
-
* await form.updateField({
|
|
1229
|
+
* await form.updateField({ itemType: "New Item" });
|
|
1218
1230
|
*
|
|
1219
1231
|
* // Edit existing board item
|
|
1220
1232
|
* const form = await board.initForm("item_123");
|
|
@@ -1223,28 +1235,15 @@ declare module "board/index" {
|
|
|
1223
1235
|
* // Edit existing board item scoped to a view
|
|
1224
1236
|
* const form = await board.initForm("item_123", "Inventory_View");
|
|
1225
1237
|
*/
|
|
1226
|
-
initForm(instanceId?: string, viewId?: string): Promise<
|
|
1227
|
-
/**
|
|
1228
|
-
* Get field options for dropdown/lookup fields
|
|
1229
|
-
* @param options - Field options (instanceId, fieldId)
|
|
1230
|
-
* @returns Promise containing the field options
|
|
1231
|
-
*
|
|
1232
|
-
* @example
|
|
1233
|
-
* const board = kf.app.getBoard("Inventory");
|
|
1234
|
-
* const options = await board.getFieldOptions({
|
|
1235
|
-
* instanceId: "item_123",
|
|
1236
|
-
* fieldId: "Category"
|
|
1237
|
-
* });
|
|
1238
|
-
*/
|
|
1239
|
-
getFieldOptions(options: BoardFieldOptions): Promise<any>;
|
|
1238
|
+
initForm(instanceId?: string, viewId?: string): Promise<CustomComponentForm>;
|
|
1240
1239
|
}
|
|
1241
1240
|
}
|
|
1242
1241
|
declare module "process/index" {
|
|
1243
1242
|
import { BaseSDK } from "core/index";
|
|
1244
|
-
import {
|
|
1243
|
+
import { CustomComponentForm } from "form/index";
|
|
1245
1244
|
import { ProcessItem, ProcessGetItemOptions, ProcessMyItemsOptions, ProcessMyTasksOptions, ProcessParticipatedOptions, ProcessAdminOptions, ProcessQueryResponse, ProcessCreateItemOptions, ProcessUpdateItemOptions, ProcessDeleteItemOptions, ProcessGetAdminItemOptions, ProcessUpdateAdminItemOptions, ProcessSubmitItemOptions, ProcessRejectItemOptions, ProcessWithdrawItemOptions, ProcessSendbackItemOptions, ProcessReassignItemOptions, ProcessGetReassigneesOptions, ProcessRestartItemOptions, ProcessDiscardItemOptions, ProcessFieldOptions, ProcessParseAttachmentOptions, ProcessAttachmentParseResult } from "types/external";
|
|
1246
1245
|
export class Process extends BaseSDK {
|
|
1247
|
-
|
|
1246
|
+
protected _id: string;
|
|
1248
1247
|
constructor(flowId: string);
|
|
1249
1248
|
/**
|
|
1250
1249
|
* Get my items from this process (items I initiated)
|
|
@@ -1450,26 +1449,7 @@ declare module "process/index" {
|
|
|
1450
1449
|
getProgress(options: {
|
|
1451
1450
|
instanceId: string;
|
|
1452
1451
|
}): Promise<any>;
|
|
1453
|
-
|
|
1454
|
-
* Initialize a form with all necessary data (schema, item data, form store)
|
|
1455
|
-
* This is the recommended way to create a custom form for dataform records
|
|
1456
|
-
* It automatically handles fetching schema, item data, and initializing the form store
|
|
1457
|
-
*
|
|
1458
|
-
* @param instanceId - Optional instance ID of the dataform record. If omitted, creates a new record
|
|
1459
|
-
* @returns Promise with Form instance ready to use
|
|
1460
|
-
*
|
|
1461
|
-
* @example
|
|
1462
|
-
* // Load existing record
|
|
1463
|
-
* const dataform = kf.app.getDataform("EmpMaster");
|
|
1464
|
-
* const form = await dataform.initForm("emp_123");
|
|
1465
|
-
* const data = await form.toJSON();
|
|
1466
|
-
*
|
|
1467
|
-
* // Create new record
|
|
1468
|
-
* const form = await dataform.initForm();
|
|
1469
|
-
* await form.updateField({ firstName: "John" });
|
|
1470
|
-
*/
|
|
1471
|
-
initForm(instanceId?: string, activityInstanceId?: string): Promise<Form>;
|
|
1472
|
-
getFieldOptions(options?: ProcessFieldOptions): Promise<ProcessQueryResponse>;
|
|
1452
|
+
getFieldOptions(options: ProcessFieldOptions): Promise<ProcessQueryResponse>;
|
|
1473
1453
|
/**
|
|
1474
1454
|
* Trigger AI document parsing on an uploaded file for a Smart Attachment field.
|
|
1475
1455
|
* Matches native platform behavior: matching empty fields are auto-filled directly
|
|
@@ -1485,17 +1465,133 @@ declare module "process/index" {
|
|
|
1485
1465
|
*/
|
|
1486
1466
|
parseAttachment(options: ProcessParseAttachmentOptions): Promise<ProcessAttachmentParseResult>;
|
|
1487
1467
|
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Process with custom-component-only capabilities.
|
|
1470
|
+
*
|
|
1471
|
+
* Returned by `kf.app.getProcess()` inside a custom component. Adds `initForm`,
|
|
1472
|
+
* which is not available in the Low/No-code (Run Script) SDKs.
|
|
1473
|
+
*/
|
|
1474
|
+
export class CustomComponentProcess extends Process {
|
|
1475
|
+
/**
|
|
1476
|
+
* Initialize a form with all necessary data (schema, item data, form store)
|
|
1477
|
+
* This is the recommended way to create a custom form for process instances
|
|
1478
|
+
* It automatically handles fetching schema, item data, and initializing the form store
|
|
1479
|
+
*
|
|
1480
|
+
* @param instanceId - Optional instance ID of the process record. If omitted, creates a new instance
|
|
1481
|
+
* @param activityInstanceId - Optional activity (task) instance the form is being filled for
|
|
1482
|
+
* @returns Promise with Form instance ready to use
|
|
1483
|
+
*
|
|
1484
|
+
* @example
|
|
1485
|
+
* // Start a new process instance
|
|
1486
|
+
* const form = await process.initForm();
|
|
1487
|
+
* await form.updateField({ LeaveType: "Annual" });
|
|
1488
|
+
*
|
|
1489
|
+
* // Continue an in-progress task
|
|
1490
|
+
* const form = await process.initForm("item_123", "act_456");
|
|
1491
|
+
* const data = await form.toJSON();
|
|
1492
|
+
*/
|
|
1493
|
+
initForm(instanceId?: string, activityInstanceId?: string): Promise<CustomComponentForm>;
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
declare module "app/agent" {
|
|
1497
|
+
import { BaseSDK } from "core/index";
|
|
1498
|
+
import { AgentContract, AgentError, AgentExecuteOptions, AgentExecution, AgentExecutionAccepted } from "types/external";
|
|
1499
|
+
/**
|
|
1500
|
+
* A published Custom Agent of the current app.
|
|
1501
|
+
*
|
|
1502
|
+
* Get one with `kf.app.getAgent(agentId)`. Calls run as the signed-in user, against the Agent's
|
|
1503
|
+
* published (Live) definition.
|
|
1504
|
+
*/
|
|
1505
|
+
export class Agent extends BaseSDK {
|
|
1506
|
+
private agentId;
|
|
1507
|
+
private _id;
|
|
1508
|
+
private activeWatches;
|
|
1509
|
+
constructor(agentId: string);
|
|
1510
|
+
/**
|
|
1511
|
+
* Read the Agent's published contract: its inputs, outputs and readiness.
|
|
1512
|
+
*
|
|
1513
|
+
* @example
|
|
1514
|
+
* const { Definition } = await kf.app.getAgent("AgXXXXXXXXXX").getContract();
|
|
1515
|
+
*/
|
|
1516
|
+
getContract(): Promise<AgentContract>;
|
|
1517
|
+
/**
|
|
1518
|
+
* Start a run. Resolves once the run is accepted (`ExecutionId`, `Status`), not when it finishes;
|
|
1519
|
+
* use {@link onExecutionComplete} or {@link getExecution} for the result.
|
|
1520
|
+
*
|
|
1521
|
+
* Never retried: if the call fails with `AGENT_EXECUTE_OUTCOME_UNKNOWN`, a run may still have
|
|
1522
|
+
* started, and app code cannot list runs to find it: tell the user the request may still be in
|
|
1523
|
+
* progress instead of starting another. `AGENT_EXECUTE_NOT_SENT` means it was not sent (for
|
|
1524
|
+
* example, the user is offline).
|
|
1525
|
+
*
|
|
1526
|
+
* @example
|
|
1527
|
+
* const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks", amount: 54000 } });
|
|
1528
|
+
*/
|
|
1529
|
+
execute(options: AgentExecuteOptions): Promise<AgentExecutionAccepted>;
|
|
1530
|
+
/**
|
|
1531
|
+
* Read a run's current state, with its `Output` once `Completed` or its `Error` once `Failed`.
|
|
1532
|
+
* Callers who are not the App's authors can read only their own runs.
|
|
1533
|
+
*/
|
|
1534
|
+
getExecution(executionId: string): Promise<AgentExecution>;
|
|
1535
|
+
/**
|
|
1536
|
+
* Be told once when a run finishes. `onComplete` gets the run on `Completed` or `Failed` (read
|
|
1537
|
+
* `Status`: a failed run is a result, not an error). `onWatchError` gets what stopped the
|
|
1538
|
+
* observation instead: an unsupported host, an access or network failure, or the observation limit
|
|
1539
|
+
* (`AGENT_OBSERVATION_STOPPED`, after about six minutes; the run may still finish, so read it later
|
|
1540
|
+
* with {@link getExecution}). At most one of the two is called, at most once.
|
|
1541
|
+
*
|
|
1542
|
+
* Neither is called if the script that registered them stops first: form, field, gallery and
|
|
1543
|
+
* table scripts stop after one minute, and they and page event scripts stop when the next script
|
|
1544
|
+
* starts on the same form, component or page. In those scripts, keep the `ExecutionId` and read
|
|
1545
|
+
* it later with {@link getExecution}.
|
|
1546
|
+
*
|
|
1547
|
+
* Returns a function that stops observing. It never cancels the run.
|
|
1548
|
+
*
|
|
1549
|
+
* @example
|
|
1550
|
+
* const stop = agent.onExecutionComplete(ExecutionId, (run) => show(run), (err) => warn(err));
|
|
1551
|
+
* // later, e.g. on unmount
|
|
1552
|
+
* stop();
|
|
1553
|
+
*/
|
|
1554
|
+
onExecutionComplete(executionId: string, onComplete: (execution: AgentExecution) => void, onWatchError?: (error: AgentError) => void): () => void;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
declare module "app/report" {
|
|
1558
|
+
import { BaseSDK } from "core/index";
|
|
1559
|
+
import { ReportFlowType, ReportQueryOptions, ReportCountOptions, ReportField, ReportDataResponse } from "types/external";
|
|
1560
|
+
/**
|
|
1561
|
+
* A flow report of the current app. The handle sends no request until you call one of its methods.
|
|
1562
|
+
*
|
|
1563
|
+
* @example
|
|
1564
|
+
* const report = kf.app.getReport("Process", "Leave_Request_A00", "Requests_by_status_x1Yz");
|
|
1565
|
+
* const { Data } = await report.getData();
|
|
1566
|
+
*/
|
|
1567
|
+
export class Report extends BaseSDK {
|
|
1568
|
+
private _flowType;
|
|
1569
|
+
private _flowId;
|
|
1570
|
+
private _id;
|
|
1571
|
+
constructor(flowType: ReportFlowType, flowId: string, reportId: string);
|
|
1572
|
+
/**
|
|
1573
|
+
* The report's calculated rows: groups and their values for a chart, the aggregate for a card.
|
|
1574
|
+
* @param options - pageNumber (a whole number from 1, default 1), pageSize (a whole number from 1 to 100, default 50), payload (sent as the request body; filter at read time with the report's parameters, { FilterParam: { "$name": "text" } }; a falsy value is skipped, so send 0 as "0")
|
|
1575
|
+
*/
|
|
1576
|
+
getData(options?: ReportQueryOptions): Promise<ReportDataResponse>;
|
|
1577
|
+
/** The number of rows a tabular report would return. Chart and card reports have no row count; use getData(). */
|
|
1578
|
+
getCount(options?: ReportCountOptions): Promise<number>;
|
|
1579
|
+
/** The fields of a tabular report. Empty for chart and card reports; use getData(). */
|
|
1580
|
+
getFields(): Promise<ReportField[]>;
|
|
1581
|
+
private _send;
|
|
1582
|
+
}
|
|
1488
1583
|
}
|
|
1489
1584
|
declare module "app/index" {
|
|
1490
1585
|
import { BaseSDK } from "core/index";
|
|
1491
1586
|
import { Page } from "app/page";
|
|
1492
1587
|
import { AppContext } from "types/internal";
|
|
1493
|
-
import { rolesObject, RunEnvelope, RunWatchError } from "types/external";
|
|
1588
|
+
import { rolesObject, ReportFlowType, RunEnvelope, RunWatchError } from "types/external";
|
|
1494
1589
|
import { DecisionTable } from "app/decisiontable";
|
|
1590
|
+
import { Dataform, CustomComponentDataform } from "dataform/index";
|
|
1591
|
+
import { Board, CustomComponentBoard } from "board/index";
|
|
1592
|
+
import { Process, CustomComponentProcess } from "process/index";
|
|
1495
1593
|
import { Agent } from "app/agent";
|
|
1496
|
-
import {
|
|
1497
|
-
import { Board } from "board/index";
|
|
1498
|
-
import { Process } from "process/index";
|
|
1594
|
+
import { Report } from "app/report";
|
|
1499
1595
|
export class Application extends BaseSDK {
|
|
1500
1596
|
page: Page;
|
|
1501
1597
|
_id: string;
|
|
@@ -1567,6 +1663,14 @@ declare module "app/index" {
|
|
|
1567
1663
|
* const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks" } });
|
|
1568
1664
|
*/
|
|
1569
1665
|
getAgent(agentId: string): Agent;
|
|
1666
|
+
/**
|
|
1667
|
+
* Get a flow report of this app: one call returns the report's calculated data instead of every record.
|
|
1668
|
+
*
|
|
1669
|
+
* @example
|
|
1670
|
+
* const report = kf.app.getReport("Process", "Leave_Request_A00", "Requests_by_status_x1Yz");
|
|
1671
|
+
* const { Data } = await report.getData();
|
|
1672
|
+
*/
|
|
1673
|
+
getReport(flowType: ReportFlowType, flowId: string, reportId: string): Report;
|
|
1570
1674
|
getDataform(flowId: string): Dataform;
|
|
1571
1675
|
getBoard(flowId: string): Board;
|
|
1572
1676
|
getProcess(flowId: string): Process;
|
|
@@ -1608,8 +1712,21 @@ declare module "app/index" {
|
|
|
1608
1712
|
roleName?: string;
|
|
1609
1713
|
}): Promise<rolesObject>;
|
|
1610
1714
|
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Application with custom-component-only capabilities.
|
|
1717
|
+
*
|
|
1718
|
+
* Used by the custom-component SDK (`kf.app`). Its flow accessors return the
|
|
1719
|
+
* `CustomComponent*` variants, which expose `initForm` — a method that the
|
|
1720
|
+
* Low/No-code (Run Script) SDKs deliberately do not have.
|
|
1721
|
+
*/
|
|
1722
|
+
export class CustomComponentApplication extends Application {
|
|
1723
|
+
getDataform(flowId: string): CustomComponentDataform;
|
|
1724
|
+
getBoard(flowId: string): CustomComponentBoard;
|
|
1725
|
+
getProcess(flowId: string): CustomComponentProcess;
|
|
1726
|
+
}
|
|
1611
1727
|
export * from "app/component";
|
|
1612
1728
|
export { Agent };
|
|
1729
|
+
export { Report };
|
|
1613
1730
|
export { Page };
|
|
1614
1731
|
export * from "app/popup";
|
|
1615
1732
|
}
|