Socket
Socket
Sign inDemoInstall

@google-cloud/storage

Package Overview
Dependencies
Maintainers
4
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 2.0.3 to 2.1.0

build/src/util.d.ts

9

build/src/acl.d.ts

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

*/
import { DecorateRequestOptions, BodyResponseCallback } from '@google-cloud/common';
interface AccessControlObject {

@@ -191,3 +192,3 @@ entity: string;

constructor();
_assignAccessMethods(role: any): void;
_assignAccessMethods(role: string): void;
}

@@ -236,4 +237,4 @@ /**

declare class Acl extends AclRoleAccessorMethods {
default?: Acl;
pathPrefix: any;
default: Acl;
pathPrefix: string;
request_: any;

@@ -535,4 +536,4 @@ constructor(options: any);

*/
request(reqOpts: any, callback: any): void;
request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
}
export { Acl, AclRoleAccessorMethods, };

@@ -17,4 +17,14 @@ /*!

import { ServiceObject } from '@google-cloud/common';
import * as request from 'request';
import { Storage } from '.';
import { Response } from 'request';
/**
* @callback StopCallback
* @param {?Error} err Request error, if any.
* @param {object} apiResponse The full API response.
*/
export interface StopCallback {
(err: Error | null, apiResponse?: request.Response): void;
}
/**
* Create a channel object to interact with a Cloud Storage channel.

@@ -41,7 +51,2 @@ *

/**
* @callback StopCallback
* @param {?Error} err Request error, if any.
* @param {object} apiResponse The full API response.
*/
/**
* Stop this channel.

@@ -69,3 +74,4 @@ *

*/
stop(callback?: any): void;
stop(): Promise<Response>;
stop(callback: StopCallback): void;
}

@@ -72,0 +78,0 @@ /**

@@ -57,34 +57,2 @@ /*!

}
/**
* @typedef {array} StopResponse
* @property {object} 0 The full API response.
*/
/**
* @callback StopCallback
* @param {?Error} err Request error, if any.
* @param {object} apiResponse The full API response.
*/
/**
* Stop this channel.
*
* @param {StopCallback} [callback] Callback function.
* @returns {Promise<StopResponse>}
*
* @example
* const {Storage} = require('@google-cloud/storage');
* const storage = new Storage();
* const channel = storage.channel('id', 'resource-id');
* channel.stop(function(err, apiResponse) {
* if (!err) {
* // Channel stopped successfully.
* }
* });
*
* //-
* // If the callback is omitted, we'll return a Promise.
* //-
* channel.stop().then(function(data) {
* const apiResponse = data[0];
* });
*/
stop(callback) {

@@ -91,0 +59,0 @@ callback = callback || common_1.util.noop;

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

*/
import { Service, GoogleAuthOptions } from '@google-cloud/common';
import { Service, GoogleAuthOptions, CreateOptions } from '@google-cloud/common';
import * as request from 'request';

@@ -27,3 +27,4 @@ import { Bucket } from './bucket';

}
export interface BucketOptions {
export interface BucketOptions extends CreateOptions {
location?: string;
kmsKeyName?: string;

@@ -39,2 +40,3 @@ userProject?: string;

requesterPays?: boolean;
retentionPolicy?: object;
userProject?: string;

@@ -332,2 +334,13 @@ }

* //-
* // Create a bucket with a retention policy of 6 months.
* //-
* const metadata = {
* retentionPolicy: {
* retentionPeriod: 15780000 // 6 months in seconds.
* }
* };
*
* storage.createBucket('new-bucket', metadata, callback);
*
* //-
* // Enable versioning on a new bucket.

@@ -432,3 +445,3 @@ * //-

*/
getBuckets(query: any, callback: any): void;
getBuckets(query: any, callback?: any): void;
/**

@@ -482,3 +495,3 @@ * @typedef {array} GetServiceAccountResponse

*/
getServiceAccount(options: any, callback: any): void;
getServiceAccount(options: any, callback?: any): void;
}

