{ "version": 3, "sources": ["../ui/app/mn.auth.service.js"], "sourcesContent": ["/*\nCopyright 2020-Present Couchbase, Inc.\n\nUse of this software is governed by the Business Source License included in\nthe file licenses/BSL-Couchbase.txt. As of the Change Date specified in that\nfile, in accordance with the Business Source License, use of this software will\nbe governed by the Apache License, Version 2.0, included in the file\nlicenses/APL2.txt.\n*/\n\nimport {Injectable} from '@angular/core';\nimport {HttpClient} from '@angular/common/http';\nimport {map} from 'rxjs/operators';\nimport {singletonGuard} from './mn.core.js';\nimport {MnHttpRequest} from './mn.http.request.js';\n\nexport {MnAuthService}\n\nclass MnAuthService {\n static get annotations() { return [\n new Injectable()\n ]}\n\n static get parameters() { return [\n HttpClient\n ]}\n\n constructor(http) {\n singletonGuard(MnAuthService);\n this.http = http;\n this.stream = {};\n\n this.stream.postUILogin =\n new MnHttpRequest(this.postUILogin.bind(this))\n .addSuccess()\n .addError(map(rv => rv.status));\n\n // this.stream.postUILogout =\n // new mn.core.MnPostHttp(this.postUILogout.bind(this));\n }\n\n whoami() {\n return this.http.get('/whoami');\n }\n\n postUILogin(user) {\n return this.http.post('/uilogin', user || {});\n // should be moved into app.admin alerts\n // we should say something like you are using cached vesrion, reload the tab\n // return that.mnPoolsService\n // .get$\n // .map(function (cachedPools, newPools) {\n\n // if (cachedPools.implementationVersion !== newPools.implementationVersion) {\n // return {ok: false, status: 410};\n // } else {\n // return resp;\n // }\n // });\n }\n\n postUILogout() {\n return this.http.post(\"/uilogout\");\n // .then(function () {\n // $window.location.reload();\n // }, function () {\n // $window.location.reload();\n // });\n }\n}\n"], "mappings": "mOAkBA,uBAAoB,WACP,cAAc,CAAE,MAAO,CAChC,GAAI,uBAGK,aAAa,CAAE,MAAO,CAC/B,YAGF,YAAY,KAAM,CAChB,eAAe,eACf,KAAK,KAAO,KACZ,KAAK,OAAS,GAEd,KAAK,OAAO,YACV,GAAI,eAAc,KAAK,YAAY,KAAK,OACvC,aACA,SAAS,IAAI,IAAM,GAAG,SAM3B,QAAS,CACP,MAAO,MAAK,KAAK,IAAI,WAGvB,YAAY,KAAM,CAChB,MAAO,MAAK,KAAK,KAAK,WAAY,MAAQ,IAe5C,cAAe,CACb,MAAO,MAAK,KAAK,KAAK,eA5C1B", "names": [] }