@@ -53,6 +53,7 @@ import {
53
53
_getChild as _getChildInternal
54
54
} from '../src/reference' ;
55
55
import { STORAGE_TYPE } from './constants' ;
56
+ import { getModularInstance } from '@firebase/util' ;
56
57
57
58
/**
58
59
* Public types.
@@ -78,6 +79,7 @@ export function uploadBytes(
78
79
data : Blob | Uint8Array | ArrayBuffer ,
79
80
metadata ?: UploadMetadata
80
81
) : Promise < UploadResult > {
82
+ ref = getModularInstance ( ref ) ;
81
83
return uploadBytesInternal (
82
84
ref as Reference ,
83
85
data ,
@@ -101,6 +103,7 @@ export function uploadString(
101
103
format ?: string ,
102
104
metadata ?: UploadMetadata
103
105
) : Promise < UploadResult > {
106
+ ref = getModularInstance ( ref ) ;
104
107
return uploadStringInternal (
105
108
ref as Reference ,
106
109
value ,
@@ -123,6 +126,7 @@ export function uploadBytesResumable(
123
126
data : Blob | Uint8Array | ArrayBuffer ,
124
127
metadata ?: UploadMetadata
125
128
) : UploadTask {
129
+ ref = getModularInstance ( ref ) ;
126
130
return uploadBytesResumableInternal (
127
131
ref as Reference ,
128
132
data ,
@@ -138,6 +142,7 @@ export function uploadBytesResumable(
138
142
* @param ref - StorageReference to get metadata from.
139
143
*/
140
144
export function getMetadata ( ref : StorageReference ) : Promise < FullMetadata > {
145
+ ref = getModularInstance ( ref ) ;
141
146
return getMetadataInternal ( ref as Reference ) as Promise < FullMetadata > ;
142
147
}
143
148
@@ -154,6 +159,7 @@ export function updateMetadata(
154
159
ref : StorageReference ,
155
160
metadata : SettableMetadata
156
161
) : Promise < FullMetadata > {
162
+ ref = getModularInstance ( ref ) ;
157
163
return updateMetadataInternal (
158
164
ref as Reference ,
159
165
metadata as Partial < MetadataInternal >
@@ -186,6 +192,7 @@ export function list(
186
192
ref : StorageReference ,
187
193
options ?: ListOptions
188
194
) : Promise < ListResult > {
195
+ ref = getModularInstance ( ref ) ;
189
196
return listInternal ( ref as Reference , options ) ;
190
197
}
191
198
@@ -209,6 +216,7 @@ export function list(
209
216
* folder. `nextPageToken` is never returned.
210
217
*/
211
218
export function listAll ( ref : StorageReference ) : Promise < ListResult > {
219
+ ref = getModularInstance ( ref ) ;
212
220
return listAllInternal ( ref as Reference ) ;
213
221
}
214
222
@@ -219,6 +227,7 @@ export function listAll(ref: StorageReference): Promise<ListResult> {
219
227
* URL for this object.
220
228
*/
221
229
export function getDownloadURL ( ref : StorageReference ) : Promise < string > {
230
+ ref = getModularInstance ( ref ) ;
222
231
return getDownloadURLInternal ( ref as Reference ) ;
223
232
}
224
233
@@ -229,6 +238,7 @@ export function getDownloadURL(ref: StorageReference): Promise<string> {
229
238
* @returns A promise that resolves if the deletion succeeds.
230
239
*/
231
240
export function deleteObject ( ref : StorageReference ) : Promise < void > {
241
+ ref = getModularInstance ( ref ) ;
232
242
return deleteObjectInternal ( ref as Reference ) ;
233
243
}
234
244
@@ -255,6 +265,7 @@ export function ref(
255
265
serviceOrRef : StorageService | StorageReference ,
256
266
pathOrUrl ?: string
257
267
) : StorageReference | null {
268
+ serviceOrRef = getModularInstance ( serviceOrRef ) ;
258
269
return refInternal (
259
270
serviceOrRef as StorageServiceInternal | Reference ,
260
271
pathOrUrl
@@ -282,7 +293,7 @@ export function getStorage(
282
293
app : FirebaseApp ,
283
294
bucketUrl ?: string
284
295
) : StorageService {
285
- // Dependencies
296
+ app = getModularInstance ( app ) ;
286
297
const storageProvider : Provider < 'storage-exp' > = _getProvider (
287
298
app ,
288
299
STORAGE_TYPE
0 commit comments