@anvil-works/anvil-cli 0.8.0-canary.15 → 0.8.0-canary.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -12904,6 +12904,9 @@ var __webpack_exports__ = {};
12904
12904
  function getGlobalOutputConfig() {
12905
12905
  return globalOutputConfig;
12906
12906
  }
12907
+ function canPrompt() {
12908
+ return !globalOutputConfig.jsonMode && !!(process.stdin.isTTY && process.stdout.isTTY);
12909
+ }
12907
12910
  function assertCanPrompt(action = "This command", explicitAlternative = "Pass explicit flags instead.") {
12908
12911
  if (globalOutputConfig.jsonMode) throw new Error(`${action} requires interactive input, but --json disables prompts. ${explicitAlternative}`);
12909
12912
  if (!process.stdin.isTTY || !process.stdout.isTTY) throw new Error(`${action} requires interactive input, but stdin/stdout is not a TTY. ${explicitAlternative}`);
@@ -14507,6 +14510,14 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
14507
14510
  html: htmlContent
14508
14511
  };
14509
14512
  }
14513
+ function formatHttpError(prefix, status, body) {
14514
+ if (!body) return `${prefix}: ${status}`;
14515
+ try {
14516
+ const parsed = JSON.parse(body);
14517
+ if ("string" == typeof parsed.error && parsed.error.trim()) return `${prefix}: ${parsed.error} (${status})`;
14518
+ } catch {}
14519
+ return `${prefix}: ${status} ${body}`;
14520
+ }
14510
14521
  const ANVIL_GITIGNORE_ENTRY = "/.anvil/";
14511
14522
  async function ensureProjectGitignoreIgnoresAnvilDir(projectRoot) {
14512
14523
  const rootGitignorePath = external_path_default().join(projectRoot, ".gitignore");
@@ -14526,14 +14537,6 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
14526
14537
  const ANVIL_DEPS_MANIFEST = "manifest.json";
14527
14538
  const DEPS_MANIFEST_VERSION = 2;
14528
14539
  const DEPENDENCY_CACHE_WARNING = "Dependency cache is missing or stale. Run `anvil deps fetch` before validation.";
14529
- function formatFetchError(prefix, status, errorBody) {
14530
- if (!errorBody) return `${prefix}: ${status}`;
14531
- try {
14532
- const parsed = JSON.parse(errorBody);
14533
- if ("string" == typeof parsed.error && parsed.error.trim()) return `${prefix}: ${parsed.error} (${status})`;
14534
- } catch {}
14535
- return `${prefix}: ${status} ${errorBody}`;
14536
- }
14537
14540
  async function fetchAllDependencies(appId, anvilUrl = resolveAnvilUrl(), options = {}) {
14538
14541
  const { commit, includeDocs = true, knownDependencies = [] } = options;
14539
14542
  const token = await auth_getValidAuthToken(anvilUrl);
@@ -14552,7 +14555,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
14552
14555
  });
14553
14556
  if (!resp.ok) {
14554
14557
  const errorBody = await resp.text();
14555
- throw new Error(formatFetchError("Failed to fetch dependencies", resp.status, errorBody));
14558
+ throw new Error(formatHttpError("Failed to fetch dependencies", resp.status, errorBody));
14556
14559
  }
14557
14560
  return await resp.json();
14558
14561
  }
@@ -23611,99 +23614,88 @@ print(json.dumps({"issues": issues}))
23611
23614
  }
23612
23615
  });
23613
23616
  }
