MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / deserializeProfile

Method deserializeProfile

server/src/db/member-db.ts:383–428  ·  view source on GitHub ↗

* Deserialize database row (parse JSONB fields)

(row: any)

Source from the content-addressed store, hash-verified

381 * Deserialize database row (parse JSONB fields)
382 */
383 private deserializeProfile(row: any): MemberProfile {
384 // Parse agents JSONB
385 let agents: AgentConfig[] = [];
386 if (row.agents) {
387 const raw = typeof row.agents === 'string'
388 ? JSON.parse(row.agents)
389 : row.agents;
390 agents = Array.isArray(raw) ? raw.map(normalizeAgentConfig) : [];
391 }
392
393 // Parse publishers JSONB
394 let publishers: PublisherConfig[] = [];
395 if (row.publishers) {
396 publishers = typeof row.publishers === 'string'
397 ? JSON.parse(row.publishers)
398 : row.publishers;
399 }
400
401 // Parse brands JSONB
402 let brands: BrandConfig[] = [];
403 if (row.brands) {
404 brands = typeof row.brands === 'string'
405 ? JSON.parse(row.brands)
406 : row.brands;
407 }
408
409 // Parse data_providers JSONB
410 let data_providers: DataProviderConfig[] = [];
411 if (row.data_providers) {
412 data_providers = typeof row.data_providers === 'string'
413 ? JSON.parse(row.data_providers)
414 : row.data_providers;
415 }
416
417 return {
418 ...row,
419 agents,
420 publishers,
421 brands,
422 data_providers,
423 markets: row.markets || [],
424 metadata: typeof row.metadata === 'string'
425 ? JSON.parse(row.metadata)
426 : row.metadata || {},
427 };
428 }
429
430}

Callers 7

createProfileMethod · 0.95
getProfileByIdMethod · 0.95
getProfileBySlugMethod · 0.95
getProfileByDomainMethod · 0.95
getProfileByOrgIdMethod · 0.95
updateProfileMethod · 0.95
listProfilesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected