Socket
Socket
Sign inDemoInstall

nx-cloud

Package Overview
Dependencies
35
Maintainers
2
Versions
149
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 16.2.0 to 16.3.0-beta.1

lib/light-client/debug-logger.d.ts

138

bin/nx-cloud.js
#!/usr/bin/env node
"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 });

@@ -10,42 +19,103 @@ const clean_up_agents_1 = require("../lib/core/commands/clean-up-agents");

const upload_and_show_run_details_1 = require("../lib/core/commands/upload-and-show-run-details");
const update_manager_1 = require("../lib/light-client/update-manager");
const path_1 = require("path");
const stripJsonComments = require("strip-json-comments");
const fs_1 = require("fs");
const debug_logger_1 = require("../lib/light-client/debug-logger");
const command = process.argv[2];
if (command === 'start-agent') {
(0, distributed_agent_impl_1.startAgent)().catch((e) => {
console.error(e);
process.exit(1);
});
const options = JSON.parse(stripJsonComments((0, fs_1.readFileSync)(`nx.json`).toString())).tasksRunnerOptions.default.options;
if (options.useLightClient) {
Promise.resolve().then(() => __awaiter(void 0, void 0, void 0, function* () { return invokeCommandWithLightRunner(options); }));
}
else if (command === 'stop-all-agents') {
(0, stop_all_agents_1.stopAllAgents)().catch((e) => {
console.error(e);
process.exit(1);
});
else {
invokeCommandFromBundledImplementation();
}
else if (command === 'start-ci-run') {
(0, start_ci_run_1.startCiRun)().catch((e) => {
console.error(e);
process.exit(1);
function invokeCommandWithLightRunner(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, debug_logger_1.debugLog)('Verifying current cloud bundle');
const { version, fullPath } = yield (0, update_manager_1.verifyOrUpdateCloudBundle)(options);
(0, debug_logger_1.debugLog)('Done: ', fullPath);
const runner = require((0, path_1.join)(process.cwd(), fullPath, 'index.js'));
if (command === 'start-agent') {
runner.startAgent().catch((e) => {
console.error(e);
process.exit(1);
});
}
else if (command === 'stop-all-agents') {
runner.stopAllAgents().catch((e) => {
console.error(e);
process.exit(1);
});
}
else if (command === 'start-ci-run') {
runner.startCiRun().catch((e) => {
console.error(e);
process.exit(1);
});
}
else if (command === 'clean-up-agents') {
runner.cleanUpAgents().catch((e) => {
console.error(e);
process.exit(1);
});
}
else if (command === 'record') {
runner.runCommandAndStoreInCloud().catch((e) => {
console.error(e);
process.exit(1);
});
}
else if (command === 'upload-and-show-run-details') {
runner.uploadAndShowRunDetails().catch((e) => {
console.error(e);
process.exit(1);
});
}
else {
console.log('Pass start-agent, stop-all-agents, or clean-up-agents');
}
});
}
else if (command === 'clean-up-agents') {
(0, clean_up_agents_1.cleanUpAgents)().catch((e) => {
console.error(e);
process.exit(1);
});
function invokeCommandFromBundledImplementation() {
if (command === 'start-agent') {
(0, distributed_agent_impl_1.startAgent)().catch((e) => {
console.error(e);
process.exit(1);
});
}
else if (command === 'stop-all-agents') {
(0, stop_all_agents_1.stopAllAgents)().catch((e) => {
console.error(e);
process.exit(1);
});
}
else if (command === 'start-ci-run') {
(0, start_ci_run_1.startCiRun)().catch((e) => {
console.error(e);
process.exit(1);
});
}
else if (command === 'clean-up-agents') {
(0, clean_up_agents_1.cleanUpAgents)().catch((e) => {
console.error(e);
process.exit(1);
});
}
else if (command === 'record') {
(0, record_output_1.runCommandAndStoreInCloud)().catch((e) => {
console.error(e);
process.exit(1);
});
}
else if (command === 'upload-and-show-run-details') {
(0, upload_and_show_run_details_1.uploadAndShowRunDetails)().catch((e) => {
console.error(e);
process.exit(1);
});
}
else {
console.log('Pass start-agent, stop-all-agents, or clean-up-agents');
}
}
else if (command === 'record') {
(0, record_output_1.runCommandAndStoreInCloud)().catch((e) => {
console.error(e);
process.exit(1);
});
}
else if (command === 'upload-and-show-run-details') {
(0, upload_and_show_run_details_1.uploadAndShowRunDetails)().catch((e) => {
console.error(e);
process.exit(1);
});
}
else {
console.log('Pass start-agent, stop-all-agents, or clean-up-agents');
}
//# sourceMappingURL=nx-cloud.js.map

@@ -1,2 +0,2 @@

import nxCloudTasksRunner from './lib/nx-cloud-tasks-runner';
export default nxCloudTasksRunner;
import { nxCloudTasksRunnerShell } from './lib/light-client/nx-cloud-tasks-runner-shell';
export default nxCloudTasksRunnerShell;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const nx_cloud_tasks_runner_1 = require("./lib/nx-cloud-tasks-runner");
exports.default = nx_cloud_tasks_runner_1.default;
const nx_cloud_tasks_runner_shell_1 = require("./lib/light-client/nx-cloud-tasks-runner-shell");
exports.default = nx_cloud_tasks_runner_shell_1.nxCloudTasksRunnerShell;
//# sourceMappingURL=index.js.map

@@ -1,1 +0,36 @@

const a0_0x9b0b=['warn','ErrorReporterApi','apply','post','reportError','createApiAxiosInstance','apiAxiosInstance','message','value','done','../../utilities/nx-imports','defineProperty','throw','next','then'];(function(_0x454c90,_0x9b0b70){const _0x2e1ee1=function(_0x4b54cf){while(--_0x4b54cf){_0x454c90['push'](_0x454c90['shift']());}};_0x2e1ee1(++_0x9b0b70);}(a0_0x9b0b,0x187));const a0_0x2e1e=function(_0x454c90,_0x9b0b70){_0x454c90=_0x454c90-0x0;let _0x2e1ee1=a0_0x9b0b[_0x454c90];return _0x2e1ee1;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x146757,_0x2b7b7c,_0x270784,_0x45016e){function _0x1c9aca(_0x30e608){return _0x30e608 instanceof _0x270784?_0x30e608:new _0x270784(function(_0x363b6b){_0x363b6b(_0x30e608);});}return new(_0x270784||(_0x270784=Promise))(function(_0x206cd0,_0x277aa1){function _0x554970(_0x73a98b){try{_0x4e1b47(_0x45016e[a0_0x2e1e('0xc')](_0x73a98b));}catch(_0x113262){_0x277aa1(_0x113262);}}function _0x3c636f(_0x2b7819){try{_0x4e1b47(_0x45016e[a0_0x2e1e('0xb')](_0x2b7819));}catch(_0x381cfa){_0x277aa1(_0x381cfa);}}function _0x4e1b47(_0x5107ed){_0x5107ed[a0_0x2e1e('0x8')]?_0x206cd0(_0x5107ed[a0_0x2e1e('0x7')]):_0x1c9aca(_0x5107ed[a0_0x2e1e('0x7')])[a0_0x2e1e('0xd')](_0x554970,_0x3c636f);}_0x4e1b47((_0x45016e=_0x45016e[a0_0x2e1e('0x1')](_0x146757,_0x2b7b7c||[]))['next']());});};Object[a0_0x2e1e('0xa')](exports,'__esModule',{'value':!![]});exports['ErrorReporterApi']=void 0x0;const axios_1=require('../../utilities/axios');const {output}=require(a0_0x2e1e('0x9'));class ErrorReporterApi{constructor(_0x2a092c){this['apiAxiosInstance']=(0x0,axios_1[a0_0x2e1e('0x4')])(_0x2a092c);}[a0_0x2e1e('0x3')](_0x2a90d7){return __awaiter(this,void 0x0,void 0x0,function*(){try{yield(0x0,axios_1['axiosMultipleTries'])(()=>this[a0_0x2e1e('0x5')][a0_0x2e1e('0x2')]('/nx-cloud/report-client-error',{'message':_0x2a90d7}));}catch(_0x6b6a69){output[a0_0x2e1e('0xe')]({'title':'Unable\x20to\x20record\x20the\x20following\x20error:\x20\x27'+_0x2a90d7+'\x27','bodyLines':[_0x6b6a69[a0_0x2e1e('0x6')]]});}});}}exports[a0_0x2e1e('0x0')]=ErrorReporterApi;
"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.ErrorReporterApi = void 0;
const axios_1 = require("../../utilities/axios");
const { output } = require('../../utilities/nx-imports');
class ErrorReporterApi {
constructor(options) {
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
}
reportError(message) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/report-client-error', {
message,
}));
}
catch (e) {
output.warn({
title: `Unable to record the following error: '${message}'`,
bodyLines: [e.message],
});
}
});
}
}
exports.ErrorReporterApi = ErrorReporterApi;
//# sourceMappingURL=error-reporter.api.js.map

@@ -1,1 +0,74 @@

const a1_0x42c6=['axiosException','error','post','../../utilities/nx-imports','RUNNER_FAILURE_PERF_ENTRY','__esModule','defineProperty','apiAxiosInstance','createApiAxiosInstance','throw','../../utilities/metric-logger','mapRespToPerfEntry','RunGroupApi','completeRunGroup','recordMetric','axiosMultipleTries','message','next','value','response','createRunGroup','exit','done','../../utilities/axios','createMetricRecorder'];(function(_0xc1dfb2,_0x42c6d4){const _0x5143be=function(_0x4eb096){while(--_0x4eb096){_0xc1dfb2['push'](_0xc1dfb2['shift']());}};_0x5143be(++_0x42c6d4);}(a1_0x42c6,0x96));const a1_0x5143=function(_0xc1dfb2,_0x42c6d4){_0xc1dfb2=_0xc1dfb2-0x0;let _0x5143be=a1_0x42c6[_0xc1dfb2];return _0x5143be;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x506105,_0x39c9a7,_0x440553,_0x56ffd7){function _0x3317b9(_0x2c5544){return _0x2c5544 instanceof _0x440553?_0x2c5544:new _0x440553(function(_0x5152f6){_0x5152f6(_0x2c5544);});}return new(_0x440553||(_0x440553=Promise))(function(_0xd0c481,_0x4ac175){function _0x4239a7(_0x369ee1){try{_0x162b9b(_0x56ffd7['next'](_0x369ee1));}catch(_0x14ada3){_0x4ac175(_0x14ada3);}}function _0xce4afe(_0x5020d0){try{_0x162b9b(_0x56ffd7[a1_0x5143('0x9')](_0x5020d0));}catch(_0x2b84c5){_0x4ac175(_0x2b84c5);}}function _0x162b9b(_0x584fe0){_0x584fe0[a1_0x5143('0x16')]?_0xd0c481(_0x584fe0[a1_0x5143('0x12')]):_0x3317b9(_0x584fe0[a1_0x5143('0x12')])['then'](_0x4239a7,_0xce4afe);}_0x162b9b((_0x56ffd7=_0x56ffd7['apply'](_0x506105,_0x39c9a7||[]))[a1_0x5143('0x11')]());});};Object[a1_0x5143('0x6')](exports,a1_0x5143('0x5'),{'value':!![]});exports[a1_0x5143('0xc')]=void 0x0;const axios_1=require(a1_0x5143('0x17'));const metric_logger_1=require(a1_0x5143('0xa'));const {output}=require(a1_0x5143('0x3'));class RunGroupApi{constructor(_0x265a6f){this[a1_0x5143('0x7')]=(0x0,axios_1[a1_0x5143('0x8')])(_0x265a6f);}[a1_0x5143('0x14')](_0x4dca41,_0x36da1f,_0x364ba1,_0x31e27f,_0x4124e4,_0x5b1b61,_0x90e8a1,_0x2f7108,_0x270dbc){var _0x240869;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x2db223=(0x0,metric_logger_1['createMetricRecorder'])(a1_0x5143('0x14'));try{const _0x1ff730=yield(0x0,axios_1[a1_0x5143('0xf')])(()=>this['apiAxiosInstance']['post']('/nx-cloud/executions/create-run-group',{'branch':_0x4dca41,'runGroup':_0x36da1f,'ciExecutionId':_0x364ba1,'ciExecutionEnv':_0x31e27f,'stopAgentsOnFailure':_0x4124e4,'agentCount':_0x5b1b61,'stopAgentsAfter':_0x90e8a1,'commitSha':_0x2f7108}));_0x2db223[a1_0x5143('0xe')]((0x0,metric_logger_1[a1_0x5143('0xb')])(_0x1ff730));}catch(_0x45a9cb){_0x2db223['recordMetric'](((_0x240869=_0x45a9cb===null||_0x45a9cb===void 0x0?void 0x0:_0x45a9cb[a1_0x5143('0x0')])===null||_0x240869===void 0x0?void 0x0:_0x240869[a1_0x5143('0x13')])?(0x0,metric_logger_1[a1_0x5143('0xb')])(_0x45a9cb[a1_0x5143('0x0')][a1_0x5143('0x13')]):metric_logger_1[a1_0x5143('0x4')]);output[a1_0x5143('0x1')]({'title':_0x45a9cb[a1_0x5143('0x10')]});process['exit'](0x1);}});}[a1_0x5143('0xd')](_0x133ef1,_0x445c8b,_0x1d93ff,_0x1022ec){var _0x47fde3;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x30ce22=(0x0,metric_logger_1[a1_0x5143('0x18')])(a1_0x5143('0xd'));try{const _0x4640af=yield(0x0,axios_1[a1_0x5143('0xf')])(()=>this[a1_0x5143('0x7')][a1_0x5143('0x2')]('/nx-cloud/executions/complete-run-group',{'branch':_0x133ef1,'runGroup':_0x445c8b,'ciExecutionId':_0x1d93ff,'ciExecutionEnv':_0x1022ec}));_0x30ce22[a1_0x5143('0xe')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x4640af));}catch(_0x57e7d2){_0x30ce22[a1_0x5143('0xe')](((_0x47fde3=_0x57e7d2===null||_0x57e7d2===void 0x0?void 0x0:_0x57e7d2['axiosException'])===null||_0x47fde3===void 0x0?void 0x0:_0x47fde3[a1_0x5143('0x13')])?(0x0,metric_logger_1[a1_0x5143('0xb')])(_0x57e7d2[a1_0x5143('0x0')][a1_0x5143('0x13')]):metric_logger_1[a1_0x5143('0x4')]);output[a1_0x5143('0x1')]({'title':_0x57e7d2[a1_0x5143('0x10')]});process[a1_0x5143('0x15')](0x1);}});}}exports[a1_0x5143('0xc')]=RunGroupApi;
"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, ciExecutionId, ciExecutionEnv, stopAgentsOnFailure, agentCount, stopAgentsAfter, commitSha, commitRef) {
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,
runGroup,
ciExecutionId,
ciExecutionEnv,
stopAgentsOnFailure,
agentCount,
stopAgentsAfter,
commitSha,
}));
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(branch, runGroup, ciExecutionId, ciExecutionEnv) {
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', {
branch,
runGroup,
ciExecutionId,
ciExecutionEnv,
}));
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

@@ -21,2 +21,4 @@ export interface DefaultTasksRunnerOptions {

url?: string;
useLightClient?: boolean;
clientVersion?: string;
}

@@ -1,1 +0,93 @@

const a0_0x353d=['startTask','../../terminal-output/read-task-terminal-output','statuses','cache','scheduledTasks','nodes','getTerminalOutput','status','forEach','runtime','tasks','serializeOverrides','outputObfuscator','endTime','cleanUpHashDetails','target','hash','CloudEnabledLifeCycle','implicitDeps','code','task','../../../utilities/serializer-overrides','params','toISOString','startTime','runContext','collectTerminalOutput','remote-cache-hit','local-cache-kept-existing','remote-cache','hashDetails','push','taskId','defineProperty','project','Cannot\x20find\x20task\x20','scheduleTask','startsWith','filter','find','cacheDirectory','npm:','updateStartedTask'];(function(_0x456f76,_0x353d11){const _0x33f00a=function(_0x3e2f3f){while(--_0x3e2f3f){_0x456f76['push'](_0x456f76['shift']());}};_0x33f00a(++_0x353d11);}(a0_0x353d,0x187));const a0_0x33f0=function(_0x456f76,_0x353d11){_0x456f76=_0x456f76-0x0;let _0x33f00a=a0_0x353d[_0x456f76];return _0x33f00a;};'use strict';Object[a0_0x33f0('0x1d')](exports,'__esModule',{'value':!![]});exports[a0_0x33f0('0xd')]=void 0x0;const serializer_overrides_1=require(a0_0x33f0('0x11'));const read_task_terminal_output_1=require(a0_0x33f0('0x28'));class CloudEnabledLifeCycle{constructor(_0x58a96c,_0x1a3697,_0x1d531a,_0x4fcc2c,_0x4f90cf,_0x14c9fc){this[a0_0x33f0('0x15')]=_0x58a96c;this[a0_0x33f0('0x24')]=_0x1a3697;this[a0_0x33f0('0x16')]=_0x1d531a;this['cacheableOperations']=_0x4fcc2c;this['outputObfuscator']=_0x4f90cf;this[a0_0x33f0('0x6')]=_0x14c9fc;}[a0_0x33f0('0x20')](_0x21021d){this[a0_0x33f0('0x15')][a0_0x33f0('0x0')][a0_0x33f0('0x1b')](_0x21021d);}[a0_0x33f0('0x27')](_0x1367b1){this['tasks'][a0_0x33f0('0x1b')]({'taskId':_0x1367b1['id'],'startTime':new Date()[a0_0x33f0('0x13')](),'target':_0x1367b1['target'][a0_0x33f0('0xb')],'projectName':_0x1367b1[a0_0x33f0('0xb')][a0_0x33f0('0x1e')],'hash':_0x1367b1[a0_0x33f0('0xc')],'hashDetails':this['cleanUpHashDetails'](_0x1367b1[a0_0x33f0('0x1a')]),'params':(0x0,serializer_overrides_1[a0_0x33f0('0x7')])(_0x1367b1),'uploadedToStorage':![]});}['endTasks'](_0x1eb328){for(let _0x1c44ea of _0x1eb328){let _0x24f2fb;const _0x58a88a=_0x1c44ea[a0_0x33f0('0x3')]===a0_0x33f0('0x19');const _0x1a0a24=_0x1c44ea[a0_0x33f0('0x3')]===a0_0x33f0('0x2a');const _0x5e351f=_0x1c44ea['status']==='local-cache'||_0x1c44ea[a0_0x33f0('0x3')]===a0_0x33f0('0x18')||_0x1a0a24;if(this[a0_0x33f0('0x15')]['statuses'][_0x1c44ea['task'][a0_0x33f0('0xc')]]){_0x24f2fb=this[a0_0x33f0('0x15')][a0_0x33f0('0x29')][_0x1c44ea[a0_0x33f0('0x10')][a0_0x33f0('0xc')]];}else if(_0x58a88a){_0x24f2fb=a0_0x33f0('0x17');}else if(_0x5e351f){_0x24f2fb='local-cache-hit';}else{_0x24f2fb='cache-miss';}this[a0_0x33f0('0x26')](_0x1c44ea,_0x24f2fb);}}['endCommand'](){}[a0_0x33f0('0x26')](_0x2b4ef9,_0xc2cf30){const _0x3c63b6=this[a0_0x33f0('0x6')][a0_0x33f0('0x23')](_0x2b731f=>_0x2b731f[a0_0x33f0('0x1c')]===_0x2b4ef9[a0_0x33f0('0x10')]['id']);if(!_0x3c63b6){throw new Error(a0_0x33f0('0x1f')+_0x2b4ef9[a0_0x33f0('0x10')]['id']);}if((_0x2b4ef9===null||_0x2b4ef9===void 0x0?void 0x0:_0x2b4ef9['startTime'])&&(_0x2b4ef9===null||_0x2b4ef9===void 0x0?void 0x0:_0x2b4ef9['endTime'])){_0x3c63b6[a0_0x33f0('0x14')]=new Date(_0x2b4ef9[a0_0x33f0('0x14')])[a0_0x33f0('0x13')]();_0x3c63b6[a0_0x33f0('0x9')]=new Date(_0x2b4ef9[a0_0x33f0('0x9')])['toISOString']();}else{_0x3c63b6[a0_0x33f0('0x9')]=new Date()[a0_0x33f0('0x13')]();}_0x3c63b6['status']=_0x2b4ef9[a0_0x33f0('0xf')];_0x3c63b6[a0_0x33f0('0x12')]=this['outputObfuscator']['obfuscate'](_0x3c63b6[a0_0x33f0('0x12')]);_0x3c63b6['cacheStatus']=_0xc2cf30;if(this['collectTerminalOutput']){_0x3c63b6['terminalOutput']=this['getTerminalOutput'](_0x2b4ef9['task'][a0_0x33f0('0xc')],_0x3c63b6['cacheStatus'],_0x2b4ef9[a0_0x33f0('0xf')]);}}[a0_0x33f0('0x2')](_0x201120,_0x5f1191,_0x3935db){return(0x0,read_task_terminal_output_1['readTaskTerminalOutput'])(this[a0_0x33f0('0x24')],this[a0_0x33f0('0x8')],_0x201120,_0x5f1191,_0x3935db);}[a0_0x33f0('0xa')](_0x18a41e){const _0xbc4c6f={};Object['keys'](_0x18a41e[a0_0x33f0('0x1')])[a0_0x33f0('0x22')](_0x1c02f8=>!_0x1c02f8[a0_0x33f0('0x21')](a0_0x33f0('0x25')))[a0_0x33f0('0x4')](_0x4a5f7a=>{_0xbc4c6f[_0x4a5f7a]=_0x18a41e['nodes'][_0x4a5f7a];});return{'nodes':_0xbc4c6f,'runtime':_0x18a41e[a0_0x33f0('0x5')],'implicitDeps':_0x18a41e[a0_0x33f0('0xe')]};}}exports[a0_0x33f0('0xd')]=CloudEnabledLifeCycle;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloudEnabledLifeCycle = void 0;
const serializer_overrides_1 = require("../../../utilities/serializer-overrides");
const read_task_terminal_output_1 = require("../../terminal-output/read-task-terminal-output");
class CloudEnabledLifeCycle {
constructor(runContext, cacheDirectory, collectTerminalOutput, cacheableOperations, outputObfuscator, tasks) {
this.runContext = runContext;
this.cacheDirectory = cacheDirectory;
this.collectTerminalOutput = collectTerminalOutput;
this.cacheableOperations = cacheableOperations;
this.outputObfuscator = outputObfuscator;
this.tasks = tasks;
}
scheduleTask(task) {
this.runContext.scheduledTasks.push(task);
}
// this gets called for every tasks that starts.
startTask(task) {
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: (0, serializer_overrides_1.serializeOverrides)(task),
uploadedToStorage: false,
});
}
endTasks(tasks) {
// this can be called multiple times changing this time.
for (let t of tasks) {
let cacheStatus;
const taskIsRemoteCacheHit = t.status === 'remote-cache';
const taskIsLocalCacheHitPreNx135 = t.status === 'cache';
const taskIsLocalCacheHit = t.status === 'local-cache' ||
t.status === 'local-cache-kept-existing' ||
taskIsLocalCacheHitPreNx135;
if (this.runContext.statuses[t.task.hash]) {
cacheStatus = this.runContext.statuses[t.task.hash];
}
else if (taskIsRemoteCacheHit) {
cacheStatus = 'remote-cache-hit';
}
else if (taskIsLocalCacheHit) {
cacheStatus = 'local-cache-hit';
}
else {
cacheStatus = 'cache-miss';
}
this.updateStartedTask(t, cacheStatus);
}
}
endCommand() { }
updateStartedTask(result, cacheStatus) {
const startedTask = this.tasks.find((t) => t.taskId === result.task.id);
if (!startedTask) {
throw new Error(`Cannot find task ${result.task.id}`);
}
if ((result === null || result === void 0 ? void 0 : result.startTime) && (result === null || result === void 0 ? void 0 : result.endTime)) {
startedTask.startTime = new Date(result.startTime).toISOString();
startedTask.endTime = new Date(result.endTime).toISOString();
}
else {
startedTask.endTime = new Date().toISOString();
}
startedTask.status = result.code;
startedTask.params = this.outputObfuscator.obfuscate(startedTask.params);
startedTask.cacheStatus = cacheStatus;
if (this.collectTerminalOutput) {
startedTask.terminalOutput = this.getTerminalOutput(result.task.hash, startedTask.cacheStatus, result.code);
}
}
getTerminalOutput(hash, cacheStatus, code) {
return (0, read_task_terminal_output_1.readTaskTerminalOutput)(this.cacheDirectory, this.outputObfuscator, hash, cacheStatus, code);
}
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,
};
}
}
exports.CloudEnabledLifeCycle = CloudEnabledLifeCycle;
//# sourceMappingURL=cloud-enabled-life-cycle.js.map

