Socket
Socket
Sign inDemoInstall

@google-cloud/storage

Package Overview
Dependencies
Maintainers
1
Versions
182
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.12.0 to 7.0.0

32

build/src/acl.d.ts

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

import { BodyResponseCallback, DecorateRequestOptions, Metadata } from './nodejs-common';
import { BodyResponseCallback, DecorateRequestOptions, BaseMetadata } from './nodejs-common';
export interface AclOptions {

@@ -8,6 +8,6 @@ pathPrefix: string;

AccessControlObject | AccessControlObject[],
Metadata
AclMetadata
];
export interface GetAclCallback {
(err: Error | null, acl?: AccessControlObject | AccessControlObject[] | null, apiResponse?: Metadata): void;
(err: Error | null, acl?: AccessControlObject | AccessControlObject[] | null, apiResponse?: AclMetadata): void;
}

@@ -25,5 +25,5 @@ export interface GetAclOptions {

}
export type UpdateAclResponse = [AccessControlObject, Metadata];
export type UpdateAclResponse = [AccessControlObject, AclMetadata];
export interface UpdateAclCallback {
(err: Error | null, acl?: AccessControlObject | null, apiResponse?: Metadata): void;
(err: Error | null, acl?: AccessControlObject | null, apiResponse?: AclMetadata): void;
}

@@ -36,9 +36,9 @@ export interface AddAclOptions {

}
export type AddAclResponse = [AccessControlObject, Metadata];
export type AddAclResponse = [AccessControlObject, AclMetadata];
export interface AddAclCallback {
(err: Error | null, acl?: AccessControlObject | null, apiResponse?: Metadata): void;
(err: Error | null, acl?: AccessControlObject | null, apiResponse?: AclMetadata): void;
}
export type RemoveAclResponse = [Metadata];
export type RemoveAclResponse = [AclMetadata];
export interface RemoveAclCallback {
(err: Error | null, apiResponse?: Metadata): void;
(err: Error | null, apiResponse?: AclMetadata): void;
}

