New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@actions/cache

Package Overview
Dependencies
Maintainers
5
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@actions/cache - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

LICENSE.md

0

lib/cache.d.ts

@@ -0,0 +0,0 @@ import { DownloadOptions, UploadOptions } from './options';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { CompressionMethod } from './constants';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -10,2 +10,4 @@ export declare enum CacheFilename {

}
export declare const DefaultRetryAttempts = 2;
export declare const DefaultRetryDelay = 5000;
export declare const SocketTimeout = 5000;

@@ -16,2 +16,6 @@ "use strict";

})(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {}));
// The default number of retry attempts.
exports.DefaultRetryAttempts = 2;
// The default delay in milliseconds between retry attempts.
exports.DefaultRetryDelay = 5000;
// Socket timeout in milliseconds during download. If no traffic is received

@@ -18,0 +22,0 @@ // over the socket during this period, the socket is destroyed and the download

@@ -0,0 +0,0 @@ import { TransferProgressEvent } from '@azure/ms-rest-js';

@@ -0,0 +0,0 @@ "use strict";

6

lib/internal/requestUtils.d.ts

@@ -5,4 +5,4 @@ import { IHttpClientResponse, ITypedResponse } from '@actions/http-client/interfaces';

export declare function isRetryableStatusCode(statusCode?: number): boolean;
export declare function retry<T>(name: string, method: () => Promise<T>, getStatusCode: (arg0: T) => number | undefined, maxAttempts?: number): Promise<T>;
export declare function retryTypedResponse<T>(name: string, method: () => Promise<ITypedResponse<T>>, maxAttempts?: number): Promise<ITypedResponse<T>>;
export declare function retryHttpClientResponse<T>(name: string, method: () => Promise<IHttpClientResponse>, maxAttempts?: number): Promise<IHttpClientResponse>;
export declare function retry<T>(name: string, method: () => Promise<T>, getStatusCode: (arg0: T) => number | undefined, maxAttempts?: number, delay?: number, onError?: ((arg0: Error) => T | undefined) | undefined): Promise<T>;
export declare function retryTypedResponse<T>(name: string, method: () => Promise<ITypedResponse<T>>, maxAttempts?: number, delay?: number): Promise<ITypedResponse<T>>;
export declare function retryHttpClientResponse<T>(name: string, method: () => Promise<IHttpClientResponse>, maxAttempts?: number, delay?: number): Promise<IHttpClientResponse>;

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

const http_client_1 = require("@actions/http-client");
const constants_1 = require("./constants");
function isSuccessStatusCode(statusCode) {

@@ -48,12 +49,26 @@ if (!statusCode) {

exports.isRetryableStatusCode = isRetryableStatusCode;
function retry(name, method, getStatusCode, maxAttempts = 2) {
function sleep(milliseconds) {
return __awaiter(this, void 0, void 0, function* () {
let response = undefined;
let statusCode = undefined;
let isRetryable = false;
return new Promise(resolve => setTimeout(resolve, milliseconds));
});
}
function retry(name, method, getStatusCode, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay, onError = undefined) {
return __awaiter(this, void 0, void 0, function* () {
let errorMessage = '';
let attempt = 1;
while (attempt <= maxAttempts) {
let response = undefined;
let statusCode = undefined;
let isRetryable = false;
try {
response = yield method();
}
catch (error) {
if (onError) {
response = onError(error);
}
isRetryable = true;
errorMessage = error.message;
}
if (response) {
statusCode = getStatusCode(response);

@@ -63,9 +78,7 @@ if (!isServerErrorStatusCode(statusCode)) {

}
}
if (statusCode) {
isRetryable = isRetryableStatusCode(statusCode);
errorMessage = `Cache service responded with ${statusCode}`;
}
catch (error) {
isRetryable = true;
errorMessage = error.message;
}
core.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`);

@@ -76,2 +89,3 @@ if (!isRetryable) {

}
yield sleep(delay);
attempt++;

@@ -83,11 +97,25 @@ }

exports.retry = retry;
function retryTypedResponse(name, method, maxAttempts = 2) {
function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay) {
return __awaiter(this, void 0, void 0, function* () {
return yield retry(name, method, (response) => response.statusCode, maxAttempts);
return yield retry(name, method, (response) => response.statusCode, maxAttempts, delay,
// If the error object contains the statusCode property, extract it and return
// an ITypedResponse<T> so it can be processed by the retry logic.
(error) => {
if (error instanceof http_client_1.HttpClientError) {
return {
statusCode: error.statusCode,
result: null,
headers: {}
};
}
else {
return undefined;
}
});
});
}
exports.retryTypedResponse = retryTypedResponse;
function retryHttpClientResponse(name, method, maxAttempts = 2) {
function retryHttpClientResponse(name, method, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay) {
return __awaiter(this, void 0, void 0, function* () {
return yield retry(name, method, (response) => response.message.statusCode, maxAttempts);
return yield retry(name, method, (response) => response.message.statusCode, maxAttempts, delay);
});

@@ -94,0 +122,0 @@ }

import { CompressionMethod } from './constants';
export declare function extractTar(archivePath: string, compressionMethod: CompressionMethod): Promise<void>;
export declare function createTar(archiveFolder: string, sourceDirectories: string[], compressionMethod: CompressionMethod): Promise<void>;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ "use strict";

{
"name": "@actions/cache",
"version": "1.0.2",
"version": "1.0.3",
"preview": true,

@@ -43,3 +43,3 @@ "description": "Actions cache lib",

"@actions/glob": "^0.1.0",
"@actions/http-client": "^1.0.8",
"@actions/http-client": "^1.0.9",
"@actions/io": "^1.0.1",

@@ -46,0 +46,0 @@ "@azure/ms-rest-js": "^2.0.7",

@@ -0,0 +0,0 @@ # `@actions/cache`

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