Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nx-cloud

Package Overview
Dependencies
Maintainers
1
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nx-cloud - npm Package Compare versions

Comparing version 13.2.0 to 13.2.1

66

lib/core/api/run-group.api.js

@@ -1,65 +0,1 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RunGroupApi = void 0;
const axios_1 = require("../../utilities/axios");
const metric_logger_1 = require("../../utilities/metric-logger");
const { output } = require('../../utilities/nx-imports');
class RunGroupApi {
constructor(options) {
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
}
createRunGroup(branch, runGroup) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const recorder = (0, metric_logger_1.createMetricRecorder)('createRunGroup');
try {
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/create-run-group', {
branch: branch,
runGroup: runGroup,
}));
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
}
catch (e) {
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
output.error({
title: e.message,
});
process.exit(1);
}
});
}
completeRunGroup(runGroup) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const recorder = (0, metric_logger_1.createMetricRecorder)('createRunGroup');
try {
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
runGroup: runGroup,
}));
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
}
catch (e) {
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
output.error({
title: e.message,
});
process.exit(1);
}
});
}
}
exports.RunGroupApi = RunGroupApi;
//# sourceMappingURL=run-group.api.js.map
const a0_0x1a13=['recordMetric','value','__awaiter','exit','defineProperty','axiosMultipleTries','axiosException','message','createRunGroup','createMetricRecorder','apply','throw','mapRespToPerfEntry','next','../../utilities/nx-imports','completeRunGroup','/nx-cloud/executions/create-run-group','__esModule','../../utilities/metric-logger','response','apiAxiosInstance','/nx-cloud/executions/complete-run-group','RunGroupApi','post','createApiAxiosInstance'];(function(_0x17f825,_0x1a1397){const _0x4b2d90=function(_0x3c3ecb){while(--_0x3c3ecb){_0x17f825['push'](_0x17f825['shift']());}};_0x4b2d90(++_0x1a1397);}(a0_0x1a13,0xc8));const a0_0x4b2d=function(_0x17f825,_0x1a1397){_0x17f825=_0x17f825-0x0;let _0x4b2d90=a0_0x1a13[_0x17f825];return _0x4b2d90;};'use strict';var __awaiter=this&&this[a0_0x4b2d('0x2')]||function(_0x2338d2,_0x402c74,_0x1d4481,_0x1602e2){function _0x221966(_0x13e42c){return _0x13e42c instanceof _0x1d4481?_0x13e42c:new _0x1d4481(function(_0x51580b){_0x51580b(_0x13e42c);});}return new(_0x1d4481||(_0x1d4481=Promise))(function(_0x122596,_0x2f46e8){function _0x255101(_0x1c5bbf){try{_0x5858bd(_0x1602e2[a0_0x4b2d('0xd')](_0x1c5bbf));}catch(_0x454119){_0x2f46e8(_0x454119);}}function _0x54c56e(_0x477902){try{_0x5858bd(_0x1602e2[a0_0x4b2d('0xb')](_0x477902));}catch(_0x485983){_0x2f46e8(_0x485983);}}function _0x5858bd(_0x331bd4){_0x331bd4['done']?_0x122596(_0x331bd4[a0_0x4b2d('0x1')]):_0x221966(_0x331bd4[a0_0x4b2d('0x1')])['then'](_0x255101,_0x54c56e);}_0x5858bd((_0x1602e2=_0x1602e2[a0_0x4b2d('0xa')](_0x2338d2,_0x402c74||[]))[a0_0x4b2d('0xd')]());});};Object[a0_0x4b2d('0x4')](exports,a0_0x4b2d('0x11'),{'value':!![]});exports[a0_0x4b2d('0x16')]=void 0x0;const axios_1=require('../../utilities/axios');const metric_logger_1=require(a0_0x4b2d('0x12'));const {output}=require(a0_0x4b2d('0xe'));class RunGroupApi{constructor(_0xab9bdd){this[a0_0x4b2d('0x14')]=(0x0,axios_1[a0_0x4b2d('0x18')])(_0xab9bdd);}[a0_0x4b2d('0x8')](_0x28c98b,_0x13f03e){var _0x40c94e;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x668199=(0x0,metric_logger_1[a0_0x4b2d('0x9')])(a0_0x4b2d('0x8'));try{const _0x43a4de=yield(0x0,axios_1['axiosMultipleTries'])(()=>this[a0_0x4b2d('0x14')][a0_0x4b2d('0x17')](a0_0x4b2d('0x10'),{'branch':_0x28c98b,'runGroup':_0x13f03e}));_0x668199[a0_0x4b2d('0x0')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x43a4de));}catch(_0x24594d){_0x668199[a0_0x4b2d('0x0')](((_0x40c94e=_0x24594d===null||_0x24594d===void 0x0?void 0x0:_0x24594d[a0_0x4b2d('0x6')])===null||_0x40c94e===void 0x0?void 0x0:_0x40c94e['response'])?(0x0,metric_logger_1[a0_0x4b2d('0xc')])(_0x24594d[a0_0x4b2d('0x6')][a0_0x4b2d('0x13')]):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);output['error']({'title':_0x24594d['message']});process[a0_0x4b2d('0x3')](0x1);}});}[a0_0x4b2d('0xf')](_0xc9c895){var _0x2c35b6;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x184a20=(0x0,metric_logger_1['createMetricRecorder'])(a0_0x4b2d('0x8'));try{const _0x1d6c53=yield(0x0,axios_1[a0_0x4b2d('0x5')])(()=>this[a0_0x4b2d('0x14')][a0_0x4b2d('0x17')](a0_0x4b2d('0x15'),{'runGroup':_0xc9c895}));_0x184a20['recordMetric']((0x0,metric_logger_1[a0_0x4b2d('0xc')])(_0x1d6c53));}catch(_0x656f8b){_0x184a20[a0_0x4b2d('0x0')](((_0x2c35b6=_0x656f8b===null||_0x656f8b===void 0x0?void 0x0:_0x656f8b[a0_0x4b2d('0x6')])===null||_0x2c35b6===void 0x0?void 0x0:_0x2c35b6[a0_0x4b2d('0x13')])?(0x0,metric_logger_1[a0_0x4b2d('0xc')])(_0x656f8b['axiosException'][a0_0x4b2d('0x13')]):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);output['error']({'title':_0x656f8b[a0_0x4b2d('0x7')]});process[a0_0x4b2d('0x3')](0x1);}});}}exports[a0_0x4b2d('0x16')]=RunGroupApi;

@@ -1,138 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloudEnabledLifeCycle = void 0;
const path = require("path");
const path_1 = require("path");
const fs_1 = require("fs");
const { appRootPath, unparse } = require('../../../utilities/nx-imports');
class CloudEnabledLifeCycle {
constructor(runContext, cacheDirectory, skipNxCache, collectTerminalOutput, cacheableOperations, outputObfuscator, tasks) {
this.runContext = runContext;
this.cacheDirectory = cacheDirectory;
this.skipNxCache = skipNxCache;
this.collectTerminalOutput = collectTerminalOutput;
this.cacheableOperations = cacheableOperations;
this.outputObfuscator = outputObfuscator;
this.tasks = tasks;
}
scheduleTask(task) {
this.runContext.scheduledTasks.push(task);
}
startTask(task) {
const overrides = Object.assign({}, (task.overrides || {}));
if (task.target.configuration) {
overrides['configuration'] = task.target.configuration;
}
this.tasks.push({
taskId: task.id,
startTime: new Date().toISOString(),
target: task.target.target,
projectName: task.target.project,
hash: task.hash,
hashDetails: this.cleanUpHashDetails(task.hashDetails),
params: unparse(overrides).join(' '),
});
}
// Used for older version for Nx. Remove in Dec 2022
endTask(task, code) {
let cacheStatus;
if (this.runContext.statuses[task.hash]) {
cacheStatus = this.runContext.statuses[task.hash];
}
else {
if (this.cacheableOperations.indexOf(task.target.target) > -1 &&
!this.skipNxCache) {
cacheStatus = 'local-cache-hit';
}
else {
cacheStatus = 'cache-miss';
}
}
this.updateStartedTask(task, code, cacheStatus);
}
endTasks(tasks) {
for (let t of tasks) {
const status = t.status === 'remote-cache'
? 'remote-cache-hit'
: t.status === 'local-cache' ||
t.status === 'local-cache-kept-existing'
? 'local-cache-hit'
: 'cache-miss';
this.updateStartedTask(t.task, t.code, status);
}
}
endCommand() { }
updateStartedTask(task, code, cacheStatus) {
const startedTask = this.tasks.find((t) => t.taskId === task.id);
if (!startedTask) {
throw new Error(`Cannot find task ${task.id}`);
}
startedTask.endTime = new Date().toISOString();
startedTask.status = code;
startedTask.params = this.outputObfuscator.obfuscate(startedTask.params);
startedTask.cacheStatus = cacheStatus;
if (this.collectTerminalOutput) {
startedTask.terminalOutput = this.getTerminalOutput(task.hash, startedTask.cacheStatus, code);
}
}
getTerminalOutput(hash, cacheStatus, code) {
let dir;
if (this.cacheDirectory) {
if (this.cacheDirectory.startsWith('./')) {
dir = (0, path_1.join)(appRootPath, this.cacheDirectory);
}
else {
dir = this.cacheDirectory;
}
}
else {
dir = (0, path_1.join)(appRootPath, 'node_modules', '.cache', 'nx');
}
try {
const taskOutput = this.readTerminalOutputFile(dir, hash);
const taskOutputSanitized = this.outputObfuscator.obfuscate(taskOutput);
const maxCharacters = cacheStatus === 'cache-miss'
? code === 0
? CloudEnabledLifeCycle.MAX_CHARACTERS_SUCCESSFUL_TASK
: CloudEnabledLifeCycle.MAX_CHARACTERS_FAILED_TASK
: CloudEnabledLifeCycle.MAX_CHARACTERS_CACHED_TASK;
return taskOutputSanitized.length > maxCharacters
? `TRUNCATED\n\n${taskOutputSanitized.slice(taskOutputSanitized.length - maxCharacters)}`
: taskOutputSanitized;
}
catch (e) {
return '';
}
}
cleanUpHashDetails(hashDetails) {
const nodes = {};
Object.keys(hashDetails.nodes)
.filter((k) => !k.startsWith('npm:'))
.forEach((k) => {
nodes[k] = hashDetails.nodes[k];
});
return {
nodes,
runtime: hashDetails.runtime,
implicitDeps: hashDetails.implicitDeps,
};
}
readTerminalOutputFile(dir, hash) {
try {
return (0, fs_1.readFileSync)(path.join(dir, 'terminalOutputs', hash)).toString();
}
catch (_a) {
try {
return (0, fs_1.readFileSync)(path.join(dir, hash, 'terminalOutput')).toString();
}
catch (_b) {
return '';
}
}
}
}
exports.CloudEnabledLifeCycle = CloudEnabledLifeCycle;
CloudEnabledLifeCycle.MAX_CHARACTERS_FAILED_TASK = 200000;
CloudEnabledLifeCycle.MAX_CHARACTERS_SUCCESSFUL_TASK = 20000;
CloudEnabledLifeCycle.MAX_CHARACTERS_CACHED_TASK = 5000;
//# sourceMappingURL=cloud-enabled-life-cycle.js.map
const a0_0x47d9=['configuration','assign','runtime','toISOString','statuses','cleanUpHashDetails','CloudEnabledLifeCycle','endCommand','status','MAX_CHARACTERS_SUCCESSFUL_TASK','remote-cache-hit','cacheStatus','MAX_CHARACTERS_CACHED_TASK','MAX_CHARACTERS_FAILED_TASK','taskId','readTerminalOutputFile','hashDetails','project','slice','updateStartedTask','getTerminalOutput','keys','local-cache-hit','join','tasks','nodes','filter','readFileSync','push','local-cache-kept-existing','local-cache','outputObfuscator','endTasks','terminalOutputs','overrides','cache-miss','target','toString','forEach','__esModule','collectTerminalOutput','defineProperty','cacheDirectory','startsWith','hash','obfuscate','length','scheduledTasks','terminalOutput','cacheableOperations','runContext','skipNxCache','endTask','startTask','path','remote-cache','find','node_modules','indexOf','.cache'];(function(_0x10c6de,_0x47d9f3){const _0x46b8de=function(_0x229dff){while(--_0x229dff){_0x10c6de['push'](_0x10c6de['shift']());}};_0x46b8de(++_0x47d9f3);}(a0_0x47d9,0xaa));const a0_0x46b8=function(_0x10c6de,_0x47d9f3){_0x10c6de=_0x10c6de-0x0;let _0x46b8de=a0_0x47d9[_0x10c6de];return _0x46b8de;};'use strict';Object[a0_0x46b8('0x33')](exports,a0_0x46b8('0x31'),{'value':!![]});exports[a0_0x46b8('0x10')]=void 0x0;const path=require(a0_0x46b8('0x4'));const path_1=require(a0_0x46b8('0x4'));const fs_1=require('fs');const {appRootPath,unparse}=require('../../../utilities/nx-imports');class CloudEnabledLifeCycle{constructor(_0x4a182d,_0x486429,_0x3ec134,_0x3178ea,_0xb393d2,_0xa3095e,_0x1356c6){this['runContext']=_0x4a182d;this[a0_0x46b8('0x34')]=_0x486429;this[a0_0x46b8('0x1')]=_0x3ec134;this[a0_0x46b8('0x32')]=_0x3178ea;this['cacheableOperations']=_0xb393d2;this[a0_0x46b8('0x29')]=_0xa3095e;this[a0_0x46b8('0x22')]=_0x1356c6;}['scheduleTask'](_0x5da31c){this['runContext'][a0_0x46b8('0x39')][a0_0x46b8('0x26')](_0x5da31c);}[a0_0x46b8('0x3')](_0x3d1ba5){const _0x14e1b2=Object[a0_0x46b8('0xb')]({},_0x3d1ba5[a0_0x46b8('0x2c')]||{});if(_0x3d1ba5[a0_0x46b8('0x2e')][a0_0x46b8('0xa')]){_0x14e1b2[a0_0x46b8('0xa')]=_0x3d1ba5['target'][a0_0x46b8('0xa')];}this[a0_0x46b8('0x22')][a0_0x46b8('0x26')]({'taskId':_0x3d1ba5['id'],'startTime':new Date()[a0_0x46b8('0xd')](),'target':_0x3d1ba5[a0_0x46b8('0x2e')][a0_0x46b8('0x2e')],'projectName':_0x3d1ba5['target'][a0_0x46b8('0x1b')],'hash':_0x3d1ba5[a0_0x46b8('0x36')],'hashDetails':this['cleanUpHashDetails'](_0x3d1ba5[a0_0x46b8('0x1a')]),'params':unparse(_0x14e1b2)[a0_0x46b8('0x21')]('\x20')});}[a0_0x46b8('0x2')](_0x3d8c13,_0x347740){let _0xd2c0d7;if(this[a0_0x46b8('0x0')][a0_0x46b8('0xe')][_0x3d8c13[a0_0x46b8('0x36')]]){_0xd2c0d7=this[a0_0x46b8('0x0')]['statuses'][_0x3d8c13['hash']];}else{if(this[a0_0x46b8('0x3b')][a0_0x46b8('0x8')](_0x3d8c13['target']['target'])>-0x1&&!this[a0_0x46b8('0x1')]){_0xd2c0d7=a0_0x46b8('0x20');}else{_0xd2c0d7=a0_0x46b8('0x2d');}}this[a0_0x46b8('0x1d')](_0x3d8c13,_0x347740,_0xd2c0d7);}[a0_0x46b8('0x2a')](_0x38e005){for(let _0x505404 of _0x38e005){const _0x507ac9=_0x505404[a0_0x46b8('0x12')]===a0_0x46b8('0x5')?a0_0x46b8('0x14'):_0x505404['status']===a0_0x46b8('0x28')||_0x505404[a0_0x46b8('0x12')]===a0_0x46b8('0x27')?a0_0x46b8('0x20'):a0_0x46b8('0x2d');this['updateStartedTask'](_0x505404['task'],_0x505404['code'],_0x507ac9);}}[a0_0x46b8('0x11')](){}['updateStartedTask'](_0x232b2d,_0xf60ebe,_0x31d594){const _0x246378=this['tasks'][a0_0x46b8('0x6')](_0x5a4dc2=>_0x5a4dc2[a0_0x46b8('0x18')]===_0x232b2d['id']);if(!_0x246378){throw new Error('Cannot\x20find\x20task\x20'+_0x232b2d['id']);}_0x246378['endTime']=new Date()['toISOString']();_0x246378['status']=_0xf60ebe;_0x246378['params']=this['outputObfuscator'][a0_0x46b8('0x37')](_0x246378['params']);_0x246378[a0_0x46b8('0x15')]=_0x31d594;if(this[a0_0x46b8('0x32')]){_0x246378['terminalOutput']=this[a0_0x46b8('0x1e')](_0x232b2d[a0_0x46b8('0x36')],_0x246378[a0_0x46b8('0x15')],_0xf60ebe);}}[a0_0x46b8('0x1e')](_0x3dd733,_0x35d48f,_0x55cbfe){let _0x3f194a;if(this[a0_0x46b8('0x34')]){if(this[a0_0x46b8('0x34')][a0_0x46b8('0x35')]('./')){_0x3f194a=(0x0,path_1['join'])(appRootPath,this['cacheDirectory']);}else{_0x3f194a=this[a0_0x46b8('0x34')];}}else{_0x3f194a=(0x0,path_1['join'])(appRootPath,a0_0x46b8('0x7'),a0_0x46b8('0x9'),'nx');}try{const _0x516e3d=this[a0_0x46b8('0x19')](_0x3f194a,_0x3dd733);const _0x2bfe71=this[a0_0x46b8('0x29')]['obfuscate'](_0x516e3d);const _0x2551ae=_0x35d48f===a0_0x46b8('0x2d')?_0x55cbfe===0x0?CloudEnabledLifeCycle[a0_0x46b8('0x13')]:CloudEnabledLifeCycle[a0_0x46b8('0x17')]:CloudEnabledLifeCycle[a0_0x46b8('0x16')];return _0x2bfe71[a0_0x46b8('0x38')]>_0x2551ae?'TRUNCATED\x0a\x0a'+_0x2bfe71[a0_0x46b8('0x1c')](_0x2bfe71[a0_0x46b8('0x38')]-_0x2551ae):_0x2bfe71;}catch(_0x4a96e3){return'';}}[a0_0x46b8('0xf')](_0x479359){const _0x3f47da={};Object[a0_0x46b8('0x1f')](_0x479359[a0_0x46b8('0x23')])[a0_0x46b8('0x24')](_0x37185c=>!_0x37185c[a0_0x46b8('0x35')]('npm:'))[a0_0x46b8('0x30')](_0x2dc5c4=>{_0x3f47da[_0x2dc5c4]=_0x479359[a0_0x46b8('0x23')][_0x2dc5c4];});return{'nodes':_0x3f47da,'runtime':_0x479359[a0_0x46b8('0xc')],'implicitDeps':_0x479359['implicitDeps']};}[a0_0x46b8('0x19')](_0x31c26a,_0x254dc0){try{return(0x0,fs_1[a0_0x46b8('0x25')])(path[a0_0x46b8('0x21')](_0x31c26a,a0_0x46b8('0x2b'),_0x254dc0))[a0_0x46b8('0x2f')]();}catch(_0x5ca910){try{return(0x0,fs_1[a0_0x46b8('0x25')])(path[a0_0x46b8('0x21')](_0x31c26a,_0x254dc0,a0_0x46b8('0x3a')))['toString']();}catch(_0x351acc){return'';}}}}exports[a0_0x46b8('0x10')]=CloudEnabledLifeCycle;CloudEnabledLifeCycle['MAX_CHARACTERS_FAILED_TASK']=0x30d40;CloudEnabledLifeCycle[a0_0x46b8('0x13')]=0x4e20;CloudEnabledLifeCycle[a0_0x46b8('0x16')]=0x1388;