@@ -55,2 +55,16 @@ export interface RemoveAclOptions {

}
export interface AclMetadata extends BaseMetadata {
bucket?: string;
domain?: string;
entity?: string;
entityId?: string;
generation?: string;
object?: string;
projectTeam?: {
projectNumber?: string;
team?: 'editors' | 'owners' | 'viewers';
};
role?: 'OWNER' | 'READER' | 'WRITER' | 'FULL_CONTROL';
[key: string]: unknown;
}
/**

@@ -57,0 +71,0 @@ * Attach functionality to a {@link Storage.acl} instance. This will add an

@@ -719,2 +719,1 @@ "use strict";

});
//# sourceMappingURL=acl.js.map

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

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

@@ -18,6 +19,6 @@ import { File, FileOptions, CreateResumableUploadOptions, CreateWriteStreamOptions } from './file';

import { URL } from 'url';
import { SetMetadataOptions } from './nodejs-common/service-object';
export type GetFilesResponse = [File[], {}, Metadata];
import { BaseMetadata, SetMetadataOptions } from './nodejs-common/service-object';
export type GetFilesResponse = [File[], {}, unknown];
export interface GetFilesCallback {
(err: Error | null, files?: File[], nextQuery?: {}, apiResponse?: Metadata): void;
(err: Error | null, files?: File[], nextQuery?: {}, apiResponse?: unknown): void;
}

@@ -36,12 +37,40 @@ interface WatchAllOptions {

}
export interface LifecycleRule {
action: {
type: string;
storageClass?: string;
} | string;
condition: {
[key: string]: boolean | Date | number | string | string[];
};
export interface LifecycleAction {
type: 'Delete' | 'SetStorageClass' | 'AbortIncompleteMultipartUpload';
storageClass?: string;
}
export interface LifecycleCondition {
age?: number;
createdBefore?: Date | string;
customTimeBefore?: Date | string;
daysSinceCustomTime?: number;
daysSinceNoncurrentTime?: number;
isLive?: boolean;
matchesPrefix?: string[];
matchesSuffix?: string[];
matchesStorageClass?: string[];
noncurrentTimeBefore?: Date | string;
numNewerVersions?: number;
}
export interface LifecycleRule {
action: LifecycleAction;
condition: LifecycleCondition;
}
export interface LifecycleCondition {
age?: number;
createdBefore?: Date | string;
customTimeBefore?: Date | string;
daysSinceCustomTime?: number;
daysSinceNoncurrentTime?: number;
isLive?: boolean;
matchesPrefix?: string[];
matchesSuffix?: string[];
matchesStorageClass?: string[];
noncurrentTimeBefore?: Date | string;
numNewerVersions?: number;
}
export interface LifecycleRule {
action: LifecycleAction;
condition: LifecycleCondition;
}
export interface EnableLoggingOptions extends PreconditionOptions {

@@ -70,5 +99,5 @@ bucket?: string | Bucket;

export interface CombineCallback {
(err: Error | null, newFile: File | null, apiResponse: Metadata): void;
(err: Error | null, newFile: File | null, apiResponse: unknown): void;
}
export type CombineResponse = [File, Metadata];
export type CombineResponse = [File, unknown];
export interface CreateChannelConfig extends WatchAllOptions {

@@ -80,5 +109,5 @@ address: string;

}
export type CreateChannelResponse = [Channel, Metadata];
export type CreateChannelResponse = [Channel, unknown];
export interface CreateChannelCallback {
(err: Error | null, channel: Channel | null, apiResponse: Metadata): void;
(err: Error | null, channel: Channel | null, apiResponse: unknown): void;
}

@@ -95,5 +124,5 @@ export interface CreateNotificationOptions {

export interface CreateNotificationCallback {
(err: Error | null, notification: Notification | null, apiResponse: Metadata): void;
(err: Error | null, notification: Notification | null, apiResponse: unknown): void;
}
export type CreateNotificationResponse = [Notification, Metadata];
export type CreateNotificationResponse = [Notification, unknown];
export interface DeleteBucketOptions {

@@ -103,5 +132,5 @@ ignoreNotFound?: boolean;

}
export type DeleteBucketResponse = [Metadata];
export type DeleteBucketResponse = [unknown];
export interface DeleteBucketCallback extends DeleteCallback {
(err: Error | null, apiResponse: Metadata): void;
(err: Error | null, apiResponse: unknown): void;
}

@@ -114,13 +143,13 @@ export interface DeleteFilesOptions extends GetFilesOptions, PreconditionOptions {

}
export type DeleteLabelsResponse = [Metadata];
export type DeleteLabelsResponse = [unknown];
export type DeleteLabelsCallback = SetLabelsCallback;
export type DeleteLabelsOptions = PreconditionOptions;
export type DisableRequesterPaysOptions = PreconditionOptions;
export type DisableRequesterPaysResponse = [Metadata];
export type DisableRequesterPaysResponse = [unknown];
export interface DisableRequesterPaysCallback {
(err?: Error | null, apiResponse?: object): void;
}
export type EnableRequesterPaysResponse = [Metadata];
export type EnableRequesterPaysResponse = [unknown];
export interface EnableRequesterPaysCallback {
(err?: Error | null, apiResponse?: Metadata): void;
(err?: Error | null, apiResponse?: unknown): void;
}

@@ -136,5 +165,5 @@ export type EnableRequesterPaysOptions = PreconditionOptions;

}
export type GetBucketResponse = [Bucket, Metadata];
export type GetBucketResponse = [Bucket, unknown];
export interface GetBucketCallback {
(err: ApiError | null, bucket: Bucket | null, apiResponse: Metadata): void;
(err: ApiError | null, bucket: Bucket | null, apiResponse: unknown): void;
}

@@ -144,9 +173,70 @@ export interface GetLabelsOptions {

}
export type GetLabelsResponse = [Metadata];
export type GetLabelsResponse = [unknown];
export interface GetLabelsCallback {
(err: Error | null, labels: object | null): void;
}
export type GetBucketMetadataResponse = [Metadata, Metadata];
export interface BucketMetadata extends BaseMetadata {
acl?: AclMetadata[] | null;
autoclass?: {
enabled?: boolean;
toggleTime?: string;
};
billing?: {
requesterPays?: boolean;
};
cors?: Cors[];
customPlacementConfig?: {
dataLocations?: string[];
};
defaultEventBasedHold?: boolean;
defaultObjectAcl?: AclMetadata[];
encryption?: {
defaultKmsKeyName?: string;
} | null;
iamConfiguration?: {
publicAccessPrevention?: string;
uniformBucketLevelAccess?: {
enabled?: boolean;
lockedTime?: string;
};
};
labels?: {
[key: string]: string | null;
};
lifecycle?: {
rule?: LifecycleRule[];
} | null;
location?: string;
locationType?: string;
logging?: {
logBucket?: string;
logObjectPrefix?: string;
};
metageneration?: string;
name?: string;
owner?: {
entity?: string;
entityId?: string;
};
projectNumber?: string | number;
retentionPolicy?: {
effectiveTime?: string;
isLocked?: boolean;
retentionPeriod?: string | number;
} | null;
rpo?: string;
storageClass?: string;
timeCreated?: string;
updated?: string;
versioning?: {
enabled?: boolean;
};
website?: {
mainPageSuffix?: string;
notFoundPage?: string;
};
}
export type GetBucketMetadataResponse = [BucketMetadata, unknown];
export interface GetBucketMetadataCallback {
(err: ApiError | null, metadata: Metadata | null, apiResponse: Metadata): void;
(err: ApiError | null, metadata: BucketMetadata | null, apiResponse: unknown): void;
}

@@ -176,9 +266,9 @@ export interface GetBucketMetadataOptions {

export interface GetNotificationsCallback {
(err: Error | null, notifications: Notification[] | null, apiResponse: Metadata): void;
(err: Error | null, notifications: Notification[] | null, apiResponse: unknown): void;
}
export type GetNotificationsResponse = [Notification[], Metadata];
export type GetNotificationsResponse = [Notification[], unknown];
export interface MakeBucketPrivateOptions {
includeFiles?: boolean;
force?: boolean;
metadata?: Metadata;
metadata?: BucketMetadata;
userProject?: string;

@@ -202,10 +292,10 @@ preconditionOpts?: PreconditionOptions;

}
export type SetBucketMetadataResponse = [Metadata];
export type SetBucketMetadataResponse = [BucketMetadata];
export interface SetBucketMetadataCallback {
(err?: Error | null, metadata?: Metadata): void;
(err?: Error | null, metadata?: BucketMetadata): void;
}
export interface BucketLockCallback {
(err?: Error | null, apiResponse?: Metadata): void;
(err?: Error | null, apiResponse?: unknown): void;
}
export type BucketLockResponse = [Metadata];
export type BucketLockResponse = [unknown];
export interface Labels {

@@ -217,5 +307,5 @@ [key: string]: string;

}
export type SetLabelsResponse = [Metadata];
export type SetLabelsResponse = [unknown];
export interface SetLabelsCallback {
(err?: Error | null, metadata?: Metadata): void;
(err?: Error | null, metadata?: unknown): void;
}

@@ -228,5 +318,5 @@ export interface SetBucketStorageClassOptions extends PreconditionOptions {

}
export type UploadResponse = [File, Metadata];
export type UploadResponse = [File, unknown];
export interface UploadCallback {
(err: Error | null, file?: File | null, apiResponse?: Metadata): void;
(err: Error | null, file?: File | null, apiResponse?: unknown): void;
}

@@ -253,3 +343,2 @@ export interface UploadOptions extends CreateResumableUploadOptions, CreateWriteStreamOptions {

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.",

@@ -538,4 +627,3 @@ CONFIGURATION_OBJECT_PREFIX_REQUIRED = "A configuration object with a prefix is required.",

*/
declare class Bucket extends ServiceObject {
metadata: Metadata;
declare class Bucket extends ServiceObject<Bucket, BucketMetadata> {
name: string;

@@ -671,3 +759,3 @@ /**

removeRetentionPeriod(options: SetBucketMetadataOptions, callback: SetBucketMetadataCallback): void;
request(reqOpts: DecorateRequestOptions): Promise<[ResponseBody, Metadata]>;
request(reqOpts: DecorateRequestOptions): Promise<RequestResponse>;
request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;

@@ -677,5 +765,5 @@ setLabels(labels: Labels, options?: SetLabelsOptions): Promise<SetLabelsResponse>;

setLabels(labels: Labels, options: SetLabelsOptions, callback: SetLabelsCallback): void;
setMetadata(metadata: Metadata, options?: SetMetadataOptions): Promise<SetMetadataResponse>;
setMetadata(metadata: Metadata, callback: MetadataCallback): void;
setMetadata(metadata: Metadata, options: SetMetadataOptions, callback: MetadataCallback): void;
setMetadata(metadata: BucketMetadata, options?: SetMetadataOptions): Promise<SetMetadataResponse<BucketMetadata>>;
setMetadata(metadata: BucketMetadata, callback: MetadataCallback<BucketMetadata>): void;
setMetadata(metadata: BucketMetadata, options: SetMetadataOptions, callback: MetadataCallback<BucketMetadata>): void;
setRetentionPeriod(duration: number, options?: SetBucketMetadataOptions): Promise<SetBucketMetadataResponse>;

@@ -682,0 +770,0 @@ setRetentionPeriod(duration: number, callback: SetBucketMetadataCallback): void;

@@ -1,5 +0,5 @@

import { Metadata, ServiceObject } from './nodejs-common';
import { BaseMetadata, ServiceObject } from './nodejs-common';
import { Storage } from './storage';
export interface StopCallback {
(err: Error | null, apiResponse?: Metadata): void;
(err: Error | null, apiResponse?: unknown): void;
}

@@ -23,5 +23,5 @@ /**

*/
declare class Channel extends ServiceObject {
declare class Channel extends ServiceObject<Channel, BaseMetadata> {
constructor(storage: Storage, id: string, resourceId: string);
stop(): Promise<Metadata>;
stop(): Promise<unknown>;
stop(callback: StopCallback): void;

@@ -28,0 +28,0 @@ }

@@ -105,2 +105,1 @@ "use strict";

(0, promisify_1.promisifyAll)(Channel);
//# sourceMappingURL=channel.js.map

@@ -255,2 +255,1 @@ "use strict";

CRC32C.CRC32C_EXTENSION_TABLE = CRC32C_EXTENSION_TABLE;
//# sourceMappingURL=crc32c.js.map

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

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

@@ -11,12 +11,12 @@ import * as http from 'http';

import { AvailableServiceObjectMethods, Bucket } from './bucket';
import { Acl } from './acl';
import { Acl, AclMetadata } from './acl';
import { GetSignedUrlResponse, GetSignedUrlCallback, URLSigner, Query } from './signer';
import { ResponseBody, Duplexify } from './nodejs-common/util';
import { Duplexify } from './nodejs-common/util';
import { CRC32CValidatorGenerator } from './crc32c';
import { URL } from 'url';
import { DeleteCallback, DeleteOptions, SetMetadataOptions } from './nodejs-common/service-object';
import { BaseMetadata, DeleteCallback, DeleteOptions, RequestResponse, SetMetadataOptions } from './nodejs-common/service-object';
import * as r from 'teeny-request';
export type GetExpirationDateResponse = [Date];
export interface GetExpirationDateCallback {
(err: Error | null, expirationDate?: Date | null, apiResponse?: Metadata): void;
(err: Error | null, expirationDate?: Date | null, apiResponse?: unknown): void;
}

@@ -80,5 +80,5 @@ export interface PolicyDocument {

}
export type GetFileMetadataResponse = [Metadata, Metadata];
export type GetFileMetadataResponse = [FileMetadata, unknown];
export interface GetFileMetadataCallback {
(err: Error | null, metadata?: Metadata, apiResponse?: Metadata): void;
(err: Error | null, metadata?: FileMetadata, apiResponse?: unknown): void;
}

@@ -88,5 +88,5 @@ export interface GetFileOptions extends GetConfig {

}
export type GetFileResponse = [File, Metadata];
export type GetFileResponse = [File, unknown];
export interface GetFileCallback {
(err: Error | null, file?: File, apiResponse?: Metadata): void;
(err: Error | null, file?: File, apiResponse?: unknown): void;
}

@@ -104,5 +104,5 @@ export interface FileExistsOptions {

}
export type DeleteFileResponse = [Metadata];
export type DeleteFileResponse = [unknown];
export interface DeleteFileCallback {
(err: Error | null, apiResponse?: Metadata): void;
(err: Error | null, apiResponse?: unknown): void;
}

@@ -113,3 +113,3 @@ export type PredefinedAcl = 'authenticatedRead' | 'bucketOwnerFullControl' | 'bucketOwnerRead' | 'private' | 'projectPrivate' | 'publicRead';

highWaterMark?: number;
metadata?: Metadata;
metadata?: FileMetadata;
origin?: string;

@@ -136,3 +136,3 @@ offset?: number;

export interface MakeFilePrivateOptions {
metadata?: Metadata;
metadata?: FileMetadata;
strict?: boolean;

@@ -142,3 +142,3 @@ userProject?: string;

}
export type MakeFilePrivateResponse = [Metadata];
export type MakeFilePrivateResponse = [unknown];
export type MakeFilePrivateCallback = SetFileMetadataCallback;

@@ -149,9 +149,9 @@ export interface IsPublicCallback {

export type IsPublicResponse = [boolean];
export type MakeFilePublicResponse = [Metadata];
export type MakeFilePublicResponse = [unknown];
export interface MakeFilePublicCallback {
(err?: Error | null, apiResponse?: Metadata): void;
(err?: Error | null, apiResponse?: unknown): void;
}
export type MoveResponse = [Metadata];
export type MoveResponse = [unknown];
export interface MoveCallback {
(err: Error | null, destinationFile?: File | null, apiResponse?: Metadata): void;
(err: Error | null, destinationFile?: File | null, apiResponse?: unknown): void;
}

@@ -197,3 +197,3 @@ export interface MoveOptions {

destinationKmsKeyName?: string;
metadata?: Metadata;
metadata?: FileMetadata;
predefinedAcl?: string;

@@ -204,5 +204,5 @@ token?: string;

}
export type CopyResponse = [File, Metadata];
export type CopyResponse = [File, unknown];
export interface CopyCallback {
(err: Error | null, file?: File | null, apiResponse?: Metadata): void;
(err: Error | null, file?: File | null, apiResponse?: unknown): void;
}

@@ -231,6 +231,6 @@ export type DownloadResponse = [Buffer];

export interface SetFileMetadataCallback {
(err?: Error | null, apiResponse?: Metadata): void;
(err?: Error | null, apiResponse?: unknown): void;
}
export type SetFileMetadataResponse = [Metadata];
export type SetStorageClassResponse = [Metadata];
export type SetFileMetadataResponse = [unknown];
export type SetStorageClassResponse = [unknown];
export interface SetStorageClassOptions {

@@ -241,4 +241,42 @@ userProject?: string;

export interface SetStorageClassCallback {
(err?: Error | null, apiResponse?: Metadata): void;
(err?: Error | null, apiResponse?: unknown): void;
}
export interface FileMetadata extends BaseMetadata {
acl?: AclMetadata[] | null;
bucket?: string;
cacheControl?: string;
componentCount?: number;
contentDisposition?: string;
contentEncoding?: string;
contentLanguage?: string;
contentType?: string;
crc32c?: string;
customerEncryption?: {
encryptionAlgorithm?: string;
keySha256?: string;
};
customTime?: string;
eventBasedHold?: boolean | null;
generation?: string | number;
kmsKeyName?: string;
md5Hash?: string;
mediaLink?: string;
metadata?: {
[key: string]: string;
};
metageneration?: string | number;
name?: string;
owner?: {
entity?: string;
entityId?: string;
};
retentionExpirationTime?: string;
size?: string | number;
storageClass?: string;
temporaryHold?: boolean | null;
timeCreated?: string;
timeDeleted?: string;
timeStorageClassUpdated?: string;
updated?: string;
}
export declare class RequestError extends Error {

@@ -266,3 +304,3 @@ code?: string;

*/
declare class File extends ServiceObject<File> {
declare class File extends ServiceObject<File, FileMetadata> {
#private;

@@ -276,3 +314,2 @@ acl: Acl;

signer?: URLSigner;
metadata: Metadata;
name: string;

@@ -808,3 +845,3 @@ generation?: number;

rename(destinationFile: string | File, options: RenameOptions, callback: RenameCallback): void;
request(reqOpts: DecorateRequestOptions): Promise<[ResponseBody, Metadata]>;
request(reqOpts: DecorateRequestOptions): Promise<RequestResponse>;
request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;

@@ -817,5 +854,5 @@ rotateEncryptionKey(options?: RotateEncryptionKeyOptions): Promise<RotateEncryptionKeyResponse>;

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;
setMetadata(metadata: FileMetadata, options?: SetMetadataOptions): Promise<SetMetadataResponse<FileMetadata>>;
setMetadata(metadata: FileMetadata, callback: MetadataCallback<FileMetadata>): void;
setMetadata(metadata: FileMetadata, options: SetMetadataOptions, callback: MetadataCallback<FileMetadata>): void;
setStorageClass(storageClass: string, options?: SetStorageClassOptions): Promise<SetStorageClassResponse>;

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

*/
startResumableUpload_(dup: Duplexify, options: CreateResumableUploadOptions): void;
startResumableUpload_(dup: Duplexify, options?: CreateResumableUploadOptions): void;
/**

@@ -852,0 +889,0 @@ * Takes a readable stream and pipes it to a remote file. Unlike

@@ -108,2 +108,1 @@ "use strict";

_HashStreamValidator_crc32cHash = new WeakMap(), _HashStreamValidator_md5Hash = new WeakMap(), _HashStreamValidator_md5Digest = new WeakMap();
//# sourceMappingURL=hash-stream-validator.js.map

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

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

@@ -7,6 +7,5 @@ export interface HmacKeyOptions {

}
export interface HmacKeyMetadata {
accessId: string;
export interface HmacKeyMetadata extends BaseMetadata {
accessId?: string;
etag?: string;
id?: string;
projectId?: string;

@@ -29,5 +28,5 @@ serviceAccountEmail?: string;

export interface HmacKeyMetadataCallback {
(err: Error | null, metadata?: HmacKeyMetadata, apiResponse?: Metadata): void;
(err: Error | null, metadata?: HmacKeyMetadata, apiResponse?: unknown): void;
}
export type HmacKeyMetadataResponse = [HmacKeyMetadata, Metadata];
export type HmacKeyMetadataResponse = [HmacKeyMetadata, unknown];
/**

@@ -51,4 +50,3 @@ * The API-formatted resource description of the HMAC key.

*/
export declare class HmacKey extends ServiceObject<HmacKeyMetadata | undefined> {
metadata: HmacKeyMetadata | undefined;
export declare class HmacKey extends ServiceObject<HmacKey, HmacKeyMetadata> {
/**

@@ -95,5 +93,5 @@ * A reference to the {@link Storage} associated with this {@link HmacKey}

*/
setMetadata(metadata: Metadata, options?: SetMetadataOptions): Promise<SetMetadataResponse>;
setMetadata(metadata: Metadata, callback: MetadataCallback): void;
setMetadata(metadata: Metadata, options: SetMetadataOptions, callback: MetadataCallback): void;
setMetadata(metadata: HmacKeyMetadata, options?: SetMetadataOptions): Promise<SetMetadataResponse<HmacKeyMetadata>>;
setMetadata(metadata: HmacKeyMetadata, callback: MetadataCallback<HmacKeyMetadata>): void;
setMetadata(metadata: HmacKeyMetadata, options: SetMetadataOptions, callback: MetadataCallback<HmacKeyMetadata>): void;
}

@@ -337,2 +337,1 @@ "use strict";

(0, promisify_1.promisifyAll)(HmacKey);
//# sourceMappingURL=hmacKey.js.map

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

import { Metadata } from './nodejs-common';
import { Bucket } from './bucket';

@@ -7,3 +6,3 @@ export interface GetPolicyOptions {

}
export type GetPolicyResponse = [Policy, Metadata];
export type GetPolicyResponse = [Policy, unknown];
/**

@@ -16,3 +15,3 @@ * @callback GetPolicyCallback

export interface GetPolicyCallback {
(err?: Error | null, acl?: Policy, apiResponse?: Metadata): void;
(err?: Error | null, acl?: Policy, apiResponse?: unknown): void;
}

@@ -32,3 +31,3 @@ /**

*/
export type SetPolicyResponse = [Policy, Metadata];
export type SetPolicyResponse = [Policy, unknown];
/**

@@ -65,3 +64,3 @@ * @callback SetPolicyCallback

[key: string]: boolean;
}, Metadata];
}, unknown];
/**

@@ -76,3 +75,3 @@ * @callback TestIamPermissionsCallback

[key: string]: boolean;
} | null, apiResponse?: Metadata): void;
} | null, apiResponse?: unknown): void;
}

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

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

IAMExceptionMessages["PERMISSIONS_REQUIRED"] = "Permissions are required.";
})(IAMExceptionMessages = exports.IAMExceptionMessages || (exports.IAMExceptionMessages = {}));
})(IAMExceptionMessages || (exports.IAMExceptionMessages = IAMExceptionMessages = {}));
/**

@@ -308,2 +308,1 @@ * Get and set IAM policies for your Cloud Storage bucket.

(0, promisify_1.promisifyAll)(Iam);
//# sourceMappingURL=iam.js.map

@@ -45,7 +45,7 @@ /**

*/
export { AccessControlObject, AclOptions, AddAclCallback, AddAclOptions, AddAclResponse, GetAclCallback, GetAclOptions, GetAclResponse, RemoveAclCallback, RemoveAclOptions, RemoveAclResponse, UpdateAclCallback, UpdateAclOptions, UpdateAclResponse, } from './acl';
export { Bucket, BucketExistsCallback, BucketExistsOptions, BucketExistsResponse, BucketLockCallback, BucketLockResponse, CombineCallback, CombineOptions, CombineResponse, CreateChannelCallback, CreateChannelConfig, CreateChannelOptions, CreateChannelResponse, CreateNotificationCallback, CreateNotificationOptions, CreateNotificationResponse, DeleteBucketCallback, DeleteBucketOptions, DeleteBucketResponse, DeleteFilesCallback, DeleteFilesOptions, DeleteLabelsCallback, DeleteLabelsResponse, DisableRequesterPaysCallback, DisableRequesterPaysResponse, EnableRequesterPaysCallback, EnableRequesterPaysResponse, GetBucketCallback, GetBucketMetadataCallback, GetBucketMetadataOptions, GetBucketMetadataResponse, GetBucketOptions, GetBucketResponse, GetBucketSignedUrlConfig, GetFilesCallback, GetFilesOptions, GetFilesResponse, GetLabelsCallback, GetLabelsOptions, GetLabelsResponse, GetNotificationsCallback, GetNotificationsOptions, GetNotificationsResponse, Labels, MakeBucketPrivateCallback, MakeBucketPrivateOptions, MakeBucketPrivateResponse, MakeBucketPublicCallback, MakeBucketPublicOptions, MakeBucketPublicResponse, SetBucketMetadataCallback, SetBucketMetadataOptions, SetBucketMetadataResponse, SetBucketStorageClassCallback, SetBucketStorageClassOptions, SetLabelsCallback, SetLabelsOptions, SetLabelsResponse, UploadCallback, UploadOptions, UploadResponse, } from './bucket';
export { AclMetadata, AccessControlObject, AclOptions, AddAclCallback, AddAclOptions, AddAclResponse, GetAclCallback, GetAclOptions, GetAclResponse, RemoveAclCallback, RemoveAclOptions, RemoveAclResponse, UpdateAclCallback, UpdateAclOptions, UpdateAclResponse, } from './acl';
export { Bucket, BucketExistsCallback, BucketExistsOptions, BucketExistsResponse, BucketLockCallback, BucketLockResponse, BucketMetadata, CombineCallback, CombineOptions, CombineResponse, CreateChannelCallback, CreateChannelConfig, CreateChannelOptions, CreateChannelResponse, CreateNotificationCallback, CreateNotificationOptions, CreateNotificationResponse, DeleteBucketCallback, DeleteBucketOptions, DeleteBucketResponse, DeleteFilesCallback, DeleteFilesOptions, DeleteLabelsCallback, DeleteLabelsResponse, DisableRequesterPaysCallback, DisableRequesterPaysResponse, EnableRequesterPaysCallback, EnableRequesterPaysResponse, GetBucketCallback, GetBucketMetadataCallback, GetBucketMetadataOptions, GetBucketMetadataResponse, GetBucketOptions, GetBucketResponse, GetBucketSignedUrlConfig, GetFilesCallback, GetFilesOptions, GetFilesResponse, GetLabelsCallback, GetLabelsOptions, GetLabelsResponse, GetNotificationsCallback, GetNotificationsOptions, GetNotificationsResponse, Labels, MakeBucketPrivateCallback, MakeBucketPrivateOptions, MakeBucketPrivateResponse, MakeBucketPublicCallback, MakeBucketPublicOptions, MakeBucketPublicResponse, SetBucketMetadataCallback, SetBucketMetadataOptions, SetBucketMetadataResponse, SetBucketStorageClassCallback, SetBucketStorageClassOptions, SetLabelsCallback, SetLabelsOptions, SetLabelsResponse, UploadCallback, UploadOptions, UploadResponse, } from './bucket';
export * from './crc32c';
export { Channel, StopCallback } from './channel';
export { CopyCallback, CopyOptions, CopyResponse, CreateReadStreamOptions, CreateResumableUploadCallback, CreateResumableUploadOptions, CreateResumableUploadResponse, CreateWriteStreamOptions, DeleteFileCallback, DeleteFileOptions, DeleteFileResponse, DownloadCallback, DownloadOptions, DownloadResponse, EncryptionKeyOptions, File, FileExistsCallback, FileExistsOptions, FileExistsResponse, FileOptions, GetExpirationDateCallback, GetExpirationDateResponse, GetFileCallback, GetFileMetadataCallback, GetFileMetadataOptions, GetFileMetadataResponse, GetFileOptions, GetFileResponse, GenerateSignedPostPolicyV2Callback, GenerateSignedPostPolicyV2Options, GenerateSignedPostPolicyV2Response, GenerateSignedPostPolicyV4Callback, GenerateSignedPostPolicyV4Options, GenerateSignedPostPolicyV4Response, GetSignedUrlConfig, MakeFilePrivateCallback, MakeFilePrivateOptions, MakeFilePrivateResponse, MakeFilePublicCallback, MakeFilePublicResponse, MoveCallback, MoveOptions, MoveResponse, PolicyDocument, PolicyFields, PredefinedAcl, RotateEncryptionKeyCallback, RotateEncryptionKeyOptions, RotateEncryptionKeyResponse, SaveCallback, SaveOptions, SetFileMetadataCallback, SetFileMetadataOptions, SetFileMetadataResponse, SetStorageClassCallback, SetStorageClassOptions, SetStorageClassResponse, SignedPostPolicyV4Output, } from './file';
export { CopyCallback, CopyOptions, CopyResponse, CreateReadStreamOptions, CreateResumableUploadCallback, CreateResumableUploadOptions, CreateResumableUploadResponse, CreateWriteStreamOptions, DeleteFileCallback, DeleteFileOptions, DeleteFileResponse, DownloadCallback, DownloadOptions, DownloadResponse, EncryptionKeyOptions, File, FileExistsCallback, FileExistsOptions, FileExistsResponse, FileMetadata, FileOptions, GetExpirationDateCallback, GetExpirationDateResponse, GetFileCallback, GetFileMetadataCallback, GetFileMetadataOptions, GetFileMetadataResponse, GetFileOptions, GetFileResponse, GenerateSignedPostPolicyV2Callback, GenerateSignedPostPolicyV2Options, GenerateSignedPostPolicyV2Response, GenerateSignedPostPolicyV4Callback, GenerateSignedPostPolicyV4Options, GenerateSignedPostPolicyV4Response, GetSignedUrlConfig, MakeFilePrivateCallback, MakeFilePrivateOptions, MakeFilePrivateResponse, MakeFilePublicCallback, MakeFilePublicResponse, MoveCallback, MoveOptions, MoveResponse, PolicyDocument, PolicyFields, PredefinedAcl, RotateEncryptionKeyCallback, RotateEncryptionKeyOptions, RotateEncryptionKeyResponse, SaveCallback, SaveOptions, SetFileMetadataCallback, SetFileMetadataOptions, SetFileMetadataResponse, SetStorageClassCallback, SetStorageClassOptions, SetStorageClassResponse, SignedPostPolicyV4Output, } from './file';
export * from './hash-stream-validator';

@@ -52,0 +52,0 @@ export { HmacKey, HmacKeyMetadata, HmacKeyMetadataCallback, HmacKeyMetadataResponse, SetHmacKeyMetadata, SetHmacKeyMetadataOptions, } from './hmacKey';

@@ -49,2 +49,1 @@ "use strict";

__exportStar(require("./transfer-manager"), exports);
//# sourceMappingURL=index.js.map

@@ -18,3 +18,3 @@ /*!

export { Service, ServiceConfig, ServiceOptions, StreamRequestOptions, } from './service';
export { DeleteCallback, ExistsCallback, GetConfig, InstanceResponseCallback, Interceptor, Metadata, MetadataCallback, MetadataResponse, Methods, ResponseCallback, ServiceObject, ServiceObjectConfig, ServiceObjectParent, SetMetadataResponse, } from './service-object';
export { BaseMetadata, DeleteCallback, ExistsCallback, GetConfig, InstanceResponseCallback, Interceptor, MetadataCallback, MetadataResponse, Methods, ResponseCallback, ServiceObject, ServiceObjectConfig, ServiceObjectParent, SetMetadataResponse, } from './service-object';
export { Abortable, AbortableDuplex, ApiError, BodyResponseCallback, DecorateRequestOptions, ResponseBody, util, } from './util';

@@ -11,2 +11,1 @@ "use strict";

Object.defineProperty(exports, "util", { enumerable: true, get: function () { return util_1.util; } });
//# sourceMappingURL=index.js.map

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

import { ApiError, BodyResponseCallback, DecorateRequestOptions } from './util';
export type RequestResponse = [Metadata, r.Response];
export type RequestResponse = [unknown, r.Response];
export interface ServiceObjectParent {

@@ -17,5 +17,4 @@ interceptors: Interceptor[];

export type GetMetadataOptions = object;
export type Metadata = any;
export type MetadataResponse = [Metadata, r.Response];
export type MetadataCallback = (err: Error | null, metadata?: Metadata, apiResponse?: r.Response) => void;
export type MetadataResponse<K> = [K, r.Response];
export type MetadataCallback<K> = (err: Error | null, metadata?: K, apiResponse?: r.Response) => void;
export type ExistsOptions = object;

@@ -71,6 +70,6 @@ export interface ExistsCallback {

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

@@ -86,3 +85,3 @@ export interface DeleteCallback {

}
type GetOrCreateOptions = GetConfig & CreateOptions;
export type GetOrCreateOptions = GetConfig & CreateOptions;
export type GetResponse<T> = [T, r.Response];

@@ -92,4 +91,11 @@ export interface ResponseCallback {

}
export type SetMetadataResponse = [Metadata];
export type SetMetadataResponse<K> = [K];
export type SetMetadataOptions = object;
export interface BaseMetadata {
id?: string;
kind?: string;
etag?: string;
selfLink?: string;
[key: string]: unknown;
}
/**

@@ -106,4 +112,4 @@ * ServiceObject is a base class, meant to be inherited from by a "service

*/
declare class ServiceObject<T = any> extends EventEmitter {
metadata: Metadata;
declare class ServiceObject<T, K extends BaseMetadata> extends EventEmitter {
metadata: K;
baseUrl?: string;

@@ -172,5 +178,5 @@ parent: ServiceObjectParent;

*/
getMetadata(options?: GetMetadataOptions): Promise<MetadataResponse>;
getMetadata(options: GetMetadataOptions, callback: MetadataCallback): void;
getMetadata(callback: MetadataCallback): void;
getMetadata(options?: GetMetadataOptions): Promise<MetadataResponse<K>>;
getMetadata(options: GetMetadataOptions, callback: MetadataCallback<K>): void;
getMetadata(callback: MetadataCallback<K>): void;
/**

@@ -189,5 +195,5 @@ * Return the user's custom request interceptors.

*/
setMetadata(metadata: Metadata, options?: SetMetadataOptions): Promise<SetMetadataResponse>;
setMetadata(metadata: Metadata, callback: MetadataCallback): void;
setMetadata(metadata: Metadata, options: SetMetadataOptions, callback: MetadataCallback): void;
setMetadata(metadata: K, options?: SetMetadataOptions): Promise<SetMetadataResponse<K>>;
setMetadata(metadata: K, callback: MetadataCallback<K>): void;
setMetadata(metadata: K, options: SetMetadataOptions, callback: MetadataCallback<K>): void;
/**

@@ -194,0 +200,0 @@ * Make an authenticated API request.

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

const events_1 = require("events");
const extend = require("extend");
const util_1 = require("./util");

@@ -120,2 +119,3 @@ /**

delete(optionsOrCallback, cb) {
var _a;
const [options, callback] = util_1.util.maybeOptionsOrCallback(optionsOrCallback, cb);

@@ -125,11 +125,14 @@ const ignoreNotFound = options.ignoreNotFound;

const methodConfig = (typeof this.methods.delete === 'object' && this.methods.delete) || {};
const reqOpts = extend(true, {
const reqOpts = {
method: 'DELETE',
uri: '',
}, methodConfig.reqOpts, {
qs: options,
});
...methodConfig.reqOpts,
qs: {
...(_a = methodConfig.reqOpts) === null || _a === void 0 ? void 0 : _a.qs,
...options,
},
};
// The `request` method may have been overridden to hold any special
// behavior. Ensure we call the original `request` method.
ServiceObject.prototype.request.call(this, reqOpts, (err, ...args) => {
ServiceObject.prototype.request.call(this, reqOpts, (err, body, res) => {
if (err) {

@@ -140,4 +143,3 @@ if (err.code === 404 && ignoreNotFound) {

}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
callback(err, ...args);
callback(err, res);
});

@@ -196,2 +198,3 @@ }

getMetadata(optionsOrCallback, cb) {
var _a;
const [options, callback] = util_1.util.maybeOptionsOrCallback(optionsOrCallback, cb);

@@ -201,7 +204,10 @@ const methodConfig = (typeof this.methods.getMetadata === 'object' &&

{};
const reqOpts = extend(true, {
const reqOpts = {
uri: '',
}, methodConfig.reqOpts, {
qs: options,
});
...methodConfig.reqOpts,
qs: {
...(_a = methodConfig.reqOpts) === null || _a === void 0 ? void 0 : _a.qs,
...options,
},
};
// The `request` method may have been overridden to hold any special

@@ -225,2 +231,3 @@ // behavior. Ensure we call the original `request` method.

setMetadata(metadata, optionsOrCallback, cb) {
var _a, _b;
const [options, callback] = util_1.util.maybeOptionsOrCallback(optionsOrCallback, cb);

@@ -230,9 +237,15 @@ const methodConfig = (typeof this.methods.setMetadata === 'object' &&

{};
const reqOpts = extend(true, {}, {
const reqOpts = {
method: 'PATCH',
uri: '',
}, methodConfig.reqOpts, {
json: metadata,
qs: options,
});
...methodConfig.reqOpts,
json: {
...(_a = methodConfig.reqOpts) === null || _a === void 0 ? void 0 : _a.json,
...metadata,
},
qs: {
...(_b = methodConfig.reqOpts) === null || _b === void 0 ? void 0 : _b.qs,
...options,
},
};
// The `request` method may have been overridden to hold any special

@@ -246,3 +259,3 @@ // behavior. Ensure we call the original `request` method.

request_(reqOpts, callback) {
reqOpts = extend(true, {}, reqOpts);
reqOpts = { ...reqOpts };
if (this.projectId) {

@@ -283,3 +296,3 @@ reqOpts.projectId = this.projectId;

requestStream(reqOpts) {
const opts = extend(true, reqOpts, { shouldReturnStream: true });
const opts = { ...reqOpts, shouldReturnStream: true };
return this.request_(opts);

@@ -290,2 +303,1 @@ }

(0, promisify_1.promisifyAll)(ServiceObject, { exclude: ['getRequestInterceptors'] });
//# sourceMappingURL=service-object.js.map

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

/*!
* Copyright 2022 Google LLC. 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 { AuthClient, GoogleAuth, GoogleAuthOptions } from 'google-auth-library';

@@ -2,0 +17,0 @@ import * as r from 'teeny-request';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Service = exports.DEFAULT_PROJECT_ID_TOKEN = void 0;
/*!
* Copyright 2022 Google LLC. 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.
*/
const extend = require("extend");
const uuid = require("uuid");

@@ -52,6 +36,7 @@ const util_1 = require("./util");

this.providedUserAgent = options.userAgent;
const reqCfg = extend({}, config, {
const reqCfg = {
...config,
projectIdRequired: this.projectIdRequired,
projectId: this.projectId,
authClient: options.authClient,
authClient: options.authClient || config.authClient,
credentials: options.credentials,

@@ -61,3 +46,3 @@ keyFile: options.keyFilename,

token: options.token,
});
};
this.makeAuthenticatedRequest =

@@ -102,3 +87,3 @@ util_1.util.makeAuthenticatedRequestFactory(reqCfg);

request_(reqOpts, callback) {
reqOpts = extend(true, {}, reqOpts, { timeout: this.timeout });
reqOpts = { ...reqOpts, timeout: this.timeout };
const isAbsoluteUrl = reqOpts.uri.indexOf('http') === 0;

@@ -148,6 +133,7 @@ const uriComponents = [this.baseUrl];

}
reqOpts.headers = extend({}, reqOpts.headers, {
reqOpts.headers = {
...reqOpts.headers,
'User-Agent': userAgent,
'x-goog-api-client': `${(0, util_2.getRuntimeTrackingString)()} gccl/${pkg.version} gccl-invocation-id/${uuid.v4()}`,
});
};
if (reqOpts.shouldReturnStream) {

@@ -177,3 +163,3 @@ return this.makeAuthenticatedRequest(reqOpts);

requestStream(reqOpts) {
const opts = extend(true, reqOpts, { shouldReturnStream: true });
const opts = { ...reqOpts, shouldReturnStream: true };
return Service.prototype.request_.call(this, opts);

@@ -183,2 +169,1 @@ }

exports.Service = Service;
//# sourceMappingURL=service.js.map

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

const ent = require("ent");
const extend = require("extend");
const google_auth_library_1 = require("google-auth-library");

@@ -157,3 +156,7 @@ const retryRequest = require("retry-request");

callback = callback || util.noop;
const parsedResp = extend(true, { err: err || null }, resp && util.parseHttpRespMessage(resp), body && util.parseHttpRespBody(body));
const parsedResp = {
err: err || null,
...(resp && util.parseHttpRespMessage(resp)),
...(body && util.parseHttpRespBody(body)),
};
// Assign the parsed body to resp.body, even if { json: false } was passed

@@ -236,2 +239,3 @@ // as a request option.

makeWritableStream(dup, options, onComplete) {
var _a;
onComplete = onComplete || util.noop;

@@ -250,3 +254,9 @@ const writeStream = new ProgressStream();

const metadata = options.metadata || {};
const reqOpts = extend(true, defaultReqOpts, options.request, {
const reqOpts = {
...defaultReqOpts,
...options.request,
qs: {
...defaultReqOpts.qs,
...(_a = options.request) === null || _a === void 0 ? void 0 : _a.qs,
},
multipart: [

@@ -262,3 +272,3 @@ {

],
});
};
options.makeAuthenticatedRequest(reqOpts, {

@@ -332,3 +342,3 @@ onAuthenticated(err, authenticatedReqOpts) {

makeAuthenticatedRequestFactory(config) {
const googleAutoAuthConfig = extend({}, config);
const googleAutoAuthConfig = { ...config };
if (googleAutoAuthConfig.projectId === service_1.DEFAULT_PROJECT_ID_TOKEN) {

@@ -353,3 +363,3 @@ delete googleAutoAuthConfig.projectId;

let projectId;
const reqConfig = extend({}, config);
const reqConfig = { ...config };
let activeRequest_;

@@ -672,2 +682,1 @@ if (!optionsOrCallback) {

exports.util = util;
//# sourceMappingURL=util.js.map

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

import { Metadata, MetadataCallback, ServiceObject } from './nodejs-common';
import { BaseMetadata, ServiceObject } from './nodejs-common';
import { ResponseBody } from './nodejs-common/util';

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

*/
export type GetNotificationMetadataResponse = [ResponseBody, Metadata];
export type GetNotificationMetadataResponse = [ResponseBody, unknown];
/**

@@ -24,3 +24,3 @@ * @callback GetNotificationMetadataCallback

export interface GetNotificationMetadataCallback {
(err: Error | null, metadata?: ResponseBody, apiResponse?: Metadata): void;
(err: Error | null, metadata?: ResponseBody, apiResponse?: unknown): void;
}

@@ -32,3 +32,3 @@ /**

*/
export type GetNotificationResponse = [Notification, Metadata];
export type GetNotificationResponse = [Notification, unknown];
export interface GetNotificationOptions {

@@ -51,3 +51,3 @@ /**

export interface GetNotificationCallback {
(err: Error | null, notification?: Notification | null, apiResponse?: Metadata): void;
(err: Error | null, notification?: Notification | null, apiResponse?: unknown): void;
}

@@ -60,4 +60,13 @@ /**

export interface DeleteNotificationCallback {
(err: Error | null, apiResponse?: Metadata): void;
(err: Error | null, apiResponse?: unknown): void;
}
export interface NotificationMetadata extends BaseMetadata {
custom_attributes?: {
[key: string]: string;
};
event_types?: string[];
object_name_prefix?: string;
payload_format?: 'JSON_API_V1' | 'NONE';
topic?: string;
}
/**

@@ -94,13 +103,4 @@ * The API-formatted resource description of the notification.

*/
declare class Notification extends ServiceObject {
declare class Notification extends ServiceObject<Notification, NotificationMetadata> {
constructor(bucket: Bucket, id: string);
delete(options?: DeleteNotificationOptions): Promise<[Metadata]>;
delete(options: DeleteNotificationOptions, callback: DeleteNotificationCallback): void;
delete(callback: DeleteNotificationCallback): void;
get(options?: GetNotificationOptions): Promise<GetNotificationResponse>;
get(options: GetNotificationOptions, callback: GetNotificationCallback): void;
get(callback: GetNotificationCallback): void;
getMetadata(options?: GetNotificationMetadataOptions): Promise<GetNotificationMetadataResponse>;
getMetadata(options: GetNotificationMetadataOptions, callback: MetadataCallback): void;
getMetadata(callback: MetadataCallback): void;
}

@@ -107,0 +107,0 @@ /**

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

constructor(bucket, id) {
const requestQueryObject = {};
const methods = {

@@ -98,2 +99,120 @@ /**

/**
* @typedef {array} DeleteNotificationResponse
* @property {object} 0 The full API response.
*/
/**
* Permanently deletes a notification subscription.
*
* See {@link https://cloud.google.com/storage/docs/json_api/v1/notifications/delete| Notifications: delete API Documentation}
*
* @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/deleteNotification.js</caption>
* region_tag:storage_delete_bucket_notification
* Another example:
*/
delete: {
reqOpts: {
qs: requestQueryObject,
},
},
/**
* Get a notification and its metadata if it exists.
*
* See {@link https://cloud.google.com/storage/docs/json_api/v1/notifications/get| Notifications: get API Documentation}
*
* @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: {
reqOpts: {
qs: requestQueryObject,
},
},
/**
* Get the notification's metadata.
*
* See {@link https://cloud.google.com/storage/docs/json_api/v1/notifications/get| Notifications: get API Documentation}
*
* @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/getMetadataNotifications.js</caption>
* region_tag:storage_print_pubsub_bucket_notification
* Another example:
*/
getMetadata: {
reqOpts: {
qs: requestQueryObject,
},
},
/**
* @typedef {array} NotificationExistsResponse

@@ -141,166 +260,2 @@ * @property {boolean} 0 Whether the notification exists or not.

}
/**
* @typedef {array} DeleteNotificationResponse
* @property {object} 0 The full API response.
*/
/**
* Permanently deletes a notification subscription.
*
* See {@link https://cloud.google.com/storage/docs/json_api/v1/notifications/delete| Notifications: delete API Documentation}
*
* @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/deleteNotification.js</caption>
* region_tag:storage_delete_bucket_notification
* Another example:
*/
delete(optionsOrCallback, callback) {
const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
callback =
typeof optionsOrCallback === 'function' ? optionsOrCallback : callback;
this.request({
method: 'DELETE',
uri: '',
qs: options,
}, callback || nodejs_common_1.util.noop);
}
/**
* Get a notification and its metadata if it exists.
*
* See {@link https://cloud.google.com/storage/docs/json_api/v1/notifications/get| Notifications: get API Documentation}
*
* @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(optionsOrCallback, callback) {
const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
callback =
typeof optionsOrCallback === 'function' ? optionsOrCallback : callback;
const autoCreate = options.autoCreate;
delete options.autoCreate;
const onCreate = (err, notification, apiResponse) => {
if (err) {
if (err.code === 409) {
this.get(options, callback);
return;
}
callback(err, null, apiResponse);
return;
}
callback(null, notification, apiResponse);
};
this.getMetadata(options, (err, metadata) => {
if (err) {
if (err.code === 404 && autoCreate) {
const args = [];
if (Object.keys(options).length > 0) {
args.push(options);
}
args.push(onCreate);
// eslint-disable-next-line
this.create.apply(this, args);
return;
}
callback(err, null, metadata);
return;
}
callback(null, this, metadata);
});
}
/**
* Get the notification's metadata.
*
* See {@link https://cloud.google.com/storage/docs/json_api/v1/notifications/get| Notifications: get API Documentation}
*
* @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/getMetadataNotifications.js</caption>
* region_tag:storage_print_pubsub_bucket_notification
* Another example:
*/
getMetadata(optionsOrCallback, callback) {
const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
callback =
typeof optionsOrCallback === 'function' ? optionsOrCallback : callback;
this.request({
uri: '',
qs: options,
}, (err, resp) => {
if (err) {
callback(err, null, resp);
return;
}
this.metadata = resp;
callback(null, this.metadata, resp);
});
}
}

@@ -314,2 +269,1 @@ exports.Notification = Notification;

(0, promisify_1.promisifyAll)(Notification);
//# sourceMappingURL=notification.js.map

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

code: number;
status?: number | string;
}

@@ -12,0 +13,0 @@ export type CreateUriCallback = (err: Error | null, uri?: string) => void;

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

const crypto_1 = require("crypto");
const extend = require("extend");
const gaxios = require("gaxios");

@@ -624,3 +623,10 @@ const google_auth_library_1 = require("google-auth-library");

};
const combinedReqOpts = extend(true, {}, this.customRequestOptions, reqOpts);
const combinedReqOpts = {
...this.customRequestOptions,
...reqOpts,
headers: {
...this.customRequestOptions.headers,
...reqOpts.headers,
},
};
const res = await this.authClient.request(combinedReqOpts);

@@ -642,3 +648,10 @@ if (res.data && res.data.error) {

reqOpts.validateStatus = () => true;
const combinedReqOpts = extend(true, {}, this.customRequestOptions, reqOpts);
const combinedReqOpts = {
...this.customRequestOptions,
...reqOpts,
headers: {
...this.customRequestOptions.headers,
...reqOpts.headers,
},
};
const res = await this.authClient.request(combinedReqOpts);

@@ -750,2 +763,1 @@ const successfulRequest = this.onResponse(res);

exports.createURI = createURI;
//# sourceMappingURL=resumable-upload.js.map

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

SignerExceptionMessages["X_GOOG_CONTENT_SHA256"] = "The header X-Goog-Content-SHA256 must be a hexadecimal string.";
})(SignerExceptionMessages = exports.SignerExceptionMessages || (exports.SignerExceptionMessages = {}));
})(SignerExceptionMessages || (exports.SignerExceptionMessages = SignerExceptionMessages = {}));
/*

@@ -291,2 +291,1 @@ * Default signing version for getSignedUrl is 'v2'.

exports.SigningError = SigningError;
//# sourceMappingURL=signer.js.map
/// <reference types="node" />
import { ApiError, Metadata, Service, ServiceOptions } from './nodejs-common';
import { ApiError, Service, ServiceOptions } from './nodejs-common';
import { Readable } from 'stream';

@@ -15,5 +15,5 @@ import { Bucket } from './bucket';

}
export type GetServiceAccountResponse = [ServiceAccount, Metadata];
export type GetServiceAccountResponse = [ServiceAccount, unknown];
export interface GetServiceAccountCallback {
(err: Error | null, serviceAccount?: ServiceAccount, apiResponse?: Metadata): void;
(err: Error | null, serviceAccount?: ServiceAccount, apiResponse?: unknown): void;
}

@@ -39,6 +39,6 @@ export interface CreateBucketQuery {

export interface PreconditionOptions {
ifGenerationMatch?: number;
ifGenerationNotMatch?: number;
ifMetagenerationMatch?: number;
ifMetagenerationNotMatch?: number;
ifGenerationMatch?: number | string;
ifGenerationNotMatch?: number | string;
ifMetagenerationMatch?: number | string;
ifMetagenerationNotMatch?: number | string;
}

@@ -98,9 +98,9 @@ export interface StorageOptions extends ServiceOptions {

}
export type CreateBucketResponse = [Bucket, Metadata];
export type CreateBucketResponse = [Bucket, unknown];
export interface BucketCallback {
(err: Error | null, bucket?: Bucket | null, apiResponse?: Metadata): void;
(err: Error | null, bucket?: Bucket | null, apiResponse?: unknown): void;
}
export type GetBucketsResponse = [Bucket[], {}, Metadata];
export type GetBucketsResponse = [Bucket[], {}, unknown];
export interface GetBucketsCallback {
(err: Error | null, buckets: Bucket[], nextQuery?: {}, apiResponse?: Metadata): void;
(err: Error | null, buckets: Bucket[], nextQuery?: {}, apiResponse?: unknown): void;
}

@@ -139,8 +139,7 @@ export interface GetBucketsRequest {

export interface GetHmacKeysCallback {
(err: Error | null, hmacKeys: HmacKey[] | null, nextQuery?: {}, apiResponse?: Metadata): void;
(err: Error | null, hmacKeys: HmacKey[] | null, nextQuery?: {}, apiResponse?: unknown): void;
}
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."
EXPIRATION_DATE_PAST = "An expiration date cannot be in the past."
}

@@ -147,0 +146,0 @@ export declare enum StorageExceptionMessages {

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

IdempotencyStrategy[IdempotencyStrategy["RetryNever"] = 2] = "RetryNever";
})(IdempotencyStrategy = exports.IdempotencyStrategy || (exports.IdempotencyStrategy = {}));
})(IdempotencyStrategy || (exports.IdempotencyStrategy = IdempotencyStrategy = {}));
var ExceptionMessages;

@@ -38,4 +38,3 @@ (function (ExceptionMessages) {

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 = {}));
})(ExceptionMessages || (exports.ExceptionMessages = ExceptionMessages = {}));
var StorageExceptionMessages;

@@ -47,3 +46,3 @@ (function (StorageExceptionMessages) {

StorageExceptionMessages["HMAC_ACCESS_ID"] = "An access ID is needed to create an HmacKey object.";
})(StorageExceptionMessages = exports.StorageExceptionMessages || (exports.StorageExceptionMessages = {}));
})(StorageExceptionMessages || (exports.StorageExceptionMessages = StorageExceptionMessages = {}));
exports.PROTOCOL_REGEX = /^(\w*):\/\//;

@@ -1142,2 +1141,1 @@ /**

});
//# sourceMappingURL=storage.js.map

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

const path = require("path");
const extend = require("extend");
const fs_1 = require("fs");

@@ -290,3 +289,5 @@ const crc32c_1 = require("./crc32c");

}
const passThroughOptionsCopy = extend(true, {}, options.passthroughOptions);
const passThroughOptionsCopy = {
...options.passthroughOptions,
};
passThroughOptionsCopy.destination = filePath;

@@ -365,3 +366,5 @@ if (options.prefix) {

for (const file of files) {
const passThroughOptionsCopy = extend(true, {}, options.passthroughOptions);
const passThroughOptionsCopy = {
...options.passthroughOptions,
};
if (options.prefix) {

@@ -417,3 +420,3 @@ passThroughOptionsCopy.destination = path.join(options.prefix || '', passThroughOptionsCopy.destination || '', file.name);

const fileInfo = await file.get();
const size = parseInt(fileInfo[0].metadata.size);
const size = parseInt(fileInfo[0].metadata.size.toString());
// If the file size does not meet the threshold download it as a single chunk.

@@ -545,2 +548,1 @@ if (size < DOWNLOAD_IN_CHUNKS_FILE_SIZE_THRESHOLD) {

exports.TransferManager = TransferManager;
//# sourceMappingURL=transfer-manager.js.map

@@ -210,2 +210,1 @@ "use strict";

exports.PassThroughShim = PassThroughShim;
//# sourceMappingURL=util.js.map
{
"name": "@google-cloud/storage",
"description": "Cloud Storage Client Library for Node.js",
"version": "6.12.0",
"version": "7.0.0",
"license": "Apache-2.0",
"author": "Google Inc.",
"engines": {
"node": ">=12"
"node": ">=14"
},

@@ -61,11 +61,10 @@ "repository": "googleapis/nodejs-storage",

"ent": "^2.2.0",
"extend": "^3.0.2",
"fast-xml-parser": "^4.2.2",
"gaxios": "^5.0.0",
"google-auth-library": "^8.0.1",
"gaxios": "^6.0.2",
"google-auth-library": "^9.0.0",
"mime": "^3.0.0",
"mime-types": "^2.0.8",
"p-limit": "^3.0.1",
"retry-request": "^5.0.0",
"teeny-request": "^8.0.0",
"retry-request": "^6.0.0",
"teeny-request": "^9.0.0",
"uuid": "^8.0.0"

@@ -80,3 +79,2 @@ },

"@types/ent": "^2.2.1",
"@types/extend": "^3.0.0",
"@types/mime": "^3.0.0",

@@ -86,7 +84,7 @@ "@types/mime-types": "^2.1.0",

"@types/mockery": "^1.4.29",
"@types/node": "^18.0.0",
"@types/node": "^20.4.4",
"@types/node-fetch": "^2.1.3",
"@types/proxyquire": "^1.3.28",
"@types/request": "^2.48.4",
"@types/sinon": "^10.0.0",
"@types/sinon": "^10.0.15",
"@types/tmp": "0.2.3",

@@ -97,3 +95,3 @@ "@types/uuid": "^8.0.0",

"form-data": "^4.0.0",
"gts": "^3.1.0",
"gts": "^5.0.0",
"jsdoc": "^4.0.0",

@@ -108,7 +106,7 @@ "jsdoc-fresh": "^2.0.0",

"proxyquire": "^2.1.3",
"sinon": "^15.0.0",
"sinon": "^15.2.0",
"tmp": "^0.2.0",
"typescript": "^4.6.4",
"typescript": "^5.1.6",
"yargs": "^17.3.1"
}
}

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

Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule).
Libraries are compatible with all current _active_ and _maintenance_ versions of

@@ -229,0 +229,0 @@ Node.js.

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