@allurereport/core 3.0.0-beta.17 → 3.0.0-beta.19
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/dist/api.d.ts +3 -1
- package/dist/config.js +2 -1
- package/dist/history.js +2 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/qualityGate/index.d.ts +2 -0
- package/dist/qualityGate/index.js +2 -0
- package/dist/qualityGate/qualityGate.d.ts +21 -0
- package/dist/qualityGate/qualityGate.js +96 -0
- package/dist/qualityGate/rules.d.ts +5 -0
- package/dist/qualityGate/rules.js +45 -0
- package/dist/report.d.ts +17 -4
- package/dist/report.js +239 -35
- package/dist/store/store.d.ts +13 -5
- package/dist/store/store.js +262 -51
- package/dist/utils/event.d.ts +38 -9
- package/dist/utils/event.js +101 -25
- package/package.json +24 -20
- package/dist/qualityGate.d.ts +0 -25
- package/dist/qualityGate.js +0 -116
package/dist/store/store.js
CHANGED
|
@@ -9,9 +9,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _DefaultAllureStore_testResults, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_known, _DefaultAllureStore_fixtures, _DefaultAllureStore_defaultLabels, _DefaultAllureStore_environmentsConfig, _DefaultAllureStore_reportVariables,
|
|
13
|
-
import { compareBy, getWorstStatus, matchEnvironment, nullsLast, ordinal, reverse, } from "@allurereport/core-api";
|
|
14
|
-
import { md5 } from "@allurereport/plugin-api";
|
|
12
|
+
var _DefaultAllureStore_instances, _DefaultAllureStore_testResults, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_known, _DefaultAllureStore_fixtures, _DefaultAllureStore_defaultLabels, _DefaultAllureStore_environment, _DefaultAllureStore_environmentsConfig, _DefaultAllureStore_reportVariables, _DefaultAllureStore_realtimeDispatcher, _DefaultAllureStore_realtimeSubscriber, _DefaultAllureStore_globalAttachments, _DefaultAllureStore_globalErrors, _DefaultAllureStore_globalExitCode, _DefaultAllureStore_qualityGateResultsByRules, _DefaultAllureStore_historyPoints, _DefaultAllureStore_repoData, _DefaultAllureStore_environments, _DefaultAllureStore_addEnvironments;
|
|
13
|
+
import { DEFAULT_ENVIRONMENT, compareBy, getWorstStatus, htrsByTr, matchEnvironment, nullsLast, ordinal, reverse, } from "@allurereport/core-api";
|
|
14
|
+
import { md5, } from "@allurereport/plugin-api";
|
|
15
15
|
import { isFlaky } from "../utils/flaky.js";
|
|
16
16
|
import { getGitBranch, getGitRepoName } from "../utils/git.js";
|
|
17
17
|
import { getStatusTransition } from "../utils/new.js";
|
|
@@ -26,8 +26,66 @@ const index = (indexMap, key, ...items) => {
|
|
|
26
26
|
current.push(...items);
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
+
const wasStartedEarlier = (first, second) => first.start === undefined || second.start === undefined || first.start < second.start;
|
|
30
|
+
const hidePreviousAttempt = (state, testResult) => {
|
|
31
|
+
const { environment, historyId } = testResult;
|
|
32
|
+
if (environment) {
|
|
33
|
+
if (!state.has(environment)) {
|
|
34
|
+
state.set(environment, new Map());
|
|
35
|
+
}
|
|
36
|
+
if (historyId) {
|
|
37
|
+
const historyIdToLastAttemptResult = state.get(environment);
|
|
38
|
+
const currentLastAttemptResult = historyIdToLastAttemptResult.get(historyId);
|
|
39
|
+
if (currentLastAttemptResult) {
|
|
40
|
+
if (wasStartedEarlier(currentLastAttemptResult, testResult)) {
|
|
41
|
+
historyIdToLastAttemptResult.set(historyId, testResult);
|
|
42
|
+
currentLastAttemptResult.hidden = true;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
testResult.hidden = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
historyIdToLastAttemptResult.set(historyId, testResult);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export const mapToObject = (map) => {
|
|
55
|
+
const result = {};
|
|
56
|
+
map.forEach((value, key) => {
|
|
57
|
+
result[key] = value;
|
|
58
|
+
});
|
|
59
|
+
return result;
|
|
60
|
+
};
|
|
61
|
+
export const mergeMapWithRecord = (map, record) => {
|
|
62
|
+
Object.entries(record).forEach(([key, value]) => {
|
|
63
|
+
const existingValue = map.get(key);
|
|
64
|
+
if (existingValue !== undefined) {
|
|
65
|
+
if (Array.isArray(existingValue) && Array.isArray(value)) {
|
|
66
|
+
map.set(key, [...existingValue, ...value]);
|
|
67
|
+
}
|
|
68
|
+
else if (typeof existingValue === "object" &&
|
|
69
|
+
existingValue !== null &&
|
|
70
|
+
typeof value === "object" &&
|
|
71
|
+
value !== null &&
|
|
72
|
+
!Array.isArray(existingValue) &&
|
|
73
|
+
!Array.isArray(value)) {
|
|
74
|
+
map.set(key, { ...existingValue, ...value });
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
map.set(key, value);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
map.set(key, value);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return map;
|
|
85
|
+
};
|
|
29
86
|
export class DefaultAllureStore {
|
|
30
87
|
constructor(params) {
|
|
88
|
+
_DefaultAllureStore_instances.add(this);
|
|
31
89
|
_DefaultAllureStore_testResults.set(this, void 0);
|
|
32
90
|
_DefaultAllureStore_attachments.set(this, void 0);
|
|
33
91
|
_DefaultAllureStore_attachmentContents.set(this, void 0);
|
|
@@ -37,18 +95,29 @@ export class DefaultAllureStore {
|
|
|
37
95
|
_DefaultAllureStore_known.set(this, void 0);
|
|
38
96
|
_DefaultAllureStore_fixtures.set(this, void 0);
|
|
39
97
|
_DefaultAllureStore_defaultLabels.set(this, {});
|
|
98
|
+
_DefaultAllureStore_environment.set(this, void 0);
|
|
40
99
|
_DefaultAllureStore_environmentsConfig.set(this, {});
|
|
41
100
|
_DefaultAllureStore_reportVariables.set(this, {});
|
|
42
|
-
|
|
101
|
+
_DefaultAllureStore_realtimeDispatcher.set(this, void 0);
|
|
102
|
+
_DefaultAllureStore_realtimeSubscriber.set(this, void 0);
|
|
43
103
|
this.indexTestResultByTestCase = new Map();
|
|
104
|
+
this.indexLatestEnvTestResultByHistoryId = new Map();
|
|
44
105
|
this.indexTestResultByHistoryId = new Map();
|
|
45
106
|
this.indexAttachmentByTestResult = new Map();
|
|
46
107
|
this.indexAttachmentByFixture = new Map();
|
|
47
108
|
this.indexFixturesByTestResult = new Map();
|
|
48
109
|
this.indexKnownByHistoryId = new Map();
|
|
110
|
+
_DefaultAllureStore_globalAttachments.set(this, []);
|
|
111
|
+
_DefaultAllureStore_globalErrors.set(this, []);
|
|
112
|
+
_DefaultAllureStore_globalExitCode.set(this, void 0);
|
|
113
|
+
_DefaultAllureStore_qualityGateResultsByRules.set(this, {});
|
|
49
114
|
_DefaultAllureStore_historyPoints.set(this, []);
|
|
50
115
|
_DefaultAllureStore_repoData.set(this, void 0);
|
|
51
|
-
|
|
116
|
+
_DefaultAllureStore_environments.set(this, []);
|
|
117
|
+
const { history, known = [], realtimeDispatcher, realtimeSubscriber, defaultLabels = {}, environment, environmentsConfig = {}, reportVariables = {}, } = params ?? {};
|
|
118
|
+
const environments = Object.keys(environmentsConfig)
|
|
119
|
+
.concat(environment ?? "")
|
|
120
|
+
.filter(Boolean);
|
|
52
121
|
__classPrivateFieldSet(this, _DefaultAllureStore_testResults, new Map(), "f");
|
|
53
122
|
__classPrivateFieldSet(this, _DefaultAllureStore_attachments, new Map(), "f");
|
|
54
123
|
__classPrivateFieldSet(this, _DefaultAllureStore_attachmentContents, new Map(), "f");
|
|
@@ -58,15 +127,36 @@ export class DefaultAllureStore {
|
|
|
58
127
|
__classPrivateFieldSet(this, _DefaultAllureStore_history, history, "f");
|
|
59
128
|
__classPrivateFieldSet(this, _DefaultAllureStore_known, [...known], "f");
|
|
60
129
|
__classPrivateFieldGet(this, _DefaultAllureStore_known, "f").forEach((ktf) => index(this.indexKnownByHistoryId, ktf.historyId, ktf));
|
|
61
|
-
__classPrivateFieldSet(this,
|
|
130
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_realtimeDispatcher, realtimeDispatcher, "f");
|
|
131
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_realtimeSubscriber, realtimeSubscriber, "f");
|
|
62
132
|
__classPrivateFieldSet(this, _DefaultAllureStore_defaultLabels, defaultLabels, "f");
|
|
63
133
|
__classPrivateFieldSet(this, _DefaultAllureStore_environmentsConfig, environmentsConfig, "f");
|
|
134
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_environment, environment, "f");
|
|
64
135
|
__classPrivateFieldSet(this, _DefaultAllureStore_reportVariables, reportVariables, "f");
|
|
65
|
-
this
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
136
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, environments);
|
|
137
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onQualityGateResults(async (results) => {
|
|
138
|
+
results.forEach((result) => {
|
|
139
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResultsByRules, "f")[result.rule] = result;
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalExitCode(async (exitCode) => {
|
|
143
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_globalExitCode, exitCode, "f");
|
|
144
|
+
});
|
|
145
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalError(async (error) => {
|
|
146
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f").push(error);
|
|
147
|
+
});
|
|
148
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalAttachment(async (attachment) => {
|
|
149
|
+
const attachmentLink = {
|
|
150
|
+
id: md5(attachment.getOriginalFileName()),
|
|
151
|
+
missed: false,
|
|
152
|
+
used: false,
|
|
153
|
+
ext: attachment.getExtension(),
|
|
154
|
+
originalFileName: attachment.getOriginalFileName(),
|
|
155
|
+
contentType: attachment.getContentType(),
|
|
156
|
+
contentLength: attachment.getContentLength(),
|
|
157
|
+
};
|
|
158
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").set(attachmentLink.id, attachment);
|
|
159
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachments, "f").push(attachmentLink);
|
|
70
160
|
});
|
|
71
161
|
}
|
|
72
162
|
async readHistory() {
|
|
@@ -101,6 +191,18 @@ export class DefaultAllureStore {
|
|
|
101
191
|
return undefined;
|
|
102
192
|
}
|
|
103
193
|
}
|
|
194
|
+
async qualityGateResults() {
|
|
195
|
+
return Object.values(__classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResultsByRules, "f"));
|
|
196
|
+
}
|
|
197
|
+
async globalExitCode() {
|
|
198
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_globalExitCode, "f");
|
|
199
|
+
}
|
|
200
|
+
async allGlobalErrors() {
|
|
201
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f");
|
|
202
|
+
}
|
|
203
|
+
async allGlobalAttachments() {
|
|
204
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachments, "f");
|
|
205
|
+
}
|
|
104
206
|
async visitTestResult(raw, context) {
|
|
105
207
|
const attachmentLinks = [];
|
|
106
208
|
const testResult = testResultRawToState({
|
|
@@ -122,32 +224,16 @@ export class DefaultAllureStore {
|
|
|
122
224
|
}
|
|
123
225
|
});
|
|
124
226
|
}
|
|
125
|
-
testResult.environment = matchEnvironment(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), testResult);
|
|
227
|
+
testResult.environment = __classPrivateFieldGet(this, _DefaultAllureStore_environment, "f") || matchEnvironment(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), testResult);
|
|
126
228
|
const trHistory = await this.historyByTr(testResult);
|
|
127
229
|
testResult.transition = getStatusTransition(testResult, trHistory);
|
|
128
230
|
testResult.flaky = isFlaky(testResult, trHistory);
|
|
129
231
|
__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").set(testResult.id, testResult);
|
|
130
|
-
|
|
131
|
-
const maybeOther = this.indexLatestEnvTestResultByHistoryId
|
|
132
|
-
.get(testResult.environment)
|
|
133
|
-
.get(testResult.historyId);
|
|
134
|
-
if (maybeOther) {
|
|
135
|
-
if (maybeOther.start === undefined || testResult.start === undefined || maybeOther.start < testResult.start) {
|
|
136
|
-
this.indexLatestEnvTestResultByHistoryId.get(testResult.environment).set(testResult.historyId, testResult);
|
|
137
|
-
maybeOther.hidden = true;
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
testResult.hidden = true;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
this.indexLatestEnvTestResultByHistoryId.get(testResult.environment).set(testResult.historyId, testResult);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
232
|
+
hidePreviousAttempt(this.indexLatestEnvTestResultByHistoryId, testResult);
|
|
147
233
|
index(this.indexTestResultByTestCase, testResult.testCase?.id, testResult);
|
|
148
234
|
index(this.indexTestResultByHistoryId, testResult.historyId, testResult);
|
|
149
235
|
index(this.indexAttachmentByTestResult, testResult.id, ...attachmentLinks);
|
|
150
|
-
__classPrivateFieldGet(this,
|
|
236
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeDispatcher, "f")?.sendTestResult(testResult.id);
|
|
151
237
|
}
|
|
152
238
|
async visitTestFixtureResult(result, context) {
|
|
153
239
|
const attachmentLinks = [];
|
|
@@ -160,7 +246,7 @@ export class DefaultAllureStore {
|
|
|
160
246
|
index(this.indexFixturesByTestResult, trId, testFixtureResult);
|
|
161
247
|
});
|
|
162
248
|
index(this.indexAttachmentByFixture, testFixtureResult.id, ...attachmentLinks);
|
|
163
|
-
__classPrivateFieldGet(this,
|
|
249
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeDispatcher, "f")?.sendTestFixtureResult(testFixtureResult.id);
|
|
164
250
|
}
|
|
165
251
|
async visitAttachmentFile(resultFile, context) {
|
|
166
252
|
const originalFileName = resultFile.getOriginalFileName();
|
|
@@ -185,7 +271,7 @@ export class DefaultAllureStore {
|
|
|
185
271
|
contentLength: resultFile.getContentLength(),
|
|
186
272
|
});
|
|
187
273
|
}
|
|
188
|
-
__classPrivateFieldGet(this,
|
|
274
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeDispatcher, "f")?.sendAttachmentFile(id);
|
|
189
275
|
}
|
|
190
276
|
async visitMetadata(metadata) {
|
|
191
277
|
Object.keys(metadata).forEach((key) => __classPrivateFieldGet(this, _DefaultAllureStore_metadata, "f").set(key, metadata[key]));
|
|
@@ -263,22 +349,7 @@ export class DefaultAllureStore {
|
|
|
263
349
|
return tr ? this.retriesByTr(tr) : [];
|
|
264
350
|
}
|
|
265
351
|
async historyByTr(tr) {
|
|
266
|
-
|
|
267
|
-
return [];
|
|
268
|
-
}
|
|
269
|
-
return [...__classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f")]
|
|
270
|
-
.filter((dp) => !!dp.testResults[tr.historyId])
|
|
271
|
-
.map((dp) => {
|
|
272
|
-
if (!dp.url) {
|
|
273
|
-
return dp.testResults[tr.historyId];
|
|
274
|
-
}
|
|
275
|
-
const url = new URL(dp.url);
|
|
276
|
-
url.hash = tr.id;
|
|
277
|
-
return {
|
|
278
|
-
...dp.testResults[tr.historyId],
|
|
279
|
-
url: url.toString(),
|
|
280
|
-
};
|
|
281
|
-
});
|
|
352
|
+
return htrsByTr(__classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f"), tr);
|
|
282
353
|
}
|
|
283
354
|
async historyByTrId(trId) {
|
|
284
355
|
const tr = await this.testResultById(trId);
|
|
@@ -331,7 +402,7 @@ export class DefaultAllureStore {
|
|
|
331
402
|
return getTestResultsStats(allWithStats, filter);
|
|
332
403
|
}
|
|
333
404
|
async allEnvironments() {
|
|
334
|
-
return
|
|
405
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_environments, "f");
|
|
335
406
|
}
|
|
336
407
|
async testResultsByEnvironment(env, options = { includeHidden: false }) {
|
|
337
408
|
const allTrs = await this.allTestResults(options);
|
|
@@ -365,7 +436,7 @@ export class DefaultAllureStore {
|
|
|
365
436
|
testResultsByEnv: {},
|
|
366
437
|
};
|
|
367
438
|
trs.forEach((tr) => {
|
|
368
|
-
const env = matchEnvironment(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), tr);
|
|
439
|
+
const env = tr.environment || __classPrivateFieldGet(this, _DefaultAllureStore_environment, "f") || matchEnvironment(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), tr);
|
|
369
440
|
envGroup.testResultsByEnv[env] = tr.id;
|
|
370
441
|
});
|
|
371
442
|
acc.push(envGroup);
|
|
@@ -381,5 +452,145 @@ export class DefaultAllureStore {
|
|
|
381
452
|
...(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f")?.[env]?.variables ?? {}),
|
|
382
453
|
};
|
|
383
454
|
}
|
|
455
|
+
dumpState() {
|
|
456
|
+
const storeDump = {
|
|
457
|
+
testResults: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")),
|
|
458
|
+
attachments: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f")),
|
|
459
|
+
testCases: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f")),
|
|
460
|
+
fixtures: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f")),
|
|
461
|
+
environments: __classPrivateFieldGet(this, _DefaultAllureStore_environments, "f"),
|
|
462
|
+
reportVariables: __classPrivateFieldGet(this, _DefaultAllureStore_reportVariables, "f"),
|
|
463
|
+
globalAttachments: __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachments, "f"),
|
|
464
|
+
globalErrors: __classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f"),
|
|
465
|
+
indexLatestEnvTestResultByHistoryId: {},
|
|
466
|
+
indexAttachmentByTestResult: {},
|
|
467
|
+
indexTestResultByHistoryId: {},
|
|
468
|
+
indexTestResultByTestCase: {},
|
|
469
|
+
indexAttachmentByFixture: {},
|
|
470
|
+
indexFixturesByTestResult: {},
|
|
471
|
+
indexKnownByHistoryId: {},
|
|
472
|
+
};
|
|
473
|
+
this.indexLatestEnvTestResultByHistoryId.forEach((envMap) => {
|
|
474
|
+
envMap.forEach((tr, historyId) => {
|
|
475
|
+
storeDump.indexLatestEnvTestResultByHistoryId[historyId] = tr.id;
|
|
476
|
+
});
|
|
477
|
+
});
|
|
478
|
+
this.indexAttachmentByFixture.forEach((link, fxId) => {
|
|
479
|
+
storeDump.indexAttachmentByFixture[fxId] = link.map((l) => l.id);
|
|
480
|
+
});
|
|
481
|
+
this.indexAttachmentByTestResult.forEach((links, trId) => {
|
|
482
|
+
storeDump.indexAttachmentByTestResult[trId] = links.map((l) => l.id);
|
|
483
|
+
});
|
|
484
|
+
this.indexTestResultByHistoryId.forEach((trs, historyId) => {
|
|
485
|
+
storeDump.indexTestResultByHistoryId[historyId] = trs.map((tr) => tr.id);
|
|
486
|
+
});
|
|
487
|
+
this.indexTestResultByTestCase.forEach((trs, tcId) => {
|
|
488
|
+
storeDump.indexTestResultByTestCase[tcId] = trs.map((tr) => tr.id);
|
|
489
|
+
});
|
|
490
|
+
this.indexFixturesByTestResult.forEach((fixtures, trId) => {
|
|
491
|
+
storeDump.indexFixturesByTestResult[trId] = fixtures.map((f) => f.id);
|
|
492
|
+
});
|
|
493
|
+
this.indexKnownByHistoryId.forEach((known, historyId) => {
|
|
494
|
+
storeDump.indexKnownByHistoryId[historyId] = known;
|
|
495
|
+
});
|
|
496
|
+
return storeDump;
|
|
497
|
+
}
|
|
498
|
+
async restoreState(stateDump, attachmentsContents = {}) {
|
|
499
|
+
const { testResults, attachments, testCases, fixtures, reportVariables, environments, globalAttachments = [], globalErrors = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexLatestEnvTestResultByHistoryId = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, indexKnownByHistoryId = {}, } = stateDump;
|
|
500
|
+
mergeMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f"), testResults);
|
|
501
|
+
mergeMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"), attachments);
|
|
502
|
+
mergeMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f"), testCases);
|
|
503
|
+
mergeMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f"), fixtures);
|
|
504
|
+
mergeMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f"), attachmentsContents);
|
|
505
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, environments);
|
|
506
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachments, "f").push(...globalAttachments);
|
|
507
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f").push(...globalErrors);
|
|
508
|
+
Object.assign(__classPrivateFieldGet(this, _DefaultAllureStore_reportVariables, "f"), reportVariables);
|
|
509
|
+
Object.entries(indexAttachmentByTestResult).forEach(([trId, links]) => {
|
|
510
|
+
const attachmentsLinks = links.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id)).filter(Boolean);
|
|
511
|
+
if (attachmentsLinks.length === 0) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
const existingLinks = this.indexAttachmentByTestResult.get(trId);
|
|
515
|
+
if (!existingLinks) {
|
|
516
|
+
this.indexAttachmentByTestResult.set(trId, attachmentsLinks);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
existingLinks.push(...attachmentsLinks);
|
|
520
|
+
});
|
|
521
|
+
Object.entries(indexTestResultByHistoryId).forEach(([historyId, trIds]) => {
|
|
522
|
+
const trs = trIds.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(id)).filter(Boolean);
|
|
523
|
+
if (trs.length === 0) {
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
const existingTrs = this.indexTestResultByHistoryId.get(historyId);
|
|
527
|
+
if (!existingTrs) {
|
|
528
|
+
this.indexTestResultByHistoryId.set(historyId, trs);
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
existingTrs.push(...trs);
|
|
532
|
+
});
|
|
533
|
+
Object.entries(indexTestResultByTestCase).forEach(([tcId, trIds]) => {
|
|
534
|
+
const trs = trIds.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(id)).filter(Boolean);
|
|
535
|
+
if (trs.length === 0) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
const existingTrs = this.indexTestResultByTestCase.get(tcId);
|
|
539
|
+
if (!existingTrs) {
|
|
540
|
+
this.indexTestResultByTestCase.set(tcId, trs);
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
existingTrs.push(...trs);
|
|
544
|
+
});
|
|
545
|
+
Object.entries(indexAttachmentByFixture).forEach(([fxId, attachmentIds]) => {
|
|
546
|
+
const attachmentsLinks = attachmentIds.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id)).filter(Boolean);
|
|
547
|
+
if (attachmentsLinks.length === 0) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
const existingLinks = this.indexAttachmentByFixture.get(fxId);
|
|
551
|
+
if (!existingLinks) {
|
|
552
|
+
this.indexAttachmentByFixture.set(fxId, attachmentsLinks);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
existingLinks.push(...attachmentsLinks);
|
|
556
|
+
});
|
|
557
|
+
Object.entries(indexFixturesByTestResult).forEach(([trId, fixtureIds]) => {
|
|
558
|
+
const fxs = fixtureIds.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f").get(id)).filter(Boolean);
|
|
559
|
+
if (fxs.length === 0) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
const existingFixtures = this.indexFixturesByTestResult.get(trId);
|
|
563
|
+
if (!existingFixtures) {
|
|
564
|
+
this.indexFixturesByTestResult.set(trId, fxs);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
existingFixtures.push(...fxs);
|
|
568
|
+
});
|
|
569
|
+
Object.entries(indexKnownByHistoryId).forEach(([historyId, knownFailures]) => {
|
|
570
|
+
const existingKnown = this.indexKnownByHistoryId.get(historyId);
|
|
571
|
+
if (!existingKnown) {
|
|
572
|
+
this.indexKnownByHistoryId.set(historyId, knownFailures);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
existingKnown.push(...knownFailures);
|
|
576
|
+
});
|
|
577
|
+
Object.values(indexLatestEnvTestResultByHistoryId).forEach((trId) => {
|
|
578
|
+
const tr = __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(trId);
|
|
579
|
+
if (!tr) {
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
hidePreviousAttempt(this.indexLatestEnvTestResultByHistoryId, tr);
|
|
583
|
+
});
|
|
584
|
+
}
|
|
384
585
|
}
|
|
385
|
-
_DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_attachments = new WeakMap(), _DefaultAllureStore_attachmentContents = new WeakMap(), _DefaultAllureStore_testCases = new WeakMap(), _DefaultAllureStore_metadata = new WeakMap(), _DefaultAllureStore_history = new WeakMap(), _DefaultAllureStore_known = new WeakMap(), _DefaultAllureStore_fixtures = new WeakMap(), _DefaultAllureStore_defaultLabels = new WeakMap(), _DefaultAllureStore_environmentsConfig = new WeakMap(), _DefaultAllureStore_reportVariables = new WeakMap(),
|
|
586
|
+
_DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_attachments = new WeakMap(), _DefaultAllureStore_attachmentContents = new WeakMap(), _DefaultAllureStore_testCases = new WeakMap(), _DefaultAllureStore_metadata = new WeakMap(), _DefaultAllureStore_history = new WeakMap(), _DefaultAllureStore_known = new WeakMap(), _DefaultAllureStore_fixtures = new WeakMap(), _DefaultAllureStore_defaultLabels = new WeakMap(), _DefaultAllureStore_environment = new WeakMap(), _DefaultAllureStore_environmentsConfig = new WeakMap(), _DefaultAllureStore_reportVariables = new WeakMap(), _DefaultAllureStore_realtimeDispatcher = new WeakMap(), _DefaultAllureStore_realtimeSubscriber = new WeakMap(), _DefaultAllureStore_globalAttachments = new WeakMap(), _DefaultAllureStore_globalErrors = new WeakMap(), _DefaultAllureStore_globalExitCode = new WeakMap(), _DefaultAllureStore_qualityGateResultsByRules = new WeakMap(), _DefaultAllureStore_historyPoints = new WeakMap(), _DefaultAllureStore_repoData = new WeakMap(), _DefaultAllureStore_environments = new WeakMap(), _DefaultAllureStore_instances = new WeakSet(), _DefaultAllureStore_addEnvironments = function _DefaultAllureStore_addEnvironments(envs) {
|
|
587
|
+
if (__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").length === 0) {
|
|
588
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").push(DEFAULT_ENVIRONMENT);
|
|
589
|
+
}
|
|
590
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_environments, Array.from(new Set([...__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f"), ...envs])), "f");
|
|
591
|
+
envs.forEach((key) => {
|
|
592
|
+
if (!this.indexLatestEnvTestResultByHistoryId.has(key)) {
|
|
593
|
+
this.indexLatestEnvTestResultByHistoryId.set(key, new Map());
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
};
|
package/dist/utils/event.d.ts
CHANGED
|
@@ -1,16 +1,45 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TestError } from "@allurereport/core-api";
|
|
2
|
+
import type { BatchOptions, ExitCode, QualityGateValidationResult, RealtimeEventsDispatcher as RealtimeEventsDispatcherType, RealtimeSubscriber as RealtimeSubscriberType, ResultFile } from "@allurereport/plugin-api";
|
|
2
3
|
import type { EventEmitter } from "node:events";
|
|
4
|
+
export declare enum RealtimeEvents {
|
|
5
|
+
TestResult = "testResult",
|
|
6
|
+
TestFixtureResult = "testFixtureResult",
|
|
7
|
+
AttachmentFile = "attachmentFile",
|
|
8
|
+
QualityGateResults = "qualityGateResults",
|
|
9
|
+
GlobalAttachment = "globalAttachment",
|
|
10
|
+
GlobalError = "globalError",
|
|
11
|
+
GlobalExitCode = "globalExitCode"
|
|
12
|
+
}
|
|
3
13
|
export interface AllureStoreEvents {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
14
|
+
[RealtimeEvents.QualityGateResults]: [QualityGateValidationResult[]];
|
|
15
|
+
[RealtimeEvents.TestResult]: [string];
|
|
16
|
+
[RealtimeEvents.TestFixtureResult]: [string];
|
|
17
|
+
[RealtimeEvents.AttachmentFile]: [string];
|
|
18
|
+
[RealtimeEvents.GlobalAttachment]: [ResultFile];
|
|
19
|
+
[RealtimeEvents.GlobalExitCode]: [ExitCode];
|
|
20
|
+
[RealtimeEvents.GlobalError]: [TestError];
|
|
21
|
+
}
|
|
22
|
+
export declare class RealtimeEventsDispatcher implements RealtimeEventsDispatcherType {
|
|
23
|
+
#private;
|
|
24
|
+
constructor(emitter: EventEmitter<AllureStoreEvents>);
|
|
25
|
+
sendGlobalAttachment(attachment: ResultFile): void;
|
|
26
|
+
sendGlobalExitCode(codes: ExitCode): void;
|
|
27
|
+
sendGlobalError(error: TestError): void;
|
|
28
|
+
sendQualityGateResults(payload: QualityGateValidationResult[]): void;
|
|
29
|
+
sendTestResult(trId: string): void;
|
|
30
|
+
sendTestFixtureResult(tfrId: string): void;
|
|
31
|
+
sendAttachmentFile(afId: string): void;
|
|
7
32
|
}
|
|
8
|
-
export declare class
|
|
33
|
+
export declare class RealtimeSubscriber implements RealtimeSubscriberType {
|
|
9
34
|
#private;
|
|
10
35
|
constructor(emitter: EventEmitter<AllureStoreEvents>);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
36
|
+
onGlobalAttachment(listener: (attachment: ResultFile) => Promise<void>): () => void;
|
|
37
|
+
onGlobalExitCode(listener: (payload: ExitCode) => Promise<void>): () => void;
|
|
38
|
+
onGlobalError(listener: (error: TestError) => Promise<void>): () => void;
|
|
39
|
+
onQualityGateResults(listener: (payload: QualityGateValidationResult[]) => Promise<void>): () => void;
|
|
40
|
+
onTestResults(listener: (trIds: string[]) => Promise<void>, options?: BatchOptions): () => void;
|
|
41
|
+
onTestFixtureResults(listener: (tfrIds: string[]) => Promise<void>, options?: BatchOptions): () => void;
|
|
42
|
+
onAttachmentFiles(listener: (afIds: string[]) => Promise<void>, options?: BatchOptions): () => void;
|
|
43
|
+
onAll(listener: () => Promise<void>, options?: BatchOptions): () => void;
|
|
15
44
|
offAll(): void;
|
|
16
45
|
}
|
package/dist/utils/event.js
CHANGED
|
@@ -9,51 +9,127 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var
|
|
12
|
+
var _RealtimeEventsDispatcher_emitter, _RealtimeSubscriber_instances, _RealtimeSubscriber_emitter, _RealtimeSubscriber_handlers, _RealtimeSubscriber_createBatchHandler;
|
|
13
13
|
import console from "node:console";
|
|
14
14
|
import { setTimeout } from "node:timers/promises";
|
|
15
|
-
export
|
|
15
|
+
export var RealtimeEvents;
|
|
16
|
+
(function (RealtimeEvents) {
|
|
17
|
+
RealtimeEvents["TestResult"] = "testResult";
|
|
18
|
+
RealtimeEvents["TestFixtureResult"] = "testFixtureResult";
|
|
19
|
+
RealtimeEvents["AttachmentFile"] = "attachmentFile";
|
|
20
|
+
RealtimeEvents["QualityGateResults"] = "qualityGateResults";
|
|
21
|
+
RealtimeEvents["GlobalAttachment"] = "globalAttachment";
|
|
22
|
+
RealtimeEvents["GlobalError"] = "globalError";
|
|
23
|
+
RealtimeEvents["GlobalExitCode"] = "globalExitCode";
|
|
24
|
+
})(RealtimeEvents || (RealtimeEvents = {}));
|
|
25
|
+
export class RealtimeEventsDispatcher {
|
|
16
26
|
constructor(emitter) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
_RealtimeEventsDispatcher_emitter.set(this, void 0);
|
|
28
|
+
__classPrivateFieldSet(this, _RealtimeEventsDispatcher_emitter, emitter, "f");
|
|
29
|
+
}
|
|
30
|
+
sendGlobalAttachment(attachment) {
|
|
31
|
+
__classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.GlobalAttachment, attachment);
|
|
32
|
+
}
|
|
33
|
+
sendGlobalExitCode(codes) {
|
|
34
|
+
__classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.GlobalExitCode, codes);
|
|
35
|
+
}
|
|
36
|
+
sendGlobalError(error) {
|
|
37
|
+
__classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.GlobalError, error);
|
|
38
|
+
}
|
|
39
|
+
sendQualityGateResults(payload) {
|
|
40
|
+
__classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.QualityGateResults, payload ?? []);
|
|
41
|
+
}
|
|
42
|
+
sendTestResult(trId) {
|
|
43
|
+
__classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.TestResult, trId);
|
|
44
|
+
}
|
|
45
|
+
sendTestFixtureResult(tfrId) {
|
|
46
|
+
__classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.TestFixtureResult, tfrId);
|
|
47
|
+
}
|
|
48
|
+
sendAttachmentFile(afId) {
|
|
49
|
+
__classPrivateFieldGet(this, _RealtimeEventsDispatcher_emitter, "f").emit(RealtimeEvents.AttachmentFile, afId);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
_RealtimeEventsDispatcher_emitter = new WeakMap();
|
|
53
|
+
export class RealtimeSubscriber {
|
|
54
|
+
constructor(emitter) {
|
|
55
|
+
_RealtimeSubscriber_instances.add(this);
|
|
56
|
+
_RealtimeSubscriber_emitter.set(this, void 0);
|
|
57
|
+
_RealtimeSubscriber_handlers.set(this, []);
|
|
58
|
+
__classPrivateFieldSet(this, _RealtimeSubscriber_emitter, emitter, "f");
|
|
59
|
+
}
|
|
60
|
+
onGlobalAttachment(listener) {
|
|
61
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.GlobalAttachment, listener);
|
|
62
|
+
return () => {
|
|
63
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.GlobalAttachment, listener);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
onGlobalExitCode(listener) {
|
|
67
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.GlobalExitCode, listener);
|
|
68
|
+
return () => {
|
|
69
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.GlobalExitCode, listener);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
onGlobalError(listener) {
|
|
73
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.GlobalError, listener);
|
|
74
|
+
return () => {
|
|
75
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.GlobalError, listener);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
onQualityGateResults(listener) {
|
|
79
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.QualityGateResults, listener);
|
|
80
|
+
return () => {
|
|
81
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.QualityGateResults, listener);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
onTestResults(listener, options = {}) {
|
|
85
|
+
const { maxTimeout = 100 } = options;
|
|
86
|
+
const handler = __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_createBatchHandler).call(this, maxTimeout, listener);
|
|
87
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.TestResult, handler);
|
|
88
|
+
return () => {
|
|
89
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.TestResult, handler);
|
|
24
90
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
91
|
+
}
|
|
92
|
+
onTestFixtureResults(listener, options = {}) {
|
|
93
|
+
const { maxTimeout = 100 } = options;
|
|
94
|
+
const handler = __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_createBatchHandler).call(this, maxTimeout, listener);
|
|
95
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.TestFixtureResult, handler);
|
|
96
|
+
return () => {
|
|
97
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.TestFixtureResult, handler);
|
|
29
98
|
};
|
|
30
|
-
__classPrivateFieldSet(this, _Events_emitter, emitter, "f");
|
|
31
99
|
}
|
|
32
100
|
onAttachmentFiles(listener, options = {}) {
|
|
33
101
|
const { maxTimeout = 100 } = options;
|
|
34
|
-
const handler = __classPrivateFieldGet(this,
|
|
35
|
-
__classPrivateFieldGet(this,
|
|
102
|
+
const handler = __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_createBatchHandler).call(this, maxTimeout, listener);
|
|
103
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.AttachmentFile, handler);
|
|
104
|
+
return () => {
|
|
105
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.AttachmentFile, handler);
|
|
106
|
+
};
|
|
36
107
|
}
|
|
37
108
|
onAll(listener, options = {}) {
|
|
38
109
|
const { maxTimeout = 100 } = options;
|
|
39
|
-
const handler = __classPrivateFieldGet(this,
|
|
40
|
-
__classPrivateFieldGet(this,
|
|
41
|
-
__classPrivateFieldGet(this,
|
|
42
|
-
__classPrivateFieldGet(this,
|
|
110
|
+
const handler = __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_createBatchHandler).call(this, maxTimeout, listener);
|
|
111
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.TestResult, handler);
|
|
112
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.TestFixtureResult, handler);
|
|
113
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.AttachmentFile, handler);
|
|
114
|
+
return () => {
|
|
115
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.TestResult, handler);
|
|
116
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.TestFixtureResult, handler);
|
|
117
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.AttachmentFile, handler);
|
|
118
|
+
};
|
|
43
119
|
}
|
|
44
120
|
offAll() {
|
|
45
|
-
__classPrivateFieldGet(this,
|
|
46
|
-
for (const handler of __classPrivateFieldGet(this,
|
|
121
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").removeAllListeners();
|
|
122
|
+
for (const handler of __classPrivateFieldGet(this, _RealtimeSubscriber_handlers, "f")) {
|
|
47
123
|
handler.ac?.abort();
|
|
48
124
|
}
|
|
49
|
-
__classPrivateFieldSet(this,
|
|
125
|
+
__classPrivateFieldSet(this, _RealtimeSubscriber_handlers, [], "f");
|
|
50
126
|
}
|
|
51
127
|
}
|
|
52
|
-
|
|
128
|
+
_RealtimeSubscriber_emitter = new WeakMap(), _RealtimeSubscriber_handlers = new WeakMap(), _RealtimeSubscriber_instances = new WeakSet(), _RealtimeSubscriber_createBatchHandler = function _RealtimeSubscriber_createBatchHandler(maxTimeout, listener) {
|
|
53
129
|
const handler = {
|
|
54
130
|
buffer: [],
|
|
55
131
|
};
|
|
56
|
-
__classPrivateFieldGet(this,
|
|
132
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_handlers, "f").push(handler);
|
|
57
133
|
return (trId) => {
|
|
58
134
|
handler.buffer.push(trId);
|
|
59
135
|
if (handler.timeout) {
|