{ "version": 3, "sources": ["../ui/app/mn.app.service.js", "../ui/app/mn.http.interceptor.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 {BehaviorSubject, Subject} from 'rxjs';\nimport {filter} from 'rxjs/operators';\nimport {HttpErrorResponse} from '@angular/common/http';\nimport {singletonGuard} from './mn.core.js';\n\nexport {MnAppService};\n\nclass MnAppService {\n static get annotations() { return [\n new Injectable()\n ]}\n\n constructor() {\n singletonGuard(MnAppService);\n\n this.stream = {};\n this.stream.loading = new BehaviorSubject(false);\n this.stream.httpResponse = new Subject();\n this.stream.pageNotFound = new Subject();\n this.stream.http401 =\n this.stream.httpResponse.pipe(filter(function (rv) {\n //rejection.config.url !== \"/controller/changePassword\"\n //$injector.get('mnLostConnectionService').getState().isActivated\n return (rv instanceof HttpErrorResponse) &&\n (rv.status === 401) && !rv.headers.get(\"ignore-401\");\n }));\n }\n}\n", "/*\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 {HttpParams} from '@angular/common/http';\nimport {is} from 'ramda';\nimport {throwError} from 'rxjs';\nimport {tap, catchError} from 'rxjs/operators';\n\nimport { MnAppService } from './mn.app.service.js';\n\nexport { MnHttpInterceptor };\n\nclass MnHttpInterceptor {\n static get annotations() { return [\n new Injectable()\n ]}\n\n static get parameters() { return [\n MnAppService\n ]}\n\n constructor(mnAppService) {\n this.httpResponse = mnAppService.stream.httpResponse;\n }\n\n intercept(req, next) {\n var mnReq = req.clone({\n setHeaders: {\n 'invalid-auth-response': 'on',\n 'Cache-Control': 'no-cache',\n 'Pragma': 'no-cache',\n 'ns-server-ui': 'yes'\n }\n });\n\n var params;\n var headers;\n\n if ((req.method === 'POST' || req.method === 'PUT')) {\n if (!req.headers.get('isNotForm')) {\n if (is(Object, mnReq.body) && !Array.isArray(mnReq.body)) {\n params = new HttpParams({\n encoder: new CustomEncoder(),\n fromObject: mnReq.body\n });\n } else {\n params = mnReq.body;\n }\n mnReq = mnReq.clone({\n body: params,\n responseType: 'text',\n headers: mnReq.headers.set(\n 'Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')});\n }\n if (req.headers.has('isNotForm')) {\n headers = mnReq.headers.delete('isNotForm');\n mnReq = mnReq.clone({headers: headers, responseType: 'text'});\n }\n }\n\n return next\n .handle(mnReq).pipe(\n tap((event) => {\n this.httpResponse.next(event);\n }),\n catchError((event) => {\n this.httpResponse.next(event);\n return throwError(event);\n })\n );\n }\n}\n\nclass CustomEncoder {\n encodeKey(key) {\n return encodeURIComponent(key);\n }\n\n encodeValue(value) {\n return encodeURIComponent(value);\n }\n\n decodeKey(key) {\n return decodeURIComponent(key);\n }\n\n decodeValue(value) {\n return decodeURIComponent(value);\n }\n}\n"], "mappings": "+RAkBA,sBAAmB,WACN,cAAc,CAAE,MAAO,CAChC,GAAI,aAGN,aAAc,CACZ,eAAe,cAEf,KAAK,OAAS,GACd,KAAK,OAAO,QAAU,GAAI,iBAAgB,IAC1C,KAAK,OAAO,aAAe,GAAI,SAC/B,KAAK,OAAO,aAAe,GAAI,SAC/B,KAAK,OAAO,QACV,KAAK,OAAO,aAAa,KAAK,OAAO,SAAU,GAAI,CAGjD,MAAQ,cAAc,oBACnB,GAAG,SAAW,KAAQ,CAAC,GAAG,QAAQ,IAAI,mBAjBjD,oCCEA,2BAAwB,WACX,cAAc,CAAE,MAAO,CAChC,GAAI,uBAGK,aAAa,CAAE,MAAO,CAC/B,cAGF,YAAY,aAAc,CACxB,KAAK,aAAe,aA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