Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gcs-resumable-upload

Package Overview
Dependencies
Maintainers
6
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gcs-resumable-upload - npm Package Compare versions

Comparing version 2.3.3 to 3.0.0

4

build/src/index.d.ts

@@ -20,2 +20,3 @@ /*!

import * as Pumpify from 'pumpify';
export declare const PROTOCOL_REGEX: RegExp;
export interface ErrorWithCode extends Error {

@@ -145,2 +146,3 @@ code: number;

apiEndpoint: string;
baseURI: string;
authConfig?: {

@@ -171,3 +173,2 @@ scopes?: string[];

private offsetStream?;
private readonly baseURI;
constructor(cfg: UploadConfig);

@@ -191,2 +192,3 @@ createURI(): Promise<string>;

private onResponse;
private sanitizeEndpoint;
}

@@ -193,0 +195,0 @@ export declare function upload(cfg: UploadConfig): Upload;

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

const RETRY_LIMIT = 5;
exports.PROTOCOL_REGEX = /^(\w*):\/\//;
class Upload extends Pumpify {

@@ -44,3 +45,7 @@ constructor(cfg) {

this.authClient = cfg.authClient || new google_auth_library_1.GoogleAuth(cfg.authConfig);
this.apiEndpoint = cfg.apiEndpoint || 'storage.googleapis.com';
this.apiEndpoint = 'https://storage.googleapis.com';
if (cfg.apiEndpoint) {
this.apiEndpoint = this.sanitizeEndpoint(cfg.apiEndpoint);
}
this.baseURI = `${this.apiEndpoint}/upload/storage/v1/b`;
this.bucket = cfg.bucket;

@@ -69,5 +74,3 @@ const cacheKeyElements = [cfg.bucket, cfg.file];

key: base64Key,
hash: crypto_1.createHash('sha256')
.update(cfg.key)
.digest('base64'),
hash: crypto_1.createHash('sha256').update(cfg.key).digest('base64'),
};

@@ -106,5 +109,2 @@ }

}
get baseURI() {
return `https://${this.apiEndpoint}/upload/storage/v1/b`;
}
createURI(callback) {

@@ -354,3 +354,3 @@ if (!callback) {

}
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
set(props) {

@@ -391,2 +391,11 @@ this.configStore.set(this.cacheKey, props);

}
/*
* Prepare user-defined API endpoint for compatibility with our API.
*/
sanitizeEndpoint(url) {
if (!exports.PROTOCOL_REGEX.test(url)) {
url = `https://${url}`;
}
return url.replace(/\/+$/, ''); // Remove trailing slashes
}
}

@@ -393,0 +402,0 @@ exports.Upload = Upload;

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

## [3.0.0](https://www.github.com/googleapis/gcs-resumable-upload/compare/v2.3.3...v3.0.0) (2020-05-12)
### ⚠ BREAKING CHANGES
* **dep:** upgrade gts 2.0.0/drop Node 8 (#329)
* drop support for Node 8 (see: https://github.com/googleapis/gcs-resumable-upload/pull/330) (#333)
### Features
* allow user-specified protocol for options.apiEndpoint ([#349](https://www.github.com/googleapis/gcs-resumable-upload/issues/349)) ([47f76d0](https://www.github.com/googleapis/gcs-resumable-upload/commit/47f76d0ac189d70341410dc5fc52374681ad15e9))
### Bug Fixes
* **deps:** update dependency gaxios to v3 ([#325](https://www.github.com/googleapis/gcs-resumable-upload/issues/325)) ([584ea71](https://www.github.com/googleapis/gcs-resumable-upload/commit/584ea7109d1af161af47785e48ca2498597db2e8))
* **deps:** update dependency google-auth-library to v6 ([#327](https://www.github.com/googleapis/gcs-resumable-upload/issues/327)) ([609bf9a](https://www.github.com/googleapis/gcs-resumable-upload/commit/609bf9aeda5c40bfedefa0a7b934173014ea3d39))
### Miscellaneous Chores
* **dep:** upgrade gts 2.0.0/drop Node 8 ([#329](https://www.github.com/googleapis/gcs-resumable-upload/issues/329)) ([f69a184](https://www.github.com/googleapis/gcs-resumable-upload/commit/f69a18494646206fb634b2400ec21348b690d78e))
### Build System
* drop support for Node 8 (see: https://github.com/googleapis/gcs-resumable-upload/pull/330) ([#333](https://www.github.com/googleapis/gcs-resumable-upload/issues/333)) ([165cd3b](https://www.github.com/googleapis/gcs-resumable-upload/commit/165cd3bdde1c3d9988dcd7349710da23545d68c3)), closes [#330](https://www.github.com/googleapis/gcs-resumable-upload/issues/330)
### [2.3.3](https://www.github.com/googleapis/gcs-resumable-upload/compare/v2.3.2...v2.3.3) (2020-03-06)

@@ -9,0 +37,0 @@

{
"name": "gcs-resumable-upload",
"version": "2.3.3",
"version": "3.0.0",
"description": "Upload a file to Google Cloud Storage with built-in resumable behavior",

@@ -17,6 +17,5 @@ "repository": "googleapis/gcs-resumable-upload",

"fix": "gts fix",
"posttest": "npm run lint",
"prepare": "npm run compile",
"pretest": "npm run compile",
"system-test": "mocha build/system-test --timeout 20000",
"system-test": "mocha build/system-test --timeout 60000",
"samples-test": "echo no samples 🤷‍♂️",

@@ -26,3 +25,5 @@ "presystem-test": "npm run compile",

"docs-test": "linkinator docs",
"predocs-test": "npm run docs"
"predocs-test": "npm run docs",
"prelint": "cd samples; npm link ../; npm install",
"precompile": "gts clean"
},

@@ -43,3 +44,3 @@ "keywords": [

"engines": {
"node": ">=8.10.0"
"node": ">=10"
},

@@ -49,4 +50,4 @@ "dependencies": {

"configstore": "^5.0.0",
"gaxios": "^2.0.0",
"google-auth-library": "^5.0.0",
"gaxios": "^3.0.0",
"google-auth-library": "^6.0.0",
"pumpify": "^2.0.0",

@@ -64,7 +65,7 @@ "stream-events": "^1.0.4"

"@types/pumpify": "^1.4.1",
"@types/sinon": "^7.0.10",
"@types/sinon": "^9.0.0",
"assert-rejects": "^1.0.0",
"c8": "^7.0.0",
"codecov": "^3.0.4",
"gts": "^1.0.0",
"gts": "^2.0.0",
"is-stream": "^2.0.0",

@@ -76,4 +77,4 @@ "linkinator": "^2.0.0",

"sinon": "^9.0.0",
"typescript": "3.6.4"
"typescript": "^3.8.3"
}
}

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