@xtr-dev/rondevu-client 0.1.2 → 0.1.3

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/dist/client.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { RondevuClientOptions, ListTopicsResponse, ListSessionsResponse, CreateOfferRequest, CreateOfferResponse, AnswerRequest, AnswerResponse, PollOffererResponse, PollAnswererResponse, VersionResponse, HealthResponse, Side } from './types';
2
2
  /**
3
- * HTTP client for Rondevu peer signaling and discovery server
3
+ * HTTP API client for Rondevu peer signaling and discovery server
4
4
  */
5
- export declare class RondevuClient {
5
+ export declare class RondevuAPI {
6
6
  private readonly baseUrl;
7
7
  private readonly fetchImpl;
8
8
  /**
9
- * Creates a new Rondevu client instance
9
+ * Creates a new Rondevu API client instance
10
10
  * @param options - Client configuration options
11
11
  */
12
12
  constructor(options: RondevuClientOptions);
@@ -21,8 +21,8 @@ export declare class RondevuClient {
21
21
  *
22
22
  * @example
23
23
  * ```typescript
24
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
25
- * const { version } = await client.getVersion();
24
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
25
+ * const { version } = await api.getVersion();
26
26
  * console.log('Server version:', version);
27
27
  * ```
28
28
  */
@@ -36,8 +36,8 @@ export declare class RondevuClient {
36
36
  *
37
37
  * @example
38
38
  * ```typescript
39
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
40
- * const { topics, pagination } = await client.listTopics();
39
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
40
+ * const { topics, pagination } = await api.listTopics();
41
41
  * console.log(`Found ${topics.length} topics`);
42
42
  * ```
43
43
  */
@@ -50,8 +50,8 @@ export declare class RondevuClient {
50
50
  *
51
51
  * @example
52
52
  * ```typescript
53
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
54
- * const { sessions } = await client.listSessions('my-room');
53
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
54
+ * const { sessions } = await api.listSessions('my-room');
55
55
  * const otherPeers = sessions.filter(s => s.peerId !== myPeerId);
56
56
  * ```
57
57
  */
@@ -65,8 +65,8 @@ export declare class RondevuClient {
65
65
  *
66
66
  * @example
67
67
  * ```typescript
68
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
69
- * const { code } = await client.createOffer('my-room', {
68
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
69
+ * const { code } = await api.createOffer('my-room', {
70
70
  * peerId: 'peer-123',
71
71
  * offer: signalingData
72
72
  * });
@@ -82,17 +82,17 @@ export declare class RondevuClient {
82
82
  *
83
83
  * @example
84
84
  * ```typescript
85
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
85
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
86
86
  *
87
87
  * // Send answer
88
- * await client.sendAnswer({
88
+ * await api.sendAnswer({
89
89
  * code: sessionCode,
90
90
  * answer: answerData,
91
91
  * side: 'answerer'
92
92
  * });
93
93
  *
94
94
  * // Send candidate
95
- * await client.sendAnswer({
95
+ * await api.sendAnswer({
96
96
  * code: sessionCode,
97
97
  * candidate: candidateData,
98
98
  * side: 'offerer'
@@ -109,16 +109,16 @@ export declare class RondevuClient {
109
109
  *
110
110
  * @example
111
111
  * ```typescript
112
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
112
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
113
113
  *
114
114
  * // Offerer polls for answer
115
- * const offererData = await client.poll(sessionCode, 'offerer');
115
+ * const offererData = await api.poll(sessionCode, 'offerer');
116
116
  * if (offererData.answer) {
117
117
  * console.log('Received answer:', offererData.answer);
118
118
  * }
119
119
  *
120
120
  * // Answerer polls for offer
121
- * const answererData = await client.poll(sessionCode, 'answerer');
121
+ * const answererData = await api.poll(sessionCode, 'answerer');
122
122
  * console.log('Received offer:', answererData.offer);
123
123
  * ```
124
124
  */
@@ -130,8 +130,8 @@ export declare class RondevuClient {
130
130
  *
131
131
  * @example
132
132
  * ```typescript
133
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
134
- * const health = await client.health();
133
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
134
+ * const health = await api.health();
135
135
  * console.log('Server status:', health.status);
136
136
  * ```
137
137
  */
package/dist/client.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
- * HTTP client for Rondevu peer signaling and discovery server
2
+ * HTTP API client for Rondevu peer signaling and discovery server
3
3
  */
4
- export class RondevuClient {
4
+ export class RondevuAPI {
5
5
  /**
6
- * Creates a new Rondevu client instance
6
+ * Creates a new Rondevu API client instance
7
7
  * @param options - Client configuration options
8
8
  */
9
9
  constructor(options) {
@@ -39,8 +39,8 @@ export class RondevuClient {
39
39
  *
40
40
  * @example
41
41
  * ```typescript
42
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
43
- * const { version } = await client.getVersion();
42
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
43
+ * const { version } = await api.getVersion();
44
44
  * console.log('Server version:', version);
45
45
  * ```
46
46
  */
@@ -58,8 +58,8 @@ export class RondevuClient {
58
58
  *
59
59
  * @example
60
60
  * ```typescript
61
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
62
- * const { topics, pagination } = await client.listTopics();
61
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
62
+ * const { topics, pagination } = await api.listTopics();
63
63
  * console.log(`Found ${topics.length} topics`);
64
64
  * ```
65
65
  */
@@ -80,8 +80,8 @@ export class RondevuClient {
80
80
  *
81
81
  * @example
82
82
  * ```typescript
83
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
84
- * const { sessions } = await client.listSessions('my-room');
83
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
84
+ * const { sessions } = await api.listSessions('my-room');
85
85
  * const otherPeers = sessions.filter(s => s.peerId !== myPeerId);
86
86
  * ```
87
87
  */
@@ -99,8 +99,8 @@ export class RondevuClient {
99
99
  *
100
100
  * @example
101
101
  * ```typescript
102
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
103
- * const { code } = await client.createOffer('my-room', {
102
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
103
+ * const { code } = await api.createOffer('my-room', {
104
104
  * peerId: 'peer-123',
105
105
  * offer: signalingData
106
106
  * });
@@ -121,17 +121,17 @@ export class RondevuClient {
121
121
  *
122
122
  * @example
123
123
  * ```typescript
124
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
124
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
125
125
  *
126
126
  * // Send answer
127
- * await client.sendAnswer({
127
+ * await api.sendAnswer({
128
128
  * code: sessionCode,
129
129
  * answer: answerData,
130
130
  * side: 'answerer'
131
131
  * });
132
132
  *
133
133
  * // Send candidate
134
- * await client.sendAnswer({
134
+ * await api.sendAnswer({
135
135
  * code: sessionCode,
136
136
  * candidate: candidateData,
137
137
  * side: 'offerer'
@@ -153,16 +153,16 @@ export class RondevuClient {
153
153
  *
154
154
  * @example
155
155
  * ```typescript
156
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
156
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
157
157
  *
158
158
  * // Offerer polls for answer
159
- * const offererData = await client.poll(sessionCode, 'offerer');
159
+ * const offererData = await api.poll(sessionCode, 'offerer');
160
160
  * if (offererData.answer) {
161
161
  * console.log('Received answer:', offererData.answer);
162
162
  * }
163
163
  *
164
164
  * // Answerer polls for offer
165
- * const answererData = await client.poll(sessionCode, 'answerer');
165
+ * const answererData = await api.poll(sessionCode, 'answerer');
166
166
  * console.log('Received offer:', answererData.offer);
167
167
  * ```
168
168
  */
@@ -180,8 +180,8 @@ export class RondevuClient {
180
180
  *
181
181
  * @example
182
182
  * ```typescript
183
- * const client = new RondevuClient({ baseUrl: 'https://example.com' });
184
- * const health = await client.health();
183
+ * const api = new RondevuAPI({ baseUrl: 'https://example.com' });
184
+ * const health = await api.health();
185
185
  * console.log('Server status:', health.status);
186
186
  * ```
187
187
  */
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from './event-emitter';
2
- import { RondevuClient } from './client';
2
+ import { RondevuAPI } from './client';
3
3
  import { RondevuConnectionParams } from './types';
4
4
  /**
5
5
  * Represents a WebRTC connection with automatic signaling and ICE exchange
@@ -19,7 +19,7 @@ export declare class RondevuConnection extends EventEmitter {
19
19
  private connectionTimer?;
20
20
  private isPolling;
21
21
  private isClosed;
22
- constructor(params: RondevuConnectionParams, client: RondevuClient);
22
+ constructor(params: RondevuConnectionParams, client: RondevuAPI);
23
23
  /**
24
24
  * Setup RTCPeerConnection event handlers
25
25
  */
package/dist/index.d.ts CHANGED
@@ -4,5 +4,5 @@
4
4
  */
5
5
  export { Rondevu } from './rondevu';
6
6
  export { RondevuConnection } from './connection';
7
- export { RondevuClient } from './client';
7
+ export { RondevuAPI } from './client';
8
8
  export type { RondevuOptions, JoinOptions, ConnectionRole, RondevuConnectionParams, RondevuConnectionEvents, Side, Session, TopicInfo, Pagination, ListTopicsResponse, ListSessionsResponse, CreateOfferRequest, CreateOfferResponse, AnswerRequest, AnswerResponse, PollRequest, PollOffererResponse, PollAnswererResponse, PollResponse, VersionResponse, HealthResponse, ErrorResponse, RondevuClientOptions, } from './types';
package/dist/index.js CHANGED
@@ -6,5 +6,5 @@
6
6
  export { Rondevu } from './rondevu';
7
7
  // Export connection class
8
8
  export { RondevuConnection } from './connection';
9
- // Export low-level signaling client (for advanced usage)
10
- export { RondevuClient } from './client';
9
+ // Export low-level signaling API (for advanced usage)
10
+ export { RondevuAPI } from './client';
package/dist/rondevu.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { RondevuAPI } from './client';
1
2
  import { RondevuConnection } from './connection';
2
3
  import { RondevuOptions, JoinOptions } from './types';
3
4
  /**
@@ -5,7 +6,7 @@ import { RondevuOptions, JoinOptions } from './types';
5
6
  */
6
7
  export declare class Rondevu {
7
8
  readonly peerId: string;
8
- private client;
9
+ readonly api: RondevuAPI;
9
10
  private baseUrl;
10
11
  private fetchImpl?;
11
12
  private rtcConfig?;
package/dist/rondevu.js CHANGED
@@ -1,4 +1,4 @@
1
- import { RondevuClient } from './client';
1
+ import { RondevuAPI } from './client';
2
2
  import { RondevuConnection } from './connection';
3
3
  /**
4
4
  * Main Rondevu WebRTC client with automatic connection management
@@ -11,7 +11,7 @@ export class Rondevu {
11
11
  constructor(options = {}) {
12
12
  this.baseUrl = options.baseUrl || 'https://rondevu.xtrdev.workers.dev';
13
13
  this.fetchImpl = options.fetch;
14
- this.client = new RondevuClient({
14
+ this.api = new RondevuAPI({
15
15
  baseUrl: this.baseUrl,
16
16
  fetch: options.fetch,
17
17
  });
@@ -50,7 +50,7 @@ export class Rondevu {
50
50
  // Wait for ICE gathering to complete
51
51
  await this.waitForIceGathering(pc);
52
52
  // Create session on server with custom code
53
- await this.client.createOffer(topic, {
53
+ await this.api.createOffer(topic, {
54
54
  peerId: this.peerId,
55
55
  offer: pc.localDescription.sdp,
56
56
  code: id,
@@ -66,7 +66,7 @@ export class Rondevu {
66
66
  pollingInterval: this.pollingInterval,
67
67
  connectionTimeout: this.connectionTimeout,
68
68
  };
69
- const connection = new RondevuConnection(connectionParams, this.client);
69
+ const connection = new RondevuConnection(connectionParams, this.api);
70
70
  // Start polling for answer
71
71
  connection.startPolling();
72
72
  return connection;
@@ -78,7 +78,7 @@ export class Rondevu {
78
78
  */
79
79
  async connect(id) {
80
80
  // Poll server to get session by ID
81
- const sessionData = await this.findSessionByIdWithClient(id, this.client);
81
+ const sessionData = await this.findSessionByIdWithClient(id, this.api);
82
82
  if (!sessionData) {
83
83
  throw new Error(`Connection ${id} not found or expired`);
84
84
  }
@@ -95,7 +95,7 @@ export class Rondevu {
95
95
  // Wait for ICE gathering
96
96
  await this.waitForIceGathering(pc);
97
97
  // Send answer to server
98
- await this.client.sendAnswer({
98
+ await this.api.sendAnswer({
99
99
  code: id,
100
100
  answer: pc.localDescription.sdp,
101
101
  side: 'answerer',
@@ -111,7 +111,7 @@ export class Rondevu {
111
111
  pollingInterval: this.pollingInterval,
112
112
  connectionTimeout: this.connectionTimeout,
113
113
  };
114
- const connection = new RondevuConnection(connectionParams, this.client);
114
+ const connection = new RondevuConnection(connectionParams, this.api);
115
115
  // Start polling for ICE candidates
116
116
  connection.startPolling();
117
117
  return connection;
@@ -124,7 +124,7 @@ export class Rondevu {
124
124
  */
125
125
  async join(topic, options) {
126
126
  // List sessions in topic
127
- const { sessions } = await this.client.listSessions(topic);
127
+ const { sessions } = await this.api.listSessions(topic);
128
128
  // Filter out self (sessions with our peer ID)
129
129
  let availableSessions = sessions.filter(session => session.peerId !== this.peerId);
130
130
  // Apply custom filter if provided
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtr-dev/rondevu-client",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "TypeScript client for Rondevu peer signaling and discovery server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",