1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-01-12 18:14:51 +00:00
musix-oss/node_modules/@firebase/functions/dist/index.node.cjs.js.map
2019-10-10 16:43:04 +03:00

1 line
30 KiB
Plaintext

{"version":3,"file":"index.node.cjs.js","sources":["../src/api/error.ts","../src/context.ts","../src/serializer.ts","../src/api/service.ts","../index.node.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google Inc.\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 { HttpsError, FunctionsErrorCode } from '@firebase/functions-types';\nimport { Serializer } from '../serializer';\nimport { HttpResponseBody } from './service';\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 explicit error that can be thrown from a handler to send an error to the\n * client that called the function.\n */\nexport class HttpsErrorImpl extends Error implements HttpsError {\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 readonly code: FunctionsErrorCode;\n\n /**\n * Extra data to be converted to JSON and included in the error response.\n */\n readonly details?: unknown;\n\n constructor(code: FunctionsErrorCode, message?: string, details?: unknown) {\n super(message);\n\n // This is a workaround for a bug in TypeScript when extending Error:\n // tslint:disable-next-line\n // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, HttpsErrorImpl.prototype);\n\n this.code = code;\n this.details = details;\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 serializer: Serializer\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 HttpsErrorImpl('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 = serializer.decode(details as {} | null);\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 HttpsErrorImpl(code, description, details);\n}\n","/**\n * @license\n * Copyright 2017 Google Inc.\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 { FirebaseApp } from '@firebase/app-types';\nimport { _FirebaseApp } from '@firebase/app-types/private';\nimport { FirebaseMessaging } from '@firebase/messaging-types';\n\n/**\n * The metadata that should be supplied with function calls.\n */\nexport interface Context {\n authToken?: string;\n instanceIdToken?: string;\n}\n\n/**\n * Helper class to get metadata that should be included with a function call.\n */\nexport class ContextProvider {\n constructor(private readonly app: FirebaseApp) {}\n\n async getAuthToken(): Promise<string | undefined> {\n try {\n const token = await (this.app as _FirebaseApp).INTERNAL.getToken();\n if (!token) {\n return undefined;\n }\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 getInstanceIdToken(): Promise<string | undefined> {\n try {\n // HACK: Until we have a separate instanceId package, this is a quick way\n // to load in the messaging instance for this app.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (!(this.app as any).messaging) {\n return undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const messaging = (this.app as any).messaging() as FirebaseMessaging;\n const token = await messaging.getToken();\n if (!token) {\n return undefined;\n }\n return token;\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 getContext(): Promise<Context> {\n const authToken = await this.getAuthToken();\n const instanceIdToken = await this.getInstanceIdToken();\n return { authToken, instanceIdToken };\n }\n}\n","/**\n * @license\n * Copyright 2017 Google Inc.\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\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\nexport class Serializer {\n // Takes data and encodes it in a JSON-friendly way, such that types such as\n // Date are preserved.\n 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 (Array.isArray(data)) {\n return data.map(x => this.encode(x));\n }\n if (typeof data === 'function' || typeof data === 'object') {\n return mapValues(data as object, x => this.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 // Takes data that's been encoded in a JSON-friendly form and returns a form\n // with richer datatypes, such as Dates, etc.\n 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 => this.decode(x));\n }\n if (typeof json === 'function' || typeof json === 'object') {\n return mapValues(json as object, x => this.decode(x as {} | null));\n }\n // Anything else is safe to return.\n return json;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google Inc.\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 } from '@firebase/app-types';\nimport { FirebaseService } from '@firebase/app-types/private';\nimport {\n FirebaseFunctions,\n HttpsCallable,\n HttpsCallableResult,\n HttpsCallableOptions\n} from '@firebase/functions-types';\nimport { _errorForResponse, HttpsErrorImpl } from './error';\nimport { ContextProvider } from '../context';\nimport { Serializer } from '../serializer';\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\n/**\n * Returns a Promise that will be rejected after the given duration.\n * The error will be of type HttpsErrorImpl.\n *\n * @param millis Number of milliseconds to wait before rejecting.\n */\nfunction failAfter(millis: number): Promise<never> {\n return new Promise((_, reject) => {\n setTimeout(() => {\n reject(new HttpsErrorImpl('deadline-exceeded', 'deadline-exceeded'));\n }, millis);\n });\n}\n\n/**\n * The main class for the Firebase Functions SDK.\n */\nexport class Service implements FirebaseFunctions, FirebaseService {\n private readonly contextProvider: ContextProvider;\n private readonly serializer = new Serializer();\n private emulatorOrigin: string | null = null;\n private cancelAllRequests: Promise<void>;\n private deleteService!: Function;\n\n /**\n * Creates a new Functions service for the given app and (optional) region.\n * @param app_ The FirebaseApp to use.\n * @param region_ The region to call functions in.\n */\n constructor(\n private app_: FirebaseApp,\n private region_: string = 'us-central1'\n ) {\n this.contextProvider = new ContextProvider(app_);\n // Cancels all ongoing requests when resolved.\n this.cancelAllRequests = new Promise(resolve => {\n this.deleteService = () => {\n return resolve();\n };\n });\n }\n\n get app(): FirebaseApp {\n return this.app_;\n }\n\n INTERNAL = {\n delete: (): Promise<void> => {\n return this.deleteService();\n }\n };\n\n /**\n * Returns the URL for a callable with the given name.\n * @param name The name of the callable.\n */\n _url(name: string): string {\n const projectId = this.app_.options.projectId;\n const region = this.region_;\n if (this.emulatorOrigin !== null) {\n const origin = this.emulatorOrigin;\n return `${origin}/${projectId}/${region}/${name}`;\n }\n return `https://${region}-${projectId}.cloudfunctions.net/${name}`;\n }\n\n /**\n * Changes this instance to point to a Cloud Functions emulator running\n * locally. See https://firebase.google.com/docs/functions/local-emulator\n *\n * @param origin The origin of the local emulator, such as\n * \"http://localhost:5005\".\n */\n useFunctionsEmulator(origin: string): void {\n this.emulatorOrigin = origin;\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 */\n httpsCallable(name: string, options?: HttpsCallableOptions): HttpsCallable {\n return data => {\n return this.call(name, data, options || {});\n };\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 * @return A Promise that will succeed when the request finishes.\n */\n private async postJSON(\n url: string,\n body: {},\n headers: Headers\n ): Promise<HttpResponse> {\n headers.append('Content-Type', 'application/json');\n\n let response: Response;\n try {\n response = await fetch(url, {\n method: 'POST',\n body: JSON.stringify(body),\n headers\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: {} | 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 * 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.s\n */\n private async call(\n name: string,\n data: unknown,\n options: HttpsCallableOptions\n ): Promise<HttpsCallableResult> {\n const url = this._url(name);\n\n // Encode any special types, such as dates, in the input data.\n data = this.serializer.encode(data);\n const body = { data };\n\n // Add a header for the authToken.\n const headers = new Headers();\n const context = await this.contextProvider.getContext();\n if (context.authToken) {\n headers.append('Authorization', 'Bearer ' + context.authToken);\n }\n if (context.instanceIdToken) {\n headers.append('Firebase-Instance-ID-Token', context.instanceIdToken);\n }\n\n // Default timeout to 70s, but let the options override it.\n const timeout = options.timeout || 70000;\n\n const response = await Promise.race([\n this.postJSON(url, body, headers),\n failAfter(timeout),\n this.cancelAllRequests\n ]);\n\n // If service was deleted, interrupted response throws an error.\n if (!response) {\n throw new HttpsErrorImpl(\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(\n response.status,\n response.json,\n this.serializer\n );\n if (error) {\n throw error;\n }\n\n if (!response.json) {\n throw new HttpsErrorImpl(\n 'internal',\n 'Response is not valid JSON object.'\n );\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 HttpsErrorImpl('internal', 'Response is missing data field.');\n }\n\n // Decode any special types, such as dates, in the returned data.\n const decodedData = this.serializer.decode(responseData as {} | null);\n\n return { data: decodedData };\n }\n}\n","/**\n * @license\n * Copyright 2017 Google Inc.\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 firebase from '@firebase/app';\nimport { FirebaseApp } from '@firebase/app-types';\nimport {\n FirebaseServiceFactory,\n _FirebaseNamespace\n} from '@firebase/app-types/private';\nimport { Service } from './src/api/service';\nimport 'isomorphic-fetch';\n\n/**\n * Type constant for Firebase Functions.\n */\nconst FUNCTIONS_TYPE = 'functions';\n\nfunction factory(app: FirebaseApp, _unused: unknown, region?: string): Service {\n return new Service(app, region);\n}\n\nexport function registerFunctions(instance: _FirebaseNamespace): void {\n const namespaceExports = {\n // no-inline\n Functions: Service\n };\n instance.INTERNAL.registerService(\n FUNCTIONS_TYPE,\n factory as FirebaseServiceFactory,\n namespaceExports,\n // We don't need to wait on any AppHooks.\n undefined,\n // Allow multiple functions instances per app.\n true\n );\n}\n\nregisterFunctions(firebase as _FirebaseNamespace);\n"],"names":["tslib_1.__extends"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;AAqBA;;;;;;;AAOA,IAAM,YAAY,GAA2C;IAC3D,EAAE,EAAE,IAAI;IACR,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,gBAAgB,EAAE,kBAAkB;IACpC,iBAAiB,EAAE,mBAAmB;IACtC,SAAS,EAAE,WAAW;IACtB,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,oBAAoB;IACxC,mBAAmB,EAAE,qBAAqB;IAC1C,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;CACvB,CAAC;;;;;AAMF;IAAoCA,0CAAK;IAYvC,wBAAY,IAAwB,EAAE,OAAgB,EAAE,OAAiB;QAAzE,YACE,kBAAM,OAAO,CAAC,SASf;;;;QAJC,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;QAEtD,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;;KACxB;IACH,qBAAC;CAvBD,CAAoC,KAAK,GAuBxC;AAED;;;;;;;;AAQA,SAAS,iBAAiB,CAAC,MAAc;;IAEvC,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,EAAE;QACjC,OAAO,IAAI,CAAC;KACb;IACD,QAAQ,MAAM;QACZ,KAAK,CAAC;;YAEJ,OAAO,UAAU,CAAC;QACpB,KAAK,GAAG;YACN,OAAO,kBAAkB,CAAC;QAC5B,KAAK,GAAG;YACN,OAAO,i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