@xanots/sdk 0.0.5 → 0.0.7

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.
Files changed (83) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +3 -3
  3. package/dist/.build-fingerprint +1 -1
  4. package/dist/{agent-file-refresh-IJ7GN2FJ.js → agent-file-refresh-4W37DGXS.js} +4 -4
  5. package/dist/bin.js +8 -8
  6. package/dist/branch-commands-PBQ36L4A.js +134 -0
  7. package/dist/{chunk-CYJ7R3AD.js → chunk-2V3JUXTF.js} +24 -11
  8. package/dist/{chunk-OR43PDCW.js → chunk-3EYUR3TX.js} +2 -2
  9. package/dist/{chunk-SG4UBJ47.js → chunk-3QW5NFZJ.js} +26 -5
  10. package/dist/{chunk-7SISR3CS.js → chunk-4PE4ZAB7.js} +3 -3
  11. package/dist/{chunk-PGBK64U5.js → chunk-4PTSTDIG.js} +2 -2
  12. package/dist/{live-diff-FP4SFNT4.js → chunk-5HCDZ2XN.js} +67 -6
  13. package/dist/{chunk-OARSPAIE.js → chunk-5PDOAR77.js} +58 -38
  14. package/dist/{chunk-5WGEURVI.js → chunk-6AAT2AYQ.js} +21 -1
  15. package/dist/{chunk-QA5ICJ4M.js → chunk-7BUTRVKA.js} +3 -3
  16. package/dist/{chunk-YUBJLB6G.js → chunk-7JDT4PBU.js} +75 -8
  17. package/dist/{chunk-LLWK6H77.js → chunk-BKDJN76G.js} +31 -1
  18. package/dist/{chunk-MS3BRZAZ.js → chunk-CL2H2WYE.js} +50 -27
  19. package/dist/{chunk-KXCPZUUM.js → chunk-DBHE35JM.js} +8 -67
  20. package/dist/chunk-EQW3YT5U.js +159 -0
  21. package/dist/{chunk-BPEEGJJA.js → chunk-FAWNUE2U.js} +39 -8
  22. package/dist/{chunk-ZGA5MUNC.js → chunk-FDKR4YMN.js} +2 -2
  23. package/dist/{chunk-APOR6TCV.js → chunk-H2DEDWQF.js} +4 -4
  24. package/dist/{chunk-PXXLBXOP.js → chunk-JAVB27HL.js} +2 -2
  25. package/dist/{chunk-AAFBSOSD.js → chunk-JQJPFUZI.js} +3 -3
  26. package/dist/{chunk-IVP6TS26.js → chunk-JQLR64UC.js} +6 -5
  27. package/dist/{chunk-FN4OQT2J.js → chunk-JUHKEAHJ.js} +4 -4
  28. package/dist/{chunk-WJYB7DSI.js → chunk-MDXR5E5Q.js} +2 -2
  29. package/dist/{chunk-WGDAOOXG.js → chunk-MU3O43L2.js} +3 -3
  30. package/dist/{chunk-YUPQOLFX.js → chunk-NJGNUVXR.js} +15 -4
  31. package/dist/{chunk-F5T45NAM.js → chunk-OKNSR7MT.js} +45 -2
  32. package/dist/{chunk-MFIHIS6B.js → chunk-OYMR5AMJ.js} +2 -2
  33. package/dist/{chunk-QUUB7HYK.js → chunk-P5C2YKAM.js} +2 -2
  34. package/dist/{chunk-6DHJVLYP.js → chunk-Q77KNEUL.js} +1 -1
  35. package/dist/{chunk-D6OGU2AI.js → chunk-QIWBCS7N.js} +2 -2
  36. package/dist/cli.d.ts +28 -2
  37. package/dist/cli.js +7 -7
  38. package/dist/{codegen-command-BLOS3GR3.js → codegen-command-DYH4H4TD.js} +18 -18
  39. package/dist/{completion-GHP5RRLQ.js → completion-A6BZ3XGU.js} +8 -7
  40. package/dist/{deploy-command-XOH76USO.js → deploy-command-HM57BINV.js} +15 -15
  41. package/dist/{env-target-POGJMD6Q.js → env-target-WA3BH5YU.js} +6 -6
  42. package/dist/{ephemeral-command-46SL27GJ.js → ephemeral-command-SD2KLX4P.js} +10 -10
  43. package/dist/index.d.ts +69 -26
  44. package/dist/index.js +6 -6
  45. package/dist/init-command-VIPWAQYS.js +30 -0
  46. package/dist/internal.d.ts +2 -2
  47. package/dist/internal.js +120 -62
  48. package/dist/{io-7VIA5SON.js → io-M7XZEMK7.js} +3 -3
  49. package/dist/live-diff-QK4KC2FJ.js +12 -0
  50. package/dist/{lock-KXOJIGCG.js → lock-GFXD6G2E.js} +6 -2
  51. package/dist/{lock-commands-6UONZW26.js → lock-commands-7VJKAXV6.js} +8 -8
  52. package/dist/{login-command-SG7IWTHW.js → login-command-DFCURZLC.js} +6 -6
  53. package/dist/{logout-command-J2AG5NKC.js → logout-command-WXVZQCAV.js} +2 -2
  54. package/dist/{marketplace-command-NKTQ3VPS.js → marketplace-command-BCOAAN2I.js} +3 -3
  55. package/dist/{meta-client-OW5WKWW7.js → meta-client-57ZWVHST.js} +2 -2
  56. package/dist/node.d.ts +2 -2
  57. package/dist/node.js +10 -10
  58. package/dist/{profile-command-ZPC2DPFV.js → profile-command-QJAAUZIV.js} +3 -3
  59. package/dist/{release-command-FKQ6E3TD.js → release-command-3IET7YII.js} +206 -26
  60. package/dist/{sandbox-details-command-DMY2KGA2.js → sandbox-details-command-EDO56IY3.js} +4 -4
  61. package/dist/{sandbox-export-command-R6QMEK3D.js → sandbox-export-command-MO6DEZ7Z.js} +5 -5
  62. package/dist/scaffold.d.ts +10 -13
  63. package/dist/scaffold.js +3 -3
  64. package/dist/{store-BJONDJoZ.d.ts → store-DfuWu1tE.d.ts} +1 -1
  65. package/dist/{test-command-56IAEYHX.js → test-command-S7SMRWMP.js} +8 -8
  66. package/dist/{upgrade-command-M2DZ3ZPD.js → upgrade-command-TZYSGXP7.js} +13 -13
  67. package/dist/{validate-command-CIBQJND7.js → validate-command-MMXEVHH3.js} +10 -10
  68. package/dist/{workspace-command-HZS43PHJ.js → workspace-command-X6L7HTXO.js} +24 -20
  69. package/guides/environment.md +6 -3
  70. package/guides/scaffold.md +3 -2
  71. package/llms/fields.md +8 -0
  72. package/llms/kinds-core.md +2 -1
  73. package/llms/lambda.md +1 -1
  74. package/llms/legacy.md +1 -1
  75. package/llms/lock.md +32 -0
  76. package/llms/object-kinds.md +2 -2
  77. package/llms/statements-calls.md +10 -3
  78. package/llms/statements-data.md +2 -1
  79. package/llms-full.txt +108 -58
  80. package/llms.txt +49 -49
  81. package/manifest.json +2 -2
  82. package/package.json +1 -1
  83. package/dist/init-command-NCRPVFGE.js +0 -30
