Files
integrations/ts/cli/commands.inspect.ts

25 lines
968 B
TypeScript

import type { IntegrationRegistry } from '../core/index.js';
export const commandInspect = (registryArg: IntegrationRegistry, domainArg: string): string => {
const integration = registryArg.get(domainArg);
if (!integration) {
throw new Error(`Integration not found: ${domainArg}`);
}
const descriptor = integration.discoveryDescriptor;
const probes = descriptor.getProbes();
const matchers = descriptor.getMatchers();
const validators = descriptor.getValidators();
return [
`Domain: ${integration.domain}`,
`Name: ${integration.displayName}`,
`Status: ${integration.status}`,
'',
'Discovery:',
` probes: ${probes.length ? probes.map((probeArg) => probeArg.id).join(', ') : 'none'}`,
` matchers: ${matchers.length ? matchers.map((matcherArg) => matcherArg.id).join(', ') : 'none'}`,
` validators: ${validators.length ? validators.map((validatorArg) => validatorArg.id).join(', ') : 'none'}`,
].join('\n');
};