UNPKG

6.46 kBSource Map (JSON)View Raw
1{"version":3,"file":"angular-fire-compat-functions.js","sources":["../../../src/compat/functions/base.ts","../../../src/compat/functions/functions.ts","../../../src/compat/functions/functions.module.ts","../../../src/compat/functions/angular-fire-compat-functions.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/functions, so Proxy can work with proxy-polyfill in Internet Explorer\nexport const proxyPolyfillCompat = {\n useEmulator: null,\n useFunctionsEmulator: null,\n httpsCallable: null,\n};\n","import { Inject, Injectable, InjectionToken, NgZone, Optional } from '@angular/core';\nimport { from, Observable, of } from 'rxjs';\nimport { map, observeOn, shareReplay, switchMap } from 'rxjs/operators';\nimport { ɵAngularFireSchedulers } from '@angular/fire';\nimport { ɵlazySDKProxy, ɵPromiseProxy, ɵapplyMixins } from '@angular/fire/compat';\nimport { FirebaseOptions } from 'firebase/app';\nimport { ɵfirebaseAppFactory, FIREBASE_APP_NAME, FIREBASE_OPTIONS, ɵcacheInstance } from '@angular/fire/compat';\nimport firebase from 'firebase/compat/app';\nimport { proxyPolyfillCompat } from './base';\nimport { HttpsCallableOptions } from '@firebase/functions-types';\nimport { AppCheckInstances } from '@angular/fire/app-check';\n\nexport const ORIGIN = new InjectionToken<string>('angularfire2.functions.origin');\nexport const REGION = new InjectionToken<string>('angularfire2.functions.region');\n\ntype UseEmulatorArguments = Parameters<firebase.functions.Functions['useEmulator']>;\nexport const USE_EMULATOR = new InjectionToken<UseEmulatorArguments>('angularfire2.functions.use-emulator');\n\n// override httpsCallable for compatibility with 5.x\nexport interface AngularFireFunctions extends Omit<ɵPromiseProxy<firebase.functions.Functions>, 'httpsCallable'> {\n}\n\n@Injectable({\n providedIn: 'any'\n})\nexport class AngularFireFunctions {\n\n public readonly httpsCallable: <T = any, R = any>(name: string, options?: HttpsCallableOptions) => (data: T) => Observable<R>;\n\n constructor(\n @Inject(FIREBASE_OPTIONS) options: FirebaseOptions,\n @Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,\n zone: NgZone,\n schedulers: ɵAngularFireSchedulers,\n @Optional() @Inject(REGION) region: string | null,\n @Optional() @Inject(ORIGIN) origin: string | null,\n @Optional() @Inject(USE_EMULATOR) _useEmulator: any, // can't use the tuple here\n @Optional() _appCheckInstances: AppCheckInstances,\n ) {\n const useEmulator: UseEmulatorArguments | null = _useEmulator;\n\n const functions = of(undefined).pipe(\n observeOn(schedulers.outsideAngular),\n switchMap(() => import('firebase/compat/functions')),\n map(() => ɵfirebaseAppFactory(options, zone, name)),\n map(app => ɵcacheInstance(`${app.name}.functions.${region || origin}`, 'AngularFireFunctions', app.name, () => {\n let functions: firebase.functions.Functions;\n if (region && origin) {\n throw new Error('REGION and ORIGIN can\\'t be used at the same time.');\n }\n functions = app.functions(region || origin || undefined);\n if (useEmulator) {\n functions.useEmulator(...useEmulator);\n }\n return functions;\n }, [region, origin, useEmulator])),\n shareReplay({ bufferSize: 1, refCount: false })\n );\n\n this.httpsCallable = <T = any, R = any>(name: string, options?: HttpsCallableOptions) =>\n (data: T) => from(functions).pipe(\n observeOn(schedulers.insideAngular),\n switchMap(functions => functions.httpsCallable(name, options)(data)),\n map(r => r.data as R)\n );\n\n return ɵlazySDKProxy(this, functions, zone);\n\n }\n\n}\n\nɵapplyMixins(AngularFireFunctions, [proxyPolyfillCompat]);\n","import { NgModule } from '@angular/core';\nimport { AngularFireFunctions } from './functions';\nimport firebase from 'firebase/compat/app';\nimport { VERSION } from '@angular/fire';\n\n@NgModule({\n providers: [ AngularFireFunctions ]\n})\nexport class AngularFireFunctionsModule {\n constructor() {\n firebase.registerVersion('angularfire', VERSION.full, 'fn-compat');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;AACA;AACO,MAAM,mBAAmB,GAAG;IACjC,WAAW,EAAE,IAAI;IACjB,oBAAoB,EAAE,IAAI;IAC1B,aAAa,EAAE,IAAI;CACpB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