@@ -1,1 +0,320 @@

const a1_0x24e0=['url','FileStorage','EndOfRunMessage','assign','lifeCycle','parseCommand','OutputObfuscator','daemon','CloudRemoteCache','cloudEnabledTasksRunner','anyErrors','fs-extra','../../../utilities/environment','env','stringify','cloud-enabled-runner','getBranch','path','uploadedToStorage','./cloud-enabled-life-cycle','__awaiter','defineProperty','./cloud-remote-cache','maskedProperties','CloudEnabledLifeCycle','writeFileSync','../../api/error-reporter.api','done','../../../utilities/nx-imports','catch','removeTrailingSlash','storedHashes','./cloud-run.api','find','__esModule','obfuscate','push','CloudRunApi','length','taskId','runUrl','warn','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','nx-cloud/lib/daemon/process-run-end','error','Nx\x20Cloud\x20wasn\x27t\x20able\x20to\x20store\x20artifacts.','ACCESS_TOKEN','apply','.commit','/runs/','printCacheHitsMessage','getRunGroup','agentRunningInDistributedExecution','next','../../terminal-output/output-obfuscator','generateUniqueLinkId','toString','subscribe','printMessages','map','Nx\x20Cloud\x20Problems','join','then','pathExists','encryptionKey','tasks-hashes-','resolve','startRun','../../file-storage/e2e-encryption','submitRunMetrics','accessToken','enabled','../../file-storage/file-storage','message','ENCRYPTION_KEY','VERBOSE_LOGGING','Executed\x20tasks\x20with\x20hashes:\x20','forEach','hash','DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE','value','exit','note','toISOString','local-cache-hit','../../terminal-output/end-of-run-message','filter','extractGitSha'];(function(_0x1be480,_0x24e0e9){const _0x3d1ab7=function(_0xe0de0c){while(--_0xe0de0c){_0x1be480['push'](_0x1be480['shift']());}};_0x3d1ab7(++_0x24e0e9);}(a1_0x24e0,0xd9));const a1_0x3d1a=function(_0x1be480,_0x24e0e9){_0x1be480=_0x1be480-0x0;let _0x3d1ab7=a1_0x24e0[_0x1be480];return _0x3d1ab7;};'use strict';var __awaiter=this&&this[a1_0x3d1a('0x43')]||function(_0x3cc65e,_0x2f16a9,_0x207973,_0x4038a3){function _0x1fd0ef(_0x23f39c){return _0x23f39c instanceof _0x207973?_0x23f39c:new _0x207973(function(_0xda029e){_0xda029e(_0x23f39c);});}return new(_0x207973||(_0x207973=Promise))(function(_0x37455d,_0xbbe6df){function _0x269097(_0x1997f1){try{_0x1d6d86(_0x4038a3['next'](_0x1997f1));}catch(_0x162c36){_0xbbe6df(_0x162c36);}}function _0x5064e0(_0x3493d8){try{_0x1d6d86(_0x4038a3['throw'](_0x3493d8));}catch(_0x1d6568){_0xbbe6df(_0x1d6568);}}function _0x1d6d86(_0x4546f3){_0x4546f3[a1_0x3d1a('0x4a')]?_0x37455d(_0x4546f3[a1_0x3d1a('0x27')]):_0x1fd0ef(_0x4546f3[a1_0x3d1a('0x27')])[a1_0x3d1a('0x15')](_0x269097,_0x5064e0);}_0x1d6d86((_0x4038a3=_0x4038a3[a1_0x3d1a('0x6')](_0x3cc65e,_0x2f16a9||[]))[a1_0x3d1a('0xc')]());});};Object[a1_0x3d1a('0x44')](exports,a1_0x3d1a('0x51'),{'value':!![]});exports[a1_0x3d1a('0x38')]=void 0x0;const message_reporter_1=require('../../terminal-output/message-reporter');const end_of_run_message_1=require(a1_0x3d1a('0x2c'));const output_obfuscator_1=require(a1_0x3d1a('0xd'));const cloud_enabled_life_cycle_1=require(a1_0x3d1a('0x42'));const file_storage_1=require(a1_0x3d1a('0x1f'));const e2e_encryption_1=require(a1_0x3d1a('0x1b'));const environment_1=require(a1_0x3d1a('0x3b'));const cloud_remote_cache_1=require(a1_0x3d1a('0x45'));const cloud_run_api_1=require(a1_0x3d1a('0x4f'));const fs_1=require('fs');const path=require(a1_0x3d1a('0x40'));const path_1=require(a1_0x3d1a('0x40'));const metric_logger_1=require('../../../utilities/metric-logger');const error_reporter_api_1=require(a1_0x3d1a('0x49'));const fs_extra_1=require(a1_0x3d1a('0x3a'));const id_generator_1=require('./id-generator');const remove_trailing_slash_1=require('../../../utilities/remove-trailing-slash');const {tasksRunner,output,cacheDirectory}=require(a1_0x3d1a('0x4b'));function createApi(_0x5e54ee,_0x39e27d,_0xffed9){const _0x21d22b=(0x0,environment_1['getMachineInfo'])();return new cloud_run_api_1[(a1_0x3d1a('0x54'))](_0x5e54ee,_0xffed9,_0x39e27d,_0x21d22b);}function storeTaskHashes(_0x3a5349,_0x263670,_0x3738cc){const _0x537c38=JSON[a1_0x3d1a('0x3d')](_0x3a5349[a1_0x3d1a('0x12')](_0x3e8e66=>({'taskId':_0x3e8e66[a1_0x3d1a('0x56')],'hash':_0x3e8e66[a1_0x3d1a('0x25')]})));if(environment_1[a1_0x3d1a('0x22')]){output[a1_0x3d1a('0x29')]({'title':a1_0x3d1a('0x23')+_0x537c38});}(0x0,fs_1[a1_0x3d1a('0x48')])(path[a1_0x3d1a('0x14')](_0x263670,a1_0x3d1a('0x18')+_0x3738cc),_0x537c38);}function storeLocalCacheHits(_0x3575da,_0x560c2a,_0x2c3eb7){const _0x4802c2=_0x3575da[a1_0x3d1a('0x2d')](_0x4d115a=>_0x4d115a['cacheStatus']===a1_0x3d1a('0x2b'))[a1_0x3d1a('0x12')](_0x49c0ba=>_0x49c0ba[a1_0x3d1a('0x25')]);_0x4802c2[a1_0x3d1a('0x24')](_0x4d0365=>_0x560c2a['store'](_0x4d0365,_0x2c3eb7));}function onComplete({daemon,options,fileStorage,remoteCache,api,outputObfuscator,runStartTime,messages,endOfRunMessage,taskExecutions,versionOfNxBefore133,inner,encryptionKey,storeInCurrentProcess,distributedExecutionId,runContext}){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x9aa671=new Date()[a1_0x3d1a('0x2a')]();const _0x4ebe0e=(0x0,environment_1[a1_0x3d1a('0x3f')])();const _0x39a18c={'command':outputObfuscator[a1_0x3d1a('0x52')]((0x0,environment_1[a1_0x3d1a('0x34')])()),'startTime':runStartTime,'endTime':_0x9aa671,'distributedExecutionId':distributedExecutionId,'branch':_0x4ebe0e,'runGroup':(0x0,environment_1[a1_0x3d1a('0xa')])(),'sha':_0x4ebe0e?(0x0,environment_1[a1_0x3d1a('0x2e')])():undefined,'inner':inner};const _0x22645a={'branch':_0x4ebe0e,'runGroup':(0x0,environment_1[a1_0x3d1a('0xa')])(),'ciExecutionId':(0x0,environment_1['getCIExecutionId'])(),'ciExecutionEnv':(0x0,environment_1['getCIExecutionEnv'])()};if(storeInCurrentProcess){if((0x0,environment_1[a1_0x3d1a('0xb')])(distributedExecutionId)){storeTaskHashes(taskExecutions,cacheDirectory,distributedExecutionId);storeLocalCacheHits(taskExecutions,remoteCache,cacheDirectory);}try{yield remoteCache['waitForStoreRequestsToComplete']();}catch(_0x325f11){output['error']({'title':a1_0x3d1a('0x4')});messages[a1_0x3d1a('0x11')]();return![];}for(const _0x59753b of fileStorage[a1_0x3d1a('0x4e')]){const _0x579e4d=taskExecutions[a1_0x3d1a('0x50')](_0x14d9f1=>_0x14d9f1[a1_0x3d1a('0x25')]===_0x59753b);if(!_0x579e4d){throw new Error('Task\x20with\x20hash\x20'+_0x59753b+'\x20isn\x27t\x20recorded');}_0x579e4d[a1_0x3d1a('0x41')]=!![];}try{yield api['endRun'](_0x39a18c,taskExecutions,_0x22645a);}catch(_0x425b1f){output[a1_0x3d1a('0x3')]({'title':'Nx\x20Cloud\x20wasn\x27t\x20able\x20to\x20record\x20its\x20run.'});messages[a1_0x3d1a('0x11')]();return![];}yield(0x0,metric_logger_1[a1_0x3d1a('0x1c')])(options);}else{try{const _0x1cbb46=environment_1[a1_0x3d1a('0x5')]?environment_1[a1_0x3d1a('0x5')]:options[a1_0x3d1a('0x1d')];const _0x56cd7f=(0x0,id_generator_1[a1_0x3d1a('0xe')])();const _0x29afc7=require[a1_0x3d1a('0x19')](a1_0x3d1a('0x2'));yield daemon['processInBackground'](_0x29afc7,{'encryptionKey':encryptionKey,'runnerOptions':Object[a1_0x3d1a('0x32')](Object[a1_0x3d1a('0x32')]({},options),{'accessToken':_0x1cbb46}),'delayedStoreRequests':remoteCache['delayedStoreRequests'],'ciExecutionContext':_0x22645a,'runEnd':{'runData':_0x39a18c,'taskExecutions':taskExecutions,'linkId':_0x56cd7f}});runContext[a1_0x3d1a('0x57')]=(0x0,remove_trailing_slash_1[a1_0x3d1a('0x4d')])(options[a1_0x3d1a('0x2f')]||'https://nx.app')+a1_0x3d1a('0x8')+_0x56cd7f;}catch(_0x3a6883){output[a1_0x3d1a('0x0')]({'title':a1_0x3d1a('0x13'),'bodyLines':[_0x3a6883[a1_0x3d1a('0x20')]||_0x3a6883[a1_0x3d1a('0xf')]()]});return![];}}if(versionOfNxBefore133){setTimeout(()=>{messages[a1_0x3d1a('0x11')]();if(!messages[a1_0x3d1a('0x39')]&&!inner){endOfRunMessage['printCacheHitsMessage']();}},0x0);}else{messages[a1_0x3d1a('0x11')]();if(!messages[a1_0x3d1a('0x39')]&&!inner){endOfRunMessage[a1_0x3d1a('0x9')]();}}return!![];});}function createLifeCycle(_0x2ad4ac,_0x3baa6f,_0x3e6463,_0x59536c){const _0x556083=new cloud_enabled_life_cycle_1[(a1_0x3d1a('0x47'))](_0x2ad4ac,cacheDirectory,!![],_0x3baa6f['cacheableOperations']||[],_0x3e6463,_0x59536c);try{const {CompositeLifeCycle}=require(a1_0x3d1a('0x4b'));if(!CompositeLifeCycle)return _0x556083;return new CompositeLifeCycle([_0x3baa6f[a1_0x3d1a('0x33')],_0x556083]);}catch(_0x46b0ba){return _0x556083;}}function fetchUrlsForKnownHashesUpfront(_0x231af8,_0x5bd290,_0xa914b2,_0x296e14,_0x2e6eec){return __awaiter(this,void 0x0,void 0x0,function*(){if(_0x296e14['skipNxCache'])return;let _0x166c85=_0xa914b2[a1_0x3d1a('0x12')](_0x2a052d=>_0x2a052d[a1_0x3d1a('0x25')])['filter'](_0x443a2e=>!!_0x443a2e);const _0x40a166=yield Promise['all'](_0x166c85['map'](_0x1745f5=>{const _0x4d59ef=(0x0,path_1[a1_0x3d1a('0x14')])(cacheDirectory,_0x1745f5+a1_0x3d1a('0x7'));return(0x0,fs_extra_1[a1_0x3d1a('0x16')])(_0x4d59ef);}));const _0x3b2718=[];for(let _0x41048b=0x0;_0x41048b<_0x40a166[a1_0x3d1a('0x55')];++_0x41048b){if(!_0x40a166[_0x41048b]){_0x3b2718[a1_0x3d1a('0x53')](_0x166c85[_0x41048b]);}}if(_0x3b2718[a1_0x3d1a('0x55')]>0x0){const _0x18aa6c=_0x231af8[a1_0x3d1a('0x1a')](_0x2e6eec,_0x3b2718);for(const _0x34da76 of _0x3b2718){_0x5bd290['requests'][_0x34da76]=_0x18aa6c;}}});}function cloudEnabledTasksRunner(_0x16eadb,_0x32bd98,_0x263ebc,_0x171965=![]){var _0x25bf6b;const _0x23d726=process[a1_0x3d1a('0x3c')][a1_0x3d1a('0x1')];const _0xc5053b={'statuses':{},'scheduledTasks':[],'requests':{},'allTasks':_0x16eadb};const _0x4297a3=_0x32bd98['lifeCycle']===undefined;const _0xc79953=[];const _0x391ccb=new message_reporter_1['MessageReporter'](_0x32bd98);const _0x335a7a=createApi(_0x391ccb,_0x32bd98,_0xc5053b);const _0x19c44c=new end_of_run_message_1[(a1_0x3d1a('0x31'))](_0xc5053b,_0xc79953,_0x23d726);const _0x16ff64=new output_obfuscator_1[(a1_0x3d1a('0x35'))](_0x32bd98[a1_0x3d1a('0x46')]);const _0x6d4bae=new Date()[a1_0x3d1a('0x2a')]();const _0x28f1a4=createLifeCycle(_0xc5053b,_0x32bd98,_0x16ff64,_0xc79953);const _0x8ae904=environment_1[a1_0x3d1a('0x21')]||_0x32bd98[a1_0x3d1a('0x17')];const _0x2419e9=new e2e_encryption_1['E2EEncryption'](_0x8ae904);const _0x1c6d5f=new error_reporter_api_1['ErrorReporterApi'](_0x32bd98);const _0x403b49=(0x0,environment_1[a1_0x3d1a('0xb')])(_0x23d726)||!((_0x25bf6b=_0x263ebc[a1_0x3d1a('0x36')])===null||_0x25bf6b===void 0x0?void 0x0:_0x25bf6b[a1_0x3d1a('0x1e')]());const _0x22b9c1=new file_storage_1[(a1_0x3d1a('0x30'))](_0x2419e9,_0x1c6d5f,_0x32bd98,a1_0x3d1a('0x3e'));const _0x55902a=new cloud_remote_cache_1[(a1_0x3d1a('0x37'))](_0x391ccb,_0x335a7a,_0xc5053b,_0x22b9c1,_0x23d726,_0x403b49);fetchUrlsForKnownHashesUpfront(_0x335a7a,_0xc5053b,_0x16eadb,_0x32bd98,_0x23d726);delete process[a1_0x3d1a('0x3c')][a1_0x3d1a('0x1')];const _0x45f43f=tasksRunner(_0x16eadb,Object[a1_0x3d1a('0x32')](Object[a1_0x3d1a('0x32')]({},_0x32bd98),{'remoteCache':_0x55902a,'lifeCycle':_0x28f1a4}),_0x263ebc);if(_0x45f43f[a1_0x3d1a('0x10')]){const {Subject}=require('rxjs/internal/Subject');const _0x399cff=new Subject();_0x45f43f[a1_0x3d1a('0x10')]({'next':_0x5e1c34=>_0x399cff[a1_0x3d1a('0xc')](_0x5e1c34),'error':_0x1dddfa=>_0x399cff[a1_0x3d1a('0x3')](_0x1dddfa),'complete':()=>__awaiter(this,void 0x0,void 0x0,function*(){const _0x3bf7ed=yield onComplete({'daemon':_0x263ebc[a1_0x3d1a('0x36')],'options':_0x32bd98,'fileStorage':_0x22b9c1,'remoteCache':_0x55902a,'api':_0x335a7a,'outputObfuscator':_0x16ff64,'runStartTime':_0x6d4bae,'messages':_0x391ccb,'endOfRunMessage':_0x19c44c,'taskExecutions':_0xc79953,'versionOfNxBefore133':_0x4297a3,'inner':_0x171965,'encryptionKey':_0x8ae904,'storeInCurrentProcess':_0x403b49,'runContext':_0xc5053b,'distributedExecutionId':_0x23d726});if(!_0x3bf7ed&&(0x0,environment_1[a1_0x3d1a('0xb')])(_0x23d726)){process[a1_0x3d1a('0x28')](environment_1[a1_0x3d1a('0x26')]);}_0x399cff['complete']();})});return _0x399cff;}else{return _0x45f43f[a1_0x3d1a('0x15')](_0x503bdf=>__awaiter(this,void 0x0,void 0x0,function*(){const _0x213942=yield onComplete({'daemon':_0x263ebc[a1_0x3d1a('0x36')],'options':_0x32bd98,'fileStorage':_0x22b9c1,'remoteCache':_0x55902a,'api':_0x335a7a,'outputObfuscator':_0x16ff64,'runStartTime':_0x6d4bae,'messages':_0x391ccb,'endOfRunMessage':_0x19c44c,'taskExecutions':_0xc79953,'versionOfNxBefore133':_0x4297a3,'inner':_0x171965,'encryptionKey':_0x8ae904,'storeInCurrentProcess':_0x403b49,'runContext':_0xc5053b,'distributedExecutionId':_0x23d726});if(!_0x213942&&(0x0,environment_1[a1_0x3d1a('0xb')])(_0x23d726)){process['exit'](environment_1['DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE']);}return _0x503bdf;}))[a1_0x3d1a('0x4c')](_0x45b2bc=>__awaiter(this,void 0x0,void 0x0,function*(){const _0x2bc79c=yield onComplete({'daemon':_0x263ebc[a1_0x3d1a('0x36')],'options':_0x32bd98,'fileStorage':_0x22b9c1,'remoteCache':_0x55902a,'api':_0x335a7a,'outputObfuscator':_0x16ff64,'runStartTime':_0x6d4bae,'messages':_0x391ccb,'endOfRunMessage':_0x19c44c,'taskExecutions':_0xc79953,'versionOfNxBefore133':_0x4297a3,'inner':_0x171965,'encryptionKey':_0x8ae904,'storeInCurrentProcess':_0x403b49,'runContext':_0xc5053b,'distributedExecutionId':_0x23d726});if(!_0x2bc79c&&(0x0,environment_1[a1_0x3d1a('0xb')])(_0x23d726)){process[a1_0x3d1a('0x28')](environment_1[a1_0x3d1a('0x26')]);}throw _0x45b2bc;}));}}exports[a1_0x3d1a('0x38')]=cloudEnabledTasksRunner;
"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 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 path_1 = require("path");
const metric_logger_1 = require("../../../utilities/metric-logger");
const error_reporter_api_1 = require("../../api/error-reporter.api");
const fs_extra_1 = require("fs-extra");
const id_generator_1 = require("./id-generator");
const remove_trailing_slash_1 = require("../../../utilities/remove-trailing-slash");
const { tasksRunner, output, cacheDirectory, } = require('../../../utilities/nx-imports');
function createApi(errors, options, runContext) {
const machineInfo = (0, environment_1.getMachineInfo)();
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);
}
/*
* It can happen that a task is executed multiple times on an agent, say for DTE1 and DTE2.
* When it runs for DTE2, it will be a local cache hit, so it will be marked as completed.
* However, Nx won't upload an artifact to S3 in this case. Usually this isn't a problem,
* cause the first DTE would have uploaded it. But if you are using a DTE, with a read-only token,
* the uploaded artifact will have a different scoped hash.
*
* To address this: we are finding all local cache hits, and upload everything that has a put url.
*/
function storeLocalCacheHits(taskExecutions, remoteCache, nxCacheDirectory) {
const hashes = taskExecutions
.filter((t) => t.cacheStatus === 'local-cache-hit')
.map((t) => t.hash);
hashes.forEach((hash) => remoteCache.store(hash, nxCacheDirectory));
}
function onComplete({ daemon, options, fileStorage, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133, inner, encryptionKey, storeInCurrentProcess, distributedExecutionId, runContext, }) {
return __awaiter(this, void 0, void 0, function* () {
const runEndTime = new Date().toISOString();
const branch = (0, environment_1.getBranch)();
const runData = {
command: outputObfuscator.obfuscate((0, environment_1.parseCommand)()),
startTime: runStartTime,
endTime: runEndTime,
distributedExecutionId,
branch: branch,
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,
inner: inner,
};
const ciExecutionContext = {
branch: branch,
runGroup: (0, environment_1.getRunGroup)(),
ciExecutionId: (0, environment_1.getCIExecutionId)(),
ciExecutionEnv: (0, environment_1.getCIExecutionEnv)(),
};
if (storeInCurrentProcess) {
if ((0, environment_1.agentRunningInDistributedExecution)(distributedExecutionId)) {
storeTaskHashes(taskExecutions, cacheDirectory, distributedExecutionId);
storeLocalCacheHits(taskExecutions, remoteCache, cacheDirectory);
}
try {
yield remoteCache.waitForStoreRequestsToComplete();
}
catch (e) {
output.error({
title: `Nx Cloud wasn't able to store artifacts.`,
});
messages.printMessages();
return false;
}
for (const hash of fileStorage.storedHashes) {
const matchingTask = taskExecutions.find((t) => t.hash === hash);
if (!matchingTask) {
throw new Error(`Task with hash ${hash} isn't recorded`);
}
matchingTask.uploadedToStorage = true;
}
try {
yield api.endRun(runData, taskExecutions, ciExecutionContext);
}
catch (e) {
output.error({
title: `Nx Cloud wasn't able to record its run.`,
});
messages.printMessages();
return false;
}
yield (0, metric_logger_1.submitRunMetrics)(options);
}
else {
try {
const accessToken = environment_1.ACCESS_TOKEN ? environment_1.ACCESS_TOKEN : options.accessToken;
const linkId = (0, id_generator_1.generateUniqueLinkId)();
const processRunEndFullPath = require.resolve('nx-cloud/lib/daemon/process-run-end');
yield daemon.processInBackground(processRunEndFullPath, {
encryptionKey,
runnerOptions: Object.assign(Object.assign({}, options), { accessToken }),
delayedStoreRequests: remoteCache.delayedStoreRequests,
ciExecutionContext,
runEnd: {
runData,
taskExecutions,
linkId,
},
});
runContext.runUrl = `${(0, remove_trailing_slash_1.removeTrailingSlash)(options.url || 'https://nx.app')}/runs/${linkId}`;
}
catch (e) {
output.warn({
title: `Nx Cloud Problems`,
bodyLines: [e.message || e.toString()],
});
return false;
}
}
// 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 && !inner) {
endOfRunMessage.printCacheHitsMessage();
}
}, 0);
}
else {
messages.printMessages();
if (!messages.anyErrors && !inner) {
endOfRunMessage.printCacheHitsMessage();
}
}
return true;
});
}
function createLifeCycle(runContext, options, outputObfuscator, tasks) {
const cloudEnabledLifeCycle = new cloud_enabled_life_cycle_1.CloudEnabledLifeCycle(runContext, cacheDirectory, true, 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 fetchUrlsForKnownHashesUpfront(api, runContext, tasks, options, distributedExecutionId) {
return __awaiter(this, void 0, void 0, function* () {
if (options.skipNxCache)
return;
let hashes = tasks.map((t) => t.hash).filter((h) => !!h);
// filter out the urls that don't have artifact stored locally
const exists = yield Promise.all(hashes.map((hash) => {
const tdCommit = (0, path_1.join)(cacheDirectory, `${hash}.commit`);
return (0, fs_extra_1.pathExists)(tdCommit);
}));
const missingHashes = [];
for (let i = 0; i < exists.length; ++i) {
if (!exists[i]) {
missingHashes.push(hashes[i]);
}
}
if (missingHashes.length > 0) {
const startRunRequest = api.startRun(distributedExecutionId, missingHashes);
for (const hash of missingHashes) {
runContext.requests[hash] = startRunRequest;
}
}
});
}
function cloudEnabledTasksRunner(tasks, options, context, inner = false) {
var _a;
const distributedExecutionId = process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID;
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, distributedExecutionId);
const outputObfuscator = new output_obfuscator_1.OutputObfuscator(options.maskedProperties);
const runStartTime = new Date().toISOString();
const lifeCycle = createLifeCycle(runContext, options, outputObfuscator, taskExecutions);
const encryptionKey = environment_1.ENCRYPTION_KEY || options.encryptionKey;
const encryption = new e2e_encryption_1.E2EEncryption(encryptionKey);
const errorApi = new error_reporter_api_1.ErrorReporterApi(options);
const storeInCurrentProcess = (0, environment_1.agentRunningInDistributedExecution)(distributedExecutionId) ||
!((_a = context.daemon) === null || _a === void 0 ? void 0 : _a.enabled());
const fileStorage = new file_storage_1.FileStorage(encryption, errorApi, options, 'cloud-enabled-runner');
const remoteCache = new cloud_remote_cache_1.CloudRemoteCache(messages, api, runContext, fileStorage, distributedExecutionId, storeInCurrentProcess);
// we don't await for it cause this step is optional
fetchUrlsForKnownHashesUpfront(api, runContext, tasks, options, distributedExecutionId);
// have to reset it so we don't capture inner tasks
delete process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID;
const res = tasksRunner(tasks, Object.assign(Object.assign({}, options), { remoteCache, lifeCycle }), context);
// observable -> legacy
if (res.subscribe) {
const { Subject } = require('rxjs/internal/Subject');
const wrappedRes = new Subject();
res.subscribe({
next: (value) => wrappedRes.next(value),
error: (err) => wrappedRes.error(err),
complete: () => __awaiter(this, void 0, void 0, function* () {
const success = yield onComplete({
daemon: context.daemon,
options,
fileStorage,
remoteCache,
api,
outputObfuscator,
runStartTime,
messages,
endOfRunMessage,
taskExecutions,
versionOfNxBefore133,
inner,
encryptionKey,
storeInCurrentProcess,
runContext,
distributedExecutionId,
});
if (!success &&
(0, environment_1.agentRunningInDistributedExecution)(distributedExecutionId)) {
process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
}
wrappedRes.complete();
}),
});
return wrappedRes;
// promise
}
else {
return res
.then((r) => __awaiter(this, void 0, void 0, function* () {
const success = yield onComplete({
daemon: context.daemon,
options,
fileStorage,
remoteCache,
api,
outputObfuscator,
runStartTime,
messages,
endOfRunMessage,
taskExecutions,
versionOfNxBefore133,
inner,
encryptionKey,
storeInCurrentProcess,
runContext,
distributedExecutionId,
});
if (!success &&
(0, environment_1.agentRunningInDistributedExecution)(distributedExecutionId)) {
process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
}
return r;
}))
.catch((e) => __awaiter(this, void 0, void 0, function* () {
const success = yield onComplete({
daemon: context.daemon,
options,
fileStorage,
remoteCache,
api,
outputObfuscator,
runStartTime,
messages,
endOfRunMessage,
taskExecutions,
versionOfNxBefore133,
inner,
encryptionKey,
storeInCurrentProcess,
runContext,
distributedExecutionId,
});
if (!success &&
(0, environment_1.agentRunningInDistributedExecution)(distributedExecutionId)) {
process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
}
throw e;
}));
}
}
exports.cloudEnabledTasksRunner = cloudEnabledTasksRunner;
//# sourceMappingURL=cloud-enabled.runner.js.map

@@ -1,1 +0,133 @@

const a2_0x9fdf=['resolve','put','../../../utilities/nx-imports','__awaiter','hashUrls','waitForStoreRequestsToComplete','response','done','statuses','VERBOSE_LOGGING','status','value','Error\x20when\x20storing\x20artifacts','throw','../../../utilities/environment','requests','scheduledTasks','get','storeRequests','storeInCurrentProcess','fileStorage','cacheError','push','Nx\x20Cloud:\x20Skipping\x20storing\x20','__esModule','next','hash','then','CloudRemoteCache','startRun','delayedStoreRequests','defineProperty','store','.\x20Status\x20404.','indexOf','Maybe\x20you\x20are\x20using\x20a\x20read-only\x20token\x20or\x20the\x20artifact\x20has\x20already\x20being\x20uploaded.','runContext','messages','forEach','storage','extractErrorMessage','reduce','note','Nx\x20Cloud:\x20Cache\x20miss\x20','cache-miss','distributedExecutionId','axiosException'];(function(_0x31a548,_0x9fdf4a){const _0x414069=function(_0x4427c5){while(--_0x4427c5){_0x31a548['push'](_0x31a548['shift']());}};_0x414069(++_0x9fdf4a);}(a2_0x9fdf,0x134));const a2_0x4140=function(_0x31a548,_0x9fdf4a){_0x31a548=_0x31a548-0x0;let _0x414069=a2_0x9fdf[_0x31a548];return _0x414069;};'use strict';var __awaiter=this&&this[a2_0x4140('0x18')]||function(_0x31c728,_0x1d342f,_0x48c628,_0x554db0){function _0x12aee0(_0x38898f){return _0x38898f instanceof _0x48c628?_0x38898f:new _0x48c628(function(_0x3095ed){_0x3095ed(_0x38898f);});}return new(_0x48c628||(_0x48c628=Promise))(function(_0x47630b,_0x37533f){function _0x4c9913(_0x4fc455){try{_0xd1277b(_0x554db0[a2_0x4140('0x2e')](_0x4fc455));}catch(_0x23a6eb){_0x37533f(_0x23a6eb);}}function _0x27b565(_0x1a5cd5){try{_0xd1277b(_0x554db0[a2_0x4140('0x22')](_0x1a5cd5));}catch(_0x40f0cb){_0x37533f(_0x40f0cb);}}function _0xd1277b(_0x4d1612){_0x4d1612[a2_0x4140('0x1c')]?_0x47630b(_0x4d1612[a2_0x4140('0x20')]):_0x12aee0(_0x4d1612[a2_0x4140('0x20')])[a2_0x4140('0x1')](_0x4c9913,_0x27b565);}_0xd1277b((_0x554db0=_0x554db0['apply'](_0x31c728,_0x1d342f||[]))[a2_0x4140('0x2e')]());});};Object[a2_0x4140('0x5')](exports,a2_0x4140('0x2d'),{'value':!![]});exports['CloudRemoteCache']=void 0x0;const environment_1=require(a2_0x4140('0x23'));const {output}=require(a2_0x4140('0x17'));class CloudRemoteCache{constructor(_0x198992,_0xcb689e,_0x45c60f,_0x951007,_0x208de6,_0x417e5b){this[a2_0x4140('0xb')]=_0x198992;this['api']=_0xcb689e;this['runContext']=_0x45c60f;this[a2_0x4140('0x29')]=_0x951007;this[a2_0x4140('0x13')]=_0x208de6;this[a2_0x4140('0x28')]=_0x417e5b;this['storeRequests']=[];this[a2_0x4140('0x4')]=[];}['retrieve'](_0x987a62,_0x270af4){var _0x81e07f;return __awaiter(this,void 0x0,void 0x0,function*(){if(this['messages'][a2_0x4140('0x2a')])return![];const _0xaee50d=yield this['hashUrls'](_0x987a62);if(!_0xaee50d||!_0xaee50d['get']){if(environment_1[a2_0x4140('0x1e')]){output['note']({'title':'Nx\x20Cloud:\x20Cache\x20miss\x20'+_0x987a62+'.'});}this[a2_0x4140('0xa')][a2_0x4140('0x1d')][_0x987a62]=a2_0x4140('0x12');return![];}try{yield this['fileStorage']['retrieve'](_0x987a62,_0xaee50d[a2_0x4140('0x26')],_0x270af4);this[a2_0x4140('0xa')][a2_0x4140('0x1d')][_0x987a62]='remote-cache-hit';return!![];}catch(_0x5bf8bc){const _0x5aec71=(_0x81e07f=_0x5bf8bc[a2_0x4140('0x14')])!==null&&_0x81e07f!==void 0x0?_0x81e07f:_0x5bf8bc;if(_0x5aec71[a2_0x4140('0x1b')]&&_0x5aec71[a2_0x4140('0x1b')][a2_0x4140('0x1f')]===0x194){if(environment_1[a2_0x4140('0x1e')]){output[a2_0x4140('0x10')]({'title':a2_0x4140('0x11')+_0x987a62+a2_0x4140('0x7')});}}else{this['messages'][a2_0x4140('0x2a')]=this[a2_0x4140('0xb')]['extractErrorMessage'](_0x5aec71,a2_0x4140('0xd'));}this[a2_0x4140('0xa')][a2_0x4140('0x1d')][_0x987a62]='cache-miss';return![];}});}[a2_0x4140('0x6')](_0x289ead,_0x2957f4){return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a2_0x4140('0xb')][a2_0x4140('0x2a')])return![];const _0x4acfd8=Promise[a2_0x4140('0x15')]()[a2_0x4140('0x1')](()=>__awaiter(this,void 0x0,void 0x0,function*(){var _0x478662;const _0x50c40b=yield this[a2_0x4140('0x19')](_0x289ead);if(!_0x50c40b)return![];if(!_0x50c40b[a2_0x4140('0x16')]){if(environment_1['VERBOSE_LOGGING']){output[a2_0x4140('0x10')]({'title':a2_0x4140('0x2c')+_0x289ead+'.','bodyLines':['There\x20are\x20several\x20reasons\x20why\x20this\x20can\x20happen.',a2_0x4140('0x9')]});}return!![];}if(!this['storeInCurrentProcess']){this[a2_0x4140('0x4')][a2_0x4140('0x2b')]({'hash':_0x289ead,'url':_0x50c40b[a2_0x4140('0x16')]});return!![];}try{yield this['fileStorage'][a2_0x4140('0x6')](_0x289ead,_0x50c40b[a2_0x4140('0x16')],_0x2957f4);return!![];}catch(_0x4443f9){const _0x61e47d=(_0x478662=_0x4443f9['axiosException'])!==null&&_0x478662!==void 0x0?_0x478662:_0x4443f9;this['messages']['cacheError']=this[a2_0x4140('0xb')][a2_0x4140('0xe')](_0x61e47d,a2_0x4140('0xd'));return![];}}));this['storeRequests'][a2_0x4140('0x2b')](_0x4acfd8);return _0x4acfd8;});}[a2_0x4140('0x19')](_0x28ccce){return __awaiter(this,void 0x0,void 0x0,function*(){if(_0x28ccce in this['runContext'][a2_0x4140('0x24')]){return(yield this['runContext'][a2_0x4140('0x24')][_0x28ccce])[_0x28ccce];}else{const _0xfd027f=this[a2_0x4140('0xa')][a2_0x4140('0x25')]['filter'](_0x2752a6=>!this[a2_0x4140('0xa')][a2_0x4140('0x24')][_0x2752a6[a2_0x4140('0x0')]])['map'](_0x18ac2f=>_0x18ac2f['hash']);if(_0xfd027f[a2_0x4140('0x8')](_0x28ccce)===-0x1){_0xfd027f['push'](_0x28ccce);}const _0x48b18a=this['api'][a2_0x4140('0x3')](this[a2_0x4140('0x13')],_0xfd027f);_0xfd027f[a2_0x4140('0xc')](_0x4138a2=>{this[a2_0x4140('0xa')][a2_0x4140('0x24')][_0x4138a2]=_0x48b18a;});return(yield _0x48b18a)[_0x28ccce];}});}[a2_0x4140('0x1a')](){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x4dd16a=yield Promise['all'](this[a2_0x4140('0x27')])[a2_0x4140('0x1')](_0x3114aa=>_0x3114aa[a2_0x4140('0xf')]((_0x2c953f,_0xded66d)=>_0x2c953f&&_0xded66d,!![]));if(!_0x4dd16a){throw new Error(a2_0x4140('0x21'));}});}}exports[a2_0x4140('0x2')]=CloudRemoteCache;
"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, distributedExecutionId, storeInCurrentProcess) {
this.messages = messages;
this.api = api;
this.runContext = runContext;
this.fileStorage = fileStorage;
this.distributedExecutionId = distributedExecutionId;
this.storeInCurrentProcess = storeInCurrentProcess;
this.storeRequests = [];
this.delayedStoreRequests = [];
}
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;
// TODO: vsavkin remove this handling Oct 2023
// 404 indicates that something is broken, but older versions
// of the api can result in such errors
// we ignore them for now
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}.`,
bodyLines: [
`There are several reasons why this can happen.`,
`Maybe you are using a read-only token or the artifact has already being uploaded.`,
],
});
}
return true;
}
if (!this.storeInCurrentProcess) {
this.delayedStoreRequests.push({ hash: hash, url: hashUrls.put });
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(this.distributedExecutionId, scheduledTaskHashesWithoutRequests);
scheduledTaskHashesWithoutRequests.forEach((taskHash) => {
this.runContext.requests[taskHash] = request;
});
return (yield request)[hash];
}
});
}
waitForStoreRequestsToComplete() {
return __awaiter(this, void 0, void 0, function* () {
const res = yield Promise.all(this.storeRequests).then((r) => r.reduce((a, b) => a && b, true));
if (!res) {
throw new Error(`Error when storing artifacts`);
}
});
}
}
exports.CloudRemoteCache = CloudRemoteCache;
//# sourceMappingURL=cloud-remote-cache.js.map

@@ -1,1 +0,174 @@

const a3_0x24e8=['getRunGroup','createMetricRecorder','data','__awaiter','Run\x20Details:','Run\x20completion\x20responded\x20with\x20`undefined`.','../../../utilities/nx-imports','startRun','package.json','message','status','/nx-cloud/runs/end','error','apiError','RUNNER_FAILURE_PERF_ENTRY','RunEnd\x20duration','stringify','nxCloudVersion','response','RunStart','axiosException','from','urls','next','devDependencies','isConnectedToPrivateCloud','runContext','getCIExecutionEnv','api','/nx-cloud/runs/start','../../../utilities/metric-logger','printDuration','getCIExecutionId','CloudRunApi','runUrl','nx-cloud','readFileSync','promisify','defaults','createReqBody','Invalid\x20end\x20run\x20response','VERBOSE_LOGGING','map','headers','recordMetric','note','getBranch','success','machineInfo','uploadedToStorage','mapRespToPerfEntry','done','throw','../../../utilities/environment','messages','axiosMultipleTries','endRun','Invalid\x20Nx\x20Cloud\x20response:\x20','assign','post','toString','RunStart\x20duration','application/octet-stream','parse','stack','RunEnd.\x20Completed\x20tasks','apiAxiosInstance','apply','extractErrorMessage','gzip','length','unknown','Invalid\x20end\x20run\x20response:\x20','string','then','terminalOutput','defineProperty','util'];(function(_0x13b2c3,_0x24e884){const _0x5b9a57=function(_0x392d50){while(--_0x392d50){_0x13b2c3['push'](_0x13b2c3['shift']());}};_0x5b9a57(++_0x24e884);}(a3_0x24e8,0xb6));const a3_0x5b9a=function(_0x13b2c3,_0x24e884){_0x13b2c3=_0x13b2c3-0x0;let _0x5b9a57=a3_0x24e8[_0x13b2c3];return _0x5b9a57;};'use strict';var __awaiter=this&&this[a3_0x5b9a('0x37')]||function(_0x28e754,_0x394e8e,_0x4a5fca,_0x523218){function _0x458ac5(_0x5bde4f){return _0x5bde4f instanceof _0x4a5fca?_0x5bde4f:new _0x4a5fca(function(_0x2334da){_0x2334da(_0x5bde4f);});}return new(_0x4a5fca||(_0x4a5fca=Promise))(function(_0x2e8a5e,_0x17cfb7){function _0x3431b6(_0x54cc28){try{_0x56fd4a(_0x523218[a3_0x5b9a('0x4b')](_0x54cc28));}catch(_0x2c90c2){_0x17cfb7(_0x2c90c2);}}function _0x94a57b(_0x5c6e4e){try{_0x56fd4a(_0x523218[a3_0x5b9a('0x1a')](_0x5c6e4e));}catch(_0x2c476a){_0x17cfb7(_0x2c476a);}}function _0x56fd4a(_0x3bee22){_0x3bee22[a3_0x5b9a('0x19')]?_0x2e8a5e(_0x3bee22['value']):_0x458ac5(_0x3bee22['value'])[a3_0x5b9a('0x30')](_0x3431b6,_0x94a57b);}_0x56fd4a((_0x523218=_0x523218[a3_0x5b9a('0x29')](_0x28e754,_0x394e8e||[]))[a3_0x5b9a('0x4b')]());});};Object[a3_0x5b9a('0x32')](exports,'__esModule',{'value':!![]});exports[a3_0x5b9a('0x7')]=void 0x0;const axios_1=require('../../../utilities/axios');const environment_1=require(a3_0x5b9a('0x1b'));const fs_1=require('fs');const zlib_1=require('zlib');const util_1=require(a3_0x5b9a('0x33'));const metric_logger_1=require(a3_0x5b9a('0x4'));const is_private_cloud_1=require('../../../utilities/is-private-cloud');const {output}=require(a3_0x5b9a('0x3a'));class CloudRunApi{constructor(_0x30e0a3,_0x1afd76,_0x1468ae,_0x1d8e59){this[a3_0x5b9a('0x1c')]=_0x30e0a3;this[a3_0x5b9a('0x0')]=_0x1afd76;this[a3_0x5b9a('0x16')]=_0x1d8e59;this[a3_0x5b9a('0x28')]=(0x0,axios_1['createApiAxiosInstance'])(_0x1468ae);}[a3_0x5b9a('0x3b')](_0x1025e1,_0x5b2c62){var _0x417ab3;return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a3_0x5b9a('0x1c')]['apiError'])return{};const _0xd5f917=(0x0,metric_logger_1[a3_0x5b9a('0x35')])(a3_0x5b9a('0x3b'));try{const _0x4a5e65={'meta':{'nxCloudVersion':this[a3_0x5b9a('0x45')]()},'branch':(0x0,environment_1[a3_0x5b9a('0x14')])(),'runGroup':(0x0,environment_1[a3_0x5b9a('0x34')])(),'ciExecutionId':(0x0,environment_1[a3_0x5b9a('0x6')])(),'ciExecutionEnv':(0x0,environment_1[a3_0x5b9a('0x1')])(),'distributedExecutionId':_0x1025e1,'hashes':_0x5b2c62,'machineInfo':this[a3_0x5b9a('0x16')]};if(environment_1[a3_0x5b9a('0xf')]){output[a3_0x5b9a('0x13')]({'title':a3_0x5b9a('0x47'),'bodyLines':['\x0a'+JSON[a3_0x5b9a('0x44')](_0x4a5e65,null,0x2)]});}const _0x2bfc5a=yield(0x0,axios_1['printDuration'])(a3_0x5b9a('0x23'),()=>(0x0,axios_1[a3_0x5b9a('0x1d')])(()=>this['apiAxiosInstance'][a3_0x5b9a('0x21')](a3_0x5b9a('0x3'),_0x4a5e65)));_0xd5f917[a3_0x5b9a('0x12')]((0x0,metric_logger_1[a3_0x5b9a('0x18')])(_0x2bfc5a));if(_0x2bfc5a[a3_0x5b9a('0x36')]&&_0x2bfc5a[a3_0x5b9a('0x36')]['message']){this['messages'][a3_0x5b9a('0x3d')]=_0x2bfc5a[a3_0x5b9a('0x36')][a3_0x5b9a('0x3d')];}if(!_0x2bfc5a['data']||!_0x2bfc5a['data'][a3_0x5b9a('0x4a')]){this[a3_0x5b9a('0x1c')][a3_0x5b9a('0x41')]=a3_0x5b9a('0x1f')+JSON[a3_0x5b9a('0x44')](_0x2bfc5a['data']);return{};}return _0x2bfc5a[a3_0x5b9a('0x36')][a3_0x5b9a('0x4a')];}catch(_0x3dc3af){_0xd5f917['recordMetric'](((_0x417ab3=_0x3dc3af===null||_0x3dc3af===void 0x0?void 0x0:_0x3dc3af[a3_0x5b9a('0x48')])===null||_0x417ab3===void 0x0?void 0x0:_0x417ab3['response'])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x3dc3af[a3_0x5b9a('0x48')]['response']):metric_logger_1[a3_0x5b9a('0x42')]);this[a3_0x5b9a('0x1c')]['apiError']=this[a3_0x5b9a('0x1c')][a3_0x5b9a('0x2a')](_0x3dc3af,a3_0x5b9a('0x2'));return{};}});}[a3_0x5b9a('0xd')](_0x848a1f,_0x36e6c9,_0x6838df,_0x15fbbb){if((0x0,is_private_cloud_1[a3_0x5b9a('0x4d')])()){for(let _0x23b118 of _0x36e6c9){delete _0x23b118[a3_0x5b9a('0x17')];}}const _0x3fbbad=Object['assign'](Object[a3_0x5b9a('0x20')]({'meta':{'nxCloudVersion':this[a3_0x5b9a('0x45')]()},'tasks':_0x36e6c9,'run':_0x848a1f,'linkId':_0x15fbbb},(0x0,is_private_cloud_1[a3_0x5b9a('0x4d')])()?{}:_0x6838df),{'machineInfo':this['machineInfo']});return JSON[a3_0x5b9a('0x44')](_0x3fbbad);}[a3_0x5b9a('0x1e')](_0x3d56af,_0x16f491,_0x57638e,_0x1009a2){var _0x2b4e18,_0x53b339;return __awaiter(this,void 0x0,void 0x0,function*(){if(this['messages'][a3_0x5b9a('0x41')])return![];let _0x1aea04=this[a3_0x5b9a('0xd')](_0x3d56af,_0x16f491,_0x57638e,_0x1009a2);if(_0x1aea04[a3_0x5b9a('0x2c')]>0x14*0x3e8*0x3e8){_0x1aea04=this[a3_0x5b9a('0xd')](_0x3d56af,_0x16f491[a3_0x5b9a('0x10')](_0x4ceb57=>Object[a3_0x5b9a('0x20')](Object[a3_0x5b9a('0x20')]({},_0x4ceb57),{'hashDetails':undefined})),_0x57638e,_0x1009a2);}const _0x5506c3=Buffer[a3_0x5b9a('0x49')](_0x1aea04);const _0x2ba752=yield(0x0,util_1[a3_0x5b9a('0xb')])(zlib_1[a3_0x5b9a('0x2b')])(_0x5506c3);const _0xe63038=(0x0,metric_logger_1['createMetricRecorder'])(a3_0x5b9a('0x1e'));try{if(environment_1[a3_0x5b9a('0xf')]){const _0x5063db=_0x16f491[a3_0x5b9a('0x10')](_0x5b5d76=>{return Object[a3_0x5b9a('0x20')](Object[a3_0x5b9a('0x20')]({},_0x5b5d76),{'terminalOutput':_0x5b5d76[a3_0x5b9a('0x31')]?_0x5b5d76[a3_0x5b9a('0x31')]['slice'](0x0,0x14)+'...':undefined});});output[a3_0x5b9a('0x13')]({'title':a3_0x5b9a('0x27'),'bodyLines':['\x0a'+JSON[a3_0x5b9a('0x44')](_0x5063db,null,0x2)]});}const _0x5b9765=yield(0x0,axios_1[a3_0x5b9a('0x5')])(a3_0x5b9a('0x43'),()=>(0x0,axios_1[a3_0x5b9a('0x1d')])(()=>this[a3_0x5b9a('0x28')][a3_0x5b9a('0x21')](a3_0x5b9a('0x3f'),_0x2ba752,{'headers':Object['assign'](Object[a3_0x5b9a('0x20')]({},this['apiAxiosInstance'][a3_0x5b9a('0xc')][a3_0x5b9a('0x11')]),{'Content-Encoding':a3_0x5b9a('0x2b'),'Content-Type':a3_0x5b9a('0x24')})})));if(_0x5b9765){_0xe63038['recordMetric']((0x0,metric_logger_1[a3_0x5b9a('0x18')])(_0x5b9765));if(_0x5b9765[a3_0x5b9a('0x36')]&&_0x5b9765[a3_0x5b9a('0x36')][a3_0x5b9a('0x8')]&&_0x5b9765['data']['status']===a3_0x5b9a('0x15')){this[a3_0x5b9a('0x0')][a3_0x5b9a('0x8')]=_0x5b9765[a3_0x5b9a('0x36')][a3_0x5b9a('0x8')];return!![];}if(_0x5b9765[a3_0x5b9a('0x36')]&&_0x5b9765[a3_0x5b9a('0x36')][a3_0x5b9a('0x3e')]){this[a3_0x5b9a('0x1c')][a3_0x5b9a('0x41')]='Invalid\x20end\x20run\x20response:\x20'+JSON['stringify'](_0x5b9765['data']['message']);}else if(_0x5b9765[a3_0x5b9a('0x36')]&&typeof _0x5b9765[a3_0x5b9a('0x36')]===a3_0x5b9a('0x2f')){if(_0x5b9765['data']!==a3_0x5b9a('0x15')){this[a3_0x5b9a('0x1c')]['apiError']='Invalid\x20end\x20run\x20response:\x20'+JSON[a3_0x5b9a('0x44')](_0x5b9765[a3_0x5b9a('0x36')]);}}else{this['messages']['apiError']=a3_0x5b9a('0x2e')+JSON[a3_0x5b9a('0x44')](_0x5b9765[a3_0x5b9a('0x36')]);}if(environment_1[a3_0x5b9a('0xf')]){output[a3_0x5b9a('0x13')]({'title':a3_0x5b9a('0xe'),'bodyLines':[JSON['stringify'](_0x5b9765[a3_0x5b9a('0x36')],null,0x2)]});}}else{output[a3_0x5b9a('0x40')]({'title':'Nx\x20Cloud:\x20Unknown\x20Error\x20Occurred','bodyLines':[a3_0x5b9a('0x39'),a3_0x5b9a('0x38'),JSON[a3_0x5b9a('0x44')](_0x3d56af,null,0x2),'Stack\x20Trace:',JSON[a3_0x5b9a('0x44')](new Error()[a3_0x5b9a('0x26')],null,0x2)]});}return![];}catch(_0x3905ab){_0xe63038[a3_0x5b9a('0x12')](((_0x2b4e18=_0x3905ab===null||_0x3905ab===void 0x0?void 0x0:_0x3905ab[a3_0x5b9a('0x48')])===null||_0x2b4e18===void 0x0?void 0x0:_0x2b4e18[a3_0x5b9a('0x46')])?(0x0,metric_logger_1[a3_0x5b9a('0x18')])(_0x3905ab[a3_0x5b9a('0x48')][a3_0x5b9a('0x46')]):metric_logger_1[a3_0x5b9a('0x42')]);const _0x61f80=(_0x53b339=_0x3905ab['axiosException'])!==null&&_0x53b339!==void 0x0?_0x53b339:_0x3905ab;this[a3_0x5b9a('0x1c')][a3_0x5b9a('0x41')]=this[a3_0x5b9a('0x1c')][a3_0x5b9a('0x2a')](_0x61f80,a3_0x5b9a('0x2'));return![];}});}[a3_0x5b9a('0x45')](){try{const _0x119e5e=JSON[a3_0x5b9a('0x25')]((0x0,fs_1[a3_0x5b9a('0xa')])(a3_0x5b9a('0x3c'))[a3_0x5b9a('0x22')]());return _0x119e5e['devDependencies'][a3_0x5b9a('0x9')]||_0x119e5e[a3_0x5b9a('0x4c')]['@nrwl/nx-cloud'];}catch(_0x1d77b8){return a3_0x5b9a('0x2d');}}}exports[a3_0x5b9a('0x7')]=CloudRunApi;
"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 is_private_cloud_1 = require("../../../utilities/is-private-cloud");
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* () {
// API is not working, don't make the end request
if (this.messages.apiError)
return {};
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)(),
ciExecutionId: (0, environment_1.getCIExecutionId)(),
ciExecutionEnv: (0, environment_1.getCIExecutionEnv)(),
distributedExecutionId,
hashes,
};
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'RunStart',
bodyLines: ['\n' + JSON.stringify(request, null, 2)],
});
}
const resp = yield (0, axios_1.printDuration)('RunStart duration', () => (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 {};
}
});
}
createReqBody(run, tasks, ciExecutionContext, linkId) {
if ((0, is_private_cloud_1.isConnectedToPrivateCloud)()) {
for (let t of tasks) {
delete t.uploadedToStorage;
}
}
const uncompressedReqBody = Object.assign(Object.assign({ meta: {
nxCloudVersion: this.nxCloudVersion(),
}, tasks,
run,
linkId }, ((0, is_private_cloud_1.isConnectedToPrivateCloud)() ? {} : ciExecutionContext)), { machineInfo: this.machineInfo });
return JSON.stringify(uncompressedReqBody);
}
endRun(run, tasks, ciExecutionContext, linkId) {
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;
let uncompressedBodyString = this.createReqBody(run, tasks, ciExecutionContext, linkId);
// if the req body is > 20mb, remove hashDetails
if (uncompressedBodyString.length > 20 * 1000 * 1000) {
uncompressedBodyString = this.createReqBody(run, tasks.map((t) => (Object.assign(Object.assign({}, t), { hashDetails: undefined }))), ciExecutionContext, linkId);
}
const uncompressedBuffer = Buffer.from(uncompressedBodyString);
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.printDuration)('RunEnd duration', () => (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['nx-cloud'] || v.devDependencies['@nrwl/nx-cloud']);
}
catch (e) {
return 'unknown';
}
}
}
exports.CloudRunApi = CloudRunApi;
//# sourceMappingURL=cloud-run.api.js.map

@@ -1,1 +0,16 @@

const a4_0x4b56=['length','ABCDEFGHIJKLMNOPQRSTUVWXYZ','0123456789','random','generateUniqueLinkId','__esModule','floor'];(function(_0x4f3749,_0x4b561a){const _0x5c251c=function(_0x4cc790){while(--_0x4cc790){_0x4f3749['push'](_0x4f3749['shift']());}};_0x5c251c(++_0x4b561a);}(a4_0x4b56,0x1b1));const a4_0x5c25=function(_0x4f3749,_0x4b561a){_0x4f3749=_0x4f3749-0x0;let _0x5c251c=a4_0x4b56[_0x4f3749];return _0x5c251c;};'use strict';Object['defineProperty'](exports,a4_0x5c25('0x6'),{'value':!![]});exports[a4_0x5c25('0x5')]=void 0x0;const upper=a4_0x5c25('0x2');const digits=a4_0x5c25('0x3');const lower=upper['toLowerCase']();const alphanum=upper+lower+digits;function generateUniqueLinkId(){let _0x101db1='';for(let _0x12a35b=0x0;_0x12a35b<0xa;++_0x12a35b){_0x101db1+=alphanum[Math[a4_0x5c25('0x0')](Math[a4_0x5c25('0x4')]()*alphanum[a4_0x5c25('0x1')])];}return _0x101db1;}exports[a4_0x5c25('0x5')]=generateUniqueLinkId;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateUniqueLinkId = void 0;
const upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const digits = '0123456789';
const lower = upper.toLowerCase();
const alphanum = upper + lower + digits;
function generateUniqueLinkId() {
let res = '';
for (let i = 0; i < 10; ++i) {
res += alphanum[Math.floor(Math.random() * alphanum.length)];
}
return res;
}
exports.generateUniqueLinkId = generateUniqueLinkId;
//# sourceMappingURL=id-generator.js.map

@@ -1,1 +0,93 @@

const a5_0x1ccb=['RUNNER_FAILURE_PERF_ENTRY','done','axiosException','/nx-cloud/executions/tasks','data','ciExecutionId:\x20','note','agentName','recordMetric','Completed\x20run\x20group\x20with\x20an\x20error','mapRespToPerfEntry','../../../utilities/metric-logger','axiosMultipleTries','next','DistributedAgentApi','__awaiter','defineProperty','runGroup:\x20','../../../utilities/nx-imports','dtePollTasks','tasks','ciExecutionId','createMetricRecorder','apiAxiosInstance','runGroup','/nx-cloud/executions/complete-run-group','../../../utilities/axios','then','value','response','__esModule','ciExecutionEnv','error:\x20','createApiAxiosInstance'];(function(_0x33f5ff,_0x1ccbaf){const _0x343169=function(_0x765b37){while(--_0x765b37){_0x33f5ff['push'](_0x33f5ff['shift']());}};_0x343169(++_0x1ccbaf);}(a5_0x1ccb,0x71));const a5_0x3431=function(_0x33f5ff,_0x1ccbaf){_0x33f5ff=_0x33f5ff-0x0;let _0x343169=a5_0x1ccb[_0x33f5ff];return _0x343169;};'use strict';var __awaiter=this&&this[a5_0x3431('0x4')]||function(_0x18b8fa,_0x3ca304,_0xd27b19,_0x12a30b){function _0x2fc8d0(_0x4a114c){return _0x4a114c instanceof _0xd27b19?_0x4a114c:new _0xd27b19(function(_0x5449f9){_0x5449f9(_0x4a114c);});}return new(_0xd27b19||(_0xd27b19=Promise))(function(_0xb83b1f,_0x1ccf2f){function _0x33f76d(_0x502a87){try{_0x2b4acd(_0x12a30b['next'](_0x502a87));}catch(_0x5b2125){_0x1ccf2f(_0x5b2125);}}function _0x48c7d4(_0x48d6f8){try{_0x2b4acd(_0x12a30b['throw'](_0x48d6f8));}catch(_0x4f1060){_0x1ccf2f(_0x4f1060);}}function _0x2b4acd(_0x3c4e5d){_0x3c4e5d[a5_0x3431('0x18')]?_0xb83b1f(_0x3c4e5d[a5_0x3431('0x11')]):_0x2fc8d0(_0x3c4e5d[a5_0x3431('0x11')])[a5_0x3431('0x10')](_0x33f76d,_0x48c7d4);}_0x2b4acd((_0x12a30b=_0x12a30b['apply'](_0x18b8fa,_0x3ca304||[]))[a5_0x3431('0x2')]());});};Object[a5_0x3431('0x5')](exports,a5_0x3431('0x13'),{'value':!![]});exports[a5_0x3431('0x3')]=void 0x0;const axios_1=require(a5_0x3431('0xf'));const environment_1=require('../../../utilities/environment');const metric_logger_1=require(a5_0x3431('0x0'));const {output}=require(a5_0x3431('0x7'));class DistributedAgentApi{constructor(_0x3006ed,_0x39c337,_0x5b995a,_0x52ea69,_0x1391d5,_0xeaec3f){this['branch']=_0x39c337;this[a5_0x3431('0xd')]=_0x5b995a;this[a5_0x3431('0xa')]=_0x52ea69;this[a5_0x3431('0x14')]=_0x1391d5;this['agentName']=_0xeaec3f;this[a5_0x3431('0xc')]=(0x0,axios_1[a5_0x3431('0x16')])(_0x3006ed);}[a5_0x3431('0x9')](_0x4b42d1,_0x263891,_0x24433a,_0x187b05){var _0xf20eb6;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x2d2f72=(0x0,metric_logger_1[a5_0x3431('0xb')])(a5_0x3431('0x8'));try{const _0x423af0=yield(0x0,axios_1[a5_0x3431('0x1')])(()=>this[a5_0x3431('0xc')]['post'](a5_0x3431('0x1a'),{'runGroup':this[a5_0x3431('0xd')],'ciExecutionId':this[a5_0x3431('0xa')],'ciExecutionEnv':this[a5_0x3431('0x14')],'agentName':this[a5_0x3431('0x1e')],'executionId':_0x4b42d1,'statusCode':_0x263891,'completedTasks':_0x24433a,'targets':_0x187b05}));_0x2d2f72[a5_0x3431('0x1f')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x423af0));return _0x423af0[a5_0x3431('0x1b')];}catch(_0x241268){_0x2d2f72['recordMetric'](((_0xf20eb6=_0x241268===null||_0x241268===void 0x0?void 0x0:_0x241268[a5_0x3431('0x19')])===null||_0xf20eb6===void 0x0?void 0x0:_0xf20eb6['response'])?(0x0,metric_logger_1[a5_0x3431('0x21')])(_0x241268[a5_0x3431('0x19')][a5_0x3431('0x12')]):metric_logger_1[a5_0x3431('0x17')]);throw _0x241268;}});}['completeRunGroupWithError'](_0x25379d){var _0x213083;return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1['VERBOSE_LOGGING']){output[a5_0x3431('0x1d')]({'title':'Completing\x20with\x20an\x20error','bodyLines':[a5_0x3431('0x1c')+this[a5_0x3431('0xa')],'ciExecutionEnv:\x20'+this['ciExecutionEnv'],a5_0x3431('0x6')+this[a5_0x3431('0xd')],a5_0x3431('0x15')+_0x25379d]});}const _0x1a1a9b=(0x0,metric_logger_1['createMetricRecorder'])('completeRunGroup');try{const _0x4eb911=yield(0x0,axios_1[a5_0x3431('0x1')])(()=>this[a5_0x3431('0xc')]['post'](a5_0x3431('0xe'),{'branch':this['branch'],'runGroup':this[a5_0x3431('0xd')],'ciExecutionId':this[a5_0x3431('0xa')],'ciExecutionEnv':this[a5_0x3431('0x14')],'agentName':this[a5_0x3431('0x1e')],'criticalErrorMessage':_0x25379d}));if(environment_1['VERBOSE_LOGGING']){output[a5_0x3431('0x1d')]({'title':a5_0x3431('0x20')});}_0x1a1a9b['recordMetric']((0x0,metric_logger_1[a5_0x3431('0x21')])(_0x4eb911));}catch(_0xd030b0){_0x1a1a9b[a5_0x3431('0x1f')](((_0x213083=_0xd030b0===null||_0xd030b0===void 0x0?void 0x0:_0xd030b0['axiosException'])===null||_0x213083===void 0x0?void 0x0:_0x213083[a5_0x3431('0x12')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0xd030b0[a5_0x3431('0x19')][a5_0x3431('0x12')]):metric_logger_1[a5_0x3431('0x17')]);console['error'](_0xd030b0);}});}}exports[a5_0x3431('0x3')]=DistributedAgentApi;
"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, branch, runGroup, ciExecutionId, ciExecutionEnv, agentName) {
this.branch = branch;
this.runGroup = runGroup;
this.ciExecutionId = ciExecutionId;
this.ciExecutionEnv = ciExecutionEnv;
this.agentName = agentName;
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
}
tasks(executionId, statusCode, completedTasks, targets) {
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,
ciExecutionId: this.ciExecutionId,
ciExecutionEnv: this.ciExecutionEnv,
agentName: this.agentName,
executionId,
statusCode,
completedTasks,
targets,
}));
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 with an error',
bodyLines: [
`ciExecutionId: ${this.ciExecutionId}`,
`ciExecutionEnv: ${this.ciExecutionEnv}`,
`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', {
branch: this.branch,
runGroup: this.runGroup,
ciExecutionId: this.ciExecutionId,
ciExecutionEnv: this.ciExecutionEnv,
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

