@supernovaio/cli
Version:
Supernova.io Command Line Interface
68 lines (66 loc) • 3.14 kB
JavaScript
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e3d2488d-9a42-5f88-ac52-be39d4531604")}catch(e){}}();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Flags } from "@oclif/core";
import { SentryTraced } from "@sentry/nestjs";
import { z } from "zod";
import { SentryCommand } from "../../../types/index.js";
import { NotAuthorizedError } from "../../../types/not-authorized.error.js";
import { watchAnalyzeStatus } from "../../../utils/analyze-status.js";
import { createApiClient } from "../../../utils/http-client.js";
const AnalyzeStatusConfig = z.object({
designSystemId: z.string().optional(),
});
export default class AnalyzeStatus extends SentryCommand {
static hidden = true;
static args = {};
static description = "Show code snapshot processing status for current user";
static examples = ["<%= config.bin %> <%= command.id %> --designSystemId 123"];
static flags = {
designSystemId: Flags.string({ char: "d", description: "Design system ID" }),
};
get commandId() {
return AnalyzeStatus.id;
}
get configSchema() {
return AnalyzeStatusConfig;
}
async run() {
const { flags } = await this.parse(AnalyzeStatus);
const config = this.configService.get();
const designSystemId = flags.designSystemId ?? config?.designSystemId ?? (await this.promptDesignSystemId());
let apiClient;
try {
apiClient = await createApiClient(this.env);
}
catch (error) {
if (error instanceof NotAuthorizedError && (await this.promptLoginIfInteractive())) {
apiClient = await createApiClient(this.env);
}
else {
throw error;
}
}
await watchAnalyzeStatus({
apiClient,
designSystemId,
error: message => this.error(message),
log: message => this.log(message),
});
}
}
__decorate([
SentryTraced(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], AnalyzeStatus.prototype, "run", null);
//# sourceMappingURL=status.js.map
//# debugId=e3d2488d-9a42-5f88-ac52-be39d4531604