@angular/fire 7.6.0-canary.59b95af → 7.6.0-canary.60943d6
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.
- package/README.md +7 -1
- package/bundles/angular-fire.umd.js +1 -1
- package/bundles/angular-fire.umd.js.map +1 -1
- package/docs/auth.md +1 -1
- package/docs/install-firebase-tools.md +78 -0
- package/docs/universal/cloud-functions.md +27 -6
- package/docs/universal/getting-started.md +9 -134
- package/esm2015/core.js +1 -1
- package/fesm2015/angular-fire.js +1 -1
- package/fesm2015/angular-fire.js.map +1 -1
- package/package.json +1 -1
- package/schematics/deploy/actions.js +17 -21
package/README.md
CHANGED
|
@@ -3,7 +3,13 @@ The official [Angular](https://angular.io/) library for [Firebase](https://fireb
|
|
|
3
3
|
|
|
4
4
|
<strong><pre>ng add @angular/fire</pre></strong>
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
_Note: If you want to ng add AngularFire and will be using Hosting/Cloud Functions, you need to configure the
|
|
7
|
+
Firebase CLI first so that you are logged in for the schematics that are run as part of `ng add @angular/fire`.
|
|
8
|
+
Follow [this guide](docs/install-firebase-tools.md) to have the Firebase CLI walk you through the setup._
|
|
9
|
+
|
|
10
|
+
AngularFire smooths over the rough edges an Angular developer might encounter when implementing the framework-agnostic
|
|
11
|
+
[Firebase JS SDK](https://github.com/firebase/firebase-js-sdk) & aims to provide a more natural developer experience
|
|
12
|
+
by conforming to Angular conventions.
|
|
7
13
|
|
|
8
14
|
- **Dependency injection** - Provide and Inject Firebase services in your components
|
|
9
15
|
- **Zone.js wrappers** - Stable zones allow proper functionality of service workers, forms, SSR, and pre-rendering
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
28
|
|
|
29
|
-
var VERSION = new i0.Version('7.6.0-canary.
|
|
29
|
+
var VERSION = new i0.Version('7.6.0-canary.60943d6');
|
|
30
30
|
var isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';
|
|
31
31
|
var isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';
|
|
32
32
|
var isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-fire.umd.js","sources":["../../../src/core.ts","../../../src/zones.ts","../../../src/angular-fire.ts"],"sourcesContent":["import { Version } from '@angular/core';\nimport { FirebaseApp, getApps } from 'firebase/app';\nimport { ComponentContainer } from '@firebase/component';\nimport { isSupported as isRemoteConfigSupported } from 'firebase/remote-config';\nimport { isSupported as isMessagingSupported } from 'firebase/messaging';\nimport { isSupported as isAnalyticsSupported } from 'firebase/analytics';\n\nexport const VERSION = new Version('7.6.0-canary.59b95af');\n\nconst isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';\nconst isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';\nconst isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';\nconst isRemoteConfigSupportedPromiseSymbol = '__angularfire_symbol__remoteConfigIsSupported';\nconst isMessagingSupportedValueSymbol = '__angularfire_symbol__messagingIsSupportedValue';\nconst isMessagingSupportedPromiseSymbol = '__angularfire_symbol__messagingIsSupported';\n\nglobalThis[isAnalyticsSupportedPromiseSymbol] ||= isAnalyticsSupported().then(it =>\n globalThis[isAnalyticsSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isAnalyticsSupportedValueSymbol] = false\n);\n\nglobalThis[isMessagingSupportedPromiseSymbol] ||= isMessagingSupported().then(it =>\n globalThis[isMessagingSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isMessagingSupportedValueSymbol] = false\n);\n\nglobalThis[isRemoteConfigSupportedPromiseSymbol] ||= isRemoteConfigSupported().then(it =>\n globalThis[isRemoteConfigSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isRemoteConfigSupportedValueSymbol] = false\n);\n\nconst isSupportedError = (module: string) =>\n `The APP_INITIALIZER that is \"making\" isSupported() sync for the sake of convenient DI has not resolved in this\ncontext. Rather than injecting ${module} in the constructor, first ensure that ${module} is supported by calling\n\\`await isSupported()\\`, then retrieve the instance from the injector manually \\`injector.get(${module})\\`.`;\n\nexport const ɵisMessagingSupportedFactory = {\n async: () => globalThis[isMessagingSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isMessagingSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Messaging')); }\n return ret;\n }\n};\n\nexport const ɵisRemoteConfigSupportedFactory = {\n async: () => globalThis[isRemoteConfigSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isRemoteConfigSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('RemoteConfig')); }\n return ret;\n }\n};\n\nexport const ɵisAnalyticsSupportedFactory = {\n async: () => globalThis[isAnalyticsSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isAnalyticsSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Analytics')); }\n return ret;\n }\n};\n\n// TODO is there a better way to get at the internal types?\ninterface FirebaseAppWithContainer extends FirebaseApp {\n container: ComponentContainer;\n}\n\nexport function ɵgetDefaultInstanceOf<T= unknown>(identifier: string, provided: T[]|undefined, defaultApp: FirebaseApp): T|undefined {\n if (provided) {\n // Was provide* only called once? If so grab that\n if (provided.length === 1) { return provided[0]; }\n const providedUsingDefaultApp = provided.filter((it: any) => it.app === defaultApp);\n // Was provide* only called once, using the default app? If so use that\n if (providedUsingDefaultApp.length === 1) { return providedUsingDefaultApp[0]; }\n }\n // Grab the default instance from the defaultApp\n const defaultAppWithContainer: FirebaseAppWithContainer = defaultApp as any;\n const provider = defaultAppWithContainer.container.getProvider(identifier as never);\n return provider.getImmediate({ optional: true });\n}\n\nexport const ɵgetAllInstancesOf = <T= unknown>(identifier: string, app?: FirebaseApp): Array<T> => {\n const apps = app ? [app] : getApps();\n const instances: Array<any> = [];\n apps.forEach((app: FirebaseAppWithContainer) => {\n const provider: any = app.container.getProvider(identifier as never);\n provider.instances.forEach((instance: any) => {\n if (!instances.includes(instance)) {\n instances.push(instance);\n }\n });\n });\n return instances;\n};\n","import { Injectable, NgZone } from '@angular/core';\nimport {\n asyncScheduler,\n Observable,\n Operator,\n queueScheduler,\n SchedulerAction,\n SchedulerLike,\n Subscriber,\n Subscription,\n TeardownLogic\n} from 'rxjs';\nimport { observeOn, subscribeOn, tap } from 'rxjs/operators';\n\nfunction noop() {\n}\n\n/**\n * Schedules tasks so that they are invoked inside the Zone that is passed in the constructor.\n */\n// tslint:disable-next-line:class-name\nexport class ɵZoneScheduler implements SchedulerLike {\n constructor(private zone: any, private delegate: any = queueScheduler) {\n }\n\n now() {\n return this.delegate.now();\n }\n\n schedule(work: (this: SchedulerAction<any>, state?: any) => void, delay?: number, state?: any): Subscription {\n const targetZone = this.zone;\n // Wrap the specified work function to make sure that if nested scheduling takes place the\n // work is executed in the correct zone\n const workInZone = function(this: SchedulerAction<any>, state: any) {\n targetZone.runGuarded(() => {\n work.apply(this, [state]);\n });\n };\n\n // Scheduling itself needs to be run in zone to ensure setInterval calls for async scheduling are done\n // inside the correct zone. This scheduler needs to schedule asynchronously always to ensure that\n // firebase emissions are never synchronous. Specifying a delay causes issues with the queueScheduler delegate.\n return this.delegate.schedule(workInZone, delay, state);\n }\n}\n\nclass BlockUntilFirstOperator<T> implements Operator<T, T> {\n private task: MacroTask | null = null;\n\n constructor(private zone: any) {\n }\n\n call(subscriber: Subscriber<T>, source: Observable<T>): TeardownLogic {\n const unscheduleTask = this.unscheduleTask.bind(this);\n this.task = this.zone.run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n\n return source.pipe(\n tap({ next: unscheduleTask, complete: unscheduleTask, error: unscheduleTask })\n ).subscribe(subscriber).add(unscheduleTask);\n }\n\n private unscheduleTask() {\n // maybe this is a race condition, invoke in a timeout\n // hold for 10ms while I try to figure out what is going on\n setTimeout(() => {\n if (this.task != null && this.task.state === 'scheduled') {\n this.task.invoke();\n this.task = null;\n }\n }, 10);\n }\n}\n\n@Injectable({\n providedIn: 'root',\n})\n// tslint:disable-next-line:class-name\nexport class ɵAngularFireSchedulers {\n public readonly outsideAngular: ɵZoneScheduler;\n public readonly insideAngular: ɵZoneScheduler;\n\n constructor(public ngZone: NgZone) {\n this.outsideAngular = ngZone.runOutsideAngular(() => new ɵZoneScheduler(Zone.current));\n this.insideAngular = ngZone.run(() => new ɵZoneScheduler(Zone.current, asyncScheduler));\n globalThis.ɵAngularFireScheduler ||= this;\n }\n}\n\nfunction getSchedulers() {\n const schedulers = globalThis.ɵAngularFireScheduler as ɵAngularFireSchedulers|undefined;\n if (!schedulers) {\n throw new Error(\n`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using\nprovideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);\n }\n return schedulers;\n}\n\nfunction runOutsideAngular<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.runOutsideAngular(() => fn());\n}\n\nfunction run<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.run(() => fn());\n}\n\nexport function observeOutsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().outsideAngular));\n}\n\nexport function observeInsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().insideAngular));\n}\n\nexport function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n const scheduler = getSchedulers();\n return ɵkeepUnstableUntilFirstFactory(getSchedulers())(obs$);\n}\n\n/**\n * Operator to block the zone until the first value has been emitted or the observable\n * has completed/errored. This is used to make sure that universal waits until the first\n * value from firebase but doesn't block the zone forever since the firebase subscription\n * is still alive.\n */\nexport function ɵkeepUnstableUntilFirstFactory(schedulers: ɵAngularFireSchedulers) {\n return function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n obs$ = obs$.lift(\n new BlockUntilFirstOperator(schedulers.ngZone)\n );\n\n return obs$.pipe(\n // Run the subscribe body outside of Angular (e.g. calling Firebase SDK to add a listener to a change event)\n subscribeOn(schedulers.outsideAngular),\n // Run operators inside the angular zone (e.g. side effects via tap())\n observeOn(schedulers.insideAngular)\n // INVESTIGATE https://github.com/angular/angularfire/pull/2315\n // share()\n );\n };\n}\n\nconst zoneWrapFn = (it: (...args: any[]) => any, macrotask: MacroTask|undefined) => {\n const _this = this;\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n const _arguments = arguments;\n if (macrotask) {\n setTimeout(() => {\n if (macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n }\n return run(() => it.apply(_this, _arguments));\n };\n};\n\nexport const ɵzoneWrap = <T= unknown>(it: T, blockUntilFirst: boolean): T => {\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n let macrotask: MacroTask | undefined;\n const _arguments = arguments;\n // if this is a callback function, e.g, onSnapshot, we should create a microtask and invoke it\n // only once one of the callback functions is tripped.\n for (let i = 0; i < arguments.length; i++) {\n if (typeof _arguments[i] === 'function') {\n if (blockUntilFirst) {\n macrotask ||= run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n }\n // TODO create a microtask to track callback functions\n _arguments[i] = zoneWrapFn(_arguments[i], macrotask);\n }\n }\n const ret = runOutsideAngular(() => (it as any).apply(this, _arguments));\n if (!blockUntilFirst) {\n if (ret instanceof Observable) {\n const schedulers = getSchedulers();\n return ret.pipe(\n subscribeOn(schedulers.outsideAngular),\n observeOn(schedulers.insideAngular),\n );\n } else {\n return run(() => ret);\n }\n }\n if (ret instanceof Observable) {\n return ret.pipe(keepUnstableUntilFirst) as any;\n } else if (ret instanceof Promise) {\n return run(() => new Promise((resolve, reject) => ret.then(it => run(() => resolve(it)), reason => run(() => reject(reason)))));\n } else if (typeof ret === 'function' && macrotask) {\n // Handle unsubscribe\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n setTimeout(() => {\n if (macrotask && macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n return ret.apply(this, arguments);\n };\n } else {\n // TODO how do we handle storage uploads in Zone? and other stuff with cancel() etc?\n return run(() => ret);\n }\n } as any;\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["Version","isAnalyticsSupported","isMessagingSupported","isRemoteConfigSupported","app","getApps","tap","asyncScheduler","Injectable","observeOn","subscribeOn","Observable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;QAOa,OAAO,GAAG,IAAIA,UAAO,CAAC,sBAAsB,EAAE;IAE3D,IAAM,+BAA+B,GAAG,iDAAiD,CAAC;IAC1F,IAAM,iCAAiC,GAAG,4CAA4C,CAAC;IACvF,IAAM,kCAAkC,GAAG,oDAAoD,CAAC;IAChG,IAAM,oCAAoC,GAAG,+CAA+C,CAAC;IAC7F,IAAM,+BAA+B,GAAG,iDAAiD,CAAC;IAC1F,IAAM,iCAAiC,GAAG,4CAA4C,CAAC;IAEvF,UAAU,CAAC,iCAAiC,MAA5C,UAAU,CAAC,iCAAiC,IAAMC,qBAAoB,EAAE,CAAC,IAAI,CAAC,UAAA,EAAE,IAC9E,OAAA,UAAU,CAAC,+BAA+B,CAAC,GAAG,EAAE,GAAA,CACjD,CAAC,KAAK,CAAC,cACN,OAAA,UAAU,CAAC,+BAA+B,CAAC,GAAG,KAAK,GAAA,CACpD,EAAC;IAEF,UAAU,CAAC,iCAAiC,MAA5C,UAAU,CAAC,iCAAiC,IAAMC,qBAAoB,EAAE,CAAC,IAAI,CAAC,UAAA,EAAE,IAC9E,OAAA,UAAU,CAAC,+BAA+B,CAAC,GAAG,EAAE,GAAA,CACjD,CAAC,KAAK,CAAC,cACN,OAAA,UAAU,CAAC,+BAA+B,CAAC,GAAG,KAAK,GAAA,CACp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,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAQ,CAAC;aAChD;iBAAM,IAAI,GAAG,YAAY,OAAO,EAAE;gBACjC,OAAO,GAAG,CAAC,cAAM,OAAA,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM,IAAK,OAAA,GAAG,CAAC,IAAI,CAAC,UAAA,EAAE,IAAI,OAAA,GAAG,CAAC,cAAM,OAAA,OAAO,CAAC,EAAE,CAAC,GAAA,CAAC,GAAA,EAAE,UAAA,MAAM,IAAI,OAAA,GAAG,CAAC,cAAM,OAAA,MAAM,CAAC,MAAM,CAAC,GAAA,CAAC,GAAA,CAAC,GAAA,CAAC,GAAA,CAAC,CAAC;aACjI;iBAAM,IAAI,OAAO,GAAG,KAAK,UAAU,IAAI,SAAS,EAAE;;;;gBAIjD,OAAO;oBACL,UAAU,CAAC;wBACT,IAAI,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,WAAW,EAAE;4BAChD,SAAS,CAAC,MAAM,EAAE,CAAC;yBACpB;qBACF,EAAE,EAAE,CAAC,CAAC;oBACP,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;iBACnC,CAAC;aACH;iBAAM;;gBAEL,OAAO,GAAG,CAAC,cAAM,OAAA,GAAG,GAAA,CAAC,CAAC;aACvB;SACK,CAAC;IACX;;ICjNA;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"angular-fire.umd.js","sources":["../../../src/core.ts","../../../src/zones.ts","../../../src/angular-fire.ts"],"sourcesContent":["import { Version } from '@angular/core';\nimport { FirebaseApp, getApps } from 'firebase/app';\nimport { ComponentContainer } from '@firebase/component';\nimport { isSupported as isRemoteConfigSupported } from 'firebase/remote-config';\nimport { isSupported as isMessagingSupported } from 'firebase/messaging';\nimport { isSupported as isAnalyticsSupported } from 'firebase/analytics';\n\nexport const VERSION = new Version('7.6.0-canary.60943d6');\n\nconst isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';\nconst isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';\nconst isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';\nconst isRemoteConfigSupportedPromiseSymbol = '__angularfire_symbol__remoteConfigIsSupported';\nconst isMessagingSupportedValueSymbol = '__angularfire_symbol__messagingIsSupportedValue';\nconst isMessagingSupportedPromiseSymbol = '__angularfire_symbol__messagingIsSupported';\n\nglobalThis[isAnalyticsSupportedPromiseSymbol] ||= isAnalyticsSupported().then(it =>\n globalThis[isAnalyticsSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isAnalyticsSupportedValueSymbol] = false\n);\n\nglobalThis[isMessagingSupportedPromiseSymbol] ||= isMessagingSupported().then(it =>\n globalThis[isMessagingSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isMessagingSupportedValueSymbol] = false\n);\n\nglobalThis[isRemoteConfigSupportedPromiseSymbol] ||= isRemoteConfigSupported().then(it =>\n globalThis[isRemoteConfigSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isRemoteConfigSupportedValueSymbol] = false\n);\n\nconst isSupportedError = (module: string) =>\n `The APP_INITIALIZER that is \"making\" isSupported() sync for the sake of convenient DI has not resolved in this\ncontext. Rather than injecting ${module} in the constructor, first ensure that ${module} is supported by calling\n\\`await isSupported()\\`, then retrieve the instance from the injector manually \\`injector.get(${module})\\`.`;\n\nexport const ɵisMessagingSupportedFactory = {\n async: () => globalThis[isMessagingSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isMessagingSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Messaging')); }\n return ret;\n }\n};\n\nexport const ɵisRemoteConfigSupportedFactory = {\n async: () => globalThis[isRemoteConfigSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isRemoteConfigSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('RemoteConfig')); }\n return ret;\n }\n};\n\nexport const ɵisAnalyticsSupportedFactory = {\n async: () => globalThis[isAnalyticsSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isAnalyticsSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Analytics')); }\n return ret;\n }\n};\n\n// TODO is there a better way to get at the internal types?\ninterface FirebaseAppWithContainer extends FirebaseApp {\n container: ComponentContainer;\n}\n\nexport function ɵgetDefaultInstanceOf<T= unknown>(identifier: string, provided: T[]|undefined, defaultApp: FirebaseApp): T|undefined {\n if (provided) {\n // Was provide* only called once? If so grab that\n if (provided.length === 1) { return provided[0]; }\n const providedUsingDefaultApp = provided.filter((it: any) => it.app === defaultApp);\n // Was provide* only called once, using the default app? If so use that\n if (providedUsingDefaultApp.length === 1) { return providedUsingDefaultApp[0]; }\n }\n // Grab the default instance from the defaultApp\n const defaultAppWithContainer: FirebaseAppWithContainer = defaultApp as any;\n const provider = defaultAppWithContainer.container.getProvider(identifier as never);\n return provider.getImmediate({ optional: true });\n}\n\nexport const ɵgetAllInstancesOf = <T= unknown>(identifier: string, app?: FirebaseApp): Array<T> => {\n const apps = app ? [app] : getApps();\n const instances: Array<any> = [];\n apps.forEach((app: FirebaseAppWithContainer) => {\n const provider: any = app.container.getProvider(identifier as never);\n provider.instances.forEach((instance: any) => {\n if (!instances.includes(instance)) {\n instances.push(instance);\n }\n });\n });\n return instances;\n};\n","import { Injectable, NgZone } from '@angular/core';\nimport {\n asyncScheduler,\n Observable,\n Operator,\n queueScheduler,\n SchedulerAction,\n SchedulerLike,\n Subscriber,\n Subscription,\n TeardownLogic\n} from 'rxjs';\nimport { observeOn, subscribeOn, tap } from 'rxjs/operators';\n\nfunction noop() {\n}\n\n/**\n * Schedules tasks so that they are invoked inside the Zone that is passed in the constructor.\n */\n// tslint:disable-next-line:class-name\nexport class ɵZoneScheduler implements SchedulerLike {\n constructor(private zone: any, private delegate: any = queueScheduler) {\n }\n\n now() {\n return this.delegate.now();\n }\n\n schedule(work: (this: SchedulerAction<any>, state?: any) => void, delay?: number, state?: any): Subscription {\n const targetZone = this.zone;\n // Wrap the specified work function to make sure that if nested scheduling takes place the\n // work is executed in the correct zone\n const workInZone = function(this: SchedulerAction<any>, state: any) {\n targetZone.runGuarded(() => {\n work.apply(this, [state]);\n });\n };\n\n // Scheduling itself needs to be run in zone to ensure setInterval calls for async scheduling are done\n // inside the correct zone. This scheduler needs to schedule asynchronously always to ensure that\n // firebase emissions are never synchronous. Specifying a delay causes issues with the queueScheduler delegate.\n return this.delegate.schedule(workInZone, delay, state);\n }\n}\n\nclass BlockUntilFirstOperator<T> implements Operator<T, T> {\n private task: MacroTask | null = null;\n\n constructor(private zone: any) {\n }\n\n call(subscriber: Subscriber<T>, source: Observable<T>): TeardownLogic {\n const unscheduleTask = this.unscheduleTask.bind(this);\n this.task = this.zone.run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n\n return source.pipe(\n tap({ next: unscheduleTask, complete: unscheduleTask, error: unscheduleTask })\n ).subscribe(subscriber).add(unscheduleTask);\n }\n\n private unscheduleTask() {\n // maybe this is a race condition, invoke in a timeout\n // hold for 10ms while I try to figure out what is going on\n setTimeout(() => {\n if (this.task != null && this.task.state === 'scheduled') {\n this.task.invoke();\n this.task = null;\n }\n }, 10);\n }\n}\n\n@Injectable({\n providedIn: 'root',\n})\n// tslint:disable-next-line:class-name\nexport class ɵAngularFireSchedulers {\n public readonly outsideAngular: ɵZoneScheduler;\n public readonly insideAngular: ɵZoneScheduler;\n\n constructor(public ngZone: NgZone) {\n this.outsideAngular = ngZone.runOutsideAngular(() => new ɵZoneScheduler(Zone.current));\n this.insideAngular = ngZone.run(() => new ɵZoneScheduler(Zone.current, asyncScheduler));\n globalThis.ɵAngularFireScheduler ||= this;\n }\n}\n\nfunction getSchedulers() {\n const schedulers = globalThis.ɵAngularFireScheduler as ɵAngularFireSchedulers|undefined;\n if (!schedulers) {\n throw new Error(\n`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using\nprovideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);\n }\n return schedulers;\n}\n\nfunction runOutsideAngular<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.runOutsideAngular(() => fn());\n}\n\nfunction run<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.run(() => fn());\n}\n\nexport function observeOutsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().outsideAngular));\n}\n\nexport function observeInsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().insideAngular));\n}\n\nexport function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n const scheduler = getSchedulers();\n return ɵkeepUnstableUntilFirstFactory(getSchedulers())(obs$);\n}\n\n/**\n * Operator to block the zone until the first value has been emitted or the observable\n * has completed/errored. This is used to make sure that universal waits until the first\n * value from firebase but doesn't block the zone forever since the firebase subscription\n * is still alive.\n */\nexport function ɵkeepUnstableUntilFirstFactory(schedulers: ɵAngularFireSchedulers) {\n return function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n obs$ = obs$.lift(\n new BlockUntilFirstOperator(schedulers.ngZone)\n );\n\n return obs$.pipe(\n // Run the subscribe body outside of Angular (e.g. calling Firebase SDK to add a listener to a change event)\n subscribeOn(schedulers.outsideAngular),\n // Run operators inside the angular zone (e.g. side effects via tap())\n observeOn(schedulers.insideAngular)\n // INVESTIGATE https://github.com/angular/angularfire/pull/2315\n // share()\n );\n };\n}\n\nconst zoneWrapFn = (it: (...args: any[]) => any, macrotask: MacroTask|undefined) => {\n const _this = this;\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n const _arguments = arguments;\n if (macrotask) {\n setTimeout(() => {\n if (macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n }\n return run(() => it.apply(_this, _arguments));\n };\n};\n\nexport const ɵzoneWrap = <T= unknown>(it: T, blockUntilFirst: boolean): T => {\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n let macrotask: MacroTask | undefined;\n const _arguments = arguments;\n // if this is a callback function, e.g, onSnapshot, we should create a microtask and invoke it\n // only once one of the callback functions is tripped.\n for (let i = 0; i < arguments.length; i++) {\n if (typeof _arguments[i] === 'function') {\n if (blockUntilFirst) {\n macrotask ||= run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n }\n // TODO create a microtask to track callback functions\n _arguments[i] = zoneWrapFn(_arguments[i], macrotask);\n }\n }\n const ret = runOutsideAngular(() => (it as any).apply(this, _arguments));\n if (!blockUntilFirst) {\n if (ret instanceof Observable) {\n const schedulers = getSchedulers();\n return ret.pipe(\n subscribeOn(schedulers.outsideAngular),\n observeOn(schedulers.insideAngular),\n );\n } else {\n return run(() => ret);\n }\n }\n if (ret instanceof Observable) {\n return ret.pipe(keepUnstableUntilFirst) as any;\n } else if (ret instanceof Promise) {\n return run(() => new Promise((resolve, reject) => ret.then(it => run(() => resolve(it)), reason => run(() => reject(reason)))));\n } else if (typeof ret === 'function' && macrotask) {\n // Handle unsubscribe\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n setTimeout(() => {\n if (macrotask && macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n return ret.apply(this, arguments);\n };\n } else {\n // TODO how do we handle storage uploads in Zone? and other stuff with cancel() etc?\n return run(() => ret);\n }\n } as any;\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["Version","isAnalyticsSupported","isMessagingSupported","isRemoteConfigSupported","app","getApps","tap","asyncScheduler","Injectable","observeOn","subscribeOn","Observable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;QAOa,OAAO,GAAG,IAAIA,UAAO,CAAC,sBAAsB,EAAE;IAE3D,IAAM,+BAA+B,GAAG,iDAAiD,CAAC;IAC1F,IAAM,iCAAiC,GAAG,4CAA4C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CAAC,KAAK,KAAK,WAAW,EAAE;4BAChD,SAAS,CAAC,MAAM,EAAE,CAAC;yBACpB;qBACF,EAAE,EAAE,CAAC,CAAC;oBACP,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;iBACnC,CAAC;aACH;iBAAM;;gBAEL,OAAO,GAAG,CAAC,cAAM,OAAA,GAAG,GAAA,CAAC,CAAC;aACvB;SACK,CAAC;IACX;;ICjNA;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/docs/auth.md
CHANGED
|
@@ -76,7 +76,7 @@ export class UserComponent implements OnDestroy {
|
|
|
76
76
|
...
|
|
77
77
|
|
|
78
78
|
constructor() {
|
|
79
|
-
this.userSubscription = this.user$.subscribe(aUser: User | null => {
|
|
79
|
+
this.userSubscription = this.user$.subscribe((aUser: User | null) => {
|
|
80
80
|
//handle user state changes here. Note, that user will be null if there is no currently logged in user.
|
|
81
81
|
console.log(aUser);
|
|
82
82
|
})
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Firebase Tools Install and Setup
|
|
2
|
+
|
|
3
|
+
### 1. Install package
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g firebase-tools
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
or with `yarn`
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
yarn global add firebase-tools
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
You can also choose to install it as a dependency for your project rather than globally
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install --save-dev firebase-tools
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
or with `yarn`
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add -D firebase-tools
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2. Configure Firebase Tools
|
|
28
|
+
|
|
29
|
+
In your projects root directory run:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
firebase init
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
or if your installed it within your project rather than globally
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx firebase init
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
or with `yarn`
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
yarn firebase init
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This will ask you to login if you are not logged in already, the process will take you through a browser
|
|
48
|
+
redirect to log you into Firebase.
|
|
49
|
+
|
|
50
|
+
### 3. Choose what Firebase features
|
|
51
|
+
|
|
52
|
+
`firebase-tools` displays Firebase features you want to configure.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
? Which Firebase features do you want to set up for this directory? Press Space
|
|
56
|
+
to select features, then Enter to confirm your choices. (Press <space> to select
|
|
57
|
+
, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
|
|
58
|
+
◯ Realtime Database: Configure a security rules file for Realtime Database and
|
|
59
|
+
(optionally) provision default instance
|
|
60
|
+
◯ Firestore: Configure security rules and indexes files for Firestore
|
|
61
|
+
◯ Functions: Configure a Cloud Functions directory and its files
|
|
62
|
+
◯ Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub
|
|
63
|
+
Action deploys
|
|
64
|
+
◯ Hosting: Set up GitHub Action deploys
|
|
65
|
+
(Move up and down to reveal more choices)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 4. Connect your repo to a Firebase project
|
|
69
|
+
|
|
70
|
+
The CLI will then walk you through making sure your repo is configured with a Firebase project.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
? Please select an option:
|
|
74
|
+
◯ Use an existing project
|
|
75
|
+
◯ Create a new project
|
|
76
|
+
◯ Add Firebase to an existing Google Cloud Platform project
|
|
77
|
+
◯ Don't set up a default project
|
|
78
|
+
```
|
|
@@ -40,8 +40,8 @@ Let's go ahead and modify your `package.json` to build for Cloud Functions:
|
|
|
40
40
|
```js
|
|
41
41
|
"scripts": {
|
|
42
42
|
// ... omitted
|
|
43
|
-
"build": "ng build && npm run
|
|
44
|
-
"copy:hosting": "cp -r ./dist/YOUR_PROJECT_NAME/* ./public && rm ./public/index.html",
|
|
43
|
+
"build": "ng build && npm run build:ssr && npm run copy:hosting && npm run build:functions",
|
|
44
|
+
"copy:hosting": "cp -r ./dist/YOUR_PROJECT_NAME/* ./public && rm -f ./public/index.html",
|
|
45
45
|
"build:functions": "npm run --prefix functions build"
|
|
46
46
|
},
|
|
47
47
|
```
|
|
@@ -51,21 +51,42 @@ Change the build script in your `functions/package.json` to the following:
|
|
|
51
51
|
```js
|
|
52
52
|
"scripts": {
|
|
53
53
|
// ... omitted
|
|
54
|
-
"build": "rm -
|
|
54
|
+
"build": "rm -rf ./dist && cp -r ../dist . && tsc",
|
|
55
55
|
}
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
You will either need to install the dependencies from the `functions/package.json` or add them to your root `package.json`.
|
|
59
|
+
|
|
58
60
|
Finally, add the following to your `functions/src/index.ts`:
|
|
59
61
|
|
|
60
62
|
```ts
|
|
61
63
|
export const universal = functions.https.onRequest((request, response) => {
|
|
62
|
-
require(`${process.cwd()}/dist/YOUR_PROJECT_NAME
|
|
64
|
+
require(`${process.cwd()}/dist/YOUR_PROJECT_NAME/server/main`).app()(request, response);
|
|
63
65
|
});
|
|
64
66
|
```
|
|
65
67
|
|
|
66
|
-
|
|
68
|
+
In the `server.ts` file generated by the Angular CLI ensure that the `index.html` is being read from the correct place.
|
|
69
|
+
|
|
70
|
+
As of writing the Angular CLI generates:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index.html';
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
this needs to be changed to:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : join(distFolder, 'index.html');
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
So that the `index.html` is read from the correct `dist` folder.
|
|
83
|
+
|
|
84
|
+
You should now be able to run `npm run build` to build your project for Firebase Hosting and Cloud Functions.
|
|
85
|
+
|
|
86
|
+
To test, spin up the emulator with `firebase serve`. Once you've confirmed its working go ahead and `firebase deploy`.
|
|
67
87
|
|
|
68
|
-
|
|
88
|
+
_Note: Universal will now SSR your application and serve it, depending on how you have your deployment setup some assets may fail to
|
|
89
|
+
serve because the Cloud Function is at a different route than the `APP_BASE_REF` configured._
|
|
69
90
|
|
|
70
91
|
### [Next Step: Prerendering your Universal application](prerendering.md)
|
|
71
92
|
|
|
@@ -7,147 +7,22 @@ Server-side rendering (SSR) is the process of converting a JavaScript app to pla
|
|
|
7
7
|
- @angular/cli >= v6.0
|
|
8
8
|
- @angular/fire >= v5.0.0
|
|
9
9
|
|
|
10
|
-
## 1.
|
|
10
|
+
## 1. Add Angular Universal to your project
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Follow the steps from the [Angular Universal Tutorial](https://angular.io/guide/universal) to add Universal to your
|
|
13
|
+
project.
|
|
13
14
|
|
|
14
15
|
```
|
|
15
|
-
ng
|
|
16
|
+
ng add @nguniversal/express-engine
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
This will create all the files you need and setup all the configurations for Universal rendering for your application.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
## 2. Next Steps
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
npm install --save-dev @nguniversal/express-engine @nguniversal/module-map-ngfactory-loader express webpack-cli ts-loader ws xhr2
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Create a file called `server.ts` in the root of you project.
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
// These are important and needed before anything else
|
|
30
|
-
import 'zone.js/dist/zone-node';
|
|
31
|
-
import 'reflect-metadata';
|
|
32
|
-
|
|
33
|
-
import { enableProdMode } from '@angular/core';
|
|
34
|
-
import { ngExpressEngine } from '@nguniversal/express-engine';
|
|
35
|
-
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
|
|
36
|
-
|
|
37
|
-
import * as express from 'express';
|
|
38
|
-
import { join } from 'path';
|
|
39
|
-
import { readFileSync } from 'fs';
|
|
40
|
-
|
|
41
|
-
// Polyfills required for Firebase
|
|
42
|
-
(global as any).WebSocket = require('ws');
|
|
43
|
-
(global as any).XMLHttpRequest = require('xhr2');
|
|
44
|
-
|
|
45
|
-
// Faster renders in prod mode
|
|
46
|
-
enableProdMode();
|
|
47
|
-
|
|
48
|
-
// Export our express server
|
|
49
|
-
export const app = express();
|
|
50
|
-
|
|
51
|
-
const DIST_FOLDER = join(process.cwd(), 'dist');
|
|
52
|
-
const APP_NAME = 'YOUR_PROJECT_NAME'; // TODO: replace me!
|
|
53
|
-
|
|
54
|
-
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require(`./dist/${APP_NAME}-server/main`);
|
|
55
|
-
|
|
56
|
-
// index.html template
|
|
57
|
-
const template = readFileSync(join(DIST_FOLDER, APP_NAME, 'index.html')).toString();
|
|
58
|
-
|
|
59
|
-
app.engine('html', ngExpressEngine({
|
|
60
|
-
bootstrap: AppServerModuleNgFactory,
|
|
61
|
-
providers: [
|
|
62
|
-
provideModuleMap(LAZY_MODULE_MAP)
|
|
63
|
-
]
|
|
64
|
-
}));
|
|
65
|
-
|
|
66
|
-
app.set('view engine', 'html');
|
|
67
|
-
app.set('views', join(DIST_FOLDER, APP_NAME));
|
|
68
|
-
|
|
69
|
-
// Serve static files
|
|
70
|
-
app.get('*.*', express.static(join(DIST_FOLDER, APP_NAME)));
|
|
71
|
-
|
|
72
|
-
// All regular routes use the Universal engine
|
|
73
|
-
app.get('*', (req, res) => {
|
|
74
|
-
res.render(join(DIST_FOLDER, APP_NAME, 'index.html'), { req });
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// If we're not in the Cloud Functions environment, spin up a Node server
|
|
78
|
-
if (!process.env.FUNCTION_NAME) {
|
|
79
|
-
const PORT = process.env.PORT || 4000;
|
|
80
|
-
app.listen(PORT, () => {
|
|
81
|
-
console.log(`Node server listening on http://localhost:${PORT}`);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## 3. Add a Webpack Config for the Express Server
|
|
87
|
-
|
|
88
|
-
Create a new file named `webpack.server.config.js` to bundle the express app from previous step.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
```js
|
|
92
|
-
const path = require('path');
|
|
93
|
-
const webpack = require('webpack');
|
|
94
|
-
|
|
95
|
-
const APP_NAME = 'YOUR_PROJECT_NAME'; // TODO: replace me!
|
|
96
|
-
|
|
97
|
-
module.exports = {
|
|
98
|
-
entry: { server: './server.ts' },
|
|
99
|
-
resolve: { extensions: ['.js', '.ts'] },
|
|
100
|
-
mode: 'development',
|
|
101
|
-
target: 'node',
|
|
102
|
-
externals: [
|
|
103
|
-
/* Firebase has some troubles being webpacked when in
|
|
104
|
-
in the Node environment, let's skip it.
|
|
105
|
-
Note: you may need to exclude other dependencies depending
|
|
106
|
-
on your project. */
|
|
107
|
-
/^firebase/
|
|
108
|
-
],
|
|
109
|
-
output: {
|
|
110
|
-
// Export a UMD of the webpacked server.ts & deps, for
|
|
111
|
-
// rendering in Cloud Functions
|
|
112
|
-
path: path.join(__dirname, `dist/${APP_NAME}-webpack`),
|
|
113
|
-
library: 'app',
|
|
114
|
-
libraryTarget: 'umd',
|
|
115
|
-
filename: '[name].js'
|
|
116
|
-
},
|
|
117
|
-
module: {
|
|
118
|
-
rules: [
|
|
119
|
-
{ test: /\.ts$/, loader: 'ts-loader' }
|
|
120
|
-
]
|
|
121
|
-
},
|
|
122
|
-
plugins: [
|
|
123
|
-
new webpack.ContextReplacementPlugin(
|
|
124
|
-
/(.+)?angular(\\|\/)core(.+)?/,
|
|
125
|
-
path.join(__dirname, 'src'), // location of your src
|
|
126
|
-
{} // a map of your routes
|
|
127
|
-
),
|
|
128
|
-
new webpack.ContextReplacementPlugin(
|
|
129
|
-
/(.+)?express(\\|\/)(.+)?/,
|
|
130
|
-
path.join(__dirname, 'src'),
|
|
131
|
-
{}
|
|
132
|
-
)
|
|
133
|
-
]
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## 4.0 Build Scripts
|
|
138
|
-
|
|
139
|
-
Update your `package.json` with the following build scripts, replacing `YOUR_PROJECT_NAME` with the name of your project.
|
|
140
|
-
|
|
141
|
-
```js
|
|
142
|
-
"scripts": {
|
|
143
|
-
// ... omitted
|
|
144
|
-
"build": "ng build && npm run build:ssr",
|
|
145
|
-
"build:ssr": "ng run YOUR_PROJECT_NAME:server && npm run webpack:ssr",
|
|
146
|
-
"webpack:ssr": "webpack --config webpack.server.config.js",
|
|
147
|
-
"serve:ssr": "node dist/YOUR_PROJECT_NAME-webpack/server.js"
|
|
148
|
-
},
|
|
149
|
-
```
|
|
23
|
+
Test your app locally by running `npm run dev:ssr`.
|
|
150
24
|
|
|
151
|
-
|
|
25
|
+
_Note: `dev:ssr` is a command that was added to your `package.json` by the `ng add` command that will run the dev server
|
|
26
|
+
for your Angular with Universal._
|
|
152
27
|
|
|
153
28
|
### [Next Step: Deploying your Universal application on Cloud Functions for Firebase](cloud-functions.md)
|
package/esm2015/core.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getApps } from 'firebase/app';
|
|
|
3
3
|
import { isSupported as isRemoteConfigSupported } from 'firebase/remote-config';
|
|
4
4
|
import { isSupported as isMessagingSupported } from 'firebase/messaging';
|
|
5
5
|
import { isSupported as isAnalyticsSupported } from 'firebase/analytics';
|
|
6
|
-
export const VERSION = new Version('7.6.0-canary.
|
|
6
|
+
export const VERSION = new Version('7.6.0-canary.60943d6');
|
|
7
7
|
const isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';
|
|
8
8
|
const isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';
|
|
9
9
|
const isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';
|
package/fesm2015/angular-fire.js
CHANGED
|
@@ -7,7 +7,7 @@ import { isSupported } from 'firebase/analytics';
|
|
|
7
7
|
import { queueScheduler, asyncScheduler, Observable } from 'rxjs';
|
|
8
8
|
import { tap, observeOn, subscribeOn } from 'rxjs/operators';
|
|
9
9
|
|
|
10
|
-
const VERSION = new Version('7.6.0-canary.
|
|
10
|
+
const VERSION = new Version('7.6.0-canary.60943d6');
|
|
11
11
|
const isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';
|
|
12
12
|
const isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';
|
|
13
13
|
const isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-fire.js","sources":["../../../src/core.ts","../../../src/zones.ts","../../../src/angular-fire.ts"],"sourcesContent":["import { Version } from '@angular/core';\nimport { FirebaseApp, getApps } from 'firebase/app';\nimport { ComponentContainer } from '@firebase/component';\nimport { isSupported as isRemoteConfigSupported } from 'firebase/remote-config';\nimport { isSupported as isMessagingSupported } from 'firebase/messaging';\nimport { isSupported as isAnalyticsSupported } from 'firebase/analytics';\n\nexport const VERSION = new Version('7.6.0-canary.59b95af');\n\nconst isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';\nconst isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';\nconst isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';\nconst isRemoteConfigSupportedPromiseSymbol = '__angularfire_symbol__remoteConfigIsSupported';\nconst isMessagingSupportedValueSymbol = '__angularfire_symbol__messagingIsSupportedValue';\nconst isMessagingSupportedPromiseSymbol = '__angularfire_symbol__messagingIsSupported';\n\nglobalThis[isAnalyticsSupportedPromiseSymbol] ||= isAnalyticsSupported().then(it =>\n globalThis[isAnalyticsSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isAnalyticsSupportedValueSymbol] = false\n);\n\nglobalThis[isMessagingSupportedPromiseSymbol] ||= isMessagingSupported().then(it =>\n globalThis[isMessagingSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isMessagingSupportedValueSymbol] = false\n);\n\nglobalThis[isRemoteConfigSupportedPromiseSymbol] ||= isRemoteConfigSupported().then(it =>\n globalThis[isRemoteConfigSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isRemoteConfigSupportedValueSymbol] = false\n);\n\nconst isSupportedError = (module: string) =>\n `The APP_INITIALIZER that is \"making\" isSupported() sync for the sake of convenient DI has not resolved in this\ncontext. Rather than injecting ${module} in the constructor, first ensure that ${module} is supported by calling\n\\`await isSupported()\\`, then retrieve the instance from the injector manually \\`injector.get(${module})\\`.`;\n\nexport const ɵisMessagingSupportedFactory = {\n async: () => globalThis[isMessagingSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isMessagingSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Messaging')); }\n return ret;\n }\n};\n\nexport const ɵisRemoteConfigSupportedFactory = {\n async: () => globalThis[isRemoteConfigSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isRemoteConfigSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('RemoteConfig')); }\n return ret;\n }\n};\n\nexport const ɵisAnalyticsSupportedFactory = {\n async: () => globalThis[isAnalyticsSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isAnalyticsSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Analytics')); }\n return ret;\n }\n};\n\n// TODO is there a better way to get at the internal types?\ninterface FirebaseAppWithContainer extends FirebaseApp {\n container: ComponentContainer;\n}\n\nexport function ɵgetDefaultInstanceOf<T= unknown>(identifier: string, provided: T[]|undefined, defaultApp: FirebaseApp): T|undefined {\n if (provided) {\n // Was provide* only called once? If so grab that\n if (provided.length === 1) { return provided[0]; }\n const providedUsingDefaultApp = provided.filter((it: any) => it.app === defaultApp);\n // Was provide* only called once, using the default app? If so use that\n if (providedUsingDefaultApp.length === 1) { return providedUsingDefaultApp[0]; }\n }\n // Grab the default instance from the defaultApp\n const defaultAppWithContainer: FirebaseAppWithContainer = defaultApp as any;\n const provider = defaultAppWithContainer.container.getProvider(identifier as never);\n return provider.getImmediate({ optional: true });\n}\n\nexport const ɵgetAllInstancesOf = <T= unknown>(identifier: string, app?: FirebaseApp): Array<T> => {\n const apps = app ? [app] : getApps();\n const instances: Array<any> = [];\n apps.forEach((app: FirebaseAppWithContainer) => {\n const provider: any = app.container.getProvider(identifier as never);\n provider.instances.forEach((instance: any) => {\n if (!instances.includes(instance)) {\n instances.push(instance);\n }\n });\n });\n return instances;\n};\n","import { Injectable, NgZone } from '@angular/core';\nimport {\n asyncScheduler,\n Observable,\n Operator,\n queueScheduler,\n SchedulerAction,\n SchedulerLike,\n Subscriber,\n Subscription,\n TeardownLogic\n} from 'rxjs';\nimport { observeOn, subscribeOn, tap } from 'rxjs/operators';\n\nfunction noop() {\n}\n\n/**\n * Schedules tasks so that they are invoked inside the Zone that is passed in the constructor.\n */\n// tslint:disable-next-line:class-name\nexport class ɵZoneScheduler implements SchedulerLike {\n constructor(private zone: any, private delegate: any = queueScheduler) {\n }\n\n now() {\n return this.delegate.now();\n }\n\n schedule(work: (this: SchedulerAction<any>, state?: any) => void, delay?: number, state?: any): Subscription {\n const targetZone = this.zone;\n // Wrap the specified work function to make sure that if nested scheduling takes place the\n // work is executed in the correct zone\n const workInZone = function(this: SchedulerAction<any>, state: any) {\n targetZone.runGuarded(() => {\n work.apply(this, [state]);\n });\n };\n\n // Scheduling itself needs to be run in zone to ensure setInterval calls for async scheduling are done\n // inside the correct zone. This scheduler needs to schedule asynchronously always to ensure that\n // firebase emissions are never synchronous. Specifying a delay causes issues with the queueScheduler delegate.\n return this.delegate.schedule(workInZone, delay, state);\n }\n}\n\nclass BlockUntilFirstOperator<T> implements Operator<T, T> {\n private task: MacroTask | null = null;\n\n constructor(private zone: any) {\n }\n\n call(subscriber: Subscriber<T>, source: Observable<T>): TeardownLogic {\n const unscheduleTask = this.unscheduleTask.bind(this);\n this.task = this.zone.run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n\n return source.pipe(\n tap({ next: unscheduleTask, complete: unscheduleTask, error: unscheduleTask })\n ).subscribe(subscriber).add(unscheduleTask);\n }\n\n private unscheduleTask() {\n // maybe this is a race condition, invoke in a timeout\n // hold for 10ms while I try to figure out what is going on\n setTimeout(() => {\n if (this.task != null && this.task.state === 'scheduled') {\n this.task.invoke();\n this.task = null;\n }\n }, 10);\n }\n}\n\n@Injectable({\n providedIn: 'root',\n})\n// tslint:disable-next-line:class-name\nexport class ɵAngularFireSchedulers {\n public readonly outsideAngular: ɵZoneScheduler;\n public readonly insideAngular: ɵZoneScheduler;\n\n constructor(public ngZone: NgZone) {\n this.outsideAngular = ngZone.runOutsideAngular(() => new ɵZoneScheduler(Zone.current));\n this.insideAngular = ngZone.run(() => new ɵZoneScheduler(Zone.current, asyncScheduler));\n globalThis.ɵAngularFireScheduler ||= this;\n }\n}\n\nfunction getSchedulers() {\n const schedulers = globalThis.ɵAngularFireScheduler as ɵAngularFireSchedulers|undefined;\n if (!schedulers) {\n throw new Error(\n`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using\nprovideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);\n }\n return schedulers;\n}\n\nfunction runOutsideAngular<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.runOutsideAngular(() => fn());\n}\n\nfunction run<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.run(() => fn());\n}\n\nexport function observeOutsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().outsideAngular));\n}\n\nexport function observeInsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().insideAngular));\n}\n\nexport function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n const scheduler = getSchedulers();\n return ɵkeepUnstableUntilFirstFactory(getSchedulers())(obs$);\n}\n\n/**\n * Operator to block the zone until the first value has been emitted or the observable\n * has completed/errored. This is used to make sure that universal waits until the first\n * value from firebase but doesn't block the zone forever since the firebase subscription\n * is still alive.\n */\nexport function ɵkeepUnstableUntilFirstFactory(schedulers: ɵAngularFireSchedulers) {\n return function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n obs$ = obs$.lift(\n new BlockUntilFirstOperator(schedulers.ngZone)\n );\n\n return obs$.pipe(\n // Run the subscribe body outside of Angular (e.g. calling Firebase SDK to add a listener to a change event)\n subscribeOn(schedulers.outsideAngular),\n // Run operators inside the angular zone (e.g. side effects via tap())\n observeOn(schedulers.insideAngular)\n // INVESTIGATE https://github.com/angular/angularfire/pull/2315\n // share()\n );\n };\n}\n\nconst zoneWrapFn = (it: (...args: any[]) => any, macrotask: MacroTask|undefined) => {\n const _this = this;\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n const _arguments = arguments;\n if (macrotask) {\n setTimeout(() => {\n if (macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n }\n return run(() => it.apply(_this, _arguments));\n };\n};\n\nexport const ɵzoneWrap = <T= unknown>(it: T, blockUntilFirst: boolean): T => {\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n let macrotask: MacroTask | undefined;\n const _arguments = arguments;\n // if this is a callback function, e.g, onSnapshot, we should create a microtask and invoke it\n // only once one of the callback functions is tripped.\n for (let i = 0; i < arguments.length; i++) {\n if (typeof _arguments[i] === 'function') {\n if (blockUntilFirst) {\n macrotask ||= run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n }\n // TODO create a microtask to track callback functions\n _arguments[i] = zoneWrapFn(_arguments[i], macrotask);\n }\n }\n const ret = runOutsideAngular(() => (it as any).apply(this, _arguments));\n if (!blockUntilFirst) {\n if (ret instanceof Observable) {\n const schedulers = getSchedulers();\n return ret.pipe(\n subscribeOn(schedulers.outsideAngular),\n observeOn(schedulers.insideAngular),\n );\n } else {\n return run(() => ret);\n }\n }\n if (ret instanceof Observable) {\n return ret.pipe(keepUnstableUntilFirst) as any;\n } else if (ret instanceof Promise) {\n return run(() => new Promise((resolve, reject) => ret.then(it => run(() => resolve(it)), reason => run(() => reject(reason)))));\n } else if (typeof ret === 'function' && macrotask) {\n // Handle unsubscribe\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n setTimeout(() => {\n if (macrotask && macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n return ret.apply(this, arguments);\n };\n } else {\n // TODO how do we handle storage uploads in Zone? and other stuff with cancel() etc?\n return run(() => ret);\n }\n } as any;\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["isAnalyticsSupported","isMessagingSupported","isRemoteConfigSupported","this"],"mappings":";;;;;;;;;MAOa,OAAO,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE;AAE3D,MAAM,+BAA+B,GAAG,iDAAiD,CAAC;AAC1F,MAAM,iCAAiC,GAAG,4CAA4C,CAAC;AACvF,MAAM,kCAAkC,GAAG,oDAAoD,CAAC;AAChG,MAAM,oCAAoC,GAAG,+CAA+C,CAAC;AAC7F,MAAM,+BAA+B,GAAG,iDAAiD,CAAC;AAC1F,MAAM,iCAAiC,GAAG,4CAA4C,CAAC;AAEvF,UAAU,CAAC,iCAAiC,MAA5C,UAAU,CAAC,iCAAiC,IAAMA,WAAoB,EAAE,CAAC,IAAI,CAAC,EAAE,IAC9E,UAAU,CAAC,+BAA+B,CAAC,GAAG,EAAE,CACjD,CAAC,KAAK,CAAC,MACN,UAAU,CAAC,+BAA+B,CAAC,GAAG,KAAK,CACpD,EAAC;AAEF,UAAU,CAAC,iC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AAO,EAAE,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACjI;aAAM,IAAI,OAAO,GAAG,KAAK,UAAU,IAAI,SAAS,EAAE;;;;YAIjD,OAAO;gBACL,UAAU,CAAC;oBACT,IAAI,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,WAAW,EAAE;wBAChD,SAAS,CAAC,MAAM,EAAE,CAAC;qBACpB;iBACF,EAAE,EAAE,CAAC,CAAC;gBACP,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;aACnC,CAAC;SACH;aAAM;;YAEL,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;SACvB;KACK,CAAC;AACX;;ACjNA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"angular-fire.js","sources":["../../../src/core.ts","../../../src/zones.ts","../../../src/angular-fire.ts"],"sourcesContent":["import { Version } from '@angular/core';\nimport { FirebaseApp, getApps } from 'firebase/app';\nimport { ComponentContainer } from '@firebase/component';\nimport { isSupported as isRemoteConfigSupported } from 'firebase/remote-config';\nimport { isSupported as isMessagingSupported } from 'firebase/messaging';\nimport { isSupported as isAnalyticsSupported } from 'firebase/analytics';\n\nexport const VERSION = new Version('7.6.0-canary.60943d6');\n\nconst isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';\nconst isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';\nconst isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';\nconst isRemoteConfigSupportedPromiseSymbol = '__angularfire_symbol__remoteConfigIsSupported';\nconst isMessagingSupportedValueSymbol = '__angularfire_symbol__messagingIsSupportedValue';\nconst isMessagingSupportedPromiseSymbol = '__angularfire_symbol__messagingIsSupported';\n\nglobalThis[isAnalyticsSupportedPromiseSymbol] ||= isAnalyticsSupported().then(it =>\n globalThis[isAnalyticsSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isAnalyticsSupportedValueSymbol] = false\n);\n\nglobalThis[isMessagingSupportedPromiseSymbol] ||= isMessagingSupported().then(it =>\n globalThis[isMessagingSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isMessagingSupportedValueSymbol] = false\n);\n\nglobalThis[isRemoteConfigSupportedPromiseSymbol] ||= isRemoteConfigSupported().then(it =>\n globalThis[isRemoteConfigSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isRemoteConfigSupportedValueSymbol] = false\n);\n\nconst isSupportedError = (module: string) =>\n `The APP_INITIALIZER that is \"making\" isSupported() sync for the sake of convenient DI has not resolved in this\ncontext. Rather than injecting ${module} in the constructor, first ensure that ${module} is supported by calling\n\\`await isSupported()\\`, then retrieve the instance from the injector manually \\`injector.get(${module})\\`.`;\n\nexport const ɵisMessagingSupportedFactory = {\n async: () => globalThis[isMessagingSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isMessagingSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Messaging')); }\n return ret;\n }\n};\n\nexport const ɵisRemoteConfigSupportedFactory = {\n async: () => globalThis[isRemoteConfigSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isRemoteConfigSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('RemoteConfig')); }\n return ret;\n }\n};\n\nexport const ɵisAnalyticsSupportedFactory = {\n async: () => globalThis[isAnalyticsSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isAnalyticsSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Analytics')); }\n return ret;\n }\n};\n\n// TODO is there a better way to get at the internal types?\ninterface FirebaseAppWithContainer extends FirebaseApp {\n container: ComponentContainer;\n}\n\nexport function ɵgetDefaultInstanceOf<T= unknown>(identifier: string, provided: T[]|undefined, defaultApp: FirebaseApp): T|undefined {\n if (provided) {\n // Was provide* only called once? If so grab that\n if (provided.length === 1) { return provided[0]; }\n const providedUsingDefaultApp = provided.filter((it: any) => it.app === defaultApp);\n // Was provide* only called once, using the default app? If so use that\n if (providedUsingDefaultApp.length === 1) { return providedUsingDefaultApp[0]; }\n }\n // Grab the default instance from the defaultApp\n const defaultAppWithContainer: FirebaseAppWithContainer = defaultApp as any;\n const provider = defaultAppWithContainer.container.getProvider(identifier as never);\n return provider.getImmediate({ optional: true });\n}\n\nexport const ɵgetAllInstancesOf = <T= unknown>(identifier: string, app?: FirebaseApp): Array<T> => {\n const apps = app ? [app] : getApps();\n const instances: Array<any> = [];\n apps.forEach((app: FirebaseAppWithContainer) => {\n const provider: any = app.container.getProvider(identifier as never);\n provider.instances.forEach((instance: any) => {\n if (!instances.includes(instance)) {\n instances.push(instance);\n }\n });\n });\n return instances;\n};\n","import { Injectable, NgZone } from '@angular/core';\nimport {\n asyncScheduler,\n Observable,\n Operator,\n queueScheduler,\n SchedulerAction,\n SchedulerLike,\n Subscriber,\n Subscription,\n TeardownLogic\n} from 'rxjs';\nimport { observeOn, subscribeOn, tap } from 'rxjs/operators';\n\nfunction noop() {\n}\n\n/**\n * Schedules tasks so that they are invoked inside the Zone that is passed in the constructor.\n */\n// tslint:disable-next-line:class-name\nexport class ɵZoneScheduler implements SchedulerLike {\n constructor(private zone: any, private delegate: any = queueScheduler) {\n }\n\n now() {\n return this.delegate.now();\n }\n\n schedule(work: (this: SchedulerAction<any>, state?: any) => void, delay?: number, state?: any): Subscription {\n const targetZone = this.zone;\n // Wrap the specified work function to make sure that if nested scheduling takes place the\n // work is executed in the correct zone\n const workInZone = function(this: SchedulerAction<any>, state: any) {\n targetZone.runGuarded(() => {\n work.apply(this, [state]);\n });\n };\n\n // Scheduling itself needs to be run in zone to ensure setInterval calls for async scheduling are done\n // inside the correct zone. This scheduler needs to schedule asynchronously always to ensure that\n // firebase emissions are never synchronous. Specifying a delay causes issues with the queueScheduler delegate.\n return this.delegate.schedule(workInZone, delay, state);\n }\n}\n\nclass BlockUntilFirstOperator<T> implements Operator<T, T> {\n private task: MacroTask | null = null;\n\n constructor(private zone: any) {\n }\n\n call(subscriber: Subscriber<T>, source: Observable<T>): TeardownLogic {\n const unscheduleTask = this.unscheduleTask.bind(this);\n this.task = this.zone.run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n\n return source.pipe(\n tap({ next: unscheduleTask, complete: unscheduleTask, error: unscheduleTask })\n ).subscribe(subscriber).add(unscheduleTask);\n }\n\n private unscheduleTask() {\n // maybe this is a race condition, invoke in a timeout\n // hold for 10ms while I try to figure out what is going on\n setTimeout(() => {\n if (this.task != null && this.task.state === 'scheduled') {\n this.task.invoke();\n this.task = null;\n }\n }, 10);\n }\n}\n\n@Injectable({\n providedIn: 'root',\n})\n// tslint:disable-next-line:class-name\nexport class ɵAngularFireSchedulers {\n public readonly outsideAngular: ɵZoneScheduler;\n public readonly insideAngular: ɵZoneScheduler;\n\n constructor(public ngZone: NgZone) {\n this.outsideAngular = ngZone.runOutsideAngular(() => new ɵZoneScheduler(Zone.current));\n this.insideAngular = ngZone.run(() => new ɵZoneScheduler(Zone.current, asyncScheduler));\n globalThis.ɵAngularFireScheduler ||= this;\n }\n}\n\nfunction getSchedulers() {\n const schedulers = globalThis.ɵAngularFireScheduler as ɵAngularFireSchedulers|undefined;\n if (!schedulers) {\n throw new Error(\n`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using\nprovideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);\n }\n return schedulers;\n}\n\nfunction runOutsideAngular<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.runOutsideAngular(() => fn());\n}\n\nfunction run<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.run(() => fn());\n}\n\nexport function observeOutsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().outsideAngular));\n}\n\nexport function observeInsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().insideAngular));\n}\n\nexport function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n const scheduler = getSchedulers();\n return ɵkeepUnstableUntilFirstFactory(getSchedulers())(obs$);\n}\n\n/**\n * Operator to block the zone until the first value has been emitted or the observable\n * has completed/errored. This is used to make sure that universal waits until the first\n * value from firebase but doesn't block the zone forever since the firebase subscription\n * is still alive.\n */\nexport function ɵkeepUnstableUntilFirstFactory(schedulers: ɵAngularFireSchedulers) {\n return function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n obs$ = obs$.lift(\n new BlockUntilFirstOperator(schedulers.ngZone)\n );\n\n return obs$.pipe(\n // Run the subscribe body outside of Angular (e.g. calling Firebase SDK to add a listener to a change event)\n subscribeOn(schedulers.outsideAngular),\n // Run operators inside the angular zone (e.g. side effects via tap())\n observeOn(schedulers.insideAngular)\n // INVESTIGATE https://github.com/angular/angularfire/pull/2315\n // share()\n );\n };\n}\n\nconst zoneWrapFn = (it: (...args: any[]) => any, macrotask: MacroTask|undefined) => {\n const _this = this;\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n const _arguments = arguments;\n if (macrotask) {\n setTimeout(() => {\n if (macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n }\n return run(() => it.apply(_this, _arguments));\n };\n};\n\nexport const ɵzoneWrap = <T= unknown>(it: T, blockUntilFirst: boolean): T => {\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n let macrotask: MacroTask | undefined;\n const _arguments = arguments;\n // if this is a callback function, e.g, onSnapshot, we should create a microtask and invoke it\n // only once one of the callback functions is tripped.\n for (let i = 0; i < arguments.length; i++) {\n if (typeof _arguments[i] === 'function') {\n if (blockUntilFirst) {\n macrotask ||= run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n }\n // TODO create a microtask to track callback functions\n _arguments[i] = zoneWrapFn(_arguments[i], macrotask);\n }\n }\n const ret = runOutsideAngular(() => (it as any).apply(this, _arguments));\n if (!blockUntilFirst) {\n if (ret instanceof Observable) {\n const schedulers = getSchedulers();\n return ret.pipe(\n subscribeOn(schedulers.outsideAngular),\n observeOn(schedulers.insideAngular),\n );\n } else {\n return run(() => ret);\n }\n }\n if (ret instanceof Observable) {\n return ret.pipe(keepUnstableUntilFirst) as any;\n } else if (ret instanceof Promise) {\n return run(() => new Promise((resolve, reject) => ret.then(it => run(() => resolve(it)), reason => run(() => reject(reason)))));\n } else if (typeof ret === 'function' && macrotask) {\n // Handle unsubscribe\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n setTimeout(() => {\n if (macrotask && macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n return ret.apply(this, arguments);\n };\n } else {\n // TODO how do we handle storage uploads in Zone? and other stuff with cancel() etc?\n return run(() => ret);\n }\n } as any;\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["isAnalyticsSupported","isMessagingSupported","isRemoteConfigSupported","this"],"mappings":";;;;;;;;;MAOa,OAAO,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE;AAE3D,MAAM,+BAA+B,GAAG,iDAAiD,CAAC;AAC1F,MAAM,iCAAiC,GAAG,4CAA4C,CAAC;AACvF,MAAM,kCAAkC,GAAG,oDAAoD,CAAC;AAChG,MAAM,oCAAoC,GAAG,+CAA+C,CAAC;AAC7F,MAAM,+BAA+B,GAAG,iDAAiD,CAAC;AAC1F,MAAM,iCAAiC,GAAG,4CAA4C,CAAC;AAEvF,UAAU,CAAC,iCAAiC,MAA5C,UAAU,CAAC,iCAAiC,IAAMA,WAAoB,EAAE,CAAC,IAAI,CAAC,EAAE,IAC9E,UAAU,CAAC,+BAA+B,CAAC,GAAG,EAAE,CACjD,CAAC,KAAK,CAAC,MAC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YAAY,OAAO,EAAE;YACjC,OAAO,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACjI;aAAM,IAAI,OAAO,GAAG,KAAK,UAAU,IAAI,SAAS,EAAE;;;;YAIjD,OAAO;gBACL,UAAU,CAAC;oBACT,IAAI,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,WAAW,EAAE;wBAChD,SAAS,CAAC,MAAM,EAAE,CAAC;qBACpB;iBACF,EAAE,EAAE,CAAC,CAAC;gBACP,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;aACnC,CAAC;SACH;aAAM;;YAEL,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;SACvB;KACK,CAAC;AACX;;ACjNA;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../node_modules/ng-packagr/package.schema.json",
|
|
3
3
|
"name": "@angular/fire",
|
|
4
|
-
"version": "7.6.0-canary.
|
|
4
|
+
"version": "7.6.0-canary.60943d6",
|
|
5
5
|
"description": "The official Angular library for Firebase.",
|
|
6
6
|
"schematics": "./schematics/collection.json",
|
|
7
7
|
"builders": "./schematics/builders.json",
|
|
@@ -315,35 +315,31 @@ const deployToCloudRun = (firebaseTools, context, workspaceRoot, staticBuildTarg
|
|
|
315
315
|
exports.deployToCloudRun = deployToCloudRun;
|
|
316
316
|
function deploy(firebaseTools, context, staticBuildTarget, serverBuildTarget, prerenderBuildTarget, firebaseProject, options, firebaseToken) {
|
|
317
317
|
return __awaiter(this, void 0, void 0, function* () {
|
|
318
|
-
if (!firebaseToken) {
|
|
318
|
+
if (!firebaseToken && !process.env.GOOGLE_APPLICATION_CREDENTIALS) {
|
|
319
319
|
yield firebaseTools.login();
|
|
320
320
|
const user = yield firebaseTools.login({ projectRoot: context.workspaceRoot });
|
|
321
321
|
console.log(`Logged into Firebase as ${user.email}.`);
|
|
322
322
|
}
|
|
323
|
-
if (
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
323
|
+
if (!firebaseToken && process.env.GOOGLE_APPLICATION_CREDENTIALS) {
|
|
324
|
+
yield spawnAsync(`gcloud auth activate-service-account --key-file ${process.env.GOOGLE_APPLICATION_CREDENTIALS}`);
|
|
325
|
+
console.log(`Using Google Application Credentials.`);
|
|
326
|
+
}
|
|
327
|
+
if (prerenderBuildTarget) {
|
|
328
|
+
const run = yield context.scheduleTarget(architect_1.targetFromTargetString(prerenderBuildTarget.name), prerenderBuildTarget.options);
|
|
329
|
+
yield run.result;
|
|
328
330
|
}
|
|
329
331
|
else {
|
|
330
|
-
if (
|
|
331
|
-
|
|
332
|
-
yield run.result;
|
|
332
|
+
if (!context.target) {
|
|
333
|
+
throw new Error('Cannot execute the build target');
|
|
333
334
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
context.scheduleTarget(architect_1.targetFromTargetString(staticBuildTarget.name), staticBuildTarget.options).then(run => run.result)
|
|
341
|
-
];
|
|
342
|
-
if (serverBuildTarget) {
|
|
343
|
-
builders.push(context.scheduleTarget(architect_1.targetFromTargetString(serverBuildTarget.name), serverBuildTarget.options).then(run => run.result));
|
|
344
|
-
}
|
|
345
|
-
yield Promise.all(builders);
|
|
335
|
+
context.logger.info(`📦 Building "${context.target.project}"`);
|
|
336
|
+
const builders = [
|
|
337
|
+
context.scheduleTarget(architect_1.targetFromTargetString(staticBuildTarget.name), staticBuildTarget.options).then(run => run.result)
|
|
338
|
+
];
|
|
339
|
+
if (serverBuildTarget) {
|
|
340
|
+
builders.push(context.scheduleTarget(architect_1.targetFromTargetString(serverBuildTarget.name), serverBuildTarget.options).then(run => run.result));
|
|
346
341
|
}
|
|
342
|
+
yield Promise.all(builders);
|
|
347
343
|
}
|
|
348
344
|
try {
|
|
349
345
|
yield firebaseTools.use(firebaseProject, {
|