@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/kfsdk.es.js CHANGED
@@ -105,6 +105,9 @@ const LISTENER_CMDS = {
105
105
  CUSTOM_FUNCTION_ON_RUN_COMPLETE: "CUSTOM_FUNCTION_ON_RUN_COMPLETE",
106
106
  CUSTOM_FUNCTION_STOP_WATCH: "CUSTOM_FUNCTION_STOP_WATCH",
107
107
  DECISION_TABLE_EXECUTE: "DECISION_TABLE_EXECUTE",
108
+ REPORT_GET_DATA: "REPORT_GET_DATA",
109
+ REPORT_GET_COUNT: "REPORT_GET_COUNT",
110
+ REPORT_GET_FIELDS: "REPORT_GET_FIELDS",
108
111
  DATAFORM_IMPORT_CSV: "DATAFORM_IMPORT_CSV",
109
112
  DATAFORM_OPEN_FORM: "DATAFORM_OPEN_FORM",
110
113
  DATAFORM_GET_FIELDS: "DATAFORM_GET_FIELDS",
@@ -675,146 +678,6 @@ class DecisionTable extends BaseSDK {
675
678
  });
676
679
  }
677
680
  }
678
- const READ_TIMEOUT_MS$1 = 75e3;
679
- const EXECUTE_TIMEOUT_MS = 6e4;
680
- const WATCH_ACK_TIMEOUT_MS$1 = 6e4;
681
- const WATCH_DEADLINE_MS$1 = 42e4;
682
- const TERMINAL_STATUSES$1 = ["Completed", "Failed"];
683
- function sdkError$1(errorCode, error) {
684
- return { isError: true, error, errorCode };
685
- }
686
- function notify$1(callback, value) {
687
- try {
688
- callback == null ? void 0 : callback(value);
689
- } catch (error) {
690
- console.error(error);
691
- }
692
- }
693
- const NOT_SENT$1 = sdkError$1("AGENT_REQUEST_NOT_SENT", "The request could not be sent to the host.");
694
- class Agent extends BaseSDK {
695
- constructor(agentId) {
696
- super();
697
- this.activeWatches = 0;
698
- this.agentId = agentId;
699
- this._id = generateId("customagent");
700
- }
701
- getContract() {
702
- return this._postMessageBounded(
703
- LISTENER_CMDS.CUSTOM_AGENT_GET_CONTRACT,
704
- { agentId: this.agentId },
705
- {
706
- timeoutMs: READ_TIMEOUT_MS$1,
707
- timeoutError: sdkError$1("AGENT_HOST_TIMEOUT", "The host did not answer the Agent contract request."),
708
- sendError: NOT_SENT$1
709
- }
710
- ).promise;
711
- }
712
- execute(options) {
713
- var _a;
714
- return this._postMessageBounded(
715
- LISTENER_CMDS.CUSTOM_AGENT_EXECUTE,
716
- { agentId: this.agentId, inputData: (_a = options == null ? void 0 : options.inputData) != null ? _a : {} },
717
- {
718
- timeoutMs: EXECUTE_TIMEOUT_MS,
719
- timeoutError: sdkError$1(
720
- "AGENT_EXECUTE_OUTCOME_UNKNOWN",
721
- "The host did not confirm the run; it may still have started."
722
- ),
723
- sendError: sdkError$1("AGENT_EXECUTE_NOT_SENT", "The run request could not be sent to the host.")
724
- }
725
- ).promise;
726
- }
727
- getExecution(executionId) {
728
- return this._postMessageBounded(
729
- LISTENER_CMDS.CUSTOM_AGENT_GET_EXECUTION,
730
- { agentId: this.agentId, executionId },
731
- {
732
- timeoutMs: READ_TIMEOUT_MS$1,
733
- timeoutError: sdkError$1("AGENT_HOST_TIMEOUT", "The host did not answer the Agent execution request."),
734
- sendError: NOT_SENT$1
735
- }
736
- ).promise;
737
- }
738
- onExecutionComplete(executionId, onComplete, onWatchError) {
739
- const watchId = generateId("agentwatch");
740
- const eventName = `${EVENT_TYPES.CUSTOM_AGENT_EXECUTION_COMPLETE}:${watchId}`;
741
- let settled = false;
742
- let deadline = null;
743
- let registration = null;
744
- const end = () => {
745
- settled = true;
746
- if (deadline)
747
- clearTimeout(deadline);
748
- registration == null ? void 0 : registration.cancel();
749
- this._removeEventListener(eventName);
750
- this.activeWatches -= 1;
751
- if (this.activeWatches === 0)
752
- Reflect.deleteProperty(globalInstances, this._id);
753
- };
754
- const tellHostToStop = () => {
755
- try {
756
- this._postMessage(LISTENER_CMDS.CUSTOM_AGENT_STOP_WATCH, { id: this._id, watchId, eventName });
757
- } catch {
758
- }
759
- };
760
- const fail = (error) => {
761
- if (settled)
762
- return;
763
- end();
764
- tellHostToStop();
765
- notify$1(onWatchError, error);
766
- };
767
- const listener = (params) => {
768
- if (settled)
769
- return;
770
- if (params == null ? void 0 : params.isError) {
771
- end();
772
- notify$1(onWatchError, params);
773
- return;
774
- }
775
- const execution = params;
776
- if ((execution == null ? void 0 : execution.ExecutionId) !== executionId || TERMINAL_STATUSES$1.indexOf(execution == null ? void 0 : execution.Status) === -1) {
777
- fail(sdkError$1("AGENT_WATCH_INVALID_EVENT", "The host reported something other than a finished run."));
778
- return;
779
- }
780
- end();
781
- notify$1(onComplete, execution);
782
- };
783
- this.activeWatches += 1;
784
- globalInstances[this._id] = this;
785
- this._addEventListener(eventName, listener);
786
- registration = this._postMessageBounded(
787
- LISTENER_CMDS.CUSTOM_AGENT_WATCH_EXECUTION,
788
- { id: this._id, agentId: this.agentId, executionId, watchId, eventName },
789
- {
790
- timeoutMs: WATCH_ACK_TIMEOUT_MS$1,
791
- timeoutError: sdkError$1("AGENT_HOST_UNSUPPORTED", "The host did not start observing the Agent run."),
792
- sendError: NOT_SENT$1
793
- }
794
- );
795
- registration.promise.then(
796
- (acknowledged) => {
797
- if (settled)
798
- return;
799
- if (acknowledged !== true) {
800
- fail(sdkError$1("AGENT_HOST_UNSUPPORTED", "The host did not start observing the Agent run."));
801
- return;
802
- }
803
- deadline = setTimeout(
804
- () => fail(sdkError$1("AGENT_OBSERVATION_STOPPED", "Stopped checking the Agent run; read it again later.")),
805
- WATCH_DEADLINE_MS$1
806
- );
807
- },
808
- (error) => fail(error)
809
- );
810
- return () => {
811
- if (settled)
812
- return;
813
- end();
814
- tellHostToStop();
815
- };
816
- }
817
- }
818
681
  class Form extends BaseSDK {
819
682
  constructor(storeId, flowId, instanceId, activityInstanceId) {
820
683
  super();
@@ -844,6 +707,18 @@ class Form extends BaseSDK {
844
707
  data: args
845
708
  });
846
709
  }
