Add TypeScript integrations package
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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');
|
||||
};
|
||||
Reference in New Issue
Block a user