@@ -1,1 +0,170 @@

const a6_0x1cdc=['../../../utilities/metric-logger','encryptionKey','__esModule','Agent\x20was\x20terminated\x20via\x20SIGINT','apply','nx-cloud','E2EEncryption','default','CIRCLECI','startAgent','yargs-parser','../../error/print-invalid-runner-error','then','strip-json-comments','Nx\x20Cloud:\x20Workspace\x20is\x20disabled','End\x20all\x20currently\x20running\x20agents,\x20run\x20\x22npx\x20nx-cloud\x20clean-up-agents\x22,\x20and\x20try\x20again.','floor','../../api/error-reporter.api','random','filter','This\x20can\x20also\x20be\x20a\x20false\x20positive\x20caused\x20by\x20agents\x20that\x20did\x20not\x20shut\x20down\x20correctly.','done','@nrwl/nx-cloud','runner','options','../../../utilities/dte-artifact-storage','Starting\x20an\x20agent\x20for\x20running\x20Nx\x20tasks','writeFileSync','next','printRunGroupError','ENCRYPTION_KEY','printCacheableTargetsError','readFileSync','length','CIRCLE_JOB','Critical\x20Error\x20in\x20Agent:\x20\x22','/lockfiles','argv','readdirSync','../../error/print-cacheable-targets-error','value','map','SIGINT','getRunGroup','If\x20you\x20believe\x20this\x20is\x20the\x20case,\x20run\x20\x22npx\x20nx-cloud\x20clean-up-agents\x22.','SIGTERM','./invoke-tasks-using-run-many','../../file-storage/e2e-encryption','Distributed\x20Task\x20Execution\x20is\x20disabled\x20when\x20your\x20workspace\x20is\x20disabled','unlinkSync','DistributedAgentApi','cacheableOperations','defineProperty','We\x20have\x20detected\x20other\x20agents\x20running\x20in\x20this\x20workspace.\x20This\x20can\x20cause\x20unexpected\x20behavior.','warn','We\x20have\x20detected\x20another\x20agent\x20with\x20this\x20ID\x20running\x20in\x20this\x20workspace.\x20This\x20should\x20not\x20happen.','getCIExecutionEnv','CIRCLE_STAGE','note','Agent\x20','.lock','throw','getCIExecutionId','includes','Starting\x20an\x20agent\x20for\x20running\x20Nx\x20target(s)\x20[','ErrorReporterApi','Duplicate\x20Agent\x20ID\x20Detected','error','join','existsSync','FileStorage','Other\x20Nx\x20Cloud\x20Agents\x20Detected','trim','./execute-tasks','completeRunGroupWithError','../../file-storage/file-storage','env','some','NX_AGENT_NAME','exit','parse','Organization\x20administrators\x20can\x20find\x20more\x20information\x20on\x20the\x20\x27Billing\x20and\x20Plans\x27\x20page\x20in\x20the\x20Nx\x20Cloud\x20Webapp','targets','DteArtifactStorage','./invoke-tasks-using-nx-imperative-api'];(function(_0x251b4e,_0x1cdc5a){const _0x522a33=function(_0x59c859){while(--_0x59c859){_0x251b4e['push'](_0x251b4e['shift']());}};_0x522a33(++_0x1cdc5a);}(a6_0x1cdc,0x100));const a6_0x522a=function(_0x251b4e,_0x1cdc5a){_0x251b4e=_0x251b4e-0x0;let _0x522a33=a6_0x1cdc[_0x251b4e];return _0x522a33;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x59e3ee,_0x491164,_0x47508c,_0x1b4b61){function _0x44daf4(_0x2d92b9){return _0x2d92b9 instanceof _0x47508c?_0x2d92b9:new _0x47508c(function(_0x2e81d2){_0x2e81d2(_0x2d92b9);});}return new(_0x47508c||(_0x47508c=Promise))(function(_0xb58362,_0x7740d7){function _0x429944(_0x3a5873){try{_0x51f8db(_0x1b4b61['next'](_0x3a5873));}catch(_0x39f165){_0x7740d7(_0x39f165);}}function _0x4aa999(_0x1b255c){try{_0x51f8db(_0x1b4b61[a6_0x522a('0x3c')](_0x1b255c));}catch(_0xa96b82){_0x7740d7(_0xa96b82);}}function _0x51f8db(_0x295942){_0x295942[a6_0x522a('0x14')]?_0xb58362(_0x295942[a6_0x522a('0x27')]):_0x44daf4(_0x295942[a6_0x522a('0x27')])[a6_0x522a('0xb')](_0x429944,_0x4aa999);}_0x51f8db((_0x1b4b61=_0x1b4b61[a6_0x522a('0x3')](_0x59e3ee,_0x491164||[]))[a6_0x522a('0x1b')]());});};Object[a6_0x522a('0x33')](exports,a6_0x522a('0x1'),{'value':!![]});exports[a6_0x522a('0x8')]=void 0x0;const fs_1=require('fs');const stripJsonComments=require(a6_0x522a('0xc'));const yargsParser=require(a6_0x522a('0x9'));const environment_1=require('../../../utilities/environment');const metric_logger_1=require(a6_0x522a('0x54'));const print_cacheable_targets_error_1=require(a6_0x522a('0x26'));const print_invalid_runner_error_1=require(a6_0x522a('0xa'));const print_run_group_error_1=require('../../error/print-run-group-error');const distributed_agent_api_1=require('./distributed-agent.api');const execute_tasks_1=require(a6_0x522a('0x48'));const dte_artifact_storage_1=require(a6_0x522a('0x18'));const file_storage_1=require(a6_0x522a('0x4a'));const e2e_encryption_1=require(a6_0x522a('0x2e'));const error_reporter_api_1=require(a6_0x522a('0x10'));const invoke_tasks_using_run_many_1=require(a6_0x522a('0x2d'));const invoke_tasks_using_nx_imperative_api_1=require(a6_0x522a('0x53'));const is_workspace_enabled_1=require('../../../utilities/is-workspace-enabled');const {output,initTasksRunner,workspaceRoot,cacheDirectory}=require('../../../utilities/nx-imports');const args=yargsParser(process[a6_0x522a('0x24')],{'array':[a6_0x522a('0x51')],'default':{}});if(args[a6_0x522a('0x51')]&&args['targets'][a6_0x522a('0x20')]===0x1){args[a6_0x522a('0x51')]=args[a6_0x522a('0x51')][0x0]['split'](',')[a6_0x522a('0x28')](_0x129218=>_0x129218[a6_0x522a('0x47')]());}function startAgent(){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x55e862=(0x0,environment_1['getBranch'])();const _0x29786a=(0x0,environment_1[a6_0x522a('0x2a')])();const _0x5d0882=(0x0,environment_1[a6_0x522a('0x3d')])();const _0x47fb50=(0x0,environment_1[a6_0x522a('0x37')])();if(!(0x0,print_run_group_error_1['canDetectRunGroup'])(_0x29786a,_0x5d0882)){(0x0,print_run_group_error_1[a6_0x522a('0x1c')])();process[a6_0x522a('0x4e')](0x1);}if(args[a6_0x522a('0x51')]&&args['targets'][a6_0x522a('0x20')]){output[a6_0x522a('0x39')]({'title':a6_0x522a('0x3f')+args[a6_0x522a('0x51')][a6_0x522a('0x43')](',\x20')+']'});}else{output[a6_0x522a('0x39')]({'title':a6_0x522a('0x19')});}const _0xadd020=JSON[a6_0x522a('0x4f')](stripJsonComments((0x0,fs_1[a6_0x522a('0x1f')])(workspaceRoot+'/nx.json')['toString']()))['tasksRunnerOptions'][a6_0x522a('0x6')];if(_0xadd020['runner']!==a6_0x522a('0x4')&&_0xadd020[a6_0x522a('0x16')]!==a6_0x522a('0x15')){(0x0,print_invalid_runner_error_1['printInvalidRunnerError'])();return process[a6_0x522a('0x4e')](0x1);}const _0x2dd6f9=_0xadd020[a6_0x522a('0x17')];if(args[a6_0x522a('0x51')]&&args[a6_0x522a('0x51')][a6_0x522a('0x4c')](_0x5330eb=>{var _0x14433a;return!((_0x14433a=_0x2dd6f9[a6_0x522a('0x32')])===null||_0x14433a===void 0x0?void 0x0:_0x14433a[a6_0x522a('0x3e')](_0x5330eb));})){const _0x5e07a1=args[a6_0x522a('0x51')][a6_0x522a('0x12')](_0x151929=>{var _0x519679;return!((_0x519679=_0x2dd6f9[a6_0x522a('0x32')])===null||_0x519679===void 0x0?void 0x0:_0x519679['includes'](_0x151929));});(0x0,print_cacheable_targets_error_1[a6_0x522a('0x1e')])(_0x5e07a1);return process['exit'](0x1);}const _0x3d9fb5=yield(0x0,is_workspace_enabled_1['isWorkspaceEnabled'])(_0x2dd6f9);if(!_0x3d9fb5){output['error']({'title':a6_0x522a('0xd'),'bodyLines':[a6_0x522a('0x2f'),'',a6_0x522a('0x50')]});process[a6_0x522a('0x4e')](0x1);}const _0x34ec7d=getAgentName();const _0x275209=new distributed_agent_api_1[(a6_0x522a('0x31'))](_0x2dd6f9,_0x55e862,_0x29786a,_0x5d0882,_0x47fb50,_0x34ec7d);createAgentLockfileAndSetUpListeners(_0x275209,_0x2dd6f9,_0x34ec7d);const _0x1064ab=new e2e_encryption_1[(a6_0x522a('0x5'))](environment_1[a6_0x522a('0x1d')]||_0x2dd6f9[a6_0x522a('0x0')]);const _0x33e7c5=new error_reporter_api_1[(a6_0x522a('0x40'))](_0x2dd6f9);const _0x163bdc=new dte_artifact_storage_1[(a6_0x522a('0x52'))](new file_storage_1[(a6_0x522a('0x45'))](_0x1064ab,_0x33e7c5,_0x2dd6f9,'dte-agent'),cacheDirectory);const _0x4810a9=initTasksRunner?yield(0x0,invoke_tasks_using_nx_imperative_api_1['invokeTasksUsingNxImperativeApi'])(_0x2dd6f9):yield(0x0,invoke_tasks_using_run_many_1['invokeTasksUsingRunMany'])();return(0x0,execute_tasks_1['executeTasks'])(_0x34ec7d,_0x275209,_0x163bdc,_0x4810a9,args[a6_0x522a('0x51')])['then'](_0x55a075=>__awaiter(this,void 0x0,void 0x0,function*(){yield(0x0,metric_logger_1['submitRunMetrics'])(_0x2dd6f9);return _0x55a075;}))['catch'](_0x230b16=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x275209[a6_0x522a('0x49')](a6_0x522a('0x22')+_0x230b16['message']+'\x22');throw _0x230b16;}));});}exports[a6_0x522a('0x8')]=startAgent;function getAgentName(){if(process['env'][a6_0x522a('0x4d')]!==undefined){return process[a6_0x522a('0x4b')][a6_0x522a('0x4d')];}else if(process['env'][a6_0x522a('0x7')]!==undefined&&process[a6_0x522a('0x4b')][a6_0x522a('0x38')]){return process[a6_0x522a('0x4b')]['CIRCLE_STAGE'];}else if(process[a6_0x522a('0x4b')][a6_0x522a('0x7')]!==undefined&&process[a6_0x522a('0x4b')][a6_0x522a('0x21')]){return process[a6_0x522a('0x4b')][a6_0x522a('0x21')];}else{return a6_0x522a('0x3a')+Math[a6_0x522a('0xf')](Math[a6_0x522a('0x11')]()*0x186a0);}}function createAgentLockfileAndSetUpListeners(_0x55aed0,_0x5cff82,_0x2ce32a){const _0x1a06b4=cacheDirectory+a6_0x522a('0x23');const _0xc6d129=_0x1a06b4+'/'+_0x2ce32a+a6_0x522a('0x3b');if(!(0x0,fs_1[a6_0x522a('0x44')])(_0x1a06b4)){(0x0,fs_1['mkdirSync'])(_0x1a06b4,{'recursive':!![]});}const _0x1523dd=(0x0,fs_1[a6_0x522a('0x25')])(_0x1a06b4);if(_0x1523dd[a6_0x522a('0x20')]){if(_0x1523dd['includes'](_0x2ce32a+'.lock')){output[a6_0x522a('0x42')]({'title':a6_0x522a('0x41'),'bodyLines':[a6_0x522a('0x36'),'',a6_0x522a('0xe')]});process[a6_0x522a('0x4e')](0x1);}output[a6_0x522a('0x35')]({'title':a6_0x522a('0x46'),'bodyLines':[a6_0x522a('0x34'),'',a6_0x522a('0x13'),a6_0x522a('0x2b')]});}(0x0,fs_1[a6_0x522a('0x1a')])(_0xc6d129,'');process['on'](a6_0x522a('0x4e'),_0x2149d0=>{cleanupAgentLockfile(_0xc6d129,_0x2149d0);});process['on'](a6_0x522a('0x2c'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x55aed0[a6_0x522a('0x49')]('Agent\x20was\x20terminated\x20via\x20SIGTERM');cleanupAgentLockfile(_0xc6d129,0x1);}));process['on'](a6_0x522a('0x29'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x55aed0['completeRunGroupWithError'](a6_0x522a('0x2'));cleanupAgentLockfile(_0xc6d129,0x1);}));}function cleanupAgentLockfile(_0x10580c,_0x39677e){if((0x0,fs_1[a6_0x522a('0x44')])(_0x10580c)){(0x0,fs_1[a6_0x522a('0x30')])(_0x10580c);process[a6_0x522a('0x4e')](_0x39677e);}}
"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 fs_1 = require("fs");
const stripJsonComments = require("strip-json-comments");
const yargsParser = require("yargs-parser");
const environment_1 = require("../../../utilities/environment");
const metric_logger_1 = require("../../../utilities/metric-logger");
const print_cacheable_targets_error_1 = require("../../error/print-cacheable-targets-error");
const print_invalid_runner_error_1 = require("../../error/print-invalid-runner-error");
const print_run_group_error_1 = require("../../error/print-run-group-error");
const distributed_agent_api_1 = require("./distributed-agent.api");
const execute_tasks_1 = require("./execute-tasks");
const dte_artifact_storage_1 = require("../../../utilities/dte-artifact-storage");
const file_storage_1 = require("../../file-storage/file-storage");
const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
const error_reporter_api_1 = require("../../api/error-reporter.api");
const invoke_tasks_using_run_many_1 = require("./invoke-tasks-using-run-many");
const invoke_tasks_using_nx_imperative_api_1 = require("./invoke-tasks-using-nx-imperative-api");
const is_workspace_enabled_1 = require("../../../utilities/is-workspace-enabled");
const { output, initTasksRunner, workspaceRoot, cacheDirectory, } = require('../../../utilities/nx-imports');
const args = yargsParser(process.argv, {
array: ['targets'],
default: {},
});
// just in case someone passes the args with commas
// cf. https://github.com/yargs/yargs/issues/846
if (args.targets && args.targets.length === 1) {
args.targets = args.targets[0].split(',').map((x) => x.trim());
}
function startAgent() {
return __awaiter(this, void 0, void 0, function* () {
const branch = (0, environment_1.getBranch)();
const runGroup = (0, environment_1.getRunGroup)();
const ciExecutionId = (0, environment_1.getCIExecutionId)();
const ciExecutionEnv = (0, environment_1.getCIExecutionEnv)();
if (!(0, print_run_group_error_1.canDetectRunGroup)(runGroup, ciExecutionId)) {
(0, print_run_group_error_1.printRunGroupError)();
process.exit(1);
}
if (args.targets && args.targets.length) {
output.note({
title: `Starting an agent for running Nx target(s) [${args.targets.join(', ')}]`,
});
}
else {
output.note({
title: 'Starting an agent for running Nx tasks',
});
}
const defaultRunnerConfig = JSON.parse(stripJsonComments((0, fs_1.readFileSync)(`${workspaceRoot}/nx.json`).toString())).tasksRunnerOptions.default;
if (defaultRunnerConfig.runner !== 'nx-cloud' &&
defaultRunnerConfig.runner !== '@nrwl/nx-cloud') {
(0, print_invalid_runner_error_1.printInvalidRunnerError)();
return process.exit(1);
}
const options = defaultRunnerConfig.options;
if (args.targets &&
args.targets.some((target) => { var _a; return !((_a = options.cacheableOperations) === null || _a === void 0 ? void 0 : _a.includes(target)); })) {
const wrongTargets = args.targets.filter((target) => { var _a; return !((_a = options.cacheableOperations) === null || _a === void 0 ? void 0 : _a.includes(target)); });
(0, print_cacheable_targets_error_1.printCacheableTargetsError)(wrongTargets);
return process.exit(1);
}
const workspaceEnabled = yield (0, is_workspace_enabled_1.isWorkspaceEnabled)(options);
if (!workspaceEnabled) {
output.error({
title: 'Nx Cloud: Workspace is disabled',
bodyLines: [
'Distributed Task Execution is disabled when your workspace is disabled',
'',
"Organization administrators can find more information on the 'Billing and Plans' page in the Nx Cloud Webapp",
],
});
process.exit(1);
}
const agentName = getAgentName();
const api = new distributed_agent_api_1.DistributedAgentApi(options, branch, runGroup, ciExecutionId, ciExecutionEnv, agentName);
createAgentLockfileAndSetUpListeners(api, options, agentName);
const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
const errorReporter = new error_reporter_api_1.ErrorReporterApi(options);
const dteArtifactStorage = new dte_artifact_storage_1.DteArtifactStorage(new file_storage_1.FileStorage(encryption, errorReporter, options, 'dte-agent'), cacheDirectory);
const invokeTasks = initTasksRunner
? yield (0, invoke_tasks_using_nx_imperative_api_1.invokeTasksUsingNxImperativeApi)(options)
: yield (0, invoke_tasks_using_run_many_1.invokeTasksUsingRunMany)();
return (0, execute_tasks_1.executeTasks)(agentName, api, dteArtifactStorage, invokeTasks, args.targets)
.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;
function getAgentName() {
if (process.env.NX_AGENT_NAME !== undefined) {
return process.env.NX_AGENT_NAME;
}
else if (process.env.CIRCLECI !== undefined && process.env.CIRCLE_STAGE) {
return process.env.CIRCLE_STAGE;
}
else if (process.env.CIRCLECI !== undefined && process.env.CIRCLE_JOB) {
return process.env.CIRCLE_JOB;
}
else {
return `Agent ${Math.floor(Math.random() * 100000)}`;
}
}
function createAgentLockfileAndSetUpListeners(api, options, agentName) {
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', (code) => {
cleanupAgentLockfile(lockFilePath, code);
});
process.on('SIGTERM', () => __awaiter(this, void 0, void 0, function* () {
yield api.completeRunGroupWithError('Agent was terminated via SIGTERM');
cleanupAgentLockfile(lockFilePath, 1);
}));
process.on('SIGINT', () => __awaiter(this, void 0, void 0, function* () {
yield api.completeRunGroupWithError('Agent was terminated via SIGINT');
cleanupAgentLockfile(lockFilePath, 1);
}));
}
function cleanupAgentLockfile(lockFilePath, code) {
if ((0, fs_1.existsSync)(lockFilePath)) {
(0, fs_1.unlinkSync)(lockFilePath);
process.exit(code);
}
}
//# sourceMappingURL=distributed-agent.impl.js.map

@@ -1,1 +0,114 @@

const a7_0x4c74=['apply','completed','VERBOSE_LOGGING','createUnchangedValueTimeout','__esModule','status','number\x20of\x20tasks:\x20','url','\x20Hash:\x20','../../../utilities/nx-imports','tasks','note','../../../utilities/waiter','hash','retrieveAndExtract','Error:','NO_FURTHER_TASKS_TO_RUN','maxParallel:\x20','maxParallel','../../../utilities/environment','getTime','completed:\x20','reset','executionId','RUN_GROUP_COMPLETED','retryDuring:\x20','taskId','value','then','completedTasks','criticalErrorMessage','wait','__awaiter','\x20seconds','\x20fetching\x20tasks...','done','No\x20new\x20messages\x20received\x20after\x20','\x20downloading\x20artifacts\x20for\x20','../../../utilities/create-unchanged-value-timeout','join','retryDuring','NO_MESSAGES_TIMEOUT','length','exit','next','executionId:\x20','error:\x20','executeTasks','\x20waiting...','\x20Url:\x20'];(function(_0x3938c2,_0x4c7436){const _0x531570=function(_0x29efad){while(--_0x29efad){_0x3938c2['push'](_0x3938c2['shift']());}};_0x531570(++_0x4c7436);}(a7_0x4c74,0x154));const a7_0x5315=function(_0x3938c2,_0x4c7436){_0x3938c2=_0x3938c2-0x0;let _0x531570=a7_0x4c74[_0x3938c2];return _0x531570;};'use strict';var __awaiter=this&&this[a7_0x5315('0x2a')]||function(_0x5ace71,_0x423b58,_0x877493,_0x5553ec){function _0x5ede70(_0x3f3f7f){return _0x3f3f7f instanceof _0x877493?_0x3f3f7f:new _0x877493(function(_0x7accc0){_0x7accc0(_0x3f3f7f);});}return new(_0x877493||(_0x877493=Promise))(function(_0x293121,_0x87a030){function _0x5b0a9f(_0x4540c3){try{_0x166580(_0x5553ec[a7_0x5315('0x4')](_0x4540c3));}catch(_0x14073d){_0x87a030(_0x14073d);}}function _0x7a2278(_0x5d6502){try{_0x166580(_0x5553ec['throw'](_0x5d6502));}catch(_0x51bf7f){_0x87a030(_0x51bf7f);}}function _0x166580(_0x5d50d5){_0x5d50d5[a7_0x5315('0x2d')]?_0x293121(_0x5d50d5[a7_0x5315('0x25')]):_0x5ede70(_0x5d50d5[a7_0x5315('0x25')])[a7_0x5315('0x26')](_0x5b0a9f,_0x7a2278);}_0x166580((_0x5553ec=_0x5553ec[a7_0x5315('0xa')](_0x5ace71,_0x423b58||[]))[a7_0x5315('0x4')]());});};Object['defineProperty'](exports,a7_0x5315('0xe'),{'value':!![]});exports[a7_0x5315('0x7')]=void 0x0;const create_unchanged_value_timeout_1=require(a7_0x5315('0x30'));const environment_1=require(a7_0x5315('0x1d'));const waiter_1=require(a7_0x5315('0x16'));const {output}=require(a7_0x5315('0x13'));function executeTasks(_0x313d9c,_0xe5817d,_0x3c8379,_0x28d36f,_0x1a8ae8){return __awaiter(this,void 0x0,void 0x0,function*(){let _0x203947=0x0;let _0x1033ea=null;const _0x46421d=(0x0,create_unchanged_value_timeout_1[a7_0x5315('0xd')])({'title':a7_0x5315('0x2e')+environment_1[a7_0x5315('0x1')]/0x3e8+a7_0x5315('0x2b'),'timeout':environment_1['NO_MESSAGES_TIMEOUT']});const _0x40598e=new waiter_1['Waiter']();let _0x21b0a7=[];const _0xacd8b6=new Date();let _0x110672=![];const _0x1b73c2={};while(!![]){if(environment_1[a7_0x5315('0xc')]){output[a7_0x5315('0x15')]({'title':_0x313d9c+a7_0x5315('0x2c')});}_0x1033ea=yield _0xe5817d[a7_0x5315('0x14')](_0x1033ea?_0x1033ea[a7_0x5315('0x21')]:null,_0x203947,_0x21b0a7,_0x1a8ae8);if(environment_1[a7_0x5315('0xc')]){output['note']({'title':_0x313d9c+'\x20received\x20an\x20API\x20Response','bodyLines':[a7_0x5315('0x1f')+_0x1033ea[a7_0x5315('0xb')],'status:\x20'+_0x1033ea[a7_0x5315('0xf')],a7_0x5315('0x23')+_0x1033ea[a7_0x5315('0x0')],a7_0x5315('0x5')+_0x1033ea[a7_0x5315('0x21')],a7_0x5315('0x10')+_0x1033ea['tasks'][a7_0x5315('0x2')],a7_0x5315('0x6')+_0x1033ea[a7_0x5315('0x28')],a7_0x5315('0x1b')+_0x1033ea['maxParallel']]});}if(_0x1033ea[a7_0x5315('0x28')]){output['error']({'title':'Distributed\x20Execution\x20Terminated','bodyLines':[a7_0x5315('0x19'),_0x1033ea[a7_0x5315('0x28')]]});process[a7_0x5315('0x3')](0x0);}if((_0x1033ea===null||_0x1033ea===void 0x0?void 0x0:_0x1033ea[a7_0x5315('0x0')])&&(_0x1033ea===null||_0x1033ea===void 0x0?void 0x0:_0x1033ea['retryDuring'])!==0x0&&!_0x110672&&new Date()[a7_0x5315('0x1e')]()-_0xacd8b6[a7_0x5315('0x1e')]()>_0x1033ea[a7_0x5315('0x0')]){yield _0x40598e[a7_0x5315('0x29')]();continue;}if((_0x1033ea===null||_0x1033ea===void 0x0?void 0x0:_0x1033ea[a7_0x5315('0xf')])!==undefined){if(_0x1033ea[a7_0x5315('0xf')]===a7_0x5315('0x22')||_0x1033ea[a7_0x5315('0xf')]===a7_0x5315('0x1a')){return;}}else if(_0x1033ea['completed']){return;}_0x46421d(_0x1033ea[a7_0x5315('0x14')]['map'](_0x25afe3=>_0x25afe3['taskId'])[a7_0x5315('0x31')](''));if(!_0x1033ea['executionId']){if(environment_1[a7_0x5315('0xc')]){output[a7_0x5315('0x15')]({'title':_0x313d9c+a7_0x5315('0x8')});}yield _0x40598e[a7_0x5315('0x29')]();_0x203947=0x0;_0x21b0a7=[];continue;}_0x40598e[a7_0x5315('0x20')]();_0x110672=!![];if(_0x1033ea['completedTasks']){for(const _0x6d5de1 of _0x1033ea[a7_0x5315('0x27')]){if(_0x1b73c2[_0x6d5de1['taskId']])continue;output[a7_0x5315('0x15')]({'title':_0x313d9c+a7_0x5315('0x2f')+_0x6d5de1[a7_0x5315('0x24')]+a7_0x5315('0x12')+_0x6d5de1[a7_0x5315('0x17')]+a7_0x5315('0x9')+_0x6d5de1[a7_0x5315('0x11')]});yield _0x3c8379[a7_0x5315('0x18')](_0x6d5de1[a7_0x5315('0x17')],_0x6d5de1[a7_0x5315('0x11')]);_0x1b73c2[_0x6d5de1[a7_0x5315('0x24')]]=!![];}}const _0x1913cd=yield _0x28d36f(_0x1033ea[a7_0x5315('0x21')],_0x1033ea['tasks'],_0x1033ea[a7_0x5315('0x1c')]);for(const _0x2d2b26 of _0x1913cd['completedTasks']){_0x1b73c2[_0x2d2b26['taskId']]=!![];}_0x203947=_0x1913cd['completedStatusCode'];_0x21b0a7=_0x1913cd['completedTasks'];}});}exports[a7_0x5315('0x7')]=executeTasks;
"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.executeTasks = void 0;
const create_unchanged_value_timeout_1 = require("../../../utilities/create-unchanged-value-timeout");
const environment_1 = require("../../../utilities/environment");
const waiter_1 = require("../../../utilities/waiter");
const { output } = require('../../../utilities/nx-imports');
function executeTasks(agentName, api, dteArtifactStorage, invokeTasks, targets) {
return __awaiter(this, void 0, void 0, function* () {
let completedStatusCode = 0;
let apiResponse = null;
const failIfSameTasksAfterTimeout = (0, create_unchanged_value_timeout_1.createUnchangedValueTimeout)({
title: `No new messages received after ${environment_1.NO_MESSAGES_TIMEOUT / 1000} seconds`,
timeout: environment_1.NO_MESSAGES_TIMEOUT,
});
const waiter = new waiter_1.Waiter();
let completedTasks = [];
const startTime = new Date();
let executedAnyTasks = false;
const processedTasks = {};
while (true) {
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: `${agentName} fetching tasks...`,
});
}
apiResponse = yield api.tasks(apiResponse ? apiResponse.executionId : null, completedStatusCode, completedTasks, targets);
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: `${agentName} received an API Response`,
bodyLines: [
`completed: ${apiResponse.completed}`,
`status: ${apiResponse.status}`,
`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 === null || apiResponse === void 0 ? void 0 : apiResponse.status) !== undefined) {
if (apiResponse.status === 'RUN_GROUP_COMPLETED' ||
apiResponse.status === 'NO_FURTHER_TASKS_TO_RUN') {
return;
}
}
else if (apiResponse.completed) {
return;
}
// if status is present that use the status instead of completed, otherwise use completed
failIfSameTasksAfterTimeout(apiResponse.tasks.map((t) => t.taskId).join(''));
if (!apiResponse.executionId) {
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: `${agentName} waiting...`,
});
}
yield waiter.wait();
completedStatusCode = 0;
completedTasks = [];
continue;
}
waiter.reset();
executedAnyTasks = true;
if (apiResponse.completedTasks) {
for (const t of apiResponse.completedTasks) {
if (processedTasks[t.taskId])
continue;
output.note({
title: `${agentName} downloading artifacts for ${t.taskId} Hash: ${t.hash} Url: ${t.url}`,
});
yield dteArtifactStorage.retrieveAndExtract(t.hash, t.url);
processedTasks[t.taskId] = true;
}
}
const r = yield invokeTasks(apiResponse.executionId, apiResponse.tasks, apiResponse.maxParallel);
for (const t of r.completedTasks) {
processedTasks[t.taskId] = true;
}
completedStatusCode = r.completedStatusCode;
completedTasks = r.completedTasks;
}
});
}
exports.executeTasks = executeTasks;
//# sourceMappingURL=execute-tasks.js.map

@@ -1,1 +0,58 @@

const a8_0x1659=['../../../utilities/serializer-overrides','apply','NX_PREFIX_OUTPUT','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','assign','status','../../../utilities/nx-imports','invokeTasksUsingNxImperativeApi','NX_STREAM_OUTPUT','length','value','yargs-parser','configuration','__esModule','values','true','defineProperty','done','NX_CACHE_FAILURES','then','map','env','taskId','throw','hash'];(function(_0x65c9f7,_0x1659f3){const _0x4b9b12=function(_0x5c9d8e){while(--_0x5c9d8e){_0x65c9f7['push'](_0x65c9f7['shift']());}};_0x4b9b12(++_0x1659f3);}(a8_0x1659,0x7e));const a8_0x4b9b=function(_0x65c9f7,_0x1659f3){_0x65c9f7=_0x65c9f7-0x0;let _0x4b9b12=a8_0x1659[_0x65c9f7];return _0x4b9b12;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x1807ea,_0x7f90b0,_0x5b2db6,_0x5aaac9){function _0x15e837(_0xe77922){return _0xe77922 instanceof _0x5b2db6?_0xe77922:new _0x5b2db6(function(_0x42f7b7){_0x42f7b7(_0xe77922);});}return new(_0x5b2db6||(_0x5b2db6=Promise))(function(_0x866aa3,_0x434a96){function _0x587cd4(_0x407364){try{_0x9cf080(_0x5aaac9['next'](_0x407364));}catch(_0x133f04){_0x434a96(_0x133f04);}}function _0x3ecc07(_0x450584){try{_0x9cf080(_0x5aaac9[a8_0x4b9b('0x16')](_0x450584));}catch(_0x6b4484){_0x434a96(_0x6b4484);}}function _0x9cf080(_0x29adb1){_0x29adb1[a8_0x4b9b('0x10')]?_0x866aa3(_0x29adb1[a8_0x4b9b('0x9')]):_0x15e837(_0x29adb1[a8_0x4b9b('0x9')])[a8_0x4b9b('0x12')](_0x587cd4,_0x3ecc07);}_0x9cf080((_0x5aaac9=_0x5aaac9[a8_0x4b9b('0x0')](_0x1807ea,_0x7f90b0||[]))['next']());});};Object[a8_0x4b9b('0xf')](exports,a8_0x4b9b('0xc'),{'value':!![]});exports[a8_0x4b9b('0x6')]=void 0x0;const {initTasksRunner}=require(a8_0x4b9b('0x5'));const parser=require(a8_0x4b9b('0xa'));const serializer_overrides_1=require(a8_0x4b9b('0x18'));function invokeTasksUsingNxImperativeApi(_0x1567c3){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x245a8a=yield initTasksRunner(_0x1567c3);return(_0x1d4f69,_0x2dc21b,_0x3cdd0d)=>__awaiter(this,void 0x0,void 0x0,function*(){const _0x4662e3=_0x2dc21b[a8_0x4b9b('0x13')](_0x4c83a0=>{const _0x16db2e=parser(_0x4c83a0['params'],{'configuration':{'camel-case-expansion':![],'dot-notation':!![]}});const _0x305bb1=(0x0,serializer_overrides_1['unparse'])(_0x16db2e);if(_0x16db2e['_'][a8_0x4b9b('0x8')]==0x0){delete _0x16db2e['_'];}return{'id':_0x4c83a0[a8_0x4b9b('0x15')],'target':{'project':_0x4c83a0['projectName'],'target':_0x4c83a0['target'],'configuration':_0x4c83a0[a8_0x4b9b('0xb')]},'overrides':Object[a8_0x4b9b('0x3')](Object['assign']({},_0x16db2e),{'__overrides_unparsed__':_0x305bb1})};});process[a8_0x4b9b('0x14')][a8_0x4b9b('0x11')]=a8_0x4b9b('0xe');process['env'][a8_0x4b9b('0x2')]=_0x1d4f69;process[a8_0x4b9b('0x14')][a8_0x4b9b('0x7')]='true';process[a8_0x4b9b('0x14')][a8_0x4b9b('0x1')]=a8_0x4b9b('0xe');const _0x1f23da=yield _0x245a8a['invoke']({'tasks':_0x4662e3,'parallel':_0x3cdd0d});const _0x449d2a=Object[a8_0x4b9b('0xd')](_0x1f23da['taskGraph']['tasks']);return{'completedTasks':_0x449d2a['map'](_0x25fad7=>({'taskId':_0x25fad7['id'],'hash':_0x25fad7[a8_0x4b9b('0x17')]})),'completedStatusCode':_0x1f23da[a8_0x4b9b('0x4')]};});});}exports[a8_0x4b9b('0x6')]=invokeTasksUsingNxImperativeApi;
"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.invokeTasksUsingNxImperativeApi = void 0;
const { initTasksRunner } = require('../../../utilities/nx-imports');
const parser = require("yargs-parser");
const serializer_overrides_1 = require("../../../utilities/serializer-overrides");
function invokeTasksUsingNxImperativeApi(options) {
return __awaiter(this, void 0, void 0, function* () {
const tasksRunner = yield initTasksRunner(options);
return (executionId, tasksToExecute, parallel) => __awaiter(this, void 0, void 0, function* () {
const tasks = tasksToExecute.map((t) => {
const params = parser(t.params, {
configuration: {
'camel-case-expansion': false,
'dot-notation': true,
},
});
const unparsed = (0, serializer_overrides_1.unparse)(params);
if (params._.length == 0) {
delete params._;
}
return {
id: t.taskId,
target: {
project: t.projectName,
target: t.target,
configuration: t.configuration,
},
overrides: Object.assign(Object.assign({}, params), { __overrides_unparsed__: unparsed }),
};
});
process.env.NX_CACHE_FAILURES = 'true'; // this is only requires because of how we do uploads
process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID = executionId;
process.env.NX_STREAM_OUTPUT = 'true';
process.env.NX_PREFIX_OUTPUT = 'true';
const r = yield tasksRunner.invoke({ tasks, parallel });
const completedTasks = Object.values(r.taskGraph.tasks);
return {
completedTasks: completedTasks.map((t) => ({
taskId: t.id,
hash: t.hash,
})),
completedStatusCode: r.status,
};
});
});
}
exports.invokeTasksUsingNxImperativeApi = invokeTasksUsingNxImperativeApi;
//# sourceMappingURL=invoke-tasks-using-nx-imperative-api.js.map

@@ -1,1 +0,96 @@

const a9_0x2bf8=['true','join','ignore','status','find','push','unlinkSync','length','next','done','projects','VERBOSE_LOGGING','inherit','child_process','env','__awaiter','value','npx\x20nx\x20run-many\x20--target=','/tasks-hashes-','params','forEach','then','defineProperty','DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE','toString','configuration','parse','invokeTasksUsingRunMany','assign','--configuration=','apply','\x20--parallel\x20--max-parallel=','target'];(function(_0x3289c9,_0x2bf872){const _0x2772ae=function(_0x138306){while(--_0x138306){_0x3289c9['push'](_0x3289c9['shift']());}};_0x2772ae(++_0x2bf872);}(a9_0x2bf8,0x138));const a9_0x2772=function(_0x3289c9,_0x2bf872){_0x3289c9=_0x3289c9-0x0;let _0x2772ae=a9_0x2bf8[_0x3289c9];return _0x2772ae;};'use strict';var __awaiter=this&&this[a9_0x2772('0x0')]||function(_0x5a45b4,_0x4eed74,_0x3bc304,_0x8a274){function _0x3af470(_0x5a7c4b){return _0x5a7c4b instanceof _0x3bc304?_0x5a7c4b:new _0x3bc304(function(_0x4ad47a){_0x4ad47a(_0x5a7c4b);});}return new(_0x3bc304||(_0x3bc304=Promise))(function(_0x417cfa,_0x229b14){function _0x2dc84f(_0x5ccb7e){try{_0x464507(_0x8a274[a9_0x2772('0x1a')](_0x5ccb7e));}catch(_0x578819){_0x229b14(_0x578819);}}function _0xfa2a16(_0x10f509){try{_0x464507(_0x8a274['throw'](_0x10f509));}catch(_0x229e08){_0x229b14(_0x229e08);}}function _0x464507(_0x4015bc){_0x4015bc[a9_0x2772('0x1b')]?_0x417cfa(_0x4015bc[a9_0x2772('0x1')]):_0x3af470(_0x4015bc[a9_0x2772('0x1')])[a9_0x2772('0x6')](_0x2dc84f,_0xfa2a16);}_0x464507((_0x8a274=_0x8a274[a9_0x2772('0xf')](_0x5a45b4,_0x4eed74||[]))['next']());});};Object[a9_0x2772('0x7')](exports,'__esModule',{'value':!![]});exports[a9_0x2772('0xc')]=void 0x0;const environment_1=require('../../../utilities/environment');const child_process_1=require(a9_0x2772('0x1f'));const fs_1=require('fs');const {output,cacheDirectory}=require('../../../utilities/nx-imports');function invokeTasksUsingRunMany(){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x4a4b14=completedTasksReader();return function _0x1a2db8(_0x26e0ec,_0x36fadb,_0x4472f3){return __awaiter(this,void 0x0,void 0x0,function*(){let _0x41ebcd=0x0;const _0x3f5656=[];for(const _0x26b42d of groupByTarget(_0x36fadb)){const _0x3e4c77=_0x26b42d[a9_0x2772('0xa')]?a9_0x2772('0xe')+_0x26b42d['configuration']:'';const _0x543e67=_0x4472f3>0x1?a9_0x2772('0x10')+_0x4472f3:'';const _0x119567=a9_0x2772('0x2')+_0x26b42d[a9_0x2772('0x11')]+'\x20'+_0x3e4c77+'\x20--projects='+_0x26b42d[a9_0x2772('0x1c')][a9_0x2772('0x13')](',')+'\x20'+_0x26b42d[a9_0x2772('0x4')]+_0x543e67;if(environment_1[a9_0x2772('0x1d')]){output['note']({'title':'Executing:\x20\x27'+_0x119567+'\x27'});}try{(0x0,child_process_1['execSync'])(_0x119567,{'stdio':[a9_0x2772('0x14'),a9_0x2772('0x1e'),'inherit'],'env':Object[a9_0x2772('0xd')](Object[a9_0x2772('0xd')]({},process[a9_0x2772('0x20')]),{'NX_CACHE_FAILURES':'true','NX_CLOUD_DISTRIBUTED_EXECUTION_ID':_0x26e0ec,'NX_STREAM_OUTPUT':'true','NX_PREFIX_OUTPUT':a9_0x2772('0x12')})});_0x3f5656[a9_0x2772('0x17')](..._0x4a4b14(_0x26e0ec));}catch(_0x918ba7){if(_0x918ba7[a9_0x2772('0x15')]===environment_1[a9_0x2772('0x8')]){throw _0x918ba7;}else{_0x41ebcd=0x1;_0x3f5656['push'](..._0x4a4b14(_0x26e0ec));}}}return{'completedStatusCode':_0x41ebcd,'completedTasks':_0x3f5656};});};});}exports[a9_0x2772('0xc')]=invokeTasksUsingRunMany;function groupByTarget(_0xfae45d){const _0x4a5b58=[];_0xfae45d[a9_0x2772('0x5')](_0x2c6ebe=>{const _0x23bc9a=_0x4a5b58[a9_0x2772('0x16')](_0x142e4f=>_0x142e4f[a9_0x2772('0x11')]===_0x2c6ebe[a9_0x2772('0x11')]&&_0x142e4f['configuration']===_0x2c6ebe[a9_0x2772('0xa')]);if(_0x23bc9a){_0x23bc9a[a9_0x2772('0x1c')][a9_0x2772('0x17')](_0x2c6ebe['projectName']);}else{_0x4a5b58[a9_0x2772('0x17')]({'target':_0x2c6ebe[a9_0x2772('0x11')],'projects':[_0x2c6ebe['projectName']],'params':_0x2c6ebe[a9_0x2772('0x4')],'configuration':_0x2c6ebe[a9_0x2772('0xa')]});}});return _0x4a5b58;}function completedTasksReader(){return _0x412020=>{const _0x4ecbe4='Command\x20execution\x20failed\x20(distributed\x20task\x20execution:\x20'+_0x412020+').\x20Tasks\x20hashes\x20haven\x27t\x20been\x20recorded.';let _0x5d5ee1;try{const _0x3061ec=cacheDirectory+a9_0x2772('0x3')+_0x412020;_0x5d5ee1=JSON[a9_0x2772('0xb')]((0x0,fs_1['readFileSync'])(_0x3061ec)[a9_0x2772('0x9')]());(0x0,fs_1[a9_0x2772('0x18')])(_0x3061ec);}catch(_0xee9402){throw new Error(_0x4ecbe4);}if(_0x5d5ee1[a9_0x2772('0x19')]==0x0){throw new Error(_0x4ecbe4);}return _0x5d5ee1;};}
"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.invokeTasksUsingRunMany = void 0;
const environment_1 = require("../../../utilities/environment");
const child_process_1 = require("child_process");
const fs_1 = require("fs");
const { output, cacheDirectory } = require('../../../utilities/nx-imports');
function invokeTasksUsingRunMany() {
return __awaiter(this, void 0, void 0, function* () {
const readCompleted = completedTasksReader();
return function invokeTasksUsingRunMany(executionId, tasksToExecute, parallel) {
return __awaiter(this, void 0, void 0, function* () {
let completedStatusCode = 0;
const completedTasks = [];
for (const g of groupByTarget(tasksToExecute)) {
const config = g.configuration
? `--configuration=${g.configuration}`
: ``;
const parallelStr = parallel > 1 ? ` --parallel --max-parallel=${parallel}` : ``;
// TODO use pnpx or yarn when needed
const command = `npx nx run-many --target=${g.target} ${config} --projects=${g.projects.join(',')} ${g.params}${parallelStr}`;
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: `Executing: '${command}'`,
});
}
try {
(0, child_process_1.execSync)(command, {
stdio: ['ignore', 'inherit', 'inherit'],
env: Object.assign(Object.assign({}, process.env), { NX_CACHE_FAILURES: 'true', NX_CLOUD_DISTRIBUTED_EXECUTION_ID: executionId, NX_STREAM_OUTPUT: 'true', NX_PREFIX_OUTPUT: 'true' }),
});
completedTasks.push(...readCompleted(executionId));
}
catch (e) {
if (e.status === environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE) {
throw e;
}
else {
completedStatusCode = 1;
completedTasks.push(...readCompleted(executionId));
}
}
}
return { completedStatusCode, completedTasks };
});
};
});
}
exports.invokeTasksUsingRunMany = invokeTasksUsingRunMany;
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 completedTasksReader() {
return (distributedExecutionId) => {
const errorMessage = `Command execution failed (distributed task execution: ${distributedExecutionId}). Tasks hashes haven\'t been recorded.`;
let completedTasks;
try {
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;
};
}
//# sourceMappingURL=invoke-tasks-using-run-many.js.map

@@ -1,1 +0,154 @@

const a10_0x27b9=['map','../../../utilities/nx-imports','../../../utilities/serializer-overrides','DistributedExecutionApi','NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT','createMetricRecorder','/nx-cloud/executions/status','apply','../../../utilities/axios','next','Starting\x20a\x20distributed\x20execution','post','serializeOverrides','dteStart','ciExecutionEnv:\x20','runGroup:\x20','enabled','project','throw','../../../utilities/environment','parallel','createStartRequest','axiosException','value','axiosMultipleTries','message','NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE','target','/nx-cloud/executions/complete-run-group','maxParallel','error','exit','note','VERBOSE_LOGGING','status','defineProperty','createApiAxiosInstance','__awaiter','stopAgentsOnFailure','recordMetric','agentCount','done','mapRespToPerfEntry','/nx-cloud/executions/start','hash','then','response','apiAxiosInstance','false','data','RUNNER_FAILURE_PERF_ENTRY'];(function(_0xe96a71,_0x27b977){const _0x5a59be=function(_0x2a9613){while(--_0x2a9613){_0xe96a71['push'](_0xe96a71['shift']());}};_0x5a59be(++_0x27b977);}(a10_0x27b9,0xa1));const a10_0x5a59=function(_0xe96a71,_0x27b977){_0xe96a71=_0xe96a71-0x0;let _0x5a59be=a10_0x27b9[_0xe96a71];return _0x5a59be;};'use strict';var __awaiter=this&&this[a10_0x5a59('0x1d')]||function(_0x139c6b,_0x215184,_0x39bfb6,_0x584e7e){function _0x18f518(_0x1e3194){return _0x1e3194 instanceof _0x39bfb6?_0x1e3194:new _0x39bfb6(function(_0x27dbad){_0x27dbad(_0x1e3194);});}return new(_0x39bfb6||(_0x39bfb6=Promise))(function(_0x16864c,_0x42053e){function _0x4a7396(_0x2aa27a){try{_0x56e516(_0x584e7e[a10_0x5a59('0x1')](_0x2aa27a));}catch(_0x57204c){_0x42053e(_0x57204c);}}function _0x52bb5f(_0x4ed0bb){try{_0x56e516(_0x584e7e[a10_0x5a59('0xa')](_0x4ed0bb));}catch(_0x4b714a){_0x42053e(_0x4b714a);}}function _0x56e516(_0x184b16){_0x184b16[a10_0x5a59('0x21')]?_0x16864c(_0x184b16[a10_0x5a59('0xf')]):_0x18f518(_0x184b16[a10_0x5a59('0xf')])[a10_0x5a59('0x25')](_0x4a7396,_0x52bb5f);}_0x56e516((_0x584e7e=_0x584e7e[a10_0x5a59('0x32')](_0x139c6b,_0x215184||[]))[a10_0x5a59('0x1')]());});};Object[a10_0x5a59('0x1b')](exports,'__esModule',{'value':!![]});exports[a10_0x5a59('0xd')]=exports[a10_0x5a59('0x2e')]=void 0x0;const axios_1=require(a10_0x5a59('0x0'));const environment_1=require(a10_0x5a59('0xb'));const metric_logger_1=require('../../../utilities/metric-logger');const serializer_overrides_1=require(a10_0x5a59('0x2d'));const {output}=require(a10_0x5a59('0x2c'));class DistributedExecutionApi{constructor(_0x288d84){this['apiAxiosInstance']=(0x0,axios_1[a10_0x5a59('0x1c')])(_0x288d84);}['start'](_0x544e82){var _0x7dd91a;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x37a4e2=(0x0,metric_logger_1[a10_0x5a59('0x30')])(a10_0x5a59('0x5'));let _0x4d8220;if(environment_1[a10_0x5a59('0x19')]){output['note']({'title':a10_0x5a59('0x2'),'bodyLines':[JSON['stringify'](_0x544e82,null,0x2)]});}try{_0x4d8220=yield(0x0,axios_1[a10_0x5a59('0x10')])(()=>this[a10_0x5a59('0x27')][a10_0x5a59('0x3')](a10_0x5a59('0x23'),_0x544e82));_0x37a4e2['recordMetric']((0x0,metric_logger_1[a10_0x5a59('0x22')])(_0x4d8220));}catch(_0x1fc21d){_0x37a4e2['recordMetric'](((_0x7dd91a=_0x1fc21d===null||_0x1fc21d===void 0x0?void 0x0:_0x1fc21d[a10_0x5a59('0xe')])===null||_0x7dd91a===void 0x0?void 0x0:_0x7dd91a[a10_0x5a59('0x26')])?(0x0,metric_logger_1[a10_0x5a59('0x22')])(_0x1fc21d[a10_0x5a59('0xe')][a10_0x5a59('0x26')]):metric_logger_1[a10_0x5a59('0x2a')]);throw _0x1fc21d;}if(!_0x4d8220[a10_0x5a59('0x29')][a10_0x5a59('0x8')]){throw new Error('Workspace\x20is\x20disabled.\x20Cannot\x20perform\x20distributed\x20task\x20executions.');}if(_0x4d8220[a10_0x5a59('0x29')][a10_0x5a59('0x16')]){throw new Error(_0x4d8220['data'][a10_0x5a59('0x16')]);}return _0x4d8220[a10_0x5a59('0x29')]['id'];});}[a10_0x5a59('0x1a')](_0x2c3c9b){var _0x3a7892;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x77c70b=(0x0,metric_logger_1['createMetricRecorder'])('dteStatus');try{const _0x59c2f0=yield(0x0,axios_1[a10_0x5a59('0x10')])(()=>this[a10_0x5a59('0x27')][a10_0x5a59('0x3')](a10_0x5a59('0x31'),{'id':_0x2c3c9b}));_0x77c70b['recordMetric']((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x59c2f0));return _0x59c2f0[a10_0x5a59('0x29')];}catch(_0x2452aa){_0x77c70b['recordMetric'](((_0x3a7892=_0x2452aa===null||_0x2452aa===void 0x0?void 0x0:_0x2452aa[a10_0x5a59('0xe')])===null||_0x3a7892===void 0x0?void 0x0:_0x3a7892[a10_0x5a59('0x26')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x2452aa[a10_0x5a59('0xe')][a10_0x5a59('0x26')]):metric_logger_1[a10_0x5a59('0x2a')]);output[a10_0x5a59('0x16')]({'title':_0x2452aa[a10_0x5a59('0x11')]});process[a10_0x5a59('0x17')](0x1);}});}['completeRunGroupWithError'](_0x48c75e,_0x3c27ad,_0x17a464,_0x91f751,_0x2c82ff){var _0x1ce95d;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x5d75ab=(0x0,metric_logger_1[a10_0x5a59('0x30')])('completeRunGroup');if(environment_1[a10_0x5a59('0x19')]){output[a10_0x5a59('0x18')]({'title':'Completing\x20with\x20an\x20error','bodyLines':['ciExecutionId:\x20'+_0x17a464,a10_0x5a59('0x6')+_0x91f751,a10_0x5a59('0x7')+_0x3c27ad,'error:\x20'+_0x2c82ff]});}try{const _0x54f510=yield(0x0,axios_1[a10_0x5a59('0x10')])(()=>this[a10_0x5a59('0x27')][a10_0x5a59('0x3')](a10_0x5a59('0x14'),{'branch':_0x48c75e,'runGroup':_0x3c27ad,'ciExecutionId':_0x17a464,'ciExecutionEnv':_0x91f751,'criticalErrorMessage':_0x2c82ff}),0x3);_0x5d75ab[a10_0x5a59('0x1f')]((0x0,metric_logger_1[a10_0x5a59('0x22')])(_0x54f510));}catch(_0xdf4af1){_0x5d75ab[a10_0x5a59('0x1f')](((_0x1ce95d=_0xdf4af1===null||_0xdf4af1===void 0x0?void 0x0:_0xdf4af1[a10_0x5a59('0xe')])===null||_0x1ce95d===void 0x0?void 0x0:_0x1ce95d[a10_0x5a59('0x26')])?(0x0,metric_logger_1[a10_0x5a59('0x22')])(_0xdf4af1[a10_0x5a59('0xe')][a10_0x5a59('0x26')]):metric_logger_1[a10_0x5a59('0x2a')]);}});}}exports[a10_0x5a59('0x2e')]=DistributedExecutionApi;function createStartRequest(_0xe837e7,_0x3cf2a7,_0x272675,_0x2b5c0e,_0x37c86e,_0x535acc,_0x5106ad){const _0x491c4d=_0x37c86e[a10_0x5a59('0x2b')](_0x571d29=>{return _0x571d29['map'](_0x2531a2=>{return{'taskId':_0x2531a2['id'],'hash':_0x2531a2[a10_0x5a59('0x24')],'projectName':_0x2531a2[a10_0x5a59('0x13')][a10_0x5a59('0x9')],'target':_0x2531a2['target']['target'],'configuration':_0x2531a2[a10_0x5a59('0x13')]['configuration']||null,'params':(0x0,serializer_overrides_1[a10_0x5a59('0x4')])(_0x2531a2)};});});const _0x5c9371={'command':(0x0,environment_1['parseCommand'])(),'branch':_0xe837e7,'runGroup':_0x3cf2a7,'ciExecutionId':_0x272675,'ciExecutionEnv':_0x2b5c0e,'tasks':_0x491c4d,'maxParallel':calculateMaxParallel(_0x535acc),'commitSha':_0x5106ad};if(environment_1[a10_0x5a59('0x2f')]){_0x5c9371[a10_0x5a59('0x20')]=environment_1['NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT'];}if(!environment_1[a10_0x5a59('0x12')]){_0x5c9371[a10_0x5a59('0x1e')]=![];}return _0x5c9371;}exports['createStartRequest']=createStartRequest;function calculateMaxParallel(_0x54504f){if(_0x54504f[a10_0x5a59('0xc')]===a10_0x5a59('0x28')||_0x54504f[a10_0x5a59('0xc')]===![]){return 0x1;}else if(_0x54504f[a10_0x5a59('0xc')]==='true'||_0x54504f['parallel']===!![]){return Number(_0x54504f['maxParallel']||0x3);}else if(_0x54504f['parallel']===undefined){return _0x54504f[a10_0x5a59('0x15')]?Number(_0x54504f['maxParallel']):0x3;}else{return Number(_0x54504f[a10_0x5a59('0xc')])||0x3;}}
"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 serializer_overrides_1 = require("../../../utilities/serializer-overrides");
const { output } = 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;
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'Starting a distributed execution',
bodyLines: [JSON.stringify(params, null, 2)],
});
}
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(branch, runGroup, ciExecutionId, ciExecutionEnv, error) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const recorder = (0, metric_logger_1.createMetricRecorder)('completeRunGroup');
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'Completing with an error',
bodyLines: [
`ciExecutionId: ${ciExecutionId}`,
`ciExecutionEnv: ${ciExecutionEnv}`,
`runGroup: ${runGroup}`,
`error: ${error}`,
],
});
}
try {
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
branch,
runGroup,
ciExecutionId,
ciExecutionEnv,
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(branch, runGroup, ciExecutionId, ciExecutionEnv, task, options, commitSha) {
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: (0, serializer_overrides_1.serializeOverrides)(t),
};
});
});
const request = {
command: (0, environment_1.parseCommand)(),
branch,
runGroup,
ciExecutionId,
ciExecutionEnv,
tasks: tasksToExecute,
maxParallel: calculateMaxParallel(options),
commitSha,
};
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

