@depup/firebase__storage 0.14.1-depup.0
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/README.md +31 -0
- package/changes.json +10 -0
- package/dist/index.browser.cjs.js +3685 -0
- package/dist/index.browser.cjs.js.map +1 -0
- package/dist/index.cjs.js +3685 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.js +3656 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.node.cjs.js +3710 -0
- package/dist/index.node.cjs.js.map +1 -0
- package/dist/node-esm/index.node.esm.js +3681 -0
- package/dist/node-esm/index.node.esm.js.map +1 -0
- package/dist/node-esm/package.json +1 -0
- package/dist/node-esm/src/api.browser.d.ts +47 -0
- package/dist/node-esm/src/api.d.ts +200 -0
- package/dist/node-esm/src/api.node.d.ts +47 -0
- package/dist/node-esm/src/constants.d.ts +20 -0
- package/dist/node-esm/src/implementation/async.d.ts +22 -0
- package/dist/node-esm/src/implementation/backoff.d.ts +43 -0
- package/dist/node-esm/src/implementation/blob.d.ts +34 -0
- package/dist/node-esm/src/implementation/connection.d.ts +56 -0
- package/dist/node-esm/src/implementation/constants.d.ts +48 -0
- package/dist/node-esm/src/implementation/error.d.ts +126 -0
- package/dist/node-esm/src/implementation/failrequest.d.ts +29 -0
- package/dist/node-esm/src/implementation/fs.d.ts +17 -0
- package/dist/node-esm/src/implementation/json.d.ts +7 -0
- package/dist/node-esm/src/implementation/list.d.ts +19 -0
- package/dist/node-esm/src/implementation/location.d.ts +32 -0
- package/dist/node-esm/src/implementation/metadata.d.ts +40 -0
- package/dist/node-esm/src/implementation/observer.d.ts +47 -0
- package/dist/node-esm/src/implementation/path.d.ts +31 -0
- package/dist/node-esm/src/implementation/request.d.ts +47 -0
- package/dist/node-esm/src/implementation/requestinfo.d.ts +73 -0
- package/dist/node-esm/src/implementation/requests.d.ts +84 -0
- package/dist/node-esm/src/implementation/string.d.ts +73 -0
- package/dist/node-esm/src/implementation/taskenums.d.ts +77 -0
- package/dist/node-esm/src/implementation/type.d.ts +23 -0
- package/dist/node-esm/src/implementation/url.d.ts +22 -0
- package/dist/node-esm/src/implementation/utils.d.ts +23 -0
- package/dist/node-esm/src/index.d.ts +7 -0
- package/dist/node-esm/src/index.node.d.ts +7 -0
- package/dist/node-esm/src/list.d.ts +41 -0
- package/dist/node-esm/src/metadata.d.ts +27 -0
- package/dist/node-esm/src/platform/base64.d.ts +20 -0
- package/dist/node-esm/src/platform/browser/base64.d.ts +19 -0
- package/dist/node-esm/src/platform/browser/connection.d.ts +55 -0
- package/dist/node-esm/src/platform/connection.d.ts +22 -0
- package/dist/node-esm/src/platform/node/base64.d.ts +19 -0
- package/dist/node-esm/src/platform/node/connection.d.ts +58 -0
- package/dist/node-esm/src/public-types.d.ts +424 -0
- package/dist/node-esm/src/reference.d.ts +208 -0
- package/dist/node-esm/src/service.d.ts +131 -0
- package/dist/node-esm/src/task.d.ts +148 -0
- package/dist/node-esm/test/unit/connection.d.ts +47 -0
- package/dist/node-esm/test/unit/testshared.d.ts +60 -0
- package/dist/src/api.browser.d.ts +47 -0
- package/dist/src/api.d.ts +200 -0
- package/dist/src/api.node.d.ts +47 -0
- package/dist/src/constants.d.ts +20 -0
- package/dist/src/implementation/async.d.ts +22 -0
- package/dist/src/implementation/backoff.d.ts +43 -0
- package/dist/src/implementation/blob.d.ts +34 -0
- package/dist/src/implementation/connection.d.ts +56 -0
- package/dist/src/implementation/constants.d.ts +48 -0
- package/dist/src/implementation/error.d.ts +126 -0
- package/dist/src/implementation/failrequest.d.ts +29 -0
- package/dist/src/implementation/fs.d.ts +17 -0
- package/dist/src/implementation/json.d.ts +7 -0
- package/dist/src/implementation/list.d.ts +19 -0
- package/dist/src/implementation/location.d.ts +32 -0
- package/dist/src/implementation/metadata.d.ts +40 -0
- package/dist/src/implementation/observer.d.ts +47 -0
- package/dist/src/implementation/path.d.ts +31 -0
- package/dist/src/implementation/request.d.ts +47 -0
- package/dist/src/implementation/requestinfo.d.ts +73 -0
- package/dist/src/implementation/requests.d.ts +84 -0
- package/dist/src/implementation/string.d.ts +73 -0
- package/dist/src/implementation/taskenums.d.ts +77 -0
- package/dist/src/implementation/type.d.ts +23 -0
- package/dist/src/implementation/url.d.ts +22 -0
- package/dist/src/implementation/utils.d.ts +23 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.node.d.ts +7 -0
- package/dist/src/list.d.ts +41 -0
- package/dist/src/metadata.d.ts +27 -0
- package/dist/src/platform/base64.d.ts +20 -0
- package/dist/src/platform/browser/base64.d.ts +19 -0
- package/dist/src/platform/browser/connection.d.ts +55 -0
- package/dist/src/platform/connection.d.ts +22 -0
- package/dist/src/platform/node/base64.d.ts +19 -0
- package/dist/src/platform/node/connection.d.ts +58 -0
- package/dist/src/public-types.d.ts +424 -0
- package/dist/src/reference.d.ts +208 -0
- package/dist/src/service.d.ts +131 -0
- package/dist/src/task.d.ts +148 -0
- package/dist/src/tsdoc-metadata.json +11 -0
- package/dist/storage-public.d.ts +725 -0
- package/dist/storage.d.ts +1391 -0
- package/dist/test/unit/connection.d.ts +47 -0
- package/dist/test/unit/testshared.d.ts +60 -0
- package/package.json +98 -0
|
@@ -0,0 +1,131 @@
|
|
|
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 { Location } from './implementation/location';
|
|
18
|
+
import { Request } from './implementation/request';
|
|
19
|
+
import { RequestInfo } from './implementation/requestinfo';
|
|
20
|
+
import { Reference } from './reference';
|
|
21
|
+
import { Provider } from '@firebase/component';
|
|
22
|
+
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
|
|
23
|
+
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
|
|
24
|
+
import { FirebaseApp } from '@firebase/app';
|
|
25
|
+
import { FirebaseStorage } from './public-types';
|
|
26
|
+
import { EmulatorMockTokenOptions } from '@firebase/util';
|
|
27
|
+
import { Connection, ConnectionType } from './implementation/connection';
|
|
28
|
+
export declare function isUrl(path?: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Returns a storage Reference for the given url.
|
|
31
|
+
* @param storage - `Storage` instance.
|
|
32
|
+
* @param url - URL. If empty, returns root reference.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export declare function ref(storage: FirebaseStorageImpl, url?: string): Reference;
|
|
36
|
+
/**
|
|
37
|
+
* Returns a storage Reference for the given path in the
|
|
38
|
+
* default bucket.
|
|
39
|
+
* @param storageOrRef - `Storage` service or storage `Reference`.
|
|
40
|
+
* @param pathOrUrlStorage - path. If empty, returns root reference (if Storage
|
|
41
|
+
* instance provided) or returns same reference (if Reference provided).
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare function ref(storageOrRef: FirebaseStorageImpl | Reference, path?: string): Reference;
|
|
45
|
+
export declare function connectStorageEmulator(storage: FirebaseStorageImpl, host: string, port: number, options?: {
|
|
46
|
+
mockUserToken?: EmulatorMockTokenOptions | string;
|
|
47
|
+
}): void;
|
|
48
|
+
/**
|
|
49
|
+
* A service that provides Firebase Storage Reference instances.
|
|
50
|
+
* @param opt_url - gs:// url to a custom Storage Bucket
|
|
51
|
+
*
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export declare class FirebaseStorageImpl implements FirebaseStorage {
|
|
55
|
+
/**
|
|
56
|
+
* FirebaseApp associated with this StorageService instance.
|
|
57
|
+
*/
|
|
58
|
+
readonly app: FirebaseApp;
|
|
59
|
+
readonly _authProvider: Provider<FirebaseAuthInternalName>;
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
readonly _appCheckProvider: Provider<AppCheckInternalComponentName>;
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
readonly _url?: string | undefined;
|
|
68
|
+
readonly _firebaseVersion?: string | undefined;
|
|
69
|
+
_isUsingEmulator: boolean;
|
|
70
|
+
_bucket: Location | null;
|
|
71
|
+
/**
|
|
72
|
+
* This string can be in the formats:
|
|
73
|
+
* - host
|
|
74
|
+
* - host:port
|
|
75
|
+
*/
|
|
76
|
+
private _host;
|
|
77
|
+
_protocol: string;
|
|
78
|
+
protected readonly _appId: string | null;
|
|
79
|
+
private readonly _requests;
|
|
80
|
+
private _deleted;
|
|
81
|
+
private _maxOperationRetryTime;
|
|
82
|
+
private _maxUploadRetryTime;
|
|
83
|
+
_overrideAuthToken?: string;
|
|
84
|
+
constructor(
|
|
85
|
+
/**
|
|
86
|
+
* FirebaseApp associated with this StorageService instance.
|
|
87
|
+
*/
|
|
88
|
+
app: FirebaseApp, _authProvider: Provider<FirebaseAuthInternalName>,
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
_appCheckProvider: Provider<AppCheckInternalComponentName>,
|
|
93
|
+
/**
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
_url?: string | undefined, _firebaseVersion?: string | undefined, _isUsingEmulator?: boolean);
|
|
97
|
+
/**
|
|
98
|
+
* The host string for this service, in the form of `host` or
|
|
99
|
+
* `host:port`.
|
|
100
|
+
*/
|
|
101
|
+
get host(): string;
|
|
102
|
+
set host(host: string);
|
|
103
|
+
/**
|
|
104
|
+
* The maximum time to retry uploads in milliseconds.
|
|
105
|
+
*/
|
|
106
|
+
get maxUploadRetryTime(): number;
|
|
107
|
+
set maxUploadRetryTime(time: number);
|
|
108
|
+
/**
|
|
109
|
+
* The maximum time to retry operations other than uploads or downloads in
|
|
110
|
+
* milliseconds.
|
|
111
|
+
*/
|
|
112
|
+
get maxOperationRetryTime(): number;
|
|
113
|
+
set maxOperationRetryTime(time: number);
|
|
114
|
+
_getAuthToken(): Promise<string | null>;
|
|
115
|
+
_getAppCheckToken(): Promise<string | null>;
|
|
116
|
+
/**
|
|
117
|
+
* Stop running requests and prevent more from being created.
|
|
118
|
+
*/
|
|
119
|
+
_delete(): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Returns a new firebaseStorage.Reference object referencing this StorageService
|
|
122
|
+
* at the given Location.
|
|
123
|
+
*/
|
|
124
|
+
_makeStorageReference(loc: Location): Reference;
|
|
125
|
+
/**
|
|
126
|
+
* @param requestInfo - HTTP RequestInfo object
|
|
127
|
+
* @param authToken - Firebase auth token
|
|
128
|
+
*/
|
|
129
|
+
_makeRequest<I extends ConnectionType, O>(requestInfo: RequestInfo<I, O>, requestFactory: () => Connection<I>, authToken: string | null, appCheckToken: string | null, retry?: boolean): Request<O>;
|
|
130
|
+
makeRequestWithTokens<I extends ConnectionType, O>(requestInfo: RequestInfo<I, O>, requestFactory: () => Connection<I>): Promise<O>;
|
|
131
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
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 types for interacting with blob transfer tasks.
|
|
19
|
+
*/
|
|
20
|
+
import { FbsBlob } from './implementation/blob';
|
|
21
|
+
import { StorageError } from './implementation/error';
|
|
22
|
+
import { InternalTaskState, TaskEvent } from './implementation/taskenums';
|
|
23
|
+
import { Metadata } from './metadata';
|
|
24
|
+
import { Subscribe, Unsubscribe } from './implementation/observer';
|
|
25
|
+
import { UploadTaskSnapshot, StorageObserver } from './public-types';
|
|
26
|
+
import { Reference } from './reference';
|
|
27
|
+
import { CompleteFn } from '@firebase/util';
|
|
28
|
+
/**
|
|
29
|
+
* Represents a blob being uploaded. Can be used to pause/resume/cancel the
|
|
30
|
+
* upload and manage callbacks for various events.
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare class UploadTask {
|
|
34
|
+
private _ref;
|
|
35
|
+
/**
|
|
36
|
+
* The data to be uploaded.
|
|
37
|
+
*/
|
|
38
|
+
_blob: FbsBlob;
|
|
39
|
+
/**
|
|
40
|
+
* Metadata related to the upload.
|
|
41
|
+
*/
|
|
42
|
+
_metadata: Metadata | null;
|
|
43
|
+
private _mappings;
|
|
44
|
+
/**
|
|
45
|
+
* Number of bytes transferred so far.
|
|
46
|
+
*/
|
|
47
|
+
_transferred: number;
|
|
48
|
+
private _needToFetchStatus;
|
|
49
|
+
private _needToFetchMetadata;
|
|
50
|
+
private _observers;
|
|
51
|
+
private _resumable;
|
|
52
|
+
/**
|
|
53
|
+
* Upload state.
|
|
54
|
+
*/
|
|
55
|
+
_state: InternalTaskState;
|
|
56
|
+
private _error?;
|
|
57
|
+
private _uploadUrl?;
|
|
58
|
+
private _request?;
|
|
59
|
+
private _chunkMultiplier;
|
|
60
|
+
private _errorHandler;
|
|
61
|
+
private _metadataErrorHandler;
|
|
62
|
+
private _resolve?;
|
|
63
|
+
private _reject?;
|
|
64
|
+
private pendingTimeout?;
|
|
65
|
+
private _promise;
|
|
66
|
+
private sleepTime;
|
|
67
|
+
private maxSleepTime;
|
|
68
|
+
isExponentialBackoffExpired(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* @param ref - The firebaseStorage.Reference object this task came
|
|
71
|
+
* from, untyped to avoid cyclic dependencies.
|
|
72
|
+
* @param blob - The blob to upload.
|
|
73
|
+
*/
|
|
74
|
+
constructor(ref: Reference, blob: FbsBlob, metadata?: Metadata | null);
|
|
75
|
+
private _makeProgressCallback;
|
|
76
|
+
private _shouldDoResumable;
|
|
77
|
+
private _start;
|
|
78
|
+
private _resolveToken;
|
|
79
|
+
private _createResumable;
|
|
80
|
+
private _fetchStatus;
|
|
81
|
+
private _continueUpload;
|
|
82
|
+
private _increaseMultiplier;
|
|
83
|
+
private _fetchMetadata;
|
|
84
|
+
private _oneShotUpload;
|
|
85
|
+
private _updateProgress;
|
|
86
|
+
private _transition;
|
|
87
|
+
private completeTransitions_;
|
|
88
|
+
/**
|
|
89
|
+
* A snapshot of the current task state.
|
|
90
|
+
*/
|
|
91
|
+
get snapshot(): UploadTaskSnapshot;
|
|
92
|
+
/**
|
|
93
|
+
* Adds a callback for an event.
|
|
94
|
+
* @param type - The type of event to listen for.
|
|
95
|
+
* @param nextOrObserver -
|
|
96
|
+
* The `next` function, which gets called for each item in
|
|
97
|
+
* the event stream, or an observer object with some or all of these three
|
|
98
|
+
* properties (`next`, `error`, `complete`).
|
|
99
|
+
* @param error - A function that gets called with a `StorageError`
|
|
100
|
+
* if the event stream ends due to an error.
|
|
101
|
+
* @param completed - A function that gets called if the
|
|
102
|
+
* event stream ends normally.
|
|
103
|
+
* @returns
|
|
104
|
+
* If only the event argument is passed, returns a function you can use to
|
|
105
|
+
* add callbacks (see the examples above). If more than just the event
|
|
106
|
+
* argument is passed, returns a function you can call to unregister the
|
|
107
|
+
* callbacks.
|
|
108
|
+
*/
|
|
109
|
+
on(type: TaskEvent, nextOrObserver?: StorageObserver<UploadTaskSnapshot> | null | ((snapshot: UploadTaskSnapshot) => unknown), error?: ((a: StorageError) => unknown) | null, completed?: CompleteFn | null): Unsubscribe | Subscribe<UploadTaskSnapshot>;
|
|
110
|
+
/**
|
|
111
|
+
* This object behaves like a Promise, and resolves with its snapshot data
|
|
112
|
+
* when the upload completes.
|
|
113
|
+
* @param onFulfilled - The fulfillment callback. Promise chaining works as normal.
|
|
114
|
+
* @param onRejected - The rejection callback.
|
|
115
|
+
*/
|
|
116
|
+
then<U>(onFulfilled?: ((value: UploadTaskSnapshot) => U | Promise<U>) | null, onRejected?: ((error: StorageError) => U | Promise<U>) | null): Promise<U>;
|
|
117
|
+
/**
|
|
118
|
+
* Equivalent to calling `then(null, onRejected)`.
|
|
119
|
+
*/
|
|
120
|
+
catch<T>(onRejected: (p1: StorageError) => T | Promise<T>): Promise<T>;
|
|
121
|
+
/**
|
|
122
|
+
* Adds the given observer.
|
|
123
|
+
*/
|
|
124
|
+
private _addObserver;
|
|
125
|
+
/**
|
|
126
|
+
* Removes the given observer.
|
|
127
|
+
*/
|
|
128
|
+
private _removeObserver;
|
|
129
|
+
private _notifyObservers;
|
|
130
|
+
private _finishPromise;
|
|
131
|
+
private _notifyObserver;
|
|
132
|
+
/**
|
|
133
|
+
* Resumes a paused task. Has no effect on a currently running or failed task.
|
|
134
|
+
* @returns True if the operation took effect, false if ignored.
|
|
135
|
+
*/
|
|
136
|
+
resume(): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Pauses a currently running task. Has no effect on a paused or failed task.
|
|
139
|
+
* @returns True if the operation took effect, false if ignored.
|
|
140
|
+
*/
|
|
141
|
+
pause(): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Cancels a currently running or paused task. Has no effect on a complete or
|
|
144
|
+
* failed task.
|
|
145
|
+
* @returns True if the operation took effect, false if ignored.
|
|
146
|
+
*/
|
|
147
|
+
cancel(): boolean;
|
|
148
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "0.1.2"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|