23614
- const TABLE_MAPPINGS_PATH = ".anvil/table-mappings.json";
23615
- function tables_formatFetchError(prefix, status, errorBody) {
23616
- if (!errorBody) return `${prefix}: ${status}`;
23617
- try {
23618
- const parsed = JSON.parse(errorBody);
23619
- if ("string" == typeof parsed.error && parsed.error.trim()) return `${prefix}: ${parsed.error} (${status})`;
23620
- } catch {}
23621
- return `${prefix}: ${status} ${errorBody}`;
23622
- }
23623
- async function fetchTableMappings(appId, anvilUrl = resolveAnvilUrl()) {
23617
+ async function applyDatabaseSchema(appId, options = {}) {
23618
+ const anvilUrl = options.anvilUrl ?? resolveAnvilUrl();
23619
+ const projectRoot = options.projectRoot ?? process.cwd();
23620
+ const appYaml = external_js_yaml_default().load(await external_fs_.promises.readFile(external_path_default().join(projectRoot, "anvil.yaml"), "utf8"));
23624
23621
  const token = await auth_getValidAuthToken(anvilUrl);
23625
- const resp = await fetch(`${anvilUrl}/ide/api/_/apps/${appId}/db`, {
23622
+ const response = await fetch(`${anvilUrl}/ide/api/_/apps/${appId}/db/infer-from-env/apply-schema`, {
23623
+ method: "PUT",
23626
23624
  headers: {
23627
- Authorization: `Bearer ${token}`
23628
- }
23629
- });
23630
- if (!resp.ok) {
23631
- const errorBody = await resp.text();
23632
- throw new Error(tables_formatFetchError("Failed to fetch table mappings", resp.status, errorBody));
23633
- }
23634
- const databases = await resp.json();
23635
- const allTables = [];
23636
- for (const db of databases)for (const table of db.tables || [])allTables.push({
23637
- table_id: table.id,
23638
- python_name: table.python_name,
23639
- name: table.name
23640
- });
23641
- return {
23642
- tables: allTables
23643
- };
23644
- }
23645
- async function writeTableMappings(projectRoot, mappings) {
23646
- const filePath = external_path_default().join(projectRoot, TABLE_MAPPINGS_PATH);
23647
- await promises_default().mkdir(external_path_default().dirname(filePath), {
23648
- recursive: true
23625
+ Authorization: `Bearer ${token}`,
23626
+ "Content-Type": "application/json"
23627
+ },
23628
+ body: JSON.stringify({
23629
+ schema: appYaml?.db_schema ?? {},
23630
+ table_id_hints: appYaml?.table_id_hints
23631
+ })
23649
23632
  });
23650
- await promises_default().writeFile(filePath, JSON.stringify(mappings, null, 2));
23651
- }
23652
- async function readTableMappings(projectRoot) {
23653
- const filePath = external_path_default().join(projectRoot, TABLE_MAPPINGS_PATH);
23654
- try {
23655
- const content = await promises_default().readFile(filePath, "utf-8");
23656
- return JSON.parse(content);
23657
- } catch {
23658
- return null;
23659
- }
23633
+ if (!response.ok) throw new Error(formatHttpError("Failed to apply database schema", response.status, await response.text()));
23634
+ return await response.json();
23660
23635
  }
23661
- async function clearTableMappings(projectRoot) {
23662
- const filePath = external_path_default().join(projectRoot, TABLE_MAPPINGS_PATH);
23663
- await promises_default().rm(filePath, {
23664
- force: true
23665
- });
23636
+ async function confirmSchemaApplication(message) {
23637
+ if (!canPrompt()) return true;
23638
+ return logger_logger.confirm(message, true);
23666
23639
  }
23667
- function registerTablesCommand(program) {
23668
- const tables = program.command("tables").description("Manage table mappings");
23669
- tables.command("fetch").description("Fetch table mappings into .anvil/table-mappings.json").action(async ()=>{
23640
+ function registerDbCommand(program) {
23641
+ if ("1" !== process.env.ANVIL_AGENT_HOST) return;
23642
+ const db = program.command("db").description("Manage app databases");
23643
+ db.command("apply-schema").description("Apply the app schema to the database for the current environment").action(async ()=>{
23670
23644
  try {
23671
23645
  const projectRoot = process.cwd();
23646
+ auth_setRepoContext(projectRoot);
23672
23647
  const anvilUrl = resolveAnvilUrl();
23673
- const mainAppId = await resolvePrimaryAppId(projectRoot, anvilUrl);
23674
- if (!mainAppId) {
23675
- logger_logger.error("No Anvil app found in current directory");
23676
- logger_logger.info("Make sure you're in a directory with an Anvil app git remote.");
23677
- process.exit(1);
23678
- }
23679
- logger_logger.info("Fetching table mappings...");
23680
- const response = await fetchTableMappings(mainAppId, anvilUrl);
23681
- if (!response.tables.length) return void logger_logger.info("No tables found");
23682
- if (await ensureProjectGitignoreIgnoresAnvilDir(projectRoot)) logger_logger.info("Added /.anvil/ to .gitignore");
23683
- await writeTableMappings(projectRoot, response);
23684
- logger_logger.success(`Fetched ${response.tables.length} table mappings`);
23685
- } catch (e) {
23686
- logger_logger.error(e.message);
23648
+ const appId = await resolvePrimaryAppId(projectRoot, anvilUrl);
23649
+ if (!appId) throw new Error("No Anvil app found in current directory. Make sure you're in a directory with an Anvil app git remote.");
23650
+ if (!await confirmSchemaApplication("Apply the app environment's schema to its database? This may delete tables, columns, or data.")) return void logger_logger.info("Schema application cancelled.");
23651
+ const response = await applyDatabaseSchema(appId, {
23652
+ anvilUrl,
23653
+ projectRoot
23654
+ });
23655
+ if (getGlobalOutputConfig().jsonMode) logJsonResult(true, {
23656
+ data: response
23657
+ });
23658
+ else logger_logger.success("Database schema applied.");
23659
+ } catch (error) {
23660
+ const message = errors_getErrorMessage(error);
23661
+ if (getGlobalOutputConfig().jsonMode) logJsonResult(false, {
23662
+ error: message
23663
+ });
23664
+ else logger_logger.error(message);
23687
23665
  process.exit(1);
23688
23666
  }
23689
23667
  });
23690
- tables.command("status").description("Show cached table mappings").action(async ()=>{
23691
- try {
23692
- const mappings = await readTableMappings(process.cwd());
23693
- if (!mappings || !mappings.tables.length) return void logger_logger.info("No cached table mappings (run 'anvil tables fetch')");
23694
- logger_logger.info("Cached table mappings:");
23695
- for (const t of mappings.tables)logger_logger.info(` ${t.python_name} (${t.name}) - ID: ${t.table_id}`);
23696
- } catch (e) {
23697
- logger_logger.error(e.message);
23698
- process.exit(1);
23668
+ }
23669
+ async function ensureEnvironmentUrl(appId, envPid, options = {}) {
23670
+ const anvilUrl = options.anvilUrl ?? resolveAnvilUrl();
23671
+ const token = await auth_getValidAuthToken(anvilUrl);
23672
+ const response = await fetch(`${anvilUrl}/ide/api/_/apps/${encodeURIComponent(appId)}/environments/${encodeURIComponent(envPid)}/ensure-url`, {
23673
+ method: "POST",
23674
+ headers: {
23675
+ Authorization: `Bearer ${token}`
23699
23676
  }
23700
23677
  });
23701
- tables.command("clear").description("Clear cached table mappings").action(async ()=>{
23678
+ if (!response.ok) throw new Error(formatHttpError("Failed to get environment URL", response.status, await response.text()));
23679
+ const result = await response.json();
23680
+ return result.url;
23681
+ }
23682
+ function registerEnvCommand(program) {
23683
+ if ("1" !== process.env.ANVIL_AGENT_HOST) return;
23684
+ const env = program.command("env").description("Manage app environments");
23685
+ env.command("url").description("Get a private app URL for the current environment, creating one if necessary").action(async ()=>{
23702
23686
  try {
23703
- await clearTableMappings(process.cwd());
23704
- logger_logger.success("Cleared .anvil/table-mappings.json");
23705
- } catch (e) {
23706
- logger_logger.error(e.message);
23687
+ const projectRoot = process.cwd();
23688
+ const envPid = await readEnvironmentPid(projectRoot);
23689
+ if (!envPid) throw new Error("No app environment associated with the current directory.");
23690
+ auth_setRepoContext(projectRoot);
23691
+ const anvilUrl = resolveAnvilUrl();
23692
+ const appId = await resolvePrimaryAppId(projectRoot, anvilUrl);
23693
+ if (!appId) throw new Error("No Anvil app found in current directory. Make sure you're in a directory with an Anvil app git remote.");
23694
+ logger_logger.info(await ensureEnvironmentUrl(appId, envPid, {
23695
+ anvilUrl
23696
+ }));
23697
+ } catch (error) {
23698
+ logger_logger.error(errors_getErrorMessage(error));
23707
23699
  process.exit(1);
23708
23700
  }
23709
23701
  });
@@ -24128,7 +24120,8 @@ print(json.dumps({"issues": issues}))
24128
24120
  registerVersionCommand(program, VERSION);
24129
24121
  registerConfigureCommand(program, VERSION);
24130
24122
  registerDepsCommand(program);
24131
- registerTablesCommand(program);
24123
+ registerDbCommand(program);
24124
+ registerEnvCommand(program);
24132
24125
  program.command("update").description("Update anvil to the latest version").alias("u").action(async ()=>{
24133
24126
  await handleUpdateCommand();
24134
24127
  });
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerDbCommand(program: Command): void;
3
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/commands/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4CxD"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerEnvCommand(program: Command): void;
3
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/commands/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgCzD"}
@@ -13,5 +13,6 @@ export { registerConvertTemplateCommand } from "./convertTemplate";
13
13
  export { registerVersionCommand } from "./version";
14
14
  export { registerConfigureCommand } from "./configure";
15
15
  export { registerDepsCommand } from "./deps";
16
- export { registerTablesCommand } from "./tables";
16
+ export { registerDbCommand } from "./db";
17
+ export { registerEnvCommand } from "./env";
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC"}
package/dist/index.js CHANGED
@@ -14578,6 +14578,14 @@ Promise.resolve()
14578
14578
  html: htmlContent
14579
14579
  };
14580
14580
  }
14581
+ function formatHttpError(prefix, status, body) {
14582
+ if (!body) return `${prefix}: ${status}`;
14583
+ try {
14584
+ const parsed = JSON.parse(body);
14585
+ if ("string" == typeof parsed.error && parsed.error.trim()) return `${prefix}: ${parsed.error} (${status})`;
14586
+ } catch {}
14587
+ return `${prefix}: ${status} ${body}`;
14588
+ }
14581
14589
  const ANVIL_GITIGNORE_ENTRY = "/.anvil/";
14582
14590
  async function ensureProjectGitignoreIgnoresAnvilDir(projectRoot) {
14583
14591
  const rootGitignorePath = external_path_default().join(projectRoot, ".gitignore");
@@ -14596,14 +14604,6 @@ Promise.resolve()
14596
14604
  const ANVIL_DEPS_DIR = ".anvil/deps";
14597
14605
  const ANVIL_DEPS_MANIFEST = "manifest.json";
14598
14606
  const DEPS_MANIFEST_VERSION = 2;
14599
- function formatFetchError(prefix, status, errorBody) {
14600
- if (!errorBody) return `${prefix}: ${status}`;
14601
- try {
14602
- const parsed = JSON.parse(errorBody);
14603
- if ("string" == typeof parsed.error && parsed.error.trim()) return `${prefix}: ${parsed.error} (${status})`;
14604
- } catch {}
14605
- return `${prefix}: ${status} ${errorBody}`;
14606
- }
14607
14607
  async function fetchAllDependencies(appId, anvilUrl = resolveAnvilUrl(), options = {}) {
14608
14608
  const { commit, includeDocs = true, knownDependencies = [] } = options;
14609
14609
  const token = await auth_getValidAuthToken(anvilUrl);
@@ -14622,7 +14622,7 @@ Promise.resolve()
14622
14622
  });
14623
14623
  if (!resp.ok) {
14624
14624
  const errorBody = await resp.text();
14625
- throw new Error(formatFetchError("Failed to fetch dependencies", resp.status, errorBody));
14625
+ throw new Error(formatHttpError("Failed to fetch dependencies", resp.status, errorBody));
14626
14626
  }
14627
14627
  return await resp.json();
14628
14628
  }
@@ -1 +1 @@
1
- {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8BpC,OAAO,EAAyD,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAiC3G,KAAK,sBAAsB,GAAG,eAAe,GAAG;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAoKF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAO7F;AAmLD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,EAAE,CAezE;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAwFzD;AAiBD,wBAAgB,YAAY,IAAI,OAAO,CAkGtC"}
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BpC,OAAO,EAAyD,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAiC3G,KAAK,sBAAsB,GAAG,eAAe,GAAG;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAoKF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAO7F;AAmLD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,EAAE,CAezE;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAwFzD;AAiBD,wBAAgB,YAAY,IAAI,OAAO,CAmGtC"}
@@ -0,0 +1,7 @@
1
+ export interface ApplyDatabaseSchemaOptions {
2
+ anvilUrl?: string;
3
+ projectRoot?: string;
4
+ }
5
+ /** Apply the current app environment's source schema to its database. */
6
+ export declare function applyDatabaseSchema(appId: string, options?: ApplyDatabaseSchemaOptions): Promise<Record<string, never>>;
7
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/services/db.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,0BAA0B;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,yEAAyE;AACzE,wBAAsB,mBAAmB,CACrC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,0BAA+B,GACzC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAwBhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../src/services/deps.ts"],"names":[],"mappings":"AAcA,QAAA,MAAM,qBAAqB,IAAI,CAAC;AAGhC,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,2BAA2B;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,+BAA+B,EAAE,CAAC;CACzD;AAED,MAAM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AAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA4BhG;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAEjF;AA0HD;;GAEG;AACH,wBAAsB,mBAAmB,CACrC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACxC,OAAO,CAAC,IAAI,CAAC,CA+Cf;AAMD;;GAEG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvE;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAO9E"}
@@ -0,0 +1,5 @@
1
+ export interface EnsureEnvironmentUrlOptions {
2
+ anvilUrl?: string;
3
+ }
4
+ export declare function ensureEnvironmentUrl(appId: string, envPid: string, options?: EnsureEnvironmentUrlOptions): Promise<string>;
5
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/services/environment.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,2BAA2B;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,oBAAoB,CACtC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,2BAAgC,GAC1C,OAAO,CAAC,MAAM,CAAC,CAiBjB"}
@@ -0,0 +1,2 @@
1
+ export declare function formatHttpError(prefix: string, status: number, body: string): string;
2
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/services/http.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAepF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anvil-works/anvil-cli",
3
- "version": "0.8.0-canary.15",
3
+ "version": "0.8.0-canary.16",
4
4
  "description": "CLI tool for developing Anvil apps locally",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/api.d.ts",
@@ -1,7 +0,0 @@
1
- /**
2
- * Tables command for anvil-cli.
3
- * Manages table mappings - fetch, status, clear.
4
- */
5
- import { Command } from "commander";
6
- export declare function registerTablesCommand(program: Command): void;
7
- //# sourceMappingURL=tables.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/commands/tables.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoE5D"}
@@ -1,27 +0,0 @@
1
- export interface TableMapping {
2
- table_id: number;
3
- python_name: string;
4
- name: string;
5
- }
6
- export interface TableMappingsResponse {
7
- tables: TableMapping[];
8
- }
9
- /**
10
- * Fetch table mappings from the Anvil server.
11
- * Extracts table_id -> python_name mappings from all databases.
12
- */
13
- export declare function fetchTableMappings(appId: string, anvilUrl?: string): Promise<TableMappingsResponse>;
14
- /**
15
- * Write table mappings to .anvil/table-mappings.json
16
- */
17
- export declare function writeTableMappings(projectRoot: string, mappings: TableMappingsResponse): Promise<void>;
18
- /**
19
- * Read table mappings from .anvil/table-mappings.json
20
- * Returns null if file does not exist.
21
- */
22
- export declare function readTableMappings(projectRoot: string): Promise<TableMappingsResponse | null>;
23
- /**
24
- * Clear table mappings file.
25
- */
26
- export declare function clearTableMappings(projectRoot: string): Promise<void>;
27
- //# sourceMappingURL=tables.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/services/tables.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IAClC,MAAM,EAAE,YAAY,EAAE,CAAC;CAC1B;AAkBD;;;GAGG;AACH,wBAAsB,kBAAkB,CACpC,KAAK,EAAE,MAAM,EACb,QAAQ,SAAoB,GAC7B,OAAO,CAAC,qBAAqB,CAAC,CAwBhC;AAMD;;GAEG;AACH,wBAAsB,kBAAkB,CACpC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,qBAAqB,GAChC,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACnC,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAQvC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG3E"}