@@ -1,1 +0,120 @@

const a11_0x2924=['extractGitRef','DteArtifactStorage','getRunGroup','E2EEncryption','defineProperty','./task-graph-creator','skipNxCache','getCIExecutionEnv','success','lifeCycle','getCIExecutionId','done','next','splitTasksIntoStages','../../error/print-run-group-error','encryptionKey','printRunGroupError','SIGTERM','log','VERBOSE_LOGGING','start','value','../../../utilities/nx-imports','values','createTaskGraphCompat','Main\x20job\x20was\x20terminated\x20via\x20SIGTERM','./split-task-graph-into-stages','SIGINT','./distributed-execution.api','createStartRequest','DistributedExecutionApi','endTasks','dte-main','extractGitSha','apply','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','exit','Successfully\x20completed\x20running\x20the\x20command.','See\x20run\x20details\x20at\x20','Unable\x20to\x20complete\x20a\x20run.','runUrl','completeRunGroupWithError','nxCloudDistributedTasksRunner','submitRunMetrics','axiosException','commandStatus','throw','../../../utilities/dte-artifact-storage','then','warn','../../../utilities/metric-logger','note','../../file-storage/e2e-encryption','error','scheduleTask','FileStorage','message','startTask','../../../utilities/environment'];(function(_0x31bd6a,_0x292468){const _0x29c7f6=function(_0x5de2d8){while(--_0x5de2d8){_0x31bd6a['push'](_0x31bd6a['shift']());}};_0x29c7f6(++_0x292468);}(a11_0x2924,0x135));const a11_0x29c7=function(_0x31bd6a,_0x292468){_0x31bd6a=_0x31bd6a-0x0;let _0x29c7f6=a11_0x2924[_0x31bd6a];return _0x29c7f6;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x375204,_0x59f31b,_0x2708f0,_0x3588b7){function _0x94b2ad(_0x28ec3f){return _0x28ec3f instanceof _0x2708f0?_0x28ec3f:new _0x2708f0(function(_0x4684f7){_0x4684f7(_0x28ec3f);});}return new(_0x2708f0||(_0x2708f0=Promise))(function(_0x20a60f,_0x81be8b){function _0x2a3573(_0x26c9db){try{_0x4c228c(_0x3588b7[a11_0x29c7('0x39')](_0x26c9db));}catch(_0x12604b){_0x81be8b(_0x12604b);}}function _0x2f5517(_0x4675a9){try{_0x4c228c(_0x3588b7[a11_0x29c7('0x20')](_0x4675a9));}catch(_0x24da57){_0x81be8b(_0x24da57);}}function _0x4c228c(_0x5a50fc){_0x5a50fc[a11_0x29c7('0x38')]?_0x20a60f(_0x5a50fc[a11_0x29c7('0x7')]):_0x94b2ad(_0x5a50fc['value'])[a11_0x29c7('0x22')](_0x2a3573,_0x2f5517);}_0x4c228c((_0x3588b7=_0x3588b7[a11_0x29c7('0x14')](_0x375204,_0x59f31b||[]))[a11_0x29c7('0x39')]());});};Object[a11_0x29c7('0x31')](exports,'__esModule',{'value':!![]});exports[a11_0x29c7('0x1c')]=void 0x0;const environment_1=require(a11_0x29c7('0x2c'));const metric_logger_1=require(a11_0x29c7('0x24'));const error_reporter_api_1=require('../../api/error-reporter.api');const print_run_group_error_1=require(a11_0x29c7('0x0'));const e2e_encryption_1=require(a11_0x29c7('0x26'));const file_storage_1=require('../../file-storage/file-storage');const distributed_execution_api_1=require(a11_0x29c7('0xe'));const split_task_graph_into_stages_1=require(a11_0x29c7('0xc'));const task_graph_creator_1=require(a11_0x29c7('0x32'));const process_tasks_1=require('./process-tasks');const dte_artifact_storage_1=require(a11_0x29c7('0x21'));const {output,cacheDirectory}=require(a11_0x29c7('0x8'));class NoopLifeCycle{[a11_0x29c7('0x28')](_0x1230a2){}[a11_0x29c7('0x2b')](_0x200d90){}[a11_0x29c7('0x11')](_0xc700a2){}}const nxCloudDistributedTasksRunner=(_0x2bde3a,_0x3e6967,_0x230096)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(_0x3e6967[a11_0x29c7('0x33')]){output[a11_0x29c7('0x23')]({'title':'--skip-nx-cache\x20is\x20ignored\x20when\x20using\x20distributed\x20tasks\x20execution\x20(DTE).','bodyLine':['DTE\x20needs\x20the\x20cache\x20to\x20share\x20files\x20between\x20agents.']});}if(environment_1[a11_0x29c7('0x5')]){output[a11_0x29c7('0x25')]({'title':'Starting\x20distributed\x20command\x20execution'});}_0x3e6967[a11_0x29c7('0x36')]=new NoopLifeCycle();const _0x2e54f1=(0x0,environment_1['getBranch'])();const _0x32f07c=(0x0,environment_1[a11_0x29c7('0x2f')])();const _0x344181=(0x0,environment_1[a11_0x29c7('0x37')])();const _0x241274=(0x0,environment_1[a11_0x29c7('0x34')])();const _0x2fb723=(0x0,environment_1[a11_0x29c7('0x13')])();const _0x1149e1=(0x0,environment_1[a11_0x29c7('0x2d')])();if(!(0x0,print_run_group_error_1['canDetectRunGroup'])(_0x32f07c,_0x344181)){(0x0,print_run_group_error_1[a11_0x29c7('0x2')])();process['exit'](0x1);}const _0x1127cd=new e2e_encryption_1[(a11_0x29c7('0x30'))](environment_1['ENCRYPTION_KEY']||_0x3e6967[a11_0x29c7('0x1')]);const _0x35cc36=new error_reporter_api_1['ErrorReporterApi'](_0x3e6967);const _0x51c266=new dte_artifact_storage_1[(a11_0x29c7('0x2e'))](new file_storage_1[(a11_0x29c7('0x29'))](_0x1127cd,_0x35cc36,_0x3e6967,a11_0x29c7('0x12')),cacheDirectory);const _0x5e9cb5=new distributed_execution_api_1[(a11_0x29c7('0x10'))](_0x3e6967);attachSignalListenersToCompleteRunGroupOnError(_0x5e9cb5,_0x2e54f1,_0x32f07c,_0x344181,_0x241274);try{const _0x5be5ce=getTaskGraph(_0x230096,_0x2bde3a,_0x3e6967);const _0x154ba8=yield runDistributedExecution(_0x5e9cb5,_0x3e6967,_0x51c266,_0x2e54f1,_0x32f07c,_0x344181,_0x241274,_0x5be5ce,_0x2fb723,_0x1149e1);if(_0x154ba8[a11_0x29c7('0x1f')]===0x0){output[a11_0x29c7('0x35')]({'title':a11_0x29c7('0x17'),'bodyLines':[a11_0x29c7('0x18')+_0x154ba8[a11_0x29c7('0x1a')]]});}else{output[a11_0x29c7('0x27')]({'title':'Command\x20execution\x20failed.','bodyLines':[a11_0x29c7('0x18')+_0x154ba8[a11_0x29c7('0x1a')]]});}yield(0x0,metric_logger_1[a11_0x29c7('0x1d')])(_0x3e6967);process[a11_0x29c7('0x16')](_0x154ba8[a11_0x29c7('0x1f')]);}catch(_0x23dcb0){output['error']({'title':a11_0x29c7('0x19'),'bodyLines':[_0x23dcb0[a11_0x29c7('0x2a')]]});if(_0x23dcb0['axiosException']){console[a11_0x29c7('0x4')](_0x23dcb0[a11_0x29c7('0x1e')]);}else{console['log'](_0x23dcb0);}try{yield _0x5e9cb5[a11_0x29c7('0x1b')](_0x2e54f1,_0x32f07c,_0x344181,_0x241274,a11_0x29c7('0x15')+_0x23dcb0['message']+'\x22');}finally{process[a11_0x29c7('0x16')](0x1);}}});exports[a11_0x29c7('0x1c')]=nxCloudDistributedTasksRunner;function getTaskGraph(_0x5e97f7,_0x566759,_0x4184f8){if(_0x5e97f7['taskGraph']){return _0x5e97f7['taskGraph'];}else{return(0x0,task_graph_creator_1[a11_0x29c7('0xa')])(_0x4184f8,_0x5e97f7['projectGraph'],_0x566759);}}function attachSignalListenersToCompleteRunGroupOnError(_0xe3631,_0x5eac58,_0x5b2996,_0x560a7c,_0x3d4404){process['on'](a11_0x29c7('0xd'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0xe3631[a11_0x29c7('0x1b')](_0x5eac58,_0x5b2996,_0x560a7c,_0x3d4404,'Main\x20job\x20was\x20terminated\x20via\x20SIGINT');process[a11_0x29c7('0x16')](0x1);}));process['on'](a11_0x29c7('0x3'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0xe3631[a11_0x29c7('0x1b')](_0x5eac58,_0x5b2996,_0x560a7c,_0x3d4404,a11_0x29c7('0xb'));process['exit'](0x1);}));}function runDistributedExecution(_0x2dff12,_0x2b0a9c,_0x5be03a,_0x2302aa,_0x919ba3,_0x5c4447,_0xc6e8c9,_0x32b2bb,_0x28eafb,_0x5bd5b5){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x430ca8=yield _0x2dff12[a11_0x29c7('0x6')]((0x0,distributed_execution_api_1[a11_0x29c7('0xf')])(_0x2302aa,_0x919ba3,_0x5c4447,_0xc6e8c9,(0x0,split_task_graph_into_stages_1[a11_0x29c7('0x3a')])(_0x32b2bb),_0x2b0a9c,_0x28eafb));return yield(0x0,process_tasks_1['processTasks'])(_0x2dff12,_0x5be03a,_0x430ca8,Object[a11_0x29c7('0x9')](_0x32b2bb['tasks']));});}
"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.nxCloudDistributedTasksRunner = void 0;
const environment_1 = require("../../../utilities/environment");
const metric_logger_1 = require("../../../utilities/metric-logger");
const error_reporter_api_1 = require("../../api/error-reporter.api");
const print_run_group_error_1 = require("../../error/print-run-group-error");
const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
const file_storage_1 = require("../../file-storage/file-storage");
const distributed_execution_api_1 = require("./distributed-execution.api");
const split_task_graph_into_stages_1 = require("./split-task-graph-into-stages");
const task_graph_creator_1 = require("./task-graph-creator");
const process_tasks_1 = require("./process-tasks");
const dte_artifact_storage_1 = require("../../../utilities/dte-artifact-storage");
const { output, cacheDirectory } = require('../../../utilities/nx-imports');
class NoopLifeCycle {
scheduleTask(task) { }
startTask(task) { }
endTasks(tasks) { }
}
const nxCloudDistributedTasksRunner = (tasks, options, context) => __awaiter(void 0, void 0, void 0, function* () {
if (options.skipNxCache) {
output.warn({
title: `--skip-nx-cache is ignored when using distributed tasks execution (DTE).`,
bodyLine: [`DTE needs the cache to share files between agents.`],
});
}
if (environment_1.VERBOSE_LOGGING) {
output.note({
title: 'Starting distributed command execution',
});
}
options.lifeCycle = new NoopLifeCycle();
const branch = (0, environment_1.getBranch)();
const runGroup = (0, environment_1.getRunGroup)();
const ciExecutionId = (0, environment_1.getCIExecutionId)();
const ciExecutionEnv = (0, environment_1.getCIExecutionEnv)();
const commitSha = (0, environment_1.extractGitSha)();
const commitRef = (0, environment_1.extractGitRef)();
if (!(0, print_run_group_error_1.canDetectRunGroup)(runGroup, ciExecutionId)) {
(0, print_run_group_error_1.printRunGroupError)();
process.exit(1);
}
const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
const errorReporter = new error_reporter_api_1.ErrorReporterApi(options);
const dteArtifactStorage = new dte_artifact_storage_1.DteArtifactStorage(new file_storage_1.FileStorage(encryption, errorReporter, options, 'dte-main'), cacheDirectory);
const api = new distributed_execution_api_1.DistributedExecutionApi(options);
attachSignalListenersToCompleteRunGroupOnError(api, branch, runGroup, ciExecutionId, ciExecutionEnv);
try {
const taskGraph = getTaskGraph(context, tasks, options);
const r = yield runDistributedExecution(api, options, dteArtifactStorage, branch, runGroup, ciExecutionId, ciExecutionEnv, taskGraph, commitSha, commitRef);
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);
}
try {
yield api.completeRunGroupWithError(branch, runGroup, ciExecutionId, ciExecutionEnv, `Main job terminated with an error: "${e.message}"`);
}
finally {
process.exit(1);
}
}
});
exports.nxCloudDistributedTasksRunner = nxCloudDistributedTasksRunner;
function getTaskGraph(context, tasks, options) {
if (context.taskGraph) {
return context.taskGraph;
}
else {
return (0, task_graph_creator_1.createTaskGraphCompat)(options, context.projectGraph, tasks);
}
}
function attachSignalListenersToCompleteRunGroupOnError(api, branch, runGroup, ciExecutionId, ciExecutionEnv) {
process.on('SIGINT', () => __awaiter(this, void 0, void 0, function* () {
yield api.completeRunGroupWithError(branch, runGroup, ciExecutionId, ciExecutionEnv, 'Main job was terminated via SIGINT');
process.exit(1);
}));
process.on('SIGTERM', () => __awaiter(this, void 0, void 0, function* () {
yield api.completeRunGroupWithError(branch, runGroup, ciExecutionId, ciExecutionEnv, 'Main job was terminated via SIGTERM');
process.exit(1);
}));
}
function runDistributedExecution(api, options, dteArtifactStorage, branch, runGroup, ciExecutionId, ciExecutionEnv, taskGraph, commitSha, commitRef) {
return __awaiter(this, void 0, void 0, function* () {
const id = yield api.start((0, distributed_execution_api_1.createStartRequest)(branch, runGroup, ciExecutionId, ciExecutionEnv, (0, split_task_graph_into_stages_1.splitTasksIntoStages)(taskGraph), options, commitSha));
return yield (0, process_tasks_1.processTasks)(api, dteArtifactStorage, id, Object.values(taskGraph.tasks));
});
}
//# sourceMappingURL=distributed-execution.runner.js.map

