@4players/odin-common 1.0.6 → 1.1.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +6 -2
  2. package/lib/cjs/index.js +23 -10
  3. package/lib/cjs/{streams → rpc}/commands.js +8 -8
  4. package/lib/cjs/{streams → rpc}/notifications.js +7 -7
  5. package/lib/cjs/utility/base64.js +30 -0
  6. package/lib/cjs/utility/bytearray.js +29 -0
  7. package/lib/cjs/utility/environment.js +12 -0
  8. package/lib/cjs/utility/iterable.js +11 -0
  9. package/lib/cjs/utility/json.js +7 -0
  10. package/lib/cjs/utility/result.js +29 -0
  11. package/lib/cjs/utility/rpc.js +39 -0
  12. package/lib/cjs/utility/selector.js +31 -0
  13. package/lib/cjs/utility/sleep.js +29 -0
  14. package/lib/cjs/utility/strand.js +48 -0
  15. package/lib/cjs/utility/url.js +28 -0
  16. package/lib/cjs/utility/validation.js +31 -0
  17. package/lib/cjs/utility/websocket.js +85 -0
  18. package/lib/esm/index.js +23 -10
  19. package/lib/esm/{streams → rpc}/commands.js +7 -7
  20. package/lib/esm/{streams → rpc}/notifications.js +6 -6
  21. package/lib/esm/utility/base64.js +25 -0
  22. package/lib/esm/utility/bytearray.js +24 -0
  23. package/lib/esm/utility/environment.js +7 -0
  24. package/lib/esm/utility/iterable.js +7 -0
  25. package/lib/esm/utility/json.js +3 -0
  26. package/lib/esm/utility/result.js +21 -0
  27. package/lib/esm/utility/rpc.js +32 -0
  28. package/lib/esm/utility/selector.js +27 -0
  29. package/lib/esm/utility/sleep.js +23 -0
  30. package/lib/esm/utility/strand.js +44 -0
  31. package/lib/esm/utility/url.js +23 -0
  32. package/lib/esm/utility/validation.js +21 -0
  33. package/lib/esm/utility/websocket.js +80 -0
  34. package/lib/index.d.ts +23 -0
  35. package/lib/rpc/commands.d.ts +9 -0
  36. package/lib/rpc/notifications.d.ts +6 -0
  37. package/lib/utility/base64.d.ts +3 -0
  38. package/lib/utility/base64.spec.d.ts +4 -0
  39. package/lib/utility/bytearray.d.ts +4 -0
  40. package/lib/utility/bytearray.spec.d.ts +4 -0
  41. package/lib/utility/environment.d.ts +2 -0
  42. package/lib/utility/environment.spec.d.ts +4 -0
  43. package/lib/utility/iterable.d.ts +1 -0
  44. package/lib/utility/iterable.spec.d.ts +4 -0
  45. package/lib/utility/json.d.ts +4 -0
  46. package/lib/utility/json.spec.d.ts +7 -0
  47. package/lib/utility/result.d.ts +17 -0
  48. package/lib/utility/rpc.d.ts +19 -0
  49. package/lib/utility/selector.d.ts +7 -0
  50. package/lib/utility/sleep.d.ts +4 -0
  51. package/lib/utility/strand.d.ts +6 -0
  52. package/lib/utility/url.d.ts +3 -0
  53. package/lib/utility/validation.d.ts +7 -0
  54. package/lib/utility/websocket.d.ts +7 -0
  55. package/lib/utility/websocket.spec.d.ts +6 -0
  56. package/package.json +16 -8
  57. package/testy.json +4 -0
  58. package/lib/types/index.d.ts +0 -10
  59. package/lib/types/streams/commands.d.ts +0 -218
  60. package/lib/types/streams/notifications.d.ts +0 -779
  61. /package/lib/cjs/{plugins → plugin}/api.js +0 -0
  62. /package/lib/cjs/{schemas → schema}/media.js +0 -0
  63. /package/lib/cjs/{schemas → schema}/message.js +0 -0
  64. /package/lib/cjs/{schemas → schema}/peer.js +0 -0
  65. /package/lib/cjs/{schemas → schema}/room.js +0 -0
  66. /package/lib/cjs/{schemas → schema}/serialization.js +0 -0
  67. /package/lib/cjs/{schemas → schema}/token.js +0 -0
  68. /package/lib/cjs/{schemas → schema}/webrtc.js +0 -0
  69. /package/lib/esm/{plugins → plugin}/api.js +0 -0
  70. /package/lib/esm/{schemas → schema}/media.js +0 -0
  71. /package/lib/esm/{schemas → schema}/message.js +0 -0
  72. /package/lib/esm/{schemas → schema}/peer.js +0 -0
  73. /package/lib/esm/{schemas → schema}/room.js +0 -0
  74. /package/lib/esm/{schemas → schema}/serialization.js +0 -0
  75. /package/lib/esm/{schemas → schema}/token.js +0 -0
  76. /package/lib/esm/{schemas → schema}/webrtc.js +0 -0
  77. /package/lib/{types/plugins → plugin}/api.d.ts +0 -0
  78. /package/lib/{types/schemas → schema}/media.d.ts +0 -0
  79. /package/lib/{types/schemas → schema}/message.d.ts +0 -0
  80. /package/lib/{types/schemas → schema}/peer.d.ts +0 -0
  81. /package/lib/{types/schemas → schema}/room.d.ts +0 -0
  82. /package/lib/{types/schemas → schema}/serialization.d.ts +0 -0
  83. /package/lib/{types/schemas → schema}/token.d.ts +0 -0
  84. /package/lib/{types/schemas → schema}/webrtc.d.ts +0 -0
@@ -1,218 +0,0 @@
1
- import * as z from 'zod';
2
- export declare const MainCommands: {
3
- JoinRoom: {
4
- request: z.ZodObject<{
5
- token: z.ZodString;
6
- room_id: z.ZodString;
7
- user_data: z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>;
8
- position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
9
- }, "strip", z.ZodTypeAny, {
10
- user_data: Uint8Array;
11
- token: string;
12
- room_id: string;
13
- position: [number, number, number] | [number, number];
14
- }, {
15
- user_data: Uint8Array;
16
- token: string;
17
- room_id: string;
18
- position: [number, number, number] | [number, number];
19
- }>;
20
- response: z.ZodObject<{
21
- peer_id: z.ZodNumber;
22
- stream_id: z.ZodOptional<z.ZodNumber>;
23
- token: z.ZodOptional<z.ZodString>;
24
- }, "strip", z.ZodTypeAny, {
25
- peer_id: number;
26
- stream_id?: number | undefined;
27
- token?: string | undefined;
28
- }, {
29
- peer_id: number;
30
- stream_id?: number | undefined;
31
- token?: string | undefined;
32
- }>;
33
- };
34
- WebRtcUpdate: {
35
- request: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
36
- kind: z.ZodLiteral<"Sdp">;
37
- type: z.ZodEnum<["Answer", "Offer"]>;
38
- sdp: z.ZodString;
39
- media_map: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodString], null>, "many">;
40
- }, "strip", z.ZodTypeAny, {
41
- type: "Answer" | "Offer";
42
- kind: "Sdp";
43
- sdp: string;
44
- media_map: [number, string][];
45
- }, {
46
- type: "Answer" | "Offer";
47
- kind: "Sdp";
48
- sdp: string;
49
- media_map: [number, string][];
50
- }>, z.ZodObject<{
51
- kind: z.ZodLiteral<"Trickle">;
52
- candidate: z.ZodString;
53
- spd_mid: z.ZodOptional<z.ZodString>;
54
- spd_mline_index: z.ZodOptional<z.ZodNumber>;
55
- username_fragment: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
56
- }, "strip", z.ZodTypeAny, {
57
- kind: "Trickle";
58
- candidate: string;
59
- spd_mid?: string | undefined;
60
- spd_mline_index?: number | undefined;
61
- username_fragment?: string | null | undefined;
62
- }, {
63
- kind: "Trickle";
64
- candidate: string;
65
- spd_mid?: string | undefined;
66
- spd_mline_index?: number | undefined;
67
- username_fragment?: string | null | undefined;
68
- }>, z.ZodObject<{
69
- kind: z.ZodLiteral<"TrickleFinished">;
70
- }, "strip", z.ZodTypeAny, {
71
- kind: "TrickleFinished";
72
- }, {
73
- kind: "TrickleFinished";
74
- }>]>;
75
- response: z.ZodNull;
76
- };
77
- RequestReconnectToken: {
78
- request: z.ZodObject<{
79
- peer_id: z.ZodOptional<z.ZodNumber>;
80
- }, "strip", z.ZodTypeAny, {
81
- peer_id?: number | undefined;
82
- }, {
83
- peer_id?: number | undefined;
84
- }>;
85
- response: z.ZodString;
86
- };
87
- Ping: {
88
- request: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
89
- response: z.ZodNull;
90
- };
91
- };
92
- export declare const RoomCommands: {
93
- UpdatePeer: {
94
- request: z.ZodObject<{
95
- user_data: z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>;
96
- }, "strip", z.ZodTypeAny, {
97
- user_data: Uint8Array;
98
- }, {
99
- user_data: Uint8Array;
100
- }>;
101
- response: z.ZodNull;
102
- };
103
- StartMedia: {
104
- request: z.ZodObject<{
105
- media_id: z.ZodNumber;
106
- properties: z.ZodUnion<[z.ZodObject<{
107
- kind: z.ZodOptional<z.ZodLiteral<"audio">>;
108
- uid: z.ZodOptional<z.ZodString>;
109
- }, "strip", z.ZodTypeAny, {
110
- kind?: "audio" | undefined;
111
- uid?: string | undefined;
112
- }, {
113
- kind?: "audio" | undefined;
114
- uid?: string | undefined;
115
- }>, z.ZodObject<{
116
- kind: z.ZodOptional<z.ZodLiteral<"video">>;
117
- codec: z.ZodOptional<z.ZodString>;
118
- uid: z.ZodOptional<z.ZodString>;
119
- }, "strip", z.ZodTypeAny, {
120
- kind?: "video" | undefined;
121
- codec?: string | undefined;
122
- uid?: string | undefined;
123
- }, {
124
- kind?: "video" | undefined;
125
- codec?: string | undefined;
126
- uid?: string | undefined;
127
- }>]>;
128
- }, "strip", z.ZodTypeAny, {
129
- properties: ({
130
- kind?: "audio" | undefined;
131
- uid?: string | undefined;
132
- } | {
133
- kind?: "video" | undefined;
134
- codec?: string | undefined;
135
- uid?: string | undefined;
136
- }) & ({
137
- kind?: "audio" | undefined;
138
- uid?: string | undefined;
139
- } | {
140
- kind?: "video" | undefined;
141
- codec?: string | undefined;
142
- uid?: string | undefined;
143
- } | undefined);
144
- media_id: number;
145
- }, {
146
- properties: ({
147
- kind?: "audio" | undefined;
148
- uid?: string | undefined;
149
- } | {
150
- kind?: "video" | undefined;
151
- codec?: string | undefined;
152
- uid?: string | undefined;
153
- }) & ({
154
- kind?: "audio" | undefined;
155
- uid?: string | undefined;
156
- } | {
157
- kind?: "video" | undefined;
158
- codec?: string | undefined;
159
- uid?: string | undefined;
160
- } | undefined);
161
- media_id: number;
162
- }>;
163
- response: z.ZodNull;
164
- };
165
- StopMedia: {
166
- request: z.ZodObject<{
167
- media_id: z.ZodNumber;
168
- }, "strip", z.ZodTypeAny, {
169
- media_id: number;
170
- }, {
171
- media_id: number;
172
- }>;
173
- response: z.ZodNull;
174
- };
175
- PauseMedia: {
176
- request: z.ZodObject<{
177
- media_id: z.ZodNumber;
178
- }, "strip", z.ZodTypeAny, {
179
- media_id: number;
180
- }, {
181
- media_id: number;
182
- }>;
183
- response: z.ZodNull;
184
- };
185
- ResumeMedia: {
186
- request: z.ZodObject<{
187
- media_id: z.ZodNumber;
188
- }, "strip", z.ZodTypeAny, {
189
- media_id: number;
190
- }, {
191
- media_id: number;
192
- }>;
193
- response: z.ZodNull;
194
- };
195
- SetPeerPosition: {
196
- request: z.ZodObject<{
197
- position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
198
- }, "strip", z.ZodTypeAny, {
199
- position: [number, number, number] | [number, number];
200
- }, {
201
- position: [number, number, number] | [number, number];
202
- }>;
203
- response: z.ZodNull;
204
- };
205
- SendMessage: {
206
- request: z.ZodObject<{
207
- target_peer_ids: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
208
- message: z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>;
209
- }, "strip", z.ZodTypeAny, {
210
- message: Uint8Array;
211
- target_peer_ids?: number[] | undefined;
212
- }, {
213
- message: Uint8Array;
214
- target_peer_ids?: number[] | undefined;
215
- }>;
216
- response: z.ZodNull;
217
- };
218
- };