@voicenter-team/opensips-js 1.0.21 → 1.0.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/dist/index.d.ts +737 -0
  2. package/dist/opensips-js.cjs.js +155 -0
  3. package/dist/opensips-js.es.js +21363 -0
  4. package/dist/opensips-js.iife.js +155 -0
  5. package/dist/opensips-js.umd.js +155 -0
  6. package/package.json +15 -9
  7. package/src/types/Dialog.d.ts +7 -0
  8. package/src/types/Socket.d.ts +8 -0
  9. package/src/types/Transactions.d.ts +9 -0
  10. package/src/types/UAExtended.d.ts +86 -0
  11. package/src/types/listeners.d.ts +26 -2
  12. package/src/types/msrp.d.ts +55 -0
  13. package/src/types/rtc.d.ts +23 -4
  14. package/src/types/timer.d.ts +7 -0
  15. package/build/enum/call.event.listener.type.d.ts +0 -7
  16. package/build/enum/call.event.listener.type.js +0 -10
  17. package/build/enum/metric.keys.to.include.d.ts +0 -2
  18. package/build/enum/metric.keys.to.include.js +0 -4
  19. package/build/helpers/UA/index.d.ts +0 -6
  20. package/build/helpers/UA/index.js +0 -9
  21. package/build/helpers/audio.helper.d.ts +0 -9
  22. package/build/helpers/audio.helper.js +0 -61
  23. package/build/helpers/filter.helper.d.ts +0 -2
  24. package/build/helpers/filter.helper.js +0 -14
  25. package/build/helpers/time.helper.d.ts +0 -16
  26. package/build/helpers/time.helper.js +0 -28
  27. package/build/helpers/volume.helper.d.ts +0 -2
  28. package/build/helpers/volume.helper.js +0 -76
  29. package/build/helpers/webrtcmetrics/collector.d.ts +0 -32
  30. package/build/helpers/webrtcmetrics/collector.js +0 -282
  31. package/build/helpers/webrtcmetrics/engine.d.ts +0 -20
  32. package/build/helpers/webrtcmetrics/engine.js +0 -164
  33. package/build/helpers/webrtcmetrics/exporter.d.ts +0 -116
  34. package/build/helpers/webrtcmetrics/exporter.js +0 -528
  35. package/build/helpers/webrtcmetrics/extractor.d.ts +0 -1
  36. package/build/helpers/webrtcmetrics/extractor.js +0 -976
  37. package/build/helpers/webrtcmetrics/index.d.ts +0 -63
  38. package/build/helpers/webrtcmetrics/index.js +0 -93
  39. package/build/helpers/webrtcmetrics/metrics.d.ts +0 -2
  40. package/build/helpers/webrtcmetrics/metrics.js +0 -8
  41. package/build/helpers/webrtcmetrics/probe.d.ts +0 -76
  42. package/build/helpers/webrtcmetrics/probe.js +0 -153
  43. package/build/helpers/webrtcmetrics/utils/config.d.ts +0 -12
  44. package/build/helpers/webrtcmetrics/utils/config.js +0 -28
  45. package/build/helpers/webrtcmetrics/utils/helper.d.ts +0 -13
  46. package/build/helpers/webrtcmetrics/utils/helper.js +0 -134
  47. package/build/helpers/webrtcmetrics/utils/log.d.ts +0 -7
  48. package/build/helpers/webrtcmetrics/utils/log.js +0 -71
  49. package/build/helpers/webrtcmetrics/utils/models.d.ts +0 -309
  50. package/build/helpers/webrtcmetrics/utils/models.js +0 -298
  51. package/build/helpers/webrtcmetrics/utils/score.d.ts +0 -4
  52. package/build/helpers/webrtcmetrics/utils/score.js +0 -235
  53. package/build/helpers/webrtcmetrics/utils/shortUUId.d.ts +0 -1
  54. package/build/helpers/webrtcmetrics/utils/shortUUId.js +0 -7
  55. package/build/index.d.ts +0 -181
  56. package/build/index.js +0 -911
