@nrwl/nx-cloud 13.2.0 → 13.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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 a0_0x1a13=['recordMetric','value','__awaiter','exit','defineProperty','axiosMultipleTries','axiosException','message','createRunGroup','createMetricRecorder','apply','throw','mapRespToPerfEntry','next','../../utilities/nx-imports','completeRunGroup','/nx-cloud/executions/create-run-group','__esModule','../../utilities/metric-logger','response','apiAxiosInstance','/nx-cloud/executions/complete-run-group','RunGroupApi','post','createApiAxiosInstance'];(function(_0x17f825,_0x1a1397){const _0x4b2d90=function(_0x3c3ecb){while(--_0x3c3ecb){_0x17f825['push'](_0x17f825['shift']());}};_0x4b2d90(++_0x1a1397);}(a0_0x1a13,0xc8));const a0_0x4b2d=function(_0x17f825,_0x1a1397){_0x17f825=_0x17f825-0x0;let _0x4b2d90=a0_0x1a13[_0x17f825];return _0x4b2d90;};'use strict';var __awaiter=this&&this[a0_0x4b2d('0x2')]||function(_0x2338d2,_0x402c74,_0x1d4481,_0x1602e2){function _0x221966(_0x13e42c){return _0x13e42c instanceof _0x1d4481?_0x13e42c:new _0x1d4481(function(_0x51580b){_0x51580b(_0x13e42c);});}return new(_0x1d4481||(_0x1d4481=Promise))(function(_0x122596,_0x2f46e8){function _0x255101(_0x1c5bbf){try{_0x5858bd(_0x1602e2[a0_0x4b2d('0xd')](_0x1c5bbf));}catch(_0x454119){_0x2f46e8(_0x454119);}}function _0x54c56e(_0x477902){try{_0x5858bd(_0x1602e2[a0_0x4b2d('0xb')](_0x477902));}catch(_0x485983){_0x2f46e8(_0x485983);}}function _0x5858bd(_0x331bd4){_0x331bd4['done']?_0x122596(_0x331bd4[a0_0x4b2d('0x1')]):_0x221966(_0x331bd4[a0_0x4b2d('0x1')])['then'](_0x255101,_0x54c56e);}_0x5858bd((_0x1602e2=_0x1602e2[a0_0x4b2d('0xa')](_0x2338d2,_0x402c74||[]))[a0_0x4b2d('0xd')]());});};Object[a0_0x4b2d('0x4')](exports,a0_0x4b2d('0x11'),{'value':!![]});exports[a0_0x4b2d('0x16')]=void 0x0;const axios_1=require('../../utilities/axios');const metric_logger_1=require(a0_0x4b2d('0x12'));const {output}=require(a0_0x4b2d('0xe'));class RunGroupApi{constructor(_0xab9bdd){this[a0_0x4b2d('0x14')]=(0x0,axios_1[a0_0x4b2d('0x18')])(_0xab9bdd);}[a0_0x4b2d('0x8')](_0x28c98b,_0x13f03e){var _0x40c94e;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x668199=(0x0,metric_logger_1[a0_0x4b2d('0x9')])(a0_0x4b2d('0x8'));try{const _0x43a4de=yield(0x0,axios_1['axiosMultipleTries'])(()=>this[a0_0x4b2d('0x14')][a0_0x4b2d('0x17')](a0_0x4b2d('0x10'),{'branch':_0x28c98b,'runGroup':_0x13f03e}));_0x668199[a0_0x4b2d('0x0')]((0x0,metric_logger_1['mapRespToPerfEntry'])(_0x43a4de));}catch(_0x24594d){_0x668199[a0_0x4b2d('0x0')](((_0x40c94e=_0x24594d===null||_0x24594d===void 0x0?void 0x0:_0x24594d[a0_0x4b2d('0x6')])===null||_0x40c94e===void 0x0?void 0x0:_0x40c94e['response'])?(0x0,metric_logger_1[a0_0x4b2d('0xc')])(_0x24594d[a0_0x4b2d('0x6')][a0_0x4b2d('0x13')]):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);output['error']({'title':_0x24594d['message']});process[a0_0x4b2d('0x3')](0x1);}});}[a0_0x4b2d('0xf')](_0xc9c895){var _0x2c35b6;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x184a20=(0x0,metric_logger_1['createMetricRecorder'])(a0_0x4b2d('0x8'));try{const _0x1d6c53=yield(0x0,axios_1[a0_0x4b2d('0x5')])(()=>this[a0_0x4b2d('0x14')][a0_0x4b2d('0x17')](a0_0x4b2d('0x15'),{'runGroup':_0xc9c895}));_0x184a20['recordMetric']((0x0,metric_logger_1[a0_0x4b2d('0xc')])(_0x1d6c53));}catch(_0x656f8b){_0x184a20[a0_0x4b2d('0x0')](((_0x2c35b6=_0x656f8b===null||_0x656f8b===void 0x0?void 0x0:_0x656f8b[a0_0x4b2d('0x6')])===null||_0x2c35b6===void 0x0?void 0x0:_0x2c35b6[a0_0x4b2d('0x13')])?(0x0,metric_logger_1[a0_0x4b2d('0xc')])(_0x656f8b['axiosException'][a0_0x4b2d('0x13')]):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);output['error']({'title':_0x656f8b[a0_0x4b2d('0x7')]});process[a0_0x4b2d('0x3')](0x1);}});}}exports[a0_0x4b2d('0x16')]=RunGroupApi;
@@ -1,138 +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 { appRootPath, unparse } = require('../../../utilities/nx-imports');
8
- class CloudEnabledLifeCycle {
9
- constructor(runContext, cacheDirectory, skipNxCache, collectTerminalOutput, cacheableOperations, outputObfuscator, tasks) {
10
- this.runContext = runContext;
11
- this.cacheDirectory = cacheDirectory;
12
- this.skipNxCache = skipNxCache;
13
- this.collectTerminalOutput = collectTerminalOutput;
14
- this.cacheableOperations = cacheableOperations;
15
- this.outputObfuscator = outputObfuscator;
16
- this.tasks = tasks;
17
- }
18
- scheduleTask(task) {
19
- this.runContext.scheduledTasks.push(task);
20
- }
21
- startTask(task) {
22
- const overrides = Object.assign({}, (task.overrides || {}));
23
- if (task.target.configuration) {
24
- overrides['configuration'] = task.target.configuration;
25
- }
26
- this.tasks.push({
27
- taskId: task.id,
28
- startTime: new Date().toISOString(),
29
- target: task.target.target,
30
- projectName: task.target.project,
31
- hash: task.hash,
32
- hashDetails: this.cleanUpHashDetails(task.hashDetails),
33
- params: unparse(overrides).join(' '),
34
- });
35
- }
36
- // Used for older version for Nx. Remove in Dec 2022
37
- endTask(task, code) {
38
- let cacheStatus;
39
- if (this.runContext.statuses[task.hash]) {
40
- cacheStatus = this.runContext.statuses[task.hash];
41
- }
42
- else {
43
- if (this.cacheableOperations.indexOf(task.target.target) > -1 &&
44
- !this.skipNxCache) {
45
- cacheStatus = 'local-cache-hit';
46
- }
47
- else {
48
- cacheStatus = 'cache-miss';
49
- }
50
- }
51
- this.updateStartedTask(task, code, cacheStatus);
52
- }
53
- endTasks(tasks) {
54
- for (let t of tasks) {
55
- const status = t.status === 'remote-cache'
56
- ? 'remote-cache-hit'
57
- : t.status === 'local-cache' ||
58
- t.status === 'local-cache-kept-existing'
59
- ? 'local-cache-hit'
60
- : 'cache-miss';
61
- this.updateStartedTask(t.task, t.code, status);
62
- }
63
- }
64
- endCommand() { }
65
- updateStartedTask(task, code, cacheStatus) {
66
- const startedTask = this.tasks.find((t) => t.taskId === task.id);
67
- if (!startedTask) {
68
- throw new Error(`Cannot find task ${task.id}`);
69
- }
70
- startedTask.endTime = new Date().toISOString();
71
- startedTask.status = code;
72
- startedTask.params = this.outputObfuscator.obfuscate(startedTask.params);
73
- startedTask.cacheStatus = cacheStatus;
74
- if (this.collectTerminalOutput) {
75
- startedTask.terminalOutput = this.getTerminalOutput(task.hash, startedTask.cacheStatus, code);
76
- }
77
- }
78
- getTerminalOutput(hash, cacheStatus, code) {
79
- let dir;
80
- if (this.cacheDirectory) {
81
- if (this.cacheDirectory.startsWith('./')) {
82
- dir = (0, path_1.join)(appRootPath, this.cacheDirectory);
83
- }
84
- else {
85
- dir = this.cacheDirectory;
86
- }
87
- }
88
- else {
89
- dir = (0, path_1.join)(appRootPath, 'node_modules', '.cache', 'nx');
90
- }
91
- try {
92
- const taskOutput = this.readTerminalOutputFile(dir, hash);
93
- const taskOutputSanitized = this.outputObfuscator.obfuscate(taskOutput);
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 = 5000;
138
- //# sourceMappingURL=cloud-enabled-life-cycle.js.map
1
+ const a0_0x47d9=['configuration','assign','runtime','toISOString','statuses','cleanUpHashDetails','CloudEnabledLifeCycle','endCommand','status','MAX_CHARACTERS_SUCCESSFUL_TASK','remote-cache-hit','cacheStatus','MAX_CHARACTERS_CACHED_TASK','MAX_CHARACTERS_FAILED_TASK','taskId','readTerminalOutputFile','hashDetails','project','slice','updateStartedTask','getTerminalOutput','keys','local-cache-hit','join','tasks','nodes','filter','readFileSync','push','local-cache-kept-existing','local-cache','outputObfuscator','endTasks','terminalOutputs','overrides','cache-miss','target','toString','forEach','__esModule','collectTerminalOutput','defineProperty','cacheDirectory','startsWith','hash','obfuscate','length','scheduledTasks','terminalOutput','cacheableOperations','runContext','skipNxCache','endTask','startTask','path','remote-cache','find','node_modules','indexOf','.cache'];(function(_0x10c6de,_0x47d9f3){const _0x46b8de=function(_0x229dff){while(--_0x229dff){_0x10c6de['push'](_0x10c6de['shift']());}};_0x46b8de(++_0x47d9f3);}(a0_0x47d9,0xaa));const a0_0x46b8=function(_0x10c6de,_0x47d9f3){_0x10c6de=_0x10c6de-0x0;let _0x46b8de=a0_0x47d9[_0x10c6de];return _0x46b8de;};'use strict';Object[a0_0x46b8('0x33')](exports,a0_0x46b8('0x31'),{'value':!![]});exports[a0_0x46b8('0x10')]=void 0x0;const path=require(a0_0x46b8('0x4'));const path_1=require(a0_0x46b8('0x4'));const fs_1=require('fs');const {appRootPath,unparse}=require('../../../utilities/nx-imports');class CloudEnabledLifeCycle{constructor(_0x4a182d,_0x486429,_0x3ec134,_0x3178ea,_0xb393d2,_0xa3095e,_0x1356c6){this['runContext']=_0x4a182d;this[a0_0x46b8('0x34')]=_0x486429;this[a0_0x46b8('0x1')]=_0x3ec134;this[a0_0x46b8('0x32')]=_0x3178ea;this['cacheableOperations']=_0xb393d2;this[a0_0x46b8('0x29')]=_0xa3095e;this[a0_0x46b8('0x22')]=_0x1356c6;}['scheduleTask'](_0x5da31c){this['runContext'][a0_0x46b8('0x39')][a0_0x46b8('0x26')](_0x5da31c);}[a0_0x46b8('0x3')](_0x3d1ba5){const _0x14e1b2=Object[a0_0x46b8('0xb')]({},_0x3d1ba5[a0_0x46b8('0x2c')]||{});if(_0x3d1ba5[a0_0x46b8('0x2e')][a0_0x46b8('0xa')]){_0x14e1b2[a0_0x46b8('0xa')]=_0x3d1ba5['target'][a0_0x46b8('0xa')];}this[a0_0x46b8('0x22')][a0_0x46b8('0x26')]({'taskId':_0x3d1ba5['id'],'startTime':new Date()[a0_0x46b8('0xd')](),'target':_0x3d1ba5[a0_0x46b8('0x2e')][a0_0x46b8('0x2e')],'projectName':_0x3d1ba5['target'][a0_0x46b8('0x1b')],'hash':_0x3d1ba5[a0_0x46b8('0x36')],'hashDetails':this['cleanUpHashDetails'](_0x3d1ba5[a0_0x46b8('0x1a')]),'params':unparse(_0x14e1b2)[a0_0x46b8('0x21')]('\x20')});}[a0_0x46b8('0x2')](_0x3d8c13,_0x347740){let _0xd2c0d7;if(this[a0_0x46b8('0x0')][a0_0x46b8('0xe')][_0x3d8c13[a0_0x46b8('0x36')]]){_0xd2c0d7=this[a0_0x46b8('0x0')]['statuses'][_0x3d8c13['hash']];}else{if(this[a0_0x46b8('0x3b')][a0_0x46b8('0x8')](_0x3d8c13['target']['target'])>-0x1&&!this[a0_0x46b8('0x1')]){_0xd2c0d7=a0_0x46b8('0x20');}else{_0xd2c0d7=a0_0x46b8('0x2d');}}this[a0_0x46b8('0x1d')](_0x3d8c13,_0x347740,_0xd2c0d7);}[a0_0x46b8('0x2a')](_0x38e005){for(let _0x505404 of _0x38e005){const _0x507ac9=_0x505404[a0_0x46b8('0x12')]===a0_0x46b8('0x5')?a0_0x46b8('0x14'):_0x505404['status']===a0_0x46b8('0x28')||_0x505404[a0_0x46b8('0x12')]===a0_0x46b8('0x27')?a0_0x46b8('0x20'):a0_0x46b8('0x2d');this['updateStartedTask'](_0x505404['task'],_0x505404['code'],_0x507ac9);}}[a0_0x46b8('0x11')](){}['updateStartedTask'](_0x232b2d,_0xf60ebe,_0x31d594){const _0x246378=this['tasks'][a0_0x46b8('0x6')](_0x5a4dc2=>_0x5a4dc2[a0_0x46b8('0x18')]===_0x232b2d['id']);if(!_0x246378){throw new Error('Cannot\x20find\x20task\x20'+_0x232b2d['id']);}_0x246378['endTime']=new Date()['toISOString']();_0x246378['status']=_0xf60ebe;_0x246378['params']=this['outputObfuscator'][a0_0x46b8('0x37')](_0x246378['params']);_0x246378[a0_0x46b8('0x15')]=_0x31d594;if(this[a0_0x46b8('0x32')]){_0x246378['terminalOutput']=this[a0_0x46b8('0x1e')](_0x232b2d[a0_0x46b8('0x36')],_0x246378[a0_0x46b8('0x15')],_0xf60ebe);}}[a0_0x46b8('0x1e')](_0x3dd733,_0x35d48f,_0x55cbfe){let _0x3f194a;if(this[a0_0x46b8('0x34')]){if(this[a0_0x46b8('0x34')][a0_0x46b8('0x35')]('./')){_0x3f194a=(0x0,path_1['join'])(appRootPath,this['cacheDirectory']);}else{_0x3f194a=this[a0_0x46b8('0x34')];}}else{_0x3f194a=(0x0,path_1['join'])(appRootPath,a0_0x46b8('0x7'),a0_0x46b8('0x9'),'nx');}try{const _0x516e3d=this[a0_0x46b8('0x19')](_0x3f194a,_0x3dd733);const _0x2bfe71=this[a0_0x46b8('0x29')]['obfuscate'](_0x516e3d);const _0x2551ae=_0x35d48f===a0_0x46b8('0x2d')?_0x55cbfe===0x0?CloudEnabledLifeCycle[a0_0x46b8('0x13')]:CloudEnabledLifeCycle[a0_0x46b8('0x17')]:CloudEnabledLifeCycle[a0_0x46b8('0x16')];return _0x2bfe71[a0_0x46b8('0x38')]>_0x2551ae?'TRUNCATED\x0a\x0a'+_0x2bfe71[a0_0x46b8('0x1c')](_0x2bfe71[a0_0x46b8('0x38')]-_0x2551ae):_0x2bfe71;}catch(_0x4a96e3){return'';}}[a0_0x46b8('0xf')](_0x479359){const _0x3f47da={};Object[a0_0x46b8('0x1f')](_0x479359[a0_0x46b8('0x23')])[a0_0x46b8('0x24')](_0x37185c=>!_0x37185c[a0_0x46b8('0x35')]('npm:'))[a0_0x46b8('0x30')](_0x2dc5c4=>{_0x3f47da[_0x2dc5c4]=_0x479359[a0_0x46b8('0x23')][_0x2dc5c4];});return{'nodes':_0x3f47da,'runtime':_0x479359[a0_0x46b8('0xc')],'implicitDeps':_0x479359['implicitDeps']};}[a0_0x46b8('0x19')](_0x31c26a,_0x254dc0){try{return(0x0,fs_1[a0_0x46b8('0x25')])(path[a0_0x46b8('0x21')](_0x31c26a,a0_0x46b8('0x2b'),_0x254dc0))[a0_0x46b8('0x2f')]();}catch(_0x5ca910){try{return(0x0,fs_1[a0_0x46b8('0x25')])(path[a0_0x46b8('0x21')](_0x31c26a,_0x254dc0,a0_0x46b8('0x3a')))['toString']();}catch(_0x351acc){return'';}}}}exports[a0_0x46b8('0x10')]=CloudEnabledLifeCycle;CloudEnabledLifeCycle['MAX_CHARACTERS_FAILED_TASK']=0x30d40;CloudEnabledLifeCycle[a0_0x46b8('0x13')]=0x4e20;CloudEnabledLifeCycle[a0_0x46b8('0x16')]=0x1388;
@@ -1,166 +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 Subject_1 = require("rxjs/internal/Subject");
14
- const message_reporter_1 = require("../../terminal-output/message-reporter");
15
- const end_of_run_message_1 = require("../../terminal-output/end-of-run-message");
16
- const output_obfuscator_1 = require("../../terminal-output/output-obfuscator");
17
- const cloud_enabled_life_cycle_1 = require("./cloud-enabled-life-cycle");
18
- const file_storage_1 = require("../../file-storage/file-storage");
19
- const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
20
- const environment_1 = require("../../../utilities/environment");
21
- const cloud_remote_cache_1 = require("./cloud-remote-cache");
22
- const cloud_run_api_1 = require("./cloud-run.api");
23
- const fs_1 = require("fs");
24
- const path = require("path");
25
- const metric_logger_1 = require("../../../utilities/metric-logger");
26
- const { tasksRunnerV2, 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) {
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
- }, taskExecutions),
64
- ]);
65
- // this workaround is required because prior to Nx 13.3 we printed
66
- // the end message after the runner completes, so we need to wait for the
67
- // message to appear in the right place
68
- if (versionOfNxBefore133) {
69
- setTimeout(() => {
70
- messages.printMessages();
71
- if (!messages.anyErrors) {
72
- endOfRunMessage.printCacheHitsMessage();
73
- }
74
- }, 0);
75
- }
76
- else {
77
- messages.printMessages();
78
- if (!messages.anyErrors) {
79
- endOfRunMessage.printCacheHitsMessage();
80
- }
81
- }
82
- if (environment_1.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION) {
83
- if (!endRequest[0]) {
84
- output.error({
85
- title: `Agent wasn't able to store artifacts`,
86
- });
87
- messages.printMessages();
88
- process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
89
- }
90
- if (!endRequest[1]) {
91
- output.error({
92
- title: `Agent wasn't able to record its run`,
93
- });
94
- messages.printMessages();
95
- process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
96
- }
97
- }
98
- yield (0, metric_logger_1.submitRunMetrics)(options);
99
- });
100
- }
101
- function createLifeCycle(runContext, options, outputObfuscator, tasks) {
102
- const cloudEnabledLifeCycle = new cloud_enabled_life_cycle_1.CloudEnabledLifeCycle(runContext, options.cacheDirectory, !!options.skipNxCache, options.scan === undefined ? true : options.scan, options.cacheableOperations || [], outputObfuscator, tasks);
103
- try {
104
- const { CompositeLifeCycle } = require('../../../utilities/nx-imports');
105
- if (!CompositeLifeCycle)
106
- return cloudEnabledLifeCycle;
107
- return new CompositeLifeCycle([options.lifeCycle, cloudEnabledLifeCycle]);
108
- }
109
- catch (e) {
110
- return cloudEnabledLifeCycle;
111
- }
112
- }
113
- function cloudEnabledTasksRunner(tasks, options, context) {
114
- const runContext = {
115
- statuses: {},
116
- scheduledTasks: [],
117
- requests: {},
118
- allTasks: tasks,
119
- };
120
- const versionOfNxBefore133 = options.lifeCycle === undefined;
121
- const taskExecutions = [];
122
- const messages = new message_reporter_1.MessageReporter(options);
123
- const api = createApi(messages, options, runContext);
124
- const endOfRunMessage = new end_of_run_message_1.EndOfRunMessage(runContext, taskExecutions);
125
- const outputObfuscator = new output_obfuscator_1.OutputObfuscator(options.maskedProperties);
126
- const hashes = tasks.map((t) => t.hash).filter((h) => !!h);
127
- const startRunRequest = api.startRun(environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID, hashes);
128
- hashes.forEach((hash) => {
129
- runContext.requests[hash] = startRunRequest;
130
- });
131
- const runStartTime = new Date().toISOString();
132
- const lifeCycle = createLifeCycle(runContext, options, outputObfuscator, taskExecutions);
133
- const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
134
- const fileStorage = new file_storage_1.FileStorage(encryption);
135
- const remoteCache = new cloud_remote_cache_1.CloudRemoteCache(messages, api, runContext, fileStorage);
136
- // have to reset it so we don't capture inner tasks
137
- delete process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID;
138
- const res = tasksRunnerV2(tasks, Object.assign(Object.assign({}, options), { remoteCache, lifeCycle }), context);
139
- // observable -> legacy
140
- if (res.subscribe) {
141
- const wrappedRes = new Subject_1.Subject();
142
- res.subscribe({
143
- next: (value) => wrappedRes.next(value),
144
- error: (err) => wrappedRes.error(err),
145
- complete: () => __awaiter(this, void 0, void 0, function* () {
146
- yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133);
147
- wrappedRes.complete();
148
- }),
149
- });
150
- return wrappedRes;
151
- // promise
152
- }
153
- else {
154
- return res
155
- .then((r) => __awaiter(this, void 0, void 0, function* () {
156
- yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133);
157
- return r;
158
- }))
159
- .catch((e) => __awaiter(this, void 0, void 0, function* () {
160
- yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133);
161
- throw e;
162
- }));
163
- }
164
- }
165
- exports.cloudEnabledTasksRunner = cloudEnabledTasksRunner;
166
- //# sourceMappingURL=cloud-enabled.runner.js.map
1
+ const a1_0x3638=['anyErrors','stringify','requests','Executed\x20tasks\x20with\x20hashes:\x20','toISOString','throw','getBranch','AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION','getMachineInfo','next','printMessages','getRunGroup','join','path','defineProperty','tasks-hashes-','subscribe','printCacheHitsMessage','done','DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE','../../../utilities/nx-imports','Agent\x20wasn\x27t\x20able\x20to\x20record\x20its\x20run','parseCommand','hash','./cloud-remote-cache','startRun','./cloud-enabled-life-cycle','../../../utilities/environment','__awaiter','CloudRunApi','obfuscate','cacheableOperations','taskId','FileStorage','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','exit','cacheDirectory','CloudRemoteCache','then','lifeCycle','../../../utilities/metric-logger','all','MessageReporter','E2EEncryption','value','encryptionKey','cloudEnabledTasksRunner','maskedProperties','submitRunMetrics','../../file-storage/e2e-encryption','scan','./node_modules/.cache/nx','map','__esModule','OutputObfuscator','EndOfRunMessage','complete','CloudEnabledLifeCycle','error','filter'];(function(_0x2bd96e,_0x3638c9){const _0x1abc1f=function(_0x2c9e09){while(--_0x2c9e09){_0x2bd96e['push'](_0x2bd96e['shift']());}};_0x1abc1f(++_0x3638c9);}(a1_0x3638,0x11c));const a1_0x1abc=function(_0x2bd96e,_0x3638c9){_0x2bd96e=_0x2bd96e-0x0;let _0x1abc1f=a1_0x3638[_0x2bd96e];return _0x1abc1f;};'use strict';var __awaiter=this&&this[a1_0x1abc('0x2c')]||function(_0x5c9582,_0x542586,_0x3db25a,_0x1f9bbe){function _0x38c6ca(_0x3fd370){return _0x3fd370 instanceof _0x3db25a?_0x3fd370:new _0x3db25a(function(_0x6eaf7c){_0x6eaf7c(_0x3fd370);});}return new(_0x3db25a||(_0x3db25a=Promise))(function(_0x42ded6,_0x3fdd74){function _0x5590ed(_0x45d870){try{_0x4763cb(_0x1f9bbe[a1_0x1abc('0x19')](_0x45d870));}catch(_0x233e10){_0x3fdd74(_0x233e10);}}function _0x3b6a6e(_0x1ebfb7){try{_0x4763cb(_0x1f9bbe[a1_0x1abc('0x15')](_0x1ebfb7));}catch(_0x153fa3){_0x3fdd74(_0x153fa3);}}function _0x4763cb(_0x413f0e){_0x413f0e[a1_0x1abc('0x22')]?_0x42ded6(_0x413f0e[a1_0x1abc('0x0')]):_0x38c6ca(_0x413f0e['value'])[a1_0x1abc('0x36')](_0x5590ed,_0x3b6a6e);}_0x4763cb((_0x1f9bbe=_0x1f9bbe['apply'](_0x5c9582,_0x542586||[]))[a1_0x1abc('0x19')]());});};Object[a1_0x1abc('0x1e')](exports,a1_0x1abc('0x9'),{'value':!![]});exports[a1_0x1abc('0x2')]=void 0x0;const Subject_1=require('rxjs/internal/Subject');const message_reporter_1=require('../../terminal-output/message-reporter');const end_of_run_message_1=require('../../terminal-output/end-of-run-message');const output_obfuscator_1=require('../../terminal-output/output-obfuscator');const cloud_enabled_life_cycle_1=require(a1_0x1abc('0x2a'));const file_storage_1=require('../../file-storage/file-storage');const e2e_encryption_1=require(a1_0x1abc('0x5'));const environment_1=require(a1_0x1abc('0x2b'));const cloud_remote_cache_1=require(a1_0x1abc('0x28'));const cloud_run_api_1=require('./cloud-run.api');const fs_1=require('fs');const path=require(a1_0x1abc('0x1d'));const metric_logger_1=require(a1_0x1abc('0x38'));const {tasksRunnerV2,output}=require(a1_0x1abc('0x24'));function createApi(_0x2d568a,_0x450dd0,_0x339d00){const _0x427519=(0x0,environment_1[a1_0x1abc('0x18')])(_0x450dd0);return new cloud_run_api_1[(a1_0x1abc('0x2d'))](_0x2d568a,_0x339d00,_0x450dd0,_0x427519);}function storeTaskHashes(_0xb59c7e,_0x5dc5e5,_0x1e42f6){const _0x498e4b=JSON[a1_0x1abc('0x11')](_0xb59c7e['map'](_0x5c2021=>({'taskId':_0x5c2021[a1_0x1abc('0x30')],'hash':_0x5c2021['hash']})));if(environment_1['VERBOSE_LOGGING']){output['note']({'title':a1_0x1abc('0x13')+_0x498e4b});}(0x0,fs_1['writeFileSync'])(path[a1_0x1abc('0x1c')](_0x5dc5e5,a1_0x1abc('0x1f')+_0x1e42f6),_0x498e4b);}function onComplete(_0x289380,_0x138171,_0x4ccb79,_0x5297f4,_0xa28c74,_0x9771ff,_0x3ef8b2,_0x193586,_0xc6c34e,_0x128932){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x30fada=new Date()['toISOString']();if(environment_1[a1_0x1abc('0x17')]){storeTaskHashes(_0xc6c34e,_0x138171[a1_0x1abc('0x34')]||a1_0x1abc('0x7'),environment_1['NX_CLOUD_DISTRIBUTED_EXECUTION_ID']);}const _0x40f11c=(0x0,environment_1[a1_0x1abc('0x16')])();const _0x7afdf8=yield Promise[a1_0x1abc('0x39')]([_0x4ccb79['waitForStoreRequestsToComplete'](),_0x5297f4['endRun']({'command':_0xa28c74[a1_0x1abc('0x2e')]((0x0,environment_1[a1_0x1abc('0x26')])()),'startTime':_0x9771ff,'endTime':_0x30fada,'distributedExecutionId':environment_1[a1_0x1abc('0x32')],'branch':_0x40f11c,'scan':!![],'runGroup':(0x0,environment_1[a1_0x1abc('0x1b')])(),'sha':_0x40f11c?(0x0,environment_1['extractGitSha'])():undefined},_0xc6c34e)]);if(_0x128932){setTimeout(()=>{_0x3ef8b2[a1_0x1abc('0x1a')]();if(!_0x3ef8b2[a1_0x1abc('0x10')]){_0x193586[a1_0x1abc('0x21')]();}},0x0);}else{_0x3ef8b2[a1_0x1abc('0x1a')]();if(!_0x3ef8b2[a1_0x1abc('0x10')]){_0x193586[a1_0x1abc('0x21')]();}}if(environment_1[a1_0x1abc('0x17')]){if(!_0x7afdf8[0x0]){output['error']({'title':'Agent\x20wasn\x27t\x20able\x20to\x20store\x20artifacts'});_0x3ef8b2[a1_0x1abc('0x1a')]();process[a1_0x1abc('0x33')](environment_1[a1_0x1abc('0x23')]);}if(!_0x7afdf8[0x1]){output['error']({'title':a1_0x1abc('0x25')});_0x3ef8b2[a1_0x1abc('0x1a')]();process['exit'](environment_1[a1_0x1abc('0x23')]);}}yield(0x0,metric_logger_1[a1_0x1abc('0x4')])(_0x138171);});}function createLifeCycle(_0x19acf3,_0x324540,_0x3ffcc3,_0x3e55f5){const _0x2a7b94=new cloud_enabled_life_cycle_1[(a1_0x1abc('0xd'))](_0x19acf3,_0x324540[a1_0x1abc('0x34')],!!_0x324540['skipNxCache'],_0x324540[a1_0x1abc('0x6')]===undefined?!![]:_0x324540['scan'],_0x324540[a1_0x1abc('0x2f')]||[],_0x3ffcc3,_0x3e55f5);try{const {CompositeLifeCycle}=require(a1_0x1abc('0x24'));if(!CompositeLifeCycle)return _0x2a7b94;return new CompositeLifeCycle([_0x324540[a1_0x1abc('0x37')],_0x2a7b94]);}catch(_0x3cba71){return _0x2a7b94;}}function cloudEnabledTasksRunner(_0x48aec8,_0x2860f5,_0x54cf29){const _0x2880e5={'statuses':{},'scheduledTasks':[],'requests':{},'allTasks':_0x48aec8};const _0x1651e5=_0x2860f5[a1_0x1abc('0x37')]===undefined;const _0x122fba=[];const _0x2f81fa=new message_reporter_1[(a1_0x1abc('0x3a'))](_0x2860f5);const _0x1a963d=createApi(_0x2f81fa,_0x2860f5,_0x2880e5);const _0x4b7e9a=new end_of_run_message_1[(a1_0x1abc('0xb'))](_0x2880e5,_0x122fba);const _0x55e5b2=new output_obfuscator_1[(a1_0x1abc('0xa'))](_0x2860f5[a1_0x1abc('0x3')]);const _0x2790a7=_0x48aec8[a1_0x1abc('0x8')](_0x25968d=>_0x25968d[a1_0x1abc('0x27')])[a1_0x1abc('0xf')](_0x47e366=>!!_0x47e366);const _0x5379b5=_0x1a963d[a1_0x1abc('0x29')](environment_1[a1_0x1abc('0x32')],_0x2790a7);_0x2790a7['forEach'](_0x56e9e2=>{_0x2880e5[a1_0x1abc('0x12')][_0x56e9e2]=_0x5379b5;});const _0x3ef192=new Date()[a1_0x1abc('0x14')]();const _0x52225a=createLifeCycle(_0x2880e5,_0x2860f5,_0x55e5b2,_0x122fba);const _0x523e08=new e2e_encryption_1[(a1_0x1abc('0x3b'))](environment_1['ENCRYPTION_KEY']||_0x2860f5[a1_0x1abc('0x1')]);const _0x462be8=new file_storage_1[(a1_0x1abc('0x31'))](_0x523e08);const _0x2e7797=new cloud_remote_cache_1[(a1_0x1abc('0x35'))](_0x2f81fa,_0x1a963d,_0x2880e5,_0x462be8);delete process['env'][a1_0x1abc('0x32')];const _0x2bac08=tasksRunnerV2(_0x48aec8,Object['assign'](Object['assign']({},_0x2860f5),{'remoteCache':_0x2e7797,'lifeCycle':_0x52225a}),_0x54cf29);if(_0x2bac08['subscribe']){const _0x2068d8=new Subject_1['Subject']();_0x2bac08[a1_0x1abc('0x20')]({'next':_0x1f2dee=>_0x2068d8[a1_0x1abc('0x19')](_0x1f2dee),'error':_0x253333=>_0x2068d8[a1_0x1abc('0xe')](_0x253333),'complete':()=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x52225a,_0x2860f5,_0x2e7797,_0x1a963d,_0x55e5b2,_0x3ef192,_0x2f81fa,_0x4b7e9a,_0x122fba,_0x1651e5);_0x2068d8[a1_0x1abc('0xc')]();})});return _0x2068d8;}else{return _0x2bac08[a1_0x1abc('0x36')](_0x5a3c22=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x52225a,_0x2860f5,_0x2e7797,_0x1a963d,_0x55e5b2,_0x3ef192,_0x2f81fa,_0x4b7e9a,_0x122fba,_0x1651e5);return _0x5a3c22;}))['catch'](_0x9833e1=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete(_0x52225a,_0x2860f5,_0x2e7797,_0x1a963d,_0x55e5b2,_0x3ef192,_0x2f81fa,_0x4b7e9a,_0x122fba,_0x1651e5);throw _0x9833e1;}));}}exports[a1_0x1abc('0x2')]=cloudEnabledTasksRunner;
@@ -1,113 +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_0x51e4=['response','apply','put','fileStorage','hashUrls','Nx\x20Cloud:\x20Skipping\x20storing\x20','all','VERBOSE_LOGGING','storeRequests','messages','indexOf','map','then','resolve','CloudRemoteCache','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','value','scheduledTasks','remote-cache-hit','note','statuses','reduce','.\x20Read\x20only\x20token\x20is\x20used.','filter','startRun','push','hash','axiosException','Nx\x20Cloud:\x20Cache\x20miss\x20','store','runContext','retrieve','status','extractErrorMessage','cacheError','requests','done','storage','cache-miss','waitForStoreRequestsToComplete','throw','__awaiter','../../../utilities/nx-imports','next','get','api','../../../utilities/environment'];(function(_0xd99f7f,_0x51e41f){const _0x254378=function(_0x45cf18){while(--_0x45cf18){_0xd99f7f['push'](_0xd99f7f['shift']());}};_0x254378(++_0x51e41f);}(a2_0x51e4,0x9d));const a2_0x2543=function(_0xd99f7f,_0x51e41f){_0xd99f7f=_0xd99f7f-0x0;let _0x254378=a2_0x51e4[_0xd99f7f];return _0x254378;};'use strict';var __awaiter=this&&this[a2_0x2543('0x19')]||function(_0x2aa292,_0x3e1af0,_0x22307f,_0x50d05a){function _0x4a039c(_0x1d57f1){return _0x1d57f1 instanceof _0x22307f?_0x1d57f1:new _0x22307f(function(_0x479a0a){_0x479a0a(_0x1d57f1);});}return new(_0x22307f||(_0x22307f=Promise))(function(_0x57793f,_0x5a2857){function _0x1f7935(_0x202aa3){try{_0x11440b(_0x50d05a[a2_0x2543('0x1b')](_0x202aa3));}catch(_0x3866ae){_0x5a2857(_0x3866ae);}}function _0xc581a4(_0x5d32a1){try{_0x11440b(_0x50d05a[a2_0x2543('0x18')](_0x5d32a1));}catch(_0x4fd4ff){_0x5a2857(_0x4fd4ff);}}function _0x11440b(_0x1c400c){_0x1c400c[a2_0x2543('0x14')]?_0x57793f(_0x1c400c[a2_0x2543('0x0')]):_0x4a039c(_0x1c400c[a2_0x2543('0x0')])[a2_0x2543('0x2b')](_0x1f7935,_0xc581a4);}_0x11440b((_0x50d05a=_0x50d05a[a2_0x2543('0x20')](_0x2aa292,_0x3e1af0||[]))[a2_0x2543('0x1b')]());});};Object['defineProperty'](exports,'__esModule',{'value':!![]});exports[a2_0x2543('0x2d')]=void 0x0;const environment_1=require(a2_0x2543('0x1e'));const {output}=require(a2_0x2543('0x1a'));class CloudRemoteCache{constructor(_0x42ecdf,_0x414663,_0x31ed3e,_0x576338){this[a2_0x2543('0x28')]=_0x42ecdf;this[a2_0x2543('0x1d')]=_0x414663;this[a2_0x2543('0xe')]=_0x31ed3e;this[a2_0x2543('0x22')]=_0x576338;this['storeRequests']=[];}[a2_0x2543('0xf')](_0x1caa30,_0x2e5b06){var _0x47ba79;return __awaiter(this,void 0x0,void 0x0,function*(){if(this['messages']['cacheError'])return![];const _0x434b58=yield this[a2_0x2543('0x23')](_0x1caa30);if(!_0x434b58||!_0x434b58[a2_0x2543('0x1c')]){if(environment_1[a2_0x2543('0x26')]){output[a2_0x2543('0x3')]({'title':a2_0x2543('0xc')+_0x1caa30+'.'});}this[a2_0x2543('0xe')][a2_0x2543('0x4')][_0x1caa30]=a2_0x2543('0x16');return![];}try{yield this['fileStorage'][a2_0x2543('0xf')](_0x1caa30,_0x434b58[a2_0x2543('0x1c')],_0x2e5b06);this['runContext'][a2_0x2543('0x4')][_0x1caa30]=a2_0x2543('0x2');return!![];}catch(_0x5bd6b1){const _0x2adbc3=(_0x47ba79=_0x5bd6b1[a2_0x2543('0xb')])!==null&&_0x47ba79!==void 0x0?_0x47ba79:_0x5bd6b1;if(_0x2adbc3[a2_0x2543('0x1f')]&&_0x2adbc3['response'][a2_0x2543('0x10')]===0x194){if(environment_1[a2_0x2543('0x26')]){output[a2_0x2543('0x3')]({'title':a2_0x2543('0xc')+_0x1caa30+'.\x20Status\x20404.'});}}else{this['messages'][a2_0x2543('0x12')]=this['messages'][a2_0x2543('0x11')](_0x2adbc3,a2_0x2543('0x15'));}this[a2_0x2543('0xe')][a2_0x2543('0x4')][_0x1caa30]='cache-miss';return![];}});}[a2_0x2543('0xd')](_0x2778d9,_0x16e4a3){return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a2_0x2543('0x28')]['cacheError'])return![];const _0x5251ed=Promise[a2_0x2543('0x2c')]()[a2_0x2543('0x2b')](()=>__awaiter(this,void 0x0,void 0x0,function*(){var _0xa3141c;const _0x499e1f=yield this['hashUrls'](_0x2778d9);if(!_0x499e1f)return![];if(!_0x499e1f[a2_0x2543('0x21')]){if(environment_1[a2_0x2543('0x26')]){output[a2_0x2543('0x3')]({'title':a2_0x2543('0x24')+_0x2778d9+a2_0x2543('0x6')});}return!![];}try{yield this[a2_0x2543('0x22')]['store'](_0x2778d9,_0x499e1f[a2_0x2543('0x21')],_0x16e4a3);return!![];}catch(_0x2c2de3){const _0x2c6f3f=(_0xa3141c=_0x2c2de3[a2_0x2543('0xb')])!==null&&_0xa3141c!==void 0x0?_0xa3141c:_0x2c2de3;this[a2_0x2543('0x28')][a2_0x2543('0x12')]=this[a2_0x2543('0x28')]['extractErrorMessage'](_0x2c6f3f,a2_0x2543('0x15'));return![];}}));this['storeRequests'][a2_0x2543('0x9')](_0x5251ed);return _0x5251ed;});}['hashUrls'](_0x274ba2){return __awaiter(this,void 0x0,void 0x0,function*(){if(_0x274ba2 in this['runContext'][a2_0x2543('0x13')]){return(yield this[a2_0x2543('0xe')][a2_0x2543('0x13')][_0x274ba2])[_0x274ba2];}else{const _0x38acd7=this[a2_0x2543('0xe')][a2_0x2543('0x1')][a2_0x2543('0x7')](_0x151889=>!this['runContext']['requests'][_0x151889['hash']])[a2_0x2543('0x2a')](_0x217186=>_0x217186[a2_0x2543('0xa')]);if(_0x38acd7[a2_0x2543('0x29')](_0x274ba2)===-0x1){_0x38acd7['push'](_0x274ba2);}const _0x1ceddc=this[a2_0x2543('0x1d')][a2_0x2543('0x8')](environment_1[a2_0x2543('0x2e')],_0x38acd7);_0x38acd7['forEach'](_0x48afb2=>{this[a2_0x2543('0xe')]['requests'][_0x48afb2]=_0x1ceddc;});return(yield _0x1ceddc)[_0x274ba2];}});}[a2_0x2543('0x17')](){return Promise[a2_0x2543('0x25')](this[a2_0x2543('0x27')])[a2_0x2543('0x2b')](_0x4422d8=>_0x4422d8[a2_0x2543('0x5')]((_0x32ab9f,_0x37960b)=>_0x32ab9f&&_0x37960b,!![]));}}exports[a2_0x2543('0x2d')]=CloudRemoteCache;