import {
  AuthenticatedCommand
} from "./chunk-G2JISDKX.js";
import {
  require_lib
} from "./chunk-XECLOG6B.js";
import {
  getParsedSchema
} from "./chunk-UDU5PBTV.js";
import {
  __toESM,
  init_cjs_shims
} from "./chunk-7GH3YGSC.js";

// src/commands/store-schema.ts
init_cjs_shims();
var import_core = __toESM(require_lib(), 1);
var StoreSchema = class extends AuthenticatedCommand {
  static {
    this.description = "Store schema within your Fragment workspace";
  }
  static {
    this.examples = ["<%= config.bin %> <%= command.id %>"];
  }
  static {
    this.flags = {
      path: import_core.Flags.string({
        char: "p",
        description: "Path to schema file (e.g. fragment.jsonc)",
        default: "fragment.jsonc"
        // TODO: Update to use DEFAULT_SCHEMA_PATH constant
      })
    };
  }
  async run() {
    const schema = getParsedSchema({
      command: this,
      schemaPath: this.flags.path
    });
    const res = await this.sdk.storeSchema({
      schema: {
        ...schema,
        name: schema.name ?? schema.key
      }
    });
    if (res.storeSchema.__typename !== "StoreSchemaResult") {
      this.exit(1);
    }
  }
};

export {
  StoreSchema
};
