@nrwl/nx-cloud 15.3.3-beta.1 → 15.3.3

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.
@@ -1,36 +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
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ErrorReporterApi = void 0;
13
- const axios_1 = require("../../utilities/axios");
14
- const { output } = require('../../utilities/nx-imports');
15
- class ErrorReporterApi {
16
- constructor(options) {
17
- this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
18
- }
19
- reportError(message) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- try {
22
- yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/report-client-error', {
23
- message,
24
- }));
25
- }
26
- catch (e) {
27
- output.warn({
28
- title: `Unable to record the following error: '${message}'`,
29
- bodyLines: [e.message],
30
- });
31
- }
32
- });
33
- }
34
- }
35
- exports.ErrorReporterApi = ErrorReporterApi;
36
- //# sourceMappingURL=error-reporter.api.js.map
1
+ const a0_0x50c9=['../../utilities/axios','post','__esModule','__awaiter','value','/nx-cloud/report-client-error','next','ErrorReporterApi','done','then','warn','apply','apiAxiosInstance','axiosMultipleTries','createApiAxiosInstance','Unable\x20to\x20record\x20the\x20following\x20error:\x20\x27','throw','../../utilities/nx-imports','defineProperty'];(function(_0x27ddf6,_0x50c966){const _0x1d8cc4=function(_0x3f41c0){while(--_0x3f41c0){_0x27ddf6['push'](_0x27ddf6['shift']());}};_0x1d8cc4(++_0x50c966);}(a0_0x50c9,0x10b));const a0_0x1d8c=function(_0x27ddf6,_0x50c966){_0x27ddf6=_0x27ddf6-0x0;let _0x1d8cc4=a0_0x50c9[_0x27ddf6];return _0x1d8cc4;};'use strict';var __awaiter=this&&this[a0_0x1d8c('0x2')]||function(_0x35a744,_0x475576,_0x33cc99,_0x3b4ece){function _0x18affc(_0x3f04d3){return _0x3f04d3 instanceof _0x33cc99?_0x3f04d3:new _0x33cc99(function(_0x5874a2){_0x5874a2(_0x3f04d3);});}return new(_0x33cc99||(_0x33cc99=Promise))(function(_0x2fefa0,_0x391e0b){function _0x2e8627(_0x41ef17){try{_0x44154d(_0x3b4ece[a0_0x1d8c('0x5')](_0x41ef17));}catch(_0x2a31ac){_0x391e0b(_0x2a31ac);}}function _0x54c8ba(_0x2e6500){try{_0x44154d(_0x3b4ece[a0_0x1d8c('0xf')](_0x2e6500));}catch(_0x4f585a){_0x391e0b(_0x4f585a);}}function _0x44154d(_0x40c2a2){_0x40c2a2[a0_0x1d8c('0x7')]?_0x2fefa0(_0x40c2a2['value']):_0x18affc(_0x40c2a2[a0_0x1d8c('0x3')])[a0_0x1d8c('0x8')](_0x2e8627,_0x54c8ba);}_0x44154d((_0x3b4ece=_0x3b4ece[a0_0x1d8c('0xa')](_0x35a744,_0x475576||[]))[a0_0x1d8c('0x5')]());});};Object[a0_0x1d8c('0x11')](exports,a0_0x1d8c('0x1'),{'value':!![]});exports[a0_0x1d8c('0x6')]=void 0x0;const axios_1=require(a0_0x1d8c('0x12'));const {output}=require(a0_0x1d8c('0x10'));class ErrorReporterApi{constructor(_0x196c37){this['apiAxiosInstance']=(0x0,axios_1[a0_0x1d8c('0xd')])(_0x196c37);}['reportError'](_0x50b231){return __awaiter(this,void 0x0,void 0x0,function*(){try{yield(0x0,axios_1[a0_0x1d8c('0xc')])(()=>this[a0_0x1d8c('0xb')][a0_0x1d8c('0x0')](a0_0x1d8c('0x4'),{'message':_0x50b231}));}catch(_0x5bd0f0){output[a0_0x1d8c('0x9')]({'title':a0_0x1d8c('0xe')+_0x50b231+'\x27','bodyLines':[_0x5bd0f0['message']]});}});}}exports[a0_0x1d8c('0x6')]=ErrorReporterApi;
@@ -1,73 +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
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RunGroupApi = void 0;
13
- const axios_1 = require("../../utilities/axios");
14
- const metric_logger_1 = require("../../utilities/metric-logger");
15
- const { output } = require('../../utilities/nx-imports');
16
- class RunGroupApi {
17
- constructor(options) {
18
- this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
19
- }
20
- createRunGroup(branch, runGroup, ciExecutionId, ciExecutionEnv, stopAgentsOnFailure, agentCount, stopAgentsAfter) {
21
- var _a;
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const recorder = (0, metric_logger_1.createMetricRecorder)('createRunGroup');
24
- try {
25
- const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/create-run-group', {
26
- branch,
27
- runGroup,
28
- ciExecutionId,
29
- ciExecutionEnv,
30
- stopAgentsOnFailure,
31
- agentCount,
32
- stopAgentsAfter,
33
- }));
34
- recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
35
- }
36
- catch (e) {
37
- recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
38
- ? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
39
- : metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
40
- output.error({
41
- title: e.message,
42
- });
43
- process.exit(1);
44
- }
45
- });
46
- }
47
- completeRunGroup(branch, runGroup, ciExecutionId, ciExecutionEnv) {
48
- var _a;
49
- return __awaiter(this, void 0, void 0, function* () {
50
- const recorder = (0, metric_logger_1.createMetricRecorder)('completeRunGroup');
51
- try {
52
- const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
53
- branch,
54
- runGroup,
55
- ciExecutionId,
56
- ciExecutionEnv,
57
- }));
58
- recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
59
- }
60
- catch (e) {
61
- recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
62
- ? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
63
- : metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
64
- output.error({
65
- title: e.message,
66
- });
67
- process.exit(1);
68
- }
69
- });
70
- }
71
- }
72
- exports.RunGroupApi = RunGroupApi;
73
- //# sourceMappingURL=run-group.api.js.map
1
+ const a1_0x8f31=['RunGroupApi','done','apply','axiosException','recordMetric','mapRespToPerfEntry','exit','/nx-cloud/executions/create-run-group','axiosMultipleTries','apiAxiosInstance','../../utilities/axios','__esModule','completeRunGroup','response','RUNNER_FAILURE_PERF_ENTRY','../../utilities/nx-imports','__awaiter','next','post','error','createRunGroup','value'];(function(_0x290df0,_0x8f31ef){const _0x524446=function(_0x38cdb7){while(--_0x38cdb7){_0x290df0['push'](_0x290df0['shift']());}};_0x524446(++_0x8f31ef);}(a1_0x8f31,0x110));const a1_0x5244=function(_0x290df0,_0x8f31ef){_0x290df0=_0x290df0-0x0;let _0x524446=a1_0x8f31[_0x290df0];return _0x524446;};'use strict';var __awaiter=this&&this[a1_0x5244('0x8')]||function(_0x28e3bd,_0x5d37d0,_0x4b1c41,_0x2a7254){function _0x47c986(_0x262f5b){return _0x262f5b instanceof _0x4b1c41?_0x262f5b:new _0x4b1c41(function(_0xc3229b){_0xc3229b(_0x262f5b);});}return new(_0x4b1c41||(_0x4b1c41=Promise))(function(_0x266a10,_0xe5a85a){function _0x24aaca(_0x2a9045){try{_0xbe4a42(_0x2a7254[a1_0x5244('0x9')](_0x2a9045));}catch(_0xfc5240){_0xe5a85a(_0xfc5240);}}function _0x961fcb(_0x443e43){try{_0xbe4a42(_0x2a7254['throw'](_0x443e43));}catch(_0x3bda89){_0xe5a85a(_0x3bda89);}}function _0xbe4a42(_0x1b244d){_0x1b244d[a1_0x5244('0xf')]?_0x266a10(_0x1b244d[a1_0x5244('0xd')]):_0x47c986(_0x1b244d[a1_0x5244('0xd')])['then'](_0x24aaca,_0x961fcb);}_0xbe4a42((_0x2a7254=_0x2a7254[a1_0x5244('0x10')](_0x28e3bd,_0x5d37d0||[]))['next']());});};Object['defineProperty'](exports,a1_0x5244('0x3'),{'value':!![]});exports[a1_0x5244('0xe')]=void 0x0;const axios_1=require(a1_0x5244('0x2'));const metric_logger_1=require('../../utilities/metric-logger');const {output}=require(a1_0x5244('0x7'));class RunGroupApi{constructor(_0x17a5ee){this['apiAxiosInstance']=(0x0,axios_1['createApiAxiosInstance'])(_0x17a5ee);}[a1_0x5244('0xc')](_0x1db503,_0x294bbe,_0x11eb86,_0x46f2da,_0x55d30c,_0x4f531f,_0x1ffa85){var _0x45a421;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x19121c=(0x0,metric_logger_1['createMetricRecorder'])(a1_0x5244('0xc'));try{const _0x505af2=yield(0x0,axios_1[a1_0x5244('0x0')])(()=>this[a1_0x5244('0x1')][a1_0x5244('0xa')](a1_0x5244('0x15'),{'branch':_0x1db503,'runGroup':_0x294bbe,'ciExecutionId':_0x11eb86,'ciExecutionEnv':_0x46f2da,'stopAgentsOnFailure':_0x55d30c,'agentCount':_0x4f531f,'stopAgentsAfter':_0x1ffa85}));_0x19121c[a1_0x5244('0x12')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x505af2));}catch(_0x434d13){_0x19121c[a1_0x5244('0x12')](((_0x45a421=_0x434d13===null||_0x434d13===void 0x0?void 0x0:_0x434d13[a1_0x5244('0x11')])===null||_0x45a421===void 0x0?void 0x0:_0x45a421[a1_0x5244('0x5')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x434d13[a1_0x5244('0x11')]['response']):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);output[a1_0x5244('0xb')]({'title':_0x434d13['message']});process[a1_0x5244('0x14')](0x1);}});}[a1_0x5244('0x4')](_0x883e3d,_0x2675e1,_0x578b79,_0x27e4d3){var _0x11d791;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x4fba9e=(0x0,metric_logger_1['createMetricRecorder'])(a1_0x5244('0x4'));try{const _0x1377fa=yield(0x0,axios_1['axiosMultipleTries'])(()=>this['apiAxiosInstance'][a1_0x5244('0xa')]('/nx-cloud/executions/complete-run-group',{'branch':_0x883e3d,'runGroup':_0x2675e1,'ciExecutionId':_0x578b79,'ciExecutionEnv':_0x27e4d3}));_0x4fba9e[a1_0x5244('0x12')]((0x0,metric_logger_1[a1_0x5244('0x13')])(_0x1377fa));}catch(_0x548453){_0x4fba9e['recordMetric'](((_0x11d791=_0x548453===null||_0x548453===void 0x0?void 0x0:_0x548453['axiosException'])===null||_0x11d791===void 0x0?void 0x0:_0x11d791[a1_0x5244('0x5')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x548453[a1_0x5244('0x11')][a1_0x5244('0x5')]):metric_logger_1[a1_0x5244('0x6')]);output[a1_0x5244('0xb')]({'title':_0x548453['message']});process[a1_0x5244('0x14')](0x1);}});}}exports[a1_0x5244('0xe')]=RunGroupApi;
@@ -1,5 +1,5 @@
1
1
  import { CacheUrls } from './cache-urls.model';
