Skip to content
Snippets Groups Projects
resolve-did.command.ts 625 B
Newer Older
import { Command, CommandRunner } from 'nest-commander';
import { firstValueFrom, tap } from 'rxjs';

import { CommanderService } from '../commander.service.js';

@Command({
  name: 'resolve-did',
  arguments: '<tenantId> <did>',
})
export class ResolveDIDCommand extends CommandRunner {
  public constructor(private readonly service: CommanderService) {
    super();
  }

  public async run([tenantId, did]: string[]): Promise<void> {
    await firstValueFrom(
      this.service.resolveDID(tenantId, did).pipe(
        tap((data) => {
          console.log(JSON.stringify(data, null, 2));
        }),
      ),
    );
  }
}