From 8eff962cab608341a6f2fedc640a0e32d96f26e2 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Sun, 9 Nov 2025 11:15:19 +0800 Subject: pain --- .../@firebase/functions/dist/esm/index.esm.js | 970 ++++++++++++++++++++ .../@firebase/functions/dist/esm/index.esm.js.map | 1 + .../@firebase/functions/dist/esm/package.json | 1 + .../@firebase/functions/dist/esm/src/api.d.ts | 51 ++ .../@firebase/functions/dist/esm/src/config.d.ts | 17 + .../functions/dist/esm/src/constants.d.ts | 20 + .../@firebase/functions/dist/esm/src/context.d.ts | 46 + .../@firebase/functions/dist/esm/src/error.d.ts | 49 ++ .../@firebase/functions/dist/esm/src/index.d.ts | 7 + .../functions/dist/esm/src/public-types.d.ts | 150 ++++ .../functions/dist/esm/src/serializer.d.ts | 14 + .../@firebase/functions/dist/esm/src/service.d.ts | 86 ++ .../@firebase/functions/dist/esm/test/utils.d.ts | 21 + .../@firebase/functions/dist/functions-public.d.ts | 208 +++++ .../@firebase/functions/dist/functions.d.ts | 208 +++++ .../@firebase/functions/dist/index.cjs.js | 978 +++++++++++++++++++++ .../@firebase/functions/dist/index.cjs.js.map | 1 + .../@firebase/functions/dist/src/api.d.ts | 51 ++ .../@firebase/functions/dist/src/config.d.ts | 17 + .../@firebase/functions/dist/src/constants.d.ts | 20 + .../@firebase/functions/dist/src/context.d.ts | 46 + .../@firebase/functions/dist/src/error.d.ts | 49 ++ .../@firebase/functions/dist/src/index.d.ts | 7 + .../@firebase/functions/dist/src/public-types.d.ts | 150 ++++ .../@firebase/functions/dist/src/serializer.d.ts | 14 + .../@firebase/functions/dist/src/service.d.ts | 86 ++ .../functions/dist/src/tsdoc-metadata.json | 11 + .../@firebase/functions/dist/test/utils.d.ts | 21 + 28 files changed, 3300 insertions(+) create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/index.esm.js create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/index.esm.js.map create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/package.json create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/src/api.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/src/config.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/src/constants.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/src/context.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/src/error.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/src/index.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/src/public-types.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/src/serializer.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/src/service.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/esm/test/utils.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/functions-public.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/functions.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/index.cjs.js create mode 100644 frontend-old/node_modules/@firebase/functions/dist/index.cjs.js.map create mode 100644 frontend-old/node_modules/@firebase/functions/dist/src/api.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/src/config.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/src/constants.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/src/context.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/src/error.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/src/index.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/src/public-types.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/src/serializer.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/src/service.d.ts create mode 100644 frontend-old/node_modules/@firebase/functions/dist/src/tsdoc-metadata.json create mode 100644 frontend-old/node_modules/@firebase/functions/dist/test/utils.d.ts (limited to 'frontend-old/node_modules/@firebase/functions/dist') diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/index.esm.js b/frontend-old/node_modules/@firebase/functions/dist/esm/index.esm.js new file mode 100644 index 0000000..a181f4f --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/index.esm.js @@ -0,0 +1,970 @@ +import { _isFirebaseServerApp, _registerComponent, registerVersion, _getProvider, getApp } from '@firebase/app'; +import { FirebaseError, isCloudWorkstation, pingServer, updateEmulatorBanner, getModularInstance, getDefaultEmulatorHostnameAndPort } from '@firebase/util'; +import { Component } from '@firebase/component'; + +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const LONG_TYPE = 'type.googleapis.com/google.protobuf.Int64Value'; +const UNSIGNED_LONG_TYPE = 'type.googleapis.com/google.protobuf.UInt64Value'; +function mapValues( +// { [k: string]: unknown } is no longer a wildcard assignment target after typescript 3.5 +// eslint-disable-next-line @typescript-eslint/no-explicit-any +o, f) { + const result = {}; + for (const key in o) { + if (o.hasOwnProperty(key)) { + result[key] = f(o[key]); + } + } + return result; +} +/** + * Takes data and encodes it in a JSON-friendly way, such that types such as + * Date are preserved. + * @internal + * @param data - Data to encode. + */ +function encode(data) { + if (data == null) { + return null; + } + if (data instanceof Number) { + data = data.valueOf(); + } + if (typeof data === 'number' && isFinite(data)) { + // Any number in JS is safe to put directly in JSON and parse as a double + // without any loss of precision. + return data; + } + if (data === true || data === false) { + return data; + } + if (Object.prototype.toString.call(data) === '[object String]') { + return data; + } + if (data instanceof Date) { + return data.toISOString(); + } + if (Array.isArray(data)) { + return data.map(x => encode(x)); + } + if (typeof data === 'function' || typeof data === 'object') { + return mapValues(data, x => encode(x)); + } + // If we got this far, the data is not encodable. + throw new Error('Data cannot be encoded in JSON: ' + data); +} +/** + * Takes data that's been encoded in a JSON-friendly form and returns a form + * with richer datatypes, such as Dates, etc. + * @internal + * @param json - JSON to convert. + */ +function decode(json) { + if (json == null) { + return json; + } + if (json['@type']) { + switch (json['@type']) { + case LONG_TYPE: + // Fall through and handle this the same as unsigned. + case UNSIGNED_LONG_TYPE: { + // Technically, this could work return a valid number for malformed + // data if there was a number followed by garbage. But it's just not + // worth all the extra code to detect that case. + const value = Number(json['value']); + if (isNaN(value)) { + throw new Error('Data cannot be decoded from JSON: ' + json); + } + return value; + } + default: { + throw new Error('Data cannot be decoded from JSON: ' + json); + } + } + } + if (Array.isArray(json)) { + return json.map(x => decode(x)); + } + if (typeof json === 'function' || typeof json === 'object') { + return mapValues(json, x => decode(x)); + } + // Anything else is safe to return. + return json; +} + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Type constant for Firebase Functions. + */ +const FUNCTIONS_TYPE = 'functions'; + +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Standard error codes for different ways a request can fail, as defined by: + * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto + * + * This map is used primarily to convert from a backend error code string to + * a client SDK error code string, and make sure it's in the supported set. + */ +const errorCodeMap = { + OK: 'ok', + CANCELLED: 'cancelled', + UNKNOWN: 'unknown', + INVALID_ARGUMENT: 'invalid-argument', + DEADLINE_EXCEEDED: 'deadline-exceeded', + NOT_FOUND: 'not-found', + ALREADY_EXISTS: 'already-exists', + PERMISSION_DENIED: 'permission-denied', + UNAUTHENTICATED: 'unauthenticated', + RESOURCE_EXHAUSTED: 'resource-exhausted', + FAILED_PRECONDITION: 'failed-precondition', + ABORTED: 'aborted', + OUT_OF_RANGE: 'out-of-range', + UNIMPLEMENTED: 'unimplemented', + INTERNAL: 'internal', + UNAVAILABLE: 'unavailable', + DATA_LOSS: 'data-loss' +}; +/** + * An error returned by the Firebase Functions client SDK. + * + * See {@link FunctionsErrorCode} for full documentation of codes. + * + * @public + */ +class FunctionsError extends FirebaseError { + /** + * Constructs a new instance of the `FunctionsError` class. + */ + constructor( + /** + * A standard error code that will be returned to the client. This also + * determines the HTTP status code of the response, as defined in code.proto. + */ + code, message, + /** + * Additional details to be converted to JSON and included in the error response. + */ + details) { + super(`${FUNCTIONS_TYPE}/${code}`, message || ''); + this.details = details; + // Since the FirebaseError constructor sets the prototype of `this` to FirebaseError.prototype, + // we also have to do it in all subclasses to allow for correct `instanceof` checks. + Object.setPrototypeOf(this, FunctionsError.prototype); + } +} +/** + * Takes an HTTP status code and returns the corresponding ErrorCode. + * This is the standard HTTP status code -> error mapping defined in: + * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto + * + * @param status An HTTP status code. + * @return The corresponding ErrorCode, or ErrorCode.UNKNOWN if none. + */ +function codeForHTTPStatus(status) { + // Make sure any successful status is OK. + if (status >= 200 && status < 300) { + return 'ok'; + } + switch (status) { + case 0: + // This can happen if the server returns 500. + return 'internal'; + case 400: + return 'invalid-argument'; + case 401: + return 'unauthenticated'; + case 403: + return 'permission-denied'; + case 404: + return 'not-found'; + case 409: + return 'aborted'; + case 429: + return 'resource-exhausted'; + case 499: + return 'cancelled'; + case 500: + return 'internal'; + case 501: + return 'unimplemented'; + case 503: + return 'unavailable'; + case 504: + return 'deadline-exceeded'; + } + return 'unknown'; +} +/** + * Takes an HTTP response and returns the corresponding Error, if any. + */ +function _errorForResponse(status, bodyJSON) { + let code = codeForHTTPStatus(status); + // Start with reasonable defaults from the status code. + let description = code; + let details = undefined; + // Then look through the body for explicit details. + try { + const errorJSON = bodyJSON && bodyJSON.error; + if (errorJSON) { + const status = errorJSON.status; + if (typeof status === 'string') { + if (!errorCodeMap[status]) { + // They must've included an unknown error code in the body. + return new FunctionsError('internal', 'internal'); + } + code = errorCodeMap[status]; + // TODO(klimt): Add better default descriptions for error enums. + // The default description needs to be updated for the new code. + description = status; + } + const message = errorJSON.message; + if (typeof message === 'string') { + description = message; + } + details = errorJSON.details; + if (details !== undefined) { + details = decode(details); + } + } + } + catch (e) { + // If we couldn't parse explicit error data, that's fine. + } + if (code === 'ok') { + // Technically, there's an edge case where a developer could explicitly + // return an error code of OK, and we will treat it as success, but that + // seems reasonable. + return null; + } + return new FunctionsError(code, description, details); +} + +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Helper class to get metadata that should be included with a function call. + * @internal + */ +class ContextProvider { + constructor(app, authProvider, messagingProvider, appCheckProvider) { + this.app = app; + this.auth = null; + this.messaging = null; + this.appCheck = null; + this.serverAppAppCheckToken = null; + if (_isFirebaseServerApp(app) && app.settings.appCheckToken) { + this.serverAppAppCheckToken = app.settings.appCheckToken; + } + this.auth = authProvider.getImmediate({ optional: true }); + this.messaging = messagingProvider.getImmediate({ + optional: true + }); + if (!this.auth) { + authProvider.get().then(auth => (this.auth = auth), () => { + /* get() never rejects */ + }); + } + if (!this.messaging) { + messagingProvider.get().then(messaging => (this.messaging = messaging), () => { + /* get() never rejects */ + }); + } + if (!this.appCheck) { + appCheckProvider?.get().then(appCheck => (this.appCheck = appCheck), () => { + /* get() never rejects */ + }); + } + } + async getAuthToken() { + if (!this.auth) { + return undefined; + } + try { + const token = await this.auth.getToken(); + return token?.accessToken; + } + catch (e) { + // If there's any error when trying to get the auth token, leave it off. + return undefined; + } + } + async getMessagingToken() { + if (!this.messaging || + !('Notification' in self) || + Notification.permission !== 'granted') { + return undefined; + } + try { + return await this.messaging.getToken(); + } + catch (e) { + // We don't warn on this, because it usually means messaging isn't set up. + // console.warn('Failed to retrieve instance id token.', e); + // If there's any error when trying to get the token, leave it off. + return undefined; + } + } + async getAppCheckToken(limitedUseAppCheckTokens) { + if (this.serverAppAppCheckToken) { + return this.serverAppAppCheckToken; + } + if (this.appCheck) { + const result = limitedUseAppCheckTokens + ? await this.appCheck.getLimitedUseToken() + : await this.appCheck.getToken(); + if (result.error) { + // Do not send the App Check header to the functions endpoint if + // there was an error from the App Check exchange endpoint. The App + // Check SDK will already have logged the error to console. + return null; + } + return result.token; + } + return null; + } + async getContext(limitedUseAppCheckTokens) { + const authToken = await this.getAuthToken(); + const messagingToken = await this.getMessagingToken(); + const appCheckToken = await this.getAppCheckToken(limitedUseAppCheckTokens); + return { authToken, messagingToken, appCheckToken }; + } +} + +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const DEFAULT_REGION = 'us-central1'; +const responseLineRE = /^data: (.*?)(?:\n|$)/; +/** + * Returns a Promise that will be rejected after the given duration. + * The error will be of type FunctionsError. + * + * @param millis Number of milliseconds to wait before rejecting. + */ +function failAfter(millis) { + // Node timers and browser timers are fundamentally incompatible, but we + // don't care about the value here + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let timer = null; + return { + promise: new Promise((_, reject) => { + timer = setTimeout(() => { + reject(new FunctionsError('deadline-exceeded', 'deadline-exceeded')); + }, millis); + }), + cancel: () => { + if (timer) { + clearTimeout(timer); + } + } + }; +} +/** + * The main class for the Firebase Functions SDK. + * @internal + */ +class FunctionsService { + /** + * Creates a new Functions service for the given app. + * @param app - The FirebaseApp to use. + */ + constructor(app, authProvider, messagingProvider, appCheckProvider, regionOrCustomDomain = DEFAULT_REGION, fetchImpl = (...args) => fetch(...args)) { + this.app = app; + this.fetchImpl = fetchImpl; + this.emulatorOrigin = null; + this.contextProvider = new ContextProvider(app, authProvider, messagingProvider, appCheckProvider); + // Cancels all ongoing requests when resolved. + this.cancelAllRequests = new Promise(resolve => { + this.deleteService = () => { + return Promise.resolve(resolve()); + }; + }); + // Resolve the region or custom domain overload by attempting to parse it. + try { + const url = new URL(regionOrCustomDomain); + this.customDomain = + url.origin + (url.pathname === '/' ? '' : url.pathname); + this.region = DEFAULT_REGION; + } + catch (e) { + this.customDomain = null; + this.region = regionOrCustomDomain; + } + } + _delete() { + return this.deleteService(); + } + /** + * Returns the URL for a callable with the given name. + * @param name - The name of the callable. + * @internal + */ + _url(name) { + const projectId = this.app.options.projectId; + if (this.emulatorOrigin !== null) { + const origin = this.emulatorOrigin; + return `${origin}/${projectId}/${this.region}/${name}`; + } + if (this.customDomain !== null) { + return `${this.customDomain}/${name}`; + } + return `https://${this.region}-${projectId}.cloudfunctions.net/${name}`; + } +} +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * + * Note: this must be called before this instance has been used to do any operations. + * + * @param host The emulator host (ex: localhost) + * @param port The emulator port (ex: 5001) + * @public + */ +function connectFunctionsEmulator$1(functionsInstance, host, port) { + const useSsl = isCloudWorkstation(host); + functionsInstance.emulatorOrigin = `http${useSsl ? 's' : ''}://${host}:${port}`; + // Workaround to get cookies in Firebase Studio + if (useSsl) { + void pingServer(functionsInstance.emulatorOrigin + '/backends'); + updateEmulatorBanner('Functions', true); + } +} +/** + * Returns a reference to the callable https trigger with the given name. + * @param name - The name of the trigger. + * @public + */ +function httpsCallable$1(functionsInstance, name, options) { + const callable = (data) => { + return call(functionsInstance, name, data, options || {}); + }; + callable.stream = (data, options) => { + return stream(functionsInstance, name, data, options); + }; + return callable; +} +/** + * Returns a reference to the callable https trigger with the given url. + * @param url - The url of the trigger. + * @public + */ +function httpsCallableFromURL$1(functionsInstance, url, options) { + const callable = (data) => { + return callAtURL(functionsInstance, url, data, options || {}); + }; + callable.stream = (data, options) => { + return streamAtURL(functionsInstance, url, data, options || {}); + }; + return callable; +} +function getCredentials(functionsInstance) { + return functionsInstance.emulatorOrigin && + isCloudWorkstation(functionsInstance.emulatorOrigin) + ? 'include' + : undefined; +} +/** + * Does an HTTP POST and returns the completed response. + * @param url The url to post to. + * @param body The JSON body of the post. + * @param headers The HTTP headers to include in the request. + * @param functionsInstance functions instance that is calling postJSON + * @return A Promise that will succeed when the request finishes. + */ +async function postJSON(url, body, headers, fetchImpl, functionsInstance) { + headers['Content-Type'] = 'application/json'; + let response; + try { + response = await fetchImpl(url, { + method: 'POST', + body: JSON.stringify(body), + headers, + credentials: getCredentials(functionsInstance) + }); + } + catch (e) { + // This could be an unhandled error on the backend, or it could be a + // network error. There's no way to know, since an unhandled error on the + // backend will fail to set the proper CORS header, and thus will be + // treated as a network error by fetch. + return { + status: 0, + json: null + }; + } + let json = null; + try { + json = await response.json(); + } + catch (e) { + // If we fail to parse JSON, it will fail the same as an empty body. + } + return { + status: response.status, + json + }; +} +/** + * Creates authorization headers for Firebase Functions requests. + * @param functionsInstance The Firebase Functions service instance. + * @param options Options for the callable function, including AppCheck token settings. + * @return A Promise that resolves a headers map to include in outgoing fetch request. + */ +async function makeAuthHeaders(functionsInstance, options) { + const headers = {}; + const context = await functionsInstance.contextProvider.getContext(options.limitedUseAppCheckTokens); + if (context.authToken) { + headers['Authorization'] = 'Bearer ' + context.authToken; + } + if (context.messagingToken) { + headers['Firebase-Instance-ID-Token'] = context.messagingToken; + } + if (context.appCheckToken !== null) { + headers['X-Firebase-AppCheck'] = context.appCheckToken; + } + return headers; +} +/** + * Calls a callable function asynchronously and returns the result. + * @param name The name of the callable trigger. + * @param data The data to pass as params to the function. + */ +function call(functionsInstance, name, data, options) { + const url = functionsInstance._url(name); + return callAtURL(functionsInstance, url, data, options); +} +/** + * Calls a callable function asynchronously and returns the result. + * @param url The url of the callable trigger. + * @param data The data to pass as params to the function. + */ +async function callAtURL(functionsInstance, url, data, options) { + // Encode any special types, such as dates, in the input data. + data = encode(data); + const body = { data }; + // Add a header for the authToken. + const headers = await makeAuthHeaders(functionsInstance, options); + // Default timeout to 70s, but let the options override it. + const timeout = options.timeout || 70000; + const failAfterHandle = failAfter(timeout); + const response = await Promise.race([ + postJSON(url, body, headers, functionsInstance.fetchImpl, functionsInstance), + failAfterHandle.promise, + functionsInstance.cancelAllRequests + ]); + // Always clear the failAfter timeout + failAfterHandle.cancel(); + // If service was deleted, interrupted response throws an error. + if (!response) { + throw new FunctionsError('cancelled', 'Firebase Functions instance was deleted.'); + } + // Check for an error status, regardless of http status. + const error = _errorForResponse(response.status, response.json); + if (error) { + throw error; + } + if (!response.json) { + throw new FunctionsError('internal', 'Response is not valid JSON object.'); + } + let responseData = response.json.data; + // TODO(klimt): For right now, allow "result" instead of "data", for + // backwards compatibility. + if (typeof responseData === 'undefined') { + responseData = response.json.result; + } + if (typeof responseData === 'undefined') { + // Consider the response malformed. + throw new FunctionsError('internal', 'Response is missing data field.'); + } + // Decode any special types, such as dates, in the returned data. + const decodedData = decode(responseData); + return { data: decodedData }; +} +/** + * Calls a callable function asynchronously and returns a streaming result. + * @param name The name of the callable trigger. + * @param data The data to pass as params to the function. + * @param options Streaming request options. + */ +function stream(functionsInstance, name, data, options) { + const url = functionsInstance._url(name); + return streamAtURL(functionsInstance, url, data, options || {}); +} +/** + * Calls a callable function asynchronously and return a streaming result. + * @param url The url of the callable trigger. + * @param data The data to pass as params to the function. + * @param options Streaming request options. + */ +async function streamAtURL(functionsInstance, url, data, options) { + // Encode any special types, such as dates, in the input data. + data = encode(data); + const body = { data }; + // + // Add a header for the authToken. + const headers = await makeAuthHeaders(functionsInstance, options); + headers['Content-Type'] = 'application/json'; + headers['Accept'] = 'text/event-stream'; + let response; + try { + response = await functionsInstance.fetchImpl(url, { + method: 'POST', + body: JSON.stringify(body), + headers, + signal: options?.signal, + credentials: getCredentials(functionsInstance) + }); + } + catch (e) { + if (e instanceof Error && e.name === 'AbortError') { + const error = new FunctionsError('cancelled', 'Request was cancelled.'); + return { + data: Promise.reject(error), + stream: { + [Symbol.asyncIterator]() { + return { + next() { + return Promise.reject(error); + } + }; + } + } + }; + } + // This could be an unhandled error on the backend, or it could be a + // network error. There's no way to know, since an unhandled error on the + // backend will fail to set the proper CORS header, and thus will be + // treated as a network error by fetch. + const error = _errorForResponse(0, null); + return { + data: Promise.reject(error), + // Return an empty async iterator + stream: { + [Symbol.asyncIterator]() { + return { + next() { + return Promise.reject(error); + } + }; + } + } + }; + } + let resultResolver; + let resultRejecter; + const resultPromise = new Promise((resolve, reject) => { + resultResolver = resolve; + resultRejecter = reject; + }); + options?.signal?.addEventListener('abort', () => { + const error = new FunctionsError('cancelled', 'Request was cancelled.'); + resultRejecter(error); + }); + const reader = response.body.getReader(); + const rstream = createResponseStream(reader, resultResolver, resultRejecter, options?.signal); + return { + stream: { + [Symbol.asyncIterator]() { + const rreader = rstream.getReader(); + return { + async next() { + const { value, done } = await rreader.read(); + return { value: value, done }; + }, + async return() { + await rreader.cancel(); + return { done: true, value: undefined }; + } + }; + } + }, + data: resultPromise + }; +} +/** + * Creates a ReadableStream that processes a streaming response from a streaming + * callable function that returns data in server-sent event format. + * + * @param reader The underlying reader providing raw response data + * @param resultResolver Callback to resolve the final result when received + * @param resultRejecter Callback to reject with an error if encountered + * @param signal Optional AbortSignal to cancel the stream processing + * @returns A ReadableStream that emits decoded messages from the response + * + * The returned ReadableStream: + * 1. Emits individual messages when "message" data is received + * 2. Resolves with the final result when a "result" message is received + * 3. Rejects with an error if an "error" message is received + */ +function createResponseStream(reader, resultResolver, resultRejecter, signal) { + const processLine = (line, controller) => { + const match = line.match(responseLineRE); + // ignore all other lines (newline, comments, etc.) + if (!match) { + return; + } + const data = match[1]; + try { + const jsonData = JSON.parse(data); + if ('result' in jsonData) { + resultResolver(decode(jsonData.result)); + return; + } + if ('message' in jsonData) { + controller.enqueue(decode(jsonData.message)); + return; + } + if ('error' in jsonData) { + const error = _errorForResponse(0, jsonData); + controller.error(error); + resultRejecter(error); + return; + } + } + catch (error) { + if (error instanceof FunctionsError) { + controller.error(error); + resultRejecter(error); + return; + } + // ignore other parsing errors + } + }; + const decoder = new TextDecoder(); + return new ReadableStream({ + start(controller) { + let currentText = ''; + return pump(); + async function pump() { + if (signal?.aborted) { + const error = new FunctionsError('cancelled', 'Request was cancelled'); + controller.error(error); + resultRejecter(error); + return Promise.resolve(); + } + try { + const { value, done } = await reader.read(); + if (done) { + if (currentText.trim()) { + processLine(currentText.trim(), controller); + } + controller.close(); + return; + } + if (signal?.aborted) { + const error = new FunctionsError('cancelled', 'Request was cancelled'); + controller.error(error); + resultRejecter(error); + await reader.cancel(); + return; + } + currentText += decoder.decode(value, { stream: true }); + const lines = currentText.split('\n'); + currentText = lines.pop() || ''; + for (const line of lines) { + if (line.trim()) { + processLine(line.trim(), controller); + } + } + return pump(); + } + catch (error) { + const functionsError = error instanceof FunctionsError + ? error + : _errorForResponse(0, null); + controller.error(functionsError); + resultRejecter(functionsError); + } + } + }, + cancel() { + return reader.cancel(); + } + }); +} + +const name = "@firebase/functions"; +const version = "0.13.1"; + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const AUTH_INTERNAL_NAME = 'auth-internal'; +const APP_CHECK_INTERNAL_NAME = 'app-check-internal'; +const MESSAGING_INTERNAL_NAME = 'messaging-internal'; +function registerFunctions(variant) { + const factory = (container, { instanceIdentifier: regionOrCustomDomain }) => { + // Dependencies + const app = container.getProvider('app').getImmediate(); + const authProvider = container.getProvider(AUTH_INTERNAL_NAME); + const messagingProvider = container.getProvider(MESSAGING_INTERNAL_NAME); + const appCheckProvider = container.getProvider(APP_CHECK_INTERNAL_NAME); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return new FunctionsService(app, authProvider, messagingProvider, appCheckProvider, regionOrCustomDomain); + }; + _registerComponent(new Component(FUNCTIONS_TYPE, factory, "PUBLIC" /* ComponentType.PUBLIC */).setMultipleInstances(true)); + registerVersion(name, version, variant); + // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation + registerVersion(name, version, 'esm2020'); +} + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Returns a {@link Functions} instance for the given app. + * @param app - The {@link @firebase/app#FirebaseApp} to use. + * @param regionOrCustomDomain - one of: + * a) The region the callable functions are located in (ex: us-central1) + * b) A custom domain hosting the callable functions (ex: https://mydomain.com) + * @public + */ +function getFunctions(app = getApp(), regionOrCustomDomain = DEFAULT_REGION) { + // Dependencies + const functionsProvider = _getProvider(getModularInstance(app), FUNCTIONS_TYPE); + const functionsInstance = functionsProvider.getImmediate({ + identifier: regionOrCustomDomain + }); + const emulator = getDefaultEmulatorHostnameAndPort('functions'); + if (emulator) { + connectFunctionsEmulator(functionsInstance, ...emulator); + } + return functionsInstance; +} +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * + * Note: this must be called before this instance has been used to do any operations. + * + * @param host - The emulator host (ex: localhost) + * @param port - The emulator port (ex: 5001) + * @public + */ +function connectFunctionsEmulator(functionsInstance, host, port) { + connectFunctionsEmulator$1(getModularInstance(functionsInstance), host, port); +} +/** + * Returns a reference to the callable HTTPS trigger with the given name. + * @param name - The name of the trigger. + * @public + */ +function httpsCallable(functionsInstance, name, options) { + return httpsCallable$1(getModularInstance(functionsInstance), name, options); +} +/** + * Returns a reference to the callable HTTPS trigger with the specified url. + * @param url - The url of the trigger. + * @public + */ +function httpsCallableFromURL(functionsInstance, url, options) { + return httpsCallableFromURL$1(getModularInstance(functionsInstance), url, options); +} + +/** + * Cloud Functions for Firebase + * + * @packageDocumentation + */ +registerFunctions(); + +export { FunctionsError, connectFunctionsEmulator, getFunctions, httpsCallable, httpsCallableFromURL }; +//# sourceMappingURL=index.esm.js.map diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/index.esm.js.map b/frontend-old/node_modules/@firebase/functions/dist/esm/index.esm.js.map new file mode 100644 index 0000000..74907c3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/index.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.esm.js","sources":["../../src/serializer.ts","../../src/constants.ts","../../src/error.ts","../../src/context.ts","../../src/service.ts","../../src/config.ts","../../src/api.ts","../../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst LONG_TYPE = 'type.googleapis.com/google.protobuf.Int64Value';\nconst UNSIGNED_LONG_TYPE = 'type.googleapis.com/google.protobuf.UInt64Value';\n\nfunction mapValues(\n // { [k: string]: unknown } is no longer a wildcard assignment target after typescript 3.5\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n o: { [key: string]: any },\n f: (arg0: unknown) => unknown\n): object {\n const result: { [key: string]: unknown } = {};\n for (const key in o) {\n if (o.hasOwnProperty(key)) {\n result[key] = f(o[key]);\n }\n }\n return result;\n}\n\n/**\n * Takes data and encodes it in a JSON-friendly way, such that types such as\n * Date are preserved.\n * @internal\n * @param data - Data to encode.\n */\nexport function encode(data: unknown): unknown {\n if (data == null) {\n return null;\n }\n if (data instanceof Number) {\n data = data.valueOf();\n }\n if (typeof data === 'number' && isFinite(data)) {\n // Any number in JS is safe to put directly in JSON and parse as a double\n // without any loss of precision.\n return data;\n }\n if (data === true || data === false) {\n return data;\n }\n if (Object.prototype.toString.call(data) === '[object String]') {\n return data;\n }\n if (data instanceof Date) {\n return data.toISOString();\n }\n if (Array.isArray(data)) {\n return data.map(x => encode(x));\n }\n if (typeof data === 'function' || typeof data === 'object') {\n return mapValues(data!, x => encode(x));\n }\n // If we got this far, the data is not encodable.\n throw new Error('Data cannot be encoded in JSON: ' + data);\n}\n\n/**\n * Takes data that's been encoded in a JSON-friendly form and returns a form\n * with richer datatypes, such as Dates, etc.\n * @internal\n * @param json - JSON to convert.\n */\nexport function decode(json: unknown): unknown {\n if (json == null) {\n return json;\n }\n if ((json as { [key: string]: unknown })['@type']) {\n switch ((json as { [key: string]: unknown })['@type']) {\n case LONG_TYPE:\n // Fall through and handle this the same as unsigned.\n case UNSIGNED_LONG_TYPE: {\n // Technically, this could work return a valid number for malformed\n // data if there was a number followed by garbage. But it's just not\n // worth all the extra code to detect that case.\n const value = Number((json as { [key: string]: unknown })['value']);\n if (isNaN(value)) {\n throw new Error('Data cannot be decoded from JSON: ' + json);\n }\n return value;\n }\n default: {\n throw new Error('Data cannot be decoded from JSON: ' + json);\n }\n }\n }\n if (Array.isArray(json)) {\n return json.map(x => decode(x));\n }\n if (typeof json === 'function' || typeof json === 'object') {\n return mapValues(json!, x => decode(x));\n }\n // Anything else is safe to return.\n return json;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Type constant for Firebase Functions.\n */\nexport const FUNCTIONS_TYPE = 'functions';\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FunctionsErrorCodeCore as FunctionsErrorCode } from './public-types';\nimport { decode } from './serializer';\nimport { HttpResponseBody } from './service';\nimport { FirebaseError } from '@firebase/util';\nimport { FUNCTIONS_TYPE } from './constants';\n\n/**\n * Standard error codes for different ways a request can fail, as defined by:\n * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto\n *\n * This map is used primarily to convert from a backend error code string to\n * a client SDK error code string, and make sure it's in the supported set.\n */\nconst errorCodeMap: { [name: string]: FunctionsErrorCode } = {\n OK: 'ok',\n CANCELLED: 'cancelled',\n UNKNOWN: 'unknown',\n INVALID_ARGUMENT: 'invalid-argument',\n DEADLINE_EXCEEDED: 'deadline-exceeded',\n NOT_FOUND: 'not-found',\n ALREADY_EXISTS: 'already-exists',\n PERMISSION_DENIED: 'permission-denied',\n UNAUTHENTICATED: 'unauthenticated',\n RESOURCE_EXHAUSTED: 'resource-exhausted',\n FAILED_PRECONDITION: 'failed-precondition',\n ABORTED: 'aborted',\n OUT_OF_RANGE: 'out-of-range',\n UNIMPLEMENTED: 'unimplemented',\n INTERNAL: 'internal',\n UNAVAILABLE: 'unavailable',\n DATA_LOSS: 'data-loss'\n};\n\n/**\n * An error returned by the Firebase Functions client SDK.\n *\n * See {@link FunctionsErrorCode} for full documentation of codes.\n *\n * @public\n */\nexport class FunctionsError extends FirebaseError {\n /**\n * Constructs a new instance of the `FunctionsError` class.\n */\n constructor(\n /**\n * A standard error code that will be returned to the client. This also\n * determines the HTTP status code of the response, as defined in code.proto.\n */\n code: FunctionsErrorCode,\n message?: string,\n /**\n * Additional details to be converted to JSON and included in the error response.\n */\n readonly details?: unknown\n ) {\n super(`${FUNCTIONS_TYPE}/${code}`, message || '');\n\n // Since the FirebaseError constructor sets the prototype of `this` to FirebaseError.prototype,\n // we also have to do it in all subclasses to allow for correct `instanceof` checks.\n Object.setPrototypeOf(this, FunctionsError.prototype);\n }\n}\n\n/**\n * Takes an HTTP status code and returns the corresponding ErrorCode.\n * This is the standard HTTP status code -> error mapping defined in:\n * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto\n *\n * @param status An HTTP status code.\n * @return The corresponding ErrorCode, or ErrorCode.UNKNOWN if none.\n */\nfunction codeForHTTPStatus(status: number): FunctionsErrorCode {\n // Make sure any successful status is OK.\n if (status >= 200 && status < 300) {\n return 'ok';\n }\n switch (status) {\n case 0:\n // This can happen if the server returns 500.\n return 'internal';\n case 400:\n return 'invalid-argument';\n case 401:\n return 'unauthenticated';\n case 403:\n return 'permission-denied';\n case 404:\n return 'not-found';\n case 409:\n return 'aborted';\n case 429:\n return 'resource-exhausted';\n case 499:\n return 'cancelled';\n case 500:\n return 'internal';\n case 501:\n return 'unimplemented';\n case 503:\n return 'unavailable';\n case 504:\n return 'deadline-exceeded';\n default: // ignore\n }\n return 'unknown';\n}\n\n/**\n * Takes an HTTP response and returns the corresponding Error, if any.\n */\nexport function _errorForResponse(\n status: number,\n bodyJSON: HttpResponseBody | null\n): Error | null {\n let code = codeForHTTPStatus(status);\n\n // Start with reasonable defaults from the status code.\n let description: string = code;\n\n let details: unknown = undefined;\n\n // Then look through the body for explicit details.\n try {\n const errorJSON = bodyJSON && bodyJSON.error;\n if (errorJSON) {\n const status = errorJSON.status;\n if (typeof status === 'string') {\n if (!errorCodeMap[status]) {\n // They must've included an unknown error code in the body.\n return new FunctionsError('internal', 'internal');\n }\n code = errorCodeMap[status];\n\n // TODO(klimt): Add better default descriptions for error enums.\n // The default description needs to be updated for the new code.\n description = status;\n }\n\n const message = errorJSON.message;\n if (typeof message === 'string') {\n description = message;\n }\n\n details = errorJSON.details;\n if (details !== undefined) {\n details = decode(details);\n }\n }\n } catch (e) {\n // If we couldn't parse explicit error data, that's fine.\n }\n\n if (code === 'ok') {\n // Technically, there's an edge case where a developer could explicitly\n // return an error code of OK, and we will treat it as success, but that\n // seems reasonable.\n return null;\n }\n\n return new FunctionsError(code, description, details);\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Provider } from '@firebase/component';\nimport { _isFirebaseServerApp, FirebaseApp } from '@firebase/app';\nimport {\n AppCheckInternalComponentName,\n FirebaseAppCheckInternal\n} from '@firebase/app-check-interop-types';\nimport {\n MessagingInternal,\n MessagingInternalComponentName\n} from '@firebase/messaging-interop-types';\nimport {\n FirebaseAuthInternal,\n FirebaseAuthInternalName\n} from '@firebase/auth-interop-types';\n\n/**\n * The metadata that should be supplied with function calls.\n * @internal\n */\nexport interface Context {\n authToken?: string;\n messagingToken?: string;\n appCheckToken: string | null;\n}\n\n/**\n * Helper class to get metadata that should be included with a function call.\n * @internal\n */\nexport class ContextProvider {\n private auth: FirebaseAuthInternal | null = null;\n private messaging: MessagingInternal | null = null;\n private appCheck: FirebaseAppCheckInternal | null = null;\n private serverAppAppCheckToken: string | null = null;\n constructor(\n readonly app: FirebaseApp,\n authProvider: Provider,\n messagingProvider: Provider,\n appCheckProvider: Provider\n ) {\n if (_isFirebaseServerApp(app) && app.settings.appCheckToken) {\n this.serverAppAppCheckToken = app.settings.appCheckToken;\n }\n this.auth = authProvider.getImmediate({ optional: true });\n this.messaging = messagingProvider.getImmediate({\n optional: true\n });\n\n if (!this.auth) {\n authProvider.get().then(\n auth => (this.auth = auth),\n () => {\n /* get() never rejects */\n }\n );\n }\n\n if (!this.messaging) {\n messagingProvider.get().then(\n messaging => (this.messaging = messaging),\n () => {\n /* get() never rejects */\n }\n );\n }\n\n if (!this.appCheck) {\n appCheckProvider?.get().then(\n appCheck => (this.appCheck = appCheck),\n () => {\n /* get() never rejects */\n }\n );\n }\n }\n\n async getAuthToken(): Promise {\n if (!this.auth) {\n return undefined;\n }\n\n try {\n const token = await this.auth.getToken();\n return token?.accessToken;\n } catch (e) {\n // If there's any error when trying to get the auth token, leave it off.\n return undefined;\n }\n }\n\n async getMessagingToken(): Promise {\n if (\n !this.messaging ||\n !('Notification' in self) ||\n Notification.permission !== 'granted'\n ) {\n return undefined;\n }\n\n try {\n return await this.messaging.getToken();\n } catch (e) {\n // We don't warn on this, because it usually means messaging isn't set up.\n // console.warn('Failed to retrieve instance id token.', e);\n\n // If there's any error when trying to get the token, leave it off.\n return undefined;\n }\n }\n\n async getAppCheckToken(\n limitedUseAppCheckTokens?: boolean\n ): Promise {\n if (this.serverAppAppCheckToken) {\n return this.serverAppAppCheckToken;\n }\n if (this.appCheck) {\n const result = limitedUseAppCheckTokens\n ? await this.appCheck.getLimitedUseToken()\n : await this.appCheck.getToken();\n if (result.error) {\n // Do not send the App Check header to the functions endpoint if\n // there was an error from the App Check exchange endpoint. The App\n // Check SDK will already have logged the error to console.\n return null;\n }\n return result.token;\n }\n return null;\n }\n\n async getContext(limitedUseAppCheckTokens?: boolean): Promise {\n const authToken = await this.getAuthToken();\n const messagingToken = await this.getMessagingToken();\n const appCheckToken = await this.getAppCheckToken(limitedUseAppCheckTokens);\n return { authToken, messagingToken, appCheckToken };\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseApp, _FirebaseService } from '@firebase/app';\nimport {\n HttpsCallable,\n HttpsCallableResult,\n HttpsCallableStreamResult,\n HttpsCallableOptions,\n HttpsCallableStreamOptions\n} from './public-types';\nimport { _errorForResponse, FunctionsError } from './error';\nimport { ContextProvider } from './context';\nimport { encode, decode } from './serializer';\nimport { Provider } from '@firebase/component';\nimport { FirebaseAuthInternalName } from '@firebase/auth-interop-types';\nimport { MessagingInternalComponentName } from '@firebase/messaging-interop-types';\nimport { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';\nimport {\n isCloudWorkstation,\n pingServer,\n updateEmulatorBanner\n} from '@firebase/util';\n\nexport const DEFAULT_REGION = 'us-central1';\n\nconst responseLineRE = /^data: (.*?)(?:\\n|$)/;\n\n/**\n * The response to an http request.\n */\ninterface HttpResponse {\n status: number;\n json: HttpResponseBody | null;\n}\n/**\n * Describes the shape of the HttpResponse body.\n * It makes functions that would otherwise take {} able to access the\n * possible elements in the body more easily\n */\nexport interface HttpResponseBody {\n data?: unknown;\n result?: unknown;\n error?: {\n message?: unknown;\n status?: unknown;\n details?: unknown;\n };\n}\n\ninterface CancellablePromise {\n promise: Promise;\n cancel: () => void;\n}\n\n/**\n * Returns a Promise that will be rejected after the given duration.\n * The error will be of type FunctionsError.\n *\n * @param millis Number of milliseconds to wait before rejecting.\n */\nfunction failAfter(millis: number): CancellablePromise {\n // Node timers and browser timers are fundamentally incompatible, but we\n // don't care about the value here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let timer: any | null = null;\n return {\n promise: new Promise((_, reject) => {\n timer = setTimeout(() => {\n reject(new FunctionsError('deadline-exceeded', 'deadline-exceeded'));\n }, millis);\n }),\n cancel: () => {\n if (timer) {\n clearTimeout(timer);\n }\n }\n };\n}\n\n/**\n * The main class for the Firebase Functions SDK.\n * @internal\n */\nexport class FunctionsService implements _FirebaseService {\n readonly contextProvider: ContextProvider;\n emulatorOrigin: string | null = null;\n cancelAllRequests: Promise;\n deleteService!: () => Promise;\n region: string;\n customDomain: string | null;\n\n /**\n * Creates a new Functions service for the given app.\n * @param app - The FirebaseApp to use.\n */\n constructor(\n readonly app: FirebaseApp,\n authProvider: Provider,\n messagingProvider: Provider,\n appCheckProvider: Provider,\n regionOrCustomDomain: string = DEFAULT_REGION,\n readonly fetchImpl: typeof fetch = (...args) => fetch(...args)\n ) {\n this.contextProvider = new ContextProvider(\n app,\n authProvider,\n messagingProvider,\n appCheckProvider\n );\n // Cancels all ongoing requests when resolved.\n this.cancelAllRequests = new Promise(resolve => {\n this.deleteService = () => {\n return Promise.resolve(resolve());\n };\n });\n\n // Resolve the region or custom domain overload by attempting to parse it.\n try {\n const url = new URL(regionOrCustomDomain);\n this.customDomain =\n url.origin + (url.pathname === '/' ? '' : url.pathname);\n this.region = DEFAULT_REGION;\n } catch (e) {\n this.customDomain = null;\n this.region = regionOrCustomDomain;\n }\n }\n\n _delete(): Promise {\n return this.deleteService();\n }\n\n /**\n * Returns the URL for a callable with the given name.\n * @param name - The name of the callable.\n * @internal\n */\n _url(name: string): string {\n const projectId = this.app.options.projectId;\n if (this.emulatorOrigin !== null) {\n const origin = this.emulatorOrigin;\n return `${origin}/${projectId}/${this.region}/${name}`;\n }\n\n if (this.customDomain !== null) {\n return `${this.customDomain}/${name}`;\n }\n\n return `https://${this.region}-${projectId}.cloudfunctions.net/${name}`;\n }\n}\n\n/**\n * Modify this instance to communicate with the Cloud Functions emulator.\n *\n * Note: this must be called before this instance has been used to do any operations.\n *\n * @param host The emulator host (ex: localhost)\n * @param port The emulator port (ex: 5001)\n * @public\n */\nexport function connectFunctionsEmulator(\n functionsInstance: FunctionsService,\n host: string,\n port: number\n): void {\n const useSsl = isCloudWorkstation(host);\n functionsInstance.emulatorOrigin = `http${\n useSsl ? 's' : ''\n }://${host}:${port}`;\n // Workaround to get cookies in Firebase Studio\n if (useSsl) {\n void pingServer(functionsInstance.emulatorOrigin + '/backends');\n updateEmulatorBanner('Functions', true);\n }\n}\n\n/**\n * Returns a reference to the callable https trigger with the given name.\n * @param name - The name of the trigger.\n * @public\n */\nexport function httpsCallable(\n functionsInstance: FunctionsService,\n name: string,\n options?: HttpsCallableOptions\n): HttpsCallable {\n const callable = (\n data?: RequestData | null\n ): Promise => {\n return call(functionsInstance, name, data, options || {});\n };\n\n callable.stream = (\n data?: RequestData | null,\n options?: HttpsCallableStreamOptions\n ) => {\n return stream(functionsInstance, name, data, options);\n };\n\n return callable as HttpsCallable;\n}\n\n/**\n * Returns a reference to the callable https trigger with the given url.\n * @param url - The url of the trigger.\n * @public\n */\nexport function httpsCallableFromURL<\n RequestData,\n ResponseData,\n StreamData = unknown\n>(\n functionsInstance: FunctionsService,\n url: string,\n options?: HttpsCallableOptions\n): HttpsCallable {\n const callable = (\n data?: RequestData | null\n ): Promise => {\n return callAtURL(functionsInstance, url, data, options || {});\n };\n\n callable.stream = (\n data?: RequestData | null,\n options?: HttpsCallableStreamOptions\n ) => {\n return streamAtURL(functionsInstance, url, data, options || {});\n };\n return callable as HttpsCallable;\n}\n\nfunction getCredentials(\n functionsInstance: FunctionsService\n): 'include' | undefined {\n return functionsInstance.emulatorOrigin &&\n isCloudWorkstation(functionsInstance.emulatorOrigin)\n ? 'include'\n : undefined;\n}\n\n/**\n * Does an HTTP POST and returns the completed response.\n * @param url The url to post to.\n * @param body The JSON body of the post.\n * @param headers The HTTP headers to include in the request.\n * @param functionsInstance functions instance that is calling postJSON\n * @return A Promise that will succeed when the request finishes.\n */\nasync function postJSON(\n url: string,\n body: unknown,\n headers: { [key: string]: string },\n fetchImpl: typeof fetch,\n functionsInstance: FunctionsService\n): Promise {\n headers['Content-Type'] = 'application/json';\n\n let response: Response;\n try {\n response = await fetchImpl(url, {\n method: 'POST',\n body: JSON.stringify(body),\n headers,\n credentials: getCredentials(functionsInstance)\n });\n } catch (e) {\n // This could be an unhandled error on the backend, or it could be a\n // network error. There's no way to know, since an unhandled error on the\n // backend will fail to set the proper CORS header, and thus will be\n // treated as a network error by fetch.\n return {\n status: 0,\n json: null\n };\n }\n let json: HttpResponseBody | null = null;\n try {\n json = await response.json();\n } catch (e) {\n // If we fail to parse JSON, it will fail the same as an empty body.\n }\n return {\n status: response.status,\n json\n };\n}\n\n/**\n * Creates authorization headers for Firebase Functions requests.\n * @param functionsInstance The Firebase Functions service instance.\n * @param options Options for the callable function, including AppCheck token settings.\n * @return A Promise that resolves a headers map to include in outgoing fetch request.\n */\nasync function makeAuthHeaders(\n functionsInstance: FunctionsService,\n options: HttpsCallableOptions\n): Promise> {\n const headers: Record = {};\n const context = await functionsInstance.contextProvider.getContext(\n options.limitedUseAppCheckTokens\n );\n if (context.authToken) {\n headers['Authorization'] = 'Bearer ' + context.authToken;\n }\n if (context.messagingToken) {\n headers['Firebase-Instance-ID-Token'] = context.messagingToken;\n }\n if (context.appCheckToken !== null) {\n headers['X-Firebase-AppCheck'] = context.appCheckToken;\n }\n return headers;\n}\n\n/**\n * Calls a callable function asynchronously and returns the result.\n * @param name The name of the callable trigger.\n * @param data The data to pass as params to the function.\n */\nfunction call(\n functionsInstance: FunctionsService,\n name: string,\n data: unknown,\n options: HttpsCallableOptions\n): Promise {\n const url = functionsInstance._url(name);\n return callAtURL(functionsInstance, url, data, options);\n}\n\n/**\n * Calls a callable function asynchronously and returns the result.\n * @param url The url of the callable trigger.\n * @param data The data to pass as params to the function.\n */\nasync function callAtURL(\n functionsInstance: FunctionsService,\n url: string,\n data: unknown,\n options: HttpsCallableOptions\n): Promise {\n // Encode any special types, such as dates, in the input data.\n data = encode(data);\n const body = { data };\n\n // Add a header for the authToken.\n const headers = await makeAuthHeaders(functionsInstance, options);\n\n // Default timeout to 70s, but let the options override it.\n const timeout = options.timeout || 70000;\n\n const failAfterHandle = failAfter(timeout);\n const response = await Promise.race([\n postJSON(\n url,\n body,\n headers,\n functionsInstance.fetchImpl,\n functionsInstance\n ),\n failAfterHandle.promise,\n functionsInstance.cancelAllRequests\n ]);\n\n // Always clear the failAfter timeout\n failAfterHandle.cancel();\n\n // If service was deleted, interrupted response throws an error.\n if (!response) {\n throw new FunctionsError(\n 'cancelled',\n 'Firebase Functions instance was deleted.'\n );\n }\n\n // Check for an error status, regardless of http status.\n const error = _errorForResponse(response.status, response.json);\n if (error) {\n throw error;\n }\n\n if (!response.json) {\n throw new FunctionsError('internal', 'Response is not valid JSON object.');\n }\n\n let responseData = response.json.data;\n // TODO(klimt): For right now, allow \"result\" instead of \"data\", for\n // backwards compatibility.\n if (typeof responseData === 'undefined') {\n responseData = response.json.result;\n }\n if (typeof responseData === 'undefined') {\n // Consider the response malformed.\n throw new FunctionsError('internal', 'Response is missing data field.');\n }\n\n // Decode any special types, such as dates, in the returned data.\n const decodedData = decode(responseData);\n\n return { data: decodedData };\n}\n\n/**\n * Calls a callable function asynchronously and returns a streaming result.\n * @param name The name of the callable trigger.\n * @param data The data to pass as params to the function.\n * @param options Streaming request options.\n */\nfunction stream(\n functionsInstance: FunctionsService,\n name: string,\n data: unknown,\n options?: HttpsCallableStreamOptions\n): Promise {\n const url = functionsInstance._url(name);\n return streamAtURL(functionsInstance, url, data, options || {});\n}\n\n/**\n * Calls a callable function asynchronously and return a streaming result.\n * @param url The url of the callable trigger.\n * @param data The data to pass as params to the function.\n * @param options Streaming request options.\n */\nasync function streamAtURL(\n functionsInstance: FunctionsService,\n url: string,\n data: unknown,\n options: HttpsCallableStreamOptions\n): Promise {\n // Encode any special types, such as dates, in the input data.\n data = encode(data);\n const body = { data };\n //\n // Add a header for the authToken.\n const headers = await makeAuthHeaders(functionsInstance, options);\n headers['Content-Type'] = 'application/json';\n headers['Accept'] = 'text/event-stream';\n\n let response: Response;\n try {\n response = await functionsInstance.fetchImpl(url, {\n method: 'POST',\n body: JSON.stringify(body),\n headers,\n signal: options?.signal,\n credentials: getCredentials(functionsInstance)\n });\n } catch (e) {\n if (e instanceof Error && e.name === 'AbortError') {\n const error = new FunctionsError('cancelled', 'Request was cancelled.');\n return {\n data: Promise.reject(error),\n stream: {\n [Symbol.asyncIterator]() {\n return {\n next() {\n return Promise.reject(error);\n }\n };\n }\n }\n };\n }\n // This could be an unhandled error on the backend, or it could be a\n // network error. There's no way to know, since an unhandled error on the\n // backend will fail to set the proper CORS header, and thus will be\n // treated as a network error by fetch.\n const error = _errorForResponse(0, null);\n return {\n data: Promise.reject(error),\n // Return an empty async iterator\n stream: {\n [Symbol.asyncIterator]() {\n return {\n next() {\n return Promise.reject(error);\n }\n };\n }\n }\n };\n }\n let resultResolver: (value: unknown) => void;\n let resultRejecter: (reason: unknown) => void;\n const resultPromise = new Promise((resolve, reject) => {\n resultResolver = resolve;\n resultRejecter = reject;\n });\n options?.signal?.addEventListener('abort', () => {\n const error = new FunctionsError('cancelled', 'Request was cancelled.');\n resultRejecter(error);\n });\n const reader = response.body!.getReader();\n const rstream = createResponseStream(\n reader,\n resultResolver!,\n resultRejecter!,\n options?.signal\n );\n return {\n stream: {\n [Symbol.asyncIterator]() {\n const rreader = rstream.getReader();\n return {\n async next() {\n const { value, done } = await rreader.read();\n return { value: value as unknown, done };\n },\n async return() {\n await rreader.cancel();\n return { done: true, value: undefined };\n }\n };\n }\n },\n data: resultPromise\n };\n}\n\n/**\n * Creates a ReadableStream that processes a streaming response from a streaming\n * callable function that returns data in server-sent event format.\n *\n * @param reader The underlying reader providing raw response data\n * @param resultResolver Callback to resolve the final result when received\n * @param resultRejecter Callback to reject with an error if encountered\n * @param signal Optional AbortSignal to cancel the stream processing\n * @returns A ReadableStream that emits decoded messages from the response\n *\n * The returned ReadableStream:\n * 1. Emits individual messages when \"message\" data is received\n * 2. Resolves with the final result when a \"result\" message is received\n * 3. Rejects with an error if an \"error\" message is received\n */\nfunction createResponseStream(\n reader: ReadableStreamDefaultReader,\n resultResolver: (value: unknown) => void,\n resultRejecter: (reason: unknown) => void,\n signal?: AbortSignal\n): ReadableStream {\n const processLine = (\n line: string,\n controller: ReadableStreamDefaultController\n ): void => {\n const match = line.match(responseLineRE);\n // ignore all other lines (newline, comments, etc.)\n if (!match) {\n return;\n }\n const data = match[1];\n try {\n const jsonData = JSON.parse(data);\n if ('result' in jsonData) {\n resultResolver(decode(jsonData.result));\n return;\n }\n if ('message' in jsonData) {\n controller.enqueue(decode(jsonData.message));\n return;\n }\n if ('error' in jsonData) {\n const error = _errorForResponse(0, jsonData);\n controller.error(error);\n resultRejecter(error);\n return;\n }\n } catch (error) {\n if (error instanceof FunctionsError) {\n controller.error(error);\n resultRejecter(error);\n return;\n }\n // ignore other parsing errors\n }\n };\n\n const decoder = new TextDecoder();\n return new ReadableStream({\n start(controller) {\n let currentText = '';\n return pump();\n async function pump(): Promise {\n if (signal?.aborted) {\n const error = new FunctionsError(\n 'cancelled',\n 'Request was cancelled'\n );\n controller.error(error);\n resultRejecter(error);\n return Promise.resolve();\n }\n try {\n const { value, done } = await reader.read();\n if (done) {\n if (currentText.trim()) {\n processLine(currentText.trim(), controller);\n }\n controller.close();\n return;\n }\n if (signal?.aborted) {\n const error = new FunctionsError(\n 'cancelled',\n 'Request was cancelled'\n );\n controller.error(error);\n resultRejecter(error);\n await reader.cancel();\n return;\n }\n currentText += decoder.decode(value, { stream: true });\n const lines = currentText.split('\\n');\n currentText = lines.pop() || '';\n for (const line of lines) {\n if (line.trim()) {\n processLine(line.trim(), controller);\n }\n }\n return pump();\n } catch (error) {\n const functionsError =\n error instanceof FunctionsError\n ? error\n : _errorForResponse(0, null);\n controller.error(functionsError);\n resultRejecter(functionsError);\n }\n }\n },\n cancel() {\n return reader.cancel();\n }\n });\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _registerComponent, registerVersion } from '@firebase/app';\nimport { FunctionsService } from './service';\nimport {\n Component,\n ComponentType,\n ComponentContainer,\n InstanceFactory\n} from '@firebase/component';\nimport { FUNCTIONS_TYPE } from './constants';\nimport { FirebaseAuthInternalName } from '@firebase/auth-interop-types';\nimport { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';\nimport { MessagingInternalComponentName } from '@firebase/messaging-interop-types';\nimport { name, version } from '../package.json';\n\nconst AUTH_INTERNAL_NAME: FirebaseAuthInternalName = 'auth-internal';\nconst APP_CHECK_INTERNAL_NAME: AppCheckInternalComponentName =\n 'app-check-internal';\nconst MESSAGING_INTERNAL_NAME: MessagingInternalComponentName =\n 'messaging-internal';\n\nexport function registerFunctions(variant?: string): void {\n const factory: InstanceFactory<'functions'> = (\n container: ComponentContainer,\n { instanceIdentifier: regionOrCustomDomain }\n ) => {\n // Dependencies\n const app = container.getProvider('app').getImmediate();\n const authProvider = container.getProvider(AUTH_INTERNAL_NAME);\n const messagingProvider = container.getProvider(MESSAGING_INTERNAL_NAME);\n const appCheckProvider = container.getProvider(APP_CHECK_INTERNAL_NAME);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new FunctionsService(\n app,\n authProvider,\n messagingProvider,\n appCheckProvider,\n regionOrCustomDomain\n );\n };\n\n _registerComponent(\n new Component(\n FUNCTIONS_TYPE,\n factory,\n ComponentType.PUBLIC\n ).setMultipleInstances(true)\n );\n\n registerVersion(name, version, variant);\n // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation\n registerVersion(name, version, '__BUILD_TARGET__');\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _getProvider, FirebaseApp, getApp } from '@firebase/app';\nimport { FUNCTIONS_TYPE } from './constants';\n\nimport { Provider } from '@firebase/component';\nimport { Functions, HttpsCallableOptions, HttpsCallable } from './public-types';\nimport {\n FunctionsService,\n DEFAULT_REGION,\n connectFunctionsEmulator as _connectFunctionsEmulator,\n httpsCallable as _httpsCallable,\n httpsCallableFromURL as _httpsCallableFromURL\n} from './service';\nimport {\n getModularInstance,\n getDefaultEmulatorHostnameAndPort\n} from '@firebase/util';\n\nexport { FunctionsError } from './error';\nexport * from './public-types';\n\n/**\n * Returns a {@link Functions} instance for the given app.\n * @param app - The {@link @firebase/app#FirebaseApp} to use.\n * @param regionOrCustomDomain - one of:\n * a) The region the callable functions are located in (ex: us-central1)\n * b) A custom domain hosting the callable functions (ex: https://mydomain.com)\n * @public\n */\nexport function getFunctions(\n app: FirebaseApp = getApp(),\n regionOrCustomDomain: string = DEFAULT_REGION\n): Functions {\n // Dependencies\n const functionsProvider: Provider<'functions'> = _getProvider(\n getModularInstance(app),\n FUNCTIONS_TYPE\n );\n const functionsInstance = functionsProvider.getImmediate({\n identifier: regionOrCustomDomain\n });\n const emulator = getDefaultEmulatorHostnameAndPort('functions');\n if (emulator) {\n connectFunctionsEmulator(functionsInstance, ...emulator);\n }\n return functionsInstance;\n}\n\n/**\n * Modify this instance to communicate with the Cloud Functions emulator.\n *\n * Note: this must be called before this instance has been used to do any operations.\n *\n * @param host - The emulator host (ex: localhost)\n * @param port - The emulator port (ex: 5001)\n * @public\n */\nexport function connectFunctionsEmulator(\n functionsInstance: Functions,\n host: string,\n port: number\n): void {\n _connectFunctionsEmulator(\n getModularInstance(functionsInstance as FunctionsService),\n host,\n port\n );\n}\n\n/**\n * Returns a reference to the callable HTTPS trigger with the given name.\n * @param name - The name of the trigger.\n * @public\n */\nexport function httpsCallable<\n RequestData = unknown,\n ResponseData = unknown,\n StreamData = unknown\n>(\n functionsInstance: Functions,\n name: string,\n options?: HttpsCallableOptions\n): HttpsCallable {\n return _httpsCallable(\n getModularInstance(functionsInstance as FunctionsService),\n name,\n options\n );\n}\n\n/**\n * Returns a reference to the callable HTTPS trigger with the specified url.\n * @param url - The url of the trigger.\n * @public\n */\nexport function httpsCallableFromURL<\n RequestData = unknown,\n ResponseData = unknown,\n StreamData = unknown\n>(\n functionsInstance: Functions,\n url: string,\n options?: HttpsCallableOptions\n): HttpsCallable {\n return _httpsCallableFromURL(\n getModularInstance(functionsInstance as FunctionsService),\n url,\n options\n );\n}\n","/**\n * Cloud Functions for Firebase\n *\n * @packageDocumentation\n */\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { registerFunctions } from './config';\n\nexport * from './api';\nexport * from './public-types';\n\nregisterFunctions();\n"],"names":["connectFunctionsEmulator","httpsCallable","httpsCallableFromURL","_connectFunctionsEmulator","_httpsCallable","_httpsCallableFromURL"],"mappings":";;;;AAAA;;;;;;;;;;;;;;;AAeG;AACH,MAAM,SAAS,GAAG,gDAAgD,CAAC;AACnE,MAAM,kBAAkB,GAAG,iDAAiD,CAAC;AAE7E,SAAS,SAAS;AAChB;AACA;AACA,CAAyB,EACzB,CAA6B,EAAA;IAE7B,MAAM,MAAM,GAA+B,EAAE,CAAC;AAC9C,IAAA,KAAK,MAAM,GAAG,IAAI,CAAC,EAAE;AACnB,QAAA,IAAI,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YACzB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;SACzB;KACF;AACD,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;AAKG;AACG,SAAU,MAAM,CAAC,IAAa,EAAA;AAClC,IAAA,IAAI,IAAI,IAAI,IAAI,EAAE;AAChB,QAAA,OAAO,IAAI,CAAC;KACb;AACD,IAAA,IAAI,IAAI,YAAY,MAAM,EAAE;AAC1B,QAAA,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;KACvB;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE;;;AAG9C,QAAA,OAAO,IAAI,CAAC;KACb;IACD,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE;AACnC,QAAA,OAAO,IAAI,CAAC;KACb;AACD,I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,IAAY,EACZ,IAAY,EAAA;IAEZC,0BAAyB,CACvB,kBAAkB,CAAmB,iBAAqC,CAAC,EAC3E,IAAI,EACJ,IAAI,CACL,CAAC;AACJ,CAAC;AAED;;;;AAIG;SACa,aAAa,CAK3B,iBAA4B,EAC5B,IAAY,EACZ,OAA8B,EAAA;IAE9B,OAAOC,eAAc,CACnB,kBAAkB,CAAmB,iBAAqC,CAAC,EAC3E,IAAI,EACJ,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;AAIG;SACa,oBAAoB,CAKlC,iBAA4B,EAC5B,GAAW,EACX,OAA8B,EAAA;IAE9B,OAAOC,sBAAqB,CAC1B,kBAAkB,CAAmB,iBAAqC,CAAC,EAC3E,GAAG,EACH,OAAO,CACR,CAAC;AACJ;;AC7HA;;;;AAIG;AAuBH,iBAAiB,EAAE;;;;"} \ No newline at end of file diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/package.json b/frontend-old/node_modules/@firebase/functions/dist/esm/package.json new file mode 100644 index 0000000..7c34deb --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/src/api.d.ts b/frontend-old/node_modules/@firebase/functions/dist/esm/src/api.d.ts new file mode 100644 index 0000000..c9837ba --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/src/api.d.ts @@ -0,0 +1,51 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +import { Functions, HttpsCallableOptions, HttpsCallable } from './public-types'; +export { FunctionsError } from './error'; +export * from './public-types'; +/** + * Returns a {@link Functions} instance for the given app. + * @param app - The {@link @firebase/app#FirebaseApp} to use. + * @param regionOrCustomDomain - one of: + * a) The region the callable functions are located in (ex: us-central1) + * b) A custom domain hosting the callable functions (ex: https://mydomain.com) + * @public + */ +export declare function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions; +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * + * Note: this must be called before this instance has been used to do any operations. + * + * @param host - The emulator host (ex: localhost) + * @param port - The emulator port (ex: 5001) + * @public + */ +export declare function connectFunctionsEmulator(functionsInstance: Functions, host: string, port: number): void; +/** + * Returns a reference to the callable HTTPS trigger with the given name. + * @param name - The name of the trigger. + * @public + */ +export declare function httpsCallable(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable; +/** + * Returns a reference to the callable HTTPS trigger with the specified url. + * @param url - The url of the trigger. + * @public + */ +export declare function httpsCallableFromURL(functionsInstance: Functions, url: string, options?: HttpsCallableOptions): HttpsCallable; diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/src/config.d.ts b/frontend-old/node_modules/@firebase/functions/dist/esm/src/config.d.ts new file mode 100644 index 0000000..8df6b14 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/src/config.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export declare function registerFunctions(variant?: string): void; diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/src/constants.d.ts b/frontend-old/node_modules/@firebase/functions/dist/esm/src/constants.d.ts new file mode 100644 index 0000000..59e9e1e --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/src/constants.d.ts @@ -0,0 +1,20 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Type constant for Firebase Functions. + */ +export declare const FUNCTIONS_TYPE = "functions"; diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/src/context.d.ts b/frontend-old/node_modules/@firebase/functions/dist/esm/src/context.d.ts new file mode 100644 index 0000000..2c3715a --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/src/context.d.ts @@ -0,0 +1,46 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Provider } from '@firebase/component'; +import { FirebaseApp } from '@firebase/app'; +import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types'; +import { MessagingInternalComponentName } from '@firebase/messaging-interop-types'; +import { FirebaseAuthInternalName } from '@firebase/auth-interop-types'; +/** + * The metadata that should be supplied with function calls. + * @internal + */ +export interface Context { + authToken?: string; + messagingToken?: string; + appCheckToken: string | null; +} +/** + * Helper class to get metadata that should be included with a function call. + * @internal + */ +export declare class ContextProvider { + readonly app: FirebaseApp; + private auth; + private messaging; + private appCheck; + private serverAppAppCheckToken; + constructor(app: FirebaseApp, authProvider: Provider, messagingProvider: Provider, appCheckProvider: Provider); + getAuthToken(): Promise; + getMessagingToken(): Promise; + getAppCheckToken(limitedUseAppCheckTokens?: boolean): Promise; + getContext(limitedUseAppCheckTokens?: boolean): Promise; +} diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/src/error.d.ts b/frontend-old/node_modules/@firebase/functions/dist/esm/src/error.d.ts new file mode 100644 index 0000000..2828891 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/src/error.d.ts @@ -0,0 +1,49 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FunctionsErrorCodeCore as FunctionsErrorCode } from './public-types'; +import { HttpResponseBody } from './service'; +import { FirebaseError } from '@firebase/util'; +/** + * An error returned by the Firebase Functions client SDK. + * + * See {@link FunctionsErrorCode} for full documentation of codes. + * + * @public + */ +export declare class FunctionsError extends FirebaseError { + /** + * Additional details to be converted to JSON and included in the error response. + */ + readonly details?: unknown; + /** + * Constructs a new instance of the `FunctionsError` class. + */ + constructor( + /** + * A standard error code that will be returned to the client. This also + * determines the HTTP status code of the response, as defined in code.proto. + */ + code: FunctionsErrorCode, message?: string, + /** + * Additional details to be converted to JSON and included in the error response. + */ + details?: unknown); +} +/** + * Takes an HTTP response and returns the corresponding Error, if any. + */ +export declare function _errorForResponse(status: number, bodyJSON: HttpResponseBody | null): Error | null; diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/src/index.d.ts b/frontend-old/node_modules/@firebase/functions/dist/esm/src/index.d.ts new file mode 100644 index 0000000..83261f8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/src/index.d.ts @@ -0,0 +1,7 @@ +/** + * Cloud Functions for Firebase + * + * @packageDocumentation + */ +export * from './api'; +export * from './public-types'; diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/src/public-types.d.ts b/frontend-old/node_modules/@firebase/functions/dist/esm/src/public-types.d.ts new file mode 100644 index 0000000..0c170a0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/src/public-types.d.ts @@ -0,0 +1,150 @@ +/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +/** + * An `HttpsCallableResult` wraps a single result from a function call. + * @public + */ +export interface HttpsCallableResult { + /** + * Data returned from callable function. + */ + readonly data: ResponseData; +} +/** + * An `HttpsCallableStreamResult` wraps a single streaming result from a function call. + * @public + */ +export interface HttpsCallableStreamResult { + readonly data: Promise; + readonly stream: AsyncIterable; +} +/** + * A reference to a "callable" HTTP trigger in Cloud Functions. + * @param data - Data to be passed to callable function. + * @public + */ +export interface HttpsCallable { + (data?: RequestData | null): Promise>; + stream: (data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise>; +} +/** + * An interface for metadata about how calls should be executed. + * @public + */ +export interface HttpsCallableOptions { + /** + * Time in milliseconds after which to cancel if there is no response. + * Default is 70000. + */ + timeout?: number; + /** + * If set to true, uses a limited-use App Check token for callable function requests from this + * instance of {@link Functions}. You must use limited-use tokens to call functions with + * replay protection enabled. By default, this is false. + */ + limitedUseAppCheckTokens?: boolean; +} +/** + * An interface for metadata about how a stream call should be executed. + * @public + */ +export interface HttpsCallableStreamOptions { + /** + * An `AbortSignal` that can be used to cancel the streaming response. When the signal is aborted, + * the underlying HTTP connection will be terminated. + */ + signal?: AbortSignal; + /** + * If set to true, uses a limited-use App Check token for callable function requests from this + * instance of {@link Functions}. You must use limited-use tokens to call functions with + * replay protection enabled. By default, this is false. + */ + limitedUseAppCheckTokens?: boolean; +} +/** + * A `Functions` instance. + * @public + */ +export interface Functions { + /** + * The {@link @firebase/app#FirebaseApp} this `Functions` instance is associated with. + */ + app: FirebaseApp; + /** + * The region the callable Cloud Functions are located in. + * Default is `us-central-1`. + */ + region: string; + /** + * A custom domain hosting the callable Cloud Functions. + * ex: https://mydomain.com + */ + customDomain: string | null; +} +/** + * Functions error code string appended after "functions/" product prefix. + * See {@link FunctionsErrorCode} for full documentation of codes. + * @public + */ +export type FunctionsErrorCodeCore = 'ok' | 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated'; +/** + * The set of Firebase Functions status codes. The codes are the same at the + * ones exposed by gRPC here: + * https://github.com/grpc/grpc/blob/master/doc/statuscodes.md + * + * Possible values: + * - 'cancelled': The operation was cancelled (typically by the caller). + * - 'unknown': Unknown error or an error from a different error domain. + * - 'invalid-argument': Client specified an invalid argument. Note that this + * differs from 'failed-precondition'. 'invalid-argument' indicates + * arguments that are problematic regardless of the state of the system + * (e.g. an invalid field name). + * - 'deadline-exceeded': Deadline expired before operation could complete. + * For operations that change the state of the system, this error may be + * returned even if the operation has completed successfully. For example, + * a successful response from a server could have been delayed long enough + * for the deadline to expire. + * - 'not-found': Some requested document was not found. + * - 'already-exists': Some document that we attempted to create already + * exists. + * - 'permission-denied': The caller does not have permission to execute the + * specified operation. + * - 'resource-exhausted': Some resource has been exhausted, perhaps a + * per-user quota, or perhaps the entire file system is out of space. + * - 'failed-precondition': Operation was rejected because the system is not + * in a state required for the operation's execution. + * - 'aborted': The operation was aborted, typically due to a concurrency + * issue like transaction aborts, etc. + * - 'out-of-range': Operation was attempted past the valid range. + * - 'unimplemented': Operation is not implemented or not supported/enabled. + * - 'internal': Internal errors. Means some invariants expected by + * underlying system has been broken. If you see one of these errors, + * something is very broken. + * - 'unavailable': The service is currently unavailable. This is most likely + * a transient condition and may be corrected by retrying with a backoff. + * - 'data-loss': Unrecoverable data loss or corruption. + * - 'unauthenticated': The request does not have valid authentication + * credentials for the operation. + * @public + */ +export type FunctionsErrorCode = `functions/${FunctionsErrorCodeCore}`; +declare module '@firebase/component' { + interface NameServiceMapping { + 'functions': Functions; + } +} diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/src/serializer.d.ts b/frontend-old/node_modules/@firebase/functions/dist/esm/src/serializer.d.ts new file mode 100644 index 0000000..ae746e0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/src/serializer.d.ts @@ -0,0 +1,14 @@ +/** + * Takes data and encodes it in a JSON-friendly way, such that types such as + * Date are preserved. + * @internal + * @param data - Data to encode. + */ +export declare function encode(data: unknown): unknown; +/** + * Takes data that's been encoded in a JSON-friendly form and returns a form + * with richer datatypes, such as Dates, etc. + * @internal + * @param json - JSON to convert. + */ +export declare function decode(json: unknown): unknown; diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/src/service.d.ts b/frontend-old/node_modules/@firebase/functions/dist/esm/src/service.d.ts new file mode 100644 index 0000000..67e0807 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/src/service.d.ts @@ -0,0 +1,86 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp, _FirebaseService } from '@firebase/app'; +import { HttpsCallable, HttpsCallableOptions } from './public-types'; +import { ContextProvider } from './context'; +import { Provider } from '@firebase/component'; +import { FirebaseAuthInternalName } from '@firebase/auth-interop-types'; +import { MessagingInternalComponentName } from '@firebase/messaging-interop-types'; +import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types'; +export declare const DEFAULT_REGION = "us-central1"; +/** + * Describes the shape of the HttpResponse body. + * It makes functions that would otherwise take {} able to access the + * possible elements in the body more easily + */ +export interface HttpResponseBody { + data?: unknown; + result?: unknown; + error?: { + message?: unknown; + status?: unknown; + details?: unknown; + }; +} +/** + * The main class for the Firebase Functions SDK. + * @internal + */ +export declare class FunctionsService implements _FirebaseService { + readonly app: FirebaseApp; + readonly fetchImpl: typeof fetch; + readonly contextProvider: ContextProvider; + emulatorOrigin: string | null; + cancelAllRequests: Promise; + deleteService: () => Promise; + region: string; + customDomain: string | null; + /** + * Creates a new Functions service for the given app. + * @param app - The FirebaseApp to use. + */ + constructor(app: FirebaseApp, authProvider: Provider, messagingProvider: Provider, appCheckProvider: Provider, regionOrCustomDomain?: string, fetchImpl?: typeof fetch); + _delete(): Promise; + /** + * Returns the URL for a callable with the given name. + * @param name - The name of the callable. + * @internal + */ + _url(name: string): string; +} +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * + * Note: this must be called before this instance has been used to do any operations. + * + * @param host The emulator host (ex: localhost) + * @param port The emulator port (ex: 5001) + * @public + */ +export declare function connectFunctionsEmulator(functionsInstance: FunctionsService, host: string, port: number): void; +/** + * Returns a reference to the callable https trigger with the given name. + * @param name - The name of the trigger. + * @public + */ +export declare function httpsCallable(functionsInstance: FunctionsService, name: string, options?: HttpsCallableOptions): HttpsCallable; +/** + * Returns a reference to the callable https trigger with the given url. + * @param url - The url of the trigger. + * @public + */ +export declare function httpsCallableFromURL(functionsInstance: FunctionsService, url: string, options?: HttpsCallableOptions): HttpsCallable; diff --git a/frontend-old/node_modules/@firebase/functions/dist/esm/test/utils.d.ts b/frontend-old/node_modules/@firebase/functions/dist/esm/test/utils.d.ts new file mode 100644 index 0000000..6345f10 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/esm/test/utils.d.ts @@ -0,0 +1,21 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseOptions, FirebaseApp } from '@firebase/app'; +import { Provider } from '@firebase/component'; +import { FunctionsService } from '../src/service'; +export declare function makeFakeApp(options?: FirebaseOptions): FirebaseApp; +export declare function createTestService(app: FirebaseApp, region?: string, authProvider?: Provider<"auth-internal">, messagingProvider?: Provider<"messaging-internal">, appCheckProvider?: Provider<"app-check-internal">): FunctionsService; diff --git a/frontend-old/node_modules/@firebase/functions/dist/functions-public.d.ts b/frontend-old/node_modules/@firebase/functions/dist/functions-public.d.ts new file mode 100644 index 0000000..31031b2 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/functions-public.d.ts @@ -0,0 +1,208 @@ +/** + * Cloud Functions for Firebase + * + * @packageDocumentation + */ + +import { FirebaseApp } from '@firebase/app'; +import { FirebaseError } from '@firebase/util'; + +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * + * Note: this must be called before this instance has been used to do any operations. + * + * @param host - The emulator host (ex: localhost) + * @param port - The emulator port (ex: 5001) + * @public + */ +export declare function connectFunctionsEmulator(functionsInstance: Functions, host: string, port: number): void; + +/** + * A `Functions` instance. + * @public + */ +export declare interface Functions { + /** + * The {@link @firebase/app#FirebaseApp} this `Functions` instance is associated with. + */ + app: FirebaseApp; + /** + * The region the callable Cloud Functions are located in. + * Default is `us-central-1`. + */ + region: string; + /** + * A custom domain hosting the callable Cloud Functions. + * ex: https://mydomain.com + */ + customDomain: string | null; +} + +/** + * An error returned by the Firebase Functions client SDK. + * + * See {@link FunctionsErrorCode} for full documentation of codes. + * + * @public + */ +export declare class FunctionsError extends FirebaseError { + /** + * Additional details to be converted to JSON and included in the error response. + */ + readonly details?: unknown; + /** + * Constructs a new instance of the `FunctionsError` class. + */ + constructor( + /** + * A standard error code that will be returned to the client. This also + * determines the HTTP status code of the response, as defined in code.proto. + */ + code: FunctionsErrorCodeCore, message?: string, + /** + * Additional details to be converted to JSON and included in the error response. + */ + details?: unknown); +} + +/** + * The set of Firebase Functions status codes. The codes are the same at the + * ones exposed by gRPC here: + * https://github.com/grpc/grpc/blob/master/doc/statuscodes.md + * + * Possible values: + * - 'cancelled': The operation was cancelled (typically by the caller). + * - 'unknown': Unknown error or an error from a different error domain. + * - 'invalid-argument': Client specified an invalid argument. Note that this + * differs from 'failed-precondition'. 'invalid-argument' indicates + * arguments that are problematic regardless of the state of the system + * (e.g. an invalid field name). + * - 'deadline-exceeded': Deadline expired before operation could complete. + * For operations that change the state of the system, this error may be + * returned even if the operation has completed successfully. For example, + * a successful response from a server could have been delayed long enough + * for the deadline to expire. + * - 'not-found': Some requested document was not found. + * - 'already-exists': Some document that we attempted to create already + * exists. + * - 'permission-denied': The caller does not have permission to execute the + * specified operation. + * - 'resource-exhausted': Some resource has been exhausted, perhaps a + * per-user quota, or perhaps the entire file system is out of space. + * - 'failed-precondition': Operation was rejected because the system is not + * in a state required for the operation's execution. + * - 'aborted': The operation was aborted, typically due to a concurrency + * issue like transaction aborts, etc. + * - 'out-of-range': Operation was attempted past the valid range. + * - 'unimplemented': Operation is not implemented or not supported/enabled. + * - 'internal': Internal errors. Means some invariants expected by + * underlying system has been broken. If you see one of these errors, + * something is very broken. + * - 'unavailable': The service is currently unavailable. This is most likely + * a transient condition and may be corrected by retrying with a backoff. + * - 'data-loss': Unrecoverable data loss or corruption. + * - 'unauthenticated': The request does not have valid authentication + * credentials for the operation. + * @public + */ +export declare type FunctionsErrorCode = `functions/${FunctionsErrorCodeCore}`; + +/** + * Functions error code string appended after "functions/" product prefix. + * See {@link FunctionsErrorCode} for full documentation of codes. + * @public + */ +export declare type FunctionsErrorCodeCore = 'ok' | 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated'; + +/** + * Returns a {@link Functions} instance for the given app. + * @param app - The {@link @firebase/app#FirebaseApp} to use. + * @param regionOrCustomDomain - one of: + * a) The region the callable functions are located in (ex: us-central1) + * b) A custom domain hosting the callable functions (ex: https://mydomain.com) + * @public + */ +export declare function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions; + +/** + * A reference to a "callable" HTTP trigger in Cloud Functions. + * @param data - Data to be passed to callable function. + * @public + */ +export declare interface HttpsCallable { + (data?: RequestData | null): Promise>; + stream: (data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise>; +} + +/** + * Returns a reference to the callable HTTPS trigger with the given name. + * @param name - The name of the trigger. + * @public + */ +export declare function httpsCallable(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable; + +/** + * Returns a reference to the callable HTTPS trigger with the specified url. + * @param url - The url of the trigger. + * @public + */ +export declare function httpsCallableFromURL(functionsInstance: Functions, url: string, options?: HttpsCallableOptions): HttpsCallable; + +/** + * An interface for metadata about how calls should be executed. + * @public + */ +export declare interface HttpsCallableOptions { + /** + * Time in milliseconds after which to cancel if there is no response. + * Default is 70000. + */ + timeout?: number; + /** + * If set to true, uses a limited-use App Check token for callable function requests from this + * instance of {@link Functions}. You must use limited-use tokens to call functions with + * replay protection enabled. By default, this is false. + */ + limitedUseAppCheckTokens?: boolean; +} + +/** + * An `HttpsCallableResult` wraps a single result from a function call. + * @public + */ +export declare interface HttpsCallableResult { + /** + * Data returned from callable function. + */ + readonly data: ResponseData; +} + +/** + * An interface for metadata about how a stream call should be executed. + * @public + */ +export declare interface HttpsCallableStreamOptions { + /** + * An `AbortSignal` that can be used to cancel the streaming response. When the signal is aborted, + * the underlying HTTP connection will be terminated. + */ + signal?: AbortSignal; + /** + * If set to true, uses a limited-use App Check token for callable function requests from this + * instance of {@link Functions}. You must use limited-use tokens to call functions with + * replay protection enabled. By default, this is false. + */ + limitedUseAppCheckTokens?: boolean; +} + +/** + * An `HttpsCallableStreamResult` wraps a single streaming result from a function call. + * @public + */ +export declare interface HttpsCallableStreamResult { + readonly data: Promise; + readonly stream: AsyncIterable; +} + +export { } diff --git a/frontend-old/node_modules/@firebase/functions/dist/functions.d.ts b/frontend-old/node_modules/@firebase/functions/dist/functions.d.ts new file mode 100644 index 0000000..31031b2 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/functions.d.ts @@ -0,0 +1,208 @@ +/** + * Cloud Functions for Firebase + * + * @packageDocumentation + */ + +import { FirebaseApp } from '@firebase/app'; +import { FirebaseError } from '@firebase/util'; + +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * + * Note: this must be called before this instance has been used to do any operations. + * + * @param host - The emulator host (ex: localhost) + * @param port - The emulator port (ex: 5001) + * @public + */ +export declare function connectFunctionsEmulator(functionsInstance: Functions, host: string, port: number): void; + +/** + * A `Functions` instance. + * @public + */ +export declare interface Functions { + /** + * The {@link @firebase/app#FirebaseApp} this `Functions` instance is associated with. + */ + app: FirebaseApp; + /** + * The region the callable Cloud Functions are located in. + * Default is `us-central-1`. + */ + region: string; + /** + * A custom domain hosting the callable Cloud Functions. + * ex: https://mydomain.com + */ + customDomain: string | null; +} + +/** + * An error returned by the Firebase Functions client SDK. + * + * See {@link FunctionsErrorCode} for full documentation of codes. + * + * @public + */ +export declare class FunctionsError extends FirebaseError { + /** + * Additional details to be converted to JSON and included in the error response. + */ + readonly details?: unknown; + /** + * Constructs a new instance of the `FunctionsError` class. + */ + constructor( + /** + * A standard error code that will be returned to the client. This also + * determines the HTTP status code of the response, as defined in code.proto. + */ + code: FunctionsErrorCodeCore, message?: string, + /** + * Additional details to be converted to JSON and included in the error response. + */ + details?: unknown); +} + +/** + * The set of Firebase Functions status codes. The codes are the same at the + * ones exposed by gRPC here: + * https://github.com/grpc/grpc/blob/master/doc/statuscodes.md + * + * Possible values: + * - 'cancelled': The operation was cancelled (typically by the caller). + * - 'unknown': Unknown error or an error from a different error domain. + * - 'invalid-argument': Client specified an invalid argument. Note that this + * differs from 'failed-precondition'. 'invalid-argument' indicates + * arguments that are problematic regardless of the state of the system + * (e.g. an invalid field name). + * - 'deadline-exceeded': Deadline expired before operation could complete. + * For operations that change the state of the system, this error may be + * returned even if the operation has completed successfully. For example, + * a successful response from a server could have been delayed long enough + * for the deadline to expire. + * - 'not-found': Some requested document was not found. + * - 'already-exists': Some document that we attempted to create already + * exists. + * - 'permission-denied': The caller does not have permission to execute the + * specified operation. + * - 'resource-exhausted': Some resource has been exhausted, perhaps a + * per-user quota, or perhaps the entire file system is out of space. + * - 'failed-precondition': Operation was rejected because the system is not + * in a state required for the operation's execution. + * - 'aborted': The operation was aborted, typically due to a concurrency + * issue like transaction aborts, etc. + * - 'out-of-range': Operation was attempted past the valid range. + * - 'unimplemented': Operation is not implemented or not supported/enabled. + * - 'internal': Internal errors. Means some invariants expected by + * underlying system has been broken. If you see one of these errors, + * something is very broken. + * - 'unavailable': The service is currently unavailable. This is most likely + * a transient condition and may be corrected by retrying with a backoff. + * - 'data-loss': Unrecoverable data loss or corruption. + * - 'unauthenticated': The request does not have valid authentication + * credentials for the operation. + * @public + */ +export declare type FunctionsErrorCode = `functions/${FunctionsErrorCodeCore}`; + +/** + * Functions error code string appended after "functions/" product prefix. + * See {@link FunctionsErrorCode} for full documentation of codes. + * @public + */ +export declare type FunctionsErrorCodeCore = 'ok' | 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated'; + +/** + * Returns a {@link Functions} instance for the given app. + * @param app - The {@link @firebase/app#FirebaseApp} to use. + * @param regionOrCustomDomain - one of: + * a) The region the callable functions are located in (ex: us-central1) + * b) A custom domain hosting the callable functions (ex: https://mydomain.com) + * @public + */ +export declare function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions; + +/** + * A reference to a "callable" HTTP trigger in Cloud Functions. + * @param data - Data to be passed to callable function. + * @public + */ +export declare interface HttpsCallable { + (data?: RequestData | null): Promise>; + stream: (data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise>; +} + +/** + * Returns a reference to the callable HTTPS trigger with the given name. + * @param name - The name of the trigger. + * @public + */ +export declare function httpsCallable(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable; + +/** + * Returns a reference to the callable HTTPS trigger with the specified url. + * @param url - The url of the trigger. + * @public + */ +export declare function httpsCallableFromURL(functionsInstance: Functions, url: string, options?: HttpsCallableOptions): HttpsCallable; + +/** + * An interface for metadata about how calls should be executed. + * @public + */ +export declare interface HttpsCallableOptions { + /** + * Time in milliseconds after which to cancel if there is no response. + * Default is 70000. + */ + timeout?: number; + /** + * If set to true, uses a limited-use App Check token for callable function requests from this + * instance of {@link Functions}. You must use limited-use tokens to call functions with + * replay protection enabled. By default, this is false. + */ + limitedUseAppCheckTokens?: boolean; +} + +/** + * An `HttpsCallableResult` wraps a single result from a function call. + * @public + */ +export declare interface HttpsCallableResult { + /** + * Data returned from callable function. + */ + readonly data: ResponseData; +} + +/** + * An interface for metadata about how a stream call should be executed. + * @public + */ +export declare interface HttpsCallableStreamOptions { + /** + * An `AbortSignal` that can be used to cancel the streaming response. When the signal is aborted, + * the underlying HTTP connection will be terminated. + */ + signal?: AbortSignal; + /** + * If set to true, uses a limited-use App Check token for callable function requests from this + * instance of {@link Functions}. You must use limited-use tokens to call functions with + * replay protection enabled. By default, this is false. + */ + limitedUseAppCheckTokens?: boolean; +} + +/** + * An `HttpsCallableStreamResult` wraps a single streaming result from a function call. + * @public + */ +export declare interface HttpsCallableStreamResult { + readonly data: Promise; + readonly stream: AsyncIterable; +} + +export { } diff --git a/frontend-old/node_modules/@firebase/functions/dist/index.cjs.js b/frontend-old/node_modules/@firebase/functions/dist/index.cjs.js new file mode 100644 index 0000000..fafce2e --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/index.cjs.js @@ -0,0 +1,978 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var app = require('@firebase/app'); +var util = require('@firebase/util'); +var component = require('@firebase/component'); + +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const LONG_TYPE = 'type.googleapis.com/google.protobuf.Int64Value'; +const UNSIGNED_LONG_TYPE = 'type.googleapis.com/google.protobuf.UInt64Value'; +function mapValues( +// { [k: string]: unknown } is no longer a wildcard assignment target after typescript 3.5 +// eslint-disable-next-line @typescript-eslint/no-explicit-any +o, f) { + const result = {}; + for (const key in o) { + if (o.hasOwnProperty(key)) { + result[key] = f(o[key]); + } + } + return result; +} +/** + * Takes data and encodes it in a JSON-friendly way, such that types such as + * Date are preserved. + * @internal + * @param data - Data to encode. + */ +function encode(data) { + if (data == null) { + return null; + } + if (data instanceof Number) { + data = data.valueOf(); + } + if (typeof data === 'number' && isFinite(data)) { + // Any number in JS is safe to put directly in JSON and parse as a double + // without any loss of precision. + return data; + } + if (data === true || data === false) { + return data; + } + if (Object.prototype.toString.call(data) === '[object String]') { + return data; + } + if (data instanceof Date) { + return data.toISOString(); + } + if (Array.isArray(data)) { + return data.map(x => encode(x)); + } + if (typeof data === 'function' || typeof data === 'object') { + return mapValues(data, x => encode(x)); + } + // If we got this far, the data is not encodable. + throw new Error('Data cannot be encoded in JSON: ' + data); +} +/** + * Takes data that's been encoded in a JSON-friendly form and returns a form + * with richer datatypes, such as Dates, etc. + * @internal + * @param json - JSON to convert. + */ +function decode(json) { + if (json == null) { + return json; + } + if (json['@type']) { + switch (json['@type']) { + case LONG_TYPE: + // Fall through and handle this the same as unsigned. + case UNSIGNED_LONG_TYPE: { + // Technically, this could work return a valid number for malformed + // data if there was a number followed by garbage. But it's just not + // worth all the extra code to detect that case. + const value = Number(json['value']); + if (isNaN(value)) { + throw new Error('Data cannot be decoded from JSON: ' + json); + } + return value; + } + default: { + throw new Error('Data cannot be decoded from JSON: ' + json); + } + } + } + if (Array.isArray(json)) { + return json.map(x => decode(x)); + } + if (typeof json === 'function' || typeof json === 'object') { + return mapValues(json, x => decode(x)); + } + // Anything else is safe to return. + return json; +} + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Type constant for Firebase Functions. + */ +const FUNCTIONS_TYPE = 'functions'; + +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Standard error codes for different ways a request can fail, as defined by: + * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto + * + * This map is used primarily to convert from a backend error code string to + * a client SDK error code string, and make sure it's in the supported set. + */ +const errorCodeMap = { + OK: 'ok', + CANCELLED: 'cancelled', + UNKNOWN: 'unknown', + INVALID_ARGUMENT: 'invalid-argument', + DEADLINE_EXCEEDED: 'deadline-exceeded', + NOT_FOUND: 'not-found', + ALREADY_EXISTS: 'already-exists', + PERMISSION_DENIED: 'permission-denied', + UNAUTHENTICATED: 'unauthenticated', + RESOURCE_EXHAUSTED: 'resource-exhausted', + FAILED_PRECONDITION: 'failed-precondition', + ABORTED: 'aborted', + OUT_OF_RANGE: 'out-of-range', + UNIMPLEMENTED: 'unimplemented', + INTERNAL: 'internal', + UNAVAILABLE: 'unavailable', + DATA_LOSS: 'data-loss' +}; +/** + * An error returned by the Firebase Functions client SDK. + * + * See {@link FunctionsErrorCode} for full documentation of codes. + * + * @public + */ +class FunctionsError extends util.FirebaseError { + /** + * Constructs a new instance of the `FunctionsError` class. + */ + constructor( + /** + * A standard error code that will be returned to the client. This also + * determines the HTTP status code of the response, as defined in code.proto. + */ + code, message, + /** + * Additional details to be converted to JSON and included in the error response. + */ + details) { + super(`${FUNCTIONS_TYPE}/${code}`, message || ''); + this.details = details; + // Since the FirebaseError constructor sets the prototype of `this` to FirebaseError.prototype, + // we also have to do it in all subclasses to allow for correct `instanceof` checks. + Object.setPrototypeOf(this, FunctionsError.prototype); + } +} +/** + * Takes an HTTP status code and returns the corresponding ErrorCode. + * This is the standard HTTP status code -> error mapping defined in: + * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto + * + * @param status An HTTP status code. + * @return The corresponding ErrorCode, or ErrorCode.UNKNOWN if none. + */ +function codeForHTTPStatus(status) { + // Make sure any successful status is OK. + if (status >= 200 && status < 300) { + return 'ok'; + } + switch (status) { + case 0: + // This can happen if the server returns 500. + return 'internal'; + case 400: + return 'invalid-argument'; + case 401: + return 'unauthenticated'; + case 403: + return 'permission-denied'; + case 404: + return 'not-found'; + case 409: + return 'aborted'; + case 429: + return 'resource-exhausted'; + case 499: + return 'cancelled'; + case 500: + return 'internal'; + case 501: + return 'unimplemented'; + case 503: + return 'unavailable'; + case 504: + return 'deadline-exceeded'; + } + return 'unknown'; +} +/** + * Takes an HTTP response and returns the corresponding Error, if any. + */ +function _errorForResponse(status, bodyJSON) { + let code = codeForHTTPStatus(status); + // Start with reasonable defaults from the status code. + let description = code; + let details = undefined; + // Then look through the body for explicit details. + try { + const errorJSON = bodyJSON && bodyJSON.error; + if (errorJSON) { + const status = errorJSON.status; + if (typeof status === 'string') { + if (!errorCodeMap[status]) { + // They must've included an unknown error code in the body. + return new FunctionsError('internal', 'internal'); + } + code = errorCodeMap[status]; + // TODO(klimt): Add better default descriptions for error enums. + // The default description needs to be updated for the new code. + description = status; + } + const message = errorJSON.message; + if (typeof message === 'string') { + description = message; + } + details = errorJSON.details; + if (details !== undefined) { + details = decode(details); + } + } + } + catch (e) { + // If we couldn't parse explicit error data, that's fine. + } + if (code === 'ok') { + // Technically, there's an edge case where a developer could explicitly + // return an error code of OK, and we will treat it as success, but that + // seems reasonable. + return null; + } + return new FunctionsError(code, description, details); +} + +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Helper class to get metadata that should be included with a function call. + * @internal + */ +class ContextProvider { + constructor(app$1, authProvider, messagingProvider, appCheckProvider) { + this.app = app$1; + this.auth = null; + this.messaging = null; + this.appCheck = null; + this.serverAppAppCheckToken = null; + if (app._isFirebaseServerApp(app$1) && app$1.settings.appCheckToken) { + this.serverAppAppCheckToken = app$1.settings.appCheckToken; + } + this.auth = authProvider.getImmediate({ optional: true }); + this.messaging = messagingProvider.getImmediate({ + optional: true + }); + if (!this.auth) { + authProvider.get().then(auth => (this.auth = auth), () => { + /* get() never rejects */ + }); + } + if (!this.messaging) { + messagingProvider.get().then(messaging => (this.messaging = messaging), () => { + /* get() never rejects */ + }); + } + if (!this.appCheck) { + appCheckProvider?.get().then(appCheck => (this.appCheck = appCheck), () => { + /* get() never rejects */ + }); + } + } + async getAuthToken() { + if (!this.auth) { + return undefined; + } + try { + const token = await this.auth.getToken(); + return token?.accessToken; + } + catch (e) { + // If there's any error when trying to get the auth token, leave it off. + return undefined; + } + } + async getMessagingToken() { + if (!this.messaging || + !('Notification' in self) || + Notification.permission !== 'granted') { + return undefined; + } + try { + return await this.messaging.getToken(); + } + catch (e) { + // We don't warn on this, because it usually means messaging isn't set up. + // console.warn('Failed to retrieve instance id token.', e); + // If there's any error when trying to get the token, leave it off. + return undefined; + } + } + async getAppCheckToken(limitedUseAppCheckTokens) { + if (this.serverAppAppCheckToken) { + return this.serverAppAppCheckToken; + } + if (this.appCheck) { + const result = limitedUseAppCheckTokens + ? await this.appCheck.getLimitedUseToken() + : await this.appCheck.getToken(); + if (result.error) { + // Do not send the App Check header to the functions endpoint if + // there was an error from the App Check exchange endpoint. The App + // Check SDK will already have logged the error to console. + return null; + } + return result.token; + } + return null; + } + async getContext(limitedUseAppCheckTokens) { + const authToken = await this.getAuthToken(); + const messagingToken = await this.getMessagingToken(); + const appCheckToken = await this.getAppCheckToken(limitedUseAppCheckTokens); + return { authToken, messagingToken, appCheckToken }; + } +} + +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const DEFAULT_REGION = 'us-central1'; +const responseLineRE = /^data: (.*?)(?:\n|$)/; +/** + * Returns a Promise that will be rejected after the given duration. + * The error will be of type FunctionsError. + * + * @param millis Number of milliseconds to wait before rejecting. + */ +function failAfter(millis) { + // Node timers and browser timers are fundamentally incompatible, but we + // don't care about the value here + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let timer = null; + return { + promise: new Promise((_, reject) => { + timer = setTimeout(() => { + reject(new FunctionsError('deadline-exceeded', 'deadline-exceeded')); + }, millis); + }), + cancel: () => { + if (timer) { + clearTimeout(timer); + } + } + }; +} +/** + * The main class for the Firebase Functions SDK. + * @internal + */ +class FunctionsService { + /** + * Creates a new Functions service for the given app. + * @param app - The FirebaseApp to use. + */ + constructor(app, authProvider, messagingProvider, appCheckProvider, regionOrCustomDomain = DEFAULT_REGION, fetchImpl = (...args) => fetch(...args)) { + this.app = app; + this.fetchImpl = fetchImpl; + this.emulatorOrigin = null; + this.contextProvider = new ContextProvider(app, authProvider, messagingProvider, appCheckProvider); + // Cancels all ongoing requests when resolved. + this.cancelAllRequests = new Promise(resolve => { + this.deleteService = () => { + return Promise.resolve(resolve()); + }; + }); + // Resolve the region or custom domain overload by attempting to parse it. + try { + const url = new URL(regionOrCustomDomain); + this.customDomain = + url.origin + (url.pathname === '/' ? '' : url.pathname); + this.region = DEFAULT_REGION; + } + catch (e) { + this.customDomain = null; + this.region = regionOrCustomDomain; + } + } + _delete() { + return this.deleteService(); + } + /** + * Returns the URL for a callable with the given name. + * @param name - The name of the callable. + * @internal + */ + _url(name) { + const projectId = this.app.options.projectId; + if (this.emulatorOrigin !== null) { + const origin = this.emulatorOrigin; + return `${origin}/${projectId}/${this.region}/${name}`; + } + if (this.customDomain !== null) { + return `${this.customDomain}/${name}`; + } + return `https://${this.region}-${projectId}.cloudfunctions.net/${name}`; + } +} +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * + * Note: this must be called before this instance has been used to do any operations. + * + * @param host The emulator host (ex: localhost) + * @param port The emulator port (ex: 5001) + * @public + */ +function connectFunctionsEmulator$1(functionsInstance, host, port) { + const useSsl = util.isCloudWorkstation(host); + functionsInstance.emulatorOrigin = `http${useSsl ? 's' : ''}://${host}:${port}`; + // Workaround to get cookies in Firebase Studio + if (useSsl) { + void util.pingServer(functionsInstance.emulatorOrigin + '/backends'); + util.updateEmulatorBanner('Functions', true); + } +} +/** + * Returns a reference to the callable https trigger with the given name. + * @param name - The name of the trigger. + * @public + */ +function httpsCallable$1(functionsInstance, name, options) { + const callable = (data) => { + return call(functionsInstance, name, data, options || {}); + }; + callable.stream = (data, options) => { + return stream(functionsInstance, name, data, options); + }; + return callable; +} +/** + * Returns a reference to the callable https trigger with the given url. + * @param url - The url of the trigger. + * @public + */ +function httpsCallableFromURL$1(functionsInstance, url, options) { + const callable = (data) => { + return callAtURL(functionsInstance, url, data, options || {}); + }; + callable.stream = (data, options) => { + return streamAtURL(functionsInstance, url, data, options || {}); + }; + return callable; +} +function getCredentials(functionsInstance) { + return functionsInstance.emulatorOrigin && + util.isCloudWorkstation(functionsInstance.emulatorOrigin) + ? 'include' + : undefined; +} +/** + * Does an HTTP POST and returns the completed response. + * @param url The url to post to. + * @param body The JSON body of the post. + * @param headers The HTTP headers to include in the request. + * @param functionsInstance functions instance that is calling postJSON + * @return A Promise that will succeed when the request finishes. + */ +async function postJSON(url, body, headers, fetchImpl, functionsInstance) { + headers['Content-Type'] = 'application/json'; + let response; + try { + response = await fetchImpl(url, { + method: 'POST', + body: JSON.stringify(body), + headers, + credentials: getCredentials(functionsInstance) + }); + } + catch (e) { + // This could be an unhandled error on the backend, or it could be a + // network error. There's no way to know, since an unhandled error on the + // backend will fail to set the proper CORS header, and thus will be + // treated as a network error by fetch. + return { + status: 0, + json: null + }; + } + let json = null; + try { + json = await response.json(); + } + catch (e) { + // If we fail to parse JSON, it will fail the same as an empty body. + } + return { + status: response.status, + json + }; +} +/** + * Creates authorization headers for Firebase Functions requests. + * @param functionsInstance The Firebase Functions service instance. + * @param options Options for the callable function, including AppCheck token settings. + * @return A Promise that resolves a headers map to include in outgoing fetch request. + */ +async function makeAuthHeaders(functionsInstance, options) { + const headers = {}; + const context = await functionsInstance.contextProvider.getContext(options.limitedUseAppCheckTokens); + if (context.authToken) { + headers['Authorization'] = 'Bearer ' + context.authToken; + } + if (context.messagingToken) { + headers['Firebase-Instance-ID-Token'] = context.messagingToken; + } + if (context.appCheckToken !== null) { + headers['X-Firebase-AppCheck'] = context.appCheckToken; + } + return headers; +} +/** + * Calls a callable function asynchronously and returns the result. + * @param name The name of the callable trigger. + * @param data The data to pass as params to the function. + */ +function call(functionsInstance, name, data, options) { + const url = functionsInstance._url(name); + return callAtURL(functionsInstance, url, data, options); +} +/** + * Calls a callable function asynchronously and returns the result. + * @param url The url of the callable trigger. + * @param data The data to pass as params to the function. + */ +async function callAtURL(functionsInstance, url, data, options) { + // Encode any special types, such as dates, in the input data. + data = encode(data); + const body = { data }; + // Add a header for the authToken. + const headers = await makeAuthHeaders(functionsInstance, options); + // Default timeout to 70s, but let the options override it. + const timeout = options.timeout || 70000; + const failAfterHandle = failAfter(timeout); + const response = await Promise.race([ + postJSON(url, body, headers, functionsInstance.fetchImpl, functionsInstance), + failAfterHandle.promise, + functionsInstance.cancelAllRequests + ]); + // Always clear the failAfter timeout + failAfterHandle.cancel(); + // If service was deleted, interrupted response throws an error. + if (!response) { + throw new FunctionsError('cancelled', 'Firebase Functions instance was deleted.'); + } + // Check for an error status, regardless of http status. + const error = _errorForResponse(response.status, response.json); + if (error) { + throw error; + } + if (!response.json) { + throw new FunctionsError('internal', 'Response is not valid JSON object.'); + } + let responseData = response.json.data; + // TODO(klimt): For right now, allow "result" instead of "data", for + // backwards compatibility. + if (typeof responseData === 'undefined') { + responseData = response.json.result; + } + if (typeof responseData === 'undefined') { + // Consider the response malformed. + throw new FunctionsError('internal', 'Response is missing data field.'); + } + // Decode any special types, such as dates, in the returned data. + const decodedData = decode(responseData); + return { data: decodedData }; +} +/** + * Calls a callable function asynchronously and returns a streaming result. + * @param name The name of the callable trigger. + * @param data The data to pass as params to the function. + * @param options Streaming request options. + */ +function stream(functionsInstance, name, data, options) { + const url = functionsInstance._url(name); + return streamAtURL(functionsInstance, url, data, options || {}); +} +/** + * Calls a callable function asynchronously and return a streaming result. + * @param url The url of the callable trigger. + * @param data The data to pass as params to the function. + * @param options Streaming request options. + */ +async function streamAtURL(functionsInstance, url, data, options) { + // Encode any special types, such as dates, in the input data. + data = encode(data); + const body = { data }; + // + // Add a header for the authToken. + const headers = await makeAuthHeaders(functionsInstance, options); + headers['Content-Type'] = 'application/json'; + headers['Accept'] = 'text/event-stream'; + let response; + try { + response = await functionsInstance.fetchImpl(url, { + method: 'POST', + body: JSON.stringify(body), + headers, + signal: options?.signal, + credentials: getCredentials(functionsInstance) + }); + } + catch (e) { + if (e instanceof Error && e.name === 'AbortError') { + const error = new FunctionsError('cancelled', 'Request was cancelled.'); + return { + data: Promise.reject(error), + stream: { + [Symbol.asyncIterator]() { + return { + next() { + return Promise.reject(error); + } + }; + } + } + }; + } + // This could be an unhandled error on the backend, or it could be a + // network error. There's no way to know, since an unhandled error on the + // backend will fail to set the proper CORS header, and thus will be + // treated as a network error by fetch. + const error = _errorForResponse(0, null); + return { + data: Promise.reject(error), + // Return an empty async iterator + stream: { + [Symbol.asyncIterator]() { + return { + next() { + return Promise.reject(error); + } + }; + } + } + }; + } + let resultResolver; + let resultRejecter; + const resultPromise = new Promise((resolve, reject) => { + resultResolver = resolve; + resultRejecter = reject; + }); + options?.signal?.addEventListener('abort', () => { + const error = new FunctionsError('cancelled', 'Request was cancelled.'); + resultRejecter(error); + }); + const reader = response.body.getReader(); + const rstream = createResponseStream(reader, resultResolver, resultRejecter, options?.signal); + return { + stream: { + [Symbol.asyncIterator]() { + const rreader = rstream.getReader(); + return { + async next() { + const { value, done } = await rreader.read(); + return { value: value, done }; + }, + async return() { + await rreader.cancel(); + return { done: true, value: undefined }; + } + }; + } + }, + data: resultPromise + }; +} +/** + * Creates a ReadableStream that processes a streaming response from a streaming + * callable function that returns data in server-sent event format. + * + * @param reader The underlying reader providing raw response data + * @param resultResolver Callback to resolve the final result when received + * @param resultRejecter Callback to reject with an error if encountered + * @param signal Optional AbortSignal to cancel the stream processing + * @returns A ReadableStream that emits decoded messages from the response + * + * The returned ReadableStream: + * 1. Emits individual messages when "message" data is received + * 2. Resolves with the final result when a "result" message is received + * 3. Rejects with an error if an "error" message is received + */ +function createResponseStream(reader, resultResolver, resultRejecter, signal) { + const processLine = (line, controller) => { + const match = line.match(responseLineRE); + // ignore all other lines (newline, comments, etc.) + if (!match) { + return; + } + const data = match[1]; + try { + const jsonData = JSON.parse(data); + if ('result' in jsonData) { + resultResolver(decode(jsonData.result)); + return; + } + if ('message' in jsonData) { + controller.enqueue(decode(jsonData.message)); + return; + } + if ('error' in jsonData) { + const error = _errorForResponse(0, jsonData); + controller.error(error); + resultRejecter(error); + return; + } + } + catch (error) { + if (error instanceof FunctionsError) { + controller.error(error); + resultRejecter(error); + return; + } + // ignore other parsing errors + } + }; + const decoder = new TextDecoder(); + return new ReadableStream({ + start(controller) { + let currentText = ''; + return pump(); + async function pump() { + if (signal?.aborted) { + const error = new FunctionsError('cancelled', 'Request was cancelled'); + controller.error(error); + resultRejecter(error); + return Promise.resolve(); + } + try { + const { value, done } = await reader.read(); + if (done) { + if (currentText.trim()) { + processLine(currentText.trim(), controller); + } + controller.close(); + return; + } + if (signal?.aborted) { + const error = new FunctionsError('cancelled', 'Request was cancelled'); + controller.error(error); + resultRejecter(error); + await reader.cancel(); + return; + } + currentText += decoder.decode(value, { stream: true }); + const lines = currentText.split('\n'); + currentText = lines.pop() || ''; + for (const line of lines) { + if (line.trim()) { + processLine(line.trim(), controller); + } + } + return pump(); + } + catch (error) { + const functionsError = error instanceof FunctionsError + ? error + : _errorForResponse(0, null); + controller.error(functionsError); + resultRejecter(functionsError); + } + } + }, + cancel() { + return reader.cancel(); + } + }); +} + +const name = "@firebase/functions"; +const version = "0.13.1"; + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const AUTH_INTERNAL_NAME = 'auth-internal'; +const APP_CHECK_INTERNAL_NAME = 'app-check-internal'; +const MESSAGING_INTERNAL_NAME = 'messaging-internal'; +function registerFunctions(variant) { + const factory = (container, { instanceIdentifier: regionOrCustomDomain }) => { + // Dependencies + const app = container.getProvider('app').getImmediate(); + const authProvider = container.getProvider(AUTH_INTERNAL_NAME); + const messagingProvider = container.getProvider(MESSAGING_INTERNAL_NAME); + const appCheckProvider = container.getProvider(APP_CHECK_INTERNAL_NAME); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return new FunctionsService(app, authProvider, messagingProvider, appCheckProvider, regionOrCustomDomain); + }; + app._registerComponent(new component.Component(FUNCTIONS_TYPE, factory, "PUBLIC" /* ComponentType.PUBLIC */).setMultipleInstances(true)); + app.registerVersion(name, version, variant); + // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation + app.registerVersion(name, version, 'cjs2020'); +} + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Returns a {@link Functions} instance for the given app. + * @param app - The {@link @firebase/app#FirebaseApp} to use. + * @param regionOrCustomDomain - one of: + * a) The region the callable functions are located in (ex: us-central1) + * b) A custom domain hosting the callable functions (ex: https://mydomain.com) + * @public + */ +function getFunctions(app$1 = app.getApp(), regionOrCustomDomain = DEFAULT_REGION) { + // Dependencies + const functionsProvider = app._getProvider(util.getModularInstance(app$1), FUNCTIONS_TYPE); + const functionsInstance = functionsProvider.getImmediate({ + identifier: regionOrCustomDomain + }); + const emulator = util.getDefaultEmulatorHostnameAndPort('functions'); + if (emulator) { + connectFunctionsEmulator(functionsInstance, ...emulator); + } + return functionsInstance; +} +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * + * Note: this must be called before this instance has been used to do any operations. + * + * @param host - The emulator host (ex: localhost) + * @param port - The emulator port (ex: 5001) + * @public + */ +function connectFunctionsEmulator(functionsInstance, host, port) { + connectFunctionsEmulator$1(util.getModularInstance(functionsInstance), host, port); +} +/** + * Returns a reference to the callable HTTPS trigger with the given name. + * @param name - The name of the trigger. + * @public + */ +function httpsCallable(functionsInstance, name, options) { + return httpsCallable$1(util.getModularInstance(functionsInstance), name, options); +} +/** + * Returns a reference to the callable HTTPS trigger with the specified url. + * @param url - The url of the trigger. + * @public + */ +function httpsCallableFromURL(functionsInstance, url, options) { + return httpsCallableFromURL$1(util.getModularInstance(functionsInstance), url, options); +} + +/** + * Cloud Functions for Firebase + * + * @packageDocumentation + */ +registerFunctions(); + +exports.FunctionsError = FunctionsError; +exports.connectFunctionsEmulator = connectFunctionsEmulator; +exports.getFunctions = getFunctions; +exports.httpsCallable = httpsCallable; +exports.httpsCallableFromURL = httpsCallableFromURL; +//# sourceMappingURL=index.cjs.js.map diff --git a/frontend-old/node_modules/@firebase/functions/dist/index.cjs.js.map b/frontend-old/node_modules/@firebase/functions/dist/index.cjs.js.map new file mode 100644 index 0000000..c670142 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/index.cjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.cjs.js","sources":["../src/serializer.ts","../src/constants.ts","../src/error.ts","../src/context.ts","../src/service.ts","../src/config.ts","../src/api.ts","../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst LONG_TYPE = 'type.googleapis.com/google.protobuf.Int64Value';\nconst UNSIGNED_LONG_TYPE = 'type.googleapis.com/google.protobuf.UInt64Value';\n\nfunction mapValues(\n // { [k: string]: unknown } is no longer a wildcard assignment target after typescript 3.5\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n o: { [key: string]: any },\n f: (arg0: unknown) => unknown\n): object {\n const result: { [key: string]: unknown } = {};\n for (const key in o) {\n if (o.hasOwnProperty(key)) {\n result[key] = f(o[key]);\n }\n }\n return result;\n}\n\n/**\n * Takes data and encodes it in a JSON-friendly way, such that types such as\n * Date are preserved.\n * @internal\n * @param data - Data to encode.\n */\nexport function encode(data: unknown): unknown {\n if (data == null) {\n return null;\n }\n if (data instanceof Number) {\n data = data.valueOf();\n }\n if (typeof data === 'number' && isFinite(data)) {\n // Any number in JS is safe to put directly in JSON and parse as a double\n // without any loss of precision.\n return data;\n }\n if (data === true || data === false) {\n return data;\n }\n if (Object.prototype.toString.call(data) === '[object String]') {\n return data;\n }\n if (data instanceof Date) {\n return data.toISOString();\n }\n if (Array.isArray(data)) {\n return data.map(x => encode(x));\n }\n if (typeof data === 'function' || typeof data === 'object') {\n return mapValues(data!, x => encode(x));\n }\n // If we got this far, the data is not encodable.\n throw new Error('Data cannot be encoded in JSON: ' + data);\n}\n\n/**\n * Takes data that's been encoded in a JSON-friendly form and returns a form\n * with richer datatypes, such as Dates, etc.\n * @internal\n * @param json - JSON to convert.\n */\nexport function decode(json: unknown): unknown {\n if (json == null) {\n return json;\n }\n if ((json as { [key: string]: unknown })['@type']) {\n switch ((json as { [key: string]: unknown })['@type']) {\n case LONG_TYPE:\n // Fall through and handle this the same as unsigned.\n case UNSIGNED_LONG_TYPE: {\n // Technically, this could work return a valid number for malformed\n // data if there was a number followed by garbage. But it's just not\n // worth all the extra code to detect that case.\n const value = Number((json as { [key: string]: unknown })['value']);\n if (isNaN(value)) {\n throw new Error('Data cannot be decoded from JSON: ' + json);\n }\n return value;\n }\n default: {\n throw new Error('Data cannot be decoded from JSON: ' + json);\n }\n }\n }\n if (Array.isArray(json)) {\n return json.map(x => decode(x));\n }\n if (typeof json === 'function' || typeof json === 'object') {\n return mapValues(json!, x => decode(x));\n }\n // Anything else is safe to return.\n return json;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Type constant for Firebase Functions.\n */\nexport const FUNCTIONS_TYPE = 'functions';\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FunctionsErrorCodeCore as FunctionsErrorCode } from './public-types';\nimport { decode } from './serializer';\nimport { HttpResponseBody } from './service';\nimport { FirebaseError } from '@firebase/util';\nimport { FUNCTIONS_TYPE } from './constants';\n\n/**\n * Standard error codes for different ways a request can fail, as defined by:\n * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto\n *\n * This map is used primarily to convert from a backend error code string to\n * a client SDK error code string, and make sure it's in the supported set.\n */\nconst errorCodeMap: { [name: string]: FunctionsErrorCode } = {\n OK: 'ok',\n CANCELLED: 'cancelled',\n UNKNOWN: 'unknown',\n INVALID_ARGUMENT: 'invalid-argument',\n DEADLINE_EXCEEDED: 'deadline-exceeded',\n NOT_FOUND: 'not-found',\n ALREADY_EXISTS: 'already-exists',\n PERMISSION_DENIED: 'permission-denied',\n UNAUTHENTICATED: 'unauthenticated',\n RESOURCE_EXHAUSTED: 'resource-exhausted',\n FAILED_PRECONDITION: 'failed-precondition',\n ABORTED: 'aborted',\n OUT_OF_RANGE: 'out-of-range',\n UNIMPLEMENTED: 'unimplemented',\n INTERNAL: 'internal',\n UNAVAILABLE: 'unavailable',\n DATA_LOSS: 'data-loss'\n};\n\n/**\n * An error returned by the Firebase Functions client SDK.\n *\n * See {@link FunctionsErrorCode} for full documentation of codes.\n *\n * @public\n */\nexport class FunctionsError extends FirebaseError {\n /**\n * Constructs a new instance of the `FunctionsError` class.\n */\n constructor(\n /**\n * A standard error code that will be returned to the client. This also\n * determines the HTTP status code of the response, as defined in code.proto.\n */\n code: FunctionsErrorCode,\n message?: string,\n /**\n * Additional details to be converted to JSON and included in the error response.\n */\n readonly details?: unknown\n ) {\n super(`${FUNCTIONS_TYPE}/${code}`, message || '');\n\n // Since the FirebaseError constructor sets the prototype of `this` to FirebaseError.prototype,\n // we also have to do it in all subclasses to allow for correct `instanceof` checks.\n Object.setPrototypeOf(this, FunctionsError.prototype);\n }\n}\n\n/**\n * Takes an HTTP status code and returns the corresponding ErrorCode.\n * This is the standard HTTP status code -> error mapping defined in:\n * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto\n *\n * @param status An HTTP status code.\n * @return The corresponding ErrorCode, or ErrorCode.UNKNOWN if none.\n */\nfunction codeForHTTPStatus(status: number): FunctionsErrorCode {\n // Make sure any successful status is OK.\n if (status >= 200 && status < 300) {\n return 'ok';\n }\n switch (status) {\n case 0:\n // This can happen if the server returns 500.\n return 'internal';\n case 400:\n return 'invalid-argument';\n case 401:\n return 'unauthenticated';\n case 403:\n return 'permission-denied';\n case 404:\n return 'not-found';\n case 409:\n return 'aborted';\n case 429:\n return 'resource-exhausted';\n case 499:\n return 'cancelled';\n case 500:\n return 'internal';\n case 501:\n return 'unimplemented';\n case 503:\n return 'unavailable';\n case 504:\n return 'deadline-exceeded';\n default: // ignore\n }\n return 'unknown';\n}\n\n/**\n * Takes an HTTP response and returns the corresponding Error, if any.\n */\nexport function _errorForResponse(\n status: number,\n bodyJSON: HttpResponseBody | null\n): Error | null {\n let code = codeForHTTPStatus(status);\n\n // Start with reasonable defaults from the status code.\n let description: string = code;\n\n let details: unknown = undefined;\n\n // Then look through the body for explicit details.\n try {\n const errorJSON = bodyJSON && bodyJSON.error;\n if (errorJSON) {\n const status = errorJSON.status;\n if (typeof status === 'string') {\n if (!errorCodeMap[status]) {\n // They must've included an unknown error code in the body.\n return new FunctionsError('internal', 'internal');\n }\n code = errorCodeMap[status];\n\n // TODO(klimt): Add better default descriptions for error enums.\n // The default description needs to be updated for the new code.\n description = status;\n }\n\n const message = errorJSON.message;\n if (typeof message === 'string') {\n description = message;\n }\n\n details = errorJSON.details;\n if (details !== undefined) {\n details = decode(details);\n }\n }\n } catch (e) {\n // If we couldn't parse explicit error data, that's fine.\n }\n\n if (code === 'ok') {\n // Technically, there's an edge case where a developer could explicitly\n // return an error code of OK, and we will treat it as success, but that\n // seems reasonable.\n return null;\n }\n\n return new FunctionsError(code, description, details);\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Provider } from '@firebase/component';\nimport { _isFirebaseServerApp, FirebaseApp } from '@firebase/app';\nimport {\n AppCheckInternalComponentName,\n FirebaseAppCheckInternal\n} from '@firebase/app-check-interop-types';\nimport {\n MessagingInternal,\n MessagingInternalComponentName\n} from '@firebase/messaging-interop-types';\nimport {\n FirebaseAuthInternal,\n FirebaseAuthInternalName\n} from '@firebase/auth-interop-types';\n\n/**\n * The metadata that should be supplied with function calls.\n * @internal\n */\nexport interface Context {\n authToken?: string;\n messagingToken?: string;\n appCheckToken: string | null;\n}\n\n/**\n * Helper class to get metadata that should be included with a function call.\n * @internal\n */\nexport class ContextProvider {\n private auth: FirebaseAuthInternal | null = null;\n private messaging: MessagingInternal | null = null;\n private appCheck: FirebaseAppCheckInternal | null = null;\n private serverAppAppCheckToken: string | null = null;\n constructor(\n readonly app: FirebaseApp,\n authProvider: Provider,\n messagingProvider: Provider,\n appCheckProvider: Provider\n ) {\n if (_isFirebaseServerApp(app) && app.settings.appCheckToken) {\n this.serverAppAppCheckToken = app.settings.appCheckToken;\n }\n this.auth = authProvider.getImmediate({ optional: true });\n this.messaging = messagingProvider.getImmediate({\n optional: true\n });\n\n if (!this.auth) {\n authProvider.get().then(\n auth => (this.auth = auth),\n () => {\n /* get() never rejects */\n }\n );\n }\n\n if (!this.messaging) {\n messagingProvider.get().then(\n messaging => (this.messaging = messaging),\n () => {\n /* get() never rejects */\n }\n );\n }\n\n if (!this.appCheck) {\n appCheckProvider?.get().then(\n appCheck => (this.appCheck = appCheck),\n () => {\n /* get() never rejects */\n }\n );\n }\n }\n\n async getAuthToken(): Promise {\n if (!this.auth) {\n return undefined;\n }\n\n try {\n const token = await this.auth.getToken();\n return token?.accessToken;\n } catch (e) {\n // If there's any error when trying to get the auth token, leave it off.\n return undefined;\n }\n }\n\n async getMessagingToken(): Promise {\n if (\n !this.messaging ||\n !('Notification' in self) ||\n Notification.permission !== 'granted'\n ) {\n return undefined;\n }\n\n try {\n return await this.messaging.getToken();\n } catch (e) {\n // We don't warn on this, because it usually means messaging isn't set up.\n // console.warn('Failed to retrieve instance id token.', e);\n\n // If there's any error when trying to get the token, leave it off.\n return undefined;\n }\n }\n\n async getAppCheckToken(\n limitedUseAppCheckTokens?: boolean\n ): Promise {\n if (this.serverAppAppCheckToken) {\n return this.serverAppAppCheckToken;\n }\n if (this.appCheck) {\n const result = limitedUseAppCheckTokens\n ? await this.appCheck.getLimitedUseToken()\n : await this.appCheck.getToken();\n if (result.error) {\n // Do not send the App Check header to the functions endpoint if\n // there was an error from the App Check exchange endpoint. The App\n // Check SDK will already have logged the error to console.\n return null;\n }\n return result.token;\n }\n return null;\n }\n\n async getContext(limitedUseAppCheckTokens?: boolean): Promise {\n const authToken = await this.getAuthToken();\n const messagingToken = await this.getMessagingToken();\n const appCheckToken = await this.getAppCheckToken(limitedUseAppCheckTokens);\n return { authToken, messagingToken, appCheckToken };\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseApp, _FirebaseService } from '@firebase/app';\nimport {\n HttpsCallable,\n HttpsCallableResult,\n HttpsCallableStreamResult,\n HttpsCallableOptions,\n HttpsCallableStreamOptions\n} from './public-types';\nimport { _errorForResponse, FunctionsError } from './error';\nimport { ContextProvider } from './context';\nimport { encode, decode } from './serializer';\nimport { Provider } from '@firebase/component';\nimport { FirebaseAuthInternalName } from '@firebase/auth-interop-types';\nimport { MessagingInternalComponentName } from '@firebase/messaging-interop-types';\nimport { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';\nimport {\n isCloudWorkstation,\n pingServer,\n updateEmulatorBanner\n} from '@firebase/util';\n\nexport const DEFAULT_REGION = 'us-central1';\n\nconst responseLineRE = /^data: (.*?)(?:\\n|$)/;\n\n/**\n * The response to an http request.\n */\ninterface HttpResponse {\n status: number;\n json: HttpResponseBody | null;\n}\n/**\n * Describes the shape of the HttpResponse body.\n * It makes functions that would otherwise take {} able to access the\n * possible elements in the body more easily\n */\nexport interface HttpResponseBody {\n data?: unknown;\n result?: unknown;\n error?: {\n message?: unknown;\n status?: unknown;\n details?: unknown;\n };\n}\n\ninterface CancellablePromise {\n promise: Promise;\n cancel: () => void;\n}\n\n/**\n * Returns a Promise that will be rejected after the given duration.\n * The error will be of type FunctionsError.\n *\n * @param millis Number of milliseconds to wait before rejecting.\n */\nfunction failAfter(millis: number): CancellablePromise {\n // Node timers and browser timers are fundamentally incompatible, but we\n // don't care about the value here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let timer: any | null = null;\n return {\n promise: new Promise((_, reject) => {\n timer = setTimeout(() => {\n reject(new FunctionsError('deadline-exceeded', 'deadline-exceeded'));\n }, millis);\n }),\n cancel: () => {\n if (timer) {\n clearTimeout(timer);\n }\n }\n };\n}\n\n/**\n * The main class for the Firebase Functions SDK.\n * @internal\n */\nexport class FunctionsService implements _FirebaseService {\n readonly contextProvider: ContextProvider;\n emulatorOrigin: string | null = null;\n cancelAllRequests: Promise;\n deleteService!: () => Promise;\n region: string;\n customDomain: string | null;\n\n /**\n * Creates a new Functions service for the given app.\n * @param app - The FirebaseApp to use.\n */\n constructor(\n readonly app: FirebaseApp,\n authProvider: Provider,\n messagingProvider: Provider,\n appCheckProvider: Provider,\n regionOrCustomDomain: string = DEFAULT_REGION,\n readonly fetchImpl: typeof fetch = (...args) => fetch(...args)\n ) {\n this.contextProvider = new ContextProvider(\n app,\n authProvider,\n messagingProvider,\n appCheckProvider\n );\n // Cancels all ongoing requests when resolved.\n this.cancelAllRequests = new Promise(resolve => {\n this.deleteService = () => {\n return Promise.resolve(resolve());\n };\n });\n\n // Resolve the region or custom domain overload by attempting to parse it.\n try {\n const url = new URL(regionOrCustomDomain);\n this.customDomain =\n url.origin + (url.pathname === '/' ? '' : url.pathname);\n this.region = DEFAULT_REGION;\n } catch (e) {\n this.customDomain = null;\n this.region = regionOrCustomDomain;\n }\n }\n\n _delete(): Promise {\n return this.deleteService();\n }\n\n /**\n * Returns the URL for a callable with the given name.\n * @param name - The name of the callable.\n * @internal\n */\n _url(name: string): string {\n const projectId = this.app.options.projectId;\n if (this.emulatorOrigin !== null) {\n const origin = this.emulatorOrigin;\n return `${origin}/${projectId}/${this.region}/${name}`;\n }\n\n if (this.customDomain !== null) {\n return `${this.customDomain}/${name}`;\n }\n\n return `https://${this.region}-${projectId}.cloudfunctions.net/${name}`;\n }\n}\n\n/**\n * Modify this instance to communicate with the Cloud Functions emulator.\n *\n * Note: this must be called before this instance has been used to do any operations.\n *\n * @param host The emulator host (ex: localhost)\n * @param port The emulator port (ex: 5001)\n * @public\n */\nexport function connectFunctionsEmulator(\n functionsInstance: FunctionsService,\n host: string,\n port: number\n): void {\n const useSsl = isCloudWorkstation(host);\n functionsInstance.emulatorOrigin = `http${\n useSsl ? 's' : ''\n }://${host}:${port}`;\n // Workaround to get cookies in Firebase Studio\n if (useSsl) {\n void pingServer(functionsInstance.emulatorOrigin + '/backends');\n updateEmulatorBanner('Functions', true);\n }\n}\n\n/**\n * Returns a reference to the callable https trigger with the given name.\n * @param name - The name of the trigger.\n * @public\n */\nexport function httpsCallable(\n functionsInstance: FunctionsService,\n name: string,\n options?: HttpsCallableOptions\n): HttpsCallable {\n const callable = (\n data?: RequestData | null\n ): Promise => {\n return call(functionsInstance, name, data, options || {});\n };\n\n callable.stream = (\n data?: RequestData | null,\n options?: HttpsCallableStreamOptions\n ) => {\n return stream(functionsInstance, name, data, options);\n };\n\n return callable as HttpsCallable;\n}\n\n/**\n * Returns a reference to the callable https trigger with the given url.\n * @param url - The url of the trigger.\n * @public\n */\nexport function httpsCallableFromURL<\n RequestData,\n ResponseData,\n StreamData = unknown\n>(\n functionsInstance: FunctionsService,\n url: string,\n options?: HttpsCallableOptions\n): HttpsCallable {\n const callable = (\n data?: RequestData | null\n ): Promise => {\n return callAtURL(functionsInstance, url, data, options || {});\n };\n\n callable.stream = (\n data?: RequestData | null,\n options?: HttpsCallableStreamOptions\n ) => {\n return streamAtURL(functionsInstance, url, data, options || {});\n };\n return callable as HttpsCallable;\n}\n\nfunction getCredentials(\n functionsInstance: FunctionsService\n): 'include' | undefined {\n return functionsInstance.emulatorOrigin &&\n isCloudWorkstation(functionsInstance.emulatorOrigin)\n ? 'include'\n : undefined;\n}\n\n/**\n * Does an HTTP POST and returns the completed response.\n * @param url The url to post to.\n * @param body The JSON body of the post.\n * @param headers The HTTP headers to include in the request.\n * @param functionsInstance functions instance that is calling postJSON\n * @return A Promise that will succeed when the request finishes.\n */\nasync function postJSON(\n url: string,\n body: unknown,\n headers: { [key: string]: string },\n fetchImpl: typeof fetch,\n functionsInstance: FunctionsService\n): Promise {\n headers['Content-Type'] = 'application/json';\n\n let response: Response;\n try {\n response = await fetchImpl(url, {\n method: 'POST',\n body: JSON.stringify(body),\n headers,\n credentials: getCredentials(functionsInstance)\n });\n } catch (e) {\n // This could be an unhandled error on the backend, or it could be a\n // network error. There's no way to know, since an unhandled error on the\n // backend will fail to set the proper CORS header, and thus will be\n // treated as a network error by fetch.\n return {\n status: 0,\n json: null\n };\n }\n let json: HttpResponseBody | null = null;\n try {\n json = await response.json();\n } catch (e) {\n // If we fail to parse JSON, it will fail the same as an empty body.\n }\n return {\n status: response.status,\n json\n };\n}\n\n/**\n * Creates authorization headers for Firebase Functions requests.\n * @param functionsInstance The Firebase Functions service instance.\n * @param options Options for the callable function, including AppCheck token settings.\n * @return A Promise that resolves a headers map to include in outgoing fetch request.\n */\nasync function makeAuthHeaders(\n functionsInstance: FunctionsService,\n options: HttpsCallableOptions\n): Promise> {\n const headers: Record = {};\n const context = await functionsInstance.contextProvider.getContext(\n options.limitedUseAppCheckTokens\n );\n if (context.authToken) {\n headers['Authorization'] = 'Bearer ' + context.authToken;\n }\n if (context.messagingToken) {\n headers['Firebase-Instance-ID-Token'] = context.messagingToken;\n }\n if (context.appCheckToken !== null) {\n headers['X-Firebase-AppCheck'] = context.appCheckToken;\n }\n return headers;\n}\n\n/**\n * Calls a callable function asynchronously and returns the result.\n * @param name The name of the callable trigger.\n * @param data The data to pass as params to the function.\n */\nfunction call(\n functionsInstance: FunctionsService,\n name: string,\n data: unknown,\n options: HttpsCallableOptions\n): Promise {\n const url = functionsInstance._url(name);\n return callAtURL(functionsInstance, url, data, options);\n}\n\n/**\n * Calls a callable function asynchronously and returns the result.\n * @param url The url of the callable trigger.\n * @param data The data to pass as params to the function.\n */\nasync function callAtURL(\n functionsInstance: FunctionsService,\n url: string,\n data: unknown,\n options: HttpsCallableOptions\n): Promise {\n // Encode any special types, such as dates, in the input data.\n data = encode(data);\n const body = { data };\n\n // Add a header for the authToken.\n const headers = await makeAuthHeaders(functionsInstance, options);\n\n // Default timeout to 70s, but let the options override it.\n const timeout = options.timeout || 70000;\n\n const failAfterHandle = failAfter(timeout);\n const response = await Promise.race([\n postJSON(\n url,\n body,\n headers,\n functionsInstance.fetchImpl,\n functionsInstance\n ),\n failAfterHandle.promise,\n functionsInstance.cancelAllRequests\n ]);\n\n // Always clear the failAfter timeout\n failAfterHandle.cancel();\n\n // If service was deleted, interrupted response throws an error.\n if (!response) {\n throw new FunctionsError(\n 'cancelled',\n 'Firebase Functions instance was deleted.'\n );\n }\n\n // Check for an error status, regardless of http status.\n const error = _errorForResponse(response.status, response.json);\n if (error) {\n throw error;\n }\n\n if (!response.json) {\n throw new FunctionsError('internal', 'Response is not valid JSON object.');\n }\n\n let responseData = response.json.data;\n // TODO(klimt): For right now, allow \"result\" instead of \"data\", for\n // backwards compatibility.\n if (typeof responseData === 'undefined') {\n responseData = response.json.result;\n }\n if (typeof responseData === 'undefined') {\n // Consider the response malformed.\n throw new FunctionsError('internal', 'Response is missing data field.');\n }\n\n // Decode any special types, such as dates, in the returned data.\n const decodedData = decode(responseData);\n\n return { data: decodedData };\n}\n\n/**\n * Calls a callable function asynchronously and returns a streaming result.\n * @param name The name of the callable trigger.\n * @param data The data to pass as params to the function.\n * @param options Streaming request options.\n */\nfunction stream(\n functionsInstance: FunctionsService,\n name: string,\n data: unknown,\n options?: HttpsCallableStreamOptions\n): Promise {\n const url = functionsInstance._url(name);\n return streamAtURL(functionsInstance, url, data, options || {});\n}\n\n/**\n * Calls a callable function asynchronously and return a streaming result.\n * @param url The url of the callable trigger.\n * @param data The data to pass as params to the function.\n * @param options Streaming request options.\n */\nasync function streamAtURL(\n functionsInstance: FunctionsService,\n url: string,\n data: unknown,\n options: HttpsCallableStreamOptions\n): Promise {\n // Encode any special types, such as dates, in the input data.\n data = encode(data);\n const body = { data };\n //\n // Add a header for the authToken.\n const headers = await makeAuthHeaders(functionsInstance, options);\n headers['Content-Type'] = 'application/json';\n headers['Accept'] = 'text/event-stream';\n\n let response: Response;\n try {\n response = await functionsInstance.fetchImpl(url, {\n method: 'POST',\n body: JSON.stringify(body),\n headers,\n signal: options?.signal,\n credentials: getCredentials(functionsInstance)\n });\n } catch (e) {\n if (e instanceof Error && e.name === 'AbortError') {\n const error = new FunctionsError('cancelled', 'Request was cancelled.');\n return {\n data: Promise.reject(error),\n stream: {\n [Symbol.asyncIterator]() {\n return {\n next() {\n return Promise.reject(error);\n }\n };\n }\n }\n };\n }\n // This could be an unhandled error on the backend, or it could be a\n // network error. There's no way to know, since an unhandled error on the\n // backend will fail to set the proper CORS header, and thus will be\n // treated as a network error by fetch.\n const error = _errorForResponse(0, null);\n return {\n data: Promise.reject(error),\n // Return an empty async iterator\n stream: {\n [Symbol.asyncIterator]() {\n return {\n next() {\n return Promise.reject(error);\n }\n };\n }\n }\n };\n }\n let resultResolver: (value: unknown) => void;\n let resultRejecter: (reason: unknown) => void;\n const resultPromise = new Promise((resolve, reject) => {\n resultResolver = resolve;\n resultRejecter = reject;\n });\n options?.signal?.addEventListener('abort', () => {\n const error = new FunctionsError('cancelled', 'Request was cancelled.');\n resultRejecter(error);\n });\n const reader = response.body!.getReader();\n const rstream = createResponseStream(\n reader,\n resultResolver!,\n resultRejecter!,\n options?.signal\n );\n return {\n stream: {\n [Symbol.asyncIterator]() {\n const rreader = rstream.getReader();\n return {\n async next() {\n const { value, done } = await rreader.read();\n return { value: value as unknown, done };\n },\n async return() {\n await rreader.cancel();\n return { done: true, value: undefined };\n }\n };\n }\n },\n data: resultPromise\n };\n}\n\n/**\n * Creates a ReadableStream that processes a streaming response from a streaming\n * callable function that returns data in server-sent event format.\n *\n * @param reader The underlying reader providing raw response data\n * @param resultResolver Callback to resolve the final result when received\n * @param resultRejecter Callback to reject with an error if encountered\n * @param signal Optional AbortSignal to cancel the stream processing\n * @returns A ReadableStream that emits decoded messages from the response\n *\n * The returned ReadableStream:\n * 1. Emits individual messages when \"message\" data is received\n * 2. Resolves with the final result when a \"result\" message is received\n * 3. Rejects with an error if an \"error\" message is received\n */\nfunction createResponseStream(\n reader: ReadableStreamDefaultReader,\n resultResolver: (value: unknown) => void,\n resultRejecter: (reason: unknown) => void,\n signal?: AbortSignal\n): ReadableStream {\n const processLine = (\n line: string,\n controller: ReadableStreamDefaultController\n ): void => {\n const match = line.match(responseLineRE);\n // ignore all other lines (newline, comments, etc.)\n if (!match) {\n return;\n }\n const data = match[1];\n try {\n const jsonData = JSON.parse(data);\n if ('result' in jsonData) {\n resultResolver(decode(jsonData.result));\n return;\n }\n if ('message' in jsonData) {\n controller.enqueue(decode(jsonData.message));\n return;\n }\n if ('error' in jsonData) {\n const error = _errorForResponse(0, jsonData);\n controller.error(error);\n resultRejecter(error);\n return;\n }\n } catch (error) {\n if (error instanceof FunctionsError) {\n controller.error(error);\n resultRejecter(error);\n return;\n }\n // ignore other parsing errors\n }\n };\n\n const decoder = new TextDecoder();\n return new ReadableStream({\n start(controller) {\n let currentText = '';\n return pump();\n async function pump(): Promise {\n if (signal?.aborted) {\n const error = new FunctionsError(\n 'cancelled',\n 'Request was cancelled'\n );\n controller.error(error);\n resultRejecter(error);\n return Promise.resolve();\n }\n try {\n const { value, done } = await reader.read();\n if (done) {\n if (currentText.trim()) {\n processLine(currentText.trim(), controller);\n }\n controller.close();\n return;\n }\n if (signal?.aborted) {\n const error = new FunctionsError(\n 'cancelled',\n 'Request was cancelled'\n );\n controller.error(error);\n resultRejecter(error);\n await reader.cancel();\n return;\n }\n currentText += decoder.decode(value, { stream: true });\n const lines = currentText.split('\\n');\n currentText = lines.pop() || '';\n for (const line of lines) {\n if (line.trim()) {\n processLine(line.trim(), controller);\n }\n }\n return pump();\n } catch (error) {\n const functionsError =\n error instanceof FunctionsError\n ? error\n : _errorForResponse(0, null);\n controller.error(functionsError);\n resultRejecter(functionsError);\n }\n }\n },\n cancel() {\n return reader.cancel();\n }\n });\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _registerComponent, registerVersion } from '@firebase/app';\nimport { FunctionsService } from './service';\nimport {\n Component,\n ComponentType,\n ComponentContainer,\n InstanceFactory\n} from '@firebase/component';\nimport { FUNCTIONS_TYPE } from './constants';\nimport { FirebaseAuthInternalName } from '@firebase/auth-interop-types';\nimport { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';\nimport { MessagingInternalComponentName } from '@firebase/messaging-interop-types';\nimport { name, version } from '../package.json';\n\nconst AUTH_INTERNAL_NAME: FirebaseAuthInternalName = 'auth-internal';\nconst APP_CHECK_INTERNAL_NAME: AppCheckInternalComponentName =\n 'app-check-internal';\nconst MESSAGING_INTERNAL_NAME: MessagingInternalComponentName =\n 'messaging-internal';\n\nexport function registerFunctions(variant?: string): void {\n const factory: InstanceFactory<'functions'> = (\n container: ComponentContainer,\n { instanceIdentifier: regionOrCustomDomain }\n ) => {\n // Dependencies\n const app = container.getProvider('app').getImmediate();\n const authProvider = container.getProvider(AUTH_INTERNAL_NAME);\n const messagingProvider = container.getProvider(MESSAGING_INTERNAL_NAME);\n const appCheckProvider = container.getProvider(APP_CHECK_INTERNAL_NAME);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new FunctionsService(\n app,\n authProvider,\n messagingProvider,\n appCheckProvider,\n regionOrCustomDomain\n );\n };\n\n _registerComponent(\n new Component(\n FUNCTIONS_TYPE,\n factory,\n ComponentType.PUBLIC\n ).setMultipleInstances(true)\n );\n\n registerVersion(name, version, variant);\n // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation\n registerVersion(name, version, '__BUILD_TARGET__');\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _getProvider, FirebaseApp, getApp } from '@firebase/app';\nimport { FUNCTIONS_TYPE } from './constants';\n\nimport { Provider } from '@firebase/component';\nimport { Functions, HttpsCallableOptions, HttpsCallable } from './public-types';\nimport {\n FunctionsService,\n DEFAULT_REGION,\n connectFunctionsEmulator as _connectFunctionsEmulator,\n httpsCallable as _httpsCallable,\n httpsCallableFromURL as _httpsCallableFromURL\n} from './service';\nimport {\n getModularInstance,\n getDefaultEmulatorHostnameAndPort\n} from '@firebase/util';\n\nexport { FunctionsError } from './error';\nexport * from './public-types';\n\n/**\n * Returns a {@link Functions} instance for the given app.\n * @param app - The {@link @firebase/app#FirebaseApp} to use.\n * @param regionOrCustomDomain - one of:\n * a) The region the callable functions are located in (ex: us-central1)\n * b) A custom domain hosting the callable functions (ex: https://mydomain.com)\n * @public\n */\nexport function getFunctions(\n app: FirebaseApp = getApp(),\n regionOrCustomDomain: string = DEFAULT_REGION\n): Functions {\n // Dependencies\n const functionsProvider: Provider<'functions'> = _getProvider(\n getModularInstance(app),\n FUNCTIONS_TYPE\n );\n const functionsInstance = functionsProvider.getImmediate({\n identifier: regionOrCustomDomain\n });\n const emulator = getDefaultEmulatorHostnameAndPort('functions');\n if (emulator) {\n connectFunctionsEmulator(functionsInstance, ...emulator);\n }\n return functionsInstance;\n}\n\n/**\n * Modify this instance to communicate with the Cloud Functions emulator.\n *\n * Note: this must be called before this instance has been used to do any operations.\n *\n * @param host - The emulator host (ex: localhost)\n * @param port - The emulator port (ex: 5001)\n * @public\n */\nexport function connectFunctionsEmulator(\n functionsInstance: Functions,\n host: string,\n port: number\n): void {\n _connectFunctionsEmulator(\n getModularInstance(functionsInstance as FunctionsService),\n host,\n port\n );\n}\n\n/**\n * Returns a reference to the callable HTTPS trigger with the given name.\n * @param name - The name of the trigger.\n * @public\n */\nexport function httpsCallable<\n RequestData = unknown,\n ResponseData = unknown,\n StreamData = unknown\n>(\n functionsInstance: Functions,\n name: string,\n options?: HttpsCallableOptions\n): HttpsCallable {\n return _httpsCallable(\n getModularInstance(functionsInstance as FunctionsService),\n name,\n options\n );\n}\n\n/**\n * Returns a reference to the callable HTTPS trigger with the specified url.\n * @param url - The url of the trigger.\n * @public\n */\nexport function httpsCallableFromURL<\n RequestData = unknown,\n ResponseData = unknown,\n StreamData = unknown\n>(\n functionsInstance: Functions,\n url: string,\n options?: HttpsCallableOptions\n): HttpsCallable {\n return _httpsCallableFromURL(\n getModularInstance(functionsInstance as FunctionsService),\n url,\n options\n );\n}\n","/**\n * Cloud Functions for Firebase\n *\n * @packageDocumentation\n */\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { registerFunctions } from './config';\n\nexport * from './api';\nexport * from './public-types';\n\nregisterFunctions();\n"],"names":["FirebaseError","app","_isFirebaseServerApp","connectFunctionsEmulator","isCloudWorkstation","pingServer","updateEmulatorBanner","httpsCallable","httpsCallableFromURL","_registerComponent","Component","registerVersion","getApp","_getProvider","getModularInstance","getDefaultEmulatorHostnameAndPort","_connectFunctionsEmulator","_httpsCallable","_httpsCallableFromURL"],"mappings":";;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AACH,MAAM,SAAS,GAAG,gDAAgD,CAAC;AACnE,MAAM,kBAAkB,GAAG,iDAAiD,CAAC;AAE7E,SAAS,SAAS;AAChB;AACA;AACA,CAAyB,EACzB,CAA6B,EAAA;IAE7B,MAAM,MAAM,GAA+B,EAAE,CAAC;AAC9C,IAAA,KAAK,MAAM,GAAG,IAAI,CAAC,EAAE;AACnB,QAAA,IAAI,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YACzB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;SACzB;KACF;AACD,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;AAKG;AACG,SAAU,MAAM,CAAC,IAAa,EAAA;AAClC,IAAA,IAAI,IAAI,IAAI,IAAI,EAAE;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AC;AACF,IAAA,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,YAAY,CAAC;AACvD,QAAA,UAAU,EAAE,oBAAoB;AACjC,KAAA,CAAC,CAAC;AACH,IAAA,MAAM,QAAQ,GAAGc,sCAAiC,CAAC,WAAW,CAAC,CAAC;IAChE,IAAI,QAAQ,EAAE;AACZ,QAAA,wBAAwB,CAAC,iBAAiB,EAAE,GAAG,QAAQ,CAAC,CAAC;KAC1D;AACD,IAAA,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED;;;;;;;;AAQG;SACa,wBAAwB,CACtC,iBAA4B,EAC5B,IAAY,EACZ,IAAY,EAAA;IAEZC,0BAAyB,CACvBF,uBAAkB,CAAmB,iBAAqC,CAAC,EAC3E,IAAI,EACJ,IAAI,CACL,CAAC;AACJ,CAAC;AAED;;;;AAIG;SACa,aAAa,CAK3B,iBAA4B,EAC5B,IAAY,EACZ,OAA8B,EAAA;IAE9B,OAAOG,eAAc,CACnBH,uBAAkB,CAAmB,iBAAqC,CAAC,EAC3E,IAAI,EACJ,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;AAIG;SACa,oBAAoB,CAKlC,iBAA4B,EAC5B,GAAW,EACX,OAA8B,EAAA;IAE9B,OAAOI,sBAAqB,CAC1BJ,uBAAkB,CAAmB,iBAAqC,CAAC,EAC3E,GAAG,EACH,OAAO,CACR,CAAC;AACJ;;AC7HA;;;;AAIG;AAuBH,iBAAiB,EAAE;;;;;;;;"} \ No newline at end of file diff --git a/frontend-old/node_modules/@firebase/functions/dist/src/api.d.ts b/frontend-old/node_modules/@firebase/functions/dist/src/api.d.ts new file mode 100644 index 0000000..c9837ba --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/src/api.d.ts @@ -0,0 +1,51 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +import { Functions, HttpsCallableOptions, HttpsCallable } from './public-types'; +export { FunctionsError } from './error'; +export * from './public-types'; +/** + * Returns a {@link Functions} instance for the given app. + * @param app - The {@link @firebase/app#FirebaseApp} to use. + * @param regionOrCustomDomain - one of: + * a) The region the callable functions are located in (ex: us-central1) + * b) A custom domain hosting the callable functions (ex: https://mydomain.com) + * @public + */ +export declare function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions; +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * + * Note: this must be called before this instance has been used to do any operations. + * + * @param host - The emulator host (ex: localhost) + * @param port - The emulator port (ex: 5001) + * @public + */ +export declare function connectFunctionsEmulator(functionsInstance: Functions, host: string, port: number): void; +/** + * Returns a reference to the callable HTTPS trigger with the given name. + * @param name - The name of the trigger. + * @public + */ +export declare function httpsCallable(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable; +/** + * Returns a reference to the callable HTTPS trigger with the specified url. + * @param url - The url of the trigger. + * @public + */ +export declare function httpsCallableFromURL(functionsInstance: Functions, url: string, options?: HttpsCallableOptions): HttpsCallable; diff --git a/frontend-old/node_modules/@firebase/functions/dist/src/config.d.ts b/frontend-old/node_modules/@firebase/functions/dist/src/config.d.ts new file mode 100644 index 0000000..8df6b14 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/src/config.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export declare function registerFunctions(variant?: string): void; diff --git a/frontend-old/node_modules/@firebase/functions/dist/src/constants.d.ts b/frontend-old/node_modules/@firebase/functions/dist/src/constants.d.ts new file mode 100644 index 0000000..59e9e1e --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/src/constants.d.ts @@ -0,0 +1,20 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Type constant for Firebase Functions. + */ +export declare const FUNCTIONS_TYPE = "functions"; diff --git a/frontend-old/node_modules/@firebase/functions/dist/src/context.d.ts b/frontend-old/node_modules/@firebase/functions/dist/src/context.d.ts new file mode 100644 index 0000000..2c3715a --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/src/context.d.ts @@ -0,0 +1,46 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Provider } from '@firebase/component'; +import { FirebaseApp } from '@firebase/app'; +import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types'; +import { MessagingInternalComponentName } from '@firebase/messaging-interop-types'; +import { FirebaseAuthInternalName } from '@firebase/auth-interop-types'; +/** + * The metadata that should be supplied with function calls. + * @internal + */ +export interface Context { + authToken?: string; + messagingToken?: string; + appCheckToken: string | null; +} +/** + * Helper class to get metadata that should be included with a function call. + * @internal + */ +export declare class ContextProvider { + readonly app: FirebaseApp; + private auth; + private messaging; + private appCheck; + private serverAppAppCheckToken; + constructor(app: FirebaseApp, authProvider: Provider, messagingProvider: Provider, appCheckProvider: Provider); + getAuthToken(): Promise; + getMessagingToken(): Promise; + getAppCheckToken(limitedUseAppCheckTokens?: boolean): Promise; + getContext(limitedUseAppCheckTokens?: boolean): Promise; +} diff --git a/frontend-old/node_modules/@firebase/functions/dist/src/error.d.ts b/frontend-old/node_modules/@firebase/functions/dist/src/error.d.ts new file mode 100644 index 0000000..2828891 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/src/error.d.ts @@ -0,0 +1,49 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FunctionsErrorCodeCore as FunctionsErrorCode } from './public-types'; +import { HttpResponseBody } from './service'; +import { FirebaseError } from '@firebase/util'; +/** + * An error returned by the Firebase Functions client SDK. + * + * See {@link FunctionsErrorCode} for full documentation of codes. + * + * @public + */ +export declare class FunctionsError extends FirebaseError { + /** + * Additional details to be converted to JSON and included in the error response. + */ + readonly details?: unknown; + /** + * Constructs a new instance of the `FunctionsError` class. + */ + constructor( + /** + * A standard error code that will be returned to the client. This also + * determines the HTTP status code of the response, as defined in code.proto. + */ + code: FunctionsErrorCode, message?: string, + /** + * Additional details to be converted to JSON and included in the error response. + */ + details?: unknown); +} +/** + * Takes an HTTP response and returns the corresponding Error, if any. + */ +export declare function _errorForResponse(status: number, bodyJSON: HttpResponseBody | null): Error | null; diff --git a/frontend-old/node_modules/@firebase/functions/dist/src/index.d.ts b/frontend-old/node_modules/@firebase/functions/dist/src/index.d.ts new file mode 100644 index 0000000..83261f8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/src/index.d.ts @@ -0,0 +1,7 @@ +/** + * Cloud Functions for Firebase + * + * @packageDocumentation + */ +export * from './api'; +export * from './public-types'; diff --git a/frontend-old/node_modules/@firebase/functions/dist/src/public-types.d.ts b/frontend-old/node_modules/@firebase/functions/dist/src/public-types.d.ts new file mode 100644 index 0000000..0c170a0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/src/public-types.d.ts @@ -0,0 +1,150 @@ +/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +/** + * An `HttpsCallableResult` wraps a single result from a function call. + * @public + */ +export interface HttpsCallableResult { + /** + * Data returned from callable function. + */ + readonly data: ResponseData; +} +/** + * An `HttpsCallableStreamResult` wraps a single streaming result from a function call. + * @public + */ +export interface HttpsCallableStreamResult { + readonly data: Promise; + readonly stream: AsyncIterable; +} +/** + * A reference to a "callable" HTTP trigger in Cloud Functions. + * @param data - Data to be passed to callable function. + * @public + */ +export interface HttpsCallable { + (data?: RequestData | null): Promise>; + stream: (data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise>; +} +/** + * An interface for metadata about how calls should be executed. + * @public + */ +export interface HttpsCallableOptions { + /** + * Time in milliseconds after which to cancel if there is no response. + * Default is 70000. + */ + timeout?: number; + /** + * If set to true, uses a limited-use App Check token for callable function requests from this + * instance of {@link Functions}. You must use limited-use tokens to call functions with + * replay protection enabled. By default, this is false. + */ + limitedUseAppCheckTokens?: boolean; +} +/** + * An interface for metadata about how a stream call should be executed. + * @public + */ +export interface HttpsCallableStreamOptions { + /** + * An `AbortSignal` that can be used to cancel the streaming response. When the signal is aborted, + * the underlying HTTP connection will be terminated. + */ + signal?: AbortSignal; + /** + * If set to true, uses a limited-use App Check token for callable function requests from this + * instance of {@link Functions}. You must use limited-use tokens to call functions with + * replay protection enabled. By default, this is false. + */ + limitedUseAppCheckTokens?: boolean; +} +/** + * A `Functions` instance. + * @public + */ +export interface Functions { + /** + * The {@link @firebase/app#FirebaseApp} this `Functions` instance is associated with. + */ + app: FirebaseApp; + /** + * The region the callable Cloud Functions are located in. + * Default is `us-central-1`. + */ + region: string; + /** + * A custom domain hosting the callable Cloud Functions. + * ex: https://mydomain.com + */ + customDomain: string | null; +} +/** + * Functions error code string appended after "functions/" product prefix. + * See {@link FunctionsErrorCode} for full documentation of codes. + * @public + */ +export type FunctionsErrorCodeCore = 'ok' | 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated'; +/** + * The set of Firebase Functions status codes. The codes are the same at the + * ones exposed by gRPC here: + * https://github.com/grpc/grpc/blob/master/doc/statuscodes.md + * + * Possible values: + * - 'cancelled': The operation was cancelled (typically by the caller). + * - 'unknown': Unknown error or an error from a different error domain. + * - 'invalid-argument': Client specified an invalid argument. Note that this + * differs from 'failed-precondition'. 'invalid-argument' indicates + * arguments that are problematic regardless of the state of the system + * (e.g. an invalid field name). + * - 'deadline-exceeded': Deadline expired before operation could complete. + * For operations that change the state of the system, this error may be + * returned even if the operation has completed successfully. For example, + * a successful response from a server could have been delayed long enough + * for the deadline to expire. + * - 'not-found': Some requested document was not found. + * - 'already-exists': Some document that we attempted to create already + * exists. + * - 'permission-denied': The caller does not have permission to execute the + * specified operation. + * - 'resource-exhausted': Some resource has been exhausted, perhaps a + * per-user quota, or perhaps the entire file system is out of space. + * - 'failed-precondition': Operation was rejected because the system is not + * in a state required for the operation's execution. + * - 'aborted': The operation was aborted, typically due to a concurrency + * issue like transaction aborts, etc. + * - 'out-of-range': Operation was attempted past the valid range. + * - 'unimplemented': Operation is not implemented or not supported/enabled. + * - 'internal': Internal errors. Means some invariants expected by + * underlying system has been broken. If you see one of these errors, + * something is very broken. + * - 'unavailable': The service is currently unavailable. This is most likely + * a transient condition and may be corrected by retrying with a backoff. + * - 'data-loss': Unrecoverable data loss or corruption. + * - 'unauthenticated': The request does not have valid authentication + * credentials for the operation. + * @public + */ +export type FunctionsErrorCode = `functions/${FunctionsErrorCodeCore}`; +declare module '@firebase/component' { + interface NameServiceMapping { + 'functions': Functions; + } +} diff --git a/frontend-old/node_modules/@firebase/functions/dist/src/serializer.d.ts b/frontend-old/node_modules/@firebase/functions/dist/src/serializer.d.ts new file mode 100644 index 0000000..ae746e0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/src/serializer.d.ts @@ -0,0 +1,14 @@ +/** + * Takes data and encodes it in a JSON-friendly way, such that types such as + * Date are preserved. + * @internal + * @param data - Data to encode. + */ +export declare function encode(data: unknown): unknown; +/** + * Takes data that's been encoded in a JSON-friendly form and returns a form + * with richer datatypes, such as Dates, etc. + * @internal + * @param json - JSON to convert. + */ +export declare function decode(json: unknown): unknown; diff --git a/frontend-old/node_modules/@firebase/functions/dist/src/service.d.ts b/frontend-old/node_modules/@firebase/functions/dist/src/service.d.ts new file mode 100644 index 0000000..67e0807 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/src/service.d.ts @@ -0,0 +1,86 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp, _FirebaseService } from '@firebase/app'; +import { HttpsCallable, HttpsCallableOptions } from './public-types'; +import { ContextProvider } from './context'; +import { Provider } from '@firebase/component'; +import { FirebaseAuthInternalName } from '@firebase/auth-interop-types'; +import { MessagingInternalComponentName } from '@firebase/messaging-interop-types'; +import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types'; +export declare const DEFAULT_REGION = "us-central1"; +/** + * Describes the shape of the HttpResponse body. + * It makes functions that would otherwise take {} able to access the + * possible elements in the body more easily + */ +export interface HttpResponseBody { + data?: unknown; + result?: unknown; + error?: { + message?: unknown; + status?: unknown; + details?: unknown; + }; +} +/** + * The main class for the Firebase Functions SDK. + * @internal + */ +export declare class FunctionsService implements _FirebaseService { + readonly app: FirebaseApp; + readonly fetchImpl: typeof fetch; + readonly contextProvider: ContextProvider; + emulatorOrigin: string | null; + cancelAllRequests: Promise; + deleteService: () => Promise; + region: string; + customDomain: string | null; + /** + * Creates a new Functions service for the given app. + * @param app - The FirebaseApp to use. + */ + constructor(app: FirebaseApp, authProvider: Provider, messagingProvider: Provider, appCheckProvider: Provider, regionOrCustomDomain?: string, fetchImpl?: typeof fetch); + _delete(): Promise; + /** + * Returns the URL for a callable with the given name. + * @param name - The name of the callable. + * @internal + */ + _url(name: string): string; +} +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * + * Note: this must be called before this instance has been used to do any operations. + * + * @param host The emulator host (ex: localhost) + * @param port The emulator port (ex: 5001) + * @public + */ +export declare function connectFunctionsEmulator(functionsInstance: FunctionsService, host: string, port: number): void; +/** + * Returns a reference to the callable https trigger with the given name. + * @param name - The name of the trigger. + * @public + */ +export declare function httpsCallable(functionsInstance: FunctionsService, name: string, options?: HttpsCallableOptions): HttpsCallable; +/** + * Returns a reference to the callable https trigger with the given url. + * @param url - The url of the trigger. + * @public + */ +export declare function httpsCallableFromURL(functionsInstance: FunctionsService, url: string, options?: HttpsCallableOptions): HttpsCallable; diff --git a/frontend-old/node_modules/@firebase/functions/dist/src/tsdoc-metadata.json b/frontend-old/node_modules/@firebase/functions/dist/src/tsdoc-metadata.json new file mode 100644 index 0000000..6af1f6a --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/src/tsdoc-metadata.json @@ -0,0 +1,11 @@ +// This file is read by tools that parse documentation comments conforming to the TSDoc standard. +// It should be published with your NPM package. It should not be tracked by Git. +{ + "tsdocVersion": "0.12", + "toolPackages": [ + { + "packageName": "@microsoft/api-extractor", + "packageVersion": "0.1.2" + } + ] +} diff --git a/frontend-old/node_modules/@firebase/functions/dist/test/utils.d.ts b/frontend-old/node_modules/@firebase/functions/dist/test/utils.d.ts new file mode 100644 index 0000000..6345f10 --- /dev/null +++ b/frontend-old/node_modules/@firebase/functions/dist/test/utils.d.ts @@ -0,0 +1,21 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseOptions, FirebaseApp } from '@firebase/app'; +import { Provider } from '@firebase/component'; +import { FunctionsService } from '../src/service'; +export declare function makeFakeApp(options?: FirebaseOptions): FirebaseApp; +export declare function createTestService(app: FirebaseApp, region?: string, authProvider?: Provider<"auth-internal">, messagingProvider?: Provider<"messaging-internal">, appCheckProvider?: Provider<"app-check-internal">): FunctionsService; -- cgit v1.2.3