This repository has been archived by the owner on Dec 18, 2024. It is now read-only.
generated from MeasureAuthoringTool/madie-frontend-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into MAT-6475
- Loading branch information
Showing
25 changed files
with
1,921 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm exec pretty-quick --staged && npm exec concurrently npm:test npm:lint | ||
npm exec pretty-quick --staged && npm exec concurrently "npm:lint" "npm:test -- --silent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import axios from "axios"; | ||
import useServiceConfig from "./useServiceConfig"; | ||
import { ServiceConfig } from "./ServiceContext"; | ||
import { useOktaTokens } from "@madie/madie-util"; | ||
import { CqlDefinitionExpression } from "../util/GroupCoverageHelpers"; | ||
import { CqlDefinitionCallstack } from "../components/editTestCase/groupCoverage/QiCoreGroupCoverage"; | ||
|
||
export class CqlParsingService { | ||
constructor(private baseUrl: string, private getAccessToken: () => string) {} | ||
|
||
async getDefinitionCallstacks(cql: string): Promise<CqlDefinitionCallstack> { | ||
try { | ||
const response = await axios.put<string>( | ||
`${this.baseUrl}/cql/callstacks`, | ||
cql, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${this.getAccessToken()}`, | ||
"Content-Type": "text/plain", | ||
}, | ||
} | ||
); | ||
return response.data as unknown as CqlDefinitionCallstack; | ||
} catch (err) { | ||
const message = `Unable to retrieve used definition references`; | ||
throw new Error(message); | ||
} | ||
} | ||
|
||
async getAllDefinitionsAndFunctions( | ||
cql: string | ||
): Promise<CqlDefinitionExpression[]> { | ||
try { | ||
const response = await axios.put<string>( | ||
`${this.baseUrl}/cql/definitions`, | ||
cql, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${this.getAccessToken()}`, | ||
"Content-Type": "text/plain", | ||
}, | ||
} | ||
); | ||
return response.data as unknown as CqlDefinitionExpression[]; | ||
} catch (err) { | ||
const message = `Unable to retrieve definition and function references`; | ||
throw new Error(message); | ||
} | ||
} | ||
} | ||
|
||
const useCqlParsingService = (): CqlParsingService => { | ||
const serviceConfig: ServiceConfig = useServiceConfig(); | ||
const { getAccessToken } = useOktaTokens(); | ||
return new CqlParsingService( | ||
serviceConfig?.elmTranslationService.baseUrl, | ||
getAccessToken | ||
); | ||
}; | ||
|
||
export default useCqlParsingService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.