2
- export declare type TaskStatus = 'success' | 'failure' | 'skipped' | 'local-cache-kept-existing' | 'local-cache' | 'cache' | 'remote-cache';
2
+ export type TaskStatus = 'success' | 'failure' | 'skipped' | 'local-cache-kept-existing' | 'local-cache' | 'cache' | 'remote-cache';
3
3
  export interface TaskResult {
4
4
  task: Task;
5
5
  status: TaskStatus;
@@ -117,7 +117,7 @@ export interface Task {
117
117
  };
118
118
  };
119
119
  }
120
- export declare type RunContext = {
120
+ export type RunContext = {
121
121
  statuses: {
122
122
  [hash: string]: 'remote-cache-hit' | 'cache-miss';
123
123
  };
@@ -1,93 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CloudEnabledLifeCycle = void 0;
4
- const serializer_overrides_1 = require("../../../utilities/serializer-overrides");
5
- const read_task_terminal_output_1 = require("../../terminal-output/read-task-terminal-output");
6
- class CloudEnabledLifeCycle {
7
- constructor(runContext, cacheDirectory, collectTerminalOutput, cacheableOperations, outputObfuscator, tasks) {
8
- this.runContext = runContext;
9
- this.cacheDirectory = cacheDirectory;
10
- this.collectTerminalOutput = collectTerminalOutput;
11
- this.cacheableOperations = cacheableOperations;
12
- this.outputObfuscator = outputObfuscator;
13
- this.tasks = tasks;
14
- }
15
- scheduleTask(task) {
16
- this.runContext.scheduledTasks.push(task);
17
- }
18
- // this gets called for every tasks that starts.
19
- startTask(task) {
20
- this.tasks.push({
21
- taskId: task.id,
22
- startTime: new Date().toISOString(),
23
- target: task.target.target,
24
- projectName: task.target.project,
25
- hash: task.hash,
26
- hashDetails: this.cleanUpHashDetails(task.hashDetails),
27
- params: (0, serializer_overrides_1.serializeOverrides)(task),
28
- uploadedToStorage: false,
29
- });
30
- }
31
- endTasks(tasks) {
32
- // this can be called multiple times changing this time.
33
- for (let t of tasks) {
34
- let cacheStatus;
35
- const taskIsRemoteCacheHit = t.status === 'remote-cache';
36
- const taskIsLocalCacheHitPreNx135 = t.status === 'cache';
37
- const taskIsLocalCacheHit = t.status === 'local-cache' ||
38
- t.status === 'local-cache-kept-existing' ||
39
- taskIsLocalCacheHitPreNx135;
40
- if (this.runContext.statuses[t.task.hash]) {
41
- cacheStatus = this.runContext.statuses[t.task.hash];
42
- }
43
- else if (taskIsRemoteCacheHit) {
44
- cacheStatus = 'remote-cache-hit';
45
- }
46
- else if (taskIsLocalCacheHit) {
47
- cacheStatus = 'local-cache-hit';
48
- }
49
- else {
50
- cacheStatus = 'cache-miss';
51
- }
52
- this.updateStartedTask(t, cacheStatus);
53
- }
54
- }
55
- endCommand() { }
56
- updateStartedTask(result, cacheStatus) {
57
- const startedTask = this.tasks.find((t) => t.taskId === result.task.id);
58
- if (!startedTask) {
59
- throw new Error(`Cannot find task ${result.task.id}`);
60
- }
61
- if ((result === null || result === void 0 ? void 0 : result.startTime) && (result === null || result === void 0 ? void 0 : result.endTime)) {
62
- startedTask.startTime = new Date(result.startTime).toISOString();
63
- startedTask.endTime = new Date(result.endTime).toISOString();
64
- }
65
- else {
66
- startedTask.endTime = new Date().toISOString();
67
- }
68
- startedTask.status = result.code;
69
- startedTask.params = this.outputObfuscator.obfuscate(startedTask.params);
70
- startedTask.cacheStatus = cacheStatus;
71
- if (this.collectTerminalOutput) {
72
- startedTask.terminalOutput = this.getTerminalOutput(result.task.hash, startedTask.cacheStatus, result.code);
73
- }
74
- }
75
- getTerminalOutput(hash, cacheStatus, code) {
76
- return (0, read_task_terminal_output_1.readTaskTerminalOutput)(this.cacheDirectory, this.outputObfuscator, hash, cacheStatus, code);
77
- }
78
- cleanUpHashDetails(hashDetails) {
79
- const nodes = {};
80
- Object.keys(hashDetails.nodes)
81
- .filter((k) => !k.startsWith('npm:'))
82
- .forEach((k) => {
83
- nodes[k] = hashDetails.nodes[k];
84
- });
85
- return {
86
- nodes,
87
- runtime: hashDetails.runtime,
88
- implicitDeps: hashDetails.implicitDeps,
89
- };
90
- }
91
- }
92
- exports.CloudEnabledLifeCycle = CloudEnabledLifeCycle;
93
- //# sourceMappingURL=cloud-enabled-life-cycle.js.map
1
+ const a0_0xf2e5=['find','endTime','toISOString','target','collectTerminalOutput','cache-miss','local-cache-kept-existing','scheduledTasks','__esModule','obfuscate','hash','nodes','project','cache','task','statuses','getTerminalOutput','endCommand','implicitDeps','cacheDirectory','updateStartedTask','code','status','../../../utilities/serializer-overrides','startTime','CloudEnabledLifeCycle','cacheStatus','tasks','Cannot\x20find\x20task\x20','outputObfuscator','terminalOutput','runContext','../../terminal-output/read-task-terminal-output','startTask','endTasks','push','cleanUpHashDetails','scheduleTask','startsWith','local-cache-hit','params'];(function(_0x10a34f,_0xf2e5f){const _0x4a0861=function(_0x5a31ec){while(--_0x5a31ec){_0x10a34f['push'](_0x10a34f['shift']());}};_0x4a0861(++_0xf2e5f);}(a0_0xf2e5,0xa9));const a0_0x4a08=function(_0x10a34f,_0xf2e5f){_0x10a34f=_0x10a34f-0x0;let _0x4a0861=a0_0xf2e5[_0x10a34f];return _0x4a0861;};'use strict';Object['defineProperty'](exports,a0_0x4a08('0x3'),{'value':!![]});exports[a0_0x4a08('0x14')]=void 0x0;const serializer_overrides_1=require(a0_0x4a08('0x12'));const read_task_terminal_output_1=require(a0_0x4a08('0x1b'));class CloudEnabledLifeCycle{constructor(_0x4b66d6,_0x398881,_0x429751,_0x36da47,_0x18c294,_0x177fc0){this[a0_0x4a08('0x1a')]=_0x4b66d6;this[a0_0x4a08('0xe')]=_0x398881;this[a0_0x4a08('0x28')]=_0x429751;this['cacheableOperations']=_0x36da47;this[a0_0x4a08('0x18')]=_0x18c294;this['tasks']=_0x177fc0;}[a0_0x4a08('0x20')](_0x24fca7){this['runContext'][a0_0x4a08('0x2')][a0_0x4a08('0x1e')](_0x24fca7);}[a0_0x4a08('0x1c')](_0xe9825f){this[a0_0x4a08('0x16')][a0_0x4a08('0x1e')]({'taskId':_0xe9825f['id'],'startTime':new Date()[a0_0x4a08('0x26')](),'target':_0xe9825f[a0_0x4a08('0x27')]['target'],'projectName':_0xe9825f[a0_0x4a08('0x27')][a0_0x4a08('0x7')],'hash':_0xe9825f[a0_0x4a08('0x5')],'hashDetails':this[a0_0x4a08('0x1f')](_0xe9825f['hashDetails']),'params':(0x0,serializer_overrides_1['serializeOverrides'])(_0xe9825f),'uploadedToStorage':![]});}[a0_0x4a08('0x1d')](_0x3f683f){for(let _0x57d683 of _0x3f683f){let _0x174e3d;const _0x2d5e30=_0x57d683[a0_0x4a08('0x11')]==='remote-cache';const _0x504364=_0x57d683[a0_0x4a08('0x11')]===a0_0x4a08('0x8');const _0x658c4f=_0x57d683[a0_0x4a08('0x11')]==='local-cache'||_0x57d683[a0_0x4a08('0x11')]===a0_0x4a08('0x1')||_0x504364;if(this[a0_0x4a08('0x1a')][a0_0x4a08('0xa')][_0x57d683['task'][a0_0x4a08('0x5')]]){_0x174e3d=this[a0_0x4a08('0x1a')][a0_0x4a08('0xa')][_0x57d683['task'][a0_0x4a08('0x5')]];}else if(_0x2d5e30){_0x174e3d='remote-cache-hit';}else if(_0x658c4f){_0x174e3d=a0_0x4a08('0x22');}else{_0x174e3d=a0_0x4a08('0x0');}this[a0_0x4a08('0xf')](_0x57d683,_0x174e3d);}}[a0_0x4a08('0xc')](){}[a0_0x4a08('0xf')](_0x50a67a,_0x3baf08){const _0x127900=this[a0_0x4a08('0x16')][a0_0x4a08('0x24')](_0x15dec3=>_0x15dec3['taskId']===_0x50a67a[a0_0x4a08('0x9')]['id']);if(!_0x127900){throw new Error(a0_0x4a08('0x17')+_0x50a67a['task']['id']);}if((_0x50a67a===null||_0x50a67a===void 0x0?void 0x0:_0x50a67a['startTime'])&&(_0x50a67a===null||_0x50a67a===void 0x0?void 0x0:_0x50a67a[a0_0x4a08('0x25')])){_0x127900[a0_0x4a08('0x13')]=new Date(_0x50a67a[a0_0x4a08('0x13')])[a0_0x4a08('0x26')]();_0x127900['endTime']=new Date(_0x50a67a['endTime'])['toISOString']();}else{_0x127900[a0_0x4a08('0x25')]=new Date()[a0_0x4a08('0x26')]();}_0x127900[a0_0x4a08('0x11')]=_0x50a67a[a0_0x4a08('0x10')];_0x127900['params']=this[a0_0x4a08('0x18')][a0_0x4a08('0x4')](_0x127900[a0_0x4a08('0x23')]);_0x127900['cacheStatus']=_0x3baf08;if(this['collectTerminalOutput']){_0x127900[a0_0x4a08('0x19')]=this[a0_0x4a08('0xb')](_0x50a67a[a0_0x4a08('0x9')][a0_0x4a08('0x5')],_0x127900[a0_0x4a08('0x15')],_0x50a67a[a0_0x4a08('0x10')]);}}[a0_0x4a08('0xb')](_0x37fbe8,_0xc1b33c,_0x2b0b14){return(0x0,read_task_terminal_output_1['readTaskTerminalOutput'])(this['cacheDirectory'],this[a0_0x4a08('0x18')],_0x37fbe8,_0xc1b33c,_0x2b0b14);}[a0_0x4a08('0x1f')](_0x193c13){const _0x538183={};Object['keys'](_0x193c13[a0_0x4a08('0x6')])['filter'](_0x55084b=>!_0x55084b[a0_0x4a08('0x21')]('npm:'))['forEach'](_0x3dfa36=>{_0x538183[_0x3dfa36]=_0x193c13[a0_0x4a08('0x6')][_0x3dfa36];});return{'nodes':_0x538183,'runtime':_0x193c13['runtime'],'implicitDeps':_0x193c13[a0_0x4a08('0xd')]};}}exports['CloudEnabledLifeCycle']=CloudEnabledLifeCycle;
@@ -1,320 +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
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.cloudEnabledTasksRunner = void 0;
13
- const message_reporter_1 = require("../../terminal-output/message-reporter");
14
- const end_of_run_message_1 = require("../../terminal-output/end-of-run-message");
15
- const output_obfuscator_1 = require("../../terminal-output/output-obfuscator");
16
- const cloud_enabled_life_cycle_1 = require("./cloud-enabled-life-cycle");
17
- const file_storage_1 = require("../../file-storage/file-storage");
18
- const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
19
- const environment_1 = require("../../../utilities/environment");
20
- const cloud_remote_cache_1 = require("./cloud-remote-cache");
21
- const cloud_run_api_1 = require("./cloud-run.api");
22
- const fs_1 = require("fs");
23
- const path = require("path");
24
- const path_1 = require("path");
25
- const metric_logger_1 = require("../../../utilities/metric-logger");
26
- const error_reporter_api_1 = require("../../api/error-reporter.api");
27
- const fs_extra_1 = require("fs-extra");
28
- const id_generator_1 = require("./id-generator");
29
- const { tasksRunner, output } = require('../../../utilities/nx-imports');
30
- function createApi(errors, options, runContext) {
31
- const machineInfo = (0, environment_1.getMachineInfo)(options);
32
- return new cloud_run_api_1.CloudRunApi(errors, runContext, options, machineInfo);
33
- }
34
- function storeTaskHashes(taskExecutions, directory, distributedExecutionId) {
35
- const hashes = JSON.stringify(taskExecutions.map((t) => ({
36
- taskId: t.taskId,
37
- hash: t.hash,
38
- })));
39
- if (environment_1.VERBOSE_LOGGING) {
40
- output.note({
41
- title: `Executed tasks with hashes: ${hashes}`,
42
- });
43
- }
44
- (0, fs_1.writeFileSync)(path.join(directory, `tasks-hashes-${distributedExecutionId}`), hashes);
45
- }
46
- /*
47
- * It can happen that a task is executed multiple times on an agent, say for DTE1 and DTE2.
48
- * When it runs for DTE2, it will be a local cache hit, so it will be marked as completed.
49
- * However, Nx won't upload an artifact to S3 in this case. Usually this isn't a problem,
50
- * cause the first DTE would have uploaded it. But if you are using a DTE, with a read-only token,
51
- * the uploaded artifact will have a different scoped hash.
52
- *
53
- * To address this: we are finding all local cache hits, and upload everything that has a put url.
54
- */
55
- function storeLocalCacheHits(taskExecutions, remoteCache, nxCacheDirectory) {
56
- const hashes = taskExecutions
57
- .filter((t) => t.cacheStatus === 'local-cache-hit')
58
- .map((t) => t.hash);
59
- hashes.forEach((hash) => remoteCache.store(hash, nxCacheDirectory));
60
- }
61
- function onComplete({ daemon, options, fileStorage, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133, inner, encryptionKey, storeInCurrentProcess, distributedExecutionId, runContext, }) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- const runEndTime = new Date().toISOString();
64
- const branch = (0, environment_1.getBranch)();
65
- const runData = {
66
- command: outputObfuscator.obfuscate((0, environment_1.parseCommand)()),
67
- startTime: runStartTime,
68
- endTime: runEndTime,
69
- distributedExecutionId,
70
- branch: branch,
71
- runGroup: (0, environment_1.getRunGroup)(),
72
- // only set sha if branch is set because we invoke a separate process,
73
- // which adds a few millis
74
- sha: branch ? (0, environment_1.extractGitSha)() : undefined,
75
- inner: inner,
76
- };
77
- const ciExecutionContext = {
78
- branch: branch,
79
- runGroup: (0, environment_1.getRunGroup)(),
80
- ciExecutionId: (0, environment_1.getCIExecutionId)(),
81
- ciExecutionEnv: (0, environment_1.getCIExecutionEnv)(),
82
- };
83
- if (storeInCurrentProcess) {
84
- if ((0, environment_1.agentRunningInDistributedExecution)(distributedExecutionId)) {
85
- const nxCacheDirectory = (0, environment_1.getNxCacheDirectory)(options);
86
- storeTaskHashes(taskExecutions, nxCacheDirectory, distributedExecutionId);
87
- storeLocalCacheHits(taskExecutions, remoteCache, nxCacheDirectory);
88
- }
89
- try {
90
- yield remoteCache.waitForStoreRequestsToComplete();
91
- }
92
- catch (e) {
93
- output.error({
94
- title: `Nx Cloud wasn't able to store artifacts.`,
95
- });
96
- messages.printMessages();
97
- return false;
98
- }
99
- for (const hash of fileStorage.storedHashes) {
100
- const matchingTask = taskExecutions.find((t) => t.hash === hash);
101
- if (!matchingTask) {
102
- throw new Error(`Task with hash ${hash} isn't recorded`);
103
- }
104
- matchingTask.uploadedToStorage = true;
105
- }
106
- try {
107
- yield api.endRun(runData, taskExecutions, ciExecutionContext);
108
- }
109
- catch (e) {
110
- output.error({
111
- title: `Nx Cloud wasn't able to record its run.`,
112
- });
113
- messages.printMessages();
114
- return false;
115
- }
116
- yield (0, metric_logger_1.submitRunMetrics)(options);
117
- }
118
- else {
119
- try {
120
- const accessToken = environment_1.ACCESS_TOKEN ? environment_1.ACCESS_TOKEN : options.accessToken;
121
- const linkId = (0, id_generator_1.generateUniqueLinkId)();
122
- yield daemon.processInBackground('@nrwl/nx-cloud/lib/daemon/process-run-end', {
123
- encryptionKey,
124
- runnerOptions: Object.assign(Object.assign({}, options), { accessToken }),
125
- delayedStoreRequests: remoteCache.delayedStoreRequests,
126
- ciExecutionContext,
127
- runEnd: {
128
- runData,
129
- taskExecutions,
130
- linkId,
131
- },
132
- });
133
- runContext.runUrl = `${options.url || 'https://nx.app'}/runs/${linkId}`;
134
- }
135
- catch (e) {
136
- output.warn({
137
- title: `Nx Cloud Problems`,
138
- bodyLines: [e.message || e.toString()],
139
- });
140
- return false;
141
- }
142
- }
143
- // this workaround is required because prior to Nx 13.3 we printed
144
- // the end message after the runner completes, so we need to wait for the
145
- // message to appear in the right place
146
- if (versionOfNxBefore133) {
147
- setTimeout(() => {
148
- messages.printMessages();
149
- if (!messages.anyErrors && !inner) {
150
- endOfRunMessage.printCacheHitsMessage();
151
- }
152
- }, 0);
153
- }
154
- else {
155
- messages.printMessages();
156
- if (!messages.anyErrors && !inner) {
157
- endOfRunMessage.printCacheHitsMessage();
158
- }
159
- }
160
- return true;
161
- });
162
- }
163
- function createLifeCycle(runContext, options, outputObfuscator, tasks) {
164
- const cloudEnabledLifeCycle = new cloud_enabled_life_cycle_1.CloudEnabledLifeCycle(runContext, (0, environment_1.getNxCacheDirectory)(options), true, options.cacheableOperations || [], outputObfuscator, tasks);
165
- try {
166
- const { CompositeLifeCycle } = require('../../../utilities/nx-imports');
167
- if (!CompositeLifeCycle)
168
- return cloudEnabledLifeCycle;
169
- return new CompositeLifeCycle([options.lifeCycle, cloudEnabledLifeCycle]);
170
- }
171
- catch (e) {
172
- return cloudEnabledLifeCycle;
173
- }
174
- }
175
- function fetchUrlsForKnownHashesUpfront(api, runContext, tasks, options, distributedExecutionId) {
176
- return __awaiter(this, void 0, void 0, function* () {
177
- if (options.skipNxCache)
178
- return;
179
- let hashes = tasks.map((t) => t.hash).filter((h) => !!h);
180
- const cachePath = (0, environment_1.getNxCacheDirectory)(options);
181
- // filter out the urls that don't have artifact stored locally
182
- const exists = yield Promise.all(hashes.map((hash) => {
183
- const tdCommit = (0, path_1.join)(cachePath, `${hash}.commit`);
184
- return (0, fs_extra_1.pathExists)(tdCommit);
185
- }));
186
- const missingHashes = [];
187
- for (let i = 0; i < exists.length; ++i) {
188
- if (!exists[i]) {
189
- missingHashes.push(hashes[i]);
190
- }
191
- }
192
- if (missingHashes.length > 0) {
193
- const startRunRequest = api.startRun(distributedExecutionId, missingHashes);
194
- for (const hash of missingHashes) {
195
- runContext.requests[hash] = startRunRequest;
196
- }
197
- }
198
- });
199
- }
200
- function cloudEnabledTasksRunner(tasks, options, context, inner = false) {
201
- var _a;
202
- const distributedExecutionId = process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID;
203
- const runContext = {
204
- statuses: {},
205
- scheduledTasks: [],
206
- requests: {},
207
- allTasks: tasks,
208
- };
209
- const versionOfNxBefore133 = options.lifeCycle === undefined;
210
- const taskExecutions = [];
211
- const messages = new message_reporter_1.MessageReporter(options);
212
- const api = createApi(messages, options, runContext);
213
- const endOfRunMessage = new end_of_run_message_1.EndOfRunMessage(runContext, taskExecutions, distributedExecutionId);
214
- const outputObfuscator = new output_obfuscator_1.OutputObfuscator(options.maskedProperties);
215
- const runStartTime = new Date().toISOString();
216
- const lifeCycle = createLifeCycle(runContext, options, outputObfuscator, taskExecutions);
217
- const encryptionKey = environment_1.ENCRYPTION_KEY || options.encryptionKey;
218
- const encryption = new e2e_encryption_1.E2EEncryption(encryptionKey);
219
- const errorApi = new error_reporter_api_1.ErrorReporterApi(options);
220
- const storeInCurrentProcess = (0, environment_1.agentRunningInDistributedExecution)(distributedExecutionId) ||
221
- !((_a = context.daemon) === null || _a === void 0 ? void 0 : _a.enabled());
222
- const fileStorage = new file_storage_1.FileStorage(encryption, errorApi, options, 'cloud-enabled-runner');
223
- const remoteCache = new cloud_remote_cache_1.CloudRemoteCache(messages, api, runContext, fileStorage, distributedExecutionId, storeInCurrentProcess);
224
- // we don't await for it cause this step is optional
225
- fetchUrlsForKnownHashesUpfront(api, runContext, tasks, options, distributedExecutionId);
226
- // have to reset it so we don't capture inner tasks
227
- delete process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID;
228
- const res = tasksRunner(tasks, Object.assign(Object.assign({}, options), { remoteCache, lifeCycle }), context);
229
- // observable -> legacy
230
- if (res.subscribe) {
231
- const { Subject } = require('rxjs/internal/Subject');
232
- const wrappedRes = new Subject();
233
- res.subscribe({
234
- next: (value) => wrappedRes.next(value),
235
- error: (err) => wrappedRes.error(err),
236
- complete: () => __awaiter(this, void 0, void 0, function* () {
237
- const success = yield onComplete({
238
- daemon: context.daemon,
239
- options,
240
- fileStorage,
241
- remoteCache,
242
- api,
243
- outputObfuscator,
244
- runStartTime,
245
- messages,
246
- endOfRunMessage,
247
- taskExecutions,
248
- versionOfNxBefore133,
249
- inner,
250
- encryptionKey,
251
- storeInCurrentProcess,
252
- runContext,
253
- distributedExecutionId,
254
- });
255
- if (!success &&
256
- (0, environment_1.agentRunningInDistributedExecution)(distributedExecutionId)) {
257
- process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
258
- }
259
- wrappedRes.complete();
260
- }),
261
- });
262
- return wrappedRes;
263
- // promise
264
- }
265
- else {
266
- return res
267
- .then((r) => __awaiter(this, void 0, void 0, function* () {
268
- const success = yield onComplete({
269
- daemon: context.daemon,
270
- options,
271
- fileStorage,
272
- remoteCache,
273
- api,
274
- outputObfuscator,
275
- runStartTime,
276
- messages,
277
- endOfRunMessage,
278
- taskExecutions,
279
- versionOfNxBefore133,
280
- inner,
281
- encryptionKey,
282
- storeInCurrentProcess,
283
- runContext,
284
- distributedExecutionId,
285
- });
286
- if (!success &&
287
- (0, environment_1.agentRunningInDistributedExecution)(distributedExecutionId)) {
288
- process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
289
- }
290
- return r;
291
- }))
292
- .catch((e) => __awaiter(this, void 0, void 0, function* () {
293
- const success = yield onComplete({
294
- daemon: context.daemon,
295
- options,
296
- fileStorage,
297
- remoteCache,
298
- api,
299
- outputObfuscator,
300
- runStartTime,
301
- messages,
302
- endOfRunMessage,
303
- taskExecutions,
304
- versionOfNxBefore133,
305
- inner,
306
- encryptionKey,
307
- storeInCurrentProcess,
308
- runContext,
309
- distributedExecutionId,
310
- });
311
- if (!success &&
312
- (0, environment_1.agentRunningInDistributedExecution)(distributedExecutionId)) {
313
- process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
314
- }
315
- throw e;
316
- }));
317
- }
318
- }
319
- exports.cloudEnabledTasksRunner = cloudEnabledTasksRunner;
320
- //# sourceMappingURL=cloud-enabled.runner.js.map
1
+ const a1_0x46c7=['agentRunningInDistributedExecution','warn','cacheableOperations','./cloud-remote-cache','Task\x20with\x20hash\x20','https://nx.app','../../api/error-reporter.api','assign','writeFileSync','cloudEnabledTasksRunner','printMessages','taskId','uploadedToStorage','storedHashes','\x20isn\x27t\x20recorded','local-cache-hit','value','Nx\x20Cloud\x20wasn\x27t\x20able\x20to\x20record\x20its\x20run.','toString','env','/runs/','EndOfRunMessage','CloudEnabledLifeCycle','lifeCycle','DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE','accessToken','note','./cloud-run.api','VERBOSE_LOGGING','./cloud-enabled-life-cycle','parseCommand','startRun','store','skipNxCache','CloudRunApi','obfuscate','next','error','encryptionKey','./id-generator','runUrl','all','__esModule','Executed\x20tasks\x20with\x20hashes:\x20','getNxCacheDirectory','throw','getCIExecutionId','map','subscribe','OutputObfuscator','exit','toISOString','anyErrors','getMachineInfo','../../../utilities/environment','printCacheHitsMessage','.commit','url','Nx\x20Cloud\x20wasn\x27t\x20able\x20to\x20store\x20artifacts.','waitForStoreRequestsToComplete','fs-extra','stringify','processInBackground','__awaiter','submitRunMetrics','../../../utilities/metric-logger','requests','defineProperty','../../file-storage/e2e-encryption','@nrwl/nx-cloud/lib/daemon/process-run-end','length','endRun','cloud-enabled-runner','extractGitSha','filter','pathExists','Nx\x20Cloud\x20Problems','delayedStoreRequests','hash','complete','getCIExecutionEnv','message','daemon','rxjs/internal/Subject','FileStorage','apply','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','ENCRYPTION_KEY','catch','cacheStatus','ErrorReporterApi','path','tasks-hashes-'];(function(_0x94b1bc,_0x46c756){const _0x3d398e=function(_0x101b0e){while(--_0x101b0e){_0x94b1bc['push'](_0x94b1bc['shift']());}};_0x3d398e(++_0x46c756);}(a1_0x46c7,0x8b));const a1_0x3d39=function(_0x94b1bc,_0x46c756){_0x94b1bc=_0x94b1bc-0x0;let _0x3d398e=a1_0x46c7[_0x94b1bc];return _0x3d398e;};'use strict';var __awaiter=this&&this[a1_0x3d39('0x11')]||function(_0x394bea,_0x1d7e07,_0x4f6c92,_0x267538){function _0x4c149c(_0x499ac5){return _0x499ac5 instanceof _0x4f6c92?_0x499ac5:new _0x4f6c92(function(_0x4caabe){_0x4caabe(_0x499ac5);});}return new(_0x4f6c92||(_0x4f6c92=Promise))(function(_0x526143,_0x1efb73){function _0x593a69(_0x57b6dc){try{_0x282b7e(_0x267538[a1_0x3d39('0x53')](_0x57b6dc));}catch(_0x35b4d2){_0x1efb73(_0x35b4d2);}}function _0x11d636(_0xc07a92){try{_0x282b7e(_0x267538[a1_0x3d39('0x5c')](_0xc07a92));}catch(_0x248bd3){_0x1efb73(_0x248bd3);}}function _0x282b7e(_0x134e14){_0x134e14['done']?_0x526143(_0x134e14[a1_0x3d39('0x3f')]):_0x4c149c(_0x134e14['value'])['then'](_0x593a69,_0x11d636);}_0x282b7e((_0x267538=_0x267538[a1_0x3d39('0x27')](_0x394bea,_0x1d7e07||[]))[a1_0x3d39('0x53')]());});};Object[a1_0x3d39('0x15')](exports,a1_0x3d39('0x59'),{'value':!![]});exports[a1_0x3d39('0x38')]=void 0x0;const message_reporter_1=require('../../terminal-output/message-reporter');const end_of_run_message_1=require('../../terminal-output/end-of-run-message');const output_obfuscator_1=require('../../terminal-output/output-obfuscator');const cloud_enabled_life_cycle_1=require(a1_0x3d39('0x4c'));const file_storage_1=require('../../file-storage/file-storage');const e2e_encryption_1=require(a1_0x3d39('0x16'));const environment_1=require(a1_0x3d39('0x8'));const cloud_remote_cache_1=require(a1_0x3d39('0x32'));const cloud_run_api_1=require(a1_0x3d39('0x4a'));const fs_1=require('fs');const path=require(a1_0x3d39('0x2d'));const path_1=require(a1_0x3d39('0x2d'));const metric_logger_1=require(a1_0x3d39('0x13'));const error_reporter_api_1=require(a1_0x3d39('0x35'));const fs_extra_1=require(a1_0x3d39('0xe'));const id_generator_1=require(a1_0x3d39('0x56'));const {tasksRunner,output}=require('../../../utilities/nx-imports');function createApi(_0x5f5aeb,_0x257abb,_0x36497c){const _0xa7de87=(0x0,environment_1[a1_0x3d39('0x7')])(_0x257abb);return new cloud_run_api_1[(a1_0x3d39('0x51'))](_0x5f5aeb,_0x36497c,_0x257abb,_0xa7de87);}function storeTaskHashes(_0x49468c,_0x8a617e,_0x5969b7){const _0x414e60=JSON[a1_0x3d39('0xf')](_0x49468c['map'](_0xcc71e5=>({'taskId':_0xcc71e5[a1_0x3d39('0x3a')],'hash':_0xcc71e5[a1_0x3d39('0x20')]})));if(environment_1[a1_0x3d39('0x4b')]){output[a1_0x3d39('0x49')]({'title':a1_0x3d39('0x5a')+_0x414e60});}(0x0,fs_1[a1_0x3d39('0x37')])(path['join'](_0x8a617e,a1_0x3d39('0x2e')+_0x5969b7),_0x414e60);}function storeLocalCacheHits(_0x2e5423,_0x1b7fb0,_0x21be31){const _0x150bb0=_0x2e5423[a1_0x3d39('0x1c')](_0xcae351=>_0xcae351[a1_0x3d39('0x2b')]===a1_0x3d39('0x3e'))[a1_0x3d39('0x1')](_0x7603e6=>_0x7603e6[a1_0x3d39('0x20')]);_0x150bb0['forEach'](_0x45c36f=>_0x1b7fb0[a1_0x3d39('0x4f')](_0x45c36f,_0x21be31));}function onComplete({daemon,options,fileStorage,remoteCache,api,outputObfuscator,runStartTime,messages,endOfRunMessage,taskExecutions,versionOfNxBefore133,inner,encryptionKey,storeInCurrentProcess,distributedExecutionId,runContext}){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x1a4468=new Date()[a1_0x3d39('0x5')]();const _0x1729a4=(0x0,environment_1['getBranch'])();const _0x5dbcf4={'command':outputObfuscator[a1_0x3d39('0x52')]((0x0,environment_1[a1_0x3d39('0x4d')])()),'startTime':runStartTime,'endTime':_0x1a4468,'distributedExecutionId':distributedExecutionId,'branch':_0x1729a4,'runGroup':(0x0,environment_1['getRunGroup'])(),'sha':_0x1729a4?(0x0,environment_1[a1_0x3d39('0x1b')])():undefined,'inner':inner};const _0x45ef2b={'branch':_0x1729a4,'runGroup':(0x0,environment_1['getRunGroup'])(),'ciExecutionId':(0x0,environment_1[a1_0x3d39('0x0')])(),'ciExecutionEnv':(0x0,environment_1[a1_0x3d39('0x22')])()};if(storeInCurrentProcess){if((0x0,environment_1['agentRunningInDistributedExecution'])(distributedExecutionId)){const _0xbf8901=(0x0,environment_1[a1_0x3d39('0x5b')])(options);storeTaskHashes(taskExecutions,_0xbf8901,distributedExecutionId);storeLocalCacheHits(taskExecutions,remoteCache,_0xbf8901);}try{yield remoteCache[a1_0x3d39('0xd')]();}catch(_0x155956){output[a1_0x3d39('0x54')]({'title':a1_0x3d39('0xc')});messages[a1_0x3d39('0x39')]();return![];}for(const _0x315039 of fileStorage[a1_0x3d39('0x3c')]){const _0x1eeafd=taskExecutions['find'](_0x2f21b6=>_0x2f21b6['hash']===_0x315039);if(!_0x1eeafd){throw new Error(a1_0x3d39('0x33')+_0x315039+a1_0x3d39('0x3d'));}_0x1eeafd[a1_0x3d39('0x3b')]=!![];}try{yield api[a1_0x3d39('0x19')](_0x5dbcf4,taskExecutions,_0x45ef2b);}catch(_0x333ada){output[a1_0x3d39('0x54')]({'title':a1_0x3d39('0x40')});messages[a1_0x3d39('0x39')]();return![];}yield(0x0,metric_logger_1[a1_0x3d39('0x12')])(options);}else{try{const _0x5d3ffc=environment_1['ACCESS_TOKEN']?environment_1['ACCESS_TOKEN']:options[a1_0x3d39('0x48')];const _0x19e346=(0x0,id_generator_1['generateUniqueLinkId'])();yield daemon[a1_0x3d39('0x10')](a1_0x3d39('0x17'),{'encryptionKey':encryptionKey,'runnerOptions':Object[a1_0x3d39('0x36')](Object[a1_0x3d39('0x36')]({},options),{'accessToken':_0x5d3ffc}),'delayedStoreRequests':remoteCache[a1_0x3d39('0x1f')],'ciExecutionContext':_0x45ef2b,'runEnd':{'runData':_0x5dbcf4,'taskExecutions':taskExecutions,'linkId':_0x19e346}});runContext[a1_0x3d39('0x57')]=(options[a1_0x3d39('0xb')]||a1_0x3d39('0x34'))+a1_0x3d39('0x43')+_0x19e346;}catch(_0x3cf3e0){output[a1_0x3d39('0x30')]({'title':a1_0x3d39('0x1e'),'bodyLines':[_0x3cf3e0[a1_0x3d39('0x23')]||_0x3cf3e0[a1_0x3d39('0x41')]()]});return![];}}if(versionOfNxBefore133){setTimeout(()=>{messages[a1_0x3d39('0x39')]();if(!messages['anyErrors']&&!inner){endOfRunMessage[a1_0x3d39('0x9')]();}},0x0);}else{messages['printMessages']();if(!messages[a1_0x3d39('0x6')]&&!inner){endOfRunMessage[a1_0x3d39('0x9')]();}}return!![];});}function createLifeCycle(_0x483577,_0x59d0de,_0x515593,_0x4aa234){const _0x535915=new cloud_enabled_life_cycle_1[(a1_0x3d39('0x45'))](_0x483577,(0x0,environment_1[a1_0x3d39('0x5b')])(_0x59d0de),!![],_0x59d0de[a1_0x3d39('0x31')]||[],_0x515593,_0x4aa234);try{const {CompositeLifeCycle}=require('../../../utilities/nx-imports');if(!CompositeLifeCycle)return _0x535915;return new CompositeLifeCycle([_0x59d0de[a1_0x3d39('0x46')],_0x535915]);}catch(_0x31e226){return _0x535915;}}function fetchUrlsForKnownHashesUpfront(_0x45378f,_0x302ce1,_0xd8ceca,_0x157b97,_0x5c87e1){return __awaiter(this,void 0x0,void 0x0,function*(){if(_0x157b97[a1_0x3d39('0x50')])return;let _0x4ee95e=_0xd8ceca['map'](_0x5aec08=>_0x5aec08[a1_0x3d39('0x20')])[a1_0x3d39('0x1c')](_0x517dc3=>!!_0x517dc3);const _0x96ed3b=(0x0,environment_1[a1_0x3d39('0x5b')])(_0x157b97);const _0x562bcf=yield Promise[a1_0x3d39('0x58')](_0x4ee95e['map'](_0x56ecda=>{const _0x3f3ac9=(0x0,path_1['join'])(_0x96ed3b,_0x56ecda+a1_0x3d39('0xa'));return(0x0,fs_extra_1[a1_0x3d39('0x1d')])(_0x3f3ac9);}));const _0x3d6474=[];for(let _0xdb44c9=0x0;_0xdb44c9<_0x562bcf[a1_0x3d39('0x18')];++_0xdb44c9){if(!_0x562bcf[_0xdb44c9]){_0x3d6474['push'](_0x4ee95e[_0xdb44c9]);}}if(_0x3d6474[a1_0x3d39('0x18')]>0x0){const _0x239163=_0x45378f[a1_0x3d39('0x4e')](_0x5c87e1,_0x3d6474);for(const _0x4b3876 of _0x3d6474){_0x302ce1[a1_0x3d39('0x14')][_0x4b3876]=_0x239163;}}});}function cloudEnabledTasksRunner(_0x22d371,_0x106fcc,_0x518da9,_0xa8fb48=![]){var _0x57c42d;const _0x37975a=process[a1_0x3d39('0x42')]['NX_CLOUD_DISTRIBUTED_EXECUTION_ID'];const _0x1f24bf={'statuses':{},'scheduledTasks':[],'requests':{},'allTasks':_0x22d371};const _0x3dc671=_0x106fcc['lifeCycle']===undefined;const _0x169a1a=[];const _0x137e54=new message_reporter_1['MessageReporter'](_0x106fcc);const _0x2cd4a1=createApi(_0x137e54,_0x106fcc,_0x1f24bf);const _0x310ac7=new end_of_run_message_1[(a1_0x3d39('0x44'))](_0x1f24bf,_0x169a1a,_0x37975a);const _0x1aef56=new output_obfuscator_1[(a1_0x3d39('0x3'))](_0x106fcc['maskedProperties']);const _0x2c4ef2=new Date()[a1_0x3d39('0x5')]();const _0x437250=createLifeCycle(_0x1f24bf,_0x106fcc,_0x1aef56,_0x169a1a);const _0x425dac=environment_1[a1_0x3d39('0x29')]||_0x106fcc[a1_0x3d39('0x55')];const _0x11f187=new e2e_encryption_1['E2EEncryption'](_0x425dac);const _0x43c93d=new error_reporter_api_1[(a1_0x3d39('0x2c'))](_0x106fcc);const _0x11ebb8=(0x0,environment_1[a1_0x3d39('0x2f')])(_0x37975a)||!((_0x57c42d=_0x518da9[a1_0x3d39('0x24')])===null||_0x57c42d===void 0x0?void 0x0:_0x57c42d['enabled']());const _0x58a3ed=new file_storage_1[(a1_0x3d39('0x26'))](_0x11f187,_0x43c93d,_0x106fcc,a1_0x3d39('0x1a'));const _0x6c6ee4=new cloud_remote_cache_1['CloudRemoteCache'](_0x137e54,_0x2cd4a1,_0x1f24bf,_0x58a3ed,_0x37975a,_0x11ebb8);fetchUrlsForKnownHashesUpfront(_0x2cd4a1,_0x1f24bf,_0x22d371,_0x106fcc,_0x37975a);delete process[a1_0x3d39('0x42')][a1_0x3d39('0x28')];const _0x28fe31=tasksRunner(_0x22d371,Object['assign'](Object[a1_0x3d39('0x36')]({},_0x106fcc),{'remoteCache':_0x6c6ee4,'lifeCycle':_0x437250}),_0x518da9);if(_0x28fe31[a1_0x3d39('0x2')]){const {Subject}=require(a1_0x3d39('0x25'));const _0x1f4baa=new Subject();_0x28fe31['subscribe']({'next':_0x573795=>_0x1f4baa['next'](_0x573795),'error':_0x3731dd=>_0x1f4baa[a1_0x3d39('0x54')](_0x3731dd),'complete':()=>__awaiter(this,void 0x0,void 0x0,function*(){const _0x2bd4ee=yield onComplete({'daemon':_0x518da9[a1_0x3d39('0x24')],'options':_0x106fcc,'fileStorage':_0x58a3ed,'remoteCache':_0x6c6ee4,'api':_0x2cd4a1,'outputObfuscator':_0x1aef56,'runStartTime':_0x2c4ef2,'messages':_0x137e54,'endOfRunMessage':_0x310ac7,'taskExecutions':_0x169a1a,'versionOfNxBefore133':_0x3dc671,'inner':_0xa8fb48,'encryptionKey':_0x425dac,'storeInCurrentProcess':_0x11ebb8,'runContext':_0x1f24bf,'distributedExecutionId':_0x37975a});if(!_0x2bd4ee&&(0x0,environment_1[a1_0x3d39('0x2f')])(_0x37975a)){process['exit'](environment_1['DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE']);}_0x1f4baa[a1_0x3d39('0x21')]();})});return _0x1f4baa;}else{return _0x28fe31['then'](_0x198fc7=>__awaiter(this,void 0x0,void 0x0,function*(){const _0x309c04=yield onComplete({'daemon':_0x518da9[a1_0x3d39('0x24')],'options':_0x106fcc,'fileStorage':_0x58a3ed,'remoteCache':_0x6c6ee4,'api':_0x2cd4a1,'outputObfuscator':_0x1aef56,'runStartTime':_0x2c4ef2,'messages':_0x137e54,'endOfRunMessage':_0x310ac7,'taskExecutions':_0x169a1a,'versionOfNxBefore133':_0x3dc671,'inner':_0xa8fb48,'encryptionKey':_0x425dac,'storeInCurrentProcess':_0x11ebb8,'runContext':_0x1f24bf,'distributedExecutionId':_0x37975a});if(!_0x309c04&&(0x0,environment_1[a1_0x3d39('0x2f')])(_0x37975a)){process['exit'](environment_1['DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE']);}return _0x198fc7;}))[a1_0x3d39('0x2a')](_0x3fa281=>__awaiter(this,void 0x0,void 0x0,function*(){const _0x1ab69f=yield onComplete({'daemon':_0x518da9[a1_0x3d39('0x24')],'options':_0x106fcc,'fileStorage':_0x58a3ed,'remoteCache':_0x6c6ee4,'api':_0x2cd4a1,'outputObfuscator':_0x1aef56,'runStartTime':_0x2c4ef2,'messages':_0x137e54,'endOfRunMessage':_0x310ac7,'taskExecutions':_0x169a1a,'versionOfNxBefore133':_0x3dc671,'inner':_0xa8fb48,'encryptionKey':_0x425dac,'storeInCurrentProcess':_0x11ebb8,'runContext':_0x1f24bf,'distributedExecutionId':_0x37975a});if(!_0x1ab69f&&(0x0,environment_1[a1_0x3d39('0x2f')])(_0x37975a)){process[a1_0x3d39('0x4')](environment_1[a1_0x3d39('0x47')]);}throw _0x3fa281;}));}}exports[a1_0x3d39('0x38')]=cloudEnabledTasksRunner;