@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/nocode.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
- private storeId;
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
- constructor(storeId: string, flowId: string, instanceId: string, tableId: string, activityInstanceId?: string);
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(): Form;
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
- Filters?: any;
250
+ Filter?: any;
239
251
  Sort?: PayloadSortItem[];
240
252
  FilterParam?: any;
241
253
  };
242
254
  export type ProcessPayloadOptions = {
243
255
  Columns?: any[];
244
- Filters?: any;
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. */
@@ -1091,39 +1104,12 @@ declare module "app/page" {
1091
1104
  getRoute(): string;
1092
1105
  }
1093
1106
  }
1094
- declare module "app/report" {
1095
- import { BaseSDK } from "core/index";
1096
- import { ReportFlowType, ReportQueryOptions, ReportCountOptions, ReportField, ReportDataResponse } from "types/external";
1097
- /**
1098
- * A flow report of the current app. The handle sends no request until you call one of its methods.
1099
- *
1100
- * @example
1101
- * const report = kf.app.getReport("Process", "Leave_Request_A00", "Requests_by_status_x1Yz");
1102
- * const { Data } = await report.getData();
1103
- */
1104
- export class Report extends BaseSDK {
1105
- private _flowType;
1106
- private _flowId;
1107
- private _id;
1108
- constructor(flowType: ReportFlowType, flowId: string, reportId: string);
1109
- /**
1110
- * The report's calculated rows: groups and their values for a chart, the aggregate for a card.
1111
- * @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")
1112
- */
1113
- getData(options?: ReportQueryOptions): Promise<ReportDataResponse>;
1114
- /** The number of rows a tabular report would return. Chart and card reports have no row count; use getData(). */
1115
- getCount(options?: ReportCountOptions): Promise<number>;
1116
- /** The fields of a tabular report. Empty for chart and card reports; use getData(). */
1117
- getFields(): Promise<ReportField[]>;
1118
- private _send;
1119
- }
1120
- }
1121
1107
  declare module "dataform/index" {
1122
1108
  import { BaseSDK } from "core/index";
1123
- import { Form } from "form/index";
1109
+ import { CustomComponentForm } from "form/index";
1124
1110
  import { DataformItem, DataformQueryOptions, DataformQueryResponse, DataformCreateItemOptions, DataformUpdateItemOptions, DataformGetItemOptions, DataformDeleteItemOptions, DataformDiscardItemOptions, DataformSubmitItemOptions, DataformFieldOptions } from "types/external";
1125
1111
  export class Dataform extends BaseSDK {
1126
- private _id;
1112
+ protected _id: string;
1127
1113
  constructor(flowId: string);
1128
1114
  /**
1129
1115
  * Get all items from this dataform with optional filtering, sorting, and pagination
@@ -1190,6 +1176,15 @@ declare module "dataform/index" {
1190
1176
  getFields(options?: {
1191
1177
  viewId?: string;
1192
1178
  }): Promise<any>;
1179
+ getFieldOptions(options: DataformFieldOptions): Promise<DataformQueryResponse>;
1180
+ }
1181
+ /**
1182
+ * Dataform with custom-component-only capabilities.
1183
+ *
1184
+ * Returned by `kf.app.getDataform()` inside a custom component. Adds `initForm`,
1185
+ * which is not available in the Low/No-code (Run Script) SDKs.
1186
+ */
1187
+ export class CustomComponentDataform extends Dataform {
1193
1188
  /**
1194
1189
  * Initialize a form with all necessary data (schema, item data, form store)
1195
1190
  * This is the recommended way to create a custom form for dataform records
@@ -1212,16 +1207,15 @@ declare module "dataform/index" {
1212
1207
  * const form = await dataform.initForm();
1213
1208
  * await form.updateField({ firstName: "John" });
1214
1209
  */
1215
- initForm(instanceId?: string, viewId?: string): Promise<Form>;
1216
- getFieldOptions(options?: DataformFieldOptions): Promise<DataformQueryResponse>;
1210
+ initForm(instanceId?: string, viewId?: string): Promise<CustomComponentForm>;
1217
1211
  }
1218
1212
  }
1219
1213
  declare module "board/index" {
1220
1214
  import { BaseSDK } from "core/index";
1221
- import { Form } from "form/index";
1215
+ import { CustomComponentForm } from "form/index";
1222
1216
  import { BoardItem, BoardGetItemOptions, BoardGetItemsOptions, BoardQueryResponse, BoardCreateItemOptions, BoardUpdateItemOptions, BoardDeleteItemOptions, BoardSubmitItemOptions, BoardDiscardItemOptions, BoardFieldOptions } from "types/external";
1223
1217
  export class Board extends BaseSDK {
1224
- private _id;
1218
+ protected _id: string;
1225
1219
  constructor(flowId: string);
1226
1220
  /**
1227
1221
  * Import data from CSV file
@@ -1245,7 +1239,7 @@ declare module "board/index" {
1245
1239
  getItems(options?: BoardGetItemsOptions): Promise<BoardQueryResponse>;
1246
1240
  /**
1247
1241
  * Get a single board/case item by instance ID
1248
- * @param options - instanceId (required)
1242
+ * @param options - instanceId (required), optional viewId
1249
1243
  * @returns Promise containing the item data
1250
1244
  */
1251
1245
  getItem(options: BoardGetItemOptions): Promise<BoardItem>;
@@ -1256,7 +1250,7 @@ declare module "board/index" {
1256
1250
  *
1257
1251
  * @example
1258
1252
  * const board = kf.app.getBoard("Inventory");
1259
- * const item = await board.createItem({ data: { Name: "New Item" } });
1253
+ * const item = await board.createItem({ data: { itemType: "New Item" } });
1260
1254
  */
1261
1255
  createItem(options?: BoardCreateItemOptions): Promise<BoardItem>;
1262
1256
  /**
@@ -1268,7 +1262,7 @@ declare module "board/index" {
1268
1262
  * const board = kf.app.getBoard("Inventory");
1269
1263
  * await board.updateItem({
1270
1264
  * instanceId: "item_123",
1271
- * data: { Name: "Updated Item" }
1265
+ * data: { itemType: "Updated Item" }
1272
1266
  * });
1273
1267
  */
1274
1268
  updateItem(options: BoardUpdateItemOptions): Promise<BoardItem>;
@@ -1299,6 +1293,27 @@ declare module "board/index" {
1299
1293
  getFields(options?: {
1300
1294
  viewId?: string;
1301
1295
  }): Promise<any>;
1296
+ /**
1297
+ * Get field options for dropdown/lookup fields
1298
+ * @param options - Field options (instanceId, fieldId)
1299
+ * @returns Promise containing the field options
1300
+ *
1301
+ * @example
1302
+ * const board = kf.app.getBoard("Inventory");
1303
+ * const options = await board.getFieldOptions({
1304
+ * instanceId: "item_123",
1305
+ * fieldId: "Category"
1306
+ * });
1307
+ */
1308
+ getFieldOptions(options: BoardFieldOptions): Promise<any>;
1309
+ }
1310
+ /**
1311
+ * Board with custom-component-only capabilities.
1312
+ *
1313
+ * Returned by `kf.app.getBoard()` inside a custom component. Adds `initForm`,
1314
+ * which is not available in the Low/No-code (Run Script) SDKs.
1315
+ */
1316
+ export class CustomComponentBoard extends Board {
1302
1317
  /**
1303
1318
  * Initialize a form for a board item with all necessary setup
1304
1319
  * Fetches schema, item data, creates and initializes the form store
@@ -1311,7 +1326,7 @@ declare module "board/index" {
1311
1326
  * // Create new board item
1312
1327
  * const board = kf.app.getBoard("Inventory");
1313
1328
  * const form = await board.initForm();
1314
- * await form.updateField({ Name: "New Item" });
1329
+ * await form.updateField({ itemType: "New Item" });
1315
1330
  *
1316
1331
  * // Edit existing board item
1317
1332
  * const form = await board.initForm("item_123");
@@ -1320,28 +1335,15 @@ declare module "board/index" {
1320
1335
  * // Edit existing board item scoped to a view
1321
1336
  * const form = await board.initForm("item_123", "Inventory_View");
1322
1337
  */
1323
- initForm(instanceId?: string, viewId?: string): Promise<Form>;
1324
- /**
1325
- * Get field options for dropdown/lookup fields
1326
- * @param options - Field options (instanceId, fieldId)
1327
- * @returns Promise containing the field options
1328
- *
1329
- * @example
1330
- * const board = kf.app.getBoard("Inventory");
1331
- * const options = await board.getFieldOptions({
1332
- * instanceId: "item_123",
1333
- * fieldId: "Category"
1334
- * });
1335
- */
1336
- getFieldOptions(options: BoardFieldOptions): Promise<any>;
1338
+ initForm(instanceId?: string, viewId?: string): Promise<CustomComponentForm>;
1337
1339
  }
1338
1340
  }
1339
1341
  declare module "process/index" {
1340
1342
  import { BaseSDK } from "core/index";
1341
- import { Form } from "form/index";
1343
+ import { CustomComponentForm } from "form/index";
1342
1344
  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";
1343
1345
  export class Process extends BaseSDK {
1344
- private _id;
1346
+ protected _id: string;
1345
1347
  constructor(flowId: string);
1346
1348
  /**
1347
1349
  * Get my items from this process (items I initiated)
@@ -1547,26 +1549,7 @@ declare module "process/index" {
1547
1549
  getProgress(options: {
1548
1550
  instanceId: string;
1549
1551
  }): Promise<any>;
1550
- /**
1551
- * Initialize a form with all necessary data (schema, item data, form store)
1552
- * This is the recommended way to create a custom form for dataform records
1553
- * It automatically handles fetching schema, item data, and initializing the form store
1554
- *
1555
- * @param instanceId - Optional instance ID of the dataform record. If omitted, creates a new record
1556
- * @returns Promise with Form instance ready to use
1557
- *
1558
- * @example
1559
- * // Load existing record
1560
- * const dataform = kf.app.getDataform("EmpMaster");
1561
- * const form = await dataform.initForm("emp_123");
1562
- * const data = await form.toJSON();
1563
- *
1564
- * // Create new record
1565
- * const form = await dataform.initForm();
1566
- * await form.updateField({ firstName: "John" });
1567
- */
1568
- initForm(instanceId?: string, activityInstanceId?: string): Promise<Form>;
1569
- getFieldOptions(options?: ProcessFieldOptions): Promise<ProcessQueryResponse>;
1552
+ getFieldOptions(options: ProcessFieldOptions): Promise<ProcessQueryResponse>;
1570
1553
  /**
1571
1554
  * Trigger AI document parsing on an uploaded file for a Smart Attachment field.
1572
1555
  * Matches native platform behavior: matching empty fields are auto-filled directly
@@ -1582,6 +1565,60 @@ declare module "process/index" {
1582
1565
  */
1583
1566
  parseAttachment(options: ProcessParseAttachmentOptions): Promise<ProcessAttachmentParseResult>;
1584
1567
  }
1568
+ /**
1569
+ * Process with custom-component-only capabilities.
1570
+ *
1571
+ * Returned by `kf.app.getProcess()` inside a custom component. Adds `initForm`,
1572
+ * which is not available in the Low/No-code (Run Script) SDKs.
1573
+ */
1574
+ export class CustomComponentProcess extends Process {
1575
+ /**
1576
+ * Initialize a form with all necessary data (schema, item data, form store)
1577
+ * This is the recommended way to create a custom form for process instances
1578
+ * It automatically handles fetching schema, item data, and initializing the form store
1579
+ *
1580
+ * @param instanceId - Optional instance ID of the process record. If omitted, creates a new instance
1581
+ * @param activityInstanceId - Optional activity (task) instance the form is being filled for
1582
+ * @returns Promise with Form instance ready to use
1583
+ *
1584
+ * @example
1585
+ * // Start a new process instance
1586
+ * const form = await process.initForm();
1587
+ * await form.updateField({ LeaveType: "Annual" });
1588
+ *
1589
+ * // Continue an in-progress task
1590
+ * const form = await process.initForm("item_123", "act_456");
1591
+ * const data = await form.toJSON();
1592
+ */
1593
+ initForm(instanceId?: string, activityInstanceId?: string): Promise<CustomComponentForm>;
1594
+ }
1595
+ }
1596
+ declare module "app/report" {
1597
+ import { BaseSDK } from "core/index";
1598
+ import { ReportFlowType, ReportQueryOptions, ReportCountOptions, ReportField, ReportDataResponse } from "types/external";
1599
+ /**
1600
+ * A flow report of the current app. The handle sends no request until you call one of its methods.
1601
+ *
1602
+ * @example
1603
+ * const report = kf.app.getReport("Process", "Leave_Request_A00", "Requests_by_status_x1Yz");
1604
+ * const { Data } = await report.getData();
1605
+ */
1606
+ export class Report extends BaseSDK {
1607
+ private _flowType;
1608
+ private _flowId;
1609
+ private _id;
1610
+ constructor(flowType: ReportFlowType, flowId: string, reportId: string);
1611
+ /**
1612
+ * The report's calculated rows: groups and their values for a chart, the aggregate for a card.
1613
+ * @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")
1614
+ */
1615
+ getData(options?: ReportQueryOptions): Promise<ReportDataResponse>;
1616
+ /** The number of rows a tabular report would return. Chart and card reports have no row count; use getData(). */
1617
+ getCount(options?: ReportCountOptions): Promise<number>;
1618
+ /** The fields of a tabular report. Empty for chart and card reports; use getData(). */
1619
+ getFields(): Promise<ReportField[]>;
1620
+ private _send;
1621
+ }
1585
1622
  }
1586
1623
  declare module "app/index" {
1587
1624
  import { BaseSDK } from "core/index";
@@ -1589,11 +1626,11 @@ declare module "app/index" {
1589
1626
  import { AppContext } from "types/internal";
1590
1627
  import { rolesObject, ReportFlowType, RunEnvelope, RunWatchError } from "types/external";
1591
1628
  import { DecisionTable } from "app/decisiontable";
1629
+ import { Dataform, CustomComponentDataform } from "dataform/index";
1630
+ import { Board, CustomComponentBoard } from "board/index";
1631
+ import { Process, CustomComponentProcess } from "process/index";
1592
1632
  import { Agent } from "app/agent";
1593
1633
  import { Report } from "app/report";
1594
- import { Dataform } from "dataform/index";
1595
- import { Board } from "board/index";
1596
- import { Process } from "process/index";
1597
1634
  export class Application extends BaseSDK {
1598
1635
  page: Page;
1599
1636
  _id: string;
@@ -1714,6 +1751,18 @@ declare module "app/index" {
1714
1751
  roleName?: string;
1715
1752
  }): Promise<rolesObject>;
1716
1753
  }
1754
+ /**
1755
+ * Application with custom-component-only capabilities.
1756
+ *
1757
+ * Used by the custom-component SDK (`kf.app`). Its flow accessors return the
1758
+ * `CustomComponent*` variants, which expose `initForm` — a method that the
1759
+ * Low/No-code (Run Script) SDKs deliberately do not have.
1760
+ */
1761
+ export class CustomComponentApplication extends Application {
1762
+ getDataform(flowId: string): CustomComponentDataform;
1763
+ getBoard(flowId: string): CustomComponentBoard;
1764
+ getProcess(flowId: string): CustomComponentProcess;
1765
+ }
1717
1766
  export * from "app/component";
1718
1767
  export { Agent };
1719
1768
  export { Report };
@@ -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;
@@ -248,14 +246,14 @@ declare type PayloadSortItem = {
248
246
 
249
247
  declare type PayloadOptions = {
250
248
  Columns?: any[];
251
- Filters?: any;
249
+ Filter?: any;
252
250
  Sort?: PayloadSortItem[];
253
251
  FilterParam?: any;
254
252
  };
255
253
 
256
254
  declare type ProcessPayloadOptions = {
257
255
  Columns?: any[];
258
- Filters?: any;
256
+ Filter?: any;
259
257
  Sort?: PayloadSortItem[];
260
258
  };
261
259
 
@@ -428,7 +426,7 @@ declare type ProcessDiscardItemOptions = {
428
426
  instanceId: string;
429
427
  };
430
428
 
431
- declare type ProcessFieldOptions = {
429
+ declare type ProcessFieldOptions = BaseQueryOptions & {
432
430
  instanceId: string;
433
431
  activityInstanceId: string;
434
432
  fieldId: string;
@@ -551,7 +549,7 @@ declare type DataformSubmitItemOptions = {
551
549
  viewId?: string;
552
550
  };
553
551
 
554
- declare type DataformFieldOptions = {
552
+ declare type DataformFieldOptions = BaseQueryOptions & {
555
553
  instanceId: string;
556
554
  fieldId: string;
557
555
  /** Skip the server-side model lookup by supplying the field's type directly. */
@@ -573,6 +571,7 @@ declare type BoardQueryResponse = QueryResponse;
573
571
 
574
572
  declare type BoardGetItemOptions = {
575
573
  instanceId: string;
574
+ viewId?: string;
576
575
  };
577
576
 
578
577
  declare type BoardCreateItemOptions = {
@@ -597,7 +596,7 @@ declare type BoardDiscardItemOptions = {
597
596
  instanceId: string;
598
597
  };
599
598
 
600
- declare type BoardFieldOptions = {
599
+ declare type BoardFieldOptions = BaseQueryOptions & {
601
600
  instanceId: string;
602
601
  fieldId: string;
603
602
  /** Skip the server-side model lookup by supplying the field's type directly. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kissflow/lowcode-client-sdk",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "description": "JavaScript SDK for developing over the Kissflow lowcode platform",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [