@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.d.cts CHANGED
@@ -1355,6 +1355,10 @@ declare class SuperatomClient {
1355
1355
  * Get current reconnection attempts
1356
1356
  */
1357
1357
  getReconnectAttempts(): number;
1358
+ /**
1359
+ * Get client type
1360
+ */
1361
+ get type(): string;
1358
1362
  /**
1359
1363
  * Send a message and wait for response with timeout (alias for sendWithResponse)
1360
1364
  */
package/dist/index.d.ts CHANGED
@@ -1355,6 +1355,10 @@ declare class SuperatomClient {
1355
1355
  * Get current reconnection attempts
1356
1356
  */
1357
1357
  getReconnectAttempts(): number;
1358
+ /**
1359
+ * Get client type
1360
+ */
1361
+ get type(): string;
1358
1362
  /**
1359
1363
  * Send a message and wait for response with timeout (alias for sendWithResponse)
1360
1364
  */
package/dist/index.js CHANGED
@@ -591,7 +591,7 @@ async function sendAuthLoginRequest(client, loginDataBase64, timeout) {
591
591
  id: messageId,
592
592
  type: "AUTH_LOGIN_REQ",
593
593
  from: {
594
- type: "runtime"
594
+ type: client.type
595
595
  },
596
596
  to: {
597
597
  type: "data-agent"
@@ -601,6 +601,7 @@ async function sendAuthLoginRequest(client, loginDataBase64, timeout) {
601
601
  }
602
602
  });
603
603
  const response = await client.sendWithResponse(message, timeout);
604
+ console.log("sdk auth login response", response);
604
605
  return response;
605
606
  }
606
607
  async function sendAuthVerifyRequest(client, token, timeout) {
@@ -609,7 +610,7 @@ async function sendAuthVerifyRequest(client, token, timeout) {
609
610
  id: messageId,
610
611
  type: "AUTH_VERIFY_REQ",
611
612
  from: {
612
- type: "runtime"
613
+ type: client.type
613
614
  },
614
615
  to: {
615
616
  type: "data-agent"
@@ -629,7 +630,7 @@ async function sendUserPromptRequest(client, prompt, threadId, uiBlockId, timeou
629
630
  id: messageId,
630
631
  type: "USER_PROMPT_REQ",
631
632
  from: {
632
- type: "runtime"
633
+ type: client.type
633
634
  },
634
635
  to: {
635
636
  type: "data-agent"
@@ -654,7 +655,7 @@ async function sendUserPromptSuggestionsRequest(client, prompt, limit = 5, timeo
654
655
  id: messageId,
655
656
  type: "USER_PROMPT_SUGGESTIONS_REQ",
656
657
  from: {
657
- type: "runtime"
658
+ type: client.type
658
659
  },
659
660
  to: {
660
661
  type: "data-agent"
@@ -674,7 +675,7 @@ async function requestBundle(client, options) {
674
675
  const message = BundleRequestMessageSchema.parse({
675
676
  id: messageId,
676
677
  type: "BUNDLE_REQ",
677
- from: { type: "runtime" },
678
+ from: { type: client.type },
678
679
  to: { type: "data-agent" },
679
680
  payload: {}
680
681
  });
@@ -722,7 +723,7 @@ async function requestData(client, options) {
722
723
  const message = DataRequestMessageSchema.parse({
723
724
  id: messageId,
724
725
  type: "DATA_REQ",
725
- from: { type: "runtime" },
726
+ from: { type: client.type },
726
727
  to: { type: "data-agent" },
727
728
  payload: {
728
729
  collection: options.collection,
@@ -764,7 +765,7 @@ async function sendComponents(client, components) {
764
765
  id: messageId,
765
766
  type: "COMPONENT_LIST_RES",
766
767
  from: {
767
- type: "runtime"
768
+ type: client.type
768
769
  },
769
770
  to: {
770
771
  type: "data-agent"
@@ -782,7 +783,7 @@ async function createUser(client, username, password, timeout) {
782
783
  const message = UsersRequestMessageSchema.parse({
783
784
  id: messageId,
784
785
  type: "USERS",
785
- from: { type: "admin" },
786
+ from: { type: client.type },
786
787
  to: { type: "data-agent" },
787
788
  payload: {
788
789
  operation: "create",
@@ -806,7 +807,7 @@ async function updateUser(client, username, password, timeout) {
806
807
  const message = UsersRequestMessageSchema.parse({
807
808
  id: messageId,
808
809
  type: "USERS",
809
- from: { type: "admin" },
810
+ from: { type: client.type },
810
811
  to: { type: "data-agent" },
811
812
  payload: {
812
813
  operation: "update",
@@ -830,7 +831,7 @@ async function deleteUser(client, username, timeout) {
830
831
  const message = UsersRequestMessageSchema.parse({
831
832
  id: messageId,
832
833
  type: "USERS",
833
- from: { type: "admin" },
834
+ from: { type: client.type },
834
835
  to: { type: "data-agent" },
835
836
  payload: {
836
837
  operation: "delete",
@@ -853,7 +854,7 @@ async function getAllUsers(client, timeout) {
853
854
  const message = UsersRequestMessageSchema.parse({
854
855
  id: messageId,
855
856
  type: "USERS",
856
- from: { type: "admin" },
857
+ from: { type: client.type },
857
858
  to: { type: "data-agent" },
858
859
  payload: {
859
860
  operation: "getAll"
@@ -874,7 +875,7 @@ async function getUser(client, username, timeout) {
874
875
  const message = UsersRequestMessageSchema.parse({
875
876
  id: messageId,
876
877
  type: "USERS",
877
- from: { type: "admin" },
878
+ from: { type: client.type },
878
879
  to: { type: "data-agent" },
879
880
  payload: {
880
881
  operation: "getOne",
@@ -899,7 +900,7 @@ async function createDashboard(client, dashboardId, dashboard, timeout) {
899
900
  const message = DashboardsRequestMessageSchema.parse({
900
901
  id: messageId,
901
902
  type: "DASHBOARDS",
902
- from: { type: "admin" },
903
+ from: { type: client.type },
903
904
  to: { type: "data-agent" },
904
905
  payload: {
905
906
  operation: "create",
@@ -924,7 +925,7 @@ async function updateDashboard(client, dashboardId, dashboard, timeout) {
924
925
  const message = DashboardsRequestMessageSchema.parse({
925
926
  id: messageId,
926
927
  type: "DASHBOARDS",
927
- from: { type: "admin" },
928
+ from: { type: client.type },
928
929
  to: { type: "data-agent" },
929
930
  payload: {
930
931
  operation: "update",
@@ -949,7 +950,7 @@ async function deleteDashboard(client, dashboardId, timeout) {
949
950
  const message = DashboardsRequestMessageSchema.parse({
950
951
  id: messageId,
951
952
  type: "DASHBOARDS",
952
- from: { type: "admin" },
953
+ from: { type: client.type },
953
954
  to: { type: "data-agent" },
954
955
  payload: {
955
956
  operation: "delete",
@@ -972,7 +973,7 @@ async function getAllDashboards(client, timeout) {
972
973
  const message = DashboardsRequestMessageSchema.parse({
973
974
  id: messageId,
974
975
  type: "DASHBOARDS",
975
- from: { type: "admin" },
976
+ from: { type: client.type },
976
977
  to: { type: "data-agent" },
977
978
  payload: {
978
979
  operation: "getAll"
@@ -993,7 +994,7 @@ async function getDashboard(client, dashboardId, timeout) {
993
994
  const message = DashboardsRequestMessageSchema.parse({
994
995
  id: messageId,
995
996
  type: "DASHBOARDS",
996
- from: { type: "admin" },
997
+ from: { type: client.type },
997
998
  to: { type: "data-agent" },
998
999
  payload: {
999
1000
  operation: "getOne",
@@ -1019,7 +1020,7 @@ async function createReport(client, reportId, report, timeout) {
1019
1020
  const message = ReportsRequestMessageSchema.parse({
1020
1021
  id: messageId,
1021
1022
  type: "REPORTS",
1022
- from: { type: "admin" },
1023
+ from: { type: client.type },
1023
1024
  to: { type: "data-agent" },
1024
1025
  payload: {
1025
1026
  operation: "create",
@@ -1044,7 +1045,7 @@ async function updateReport(client, reportId, report, timeout) {
1044
1045
  const message = ReportsRequestMessageSchema.parse({
1045
1046
  id: messageId,
1046
1047
  type: "REPORTS",
1047
- from: { type: "admin" },
1048
+ from: { type: client.type },
1048
1049
  to: { type: "data-agent" },
1049
1050
  payload: {
1050
1051
  operation: "update",
@@ -1069,7 +1070,7 @@ async function deleteReport(client, reportId, timeout) {
1069
1070
  const message = ReportsRequestMessageSchema.parse({
1070
1071
  id: messageId,
1071
1072
  type: "REPORTS",
1072
- from: { type: "admin" },
1073
+ from: { type: client.type },
1073
1074
  to: { type: "data-agent" },
1074
1075
  payload: {
1075
1076
  operation: "delete",
@@ -1092,7 +1093,7 @@ async function getAllReports(client, timeout) {
1092
1093
  const message = ReportsRequestMessageSchema.parse({
1093
1094
  id: messageId,
1094
1095
  type: "REPORTS",
1095
- from: { type: "admin" },
1096
+ from: { type: client.type },
1096
1097
  to: { type: "data-agent" },
1097
1098
  payload: {
1098
1099
  operation: "getAll"
@@ -1113,7 +1114,7 @@ async function getReport(client, reportId, timeout) {
1113
1114
  const message = ReportsRequestMessageSchema.parse({
1114
1115
  id: messageId,
1115
1116
  type: "REPORTS",
1116
- from: { type: "admin" },
1117
+ from: { type: client.type },
1117
1118
  to: { type: "data-agent" },
1118
1119
  payload: {
1119
1120
  operation: "getOne",
@@ -1139,7 +1140,7 @@ async function getActions(client, options) {
1139
1140
  const message = ActionsRequestMessageSchema.parse({
1140
1141
  id: messageId,
1141
1142
  type: "ACTIONS",
1142
- from: { type: "runtime" },
1143
+ from: { type: client.type },
1143
1144
  to: { type: "data-agent" },
1144
1145
  payload: {
1145
1146
  SA_RUNTIME: options.SA_RUNTIME
@@ -1327,7 +1328,7 @@ var SuperatomClient = class {
1327
1328
  }
1328
1329
  const fullMessage = {
1329
1330
  ...message,
1330
- from: message.from || { type: "runtime" }
1331
+ from: message.from || { type: this.config.type }
1331
1332
  };
1332
1333
  try {
1333
1334
  this.socket.send(JSON.stringify(fullMessage));
@@ -1405,6 +1406,12 @@ var SuperatomClient = class {
1405
1406
  getReconnectAttempts() {
1406
1407
  return this.reconnectAttempts;
1407
1408
  }
1409
+ /**
1410
+ * Get client type
1411
+ */
1412
+ get type() {
1413
+ return this.config.type;
1414
+ }
1408
1415
  /**
1409
1416
  * Send a message and wait for response with timeout (alias for sendWithResponse)
1410
1417
  */