@@ -1,166 +0,1 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.cloudEnabledTasksRunner = void 0;
const Subject_1 = require("rxjs/internal/Subject");
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("./cloud-enabled-life-cycle");
const file_storage_1 = require("../../file-storage/file-storage");
const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
const environment_1 = require("../../../utilities/environment");
const cloud_remote_cache_1 = require("./cloud-remote-cache");
const cloud_run_api_1 = require("./cloud-run.api");
const fs_1 = require("fs");
const path = require("path");
const metric_logger_1 = require("../../../utilities/metric-logger");
const { tasksRunnerV2, output } = require('../../../utilities/nx-imports');
function createApi(errors, options, runContext) {
const machineInfo = (0, environment_1.getMachineInfo)(options);
return new cloud_run_api_1.CloudRunApi(errors, runContext, options, machineInfo);
}
function storeTaskHashes(taskExecutions, directory, distributedExecutionId) {
const hashes = JSON.stringify(taskExecutions.map((t) => ({
taskId: t.taskId,
hash: t.hash,
})));
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: `Executed tasks with hashes: ${hashes}`,
});
}
(0, fs_1.writeFileSync)(path.join(directory, `tasks-hashes-${distributedExecutionId}`), hashes);
}
function onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133) {
return __awaiter(this, void 0, void 0, function* () {
const runEndTime = new Date().toISOString();
if (environment_1.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION) {
storeTaskHashes(taskExecutions, options.cacheDirectory || './node_modules/.cache/nx', environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID);
}
const branch = (0, environment_1.getBranch)();
const endRequest = yield Promise.all([
remoteCache.waitForStoreRequestsToComplete(),
api.endRun({
command: outputObfuscator.obfuscate((0, environment_1.parseCommand)()),
startTime: runStartTime,
endTime: runEndTime,
distributedExecutionId: environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID,
branch: branch,
scan: true,
runGroup: (0, environment_1.getRunGroup)(),
// only set sha if branch is set because we invoke a separate process,
// which adds a few millis
sha: branch ? (0, environment_1.extractGitSha)() : undefined,
}, taskExecutions),
]);
// this workaround is required because prior to Nx 13.3 we printed
// the end message after the runner completes, so we need to wait for the
// message to appear in the right place
if (versionOfNxBefore133) {
setTimeout(() => {
messages.printMessages();
if (!messages.anyErrors) {
endOfRunMessage.printCacheHitsMessage();
}
}, 0);
}
else {
messages.printMessages();
if (!messages.anyErrors) {
endOfRunMessage.printCacheHitsMessage();
}
}
if (environment_1.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION) {
if (!endRequest[0]) {
output.error({
title: `Agent wasn't able to store artifacts`,
});
messages.printMessages();
process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
}
if (!endRequest[1]) {
output.error({
title: `Agent wasn't able to record its run`,
});
messages.printMessages();
process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
}
}
yield (0, metric_logger_1.submitRunMetrics)(options);
});
}
function createLifeCycle(runContext, options, outputObfuscator, tasks) {
const cloudEnabledLifeCycle = new cloud_enabled_life_cycle_1.CloudEnabledLifeCycle(runContext, options.cacheDirectory, !!options.skipNxCache, options.scan === undefined ? true : options.scan, options.cacheableOperations || [], outputObfuscator, tasks);
try {
const { CompositeLifeCycle } = require('../../../utilities/nx-imports');
if (!CompositeLifeCycle)
return cloudEnabledLifeCycle;
return new CompositeLifeCycle([options.lifeCycle, cloudEnabledLifeCycle]);
}
catch (e) {
return cloudEnabledLifeCycle;
}
}
function cloudEnabledTasksRunner(tasks, options, context) {
const runContext = {
statuses: {},
scheduledTasks: [],
requests: {},
allTasks: tasks,
};
const versionOfNxBefore133 = options.lifeCycle === undefined;
const taskExecutions = [];
const messages = new message_reporter_1.MessageReporter(options);
const api = createApi(messages, options, runContext);
const endOfRunMessage = new end_of_run_message_1.EndOfRunMessage(runContext, taskExecutions);
const outputObfuscator = new output_obfuscator_1.OutputObfuscator(options.maskedProperties);
const hashes = tasks.map((t) => t.hash).filter((h) => !!h);
const startRunRequest = api.startRun(environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID, hashes);
hashes.forEach((hash) => {
runContext.requests[hash] = startRunRequest;
});
const runStartTime = new Date().toISOString();
const lifeCycle = createLifeCycle(runContext, options, outputObfuscator, taskExecutions);
const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
const fileStorage = new file_storage_1.FileStorage(encryption);
const remoteCache = new cloud_remote_cache_1.CloudRemoteCache(messages, api, runContext, fileStorage);
// have to reset it so we don't capture inner tasks
delete process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID;
const res = tasksRunnerV2(tasks, Object.assign(Object.assign({}, options), { remoteCache, lifeCycle }), context);
// observable -> legacy
if (res.subscribe) {
const wrappedRes = new Subject_1.Subject();
res.subscribe({
next: (value) => wrappedRes.next(value),
error: (err) => wrappedRes.error(err),
complete: () => __awaiter(this, void 0, void 0, function* () {
yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133);
wrappedRes.complete();
}),
});
return wrappedRes;
// promise
}
else {
return res
.then((r) => __awaiter(this, void 0, void 0, function* () {
yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133);
return r;
}))
.catch((e) => __awaiter(this, void 0, void 0, function* () {
yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133);
throw e;
}));
}
}
exports.cloudEnabledTasksRunner = cloudEnabledTasksRunner;
//# sourceMappingURL=cloud-enabled.runner.js.map
const a1_0x3638=['anyErrors','stringify','requests','Executed\x20tasks\x20with\x20hashes:\x20','toISOString','throw','getBranch','AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION','getMachineInfo','next','printMessages','getRunGroup','join','path','defineProperty','tasks-hashes-','subscribe','printCacheHitsMessage','done','DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE','../../../utilities/nx-imports','Agent\x20wasn\x27t\x20able\x20to\x20record\x20its\x20run','parseCommand','hash','./cloud-remote-cache','startRun','./cloud-enabled-life-cycle','../../../utilities/environment','__awaiter','CloudRunApi','obfuscate','cacheableOperations','taskId','FileStorage','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','exit','cacheDirectory','CloudRemoteCache','then','lifeCycle','../../../utilities/metric-logger','all','MessageReporter','E2EEncryption','value','encryptionKey','cloudEnabledTasksRunner','maskedProperties','submitRunMetrics','../../file-storage/e2e-encryption','scan','./node_modules/.cache/nx','map','__esModule','OutputObfuscator','EndOfRunMessage','complete','CloudEnabledLifeCycle','error','filter'];(function(_0x2bd96e,_0x3638c9){const _0x1abc1f=function(_0x2c9e09){while(--_0x2c9e09){_0x2bd96e['push'](_0x2bd96e['shift']());}};_0x1abc1f(++_0x3638c9);}(a1_0x3638,0x11c));const a1_0x1abc=function(_0x2bd96e,_0x3638c9){_0x2bd96e=_0x2bd96e-0x0;let _0x1abc1f=a1_0x3638[_0x2bd96e];return _0x1abc1f;};'use strict';var __awaiter=this&&this[a1_0x1abc('0x2c')]||function(_0x5c9582,_0x542586,_0x3db25a,_0x1f9bbe){function _0x38c6ca(_0x3fd370){return _0x3fd370 instanceof _0x3db25a?_0x3fd370:new _0x3db25a(function(_0x6eaf7c){_0x6eaf7c(_0x3fd370);});}return new(_0x3db25a||(_0x3db25a=Promise))(function(_0x42ded6,_0x3fdd74){function _0x5590ed(_0x45d870){try{_0x4763cb(_0x1f9bbe[a1_0x1abc('0x19')](_0x45d870));}catch(_0x233e10){_0x3fdd74(_0x233e10);}}function _0x3b6a6e(_0x1ebfb7){try{_0x4763cb(_0x1f9bbe[a1_0x1abc('0x15')](_0x1ebfb7));}catch(_0x153fa3){_0x3fdd74(_0x153fa3);}}function _0x4763cb(_0x413f0e){_0x413f0e[a1_0x1abc('0x22')]?_0x42ded6(_0x413f0e[a1_0x1abc('0x0')]):_0x38c6ca(_0x413f0e['value'])[a1_0x1abc('0x36')](_0x5590ed,_0x3b6a6e);}_0x4763cb((_0x1f9bbe=_0x1f9bbe['apply'](_0x5c9582,_0x542586||[]))[a1_0x1abc('0x19')]());});};Object[a1_0x1abc('0x1e')](exports,a1_0x1abc('0x9'),{'value':!![]});exports[a1_0x1abc('0x2')]=void 0x0;const Subject_1=require('rxjs/internal/Subject');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_0x1abc('0x2a'));const file_storage_1=require('../../file-storage/file-storage');const e2e_encryption_1=require(a1_0x1abc('0x5'));const environment_1=require(a1_0x1abc('0x2b'));const cloud_remote_cache_1=require(a1_0x1abc('0x28'));const cloud_run_api_1=require('./cloud-run.api');const fs_1=require('fs');const path=require(a1_0x1abc('0x1d'));const metric_logger_1=require(a1_0x1abc('0x38'));const {tasksRunnerV2,output}=require(a1_0x1abc('0x24'));function createApi(_0x2d568a,_0x450dd0,_0x339d00){const _0x427519=(0x0,environment_1[a1_0x1abc('0x18')])(_0x450dd0);return new cloud_run_api_1[(a1_0x1abc('0x2d'))](_0x2d568a,_0x339d00,_0x450dd0,_0x427519);}function storeTaskHashes(_0xb59c7e,_0x5dc5e5,_0x1e42f6){const _0x498e4b=JSON[a1_0x1abc('0x11')](_0xb59c7e['map'](_0x5c2021=>({'taskId':_0x5c2021[a1_0x1abc('0x30')],'hash':_0x5c2021['hash']})));if(environment_1['VERBOSE_LOGGING']){output['note']({'title':a1_0x1abc('0x13')+_0x498e4b});}(0x0,fs_1['writeFileSync'])(path[a1_0x1abc('0x1c')](_0x5dc5e5,a1_0x1abc('0x1f')+_0x1e42f6),_0x498e4b);}function onComplete(_0x289380,_0x138171,_0x4ccb79,_0x5297f4,_0xa28c74,_0x9771ff,_0x3ef8b2,_0x193586,_0xc6c34e,_0x128932){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x30fada=new Date()['toISOString']();if(environment_1[a1_0x1abc('0x17')]){storeTaskHashes(_0xc6c34e,_0x138171[a1_0x1abc('0x34')]||a1_0x1abc('0x7'),environment_1['NX_CLOUD_DISTRIBUTED_EXECUTION_ID']);}const _0x40f11c=(0x0,environment_1[a1_0x1abc('0x16')])();const _0x7afdf8=yield Promise[a1_0x1abc('0x39')]([_0x4ccb79['waitForStoreRequestsToComplete'](),_0x5297f4['endRun']({'command':_0xa28c74[a1_0x1abc('0x2e')]((0x0,environment_1[a1_0x1abc('0x26')])()),'startTime':_0x9771ff,'endTime':_0x30fada,'distributedExecutionId':environment_1[a1_0x1abc('0x32')],'branch':_0x40f11c,'scan':!![],'runGroup':(0x0,environment_1[a1_0x1abc('0x1b')])(),'sha':_0x40f11c?(0x0,environment_1['extractGitSha'])():undefined},_0xc6c34e)]);if(_0x128932){setTimeout(()=>{_0x3ef8b2[a1_0x1abc('0x1a')]();if(!_0x3ef8b2[a1_0x1abc('0x10')]){_0x193586[a1_0x1abc('0x21')]();}},0x0);}else{_0x3ef8b2[a1_0x1abc('0x1a')]();if(!_0x3ef8b2[a1_0x1abc('0x10')]){_0x193586[a1_0x1abc('0x21')]();}}if(environment_1[a1_0x1abc('0x17')]){if(!_0x7afdf8[0x0]){output['error']({'title':'Agent\x20wasn\x27t\x20able\x20to\x20store\x20artifacts'});_0x3ef8b2[a1_0x1abc('0x1a')]();process[a1_0x1abc('0x33')](environment_1[a1_0x1abc('0x23')]);}if(!_0x7afdf8[0x1]){output['error']({'title':a1_0x1abc('0x25')});_0x3ef8b2[a1_0x1abc('0x1a')]();process['exit'](environment_1[a1_0x1abc('0x23')]);}}yield(0x0,metric_logger_1[a1_0x1abc('0x4')])(_0x138171);});}function createLifeCycle(_0x19acf3,_0x324540,_0x3ffcc3,_0x3e55f5){const _0x2a7b94=new cloud_enabled_life_cycle_1[(a1_0x1abc('0xd'))](_0x19acf3,_0x324540[a1_0x1abc('0x34')],!!_0x324540['skipNxCache'],_0x324540[a1_0x1abc('0x6')]===undefined?!![]:_0x324540['scan'],_0x324540[a1_0x1abc('0x2f')]||[],_0x3ffcc3,_0x3e55f5);try{const {CompositeLifeCycle}=require(a1_0x1abc('0x24'));if(!CompositeLifeCycle)return _0x2a7b94;return new CompositeLifeCycle([_0x324540[a1_0x1abc('0x37')],_0x2a7b94]);}catch(_0x3cba71){return _0x2a7b94;}}function cloudEnabledTasksRunner(_0x48aec8,_0x2860f5,_0x54cf29){const _0x2880e5={'statuses':{},'scheduledTasks':[],'requests':{},'allTasks':_0x48aec8};const _0x1651e5=_0x2860f5[a1_0x1abc('0x37')]===undefined;const _0x122fba=[];const _0x2f81fa=new message_reporter_1[(a1_0x1abc('0x3a'))](_0x2860f5);const _0x1a963d=createApi(_0x2f81fa,_0x2860f5,_0x2880e5);const _0x4b7e9a=new end_of_run_message_1[(a1_0x1abc('0xb'))](_0x2880e5,_0x122fba);const _0x55e5b2=new output_obfuscator_1[(a1_0x1abc('0xa'))](_0x2860f5[a1_0x1abc('0x3')]);const _0x2790a7=_0x48aec8[a1_0x1abc('0x8')](_0x25968d=>_0x25968d[a1_0x1abc('0x27')])[a1_0x1abc('0xf')](_0x47e366=>!!_0x47e366);const _0x5379b5=_0x1a963d[a1_0x1abc('0x29')](environment_1[a1_0x1abc('0x32')],_0x2790a7);_0x2790a7['forEach'](_0x56e9e2=>{_0x2880e5[a1_0x1abc('0x12')][_0x56e9e2]=_0x5379b5;});const _0x3ef192=new Date()[a1_0x1abc('0x14')]();const _0x52225a=createLifeCycle(_0x2880e5,_0x2860f5,_0x55e5b2,_0x122fba);const _0x523e08=new e2e_encryption_1[(a1_0x1abc('0x3b'))](environment_1['ENCRYPTION_KEY']||_0x2860f5[a1_0x1abc('0x1')]);const _0x462be8=new file_storage_1[(a1_0x1abc('0x31'))](_0x523e08);const _0x2e7797=new cloud_remote_cache_1[(a1_0x1abc('0x35'))](_0x2f81fa,_0x1a963d,_0x2880e5,_0x462be8);delete process['env'][a1_0x1abc('0x32')];const _0x2bac08=tasksRunnerV2(_0x48aec8,Object['assign'](Object['assign']({},_0x2860f5),{'remoteCache':_0x2e7797,'lifeCycle':_0x52225a}),_0x54cf29);if(_0x2bac08['subscribe']){const _0x2068d8=new Subject_1['Subject']();_0x2bac08[a1_0x1abc('0x20')]({'next':_0x1f2dee=>_0x2068d8[a1_0x1abc('0x19')](_0x1f2dee),'error':_0x253333=>_0x2068d8[a1_0x1abc('0xe')](_0x253333),'complete':()=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x52225a,_0x2860f5,_0x2e7797,_0x1a963d,_0x55e5b2,_0x3ef192,_0x2f81fa,_0x4b7e9a,_0x122fba,_0x1651e5);_0x2068d8[a1_0x1abc('0xc')]();})});return _0x2068d8;}else{return _0x2bac08[a1_0x1abc('0x36')](_0x5a3c22=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x52225a,_0x2860f5,_0x2e7797,_0x1a963d,_0x55e5b2,_0x3ef192,_0x2f81fa,_0x4b7e9a,_0x122fba,_0x1651e5);return _0x5a3c22;}))['catch'](_0x9833e1=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x52225a,_0x2860f5,_0x2e7797,_0x1a963d,_0x55e5b2,_0x3ef192,_0x2f81fa,_0x4b7e9a,_0x122fba,_0x1651e5);throw _0x9833e1;}));}}exports[a1_0x1abc('0x2')]=cloudEnabledTasksRunner;

