@react-native-firebase/storage 25.1.0 → 26.1.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/RNFBStorage.podspec +26 -7
  3. package/android/build.gradle +23 -0
  4. package/android/src/main/java/io/invertase/firebase/storage/{ReactNativeFirebaseStorageModule.java → NativeRNFBTurboStorage.java} +72 -131
  5. package/android/src/main/java/io/invertase/firebase/storage/ReactNativeFirebaseStoragePackage.java +1 -1
  6. package/android/src/main/java/io/invertase/firebase/storage/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboStorageSpec.java +125 -0
  7. package/android/src/main/java/io/invertase/firebase/storage/generated/jni/CMakeLists.txt +36 -0
  8. package/android/src/main/java/io/invertase/firebase/storage/generated/jni/RNFBStorageTurboModules-generated.cpp +116 -0
  9. package/android/src/main/java/io/invertase/firebase/storage/generated/jni/RNFBStorageTurboModules.h +31 -0
  10. package/android/src/main/java/io/invertase/firebase/storage/generated/jni/react/renderer/components/RNFBStorageTurboModules/RNFBStorageTurboModulesJSI-generated.cpp +153 -0
  11. package/android/src/main/java/io/invertase/firebase/storage/generated/jni/react/renderer/components/RNFBStorageTurboModules/RNFBStorageTurboModulesJSI.h +246 -0
  12. package/dist/module/StorageReference.js +4 -7
  13. package/dist/module/StorageReference.js.map +1 -1
  14. package/dist/module/StorageTask.js.map +1 -1
  15. package/dist/module/index.js +384 -6
  16. package/dist/module/index.js.map +1 -1
  17. package/dist/module/types/storage.js +6 -2
  18. package/dist/module/types/storage.js.map +1 -1
  19. package/dist/module/version.js +1 -1
  20. package/dist/module/web/RNFBStorageModule.js +9 -11
  21. package/dist/module/web/RNFBStorageModule.js.map +1 -1
  22. package/dist/typescript/lib/StorageReference.d.ts.map +1 -1
  23. package/dist/typescript/lib/StorageTask.d.ts +7 -8
  24. package/dist/typescript/lib/StorageTask.d.ts.map +1 -1
  25. package/dist/typescript/lib/index.d.ts +150 -4
  26. package/dist/typescript/lib/index.d.ts.map +1 -1
  27. package/dist/typescript/lib/types/internal.d.ts +5 -5
  28. package/dist/typescript/lib/types/internal.d.ts.map +1 -1
  29. package/dist/typescript/lib/types/storage.d.ts +15 -10
  30. package/dist/typescript/lib/types/storage.d.ts.map +1 -1
  31. package/dist/typescript/lib/version.d.ts +1 -1
  32. package/dist/typescript/lib/web/RNFBStorageModule.d.ts +3 -3
  33. package/dist/typescript/lib/web/RNFBStorageModule.d.ts.map +1 -1
  34. package/ios/RNFBStorage/RNFBStorageCommon.m +11 -0
  35. package/ios/RNFBStorage/RNFBStorageHelper.h +113 -0
  36. package/ios/RNFBStorage/{RNFBStorageModule.m → RNFBStorageHelper.m} +227 -222
  37. package/ios/RNFBStorage/RNFBStorageModule.h +2 -2
  38. package/ios/RNFBStorage/RNFBStorageModule.mm +252 -0
  39. package/ios/RNFBStorage.xcodeproj/project.pbxproj +8 -8
  40. package/ios/generated/RCTAppDependencyProvider.h +25 -0
  41. package/ios/generated/RCTAppDependencyProvider.mm +55 -0
  42. package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  43. package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  44. package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
  45. package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
  46. package/ios/generated/RNFBStorageTurboModules/RNFBStorageTurboModules-generated.mm +142 -0
  47. package/ios/generated/RNFBStorageTurboModules/RNFBStorageTurboModules.h +198 -0
  48. package/ios/generated/RNFBStorageTurboModulesJSI-generated.cpp +153 -0
  49. package/ios/generated/RNFBStorageTurboModulesJSI.h +246 -0
  50. package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
  51. package/lib/StorageReference.ts +3 -8
  52. package/lib/StorageTask.ts +13 -15
  53. package/lib/index.ts +501 -7
  54. package/lib/types/internal.ts +5 -5
  55. package/lib/types/storage.ts +17 -10
  56. package/lib/version.ts +1 -1
  57. package/lib/web/RNFBStorageModule.ts +10 -12
  58. package/package.json +22 -4
  59. package/react-native.config.js +10 -0
  60. package/specs/NativeRNFBTurboStorage.ts +46 -0
  61. package/typedoc.json +2 -3
  62. package/dist/module/modular.js +0 -270
  63. package/dist/module/modular.js.map +0 -1
  64. package/dist/module/namespaced.js +0 -192
  65. package/dist/module/namespaced.js.map +0 -1
  66. package/dist/module/types/namespaced.js +0 -64
  67. package/dist/module/types/namespaced.js.map +0 -1
  68. package/dist/typescript/lib/modular.d.ts +0 -154
  69. package/dist/typescript/lib/modular.d.ts.map +0 -1
  70. package/dist/typescript/lib/namespaced.d.ts +0 -12
  71. package/dist/typescript/lib/namespaced.d.ts.map +0 -1
  72. package/dist/typescript/lib/types/namespaced.d.ts +0 -1122
  73. package/dist/typescript/lib/types/namespaced.d.ts.map +0 -1
  74. package/lib/modular.ts +0 -401
  75. package/lib/namespaced.ts +0 -264
  76. package/lib/types/namespaced.ts +0 -1248
