Socket
Socket
Sign inDemoInstall

@google-cloud/storage

Package Overview
Dependencies
Maintainers
1
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/storage - npm Package Compare versions

Comparing version 5.18.2 to 5.18.3

11

build/src/bucket.d.ts

@@ -231,2 +231,13 @@ /// <reference types="node" />

declare type MakeAllFilesPublicPrivateResponse = [File[]];
export declare enum BucketExceptionMessages {
PROVIDE_SOURCE_FILE = "You must provide at least one source file.",
DESTINATION_FILE_NOT_SPECIFIED = "A destination file must be specified.",
CHANNEL_ID_REQUIRED = "An ID is required to create a channel.",
CHANNEL_ADDRESS_REQUIRED = "An address is required to create a channel.",
TOPIC_NAME_REQUIRED = "A valid topic name is required.",
CONFIGURATION_OBJECT_PREFIX_REQUIRED = "A configuration object with a prefix is required.",
SPECIFY_FILE_NAME = "A file name must be specified.",
METAGENERATION_NOT_PROVIDED = "A metageneration must be provided.",
SUPPLY_NOTIFICATION_ID = "You must supply a notification ID."
}
/**

@@ -233,0 +244,0 @@ * Get and set IAM policies for your bucket.

@@ -229,2 +229,14 @@ /// <reference types="node" />

}
export declare enum FileExceptionMessages {
EXPIRATION_TIME_NA = "An expiration time is not available.",
DESTINATION_NO_NAME = "Destination file should have a name.",
INVALID_VALIDATION_FILE_RANGE = "Cannot use validation with file ranges (start/end).",
MD5_NOT_AVAILABLE = "MD5 verification was specified, but is not available for the requested object. MD5 is not available for composite objects.",
EQUALS_CONDITION_TWO_ELEMENTS = "Equals condition must be an array of 2 elements.",
STARTS_WITH_TWO_ELEMENTS = "StartsWith condition must be an array of 2 elements.",
CONTENT_LENGTH_RANGE_MIN_MAX = "ContentLengthRange must have numeric min & max fields.",
DOWNLOAD_MISMATCH = "The downloaded data did not match the data from the server. To be sure the content is the same, you should download the file again.",
UPLOAD_MISMATCH_DELETE_FAIL = "The uploaded data did not match the data from the server. \n As a precaution, we attempted to delete the file, but it was not successful. \n To be sure the content is the same, you should try removing the file manually, \n then uploading the file again. \n \n\nThe delete attempt failed with this message:\n\n ",
UPLOAD_MISMATCH = "The uploaded data did not match the data from the server. \n As a precaution, the file has been deleted. \n To be sure the content is the same, you should try uploading the file again."
}
/**

@@ -231,0 +243,0 @@ * A File object is created from your {@link Bucket} object using

8

build/src/gcs-resumable-upload/index.js

@@ -370,3 +370,5 @@ "use strict";

if (this.offset < this.numBytesWritten) {
this.emit('error', new RangeError('The offset is lower than the number of bytes written'));
const delta = this.numBytesWritten - this.offset;
const message = `The offset is lower than the number of bytes written. The server has ${this.offset} bytes and while ${this.numBytesWritten} bytes has been uploaded - thus ${delta} bytes are missing. Stopping as this could result in data loss. Initiate a new upload to continue.`;
this.emit('error', new RangeError(message));
return;

@@ -628,5 +630,3 @@ }

if (this.numBytesWritten) {
let message = 'Attempting to restart an upload after unrecoverable bytes have been written from upstream. ';
message += 'Stopping as this could result in data loss. ';
message += 'Create a new upload object to continue.';
const message = 'Attempting to restart an upload after unrecoverable bytes have been written from upstream. Stopping as this could result in data loss. Initiate a new upload to continue.';
this.emit('error', new RangeError(message));

@@ -633,0 +633,0 @@ return;

@@ -82,2 +82,6 @@ import { Metadata } from '@google-cloud/common';

}
export declare enum IAMExceptionMessages {
POLICY_OBJECT_REQUIRED = "A policy object is required.",
PERMISSIONS_REQUIRED = "Permissions are required."
}
/**

@@ -84,0 +88,0 @@ * Get and set IAM policies for your Cloud Storage bucket.

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.Iam = void 0;
exports.Iam = exports.IAMExceptionMessages = void 0;
const promisify_1 = require("@google-cloud/promisify");
const arrify = require("arrify");
const util_1 = require("./util");
var IAMExceptionMessages;
(function (IAMExceptionMessages) {
IAMExceptionMessages["POLICY_OBJECT_REQUIRED"] = "A policy object is required.";
IAMExceptionMessages["PERMISSIONS_REQUIRED"] = "Permissions are required.";
})(IAMExceptionMessages = exports.IAMExceptionMessages || (exports.IAMExceptionMessages = {}));
/**

@@ -150,3 +155,3 @@ * Get and set IAM policies for your Cloud Storage bucket.

* @param {Policy} policy The policy.
* @param {SetPolicyOptions} [options] Configuration opbject.
* @param {SetPolicyOptions} [options] Configuration options.
* @param {SetPolicyCallback} callback Callback function.

@@ -195,3 +200,3 @@ * @returns {Promise<SetPolicyResponse>}

if (policy === null || typeof policy !== 'object') {
throw new Error('A policy object is required.');
throw new Error(IAMExceptionMessages.POLICY_OBJECT_REQUIRED);
}

@@ -265,3 +270,3 @@ const { options, callback: cb } = util_1.normalize(optionsOrCallback, callback);

if (!Array.isArray(permissions) && typeof permissions !== 'string') {
throw new Error('Permissions are required.');
throw new Error(IAMExceptionMessages.PERMISSIONS_REQUIRED);
}

@@ -268,0 +273,0 @@ const { options, callback: cb } = util_1.normalize(optionsOrCallback, callback);

@@ -48,2 +48,7 @@ /// <reference types="node" />

}
export declare enum SignerExceptionMessages {
ACCESSIBLE_DATE_INVALID = "The accessible at date provided was invalid.",
EXPIRATION_BEFORE_ACCESSIBLE_DATE = "An expiration date cannot be before accessible date.",
X_GOOG_CONTENT_SHA256 = "The header X-Goog-Content-SHA256 must be a hexadecimal string."
}
/**

@@ -50,0 +55,0 @@ * @const {string}

@@ -16,7 +16,14 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SigningError = exports.URLSigner = exports.PATH_STYLED_HOST = void 0;
exports.SigningError = exports.URLSigner = exports.PATH_STYLED_HOST = exports.SignerExceptionMessages = void 0;
const crypto = require("crypto");
const dateFormat = require("date-and-time");
const url = require("url");
const storage_1 = require("./storage");
const util_1 = require("./util");
var SignerExceptionMessages;
(function (SignerExceptionMessages) {
SignerExceptionMessages["ACCESSIBLE_DATE_INVALID"] = "The accessible at date provided was invalid.";
SignerExceptionMessages["EXPIRATION_BEFORE_ACCESSIBLE_DATE"] = "An expiration date cannot be before accessible date.";
SignerExceptionMessages["X_GOOG_CONTENT_SHA256"] = "The header X-Goog-Content-SHA256 must be a hexadecimal string.";
})(SignerExceptionMessages = exports.SignerExceptionMessages || (exports.SignerExceptionMessages = {}));
/*

@@ -26,3 +33,3 @@ * Default signing version for getSignedUrl is 'v2'.

const DEFAULT_SIGNING_VERSION = 'v2';
const SEVEN_DAYS = 604800;
const SEVEN_DAYS = 7 * 24 * 60 * 60;
/**

@@ -44,3 +51,3 @@ * @const {string}

if (expiresInSeconds < accessibleAtInSeconds) {
throw new Error('An expiration date cannot be before accessible date.');
throw new Error(SignerExceptionMessages.EXPIRATION_BEFORE_ACCESSIBLE_DATE);
}

@@ -140,3 +147,3 @@ let customHost;

!/[A-Fa-f0-9]{40}/.test(sha256Header)) {
throw new Error('The header X-Goog-Content-SHA256 must be a hexadecimal string.');
throw new Error(SignerExceptionMessages.X_GOOG_CONTENT_SHA256);
}

@@ -258,6 +265,6 @@ contentSha256 = sha256Header;

if (isNaN(expiresInMSeconds)) {
throw new Error('The expiration date provided was invalid.');
throw new Error(storage_1.ExceptionMessages.EXPIRATION_DATE_INVALID);
}
if (expiresInMSeconds < current.valueOf()) {
throw new Error('An expiration date cannot be in the past.');
throw new Error(storage_1.ExceptionMessages.EXPIRATION_DATE_PAST);
}

@@ -269,3 +276,3 @@ return Math.round(expiresInMSeconds / 1000); // The API expects seconds.

if (isNaN(accessibleAtInMSeconds)) {
throw new Error('The accessible at date provided was invalid.');
throw new Error(SignerExceptionMessages.ACCESSIBLE_DATE_INVALID);
}

@@ -272,0 +279,0 @@ return Math.floor(accessibleAtInMSeconds / 1000); // The API expects seconds.

@@ -138,2 +138,15 @@ /// <reference types="node" />

}
export declare enum ExceptionMessages {
EXPIRATION_DATE_INVALID = "The expiration date provided was invalid.",
EXPIRATION_DATE_PAST = "An expiration date cannot be in the past.",
INVALID_ACTION = "The action is not provided or invalid."
}
export declare enum StorageExceptionMessages {
AUTO_RETRY_DEPRECATED = "autoRetry is deprecated. Use retryOptions.autoRetry instead.",
MAX_RETRIES_DEPRECATED = "maxRetries is deprecated. Use retryOptions.maxRetries instead.",
BUCKET_NAME_REQUIRED = "A bucket name is needed to use Cloud Storage.",
BUCKET_NAME_REQUIRED_CREATE = "A name is required to create a bucket.",
HMAC_SERVICE_ACCOUNT = "The first argument must be a service account email to create an HMAC key.",
HMAC_ACCESS_ID = "An access ID is needed to create an HmacKey object."
}
export declare type GetHmacKeysResponse = [HmacKey[]];

@@ -412,7 +425,7 @@ export declare const PROTOCOL_REGEX: RegExp;

* header in API requests.
* @property {object} [authClient] GoogleAuth client to reuse instead of creating a new one.
* @property {object} [authClient] `AuthClient` or `GoogleAuth` client to reuse instead of creating a new one.
* @property {number} [timeout] The amount of time in milliseconds to wait per http request before timing out.
* @property {object[]} [interceptors_] Array of custom request interceptors to be returned in the order they were assigned.
* @property {string} [apiEndpoint = storage.google.com] The API endpoint of the service used to make requests.
* @property {boolean} [useAuthWithCustomEndpoint] Controls whether or not to use authentication when using a custom endpoint.
* @property {boolean} [useAuthWithCustomEndpoint = false] Controls whether or not to use authentication when using a custom endpoint.
*/

@@ -438,3 +451,16 @@ /**

* ```
*
* @example
* Create a client with an `AuthClient` (e.g. `DownscopedClient`)
* ```
* const {DownscopedClient} = require('google-auth-library');
* const authClient = new DownscopedClient({...});
*
* const storage = new Storage({authClient});
* ```
*
* Additional samples:
* - https://github.com/googleapis/google-auth-library-nodejs#sample-usage-1
* - https://github.com/googleapis/google-auth-library-nodejs/blob/main/samples/downscopedclient.js
*
* @param {StorageOptions} [options] Configuration options.

@@ -592,3 +618,3 @@ */

* @param {string} accessId The HMAC key's access ID.
* @param {HmacKeyOptions} options HmacKey constructor owptions.
* @param {HmacKeyOptions} options HmacKey constructor options.
* @returns {HmacKey}

@@ -595,0 +621,0 @@ * @see HmacKey

@@ -16,3 +16,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Storage = exports.RETRYABLE_ERR_FN_DEFAULT = exports.MAX_RETRY_DELAY_DEFAULT = exports.TOTAL_TIMEOUT_DEFAULT = exports.RETRY_DELAY_MULTIPLIER_DEFAULT = exports.MAX_RETRY_DEFAULT = exports.AUTO_RETRY_DEFAULT = exports.PROTOCOL_REGEX = exports.IdempotencyStrategy = void 0;
exports.Storage = exports.RETRYABLE_ERR_FN_DEFAULT = exports.MAX_RETRY_DELAY_DEFAULT = exports.TOTAL_TIMEOUT_DEFAULT = exports.RETRY_DELAY_MULTIPLIER_DEFAULT = exports.MAX_RETRY_DEFAULT = exports.AUTO_RETRY_DEFAULT = exports.PROTOCOL_REGEX = exports.StorageExceptionMessages = exports.ExceptionMessages = exports.IdempotencyStrategy = void 0;
const common_1 = require("@google-cloud/common");

@@ -34,2 +34,17 @@ const paginator_1 = require("@google-cloud/paginator");

})(IdempotencyStrategy = exports.IdempotencyStrategy || (exports.IdempotencyStrategy = {}));
var ExceptionMessages;
(function (ExceptionMessages) {
ExceptionMessages["EXPIRATION_DATE_INVALID"] = "The expiration date provided was invalid.";
ExceptionMessages["EXPIRATION_DATE_PAST"] = "An expiration date cannot be in the past.";
ExceptionMessages["INVALID_ACTION"] = "The action is not provided or invalid.";
})(ExceptionMessages = exports.ExceptionMessages || (exports.ExceptionMessages = {}));
var StorageExceptionMessages;
(function (StorageExceptionMessages) {
StorageExceptionMessages["AUTO_RETRY_DEPRECATED"] = "autoRetry is deprecated. Use retryOptions.autoRetry instead.";
StorageExceptionMessages["MAX_RETRIES_DEPRECATED"] = "maxRetries is deprecated. Use retryOptions.maxRetries instead.";
StorageExceptionMessages["BUCKET_NAME_REQUIRED"] = "A bucket name is needed to use Cloud Storage.";
StorageExceptionMessages["BUCKET_NAME_REQUIRED_CREATE"] = "A name is required to create a bucket.";
StorageExceptionMessages["HMAC_SERVICE_ACCOUNT"] = "The first argument must be a service account email to create an HMAC key.";
StorageExceptionMessages["HMAC_ACCESS_ID"] = "An access ID is needed to create an HmacKey object.";
})(StorageExceptionMessages = exports.StorageExceptionMessages || (exports.StorageExceptionMessages = {}));
exports.PROTOCOL_REGEX = /^(\w*):\/\//;

@@ -285,7 +300,7 @@ /**

* header in API requests.
* @property {object} [authClient] GoogleAuth client to reuse instead of creating a new one.
* @property {object} [authClient] `AuthClient` or `GoogleAuth` client to reuse instead of creating a new one.
* @property {number} [timeout] The amount of time in milliseconds to wait per http request before timing out.
* @property {object[]} [interceptors_] Array of custom request interceptors to be returned in the order they were assigned.
* @property {string} [apiEndpoint = storage.google.com] The API endpoint of the service used to make requests.
* @property {boolean} [useAuthWithCustomEndpoint] Controls whether or not to use authentication when using a custom endpoint.
* @property {boolean} [useAuthWithCustomEndpoint = false] Controls whether or not to use authentication when using a custom endpoint.
*/

@@ -311,3 +326,16 @@ /**

* ```
*
* @example
* Create a client with an `AuthClient` (e.g. `DownscopedClient`)
* ```
* const {DownscopedClient} = require('google-auth-library');
* const authClient = new DownscopedClient({...});
*
* const storage = new Storage({authClient});
* ```
*
* Additional samples:
* - https://github.com/googleapis/google-auth-library-nodejs#sample-usage-1
* - https://github.com/googleapis/google-auth-library-nodejs/blob/main/samples/downscopedclient.js
*
* @param {StorageOptions} [options] Configuration options.

@@ -335,3 +363,3 @@ */

((_a = options.retryOptions) === null || _a === void 0 ? void 0 : _a.autoRetry) !== undefined) {
throw new common_1.ApiError('autoRetry is deprecated. Use retryOptions.autoRetry instead.');
throw new common_1.ApiError(StorageExceptionMessages.AUTO_RETRY_DEPRECATED);
}

@@ -346,3 +374,3 @@ else if (options.autoRetry !== undefined) {

if (options.maxRetries && ((_c = options.retryOptions) === null || _c === void 0 ? void 0 : _c.maxRetries)) {
throw new common_1.ApiError('maxRetries is deprecated. Use retryOptions.maxRetries instead.');
throw new common_1.ApiError(StorageExceptionMessages.MAX_RETRIES_DEPRECATED);
}

@@ -427,3 +455,3 @@ else if (options.maxRetries) {

if (!name) {
throw new Error('A bucket name is needed to use Cloud Storage.');
throw new Error(StorageExceptionMessages.BUCKET_NAME_REQUIRED);
}

@@ -568,3 +596,3 @@ return new bucket_1.Bucket(this, name, options);

if (!name) {
throw new Error('A name is required to create a bucket.');
throw new Error(StorageExceptionMessages.BUCKET_NAME_REQUIRED_CREATE);
}

@@ -701,3 +729,3 @@ let metadata;

if (typeof serviceAccountEmail !== 'string') {
throw new Error('The first argument must be a service account email to create an HMAC key.');
throw new Error(StorageExceptionMessages.HMAC_SERVICE_ACCOUNT);
}

@@ -747,3 +775,3 @@ const { options, callback } = util_1.normalize(optionsOrCb, cb);

* @property {Bucket[]} 0 Array of {@link Bucket} instances.
* @property {objcet} 1 nextQuery A query object to receive more results.
* @property {object} 1 nextQuery A query object to receive more results.
* @property {object} 2 The full API response.

@@ -939,3 +967,3 @@ */

* @param {string} accessId The HMAC key's access ID.
* @param {HmacKeyOptions} options HmacKey constructor owptions.
* @param {HmacKeyOptions} options HmacKey constructor options.
* @returns {HmacKey}

@@ -953,3 +981,3 @@ * @see HmacKey

if (!accessId) {
throw new Error('An access ID is needed to create an HmacKey object.');
throw new Error(StorageExceptionMessages.HMAC_ACCESS_ID);
}

@@ -956,0 +984,0 @@ return new hmacKey_1.HmacKey(this, accessId, options);

{
"name": "@google-cloud/storage",
"description": "Cloud Storage Client Library for Node.js",
"version": "5.18.2",
"version": "5.18.3",
"license": "Apache-2.0",

@@ -112,3 +112,3 @@ "author": "Google Inc.",

"tmp": "^0.2.0",
"typescript": "^3.8.3",
"typescript": "~3.9.10",
"uuid": "^8.0.0",

@@ -115,0 +115,0 @@ "yargs": "^16.0.0"

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

| Rotate Encryption Key | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/rotateEncryptionKey.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/rotateEncryptionKey.js,samples/README.md) |
| Set Client Endpoint | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setClientEndpoint.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setClientEndpoint.js,samples/README.md) |
| Set Event Based Hold | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setEventBasedHold.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setEventBasedHold.js,samples/README.md) |

@@ -194,0 +195,0 @@ | Set Public Access Prevention Enforced | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/setPublicAccessPreventionEnforced.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/setPublicAccessPreventionEnforced.js,samples/README.md) |

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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