@@ -1,113 +0,1 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloudRemoteCache = void 0;
const environment_1 = require("../../../utilities/environment");
const { output } = require('../../../utilities/nx-imports');
class CloudRemoteCache {
constructor(messages, api, runContext, fileStorage) {
this.messages = messages;
this.api = api;
this.runContext = runContext;
this.fileStorage = fileStorage;
this.storeRequests = [];
}
retrieve(hash, cacheDirectory) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
if (this.messages.cacheError)
return false;
const hashUrls = yield this.hashUrls(hash);
if (!hashUrls || !hashUrls.get) {
if (environment_1.VERBOSE_LOGGING) {
output.note({ title: `Nx Cloud: Cache miss ${hash}.` });
}
this.runContext.statuses[hash] = 'cache-miss';
return false;
}
try {
yield this.fileStorage.retrieve(hash, hashUrls.get, cacheDirectory);
this.runContext.statuses[hash] = 'remote-cache-hit';
return true;
}
catch (ee) {
const e = (_a = ee.axiosException) !== null && _a !== void 0 ? _a : ee;
if (e.response && e.response.status === 404) {
if (environment_1.VERBOSE_LOGGING) {
output.note({ title: `Nx Cloud: Cache miss ${hash}. Status 404.` });
}
// cache miss. print nothing
}
else {
this.messages.cacheError = this.messages.extractErrorMessage(e, 'storage');
}
this.runContext.statuses[hash] = 'cache-miss';
return false;
}
});
}
store(hash, cacheDirectory) {
return __awaiter(this, void 0, void 0, function* () {
if (this.messages.cacheError)
return false;
const res = Promise.resolve().then(() => __awaiter(this, void 0, void 0, function* () {
var _a;
const hashUrls = yield this.hashUrls(hash);
if (!hashUrls)
return false;
if (!hashUrls.put) {
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: `Nx Cloud: Skipping storing ${hash}. Read only token is used.`,
});
}
return true;
}
try {
yield this.fileStorage.store(hash, hashUrls.put, cacheDirectory);
return true;
}
catch (ee) {
const e = (_a = ee.axiosException) !== null && _a !== void 0 ? _a : ee;
this.messages.cacheError = this.messages.extractErrorMessage(e, 'storage');
return false;
}
}));
this.storeRequests.push(res);
return res;
});
}
hashUrls(hash) {
return __awaiter(this, void 0, void 0, function* () {
if (hash in this.runContext.requests) {
return (yield this.runContext.requests[hash])[hash];
}
else {
const scheduledTaskHashesWithoutRequests = this.runContext.scheduledTasks
.filter((t) => !this.runContext.requests[t.hash])
.map((t) => t.hash);
if (scheduledTaskHashesWithoutRequests.indexOf(hash) === -1) {
scheduledTaskHashesWithoutRequests.push(hash);
}
const request = this.api.startRun(environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID, scheduledTaskHashesWithoutRequests);
scheduledTaskHashesWithoutRequests.forEach((taskHash) => {
this.runContext.requests[taskHash] = request;
});
return (yield request)[hash];
}
});
}
waitForStoreRequestsToComplete() {
return Promise.all(this.storeRequests).then((r) => r.reduce((a, b) => a && b, true));
}
}
exports.CloudRemoteCache = CloudRemoteCache;
//# sourceMappingURL=cloud-remote-cache.js.map
const a2_0x51e4=['response','apply','put','fileStorage','hashUrls','Nx\x20Cloud:\x20Skipping\x20storing\x20','all','VERBOSE_LOGGING','storeRequests','messages','indexOf','map','then','resolve','CloudRemoteCache','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','value','scheduledTasks','remote-cache-hit','note','statuses','reduce','.\x20Read\x20only\x20token\x20is\x20used.','filter','startRun','push','hash','axiosException','Nx\x20Cloud:\x20Cache\x20miss\x20','store','runContext','retrieve','status','extractErrorMessage','cacheError','requests','done','storage','cache-miss','waitForStoreRequestsToComplete','throw','__awaiter','../../../utilities/nx-imports','next','get','api','../../../utilities/environment'];(function(_0xd99f7f,_0x51e41f){const _0x254378=function(_0x45cf18){while(--_0x45cf18){_0xd99f7f['push'](_0xd99f7f['shift']());}};_0x254378(++_0x51e41f);}(a2_0x51e4,0x9d));const a2_0x2543=function(_0xd99f7f,_0x51e41f){_0xd99f7f=_0xd99f7f-0x0;let _0x254378=a2_0x51e4[_0xd99f7f];return _0x254378;};'use strict';var __awaiter=this&&this[a2_0x2543('0x19')]||function(_0x2aa292,_0x3e1af0,_0x22307f,_0x50d05a){function _0x4a039c(_0x1d57f1){return _0x1d57f1 instanceof _0x22307f?_0x1d57f1:new _0x22307f(function(_0x479a0a){_0x479a0a(_0x1d57f1);});}return new(_0x22307f||(_0x22307f=Promise))(function(_0x57793f,_0x5a2857){function _0x1f7935(_0x202aa3){try{_0x11440b(_0x50d05a[a2_0x2543('0x1b')](_0x202aa3));}catch(_0x3866ae){_0x5a2857(_0x3866ae);}}function _0xc581a4(_0x5d32a1){try{_0x11440b(_0x50d05a[a2_0x2543('0x18')](_0x5d32a1));}catch(_0x4fd4ff){_0x5a2857(_0x4fd4ff);}}function _0x11440b(_0x1c400c){_0x1c400c[a2_0x2543('0x14')]?_0x57793f(_0x1c400c[a2_0x2543('0x0')]):_0x4a039c(_0x1c400c[a2_0x2543('0x0')])[a2_0x2543('0x2b')](_0x1f7935,_0xc581a4);}_0x11440b((_0x50d05a=_0x50d05a[a2_0x2543('0x20')](_0x2aa292,_0x3e1af0||[]))[a2_0x2543('0x1b')]());});};Object['defineProperty'](exports,'__esModule',{'value':!![]});exports[a2_0x2543('0x2d')]=void 0x0;const environment_1=require(a2_0x2543('0x1e'));const {output}=require(a2_0x2543('0x1a'));class CloudRemoteCache{constructor(_0x42ecdf,_0x414663,_0x31ed3e,_0x576338){this[a2_0x2543('0x28')]=_0x42ecdf;this[a2_0x2543('0x1d')]=_0x414663;this[a2_0x2543('0xe')]=_0x31ed3e;this[a2_0x2543('0x22')]=_0x576338;this['storeRequests']=[];}[a2_0x2543('0xf')](_0x1caa30,_0x2e5b06){var _0x47ba79;return __awaiter(this,void 0x0,void 0x0,function*(){if(this['messages']['cacheError'])return![];const _0x434b58=yield this[a2_0x2543('0x23')](_0x1caa30);if(!_0x434b58||!_0x434b58[a2_0x2543('0x1c')]){if(environment_1[a2_0x2543('0x26')]){output[a2_0x2543('0x3')]({'title':a2_0x2543('0xc')+_0x1caa30+'.'});}this[a2_0x2543('0xe')][a2_0x2543('0x4')][_0x1caa30]=a2_0x2543('0x16');return![];}try{yield this['fileStorage'][a2_0x2543('0xf')](_0x1caa30,_0x434b58[a2_0x2543('0x1c')],_0x2e5b06);this['runContext'][a2_0x2543('0x4')][_0x1caa30]=a2_0x2543('0x2');return!![];}catch(_0x5bd6b1){const _0x2adbc3=(_0x47ba79=_0x5bd6b1[a2_0x2543('0xb')])!==null&&_0x47ba79!==void 0x0?_0x47ba79:_0x5bd6b1;if(_0x2adbc3[a2_0x2543('0x1f')]&&_0x2adbc3['response'][a2_0x2543('0x10')]===0x194){if(environment_1[a2_0x2543('0x26')]){output[a2_0x2543('0x3')]({'title':a2_0x2543('0xc')+_0x1caa30+'.\x20Status\x20404.'});}}else{this['messages'][a2_0x2543('0x12')]=this['messages'][a2_0x2543('0x11')](_0x2adbc3,a2_0x2543('0x15'));}this[a2_0x2543('0xe')][a2_0x2543('0x4')][_0x1caa30]='cache-miss';return![];}});}[a2_0x2543('0xd')](_0x2778d9,_0x16e4a3){return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a2_0x2543('0x28')]['cacheError'])return![];const _0x5251ed=Promise[a2_0x2543('0x2c')]()[a2_0x2543('0x2b')](()=>__awaiter(this,void 0x0,void 0x0,function*(){var _0xa3141c;const _0x499e1f=yield this['hashUrls'](_0x2778d9);if(!_0x499e1f)return![];if(!_0x499e1f[a2_0x2543('0x21')]){if(environment_1[a2_0x2543('0x26')]){output[a2_0x2543('0x3')]({'title':a2_0x2543('0x24')+_0x2778d9+a2_0x2543('0x6')});}return!![];}try{yield this[a2_0x2543('0x22')]['store'](_0x2778d9,_0x499e1f[a2_0x2543('0x21')],_0x16e4a3);return!![];}catch(_0x2c2de3){const _0x2c6f3f=(_0xa3141c=_0x2c2de3[a2_0x2543('0xb')])!==null&&_0xa3141c!==void 0x0?_0xa3141c:_0x2c2de3;this[a2_0x2543('0x28')][a2_0x2543('0x12')]=this[a2_0x2543('0x28')]['extractErrorMessage'](_0x2c6f3f,a2_0x2543('0x15'));return![];}}));this['storeRequests'][a2_0x2543('0x9')](_0x5251ed);return _0x5251ed;});}['hashUrls'](_0x274ba2){return __awaiter(this,void 0x0,void 0x0,function*(){if(_0x274ba2 in this['runContext'][a2_0x2543('0x13')]){return(yield this[a2_0x2543('0xe')][a2_0x2543('0x13')][_0x274ba2])[_0x274ba2];}else{const _0x38acd7=this[a2_0x2543('0xe')][a2_0x2543('0x1')][a2_0x2543('0x7')](_0x151889=>!this['runContext']['requests'][_0x151889['hash']])[a2_0x2543('0x2a')](_0x217186=>_0x217186[a2_0x2543('0xa')]);if(_0x38acd7[a2_0x2543('0x29')](_0x274ba2)===-0x1){_0x38acd7['push'](_0x274ba2);}const _0x1ceddc=this[a2_0x2543('0x1d')][a2_0x2543('0x8')](environment_1[a2_0x2543('0x2e')],_0x38acd7);_0x38acd7['forEach'](_0x48afb2=>{this[a2_0x2543('0xe')]['requests'][_0x48afb2]=_0x1ceddc;});return(yield _0x1ceddc)[_0x274ba2];}});}[a2_0x2543('0x17')](){return Promise[a2_0x2543('0x25')](this[a2_0x2543('0x27')])[a2_0x2543('0x2b')](_0x4422d8=>_0x4422d8[a2_0x2543('0x5')]((_0x32ab9f,_0x37960b)=>_0x32ab9f&&_0x37960b,!![]));}}exports[a2_0x2543('0x2d')]=CloudRemoteCache;

