MCPcopy Index your code
hub / github.com/dataease/SQLBot / executeRequest

Function executeRequest

frontend/public/swagger-ui-bundle.js:38166–38228  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

38164 setMutatedRequest = (s, o, i) => ({ payload: { path: s, method: o, req: i }, type: _o }),
38165 logRequest = (s) => ({ payload: s, type: So }),
38166 executeRequest =
38167 (s) =>
38168 ({ fn: o, specActions: i, specSelectors: a, getConfigs: u, oas3Selectors: _ }) => {
38169 let { pathName: w, method: x, operation: C } = s,
38170 { requestInterceptor: j, responseInterceptor: L } = u(),
38171 B = C.toJS()
38172 if (
38173 (C &&
38174 C.get('parameters') &&
38175 C.get('parameters')
38176 .filter((s) => s && !0 === s.get('allowEmptyValue'))
38177 .forEach((o) => {
38178 if (a.parameterInclusionSettingFor([w, x], o.get('name'), o.get('in'))) {
38179 s.parameters = s.parameters || {}
38180 const i = paramToValue(o, s.parameters)
38181 ;(!i || (i && 0 === i.size)) && (s.parameters[o.get('name')] = '')
38182 }
38183 }),
38184 (s.contextUrl = Nt()(a.url()).toString()),
38185 B && B.operationId
38186 ? (s.operationId = B.operationId)
38187 : B && w && x && (s.operationId = o.opId(B, w, x)),
38188 a.isOAS3())
38189 ) {
38190 const o = `${w}:${x}`
38191 s.server = _.selectedServer(o) || _.selectedServer()
38192 const i = _.serverVariables({ server: s.server, namespace: o }).toJS(),
38193 a = _.serverVariables({ server: s.server }).toJS()
38194 ;((s.serverVariables = Object.keys(i).length ? i : a),
38195 (s.requestContentType = _.requestContentType(w, x)),
38196 (s.responseContentType = _.responseContentType(w, x) || '*/*'))
38197 const u = _.requestBodyValue(w, x),
38198 C = _.requestBodyInclusionSetting(w, x)
38199 u && u.toJS
38200 ? (s.requestBody = u
38201 .map((s) => (ze.Map.isMap(s) ? s.get('value') : s))
38202 .filter(
38203 (s, o) => (Array.isArray(s) ? 0 !== s.length : !isEmptyValue(s)) || C.get(o)
38204 )
38205 .toJS())
38206 : (s.requestBody = u)
38207 }
38208 let $ = Object.assign({}, s)
38209 ;(($ = o.buildRequest($)), i.setRequest(s.pathName, s.method, $))
38210 ;((s.requestInterceptor = async (o) => {
38211 let a = await j.apply(void 0, [o]),
38212 u = Object.assign({}, a)
38213 return (i.setMutatedRequest(s.pathName, s.method, u), a)
38214 }),
38215 (s.responseInterceptor = L))
38216 const U = Date.now()
38217 return o
38218 .execute(s)
38219 .then((o) => {
38220 ;((o.duration = Date.now() - U), i.setResponse(s.pathName, s.method, o))
38221 })
38222 .catch((o) => {
38223 ;('Failed to fetch' === o.message &&

Callers

nothing calls this directly

Calls 13

paramToValueFunction · 0.85
isEmptyValueFunction · 0.85
uFunction · 0.70
getMethod · 0.65
NtFunction · 0.50
forEachMethod · 0.45
filterMethod · 0.45
toStringMethod · 0.45
urlMethod · 0.45
keysMethod · 0.45
mapMethod · 0.45
isArrayMethod · 0.45

Tested by

no test coverage detected