@xanots/sdk 0.0.8 → 0.0.10

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 (102) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +28 -21
  3. package/dist/.build-fingerprint +1 -1
  4. package/dist/{agent-file-refresh-4W37DGXS.js → agent-file-refresh-QNKN5RYD.js} +3 -3
  5. package/dist/bin.js +8 -7
  6. package/dist/{branch-commands-PBQ36L4A.js → branch-commands-2BLOC2GR.js} +13 -11
  7. package/dist/{capture-7PO6SGB4.js → capture-4WVJY4DQ.js} +2 -2
  8. package/dist/{chunk-ZOYMZZ3S.js → chunk-3INK4Y4E.js} +1 -1
  9. package/dist/{chunk-NDZFBZHC.js → chunk-3UABJA4X.js} +1 -1
  10. package/dist/{chunk-7AXQKABT.js → chunk-5R73LFWK.js} +3 -3
  11. package/dist/{chunk-CDAQUY5W.js → chunk-5YCQ2QHH.js} +2 -2
  12. package/dist/{chunk-2ROR3AZC.js → chunk-75Z74TA7.js} +2 -2
  13. package/dist/{chunk-QTNO2WD6.js → chunk-7ZYW652H.js} +1 -1
  14. package/dist/{chunk-SNO3KHCY.js → chunk-ACCBOMCB.js} +109 -78
  15. package/dist/{chunk-4PTSTDIG.js → chunk-AIZKXUNP.js} +2 -2
  16. package/dist/{chunk-P5C2YKAM.js → chunk-ANUDXFEX.js} +18 -27
  17. package/dist/chunk-CTD5ZCV6.js +28 -0
  18. package/dist/{chunk-5HCDZ2XN.js → chunk-DBFU47BJ.js} +2 -2
  19. package/dist/{chunk-OKNSR7MT.js → chunk-DIA7CT7J.js} +129 -150
  20. package/dist/{chunk-JQLR64UC.js → chunk-F6CYJ7TN.js} +21 -6
  21. package/dist/{chunk-BKDJN76G.js → chunk-FE5I6S6N.js} +1 -1
  22. package/dist/{chunk-EM5QPTXP.js → chunk-I7DQDJAM.js} +30 -48
  23. package/dist/{chunk-QIWBCS7N.js → chunk-JGCWTCA7.js} +2 -2
  24. package/dist/{chunk-MDXR5E5Q.js → chunk-K5IOND4K.js} +2 -2
  25. package/dist/{chunk-4PE4ZAB7.js → chunk-KA6G2L7U.js} +5 -5
  26. package/dist/{chunk-64QK6JEK.js → chunk-LBYWGMOA.js} +36 -2
  27. package/dist/{chunk-3MDKV2VA.js → chunk-P6TAVLOX.js} +2 -2
  28. package/dist/{chunk-3QW5NFZJ.js → chunk-QKM4U5UK.js} +3 -3
  29. package/dist/{chunk-T4XPCJRF.js → chunk-TCFIPDB3.js} +1 -1
  30. package/dist/{chunk-FEQTQ6PM.js → chunk-VKSOTZK3.js} +2 -2
  31. package/dist/{chunk-6DHBYBTO.js → chunk-VNQM3V2C.js} +1 -2
  32. package/dist/{chunk-PYS7UNNW.js → chunk-W24FJHPD.js} +3 -3
  33. package/dist/chunk-WGPXT2G2.js +22 -0
  34. package/dist/{chunk-6AAT2AYQ.js → chunk-WP4OZZV4.js} +2 -2
  35. package/dist/{chunk-MU3O43L2.js → chunk-YBC3IKMF.js} +2 -2
  36. package/dist/{chunk-C3M5K4ZH.js → chunk-YYFXVYPX.js} +37 -6
  37. package/dist/chunk-ZQ2PKR6R.js +40 -0
  38. package/dist/cli.d.ts +57 -31
  39. package/dist/cli.js +6 -5
  40. package/dist/codegen-command-GB3H2KQ7.js +46 -0
  41. package/dist/{completion-A6BZ3XGU.js → completion-WF46272M.js} +2 -2
  42. package/dist/{config-NL33PN4D.js → config-476F3PT5.js} +1 -1
  43. package/dist/{deploy-command-QZ3GNLAD.js → deploy-command-QTIVA22A.js} +68 -100
  44. package/dist/{ephemeral-command-DL7EY4LL.js → ephemeral-command-U4AQ3TXX.js} +25 -28
  45. package/dist/index.d.ts +2 -2
  46. package/dist/index.js +5 -5
  47. package/dist/{init-command-4MG3UKUO.js → init-command-MAXULNAD.js} +13 -10
  48. package/dist/{onboard-command-EHOHKQQU.js → init-web-3JNFG6GI.js} +10 -10
  49. package/dist/internal.d.ts +2 -2
  50. package/dist/internal.js +42 -45
  51. package/dist/{live-diff-QK4KC2FJ.js → live-diff-IXKBVG4K.js} +3 -3
  52. package/dist/{lock-commands-Y4S4NUCE.js → lock-commands-DQ7CUMIV.js} +20 -19
  53. package/dist/{login-command-DFCURZLC.js → login-command-Z6CHTA57.js} +7 -7
  54. package/dist/{logout-command-WXVZQCAV.js → logout-command-ER6IKAYJ.js} +2 -2
  55. package/dist/{loop-7SAIGRCZ.js → loop-D5NPL4VH.js} +3 -3
  56. package/dist/{marketplace-command-BCOAAN2I.js → marketplace-command-P4IPLJ6J.js} +6 -6
  57. package/dist/{meta-client-57ZWVHST.js → meta-client-K2J4XH64.js} +6 -6
  58. package/dist/node.d.ts +2 -2
  59. package/dist/node.js +9 -8
  60. package/dist/{validate-command-GLF5ZOOW.js → preflight-command-GZ2GE5RN.js} +17 -16
  61. package/dist/{profile-command-QJAAUZIV.js → profile-command-LJSBDV2L.js} +5 -5
  62. package/dist/{release-command-DN75G5GJ.js → release-command-YUBTNHVX.js} +36 -33
  63. package/dist/{routes-manifest-SP3ZXLMR.js → routes-manifest-PWZHDOI5.js} +2 -2
  64. package/dist/scaffold.js +2 -2
  65. package/dist/{static-host-D6KS7X45.js → static-host-3WMV7IZO.js} +1 -1
  66. package/dist/status-command-AL47VG7H.js +162 -0
  67. package/dist/{store-CUCBSYLj.d.ts → store-BG1UPZ3Z.d.ts} +5 -5
  68. package/dist/{test-command-RRNNJ45I.js → test-command-YAZLKLGQ.js} +46 -29
  69. package/dist/{upgrade-command-XFOAWDI3.js → upgrade-command-FB5QJ363.js} +13 -12
  70. package/dist/{workspace-K72NP7SX.js → workspace-2COHDBM3.js} +1 -1
  71. package/dist/{workspace-command-QCFELEGR.js → workspace-command-43P42FBP.js} +31 -32
  72. package/dist/{workspace-export-AJMGN3CQ.js → workspace-export-DURY5WYL.js} +2 -2
  73. package/guides/README.md +2 -2
  74. package/guides/authoring.md +9 -1
  75. package/guides/cli.md +17 -19
  76. package/guides/codegen.md +21 -5
  77. package/guides/coverage.md +1 -1
  78. package/guides/deploying.md +31 -34
  79. package/guides/environment.md +4 -4
  80. package/guides/object-kinds.md +3 -3
  81. package/guides/project-structure.md +1 -1
  82. package/guides/scaffold.md +25 -2
  83. package/guides/typed-frontend.md +1 -1
  84. package/llms/fields.md +3 -2
  85. package/llms/kinds-agent-mcp.md +1 -1
  86. package/llms/kinds-core.md +1 -1
  87. package/llms/kinds-realtime.md +1 -1
  88. package/llms/lock.md +5 -5
  89. package/llms/statements-calls.md +2 -1
  90. package/llms/statements-data.md +5 -2
  91. package/llms/tests.md +3 -2
  92. package/llms-full.txt +41 -44
  93. package/llms.txt +20 -29
  94. package/manifest.json +95 -426
  95. package/package.json +1 -1
  96. package/dist/chunk-3EYUR3TX.js +0 -100
  97. package/dist/chunk-JQJPFUZI.js +0 -118
  98. package/dist/chunk-XP7S3VWY.js +0 -78
  99. package/dist/codegen-command-U2W72DLG.js +0 -43
  100. package/dist/env-target-NAYVEXBH.js +0 -16
  101. package/dist/sandbox-details-command-EDO56IY3.js +0 -18
  102. package/dist/sandbox-export-command-MO6DEZ7Z.js +0 -24
