@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.
Files changed (212) hide show
  1. package/.eslintrc.json +143 -0
  2. package/lib/Evaluator.d.ts.map +1 -1
  3. package/lib/Evaluator.js +54 -47
  4. package/lib/Observer.d.ts +1404 -38
  5. package/lib/Observer.d.ts.map +1 -1
  6. package/lib/Observer.js +479 -176
  7. package/lib/common/Semaphore.d.ts.map +1 -1
  8. package/lib/common/callMetaReports.d.ts.map +1 -1
  9. package/lib/common/callMetaReports.js +1 -0
  10. package/lib/common/logger.d.ts.map +1 -1
  11. package/lib/common/logger.js +15 -15
  12. package/lib/common/utils.d.ts +1 -0
  13. package/lib/common/utils.d.ts.map +1 -1
  14. package/lib/common/utils.js +12 -1
  15. package/lib/entries/CallEntry.d.ts +611 -0
  16. package/lib/entries/CallEntry.d.ts.map +1 -0
  17. package/lib/entries/CallEntry.js +75 -0
  18. package/lib/entries/ClientEntry.d.ts +474 -0
  19. package/lib/entries/ClientEntry.d.ts.map +1 -0
  20. package/lib/entries/ClientEntry.js +101 -0
  21. package/lib/entries/InboundTrackEntry.d.ts +670 -0
  22. package/lib/entries/InboundTrackEntry.d.ts.map +1 -0
  23. package/lib/entries/InboundTrackEntry.js +76 -0
  24. package/lib/entries/OutboundTrackEntry.d.ts +670 -0
  25. package/lib/entries/OutboundTrackEntry.d.ts.map +1 -0
  26. package/lib/entries/OutboundTrackEntry.js +73 -0
  27. package/lib/entries/PeerConnectionEntry.d.ts +469 -0
  28. package/lib/entries/PeerConnectionEntry.d.ts.map +1 -0
  29. package/lib/entries/PeerConnectionEntry.js +144 -0
  30. package/lib/entries/SfuEntry.d.ts +150 -0
  31. package/lib/entries/SfuEntry.d.ts.map +1 -0
  32. package/lib/entries/SfuEntry.js +77 -0
  33. package/lib/entries/SfuInboundRtpPadEntry.d.ts +14 -0
  34. package/lib/entries/SfuInboundRtpPadEntry.d.ts.map +1 -0
  35. package/lib/entries/SfuInboundRtpPadEntry.js +49 -0
  36. package/lib/entries/SfuOutboundRtpPadEntry.d.ts +14 -0
  37. package/lib/entries/SfuOutboundRtpPadEntry.d.ts.map +1 -0
  38. package/lib/entries/SfuOutboundRtpPadEntry.js +47 -0
  39. package/lib/entries/SfuSctpChannelEntry.d.ts +12 -0
  40. package/lib/entries/SfuSctpChannelEntry.d.ts.map +1 -0
  41. package/lib/entries/SfuSctpChannelEntry.js +43 -0
  42. package/lib/entries/SfuTransportEntry.d.ts +82 -0
  43. package/lib/entries/SfuTransportEntry.d.ts.map +1 -0
  44. package/lib/entries/SfuTransportEntry.js +122 -0
  45. package/lib/index.d.ts +10 -0
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/middlewares/CallOperationsContext.d.ts.map +1 -1
  48. package/lib/middlewares/CallOperationsContext.js +2 -6
  49. package/lib/middlewares/CallProcessor.d.ts.map +1 -1
  50. package/lib/middlewares/CallProcessor.js +15 -6
  51. package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +1 -1
  52. package/lib/middlewares/CommitTransactionMiddleware.js +22 -26
  53. package/lib/middlewares/DeleteOutdatedCallEntries.d.ts.map +1 -1
  54. package/lib/middlewares/DeleteOutdatedCallEntries.js +29 -20
  55. package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts.map +1 -1
  56. package/lib/middlewares/DeleteOutdatedSfuEntries.js +27 -18
  57. package/lib/middlewares/Middleware.d.ts.map +1 -1
  58. package/lib/middlewares/Middleware.js +13 -4
  59. package/lib/middlewares/Processor.d.ts.map +1 -1
  60. package/lib/middlewares/Processor.js +18 -9
  61. package/lib/middlewares/TransactionContext.d.ts.map +1 -1
  62. package/lib/middlewares/TransactionContext.js +84 -73
  63. package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +1 -1
  64. package/lib/middlewares/VisitObservedCallsMiddleware.js +16 -7
  65. package/lib/middlewares/VisitObservedSfusMiddleware.d.ts.map +1 -1
  66. package/lib/middlewares/VisitObservedSfusMiddleware.js +15 -6
  67. package/lib/middlewares/visitors/visitClient.d.ts.map +1 -1
  68. package/lib/middlewares/visitors/visitClient.js +6 -18
  69. package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts.map +1 -1
  70. package/lib/middlewares/visitors/visitInboundAudioTrack.js +17 -20
  71. package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts.map +1 -1
  72. package/lib/middlewares/visitors/visitInboundVideoTrack.js +16 -21
  73. package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts.map +1 -1
  74. package/lib/middlewares/visitors/visitOutboundAudioTrack.js +16 -16
  75. package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +1 -1
  76. package/lib/middlewares/visitors/visitOutboundVideoTarck.js +16 -17
  77. package/lib/middlewares/visitors/visitPeerConnection.d.ts.map +1 -1
  78. package/lib/middlewares/visitors/visitPeerConnection.js +24 -40
  79. package/lib/middlewares/visitors/visitSfu.d.ts.map +1 -1
  80. package/lib/middlewares/visitors/visitSfu.js +6 -7
  81. package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts.map +1 -1
  82. package/lib/middlewares/visitors/visitSfuInboundRtpPad.js +3 -7
  83. package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts.map +1 -1
  84. package/lib/middlewares/visitors/visitSfuOutboundRtpPad.js +3 -8
  85. package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts.map +1 -1
  86. package/lib/middlewares/visitors/visitSfuSctpChannel.js +3 -6
  87. package/lib/middlewares/visitors/visitSfuTransport.d.ts.map +1 -1
  88. package/lib/middlewares/visitors/visitSfuTransport.js +3 -6
  89. package/lib/processes/closePeerConnectionProcess.d.ts.map +1 -1
  90. package/lib/processes/closePeerConnectionProcess.js +14 -5
  91. package/lib/processes/detachClientProcess.d.ts.map +1 -1
  92. package/lib/processes/detachClientProcess.js +20 -17
  93. package/lib/processes/findRemoteMatches.d.ts +2 -2
  94. package/lib/processes/findRemoteMatches.d.ts.map +1 -1
  95. package/lib/processes/findRemoteMatches.js +70 -56
  96. package/lib/processes/inboundTrackRemoved.d.ts.map +1 -1
  97. package/lib/processes/inboundTrackRemoved.js +12 -3
  98. package/lib/processes/joinClientProcess.d.ts.map +1 -1
  99. package/lib/processes/joinClientProcess.js +15 -6
  100. package/lib/processes/outboundTrackRemoved.d.ts.map +1 -1
  101. package/lib/processes/outboundTrackRemoved.js +12 -3
  102. package/lib/samples/ObservedCall.d.ts.map +1 -1
  103. package/lib/samples/ObservedCall.js +1 -5
  104. package/lib/samples/ObservedCalls.d.ts.map +1 -1
  105. package/lib/samples/ObservedClient.d.ts.map +1 -1
  106. package/lib/samples/ObservedClient.js +1 -9
  107. package/lib/samples/ObservedInboundAudioTrack.d.ts.map +1 -1
  108. package/lib/samples/ObservedInboundAudioTrack.js +1 -5
  109. package/lib/samples/ObservedInboundVideoTrack.d.ts.map +1 -1
  110. package/lib/samples/ObservedInboundVideoTrack.js +1 -5
  111. package/lib/samples/ObservedOutboundAudioTrack.d.ts.map +1 -1
  112. package/lib/samples/ObservedOutboundAudioTrack.js +1 -5
  113. package/lib/samples/ObservedOutboundVideoTrack.d.ts.map +1 -1
  114. package/lib/samples/ObservedOutboundVideoTrack.js +1 -5
  115. package/lib/samples/ObservedPeerConnection.d.ts.map +1 -1
  116. package/lib/samples/ObservedPeerConnection.js +1 -12
  117. package/lib/samples/ObservedSfu.d.ts.map +1 -1
  118. package/lib/samples/ObservedSfu.js +1 -8
  119. package/lib/samples/ObservedSfuInboundRtpPad.d.ts.map +1 -1
  120. package/lib/samples/ObservedSfuInboundRtpPad.js +1 -5
  121. package/lib/samples/ObservedSfuOutboundRtpPad.d.ts.map +1 -1
  122. package/lib/samples/ObservedSfuOutboundRtpPad.js +1 -5
  123. package/lib/samples/ObservedSfuSctpChannel.d.ts.map +1 -1
  124. package/lib/samples/ObservedSfuSctpChannel.js +1 -5
  125. package/lib/samples/ObservedSfuTransport.d.ts.map +1 -1
  126. package/lib/samples/ObservedSfuTransport.js +1 -8
  127. package/lib/samples/ObservedSfus.d.ts.map +1 -1
  128. package/lib/sinks/ObserverSink.d.ts.map +1 -1
  129. package/lib/sinks/ObserverSink.js +42 -31
  130. package/lib/sinks/callEventReports.js +1 -0
  131. package/lib/sources/ObservedCallSource.d.ts +5 -3
  132. package/lib/sources/ObservedCallSource.d.ts.map +1 -1
  133. package/lib/sources/ObservedClientSource.d.ts +3 -2
  134. package/lib/sources/ObservedClientSource.d.ts.map +1 -1
  135. package/lib/sources/ObservedSfuSource.d.ts +3 -2
  136. package/lib/sources/ObservedSfuSource.d.ts.map +1 -1
  137. package/lib/sources/Sources.d.ts +8 -4
  138. package/lib/sources/Sources.d.ts.map +1 -1
  139. package/lib/sources/Sources.js +71 -46
  140. package/lib/storages/ObserverStorage.d.ts.map +1 -1
  141. package/lib/storages/SimpleStorage.d.ts.map +1 -1
  142. package/lib/storages/SimpleStorage.js +40 -23
  143. package/package.json +1 -1
  144. package/src/Evaluator.ts +17 -9
  145. package/src/Observer.ts +230 -170
  146. package/src/common/Semaphore.ts +2 -0
  147. package/src/common/callMetaReports.ts +30 -28
  148. package/src/common/logger.ts +140 -132
  149. package/src/common/types.ts +1 -1
  150. package/src/common/utils.ts +12 -1
  151. package/src/entries/CallEntry.ts +62 -0
  152. package/src/entries/ClientEntry.ts +90 -0
  153. package/src/entries/InboundTrackEntry.ts +74 -0
  154. package/src/entries/OutboundTrackEntry.ts +72 -0
  155. package/src/entries/PeerConnectionEntry.ts +133 -0
  156. package/src/entries/SfuEntry.ts +62 -0
  157. package/src/entries/SfuInboundRtpPadEntry.ts +46 -0
  158. package/src/entries/SfuOutboundRtpPadEntry.ts +44 -0
  159. package/src/entries/SfuSctpChannelEntry.ts +39 -0
  160. package/src/entries/SfuTransportEntry.ts +109 -0
  161. package/src/index.ts +11 -0
  162. package/src/middlewares/CallOperationsContext.ts +9 -5
  163. package/src/middlewares/CallProcessor.ts +4 -2
  164. package/src/middlewares/CommitTransactionMiddleware.ts +8 -5
  165. package/src/middlewares/DeleteOutdatedCallEntries.ts +24 -16
  166. package/src/middlewares/DeleteOutdatedSfuEntries.ts +24 -15
  167. package/src/middlewares/Middleware.ts +1 -0
  168. package/src/middlewares/Processor.ts +10 -5
  169. package/src/middlewares/TransactionContext.ts +1 -2
  170. package/src/middlewares/VisitObservedCallsMiddleware.ts +5 -2
  171. package/src/middlewares/VisitObservedSfusMiddleware.ts +8 -7
  172. package/src/middlewares/visitors/visitClient.ts +15 -1
  173. package/src/middlewares/visitors/visitInboundAudioTrack.ts +4 -1
  174. package/src/middlewares/visitors/visitInboundVideoTrack.ts +5 -1
  175. package/src/middlewares/visitors/visitOutboundAudioTrack.ts +5 -1
  176. package/src/middlewares/visitors/visitOutboundVideoTarck.ts +5 -1
  177. package/src/middlewares/visitors/visitPeerConnection.ts +15 -2
  178. package/src/middlewares/visitors/visitSfu.ts +7 -1
  179. package/src/middlewares/visitors/visitSfuInboundRtpPad.ts +4 -2
  180. package/src/middlewares/visitors/visitSfuOutboundRtpPad.ts +3 -1
  181. package/src/middlewares/visitors/visitSfuSctpChannel.ts +23 -21
  182. package/src/middlewares/visitors/visitSfuTransport.ts +3 -1
  183. package/src/processes/closePeerConnectionProcess.ts +3 -0
  184. package/src/processes/detachClientProcess.ts +13 -4
  185. package/src/processes/findRemoteMatches.ts +32 -21
  186. package/src/processes/inboundTrackRemoved.ts +2 -0
  187. package/src/processes/joinClientProcess.ts +8 -2
  188. package/src/processes/outboundTrackRemoved.ts +2 -0
  189. package/src/samples/ObservedCall.ts +6 -0
  190. package/src/samples/ObservedCalls.ts +13 -7
  191. package/src/samples/ObservedClient.ts +24 -8
  192. package/src/samples/ObservedInboundAudioTrack.ts +3 -2
  193. package/src/samples/ObservedInboundVideoTrack.ts +3 -2
  194. package/src/samples/ObservedOutboundAudioTrack.ts +3 -2
  195. package/src/samples/ObservedOutboundVideoTrack.ts +3 -2
  196. package/src/samples/ObservedPeerConnection.ts +27 -11
  197. package/src/samples/ObservedSfu.ts +17 -10
  198. package/src/samples/ObservedSfuInboundRtpPad.ts +5 -4
  199. package/src/samples/ObservedSfuOutboundRtpPad.ts +5 -4
  200. package/src/samples/ObservedSfuSctpChannel.ts +13 -13
  201. package/src/samples/ObservedSfuTransport.ts +19 -7
  202. package/src/samples/ObservedSfus.ts +10 -5
  203. package/src/sinks/ObserverSink.ts +51 -44
  204. package/src/sinks/callEventReports.ts +1 -1
  205. package/src/sources/ObservedCallSource.ts +6 -5
  206. package/src/sources/ObservedClientSource.ts +3 -2
  207. package/src/sources/ObservedSfuSource.ts +4 -8
  208. package/src/sources/Sources.ts +96 -22
  209. package/src/storages/ObserverStorage.ts +1 -0
  210. package/src/storages/SimpleStorage.ts +44 -21
  211. package/tsconfig.json +7 -5
  212. 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
+ }
@@ -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,EAAuB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,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 = async (context, next) => {
30
- await process(context);
38
+ const middleware = (context, next) => __awaiter(this, void 0, void 0, function* () {
39
+ yield process(context);
31
40
  if (next)
32
- await next(context);
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(`Evaluator is successfully performed eval process`);
116
+ logger.debug('Evaluator is successfully performed eval process');
115
117
  })
116
118
  .catch((err) => {
117
- logger.warn(`Error occurred while evaluating`, err);
119
+ logger.warn('Error occurred while evaluating', err);
118
120
  });
119
121
  }
120
- async _eval(callOperationsContext, evaluatorContext) {
122
+ _eval(callOperationsContext, evaluatorContext) {
121
123
  var _a;
122
- const actualBlockingPoint = (_a = this._evaluations.get(this._index)) !== null && _a !== void 0 ? _a : Promise.resolve();
123
- const index = ++this._index;
124
- const result = new Promise((resolve, reject) => {
125
- actualBlockingPoint.then(() => {
126
- this._process(callOperationsContext, evaluatorContext)
127
- .then(() => resolve())
128
- .catch((err) => reject(err));
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
- const nextBlockingPoint = new Promise((resolve) => {
132
- result.then(() => {
133
- this._evaluations.delete(index);
134
- resolve();
135
- }).catch(() => {
136
- this._evaluations.delete(index);
137
- resolve();
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
- async _process(callOperationsContext, evaluatorContext) {
147
- const process = async () => {
148
- await this._callSemaphore.acquire();
149
- await this._callProcessor.use(callOperationsContext).finally(() => {
150
- this._callSemaphore.release();
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
  }