UNPKG

@fragment-dev/cli

Version:
56 lines (53 loc) 1.46 kB
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/reverse-ledger-entry.ts init_cjs_shims(); var import_core = __toESM(require_lib(), 1); var import_chalk = __toESM(require_source(), 1); var ReverseLedgerEntry = class extends AuthenticatedCommand { static { this.summary = "Reverse a Ledger Entry."; } static { this.description = `This mirrors the ${import_chalk.default.magentaBright( "reverseLedgerEntry" )} mutation in the GraphQL API.`; } static { this.examples = ["<%= config.bin %> <%= command.id %>"]; } static { this.flags = { id: import_core.Flags.string({ description: "Fragment ID of the Ledger Entry to reverse.", required: true }) }; } async run() { const res = await this.sdk.ReverseLedgerEntry({ id: this.flags.id }); if (res.reverseLedgerEntry.__typename !== "ReverseLedgerEntryResult") { this.logToStderr(`Received error: ${res.reverseLedgerEntry.__typename}`); this.logToStderr(`Message: ${res.reverseLedgerEntry.message}`); this.logToStderr(`Code: ${res.reverseLedgerEntry.code}`); this.logToStderr(`Retryable: ${res.reverseLedgerEntry.retryable}`); this.exit(1); } } }; export { ReverseLedgerEntry };