@observertc/observer-js 0.9.21-beta → 0.9.23-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/.eslintrc.json +143 -0
- package/lib/Evaluator.d.ts.map +1 -1
- package/lib/Evaluator.js +54 -47
- package/lib/Observer.d.ts +1404 -38
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +479 -176
- package/lib/common/Semaphore.d.ts.map +1 -1
- package/lib/common/callMetaReports.d.ts.map +1 -1
- package/lib/common/callMetaReports.js +1 -0
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +15 -15
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +12 -1
- package/lib/entries/CallEntry.d.ts +611 -0
- package/lib/entries/CallEntry.d.ts.map +1 -0
- package/lib/entries/CallEntry.js +75 -0
- package/lib/entries/ClientEntry.d.ts +474 -0
- package/lib/entries/ClientEntry.d.ts.map +1 -0
- package/lib/entries/ClientEntry.js +101 -0
- package/lib/entries/InboundTrackEntry.d.ts +670 -0
- package/lib/entries/InboundTrackEntry.d.ts.map +1 -0
- package/lib/entries/InboundTrackEntry.js +76 -0
- package/lib/entries/OutboundTrackEntry.d.ts +670 -0
- package/lib/entries/OutboundTrackEntry.d.ts.map +1 -0
- package/lib/entries/OutboundTrackEntry.js +73 -0
- package/lib/entries/PeerConnectionEntry.d.ts +469 -0
- package/lib/entries/PeerConnectionEntry.d.ts.map +1 -0
- package/lib/entries/PeerConnectionEntry.js +144 -0
- package/lib/entries/SfuEntry.d.ts +150 -0
- package/lib/entries/SfuEntry.d.ts.map +1 -0
- package/lib/entries/SfuEntry.js +77 -0
- package/lib/entries/SfuInboundRtpPadEntry.d.ts +14 -0
- package/lib/entries/SfuInboundRtpPadEntry.d.ts.map +1 -0
- package/lib/entries/SfuInboundRtpPadEntry.js +49 -0
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts +14 -0
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts.map +1 -0
- package/lib/entries/SfuOutboundRtpPadEntry.js +47 -0
- package/lib/entries/SfuSctpChannelEntry.d.ts +12 -0
- package/lib/entries/SfuSctpChannelEntry.d.ts.map +1 -0
- package/lib/entries/SfuSctpChannelEntry.js +43 -0
- package/lib/entries/SfuTransportEntry.d.ts +82 -0
- package/lib/entries/SfuTransportEntry.d.ts.map +1 -0
- package/lib/entries/SfuTransportEntry.js +122 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/middlewares/CallOperationsContext.d.ts.map +1 -1
- package/lib/middlewares/CallOperationsContext.js +2 -6
- package/lib/middlewares/CallProcessor.d.ts.map +1 -1
- package/lib/middlewares/CallProcessor.js +15 -6
- package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +1 -1
- package/lib/middlewares/CommitTransactionMiddleware.js +22 -26
- package/lib/middlewares/DeleteOutdatedCallEntries.d.ts.map +1 -1
- package/lib/middlewares/DeleteOutdatedCallEntries.js +29 -20
- package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts.map +1 -1
- package/lib/middlewares/DeleteOutdatedSfuEntries.js +27 -18
- package/lib/middlewares/Middleware.d.ts.map +1 -1
- package/lib/middlewares/Middleware.js +13 -4
- package/lib/middlewares/Processor.d.ts.map +1 -1
- package/lib/middlewares/Processor.js +18 -9
- package/lib/middlewares/TransactionContext.d.ts.map +1 -1
- package/lib/middlewares/TransactionContext.js +84 -73
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +1 -1
- package/lib/middlewares/VisitObservedCallsMiddleware.js +16 -7
- package/lib/middlewares/VisitObservedSfusMiddleware.d.ts.map +1 -1
- package/lib/middlewares/VisitObservedSfusMiddleware.js +15 -6
- package/lib/middlewares/visitors/visitClient.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitClient.js +6 -18
- package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitInboundAudioTrack.js +17 -20
- package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitInboundVideoTrack.js +16 -21
- package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitOutboundAudioTrack.js +16 -16
- package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitOutboundVideoTarck.js +16 -17
- package/lib/middlewares/visitors/visitPeerConnection.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitPeerConnection.js +24 -40
- package/lib/middlewares/visitors/visitSfu.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfu.js +6 -7
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.js +3 -7
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.js +3 -8
- package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuSctpChannel.js +3 -6
- package/lib/middlewares/visitors/visitSfuTransport.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuTransport.js +3 -6
- package/lib/processes/closePeerConnectionProcess.d.ts.map +1 -1
- package/lib/processes/closePeerConnectionProcess.js +14 -5
- package/lib/processes/detachClientProcess.d.ts.map +1 -1
- package/lib/processes/detachClientProcess.js +20 -17
- package/lib/processes/findRemoteMatches.d.ts +2 -2
- package/lib/processes/findRemoteMatches.d.ts.map +1 -1
- package/lib/processes/findRemoteMatches.js +70 -56
- package/lib/processes/inboundTrackRemoved.d.ts.map +1 -1
- package/lib/processes/inboundTrackRemoved.js +12 -3
- package/lib/processes/joinClientProcess.d.ts.map +1 -1
- package/lib/processes/joinClientProcess.js +15 -6
- package/lib/processes/outboundTrackRemoved.d.ts.map +1 -1
- package/lib/processes/outboundTrackRemoved.js +12 -3
- package/lib/samples/ObservedCall.d.ts.map +1 -1
- package/lib/samples/ObservedCall.js +1 -5
- package/lib/samples/ObservedCalls.d.ts.map +1 -1
- package/lib/samples/ObservedClient.d.ts.map +1 -1
- package/lib/samples/ObservedClient.js +1 -9
- package/lib/samples/ObservedInboundAudioTrack.d.ts.map +1 -1
- package/lib/samples/ObservedInboundAudioTrack.js +1 -5
- package/lib/samples/ObservedInboundVideoTrack.d.ts.map +1 -1
- package/lib/samples/ObservedInboundVideoTrack.js +1 -5
- package/lib/samples/ObservedOutboundAudioTrack.d.ts.map +1 -1
- package/lib/samples/ObservedOutboundAudioTrack.js +1 -5
- package/lib/samples/ObservedOutboundVideoTrack.d.ts.map +1 -1
- package/lib/samples/ObservedOutboundVideoTrack.js +1 -5
- package/lib/samples/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/samples/ObservedPeerConnection.js +1 -12
- package/lib/samples/ObservedSfu.d.ts.map +1 -1
- package/lib/samples/ObservedSfu.js +1 -8
- package/lib/samples/ObservedSfuInboundRtpPad.d.ts.map +1 -1
- package/lib/samples/ObservedSfuInboundRtpPad.js +1 -5
- package/lib/samples/ObservedSfuOutboundRtpPad.d.ts.map +1 -1
- package/lib/samples/ObservedSfuOutboundRtpPad.js +1 -5
- package/lib/samples/ObservedSfuSctpChannel.d.ts.map +1 -1
- package/lib/samples/ObservedSfuSctpChannel.js +1 -5
- package/lib/samples/ObservedSfuTransport.d.ts.map +1 -1
- package/lib/samples/ObservedSfuTransport.js +1 -8
- package/lib/samples/ObservedSfus.d.ts.map +1 -1
- package/lib/sinks/ObserverSink.d.ts.map +1 -1
- package/lib/sinks/ObserverSink.js +42 -31
- package/lib/sinks/callEventReports.js +1 -0
- package/lib/sources/ObservedCallSource.d.ts +6 -3
- package/lib/sources/ObservedCallSource.d.ts.map +1 -1
- package/lib/sources/ObservedClientSource.d.ts +3 -2
- package/lib/sources/ObservedClientSource.d.ts.map +1 -1
- package/lib/sources/ObservedSfuSource.d.ts +3 -2
- package/lib/sources/ObservedSfuSource.d.ts.map +1 -1
- package/lib/sources/Sources.d.ts +8 -4
- package/lib/sources/Sources.d.ts.map +1 -1
- package/lib/sources/Sources.js +83 -46
- package/lib/storages/ObserverStorage.d.ts.map +1 -1
- package/lib/storages/SimpleStorage.d.ts.map +1 -1
- package/lib/storages/SimpleStorage.js +40 -23
- package/package.json +1 -1
- package/src/Evaluator.ts +17 -9
- package/src/Observer.ts +230 -170
- package/src/common/Semaphore.ts +2 -0
- package/src/common/callMetaReports.ts +30 -28
- package/src/common/logger.ts +140 -132
- package/src/common/types.ts +1 -1
- package/src/common/utils.ts +12 -1
- package/src/entries/CallEntry.ts +62 -0
- package/src/entries/ClientEntry.ts +90 -0
- package/src/entries/InboundTrackEntry.ts +74 -0
- package/src/entries/OutboundTrackEntry.ts +72 -0
- package/src/entries/PeerConnectionEntry.ts +133 -0
- package/src/entries/SfuEntry.ts +62 -0
- package/src/entries/SfuInboundRtpPadEntry.ts +46 -0
- package/src/entries/SfuOutboundRtpPadEntry.ts +44 -0
- package/src/entries/SfuSctpChannelEntry.ts +39 -0
- package/src/entries/SfuTransportEntry.ts +109 -0
- package/src/index.ts +11 -0
- package/src/middlewares/CallOperationsContext.ts +9 -5
- package/src/middlewares/CallProcessor.ts +4 -2
- package/src/middlewares/CommitTransactionMiddleware.ts +8 -5
- package/src/middlewares/DeleteOutdatedCallEntries.ts +24 -16
- package/src/middlewares/DeleteOutdatedSfuEntries.ts +24 -15
- package/src/middlewares/Middleware.ts +1 -0
- package/src/middlewares/Processor.ts +10 -5
- package/src/middlewares/TransactionContext.ts +1 -2
- package/src/middlewares/VisitObservedCallsMiddleware.ts +5 -2
- package/src/middlewares/VisitObservedSfusMiddleware.ts +8 -7
- package/src/middlewares/visitors/visitClient.ts +15 -1
- package/src/middlewares/visitors/visitInboundAudioTrack.ts +4 -1
- package/src/middlewares/visitors/visitInboundVideoTrack.ts +5 -1
- package/src/middlewares/visitors/visitOutboundAudioTrack.ts +5 -1
- package/src/middlewares/visitors/visitOutboundVideoTarck.ts +5 -1
- package/src/middlewares/visitors/visitPeerConnection.ts +15 -2
- package/src/middlewares/visitors/visitSfu.ts +7 -1
- package/src/middlewares/visitors/visitSfuInboundRtpPad.ts +4 -2
- package/src/middlewares/visitors/visitSfuOutboundRtpPad.ts +3 -1
- package/src/middlewares/visitors/visitSfuSctpChannel.ts +23 -21
- package/src/middlewares/visitors/visitSfuTransport.ts +3 -1
- package/src/processes/closePeerConnectionProcess.ts +3 -0
- package/src/processes/detachClientProcess.ts +13 -4
- package/src/processes/findRemoteMatches.ts +32 -21
- package/src/processes/inboundTrackRemoved.ts +2 -0
- package/src/processes/joinClientProcess.ts +8 -2
- package/src/processes/outboundTrackRemoved.ts +2 -0
- package/src/samples/ObservedCall.ts +6 -0
- package/src/samples/ObservedCalls.ts +13 -7
- package/src/samples/ObservedClient.ts +24 -8
- package/src/samples/ObservedInboundAudioTrack.ts +3 -2
- package/src/samples/ObservedInboundVideoTrack.ts +3 -2
- package/src/samples/ObservedOutboundAudioTrack.ts +3 -2
- package/src/samples/ObservedOutboundVideoTrack.ts +3 -2
- package/src/samples/ObservedPeerConnection.ts +27 -11
- package/src/samples/ObservedSfu.ts +17 -10
- package/src/samples/ObservedSfuInboundRtpPad.ts +5 -4
- package/src/samples/ObservedSfuOutboundRtpPad.ts +5 -4
- package/src/samples/ObservedSfuSctpChannel.ts +13 -13
- package/src/samples/ObservedSfuTransport.ts +19 -7
- package/src/samples/ObservedSfus.ts +10 -5
- package/src/sinks/ObserverSink.ts +51 -44
- package/src/sinks/callEventReports.ts +1 -1
- package/src/sources/ObservedCallSource.ts +9 -6
- package/src/sources/ObservedClientSource.ts +3 -2
- package/src/sources/ObservedSfuSource.ts +4 -8
- package/src/sources/Sources.ts +107 -22
- package/src/storages/ObserverStorage.ts +1 -0
- package/src/storages/SimpleStorage.ts +44 -21
- package/tsconfig.json +7 -5
- package/.eslintrc.js +0 -27
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.SinkImpl = void 0;
|
|
4
13
|
const events_1 = require("events");
|
|
@@ -110,11 +119,11 @@ class SinkImpl {
|
|
|
110
119
|
return this._sfuExtensionReports;
|
|
111
120
|
}
|
|
112
121
|
addProcess(process) {
|
|
113
|
-
const middleware =
|
|
114
|
-
|
|
122
|
+
const middleware = (context, next) => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
yield process(context);
|
|
115
124
|
if (next)
|
|
116
|
-
|
|
117
|
-
};
|
|
125
|
+
yield next(context);
|
|
126
|
+
});
|
|
118
127
|
this._customProcesses.set(process, middleware);
|
|
119
128
|
this._processor.addMiddleware(middleware);
|
|
120
129
|
}
|
|
@@ -126,35 +135,37 @@ class SinkImpl {
|
|
|
126
135
|
this._customProcesses.delete(process);
|
|
127
136
|
this._processor.removeMiddleware(middleware);
|
|
128
137
|
}
|
|
129
|
-
|
|
138
|
+
_process(context) {
|
|
130
139
|
var _a;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
.
|
|
144
|
-
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
if (this._processor.getSize() < 1) {
|
|
142
|
+
// no process to execute
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (this._processes.has(this._index)) {
|
|
146
|
+
VisitObservedCallsMiddleware_1.logger.warn('The sink process has been called while the previous process has not yet completed. This may indicate that the observer is attempting to process more reports than it can handle.');
|
|
147
|
+
}
|
|
148
|
+
const actualBlockingPoint = (_a = this._processes.get(this._index)) !== null && _a !== void 0 ? _a : Promise.resolve();
|
|
149
|
+
const index = ++this._index;
|
|
150
|
+
const result = new Promise((resolve, reject) => {
|
|
151
|
+
actualBlockingPoint.then(() => {
|
|
152
|
+
this._processor.use(context)
|
|
153
|
+
.then(() => resolve())
|
|
154
|
+
.catch((err) => reject(err));
|
|
155
|
+
});
|
|
145
156
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
157
|
+
const nextBlockingPoint = new Promise((resolve) => {
|
|
158
|
+
result.then(() => {
|
|
159
|
+
this._processes.delete(index);
|
|
160
|
+
resolve();
|
|
161
|
+
}).catch(() => {
|
|
162
|
+
this._processes.delete(index);
|
|
163
|
+
resolve();
|
|
164
|
+
});
|
|
154
165
|
});
|
|
166
|
+
this._processes.set(index, nextBlockingPoint);
|
|
167
|
+
return result;
|
|
155
168
|
});
|
|
156
|
-
this._processes.set(index, nextBlockingPoint);
|
|
157
|
-
return result;
|
|
158
169
|
}
|
|
159
170
|
emit() {
|
|
160
171
|
let result = 0;
|
|
@@ -165,8 +176,8 @@ class SinkImpl {
|
|
|
165
176
|
}
|
|
166
177
|
};
|
|
167
178
|
const context = this._createObserverSinkContext();
|
|
168
|
-
this._process(context).catch(err => {
|
|
169
|
-
VisitObservedCallsMiddleware_1.logger.error(
|
|
179
|
+
this._process(context).catch((err) => {
|
|
180
|
+
VisitObservedCallsMiddleware_1.logger.error('Error occurred while processing reports', err);
|
|
170
181
|
});
|
|
171
182
|
checkAndEmit('call-event', this._callEventReports);
|
|
172
183
|
this._callEventReports = [];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createMediaTrackRemovedEventReport = exports.createMediaTrackAddedEventReport = exports.createPeerConnectionClosedEventReport = exports.createPeerConnectionOpenedEventReport = exports.createClientLeftEventReport = exports.createClientJoinedEventReport = exports.createCallEndedEventReport = exports.createCallStartedEventReport = exports.CallEventType = void 0;
|
|
4
|
+
// eslint-disable-next-line no-shadow
|
|
4
5
|
var CallEventType;
|
|
5
6
|
(function (CallEventType) {
|
|
6
7
|
CallEventType["CALL_STARTED"] = "CALL_STARTED";
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { PartialBy } from '../common/utils';
|
|
2
2
|
import { ObservedClientSource, ObservedClientSourceConfig } from './ObservedClientSource';
|
|
3
|
-
export type ObservedCallSourceConfig = {
|
|
3
|
+
export type ObservedCallSourceConfig<T extends Record<string, unknown>> = {
|
|
4
|
+
readonly appData: T;
|
|
4
5
|
readonly serviceId: string;
|
|
5
6
|
readonly mediaUnitId: string;
|
|
6
7
|
readonly roomId: string;
|
|
7
8
|
readonly callId: string;
|
|
8
9
|
};
|
|
9
|
-
export interface ObservedCallSource extends ObservedCallSourceConfig {
|
|
10
|
+
export interface ObservedCallSource<T extends Record<string, unknown> = Record<string, unknown>> extends ObservedCallSourceConfig<T> {
|
|
10
11
|
readonly closed: boolean;
|
|
11
|
-
|
|
12
|
+
readonly clients: IterableIterator<ObservedClientSource>;
|
|
13
|
+
getClientSource<U extends Record<string, unknown>>(clientId: string): ObservedClientSource<U> | undefined;
|
|
14
|
+
createClientSource<U extends Record<string, unknown> = Record<string, unknown>>(context: PartialBy<ObservedClientSourceConfig<U>, 'joined' | 'mediaUnitId' | 'serviceId' | 'callId' | 'roomId'>): ObservedClientSource<U>;
|
|
12
15
|
close(): void;
|
|
13
16
|
}
|
|
14
17
|
//# sourceMappingURL=ObservedCallSource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedCallSource.d.ts","sourceRoot":"","sources":["../../src/sources/ObservedCallSource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ObservedCallSource.d.ts","sourceRoot":"","sources":["../../src/sources/ObservedCallSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAE1F,MAAM,MAAM,wBAAwB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACzE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;IACnB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,SAAQ,wBAAwB,CAAC,CAAC,CAAC;IACnI,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;IAEzD,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAE1G,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7E,OAAO,EAAE,SAAS,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC,GAC7G,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAG3B,KAAK,IAAI,IAAI,CAAC;CACd"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ClientSample } from '@observertc/sample-schemas-js';
|
|
2
|
-
export type ObservedClientSourceConfig = {
|
|
2
|
+
export type ObservedClientSourceConfig<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
3
|
+
readonly appData: T;
|
|
3
4
|
readonly serviceId: string;
|
|
4
5
|
readonly mediaUnitId: string;
|
|
5
6
|
readonly roomId: string;
|
|
@@ -10,7 +11,7 @@ export type ObservedClientSourceConfig = {
|
|
|
10
11
|
userId?: string;
|
|
11
12
|
timeZoneId?: string;
|
|
12
13
|
};
|
|
13
|
-
export interface ObservedClientSource extends ObservedClientSourceConfig {
|
|
14
|
+
export interface ObservedClientSource<T extends Record<string, unknown> = Record<string, unknown>> extends ObservedClientSourceConfig<T> {
|
|
14
15
|
readonly closed: boolean;
|
|
15
16
|
accept(...samples: ClientSample[]): void;
|
|
16
17
|
close(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedClientSource.d.ts","sourceRoot":"","sources":["../../src/sources/ObservedClientSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,MAAM,MAAM,0BAA0B,GAAG;
|
|
1
|
+
{"version":3,"file":"ObservedClientSource.d.ts","sourceRoot":"","sources":["../../src/sources/ObservedClientSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,MAAM,MAAM,0BAA0B,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACrG,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,SAAQ,0BAA0B,CAAC,CAAC,CAAC;IACvI,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,MAAM,CAAC,GAAG,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAOzC,KAAK,IAAI,IAAI,CAAC;CACd"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { SfuSample } from '@observertc/sample-schemas-js';
|
|
2
|
-
export type ObservedSfuSourceConfig = {
|
|
2
|
+
export type ObservedSfuSourceConfig<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
3
|
+
readonly appData: T;
|
|
3
4
|
readonly serviceId: string;
|
|
4
5
|
readonly mediaUnitId: string;
|
|
5
6
|
readonly sfuId: string;
|
|
6
7
|
readonly joined: number;
|
|
7
8
|
timeZoneId?: string;
|
|
8
9
|
};
|
|
9
|
-
export interface ObservedSfuSource extends ObservedSfuSourceConfig {
|
|
10
|
+
export interface ObservedSfuSource<T extends Record<string, unknown> = Record<string, unknown>> extends ObservedSfuSourceConfig<T> {
|
|
10
11
|
readonly closed: boolean;
|
|
11
12
|
accept(...samples: SfuSample[]): void;
|
|
12
13
|
close(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedSfuSource.d.ts","sourceRoot":"","sources":["../../src/sources/ObservedSfuSource.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ObservedSfuSource.d.ts","sourceRoot":"","sources":["../../src/sources/ObservedSfuSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAClG,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,SAAQ,uBAAuB,CAAC,CAAC,CAAC;IACjI,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,MAAM,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAEtC,KAAK,IAAI,IAAI,CAAC;CACd"}
|
package/lib/sources/Sources.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ObservedCalls } from '../samples/ObservedCalls';
|
|
2
|
-
import {
|
|
2
|
+
import { ObservedClientSourceConfig } from './ObservedClientSource';
|
|
3
3
|
import { PartialBy } from '../common/utils';
|
|
4
4
|
import { ObservedSfuSourceConfig, ObservedSfuSource } from './ObservedSfuSource';
|
|
5
5
|
import { ObservedSfus } from '../samples/ObservedSfus';
|
|
6
|
+
import { ObservedCallSource, ObservedCallSourceConfig } from './ObservedCallSource';
|
|
6
7
|
export type SourcesConfig = {
|
|
7
8
|
maxSamples: number;
|
|
8
9
|
maxTimeInMs: number;
|
|
@@ -21,7 +22,7 @@ export type SourcesEvents = {
|
|
|
21
22
|
export declare class Sources {
|
|
22
23
|
readonly config: SourcesConfig;
|
|
23
24
|
private readonly _warnFlags;
|
|
24
|
-
private readonly
|
|
25
|
+
private readonly _callSources;
|
|
25
26
|
private readonly _sfuSources;
|
|
26
27
|
private readonly _emitter;
|
|
27
28
|
private _observedCallsBuilder;
|
|
@@ -29,11 +30,14 @@ export declare class Sources {
|
|
|
29
30
|
private _timer?;
|
|
30
31
|
private _numberOfSamples;
|
|
31
32
|
constructor(config: SourcesConfig);
|
|
33
|
+
getCallSource<T extends Record<string, unknown> = Record<string, unknown>>(callId: string): ObservedCallSource<T> | undefined;
|
|
34
|
+
getSfuSource<T extends Record<string, unknown> = Record<string, unknown>>(sfuId: string): ObservedSfuSource<T> | undefined;
|
|
32
35
|
on<K extends keyof SourcesEvents>(event: K, listener: (data: SourcesEvents[K]) => void): this;
|
|
33
36
|
off<K extends keyof SourcesEvents>(event: K, listener: (data: SourcesEvents[K]) => void): this;
|
|
34
37
|
private _emit;
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
createCallSource<T extends Record<string, unknown> = Record<string, unknown>>(config: ObservedCallSourceConfig<T>): ObservedCallSource<T>;
|
|
39
|
+
private _createClientSource;
|
|
40
|
+
createSfuSource<T extends Record<string, unknown> = Record<string, unknown>>(config: PartialBy<ObservedSfuSourceConfig<T>, 'joined'>): ObservedSfuSource;
|
|
37
41
|
private _incrementSamples;
|
|
38
42
|
emitSamples(): void;
|
|
39
43
|
private _emitSamples;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sources.d.ts","sourceRoot":"","sources":["../../src/sources/Sources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAwB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"Sources.d.ts","sourceRoot":"","sources":["../../src/sources/Sources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAwB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAwB,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAG1F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,YAAY,EAAuB,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAIpF,MAAM,MAAM,aAAa,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC3B,kBAAkB,EAAE;QACnB,aAAa,EAAE,aAAa,CAAC;QAC7B,YAAY,EAAE,YAAY,CAAC;QAC3B,eAAe,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,uBAAuB,EAAE,0BAA0B,CAAC;IACpD,qBAAqB,EAAE,0BAA0B,CAAC;IAClD,oBAAoB,EAAE,uBAAuB,CAAC;IAC9C,kBAAkB,EAAE,uBAAuB,CAAC;CAC5C,CAAC;AAEF,qBAAa,OAAO;aAagB,MAAM,EAAE,aAAa;IAXxD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA4C;IACvE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAyC;IAEtE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAwC;IACpE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAE/C,OAAO,CAAC,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B;IAQlB,WAAW;IAalB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,WAAW;IAaZ,KAAK;CAOZ"}
|
package/lib/sources/Sources.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.Sources = void 0;
|
|
4
15
|
const ObservedCalls_1 = require("../samples/ObservedCalls");
|
|
@@ -10,13 +21,24 @@ class Sources {
|
|
|
10
21
|
constructor(config) {
|
|
11
22
|
this.config = config;
|
|
12
23
|
this._warnFlags = { autoEmitButEmitSamplesInvoked: false };
|
|
13
|
-
this.
|
|
24
|
+
this._callSources = new Map();
|
|
25
|
+
// private readonly _clientSources = new Map<string, ObservedClientSource>();
|
|
14
26
|
this._sfuSources = new Map();
|
|
15
27
|
this._emitter = new events_1.EventEmitter();
|
|
16
28
|
this._observedCallsBuilder = new ObservedCalls_1.ObservedCallsBuilder();
|
|
17
29
|
this._observedSfusBuilder = new ObservedSfus_1.ObservedSfusBuilder();
|
|
18
30
|
this._numberOfSamples = 0;
|
|
19
31
|
}
|
|
32
|
+
getCallSource(callId) {
|
|
33
|
+
if (!this._callSources.has(callId))
|
|
34
|
+
return;
|
|
35
|
+
return this._callSources.get(callId);
|
|
36
|
+
}
|
|
37
|
+
getSfuSource(sfuId) {
|
|
38
|
+
if (!this._sfuSources.has(sfuId))
|
|
39
|
+
return;
|
|
40
|
+
return this._sfuSources.get(sfuId);
|
|
41
|
+
}
|
|
20
42
|
on(event, listener) {
|
|
21
43
|
this._emitter.addListener(event, listener);
|
|
22
44
|
return this;
|
|
@@ -28,51 +50,76 @@ class Sources {
|
|
|
28
50
|
_emit(event, data) {
|
|
29
51
|
return this._emitter.emit(event, data);
|
|
30
52
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
53
|
+
createCallSource(config) {
|
|
54
|
+
let closed = false;
|
|
55
|
+
const { serviceId, mediaUnitId, appData } = config, callConfig = __rest(config, ["serviceId", "mediaUnitId", "appData"]);
|
|
56
|
+
const clientSources = new Map();
|
|
57
|
+
const callSource = Object.assign(Object.assign({}, callConfig), { appData,
|
|
58
|
+
serviceId,
|
|
59
|
+
mediaUnitId,
|
|
60
|
+
get clients() {
|
|
61
|
+
return clientSources.values();
|
|
62
|
+
}, getClientSource: (clientId) => {
|
|
63
|
+
if (!clientSources.has(clientId))
|
|
64
|
+
return;
|
|
65
|
+
else
|
|
66
|
+
return clientSources.get(clientId);
|
|
67
|
+
}, createClientSource: (context) => {
|
|
68
|
+
const existingClientSource = clientSources.get(context.clientId);
|
|
69
|
+
if (existingClientSource)
|
|
70
|
+
return existingClientSource;
|
|
71
|
+
const { appData: clientAppData } = context, clientConfig = __rest(context, ["appData"]);
|
|
72
|
+
const clientSource = this._createClientSource(Object.assign(Object.assign(Object.assign({}, callConfig), clientConfig), { appData: clientAppData, serviceId,
|
|
73
|
+
mediaUnitId }));
|
|
74
|
+
const closeClientSource = clientSource.close;
|
|
75
|
+
clientSource.close = () => {
|
|
76
|
+
closeClientSource();
|
|
77
|
+
clientSources.delete(context.clientId);
|
|
78
|
+
};
|
|
79
|
+
clientSources.set(context.clientId, clientSource);
|
|
80
|
+
return clientSource;
|
|
81
|
+
}, close: () => {
|
|
82
|
+
if (closed) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
for (const clientSource of clientSources.values()) {
|
|
86
|
+
clientSource.close();
|
|
87
|
+
}
|
|
88
|
+
clientSources.clear();
|
|
89
|
+
this._callSources.delete(config.callId);
|
|
90
|
+
closed = true;
|
|
91
|
+
}, closed });
|
|
92
|
+
if (this._callSources.size < 1) {
|
|
93
|
+
this._resetTimer();
|
|
37
94
|
}
|
|
95
|
+
this._callSources.set(config.callId, callSource);
|
|
96
|
+
return callSource;
|
|
97
|
+
}
|
|
98
|
+
_createClientSource(config) {
|
|
99
|
+
var _a;
|
|
38
100
|
let closed = false;
|
|
39
|
-
|
|
40
|
-
const source = {
|
|
41
|
-
...config,
|
|
42
|
-
joined: (_a = config.joined) !== null && _a !== void 0 ? _a : Date.now(),
|
|
43
|
-
accept: (...samples) => {
|
|
101
|
+
const { appData } = config, clientConfig = __rest(config, ["appData"]);
|
|
102
|
+
const source = Object.assign(Object.assign({}, clientConfig), { appData, joined: (_a = config.joined) !== null && _a !== void 0 ? _a : Date.now(), accept: (...samples) => {
|
|
44
103
|
if (closed) {
|
|
45
104
|
throw new Error('Cannot accept ClientSample, because the ClientSource is closed');
|
|
46
105
|
}
|
|
47
106
|
const observedCallBuilder = this._observedCallsBuilder.getOrCreateObservedCallBuilder(config.callId, () => {
|
|
48
|
-
return {
|
|
49
|
-
...source,
|
|
50
|
-
};
|
|
107
|
+
return Object.assign({}, source);
|
|
51
108
|
});
|
|
52
109
|
const observedClientBuilder = observedCallBuilder.getOrCreateObservedClientBuilder(config.clientId, () => {
|
|
53
|
-
return {
|
|
54
|
-
...source,
|
|
55
|
-
};
|
|
110
|
+
return Object.assign({}, source);
|
|
56
111
|
});
|
|
57
112
|
for (const sample of samples) {
|
|
58
113
|
observedClientBuilder.addClientSample(sample);
|
|
59
114
|
}
|
|
60
115
|
this._incrementSamples(samples.length);
|
|
61
|
-
},
|
|
62
|
-
close: () => {
|
|
116
|
+
}, close: () => {
|
|
63
117
|
if (closed) {
|
|
64
118
|
return;
|
|
65
119
|
}
|
|
66
120
|
closed = true;
|
|
67
|
-
this._clientSources.delete(config.clientId);
|
|
68
121
|
this._emit('removed-client-source', source);
|
|
69
|
-
},
|
|
70
|
-
closed,
|
|
71
|
-
};
|
|
72
|
-
if (this._clientSources.size < 1) {
|
|
73
|
-
this._resetTimer();
|
|
74
|
-
}
|
|
75
|
-
this._clientSources.set(config.clientId, source);
|
|
122
|
+
}, closed });
|
|
76
123
|
this._emit('added-client-source', source);
|
|
77
124
|
return source;
|
|
78
125
|
}
|
|
@@ -80,38 +127,29 @@ class Sources {
|
|
|
80
127
|
var _a;
|
|
81
128
|
const existingSfuSource = this._sfuSources.get(config.sfuId);
|
|
82
129
|
if (existingSfuSource) {
|
|
83
|
-
logger.warn(`Attempted to add a SfuSource for sfu ${config.sfuId} twice`);
|
|
84
130
|
return existingSfuSource;
|
|
85
131
|
}
|
|
86
132
|
let closed = false;
|
|
87
133
|
// config.joined = config.joined ?? Date.now();
|
|
88
|
-
const source = {
|
|
89
|
-
...config,
|
|
90
|
-
joined: (_a = config.joined) !== null && _a !== void 0 ? _a : Date.now(),
|
|
91
|
-
accept: (...samples) => {
|
|
134
|
+
const source = Object.assign(Object.assign({}, config), { joined: (_a = config.joined) !== null && _a !== void 0 ? _a : Date.now(), accept: (...samples) => {
|
|
92
135
|
if (closed) {
|
|
93
136
|
throw new Error('Cannot accept SfuSample, because the SfuSource is closed');
|
|
94
137
|
}
|
|
95
138
|
const observedSfuBuilder = this._observedSfusBuilder.getOrCreateObservedSfuBuilder(config.sfuId, () => {
|
|
96
|
-
return {
|
|
97
|
-
...source,
|
|
98
|
-
};
|
|
139
|
+
return Object.assign({}, source);
|
|
99
140
|
});
|
|
100
141
|
for (const sample of samples) {
|
|
101
142
|
observedSfuBuilder.addSfuSample(sample);
|
|
102
143
|
}
|
|
103
144
|
this._incrementSamples(samples.length);
|
|
104
|
-
},
|
|
105
|
-
close: () => {
|
|
145
|
+
}, close: () => {
|
|
106
146
|
if (closed) {
|
|
107
147
|
return;
|
|
108
148
|
}
|
|
109
149
|
closed = true;
|
|
110
150
|
this._sfuSources.delete(config.sfuId);
|
|
111
151
|
this._emit('removed-sfu-source', source);
|
|
112
|
-
},
|
|
113
|
-
closed,
|
|
114
|
-
};
|
|
152
|
+
}, closed });
|
|
115
153
|
if (this._sfuSources.size < 1) {
|
|
116
154
|
this._resetTimer();
|
|
117
155
|
}
|
|
@@ -163,11 +201,10 @@ class Sources {
|
|
|
163
201
|
}
|
|
164
202
|
}
|
|
165
203
|
close() {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
204
|
+
[...this._callSources.values()].forEach((callSource) => callSource.close());
|
|
205
|
+
[...this._sfuSources.values()].forEach((sfuSource) => sfuSource.close());
|
|
206
|
+
this._callSources.clear();
|
|
207
|
+
this._sfuSources.clear();
|
|
171
208
|
this._emitSamples();
|
|
172
209
|
}
|
|
173
210
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObserverStorage.d.ts","sourceRoot":"","sources":["../../src/storages/ObserverStorage.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ObserverStorage.d.ts","sourceRoot":"","sources":["../../src/storages/ObserverStorage.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,EAAE,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAExB;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;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CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAgBjE,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAQtC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAejD,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAQ9D,YAAY,IAAI,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAG/C"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
3
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
4
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
5
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
6
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
7
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
8
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
9
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
10
|
+
function fulfill(value) { resume("next", value); }
|
|
11
|
+
function reject(value) { resume("throw", value); }
|
|
12
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
13
|
+
};
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
15
|
exports.SimpleStorage = void 0;
|
|
4
16
|
class SimpleStorage {
|
|
@@ -6,16 +18,17 @@ class SimpleStorage {
|
|
|
6
18
|
this.id = id;
|
|
7
19
|
this._map = new Map();
|
|
8
20
|
}
|
|
9
|
-
|
|
10
|
-
return this._map.size;
|
|
21
|
+
size() {
|
|
22
|
+
return Promise.resolve(this._map.size);
|
|
11
23
|
}
|
|
12
|
-
|
|
24
|
+
clear() {
|
|
13
25
|
this._map.clear();
|
|
26
|
+
return Promise.resolve();
|
|
14
27
|
}
|
|
15
|
-
|
|
16
|
-
return this._map.get(key);
|
|
28
|
+
get(key) {
|
|
29
|
+
return Promise.resolve(this._map.get(key));
|
|
17
30
|
}
|
|
18
|
-
|
|
31
|
+
getAll(keys) {
|
|
19
32
|
const result = new Map();
|
|
20
33
|
for (const key of keys) {
|
|
21
34
|
const value = this._map.get(key);
|
|
@@ -23,14 +36,14 @@ class SimpleStorage {
|
|
|
23
36
|
result.set(key, value);
|
|
24
37
|
}
|
|
25
38
|
}
|
|
26
|
-
return result;
|
|
39
|
+
return Promise.resolve(result);
|
|
27
40
|
}
|
|
28
|
-
|
|
41
|
+
set(key, value) {
|
|
29
42
|
const result = this._map.get(key);
|
|
30
43
|
this._map.set(key, value);
|
|
31
|
-
return result;
|
|
44
|
+
return Promise.resolve(result);
|
|
32
45
|
}
|
|
33
|
-
|
|
46
|
+
setAll(entries) {
|
|
34
47
|
const result = new Map();
|
|
35
48
|
for (const [key, value] of entries) {
|
|
36
49
|
const oldValue = this._map.get(key);
|
|
@@ -39,16 +52,17 @@ class SimpleStorage {
|
|
|
39
52
|
}
|
|
40
53
|
this._map.set(key, value);
|
|
41
54
|
}
|
|
42
|
-
return result;
|
|
55
|
+
return Promise.resolve(result);
|
|
43
56
|
}
|
|
44
|
-
|
|
57
|
+
insert(key, value) {
|
|
45
58
|
const result = this._map.get(key);
|
|
46
59
|
if (result) {
|
|
47
|
-
return result;
|
|
60
|
+
return Promise.resolve(result);
|
|
48
61
|
}
|
|
49
62
|
this._map.set(key, value);
|
|
63
|
+
return Promise.resolve(undefined);
|
|
50
64
|
}
|
|
51
|
-
|
|
65
|
+
insertAll(entries) {
|
|
52
66
|
const result = new Map();
|
|
53
67
|
for (const [key, value] of entries) {
|
|
54
68
|
const oldValue = this._map.get(key);
|
|
@@ -59,14 +73,14 @@ class SimpleStorage {
|
|
|
59
73
|
this._map.set(key, value);
|
|
60
74
|
}
|
|
61
75
|
}
|
|
62
|
-
return result;
|
|
76
|
+
return Promise.resolve(result);
|
|
63
77
|
}
|
|
64
|
-
|
|
78
|
+
remove(key) {
|
|
65
79
|
const result = this._map.get(key);
|
|
66
80
|
this._map.delete(key);
|
|
67
|
-
return result;
|
|
81
|
+
return Promise.resolve(result);
|
|
68
82
|
}
|
|
69
|
-
|
|
83
|
+
removeAll(keys) {
|
|
70
84
|
const result = new Map();
|
|
71
85
|
for (const key of keys) {
|
|
72
86
|
const value = this._map.get(key);
|
|
@@ -75,12 +89,15 @@ class SimpleStorage {
|
|
|
75
89
|
result.set(key, value);
|
|
76
90
|
}
|
|
77
91
|
}
|
|
78
|
-
return result;
|
|
92
|
+
return Promise.resolve(result);
|
|
79
93
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
yield
|
|
83
|
-
|
|
94
|
+
[Symbol.asyncIterator]() {
|
|
95
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
96
|
+
yield __await(Promise.resolve());
|
|
97
|
+
for (const entry of this._map.entries()) {
|
|
98
|
+
yield yield __await(entry);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
84
101
|
}
|
|
85
102
|
localEntries() {
|
|
86
103
|
return this._map.entries();
|