@react-native-firebase/storage 24.1.0 → 25.0.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 (95) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/{lib → dist/module}/StorageDownloadTask.js +4 -3
  3. package/dist/module/StorageDownloadTask.js.map +1 -0
  4. package/{lib → dist/module}/StorageListResult.js +13 -8
  5. package/dist/module/StorageListResult.js.map +1 -0
  6. package/dist/module/StorageReference.js +270 -0
  7. package/dist/module/StorageReference.js.map +1 -0
  8. package/{lib → dist/module}/StorageStatics.js +5 -16
  9. package/dist/module/StorageStatics.js.map +1 -0
  10. package/{lib → dist/module}/StorageTask.js +82 -71
  11. package/dist/module/StorageTask.js.map +1 -0
  12. package/{lib → dist/module}/StorageUploadTask.js +4 -3
  13. package/dist/module/StorageUploadTask.js.map +1 -0
  14. package/dist/module/index.js +29 -0
  15. package/dist/module/index.js.map +1 -0
  16. package/{lib/modular/index.js → dist/module/modular.js} +65 -79
  17. package/dist/module/modular.js.map +1 -0
  18. package/dist/module/namespaced.js +192 -0
  19. package/dist/module/namespaced.js.map +1 -0
  20. package/dist/module/package.json +1 -0
  21. package/dist/module/types/internal.js +4 -0
  22. package/dist/module/types/internal.js.map +1 -0
  23. package/dist/module/types/namespaced.js +64 -0
  24. package/dist/module/types/namespaced.js.map +1 -0
  25. package/dist/module/types/storage.js +139 -0
  26. package/dist/module/types/storage.js.map +1 -0
  27. package/dist/module/utils.js +105 -0
  28. package/dist/module/utils.js.map +1 -0
  29. package/dist/module/version.js +5 -0
  30. package/dist/module/version.js.map +1 -0
  31. package/dist/module/web/RNFBStorageModule.android.js +6 -0
  32. package/dist/module/web/RNFBStorageModule.android.js.map +1 -0
  33. package/dist/module/web/RNFBStorageModule.ios.js +6 -0
  34. package/dist/module/web/RNFBStorageModule.ios.js.map +1 -0
  35. package/{lib → dist/module}/web/RNFBStorageModule.js +115 -197
  36. package/dist/module/web/RNFBStorageModule.js.map +1 -0
  37. package/dist/typescript/lib/StorageDownloadTask.d.ts +6 -0
  38. package/dist/typescript/lib/StorageDownloadTask.d.ts.map +1 -0
  39. package/dist/typescript/lib/StorageListResult.d.ts +13 -0
  40. package/dist/typescript/lib/StorageListResult.d.ts.map +1 -0
  41. package/dist/typescript/lib/StorageReference.d.ts +87 -0
  42. package/dist/typescript/lib/StorageReference.d.ts.map +1 -0
  43. package/dist/typescript/lib/StorageStatics.d.ts +2 -0
  44. package/dist/typescript/lib/StorageStatics.d.ts.map +1 -0
  45. package/dist/typescript/lib/StorageTask.d.ts +43 -0
  46. package/dist/typescript/lib/StorageTask.d.ts.map +1 -0
  47. package/dist/typescript/lib/StorageUploadTask.d.ts +6 -0
  48. package/dist/typescript/lib/StorageUploadTask.d.ts.map +1 -0
  49. package/dist/typescript/lib/index.d.ts +6 -0
  50. package/dist/typescript/lib/index.d.ts.map +1 -0
  51. package/dist/typescript/lib/modular.d.ts +154 -0
  52. package/dist/typescript/lib/modular.d.ts.map +1 -0
  53. package/dist/typescript/lib/namespaced.d.ts +12 -0
  54. package/dist/typescript/lib/namespaced.d.ts.map +1 -0
  55. package/dist/typescript/lib/types/internal.d.ts +131 -0
  56. package/dist/typescript/lib/types/internal.d.ts.map +1 -0
  57. package/dist/typescript/lib/types/namespaced.d.ts +1122 -0
  58. package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
  59. package/dist/typescript/lib/types/storage.d.ts +338 -0
  60. package/dist/typescript/lib/types/storage.d.ts.map +1 -0
  61. package/dist/typescript/lib/utils.d.ts +20 -0
  62. package/dist/typescript/lib/utils.d.ts.map +1 -0
  63. package/dist/typescript/lib/version.d.ts +2 -0
  64. package/dist/typescript/lib/version.d.ts.map +1 -0
  65. package/dist/typescript/lib/web/RNFBStorageModule.android.d.ts +3 -0
  66. package/dist/typescript/lib/web/RNFBStorageModule.android.d.ts.map +1 -0
  67. package/dist/typescript/lib/web/RNFBStorageModule.d.ts +142 -0
  68. package/dist/typescript/lib/web/RNFBStorageModule.d.ts.map +1 -0
  69. package/dist/typescript/lib/web/RNFBStorageModule.ios.d.ts +3 -0
  70. package/dist/typescript/lib/web/RNFBStorageModule.ios.d.ts.map +1 -0
  71. package/dist/typescript/package.json +1 -0
  72. package/lib/StorageDownloadTask.ts +30 -0
  73. package/lib/StorageListResult.ts +61 -0
  74. package/lib/{StorageReference.js → StorageReference.ts} +103 -61
  75. package/lib/StorageStatics.ts +19 -0
  76. package/lib/StorageTask.ts +336 -0
  77. package/lib/StorageUploadTask.ts +30 -0
  78. package/lib/index.ts +27 -0
  79. package/lib/modular.ts +401 -0
  80. package/lib/{index.js → namespaced.ts} +70 -28
  81. package/lib/types/internal.ts +189 -0
  82. package/lib/{index.d.ts → types/namespaced.ts} +111 -49
  83. package/lib/types/storage.ts +417 -0
  84. package/lib/{utils.js → utils.ts} +62 -15
  85. package/lib/version.ts +2 -0
  86. package/lib/web/RNFBStorageModule.android.ts +3 -0
  87. package/lib/web/RNFBStorageModule.ios.ts +3 -0
  88. package/lib/web/RNFBStorageModule.ts +557 -0
  89. package/package.json +41 -7
  90. package/tsconfig.json +23 -0
  91. package/typedoc.json +1 -1
  92. package/lib/modular/index.d.ts +0 -276
  93. package/lib/version.js +0 -2
  94. package/lib/web/RNFBStorageModule.android.js +0 -2
  95. package/lib/web/RNFBStorageModule.ios.js +0 -2
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  /*
2
4
  * Copyright (c) 2016-present Invertase Limited & Contributors
3
5
  *
@@ -16,79 +18,77 @@
16
18
  */
17
19
 
18
20
  import { isFunction, isNull, isObject } from '@react-native-firebase/app/dist/module/common';
19
- import { TaskEvent } from './StorageStatics';
20
-
21
+ import { TaskEvent } from "./StorageStatics.js";
21
22
  let TASK_ID = 0;
22
-
23
+ function createEmptyMetadata(ref) {
24
+ return {
25
+ bucket: ref.bucket,
26
+ fullPath: ref.fullPath,
27
+ generation: '',
28
+ metageneration: '',
29
+ name: ref.name,
30
+ size: 0,
31
+ timeCreated: '',
32
+ updated: '',
33
+ downloadTokens: undefined,
34
+ ref
35
+ };
36
+ }
23
37
  function wrapErrorEventListener(listenerFn, unsubscribe) {
24
- return event => {
38
+ return snapshot => {
25
39
  if (unsubscribe) {
26
40
  setTimeout(() => unsubscribe(), 0);
27
41
  } // 1 frame = 16ms, pushing to next frame
28
42
  if (isFunction(listenerFn)) {
29
- listenerFn(event.error);
43
+ const errorEvent = snapshot;
44
+ if (errorEvent.error) {
45
+ listenerFn(errorEvent.error);
46
+ }
30
47
  }
31
48
  };
32
49
  }
33
-
34
50
  function wrapSnapshotEventListener(task, listenerFn, unsubscribe) {
35
51
  if (!isFunction(listenerFn)) {
36
52
  return null;
37
53
  }
38
- return event => {
54
+ return snapshot => {
39
55
  if (unsubscribe) {
40
56
  setTimeout(() => unsubscribe(), 0);
41
57
  } // 1 frame = 16ms, pushing to next frame
42
58
  if (isFunction(listenerFn)) {
43
- const snapshot = Object.assign({}, event);
44
- snapshot.task = task;
45
- snapshot.ref = task._ref;
46
-
47
- if (snapshot.metadata) {
48
- if (!snapshot.metadata.generation) {
49
- snapshot.metadata.generation = '';
50
- }
51
- if (!snapshot.metadata.bucket) {
52
- snapshot.metadata.bucket = task._ref.bucket;
53
- }
54
- if (!snapshot.metadata.metageneration) {
55
- snapshot.metadata.metageneration = '';
56
- }
57
- // // TODO(salakar): these are always here, cannot repro without, remove in 6.1.0 if no issues:
58
- // if (!snapshot.metadata.name) snapshot.metadata.name = task._ref.name;
59
- // if (!snapshot.metadata.fullPath) snapshot.metadata.fullPath = task._ref.fullPath;
59
+ const taskSnapshot = Object.assign({}, snapshot);
60
+ taskSnapshot.task = task;
61
+ taskSnapshot.ref = task._ref;
62
+ if (!taskSnapshot.metadata) {
63
+ taskSnapshot.metadata = createEmptyMetadata(task._ref);
64
+ } else {
65
+ if (!taskSnapshot.metadata.generation) taskSnapshot.metadata.generation = '';
66
+ if (!taskSnapshot.metadata.bucket) taskSnapshot.metadata.bucket = task._ref.bucket;
67
+ if (!taskSnapshot.metadata.metageneration) taskSnapshot.metadata.metageneration = '';
68
+ if (!taskSnapshot.metadata.fullPath) taskSnapshot.metadata.fullPath = task._ref.fullPath;
69
+ if (!taskSnapshot.metadata.name) taskSnapshot.metadata.name = task._ref.name;
70
+ if (!taskSnapshot.metadata.ref) taskSnapshot.metadata.ref = task._ref;
60
71
  }
61
-
62
- Object.freeze(snapshot);
63
- task._snapshot = snapshot;
64
-
65
- listenerFn(snapshot);
72
+ Object.freeze(taskSnapshot);
73
+ task._snapshot = taskSnapshot;
74
+ listenerFn(taskSnapshot);
66
75
  }
67
76
  };
68
77
  }
69
-
70
78
  function addTaskEventListener(task, eventName, listener) {
71
79
  let _eventName = eventName;
72
80
  if (_eventName !== TaskEvent.STATE_CHANGED) {
73
81
  _eventName = `${task._type}_${eventName}`;
74
82
  }
75
-
76
- return task._storage.emitter.addListener(
77
- task._storage.eventNameForApp(task._id, _eventName),
78
- listener,
79
- );
83
+ return task._storage.emitter.addListener(task._storage.eventNameForApp(task._id, _eventName), listener);
80
84
  }
81
-
82
85
  function subscribeToEvents(task, nextOrObserver, error, complete) {
83
86
  let _error;
84
87
  let _errorSubscription;
85
-
86
88
  let _next;
87
89
  let _nextSubscription;
88
-
89
90
  let _complete;
90
91
  let _completeSubscription;
91
-
92
92
  const unsubscribe = () => {
93
93
  if (_nextSubscription) {
94
94
  _nextSubscription.remove();
@@ -100,39 +100,32 @@ function subscribeToEvents(task, nextOrObserver, error, complete) {
100
100
  _completeSubscription.remove();
101
101
  }
102
102
  };
103
-
104
103
  if (isFunction(nextOrObserver)) {
105
104
  _error = wrapErrorEventListener(error, unsubscribe);
106
- _next = wrapSnapshotEventListener(task, nextOrObserver);
105
+ _next = wrapSnapshotEventListener(task, nextOrObserver, null);
107
106
  _complete = wrapSnapshotEventListener(task, complete, unsubscribe);
108
107
  } else if (isObject(nextOrObserver)) {
109
- _error = wrapErrorEventListener(nextOrObserver.error, unsubscribe);
110
- _next = wrapSnapshotEventListener(task, nextOrObserver.next);
111
- _complete = wrapSnapshotEventListener(task, nextOrObserver.complete, unsubscribe);
108
+ const observer = nextOrObserver;
109
+ _error = wrapErrorEventListener(observer.error, unsubscribe);
110
+ _next = wrapSnapshotEventListener(task, observer.next, null);
111
+ _complete = wrapSnapshotEventListener(task, observer.complete, unsubscribe);
112
112
  } else if (isNull(nextOrObserver)) {
113
113
  _error = wrapErrorEventListener(error, unsubscribe);
114
114
  _complete = wrapSnapshotEventListener(task, complete, unsubscribe);
115
115
  } else {
116
- throw new Error(
117
- "firebase.storage.StorageTask.on(*, _) 'nextOrObserver' must be a Function, an Object or Null.",
118
- );
116
+ throw new Error("firebase.storage.StorageTask.on(*, _) 'nextOrObserver' must be a Function, an Object or Null.");
119
117
  }
120
-
121
118
  if (_next) {
122
119
  _nextSubscription = addTaskEventListener(task, TaskEvent.STATE_CHANGED, _next);
123
120
  }
124
-
125
121
  if (_error) {
126
122
  _errorSubscription = addTaskEventListener(task, 'failure', _error);
127
123
  }
128
-
129
124
  if (_complete) {
130
125
  _completeSubscription = addTaskEventListener(task, 'success', _complete);
131
126
  }
132
-
133
127
  return unsubscribe;
134
128
  }
135
-
136
129
  export default class StorageTask {
137
130
  constructor(type, storageRef, beginTaskFn) {
138
131
  this._type = type;
@@ -141,7 +134,14 @@ export default class StorageTask {
141
134
  this._ref = storageRef;
142
135
  this._beginTask = beginTaskFn;
143
136
  this._storage = storageRef._storage;
144
- this._snapshot = null;
137
+ this._snapshot = {
138
+ bytesTransferred: 0,
139
+ totalBytes: 0,
140
+ state: 'running',
141
+ metadata: createEmptyMetadata(storageRef),
142
+ task: this,
143
+ ref: storageRef
144
+ };
145
145
  }
146
146
 
147
147
  /**
@@ -151,17 +151,31 @@ export default class StorageTask {
151
151
  if (!this._promise) {
152
152
  this._promise = this._beginTask(this);
153
153
  }
154
-
155
- return new Promise((resolve, reject) => {
156
- const boundPromise = this._promise.then.bind(this._promise);
157
-
158
- boundPromise(response => {
159
- this._snapshot = { ...response, ref: this._ref, task: this };
160
- resolve(response);
161
- }).catch(error => {
162
- reject(error);
154
+ const promise = this._promise;
155
+ return (onFulfilled, onRejected) => {
156
+ return new Promise((resolve, reject) => {
157
+ promise.then(response => {
158
+ this._snapshot = {
159
+ ...response,
160
+ ref: this._ref,
161
+ task: this,
162
+ state: response?.state ?? this._snapshot.state,
163
+ metadata: response?.metadata ? response.metadata : createEmptyMetadata(this._ref)
164
+ };
165
+ if (onFulfilled) {
166
+ resolve(onFulfilled(this._snapshot));
167
+ } else {
168
+ resolve(response);
169
+ }
170
+ }).catch(error => {
171
+ if (onRejected) {
172
+ resolve(onRejected(error));
173
+ } else {
174
+ reject(error);
175
+ }
176
+ });
163
177
  });
164
- }).then.bind(this._promise);
178
+ };
165
179
  }
166
180
 
167
181
  /**
@@ -173,7 +187,6 @@ export default class StorageTask {
173
187
  }
174
188
  return this._promise.catch.bind(this._promise);
175
189
  }
176
-
177
190
  get snapshot() {
178
191
  return this._snapshot;
179
192
  }
@@ -190,22 +203,19 @@ export default class StorageTask {
190
203
  /**
191
204
  * @url https://firebase.google.com/docs/reference/js/firebase.storage.UploadTask#on
192
205
  */
206
+
193
207
  on(event, nextOrObserver, error, complete) {
194
208
  if (event !== TaskEvent.STATE_CHANGED) {
195
- throw new Error(
196
- `firebase.storage.StorageTask.on event argument must be a string with a value of '${TaskEvent.STATE_CHANGED}'`,
197
- );
209
+ throw new Error(`firebase.storage.StorageTask.on event argument must be a string with a value of '${TaskEvent.STATE_CHANGED}'`);
198
210
  }
199
-
200
211
  if (!this._promise) {
201
212
  this._promise = this._beginTask(this);
202
213
  }
203
214
 
204
215
  // if only event provided return the subscriber function
205
216
  if (!nextOrObserver && !error && !complete) {
206
- return subscribeToEvents.bind(null, this);
217
+ return (...args) => subscribeToEvents(this, ...args);
207
218
  }
208
-
209
219
  return subscribeToEvents(this, nextOrObserver, error, complete);
210
220
  }
211
221
 
@@ -217,7 +227,7 @@ export default class StorageTask {
217
227
  }
218
228
 
219
229
  /**
220
- * @url https://firebase.google.com/docs/reference/js/firebase.storage.UploadTask#resume
230
+ * @url https://firebase.google.com/docs/reference/js/firebase.storage.UploadTask#pause
221
231
  */
222
232
  resume() {
223
233
  return this._storage.native.setTaskStatus(this._id, 1);
@@ -230,3 +240,4 @@ export default class StorageTask {
230
240
  return this._storage.native.setTaskStatus(this._id, 2);
231
241
  }
232
242
  }
243
+ //# sourceMappingURL=StorageTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isFunction","isNull","isObject","TaskEvent","TASK_ID","createEmptyMetadata","ref","bucket","fullPath","generation","metageneration","name","size","timeCreated","updated","downloadTokens","undefined","wrapErrorEventListener","listenerFn","unsubscribe","snapshot","setTimeout","errorEvent","error","wrapSnapshotEventListener","task","taskSnapshot","Object","assign","_ref","metadata","freeze","_snapshot","addTaskEventListener","eventName","listener","_eventName","STATE_CHANGED","_type","_storage","emitter","addListener","eventNameForApp","_id","subscribeToEvents","nextOrObserver","complete","_error","_errorSubscription","_next","_nextSubscription","_complete","_completeSubscription","remove","observer","next","Error","StorageTask","constructor","type","storageRef","beginTaskFn","_promise","_beginTask","bytesTransferred","totalBytes","state","then","promise","onFulfilled","onRejected","Promise","resolve","reject","response","catch","bind","on","event","args","pause","native","setTaskStatus","resume","cancel"],"sourceRoot":"../../lib","sources":["StorageTask.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,+CAA+C;AAE5F,SAASC,SAAS,QAAQ,qBAAkB;AAa5C,IAAIC,OAAO,GAAG,CAAC;AAIf,SAASC,mBAAmBA,CAACC,GAAqB,EAAgB;EAChE,OAAO;IACLC,MAAM,EAAED,GAAG,CAACC,MAAM;IAClBC,QAAQ,EAAEF,GAAG,CAACE,QAAQ;IACtBC,UAAU,EAAE,EAAE;IACdC,cAAc,EAAE,EAAE;IAClB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EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;AACF;AACA;;EAQE6C,EAAEA,CACAC,KAAoB,EACpBjC,cAA6F,EAC7FtB,KAA4E,EAC5EuB,QAAiC,EACM;IACvC,IAAIgC,KAAK,KAAK3E,SAAS,CAACkC,aAAa,EAAE;MACrC,MAAM,IAAImB,KAAK,CACb,oFAAoFrD,SAAS,CAACkC,aAAa,GAC7G,CAAC;IACH;IAEA,IAAI,CAAC,IAAI,CAACyB,QAAQ,EAAE;MAClB,IAAI,CAACA,QAAQ,GAAG,IAAI,CAACC,UAAU,CAAC,IAAI,CAAC;IACvC;;IAEA;IACA,IAAI,CAAClB,cAAc,IAAI,CAACtB,KAAK,IAAI,CAACuB,QAAQ,EAAE;MAC1C,OAAQ,CAAC,GAAGiC,IAAyC,KACnDnC,iBAAiB,CAAC,IAAI,EAAE,GAAGmC,IAAI,CAAC;IACpC;IAEA,OAAOnC,iBAAiB,CAAC,IAAI,EAAEC,cAAc,EAAEtB,KAAK,EAAEuB,QAAQ,CAAC;EACjE;;EAEA;AACF;AACA;EACEkC,KAAKA,CAAA,EAAqB;IACxB,OAAO,IAAI,CAACzC,QAAQ,CAAC0C,MAAM,CAACC,aAAa,CAAC,IAAI,CAACvC,GAAG,EAAE,CAAC,CAAC;EACxD;;EAEA;AACF;AACA;EACEwC,MAAMA,CAAA,EAAqB;IACzB,OAAO,IAAI,CAAC5C,QAAQ,CAAC0C,MAAM,CAACC,aAAa,CAAC,IAAI,CAACvC,GAAG,EAAE,CAAC,CAAC;EACxD;;EAEA;AACF;AACA;EACEyC,MAAMA,CAAA,EAAqB;IACzB,OAAO,IAAI,CAAC7C,QAAQ,CAAC0C,MAAM,CAACC,aAAa,CAAC,IAAI,CAACvC,GAAG,EAAE,CAAC,CAAC;EACxD;AACF","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  /*
2
4
  * Copyright (c) 2016-present Invertase Limited & Contributors
3
5
  *
@@ -15,12 +17,11 @@
15
17
  *
16
18
  */
17
19
 
18
- import StorageTask from './StorageTask';
19
-
20
+ import StorageTask from "./StorageTask.js";
20
21
  const UPLOAD_TASK = 'upload';
21
-
22
22
  export default class StorageUploadTask extends StorageTask {
23
23
  constructor(storageRef, beginTaskFn) {
24
24
  super(UPLOAD_TASK, storageRef, beginTaskFn);
25
25
  }
26
26
  }
27
+ //# sourceMappingURL=StorageUploadTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StorageTask","UPLOAD_TASK","StorageUploadTask","constructor","storageRef","beginTaskFn"],"sourceRoot":"../../lib","sources":["StorageUploadTask.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,WAAW,MAAM,kBAAe;AAGvC,MAAMC,WAAW,GAAG,QAAQ;AAE5B,eAAe,MAAMC,iBAAiB,SAASF,WAAW,CAAC;EACzDG,WAAWA,CACTC,UAA4B,EAC5BC,WAAyD,EACzD;IACA,KAAK,CAACJ,WAAW,EAAEG,UAAU,EAAEC,WAAW,CAAC;EAC7C;AACF","ignoreList":[]}
@@ -0,0 +1,29 @@
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
+ // Export modular types from types/storage
21
+
22
+ // Export modular API functions
23
+ export * from "./modular.js";
24
+
25
+ // Export namespaced API
26
+
27
+ export * from "./namespaced.js";
28
+ export { default } from "./namespaced.js";
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default"],"sourceRoot":"../../lib","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAGA;AACA,cAAc,cAAW;;AAEzB;;AAEA,cAAc,iBAAc;AAC5B,SAASA,OAAO,QAAQ,iBAAc","ignoreList":[]}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  /*
2
4
  * Copyright (c) 2016-present Invertase Limited & Contributors
3
5
  *
@@ -14,22 +16,15 @@
14
16
  * limitations under the License.
15
17
  *
16
18
  */
17
- /**
18
- * @typedef {import('..').FirebaseStorageTypes} FirebaseStorageTypes
19
- * @typedef {import('..').FirebaseStorageTypes.Module} Storage
20
- * @typedef {import('..').FirebaseStorageTypes.Reference} Reference
21
- * @typedef {import('..').FirebaseStorageTypes.FullMetadata} FullMetadata
22
- * @typedef {import('..').FirebaseStorageTypes.ListResult} ListResult
23
- * @typedef {import('..').FirebaseStorageTypes.TaskResult} TaskResult
24
- * @typedef {import('..').FirebaseStorageTypes.Task} Task
25
- * @typedef {import('..').FirebaseStorageTypes.ListOptions} ListOptions
26
- * @typedef {import('..').FirebaseStorageTypes.SettableMetadata} SettableMetadata
27
- * @typedef {import('..').FirebaseStorageTypes.EmulatorMockTokenOptions} EmulatorMockTokenOptions
28
- * @typedef {import('@firebase/app').FirebaseApp} FirebaseApp
29
- */
30
19
 
31
20
  import { getApp } from '@react-native-firebase/app';
32
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
+ }
33
28
 
34
29
  /**
35
30
  * Returns a Storage instance for the given app.
@@ -42,14 +37,11 @@ export function getStorage(app, bucketUrl) {
42
37
  if (bucketUrl != null) {
43
38
  return getApp(app.name).storage(bucketUrl);
44
39
  }
45
-
46
40
  return getApp(app.name).storage();
47
41
  }
48
-
49
42
  if (bucketUrl != null) {
50
43
  return getApp().storage(bucketUrl);
51
44
  }
52
-
53
45
  return getApp().storage();
54
46
  }
55
47
 
@@ -66,13 +58,31 @@ export function connectStorageEmulator(storage, host, port, options) {
66
58
  }
67
59
 
68
60
  /**
69
- * Modify this Storage instance to communicate with the Firebase Storage emulator.
70
- * @param storage - Storage instance.
71
- * @param path An optional string pointing to a location on the storage bucket. If no path
72
- * is provided, the returned reference will be the bucket root path. Optional.
73
- * @returns {Reference}
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}
74
65
  */
75
- export function ref(storage, path) {
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
+ }
76
86
  return storage.ref.call(storage, path, MODULAR_DEPRECATION_ARG);
77
87
  }
78
88
 
@@ -87,22 +97,21 @@ export function deleteObject(storageRef) {
87
97
 
88
98
  /**
89
99
  * Downloads the data at the object's location. Returns an error if the object is not found.
90
- * @param storageRef - Storage `Reference` instance.
100
+ * @param _storageRef - Storage `Reference` instance.
101
+ * @param _maxDownloadSizeBytes - The maximum allowed size in bytes to retrieve. Web only.
91
102
  * @returns {Promise<Blob>}
92
103
  */
93
- // eslint-disable-next-line
94
- export function getBlob(storageRef, maxDownloadSizeBytes) {
104
+ export function getBlob(_storageRef, _maxDownloadSizeBytes) {
95
105
  throw new Error('`getBlob()` is not implemented');
96
106
  }
97
107
 
98
108
  /**
99
109
  * 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.
110
+ * @param _storageRef - Storage `Reference` instance.
111
+ * @param _maxDownloadSizeBytes - The maximum allowed size in bytes to retrieve. Web only.
102
112
  * @returns {Promise<ArrayBuffer>}
103
113
  */
104
- // eslint-disable-next-line
105
- export function getBytes(storageRef, maxDownloadSizeBytes) {
114
+ export function getBytes(_storageRef, _maxDownloadSizeBytes) {
106
115
  throw new Error('`getBytes()` is not implemented');
107
116
  }
108
117
 
@@ -126,12 +135,11 @@ export function getMetadata(storageRef) {
126
135
 
127
136
  /**
128
137
  * Downloads the data at the object's location. This API is only available in Nodejs.
129
- * @param storageRef - Storage `Reference` instance.
130
- * @param maxDownloadSizeBytes - The maximum allowed size in bytes to retrieve. Web only.
138
+ * @param _storageRef - Storage `Reference` instance.
139
+ * @param _maxDownloadSizeBytes - The maximum allowed size in bytes to retrieve. Web only.
131
140
  * @returns {NodeJS.ReadableStream;}
132
141
  */
133
- // eslint-disable-next-line
134
- export function getStream(storageRef, maxDownloadSizeBytes) {
142
+ export function getStream(_storageRef, _maxDownloadSizeBytes) {
135
143
  throw new Error('`getStream()` is not implemented');
136
144
  }
137
145
 
@@ -141,8 +149,12 @@ export function getStream(storageRef, maxDownloadSizeBytes) {
141
149
  * @param options - Storage `ListOptions` instance. The options list() accepts.
142
150
  * @returns {Promise<ListResult>}
143
151
  */
144
- export function list(storageRef, options) {
145
- return storageRef.list.call(storageRef, options, MODULAR_DEPRECATION_ARG);
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;
146
158
  }
147
159
 
148
160
  /**
@@ -150,8 +162,12 @@ export function list(storageRef, options) {
150
162
  * @param storageRef - Storage `Reference` instance.
151
163
  * @returns {Promise<ListResult>}
152
164
  */
153
- export function listAll(storageRef) {
154
- return storageRef.listAll.call(storageRef, MODULAR_DEPRECATION_ARG);
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;
155
171
  }
156
172
 
157
173
  /**
@@ -166,13 +182,12 @@ export function updateMetadata(storageRef, metadata) {
166
182
 
167
183
  /**
168
184
  * Uploads data to this object's location. The upload is not resumable.
169
- * @param storageRef - Storage `Reference` instance.
170
- * @param data - The data (Blob | Uint8Array | ArrayBuffer) to upload to the storage bucket at the reference location.
171
- * @param metadata - A Storage `SettableMetadata` instance to update. Optional.
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.
172
188
  * @returns {Promise<TaskResult>}
173
189
  */
174
- // eslint-disable-next-line
175
- export async function uploadBytes(storageRef, data, metadata) {
190
+ export async function uploadBytes(_storageRef, _data, _metadata) {
176
191
  throw new Error('`uploadBytes()` is not implemented');
177
192
  }
178
193
 
@@ -180,7 +195,7 @@ export async function uploadBytes(storageRef, data, metadata) {
180
195
  * Uploads data to this object's location. The upload is not resumable.
181
196
  * @param storageRef - Storage `Reference` instance.
182
197
  * @param data - The data (Blob | Uint8Array | ArrayBuffer) to upload to the storage bucket at the reference location.
183
- * @param metadata - A Storage `SettableMetadata` instance to update. Optional.
198
+ * @param metadata - A Storage `UploadMetadata` instance to update. Optional.
184
199
  * @returns {Task}
185
200
  */
186
201
  export function uploadBytesResumable(storageRef, data, metadata) {
@@ -190,9 +205,9 @@ export function uploadBytesResumable(storageRef, data, metadata) {
190
205
  /**
191
206
  * Uploads data to this object's location. The upload is not resumable.
192
207
  * @param storageRef - Storage `Reference` instance.
193
- * @param value - The string to upload.
208
+ * @param data - The string to upload.
194
209
  * @param format - The format of the string to upload ('raw' | 'base64' | 'base64url' | 'data_url'). Optional.
195
- * @param metadata - A Storage `SettableMetadata` instance to update. Optional.
210
+ * @param metadata - A Storage `UploadMetadata` instance to update. Optional.
196
211
  * @returns {Task}
197
212
  */
198
213
  export function uploadString(storageRef, data, format, metadata) {
@@ -201,16 +216,6 @@ export function uploadString(storageRef, data, format, metadata) {
201
216
 
202
217
  // Methods not on the Firebase JS SDK below
203
218
 
204
- /**
205
- * Returns a new Storage `Reference` instance from a storage bucket URL.
206
- * @param storage - Storage instance.
207
- * @param url - A storage bucket URL pointing to a single file or location. Must be either a `gs://` url or an `http` url. Not available on web.
208
- * @returns {Reference}
209
- */
210
- export function refFromURL(storage, url) {
211
- return storage.refFromURL.call(storage, url, MODULAR_DEPRECATION_ARG);
212
- }
213
-
214
219
  /**
215
220
  * Sets the maximum time in milliseconds to retry a download if a failure occurs.. android & iOS only.
216
221
  * @param storage - Storage instance.
@@ -234,8 +239,8 @@ export function setMaxUploadRetryTime(storage, time) {
234
239
  /**
235
240
  * Puts a file from local disk onto the storage bucket.
236
241
  * @param storageRef - Storage Reference instance.
237
- * @param localFilePath The local file path to upload to the bucket at the reference location.
238
- * @param metadata Any additional `SettableMetadata` for this task.
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.
239
244
  * @returns {Task}
240
245
  */
241
246
  export function putFile(storageRef, filePath, metadata) {
@@ -245,32 +250,13 @@ export function putFile(storageRef, filePath, metadata) {
245
250
  /**
246
251
  * Downloads a file to the specified local file path on the device.
247
252
  * @param storageRef - Storage Reference instance.
248
- * @param localFilePath The local file path to upload to on the device.
253
+ * @param filePath The local file path to upload to on the device.
249
254
  * @returns {Task}
250
255
  */
251
256
  export function writeToFile(storageRef, filePath) {
252
257
  return storageRef.writeToFile.call(storageRef, filePath, MODULAR_DEPRECATION_ARG);
253
258
  }
254
259
 
255
- /**
256
- * Returns a gs:// URL for this object in the form `gs://<bucket>/<path>/<to>/<object>`.
257
- * @param storageRef - Storage Reference instance.
258
- * @returns {String}
259
- */
260
- export function toString(storageRef) {
261
- return storageRef.toString.call(storageRef, MODULAR_DEPRECATION_ARG);
262
- }
263
-
264
- /**
265
- * Returns a reference to a relative path from this reference.
266
- * @param storageRef - Storage Reference instance.
267
- * @param path - The relative path from this reference. Leading, trailing, and consecutive slashes are removed.
268
- * @returns {String}
269
- */
270
- export function child(storageRef, path) {
271
- return storageRef.child.call(storageRef, path, MODULAR_DEPRECATION_ARG);
272
- }
273
-
274
260
  /**
275
261
  * Sets the maximum time in milliseconds to retry a download if a failure occurs.
276
262
  * @param storage - Storage instance.
@@ -280,5 +266,5 @@ export function child(storageRef, path) {
280
266
  export function setMaxDownloadRetryTime(storage, time) {
281
267
  return storage.setMaxDownloadRetryTime.call(storage, time, MODULAR_DEPRECATION_ARG);
282
268
  }
283
-
284
- export { StringFormat, TaskEvent, TaskState } from '../StorageStatics';
269
+ export { StringFormat, TaskEvent, TaskState } from "./StorageStatics.js";
270
+ //# sourceMappingURL=modular.js.map
@@ -0,0 +1 @@
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,EAC5B;EACN,OACGJ,OAAO,CAAqBK,WAAW,CAGxCC,IAAI,CAACN,OAAO,EAAEE,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEb,uBAAuB,CAAC;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAE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