"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMiniappAttr=getMiniappAttr;const tslib_1=require("tslib"),request_1=require("../utils/request"),sign_1=require("../utils/sign"),log=tslib_1.__importStar(require("../utils/log")),url_config_1=require("../config/url.config"),jsonParse_1=require("../utils/jsonParse"),testCache={};async function getMiniappAttr(e,t){try{if(global.useAttrCache&&testCache[t])return testCache[t];const r=await(0,sign_1.getSignature)(e,t),{body:i}=await(0,request_1.request)({url:url_config_1.getSdkIntInfo,method:"post",body:JSON.stringify({appid:t,signature:r}),headers:{"content-type":"application/json"}}),s=(0,jsonParse_1.jsonRespParse)(i,url_config_1.getSdkIntInfo);if(0===s.errCode)return global.useAttrCache&&(testCache[t]=s.data),s.data;log.error(`get ${t} project miniapp attr fail errCode: ${s.errCode}, errMsg: ${s.errMsg}`)}catch(e){throw log.error(`get ${t} project miniapp attr fail ${e}`),e}}