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GjD,OAAO,C,CAIV,OAAO,CACR,CAEQ,4BAAOf,CAAsBrB,EAA8BmB,EAA+ClB,GACjH,OAA4E,GAAxEH,EAAmBmB,aAAajB,EAAYmB,IACzClB,EAAiBI,SAAW,IAAYwB,QAChD,CAEA,4BAAON,CAAsBvB,EAA+BmB,EAA+CjB,GAC1G,OAA4E,GAAxEJ,EAAmBmB,aAAajB,EAAYmB,IACzCjB,EAAaE,SAAW,IAAQkC,QACxC,CAEQ,6BAAOb,CAAuBzB,EAA8BmB,EAA+CjB,GAClH,OAA4E,GAAxEJ,EAAmBmB,aAAajB,EAAYmB,IACzCjB,EAAaE,SAAW,IAAQsB,SACxC,E","sources":["webpack://client-app/./src/app/services/AWJClient.ts","webpack://client-app/./src/app/services/AoxRequestBuilder.ts","webpack://client-app/./src/app/services/AzFuncsClient.ts","webpack://client-app/./src/app/services/BimClient.ts","webpack://client-app/./src/app/services/RequestExecution.ts","webpack://client-app/./src/app/services/RequestErrorHandling.ts","webpack://client-app/./src/app/services/RequestMethod.ts","webpack://client-app/./src/app/services/ViewerThreeDServiceIF.ts","webpack://client-app/./src/app/services/access-level-service.ts"],"sourcesContent":["import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { ErrorService } from './error-service';\r\nimport { ModalService } from './modal-service';\r\nimport { I18N } from 'aurelia-i18n';\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 { ApiClient } from './api-client';\r\n\r\n\r\nexport class AWJClient extends ApiClient {\r\n\t// how do we configure in api?\r\n\tconstructor(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) {\r\n\t\tsuper(modal, errorService, events, i18n, projectTokenService, orgTokenService); //, appContext);\r\n\t}\r\n\r\n\tpublic 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\t\tthis.version = 'no-bim-client-version';\r\n\t\tthis.build = 'no-bim-client-build';\r\n\t}\r\n}\r\n","import { HttpClient, HttpResponseMessage, RequestBuilder } from \"aurelia-http-client\";\r\n\r\nexport class AoxRequestBuilder {\r\n\theaders: object = {};\r\n\tmethod: string = \"\";\r\n\tcontent?: any;\r\n\tnoGui: boolean = false;\r\n\r\n\t//private route: string = \"\";\r\n\tpublic route: string = \"\"; // let us inspect for error handling.\r\n\r\n\r\n\tconstructor(apiUrl: string) {\r\n\t\tthis.addRouteSection(apiUrl);\r\n\t}\r\n\r\n\tpublic addRouteSection(section: string): void {\r\n\t\tthis.route += section;\r\n\t}\r\n\tasync sendXhrCall(responseType?: string): Promise {\r\n\t\tlet client = new HttpClient();\r\n\t\tlet builder: RequestBuilder = client.createRequest(this.route);\r\n\r\n\t\tif (this.method == 'GET') {\r\n\t\t\tbuilder = builder.asGet();\r\n\t\t} else if (this.method == 'POST') {\r\n\t\t\tbuilder = builder.asPost().withContent(this.content);\r\n\t\t}\r\n\r\n\t\tif (responseType) {\r\n\t\t\tbuilder = builder.withResponseType(responseType);\r\n\t\t}\r\n\r\n\t\tObject.keys(this.headers).forEach(x => builder = builder.withHeader(x, (this.headers)[x]));\r\n\t\treturn builder.send();\r\n\t}\r\n}\r\n","import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { ErrorService } from './error-service';\r\nimport { ModalService } from './modal-service';\r\nimport { I18N } from 'aurelia-i18n';\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 { ApiClient } from './api-client';\r\n\r\n\r\nexport class AzFuncsClient extends ApiClient {\r\n\tconstructor(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) {\r\n\t\tsuper(modal, errorService, events, i18n, projectTokenService, orgTokenService); //, appContext);\r\n\t}\r\n\r\n\tpublic 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\tlet AzFunc_BaseUrl = environment.azureFunctionsUrl;\r\n\t\tif (!AzFunc_BaseUrl) { throw 'environment.azureFunctionsUrl setting is missing.'; }\r\n\r\n\t\tthis.set_apiUrl(AzFunc_BaseUrl);\r\n\t\tconsole.log('AzF-Client', AzFunc_BaseUrl);\r\n\t\tthis.version = 'no-bim-client-version';\r\n\t\tthis.build = 'no-bim-client-build';\r\n\t}\r\n}\r\n","import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { ErrorService } from './error-service';\r\nimport { ModalService } from './modal-service';\r\nimport { I18N } from 'aurelia-i18n';\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 { ApiClient } from './api-client';\r\n\r\n\r\nexport class BimClient extends ApiClient {\r\n\tconstructor(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) {\r\n\t\tsuper(modal, errorService, events, i18n, projectTokenService, orgTokenService); //, appContext);\r\n\t}\r\n\r\n\tpublic 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\t\tthis.version = 'no-bim-client-version';\r\n\t\tthis.build = 'no-bim-client-build';\r\n\t}\r\n}\r\n","import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { HttpResponseMessage } from \"aurelia-http-client\";\r\nimport * as downloadjs from \"downloadjs\";\r\nimport { AoxRequestBuilder } from './AoxRequestBuilder';\r\n\r\n\r\nexport class RequestExecution {\r\n\tprotected errorHandler: Function = async() => { console.warn('empty-errorHandler'); }; // 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\tconstructor(protected request: AoxRequestBuilder, protected events: EventAggregator) { }\r\n\r\n\tpublic async noResponse(): Promise {\r\n\t\tthis.events.publish('is-loading', true);\r\n\t\treturn await this.request.sendXhrCall() // noResponse\r\n\t\t\t.catch(async (reason) => this.errorHandler(reason))//noResponse\r\n\t\t\t.finally(() => {\r\n\t\t\t\tthis.events.publish('is-loading', false);\r\n\t\t\t});\r\n\t}\r\n\r\n\t// JG: This was broken - it's not fetch Response, it's HttpResponseMessage!\r\n\tpublic async response(): Promise {\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);//response\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\t}\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\tpublic async responseNoLoadingIcon(): Promise {\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);//responseNoLoadingIcon\r\n\t\t\treturn really;\r\n\t\t}\r\n\t}\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));//downloadFile\r\n\t}\r\n\r\n\tpublic 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);//objectResult\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);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic async jsonResult(lookBusy: boolean = true): Promise {\r\n\t\tif (lookBusy) { this.events.publish('is-loading', true); }\r\n \r\n\t\treturn await this.request.sendXhrCall() // jsonResult\r\n\t\t\t.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\r\n\t\t\t\t// This is CRAP - we don't get any error indication back??\r\n\t\t\t\tlet dlgPromise:Promise = this.errorHandler(reason);//jsonResult\r\n\t\t\t\tconsole.log('jsonResult,dlg:', dlgPromise);\r\n\r\n\t\t\t\tlet done = await dlgPromise; // Note below.\r\n\t\t\t\tconsole.log('jsonResult,done:', done); // this became UNDEFINED - why?\r\n\t\t\t\t// but still, we are not returning anything to anyone, and not throwing any exception or other indication that the operation failed, WTF.\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\t}\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\t\treturn await this.request.sendXhrCall() // in jsonResultNoLoadingIcon. \r\n\t\t\t.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);//jsonResultNoLoadingIcon\r\n\t\t\t\tlet done = await dlg; // Note below. // what note??\r\n\t\t\t});\r\n\t}\r\n\r\n\tpublic 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);//stringResult\r\n\t\t\tconsole.log('Done awaiting error handler..', myAny);\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\t}\r\n\r\n}\r\n","import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { ErrorService } from './error-service';\r\nimport { ModalService } from './modal-service';\r\nimport { HttpResponseMessage, RequestMessage } from \"aurelia-http-client\";\r\nimport { I18N } from 'aurelia-i18n';\r\nimport { ModalMessage } from 'app/components/dialog/modal-message';\r\nimport { DialogCancellableOpenResult, DialogCloseResult, DialogOpenPromise } from 'aurelia-dialog';\r\nimport { AoxRequestBuilder } from './AoxRequestBuilder';\r\nimport { RequestExecution } from './RequestExecution';\r\n\r\n\r\nexport class RequestErrorHandling extends RequestExecution {\r\n\r\n\tasync error403(): Promise {\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\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) {\r\n\t\treturn this.modal.OpenMessage('Conflict', reason.response, true);\r\n\t}\r\n\t/* Consider the remaining errors may require the same.\r\n\tHOWEVER, 401 is special, because it suggests me might need a reset/fresh-login. 403,404,409 etc does NOT necessarily require the same.\r\n\t*/ \r\n\tasync error401(responseMsg: HttpResponseMessage): Promise {\r\n\t\t// We must make sure an exception is propagated, if the user clicked 'Reset'(to log in again.)\r\n\t\tconsole.trace('inside 401', responseMsg.response); //, responseMsg); //response: \"invalid_tokenThe token expired at '05/24/2024 09:32:45'\"\r\n\t\tconst content:string = responseMsg.response;\r\n\t\tconst loginExpired = content.includes('Expired');\t\r\n\r\n\t\tlet dlg0:DialogOpenPromise = this.modal.OpenMessage('Unauthorized', \r\n\t\tloginExpired\r\n\t\t? \"User session appears to have expired. \\n You must log in again. \\n Click 'Reset' to do so.\"\r\n\t\t: `An unauthorized action was invoked.\\n\\n${responseMsg.requestMessage.url}`,\r\n\t\t\ttrue // ie showReset.\r\n\t\t);\r\n\r\n\t\tdlg0.whenClosed(x => this.events.publish(\"user unauthorized\"));\r\n\t\tlet dlg:DialogCancellableOpenResult = await dlg0;\r\n\t\tawait this.throwIfResetWasPressed(dlg);\r\n\t\treturn dlg;\r\n\t}\r\n\r\n\tconstructor(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):Promise => {//constructor\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(reason);\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\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\tconst reqMsg:RequestMessage = reason.requestMessage;\r\n\t\t\t\tconst url_ = reqMsg.url;\r\n\t\t\t\tthis.alsoLogResponseWITH_gui(reason);\r\n\t\t\t\tconst dialogCancellableOpenResult:DialogCancellableOpenResult = await this.modal.OpenMessage('An error occurred:' + url_, `${reason}`, true);\r\n\t\t\t\tawait this.throwIfResetWasPressed(dialogCancellableOpenResult);\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\r\n\thandleErrorWithErrorService(errorHandler2: (service: ErrorService, reason: any) => Promise): RequestExecution {\r\n\t\tthis.errorHandler = async(reason: any) => await errorHandler2(this.errorService, reason);//handleErrorWithErrorService\r\n\t\treturn this;\r\n\t}\r\n\r\n\thandleError(title: string, message: string): RequestExecution {\r\n\t\t//console.trace('who called handleError?');\r\n\t\tthis.errorHandler = async(reason: any) => {//handleError\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 dialogCancellableOpenResult:DialogCancellableOpenResult = await dlgPromise;\r\n\t\t\tawait this.throwIfResetWasPressed(dialogCancellableOpenResult);\r\n\t\t\t//const dlgCloseResult = await dlgPromise.whenClosed();\r\n\t\t\t//const output = dlgCloseResult.output;\r\n\t\t\t//console.log('dlgCloseResult:', dlgCloseResult);\r\n\t\t\treturn null; //undefined; //reason;\r\n\t\t\t// ( - we don't really know what people expect to get returned from errorHandler.)\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 = async(reason: any) => {//handleErrorUsingReason\r\n\t\t\tconsole.trace('HRUR');\r\n\t\t\tconsole.log('HRUR', reason, reason.response);\r\n\t\t\tawait this.throwIfResetWasPressed(await this.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 = async(reason: any) => {//handleErrorMsgUsingReason\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\tawait this.throwIfResetWasPressed(await this.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\tasync throwIfResetWasPressed(r: DialogCancellableOpenResult):Promise {\r\n\t\t/* The original exception, by this point,\r\n\t\thas become an ordinary 'returned result' from a shown dialog \r\n\t\t- that is, it is not an exception anymore.\r\n\t\tSo we will have to rethrow an exception, to 'make it feel like an exception again'\r\n\t\t(to those guys who ended up in a UI error handler messagebox,\r\n\t\twhen the backend async method they tried to call, failed on them).\r\n\t\t */\r\n\t\tif (r.wasCancelled) { return; }\r\n\r\n\t\tconst dcr:DialogCloseResult = await r.closeResult;\r\n\t\tif (!dcr) { console.error('missing dcr?', dcr); return; }\r\n\r\n\t\tconst data = dcr.output;\r\n\t\tif (!data) { console.error('missing DialogCloseResult.output?', data); return; } // only positive presence of data.errorReset causes us to act/throw exception.\r\n\r\n\t\tif (data.errorReset) {// den her blev sur - 'data is undefined'.\t\t\t\r\n\t\t\tconsole.warn('RequestErrorHandling.act, errorReset:', data.errorReset);\r\n\t\t\t// we do this, to stop aurelia from continuing to build the view:\r\n\t\t\tthrow data.errorReset; // JG: If we didn't log these decisions, it would be hard to figure out how we ended up where we do.\r\n\t\t} else {\r\n\t\t\tconsole.log('(no errorReset in act)');\r\n\t\t}\r\n\t}\r\n\r\n}\r\n","import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { ErrorService } from './error-service';\r\nimport { ModalService } from './modal-service';\r\nimport { json } from \"aurelia-fetch-client\";\r\nimport { I18N } from 'aurelia-i18n';\r\nimport { AoxRequestBuilder } from './AoxRequestBuilder';\r\nimport { RequestErrorHandling } from './RequestErrorHandling';\r\n\r\n\r\nexport class RequestMethod {\r\n\tconstructor(\r\n\t\tpublic request: AoxRequestBuilder, // egentlig config..\r\n\t\tprivate events: EventAggregator,\r\n\t\tprivate modal: ModalService,\r\n\t\tprivate errorService: ErrorService,\r\n\t\tprivate i18n: I18N) {\r\n\t}\r\n\r\n\tpublic get(action: string, noGui: boolean = false): RequestErrorHandling {\r\n\t\tthis.request.method = 'GET';\r\n\t\tthis.request.noGui = noGui;\r\n\t\tthis.request.addRouteSection(action);\r\n\t\treturn this.next();\r\n\t}\r\n\tpublic postJson(action: string, content: any): RequestErrorHandling {\r\n\t\t(this.request.headers)[\"Content-Type\"] = \"application/json\";\r\n\t\tthis.request.method = 'POST';\r\n\t\tthis.request.content = json(content);\r\n\t\tthis.request.addRouteSection(action);\r\n\t\treturn this.next();\r\n\t}\r\n\tpublic postText(action: string, content: string): RequestErrorHandling {\r\n\t\tthis.request.method = 'POST';\r\n\t\tthis.request.content = content;\r\n\t\tthis.request.addRouteSection(action);\r\n\t\treturn this.next();\r\n\t}\r\n\tpublic postForm(action: string, content: FormData): RequestErrorHandling {\r\n\t\t//this.request.headers[\"Content-Type\"] = contentType;\r\n\t\tthis.request.method = 'POST';\r\n\t\tthis.request.content = content;\r\n\t\tthis.request.addRouteSection(action);\r\n\t\treturn this.next();\r\n\t}\r\n\tprivate next(): RequestErrorHandling {\r\n\t\treturn new RequestErrorHandling(this.request, this.events, this.modal, this.errorService, this.i18n);\r\n\t}\r\n}\r\n","import {ObjectIDsIF} from \"../project/ifc-fun/openbim-container\";\r\n\r\nexport interface ViewerThreeDServiceIF {\r\n\tchangeSelectedTool(tool: ToolEnum): Promise;\r\n\thideAllObjects(): Promise;\r\n\ttransluteAllObjects(): Promise;\r\n\tshowAllObjects(): Promise;\r\n\thandleSpaces(shouldShowSpaces: boolean): Promise;\r\n\r\n\ttransluteOthers(selectedObjectIds: ObjectIDsIF): Promise\r\n\thideOthers(objectIds: ObjectIDsIF): Promise;\r\n\tlookAtObjects(objectIds: ObjectIDsIF): Promise;\r\n\tselectObjects(objectIds: ObjectIDsIF): Promise;\r\n\ttransluteObjects(objectIds: ObjectIDsIF): Promise;\r\n\tshowObjects(objectIds: ObjectIDsIF): Promise;\r\n\thideObjects(objectIds: ObjectIDsIF): Promise;\r\n}\r\n\r\nexport enum ToolEnum {\r\n\tObjectSelection,\r\n\tLengthMeasure,\r\n\tAreaMeasure,\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, show:boolean): boolean {\r\n\t\tif (projectTokenInfo.orgRole < 0) {\r\n\t\t\tconsole.warn(`hasAccess sees a bad projectTokenInfo, role is:${projectTokenInfo.prjRole}`);\r\n\t\t}\r\n let access:boolean=false;\r\n switch (route?.menuAccessLevel) {\r\n\t\t\tcase MenuAccessLevel.PrjUser: access = this.hasPrjUserAccess(projectTokenInfo); break;\r\n\t\t\tcase MenuAccessLevel.PrjSettings: access = this.hasPrjSettingAccess(projectTokenInfo); break;\r\n\t\t\tcase MenuAccessLevel.PrjAdmin: access = this.hasPrjAdminAccess(projectTokenInfo); break;\r\n\t\t\tcase MenuAccessLevel.OrgAdmin: access = this.hasOrgAdminAccess(orgTokenInfo); break;\r\n\t\t\tcase MenuAccessLevel.AOCRoles: access = this.hasAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed); break;\r\n\t\t\tcase MenuAccessLevel.AOCRolesOrPrjUser: access = this.hasPrjUserOrAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed, projectTokenInfo); break;\r\n\t\t\tcase MenuAccessLevel.AOCRolesOrOrgUser: access = this.hasOrgUserOrAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed, orgTokenInfo); break;\r\n\t\t\tcase MenuAccessLevel.AOCRolesOrOrgAdmin: access = this.hasOrgAdminOrAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed,orgTokenInfo); break;\r\n\r\n default:\r\n\t\t\t\t// JG: these should really be investigated:\r\n //console.warn('ALS.hasAccess did not find a menuAccessLevel for', route);\r\n if (show) { \r\n\t\t\t\t\t//console.warn('B hasAccess, menuAccessLevel?', route?.menuAccessLevel, 'route:', route); \r\n\t\t\t\t}\r\n return false;\r\n \r\n\t\t}\r\n\r\n // right now we are mostly interested if it FAILS.\r\n\t\tif (show && !access) { \r\n\t\t\t//console.warn('A hasAccess, menuAccessLevel?', route?.menuAccessLevel, 'route:', route,'prjToken:', projectTokenInfo); \r\n\t\t}\r\n return access;\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}\r\n"],"names":["AWJClient","constructor","modal","errorService","events","i18n","projectTokenService","orgTokenService","super","initialize","AWJ_BaseUrl","this","set_apiUrl","console","log","version","build","AoxRequestBuilder","apiUrl","headers","method","noGui","route","addRouteSection","section","sendXhrCall","responseType","builder","createRequest","asGet","asPost","withContent","content","withResponseType","Object","keys","forEach","x","withHeader","send","AzFuncsClient","AzFunc_BaseUrl","BimClient","bimViewerBaseUrl","RequestExecution","request","errorHandler","async","warn","noResponse","publish","catch","reason","finally","response","really","responseNoLoadingIcon","downloadFile","fileName","then","download","objectResult","typeInstance","Boolean","assign","trace","jsonResult","lookBusy","dlgPromise","done","jsonResultNoLoadingIcon","dlg","stringResult","myAny","RequestErrorHandling","error403","OpenMessage","whenClosed","error404","error409","error401","responseMsg","loginExpired","includes","dlg0","requestMessage","url","throwIfResetWasPressed","statusCode","logErrorInstead","url_","alsoLogResponseWITH_gui","dialogCancellableOpenResult","message","extra","hasOwnProperty","messageUrl","ArrayBuffer","ab","str","TextDecoder","decode","handleErrorWithErrorService","errorHandler2","handleError","title","logResponse","OpenModal","tr","showReset","rspMsg","handleErrorUsingReason","handleErrorMsgUsingReason","newLine","repeat","r","wasCancelled","dcr","closeResult","error","data","output","errorReset","RequestMethod","get","action","next","postJson","postText","postForm","ToolEnum","AccessLevelService","hasAccess","appContext","projectTokenInfo","orgTokenInfo","show","orgRole","prjRole","access","menuAccessLevel","PrjUser","hasPrjUserAccess","PrjSettings","hasPrjSettingAccess","PrjAdmin","hasPrjAdminAccess","OrgAdmin","hasOrgAdminAccess","AOCRoles","hasAOCAccess","settings","sectionUserRolesAllowed","AOCRolesOrPrjUser","hasPrjUserOrAOCAccess","AOCRolesOrOrgUser","hasOrgUserOrAOCAccess","AOCRolesOrOrgAdmin","hasOrgAdminOrAOCAccess","Org_Admin","Prj_Admin","Prj_Setting_User","Prj_User","routeRolesAllowed","undefined","i","length","routeElement","currentUser","j","roles","Org_User"],"sourceRoot":""}