@finos/legend-graph
Version:
Legend graph and graph manager
121 lines • 5.39 kB
JavaScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import axios, { AxiosError } from 'axios';
import { ContentType, HttpHeader, } from '@finos/legend-shared';
import { V1_ExecuteInput } from '../protocol/pure/v1/engine/execution/V1_ExecuteInput.js';
import { V1_ArtifactGenerationExtensionInput, } from '../protocol/pure/v1/engine/generation/V1_ArtifactGenerationExtensionApi.js';
export const ENGINE_TEST_SUPPORT_API_URL = 'http://localhost:6300/api';
export { AxiosError as ENGINE_TEST_SUPPORT__NetworkClientError };
export async function ENGINE_TEST_SUPPORT__getClassifierPathMapping() {
return (await axios.get(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/protocol/pure/getClassifierPathMap`)).data;
}
export async function ENGINE_TEST_SUPPORT__getSubtypeInfo() {
return (await axios.get(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/protocol/pure/getSubtypeInfo`)).data;
}
export async function ENGINE_TEST_SUPPORT__execute(executionInput) {
return (await axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/execution/execute`, V1_ExecuteInput.serialization.toJson(executionInput), {
headers: {
[HttpHeader.CONTENT_TYPE]: ContentType.APPLICATION_JSON,
},
})).data;
}
export async function ENGINE_TEST_SUPPORT__grammarToJSON_model(code, returnSourceInformation) {
return (await axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/grammar/grammarToJson/model`, code, {
headers: {
[HttpHeader.CONTENT_TYPE]: ContentType.TEXT_PLAIN,
},
params: {
returnSourceInformation,
},
})).data;
}
export async function ENGINE_TEST_SUPPORT__grammarToJSON_lambda(code, returnSourceInformation) {
return (await axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/grammar/grammarToJson/lambda`, code, {
headers: {
[HttpHeader.CONTENT_TYPE]: ContentType.TEXT_PLAIN,
},
params: {
returnSourceInformation,
},
})).data;
}
export async function ENGINE_TEST_SUPPORT__grammarToJSON_valueSpecification(code, returnSourceInformation) {
return (await axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/grammar/grammarToJson/valueSpecification`, code, {
headers: {
[HttpHeader.CONTENT_TYPE]: ContentType.TEXT_PLAIN,
},
params: {
returnSourceInformation,
},
})).data;
}
export async function ENGINE_TEST_SUPPORT__JSONToGrammar_model(model, pretty) {
return (await axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/grammar/jsonToGrammar/model`, model, {
headers: {
[HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN,
},
params: {
renderStyle: pretty ? 'PRETTY' : 'STANDARD',
},
})).data;
}
export async function ENGINE_TEST_SUPPORT__JSONToGrammar_valueSpecification(value, pretty) {
return (await axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/grammar/jsonToGrammar/valueSpecification`, value, {
headers: {
[HttpHeader.CONTENT_TYPE]: ContentType.APPLICATION_JSON,
[HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN,
},
params: {
renderStyle: pretty ? 'PRETTY' : 'STANDARD',
},
})).data;
}
export async function ENGINE_TEST_SUPPORT__JSONToGrammar_lambda(value, pretty) {
return (await axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/grammar/jsonToGrammar/lambda`, value, {
headers: {
[HttpHeader.CONTENT_TYPE]: ContentType.APPLICATION_JSON,
[HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN,
},
params: {
renderStyle: pretty ? 'PRETTY' : 'STANDARD',
},
})).data;
}
export async function ENGINE_TEST_SUPPORT__compile(model) {
return axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/compilation/compile`, model);
}
export async function ENGINE_TEST_SUPPORT__getLambdaReturnType(lambda, model) {
return (await axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/compilation/lambdaReturnType`, {
lambda,
model,
})).data;
}
export async function ENGINE_TEST_SUPPORT__getLambdaRelationType(lambda, model) {
return (await axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/compilation/lambdaRelationType`, {
lambda,
model,
})).data;
}
export async function ENGINE_TEST_SUPPORT__transformTdsToRelation_lambda(lambda, model) {
return (await axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/compilation/autofix/transformTdsToRelation/lambda`, {
lambda,
model,
})).data;
}
export async function ENGINE_TEST_SUPPORT__generateArtifacts(input) {
return (await axios.post(`${ENGINE_TEST_SUPPORT_API_URL}/pure/v1/generation/generateArtifacts`, V1_ArtifactGenerationExtensionInput.serialization.toJson(input))).data;
}
//# sourceMappingURL=EngineTestSupport.js.map