@@ -1,63 +0,0 @@
1
- export default class WebRTCMetrics {
2
- constructor(cfg: any);
3
- _config: {
4
- refreshEvery: number;
5
- startAfter: number;
6
- stopAfter: number;
7
- verbose: boolean;
8
- pname: string;
9
- cid: string;
10
- uid: string;
11
- record: boolean;
12
- ticket: boolean;
13
- };
14
- _engine: ProbesEngine;
15
- /**
16
- * Change log level manually
17
- * @param {string} level - The level of logs. Can be one of 'TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'SILENT'
18
- */
19
- setupLogLevel(level: string): void;
20
- /**
21
- * Get the version
22
- */
23
- get version(): any;
24
- /**
25
- * Get the library name
26
- */
27
- get name(): any;
28
- /**
29
- * Get the probes
30
- */
31
- get probes(): any[];
32
- /**
33
- * Create a new probe and return it
34
- * @param {RTCPeerConnection} peerConnection The RTCPeerConnection instance to monitor
35
- * @param {Object} options The option
36
- * @return {Probe} The probe created
37
- */
38
- createProbe(peerConnection: RTCPeerConnection, options: Object): Probe;
39
- /**
40
- * Start all probes
41
- */
42
- startAllProbes(): void;
43
- /**
44
- * Stop all probes
45
- */
46
- stopAllProbes(): void;
47
- /**
48
- * Is running
49
- */
50
- get running(): boolean;
51
- /**
52
- * Is Idle
53
- */
54
- get idle(): boolean;
55
- /**
56
- * Experimental
57
- * Remote a probe
58
- * @param {Probe} probe
59
- */
60
- removeProbe(probe: Probe): void;
61
- set onresult(arg: any);
62
- }
63
- import ProbesEngine from "./engine";
@@ -1,93 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- require("regenerator-runtime/runtime.js");
7
- const log_1 = require("./utils/log");
8
- const config_1 = require("./utils/config");
9
- const engine_1 = __importDefault(require("./engine"));
10
- const moduleName = "interface ";
11
- class WebRTCMetrics {
12
- constructor(cfg) {
13
- this._config = (0, config_1.getGlobalConfig)(cfg);
14
- (0, log_1.info)(moduleName, `welcome to ${this._config.name} version ${this._config.version}`);
15
- (0, log_1.setVerboseLog)(this._config.verbose || false);
16
- this._engine = new engine_1.default(this._config);
17
- }
18
- /**
19
- * Change log level manually
20
- * @param {string} level - The level of logs. Can be one of 'TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'SILENT'
21
- */
22
- setupLogLevel(level) {
23
- (0, log_1.setLogLevel)(level);
24
- }
25
- /**
26
- * Get the version
27
- */
28
- get version() {
29
- return this._config.version;
30
- }
31
- /**
32
- * Get the library name
33
- */
34
- get name() {
35
- return this._config.name;
36
- }
37
- /**
38
- * Get the probes
39
- */
40
- get probes() {
41
- return this._engine.probes;
42
- }
43
- /**
44
- * Create a new probe and return it
45
- * @param {RTCPeerConnection} peerConnection The RTCPeerConnection instance to monitor
46
- * @param {Object} options The option
47
- * @return {Probe} The probe created
48
- */
49
- createProbe(peerConnection, options) {
50
- return this._engine.addNewProbe(peerConnection, options);
51
- }
52
- /**
53
- * Start all probes
54
- */
55
- startAllProbes() {
56
- this._engine.start();
57
- }
58
- /**
59
- * Stop all probes
60
- */
61
- stopAllProbes() {
62
- this._engine.stop();
63
- }
64
- /**
65
- * Is running
66
- */
67
- get running() {
68
- return this._engine.isRunning;
69
- }
70
- /**
71
- * Is Idle
72
- */
73
- get idle() {
74
- return this._engine.isIdle;
75
- }
76
- /**
77
- * Experimental
78
- * Remote a probe
79
- * @param {Probe} probe
80
- */
81
- removeProbe(probe) {
82
- this._engine.removeExistingProbe(probe);
83
- }
84
- set onresult(callback) {
85
- if (callback) {
86
- this._engine.registerCallback("onresult", callback);
87
- }
88
- else {
89
- this._engine.unregisterCallback("onresult");
90
- }
91
- }
92
- }
93
- exports.default = WebRTCMetrics;
@@ -1,2 +0,0 @@
1
- import WebRTCMetrics from './index.js';
2
- export default WebRTCMetrics;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- // @ts-ignore
7
- const index_js_1 = __importDefault(require("./index.js"));
8
- exports.default = index_js_1.default;
@@ -1,76 +0,0 @@
1
- export default class Probe {
2
- constructor(cfg: any);
3
- _id: any;
4
- _moduleName: any;
5
- _config: any;
6
- _collector: Collector;
7
- /**
8
- * Register a callback to 'onreport'
9
- * Unregister when callback is null
10
- * Fired when a report is received
11
- */
12
- set onreport(arg: any);
13
- /**
14
- * Register a callback to 'onticket'
15
- * Unregister when callback is null
16
- * Fired when a ticket is received
17
- */
18
- set onticket(arg: any);
19
- /**
20
- * Get the id of the Probe
21
- */
22
- get id(): any;
23
- /**
24
- * Get the name of the PeerConnection
25
- */
26
- get pname(): any;
27
- /**
28
- * Get the call identifier
29
- */
30
- get cid(): any;
31
- /**
32
- * Get the user identifier
33
- */
34
- get uid(): any;
35
- set state(arg: string);
36
- /**
37
- * Get the state of the analyzer
38
- * Value can be 'running' or 'idle'
39
- */
40
- get state(): string;
41
- /**
42
- * Add a custom event for that probe
43
- * @param {String} name The name of the event
44
- * @param {String} category The category of the event. Could be any strings
45
- * @param {String} description A description. Could be empty
46
- * @param {Date} at Optional. The date of the event
47
- */
48
- addCustomEvent(name: string, category: string, description: string, at?: Date): void;
49
- /**
50
- * Return true if the probe is running
51
- */
52
- get isRunning(): boolean;
53
- /**
54
- * Return true if the probe is idle
55
- */
56
- get isIdle(): boolean;
57
- /**
58
- * Set the user identifier
59
- */
60
- updateUserId(value: any): void;
61
- /**
62
- * Update the call identifier
63
- */
64
- updateCallId(value: any): void;
65
- /**
66
- * Set a probe to running state
67
- */
68
- start(): void;
69
- /**
70
- * Set a probe to idle state
71
- */
72
- stop(forced?: boolean): void;
73
- takeReferenceStats(): Promise<any>;
74
- collectStats(): Promise<any>;
75
- }
76
- import Collector from "./collector";
@@ -1,153 +0,0 @@
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
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const log_1 = require("./utils/log");
16
- const collector_1 = __importDefault(require("./collector"));
17
- const models_1 = require("./utils/models");
18
- const helper_1 = require("./utils/helper");
19
- class Probe {
20
- constructor(cfg) {
21
- this._id = (cfg.pname && cfg.pname.substr(0, 12).padEnd(12, " ")) || (0, helper_1.createProbeId)();
22
- this._moduleName = this._id;
23
- (0, log_1.info)(this._moduleName, "probe created");
24
- this._config = cfg;
25
- this._collector = new collector_1.default(this._config, this._id);
26
- }
27
- /**
28
- * Register a callback to 'onreport'
29
- * Unregister when callback is null
30
- * Fired when a report is received
31
- */
32
- set onreport(callback) {
33
- if (callback) {
34
- this._collector.registerCallback("onreport", callback);
35
- }
36
- else {
37
- this._collector.unregisterCallback("onreport");
38
- }
39
- }
40
- /**
41
- * Register a callback to 'onticket'
42
- * Unregister when callback is null
43
- * Fired when a ticket is received
44
- */
45
- set onticket(callback) {
46
- if (callback) {
47
- this._collector.registerCallback("onticket", callback);
48
- }
49
- else {
50
- this._collector.unregisterCallback("onticket");
51
- }
52
- }
53
- /**
54
- * Get the id of the Probe
55
- */
56
- get id() {
57
- return this._id;
58
- }
59
- /**
60
- * Get the name of the PeerConnection
61
- */
62
- get pname() {
63
- return this._config.pname;
64
- }
65
- /**
66
- * Get the call identifier
67
- */
68
- get cid() {
69
- return this._config.cid;
70
- }
71
- /**
72
- * Get the user identifier
73
- */
74
- get uid() {
75
- return this._config.uid;
76
- }
77
- /**
78
- * Get the state of the analyzer
79
- * Value can be 'running' or 'idle'
80
- */
81
- get state() {
82
- return this._collector.state;
83
- }
84
- set state(newState) {
85
- this._collector.state = newState;
86
- }
87
- /**
88
- * Add a custom event for that probe
89
- * @param {String} name The name of the event
90
- * @param {String} category The category of the event. Could be any strings
91
- * @param {String} description A description. Could be empty
92
- * @param {Date} at Optional. The date of the event
93
- */
94
- addCustomEvent(name, category, description, at = new Date().toJSON()) {
95
- this._collector.addCustomEvent(at, category, name, description);
96
- }
97
- /**
98
- * Return true if the probe is running
99
- */
100
- get isRunning() {
101
- return this._collector.state === models_1.COLLECTOR_STATE.RUNNING;
102
- }
103
- /**
104
- * Return true if the probe is idle
105
- */
106
- get isIdle() {
107
- return this._collector.state === models_1.COLLECTOR_STATE.IDLE;
108
- }
109
- /**
110
- * Set the user identifier
111
- */
112
- updateUserId(value) {
113
- this._config.uid = value;
114
- this._collector.updateConfig(this._config);
115
- }
116
- /**
117
- * Update the call identifier
118
- */
119
- updateCallId(value) {
120
- this._config.cid = value;
121
- this._collector.updateConfig(this._config);
122
- }
123
- /**
124
- * Set a probe to running state
125
- */
126
- start() {
127
- if (!this.isIdle) {
128
- (0, log_1.warn)(this._moduleName, "probe is already running");
129
- return;
130
- }
131
- this._collector.start();
132
- }
133
- /**
134
- * Set a probe to idle state
135
- */
136
- stop(forced = false) {
137
- if (!this.isRunning) {
138
- return;
139
- }
140
- this._collector.stop(forced);
141
- }
142
- takeReferenceStats() {
143
- return __awaiter(this, void 0, void 0, function* () {
144
- return this._collector.takeReferenceStats();
145
- });
146
- }
147
- collectStats() {
148
- return __awaiter(this, void 0, void 0, function* () {
149
- return (this._collector.collectStats());
150
- });
151
- }
152
- }
153
- exports.default = Probe;
@@ -1,12 +0,0 @@
1
- export function getConfig(peerConnection: any, cfg: {} | undefined, globalConfig: any): any;
2
- export function getGlobalConfig(cfg?: {}): {
3
- refreshEvery: number;
4
- startAfter: number;
5
- stopAfter: number;
6
- verbose: boolean;
7
- pname: string;
8
- cid: string;
9
- uid: string;
10
- record: boolean;
11
- ticket: boolean;
12
- };
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGlobalConfig = exports.getConfig = void 0;
4
- const models_1 = require("./models");
5
- const log_1 = require("./log");
6
- const moduleName = "config ";
7
- const getConfig = (peerConnection, cfg = {}, globalConfig) => {
8
- const config = Object.assign(Object.assign({}, globalConfig), cfg);
9
- if (!cfg.pname) {
10
- (0, log_1.warn)(moduleName, `Argument [String] 'cfg.pname' for the peerConnection name or id is missing - use generated '${globalConfig.pname}'`);
11
- }
12
- if (!cfg.cid) {
13
- (0, log_1.warn)(moduleName, `Argument [String] 'cfg.cid' for the call name or id is missing - use generated '${globalConfig.cid}'`);
14
- }
15
- if (!cfg.uid) {
16
- (0, log_1.warn)(moduleName, `Argument [String] 'cfg.uid' for the user name or id is missing - use generated '${globalConfig.uid}'`);
17
- }
18
- config.pc = peerConnection;
19
- return config;
20
- };
21
- exports.getConfig = getConfig;
22
- const getGlobalConfig = (cfg = {}) => {
23
- const config = Object.assign(Object.assign({}, models_1.defaultConfig), cfg);
24
- config.name = (0, models_1.getLibName)();
25
- config.version = (0, models_1.getVersion)();
26
- return config;
27
- };
28
- exports.getGlobalConfig = getGlobalConfig;
@@ -1,13 +0,0 @@
1
- export function average(nums: any): number;
2
- export function createProbeId(): string;
3
- export function createCollectorId(): string;
4
- export function timeout(ms: any): Promise<any>;
5
- export function call(fct: any, context: any, value: any): void;
6
- export function volatilityValuesOfReports(reports: any, key: any, subKey: any, ssrc: any): number | null;
7
- export function averageValuesOfReports(reports: any, key: any, subKey: any, avoidZeroValue: boolean | undefined, ssrc: any): number | null;
8
- export function sumValuesOfReports(reports: any, key: any, subKey: any): any;
9
- export function minValueOfReports(reports: any, key: any, subKey: any, ssrc: any): number | null;
10
- export function maxValueOfReports(reports: any, key: any, subKey: any, ssrc: any): number | null;
11
- export function lastOfReports(reports: any, key: any, subKey: any, ssrc: any): any;
12
- export function getLastReport(reports: any): any;
13
- export function getSSRCDataFromBunch(ssrc: any, bunch: any, direction: any): {} | null;
@@ -1,134 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getSSRCDataFromBunch = exports.getLastReport = exports.lastOfReports = exports.maxValueOfReports = exports.minValueOfReports = exports.sumValuesOfReports = exports.averageValuesOfReports = exports.volatilityValuesOfReports = exports.call = exports.timeout = exports.createCollectorId = exports.createProbeId = exports.average = void 0;
7
- //import shortUUID from "./shortUUId";
8
- const generate_unique_id_1 = __importDefault(require("generate-unique-id"));
9
- const models_1 = require("./models");
10
- const getValues = (reports, key, subKey, avoidZeroValue = false, ssrc) => {
11
- let arr = reports.map((report) => {
12
- if (!subKey) {
13
- return report[key];
14
- }
15
- if (!ssrc) {
16
- return report[key][subKey];
17
- }
18
- const data = report[key][ssrc];
19
- if (data) {
20
- return data[subKey];
21
- }
22
- return null;
23
- });
24
- // Avoid null value
25
- arr = arr.filter((item) => {
26
- if (avoidZeroValue) {
27
- return (Number.isFinite(item) && item > 0);
28
- }
29
- return Number.isFinite(item);
30
- });
31
- if (arr.length === 0) {
32
- return [];
33
- }
34
- return arr;
35
- };
36
- const average = (nums) => (nums.reduce((a, b) => a + b, 0) / nums.length);
37
- exports.average = average;
38
- const createProbeId = () => (`probe-${(0, generate_unique_id_1.default)()}`);
39
- exports.createProbeId = createProbeId;
40
- const createCollectorId = () => (`coltr-${(0, generate_unique_id_1.default)()}`);
41
- exports.createCollectorId = createCollectorId;
42
- const timeout = (ms) => (new Promise((resolve) => setTimeout(resolve, ms)));
43
- exports.timeout = timeout;
44
- const call = (fct, context, value) => {
45
- if (!context) {
46
- fct(value);
47
- }
48
- else {
49
- fct.call(context, value);
50
- }
51
- };
52
- exports.call = call;
53
- const volatilityValuesOfReports = (reports, key, subKey, ssrc) => {
54
- const values = getValues(reports, key, subKey, true, ssrc);
55
- if (values.length === 0) {
56
- return null;
57
- }
58
- const avg = values.reduce((p, c) => p + c, 0) / values.length;
59
- if (avg === 0) {
60
- return null;
61
- }
62
- const diff = values.map((data) => (Math.abs(avg - data)));
63
- const totalDiff = diff.reduce((p, c) => p + c, 0);
64
- const volatility = ((totalDiff / values.length) * 100) / avg;
65
- return volatility;
66
- };
67
- exports.volatilityValuesOfReports = volatilityValuesOfReports;
68
- const averageValuesOfReports = (reports, key, subKey, avoidZeroValue = false, ssrc) => {
69
- const values = getValues(reports, key, subKey, avoidZeroValue, ssrc);
70
- if (values.length === 0) {
71
- return null;
72
- }
73
- return values.reduce((p, c) => p + c, 0) / values.length;
74
- };
75
- exports.averageValuesOfReports = averageValuesOfReports;
76
- const sumValuesOfReports = (reports, key, subKey) => {
77
- const values = getValues(reports, key, subKey);
78
- return values.reduce((p, c) => p + c, 0);
79
- };
80
- exports.sumValuesOfReports = sumValuesOfReports;
81
- const minValueOfReports = (reports, key, subKey, ssrc) => {
82
- const values = getValues(reports, key, subKey, true, ssrc);
83
- if (values.length === 0) {
84
- return null;
85
- }
86
- return Math.min(...values);
87
- };
88
- exports.minValueOfReports = minValueOfReports;
89
- const maxValueOfReports = (reports, key, subKey, ssrc) => {
90
- const values = getValues(reports, key, subKey, false, ssrc);
91
- if (values.length === 0) {
92
- return null;
93
- }
94
- return Math.max(...values);
95
- };
96
- exports.maxValueOfReports = maxValueOfReports;
97
- const lastOfReports = (reports, key, subKey, ssrc) => {
98
- const lastReport = reports.slice().pop();
99
- if (!lastReport) {
100
- return null;
101
- }
102
- if (!subKey) {
103
- return lastReport[key];
104
- }
105
- if (!ssrc) {
106
- return lastReport[key][subKey];
107
- }
108
- const ssrcData = lastReport[key][ssrc];
109
- if (ssrcData) {
110
- return ssrcData[subKey];
111
- }
112
- return null;
113
- };
114
- exports.lastOfReports = lastOfReports;
115
- const getLastReport = (reports) => (reports.slice().pop());
116
- exports.getLastReport = getLastReport;
117
- const getSSRCDataFromBunch = (ssrc, bunch, direction) => {
118
- if (!bunch) {
119
- return null;
120
- }
121
- const ssrcBunch = {};
122
- let audioBunch = bunch[models_1.VALUE.AUDIO][ssrc];
123
- if (!audioBunch) {
124
- audioBunch = direction === models_1.DIRECTION.INBOUND ? Object.assign({}, models_1.defaultAudioMetricIn) : Object.assign({}, models_1.defaultAudioMetricOut);
125
- }
126
- ssrcBunch[models_1.VALUE.AUDIO] = audioBunch;
127
- let videoBunch = bunch[models_1.VALUE.VIDEO][ssrc];
128
- if (!videoBunch) {
129
- videoBunch = direction === models_1.DIRECTION.INBOUND ? Object.assign({}, models_1.defaultVideoMetricIn) : Object.assign({}, models_1.defaultVideoMetricOut);
130
- }
131
- ssrcBunch[models_1.VALUE.VIDEO] = videoBunch;
132
- return ssrcBunch;
133
- };
134
- exports.getSSRCDataFromBunch = getSSRCDataFromBunch;
@@ -1,7 +0,0 @@
1
- export function setVerboseLog(shouldHaveVerboseLog: any): void;
2
- export function setLogLevel(logLevel: any): void;
3
- export function debug(name: any, message: any, data: any): void;
4
- export function trace(name: any, message: any): void;
5
- export function info(name: any, message: any): void;
6
- export function warn(name: any, message: any): void;
7
- export function error(name: any, message: any): void;
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.error = exports.warn = exports.info = exports.trace = exports.debug = exports.setLogLevel = exports.setVerboseLog = void 0;
27
- const log = __importStar(require("loglevel"));
28
- const getHeader = () => `${new Date().toISOString()} | metrics`;
29
- const format = (header, module, message) => `${header} | ${module} | ${message}`;
30
- log.setDefaultLevel(log.levels.TRACE);
31
- const setVerboseLog = (shouldHaveVerboseLog) => {
32
- log.info(format(getHeader(), "log ", `set log level to ${shouldHaveVerboseLog ? "verbose" : "info"}`));
33
- log.setLevel(shouldHaveVerboseLog ? log.levels.TRACE : log.levels.INFO);
34
- };
35
- exports.setVerboseLog = setVerboseLog;
36
- const setLogLevel = (logLevel) => {
37
- const levels = [...Object.keys(log.levels)];
38
- if (levels.includes(logLevel)) {
39
- log.info(format(getHeader(), "log ", `update log level to ${logLevel.toLowerCase()}`));
40
- log.setLevel(logLevel);
41
- }
42
- else {
43
- log.warn(format(getHeader(), "log ", "Incorrect log level please choose one of "), levels);
44
- }
45
- };
46
- exports.setLogLevel = setLogLevel;
47
- const debug = (name, message, data) => {
48
- if (data) {
49
- log.debug(format(getHeader(), name, message), data);
50
- }
51
- else {
52
- log.debug(format(getHeader(), name, message));
53
- }
54
- };
55
- exports.debug = debug;
56
- const trace = (name, message) => {
57
- log.info(format(getHeader(), name, message));
58
- };
59
- exports.trace = trace;
60
- const info = (name, message) => {
61
- log.info(format(getHeader(), name, message));
62
- };
63
- exports.info = info;
64
- const warn = (name, message) => {
65
- log.warn(format(getHeader(), name, message));
66
- };
67
- exports.warn = warn;
68
- const error = (name, message) => {
69
- log.error(format(getHeader(), name, message));
70
- };
71
- exports.error = error;