@@ -1,158 +0,1 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloudRunApi = void 0;
const axios_1 = require("../../../utilities/axios");
const environment_1 = require("../../../utilities/environment");
const fs_1 = require("fs");
const zlib_1 = require("zlib");
const util_1 = require("util");
const metric_logger_1 = require("../../../utilities/metric-logger");
const { output } = require('../../../utilities/nx-imports');
class CloudRunApi {
constructor(messages, runContext, options, machineInfo) {
this.messages = messages;
this.runContext = runContext;
this.machineInfo = machineInfo;
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
}
startRun(distributedExecutionId, hashes) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const recorder = (0, metric_logger_1.createMetricRecorder)('startRun');
try {
const request = {
meta: {
nxCloudVersion: this.nxCloudVersion(),
},
branch: (0, environment_1.getBranch)(),
runGroup: (0, environment_1.getRunGroup)(),
distributedExecutionId,
hashes,
};
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'RunStart',
bodyLines: ['\n' + JSON.stringify(request, null, 2)],
});
}
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/runs/start', request));
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
if (resp.data && resp.data.message) {
this.messages.message = resp.data.message;
}
if (!resp.data || !resp.data.urls) {
this.messages.apiError = `Invalid Nx Cloud response: ${JSON.stringify(resp.data)}`;
return {};
}
return resp.data.urls;
}
catch (e) {
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
this.messages.apiError = this.messages.extractErrorMessage(e, 'api');
return {};
}
});
}
endRun(run, tasks) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
// API is not working, don't make the end request
if (this.messages.apiError)
return false;
const uncompressedReqBody = {
meta: {
nxCloudVersion: this.nxCloudVersion(),
},
tasks,
run: run,
machineInfo: this.machineInfo,
};
const uncompressedBuffer = Buffer.from(JSON.stringify(uncompressedReqBody));
const compressedBuffer = yield (0, util_1.promisify)(zlib_1.gzip)(uncompressedBuffer);
const recorder = (0, metric_logger_1.createMetricRecorder)('endRun');
try {
if (environment_1.VERBOSE_LOGGING) {
const t = tasks.map((tt) => {
return Object.assign(Object.assign({}, tt), { terminalOutput: tt.terminalOutput
? `${tt.terminalOutput.slice(0, 20)}...`
: undefined });
});
output.note({
title: 'RunEnd. Completed tasks',
bodyLines: ['\n' + JSON.stringify(t, null, 2)],
});
}
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/runs/end', compressedBuffer, {
headers: Object.assign(Object.assign({}, this.apiAxiosInstance.defaults.headers), { 'Content-Encoding': 'gzip', 'Content-Type': 'application/octet-stream' }),
}));
if (resp) {
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
if (resp.data && resp.data.runUrl && resp.data.status === 'success') {
this.runContext.runUrl = resp.data.runUrl;
return true;
}
if (resp.data && resp.data.status) {
this.messages.apiError = `Invalid end run response: ${JSON.stringify(resp.data.message)}`;
}
else if (resp.data && typeof resp.data === 'string') {
if (resp.data !== 'success') {
this.messages.apiError = `Invalid end run response: ${JSON.stringify(resp.data)}`;
}
}
else {
this.messages.apiError = `Invalid end run response: ${JSON.stringify(resp.data)}`;
}
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'Invalid end run response',
bodyLines: [JSON.stringify(resp.data, null, 2)],
});
}
}
else {
output.error({
title: 'Nx Cloud: Unknown Error Occurred',
bodyLines: [
'Run completion responded with `undefined`.',
'Run Details:',
JSON.stringify(run, null, 2),
'Stack Trace:',
JSON.stringify(new Error().stack, null, 2),
],
});
}
return false;
}
catch (ee) {
recorder.recordMetric(((_a = ee === null || ee === void 0 ? void 0 : ee.axiosException) === null || _a === void 0 ? void 0 : _a.response)
? (0, metric_logger_1.mapRespToPerfEntry)(ee.axiosException.response)
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
const e = (_b = ee.axiosException) !== null && _b !== void 0 ? _b : ee;
this.messages.apiError = this.messages.extractErrorMessage(e, 'api');
return false;
}
});
}
nxCloudVersion() {
try {
const v = JSON.parse((0, fs_1.readFileSync)(`package.json`).toString());
return v.devDependencies['@nrwl/nx-cloud'];
}
catch (e) {
return 'unknown';
}
}
}
exports.CloudRunApi = CloudRunApi;
//# sourceMappingURL=cloud-run.api.js.map
const a3_0xe9ef=['createMetricRecorder','apiAxiosInstance','data','note','next','/nx-cloud/runs/end','createApiAxiosInstance','done','Invalid\x20end\x20run\x20response','mapRespToPerfEntry','stringify','axiosException','../../../utilities/nx-imports','map','assign','status','urls','slice','../../../utilities/metric-logger','nxCloudVersion','promisify','readFileSync','endRun','messages','startRun','/nx-cloud/runs/start','message','success','apply','RUNNER_FAILURE_PERF_ENTRY','defaults','machineInfo','getRunGroup','terminalOutput','post','runUrl','VERBOSE_LOGGING','Invalid\x20end\x20run\x20response:\x20','apiError','gzip','defineProperty','util','runContext','extractErrorMessage','error','stack','RunStart','recordMetric','Run\x20Details:','...','../../../utilities/axios','CloudRunApi','Invalid\x20Nx\x20Cloud\x20response:\x20','value','unknown','Stack\x20Trace:','from','axiosMultipleTries','api','devDependencies','headers','response'];(function(_0x5911ba,_0xe9ef2){const _0x14dd70=function(_0x531fb1){while(--_0x531fb1){_0x5911ba['push'](_0x5911ba['shift']());}};_0x14dd70(++_0xe9ef2);}(a3_0xe9ef,0x1da));const a3_0x14dd=function(_0x5911ba,_0xe9ef2){_0x5911ba=_0x5911ba-0x0;let _0x14dd70=a3_0xe9ef[_0x5911ba];return _0x14dd70;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x4e28fa,_0x609af0,_0xb28bf1,_0x23400f){function _0x4261d9(_0x5804ab){return _0x5804ab instanceof _0xb28bf1?_0x5804ab:new _0xb28bf1(function(_0x4109d9){_0x4109d9(_0x5804ab);});}return new(_0xb28bf1||(_0xb28bf1=Promise))(function(_0x2a971c,_0xb312ad){function _0x5afe29(_0x56545b){try{_0x72da2a(_0x23400f[a3_0x14dd('0x1a')](_0x56545b));}catch(_0x4bdedc){_0xb312ad(_0x4bdedc);}}function _0x5a21e7(_0x1c1cae){try{_0x72da2a(_0x23400f['throw'](_0x1c1cae));}catch(_0x46119d){_0xb312ad(_0x46119d);}}function _0x72da2a(_0x2bd9aa){_0x2bd9aa[a3_0x14dd('0x1d')]?_0x2a971c(_0x2bd9aa['value']):_0x4261d9(_0x2bd9aa[a3_0x14dd('0xd')])['then'](_0x5afe29,_0x5a21e7);}_0x72da2a((_0x23400f=_0x23400f[a3_0x14dd('0x32')](_0x4e28fa,_0x609af0||[]))[a3_0x14dd('0x1a')]());});};Object[a3_0x14dd('0x0')](exports,'__esModule',{'value':!![]});exports[a3_0x14dd('0xb')]=void 0x0;const axios_1=require(a3_0x14dd('0xa'));const environment_1=require('../../../utilities/environment');const fs_1=require('fs');const zlib_1=require('zlib');const util_1=require(a3_0x14dd('0x1'));const metric_logger_1=require(a3_0x14dd('0x28'));const {output}=require(a3_0x14dd('0x22'));class CloudRunApi{constructor(_0x215ac6,_0x3483ed,_0x46288f,_0x531cb3){this[a3_0x14dd('0x2d')]=_0x215ac6;this[a3_0x14dd('0x2')]=_0x3483ed;this[a3_0x14dd('0x35')]=_0x531cb3;this[a3_0x14dd('0x17')]=(0x0,axios_1[a3_0x14dd('0x1c')])(_0x46288f);}['startRun'](_0x17a951,_0x3e19c8){var _0x53e8fd;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x36bc25=(0x0,metric_logger_1['createMetricRecorder'])(a3_0x14dd('0x2e'));try{const _0x34ae38={'meta':{'nxCloudVersion':this[a3_0x14dd('0x29')]()},'branch':(0x0,environment_1['getBranch'])(),'runGroup':(0x0,environment_1[a3_0x14dd('0x36')])(),'distributedExecutionId':_0x17a951,'hashes':_0x3e19c8};if(environment_1[a3_0x14dd('0x3a')]){output['note']({'title':a3_0x14dd('0x6'),'bodyLines':['\x0a'+JSON[a3_0x14dd('0x20')](_0x34ae38,null,0x2)]});}const _0x1e64c7=yield(0x0,axios_1[a3_0x14dd('0x11')])(()=>this[a3_0x14dd('0x17')]['post'](a3_0x14dd('0x2f'),_0x34ae38));_0x36bc25[a3_0x14dd('0x7')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x1e64c7));if(_0x1e64c7['data']&&_0x1e64c7['data'][a3_0x14dd('0x30')]){this[a3_0x14dd('0x2d')][a3_0x14dd('0x30')]=_0x1e64c7['data'][a3_0x14dd('0x30')];}if(!_0x1e64c7[a3_0x14dd('0x18')]||!_0x1e64c7[a3_0x14dd('0x18')][a3_0x14dd('0x26')]){this[a3_0x14dd('0x2d')][a3_0x14dd('0x3c')]=a3_0x14dd('0xc')+JSON['stringify'](_0x1e64c7[a3_0x14dd('0x18')]);return{};}return _0x1e64c7['data'][a3_0x14dd('0x26')];}catch(_0x5009d0){_0x36bc25['recordMetric'](((_0x53e8fd=_0x5009d0===null||_0x5009d0===void 0x0?void 0x0:_0x5009d0['axiosException'])===null||_0x53e8fd===void 0x0?void 0x0:_0x53e8fd['response'])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x5009d0[a3_0x14dd('0x21')][a3_0x14dd('0x15')]):metric_logger_1[a3_0x14dd('0x33')]);this[a3_0x14dd('0x2d')][a3_0x14dd('0x3c')]=this[a3_0x14dd('0x2d')][a3_0x14dd('0x3')](_0x5009d0,a3_0x14dd('0x12'));return{};}});}[a3_0x14dd('0x2c')](_0x50f22a,_0x964afb){var _0x50c3ab,_0x1fe976;return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a3_0x14dd('0x2d')]['apiError'])return![];const _0x14d2db={'meta':{'nxCloudVersion':this[a3_0x14dd('0x29')]()},'tasks':_0x964afb,'run':_0x50f22a,'machineInfo':this[a3_0x14dd('0x35')]};const _0x170877=Buffer[a3_0x14dd('0x10')](JSON[a3_0x14dd('0x20')](_0x14d2db));const _0x2047ad=yield(0x0,util_1[a3_0x14dd('0x2a')])(zlib_1[a3_0x14dd('0x3d')])(_0x170877);const _0x1bc741=(0x0,metric_logger_1[a3_0x14dd('0x16')])(a3_0x14dd('0x2c'));try{if(environment_1['VERBOSE_LOGGING']){const _0x2f5658=_0x964afb[a3_0x14dd('0x23')](_0x301856=>{return Object['assign'](Object[a3_0x14dd('0x24')]({},_0x301856),{'terminalOutput':_0x301856[a3_0x14dd('0x37')]?_0x301856[a3_0x14dd('0x37')][a3_0x14dd('0x27')](0x0,0x14)+a3_0x14dd('0x9'):undefined});});output[a3_0x14dd('0x19')]({'title':'RunEnd.\x20Completed\x20tasks','bodyLines':['\x0a'+JSON[a3_0x14dd('0x20')](_0x2f5658,null,0x2)]});}const _0x386974=yield(0x0,axios_1['axiosMultipleTries'])(()=>this['apiAxiosInstance'][a3_0x14dd('0x38')](a3_0x14dd('0x1b'),_0x2047ad,{'headers':Object[a3_0x14dd('0x24')](Object[a3_0x14dd('0x24')]({},this['apiAxiosInstance'][a3_0x14dd('0x34')][a3_0x14dd('0x14')]),{'Content-Encoding':'gzip','Content-Type':'application/octet-stream'})}));if(_0x386974){_0x1bc741['recordMetric']((0x0,metric_logger_1[a3_0x14dd('0x1f')])(_0x386974));if(_0x386974['data']&&_0x386974[a3_0x14dd('0x18')][a3_0x14dd('0x39')]&&_0x386974[a3_0x14dd('0x18')][a3_0x14dd('0x25')]===a3_0x14dd('0x31')){this[a3_0x14dd('0x2')][a3_0x14dd('0x39')]=_0x386974[a3_0x14dd('0x18')]['runUrl'];return!![];}if(_0x386974[a3_0x14dd('0x18')]&&_0x386974[a3_0x14dd('0x18')][a3_0x14dd('0x25')]){this[a3_0x14dd('0x2d')][a3_0x14dd('0x3c')]=a3_0x14dd('0x3b')+JSON[a3_0x14dd('0x20')](_0x386974['data'][a3_0x14dd('0x30')]);}else if(_0x386974[a3_0x14dd('0x18')]&&typeof _0x386974['data']==='string'){if(_0x386974[a3_0x14dd('0x18')]!=='success'){this['messages'][a3_0x14dd('0x3c')]=a3_0x14dd('0x3b')+JSON['stringify'](_0x386974['data']);}}else{this[a3_0x14dd('0x2d')][a3_0x14dd('0x3c')]=a3_0x14dd('0x3b')+JSON[a3_0x14dd('0x20')](_0x386974[a3_0x14dd('0x18')]);}if(environment_1[a3_0x14dd('0x3a')]){output['note']({'title':a3_0x14dd('0x1e'),'bodyLines':[JSON['stringify'](_0x386974['data'],null,0x2)]});}}else{output[a3_0x14dd('0x4')]({'title':'Nx\x20Cloud:\x20Unknown\x20Error\x20Occurred','bodyLines':['Run\x20completion\x20responded\x20with\x20`undefined`.',a3_0x14dd('0x8'),JSON[a3_0x14dd('0x20')](_0x50f22a,null,0x2),a3_0x14dd('0xf'),JSON[a3_0x14dd('0x20')](new Error()[a3_0x14dd('0x5')],null,0x2)]});}return![];}catch(_0x45b471){_0x1bc741['recordMetric'](((_0x50c3ab=_0x45b471===null||_0x45b471===void 0x0?void 0x0:_0x45b471['axiosException'])===null||_0x50c3ab===void 0x0?void 0x0:_0x50c3ab[a3_0x14dd('0x15')])?(0x0,metric_logger_1[a3_0x14dd('0x1f')])(_0x45b471[a3_0x14dd('0x21')]['response']):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);const _0x84c3fe=(_0x1fe976=_0x45b471[a3_0x14dd('0x21')])!==null&&_0x1fe976!==void 0x0?_0x1fe976:_0x45b471;this[a3_0x14dd('0x2d')][a3_0x14dd('0x3c')]=this[a3_0x14dd('0x2d')]['extractErrorMessage'](_0x84c3fe,a3_0x14dd('0x12'));return![];}});}['nxCloudVersion'](){try{const _0x16a4cc=JSON['parse']((0x0,fs_1[a3_0x14dd('0x2b')])('package.json')['toString']());return _0x16a4cc[a3_0x14dd('0x13')]['@nrwl/nx-cloud'];}catch(_0x521641){return a3_0x14dd('0xe');}}}exports[a3_0x14dd('0xb')]=CloudRunApi;

@@ -1,79 +0,1 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DistributedAgentApi = void 0;
const axios_1 = require("../../../utilities/axios");
const environment_1 = require("../../../utilities/environment");
const metric_logger_1 = require("../../../utilities/metric-logger");
const { output } = require('../../../utilities/nx-imports');
class DistributedAgentApi {
constructor(options, runGroup, agentName) {
this.runGroup = runGroup;
this.agentName = agentName;
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
}
tasks(executionId, statusCode, completedTasks) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const recorder = (0, metric_logger_1.createMetricRecorder)('dtePollTasks');
try {
const res = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/tasks', {
runGroup: this.runGroup,
agentName: this.agentName,
executionId,
statusCode,
completedTasks,
}));
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(res));
return res.data;
}
catch (e) {
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
throw e;
}
});
}
completeRunGroupWithError(error) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'Completing run group with an error',
bodyLines: [`runGroup: ${this.runGroup}`, `error: ${error}`],
});
}
const recorder = (0, metric_logger_1.createMetricRecorder)('completeRunGroup');
try {
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
runGroup: this.runGroup,
agentName: this.agentName,
criticalErrorMessage: error,
}));
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'Completed run group with an error',
});
}
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
}
catch (e) {
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
console.error(e);
}
});
}
}
exports.DistributedAgentApi = DistributedAgentApi;
//# sourceMappingURL=distributed-agent.api.js.map
const a4_0x3032=['next','recordMetric','/nx-cloud/executions/complete-run-group','createApiAxiosInstance','VERBOSE_LOGGING','runGroup:\x20','../../../utilities/metric-logger','error','response','runGroup','../../../utilities/nx-imports','value','DistributedAgentApi','data','done','apply','note','axiosException','agentName','apiAxiosInstance','../../../utilities/axios','axiosMultipleTries','tasks','RUNNER_FAILURE_PERF_ENTRY','mapRespToPerfEntry','completeRunGroupWithError','createMetricRecorder','Completed\x20run\x20group\x20with\x20an\x20error','throw','../../../utilities/environment','post','defineProperty'];(function(_0x2f6054,_0x303267){const _0x575f1c=function(_0x5402c2){while(--_0x5402c2){_0x2f6054['push'](_0x2f6054['shift']());}};_0x575f1c(++_0x303267);}(a4_0x3032,0x12b));const a4_0x575f=function(_0x2f6054,_0x303267){_0x2f6054=_0x2f6054-0x0;let _0x575f1c=a4_0x3032[_0x2f6054];return _0x575f1c;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x14401c,_0x12fcbd,_0x281143,_0x588e68){function _0xb0761(_0x103972){return _0x103972 instanceof _0x281143?_0x103972:new _0x281143(function(_0x2ad5a2){_0x2ad5a2(_0x103972);});}return new(_0x281143||(_0x281143=Promise))(function(_0x4643a3,_0x5d5e4f){function _0x5db142(_0x6db2b7){try{_0x1c8e74(_0x588e68[a4_0x575f('0x15')](_0x6db2b7));}catch(_0xd00be9){_0x5d5e4f(_0xd00be9);}}function _0x5523b9(_0x500785){try{_0x1c8e74(_0x588e68[a4_0x575f('0x11')](_0x500785));}catch(_0x46f55d){_0x5d5e4f(_0x46f55d);}}function _0x1c8e74(_0x5a9442){_0x5a9442[a4_0x575f('0x3')]?_0x4643a3(_0x5a9442[a4_0x575f('0x0')]):_0xb0761(_0x5a9442[a4_0x575f('0x0')])['then'](_0x5db142,_0x5523b9);}_0x1c8e74((_0x588e68=_0x588e68[a4_0x575f('0x4')](_0x14401c,_0x12fcbd||[]))[a4_0x575f('0x15')]());});};Object[a4_0x575f('0x14')](exports,'__esModule',{'value':!![]});exports[a4_0x575f('0x1')]=void 0x0;const axios_1=require(a4_0x575f('0x9'));const environment_1=require(a4_0x575f('0x12'));const metric_logger_1=require(a4_0x575f('0x1b'));const {output}=require(a4_0x575f('0x1f'));class DistributedAgentApi{constructor(_0x498666,_0x3ed67d,_0x234699){this['runGroup']=_0x3ed67d;this[a4_0x575f('0x7')]=_0x234699;this[a4_0x575f('0x8')]=(0x0,axios_1[a4_0x575f('0x18')])(_0x498666);}[a4_0x575f('0xb')](_0x49381b,_0x214741,_0x49a6ed){var _0x41e501;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x419cd1=(0x0,metric_logger_1[a4_0x575f('0xf')])('dtePollTasks');try{const _0x224d27=yield(0x0,axios_1[a4_0x575f('0xa')])(()=>this[a4_0x575f('0x8')][a4_0x575f('0x13')]('/nx-cloud/executions/tasks',{'runGroup':this[a4_0x575f('0x1e')],'agentName':this[a4_0x575f('0x7')],'executionId':_0x49381b,'statusCode':_0x214741,'completedTasks':_0x49a6ed}));_0x419cd1[a4_0x575f('0x16')]((0x0,metric_logger_1[a4_0x575f('0xd')])(_0x224d27));return _0x224d27[a4_0x575f('0x2')];}catch(_0x2371eb){_0x419cd1['recordMetric'](((_0x41e501=_0x2371eb===null||_0x2371eb===void 0x0?void 0x0:_0x2371eb[a4_0x575f('0x6')])===null||_0x41e501===void 0x0?void 0x0:_0x41e501[a4_0x575f('0x1d')])?(0x0,metric_logger_1[a4_0x575f('0xd')])(_0x2371eb[a4_0x575f('0x6')]['response']):metric_logger_1[a4_0x575f('0xc')]);throw _0x2371eb;}});}[a4_0x575f('0xe')](_0x23ff42){var _0x8afb54;return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1[a4_0x575f('0x19')]){output[a4_0x575f('0x5')]({'title':'Completing\x20run\x20group\x20with\x20an\x20error','bodyLines':[a4_0x575f('0x1a')+this[a4_0x575f('0x1e')],'error:\x20'+_0x23ff42]});}const _0x53d21b=(0x0,metric_logger_1[a4_0x575f('0xf')])('completeRunGroup');try{const _0x224ec2=yield(0x0,axios_1['axiosMultipleTries'])(()=>this[a4_0x575f('0x8')]['post'](a4_0x575f('0x17'),{'runGroup':this[a4_0x575f('0x1e')],'agentName':this['agentName'],'criticalErrorMessage':_0x23ff42}));if(environment_1[a4_0x575f('0x19')]){output[a4_0x575f('0x5')]({'title':a4_0x575f('0x10')});}_0x53d21b[a4_0x575f('0x16')]((0x0,metric_logger_1[a4_0x575f('0xd')])(_0x224ec2));}catch(_0x2e9745){_0x53d21b[a4_0x575f('0x16')](((_0x8afb54=_0x2e9745===null||_0x2e9745===void 0x0?void 0x0:_0x2e9745[a4_0x575f('0x6')])===null||_0x8afb54===void 0x0?void 0x0:_0x8afb54['response'])?(0x0,metric_logger_1[a4_0x575f('0xd')])(_0x2e9745[a4_0x575f('0x6')][a4_0x575f('0x1d')]):metric_logger_1[a4_0x575f('0xc')]);console[a4_0x575f('0x1c')](_0x2e9745);}});}}exports['DistributedAgentApi']=DistributedAgentApi;

