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

Method deserialise

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

Source from the content-addressed store, hash-verified

26196 return []
26197 }
26198 deserialise(s) {
26199 if ('string' == typeof s) return new this.namespace.elements.String(s)
26200 if ('number' == typeof s) return new this.namespace.elements.Number(s)
26201 if ('boolean' == typeof s) return new this.namespace.elements.Boolean(s)
26202 if (null === s) return new this.namespace.elements.Null()
26203 if (Array.isArray(s))
26204 return new this.namespace.elements.Array(s.map(this.deserialise, this))
26205 const o = this.namespace.getElementClass(s.element),
26206 i = new o()
26207 ;(i.element !== s.element && (i.element = s.element),
26208 s.meta && this.deserialiseObject(s.meta, i.meta),
26209 s.attributes && this.deserialiseObject(s.attributes, i.attributes))
26210 const a = this.deserialiseContent(s.content)
26211 if (((void 0 === a && null !== i.content) || (i.content = a), 'enum' === i.element)) {
26212 i.content && i.attributes.set('enumerations', i.content)
26213 let s = i.attributes.get('samples')
26214 if ((i.attributes.remove('samples'), s)) {
26215 const a = s
26216 ;((s = new this.namespace.elements.Array()),
26217 a.forEach((a) => {
26218 a.forEach((a) => {
26219 const u = new o(a)
26220 ;((u.element = i.element), s.push(u))
26221 })
26222 }))
26223 const u = s.shift()
26224 ;((i.content = u ? u.content : void 0), i.attributes.set('samples', s))
26225 } else i.content = void 0
26226 let a = i.attributes.get('default')
26227 if (a && a.length > 0) {
26228 a = a.get(0)
26229 const s = new o(a)
26230 ;((s.element = i.element), i.attributes.set('default', s))
26231 }
26232 } else if ('dataStructure' === i.element && Array.isArray(i.content))
26233 [i.content] = i.content
26234 else if ('category' === i.element) {
26235 const s = i.attributes.get('meta')
26236 s && (i.attributes.set('metadata', s), i.attributes.remove('meta'))
26237 } else
26238 'member' === i.element &&
26239 i.key &&
26240 i.key._attributes &&
26241 i.key._attributes.getValue('variable') &&
26242 (i.attributes.set('variable', i.key.attributes.get('variable')),
26243 i.key.attributes.remove('variable'))
26244 return i
26245 }
26246 serialiseContent(s) {
26247 if (s instanceof this.namespace.elements.Element) return this.serialise(s)
26248 if (s instanceof this.namespace.KeyValuePair) {

Callers 2

deserialiseContentMethod · 0.95
deserialiseObjectMethod · 0.95

Calls 12

deserialiseObjectMethod · 0.95
deserialiseContentMethod · 0.95
getElementClassMethod · 0.80
getMethod · 0.65
removeMethod · 0.65
isArrayMethod · 0.45
mapMethod · 0.45
setMethod · 0.45
forEachMethod · 0.45
pushMethod · 0.45
shiftMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected