@huddle01/observer-client-sdk
Advanced tools
Comparing version 0.11.1-1ccf3ca.0 to 0.11.1-22baef5.0
@@ -7,3 +7,3 @@ import { DashboardDataStreamNotification } from './protocols/DashboardMessageProtocol'; | ||
newrow: [row: T]; | ||
error: [error: string]; | ||
streamerror: [error: string]; | ||
}; | ||
@@ -10,0 +10,0 @@ export type ObserverDashboardDataStreamConfig = { |
@@ -86,4 +86,4 @@ "use strict"; | ||
} | ||
case 'error': { | ||
this.emit('error', event.payload); | ||
case 'streamerror': { | ||
this.emit('streamerror', event.payload); | ||
break; | ||
@@ -90,0 +90,0 @@ } |
@@ -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; | ||
}; | ||
@@ -53,8 +54,2 @@ }>; | ||
}[]; | ||
dataStreams: { | ||
streamType: string; | ||
streamId: string; | ||
instanceType: 'dataCollector' | 'dataSource'; | ||
collectedBytes: number; | ||
}[]; | ||
jobRouter: { | ||
@@ -67,2 +62,36 @@ createdAt: number; | ||
}; | ||
streamRouter: { | ||
emitter: { | ||
numberOfSubscriptions: number; | ||
numberOfSentEventInvocations: number; | ||
numberOfReceivedEventInvocations: number; | ||
}; | ||
sinks: { | ||
sinkId: string; | ||
streamId: string; | ||
state: string; | ||
streamProviderPeerId?: string; | ||
}[]; | ||
streamProviders: { | ||
streamType: string; | ||
bytesHighWaterMark: number; | ||
bytesLowWaterMark: number; | ||
totalBytes: number; | ||
collectors: { | ||
createdAt: number; | ||
streamId: string; | ||
numberOfFilesUploaded: number; | ||
numberOfSinks: number; | ||
collectedBytes: number; | ||
}[]; | ||
sources: { | ||
createdAt: number; | ||
streamId: string; | ||
numberOfFilesDownloaded: number; | ||
numberOfSinks: number; | ||
activeClosingTimer: boolean; | ||
collectedBytes: number; | ||
}[]; | ||
}[]; | ||
}; | ||
stats: { | ||
@@ -118,2 +147,12 @@ consumedSamples: number; | ||
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 = { | ||
@@ -127,5 +166,11 @@ findCalls: { | ||
transportId?: string; | ||
producerId?: string; | ||
consumerId?: string; | ||
}; | ||
ongoingCals: undefined; | ||
ongoingCalls: undefined; | ||
getTurnStats: { | ||
startDate: number; | ||
endDate?: number; | ||
}; | ||
getSummaryStats: { | ||
@@ -169,3 +214,3 @@ startDate: number; | ||
data: unknown; | ||
error: string; | ||
streamerror: string; | ||
close: undefined; | ||
@@ -172,0 +217,0 @@ }; |
@@ -10,2 +10,3 @@ "use strict"; | ||
clientSnapshotResourceId: 'client-snapshot', | ||
reportsResourceId: 'reports', | ||
} | ||
@@ -12,0 +13,0 @@ }); |
@@ -161,3 +161,3 @@ "use strict"; | ||
} | ||
console.warn('sending request', pendingRequest.request); | ||
// console.warn('sending request', pendingRequest.request); | ||
this._pendingRequests.set(pendingRequest.request.requestId, pendingRequest); | ||
@@ -164,0 +164,0 @@ this._socket?.send(this._codec.encode(pendingRequest.request)); |
{ | ||
"name": "@huddle01/observer-client-sdk", | ||
"version": "0.11.1-1ccf3ca.0", | ||
"version": "0.11.1-22baef5.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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
183652
45
3793