@@ -1,239 +0,1 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.startAgent = void 0;
const child_process_1 = require("child_process");
const stripJsonComments = require("strip-json-comments");
const distributed_agent_api_1 = require("./distributed-agent.api");
const waiter_1 = require("../../../utilities/waiter");
const environment_1 = require("../../../utilities/environment");
const print_run_group_error_1 = require("../../error/print-run-group-error");
const create_no_new_messages_timeout_1 = require("../../../utilities/create-no-new-messages-timeout");
const fs_1 = require("fs");
const metric_logger_1 = require("../../../utilities/metric-logger");
const { output } = require('../../../utilities/nx-imports');
function executeTasks(options, api) {
return __awaiter(this, void 0, void 0, function* () {
let completedStatusCode = 0;
let apiResponse = null;
const failIfSameTasksIn30Mins = (0, create_no_new_messages_timeout_1.createNoNewMessagesTimeout)();
const waiter = new waiter_1.Waiter();
let completedTasks = [];
const startTime = new Date();
let executedAnyTasks = false;
while (true) {
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'Fetching tasks...',
});
}
apiResponse = yield api.tasks(apiResponse ? apiResponse.executionId : null, completedStatusCode, completedTasks);
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'API Response',
bodyLines: [
`completed: ${apiResponse.completed}`,
`retryDuring: ${apiResponse.retryDuring}`,
`executionId: ${apiResponse.executionId}`,
`number of tasks: ${apiResponse.tasks.length}`,
`error: ${apiResponse.criticalErrorMessage}`,
`maxParallel: ${apiResponse.maxParallel}`,
],
});
}
if (apiResponse.criticalErrorMessage) {
output.error({
title: 'Distributed Execution Terminated',
bodyLines: ['Error:', apiResponse.criticalErrorMessage],
});
process.exit(0);
}
// run group is completed but it might be a rerun
// we will try several times before going further and
// completed the response
// we only do it if we haven't executed any tasks
if ((apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse.retryDuring) &&
(apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse.retryDuring) !== 0 &&
!executedAnyTasks &&
new Date().getTime() - startTime.getTime() > apiResponse.retryDuring) {
yield waiter.wait();
continue;
}
if (apiResponse.completed)
return;
failIfSameTasksIn30Mins(apiResponse.tasks.map((t) => t.taskId).join(''));
if (!apiResponse.executionId) {
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'Waiting...',
});
}
yield waiter.wait();
completedStatusCode = 0;
completedTasks = [];
continue;
}
waiter.reset();
executedAnyTasks = true;
const r = invokeTasksUsingRunMany(options, apiResponse.executionId, apiResponse.tasks, apiResponse.maxParallel);
completedStatusCode = r.completedStatusCode;
completedTasks = r.completedTasks;
}
});
}
function readCompletedTasks(options, distributedExecutionId) {
const errorMessage = `Command execution failed (distributed task execution: ${distributedExecutionId}). Tasks hashes haven\'t been recorded.`;
let completedTasks;
try {
const cacheDirectory = options.cacheDirectory || './node_modules/.cache/nx';
const taskHashesFile = `${cacheDirectory}/tasks-hashes-${distributedExecutionId}`;
completedTasks = JSON.parse((0, fs_1.readFileSync)(taskHashesFile).toString());
// remove it such that if the next command crashes we don't read an obsolete file
(0, fs_1.unlinkSync)(taskHashesFile);
}
catch (e) {
throw new Error(errorMessage);
}
if (completedTasks.length == 0) {
throw new Error(errorMessage);
}
return completedTasks;
}
function invokeTasksUsingRunMany(options, executionId, tasks, maxParallel) {
let completedStatusCode = 0;
const completedTasks = [];
for (const g of groupByTarget(tasks)) {
const config = g.configuration ? `--configuration=${g.configuration}` : ``;
const parallel = maxParallel > 1 ? ` --parallel --max-parallel=${maxParallel}` : ``;
// TODO use pnpx or yarn when needed
const command = `npx nx run-many --target=${g.target} ${config} --projects=${g.projects.join(',')} ${g.params}${parallel}`;
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: `Executing: '${command}'`,
});
}
try {
(0, child_process_1.execSync)(command, {
stdio: ['inherit', 'inherit', 'inherit'],
env: Object.assign(Object.assign({}, process.env), { NX_CACHE_FAILURES: 'true', NX_CLOUD_DISTRIBUTED_EXECUTION_ID: executionId }),
});
}
catch (e) {
if (e.status === environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE) {
throw e;
}
else {
completedStatusCode = 1;
}
}
finally {
completedTasks.push(...readCompletedTasks(options, executionId));
}
}
return { completedStatusCode, completedTasks };
}
function groupByTarget(tasks) {
const res = [];
tasks.forEach((t) => {
const r = res.find((rr) => rr.target === t.target && rr.configuration === t.configuration);
if (r) {
r.projects.push(t.projectName);
}
else {
res.push({
target: t.target,
projects: [t.projectName],
params: t.params,
configuration: t.configuration,
});
}
});
return res;
}
function getAgentName() {
if (process.env.NX_AGENT_NAME !== undefined) {
return process.env.NX_AGENT_NAME;
}
else if (process.env.CIRCLECI !== undefined) {
return process.env.CIRCLE_STAGE;
}
else {
return `Agent ${Math.floor(Math.random() * 100000)}`;
}
}
function createAgentLockfile(options, agentName) {
const cacheDirectory = options.cacheDirectory || './node_modules/.cache/nx';
const lockFileDirectory = `${cacheDirectory}/lockfiles`;
const lockFilePath = `${lockFileDirectory}/${agentName}.lock`;
if (!(0, fs_1.existsSync)(lockFileDirectory)) {
(0, fs_1.mkdirSync)(lockFileDirectory, { recursive: true });
}
// Check for other agents' lockfiles and warn if exist
const lockFiles = (0, fs_1.readdirSync)(lockFileDirectory);
if (lockFiles.length) {
// Check to make sure the current agent name is not in use (only 1/100000 ^ 2 chance of this)
if (lockFiles.includes(`${agentName}.lock`)) {
output.error({
title: 'Duplicate Agent ID Detected',
bodyLines: [
'We have detected another agent with this ID running in this workspace. This should not happen.',
'',
'End all currently running agents, run "npx nx-cloud clean-up-agents", and try again.',
],
});
process.exit(1);
}
output.warn({
title: 'Other Nx Cloud Agents Detected',
bodyLines: [
'We have detected other agents running in this workspace. This can cause unexpected behavior.',
'',
'This can also be a false positive caused by agents that did not shut down correctly.',
'If you believe this is the case, run "npx nx-cloud clean-up-agents".',
],
});
}
(0, fs_1.writeFileSync)(lockFilePath, '');
process.on('exit', () => cleanupAgentLockfile(lockFilePath));
process.on('SIGINT', () => cleanupAgentLockfile(lockFilePath));
}
function cleanupAgentLockfile(lockFilePath) {
if ((0, fs_1.existsSync)(lockFilePath)) {
(0, fs_1.unlinkSync)(lockFilePath);
}
}
function startAgent() {
return __awaiter(this, void 0, void 0, function* () {
const runGroup = (0, environment_1.getRunGroup)();
if (!runGroup) {
(0, print_run_group_error_1.printRunGroupError)();
return process.exit(1);
}
output.note({
title: 'Starting an agent for running Nx tasks',
});
const options = JSON.parse(stripJsonComments((0, fs_1.readFileSync)('nx.json').toString())).tasksRunnerOptions.default.options;
const agentName = getAgentName();
createAgentLockfile(options, agentName);
const api = new distributed_agent_api_1.DistributedAgentApi(options, runGroup, agentName);
return executeTasks(options, api)
.then((res) => __awaiter(this, void 0, void 0, function* () {
yield (0, metric_logger_1.submitRunMetrics)(options);
return res;
}))
.catch((e) => __awaiter(this, void 0, void 0, function* () {
yield api.completeRunGroupWithError(`Critical Error in Agent: "${e.message}"`);
throw e;
}));
});
}
exports.startAgent = startAgent;
//# sourceMappingURL=distributed-agent.impl.js.map
const a5_0x2a36=['completed:\x20','done','value','maxParallel','VERBOSE_LOGGING','includes','unlinkSync','startAgent','npx\x20nx\x20run-many\x20--target=','target','random','\x20--parallel\x20--max-parallel=','note','configuration','map','executionId','next','mkdirSync','cacheDirectory','assign','reset','Waiting...','floor','strip-json-comments','execSync','existsSync','number\x20of\x20tasks:\x20','NX_AGENT_NAME','./node_modules/.cache/nx','getTime','executionId:\x20','readdirSync','warn','--configuration=','Duplicate\x20Agent\x20ID\x20Detected','taskId','.lock','../../../utilities/environment','If\x20you\x20believe\x20this\x20is\x20the\x20case,\x20run\x20\x22npx\x20nx-cloud\x20clean-up-agents\x22.','readFileSync','submitRunMetrics','We\x20have\x20detected\x20other\x20agents\x20running\x20in\x20this\x20workspace.\x20This\x20can\x20cause\x20unexpected\x20behavior.','Distributed\x20Execution\x20Terminated','Fetching\x20tasks...','DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE','projects','env','exit','Waiter','catch','We\x20have\x20detected\x20another\x20agent\x20with\x20this\x20ID\x20running\x20in\x20this\x20workspace.\x20This\x20should\x20not\x20happen.','Critical\x20Error\x20in\x20Agent:\x20\x22','Agent\x20','../../../utilities/metric-logger','message','wait','SIGINT','length','This\x20can\x20also\x20be\x20a\x20false\x20positive\x20caused\x20by\x20agents\x20that\x20did\x20not\x20shut\x20down\x20correctly.','./distributed-agent.api','child_process','apply','tasks','inherit','Executing:\x20\x27','projectName','/tasks-hashes-','criticalErrorMessage','defineProperty','API\x20Response','writeFileSync','push','tasksRunnerOptions','then','completedStatusCode','nx.json','true','__awaiter','\x20--projects=','/lockfiles','retryDuring',').\x20Tasks\x20hashes\x20haven\x27t\x20been\x20recorded.','completedTasks','status'];(function(_0x138255,_0x2a3635){const _0x3d6cdf=function(_0x1e3da3){while(--_0x1e3da3){_0x138255['push'](_0x138255['shift']());}};_0x3d6cdf(++_0x2a3635);}(a5_0x2a36,0xb5));const a5_0x3d6c=function(_0x138255,_0x2a3635){_0x138255=_0x138255-0x0;let _0x3d6cdf=a5_0x2a36[_0x138255];return _0x3d6cdf;};'use strict';var __awaiter=this&&this[a5_0x3d6c('0x40')]||function(_0x32765b,_0x5bc795,_0x1f7a80,_0x4a0dd8){function _0x505fbc(_0x4580e5){return _0x4580e5 instanceof _0x1f7a80?_0x4580e5:new _0x1f7a80(function(_0x189000){_0x189000(_0x4580e5);});}return new(_0x1f7a80||(_0x1f7a80=Promise))(function(_0x5afc27,_0x4f1102){function _0x58b18b(_0x11b798){try{_0x52aab7(_0x4a0dd8[a5_0x3d6c('0x3')](_0x11b798));}catch(_0x2df098){_0x4f1102(_0x2df098);}}function _0x5d7c14(_0x364b4e){try{_0x52aab7(_0x4a0dd8['throw'](_0x364b4e));}catch(_0x21a916){_0x4f1102(_0x21a916);}}function _0x52aab7(_0x4210d4){_0x4210d4[a5_0x3d6c('0x48')]?_0x5afc27(_0x4210d4[a5_0x3d6c('0x49')]):_0x505fbc(_0x4210d4[a5_0x3d6c('0x49')])[a5_0x3d6c('0x3c')](_0x58b18b,_0x5d7c14);}_0x52aab7((_0x4a0dd8=_0x4a0dd8[a5_0x3d6c('0x30')](_0x32765b,_0x5bc795||[]))[a5_0x3d6c('0x3')]());});};Object[a5_0x3d6c('0x37')](exports,'__esModule',{'value':!![]});exports[a5_0x3d6c('0x4e')]=void 0x0;const child_process_1=require(a5_0x3d6c('0x2f'));const stripJsonComments=require(a5_0x3d6c('0xa'));const distributed_agent_api_1=require(a5_0x3d6c('0x2e'));const waiter_1=require('../../../utilities/waiter');const environment_1=require(a5_0x3d6c('0x18'));const print_run_group_error_1=require('../../error/print-run-group-error');const create_no_new_messages_timeout_1=require('../../../utilities/create-no-new-messages-timeout');const fs_1=require('fs');const metric_logger_1=require(a5_0x3d6c('0x28'));const {output}=require('../../../utilities/nx-imports');function executeTasks(_0x36bc1a,_0x3651eb){return __awaiter(this,void 0x0,void 0x0,function*(){let _0x5af26c=0x0;let _0x1f8698=null;const _0x6b89b6=(0x0,create_no_new_messages_timeout_1['createNoNewMessagesTimeout'])();const _0x34f2c8=new waiter_1[(a5_0x3d6c('0x23'))]();let _0x5a4691=[];const _0x595765=new Date();let _0x30c9b1=![];while(!![]){if(environment_1[a5_0x3d6c('0x4b')]){output[a5_0x3d6c('0x53')]({'title':a5_0x3d6c('0x1e')});}_0x1f8698=yield _0x3651eb['tasks'](_0x1f8698?_0x1f8698[a5_0x3d6c('0x2')]:null,_0x5af26c,_0x5a4691);if(environment_1['VERBOSE_LOGGING']){output[a5_0x3d6c('0x53')]({'title':a5_0x3d6c('0x38'),'bodyLines':[a5_0x3d6c('0x47')+_0x1f8698['completed'],'retryDuring:\x20'+_0x1f8698['retryDuring'],a5_0x3d6c('0x11')+_0x1f8698[a5_0x3d6c('0x2')],a5_0x3d6c('0xd')+_0x1f8698['tasks']['length'],'error:\x20'+_0x1f8698[a5_0x3d6c('0x36')],'maxParallel:\x20'+_0x1f8698[a5_0x3d6c('0x4a')]]});}if(_0x1f8698['criticalErrorMessage']){output['error']({'title':a5_0x3d6c('0x1d'),'bodyLines':['Error:',_0x1f8698[a5_0x3d6c('0x36')]]});process[a5_0x3d6c('0x22')](0x0);}if((_0x1f8698===null||_0x1f8698===void 0x0?void 0x0:_0x1f8698['retryDuring'])&&(_0x1f8698===null||_0x1f8698===void 0x0?void 0x0:_0x1f8698[a5_0x3d6c('0x43')])!==0x0&&!_0x30c9b1&&new Date()[a5_0x3d6c('0x10')]()-_0x595765['getTime']()>_0x1f8698['retryDuring']){yield _0x34f2c8[a5_0x3d6c('0x2a')]();continue;}if(_0x1f8698['completed'])return;_0x6b89b6(_0x1f8698[a5_0x3d6c('0x31')][a5_0x3d6c('0x1')](_0x1278aa=>_0x1278aa[a5_0x3d6c('0x16')])['join'](''));if(!_0x1f8698[a5_0x3d6c('0x2')]){if(environment_1[a5_0x3d6c('0x4b')]){output[a5_0x3d6c('0x53')]({'title':a5_0x3d6c('0x8')});}yield _0x34f2c8['wait']();_0x5af26c=0x0;_0x5a4691=[];continue;}_0x34f2c8[a5_0x3d6c('0x7')]();_0x30c9b1=!![];const _0x4e26dd=invokeTasksUsingRunMany(_0x36bc1a,_0x1f8698[a5_0x3d6c('0x2')],_0x1f8698['tasks'],_0x1f8698[a5_0x3d6c('0x4a')]);_0x5af26c=_0x4e26dd[a5_0x3d6c('0x3d')];_0x5a4691=_0x4e26dd[a5_0x3d6c('0x45')];}});}function readCompletedTasks(_0x873370,_0x1662ad){const _0x4238fc='Command\x20execution\x20failed\x20(distributed\x20task\x20execution:\x20'+_0x1662ad+a5_0x3d6c('0x44');let _0x1fabfe;try{const _0x50f954=_0x873370[a5_0x3d6c('0x5')]||a5_0x3d6c('0xf');const _0x49a71b=_0x50f954+a5_0x3d6c('0x35')+_0x1662ad;_0x1fabfe=JSON['parse']((0x0,fs_1[a5_0x3d6c('0x1a')])(_0x49a71b)['toString']());(0x0,fs_1[a5_0x3d6c('0x4d')])(_0x49a71b);}catch(_0x3a712c){throw new Error(_0x4238fc);}if(_0x1fabfe['length']==0x0){throw new Error(_0x4238fc);}return _0x1fabfe;}function invokeTasksUsingRunMany(_0x2e0b53,_0x3a2856,_0xc2e3ed,_0x5db54f){let _0x1c9cdd=0x0;const _0x3ca81e=[];for(const _0x3d6c0a of groupByTarget(_0xc2e3ed)){const _0xea88bd=_0x3d6c0a['configuration']?a5_0x3d6c('0x14')+_0x3d6c0a[a5_0x3d6c('0x0')]:'';const _0xb064cf=_0x5db54f>0x1?a5_0x3d6c('0x52')+_0x5db54f:'';const _0x27eb4f=a5_0x3d6c('0x4f')+_0x3d6c0a['target']+'\x20'+_0xea88bd+a5_0x3d6c('0x41')+_0x3d6c0a[a5_0x3d6c('0x20')]['join'](',')+'\x20'+_0x3d6c0a['params']+_0xb064cf;if(environment_1['VERBOSE_LOGGING']){output['note']({'title':a5_0x3d6c('0x33')+_0x27eb4f+'\x27'});}try{(0x0,child_process_1[a5_0x3d6c('0xb')])(_0x27eb4f,{'stdio':[a5_0x3d6c('0x32'),a5_0x3d6c('0x32'),a5_0x3d6c('0x32')],'env':Object[a5_0x3d6c('0x6')](Object[a5_0x3d6c('0x6')]({},process['env']),{'NX_CACHE_FAILURES':a5_0x3d6c('0x3f'),'NX_CLOUD_DISTRIBUTED_EXECUTION_ID':_0x3a2856})});}catch(_0x5c9f64){if(_0x5c9f64[a5_0x3d6c('0x46')]===environment_1[a5_0x3d6c('0x1f')]){throw _0x5c9f64;}else{_0x1c9cdd=0x1;}}finally{_0x3ca81e[a5_0x3d6c('0x3a')](...readCompletedTasks(_0x2e0b53,_0x3a2856));}}return{'completedStatusCode':_0x1c9cdd,'completedTasks':_0x3ca81e};}function groupByTarget(_0x555866){const _0x471be0=[];_0x555866['forEach'](_0xc29a13=>{const _0x4568f4=_0x471be0['find'](_0x2225b6=>_0x2225b6[a5_0x3d6c('0x50')]===_0xc29a13[a5_0x3d6c('0x50')]&&_0x2225b6['configuration']===_0xc29a13[a5_0x3d6c('0x0')]);if(_0x4568f4){_0x4568f4[a5_0x3d6c('0x20')][a5_0x3d6c('0x3a')](_0xc29a13['projectName']);}else{_0x471be0[a5_0x3d6c('0x3a')]({'target':_0xc29a13[a5_0x3d6c('0x50')],'projects':[_0xc29a13[a5_0x3d6c('0x34')]],'params':_0xc29a13['params'],'configuration':_0xc29a13[a5_0x3d6c('0x0')]});}});return _0x471be0;}function getAgentName(){if(process[a5_0x3d6c('0x21')]['NX_AGENT_NAME']!==undefined){return process['env'][a5_0x3d6c('0xe')];}else if(process[a5_0x3d6c('0x21')]['CIRCLECI']!==undefined){return process['env']['CIRCLE_STAGE'];}else{return a5_0x3d6c('0x27')+Math[a5_0x3d6c('0x9')](Math[a5_0x3d6c('0x51')]()*0x186a0);}}function createAgentLockfile(_0x508ad0,_0x38e19a){const _0x4b41e2=_0x508ad0[a5_0x3d6c('0x5')]||a5_0x3d6c('0xf');const _0x5cc898=_0x4b41e2+a5_0x3d6c('0x42');const _0x6f5ce0=_0x5cc898+'/'+_0x38e19a+a5_0x3d6c('0x17');if(!(0x0,fs_1[a5_0x3d6c('0xc')])(_0x5cc898)){(0x0,fs_1[a5_0x3d6c('0x4')])(_0x5cc898,{'recursive':!![]});}const _0x1b7f96=(0x0,fs_1[a5_0x3d6c('0x12')])(_0x5cc898);if(_0x1b7f96[a5_0x3d6c('0x2c')]){if(_0x1b7f96[a5_0x3d6c('0x4c')](_0x38e19a+a5_0x3d6c('0x17'))){output['error']({'title':a5_0x3d6c('0x15'),'bodyLines':[a5_0x3d6c('0x25'),'','End\x20all\x20currently\x20running\x20agents,\x20run\x20\x22npx\x20nx-cloud\x20clean-up-agents\x22,\x20and\x20try\x20again.']});process[a5_0x3d6c('0x22')](0x1);}output[a5_0x3d6c('0x13')]({'title':'Other\x20Nx\x20Cloud\x20Agents\x20Detected','bodyLines':[a5_0x3d6c('0x1c'),'',a5_0x3d6c('0x2d'),a5_0x3d6c('0x19')]});}(0x0,fs_1[a5_0x3d6c('0x39')])(_0x6f5ce0,'');process['on'](a5_0x3d6c('0x22'),()=>cleanupAgentLockfile(_0x6f5ce0));process['on'](a5_0x3d6c('0x2b'),()=>cleanupAgentLockfile(_0x6f5ce0));}function cleanupAgentLockfile(_0x400c4){if((0x0,fs_1[a5_0x3d6c('0xc')])(_0x400c4)){(0x0,fs_1[a5_0x3d6c('0x4d')])(_0x400c4);}}function startAgent(){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x3a3960=(0x0,environment_1['getRunGroup'])();if(!_0x3a3960){(0x0,print_run_group_error_1['printRunGroupError'])();return process[a5_0x3d6c('0x22')](0x1);}output['note']({'title':'Starting\x20an\x20agent\x20for\x20running\x20Nx\x20tasks'});const _0x5e46ab=JSON['parse'](stripJsonComments((0x0,fs_1[a5_0x3d6c('0x1a')])(a5_0x3d6c('0x3e'))['toString']()))[a5_0x3d6c('0x3b')]['default']['options'];const _0x359b14=getAgentName();createAgentLockfile(_0x5e46ab,_0x359b14);const _0x34f9cb=new distributed_agent_api_1['DistributedAgentApi'](_0x5e46ab,_0x3a3960,_0x359b14);return executeTasks(_0x5e46ab,_0x34f9cb)[a5_0x3d6c('0x3c')](_0x3df956=>__awaiter(this,void 0x0,void 0x0,function*(){yield(0x0,metric_logger_1[a5_0x3d6c('0x1b')])(_0x5e46ab);return _0x3df956;}))[a5_0x3d6c('0x24')](_0xb7fae1=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x34f9cb['completeRunGroupWithError'](a5_0x3d6c('0x26')+_0xb7fae1[a5_0x3d6c('0x29')]+'\x22');throw _0xb7fae1;}));});}exports[a5_0x3d6c('0x4e')]=startAgent;