@@ -9,11 +9,11 @@ import {
9
9
  unknownFlag,
10
10
  unknownHelpTopic,
11
11
  unknownSubcommand
12
- } from "./chunk-IVP6TS26.js";
12
+ } from "./chunk-JQLR64UC.js";
13
13
  import {
14
14
  readLockFile,
15
15
  writeLockFile
16
- } from "./chunk-MFIHIS6B.js";
16
+ } from "./chunk-OYMR5AMJ.js";
17
17
  import {
18
18
  detail,
19
19
  info,
@@ -24,13 +24,13 @@ import {
24
24
  Xano,
25
25
  assertSeedIds,
26
26
  coerceSeedRowValues
27
- } from "./chunk-BPEEGJJA.js";
27
+ } from "./chunk-FAWNUE2U.js";
28
28
  import {
29
29
  getCommand,
30
30
  getSubcommand,
31
31
  isCommand,
32
32
  suggest
33
- } from "./chunk-F5T45NAM.js";
33
+ } from "./chunk-OKNSR7MT.js";
34
34
  import {
35
35
  FILTER_NAMES,
36
36
  KNOWLEDGE_DIR,
@@ -44,7 +44,7 @@ import {
44
44
  pathSegment,
45
45
  serializeBundle,
46
46
  tableColumns
47
- } from "./chunk-YUPQOLFX.js";
47
+ } from "./chunk-NJGNUVXR.js";
48
48
  import {
49
49
  WORKSPACE_KEY,
50
50
  createLockContext,
@@ -56,7 +56,7 @@ import {
56
56
  seedLockOverrides,
57
57
  serializeLock,
58
58
  validateLockModel
59
- } from "./chunk-YUBJLB6G.js";
59
+ } from "./chunk-7JDT4PBU.js";
60
60
 
61
61
  // src/emit/cli.ts
62
62
  import { pathToFileURL as pathToFileURL3, fileURLToPath as fileURLToPath3 } from "url";
