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

Method detectVariant

server/src/brand-manager.ts:281–311  ·  view source on GitHub ↗

* Detect which variant of brand.json this is

(
    data: unknown
  )

Source from the content-addressed store, hash-verified

279 * Detect which variant of brand.json this is
280 */
281 private detectVariant(
282 data: unknown
283 ): 'authoritative_location' | 'house_redirect' | 'brand_agent' | 'house_portfolio' | null {
284 if (typeof data !== 'object' || data === null) {
285 return null;
286 }
287
288 const obj = data as Record<string, unknown>;
289
290 // Check for authoritative_location redirect
291 if ('authoritative_location' in obj && typeof obj.authoritative_location === 'string') {
292 return 'authoritative_location';
293 }
294
295 // Check for brand_agent
296 if ('brand_agent' in obj && typeof obj.brand_agent === 'object') {
297 return 'brand_agent';
298 }
299
300 // Check for house - could be string (redirect) or object (portfolio)
301 if ('house' in obj) {
302 if (typeof obj.house === 'string') {
303 return 'house_redirect';
304 }
305 if (typeof obj.house === 'object' && 'brands' in obj) {
306 return 'house_portfolio';
307 }
308 }
309
310 return null;
311 }
312
313 /**
314 * Validate authoritative_location variant

Callers 1

validateDomainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected