From a9ab66d5eeadae77945d9b559a7eb7066470b331 Mon Sep 17 00:00:00 2001 From: crazy-max Date: Mon, 9 Mar 2020 14:24:46 +0000 Subject: [PATCH] Update node_modules --- node_modules/@actions/http-client/README.md | 8 +- node_modules/@actions/http-client/RELEASES.md | 13 + node_modules/@actions/http-client/index.d.ts | 18 + node_modules/@actions/http-client/index.js | 114 +++ .../@actions/http-client/interfaces.d.ts | 6 + .../node_modules/tunnel/.idea/encodings.xml | 6 - .../node_modules/tunnel/.idea/modules.xml | 8 - .../node_modules/tunnel/.idea/node-tunnel.iml | 12 - .../node_modules/tunnel/.idea/vcs.xml | 6 - .../node_modules/tunnel/.idea/workspace.xml | 797 ------------------ .../node_modules/tunnel/.travis.yml | 6 - .../node_modules/tunnel/CHANGELOG.md | 22 - .../http-client/node_modules/tunnel/LICENSE | 21 - .../http-client/node_modules/tunnel/README.md | 185 ---- .../http-client/node_modules/tunnel/index.js | 1 - .../node_modules/tunnel/lib/tunnel.js | 264 ------ .../node_modules/tunnel/package.json | 67 -- .../@actions/http-client/package.json | 20 +- node_modules/@actions/tool-cache/README.md | 6 +- .../@actions/tool-cache/lib/retry-helper.d.ts | 12 + .../@actions/tool-cache/lib/retry-helper.js | 67 ++ .../tool-cache/lib/retry-helper.js.map | 1 + .../@actions/tool-cache/lib/tool-cache.js | 107 ++- .../@actions/tool-cache/lib/tool-cache.js.map | 2 +- node_modules/@actions/tool-cache/package.json | 20 +- node_modules/tunnel/package.json | 1 + 26 files changed, 327 insertions(+), 1463 deletions(-) create mode 100644 node_modules/@actions/http-client/RELEASES.md delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/.idea/encodings.xml delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/.idea/modules.xml delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/.idea/node-tunnel.iml delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/.idea/vcs.xml delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/.idea/workspace.xml delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/.travis.yml delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/CHANGELOG.md delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/LICENSE delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/README.md delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/index.js delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/lib/tunnel.js delete mode 100644 node_modules/@actions/http-client/node_modules/tunnel/package.json create mode 100644 node_modules/@actions/tool-cache/lib/retry-helper.d.ts create mode 100644 node_modules/@actions/tool-cache/lib/retry-helper.js create mode 100644 node_modules/@actions/tool-cache/lib/retry-helper.js.map diff --git a/node_modules/@actions/http-client/README.md b/node_modules/@actions/http-client/README.md index 9ef52c2..be61eb3 100644 --- a/node_modules/@actions/http-client/README.md +++ b/node_modules/@actions/http-client/README.md @@ -18,6 +18,8 @@ A lightweight HTTP client optimized for use with actions, TypeScript with generi - Basic, Bearer and PAT Support out of the box. Extensible handlers for others. - Redirects supported +Features and releases [here](./RELEASES.md) + ## Install ``` @@ -49,7 +51,11 @@ export NODE_DEBUG=http ## Node support -The http-client is built using the latest LTS version of Node 12. We also support the latest LTS for Node 6, 8 and Node 10. +The http-client is built using the latest LTS version of Node 12. It may work on previous node LTS versions but it's tested and officially supported on Node12+. + +## Support and Versioning + +We follow semver and will hold compatibility between major versions and increment the minor version with new features and capabilities (while holding compat). ## Contributing diff --git a/node_modules/@actions/http-client/RELEASES.md b/node_modules/@actions/http-client/RELEASES.md new file mode 100644 index 0000000..c8040ed --- /dev/null +++ b/node_modules/@actions/http-client/RELEASES.md @@ -0,0 +1,13 @@ +## Releases + +## 1.0.6 +Automatically sends Content-Type and Accept application/json headers for \Json() helper methods if not set in the client or parameters. + +## 1.0.5 +Adds \Json() helper methods for json over http scenarios. + +## 1.0.4 +Started to add \Json() helper methods. Do not use this release for that. Use >= 1.0.5 since there was an issue with types. + +## 1.0.1 to 1.0.3 +Adds proxy support. \ No newline at end of file diff --git a/node_modules/@actions/http-client/index.d.ts b/node_modules/@actions/http-client/index.d.ts index ea3454d..2bbcc6a 100644 --- a/node_modules/@actions/http-client/index.d.ts +++ b/node_modules/@actions/http-client/index.d.ts @@ -29,6 +29,13 @@ export declare enum HttpCodes { ServiceUnavailable = 503, GatewayTimeout = 504 } +export declare enum Headers { + Accept = "accept", + ContentType = "content-type" +} +export declare enum MediaTypes { + ApplicationJson = "application/json" +} /** * Returns the proxy URL, depending upon the supplied url and proxy environment variables. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com @@ -64,6 +71,14 @@ export declare class HttpClient { put(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise; head(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise; sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: ifm.IHeaders): Promise; + /** + * Gets a typed object from an endpoint + * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise + */ + getJson(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise>; + postJson(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise>; + putJson(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise>; + patchJson(requestUrl: string, obj: any, additionalHeaders?: ifm.IHeaders): Promise>; /** * Makes a raw http request. * All other methods such as get, post, patch, and request ultimately call this. @@ -95,6 +110,9 @@ export declare class HttpClient { getAgent(serverUrl: string): http.Agent; private _prepareRequest; private _mergeHeaders; + private _getExistingOrDefaultHeader; private _getAgent; private _performExponentialBackoff; + private static dateTimeDeserializer; + private _processResponse; } diff --git a/node_modules/@actions/http-client/index.js b/node_modules/@actions/http-client/index.js index 631e16f..7e553a6 100644 --- a/node_modules/@actions/http-client/index.js +++ b/node_modules/@actions/http-client/index.js @@ -34,6 +34,15 @@ var HttpCodes; HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); +var Headers; +(function (Headers) { + Headers["Accept"] = "accept"; + Headers["ContentType"] = "content-type"; +})(Headers = exports.Headers || (exports.Headers = {})); +var MediaTypes; +(function (MediaTypes) { + MediaTypes["ApplicationJson"] = "application/json"; +})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); /** * Returns the proxy URL, depending upon the supplied url and proxy environment variables. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com @@ -132,6 +141,36 @@ class HttpClient { sendStream(verb, requestUrl, stream, additionalHeaders) { return this.request(verb, requestUrl, stream, additionalHeaders); } + /** + * Gets a typed object from an endpoint + * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise + */ + async getJson(requestUrl, additionalHeaders = {}) { + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + let res = await this.get(requestUrl, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async postJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.post(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async putJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.put(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async patchJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.patch(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } /** * Makes a raw http request. * All other methods such as get, post, patch, and request ultimately call this. @@ -315,6 +354,14 @@ class HttpClient { } return lowercaseKeys(headers || {}); } + _getExistingOrDefaultHeader(additionalHeaders, header, _default) { + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + let clientHeader; + if (this.requestOptions && this.requestOptions.headers) { + clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; + } + return additionalHeaders[header] || clientHeader || _default; + } _getAgent(parsedUrl) { let agent; let proxyUrl = pm.getProxyUrl(parsedUrl); @@ -382,5 +429,72 @@ class HttpClient { const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); return new Promise(resolve => setTimeout(() => resolve(), ms)); } + static dateTimeDeserializer(key, value) { + if (typeof value === 'string') { + let a = new Date(value); + if (!isNaN(a.valueOf())) { + return a; + } + } + return value; + } + async _processResponse(res, options) { + return new Promise(async (resolve, reject) => { + const statusCode = res.message.statusCode; + const response = { + statusCode: statusCode, + result: null, + headers: {} + }; + // not found leads to null obj returned + if (statusCode == HttpCodes.NotFound) { + resolve(response); + } + let obj; + let contents; + // get the result from the body + try { + contents = await res.readBody(); + if (contents && contents.length > 0) { + if (options && options.deserializeDates) { + obj = JSON.parse(contents, HttpClient.dateTimeDeserializer); + } + else { + obj = JSON.parse(contents); + } + response.result = obj; + } + response.headers = res.message.headers; + } + catch (err) { + // Invalid resource (contents not json); leaving result obj null + } + // note that 3xx redirects are handled by the http layer. + if (statusCode > 299) { + let msg; + // if exception/error in body, attempt to get better error + if (obj && obj.message) { + msg = obj.message; + } + else if (contents && contents.length > 0) { + // it may be the case that the exception is in the body message as string + msg = contents; + } + else { + msg = "Failed request: (" + statusCode + ")"; + } + let err = new Error(msg); + // attach statusCode and body obj (if available) to the error object + err['statusCode'] = statusCode; + if (response.result) { + err['result'] = response.result; + } + reject(err); + } + else { + resolve(response); + } + }); + } } exports.HttpClient = HttpClient; diff --git a/node_modules/@actions/http-client/interfaces.d.ts b/node_modules/@actions/http-client/interfaces.d.ts index 2e8822a..7e3fc3f 100644 --- a/node_modules/@actions/http-client/interfaces.d.ts +++ b/node_modules/@actions/http-client/interfaces.d.ts @@ -39,6 +39,12 @@ export interface IRequestOptions { maxRedirects?: number; maxSockets?: number; keepAlive?: boolean; + deserializeDates?: boolean; allowRetries?: boolean; maxRetries?: number; } +export interface ITypedResponse { + statusCode: number; + result: T | null; + headers: Object; +} diff --git a/node_modules/@actions/http-client/node_modules/tunnel/.idea/encodings.xml b/node_modules/@actions/http-client/node_modules/tunnel/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/node_modules/@actions/http-client/node_modules/tunnel/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/node_modules/@actions/http-client/node_modules/tunnel/.idea/modules.xml b/node_modules/@actions/http-client/node_modules/tunnel/.idea/modules.xml deleted file mode 100644 index 27bf888..0000000 --- a/node_modules/@actions/http-client/node_modules/tunnel/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/node_modules/@actions/http-client/node_modules/tunnel/.idea/node-tunnel.iml b/node_modules/@actions/http-client/node_modules/tunnel/.idea/node-tunnel.iml deleted file mode 100644 index 24643cc..0000000 --- a/node_modules/@actions/http-client/node_modules/tunnel/.idea/node-tunnel.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/@actions/http-client/node_modules/tunnel/.idea/vcs.xml b/node_modules/@actions/http-client/node_modules/tunnel/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/node_modules/@actions/http-client/node_modules/tunnel/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/node_modules/@actions/http-client/node_modules/tunnel/.idea/workspace.xml b/node_modules/@actions/http-client/node_modules/tunnel/.idea/workspace.xml deleted file mode 100644 index 1a318c8..0000000 --- a/node_modules/@actions/http-client/node_modules/tunnel/.idea/workspace.xml +++ /dev/null @@ -1,797 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - max - onconne - - - - - - - - - - - - - false - - false - false - true - - - true - DEFINITION_ORDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -