Socket
Socket
Sign inDemoInstall

nx-cloud

Package Overview
Dependencies
Maintainers
1
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nx-cloud - npm Package Compare versions

Comparing version 14.0.4-beta.4 to 14.0.5-beta.1

lib/core/api/error-reporter.api.d.ts

5

lib/core/file-storage/file-storage.d.ts
import { E2EEncryption } from './e2e-encryption';
import { ErrorReporterApi } from '../api/error-reporter.api';
export declare class FileStorage {
private readonly encryption;
constructor(encryption: E2EEncryption);
private readonly errorReporter;
private readonly failWhenCannotDownloadArtifact;
constructor(encryption: E2EEncryption, errorReporter: ErrorReporterApi, failWhenCannotDownloadArtifact: boolean);
retrieve(hash: string, url: string, cacheDirectory: string): Promise<void>;

@@ -6,0 +9,0 @@ store(hash: string, url: string, cacheDirectory: string): Promise<any>;

28

lib/core/file-storage/file-storage.js

@@ -23,4 +23,6 @@ "use strict";

class FileStorage {
constructor(encryption) {
constructor(encryption, errorReporter, failWhenCannotDownloadArtifact) {
this.encryption = encryption;
this.errorReporter = errorReporter;
this.failWhenCannotDownloadArtifact = failWhenCannotDownloadArtifact;
}

@@ -37,7 +39,23 @@ retrieve(hash, url, cacheDirectory) {

const commitFilePath = this.createCommitFilePath(hash, cacheDirectory);
yield this.downloadFile(url, tgz, commitFilePath);
this.createCommitFile(commitFilePath);
if (environment_1.VERBOSE_LOGGING) {
output.note({ title: `Nx Cloud: Downloaded ${hash}` });
try {
yield this.downloadFile(url, tgz, commitFilePath);
this.createCommitFile(commitFilePath);
if (environment_1.VERBOSE_LOGGING) {
output.note({ title: `Nx Cloud: Downloaded ${hash}` });
}
}
catch (e) {
const error = e.message || e.toString();
const errorMessage = `Failed to download or untar the cached artifacts for ${hash}. Error: ${error}`;
yield this.errorReporter.reportError(errorMessage);
if (this.failWhenCannotDownloadArtifact) {
throw e;
}
else {
output.warn({
title: errorMessage,
bodyLines: [`RETRIEVAL URL: ${url}`],
});
}
}
});

@@ -44,0 +62,0 @@ }

@@ -25,2 +25,3 @@ "use strict";

const metric_logger_1 = require("../../../utilities/metric-logger");
const error_reporter_api_1 = require("../../api/error-reporter.api");
const { tasksRunner, output } = require('../../../utilities/nx-imports');

@@ -135,3 +136,4 @@ function createApi(errors, options, runContext) {

const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
const fileStorage = new file_storage_1.FileStorage(encryption);
const errorApi = new error_reporter_api_1.ErrorReporterApi(options);
const fileStorage = new file_storage_1.FileStorage(encryption, errorApi, false);
const remoteCache = new cloud_remote_cache_1.CloudRemoteCache(messages, api, runContext, fileStorage);

@@ -138,0 +140,0 @@ // have to reset it so we don't capture inner tasks

@@ -15,4 +15,5 @@ import { RunContext } from '../../models/run-context.model';

startRun(distributedExecutionId: string | undefined, hashes: string[]): Promise<CacheUrls>;
private createReqBody;
endRun(run: RunData, tasks: TaskExecution[]): Promise<boolean>;
private nxCloudVersion;
}

@@ -67,2 +67,13 @@ "use strict";

}
createReqBody(run, tasks) {
const uncompressedReqBody = {
meta: {
nxCloudVersion: this.nxCloudVersion(),
},
tasks,
run: run,
machineInfo: this.machineInfo,
};
return JSON.stringify(uncompressedReqBody);
}
endRun(run, tasks) {

@@ -74,11 +85,8 @@ var _a, _b;

return false;
const uncompressedReqBody = {
meta: {
nxCloudVersion: this.nxCloudVersion(),
},
tasks,
run: run,
machineInfo: this.machineInfo,
};
const uncompressedBuffer = Buffer.from(JSON.stringify(uncompressedReqBody));
let uncompressedBodyString = this.createReqBody(run, tasks);
// if the req body is > 20mb, remove hashDetails
if (uncompressedBodyString.length > 20 * 1000 * 1000) {
uncompressedBodyString = this.createReqBody(run, tasks.map((t) => (Object.assign(Object.assign({}, t), { hashDetails: undefined }))));
}
const uncompressedBuffer = Buffer.from(uncompressedBodyString);
const compressedBuffer = yield (0, util_1.promisify)(zlib_1.gzip)(uncompressedBuffer);

@@ -85,0 +93,0 @@ const recorder = (0, metric_logger_1.createMetricRecorder)('endRun');

@@ -23,2 +23,3 @@ "use strict";

const metric_logger_1 = require("../../../utilities/metric-logger");
const error_reporter_api_1 = require("../../api/error-reporter.api");
const { output, workspaceRoot, getDependencyConfigs, getOutputs, unparse, Cache, } = require('../../../utilities/nx-imports');

@@ -139,3 +140,4 @@ class NoopLifeCycle {

const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
const fileStorage = new file_storage_1.FileStorage(encryption);
const errorReporter = new error_reporter_api_1.ErrorReporterApi(options);
const fileStorage = new file_storage_1.FileStorage(encryption, errorReporter, true);
const cache = new Cache(options);

@@ -142,0 +144,0 @@ const api = new distributed_execution_api_1.DistributedExecutionApi(options);

{
"name": "nx-cloud",
"version": "14.0.4-beta.4",
"version": "14.0.5-beta.1",
"description": "Nx Cloud plugin for Nx",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc