@workadventure/room-api-client 1.31.6 → 1.32.0

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.
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.11.6
3
+ // protoc-gen-ts_proto v2.11.8
4
4
  // protoc v3.19.1
5
5
  // source: google/protobuf/empty.proto
6
6
  /* eslint-disable */
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.11.6
3
+ // protoc-gen-ts_proto v2.11.8
4
4
  // protoc v3.19.1
5
5
  // source: google/protobuf/struct.proto
6
6
  /* eslint-disable */
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.11.6
3
+ // protoc-gen-ts_proto v2.11.8
4
4
  // protoc v3.19.1
5
5
  // source: room-api.proto
6
6
  /* eslint-disable */
@@ -11,14 +11,17 @@ const eventName = "my-event";
11
11
  async function init() {
12
12
  // Send an event in 5 seconds
13
13
  setTimeout(() => {
14
- console.info("Sending event: { foo: \"Default Value\" }");
15
- client.broadcastEvent({
14
+ console.info('Sending event: { foo: "Default Value" }');
15
+ client
16
+ .broadcastEvent({
16
17
  name: eventName,
17
18
  room: roomUrl,
18
19
  data: { foo: "Default Value" },
19
- }).then(() => {
20
- console.info("Event sent: { foo: \"Default Value\" }");
21
- }).catch((e) => {
20
+ })
21
+ .then(() => {
22
+ console.info('Event sent: { foo: "Default Value" }');
23
+ })
24
+ .catch((e) => {
22
25
  console.error("Error sending event:", e);
23
26
  });
24
27
  }, 1000);
@@ -34,4 +37,4 @@ async function init() {
34
37
  break;
35
38
  }
36
39
  }
37
- init().catch(e => console.error(e));
40
+ init().catch((e) => console.error(e));
@@ -24,13 +24,16 @@ async function init() {
24
24
  console.log("Value read:", Value.unwrap(value));
25
25
  // Save a variable in 5sec
26
26
  setTimeout(() => {
27
- client.saveVariable({
27
+ client
28
+ .saveVariable({
28
29
  name: variableName,
29
30
  room: roomUrl,
30
31
  value: "New Value",
31
- }).then(() => {
32
+ })
33
+ .then(() => {
32
34
  console.log("Value saved: New Value");
33
- }).catch(e => console.error(e));
35
+ })
36
+ .catch((e) => console.error(e));
34
37
  }, 5000);
35
38
  // Listen a variable
36
39
  const listenVariable = client.listenVariable({
@@ -43,4 +46,4 @@ async function init() {
43
46
  break;
44
47
  }
45
48
  }
46
- init().catch(e => console.error(e));
49
+ init().catch((e) => console.error(e));
package/dist/index.js CHANGED
@@ -1,12 +1,16 @@
1
1
  export * from "./compiled_proto/room-api";
2
- import { ChannelCredentials, createChannel, createClient, Metadata } from "nice-grpc";
2
+ import { ChannelCredentials, createChannel, createClient, Metadata, } from "nice-grpc";
3
3
  import { RoomApiDefinition } from "./compiled_proto/room-api";
4
4
  export const createRoomApiClient = (apiKey, host = "room-api.workadventu.re", port = 443) => {
5
- const channel = createChannel(`${host}:${port}`, port === 443 || host.startsWith("https://") ? ChannelCredentials.createSsl() : ChannelCredentials.createInsecure());
5
+ const channel = createChannel(`${host}:${port}`, port === 443 || host.startsWith("https://")
6
+ ? ChannelCredentials.createSsl(undefined, undefined, undefined, process.env.NODE_TLS_REJECT_UNAUTHORIZED === "0"
7
+ ? { rejectUnauthorized: false }
8
+ : undefined)
9
+ : ChannelCredentials.createInsecure());
6
10
  const client = createClient(RoomApiDefinition, channel, {
7
11
  "*": {
8
12
  metadata: new Metadata({ "X-API-Key": apiKey }),
9
- }
13
+ },
10
14
  });
11
15
  return client;
12
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workadventure/room-api-client",
3
- "version": "v1.31.6",
3
+ "version": "v1.32.0",
4
4
  "description": "Workadventure Room Api Client",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -36,21 +36,21 @@
36
36
  },
37
37
  "homepage": "https://github.com/thecodingmachine/workadventure/tree/master/libs/room-api-clients/room-api-client-js#readme",
38
38
  "dependencies": {
39
- "@bufbuild/protobuf": "^2.2.2",
40
- "@grpc/grpc-js": "1.8.22",
41
- "long": "^5.2.1",
42
- "nice-grpc": "^2.1.3"
39
+ "@bufbuild/protobuf": "^2.12.0",
40
+ "@grpc/grpc-js": "1.14.4",
41
+ "long": "^5.3.2",
42
+ "nice-grpc": "^2.1.16"
43
43
  },
44
44
  "devDependencies": {
45
- "@types/node": "^18.15.5",
45
+ "@types/node": "^25.9.1",
46
46
  "@workadventure/eslint-config": "file:../../eslint-config",
47
- "eslint": "^9.35.0",
48
- "grpc-tools": "^1.12.4",
49
- "lint-staged": "^13.2.0",
50
- "prettier": "^2.8.6",
51
- "ts-proto": "^2.4.2",
52
- "tsx": "^4.7.1",
53
- "typescript": "^5.8.3"
47
+ "eslint": "^10.4.0",
48
+ "grpc-tools": "^1.13.1",
49
+ "lint-staged": "^17.0.5",
50
+ "prettier": "^3.8.3",
51
+ "ts-proto": "^2.11.8",
52
+ "tsx": "^4.22.3",
53
+ "typescript": "^5.9.3"
54
54
  },
55
55
  "lint-staged": {
56
56
  "*.{js,ts}": [