@4players/odin-common 1.6.1 → 1.7.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.
- package/CHANGELOG.md +6 -0
- package/lib/cjs/plugin/api.js +2 -0
- package/lib/cjs/rpc/commands.js +26 -26
- package/lib/cjs/rpc/notifications.js +3 -3
- package/lib/esm/plugin/api.js +1 -1
- package/lib/esm/rpc/commands.js +1 -1
- package/lib/esm/rpc/notifications.js +2 -2
- package/lib/plugin/api.d.ts +1 -0
- package/lib/rpc/commands.d.ts +2 -1
- package/lib/rpc/notifications.d.ts +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/cjs/plugin/api.js
CHANGED
package/lib/cjs/rpc/commands.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RoomCommandsRpc = exports.MainCommandsRpc = void 0;
|
|
4
|
-
const
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
5
|
const serialization_1 = require("../schema/serialization");
|
|
6
6
|
const room_1 = require("../schema/room");
|
|
7
7
|
const peer_1 = require("../schema/peer");
|
|
@@ -9,72 +9,72 @@ const media_1 = require("../schema/media");
|
|
|
9
9
|
const webrtc_1 = require("../schema/webrtc");
|
|
10
10
|
exports.MainCommandsRpc = {
|
|
11
11
|
JoinRoom: {
|
|
12
|
-
request: z.object({
|
|
13
|
-
token: z.string(),
|
|
12
|
+
request: zod_1.z.object({
|
|
13
|
+
token: zod_1.z.string(),
|
|
14
14
|
room_id: room_1.RoomIdSchema,
|
|
15
15
|
user_data: serialization_1.ByteArraySchema,
|
|
16
16
|
position: peer_1.PeerPositionSchema,
|
|
17
17
|
}),
|
|
18
|
-
response: z.object({
|
|
18
|
+
response: zod_1.z.object({
|
|
19
19
|
peer_id: peer_1.PeerIdSchema,
|
|
20
|
-
stream_id: z.optional(z.number()),
|
|
21
|
-
token: z.optional(z.string()),
|
|
20
|
+
stream_id: zod_1.z.optional(zod_1.z.number()),
|
|
21
|
+
token: zod_1.z.optional(zod_1.z.string()),
|
|
22
22
|
}),
|
|
23
23
|
},
|
|
24
24
|
WebRtcUpdate: {
|
|
25
25
|
request: webrtc_1.WebRtcUpdateSchema,
|
|
26
|
-
response: z.null(),
|
|
26
|
+
response: zod_1.z.null(),
|
|
27
27
|
},
|
|
28
28
|
RequestReconnectToken: {
|
|
29
|
-
request: z.object({ peer_id: z.optional(peer_1.PeerIdSchema) }),
|
|
30
|
-
response: z.string(),
|
|
29
|
+
request: zod_1.z.object({ peer_id: zod_1.z.optional(peer_1.PeerIdSchema) }),
|
|
30
|
+
response: zod_1.z.string(),
|
|
31
31
|
},
|
|
32
32
|
Ping: {
|
|
33
|
-
request: z.object({}),
|
|
34
|
-
response: z.null(),
|
|
33
|
+
request: zod_1.z.object({}),
|
|
34
|
+
response: zod_1.z.null(),
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
37
|
exports.RoomCommandsRpc = {
|
|
38
38
|
UpdatePeer: {
|
|
39
|
-
request: z.object({ user_data: serialization_1.ByteArraySchema }),
|
|
40
|
-
response: z.null(),
|
|
39
|
+
request: zod_1.z.object({ user_data: serialization_1.ByteArraySchema }),
|
|
40
|
+
response: zod_1.z.null(),
|
|
41
41
|
},
|
|
42
42
|
StartMedia: {
|
|
43
|
-
request: z.object({
|
|
43
|
+
request: zod_1.z.object({
|
|
44
44
|
media_id: media_1.MediaIdSchema,
|
|
45
45
|
properties: media_1.MediaPropertiesSchema,
|
|
46
46
|
}),
|
|
47
|
-
response: z.null(),
|
|
47
|
+
response: zod_1.z.null(),
|
|
48
48
|
},
|
|
49
49
|
StopMedia: {
|
|
50
|
-
request: z.object({
|
|
50
|
+
request: zod_1.z.object({
|
|
51
51
|
media_id: media_1.MediaIdSchema,
|
|
52
52
|
}),
|
|
53
|
-
response: z.null(),
|
|
53
|
+
response: zod_1.z.null(),
|
|
54
54
|
},
|
|
55
55
|
PauseMedia: {
|
|
56
|
-
request: z.object({
|
|
56
|
+
request: zod_1.z.object({
|
|
57
57
|
media_id: media_1.MediaIdSchema,
|
|
58
58
|
}),
|
|
59
|
-
response: z.null(),
|
|
59
|
+
response: zod_1.z.null(),
|
|
60
60
|
},
|
|
61
61
|
ResumeMedia: {
|
|
62
|
-
request: z.object({
|
|
62
|
+
request: zod_1.z.object({
|
|
63
63
|
media_id: media_1.MediaIdSchema,
|
|
64
64
|
}),
|
|
65
|
-
response: z.null(),
|
|
65
|
+
response: zod_1.z.null(),
|
|
66
66
|
},
|
|
67
67
|
SetPeerPosition: {
|
|
68
|
-
request: z.object({
|
|
68
|
+
request: zod_1.z.object({
|
|
69
69
|
position: peer_1.PeerPositionSchema,
|
|
70
70
|
}),
|
|
71
|
-
response: z.null(),
|
|
71
|
+
response: zod_1.z.null(),
|
|
72
72
|
},
|
|
73
73
|
SendMessage: {
|
|
74
|
-
request: z.object({
|
|
75
|
-
target_peer_ids: z.optional(z.array(peer_1.PeerIdSchema)),
|
|
74
|
+
request: zod_1.z.object({
|
|
75
|
+
target_peer_ids: zod_1.z.optional(zod_1.z.array(peer_1.PeerIdSchema)),
|
|
76
76
|
message: serialization_1.ByteArraySchema,
|
|
77
77
|
}),
|
|
78
|
-
response: z.null(),
|
|
78
|
+
response: zod_1.z.null(),
|
|
79
79
|
},
|
|
80
80
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RoomNotificationsRpc = exports.
|
|
3
|
+
exports.RoomNotificationsRpc = exports.RoomNotificationSchema = exports.MainNotificationsRpc = exports.MainNotificationSchema = void 0;
|
|
4
4
|
const z = require("zod");
|
|
5
5
|
const room_1 = require("../schema/room");
|
|
6
6
|
const peer_1 = require("../schema/peer");
|
|
7
7
|
const message_1 = require("../schema/message");
|
|
8
8
|
const webrtc_1 = require("../schema/webrtc");
|
|
9
|
-
exports.
|
|
9
|
+
exports.MainNotificationSchema = z.object({
|
|
10
10
|
name: z.literal('WebRtcUpdate'),
|
|
11
11
|
properties: webrtc_1.WebRtcUpdateSchema,
|
|
12
12
|
});
|
|
13
13
|
exports.MainNotificationsRpc = {
|
|
14
14
|
WebRtcUpdate: webrtc_1.WebRtcUpdateSchema,
|
|
15
15
|
};
|
|
16
|
-
exports.
|
|
16
|
+
exports.RoomNotificationSchema = z.union([
|
|
17
17
|
z.object({
|
|
18
18
|
name: z.literal('RoomStatusChanged'),
|
|
19
19
|
properties: room_1.RoomStatusChangedSchema,
|
package/lib/esm/plugin/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const MinDBFS = -758.596;
|
package/lib/esm/rpc/commands.js
CHANGED
|
@@ -3,14 +3,14 @@ import { RoomStatusChangedSchema, RoomUpdatesSchema } from '../schema/room';
|
|
|
3
3
|
import { PeerUpdateSchema } from '../schema/peer';
|
|
4
4
|
import { MessageReceivedSchema } from '../schema/message';
|
|
5
5
|
import { WebRtcUpdateSchema } from '../schema/webrtc';
|
|
6
|
-
export const
|
|
6
|
+
export const MainNotificationSchema = z.object({
|
|
7
7
|
name: z.literal('WebRtcUpdate'),
|
|
8
8
|
properties: WebRtcUpdateSchema,
|
|
9
9
|
});
|
|
10
10
|
export const MainNotificationsRpc = {
|
|
11
11
|
WebRtcUpdate: WebRtcUpdateSchema,
|
|
12
12
|
};
|
|
13
|
-
export const
|
|
13
|
+
export const RoomNotificationSchema = z.union([
|
|
14
14
|
z.object({
|
|
15
15
|
name: z.literal('RoomStatusChanged'),
|
|
16
16
|
properties: RoomStatusChangedSchema,
|
package/lib/plugin/api.d.ts
CHANGED
package/lib/rpc/commands.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
2
|
export type Notifications = Record<string, z.ZodTypeAny>;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const MainNotificationSchema: z.ZodObject<{
|
|
4
4
|
name: z.ZodLiteral<"WebRtcUpdate">;
|
|
5
5
|
properties: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
6
6
|
kind: z.ZodLiteral<"Sdp">;
|
|
@@ -75,6 +75,7 @@ export declare const MainNotificationsSchema: z.ZodObject<{
|
|
|
75
75
|
};
|
|
76
76
|
name: "WebRtcUpdate";
|
|
77
77
|
}>;
|
|
78
|
+
export type MainNotification = z.infer<typeof MainNotificationSchema>;
|
|
78
79
|
export declare const MainNotificationsRpc: {
|
|
79
80
|
WebRtcUpdate: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
80
81
|
kind: z.ZodLiteral<"Sdp">;
|
|
@@ -118,7 +119,7 @@ export declare const MainNotificationsRpc: {
|
|
|
118
119
|
}>]>;
|
|
119
120
|
};
|
|
120
121
|
export type MainNotifications = typeof MainNotificationsRpc;
|
|
121
|
-
export declare const
|
|
122
|
+
export declare const RoomNotificationSchema: z.ZodUnion<[z.ZodObject<{
|
|
122
123
|
name: z.ZodLiteral<"RoomStatusChanged">;
|
|
123
124
|
properties: z.ZodObject<{
|
|
124
125
|
status: z.ZodEnum<["Joining", "Joined", "Closed"]>;
|
|
@@ -1098,6 +1099,7 @@ export declare const RoomNotificationsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
1098
1099
|
};
|
|
1099
1100
|
name: "MessageReceived";
|
|
1100
1101
|
}>]>;
|
|
1102
|
+
export type RoomNotification = z.infer<typeof RoomNotificationSchema>;
|
|
1101
1103
|
export declare const RoomNotificationsRpc: {
|
|
1102
1104
|
RoomStatusChanged: z.ZodObject<{
|
|
1103
1105
|
status: z.ZodEnum<["Joining", "Joined", "Closed"]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@4players/odin-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
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",
|