crafter-kit 1.0.11 → 1.0.13

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.mts CHANGED
@@ -9,12 +9,12 @@ interface CreateRoomRequest {
9
9
  filterChat?: Boolean;
10
10
  }
11
11
  interface CreateRoomData {
12
- roomId: string;
12
+ roomID: string;
13
13
  }
14
14
  interface Message {
15
15
  id: string;
16
16
  senderID: string;
17
- destinationId: string;
17
+ destinationID: string;
18
18
  content: string;
19
19
  messageType: "DIRECT" | "GROUP";
20
20
  flagged: Boolean;
package/dist/index.d.ts CHANGED
@@ -9,12 +9,12 @@ interface CreateRoomRequest {
9
9
  filterChat?: Boolean;
10
10
  }
11
11
  interface CreateRoomData {
12
- roomId: string;
12
+ roomID: string;
13
13
  }
14
14
  interface Message {
15
15
  id: string;
16
16
  senderID: string;
17
- destinationId: string;
17
+ destinationID: string;
18
18
  content: string;
19
19
  messageType: "DIRECT" | "GROUP";
20
20
  flagged: Boolean;
package/dist/index.js CHANGED
@@ -26,8 +26,7 @@ __export(index_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(index_exports);
28
28
  var import_socket = require("socket.io-client");
29
- var SERVER_HTTP_URL = "http://localhost:3000";
30
- var SERVER_WS_URL = "ws://localhost:3000";
29
+ var SERVER_URL = "http://localhost:3000";
31
30
  function connectSocket(url) {
32
31
  return new Promise((resolve, reject) => {
33
32
  const socket = (0, import_socket.io)(url, {
@@ -51,13 +50,13 @@ var Chatter = class {
51
50
  this.onMessageCallbacks.set(sourceID, callback);
52
51
  }
53
52
  async connect() {
54
- this.socket = await connectSocket(SERVER_WS_URL);
53
+ this.socket = await connectSocket(SERVER_URL);
55
54
  this.socket.on("disconnect", () => {
56
55
  this.socket = null;
57
56
  });
58
57
  this.socket.on("receiveMessage", (msg) => {
59
58
  if (msg.messageType == "GROUP") {
60
- const msgCallback = this.onMessageCallbacks.get(msg.destinationId);
59
+ const msgCallback = this.onMessageCallbacks.get(msg.destinationID);
61
60
  if (msgCallback) msgCallback(msg);
62
61
  }
63
62
  });
@@ -101,7 +100,7 @@ var Chatter = class {
101
100
  }
102
101
  };
103
102
  async function createRoom(data) {
104
- const response = await fetch(`${SERVER_HTTP_URL}/api/chat/createRoom`, {
103
+ const response = await fetch(`${SERVER_URL}/api/chat/createRoom`, {
105
104
  method: "POST",
106
105
  headers: {
107
106
  "Content-Type": "application/json"
@@ -113,10 +112,10 @@ async function createRoom(data) {
113
112
  throw new Error(`Failed to create chat room: ${error.msg}`);
114
113
  }
115
114
  const responseData = await response.json();
116
- if (!responseData || !responseData.roomId) {
115
+ if (!responseData || !responseData.roomID) {
117
116
  throw new Error("Failed to create chat room: missing room ID");
118
117
  }
119
- return responseData.roomId;
118
+ return responseData.roomID;
120
119
  }
121
120
  function add(a, b) {
122
121
  return a + b;
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  // src/index.ts
2
2
  import { io } from "socket.io-client";
3
- var SERVER_HTTP_URL = "http://localhost:3000";
4
- var SERVER_WS_URL = "ws://localhost:3000";
3
+ var SERVER_URL = "http://localhost:3000";
5
4
  function connectSocket(url) {
6
5
  return new Promise((resolve, reject) => {
7
6
  const socket = io(url, {
@@ -25,13 +24,13 @@ var Chatter = class {
25
24
  this.onMessageCallbacks.set(sourceID, callback);
26
25
  }
27
26
  async connect() {
28
- this.socket = await connectSocket(SERVER_WS_URL);
27
+ this.socket = await connectSocket(SERVER_URL);
29
28
  this.socket.on("disconnect", () => {
30
29
  this.socket = null;
31
30
  });
32
31
  this.socket.on("receiveMessage", (msg) => {
33
32
  if (msg.messageType == "GROUP") {
34
- const msgCallback = this.onMessageCallbacks.get(msg.destinationId);
33
+ const msgCallback = this.onMessageCallbacks.get(msg.destinationID);
35
34
  if (msgCallback) msgCallback(msg);
36
35
  }
37
36
  });
@@ -75,7 +74,7 @@ var Chatter = class {
75
74
  }
76
75
  };
77
76
  async function createRoom(data) {
78
- const response = await fetch(`${SERVER_HTTP_URL}/api/chat/createRoom`, {
77
+ const response = await fetch(`${SERVER_URL}/api/chat/createRoom`, {
79
78
  method: "POST",
80
79
  headers: {
81
80
  "Content-Type": "application/json"
@@ -87,10 +86,10 @@ async function createRoom(data) {
87
86
  throw new Error(`Failed to create chat room: ${error.msg}`);
88
87
  }
89
88
  const responseData = await response.json();
90
- if (!responseData || !responseData.roomId) {
89
+ if (!responseData || !responseData.roomID) {
91
90
  throw new Error("Failed to create chat room: missing room ID");
92
91
  }
93
- return responseData.roomId;
92
+ return responseData.roomID;
94
93
  }
95
94
  function add(a, b) {
96
95
  return a + b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crafter-kit",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",