@volorio/sdk 0.1.0 → 0.2.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/README.md CHANGED
@@ -5,7 +5,7 @@ Volorio SDK lets customers sell and embed RTC video, voice, live streaming, chat
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install @volorio/sdk livekit-client
8
+ npm install @volorio/sdk
9
9
  ```
10
10
 
11
11
  ## Server-side token endpoint
@@ -30,6 +30,7 @@ app.post("/api/volorio/session", async (request, response) => {
30
30
  roomId: request.body.roomId,
31
31
  identity: request.body.identity,
32
32
  quality: request.body.quality ?? "hd",
33
+ products: ["rtc_voice", "rtc_video_hd", "ai_noise_suppression", "spatial_audio_3d", "interactive_whiteboard"],
33
34
  ttlSeconds: 3600,
34
35
  });
35
36
 
@@ -58,6 +59,12 @@ const room = new VolorioRoomClient({
58
59
  videoMinutePriceMicros: 890,
59
60
  screenShareMinutePriceMicros: 120,
60
61
  chatMinutePriceMicros: 80,
62
+ noiseSuppressionMinutePriceMicros: 590,
63
+ spatialAudioMinutePriceMicros: 990,
64
+ whiteboardMinutePriceMicros: 1_400,
65
+ classroomMinutePriceMicros: 2_190,
66
+ noiseSuppressionProcessorFactory: async () => createYourAudioNoiseSuppressionProcessor(),
67
+ spatialAudioEngineFactory: async () => createYourSpatialAudioEngine(),
61
68
  });
62
69
 
63
70
  room.on("usageEstimateChanged", (estimate) => {
@@ -68,9 +75,62 @@ room.on("usageEstimateChanged", (estimate) => {
68
75
  await room.join(session);
69
76
  await room.enableCamera(true);
70
77
  await room.enableMicrophone(true);
78
+ await room.enableNoiseSuppression(true);
79
+ await room.enableSpatialAudio(true);
80
+ await room.setSpatialAudioParticipantPosition("visitor_42", { x: 0, y: 0, z: -1 });
81
+ await room.setSpatialAudioListenerPosition({ x: 0, y: 0, z: 0 });
82
+ await room.enableWhiteboard(true);
83
+ await room.enableFlexibleClassroom({
84
+ classroomId: "math_101",
85
+ role: "teacher",
86
+ layout: "lecture",
87
+ enableWhiteboard: true,
88
+ enableScreenShare: true,
89
+ });
90
+ await room.sendWhiteboardStroke({
91
+ strokeId: "stroke_001",
92
+ color: "#111111",
93
+ width: 4,
94
+ points: [{ x: 0, y: 0 }, { x: 10, y: 8 }],
95
+ });
71
96
  await room.sendMessage("hello");
72
97
  ```
73
98
 
99
+ `enableNoiseSuppression(true)` requires the backend session to include the `ai_noise_suppression` product grant and requires a browser audio processor factory. If no processor is configured, the SDK fails loudly instead of pretending the product is active.
100
+ `enableSpatialAudio(true)` requires the backend session to include the `spatial_audio_3d` product grant and requires a browser spatial audio engine factory.
101
+ `enableWhiteboard(true)` requires the backend session to include the `interactive_whiteboard` product grant. Stroke and clear events are sent over Volorio reliable room data messages.
102
+ `enableFlexibleClassroom(...)` requires the backend session to include the `flexible_classroom` product grant. The server helper below also requests whiteboard and screen-share grants by default.
103
+
104
+ ## Flexible Classroom
105
+
106
+ ```ts
107
+ const session = await volorio.createClassroomSession({
108
+ projectId: "proj_123",
109
+ classroomId: "math_101",
110
+ roomId: "classroom_math_101",
111
+ identity: "teacher_001",
112
+ role: "teacher",
113
+ layout: "lecture",
114
+ quality: "fullhd",
115
+ });
116
+ ```
117
+
118
+ The helper creates a normal Volorio room session through `/v1/sessions`, so API key validation, product entitlements, wallet reservation, and heartbeat cutoff stay enforced by the gateway.
119
+
120
+ ## Analytics
121
+
122
+ ```ts
123
+ const analytics = await volorio.getAnalyticsSummary({
124
+ projectId: "proj_123",
125
+ periodStart: "2026-08-01T00:00:00.000Z",
126
+ periodEnd: "2026-09-01T00:00:00.000Z",
127
+ });
128
+
129
+ console.log(analytics.totalQuantity, analytics.totalAmountMicros, analytics.products);
130
+ ```
131
+
132
+ Analytics requires an API key with `analytics:read` scope and the `analytics` product grant.
133
+
74
134
  ## Product catalog
