@4players/odin-common 2.4.0 → 2.4.2

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.
@@ -8,6 +8,12 @@ const peer_1 = require("../schema/peer");
8
8
  const media_1 = require("../schema/media");
9
9
  const webrtc_1 = require("../schema/webrtc");
10
10
  exports.MainCommandsRpc = {
11
+ Hello: {
12
+ request: zod_1.z.object({
13
+ stream: zod_1.z.literal('main'),
14
+ }),
15
+ response: zod_1.z.null(),
16
+ },
11
17
  JoinRoom: {
12
18
  request: zod_1.z.object({
13
19
  token: zod_1.z.string(),
@@ -35,6 +41,16 @@ exports.MainCommandsRpc = {
35
41
  },
36
42
  };
37
43
  exports.RoomCommandsRpc = {
44
+ Hello: {
45
+ request: zod_1.z.object({
46
+ stream: zod_1.z.literal('room'),
47
+ token: zod_1.z.string(),
48
+ room_id: zod_1.z.string(),
49
+ user_data: serialization_1.ByteArraySchema,
50
+ position: peer_1.PeerPositionSchema,
51
+ }),
52
+ response: zod_1.z.null(),
53
+ },
38
54
  UpdatePeer: {
39
55
  request: zod_1.z.object({ user_data: serialization_1.ByteArraySchema }),
40
56
  response: zod_1.z.null(),
@@ -5,6 +5,12 @@ import { PeerIdSchema, PeerPositionSchema } from '../schema/peer';
5
5
  import { MediaIdSchema, MediaPropertiesSchema } from '../schema/media';
6
6
  import { WebRtcUpdateSchema } from '../schema/webrtc';
7
7
  export const MainCommandsRpc = {
8
+ Hello: {
9
+ request: z.object({
10
+ stream: z.literal('main'),
11
+ }),
12
+ response: z.null(),
13
+ },
8
14
  JoinRoom: {
9
15
  request: z.object({
10
16
  token: z.string(),
@@ -32,6 +38,16 @@ export const MainCommandsRpc = {
32
38
  },
33
39
  };
34
40
  export const RoomCommandsRpc = {
41
+ Hello: {
42
+ request: z.object({
43
+ stream: z.literal('room'),
44
+ token: z.string(),
45
+ room_id: z.string(),
46
+ user_data: ByteArraySchema,
47
+ position: PeerPositionSchema,
48
+ }),
49
+ response: z.null(),
50
+ },
35
51
  UpdatePeer: {
36
52
  request: z.object({ user_data: ByteArraySchema }),
37
53
  response: z.null(),
@@ -3,8 +3,9 @@ export declare namespace Backend {
3
3
  type UID = string;
4
4
  type OnStatusChanged = (status: 'started' | 'stopped') => void;
5
5
  type OnEvent = (method: string, properties: unknown) => void;
6
+ type Version = '1';
6
7
  interface Plugin {
7
- readonly version: '1';
8
+ readonly version: Version;
8
9
  readonly playbackVolume: Volume;
9
10
  joinRoom(parameters: JoinRoomParameters): Room;
10
11
  createAudioPlayback(parameters: CreateAudioPlaybackParameters): Promise<AudioPlayback>;
@@ -5,6 +5,16 @@ export type Commands = Record<string, {
5
5
  response: z.ZodTypeAny;
6
6
  }>;
7
7
  export declare const MainCommandsRpc: {
8
+ Hello: {
9
+ request: z.ZodObject<{
10
+ stream: z.ZodLiteral<"main">;
11
+ }, "strip", z.ZodTypeAny, {
12
+ stream: "main";
13
+ }, {
14
+ stream: "main";
15
+ }>;
16
+ response: z.ZodNull;
17
+ };
8
18
  JoinRoom: {
9
19
  request: z.ZodObject<{
10
20
  token: z.ZodString;
@@ -96,6 +106,28 @@ export declare const MainCommandsRpc: {
96
106
  };
97
107
  export type MainCommands = typeof MainCommandsRpc;
98
108
  export declare const RoomCommandsRpc: {
109
+ Hello: {
110
+ request: z.ZodObject<{
111
+ stream: z.ZodLiteral<"room">;
112
+ token: z.ZodString;
113
+ room_id: z.ZodString;
114
+ user_data: z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>;
115
+ position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
116
+ }, "strip", z.ZodTypeAny, {
117
+ user_data: Uint8Array;
118
+ stream: "room";
119
+ token: string;
120
+ room_id: string;
121
+ position: [number, number, number] | [number, number];
122
+ }, {
123
+ user_data: Uint8Array;
124
+ stream: "room";
125
+ token: string;
126
+ room_id: string;
127
+ position: [number, number, number] | [number, number];
128
+ }>;
129
+ response: z.ZodNull;
130
+ };
99
131
  UpdatePeer: {
100
132
  request: z.ZodObject<{
101
133
  user_data: z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4players/odin-common",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "A collection of commonly used type definitions and utility functions across ODIN web projects",
5
5
  "author": "Josho Bleicker <josho.bleicker@4players.io> (https://www.4players.io)",
6
6
  "homepage": "https://www.4players.io",
@@ -43,4 +43,4 @@
43
43
  "testyts": "~1.5.0",
44
44
  "typescript": "~5.4.0"
45
45
  }
46
- }
46
+ }