Socket
Socket
Sign inDemoInstall

@google-cloud/common

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/common - npm Package Compare versions

Comparing version 2.4.0 to 3.0.0

15

build/src/index.d.ts

@@ -1,16 +0,1 @@

/*!
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { GoogleAuthOptions } from 'google-auth-library';

@@ -17,0 +2,0 @@ /**

28

build/src/index.js
"use strict";
/*!
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });

@@ -18,0 +16,0 @@ /**

/*!
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*!
* @module common/operation

@@ -37,3 +22,3 @@ */

*
* @return {promise}
* @return {Promise}
*/

@@ -40,0 +25,0 @@ promise(): Promise<unknown>;

"use strict";
/*!
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });

@@ -23,3 +21,3 @@ /*!

const util_1 = require("util");
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
class Operation extends service_object_1.ServiceObject {

@@ -58,3 +56,3 @@ /**

}, config);
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
config.methods = (config.methods || methods);

@@ -69,6 +67,6 @@ super(config);

*
* @return {promise}
* @return {Promise}
*/
promise() {
return new this.Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
this.on('error', reject).on('complete', (metadata) => {

@@ -75,0 +73,0 @@ resolve([metadata]);

@@ -1,16 +0,1 @@

/*!
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <reference types="node" />

@@ -22,3 +7,2 @@ import { EventEmitter } from 'events';

export interface ServiceObjectParent {
Promise?: PromiseConstructor;
requestStream(reqOpts: DecorateRequestOptions): r.Request;

@@ -118,3 +102,2 @@ request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;

protected interceptors: Interceptor[];
Promise?: PromiseConstructor;
constructor(config: ServiceObjectConfig);

@@ -121,0 +104,0 @@ /**

"use strict";
/*!
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2015 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });

@@ -37,3 +35,3 @@ /*!

*/
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
class ServiceObject extends events_1.EventEmitter {

@@ -68,3 +66,2 @@ /*

this.pollIntervalMs = config.pollIntervalMs;
this.Promise = this.parent ? this.parent.Promise : undefined;
if (config.methods) {

@@ -79,5 +76,5 @@ Object.getOwnPropertyNames(ServiceObject.prototype)

// The ServiceObject didn't redefine the method.
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this[methodName] ===
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ServiceObject.prototype[methodName] &&

@@ -88,3 +85,3 @@ // This method isn't wanted.

.forEach(methodName => {
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this[methodName] = undefined;

@@ -95,2 +92,3 @@ });

create(optionsOrCallback, callback) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;

@@ -116,2 +114,3 @@ const args = [this.id];

args.push(onCreate);
// eslint-disable-next-line prefer-spread
this.createMethod.apply(null, args);

@@ -148,2 +147,3 @@ }

get(optionsOrCallback, cb) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;

@@ -150,0 +150,0 @@ const [opts, callback] = util_1.util.maybeOptionsOrCallback(optionsOrCallback, cb);

@@ -1,16 +0,1 @@

/*!
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { GoogleAuth, GoogleAuthOptions } from 'google-auth-library';

@@ -46,3 +31,2 @@ import * as r from 'teeny-request';

interceptors_?: Interceptor[];
promise?: PromiseConstructor;
email?: string;

@@ -59,3 +43,2 @@ token?: string;

private projectIdRequired;
Promise: PromiseConstructor;
makeAuthenticatedRequest: MakeAuthenticatedRequest;

@@ -62,0 +45,0 @@ authClient: GoogleAuth;

"use strict";
/*!
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2015 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });

@@ -50,3 +48,2 @@ /*!

this.projectIdRequired = config.projectIdRequired !== false;
this.Promise = options.promise || Promise;
const reqCfg = extend({}, config, {

@@ -53,0 +50,0 @@ projectIdRequired: this.projectIdRequired,

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

const teeny_request_1 = require("teeny-request");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const duplexify = require('duplexify');

@@ -214,3 +215,4 @@ const requestDefaults = {

onComplete = onComplete || util.noop;
const writeStream = new stream_1.PassThrough();
const writeStream = new ProgressStream();
writeStream.on('progress', evt => dup.emit('progress', evt));
dup.setWritable(writeStream);

@@ -329,3 +331,3 @@ const defaultReqOpts = {

if (!err || autoAuthFailed) {
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let projectId = authClient._cachedProjectId;

@@ -439,3 +441,3 @@ if (config.projectId && config.projectId !== '{{projectId}}') {

const dup = config.stream;
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let requestStream;

@@ -489,3 +491,3 @@ const isGetRequest = (reqOpts.method || 'GET').toUpperCase() === 'GET';

}
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
isCustomType(unknown, module) {

@@ -502,2 +504,3 @@ function getConstructorName(obj) {

let walkingModule = unknown;
// eslint-disable-next-line no-constant-condition
while (true) {

@@ -539,4 +542,21 @@ if (getConstructorName(walkingModule) === parentModuleName) {

exports.Util = Util;
/**
* Basic Passthrough Stream that records the number of bytes read
* every time the cursor is moved.
*/
class ProgressStream extends stream_1.Transform {
constructor() {
super(...arguments);
this.bytesRead = 0;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
_transform(chunk, encoding, callback) {
this.bytesRead += chunk.length;
this.emit('progress', { bytesWritten: this.bytesRead, contentLength: '*' });
this.push(chunk);
callback();
}
}
const util = new Util();
exports.util = util;
//# sourceMappingURL=util.js.map

@@ -7,2 +7,26 @@ # Changelog

## [3.0.0](https://www.github.com/googleapis/nodejs-common/compare/v2.4.0...v3.0.0) (2020-03-26)
### ⚠ BREAKING CHANGES
* drop support for node.js 8 (#554)
* remove support for custom promises (#541)
### Features
* add progress events ([#540](https://www.github.com/googleapis/nodejs-common/issues/540)) ([1834059](https://www.github.com/googleapis/nodejs-common/commit/18340596ecb61018e5427371b9b5a120753ec003))
### Bug Fixes
* remove support for custom promises ([#541](https://www.github.com/googleapis/nodejs-common/issues/541)) ([ecf1c16](https://www.github.com/googleapis/nodejs-common/commit/ecf1c167927b609f13dc4fbec1954ff3a2765344))
* **deps:** update dependency @google-cloud/projectify to v2 ([#553](https://www.github.com/googleapis/nodejs-common/issues/553)) ([23030a2](https://www.github.com/googleapis/nodejs-common/commit/23030a25783cd091f4720c25a15416c91e7bd0a0))
* **deps:** update dependency @google-cloud/promisify to v2 ([#552](https://www.github.com/googleapis/nodejs-common/issues/552)) ([63175e0](https://www.github.com/googleapis/nodejs-common/commit/63175e0c4504020466a95e92c2449bdb8ac47546))
### Miscellaneous Chores
* drop support for node.js 8 ([#554](https://www.github.com/googleapis/nodejs-common/issues/554)) ([9f41047](https://www.github.com/googleapis/nodejs-common/commit/9f410477432893f68e57b5eeb31a068a3d8ef52f))
## [2.4.0](https://www.github.com/googleapis/nodejs-common/compare/v2.3.0...v2.4.0) (2020-02-25)

@@ -9,0 +33,0 @@

{
"name": "@google-cloud/common",
"description": "Common components for Cloud APIs Node.js Client Libraries",
"version": "2.4.0",
"version": "3.0.0",
"license": "Apache-2.0",
"author": "Google Inc.",
"engines": {
"node": ">=8.10.0"
"node": ">=10"
},

@@ -20,6 +20,4 @@ "repository": "googleapis/nodejs-common",

"test": "c8 mocha build/test",
"posttest": "npm run lint && npm run license-check",
"prepare": "npm run compile",
"pretest": "npm run compile",
"license-check": "jsgl --local .",
"compile": "tsc -p .",

@@ -35,39 +33,37 @@ "fix": "gts fix",

"dependencies": {
"@google-cloud/projectify": "^1.0.0",
"@google-cloud/promisify": "^1.0.0",
"arrify": "^2.0.0",
"duplexify": "^3.6.0",
"@google-cloud/projectify": "^2.0.0",
"@google-cloud/promisify": "^2.0.0",
"arrify": "^2.0.1",
"duplexify": "^4.1.1",
"ent": "^2.2.0",
"extend": "^3.0.2",
"google-auth-library": "^5.5.0",
"retry-request": "^4.0.0",
"teeny-request": "^6.0.0"
"google-auth-library": "^5.10.1",
"retry-request": "^4.1.1",
"teeny-request": "^6.0.3"
},
"devDependencies": {
"@compodoc/compodoc": "^1.1.9",
"@compodoc/compodoc": "^1.1.11",
"@types/ent": "^2.2.1",
"@types/extend": "^3.0.1",
"@types/mocha": "^7.0.0",
"@types/mocha": "^7.0.2",
"@types/mv": "^2.1.0",
"@types/ncp": "^2.0.1",
"@types/node": "^11.13.0",
"@types/ncp": "^2.0.3",
"@types/node": "^12.12.31",
"@types/proxyquire": "^1.3.28",
"@types/request": "^2.48.1",
"@types/sinon": "^7.0.10",
"@types/request": "^2.48.4",
"@types/sinon": "^7.5.2",
"@types/tmp": "0.1.0",
"codecov": "^3.2.0",
"gts": "^1.0.0",
"ink-docstrap": "^1.3.2",
"js-green-licenses": "^1.0.0",
"linkinator": "^2.0.0",
"mocha": "^7.0.0",
"c8": "^7.1.0",
"codecov": "^3.6.5",
"gts": "^2.0.0-alpha.6",
"linkinator": "^2.0.4",
"mocha": "^7.1.1",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"nock": "^12.0.0",
"c8": "^7.0.0",
"proxyquire": "^2.1.0",
"sinon": "^9.0.0",
"nock": "^12.0.3",
"proxyquire": "^2.1.3",
"sinon": "^9.0.1",
"tmp": "0.1.0",
"typescript": "3.6.4"
"typescript": "~3.8.3"
}
}

@@ -54,2 +54,23 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost."

## Supported Node.js Versions
Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
Libraries are compatible with all current _active_ and _maintenance_ versions of
Node.js.
Client libraries targetting some end-of-life versions of Node.js are available, and
can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
The dist-tags follow the naming convention `legacy-(version)`.
_Legacy Node.js versions are supported as a best effort:_
* Legacy versions will not be tested in continuous integration.
* Some security patches may not be able to be backported.
* Dependencies will not be kept up-to-date, and features will not be backported.
#### Legacy tags available
* `legacy-8`: install client libraries from this dist-tag for versions
compatible with Node.js 8.
## Versioning

@@ -78,2 +99,8 @@

Please note that this `README.md`, the `samples/README.md`,
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
are generated from a central template. To edit one of these files, make an edit
to its template in this
[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library).
## License

@@ -80,0 +107,0 @@

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