MCPcopy Index your code
hub / github.com/massCodeIO/massCode / parseParams

Function parseParams

src/main/http/import/opencollection.ts:134–164  ·  view source on GitHub ↗
(rawParams: unknown)

Source from the content-addressed store, hash-verified

132}
133
134function parseParams(rawParams: unknown): {
135 pathParams: Record<string, string>
136 query: HttpQueryEntry[]
137} {
138 const params = asArray(rawParams).filter(isRecord)
139 const pathParams: Record<string, string> = {}
140 const query: HttpQueryEntry[] = []
141
142 for (const param of params) {
143 const type = asString(param.type)
144 const name = asString(param.name ?? param.key)
145 const value = asString(param.value)
146 if (!name)
147 continue
148
149 if (type === 'path') {
150 pathParams[name] = value
151 continue
152 }
153
154 if (type === 'query') {
155 query.push({
156 enabled: param.disabled === true ? false : undefined,
157 key: name,
158 value,
159 })
160 }
161 }
162
163 return { pathParams, query }
164}
165
166function applyPathParams(
167 url: string,

Callers 1

parseRequestFunction · 0.85

Calls 2

asArrayFunction · 0.70
asStringFunction · 0.70

Tested by

no test coverage detected