@@ -15,27 +15,30 @@ import {
15
15
  normalize,
16
16
  retiredInputSuccessor,
17
17
  retiredInputs
18
- } from "./chunk-ZOYMZZ3S.js";
18
+ } from "./chunk-3INK4Y4E.js";
19
+ import {
20
+ resolveEphemeralName
21
+ } from "./chunk-ZQ2PKR6R.js";
19
22
  import {
20
23
  getAccessToken
21
- } from "./chunk-3QW5NFZJ.js";
24
+ } from "./chunk-QKM4U5UK.js";
22
25
  import {
23
26
  exportWorkspaceBundle
24
- } from "./chunk-QTNO2WD6.js";
27
+ } from "./chunk-7ZYW652H.js";
25
28
  import {
26
29
  projectShellFiles,
27
30
  resolveFrontendPreset,
28
31
  resolveThemeChoice,
29
32
  sanitizeAppName
30
- } from "./chunk-C3M5K4ZH.js";
33
+ } from "./chunk-YYFXVYPX.js";
31
34
  import {
32
35
  XANO_DIR,
33
36
  resolveAiPresets,
34
37
  scaffoldProject
35
- } from "./chunk-4PE4ZAB7.js";
38
+ } from "./chunk-KA6G2L7U.js";
36
39
  import {
37
40
  TEST_EXPECT_TYPES
38
- } from "./chunk-2ROR3AZC.js";
41
+ } from "./chunk-75Z74TA7.js";
39
42
  import {
40
43
  raw
41
44
  } from "./chunk-LU7TRWMC.js";
