@huddle01/observer-client-sdk
Advanced tools
Comparing version 0.11.1-1a6f2a1.0 to 0.11.1-1c57ec4.0
@@ -5,3 +5,3 @@ export { ObserverDashboardClient, ObserverDashboardClientConfig, ObserverDashboardClientEventMap, } from './ObserverDashboardClient'; | ||
export { DatabaseFrameSchema, DatabaseFrameConditions, } from './datastreams/DatabaseFrame'; | ||
export { ObserverDashboardDataStream, DataFrameConfig, ObserverDashboardDataStreamEventsMap, } from './ObservedDashboardDataStream'; | ||
export { ObserverDashboardDataStream, ObserverDashboardDataStreamConfig as DataFrameConfig, ObserverDashboardDataStreamEventsMap, } from './ObservedDashboardDataStream'; | ||
export { ObserverDashboardAdminClient } from './ObserverDashboardAdminClient'; | ||
@@ -8,0 +8,0 @@ export { DashboardQueryRequest, DashboardNotification, DashboardMessage, } from './protocols/DashboardMessageProtocol'; |
@@ -7,6 +7,6 @@ import { DashboardDataStreamNotification } from './protocols/DashboardMessageProtocol'; | ||
newrow: [row: T]; | ||
error: [error: string]; | ||
streamerror: [error: string]; | ||
}; | ||
export type DataFrameConfig = { | ||
dataFrameId: string; | ||
export type ObserverDashboardDataStreamConfig = { | ||
dataStreamId: string; | ||
}; | ||
@@ -20,3 +20,3 @@ export declare interface ObserverDashboardDataStream<T> { | ||
export declare class ObserverDashboardDataStream<T> extends EventEmitter { | ||
readonly config: DataFrameConfig; | ||
readonly config: ObserverDashboardDataStreamConfig; | ||
private readonly _channel; | ||
@@ -28,3 +28,3 @@ private readonly _sortFn?; | ||
private _rows; | ||
constructor(config: DataFrameConfig, _channel: WebSocketConnector, _sortFn?: ((a: T, b: T) => number) | undefined); | ||
constructor(config: ObserverDashboardDataStreamConfig, _channel: WebSocketConnector, _sortFn?: ((a: T, b: T) => number) | undefined); | ||
get id(): string; | ||
@@ -31,0 +31,0 @@ get rows(): T[]; |
@@ -24,3 +24,3 @@ "use strict"; | ||
get id() { | ||
return this.config.dataFrameId; | ||
return this.config.dataStreamId; | ||
} | ||
@@ -62,3 +62,3 @@ get rows() { | ||
...parameters, | ||
dataStreamId: this.config.dataFrameId, | ||
dataStreamId: this.config.dataStreamId, | ||
}, | ||
@@ -71,3 +71,3 @@ }), | ||
return this._channel.notify({ | ||
message: new DashboardMessageProtocol_1.DashboardDataStreamNotification(this.config.dataFrameId, event), | ||
message: new DashboardMessageProtocol_1.DashboardDataStreamNotification(this.config.dataStreamId, event), | ||
}); | ||
@@ -89,4 +89,4 @@ } | ||
} | ||
case 'error': { | ||
this.emit('error', event.payload); | ||
case 'streamerror': { | ||
this.emit('streamerror', event.payload); | ||
break; | ||
@@ -93,0 +93,0 @@ } |
@@ -69,5 +69,5 @@ "use strict"; | ||
async createDatabaseFrame(resourceId, conditions, updateOnCreate = true) { | ||
const dataFrameId = object_hash_1.default.sha1({ conditions, resourceId }); | ||
if (this._dataStreams.has(dataFrameId)) { | ||
const dataFramePromise = this._dataStreams.get(dataFrameId); | ||
const dataStreamId = object_hash_1.default.sha1({ connectionId: this.connection.id, conditions, resourceId }); | ||
if (this._dataStreams.has(dataStreamId)) { | ||
const dataFramePromise = this._dataStreams.get(dataStreamId); | ||
if (dataFramePromise) | ||
@@ -77,6 +77,6 @@ return dataFramePromise; | ||
const create = () => new ObservedDashboardDataStream_1.ObserverDashboardDataStream({ | ||
dataFrameId, | ||
dataStreamId, | ||
}, this.connection); | ||
const result = await this._createDataStream({ | ||
dataStreamId: dataFrameId, | ||
dataStreamId, | ||
resourceId, | ||
@@ -94,7 +94,8 @@ create, | ||
} | ||
const dataStreamId = `${this.connection.id}-${callId}`; | ||
const create = () => new ObservedDashboardDataStream_1.ObserverDashboardDataStream({ | ||
dataFrameId: callId, | ||
dataStreamId, | ||
}, this.connection); | ||
const result = await this._createDataStream({ | ||
dataStreamId: callId, | ||
dataStreamId, | ||
resourceId: DashboardMessageProtocol_1.protocolMeta.dataStreams.callSnapshotResourceId, | ||
@@ -115,7 +116,8 @@ create, | ||
} | ||
const dataStreamId = `${this.connection.id}-${clientId}`; | ||
const create = () => new ObservedDashboardDataStream_1.ObserverDashboardDataStream({ | ||
dataFrameId: clientId, | ||
dataStreamId, | ||
}, this.connection); | ||
const result = await this._createDataStream({ | ||
dataStreamId: clientId, | ||
dataStreamId, | ||
resourceId: DashboardMessageProtocol_1.protocolMeta.dataStreams.clientSnapshotResourceId, | ||
@@ -122,0 +124,0 @@ create, |
@@ -52,8 +52,2 @@ import { CallSnapshot } from "./CallSnapshotSchema"; | ||
}[]; | ||
dataStreams: { | ||
streamType: string; | ||
streamId: string; | ||
instanceType: 'dataCollector' | 'dataSource'; | ||
collectedBytes: number; | ||
}[]; | ||
jobRouter: { | ||
@@ -66,2 +60,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: { | ||
@@ -166,3 +194,3 @@ consumedSamples: number; | ||
data: unknown; | ||
error: string; | ||
streamerror: string; | ||
close: undefined; | ||
@@ -169,0 +197,0 @@ }; |
@@ -20,2 +20,3 @@ import EventEmitter from 'events'; | ||
export type WebSocketConnectorConfig = { | ||
id?: string; | ||
url: string; | ||
@@ -35,2 +36,3 @@ getAccessToken?: () => Promise<string | undefined>; | ||
constructor(config: WebSocketConnectorConfig); | ||
get id(): string | undefined; | ||
get accessToken(): string | undefined; | ||
@@ -37,0 +39,0 @@ get state(): WebSocketConnectorState; |
@@ -12,2 +12,3 @@ "use strict"; | ||
const logger_1 = require("./common/logger"); | ||
const uuid_1 = require("uuid"); | ||
const logger = (0, logger_1.createLogger)('WebSocketConnector'); | ||
@@ -29,3 +30,9 @@ const MAX_CONNECTION_TIMEOUT_IN_SEC = 15; | ||
this.config = config; | ||
if (!this.config.id) { | ||
this.config.id = (0, uuid_1.v4)(); | ||
} | ||
} | ||
get id() { | ||
return this.config.id; | ||
} | ||
get accessToken() { | ||
@@ -156,3 +163,3 @@ return this._accessToken; | ||
} | ||
console.warn('sending request', pendingRequest.request); | ||
// console.warn('sending request', pendingRequest.request); | ||
this._pendingRequests.set(pendingRequest.request.requestId, pendingRequest); | ||
@@ -159,0 +166,0 @@ this._socket?.send(this._codec.encode(pendingRequest.request)); |
{ | ||
"name": "@huddle01/observer-client-sdk", | ||
"version": "0.11.1-1a6f2a1.0", | ||
"version": "0.11.1-1c57ec4.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
175542
3635