Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@huddle01/observer-client-sdk

Package Overview
Dependencies
Maintainers
0
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@huddle01/observer-client-sdk - npm Package Compare versions

Comparing version 0.11.1-a57cde1.0 to 0.11.1-a7290ed.0

lib/datastreams/ReportSchemas.d.ts

2

lib/index.d.ts

@@ -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 @@ }

@@ -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,11 @@ connection: WebSocketConnectorConfig;

getSummaryStats(params: DashboardQueryOperations['getSummaryStats']): 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 +47,0 @@ createClientSnapshotsFrame(options: {

@@ -68,6 +68,13 @@ "use strict";

}
/**
* @deprecated Use createReportsFrame instead loading reports from bucket
* @param resourceId
* @param conditions
* @param updateOnCreate
* @returns
*/
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 +84,6 @@ return dataFramePromise;

const create = () => new ObservedDashboardDataStream_1.ObserverDashboardDataStream({
dataFrameId,
dataStreamId,
}, this.connection);
const result = await this._createDataStream({
dataStreamId: dataFrameId,
dataStreamId,
resourceId,

@@ -88,2 +95,23 @@ create,

}
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) {

@@ -95,7 +123,8 @@ if (this._dataStreams.has(callId)) {

}
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,

@@ -116,7 +145,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,

@@ -123,0 +153,0 @@ create,

@@ -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 @@ });

@@ -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-a57cde1.0",
"version": "0.11.1-a7290ed.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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc