@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.types.d.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
|
|
2
2
|
declare class Form {
|
|
3
|
+
storeId: string
|
|
3
4
|
type: string
|
|
4
5
|
instanceId: string
|
|
5
6
|
activityInstanceId: string
|
|
6
7
|
toJSON(): any;
|
|
7
8
|
getField(fieldId: string): any;
|
|
8
9
|
updateField(args: object): any;
|
|
9
|
-
getValidationErrors(): any;
|
|
10
|
-
getFormConfiguration(): any;
|
|
11
|
-
getFieldState(): any;
|
|
12
10
|
getTable(tableId: string): Table;
|
|
13
11
|
}
|
|
14
12
|
declare class Table {
|
|
15
13
|
toJSON(): any;
|
|
16
14
|
getSelectedRows(): any;
|
|
17
|
-
getRows(): TableForm[]
|
|
15
|
+
getRows(): Promise<TableForm[]>;
|
|
18
16
|
getRow(rowId: string): TableForm;
|
|
19
17
|
addRow(rowObject: object): any;
|
|
20
18
|
addRows(rows: object[]): any;
|
|
@@ -255,54 +253,8 @@ declare class Page {
|
|
|
255
253
|
declare class DecisionTable {
|
|
256
254
|
evaluate(payload?: object): any;
|
|
257
255
|
}
|
|
258
|
-
declare class Agent {
|
|
259
|
-
/**
|
|
260
|
-
* Read the Agent's published contract: its inputs, outputs and readiness.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* const { Definition } = await kf.app.getAgent("AgXXXXXXXXXX").getContract();
|
|
264
|
-
*/
|
|
265
|
-
getContract(): Promise<AgentContract>;
|
|
266
|
-
/**
|
|
267
|
-
* Start a run. Resolves once the run is accepted (`ExecutionId`, `Status`), not when it finishes;
|
|
268
|
-
* use {@link onExecutionComplete} or {@link getExecution} for the result.
|
|
269
|
-
*
|
|
270
|
-
* Never retried: if the call fails with `AGENT_EXECUTE_OUTCOME_UNKNOWN`, a run may still have
|
|
271
|
-
* started, and app code cannot list runs to find it: tell the user the request may still be in
|
|
272
|
-
* progress instead of starting another. `AGENT_EXECUTE_NOT_SENT` means it was not sent (for
|
|
273
|
-
* example, the user is offline).
|
|
274
|
-
*
|
|
275
|
-
* @example
|
|
276
|
-
* const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks", amount: 54000 } });
|
|
277
|
-
*/
|
|
278
|
-
execute(options: AgentExecuteOptions): Promise<AgentExecutionAccepted>;
|
|
279
|
-
/**
|
|
280
|
-
* Read a run's current state, with its `Output` once `Completed` or its `Error` once `Failed`.
|
|
281
|
-
* Callers who are not the App's authors can read only their own runs.
|
|
282
|
-
*/
|
|
283
|
-
getExecution(executionId: string): Promise<AgentExecution>;
|
|
284
|
-
/**
|
|
285
|
-
* Be told once when a run finishes. `onComplete` gets the run on `Completed` or `Failed` (read
|
|
286
|
-
* `Status`: a failed run is a result, not an error). `onWatchError` gets what stopped the
|
|
287
|
-
* observation instead: an unsupported host, an access or network failure, or the observation limit
|
|
288
|
-
* (`AGENT_OBSERVATION_STOPPED`, after about six minutes; the run may still finish, so read it later
|
|
289
|
-
* with {@link getExecution}). At most one of the two is called, at most once.
|
|
290
|
-
*
|
|
291
|
-
* Neither is called if the script that registered them stops first: form, field, gallery and
|
|
292
|
-
* table scripts stop after one minute, and they and page event scripts stop when the next script
|
|
293
|
-
* starts on the same form, component or page. In those scripts, keep the `ExecutionId` and read
|
|
294
|
-
* it later with {@link getExecution}.
|
|
295
|
-
*
|
|
296
|
-
* Returns a function that stops observing. It never cancels the run.
|
|
297
|
-
*
|
|
298
|
-
* @example
|
|
299
|
-
* const stop = agent.onExecutionComplete(ExecutionId, (run) => show(run), (err) => warn(err));
|
|
300
|
-
* // later, e.g. on unmount
|
|
301
|
-
* stop();
|
|
302
|
-
*/
|
|
303
|
-
onExecutionComplete(executionId: string, onComplete: (execution: AgentExecution) => void, onWatchError?: (error: AgentError) => void): () => void;
|
|
304
|
-
}
|
|
305
256
|
declare class Dataform {
|
|
257
|
+
_id: string
|
|
306
258
|
/**
|
|
307
259
|
* Get all items from this dataform with optional filtering, sorting, and pagination
|
|
308
260
|
* @param options - Query options (searchValue, pageNumber, pageSize, payload)
|
|
@@ -368,32 +320,10 @@ declare class Dataform {
|
|
|
368
320
|
getFields(options?: {
|
|
369
321
|
viewId?: string;
|
|
370
322
|
}): Promise<any>;
|
|
371
|
-
|
|
372
|
-
* Initialize a form with all necessary data (schema, item data, form store)
|
|
373
|
-
* This is the recommended way to create a custom form for dataform records
|
|
374
|
-
* It automatically handles fetching schema, item data, and initializing the form store
|
|
375
|
-
*
|
|
376
|
-
* @param instanceId - Optional instance ID of the dataform record. If omitted, creates a new record
|
|
377
|
-
* @param viewId - Optional view ID to scope the form's schema/permissions to a specific view
|
|
378
|
-
* @returns Promise with Form instance ready to use
|
|
379
|
-
*
|
|
380
|
-
* @example
|
|
381
|
-
* // Load existing record
|
|
382
|
-
* const dataform = kf.app.getDataform("EmpMaster");
|
|
383
|
-
* const form = await dataform.initForm("emp_123");
|
|
384
|
-
* const data = await form.toJSON();
|
|
385
|
-
*
|
|
386
|
-
* // Load existing record scoped to a view
|
|
387
|
-
* const form = await dataform.initForm("emp_123", "EmpMaster_View");
|
|
388
|
-
*
|
|
389
|
-
* // Create new record
|
|
390
|
-
* const form = await dataform.initForm();
|
|
391
|
-
* await form.updateField({ firstName: "John" });
|
|
392
|
-
*/
|
|
393
|
-
initForm(instanceId?: string, viewId?: string): Promise<Form>;
|
|
394
|
-
getFieldOptions(options?: DataformFieldOptions): Promise<DataformQueryResponse>;
|
|
323
|
+
getFieldOptions(options: DataformFieldOptions): Promise<DataformQueryResponse>;
|
|
395
324
|
}
|
|
396
325
|
declare class Board {
|
|
326
|
+
_id: string
|
|
397
327
|
/**
|
|
398
328
|
* Import data from CSV file
|
|
399
329
|
* @param defaultValues - Optional default values to apply to imported items
|
|
@@ -416,7 +346,7 @@ declare class Board {
|
|
|
416
346
|
getItems(options?: BoardGetItemsOptions): Promise<BoardQueryResponse>;
|
|
417
347
|
/**
|
|
418
348
|
* Get a single board/case item by instance ID
|
|
419
|
-
* @param options - instanceId (required)
|
|
349
|
+
* @param options - instanceId (required), optional viewId
|
|
420
350
|
* @returns Promise containing the item data
|
|
421
351
|
*/
|
|
422
352
|
getItem(options: BoardGetItemOptions): Promise<BoardItem>;
|
|
@@ -427,7 +357,7 @@ declare class Board {
|
|
|
427
357
|
*
|
|
428
358
|
* @example
|
|
429
359
|
* const board = kf.app.getBoard("Inventory");
|
|
430
|
-
* const item = await board.createItem({ data: {
|
|
360
|
+
* const item = await board.createItem({ data: { itemType: "New Item" } });
|
|
431
361
|
*/
|
|
432
362
|
createItem(options?: BoardCreateItemOptions): Promise<BoardItem>;
|
|
433
363
|
/**
|
|
@@ -439,7 +369,7 @@ declare class Board {
|
|
|
439
369
|
* const board = kf.app.getBoard("Inventory");
|
|
440
370
|
* await board.updateItem({
|
|
441
371
|
* instanceId: "item_123",
|
|
442
|
-
* data: {
|
|
372
|
+
* data: { itemType: "Updated Item" }
|
|
443
373
|
* });
|
|
444
374
|
*/
|
|
445
375
|
updateItem(options: BoardUpdateItemOptions): Promise<BoardItem>;
|
|
@@ -470,28 +400,6 @@ declare class Board {
|
|
|
470
400
|
getFields(options?: {
|
|
471
401
|
viewId?: string;
|
|
472
402
|
}): Promise<any>;
|
|
473
|
-
/**
|
|
474
|
-
* Initialize a form for a board item with all necessary setup
|
|
475
|
-
* Fetches schema, item data, creates and initializes the form store
|
|
476
|
-
*
|
|
477
|
-
* @param instanceId - Optional instance ID. If omitted, creates a new board item
|
|
478
|
-
* @param viewId - Optional view ID to scope the form's schema/permissions to a specific view
|
|
479
|
-
* @returns Promise with Form instance ready to use
|
|
480
|
-
*
|
|
481
|
-
* @example
|
|
482
|
-
* // Create new board item
|
|
483
|
-
* const board = kf.app.getBoard("Inventory");
|
|
484
|
-
* const form = await board.initForm();
|
|
485
|
-
* await form.updateField({ Name: "New Item" });
|
|
486
|
-
*
|
|
487
|
-
* // Edit existing board item
|
|
488
|
-
* const form = await board.initForm("item_123");
|
|
489
|
-
* const data = await form.toJSON();
|
|
490
|
-
*
|
|
491
|
-
* // Edit existing board item scoped to a view
|
|
492
|
-
* const form = await board.initForm("item_123", "Inventory_View");
|
|
493
|
-
*/
|
|
494
|
-
initForm(instanceId?: string, viewId?: string): Promise<Form>;
|
|
495
403
|
/**
|
|
496
404
|
* Get field options for dropdown/lookup fields
|
|
497
405
|
* @param options - Field options (instanceId, fieldId)
|
|
@@ -507,6 +415,7 @@ declare class Board {
|
|
|
507
415
|
getFieldOptions(options: BoardFieldOptions): Promise<any>;
|
|
508
416
|
}
|
|
509
417
|
declare class Process {
|
|
418
|
+
_id: string
|
|
510
419
|
/**
|
|
511
420
|
* Get my items from this process (items I initiated)
|
|
512
421
|
* @param options - Query options (status, searchValue, pageNumber, pageSize, payload)
|
|
@@ -711,26 +620,7 @@ declare class Process {
|
|
|
711
620
|
getProgress(options: {
|
|
712
621
|
instanceId: string;
|
|
713
622
|
}): Promise<any>;
|
|
714
|
-
|
|
715
|
-
* Initialize a form with all necessary data (schema, item data, form store)
|
|
716
|
-
* This is the recommended way to create a custom form for dataform records
|
|
717
|
-
* It automatically handles fetching schema, item data, and initializing the form store
|
|
718
|
-
*
|
|
719
|
-
* @param instanceId - Optional instance ID of the dataform record. If omitted, creates a new record
|
|
720
|
-
* @returns Promise with Form instance ready to use
|
|
721
|
-
*
|
|
722
|
-
* @example
|
|
723
|
-
* // Load existing record
|
|
724
|
-
* const dataform = kf.app.getDataform("EmpMaster");
|
|
725
|
-
* const form = await dataform.initForm("emp_123");
|
|
726
|
-
* const data = await form.toJSON();
|
|
727
|
-
*
|
|
728
|
-
* // Create new record
|
|
729
|
-
* const form = await dataform.initForm();
|
|
730
|
-
* await form.updateField({ firstName: "John" });
|
|
731
|
-
*/
|
|
732
|
-
initForm(instanceId?: string, activityInstanceId?: string): Promise<Form>;
|
|
733
|
-
getFieldOptions(options?: ProcessFieldOptions): Promise<ProcessQueryResponse>;
|
|
623
|
+
getFieldOptions(options: ProcessFieldOptions): Promise<ProcessQueryResponse>;
|
|
734
624
|
/**
|
|
735
625
|
* Trigger AI document parsing on an uploaded file for a Smart Attachment field.
|
|
736
626
|
* Matches native platform behavior: matching empty fields are auto-filled directly
|
|
@@ -746,6 +636,64 @@ declare class Process {
|
|
|
746
636
|
*/
|
|
747
637
|
parseAttachment(options: ProcessParseAttachmentOptions): Promise<ProcessAttachmentParseResult>;
|
|
748
638
|
}
|
|
639
|
+
declare class Agent {
|
|
640
|
+
/**
|
|
641
|
+
* Read the Agent's published contract: its inputs, outputs and readiness.
|
|
642
|
+
*
|
|
643
|
+
* @example
|
|
644
|
+
* const { Definition } = await kf.app.getAgent("AgXXXXXXXXXX").getContract();
|
|
645
|
+
*/
|
|
646
|
+
getContract(): Promise<AgentContract>;
|
|
647
|
+
/**
|
|
648
|
+
* Start a run. Resolves once the run is accepted (`ExecutionId`, `Status`), not when it finishes;
|
|
649
|
+
* use {@link onExecutionComplete} or {@link getExecution} for the result.
|
|
650
|
+
*
|
|
651
|
+
* Never retried: if the call fails with `AGENT_EXECUTE_OUTCOME_UNKNOWN`, a run may still have
|
|
652
|
+
* started, and app code cannot list runs to find it: tell the user the request may still be in
|
|
653
|
+
* progress instead of starting another. `AGENT_EXECUTE_NOT_SENT` means it was not sent (for
|
|
654
|
+
* example, the user is offline).
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks", amount: 54000 } });
|
|
658
|
+
*/
|
|
659
|
+
execute(options: AgentExecuteOptions): Promise<AgentExecutionAccepted>;
|
|
660
|
+
/**
|
|
661
|
+
* Read a run's current state, with its `Output` once `Completed` or its `Error` once `Failed`.
|
|
662
|
+
* Callers who are not the App's authors can read only their own runs.
|
|
663
|
+
*/
|
|
664
|
+
getExecution(executionId: string): Promise<AgentExecution>;
|
|
665
|
+
/**
|
|
666
|
+
* Be told once when a run finishes. `onComplete` gets the run on `Completed` or `Failed` (read
|
|
667
|
+
* `Status`: a failed run is a result, not an error). `onWatchError` gets what stopped the
|
|
668
|
+
* observation instead: an unsupported host, an access or network failure, or the observation limit
|
|
669
|
+
* (`AGENT_OBSERVATION_STOPPED`, after about six minutes; the run may still finish, so read it later
|
|
670
|
+
* with {@link getExecution}). At most one of the two is called, at most once.
|
|
671
|
+
*
|
|
672
|
+
* Neither is called if the script that registered them stops first: form, field, gallery and
|
|
673
|
+
* table scripts stop after one minute, and they and page event scripts stop when the next script
|
|
674
|
+
* starts on the same form, component or page. In those scripts, keep the `ExecutionId` and read
|
|
675
|
+
* it later with {@link getExecution}.
|
|
676
|
+
*
|
|
677
|
+
* Returns a function that stops observing. It never cancels the run.
|
|
678
|
+
*
|
|
679
|
+
* @example
|
|
680
|
+
* const stop = agent.onExecutionComplete(ExecutionId, (run) => show(run), (err) => warn(err));
|
|
681
|
+
* // later, e.g. on unmount
|
|
682
|
+
* stop();
|
|
683
|
+
*/
|
|
684
|
+
onExecutionComplete(executionId: string, onComplete: (execution: AgentExecution) => void, onWatchError?: (error: AgentError) => void): () => void;
|
|
685
|
+
}
|
|
686
|
+
declare class Report {
|
|
687
|
+
/**
|
|
688
|
+
* The report's calculated rows: groups and their values for a chart, the aggregate for a card.
|
|
689
|
+
* @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")
|
|
690
|
+
*/
|
|
691
|
+
getData(options?: ReportQueryOptions): Promise<ReportDataResponse>;
|
|
692
|
+
/** The number of rows a tabular report would return. Chart and card reports have no row count; use getData(). */
|
|
693
|
+
getCount(options?: ReportCountOptions): Promise<number>;
|
|
694
|
+
/** The fields of a tabular report. Empty for chart and card reports; use getData(). */
|
|
695
|
+
getFields(): Promise<ReportField[]>;
|
|
696
|
+
}
|
|
749
697
|
declare class Application {
|
|
750
698
|
page: Page
|
|
751
699
|
_id: string
|
|
@@ -815,6 +763,14 @@ declare class Application {
|
|
|
815
763
|
* const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks" } });
|
|
816
764
|
*/
|
|
817
765
|
getAgent(agentId: string): Agent;
|
|
766
|
+
/**
|
|
767
|
+
* Get a flow report of this app: one call returns the report's calculated data instead of every record.
|
|
768
|
+
*
|
|
769
|
+
* @example
|
|
770
|
+
* const report = kf.app.getReport("Process", "Leave_Request_A00", "Requests_by_status_x1Yz");
|
|
771
|
+
* const { Data } = await report.getData();
|
|
772
|
+
*/
|
|
773
|
+
getReport(flowType: ReportFlowType, flowId: string, reportId: string): Report;
|
|
818
774
|
getDataform(flowId: string): Dataform;
|
|
819
775
|
getBoard(flowId: string): Board;
|
|
820
776
|
getProcess(flowId: string): Process;
|
|
@@ -891,14 +847,14 @@ declare type PayloadSortItem = {
|
|
|
891
847
|
|
|
892
848
|
declare type PayloadOptions = {
|
|
893
849
|
Columns?: any[];
|
|
894
|
-
|
|
850
|
+
Filter?: any;
|
|
895
851
|
Sort?: PayloadSortItem[];
|
|
896
852
|
FilterParam?: any;
|
|
897
853
|
};
|
|
898
854
|
|
|
899
855
|
declare type ProcessPayloadOptions = {
|
|
900
856
|
Columns?: any[];
|
|
901
|
-
|
|
857
|
+
Filter?: any;
|
|
902
858
|
Sort?: PayloadSortItem[];
|
|
903
859
|
};
|
|
904
860
|
|
|
@@ -1071,7 +1027,7 @@ declare type ProcessDiscardItemOptions = {
|
|
|
1071
1027
|
instanceId: string;
|
|
1072
1028
|
};
|
|
1073
1029
|
|
|
1074
|
-
declare type ProcessFieldOptions = {
|
|
1030
|
+
declare type ProcessFieldOptions = BaseQueryOptions & {
|
|
1075
1031
|
instanceId: string;
|
|
1076
1032
|
activityInstanceId: string;
|
|
1077
1033
|
fieldId: string;
|
|
@@ -1118,6 +1074,51 @@ declare type DataformQueryOptions = BaseQueryOptions & {
|
|
|
1118
1074
|
|
|
1119
1075
|
declare type DataformQueryResponse = QueryResponse;
|
|
1120
1076
|
|
|
1077
|
+
// ============================================
|
|
1078
|
+
// Report Types
|
|
1079
|
+
// ============================================
|
|
1080
|
+
|
|
1081
|
+
declare type ReportFlowType = "Form" | "Process" | "Case";
|
|
1082
|
+
|
|
1083
|
+
// The request body of a report read. Only FilterParam is read: it sets the report's open parameters, each named with
|
|
1084
|
+
// a leading $ and sent as text ({ "$status": "Completed" }). Any other key is ignored.
|
|
1085
|
+
declare type ReportPayload = {
|
|
1086
|
+
FilterParam?: Record<string, string | string[] | object>;
|
|
1087
|
+
};
|
|
1088
|
+
|
|
1089
|
+
declare type ReportQueryOptions = {
|
|
1090
|
+
pageNumber?: number;
|
|
1091
|
+
pageSize?: number;
|
|
1092
|
+
payload?: ReportPayload;
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
declare type ReportCountOptions = {
|
|
1096
|
+
payload?: ReportPayload;
|
|
1097
|
+
};
|
|
1098
|
+
|
|
1099
|
+
// A field of a tabular report. The report service may add keys such as Type.
|
|
1100
|
+
declare type ReportField = {
|
|
1101
|
+
Id: string;
|
|
1102
|
+
Name: string;
|
|
1103
|
+
[key: string]: any;
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
// Which of these keys come back depends on the report's type: a chart has Columns and Values (and Rows with a
|
|
1107
|
+
// series), a card has FieldMapping and Values (its Data is empty when nothing matches), a tabular report has
|
|
1108
|
+
// Columns, Id and Name, a pivot has Columns, Rows, Values and Formatting. Each Data row is keyed by the Id of its
|
|
1109
|
+
// Columns, Rows or Values entry.
|
|
1110
|
+
declare type ReportDataResponse = {
|
|
1111
|
+
Data: any[];
|
|
1112
|
+
Columns?: any[];
|
|
1113
|
+
Rows?: any[];
|
|
1114
|
+
Values?: any[];
|
|
1115
|
+
FieldMapping?: any[];
|
|
1116
|
+
Formatting?: any[];
|
|
1117
|
+
Id?: string;
|
|
1118
|
+
Name?: string;
|
|
1119
|
+
[key: string]: any;
|
|
1120
|
+
};
|
|
1121
|
+
|
|
1121
1122
|
declare type DataformCreateItemOptions = {
|
|
1122
1123
|
data?: object;
|
|
1123
1124
|
viewId?: string;
|
|
@@ -1149,7 +1150,7 @@ declare type DataformSubmitItemOptions = {
|
|
|
1149
1150
|
viewId?: string;
|
|
1150
1151
|
};
|
|
1151
1152
|
|
|
1152
|
-
declare type DataformFieldOptions = {
|
|
1153
|
+
declare type DataformFieldOptions = BaseQueryOptions & {
|
|
1153
1154
|
instanceId: string;
|
|
1154
1155
|
fieldId: string;
|
|
1155
1156
|
/** Skip the server-side model lookup by supplying the field's type directly. */
|
|
@@ -1171,6 +1172,7 @@ declare type BoardQueryResponse = QueryResponse;
|
|
|
1171
1172
|
|
|
1172
1173
|
declare type BoardGetItemOptions = {
|
|
1173
1174
|
instanceId: string;
|
|
1175
|
+
viewId?: string;
|
|
1174
1176
|
};
|
|
1175
1177
|
|
|
1176
1178
|
declare type BoardCreateItemOptions = {
|
|
@@ -1195,7 +1197,7 @@ declare type BoardDiscardItemOptions = {
|
|
|
1195
1197
|
instanceId: string;
|
|
1196
1198
|
};
|
|
1197
1199
|
|
|
1198
|
-
declare type BoardFieldOptions = {
|
|
1200
|
+
declare type BoardFieldOptions = BaseQueryOptions & {
|
|
1199
1201
|
instanceId: string;
|
|
1200
1202
|
fieldId: string;
|
|
1201
1203
|
/** Skip the server-side model lookup by supplying the field's type directly. */
|