@@ -1,1 +0,45 @@

const a12_0x4902=['project','next','../../../utilities/nx-imports','addVerticalSeparator','target','Found\x20unknown\x20task:\x20','value','apply','__esModule','processTask','__awaiter','defineProperty','note','then','taskId','../../../utilities/serializer-overrides','configuration','find','done','serializeOverrides'];(function(_0x24f7a4,_0x4902d9){const _0x3c92ca=function(_0x331fac){while(--_0x331fac){_0x24f7a4['push'](_0x24f7a4['shift']());}};_0x3c92ca(++_0x4902d9);}(a12_0x4902,0xff));const a12_0x3c92=function(_0x24f7a4,_0x4902d9){_0x24f7a4=_0x24f7a4-0x0;let _0x3c92ca=a12_0x4902[_0x24f7a4];return _0x3c92ca;};'use strict';var __awaiter=this&&this[a12_0x3c92('0xf')]||function(_0x5164a4,_0x2e1ef6,_0x3bb2b0,_0x3c05d0){function _0x41868c(_0x5de321){return _0x5de321 instanceof _0x3bb2b0?_0x5de321:new _0x3bb2b0(function(_0x5c5aeb){_0x5c5aeb(_0x5de321);});}return new(_0x3bb2b0||(_0x3bb2b0=Promise))(function(_0x2b14ee,_0x7ebd9b){function _0x1ac24a(_0x49acc6){try{_0x597aa0(_0x3c05d0[a12_0x3c92('0x6')](_0x49acc6));}catch(_0x2b08ef){_0x7ebd9b(_0x2b08ef);}}function _0x26448f(_0x411167){try{_0x597aa0(_0x3c05d0['throw'](_0x411167));}catch(_0x141147){_0x7ebd9b(_0x141147);}}function _0x597aa0(_0x2f453e){_0x2f453e[a12_0x3c92('0x3')]?_0x2b14ee(_0x2f453e[a12_0x3c92('0xb')]):_0x41868c(_0x2f453e['value'])[a12_0x3c92('0x12')](_0x1ac24a,_0x26448f);}_0x597aa0((_0x3c05d0=_0x3c05d0[a12_0x3c92('0xc')](_0x5164a4,_0x2e1ef6||[]))[a12_0x3c92('0x6')]());});};Object[a12_0x3c92('0x10')](exports,a12_0x3c92('0xd'),{'value':!![]});exports[a12_0x3c92('0xe')]=void 0x0;const environment_1=require('../../../utilities/environment');const serializer_overrides_1=require(a12_0x3c92('0x0'));const {output}=require(a12_0x3c92('0x7'));function processTask(_0x2dff98,_0x1be2d5,_0x3aa43e){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1['VERBOSE_LOGGING']){output[a12_0x3c92('0x11')]({'title':'Processing\x20task\x20'+_0x3aa43e['taskId']});}const _0x1a2d5f=_0x1be2d5[a12_0x3c92('0x2')](_0x8499b=>_0x3aa43e['taskId']===_0x8499b['id']);if(!_0x1a2d5f){throw new Error(a12_0x3c92('0xa')+_0x3aa43e[a12_0x3c92('0x13')]);}const _0x4fba8b=yield _0x2dff98['retrieveAndExtract'](_0x3aa43e['hash'],_0x3aa43e['url']);output['logCommand'](getCommand(_0x1a2d5f));process['stdout']['write'](_0x4fba8b);output[a12_0x3c92('0x8')]();});}exports[a12_0x3c92('0xe')]=processTask;function getCommand(_0x2866e7){const _0x3bdeb5=_0x2866e7[a12_0x3c92('0x9')][a12_0x3c92('0x1')]?':'+_0x2866e7[a12_0x3c92('0x9')][a12_0x3c92('0x1')]:'';return['nx','run',_0x2866e7[a12_0x3c92('0x9')][a12_0x3c92('0x5')]+':'+_0x2866e7['target'][a12_0x3c92('0x9')]+_0x3bdeb5,(0x0,serializer_overrides_1[a12_0x3c92('0x4')])(_0x2866e7)]['join']('\x20');}
"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.processTask = void 0;
const environment_1 = require("../../../utilities/environment");
const serializer_overrides_1 = require("../../../utilities/serializer-overrides");
const { output } = require('../../../utilities/nx-imports');
function processTask(dteArtifactStorage, 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}`);
}
const terminalOutput = yield dteArtifactStorage.retrieveAndExtract(completedTask.hash, completedTask.url);
output.logCommand(getCommand(matchingTask));
process.stdout.write(terminalOutput);
output.addVerticalSeparator();
});
}
exports.processTask = processTask;
function getCommand(task) {
const config = task.target.configuration
? `:${task.target.configuration}`
: '';
return [
'nx',
'run',
`${task.target.project}:${task.target.target}${config}`,
(0, serializer_overrides_1.serializeOverrides)(task),
].join(' ');
}
//# sourceMappingURL=process-task.js.map

@@ -1,1 +0,67 @@

const a13_0x4aee=['COMPLETED','apply','__awaiter','defineProperty','value','reset','runUrl','length','throw','VERBOSE_LOGGING','note','executionId:\x20','Distributed\x20Execution\x20Terminated','error:\x20','\x20seconds.','status','next','Waiter','../../../utilities/waiter','done','./process-task','commandStatus','../../../utilities/environment','NO_COMPLETED_TASKS_TIMEOUT','taskId','createUnchangedValueTimeout','then','processTasks','Status\x20update','criticalErrorMessage','Waiting...','number\x20of\x20completed\x20tasks:\x20','Error:','executionStatus:\x20','completedTasks','executionStatus','wait','error'];(function(_0x568630,_0x4aeeaa){const _0x4f6e2f=function(_0x164def){while(--_0x164def){_0x568630['push'](_0x568630['shift']());}};_0x4f6e2f(++_0x4aeeaa);}(a13_0x4aee,0x1cf));const a13_0x4f6e=function(_0x568630,_0x4aeeaa){_0x568630=_0x568630-0x0;let _0x4f6e2f=a13_0x4aee[_0x568630];return _0x4f6e2f;};'use strict';var __awaiter=this&&this[a13_0x4f6e('0x21')]||function(_0x4da7b0,_0x42e94b,_0x111a08,_0x2d3201){function _0x32404a(_0x118438){return _0x118438 instanceof _0x111a08?_0x118438:new _0x111a08(function(_0x3c263b){_0x3c263b(_0x118438);});}return new(_0x111a08||(_0x111a08=Promise))(function(_0x5a2c29,_0x3b549f){function _0x159f80(_0x2b1b7f){try{_0x16906f(_0x2d3201[a13_0x4f6e('0x9')](_0x2b1b7f));}catch(_0x5bb37b){_0x3b549f(_0x5bb37b);}}function _0x1f6980(_0x59b794){try{_0x16906f(_0x2d3201[a13_0x4f6e('0x1')](_0x59b794));}catch(_0x3bf4d2){_0x3b549f(_0x3bf4d2);}}function _0x16906f(_0x376f33){_0x376f33[a13_0x4f6e('0xc')]?_0x5a2c29(_0x376f33[a13_0x4f6e('0x23')]):_0x32404a(_0x376f33[a13_0x4f6e('0x23')])[a13_0x4f6e('0x13')](_0x159f80,_0x1f6980);}_0x16906f((_0x2d3201=_0x2d3201[a13_0x4f6e('0x20')](_0x4da7b0,_0x42e94b||[]))['next']());});};Object[a13_0x4f6e('0x22')](exports,'__esModule',{'value':!![]});exports['processTasks']=void 0x0;const create_unchanged_value_timeout_1=require('../../../utilities/create-unchanged-value-timeout');const environment_1=require(a13_0x4f6e('0xf'));const waiter_1=require(a13_0x4f6e('0xb'));const process_task_1=require(a13_0x4f6e('0xd'));const {output}=require('../../../utilities/nx-imports');function processTasks(_0x17f146,_0x345647,_0x4d9b1e,_0x3fc657){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x42a92d={};const _0x376f7d=(0x0,create_unchanged_value_timeout_1[a13_0x4f6e('0x12')])({'title':'No\x20new\x20completed\x20tasks\x20after\x20'+environment_1[a13_0x4f6e('0x10')]/0x3e8+a13_0x4f6e('0x7'),'timeout':environment_1[a13_0x4f6e('0x10')]});const _0x132016=new waiter_1[(a13_0x4f6e('0xa'))]();while(!![]){if(environment_1['VERBOSE_LOGGING']){output[a13_0x4f6e('0x3')]({'title':a13_0x4f6e('0x17')});}yield _0x132016[a13_0x4f6e('0x1d')]();const _0x4c8e27=yield _0x17f146[a13_0x4f6e('0x8')](_0x4d9b1e);if(environment_1[a13_0x4f6e('0x2')]){output[a13_0x4f6e('0x3')]({'title':a13_0x4f6e('0x15'),'bodyLines':[a13_0x4f6e('0x4')+_0x4d9b1e,a13_0x4f6e('0x1a')+_0x4c8e27['executionStatus'],a13_0x4f6e('0x18')+_0x4c8e27[a13_0x4f6e('0x1b')][a13_0x4f6e('0x0')],a13_0x4f6e('0x6')+_0x4c8e27[a13_0x4f6e('0x16')]]});}if(_0x4c8e27[a13_0x4f6e('0x16')]){output[a13_0x4f6e('0x1e')]({'title':a13_0x4f6e('0x5'),'bodyLines':[a13_0x4f6e('0x19'),_0x4c8e27['criticalErrorMessage']]});process['exit'](0x1);}_0x376f7d(_0x4c8e27[a13_0x4f6e('0x1b')][a13_0x4f6e('0x0')]);for(const _0x135be0 of _0x4c8e27[a13_0x4f6e('0x1b')]){if(_0x42a92d[_0x135be0[a13_0x4f6e('0x11')]])continue;yield(0x0,process_task_1['processTask'])(_0x345647,_0x3fc657,_0x135be0);_0x132016[a13_0x4f6e('0x24')]();_0x42a92d[_0x135be0['taskId']]=!![];}if(_0x4c8e27[a13_0x4f6e('0x1c')]===a13_0x4f6e('0x1f')){return{'commandStatus':_0x4c8e27[a13_0x4f6e('0xe')],'runUrl':_0x4c8e27[a13_0x4f6e('0x25')]};}}});}exports[a13_0x4f6e('0x14')]=processTasks;
"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.processTasks = void 0;
const create_unchanged_value_timeout_1 = require("../../../utilities/create-unchanged-value-timeout");
const environment_1 = require("../../../utilities/environment");
const waiter_1 = require("../../../utilities/waiter");
const process_task_1 = require("./process-task");
const { output } = require('../../../utilities/nx-imports');
function processTasks(api, dteArtifactStorage, executionId, tasks) {
return __awaiter(this, void 0, void 0, function* () {
const processedTasks = {};
const failIfNumberOfCompletedTasksDoesNotChangeAfterTimeout = (0, create_unchanged_value_timeout_1.createUnchangedValueTimeout)({
title: `No new completed tasks after ${environment_1.NO_COMPLETED_TASKS_TIMEOUT / 1000} seconds.`,
timeout: environment_1.NO_COMPLETED_TASKS_TIMEOUT,
});
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);
}
failIfNumberOfCompletedTasksDoesNotChangeAfterTimeout(r.completedTasks.length);
for (const t of r.completedTasks) {
if (processedTasks[t.taskId])
continue;
yield (0, process_task_1.processTask)(dteArtifactStorage, tasks, t);
waiter.reset();
processedTasks[t.taskId] = true;
}
if (r.executionStatus === 'COMPLETED') {
return { commandStatus: r.commandStatus, runUrl: r.runUrl };
}
}
});
}
exports.processTasks = processTasks;
//# sourceMappingURL=process-tasks.js.map

@@ -1,1 +0,37 @@

const a14_0xcead=['push','__esModule','defineProperty','map','tasks','size','values','delete','splitTasksIntoStages'];(function(_0x446ca1,_0xcead33){const _0x13d0bb=function(_0x1fde5d){while(--_0x1fde5d){_0x446ca1['push'](_0x446ca1['shift']());}};_0x13d0bb(++_0xcead33);}(a14_0xcead,0x183));const a14_0x13d0=function(_0x446ca1,_0xcead33){_0x446ca1=_0x446ca1-0x0;let _0x13d0bb=a14_0xcead[_0x446ca1];return _0x13d0bb;};'use strict';Object[a14_0x13d0('0x2')](exports,a14_0x13d0('0x1'),{'value':!![]});exports[a14_0x13d0('0x8')]=void 0x0;function splitTasksIntoStages(_0x179c03){const _0x3d3233=[];const _0x3b3ec7=new Set(Object[a14_0x13d0('0x6')](_0x179c03[a14_0x13d0('0x4')])[a14_0x13d0('0x3')](_0x4b0725=>_0x4b0725['id']));let _0x274a4e=0x0;while(_0x3b3ec7[a14_0x13d0('0x5')]>0x0){const _0x4ec550=_0x3d3233[_0x274a4e]=[];for(const _0x551449 of _0x3b3ec7){let _0xdeb4cd=!![];for(const _0x28576b of _0x179c03['dependencies'][_0x551449]){if(_0x3b3ec7['has'](_0x28576b)){_0xdeb4cd=![];break;}}if(!_0xdeb4cd){continue;}const _0x384cb9=_0x179c03[a14_0x13d0('0x4')][_0x551449];_0x4ec550[a14_0x13d0('0x0')](_0x384cb9);}for(const _0xefadd6 of _0x4ec550){_0x3b3ec7[a14_0x13d0('0x7')](_0xefadd6['id']);}_0x274a4e++;}return _0x3d3233;}exports['splitTasksIntoStages']=splitTasksIntoStages;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.splitTasksIntoStages = void 0;
function splitTasksIntoStages(taskGraph) {
const stages = [];
const notStagedTaskIds = new Set(Object.values(taskGraph.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;
}
exports.splitTasksIntoStages = splitTasksIntoStages;
//# sourceMappingURL=split-task-graph-into-stages.js.map

@@ -1,1 +0,100 @@

const a15_0x7e6e=['roots','__esModule','addDependencies','projectGraph','targetDependencies','findTask','strictlyOrderedTargets','target','has','project','add','projects','../../../utilities/nx-imports','strip-json-comments','filter','indexOf','defineProperty','push','parse','TaskGraphCreator','defaultTargetDependencies','readFileSync','tasks','dependencies','addTaskToGraph','addTaskDependencies','length','createTaskGraph','toString'];(function(_0x3195e1,_0x7e6e5a){const _0x1023b3=function(_0x3521d4){while(--_0x3521d4){_0x3195e1['push'](_0x3195e1['shift']());}};_0x1023b3(++_0x7e6e5a);}(a15_0x7e6e,0x134));const a15_0x1023=function(_0x3195e1,_0x7e6e5a){_0x3195e1=_0x3195e1-0x0;let _0x1023b3=a15_0x7e6e[_0x3195e1];return _0x1023b3;};'use strict';Object[a15_0x1023('0x1b')](exports,a15_0x1023('0xc'),{'value':!![]});exports[a15_0x1023('0x1')]=exports['createTaskGraphCompat']=void 0x0;const stripJsonComments=require(a15_0x1023('0x18'));const fs_1=require('fs');const {getDependencyConfigs,workspaceRoot}=require(a15_0x1023('0x17'));function createTaskGraphCompat(_0x126adc,_0x176be9,_0x3af915){const _0x9964d2=JSON[a15_0x1023('0x0')](stripJsonComments((0x0,fs_1[a15_0x1023('0x3')])(workspaceRoot+'/nx.json')[a15_0x1023('0xa')]()));return new TaskGraphCreator(_0x176be9,getDefaultDependencyConfigs(_0x9964d2,_0x126adc))[a15_0x1023('0x9')](_0x3af915);}exports['createTaskGraphCompat']=createTaskGraphCompat;function getDefaultDependencyConfigs(_0xa82b2b,_0xeebb2e){var _0x4f497f,_0x34fb8b;const _0x40953a=(_0x4f497f=_0xa82b2b[a15_0x1023('0xf')])!==null&&_0x4f497f!==void 0x0?_0x4f497f:{};const _0x4be8b7=_0xeebb2e?(_0x34fb8b=_0xeebb2e[a15_0x1023('0x11')])!==null&&_0x34fb8b!==void 0x0?_0x34fb8b:['build']:[];for(const _0x41084d of _0x4be8b7){_0x40953a[_0x41084d]=_0x40953a[_0x41084d]||[];_0x40953a[_0x41084d][a15_0x1023('0x1c')]({'target':_0x41084d,'projects':a15_0x1023('0x5')});}return _0x40953a;}class TaskGraphCreator{constructor(_0x223445,_0x51fa1a){this[a15_0x1023('0xe')]=_0x223445;this[a15_0x1023('0x2')]=_0x51fa1a;}[a15_0x1023('0x9')](_0x4381b0){const _0xc72b0f={'roots':[],'tasks':{},'dependencies':{}};for(const _0x4c8c40 of _0x4381b0){this[a15_0x1023('0x6')](_0x4c8c40,_0xc72b0f);const _0x56cf3e=getDependencyConfigs(_0x4c8c40['target'],this[a15_0x1023('0x2')],this[a15_0x1023('0xe')]);if(!_0x56cf3e){continue;}this[a15_0x1023('0x7')](_0x4c8c40,_0x56cf3e,_0x4381b0,_0xc72b0f);}_0xc72b0f[a15_0x1023('0xb')]=Object['keys'](_0xc72b0f[a15_0x1023('0x5')])[a15_0x1023('0x19')](_0x5ddaf3=>_0xc72b0f['dependencies'][_0x5ddaf3][a15_0x1023('0x8')]===0x0);return _0xc72b0f;}['addTaskDependencies'](_0x28ad6b,_0x362850,_0x10d368,_0x20641e){for(const _0x3c744a of _0x362850){if(_0x3c744a[a15_0x1023('0x16')]==='self'){for(const _0xf410de of _0x10d368){if(_0xf410de['target']['project']===_0x28ad6b['target']['project']&&_0xf410de[a15_0x1023('0x12')][a15_0x1023('0x12')]===_0x3c744a[a15_0x1023('0x12')]){_0x20641e[a15_0x1023('0x5')][_0x28ad6b['id']]['push'](_0xf410de['id']);}}}else if(_0x3c744a[a15_0x1023('0x16')]===a15_0x1023('0x5')){const _0x598ab6=new Set();this['addDependencies'](_0x28ad6b['target'][a15_0x1023('0x14')],_0x3c744a[a15_0x1023('0x12')],_0x10d368,_0x20641e,_0x28ad6b['id'],_0x598ab6);}}}[a15_0x1023('0xd')](_0x4a32bb,_0x48fcef,_0x423086,_0x53609f,_0x34d677,_0x5c34b1){_0x5c34b1[a15_0x1023('0x15')](_0x4a32bb);const _0x45f72b=this[a15_0x1023('0xe')][a15_0x1023('0x5')][_0x4a32bb];if(_0x45f72b){const _0x3826cc=_0x45f72b['map'](_0xf647d7=>_0xf647d7[a15_0x1023('0x12')]);for(const _0x4408b0 of _0x3826cc){if(_0x5c34b1[a15_0x1023('0x13')](_0x4408b0)){continue;}const _0x3f392d=this[a15_0x1023('0x10')]({'project':_0x4408b0,'target':_0x48fcef},_0x423086);if(_0x3f392d){if(_0x53609f[a15_0x1023('0x5')][_0x34d677][a15_0x1023('0x1a')](_0x3f392d['id'])===-0x1){_0x53609f['dependencies'][_0x34d677]['push'](_0x3f392d['id']);}}else{this[a15_0x1023('0xd')](_0x4408b0,_0x48fcef,_0x423086,_0x53609f,_0x34d677,_0x5c34b1);}}}}[a15_0x1023('0x10')]({project,target},_0x32b7f0){return _0x32b7f0['find'](_0x5c533f=>_0x5c533f['target'][a15_0x1023('0x14')]===project&&_0x5c533f[a15_0x1023('0x12')]['target']===target);}[a15_0x1023('0x6')](_0x1ac15a,_0x8af92e){_0x8af92e[a15_0x1023('0x4')][_0x1ac15a['id']]=_0x1ac15a;_0x8af92e['dependencies'][_0x1ac15a['id']]=[];}}exports['TaskGraphCreator']=TaskGraphCreator;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TaskGraphCreator = exports.createTaskGraphCompat = void 0;
const stripJsonComments = require("strip-json-comments");
const fs_1 = require("fs");
const { getDependencyConfigs, workspaceRoot, } = require('../../../utilities/nx-imports');
function createTaskGraphCompat(options, projectGraph, tasks) {
const nxjson = JSON.parse(stripJsonComments((0, fs_1.readFileSync)(`${workspaceRoot}/nx.json`).toString()));
return new TaskGraphCreator(projectGraph, getDefaultDependencyConfigs(nxjson, options)).createTaskGraph(tasks);
}
exports.createTaskGraphCompat = createTaskGraphCompat;
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;
}
/**
* This is only used for versions of Nx prior to 14 where the task graph
* wasn't part of the context so we have to recreate it
*/
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;
//# sourceMappingURL=task-graph-creator.js.map
{
"name": "nx-cloud",
"version": "16.2.0",
"version": "16.3.0-beta.1",
"description": "Distributed caching and task execution for Lerna and Nx",

@@ -32,4 +32,4 @@ "keywords": [

"open": "~8.4.0",
"@nrwl/nx-cloud": "16.2.0"
"@nrwl/nx-cloud": "16.3.0-beta.1"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc