@angular/fire 18.0.0 → 18.0.1-canary.3639e41

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 (96) hide show
  1. package/esm2022/analytics/analytics.module.mjs +5 -5
  2. package/esm2022/analytics/screen-tracking.service.mjs +4 -4
  3. package/esm2022/analytics/user-tracking.service.mjs +4 -4
  4. package/esm2022/app/app.module.mjs +5 -5
  5. package/esm2022/app-check/app-check.module.mjs +5 -5
  6. package/esm2022/auth/auth.module.mjs +5 -5
  7. package/esm2022/auth-guard/auth-guard.mjs +4 -4
  8. package/esm2022/auth-guard/auth-guard.module.mjs +5 -5
  9. package/esm2022/compat/analytics/analytics.mjs +4 -4
  10. package/esm2022/compat/analytics/analytics.module.mjs +5 -5
  11. package/esm2022/compat/analytics/screen-tracking.service.mjs +4 -4
  12. package/esm2022/compat/analytics/user-tracking.service.mjs +4 -4
  13. package/esm2022/compat/auth/auth.mjs +4 -4
  14. package/esm2022/compat/auth/auth.module.mjs +5 -5
  15. package/esm2022/compat/auth-guard/auth-guard.mjs +4 -4
  16. package/esm2022/compat/auth-guard/auth-guard.module.mjs +5 -5
  17. package/esm2022/compat/database/database.mjs +4 -4
  18. package/esm2022/compat/database/database.module.mjs +5 -5
  19. package/esm2022/compat/firebase.app.module.mjs +5 -5
  20. package/esm2022/compat/firestore/firestore.mjs +4 -4
  21. package/esm2022/compat/firestore/firestore.module.mjs +5 -5
  22. package/esm2022/compat/functions/functions.mjs +4 -4
  23. package/esm2022/compat/functions/functions.module.mjs +5 -5
  24. package/esm2022/compat/messaging/messaging.mjs +4 -4
  25. package/esm2022/compat/messaging/messaging.module.mjs +5 -5
  26. package/esm2022/compat/performance/performance.mjs +4 -4
  27. package/esm2022/compat/performance/performance.module.mjs +5 -5
  28. package/esm2022/compat/performance/performance.service.mjs +4 -4
  29. package/esm2022/compat/remote-config/remote-config.mjs +4 -4
  30. package/esm2022/compat/remote-config/remote-config.module.mjs +5 -5
  31. package/esm2022/compat/storage/pipes/storageUrl.pipe.mjs +8 -8
  32. package/esm2022/compat/storage/storage.mjs +4 -4
  33. package/esm2022/compat/storage/storage.module.mjs +5 -5
  34. package/esm2022/database/database.module.mjs +5 -5
  35. package/esm2022/firestore/firestore.module.mjs +5 -5
  36. package/esm2022/firestore/lite/lite.module.mjs +5 -5
  37. package/esm2022/functions/functions.module.mjs +5 -5
  38. package/esm2022/messaging/messaging.module.mjs +5 -5
  39. package/esm2022/performance/performance.module.mjs +5 -5
  40. package/esm2022/remote-config/remote-config.module.mjs +5 -5
  41. package/esm2022/storage/storage.module.mjs +5 -5
  42. package/esm2022/vertexai-preview/vertexai.module.mjs +5 -5
  43. package/esm2022/zones.mjs +4 -4
  44. package/fesm2022/angular-fire-analytics.mjs +297 -410
  45. package/fesm2022/angular-fire-analytics.mjs.map +1 -7
  46. package/fesm2022/angular-fire-app-check.mjs +91 -162
  47. package/fesm2022/angular-fire-app-check.mjs.map +1 -7
  48. package/fesm2022/angular-fire-app.mjs +108 -181
  49. package/fesm2022/angular-fire-app.mjs.map +1 -7
  50. package/fesm2022/angular-fire-auth-guard.mjs +73 -83
  51. package/fesm2022/angular-fire-auth-guard.mjs.map +1 -7
  52. package/fesm2022/angular-fire-auth.mjs +142 -421
  53. package/fesm2022/angular-fire-auth.mjs.map +1 -7
  54. package/fesm2022/angular-fire-compat-analytics.mjs +271 -262
  55. package/fesm2022/angular-fire-compat-analytics.mjs.map +1 -7
  56. package/fesm2022/angular-fire-compat-auth-guard.mjs +72 -83
  57. package/fesm2022/angular-fire-compat-auth-guard.mjs.map +1 -7
  58. package/fesm2022/angular-fire-compat-auth.mjs +214 -215
  59. package/fesm2022/angular-fire-compat-auth.mjs.map +1 -7
  60. package/fesm2022/angular-fire-compat-database.mjs +378 -375
  61. package/fesm2022/angular-fire-compat-database.mjs.map +1 -7
  62. package/fesm2022/angular-fire-compat-firestore.mjs +677 -537
  63. package/fesm2022/angular-fire-compat-firestore.mjs.map +1 -7
  64. package/fesm2022/angular-fire-compat-functions.mjs +94 -98
  65. package/fesm2022/angular-fire-compat-functions.mjs.map +1 -7
  66. package/fesm2022/angular-fire-compat-messaging.mjs +107 -107
  67. package/fesm2022/angular-fire-compat-messaging.mjs.map +1 -7
  68. package/fesm2022/angular-fire-compat-performance.mjs +152 -158
  69. package/fesm2022/angular-fire-compat-performance.mjs.map +1 -7
  70. package/fesm2022/angular-fire-compat-remote-config.mjs +232 -216
  71. package/fesm2022/angular-fire-compat-remote-config.mjs.map +1 -7
  72. package/fesm2022/angular-fire-compat-storage.mjs +231 -226
  73. package/fesm2022/angular-fire-compat-storage.mjs.map +1 -7
  74. package/fesm2022/angular-fire-compat.mjs +153 -140
  75. package/fesm2022/angular-fire-compat.mjs.map +1 -7
  76. package/fesm2022/angular-fire-database.mjs +136 -376
  77. package/fesm2022/angular-fire-database.mjs.map +1 -7
  78. package/fesm2022/angular-fire-firestore-lite.mjs +139 -388
  79. package/fesm2022/angular-fire-firestore-lite.mjs.map +1 -7
  80. package/fesm2022/angular-fire-firestore.mjs +167 -526
  81. package/fesm2022/angular-fire-firestore.mjs.map +1 -7
  82. package/fesm2022/angular-fire-functions.mjs +93 -166
  83. package/fesm2022/angular-fire-functions.mjs.map +1 -7
  84. package/fesm2022/angular-fire-messaging.mjs +118 -196
  85. package/fesm2022/angular-fire-messaging.mjs.map +1 -7
  86. package/fesm2022/angular-fire-performance.mjs +104 -178
  87. package/fesm2022/angular-fire-performance.mjs.map +1 -7
  88. package/fesm2022/angular-fire-remote-config.mjs +132 -254
  89. package/fesm2022/angular-fire-remote-config.mjs.map +1 -7
  90. package/fesm2022/angular-fire-storage.mjs +105 -225
  91. package/fesm2022/angular-fire-storage.mjs.map +1 -7
  92. package/fesm2022/angular-fire-vertexai-preview.mjs +85 -146
  93. package/fesm2022/angular-fire-vertexai-preview.mjs.map +1 -7
  94. package/fesm2022/angular-fire.mjs +213 -183
  95. package/fesm2022/angular-fire.mjs.map +1 -7
  96. package/package.json +1 -1
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/compat/remote-config/base.ts", "../../../src/compat/remote-config/remote-config.ts", "../../../src/compat/remote-config/remote-config.module.ts"],
4
- "sourcesContent": ["// DO NOT MODIFY, this file is autogenerated by tools/build.ts\n// Export a null object with the same keys as firebase/compat/remote-config, so Proxy can work with proxy-polyfill in Internet Explorer\nexport const proxyPolyfillCompat = {\n app: null,\n settings: null,\n defaultConfig: null,\n fetchTimeMillis: null,\n lastFetchStatus: null,\n activate: null,\n ensureInitialized: null,\n fetch: null,\n fetchAndActivate: null,\n getAll: null,\n getBoolean: null,\n getNumber: null,\n getString: null,\n getValue: null,\n setLogLevel: null,\n};\n", "import { Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID } from '@angular/core';\nimport { keepUnstableUntilFirst, ɵAngularFireSchedulers } from '@angular/fire';\nimport { ɵPromiseProxy, ɵapplyMixins, ɵlazySDKProxy } from '@angular/fire/compat';\nimport { FIREBASE_APP_NAME, FIREBASE_OPTIONS, ɵcacheInstance, ɵfirebaseAppFactory } from '@angular/fire/compat';\nimport { FirebaseOptions } from 'firebase/app';\nimport firebase from 'firebase/compat/app';\nimport { isSupported } from 'firebase/remote-config';\nimport { EMPTY, MonoTypeOperatorFunction, Observable, OperatorFunction, concat, of, pipe } from 'rxjs';\nimport {\n debounceTime,\n distinctUntilChanged,\n filter,\n groupBy,\n map,\n mergeMap,\n observeOn,\n scan,\n shareReplay,\n startWith,\n switchMap,\n withLatestFrom\n} from 'rxjs/operators';\nimport { proxyPolyfillCompat } from './base';\nimport { Settings } from './interfaces';\n\nexport type ConfigTemplate = Record<string, string | number | boolean>;\n\nexport const SETTINGS = new InjectionToken<Settings>('angularfire2.remoteConfig.settings');\nexport const DEFAULTS = new InjectionToken<ConfigTemplate>('angularfire2.remoteConfig.defaultConfig');\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface AngularFireRemoteConfig extends ɵPromiseProxy<firebase.remoteConfig.RemoteConfig> {\n}\n\nconst AS_TO_FN = { strings: 'asString', numbers: 'asNumber', booleans: 'asBoolean' };\nconst STATIC_VALUES = { numbers: 0, booleans: false, strings: undefined };\n\n// TODO look into the types here, I don't like the anys\nconst proxyAll = (observable: Observable<Parameter[]>, as: 'numbers' | 'booleans' | 'strings') => new Proxy(\n observable.pipe(mapToObject(as as any)), {\n get: (self, name: string) => self[name] || observable.pipe(\n map(all => all.find(p => p.key === name)),\n map(param => param ? param[AS_TO_FN[as]]() : STATIC_VALUES[as]),\n distinctUntilChanged()\n )\n }\n) as any;\n\n// TODO export as implements Partial<...> so minor doesn't break us\nexport class Value implements firebase.remoteConfig.Value {\n asBoolean() {\n return ['1', 'true', 't', 'y', 'yes', 'on'].indexOf(this._value.toLowerCase()) > -1;\n }\n\n asString() {\n return this._value;\n }\n\n asNumber() {\n return Number(this._value) || 0;\n }\n\n getSource() {\n return this._source;\n }\n\n constructor(public _source: firebase.remoteConfig.ValueSource, public _value: string) {\n }\n}\n\n// SEMVER use ConstructorParameters when we can support Typescript 3.6\nexport class Parameter extends Value {\n constructor(public key: string, public fetchTimeMillis: number, source: firebase.remoteConfig.ValueSource, value: string) {\n super(source, value);\n }\n}\n\n// If it's a Parameter array, test any, else test the individual Parameter\nconst filterTest = (fn: (param: Parameter) => boolean) => filter<Parameter | Parameter[]>(it => Array.isArray(it) ? it.some(fn) : fn(it));\n\n// Allow the user to bypass the default values and wait till they get something from the server, even if it's a cached copy;\n// if used in conjuntion with first() it will only fetch RC values from the server if they aren't cached locally\nexport const filterRemote = () => filterTest(p => p.getSource() === 'remote');\n\n// filterFresh allows the developer to effectively set up a maximum cache time\nexport const filterFresh = (howRecentInMillis: number) => filterTest(p => p.fetchTimeMillis + howRecentInMillis >= new Date().getTime());\n\n\n// I ditched loading the defaults into RC and a simple map for scan since we already have our own defaults implementation.\n// The idea here being that if they have a default that never loads from the server, they will be able to tell via fetchTimeMillis\n// on the Parameter. Also if it doesn't come from the server it won't emit again in .changes, due to the distinctUntilChanged,\n// which we can simplify to === rather than deep comparison\nconst scanToParametersArray = (\n remoteConfig: Observable<firebase.remoteConfig.RemoteConfig | undefined>\n): OperatorFunction<Record<string, firebase.remoteConfig.Value>, Parameter[]> => pipe(\n withLatestFrom(remoteConfig),\n scan((existing, [all, rc]) => {\n // SEMVER use \"new Set\" to unique once we're only targeting es6\n // at the scale we expect remote config to be at, we probably won't see a performance hit from this unoptimized uniqueness\n // implementation.\n // const allKeys = [...new Set([...existing.map(p => p.key), ...Object.keys(all)])];\n const allKeys = [...existing.map(p => p.key), ...Object.keys(all)].filter((v, i, a) => a.indexOf(v) === i);\n return allKeys.map(key => {\n const updatedValue = all[key];\n return updatedValue ? new Parameter(key, rc ? rc.fetchTimeMillis : -1, updatedValue.getSource(), updatedValue.asString())\n : existing.find(p => p.key === key);\n });\n }, [] as Parameter[])\n);\n\n\n@Injectable({\n providedIn: 'any'\n})\nexport class AngularFireRemoteConfig {\n\n readonly changes: Observable<Parameter>;\n readonly parameters: Observable<Parameter[]>;\n readonly numbers: Observable<Record<string, number | undefined>> & Record<string, Observable<number>>;\n readonly booleans: Observable<Record<string, boolean | undefined>> & Record<string, Observable<boolean>>;\n readonly strings: Observable<Record<string, string | undefined>> & Record<string, Observable<string | undefined>>;\n\n constructor(\n @Inject(FIREBASE_OPTIONS) options: FirebaseOptions,\n @Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,\n @Optional() @Inject(SETTINGS) settings: Settings | null,\n @Optional() @Inject(DEFAULTS) defaultConfig: ConfigTemplate | null,\n private zone: NgZone,\n schedulers: ɵAngularFireSchedulers,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/ban-types\n @Inject(PLATFORM_ID) platformId: Object\n ) {\n const remoteConfig$ = of(undefined).pipe(\n observeOn(schedulers.outsideAngular),\n switchMap(() => isSupported()),\n switchMap(isSupported => isSupported ? import('firebase/compat/remote-config') : EMPTY),\n map(() => ɵfirebaseAppFactory(options, zone, name)),\n map(app => ɵcacheInstance(`${app.name}.remote-config`, 'AngularFireRemoteConfig', app.name, () => {\n const rc = app.remoteConfig();\n if (settings) {\n rc.settings = settings;\n }\n if (defaultConfig) {\n rc.defaultConfig = defaultConfig;\n }\n return rc;\n }, [settings, defaultConfig])),\n startWith<firebase.remoteConfig.RemoteConfig, undefined>(undefined),\n shareReplay({ bufferSize: 1, refCount: false })\n ) as Observable<any>;\n\n const loadedRemoteConfig$ = remoteConfig$.pipe(\n filter<firebase.remoteConfig.RemoteConfig>(rc => !!rc)\n );\n\n const default$: Observable<Record<string, firebase.remoteConfig.Value>> = of(Object.keys(defaultConfig || {}).reduce(\n (c, k) => ({ ...c, [k]: new Value('default', defaultConfig[k].toString()) }), {}\n ));\n\n // we should filter out the defaults we provided to RC, since we have our own implementation\n // that gives us a -1 for fetchTimeMillis (so filterFresh can filter them out)\n const filterOutDefaults = map<Record<string, firebase.remoteConfig.Value>, Record<string, firebase.remoteConfig.Value>>(all =>\n Object.keys(all)\n .filter(key => all[key].getSource() !== 'default')\n .reduce((acc, key) => ({ ...acc, [key]: all[key] }), {})\n );\n\n const existing$ = loadedRemoteConfig$.pipe(\n switchMap(rc =>\n rc.activate()\n .then(() => rc.ensureInitialized())\n .then(() => rc.getAll())\n ),\n filterOutDefaults\n );\n\n const fresh$ = loadedRemoteConfig$.pipe(\n switchMap(rc => zone.runOutsideAngular(() =>\n rc.fetchAndActivate()\n .then(() => rc.ensureInitialized())\n .then(() => rc.getAll())\n )),\n filterOutDefaults\n );\n\n this.parameters = concat(default$, existing$, fresh$).pipe(\n scanToParametersArray(remoteConfig$),\n keepUnstableUntilFirst,\n shareReplay({ bufferSize: 1, refCount: true })\n );\n\n this.changes = this.parameters.pipe(\n switchMap(params => of(...params)),\n groupBy(param => param.key),\n mergeMap(group => group.pipe(\n distinctUntilChanged()\n ))\n );\n\n this.strings = proxyAll(this.parameters, 'strings');\n this.booleans = proxyAll(this.parameters, 'booleans');\n this.numbers = proxyAll(this.parameters, 'numbers');\n\n return ɵlazySDKProxy(this, loadedRemoteConfig$, zone);\n }\n\n}\n\n\nexport const budget = <T>(interval: number): MonoTypeOperatorFunction<T> => (source: Observable<T>) => new Observable<T>(observer => {\n let timedOut = false;\n // TODO use scheduler task rather than settimeout\n const timeout = setTimeout(() => {\n observer.complete();\n timedOut = true;\n }, interval);\n return source.subscribe({\n next(val) {\n if (!timedOut) {\n observer.next(val);\n }\n },\n error(err) {\n if (!timedOut) {\n clearTimeout(timeout);\n observer.error(err);\n }\n },\n complete() {\n if (!timedOut) {\n clearTimeout(timeout);\n observer.complete();\n }\n }\n });\n});\n\nconst typedMethod = (it: any) => {\n switch (typeof it) {\n case 'string':\n return 'asString';\n case 'boolean':\n return 'asBoolean';\n case 'number':\n return 'asNumber';\n default:\n return 'asString';\n }\n};\n\n\nexport function scanToObject(): OperatorFunction<Parameter, Record<string, string | undefined>>;\nexport function scanToObject(to: 'numbers'): OperatorFunction<Parameter, Record<string, number | undefined>>;\nexport function scanToObject(to: 'booleans'): OperatorFunction<Parameter, Record<string, boolean | undefined>>;\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function scanToObject(to: 'strings'): OperatorFunction<Parameter, Record<string, string | undefined>>;\nexport function scanToObject<T extends ConfigTemplate>(template: T): OperatorFunction<Parameter, T & Record<string, string | undefined>>;\nexport function scanToObject<T extends ConfigTemplate>(to: 'numbers' | 'booleans' | 'strings' | T = 'strings') {\n return pipe(\n // TODO cleanup\n scan(\n (c, p: Parameter) => ({\n ...c, [p.key]: typeof to === 'object' ?\n p[typedMethod(to[p.key])]() :\n p[AS_TO_FN[to]]()\n }),\n typeof to === 'object' ?\n to as T & Record<string, string | undefined> :\n {} as Record<string, number | boolean | string>\n ),\n debounceTime(1),\n budget(10),\n distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b))\n );\n}\n\nexport function mapToObject(): OperatorFunction<Parameter[], Record<string, string | undefined>>;\nexport function mapToObject(to: 'numbers'): OperatorFunction<Parameter[], Record<string, number | undefined>>;\nexport function mapToObject(to: 'booleans'): OperatorFunction<Parameter[], Record<string, boolean | undefined>>;\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function mapToObject(to: 'strings'): OperatorFunction<Parameter[], Record<string, string | undefined>>;\nexport function mapToObject<T extends ConfigTemplate>(template: T):\n OperatorFunction<Parameter[], T & Record<string, string | undefined>>;\nexport function mapToObject<T extends ConfigTemplate>(to: 'numbers' | 'booleans' | 'strings' | T = 'strings') {\n return pipe(\n // TODO this is getting a little long, cleanup\n map((params: Parameter[]) => params.reduce(\n (c, p) => ({\n ...c, [p.key]: typeof to === 'object' ?\n p[typedMethod(to[p.key])]() :\n p[AS_TO_FN[to]]()\n }),\n typeof to === 'object' ?\n to as T & Record<string, string | undefined> :\n {} as Record<string, number | boolean | string>\n )),\n distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b))\n );\n}\n\nɵapplyMixins(AngularFireRemoteConfig, [proxyPolyfillCompat]);\n", "import { NgModule } from '@angular/core';\nimport { VERSION } from '@angular/fire';\nimport firebase from 'firebase/compat/app';\nimport { AngularFireRemoteConfig } from './remote-config';\n\n@NgModule({\n providers: [ AngularFireRemoteConfig ]\n})\nexport class AngularFireRemoteConfigModule {\n constructor() {\n firebase.registerVersion('angularfire', VERSION.full, 'rc-compat');\n }\n}\n"],
5
- "mappings": ";AAEO,IAAM,sBAAsB;EACjC,KAAK;EACL,UAAU;EACV,eAAe;EACf,iBAAiB;EACjB,iBAAiB;EACjB,UAAU;EACV,mBAAmB;EACnB,OAAO;EACP,kBAAkB;EAClB,QAAQ;EACR,YAAY;EACZ,WAAW;EACX,WAAW;EACX,UAAU;EACV,aAAa;;;;ACjBf,SAAS,QAAQ,YAAY,gBAAgB,QAAQ,UAAU,mBAAmB;AAClF,SAAS,wBAAwB,8BAA8B;AAC/D,SAAwB,cAAc,qBAAqB;AAC3D,SAAS,mBAAmB,kBAAkB,gBAAgB,2BAA2B;AAGzF,SAAS,mBA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,CAAE,uBAAuB;GACrC;;",
6
- "names": ["isSupported"]
7
- }
1
+ {"version":3,"file":"angular-fire-compat-remote-config.mjs","sources":["../../../src/compat/remote-config/base.ts","../../../src/compat/remote-config/remote-config.ts","../../../src/compat/remote-config/remote-config.module.ts","../../../src/compat/remote-config/angular-fire-compat-remote-config.ts"],"sourcesContent":["// DO NOT MODIFY, this file is autogenerated by tools/build.ts\n// Export a null object with the same keys as firebase/compat/remote-config, so Proxy can work with proxy-polyfill in Internet Explorer\nexport const proxyPolyfillCompat = {\n app: null,\n settings: null,\n defaultConfig: null,\n fetchTimeMillis: null,\n lastFetchStatus: null,\n activate: null,\n ensureInitialized: null,\n fetch: null,\n fetchAndActivate: null,\n getAll: null,\n getBoolean: null,\n getNumber: null,\n getString: null,\n getValue: null,\n setLogLevel: null,\n};\n","import { Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID } from '@angular/core';\nimport { keepUnstableUntilFirst, ɵAngularFireSchedulers } from '@angular/fire';\nimport { ɵPromiseProxy, ɵapplyMixins, ɵlazySDKProxy } from '@angular/fire/compat';\nimport { FIREBASE_APP_NAME, FIREBASE_OPTIONS, ɵcacheInstance, ɵfirebaseAppFactory } from '@angular/fire/compat';\nimport { FirebaseOptions } from 'firebase/app';\nimport firebase from 'firebase/compat/app';\nimport { isSupported } from 'firebase/remote-config';\nimport { EMPTY, MonoTypeOperatorFunction, Observable, OperatorFunction, concat, of, pipe } from 'rxjs';\nimport {\n debounceTime,\n distinctUntilChanged,\n filter,\n groupBy,\n map,\n mergeMap,\n observeOn,\n scan,\n shareReplay,\n startWith,\n switchMap,\n withLatestFrom\n} from 'rxjs/operators';\nimport { proxyPolyfillCompat } from './base';\nimport { Settings } from './interfaces';\n\nexport type ConfigTemplate = Record<string, string | number | boolean>;\n\nexport const SETTINGS = new InjectionToken<Settings>('angularfire2.remoteConfig.settings');\nexport const DEFAULTS = new InjectionToken<ConfigTemplate>('angularfire2.remoteConfig.defaultConfig');\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface AngularFireRemoteConfig extends ɵPromiseProxy<firebase.remoteConfig.RemoteConfig> {\n}\n\nconst AS_TO_FN = { strings: 'asString', numbers: 'asNumber', booleans: 'asBoolean' };\nconst STATIC_VALUES = { numbers: 0, booleans: false, strings: undefined };\n\n// TODO look into the types here, I don't like the anys\nconst proxyAll = (observable: Observable<Parameter[]>, as: 'numbers' | 'booleans' | 'strings') => new Proxy(\n observable.pipe(mapToObject(as as any)), {\n get: (self, name: string) => self[name] || observable.pipe(\n map(all => all.find(p => p.key === name)),\n map(param => param ? param[AS_TO_FN[as]]() : STATIC_VALUES[as]),\n distinctUntilChanged()\n )\n }\n) as any;\n\n// TODO export as implements Partial<...> so minor doesn't break us\nexport class Value implements firebase.remoteConfig.Value {\n asBoolean() {\n return ['1', 'true', 't', 'y', 'yes', 'on'].indexOf(this._value.toLowerCase()) > -1;\n }\n\n asString() {\n return this._value;\n }\n\n asNumber() {\n return Number(this._value) || 0;\n }\n\n getSource() {\n return this._source;\n }\n\n constructor(public _source: firebase.remoteConfig.ValueSource, public _value: string) {\n }\n}\n\n// SEMVER use ConstructorParameters when we can support Typescript 3.6\nexport class Parameter extends Value {\n constructor(public key: string, public fetchTimeMillis: number, source: firebase.remoteConfig.ValueSource, value: string) {\n super(source, value);\n }\n}\n\n// If it's a Parameter array, test any, else test the individual Parameter\nconst filterTest = (fn: (param: Parameter) => boolean) => filter<Parameter | Parameter[]>(it => Array.isArray(it) ? it.some(fn) : fn(it));\n\n// Allow the user to bypass the default values and wait till they get something from the server, even if it's a cached copy;\n// if used in conjuntion with first() it will only fetch RC values from the server if they aren't cached locally\nexport const filterRemote = () => filterTest(p => p.getSource() === 'remote');\n\n// filterFresh allows the developer to effectively set up a maximum cache time\nexport const filterFresh = (howRecentInMillis: number) => filterTest(p => p.fetchTimeMillis + howRecentInMillis >= new Date().getTime());\n\n\n// I ditched loading the defaults into RC and a simple map for scan since we already have our own defaults implementation.\n// The idea here being that if they have a default that never loads from the server, they will be able to tell via fetchTimeMillis\n// on the Parameter. Also if it doesn't come from the server it won't emit again in .changes, due to the distinctUntilChanged,\n// which we can simplify to === rather than deep comparison\nconst scanToParametersArray = (\n remoteConfig: Observable<firebase.remoteConfig.RemoteConfig | undefined>\n): OperatorFunction<Record<string, firebase.remoteConfig.Value>, Parameter[]> => pipe(\n withLatestFrom(remoteConfig),\n scan((existing, [all, rc]) => {\n // SEMVER use \"new Set\" to unique once we're only targeting es6\n // at the scale we expect remote config to be at, we probably won't see a performance hit from this unoptimized uniqueness\n // implementation.\n // const allKeys = [...new Set([...existing.map(p => p.key), ...Object.keys(all)])];\n const allKeys = [...existing.map(p => p.key), ...Object.keys(all)].filter((v, i, a) => a.indexOf(v) === i);\n return allKeys.map(key => {\n const updatedValue = all[key];\n return updatedValue ? new Parameter(key, rc ? rc.fetchTimeMillis : -1, updatedValue.getSource(), updatedValue.asString())\n : existing.find(p => p.key === key);\n });\n }, [] as Parameter[])\n);\n\n\n@Injectable({\n providedIn: 'any'\n})\nexport class AngularFireRemoteConfig {\n\n readonly changes: Observable<Parameter>;\n readonly parameters: Observable<Parameter[]>;\n readonly numbers: Observable<Record<string, number | undefined>> & Record<string, Observable<number>>;\n readonly booleans: Observable<Record<string, boolean | undefined>> & Record<string, Observable<boolean>>;\n readonly strings: Observable<Record<string, string | undefined>> & Record<string, Observable<string | undefined>>;\n\n constructor(\n @Inject(FIREBASE_OPTIONS) options: FirebaseOptions,\n @Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,\n @Optional() @Inject(SETTINGS) settings: Settings | null,\n @Optional() @Inject(DEFAULTS) defaultConfig: ConfigTemplate | null,\n private zone: NgZone,\n schedulers: ɵAngularFireSchedulers,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/ban-types\n @Inject(PLATFORM_ID) platformId: Object\n ) {\n const remoteConfig$ = of(undefined).pipe(\n observeOn(schedulers.outsideAngular),\n switchMap(() => isSupported()),\n switchMap(isSupported => isSupported ? import('firebase/compat/remote-config') : EMPTY),\n map(() => ɵfirebaseAppFactory(options, zone, name)),\n map(app => ɵcacheInstance(`${app.name}.remote-config`, 'AngularFireRemoteConfig', app.name, () => {\n const rc = app.remoteConfig();\n if (settings) {\n rc.settings = settings;\n }\n if (defaultConfig) {\n rc.defaultConfig = defaultConfig;\n }\n return rc;\n }, [settings, defaultConfig])),\n startWith<firebase.remoteConfig.RemoteConfig, undefined>(undefined),\n shareReplay({ bufferSize: 1, refCount: false })\n ) as Observable<any>;\n\n const loadedRemoteConfig$ = remoteConfig$.pipe(\n filter<firebase.remoteConfig.RemoteConfig>(rc => !!rc)\n );\n\n const default$: Observable<Record<string, firebase.remoteConfig.Value>> = of(Object.keys(defaultConfig || {}).reduce(\n (c, k) => ({ ...c, [k]: new Value('default', defaultConfig[k].toString()) }), {}\n ));\n\n // we should filter out the defaults we provided to RC, since we have our own implementation\n // that gives us a -1 for fetchTimeMillis (so filterFresh can filter them out)\n const filterOutDefaults = map<Record<string, firebase.remoteConfig.Value>, Record<string, firebase.remoteConfig.Value>>(all =>\n Object.keys(all)\n .filter(key => all[key].getSource() !== 'default')\n .reduce((acc, key) => ({ ...acc, [key]: all[key] }), {})\n );\n\n const existing$ = loadedRemoteConfig$.pipe(\n switchMap(rc =>\n rc.activate()\n .then(() => rc.ensureInitialized())\n .then(() => rc.getAll())\n ),\n filterOutDefaults\n );\n\n const fresh$ = loadedRemoteConfig$.pipe(\n switchMap(rc => zone.runOutsideAngular(() =>\n rc.fetchAndActivate()\n .then(() => rc.ensureInitialized())\n .then(() => rc.getAll())\n )),\n filterOutDefaults\n );\n\n this.parameters = concat(default$, existing$, fresh$).pipe(\n scanToParametersArray(remoteConfig$),\n keepUnstableUntilFirst,\n shareReplay({ bufferSize: 1, refCount: true })\n );\n\n this.changes = this.parameters.pipe(\n switchMap(params => of(...params)),\n groupBy(param => param.key),\n mergeMap(group => group.pipe(\n distinctUntilChanged()\n ))\n );\n\n this.strings = proxyAll(this.parameters, 'strings');\n this.booleans = proxyAll(this.parameters, 'booleans');\n this.numbers = proxyAll(this.parameters, 'numbers');\n\n return ɵlazySDKProxy(this, loadedRemoteConfig$, zone);\n }\n\n}\n\n\nexport const budget = <T>(interval: number): MonoTypeOperatorFunction<T> => (source: Observable<T>) => new Observable<T>(observer => {\n let timedOut = false;\n // TODO use scheduler task rather than settimeout\n const timeout = setTimeout(() => {\n observer.complete();\n timedOut = true;\n }, interval);\n return source.subscribe({\n next(val) {\n if (!timedOut) {\n observer.next(val);\n }\n },\n error(err) {\n if (!timedOut) {\n clearTimeout(timeout);\n observer.error(err);\n }\n },\n complete() {\n if (!timedOut) {\n clearTimeout(timeout);\n observer.complete();\n }\n }\n });\n});\n\nconst typedMethod = (it: any) => {\n switch (typeof it) {\n case 'string':\n return 'asString';\n case 'boolean':\n return 'asBoolean';\n case 'number':\n return 'asNumber';\n default:\n return 'asString';\n }\n};\n\n\nexport function scanToObject(): OperatorFunction<Parameter, Record<string, string | undefined>>;\nexport function scanToObject(to: 'numbers'): OperatorFunction<Parameter, Record<string, number | undefined>>;\nexport function scanToObject(to: 'booleans'): OperatorFunction<Parameter, Record<string, boolean | undefined>>;\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function scanToObject(to: 'strings'): OperatorFunction<Parameter, Record<string, string | undefined>>;\nexport function scanToObject<T extends ConfigTemplate>(template: T): OperatorFunction<Parameter, T & Record<string, string | undefined>>;\nexport function scanToObject<T extends ConfigTemplate>(to: 'numbers' | 'booleans' | 'strings' | T = 'strings') {\n return pipe(\n // TODO cleanup\n scan(\n (c, p: Parameter) => ({\n ...c, [p.key]: typeof to === 'object' ?\n p[typedMethod(to[p.key])]() :\n p[AS_TO_FN[to]]()\n }),\n typeof to === 'object' ?\n to as T & Record<string, string | undefined> :\n {} as Record<string, number | boolean | string>\n ),\n debounceTime(1),\n budget(10),\n distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b))\n );\n}\n\nexport function mapToObject(): OperatorFunction<Parameter[], Record<string, string | undefined>>;\nexport function mapToObject(to: 'numbers'): OperatorFunction<Parameter[], Record<string, number | undefined>>;\nexport function mapToObject(to: 'booleans'): OperatorFunction<Parameter[], Record<string, boolean | undefined>>;\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function mapToObject(to: 'strings'): OperatorFunction<Parameter[], Record<string, string | undefined>>;\nexport function mapToObject<T extends ConfigTemplate>(template: T):\n OperatorFunction<Parameter[], T & Record<string, string | undefined>>;\nexport function mapToObject<T extends ConfigTemplate>(to: 'numbers' | 'booleans' | 'strings' | T = 'strings') {\n return pipe(\n // TODO this is getting a little long, cleanup\n map((params: Parameter[]) => params.reduce(\n (c, p) => ({\n ...c, [p.key]: typeof to === 'object' ?\n p[typedMethod(to[p.key])]() :\n p[AS_TO_FN[to]]()\n }),\n typeof to === 'object' ?\n to as T & Record<string, string | undefined> :\n {} as Record<string, number | boolean | string>\n )),\n distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b))\n );\n}\n\nɵapplyMixins(AngularFireRemoteConfig, [proxyPolyfillCompat]);\n","import { NgModule } from '@angular/core';\nimport { VERSION } from '@angular/fire';\nimport firebase from 'firebase/compat/app';\nimport { AngularFireRemoteConfig } from './remote-config';\n\n@NgModule({\n providers: [ AngularFireRemoteConfig ]\n})\nexport class AngularFireRemoteConfigModule {\n constructor() {\n firebase.registerVersion('angularfire', VERSION.full, 'rc-compat');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["ɵfirebaseAppFactory","ɵcacheInstance","ɵlazySDKProxy","ɵapplyMixins"],"mappings":";;;;;;;;;;AAAA;AACA;AACO,MAAM,mBAAmB,GAAG;AACjC,IAAA,GAAG,EAAE,IAAI;AACT,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,QAAQ,E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CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;AAC3B,YAAA,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE;AACpB,KAAA,CAAC,EACF,OAAO,EAAE,KAAK,QAAQ;AACpB,QAAA,EAA4C;QAC5C,EAA+C,CAClD,CAAC,EACF,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CACxE,CAAC;AACJ,CAAC;AAEDC,YAAY,CAAC,uBAAuB,EAAE,CAAC,mBAAmB,CAAC,CAAC;;MCpS/C,6BAA6B,CAAA;AACtC,IAAA,WAAA,GAAA;QACI,QAAQ,CAAC,eAAe,CAAC,aAAa,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;KACtE;uGAHQ,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;wGAA7B,6BAA6B,EAAA,CAAA,CAAA;wGAA7B,6BAA6B,EAAA,SAAA,EAF7B,CAAE,uBAAuB,CAAE,EAAA,CAAA,CAAA;;2FAE3B,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAHzC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,SAAS,EAAE,CAAE,uBAAuB,CAAE;AACvC,iBAAA,CAAA;;;ACPD;;AAEG;;;;"}
@@ -1,241 +1,246 @@
1
- // observable/fromTask.mjs
2
- import { Observable } from "rxjs";
3
- import { debounceTime } from "rxjs/operators";
1
+ import * as i1 from '@angular/fire';
2
+ import { observeOutsideAngular, keepUnstableUntilFirst, VERSION } from '@angular/fire';
3
+ import { Observable, of, from } from 'rxjs';
4
+ import { debounceTime, map, switchMap, tap } from 'rxjs/operators';
5
+ import * as i0 from '@angular/core';
6
+ import { InjectionToken, PLATFORM_ID, Injectable, Inject, Optional, makeStateKey, Pipe, NgModule } from '@angular/core';
7
+ import * as i2 from '@angular/fire/app-check';
8
+ import { ɵfirebaseAppFactory as _firebaseAppFactory, ɵcacheInstance as _cacheInstance, FIREBASE_OPTIONS, FIREBASE_APP_NAME } from '@angular/fire/compat';
9
+ import 'firebase/compat/storage';
10
+ import firebase from 'firebase/compat/app';
11
+ import { AsyncPipe } from '@angular/common';
12
+
13
+ // need to import, else the types become import('firebase/compat/app').default.storage.UploadTask
14
+ // and it no longer works w/Firebase v7
15
+ // Things aren't working great, I'm having to put in a lot of work-arounds for what
16
+ // appear to be Firebase JS SDK bugs https://github.com/firebase/firebase-js-sdk/issues/4158
4
17
  function fromTask(task) {
5
- return new Observable((subscriber) => {
6
- const progress = (snap) => subscriber.next(snap);
7
- const error = (e) => subscriber.error(e);
8
- const complete = () => subscriber.complete();
9
- progress(task.snapshot);
10
- const unsub = task.on("state_changed", progress);
11
- task.then((snapshot) => {
12
- progress(snapshot);
13
- complete();
14
- }, (e) => {
15
- progress(task.snapshot);
16
- error(e);
17
- });
18
- return function unsubscribe() {
19
- unsub();
20
- };
21
- }).pipe(
18
+ return new Observable(subscriber => {
19
+ const progress = (snap) => subscriber.next(snap);
20
+ const error = e => subscriber.error(e);
21
+ const complete = () => subscriber.complete();
22
+ // emit the current snapshot, so they don't have to wait for state_changes
23
+ // to fire next... this is stale if the task is no longer running :(
24
+ progress(task.snapshot);
25
+ const unsub = task.on('state_changed', progress);
26
+ // it turns out that neither task snapshot nor 'state_changed' fire the last
27
+ // snapshot before completion, the one with status 'success" and 100% progress
28
+ // so let's use the promise form of the task for that
29
+ task.then(snapshot => {
30
+ progress(snapshot);
31
+ complete();
32
+ }, e => {
33
+ // TODO investigate, again this is stale, we never fire a canceled or error it seems
34
+ progress(task.snapshot);
35
+ error(e);
36
+ });
37
+ // on's type if Function, rather than () => void, need to wrap
38
+ return function unsubscribe() {
39
+ unsub();
40
+ };
41
+ }).pipe(
22
42
  // deal with sync emissions from first emitting `task.snapshot`, this makes sure
23
43
  // that if the task is already finished we don't emit the old running state
24
- debounceTime(0)
25
- );
44
+ debounceTime(0));
26
45
  }
27
46
 
28
- // task.mjs
29
- import { map } from "rxjs/operators";
47
+ /**
48
+ * Create an AngularFireUploadTask from a regular UploadTask from the Storage SDK.
49
+ * This method creates an observable of the upload and returns on object that provides
50
+ * multiple methods for controlling and monitoring the file upload.
51
+ */
30
52
  function createUploadTask(task) {
31
- const inner$ = fromTask(task);
32
- return {
33
- task,
34
- then: task.then.bind(task),
35
- catch: task.catch.bind(task),
36
- pause: task.pause.bind(task),
37
- cancel: task.cancel.bind(task),
38
- resume: task.resume.bind(task),
39
- snapshotChanges: () => inner$,
40
- percentageChanges: () => inner$.pipe(map((s) => s.bytesTransferred / s.totalBytes * 100))
41
- };
53
+ const inner$ = fromTask(task);
54
+ return {
55
+ task,
56
+ then: task.then.bind(task),
57
+ catch: task.catch.bind(task),
58
+ pause: task.pause.bind(task),
59
+ cancel: task.cancel.bind(task),
60
+ resume: task.resume.bind(task),
61
+ snapshotChanges: () => inner$,
62
+ percentageChanges: () => inner$.pipe(map(s => s.bytesTransferred / s.totalBytes * 100))
63
+ };
42
64
  }
43
65
 
44
- // ref.mjs
45
- import { keepUnstableUntilFirst, observeOutsideAngular } from "@angular/fire";
46
- import { from, of } from "rxjs";
47
- import { switchMap } from "rxjs/operators";
66
+ /**
67
+ * Create an AngularFire wrapped Storage Reference. This object
68
+ * creates observable methods from promise based methods.
69
+ */
48
70
  function createStorageRef(ref) {
49
- return {
50
- getDownloadURL: () => of(void 0).pipe(observeOutsideAngular, switchMap(() => ref.getDownloadURL()), keepUnstableUntilFirst),
51
- getMetadata: () => of(void 0).pipe(observeOutsideAngular, switchMap(() => ref.getMetadata()), keepUnstableUntilFirst),
52
- delete: () => from(ref.delete()),
53
- child: (path) => createStorageRef(ref.child(path)),
54
- updateMetadata: (meta) => from(ref.updateMetadata(meta)),
55
- put: (data, metadata) => {
56
- const task = ref.put(data, metadata);
57
- return createUploadTask(task);
58
- },
59
- putString: (data, format, metadata) => {
60
- const task = ref.putString(data, format, metadata);
61
- return createUploadTask(task);
62
- },
63
- list: (options) => from(ref.list(options)),
64
- listAll: () => from(ref.listAll())
65
- };
71
+ return {
72
+ getDownloadURL: () => of(undefined).pipe(observeOutsideAngular, switchMap(() => ref.getDownloadURL()), keepUnstableUntilFirst),
73
+ getMetadata: () => of(undefined).pipe(observeOutsideAngular, switchMap(() => ref.getMetadata()), keepUnstableUntilFirst),
74
+ delete: () => from(ref.delete()),
75
+ child: (path) => createStorageRef(ref.child(path)),
76
+ updateMetadata: (meta) => from(ref.updateMetadata(meta)),
77
+ put: (data, metadata) => {
78
+ const task = ref.put(data, metadata);
79
+ return createUploadTask(task);
80
+ },
81
+ putString: (data, format, metadata) => {
82
+ const task = ref.putString(data, format, metadata);
83
+ return createUploadTask(task);
84
+ },
85
+ list: (options) => from(ref.list(options)),
86
+ listAll: () => from(ref.listAll())
87
+ };
66
88
  }
67
89
 
68
- // storage.mjs
69
- import { Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID } from "@angular/core";
70
- import { ɵAngularFireSchedulers } from "@angular/fire";
71
- import { AppCheckInstances } from "@angular/fire/app-check";
72
- import { FIREBASE_APP_NAME, FIREBASE_OPTIONS, ɵcacheInstance, ɵfirebaseAppFactory } from "@angular/fire/compat";
73
- import "firebase/compat/storage";
74
- import * as i0 from "@angular/core";
75
- import * as i1 from "@angular/fire";
76
- import * as i2 from "@angular/fire/app-check";
77
- var BUCKET = new InjectionToken("angularfire2.storageBucket");
78
- var MAX_UPLOAD_RETRY_TIME = new InjectionToken("angularfire2.storage.maxUploadRetryTime");
79
- var MAX_OPERATION_RETRY_TIME = new InjectionToken("angularfire2.storage.maxOperationRetryTime");
80
- var USE_EMULATOR = new InjectionToken("angularfire2.storage.use-emulator");
81
- var AngularFireStorage = class _AngularFireStorage {
82
- storage;
83
- constructor(options, name, storageBucket, platformId, zone, schedulers, maxUploadRetryTime, maxOperationRetryTime, _useEmulator, _appCheckInstances) {
84
- const app = ɵfirebaseAppFactory(options, zone, name);
85
- this.storage = ɵcacheInstance(`${app.name}.storage.${storageBucket}`, "AngularFireStorage", app.name, () => {
86
- const storage = zone.runOutsideAngular(() => app.storage(storageBucket || void 0));
87
- const useEmulator = _useEmulator;
88
- if (useEmulator) {
89
- storage.useEmulator(...useEmulator);
90
- }
91
- if (maxUploadRetryTime) {
92
- storage.setMaxUploadRetryTime(maxUploadRetryTime);
93
- }
94
- if (maxOperationRetryTime) {
95
- storage.setMaxOperationRetryTime(maxOperationRetryTime);
96
- }
97
- return storage;
98
- }, [maxUploadRetryTime, maxOperationRetryTime]);
99
- }
100
- ref(path) {
101
- return createStorageRef(this.storage.ref(path));
102
- }
103
- refFromURL(path) {
104
- return createStorageRef(this.storage.refFromURL(path));
105
- }
106
- upload(path, data, metadata) {
107
- const storageRef = this.storage.ref(path);
108
- const ref = createStorageRef(storageRef);
109
- return ref.put(data, metadata);
110
- }
111
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i0, type: _AngularFireStorage, deps: [{ token: FIREBASE_OPTIONS }, { token: FIREBASE_APP_NAME, optional: true }, { token: BUCKET, optional: true }, { token: PLATFORM_ID }, { token: i0.NgZone }, { token: i1.ɵAngularFireSchedulers }, { token: MAX_UPLOAD_RETRY_TIME, optional: true }, { token: MAX_OPERATION_RETRY_TIME, optional: true }, { token: USE_EMULATOR, optional: true }, { token: i2.AppCheckInstances, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
112
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i0, type: _AngularFireStorage, providedIn: "any" });
113
- };
114
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i0, type: AngularFireStorage, decorators: [{
115
- type: Injectable,
116
- args: [{
117
- providedIn: "any"
118
- }]
119
- }], ctorParameters: () => [{ type: void 0, decorators: [{
120
- type: Inject,
121
- args: [FIREBASE_OPTIONS]
122
- }] }, { type: void 0, decorators: [{
123
- type: Optional
124
- }, {
125
- type: Inject,
126
- args: [FIREBASE_APP_NAME]
127
- }] }, { type: void 0, decorators: [{
128
- type: Optional
129
- }, {
130
- type: Inject,
131
- args: [BUCKET]
132
- }] }, { type: Object, decorators: [{
133
- type: Inject,
134
- args: [PLATFORM_ID]
135
- }] }, { type: i0.NgZone }, { type: i1.ɵAngularFireSchedulers }, { type: void 0, decorators: [{
136
- type: Optional
137
- }, {
138
- type: Inject,
139
- args: [MAX_UPLOAD_RETRY_TIME]
140
- }] }, { type: void 0, decorators: [{
141
- type: Optional
142
- }, {
143
- type: Inject,
144
- args: [MAX_OPERATION_RETRY_TIME]
145
- }] }, { type: void 0, decorators: [{
146
- type: Optional
147
- }, {
148
- type: Inject,
149
- args: [USE_EMULATOR]
150
- }] }, { type: i2.AppCheckInstances, decorators: [{
151
- type: Optional
152
- }] }] });
90
+ const BUCKET = new InjectionToken('angularfire2.storageBucket');
91
+ const MAX_UPLOAD_RETRY_TIME = new InjectionToken('angularfire2.storage.maxUploadRetryTime');
92
+ const MAX_OPERATION_RETRY_TIME = new InjectionToken('angularfire2.storage.maxOperationRetryTime');
93
+ const USE_EMULATOR = new InjectionToken('angularfire2.storage.use-emulator');
94
+ /**
95
+ * AngularFireStorage Service
96
+ *
97
+ * This service is the main entry point for this feature module. It provides
98
+ * an API for uploading and downloading binary files from Cloud Storage for
99
+ * Firebase.
100
+ */
101
+ class AngularFireStorage {
102
+ storage;
103
+ constructor(options, name, storageBucket,
104
+ // eslint-disable-next-line @typescript-eslint/ban-types
105
+ platformId, zone, schedulers, maxUploadRetryTime, maxOperationRetryTime, _useEmulator, _appCheckInstances) {
106
+ const app = _firebaseAppFactory(options, zone, name);
107
+ this.storage = _cacheInstance(`${app.name}.storage.${storageBucket}`, 'AngularFireStorage', app.name, () => {
108
+ const storage = zone.runOutsideAngular(() => app.storage(storageBucket || undefined));
109
+ const useEmulator = _useEmulator;
110
+ if (useEmulator) {
111
+ storage.useEmulator(...useEmulator);
112
+ }
113
+ if (maxUploadRetryTime) {
114
+ storage.setMaxUploadRetryTime(maxUploadRetryTime);
115
+ }
116
+ if (maxOperationRetryTime) {
117
+ storage.setMaxOperationRetryTime(maxOperationRetryTime);
118
+ }
119
+ return storage;
120
+ }, [maxUploadRetryTime, maxOperationRetryTime]);
121
+ }
122
+ ref(path) {
123
+ return createStorageRef(this.storage.ref(path));
124
+ }
125
+ refFromURL(path) {
126
+ return createStorageRef(this.storage.refFromURL(path));
127
+ }
128
+ upload(path, data, metadata) {
129
+ const storageRef = this.storage.ref(path);
130
+ const ref = createStorageRef(storageRef);
131
+ return ref.put(data, metadata);
132
+ }
133
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireStorage, deps: [{ token: FIREBASE_OPTIONS }, { token: FIREBASE_APP_NAME, optional: true }, { token: BUCKET, optional: true }, { token: PLATFORM_ID }, { token: i0.NgZone }, { token: i1.ɵAngularFireSchedulers }, { token: MAX_UPLOAD_RETRY_TIME, optional: true }, { token: MAX_OPERATION_RETRY_TIME, optional: true }, { token: USE_EMULATOR, optional: true }, { token: i2.AppCheckInstances, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
134
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireStorage, providedIn: 'any' });
135
+ }
136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireStorage, decorators: [{
137
+ type: Injectable,
138
+ args: [{
139
+ providedIn: 'any'
140
+ }]
141
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
142
+ type: Inject,
143
+ args: [FIREBASE_OPTIONS]
144
+ }] }, { type: undefined, decorators: [{
145
+ type: Optional
146
+ }, {
147
+ type: Inject,
148
+ args: [FIREBASE_APP_NAME]
149
+ }] }, { type: undefined, decorators: [{
150
+ type: Optional
151
+ }, {
152
+ type: Inject,
153
+ args: [BUCKET]
154
+ }] }, { type: Object, decorators: [{
155
+ type: Inject,
156
+ args: [PLATFORM_ID]
157
+ }] }, { type: i0.NgZone }, { type: i1.ɵAngularFireSchedulers }, { type: undefined, decorators: [{
158
+ type: Optional
159
+ }, {
160
+ type: Inject,
161
+ args: [MAX_UPLOAD_RETRY_TIME]
162
+ }] }, { type: undefined, decorators: [{
163
+ type: Optional
164
+ }, {
165
+ type: Inject,
166
+ args: [MAX_OPERATION_RETRY_TIME]
167
+ }] }, { type: undefined, decorators: [{
168
+ type: Optional
169
+ }, {
170
+ type: Inject,
171
+ args: [USE_EMULATOR]
172
+ }] }, { type: i2.AppCheckInstances, decorators: [{
173
+ type: Optional
174
+ }] }] });
153
175
 
154
- // pipes/storageUrl.pipe.mjs
155
- import { AsyncPipe } from "@angular/common";
156
- import { ChangeDetectorRef, NgModule, Optional as Optional2, Pipe, TransferState, makeStateKey } from "@angular/core";
157
- import { of as of2 } from "rxjs";
158
- import { tap } from "rxjs/operators";
159
- import * as i02 from "@angular/core";
160
- var GetDownloadURLPipe = class _GetDownloadURLPipe {
161
- storage;
162
- state;
163
- asyncPipe;
164
- path;
165
- downloadUrl$;
166
- constructor(storage, cdr, state) {
167
- this.storage = storage;
168
- this.state = state;
169
- this.asyncPipe = new AsyncPipe(cdr);
170
- }
171
- transform(path) {
172
- if (path !== this.path) {
173
- this.path = path;
174
- const key = makeStateKey(`|getDownloadURL|${path}`);
175
- const existing = this.state?.get(key, void 0);
176
- this.downloadUrl$ = existing ? of2(existing) : this.storage.ref(path).getDownloadURL().pipe(tap((it) => this.state?.set(key, it)));
176
+ /** to be used with in combination with | async */
177
+ class GetDownloadURLPipe {
178
+ storage;
179
+ state;
180
+ asyncPipe;
181
+ path;
182
+ downloadUrl$;
183
+ constructor(storage, cdr, state) {
184
+ this.storage = storage;
185
+ this.state = state;
186
+ this.asyncPipe = new AsyncPipe(cdr);
177
187
  }
178
- return this.asyncPipe.transform(this.downloadUrl$);
179
- }
180
- ngOnDestroy() {
181
- this.asyncPipe.ngOnDestroy();
182
- }
183
- static ɵfac = i02.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i02, type: _GetDownloadURLPipe, deps: [{ token: AngularFireStorage }, { token: i02.ChangeDetectorRef }, { token: i02.TransferState, optional: true }], target: i02.ɵɵFactoryTarget.Pipe });
184
- static ɵpipe = i02.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.0-rc.3", ngImport: i02, type: _GetDownloadURLPipe, name: "getDownloadURL", pure: false });
185
- };
186
- i02.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i02, type: GetDownloadURLPipe, decorators: [{
187
- type: Pipe,
188
- args: [{
189
- name: "getDownloadURL",
190
- pure: false
191
- }]
192
- }], ctorParameters: () => [{ type: AngularFireStorage }, { type: i02.ChangeDetectorRef }, { type: i02.TransferState, decorators: [{
193
- type: Optional2
194
- }] }] });
195
- var GetDownloadURLPipeModule = class _GetDownloadURLPipeModule {
196
- static ɵfac = i02.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i02, type: _GetDownloadURLPipeModule, deps: [], target: i02.ɵɵFactoryTarget.NgModule });
197
- static ɵmod = i02.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0-rc.3", ngImport: i02, type: _GetDownloadURLPipeModule, declarations: [GetDownloadURLPipe], exports: [GetDownloadURLPipe] });
198
- static ɵinj = i02.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i02, type: _GetDownloadURLPipeModule });
199
- };
200
- i02.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i02, type: GetDownloadURLPipeModule, decorators: [{
201
- type: NgModule,
202
- args: [{
203
- declarations: [GetDownloadURLPipe],
204
- exports: [GetDownloadURLPipe]
205
- }]
206
- }] });
188
+ transform(path) {
189
+ if (path !== this.path) {
190
+ this.path = path;
191
+ const key = makeStateKey(`|getDownloadURL|${path}`);
192
+ const existing = this.state?.get(key, undefined);
193
+ this.downloadUrl$ = existing ? of(existing) : this.storage.ref(path).getDownloadURL().pipe(tap(it => this.state?.set(key, it)));
194
+ }
195
+ return this.asyncPipe.transform(this.downloadUrl$);
196
+ }
197
+ ngOnDestroy() {
198
+ this.asyncPipe.ngOnDestroy();
199
+ }
200
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: GetDownloadURLPipe, deps: [{ token: AngularFireStorage }, { token: i0.ChangeDetectorRef }, { token: i0.TransferState, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
201
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.0", ngImport: i0, type: GetDownloadURLPipe, name: "getDownloadURL", pure: false });
202
+ }
203
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: GetDownloadURLPipe, decorators: [{
204
+ type: Pipe,
205
+ args: [{
206
+ name: 'getDownloadURL',
207
+ pure: false,
208
+ }]
209
+ }], ctorParameters: () => [{ type: AngularFireStorage }, { type: i0.ChangeDetectorRef }, { type: i0.TransferState, decorators: [{
210
+ type: Optional
211
+ }] }] });
212
+ class GetDownloadURLPipeModule {
213
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: GetDownloadURLPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
214
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0", ngImport: i0, type: GetDownloadURLPipeModule, declarations: [GetDownloadURLPipe], exports: [GetDownloadURLPipe] });
215
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: GetDownloadURLPipeModule });
216
+ }
217
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: GetDownloadURLPipeModule, decorators: [{
218
+ type: NgModule,
219
+ args: [{
220
+ declarations: [GetDownloadURLPipe],
221
+ exports: [GetDownloadURLPipe],
222
+ }]
223
+ }] });
224
+
225
+ class AngularFireStorageModule {
226
+ constructor() {
227
+ firebase.registerVersion('angularfire', VERSION.full, 'gcs-compat');
228
+ }
229
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireStorageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
230
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0", ngImport: i0, type: AngularFireStorageModule, exports: [GetDownloadURLPipeModule] });
231
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireStorageModule, providers: [AngularFireStorage], imports: [GetDownloadURLPipeModule] });
232
+ }
233
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireStorageModule, decorators: [{
234
+ type: NgModule,
235
+ args: [{
236
+ exports: [GetDownloadURLPipeModule],
237
+ providers: [AngularFireStorage]
238
+ }]
239
+ }], ctorParameters: () => [] });
240
+
241
+ /**
242
+ * Generated bundle index. Do not edit.
243
+ */
207
244
 
208
- // storage.module.mjs
209
- import { NgModule as NgModule2 } from "@angular/core";
210
- import { VERSION } from "@angular/fire";
211
- import firebase from "firebase/compat/app";
212
- import * as i03 from "@angular/core";
213
- var AngularFireStorageModule = class _AngularFireStorageModule {
214
- constructor() {
215
- firebase.registerVersion("angularfire", VERSION.full, "gcs-compat");
216
- }
217
- static ɵfac = i03.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i03, type: _AngularFireStorageModule, deps: [], target: i03.ɵɵFactoryTarget.NgModule });
218
- static ɵmod = i03.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0-rc.3", ngImport: i03, type: _AngularFireStorageModule, exports: [GetDownloadURLPipeModule] });
219
- static ɵinj = i03.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i03, type: _AngularFireStorageModule, providers: [AngularFireStorage], imports: [GetDownloadURLPipeModule] });
220
- };
221
- i03.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i03, type: AngularFireStorageModule, decorators: [{
222
- type: NgModule2,
223
- args: [{
224
- exports: [GetDownloadURLPipeModule],
225
- providers: [AngularFireStorage]
226
- }]
227
- }], ctorParameters: () => [] });
228
- export {
229
- AngularFireStorage,
230
- AngularFireStorageModule,
231
- BUCKET,
232
- GetDownloadURLPipe,
233
- GetDownloadURLPipeModule,
234
- MAX_OPERATION_RETRY_TIME,
235
- MAX_UPLOAD_RETRY_TIME,
236
- USE_EMULATOR,
237
- createStorageRef,
238
- createUploadTask,
239
- fromTask
240
- };
245
+ export { AngularFireStorage, AngularFireStorageModule, BUCKET, GetDownloadURLPipe, GetDownloadURLPipeModule, MAX_OPERATION_RETRY_TIME, MAX_UPLOAD_RETRY_TIME, USE_EMULATOR, createStorageRef, createUploadTask, fromTask };
241
246
  //# sourceMappingURL=angular-fire-compat-storage.mjs.map