@huddle01/observer-client-sdk
Advanced tools
Comparing version 0.11.1-8ae550a.0 to 0.11.1-900de1d.0
@@ -26,2 +26,3 @@ import { DashboardDataStreamNotification } from './protocols/DashboardMessageProtocol'; | ||
private _rows; | ||
private _reject?; | ||
constructor(config: ObserverDashboardDataStreamConfig, _channel: WebSocketConnector, _sortFn?: ((a: T, b: T) => number) | undefined); | ||
@@ -28,0 +29,0 @@ get id(): string; |
@@ -17,2 +17,3 @@ "use strict"; | ||
_rows = []; | ||
_reject; | ||
constructor(config, _channel, _sortFn) { | ||
@@ -50,3 +51,9 @@ super(); | ||
this._opened = true; | ||
let error; | ||
const listener = (err) => (error = err); | ||
this.once('streamerror', listener); | ||
await this._request('update', {}).then(() => void 0); | ||
this.off('streamerror', listener); | ||
if (error) | ||
throw new Error(error); | ||
if (this._sortFn) | ||
@@ -53,0 +60,0 @@ this._rows.sort(this._sortFn); |
@@ -7,2 +7,3 @@ import { ObserverDashboardDataStream } from './ObservedDashboardDataStream'; | ||
import { CallSnapshot, ClientSnapshot } from './protocols/CallSnapshotSchema'; | ||
import { ReportSchemas } from './datastreams/ReportSchemas'; | ||
export type ObserverDashboardClientConfig = { | ||
@@ -35,3 +36,12 @@ connection: WebSocketConnectorConfig; | ||
getSummaryStats(params: DashboardQueryOperations['getSummaryStats']): Promise<GetSummaryResponsePayload>; | ||
getTurnStats(params: DashboardQueryOperations['getTurnStats']): Promise<GetSummaryResponsePayload>; | ||
/** | ||
* @deprecated Use createReportsFrame instead loading reports from bucket | ||
* @param resourceId | ||
* @param conditions | ||
* @param updateOnCreate | ||
* @returns | ||
*/ | ||
createDatabaseFrame<K extends keyof DatabaseFrameSchema>(resourceId: K, conditions: DatabaseFrameConditions<DatabaseFrameSchema[K]>, updateOnCreate?: boolean): Promise<ObserverDashboardDataStream<DatabaseFrameSchema[K]>>; | ||
createReportsFrame<K extends keyof ReportSchemas>(reportType: K, settings: ReportSchemas[K]['request']): Promise<ObserverDashboardDataStream<ReportSchemas[K]["response"]>>; | ||
createCallSnapshotsFrame(callId: string): Promise<ObserverDashboardDataStream<CallSnapshot>>; | ||
@@ -38,0 +48,0 @@ createClientSnapshotsFrame(options: { |
@@ -68,2 +68,17 @@ "use strict"; | ||
} | ||
async getTurnStats(params) { | ||
return this.connection.request({ | ||
request: new DashboardMessageProtocol_1.DashboardQueryRequest((0, uuid_1.v4)(), { | ||
method: 'getTurnStats', | ||
parameters: params, | ||
}), | ||
}); | ||
} | ||
/** | ||
* @deprecated Use createReportsFrame instead loading reports from bucket | ||
* @param resourceId | ||
* @param conditions | ||
* @param updateOnCreate | ||
* @returns | ||
*/ | ||
async createDatabaseFrame(resourceId, conditions, updateOnCreate = true) { | ||
@@ -87,2 +102,23 @@ const dataStreamId = object_hash_1.default.sha1({ connectionId: this.connection.id, conditions, resourceId }); | ||
} | ||
async createReportsFrame(reportType, settings) { | ||
const dataStreamId = object_hash_1.default.sha1({ connectionId: this.connection.id, reportType, settings }); | ||
if (this._dataStreams.has(dataStreamId)) { | ||
const dataFramePromise = this._dataStreams.get(dataStreamId); | ||
if (dataFramePromise) | ||
return dataFramePromise; | ||
} | ||
const create = () => new ObservedDashboardDataStream_1.ObserverDashboardDataStream({ | ||
dataStreamId, | ||
}, this.connection); | ||
const result = await this._createDataStream({ | ||
dataStreamId, | ||
resourceId: DashboardMessageProtocol_1.protocolMeta.dataStreams.reportsResourceId, | ||
create, | ||
parameters: { | ||
reportType, | ||
...settings, | ||
}, | ||
}, true); | ||
return result; | ||
} | ||
async createCallSnapshotsFrame(callId) { | ||
@@ -89,0 +125,0 @@ if (this._dataStreams.has(callId)) { |
@@ -9,2 +9,3 @@ import { CallSnapshot } from "./CallSnapshotSchema"; | ||
clientSnapshotResourceId: string; | ||
reportsResourceId: string; | ||
}; | ||
@@ -144,2 +145,12 @@ }>; | ||
export type GetServerStatesResponsePayload = ObserverServerState[]; | ||
export type GetTurnStatsResponsePayload = { | ||
[K in string]: { | ||
totalBytesSent: number; | ||
totalBytesReceived: number; | ||
totalPacketsSent: number; | ||
totalPacketsReceived: number; | ||
inboundBitrate: number; | ||
outboundBitrate: number; | ||
}; | ||
}; | ||
export type DashboardQueryOperations = { | ||
@@ -153,5 +164,11 @@ findCalls: { | ||
transportId?: string; | ||
producerId?: string; | ||
consumerId?: string; | ||
}; | ||
ongoingCals: undefined; | ||
ongoingCalls: undefined; | ||
getTurnStats: { | ||
startDate: number; | ||
endDate?: number; | ||
}; | ||
getSummaryStats: { | ||
@@ -158,0 +175,0 @@ startDate: number; |
@@ -10,2 +10,3 @@ "use strict"; | ||
clientSnapshotResourceId: 'client-snapshot', | ||
reportsResourceId: 'reports', | ||
} | ||
@@ -12,0 +13,0 @@ }); |
{ | ||
"name": "@huddle01/observer-client-sdk", | ||
"version": "0.11.1-8ae550a.0", | ||
"version": "0.11.1-900de1d.0", | ||
"description": "ObserverDashboardClient SDK", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
183931
45
3801