UNPKG

@finos/legend-graph

Version:
310 lines 28 kB
/** * 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 { ContentType, AbstractServerClient, HttpHeader, NetworkClient, } from '@finos/legend-shared'; import { EXECUTION_SERIALIZATION_FORMAT } from '../../../../../graph-manager/action/execution/ExecutionResult.js'; import { ServiceExecutionMode } from '../../../../action/service/ServiceExecutionMode.js'; import {} from './pureProtocol/V1_LambdaTdsToRelationInput.js'; var CORE_ENGINE_ACTIVITY_TRACE; (function (CORE_ENGINE_ACTIVITY_TRACE) { CORE_ENGINE_ACTIVITY_TRACE["GRAMMAR_TO_JSON"] = "transform Pure code to protocol"; CORE_ENGINE_ACTIVITY_TRACE["JSON_TO_GRAMMAR"] = "transform protocol to Pure code"; CORE_ENGINE_ACTIVITY_TRACE["AUTOFIX_TDS_TO_RELATION"] = "transform TDS protocol to relation protocol"; CORE_ENGINE_ACTIVITY_TRACE["DATABASE_TO_MODELS"] = "generate models from database"; CORE_ENGINE_ACTIVITY_TRACE["TEST_DATA_GENERATION"] = "generate test data"; CORE_ENGINE_ACTIVITY_TRACE["EXTERNAL_FORMAT_TO_PROTOCOL"] = "transform external format code to protocol"; CORE_ENGINE_ACTIVITY_TRACE["GENERATE_FILE"] = "generate file"; CORE_ENGINE_ACTIVITY_TRACE["COMPILE"] = "compile"; CORE_ENGINE_ACTIVITY_TRACE["COMPILE_GRAMMAR"] = "compile grammar"; CORE_ENGINE_ACTIVITY_TRACE["GET_LAMBDA_RETURN_TYPE"] = "get lambda return type"; CORE_ENGINE_ACTIVITY_TRACE["EXECUTE"] = "execute"; CORE_ENGINE_ACTIVITY_TRACE["GENERATE_EXECUTION_PLAN"] = "generate execution plan"; CORE_ENGINE_ACTIVITY_TRACE["GENERATE_ARTIFACTS"] = "generate artifacts"; CORE_ENGINE_ACTIVITY_TRACE["REGISTER_SERVICE"] = "register service"; CORE_ENGINE_ACTIVITY_TRACE["GET_SERVICE_VERSION"] = "get service version"; CORE_ENGINE_ACTIVITY_TRACE["ACTIVATE_SERVICE_GENERATION_ID"] = "activate service generation id"; CORE_ENGINE_ACTIVITY_TRACE["VALIDATE_SERVICE_ASSERTION_ID"] = "validate service assertion id"; CORE_ENGINE_ACTIVITY_TRACE["RUN_SERVICE_TESTS"] = "run service tests"; CORE_ENGINE_ACTIVITY_TRACE["GENERATE_TEST_DATA_WITH_DEFAULT_SEED"] = "generate test data with default seed"; CORE_ENGINE_ACTIVITY_TRACE["GENERATE_TEST_DATA_WITH_SEED"] = "generate test data with seed"; CORE_ENGINE_ACTIVITY_TRACE["RUN_TESTS"] = "run tests"; CORE_ENGINE_ACTIVITY_TRACE["CREATE_QUERY"] = "create query"; CORE_ENGINE_ACTIVITY_TRACE["UPDATE_QUERY"] = "update query"; CORE_ENGINE_ACTIVITY_TRACE["PATCH_QUERY"] = "patch query"; CORE_ENGINE_ACTIVITY_TRACE["DELETE_QUERY"] = "delete query"; CORE_ENGINE_ACTIVITY_TRACE["CREATE_DATA_CUBE"] = "create DataCube"; CORE_ENGINE_ACTIVITY_TRACE["UPDATE_DATA_CUBE"] = "update DataCube"; CORE_ENGINE_ACTIVITY_TRACE["DELETE_DATA_CUBE"] = "delete DataCube"; CORE_ENGINE_ACTIVITY_TRACE["CANCEL_USER_EXECUTIONS"] = "cancel user executions"; CORE_ENGINE_ACTIVITY_TRACE["MAPPING_MODEL_COVERAGE_ANALYTICS"] = "mapping model coverage analytics"; CORE_ENGINE_ACTIVITY_TRACE["SURVEY_DATASET_ANALYTICS"] = "survey dataset analytics"; CORE_ENGINE_ACTIVITY_TRACE["STORE_ENTITLEMENT_ANALYTICS"] = "store entitlement analytics"; CORE_ENGINE_ACTIVITY_TRACE["DATABASE_SCHEMA_EXPLORATION"] = "database schema exploration"; CORE_ENGINE_ACTIVITY_TRACE["DATABASE_RAW_SQL_EXECUTION"] = "database raw SQL execution"; CORE_ENGINE_ACTIVITY_TRACE["VALIDATE_FUNCTION_ACTIVATOR"] = "validate function activator"; CORE_ENGINE_ACTIVITY_TRACE["PUBLISH_FUNCTION_ACTIVATOR_TO_SANDBOX"] = "publish function activator to sandbox"; })(CORE_ENGINE_ACTIVITY_TRACE || (CORE_ENGINE_ACTIVITY_TRACE = {})); var ENGINE_EXECUTION_SERIALIZATION_FORMAT; (function (ENGINE_EXECUTION_SERIALIZATION_FORMAT) { ENGINE_EXECUTION_SERIALIZATION_FORMAT["CSV_TRANSFORMED"] = "csv_transformed"; })(ENGINE_EXECUTION_SERIALIZATION_FORMAT || (ENGINE_EXECUTION_SERIALIZATION_FORMAT = {})); export const V1_getEngineSerializationFormat = (val) => { switch (val) { // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition case EXECUTION_SERIALIZATION_FORMAT.CSV: return ENGINE_EXECUTION_SERIALIZATION_FORMAT.CSV_TRANSFORMED; default: return val; } }; // eslint-disable-next-line @finos/legend/enforce-protocol-export-prefix export async function getCurrentUserIDFromEngineServer(engineServerUrl) { return new NetworkClient().get(`${engineServerUrl}/server/v1/currentUser`); } export class V1_EngineServerClient extends AbstractServerClient { currentUserId; env; // NOTE: this is an attempt to follow engine's effort to be split into multiple pieces // for better operational performance overall. // e.g. we dedicate some servers for query, some for services, etc. // // if we do it like this, there might be some complications about the getting the current // user, right now we assume to make some call on the query servers, for example, but // getting the user from the main engine server, which seems problematic. queryBaseUrl; baseUrlForServiceRegistration; constructor(config) { super(config); this.queryBaseUrl = config.queryBaseUrl; } setBaseUrlForServiceRegistration(val) { this.baseUrlForServiceRegistration = val; } setEnv = (value) => { this.env = value; }; setCurrentUserId = (value) => { this.currentUserId = value; }; getTraceData = (name, tracingTags) => ({ name, tags: { env: this.env ?? '(unknown)', userId: this.currentUserId ?? '(unknown)', ...tracingTags, }, }); _pure = () => `${this.baseUrl}/pure/v1`; _sdlc = () => `${this.baseUrl}/sdlc/v1`; // ------------------------------------------- Server ------------------------------------------- _server = () => `${this.baseUrl}/server/v1`; getCurrentUserId = () => this.get(`${this._server()}/currentUser`); // ------------------------------------------- Server ------------------------------------------- _lambda = () => `${this.baseUrl}/lambda/v1`; getLambdaPrefixes = () => this.get(`${this._lambda()}/lambdaPrefixes`); // ------------------------------------------- Protocol ------------------------------------------- getClassifierPathMap = () => this.get(`${this._pure()}/protocol/pure/getClassifierPathMap`); getSubtypeInfo = () => this.get(`${this._pure()}/protocol/pure/getSubtypeInfo`); transformTdsToRelation_lambda = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.AUTOFIX_TDS_TO_RELATION), `${this._pure()}/compilation/autofix/transformTdsToRelation/lambda`, input, {}, { [HttpHeader.ACCEPT]: ContentType.APPLICATION_JSON, [HttpHeader.CONTENT_TYPE]: ContentType.APPLICATION_JSON, }, { enableCompression: true }); // ------------------------------------------- SDLC ------------------------------------------- createPrototypeProject = () => this.post(`${this._sdlc()}/createPrototypeProject`, undefined, {}, { [HttpHeader.CONTENT_TYPE]: ContentType.TEXT_PLAIN, }); validUserAccessRole = (userId) => this.get(`${this._sdlc()}/userHasPrototypeProjectAccess/${userId}`, undefined, { [HttpHeader.CONTENT_TYPE]: ContentType.TEXT_PLAIN, }); // ------------------------------------------- Grammar ------------------------------------------- _grammarToJSON = () => `${this._pure()}/grammar/grammarToJson`; grammarToJSON_model = (input, sourceId, lineOffset, returnSourceInformation) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GRAMMAR_TO_JSON), `${this._grammarToJSON()}/model`, input, {}, { [HttpHeader.CONTENT_TYPE]: ContentType.TEXT_PLAIN, }, { sourceId, lineOffset, returnSourceInformation, }, { enableCompression: true }); grammarToJSON_lambda = (input, sourceId, lineOffset, columnOffset, returnSourceInformation) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GRAMMAR_TO_JSON), `${this._grammarToJSON()}/lambda`, input, {}, { [HttpHeader.CONTENT_TYPE]: ContentType.TEXT_PLAIN, }, { sourceId, lineOffset, columnOffset, returnSourceInformation, }, { enableCompression: true }); grammarToJSON_lambda_batch = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GRAMMAR_TO_JSON), `${this._grammarToJSON()}/lambda/batch`, input, {}, undefined, undefined, { enableCompression: true }); grammarToJSON_valueSpecification_batch = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GRAMMAR_TO_JSON), `${this._grammarToJSON()}/valueSpecification/batch`, input, {}, undefined, undefined, { enableCompression: true }); grammarToJSON_valueSpecification = (input, sourceId, lineOffset, columnOffset, returnSourceInformation) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GRAMMAR_TO_JSON), `${this._grammarToJSON()}/valueSpecification`, input, {}, { [HttpHeader.CONTENT_TYPE]: ContentType.TEXT_PLAIN, }, { sourceId, lineOffset, columnOffset, returnSourceInformation, }, { enableCompression: true }); grammarToJSON_relationalOperationElement = (input, sourceId, lineOffset, columnOffset, returnSourceInformation) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GRAMMAR_TO_JSON), `${this._grammarToJSON()}/relationalOperationElement`, input, {}, { [HttpHeader.CONTENT_TYPE]: ContentType.TEXT_PLAIN, }, { sourceId, lineOffset, columnOffset, returnSourceInformation, }, { enableCompression: true }); grammarToJSON_relationalOperationElement_batch = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GRAMMAR_TO_JSON), `${this._grammarToJSON()}/relationalOperationElement/batch`, input, {}, undefined, undefined, { enableCompression: true }); _JSONToGrammar = () => `${this._pure()}/grammar/jsonToGrammar`; JSONToGrammar_model = (input, renderStyle) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.JSON_TO_GRAMMAR), `${this._JSONToGrammar()}/model`, input, {}, { [HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN }, { renderStyle }, { enableCompression: true }); JSONToGrammar_lambda = (input, renderStyle) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.JSON_TO_GRAMMAR), `${this._JSONToGrammar()}/lambda`, input, {}, { [HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN }, { renderStyle }, { enableCompression: true }); JSONToGrammar_lambda_batch = (input, renderStyle) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.JSON_TO_GRAMMAR), `${this._JSONToGrammar()}/lambda/batch`, input, {}, undefined, { renderStyle }, { enableCompression: true }); JSONToGrammar_valueSpecification_batch = (input, renderStyle) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.JSON_TO_GRAMMAR), `${this._JSONToGrammar()}/valueSpecification/batch`, input, {}, undefined, { renderStyle }, { enableCompression: true }); JSONToGrammar_valueSpecification = (input, renderStyle) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.JSON_TO_GRAMMAR), `${this._JSONToGrammar()}/valueSpecification`, input, {}, { [HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN }, { renderStyle }, { enableCompression: false }); JSONToGrammar_relationalOperationElement = (input, renderStyle) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.JSON_TO_GRAMMAR), `${this._JSONToGrammar()}/relationalOperationElement`, input, {}, { [HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN }, { renderStyle }, { enableCompression: true }); JSONToGrammar_relationalOperationElement_batch = (input, renderStyle) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.JSON_TO_GRAMMAR), `${this._JSONToGrammar()}/relationalOperationElement/batch`, input, {}, undefined, { renderStyle }, { enableCompression: true }); // ------------------------------------------- Test --------------------------------------- runTests = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.RUN_TESTS), `${this._pure()}/testable/runTests`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.RUN_TESTS), {}, undefined, undefined, { enableCompression: true }); debugTests = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.RUN_TESTS), `${this._pure()}/testable/debugTests`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.RUN_TESTS), {}, undefined, undefined, { enableCompression: true }); // ------------------------------------------- External Format --------------------------------------- _externalFormats = () => `${this._pure()}/external/format`; getAvailableExternalFormatsDescriptions = () => this.get(`${this._externalFormats()}/availableFormats`); generateModel = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GENERATE_FILE), `${this._externalFormats()}/generateModel`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.GENERATE_FILE), {}, undefined, undefined, { enableCompression: true }); generateSchema = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GENERATE_FILE), `${this._externalFormats()}/generateSchema`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.GENERATE_FILE), {}, undefined, undefined, { enableCompression: true }); // ------------------------------------------- Code Import ------------------------------------------- getAvailableCodeImportDescriptions = () => this.get(`${this._pure()}/codeImport/availableImports`); // ------------------------------------------- Schema Import ------------------------------------------- getAvailableSchemaImportDescriptions = () => this.get(`${this._pure()}/schemaImport/availableImports`); // ------------------------------------------- Code Generation ------------------------------------------- getAvailableCodeGenerationDescriptions = () => this.get(`${this._pure()}/codeGeneration/availableGenerations`); generateFile = (mode, type, input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GENERATE_FILE), `${this._pure()}/${mode}/${type}`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.GENERATE_FILE), {}, undefined, undefined, { enableCompression: true }); generateAritfacts = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GENERATE_ARTIFACTS), `${this._pure()}/generation/generateArtifacts`, input, {}, undefined, undefined, { enableCompression: true }); // ------------------------------------------- Schema Generation ------------------------------------------- getAvailableSchemaGenerationDescriptions = () => this.get(`${this._pure()}/schemaGeneration/availableGenerations`); // --------------------------------------------- Test Data Generation --------------------------------------------- _testDataGeneration = () => `${this._pure()}/testData/generation`; generateTestData(input) { return this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.TEST_DATA_GENERATION), `${this._testDataGeneration()}/DONOTUSE_generateTestData`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.TEST_DATA_GENERATION)); } // ------------------------------------------- Compile ------------------------------------------- compile = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.COMPILE), `${this._pure()}/compilation/compile`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.COMPILE), {}, undefined, undefined, { enableCompression: true }); lambdaReturnType = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GET_LAMBDA_RETURN_TYPE), `${this._pure()}/compilation/lambdaReturnType`, input, {}, undefined, undefined, { enableCompression: true }); lambdaRelationType = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GET_LAMBDA_RETURN_TYPE), `${this._pure()}/compilation/lambdaRelationType`, input, {}, undefined, undefined, { enableCompression: true }); completeCode = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GET_LAMBDA_RETURN_TYPE), `${this._pure()}/codeCompletion/completeCode`, input, {}, undefined, undefined, { enableCompression: true }); // ------------------------------------------- Execute ------------------------------------------- _execution = () => `${this._pure()}/execution`; _executionManager = () => `${this._server()}/executionManager`; runQuery = (input, options) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.EXECUTE, options?.tracingTags), `${this._execution()}/execute`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.EXECUTE), { signal: options?.abortController?.signal ?? null, }, undefined, { serializationFormat: options?.serializationFormat ? V1_getEngineSerializationFormat(options.serializationFormat) : undefined, }, { enableCompression: true }, { skipProcessing: Boolean(options?.returnAsResponse) }); generatePlan = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GENERATE_EXECUTION_PLAN), `${this._execution()}/generatePlan`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.GENERATE_EXECUTION_PLAN), {}, undefined, undefined, { enableCompression: true }); debugPlanGeneration = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GENERATE_EXECUTION_PLAN), `${this._execution()}/generatePlan/debug`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.GENERATE_EXECUTION_PLAN), {}, undefined, undefined, { enableCompression: true }); generateTestDataWithDefaultSeed = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GENERATE_TEST_DATA_WITH_DEFAULT_SEED), `${this._execution()}/testDataGeneration/generateTestData_WithDefaultSeed`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.GENERATE_TEST_DATA_WITH_DEFAULT_SEED), {}, { [HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN }, undefined, { enableCompression: true }); generateTestDataWithSeed = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GENERATE_TEST_DATA_WITH_SEED), `${this._execution()}/testDataGeneration/generateTestData_WithSeed`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.GENERATE_TEST_DATA_WITH_SEED), {}, { [HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN }, undefined, { enableCompression: true }); /** * TODO: this is an internal API that should me refactored out using extension mechanism */ INTERNAL__cancelUserExecutions = (userID, broadcastToCluster) => this.deleteWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.CANCEL_USER_EXECUTIONS), `${this._executionManager()}/cancelUserExecution`, {}, {}, {}, { userID, broadcastToCluster }, { enableCompression: true }); // ------------------------------------------- Query ------------------------------------------- _query = (queryId) => `${this.queryBaseUrl ?? this.baseUrl}/pure/v1/query${queryId ? `/${encodeURIComponent(queryId)}` : ''}`; searchQueries = (searchSpecification) => this.post(`${this._query()}/search`, searchSpecification, undefined); getQueries = (queryIds) => this.get(`${this._query()}/batch`, {}, undefined, { queryIds }); getQuery = (queryId) => this.get(this._query(queryId)); createQuery = (query) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.CREATE_QUERY), this._query(), query); updateQuery = (queryId, query) => this.putWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.UPDATE_QUERY), this._query(queryId), query); patchQuery = (queryId, query) => this.putWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.PATCH_QUERY), `${this._query(queryId)}/patchQuery`, query); deleteQuery = (queryId) => this.deleteWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.DELETE_QUERY), this._query(queryId)); // ------------------------------------------- DataCube ------------------------------------------- _dataCube = (id) => `${this.queryBaseUrl ?? this.baseUrl}/pure/v1/query/dataCube${id ? `/${encodeURIComponent(id)}` : ''}`; searchDataCubes = (searchSpecification) => this.post(`${this._dataCube()}/search`, searchSpecification, undefined); getDataCubes = (ids) => this.get(`${this._dataCube()}/batch`, {}, undefined, { queryIds: ids, }); getDataCube = (id) => this.get(this._dataCube(id)); createDataCube = (dataCube) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.CREATE_DATA_CUBE), this._dataCube(), dataCube); updateDataCube = (id, dataCube) => this.putWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.UPDATE_DATA_CUBE), this._dataCube(id), dataCube); deleteDataCube = (id) => this.deleteWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.DELETE_DATA_CUBE), this._dataCube(id)); // --------------------------------------- Analysis --------------------------------------- analyzeMappingModelCoverage = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.MAPPING_MODEL_COVERAGE_ANALYTICS), `${this._pure()}/analytics/mapping/modelCoverage`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.MAPPING_MODEL_COVERAGE_ANALYTICS), {}, undefined, undefined, { enableCompression: true }); surveyDatasets = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.SURVEY_DATASET_ANALYTICS), `${this._pure()}/analytics/store-entitlement/surveyDatasets`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.SURVEY_DATASET_ANALYTICS), {}, undefined, undefined, { enableCompression: true }); checkDatasetEntitlements = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.STORE_ENTITLEMENT_ANALYTICS), `${this._pure()}/analytics/store-entitlement/checkDatasetEntitlements`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.STORE_ENTITLEMENT_ANALYTICS), {}, undefined, undefined, { enableCompression: true }); _databaseUtilities = () => `${this._pure()}/utilities/database`; buildDatabase = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.DATABASE_SCHEMA_EXPLORATION), `${this._databaseUtilities()}/schemaExploration`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.DATABASE_SCHEMA_EXPLORATION)); executeRawSQL = (input) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.DATABASE_RAW_SQL_EXECUTION), `${this._databaseUtilities()}/executeRawSQL`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.DATABASE_RAW_SQL_EXECUTION), {}, { [HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN }); // ------------------------------------------- Function --------------------------------------- _functionActivator = () => `${this.baseUrl}/functionActivator`; getAvailableFunctionActivators() { return this.get(`${this._functionActivator()}/list`); } validateFunctionActivator(input) { return this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.VALIDATE_FUNCTION_ACTIVATOR), `${this._functionActivator()}/validate`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.VALIDATE_FUNCTION_ACTIVATOR)); } publishFunctionActivatorToSandbox(input) { return this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.PUBLISH_FUNCTION_ACTIVATOR_TO_SANDBOX), `${this._functionActivator()}/publishToSandbox`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.PUBLISH_FUNCTION_ACTIVATOR_TO_SANDBOX)); } // ------------------------------------------- Relational --------------------------------------- _relationalElement = () => `${this._pure()}/relational`; generateModelsFromDatabaseSpecification(input) { return this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.DATABASE_TO_MODELS), `${this._relationalElement()}/generateModelsFromDatabaseSpecification`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.DATABASE_TO_MODELS)); } getAvailableRelationalDatabaseTypeConfigurations = () => this.get(`${this._relationalElement()}/connection/supportedDbAuthenticationFlows`); // ------------------------------------------- Service ------------------------------------------- _service = (serviceServerUrl) => `${serviceServerUrl ?? this.baseUrl}/service/v1`; /** * TODO: this is an internal API that should me refactored out using extension mechanism */ TEMPORARY__getServerServiceInfo = () => this.get(`${this._server()}/info/services`); /** * TODO: this is an internal API that should me refactored out using extension mechanism */ TEMPORARY__getServiceVersionInfo = (serviceServerUrl, serviceId) => this.getWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GET_SERVICE_VERSION), `${this._service(this.baseUrlForServiceRegistration ?? serviceServerUrl)}/id/${serviceId}`); /** * TODO: this is an internal API that should me refactored out using extension mechanism */ TEMPORARY__activateGenerationId = (serviceServerUrl, generationId) => this.putWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.ACTIVATE_SERVICE_GENERATION_ID), `${this._service(this.baseUrlForServiceRegistration ?? serviceServerUrl)}/generation/setActive/id/${generationId}`, {}, {}, {}, {}, {}, { skipProcessing: true }); runServicePostVal = (servicePath, input, assertionId) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.VALIDATE_SERVICE_ASSERTION_ID), `${this._service()}/doValidation`, input, {}, undefined, { assertionId: assertionId, servicePath: servicePath, }, { enableCompression: true }); getRegisterServiceUrlFromExecMode = (serviceExecutionMode) => { const REGISTER_ENDPOINT_PREFIX = 'register'; switch (serviceExecutionMode) { case ServiceExecutionMode.FULL_INTERACTIVE: return `${REGISTER_ENDPOINT_PREFIX}_fullInteractive`; case ServiceExecutionMode.SEMI_INTERACTIVE: return `${REGISTER_ENDPOINT_PREFIX}_semiInteractive`; default: return REGISTER_ENDPOINT_PREFIX; } }; /** * TODO: this is an internal API that should me refactored out using extension mechanism */ INTERNAL__registerService = (input, serviceServerUrl, serviceExecutionMode, TEMPORARY__useStoreModel, TEMPORARY__useGenerateLineage, TEMPORARY__useGenerateOpenApi) => this.postWithTracing(this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.REGISTER_SERVICE), `${this._service(this.baseUrlForServiceRegistration ?? serviceServerUrl)}/${this.getRegisterServiceUrlFromExecMode(serviceExecutionMode)}`, this.debugPayload(input, CORE_ENGINE_ACTIVITY_TRACE.REGISTER_SERVICE), {}, undefined, serviceExecutionMode === ServiceExecutionMode.FULL_INTERACTIVE ? { storeModel: TEMPORARY__useStoreModel, generateLineage: TEMPORARY__useGenerateLineage, } : serviceExecutionMode === ServiceExecutionMode.SEMI_INTERACTIVE ? { generateLineage: TEMPORARY__useGenerateLineage, } : { generateLineage: TEMPORARY__useGenerateLineage, generateOpenApi: TEMPORARY__useGenerateOpenApi, }, { enableCompression: true }); } //# sourceMappingURL=V1_EngineServerClient.js.map