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

@google-cloud/storage

Package Overview
Dependencies
Maintainers
1
Versions
184
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 6.3.0 to 6.4.0

1

build/src/acl.js

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

qs: query,
maxRetries: 0,
json: {

@@ -392,0 +393,0 @@ entity: options.entity,

40

build/src/bucket.d.ts

@@ -5,3 +5,3 @@ /// <reference types="node" />

/// <reference types="node" />
import { ApiError, BodyResponseCallback, DecorateRequestOptions, DeleteCallback, ExistsCallback, GetConfig, Metadata, ResponseBody, ServiceObject } from './nodejs-common';
import { ApiError, BodyResponseCallback, DecorateRequestOptions, DeleteCallback, ExistsCallback, GetConfig, Metadata, MetadataCallback, ResponseBody, ServiceObject, SetMetadataResponse } from './nodejs-common';
import * as http from 'http';

@@ -18,2 +18,3 @@ import { Acl } from './acl';

import { URL } from 'url';
import { SetMetadataOptions } from './nodejs-common/service-object';
export declare type GetFilesResponse = [File[], {}, Metadata];

@@ -32,3 +33,3 @@ export interface GetFilesCallback {

}
export interface AddLifecycleRuleOptions {
export interface AddLifecycleRuleOptions extends PreconditionOptions {
append?: boolean;

@@ -46,3 +47,3 @@ }

}
export interface EnableLoggingOptions {
export interface EnableLoggingOptions extends PreconditionOptions {
bucket?: string | Bucket;

@@ -111,2 +112,4 @@ prefix: string;

export declare type DeleteLabelsCallback = SetLabelsCallback;
export declare type DeleteLabelsOptions = PreconditionOptions;
export declare type DisableRequesterPaysOptions = PreconditionOptions;
export declare type DisableRequesterPaysResponse = [Metadata];

@@ -120,2 +123,3 @@ export interface DisableRequesterPaysCallback {

}
export declare type EnableRequesterPaysOptions = PreconditionOptions;
export interface BucketExistsOptions extends GetConfig {

@@ -175,2 +179,3 @@ userProject?: string;

userProject?: string;
preconditionOpts?: PreconditionOptions;
}

@@ -189,3 +194,3 @@ export declare type MakeBucketPrivateResponse = [File[]];

export declare type MakeBucketPublicResponse = [File[]];
export interface SetBucketMetadataOptions {
export interface SetBucketMetadataOptions extends PreconditionOptions {
userProject?: string;

@@ -204,3 +209,3 @@ }

}
export interface SetLabelsOptions {
export interface SetLabelsOptions extends PreconditionOptions {
userProject?: string;

@@ -212,3 +217,3 @@ }

}
export interface SetBucketStorageClassOptions {
export interface SetBucketStorageClassOptions extends PreconditionOptions {
userProject?: string;

@@ -581,10 +586,15 @@ }

deleteLabels(labels?: string | string[]): Promise<DeleteLabelsResponse>;
deleteLabels(options: DeleteLabelsOptions): Promise<DeleteLabelsResponse>;
deleteLabels(callback: DeleteLabelsCallback): void;
deleteLabels(labels: string | string[], options: DeleteLabelsOptions): Promise<DeleteLabelsResponse>;
deleteLabels(labels: string | string[], callback: DeleteLabelsCallback): void;
disableRequesterPays(): Promise<DisableRequesterPaysResponse>;
deleteLabels(labels: string | string[], options: DeleteLabelsOptions, callback: DeleteLabelsCallback): void;
disableRequesterPays(options?: DisableRequesterPaysOptions): Promise<DisableRequesterPaysResponse>;
disableRequesterPays(callback: DisableRequesterPaysCallback): void;
disableRequesterPays(options: DisableRequesterPaysOptions, callback: DisableRequesterPaysCallback): void;
enableLogging(config: EnableLoggingOptions): Promise<SetBucketMetadataResponse>;
enableLogging(config: EnableLoggingOptions, callback: SetBucketMetadataCallback): void;
enableRequesterPays(): Promise<EnableRequesterPaysResponse>;
enableRequesterPays(options?: EnableRequesterPaysOptions): Promise<EnableRequesterPaysResponse>;
enableRequesterPays(callback: EnableRequesterPaysCallback): void;
enableRequesterPays(options: EnableRequesterPaysOptions, callback: EnableRequesterPaysCallback): void;
/**

@@ -652,4 +662,5 @@ * Create a {@link File} object. See {@link File} to see how to handle

notification(id: string): Notification;
removeRetentionPeriod(): Promise<SetBucketMetadataResponse>;
removeRetentionPeriod(options?: SetBucketMetadataOptions): Promise<SetBucketMetadataResponse>;
removeRetentionPeriod(callback: SetBucketMetadataCallback): void;
removeRetentionPeriod(options: SetBucketMetadataOptions, callback: SetBucketMetadataCallback): void;
request(reqOpts: DecorateRequestOptions): Promise<[ResponseBody, Metadata]>;

@@ -660,6 +671,11 @@ request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;

setLabels(labels: Labels, options: SetLabelsOptions, callback: SetLabelsCallback): void;
setRetentionPeriod(duration: number): Promise<SetBucketMetadataResponse>;
setMetadata(metadata: Metadata, options?: SetMetadataOptions): Promise<SetMetadataResponse>;
setMetadata(metadata: Metadata, callback: MetadataCallback): void;
setMetadata(metadata: Metadata, options: SetMetadataOptions, callback: MetadataCallback): void;
setRetentionPeriod(duration: number, options?: SetBucketMetadataOptions): Promise<SetBucketMetadataResponse>;
setRetentionPeriod(duration: number, callback: SetBucketMetadataCallback): void;
setCorsConfiguration(corsConfiguration: Cors[]): Promise<SetBucketMetadataResponse>;
setRetentionPeriod(duration: number, options: SetBucketMetadataOptions, callback: SetBucketMetadataCallback): void;
setCorsConfiguration(corsConfiguration: Cors[], options?: SetBucketMetadataOptions): Promise<SetBucketMetadataResponse>;
setCorsConfiguration(corsConfiguration: Cors[], callback: SetBucketMetadataCallback): void;
setCorsConfiguration(corsConfiguration: Cors[], options: SetBucketMetadataOptions, callback: SetBucketMetadataCallback): void;
setStorageClass(storageClass: string, options?: SetBucketStorageClassOptions): Promise<SetBucketMetadataResponse>;

@@ -691,3 +707,3 @@ setStorageClass(storageClass: string, callback: SetBucketStorageClassCallback): void;

getId(): string;
disableAutoRetryConditionallyIdempotent_(coreOpts: any, methodType: AvailableServiceObjectMethods): void;
disableAutoRetryConditionallyIdempotent_(coreOpts: any, methodType: AvailableServiceObjectMethods, localPreconditionOptions?: PreconditionOptions): void;
}

@@ -694,0 +710,0 @@ /**

@@ -5,3 +5,3 @@ /// <reference types="node" />

/// <reference types="node" />
import { BodyResponseCallback, DecorateRequestOptions, GetConfig, Metadata, ServiceObject } from './nodejs-common';
import { BodyResponseCallback, DecorateRequestOptions, GetConfig, Metadata, MetadataCallback, ServiceObject, SetMetadataResponse } from './nodejs-common';
import { Writable, Readable } from 'stream';

@@ -16,2 +16,4 @@ import * as http from 'http';

import { URL } from 'url';
import { DeleteCallback, DeleteOptions, SetMetadataOptions } from './nodejs-common/service-object';
import * as r from 'teeny-request';
export declare type GetExpirationDateResponse = [Date];

@@ -132,2 +134,3 @@ export interface GetExpirationDateCallback {

userProject?: string;
preconditionOpts?: PreconditionOptions;
}

@@ -159,2 +162,3 @@ export declare type MakeFilePrivateResponse = [Metadata];

kmsKeyName?: string;
preconditionOpts?: PreconditionOptions;
}

@@ -691,2 +695,12 @@ export declare type RotateEncryptionKeyCallback = CopyCallback;

createWriteStream(options?: CreateWriteStreamOptions): Writable;
/**
* Delete the object.
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {object} callback.apiResponse - The full API response.
*/
delete(options?: DeleteOptions): Promise<[r.Response]>;
delete(options: DeleteOptions, callback: DeleteCallback): void;
delete(callback: DeleteCallback): void;
download(options?: DownloadOptions): Promise<DownloadResponse>;

@@ -790,2 +804,5 @@ download(options: DownloadOptions, callback: DownloadCallback): void;

save(data: string | Buffer, options: SaveOptions, callback: SaveCallback): void;
setMetadata(metadata: Metadata, options?: SetMetadataOptions): Promise<SetMetadataResponse>;
setMetadata(metadata: Metadata, callback: MetadataCallback): void;
setMetadata(metadata: Metadata, options: SetMetadataOptions, callback: MetadataCallback): void;
setStorageClass(storageClass: string, options?: SetStorageClassOptions): Promise<SetStorageClassResponse>;

@@ -831,3 +848,3 @@ setStorageClass(storageClass: string, options: SetStorageClassOptions, callback: SetStorageClassCallback): void;

startSimpleUpload_(dup: Duplexify, options?: CreateWriteStreamOptions): void;
disableAutoRetryConditionallyIdempotent_(coreOpts: any, methodType: AvailableServiceObjectMethods): void;
disableAutoRetryConditionallyIdempotent_(coreOpts: any, methodType: AvailableServiceObjectMethods, localPreconditionOptions?: PreconditionOptions): void;
private getBufferFromReadable;

@@ -834,0 +851,0 @@ }

@@ -1,2 +0,3 @@

import { Metadata, ServiceObject } from './nodejs-common';
import { Metadata, ServiceObject, MetadataCallback, SetMetadataResponse } from './nodejs-common';
import { SetMetadataOptions } from './nodejs-common/service-object';
import { Storage } from './storage';

@@ -51,2 +52,10 @@ export interface HmacKeyOptions {

/**
* A reference to the {@link Storage} associated with this {@link HmacKey}
* instance.
* @name HmacKey#storage
* @type {Storage}
*/
storage: Storage;
private instanceRetryValue?;
/**
* @typedef {object} HmacKeyOptions

@@ -75,2 +84,14 @@ * @property {string} [projectId] The project ID of the project that owns

constructor(storage: Storage, accessId: string, options?: HmacKeyOptions);
/**
* Set the metadata for this object.
*
* @param {object} metadata - The metadata to set on this object.
* @param {object=} options - Configuration options.
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {object} callback.apiResponse - The full API response.
*/
setMetadata(metadata: Metadata, options?: SetMetadataOptions): Promise<SetMetadataResponse>;
setMetadata(metadata: Metadata, callback: MetadataCallback): void;
setMetadata(metadata: Metadata, options: SetMetadataOptions, callback: MetadataCallback): void;
}

@@ -18,2 +18,4 @@ "use strict";

const nodejs_common_1 = require("./nodejs-common");
const storage_1 = require("./storage");
const promisify_1 = require("@google-cloud/promisify");
/**

@@ -306,5 +308,32 @@ * The API-formatted resource description of the HMAC key.

});
this.storage = storage;
this.instanceRetryValue = storage.retryOptions.autoRetry;
}
setMetadata(metadata, optionsOrCallback, cb) {
// ETag preconditions are not currently supported. Retries should be disabled if the idempotency strategy is not set to RetryAlways
if (this.storage.retryOptions.idempotencyStrategy !==
storage_1.IdempotencyStrategy.RetryAlways) {
this.storage.retryOptions.autoRetry = false;
}
const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
cb =
typeof optionsOrCallback === 'function'
? optionsOrCallback
: cb;
super
.setMetadata(metadata, options)
.then(resp => cb(null, ...resp))
.catch(cb)
.finally(() => {
this.storage.retryOptions.autoRetry = this.instanceRetryValue;
});
}
}
exports.HmacKey = HmacKey;
/*! Developer Documentation
*
* All async methods (except for streams) will return a Promise in the event
* that a callback is omitted.
*/
(0, promisify_1.promisifyAll)(HmacKey);
//# sourceMappingURL=hmacKey.js.map

@@ -201,5 +201,10 @@ "use strict";

const { options, callback: cb } = (0, util_1.normalize)(optionsOrCallback, callback);
let maxRetries;
if (policy.etag === undefined) {
maxRetries = 0;
}
this.request_({
method: 'PUT',
uri: '/iam',
maxRetries,
json: Object.assign({

@@ -206,0 +211,0 @@ resourceId: this.resourceId_,

@@ -69,2 +69,6 @@ /// <reference types="node" />

ignoreNotFound?: boolean;
ifGenerationMatch?: number;
ifGenerationNotMatch?: number;
ifMetagenerationMatch?: number;
ifMetagenerationNotMatch?: number;
} & object;

@@ -71,0 +75,0 @@ export interface DeleteCallback {

@@ -505,6 +505,6 @@ "use strict";

let maxRetryValue = MAX_RETRY_DEFAULT;
if (config.maxRetries) {
if (config.maxRetries !== undefined) {
maxRetryValue = config.maxRetries;
}
else if ((_b = config.retryOptions) === null || _b === void 0 ? void 0 : _b.maxRetries) {
else if (((_b = config.retryOptions) === null || _b === void 0 ? void 0 : _b.maxRetries) !== undefined) {
maxRetryValue = config.retryOptions.maxRetries;

@@ -531,2 +531,3 @@ }

options.retries = reqOpts.maxRetries;
options.noResponseRetries = reqOpts.maxRetries;
}

@@ -533,0 +534,0 @@ if (!config.stream) {

@@ -95,2 +95,7 @@ "use strict";

var _a;
const isConnectionProblem = (reason) => {
return ((reason && reason.includes('eai_again')) || //DNS lookup error
reason === 'econnreset' ||
reason === 'unexpected connection closure');
};
if (err) {

@@ -100,8 +105,12 @@ if ([408, 429, 500, 502, 503, 504].indexOf(err.code) !== -1) {

}
if (typeof err.code === 'string') {
const reason = err.code.toLowerCase();
if (isConnectionProblem(reason)) {
return true;
}
}
if (err.errors) {
for (const e of err.errors) {
const reason = (_a = e === null || e === void 0 ? void 0 : e.reason) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
if ((reason && reason.includes('eai_again')) || //DNS lookup error
reason === 'econnreset' ||
reason === 'unexpected connection closure') {
if (isConnectionProblem(reason)) {
return true;

@@ -108,0 +117,0 @@ }

/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import * as querystring from 'querystring';
import { PassThrough } from 'stream';
export declare function normalize<T = {}, U = Function>(optionsOrCallback?: T | U, cb?: U): {

@@ -67,1 +70,8 @@ options: T;

export declare function formatAsUTCISO(dateTimeToFormat: Date, includeTime?: boolean, dateDelimiter?: string, timeDelimiter?: string): string;
export declare class PassThroughShim extends PassThrough {
private shouldEmitReading;
private shouldEmitWriting;
_read(size: number): void;
_write(chunk: never, encoding: BufferEncoding, callback: (error?: Error | null | undefined) => void): void;
_final(callback: (error?: Error | null | undefined) => void): void;
}

@@ -16,4 +16,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.formatAsUTCISO = exports.convertObjKeysToSnakeCase = exports.unicodeJSONStringify = exports.objectKeyToLowercase = exports.qsStringify = exports.encodeURI = exports.fixedEncodeURIComponent = exports.objectEntries = exports.normalize = void 0;
exports.PassThroughShim = exports.formatAsUTCISO = exports.convertObjKeysToSnakeCase = exports.unicodeJSONStringify = exports.objectKeyToLowercase = exports.qsStringify = exports.encodeURI = exports.fixedEncodeURIComponent = exports.objectEntries = exports.normalize = void 0;
const querystring = require("querystring");
const stream_1 = require("stream");
function normalize(optionsOrCallback, cb) {

@@ -148,2 +149,40 @@ const options = (typeof optionsOrCallback === 'object' ? optionsOrCallback : {});

exports.formatAsUTCISO = formatAsUTCISO;
class PassThroughShim extends stream_1.PassThrough {
constructor() {
super(...arguments);
this.shouldEmitReading = true;
this.shouldEmitWriting = true;
}
_read(size) {
if (this.shouldEmitReading) {
this.emit('reading');
this.shouldEmitReading = false;
}
super._read(size);
}
_write(chunk, encoding, callback) {
if (this.shouldEmitWriting) {
this.emit('writing');
this.shouldEmitWriting = false;
}
// Per the nodejs documention, callback must be invoked on the next tick
process.nextTick(() => {
super._write(chunk, encoding, callback);
});
}
_final(callback) {
// If the stream is empty (i.e. empty file) final will be invoked before _read / _write
// and we should still emit the proper events.
if (this.shouldEmitReading) {
this.emit('reading');
this.shouldEmitReading = false;
}
if (this.shouldEmitWriting) {
this.emit('writing');
this.shouldEmitWriting = false;
}
callback(null);
}
}
exports.PassThroughShim = PassThroughShim;
//# sourceMappingURL=util.js.map
{
"name": "@google-cloud/storage",
"description": "Cloud Storage Client Library for Node.js",
"version": "6.3.0",
"version": "6.4.0",
"license": "Apache-2.0",

@@ -70,3 +70,2 @@ "author": "Google Inc.",

"retry-request": "^5.0.0",
"stream-events": "^1.0.4",
"teeny-request": "^8.0.0",

@@ -83,3 +82,3 @@ "uuid": "^8.0.0"

"@types/extend": "^3.0.0",
"@types/mime": "^2.0.0",
"@types/mime": "^3.0.0",
"@types/mime-types": "^2.1.0",

@@ -86,0 +85,0 @@ "@types/mocha": "^9.1.1",

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