75
135
 
76
136
  ```ts
@@ -81,6 +141,30 @@ console.table(volorioPricingCatalog);
81
141
 
82
142
  Current catalog includes separate products for conversational AI, RTC voice, RTC video HD, RTC video FullHD, RTC video 2K, RTC video 4K, live streaming, signaling, chat MAU, speech-to-text, translation, recording, media gateway, transcoding, media push, media pull, AI noise suppression, 3D spatial audio, whiteboard, analytics, and flexible classroom.
83
143
 
144
+ ## Server media services
145
+
146
+ ```ts
147
+ import { VolorioServerClient } from "@volorio/sdk/node";
148
+
149
+ const volorio = new VolorioServerClient({
150
+ apiBaseUrl: "https://api.volorio.com",
151
+ apiKey: process.env.VOLORIO_SERVER_API_KEY!,
152
+ });
153
+
154
+ await volorio.startMediaPush({
155
+ roomId: "room_123",
156
+ outputUrl: "rtmp://cdn.example.com/live/stream",
157
+ quality: "fullhd",
158
+ layout: "speaker",
159
+ });
160
+
161
+ await volorio.startMediaPull({
162
+ roomId: "room_123",
163
+ sourceUrl: "https://cdn.example.com/live/source.m3u8",
164
+ participantIdentity: "remote_stage",
165
+ });
166
+ ```
167
+
84
168
  ## Local package build
85
169
 
86
170
  ```bash
