|
1 | 1 | import Command from '../../core/command' |
2 | 2 | import { flags, FlagInput, managementSDKClient, cliux, printFlagDeprecation } from '@contentstack/cli-utilities' |
3 | 3 | import buildOutput from '../../core/content-type/audit' |
4 | | -import { getStack, getUsers } from '../../utils' |
| 4 | +import { getStack, getUsers, getContentType } from '../../utils' |
5 | 5 |
|
6 | 6 | export default class AuditCommand extends Command { |
7 | 7 | static description = 'Display recent changes to a Content Type' |
@@ -52,13 +52,18 @@ export default class AuditCommand extends Command { |
52 | 52 | }) |
53 | 53 |
|
54 | 54 | const spinner = cliux.loaderV2(Command.RequestDataMessage) |
55 | | - |
| 55 | + //validate content type |
| 56 | + await getContentType({ |
| 57 | + managementSdk: this.contentTypeManagementClient, |
| 58 | + apiKey: this.apiKey, |
| 59 | + uid: flags['content-type'], |
| 60 | + spinner |
| 61 | + }); |
56 | 62 | const [stack, audit, users] = await Promise.all([ |
57 | 63 | getStack(this.contentTypeManagementClient, this.apiKey, spinner), |
58 | 64 | this.client.getContentTypeAuditLogs(this.apiKey, flags['content-type'], spinner), |
59 | 65 | getUsers(this.contentTypeManagementClient, this.apiKey, spinner) |
60 | 66 | ]) |
61 | | - |
62 | 67 | cliux.loaderV2('', spinner) |
63 | 68 |
|
64 | 69 | const output = buildOutput(audit.logs, users) |
|
0 commit comments