Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -4,6 +4,127 @@
[1]: https://www.npmjs.com/package/gcp-metadata?activeTab=versions
### [4.2.1](https://www.github.com/googleapis/gcp-metadata/compare/v4.2.0...v4.2.1) (2020-10-29)
### Bug Fixes
* **deps:** update dependency gaxios to v4 ([#420](https://www.github.com/googleapis/gcp-metadata/issues/420)) ([b99fb07](https://www.github.com/googleapis/gcp-metadata/commit/b99fb0764b8dbb8b083f73b8007816914db4f09a))
## [4.2.0](https://www.github.com/googleapis/gcp-metadata/compare/v4.1.4...v4.2.0) (2020-09-15)
### Features
* add support for GCE_METADATA_HOST environment variable ([#406](https://www.github.com/googleapis/gcp-metadata/issues/406)) ([eaf128a](https://www.github.com/googleapis/gcp-metadata/commit/eaf128ad5afc4357cde72d19b017b9474c070fea))
### [4.1.4](https://www.github.com/googleapis/gcp-metadata/compare/v4.1.3...v4.1.4) (2020-07-15)
### Bug Fixes
* **deps:** update dependency json-bigint to v1 ([#382](https://www.github.com/googleapis/gcp-metadata/issues/382)) ([ab4d8c3](https://www.github.com/googleapis/gcp-metadata/commit/ab4d8c3022903206d433bafc47c27815c6f85e36))
### [4.1.3](https://www.github.com/googleapis/gcp-metadata/compare/v4.1.2...v4.1.3) (2020-07-13)
### Bug Fixes
* **deps:** update dependency json-bigint to ^0.4.0 ([#378](https://www.github.com/googleapis/gcp-metadata/issues/378)) ([b214280](https://www.github.com/googleapis/gcp-metadata/commit/b2142807928c8c032509277900d35fccd1023f0f))
### [4.1.2](https://www.github.com/googleapis/gcp-metadata/compare/v4.1.1...v4.1.2) (2020-07-10)
### Bug Fixes
* **deps:** roll back dependency gcp-metadata to ^4.1.0 ([#373](https://www.github.com/googleapis/gcp-metadata/issues/373)) ([a45adef](https://www.github.com/googleapis/gcp-metadata/commit/a45adefd92418faa08c8a5014cedb844d1eb3ae6))
### [4.1.1](https://www.github.com/googleapis/gcp-metadata/compare/v4.1.0...v4.1.1) (2020-07-09)
### Bug Fixes
* typeo in nodejs .gitattribute ([#371](https://www.github.com/googleapis/gcp-metadata/issues/371)) ([5b4bb1c](https://www.github.com/googleapis/gcp-metadata/commit/5b4bb1c85e67e3ef0a6d1ec2ea316d560e03092f))
## [4.1.0](https://www.github.com/googleapis/gcp-metadata/compare/v4.0.1...v4.1.0) (2020-05-05)
### Features
* Introduces the GCE_METADATA_IP to allow using a different IP address for the GCE metadata server. ([#346](https://www.github.com/googleapis/gcp-metadata/issues/346)) ([ec0f82d](https://www.github.com/googleapis/gcp-metadata/commit/ec0f82d022b4b3aac95e94ee1d8e53cfac3b14a4))
### Bug Fixes
* do not check secondary host if GCE_METADATA_IP set ([#352](https://www.github.com/googleapis/gcp-metadata/issues/352)) ([64fa7d6](https://www.github.com/googleapis/gcp-metadata/commit/64fa7d68cbb76f455a3bfdcb27d58e7775eb789a))
* warn rather than throwing when we fail to connect to metadata server ([#351](https://www.github.com/googleapis/gcp-metadata/issues/351)) ([754a6c0](https://www.github.com/googleapis/gcp-metadata/commit/754a6c07d1a72615cbb5ebf9ee04475a9a12f1c0))
### [4.0.1](https://www.github.com/googleapis/gcp-metadata/compare/v4.0.0...v4.0.1) (2020-04-14)
### Bug Fixes
* **deps:** update dependency gaxios to v3 ([#326](https://www.github.com/googleapis/gcp-metadata/issues/326)) ([5667178](https://www.github.com/googleapis/gcp-metadata/commit/5667178429baff71ad5dab2a96f97f27b2106d57))
* apache license URL ([#468](https://www.github.com/googleapis/gcp-metadata/issues/468)) ([#336](https://www.github.com/googleapis/gcp-metadata/issues/336)) ([195dcd2](https://www.github.com/googleapis/gcp-metadata/commit/195dcd2d227ba496949e7ec0dcd77e5b9269066c))
## [4.0.0](https://www.github.com/googleapis/gcp-metadata/compare/v3.5.0...v4.0.0) (2020-03-19)
### ⚠ BREAKING CHANGES
* typescript@3.7.x has breaking changes; compiler now targets es2015
* drops Node 8 from engines field (#315)
### Features
* drops Node 8 from engines field ([#315](https://www.github.com/googleapis/gcp-metadata/issues/315)) ([acb6233](https://www.github.com/googleapis/gcp-metadata/commit/acb62337e8ba7f0b259ae4e553f19c5786207d84))
### Build System
* switch to latest typescirpt/gts ([#317](https://www.github.com/googleapis/gcp-metadata/issues/317)) ([fbb7158](https://www.github.com/googleapis/gcp-metadata/commit/fbb7158be62c9f1949b69079e35113be1e10495c))
## [3.5.0](https://www.github.com/googleapis/gcp-metadata/compare/v3.4.0...v3.5.0) (2020-03-03)
### Features
* add ECONNREFUSED to list of known errors for isAvailable() ([#309](https://www.github.com/googleapis/gcp-metadata/issues/309)) ([17ff6ea](https://www.github.com/googleapis/gcp-metadata/commit/17ff6ea361d02de31463532d4ab4040bf6276e0b))
## [3.4.0](https://www.github.com/googleapis/gcp-metadata/compare/v3.3.1...v3.4.0) (2020-02-24)
### Features
* significantly increase timeout if GCF environment detected ([#300](https://www.github.com/googleapis/gcp-metadata/issues/300)) ([8e507c6](https://www.github.com/googleapis/gcp-metadata/commit/8e507c645f69a11f508884b3181dc4414e579fcc))
### [3.3.1](https://www.github.com/googleapis/gcp-metadata/compare/v3.3.0...v3.3.1) (2020-01-30)
### Bug Fixes
* **isAvailable:** handle EHOSTDOWN and EHOSTUNREACH error codes ([#291](https://www.github.com/googleapis/gcp-metadata/issues/291)) ([ba8d9f5](https://www.github.com/googleapis/gcp-metadata/commit/ba8d9f50eac6cf8b439c1b66c48ace146c75f6e2))
## [3.3.0](https://www.github.com/googleapis/gcp-metadata/compare/v3.2.3...v3.3.0) (2019-12-16)
### Features
* add environment variable for configuring environment detection ([#275](https://www.github.com/googleapis/gcp-metadata/issues/275)) ([580cfa4](https://www.github.com/googleapis/gcp-metadata/commit/580cfa4a5f5d0041aa09ae85cfc5a4575dd3957f))
* cache response from isAvailable() method ([#274](https://www.github.com/googleapis/gcp-metadata/issues/274)) ([a05e13f](https://www.github.com/googleapis/gcp-metadata/commit/a05e13f1d1d61b1f9b9b1703bc37cdbdc022c93b))
### Bug Fixes
* fastFailMetadataRequest should not reject, if response already happened ([#273](https://www.github.com/googleapis/gcp-metadata/issues/273)) ([a6590c4](https://www.github.com/googleapis/gcp-metadata/commit/a6590c4fd8bc2dff3995c83d4c9175d5bd9f5e4a))
### [3.2.3](https://www.github.com/googleapis/gcp-metadata/compare/v3.2.2...v3.2.3) (2019-12-12)
### Bug Fixes
* **deps:** pin TypeScript below 3.7.0 ([e4bf622](https://www.github.com/googleapis/gcp-metadata/commit/e4bf622e6654a51ddffc0921a15250130591db2f))
### [3.2.2](https://www.github.com/googleapis/gcp-metadata/compare/v3.2.1...v3.2.2) (2019-11-13)

23
node_modules/gcp-metadata/README.md generated vendored
View File

@@ -25,7 +25,15 @@ console.log(data); // ... All metadata properties
#### Access specific properties
```js
const data = await gcpMetadata.instance('hostname');
console.log(data) // ...Instance hostname
console.log(data); // ...Instance hostname
const projectId = await gcpMetadata.project('project-id');
console.log(projectId); // ...Project ID of the running instance
```
#### Access nested properties with the relative path
```js
const data = await gcpMetadata.instance('service-accounts/default/email');
console.log(data); // ...Email address of the Compute identity service account
```
#### Access specific properties with query parameters
@@ -62,4 +70,15 @@ console.log(id.toString()) // ... 4520031799277581759
[codecov-image]: https://codecov.io/gh/googleapis/gcp-metadata/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/googleapis/gcp-metadata
[npm-image]: https://img.shields.io/npm/v/gcp-metadata.svg
[npm-url]: https://www.npmjs.com/package/gcp-metadata
[npm-url]: https://www.npmjs.com/package/gcp-metadata
### Environment variables
* GCE_METADATA_HOST: provide an alternate host or IP to perform lookup against (useful, for example, you're connecting through a custom proxy server).
For example:
```
export GCE_METADATA_HOST = '169.254.169.254'
```
* DETECT_GCP_RETRIES: number representing number of retries that should be attempted on metadata lookup.

View File

@@ -6,15 +6,13 @@
*/
/// <reference types="node" />
import { OutgoingHttpHeaders } from 'http';
export declare const HOST_ADDRESS = "http://169.254.169.254";
export declare const BASE_PATH = "/computeMetadata/v1";
export declare const BASE_URL: string;
export declare const HOST_ADDRESS = "http://169.254.169.254";
export declare const SECONDARY_HOST_ADDRESS = "http://metadata.google.internal.";
export declare const SECONDARY_BASE_URL: string;
export declare const HEADER_NAME = "Metadata-Flavor";
export declare const HEADER_VALUE = "Google";
export declare const HEADERS: Readonly<{
[HEADER_NAME]: string;
"Metadata-Flavor": string;
}>;
export interface Options {
params?: {
@@ -25,7 +23,9 @@ export interface Options {
}
export declare function instance<T = any>(options?: string | Options): Promise<T>;
export declare function project<T = any>(options?: string | Options): Promise<T>;
/**
* Determine if the metadata server is currently available.
*/
export declare function isAvailable(): Promise<boolean>;
/**
* reset the memoized isAvailable() lookup.
*/
export declare function resetIsAvailableCache(): void;
export declare function requestTimeout(): number;

View File

@@ -6,16 +6,34 @@
* See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.requestTimeout = exports.resetIsAvailableCache = exports.isAvailable = exports.project = exports.instance = exports.HEADERS = exports.HEADER_VALUE = exports.HEADER_NAME = exports.SECONDARY_HOST_ADDRESS = exports.HOST_ADDRESS = exports.BASE_PATH = void 0;
const gaxios_1 = require("gaxios");
const jsonBigint = require('json-bigint');
exports.HOST_ADDRESS = 'http://169.254.169.254';
const jsonBigint = require('json-bigint'); // eslint-disable-line
exports.BASE_PATH = '/computeMetadata/v1';
exports.BASE_URL = exports.HOST_ADDRESS + exports.BASE_PATH;
exports.HOST_ADDRESS = 'http://169.254.169.254';
exports.SECONDARY_HOST_ADDRESS = 'http://metadata.google.internal.';
exports.SECONDARY_BASE_URL = exports.SECONDARY_HOST_ADDRESS + exports.BASE_PATH;
exports.HEADER_NAME = 'Metadata-Flavor';
exports.HEADER_VALUE = 'Google';
exports.HEADERS = Object.freeze({ [exports.HEADER_NAME]: exports.HEADER_VALUE });
/**
* Returns the base URL while taking into account the GCE_METADATA_HOST
* environment variable if it exists.
*
* @returns The base URL, e.g., http://169.254.169.254/computeMetadata/v1.
*/
function getBaseUrl(baseUrl) {
if (!baseUrl) {
baseUrl =
process.env.GCE_METADATA_IP ||
process.env.GCE_METADATA_HOST ||
exports.HOST_ADDRESS;
}
// If no scheme is provided default to HTTP:
if (!/^https?:\/\//.test(baseUrl)) {
baseUrl = `http://${baseUrl}`;
}
return new URL(exports.BASE_PATH, baseUrl).href;
}
// Accepts an options object passed from the user to the API. In previous
// versions of the API, it referred to a `Request` or an `Axios` request
// options object. Now it refers to an object with very limited property
@@ -29,7 +47,7 @@ function validate(options) {
case 'headers':
break;
case 'qs':
throw new Error(`'qs' is not a valid configuration option. Please use 'params' instead.`);
throw new Error("'qs' is not a valid configuration option. Please use 'params' instead.");
default:
throw new Error(`'${key}' is not a valid configuration option.`);
}
@@ -48,12 +66,12 @@ async function metadataAccessor(type, options, noResponseRetries = 3, fastFail =
try {
const requestMethod = fastFail ? fastFailMetadataRequest : gaxios_1.request;
const res = await requestMethod({
url: `${exports.BASE_URL}/${type}${property}`,
url: `${getBaseUrl()}/${type}${property}`,
headers: Object.assign({}, exports.HEADERS, options.headers),
retryConfig: { noResponseRetries },
params: options.params,
responseType: 'text',
timeout: 3000,
timeout: requestTimeout(),
});
// NOTE: node.js converts all incoming headers to lower case.
if (res.headers[exports.HEADER_NAME.toLowerCase()] !== exports.HEADER_VALUE) {
@@ -80,28 +98,92 @@ async function metadataAccessor(type, options, noResponseRetries = 3, fastFail =
}
}
async function fastFailMetadataRequest(options) {
const secondaryOptions = Object.assign(Object.assign({}, options), { url: options.url.replace(exports.BASE_URL, exports.SECONDARY_BASE_URL) });
return Promise.race([gaxios_1.request(options), gaxios_1.request(secondaryOptions)]);
const secondaryOptions = {
...options,
url: options.url.replace(getBaseUrl(), getBaseUrl(exports.SECONDARY_HOST_ADDRESS)),
};
// We race a connection between DNS/IP to metadata server. There are a couple
// reasons for this:
//
// 1. the DNS is slow in some GCP environments; by checking both, we might
// detect the runtime environment signficantly faster.
// 2. we can't just check the IP, which is tarpitted and slow to respond
// on a user's local machine.
//
// Additional logic has been added to make sure that we don't create an
// unhandled rejection in scenarios where a failure happens sometime
// after a success.
//
// Note, however, if a failure happens prior to a success, a rejection should
// occur, this is for folks running locally.
//
let responded = false;
const r1 = gaxios_1.request(options)
.then(res => {
responded = true;
return res;
})
.catch(err => {
if (responded) {
return r2;
}
else {
responded = true;
throw err;
}
});
const r2 = gaxios_1.request(secondaryOptions)
.then(res => {
responded = true;
return res;
})
.catch(err => {
if (responded) {
return r1;
}
else {
responded = true;
throw err;
}
});
return Promise.race([r1, r2]);
}
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function instance(options) {
return metadataAccessor('instance', options);
}
exports.instance = instance;
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function project(options) {
return metadataAccessor('project', options);
}
exports.project = project;
/*
* How many times should we retry detecting GCP environment.
*/
function detectGCPAvailableRetries() {
return process.env.DETECT_GCP_RETRIES
? Number(process.env.DETECT_GCP_RETRIES)
: 0;
}
/**
* Determine if the metadata server is currently available.
*/
let cachedIsAvailableResponse;
async function isAvailable() {
try {
// Attempt to read instance metadata. As configured, this will
// retry 3 times if there is a valid response, and fail fast
// if there is an ETIMEDOUT or ENOTFOUND error.
await metadataAccessor('instance', undefined, 0, true);
// If a user is instantiating several GCP libraries at the same time,
// this may result in multiple calls to isAvailable(), to detect the
// runtime environment. We use the same promise for each of these calls
// to reduce the network load.
if (cachedIsAvailableResponse === undefined) {
cachedIsAvailableResponse = metadataAccessor('instance', undefined, detectGCPAvailableRetries(),
// If the default HOST_ADDRESS has been overridden, we should not
// make an effort to try SECONDARY_HOST_ADDRESS (as we are likely in
// a non-GCP environment):
!(process.env.GCE_METADATA_IP || process.env.GCE_METADATA_HOST));
}
await cachedIsAvailableResponse;
return true;
}
catch (err) {
@@ -113,16 +195,52 @@ async function isAvailable() {
// within ms.
return false;
}
else if (err.code &&
(err.code === 'ENOTFOUND' ||
err.code === 'ENOENT' ||
err.code === 'ENETUNREACH')) {
if (err.response && err.response.status === 404) {
return false;
}
else {
if (!(err.response && err.response.status === 404) &&
// A warning is emitted if we see an unexpected err.code, or err.code
// is not populated:
(!err.code ||
![
'EHOSTDOWN',
'EHOSTUNREACH',
'ENETUNREACH',
'ENOENT',
'ENOTFOUND',
'ECONNREFUSED',
].includes(err.code))) {
let code = 'UNKNOWN';
if (err.code)
code = err.code;
process.emitWarning(`received unexpected error = ${err.message} code = ${code}`, 'MetadataLookupWarning');
}
// Failure to resolve the metadata service means that it is not available.
return false;
}
// Throw unexpected errors.
throw err;
}
}
exports.isAvailable = isAvailable;
/**
* reset the memoized isAvailable() lookup.
*/
function resetIsAvailableCache() {
cachedIsAvailableResponse = undefined;
}
exports.resetIsAvailableCache = resetIsAvailableCache;
function requestTimeout() {
// In testing, we were able to reproduce behavior similar to
// https://github.com/googleapis/google-auth-library-nodejs/issues/798
// by making many concurrent network requests. Requests do not actually fail,
// rather they take significantly longer to complete (and we hit our
// default 3000ms timeout).
//
// This logic detects a GCF environment, using the documented environment
// variables K_SERVICE and FUNCTION_NAME:
// https://cloud.google.com/functions/docs/env-var and, in a GCF environment
// eliminates timeouts (by setting the value to 0 to disable).
return process.env.K_SERVICE || process.env.FUNCTION_NAME ? 0 : 3000;
}
exports.requestTimeout = requestTimeout;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,27 +1,27 @@
{
"_from": "gcp-metadata@^3.2.0",
"_id": "gcp-metadata@3.2.2",
"_from": "gcp-metadata@^4.2.0",
"_id": "gcp-metadata@4.2.1",
"_inBundle": false,
"_integrity": "sha512-vR7kcJMCYJG/mYWp/a1OszdOqnLB/XW1GorWW1hc1lWVNL26L497zypWb9cG0CYDQ4Bl1Wk0+fSZFFjwJlTQgQ==",
"_integrity": "sha512-tSk+REe5iq/N+K+SK1XjZJUrFPuDqGZVzCy2vocIHIGmPlTGsa8owXMJwGkrXr73NO0AzhPW4MF2DEHz7P2AVw==",
"_location": "/gcp-metadata",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "gcp-metadata@^3.2.0",
"raw": "gcp-metadata@^4.2.0",
"name": "gcp-metadata",
"escapedName": "gcp-metadata",
"rawSpec": "^3.2.0",
"rawSpec": "^4.2.0",
"saveSpec": null,
"fetchSpec": "^3.2.0"
"fetchSpec": "^4.2.0"
},
"_requiredBy": [
"/google-auth-library"
],
"_resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-3.2.2.tgz",
"_shasum": "dcac6bf65775d5caa3a2e161469c0af068849256",
"_spec": "gcp-metadata@^3.2.0",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/google-auth-library",
"_resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.2.1.tgz",
"_shasum": "31849fbcf9025ef34c2297c32a89a1e7e9f2cd62",
"_spec": "gcp-metadata@^4.2.0",
"_where": "/home/codespace/workspace/upload-google-play/node_modules/google-auth-library",
"author": {
"name": "Stephen Sawchuk"
},
@@ -30,41 +30,37 @@
},
"bundleDependencies": false,
"dependencies": {
"gaxios": "^2.1.0",
"json-bigint": "^0.3.0"
"gaxios": "^4.0.0",
"json-bigint": "^1.0.0"
},
"deprecated": false,
"description": "Get the metadata from a Google Cloud Platform environment",
"devDependencies": {
"@compodoc/compodoc": "^1.1.10",
"@types/mocha": "^5.2.7",
"@microsoft/api-documenter": "^7.8.10",
"@microsoft/api-extractor": "^7.8.10",
"@types/mocha": "^8.0.0",
"@types/ncp": "^2.0.1",
"@types/nock": "^10.0.3",
"@types/node": "^12.7.2",
"@types/tmp": "0.1.0",
"@types/uuid": "^3.4.5",
"assert-rejects": "^1.0.0",
"c8": "^6.0.0",
"@types/tmp": "0.2.0",
"@types/uuid": "^8.0.0",
"c8": "^7.0.0",
"codecov": "^3.5.0",
"eslint": "^6.1.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-prettier": "^3.1.0",
"gcbuild": "^1.3.4",
"gcx": "^0.2.4",
"googleapis": "^45.0.0",
"gts": "^1.1.0",
"linkinator": "^1.5.0",
"mocha": "^6.2.0",
"gcx": "^1.0.0",
"googleapis": "^61.0.0",
"gts": "^3.0.0",
"linkinator": "^2.0.0",
"mocha": "^8.0.0",
"ncp": "^2.0.0",
"nock": "^11.0.0",
"prettier": "^1.18.2",
"source-map-support": "^0.5.13",
"typescript": "^3.5.3",
"uuid": "^3.3.2"
"nock": "^13.0.0",
"tmp": "^0.2.0",
"typescript": "^3.8.3",
"uuid": "^8.0.0"
},
"engines": {
"node": ">=8.10.0"
"node": ">=10"
},
"files": [
"build/src"
@@ -87,13 +83,17 @@
"url": "git+https://github.com/googleapis/gcp-metadata.git"
},
"scripts": {
"api-documenter": "api-documenter yaml --input-folder=temp",
"api-extractor": "api-extractor run --local",
"clean": "gts clean",
"compile": "tsc -p .",
"docs": "compodoc src/",
"docs-test": "linkinator docs",
"fix": "gts fix && eslint --fix '**/*.js'",
"lint": "gts check && eslint '**/*.js'",
"fix": "gts fix",
"lint": "gts check",
"precompile": "gts clean",
"predocs-test": "npm run docs",
"prelint": "cd samples; npm link ../; npm install",
"prepare": "npm run compile",
"presystem-test": "npm run compile",
"pretest": "npm run compile",
@@ -102,5 +102,5 @@
"test": "c8 mocha --timeout=5000 build/test"
},
"types": "./build/src/index.d.ts",
"version": "3.2.2"
"version": "4.2.1"
}