slnodejs 6.1.1142 → 6.1.1147

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 (46) hide show
  1. package/package.json +1 -1
  2. package/tsOutputs/cli-parse/executors/nyc-report-executor.js +1 -2
  3. package/tsOutputs/cli-parse/executors/nyc-report-executor.js.map +1 -1
  4. package/tsOutputs/common/contracts.d.ts +1 -1
  5. package/tsOutputs/common/coverage-elements/original-module-loader.d.ts +1 -1
  6. package/tsOutputs/common/footprints-process-v6/collection-interval.js.map +1 -0
  7. package/tsOutputs/common/footprints-process-v6/index.js +1 -1
  8. package/tsOutputs/common/footprints-process-v6/index.js.map +1 -1
  9. package/tsOutputs/common/{footprints-process → footprints-process-v6}/istanbul-to-footprints-contract.d.ts +0 -7
  10. package/tsOutputs/common/footprints-process-v6/istanbul-to-footprints-contract.js +3 -0
  11. package/tsOutputs/common/footprints-process-v6/istanbul-to-footprints-contract.js.map +1 -0
  12. package/tsOutputs/common/sl-mapper-tokenizer.d.ts +21 -0
  13. package/tsOutputs/common/sl-mapper-tokenizer.js +12 -10
  14. package/tsOutputs/common/sl-mapper-tokenizer.js.map +1 -1
  15. package/tsOutputs/test-listener/agent.d.ts +1 -2
  16. package/tsOutputs/test-listener/agent.js.map +1 -1
  17. package/tsOutputs/test-listener/api.js +3 -7
  18. package/tsOutputs/test-listener/api.js.map +1 -1
  19. package/tsOutputs/test-listener/factory.d.ts +1 -6
  20. package/tsOutputs/test-listener/factory.js +1 -30
  21. package/tsOutputs/test-listener/factory.js.map +1 -1
  22. package/tsOutputs/test-listener/nyc-report-executor-fpv6.js +1 -1
  23. package/tsOutputs/test-listener/nyc-report-executor-fpv6.js.map +1 -1
  24. package/tsOutputs/test-listener/remote-agent.d.ts +1 -0
  25. package/tsOutputs/test-listener/remote-agent.js +7 -1
  26. package/tsOutputs/test-listener/remote-agent.js.map +1 -1
  27. package/tsOutputs/common/footprints-process/collection-interval.js.map +0 -1
  28. package/tsOutputs/common/footprints-process/footprints-service-proxy.d.ts +0 -13
  29. package/tsOutputs/common/footprints-process/footprints-service-proxy.js +0 -63
  30. package/tsOutputs/common/footprints-process/footprints-service-proxy.js.map +0 -1
  31. package/tsOutputs/common/footprints-process/index.d.ts +0 -72
  32. package/tsOutputs/common/footprints-process/index.js +0 -287
  33. package/tsOutputs/common/footprints-process/index.js.map +0 -1
  34. package/tsOutputs/common/footprints-process/istanbul-to-footprints-contract.js +0 -7
  35. package/tsOutputs/common/footprints-process/istanbul-to-footprints-contract.js.map +0 -1
  36. package/tsOutputs/common/footprints-process/istanbul-to-footprints.d.ts +0 -47
  37. package/tsOutputs/common/footprints-process/istanbul-to-footprints.js +0 -426
  38. package/tsOutputs/common/footprints-process/istanbul-to-footprints.js.map +0 -1
  39. package/tsOutputs/common/footprints-process/production-footprints-handler.d.ts +0 -55
  40. package/tsOutputs/common/footprints-process/production-footprints-handler.js +0 -278
  41. package/tsOutputs/common/footprints-process/production-footprints-handler.js.map +0 -1
  42. package/tsOutputs/common/messages-formatter.d.ts +0 -6
  43. package/tsOutputs/test-listener/nyc-report-executor.js +0 -108
  44. package/tsOutputs/test-listener/nyc-report-executor.js.map +0 -1
  45. /package/tsOutputs/common/{footprints-process → footprints-process-v6}/collection-interval.d.ts +0 -0
  46. /package/tsOutputs/common/{footprints-process → footprints-process-v6}/collection-interval.js +0 -0