@@ -1,130 +0,1 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createStartRequest = exports.DistributedExecutionApi = void 0;
const axios_1 = require("../../../utilities/axios");
const environment_1 = require("../../../utilities/environment");
const metric_logger_1 = require("../../../utilities/metric-logger");
const { output, unparse } = require('../../../utilities/nx-imports');
class DistributedExecutionApi {
constructor(options) {
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
}
start(params) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const recorder = (0, metric_logger_1.createMetricRecorder)('dteStart');
let resp;
try {
resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/start', params));
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
}
catch (e) {
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
throw e;
}
if (!resp.data.enabled) {
throw new Error(`Workspace is disabled. Cannot perform distributed task executions.`);
}
if (resp.data.error) {
throw new Error(resp.data.error);
}
return resp.data.id;
});
}
status(id) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const recorder = (0, metric_logger_1.createMetricRecorder)('dteStatus');
try {
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/status', {
id,
}));
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
return resp.data;
}
catch (e) {
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
output.error({
title: e.message,
});
process.exit(1);
}
});
}
completeRunGroupWithError(runGroup, error) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const recorder = (0, metric_logger_1.createMetricRecorder)('completeRunGroup');
try {
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
runGroup: runGroup,
criticalErrorMessage: error,
}), 3);
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
}
catch (e) {
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
}
});
}
}
exports.DistributedExecutionApi = DistributedExecutionApi;
function createStartRequest(runGroup, task, options) {
const tasksToExecute = task.map((arr) => {
return arr.map((t) => {
return {
taskId: t.id,
hash: t.hash,
projectName: t.target.project,
target: t.target.target,
configuration: t.target.configuration || null,
params: unparse(t.overrides).join(' '),
};
});
});
const request = {
command: (0, environment_1.parseCommand)(),
branch: (0, environment_1.getBranch)(),
runGroup,
tasks: tasksToExecute,
maxParallel: calculateMaxParallel(options),
};
if (environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT) {
request.agentCount = environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT;
}
if (!environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE) {
request.stopAgentsOnFailure = false;
}
return request;
}
exports.createStartRequest = createStartRequest;
function calculateMaxParallel(options) {
if (options.parallel === 'false' || options.parallel === false) {
return 1;
}
else if (options.parallel === 'true' || options.parallel === true) {
return Number(options.maxParallel || 3);
}
else if (options.parallel === undefined) {
return options.maxParallel ? Number(options.maxParallel) : 3;
}
else {
return Number(options.parallel) || 3;
}
}
//# sourceMappingURL=distributed-execution.api.js.map
const a6_0x12aa=['project','NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT','target','mapRespToPerfEntry','then','createStartRequest','done','axiosMultipleTries','agentCount','../../../utilities/environment','data','/nx-cloud/executions/complete-run-group','join','__awaiter','../../../utilities/axios','completeRunGroup','status','map','apiAxiosInstance','dteStatus','exit','../../../utilities/nx-imports','true','parseCommand','createApiAxiosInstance','RUNNER_FAILURE_PERF_ENTRY','/nx-cloud/executions/status','error','dteStart','hash','recordMetric','../../../utilities/metric-logger','next','parallel','NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE','configuration','axiosException','response','value','message','maxParallel','stopAgentsOnFailure','post','Workspace\x20is\x20disabled.\x20Cannot\x20perform\x20distributed\x20task\x20executions.','completeRunGroupWithError','overrides','createMetricRecorder','false'];(function(_0x354bce,_0x12aa3c){const _0x3964b4=function(_0x2085d3){while(--_0x2085d3){_0x354bce['push'](_0x354bce['shift']());}};_0x3964b4(++_0x12aa3c);}(a6_0x12aa,0x144));const a6_0x3964=function(_0x354bce,_0x12aa3c){_0x354bce=_0x354bce-0x0;let _0x3964b4=a6_0x12aa[_0x354bce];return _0x3964b4;};'use strict';var __awaiter=this&&this[a6_0x3964('0x19')]||function(_0x34da2c,_0x39c1fc,_0x4dba28,_0x3eda65){function _0x29a295(_0xa5eaad){return _0xa5eaad instanceof _0x4dba28?_0xa5eaad:new _0x4dba28(function(_0x49215b){_0x49215b(_0xa5eaad);});}return new(_0x4dba28||(_0x4dba28=Promise))(function(_0x181f54,_0x2f8e55){function _0x2c31de(_0x3358ef){try{_0x2e8ce8(_0x3eda65['next'](_0x3358ef));}catch(_0x5a6ab1){_0x2f8e55(_0x5a6ab1);}}function _0x3aedd8(_0x3ee8b7){try{_0x2e8ce8(_0x3eda65['throw'](_0x3ee8b7));}catch(_0x59587a){_0x2f8e55(_0x59587a);}}function _0x2e8ce8(_0x466b1b){_0x466b1b[a6_0x3964('0x12')]?_0x181f54(_0x466b1b[a6_0x3964('0x2')]):_0x29a295(_0x466b1b[a6_0x3964('0x2')])[a6_0x3964('0x10')](_0x2c31de,_0x3aedd8);}_0x2e8ce8((_0x3eda65=_0x3eda65['apply'](_0x34da2c,_0x39c1fc||[]))[a6_0x3964('0x2c')]());});};Object['defineProperty'](exports,'__esModule',{'value':!![]});exports[a6_0x3964('0x11')]=exports['DistributedExecutionApi']=void 0x0;const axios_1=require(a6_0x3964('0x1a'));const environment_1=require(a6_0x3964('0x15'));const metric_logger_1=require(a6_0x3964('0x2b'));const {output,unparse}=require(a6_0x3964('0x21'));class DistributedExecutionApi{constructor(_0x4417d0){this[a6_0x3964('0x1e')]=(0x0,axios_1[a6_0x3964('0x24')])(_0x4417d0);}['start'](_0x54523b){var _0x3aeb77;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x13062d=(0x0,metric_logger_1['createMetricRecorder'])(a6_0x3964('0x28'));let _0x562e6;try{_0x562e6=yield(0x0,axios_1[a6_0x3964('0x13')])(()=>this[a6_0x3964('0x1e')]['post']('/nx-cloud/executions/start',_0x54523b));_0x13062d[a6_0x3964('0x2a')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x562e6));}catch(_0x36575a){_0x13062d[a6_0x3964('0x2a')](((_0x3aeb77=_0x36575a===null||_0x36575a===void 0x0?void 0x0:_0x36575a['axiosException'])===null||_0x3aeb77===void 0x0?void 0x0:_0x3aeb77['response'])?(0x0,metric_logger_1[a6_0x3964('0xf')])(_0x36575a[a6_0x3964('0x0')]['response']):metric_logger_1[a6_0x3964('0x25')]);throw _0x36575a;}if(!_0x562e6[a6_0x3964('0x16')]['enabled']){throw new Error(a6_0x3964('0x7'));}if(_0x562e6[a6_0x3964('0x16')][a6_0x3964('0x27')]){throw new Error(_0x562e6[a6_0x3964('0x16')][a6_0x3964('0x27')]);}return _0x562e6['data']['id'];});}[a6_0x3964('0x1c')](_0x55a267){var _0x58b7ce;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x47b324=(0x0,metric_logger_1[a6_0x3964('0xa')])(a6_0x3964('0x1f'));try{const _0x5f2a26=yield(0x0,axios_1['axiosMultipleTries'])(()=>this[a6_0x3964('0x1e')][a6_0x3964('0x6')](a6_0x3964('0x26'),{'id':_0x55a267}));_0x47b324[a6_0x3964('0x2a')]((0x0,metric_logger_1[a6_0x3964('0xf')])(_0x5f2a26));return _0x5f2a26[a6_0x3964('0x16')];}catch(_0x54532f){_0x47b324[a6_0x3964('0x2a')](((_0x58b7ce=_0x54532f===null||_0x54532f===void 0x0?void 0x0:_0x54532f[a6_0x3964('0x0')])===null||_0x58b7ce===void 0x0?void 0x0:_0x58b7ce[a6_0x3964('0x1')])?(0x0,metric_logger_1[a6_0x3964('0xf')])(_0x54532f['axiosException'][a6_0x3964('0x1')]):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);output[a6_0x3964('0x27')]({'title':_0x54532f[a6_0x3964('0x3')]});process[a6_0x3964('0x20')](0x1);}});}[a6_0x3964('0x8')](_0x452dac,_0x199aca){var _0xef9ce9;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x275a48=(0x0,metric_logger_1[a6_0x3964('0xa')])(a6_0x3964('0x1b'));try{const _0x44d2ab=yield(0x0,axios_1[a6_0x3964('0x13')])(()=>this[a6_0x3964('0x1e')][a6_0x3964('0x6')](a6_0x3964('0x17'),{'runGroup':_0x452dac,'criticalErrorMessage':_0x199aca}),0x3);_0x275a48['recordMetric']((0x0,metric_logger_1[a6_0x3964('0xf')])(_0x44d2ab));}catch(_0x12a042){_0x275a48[a6_0x3964('0x2a')](((_0xef9ce9=_0x12a042===null||_0x12a042===void 0x0?void 0x0:_0x12a042[a6_0x3964('0x0')])===null||_0xef9ce9===void 0x0?void 0x0:_0xef9ce9[a6_0x3964('0x1')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x12a042[a6_0x3964('0x0')][a6_0x3964('0x1')]):metric_logger_1[a6_0x3964('0x25')]);}});}}exports['DistributedExecutionApi']=DistributedExecutionApi;function createStartRequest(_0x513b9a,_0x3ca0df,_0x811966){const _0xc1933=_0x3ca0df[a6_0x3964('0x1d')](_0x580409=>{return _0x580409[a6_0x3964('0x1d')](_0x11f065=>{return{'taskId':_0x11f065['id'],'hash':_0x11f065[a6_0x3964('0x29')],'projectName':_0x11f065[a6_0x3964('0xe')][a6_0x3964('0xc')],'target':_0x11f065['target'][a6_0x3964('0xe')],'configuration':_0x11f065[a6_0x3964('0xe')][a6_0x3964('0x2f')]||null,'params':unparse(_0x11f065[a6_0x3964('0x9')])[a6_0x3964('0x18')]('\x20')};});});const _0x59ab0e={'command':(0x0,environment_1[a6_0x3964('0x23')])(),'branch':(0x0,environment_1['getBranch'])(),'runGroup':_0x513b9a,'tasks':_0xc1933,'maxParallel':calculateMaxParallel(_0x811966)};if(environment_1[a6_0x3964('0xd')]){_0x59ab0e[a6_0x3964('0x14')]=environment_1[a6_0x3964('0xd')];}if(!environment_1[a6_0x3964('0x2e')]){_0x59ab0e[a6_0x3964('0x5')]=![];}return _0x59ab0e;}exports[a6_0x3964('0x11')]=createStartRequest;function calculateMaxParallel(_0xdfc91a){if(_0xdfc91a[a6_0x3964('0x2d')]===a6_0x3964('0xb')||_0xdfc91a[a6_0x3964('0x2d')]===![]){return 0x1;}else if(_0xdfc91a['parallel']===a6_0x3964('0x22')||_0xdfc91a[a6_0x3964('0x2d')]===!![]){return Number(_0xdfc91a[a6_0x3964('0x4')]||0x3);}else if(_0xdfc91a[a6_0x3964('0x2d')]===undefined){return _0xdfc91a['maxParallel']?Number(_0xdfc91a[a6_0x3964('0x4')]):0x3;}else{return Number(_0xdfc91a['parallel'])||0x3;}}

