@observertc/observer-js 0.30.5-beta → 0.40.0-beta
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/lib/CallSummary.d.ts +22 -0
- package/lib/CallSummary.d.ts.map +1 -0
- package/lib/ObservedCall.d.ts +6 -13
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +24 -104
- package/lib/ObservedClient.d.ts +16 -27
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +360 -523
- package/lib/ObservedInboundTrack.d.ts +3 -8
- package/lib/ObservedInboundTrack.d.ts.map +1 -1
- package/lib/ObservedInboundTrack.js +74 -154
- package/lib/ObservedOutboundTrack.d.ts +9 -8
- package/lib/ObservedOutboundTrack.d.ts.map +1 -1
- package/lib/ObservedOutboundTrack.js +76 -130
- package/lib/ObservedPeerConnection.d.ts +17 -15
- package/lib/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/ObservedPeerConnection.js +64 -173
- package/lib/ObservedSfu.d.ts +14 -4
- package/lib/ObservedSfu.d.ts.map +1 -1
- package/lib/ObservedSfu.js +37 -50
- package/lib/Observer.d.ts +5 -6
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +28 -31
- package/lib/common/types.d.ts +0 -55
- package/lib/common/types.d.ts.map +1 -1
- package/lib/index.d.ts +5 -7
- package/lib/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/CallSummary.ts +23 -0
- package/src/ObservedCall.ts +27 -87
- package/src/ObservedClient.ts +425 -582
- package/src/ObservedInboundTrack.ts +14 -65
- package/src/ObservedOutboundTrack.ts +32 -53
- package/src/ObservedPeerConnection.ts +55 -117
- package/src/ObservedSfu.ts +45 -27
- package/src/Observer.ts +11 -16
- package/src/common/types.ts +0 -69
- package/src/index.ts +5 -7
- package/lib/models/Models.d.ts +0 -642
- package/lib/models/Models.d.ts.map +0 -1
- package/lib/models/Models.js +0 -481
- package/lib/models/samples_pb.d.ts +0 -2452
- package/lib/models/samples_pb.d.ts.map +0 -1
- package/lib/models/samples_pb.js +0 -1495
- package/lib/storages/ObserverStorage.d.ts +0 -87
- package/lib/storages/ObserverStorage.d.ts.map +0 -1
- package/lib/storages/SimpleStorage.d.ts +0 -19
- package/lib/storages/SimpleStorage.d.ts.map +0 -1
- package/lib/storages/SimpleStorage.js +0 -106
- package/lib/storages/StorageProvider.d.ts +0 -16
- package/lib/storages/StorageProvider.d.ts.map +0 -1
- package/lib/storages/StorageProvider.js +0 -29
- package/src/models/Models.ts +0 -1103
- package/src/models/samples_pb.ts +0 -4061
- package/src/storages/ObserverStorage.ts +0 -99
- package/src/storages/SimpleStorage.ts +0 -120
- package/src/storages/StorageProvider.ts +0 -42
- /package/lib/{storages/ObserverStorage.js → CallSummary.js} +0 -0
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `ObserverStorage` interface defines the methods used for managing storage of key-value pairs.
|
|
3
|
-
*/
|
|
4
|
-
export interface ObserverStorage<K, V> {
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The identifier of the storage
|
|
8
|
-
*/
|
|
9
|
-
readonly id: string;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Returns the number of entries the storage has.
|
|
13
|
-
*/
|
|
14
|
-
size(): Promise<number>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Clears the storage and evicts all entries.
|
|
18
|
-
*/
|
|
19
|
-
clear(): Promise<void>;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Retrieves the value associated with the given key or returns undefined if the entry is not found.
|
|
23
|
-
*
|
|
24
|
-
* @param key The key to be accessed in the storage.
|
|
25
|
-
* @returns The value or undefined if the entry was not found.
|
|
26
|
-
*/
|
|
27
|
-
get(key: K): Promise<V | undefined>;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Retrieves a map filled with key-value pairs found in the storage for the given keys.
|
|
31
|
-
*
|
|
32
|
-
* @param keys A set of keys to be retrieved from the storage.
|
|
33
|
-
* @returns A ReadonlyMap containing the key-value pairs found in the storage.
|
|
34
|
-
*/
|
|
35
|
-
getAll(keys: Iterable<K>): Promise<ReadonlyMap<K, V>>;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Sets the value for the specified key and returns the previous value or undefined.
|
|
39
|
-
*
|
|
40
|
-
* @param key The key to be set.
|
|
41
|
-
* @param value The value to be set.
|
|
42
|
-
* @returns The previous value or undefined.
|
|
43
|
-
*/
|
|
44
|
-
set(key: K, value: V): Promise<V | undefined>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Sets all the key-value pairs in the provided ReadonlyMap.
|
|
48
|
-
*
|
|
49
|
-
* @param entries A ReadonlyMap containing the key-value pairs to be set.
|
|
50
|
-
* @returns A Promise of the ReadonlyMap containing the key-value pairs.
|
|
51
|
-
*/
|
|
52
|
-
setAll(entries: ReadonlyMap<K, V>): Promise<ReadonlyMap<K, V>>;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Inserts a key-value pair only if the key does not already exist and returns the value or undefined.
|
|
56
|
-
*
|
|
57
|
-
* @param key The key to be inserted.
|
|
58
|
-
* @param value The value to be inserted.
|
|
59
|
-
* @returns The value already stored in the storage, or undefined if there was no value stored for the given key.
|
|
60
|
-
*/
|
|
61
|
-
insert(key: K, value: V): Promise<V | undefined>;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Inserts all key-value pairs in the provided ReadonlyMap only if the keys do not already exist.
|
|
65
|
-
* Returns a ReadonlyMap containing the values already stored in the storage for the given keys,
|
|
66
|
-
* or undefined for each key that had no value stored.
|
|
67
|
-
*
|
|
68
|
-
* @param entries A ReadonlyMap containing the key-value pairs to be inserted.
|
|
69
|
-
* @returns A Promise of the ReadonlyMap containing the values already stored in the storage for the given keys,
|
|
70
|
-
* or undefined for each key that had no value stored.
|
|
71
|
-
*/
|
|
72
|
-
insertAll(entries: ReadonlyMap<K, V>): Promise<ReadonlyMap<K, V | undefined>>;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Removes the key-value pair associated with the specified key and returns the removed value or undefined.
|
|
76
|
-
*
|
|
77
|
-
* @param key The key to be removed.
|
|
78
|
-
* @returns The removed value or undefined.
|
|
79
|
-
*/
|
|
80
|
-
remove(key: K): Promise<V | undefined>;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Removes all key-value pairs associated with the specified keys and returns a ReadonlyMap of the removed pairs.
|
|
84
|
-
*
|
|
85
|
-
* @param keys An iterable of keys to be removed.
|
|
86
|
-
* @returns A Promise of the ReadonlyMap containing the removed key-value pairs.
|
|
87
|
-
*/
|
|
88
|
-
removeAll(keys: Iterable<K>): Promise<ReadonlyMap<K, V>>;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Returns an async iterable iterator for the key-value pairs in the storage.
|
|
92
|
-
*/
|
|
93
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<[K, V]>;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Returns an iterable iterator for the key-value pairs stored in this local instance of the storage.
|
|
97
|
-
*/
|
|
98
|
-
localEntries(): IterableIterator<[K, V]>;
|
|
99
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { ObserverStorage } from './ObserverStorage';
|
|
2
|
-
|
|
3
|
-
export class SimpleStorage<K, V> implements ObserverStorage<K, V> {
|
|
4
|
-
private _map = new Map<K, V>();
|
|
5
|
-
|
|
6
|
-
public constructor(public readonly id: string) {}
|
|
7
|
-
|
|
8
|
-
public size(): Promise<number> {
|
|
9
|
-
return Promise.resolve(this._map.size);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
public clear(): Promise<void> {
|
|
13
|
-
this._map.clear();
|
|
14
|
-
|
|
15
|
-
return Promise.resolve();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public get(key: K): Promise<V | undefined> {
|
|
19
|
-
return Promise.resolve(this._map.get(key));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public getAll(keys: Iterable<K>): Promise<ReadonlyMap<K, V>> {
|
|
23
|
-
const result = new Map<K, V>();
|
|
24
|
-
|
|
25
|
-
for (const key of keys) {
|
|
26
|
-
const value = this._map.get(key);
|
|
27
|
-
|
|
28
|
-
if (value) {
|
|
29
|
-
result.set(key, value);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return Promise.resolve(result);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public set(key: K, value: V): Promise<V | undefined> {
|
|
37
|
-
const result = this._map.get(key);
|
|
38
|
-
|
|
39
|
-
this._map.set(key, value);
|
|
40
|
-
|
|
41
|
-
return Promise.resolve(result);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public setAll(entries: ReadonlyMap<K, V>): Promise<ReadonlyMap<K, V>> {
|
|
45
|
-
const result = new Map<K, V>();
|
|
46
|
-
|
|
47
|
-
for (const [ key, value ] of entries) {
|
|
48
|
-
const oldValue = this._map.get(key);
|
|
49
|
-
|
|
50
|
-
if (oldValue) {
|
|
51
|
-
result.set(key, oldValue);
|
|
52
|
-
}
|
|
53
|
-
this._map.set(key, value);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return Promise.resolve(result);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public insert(key: K, value: V): Promise<V | undefined> {
|
|
60
|
-
const result = this._map.get(key);
|
|
61
|
-
|
|
62
|
-
if (result) {
|
|
63
|
-
return Promise.resolve(result);
|
|
64
|
-
}
|
|
65
|
-
this._map.set(key, value);
|
|
66
|
-
|
|
67
|
-
return Promise.resolve(undefined);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public insertAll(entries: ReadonlyMap<K, V>): Promise<ReadonlyMap<K, V>> {
|
|
71
|
-
const result = new Map<K, V>();
|
|
72
|
-
|
|
73
|
-
for (const [ key, value ] of entries) {
|
|
74
|
-
const oldValue = this._map.get(key);
|
|
75
|
-
|
|
76
|
-
if (oldValue) {
|
|
77
|
-
result.set(key, oldValue);
|
|
78
|
-
} else {
|
|
79
|
-
this._map.set(key, value);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return Promise.resolve(result);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public remove(key: K): Promise<V | undefined> {
|
|
87
|
-
const result = this._map.get(key);
|
|
88
|
-
|
|
89
|
-
this._map.delete(key);
|
|
90
|
-
|
|
91
|
-
return Promise.resolve(result);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public removeAll(keys: Iterable<K>): Promise<ReadonlyMap<K, V>> {
|
|
95
|
-
const result = new Map<K, V>();
|
|
96
|
-
|
|
97
|
-
for (const key of keys) {
|
|
98
|
-
const value = this._map.get(key);
|
|
99
|
-
|
|
100
|
-
this._map.delete(key);
|
|
101
|
-
if (value) {
|
|
102
|
-
result.set(key, value);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return Promise.resolve(result);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
public async *[Symbol.asyncIterator](): AsyncIterableIterator<[K, V]> {
|
|
110
|
-
await Promise.resolve();
|
|
111
|
-
|
|
112
|
-
for (const entry of this._map.entries()) {
|
|
113
|
-
yield entry;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
public localEntries(): IterableIterator<[K, V]> {
|
|
118
|
-
return this._map.entries();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ObserverStorage } from './ObserverStorage';
|
|
2
|
-
import * as Models from '../models/Models';
|
|
3
|
-
import { SimpleStorage } from './SimpleStorage';
|
|
4
|
-
|
|
5
|
-
export interface StorageProvider {
|
|
6
|
-
readonly callStorage: ObserverStorage<string, Models.Call>;
|
|
7
|
-
readonly clientStorage: ObserverStorage<string, Models.Client>;
|
|
8
|
-
readonly peerConnectionStorage: ObserverStorage<string, Models.PeerConnection>;
|
|
9
|
-
readonly inboundTrackStorage: ObserverStorage<string, Models.InboundTrack>;
|
|
10
|
-
readonly outboundTrackStorage: ObserverStorage<string, Models.OutboundTrack>;
|
|
11
|
-
readonly sfuStorage: ObserverStorage<string, Models.Sfu>;
|
|
12
|
-
readonly sfuTransportStorage: ObserverStorage<string, Models.SfuTransport>;
|
|
13
|
-
readonly sfuInboundRtpPadStorage: ObserverStorage<string, Models.SfuInboundRtpPad>;
|
|
14
|
-
readonly sfuOutboundRtpPadStorage: ObserverStorage<string, Models.SfuOutboundRtpPad>;
|
|
15
|
-
readonly sfuSctpChannelStorage: ObserverStorage<string, Models.SfuSctpChannel>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function createSimpleStorageProvider(): StorageProvider {
|
|
19
|
-
const callStorage = new SimpleStorage<string, Models.Call>('ObserverCallStorage');
|
|
20
|
-
const clientStorage = new SimpleStorage<string, Models.Client>('ObserverClientStorage');
|
|
21
|
-
const peerConnectionStorage = new SimpleStorage<string, Models.PeerConnection>('ObserverPeerConnectionStorage');
|
|
22
|
-
const inboundTrackStorage = new SimpleStorage<string, Models.InboundTrack>('ObserverInboundTrackStorage');
|
|
23
|
-
const outboundTrackStorage = new SimpleStorage<string, Models.OutboundTrack>('ObserverOutboundTrackStorage');
|
|
24
|
-
const sfuStorage = new SimpleStorage<string, Models.Sfu>('ObserverSfuStorage');
|
|
25
|
-
const sfuTransportStorage = new SimpleStorage<string, Models.SfuTransport>('ObserverSfuTransportStorage');
|
|
26
|
-
const sfuInboundRtpPadStorage = new SimpleStorage<string, Models.SfuInboundRtpPad>('ObserverSfuInboundRtpPadStorage');
|
|
27
|
-
const sfuOutboundRtpPadStorage = new SimpleStorage<string, Models.SfuOutboundRtpPad>('ObserverSfuOutboundRtpPadStorage');
|
|
28
|
-
const sfuSctpChannelStorage = new SimpleStorage<string, Models.SfuSctpChannel>('ObserverSfuSctpChannelStorage');
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
callStorage,
|
|
32
|
-
clientStorage,
|
|
33
|
-
peerConnectionStorage,
|
|
34
|
-
inboundTrackStorage,
|
|
35
|
-
outboundTrackStorage,
|
|
36
|
-
sfuStorage,
|
|
37
|
-
sfuTransportStorage,
|
|
38
|
-
sfuInboundRtpPadStorage,
|
|
39
|
-
sfuOutboundRtpPadStorage,
|
|
40
|
-
sfuSctpChannelStorage,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
File without changes
|