@@ -517,1 +530,2 @@ /**

export { Storage };
export { Bucket, File, Channel };

@@ -25,4 +25,7 @@ /**

const bucket_1 = require("./bucket");
exports.Bucket = bucket_1.Bucket;
const channel_1 = require("./channel");
exports.Channel = channel_1.Channel;
const file_1 = require("./file");
exports.File = file_1.File;
/**

@@ -29,0 +32,0 @@ * @typedef {object} ClientConfig

@@ -16,5 +16,61 @@ /*!

*/
import { ServiceObject } from '@google-cloud/common';
import { ServiceObject, GetMetadataCallback } from '@google-cloud/common';
import * as request from 'request';
import { Bucket } from './bucket';
import { ResponseBody } from '@google-cloud/common/build/src/util';
export interface DeleteNotificationOptions {
userProject?: string;
}
export interface GetNotificationMetadataOptions {
userProject?: string;
}
/**
* @typedef {array} GetNotificationMetadataResponse
* @property {object} 0 The notification metadata.
* @property {object} 1 The full API response.
*/
export declare type GetNotificationMetadataResponse = [ResponseBody, request.Response];
/**
* @callback GetNotificationMetadataCallback
* @param {?Error} err Request error, if any.
* @param {object} files The notification metadata.
* @param {object} apiResponse The full API response.
*/
export interface GetNotificationMetadataCallback {
(err: Error | null, metadata?: ResponseBody, apiResponse?: request.Response): void;
}
/**
* @typedef {array} GetNotificationResponse
* @property {Notification} 0 The {@link Notification}
* @property {object} 1 The full API response.
*/
export declare type GetNotificationResponse = [Notification, request.Response];
export interface GetNotificationOptions {
/**
* Automatically create the object if it does not exist. Default: `false`.
*/
autoCreate?: boolean;
/**
* The ID of the project which will be billed for the request.
*/
userProject?: string;
}
/**
* @callback GetNotificationCallback
* @param {?Error} err Request error, if any.
* @param {Notification} notification The {@link Notification}.
* @param {object} apiResponse The full API response.
*/
export interface GetNotificationCallback {
(err: Error | null, notification?: Notification | null, apiResponse?: request.Response): void;
}
/**
* @callback DeleteNotificationCallback
* @param {?Error} err Request error, if any.
* @param {object} apiResponse The full API response.
*/
export interface DeleteNotificationCallback {
(err: Error | null, apiResponse?: request.Response): void;
}
/**
* A Notification object is created from your {@link Bucket} object using

@@ -46,7 +102,2 @@ * {@link Bucket#notification}. Use it to interact with Cloud Pub/Sub

/**
* @callback DeleteNotificationCallback
* @param {?Error} err Request error, if any.
* @param {object} apiResponse The full API response.
*/
/**
* Permanently deletes a notification subscription.

@@ -81,15 +132,6 @@ *

*/
delete(options: any, callback?: any): void;
delete(options?: DeleteNotificationOptions): Promise<[request.Response]>;
delete(options: DeleteNotificationOptions, callback: DeleteNotificationCallback): void;
delete(callback: DeleteNotificationCallback): void;
/**
* @typedef {array} GetNotificationResponse
* @property {Notification} 0 The {@link Notification}
* @property {object} 1 The full API response.
*/
/**
* @callback GetNotificationCallback
* @param {?Error} err Request error, if any.
* @param {Notification} notification The {@link Notification}.
* @param {object} apiResponse The full API response.
*/
/**
* Get a notification and its metadata if it exists.

@@ -126,15 +168,6 @@ *

*/
get(options: any, callback?: any): void;
get(options?: GetNotificationOptions): Promise<GetNotificationResponse>;
get(options: GetNotificationOptions, callback: GetNotificationCallback): void;
get(callback: GetNotificationCallback): void;
/**
* @typedef {array} GetNotificationMetadataResponse
* @property {object} 0 The notification metadata.
* @property {object} 1 The full API response.
*/
/**
* @callback GetNotificationMetadataCallback
* @param {?Error} err Request error, if any.
* @param {object} files The notification metadata.
* @param {object} apiResponse The full API response.
*/
/**
* Get the notification's metadata.

@@ -170,3 +203,5 @@ *

*/
getMetadata(options: any, callback?: any): void;
getMetadata(options?: GetNotificationMetadataOptions): Promise<GetNotificationMetadataResponse>;
getMetadata(options: GetNotificationMetadataOptions, callback: GetMetadataCallback): void;
getMetadata(callback: GetMetadataCallback): void;
}