710
+ getTable(tableId) {
711
+ return new Table(
712
+ this.storeId,
713
+ this.flowId,
714
+ this.instanceId,
715
+ tableId,
716
+ this.activityInstanceId,
717
+ this
718
+ );
719
+ }
720
+ }
721
+ class CustomComponentForm extends Form {
847
722
  getValidationErrors() {
848
723
  return this._postMessageAsync(
849
724
  LISTENER_CMDS.GET_FORM_VALIDATION_ERRORS,
@@ -865,24 +740,16 @@ class Form extends BaseSDK {
865
740
  instanceId: this.instanceId
866
741
  });
867
742
  }
868
- getTable(tableId) {
869
- return new Table(
870
- this.storeId,
871
- this.flowId,
872
- this.instanceId,
873
- tableId,
874
- this.activityInstanceId
875
- );
876
- }
877
743
  }
878
744
  class Table extends BaseSDK {
879
- constructor(storeId, flowId, instanceId, tableId, activityInstanceId) {
745
+ constructor(storeId, flowId, instanceId, tableId, activityInstanceId, parent) {
880
746
  super();
881
747
  this.tableId = tableId;
882
748
  this.storeId = storeId;
883
749
  this.flowId = flowId;
884
750
  this.instanceId = instanceId;
885
751
  this.activityInstanceId = activityInstanceId;
752
+ this.parent = parent;
886
753
  }
887
754
  toJSON() {
888
755
  return this._postMessageAsync(LISTENER_CMDS.TO_JSON, {
@@ -915,7 +782,8 @@ class Table extends BaseSDK {
915
782
  this.instanceId,
916
783
  this.tableId,
917
784
  row.id,
918
- this.activityInstanceId
785
+ this.activityInstanceId,
786
+ this.parent
919
787
  )
920
788
  );
921
789
  }
@@ -928,7 +796,8 @@ class Table extends BaseSDK {
928
796
  this.instanceId,
929
797
  this.tableId,
930
798
  rowId,
931
- this.activityInstanceId
799
+ this.activityInstanceId,
800
+ this.parent
932
801
  );
933
802
  }
934
803
  addRow(rowObject) {
@@ -965,7 +834,7 @@ class Table extends BaseSDK {
965
834
  }
966
835
  }
967
836
  class TableForm extends BaseSDK {
968
- constructor(storeId, flowId, instanceId, tableId, rowId, activityInstanceId) {
837
+ constructor(storeId, flowId, instanceId, tableId, rowId, activityInstanceId, parent) {
969
838
  super();
970
839
  this.storeId = storeId;
971
840
  this.flowId = flowId;
@@ -974,8 +843,11 @@ class TableForm extends BaseSDK {
974
843
  this.tableId = tableId;
975
844
  this.rowId = rowId;
976
845
  this.activityInstanceId = activityInstanceId;
846
+ this.parent = parent;
977
847
  }
978
848
  getParent() {
849
+ if (this.parent)
850
+ return this.parent;
979
851
  return new Form(
980
852
  this.storeId,
981
853
  this.flowId,
@@ -1102,32 +974,43 @@ class Dataform extends BaseSDK {
1102
974
  viewId: (options == null ? void 0 : options.viewId) || ""
1103
975
  });
1104
976
  }
977
+ getFieldOptions(options) {
978
+ const error = requireFieldsAsync([
979
+ { value: options == null ? void 0 : options.instanceId, name: "instanceId" },
980
+ { value: options == null ? void 0 : options.fieldId, name: "fieldId" }
981
+ ]);
982
+ if (error)
983
+ return error;
984
+ return this._postMessageAsync(
985
+ LISTENER_CMDS.DATAFORM_GET_FIELD_OPTIONS,
986
+ {
987
+ flowId: this._id,
988
+ instanceId: options.instanceId,
989
+ fieldId: options.fieldId,
990
+ fieldType: options.fieldType,
991
+ tableId: options.tableId,
992
+ tableRowId: options.tableRowId,
993
+ pageNumber: options.pageNumber,
994
+ pageSize: options.pageSize,
995
+ searchValue: options.searchValue
996
+ }
997
+ );
998
+ }
999
+ }
1000
+ class CustomComponentDataform extends Dataform {
1105
1001
  initForm(instanceId, viewId) {
1106
1002
  return this._postMessageAsync(LISTENER_CMDS.DATAFORM_INIT_FORM, {
1107
1003
  flowId: this._id,
1108
1004
  instanceId: instanceId || "",
1109
1005
  viewId: viewId || ""
1110
1006
  }).then((response) => {
1111
- return new Form(
1007
+ return new CustomComponentForm(
1112
1008
  response.storeId || instanceId || "",
1113
1009
  this._id,
1114
1010
  response.itemId || instanceId
1115
1011
  );
1116
1012
  });
1117
1013
  }
1118
- getFieldOptions(options) {
1119
- return this._postMessageAsync(
1120
- LISTENER_CMDS.DATAFORM_GET_FIELD_OPTIONS,
1121
- {
1122
- flowId: this._id,
1123
- instanceId: (options == null ? void 0 : options.instanceId) || "",
1124
- fieldId: (options == null ? void 0 : options.fieldId) || "",
1125
- fieldType: options == null ? void 0 : options.fieldType,
1126
- tableId: options == null ? void 0 : options.tableId,
1127
- tableRowId: options == null ? void 0 : options.tableRowId
1128
- }
1129
- );
1130
- }
1131
1014
  }
1132
1015
  class Board extends BaseSDK {
1133
1016
  constructor(flowId) {
@@ -1166,7 +1049,8 @@ class Board extends BaseSDK {
1166
1049
  return error;
1167
1050
  return this._postMessageAsync(LISTENER_CMDS.BOARD_GET_ITEM, {
1168
1051
  flowId: this._id,
1169
- instanceId: options.instanceId
1052
+ instanceId: options.instanceId,
1053
+ viewId: options.viewId || ""
1170
1054
  });
1171
1055
  }
1172
1056
  createItem(options) {
@@ -1218,23 +1102,10 @@ class Board extends BaseSDK {
1218
1102
  viewId: (options == null ? void 0 : options.viewId) || ""
1219
1103
  });
1220
1104
  }
1221
- initForm(instanceId, viewId) {
1222
- return this._postMessageAsync(LISTENER_CMDS.BOARD_INIT_FORM, {
1223
- flowId: this._id,
1224
- instanceId: instanceId || "",
1225
- viewId: viewId || ""
1226
- }).then((response) => {
1227
- return new Form(
1228
- response.storeId || instanceId || "",
1229
- this._id,
1230
- response.itemId || instanceId
1231
- );
1232
- });
1233
- }
1234
1105
  getFieldOptions(options) {
1235
1106
  const error = requireFieldsAsync([
1236
- { value: options.instanceId, name: "instanceId" },
1237
- { value: options.fieldId, name: "fieldId" }
1107
+ { value: options == null ? void 0 : options.instanceId, name: "instanceId" },
1108
+ { value: options == null ? void 0 : options.fieldId, name: "fieldId" }
1238
1109
  ]);
1239
1110
  if (error)
1240
1111
  return error;
@@ -1244,7 +1115,25 @@ class Board extends BaseSDK {
1244
1115
  fieldId: options.fieldId,
1245
1116
  fieldType: options.fieldType,
1246
1117
  tableId: options == null ? void 0 : options.tableId,
1247
- tableRowId: options == null ? void 0 : options.tableRowId
1118
+ tableRowId: options == null ? void 0 : options.tableRowId,
1119
+ pageNumber: options == null ? void 0 : options.pageNumber,
1120
+ pageSize: options == null ? void 0 : options.pageSize,
1121
+ searchValue: options == null ? void 0 : options.searchValue
1122
+ });
1123
+ }
1124
+ }
1125
+ class CustomComponentBoard extends Board {
1126
+ initForm(instanceId, viewId) {
1127
+ return this._postMessageAsync(LISTENER_CMDS.BOARD_INIT_FORM, {
1128
+ flowId: this._id,
1129
+ instanceId: instanceId || "",
1130
+ viewId: viewId || ""
1131
+ }).then((response) => {
1132
+ return new CustomComponentForm(
1133
+ response.storeId || instanceId || "",
1134
+ this._id,
1135
+ response.itemId || instanceId
1136
+ );
1248
1137
  });
1249
1138
  }
1250
1139
  }
@@ -1531,29 +1420,25 @@ class Process extends BaseSDK {
1531
1420
  instanceId: options.instanceId
1532
1421
  });
1533
1422
  }
1534
- initForm(instanceId, activityInstanceId) {
1535
- return this._postMessageAsync(LISTENER_CMDS.PROCESS_INIT_FORM, {
1536
- flowId: this._id,
1537
- instanceId: instanceId || "",
1538
- activityInstanceId: activityInstanceId || ""
1539
- }).then((response) => {
1540
- return new Form(
1541
- response.storeId || instanceId || "",
1542
- this._id,
1543
- response.itemId || instanceId,
1544
- response.activityInstanceId || activityInstanceId
1545
- );
1546
- });
1547
- }
1548
1423
  getFieldOptions(options) {
1424
+ const error = requireFieldsAsync([
1425
+ { value: options == null ? void 0 : options.instanceId, name: "instanceId" },
1426
+ { value: options == null ? void 0 : options.activityInstanceId, name: "activityInstanceId" },
1427
+ { value: options == null ? void 0 : options.fieldId, name: "fieldId" }
1428
+ ]);
1429
+ if (error)
1430
+ return error;
1549
1431
  return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_FIELD_OPTIONS, {
1550
1432
  flowId: this._id,
1551
- instanceId: (options == null ? void 0 : options.instanceId) || "",
1552
- activityInstanceId: (options == null ? void 0 : options.activityInstanceId) || "",
1553
- fieldId: (options == null ? void 0 : options.fieldId) || "",
1554
- fieldType: options == null ? void 0 : options.fieldType,
1555
- tableId: options == null ? void 0 : options.tableId,
1556
- tableRowId: options == null ? void 0 : options.tableRowId
1433
+ instanceId: options.instanceId,
1434
+ activityInstanceId: options.activityInstanceId,
1435
+ fieldId: options.fieldId,
1436
+ fieldType: options.fieldType,
1437
+ tableId: options.tableId,
1438
+ tableRowId: options.tableRowId,
1439
+ pageNumber: options.pageNumber,
1440
+ pageSize: options.pageSize,
1441
+ searchValue: options.searchValue
1557
1442
  });
1558
1443
  }
1559
1444
  parseAttachment(options) {
@@ -1574,6 +1459,203 @@ class Process extends BaseSDK {
1574
1459
  });
1575
1460
  }
