@kissflow/lowcode-client-sdk 1.0.52 → 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 +202 -153
- package/dist/kf.lowcodeworkersdk.es.js +231 -262
- package/dist/kf.nocodeworkersdk.es.js +761 -0
- package/dist/kfsdk.es.js +295 -246
- package/dist/kfsdk.umd.js +1 -1
- package/dist/lowcode.d.ts +200 -151
- package/dist/lowcode.types.d.ts +74 -136
- package/dist/nocode.d.ts +139 -90
- package/dist/nocode.types.d.ts +8 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -187,13 +187,13 @@ declare module "types/external" {
|
|
|
187
187
|
};
|
|
188
188
|
export type PayloadOptions = {
|
|
189
189
|
Columns?: any[];
|
|
190
|
-
|
|
190
|
+
Filter?: any;
|
|
191
191
|
Sort?: PayloadSortItem[];
|
|
192
192
|
FilterParam?: any;
|
|
193
193
|
};
|
|
194
194
|
export type ProcessPayloadOptions = {
|
|
195
195
|
Columns?: any[];
|
|
196
|
-
|
|
196
|
+
Filter?: any;
|
|
197
197
|
Sort?: PayloadSortItem[];
|
|
198
198
|
};
|
|
199
199
|
export type userObject = {
|
|
@@ -317,7 +317,7 @@ declare module "types/external" {
|
|
|
317
317
|
export type ProcessDiscardItemOptions = {
|
|
318
318
|
instanceId: string;
|
|
319
319
|
};
|
|
320
|
-
export type ProcessFieldOptions = {
|
|
320
|
+
export type ProcessFieldOptions = BaseQueryOptions & {
|
|
321
321
|
instanceId: string;
|
|
322
322
|
activityInstanceId: string;
|
|
323
323
|
fieldId: string;
|
|
@@ -406,7 +406,7 @@ declare module "types/external" {
|
|
|
406
406
|
data?: object;
|
|
407
407
|
viewId?: string;
|
|
408
408
|
};
|
|
409
|
-
export type DataformFieldOptions = {
|
|
409
|
+
export type DataformFieldOptions = BaseQueryOptions & {
|
|
410
410
|
instanceId: string;
|
|
411
411
|
fieldId: string;
|
|
412
412
|
/** Skip the server-side model lookup by supplying the field's type directly. */
|
|
@@ -421,6 +421,7 @@ declare module "types/external" {
|
|
|
421
421
|
export type BoardQueryResponse = QueryResponse;
|
|
422
422
|
export type BoardGetItemOptions = {
|
|
423
423
|
instanceId: string;
|
|
424
|
+
viewId?: string;
|
|
424
425
|
};
|
|
425
426
|
export type BoardCreateItemOptions = {
|
|
426
427
|
data?: object;
|
|
@@ -439,7 +440,7 @@ declare module "types/external" {
|
|
|
439
440
|
export type BoardDiscardItemOptions = {
|
|
440
441
|
instanceId: string;
|
|
441
442
|
};
|
|
442
|
-
export type BoardFieldOptions = {
|
|
443
|
+
export type BoardFieldOptions = BaseQueryOptions & {
|
|
443
444
|
instanceId: string;
|
|
444
445
|
fieldId: string;
|
|
445
446
|
/** Skip the server-side model lookup by supplying the field's type directly. */
|
|
@@ -943,98 +944,10 @@ declare module "app/decisiontable" {
|
|
|
943
944
|
evaluate(payload?: object): any;
|
|
944
945
|
}
|
|
945
946
|
}
|
|
946
|
-
declare module "app/agent" {
|
|
947
|
-
import { BaseSDK } from "core/index";
|
|
948
|
-
import { AgentContract, AgentError, AgentExecuteOptions, AgentExecution, AgentExecutionAccepted } from "types/external";
|
|
949
|
-
/**
|
|
950
|
-
* A published Custom Agent of the current app.
|
|
951
|
-
*
|
|
952
|
-
* Get one with `kf.app.getAgent(agentId)`. Calls run as the signed-in user, against the Agent's
|
|
953
|
-
* published (Live) definition.
|
|
954
|
-
*/
|
|
955
|
-
export class Agent extends BaseSDK {
|
|
956
|
-
private agentId;
|
|
957
|
-
private _id;
|
|
958
|
-
private activeWatches;
|
|
959
|
-
constructor(agentId: string);
|
|
960
|
-
/**
|
|
961
|
-
* Read the Agent's published contract: its inputs, outputs and readiness.
|
|
962
|
-
*
|
|
963
|
-
* @example
|
|
964
|
-
* const { Definition } = await kf.app.getAgent("AgXXXXXXXXXX").getContract();
|
|
965
|
-
*/
|
|
966
|
-
getContract(): Promise<AgentContract>;
|
|
967
|
-
/**
|
|
968
|
-
* Start a run. Resolves once the run is accepted (`ExecutionId`, `Status`), not when it finishes;
|
|
969
|
-
* use {@link onExecutionComplete} or {@link getExecution} for the result.
|
|
970
|
-
*
|
|
971
|
-
* Never retried: if the call fails with `AGENT_EXECUTE_OUTCOME_UNKNOWN`, a run may still have
|
|
972
|
-
* started, and app code cannot list runs to find it: tell the user the request may still be in
|
|
973
|
-
* progress instead of starting another. `AGENT_EXECUTE_NOT_SENT` means it was not sent (for
|
|
974
|
-
* example, the user is offline).
|
|
975
|
-
*
|
|
976
|
-
* @example
|
|
977
|
-
* const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks", amount: 54000 } });
|
|
978
|
-
*/
|
|
979
|
-
execute(options: AgentExecuteOptions): Promise<AgentExecutionAccepted>;
|
|
980
|
-
/**
|
|
981
|
-
* Read a run's current state, with its `Output` once `Completed` or its `Error` once `Failed`.
|
|
982
|
-
* Callers who are not the App's authors can read only their own runs.
|
|
983
|
-
*/
|
|
984
|
-
getExecution(executionId: string): Promise<AgentExecution>;
|
|
985
|
-
/**
|
|
986
|
-
* Be told once when a run finishes. `onComplete` gets the run on `Completed` or `Failed` (read
|
|
987
|
-
* `Status`: a failed run is a result, not an error). `onWatchError` gets what stopped the
|
|
988
|
-
* observation instead: an unsupported host, an access or network failure, or the observation limit
|
|
989
|
-
* (`AGENT_OBSERVATION_STOPPED`, after about six minutes; the run may still finish, so read it later
|
|
990
|
-
* with {@link getExecution}). At most one of the two is called, at most once.
|
|
991
|
-
*
|
|
992
|
-
* Neither is called if the script that registered them stops first: form, field, gallery and
|
|
993
|
-
* table scripts stop after one minute, and they and page event scripts stop when the next script
|
|
994
|
-
* starts on the same form, component or page. In those scripts, keep the `ExecutionId` and read
|
|
995
|
-
* it later with {@link getExecution}.
|
|
996
|
-
*
|
|
997
|
-
* Returns a function that stops observing. It never cancels the run.
|
|
998
|
-
*
|
|
999
|
-
* @example
|
|
1000
|
-
* const stop = agent.onExecutionComplete(ExecutionId, (run) => show(run), (err) => warn(err));
|
|
1001
|
-
* // later, e.g. on unmount
|
|
1002
|
-
* stop();
|
|
1003
|
-
*/
|
|
1004
|
-
onExecutionComplete(executionId: string, onComplete: (execution: AgentExecution) => void, onWatchError?: (error: AgentError) => void): () => void;
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
declare module "app/report" {
|
|
1008
|
-
import { BaseSDK } from "core/index";
|
|
1009
|
-
import { ReportFlowType, ReportQueryOptions, ReportCountOptions, ReportField, ReportDataResponse } from "types/external";
|
|
1010
|
-
/**
|
|
1011
|
-
* A flow report of the current app. The handle sends no request until you call one of its methods.
|
|
1012
|
-
*
|
|
1013
|
-
* @example
|
|
1014
|
-
* const report = kf.app.getReport("Process", "Leave_Request_A00", "Requests_by_status_x1Yz");
|
|
1015
|
-
* const { Data } = await report.getData();
|
|
1016
|
-
*/
|
|
1017
|
-
export class Report extends BaseSDK {
|
|
1018
|
-
private _flowType;
|
|
1019
|
-
private _flowId;
|
|
1020
|
-
private _id;
|
|
1021
|
-
constructor(flowType: ReportFlowType, flowId: string, reportId: string);
|
|
1022
|
-
/**
|
|
1023
|
-
* The report's calculated rows: groups and their values for a chart, the aggregate for a card.
|
|
1024
|
-
* @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")
|
|
1025
|
-
*/
|
|
1026
|
-
getData(options?: ReportQueryOptions): Promise<ReportDataResponse>;
|
|
1027
|
-
/** The number of rows a tabular report would return. Chart and card reports have no row count; use getData(). */
|
|
1028
|
-
getCount(options?: ReportCountOptions): Promise<number>;
|
|
1029
|
-
/** The fields of a tabular report. Empty for chart and card reports; use getData(). */
|
|
1030
|
-
getFields(): Promise<ReportField[]>;
|
|
1031
|
-
private _send;
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
947
|
declare module "form/index" {
|
|
1035
948
|
import { BaseSDK } from "core/index";
|
|
1036
949
|
export class Form extends BaseSDK {
|
|
1037
|
-
|
|
950
|
+
protected storeId: string;
|
|
1038
951
|
private flowId;
|
|
1039
952
|
type: string;
|
|
1040
953
|
instanceId: string;
|
|
@@ -1043,37 +956,49 @@ declare module "form/index" {
|
|
|
1043
956
|
toJSON(): any;
|
|
1044
957
|
getField(fieldId: string): any;
|
|
1045
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 {
|
|
1046
970
|
getValidationErrors(): any;
|
|
1047
971
|
getFormConfiguration(): any;
|
|
1048
972
|
getFieldState(): any;
|
|
1049
|
-
getTable(tableId: string): Table;
|
|
1050
973
|
}
|
|
1051
|
-
class Table extends BaseSDK {
|
|
974
|
+
class Table<F extends Form = Form> extends BaseSDK {
|
|
1052
975
|
private storeId;
|
|
1053
976
|
private flowId;
|
|
1054
977
|
private instanceId;
|
|
1055
978
|
private tableId;
|
|
1056
979
|
private activityInstanceId?;
|
|
1057
|
-
|
|
980
|
+
private parent?;
|
|
981
|
+
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, activityInstanceId?: string, parent?: F);
|
|
1058
982
|
toJSON(): any;
|
|
1059
983
|
getSelectedRows(): any;
|
|
1060
|
-
getRows(): TableForm[]
|
|
1061
|
-
getRow(rowId: string): TableForm
|
|
984
|
+
getRows(): Promise<TableForm<F>[]>;
|
|
985
|
+
getRow(rowId: string): TableForm<F>;
|
|
1062
986
|
addRow(rowObject: object): any;
|
|
1063
987
|
addRows(rows: object[]): any;
|
|
1064
988
|
deleteRow(rowId: string): any;
|
|
1065
989
|
deleteRows(rows: string[]): any;
|
|
1066
990
|
}
|
|
1067
|
-
export class TableForm extends BaseSDK {
|
|
991
|
+
export class TableForm<F extends Form = Form> extends BaseSDK {
|
|
1068
992
|
private storeId;
|
|
1069
993
|
private flowId;
|
|
1070
994
|
private instanceId;
|
|
1071
995
|
private tableId;
|
|
1072
996
|
private rowId;
|
|
1073
997
|
private activityInstanceId?;
|
|
998
|
+
private parent?;
|
|
1074
999
|
type: string;
|
|
1075
|
-
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, rowId: string, activityInstanceId?: string);
|
|
1076
|
-
getParent():
|
|
1000
|
+
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, rowId: string, activityInstanceId?: string, parent?: F);
|
|
1001
|
+
getParent(): F;
|
|
1077
1002
|
toJSON(): any;
|
|
1078
1003
|
getField(fieldId: string): any;
|
|
1079
1004
|
updateField(args: object): any;
|
|
@@ -1081,10 +1006,10 @@ declare module "form/index" {
|
|
|
1081
1006
|
}
|
|
1082
1007
|
declare module "dataform/index" {
|
|
1083
1008
|
import { BaseSDK } from "core/index";
|
|
1084
|
-
import {
|
|
1009
|
+
import { CustomComponentForm } from "form/index";
|
|
1085
1010
|
import { DataformItem, DataformQueryOptions, DataformQueryResponse, DataformCreateItemOptions, DataformUpdateItemOptions, DataformGetItemOptions, DataformDeleteItemOptions, DataformDiscardItemOptions, DataformSubmitItemOptions, DataformFieldOptions } from "types/external";
|
|
1086
1011
|
export class Dataform extends BaseSDK {
|
|
1087
|
-
|
|
1012
|
+
protected _id: string;
|
|
1088
1013
|
constructor(flowId: string);
|
|
1089
1014
|
/**
|
|
1090
1015
|
* Get all items from this dataform with optional filtering, sorting, and pagination
|
|
@@ -1151,6 +1076,15 @@ declare module "dataform/index" {
|
|
|
1151
1076
|
getFields(options?: {
|
|
1152
1077
|
viewId?: string;
|
|
1153
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 {
|
|
1154
1088
|
/**
|
|
1155
1089
|
* Initialize a form with all necessary data (schema, item data, form store)
|
|
1156
1090
|
* This is the recommended way to create a custom form for dataform records
|
|
@@ -1173,16 +1107,15 @@ declare module "dataform/index" {
|
|
|
1173
1107
|
* const form = await dataform.initForm();
|
|
1174
1108
|
* await form.updateField({ firstName: "John" });
|
|
1175
1109
|
*/
|
|
1176
|
-
initForm(instanceId?: string, viewId?: string): Promise<
|
|
1177
|
-
getFieldOptions(options?: DataformFieldOptions): Promise<DataformQueryResponse>;
|
|
1110
|
+
initForm(instanceId?: string, viewId?: string): Promise<CustomComponentForm>;
|
|
1178
1111
|
}
|
|
1179
1112
|
}
|
|
1180
1113
|
declare module "board/index" {
|
|
1181
1114
|
import { BaseSDK } from "core/index";
|
|
1182
|
-
import {
|
|
1115
|
+
import { CustomComponentForm } from "form/index";
|
|
1183
1116
|
import { BoardItem, BoardGetItemOptions, BoardGetItemsOptions, BoardQueryResponse, BoardCreateItemOptions, BoardUpdateItemOptions, BoardDeleteItemOptions, BoardSubmitItemOptions, BoardDiscardItemOptions, BoardFieldOptions } from "types/external";
|
|
1184
1117
|
export class Board extends BaseSDK {
|
|
1185
|
-
|
|
1118
|
+
protected _id: string;
|
|
1186
1119
|
constructor(flowId: string);
|
|
1187
1120
|
/**
|
|
1188
1121
|
* Import data from CSV file
|
|
@@ -1206,7 +1139,7 @@ declare module "board/index" {
|
|
|
1206
1139
|
getItems(options?: BoardGetItemsOptions): Promise<BoardQueryResponse>;
|
|
1207
1140
|
/**
|
|
1208
1141
|
* Get a single board/case item by instance ID
|
|
1209
|
-
* @param options - instanceId (required)
|
|
1142
|
+
* @param options - instanceId (required), optional viewId
|
|
1210
1143
|
* @returns Promise containing the item data
|
|
1211
1144
|
*/
|
|
1212
1145
|
getItem(options: BoardGetItemOptions): Promise<BoardItem>;
|
|
@@ -1217,7 +1150,7 @@ declare module "board/index" {
|
|
|
1217
1150
|
*
|
|
1218
1151
|
* @example
|
|
1219
1152
|
* const board = kf.app.getBoard("Inventory");
|
|
1220
|
-
* const item = await board.createItem({ data: {
|
|
1153
|
+
* const item = await board.createItem({ data: { itemType: "New Item" } });
|
|
1221
1154
|
*/
|
|
1222
1155
|
createItem(options?: BoardCreateItemOptions): Promise<BoardItem>;
|
|
1223
1156
|
/**
|
|
@@ -1229,7 +1162,7 @@ declare module "board/index" {
|
|
|
1229
1162
|
* const board = kf.app.getBoard("Inventory");
|
|
1230
1163
|
* await board.updateItem({
|
|
1231
1164
|
* instanceId: "item_123",
|
|
1232
|
-
* data: {
|
|
1165
|
+
* data: { itemType: "Updated Item" }
|
|
1233
1166
|
* });
|
|
1234
1167
|
*/
|
|
1235
1168
|
updateItem(options: BoardUpdateItemOptions): Promise<BoardItem>;
|
|
@@ -1260,6 +1193,27 @@ declare module "board/index" {
|
|
|
1260
1193
|
getFields(options?: {
|
|
1261
1194
|
viewId?: string;
|
|
1262
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 {
|
|
1263
1217
|
/**
|
|
1264
1218
|
* Initialize a form for a board item with all necessary setup
|
|
1265
1219
|
* Fetches schema, item data, creates and initializes the form store
|
|
@@ -1272,7 +1226,7 @@ declare module "board/index" {
|
|
|
1272
1226
|
* // Create new board item
|
|
1273
1227
|
* const board = kf.app.getBoard("Inventory");
|
|
1274
1228
|
* const form = await board.initForm();
|
|
1275
|
-
* await form.updateField({
|
|
1229
|
+
* await form.updateField({ itemType: "New Item" });
|
|
1276
1230
|
*
|
|
1277
1231
|
* // Edit existing board item
|
|
1278
1232
|
* const form = await board.initForm("item_123");
|
|
@@ -1281,28 +1235,15 @@ declare module "board/index" {
|
|
|
1281
1235
|
* // Edit existing board item scoped to a view
|
|
1282
1236
|
* const form = await board.initForm("item_123", "Inventory_View");
|
|
1283
1237
|
*/
|
|
1284
|
-
initForm(instanceId?: string, viewId?: string): Promise<
|
|
1285
|
-
/**
|
|
1286
|
-
* Get field options for dropdown/lookup fields
|
|
1287
|
-
* @param options - Field options (instanceId, fieldId)
|
|
1288
|
-
* @returns Promise containing the field options
|
|
1289
|
-
*
|
|
1290
|
-
* @example
|
|
1291
|
-
* const board = kf.app.getBoard("Inventory");
|
|
1292
|
-
* const options = await board.getFieldOptions({
|
|
1293
|
-
* instanceId: "item_123",
|
|
1294
|
-
* fieldId: "Category"
|
|
1295
|
-
* });
|
|
1296
|
-
*/
|
|
1297
|
-
getFieldOptions(options: BoardFieldOptions): Promise<any>;
|
|
1238
|
+
initForm(instanceId?: string, viewId?: string): Promise<CustomComponentForm>;
|
|
1298
1239
|
}
|
|
1299
1240
|
}
|
|
1300
1241
|
declare module "process/index" {
|
|
1301
1242
|
import { BaseSDK } from "core/index";
|
|
1302
|
-
import {
|
|
1243
|
+
import { CustomComponentForm } from "form/index";
|
|
1303
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";
|
|
1304
1245
|
export class Process extends BaseSDK {
|
|
1305
|
-
|
|
1246
|
+
protected _id: string;
|
|
1306
1247
|
constructor(flowId: string);
|
|
1307
1248
|
/**
|
|
1308
1249
|
* Get my items from this process (items I initiated)
|
|
@@ -1508,26 +1449,7 @@ declare module "process/index" {
|
|
|
1508
1449
|
getProgress(options: {
|
|
1509
1450
|
instanceId: string;
|
|
1510
1451
|
}): Promise<any>;
|
|
1511
|
-
|
|
1512
|
-
* Initialize a form with all necessary data (schema, item data, form store)
|
|
1513
|
-
* This is the recommended way to create a custom form for dataform records
|
|
1514
|
-
* It automatically handles fetching schema, item data, and initializing the form store
|
|
1515
|
-
*
|
|
1516
|
-
* @param instanceId - Optional instance ID of the dataform record. If omitted, creates a new record
|
|
1517
|
-
* @returns Promise with Form instance ready to use
|
|
1518
|
-
*
|
|
1519
|
-
* @example
|
|
1520
|
-
* // Load existing record
|
|
1521
|
-
* const dataform = kf.app.getDataform("EmpMaster");
|
|
1522
|
-
* const form = await dataform.initForm("emp_123");
|
|
1523
|
-
* const data = await form.toJSON();
|
|
1524
|
-
*
|
|
1525
|
-
* // Create new record
|
|
1526
|
-
* const form = await dataform.initForm();
|
|
1527
|
-
* await form.updateField({ firstName: "John" });
|
|
1528
|
-
*/
|
|
1529
|
-
initForm(instanceId?: string, activityInstanceId?: string): Promise<Form>;
|
|
1530
|
-
getFieldOptions(options?: ProcessFieldOptions): Promise<ProcessQueryResponse>;
|
|
1452
|
+
getFieldOptions(options: ProcessFieldOptions): Promise<ProcessQueryResponse>;
|
|
1531
1453
|
/**
|
|
1532
1454
|
* Trigger AI document parsing on an uploaded file for a Smart Attachment field.
|
|
1533
1455
|
* Matches native platform behavior: matching empty fields are auto-filled directly
|
|
@@ -1543,6 +1465,121 @@ declare module "process/index" {
|
|
|
1543
1465
|
*/
|
|
1544
1466
|
parseAttachment(options: ProcessParseAttachmentOptions): Promise<ProcessAttachmentParseResult>;
|
|
1545
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
|
+
}
|
|
1546
1583
|
}
|
|
1547
1584
|
declare module "app/index" {
|
|
1548
1585
|
import { BaseSDK } from "core/index";
|
|
@@ -1550,11 +1587,11 @@ declare module "app/index" {
|
|
|
1550
1587
|
import { AppContext } from "types/internal";
|
|
1551
1588
|
import { rolesObject, ReportFlowType, RunEnvelope, RunWatchError } from "types/external";
|
|
1552
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";
|
|
1553
1593
|
import { Agent } from "app/agent";
|
|
1554
1594
|
import { Report } from "app/report";
|
|
1555
|
-
import { Dataform } from "dataform/index";
|
|
1556
|
-
import { Board } from "board/index";
|
|
1557
|
-
import { Process } from "process/index";
|
|
1558
1595
|
export class Application extends BaseSDK {
|
|
1559
1596
|
page: Page;
|
|
1560
1597
|
_id: string;
|
|
@@ -1675,6 +1712,18 @@ declare module "app/index" {
|
|
|
1675
1712
|
roleName?: string;
|
|
1676
1713
|
}): Promise<rolesObject>;
|
|
1677
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
|
+
}
|
|
1678
1727
|
export * from "app/component";
|
|
1679
1728
|
export { Agent };
|
|
1680
1729
|
export { Report };
|
|
@@ -1683,11 +1732,11 @@ declare module "app/index" {
|
|
|
1683
1732
|
}
|
|
1684
1733
|
declare module "index" {
|
|
1685
1734
|
import { BaseSDK } from "core/index";
|
|
1686
|
-
import {
|
|
1735
|
+
import { CustomComponentApplication, Page, CustomComponent } from "app/index";
|
|
1687
1736
|
import { Client, Formatter } from "utils/index";
|
|
1688
1737
|
import { userObject, accountObject, environmentObject } from "types/external";
|
|
1689
1738
|
class CustomComponentSDK extends BaseSDK {
|
|
1690
|
-
app:
|
|
1739
|
+
app: CustomComponentApplication;
|
|
1691
1740
|
page: Page;
|
|
1692
1741
|
user: userObject;
|
|
1693
1742
|
account: accountObject;
|