1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/operators'), require('@angular/fire'), require('@angular/core'), require('@angular/fire/compat'), require('firebase/compat/storage'), require('@angular/fire/app-check'), require('@angular/common'), require('@angular/platform-browser'), require('firebase/compat/app')) :
|
3 | typeof define === 'function' && define.amd ? define('@angular/fire/compat/storage', ['exports', 'rxjs', 'rxjs/operators', '@angular/fire', '@angular/core', '@angular/fire/compat', 'firebase/compat/storage', '@angular/fire/app-check', '@angular/common', '@angular/platform-browser', 'firebase/compat/app'], factory) :
|
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.angular = global.angular || {}, global.angular.fire = global.angular.fire || {}, global.angular.fire.compat = global.angular.fire.compat || {}, global.angular.fire.compat.storage = {}), global.rxjs, global.rxjs.operators, global.angular.fire, global.ng.core, global.angular.fire.compat, null, global.angular.fire['app-check'], global.ng.common, global.ng.platformBrowser, global.firebase));
|
5 | }(this, (function (exports, rxjs, operators, i1, i0, compat, storage, i2, common, i2$1, firebase) { 'use strict';
|
6 |
|
7 | function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
8 |
|
9 | function _interopNamespace(e) {
|
10 | if (e && e.__esModule) return e;
|
11 | var n = Object.create(null);
|
12 | if (e) {
|
13 | Object.keys(e).forEach(function (k) {
|
14 | if (k !== 'default') {
|
15 | var d = Object.getOwnPropertyDescriptor(e, k);
|
16 | Object.defineProperty(n, k, d.get ? d : {
|
17 | enumerable: true,
|
18 | get: function () {
|
19 | return e[k];
|
20 | }
|
21 | });
|
22 | }
|
23 | });
|
24 | }
|
25 | n['default'] = e;
|
26 | return Object.freeze(n);
|
27 | }
|
28 |
|
29 | var i1__namespace = _interopNamespace(i1);
|
30 | var i0__namespace = _interopNamespace(i0);
|
31 | var i2__namespace = _interopNamespace(i2);
|
32 | var i2__namespace$1 = _interopNamespace(i2$1);
|
33 | var firebase__default = _interopDefaultLegacy(firebase);
|
34 |
|
35 |
|
36 |
|
37 | function fromTask(task) {
|
38 | return new rxjs.Observable(function (subscriber) {
|
39 | var progress = function (snap) { return subscriber.next(snap); };
|
40 | var error = function (e) { return subscriber.error(e); };
|
41 | var complete = function () { return subscriber.complete(); };
|
42 |
|
43 |
|
44 | progress(task.snapshot);
|
45 | var unsub = task.on('state_changed', progress);
|
46 |
|
47 |
|
48 |
|
49 | task.then(function (snapshot) {
|
50 | progress(snapshot);
|
51 | complete();
|
52 | }, function (e) {
|
53 |
|
54 | progress(task.snapshot);
|
55 | error(e);
|
56 | });
|
57 |
|
58 | return function unsubscribe() {
|
59 | unsub();
|
60 | };
|
61 | }).pipe(
|
62 |
|
63 |
|
64 | operators.debounceTime(0));
|
65 | }
|
66 |
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 | function createUploadTask(task) {
|
73 | var inner$ = fromTask(task);
|
74 | return {
|
75 | task: task,
|
76 | then: task.then.bind(task),
|
77 | catch: task.catch.bind(task),
|
78 | pause: task.pause.bind(task),
|
79 | cancel: task.cancel.bind(task),
|
80 | resume: task.resume.bind(task),
|
81 | snapshotChanges: function () { return inner$; },
|
82 | percentageChanges: function () { return inner$.pipe(operators.map(function (s) { return s.bytesTransferred / s.totalBytes * 100; })); }
|
83 | };
|
84 | }
|
85 |
|
86 | |
87 |
|
88 |
|
89 |
|
90 | function createStorageRef(ref) {
|
91 | return {
|
92 | getDownloadURL: function () { return rxjs.of(undefined).pipe(i1.observeOutsideAngular, operators.switchMap(function () { return ref.getDownloadURL(); }), i1.keepUnstableUntilFirst); },
|
93 | getMetadata: function () { return rxjs.of(undefined).pipe(i1.observeOutsideAngular, operators.switchMap(function () { return ref.getMetadata(); }), i1.keepUnstableUntilFirst); },
|
94 | delete: function () { return rxjs.from(ref.delete()); },
|
95 | child: function (path) { return createStorageRef(ref.child(path)); },
|
96 | updateMetadata: function (meta) { return rxjs.from(ref.updateMetadata(meta)); },
|
97 | put: function (data, metadata) {
|
98 | var task = ref.put(data, metadata);
|
99 | return createUploadTask(task);
|
100 | },
|
101 | putString: function (data, format, metadata) {
|
102 | var task = ref.putString(data, format, metadata);
|
103 | return createUploadTask(task);
|
104 | },
|
105 | list: function (options) { return rxjs.from(ref.list(options)); },
|
106 | listAll: function () { return rxjs.from(ref.listAll()); }
|
107 | };
|
108 | }
|
109 |
|
110 | |
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 | var extendStatics = function (d, b) {
|
126 | extendStatics = Object.setPrototypeOf ||
|
127 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
128 | function (d, b) { for (var p in b)
|
129 | if (Object.prototype.hasOwnProperty.call(b, p))
|
130 | d[p] = b[p]; };
|
131 | return extendStatics(d, b);
|
132 | };
|
133 | function __extends(d, b) {
|
134 | if (typeof b !== "function" && b !== null)
|
135 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
136 | extendStatics(d, b);
|
137 | function __() { this.constructor = d; }
|
138 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
139 | }
|
140 | var __assign = function () {
|
141 | __assign = Object.assign || function __assign(t) {
|
142 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
143 | s = arguments[i];
|
144 | for (var p in s)
|
145 | if (Object.prototype.hasOwnProperty.call(s, p))
|
146 | t[p] = s[p];
|
147 | }
|
148 | return t;
|
149 | };
|
150 | return __assign.apply(this, arguments);
|
151 | };
|
152 | function __rest(s, e) {
|
153 | var t = {};
|
154 | for (var p in s)
|
155 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
156 | t[p] = s[p];
|
157 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
158 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
159 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
160 | t[p[i]] = s[p[i]];
|
161 | }
|
162 | return t;
|
163 | }
|
164 | function __decorate(decorators, target, key, desc) {
|
165 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
166 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
167 | r = Reflect.decorate(decorators, target, key, desc);
|
168 | else
|
169 | for (var i = decorators.length - 1; i >= 0; i--)
|
170 | if (d = decorators[i])
|
171 | r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
172 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
173 | }
|
174 | function __param(paramIndex, decorator) {
|
175 | return function (target, key) { decorator(target, key, paramIndex); };
|
176 | }
|
177 | function __metadata(metadataKey, metadataValue) {
|
178 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
179 | return Reflect.metadata(metadataKey, metadataValue);
|
180 | }
|
181 | function __awaiter(thisArg, _arguments, P, generator) {
|
182 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
183 | return new (P || (P = Promise))(function (resolve, reject) {
|
184 | function fulfilled(value) { try {
|
185 | step(generator.next(value));
|
186 | }
|
187 | catch (e) {
|
188 | reject(e);
|
189 | } }
|
190 | function rejected(value) { try {
|
191 | step(generator["throw"](value));
|
192 | }
|
193 | catch (e) {
|
194 | reject(e);
|
195 | } }
|
196 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
197 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
198 | });
|
199 | }
|
200 | function __generator(thisArg, body) {
|
201 | var _ = { label: 0, sent: function () { if (t[0] & 1)
|
202 | throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
203 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
204 | function verb(n) { return function (v) { return step([n, v]); }; }
|
205 | function step(op) {
|
206 | if (f)
|
207 | throw new TypeError("Generator is already executing.");
|
208 | while (_)
|
209 | try {
|
210 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
211 | return t;
|
212 | if (y = 0, t)
|
213 | op = [op[0] & 2, t.value];
|
214 | switch (op[0]) {
|
215 | case 0:
|
216 | case 1:
|
217 | t = op;
|
218 | break;
|
219 | case 4:
|
220 | _.label++;
|
221 | return { value: op[1], done: false };
|
222 | case 5:
|
223 | _.label++;
|
224 | y = op[1];
|
225 | op = [0];
|
226 | continue;
|
227 | case 7:
|
228 | op = _.ops.pop();
|
229 | _.trys.pop();
|
230 | continue;
|
231 | default:
|
232 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
233 | _ = 0;
|
234 | continue;
|
235 | }
|
236 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
237 | _.label = op[1];
|
238 | break;
|
239 | }
|
240 | if (op[0] === 6 && _.label < t[1]) {
|
241 | _.label = t[1];
|
242 | t = op;
|
243 | break;
|
244 | }
|
245 | if (t && _.label < t[2]) {
|
246 | _.label = t[2];
|
247 | _.ops.push(op);
|
248 | break;
|
249 | }
|
250 | if (t[2])
|
251 | _.ops.pop();
|
252 | _.trys.pop();
|
253 | continue;
|
254 | }
|
255 | op = body.call(thisArg, _);
|
256 | }
|
257 | catch (e) {
|
258 | op = [6, e];
|
259 | y = 0;
|
260 | }
|
261 | finally {
|
262 | f = t = 0;
|
263 | }
|
264 | if (op[0] & 5)
|
265 | throw op[1];
|
266 | return { value: op[0] ? op[1] : void 0, done: true };
|
267 | }
|
268 | }
|
269 | var __createBinding = Object.create ? (function (o, m, k, k2) {
|
270 | if (k2 === undefined)
|
271 | k2 = k;
|
272 | Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
273 | }) : (function (o, m, k, k2) {
|
274 | if (k2 === undefined)
|
275 | k2 = k;
|
276 | o[k2] = m[k];
|
277 | });
|
278 | function __exportStar(m, o) {
|
279 | for (var p in m)
|
280 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
281 | __createBinding(o, m, p);
|
282 | }
|
283 | function __values(o) {
|
284 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
285 | if (m)
|
286 | return m.call(o);
|
287 | if (o && typeof o.length === "number")
|
288 | return {
|
289 | next: function () {
|
290 | if (o && i >= o.length)
|
291 | o = void 0;
|
292 | return { value: o && o[i++], done: !o };
|
293 | }
|
294 | };
|
295 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
296 | }
|
297 | function __read(o, n) {
|
298 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
299 | if (!m)
|
300 | return o;
|
301 | var i = m.call(o), r, ar = [], e;
|
302 | try {
|
303 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
304 | ar.push(r.value);
|
305 | }
|
306 | catch (error) {
|
307 | e = { error: error };
|
308 | }
|
309 | finally {
|
310 | try {
|
311 | if (r && !r.done && (m = i["return"]))
|
312 | m.call(i);
|
313 | }
|
314 | finally {
|
315 | if (e)
|
316 | throw e.error;
|
317 | }
|
318 | }
|
319 | return ar;
|
320 | }
|
321 |
|
322 | function __spread() {
|
323 | for (var ar = [], i = 0; i < arguments.length; i++)
|
324 | ar = ar.concat(__read(arguments[i]));
|
325 | return ar;
|
326 | }
|
327 |
|
328 | function __spreadArrays() {
|
329 | for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
330 | s += arguments[i].length;
|
331 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
332 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
333 | r[k] = a[j];
|
334 | return r;
|
335 | }
|
336 | function __spreadArray(to, from) {
|
337 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
338 | to[j] = from[i];
|
339 | return to;
|
340 | }
|
341 | function __await(v) {
|
342 | return this instanceof __await ? (this.v = v, this) : new __await(v);
|
343 | }
|
344 | function __asyncGenerator(thisArg, _arguments, generator) {
|
345 | if (!Symbol.asyncIterator)
|
346 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
347 | var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
348 | return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
349 | function verb(n) { if (g[n])
|
350 | i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
351 | function resume(n, v) { try {
|
352 | step(g[n](v));
|
353 | }
|
354 | catch (e) {
|
355 | settle(q[0][3], e);
|
356 | } }
|
357 | function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
358 | function fulfill(value) { resume("next", value); }
|
359 | function reject(value) { resume("throw", value); }
|
360 | function settle(f, v) { if (f(v), q.shift(), q.length)
|
361 | resume(q[0][0], q[0][1]); }
|
362 | }
|
363 | function __asyncDelegator(o) {
|
364 | var i, p;
|
365 | return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
366 | function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
367 | }
|
368 | function __asyncValues(o) {
|
369 | if (!Symbol.asyncIterator)
|
370 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
371 | var m = o[Symbol.asyncIterator], i;
|
372 | return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
373 | function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
374 | function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
375 | }
|
376 | function __makeTemplateObject(cooked, raw) {
|
377 | if (Object.defineProperty) {
|
378 | Object.defineProperty(cooked, "raw", { value: raw });
|
379 | }
|
380 | else {
|
381 | cooked.raw = raw;
|
382 | }
|
383 | return cooked;
|
384 | }
|
385 | ;
|
386 | var __setModuleDefault = Object.create ? (function (o, v) {
|
387 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
388 | }) : function (o, v) {
|
389 | o["default"] = v;
|
390 | };
|
391 | function __importStar(mod) {
|
392 | if (mod && mod.__esModule)
|
393 | return mod;
|
394 | var result = {};
|
395 | if (mod != null)
|
396 | for (var k in mod)
|
397 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
398 | __createBinding(result, mod, k);
|
399 | __setModuleDefault(result, mod);
|
400 | return result;
|
401 | }
|
402 | function __importDefault(mod) {
|
403 | return (mod && mod.__esModule) ? mod : { default: mod };
|
404 | }
|
405 | function __classPrivateFieldGet(receiver, state, kind, f) {
|
406 | if (kind === "a" && !f)
|
407 | throw new TypeError("Private accessor was defined without a getter");
|
408 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
409 | throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
410 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
411 | }
|
412 | function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
413 | if (kind === "m")
|
414 | throw new TypeError("Private method is not writable");
|
415 | if (kind === "a" && !f)
|
416 | throw new TypeError("Private accessor was defined without a setter");
|
417 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
418 | throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
419 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
420 | }
|
421 |
|
422 | var BUCKET = new i0.InjectionToken('angularfire2.storageBucket');
|
423 | var MAX_UPLOAD_RETRY_TIME = new i0.InjectionToken('angularfire2.storage.maxUploadRetryTime');
|
424 | var MAX_OPERATION_RETRY_TIME = new i0.InjectionToken('angularfire2.storage.maxOperationRetryTime');
|
425 | var USE_EMULATOR = new i0.InjectionToken('angularfire2.storage.use-emulator');
|
426 | |
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 | var AngularFireStorage = (function () {
|
434 | function AngularFireStorage(options, name, storageBucket,
|
435 | // tslint:disable-next-line:ban-types
|
436 | platformId, zone, schedulers, maxUploadRetryTime, maxOperationRetryTime, _useEmulator, _appCheckInstances) {
|
437 | var app = compat.ɵfirebaseAppFactory(options, zone, name);
|
438 | this.storage = compat.ɵcacheInstance(app.name + ".storage." + storageBucket, 'AngularFireStorage', app.name, function () {
|
439 | var storage = zone.runOutsideAngular(function () { return app.storage(storageBucket || undefined); });
|
440 | var useEmulator = _useEmulator;
|
441 | if (useEmulator) {
|
442 | storage.useEmulator.apply(storage, __spreadArray([], __read(useEmulator)));
|
443 | }
|
444 | if (maxUploadRetryTime) {
|
445 | storage.setMaxUploadRetryTime(maxUploadRetryTime);
|
446 | }
|
447 | if (maxOperationRetryTime) {
|
448 | storage.setMaxOperationRetryTime(maxOperationRetryTime);
|
449 | }
|
450 | return storage;
|
451 | }, [maxUploadRetryTime, maxOperationRetryTime]);
|
452 | }
|
453 | AngularFireStorage.prototype.ref = function (path) {
|
454 | return createStorageRef(this.storage.ref(path));
|
455 | };
|
456 | AngularFireStorage.prototype.refFromURL = function (path) {
|
457 | return createStorageRef(this.storage.refFromURL(path));
|
458 | };
|
459 | AngularFireStorage.prototype.upload = function (path, data, metadata) {
|
460 | var storageRef = this.storage.ref(path);
|
461 | var ref = createStorageRef(storageRef);
|
462 | return ref.put(data, metadata);
|
463 | };
|
464 | return AngularFireStorage;
|
465 | }());
|
466 | AngularFireStorage.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireStorage, deps: [{ token: compat.FIREBASE_OPTIONS }, { token: compat.FIREBASE_APP_NAME, optional: true }, { token: BUCKET, optional: true }, { token: i0.PLATFORM_ID }, { token: i0__namespace.NgZone }, { token: i1__namespace.ɵAngularFireSchedulers }, { token: MAX_UPLOAD_RETRY_TIME, optional: true }, { token: MAX_OPERATION_RETRY_TIME, optional: true }, { token: USE_EMULATOR, optional: true }, { token: i2__namespace.AppCheckInstances, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
467 | AngularFireStorage.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireStorage, providedIn: 'any' });
|
468 | i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireStorage, decorators: [{
|
469 | type: i0.Injectable,
|
470 | args: [{
|
471 | providedIn: 'any'
|
472 | }]
|
473 | }], ctorParameters: function () {
|
474 | return [{ type: undefined, decorators: [{
|
475 | type: i0.Inject,
|
476 | args: [compat.FIREBASE_OPTIONS]
|
477 | }] }, { type: undefined, decorators: [{
|
478 | type: i0.Optional
|
479 | }, {
|
480 | type: i0.Inject,
|
481 | args: [compat.FIREBASE_APP_NAME]
|
482 | }] }, { type: undefined, decorators: [{
|
483 | type: i0.Optional
|
484 | }, {
|
485 | type: i0.Inject,
|
486 | args: [BUCKET]
|
487 | }] }, { type: Object, decorators: [{
|
488 | type: i0.Inject,
|
489 | args: [i0.PLATFORM_ID]
|
490 | }] }, { type: i0__namespace.NgZone }, { type: i1__namespace.ɵAngularFireSchedulers }, { type: undefined, decorators: [{
|
491 | type: i0.Optional
|
492 | }, {
|
493 | type: i0.Inject,
|
494 | args: [MAX_UPLOAD_RETRY_TIME]
|
495 | }] }, { type: undefined, decorators: [{
|
496 | type: i0.Optional
|
497 | }, {
|
498 | type: i0.Inject,
|
499 | args: [MAX_OPERATION_RETRY_TIME]
|
500 | }] }, { type: undefined, decorators: [{
|
501 | type: i0.Optional
|
502 | }, {
|
503 | type: i0.Inject,
|
504 | args: [USE_EMULATOR]
|
505 | }] }, { type: i2__namespace.AppCheckInstances, decorators: [{
|
506 | type: i0.Optional
|
507 | }] }];
|
508 | } });
|
509 |
|
510 |
|
511 | var GetDownloadURLPipe = (function () {
|
512 | function GetDownloadURLPipe(storage, cdr, state) {
|
513 | this.storage = storage;
|
514 | this.state = state;
|
515 | this.asyncPipe = new common.AsyncPipe(cdr);
|
516 | }
|
517 | GetDownloadURLPipe.prototype.transform = function (path) {
|
518 | var _this = this;
|
519 | var _a;
|
520 | if (path !== this.path) {
|
521 | this.path = path;
|
522 | var key_1 = i2$1.makeStateKey("|getDownloadURL|" + path);
|
523 | var existing = (_a = this.state) === null || _a === void 0 ? void 0 : _a.get(key_1, undefined);
|
524 | this.downloadUrl$ = existing ? rxjs.of(existing) : this.storage.ref(path).getDownloadURL().pipe(operators.tap(function (it) { var _a; return (_a = _this.state) === null || _a === void 0 ? void 0 : _a.set(key_1, it); }));
|
525 | }
|
526 | return this.asyncPipe.transform(this.downloadUrl$);
|
527 | };
|
528 | GetDownloadURLPipe.prototype.ngOnDestroy = function () {
|
529 | this.asyncPipe.ngOnDestroy();
|
530 | };
|
531 | return GetDownloadURLPipe;
|
532 | }());
|
533 | GetDownloadURLPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: GetDownloadURLPipe, deps: [{ token: AngularFireStorage }, { token: i0__namespace.ChangeDetectorRef }, { token: i2__namespace$1.TransferState, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
534 | GetDownloadURLPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: GetDownloadURLPipe, name: "getDownloadURL", pure: false });
|
535 | i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: GetDownloadURLPipe, decorators: [{
|
536 | type: i0.Pipe,
|
537 | args: [{
|
538 | name: 'getDownloadURL',
|
539 | pure: false,
|
540 | }]
|
541 | }], ctorParameters: function () {
|
542 | return [{ type: AngularFireStorage }, { type: i0__namespace.ChangeDetectorRef }, { type: i2__namespace$1.TransferState, decorators: [{
|
543 | type: i0.Optional
|
544 | }] }];
|
545 | } });
|
546 | var GetDownloadURLPipeModule = (function () {
|
547 | function GetDownloadURLPipeModule() {
|
548 | }
|
549 | return GetDownloadURLPipeModule;
|
550 | }());
|
551 | GetDownloadURLPipeModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: GetDownloadURLPipeModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
552 | GetDownloadURLPipeModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: GetDownloadURLPipeModule, declarations: [GetDownloadURLPipe], exports: [GetDownloadURLPipe] });
|
553 | GetDownloadURLPipeModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: GetDownloadURLPipeModule });
|
554 | i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: GetDownloadURLPipeModule, decorators: [{
|
555 | type: i0.NgModule,
|
556 | args: [{
|
557 | declarations: [GetDownloadURLPipe],
|
558 | exports: [GetDownloadURLPipe],
|
559 | }]
|
560 | }] });
|
561 |
|
562 | var AngularFireStorageModule = (function () {
|
563 | function AngularFireStorageModule() {
|
564 | firebase__default['default'].registerVersion('angularfire', i1.VERSION.full, 'gcs-compat');
|
565 | }
|
566 | return AngularFireStorageModule;
|
567 | }());
|
568 | AngularFireStorageModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireStorageModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
569 | AngularFireStorageModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireStorageModule, exports: [GetDownloadURLPipeModule] });
|
570 | AngularFireStorageModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireStorageModule, providers: [AngularFireStorage], imports: [GetDownloadURLPipeModule] });
|
571 | i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireStorageModule, decorators: [{
|
572 | type: i0.NgModule,
|
573 | args: [{
|
574 | exports: [GetDownloadURLPipeModule],
|
575 | providers: [AngularFireStorage]
|
576 | }]
|
577 | }], ctorParameters: function () { return []; } });
|
578 |
|
579 | |
580 |
|
581 |
|
582 |
|
583 | exports.AngularFireStorage = AngularFireStorage;
|
584 | exports.AngularFireStorageModule = AngularFireStorageModule;
|
585 | exports.BUCKET = BUCKET;
|
586 | exports.GetDownloadURLPipe = GetDownloadURLPipe;
|
587 | exports.GetDownloadURLPipeModule = GetDownloadURLPipeModule;
|
588 | exports.MAX_OPERATION_RETRY_TIME = MAX_OPERATION_RETRY_TIME;
|
589 | exports.MAX_UPLOAD_RETRY_TIME = MAX_UPLOAD_RETRY_TIME;
|
590 | exports.USE_EMULATOR = USE_EMULATOR;
|
591 | exports.createStorageRef = createStorageRef;
|
592 | exports.createUploadTask = createUploadTask;
|
593 | exports.fromTask = fromTask;
|
594 |
|
595 | Object.defineProperty(exports, '__esModule', { value: true });
|
596 |
|
597 | })));
|
598 |
|