1576
1461
  }
1462
+ class CustomComponentProcess extends Process {
1463
+ initForm(instanceId, activityInstanceId) {
1464
+ return this._postMessageAsync(LISTENER_CMDS.PROCESS_INIT_FORM, {
1465
+ flowId: this._id,
1466
+ instanceId: instanceId || "",
1467
+ activityInstanceId: activityInstanceId || ""
1468
+ }).then((response) => {
1469
+ return new CustomComponentForm(
1470
+ response.storeId || instanceId || "",
1471
+ this._id,
1472
+ response.itemId || instanceId,
1473
+ response.activityInstanceId || activityInstanceId
1474
+ );
1475
+ });
1476
+ }
1477
+ }
1478
+ const READ_TIMEOUT_MS$1 = 75e3;
1479
+ const EXECUTE_TIMEOUT_MS = 6e4;
1480
+ const WATCH_ACK_TIMEOUT_MS$1 = 6e4;
1481
+ const WATCH_DEADLINE_MS$1 = 42e4;
1482
+ const TERMINAL_STATUSES$1 = ["Completed", "Failed"];
1483
+ function sdkError$1(errorCode, error) {
1484
+ return { isError: true, error, errorCode };
1485
+ }
1486
+ function notify$1(callback, value) {
1487
+ try {
1488
+ callback == null ? void 0 : callback(value);
1489
+ } catch (error) {
1490
+ console.error(error);
1491
+ }
1492
+ }
1493
+ const NOT_SENT$1 = sdkError$1("AGENT_REQUEST_NOT_SENT", "The request could not be sent to the host.");
1494
+ class Agent extends BaseSDK {
1495
+ constructor(agentId) {
1496
+ super();
1497
+ this.activeWatches = 0;
1498
+ this.agentId = agentId;
1499
+ this._id = generateId("customagent");
1500
+ }
1501
+ getContract() {
1502
+ return this._postMessageBounded(
1503
+ LISTENER_CMDS.CUSTOM_AGENT_GET_CONTRACT,
1504
+ { agentId: this.agentId },
1505
+ {
1506
+ timeoutMs: READ_TIMEOUT_MS$1,
1507
+ timeoutError: sdkError$1("AGENT_HOST_TIMEOUT", "The host did not answer the Agent contract request."),
1508
+ sendError: NOT_SENT$1
1509
+ }
1510
+ ).promise;
1511
+ }
1512
+ execute(options) {
1513
+ var _a;
1514
+ return this._postMessageBounded(
1515
+ LISTENER_CMDS.CUSTOM_AGENT_EXECUTE,
1516
+ { agentId: this.agentId, inputData: (_a = options == null ? void 0 : options.inputData) != null ? _a : {} },
1517
+ {
1518
+ timeoutMs: EXECUTE_TIMEOUT_MS,
1519
+ timeoutError: sdkError$1(
1520
+ "AGENT_EXECUTE_OUTCOME_UNKNOWN",
1521
+ "The host did not confirm the run; it may still have started."
1522
+ ),
1523
+ sendError: sdkError$1("AGENT_EXECUTE_NOT_SENT", "The run request could not be sent to the host.")
1524
+ }
1525
+ ).promise;
1526
+ }
1527
+ getExecution(executionId) {
1528
+ return this._postMessageBounded(
1529
+ LISTENER_CMDS.CUSTOM_AGENT_GET_EXECUTION,
1530
+ { agentId: this.agentId, executionId },
1531
+ {
1532
+ timeoutMs: READ_TIMEOUT_MS$1,
1533
+ timeoutError: sdkError$1("AGENT_HOST_TIMEOUT", "The host did not answer the Agent execution request."),
1534
+ sendError: NOT_SENT$1
1535
+ }
1536
+ ).promise;
1537
+ }
1538
+ onExecutionComplete(executionId, onComplete, onWatchError) {
1539
+ const watchId = generateId("agentwatch");
1540
+ const eventName = `${EVENT_TYPES.CUSTOM_AGENT_EXECUTION_COMPLETE}:${watchId}`;
1541
+ let settled = false;
1542
+ let deadline = null;
1543
+ let registration = null;
1544
+ const end = () => {
1545
+ settled = true;
1546
+ if (deadline)
1547
+ clearTimeout(deadline);
1548
+ registration == null ? void 0 : registration.cancel();
1549
+ this._removeEventListener(eventName);
1550
+ this.activeWatches -= 1;
1551
+ if (this.activeWatches === 0)
1552
+ Reflect.deleteProperty(globalInstances, this._id);
1553
+ };
1554
+ const tellHostToStop = () => {
1555
+ try {
1556
+ this._postMessage(LISTENER_CMDS.CUSTOM_AGENT_STOP_WATCH, { id: this._id, watchId, eventName });
1557
+ } catch {
1558
+ }
1559
+ };
1560
+ const fail = (error) => {
1561
+ if (settled)
1562
+ return;
1563
+ end();
1564
+ tellHostToStop();
1565
+ notify$1(onWatchError, error);
1566
+ };
1567
+ const listener = (params) => {
1568
+ if (settled)
1569
+ return;
1570
+ if (params == null ? void 0 : params.isError) {
1571
+ end();
1572
+ notify$1(onWatchError, params);
1573
+ return;
1574
+ }
1575
+ const execution = params;
1576
+ if ((execution == null ? void 0 : execution.ExecutionId) !== executionId || TERMINAL_STATUSES$1.indexOf(execution == null ? void 0 : execution.Status) === -1) {
1577
+ fail(sdkError$1("AGENT_WATCH_INVALID_EVENT", "The host reported something other than a finished run."));
1578
+ return;
1579
+ }
1580
+ end();
1581
+ notify$1(onComplete, execution);
1582
+ };
1583
+ this.activeWatches += 1;
1584
+ globalInstances[this._id] = this;
1585
+ this._addEventListener(eventName, listener);
1586
+ registration = this._postMessageBounded(
1587
+ LISTENER_CMDS.CUSTOM_AGENT_WATCH_EXECUTION,
1588
+ { id: this._id, agentId: this.agentId, executionId, watchId, eventName },
1589
+ {
1590
+ timeoutMs: WATCH_ACK_TIMEOUT_MS$1,
1591
+ timeoutError: sdkError$1("AGENT_HOST_UNSUPPORTED", "The host did not start observing the Agent run."),
1592
+ sendError: NOT_SENT$1
1593
+ }
1594
+ );
1595
+ registration.promise.then(
1596
+ (acknowledged) => {
1597
+ if (settled)
1598
+ return;
1599
+ if (acknowledged !== true) {
1600
+ fail(sdkError$1("AGENT_HOST_UNSUPPORTED", "The host did not start observing the Agent run."));
1601
+ return;
1602
+ }
1603
+ deadline = setTimeout(
1604
+ () => fail(sdkError$1("AGENT_OBSERVATION_STOPPED", "Stopped checking the Agent run; read it again later.")),
1605
+ WATCH_DEADLINE_MS$1
1606
+ );
1607
+ },
1608
+ (error) => fail(error)
1609
+ );
1610
+ return () => {
1611
+ if (settled)
1612
+ return;
1613
+ end();
1614
+ tellHostToStop();
1615
+ };
1616
+ }
1617
+ }
1618
+ const REPORT_FLOW_TYPES = ["Form", "Process", "Case"];
1619
+ class Report extends BaseSDK {
1620
+ constructor(flowType, flowId, reportId) {
1621
+ super();
1622
+ this._flowType = flowType;
1623
+ this._flowId = flowId;
1624
+ this._id = reportId;
1625
+ }
1626
+ getData(options) {
1627
+ return this._send(LISTENER_CMDS.REPORT_GET_DATA, {
1628
+ pageNumber: (options == null ? void 0 : options.pageNumber) || 1,
1629
+ pageSize: (options == null ? void 0 : options.pageSize) || 50,
1630
+ payload: (options == null ? void 0 : options.payload) || {}
1631
+ });
1632
+ }
1633
+ getCount(options) {
1634
+ return this._send(LISTENER_CMDS.REPORT_GET_COUNT, { payload: (options == null ? void 0 : options.payload) || {} });
1635
+ }
1636
+ getFields() {
1637
+ return this._send(LISTENER_CMDS.REPORT_GET_FIELDS, {});
1638
+ }
1639
+ _send(command, args) {
1640
+ const missing = requireFieldsAsync([
1641
+ { value: this._flowId, name: "flowId" },
1642
+ { value: this._id, name: "reportId" }
1643
+ ]);
1644
+ if (missing)
1645
+ return missing;
1646
+ if (REPORT_FLOW_TYPES.indexOf(this._flowType) === -1) {
1647
+ return Promise.reject({
1648
+ message: `flowType must be one of ${REPORT_FLOW_TYPES.join(", ")}`
1649
+ });
1650
+ }
1651
+ return this._postMessageAsync(command, {
1652
+ flowType: this._flowType,
1653
+ flowId: this._flowId,
1654
+ reportId: this._id,
1655
+ ...args
1656
+ });
1657
+ }
1658
+ }
1577
1659
  const READ_TIMEOUT_MS = 3e4;
