MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / applyCustomRegistryEntries

Function applyCustomRegistryEntries

packages/oauth/src/custom-registry.ts:386–411  ·  view source on GitHub ↗
(
  config: ManagedKimiConfigShape,
  entries: Record<string, CustomRegistryProviderEntry>,
  source: CustomRegistrySource,
)

Source from the content-addressed store, hash-verified

384 * registry".
385 */
386export function applyCustomRegistryEntries(
387 config: ManagedKimiConfigShape,
388 entries: Record<string, CustomRegistryProviderEntry>,
389 source: CustomRegistrySource,
390): void {
391 const surviving = new Set(Object.values(entries).map((entry) => entry.id));
392 for (const [providerId, provider] of Object.entries(config.providers)) {
393 if (surviving.has(providerId)) continue;
394 if (!isRecord(provider)) continue;
395 const existingSource = provider['source'];
396 if (
397 isRecord(existingSource) &&
398 existingSource['kind'] === 'apiJson' &&
399 existingSource['url'] === source.url
400 ) {
401 removeCustomRegistryProvider(config, providerId);
402 }
403 }
404
405 for (const entry of Object.values(entries)) {
406 if (entry.id in config.providers) {
407 removeCustomRegistryProvider(config, entry.id);
408 }
409 applyCustomRegistryProvider(config, entry, source);
410 }
411}

Callers 2

Calls 5

isRecordFunction · 0.90
valuesMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected