@4players/odin-common 1.7.0 → 2.0.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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.1
4
+
5
+ - Update `TokenSubjectSchema` with additional subjects for gateway management apis
6
+
3
7
  ## 1.7.0
4
8
 
5
9
  - Added `MinDBFS`
@@ -6,11 +6,13 @@ exports.MediaIdSchema = z.number();
6
6
  exports.MediaAudioPropertiesSchema = z.object({
7
7
  kind: z.optional(z.literal('audio')),
8
8
  uid: z.optional(z.string()),
9
+ customType: z.optional(z.string()),
9
10
  });
10
11
  exports.MediaVideoPropertiesSchema = z.object({
11
12
  kind: z.optional(z.literal('video')),
12
13
  codec: z.optional(z.string()),
13
14
  uid: z.optional(z.string()),
15
+ customType: z.optional(z.string()),
14
16
  });
15
17
  exports.MediaPropertiesSchema = z.union([
16
18
  exports.MediaAudioPropertiesSchema,
@@ -1,17 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oneOrMany = exports.TokenClaimsSchema = exports.TokenAudienceSchema = exports.TokenSubjectSchema = void 0;
3
+ exports.oneOrMany = exports.TokenClaimsSchema = exports.TokenSubjectSchema = exports.TokenAudienceSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- exports.TokenSubjectSchema = zod_1.z.enum(['connect']);
6
5
  exports.TokenAudienceSchema = zod_1.z.enum(['sfu', 'gateway']);
6
+ exports.TokenSubjectSchema = zod_1.z.enum([
7
+ 'connect',
8
+ 'roomclose',
9
+ 'roomupdate',
10
+ 'roombanclient',
11
+ 'roomsendmessage',
12
+ ]);
7
13
  exports.TokenClaimsSchema = zod_1.z.object({
8
14
  uid: zod_1.z.string(),
9
15
  cid: zod_1.z.optional(zod_1.z.string()),
10
16
  rid: oneOrMany(zod_1.z.string()),
11
17
  nsp: zod_1.z.optional(zod_1.z.string()),
12
18
  adr: zod_1.z.optional(zod_1.z.string()),
13
- sub: zod_1.z.optional(oneOrMany(exports.TokenSubjectSchema)),
14
19
  aud: zod_1.z.optional(oneOrMany(exports.TokenAudienceSchema)),
20
+ sub: zod_1.z.optional(oneOrMany(exports.TokenSubjectSchema)),
15
21
  exp: zod_1.z.optional(zod_1.z.number()),
16
22
  nbf: zod_1.z.optional(zod_1.z.number()),
17
23
  ups: zod_1.z.optional(zod_1.z.string()),
@@ -3,11 +3,13 @@ export const MediaIdSchema = z.number();
3
3
  export const MediaAudioPropertiesSchema = z.object({
4
4
  kind: z.optional(z.literal('audio')),
5
5
  uid: z.optional(z.string()),
6
+ customType: z.optional(z.string()),
6
7
  });
7
8
  export const MediaVideoPropertiesSchema = z.object({
8
9
  kind: z.optional(z.literal('video')),
9
10
  codec: z.optional(z.string()),
10
11
  uid: z.optional(z.string()),
12
+ customType: z.optional(z.string()),
11
13
  });
12
14
  export const MediaPropertiesSchema = z.union([
13
15
  MediaAudioPropertiesSchema,
@@ -1,14 +1,20 @@
1
1
  import { z } from 'zod';
2
- export const TokenSubjectSchema = z.enum(['connect']);
3
2
  export const TokenAudienceSchema = z.enum(['sfu', 'gateway']);
3
+ export const TokenSubjectSchema = z.enum([
4
+ 'connect',
5
+ 'roomclose',
6
+ 'roomupdate',
7
+ 'roombanclient',
8
+ 'roomsendmessage',
9
+ ]);
4
10
  export const TokenClaimsSchema = z.object({
5
11
  uid: z.string(),
6
12
  cid: z.optional(z.string()),
7
13
  rid: oneOrMany(z.string()),
8
14
  nsp: z.optional(z.string()),
9
15
  adr: z.optional(z.string()),
10
- sub: z.optional(oneOrMany(TokenSubjectSchema)),
11
16
  aud: z.optional(oneOrMany(TokenAudienceSchema)),
17
+ sub: z.optional(oneOrMany(TokenSubjectSchema)),
12
18
  exp: z.optional(z.number()),
13
19
  nbf: z.optional(z.number()),
14
20
  ups: z.optional(z.string()),
@@ -9,6 +9,8 @@ export declare namespace Backend {
9
9
  joinRoom(parameters: JoinRoomParameters): Room;
10
10
  createAudioPlayback(parameters: CreateAudioPlaybackParameters): Promise<AudioPlayback>;
11
11
  createAudioCapture(parameters: CreateAudioCaptureParameters): Promise<AudioCapture>;
12
+ createVideoCapture(ms: MediaStream, customType?: string): Promise<VideoCapture>;
13
+ createVideoPlayback(parameters: CreateVideoPlaybackParameters): Promise<VideoPlayback>;
12
14
  enumerateDevices(): Promise<Array<Device>>;
13
15
  setOutputVolume(volume: Volume): void;
14
16
  setOutputDevice(device: DeviceParameters): Promise<void>;
@@ -37,11 +39,12 @@ export declare namespace Backend {
37
39
  }
38
40
  interface Room {
39
41
  request(method: string, properties: unknown): Promise<unknown>;
40
- link(media: Media): void;
42
+ link(media: Media): Promise<void>;
41
43
  unlink(media: Media): void;
42
44
  close(): void;
43
45
  }
44
46
  interface Media {
47
+ readonly customType?: string;
45
48
  close(): void;
46
49
  }
47
50
  interface AudioMedia extends Media {
@@ -52,6 +55,11 @@ export declare namespace Backend {
52
55
  interface CreateAudioPlaybackParameters {
53
56
  readonly uid: UID;
54
57
  readonly volume?: Volume;
58
+ readonly customType?: string;
59
+ }
60
+ interface CreateVideoPlaybackParameters {
61
+ readonly uid: UID;
62
+ readonly customType?: string;
55
63
  }
56
64
  interface AudioPlayback extends AudioMedia {
57
65
  readonly uid: UID;
@@ -68,6 +76,14 @@ export declare namespace Backend {
68
76
  setApm(config: ApmConfig): void;
69
77
  setDevice(device: DeviceParameters): void;
70
78
  }
79
+ interface VideoCapture extends Media {
80
+ mediaStream?: MediaStream;
81
+ setDevice(ms: MediaStream): Promise<void>;
82
+ }
83
+ interface VideoPlayback extends Media {
84
+ readonly mediaStream?: MediaStream;
85
+ readonly uid: UID;
86
+ }
71
87
  type Volume = number | 'muted';
72
88
  interface VadConfig {
73
89
  voiceActivity?: SensitivityRange;
@@ -112,57 +112,71 @@ export declare const RoomCommandsRpc: {
112
112
  properties: z.ZodUnion<[z.ZodObject<{
113
113
  kind: z.ZodOptional<z.ZodLiteral<"audio">>;
114
114
  uid: z.ZodOptional<z.ZodString>;
115
+ customType: z.ZodOptional<z.ZodString>;
115
116
  }, "strip", z.ZodTypeAny, {
116
117
  kind?: "audio" | undefined;
117
118
  uid?: string | undefined;
119
+ customType?: string | undefined;
118
120
  }, {
119
121
  kind?: "audio" | undefined;
120
122
  uid?: string | undefined;
123
+ customType?: string | undefined;
121
124
  }>, z.ZodObject<{
122
125
  kind: z.ZodOptional<z.ZodLiteral<"video">>;
123
126
  codec: z.ZodOptional<z.ZodString>;
124
127
  uid: z.ZodOptional<z.ZodString>;
128
+ customType: z.ZodOptional<z.ZodString>;
125
129
  }, "strip", z.ZodTypeAny, {
126
130
  kind?: "video" | undefined;
127
131
  codec?: string | undefined;
128
132
  uid?: string | undefined;
133
+ customType?: string | undefined;
129
134
  }, {
130
135
  kind?: "video" | undefined;
131
136
  codec?: string | undefined;
132
137
  uid?: string | undefined;
138
+ customType?: string | undefined;
133
139
  }>]>;
134
140
  }, "strip", z.ZodTypeAny, {
135
141
  properties: ({
136
142
  kind?: "audio" | undefined;
137
143
  uid?: string | undefined;
144
+ customType?: string | undefined;
138
145
  } | {
139
146
  kind?: "video" | undefined;
140
147
  codec?: string | undefined;
141
148
  uid?: string | undefined;
149
+ customType?: string | undefined;
142
150
  }) & ({
143
151
  kind?: "audio" | undefined;
144
152
  uid?: string | undefined;
153
+ customType?: string | undefined;
145
154
  } | {
146
155
  kind?: "video" | undefined;
147
156
  codec?: string | undefined;
148
157
  uid?: string | undefined;
158
+ customType?: string | undefined;
149
159
  } | undefined);
150
160
  media_id: number;
151
161
  }, {
152
162
  properties: ({
153
163
  kind?: "audio" | undefined;
154
164
  uid?: string | undefined;
165
+ customType?: string | undefined;
155
166
  } | {
156
167
  kind?: "video" | undefined;
157
168
  codec?: string | undefined;
158
169
  uid?: string | undefined;
170
+ customType?: string | undefined;
159
171
  }) & ({
160
172
  kind?: "audio" | undefined;
161
173
  uid?: string | undefined;
174
+ customType?: string | undefined;
162
175
  } | {
163
176
  kind?: "video" | undefined;
164
177
  codec?: string | undefined;
165
178
  uid?: string | undefined;
179
+ customType?: string | undefined;
166
180
  } | undefined);
167
181
  media_id: number;
168
182
  }>;