@@ -1,306 +0,1 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TaskGraphCreator = exports.nxCloudDistributedTasksRunner = void 0;
const Observable_1 = require("rxjs/internal/Observable");
const stripJsonComments = require("strip-json-comments");
const fs_1 = require("fs");
const distributed_execution_api_1 = require("./distributed-execution.api");
const file_storage_1 = require("../../file-storage/file-storage");
const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
const waiter_1 = require("../../../utilities/waiter");
const environment_1 = require("../../../utilities/environment");
const print_run_group_error_1 = require("../../error/print-run-group-error");
const create_no_new_messages_timeout_1 = require("../../../utilities/create-no-new-messages-timeout");
const metric_logger_1 = require("../../../utilities/metric-logger");
const { output, getDependencyConfigs, getOutputs, unparse, Cache, } = require('../../../utilities/nx-imports');
class NoopLifeCycle {
scheduleTask(task) { }
startTask(task) { }
endTask(task, code) { }
}
function runDistributedExecution(api, options, context, fileStorage, cache, runGroup, tasks) {
return __awaiter(this, void 0, void 0, function* () {
const nxjson = JSON.parse(stripJsonComments((0, fs_1.readFileSync)('nx.json').toString()));
const stages = new TaskOrderer(context.projectGraph, getDefaultDependencyConfigs(nxjson, options)).splitTasksIntoStages(tasks);
const id = yield api.start((0, distributed_execution_api_1.createStartRequest)(runGroup, stages, options));
return yield processTasks(api, fileStorage, cache, options, id, tasks, context);
});
}
function processTasks(api, fileStorage, cache, options, executionId, tasks, context) {
return __awaiter(this, void 0, void 0, function* () {
const processedTasks = {};
const failIfNumberOfCompletedTasksDoesNotChangeIn30Mins = (0, create_no_new_messages_timeout_1.createNoNewMessagesTimeout)();
const waiter = new waiter_1.Waiter();
while (true) {
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'Waiting...',
});
}
yield waiter.wait();
const r = yield api.status(executionId);
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: `Status update`,
bodyLines: [
`executionId: ${executionId}`,
`executionStatus: ${r.executionStatus}`,
`number of completed tasks: ${r.completedTasks.length}`,
`error: ${r.criticalErrorMessage}`,
],
});
}
if (r.criticalErrorMessage) {
output.error({
title: 'Distributed Execution Terminated',
bodyLines: ['Error:', r.criticalErrorMessage],
});
process.exit(1);
}
failIfNumberOfCompletedTasksDoesNotChangeIn30Mins(r.completedTasks.length);
for (const t of r.completedTasks) {
if (processedTasks[t.taskId])
continue;
yield processTask(fileStorage, cache, context, options, tasks, t);
waiter.reset();
processedTasks[t.taskId] = true;
}
if (r.executionStatus === 'COMPLETED') {
return { commandStatus: r.commandStatus, runUrl: r.runUrl };
}
}
});
}
function processTask(fileStorage, cache, context, options, tasks, completedTask) {
return __awaiter(this, void 0, void 0, function* () {
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: `Processing task ${completedTask.taskId}`,
});
}
const matchingTask = tasks.find((tt) => completedTask.taskId === tt.id);
if (!matchingTask) {
throw new Error(`Found unknown task: ${completedTask.taskId}`);
}
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: `Retrieving artifacts from ${completedTask.url}`,
});
}
yield fileStorage.retrieve(completedTask.hash, completedTask.url, options.cacheDirectory || './node_modules/.cache/nx');
const cachedResult = yield cache.get(Object.assign(Object.assign({}, matchingTask), { hash: completedTask.hash }));
const outputs = getOutputs(context.projectGraph.nodes, matchingTask);
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: `Extracting artifacts`,
bodyLines: outputs,
});
}
yield cache.copyFilesFromCache(completedTask.hash, cachedResult, outputs);
output.logCommand(getCommand(matchingTask));
process.stdout.write(cachedResult.terminalOutput);
output.addVerticalSeparator();
});
}
function getCommand(task) {
const args = unparse(task.overrides || {});
const config = task.target.configuration
? `:${task.target.configuration}`
: '';
return [
'nx',
'run',
`${task.target.project}:${task.target.target}${config}`,
...args,
].join(' ');
}
const nxCloudDistributedTasksRunner = (tasks, options, context) => {
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'Starting distributed command execution',
});
}
options.lifeCycle = new NoopLifeCycle();
const runGroup = (0, environment_1.getRunGroup)();
if (!runGroup) {
(0, print_run_group_error_1.printRunGroupError)();
return process.exit(1);
}
const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
const fileStorage = new file_storage_1.FileStorage(encryption);
const cache = new Cache(options);
const api = new distributed_execution_api_1.DistributedExecutionApi(options);
runDistributedExecution(api, options, context, fileStorage, cache, runGroup, tasks)
.then((r) => __awaiter(void 0, void 0, void 0, function* () {
if (r.commandStatus === 0) {
output.success({
title: 'Successfully completed running the command.',
bodyLines: [`See run details at ${r.runUrl}`],
});
}
else {
output.error({
title: 'Command execution failed.',
bodyLines: [`See run details at ${r.runUrl}`],
});
}
yield (0, metric_logger_1.submitRunMetrics)(options);
process.exit(r.commandStatus);
}))
.catch((e) => {
output.error({
title: 'Unable to complete a run.',
bodyLines: [e.message],
});
if (e.axiosException) {
console.log(e.axiosException);
}
else {
console.log(e);
}
api
.completeRunGroupWithError(runGroup, `Main job terminated with an error: "${e.message}"`)
.finally(() => process.exit(1));
});
return new Observable_1.Observable(() => { });
};
exports.nxCloudDistributedTasksRunner = nxCloudDistributedTasksRunner;
class TaskOrderer {
constructor(projectGraph, defaultTargetDependencies) {
this.projectGraph = projectGraph;
this.defaultTargetDependencies = defaultTargetDependencies;
}
splitTasksIntoStages(tasks) {
if (tasks.length === 0)
return [];
const stages = [];
const taskGraph = this.createTaskGraph(tasks);
const notStagedTaskIds = new Set(tasks.map((t) => t.id));
let stageIndex = 0;
// Loop through tasks and try to stage them. As tasks are staged, they are removed from the loop
while (notStagedTaskIds.size > 0) {
const currentStage = (stages[stageIndex] = []);
for (const taskId of notStagedTaskIds) {
let ready = true;
for (const dependency of taskGraph.dependencies[taskId]) {
if (notStagedTaskIds.has(dependency)) {
// dependency has not been staged yet, this task is not ready to be staged.
ready = false;
break;
}
}
// Some dependency still has not been staged, skip it for now, it will be processed again
if (!ready) {
continue;
}
// All the dependencies have been staged, let's stage it.
const task = taskGraph.tasks[taskId];
currentStage.push(task);
}
// Remove the entire new stage of tasks from the list
for (const task of currentStage) {
notStagedTaskIds.delete(task.id);
}
stageIndex++;
}
return stages;
}
createTaskGraph(tasks) {
const t = new TaskGraphCreator(this.projectGraph, this.defaultTargetDependencies);
return t.createTaskGraph(tasks);
}
}
class TaskGraphCreator {
constructor(projectGraph, defaultTargetDependencies) {
this.projectGraph = projectGraph;
this.defaultTargetDependencies = defaultTargetDependencies;
}
createTaskGraph(tasks) {
const graph = {
roots: [],
tasks: {},
dependencies: {},
};
for (const task of tasks) {
this.addTaskToGraph(task, graph);
const dependencyConfigs = getDependencyConfigs(task.target, this.defaultTargetDependencies, this.projectGraph);
if (!dependencyConfigs) {
continue;
}
this.addTaskDependencies(task, dependencyConfigs, tasks, graph);
}
graph.roots = Object.keys(graph.dependencies).filter((k) => graph.dependencies[k].length === 0);
return graph;
}
addTaskDependencies(task, dependencyConfigs, tasks, graph) {
for (const dependencyConfig of dependencyConfigs) {
if (dependencyConfig.projects === 'self') {
for (const t of tasks) {
if (t.target.project === task.target.project &&
t.target.target === dependencyConfig.target) {
graph.dependencies[task.id].push(t.id);
}
}
}
else if (dependencyConfig.projects === 'dependencies') {
const seen = new Set();
this.addDependencies(task.target.project, dependencyConfig.target, tasks, graph, task.id, seen);
}
}
}
addDependencies(project, target, tasks, graph, taskId, seen) {
seen.add(project);
const dependencies = this.projectGraph.dependencies[project];
if (dependencies) {
const projectDependencies = dependencies.map((dependency) => dependency.target);
for (const projectDependency of projectDependencies) {
if (seen.has(projectDependency)) {
continue;
}
const dependency = this.findTask({ project: projectDependency, target }, tasks);
if (dependency) {
if (graph.dependencies[taskId].indexOf(dependency.id) === -1) {
graph.dependencies[taskId].push(dependency.id);
}
}
else {
this.addDependencies(projectDependency, target, tasks, graph, taskId, seen);
}
}
}
}
findTask({ project, target }, tasks) {
return tasks.find((t) => t.target.project === project && t.target.target === target);
}
addTaskToGraph(task, graph) {
graph.tasks[task.id] = task;
graph.dependencies[task.id] = [];
}
}
exports.TaskGraphCreator = TaskGraphCreator;
function getDefaultDependencyConfigs(nxJson, runnerOptions) {
var _a, _b;
const defaults = (_a = nxJson.targetDependencies) !== null && _a !== void 0 ? _a : {};
const strictlyOrderedTargets = runnerOptions
? (_b = runnerOptions.strictlyOrderedTargets) !== null && _b !== void 0 ? _b : ['build']
: [];
// Strictly Ordered Targets depend on their dependencies
for (const target of strictlyOrderedTargets) {
defaults[target] = defaults[target] || [];
defaults[target].push({
target,
projects: 'dependencies',
});
}
return defaults;
}
//# sourceMappingURL=distributed-execution.runner.js.map
const a7_0x1262=['targetDependencies','parse','./distributed-execution.api','error:\x20','commandStatus','COMPLETED','criticalErrorMessage','join','run','completeRunGroupWithError','value','DistributedExecutionApi','size','url','addTaskDependencies','Unable\x20to\x20complete\x20a\x20run.','FileStorage','executionId:\x20','reset','roots','then','Waiting...','VERBOSE_LOGGING','addTaskToGraph','length','axiosException','status','Command\x20execution\x20failed.','tasks','Waiter','throw','exit','See\x20run\x20details\x20at\x20','message','Processing\x20task\x20','configuration','indexOf','createTaskGraph','terminalOutput','retrieve','projectGraph','addDependencies','nxCloudDistributedTasksRunner','add','../../file-storage/file-storage','Distributed\x20Execution\x20Terminated','TaskGraphCreator','./node_modules/.cache/nx','next','defineProperty','map','project','build','lifeCycle','executionStatus','overrides','Found\x20unknown\x20task:\x20','error','get','dependencies','Status\x20update','done','catch','wait','hash','../../../utilities/nx-imports','__esModule','taskId','projects','Error:','log','../../file-storage/e2e-encryption','../../error/print-run-group-error','ENCRYPTION_KEY','completedTasks','defaultTargetDependencies','E2EEncryption','delete','submitRunMetrics','logCommand','stdout','Extracting\x20artifacts','../../../utilities/create-no-new-messages-timeout','printRunGroupError','finally','cacheDirectory','runUrl','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','getRunGroup','push','executionStatus:\x20','createNoNewMessagesTimeout','find','../../../utilities/environment','number\x20of\x20completed\x20tasks:\x20','splitTasksIntoStages','assign','strictlyOrderedTargets','Observable','../../../utilities/metric-logger','strip-json-comments','target','__awaiter','encryptionKey','note','start','apply','endTask','success'];(function(_0x857951,_0x1262b2){const _0x4eac35=function(_0x4518ba){while(--_0x4518ba){_0x857951['push'](_0x857951['shift']());}};_0x4eac35(++_0x1262b2);}(a7_0x1262,0x87));const a7_0x4eac=function(_0x857951,_0x1262b2){_0x857951=_0x857951-0x0;let _0x4eac35=a7_0x1262[_0x857951];return _0x4eac35;};'use strict';var __awaiter=this&&this[a7_0x4eac('0x4c')]||function(_0x37205a,_0xc83eb9,_0x48dd20,_0x55696e){function _0x41d6c7(_0x1b5ef9){return _0x1b5ef9 instanceof _0x48dd20?_0x1b5ef9:new _0x48dd20(function(_0x3f4cb1){_0x3f4cb1(_0x1b5ef9);});}return new(_0x48dd20||(_0x48dd20=Promise))(function(_0x5c2504,_0x4f58a5){function _0x547e4a(_0x2dbc30){try{_0x53efb0(_0x55696e['next'](_0x2dbc30));}catch(_0x2968ab){_0x4f58a5(_0x2968ab);}}function _0x26364f(_0x5d9838){try{_0x53efb0(_0x55696e[a7_0x4eac('0x4')](_0x5d9838));}catch(_0x43564d){_0x4f58a5(_0x43564d);}}function _0x53efb0(_0x2d0356){_0x2d0356[a7_0x4eac('0x23')]?_0x5c2504(_0x2d0356[a7_0x4eac('0x5d')]):_0x41d6c7(_0x2d0356[a7_0x4eac('0x5d')])[a7_0x4eac('0x67')](_0x547e4a,_0x26364f);}_0x53efb0((_0x55696e=_0x55696e[a7_0x4eac('0x50')](_0x37205a,_0xc83eb9||[]))[a7_0x4eac('0x16')]());});};Object[a7_0x4eac('0x17')](exports,a7_0x4eac('0x28'),{'value':!![]});exports[a7_0x4eac('0x14')]=exports['nxCloudDistributedTasksRunner']=void 0x0;const Observable_1=require('rxjs/internal/Observable');const stripJsonComments=require(a7_0x4eac('0x4a'));const fs_1=require('fs');const distributed_execution_api_1=require(a7_0x4eac('0x55'));const file_storage_1=require(a7_0x4eac('0x12'));const e2e_encryption_1=require(a7_0x4eac('0x2d'));const waiter_1=require('../../../utilities/waiter');const environment_1=require(a7_0x4eac('0x43'));const print_run_group_error_1=require(a7_0x4eac('0x2e'));const create_no_new_messages_timeout_1=require(a7_0x4eac('0x38'));const metric_logger_1=require(a7_0x4eac('0x49'));const {output,getDependencyConfigs,getOutputs,unparse,Cache}=require(a7_0x4eac('0x27'));class NoopLifeCycle{['scheduleTask'](_0x3ea615){}['startTask'](_0x26f83c){}[a7_0x4eac('0x51')](_0x74e1d2,_0x36cf54){}}function runDistributedExecution(_0x30080b,_0x4dba9b,_0x46571b,_0x5de3ed,_0x5abcb6,_0x143c99,_0x4dad1b){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x245bb6=JSON[a7_0x4eac('0x54')](stripJsonComments((0x0,fs_1['readFileSync'])('nx.json')['toString']()));const _0x1c8873=new TaskOrderer(_0x46571b[a7_0x4eac('0xe')],getDefaultDependencyConfigs(_0x245bb6,_0x4dba9b))[a7_0x4eac('0x45')](_0x4dad1b);const _0x27ee49=yield _0x30080b[a7_0x4eac('0x4f')]((0x0,distributed_execution_api_1['createStartRequest'])(_0x143c99,_0x1c8873,_0x4dba9b));return yield processTasks(_0x30080b,_0x5de3ed,_0x5abcb6,_0x4dba9b,_0x27ee49,_0x4dad1b,_0x46571b);});}function processTasks(_0x5c0371,_0x1baa9b,_0x16bcf8,_0x4130a2,_0xee56f4,_0x337971,_0x5ebf56){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x1732b5={};const _0x4d21c4=(0x0,create_no_new_messages_timeout_1[a7_0x4eac('0x41')])();const _0x3c2ff3=new waiter_1[(a7_0x4eac('0x3'))]();while(!![]){if(environment_1[a7_0x4eac('0x69')]){output[a7_0x4eac('0x4e')]({'title':a7_0x4eac('0x68')});}yield _0x3c2ff3[a7_0x4eac('0x25')]();const _0x45a8bd=yield _0x5c0371[a7_0x4eac('0x0')](_0xee56f4);if(environment_1['VERBOSE_LOGGING']){output['note']({'title':a7_0x4eac('0x22'),'bodyLines':[a7_0x4eac('0x64')+_0xee56f4,a7_0x4eac('0x40')+_0x45a8bd[a7_0x4eac('0x1c')],a7_0x4eac('0x44')+_0x45a8bd[a7_0x4eac('0x30')]['length'],a7_0x4eac('0x56')+_0x45a8bd['criticalErrorMessage']]});}if(_0x45a8bd[a7_0x4eac('0x59')]){output[a7_0x4eac('0x1f')]({'title':a7_0x4eac('0x13'),'bodyLines':[a7_0x4eac('0x2b'),_0x45a8bd[a7_0x4eac('0x59')]]});process['exit'](0x1);}_0x4d21c4(_0x45a8bd[a7_0x4eac('0x30')][a7_0x4eac('0x6b')]);for(const _0x2180a8 of _0x45a8bd['completedTasks']){if(_0x1732b5[_0x2180a8[a7_0x4eac('0x29')]])continue;yield processTask(_0x1baa9b,_0x16bcf8,_0x5ebf56,_0x4130a2,_0x337971,_0x2180a8);_0x3c2ff3[a7_0x4eac('0x65')]();_0x1732b5[_0x2180a8[a7_0x4eac('0x29')]]=!![];}if(_0x45a8bd[a7_0x4eac('0x1c')]===a7_0x4eac('0x58')){return{'commandStatus':_0x45a8bd['commandStatus'],'runUrl':_0x45a8bd[a7_0x4eac('0x3c')]};}}});}function processTask(_0x2cb77a,_0xb8d4d8,_0x160844,_0x4f2c5a,_0x60be7e,_0x55435f){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1['VERBOSE_LOGGING']){output[a7_0x4eac('0x4e')]({'title':a7_0x4eac('0x8')+_0x55435f[a7_0x4eac('0x29')]});}const _0x39d589=_0x60be7e[a7_0x4eac('0x42')](_0x557dde=>_0x55435f['taskId']===_0x557dde['id']);if(!_0x39d589){throw new Error(a7_0x4eac('0x1e')+_0x55435f[a7_0x4eac('0x29')]);}if(environment_1['VERBOSE_LOGGING']){output['note']({'title':'Retrieving\x20artifacts\x20from\x20'+_0x55435f[a7_0x4eac('0x60')]});}yield _0x2cb77a[a7_0x4eac('0xd')](_0x55435f[a7_0x4eac('0x26')],_0x55435f[a7_0x4eac('0x60')],_0x4f2c5a[a7_0x4eac('0x3b')]||a7_0x4eac('0x15'));const _0x40613a=yield _0xb8d4d8[a7_0x4eac('0x20')](Object[a7_0x4eac('0x46')](Object[a7_0x4eac('0x46')]({},_0x39d589),{'hash':_0x55435f['hash']}));const _0x10c51a=getOutputs(_0x160844['projectGraph']['nodes'],_0x39d589);if(environment_1[a7_0x4eac('0x69')]){output[a7_0x4eac('0x4e')]({'title':a7_0x4eac('0x37'),'bodyLines':_0x10c51a});}yield _0xb8d4d8['copyFilesFromCache'](_0x55435f[a7_0x4eac('0x26')],_0x40613a,_0x10c51a);output[a7_0x4eac('0x35')](getCommand(_0x39d589));process[a7_0x4eac('0x36')]['write'](_0x40613a[a7_0x4eac('0xc')]);output['addVerticalSeparator']();});}function getCommand(_0x35ccc3){const _0x126b68=unparse(_0x35ccc3[a7_0x4eac('0x1d')]||{});const _0x92528=_0x35ccc3[a7_0x4eac('0x4b')][a7_0x4eac('0x9')]?':'+_0x35ccc3['target'][a7_0x4eac('0x9')]:'';return['nx',a7_0x4eac('0x5b'),_0x35ccc3[a7_0x4eac('0x4b')][a7_0x4eac('0x19')]+':'+_0x35ccc3[a7_0x4eac('0x4b')][a7_0x4eac('0x4b')]+_0x92528,..._0x126b68][a7_0x4eac('0x5a')]('\x20');}const nxCloudDistributedTasksRunner=(_0x1cb758,_0x2c5638,_0x7b53a1)=>{if(environment_1[a7_0x4eac('0x69')]){output[a7_0x4eac('0x4e')]({'title':'Starting\x20distributed\x20command\x20execution'});}_0x2c5638[a7_0x4eac('0x1b')]=new NoopLifeCycle();const _0x487171=(0x0,environment_1[a7_0x4eac('0x3e')])();if(!_0x487171){(0x0,print_run_group_error_1[a7_0x4eac('0x39')])();return process['exit'](0x1);}const _0x5644fe=new e2e_encryption_1[(a7_0x4eac('0x32'))](environment_1[a7_0x4eac('0x2f')]||_0x2c5638[a7_0x4eac('0x4d')]);const _0x5f28f0=new file_storage_1[(a7_0x4eac('0x63'))](_0x5644fe);const _0x1681c8=new Cache(_0x2c5638);const _0xdf5c8=new distributed_execution_api_1[(a7_0x4eac('0x5e'))](_0x2c5638);runDistributedExecution(_0xdf5c8,_0x2c5638,_0x7b53a1,_0x5f28f0,_0x1681c8,_0x487171,_0x1cb758)[a7_0x4eac('0x67')](_0xfd2d6b=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(_0xfd2d6b[a7_0x4eac('0x57')]===0x0){output[a7_0x4eac('0x52')]({'title':'Successfully\x20completed\x20running\x20the\x20command.','bodyLines':[a7_0x4eac('0x6')+_0xfd2d6b[a7_0x4eac('0x3c')]]});}else{output[a7_0x4eac('0x1f')]({'title':a7_0x4eac('0x1'),'bodyLines':[a7_0x4eac('0x6')+_0xfd2d6b['runUrl']]});}yield(0x0,metric_logger_1[a7_0x4eac('0x34')])(_0x2c5638);process[a7_0x4eac('0x5')](_0xfd2d6b[a7_0x4eac('0x57')]);}))[a7_0x4eac('0x24')](_0x18d3ab=>{output[a7_0x4eac('0x1f')]({'title':a7_0x4eac('0x62'),'bodyLines':[_0x18d3ab[a7_0x4eac('0x7')]]});if(_0x18d3ab[a7_0x4eac('0x6c')]){console[a7_0x4eac('0x2c')](_0x18d3ab[a7_0x4eac('0x6c')]);}else{console[a7_0x4eac('0x2c')](_0x18d3ab);}_0xdf5c8[a7_0x4eac('0x5c')](_0x487171,a7_0x4eac('0x3d')+_0x18d3ab['message']+'\x22')[a7_0x4eac('0x3a')](()=>process['exit'](0x1));});return new Observable_1[(a7_0x4eac('0x48'))](()=>{});};exports[a7_0x4eac('0x10')]=nxCloudDistributedTasksRunner;class TaskOrderer{constructor(_0x5aba69,_0x5c93f8){this[a7_0x4eac('0xe')]=_0x5aba69;this[a7_0x4eac('0x31')]=_0x5c93f8;}[a7_0x4eac('0x45')](_0x13e31a){if(_0x13e31a['length']===0x0)return[];const _0x1dfc6a=[];const _0x5c03cd=this['createTaskGraph'](_0x13e31a);const _0x5f022a=new Set(_0x13e31a['map'](_0x2b5d24=>_0x2b5d24['id']));let _0x179440=0x0;while(_0x5f022a[a7_0x4eac('0x5f')]>0x0){const _0x255725=_0x1dfc6a[_0x179440]=[];for(const _0x412c50 of _0x5f022a){let _0x137cf4=!![];for(const _0x485c5b of _0x5c03cd[a7_0x4eac('0x21')][_0x412c50]){if(_0x5f022a['has'](_0x485c5b)){_0x137cf4=![];break;}}if(!_0x137cf4){continue;}const _0x23fcbb=_0x5c03cd[a7_0x4eac('0x2')][_0x412c50];_0x255725[a7_0x4eac('0x3f')](_0x23fcbb);}for(const _0x4c95fa of _0x255725){_0x5f022a[a7_0x4eac('0x33')](_0x4c95fa['id']);}_0x179440++;}return _0x1dfc6a;}['createTaskGraph'](_0x301da9){const _0x52b26f=new TaskGraphCreator(this[a7_0x4eac('0xe')],this[a7_0x4eac('0x31')]);return _0x52b26f[a7_0x4eac('0xb')](_0x301da9);}}class TaskGraphCreator{constructor(_0xb73ede,_0x3b69e5){this[a7_0x4eac('0xe')]=_0xb73ede;this[a7_0x4eac('0x31')]=_0x3b69e5;}['createTaskGraph'](_0x599736){const _0x4ca1e9={'roots':[],'tasks':{},'dependencies':{}};for(const _0x249d0b of _0x599736){this[a7_0x4eac('0x6a')](_0x249d0b,_0x4ca1e9);const _0x1a93b0=getDependencyConfigs(_0x249d0b['target'],this[a7_0x4eac('0x31')],this[a7_0x4eac('0xe')]);if(!_0x1a93b0){continue;}this[a7_0x4eac('0x61')](_0x249d0b,_0x1a93b0,_0x599736,_0x4ca1e9);}_0x4ca1e9[a7_0x4eac('0x66')]=Object['keys'](_0x4ca1e9[a7_0x4eac('0x21')])['filter'](_0x31a255=>_0x4ca1e9[a7_0x4eac('0x21')][_0x31a255][a7_0x4eac('0x6b')]===0x0);return _0x4ca1e9;}[a7_0x4eac('0x61')](_0x3d5898,_0x1f63cb,_0x5af7a3,_0x4000b4){for(const _0x3f139 of _0x1f63cb){if(_0x3f139[a7_0x4eac('0x2a')]==='self'){for(const _0x264d7a of _0x5af7a3){if(_0x264d7a[a7_0x4eac('0x4b')][a7_0x4eac('0x19')]===_0x3d5898[a7_0x4eac('0x4b')]['project']&&_0x264d7a[a7_0x4eac('0x4b')][a7_0x4eac('0x4b')]===_0x3f139[a7_0x4eac('0x4b')]){_0x4000b4[a7_0x4eac('0x21')][_0x3d5898['id']][a7_0x4eac('0x3f')](_0x264d7a['id']);}}}else if(_0x3f139[a7_0x4eac('0x2a')]==='dependencies'){const _0x128ff2=new Set();this[a7_0x4eac('0xf')](_0x3d5898[a7_0x4eac('0x4b')][a7_0x4eac('0x19')],_0x3f139[a7_0x4eac('0x4b')],_0x5af7a3,_0x4000b4,_0x3d5898['id'],_0x128ff2);}}}[a7_0x4eac('0xf')](_0x47d3ad,_0x4fa4ac,_0x32ed3c,_0x3a21e6,_0x52c421,_0x2fe424){_0x2fe424[a7_0x4eac('0x11')](_0x47d3ad);const _0x25c08e=this[a7_0x4eac('0xe')][a7_0x4eac('0x21')][_0x47d3ad];if(_0x25c08e){const _0x5eedf8=_0x25c08e[a7_0x4eac('0x18')](_0x557183=>_0x557183[a7_0x4eac('0x4b')]);for(const _0x18a81c of _0x5eedf8){if(_0x2fe424['has'](_0x18a81c)){continue;}const _0x2c704d=this['findTask']({'project':_0x18a81c,'target':_0x4fa4ac},_0x32ed3c);if(_0x2c704d){if(_0x3a21e6[a7_0x4eac('0x21')][_0x52c421][a7_0x4eac('0xa')](_0x2c704d['id'])===-0x1){_0x3a21e6[a7_0x4eac('0x21')][_0x52c421][a7_0x4eac('0x3f')](_0x2c704d['id']);}}else{this[a7_0x4eac('0xf')](_0x18a81c,_0x4fa4ac,_0x32ed3c,_0x3a21e6,_0x52c421,_0x2fe424);}}}}['findTask']({project,target},_0x4dca16){return _0x4dca16[a7_0x4eac('0x42')](_0x5f5103=>_0x5f5103[a7_0x4eac('0x4b')][a7_0x4eac('0x19')]===project&&_0x5f5103[a7_0x4eac('0x4b')][a7_0x4eac('0x4b')]===target);}[a7_0x4eac('0x6a')](_0x297c9e,_0x369d12){_0x369d12[a7_0x4eac('0x2')][_0x297c9e['id']]=_0x297c9e;_0x369d12['dependencies'][_0x297c9e['id']]=[];}}exports['TaskGraphCreator']=TaskGraphCreator;function getDefaultDependencyConfigs(_0x541013,_0x2bbc68){var _0x54883f,_0x3e0231;const _0x4ebc90=(_0x54883f=_0x541013[a7_0x4eac('0x53')])!==null&&_0x54883f!==void 0x0?_0x54883f:{};const _0xb1e16=_0x2bbc68?(_0x3e0231=_0x2bbc68[a7_0x4eac('0x47')])!==null&&_0x3e0231!==void 0x0?_0x3e0231:[a7_0x4eac('0x1a')]:[];for(const _0x8438ef of _0xb1e16){_0x4ebc90[_0x8438ef]=_0x4ebc90[_0x8438ef]||[];_0x4ebc90[_0x8438ef][a7_0x4eac('0x3f')]({'target':_0x8438ef,'projects':a7_0x4eac('0x21')});}return _0x4ebc90;}

2

package.json
{
"name": "nx-cloud",
"version": "13.2.0",
"version": "13.2.1",
"description": "Nx Cloud plugin for Nx",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc