UNPKG

22.6 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('firebase/compat/functions'), require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/fire/compat'), require('@angular/fire'), require('@angular/fire/app-check'), require('firebase/compat/app')) :
3 typeof define === 'function' && define.amd ? define('@angular/fire/compat/functions', ['exports', 'firebase/compat/functions', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/fire/compat', '@angular/fire', '@angular/fire/app-check', 'firebase/compat/app'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.angular = global.angular || {}, global.angular.fire = global.angular.fire || {}, global.angular.fire.compat = global.angular.fire.compat || {}, global.angular.fire.compat.functions = {}), null, global.ng.core, global.rxjs, global.rxjs.operators, global.angular.fire.compat, global.angular.fire, global.angular.fire['app-check'], global.firebase));
5}(this, (function (exports, functions, i0, rxjs, operators, compat, i1, i2, firebase) { 'use strict';
6
7 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
9 function _interopNamespace(e) {
10 if (e && e.__esModule) return e;
11 var n = Object.create(null);
12 if (e) {
13 Object.keys(e).forEach(function (k) {
14 if (k !== 'default') {
15 var d = Object.getOwnPropertyDescriptor(e, k);
16 Object.defineProperty(n, k, d.get ? d : {
17 enumerable: true,
18 get: function () {
19 return e[k];
20 }
21 });
22 }
23 });
24 }
25 n['default'] = e;
26 return Object.freeze(n);
27 }
28
29 var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
30 var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
31 var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
32 var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
33
34 /*! *****************************************************************************
35 Copyright (c) Microsoft Corporation.
36
37 Permission to use, copy, modify, and/or distribute this software for any
38 purpose with or without fee is hereby granted.
39
40 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
41 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
42 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
43 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
44 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
45 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
46 PERFORMANCE OF THIS SOFTWARE.
47 ***************************************************************************** */
48 /* global Reflect, Promise */
49 var extendStatics = function (d, b) {
50 extendStatics = Object.setPrototypeOf ||
51 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
52 function (d, b) { for (var p in b)
53 if (Object.prototype.hasOwnProperty.call(b, p))
54 d[p] = b[p]; };
55 return extendStatics(d, b);
56 };
57 function __extends(d, b) {
58 if (typeof b !== "function" && b !== null)
59 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
60 extendStatics(d, b);
61 function __() { this.constructor = d; }
62 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
63 }
64 var __assign = function () {
65 __assign = Object.assign || function __assign(t) {
66 for (var s, i = 1, n = arguments.length; i < n; i++) {
67 s = arguments[i];
68 for (var p in s)
69 if (Object.prototype.hasOwnProperty.call(s, p))
70 t[p] = s[p];
71 }
72 return t;
73 };
74 return __assign.apply(this, arguments);
75 };
76 function __rest(s, e) {
77 var t = {};
78 for (var p in s)
79 if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
80 t[p] = s[p];
81 if (s != null && typeof Object.getOwnPropertySymbols === "function")
82 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
83 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
84 t[p[i]] = s[p[i]];
85 }
86 return t;
87 }
88 function __decorate(decorators, target, key, desc) {
89 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
90 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
91 r = Reflect.decorate(decorators, target, key, desc);
92 else
93 for (var i = decorators.length - 1; i >= 0; i--)
94 if (d = decorators[i])
95 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
96 return c > 3 && r && Object.defineProperty(target, key, r), r;
97 }
98 function __param(paramIndex, decorator) {
99 return function (target, key) { decorator(target, key, paramIndex); };
100 }
101 function __metadata(metadataKey, metadataValue) {
102 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
103 return Reflect.metadata(metadataKey, metadataValue);
104 }
105 function __awaiter(thisArg, _arguments, P, generator) {
106 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
107 return new (P || (P = Promise))(function (resolve, reject) {
108 function fulfilled(value) { try {
109 step(generator.next(value));
110 }
111 catch (e) {
112 reject(e);
113 } }
114 function rejected(value) { try {
115 step(generator["throw"](value));
116 }
117 catch (e) {
118 reject(e);
119 } }
120 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
121 step((generator = generator.apply(thisArg, _arguments || [])).next());
122 });
123 }
124 function __generator(thisArg, body) {
125 var _ = { label: 0, sent: function () { if (t[0] & 1)
126 throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
127 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
128 function verb(n) { return function (v) { return step([n, v]); }; }
129 function step(op) {
130 if (f)
131 throw new TypeError("Generator is already executing.");
132 while (_)
133 try {
134 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
135 return t;
136 if (y = 0, t)
137 op = [op[0] & 2, t.value];
138 switch (op[0]) {
139 case 0:
140 case 1:
141 t = op;
142 break;
143 case 4:
144 _.label++;
145 return { value: op[1], done: false };
146 case 5:
147 _.label++;
148 y = op[1];
149 op = [0];
150 continue;
151 case 7:
152 op = _.ops.pop();
153 _.trys.pop();
154 continue;
155 default:
156 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
157 _ = 0;
158 continue;
159 }
160 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
161 _.label = op[1];
162 break;
163 }
164 if (op[0] === 6 && _.label < t[1]) {
165 _.label = t[1];
166 t = op;
167 break;
168 }
169 if (t && _.label < t[2]) {
170 _.label = t[2];
171 _.ops.push(op);
172 break;
173 }
174 if (t[2])
175 _.ops.pop();
176 _.trys.pop();
177 continue;
178 }
179 op = body.call(thisArg, _);
180 }
181 catch (e) {
182 op = [6, e];
183 y = 0;
184 }
185 finally {
186 f = t = 0;
187 }
188 if (op[0] & 5)
189 throw op[1];
190 return { value: op[0] ? op[1] : void 0, done: true };
191 }
192 }
193 var __createBinding = Object.create ? (function (o, m, k, k2) {
194 if (k2 === undefined)
195 k2 = k;
196 Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
197 }) : (function (o, m, k, k2) {
198 if (k2 === undefined)
199 k2 = k;
200 o[k2] = m[k];
201 });
202 function __exportStar(m, o) {
203 for (var p in m)
204 if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
205 __createBinding(o, m, p);
206 }
207 function __values(o) {
208 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
209 if (m)
210 return m.call(o);
211 if (o && typeof o.length === "number")
212 return {
213 next: function () {
214 if (o && i >= o.length)
215 o = void 0;
216 return { value: o && o[i++], done: !o };
217 }
218 };
219 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
220 }
221 function __read(o, n) {
222 var m = typeof Symbol === "function" && o[Symbol.iterator];
223 if (!m)
224 return o;
225 var i = m.call(o), r, ar = [], e;
226 try {
227 while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
228 ar.push(r.value);
229 }
230 catch (error) {
231 e = { error: error };
232 }
233 finally {
234 try {
235 if (r && !r.done && (m = i["return"]))
236 m.call(i);
237 }
238 finally {
239 if (e)
240 throw e.error;
241 }
242 }
243 return ar;
244 }
245 /** @deprecated */
246 function __spread() {
247 for (var ar = [], i = 0; i < arguments.length; i++)
248 ar = ar.concat(__read(arguments[i]));
249 return ar;
250 }
251 /** @deprecated */
252 function __spreadArrays() {
253 for (var s = 0, i = 0, il = arguments.length; i < il; i++)
254 s += arguments[i].length;
255 for (var r = Array(s), k = 0, i = 0; i < il; i++)
256 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
257 r[k] = a[j];
258 return r;
259 }
260 function __spreadArray(to, from) {
261 for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
262 to[j] = from[i];
263 return to;
264 }
265 function __await(v) {
266 return this instanceof __await ? (this.v = v, this) : new __await(v);
267 }
268 function __asyncGenerator(thisArg, _arguments, generator) {
269 if (!Symbol.asyncIterator)
270 throw new TypeError("Symbol.asyncIterator is not defined.");
271 var g = generator.apply(thisArg, _arguments || []), i, q = [];
272 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
273 function verb(n) { if (g[n])
274 i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
275 function resume(n, v) { try {
276 step(g[n](v));
277 }
278 catch (e) {
279 settle(q[0][3], e);
280 } }
281 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
282 function fulfill(value) { resume("next", value); }
283 function reject(value) { resume("throw", value); }
284 function settle(f, v) { if (f(v), q.shift(), q.length)
285 resume(q[0][0], q[0][1]); }
286 }
287 function __asyncDelegator(o) {
288 var i, p;
289 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
290 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
291 }
292 function __asyncValues(o) {
293 if (!Symbol.asyncIterator)
294 throw new TypeError("Symbol.asyncIterator is not defined.");
295 var m = o[Symbol.asyncIterator], i;
296 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
297 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
298 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
299 }
300 function __makeTemplateObject(cooked, raw) {
301 if (Object.defineProperty) {
302 Object.defineProperty(cooked, "raw", { value: raw });
303 }
304 else {
305 cooked.raw = raw;
306 }
307 return cooked;
308 }
309 ;
310 var __setModuleDefault = Object.create ? (function (o, v) {
311 Object.defineProperty(o, "default", { enumerable: true, value: v });
312 }) : function (o, v) {
313 o["default"] = v;
314 };
315 function __importStar(mod) {
316 if (mod && mod.__esModule)
317 return mod;
318 var result = {};
319 if (mod != null)
320 for (var k in mod)
321 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
322 __createBinding(result, mod, k);
323 __setModuleDefault(result, mod);
324 return result;
325 }
326 function __importDefault(mod) {
327 return (mod && mod.__esModule) ? mod : { default: mod };
328 }
329 function __classPrivateFieldGet(receiver, state, kind, f) {
330 if (kind === "a" && !f)
331 throw new TypeError("Private accessor was defined without a getter");
332 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
333 throw new TypeError("Cannot read private member from an object whose class did not declare it");
334 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
335 }
336 function __classPrivateFieldSet(receiver, state, value, kind, f) {
337 if (kind === "m")
338 throw new TypeError("Private method is not writable");
339 if (kind === "a" && !f)
340 throw new TypeError("Private accessor was defined without a setter");
341 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
342 throw new TypeError("Cannot write private member to an object whose class did not declare it");
343 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
344 }
345
346 // DO NOT MODIFY, this file is autogenerated by tools/build.ts
347 // Export a null object with the same keys as firebase/compat/functions, so Proxy can work with proxy-polyfill in Internet Explorer
348 var proxyPolyfillCompat = {
349 useEmulator: null,
350 useFunctionsEmulator: null,
351 httpsCallable: null,
352 };
353
354 var ORIGIN = new i0.InjectionToken('angularfire2.functions.origin');
355 var REGION = new i0.InjectionToken('angularfire2.functions.region');
356 var USE_EMULATOR = new i0.InjectionToken('angularfire2.functions.use-emulator');
357 var AngularFireFunctions = /** @class */ (function () {
358 function AngularFireFunctions(options, name, zone, schedulers, region, origin, _useEmulator, // can't use the tuple here
359 _appCheckInstances) {
360 var useEmulator = _useEmulator;
361 var functions = rxjs.of(undefined).pipe(operators.observeOn(schedulers.outsideAngular), operators.switchMap(function () { return rxjs.of(undefined); }), operators.map(function () { return compat.ɵfirebaseAppFactory(options, zone, name); }), operators.map(function (app) { return compat.ɵcacheInstance(app.name + ".functions." + (region || origin), 'AngularFireFunctions', app.name, function () {
362 var functions;
363 if (region && origin) {
364 throw new Error('REGION and ORIGIN can\'t be used at the same time.');
365 }
366 functions = app.functions(region || origin || undefined);
367 if (useEmulator) {
368 functions.useEmulator.apply(functions, __spreadArray([], __read(useEmulator)));
369 }
370 return functions;
371 }, [region, origin, useEmulator]); }), operators.shareReplay({ bufferSize: 1, refCount: false }));
372 this.httpsCallable = function (name, options) { return function (data) { return rxjs.from(functions).pipe(operators.observeOn(schedulers.insideAngular), operators.switchMap(function (functions) { return functions.httpsCallable(name, options)(data); }), operators.map(function (r) { return r.data; })); }; };
373 return compat.ɵlazySDKProxy(this, functions, zone);
374 }
375 return AngularFireFunctions;
376 }());
377 AngularFireFunctions.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireFunctions, deps: [{ token: compat.FIREBASE_OPTIONS }, { token: compat.FIREBASE_APP_NAME, optional: true }, { token: i0__namespace.NgZone }, { token: i1__namespace.ɵAngularFireSchedulers }, { token: REGION, optional: true }, { token: ORIGIN, optional: true }, { token: USE_EMULATOR, optional: true }, { token: i2__namespace.AppCheckInstances, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
378 AngularFireFunctions.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireFunctions, providedIn: 'any' });
379 i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireFunctions, decorators: [{
380 type: i0.Injectable,
381 args: [{
382 providedIn: 'any'
383 }]
384 }], ctorParameters: function () {
385 return [{ type: undefined, decorators: [{
386 type: i0.Inject,
387 args: [compat.FIREBASE_OPTIONS]
388 }] }, { type: undefined, decorators: [{
389 type: i0.Optional
390 }, {
391 type: i0.Inject,
392 args: [compat.FIREBASE_APP_NAME]
393 }] }, { type: i0__namespace.NgZone }, { type: i1__namespace.ɵAngularFireSchedulers }, { type: undefined, decorators: [{
394 type: i0.Optional
395 }, {
396 type: i0.Inject,
397 args: [REGION]
398 }] }, { type: undefined, decorators: [{
399 type: i0.Optional
400 }, {
401 type: i0.Inject,
402 args: [ORIGIN]
403 }] }, { type: undefined, decorators: [{
404 type: i0.Optional
405 }, {
406 type: i0.Inject,
407 args: [USE_EMULATOR]
408 }] }, { type: i2__namespace.AppCheckInstances, decorators: [{
409 type: i0.Optional
410 }] }];
411 } });
412 compat.ɵapplyMixins(AngularFireFunctions, [proxyPolyfillCompat]);
413
414 var AngularFireFunctionsModule = /** @class */ (function () {
415 function AngularFireFunctionsModule() {
416 firebase__default['default'].registerVersion('angularfire', i1.VERSION.full, 'fn-compat');
417 }
418 return AngularFireFunctionsModule;
419 }());
420 AngularFireFunctionsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireFunctionsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
421 AngularFireFunctionsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireFunctionsModule });
422 AngularFireFunctionsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireFunctionsModule, providers: [AngularFireFunctions] });
423 i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFireFunctionsModule, decorators: [{
424 type: i0.NgModule,
425 args: [{
426 providers: [AngularFireFunctions]
427 }]
428 }], ctorParameters: function () { return []; } });
429
430 /**
431 * Generated bundle index. Do not edit.
432 */
433
434 exports.AngularFireFunctions = AngularFireFunctions;
435 exports.AngularFireFunctionsModule = AngularFireFunctionsModule;
436 exports.ORIGIN = ORIGIN;
437 exports.REGION = REGION;
438 exports.USE_EMULATOR = USE_EMULATOR;
439
440 Object.defineProperty(exports, '__esModule', { value: true });
441
442})));
443//# sourceMappingURL=angular-fire-compat-functions.umd.js.map