@@ -1,53 +1 @@
1
- type EventName = "participantsChanged" | "messageReceived" | "usageEstimateChanged" | "connected" | "disconnected";
2
- type Handler = (event: unknown) => void;
3
- export interface VolorioBrowserSession {
4
- livekitUrl: string;
5
- token: string;
6
- identity: string;
7
- }
8
- export interface VolorioUsageEstimate {
9
- participantMinutes: number;
10
- estimatedAmountMicros: number;
11
- }
12
- export interface VolorioRoomClientOptions {
13
- roomFactory?: () => VolorioRoomLike;
14
- now?: () => number;
15
- participantMinutePriceMicros?: number;
16
- videoMinutePriceMicros?: number;
17
- screenShareMinutePriceMicros?: number;
18
- chatMinutePriceMicros?: number;
19
- }
20
- export interface VolorioRoomLike {
21
- localParticipant: {
22
- setCameraEnabled(enabled: boolean): Promise<void>;
23
- setMicrophoneEnabled(enabled: boolean): Promise<void>;
24
- setScreenShareEnabled(enabled: boolean): Promise<void>;
25
- publishData(payload: Uint8Array, options?: {
26
- reliable?: boolean;
27
- }): Promise<void>;
28
- };
29
- on(event: string, handler: (...args: unknown[]) => void): void;
30
- connect(url: string, token: string): Promise<void>;
31
- disconnect(): void;
32
- }
33
- export declare class VolorioRoomClient {
34
- private readonly handlers;
35
- private readonly roomFactory;
36
- private readonly now;
37
- private readonly rates;
38
- private room;
39
- private joinedAt;
40
- private featureState;
41
- constructor(options?: VolorioRoomClientOptions);
42
- on(event: EventName, handler: Handler): () => void;
43
- join(session: VolorioBrowserSession): Promise<void>;
44
- disconnect(): void;
45
- enableCamera(enabled: boolean): Promise<void>;
46
- enableMicrophone(enabled: boolean): Promise<void>;
47
- enableScreenShare(enabled: boolean): Promise<void>;
48
- sendMessage(message: string): Promise<void>;
49
- updateUsageEstimate(): VolorioUsageEstimate;
50
- private requireRoom;
51
- private emit;
52
- }
53
- export {};
1
+ export * from "@volorio/rtc";
@@ -1,97 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VolorioRoomClient = void 0;
4
- class VolorioRoomClient {
5
- handlers = new Map();
6
- roomFactory;
7
- now;
8
- rates;
9
- room;
10
- joinedAt = 0;
11
- featureState = { camera: false, screenShare: false, chat: false };
12
- constructor(options = {}) {
13
- this.roomFactory = options.roomFactory ?? createLiveKitRoom;
14
- this.now = options.now ?? Date.now;
15
- this.rates = {
16
- participantMinutePriceMicros: options.participantMinutePriceMicros ?? 590,
17
- videoMinutePriceMicros: options.videoMinutePriceMicros ?? 250,
18
- screenShareMinutePriceMicros: options.screenShareMinutePriceMicros ?? 120,
19
- chatMinutePriceMicros: options.chatMinutePriceMicros ?? 80,
20
- };
21
- }
22
- on(event, handler) {
23
- const handlers = this.handlers.get(event) ?? [];
24
- handlers.push(handler);
25
- this.handlers.set(event, handlers);
26
- return () => this.handlers.set(event, handlers.filter((item) => item !== handler));
27
- }
28
- async join(session) {
29
- this.room = this.roomFactory();
30
- this.room.on("disconnected", () => this.emit("disconnected", undefined));
31
- this.room.on("participantConnected", () => this.emit("participantsChanged", undefined));
32
- this.room.on("participantDisconnected", () => this.emit("participantsChanged", undefined));
33
- this.room.on("dataReceived", (payload, participant) => {
34
- this.emit("messageReceived", { payload, participant });
35
- });
36
- await this.room.connect(session.livekitUrl, session.token);
37
- this.joinedAt = this.now();
38
- this.emit("connected", { identity: session.identity });
39
- this.updateUsageEstimate();
40
- }
41
- disconnect() {
42
- this.room?.disconnect();
43
- this.room = undefined;
44
- this.emit("disconnected", undefined);
45
- }
46
- async enableCamera(enabled) {
47
- await this.requireRoom().localParticipant.setCameraEnabled(enabled);
48
- this.featureState.camera = enabled;
49
- this.updateUsageEstimate();
50
- }
51
- async enableMicrophone(enabled) {
52
- await this.requireRoom().localParticipant.setMicrophoneEnabled(enabled);
53
- }
54
- async enableScreenShare(enabled) {
55
- await this.requireRoom().localParticipant.setScreenShareEnabled(enabled);
56
- this.featureState.screenShare = enabled;
57
- this.updateUsageEstimate();
58
- }
59
- async sendMessage(message) {
60
- await this.requireRoom().localParticipant.publishData(new TextEncoder().encode(message), { reliable: true });
61
- this.featureState.chat = true;
62
- this.updateUsageEstimate();
63
- }
64
- updateUsageEstimate() {
65
- const elapsedMinutes = Math.max(0, (this.now() - this.joinedAt) / 60000);
66
- const perMinute = this.rates.participantMinutePriceMicros +
67
- (this.featureState.camera ? this.rates.videoMinutePriceMicros : 0) +
68
- (this.featureState.screenShare ? this.rates.screenShareMinutePriceMicros : 0) +
69
- (this.featureState.chat ? this.rates.chatMinutePriceMicros : 0);
70
- const estimate = {
71
- participantMinutes: elapsedMinutes,
72
- estimatedAmountMicros: Math.round(elapsedMinutes * perMinute),
73
- };
74
- this.emit("usageEstimateChanged", estimate);
75
- return estimate;
76
- }
77
- requireRoom() {
78
- if (this.room === undefined) {
79
- throw new Error("Volorio room is not connected");
80
- }
81
- return this.room;
82
- }
83
- emit(event, payload) {
84
- for (const handler of this.handlers.get(event) ?? []) {
85
- handler(payload);
86
- }
87
- }
88
- }
89
- exports.VolorioRoomClient = VolorioRoomClient;
90
- function createLiveKitRoom() {
91
- const livekit = globalThis.LivekitClient;
92
- if (livekit === undefined) {
93
- throw new Error("livekit-client is required. Pass roomFactory or load LivekitClient in the browser.");
94
- }
95
- return new livekit.Room();
96
- }
17
+ __exportStar(require("@volorio/rtc"), exports);
97
18
  //# sourceMappingURL=browser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":";;;AAmCA,MAAa,iBAAiB;IACX,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC3C,WAAW,CAAwB;IACnC,GAAG,CAAe;IAClB,KAAK,CAAiK;IAC/K,IAAI,CAA8B;IAClC,QAAQ,GAAG,CAAC,CAAC;IACb,YAAY,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAE1E,YAAY,UAAoC,EAAE;QAChD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,iBAAiB,CAAC;QAC5D,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG;YACX,4BAA4B,EAAE,OAAO,CAAC,4BAA4B,IAAI,GAAG;YACzE,sBAAsB,EAAE,OAAO,CAAC,sBAAsB,IAAI,GAAG;YAC7D,4BAA4B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AAgB;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YACrD,OAAO,CAAC,OAAO,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AAhGD,8CAgGC;AAED,SAAS,iBAAiB;IACxB,MAAM,OAAO,GAAI,UAAiF,CAAC,aAAa,CAAC;IACjH,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;AAC5B,CAAC"}
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B"}
@@ -1,3 +1,3 @@
1
- export * from "./node";
2
- export * from "./browser";
3
- export * from "./pricing";
1
+ export * from "@volorio/core";
2
+ export * from "@volorio/server";
3
+ export * from "@volorio/rtc";
package/dist/src/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./node"), exports);
18
- __exportStar(require("./browser"), exports);
19
- __exportStar(require("./pricing"), exports);
17
+ __exportStar(require("@volorio/core"), exports);
18
+ __exportStar(require("@volorio/server"), exports);
19
+ __exportStar(require("@volorio/rtc"), exports);
20
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,4CAA0B;AAC1B,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,kDAAgC;AAChC,+CAA6B"}
@@ -1,28 +1 @@
1
- export interface VolorioServerClientOptions {
2
- apiBaseUrl: string;
3
- apiKey: string;
4
- fetch?: typeof fetch;
5
- }
6
- export interface CreateRoomSessionInput {
7
- projectId: string;
8
- roomId: string;
9
- identity: string;
10
- regionId?: string;
11
- ttlSeconds?: number;
12
- quality?: "voice" | "hd" | "fullhd" | "2k" | "4k";
13
- }
14
- export interface VolorioRoomSession {
15
- projectId: string;
16
- roomId: string;
17
- identity: string;
18
- token: string;
19
- livekitUrl: string;
20
- }
21
- export declare class VolorioServerClient {
22
- private readonly apiBaseUrl;
23
- private readonly apiKey;
24
- private readonly fetchImpl;
25
- constructor(options: VolorioServerClientOptions);
26
- createRoomSession(input: CreateRoomSessionInput): Promise<VolorioRoomSession>;
27
- private post;
28
- }
1
+ export * from "@volorio/server";
package/dist/src/node.js CHANGED
@@ -1,50 +1,18 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VolorioServerClient = void 0;
4
- class VolorioServerClient {
5
- apiBaseUrl;
6
- apiKey;
7
- fetchImpl;
8
- constructor(options) {
9
- this.apiBaseUrl = options.apiBaseUrl.replace(/\/+$/, "");
10
- this.apiKey = options.apiKey;
11
- this.fetchImpl = options.fetch ?? fetch;
12
- }
13
- async createRoomSession(input) {
14
- await this.post("/v1/media-rooms", {
15
- roomId: input.roomId,
16
- regionId: input.regionId ?? "default",
17
- metadata: JSON.stringify({ projectId: input.projectId, quality: input.quality ?? "hd" }),
18
- });
19
- const token = await this.post("/v1/tokens", {
20
- projectId: input.projectId,
21
- roomId: input.roomId,
22
- identity: input.identity,
23
- ttlSeconds: input.ttlSeconds ?? 3600,
24
- quality: input.quality ?? "hd",
25
- });
26
- return {
27
- projectId: input.projectId,
28
- roomId: input.roomId,
29
- identity: input.identity,
30
- token: token.token,
31
- livekitUrl: token.livekitUrl ?? "",
32
- };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
33
7
  }
34
- async post(path, body) {
35
- const response = await this.fetchImpl(`${this.apiBaseUrl}${path}`, {
36
- method: "POST",
37
- headers: {
38
- authorization: `Bearer ${this.apiKey}`,
39
- "content-type": "application/json",
40
- },
41
- body: JSON.stringify(body),
42
- });
43
- if (!response.ok) {
44
- throw new Error(`Volorio API ${path} returned ${response.status}: ${await response.text()}`);
45
- }
46
- return response.json();
47
- }
48
- }
49
- exports.VolorioServerClient = VolorioServerClient;
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("@volorio/server"), exports);
50
18
  //# sourceMappingURL=node.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":";;;AAuBA,MAAa,mBAAmB;IACb,UAAU,CAAS;IACnB,MAAM,CAAS;IACf,SAAS,CAAe;IAEzC,YAAY,OAAmC;QAC7C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,KAA6B;QACn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AAK,CAAC,eAAe,IAAI,aAAa,QAAQ,CAAC,MAAM,KAAK,MAAM,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC/F,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAA2B,CAAC;IAClD,CAAC;CACF;AAlDD,kDAkDC"}
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
@@ -1,13 +1 @@
1
- export type VolorioProductUnit = "minute" | "participant_minute" | "message" | "monthly_active_user" | "month";
2
- export interface VolorioProductPrice {
3
- id: string;
4
- name: string;
5
- category: "core" | "media_service" | "ai_extension" | "addon" | "apaas";
6
- unit: VolorioProductUnit;
7
- unitPriceMicros: number;
8
- freeAllowance?: {
9
- quantity: number;
10
- period: "month" | "one_time";
11
- };
12
- }
13
- export declare const volorioPricingCatalog: readonly VolorioProductPrice[];
1
+ export * from "@volorio/core";
@@ -1,28 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.volorioPricingCatalog = void 0;
4
- exports.volorioPricingCatalog = [
5
- { id: "conversational_ai_platform", name: "Conversational AI Platform", category: "core", unit: "minute", unitPriceMicros: 100_000, freeAllowance: { quantity: 300, period: "one_time" } },
6
- { id: "rtc_voice", name: "RTC Voice", category: "core", unit: "participant_minute", unitPriceMicros: 590 },
7
- { id: "rtc_video_hd", name: "RTC Video HD", category: "core", unit: "participant_minute", unitPriceMicros: 590, freeAllowance: { quantity: 10_000, period: "month" } },
8
- { id: "rtc_video_fullhd", name: "RTC Video FullHD", category: "core", unit: "participant_minute", unitPriceMicros: 890 },
9
- { id: "rtc_video_2k", name: "RTC Video 2K", category: "core", unit: "participant_minute", unitPriceMicros: 1_490 },
10
- { id: "rtc_video_4k", name: "RTC Video 4K", category: "core", unit: "participant_minute", unitPriceMicros: 2_490 },
11
- { id: "live_streaming", name: "Live Streaming", category: "core", unit: "participant_minute", unitPriceMicros: 590 },
12
- { id: "screen_share", name: "Screen Share", category: "core", unit: "participant_minute", unitPriceMicros: 590 },
13
- { id: "signaling", name: "Signaling", category: "core", unit: "message", unitPriceMicros: 1_500, freeAllowance: { quantity: 1_000_000, period: "month" } },
14
- { id: "chat_mau", name: "Chat MAU", category: "core", unit: "monthly_active_user", unitPriceMicros: 50_000, freeAllowance: { quantity: 500, period: "month" } },
15
- { id: "speech_to_text", name: "Real-Time Speech to Text", category: "media_service", unit: "minute", unitPriceMicros: 16_990 },
16
- { id: "real_time_translation", name: "Real-Time Translation", category: "media_service", unit: "minute", unitPriceMicros: 8_990 },
17
- { id: "recording", name: "Recording", category: "media_service", unit: "minute", unitPriceMicros: 990 },
18
- { id: "media_gateway", name: "Media Gateway", category: "media_service", unit: "minute", unitPriceMicros: 990 },
19
- { id: "cloud_transcoding", name: "Cloud Transcoding", category: "media_service", unit: "minute", unitPriceMicros: 1_990 },
20
- { id: "media_push", name: "Media Push", category: "media_service", unit: "minute", unitPriceMicros: 1_990 },
21
- { id: "media_pull", name: "Media Pull", category: "media_service", unit: "minute", unitPriceMicros: 1_150 },
22
- { id: "ai_noise_suppression", name: "AI Noise Suppression", category: "ai_extension", unit: "minute", unitPriceMicros: 590, freeAllowance: { quantity: 10_000, period: "month" } },
23
- { id: "spatial_audio_3d", name: "3D Spatial Audio", category: "ai_extension", unit: "minute", unitPriceMicros: 990, freeAllowance: { quantity: 10_000, period: "month" } },
24
- { id: "interactive_whiteboard", name: "Interactive Whiteboard", category: "addon", unit: "minute", unitPriceMicros: 1_400, freeAllowance: { quantity: 10_000, period: "month" } },
25
- { id: "analytics", name: "Analytics", category: "addon", unit: "month", unitPriceMicros: 449_000_000 },
26
- { id: "flexible_classroom", name: "Flexible Classroom", category: "apaas", unit: "minute", unitPriceMicros: 2_190, freeAllowance: { quantity: 10_000, period: "month" } },
27
- ];
17
+ __exportStar(require("@volorio/core"), exports);
28
18
  //# sourceMappingURL=pricing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../src/pricing.ts"],"names":[],"mappings":";;;AAmBa,QAAA,qBAAqB,GAAmC;IACnE,EAAE,EAAE,EAAE,4BAA4B,EAAE,IAAI,EAAE,4BAA4B,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;IAC1L,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,eAAe,EAAE,GAAG,EAAE;IAC1G,EAAE,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,eAAe,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IACtK,EAAE,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,eAAe,EAAE,GAAG,EAAE;I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,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IACjL,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE;IACtG,EAAE,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,oBAAoB,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;CAC1K,CAAC"}
1
+ {"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../src/pricing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@volorio/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
- "description": "Volorio RTC, chat, usage, and billing SDK for Node.js and browsers.",
5
+ "description": "Volorio RTC, chat, usage, billing, and media services SDK for Node.js and browsers.",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
8
8
  "exports": {
@@ -36,12 +36,9 @@
36
36
  "test": "tsc -p tsconfig.json && node --test dist/test/*.spec.js",
37
37
  "pack:local": "pnpm build && npm pack --pack-destination dist"
38
38
  },
39
- "peerDependencies": {
40
- "livekit-client": "^2.0.0"
41
- },
42
- "peerDependenciesMeta": {
43
- "livekit-client": {
44
- "optional": true
45
- }
39
+ "dependencies": {
40
+ "@volorio/core": "^0.2.0",
41
+ "@volorio/rtc": "^0.2.0",
42
+ "@volorio/server": "^0.2.0"
46
43
  }
47
44
  }