@sparkstudio/realtime-ui 1.0.26 → 1.0.29

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/index.cjs CHANGED
@@ -38,6 +38,8 @@ __export(index_exports, {
38
38
  UserStatusType: () => UserStatusType,
39
39
  WebSocketConnection: () => WebSocketConnection,
40
40
  WebSocketConnectionDTO: () => WebSocketConnectionDTO,
41
+ WebSocketRequestDTO: () => WebSocketRequestDTO,
42
+ WebSocketUtility: () => WebSocketUtility,
41
43
  useRealtime: () => useRealtime
42
44
  });
43
45
  module.exports = __toCommonJS(index_exports);
@@ -312,8 +314,8 @@ var WebSocketConnection = class {
312
314
  if (!response.ok) throw new Error(await response.text());
313
315
  return await response.json();
314
316
  }
315
- async SendMessage(serviceMessageDTO) {
316
- const url = `${this.baseUrl}/api/WebSocketConnection/SendMessage`;
317
+ async GetWebSocketRequest(serviceMessageDTO) {
318
+ const url = `${this.baseUrl}/api/WebSocketConnection/GetWebSocketRequest`;
317
319
  const token = localStorage.getItem("auth_token");
318
320
  const requestOptions = {
319
321
  method: "POST",
@@ -329,17 +331,42 @@ var WebSocketConnection = class {
329
331
  }
330
332
  };
331
333
 
334
+ // src/api/Controllers/WebSocketUtility.ts
335
+ var WebSocketUtility = class {
336
+ baseUrl;
337
+ constructor(baseUrl) {
338
+ this.baseUrl = baseUrl;
339
+ }
340
+ async SendMessage(webSocketRequestDTO) {
341
+ const url = `${this.baseUrl}/api/WebSocketUtility/SendMessage`;
342
+ const token = localStorage.getItem("auth_token");
343
+ const requestOptions = {
344
+ method: "POST",
345
+ headers: {
346
+ "Content-Type": "application/json",
347
+ ...token && { Authorization: `Bearer ${token}` }
348
+ },
349
+ body: JSON.stringify(webSocketRequestDTO)
350
+ };
351
+ const response = await fetch(url, requestOptions);
352
+ if (!response.ok) throw new Error(await response.text());
353
+ return await response.json();
354
+ }
355
+ };
356
+
332
357
  // src/api/SparkStudioRealtimeSDK.ts
333
358
  var SparkStudioRealtimeSDK = class {
334
359
  home;
335
360
  roomInstance;
336
361
  userSetting;
337
362
  webSocketConnection;
363
+ webSocketUtility;
338
364
  constructor(baseUrl) {
339
365
  this.home = new Home(baseUrl);
340
366
  this.roomInstance = new RoomInstance(baseUrl);
341
367
  this.userSetting = new UserSetting(baseUrl);
342
368
  this.webSocketConnection = new WebSocketConnection(baseUrl);
369
+ this.webSocketUtility = new WebSocketUtility(baseUrl);
343
370
  }
344
371
  };
345
372
 
@@ -465,6 +492,16 @@ var WebSocketConnectionDTO = class {
465
492
  }
466
493
  };
467
494
 
495
+ // src/api/DTOs/WebSocketRequestDTO.ts
496
+ var WebSocketRequestDTO = class {
497
+ Message;
498
+ Connections;
499
+ constructor(init) {
500
+ this.Message = init.Message;
501
+ this.Connections = init.Connections;
502
+ }
503
+ };
504
+
468
505
  // src/api/Enums/UserStatusType.ts
469
506
  var UserStatusType = /* @__PURE__ */ ((UserStatusType2) => {
470
507
  UserStatusType2[UserStatusType2["Offline"] = 0] = "Offline";
@@ -735,5 +772,7 @@ function HomeContent() {
735
772
  UserStatusType,
736
773
  WebSocketConnection,
737
774
  WebSocketConnectionDTO,
775
+ WebSocketRequestDTO,
776
+ WebSocketUtility,
738
777
  useRealtime
739
778
  });
package/dist/index.d.cts CHANGED
@@ -180,15 +180,17 @@ declare class ServiceMessageDTO implements IServiceMessageDTO {
180
180
  }
181
181
 
182
182
  /**
183
- * Represents an Auto-generated model for OkResultDTO.
183
+ * Represents an Auto-generated model for WebSocketRequestDTO.
184
184
  */
185
- interface IOkResultDTO {
185
+ interface IWebSocketRequestDTO {
186
186
  Message?: string;
187
+ Connections?: WebSocketConnectionDTO[];
187
188
  }
188
- type OkResultDTOInit = Partial<IOkResultDTO>;
189
- declare class OkResultDTO implements IOkResultDTO {
189
+ type WebSocketRequestDTOInit = Partial<IWebSocketRequestDTO>;
190
+ declare class WebSocketRequestDTO implements IWebSocketRequestDTO {
190
191
  Message?: string;
191
- constructor(init: OkResultDTOInit);
192
+ Connections?: WebSocketConnectionDTO[];
193
+ constructor(init: WebSocketRequestDTOInit);
192
194
  }
193
195
 
194
196
  /**
@@ -202,7 +204,28 @@ declare class WebSocketConnection {
202
204
  ReadConnections(userId: Guid): Promise<WebSocketConnectionDTO[]>;
203
205
  ReadUserIdByConnectionId(connectionId: string): Promise<GuidResultDTO>;
204
206
  Clear(): Promise<StringResultDTO>;
205
- SendMessage(serviceMessageDTO: ServiceMessageDTO): Promise<OkResultDTO>;
207
+ GetWebSocketRequest(serviceMessageDTO: ServiceMessageDTO): Promise<WebSocketRequestDTO>;
208
+ }
209
+
210
+ /**
211
+ * Represents an Auto-generated model for OkResultDTO.
212
+ */
213
+ interface IOkResultDTO {
214
+ Message?: string;
215
+ }
216
+ type OkResultDTOInit = Partial<IOkResultDTO>;
217
+ declare class OkResultDTO implements IOkResultDTO {
218
+ Message?: string;
219
+ constructor(init: OkResultDTOInit);
220
+ }
221
+
222
+ /**
223
+ * Auto-generated client for the WebSocketUtility controller.
224
+ */
225
+ declare class WebSocketUtility {
226
+ private baseUrl;
227
+ constructor(baseUrl: string);
228
+ SendMessage(webSocketRequestDTO: WebSocketRequestDTO): Promise<OkResultDTO>;
206
229
  }
207
230
 
208
231
  /**
@@ -213,6 +236,7 @@ declare class SparkStudioRealtimeSDK {
213
236
  roomInstance: RoomInstance;
214
237
  userSetting: UserSetting;
215
238
  webSocketConnection: WebSocketConnection;
239
+ webSocketUtility: WebSocketUtility;
216
240
  constructor(baseUrl: string);
217
241
  }
218
242
 
@@ -251,4 +275,4 @@ declare function useRealtime(url: string): {
251
275
 
252
276
  declare function HomeView(): react_jsx_runtime.JSX.Element;
253
277
 
254
- export { type Guid, GuidResultDTO, GuidUtil, Home, HomeView, type IGuidResultDTO, type IOkResultDTO, type IRoomInstanceDTO, type IRoomInstanceViewDTO, type IServiceMessageDTO, type IStringResultDTO, type IUniqueViewDTO, type IUserSettingDTO, type IWebSocketConnectionDTO, OkResultDTO, RealtimeEngine, type RealtimeEventMap, type RealtimeStatus, RoomInstance, RoomInstanceDTO, RoomInstanceViewDTO, ServiceMessageDTO, SparkStudioRealtimeSDK, StringResultDTO, UniqueViewDTO, UserSetting, UserSettingDTO, UserStatusType, WebSocketConnection, WebSocketConnectionDTO, useRealtime };
278
+ export { type Guid, GuidResultDTO, GuidUtil, Home, HomeView, type IGuidResultDTO, type IOkResultDTO, type IRoomInstanceDTO, type IRoomInstanceViewDTO, type IServiceMessageDTO, type IStringResultDTO, type IUniqueViewDTO, type IUserSettingDTO, type IWebSocketConnectionDTO, type IWebSocketRequestDTO, OkResultDTO, RealtimeEngine, type RealtimeEventMap, type RealtimeStatus, RoomInstance, RoomInstanceDTO, RoomInstanceViewDTO, ServiceMessageDTO, SparkStudioRealtimeSDK, StringResultDTO, UniqueViewDTO, UserSetting, UserSettingDTO, UserStatusType, WebSocketConnection, WebSocketConnectionDTO, WebSocketRequestDTO, WebSocketUtility, useRealtime };
package/dist/index.d.ts CHANGED
@@ -180,15 +180,17 @@ declare class ServiceMessageDTO implements IServiceMessageDTO {
180
180
  }
181
181
 
182
182
  /**
183
- * Represents an Auto-generated model for OkResultDTO.
183
+ * Represents an Auto-generated model for WebSocketRequestDTO.
184
184
  */
185
- interface IOkResultDTO {
185
+ interface IWebSocketRequestDTO {
186
186
  Message?: string;
187
+ Connections?: WebSocketConnectionDTO[];
187
188
  }
188
- type OkResultDTOInit = Partial<IOkResultDTO>;
189
- declare class OkResultDTO implements IOkResultDTO {
189
+ type WebSocketRequestDTOInit = Partial<IWebSocketRequestDTO>;
190
+ declare class WebSocketRequestDTO implements IWebSocketRequestDTO {
190
191
  Message?: string;
191
- constructor(init: OkResultDTOInit);
192
+ Connections?: WebSocketConnectionDTO[];
193
+ constructor(init: WebSocketRequestDTOInit);
192
194
  }
193
195
 
194
196
  /**
@@ -202,7 +204,28 @@ declare class WebSocketConnection {
202
204
  ReadConnections(userId: Guid): Promise<WebSocketConnectionDTO[]>;
203
205
  ReadUserIdByConnectionId(connectionId: string): Promise<GuidResultDTO>;
204
206
  Clear(): Promise<StringResultDTO>;
205
- SendMessage(serviceMessageDTO: ServiceMessageDTO): Promise<OkResultDTO>;
207
+ GetWebSocketRequest(serviceMessageDTO: ServiceMessageDTO): Promise<WebSocketRequestDTO>;
208
+ }
209
+
210
+ /**
211
+ * Represents an Auto-generated model for OkResultDTO.
212
+ */
213
+ interface IOkResultDTO {
214
+ Message?: string;
215
+ }
216
+ type OkResultDTOInit = Partial<IOkResultDTO>;
217
+ declare class OkResultDTO implements IOkResultDTO {
218
+ Message?: string;
219
+ constructor(init: OkResultDTOInit);
220
+ }
221
+
222
+ /**
223
+ * Auto-generated client for the WebSocketUtility controller.
224
+ */
225
+ declare class WebSocketUtility {
226
+ private baseUrl;
227
+ constructor(baseUrl: string);
228
+ SendMessage(webSocketRequestDTO: WebSocketRequestDTO): Promise<OkResultDTO>;
206
229
  }
207
230
 
208
231
  /**
@@ -213,6 +236,7 @@ declare class SparkStudioRealtimeSDK {
213
236
  roomInstance: RoomInstance;
214
237
  userSetting: UserSetting;
215
238
  webSocketConnection: WebSocketConnection;
239
+ webSocketUtility: WebSocketUtility;
216
240
  constructor(baseUrl: string);
217
241
  }
218
242
 
@@ -251,4 +275,4 @@ declare function useRealtime(url: string): {
251
275
 
252
276
  declare function HomeView(): react_jsx_runtime.JSX.Element;
253
277
 
254
- export { type Guid, GuidResultDTO, GuidUtil, Home, HomeView, type IGuidResultDTO, type IOkResultDTO, type IRoomInstanceDTO, type IRoomInstanceViewDTO, type IServiceMessageDTO, type IStringResultDTO, type IUniqueViewDTO, type IUserSettingDTO, type IWebSocketConnectionDTO, OkResultDTO, RealtimeEngine, type RealtimeEventMap, type RealtimeStatus, RoomInstance, RoomInstanceDTO, RoomInstanceViewDTO, ServiceMessageDTO, SparkStudioRealtimeSDK, StringResultDTO, UniqueViewDTO, UserSetting, UserSettingDTO, UserStatusType, WebSocketConnection, WebSocketConnectionDTO, useRealtime };
278
+ export { type Guid, GuidResultDTO, GuidUtil, Home, HomeView, type IGuidResultDTO, type IOkResultDTO, type IRoomInstanceDTO, type IRoomInstanceViewDTO, type IServiceMessageDTO, type IStringResultDTO, type IUniqueViewDTO, type IUserSettingDTO, type IWebSocketConnectionDTO, type IWebSocketRequestDTO, OkResultDTO, RealtimeEngine, type RealtimeEventMap, type RealtimeStatus, RoomInstance, RoomInstanceDTO, RoomInstanceViewDTO, ServiceMessageDTO, SparkStudioRealtimeSDK, StringResultDTO, UniqueViewDTO, UserSetting, UserSettingDTO, UserStatusType, WebSocketConnection, WebSocketConnectionDTO, WebSocketRequestDTO, WebSocketUtility, useRealtime };
package/dist/index.js CHANGED
@@ -268,8 +268,8 @@ var WebSocketConnection = class {
268
268
  if (!response.ok) throw new Error(await response.text());
269
269
  return await response.json();
270
270
  }
271
- async SendMessage(serviceMessageDTO) {
272
- const url = `${this.baseUrl}/api/WebSocketConnection/SendMessage`;
271
+ async GetWebSocketRequest(serviceMessageDTO) {
272
+ const url = `${this.baseUrl}/api/WebSocketConnection/GetWebSocketRequest`;
273
273
  const token = localStorage.getItem("auth_token");
274
274
  const requestOptions = {
275
275
  method: "POST",
@@ -285,17 +285,42 @@ var WebSocketConnection = class {
285
285
  }
286
286
  };
287
287
 
288
+ // src/api/Controllers/WebSocketUtility.ts
289
+ var WebSocketUtility = class {
290
+ baseUrl;
291
+ constructor(baseUrl) {
292
+ this.baseUrl = baseUrl;
293
+ }
294
+ async SendMessage(webSocketRequestDTO) {
295
+ const url = `${this.baseUrl}/api/WebSocketUtility/SendMessage`;
296
+ const token = localStorage.getItem("auth_token");
297
+ const requestOptions = {
298
+ method: "POST",
299
+ headers: {
300
+ "Content-Type": "application/json",
301
+ ...token && { Authorization: `Bearer ${token}` }
302
+ },
303
+ body: JSON.stringify(webSocketRequestDTO)
304
+ };
305
+ const response = await fetch(url, requestOptions);
306
+ if (!response.ok) throw new Error(await response.text());
307
+ return await response.json();
308
+ }
309
+ };
310
+
288
311
  // src/api/SparkStudioRealtimeSDK.ts
289
312
  var SparkStudioRealtimeSDK = class {
290
313
  home;
291
314
  roomInstance;
292
315
  userSetting;
293
316
  webSocketConnection;
317
+ webSocketUtility;
294
318
  constructor(baseUrl) {
295
319
  this.home = new Home(baseUrl);
296
320
  this.roomInstance = new RoomInstance(baseUrl);
297
321
  this.userSetting = new UserSetting(baseUrl);
298
322
  this.webSocketConnection = new WebSocketConnection(baseUrl);
323
+ this.webSocketUtility = new WebSocketUtility(baseUrl);
299
324
  }
300
325
  };
301
326
 
@@ -421,6 +446,16 @@ var WebSocketConnectionDTO = class {
421
446
  }
422
447
  };
423
448
 
449
+ // src/api/DTOs/WebSocketRequestDTO.ts
450
+ var WebSocketRequestDTO = class {
451
+ Message;
452
+ Connections;
453
+ constructor(init) {
454
+ this.Message = init.Message;
455
+ this.Connections = init.Connections;
456
+ }
457
+ };
458
+
424
459
  // src/api/Enums/UserStatusType.ts
425
460
  var UserStatusType = /* @__PURE__ */ ((UserStatusType2) => {
426
461
  UserStatusType2[UserStatusType2["Offline"] = 0] = "Offline";
@@ -695,5 +730,7 @@ export {
695
730
  UserStatusType,
696
731
  WebSocketConnection,
697
732
  WebSocketConnectionDTO,
733
+ WebSocketRequestDTO,
734
+ WebSocketUtility,
698
735
  useRealtime
699
736
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkstudio/realtime-ui",
3
- "version": "1.0.26",
3
+ "version": "1.0.29",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",