MCPcopy Index your code
hub / github.com/simstudioai/sim / parseResource

Function parseResource

apps/sim/hooks/queries/mothership-chats.ts:122–133  ·  view source on GitHub ↗
(value: unknown, context: string)

Source from the content-addressed store, hash-verified

120}
121
122function parseResource(value: unknown, context: string): MothershipResource {
123 assertValid(isRecordLike(value), `${context} must be an object`)
124 assertValid(isResourceType(value.type), `${context}.type is invalid`)
125 assertValid(typeof value.id === 'string', `${context}.id must be a string`)
126 assertValid(typeof value.title === 'string', `${context}.title must be a string`)
127
128 return {
129 type: value.type,
130 id: value.id,
131 title: value.title,
132 }
133}
134
135function parseResources(value: unknown, context: string): MothershipResource[] {
136 assertValid(Array.isArray(value), `${context} must be an array`)

Callers 1

parseResourcesFunction · 0.85

Calls 3

isRecordLikeFunction · 0.90
assertValidFunction · 0.85
isResourceTypeFunction · 0.85

Tested by

no test coverage detected