@fragment-dev/cli
Version:
66 lines (63 loc) • 1.75 kB
JavaScript
import {
AuthenticatedCommand
} from "./chunk-W7HG2VEH.js";
import {
require_lib
} from "./chunk-UD22EIAP.js";
import {
require_source
} from "./chunk-M5OAS5QZ.js";
import {
__toESM,
init_cjs_shims
} from "./chunk-7GH3YGSC.js";
// src/commands/delete-ledger.ts
init_cjs_shims();
var import_core = __toESM(require_lib(), 1);
var import_chalk = __toESM(require_source(), 1);
var DeleteLedger = class extends AuthenticatedCommand {
static {
this.summary = "Delete a Ledger.";
}
static {
this.description = `This mirrors the ${import_chalk.default.magentaBright(
"deleteLedger"
)} mutation in the GraphQL API.`;
}
static {
this.examples = ["<%= config.bin %> <%= command.id %>"];
}
static {
this.flags = {
"ledger.ik": import_core.Flags.string({
char: "l",
description: "The Idempotency Key of the Ledger to delete."
}),
"ledger.id": import_core.Flags.string({
description: "The Fragment ID of the Ledger to delete."
})
};
}
async run() {
if (!this.flags["ledger.id"] && !this.flags["ledger.ik"]) {
this.logToStderr("Either --ledger.id or --ledger.ik is required.");
this.exit(1);
}
const res = await this.sdk.DeleteLedger({
ledger: {
ik: this.flags["ledger.ik"],
id: this.flags["ledger.id"]
}
});
if (res.deleteLedger.__typename !== "DeleteLedgerResult") {
this.logToStderr(`Received error: ${res.deleteLedger.__typename}`);
this.logToStderr(`Message: ${res.deleteLedger.message}`);
this.logToStderr(`Code: ${res.deleteLedger.code}`);
this.logToStderr(`Retryable: ${res.deleteLedger.retryable}`);
this.exit(1);
}
}
};
export {
DeleteLedger
};