@fragment-dev/cli
Version:
69 lines (66 loc) • 1.62 kB
JavaScript
import {
AuthenticatedCommand
} from "./chunk-SHTFFJEV.js";
import {
require_lib
} from "./chunk-IH6BCA6S.js";
import {
getParsedSchema
} from "./chunk-UDU5PBTV.js";
import {
__toESM,
init_cjs_shims
} from "./chunk-7GH3YGSC.js";
// src/commands/create-ledger.ts
init_cjs_shims();
var import_core = __toESM(require_lib(), 1);
var CreateLedger = class extends AuthenticatedCommand {
static {
this.description = "Create schematized Ledger within your Fragment workspace";
}
static {
this.examples = ["<%= config.bin %> <%= command.id %>"];
}
static {
this.flags = {
ik: import_core.Flags.string({
char: "i",
description: "Idempotency key for Ledger creation",
required: true
}),
name: import_core.Flags.string({
char: "n",
description: "Ledger name (e.g. 'My First Ledger')",
required: true
}),
schema: import_core.Flags.string({
char: "s",
description: "Path to schema file (defaults to fragment.jsonc)",
default: "fragment.jsonc"
// TODO: Update to use DEFAULT_SCHEMA_PATH constant
})
};
}
async run() {
const schema = getParsedSchema({
command: this,
schemaPath: this.flags.schema
});
const res = await this.sdk.CreateLedger({
ik: this.flags.ik,
ledger: {
name: this.flags.name
},
schema: {
// temporary until schema has key required
key: schema.key
}
});
if (res.createLedger.__typename !== "CreateLedgerResult") {
this.exit(1);
}
}
};
export {
CreateLedger
};