@firebase/storage 0.8.3 → 0.8.4-canary.1048c4f2d
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/CHANGELOG.md +8 -0
- package/dist/index.browser.cjs.js +45 -63
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.cjs.js +182 -178
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +44 -63
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +45 -63
- package/dist/index.esm5.js.map +1 -1
- package/dist/src/api.browser.d.ts +17 -0
- package/dist/src/api.d.ts +1 -1
- package/dist/src/api.node.d.ts +17 -0
- package/dist/src/implementation/connection.d.ts +6 -6
- package/dist/src/implementation/requestinfo.d.ts +11 -3
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.node.d.ts +7 -0
- package/dist/src/platform/browser/connection.d.ts +1 -25
- package/dist/src/platform/node/connection.d.ts +1 -0
- package/dist/storage.d.ts +18 -9
- package/dist/test/browser/connection.test.d.ts +17 -0
- package/dist/test/unit/connection.test.d.ts +17 -0
- package/package.json +9 -9
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 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
|
+
export {};
|
package/dist/src/api.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export { FbsBlob as _FbsBlob } from './implementation/blob';
|
|
|
32
32
|
export { dataFromString as _dataFromString } from './implementation/string';
|
|
33
33
|
export { invalidRootOperation as _invalidRootOperation, invalidArgument as _invalidArgument } from './implementation/error';
|
|
34
34
|
export { TaskEvent as _TaskEvent, TaskState as _TaskState } from './implementation/taskenums';
|
|
35
|
+
export { StringFormat };
|
|
35
36
|
/**
|
|
36
37
|
* Uploads data to this object's location.
|
|
37
38
|
* The upload is not resumable.
|
|
@@ -159,7 +160,6 @@ export declare function ref(storageOrRef: FirebaseStorage | StorageReference, pa
|
|
|
159
160
|
* @internal
|
|
160
161
|
*/
|
|
161
162
|
export declare function _getChild(ref: StorageReference, childPath: string): Reference;
|
|
162
|
-
export { StringFormat } from './implementation/string';
|
|
163
163
|
/**
|
|
164
164
|
* Gets a {@link FirebaseStorage} instance for the given Firebase app.
|
|
165
165
|
* @public
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 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
|
+
export {};
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
export interface Headers {
|
|
21
|
-
[name: string]: string;
|
|
22
|
-
}
|
|
17
|
+
/** Network headers */
|
|
18
|
+
export declare type Headers = Record<string, string>;
|
|
23
19
|
/**
|
|
24
20
|
* A lightweight wrapper around XMLHttpRequest with a
|
|
25
21
|
* goog.net.XhrIo-like interface.
|
|
26
22
|
*/
|
|
27
23
|
export interface Connection {
|
|
24
|
+
/**
|
|
25
|
+
* This method should never reject. In case of encountering an error, set an error code internally which can be accessed
|
|
26
|
+
* by calling getErrorCode() by callers.
|
|
27
|
+
*/
|
|
28
28
|
send(url: string, method: string, body?: ArrayBufferView | Blob | string | null, headers?: Headers): Promise<void>;
|
|
29
29
|
getErrorCode(): ErrorCode;
|
|
30
30
|
getStatus(): number;
|
|
@@ -22,6 +22,14 @@ import { Headers, Connection } from './connection';
|
|
|
22
22
|
export interface UrlParams {
|
|
23
23
|
[name: string]: string | number;
|
|
24
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 declare type RequestHandler<I, O> = (connection: Connection, response: I) => O;
|
|
25
33
|
export declare class RequestInfo<T> {
|
|
26
34
|
url: string;
|
|
27
35
|
method: string;
|
|
@@ -32,12 +40,12 @@ export declare class RequestInfo<T> {
|
|
|
32
40
|
* Note: The XhrIo passed to this function may be reused after this callback
|
|
33
41
|
* returns. Do not keep a reference to it in any way.
|
|
34
42
|
*/
|
|
35
|
-
handler:
|
|
43
|
+
handler: RequestHandler<string, T>;
|
|
36
44
|
timeout: number;
|
|
37
45
|
urlParams: UrlParams;
|
|
38
46
|
headers: Headers;
|
|
39
47
|
body: Blob | string | Uint8Array | null;
|
|
40
|
-
errorHandler:
|
|
48
|
+
errorHandler: RequestHandler<StorageError, StorageError> | null;
|
|
41
49
|
/**
|
|
42
50
|
* Called with the current number of bytes uploaded and total size (-1 if not
|
|
43
51
|
* computable) of the request body (i.e. used to report upload progress).
|
|
@@ -53,5 +61,5 @@ export declare class RequestInfo<T> {
|
|
|
53
61
|
* Note: The XhrIo passed to this function may be reused after this callback
|
|
54
62
|
* returns. Do not keep a reference to it in any way.
|
|
55
63
|
*/
|
|
56
|
-
handler:
|
|
64
|
+
handler: RequestHandler<string, T>, timeout: number);
|
|
57
65
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -25,38 +25,14 @@ export declare class XhrConnection implements Connection {
|
|
|
25
25
|
private sendPromise_;
|
|
26
26
|
private sent_;
|
|
27
27
|
constructor();
|
|
28
|
-
/**
|
|
29
|
-
* @override
|
|
30
|
-
*/
|
|
31
28
|
send(url: string, method: string, body?: ArrayBufferView | Blob | string, headers?: Headers): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* @override
|
|
34
|
-
*/
|
|
35
29
|
getErrorCode(): ErrorCode;
|
|
36
|
-
/**
|
|
37
|
-
* @override
|
|
38
|
-
*/
|
|
39
30
|
getStatus(): number;
|
|
40
|
-
/**
|
|
41
|
-
* @override
|
|
42
|
-
*/
|
|
43
31
|
getResponseText(): string;
|
|
44
|
-
/**
|
|
45
|
-
* Aborts the request.
|
|
46
|
-
* @override
|
|
47
|
-
*/
|
|
32
|
+
/** Aborts the request. */
|
|
48
33
|
abort(): void;
|
|
49
|
-
/**
|
|
50
|
-
* @override
|
|
51
|
-
*/
|
|
52
34
|
getResponseHeader(header: string): string | null;
|
|
53
|
-
/**
|
|
54
|
-
* @override
|
|
55
|
-
*/
|
|
56
35
|
addUploadProgressListener(listener: (p1: ProgressEvent) => void): void;
|
|
57
|
-
/**
|
|
58
|
-
* @override
|
|
59
|
-
*/
|
|
60
36
|
removeUploadProgressListener(listener: (p1: ProgressEvent) => void): void;
|
|
61
37
|
}
|
|
62
38
|
export declare function newConnection(): Connection;
|
|
@@ -27,6 +27,7 @@ export declare class FetchConnection implements Connection {
|
|
|
27
27
|
private body_;
|
|
28
28
|
private headers_;
|
|
29
29
|
private sent_;
|
|
30
|
+
private fetch_;
|
|
30
31
|
constructor();
|
|
31
32
|
send(url: string, method: string, body?: ArrayBufferView | Blob | string, headers?: Record<string, string>): Promise<void>;
|
|
32
33
|
getErrorCode(): ErrorCode;
|
package/dist/storage.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ declare type CompleteFn_2 = () => void;
|
|
|
26
26
|
* goog.net.XhrIo-like interface.
|
|
27
27
|
*/
|
|
28
28
|
declare interface Connection {
|
|
29
|
+
/**
|
|
30
|
+
* This method should never reject. In case of encountering an error, set an error code internally which can be accessed
|
|
31
|
+
* by calling getErrorCode() by callers.
|
|
32
|
+
*/
|
|
29
33
|
send(url: string, method: string, body?: ArrayBufferView | Blob | string | null, headers?: Headers_2): Promise<void>;
|
|
30
34
|
getErrorCode(): ErrorCode;
|
|
31
35
|
getStatus(): number;
|
|
@@ -328,12 +332,8 @@ export declare function getStorage(app?: FirebaseApp, bucketUrl?: string): Fireb
|
|
|
328
332
|
* See the License for the specific language governing permissions and
|
|
329
333
|
* limitations under the License.
|
|
330
334
|
*/
|
|
331
|
-
/**
|
|
332
|
-
|
|
333
|
-
*/
|
|
334
|
-
declare interface Headers_2 {
|
|
335
|
-
[name: string]: string;
|
|
336
|
-
}
|
|
335
|
+
/** Network headers */
|
|
336
|
+
declare type Headers_2 = Record<string, string>;
|
|
337
337
|
|
|
338
338
|
/**
|
|
339
339
|
* Internal enum for task state.
|
|
@@ -580,6 +580,15 @@ declare interface Request_2<T> {
|
|
|
580
580
|
cancel(appDelete?: boolean): void;
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
+
/**
|
|
584
|
+
* A function that converts a server response to the API type expected by the
|
|
585
|
+
* SDK.
|
|
586
|
+
*
|
|
587
|
+
* @param I - the type of the backend's network response
|
|
588
|
+
* @param O - the output response type used by the rest of the SDK.
|
|
589
|
+
*/
|
|
590
|
+
declare type RequestHandler<I, O> = (connection: Connection, response: I) => O;
|
|
591
|
+
|
|
583
592
|
declare class RequestInfo_2<T> {
|
|
584
593
|
url: string;
|
|
585
594
|
method: string;
|
|
@@ -590,12 +599,12 @@ declare class RequestInfo_2<T> {
|
|
|
590
599
|
* Note: The XhrIo passed to this function may be reused after this callback
|
|
591
600
|
* returns. Do not keep a reference to it in any way.
|
|
592
601
|
*/
|
|
593
|
-
handler:
|
|
602
|
+
handler: RequestHandler<string, T>;
|
|
594
603
|
timeout: number;
|
|
595
604
|
urlParams: UrlParams;
|
|
596
605
|
headers: Headers_2;
|
|
597
606
|
body: Blob | string | Uint8Array | null;
|
|
598
|
-
errorHandler:
|
|
607
|
+
errorHandler: RequestHandler<StorageError_2, StorageError_2> | null;
|
|
599
608
|
/**
|
|
600
609
|
* Called with the current number of bytes uploaded and total size (-1 if not
|
|
601
610
|
* computable) of the request body (i.e. used to report upload progress).
|
|
@@ -611,7 +620,7 @@ declare class RequestInfo_2<T> {
|
|
|
611
620
|
* Note: The XhrIo passed to this function may be reused after this callback
|
|
612
621
|
* returns. Do not keep a reference to it in any way.
|
|
613
622
|
*/
|
|
614
|
-
handler:
|
|
623
|
+
handler: RequestHandler<string, T>, timeout: number);
|
|
615
624
|
}
|
|
616
625
|
|
|
617
626
|
/**
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 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
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 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
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebase/storage",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-canary.1048c4f2d",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test:browser:unit": "karma start --single-run --unit",
|
|
23
23
|
"test:browser:integration": "karma start --single-run --integration",
|
|
24
24
|
"test:browser": "karma start --single-run",
|
|
25
|
-
"test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --file src/index.ts --config ../../config/mocharc.node.js",
|
|
25
|
+
"test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js",
|
|
26
26
|
"test:debug": "karma start --browser=Chrome",
|
|
27
27
|
"prettier": "prettier --write 'src/**/*.ts' 'test/**/*.ts'",
|
|
28
28
|
"api-report": "api-extractor run --local --verbose && ts-node-script ../../repo-scripts/prune-dts/prune-dts.ts --input dist/storage-public.d.ts --output dist/storage-public.d.ts",
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
},
|
|
31
31
|
"license": "Apache-2.0",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@firebase/util": "1.4.0",
|
|
34
|
-
"@firebase/component": "0.5.7",
|
|
35
|
-
"node-fetch": "2.6.
|
|
33
|
+
"@firebase/util": "1.4.0-canary.1048c4f2d",
|
|
34
|
+
"@firebase/component": "0.5.7-canary.1048c4f2d",
|
|
35
|
+
"node-fetch": "2.6.5",
|
|
36
36
|
"tslib": "^2.1.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@firebase/app": "0.
|
|
39
|
+
"@firebase/app": "0.7.4-canary.1048c4f2d"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@firebase/app": "0.7.
|
|
43
|
-
"@firebase/auth": "0.18.
|
|
44
|
-
"rollup": "2.
|
|
42
|
+
"@firebase/app": "0.7.4-canary.1048c4f2d",
|
|
43
|
+
"@firebase/auth": "0.18.3-canary.1048c4f2d",
|
|
44
|
+
"rollup": "2.57.0",
|
|
45
45
|
"@rollup/plugin-alias": "3.1.5",
|
|
46
46
|
"@rollup/plugin-json": "4.1.0",
|
|
47
47
|
"rollup-plugin-typescript2": "0.30.0",
|