@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/index.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;
|
|
@@ -184,13 +187,13 @@ declare module "types/external" {
|
|
|
184
187
|
};
|
|
185
188
|
export type PayloadOptions = {
|
|
186
189
|
Columns?: any[];
|
|
187
|
-
|
|
190
|
+
Filter?: any;
|
|
188
191
|
Sort?: PayloadSortItem[];
|
|
189
192
|
FilterParam?: any;
|
|
190
193
|
};
|
|
191
194
|
export type ProcessPayloadOptions = {
|
|
192
195
|
Columns?: any[];
|
|
193
|
-
|
|
196
|
+
Filter?: any;
|
|
194
197
|
Sort?: PayloadSortItem[];
|
|
195
198
|
};
|
|
196
199
|
export type userObject = {
|
|
@@ -314,7 +317,7 @@ declare module "types/external" {
|
|
|
314
317
|
export type ProcessDiscardItemOptions = {
|
|
315
318
|
instanceId: string;
|
|
316
319
|
};
|
|
317
|
-
export type ProcessFieldOptions = {
|
|
320
|
+
export type ProcessFieldOptions = BaseQueryOptions & {
|
|
318
321
|
instanceId: string;
|
|
319
322
|
activityInstanceId: string;
|
|
320
323
|
fieldId: string;
|
|
@@ -350,6 +353,34 @@ declare module "types/external" {
|
|
|
350
353
|
payload?: PayloadOptions;
|
|
351
354
|
};
|
|
352
355
|
export type DataformQueryResponse = QueryResponse;
|
|
356
|
+
export type ReportFlowType = "Form" | "Process" | "Case";
|
|
357
|
+
export type ReportPayload = {
|
|
358
|
+
FilterParam?: Record<string, string | string[] | object>;
|
|
359
|
+
};
|
|
360
|
+
export type ReportQueryOptions = {
|
|
361
|
+
pageNumber?: number;
|
|
362
|
+
pageSize?: number;
|
|
363
|
+
payload?: ReportPayload;
|
|
364
|
+
};
|
|
365
|
+
export type ReportCountOptions = {
|
|
366
|
+
payload?: ReportPayload;
|
|
367
|
+
};
|
|
368
|
+
export type ReportField = {
|
|
369
|
+
Id: string;
|
|
370
|
+
Name: string;
|
|
371
|
+
[key: string]: any;
|
|
372
|
+
};
|
|
373
|
+
export type ReportDataResponse = {
|
|
374
|
+
Data: any[];
|
|
375
|
+
Columns?: any[];
|
|
376
|
+
Rows?: any[];
|
|
377
|
+
Values?: any[];
|
|
378
|
+
FieldMapping?: any[];
|
|
379
|
+
Formatting?: any[];
|
|
380
|
+
Id?: string;
|
|
381
|
+
Name?: string;
|
|
382
|
+
[key: string]: any;
|
|
383
|
+
};
|
|
353
384
|
export type DataformCreateItemOptions = {
|
|
354
385
|
data?: object;
|
|
355
386
|
viewId?: string;
|
|
@@ -375,7 +406,7 @@ declare module "types/external" {
|
|
|
375
406
|
data?: object;
|
|
376
407
|
viewId?: string;
|
|
377
408
|
};
|
|
378
|
-
export type DataformFieldOptions = {
|
|
409
|
+
export type DataformFieldOptions = BaseQueryOptions & {
|
|
379
410
|
instanceId: string;
|
|
380
411
|
fieldId: string;
|
|
381
412
|
/** Skip the server-side model lookup by supplying the field's type directly. */
|
|
@@ -390,6 +421,7 @@ declare module "types/external" {
|
|
|
390
421
|
export type BoardQueryResponse = QueryResponse;
|
|
391
422
|
export type BoardGetItemOptions = {
|
|
392
423
|
instanceId: string;
|
|
424
|
+
viewId?: string;
|
|
393
425
|
};
|
|
394
426
|
export type BoardCreateItemOptions = {
|
|
395
427
|
data?: object;
|
|
@@ -408,7 +440,7 @@ declare module "types/external" {
|
|
|
408
440
|
export type BoardDiscardItemOptions = {
|
|
409
441
|
instanceId: string;
|
|
410
442
|
};
|
|
411
|
-
export type BoardFieldOptions = {
|
|
443
|
+
export type BoardFieldOptions = BaseQueryOptions & {
|
|
412
444
|
instanceId: string;
|
|
413
445
|
fieldId: string;
|
|
414
446
|
/** Skip the server-side model lookup by supplying the field's type directly. */
|
|
@@ -912,71 +944,10 @@ declare module "app/decisiontable" {
|
|
|
912
944
|
evaluate(payload?: object): any;
|
|
913
945
|
}
|
|
914
946
|
}
|
|
915
|
-
declare module "app/agent" {
|
|
916
|
-
import { BaseSDK } from "core/index";
|
|
917
|
-
import { AgentContract, AgentError, AgentExecuteOptions, AgentExecution, AgentExecutionAccepted } from "types/external";
|
|
918
|
-
/**
|
|
919
|
-
* A published Custom Agent of the current app.
|
|
920
|
-
*
|
|
921
|
-
* Get one with `kf.app.getAgent(agentId)`. Calls run as the signed-in user, against the Agent's
|
|
922
|
-
* published (Live) definition.
|
|
923
|
-
*/
|
|
924
|
-
export class Agent extends BaseSDK {
|
|
925
|
-
private agentId;
|
|
926
|
-
private _id;
|
|
927
|
-
private activeWatches;
|
|
928
|
-
constructor(agentId: string);
|
|
929
|
-
/**
|
|
930
|
-
* Read the Agent's published contract: its inputs, outputs and readiness.
|
|
931
|
-
*
|
|
932
|
-
* @example
|
|
933
|
-
* const { Definition } = await kf.app.getAgent("AgXXXXXXXXXX").getContract();
|
|
934
|
-
*/
|
|
935
|
-
getContract(): Promise<AgentContract>;
|
|
936
|
-
/**
|
|
937
|
-
* Start a run. Resolves once the run is accepted (`ExecutionId`, `Status`), not when it finishes;
|
|
938
|
-
* use {@link onExecutionComplete} or {@link getExecution} for the result.
|
|
939
|
-
*
|
|
940
|
-
* Never retried: if the call fails with `AGENT_EXECUTE_OUTCOME_UNKNOWN`, a run may still have
|
|
941
|
-
* started, and app code cannot list runs to find it: tell the user the request may still be in
|
|
942
|
-
* progress instead of starting another. `AGENT_EXECUTE_NOT_SENT` means it was not sent (for
|
|
943
|
-
* example, the user is offline).
|
|
944
|
-
*
|
|
945
|
-
* @example
|
|
946
|
-
* const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks", amount: 54000 } });
|
|
947
|
-
*/
|
|
948
|
-
execute(options: AgentExecuteOptions): Promise<AgentExecutionAccepted>;
|
|
949
|
-
/**
|
|
950
|
-
* Read a run's current state, with its `Output` once `Completed` or its `Error` once `Failed`.
|
|
951
|
-
* Callers who are not the App's authors can read only their own runs.
|
|
952
|
-
*/
|
|
953
|
-
getExecution(executionId: string): Promise<AgentExecution>;
|
|
954
|
-
/**
|
|
955
|
-
* Be told once when a run finishes. `onComplete` gets the run on `Completed` or `Failed` (read
|
|
956
|
-
* `Status`: a failed run is a result, not an error). `onWatchError` gets what stopped the
|
|
957
|
-
* observation instead: an unsupported host, an access or network failure, or the observation limit
|
|
958
|
-
* (`AGENT_OBSERVATION_STOPPED`, after about six minutes; the run may still finish, so read it later
|
|
959
|
-
* with {@link getExecution}). At most one of the two is called, at most once.
|
|
960
|
-
*
|
|
961
|
-
* Neither is called if the script that registered them stops first: form, field, gallery and
|
|
962
|
-
* table scripts stop after one minute, and they and page event scripts stop when the next script
|
|
963
|
-
* starts on the same form, component or page. In those scripts, keep the `ExecutionId` and read
|
|
964
|
-
* it later with {@link getExecution}.
|
|
965
|
-
*
|
|
966
|
-
* Returns a function that stops observing. It never cancels the run.
|
|
967
|
-
*
|
|
968
|
-
* @example
|
|
969
|
-
* const stop = agent.onExecutionComplete(ExecutionId, (run) => show(run), (err) => warn(err));
|
|
970
|
-
* // later, e.g. on unmount
|
|
971
|
-
* stop();
|
|
972
|
-
*/
|
|
973
|
-
onExecutionComplete(executionId: string, onComplete: (execution: AgentExecution) => void, onWatchError?: (error: AgentError) => void): () => void;
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
947
|
declare module "form/index" {
|
|
977
948
|
import { BaseSDK } from "core/index";
|
|
978
949
|
export class Form extends BaseSDK {
|
|
979
|
-
|
|
950
|
+
protected storeId: string;
|
|
980
951
|
private flowId;
|
|
981
952
|
type: string;
|
|
982
953
|
instanceId: string;
|
|
@@ -985,37 +956,49 @@ declare module "form/index" {
|
|
|
985
956
|
toJSON(): any;
|
|
986
957
|
getField(fieldId: string): any;
|
|
987
958
|
updateField(args: object): any;
|
|
959
|
+
getTable(tableId: string): Table<this>;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Form with custom-component-only capabilities.
|
|
963
|
+
*
|
|
964
|
+
* Returned by `initForm()` on the custom-component Board/Dataform/Process
|
|
965
|
+
* accessors. Adds the form-state readers (`getValidationErrors`,
|
|
966
|
+
* `getFormConfiguration`, `getFieldState`), which are not available on the
|
|
967
|
+
* base `Form` exposed via `kf.context` in the Low/No-code (Run Script) SDKs.
|
|
968
|
+
*/
|
|
969
|
+
export class CustomComponentForm extends Form {
|
|
988
970
|
getValidationErrors(): any;
|
|
989
971
|
getFormConfiguration(): any;
|
|
990
972
|
getFieldState(): any;
|
|
991
|
-
getTable(tableId: string): Table;
|
|
992
973
|
}
|
|
993
|
-
class Table extends BaseSDK {
|
|
974
|
+
class Table<F extends Form = Form> extends BaseSDK {
|
|
994
975
|
private storeId;
|
|
995
976
|
private flowId;
|
|
996
977
|
private instanceId;
|
|
997
978
|
private tableId;
|
|
998
979
|
private activityInstanceId?;
|
|
999
|
-
|
|
980
|
+
private parent?;
|
|
981
|
+
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, activityInstanceId?: string, parent?: F);
|
|
1000
982
|
toJSON(): any;
|
|
1001
983
|
getSelectedRows(): any;
|
|
1002
|
-
getRows(): TableForm[]
|
|
1003
|
-
getRow(rowId: string): TableForm
|
|
984
|
+
getRows(): Promise<TableForm<F>[]>;
|
|
985
|
+
getRow(rowId: string): TableForm<F>;
|
|
1004
986
|
addRow(rowObject: object): any;
|
|
1005
987
|
addRows(rows: object[]): any;
|
|
1006
988
|
deleteRow(rowId: string): any;
|
|
1007
989
|
deleteRows(rows: string[]): any;
|
|
1008
990
|
}
|
|
1009
|
-
export class TableForm extends BaseSDK {
|
|
991
|
+
export class TableForm<F extends Form = Form> extends BaseSDK {
|
|
1010
992
|
private storeId;
|
|
1011
993
|
private flowId;
|
|
1012
994
|
private instanceId;
|
|
1013
995
|
private tableId;
|
|
1014
996
|
private rowId;
|
|
1015
997
|
private activityInstanceId?;
|
|
998
|
+
private parent?;
|
|
1016
999
|
type: string;
|
|
1017
|
-
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, rowId: string, activityInstanceId?: string);
|
|
1018
|
-
getParent():
|
|
1000
|
+
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, rowId: string, activityInstanceId?: string, parent?: F);
|
|
1001
|
+
getParent(): F;
|
|
1019
1002
|
toJSON(): any;
|
|
1020
1003
|
getField(fieldId: string): any;
|
|
1021
1004
|
updateField(args: object): any;
|
|
@@ -1023,10 +1006,10 @@ declare module "form/index" {
|
|
|
1023
1006
|
}
|
|
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,18 +1712,31 @@ 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
|
}
|
|
1616
1733
|
declare module "index" {
|
|
1617
1734
|
import { BaseSDK } from "core/index";
|
|
1618
|
-
import {
|
|
1735
|
+
import { CustomComponentApplication, Page, CustomComponent } from "app/index";
|
|
1619
1736
|
import { Client, Formatter } from "utils/index";
|
|
1620
1737
|
import { userObject, accountObject, environmentObject } from "types/external";
|
|
1621
1738
|
class CustomComponentSDK extends BaseSDK {
|
|
1622
|
-
app:
|
|
1739
|
+
app: CustomComponentApplication;
|
|
1623
1740
|
page: Page;
|
|
1624
1741
|
user: userObject;
|
|
1625
1742
|
account: accountObject;
|