@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/lowcode.d.ts
CHANGED
|
@@ -172,7 +172,7 @@ declare module "core/index" {
|
|
|
172
172
|
declare module "form/index" {
|
|
173
173
|
import { BaseSDK } from "core/index";
|
|
174
174
|
export class Form extends BaseSDK {
|
|
175
|
-
|
|
175
|
+
protected storeId: string;
|
|
176
176
|
private flowId;
|
|
177
177
|
type: string;
|
|
178
178
|
instanceId: string;
|
|
@@ -181,37 +181,49 @@ declare module "form/index" {
|
|
|
181
181
|
toJSON(): any;
|
|
182
182
|
getField(fieldId: string): any;
|
|
183
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 {
|
|
184
195
|
getValidationErrors(): any;
|
|
185
196
|
getFormConfiguration(): any;
|
|
186
197
|
getFieldState(): any;
|
|
187
|
-
getTable(tableId: string): Table;
|
|
188
198
|
}
|
|
189
|
-
class Table extends BaseSDK {
|
|
199
|
+
class Table<F extends Form = Form> extends BaseSDK {
|
|
190
200
|
private storeId;
|
|
191
201
|
private flowId;
|
|
192
202
|
private instanceId;
|
|
193
203
|
private tableId;
|
|
194
204
|
private activityInstanceId?;
|
|
195
|
-
|
|
205
|
+
private parent?;
|
|
206
|
+
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, activityInstanceId?: string, parent?: F);
|
|
196
207
|
toJSON(): any;
|
|
197
208
|
getSelectedRows(): any;
|
|
198
|
-
getRows(): TableForm[]
|
|
199
|
-
getRow(rowId: string): TableForm
|
|
209
|
+
getRows(): Promise<TableForm<F>[]>;
|
|
210
|
+
getRow(rowId: string): TableForm<F>;
|
|
200
211
|
addRow(rowObject: object): any;
|
|
201
212
|
addRows(rows: object[]): any;
|
|
202
213
|
deleteRow(rowId: string): any;
|
|
203
214
|
deleteRows(rows: string[]): any;
|
|
204
215
|
}
|
|
205
|
-
export class TableForm extends BaseSDK {
|
|
216
|
+
export class TableForm<F extends Form = Form> extends BaseSDK {
|
|
206
217
|
private storeId;
|
|
207
218
|
private flowId;
|
|
208
219
|
private instanceId;
|
|
209
220
|
private tableId;
|
|
210
221
|
private rowId;
|
|
211
222
|
private activityInstanceId?;
|
|
223
|
+
private parent?;
|
|
212
224
|
type: string;
|
|
213
|
-
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, rowId: string, activityInstanceId?: string);
|
|
214
|
-
getParent():
|
|
225
|
+
constructor(storeId: string, flowId: string, instanceId: string, tableId: string, rowId: string, activityInstanceId?: string, parent?: F);
|
|
226
|
+
getParent(): F;
|
|
215
227
|
toJSON(): any;
|
|
216
228
|
getField(fieldId: string): any;
|
|
217
229
|
updateField(args: object): any;
|
|
@@ -235,13 +247,13 @@ declare module "types/external" {
|
|
|
235
247
|
};
|
|
236
248
|
export type PayloadOptions = {
|
|
237
249
|
Columns?: any[];
|
|
238
|
-
|
|
250
|
+
Filter?: any;
|
|
239
251
|
Sort?: PayloadSortItem[];
|
|
240
252
|
FilterParam?: any;
|
|
241
253
|
};
|
|
242
254
|
export type ProcessPayloadOptions = {
|
|
243
255
|
Columns?: any[];
|
|
244
|
-
|
|
256
|
+
Filter?: any;
|
|
245
257
|
Sort?: PayloadSortItem[];
|
|
246
258
|
};
|
|
247
259
|
export type userObject = {
|
|
@@ -365,7 +377,7 @@ declare module "types/external" {
|
|
|
365
377
|
export type ProcessDiscardItemOptions = {
|
|
366
378
|
instanceId: string;
|
|
367
379
|
};
|
|
368
|
-
export type ProcessFieldOptions = {
|
|
380
|
+
export type ProcessFieldOptions = BaseQueryOptions & {
|
|
369
381
|
instanceId: string;
|
|
370
382
|
activityInstanceId: string;
|
|
371
383
|
fieldId: string;
|
|
@@ -454,7 +466,7 @@ declare module "types/external" {
|
|
|
454
466
|
data?: object;
|
|
455
467
|
viewId?: string;
|
|
456
468
|
};
|
|
457
|
-
export type DataformFieldOptions = {
|
|
469
|
+
export type DataformFieldOptions = BaseQueryOptions & {
|
|
458
470
|
instanceId: string;
|
|
459
471
|
fieldId: string;
|
|
460
472
|
/** Skip the server-side model lookup by supplying the field's type directly. */
|
|
@@ -469,6 +481,7 @@ declare module "types/external" {
|
|
|
469
481
|
export type BoardQueryResponse = QueryResponse;
|
|
470
482
|
export type BoardGetItemOptions = {
|
|
471
483
|
instanceId: string;
|
|
484
|
+
viewId?: string;
|
|
472
485
|
};
|
|
473
486
|
export type BoardCreateItemOptions = {
|
|
474
487
|
data?: object;
|
|
@@ -487,7 +500,7 @@ declare module "types/external" {
|
|
|
487
500
|
export type BoardDiscardItemOptions = {
|
|
488
501
|
instanceId: string;
|
|
489
502
|
};
|
|
490
|
-
export type BoardFieldOptions = {
|
|
503
|
+
export type BoardFieldOptions = BaseQueryOptions & {
|
|
491
504
|
instanceId: string;
|
|
492
505
|
fieldId: string;
|
|
493
506
|
/** Skip the server-side model lookup by supplying the field's type directly. */
|
|
@@ -991,100 +1004,12 @@ declare module "app/decisiontable" {
|
|
|
991
1004
|
evaluate(payload?: object): any;
|
|
992
1005
|
}
|
|
993
1006
|
}
|
|
994
|
-
declare module "app/agent" {
|
|
995
|
-
import { BaseSDK } from "core/index";
|
|
996
|
-
import { AgentContract, AgentError, AgentExecuteOptions, AgentExecution, AgentExecutionAccepted } from "types/external";
|
|
997
|
-
/**
|
|
998
|
-
* A published Custom Agent of the current app.
|
|
999
|
-
*
|
|
1000
|
-
* Get one with `kf.app.getAgent(agentId)`. Calls run as the signed-in user, against the Agent's
|
|
1001
|
-
* published (Live) definition.
|
|
1002
|
-
*/
|
|
1003
|
-
export class Agent extends BaseSDK {
|
|
1004
|
-
private agentId;
|
|
1005
|
-
private _id;
|
|
1006
|
-
private activeWatches;
|
|
1007
|
-
constructor(agentId: string);
|
|
1008
|
-
/**
|
|
1009
|
-
* Read the Agent's published contract: its inputs, outputs and readiness.
|
|
1010
|
-
*
|
|
1011
|
-
* @example
|
|
1012
|
-
* const { Definition } = await kf.app.getAgent("AgXXXXXXXXXX").getContract();
|
|
1013
|
-
*/
|
|
1014
|
-
getContract(): Promise<AgentContract>;
|
|
1015
|
-
/**
|
|
1016
|
-
* Start a run. Resolves once the run is accepted (`ExecutionId`, `Status`), not when it finishes;
|
|
1017
|
-
* use {@link onExecutionComplete} or {@link getExecution} for the result.
|
|
1018
|
-
*
|
|
1019
|
-
* Never retried: if the call fails with `AGENT_EXECUTE_OUTCOME_UNKNOWN`, a run may still have
|
|
1020
|
-
* started, and app code cannot list runs to find it: tell the user the request may still be in
|
|
1021
|
-
* progress instead of starting another. `AGENT_EXECUTE_NOT_SENT` means it was not sent (for
|
|
1022
|
-
* example, the user is offline).
|
|
1023
|
-
*
|
|
1024
|
-
* @example
|
|
1025
|
-
* const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks", amount: 54000 } });
|
|
1026
|
-
*/
|
|
1027
|
-
execute(options: AgentExecuteOptions): Promise<AgentExecutionAccepted>;
|
|
1028
|
-
/**
|
|
1029
|
-
* Read a run's current state, with its `Output` once `Completed` or its `Error` once `Failed`.
|
|
1030
|
-
* Callers who are not the App's authors can read only their own runs.
|
|
1031
|
-
*/
|
|
1032
|
-
getExecution(executionId: string): Promise<AgentExecution>;
|
|
1033
|
-
/**
|
|
1034
|
-
* Be told once when a run finishes. `onComplete` gets the run on `Completed` or `Failed` (read
|
|
1035
|
-
* `Status`: a failed run is a result, not an error). `onWatchError` gets what stopped the
|
|
1036
|
-
* observation instead: an unsupported host, an access or network failure, or the observation limit
|
|
1037
|
-
* (`AGENT_OBSERVATION_STOPPED`, after about six minutes; the run may still finish, so read it later
|
|
1038
|
-
* with {@link getExecution}). At most one of the two is called, at most once.
|
|
1039
|
-
*
|
|
1040
|
-
* Neither is called if the script that registered them stops first: form, field, gallery and
|
|
1041
|
-
* table scripts stop after one minute, and they and page event scripts stop when the next script
|
|
1042
|
-
* starts on the same form, component or page. In those scripts, keep the `ExecutionId` and read
|
|
1043
|
-
* it later with {@link getExecution}.
|
|
1044
|
-
*
|
|
1045
|
-
* Returns a function that stops observing. It never cancels the run.
|
|
1046
|
-
*
|
|
1047
|
-
* @example
|
|
1048
|
-
* const stop = agent.onExecutionComplete(ExecutionId, (run) => show(run), (err) => warn(err));
|
|
1049
|
-
* // later, e.g. on unmount
|
|
1050
|
-
* stop();
|
|
1051
|
-
*/
|
|
1052
|
-
onExecutionComplete(executionId: string, onComplete: (execution: AgentExecution) => void, onWatchError?: (error: AgentError) => void): () => void;
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
declare module "app/report" {
|
|
1056
|
-
import { BaseSDK } from "core/index";
|
|
1057
|
-
import { ReportFlowType, ReportQueryOptions, ReportCountOptions, ReportField, ReportDataResponse } from "types/external";
|
|
1058
|
-
/**
|
|
1059
|
-
* A flow report of the current app. The handle sends no request until you call one of its methods.
|
|
1060
|
-
*
|
|
1061
|
-
* @example
|
|
1062
|
-
* const report = kf.app.getReport("Process", "Leave_Request_A00", "Requests_by_status_x1Yz");
|
|
1063
|
-
* const { Data } = await report.getData();
|
|
1064
|
-
*/
|
|
1065
|
-
export class Report extends BaseSDK {
|
|
1066
|
-
private _flowType;
|
|
1067
|
-
private _flowId;
|
|
1068
|
-
private _id;
|
|
1069
|
-
constructor(flowType: ReportFlowType, flowId: string, reportId: string);
|
|
1070
|
-
/**
|
|
1071
|
-
* The report's calculated rows: groups and their values for a chart, the aggregate for a card.
|
|
1072
|
-
* @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")
|
|
1073
|
-
*/
|
|
1074
|
-
getData(options?: ReportQueryOptions): Promise<ReportDataResponse>;
|
|
1075
|
-
/** The number of rows a tabular report would return. Chart and card reports have no row count; use getData(). */
|
|
1076
|
-
getCount(options?: ReportCountOptions): Promise<number>;
|
|
1077
|
-
/** The fields of a tabular report. Empty for chart and card reports; use getData(). */
|
|
1078
|
-
getFields(): Promise<ReportField[]>;
|
|
1079
|
-
private _send;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
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 };
|