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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ErrorReporterApi = void 0;
13
- const axios_1 = require("../../utilities/axios");
14
- const { output } = require('../../utilities/nx-imports');
15
- class ErrorReporterApi {
16
- constructor(options) {
17
- this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
18
- }
19
- reportError(message) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- try {
22
- yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/report-client-error', {
23
- message,
24
- }));
25
- }
26
- catch (e) {
27
- output.warn({
28
- title: `Unable to record the following error: '${message}'`,
29
- bodyLines: [e.message],
30
- });
31
- }
32
- });
33
- }
34
- }
35
- exports.ErrorReporterApi = ErrorReporterApi;
36
- //# sourceMappingURL=error-reporter.api.js.map
1
+ const a0_0x4a6b=['../../utilities/nx-imports','message','reportError','__esModule','createApiAxiosInstance','Unable\x20to\x20record\x20the\x20following\x20error:\x20\x27','apply','__awaiter','warn','post','ErrorReporterApi','/nx-cloud/report-client-error','next','axiosMultipleTries','done','../../utilities/axios','defineProperty','apiAxiosInstance'];(function(_0x34b1ac,_0x4a6bd6){const _0x1d0e86=function(_0x1fdff6){while(--_0x1fdff6){_0x34b1ac['push'](_0x34b1ac['shift']());}};_0x1d0e86(++_0x4a6bd6);}(a0_0x4a6b,0x141));const a0_0x1d0e=function(_0x34b1ac,_0x4a6bd6){_0x34b1ac=_0x34b1ac-0x0;let _0x1d0e86=a0_0x4a6b[_0x34b1ac];return _0x1d0e86;};'use strict';var __awaiter=this&&this[a0_0x1d0e('0xa')]||function(_0x4083db,_0x268419,_0x5a595,_0x4087b6){function _0x7c84a5(_0x5a46ea){return _0x5a46ea instanceof _0x5a595?_0x5a46ea:new _0x5a595(function(_0x5171e9){_0x5171e9(_0x5a46ea);});}return new(_0x5a595||(_0x5a595=Promise))(function(_0x2f3089,_0x34b7b6){function _0x3cbdf8(_0x19c755){try{_0x2b0a82(_0x4087b6[a0_0x1d0e('0xf')](_0x19c755));}catch(_0x146622){_0x34b7b6(_0x146622);}}function _0x6633cd(_0x471c17){try{_0x2b0a82(_0x4087b6['throw'](_0x471c17));}catch(_0x1e953c){_0x34b7b6(_0x1e953c);}}function _0x2b0a82(_0x323a20){_0x323a20[a0_0x1d0e('0x11')]?_0x2f3089(_0x323a20['value']):_0x7c84a5(_0x323a20['value'])['then'](_0x3cbdf8,_0x6633cd);}_0x2b0a82((_0x4087b6=_0x4087b6[a0_0x1d0e('0x9')](_0x4083db,_0x268419||[]))[a0_0x1d0e('0xf')]());});};Object[a0_0x1d0e('0x1')](exports,a0_0x1d0e('0x6'),{'value':!![]});exports[a0_0x1d0e('0xd')]=void 0x0;const axios_1=require(a0_0x1d0e('0x0'));const {output}=require(a0_0x1d0e('0x3'));class ErrorReporterApi{constructor(_0xf0e689){this['apiAxiosInstance']=(0x0,axios_1[a0_0x1d0e('0x7')])(_0xf0e689);}[a0_0x1d0e('0x5')](_0x304609){return __awaiter(this,void 0x0,void 0x0,function*(){try{yield(0x0,axios_1[a0_0x1d0e('0x10')])(()=>this[a0_0x1d0e('0x2')][a0_0x1d0e('0xc')](a0_0x1d0e('0xe'),{'message':_0x304609}));}catch(_0x105ffe){output[a0_0x1d0e('0xb')]({'title':a0_0x1d0e('0x8')+_0x304609+'\x27','bodyLines':[_0x105ffe[a0_0x1d0e('0x4')]]});}});}}exports[a0_0x1d0e('0xd')]=ErrorReporterApi;
@@ -1,65 +1 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RunGroupApi = void 0;
13
- const axios_1 = require("../../utilities/axios");
14
- const metric_logger_1 = require("../../utilities/metric-logger");
15
- const { output } = require('../../utilities/nx-imports');
16
- class RunGroupApi {
17
- constructor(options) {
18
- this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
19
- }
20
- createRunGroup(branch, runGroup) {
21
- var _a;
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const recorder = (0, metric_logger_1.createMetricRecorder)('createRunGroup');
24
- try {
25
- const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/create-run-group', {
26
- branch: branch,
27
- runGroup: runGroup,
28
- }));
29
- recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
30
- }
31
- catch (e) {
32
- recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
33
- ? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
34
- : metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
35
- output.error({
36
- title: e.message,
37
- });
38
- process.exit(1);
39
- }
40
- });
41
- }
42
- completeRunGroup(runGroup) {
43
- var _a;
44
- return __awaiter(this, void 0, void 0, function* () {
45
- const recorder = (0, metric_logger_1.createMetricRecorder)('createRunGroup');
46
- try {
47
- const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
48
- runGroup: runGroup,
49
- }));
50
- recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
51
- }
52
- catch (e) {
53
- recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
54
- ? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
55
- : metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
56
- output.error({
57
- title: e.message,
58
- });
59
- process.exit(1);
60
- }
61
- });
62
- }
63
- }
64
- exports.RunGroupApi = RunGroupApi;
65
- //# sourceMappingURL=run-group.api.js.map
1
+ const a1_0xc099=['axiosMultipleTries','exit','message','completeRunGroup','done','../../utilities/axios','/nx-cloud/executions/create-run-group','createRunGroup','next','/nx-cloud/executions/complete-run-group','__esModule','createApiAxiosInstance','../../utilities/metric-logger','response','RUNNER_FAILURE_PERF_ENTRY','apply','then','apiAxiosInstance','RunGroupApi','recordMetric','value','createMetricRecorder','error','axiosException'];(function(_0x8ae972,_0xc099c7){const _0x213d4b=function(_0x5d8dc2){while(--_0x5d8dc2){_0x8ae972['push'](_0x8ae972['shift']());}};_0x213d4b(++_0xc099c7);}(a1_0xc099,0x88));const a1_0x213d=function(_0x8ae972,_0xc099c7){_0x8ae972=_0x8ae972-0x0;let _0x213d4b=a1_0xc099[_0x8ae972];return _0x213d4b;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x5c61c3,_0x5d0894,_0x303275,_0x2b030d){function _0x36310e(_0x315b03){return _0x315b03 instanceof _0x303275?_0x315b03:new _0x303275(function(_0x75e815){_0x75e815(_0x315b03);});}return new(_0x303275||(_0x303275=Promise))(function(_0x52224a,_0x51ae8a){function _0x198c0a(_0x595a36){try{_0x4486f8(_0x2b030d[a1_0x213d('0x10')](_0x595a36));}catch(_0x3039aa){_0x51ae8a(_0x3039aa);}}function _0x403c67(_0x2ad000){try{_0x4486f8(_0x2b030d['throw'](_0x2ad000));}catch(_0x491a75){_0x51ae8a(_0x491a75);}}function _0x4486f8(_0xd0eb9d){_0xd0eb9d[a1_0x213d('0xc')]?_0x52224a(_0xd0eb9d[a1_0x213d('0x4')]):_0x36310e(_0xd0eb9d['value'])[a1_0x213d('0x0')](_0x198c0a,_0x403c67);}_0x4486f8((_0x2b030d=_0x2b030d[a1_0x213d('0x17')](_0x5c61c3,_0x5d0894||[]))['next']());});};Object['defineProperty'](exports,a1_0x213d('0x12'),{'value':!![]});exports['RunGroupApi']=void 0x0;const axios_1=require(a1_0x213d('0xd'));const metric_logger_1=require(a1_0x213d('0x14'));const {output}=require('../../utilities/nx-imports');class RunGroupApi{constructor(_0x15e4bc){this[a1_0x213d('0x1')]=(0x0,axios_1[a1_0x213d('0x13')])(_0x15e4bc);}[a1_0x213d('0xf')](_0x14c1dc,_0x43205a){var _0x46f952;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x1ad305=(0x0,metric_logger_1[a1_0x213d('0x5')])('createRunGroup');try{const _0x4e202a=yield(0x0,axios_1[a1_0x213d('0x8')])(()=>this[a1_0x213d('0x1')]['post'](a1_0x213d('0xe'),{'branch':_0x14c1dc,'runGroup':_0x43205a}));_0x1ad305['recordMetric']((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x4e202a));}catch(_0x3d05db){_0x1ad305[a1_0x213d('0x3')](((_0x46f952=_0x3d05db===null||_0x3d05db===void 0x0?void 0x0:_0x3d05db[a1_0x213d('0x7')])===null||_0x46f952===void 0x0?void 0x0:_0x46f952[a1_0x213d('0x15')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x3d05db[a1_0x213d('0x7')][a1_0x213d('0x15')]):metric_logger_1[a1_0x213d('0x16')]);output[a1_0x213d('0x6')]({'title':_0x3d05db[a1_0x213d('0xa')]});process[a1_0x213d('0x9')](0x1);}});}[a1_0x213d('0xb')](_0x3bdcd8){var _0x2e61aa;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x451d20=(0x0,metric_logger_1[a1_0x213d('0x5')])(a1_0x213d('0xf'));try{const _0x8a9ea7=yield(0x0,axios_1['axiosMultipleTries'])(()=>this[a1_0x213d('0x1')]['post'](a1_0x213d('0x11'),{'runGroup':_0x3bdcd8}));_0x451d20[a1_0x213d('0x3')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x8a9ea7));}catch(_0x41adf9){_0x451d20[a1_0x213d('0x3')](((_0x2e61aa=_0x41adf9===null||_0x41adf9===void 0x0?void 0x0:_0x41adf9[a1_0x213d('0x7')])===null||_0x2e61aa===void 0x0?void 0x0:_0x2e61aa[a1_0x213d('0x15')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x41adf9[a1_0x213d('0x7')][a1_0x213d('0x15')]):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);output[a1_0x213d('0x6')]({'title':_0x41adf9[a1_0x213d('0xa')]});process[a1_0x213d('0x9')](0x1);}});}}exports[a1_0x213d('0x2')]=RunGroupApi;
@@ -1,141 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CloudEnabledLifeCycle = void 0;
4
- const path = require("path");
5
- const path_1 = require("path");
6
- const fs_1 = require("fs");
7
- const environment_1 = require("../../../utilities/environment");
8
- const { workspaceRoot, unparse } = require('../../../utilities/nx-imports');
9
- class CloudEnabledLifeCycle {
10
- constructor(runContext, cacheDirectory, skipNxCache, collectTerminalOutput, cacheableOperations, outputObfuscator, tasks) {
11
- this.runContext = runContext;
12
- this.cacheDirectory = cacheDirectory;
13
- this.skipNxCache = skipNxCache;
14
- this.collectTerminalOutput = collectTerminalOutput;
15
- this.cacheableOperations = cacheableOperations;
16
- this.outputObfuscator = outputObfuscator;
17
- this.tasks = tasks;
18
- }
19
- scheduleTask(task) {
20
- this.runContext.scheduledTasks.push(task);
21
- }
22
- startTask(task) {
23
- const overrides = Object.assign({}, (task.overrides || {}));
24
- if (task.target.configuration) {
25
- overrides['configuration'] = task.target.configuration;
26
- }
27
- this.tasks.push({
28
- taskId: task.id,
29
- startTime: new Date().toISOString(),
30
- target: task.target.target,
31
- projectName: task.target.project,
32
- hash: task.hash,
33
- hashDetails: this.cleanUpHashDetails(task.hashDetails),
34
- params: unparse(overrides).join(' '),
35
- });
36
- }
37
- // Used for older version for Nx. Remove in Dec 2022
38
- endTask(task, code) {
39
- let cacheStatus;
40
- if (this.runContext.statuses[task.hash]) {
41
- cacheStatus = this.runContext.statuses[task.hash];
42
- }
43
- else {
44
- if (this.cacheableOperations.indexOf(task.target.target) > -1 &&
45
- !this.skipNxCache) {
46
- cacheStatus = 'local-cache-hit';
47
- }
48
- else {
49
- cacheStatus = 'cache-miss';
50
- }
51
- }
52
- this.updateStartedTask(task, code, cacheStatus);
53
- }
54
- endTasks(tasks) {
55
- for (let t of tasks) {
56
- const status = t.status === 'remote-cache'
57
- ? 'remote-cache-hit'
58
- : t.status === 'local-cache' ||
59
- t.status === 'local-cache-kept-existing'
60
- ? 'local-cache-hit'
61
- : 'cache-miss';
62
- this.updateStartedTask(t.task, t.code, status);
63
- }
64
- }
65
- endCommand() { }
66
- updateStartedTask(task, code, cacheStatus) {
67
- const startedTask = this.tasks.find((t) => t.taskId === task.id);
68
- if (!startedTask) {
69
- throw new Error(`Cannot find task ${task.id}`);
70
- }
71
- startedTask.endTime = new Date().toISOString();
72
- startedTask.status = code;
73
- startedTask.params = this.outputObfuscator.obfuscate(startedTask.params);
74
- startedTask.cacheStatus = cacheStatus;
75
- if (this.collectTerminalOutput) {
76
- startedTask.terminalOutput = this.getTerminalOutput(task.hash, startedTask.cacheStatus, code);
77
- }
78
- }
79
- getTerminalOutput(hash, cacheStatus, code) {
80
- let dir;
81
- if (this.cacheDirectory) {
82
- if (this.cacheDirectory.startsWith('./')) {
83
- dir = (0, path_1.join)(workspaceRoot, this.cacheDirectory);
84
- }
85
- else {
86
- dir = this.cacheDirectory;
87
- }
88
- }
89
- else {
90
- dir = (0, path_1.join)(workspaceRoot, 'node_modules', '.cache', 'nx');
91
- }
92
- try {
93
- const taskOutput = this.readTerminalOutputFile(dir, hash);
94
- const taskOutputSanitized = this.outputObfuscator.obfuscate(taskOutput);
95
- if (environment_1.NX_CLOUD_UNLIMITED_OUTPUT)
96
- return taskOutputSanitized;
97
- const maxCharacters = cacheStatus === 'cache-miss'
98
- ? code === 0
99
- ? CloudEnabledLifeCycle.MAX_CHARACTERS_SUCCESSFUL_TASK
100
- : CloudEnabledLifeCycle.MAX_CHARACTERS_FAILED_TASK
101
- : CloudEnabledLifeCycle.MAX_CHARACTERS_CACHED_TASK;
102
- return taskOutputSanitized.length > maxCharacters
103
- ? `TRUNCATED\n\n${taskOutputSanitized.slice(taskOutputSanitized.length - maxCharacters)}`
104
- : taskOutputSanitized;
105
- }
106
- catch (e) {
107
- return '';
108
- }
109
- }
110
- cleanUpHashDetails(hashDetails) {
111
- const nodes = {};
112
- Object.keys(hashDetails.nodes)
113
- .filter((k) => !k.startsWith('npm:'))
114
- .forEach((k) => {
115
- nodes[k] = hashDetails.nodes[k];
116
- });
117
- return {
118
- nodes,
119
- runtime: hashDetails.runtime,
120
- implicitDeps: hashDetails.implicitDeps,
121
- };
122
- }
123
- readTerminalOutputFile(dir, hash) {
124
- try {
125
- return (0, fs_1.readFileSync)(path.join(dir, 'terminalOutputs', hash)).toString();
126
- }
127
- catch (_a) {
128
- try {
129
- return (0, fs_1.readFileSync)(path.join(dir, hash, 'terminalOutput')).toString();
130
- }
131
- catch (_b) {
132
- return '';
133
- }
134
- }
135
- }
136
- }
137
- exports.CloudEnabledLifeCycle = CloudEnabledLifeCycle;
138
- CloudEnabledLifeCycle.MAX_CHARACTERS_FAILED_TASK = 200000;
139
- CloudEnabledLifeCycle.MAX_CHARACTERS_SUCCESSFUL_TASK = 20000;
140
- CloudEnabledLifeCycle.MAX_CHARACTERS_CACHED_TASK = 20000;
141
- //# sourceMappingURL=cloud-enabled-life-cycle.js.map
1
+ const a0_0x3a17=['push','code','runtime','defineProperty','startsWith','NX_CLOUD_UNLIMITED_OUTPUT','cacheableOperations','MAX_CHARACTERS_SUCCESSFUL_TASK','readTerminalOutputFile','implicitDeps','endTime','npm:','scheduledTasks','__esModule','MAX_CHARACTERS_CACHED_TASK','remote-cache-hit','filter','overrides','Cannot\x20find\x20task\x20','skipNxCache','cleanUpHashDetails','CloudEnabledLifeCycle','nodes','remote-cache','../../../utilities/nx-imports','terminalOutputs','status','join','local-cache-hit','terminalOutput','target','updateStartedTask','find','tasks','runContext','MAX_CHARACTERS_FAILED_TASK','indexOf','endCommand','assign','TRUNCATED\x0a\x0a','cache-miss','length','outputObfuscator','project','taskId','toString','statuses','slice','readFileSync','forEach','task','toISOString','path','configuration','params','obfuscate','endTasks','cacheStatus','cacheDirectory','local-cache-kept-existing','getTerminalOutput','collectTerminalOutput','hash'];(function(_0x5cea3a,_0x3a171c){const _0xc3145d=function(_0x27350b){while(--_0x27350b){_0x5cea3a['push'](_0x5cea3a['shift']());}};_0xc3145d(++_0x3a171c);}(a0_0x3a17,0x1ea));const a0_0xc314=function(_0x5cea3a,_0x3a171c){_0x5cea3a=_0x5cea3a-0x0;let _0xc3145d=a0_0x3a17[_0x5cea3a];return _0xc3145d;};'use strict';Object[a0_0xc314('0x11')](exports,a0_0xc314('0x1b'),{'value':!![]});exports['CloudEnabledLifeCycle']=void 0x0;const path=require(a0_0xc314('0x3'));const path_1=require(a0_0xc314('0x3'));const fs_1=require('fs');const environment_1=require('../../../utilities/environment');const {workspaceRoot,unparse}=require(a0_0xc314('0x26'));class CloudEnabledLifeCycle{constructor(_0x4a123a,_0x128b53,_0x38eeeb,_0x33ef30,_0x4b9f13,_0x447bb9,_0x5719c1){this[a0_0xc314('0x30')]=_0x4a123a;this['cacheDirectory']=_0x128b53;this[a0_0xc314('0x21')]=_0x38eeeb;this[a0_0xc314('0xc')]=_0x33ef30;this[a0_0xc314('0x14')]=_0x4b9f13;this[a0_0xc314('0x38')]=_0x447bb9;this[a0_0xc314('0x2f')]=_0x5719c1;}['scheduleTask'](_0x32760f){this[a0_0xc314('0x30')][a0_0xc314('0x1a')][a0_0xc314('0xe')](_0x32760f);}['startTask'](_0x3ac6e1){const _0x21b434=Object[a0_0xc314('0x34')]({},_0x3ac6e1[a0_0xc314('0x1f')]||{});if(_0x3ac6e1[a0_0xc314('0x2c')][a0_0xc314('0x4')]){_0x21b434['configuration']=_0x3ac6e1['target'][a0_0xc314('0x4')];}this[a0_0xc314('0x2f')]['push']({'taskId':_0x3ac6e1['id'],'startTime':new Date()['toISOString'](),'target':_0x3ac6e1[a0_0xc314('0x2c')][a0_0xc314('0x2c')],'projectName':_0x3ac6e1[a0_0xc314('0x2c')][a0_0xc314('0x39')],'hash':_0x3ac6e1[a0_0xc314('0xd')],'hashDetails':this['cleanUpHashDetails'](_0x3ac6e1['hashDetails']),'params':unparse(_0x21b434)[a0_0xc314('0x29')]('\x20')});}['endTask'](_0x567b16,_0x2499a6){let _0x3e4be3;if(this['runContext'][a0_0xc314('0x3c')][_0x567b16[a0_0xc314('0xd')]]){_0x3e4be3=this[a0_0xc314('0x30')][a0_0xc314('0x3c')][_0x567b16[a0_0xc314('0xd')]];}else{if(this[a0_0xc314('0x14')][a0_0xc314('0x32')](_0x567b16[a0_0xc314('0x2c')][a0_0xc314('0x2c')])>-0x1&&!this[a0_0xc314('0x21')]){_0x3e4be3=a0_0xc314('0x2a');}else{_0x3e4be3=a0_0xc314('0x36');}}this[a0_0xc314('0x2d')](_0x567b16,_0x2499a6,_0x3e4be3);}[a0_0xc314('0x7')](_0x35ef9b){for(let _0x2bb86b of _0x35ef9b){const _0xc0dac4=_0x2bb86b[a0_0xc314('0x28')]===a0_0xc314('0x25')?a0_0xc314('0x1d'):_0x2bb86b['status']==='local-cache'||_0x2bb86b[a0_0xc314('0x28')]===a0_0xc314('0xa')?a0_0xc314('0x2a'):a0_0xc314('0x36');this[a0_0xc314('0x2d')](_0x2bb86b[a0_0xc314('0x1')],_0x2bb86b[a0_0xc314('0xf')],_0xc0dac4);}}[a0_0xc314('0x33')](){}[a0_0xc314('0x2d')](_0x169ff6,_0x18bbb6,_0x322325){const _0x463534=this[a0_0xc314('0x2f')][a0_0xc314('0x2e')](_0x2c4300=>_0x2c4300[a0_0xc314('0x3a')]===_0x169ff6['id']);if(!_0x463534){throw new Error(a0_0xc314('0x20')+_0x169ff6['id']);}_0x463534[a0_0xc314('0x18')]=new Date()[a0_0xc314('0x2')]();_0x463534[a0_0xc314('0x28')]=_0x18bbb6;_0x463534[a0_0xc314('0x5')]=this[a0_0xc314('0x38')][a0_0xc314('0x6')](_0x463534[a0_0xc314('0x5')]);_0x463534[a0_0xc314('0x8')]=_0x322325;if(this[a0_0xc314('0xc')]){_0x463534[a0_0xc314('0x2b')]=this[a0_0xc314('0xb')](_0x169ff6[a0_0xc314('0xd')],_0x463534[a0_0xc314('0x8')],_0x18bbb6);}}[a0_0xc314('0xb')](_0x50bed2,_0x5ecaf0,_0x44f856){let _0x1d6c58;if(this[a0_0xc314('0x9')]){if(this['cacheDirectory'][a0_0xc314('0x12')]('./')){_0x1d6c58=(0x0,path_1[a0_0xc314('0x29')])(workspaceRoot,this['cacheDirectory']);}else{_0x1d6c58=this['cacheDirectory'];}}else{_0x1d6c58=(0x0,path_1[a0_0xc314('0x29')])(workspaceRoot,'node_modules','.cache','nx');}try{const _0x4a327d=this[a0_0xc314('0x16')](_0x1d6c58,_0x50bed2);const _0xb7f607=this[a0_0xc314('0x38')][a0_0xc314('0x6')](_0x4a327d);if(environment_1[a0_0xc314('0x13')])return _0xb7f607;const _0x525a4c=_0x5ecaf0===a0_0xc314('0x36')?_0x44f856===0x0?CloudEnabledLifeCycle[a0_0xc314('0x15')]:CloudEnabledLifeCycle[a0_0xc314('0x31')]:CloudEnabledLifeCycle['MAX_CHARACTERS_CACHED_TASK'];return _0xb7f607['length']>_0x525a4c?a0_0xc314('0x35')+_0xb7f607[a0_0xc314('0x3d')](_0xb7f607[a0_0xc314('0x37')]-_0x525a4c):_0xb7f607;}catch(_0x41d68f){return'';}}[a0_0xc314('0x22')](_0x24e111){const _0x54f8a5={};Object['keys'](_0x24e111[a0_0xc314('0x24')])[a0_0xc314('0x1e')](_0x4f1637=>!_0x4f1637[a0_0xc314('0x12')](a0_0xc314('0x19')))[a0_0xc314('0x0')](_0x1b8c7b=>{_0x54f8a5[_0x1b8c7b]=_0x24e111[a0_0xc314('0x24')][_0x1b8c7b];});return{'nodes':_0x54f8a5,'runtime':_0x24e111[a0_0xc314('0x10')],'implicitDeps':_0x24e111[a0_0xc314('0x17')]};}[a0_0xc314('0x16')](_0x49c698,_0xffed54){try{return(0x0,fs_1[a0_0xc314('0x3e')])(path[a0_0xc314('0x29')](_0x49c698,a0_0xc314('0x27'),_0xffed54))[a0_0xc314('0x3b')]();}catch(_0x549dfc){try{return(0x0,fs_1['readFileSync'])(path[a0_0xc314('0x29')](_0x49c698,_0xffed54,a0_0xc314('0x2b')))[a0_0xc314('0x3b')]();}catch(_0x4fc4ec){return'';}}}}exports[a0_0xc314('0x23')]=CloudEnabledLifeCycle;CloudEnabledLifeCycle[a0_0xc314('0x31')]=0x30d40;CloudEnabledLifeCycle[a0_0xc314('0x15')]=0x4e20;CloudEnabledLifeCycle[a0_0xc314('0x1c')]=0x4e20;
@@ -1,169 +1 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.cloudEnabledTasksRunner = void 0;
13
- const message_reporter_1 = require("../../terminal-output/message-reporter");
14
- const end_of_run_message_1 = require("../../terminal-output/end-of-run-message");
15
- const output_obfuscator_1 = require("../../terminal-output/output-obfuscator");
16
- const cloud_enabled_life_cycle_1 = require("./cloud-enabled-life-cycle");
17
- const file_storage_1 = require("../../file-storage/file-storage");
18
- const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
19
- const environment_1 = require("../../../utilities/environment");
20
- const cloud_remote_cache_1 = require("./cloud-remote-cache");
21
- const cloud_run_api_1 = require("./cloud-run.api");
22
- const fs_1 = require("fs");
23
- const path = require("path");
24
- const metric_logger_1 = require("../../../utilities/metric-logger");
25
- const error_reporter_api_1 = require("../../api/error-reporter.api");
26
- const { tasksRunner, output } = require('../../../utilities/nx-imports');
27
- function createApi(errors, options, runContext) {
28
- const machineInfo = (0, environment_1.getMachineInfo)(options);
29
- return new cloud_run_api_1.CloudRunApi(errors, runContext, options, machineInfo);
30
- }
31
- function storeTaskHashes(taskExecutions, directory, distributedExecutionId) {
32
- const hashes = JSON.stringify(taskExecutions.map((t) => ({
33
- taskId: t.taskId,
34
- hash: t.hash,
35
- })));
36
- if (environment_1.VERBOSE_LOGGING) {
37
- output.note({
38
- title: `Executed tasks with hashes: ${hashes}`,
39
- });
40
- }
41
- (0, fs_1.writeFileSync)(path.join(directory, `tasks-hashes-${distributedExecutionId}`), hashes);
42
- }
43
- function onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133, inner) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- const runEndTime = new Date().toISOString();
46
- if (environment_1.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION) {
47
- storeTaskHashes(taskExecutions, options.cacheDirectory || './node_modules/.cache/nx', environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID);
48
- }
49
- const branch = (0, environment_1.getBranch)();
50
- const endRequest = yield Promise.all([
51
- remoteCache.waitForStoreRequestsToComplete(),
52
- api.endRun({
53
- command: outputObfuscator.obfuscate((0, environment_1.parseCommand)()),
54
- startTime: runStartTime,
55
- endTime: runEndTime,
56
- distributedExecutionId: environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID,
57
- branch: branch,
58
- scan: true,
59
- runGroup: (0, environment_1.getRunGroup)(),
60
- // only set sha if branch is set because we invoke a separate process,
61
- // which adds a few millis
62
- sha: branch ? (0, environment_1.extractGitSha)() : undefined,
63
- inner: inner,
64
- }, taskExecutions),
65
- ]);
66
- // this workaround is required because prior to Nx 13.3 we printed
67
- // the end message after the runner completes, so we need to wait for the
68
- // message to appear in the right place
69
- if (versionOfNxBefore133) {
70
- setTimeout(() => {
71
- messages.printMessages();
72
- if (!messages.anyErrors && !inner) {
73
- endOfRunMessage.printCacheHitsMessage();
74
- }
75
- }, 0);
76
- }
77
- else {
78
- messages.printMessages();
79
- if (!messages.anyErrors && !inner) {
80
- endOfRunMessage.printCacheHitsMessage();
81
- }
82
- }
83
- if (environment_1.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION) {
84
- if (!endRequest[0]) {
85
- output.error({
86
- title: `Agent wasn't able to store artifacts`,
87
- });
88
- messages.printMessages();
89
- process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
90
- }
91
- if (!endRequest[1]) {
92
- output.error({
93
- title: `Agent wasn't able to record its run`,
94
- });
95
- messages.printMessages();
96
- process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
97
- }
98
- }
99
- yield (0, metric_logger_1.submitRunMetrics)(options);
100
- });
101
- }
102
- function createLifeCycle(runContext, options, outputObfuscator, tasks) {
103
- const cloudEnabledLifeCycle = new cloud_enabled_life_cycle_1.CloudEnabledLifeCycle(runContext, options.cacheDirectory, !!options.skipNxCache, options.scan === undefined ? true : options.scan, options.cacheableOperations || [], outputObfuscator, tasks);
104
- try {
105
- const { CompositeLifeCycle } = require('../../../utilities/nx-imports');
106
- if (!CompositeLifeCycle)
107
- return cloudEnabledLifeCycle;
108
- return new CompositeLifeCycle([options.lifeCycle, cloudEnabledLifeCycle]);
109
- }
110
- catch (e) {
111
- return cloudEnabledLifeCycle;
112
- }
113
- }
114
- function cloudEnabledTasksRunner(tasks, options, context, inner = false) {
115
- const runContext = {
116
- statuses: {},
117
- scheduledTasks: [],
118
- requests: {},
119
- allTasks: tasks,
120
- };
121
- const versionOfNxBefore133 = options.lifeCycle === undefined;
122
- const taskExecutions = [];
123
- const messages = new message_reporter_1.MessageReporter(options);
124
- const api = createApi(messages, options, runContext);
125
- const endOfRunMessage = new end_of_run_message_1.EndOfRunMessage(runContext, taskExecutions);
126
- const outputObfuscator = new output_obfuscator_1.OutputObfuscator(options.maskedProperties);
127
- const hashes = tasks.map((t) => t.hash).filter((h) => !!h);
128
- const startRunRequest = api.startRun(environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID, hashes);
129
- hashes.forEach((hash) => {
130
- runContext.requests[hash] = startRunRequest;
131
- });
132
- const runStartTime = new Date().toISOString();
133
- const lifeCycle = createLifeCycle(runContext, options, outputObfuscator, taskExecutions);
134
- const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
135
- const errorApi = new error_reporter_api_1.ErrorReporterApi(options);
136
- const fileStorage = new file_storage_1.FileStorage(encryption, errorApi, false);
137
- const remoteCache = new cloud_remote_cache_1.CloudRemoteCache(messages, api, runContext, fileStorage);
138
- // have to reset it so we don't capture inner tasks
139
- delete process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID;
140
- const res = tasksRunner(tasks, Object.assign(Object.assign({}, options), { remoteCache, lifeCycle }), context);
141
- // observable -> legacy
142
- if (res.subscribe) {
143
- const { Subject } = require('rxjs/internal/Subject');
144
- const wrappedRes = new Subject();
145
- res.subscribe({
146
- next: (value) => wrappedRes.next(value),
147
- error: (err) => wrappedRes.error(err),
148
- complete: () => __awaiter(this, void 0, void 0, function* () {
149
- yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133, inner);
150
- wrappedRes.complete();
151
- }),
152
- });
153
- return wrappedRes;
154
- // promise
155
- }
156
- else {
157
- return res
158
- .then((r) => __awaiter(this, void 0, void 0, function* () {
159
- yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133, inner);
160
- return r;
161
- }))
162
- .catch((e) => __awaiter(this, void 0, void 0, function* () {
163
- yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133, inner);
164
- throw e;
165
- }));
166
- }
167
- }
168
- exports.cloudEnabledTasksRunner = cloudEnabledTasksRunner;
169
- //# sourceMappingURL=cloud-enabled.runner.js.map
1
+ const a1_0x1717=['getRunGroup','then','cacheableOperations','assign','printMessages','MessageReporter','cloudEnabledTasksRunner','../../terminal-output/output-obfuscator','lifeCycle','Agent\x20wasn\x27t\x20able\x20to\x20store\x20artifacts','../../../utilities/nx-imports','waitForStoreRequestsToComplete','E2EEncryption','scan','hash','__esModule','cacheDirectory','catch','./cloud-run.api','writeFileSync','value','OutputObfuscator','../../file-storage/e2e-encryption','exit','forEach','VERBOSE_LOGGING','../../terminal-output/message-reporter','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','FileStorage','error','CloudRunApi','taskId','../../../utilities/environment','printCacheHitsMessage','EndOfRunMessage','skipNxCache','stringify','Agent\x20wasn\x27t\x20able\x20to\x20record\x20its\x20run','subscribe','startRun','../../api/error-reporter.api','../../../utilities/metric-logger','env','../../terminal-output/end-of-run-message','getBranch','join','toISOString','anyErrors','DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE','filter','all','getMachineInfo','CloudEnabledLifeCycle','__awaiter','next','complete','requests','./node_modules/.cache/nx','map','endRun','done','maskedProperties','rxjs/internal/Subject','parseCommand'];(function(_0x26f30c,_0x171775){const _0x3272d0=function(_0x17a674){while(--_0x17a674){_0x26f30c['push'](_0x26f30c['shift']());}};_0x3272d0(++_0x171775);}(a1_0x1717,0x6e));const a1_0x3272=function(_0x26f30c,_0x171775){_0x26f30c=_0x26f30c-0x0;let _0x3272d0=a1_0x1717[_0x26f30c];return _0x3272d0;};'use strict';var __awaiter=this&&this[a1_0x3272('0x7')]||function(_0x43978e,_0x5c1f8e,_0x9888be,_0x516c04){function _0x129171(_0x13d5a6){return _0x13d5a6 instanceof _0x9888be?_0x13d5a6:new _0x9888be(function(_0x282c2f){_0x282c2f(_0x13d5a6);});}return new(_0x9888be||(_0x9888be=Promise))(function(_0x17a487,_0xc34a2c){function _0x2f171b(_0x5c900e){try{_0x41ab0d(_0x516c04[a1_0x3272('0x8')](_0x5c900e));}catch(_0x5709ef){_0xc34a2c(_0x5709ef);}}function _0xac9a47(_0x75f910){try{_0x41ab0d(_0x516c04['throw'](_0x75f910));}catch(_0x2916f0){_0xc34a2c(_0x2916f0);}}function _0x41ab0d(_0x1acdef){_0x1acdef[a1_0x3272('0xe')]?_0x17a487(_0x1acdef['value']):_0x129171(_0x1acdef[a1_0x3272('0x26')])[a1_0x3272('0x13')](_0x2f171b,_0xac9a47);}_0x41ab0d((_0x516c04=_0x516c04['apply'](_0x43978e,_0x5c1f8e||[]))[a1_0x3272('0x8')]());});};Object['defineProperty'](exports,a1_0x3272('0x21'),{'value':!![]});exports[a1_0x3272('0x18')]=void 0x0;const message_reporter_1=require(a1_0x3272('0x2c'));const end_of_run_message_1=require(a1_0x3272('0x3d'));const output_obfuscator_1=require(a1_0x3272('0x19'));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(a1_0x3272('0x28'));const environment_1=require(a1_0x3272('0x32'));const cloud_remote_cache_1=require('./cloud-remote-cache');const cloud_run_api_1=require(a1_0x3272('0x24'));const fs_1=require('fs');const path=require('path');const metric_logger_1=require(a1_0x3272('0x3b'));const error_reporter_api_1=require(a1_0x3272('0x3a'));const {tasksRunner,output}=require(a1_0x3272('0x1c'));function createApi(_0x2bf162,_0x3cb7e6,_0x17f7bb){const _0x51fa89=(0x0,environment_1[a1_0x3272('0x5')])(_0x3cb7e6);return new cloud_run_api_1[(a1_0x3272('0x30'))](_0x2bf162,_0x17f7bb,_0x3cb7e6,_0x51fa89);}function storeTaskHashes(_0x1a8e1f,_0xfd2e1e,_0x4ef4a1){const _0x3c4da6=JSON[a1_0x3272('0x36')](_0x1a8e1f[a1_0x3272('0xc')](_0x55b245=>({'taskId':_0x55b245[a1_0x3272('0x31')],'hash':_0x55b245[a1_0x3272('0x20')]})));if(environment_1[a1_0x3272('0x2b')]){output['note']({'title':'Executed\x20tasks\x20with\x20hashes:\x20'+_0x3c4da6});}(0x0,fs_1[a1_0x3272('0x25')])(path[a1_0x3272('0x3f')](_0xfd2e1e,'tasks-hashes-'+_0x4ef4a1),_0x3c4da6);}function onComplete(_0x2728ce,_0x4029de,_0x25a82a,_0x521186,_0x3bc598,_0x3c1025,_0x530b07,_0x2cdc0f,_0x25028a,_0x1d8c56,_0x46aedb){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x3064dc=new Date()[a1_0x3272('0x0')]();if(environment_1['AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION']){storeTaskHashes(_0x25028a,_0x4029de[a1_0x3272('0x22')]||a1_0x3272('0xb'),environment_1['NX_CLOUD_DISTRIBUTED_EXECUTION_ID']);}const _0x3e3c58=(0x0,environment_1[a1_0x3272('0x3e')])();const _0x1d9578=yield Promise[a1_0x3272('0x4')]([_0x25a82a[a1_0x3272('0x1d')](),_0x521186[a1_0x3272('0xd')]({'command':_0x3bc598['obfuscate']((0x0,environment_1[a1_0x3272('0x11')])()),'startTime':_0x3c1025,'endTime':_0x3064dc,'distributedExecutionId':environment_1['NX_CLOUD_DISTRIBUTED_EXECUTION_ID'],'branch':_0x3e3c58,'scan':!![],'runGroup':(0x0,environment_1[a1_0x3272('0x12')])(),'sha':_0x3e3c58?(0x0,environment_1['extractGitSha'])():undefined,'inner':_0x46aedb},_0x25028a)]);if(_0x1d8c56){setTimeout(()=>{_0x530b07['printMessages']();if(!_0x530b07[a1_0x3272('0x1')]&&!_0x46aedb){_0x2cdc0f[a1_0x3272('0x33')]();}},0x0);}else{_0x530b07[a1_0x3272('0x16')]();if(!_0x530b07[a1_0x3272('0x1')]&&!_0x46aedb){_0x2cdc0f['printCacheHitsMessage']();}}if(environment_1['AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION']){if(!_0x1d9578[0x0]){output['error']({'title':a1_0x3272('0x1b')});_0x530b07[a1_0x3272('0x16')]();process[a1_0x3272('0x29')](environment_1[a1_0x3272('0x2')]);}if(!_0x1d9578[0x1]){output['error']({'title':a1_0x3272('0x37')});_0x530b07[a1_0x3272('0x16')]();process['exit'](environment_1['DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE']);}}yield(0x0,metric_logger_1['submitRunMetrics'])(_0x4029de);});}function createLifeCycle(_0x39e29f,_0x39d912,_0x2a6cfd,_0x3345ef){const _0x1656d3=new cloud_enabled_life_cycle_1[(a1_0x3272('0x6'))](_0x39e29f,_0x39d912[a1_0x3272('0x22')],!!_0x39d912[a1_0x3272('0x35')],_0x39d912[a1_0x3272('0x1f')]===undefined?!![]:_0x39d912[a1_0x3272('0x1f')],_0x39d912[a1_0x3272('0x14')]||[],_0x2a6cfd,_0x3345ef);try{const {CompositeLifeCycle}=require(a1_0x3272('0x1c'));if(!CompositeLifeCycle)return _0x1656d3;return new CompositeLifeCycle([_0x39d912['lifeCycle'],_0x1656d3]);}catch(_0x35e308){return _0x1656d3;}}function cloudEnabledTasksRunner(_0xe325fc,_0x374492,_0xb8381b,_0x1e0ce3=![]){const _0x4a53a1={'statuses':{},'scheduledTasks':[],'requests':{},'allTasks':_0xe325fc};const _0x48ba1f=_0x374492[a1_0x3272('0x1a')]===undefined;const _0x3dca6f=[];const _0x291820=new message_reporter_1[(a1_0x3272('0x17'))](_0x374492);const _0x35c528=createApi(_0x291820,_0x374492,_0x4a53a1);const _0x44de27=new end_of_run_message_1[(a1_0x3272('0x34'))](_0x4a53a1,_0x3dca6f);const _0x27019e=new output_obfuscator_1[(a1_0x3272('0x27'))](_0x374492[a1_0x3272('0xf')]);const _0xf0db41=_0xe325fc[a1_0x3272('0xc')](_0x130748=>_0x130748[a1_0x3272('0x20')])[a1_0x3272('0x3')](_0x34771a=>!!_0x34771a);const _0x253b4c=_0x35c528[a1_0x3272('0x39')](environment_1[a1_0x3272('0x2d')],_0xf0db41);_0xf0db41[a1_0x3272('0x2a')](_0x55184d=>{_0x4a53a1[a1_0x3272('0xa')][_0x55184d]=_0x253b4c;});const _0x3ad55d=new Date()['toISOString']();const _0x3a3d3b=createLifeCycle(_0x4a53a1,_0x374492,_0x27019e,_0x3dca6f);const _0x5c28f3=new e2e_encryption_1[(a1_0x3272('0x1e'))](environment_1['ENCRYPTION_KEY']||_0x374492['encryptionKey']);const _0x52a9ed=new error_reporter_api_1['ErrorReporterApi'](_0x374492);const _0x1ae756=new file_storage_1[(a1_0x3272('0x2e'))](_0x5c28f3,_0x52a9ed,![]);const _0x5334f2=new cloud_remote_cache_1['CloudRemoteCache'](_0x291820,_0x35c528,_0x4a53a1,_0x1ae756);delete process[a1_0x3272('0x3c')][a1_0x3272('0x2d')];const _0x3cd4ec=tasksRunner(_0xe325fc,Object[a1_0x3272('0x15')](Object[a1_0x3272('0x15')]({},_0x374492),{'remoteCache':_0x5334f2,'lifeCycle':_0x3a3d3b}),_0xb8381b);if(_0x3cd4ec[a1_0x3272('0x38')]){const {Subject}=require(a1_0x3272('0x10'));const _0x5e7bfc=new Subject();_0x3cd4ec['subscribe']({'next':_0x16eb4b=>_0x5e7bfc['next'](_0x16eb4b),'error':_0x57fe5a=>_0x5e7bfc[a1_0x3272('0x2f')](_0x57fe5a),'complete':()=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x3a3d3b,_0x374492,_0x5334f2,_0x35c528,_0x27019e,_0x3ad55d,_0x291820,_0x44de27,_0x3dca6f,_0x48ba1f,_0x1e0ce3);_0x5e7bfc[a1_0x3272('0x9')]();})});return _0x5e7bfc;}else{return _0x3cd4ec['then'](_0x4d88ee=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x3a3d3b,_0x374492,_0x5334f2,_0x35c528,_0x27019e,_0x3ad55d,_0x291820,_0x44de27,_0x3dca6f,_0x48ba1f,_0x1e0ce3);return _0x4d88ee;}))[a1_0x3272('0x23')](_0x56585d=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x3a3d3b,_0x374492,_0x5334f2,_0x35c528,_0x27019e,_0x3ad55d,_0x291820,_0x44de27,_0x3dca6f,_0x48ba1f,_0x1e0ce3);throw _0x56585d;}));}}exports[a1_0x3272('0x18')]=cloudEnabledTasksRunner;
@@ -1,113 +1 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CloudRemoteCache = void 0;
13
- const environment_1 = require("../../../utilities/environment");
14
- const { output } = require('../../../utilities/nx-imports');
15
- class CloudRemoteCache {
16
- constructor(messages, api, runContext, fileStorage) {
17
- this.messages = messages;
18
- this.api = api;
19
- this.runContext = runContext;
20
- this.fileStorage = fileStorage;
21
- this.storeRequests = [];
22
- }
23
- retrieve(hash, cacheDirectory) {
24
- var _a;
25
- return __awaiter(this, void 0, void 0, function* () {
26
- if (this.messages.cacheError)
27
- return false;
28
- const hashUrls = yield this.hashUrls(hash);
29
- if (!hashUrls || !hashUrls.get) {
30
- if (environment_1.VERBOSE_LOGGING) {
31
- output.note({ title: `Nx Cloud: Cache miss ${hash}.` });
32
- }
33
- this.runContext.statuses[hash] = 'cache-miss';
34
- return false;
35
- }
36
- try {
37
- yield this.fileStorage.retrieve(hash, hashUrls.get, cacheDirectory);
38
- this.runContext.statuses[hash] = 'remote-cache-hit';
39
- return true;
40
- }
41
- catch (ee) {
42
- const e = (_a = ee.axiosException) !== null && _a !== void 0 ? _a : ee;
43
- if (e.response && e.response.status === 404) {
44
- if (environment_1.VERBOSE_LOGGING) {
45
- output.note({ title: `Nx Cloud: Cache miss ${hash}. Status 404.` });
46
- }
47
- // cache miss. print nothing
48
- }
49
- else {
50
- this.messages.cacheError = this.messages.extractErrorMessage(e, 'storage');
51
- }
52
- this.runContext.statuses[hash] = 'cache-miss';
53
- return false;
54
- }
55
- });
56
- }
57
- store(hash, cacheDirectory) {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- if (this.messages.cacheError)
60
- return false;
61
- const res = Promise.resolve().then(() => __awaiter(this, void 0, void 0, function* () {
62
- var _a;
63
- const hashUrls = yield this.hashUrls(hash);
64
- if (!hashUrls)
65
- return false;
66
- if (!hashUrls.put) {
67
- if (environment_1.VERBOSE_LOGGING) {
68
- output.note({
69
- title: `Nx Cloud: Skipping storing ${hash}. Read only token is used.`,
70
- });
71
- }
72
- return true;
73
- }
74
- try {
75
- yield this.fileStorage.store(hash, hashUrls.put, cacheDirectory);
76
- return true;
77
- }
78
- catch (ee) {
79
- const e = (_a = ee.axiosException) !== null && _a !== void 0 ? _a : ee;
80
- this.messages.cacheError = this.messages.extractErrorMessage(e, 'storage');
81
- return false;
82
- }
83
- }));
84
- this.storeRequests.push(res);
85
- return res;
86
- });
87
- }
88
- hashUrls(hash) {
89
- return __awaiter(this, void 0, void 0, function* () {
90
- if (hash in this.runContext.requests) {
91
- return (yield this.runContext.requests[hash])[hash];
92
- }
93
- else {
94
- const scheduledTaskHashesWithoutRequests = this.runContext.scheduledTasks
95
- .filter((t) => !this.runContext.requests[t.hash])
96
- .map((t) => t.hash);
97
- if (scheduledTaskHashesWithoutRequests.indexOf(hash) === -1) {
98
- scheduledTaskHashesWithoutRequests.push(hash);
99
- }
100
- const request = this.api.startRun(environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID, scheduledTaskHashesWithoutRequests);
101
- scheduledTaskHashesWithoutRequests.forEach((taskHash) => {
102
- this.runContext.requests[taskHash] = request;
103
- });
104
- return (yield request)[hash];
105
- }
106
- });
107
- }
108
- waitForStoreRequestsToComplete() {
109
- return Promise.all(this.storeRequests).then((r) => r.reduce((a, b) => a && b, true));
110
- }
111
- }
112
- exports.CloudRemoteCache = CloudRemoteCache;
113
- //# sourceMappingURL=cloud-remote-cache.js.map
1
+ const a2_0x5911=['VERBOSE_LOGGING','push','map','waitForStoreRequestsToComplete','next','then','defineProperty','note','messages','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','requests','forEach','__esModule','scheduledTasks','api','axiosException','remote-cache-hit','value','statuses','../../../utilities/environment','Nx\x20Cloud:\x20Cache\x20miss\x20','done','filter','extractErrorMessage','reduce','cacheError','.\x20Status\x20404.','runContext','retrieve','response','hash','storeRequests','storage','CloudRemoteCache','fileStorage','Nx\x20Cloud:\x20Skipping\x20storing\x20','startRun','.\x20Read\x20only\x20token\x20is\x20used.','hashUrls','store','put','apply','get'];(function(_0x454a66,_0x591138){const _0x40cef8=function(_0x5efe20){while(--_0x5efe20){_0x454a66['push'](_0x454a66['shift']());}};_0x40cef8(++_0x591138);}(a2_0x5911,0x187));const a2_0x40ce=function(_0x454a66,_0x591138){_0x454a66=_0x454a66-0x0;let _0x40cef8=a2_0x5911[_0x454a66];return _0x40cef8;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0xeb6ecb,_0x1b9586,_0x2ea17c,_0x56dfe4){function _0x29816f(_0x4eb2db){return _0x4eb2db instanceof _0x2ea17c?_0x4eb2db:new _0x2ea17c(function(_0x133dee){_0x133dee(_0x4eb2db);});}return new(_0x2ea17c||(_0x2ea17c=Promise))(function(_0x54757c,_0x270f5d){function _0x16f4e5(_0x37727f){try{_0x3bfdf9(_0x56dfe4[a2_0x40ce('0x0')](_0x37727f));}catch(_0x1cfcd2){_0x270f5d(_0x1cfcd2);}}function _0x552917(_0x4a7bef){try{_0x3bfdf9(_0x56dfe4['throw'](_0x4a7bef));}catch(_0x23f466){_0x270f5d(_0x23f466);}}function _0x3bfdf9(_0x5c1117){_0x5c1117[a2_0x40ce('0x11')]?_0x54757c(_0x5c1117[a2_0x40ce('0xd')]):_0x29816f(_0x5c1117[a2_0x40ce('0xd')])[a2_0x40ce('0x1')](_0x16f4e5,_0x552917);}_0x3bfdf9((_0x56dfe4=_0x56dfe4[a2_0x40ce('0x25')](_0xeb6ecb,_0x1b9586||[]))[a2_0x40ce('0x0')]());});};Object[a2_0x40ce('0x2')](exports,a2_0x40ce('0x8'),{'value':!![]});exports[a2_0x40ce('0x1d')]=void 0x0;const environment_1=require(a2_0x40ce('0xf'));const {output}=require('../../../utilities/nx-imports');class CloudRemoteCache{constructor(_0x482474,_0x2b27db,_0x19300a,_0x540d00){this[a2_0x40ce('0x4')]=_0x482474;this[a2_0x40ce('0xa')]=_0x2b27db;this['runContext']=_0x19300a;this[a2_0x40ce('0x1e')]=_0x540d00;this[a2_0x40ce('0x1b')]=[];}['retrieve'](_0x3fd3d6,_0x1f378d){var _0x8f2b65;return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a2_0x40ce('0x4')]['cacheError'])return![];const _0x541b82=yield this[a2_0x40ce('0x22')](_0x3fd3d6);if(!_0x541b82||!_0x541b82[a2_0x40ce('0x26')]){if(environment_1[a2_0x40ce('0x27')]){output['note']({'title':a2_0x40ce('0x10')+_0x3fd3d6+'.'});}this[a2_0x40ce('0x17')][a2_0x40ce('0xe')][_0x3fd3d6]='cache-miss';return![];}try{yield this['fileStorage'][a2_0x40ce('0x18')](_0x3fd3d6,_0x541b82[a2_0x40ce('0x26')],_0x1f378d);this[a2_0x40ce('0x17')]['statuses'][_0x3fd3d6]=a2_0x40ce('0xc');return!![];}catch(_0x24d615){const _0x1db8dd=(_0x8f2b65=_0x24d615[a2_0x40ce('0xb')])!==null&&_0x8f2b65!==void 0x0?_0x8f2b65:_0x24d615;if(_0x1db8dd['response']&&_0x1db8dd[a2_0x40ce('0x19')]['status']===0x194){if(environment_1[a2_0x40ce('0x27')]){output[a2_0x40ce('0x3')]({'title':a2_0x40ce('0x10')+_0x3fd3d6+a2_0x40ce('0x16')});}}else{this[a2_0x40ce('0x4')][a2_0x40ce('0x15')]=this['messages'][a2_0x40ce('0x13')](_0x1db8dd,a2_0x40ce('0x1c'));}this[a2_0x40ce('0x17')][a2_0x40ce('0xe')][_0x3fd3d6]='cache-miss';return![];}});}['store'](_0x85ed4a,_0x260608){return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a2_0x40ce('0x4')][a2_0x40ce('0x15')])return![];const _0x4cee95=Promise['resolve']()[a2_0x40ce('0x1')](()=>__awaiter(this,void 0x0,void 0x0,function*(){var _0x562b5a;const _0x1574b9=yield this[a2_0x40ce('0x22')](_0x85ed4a);if(!_0x1574b9)return![];if(!_0x1574b9['put']){if(environment_1[a2_0x40ce('0x27')]){output[a2_0x40ce('0x3')]({'title':a2_0x40ce('0x1f')+_0x85ed4a+a2_0x40ce('0x21')});}return!![];}try{yield this['fileStorage'][a2_0x40ce('0x23')](_0x85ed4a,_0x1574b9[a2_0x40ce('0x24')],_0x260608);return!![];}catch(_0x33fa09){const _0x258baf=(_0x562b5a=_0x33fa09[a2_0x40ce('0xb')])!==null&&_0x562b5a!==void 0x0?_0x562b5a:_0x33fa09;this[a2_0x40ce('0x4')]['cacheError']=this[a2_0x40ce('0x4')][a2_0x40ce('0x13')](_0x258baf,a2_0x40ce('0x1c'));return![];}}));this['storeRequests'][a2_0x40ce('0x28')](_0x4cee95);return _0x4cee95;});}[a2_0x40ce('0x22')](_0x4f2ed7){return __awaiter(this,void 0x0,void 0x0,function*(){if(_0x4f2ed7 in this[a2_0x40ce('0x17')][a2_0x40ce('0x6')]){return(yield this[a2_0x40ce('0x17')]['requests'][_0x4f2ed7])[_0x4f2ed7];}else{const _0x3cdd7e=this[a2_0x40ce('0x17')][a2_0x40ce('0x9')][a2_0x40ce('0x12')](_0x18d0d0=>!this['runContext'][a2_0x40ce('0x6')][_0x18d0d0[a2_0x40ce('0x1a')]])[a2_0x40ce('0x29')](_0x322895=>_0x322895[a2_0x40ce('0x1a')]);if(_0x3cdd7e['indexOf'](_0x4f2ed7)===-0x1){_0x3cdd7e[a2_0x40ce('0x28')](_0x4f2ed7);}const _0xe7e142=this[a2_0x40ce('0xa')][a2_0x40ce('0x20')](environment_1[a2_0x40ce('0x5')],_0x3cdd7e);_0x3cdd7e[a2_0x40ce('0x7')](_0x151b29=>{this[a2_0x40ce('0x17')]['requests'][_0x151b29]=_0xe7e142;});return(yield _0xe7e142)[_0x4f2ed7];}});}[a2_0x40ce('0x2a')](){return Promise['all'](this['storeRequests'])[a2_0x40ce('0x1')](_0x58957c=>_0x58957c[a2_0x40ce('0x14')]((_0x2e51ac,_0x1f8cb8)=>_0x2e51ac&&_0x1f8cb8,!![]));}}exports[a2_0x40ce('0x1d')]=CloudRemoteCache;