@@ -15,6 +15,7 @@
15
15
  *
16
16
  */
17
17
  import type { FirebaseApp, ReactNativeFirebase } from '@react-native-firebase/app';
18
+ import type { FirebaseError } from '@firebase/app';
18
19
  import type {
19
20
  CompleteFn,
20
21
  NextFn,
@@ -22,6 +23,14 @@ import type {
22
23
  } from '@react-native-firebase/app/dist/module/types/common';
23
24
  export type { CompleteFn, NextFn, Unsubscribe };
24
25
  export type NativeFirebaseError = ReactNativeFirebase.NativeFirebaseError;
26
+
27
+ /**
28
+ * Storage failure error type for public observer callbacks.
29
+ * Runtime values are {@link NativeFirebaseError} instances structurally compatible with `FirebaseError`.
30
+ * @public
31
+ */
32
+ export type StorageError = FirebaseError;
33
+
25
34
  /**
26
35
  * Storage module instance
27
36
  */
@@ -260,15 +269,13 @@ export const TaskState = {
260
269
  */
261
270
  export interface StorageObserver<T> {
262
271
  next?: NextFn<T> | null;
263
- error?: ((error: NativeFirebaseError) => void) | null;
272
+ error?: ((error: StorageError) => unknown) | null;
264
273
  complete?: CompleteFn | null;
265
274
  }
266
275
 
267
276
  /**
268
277
  * Represents the process of uploading an object. Allows you to monitor and manage the upload.
269
278
  *
270
- * Note: React Native Firebase returns Promises for pause/resume/cancel to communicate with native iOS/Android.
271
- *
272
279
  * @public
273
280
  */
274
281
  export interface UploadTask {
@@ -276,12 +283,12 @@ export interface UploadTask {
276
283
  * Cancels a running task. Has no effect on a complete or failed task.
277
284
  * @returns True if the cancel had an effect.
278
285
  */
279
- cancel(): Promise<boolean>;
286
+ cancel(): boolean;
280
287
 
281
288
  /**
282
289
  * Equivalent to calling `then(null, onRejected)`.
283
290
  */
284
- catch(onRejected: (error: NativeFirebaseError) => unknown): Promise<unknown>;
291
+ catch(onRejected: (error: StorageError) => unknown): Promise<unknown>;
285
292
 
286
293
  /**
287
294
  * Listens for events on this task.
@@ -295,7 +302,7 @@ export interface UploadTask {
295
302
  | StorageObserver<UploadTaskSnapshot>
296
303
  | null
297
304
  | ((snapshot: UploadTaskSnapshot) => unknown),
298
- error?: ((error: NativeFirebaseError) => unknown) | null,
305
+ error?: ((error: StorageError) => unknown) | null,
299
306
  complete?: CompleteFn | null,
300
307
  ): Unsubscribe | Subscribe<UploadTaskSnapshot>;
301
308
 
@@ -303,13 +310,13 @@ export interface UploadTask {
303
310
  * Pauses a currently running task. Has no effect on a paused or failed task.
304
311
  * @returns True if the operation took effect, false if ignored.
305
312
  */
306
- pause(): Promise<boolean>;
313
+ pause(): boolean;
307
314
 
308
315
  /**
309
316
  * Resumes a paused task. Has no effect on a currently running or failed task.
310
317
  * @returns True if the operation took effect, false if ignored.
311
318
  */
312
- resume(): Promise<boolean>;
319
+ resume(): boolean;
313
320
 
314
321
  /**
315
322
  * A snapshot of the current task state.
@@ -321,7 +328,7 @@ export interface UploadTask {
321
328
  */
322
329
  then(
323
330
  onFulfilled?: ((snapshot: UploadTaskSnapshot) => unknown) | null,
324
- onRejected?: ((error: NativeFirebaseError) => unknown) | null,
331
+ onRejected?: ((error: StorageError) => unknown) | null,
325
332
  ): Promise<unknown>;
326
333
  }
327
334
 
@@ -380,7 +387,7 @@ export interface UploadResult {
380
387
 
381
388
  export type Subscribe<T> = (
382
389
  nextOrObserver?: StorageObserver<T> | null | NextFn<T>,
383
- error?: ((error: NativeFirebaseError) => unknown) | null,
390
+ error?: ((error: StorageError) => unknown) | null,
384
391
  complete?: CompleteFn | null,
385
392
  ) => Unsubscribe;
386
393
 
package/lib/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '25.1.0';
2
+ export const version = '26.1.0';
@@ -247,7 +247,7 @@ export default {
247
247
  * @param url - The path to the object.
248
248
  * @return {Promise<void>}
249
249
  */
250
- delete(appName: string, url: string): Promise<void> {
250
+ deleteObject(appName: string, url: string): Promise<void> {
251
251
  return guard(async () => {
252
252
  const ref = getReferenceFromUrl(appName, url);
253
253
  await deleteObject(ref);
@@ -516,14 +516,10 @@ export default {
516
516
  * @param appName - The app name.
517
517
  * @param taskId - The task ID.
518
518
  * @param status - The status.
519
- * @return {Promise<boolean>} Whether the status was set.
519
+ * @return Whether the status was set.
520
520
  */
521
- setTaskStatus(appName: string, taskId: string, status: number): Promise<boolean> {
522
- // TODO this function implementation cannot
523
- // be tested right now since we're unable
524
- // to create a big enough upload to be able to
525
- // pause/resume/cancel it in time.
526
- return guard(async () => {
521
+ setTaskStatus(appName: string, taskId: string, status: number): boolean {
522
+ try {
527
523
  const task = tasks[taskId];
528
524
 
529
525
  // If the task doesn't exist, return false.
@@ -535,13 +531,13 @@ export default {
535
531
 
536
532
  switch (status) {
537
533
  case 0:
538
- result = await task.pause();
534
+ result = task.pause();
539
535
  break;
540
536
  case 1:
541
- result = await task.resume();
537
+ result = task.resume();
542
538
  break;
543
539
  case 2:
544
- result = await task.cancel();
540
+ result = task.cancel();
545
541
  break;
546
542
  }
547
543
 
@@ -552,6 +548,8 @@ export default {
552
548
  });
553
549
 
554
550
  return result;
555
- });
551
+ } catch (e) {
552
+ throw getWebError(e as Error & { code?: string });
553
+ }
556
554
  },
557
555
  };
package/package.json CHANGED
@@ -1,15 +1,32 @@
1
1
  {
2
2
  "name": "@react-native-firebase/storage",
3
- "version": "25.1.0",
3
+ "version": "26.1.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - React Native Firebase provides native integration with Cloud Storage, providing support to upload and download files directly from your device and from your Firebase Cloud Storage bucket.",
6
6
  "main": "./dist/module/index.js",
7
7
  "types": "./dist/typescript/lib/index.d.ts",
8
+ "codegenConfig": {
9
+ "name": "RNFBStorageTurboModules",
10
+ "type": "modules",
11
+ "jsSrcsDir": "specs",
12
+ "includesGeneratedCode": true,
13
+ "android": {
14
+ "javaPackageName": "io.invertase.firebase.storage"
15
+ },
16
+ "ios": {
17
+ "modulesProvider": {
18
+ "NativeRNFBTurboStorage": "RNFBStorageModule"
19
+ }
20
+ }
21
+ },
8
22
  "scripts": {
9
23
  "build": "genversion --esm --semi lib/version.ts",
10
24
  "build:clean": "rimraf android/build && rimraf ios/build",
11
25
  "compile": "bob build",
12
- "prepare": "yarn run build && yarn compile"
26
+ "prepare": "yarn run build && yarn compile",
27
+ "codegen": "yarn android:codegen && yarn ios:codegen",
28
+ "android:codegen": "npx @react-native-community/cli codegen --platform android --outputPath=./android/src/main/java/io/invertase/firebase/storage/generated",
29
+ "ios:codegen": "npx @react-native-community/cli codegen --platform ios --outputPath=./ios/generated"
13
30
  },
14
31
  "repository": {
15
32
  "type": "git",
@@ -30,13 +47,14 @@
30
47
  "download"
31
48
  ],
32
49
  "peerDependencies": {
33
- "@react-native-firebase/app": "25.1.0"
50
+ "@react-native-firebase/app": "26.1.0"
34
51
  },
35
52
  "publishConfig": {
36
53
  "access": "public",
37
54
  "provenance": true
38
55
  },
39
56
  "devDependencies": {
57
+ "@react-native-firebase/app": "26.1.0",
40
58
  "react-native-builder-bob": "^0.41.0"
41
59
  },
42
60
  "exports": {
@@ -69,5 +87,5 @@
69
87
  "node_modules/",
70
88
  "dist/"
71
89
  ],
72
- "gitHead": "e0a565d8a73a9b103d140ffacfb8876b30d8bdc5"
90
+ "gitHead": "59d053eca14ab8aa80e5ac76887014925c67e52b"
73
91
  }
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ cmakeListsPath:
6
+ './src/main/java/io/invertase/firebase/storage/generated/jni/CMakeLists.txt',
7
+ },
8
+ },
9
+ },
10
+ };
@@ -0,0 +1,46 @@
1
+ /* eslint-disable @typescript-eslint/no-wrapper-object-types */
2
+ import type { TurboModule } from 'react-native';
3
+ import { TurboModuleRegistry } from 'react-native';
4
+
5
+ export interface StorageListOptions {
6
+ maxResults: number;
7
+ pageToken?: string | null;
8
+ }
9
+
10
+ export interface Spec extends TurboModule {
11
+ getConstants(): {
12
+ maxDownloadRetryTime: number;
13
+ maxOperationRetryTime: number;
14
+ maxUploadRetryTime: number;
15
+ };
16
+
17
+ deleteObject(appName: string, url: string): Promise<void>;
18
+ getDownloadURL(appName: string, url: string): Promise<string>;
19
+ getMetadata(appName: string, url: string): Promise<Object>;
20
+ updateMetadata(appName: string, url: string, metadata: Object | null): Promise<Object>;
21
+ list(appName: string, url: string, listOptions: StorageListOptions): Promise<Object>;
22
+ listAll(appName: string, url: string): Promise<Object>;
23
+ setMaxDownloadRetryTime(appName: string, milliseconds: number): Promise<void>;
24
+ setMaxOperationRetryTime(appName: string, milliseconds: number): Promise<void>;
25
+ setMaxUploadRetryTime(appName: string, milliseconds: number): Promise<void>;
26
+ useEmulator(appName: string, host: string, port: number, bucketUrl: string): void;
27
+ writeToFile(appName: string, url: string, localFilePath: string, taskId: number): Promise<Object>;
28
+ putFile(
29
+ appName: string,
30
+ url: string,
31
+ localFilePath: string,
32
+ metadata: Object | null,
33
+ taskId: number,
34
+ ): Promise<Object>;
35
+ putString(
36
+ appName: string,
37
+ url: string,
38
+ string: string,
39
+ format: string,
40
+ metadata: Object | null,
41
+ taskId: number,
42
+ ): Promise<Object>;
43
+ setTaskStatus(appName: string, taskId: number, status: number): boolean;
44
+ }
45
+
46
+ export default TurboModuleRegistry.getEnforcing<Spec>('NativeRNFBTurboStorage');
package/typedoc.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "$schema": "https://typedoc.org/schema.json",
3
- "entryPoints": ["lib/index.ts"],
4
- "intentionallyNotExported": ["StorageNamespace"]
5
-
3
+ "entryPoints": ["lib/index.ts", "lib/types/storage.ts"],
4
+ "tsconfig": "tsconfig.json"
6
5
  }
@@ -1,270 +0,0 @@
1
- "use strict";
2
-
3
- /*
4
- * Copyright (c) 2016-present Invertase Limited & Contributors
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this library except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- */
19
-
20
- import { getApp } from '@react-native-firebase/app';
21
- import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
22
- function isUrl(path) {
23
- if (typeof path !== 'string') {
24
- return false;
25
- }
26
- return /^[A-Za-z]+:\/\//.test(decodeURIComponent(path));
27
- }
28
-
29
- /**
30
- * Returns a Storage instance for the given app.
31
- * @param app - FirebaseApp. Optional.
32
- * @param bucketUrl - Storage bucket URL. Optional.
33
- * @returns {Storage}
34
- */
35
- export function getStorage(app, bucketUrl) {
36
- if (app) {
37
- if (bucketUrl != null) {
38
- return getApp(app.name).storage(bucketUrl);
39
- }
40
- return getApp(app.name).storage();
41
- }
42
- if (bucketUrl != null) {
43
- return getApp().storage(bucketUrl);
44
- }
45
- return getApp().storage();
46
- }
47
-
48
- /**
49
- * Modify this Storage instance to communicate with the Firebase Storage emulator.
50
- * @param storage - Storage instance.
51
- * @param host - emulator host (e.g. - 'localhost')
52
- * @param port - emulator port (e.g. - 9199)
53
- * @param options - `EmulatorMockTokenOptions` instance. Optional. Web only.
54
- * @returns {void}
55
- */
56
- export function connectStorageEmulator(storage, host, port, options) {
57
- return storage.useEmulator.call(storage, host, port, options, MODULAR_DEPRECATION_ARG);
58
- }
59
-
60
- /**
61
- * Returns a StorageReference for the given URL or path in the default bucket.
62
- * @param storage - FirebaseStorage instance.
63
- * @param url - Optional gs:// or https:// URL, or path. If empty, returns root reference.
64
- * @returns {StorageReference}
65
- */
66
-
67
- /**
68
- * Returns a StorageReference for the given path, or the same reference if path is omitted.
69
- * @param storageRef - StorageReference instance.
70
- * @param path - Optional child path. If omitted, returns the same reference.
71
- * @returns {StorageReference}
72
- */
73
-
74
- export function ref(storageOrRef, path) {
75
- // ref(parentRef, path) → child reference; ref(parentRef) → same reference (firebase-js-sdk overload)
76
- if (typeof storageOrRef.fullPath === 'string') {
77
- if (path === undefined) {
78
- return storageOrRef;
79
- }
80
- return storageOrRef.child.call(storageOrRef, path, MODULAR_DEPRECATION_ARG);
81
- }
82
- const storage = storageOrRef;
83
- if (path != null && isUrl(path)) {
84
- return storage.refFromURL.call(storage, path, MODULAR_DEPRECATION_ARG);
85
- }
86
- return storage.ref.call(storage, path, MODULAR_DEPRECATION_ARG);
87
- }
88
-
89
- /**
90
- * Deletes the object at this reference's location.
91
- * @param storageRef - Storage `Reference` instance.
92
- * @returns {Promise<void>}
93
- */
94
- export function deleteObject(storageRef) {
95
- return storageRef.delete.call(storageRef, MODULAR_DEPRECATION_ARG);
96
- }
97
-
98
- /**
99
- * Downloads the data at the object's location. Returns an error if the object is not found.
100
- * @param _storageRef - Storage `Reference` instance.
101
- * @param _maxDownloadSizeBytes - The maximum allowed size in bytes to retrieve. Web only.
102
- * @returns {Promise<Blob>}
103
- */
104
- export function getBlob(_storageRef, _maxDownloadSizeBytes) {
105
- throw new Error('`getBlob()` is not implemented');
106
- }
107
-
108
- /**
109
- * Downloads the data at the object's location. Returns an error if the object is not found.
110
- * @param _storageRef - Storage `Reference` instance.
111
- * @param _maxDownloadSizeBytes - The maximum allowed size in bytes to retrieve. Web only.
112
- * @returns {Promise<ArrayBuffer>}
113
- */
114
- export function getBytes(_storageRef, _maxDownloadSizeBytes) {
115
- throw new Error('`getBytes()` is not implemented');
116
- }
117
-
118
- /**
119
- * Deletes the object at this reference's location.
120
- * @param storageRef - Storage `Reference` instance.
121
- * @returns {Promise<string>}
122
- */
123
- export function getDownloadURL(storageRef) {
124
- return storageRef.getDownloadURL.call(storageRef, MODULAR_DEPRECATION_ARG);
125
- }
126
-
127
- /**
128
- * Fetches metadata for the object at this location, if one exists.
129
- * @param storageRef - Storage `Reference` instance.
130
- * @returns {Promise<FullMetadata>}
131
- */
132
- export function getMetadata(storageRef) {
133
- return storageRef.getMetadata.call(storageRef, MODULAR_DEPRECATION_ARG);
134
- }
135
-
136
- /**
137
- * Downloads the data at the object's location. This API is only available in Nodejs.
138
- * @param _storageRef - Storage `Reference` instance.
139
- * @param _maxDownloadSizeBytes - The maximum allowed size in bytes to retrieve. Web only.
140
- * @returns {NodeJS.ReadableStream;}
141
- */
142
- export function getStream(_storageRef, _maxDownloadSizeBytes) {
143
- throw new Error('`getStream()` is not implemented');
144
- }
145
-
146
- /**
147
- * List items (files) and prefixes (folders) under this storage reference
148
- * @param storageRef - Storage `Reference` instance.
149
- * @param options - Storage `ListOptions` instance. The options list() accepts.
150
- * @returns {Promise<ListResult>}
151
- */
152
- export async function list(storageRef, options) {
153
- const result = await storageRef.list.call(storageRef, options, MODULAR_DEPRECATION_ARG);
154
- if (result.nextPageToken === null) {
155
- delete result.nextPageToken;
156
- }
157
- return result;
158
- }
159
-
160
- /**
161
- * List all items (files) and prefixes (folders) under this storage reference.
162
- * @param storageRef - Storage `Reference` instance.
163
- * @returns {Promise<ListResult>}
164
- */
165
- export async function listAll(storageRef) {
166
- const result = await storageRef.listAll.call(storageRef, MODULAR_DEPRECATION_ARG);
167
- if (result.nextPageToken === null) {
168
- delete result.nextPageToken;
169
- }
170
- return result;
171
- }
172
-
173
- /**
174
- * Updates the metadata for this object.
175
- * @param storageRef - Storage `Reference` instance.
176
- * @param metadata - A Storage `SettableMetadata` instance to update.
177
- * @returns {Promise<FullMetadata>}
178
- */
179
- export function updateMetadata(storageRef, metadata) {
180
- return storageRef.updateMetadata.call(storageRef, metadata, MODULAR_DEPRECATION_ARG);
181
- }
182
-
183
- /**
184
- * Uploads data to this object's location. The upload is not resumable.
185
- * @param _storageRef - Storage `Reference` instance.
186
- * @param _data - The data (Blob | Uint8Array | ArrayBuffer) to upload to the storage bucket at the reference location.
187
- * @param _metadata - A Storage `UploadMetadata` instance to update. Optional.
188
- * @returns {Promise<TaskResult>}
189
- */
190
- export async function uploadBytes(_storageRef, _data, _metadata) {
191
- throw new Error('`uploadBytes()` is not implemented');
192
- }
193
-
194
- /**
195
- * Uploads data to this object's location. The upload is not resumable.
196
- * @param storageRef - Storage `Reference` instance.
197
- * @param data - The data (Blob | Uint8Array | ArrayBuffer) to upload to the storage bucket at the reference location.
198
- * @param metadata - A Storage `UploadMetadata` instance to update. Optional.
199
- * @returns {Task}
200
- */
201
- export function uploadBytesResumable(storageRef, data, metadata) {
202
- return storageRef.put.call(storageRef, data, metadata, MODULAR_DEPRECATION_ARG);
203
- }
204
-
205
- /**
206
- * Uploads data to this object's location. The upload is not resumable.
207
- * @param storageRef - Storage `Reference` instance.
208
- * @param data - The string to upload.
209
- * @param format - The format of the string to upload ('raw' | 'base64' | 'base64url' | 'data_url'). Optional.
210
- * @param metadata - A Storage `UploadMetadata` instance to update. Optional.
211
- * @returns {Task}
212
- */
213
- export function uploadString(storageRef, data, format, metadata) {
214
- return storageRef.putString.call(storageRef, data, format, metadata, MODULAR_DEPRECATION_ARG);
215
- }
216
-
217
- // Methods not on the Firebase JS SDK below
218
-
219
- /**
220
- * Sets the maximum time in milliseconds to retry a download if a failure occurs.. android & iOS only.
221
- * @param storage - Storage instance.
222
- * @param time - The new maximum operation retry time in milliseconds.
223
- * @returns {Promise<void>}
224
- */
225
- export function setMaxOperationRetryTime(storage, time) {
226
- return storage.setMaxOperationRetryTime.call(storage, time, MODULAR_DEPRECATION_ARG);
227
- }
228
-
229
- /**
230
- * Sets the maximum time in milliseconds to retry an upload if a failure occurs. android & iOS only.
231
- * @param storage - Storage instance.
232
- * @param time - The new maximum operation retry time in milliseconds.
233
- * @returns {Promise<void>}
234
- */
235
- export function setMaxUploadRetryTime(storage, time) {
236
- return storage.setMaxUploadRetryTime.call(storage, time, MODULAR_DEPRECATION_ARG);
237
- }
238
-
239
- /**
240
- * Puts a file from local disk onto the storage bucket.
241
- * @param storageRef - Storage Reference instance.
242
- * @param filePath The local file path to upload to the bucket at the reference location.
243
- * @param metadata Any additional `UploadMetadata` for this task.
244
- * @returns {Task}
245
- */
246
- export function putFile(storageRef, filePath, metadata) {
247
- return storageRef.putFile.call(storageRef, filePath, metadata, MODULAR_DEPRECATION_ARG);
248
- }
249
-
250
- /**
251
- * Downloads a file to the specified local file path on the device.
252
- * @param storageRef - Storage Reference instance.
253
- * @param filePath The local file path to upload to on the device.
254
- * @returns {Task}
255
- */
256
- export function writeToFile(storageRef, filePath) {
257
- return storageRef.writeToFile.call(storageRef, filePath, MODULAR_DEPRECATION_ARG);
258
- }
259
-
260
- /**
261
- * Sets the maximum time in milliseconds to retry a download if a failure occurs.
262
- * @param storage - Storage instance.
263
- * @param time - The new maximum download retry time in milliseconds.
264
- * @returns {Promise<void>}
265
- */
266
- export function setMaxDownloadRetryTime(storage, time) {
267
- return storage.setMaxDownloadRetryTime.call(storage, time, MODULAR_DEPRECATION_ARG);
268
- }
269
- export { StringFormat, TaskEvent, TaskState } from "./StorageStatics.js";
270
- //# sourceMappingURL=modular.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getApp","MODULAR_DEPRECATION_ARG","isUrl","path","test","decodeURIComponent","getStorage","app","bucketUrl","name","storage","connectStorageEmulator","host","port","options","useEmulator","call","ref","storageOrRef","fullPath","undefined","child","refFromURL","deleteObject","storageRef","delete","getBlob","_storageRef","_maxDownloadSizeBytes","Error","getBytes","getDownloadURL","getMetadata","getStream","list","result","nextPageToken","listAll","updateMetadata","metadata","uploadBytes","_data","_metadata","uploadBytesResumable","data","put","uploadString","format","putString","setMaxOperationRetryTime","time","setMaxUploadRetryTime","putFile","filePath","writeToFile","setMaxDownloadRetryTime","StringFormat","TaskEvent","TaskState"],"sourceRoot":"../../lib","sources":["modular.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,MAAM,QAAQ,4BAA4B;AACnD,SAASC,uBAAuB,QAAQ,+CAA+C;AAoBvF,SAASC,KAAKA,CAACC,IAAa,EAAW;EACrC,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAO,KAAK;EACd;EAEA,OAAO,iBAAiB,CAACC,IAAI,CAACC,kBAAkB,CAACF,IAAI,CAAC,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,UAAUA,CAACC,GAAiB,EAAEC,SAAkB,EAAmB;EACjF,IAAID,GAAG,EAAE;IACP,IAAIC,SAAS,IAAI,IAAI,EAAE;MACrB,OAAOR,MAAM,CAACO,GAAG,CAACE,IAAI,CAAC,CAACC,OAAO,CAACF,SAAS,CAAC;IAC5C;IAEA,OAAOR,MAAM,CAACO,GAAG,CAACE,IAAI,CAAC,CAACC,OAAO,CAAC,CAAC;EACnC;EAEA,IAAIF,SAAS,IAAI,IAAI,EAAE;IACrB,OAAOR,MAAM,CAAC,CAAC,CAACU,OAAO,CAACF,SAAS,CAAC;EACpC;EAEA,OAAOR,MAAM,CAAC,CAAC,CAACU,OAAO,CAAC,CAAC;AAC3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCD,OAAwB,EACxBE,IAAY,EACZC,IAAY,EACZC,OAAkC,E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