119 lines
5.4 KiB
JavaScript
119 lines
5.4 KiB
JavaScript
import { ɵgetAllInstancesOf, ɵgetDefaultInstanceOf, VERSION, ɵAngularFireSchedulers, ɵzoneWrap } from '@angular/fire';
|
|
import { timer, from } from 'rxjs';
|
|
import { concatMap, distinct } from 'rxjs/operators';
|
|
import * as i0 from '@angular/core';
|
|
import { InjectionToken, Optional, NgModule, NgZone, Injector } from '@angular/core';
|
|
import { FirebaseApp, FirebaseApps } from '@angular/fire/app';
|
|
import { AuthInstances } from '@angular/fire/auth';
|
|
import { registerVersion } from 'firebase/app';
|
|
import { AppCheckInstances } from '@angular/fire/app-check';
|
|
import { fromTask as fromTask$1, percentage as percentage$1 } from 'rxfire/storage';
|
|
import { connectStorageEmulator as connectStorageEmulator$1, deleteObject as deleteObject$1, getBlob as getBlob$1, getBytes as getBytes$1, getDownloadURL as getDownloadURL$1, getMetadata as getMetadata$1, getStorage as getStorage$1, getStream as getStream$1, list as list$1, listAll as listAll$1, ref as ref$1, updateMetadata as updateMetadata$1, uploadBytes as uploadBytes$1, uploadBytesResumable as uploadBytesResumable$1, uploadString as uploadString$1 } from 'firebase/storage';
|
|
export * from 'firebase/storage';
|
|
|
|
class Storage {
|
|
constructor(auth) {
|
|
return auth;
|
|
}
|
|
}
|
|
const STORAGE_PROVIDER_NAME = 'storage';
|
|
class StorageInstances {
|
|
constructor() {
|
|
return ɵgetAllInstancesOf(STORAGE_PROVIDER_NAME);
|
|
}
|
|
}
|
|
const storageInstance$ = timer(0, 300).pipe(concatMap(() => from(ɵgetAllInstancesOf(STORAGE_PROVIDER_NAME))), distinct());
|
|
|
|
const PROVIDED_STORAGE_INSTANCES = new InjectionToken('angularfire2.storage-instances');
|
|
function defaultStorageInstanceFactory(provided, defaultApp) {
|
|
const defaultStorage = ɵgetDefaultInstanceOf(STORAGE_PROVIDER_NAME, provided, defaultApp);
|
|
return defaultStorage && new Storage(defaultStorage);
|
|
}
|
|
function storageInstanceFactory(fn) {
|
|
return (zone, injector) => {
|
|
const storage = zone.runOutsideAngular(() => fn(injector));
|
|
return new Storage(storage);
|
|
};
|
|
}
|
|
const STORAGE_INSTANCES_PROVIDER = {
|
|
provide: StorageInstances,
|
|
deps: [
|
|
[new Optional(), PROVIDED_STORAGE_INSTANCES],
|
|
]
|
|
};
|
|
const DEFAULT_STORAGE_INSTANCE_PROVIDER = {
|
|
provide: Storage,
|
|
useFactory: defaultStorageInstanceFactory,
|
|
deps: [
|
|
[new Optional(), PROVIDED_STORAGE_INSTANCES],
|
|
FirebaseApp,
|
|
]
|
|
};
|
|
class StorageModule {
|
|
constructor() {
|
|
registerVersion('angularfire', VERSION.full, 'gcs');
|
|
}
|
|
}
|
|
StorageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: StorageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
StorageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: StorageModule });
|
|
StorageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: StorageModule, providers: [
|
|
DEFAULT_STORAGE_INSTANCE_PROVIDER,
|
|
STORAGE_INSTANCES_PROVIDER,
|
|
] });
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: StorageModule, decorators: [{
|
|
type: NgModule,
|
|
args: [{
|
|
providers: [
|
|
DEFAULT_STORAGE_INSTANCE_PROVIDER,
|
|
STORAGE_INSTANCES_PROVIDER,
|
|
]
|
|
}]
|
|
}], ctorParameters: function () { return []; } });
|
|
function provideStorage(fn, ...deps) {
|
|
return {
|
|
ngModule: StorageModule,
|
|
providers: [{
|
|
provide: PROVIDED_STORAGE_INSTANCES,
|
|
useFactory: storageInstanceFactory(fn),
|
|
multi: true,
|
|
deps: [
|
|
NgZone,
|
|
Injector,
|
|
ɵAngularFireSchedulers,
|
|
FirebaseApps,
|
|
// Defensively load Auth first, if provided
|
|
[new Optional(), AuthInstances],
|
|
[new Optional(), AppCheckInstances],
|
|
...deps,
|
|
]
|
|
}]
|
|
};
|
|
}
|
|
|
|
// DO NOT MODIFY, this file is autogenerated by tools/build.ts
|
|
const fromTask = ɵzoneWrap(fromTask$1, true);
|
|
const percentage = ɵzoneWrap(percentage$1, true);
|
|
|
|
// DO NOT MODIFY, this file is autogenerated by tools/build.ts
|
|
const connectStorageEmulator = ɵzoneWrap(connectStorageEmulator$1, true);
|
|
const deleteObject = ɵzoneWrap(deleteObject$1, true);
|
|
const getBlob = ɵzoneWrap(getBlob$1, true);
|
|
const getBytes = ɵzoneWrap(getBytes$1, true);
|
|
const getDownloadURL = ɵzoneWrap(getDownloadURL$1, true);
|
|
const getMetadata = ɵzoneWrap(getMetadata$1, true);
|
|
const getStorage = ɵzoneWrap(getStorage$1, true);
|
|
const getStream = ɵzoneWrap(getStream$1, true);
|
|
const list = ɵzoneWrap(list$1, true);
|
|
const listAll = ɵzoneWrap(listAll$1, true);
|
|
const ref = ɵzoneWrap(ref$1, true);
|
|
const updateMetadata = ɵzoneWrap(updateMetadata$1, true);
|
|
const uploadBytes = ɵzoneWrap(uploadBytes$1, true);
|
|
const uploadBytesResumable = ɵzoneWrap(uploadBytesResumable$1, true);
|
|
const uploadString = ɵzoneWrap(uploadString$1, true);
|
|
|
|
/**
|
|
* Generated bundle index. Do not edit.
|
|
*/
|
|
|
|
export { Storage, StorageInstances, StorageModule, connectStorageEmulator, deleteObject, fromTask, getBlob, getBytes, getDownloadURL, getMetadata, getStorage, getStream, list, listAll, percentage, provideStorage, ref, storageInstance$, updateMetadata, uploadBytes, uploadBytesResumable, uploadString };
|
|
//# sourceMappingURL=angular-fire-storage.js.map
|