@@ -1,278 +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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ProductionFootprintsHandler = void 0;
13
- const fs = require("fs");
14
- const os = require("os");
15
- const sl_env_vars_1 = require("../constants/sl-env-vars");
16
- const path = require("path");
17
- const http_client_1 = require("../http/http-client");
18
- const messages_formatter_1 = require("../messages-formatter");
19
- const sl_routes_1 = require("../http/sl-routes");
20
- const validation_utils_1 = require("../utils/validation-utils");
21
- const system_date_1 = require("../system-date");
22
- const metrics_store_factory_1 = require("../metrics-process/metrics-store-factory");
23
- const FILE_NOT_FOUND_CODE = 'ENOENT';
24
- class ProductionFootprintsHandler {
25
- constructor(cfg, agentInstanceData, logger) {
26
- this.validateConfig(cfg);
27
- this.agentConfig = cfg;
28
- validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(logger, 'logger');
29
- this.logger = logger;
30
- this.metaData = new MetaData(cfg.buildSessionId.value, cfg.labId.value);
31
- this.filename = this.createFilePath(cfg); //Todo: remove or make saving to file configurable
32
- this.collectionStartDate = (0, system_date_1.getSystemDateValueOf)();
33
- this.methodIdToHits = {};
34
- this.initHttpConfig(cfg);
35
- const httpClientMetadata = {
36
- agentId: agentInstanceData.agentId,
37
- buildSessionId: cfg.buildSessionId.value,
38
- agentType: agentInstanceData.agentType,
39
- agentTechnology: agentInstanceData.technology,
40
- agentVersion: agentInstanceData.agentVersion,
41
- };
42
- this.httpClient = new http_client_1.HttpClient(this.httpConfig, httpClientMetadata, logger, metrics_store_factory_1.HttpMetricsStoreFactory.create(logger));
43
- this.setupProdListenerModes();
44
- }
45
- setupProdListenerModes() {
46
- const prodListenerModes = sl_env_vars_1.SlEnvVars.getProductionListenerModes();
47
- if (prodListenerModes.length == 0 ||
48
- (prodListenerModes.length == 1 && prodListenerModes[0] == 'true')) {
49
- //Defaults in case the production listener env var is not present or is set to 'true'
50
- this.sendToServer = true;
51
- this.saveToFile = false;
52
- }
53
- else {
54
- this.sendToServer = prodListenerModes.indexOf('server') > -1;
55
- this.saveToFile = prodListenerModes.indexOf('file') > -1;
56
- }
57
- this.logger.info('Production listener send to server: ' +
58
- this.sendToServer +
59
- ', save to file: ' +
60
- this.saveToFile);
61
- }
62
- initHttpConfig(cfg) {
63
- const config = {
64
- token: cfg.token.value,
65
- server: cfg.server.value,
66
- proxy: cfg.proxy.value,
67
- compressRequests: cfg.gzip.hasValue ? cfg.gzip.value : true,
68
- buildSessionId: cfg.buildSessionId.value,
69
- };
70
- this.httpConfig = config;
71
- }
72
- handleFootprints(footprintsPacket, callback) {
73
- if (!footprintsPacket) {
74
- this.logger.info('Handle footprints - got null or empty packet. Skip saving.');
75
- callback(null);
76
- return;
77
- }
78
- if (!footprintsPacket ||
79
- !footprintsPacket.apps ||
80
- !footprintsPacket.apps[0] ||
81
- !footprintsPacket.apps[0].files) {
82
- this.logger.info('Handle footprints - no footprints data. Skip saving.');
83
- callback(null);
84
- return;
85
- }
86
- this.saveAndSendMethodsHits(footprintsPacket)
87
- .then(() => callback(null))
88
- .catch((err) => callback(err));
89
- }
90
- saveAndSendMethodsHits(packetToSend) {
91
- return __awaiter(this, void 0, void 0, function* () {
92
- const hitFiles = this.getHitFiles(packetToSend);
93
- this.logger.debug(`Submitting production data, files: ${hitFiles}, toServer: ${this.sendToServer}, toFile: ${this.saveToFile} (${this.filename})`);
94
- if (this.sendToServer) {
95
- yield this.convertAndSubmitToServer(packetToSend);
96
- }
97
- if (this.saveToFile) {
98
- this.methodIdToHits = {};
99
- this.addHitsFromFootprints(packetToSend.apps[0].files);
100
- yield this.addHitsFromFile();
101
- yield this.writeDataToFile();
102
- }
103
- });
104
- }
105
- getHitFiles(packetToSend) {
106
- if (!this.logger.isDebugEnabled()) {
107
- return;
108
- }
109
- const formatter = new messages_formatter_1.MessagesFormatter();
110
- if (packetToSend &&
111
- packetToSend.apps &&
112
- packetToSend.apps[0] &&
113
- packetToSend.apps[0].files) {
114
- packetToSend.apps[0].files.forEach((file) => {
115
- formatter.addContent(file.path);
116
- });
117
- }
118
- return formatter.content;
119
- }
120
- convertFootprintsToProductionData(footprintsPacket) {
121
- const now = (0, system_date_1.getSystemDateValueOf)();
122
- const productionDataPacket = {
123
- meta: {
124
- appName: this.agentConfig.appName.value,
125
- branchName: this.agentConfig.branch.value,
126
- buildName: this.agentConfig.build.value,
127
- bsid: this.agentConfig.buildSessionId.value,
128
- createdAt: this.collectionStartDate,
129
- lastModified: now,
130
- customerId: this.agentConfig.customerId.value,
131
- hostName: os.hostname(),
132
- pid: process.pid,
133
- labId: this.agentConfig.labId.value || 'production',
134
- },
135
- methodsHits: {},
136
- };
137
- if (footprintsPacket &&
138
- footprintsPacket.apps &&
139
- footprintsPacket.apps[0] &&
140
- footprintsPacket.apps[0].files) {
141
- footprintsPacket.apps[0].files.forEach((file) => {
142
- if (!file.methods)
143
- return;
144
- file.methods.forEach((method) => {
145
- let totalHits = 0;
146
- if (!method.hits)
147
- return;
148
- method.hits.forEach((testIdxAndHits) => {
149
- totalHits += testIdxAndHits[1];
150
- });
151
- productionDataPacket.methodsHits[method.uniqueId] = totalHits;
152
- });
153
- });
154
- }
155
- this.collectionStartDate = now;
156
- return productionDataPacket;
157
- }
158
- convertAndSubmitToServer(footprintsPacket) {
159
- const productionDataPacket = this.convertFootprintsToProductionData(footprintsPacket);
160
- return new Promise((resolve, reject) => {
161
- const url = sl_routes_1.SLRoutes.productionV1(this.agentConfig.buildSessionId.value);
162
- this.httpClient.post(productionDataPacket, url, (err) => {
163
- err ? reject(err) : resolve();
164
- });
165
- });
166
- }
167
- /*
168
- In production listener we are in anonymous mode, and all hits will refer to single anonymous test.
169
- So we can there will be single array in "hits" array.
170
- In this inner array firs element will be always '0'(the index of test in array which contains only one - the anonymous),
171
- and the second element is the hits number.
172
- */
173
- addHitsFromFootprints(files) {
174
- files.forEach((file) => {
175
- file.methods.forEach((method) => {
176
- this.methodIdToHits[method.uniqueId] = method.hits[0][1];
177
- });
178
- });
179
- }
180
- tryParseFileContent(fileContent) {
181
- try {
182
- const hitsData = JSON.parse(fileContent).methodsHits;
183
- this.logger.debug(`Previous hit data parsed successfully, '${Object.keys(hitsData).length} items loaded`);
184
- return hitsData;
185
- }
186
- catch (err) {
187
- this.logger.error(`Error while parsing hits file content. ${err}`);
188
- return null;
189
- }
190
- }
191
- validateConfig(config) {
192
- if (!config) {
193
- throw new Error('cfg cannot be null or undefined');
194
- }
195
- if (!config.labId.hasValue) {
196
- throw new Error('Configuration must contains labId');
197
- }
198
- if (!config.buildSessionId.hasValue) {
199
- throw new Error('Configuration must contains buildSessionId');
200
- }
201
- }
202
- addHitsFromFile() {
203
- return new Promise((resolve, reject) => {
204
- fs.readFile(this.filename, (err, data) => {
205
- if (err && err.code != FILE_NOT_FOUND_CODE) {
206
- this.logger.error(`Error while trying to read previous hits data. ${err}`);
207
- }
208
- if (data != null) {
209
- const hits = this.tryParseFileContent(data.toString());
210
- if (hits != null) {
211
- this.updateHits(hits);
212
- }
213
- else {
214
- this.logger.error('Could not load previous hits from file');
215
- }
216
- }
217
- resolve();
218
- });
219
- });
220
- }
221
- writeDataToFile() {
222
- return new Promise((resolve, reject) => {
223
- const data = JSON.stringify(this.toJSonObject());
224
- fs.writeFile(this.filename, data, (err) => {
225
- if (err) {
226
- this.logger.error(`Error while trying to write methods hits into file. ${err}`);
227
- reject(err);
228
- }
229
- resolve();
230
- });
231
- });
232
- }
233
- createFilePath(config) {
234
- const filename = this.combineArgsWithDash(config.buildSessionId.value, config.labId.value, process.pid) + '.json';
235
- const fileStorage = sl_env_vars_1.SlEnvVars.getFileStorage();
236
- if (fileStorage) {
237
- return path.join(fileStorage, filename);
238
- }
239
- return filename;
240
- }
241
- combineArgsWithDash(...args) {
242
- return args.join('-');
243
- }
244
- updateHits(methodsHitFromFile) {
245
- Object.keys(methodsHitFromFile).forEach((methodId) => {
246
- if (this.methodIdToHits[methodId]) {
247
- this.methodIdToHits[methodId] += parseInt(methodsHitFromFile[methodId]);
248
- }
249
- else {
250
- this.methodIdToHits[methodId] = parseInt(methodsHitFromFile[methodId]);
251
- }
252
- });
253
- }
254
- toJSonObject() {
255
- return {
256
- meta: this.metaData.toJsonObject(),
257
- methodsHits: this.methodIdToHits,
258
- };
259
- }
260
- }
261
- exports.ProductionFootprintsHandler = ProductionFootprintsHandler;
262
- class MetaData {
263
- constructor(buildSessionId, labId) {
264
- this.buildSessionId = buildSessionId;
265
- this.labId = labId;
266
- this.createdAt = (0, system_date_1.getSystemDate)().toLocaleString();
267
- this.pid = process.pid;
268
- }
269
- toJsonObject() {
270
- this.lastModifiedAt = (0, system_date_1.getSystemDate)().toLocaleString();
271
- const json = {};
272
- Object.keys(this).forEach((key) => {
273
- json[key] = this[key];
274
- });
275
- return json;
276
- }
277
- }
278
- //# sourceMappingURL=production-footprints-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"production-footprints-handler.js","sourceRoot":"","sources":["../../../common/footprints-process/production-footprints-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQA,yBAAyB;AACzB,yBAAyB;AACzB,0DAAqD;AACrD,6BAA6B;AAE7B,qDAAiD;AACjD,8DAA0D;AAC1D,iDAA6C;AAC7C,gEAA4D;AAC5D,gDAAqE;AAErE,oFAAmF;AACnF,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAqBrC,MAAa,2BAA2B;IAatC,YACE,GAAgB,EAChB,iBAAoC,EACpC,MAAc;QAEd,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;QACvB,kCAAe,CAAC,oBAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,kDAAkD;QAC5F,IA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AAC,cAAc,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;aACxE;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,YAAY;QACjB,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE;YAClC,WAAW,EAAE,IAAI,CAAC,cAAc;SACjC,CAAC;IACJ,CAAC;CACF;AApTD,kEAoTC;AAED,MAAM,QAAQ;IAOZ,YAAY,cAAsB,EAAE,KAAa;QAC/C,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,IAAA,2BAAa,GAAE,CAAC,cAAc,EAAE,CAAC;QAClD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IACzB,CAAC;IAEM,YAAY;QACjB,IAAI,CAAC,cAAc,GAAG,IAAA,2BAAa,GAAE,CAAC,cAAc,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAChC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -1,6 +0,0 @@
1
- export declare class MessagesFormatter {
2
- private _content;
3
- constructor();
4
- addContent(str: string): void;
5
- get content(): string;
6
- }
@@ -1,108 +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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.NycReportExecutor = void 0;
13
- const logger_1 = require("../common/logger");
14
- const environment_data_service_1 = require("../common/environment-data-service");
15
- const istanbul_to_footprints_1 = require("../common/footprints-process/istanbul-to-footprints");
16
- const footprints_service_proxy_1 = require("../common/footprints-process/footprints-service-proxy");
17
- const system_date_1 = require("../common/system-date");
18
- const fs = require("fs");
19
- //TODO: use all constants and interfaces from infra
20
- const DEFAULT_TEST_NAME = '__init';
21
- const DEFAULT_EXECUTION_ID = '00000000-0000-0000-0000-000000000000';
22
- class NycReportExecutor {
23
- constructor(reportFile, agentConfig, agentInstanceData) {
24
- if (!reportFile) {
25
- throw new Error('reportFile must be given');
26
- }
27
- if (!agentConfig) {
28
- throw new Error('agentConfig must be given');
29
- }
30
- if (!agentInstanceData) {
31
- throw new Error('agentInstanceData must be given');
32
- }
33
- this.reportFile = reportFile;
34
- this.agentConfig = agentConfig;
35
- this.environmentDataService = new environment_data_service_1.EnvironmentDataService(agentConfig);
36
- this.agentInstanceData = agentInstanceData;
37
- this.createLogger();
38
- }
39
- execute() {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- try {
42
- const reportData = this.readReportFile();
43
- const extendedIstanbulData = this.createExtendedIstanbulData(reportData);
44
- const footprintsFile = this.convertToFootprints(extendedIstanbulData);
45
- yield this.submitFootprints(footprintsFile);
46
- this.logger.lifecycle("Command 'uploadNycReport' finished successfully");
47
- return true;
48
- }
49
- catch (err) {
50
- this.logger.error(`Failed to upload nyc report. error: ${err}`);
51
- return false;
52
- }
53
- });
54
- }
55
- dryRun(logger) {
56
- this.logger = logger;
57
- const reportData = this.readReportFile();
58
- const extendedIstanbulData = this.createExtendedIstanbulData(reportData);
59
- return this.convertToFootprints(extendedIstanbulData);
60
- }
61
- readReportFile() {
62
- const content = fs.readFileSync(this.reportFile, { encoding: 'utf8' });
63
- if (!content) {
64
- throw new Error('Cannot read report data from: ' + this.reportFile);
65
- }
66
- return JSON.parse(content);
67
- }
68
- convertToFootprints(extendedIstanbulData) {
69
- const istanbulToFP = new istanbul_to_footprints_1.IstanbulToFootprints(this.agentConfig, this.logger);
70
- const footprintsFile = this.createFootprintsFile();
71
- return istanbulToFP.createFootprintsPackageFromRawData(extendedIstanbulData, footprintsFile);
72
- }
73
- submitFootprints(footprintsFile) {
74
- return new Promise((resolve, reject) => {
75
- const footprintsProxy = new footprints_service_proxy_1.FootprintsServiceProxy(this.agentConfig, this.agentInstanceData, this.logger);
76
- footprintsProxy.handleFootprints(footprintsFile, (err) => {
77
- return err ? reject(err) : resolve();
78
- });
79
- });
80
- }
81
- createExtendedIstanbulData(rawIstanbulData) {
82
- return {
83
- footprints: rawIstanbulData,
84
- testName: DEFAULT_TEST_NAME,
85
- executionId: DEFAULT_EXECUTION_ID,
86
- localTime: (0, system_date_1.getSystemDateValueOf)(),
87
- };
88
- }
89
- createFootprintsFile() {
90
- return {
91
- customerId: this.agentConfig.customerId.value,
92
- environment: this.environmentDataService.getEnvDataForSubmission(),
93
- configurationData: this.agentConfig.toJsonObject(),
94
- meta: {
95
- sequence: 0,
96
- generated: (0, system_date_1.getSystemDateValueOf)(),
97
- agentId: this.agentInstanceData.agentId,
98
- },
99
- tests: [],
100
- apps: [],
101
- };
102
- }
103
- createLogger() {
104
- this.logger = logger_1.LoggerFactory.getCreateApplicationLogger(this.agentConfig);
105
- }
106
- }
107
- exports.NycReportExecutor = NycReportExecutor;
108
- //# sourceMappingURL=nyc-report-executor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nyc-report-executor.js","sourceRoot":"","sources":["../../test-listener/nyc-report-executor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAiD;AAEjD,iFAA4E;AAG5E,gGAA2F;AAE3F,oGAA+F;AAC/F,uDAA6D;AAE7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