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BAAiB,KAAK,QAAS,KAAK,QAClE,EAEJ,QAAQ,eAAiB","file":"/npm/@google-cloud/error-reporting@3.0.5/build/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/@google-cloud/error-reporting@3.0.5/build/src/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\n/*!\n * Copyright 2016 Google Inc. All Rights Reserved.\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 */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ErrorReporting = exports.ErrorMessage = void 0;\n/*!\n * @module error-reporting\n */\nconst error_message_1 = require(\"./classes/error-message\");\nObject.defineProperty(exports, \"ErrorMessage\", { enumerable: true, get: function () { return error_message_1.ErrorMessage; } });\nconst configuration_1 = require(\"./configuration\");\nconst auth_client_1 = require(\"./google-apis/auth-client\");\n// Begin error reporting interfaces\nconst expressInterface = require(\"./interfaces/express\");\nconst hapiInterface = require(\"./interfaces/hapi\");\nconst koaInterface = require(\"./interfaces/koa\");\nconst koa2Interface = require(\"./interfaces/koa2\");\nconst manualInterface = require(\"./interfaces/manual\");\nconst messageBuilderInterface = require(\"./interfaces/message-builder\");\nconst restifyInterface = require(\"./interfaces/restify\");\nconst logger_1 = require(\"./logger\");\n/**\n * @typedef ConfigurationOptions\n * @type {Object}\n * @property {String} [projectId] - the projectId of the project deployed\n * @property {String} [keyFilename] - path to a key file to use for an API key\n * @property {String|Number} logLevel - a integer between and including 0-5 or a\n *  decimal representation of an integer including and between 0-5 in String\n *  form\n * @property {String} [key] - API key to use for communication with the service\n * @property {uncaughtHandlingEnum}\n *  [onUncaughtException=uncaughtHandlingEnum.ignore] - one of the uncaught\n *  handling options\n * @property {Object} [serviceContext] - the service context of the application\n * @property {String} [serviceContext.service] - the service the application is\n *  running on\n * @property {String} [serviceContext.version] - the version the hosting\n *  application is currently labelled as\n * @property {Boolean} [ignoreEnvironmentCheck] - flag indicating whether or not\n *  to communicate errors to the Google Cloud service even if NODE_ENV is not set\n *  to production\n * @property {String} [reportMode] - flag indicating whether or not\n *  to communicate errors to the Google Cloud service.  Possible values are:\n *  -> 'production' (default)\n *     -> Only report errors if NODE_ENV is set to \"production\".\n *  -> 'always'\n *     -> Always report errors regardless of the value of NODE_ENV.\n *  -> 'never'\n *     -> Never report errors regardless of the value of NODE_ENV.\n */\n/**\n * @typedef Errors\n * @type {Object}\n * @property {Function} report - The manual interface to report Errors to the\n *  Error Reporting Service\n * @property {ErrorMessage} event - Returns a new ErrorMessage class instance\n *  to use to create custom messages\n * @property {Function} express - The express plugin for Error Reporting\n * @property {Object} hapi - The hapi plugin for Error Reporting\n * @property {Function} koa - The koa plugin for Error Reporting\n * @property {Function} restify - The restify plugin for Error Reporting\n */\n/**\n * This module provides Error Reporting support for Node.js\n * applications.\n * [Error Reporting](https://cloud.google.com/error-reporting/) is\n * a feature of Google Cloud Platform that allows in-depth monitoring and\n * viewing of errors reported by applications running in almost any environment.\n *\n * This is the entry point for initializing the error reporting middleware. This\n * function will invoke configuration gathering and attempt to create a API\n * client which will send errors to the Error Reporting Service.\n *\n * @alias module:error-reporting\n * @constructor\n *\n * @resource [What is Error Reporting]{@link\n * https://cloud.google.com/error-reporting/}\n *\n * @param {ConfigurationOptions} initConfiguration - The desired project/error\n *     reporting configuration.\n */\nclass ErrorReporting {\n    constructor(initConfiguration) {\n        if (!(this instanceof ErrorReporting)) {\n            return new ErrorReporting(initConfiguration);\n        }\n        this._logger = (0, logger_1.createLogger)(initConfiguration);\n        this._config = new configuration_1.Configuration(initConfiguration, this._logger);\n        this._client = new auth_client_1.RequestHandler(this._config, this._logger);\n        if (this._config.getReportUnhandledRejections()) {\n            process.on('unhandledRejection', reason => {\n                this._logger.warn('UnhandledPromiseRejectionWarning: ' +\n                    'Unhandled promise rejection: ' +\n                    reason +\n                    '.  This rejection has been reported to the ' +\n                    'Google Cloud Platform error-reporting console.');\n                this.report(reason);\n            });\n        }\n        // Build the application interfaces for use by the hosting application\n        /**\n         * @example\n         * // Use to report errors manually like so\n         * errors.report(new Error('xyz'), function () {\n         *  console.log('done!');\n         * });\n         */\n        this.report = manualInterface.handlerSetup(this._client, this._config, this._logger);\n        /**\n         * @example\n         * // Use to create and report errors manually with a high-degree\n         * // of manual control\n         * const err = errors.event()\n         *  .setMessage('My error message')\n         *  .setUser('root@nexus');\n         * errors.report(err, function () {\n         *  console.log('done!');\n         * });\n         */\n        this.event = messageBuilderInterface.handlerSetup(this._config);\n        /**\n         * @example\n         * const hapi = require('hapi');\n         * const server = new hapi.Server();\n         * server.connection({ port: 3000 });\n         * server.start();\n         * // AFTER ALL OTHER ROUTE HANDLERS\n         * server.register({register: errors.hapi});\n         */\n        this.hapi = hapiInterface.makeHapiPlugin(this._client, this._config);\n        /**\n         * @example\n         * const express = require('express');\n         * const app = express();\n         * // AFTER ALL OTHER ROUTE HANDLERS\n         * app.use(errors.express);\n         * app.listen(3000);\n         */\n        this.express = expressInterface.makeExpressHandler(this._client, this._config);\n        /**\n         * @example\n         * const restify = require('restify');\n         * const server = restify.createServer();\n         * // BEFORE ALL OTHER ROUTE HANDLERS\n         * server.use(errors.restify(server));\n         */\n        this.restify = restifyInterface.handlerSetup(this._client, this._config);\n        /**\n         * @example\n         * // for Koa@1\n         * const koa = require('koa');\n         * const app = koa();\n         * // BEFORE ALL OTHER ROUTE HANDLERS HANDLERS\n         * app.use(errors.koa);\n         */\n        this.koa = koaInterface.koaErrorHandler(this._client, this._config);\n        /**\n         * @example\n         * // for Koa@2\n         * const koa = require('koa');\n         * const app = koa();\n         * // BEFORE ALL OTHER ROUTE HANDLERS HANDLERS\n         * app.use(errors.koa2);\n         */\n        this.koa2 = koa2Interface.koa2ErrorHandler(this._client, this._config);\n    }\n}\nexports.ErrorReporting = ErrorReporting;\n"]}