{"version":3,"file":"methodUtils.mjs","names":["ConfigService","apiMutate","getBaseMethod","type","baseType","catalogPromotedEntities","entityMethod","find","promotedEntity","entityNameParts","entityName","split","length","executeQueryAdHoc","data","apiMethodId","urlQueryParams","integrationV1ApiUrl","method","executeQueryWithParameters","executeQueryInstance","apiMethodInstanceId","executeQueryInstanceWithApiMethodInstance"],"sources":["../../../src/udp/utilities/methodUtils.js"],"sourcesContent":["import { ConfigService } from '../../configService';\nimport { apiMutate } from '../../utilities/useAxiosMutate';\n\n/** @typedef {import('axios').AxiosResponse<any>} AxiosResponse */\nexport const getBaseMethod = (type, baseType, catalogPromotedEntities) => {\n  if (!catalogPromotedEntities) {\n    return null;\n  }\n  const entityMethod = catalogPromotedEntities.find((promotedEntity) => {\n    const entityNameParts = promotedEntity.entityName.split('.');\n    if (entityNameParts.length) {\n      return entityNameParts[entityNameParts.length - 1] === type;\n    }\n    return false;\n  });\n  return entityMethod ? entityMethod[baseType] : null;\n};\n\n/**\n * @returns {Promise<AxiosResponse>}\n */\nexport const executeQueryAdHoc = async (\n  data,\n  apiMethodId,\n  urlQueryParams = ''\n) =>\n  apiMutate(\n    ConfigService.integrationV1ApiUrl,\n    `apimethod/executeQueryAdHoc/${apiMethodId}${urlQueryParams}`,\n    {\n      method: 'post'\n    },\n    data\n  );\n\n/**\n * @returns {Promise<AxiosResponse>}\n */\nexport const executeQueryWithParameters = async (\n  data,\n  apiMethodId,\n  urlQueryParams = ''\n) =>\n  apiMutate(\n    ConfigService.integrationV1ApiUrl,\n    `apimethod/executeQueryWithParameters/${apiMethodId}${urlQueryParams}`,\n    {\n      method: 'post'\n    },\n    data\n  );\n\n/**\n * @returns {Promise<AxiosResponse>}\n */\nexport const executeQueryInstance = async (\n  data,\n  apiMethodInstanceId,\n  urlQueryParams = ''\n) =>\n  apiMutate(\n    ConfigService.integrationV1ApiUrl,\n    `apimethod/executeQueryInstance/${apiMethodInstanceId}${urlQueryParams}`,\n    {\n      method: 'post'\n    },\n    data\n  );\n\n/**\n * @returns {Promise<AxiosResponse>}\n */\nexport const executeQueryInstanceWithApiMethodInstance = async (\n  data,\n  urlQueryParams = ''\n) =>\n  apiMutate(\n    ConfigService.integrationV1ApiUrl,\n    `apimethod/executeQueryInstance${urlQueryParams}`,\n    {\n      method: 'post'\n    },\n    data\n  );\n"],"mappings":";;;;AAIA,MAAaE,iBAAiBC,MAAMC,UAAUC,4BAA4B;AACxE,KAAI,CAACA,wBACH,QAAO;CAET,MAAMC,eAAeD,wBAAwBE,MAAMC,mBAAmB;EACpE,MAAMC,kBAAkBD,eAAeE,WAAWC,MAAM,IAAI;AAC5D,MAAIF,gBAAgBG,OAClB,QAAOH,gBAAgBA,gBAAgBG,SAAS,OAAOT;AAEzD,SAAO;GACP;AACF,QAAOG,eAAeA,aAAaF,YAAY;;;;;AAMjD,MAAaS,oBAAoB,OAC/BC,MACAC,aACAC,iBAAiB,OAEjBf,UACED,cAAciB,qBACd,+BAA+BF,cAAcC,kBAC7C,EACEE,QAAQ,QACT,EACDJ,KACD;;;;AAKH,MAAaK,6BAA6B,OACxCL,MACAC,aACAC,iBAAiB,OAEjBf,UACED,cAAciB,qBACd,wCAAwCF,cAAcC,kBACtD,EACEE,QAAQ,QACT,EACDJ,KACD;;;;AAKH,MAAaM,uBAAuB,OAClCN,MACAO,qBACAL,iBAAiB,OAEjBf,UACED,cAAciB,qBACd,kCAAkCI,sBAAsBL,kBACxD,EACEE,QAAQ,QACT,EACDJ,KACD;;;;AAKH,MAAaQ,4CAA4C,OACvDR,MACAE,iBAAiB,OAEjBf,UACED,cAAciB,qBACd,iCAAiCD,kBACjC,EACEE,QAAQ,QACT,EACDJ,KACD"}