@@ -44,7 +47,7 @@ import {
44
47
  describeOrigin,
45
48
  renderCodegenMarker,
46
49
  renderCodegenReadme
47
- } from "./chunk-P5C2YKAM.js";
50
+ } from "./chunk-ANUDXFEX.js";
48
51
  import {
49
52
  FIELD_METHODS,
50
53
  STATEMENT_SURFACES,
@@ -67,14 +70,14 @@ import {
67
70
  searchConstrainsRows,
68
71
  tableTrigger,
69
72
  workspaceTrigger
70
- } from "./chunk-3MDKV2VA.js";
73
+ } from "./chunk-P6TAVLOX.js";
71
74
  import {
72
75
  loadDefault,
73
76
  readVersion
74
- } from "./chunk-SNO3KHCY.js";
77
+ } from "./chunk-ACCBOMCB.js";
75
78
  import {
76
79
  UsageError
77
- } from "./chunk-JQLR64UC.js";
80
+ } from "./chunk-F6CYJ7TN.js";
78
81
  import {
79
82
  blank,
80
83
  detail,
@@ -115,7 +118,7 @@ import {
115
118
  sys,
116
119
  toolset,
117
120
  withFilters
118
- } from "./chunk-64QK6JEK.js";
121
+ } from "./chunk-LBYWGMOA.js";
119
122
  import {
120
123
  parsePathParams,
121
124
  unboundPathParams
@@ -6748,24 +6751,10 @@ function reportMismatches(report, result) {
6748
6751
 
6749
6752
  // src/emit/codegen-command.ts
6750
6753
  async function fetchBundle(args, source) {
6751
- if (source.kind === "sandbox") {
6752
- const auth3 = await getAccessToken(args);
6753
- step("Reading the sandbox workspace");
6754
- const { fetchSandboxBundle } = await import("./sandbox-export-command-MO6DEZ7Z.js");
6755
- return {
6756
- bundle: await fetchSandboxBundle(auth3),
6757
- origin: { source: "sandbox", origin: auth3.instance }
6758
- };
6759
- }
6760
6754
  if (source.kind === "ephemeral") {
6761
- const name = args.positionals[0];
6762
- if (name === void 0 || name === "") {
6763
- throw new Error(
6764
- "`xanots ephemeral codegen` needs a tenant name and an output path: `xanots ephemeral codegen <tenant> <path>`. Run `xanots ephemeral list` to see them."
6765
- );
6766
- }
6767
6755
  const auth3 = await getAccessToken(args);
6768
- const { resolveLive, fetchEphemeralBundle } = await import("./ephemeral-command-DL7EY4LL.js");
6756
+ const name = resolveEphemeralName(auth3, source.name);
6757
+ const { resolveLive, fetchEphemeralBundle } = await import("./ephemeral-command-U4AQ3TXX.js");
6769
6758
  const summary = await resolveLive(auth3, auth3.workspaceId, name);
6770
6759
  step(`Reading ephemeral "${name}"`);
6771
6760
  return {
@@ -6853,19 +6842,12 @@ function isMissingDependencyError(err) {
6853
6842
  }
6854
6843
  return false;
6855
6844
  }
6856
- async function runCodegenCommand(args, source) {
6857
- const outArg = source.kind === "ephemeral" ? args.positionals[1] : args.positionals[0];
6858
- const fileArg = source.kind === "file" ? args.positionals[0] : void 0;
6859
- const pathArg = source.kind === "file" ? args.positionals[1] : outArg;
6860
- if (source.kind === "file" && (fileArg === void 0 || fileArg === "")) {
6861
- throw new Error("`xanots codegen` needs a bundle file: `xanots codegen <bundle.json> <path>`.");
6862
- }
6863
- if (pathArg === void 0 || pathArg === "") {
6864
- throw new Error(
6865
- source.kind === "ephemeral" ? "`xanots ephemeral codegen` needs an output path: `xanots ephemeral codegen <tenant> <path>`." : `\`xanots ${source.kind === "file" ? "codegen <bundle.json>" : `${source.kind} codegen`}\` needs an output path.`
6866
- );
6867
- }
6868
- const { bundle, origin } = source.kind === "file" ? { bundle: readBundleFile(fileArg), origin: { source: "file", origin: fileArg } } : await fetchBundle(args, source);
6845
+ async function runInitFromCommand(args, source) {
6846
+ const pathArg = args.positionals[0] ?? ".";
6847
+ const { bundle, origin } = source.kind === "file" ? {
6848
+ bundle: readBundleFile(source.path),
6849
+ origin: { source: "file", origin: source.path }
6850
+ } : await fetchBundle(args, source);
6869
6851
  const mode = reportMode(args.report);
6870
6852
  const out2 = resolve(pathArg);
6871
6853
  const appName = sanitizeAppName(args.name ?? basename(out2));
@@ -6904,7 +6886,7 @@ async function runCodegenCommand(args, source) {
6904
6886
  theme: choice
6905
6887
  });
6906
6888
  let verified = null;
6907
- if (!args.noVerify) {
6889
+ if (!args.skipRoundtrip) {
6908
6890
  step("Verifying the generated tree round-trips");
6909
6891
  try {
6910
6892
  const result = verifyBundles(bundle, await reexport(out2));
@@ -6950,7 +6932,7 @@ function reportMode(value) {
6950
6932
  if (value === "full" || value === "json") return value;
6951
6933
  throw new UsageError(
6952
6934
  `--report takes grouped, full or json, not "${value}". grouped (the default) collapses repeated findings to one line per root cause, full prints every site, and json prints the findings as data.`,
6953
- { helpFor: { command: "workspace", subcommand: "codegen" } }
6935
+ { helpFor: { command: "init" } }
6954
6936
  );
6955
6937
  }
6956
6938
  var EXIT_VERIFY_FAILED = 2;
@@ -6977,7 +6959,7 @@ function blameGeneratedFile(err, out2) {
6977
6959
  return void 0;
6978
6960
  }
6979
6961
  function unverifiedReason(install) {
6980
- const fix = `run \`npm install\` in the project and re-run codegen to check the round trip`;
6962
+ const fix = `run \`npm install\` in the project and re-run \`init --from\` to check the round trip`;
6981
6963
  return install === "skipped" ? `Could not verify the round trip: dependencies are not installed (--no-install) \u2014 ${fix}.` : `Could not verify the round trip: \`npm install\` did not complete, so the tree could not be loaded \u2014 ${fix}.`;
6982
6964
  }
6983
6965
  function countBySection(payload) {
@@ -7004,7 +6986,7 @@ function summarize(args, project, bundle, verified, out2, origin, install, mode)
7004
6986
  `);
7005
6987
  }
7006
6988
  if (verified === null) {
7007
- if (args.noVerify) warn("Skipped round-trip verification (--no-verify) \u2014 the tree is unchecked.");
6989
+ if (args.skipRoundtrip) warn("Skipped the round-trip check (--skip-roundtrip) \u2014 the tree is unchecked.");
7008
6990
  } else if (verified) {
7009
6991
  success(
7010
6992
  omitted > 0 ? `Verified: re-exporting ${out2} reproduces the source bundle, apart from ${omitted} deliberately omitted value${omitted === 1 ? "" : "s"} listed above` : `Verified: re-exporting ${out2} reproduces the source bundle`
@@ -7014,7 +6996,7 @@ function summarize(args, project, bundle, verified, out2, origin, install, mode)
7014
6996
  }
7015
6997
  blank();
7016
6998
  success("Project ready.");
7017
- const cdHint = out2 === process.cwd() ? "" : ` cd ${args.positionals.at(-1)}
6999
+ const cdHint = out2 === process.cwd() ? "" : ` cd ${args.positionals[0] ?? "."}
7018
7000
  `;
7019
7001
  detail(
7020
7002
  `Next steps:
@@ -7023,15 +7005,15 @@ function summarize(args, project, bundle, verified, out2, origin, install, mode)
7023
7005
  npm run xano:deploy # build the frontend, then deploy \u2192 live ephemeral URL`
7024
7006
  );
7025
7007
  detail(
7026
- `${s2.bold(`${XANO_DIR}/`)} is disposable and schema-only \u2014 re-running codegen rewrites it. Deploying is a FULL REPLACE, so send it only to an ephemeral or sandbox environment.`
7008
+ `${s2.bold(`${XANO_DIR}/`)} is disposable and schema-only \u2014 re-running \`init --from\` rewrites it. Deploying is a FULL REPLACE, so send it only to an ephemeral environment.`
7027
7009
  );
7028
7010
  }
7029
7011
 
7030
7012
  export {
7031
7013
  fetchWorkspaceBundle,
7032
7014
  isMissingDependencyError,
7033
- runCodegenCommand,
7015
+ runInitFromCommand,
7034
7016
  verifyCrashEntry,
7035
7017
  blameGeneratedFile
7036
7018
  };
7037
- //# sourceMappingURL=chunk-EM5QPTXP.js.map
7019
+ //# sourceMappingURL=chunk-I7DQDJAM.js.map
@@ -5,7 +5,7 @@ import {
5
5
  presetFilePath,
6
6
  renderPreset,
7
7
  upsertManagedBlock
8
- } from "./chunk-4PE4ZAB7.js";
8
+ } from "./chunk-KA6G2L7U.js";
9
9
  import {
10
10
  warn
11
11
  } from "./chunk-EZG76F7R.js";
@@ -92,4 +92,4 @@ export {
92
92
  isCI,
93
93
  refreshAgentFiles
94
94
  };
95
- //# sourceMappingURL=chunk-QIWBCS7N.js.map
95
+ //# sourceMappingURL=chunk-JGCWTCA7.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ensureGitignored
3
- } from "./chunk-BKDJN76G.js";
3
+ } from "./chunk-FE5I6S6N.js";
4
4
  import {
5
5
  atomicWrite
6
6
  } from "./chunk-GNPVYOPB.js";
@@ -57,4 +57,4 @@ export {
57
57
  setEnvironment,
58
58
  clearEnvironment
59
59
  };
60
- //# sourceMappingURL=chunk-MDXR5E5Q.js.map
60
+ //# sourceMappingURL=chunk-K5IOND4K.js.map
@@ -46,7 +46,7 @@ canonical slug. It is written by \`npm run xano:export\`/\`xano:deploy\` and is
46
46
 
47
47
  To rename an object: rename it in code, run \`npm run xano:export\` (stderr prints
48
48
  the fix-up), run \`npx xanots lock rename <kind> <old> <new> --lock=xano/xano.lock\`,
49
- then export again. \`lock rename\`/\`lock adopt\` need that flag from the project root \u2014
49
+ then export again. \`lock rename\`/\`lock import\` need that flag from the project root \u2014
50
50
  they take no entry file, so they look for the lock in the current directory, while
51
51
  \`lock prune <entry-file>\` (like \`export\`) derives it from the entry.
52
52
  \`npm run xano:check\` fails if an export would change the lock \u2014 run it before
@@ -150,13 +150,13 @@ function generatedGuidanceBody(frontend) {
150
150
 
151
151
  This is a [XanoTS](https://www.npmjs.com/package/@xanots/sdk) project whose
152
152
  Xano backend under \`xano/\` was **pulled from a live workspace** and written as
153
- TypeScript by \`xanots \u2026 codegen\`. The ${frontend.label} frontend under \`frontend/\`
153
+ TypeScript by \`xanots init --from\`. The ${frontend.label} frontend under \`frontend/\`
154
154
  is a starter. XanoTS is Xano's official TypeScript SDK \u2014 the supported way to
155
155
  drive a Xano workspace from code.
156
156
 
157
157
  ### Two rules before you edit anything
158
158
 
159
- - **\`xano/\` is machine-written and disposable.** Re-running \`xanots \u2026 codegen\`
159
+ - **\`xano/\` is machine-written and disposable.** Re-running \`xanots init --from\`
160
160
  on this project rewrites that directory wholesale \u2014 no merge, no diff, no
161
161
  preservation of hand edits. Work you want to keep goes outside \`xano/\`, or
162
162
  gets re-applied after each pull. Everything else in the project is yours.
@@ -173,7 +173,7 @@ ${LEARN_FROM_THE_LIBRARY}
173
173
 
174
174
  \`frontend/src/lib/api.ts\` derives request paths (\`getPath()\`) and request/response
175
175
  types (\`InferInput\` / \`InferResponse\`) from the query defs in \`xano/\`. Never
176
- hand-type a URL or a request body. \`npx xanots paths xano/index.ts\` lists every
176
+ hand-type a URL or a request body. \`npx xanots routes xano/index.ts\` lists every
177
177
  endpoint's verb and resolved path.
178
178
 
179
179
  ### Layout
@@ -442,4 +442,4 @@ export {
442
442
  resolveAiPresets,
443
443
  scaffoldProject
444
444
  };
445
- //# sourceMappingURL=chunk-4PE4ZAB7.js.map
445
+ //# sourceMappingURL=chunk-KA6G2L7U.js.map
@@ -3690,12 +3690,37 @@ function phpEncodeString(str) {
3690
3690
  case " ":
3691
3691
  out2 += "\\t";
3692
3692
  break;
3693
+ // PHP escapes the two line terminators even under JSON_UNESCAPED_UNICODE
3694
+ // — that flag is not JSON_UNESCAPED_LINE_TERMINATORS, which the engine
3695
+ // does not pass.
3696
+ case "\u2028":
3697
+ out2 += "\\u2028";
3698
+ break;
3699
+ case "\u2029":
3700
+ out2 += "\\u2029";
3701
+ break;
3693
3702
  default:
3694
3703
  out2 += code < 32 ? "\\u" + code.toString(16).padStart(4, "0") : ch;
3695
3704
  }
3696
3705
  }
3697
3706
  return out2 + '"';
3698
3707
  }
3708
+ var PHP_INT_MAX = 9223372036854775807n;
3709
+ function phpEncodeNumber(value) {
3710
+ if (!Number.isFinite(value)) return "0";
3711
+ const text = JSON.stringify(value);
3712
+ if (!/[.eE]/.test(text)) {
3713
+ const n = BigInt(text);
3714
+ return n > PHP_INT_MAX || n < -PHP_INT_MAX - 1n ? `"${text}"` : text;
3715
+ }
3716
+ const [mantissaText, exponentText] = Math.abs(value).toExponential().split("e");
3717
+ const exponent = Number(exponentText);
3718
+ if (exponent >= -4 && exponent < 17) return text;
3719
+ const digits = mantissaText.replace(".", "").replace(/0+$/, "") || "0";
3720
+ const mantissa = digits.length > 1 ? `${digits[0]}.${digits.slice(1)}` : `${digits}.0`;
3721
+ const sign = exponent < 0 ? "-" : "+";
3722
+ return `${value < 0 ? "-" : ""}${mantissa}e${sign}${Math.abs(exponent)}`;
3723
+ }
3699
3724
  function phpJsonEncode(value) {
3700
3725
  const out2 = [];
3701
3726
  const stack = [{ value }];
@@ -3715,7 +3740,7 @@ function phpJsonEncode(value) {
3715
3740
  out2.push(phpEncodeString(current));
3716
3741
  continue;
3717
3742
  case "number":
3718
- out2.push(Number.isFinite(current) ? JSON.stringify(current) : "0");
3743
+ out2.push(phpEncodeNumber(current));
3719
3744
  continue;
3720
3745
  case "boolean":
3721
3746
  out2.push(current ? "true" : "false");
@@ -3737,6 +3762,15 @@ function phpJsonEncode(value) {
3737
3762
  }
3738
3763
  const obj2 = current;
3739
3764
  const keys = Object.keys(obj2).filter((key) => obj2[key] !== void 0);
3765
+ if (keys.length > 0 && keys.every((key, i) => key === String(i))) {
3766
+ stack.push({ lit: "]" });
3767
+ for (let i = keys.length - 1; i >= 0; i--) {
3768
+ stack.push({ value: obj2[keys[i]] });
3769
+ if (i > 0) stack.push({ lit: "," });
3770
+ }
3771
+ stack.push({ lit: "[" });
3772
+ continue;
3773
+ }
3740
3774
  stack.push({ lit: "}" });
3741
3775
  for (let i = keys.length - 1; i >= 0; i--) {
3742
3776
  const key = keys[i];
@@ -4083,4 +4117,4 @@ export {
4083
4117
  serializeBundle,
4084
4118
  emitBundle
4085
4119
  };
4086
- //# sourceMappingURL=chunk-64QK6JEK.js.map
4120
+ //# sourceMappingURL=chunk-LBYWGMOA.js.map
@@ -35,7 +35,7 @@ import {
35
35
  registerKind,
36
36
  tableColumns,
37
37
  withFilters
38
- } from "./chunk-64QK6JEK.js";
38
+ } from "./chunk-LBYWGMOA.js";
39
39
  import {
40
40
  assertPathParamInputs,
41
41
  fillPathParams,
@@ -3734,4 +3734,4 @@ export {
3734
3734
  workspaceKind,
3735
3735
  workspaceConfig
3736
3736
  };
3737
- //# sourceMappingURL=chunk-3MDKV2VA.js.map
3737
+ //# sourceMappingURL=chunk-P6TAVLOX.js.map
@@ -14,7 +14,7 @@ import {
14
14
  resolveOAuthErrorCode,
15
15
  resolveScope,
16
16
  writeCredential
17
- } from "./chunk-BKDJN76G.js";
17
+ } from "./chunk-FE5I6S6N.js";
18
18
  import {
19
19
  detail,
20
20
  hostLabel,
@@ -161,7 +161,7 @@ The refresh token may be expired or already spent \u2014 refresh tokens rotate o
161
161
  );
162
162
  }
163
163
  assertHttpsOrigin(instance2, "instance");
164
- const { resolveScopedWorkspaceId } = await import("./workspace-K72NP7SX.js");
164
+ const { resolveScopedWorkspaceId } = await import("./workspace-2COHDBM3.js");
165
165
  const workspaceId = await resolveScopedWorkspaceId({ access_token: set.access_token, instance: instance2 });
166
166
  return { access_token: set.access_token, instance: instance2, workspaceId, credentialType: "oauth" };
167
167
  }
@@ -272,4 +272,4 @@ export {
272
272
  envMetaCredentialVarsSet,
273
273
  getAccessToken
274
274
  };
275
- //# sourceMappingURL=chunk-3QW5NFZJ.js.map
275
+ //# sourceMappingURL=chunk-QKM4U5UK.js.map
@@ -64,4 +64,4 @@ export {
64
64
  indexByIdentity,
65
65
  resolveMatch
66
66
  };
67
- //# sourceMappingURL=chunk-T4XPCJRF.js.map
67
+ //# sourceMappingURL=chunk-TCFIPDB3.js.map
@@ -12,7 +12,7 @@ import {
12
12
  middlewareEntryGuid,
13
13
  stackReferencesAuth,
14
14
  tableColumns
15
- } from "./chunk-64QK6JEK.js";
15
+ } from "./chunk-LBYWGMOA.js";
16
16
  import {
17
17
  CANONICAL_PAYLOAD_KEYS,
18
18
  REFERENCEABLE_KINDS,
@@ -1706,4 +1706,4 @@ export {
1706
1706
  Xano,
1707
1707
  workspace
1708
1708
  };
1709
- //# sourceMappingURL=chunk-FEQTQ6PM.js.map
1709
+ //# sourceMappingURL=chunk-VKSOTZK3.js.map
@@ -152,7 +152,6 @@ async function waitUntilReady(auth, opts, cfg = {}) {
152
152
  }
153
153
 
154
154
  export {
155
- tenantBaseUrl,
156
155
  isExpired,
157
156
  isEphemeralDisabled,
158
157
  createEphemeral,
@@ -163,4 +162,4 @@ export {
163
162
  impersonateEphemeral,
164
163
  waitUntilReady
165
164
  };
166
- //# sourceMappingURL=chunk-6DHBYBTO.js.map
165
+ //# sourceMappingURL=chunk-VNQM3V2C.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  compileBundle
3
- } from "./chunk-SNO3KHCY.js";
3
+ } from "./chunk-ACCBOMCB.js";
4
4
  import {
5
5
  missingArgument
6
- } from "./chunk-JQLR64UC.js";
6
+ } from "./chunk-F6CYJ7TN.js";
7
7
 
8
8
  // src/emit/bundle-input.ts
9
9
  import { existsSync, readFileSync } from "fs";
@@ -34,4 +34,4 @@ export {
34
34
  assertBundleInput,
35
35
  loadBundleText
36
36
  };
37
- //# sourceMappingURL=chunk-PYS7UNNW.js.map
37
+ //# sourceMappingURL=chunk-W24FJHPD.js.map
@@ -0,0 +1,22 @@
1
+ // src/emit/output-target.ts
2
+ import { statSync } from "fs";
3
+ import { join, resolve } from "path";
4
+ function resolveOutputTarget(opts) {
5
+ const { path, name, ext } = opts;
6
+ if (path === "-") return { kind: "stdout" };
7
+ const basename = `${name}.${ext}`;
8
+ if (path === void 0 || path === "") {
9
+ return { kind: "file", path: resolve(basename) };
10
+ }
11
+ const endsWithSep = path.endsWith("/") || path.endsWith("\\");
12
+ const isDir = statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false;
13
+ if (endsWithSep || isDir) {
14
+ return { kind: "file", path: resolve(join(path, basename)) };
15
+ }
16
+ return { kind: "file", path: resolve(path) };
17
+ }
18
+
19
+ export {
20
+ resolveOutputTarget
21
+ };
22
+ //# sourceMappingURL=chunk-WGPXT2G2.js.map
@@ -29,7 +29,7 @@ function endpoint(opts, suffix = "", qs = "") {
29
29
  }
30
30
  function explainDuplicateIdentity(body2) {
31
31
  if (!/duplicate key value violates unique constraint/i.test(body2)) return void 0;
32
- return "The import tried to CREATE objects that already exist under different identities, and the engine refused the duplicate.\nThis is what a stale `xano.lock` looks like: it names guids the workspace no longer has, so nothing matched and everything was planned as new. `--replace` causes it by minting fresh identities.\nRun `xanots lock adopt` against this workspace to re-pin the lock to what is actually there, then release again.";
32
+ return "The import tried to CREATE objects that already exist under different identities, and the engine refused the duplicate.\nThis is what a stale `xano.lock` looks like: it names guids the workspace no longer has, so nothing matched and everything was planned as new. `--replace` causes it by minting fresh identities.\nRun `xanots lock import` against this workspace to re-pin the lock to what is actually there, then release again.";
33
33
  }
34
34
  var ImportHttpError = class extends Error {
35
35
  constructor(status, action, statusText, body2) {
@@ -173,4 +173,4 @@ export {
173
173
  importWorkspaceArchive,
174
174
  planWorkspaceImport
175
175
  };
176
- //# sourceMappingURL=chunk-6AAT2AYQ.js.map
176
+ //# sourceMappingURL=chunk-WP4OZZV4.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  renderThemeScript
3
- } from "./chunk-P5C2YKAM.js";
3
+ } from "./chunk-ANUDXFEX.js";
4
4
  import {
5
5
  defaultThemeChoice,
6
6
  iconLibraryOf,
@@ -842,4 +842,4 @@ export {
842
842
  allFrontendPresets,
843
843
  resolveFrameworkFlag
844
844
  };
845
- //# sourceMappingURL=chunk-MU3O43L2.js.map
845
+ //# sourceMappingURL=chunk-YBC3IKMF.js.map
@@ -2,7 +2,7 @@ import {
2
2
  presetFilePath,
3
3
  resolveAiPresets,
4
4
  scaffoldProject
5
- } from "./chunk-4PE4ZAB7.js";
5
+ } from "./chunk-KA6G2L7U.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-MU3O43L2.js";
14
+ } from "./chunk-YBC3IKMF.js";
15
15
  import {
16
16
  initLanding,
17
17
  renderApiTs,
@@ -27,7 +27,7 @@ import {
27
27
  renderViteConfig,
28
28
  renderXanoExampleMd,
29
29
  renderXanoIndex
30
- } from "./chunk-P5C2YKAM.js";
30
+ } from "./chunk-ANUDXFEX.js";
31
31
  import {
32
32
  DEFAULT_DARK_MODE,
33
33
  defaultThemeChoice,
@@ -41,10 +41,14 @@ import {
41
41
  } from "./chunk-Q77KNEUL.js";
42
42
  import {
43
43
  readVersion
44
- } from "./chunk-SNO3KHCY.js";
44
+ } from "./chunk-ACCBOMCB.js";
45
+ import {
46
+ ENV_SPELLINGS,
47
+ parseEnvSelector
48
+ } from "./chunk-CTD5ZCV6.js";
45
49
  import {
46
50
  UsageError
47
- } from "./chunk-JQLR64UC.js";
51
+ } from "./chunk-F6CYJ7TN.js";
48
52
  import {
49
53
  blank,
50
54
  detail,
@@ -393,7 +397,33 @@ function buildFileSet(vars, preset, choice) {
393
397
  { path: "xano/EXAMPLE.md", content: renderXanoExampleMd(vars) }
394
398
  ];
395
399
  }
400
+ function resolveFromSource(raw) {
401
+ const env = parseEnvSelector(raw);
402
+ if (env !== void 0) return env;
403
+ if (/\.json$/i.test(raw) || /[\\/]/.test(raw)) return { kind: "file", path: raw };
404
+ throw new UsageError(
405
+ `--from does not take "${raw}". Sources are ${ENV_SPELLINGS}, or a path to a bundle .json (\`xanots ephemeral list\` shows the environment names; bare \`ephemeral\` is the one this project last deployed to).`,
406
+ { helpFor: { command: "init" } }
407
+ );
408
+ }
409
+ function rejectPullOnlyFlags(args) {
410
+ const passed = [
411
+ ...args.report !== void 0 ? ["--report"] : [],
412
+ ...args.skipRoundtrip ? ["--skip-roundtrip"] : []
413
+ ];
414
+ if (passed.length === 0) return;
415
+ throw new UsageError(
416
+ `${passed.join(" and ")} ${passed.length === 1 ? "describes" : "describe"} the pull that \`--from\` performs, so ${passed.length === 1 ? "it does" : "they do"} nothing without it. Add \`--from <source>\`, or drop ${passed.length === 1 ? "the flag" : "them"}.`,
417
+ { helpFor: { command: "init" } }
418
+ );
419
+ }
396
420
  async function runInitCommand(args) {
421
+ if (args.from !== void 0) {
422
+ const source = resolveFromSource(args.from);
423
+ const { runInitFromCommand } = await import("./codegen-command-GB3H2KQ7.js");
424
+ return runInitFromCommand(args, source);
425
+ }
426
+ rejectPullOnlyFlags(args);
397
427
  const targetArg = args.positionals[0] ?? ".";
398
428
  const targetDir = resolve(targetArg);
399
429
  const appName = sanitizeAppName(args.name ?? basename(targetDir));
@@ -468,6 +498,7 @@ export {
468
498
  resolveThemeChoice,
469
499
  sanitizeAppName,
470
500
  projectShellFiles,
501
+ resolveFromSource,
471
502
  runInitCommand
472
503
  };
473
- //# sourceMappingURL=chunk-C3M5K4ZH.js.map
504
+ //# sourceMappingURL=chunk-YYFXVYPX.js.map
@@ -0,0 +1,40 @@
1
+ import {
2
+ getEnvironment,
3
+ readEphemeralState
4
+ } from "./chunk-K5IOND4K.js";
5
+
6
+ // src/emit/env-target.ts
7
+ async function resolveEphemeral(auth, name, deps) {
8
+ const resolved = resolveEphemeralName(auth, name, deps.cwd);
9
+ const summary = await deps.resolveLive(auth, auth.workspaceId, resolved);
10
+ if (summary.url === void 0) {
11
+ throw new Error(`Ephemeral "${resolved}" has no base URL to address yet \u2014 it may still be provisioning.`);
12
+ }
13
+ return { base: summary.url, workspaceId: 1, label: `ephemeral ${resolved}`, env: resolved };
14
+ }
15
+ function resolveEphemeralName(auth, name, cwd = process.cwd()) {
16
+ const tracked = getEnvironment(readEphemeralState(cwd), auth.workspaceId)?.name;
17
+ const resolved = name ?? tracked;
18
+ if (resolved === void 0 || resolved === "") {
19
+ throw new Error(
20
+ `No ephemeral environment to target. Name one with \`ephemeral:<name>\` (\`xanots ephemeral list\` shows them), or run \`xanots deploy\` first \u2014 this project then remembers the env it deployed to, which is what bare \`ephemeral\` reads.`
21
+ );
22
+ }
23
+ return resolved;
24
+ }
25
+ async function resolveMetaTarget(auth, selector, deps = {}) {
26
+ switch (selector.kind) {
27
+ case "workspace":
28
+ return { base: auth.instance, workspaceId: auth.workspaceId, label: `workspace ${auth.workspaceId}` };
29
+ case "ephemeral": {
30
+ const resolveLive = deps.resolveLive ?? (await import("./ephemeral-command-U4AQ3TXX.js")).resolveLive;
31
+ return resolveEphemeral(auth, selector.name, { ...deps, resolveLive });
32
+ }
33
+ }
34
+ }
35
+
36
+ export {
37
+ resolveEphemeralName,
38
+ resolveMetaTarget
39
+ };
40
+ //# sourceMappingURL=chunk-ZQ2PKR6R.js.map