@@ -430,6 +430,10 @@ function parseArgs(argv) {
430
430
  let resetData = false;
431
431
  let seed = false;
432
432
  let replace = false;
433
+ let branch;
434
+ let setLive = false;
435
+ let allowSharedSchemaChanges = false;
436
+ let backupBranch;
433
437
  let emit2;
434
438
  let json = false;
435
439
  let open = false;
@@ -624,6 +628,21 @@ function parseArgs(argv) {
624
628
  seed = true;
625
629
  } else if (arg === "--replace") {
626
630
  replace = true;
631
+ } else if (arg === "--branch" || arg.startsWith("--branch=")) {
632
+ const value = arg === "--branch" ? rest[++i] : arg.slice("--branch=".length);
633
+ if (value === void 0 || value === "") {
634
+ throw new Error("--branch expects a branch label (e.g. `--branch staging`).");
635
+ }
636
+ branch = value;
637
+ } else if (arg === "--set-live") {
638
+ setLive = true;
639
+ } else if (arg === "--allow-shared-schema-changes") {
640
+ allowSharedSchemaChanges = true;
641
+ } else if (arg === "--backup-branch") {
642
+ backupBranch = true;
643
+ } else if (arg.startsWith("--backup-branch=")) {
644
+ const value = arg.slice("--backup-branch=".length);
645
+ backupBranch = value === "" ? true : value;
627
646
  } else if (arg === "--json") {
628
647
  json = true;
629
648
  } else if (arg === "--open") {
@@ -724,6 +743,10 @@ function parseArgs(argv) {
724
743
  resetData,
725
744
  seed,
726
745
  replace,
746
+ branch,
747
+ setLive,
748
+ allowSharedSchemaChanges,
749
+ backupBranch,
727
750
  emit: emit2,
728
751
  json,
729
752
  open,
@@ -932,11 +955,11 @@ async function run(argv) {
932
955
  return;
933
956
  }
934
957
  if (command === "init") {
935
- const { runInitCommand } = await import("./init-command-NCRPVFGE.js");
958
+ const { runInitCommand } = await import("./init-command-VIPWAQYS.js");
936
959
  return runInitCommand(args);
937
960
  }
938
961
  if (command === "completion") {
939
- const { isCompletionShell, runCompletionCommand, COMPLETION_SHELLS } = await import("./completion-GHP5RRLQ.js");
962
+ const { isCompletionShell, runCompletionCommand, COMPLETION_SHELLS } = await import("./completion-A6BZ3XGU.js");
940
963
  const shell = args.positionals[0];
941
964
  if (shell === void 0 || !isCompletionShell(shell)) {
942
965
  throw new UsageError(
@@ -947,31 +970,31 @@ async function run(argv) {
947
970
  return runCompletionCommand(shell);
948
971
  }
949
972
  if (command === "upgrade") {
950
- const { runUpgradeCommand } = await import("./upgrade-command-M2DZ3ZPD.js");
973
+ const { runUpgradeCommand } = await import("./upgrade-command-TZYSGXP7.js");
951
974
  return runUpgradeCommand(args);
952
975
  }
953
976
  if (command === "lock") {
954
- const { runLockCommand } = await import("./lock-commands-6UONZW26.js");
977
+ const { runLockCommand } = await import("./lock-commands-7VJKAXV6.js");
955
978
  return runLockCommand(args);
956
979
  }
957
980
  if (command === "login") {
958
- const { runLoginCommand } = await import("./login-command-SG7IWTHW.js");
981
+ const { runLoginCommand } = await import("./login-command-DFCURZLC.js");
959
982
  return runLoginCommand(args);
960
983
  }
961
984
  if (command === "logout") {
962
- const { runLogoutCommand } = await import("./logout-command-J2AG5NKC.js");
985
+ const { runLogoutCommand } = await import("./logout-command-WXVZQCAV.js");
963
986
  return runLogoutCommand(args);
964
987
  }
965
988
  if (command === "deploy") {
966
- const { runDeployCommand } = await import("./deploy-command-XOH76USO.js");
989
+ const { runDeployCommand } = await import("./deploy-command-HM57BINV.js");
967
990
  return runDeployCommand(args);
968
991
  }
969
992
  if (command === "ephemeral") {
970
- const { runEphemeralCommand } = await import("./ephemeral-command-46SL27GJ.js");
993
+ const { runEphemeralCommand } = await import("./ephemeral-command-SD2KLX4P.js");
971
994
  return runEphemeralCommand(args);
972
995
  }
973
996
  if (command === "release") {
974
- const { runReleaseCommand } = await import("./release-command-FKQ6E3TD.js");
997
+ const { runReleaseCommand } = await import("./release-command-3IET7YII.js");
975
998
  return runReleaseCommand(args);
976
999
  }
977
1000
  if (command === "sandbox") {
@@ -979,47 +1002,47 @@ async function run(argv) {
979
1002
  throw removedSubcommand("sandbox", "deploy");
980
1003
  }
981
1004
  if (args.subcommand === "details") {
982
- const { runSandboxDetailsCommand } = await import("./sandbox-details-command-DMY2KGA2.js");
1005
+ const { runSandboxDetailsCommand } = await import("./sandbox-details-command-EDO56IY3.js");
983
1006
  return runSandboxDetailsCommand(args);
984
1007
  }
985
1008
  if (args.subcommand === "export") {
986
- const { runSandboxExportCommand } = await import("./sandbox-export-command-R6QMEK3D.js");
1009
+ const { runSandboxExportCommand } = await import("./sandbox-export-command-MO6DEZ7Z.js");
987
1010
  return runSandboxExportCommand(args);
988
1011
  }
989
1012
  if (args.subcommand === "codegen") {
990
- const { runCodegenCommand } = await import("./codegen-command-BLOS3GR3.js");
1013
+ const { runCodegenCommand } = await import("./codegen-command-DYH4H4TD.js");
991
1014
  return runCodegenCommand(args, { kind: "sandbox" });
992
1015
  }
993
1016
  throw unknownSubcommand("sandbox", args.subcommand);
994
1017
  }
995
1018
  if (command === "test") {
996
- const { runTestCommand } = await import("./test-command-56IAEYHX.js");
1019
+ const { runTestCommand } = await import("./test-command-S7SMRWMP.js");
997
1020
  return runTestCommand(args);
998
1021
  }
999
1022
  if (command === "workspace") {
1000
- const { runWorkspaceCommand } = await import("./workspace-command-HZS43PHJ.js");
1023
+ const { runWorkspaceCommand } = await import("./workspace-command-X6L7HTXO.js");
1001
1024
  return runWorkspaceCommand(args);
1002
1025
  }
1003
1026
  if (command === "codegen") {
1004
- const { runCodegenCommand } = await import("./codegen-command-BLOS3GR3.js");
1027
+ const { runCodegenCommand } = await import("./codegen-command-DYH4H4TD.js");
1005
1028
  return runCodegenCommand(args, { kind: "file" });
1006
1029
  }
1007
1030
  if (command === "profile") {
1008
1031
  if (args.subcommand !== "me") {
1009
1032
  throw unknownSubcommand("profile", args.subcommand);
1010
1033
  }
1011
- const { runProfileCommand } = await import("./profile-command-ZPC2DPFV.js");
1034
+ const { runProfileCommand } = await import("./profile-command-QJAAUZIV.js");
1012
1035
  return runProfileCommand(args);
1013
1036
  }
1014
1037
  if (command === "whoami") {
1015
- const { runProfileCommand } = await import("./profile-command-ZPC2DPFV.js");
1038
+ const { runProfileCommand } = await import("./profile-command-QJAAUZIV.js");
1016
1039
  return runProfileCommand(args);
1017
1040
  }
1018
1041
  if (command === "marketplace") {
1019
1042
  if (!["list", "search", "details", "install"].includes(args.subcommand ?? "")) {
1020
1043
  throw unknownSubcommand("marketplace", args.subcommand);
1021
1044
  }
1022
- const marketplace = await import("./marketplace-command-NKTQ3VPS.js");
1045
+ const marketplace = await import("./marketplace-command-BCOAAN2I.js");
1023
1046
  if (args.subcommand === "list") return marketplace.runMarketplaceListCommand(args);
1024
1047
  if (args.subcommand === "search") return marketplace.runMarketplaceSearchCommand(args);
1025
1048
  if (args.subcommand === "details") return marketplace.runMarketplaceDetailsCommand(args);
@@ -1029,7 +1052,7 @@ async function run(argv) {
1029
1052
  throw unknownCommand("push");
1030
1053
  }
1031
1054
  if (command === "validate") {
1032
- const { runValidateCommand } = await import("./validate-command-CIBQJND7.js");
1055
+ const { runValidateCommand } = await import("./validate-command-MMXEVHH3.js");
1033
1056
  return runValidateCommand(args);
1034
1057
  }
1035
1058
  if (command !== "compile" && command !== "export" && command !== "paths" && command !== "routes") {
@@ -1061,7 +1084,7 @@ async function run(argv) {
1061
1084
  }
1062
1085
  async function refreshAgentGuidance() {
1063
1086
  try {
1064
- const { refreshAgentFiles } = await import("./agent-file-refresh-IJ7GN2FJ.js");
1087
+ const { refreshAgentFiles } = await import("./agent-file-refresh-4W37DGXS.js");
1065
1088
  const refreshed = refreshAgentFiles({
1066
1089
  projectDir: process.cwd(),
1067
1090
  sdkVersion: readVersion()
@@ -1294,4 +1317,4 @@ export {
1294
1317
  exportBundleJson,
1295
1318
  compileBundle
1296
1319
  };
1297
- //# sourceMappingURL=chunk-MS3BRZAZ.js.map
1320
+ //# sourceMappingURL=chunk-CL2H2WYE.js.map
@@ -2,7 +2,7 @@ import {
2
2
  presetFilePath,
3
3
  resolveAiPresets,
4
4
  scaffoldProject
5
- } from "./chunk-7SISR3CS.js";
5
+ } from "./chunk-4PE4ZAB7.js";
6
6
  import {
7
7
  runNpmCapturingStderr
8
8
  } from "./chunk-ZSYZTGJH.js";
@@ -11,7 +11,7 @@ import {
11
11
  allFrontendPresets,
12
12
  findFrontendPreset,
13
13
  resolveFrameworkFlag
14
- } from "./chunk-WGDAOOXG.js";
14
+ } from "./chunk-MU3O43L2.js";
15
15
  import {
16
16
  initLanding,
17
17
  renderApiTs,
@@ -27,11 +27,9 @@ import {
27
27
  renderViteConfig,
28
28
  renderXanoExampleMd,
29
29
  renderXanoIndex
30
- } from "./chunk-QUUB7HYK.js";
30
+ } from "./chunk-P5C2YKAM.js";
31
31
  import {
32
32
  DEFAULT_DARK_MODE,
33
- curatedThemes,
34
- defaultTheme,
35
33
  defaultThemeChoice,
36
34
  normalizeRadius,
37
35
  resolveDarkModeFlag,
@@ -39,15 +37,14 @@ import {
39
37
  resolveIconsFlag,
40
38
  resolveThemeFlag,
41
39
  themeFromRegistryItem,
42
- themeSwatch,
43
40
  withRadius
44
- } from "./chunk-6DHJVLYP.js";
41
+ } from "./chunk-Q77KNEUL.js";
45
42
  import {
46
43
  readVersion
47
- } from "./chunk-MS3BRZAZ.js";
44
+ } from "./chunk-CL2H2WYE.js";
48
45
  import {
49
46
  UsageError
50
- } from "./chunk-IVP6TS26.js";
47
+ } from "./chunk-JQLR64UC.js";
51
48
  import {
52
49
  blank,
53
50
  detail,
@@ -291,7 +288,6 @@ async function resolveFrontendPreset(flag) {
291
288
  }
292
289
 
293
290
  // src/emit/theme-resolve.ts
294
- import { createInterface as createInterface2 } from "readline/promises";
295
291
  import { readFileSync as readFileSync2 } from "fs";
296
292
  import { resolve as resolvePath } from "path";
297
293
  function isRegistryRef(value) {
@@ -332,54 +328,6 @@ function parseJson(text, source) {
332
328
  async function themeFromFlag(raw) {
333
329
  return isRegistryRef(raw.trim()) ? loadRegistryTheme(raw.trim()) : resolveThemeFlag(raw);
334
330
  }
335
- function swatch(theme, color) {
336
- if (!color) return "";
337
- const blocks = themeSwatch(theme).map(({ r, g, b }) => `\x1B[38;2;${r};${g};${b}m\u2588\x1B[0m`).join("");
338
- return blocks === "" ? "" : `${blocks} `;
339
- }
340
- function colorEnabled() {
341
- if (process.env.FORCE_COLOR) return process.env.FORCE_COLOR !== "0";
342
- return !process.env.NO_COLOR && process.stderr.isTTY === true;
343
- }
344
- async function promptTheme() {
345
- const themes = curatedThemes();
346
- const color = colorEnabled();
347
- const rl = createInterface2({ input: process.stdin, output: process.stderr });
348
- try {
349
- process.stderr.write(
350
- `
351
- Which theme? (shadcn/ui color tokens \u2014 everything else is identical)
352
- ` + themes.map((t, i) => ` ${i + 1}) ${swatch(t, color)}${t.label}${i === 0 ? " (default)" : ""}`).join("\n") + `
353
- ${style.dim(
354
- ` \u2026or any <base>-<accent> pair, or a registry theme URL. See \`xanots init --help\`.`
355
- )}
356
- `
357
- );
358
- for (; ; ) {
359
- const answer = (await rl.question(`Enter a number, a theme, or leave blank for the default: `)).trim();
360
- if (answer === "") return defaultTheme();
361
- const byIndex = Number.parseInt(answer, 10);
362
- if (Number.isInteger(byIndex) && byIndex >= 1 && byIndex <= themes.length) {
363
- return themes[byIndex - 1];
364
- }
365
- if (!isRegistryRef(answer)) {
366
- try {
367
- return resolveThemeFlag(answer);
368
- } catch {
369
- return defaultTheme();
370
- }
371
- }
372
- try {
373
- return await loadRegistryTheme(answer);
374
- } catch (err) {
375
- process.stderr.write(`${style.yellow("!")} ${err instanceof Error ? err.message : String(err)}
376
- `);
377
- }
378
- }
379
- } finally {
380
- rl.close();
381
- }
382
- }
383
331
  async function resolveThemeChoice(args) {
384
332
  const dark = args.dark === void 0 || args.dark === "" ? DEFAULT_DARK_MODE : resolveDarkModeFlag(args.dark);
385
333
  const fonts = {
@@ -388,14 +336,7 @@ async function resolveThemeChoice(args) {
388
336
  ...args.fontHeading !== void 0 && args.fontHeading !== "" ? { heading: resolveFontFlag(args.fontHeading, "heading") } : {}
389
337
  };
390
338
  const icons = args.icons === void 0 || args.icons === "" ? void 0 : resolveIconsFlag(args.icons).id;
391
- let theme;
392
- if (args.theme !== void 0 && args.theme !== "") {
393
- theme = await themeFromFlag(args.theme);
394
- } else if (process.stdin.isTTY && process.stderr.isTTY) {
395
- theme = await promptTheme();
396
- } else {
397
- theme = defaultThemeChoice().theme;
398
- }
339
+ let theme = args.theme !== void 0 && args.theme !== "" ? await themeFromFlag(args.theme) : defaultThemeChoice().theme;
399
340
  if (args.radius !== void 0 && args.radius !== "") {
400
341
  theme = withRadius(theme, normalizeRadius(args.radius));
401
342
  }
@@ -529,4 +470,4 @@ export {
529
470
  projectShellFiles,
530
471
  runInitCommand
531
472
  };
532
- //# sourceMappingURL=chunk-KXCPZUUM.js.map
473
+ //# sourceMappingURL=chunk-DBHE35JM.js.map
@@ -0,0 +1,159 @@
1
+ import {
2
+ describeTransportFailure,
3
+ httpFailure
4
+ } from "./chunk-3IGNIP6R.js";
5
+
6
+ // src/deploy/branch.ts
7
+ var BRANCH_TIMEOUT_MS = 3e4;
8
+ var DEFAULT_BRANCH_LABEL = "v1";
9
+ function endpoint(baseUrl, workspaceId, suffix = "") {
10
+ return `${baseUrl.replace(/\/$/, "")}/api:meta/workspace/${workspaceId}/branch${suffix}`;
11
+ }
12
+ function assertUsableBranchLabel(label, flag) {
13
+ if (label.trim() === "") {
14
+ throw new Error(
15
+ `\`${flag}\` needs a branch label and was given an empty one.
16
+ The engine does not reject an empty label \u2014 it would create a branch with no name, which cannot be selected, promoted or deleted afterwards.`
17
+ );
18
+ }
19
+ if (label === DEFAULT_BRANCH_LABEL) {
20
+ throw new Error(
21
+ `\`${flag}=${DEFAULT_BRANCH_LABEL}\` names the workspace's DEFAULT branch, which is reserved.
22
+ The engine does not store it as an ordinary branch, so it is not caught by an "already exists" check \u2014 targeting it does not stage anything, it writes to the branch every workspace starts on.
23
+ Pick a different label, or drop the flag to release to whichever branch is currently live.`
24
+ );
25
+ }
26
+ }
27
+ async function call(auth, url, init, action) {
28
+ let res;
29
+ try {
30
+ res = await fetch(url, {
31
+ signal: AbortSignal.timeout(BRANCH_TIMEOUT_MS),
32
+ ...init,
33
+ // MERGED, never spread over: a caller passing `Content-Type` would
34
+ // otherwise replace the whole header object and send the request
35
+ // unauthenticated, which reads as a 401 from the endpoint rather than as
36
+ // the local mistake it is. Caller keys win on conflict; `Authorization` is
37
+ // not a key any caller here sets.
38
+ headers: {
39
+ accept: "application/json",
40
+ Authorization: `Bearer ${auth.access_token}`,
41
+ ...init.headers ?? {}
42
+ }
43
+ });
44
+ } catch (err) {
45
+ throw new Error(`${action} could not reach ${url}: ${describeTransportFailure(err)}`, { cause: err });
46
+ }
47
+ const text = await res.text();
48
+ if (!res.ok) {
49
+ throw new Error(httpFailure(action, { status: res.status, statusText: res.statusText }, text));
50
+ }
51
+ return text;
52
+ }
53
+ function toRecord(entry) {
54
+ if (entry === null || typeof entry !== "object") return void 0;
55
+ const row = entry;
56
+ const label = row.label;
57
+ if (typeof label !== "string" || label === "") return void 0;
58
+ return {
59
+ ...typeof row.id === "number" ? { id: row.id } : {},
60
+ label,
61
+ // Absent means false: the list shape omits `live` on non-live rows.
62
+ live: row.live === true,
63
+ backup: row.backup === true,
64
+ ...typeof row.created_at === "string" ? { createdAt: row.created_at } : {}
65
+ };
66
+ }
67
+ async function listBranches(auth, opts) {
68
+ const text = await call(auth, endpoint(opts.baseUrl, opts.workspaceId), { method: "GET" }, "list branches");
69
+ let parsed;
70
+ try {
71
+ parsed = JSON.parse(text);
72
+ } catch {
73
+ throw new Error(`list branches: could not parse the response as JSON:
74
+ ${text}`);
75
+ }
76
+ if (!Array.isArray(parsed)) {
77
+ throw new Error(`list branches: expected an array of branches, got:
78
+ ${text}`);
79
+ }
80
+ return parsed.map(toRecord).filter((b) => b !== void 0);
81
+ }
82
+ function liveBranchLabel(branches) {
83
+ return branches.find((b) => b.live)?.label;
84
+ }
85
+ async function createBranch(auth, opts) {
86
+ assertUsableBranchLabel(opts.label, "branch label");
87
+ const text = await call(
88
+ auth,
89
+ endpoint(opts.baseUrl, opts.workspaceId),
90
+ {
91
+ method: "POST",
92
+ headers: { "Content-Type": "application/json" },
93
+ body: JSON.stringify({
94
+ source_branch: opts.sourceBranch ?? DEFAULT_BRANCH_LABEL,
95
+ label: opts.label,
96
+ description: opts.description ?? ""
97
+ })
98
+ },
99
+ "create branch"
100
+ );
101
+ let parsed;
102
+ try {
103
+ parsed = JSON.parse(text);
104
+ } catch {
105
+ throw new Error(`create branch: could not parse the response as JSON:
106
+ ${text}`);
107
+ }
108
+ const record = toRecord(parsed);
109
+ if (record === void 0) {
110
+ throw new Error(`create branch: the response named no branch:
111
+ ${text}`);
112
+ }
113
+ return record;
114
+ }
115
+ async function setLiveBranch(auth, opts) {
116
+ await call(
117
+ auth,
118
+ `${endpoint(opts.baseUrl, opts.workspaceId, `/${encodeURIComponent(opts.label)}/live`)}`,
119
+ { method: "POST" },
120
+ "set live branch"
121
+ );
122
+ }
123
+ async function deleteBranch(auth, opts) {
124
+ await call(
125
+ auth,
126
+ endpoint(opts.baseUrl, opts.workspaceId, `/${encodeURIComponent(opts.label)}`),
127
+ { method: "DELETE" },
128
+ "delete branch"
129
+ );
130
+ }
131
+ function assertBranchAbsent(branches, label) {
132
+ if (!branches.some((b) => b.label === label)) return;
133
+ throw new Error(
134
+ `A branch named "${label}" already exists in this workspace.
135
+ Releasing into it is not offered: it would be a fresh import over a branch someone may be reviewing, and the SDK cannot tell those apart.
136
+ Pick a label that is free, or delete "${label}" first with \`xanots workspace branch delete ${label}\`.`
137
+ );
138
+ }
139
+ function requireBranch(branches, label) {
140
+ const found = branches.find((b) => b.label === label);
141
+ if (found !== void 0) return found;
142
+ const known = branches.map((b) => b.label).join(", ");
143
+ throw new Error(
144
+ `This workspace has no branch named "${label}".
145
+ ` + (known === "" ? `It reports no branches at all.` : `It has: ${known}`)
146
+ );
147
+ }
148
+
149
+ export {
150
+ assertUsableBranchLabel,
151
+ listBranches,
152
+ liveBranchLabel,
153
+ createBranch,
154
+ setLiveBranch,
155
+ deleteBranch,
156
+ assertBranchAbsent,
157
+ requireBranch
158
+ };
159
+ //# sourceMappingURL=chunk-EQW3YT5U.js.map
@@ -12,18 +12,20 @@ import {
12
12
  middlewareEntryGuid,
13
13
  stackReferencesAuth,
14
14
  tableColumns
15
- } from "./chunk-YUPQOLFX.js";
15
+ } from "./chunk-NJGNUVXR.js";
16
16
  import {
17
17
  CANONICAL_PAYLOAD_KEYS,
18
18
  REFERENCEABLE_KINDS,
19
19
  WORKSPACE_KEY,
20
+ appNamesByGuid,
20
21
  deriveGuid,
21
22
  guidSeedHint,
22
23
  lockKey,
24
+ lockNameForObject,
23
25
  mintCanonical,
24
26
  recordObserved,
25
27
  resolveRef
26
- } from "./chunk-YUBJLB6G.js";
28
+ } from "./chunk-7JDT4PBU.js";
27
29
 
28
30
  // src/workspace/seed-coerce.ts
29
31
  function coerceScalarValue(label, column, type, value, values) {
@@ -467,6 +469,30 @@ function checkExpressionOperands(sections, bag) {
467
469
  }
468
470
  }
469
471
  }
472
+ var INTERPOLATED_OBJECT = "[object Object]";
473
+ function checkInterpolatedValues(sections, bag) {
474
+ for (const [payloadKey, arr] of Object.entries(sections)) {
475
+ for (const obj of arr ?? []) {
476
+ if (!obj || typeof obj !== "object") continue;
477
+ const name = obj.name;
478
+ const samples = [];
479
+ walkNodes(obj, (record) => {
480
+ if (typeof record.tag !== "string" || typeof record.value !== "string") return;
481
+ if (!record.value.includes(INTERPOLATED_OBJECT)) return;
482
+ if (samples.length < 2) {
483
+ const text = record.value.length > 60 ? `${record.value.slice(0, 57)}\u2026` : record.value;
484
+ samples.push(`\`${text}\` (tag \`${record.tag}\`)`);
485
+ }
486
+ });
487
+ if (samples.length === 0) continue;
488
+ const owner = `${payloadKey} "${typeof name === "string" ? name : "?"}"`;
489
+ bag.warn(
490
+ "value.interpolated-object",
491
+ `${owner} stores ${samples.join(" and ")} \u2014 \`[object Object]\` is the JS toString of a tagged value (\`ref()\`/\`inp()\`/\`c.*\`) interpolated into a template literal or \`+\` concatenation, which evaluates at BUILD time; the engine serves this text verbatim. Compose at runtime instead: \`withFilters(c.text("\u2026"), fl.concat(ref("\u2026")))\`, an \`obj({...})\` member, or \`c.expression\`.`
492
+ );
493
+ }
494
+ }
495
+ }
470
496
  function checkSeed(tables, bag) {
471
497
  for (const def of tables) {
472
498
  const source = def.seed;
@@ -680,22 +706,24 @@ function checkNullMatchArgs(sections, bag) {
680
706
  }
681
707
  }
682
708
  function checkSameNameSiblings(sections, bag) {
709
+ const appNames = appNamesByGuid(sections["app"]);
683
710
  for (const [payloadKey, arr] of Object.entries(sections)) {
684
711
  const guidsByName = /* @__PURE__ */ new Map();
685
712
  for (const obj of arr ?? []) {
686
713
  if (!obj || typeof obj !== "object") continue;
687
714
  const { name, guid } = obj;
688
715
  if (typeof name !== "string" || name === "" || typeof guid !== "string") continue;
689
- const guids = guidsByName.get(name) ?? /* @__PURE__ */ new Set();
716
+ const identity = lockNameForObject(payloadKey, obj, appNames);
717
+ const guids = guidsByName.get(identity) ?? /* @__PURE__ */ new Set();
690
718
  guids.add(guid);
691
- guidsByName.set(name, guids);
719
+ guidsByName.set(identity, guids);
692
720
  }
693
721
  for (const [name, guids] of guidsByName) {
694
722
  if (guids.size < 2) continue;
695
- const advice = payloadKey === "query" ? `Give them distinct names (\`${name}\` and \`${name}/create\` for a GET/POST pair \u2014 the verb still carries the semantics). An explicit \`guid\` clears the export-time collision but not this one.` : `${payloadKey} identity is composed from more than the name here, but the lock key is not \u2014 name them uniquely across the workspace.`;
723
+ const advice = payloadKey === "channel" || payloadKey === "message" || payloadKey === "realtime_server" ? `${payloadKey} identity is composed from more than the name here, but the lock key is not \u2014 name them uniquely across the workspace.` : `Rename one of them \u2014 an explicit \`guid\` clears the export-time collision but not this one.`;
696
724
  bag.warn(
697
725
  "lock.same-name-siblings",
698
- `${guids.size} ${payloadKey} objects share the name "${name}" while carrying different guids. This bundle exports, but a lock entry is keyed \`${payloadKey}:${name}\` and holds ONE guid, so \`xanots export --lock\` REFUSES the pair \u2014 and a committed \`xano.lock\` is the recommended workflow. ${advice} Fixing it now costs a rename; at the first locked export it costs the lock.`
726
+ `${guids.size} ${payloadKey} objects share the identity "${name}" while carrying different guids. This bundle exports, but a lock entry is keyed \`${payloadKey}:${name}\` and holds ONE guid, so \`xanots export --lock\` REFUSES the pair \u2014 and a committed \`xano.lock\` is the recommended workflow. ${advice} Fixing it now costs a rename; at the first locked export it costs the lock.`
699
727
  );
700
728
  }
701
729
  }
@@ -1405,6 +1433,7 @@ var Xano = class {
1405
1433
  checkMicroserviceBlocks(sections, bag);
1406
1434
  checkStacks(this.tableDefs, sections, bag);
1407
1435
  checkExpressionOperands(sections, bag);
1436
+ checkInterpolatedValues(sections, bag);
1408
1437
  checkReferences(this.bundleType, sections, this.workspaceConfig.guid, bag);
1409
1438
  checkDecodeOnlyStatements(sections, bag);
1410
1439
  checkRunFamilyHosts(sections, bag);
@@ -1628,6 +1657,7 @@ var Xano = class {
1628
1657
  if (typeof ws.canonical === "string" && ws.canonical !== "") {
1629
1658
  recordObserved(ctx, WORKSPACE_KEY, { canonical: ws.canonical });
1630
1659
  }
1660
+ const appNames = appNamesByGuid(sections.app);
1631
1661
  for (const [payloadKey, arr] of Object.entries(sections)) {
1632
1662
  for (const obj of arr ?? []) {
1633
1663
  if (!obj || typeof obj !== "object") continue;
@@ -1637,7 +1667,8 @@ var Xano = class {
1637
1667
  if (typeof o.canonical === "string" && o.canonical !== "") {
1638
1668
  identity.canonical = o.canonical;
1639
1669
  }
1640
- recordObserved(ctx, lockKey(payloadKey, o.name), identity);
1670
+ const lockName = lockNameForObject(payloadKey, o, appNames);
1671
+ recordObserved(ctx, lockKey(payloadKey, lockName), identity);
1641
1672
  }
1642
1673
  }
1643
1674
  }
@@ -1652,4 +1683,4 @@ export {
1652
1683
  Xano,
1653
1684
  workspace
1654
1685
  };
1655
- //# sourceMappingURL=chunk-BPEEGJJA.js.map
1686
+ //# sourceMappingURL=chunk-FAWNUE2U.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readVersion
3
- } from "./chunk-MS3BRZAZ.js";
3
+ } from "./chunk-CL2H2WYE.js";
4
4
  import {
5
5
  atomicWrite
6
6
  } from "./chunk-GNPVYOPB.js";
@@ -170,4 +170,4 @@ export {
170
170
  upgradeCommand,
171
171
  maybeNotifyUpdate
172
172
  };
173
- //# sourceMappingURL=chunk-ZGA5MUNC.js.map
173
+ //# sourceMappingURL=chunk-FDKR4YMN.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getEnvironment,
3
3
  readEphemeralState
4
- } from "./chunk-WJYB7DSI.js";
4
+ } from "./chunk-MDXR5E5Q.js";
5
5
  import {
6
6
  sandboxBaseUrl
7
- } from "./chunk-OR43PDCW.js";
7
+ } from "./chunk-3EYUR3TX.js";
8
8
  import {
9
9
  fetchReadOrExplain,
10
10
  httpFailure
@@ -66,7 +66,7 @@ async function resolveMetaTarget(auth, opts, deps = {}) {
66
66
  case "sandbox":
67
67
  return resolveSandbox(auth);
68
68
  case "ephemeral": {
69
- const resolveLive = deps.resolveLive ?? (await import("./ephemeral-command-46SL27GJ.js")).resolveLive;
69
+ const resolveLive = deps.resolveLive ?? (await import("./ephemeral-command-SD2KLX4P.js")).resolveLive;
70
70
  return resolveEphemeral(auth, opts.name, { ...deps, resolveLive });
71
71
  }
72
72
  }
@@ -75,4 +75,4 @@ async function resolveMetaTarget(auth, opts, deps = {}) {
75
75
  export {
76
76
  resolveMetaTarget
77
77
  };
78
- //# sourceMappingURL=chunk-APOR6TCV.js.map
78
+ //# sourceMappingURL=chunk-H2DEDWQF.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  c,
3
3
  resp
4
- } from "./chunk-YUPQOLFX.js";
4
+ } from "./chunk-NJGNUVXR.js";
5
5
 
6
6
  // src/values/expect.ts
7
7
  var TEST_EXPECT_TYPES = [
@@ -90,4 +90,4 @@ export {
90
90
  TEST_EXPECT_TYPES,
91
91
  expect
92
92
  };
93
- //# sourceMappingURL=chunk-PXXLBXOP.js.map
93
+ //# sourceMappingURL=chunk-JAVB27HL.js.map