1578
1660
  const RUN_TIMEOUT_MS = 45e3;
1579
1661
  const WATCH_ACK_TIMEOUT_MS = 6e4;
@@ -1724,6 +1806,9 @@ class Application extends BaseSDK {
1724
1806
  getAgent(agentId) {
1725
1807
  return new Agent(agentId);
1726
1808
  }
1809
+ getReport(flowType, flowId, reportId) {
1810
+ return new Report(flowType, flowId, reportId);
1811
+ }
1727
1812
  getDataform(flowId) {
1728
1813
  return new Dataform(flowId);
1729
1814
  }
@@ -1743,6 +1828,17 @@ class Application extends BaseSDK {
1743
1828
  });
1744
1829
  }
1745
1830
  }
1831
+ class CustomComponentApplication extends Application {
1832
+ getDataform(flowId) {
1833
+ return new CustomComponentDataform(flowId);
1834
+ }
1835
+ getBoard(flowId) {
1836
+ return new CustomComponentBoard(flowId);
1837
+ }
1838
+ getProcess(flowId) {
1839
+ return new CustomComponentProcess(flowId);
1840
+ }
1841
+ }
1746
1842
  class CustomComponentSDK extends BaseSDK {
1747
1843
  constructor() {
1748
1844
  super();
@@ -1761,7 +1857,7 @@ class CustomComponentSDK extends BaseSDK {
1761
1857
  {},
1762
1858
  true,
1763
1859
  (data) => {
1764
- this.app = new Application(data, true);
1860
+ this.app = new CustomComponentApplication(data, true);
1765
1861
  this.page = new Page(data, true);
1766
1862
  this.context = new CustomComponent(data.componentId);
1767
1863
  this.client = new Client();