@superatomai/sdk-web 0.0.6 → 0.0.7

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.cjs CHANGED
@@ -593,7 +593,7 @@ async function sendAuthLoginRequest(client, loginDataBase64, timeout) {
593
593
  id: messageId,
594
594
  type: "AUTH_LOGIN_REQ",
595
595
  from: {
596
- type: "runtime"
596
+ type: client.type
597
597
  },
598
598
  to: {
599
599
  type: "data-agent"
@@ -603,6 +603,7 @@ async function sendAuthLoginRequest(client, loginDataBase64, timeout) {
603
603
  }
604
604
  });
605
605
  const response = await client.sendWithResponse(message, timeout);
606
+ console.log("sdk auth login response", response);
606
607
  return response;
607
608
  }
608
609
  async function sendAuthVerifyRequest(client, token, timeout) {
@@ -611,7 +612,7 @@ async function sendAuthVerifyRequest(client, token, timeout) {
611
612
  id: messageId,
612
613
  type: "AUTH_VERIFY_REQ",
613
614
  from: {
614
- type: "runtime"
615
+ type: client.type
615
616
  },
616
617
  to: {
617
618
  type: "data-agent"
@@ -631,7 +632,7 @@ async function sendUserPromptRequest(client, prompt, threadId, uiBlockId, timeou
631
632
  id: messageId,
632
633
  type: "USER_PROMPT_REQ",
633
634
  from: {
634
- type: "runtime"
635
+ type: client.type
635
636
  },
636
637
  to: {
637
638
  type: "data-agent"
@@ -656,7 +657,7 @@ async function sendUserPromptSuggestionsRequest(client, prompt, limit = 5, timeo
656
657
  id: messageId,
657
658
  type: "USER_PROMPT_SUGGESTIONS_REQ",
658
659
  from: {
659
- type: "runtime"
660
+ type: client.type
660
661
  },
661
662
  to: {
662
663
  type: "data-agent"
@@ -676,7 +677,7 @@ async function requestBundle(client, options) {
676
677
  const message = BundleRequestMessageSchema.parse({
677
678
  id: messageId,
678
679
  type: "BUNDLE_REQ",
679
- from: { type: "runtime" },
680
+ from: { type: client.type },
680
681
  to: { type: "data-agent" },
681
682
  payload: {}
682
683
  });
@@ -724,7 +725,7 @@ async function requestData(client, options) {
724
725
  const message = DataRequestMessageSchema.parse({
725
726
  id: messageId,
726
727
  type: "DATA_REQ",
727
- from: { type: "runtime" },
728
+ from: { type: client.type },
728
729
  to: { type: "data-agent" },
729
730
  payload: {
730
731
  collection: options.collection,
@@ -766,7 +767,7 @@ async function sendComponents(client, components) {
766
767
  id: messageId,
767
768
  type: "COMPONENT_LIST_RES",
768
769
  from: {
769
- type: "runtime"
770
+ type: client.type
770
771
  },
771
772
  to: {
772
773
  type: "data-agent"
@@ -784,7 +785,7 @@ async function createUser(client, username, password, timeout) {
784
785
  const message = UsersRequestMessageSchema.parse({
785
786
  id: messageId,
786
787
  type: "USERS",
787
- from: { type: "admin" },
788
+ from: { type: client.type },
788
789
  to: { type: "data-agent" },
789
790
  payload: {
790
791
  operation: "create",
@@ -808,7 +809,7 @@ async function updateUser(client, username, password, timeout) {
808
809
  const message = UsersRequestMessageSchema.parse({
809
810
  id: messageId,
810
811
  type: "USERS",
811
- from: { type: "admin" },
812
+ from: { type: client.type },
812
813
  to: { type: "data-agent" },
813
814
  payload: {
814
815
  operation: "update",
@@ -832,7 +833,7 @@ async function deleteUser(client, username, timeout) {
832
833
  const message = UsersRequestMessageSchema.parse({
833
834
  id: messageId,
834
835
  type: "USERS",
835
- from: { type: "admin" },
836
+ from: { type: client.type },
836
837
  to: { type: "data-agent" },
837
838
  payload: {
838
839
  operation: "delete",
@@ -855,7 +856,7 @@ async function getAllUsers(client, timeout) {
855
856
  const message = UsersRequestMessageSchema.parse({
856
857
  id: messageId,
857
858
  type: "USERS",
858
- from: { type: "admin" },
859
+ from: { type: client.type },
859
860
  to: { type: "data-agent" },
860
861
  payload: {
861
862
  operation: "getAll"
@@ -876,7 +877,7 @@ async function getUser(client, username, timeout) {
876
877
  const message = UsersRequestMessageSchema.parse({
877
878
  id: messageId,
878
879
  type: "USERS",
879
- from: { type: "admin" },
880
+ from: { type: client.type },
880
881
  to: { type: "data-agent" },
881
882
  payload: {
882
883
  operation: "getOne",
@@ -901,7 +902,7 @@ async function createDashboard(client, dashboardId, dashboard, timeout) {
901
902
  const message = DashboardsRequestMessageSchema.parse({
902
903
  id: messageId,
903
904
  type: "DASHBOARDS",
904
- from: { type: "admin" },
905
+ from: { type: client.type },
905
906
  to: { type: "data-agent" },
906
907
  payload: {
907
908
  operation: "create",
@@ -926,7 +927,7 @@ async function updateDashboard(client, dashboardId, dashboard, timeout) {
926
927
  const message = DashboardsRequestMessageSchema.parse({
927
928
  id: messageId,
928
929
  type: "DASHBOARDS",
929
- from: { type: "admin" },
930
+ from: { type: client.type },
930
931
  to: { type: "data-agent" },
931
932
  payload: {
932
933
  operation: "update",
@@ -951,7 +952,7 @@ async function deleteDashboard(client, dashboardId, timeout) {
951
952
  const message = DashboardsRequestMessageSchema.parse({
952
953
  id: messageId,
953
954
  type: "DASHBOARDS",
954
- from: { type: "admin" },
955
+ from: { type: client.type },
955
956
  to: { type: "data-agent" },
956
957
  payload: {
957
958
  operation: "delete",
@@ -974,7 +975,7 @@ async function getAllDashboards(client, timeout) {
974
975
  const message = DashboardsRequestMessageSchema.parse({
975
976
  id: messageId,
976
977
  type: "DASHBOARDS",
977
- from: { type: "admin" },
978
+ from: { type: client.type },
978
979
  to: { type: "data-agent" },
979
980
  payload: {
980
981
  operation: "getAll"
@@ -995,7 +996,7 @@ async function getDashboard(client, dashboardId, timeout) {
995
996
  const message = DashboardsRequestMessageSchema.parse({
996
997
  id: messageId,
997
998
  type: "DASHBOARDS",
998
- from: { type: "admin" },
999
+ from: { type: client.type },
999
1000
  to: { type: "data-agent" },
1000
1001
  payload: {
1001
1002
  operation: "getOne",
@@ -1021,7 +1022,7 @@ async function createReport(client, reportId, report, timeout) {
1021
1022
  const message = ReportsRequestMessageSchema.parse({
1022
1023
  id: messageId,
1023
1024
  type: "REPORTS",
1024
- from: { type: "admin" },
1025
+ from: { type: client.type },
1025
1026
  to: { type: "data-agent" },
1026
1027
  payload: {
1027
1028
  operation: "create",
@@ -1046,7 +1047,7 @@ async function updateReport(client, reportId, report, timeout) {
1046
1047
  const message = ReportsRequestMessageSchema.parse({
1047
1048
  id: messageId,
1048
1049
  type: "REPORTS",
1049
- from: { type: "admin" },
1050
+ from: { type: client.type },
1050
1051
  to: { type: "data-agent" },
1051
1052
  payload: {
1052
1053
  operation: "update",
@@ -1071,7 +1072,7 @@ async function deleteReport(client, reportId, timeout) {
1071
1072
  const message = ReportsRequestMessageSchema.parse({
1072
1073
  id: messageId,
1073
1074
  type: "REPORTS",
1074
- from: { type: "admin" },
1075
+ from: { type: client.type },
1075
1076
  to: { type: "data-agent" },
1076
1077
  payload: {
1077
1078
  operation: "delete",
@@ -1094,7 +1095,7 @@ async function getAllReports(client, timeout) {
1094
1095
  const message = ReportsRequestMessageSchema.parse({
1095
1096
  id: messageId,
1096
1097
  type: "REPORTS",
1097
- from: { type: "admin" },
1098
+ from: { type: client.type },
1098
1099
  to: { type: "data-agent" },
1099
1100
  payload: {
1100
1101
  operation: "getAll"
@@ -1115,7 +1116,7 @@ async function getReport(client, reportId, timeout) {
1115
1116
  const message = ReportsRequestMessageSchema.parse({
1116
1117
  id: messageId,
1117
1118
  type: "REPORTS",
1118
- from: { type: "admin" },
1119
+ from: { type: client.type },
1119
1120
  to: { type: "data-agent" },
1120
1121
  payload: {
1121
1122
  operation: "getOne",
@@ -1141,7 +1142,7 @@ async function getActions(client, options) {
1141
1142
  const message = ActionsRequestMessageSchema.parse({
1142
1143
  id: messageId,
1143
1144
  type: "ACTIONS",
1144
- from: { type: "runtime" },
1145
+ from: { type: client.type },
1145
1146
  to: { type: "data-agent" },
1146
1147
  payload: {
1147
1148
  SA_RUNTIME: options.SA_RUNTIME
@@ -1329,7 +1330,7 @@ var SuperatomClient = class {
1329
1330
  }
1330
1331
  const fullMessage = {
1331
1332
  ...message,
1332
- from: message.from || { type: "runtime" }
1333
+ from: message.from || { type: this.config.type }
1333
1334
  };
1334
1335
  try {
1335
1336
  this.socket.send(JSON.stringify(fullMessage));
@@ -1407,6 +1408,12 @@ var SuperatomClient = class {
1407
1408
  getReconnectAttempts() {
1408
1409
  return this.reconnectAttempts;
1409
1410
  }
1411
+ /**
1412
+ * Get client type
1413
+ */
1414
+ get type() {
1415
+ return this.config.type;
1416
+ }
1410
1417
  /**
1411
1418
  * Send a message and wait for response with timeout (alias for sendWithResponse)
1412
1419
  */