crafter-kit 1.0.4 → 1.0.6

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
@@ -1,3 +1,16 @@
1
+ type ApiResponse<T> = {
2
+ data: T;
3
+ } | {
4
+ error: string;
5
+ };
6
+ type CreateRoomResponse = ApiResponse<CreateRoomData>;
7
+ interface CreateRoomRequest {
8
+ filterChat?: Boolean;
9
+ }
10
+ interface CreateRoomData {
11
+ roomId: string;
12
+ }
13
+ declare function createRoom(data: CreateRoomRequest): Promise<CreateRoomResponse>;
1
14
  declare function add(a: number, b: number): number;
2
15
 
3
- export { add };
16
+ export { type CreateRoomData, type CreateRoomRequest, type CreateRoomResponse, add, createRoom };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,16 @@
1
+ type ApiResponse<T> = {
2
+ data: T;
3
+ } | {
4
+ error: string;
5
+ };
6
+ type CreateRoomResponse = ApiResponse<CreateRoomData>;
7
+ interface CreateRoomRequest {
8
+ filterChat?: Boolean;
9
+ }
10
+ interface CreateRoomData {
11
+ roomId: string;
12
+ }
13
+ declare function createRoom(data: CreateRoomRequest): Promise<CreateRoomResponse>;
1
14
  declare function add(a: number, b: number): number;
2
15
 
3
- export { add };
16
+ export { type CreateRoomData, type CreateRoomRequest, type CreateRoomResponse, add, createRoom };
package/dist/index.js CHANGED
@@ -20,13 +20,30 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- add: () => add
23
+ add: () => add,
24
+ createRoom: () => createRoom
24
25
  });
25
26
  module.exports = __toCommonJS(index_exports);
27
+ var BASE_URL = "http://localhost:3000";
28
+ async function createRoom(data) {
29
+ const response = await fetch(`${BASE_URL}/createRoom`, {
30
+ method: "POST",
31
+ headers: {
32
+ "Content-Type": "application/json"
33
+ },
34
+ body: JSON.stringify(data)
35
+ });
36
+ if (!response.ok) {
37
+ const errorText = await response.text();
38
+ throw new Error(`Create room failed: ${errorText}`);
39
+ }
40
+ return response.json();
41
+ }
26
42
  function add(a, b) {
27
43
  return a + b;
28
44
  }
29
45
  // Annotate the CommonJS export names for ESM import in node:
30
46
  0 && (module.exports = {
31
- add
47
+ add,
48
+ createRoom
32
49
  });
package/dist/index.mjs CHANGED
@@ -1,7 +1,23 @@
1
1
  // src/index.ts
2
+ var BASE_URL = "http://localhost:3000";
3
+ async function createRoom(data) {
4
+ const response = await fetch(`${BASE_URL}/createRoom`, {
5
+ method: "POST",
6
+ headers: {
7
+ "Content-Type": "application/json"
8
+ },
9
+ body: JSON.stringify(data)
10
+ });
11
+ if (!response.ok) {
12
+ const errorText = await response.text();
13
+ throw new Error(`Create room failed: ${errorText}`);
14
+ }
15
+ return response.json();
16
+ }
2
17
  function add(a, b) {
3
18
  return a + b;
4
19
  }
5
20
  export {
6
- add
21
+ add,
22
+ createRoom
7
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crafter-kit",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",