1
0
mirror of https://github.com/musix-org/musix-oss synced 2026-05-05 10:06:35 +00:00
This commit is contained in:
MatteZ02
2019-10-10 16:43:04 +03:00
parent 6f6ac8a6fa
commit 50b9bed483
9432 changed files with 1988816 additions and 167 deletions
+2
View File
@@ -0,0 +1,2 @@
- [Feature] Added the support for List API.
+5
View File
@@ -0,0 +1,5 @@
# @firebase/storage
This is the Cloud Storage component of the Firebase JS SDK.
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**
+3575
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+49
View File
@@ -0,0 +1,49 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { _FirebaseNamespace } from '@firebase/app-types/private';
import * as types from '@firebase/storage-types';
export declare function registerStorage(instance: _FirebaseNamespace): void;
/**
* Define extension behavior for `registerStorage`
*/
declare module '@firebase/app-types' {
interface FirebaseNamespace {
storage?: {
(app?: FirebaseApp): types.FirebaseStorage;
Storage: typeof types.FirebaseStorage;
StringFormat: {
BASE64: types.StringFormat;
BASE64URL: types.StringFormat;
DATA_URL: types.StringFormat;
RAW: types.StringFormat;
};
TaskEvent: {
STATE_CHANGED: types.TaskEvent;
};
TaskState: {
CANCELED: types.TaskState;
ERROR: types.TaskState;
PAUSED: types.TaskState;
RUNNING: types.TaskState;
SUCCESS: types.TaskState;
};
};
}
interface FirebaseApp {
storage?(storageBucket?: string): types.FirebaseStorage;
}
}
+3569
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+23
View File
@@ -0,0 +1,23 @@
/**
* @param name Name of the function.
* @param specs Argument specs.
* @param passed The actual arguments passed to the function.
* @throws {fbs.Error} If the arguments are invalid.
*/
export declare function validate(name: string, specs: ArgSpec[], passed: IArguments): void;
/**
* @struct
*/
export declare class ArgSpec {
validator: (p1: unknown) => void;
optional: boolean;
constructor(validator: (p1: unknown) => void, optional?: boolean);
}
export declare function and_(v1: (p1: unknown) => void, v2: (p1: unknown) => void): (p1: unknown) => void;
export declare function stringSpec(validator?: (p1: unknown) => void | null, optional?: boolean): ArgSpec;
export declare function uploadDataSpec(): ArgSpec;
export declare function metadataSpec(optional?: boolean): ArgSpec;
export declare function listOptionSpec(optional?: boolean): ArgSpec;
export declare function nonNegativeNumberSpec(): ArgSpec;
export declare function looseObjectSpec(validator?: ((p1: unknown) => void) | null, optional?: boolean): ArgSpec;
export declare function nullFunctionSpec(optional?: boolean): ArgSpec;
+22
View File
@@ -0,0 +1,22 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* Returns a function that invokes f with its arguments asynchronously as a
* microtask, i.e. as soon as possible after the current script returns back
* into browser code.
*/
export declare function async(f: Function): Function;
@@ -0,0 +1,68 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { Reference } from '../reference';
import { Service } from '../service';
import { Location } from './location';
import { Request } from './request';
import { RequestInfo } from './requestinfo';
import { requestMaker } from './requestmaker';
import { XhrIoPool } from './xhriopool';
import { FirebaseApp } from '@firebase/app-types';
/**
* @param app If null, getAuthToken always resolves with null.
* @param service The storage service associated with this auth wrapper.
* Untyped to avoid circular type dependencies.
* @struct
*/
export declare class AuthWrapper {
private app_;
private bucket_;
private storageRefMaker_;
private requestMaker_;
private pool_;
private service_;
private maxOperationRetryTime_;
private maxUploadRetryTime_;
private requestMap_;
private deleted_;
constructor(app: FirebaseApp | null, maker: (p1: AuthWrapper, p2: Location) => Reference, requestMaker: requestMaker, service: Service, pool: XhrIoPool);
private static extractBucket_;
getAuthToken(): Promise<string | null>;
bucket(): string | null;
/**
* The service associated with this auth wrapper. Untyped to avoid circular
* type dependencies.
*/
service(): Service;
/**
* Returns a new firebaseStorage.Reference object referencing this AuthWrapper
* at the given Location.
* @param loc The Location.
* @return Actually a firebaseStorage.Reference, typing not allowed
* because of circular dependency problems.
*/
makeStorageReference(loc: Location): Reference;
makeRequest<T>(requestInfo: RequestInfo<T>, authToken: string | null): Request<T>;
/**
* Stop running requests and prevent more from being created.
*/
deleteApp(): void;
maxUploadRetryTime(): number;
setMaxUploadRetryTime(time: number): void;
maxOperationRetryTime(): number;
setMaxOperationRetryTime(time: number): void;
}
+37
View File
@@ -0,0 +1,37 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @fileoverview Provides a method for running a function with exponential
* backoff.
*/
declare type id = (p1: boolean) => void;
export { id };
/**
* @param f May be invoked
* before the function returns.
* @param callback Get all the arguments passed to the function
* passed to f, including the initial boolean.
*/
export declare function start(f: (p1: (success: boolean) => void, canceled: boolean) => void, callback: Function, timeout: number): id;
/**
* Stops the retry loop from repeating.
* If the function is currently "in between" retries, it is invoked immediately
* with the second parameter as "true". Otherwise, it will be invoked once more
* after the current invocation finishes iff the current invocation would have
* triggered another retry.
*/
export declare function stop(id: id): void;
+32
View File
@@ -0,0 +1,32 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @param opt_elideCopy If true, doesn't copy mutable input data
* (e.g. Uint8Arrays). Pass true only if you know the objects will not be
* modified after this blob's construction.
*/
export declare class FbsBlob {
private data_;
private size_;
private type_;
constructor(data: Blob | Uint8Array | ArrayBuffer, elideCopy?: boolean);
size(): number;
type(): string;
slice(startByte: number, endByte: number): FbsBlob | null;
static getBlob(...args: Array<string | FbsBlob>): FbsBlob | null;
uploadData(): Blob | Uint8Array;
}
+44
View File
@@ -0,0 +1,44 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @fileoverview Constants used in the Firebase Storage library.
*/
/**
* Domain name for firebase storage.
*/
export declare const DEFAULT_HOST: string;
/**
* The key in Firebase config json for the storage bucket.
*/
export declare const CONFIG_STORAGE_BUCKET_KEY: string;
/**
* 2 minutes
*
* The timeout for all operations except upload.
*/
export declare const DEFAULT_MAX_OPERATION_RETRY_TIME: number;
/**
* 10 minutes
*
* The timeout for upload.
*/
export declare const DEFAULT_MAX_UPLOAD_RETRY_TIME: number;
/**
* This is the value of Number.MIN_SAFE_INTEGER, which is not well supported
* enough for us to use it directly.
*/
export declare const MIN_SAFE_INTEGER: number;
+79
View File
@@ -0,0 +1,79 @@
export declare class FirebaseStorageError implements Error {
private code_;
private message_;
private serverResponse_;
private name_;
constructor(code: Code, message: string);
codeProp(): string;
codeEquals(code: Code): boolean;
serverResponseProp(): string | null;
setServerResponseProp(serverResponse: string | null): void;
readonly name: string;
readonly code: string;
readonly message: string;
readonly serverResponse: null | string;
}
export declare const errors: {};
/**
* @enum {string}
*/
export declare type Code = string;
export declare const Code: {
UNKNOWN: string;
OBJECT_NOT_FOUND: string;
BUCKET_NOT_FOUND: string;
PROJECT_NOT_FOUND: string;
QUOTA_EXCEEDED: string;
UNAUTHENTICATED: string;
UNAUTHORIZED: string;
RETRY_LIMIT_EXCEEDED: string;
INVALID_CHECKSUM: string;
CANCELED: string;
INVALID_EVENT_NAME: string;
INVALID_URL: string;
INVALID_DEFAULT_BUCKET: string;
NO_DEFAULT_BUCKET: string;
CANNOT_SLICE_BLOB: string;
SERVER_FILE_WRONG_SIZE: string;
NO_DOWNLOAD_URL: string;
INVALID_ARGUMENT: string;
INVALID_ARGUMENT_COUNT: string;
APP_DELETED: string;
INVALID_ROOT_OPERATION: string;
INVALID_FORMAT: string;
INTERNAL_ERROR: string;
};
export declare function prependCode(code: Code): string;
export declare function unknown(): FirebaseStorageError;
export declare function objectNotFound(path: string): FirebaseStorageError;
export declare function bucketNotFound(bucket: string): FirebaseStorageError;
export declare function projectNotFound(project: string): FirebaseStorageError;
export declare function quotaExceeded(bucket: string): FirebaseStorageError;
export declare function unauthenticated(): FirebaseStorageError;
export declare function unauthorized(path: string): FirebaseStorageError;
export declare function retryLimitExceeded(): FirebaseStorageError;
export declare function invalidChecksum(path: string, checksum: string, calculated: string): FirebaseStorageError;
export declare function canceled(): FirebaseStorageError;
export declare function invalidEventName(name: string): FirebaseStorageError;
export declare function invalidUrl(url: string): FirebaseStorageError;
export declare function invalidDefaultBucket(bucket: string): FirebaseStorageError;
export declare function noDefaultBucket(): FirebaseStorageError;
export declare function cannotSliceBlob(): FirebaseStorageError;
export declare function serverFileWrongSize(): FirebaseStorageError;
export declare function noDownloadURL(): FirebaseStorageError;
export declare function invalidArgument(index: number, fnName: string, message: string): FirebaseStorageError;
export declare function invalidArgumentCount(argMin: number, argMax: number, fnName: string, real: number): FirebaseStorageError;
export declare function appDeleted(): FirebaseStorageError;
/**
* @param name The name of the operation that was invalid.
*/
export declare function invalidRootOperation(name: string): FirebaseStorageError;
/**
* @param format The format that was not valid.
* @param message A message describing the format violation.
*/
export declare function invalidFormat(format: string, message: string): FirebaseStorageError;
/**
* @param message A message describing the internal error.
*/
export declare function internalError(message: string): FirebaseStorageError;
@@ -0,0 +1,31 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { FirebaseStorageError } from './error';
import { Request } from './request';
/**
* A request whose promise always fails.
* @struct
* @template T
*/
export declare class FailRequest<T> implements Request<T> {
promise_: Promise<T>;
constructor(error: FirebaseStorageError);
/** @inheritDoc */
getPromise(): Promise<T>;
/** @inheritDoc */
cancel(_appDelete?: boolean): void;
}
+17
View File
@@ -0,0 +1,17 @@
/**
* Concatenates one or more values together and converts them to a Blob.
*
* @param args The values that will make up the resulting blob.
* @return The blob.
*/
export declare function getBlob(...args: Array<string | Blob | ArrayBuffer>): Blob;
/**
* Slices the blob. The returned blob contains data from the start byte
* (inclusive) till the end byte (exclusive). Negative indices cannot be used.
*
* @param blob The blob to be sliced.
* @param start Index of the starting byte.
* @param end Index of the ending byte.
* @return The blob slice or null if not supported.
*/
export declare function sliceBlob(blob: Blob, start: number, end: number): Blob | null;
+7
View File
@@ -0,0 +1,7 @@
/**
* Returns the Object resulting from parsing the given JSON, or null if the
* given string does not represent a JSON object.
*/
export declare function jsonObjectOrNull(s: string): {
[name: string]: unknown;
} | null;
+23
View File
@@ -0,0 +1,23 @@
/**
* @license
* Copyright 2019 Google Inc.
*
* 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.
*/
/**
* @fileoverview Documentation for the listOptions and listResult format
*/
import { AuthWrapper } from './authwrapper';
import { ListResult } from '../list';
export declare function fromResponseString(authWrapper: AuthWrapper, resourceString: string): ListResult | null;
export declare function listOptionsValidator(p: unknown): void;
+30
View File
@@ -0,0 +1,30 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @struct
*/
export declare class Location {
readonly bucket: string;
private path_;
constructor(bucket: string, path: string);
readonly path: string;
readonly isRoot: boolean;
fullServerUrl(): string;
bucketOnlyServerUrl(): string;
static makeFromBucketSpec(bucketString: string): Location;
static makeFromUrl(url: string): Location;
}
+44
View File
@@ -0,0 +1,44 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @fileoverview Documentation for the metadata format
*/
import { Metadata } from '../metadata';
import { AuthWrapper } from './authwrapper';
export declare function noXform_<T>(metadata: Metadata, value: T): T;
/**
* @struct
*/
declare class Mapping<T> {
server: string;
local: string;
writable: boolean;
xform: (p1: Metadata, p2?: T) => T | undefined;
constructor(server: string, local?: string | null, writable?: boolean, xform?: ((p1: Metadata, p2?: T) => T | undefined) | null);
}
declare type Mappings = Array<Mapping<string> | Mapping<number>>;
export { Mappings };
export declare function xformPath(fullPath: string | undefined): string | undefined;
export declare function getMappings(): Mappings;
export declare function addRef(metadata: Metadata, authWrapper: AuthWrapper): void;
export declare function fromResource(authWrapper: AuthWrapper, resource: {
[name: string]: unknown;
}, mappings: Mappings): Metadata;
export declare function fromResourceString(authWrapper: AuthWrapper, resourceString: string, mappings: Mappings): Metadata | null;
export declare function downloadUrlFromResourceString(metadata: Metadata, resourceString: string): string | null;
export declare function toResourceString(metadata: Metadata, mappings: Mappings): string;
export declare function metadataValidator(p: unknown): void;
+20
View File
@@ -0,0 +1,20 @@
import { FirebaseStorageError } from './error';
export declare type NextFn<T> = (value: T) => void;
export declare type ErrorFn = (error: Error | FirebaseStorageError) => void;
export declare type CompleteFn = () => void;
export declare type Unsubscribe = () => void;
export interface StorageObserver<T> {
next?: NextFn<T> | null;
error?: ErrorFn | null;
complete?: CompleteFn | null;
}
export declare type Subscribe<T> = (next?: NextFn<T> | StorageObserver<T> | null, error?: ErrorFn | null, complete?: CompleteFn | null) => Unsubscribe;
/**
* @struct
*/
export declare class Observer<T> implements StorageObserver<T> {
next?: NextFn<T> | null;
error?: ErrorFn | null;
complete?: CompleteFn | null;
constructor(nextOrObserver?: NextFn<T> | StorageObserver<T> | null, error?: ErrorFn | null, complete?: CompleteFn | null);
}
+31
View File
@@ -0,0 +1,31 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @fileoverview Contains helper methods for manipulating paths.
*/
/**
* @return Null if the path is already at the root.
*/
export declare function parent(path: string): string | null;
export declare function child(path: string, childPath: string): string;
/**
* Returns the last component of a path.
* '/foo/bar' -> 'bar'
* '/foo/bar/baz/' -> 'baz/'
* '/a' -> 'a'
*/
export declare function lastComponent(path: string): string;
+53
View File
@@ -0,0 +1,53 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { RequestInfo } from './requestinfo';
import { Headers, XhrIo } from './xhrio';
import { XhrIoPool } from './xhriopool';
/**
* @template T
*/
export interface Request<T> {
getPromise(): Promise<T>;
/**
* Cancels the request. IMPORTANT: the promise may still be resolved with an
* appropriate value (if the request is finished before you call this method,
* but the promise has not yet been resolved), so don't just assume it will be
* rejected if you call this function.
* @param appDelete True if the cancelation came from the app being deleted.
*/
cancel(appDelete?: boolean): void;
}
/**
* A collection of information about the result of a network request.
* @param opt_canceled Defaults to false.
* @struct
*/
export declare class RequestEndStatus {
wasSuccessCode: boolean;
xhr: XhrIo | null;
/**
* True if the request was canceled.
*/
canceled: boolean;
constructor(wasSuccessCode: boolean, xhr: XhrIo | null, canceled?: boolean);
}
export declare function addAuthHeader_(headers: Headers, authToken: string | null): void;
export declare function addVersionHeader_(headers: Headers): void;
/**
* @template T
*/
export declare function makeRequest<T>(requestInfo: RequestInfo<T>, authToken: string | null, pool: XhrIoPool): Request<T>;
@@ -0,0 +1,54 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { FirebaseStorageError } from './error';
import { Headers, XhrIo } from './xhrio';
export interface UrlParams {
[name: string]: string | number;
}
export declare class RequestInfo<T> {
url: string;
method: string;
/**
* Returns the value with which to resolve the request's promise. Only called
* if the request is successful. Throw from this function to reject the
* returned Request's promise with the thrown error.
* Note: The XhrIo passed to this function may be reused after this callback
* returns. Do not keep a reference to it in any way.
*/
handler: (p1: XhrIo, p2: string) => T;
timeout: number;
urlParams: UrlParams;
headers: Headers;
body: Blob | string | Uint8Array | null;
errorHandler: ((p1: XhrIo, p2: FirebaseStorageError) => FirebaseStorageError) | null;
/**
* Called with the current number of bytes uploaded and total size (-1 if not
* computable) of the request body (i.e. used to report upload progress).
*/
progressCallback: ((p1: number, p2: number) => void) | null;
successCodes: number[];
additionalRetryCodes: number[];
constructor(url: string, method: string,
/**
* Returns the value with which to resolve the request's promise. Only called
* if the request is successful. Throw from this function to reject the
* returned Request's promise with the thrown error.
* Note: The XhrIo passed to this function may be reused after this callback
* returns. Do not keep a reference to it in any way.
*/
handler: (p1: XhrIo, p2: string) => T, timeout: number);
}
@@ -0,0 +1,21 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { Request } from './request';
import { RequestInfo } from './requestinfo';
import { XhrIoPool } from './xhriopool';
declare type requestMaker = <T>(requestInfo: RequestInfo<T>, authToken: string | null, pool: XhrIoPool) => Request<T>;
export { requestMaker };
+33
View File
@@ -0,0 +1,33 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { Request } from './request';
export declare class RequestMap {
private readonly map;
private id;
constructor();
/**
* Registers the given request with this map.
* The request is unregistered when it completes.
*
* @param request The request to register.
*/
addRequest(request: Request<unknown>): void;
/**
* Cancels all registered requests.
*/
clear(): void;
}
+81
View File
@@ -0,0 +1,81 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @fileoverview Defines methods for interacting with the network.
*/
import { Metadata } from '../metadata';
import { ListResult } from '../list';
import { AuthWrapper } from './authwrapper';
import { FbsBlob } from './blob';
import { FirebaseStorageError } from './error';
import { Location } from './location';
import * as MetadataUtils from './metadata';
import { RequestInfo } from './requestinfo';
import { XhrIo } from './xhrio';
/**
* Throws the UNKNOWN FirebaseStorageError if cndn is false.
*/
export declare function handlerCheck(cndn: boolean): void;
export declare function metadataHandler(authWrapper: AuthWrapper, mappings: MetadataUtils.Mappings): (p1: XhrIo, p2: string) => Metadata;
export declare function listHandler(authWrapper: AuthWrapper): (p1: XhrIo, p2: string) => ListResult;
export declare function downloadUrlHandler(authWrapper: AuthWrapper, mappings: MetadataUtils.Mappings): (p1: XhrIo, p2: string) => string | null;
export declare function sharedErrorHandler(location: Location): (p1: XhrIo, p2: FirebaseStorageError) => FirebaseStorageError;
export declare function objectErrorHandler(location: Location): (p1: XhrIo, p2: FirebaseStorageError) => FirebaseStorageError;
export declare function getMetadata(authWrapper: AuthWrapper, location: Location, mappings: MetadataUtils.Mappings): RequestInfo<Metadata>;
export declare function list(authWrapper: AuthWrapper, location: Location, delimiter?: string, pageToken?: string | null, maxResults?: number | null): RequestInfo<ListResult>;
export declare function getDownloadUrl(authWrapper: AuthWrapper, location: Location, mappings: MetadataUtils.Mappings): RequestInfo<string | null>;
export declare function updateMetadata(authWrapper: AuthWrapper, location: Location, metadata: Metadata, mappings: MetadataUtils.Mappings): RequestInfo<Metadata>;
export declare function deleteObject(authWrapper: AuthWrapper, location: Location): RequestInfo<void>;
export declare function determineContentType_(metadata: Metadata | null, blob: FbsBlob | null): string;
export declare function metadataForUpload_(location: Location, blob: FbsBlob, metadata?: Metadata | null): Metadata;
export declare function multipartUpload(authWrapper: AuthWrapper, location: Location, mappings: MetadataUtils.Mappings, blob: FbsBlob, metadata?: Metadata | null): RequestInfo<Metadata>;
/**
* @param current The number of bytes that have been uploaded so far.
* @param total The total number of bytes in the upload.
* @param opt_finalized True if the server has finished the upload.
* @param opt_metadata The upload metadata, should
* only be passed if opt_finalized is true.
* @struct
*/
export declare class ResumableUploadStatus {
current: number;
total: number;
finalized: boolean;
metadata: Metadata | null;
constructor(current: number, total: number, finalized?: boolean, metadata?: Metadata | null);
}
export declare function checkResumeHeader_(xhr: XhrIo, allowed?: string[]): string;
export declare function createResumableUpload(authWrapper: AuthWrapper, location: Location, mappings: MetadataUtils.Mappings, blob: FbsBlob, metadata?: Metadata | null): RequestInfo<string>;
/**
* @param url From a call to fbs.requests.createResumableUpload.
*/
export declare function getResumableUploadStatus(authWrapper: AuthWrapper, location: Location, url: string, blob: FbsBlob): RequestInfo<ResumableUploadStatus>;
/**
* Any uploads via the resumable upload API must transfer a number of bytes
* that is a multiple of this number.
*/
export declare const resumableUploadChunkSize: number;
/**
* @param url From a call to fbs.requests.createResumableUpload.
* @param chunkSize Number of bytes to upload.
* @param status The previous status.
* If not passed or null, we start from the beginning.
* @throws fbs.Error If the upload is already complete, the passed in status
* has a final size inconsistent with the blob, or the blob cannot be sliced
* for upload.
*/
export declare function continueResumableUpload(location: Location, authWrapper: AuthWrapper, url: string, blob: FbsBlob, chunkSize: number, mappings: MetadataUtils.Mappings, status?: ResumableUploadStatus | null, progressCallback?: ((p1: number, p2: number) => void) | null): RequestInfo<ResumableUploadStatus>;
+25
View File
@@ -0,0 +1,25 @@
/**
* @enum {string}
*/
export declare type StringFormat = string;
export declare const StringFormat: {
RAW: string;
BASE64: string;
BASE64URL: string;
DATA_URL: string;
};
export declare function formatValidator(stringFormat: unknown): void;
/**
* @struct
*/
export declare class StringData {
data: Uint8Array;
contentType: string | null;
constructor(data: Uint8Array, contentType?: string | null);
}
export declare function dataFromString(format: StringFormat, stringData: string): StringData;
export declare function utf8Bytes_(value: string): Uint8Array;
export declare function percentEncodedBytes_(value: string): Uint8Array;
export declare function base64Bytes_(format: StringFormat, value: string): Uint8Array;
export declare function dataURLBytes_(dataUrl: string): Uint8Array;
export declare function dataURLContentType_(dataUrl: string): string | null;
+60
View File
@@ -0,0 +1,60 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @fileoverview Enumerations used for upload tasks.
*/
/**
* Enum for task events.
* @enum {string}
*/
export declare type TaskEvent = string;
export declare const TaskEvent: {
/** Triggered whenever the task changes or progress is updated. */
STATE_CHANGED: string;
};
/**
* Internal enum for task state.
* @enum {string}
*/
export declare type InternalTaskState = string;
export declare const InternalTaskState: {
RUNNING: string;
PAUSING: string;
PAUSED: string;
SUCCESS: string;
CANCELING: string;
CANCELED: string;
ERROR: string;
};
/**
* External (API-surfaced) enum for task state.
* @enum {string}
*/
export declare type TaskState = string;
export declare const TaskState: {
/** The task is currently transferring data. */
RUNNING: string;
/** The task was paused by the user. */
PAUSED: string;
/** The task completed successfully. */
SUCCESS: string;
/** The task was canceled. */
CANCELED: string;
/** The task failed with an error. */
ERROR: string;
};
export declare function taskStateFromInternalTaskState(state: InternalTaskState): TaskState;
+32
View File
@@ -0,0 +1,32 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @return False if the object is undefined or null, true otherwise.
*/
export declare function isDef<T>(p: T | null | undefined): p is T;
export declare function isJustDef<T>(p: T | null | undefined): p is T | null;
export declare function isFunction(p: unknown): p is Function;
export declare function isObject(p: unknown): p is {
[key: string]: unknown;
} | null;
export declare function isNonNullObject(p: unknown): p is object;
export declare function isNonArrayObject(p: unknown): boolean;
export declare function isString(p: unknown): p is string;
export declare function isInteger(p: unknown): p is number;
export declare function isNumber(p: unknown): p is number;
export declare function isNativeBlob(p: unknown): p is Blob;
export declare function isNativeBlobDefined(): boolean;
+19
View File
@@ -0,0 +1,19 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { UrlParams } from './requestinfo';
export declare function makeUrl(urlPart: string): string;
export declare function makeQueryString(params: UrlParams): string;
+44
View File
@@ -0,0 +1,44 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @fileoverview A lightweight wrapper around XMLHttpRequest with a
* goog.net.XhrIo-like interface.
*/
export interface Headers {
[name: string]: string | number;
}
export interface XhrIo {
send(url: string, method: string, body?: ArrayBufferView | Blob | string | null, headers?: Headers): Promise<XhrIo>;
getErrorCode(): ErrorCode;
getStatus(): number;
getResponseText(): string;
/**
* Abort the request.
*/
abort(): void;
getResponseHeader(header: string): string | null;
addUploadProgressListener(listener: (p1: ProgressEvent) => void): void;
removeUploadProgressListener(listener: (p1: ProgressEvent) => void): void;
}
/**
* @enum{number}
*/
export declare enum ErrorCode {
NO_ERROR = 0,
NETWORK_ERROR = 1,
ABORT = 2
}
@@ -0,0 +1,45 @@
import { Headers, XhrIo, ErrorCode } from './xhrio';
/**
* We use this instead of goog.net.XhrIo because goog.net.XhrIo is hyuuuuge and
* doesn't work in React Native on Android.
*/
export declare class NetworkXhrIo implements XhrIo {
private xhr_;
private errorCode_;
private sendPromise_;
private sent_;
constructor();
/**
* @override
*/
send(url: string, method: string, body?: ArrayBufferView | Blob | string | null, headers?: Headers): Promise<XhrIo>;
/**
* @override
*/
getErrorCode(): ErrorCode;
/**
* @override
*/
getStatus(): number;
/**
* @override
*/
getResponseText(): string;
/**
* Aborts the request.
* @override
*/
abort(): void;
/**
* @override
*/
getResponseHeader(header: string): string | null;
/**
* @override
*/
addUploadProgressListener(listener: (p1: ProgressEvent) => void): void;
/**
* @override
*/
removeUploadProgressListener(listener: (p1: ProgressEvent) => void): void;
}
+26
View File
@@ -0,0 +1,26 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @fileoverview Replacement for goog.net.XhrIoPool that works with fbs.XhrIo.
*/
import { XhrIo } from './xhrio';
/**
* Factory-like class for creating XhrIo instances.
*/
export declare class XhrIoPool {
createXhrIo(): XhrIo;
}
+29
View File
@@ -0,0 +1,29 @@
/**
* @license
* Copyright 2019 Google Inc.
*
* 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 { Reference } from './reference';
/**
* @fileoverview Documentation for ListOptions and ListResult format.
*/
export interface ListOptions {
maxResults?: number | null;
pageToken?: string | null;
}
export interface ListResult {
prefixes: Reference[];
items: Reference[];
nextPageToken?: string | null;
}
+44
View File
@@ -0,0 +1,44 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { Reference } from './reference';
/**
* @fileoverview Documentation for the metadata format.
*/
interface Metadata {
bucket: string | undefined;
generation: string | undefined;
metageneration: string | undefined;
fullPath: string | undefined;
name: string | undefined;
size: number | undefined;
type: string | undefined;
timeCreated: string | undefined;
updated: string | undefined;
md5Hash: string | undefined;
cacheControl: string | undefined;
contentDisposition: string | undefined;
contentEncoding: string | undefined;
contentLanguage: string | undefined;
contentType: string | undefined;
downloadTokens: string[] | undefined;
customMetadata: {
[key: string]: string;
} | undefined;
ref: Reference | undefined;
[prop: string]: unknown;
}
export { Metadata };
+153
View File
@@ -0,0 +1,153 @@
/**
* @license
* Copyright 2019 Google Inc.
*
* 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.
*/
/**
* @fileoverview Defines the Firebase Storage Reference class.
*/
import { AuthWrapper } from './implementation/authwrapper';
import { Location } from './implementation/location';
import * as metadata from './implementation/metadata';
import { StringFormat } from './implementation/string';
import { Metadata } from './metadata';
import { Service } from './service';
import { UploadTask } from './task';
import { ListOptions, ListResult } from './list';
/**
* Provides methods to interact with a bucket in the Firebase Storage service.
* @param location An fbs.location, or the URL at
* which to base this object, in one of the following forms:
* gs://<bucket>/<object-path>
* http[s]://firebasestorage.googleapis.com/
* <api-version>/b/<bucket>/o/<object-path>
* Any query or fragment strings will be ignored in the http[s]
* format. If no value is passed, the storage object will use a URL based on
* the project ID of the base firebase.App instance.
*/
export declare class Reference {
protected authWrapper: AuthWrapper;
protected location: Location;
constructor(authWrapper: AuthWrapper, location: string | Location);
/**
* @return The URL for the bucket and path this object references,
* in the form gs://<bucket>/<object-path>
* @override
*/
toString(): string;
protected newRef(authWrapper: AuthWrapper, location: Location): Reference;
protected mappings(): metadata.Mappings;
/**
* @return A reference to the object obtained by
* appending childPath, removing any duplicate, beginning, or trailing
* slashes.
*/
child(childPath: string): Reference;
/**
* @return A reference to the parent of the
* current object, or null if the current object is the root.
*/
readonly parent: Reference | null;
/**
* @return An reference to the root of this
* object's bucket.
*/
readonly root: Reference;
readonly bucket: string;
readonly fullPath: string;
readonly name: string;
readonly storage: Service;
/**
* Uploads a blob to this object's location.
* @param data The blob to upload.
* @return An UploadTask that lets you control and
* observe the upload.
*/
put(data: Blob | Uint8Array | ArrayBuffer, metadata?: Metadata | null): UploadTask;
/**
* Uploads a string to this object's location.
* @param value The string to upload.
* @param format The format of the string to upload.
* @return An UploadTask that lets you control and
* observe the upload.
*/
putString(value: string, format?: StringFormat, metadata?: Metadata): UploadTask;
/**
* Deletes the object at this location.
* @return A promise that resolves if the deletion succeeds.
*/
delete(): Promise<void>;
/**
* List all items (files) and prefixes (folders) under this storage reference.
*
* This is a helper method for calling list() repeatedly until there are
* no more results. The default pagination size is 1000.
*
* Note: The results may not be consistent if objects are changed while this
* operation is running.
*
* Warning: listAll may potentially consume too many resources if there are
* too many results.
*
* @return A Promise that resolves with all the items and prefixes under
* the current storage reference. `prefixes` contains references to
* sub-directories and `items` contains references to objects in this
* folder. `nextPageToken` is never returned.
*/
listAll(): Promise<ListResult>;
private listAllHelper;
/**
* List items (files) and prefixes (folders) under this storage reference.
*
* List API is only available for Firebase Rules Version 2.
*
* GCS is a key-blob store. Firebase Storage imposes the semantic of '/'
* delimited folder structure.
* Refer to GCS's List API if you want to learn more.
*
* To adhere to Firebase Rules's Semantics, Firebase Storage does not
* support objects whose paths end with "/" or contain two consecutive
* "/"s. Firebase Storage List API will filter these unsupported objects.
* list() may fail if there are too many unsupported objects in the bucket.
*
* @param options See ListOptions for details.
* @return A Promise that resolves with the items and prefixes.
* `prefixes` contains references to sub-folders and `items`
* contains references to objects in this folder. `nextPageToken`
* can be used to get the rest of the results.
*/
list(options?: ListOptions | null): Promise<ListResult>;
/**
* A promise that resolves with the metadata for this object. If this
* object doesn't exist or metadata cannot be retreived, the promise is
* rejected.
*/
getMetadata(): Promise<Metadata>;
/**
* Updates the metadata for this object.
* @param metadata The new metadata for the object.
* Only values that have been explicitly set will be changed. Explicitly
* setting a value to null will remove the metadata.
* @return A promise that resolves
* with the new metadata for this object.
* @see firebaseStorage.Reference.prototype.getMetadata
*/
updateMetadata(metadata: Metadata): Promise<Metadata>;
/**
* @return A promise that resolves with the download
* URL for this object.
*/
getDownloadURL(): Promise<string>;
private throwIfRoot_;
}
+60
View File
@@ -0,0 +1,60 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { FirebaseApp } from '@firebase/app-types';
import { AuthWrapper } from './implementation/authwrapper';
import { XhrIoPool } from './implementation/xhriopool';
import { Reference } from './reference';
/**
* A service that provides firebaseStorage.Reference instances.
* @param opt_url gs:// url to a custom Storage Bucket
*
* @struct
*/
export declare class Service {
authWrapper_: AuthWrapper;
private app_;
private bucket_;
private internals_;
constructor(app: FirebaseApp, pool: XhrIoPool, url?: string);
/**
* Returns a firebaseStorage.Reference for the given path in the default
* bucket.
*/
ref(path?: string): Reference;
/**
* Returns a firebaseStorage.Reference object for the given absolute URL,
* which must be a gs:// or http[s]:// URL.
*/
refFromURL(url: string): Reference;
readonly maxUploadRetryTime: number;
setMaxUploadRetryTime(time: number): void;
setMaxOperationRetryTime(time: number): void;
readonly app: FirebaseApp;
readonly INTERNAL: ServiceInternals;
}
/**
* @struct
*/
export declare class ServiceInternals {
service_: Service;
constructor(service: Service);
/**
* Called when the associated app is deleted.
* @see {!fbs.AuthWrapper.prototype.deleteApp}
*/
delete(): Promise<void>;
}
+118
View File
@@ -0,0 +1,118 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
/**
* @fileoverview Defines types for interacting with blob transfer tasks.
*/
import { AuthWrapper } from './implementation/authwrapper';
import { FbsBlob } from './implementation/blob';
import { TaskEvent } from './implementation/taskenums';
import { Metadata } from './metadata';
import { CompleteFn, ErrorFn, NextFn, StorageObserver, Subscribe, Unsubscribe } from './implementation/observer';
import { UploadTaskSnapshot } from './tasksnapshot';
import { Location } from './implementation/location';
import * as fbsMetadata from './implementation/metadata';
import { Reference } from './reference';
/**
* Represents a blob being uploaded. Can be used to pause/resume/cancel the
* upload and manage callbacks for various events.
*/
export declare class UploadTask {
private ref_;
private authWrapper_;
private location_;
private blob_;
private metadata_;
private mappings_;
private transferred_;
private needToFetchStatus_;
private needToFetchMetadata_;
private observers_;
private resumable_;
private state_;
private error_;
private uploadUrl_;
private request_;
private chunkMultiplier_;
private errorHandler_;
private metadataErrorHandler_;
private resolve_;
private reject_;
private promise_;
/**
* @param ref The firebaseStorage.Reference object this task came
* from, untyped to avoid cyclic dependencies.
* @param blob The blob to upload.
*/
constructor(ref: Reference, authWrapper: AuthWrapper, location: Location, mappings: fbsMetadata.Mappings, blob: FbsBlob, metadata?: Metadata | null);
private makeProgressCallback_;
private shouldDoResumable_;
private start_;
private resolveToken_;
private createResumable_;
private fetchStatus_;
private continueUpload_;
private increaseMultiplier_;
private fetchMetadata_;
private oneShotUpload_;
private updateProgress_;
private transition_;
private completeTransitions_;
readonly snapshot: UploadTaskSnapshot;
/**
* Adds a callback for an event.
* @param type The type of event to listen for.
*/
on(type: TaskEvent, nextOrObserver?: NextFn<UploadTaskSnapshot> | StorageObserver<UploadTaskSnapshot> | null, error?: ErrorFn | null, completed?: CompleteFn | null): Unsubscribe | Subscribe<UploadTaskSnapshot>;
/**
* This object behaves like a Promise, and resolves with its snapshot data
* when the upload completes.
* @param onFulfilled The fulfillment callback. Promise chaining works as normal.
* @param onRejected The rejection callback.
*/
then<U>(onFulfilled?: ((value: UploadTaskSnapshot) => U | Promise<U>) | null, onRejected?: ((error: Error) => U | Promise<U>) | null): Promise<U>;
/**
* Equivalent to calling `then(null, onRejected)`.
*/
catch<T>(onRejected: (p1: Error) => T | Promise<T>): Promise<T>;
/**
* Adds the given observer.
*/
private addObserver_;
/**
* Removes the given observer.
*/
private removeObserver_;
private notifyObservers_;
private finishPromise_;
private notifyObserver_;
/**
* Resumes a paused task. Has no effect on a currently running or failed task.
* @return True if the operation took effect, false if ignored.
*/
resume(): boolean;
/**
* Pauses a currently running task. Has no effect on a paused or failed task.
* @return True if the operation took effect, false if ignored.
*/
pause(): boolean;
/**
* Cancels a currently running or paused task. Has no effect on a complete or
* failed task.
* @return True if the operation took effect, false if ignored.
*/
cancel(): boolean;
}
+29
View File
@@ -0,0 +1,29 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { TaskState } from './implementation/taskenums';
import { Metadata } from './metadata';
import { Reference } from './reference';
import { UploadTask } from './task';
export declare class UploadTaskSnapshot {
readonly bytesTransferred: number;
readonly totalBytes: number;
readonly state: TaskState;
readonly metadata: Metadata | null;
readonly task: UploadTask;
readonly ref: Reference;
constructor(bytesTransferred: number, totalBytes: number, state: TaskState, metadata: Metadata | null, task: UploadTask, ref: Reference);
}
+98
View File
@@ -0,0 +1,98 @@
{
"_from": "@firebase/storage@0.3.11",
"_id": "@firebase/storage@0.3.11",
"_inBundle": false,
"_integrity": "sha512-Q2ffXE+X62gFy5mZkg7qhzAC7+kqaNZWpgS+297h/hWr/cFBDyC8eBPmnI509eKi2okixmOMbWnNluZkNYNSfw==",
"_location": "/@firebase/storage",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@firebase/storage@0.3.11",
"name": "@firebase/storage",
"escapedName": "@firebase%2fstorage",
"scope": "@firebase",
"rawSpec": "0.3.11",
"saveSpec": null,
"fetchSpec": "0.3.11"
},
"_requiredBy": [
"/firebase"
],
"_resolved": "https://registry.npmjs.org/@firebase/storage/-/storage-0.3.11.tgz",
"_shasum": "fc238e7ec6a709bb70901bd9e6d8eefea333a935",
"_spec": "@firebase/storage@0.3.11",
"_where": "C:\\Users\\matia\\Documents\\GitHub\\FutoX-Musix\\node_modules\\firebase",
"author": {
"name": "Firebase",
"email": "firebase-support@google.com",
"url": "https://firebase.google.com/"
},
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"bundleDependencies": false,
"dependencies": {
"@firebase/storage-types": "0.3.3",
"@firebase/util": "0.2.27",
"tslib": "1.10.0"
},
"deprecated": false,
"description": "This is the Cloud Storage component of the Firebase JS SDK.",
"devDependencies": {
"@types/chai": "4.2.0",
"@types/mocha": "5.2.7",
"@types/sinon": "7.0.13",
"@typescript-eslint/eslint-plugin": "2.0.0",
"@typescript-eslint/eslint-plugin-tslint": "2.0.0",
"@typescript-eslint/parser": "2.0.0",
"chai": "4.2.0",
"eslint": "5.16.0",
"karma": "4.3.0",
"karma-chrome-launcher": "3.1.0",
"karma-cli": "2.0.0",
"karma-firefox-launcher": "1.2.0",
"karma-mocha": "1.3.0",
"karma-sauce-launcher": "1.2.0",
"karma-sourcemap-loader": "0.3.7",
"karma-spec-reporter": "0.0.32",
"karma-webpack": "4.0.2",
"npm-run-all": "4.1.5",
"rollup": "1.20.3",
"rollup-plugin-typescript2": "0.24.0",
"sinon": "7.4.1",
"source-map-loader": "0.2.4",
"ts-loader": "6.0.4",
"typescript": "3.5.3",
"webpack": "4.39.3"
},
"esm2017": "dist/index.esm2017.js",
"files": [
"dist"
],
"homepage": "https://github.com/firebase/firebase-js-sdk#readme",
"license": "Apache-2.0",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"name": "@firebase/storage",
"peerDependencies": {
"@firebase/app": "0.x",
"@firebase/app-types": "0.x"
},
"repository": {
"directory": "packages/storage",
"type": "git",
"url": "git+https://github.com/firebase/firebase-js-sdk.git"
},
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"lint": "eslint -c .eslintrc.json '**/*.ts' --ignore-path '../../.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.json '**/*.ts' --ignore-path '../../.gitignore'",
"prepare": "yarn build",
"test": "run-p test:browser lint",
"test:browser": "karma start --single-run"
},
"typings": "dist/index.d.ts",
"version": "0.3.11"
}