@nrwl/nx-cloud 14.4.1 → 14.4.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,220 @@
1
- const a7_0x3577=['NO_COMPLETED_TASKS_TIMEOUT','../../error/print-run-group-error','parse','DistributedExecutionApi','then','Waiting...','nodes','./task-graph-creator','executionStatus','runUrl','get','logCommand','Waiter','Retrieving\x20artifacts\x20from\x20','completedTasks','error','note','nxCloudDistributedTasksRunner','scheduleTask','\x20seconds.','COMPLETED','values','Main\x20job\x20was\x20terminated\x20via\x20SIGINT','FileStorage','axiosException','readFileSync','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','projectGraph','submitRunMetrics','throw','targetDependencies','SIGINT','push','retrieve','done','start','length','endTask','No\x20new\x20completed\x20tasks\x20after\x20','createTaskGraph','url','build','./split-task-graph-into-stages','wait','See\x20run\x20details\x20at\x20','strictlyOrderedTargets','exit','Error:','./distributed-execution.api','../../api/error-reporter.api','run','Starting\x20distributed\x20command\x20execution','configuration','__esModule','serializeOverrides','hash','SIGTERM','assign','taskGraph','taskId','terminalOutput','/nx.json','../../../utilities/metric-logger','message','E2EEncryption','executionId:\x20','find','encryptionKey','log','cacheDirectory','Processing\x20task\x20','../../../utilities/serializer-overrides','reset','dependencies','value','Main\x20job\x20was\x20terminated\x20via\x20SIGTERM','./node_modules/.cache/nx','../../../utilities/nx-imports','number\x20of\x20completed\x20tasks:\x20','target','defineProperty','TaskGraphCreator','commandStatus','VERBOSE_LOGGING','Status\x20update','addVerticalSeparator','printRunGroupError','completeRunGroupWithError','ErrorReporterApi','getRunGroup','../../file-storage/e2e-encryption','../../../utilities/waiter','stdout','Successfully\x20completed\x20running\x20the\x20command.','../../file-storage/file-storage','criticalErrorMessage'];(function(_0x9ab495,_0x35771c){const _0x579e7d=function(_0x59729c){while(--_0x59729c){_0x9ab495['push'](_0x9ab495['shift']());}};_0x579e7d(++_0x35771c);}(a7_0x3577,0x8c));const a7_0x579e=function(_0x9ab495,_0x35771c){_0x9ab495=_0x9ab495-0x0;let _0x579e7d=a7_0x3577[_0x9ab495];return _0x579e7d;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x11aaad,_0x912506,_0x4fdfe8,_0x3af311){function _0x4b9f65(_0x2594f4){return _0x2594f4 instanceof _0x4fdfe8?_0x2594f4:new _0x4fdfe8(function(_0xba841b){_0xba841b(_0x2594f4);});}return new(_0x4fdfe8||(_0x4fdfe8=Promise))(function(_0x168c26,_0x1aa82){function _0x78d87b(_0x3ceb83){try{_0x12657c(_0x3af311['next'](_0x3ceb83));}catch(_0x2f1bb9){_0x1aa82(_0x2f1bb9);}}function _0x48f1ed(_0x24e205){try{_0x12657c(_0x3af311[a7_0x579e('0x51')](_0x24e205));}catch(_0x30ff2b){_0x1aa82(_0x30ff2b);}}function _0x12657c(_0x5d74a5){_0x5d74a5[a7_0x579e('0x56')]?_0x168c26(_0x5d74a5[a7_0x579e('0x1e')]):_0x4b9f65(_0x5d74a5[a7_0x579e('0x1e')])[a7_0x579e('0x38')](_0x78d87b,_0x48f1ed);}_0x12657c((_0x3af311=_0x3af311['apply'](_0x11aaad,_0x912506||[]))['next']());});};Object[a7_0x579e('0x24')](exports,a7_0x579e('0x9'),{'value':!![]});exports[a7_0x579e('0x45')]=void 0x0;const fs_1=require('fs');const stripJsonComments=require('strip-json-comments');const create_unchanged_value_timeout_1=require('../../../utilities/create-unchanged-value-timeout');const environment_1=require('../../../utilities/environment');const metric_logger_1=require(a7_0x579e('0x12'));const serializer_overrides_1=require(a7_0x579e('0x1b'));const waiter_1=require(a7_0x579e('0x2f'));const error_reporter_api_1=require(a7_0x579e('0x5'));const print_run_group_error_1=require(a7_0x579e('0x35'));const e2e_encryption_1=require(a7_0x579e('0x2e'));const file_storage_1=require(a7_0x579e('0x32'));const distributed_execution_api_1=require(a7_0x579e('0x4'));const split_task_graph_into_stages_1=require(a7_0x579e('0x5e'));const task_graph_creator_1=require(a7_0x579e('0x3b'));const {output,workspaceRoot,getOutputs,Cache}=require(a7_0x579e('0x21'));class NoopLifeCycle{[a7_0x579e('0x46')](_0x254c9f){}['startTask'](_0x37725f){}[a7_0x579e('0x59')](_0x500fc0,_0x354dd2){}}function runDistributedExecution(_0x16ad44,_0xcd0f09,_0x502f3a,_0x1060be,_0x4d54e7,_0x455020,_0x34a3e6){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x1a99a6=yield _0x16ad44[a7_0x579e('0x57')]((0x0,distributed_execution_api_1['createStartRequest'])(_0x455020,(0x0,split_task_graph_into_stages_1['splitTasksIntoStages'])(_0x34a3e6),_0xcd0f09));return yield processTasks(_0x16ad44,_0x1060be,_0x4d54e7,_0xcd0f09,_0x1a99a6,Object[a7_0x579e('0x49')](_0x34a3e6['tasks']),_0x502f3a);});}function processTasks(_0x93e589,_0x35d6b9,_0x34a397,_0x9e3f01,_0x4954fa,_0x558b7e,_0xfe1a49){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x8dd07c={};const _0xd2d184=(0x0,create_unchanged_value_timeout_1['createUnchangedValueTimeout'])({'title':a7_0x579e('0x5a')+environment_1[a7_0x579e('0x34')]/0x3e8+a7_0x579e('0x47'),'timeout':environment_1['NO_COMPLETED_TASKS_TIMEOUT']});const _0x32a49d=new waiter_1[(a7_0x579e('0x40'))]();while(!![]){if(environment_1[a7_0x579e('0x27')]){output[a7_0x579e('0x44')]({'title':a7_0x579e('0x39')});}yield _0x32a49d[a7_0x579e('0x5f')]();const _0x49d658=yield _0x93e589['status'](_0x4954fa);if(environment_1[a7_0x579e('0x27')]){output['note']({'title':a7_0x579e('0x28'),'bodyLines':[a7_0x579e('0x15')+_0x4954fa,'executionStatus:\x20'+_0x49d658[a7_0x579e('0x3c')],a7_0x579e('0x22')+_0x49d658[a7_0x579e('0x42')]['length'],'error:\x20'+_0x49d658['criticalErrorMessage']]});}if(_0x49d658[a7_0x579e('0x33')]){output['error']({'title':'Distributed\x20Execution\x20Terminated','bodyLines':[a7_0x579e('0x3'),_0x49d658[a7_0x579e('0x33')]]});process[a7_0x579e('0x2')](0x1);}_0xd2d184(_0x49d658[a7_0x579e('0x42')][a7_0x579e('0x58')]);for(const _0x54a466 of _0x49d658['completedTasks']){if(_0x8dd07c[_0x54a466[a7_0x579e('0xf')]])continue;yield processTask(_0x35d6b9,_0x34a397,_0xfe1a49,_0x9e3f01,_0x558b7e,_0x54a466);_0x32a49d[a7_0x579e('0x1c')]();_0x8dd07c[_0x54a466[a7_0x579e('0xf')]]=!![];}if(_0x49d658[a7_0x579e('0x3c')]===a7_0x579e('0x48')){return{'commandStatus':_0x49d658[a7_0x579e('0x26')],'runUrl':_0x49d658[a7_0x579e('0x3d')]};}}});}function processTask(_0x579989,_0x415853,_0x23e088,_0x47b5ea,_0x3effad,_0x410ff4){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1[a7_0x579e('0x27')]){output[a7_0x579e('0x44')]({'title':a7_0x579e('0x1a')+_0x410ff4['taskId']});}const _0x55c466=_0x3effad[a7_0x579e('0x16')](_0x2234a8=>_0x410ff4[a7_0x579e('0xf')]===_0x2234a8['id']);if(!_0x55c466){throw new Error('Found\x20unknown\x20task:\x20'+_0x410ff4[a7_0x579e('0xf')]);}if(environment_1['VERBOSE_LOGGING']){output[a7_0x579e('0x44')]({'title':a7_0x579e('0x41')+_0x410ff4[a7_0x579e('0x5c')]});}yield _0x579989[a7_0x579e('0x55')](_0x410ff4[a7_0x579e('0xb')],_0x410ff4[a7_0x579e('0x5c')],_0x47b5ea[a7_0x579e('0x19')]||a7_0x579e('0x20'));const _0x2edea7=yield _0x415853[a7_0x579e('0x3e')](Object[a7_0x579e('0xd')](Object[a7_0x579e('0xd')]({},_0x55c466),{'hash':_0x410ff4['hash']}));const _0x4ecc07=getOutputs(_0x23e088[a7_0x579e('0x4f')][a7_0x579e('0x3a')],_0x55c466);if(environment_1[a7_0x579e('0x27')]){output[a7_0x579e('0x44')]({'title':'Extracting\x20artifacts','bodyLines':_0x4ecc07});}yield _0x415853['copyFilesFromCache'](_0x410ff4['hash'],_0x2edea7,_0x4ecc07);output[a7_0x579e('0x3f')](getCommand(_0x55c466));process[a7_0x579e('0x30')]['write'](_0x2edea7[a7_0x579e('0x10')]);output[a7_0x579e('0x29')]();});}function getCommand(_0x53ad29){const _0x227a59=_0x53ad29['target']['configuration']?':'+_0x53ad29[a7_0x579e('0x23')][a7_0x579e('0x8')]:'';return['nx',a7_0x579e('0x6'),_0x53ad29[a7_0x579e('0x23')]['project']+':'+_0x53ad29[a7_0x579e('0x23')][a7_0x579e('0x23')]+_0x227a59,(0x0,serializer_overrides_1[a7_0x579e('0xa')])(_0x53ad29)]['join']('\x20');}function attachSignalListenersToCompleteRunGroupOnError(_0x1c955e,_0x1af6e7){process['on'](a7_0x579e('0x53'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x1c955e[a7_0x579e('0x2b')](_0x1af6e7,a7_0x579e('0x4a'));process[a7_0x579e('0x2')](0x1);}));process['on'](a7_0x579e('0xc'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x1c955e[a7_0x579e('0x2b')](_0x1af6e7,a7_0x579e('0x1f'));process['exit'](0x1);}));}const nxCloudDistributedTasksRunner=(_0x37251a,_0x379bd6,_0x1201d4)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(environment_1['VERBOSE_LOGGING']){output[a7_0x579e('0x44')]({'title':a7_0x579e('0x7')});}_0x379bd6['lifeCycle']=new NoopLifeCycle();const _0x349e05=(0x0,environment_1[a7_0x579e('0x2d')])();if(!_0x349e05){(0x0,print_run_group_error_1[a7_0x579e('0x2a')])();return process[a7_0x579e('0x2')](0x1);}const _0x2ab102=new e2e_encryption_1[(a7_0x579e('0x14'))](environment_1['ENCRYPTION_KEY']||_0x379bd6[a7_0x579e('0x17')]);const _0x356540=new error_reporter_api_1[(a7_0x579e('0x2c'))](_0x379bd6);const _0x5e5ccd=new file_storage_1[(a7_0x579e('0x4b'))](_0x2ab102,_0x356540,!![]);const _0x25fb2c=new Cache(_0x379bd6);const _0x51c8f9=new distributed_execution_api_1[(a7_0x579e('0x37'))](_0x379bd6);attachSignalListenersToCompleteRunGroupOnError(_0x51c8f9,_0x349e05);try{const _0x5045c2=getTaskGraph(_0x1201d4,_0x37251a,_0x379bd6);const _0x1c7490=yield runDistributedExecution(_0x51c8f9,_0x379bd6,_0x1201d4,_0x5e5ccd,_0x25fb2c,_0x349e05,_0x5045c2);if(_0x1c7490['commandStatus']===0x0){output['success']({'title':a7_0x579e('0x31'),'bodyLines':[a7_0x579e('0x0')+_0x1c7490['runUrl']]});}else{output[a7_0x579e('0x43')]({'title':'Command\x20execution\x20failed.','bodyLines':['See\x20run\x20details\x20at\x20'+_0x1c7490[a7_0x579e('0x3d')]]});}yield(0x0,metric_logger_1[a7_0x579e('0x50')])(_0x379bd6);process['exit'](_0x1c7490[a7_0x579e('0x26')]);}catch(_0x531443){output[a7_0x579e('0x43')]({'title':'Unable\x20to\x20complete\x20a\x20run.','bodyLines':[_0x531443[a7_0x579e('0x13')]]});if(_0x531443[a7_0x579e('0x4c')]){console[a7_0x579e('0x18')](_0x531443[a7_0x579e('0x4c')]);}else{console[a7_0x579e('0x18')](_0x531443);}try{yield _0x51c8f9['completeRunGroupWithError'](_0x349e05,a7_0x579e('0x4e')+_0x531443[a7_0x579e('0x13')]+'\x22');}finally{process[a7_0x579e('0x2')](0x1);}}});exports['nxCloudDistributedTasksRunner']=nxCloudDistributedTasksRunner;function getTaskGraph(_0xaa324e,_0x5889aa,_0x5e6aca){if(_0xaa324e[a7_0x579e('0xe')]){return _0xaa324e[a7_0x579e('0xe')];}else{const _0xf97b95=JSON[a7_0x579e('0x36')](stripJsonComments((0x0,fs_1[a7_0x579e('0x4d')])(workspaceRoot+a7_0x579e('0x11'))['toString']()));return new task_graph_creator_1[(a7_0x579e('0x25'))](_0xaa324e[a7_0x579e('0x4f')],getDefaultDependencyConfigs(_0xf97b95,_0x5e6aca))[a7_0x579e('0x5b')](_0x5889aa);}}function getDefaultDependencyConfigs(_0x57c8ff,_0x500aa2){var _0x5c8b6d,_0x43a563;const _0x623b44=(_0x5c8b6d=_0x57c8ff[a7_0x579e('0x52')])!==null&&_0x5c8b6d!==void 0x0?_0x5c8b6d:{};const _0x241115=_0x500aa2?(_0x43a563=_0x500aa2[a7_0x579e('0x1')])!==null&&_0x43a563!==void 0x0?_0x43a563:[a7_0x579e('0x5d')]:[];for(const _0x55505f of _0x241115){_0x623b44[_0x55505f]=_0x623b44[_0x55505f]||[];_0x623b44[_0x55505f][a7_0x579e('0x54')]({'target':_0x55505f,'projects':a7_0x579e('0x1d')});}return _0x623b44;}
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.nxCloudDistributedTasksRunner = void 0;
13
+ const fs_1 = require("fs");
14
+ const stripJsonComments = require("strip-json-comments");
15
+ const create_unchanged_value_timeout_1 = require("../../../utilities/create-unchanged-value-timeout");
16
+ const environment_1 = require("../../../utilities/environment");
17
+ const metric_logger_1 = require("../../../utilities/metric-logger");
18
+ const serializer_overrides_1 = require("../../../utilities/serializer-overrides");
19
+ const waiter_1 = require("../../../utilities/waiter");
20
+ const error_reporter_api_1 = require("../../api/error-reporter.api");
21
+ const print_run_group_error_1 = require("../../error/print-run-group-error");
22
+ const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
23
+ const file_storage_1 = require("../../file-storage/file-storage");
24
+ const distributed_execution_api_1 = require("./distributed-execution.api");
25
+ const split_task_graph_into_stages_1 = require("./split-task-graph-into-stages");
26
+ const task_graph_creator_1 = require("./task-graph-creator");
27
+ const { output, workspaceRoot, getOutputs, Cache, } = require('../../../utilities/nx-imports');
28
+ class NoopLifeCycle {
29
+ scheduleTask(task) { }
30
+ startTask(task) { }
31
+ endTask(task, code) { }
32
+ }
33
+ function runDistributedExecution(api, options, context, fileStorage, cache, runGroup, taskGraph) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ const id = yield api.start((0, distributed_execution_api_1.createStartRequest)(runGroup, (0, split_task_graph_into_stages_1.splitTasksIntoStages)(taskGraph), options));
36
+ return yield processTasks(api, fileStorage, cache, options, id, Object.values(taskGraph.tasks), context);
37
+ });
38
+ }
39
+ function processTasks(api, fileStorage, cache, options, executionId, tasks, context) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const processedTasks = {};
42
+ const failIfNumberOfCompletedTasksDoesNotChangeAfterTimeout = (0, create_unchanged_value_timeout_1.createUnchangedValueTimeout)({
43
+ title: `No new completed tasks after ${environment_1.NO_COMPLETED_TASKS_TIMEOUT / 1000} seconds.`,
44
+ timeout: environment_1.NO_COMPLETED_TASKS_TIMEOUT,
45
+ });
46
+ const waiter = new waiter_1.Waiter();
47
+ while (true) {
48
+ if (environment_1.VERBOSE_LOGGING) {
49
+ output.note({
50
+ title: 'Waiting...',
51
+ });
52
+ }
53
+ yield waiter.wait();
54
+ const r = yield api.status(executionId);
55
+ if (environment_1.VERBOSE_LOGGING) {
56
+ output.note({
57
+ title: `Status update`,
58
+ bodyLines: [
59
+ `executionId: ${executionId}`,
60
+ `executionStatus: ${r.executionStatus}`,
61
+ `number of completed tasks: ${r.completedTasks.length}`,
62
+ `error: ${r.criticalErrorMessage}`,
63
+ ],
64
+ });
65
+ }
66
+ if (r.criticalErrorMessage) {
67
+ output.error({
68
+ title: 'Distributed Execution Terminated',
69
+ bodyLines: ['Error:', r.criticalErrorMessage],
70
+ });
71
+ process.exit(1);
72
+ }
73
+ failIfNumberOfCompletedTasksDoesNotChangeAfterTimeout(r.completedTasks.length);
74
+ for (const t of r.completedTasks) {
75
+ if (processedTasks[t.taskId])
76
+ continue;
77
+ yield processTask(fileStorage, cache, context, options, tasks, t);
78
+ waiter.reset();
79
+ processedTasks[t.taskId] = true;
80
+ }
81
+ if (r.executionStatus === 'COMPLETED') {
82
+ return { commandStatus: r.commandStatus, runUrl: r.runUrl };
83
+ }
84
+ }
85
+ });
86
+ }
87
+ function processTask(fileStorage, cache, context, options, tasks, completedTask) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ if (environment_1.VERBOSE_LOGGING) {
90
+ output.note({
91
+ title: `Processing task ${completedTask.taskId}`,
92
+ });
93
+ }
94
+ const matchingTask = tasks.find((tt) => completedTask.taskId === tt.id);
95
+ if (!matchingTask) {
96
+ throw new Error(`Found unknown task: ${completedTask.taskId}`);
97
+ }
98
+ if (environment_1.VERBOSE_LOGGING) {
99
+ output.note({
100
+ title: `Retrieving artifacts from ${completedTask.url}`,
101
+ });
102
+ }
103
+ yield fileStorage.retrieve(completedTask.hash, completedTask.url, options.cacheDirectory || './node_modules/.cache/nx');
104
+ const cachedResult = yield cache.get(Object.assign(Object.assign({}, matchingTask), { hash: completedTask.hash }));
105
+ const outputs = getOutputs(context.projectGraph.nodes, matchingTask);
106
+ if (environment_1.VERBOSE_LOGGING) {
107
+ output.note({
108
+ title: `Extracting artifacts`,
109
+ bodyLines: outputs,
110
+ });
111
+ }
112
+ yield cache.copyFilesFromCache(completedTask.hash, cachedResult, outputs);
113
+ output.logCommand(getCommand(matchingTask));
114
+ process.stdout.write(cachedResult.terminalOutput);
115
+ output.addVerticalSeparator();
116
+ });
117
+ }
118
+ function getCommand(task) {
119
+ const config = task.target.configuration
120
+ ? `:${task.target.configuration}`
121
+ : '';
122
+ return [
123
+ 'nx',
124
+ 'run',
125
+ `${task.target.project}:${task.target.target}${config}`,
126
+ (0, serializer_overrides_1.serializeOverrides)(task),
127
+ ].join(' ');
128
+ }
129
+ function attachSignalListenersToCompleteRunGroupOnError(api, runGroup) {
130
+ process.on('SIGINT', () => __awaiter(this, void 0, void 0, function* () {
131
+ yield api.completeRunGroupWithError(runGroup, 'Main job was terminated via SIGINT');
132
+ process.exit(1);
133
+ }));
134
+ process.on('SIGTERM', () => __awaiter(this, void 0, void 0, function* () {
135
+ yield api.completeRunGroupWithError(runGroup, 'Main job was terminated via SIGTERM');
136
+ process.exit(1);
137
+ }));
138
+ }
139
+ const nxCloudDistributedTasksRunner = (tasks, options, context) => __awaiter(void 0, void 0, void 0, function* () {
140
+ if (environment_1.VERBOSE_LOGGING) {
141
+ output.note({
142
+ title: 'Starting distributed command execution',
143
+ });
144
+ }
145
+ options.lifeCycle = new NoopLifeCycle();
146
+ const runGroup = (0, environment_1.getRunGroup)();
147
+ if (!runGroup) {
148
+ (0, print_run_group_error_1.printRunGroupError)();
149
+ return process.exit(1);
150
+ }
151
+ const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
152
+ const errorReporter = new error_reporter_api_1.ErrorReporterApi(options);
153
+ const fileStorage = new file_storage_1.FileStorage(encryption, errorReporter, true);
154
+ const cache = new Cache(options);
155
+ const api = new distributed_execution_api_1.DistributedExecutionApi(options);
156
+ attachSignalListenersToCompleteRunGroupOnError(api, runGroup);
157
+ try {
158
+ const taskGraph = getTaskGraph(context, tasks, options);
159
+ const r = yield runDistributedExecution(api, options, context, fileStorage, cache, runGroup, taskGraph);
160
+ if (r.commandStatus === 0) {
161
+ output.success({
162
+ title: 'Successfully completed running the command.',
163
+ bodyLines: [`See run details at ${r.runUrl}`],
164
+ });
165
+ }
166
+ else {
167
+ output.error({
168
+ title: 'Command execution failed.',
169
+ bodyLines: [`See run details at ${r.runUrl}`],
170
+ });
171
+ }
172
+ yield (0, metric_logger_1.submitRunMetrics)(options);
173
+ process.exit(r.commandStatus);
174
+ }
175
+ catch (e) {
176
+ output.error({
177
+ title: 'Unable to complete a run.',
178
+ bodyLines: [e.message],
179
+ });
180
+ if (e.axiosException) {
181
+ console.log(e.axiosException);
182
+ }
183
+ else {
184
+ console.log(e);
185
+ }
186
+ try {
187
+ yield api.completeRunGroupWithError(runGroup, `Main job terminated with an error: "${e.message}"`);
188
+ }
189
+ finally {
190
+ process.exit(1);
191
+ }
192
+ }
193
+ });
194
+ exports.nxCloudDistributedTasksRunner = nxCloudDistributedTasksRunner;
195
+ function getTaskGraph(context, tasks, options) {
196
+ if (context.taskGraph) {
197
+ return context.taskGraph;
198
+ }
199
+ else {
200
+ const nxjson = JSON.parse(stripJsonComments((0, fs_1.readFileSync)(`${workspaceRoot}/nx.json`).toString()));
201
+ return new task_graph_creator_1.TaskGraphCreator(context.projectGraph, getDefaultDependencyConfigs(nxjson, options)).createTaskGraph(tasks);
202
+ }
203
+ }
204
+ function getDefaultDependencyConfigs(nxJson, runnerOptions) {
205
+ var _a, _b;
206
+ const defaults = (_a = nxJson.targetDependencies) !== null && _a !== void 0 ? _a : {};
207
+ const strictlyOrderedTargets = runnerOptions
208
+ ? (_b = runnerOptions.strictlyOrderedTargets) !== null && _b !== void 0 ? _b : ['build']
209
+ : [];
210
+ // Strictly Ordered Targets depend on their dependencies
211
+ for (const target of strictlyOrderedTargets) {
212
+ defaults[target] = defaults[target] || [];
213
+ defaults[target].push({
214
+ target,
215
+ projects: 'dependencies',
216
+ });
217
+ }
218
+ return defaults;
219
+ }
220
+ //# sourceMappingURL=distributed-execution.runner.js.map
@@ -1 +1,37 @@
1
- const a8_0x5022=['values','tasks','size','dependencies','__esModule','defineProperty','delete','push','splitTasksIntoStages'];(function(_0x43a1ea,_0x5022d3){const _0x426540=function(_0x121bca){while(--_0x121bca){_0x43a1ea['push'](_0x43a1ea['shift']());}};_0x426540(++_0x5022d3);}(a8_0x5022,0x180));const a8_0x4265=function(_0x43a1ea,_0x5022d3){_0x43a1ea=_0x43a1ea-0x0;let _0x426540=a8_0x5022[_0x43a1ea];return _0x426540;};'use strict';Object[a8_0x4265('0x8')](exports,a8_0x4265('0x7'),{'value':!![]});exports[a8_0x4265('0x2')]=void 0x0;function splitTasksIntoStages(_0x1a38a9){const _0xc7aa31=[];const _0x5d0a33=new Set(Object[a8_0x4265('0x3')](_0x1a38a9['tasks'])['map'](_0x41987d=>_0x41987d['id']));let _0x463c98=0x0;while(_0x5d0a33[a8_0x4265('0x5')]>0x0){const _0x5ea821=_0xc7aa31[_0x463c98]=[];for(const _0x515391 of _0x5d0a33){let _0x51a4a5=!![];for(const _0x5319a5 of _0x1a38a9[a8_0x4265('0x6')][_0x515391]){if(_0x5d0a33['has'](_0x5319a5)){_0x51a4a5=![];break;}}if(!_0x51a4a5){continue;}const _0x470b1d=_0x1a38a9[a8_0x4265('0x4')][_0x515391];_0x5ea821[a8_0x4265('0x1')](_0x470b1d);}for(const _0x422088 of _0x5ea821){_0x5d0a33[a8_0x4265('0x0')](_0x422088['id']);}_0x463c98++;}return _0xc7aa31;}exports[a8_0x4265('0x2')]=splitTasksIntoStages;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.splitTasksIntoStages = void 0;
4
+ function splitTasksIntoStages(taskGraph) {
5
+ const stages = [];
6
+ const notStagedTaskIds = new Set(Object.values(taskGraph.tasks).map((t) => t.id));
7
+ let stageIndex = 0;
8
+ // Loop through tasks and try to stage them. As tasks are staged, they are removed from the loop
9
+ while (notStagedTaskIds.size > 0) {
10
+ const currentStage = (stages[stageIndex] = []);
11
+ for (const taskId of notStagedTaskIds) {
12
+ let ready = true;
13
+ for (const dependency of taskGraph.dependencies[taskId]) {
14
+ if (notStagedTaskIds.has(dependency)) {
15
+ // dependency has not been staged yet, this task is not ready to be staged.
16
+ ready = false;
17
+ break;
18
+ }
19
+ }
20
+ // Some dependency still has not been staged, skip it for now, it will be processed again
21
+ if (!ready) {
22
+ continue;
23
+ }
24
+ // All the dependencies have been staged, let's stage it.
25
+ const task = taskGraph.tasks[taskId];
26
+ currentStage.push(task);
27
+ }
28
+ // Remove the entire new stage of tasks from the list
29
+ for (const task of currentStage) {
30
+ notStagedTaskIds.delete(task.id);
31
+ }
32
+ stageIndex++;
33
+ }
34
+ return stages;
35
+ }
36
+ exports.splitTasksIntoStages = splitTasksIntoStages;
37
+ //# sourceMappingURL=split-task-graph-into-stages.js.map
@@ -1 +1,77 @@
1
- const a9_0xd4b8=['tasks','createTaskGraph','has','target','add','addTaskDependencies','__esModule','map','indexOf','../../../utilities/nx-imports','findTask','projects','roots','self','dependencies','addTaskToGraph','filter','TaskGraphCreator','push','addDependencies','project','projectGraph','defaultTargetDependencies'];(function(_0x481fe0,_0xd4b8be){const _0x2a6541=function(_0x5e086f){while(--_0x5e086f){_0x481fe0['push'](_0x481fe0['shift']());}};_0x2a6541(++_0xd4b8be);}(a9_0xd4b8,0x193));const a9_0x2a65=function(_0x481fe0,_0xd4b8be){_0x481fe0=_0x481fe0-0x0;let _0x2a6541=a9_0xd4b8[_0x481fe0];return _0x2a6541;};'use strict';Object['defineProperty'](exports,a9_0x2a65('0x11'),{'value':!![]});exports['TaskGraphCreator']=void 0x0;const {getDependencyConfigs}=require(a9_0x2a65('0x14'));class TaskGraphCreator{constructor(_0x472d8b,_0x5cd102){this['projectGraph']=_0x472d8b;this[a9_0x2a65('0xa')]=_0x5cd102;}[a9_0x2a65('0xc')](_0x34afdb){const _0x26ef77={'roots':[],'tasks':{},'dependencies':{}};for(const _0xc5bfab of _0x34afdb){this[a9_0x2a65('0x3')](_0xc5bfab,_0x26ef77);const _0x10a8a6=getDependencyConfigs(_0xc5bfab['target'],this['defaultTargetDependencies'],this[a9_0x2a65('0x9')]);if(!_0x10a8a6){continue;}this[a9_0x2a65('0x10')](_0xc5bfab,_0x10a8a6,_0x34afdb,_0x26ef77);}_0x26ef77[a9_0x2a65('0x0')]=Object['keys'](_0x26ef77['dependencies'])[a9_0x2a65('0x4')](_0x5eaf15=>_0x26ef77['dependencies'][_0x5eaf15]['length']===0x0);return _0x26ef77;}[a9_0x2a65('0x10')](_0x239154,_0x58e49b,_0x1fa536,_0x24ae59){for(const _0x334bb9 of _0x58e49b){if(_0x334bb9[a9_0x2a65('0x16')]===a9_0x2a65('0x1')){for(const _0x53edf5 of _0x1fa536){if(_0x53edf5[a9_0x2a65('0xe')][a9_0x2a65('0x8')]===_0x239154['target'][a9_0x2a65('0x8')]&&_0x53edf5[a9_0x2a65('0xe')][a9_0x2a65('0xe')]===_0x334bb9[a9_0x2a65('0xe')]){_0x24ae59[a9_0x2a65('0x2')][_0x239154['id']][a9_0x2a65('0x6')](_0x53edf5['id']);}}}else if(_0x334bb9[a9_0x2a65('0x16')]===a9_0x2a65('0x2')){const _0x506910=new Set();this[a9_0x2a65('0x7')](_0x239154[a9_0x2a65('0xe')]['project'],_0x334bb9[a9_0x2a65('0xe')],_0x1fa536,_0x24ae59,_0x239154['id'],_0x506910);}}}[a9_0x2a65('0x7')](_0x5e9460,_0x4a1a50,_0x4203df,_0x434248,_0x58b635,_0x118541){_0x118541[a9_0x2a65('0xf')](_0x5e9460);const _0x95177d=this['projectGraph'][a9_0x2a65('0x2')][_0x5e9460];if(_0x95177d){const _0xf6bb5e=_0x95177d[a9_0x2a65('0x12')](_0x252afe=>_0x252afe[a9_0x2a65('0xe')]);for(const _0x143dee of _0xf6bb5e){if(_0x118541[a9_0x2a65('0xd')](_0x143dee)){continue;}const _0x270076=this[a9_0x2a65('0x15')]({'project':_0x143dee,'target':_0x4a1a50},_0x4203df);if(_0x270076){if(_0x434248[a9_0x2a65('0x2')][_0x58b635][a9_0x2a65('0x13')](_0x270076['id'])===-0x1){_0x434248['dependencies'][_0x58b635][a9_0x2a65('0x6')](_0x270076['id']);}}else{this[a9_0x2a65('0x7')](_0x143dee,_0x4a1a50,_0x4203df,_0x434248,_0x58b635,_0x118541);}}}}['findTask']({project,target},_0x3141aa){return _0x3141aa['find'](_0x19125c=>_0x19125c[a9_0x2a65('0xe')][a9_0x2a65('0x8')]===project&&_0x19125c[a9_0x2a65('0xe')]['target']===target);}[a9_0x2a65('0x3')](_0x13f846,_0x1d7d8f){_0x1d7d8f[a9_0x2a65('0xb')][_0x13f846['id']]=_0x13f846;_0x1d7d8f[a9_0x2a65('0x2')][_0x13f846['id']]=[];}}exports[a9_0x2a65('0x5')]=TaskGraphCreator;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TaskGraphCreator = void 0;
4
+ const { getDependencyConfigs } = require('../../../utilities/nx-imports');
5
+ /**
6
+ * This is only used for versions of Nx prior to 14 where the task graph
7
+ * wasn't part of the context so we have to recreate it
8
+ */
9
+ class TaskGraphCreator {
10
+ constructor(projectGraph, defaultTargetDependencies) {
11
+ this.projectGraph = projectGraph;
12
+ this.defaultTargetDependencies = defaultTargetDependencies;
13
+ }
14
+ createTaskGraph(tasks) {
15
+ const graph = {
16
+ roots: [],
17
+ tasks: {},
18
+ dependencies: {},
19
+ };
20
+ for (const task of tasks) {
21
+ this.addTaskToGraph(task, graph);
22
+ const dependencyConfigs = getDependencyConfigs(task.target, this.defaultTargetDependencies, this.projectGraph);
23
+ if (!dependencyConfigs) {
24
+ continue;
25
+ }
26
+ this.addTaskDependencies(task, dependencyConfigs, tasks, graph);
27
+ }
28
+ graph.roots = Object.keys(graph.dependencies).filter((k) => graph.dependencies[k].length === 0);
29
+ return graph;
30
+ }
31
+ addTaskDependencies(task, dependencyConfigs, tasks, graph) {
32
+ for (const dependencyConfig of dependencyConfigs) {
33
+ if (dependencyConfig.projects === 'self') {
34
+ for (const t of tasks) {
35
+ if (t.target.project === task.target.project &&
36
+ t.target.target === dependencyConfig.target) {
37
+ graph.dependencies[task.id].push(t.id);
38
+ }
39
+ }
40
+ }
41
+ else if (dependencyConfig.projects === 'dependencies') {
42
+ const seen = new Set();
43
+ this.addDependencies(task.target.project, dependencyConfig.target, tasks, graph, task.id, seen);
44
+ }
45
+ }
46
+ }
47
+ addDependencies(project, target, tasks, graph, taskId, seen) {
48
+ seen.add(project);
49
+ const dependencies = this.projectGraph.dependencies[project];
50
+ if (dependencies) {
51
+ const projectDependencies = dependencies.map((dependency) => dependency.target);
52
+ for (const projectDependency of projectDependencies) {
53
+ if (seen.has(projectDependency)) {
54
+ continue;
55
+ }
56
+ const dependency = this.findTask({ project: projectDependency, target }, tasks);
57
+ if (dependency) {
58
+ if (graph.dependencies[taskId].indexOf(dependency.id) === -1) {
59
+ graph.dependencies[taskId].push(dependency.id);
60
+ }
61
+ }
62
+ else {
63
+ this.addDependencies(projectDependency, target, tasks, graph, taskId, seen);
64
+ }
65
+ }
66
+ }
67
+ }
68
+ findTask({ project, target }, tasks) {
69
+ return tasks.find((t) => t.target.project === project && t.target.target === target);
70
+ }
71
+ addTaskToGraph(task, graph) {
72
+ graph.tasks[task.id] = task;
73
+ graph.dependencies[task.id] = [];
74
+ }
75
+ }
76
+ exports.TaskGraphCreator = TaskGraphCreator;
77
+ //# sourceMappingURL=task-graph-creator.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/nx-cloud",
3
- "version": "14.4.1",
3
+ "version": "14.4.2-beta.1",
4
4
  "description": "Nx Cloud plugin for Nx",
5
5
  "keywords": [
6
6
  "Monorepo",