@@ -173,0 +208,0 @@ /**

@@ -126,46 +126,6 @@ /*!

}
/**
* @typedef {array} DeleteNotificationResponse
* @property {object} 0 The full API response.
*/
/**
* @callback DeleteNotificationCallback
* @param {?Error} err Request error, if any.
* @param {object} apiResponse The full API response.
*/
/**
* Permanently deletes a notification subscription.
*
* @see [Notifications: delete API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/notifications/delete}
*
* @param {object} [options] Configuration options.
* @param {string} [options.userProject] The ID of the project which will be
* billed for the request.
* @param {DeleteNotificationCallback} [callback] Callback function.
* @returns {Promise<DeleteNotificationResponse>}
*
* @example
* const {Storage} = require('@google-cloud/storage');
* const storage = new Storage();
* const myBucket = storage.bucket('my-bucket');
* const notification = myBucket.notification('1');
*
* notification.delete(function(err, apiResponse) {});
*
* //-
* // If the callback is omitted, we'll return a Promise.
* //-
* notification.delete().then(function(data) {
* const apiResponse = data[0];
* });
*
* @example <caption>include:samples/notifications.js</caption>
* region_tag:storage_delete_notification
* Another example:
*/
delete(options, callback) {
if (is.fn(options)) {
callback = options;
options = {};
}
delete(optionsOrCallback, callback) {
const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
callback =
typeof optionsOrCallback === 'function' ? optionsOrCallback : callback;
this.request({

@@ -177,50 +137,6 @@ method: 'DELETE',

}
/**
* @typedef {array} GetNotificationResponse
* @property {Notification} 0 The {@link Notification}
* @property {object} 1 The full API response.
*/
/**
* @callback GetNotificationCallback
* @param {?Error} err Request error, if any.
* @param {Notification} notification The {@link Notification}.
* @param {object} apiResponse The full API response.
*/
/**
* Get a notification and its metadata if it exists.
*
* @see [Notifications: get API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/notifications/get}
*
* @param {object} [options] Configuration options.
* See {@link Bucket#createNotification} for create options.
* @param {boolean} [options.autoCreate] Automatically create the object if
* it does not exist. Default: `false`.
* @param {string} [options.userProject] The ID of the project which will be
* billed for the request.
* @param {GetNotificationCallback} [callback] Callback function.
* @return {Promise<GetNotificationCallback>}
*
* @example
* const {Storage} = require('@google-cloud/storage');
* const storage = new Storage();
* const myBucket = storage.bucket('my-bucket');
* const notification = myBucket.notification('1');
*
* notification.get(function(err, notification, apiResponse) {
* // `notification.metadata` has been populated.
* });
*
* //-
* // If the callback is omitted, we'll return a Promise.
* //-
* notification.get().then(function(data) {
* const notification = data[0];
* const apiResponse = data[1];
* });
*/
get(options, callback) {
if (is.fn(options)) {
callback = options;
options = {};
}
get(optionsOrCallback, callback) {
const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
callback =
typeof optionsOrCallback === 'function' ? optionsOrCallback : callback;
const autoCreate = options.autoCreate;

@@ -256,49 +172,6 @@ delete options.autoCreate;

}
/**
* @typedef {array} GetNotificationMetadataResponse
* @property {object} 0 The notification metadata.
* @property {object} 1 The full API response.
*/
/**
* @callback GetNotificationMetadataCallback
* @param {?Error} err Request error, if any.
* @param {object} files The notification metadata.
* @param {object} apiResponse The full API response.
*/
/**
* Get the notification's metadata.
*
* @see [Notifications: get API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/notifications/get}
*
* @param {object} [options] Configuration options.
* @param {string} [options.userProject] The ID of the project which will be
* billed for the request.
* @param {GetNotificationMetadataCallback} [callback] Callback function.
* @returns {Promise<GetNotificationMetadataResponse>}
*
* @example
* const {Storage} = require('@google-cloud/storage');
* const storage = new Storage();
* const myBucket = storage.bucket('my-bucket');
* const notification = myBucket.notification('1');
*
* notification.getMetadata(function(err, metadata, apiResponse) {});
*
* //-
* // If the callback is omitted, we'll return a Promise.
* //-
* notification.getMetadata().then(function(data) {
* const metadata = data[0];
* const apiResponse = data[1];
* });
*
* @example <caption>include:samples/notifications.js</caption>
* region_tag:storage_notifications_get_metadata
* Another example:
*/
getMetadata(options, callback) {
if (is.fn(options)) {
callback = options;
options = {};
}
getMetadata(optionsOrCallback, callback) {
const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
callback =
typeof optionsOrCallback === 'function' ? optionsOrCallback : callback;
this.request({

@@ -305,0 +178,0 @@ uri: '',

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

## v2.1.0
This release brings support for Bucket/Object lock operations, as well as disable TypeScript as we continue to annotate the project with types.
### New Features
- feat: Support Bucket/Object lock operations ([#374](https://github.com/googleapis/nodejs-storage/pull/374))
### Implementation Changes
- disable types for now ([#392](https://github.com/googleapis/nodejs-storage/pull/392))
- Don't publish sourcemaps ([#412](https://github.com/googleapis/nodejs-storage/pull/412))
#### TypeScript support (in progress)
- fix: add better types for file.ts ([#436](https://github.com/googleapis/nodejs-storage/pull/436))
- fix: use ~ for typescript (and fix compile errors) ([#426](https://github.com/googleapis/nodejs-storage/pull/426))
- fix: Add typing for File#download() ([#409](https://github.com/googleapis/nodejs-storage/pull/409))
- chore: convert system tests to typescript ([#424](https://github.com/googleapis/nodejs-storage/pull/424))
- Improve TypeScript types (part 4) ([#402](https://github.com/googleapis/nodejs-storage/pull/402))
- ts: convert jsdoc types to typescript interfaces (1) ([#383](https://github.com/googleapis/nodejs-storage/pull/383))
- fix: TS definition ([#387](https://github.com/googleapis/nodejs-storage/pull/387))
- Annotate types [#3](https://github.com/googleapis/nodejs-storage/pull/3) ([#391](https://github.com/googleapis/nodejs-storage/pull/391))
- Annotate types (2) ([#388](https://github.com/googleapis/nodejs-storage/pull/388))
### Dependencies
- chore(deps): update dependency eslint-plugin-prettier to v3 ([#419](https://github.com/googleapis/nodejs-storage/pull/419))
### Documentation
- docs: Modify source location for templates ([#410](https://github.com/googleapis/nodejs-storage/pull/410))
- docs: Explain `Bucket#upload()` still exists ([#421](https://github.com/googleapis/nodejs-storage/pull/421))
### Internal / Testing Changes
- fix(tests): fix system tests on CircleCI ([#431](https://github.com/googleapis/nodejs-storage/pull/431))
- fix(tests): system-test compiles to ./build, fix relative path ([#428](https://github.com/googleapis/nodejs-storage/pull/428))
- Update kokoro config ([#425](https://github.com/googleapis/nodejs-storage/pull/425))
- chore(samples): convert samples to async/await ([#422](https://github.com/googleapis/nodejs-storage/pull/422))
- build: samples test by adding approprate test variables ([#423](https://github.com/googleapis/nodejs-storage/pull/423))
- build: bring in latest kokoro cfgs to run System tests on PRs ([#413](https://github.com/googleapis/nodejs-storage/pull/413))
- test: remove appveyor config ([#411](https://github.com/googleapis/nodejs-storage/pull/411))
- Enable prefer-const in the eslint config ([#404](https://github.com/googleapis/nodejs-storage/pull/404))
- fix(test): instantiate PubSub using new ([#403](https://github.com/googleapis/nodejs-storage/pull/403))
- fix: optionsOrCallback could be undefined if not given, check before assign ([#401](https://github.com/googleapis/nodejs-storage/pull/401))
- Fix the requesterPays methods ([#400](https://github.com/googleapis/nodejs-storage/pull/400))
- Enable no-var in eslint ([#398](https://github.com/googleapis/nodejs-storage/pull/398))
- samples: don't use USA formatted dates for expiry ([#396](https://github.com/googleapis/nodejs-storage/pull/396))
- fix: copy(): Use correct destination file name in URI ([#389](https://github.com/googleapis/nodejs-storage/pull/389))
## v2.0.3

@@ -70,4 +114,4 @@

### `bucket.upload` method removed
To better support a variety of HTTP clients, the `bucket.upload` method has been removed. It can be replaced with your favorite HTTP client.
### `bucket.upload` no longer accepts URLs
To better support a variety of HTTP clients, the remote fetching functionality of `bucket.upload` has been removed. It can be replaced with your favorite HTTP client.

@@ -74,0 +118,0 @@ #### Old Code

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

@@ -12,5 +12,5 @@ "author": "Google Inc.",

"main": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"files": [
"build/src",
"!build/src/**/*.map",
"AUTHORS",

@@ -54,2 +54,3 @@ "CONTRIBUTORS",

"Tyler Johnson <mail@tyler-johnson.ca>",
"Thomas den Hollander <denhollander.thomas@gmail.com>",
"Zach Bjornson <bjornson@stanford.edu>",

@@ -62,7 +63,8 @@ "greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>"

"generate-scaffolding": "repo-tools generate all && repo-tools generate lib_samples_readme -l samples/ --config ../.cloud-repo-tools.json",
"system-test": "mocha system-test/ --timeout 600000",
"system-test": "mocha build/system-test --timeout 600000",
"presystem-test": "npm run compile",
"test-only": "nyc mocha build/test",
"test": "npm run test-only",
"pretest-only": "npm run compile",
"lint": "eslint samples/ system-test/ && gts check",
"lint": "eslint samples/ && gts check",
"samples-test": "npm link && cd samples/ && npm link ../ && npm test && cd ../",

@@ -73,3 +75,3 @@ "all-test": "npm test && npm run system-test && npm run samples-test",

"compile": "tsc -p .",
"fix": "gts fix",
"fix": "gts fix && eslint --fix samples/**/*.js",
"prepare": "npm run compile"

@@ -117,2 +119,3 @@ },

"@types/mocha": "^5.2.3",
"@types/nock": "^9.3.0",
"@types/once": "^1.4.0",

@@ -129,3 +132,3 @@ "@types/proxyquire": "^1.3.28",

"eslint-plugin-node": "^7.0.0",
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-prettier": "^3.0.0",
"gts": "^0.8.0",

@@ -136,2 +139,3 @@ "ink-docstrap": "https://github.com/docstrap/docstrap/tarball/master",

"mocha": "^5.0.0",
"nock": "^10.0.1",
"node-fetch": "^2.2.0",

@@ -146,5 +150,5 @@ "normalize-newline": "^3.0.0",

"tmp": "^0.0.33",
"typescript": "^3.0.1",
"typescript": "~3.1.1",
"uuid": "^3.1.0"
}
}

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

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