@observertc/observer-js 0.9.21-beta → 0.9.22-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 +5 -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 +71 -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 +6 -5
- package/src/sources/ObservedClientSource.ts +3 -2
- package/src/sources/ObservedSfuSource.ts +4 -8
- package/src/sources/Sources.ts +96 -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
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parser": "@typescript-eslint/parser",
|
|
3
|
+
"parserOptions": {
|
|
4
|
+
"ecmaVersion": "latest",
|
|
5
|
+
"sourceType": "module",
|
|
6
|
+
"project": "./tsconfig.json"
|
|
7
|
+
},
|
|
8
|
+
"extends": ["plugin:@typescript-eslint/recommended"],
|
|
9
|
+
"env": { "node": true },
|
|
10
|
+
"rules": {
|
|
11
|
+
"array-bracket-spacing": [ 2, "always", {
|
|
12
|
+
"objectsInArrays": true,
|
|
13
|
+
"arraysInArrays": true
|
|
14
|
+
}],
|
|
15
|
+
"arrow-parens": [ 2, "always" ],
|
|
16
|
+
"arrow-spacing": 2,
|
|
17
|
+
"block-spacing": [ 2, "always" ],
|
|
18
|
+
"brace-style": [ 2, "1tbs", { "allowSingleLine": true } ],
|
|
19
|
+
"camelcase": 2,
|
|
20
|
+
"comma-spacing": [ 2, { "before": false, "after": true } ],
|
|
21
|
+
"comma-style": 2,
|
|
22
|
+
"computed-property-spacing": 2,
|
|
23
|
+
"constructor-super": 2,
|
|
24
|
+
"func-call-spacing": 2,
|
|
25
|
+
"generator-star-spacing": 2,
|
|
26
|
+
"guard-for-in": 2,
|
|
27
|
+
"indent": [ 2, "tab", { "SwitchCase": 1 } ],
|
|
28
|
+
"@typescript-eslint/indent": [ 2, "tab", { "SwitchCase": 1 } ],
|
|
29
|
+
"require-await": "off",
|
|
30
|
+
"@typescript-eslint/require-await": "error",
|
|
31
|
+
"key-spacing": [ 2, {
|
|
32
|
+
"singleLine": {
|
|
33
|
+
"beforeColon": false,
|
|
34
|
+
"afterColon": true
|
|
35
|
+
},
|
|
36
|
+
"multiLine": {
|
|
37
|
+
"beforeColon": false,
|
|
38
|
+
"afterColon": true
|
|
39
|
+
}
|
|
40
|
+
}],
|
|
41
|
+
"keyword-spacing": 2,
|
|
42
|
+
"linebreak-style": [ 2, "unix" ],
|
|
43
|
+
"lines-around-comment": [ 2, {
|
|
44
|
+
"allowBlockStart": true,
|
|
45
|
+
"allowObjectStart": true,
|
|
46
|
+
"beforeBlockComment": true,
|
|
47
|
+
"beforeLineComment": false
|
|
48
|
+
}],
|
|
49
|
+
"max-len": 0,
|
|
50
|
+
"newline-after-var": 2,
|
|
51
|
+
"newline-before-return": 2,
|
|
52
|
+
"newline-per-chained-call": 2,
|
|
53
|
+
"no-alert": 2,
|
|
54
|
+
"no-caller": 2,
|
|
55
|
+
"no-case-declarations": 2,
|
|
56
|
+
"no-catch-shadow": 2,
|
|
57
|
+
"no-class-assign": 2,
|
|
58
|
+
"no-confusing-arrow": 2,
|
|
59
|
+
"no-console": 2,
|
|
60
|
+
"no-const-assign": 2,
|
|
61
|
+
"no-debugger": 2,
|
|
62
|
+
"no-dupe-args": 2,
|
|
63
|
+
"no-dupe-keys": 2,
|
|
64
|
+
"no-duplicate-case": 2,
|
|
65
|
+
"no-div-regex": 2,
|
|
66
|
+
"no-empty": [ 2, { "allowEmptyCatch": true } ],
|
|
67
|
+
"no-empty-pattern": 2,
|
|
68
|
+
"no-else-return": 0,
|
|
69
|
+
"no-eval": 2,
|
|
70
|
+
"no-extend-native": 2,
|
|
71
|
+
"no-ex-assign": 2,
|
|
72
|
+
"no-extra-bind": 2,
|
|
73
|
+
"no-extra-boolean-cast": 2,
|
|
74
|
+
"no-extra-label": 2,
|
|
75
|
+
"no-extra-semi": 2,
|
|
76
|
+
"no-fallthrough": 2,
|
|
77
|
+
"no-func-assign": 2,
|
|
78
|
+
"no-global-assign": 2,
|
|
79
|
+
"no-implicit-coercion": 2,
|
|
80
|
+
"no-implicit-globals": 2,
|
|
81
|
+
"no-inner-declarations": 2,
|
|
82
|
+
"no-invalid-regexp": 2,
|
|
83
|
+
"no-invalid-this": 2,
|
|
84
|
+
"no-irregular-whitespace": 2,
|
|
85
|
+
"no-lonely-if": 2,
|
|
86
|
+
"no-mixed-operators": 2,
|
|
87
|
+
"no-mixed-spaces-and-tabs": 2,
|
|
88
|
+
"no-multi-spaces": 2,
|
|
89
|
+
"no-multi-str": 2,
|
|
90
|
+
"no-multiple-empty-lines": [ 1, { "max": 1, "maxEOF": 0, "maxBOF": 0 } ],
|
|
91
|
+
"no-native-reassign": 2,
|
|
92
|
+
"no-negated-in-lhs": 2,
|
|
93
|
+
"no-new": 2,
|
|
94
|
+
"no-new-func": 2,
|
|
95
|
+
"no-new-wrappers": 2,
|
|
96
|
+
"no-obj-calls": 2,
|
|
97
|
+
"no-proto": 2,
|
|
98
|
+
"no-regex-spaces": 2,
|
|
99
|
+
"no-restricted-imports": 2,
|
|
100
|
+
"no-return-assign": 2,
|
|
101
|
+
"no-self-assign": 2,
|
|
102
|
+
"no-self-compare": 2,
|
|
103
|
+
"no-sequences": 2,
|
|
104
|
+
"no-shadow": 2,
|
|
105
|
+
"no-shadow-restricted-names": 2,
|
|
106
|
+
"no-spaced-func": 2,
|
|
107
|
+
"no-sparse-arrays": 2,
|
|
108
|
+
"no-this-before-super": 2,
|
|
109
|
+
"no-throw-literal": 2,
|
|
110
|
+
"no-unexpected-multiline": 2,
|
|
111
|
+
"no-unmodified-loop-condition": 2,
|
|
112
|
+
"no-unreachable": 2,
|
|
113
|
+
"no-unused-vars": "off",
|
|
114
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
115
|
+
"no-useless-call": 2,
|
|
116
|
+
"no-useless-computed-key": 2,
|
|
117
|
+
"no-useless-concat": 2,
|
|
118
|
+
"no-useless-rename": 2,
|
|
119
|
+
"no-var": 2,
|
|
120
|
+
"no-whitespace-before-property": 2,
|
|
121
|
+
"object-curly-newline": 0,
|
|
122
|
+
"object-curly-spacing": [ 2, "always" ],
|
|
123
|
+
"object-property-newline": [ 2, { "allowMultiplePropertiesPerLine": true } ],
|
|
124
|
+
"prefer-const": 2,
|
|
125
|
+
"prefer-rest-params": 2,
|
|
126
|
+
"prefer-spread": 2,
|
|
127
|
+
"prefer-template": 2,
|
|
128
|
+
"quotes": [ 2, "single", { "avoidEscape": true } ],
|
|
129
|
+
"semi": [ 2, "always" ],
|
|
130
|
+
"semi-spacing": 2,
|
|
131
|
+
"space-before-blocks": 2,
|
|
132
|
+
"space-before-function-paren": [ 2,
|
|
133
|
+
{
|
|
134
|
+
"anonymous": "never",
|
|
135
|
+
"named": "never",
|
|
136
|
+
"asyncArrow": "always"
|
|
137
|
+
}],
|
|
138
|
+
"space-in-parens": [ 2, "never" ],
|
|
139
|
+
"spaced-comment": [ 2, "always" ],
|
|
140
|
+
"strict": 2,
|
|
141
|
+
"valid-typeof": 2
|
|
142
|
+
}
|
|
143
|
+
}
|
package/lib/Evaluator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Evaluator.d.ts","sourceRoot":"","sources":["../src/Evaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Evaluator.d.ts","sourceRoot":"","sources":["../src/Evaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAW7D,MAAM,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAErF,qBAAa,SAAS;aAaJ,MAAM,EAAE,eAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAfnC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,YAAY,CAAoC;IAExD,OAAO,CAAC,iBAAiB,CAAoC;IAC7D,OAAO,CAAC,QAAQ,CAAsB;IAEtC,OAAO,CAAC,mBAAmB,CAA6D;IACxF,OAAO,CAAC,cAAc,CAAmC;IACzD,OAAO,CAAC,qBAAqB,CAAgC;IAC7D,OAAO,CAAC,gBAAgB,CAA8B;gBAGrC,MAAM,EAAE,eAAe,EACtB,cAAc,EAAE,SAAS,EACzB,gBAAgB,EAAE,eAAe,EACjC,iBAAiB,EAAE,gBAAgB;IAe9C,UAAU,CAAC,OAAO,EAAE,gBAAgB;IAUpC,aAAa,CAAC,OAAO,EAAE,gBAAgB;IAUvC,qBAAqB,CAAC,YAAY,EAAE,0BAA0B;IAQ9D,sBAAsB,CAAC,YAAY,EAAE,0BAA0B;IAO/D,EAAE,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAMjG,IAAI,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAMnG,GAAG,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAMzG,OAAO,CAAC,KAAK;IAIN,kBAAkB,CAAC,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,GAAG,IAAI;YAqD7D,KAAK;IAyBnB,IAAW,cAAc,IAAI,MAAM,CAElC;YAEa,QAAQ;CA6BtB"}
|
package/lib/Evaluator.js
CHANGED
|
@@ -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.Evaluator = void 0;
|
|
4
13
|
const logger_1 = require("./common/logger");
|
|
@@ -26,11 +35,11 @@ class Evaluator {
|
|
|
26
35
|
this._customProcessor = (0, Processor_1.createProcessor)();
|
|
27
36
|
}
|
|
28
37
|
addProcess(process) {
|
|
29
|
-
const middleware =
|
|
30
|
-
|
|
38
|
+
const middleware = (context, next) => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
yield process(context);
|
|
31
40
|
if (next)
|
|
32
|
-
|
|
33
|
-
};
|
|
41
|
+
yield next(context);
|
|
42
|
+
});
|
|
34
43
|
this._evaluatorProcesses.set(process, middleware);
|
|
35
44
|
this._customProcessor.addMiddleware(middleware);
|
|
36
45
|
}
|
|
@@ -43,17 +52,10 @@ class Evaluator {
|
|
|
43
52
|
this._customProcessor.removeMiddleware(middleware);
|
|
44
53
|
}
|
|
45
54
|
addClosedClientSource(clientSource) {
|
|
46
|
-
this._clientOperations.set(clientSource.clientId, {
|
|
47
|
-
type: 'detach',
|
|
48
|
-
...clientSource,
|
|
49
|
-
detached: Date.now(),
|
|
50
|
-
});
|
|
55
|
+
this._clientOperations.set(clientSource.clientId, Object.assign(Object.assign({ type: 'detach' }, clientSource), { detached: Date.now() }));
|
|
51
56
|
}
|
|
52
57
|
addCreatedClientSource(clientSource) {
|
|
53
|
-
this._clientOperations.set(clientSource.clientId, {
|
|
54
|
-
type: 'join',
|
|
55
|
-
...clientSource,
|
|
56
|
-
});
|
|
58
|
+
this._clientOperations.set(clientSource.clientId, Object.assign({ type: 'join' }, clientSource));
|
|
57
59
|
}
|
|
58
60
|
on(event, listener) {
|
|
59
61
|
this._emitter.addListener(event, listener);
|
|
@@ -111,53 +113,58 @@ class Evaluator {
|
|
|
111
113
|
this._clientOperations.clear();
|
|
112
114
|
this._eval(callOperations, evaluatorContext)
|
|
113
115
|
.then(() => {
|
|
114
|
-
logger.debug(
|
|
116
|
+
logger.debug('Evaluator is successfully performed eval process');
|
|
115
117
|
})
|
|
116
118
|
.catch((err) => {
|
|
117
|
-
logger.warn(
|
|
119
|
+
logger.warn('Error occurred while evaluating', err);
|
|
118
120
|
});
|
|
119
121
|
}
|
|
120
|
-
|
|
122
|
+
_eval(callOperationsContext, evaluatorContext) {
|
|
121
123
|
var _a;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
.
|
|
128
|
-
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
const actualBlockingPoint = (_a = this._evaluations.get(this._index)) !== null && _a !== void 0 ? _a : Promise.resolve();
|
|
126
|
+
const index = ++this._index;
|
|
127
|
+
const result = new Promise((resolve, reject) => {
|
|
128
|
+
actualBlockingPoint.then(() => {
|
|
129
|
+
this._process(callOperationsContext, evaluatorContext)
|
|
130
|
+
.then(() => resolve())
|
|
131
|
+
.catch((err) => reject(err));
|
|
132
|
+
});
|
|
129
133
|
});
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
const nextBlockingPoint = new Promise((resolve) => {
|
|
135
|
+
result.then(() => {
|
|
136
|
+
this._evaluations.delete(index);
|
|
137
|
+
resolve();
|
|
138
|
+
}).catch(() => {
|
|
139
|
+
this._evaluations.delete(index);
|
|
140
|
+
resolve();
|
|
141
|
+
});
|
|
138
142
|
});
|
|
143
|
+
this._evaluations.set(index, nextBlockingPoint);
|
|
144
|
+
return result;
|
|
139
145
|
});
|
|
140
|
-
this._evaluations.set(index, nextBlockingPoint);
|
|
141
|
-
return result;
|
|
142
146
|
}
|
|
143
147
|
get ongoingProcess() {
|
|
144
148
|
return this._evaluations.size;
|
|
145
149
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
this.
|
|
150
|
+
_process(callOperationsContext, evaluatorContext) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
const process = () => __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
yield this._callSemaphore.acquire();
|
|
154
|
+
yield this._callProcessor.use(callOperationsContext).finally(() => {
|
|
155
|
+
this._callSemaphore.release();
|
|
156
|
+
});
|
|
157
|
+
const transactionContext = yield (0, TransactionContext_1.createTransactionContext)(evaluatorContext, this._storageProvider, evaluatorContext.observedCalls, evaluatorContext.observedSfus);
|
|
158
|
+
yield this._transactionProcessor.use(transactionContext);
|
|
159
|
+
yield this._customProcessor.use(evaluatorContext);
|
|
160
|
+
});
|
|
161
|
+
yield process().then(() => {
|
|
162
|
+
this._emit('ready', undefined);
|
|
163
|
+
})
|
|
164
|
+
.catch((err) => {
|
|
165
|
+
logger.warn('Error occurred while evaluating samples', err);
|
|
166
|
+
this._emit('ready', err);
|
|
151
167
|
});
|
|
152
|
-
const transactionContext = await (0, TransactionContext_1.createTransactionContext)(evaluatorContext, this._storageProvider, evaluatorContext.observedCalls, evaluatorContext.observedSfus);
|
|
153
|
-
await this._transactionProcessor.use(transactionContext);
|
|
154
|
-
await this._customProcessor.use(evaluatorContext);
|
|
155
|
-
};
|
|
156
|
-
await process().then(() => {
|
|
157
|
-
this._emit('ready', undefined);
|
|
158
|
-
}).catch(err => {
|
|
159
|
-
logger.warn(`Error occurred while evaluating samples`, err);
|
|
160
|
-
this._emit('ready', err);
|
|
161
168
|
});
|
|
162
169
|
}
|
|
163
170
|
}
|