@nrwl/nx-cloud 14.1.3-beta.2 → 14.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ErrorReporterApi = void 0;
13
- const axios_1 = require("../../utilities/axios");
14
- const { output } = require('../../utilities/nx-imports');
15
- class ErrorReporterApi {
16
- constructor(options) {
17
- this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
18
- }
19
- reportError(message) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- try {
22
- yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/report-client-error', {
23
- message,
24
- }));
25
- }
26
- catch (e) {
27
- output.warn({
28
- title: `Unable to record the following error: '${message}'`,
29
- bodyLines: [e.message],
30
- });
31
- }
32
- });
33
- }
34
- }
35
- exports.ErrorReporterApi = ErrorReporterApi;
36
- //# sourceMappingURL=error-reporter.api.js.map
1
+ const a0_0x2fd8=['post','axiosMultipleTries','then','createApiAxiosInstance','next','../../utilities/nx-imports','__awaiter','message','value','apiAxiosInstance','__esModule','apply','../../utilities/axios','defineProperty','/nx-cloud/report-client-error','Unable\x20to\x20record\x20the\x20following\x20error:\x20\x27','warn','ErrorReporterApi','throw','reportError'];(function(_0x1401a2,_0x2fd8a5){const _0x4c3959=function(_0x1c82bf){while(--_0x1c82bf){_0x1401a2['push'](_0x1401a2['shift']());}};_0x4c3959(++_0x2fd8a5);}(a0_0x2fd8,0xb8));const a0_0x4c39=function(_0x1401a2,_0x2fd8a5){_0x1401a2=_0x1401a2-0x0;let _0x4c3959=a0_0x2fd8[_0x1401a2];return _0x4c3959;};'use strict';var __awaiter=this&&this[a0_0x4c39('0x2')]||function(_0x3b2259,_0x95f4a7,_0x47468b,_0x428c2f){function _0x5c61a7(_0x4b7c51){return _0x4b7c51 instanceof _0x47468b?_0x4b7c51:new _0x47468b(function(_0x4410c9){_0x4410c9(_0x4b7c51);});}return new(_0x47468b||(_0x47468b=Promise))(function(_0x10f10a,_0x4ec99a){function _0x1725b8(_0x5ab0ce){try{_0xfc9d07(_0x428c2f[a0_0x4c39('0x0')](_0x5ab0ce));}catch(_0x25986b){_0x4ec99a(_0x25986b);}}function _0x41c0ea(_0x19b2c1){try{_0xfc9d07(_0x428c2f[a0_0x4c39('0xe')](_0x19b2c1));}catch(_0x21e7e1){_0x4ec99a(_0x21e7e1);}}function _0xfc9d07(_0x21bfb6){_0x21bfb6['done']?_0x10f10a(_0x21bfb6[a0_0x4c39('0x4')]):_0x5c61a7(_0x21bfb6[a0_0x4c39('0x4')])[a0_0x4c39('0x12')](_0x1725b8,_0x41c0ea);}_0xfc9d07((_0x428c2f=_0x428c2f[a0_0x4c39('0x7')](_0x3b2259,_0x95f4a7||[]))['next']());});};Object[a0_0x4c39('0x9')](exports,a0_0x4c39('0x6'),{'value':!![]});exports[a0_0x4c39('0xd')]=void 0x0;const axios_1=require(a0_0x4c39('0x8'));const {output}=require(a0_0x4c39('0x1'));class ErrorReporterApi{constructor(_0x1d4472){this['apiAxiosInstance']=(0x0,axios_1[a0_0x4c39('0x13')])(_0x1d4472);}[a0_0x4c39('0xf')](_0x46b80a){return __awaiter(this,void 0x0,void 0x0,function*(){try{yield(0x0,axios_1[a0_0x4c39('0x11')])(()=>this[a0_0x4c39('0x5')][a0_0x4c39('0x10')](a0_0x4c39('0xa'),{'message':_0x46b80a}));}catch(_0x2714ef){output[a0_0x4c39('0xc')]({'title':a0_0x4c39('0xb')+_0x46b80a+'\x27','bodyLines':[_0x2714ef[a0_0x4c39('0x3')]]});}});}}exports[a0_0x4c39('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_0x8686=['exit','createRunGroup','../../utilities/metric-logger','createMetricRecorder','RunGroupApi','../../utilities/nx-imports','mapRespToPerfEntry','apiAxiosInstance','__awaiter','done','value','next','axiosMultipleTries','createApiAxiosInstance','post','axiosException','error','../../utilities/axios','recordMetric','__esModule','/nx-cloud/executions/create-run-group','RUNNER_FAILURE_PERF_ENTRY','response','/nx-cloud/executions/complete-run-group','message'];(function(_0x1e485b,_0x86866b){const _0x40c8ba=function(_0xb21f35){while(--_0xb21f35){_0x1e485b['push'](_0x1e485b['shift']());}};_0x40c8ba(++_0x86866b);}(a1_0x8686,0xe3));const a1_0x40c8=function(_0x1e485b,_0x86866b){_0x1e485b=_0x1e485b-0x0;let _0x40c8ba=a1_0x8686[_0x1e485b];return _0x40c8ba;};'use strict';var __awaiter=this&&this[a1_0x40c8('0x6')]||function(_0x394bd4,_0xa8a094,_0xc36efb,_0x655fa8){function _0x30b039(_0x38b5f7){return _0x38b5f7 instanceof _0xc36efb?_0x38b5f7:new _0xc36efb(function(_0x18ef9e){_0x18ef9e(_0x38b5f7);});}return new(_0xc36efb||(_0xc36efb=Promise))(function(_0x51b6b6,_0x514fa4){function _0x1dcba0(_0x4aaf1d){try{_0x2ce0da(_0x655fa8[a1_0x40c8('0x9')](_0x4aaf1d));}catch(_0x37792f){_0x514fa4(_0x37792f);}}function _0xe610d5(_0x298230){try{_0x2ce0da(_0x655fa8['throw'](_0x298230));}catch(_0x1e95fa){_0x514fa4(_0x1e95fa);}}function _0x2ce0da(_0x29718c){_0x29718c[a1_0x40c8('0x7')]?_0x51b6b6(_0x29718c['value']):_0x30b039(_0x29718c[a1_0x40c8('0x8')])['then'](_0x1dcba0,_0xe610d5);}_0x2ce0da((_0x655fa8=_0x655fa8['apply'](_0x394bd4,_0xa8a094||[]))[a1_0x40c8('0x9')]());});};Object['defineProperty'](exports,a1_0x40c8('0x11'),{'value':!![]});exports['RunGroupApi']=void 0x0;const axios_1=require(a1_0x40c8('0xf'));const metric_logger_1=require(a1_0x40c8('0x0'));const {output}=require(a1_0x40c8('0x3'));class RunGroupApi{constructor(_0x48288e){this['apiAxiosInstance']=(0x0,axios_1[a1_0x40c8('0xb')])(_0x48288e);}[a1_0x40c8('0x18')](_0x281ee8,_0x29286b){var _0x348006;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x42c750=(0x0,metric_logger_1[a1_0x40c8('0x1')])(a1_0x40c8('0x18'));try{const _0x234ed3=yield(0x0,axios_1['axiosMultipleTries'])(()=>this['apiAxiosInstance'][a1_0x40c8('0xc')](a1_0x40c8('0x12'),{'branch':_0x281ee8,'runGroup':_0x29286b}));_0x42c750[a1_0x40c8('0x10')]((0x0,metric_logger_1[a1_0x40c8('0x4')])(_0x234ed3));}catch(_0x3ea538){_0x42c750[a1_0x40c8('0x10')](((_0x348006=_0x3ea538===null||_0x3ea538===void 0x0?void 0x0:_0x3ea538[a1_0x40c8('0xd')])===null||_0x348006===void 0x0?void 0x0:_0x348006[a1_0x40c8('0x14')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x3ea538[a1_0x40c8('0xd')][a1_0x40c8('0x14')]):metric_logger_1[a1_0x40c8('0x13')]);output['error']({'title':_0x3ea538[a1_0x40c8('0x16')]});process[a1_0x40c8('0x17')](0x1);}});}['completeRunGroup'](_0x45d5d8){var _0x4a983f;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x230bdb=(0x0,metric_logger_1[a1_0x40c8('0x1')])(a1_0x40c8('0x18'));try{const _0x346142=yield(0x0,axios_1[a1_0x40c8('0xa')])(()=>this[a1_0x40c8('0x5')][a1_0x40c8('0xc')](a1_0x40c8('0x15'),{'runGroup':_0x45d5d8}));_0x230bdb['recordMetric']((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x346142));}catch(_0x3de7f5){_0x230bdb[a1_0x40c8('0x10')](((_0x4a983f=_0x3de7f5===null||_0x3de7f5===void 0x0?void 0x0:_0x3de7f5['axiosException'])===null||_0x4a983f===void 0x0?void 0x0:_0x4a983f['response'])?(0x0,metric_logger_1[a1_0x40c8('0x4')])(_0x3de7f5[a1_0x40c8('0xd')][a1_0x40c8('0x14')]):metric_logger_1[a1_0x40c8('0x13')]);output[a1_0x40c8('0xe')]({'title':_0x3de7f5[a1_0x40c8('0x16')]});process[a1_0x40c8('0x17')](0x1);}});}}exports[a1_0x40c8('0x2')]=RunGroupApi;
@@ -1,138 +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 serializer_overrides_1 = require("../../../utilities/serializer-overrides");
9
- const { workspaceRoot } = require('../../../utilities/nx-imports');
10
- class CloudEnabledLifeCycle {
11
- constructor(runContext, cacheDirectory, skipNxCache, collectTerminalOutput, cacheableOperations, outputObfuscator, tasks) {
12
- this.runContext = runContext;
13
- this.cacheDirectory = cacheDirectory;
14
- this.skipNxCache = skipNxCache;
15
- this.collectTerminalOutput = collectTerminalOutput;
16
- this.cacheableOperations = cacheableOperations;
17
- this.outputObfuscator = outputObfuscator;
18
- this.tasks = tasks;
19
- }
20
- scheduleTask(task) {
21
- this.runContext.scheduledTasks.push(task);
22
- }
23
- startTask(task) {
24
- this.tasks.push({
25
- taskId: task.id,
26
- startTime: new Date().toISOString(),
27
- target: task.target.target,
28
- projectName: task.target.project,
29
- hash: task.hash,
30
- hashDetails: this.cleanUpHashDetails(task.hashDetails),
31
- params: (0, serializer_overrides_1.serializeOverrides)(task),
32
- });
33
- }
34
- // Used for older version for Nx. Remove in Dec 2022
35
- endTask(task, code) {
36
- let cacheStatus;
37
- if (this.runContext.statuses[task.hash]) {
38
- cacheStatus = this.runContext.statuses[task.hash];
39
- }
40
- else {
41
- if (this.cacheableOperations.indexOf(task.target.target) > -1 &&
42
- !this.skipNxCache) {
43
- cacheStatus = 'local-cache-hit';
44
- }
45
- else {
46
- cacheStatus = 'cache-miss';
47
- }
48
- }
49
- this.updateStartedTask(task, code, cacheStatus);
50
- }
51
- endTasks(tasks) {
52
- for (let t of tasks) {
53
- const status = t.status === 'remote-cache'
54
- ? 'remote-cache-hit'
55
- : t.status === 'local-cache' ||
56
- t.status === 'local-cache-kept-existing'
57
- ? 'local-cache-hit'
58
- : 'cache-miss';
59
- this.updateStartedTask(t.task, t.code, status);
60
- }
61
- }
62
- endCommand() { }
63
- updateStartedTask(task, code, cacheStatus) {
64
- const startedTask = this.tasks.find((t) => t.taskId === task.id);
65
- if (!startedTask) {
66
- throw new Error(`Cannot find task ${task.id}`);
67
- }
68
- startedTask.endTime = new Date().toISOString();
69
- startedTask.status = code;
70
- startedTask.params = this.outputObfuscator.obfuscate(startedTask.params);
71
- startedTask.cacheStatus = cacheStatus;
72
- if (this.collectTerminalOutput) {
73
- startedTask.terminalOutput = this.getTerminalOutput(task.hash, startedTask.cacheStatus, code);
74
- }
75
- }
76
- getTerminalOutput(hash, cacheStatus, code) {
77
- let dir;
78
- if (this.cacheDirectory) {
79
- if (this.cacheDirectory.startsWith('./')) {
80
- dir = (0, path_1.join)(workspaceRoot, this.cacheDirectory);
81
- }
82
- else {
83
- dir = this.cacheDirectory;
84
- }
85
- }
86
- else {
87
- dir = (0, path_1.join)(workspaceRoot, 'node_modules', '.cache', 'nx');
88
- }
89
- try {
90
- const taskOutput = this.readTerminalOutputFile(dir, hash);
91
- const taskOutputSanitized = this.outputObfuscator.obfuscate(taskOutput);
92
- if (environment_1.NX_CLOUD_UNLIMITED_OUTPUT)
93
- return taskOutputSanitized;
94
- const maxCharacters = cacheStatus === 'cache-miss'
95
- ? code === 0
96
- ? CloudEnabledLifeCycle.MAX_CHARACTERS_SUCCESSFUL_TASK
97
- : CloudEnabledLifeCycle.MAX_CHARACTERS_FAILED_TASK
98
- : CloudEnabledLifeCycle.MAX_CHARACTERS_CACHED_TASK;
99
- return taskOutputSanitized.length > maxCharacters
100
- ? `TRUNCATED\n\n${taskOutputSanitized.slice(taskOutputSanitized.length - maxCharacters)}`
101
- : taskOutputSanitized;
102
- }
103
- catch (e) {
104
- return '';
105
- }
106
- }
107
- cleanUpHashDetails(hashDetails) {
108
- const nodes = {};
109
- Object.keys(hashDetails.nodes)
110
- .filter((k) => !k.startsWith('npm:'))
111
- .forEach((k) => {
112
- nodes[k] = hashDetails.nodes[k];
113
- });
114
- return {
115
- nodes,
116
- runtime: hashDetails.runtime,
117
- implicitDeps: hashDetails.implicitDeps,
118
- };
119
- }
120
- readTerminalOutputFile(dir, hash) {
121
- try {
122
- return (0, fs_1.readFileSync)(path.join(dir, 'terminalOutputs', hash)).toString();
123
- }
124
- catch (_a) {
125
- try {
126
- return (0, fs_1.readFileSync)(path.join(dir, hash, 'terminalOutput')).toString();
127
- }
128
- catch (_b) {
129
- return '';
130
- }
131
- }
132
- }
133
- }
134
- exports.CloudEnabledLifeCycle = CloudEnabledLifeCycle;
135
- CloudEnabledLifeCycle.MAX_CHARACTERS_FAILED_TASK = 200000;
136
- CloudEnabledLifeCycle.MAX_CHARACTERS_SUCCESSFUL_TASK = 20000;
137
- CloudEnabledLifeCycle.MAX_CHARACTERS_CACHED_TASK = 20000;
138
- //# sourceMappingURL=cloud-enabled-life-cycle.js.map
1
+ const a0_0x3816=['scheduleTask','.cache','cacheableOperations','terminalOutput','terminalOutputs','endCommand','startsWith','push','keys','hash','runtime','Cannot\x20find\x20task\x20','length','find','local-cache-hit','target','remote-cache-hit','path','updateStartedTask','MAX_CHARACTERS_CACHED_TASK','getTerminalOutput','cacheStatus','endTasks','readTerminalOutputFile','toString','slice','local-cache','skipNxCache','endTask','taskId','CloudEnabledLifeCycle','status','nodes','MAX_CHARACTERS_SUCCESSFUL_TASK','startTask','NX_CLOUD_UNLIMITED_OUTPUT','tasks','code','cache-miss','MAX_CHARACTERS_FAILED_TASK','endTime','join','node_modules','cleanUpHashDetails','serializeOverrides','collectTerminalOutput','local-cache-kept-existing','../../../utilities/serializer-overrides','remote-cache','statuses','scheduledTasks','readFileSync','project','forEach','cacheDirectory','outputObfuscator','hashDetails','toISOString','task','params','filter','obfuscate','__esModule','runContext','TRUNCATED\x0a\x0a'];(function(_0x4bd697,_0x381686){const _0x48d7d1=function(_0x4f2ab6){while(--_0x4f2ab6){_0x4bd697['push'](_0x4bd697['shift']());}};_0x48d7d1(++_0x381686);}(a0_0x3816,0x1a2));const a0_0x48d7=function(_0x4bd697,_0x381686){_0x4bd697=_0x4bd697-0x0;let _0x48d7d1=a0_0x3816[_0x4bd697];return _0x48d7d1;};'use strict';Object['defineProperty'](exports,a0_0x48d7('0x22'),{'value':!![]});exports['CloudEnabledLifeCycle']=void 0x0;const path=require(a0_0x48d7('0x36'));const path_1=require(a0_0x48d7('0x36'));const fs_1=require('fs');const environment_1=require('../../../utilities/environment');const serializer_overrides_1=require(a0_0x48d7('0x13'));const {workspaceRoot}=require('../../../utilities/nx-imports');class CloudEnabledLifeCycle{constructor(_0x16bd2b,_0x222808,_0x5265dc,_0xb95949,_0x2aabb2,_0x1a844a,_0x5e1799){this['runContext']=_0x16bd2b;this[a0_0x48d7('0x1a')]=_0x222808;this[a0_0x48d7('0x40')]=_0x5265dc;this[a0_0x48d7('0x11')]=_0xb95949;this[a0_0x48d7('0x27')]=_0x2aabb2;this[a0_0x48d7('0x1b')]=_0x1a844a;this['tasks']=_0x5e1799;}[a0_0x48d7('0x25')](_0x6185ce){this[a0_0x48d7('0x23')][a0_0x48d7('0x16')][a0_0x48d7('0x2c')](_0x6185ce);}[a0_0x48d7('0x6')](_0x4ba69a){this[a0_0x48d7('0x8')][a0_0x48d7('0x2c')]({'taskId':_0x4ba69a['id'],'startTime':new Date()[a0_0x48d7('0x1d')](),'target':_0x4ba69a['target'][a0_0x48d7('0x34')],'projectName':_0x4ba69a['target'][a0_0x48d7('0x18')],'hash':_0x4ba69a[a0_0x48d7('0x2e')],'hashDetails':this[a0_0x48d7('0xf')](_0x4ba69a[a0_0x48d7('0x1c')]),'params':(0x0,serializer_overrides_1[a0_0x48d7('0x10')])(_0x4ba69a)});}[a0_0x48d7('0x0')](_0x1c262f,_0x25199a){let _0x5e1194;if(this[a0_0x48d7('0x23')][a0_0x48d7('0x15')][_0x1c262f[a0_0x48d7('0x2e')]]){_0x5e1194=this[a0_0x48d7('0x23')]['statuses'][_0x1c262f[a0_0x48d7('0x2e')]];}else{if(this['cacheableOperations']['indexOf'](_0x1c262f[a0_0x48d7('0x34')][a0_0x48d7('0x34')])>-0x1&&!this[a0_0x48d7('0x40')]){_0x5e1194=a0_0x48d7('0x33');}else{_0x5e1194=a0_0x48d7('0xa');}}this[a0_0x48d7('0x37')](_0x1c262f,_0x25199a,_0x5e1194);}[a0_0x48d7('0x3b')](_0x593a6f){for(let _0x378d09 of _0x593a6f){const _0x5da9d6=_0x378d09[a0_0x48d7('0x3')]===a0_0x48d7('0x14')?a0_0x48d7('0x35'):_0x378d09['status']===a0_0x48d7('0x3f')||_0x378d09[a0_0x48d7('0x3')]===a0_0x48d7('0x12')?a0_0x48d7('0x33'):a0_0x48d7('0xa');this[a0_0x48d7('0x37')](_0x378d09[a0_0x48d7('0x1e')],_0x378d09[a0_0x48d7('0x9')],_0x5da9d6);}}[a0_0x48d7('0x2a')](){}[a0_0x48d7('0x37')](_0x905eba,_0x4e9a06,_0x442a41){const _0x1f0e7d=this[a0_0x48d7('0x8')][a0_0x48d7('0x32')](_0x21b3be=>_0x21b3be[a0_0x48d7('0x1')]===_0x905eba['id']);if(!_0x1f0e7d){throw new Error(a0_0x48d7('0x30')+_0x905eba['id']);}_0x1f0e7d[a0_0x48d7('0xc')]=new Date()[a0_0x48d7('0x1d')]();_0x1f0e7d[a0_0x48d7('0x3')]=_0x4e9a06;_0x1f0e7d[a0_0x48d7('0x1f')]=this[a0_0x48d7('0x1b')][a0_0x48d7('0x21')](_0x1f0e7d[a0_0x48d7('0x1f')]);_0x1f0e7d[a0_0x48d7('0x3a')]=_0x442a41;if(this[a0_0x48d7('0x11')]){_0x1f0e7d['terminalOutput']=this[a0_0x48d7('0x39')](_0x905eba[a0_0x48d7('0x2e')],_0x1f0e7d[a0_0x48d7('0x3a')],_0x4e9a06);}}[a0_0x48d7('0x39')](_0x3920b1,_0x3f2bff,_0x555e30){let _0x41e1b7;if(this[a0_0x48d7('0x1a')]){if(this[a0_0x48d7('0x1a')][a0_0x48d7('0x2b')]('./')){_0x41e1b7=(0x0,path_1[a0_0x48d7('0xd')])(workspaceRoot,this['cacheDirectory']);}else{_0x41e1b7=this[a0_0x48d7('0x1a')];}}else{_0x41e1b7=(0x0,path_1[a0_0x48d7('0xd')])(workspaceRoot,a0_0x48d7('0xe'),a0_0x48d7('0x26'),'nx');}try{const _0x2a5f83=this[a0_0x48d7('0x3c')](_0x41e1b7,_0x3920b1);const _0x5c6986=this[a0_0x48d7('0x1b')][a0_0x48d7('0x21')](_0x2a5f83);if(environment_1[a0_0x48d7('0x7')])return _0x5c6986;const _0x182ad1=_0x3f2bff===a0_0x48d7('0xa')?_0x555e30===0x0?CloudEnabledLifeCycle[a0_0x48d7('0x5')]:CloudEnabledLifeCycle[a0_0x48d7('0xb')]:CloudEnabledLifeCycle['MAX_CHARACTERS_CACHED_TASK'];return _0x5c6986[a0_0x48d7('0x31')]>_0x182ad1?a0_0x48d7('0x24')+_0x5c6986[a0_0x48d7('0x3e')](_0x5c6986[a0_0x48d7('0x31')]-_0x182ad1):_0x5c6986;}catch(_0x23799e){return'';}}[a0_0x48d7('0xf')](_0x3e1bff){const _0x7d84f4={};Object[a0_0x48d7('0x2d')](_0x3e1bff[a0_0x48d7('0x4')])[a0_0x48d7('0x20')](_0x46d7f7=>!_0x46d7f7[a0_0x48d7('0x2b')]('npm:'))[a0_0x48d7('0x19')](_0x40b232=>{_0x7d84f4[_0x40b232]=_0x3e1bff['nodes'][_0x40b232];});return{'nodes':_0x7d84f4,'runtime':_0x3e1bff[a0_0x48d7('0x2f')],'implicitDeps':_0x3e1bff['implicitDeps']};}[a0_0x48d7('0x3c')](_0x51d403,_0x5cab21){try{return(0x0,fs_1[a0_0x48d7('0x17')])(path[a0_0x48d7('0xd')](_0x51d403,a0_0x48d7('0x29'),_0x5cab21))[a0_0x48d7('0x3d')]();}catch(_0x511eb5){try{return(0x0,fs_1[a0_0x48d7('0x17')])(path['join'](_0x51d403,_0x5cab21,a0_0x48d7('0x28')))[a0_0x48d7('0x3d')]();}catch(_0x4ee74e){return'';}}}}exports[a0_0x48d7('0x2')]=CloudEnabledLifeCycle;CloudEnabledLifeCycle['MAX_CHARACTERS_FAILED_TASK']=0x30d40;CloudEnabledLifeCycle[a0_0x48d7('0x5')]=0x4e20;CloudEnabledLifeCycle[a0_0x48d7('0x38')]=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_0x5d24=['../../api/error-reporter.api','waitForStoreRequestsToComplete','FileStorage','VERBOSE_LOGGING','../../terminal-output/message-reporter','join','ErrorReporterApi','__esModule','obfuscate','complete','endRun','../../file-storage/e2e-encryption','value','CloudEnabledLifeCycle','./cloud-enabled-life-cycle','forEach','defineProperty','OutputObfuscator','requests','printCacheHitsMessage','lifeCycle','writeFileSync','../../terminal-output/end-of-run-message','submitRunMetrics','../../../utilities/nx-imports','path','anyErrors','rxjs/internal/Subject','next','scan','getRunGroup','subscribe','./cloud-run.api','./cloud-remote-cache','hash','getMachineInfo','encryptionKey','env','filter','maskedProperties','then','cloudEnabledTasksRunner','../../file-storage/file-storage','apply','toISOString','stringify','map','ENCRYPTION_KEY','cacheDirectory','tasks-hashes-','exit','./node_modules/.cache/nx','error','EndOfRunMessage','taskId','CloudRemoteCache','catch','getBranch','printMessages','extractGitSha','DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE','cacheableOperations','startRun','assign','AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','throw'];(function(_0xbdc426,_0x5d2414){const _0x13696a=function(_0x50e177){while(--_0x50e177){_0xbdc426['push'](_0xbdc426['shift']());}};_0x13696a(++_0x5d2414);}(a1_0x5d24,0x95));const a1_0x1369=function(_0xbdc426,_0x5d2414){_0xbdc426=_0xbdc426-0x0;let _0x13696a=a1_0x5d24[_0xbdc426];return _0x13696a;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x477d4b,_0x2b64d1,_0x1cc78c,_0x1b5592){function _0x4384a1(_0x42adc6){return _0x42adc6 instanceof _0x1cc78c?_0x42adc6:new _0x1cc78c(function(_0x3b3334){_0x3b3334(_0x42adc6);});}return new(_0x1cc78c||(_0x1cc78c=Promise))(function(_0x1c0c8d,_0x21bf91){function _0x57adc6(_0x149a7a){try{_0x598b49(_0x1b5592[a1_0x1369('0xd')](_0x149a7a));}catch(_0x254b7d){_0x21bf91(_0x254b7d);}}function _0x50ad80(_0x2550b4){try{_0x598b49(_0x1b5592[a1_0x1369('0x33')](_0x2550b4));}catch(_0x217737){_0x21bf91(_0x217737);}}function _0x598b49(_0x2676c2){_0x2676c2['done']?_0x1c0c8d(_0x2676c2[a1_0x1369('0x40')]):_0x4384a1(_0x2676c2[a1_0x1369('0x40')])['then'](_0x57adc6,_0x50ad80);}_0x598b49((_0x1b5592=_0x1b5592[a1_0x1369('0x1c')](_0x477d4b,_0x2b64d1||[]))['next']());});};Object[a1_0x1369('0x1')](exports,a1_0x1369('0x3b'),{'value':!![]});exports['cloudEnabledTasksRunner']=void 0x0;const message_reporter_1=require(a1_0x1369('0x38'));const end_of_run_message_1=require(a1_0x1369('0x7'));const output_obfuscator_1=require('../../terminal-output/output-obfuscator');const cloud_enabled_life_cycle_1=require(a1_0x1369('0x42'));const file_storage_1=require(a1_0x1369('0x1b'));const e2e_encryption_1=require(a1_0x1369('0x3f'));const environment_1=require('../../../utilities/environment');const cloud_remote_cache_1=require(a1_0x1369('0x12'));const cloud_run_api_1=require(a1_0x1369('0x11'));const fs_1=require('fs');const path=require(a1_0x1369('0xa'));const metric_logger_1=require('../../../utilities/metric-logger');const error_reporter_api_1=require(a1_0x1369('0x34'));const {tasksRunner,output}=require(a1_0x1369('0x9'));function createApi(_0x5efe83,_0x5d113f,_0x5d6f5d){const _0x2e2a63=(0x0,environment_1[a1_0x1369('0x14')])(_0x5d113f);return new cloud_run_api_1['CloudRunApi'](_0x5efe83,_0x5d6f5d,_0x5d113f,_0x2e2a63);}function storeTaskHashes(_0x4752e8,_0xeea2de,_0x1ae624){const _0x12aed3=JSON[a1_0x1369('0x1e')](_0x4752e8['map'](_0x5c107e=>({'taskId':_0x5c107e[a1_0x1369('0x27')],'hash':_0x5c107e[a1_0x1369('0x13')]})));if(environment_1[a1_0x1369('0x37')]){output['note']({'title':'Executed\x20tasks\x20with\x20hashes:\x20'+_0x12aed3});}(0x0,fs_1[a1_0x1369('0x6')])(path[a1_0x1369('0x39')](_0xeea2de,a1_0x1369('0x22')+_0x1ae624),_0x12aed3);}function onComplete(_0x59d3c3,_0x2c3308,_0x42e504,_0x2565f3,_0x5b913e,_0x12eb79,_0x545b17,_0x24ee2d,_0x334303,_0x507bd6,_0x4bdab0){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x3cb467=new Date()[a1_0x1369('0x1d')]();if(environment_1[a1_0x1369('0x31')]){storeTaskHashes(_0x334303,_0x2c3308[a1_0x1369('0x21')]||a1_0x1369('0x24'),environment_1[a1_0x1369('0x32')]);}const _0x4fbebf=(0x0,environment_1[a1_0x1369('0x2a')])();const _0x41c47a=yield Promise['all']([_0x42e504[a1_0x1369('0x35')](),_0x2565f3[a1_0x1369('0x3e')]({'command':_0x5b913e[a1_0x1369('0x3c')]((0x0,environment_1['parseCommand'])()),'startTime':_0x12eb79,'endTime':_0x3cb467,'distributedExecutionId':environment_1[a1_0x1369('0x32')],'branch':_0x4fbebf,'scan':!![],'runGroup':(0x0,environment_1[a1_0x1369('0xf')])(),'sha':_0x4fbebf?(0x0,environment_1[a1_0x1369('0x2c')])():undefined,'inner':_0x4bdab0},_0x334303)]);if(_0x507bd6){setTimeout(()=>{_0x545b17[a1_0x1369('0x2b')]();if(!_0x545b17[a1_0x1369('0xb')]&&!_0x4bdab0){_0x24ee2d[a1_0x1369('0x4')]();}},0x0);}else{_0x545b17[a1_0x1369('0x2b')]();if(!_0x545b17[a1_0x1369('0xb')]&&!_0x4bdab0){_0x24ee2d['printCacheHitsMessage']();}}if(environment_1[a1_0x1369('0x31')]){if(!_0x41c47a[0x0]){output[a1_0x1369('0x25')]({'title':'Agent\x20wasn\x27t\x20able\x20to\x20store\x20artifacts'});_0x545b17[a1_0x1369('0x2b')]();process[a1_0x1369('0x23')](environment_1[a1_0x1369('0x2d')]);}if(!_0x41c47a[0x1]){output[a1_0x1369('0x25')]({'title':'Agent\x20wasn\x27t\x20able\x20to\x20record\x20its\x20run'});_0x545b17['printMessages']();process[a1_0x1369('0x23')](environment_1[a1_0x1369('0x2d')]);}}yield(0x0,metric_logger_1[a1_0x1369('0x8')])(_0x2c3308);});}function createLifeCycle(_0x37c0fa,_0x1c8b10,_0x1e499e,_0x2427e1){const _0x53c873=new cloud_enabled_life_cycle_1[(a1_0x1369('0x41'))](_0x37c0fa,_0x1c8b10[a1_0x1369('0x21')],!!_0x1c8b10['skipNxCache'],_0x1c8b10['scan']===undefined?!![]:_0x1c8b10[a1_0x1369('0xe')],_0x1c8b10[a1_0x1369('0x2e')]||[],_0x1e499e,_0x2427e1);try{const {CompositeLifeCycle}=require(a1_0x1369('0x9'));if(!CompositeLifeCycle)return _0x53c873;return new CompositeLifeCycle([_0x1c8b10['lifeCycle'],_0x53c873]);}catch(_0x226a5f){return _0x53c873;}}function cloudEnabledTasksRunner(_0x378bf7,_0x588d6b,_0x48e979,_0x3ae5d=![]){const _0x1e4209={'statuses':{},'scheduledTasks':[],'requests':{},'allTasks':_0x378bf7};const _0x3c8b44=_0x588d6b[a1_0x1369('0x5')]===undefined;const _0x4cda26=[];const _0x337c21=new message_reporter_1['MessageReporter'](_0x588d6b);const _0x205c95=createApi(_0x337c21,_0x588d6b,_0x1e4209);const _0x13346c=new end_of_run_message_1[(a1_0x1369('0x26'))](_0x1e4209,_0x4cda26);const _0x4c6321=new output_obfuscator_1[(a1_0x1369('0x2'))](_0x588d6b[a1_0x1369('0x18')]);const _0x70d329=_0x378bf7[a1_0x1369('0x1f')](_0x452846=>_0x452846[a1_0x1369('0x13')])[a1_0x1369('0x17')](_0x52e0fe=>!!_0x52e0fe);const _0x5a060e=_0x205c95[a1_0x1369('0x2f')](environment_1[a1_0x1369('0x32')],_0x70d329);_0x70d329[a1_0x1369('0x0')](_0x16cb8a=>{_0x1e4209[a1_0x1369('0x3')][_0x16cb8a]=_0x5a060e;});const _0x57254b=new Date()[a1_0x1369('0x1d')]();const _0x2fa492=createLifeCycle(_0x1e4209,_0x588d6b,_0x4c6321,_0x4cda26);const _0x5b7f6c=new e2e_encryption_1['E2EEncryption'](environment_1[a1_0x1369('0x20')]||_0x588d6b[a1_0x1369('0x15')]);const _0x290708=new error_reporter_api_1[(a1_0x1369('0x3a'))](_0x588d6b);const _0x2265ef=new file_storage_1[(a1_0x1369('0x36'))](_0x5b7f6c,_0x290708,![]);const _0x198013=new cloud_remote_cache_1[(a1_0x1369('0x28'))](_0x337c21,_0x205c95,_0x1e4209,_0x2265ef);delete process[a1_0x1369('0x16')][a1_0x1369('0x32')];const _0xf259da=tasksRunner(_0x378bf7,Object[a1_0x1369('0x30')](Object[a1_0x1369('0x30')]({},_0x588d6b),{'remoteCache':_0x198013,'lifeCycle':_0x2fa492}),_0x48e979);if(_0xf259da['subscribe']){const {Subject}=require(a1_0x1369('0xc'));const _0x4917c6=new Subject();_0xf259da[a1_0x1369('0x10')]({'next':_0xc13fca=>_0x4917c6[a1_0x1369('0xd')](_0xc13fca),'error':_0x3e181c=>_0x4917c6[a1_0x1369('0x25')](_0x3e181c),'complete':()=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x2fa492,_0x588d6b,_0x198013,_0x205c95,_0x4c6321,_0x57254b,_0x337c21,_0x13346c,_0x4cda26,_0x3c8b44,_0x3ae5d);_0x4917c6[a1_0x1369('0x3d')]();})});return _0x4917c6;}else{return _0xf259da[a1_0x1369('0x19')](_0x3db86d=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x2fa492,_0x588d6b,_0x198013,_0x205c95,_0x4c6321,_0x57254b,_0x337c21,_0x13346c,_0x4cda26,_0x3c8b44,_0x3ae5d);return _0x3db86d;}))[a1_0x1369('0x29')](_0x4795d7=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x2fa492,_0x588d6b,_0x198013,_0x205c95,_0x4c6321,_0x57254b,_0x337c21,_0x13346c,_0x4cda26,_0x3c8b44,_0x3ae5d);throw _0x4795d7;}));}}exports[a1_0x1369('0x1a')]=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_0x4ec0=['resolve','../../../utilities/environment','__esModule','note','value','api','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','scheduledTasks','put','axiosException','messages','VERBOSE_LOGGING','.\x20Status\x20404.','CloudRemoteCache','startRun','next','get','response','runContext','../../../utilities/nx-imports','store','retrieve','defineProperty','reduce','statuses','map','fileStorage','storage','remote-cache-hit','forEach','indexOf','cacheError','extractErrorMessage','.\x20Read\x20only\x20token\x20is\x20used.','done','hashUrls','storeRequests','hash','then','__awaiter','apply','requests','cache-miss','Nx\x20Cloud:\x20Skipping\x20storing\x20','push','throw','Nx\x20Cloud:\x20Cache\x20miss\x20'];(function(_0x58409f,_0x4ec07c){const _0x194c3f=function(_0x1a5d20){while(--_0x1a5d20){_0x58409f['push'](_0x58409f['shift']());}};_0x194c3f(++_0x4ec07c);}(a2_0x4ec0,0x1d7));const a2_0x194c=function(_0x58409f,_0x4ec07c){_0x58409f=_0x58409f-0x0;let _0x194c3f=a2_0x4ec0[_0x58409f];return _0x194c3f;};'use strict';var __awaiter=this&&this[a2_0x194c('0x26')]||function(_0x5e6c17,_0x10f57d,_0x1d6e0c,_0x23c02d){function _0x3d93df(_0x215f3a){return _0x215f3a instanceof _0x1d6e0c?_0x215f3a:new _0x1d6e0c(function(_0x4ad529){_0x4ad529(_0x215f3a);});}return new(_0x1d6e0c||(_0x1d6e0c=Promise))(function(_0x34c7b3,_0x35b272){function _0xa1d71f(_0x3aa250){try{_0x40b87c(_0x23c02d[a2_0x194c('0xe')](_0x3aa250));}catch(_0x4f3634){_0x35b272(_0x4f3634);}}function _0x1147ac(_0x7b86f7){try{_0x40b87c(_0x23c02d[a2_0x194c('0x2c')](_0x7b86f7));}catch(_0x54da4f){_0x35b272(_0x54da4f);}}function _0x40b87c(_0x5f24d6){_0x5f24d6[a2_0x194c('0x21')]?_0x34c7b3(_0x5f24d6[a2_0x194c('0x3')]):_0x3d93df(_0x5f24d6[a2_0x194c('0x3')])[a2_0x194c('0x25')](_0xa1d71f,_0x1147ac);}_0x40b87c((_0x23c02d=_0x23c02d[a2_0x194c('0x27')](_0x5e6c17,_0x10f57d||[]))[a2_0x194c('0xe')]());});};Object[a2_0x194c('0x15')](exports,a2_0x194c('0x1'),{'value':!![]});exports[a2_0x194c('0xc')]=void 0x0;const environment_1=require(a2_0x194c('0x0'));const {output}=require(a2_0x194c('0x12'));class CloudRemoteCache{constructor(_0x3ef23f,_0x2d2d11,_0x137d66,_0x417505){this[a2_0x194c('0x9')]=_0x3ef23f;this[a2_0x194c('0x4')]=_0x2d2d11;this[a2_0x194c('0x11')]=_0x137d66;this[a2_0x194c('0x19')]=_0x417505;this[a2_0x194c('0x23')]=[];}[a2_0x194c('0x14')](_0x48bc75,_0x5c26ec){var _0x47802d;return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a2_0x194c('0x9')][a2_0x194c('0x1e')])return![];const _0x330065=yield this[a2_0x194c('0x22')](_0x48bc75);if(!_0x330065||!_0x330065[a2_0x194c('0xf')]){if(environment_1[a2_0x194c('0xa')]){output[a2_0x194c('0x2')]({'title':a2_0x194c('0x2d')+_0x48bc75+'.'});}this[a2_0x194c('0x11')][a2_0x194c('0x17')][_0x48bc75]=a2_0x194c('0x29');return![];}try{yield this['fileStorage']['retrieve'](_0x48bc75,_0x330065[a2_0x194c('0xf')],_0x5c26ec);this['runContext'][a2_0x194c('0x17')][_0x48bc75]=a2_0x194c('0x1b');return!![];}catch(_0x1204da){const _0x44781b=(_0x47802d=_0x1204da[a2_0x194c('0x8')])!==null&&_0x47802d!==void 0x0?_0x47802d:_0x1204da;if(_0x44781b[a2_0x194c('0x10')]&&_0x44781b[a2_0x194c('0x10')]['status']===0x194){if(environment_1[a2_0x194c('0xa')]){output[a2_0x194c('0x2')]({'title':a2_0x194c('0x2d')+_0x48bc75+a2_0x194c('0xb')});}}else{this[a2_0x194c('0x9')]['cacheError']=this[a2_0x194c('0x9')][a2_0x194c('0x1f')](_0x44781b,'storage');}this[a2_0x194c('0x11')][a2_0x194c('0x17')][_0x48bc75]=a2_0x194c('0x29');return![];}});}[a2_0x194c('0x13')](_0x4cd972,_0xbc73fd){return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a2_0x194c('0x9')][a2_0x194c('0x1e')])return![];const _0x2a297a=Promise[a2_0x194c('0x2e')]()[a2_0x194c('0x25')](()=>__awaiter(this,void 0x0,void 0x0,function*(){var _0x319b48;const _0x12eed8=yield this[a2_0x194c('0x22')](_0x4cd972);if(!_0x12eed8)return![];if(!_0x12eed8[a2_0x194c('0x7')]){if(environment_1[a2_0x194c('0xa')]){output[a2_0x194c('0x2')]({'title':a2_0x194c('0x2a')+_0x4cd972+a2_0x194c('0x20')});}return!![];}try{yield this[a2_0x194c('0x19')][a2_0x194c('0x13')](_0x4cd972,_0x12eed8[a2_0x194c('0x7')],_0xbc73fd);return!![];}catch(_0x5d8167){const _0x838151=(_0x319b48=_0x5d8167[a2_0x194c('0x8')])!==null&&_0x319b48!==void 0x0?_0x319b48:_0x5d8167;this[a2_0x194c('0x9')][a2_0x194c('0x1e')]=this['messages'][a2_0x194c('0x1f')](_0x838151,a2_0x194c('0x1a'));return![];}}));this[a2_0x194c('0x23')]['push'](_0x2a297a);return _0x2a297a;});}[a2_0x194c('0x22')](_0x1c181b){return __awaiter(this,void 0x0,void 0x0,function*(){if(_0x1c181b in this[a2_0x194c('0x11')][a2_0x194c('0x28')]){return(yield this['runContext'][a2_0x194c('0x28')][_0x1c181b])[_0x1c181b];}else{const _0x3fba44=this[a2_0x194c('0x11')][a2_0x194c('0x6')]['filter'](_0x5da78b=>!this[a2_0x194c('0x11')][a2_0x194c('0x28')][_0x5da78b[a2_0x194c('0x24')]])[a2_0x194c('0x18')](_0x4ba970=>_0x4ba970[a2_0x194c('0x24')]);if(_0x3fba44[a2_0x194c('0x1d')](_0x1c181b)===-0x1){_0x3fba44[a2_0x194c('0x2b')](_0x1c181b);}const _0x4527cf=this['api'][a2_0x194c('0xd')](environment_1[a2_0x194c('0x5')],_0x3fba44);_0x3fba44[a2_0x194c('0x1c')](_0x4aca90=>{this[a2_0x194c('0x11')][a2_0x194c('0x28')][_0x4aca90]=_0x4527cf;});return(yield _0x4527cf)[_0x1c181b];}});}['waitForStoreRequestsToComplete'](){return Promise['all'](this[a2_0x194c('0x23')])[a2_0x194c('0x25')](_0x3ddeb9=>_0x3ddeb9[a2_0x194c('0x16')]((_0x508aa2,_0x1aa2ab)=>_0x508aa2&&_0x1aa2ab,!![]));}}exports[a2_0x194c('0xc')]=CloudRemoteCache;