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AQG,EAAKgE,EAAqBC,EAAiBvH,GAF3D,KAAAsH,oBAAAA,EACZ,KAAAC,gBAAAA,EAAyC,KAAAvH,WAAAA,CAEjD,CAEUkC,mBACT,IAAI4I,EAAoB,eACxB,IAAKA,EAAoB,KAAM,+CAE/BzK,KAAKuH,WAAWkD,GAChBlG,QAAQI,IAAI,aAAa8F,GACnBzK,KAAKoH,QAAU,wBACfpH,KAAKqH,MAAS,qBACrB,EAGM,MAAMqD,UAAkB1D,EAE3B1F,YAAYyB,EAAsBC,EAA6BF,EACjEG,EAAmBgE,EACZC,EAAyCvH,GAChDqF,MAAMjC,EAAOC,EAAcF,EAAQG,EAAKgE,EAAqBC,EAAgBvH,GAF1D,KAAAsH,oBAAAA,EACZ,KAAAC,gBAAAA,EAAyC,KAAAvH,WAAAA,CAEjD,CAEUkC,mBAIT,IAAI8I,EAAe,kBACnB,IAAKA,EAAe,KAAM,kDAE1B3K,KAAKuH,WAAWoD,GAChBpG,QAAQI,IAAI,cAAcgG,GACpB3K,KAAKoH,QAAU,wBACfpH,KAAKqH,MAAS,qBACrB,E","sources":["webpack://client-app/./src/app/services/BimViewerThreeDServiceIF.ts","webpack://client-app/./src/app/services/access-level-service.ts","webpack://client-app/./src/app/services/api-client.ts"],"sourcesContent":["import { RevisionInformation3d } from \"app/project/work-area/split-viewer-interfaces\";\r\n\r\n\r\nexport interface BimViewerThreeDServiceIF {\r\n\tshowObjects(objectIds: number[]): void;\r\n\thideObjects(objectIds: number[]): void;\r\n\ttransluteObjects(objectIds: number[]): void;\r\n\tchangeSelectedTool(tool: ToolEnum): void;\r\n\thideAllObjects(loadedRevisions: Map): void;\r\n\ttransluteAllObjects(loadedRevisions: Map): void;\r\n\tshowAllObjects(loadedRevisions: Map): void;\r\n\thandleSpaces(loadedRevisions: Map, shouldShowSpaces: boolean): void;\r\n}\r\n\r\nexport enum ToolEnum {\r\n\tObjectSelection,\r\n\tDimensionMeasure,\r\n\tLaserMeasure,\r\n\tCropTool,\r\n}\r\n","import { IRouteConfig_Child, MenuAccessLevel, RouteConfig_Root } from \"app/aox/RouteTypings_Ajour\";\r\nimport { OrgRole } from \"app/models/org-role\";\r\nimport { OrgTokenInfo } from \"app/models/org-token-info\";\r\nimport { ProjectRole } from \"app/models/project-role\";\r\nimport { ProjectTokenInfo } from \"app/models/project-token-info\";\r\nimport { AppContextService } from \"./app-context-service\";\r\n\r\nexport class AccessLevelService {\r\n \r\n public static hasAccess(appContext:AppContextService, route:IRouteConfig_Child | RouteConfig_Root, projectTokenInfo: ProjectTokenInfo, orgTokenInfo: OrgTokenInfo): boolean {\r\n switch (route?.menuAccessLevel){\r\n\t\t\tcase MenuAccessLevel.PrjUser: return this.hasPrjUserAccess(projectTokenInfo);\r\n\t\t\tcase MenuAccessLevel.PrjSettings: return this.hasPrjSettingAccess(projectTokenInfo);\r\n\t\t\tcase MenuAccessLevel.PrjAdmin: return this.hasPrjAdminAccess(projectTokenInfo);\r\n\t\t\tcase MenuAccessLevel.OrgAdmin: return this.hasOrgAdminAccess(orgTokenInfo);\r\n\t\t\tcase MenuAccessLevel.AOCRoles: return this.hasAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed);\r\n\t\t\tcase MenuAccessLevel.AOCRolesOrPrjUser: return this.hasPrjUserOrAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed, projectTokenInfo);\r\n\t\t\tcase MenuAccessLevel.AOCRolesOrOrgUser: return this.hasOrgUserOrAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed, orgTokenInfo);\r\n\t\t\tcase MenuAccessLevel.AOCRolesOrOrgAdmin: return this.hasOrgAdminOrAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed,orgTokenInfo);\r\n\t\t}\r\n\t\treturn false;\r\n }\r\n\t\r\n private static hasOrgAdminAccess(orgTokenInfo: OrgTokenInfo): boolean {\r\n\t\treturn orgTokenInfo.orgRole >= OrgRole.Org_Admin;\r\n\t}\r\n\tprivate static hasPrjAdminAccess(projectTokenInfo: ProjectTokenInfo): boolean {\r\n\t\treturn projectTokenInfo.prjRole >= ProjectRole.Prj_Admin || projectTokenInfo.orgRole >= OrgRole.Org_Admin;\r\n\t}\r\n\tprivate static hasPrjSettingAccess(projectTokenInfo: ProjectTokenInfo): boolean {\r\n\t\treturn projectTokenInfo.prjRole >= ProjectRole.Prj_Setting_User;\r\n\t}\r\n\tprivate static hasPrjUserAccess(projectTokenInfo: ProjectTokenInfo): boolean {\r\n\t\treturn projectTokenInfo.prjRole >= ProjectRole.Prj_User;\r\n\t}\r\n\r\n\tprivate static hasAOCAccess(appContext: AppContextService, routeRolesAllowed: any): boolean {\r\n\t\tif (routeRolesAllowed == undefined) { return false; }\r\n\t\tfor (let i = 0; i < routeRolesAllowed.length; i++) {\r\n\t\t\tconst routeElement = routeRolesAllowed[i];\r\n\r\n\t\t\tif (appContext.currentUser) {\r\n\t\t\t\tfor (let j = 0; j < appContext.currentUser.roles.length; j++) {\r\n\t\t\t\t\tconst userElement = appContext.currentUser.roles[j];\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (routeElement === userElement)\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tprivate static hasPrjUserOrAOCAccess(appContext:AppContextService, sectionUserRolesAllowed: string[] | undefined, projectTokenInfo: ProjectTokenInfo): boolean {\r\n\t\tif (AccessLevelService.hasAOCAccess(appContext, sectionUserRolesAllowed) == true) { return true; }\r\n\t\treturn projectTokenInfo.prjRole >= ProjectRole.Prj_User;\r\n\t}\r\n\r\n\tstatic hasOrgUserOrAOCAccess(appContext: AppContextService, sectionUserRolesAllowed: string[] | undefined, orgTokenInfo: OrgTokenInfo): boolean {\r\n\t\tif (AccessLevelService.hasAOCAccess(appContext, sectionUserRolesAllowed) == true) { return true; }\r\n\t\treturn orgTokenInfo.orgRole >= OrgRole.Org_User;\r\n\t}\r\n\r\n\tprivate static hasOrgAdminOrAOCAccess(appContext:AppContextService, sectionUserRolesAllowed: string[] | undefined, orgTokenInfo: OrgTokenInfo): boolean {\r\n\t\tif (AccessLevelService.hasAOCAccess(appContext, sectionUserRolesAllowed) == true) { return true; }\r\n\t\treturn orgTokenInfo.orgRole >= OrgRole.Org_Admin;\r\n\t}\r\n}","import {EventAggregator} from 'aurelia-event-aggregator';\r\nimport {ErrorService} from './error-service';\r\nimport {autoinject} from 'aurelia-framework';\r\nimport {ModalService} from './modal-service';\r\nimport {json} from \"aurelia-fetch-client\";\r\nimport {HttpClient, HttpResponseMessage, RequestBuilder} from \"aurelia-http-client\";\r\nimport * as settings from 'app-settings.json';\r\nimport {I18N} from 'aurelia-i18n';\r\nimport * as downloadjs from \"downloadjs\";\r\nimport { AppValues } from '../models/app-values';\r\nimport jwt_decode from \"jwt-decode\";\r\n\r\n// JG: ja jeg er dum..\r\nimport * as environment from '../../../config/environment.json';\r\nimport { ProjectTokenService } from './project-token-service';\r\nimport { OrgTokenService } from './org-token-service';\r\nimport { AppContextService } from './app-context-service';\r\nimport { ModalMessage } from 'app/components/dialog/modal-message';\r\nimport { DialogCancellableOpenResult, DialogOpenPromise } from 'aurelia-dialog';\r\n\r\nclass AoxRequestBuilder {\r\n headers: object = {};\r\n method: string = \"\";\r\n\tcontent?: any;\r\n\tnoGui: boolean = false;\r\n\r\n //private route: string = \"\";\r\n public route: string = \"\"; // let us inspect for error handling.\r\n\r\n\t\r\n constructor(apiUrl: string) {\r\n this.addRouteSection(apiUrl);\r\n }\r\n\r\n public addRouteSection(section: string): void {\r\n this.route += section;\r\n }\r\n async sendXhrCall(responseType?:string): Promise{\r\n let client = new HttpClient();\r\n let builder:RequestBuilder = client.createRequest(this.route);\r\n\r\n if (this.method == 'GET') {\r\n builder = builder.asGet();\r\n } else if (this.method == 'POST'){\r\n builder = builder.asPost().withContent(this.content);\r\n }\r\n\r\n if (responseType) {\r\n \tbuilder = builder.withResponseType(responseType);\r\n }\r\n\r\n Object.keys(this.headers).forEach(x => builder = builder.withHeader(x, (this.headers)[x]))\r\n return builder.send();\r\n }\r\n}\r\n\r\nexport class RequestMethod {\r\n constructor(\r\n public request: AoxRequestBuilder, // egentlig config..\r\n\t\tprivate events: EventAggregator,\r\n\t\tprivate modal: ModalService,\r\n private errorService: ErrorService, \r\n private i18n: I18N) {\r\n }\r\n\r\n public get(action: string, noGui:boolean = false): RequestErrorHandling{\r\n\t\tthis.request.method = 'GET';\r\n\t\tthis.request.noGui = noGui;\r\n this.request.addRouteSection(action); \r\n return this.next();\r\n }\r\n public postJson(action: string, content: any): RequestErrorHandling {\r\n (this.request.headers)[\"Content-Type\"] = \"application/json\";\r\n this.request.method = 'POST';\r\n this.request.content = json(content);\r\n this.request.addRouteSection(action);\r\n return this.next();\r\n }\r\n public postText(action: string, content: string): RequestErrorHandling{\r\n this.request.method = 'POST';\r\n this.request.content = content;\r\n this.request.addRouteSection(action);\r\n return this.next();\r\n }\r\n public postForm(action: string, content: FormData): RequestErrorHandling{\r\n //this.request.headers[\"Content-Type\"] = contentType;\r\n this.request.method = 'POST';\r\n this.request.content = content;\r\n this.request.addRouteSection(action);\r\n return this.next();\r\n }\r\n private next(): RequestErrorHandling{\r\n return new RequestErrorHandling(this.request, this.events, this.modal, this.errorService, this.i18n);\r\n }\r\n}\r\n\r\n\r\nexport class RequestExecution {\r\n\tprotected errorHandler: Function = () => {}; // det ville ha vaeret rart med nogen TYPER paa den funktion - at den tager reason-any-Response som arg, og hvad den maaske kunne returnere..\r\n constructor(protected request: AoxRequestBuilder, protected events: EventAggregator) { }\r\n\r\n public async noResponse(): Promise{\r\n\t\tthis.events.publish('is-loading', true);\r\n\t\treturn await this.request.sendXhrCall() // noResponse\r\n .catch(async reason => this.errorHandler(reason))\r\n\t\t.finally(() => {\r\n\t\t\tthis.events.publish('is-loading', false);\r\n\t\t});\r\n }\r\n\r\n\t// JG: This was broken - it's not fetch Response, it's HttpResponseMessage!\r\n public async response(): Promise { //Response>{ // FetchAPI response??\r\n\t\tthis.events.publish('is-loading', true);\r\n\t\ttry {\r\n\t\t\tlet rsp:HttpResponseMessage = await this.request.sendXhrCall();//response\r\n\t\t\treturn rsp;\r\n\t\t\t//Type 'HttpResponseMessage' is missing the following properties from type 'Response': ok, redirected, status, type, and 9 more.\r\n\t\t} catch (reason) { //HttpResponseMessage) {\r\n\t\t\t// It turns out, the exception-argument is actually STILL the HttpResponseMessage,\r\n\t\t\t// so let us pass it unto the caller.\r\n\t\t\t// (either we should rethrow the exception, OR give them the error.\r\n\t\t\t// We should NOT hide the error from them.)\r\n\t\t\t// Thus: we UI-warn the user, then allow the code to proceed with the error.\r\n\t\t\tlet really:HttpResponseMessage = reason;\r\n\t\t\t//console.log('reason:', reason);\r\n\t\t\tawait this.errorHandler(reason);\r\n\t\t\treturn really;\r\n\t\t} finally {\r\n\t\t\tthis.events.publish('is-loading', false);\r\n\t\t}\r\n }\r\n\r\n\t//Used for calls to the api that should not be \"waited\" on with a spinning icon.\r\n\t// JG: This was broken - it's not fetch Response, it's HttpResponseMessage!\r\n public async responseNoLoadingIcon(): Promise { //Response>{ // FetchAPI response??\r\n\t\ttry {\r\n\t\t\tlet rsp:HttpResponseMessage = await this.request.sendXhrCall();//responseNoLoadingIcon\r\n\t\t\treturn rsp;\r\n\t\t\t//Type 'HttpResponseMessage' is missing the following properties from type 'Response': ok, redirected, status, type, and 9 more.\r\n\t\t} catch (reason) { //HttpResponseMessage) {\r\n\t\t\t// It turns out, the exception-argument is actually STILL the HttpResponseMessage,\r\n\t\t\t// so let us pass it unto the caller.\r\n\t\t\t// (either we should rethrow the exception, OR give them the error.\r\n\t\t\t// We should NOT hide the error from them.)\r\n\t\t\t// Thus: we UI-warn the user, then allow the code to proceed with the error.\r\n\t\t\tlet really:HttpResponseMessage = reason;\r\n\t\t\t//console.log('reason:', reason);\r\n\t\t\tawait this.errorHandler(reason);\r\n\t\t\treturn really;\r\n\t\t}\r\n }\r\n\r\n\tpublic async downloadFile(fileName:string): Promise{\r\n\t\treturn await this.request.sendXhrCall(\"arraybuffer\") // in downloadFile.\r\n\t\t\t.then(response => downloadjs(response.response, fileName, 'application/octet-stream'))\r\n\t\t\t.catch(async reason => this.errorHandler(reason));\r\n\t}\r\n \r\n public async objectResult(typeInstance?: T): Promise{\r\n\t\t// (JG: This is basicaly the same as jsonResult(), it just includes the Object.assign thing.)\r\n\t\tthis.events.publish('is-loading', true); // (Should be outside try-catch.)\r\n\t\ttry {\r\n\t\t\tlet response = await this.request.sendXhrCall();//objectResult\r\n\t\t\tif (Boolean(typeInstance)){\r\n\t\t\t\t// Do this when the dto has methods\r\n\t\t\t\tlet x = await response.content;\r\n\t\t\t\treturn Object.assign(typeInstance, x);\r\n\t\t\t} else { // Do this when the dto is an interface or only has properties\r\n\t\t\t\treturn await response.content;\r\n\t\t\t}\r\n\t\t} catch (reason) {\r\n\t\t\tconsole.trace('RequestExecution.objectResult');\r\n\t\t\tthis.errorHandler(reason);\r\n\t\t\treturn typeInstance; //Not sure if this is a good solution. fixed due to strict mode.\r\n\t\t} finally {\r\n\t\t\tthis.events.publish('is-loading', false);\t\t \t\r\n\t\t}\t\t\r\n }\r\n\r\n public async jsonResult(lookBusy:boolean=true): Promise{\r\n\t\tif (lookBusy) { this.events.publish('is-loading', true); }\r\n return await this.request.sendXhrCall() // jsonResult\r\n .then(async response => { \r\n\t\t\t\tlet awaitedContent = await response.content;\t\t\t\t\r\n\t\t\t\treturn awaitedContent;\r\n\t\t\t})\r\n\t\t\t.catch(async reason => { \r\n\t\t\t\tlet dlg = this.errorHandler(reason);\r\n\t\t\t\tlet done = await dlg; // Note below.\r\n\t\t\t})\r\n\t\t\t.finally( () => {\r\n\t\t\t\tif (lookBusy) { this.events.publish('is-loading', false); }\r\n\t\t\t});\r\n }\r\n\r\n\t//Used for calls to the api that should not be \"waited\" on with a spinning icon.\r\n\tpublic async jsonResultNoLoadingIcon(): Promise{\r\n return await this.request.sendXhrCall() // in jsonResultNoLoadingIcon. \r\n .then(async response => { \r\n\t\t\t\tlet awaitedContent = await response.content;\r\n\t\t\t\treturn awaitedContent;\r\n\t\t\t})\r\n\t\t\t.catch(async reason => { \r\n\t\t\t\tlet dlg = this.errorHandler(reason);\r\n\t\t\t\tlet done = await dlg; // Note below.\r\n\t\t\t});\r\n }\r\n\r\n public async stringResult(): Promise{\r\n\t\ttry {\r\n\t\t\tthis.events.publish('is-loading', true);\r\n\t\t\tconst httpResponseMsg = await this.request.sendXhrCall(); // in stringResult.\r\n\t\t\tconst contentString = httpResponseMsg.content;\r\n\t\t\treturn contentString;\r\n\t\t} catch (reason) {\r\n\t\t\tconsole.log('awaiting error handler..');\r\n\t\t\tconst myAny = await this.errorHandler(reason);\r\n\t\t\tconsole.log('Done awaiting error handler..');\r\n\t\t\treturn myAny;\r\n\t\t} finally {\r\n\t\t\tthis.events.publish('is-loading', false);\r\n\t\t}\r\n }\r\n\r\n\t/* The significance of either awaiting dlg here or not:\r\n\t- If we await, all error messages are shown in sequence.\r\n\t- If we skip the await, the 'queue' of error \r\n\tmessages is unwound (all of them),\r\n\tand we only end up seing the last error,\r\n\tie 'the last consequence'.\r\n\tSo without await, the user only gets 'the final consequence'.\r\n\tWITH await, we instead get the REASON it happened.\r\n\t*/\r\n\r\n}\r\n\r\nexport class RequestErrorHandling extends RequestExecution {\r\n\r\n\tasync error401():Promise { //if (reason.statusCode === 401) {\t\t}\r\n\t\tconsole.trace('inside 401');\r\n\t\tlet dlg:Promise = this.modal.OpenMessage('Unauthorized', \r\n\t\t\t\"User session might have expired or an unauthorized action was invoked\",\r\n\t\t\ttrue // ie showReset.\r\n\t\t)\r\n\t\t.whenClosed(x => this.events.publish(\"user unauthorized\")\r\n\t\t);\r\n\t\t//let done = await dlg;\r\n\t\treturn dlg;\r\n\t}\r\n\tasync error403():Promise { //if (reason.statusCode === 401) {\t\t}\r\n\t\tconsole.log('inside 403');\r\n\t\tlet dlg:Promise = this.modal.OpenMessage('Forbidden', \r\n\t\t\t\"The user does not have permission to perform this action.\",\r\n\t\t\ttrue // ie showReset.\r\n\t\t)\r\n\t\t.whenClosed(x => {});\r\n\t\t//let done = await dlg;\r\n\t\treturn dlg;\r\n\t}\r\n\terror404() { console.log('inside 404'); }//if (reason.statusCode === 404) {}\r\n\tasync error409(reason:any) { //if (reason.statusCode === 409) {}\r\n\t\treturn this.modal.OpenMessage('Conflict', reason.response, true);\r\n\t}\r\n\r\n constructor(request: AoxRequestBuilder, events: EventAggregator, private modal: ModalService, private errorService: ErrorService, private i18n: I18N) {\r\n\t\tsuper(request, events);\r\n\r\n\t\tthis.errorHandler = async (reason: HttpResponseMessage) => { // was:any\r\n\t\t\t// I hate the broken error-handling for XMLHttpRequest \r\n\t\t\t//console.trace('(MAY be NET::ERR_CONNECTION_REFUSED, ie server-not-started/available.)');\r\n\t\t\tconsole.log('EH, code:',reason.statusCode, reason.requestMessage.url);\r\n\t\t\tswitch (reason.statusCode) {\r\n\t\t\t\tcase 401: return this.error401();\r\n\t\t\t\tcase 403: return this.error403();\r\n\t\t\t\tcase 404: return this.error404();\r\n\t\t\t\tcase 409: return this.error409(reason); // conflict.\r\n\t\t\t} // report common cases without lengthy trace().\r\n\t\t\t\r\n\t\t\tconsole.trace('(MAY be NET::ERR_CONNECTION_REFUSED, ie server-not-started/available.)');\r\n\t\t\tif (this.request.noGui) {\r\n\t\t\t\tthis.logErrorInstead(reason);\r\n\t\t\t} else { // IE WITH-gui.\r\n\t\t\t\tthis.alsoLogResponseWITH_gui(reason);\r\n\t\t\t\tthis.modal.OpenMessage('An error occurred', `${reason}`, true);\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n\r\n\talsoLogResponseWITH_gui(reason: any) { \r\n\t\tthis.logErrorInstead(reason);\r\n\t} // In fact, we ALWAYS want the log.\r\n\r\n\tlogErrorInstead(message: any):RequestErrorHandling {\r\n\t\tlet extra:string = '';\r\n\t\tif (message.hasOwnProperty('requestMessage')) {\r\n\t\t\tlet messageUrl = message.requestMessage.url;\r\n\t\t\tif (Boolean(messageUrl)) {\r\n\t\t\t\textra = messageUrl;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (message.hasOwnProperty('response')) {\r\n\t\t\tlet response = message.response;\r\n\t\t\tconsole.trace('response:', response);\r\n\t\t\tif (response instanceof ArrayBuffer) {\r\n\t\t\t\tconsole.log('it is arraybuffer.');\r\n\t\t\t\tlet ab:ArrayBuffer = response;\r\n\t\t\t\tlet str = new TextDecoder().decode(ab);\r\n\t\t\t\t//var buf = new ArrayBuffer(ab.byteLength);\r\n\t\t\t\t//var int8view = new Uint8Array(buf);\r\n\t\t\t\tconsole.log('ab contents:', str); //int8view)\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconsole.log('extra:', extra);\r\n\t\tconsole.log('message:', message);\r\n\t\treturn this;\r\n\t}\r\n\t \r\n\thandleErrorWithErrorService(errorHandler: (service: ErrorService, reason: any) => void): RequestExecution {\r\n\t\tthis.errorHandler = (reason: any) => errorHandler(this.errorService, reason);\r\n\t\treturn this;\r\n\t}\r\n\t\r\n\thandleError(title: string, message: string): RequestExecution {\r\n\t\t//console.trace('who called handleError?');\r\n\r\n\t\tthis.errorHandler = async (reason: any) => { \r\n\t\t\tconsole.log('endpoint:', this.request.route);\r\n\t\t\tconsole.log('reason:',reason);\r\n\t\t\tthis.logResponse(reason);\r\n\t\t\t//await this.modal.OpenMessage(this.i18n.tr(title), this.i18n.tr(message), true);\r\n\t\t\tconst dlgPromise:DialogOpenPromise = this.modal.OpenModal( \r\n\t\t\t\tModalMessage, \r\n\t\t\t\t{ title, message:this.i18n.tr(message), showReset:true }\r\n\t\t\t\t//true\r\n\t\t\t);\r\n\t\t\tconst dlgCloseResult = await dlgPromise.whenClosed();\r\n\t\t\tconsole.log('dlgCloseResult:',dlgCloseResult);\r\n\t\t\treturn reason;\r\n\t\t};\r\n\t\treturn this;\r\n\t}\r\n\r\n\tlogResponse(rspMsg: HttpResponseMessage) {\r\n\t\tconsole.log('response:',rspMsg.response);\r\n\t\tif (typeof rspMsg.content == 'string') { // JG: 'normal case'.\r\n\t\t\tconsole.log('response.content:', rspMsg.content);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// (Special case, e.g. when attempt to download puts us into arrayBuffer mode..?)\r\n\t\tif (rspMsg.responseType == 'arraybuffer' || rspMsg.responseType == 'txt') {\r\n\t\t\tlet str:string = new TextDecoder().decode(rspMsg.response); \r\n\t\t\tconsole.log('arraybuf says:', str);\r\n\t\t\t// (JG: we attempted to download a file, but because an error happened, our 'file contents' is really the server's error response.)\r\n\t\t} else { // We have no idea what happened in that case..\r\n\t\t\tconsole.log('responseType is:', rspMsg.responseType);\r\n\t\t}\r\n\t}\r\n\r\n\thandleErrorUsingReason(title: string): RequestExecution {\r\n\t\tthis.errorHandler = (reason: any) => {\r\n\t\t\tconsole.trace('HRUR');\r\n\t\t\tconsole.log('HRUR',reason, reason.response);\r\n\t\t\tthis.modal.OpenMessage(this.i18n.tr(title), this.i18n.tr(reason.response), true);\r\n\t\t};\r\n\t\treturn this;\r\n\t}\r\n\r\n\thandleErrorMsgUsingReason(title: string, message: string): RequestExecution {\r\n\t\tlet newLine = ' '+ ('\\u1680').repeat(75);\r\n\t\tthis.errorHandler = (reason: any) => {\r\n\t\t\tconsole.log(reason.response); // Let us see/inspect any 'object ProgressEvent', to see what it's about.\r\n\t\t\tthis.modal.OpenMessage(this.i18n.tr(title), this.i18n.tr(message) + newLine + this.i18n.tr(reason.response), true);\r\n\t\t};\r\n\t\treturn this;\r\n\t}\r\n\r\n}\r\n\r\nexport interface TechInfo {\r\n version:string;\r\n build:string;\r\n}\r\n\r\n\r\n@autoinject\r\nexport class ApiClient {\r\n\r\n public _apiUrl: string = \"\"; //protected\r\n public version: string = \"\";\r\n\tpublic build: string = \"\";\r\n\tpublic clientBuild: string = \"\";\r\n\r\n\tpublic static IsCatendaEnabled_Global:boolean = false; //true; //false;\r\n\r\n constructor(private modal: ModalService, private errorService: ErrorService, private events: EventAggregator, private i18n: I18N, \r\n\t\tpublic projectTokenService: ProjectTokenService, public orgTokenService: OrgTokenService,public appContext: AppContextService) {}\r\n\r\n\tpublic set_apiUrl(url:string) {\r\n\t\t//console.log('set_apiUrl to', url, 'instead of', this._apiUrl);\t\t\r\n\t\tthis._apiUrl = url;//in-set_apiUrl\r\n\t\tif (!url) { throw 'trying to set empty apiUrl!'; }\r\n\t}\r\n\tprivate _get_apiUrl():string { // \"internal\" accessor.\r\n\t\tif (!this._apiUrl) { \r\n\t\t\tlet msg = '_get_apiUrl: trying to GET empty apiUrl!';\r\n\t\t\tconsole.trace(msg);\r\n\t\t\tthrow msg; \r\n\t\t}\r\n\t\treturn this._apiUrl;//in-get_apiUrl.\r\n\t}\r\n\r\n\tpublic isProd():boolean {\r\n\t\tlet prodBecauseHTTPS: boolean = Boolean(location.origin.startsWith(\"https\")) // Http(s) determins dev or prod;\r\n\t\treturn prodBecauseHTTPS;\r\n\t}\r\n\r\n public async initialize(): Promise{\r\n\t\t// ApiClient appears to be a DI singleton, just initialized ONCE in main.ts on startup.\r\n\r\n\t\t/* JG: I'm not too happy about this,\r\n\t\t I think they should use a symmetric mechanism,\r\n\t\t so you can control both cases the same way\r\n\t\t (i.e., I don't like that they are controlled by two different config mechanisms.) */\r\n\t\tlet prodBecauseHTTPS: boolean = this.isProd(); //Boolean(location.origin.startsWith(\"https\")) // Http(s) determins dev or prod;\r\n\r\n\t\t// prodBecauseHTTPS = true; // blot til test lokalt.\r\n\r\n\t\tif (prodBecauseHTTPS) { // For prod the api url is supplied via deployment environment vars\r\n // (Beware, this asks the tiny Controller in aspnet server that serves the aurelia UI.)\r\n\r\n\t\t\tconsole.log('location (for origin):', location);\r\n\t\t\tlet ui_baseUrl = location.origin;\r\n\r\n\t\t\tlet api_url:string = await this.custom(ui_baseUrl).get(\"/settings/client\").stringResult(); \r\n\t\t\tthis.set_apiUrl(api_url);//ApiClient.initialize-prod\r\n\t\t\tconsole.log('ApiClient.initialize-prod to:', api_url);\r\n\t\t\t// JG: Shouldn't this also set bimApi and AWJ_Api?\r\n\t\t} else { // For dev use builtin api url dev setting\r\n\t\t\tconsole.log('ApiClient.initialize-dev to:', settings.devApiUrl);\r\n\t\t\tthis.set_apiUrl(settings.devApiUrl);//ApiClient.initialize-dev\r\n\t\t}\r\n\r\n\t\tlet techVersionPath = \"Tech/Version\";\r\n\t\ttry {\r\n\t\t\tlet techInfo:TechInfo = await this.global.get(techVersionPath, true).jsonResult();\r\n\t\t\tthis.version = techInfo.version;\r\n\t\t\tthis.build = techInfo.build;\r\n\t\t} catch (e) {\r\n\t\t\talert(`cannot reach ${techVersionPath}`);\r\n\t\t}\r\n\t}\r\n\r\n private async configureClientVersion_notUsed() {\r\n\t\tlet ui_baseUrl = location.origin;\r\n\t\tlet techInfo2: TechInfo =\r\n\t\t\tawait this.custom(ui_baseUrl).get(\"/settings/clientversion\")\r\n\t\t\t\t.jsonResult()\r\n\t\t\t\t.catch(async reason => console.error(await reason.json())); \r\n\r\n\t\tthis.clientBuild = '!' + techInfo2.build;\r\n }\r\n\r\n\tpublic getApiUrl(): string { // \"external\" accessor.\r\n\t\t/* THIS is not good, the image-support-hack, also becomes a reload-bug!\r\n\t\t BOGUSERROR\r\n\t\t*/\r\n\t\tlet gottenApiUrl = this._get_apiUrl();\r\n\t\tlet hasApiUrl = Boolean(gottenApiUrl);\r\n\t\tif (!hasApiUrl) {\r\n\t\t\tlet msg = 'who is using uninitialized apiUrl?';\r\n\t\t\tconsole.trace(msg);\r\n\t\t\tthrow msg;\r\n\t\t}\r\n\r\n\t\treturn hasApiUrl ? gottenApiUrl : 'broken!!';//location.origin is SELDOM the answer, it is the CLIENT, not the API address!\r\n\r\n\t\t//location.origin; // needed for urls for images. FIXME - where do we actually need/use that?\r\n\t\t// (JG: The idea is, that for images we just do requests back to the same server address we originated from.)\t\t\r\n\t\t// But who ever empty-initializes it, if there is only one singleton-instance??\r\n\t}\r\n\r\n private buildConfig(custom_baseUrl:string=''): AoxRequestBuilder {\r\n\t\t//if (custom_baseUrl) { console.log('buildConfig gets custom_baseUrl:', custom_baseUrl); }\r\n\r\n let config = new AoxRequestBuilder( custom_baseUrl ? custom_baseUrl : this.getApiUrl() );//(in buildConfig) allows calling client host for api url in production\r\n\t\tlet token:string | null = sessionStorage.getItem('access_token');\r\n if(token)\r\n (config.headers)[\"Authorization\"] = (\"Bearer \" + token); \r\n return config;\r\n }\r\n public custom(custom_baseUrl:string=''):RequestMethod {\r\n\t\tif (!custom_baseUrl) { // JG: Jeg kobler dette til igen, da commit-beskeden fra det blev fjernet, ikke forklarer en grund til at fjerne det.\r\n\t\t\tcustom_baseUrl = this._get_apiUrl();\r\n\t\t\t// console.trace('apiClient.custom: using default ApiUrl as no custom specified.', custom_baseUrl);\r\n\t\t}\r\n let config = this.buildConfig(custom_baseUrl);//custom\r\n return new RequestMethod(config, this.events, this.modal, this.errorService, this.i18n);\r\n }\r\n\r\n\tprivate buildProjectConfig(projectId: string, custom_baseUrl:string=''): AoxRequestBuilder { //Used for getting and setting prj_access_token.\r\n\t\tif (custom_baseUrl) { \r\n\t\t\tconsole.log('buildProjectConfig gets custom_baseUrl:', custom_baseUrl); \r\n\t\t}\r\n\t\t\r\n let config = new AoxRequestBuilder( custom_baseUrl ? custom_baseUrl : this.getApiUrl() );//(in buildConfig) allows calling client host for api url in production\r\n\t\tlet token:string | null = sessionStorage.getItem('prj_access_token');\r\n if(token) {\r\n\t\t\tthis.projectTokenService.doesTokenMatchLog(projectId,token);\r\n\t\t\t(config.headers)[\"Authorization\"] = (\"Bearer \" + token); \r\n\t\t}\r\n return config;\r\n }\r\n\r\n\tpublic projectWToken(id: string):RequestMethod {\r\n\t\tif (!id) { console.trace('warning - ApiClient.project called with empty/missing projectId:', id); }\r\n\t\tif (id == 'undefined') { console.trace('passing STRING undefined in api.'); }\r\n\r\n let config = this.buildProjectConfig(id);//projectWToken \r\n (config.headers)[\"ajour_ao_scope\"] = \"ScopeAccessProject\";\r\n (config.headers)[\"ajour_ao_project\"] = id;\r\n config.addRouteSection(\"/api/project/\");\r\n return new RequestMethod(config, this.events, this.modal, this.errorService, this.i18n);\r\n }\r\n\r\n public project(id: string):RequestMethod {\r\n\t\tif (!id) { console.trace('warning - ApiClient.project called with empty/missing projectId:', id); }\r\n\t\tif (id == 'undefined') { console.trace('passing STRING undefined in api.'); }\r\n\r\n let config = this.buildConfig();//project \r\n (config.headers)[\"ajour_ao_scope\"] = \"ScopeAccessProject\";\r\n (config.headers)[\"ajour_ao_project\"] = id;\r\n config.addRouteSection(\"/api/project/\");\r\n return new RequestMethod(config, this.events, this.modal, this.errorService, this.i18n);\r\n }\r\n\r\n\tprivate buildOrgConfig(token: string | null, custom_baseUrl:string=''): AoxRequestBuilder { //Used for getting and setting prj_access_token.\r\n\t\tif (custom_baseUrl) { \r\n\t\t\tconsole.log('buildProjectConfig gets custom_baseUrl:', custom_baseUrl); \r\n\t\t}\r\n\t\t\r\n let config = new AoxRequestBuilder( custom_baseUrl ? custom_baseUrl : this.getApiUrl() );//(in buildConfig) allows calling client host for api url in production\r\n\t\tif(token) {\r\n\t\t\t(config.headers)[\"Authorization\"] = (\"Bearer \" + token); \r\n\t\t} else { //If org-token is not set we use the old token. Should be removed when OrgRoles and PrjRoles are finished being implemented.\r\n\t\t\t(config.headers)[\"Authorization\"] = (\"Bearer \" + sessionStorage.getItem('access_token')); \r\n\t\t}\r\n return config;\r\n }\r\n\r\n\tpublic orgById(orgId: string): RequestMethod {\r\n let config = this.buildConfig();//system\r\n (config.headers)[\"ajour_ao_scope\"] = \"ScopeAccessOrg\";\r\n\t\t(config.headers)[\"ajour_ao_organisation\"] = orgId;\r\n config.addRouteSection(\"/api/org/\");\r\n\t\tlet rm = new RequestMethod(config, this.events, this.modal, this.errorService, this.i18n);\r\n\t\treturn rm;\r\n }\r\n\r\n\tget orgByToken(): RequestMethod {\r\n\t\tlet token:string | null = sessionStorage.getItem('org_access_token');\r\n\t\tlet config = this.buildOrgConfig(token);//system\r\n\t\t(config.headers)[\"ajour_ao_scope\"] = \"ScopeAccessOrg\";\r\n\t\t(config.headers)[\"ajour_ao_organisation\"] = token != null ? this.orgTokenService.getOrgIdFromToken(token) : this.appContext.currentUser?.organization.id; //Defaulting to ownerCompanyId should be removed once OrgRoles are implemented properly.\r\n\t\tconfig.addRouteSection(\"/api/org/\");\r\n\t\tlet rm = new RequestMethod(config, this.events, this.modal, this.errorService, this.i18n);\r\n\t\treturn rm;\r\n }\r\n\t\r\n get system(): RequestMethod {\r\n let config = this.buildConfig();//system\r\n (config.headers)[\"ajour_ao_scope\"] = \"ScopeAccessSystem\";\r\n config.addRouteSection(\"/api/system/\");\r\n\t\tlet rm = new RequestMethod(config, this.events, this.modal, this.errorService, this.i18n);\r\n\t\treturn rm;\r\n }\r\n get manufacturer(): RequestMethod {\r\n let config = this.buildConfig();//manufacturer \r\n (config.headers)[\"ajour_ao_scope\"] = \"ScopeAccessManufacturer\";\r\n config.addRouteSection(\"/api/system/\");\r\n return new RequestMethod(config, this.events, this.modal, this.errorService, this.i18n);\r\n }\r\n get global(): RequestMethod {\r\n let config = this.buildConfig();//global\r\n (config.headers)[\"ajour_ao_scope\"] = \"ScopeAccessGlobal\";\r\n config.addRouteSection(\"/api/global/\");\r\n return new RequestMethod(config, this.events, this.modal, this.errorService, this.i18n);\r\n }\r\n\r\n\tpublic target(apiTarget: string, input: any = null): RequestMethod {\r\n\t\t// The non-obvious thing here is that \r\n\t\t// if input is specified, the request-method builder \r\n\t\t// becomes an active mechanism, that injects the 'ajour_ao_project' header value.\r\n\t\t// I'm not in favour of this 'opaque data turns out to sometimes be a project_id'.\r\n\r\n\t\tlet hasInput = !!input; //Boolean(input);\r\n\t\tlet passInput = (hasInput && apiTarget != AppValues.apiTarget.system);\r\n\t\tif (!passInput) { \r\n\t\t\treturn (this)[apiTarget]; //RequestMethod\r\n\t\t} else {\r\n\t\t\treturn (this)[apiTarget](input); //RequestMethod\r\n\t\t}\r\n }\r\n}\r\n\r\nexport class BimClient extends ApiClient {\r\n constructor(modal: ModalService, errorService: ErrorService, events: EventAggregator, \r\n\t\ti18n: I18N, public projectTokenService: ProjectTokenService, \r\n\t\tpublic orgTokenService: OrgTokenService, public appContext: AppContextService) {\r\n\t\tsuper(modal, errorService, events, i18n,projectTokenService, orgTokenService, appContext);\r\n\t}\r\n\r\n public async initialize(): Promise{\r\n\t\tlet bimViewerBaseUrl = environment.bimviewerUrl;\r\n\t\tif (!bimViewerBaseUrl) { throw 'environment.bimviewerUrl setting is missing.'; }\r\n\r\n\t\tthis.set_apiUrl(bimViewerBaseUrl);//BimClient.initialize. \r\n\t\tconsole.log('BimClient!',bimViewerBaseUrl);\r\n this.version = 'no-bim-client-version';\r\n this.build = 'no-bim-client-build';\r\n\t}\r\n}\r\n\r\nexport class AWJClient extends ApiClient { // AzureWebJobs client.\r\n\t// how do we configure in api?\r\n constructor(modal: ModalService, errorService: ErrorService, events: EventAggregator, \r\n\t\ti18n: I18N, public projectTokenService: ProjectTokenService, \r\n\t\tpublic orgTokenService: OrgTokenService, public appContext: AppContextService) {\r\n\t\tsuper(modal, errorService, events, i18n,projectTokenService, orgTokenService,appContext);\r\n\t}\r\n\r\n public async initialize(): Promise{\r\n\t\t// JG: I wonder if it works by having multiple ClientApp\\config\\environment.json?\r\n\t\t//let prodBecauseHTTPS: boolean = this.isProd();\r\n\t\t// https://bg-worker-wa.azurewebsites.net, TODO: must be split into named test and prod!\r\n\t\tlet AWJ_BaseUrl = environment.azureWebJobsUrl;\r\n\t\tif (!AWJ_BaseUrl) { throw 'environment.azureWebJobsUrl setting is missing.'; }\r\n\r\n\t\tthis.set_apiUrl(AWJ_BaseUrl);\r\n\t\tconsole.log('AWJ-Client!',AWJ_BaseUrl);\r\n this.version = 'no-bim-client-version';\r\n this.build = 'no-bim-client-build';\r\n\t}\r\n}\r\n"],"names":["ToolEnum","AccessLevelService","static","appContext","route","projectTokenInfo","orgTokenInfo","menuAccessLevel","this","hasPrjUserAccess","hasPrjSettingAccess","hasPrjAdminAccess","hasOrgAdminAccess","hasAOCAccess","settings","sectionUserRolesAllowed","hasPrjUserOrAOCAccess","hasOrgUserOrAOCAccess","hasOrgAdminOrAOCAccess","orgRole","prjRole","routeRolesAllowed","undefined","i","length","routeElement","currentUser","j","roles","AoxRequestBuilder","constructor","apiUrl","headers","method","noGui","addRouteSection","section","async","responseType","builder","createRequest","asGet","asPost","withContent","content","withResponseType","Object","keys","forEach","x","withHeader","send","RequestMethod","request","events","modal","errorService","i18n","get","action","next","postJson","postText","postForm","RequestErrorHandling","RequestExecution","errorHandler","publish","sendXhrCall","catch","reason","finally","really","fileName","then","response","typeInstance","Boolean","assign","console","trace","lookBusy","dlg","log","myAny","OpenMessage","whenClosed","error404","super","statusCode","requestMessage","url","error401","error403","error409","logErrorInstead","alsoLogResponseWITH_gui","message","extra","hasOwnProperty","messageUrl","ArrayBuffer","ab","str","TextDecoder","decode","handleErrorWithErrorService","handleError","title","logResponse","dlgPromise","OpenModal","tr","showReset","dlgCloseResult","rspMsg","handleErrorUsingReason","handleErrorMsgUsingReason","newLine","repeat","ApiClient","projectTokenService","orgTokenService","_apiUrl","version","build","clientBuild","set_apiUrl","_get_apiUrl","msg","isProd","location","origin","startsWith","ui_baseUrl","api_url","custom","stringResult","techVersionPath","techInfo","global","jsonResult","e","alert","techInfo2","error","json","getApiUrl","gottenApiUrl","hasApiUrl","buildConfig","custom_baseUrl","config","token","sessionStorage","getItem","buildProjectConfig","projectId","doesTokenMatchLog","projectWToken","id","project","buildOrgConfig","orgById","orgId","orgByToken","getOrgIdFromToken","organization","system","manufacturer","target","apiTarget","input","IsCatendaEnabled_Global","autoinject","I18N","BimClient","bimViewerBaseUrl","AWJClient","AWJ_BaseUrl"],"sourceRoot":""}