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

Function extractAuthType

scripts/generate-docs.ts:577–585  ·  view source on GitHub ↗

* Detect the authentication type from block content. * Returns 'oauth' if the block uses oauth-input credentials, * 'api-key' if it uses a plain API key field, or 'none' otherwise.

(blockContent: string)

Source from the content-addressed store, hash-verified

575 * 'api-key' if it uses a plain API key field, or 'none' otherwise.
576 */
577function extractAuthType(blockContent: string): 'oauth' | 'api-key' | 'none' {
578 // Prefer the authoritative `authMode` declaration when present.
579 if (/authMode\s*:\s*AuthMode\.OAuth\b/.test(blockContent)) return 'oauth'
580 if (/authMode\s*:\s*AuthMode\.(?:ApiKey|BotToken)\b/.test(blockContent)) return 'api-key'
581 // Fall back to credential subBlock heuristics for blocks without authMode.
582 if (/type\s*:\s*['"]oauth-input['"]/.test(blockContent)) return 'oauth'
583 if (/\bid\s*:\s*['"](?:apiKey|api_key|accessToken)['"]/.test(blockContent)) return 'api-key'
584 return 'none'
585}
586
587/**
588 * Length-preserving copy of `content` with string-literal and comment

Callers 1

writeIntegrationsJsonFunction · 0.85

Calls 1

testMethod · 0.80

Tested by

no test coverage detected