@firebase/storage 0.13.3 → 0.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs.js +3571 -3571
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.cjs.js +3571 -3571
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +3571 -3571
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +3596 -3596
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +3596 -3596
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api.browser.d.ts +47 -47
- package/dist/node-esm/src/api.d.ts +200 -200
- package/dist/node-esm/src/api.node.d.ts +47 -47
- package/dist/node-esm/src/constants.d.ts +20 -20
- package/dist/node-esm/src/implementation/async.d.ts +22 -22
- package/dist/node-esm/src/implementation/backoff.d.ts +43 -43
- package/dist/node-esm/src/implementation/blob.d.ts +34 -34
- package/dist/node-esm/src/implementation/connection.d.ts +56 -56
- package/dist/node-esm/src/implementation/constants.d.ts +48 -48
- package/dist/node-esm/src/implementation/error.d.ts +126 -126
- package/dist/node-esm/src/implementation/failrequest.d.ts +29 -29
- package/dist/node-esm/src/implementation/fs.d.ts +17 -17
- package/dist/node-esm/src/implementation/json.d.ts +7 -7
- package/dist/node-esm/src/implementation/list.d.ts +19 -19
- package/dist/node-esm/src/implementation/location.d.ts +32 -32
- package/dist/node-esm/src/implementation/metadata.d.ts +40 -40
- package/dist/node-esm/src/implementation/observer.d.ts +47 -47
- package/dist/node-esm/src/implementation/path.d.ts +31 -31
- package/dist/node-esm/src/implementation/request.d.ts +47 -47
- package/dist/node-esm/src/implementation/requestinfo.d.ts +73 -73
- package/dist/node-esm/src/implementation/requests.d.ts +84 -84
- package/dist/node-esm/src/implementation/string.d.ts +73 -73
- package/dist/node-esm/src/implementation/taskenums.d.ts +77 -77
- package/dist/node-esm/src/implementation/type.d.ts +23 -23
- package/dist/node-esm/src/implementation/url.d.ts +22 -22
- package/dist/node-esm/src/implementation/utils.d.ts +23 -23
- package/dist/node-esm/src/index.d.ts +7 -7
- package/dist/node-esm/src/index.node.d.ts +7 -7
- package/dist/node-esm/src/list.d.ts +41 -41
- package/dist/node-esm/src/metadata.d.ts +27 -27
- package/dist/node-esm/src/platform/base64.d.ts +20 -20
- package/dist/node-esm/src/platform/browser/base64.d.ts +19 -19
- package/dist/node-esm/src/platform/browser/connection.d.ts +55 -55
- package/dist/node-esm/src/platform/connection.d.ts +22 -22
- package/dist/node-esm/src/platform/node/base64.d.ts +19 -19
- package/dist/node-esm/src/platform/node/connection.d.ts +58 -59
- package/dist/node-esm/src/public-types.d.ts +424 -424
- package/dist/node-esm/src/reference.d.ts +208 -208
- package/dist/node-esm/src/service.d.ts +130 -130
- package/dist/node-esm/src/task.d.ts +148 -148
- package/dist/node-esm/test/browser/blob.test.d.ts +17 -17
- package/dist/node-esm/test/browser/connection.test.d.ts +17 -17
- package/dist/node-esm/test/browser/string.browser.test.d.ts +17 -17
- package/dist/node-esm/test/integration/integration.test.d.ts +24 -24
- package/dist/node-esm/test/node/connection.test.d.ts +17 -17
- package/dist/node-esm/test/node/stream.test.d.ts +17 -17
- package/dist/node-esm/test/unit/connection.d.ts +47 -47
- package/dist/node-esm/test/unit/index.test.d.ts +4 -4
- package/dist/node-esm/test/unit/location.test.d.ts +1 -1
- package/dist/node-esm/test/unit/reference.test.d.ts +1 -1
- package/dist/node-esm/test/unit/request.test.d.ts +1 -1
- package/dist/node-esm/test/unit/requests.test.d.ts +1 -1
- package/dist/node-esm/test/unit/service.test.d.ts +1 -1
- package/dist/node-esm/test/unit/string.test.d.ts +1 -1
- package/dist/node-esm/test/unit/task.test.d.ts +1 -1
- package/dist/node-esm/test/unit/testshared.d.ts +60 -60
- package/dist/node-esm/test/unit/utils.test.d.ts +17 -17
- package/dist/src/api.browser.d.ts +47 -47
- package/dist/src/api.d.ts +200 -200
- package/dist/src/api.node.d.ts +47 -47
- package/dist/src/constants.d.ts +20 -20
- package/dist/src/implementation/async.d.ts +22 -22
- package/dist/src/implementation/backoff.d.ts +43 -43
- package/dist/src/implementation/blob.d.ts +34 -34
- package/dist/src/implementation/connection.d.ts +56 -56
- package/dist/src/implementation/constants.d.ts +48 -48
- package/dist/src/implementation/error.d.ts +126 -126
- package/dist/src/implementation/failrequest.d.ts +29 -29
- package/dist/src/implementation/fs.d.ts +17 -17
- package/dist/src/implementation/json.d.ts +7 -7
- package/dist/src/implementation/list.d.ts +19 -19
- package/dist/src/implementation/location.d.ts +32 -32
- package/dist/src/implementation/metadata.d.ts +40 -40
- package/dist/src/implementation/observer.d.ts +47 -47
- package/dist/src/implementation/path.d.ts +31 -31
- package/dist/src/implementation/request.d.ts +47 -47
- package/dist/src/implementation/requestinfo.d.ts +73 -73
- package/dist/src/implementation/requests.d.ts +84 -84
- package/dist/src/implementation/string.d.ts +73 -73
- package/dist/src/implementation/taskenums.d.ts +77 -77
- package/dist/src/implementation/type.d.ts +23 -23
- package/dist/src/implementation/url.d.ts +22 -22
- package/dist/src/implementation/utils.d.ts +23 -23
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.node.d.ts +7 -7
- package/dist/src/list.d.ts +41 -41
- package/dist/src/metadata.d.ts +27 -27
- package/dist/src/platform/base64.d.ts +20 -20
- package/dist/src/platform/browser/base64.d.ts +19 -19
- package/dist/src/platform/browser/connection.d.ts +55 -55
- package/dist/src/platform/connection.d.ts +22 -22
- package/dist/src/platform/node/base64.d.ts +19 -19
- package/dist/src/platform/node/connection.d.ts +58 -59
- package/dist/src/public-types.d.ts +424 -424
- package/dist/src/reference.d.ts +208 -208
- package/dist/src/service.d.ts +130 -130
- package/dist/src/task.d.ts +148 -148
- package/dist/test/browser/blob.test.d.ts +17 -17
- package/dist/test/browser/connection.test.d.ts +17 -17
- package/dist/test/browser/string.browser.test.d.ts +17 -17
- package/dist/test/integration/integration.test.d.ts +24 -24
- package/dist/test/node/connection.test.d.ts +17 -17
- package/dist/test/node/stream.test.d.ts +17 -17
- package/dist/test/unit/connection.d.ts +47 -47
- package/dist/test/unit/index.test.d.ts +4 -4
- package/dist/test/unit/location.test.d.ts +1 -1
- package/dist/test/unit/reference.test.d.ts +1 -1
- package/dist/test/unit/request.test.d.ts +1 -1
- package/dist/test/unit/requests.test.d.ts +1 -1
- package/dist/test/unit/service.test.d.ts +1 -1
- package/dist/test/unit/string.test.d.ts +1 -1
- package/dist/test/unit/task.test.d.ts +1 -1
- package/dist/test/unit/testshared.d.ts +60 -60
- package/dist/test/unit/utils.test.d.ts +17 -17
- package/package.json +6 -6
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { StorageError } from './error';
|
|
18
|
-
import { Headers, Connection, ConnectionType } from './connection';
|
|
19
|
-
/**
|
|
20
|
-
* Type for url params stored in RequestInfo.
|
|
21
|
-
*/
|
|
22
|
-
export interface UrlParams {
|
|
23
|
-
[name: string]: string | number;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* A function that converts a server response to the API type expected by the
|
|
27
|
-
* SDK.
|
|
28
|
-
*
|
|
29
|
-
* @param I - the type of the backend's network response
|
|
30
|
-
* @param O - the output response type used by the rest of the SDK.
|
|
31
|
-
*/
|
|
32
|
-
export
|
|
33
|
-
/** A function to handle an error. */
|
|
34
|
-
export
|
|
35
|
-
/**
|
|
36
|
-
* Contains a fully specified request.
|
|
37
|
-
*
|
|
38
|
-
* @param I - the type of the backend's network response.
|
|
39
|
-
* @param O - the output response type used by the rest of the SDK.
|
|
40
|
-
*/
|
|
41
|
-
export declare class RequestInfo<I extends ConnectionType, O> {
|
|
42
|
-
url: string;
|
|
43
|
-
method: string;
|
|
44
|
-
/**
|
|
45
|
-
* Returns the value with which to resolve the request's promise. Only called
|
|
46
|
-
* if the request is successful. Throw from this function to reject the
|
|
47
|
-
* returned Request's promise with the thrown error.
|
|
48
|
-
* Note: The XhrIo passed to this function may be reused after this callback
|
|
49
|
-
* returns. Do not keep a reference to it in any way.
|
|
50
|
-
*/
|
|
51
|
-
handler: RequestHandler<I, O>;
|
|
52
|
-
timeout: number;
|
|
53
|
-
urlParams: UrlParams;
|
|
54
|
-
headers: Headers;
|
|
55
|
-
body: Blob | string | Uint8Array | null;
|
|
56
|
-
errorHandler: ErrorHandler | null;
|
|
57
|
-
/**
|
|
58
|
-
* Called with the current number of bytes uploaded and total size (-1 if not
|
|
59
|
-
* computable) of the request body (i.e. used to report upload progress).
|
|
60
|
-
*/
|
|
61
|
-
progressCallback: ((p1: number, p2: number) => void) | null;
|
|
62
|
-
successCodes: number[];
|
|
63
|
-
additionalRetryCodes: number[];
|
|
64
|
-
constructor(url: string, method: string,
|
|
65
|
-
/**
|
|
66
|
-
* Returns the value with which to resolve the request's promise. Only called
|
|
67
|
-
* if the request is successful. Throw from this function to reject the
|
|
68
|
-
* returned Request's promise with the thrown error.
|
|
69
|
-
* Note: The XhrIo passed to this function may be reused after this callback
|
|
70
|
-
* returns. Do not keep a reference to it in any way.
|
|
71
|
-
*/
|
|
72
|
-
handler: RequestHandler<I, O>, timeout: number);
|
|
73
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { StorageError } from './error';
|
|
18
|
+
import { Headers, Connection, ConnectionType } from './connection';
|
|
19
|
+
/**
|
|
20
|
+
* Type for url params stored in RequestInfo.
|
|
21
|
+
*/
|
|
22
|
+
export interface UrlParams {
|
|
23
|
+
[name: string]: string | number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A function that converts a server response to the API type expected by the
|
|
27
|
+
* SDK.
|
|
28
|
+
*
|
|
29
|
+
* @param I - the type of the backend's network response
|
|
30
|
+
* @param O - the output response type used by the rest of the SDK.
|
|
31
|
+
*/
|
|
32
|
+
export type RequestHandler<I extends ConnectionType, O> = (connection: Connection<I>, response: I) => O;
|
|
33
|
+
/** A function to handle an error. */
|
|
34
|
+
export type ErrorHandler = (connection: Connection<ConnectionType>, response: StorageError) => StorageError;
|
|
35
|
+
/**
|
|
36
|
+
* Contains a fully specified request.
|
|
37
|
+
*
|
|
38
|
+
* @param I - the type of the backend's network response.
|
|
39
|
+
* @param O - the output response type used by the rest of the SDK.
|
|
40
|
+
*/
|
|
41
|
+
export declare class RequestInfo<I extends ConnectionType, O> {
|
|
42
|
+
url: string;
|
|
43
|
+
method: string;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the value with which to resolve the request's promise. Only called
|
|
46
|
+
* if the request is successful. Throw from this function to reject the
|
|
47
|
+
* returned Request's promise with the thrown error.
|
|
48
|
+
* Note: The XhrIo passed to this function may be reused after this callback
|
|
49
|
+
* returns. Do not keep a reference to it in any way.
|
|
50
|
+
*/
|
|
51
|
+
handler: RequestHandler<I, O>;
|
|
52
|
+
timeout: number;
|
|
53
|
+
urlParams: UrlParams;
|
|
54
|
+
headers: Headers;
|
|
55
|
+
body: Blob | string | Uint8Array | null;
|
|
56
|
+
errorHandler: ErrorHandler | null;
|
|
57
|
+
/**
|
|
58
|
+
* Called with the current number of bytes uploaded and total size (-1 if not
|
|
59
|
+
* computable) of the request body (i.e. used to report upload progress).
|
|
60
|
+
*/
|
|
61
|
+
progressCallback: ((p1: number, p2: number) => void) | null;
|
|
62
|
+
successCodes: number[];
|
|
63
|
+
additionalRetryCodes: number[];
|
|
64
|
+
constructor(url: string, method: string,
|
|
65
|
+
/**
|
|
66
|
+
* Returns the value with which to resolve the request's promise. Only called
|
|
67
|
+
* if the request is successful. Throw from this function to reject the
|
|
68
|
+
* returned Request's promise with the thrown error.
|
|
69
|
+
* Note: The XhrIo passed to this function may be reused after this callback
|
|
70
|
+
* returns. Do not keep a reference to it in any way.
|
|
71
|
+
*/
|
|
72
|
+
handler: RequestHandler<I, O>, timeout: number);
|
|
73
|
+
}
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* @fileoverview Defines methods for interacting with the network.
|
|
19
|
-
*/
|
|
20
|
-
import { Metadata } from '../metadata';
|
|
21
|
-
import { ListResult } from '../list';
|
|
22
|
-
import { FbsBlob } from './blob';
|
|
23
|
-
import { StorageError } from './error';
|
|
24
|
-
import { Location } from './location';
|
|
25
|
-
import { Mappings } from './metadata';
|
|
26
|
-
import { RequestInfo } from './requestinfo';
|
|
27
|
-
import { Connection, ConnectionType } from './connection';
|
|
28
|
-
import { FirebaseStorageImpl } from '../service';
|
|
29
|
-
/**
|
|
30
|
-
* Throws the UNKNOWN StorageError if cndn is false.
|
|
31
|
-
*/
|
|
32
|
-
export declare function handlerCheck(cndn: boolean): void;
|
|
33
|
-
export declare function metadataHandler(service: FirebaseStorageImpl, mappings: Mappings): (p1: Connection<string>, p2: string) => Metadata;
|
|
34
|
-
export declare function listHandler(service: FirebaseStorageImpl, bucket: string): (p1: Connection<string>, p2: string) => ListResult;
|
|
35
|
-
export declare function downloadUrlHandler(service: FirebaseStorageImpl, mappings: Mappings): (p1: Connection<string>, p2: string) => string | null;
|
|
36
|
-
export declare function sharedErrorHandler(location: Location): (p1: Connection<ConnectionType>, p2: StorageError) => StorageError;
|
|
37
|
-
export declare function objectErrorHandler(location: Location): (p1: Connection<ConnectionType>, p2: StorageError) => StorageError;
|
|
38
|
-
export declare function getMetadata(service: FirebaseStorageImpl, location: Location, mappings: Mappings): RequestInfo<string, Metadata>;
|
|
39
|
-
export declare function list(service: FirebaseStorageImpl, location: Location, delimiter?: string, pageToken?: string | null, maxResults?: number | null): RequestInfo<string, ListResult>;
|
|
40
|
-
export declare function getBytes<I extends ConnectionType>(service: FirebaseStorageImpl, location: Location, maxDownloadSizeBytes?: number): RequestInfo<I, I>;
|
|
41
|
-
export declare function getDownloadUrl(service: FirebaseStorageImpl, location: Location, mappings: Mappings): RequestInfo<string, string | null>;
|
|
42
|
-
export declare function updateMetadata(service: FirebaseStorageImpl, location: Location, metadata: Partial<Metadata>, mappings: Mappings): RequestInfo<string, Metadata>;
|
|
43
|
-
export declare function deleteObject(service: FirebaseStorageImpl, location: Location): RequestInfo<string, void>;
|
|
44
|
-
export declare function determineContentType_(metadata: Metadata | null, blob: FbsBlob | null): string;
|
|
45
|
-
export declare function metadataForUpload_(location: Location, blob: FbsBlob, metadata?: Metadata | null): Metadata;
|
|
46
|
-
/**
|
|
47
|
-
* Prepare RequestInfo for uploads as Content-Type: multipart.
|
|
48
|
-
*/
|
|
49
|
-
export declare function multipartUpload(service: FirebaseStorageImpl, location: Location, mappings: Mappings, blob: FbsBlob, metadata?: Metadata | null): RequestInfo<string, Metadata>;
|
|
50
|
-
/**
|
|
51
|
-
* @param current The number of bytes that have been uploaded so far.
|
|
52
|
-
* @param total The total number of bytes in the upload.
|
|
53
|
-
* @param opt_finalized True if the server has finished the upload.
|
|
54
|
-
* @param opt_metadata The upload metadata, should
|
|
55
|
-
* only be passed if opt_finalized is true.
|
|
56
|
-
*/
|
|
57
|
-
export declare class ResumableUploadStatus {
|
|
58
|
-
current: number;
|
|
59
|
-
total: number;
|
|
60
|
-
finalized: boolean;
|
|
61
|
-
metadata: Metadata | null;
|
|
62
|
-
constructor(current: number, total: number, finalized?: boolean, metadata?: Metadata | null);
|
|
63
|
-
}
|
|
64
|
-
export declare function checkResumeHeader_(xhr: Connection<string>, allowed?: string[]): string;
|
|
65
|
-
export declare function createResumableUpload(service: FirebaseStorageImpl, location: Location, mappings: Mappings, blob: FbsBlob, metadata?: Metadata | null): RequestInfo<string, string>;
|
|
66
|
-
/**
|
|
67
|
-
* @param url From a call to fbs.requests.createResumableUpload.
|
|
68
|
-
*/
|
|
69
|
-
export declare function getResumableUploadStatus(service: FirebaseStorageImpl, location: Location, url: string, blob: FbsBlob): RequestInfo<string, ResumableUploadStatus>;
|
|
70
|
-
/**
|
|
71
|
-
* Any uploads via the resumable upload API must transfer a number of bytes
|
|
72
|
-
* that is a multiple of this number.
|
|
73
|
-
*/
|
|
74
|
-
export declare const RESUMABLE_UPLOAD_CHUNK_SIZE: number;
|
|
75
|
-
/**
|
|
76
|
-
* @param url From a call to fbs.requests.createResumableUpload.
|
|
77
|
-
* @param chunkSize Number of bytes to upload.
|
|
78
|
-
* @param status The previous status.
|
|
79
|
-
* If not passed or null, we start from the beginning.
|
|
80
|
-
* @throws fbs.Error If the upload is already complete, the passed in status
|
|
81
|
-
* has a final size inconsistent with the blob, or the blob cannot be sliced
|
|
82
|
-
* for upload.
|
|
83
|
-
*/
|
|
84
|
-
export declare function continueResumableUpload(location: Location, service: FirebaseStorageImpl, url: string, blob: FbsBlob, chunkSize: number, mappings: Mappings, status?: ResumableUploadStatus | null, progressCallback?: ((p1: number, p2: number) => void) | null): RequestInfo<string, ResumableUploadStatus>;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* @fileoverview Defines methods for interacting with the network.
|
|
19
|
+
*/
|
|
20
|
+
import { Metadata } from '../metadata';
|
|
21
|
+
import { ListResult } from '../list';
|
|
22
|
+
import { FbsBlob } from './blob';
|
|
23
|
+
import { StorageError } from './error';
|
|
24
|
+
import { Location } from './location';
|
|
25
|
+
import { Mappings } from './metadata';
|
|
26
|
+
import { RequestInfo } from './requestinfo';
|
|
27
|
+
import { Connection, ConnectionType } from './connection';
|
|
28
|
+
import { FirebaseStorageImpl } from '../service';
|
|
29
|
+
/**
|
|
30
|
+
* Throws the UNKNOWN StorageError if cndn is false.
|
|
31
|
+
*/
|
|
32
|
+
export declare function handlerCheck(cndn: boolean): void;
|
|
33
|
+
export declare function metadataHandler(service: FirebaseStorageImpl, mappings: Mappings): (p1: Connection<string>, p2: string) => Metadata;
|
|
34
|
+
export declare function listHandler(service: FirebaseStorageImpl, bucket: string): (p1: Connection<string>, p2: string) => ListResult;
|
|
35
|
+
export declare function downloadUrlHandler(service: FirebaseStorageImpl, mappings: Mappings): (p1: Connection<string>, p2: string) => string | null;
|
|
36
|
+
export declare function sharedErrorHandler(location: Location): (p1: Connection<ConnectionType>, p2: StorageError) => StorageError;
|
|
37
|
+
export declare function objectErrorHandler(location: Location): (p1: Connection<ConnectionType>, p2: StorageError) => StorageError;
|
|
38
|
+
export declare function getMetadata(service: FirebaseStorageImpl, location: Location, mappings: Mappings): RequestInfo<string, Metadata>;
|
|
39
|
+
export declare function list(service: FirebaseStorageImpl, location: Location, delimiter?: string, pageToken?: string | null, maxResults?: number | null): RequestInfo<string, ListResult>;
|
|
40
|
+
export declare function getBytes<I extends ConnectionType>(service: FirebaseStorageImpl, location: Location, maxDownloadSizeBytes?: number): RequestInfo<I, I>;
|
|
41
|
+
export declare function getDownloadUrl(service: FirebaseStorageImpl, location: Location, mappings: Mappings): RequestInfo<string, string | null>;
|
|
42
|
+
export declare function updateMetadata(service: FirebaseStorageImpl, location: Location, metadata: Partial<Metadata>, mappings: Mappings): RequestInfo<string, Metadata>;
|
|
43
|
+
export declare function deleteObject(service: FirebaseStorageImpl, location: Location): RequestInfo<string, void>;
|
|
44
|
+
export declare function determineContentType_(metadata: Metadata | null, blob: FbsBlob | null): string;
|
|
45
|
+
export declare function metadataForUpload_(location: Location, blob: FbsBlob, metadata?: Metadata | null): Metadata;
|
|
46
|
+
/**
|
|
47
|
+
* Prepare RequestInfo for uploads as Content-Type: multipart.
|
|
48
|
+
*/
|
|
49
|
+
export declare function multipartUpload(service: FirebaseStorageImpl, location: Location, mappings: Mappings, blob: FbsBlob, metadata?: Metadata | null): RequestInfo<string, Metadata>;
|
|
50
|
+
/**
|
|
51
|
+
* @param current The number of bytes that have been uploaded so far.
|
|
52
|
+
* @param total The total number of bytes in the upload.
|
|
53
|
+
* @param opt_finalized True if the server has finished the upload.
|
|
54
|
+
* @param opt_metadata The upload metadata, should
|
|
55
|
+
* only be passed if opt_finalized is true.
|
|
56
|
+
*/
|
|
57
|
+
export declare class ResumableUploadStatus {
|
|
58
|
+
current: number;
|
|
59
|
+
total: number;
|
|
60
|
+
finalized: boolean;
|
|
61
|
+
metadata: Metadata | null;
|
|
62
|
+
constructor(current: number, total: number, finalized?: boolean, metadata?: Metadata | null);
|
|
63
|
+
}
|
|
64
|
+
export declare function checkResumeHeader_(xhr: Connection<string>, allowed?: string[]): string;
|
|
65
|
+
export declare function createResumableUpload(service: FirebaseStorageImpl, location: Location, mappings: Mappings, blob: FbsBlob, metadata?: Metadata | null): RequestInfo<string, string>;
|
|
66
|
+
/**
|
|
67
|
+
* @param url From a call to fbs.requests.createResumableUpload.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getResumableUploadStatus(service: FirebaseStorageImpl, location: Location, url: string, blob: FbsBlob): RequestInfo<string, ResumableUploadStatus>;
|
|
70
|
+
/**
|
|
71
|
+
* Any uploads via the resumable upload API must transfer a number of bytes
|
|
72
|
+
* that is a multiple of this number.
|
|
73
|
+
*/
|
|
74
|
+
export declare const RESUMABLE_UPLOAD_CHUNK_SIZE: number;
|
|
75
|
+
/**
|
|
76
|
+
* @param url From a call to fbs.requests.createResumableUpload.
|
|
77
|
+
* @param chunkSize Number of bytes to upload.
|
|
78
|
+
* @param status The previous status.
|
|
79
|
+
* If not passed or null, we start from the beginning.
|
|
80
|
+
* @throws fbs.Error If the upload is already complete, the passed in status
|
|
81
|
+
* has a final size inconsistent with the blob, or the blob cannot be sliced
|
|
82
|
+
* for upload.
|
|
83
|
+
*/
|
|
84
|
+
export declare function continueResumableUpload(location: Location, service: FirebaseStorageImpl, url: string, blob: FbsBlob, chunkSize: number, mappings: Mappings, status?: ResumableUploadStatus | null, progressCallback?: ((p1: number, p2: number) => void) | null): RequestInfo<string, ResumableUploadStatus>;
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* An enumeration of the possible string formats for upload.
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
export
|
|
22
|
-
/**
|
|
23
|
-
* An enumeration of the possible string formats for upload.
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
export declare const StringFormat: {
|
|
27
|
-
/**
|
|
28
|
-
* Indicates the string should be interpreted "raw", that is, as normal text.
|
|
29
|
-
* The string will be interpreted as UTF-16, then uploaded as a UTF-8 byte
|
|
30
|
-
* sequence.
|
|
31
|
-
* Example: The string 'Hello! \\ud83d\\ude0a' becomes the byte sequence
|
|
32
|
-
* 48 65 6c 6c 6f 21 20 f0 9f 98 8a
|
|
33
|
-
*/
|
|
34
|
-
readonly RAW: "raw";
|
|
35
|
-
/**
|
|
36
|
-
* Indicates the string should be interpreted as base64-encoded data.
|
|
37
|
-
* Padding characters (trailing '='s) are optional.
|
|
38
|
-
* Example: The string 'rWmO++E6t7/rlw==' becomes the byte sequence
|
|
39
|
-
* ad 69 8e fb e1 3a b7 bf eb 97
|
|
40
|
-
*/
|
|
41
|
-
readonly BASE64: "base64";
|
|
42
|
-
/**
|
|
43
|
-
* Indicates the string should be interpreted as base64url-encoded data.
|
|
44
|
-
* Padding characters (trailing '='s) are optional.
|
|
45
|
-
* Example: The string 'rWmO--E6t7_rlw==' becomes the byte sequence
|
|
46
|
-
* ad 69 8e fb e1 3a b7 bf eb 97
|
|
47
|
-
*/
|
|
48
|
-
readonly BASE64URL: "base64url";
|
|
49
|
-
/**
|
|
50
|
-
* Indicates the string is a data URL, such as one obtained from
|
|
51
|
-
* canvas.toDataURL().
|
|
52
|
-
* Example: the string 'data:application/octet-stream;base64,aaaa'
|
|
53
|
-
* becomes the byte sequence
|
|
54
|
-
* 69 a6 9a
|
|
55
|
-
* (the content-type "application/octet-stream" is also applied, but can
|
|
56
|
-
* be overridden in the metadata object).
|
|
57
|
-
*/
|
|
58
|
-
readonly DATA_URL: "data_url";
|
|
59
|
-
};
|
|
60
|
-
export declare class StringData {
|
|
61
|
-
data: Uint8Array;
|
|
62
|
-
contentType: string | null;
|
|
63
|
-
constructor(data: Uint8Array, contentType?: string | null);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* @internal
|
|
67
|
-
*/
|
|
68
|
-
export declare function dataFromString(format: StringFormat, stringData: string): StringData;
|
|
69
|
-
export declare function utf8Bytes_(value: string): Uint8Array;
|
|
70
|
-
export declare function percentEncodedBytes_(value: string): Uint8Array;
|
|
71
|
-
export declare function base64Bytes_(format: StringFormat, value: string): Uint8Array;
|
|
72
|
-
export declare function dataURLBytes_(dataUrl: string): Uint8Array;
|
|
73
|
-
export declare function dataURLContentType_(dataUrl: string): string | null;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* An enumeration of the possible string formats for upload.
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export type StringFormat = (typeof StringFormat)[keyof typeof StringFormat];
|
|
22
|
+
/**
|
|
23
|
+
* An enumeration of the possible string formats for upload.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare const StringFormat: {
|
|
27
|
+
/**
|
|
28
|
+
* Indicates the string should be interpreted "raw", that is, as normal text.
|
|
29
|
+
* The string will be interpreted as UTF-16, then uploaded as a UTF-8 byte
|
|
30
|
+
* sequence.
|
|
31
|
+
* Example: The string 'Hello! \\ud83d\\ude0a' becomes the byte sequence
|
|
32
|
+
* 48 65 6c 6c 6f 21 20 f0 9f 98 8a
|
|
33
|
+
*/
|
|
34
|
+
readonly RAW: "raw";
|
|
35
|
+
/**
|
|
36
|
+
* Indicates the string should be interpreted as base64-encoded data.
|
|
37
|
+
* Padding characters (trailing '='s) are optional.
|
|
38
|
+
* Example: The string 'rWmO++E6t7/rlw==' becomes the byte sequence
|
|
39
|
+
* ad 69 8e fb e1 3a b7 bf eb 97
|
|
40
|
+
*/
|
|
41
|
+
readonly BASE64: "base64";
|
|
42
|
+
/**
|
|
43
|
+
* Indicates the string should be interpreted as base64url-encoded data.
|
|
44
|
+
* Padding characters (trailing '='s) are optional.
|
|
45
|
+
* Example: The string 'rWmO--E6t7_rlw==' becomes the byte sequence
|
|
46
|
+
* ad 69 8e fb e1 3a b7 bf eb 97
|
|
47
|
+
*/
|
|
48
|
+
readonly BASE64URL: "base64url";
|
|
49
|
+
/**
|
|
50
|
+
* Indicates the string is a data URL, such as one obtained from
|
|
51
|
+
* canvas.toDataURL().
|
|
52
|
+
* Example: the string 'data:application/octet-stream;base64,aaaa'
|
|
53
|
+
* becomes the byte sequence
|
|
54
|
+
* 69 a6 9a
|
|
55
|
+
* (the content-type "application/octet-stream" is also applied, but can
|
|
56
|
+
* be overridden in the metadata object).
|
|
57
|
+
*/
|
|
58
|
+
readonly DATA_URL: "data_url";
|
|
59
|
+
};
|
|
60
|
+
export declare class StringData {
|
|
61
|
+
data: Uint8Array;
|
|
62
|
+
contentType: string | null;
|
|
63
|
+
constructor(data: Uint8Array, contentType?: string | null);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export declare function dataFromString(format: StringFormat, stringData: string): StringData;
|
|
69
|
+
export declare function utf8Bytes_(value: string): Uint8Array;
|
|
70
|
+
export declare function percentEncodedBytes_(value: string): Uint8Array;
|
|
71
|
+
export declare function base64Bytes_(format: StringFormat, value: string): Uint8Array;
|
|
72
|
+
export declare function dataURLBytes_(dataUrl: string): Uint8Array;
|
|
73
|
+
export declare function dataURLContentType_(dataUrl: string): string | null;
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* @fileoverview Enumerations used for upload tasks.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* An event that is triggered on a task.
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export
|
|
25
|
-
/**
|
|
26
|
-
* An event that is triggered on a task.
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
export declare const TaskEvent: {
|
|
30
|
-
/**
|
|
31
|
-
* For this event,
|
|
32
|
-
* <ul>
|
|
33
|
-
* <li>The `next` function is triggered on progress updates and when the
|
|
34
|
-
* task is paused/resumed with an `UploadTaskSnapshot` as the first
|
|
35
|
-
* argument.</li>
|
|
36
|
-
* <li>The `error` function is triggered if the upload is canceled or fails
|
|
37
|
-
* for another reason.</li>
|
|
38
|
-
* <li>The `complete` function is triggered if the upload completes
|
|
39
|
-
* successfully.</li>
|
|
40
|
-
* </ul>
|
|
41
|
-
*/
|
|
42
|
-
STATE_CHANGED: string;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Internal enum for task state.
|
|
46
|
-
*/
|
|
47
|
-
export declare const enum InternalTaskState {
|
|
48
|
-
RUNNING = "running",
|
|
49
|
-
PAUSING = "pausing",
|
|
50
|
-
PAUSED = "paused",
|
|
51
|
-
SUCCESS = "success",
|
|
52
|
-
CANCELING = "canceling",
|
|
53
|
-
CANCELED = "canceled",
|
|
54
|
-
ERROR = "error"
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Represents the current state of a running upload.
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
export
|
|
61
|
-
/**
|
|
62
|
-
* Represents the current state of a running upload.
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
export declare const TaskState: {
|
|
66
|
-
/** The task is currently transferring data. */
|
|
67
|
-
readonly RUNNING: "running";
|
|
68
|
-
/** The task was paused by the user. */
|
|
69
|
-
readonly PAUSED: "paused";
|
|
70
|
-
/** The task completed successfully. */
|
|
71
|
-
readonly SUCCESS: "success";
|
|
72
|
-
/** The task was canceled. */
|
|
73
|
-
readonly CANCELED: "canceled";
|
|
74
|
-
/** The task failed with an error. */
|
|
75
|
-
readonly ERROR: "error";
|
|
76
|
-
};
|
|
77
|
-
export declare function taskStateFromInternalTaskState(state: InternalTaskState): TaskState;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* @fileoverview Enumerations used for upload tasks.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* An event that is triggered on a task.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export type TaskEvent = string;
|
|
25
|
+
/**
|
|
26
|
+
* An event that is triggered on a task.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare const TaskEvent: {
|
|
30
|
+
/**
|
|
31
|
+
* For this event,
|
|
32
|
+
* <ul>
|
|
33
|
+
* <li>The `next` function is triggered on progress updates and when the
|
|
34
|
+
* task is paused/resumed with an `UploadTaskSnapshot` as the first
|
|
35
|
+
* argument.</li>
|
|
36
|
+
* <li>The `error` function is triggered if the upload is canceled or fails
|
|
37
|
+
* for another reason.</li>
|
|
38
|
+
* <li>The `complete` function is triggered if the upload completes
|
|
39
|
+
* successfully.</li>
|
|
40
|
+
* </ul>
|
|
41
|
+
*/
|
|
42
|
+
STATE_CHANGED: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Internal enum for task state.
|
|
46
|
+
*/
|
|
47
|
+
export declare const enum InternalTaskState {
|
|
48
|
+
RUNNING = "running",
|
|
49
|
+
PAUSING = "pausing",
|
|
50
|
+
PAUSED = "paused",
|
|
51
|
+
SUCCESS = "success",
|
|
52
|
+
CANCELING = "canceling",
|
|
53
|
+
CANCELED = "canceled",
|
|
54
|
+
ERROR = "error"
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Represents the current state of a running upload.
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export type TaskState = (typeof TaskState)[keyof typeof TaskState];
|
|
61
|
+
/**
|
|
62
|
+
* Represents the current state of a running upload.
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export declare const TaskState: {
|
|
66
|
+
/** The task is currently transferring data. */
|
|
67
|
+
readonly RUNNING: "running";
|
|
68
|
+
/** The task was paused by the user. */
|
|
69
|
+
readonly PAUSED: "paused";
|
|
70
|
+
/** The task completed successfully. */
|
|
71
|
+
readonly SUCCESS: "success";
|
|
72
|
+
/** The task was canceled. */
|
|
73
|
+
readonly CANCELED: "canceled";
|
|
74
|
+
/** The task failed with an error. */
|
|
75
|
+
readonly ERROR: "error";
|
|
76
|
+
};
|
|
77
|
+
export declare function taskStateFromInternalTaskState(state: InternalTaskState): TaskState;
|