@kissflow/lowcode-client-sdk 1.0.51 → 1.0.52

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 CHANGED
@@ -70,6 +70,9 @@ declare module "core/constants" {
70
70
  CUSTOM_FUNCTION_ON_RUN_COMPLETE: string;
71
71
  CUSTOM_FUNCTION_STOP_WATCH: string;
72
72
  DECISION_TABLE_EXECUTE: string;
73
+ REPORT_GET_DATA: string;
74
+ REPORT_GET_COUNT: string;
75
+ REPORT_GET_FIELDS: string;
73
76
  DATAFORM_IMPORT_CSV: string;
74
77
  DATAFORM_OPEN_FORM: string;
75
78
  DATAFORM_GET_FIELDS: string;
@@ -350,6 +353,34 @@ declare module "types/external" {
350
353
  payload?: PayloadOptions;
351
354
  };
352
355
  export type DataformQueryResponse = QueryResponse;
356
+ export type ReportFlowType = "Form" | "Process" | "Case";
357
+ export type ReportPayload = {
358
+ FilterParam?: Record<string, string | string[] | object>;
359
+ };
360
+ export type ReportQueryOptions = {
361
+ pageNumber?: number;
362
+ pageSize?: number;
363
+ payload?: ReportPayload;
364
+ };
365
+ export type ReportCountOptions = {
366
+ payload?: ReportPayload;
367
+ };
368
+ export type ReportField = {
369
+ Id: string;
370
+ Name: string;
371
+ [key: string]: any;
372
+ };
373
+ export type ReportDataResponse = {
374
+ Data: any[];
375
+ Columns?: any[];
376
+ Rows?: any[];
377
+ Values?: any[];
378
+ FieldMapping?: any[];
379
+ Formatting?: any[];
380
+ Id?: string;
381
+ Name?: string;
382
+ [key: string]: any;
383
+ };
353
384
  export type DataformCreateItemOptions = {
354
385
  data?: object;
355
386
  viewId?: string;
@@ -973,6 +1004,33 @@ declare module "app/agent" {
973
1004
  onExecutionComplete(executionId: string, onComplete: (execution: AgentExecution) => void, onWatchError?: (error: AgentError) => void): () => void;
974
1005
  }
975
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
+ }
976
1034
  declare module "form/index" {
977
1035
  import { BaseSDK } from "core/index";
978
1036
  export class Form extends BaseSDK {
@@ -1490,9 +1548,10 @@ declare module "app/index" {
1490
1548
  import { BaseSDK } from "core/index";
1491
1549
  import { Page } from "app/page";
1492
1550
  import { AppContext } from "types/internal";
1493
- import { rolesObject, RunEnvelope, RunWatchError } from "types/external";
1551
+ import { rolesObject, ReportFlowType, RunEnvelope, RunWatchError } from "types/external";
1494
1552
  import { DecisionTable } from "app/decisiontable";
1495
1553
  import { Agent } from "app/agent";
1554
+ import { Report } from "app/report";
1496
1555
  import { Dataform } from "dataform/index";
1497
1556
  import { Board } from "board/index";
1498
1557
  import { Process } from "process/index";
@@ -1567,6 +1626,14 @@ declare module "app/index" {
1567
1626
  * const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks" } });
1568
1627
  */
1569
1628
  getAgent(agentId: string): Agent;
1629
+ /**
1630
+ * Get a flow report of this app: one call returns the report's calculated data instead of every record.
1631
+ *
1632
+ * @example
1633
+ * const report = kf.app.getReport("Process", "Leave_Request_A00", "Requests_by_status_x1Yz");
1634
+ * const { Data } = await report.getData();
1635
+ */
1636
+ getReport(flowType: ReportFlowType, flowId: string, reportId: string): Report;
1570
1637
  getDataform(flowId: string): Dataform;
1571
1638
  getBoard(flowId: string): Board;
1572
1639
  getProcess(flowId: string): Process;
@@ -1610,6 +1677,7 @@ declare module "app/index" {
1610
1677
  }
1611
1678
  export * from "app/component";
1612
1679
  export { Agent };
1680
+ export { Report };
1613
1681
  export { Page };
1614
1682
  export * from "app/popup";
1615
1683
  }