@xanots/sdk 0.0.1

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 (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +384 -0
  3. package/dist/agent-file-refresh-7XCACU34.js +95 -0
  4. package/dist/bin.d.ts +1 -0
  5. package/dist/bin.js +184 -0
  6. package/dist/capture-HUV5BNTC.js +32 -0
  7. package/dist/chunk-26CNBZE2.js +963 -0
  8. package/dist/chunk-33ND6LKO.js +78 -0
  9. package/dist/chunk-3DUAGYGP.js +1550 -0
  10. package/dist/chunk-3IGNIP6R.js +89 -0
  11. package/dist/chunk-47WDWMBJ.js +14 -0
  12. package/dist/chunk-4BXJGVZ3.js +318 -0
  13. package/dist/chunk-4HT3BNZ7.js +675 -0
  14. package/dist/chunk-4YMD2OOZ.js +23 -0
  15. package/dist/chunk-5WGEURVI.js +156 -0
  16. package/dist/chunk-5YTBTF25.js +29 -0
  17. package/dist/chunk-6DHBYBTO.js +166 -0
  18. package/dist/chunk-76QBEIGO.js +66 -0
  19. package/dist/chunk-7DKX2SPN.js +100 -0
  20. package/dist/chunk-7REDODS2.js +468 -0
  21. package/dist/chunk-C56BC2FY.js +254 -0
  22. package/dist/chunk-DGSF2Q5H.js +60 -0
  23. package/dist/chunk-EMCAWMHC.js +3982 -0
  24. package/dist/chunk-EZG76F7R.js +159 -0
  25. package/dist/chunk-FJ6ZS5KB.js +3607 -0
  26. package/dist/chunk-GNPVYOPB.js +17 -0
  27. package/dist/chunk-HJPTWBLH.js +38 -0
  28. package/dist/chunk-IZW6MK3U.js +248 -0
  29. package/dist/chunk-LH6Z6KFV.js +247 -0
  30. package/dist/chunk-MZUI3JNX.js +93 -0
  31. package/dist/chunk-NDZFBZHC.js +167 -0
  32. package/dist/chunk-NOO35BQ2.js +37 -0
  33. package/dist/chunk-NUQCEOKA.js +13 -0
  34. package/dist/chunk-QTNO2WD6.js +56 -0
  35. package/dist/chunk-RVB7ITKN.js +49 -0
  36. package/dist/chunk-TRU5OHQ5.js +6904 -0
  37. package/dist/chunk-VKFQJEMW.js +814 -0
  38. package/dist/chunk-VTIL47DT.js +125 -0
  39. package/dist/chunk-WHOJWOSV.js +112 -0
  40. package/dist/chunk-WKP4D5MO.js +1692 -0
  41. package/dist/chunk-X4DVXBFY.js +38 -0
  42. package/dist/chunk-XQ22GLYS.js +118 -0
  43. package/dist/chunk-YDZYMZBE.js +670 -0
  44. package/dist/chunk-YGPIY3WT.js +1146 -0
  45. package/dist/chunk-YYRDLFSJ.js +602 -0
  46. package/dist/chunk-ZUTSMMAG.js +46 -0
  47. package/dist/cli.d.ts +331 -0
  48. package/dist/cli.js +33 -0
  49. package/dist/codegen-command-OOKK6AZK.js +40 -0
  50. package/dist/codegen.d.ts +114 -0
  51. package/dist/codegen.js +71 -0
  52. package/dist/completion-TIPPZN7H.js +298 -0
  53. package/dist/config-NL33PN4D.js +84 -0
  54. package/dist/deploy-command-4EQ7XX5G.js +451 -0
  55. package/dist/env-target-IFJ5QDHC.js +16 -0
  56. package/dist/ephemeral-command-3X3I4ULC.js +242 -0
  57. package/dist/index.d.ts +4477 -0
  58. package/dist/index.js +300 -0
  59. package/dist/init-command-R6H7ZXW5.js +27 -0
  60. package/dist/internal.d.ts +74 -0
  61. package/dist/internal.js +2065 -0
  62. package/dist/io-AMIKRLPC.js +11 -0
  63. package/dist/live-diff-Y3AKETHE.js +196 -0
  64. package/dist/lock-3CVKALKT.js +37 -0
  65. package/dist/lock-commands-XTR2YKLY.js +232 -0
  66. package/dist/login-command-ACJF6KWQ.js +167 -0
  67. package/dist/logout-command-MX3MJS5U.js +68 -0
  68. package/dist/loop-OM3P2Z6O.js +93 -0
  69. package/dist/marketplace-command-RATXTKXN.js +379 -0
  70. package/dist/meta-client-OW5WKWW7.js +170 -0
  71. package/dist/node.d.ts +59 -0
  72. package/dist/node.js +442 -0
  73. package/dist/profile-command-SWJ3SPKR.js +77 -0
  74. package/dist/release-command-VV5UVZKL.js +427 -0
  75. package/dist/response-CVAE2kMj.d.ts +1915 -0
  76. package/dist/routes-manifest-SP3ZXLMR.js +244 -0
  77. package/dist/runtime-V4C3AC3A.js +13 -0
  78. package/dist/sandbox-details-command-HJE5SPVG.js +18 -0
  79. package/dist/sandbox-export-command-QCJY4GMV.js +24 -0
  80. package/dist/static-host-D6KS7X45.js +138 -0
  81. package/dist/store-BQ97nKIF.d.ts +7760 -0
  82. package/dist/test-command-TSPBQHBM.js +383 -0
  83. package/dist/validate-command-4ERHJSCO.js +122 -0
  84. package/dist/verify-rollout-FAVQ6EJY.js +40 -0
  85. package/dist/workspace-K72NP7SX.js +49 -0
  86. package/dist/workspace-command-OF23DPNI.js +156 -0
  87. package/dist/workspace-export-AJMGN3CQ.js +10 -0
  88. package/llms/fields.md +104 -0
  89. package/llms/filters.md +183 -0
  90. package/llms/kinds-agent-mcp.md +11 -0
  91. package/llms/kinds-core.md +68 -0
  92. package/llms/kinds-realtime.md +76 -0
  93. package/llms/lambda.md +111 -0
  94. package/llms/legacy.md +43 -0
  95. package/llms/object-kinds.md +31 -0
  96. package/llms/statements-calls.md +23 -0
  97. package/llms/statements-catalog.md +309 -0
  98. package/llms/statements-data.md +58 -0
  99. package/llms/statements-runtime.md +48 -0
  100. package/llms/tests.md +58 -0
  101. package/llms/triggers.md +22 -0
  102. package/llms/values.md +29 -0
  103. package/llms-full.txt +1672 -0
  104. package/llms.txt +483 -0
  105. package/manifest.json +9592 -0
  106. package/package.json +110 -0
@@ -0,0 +1,298 @@
1
+ import {
2
+ FLAGS,
3
+ flagKey,
4
+ flagValues,
5
+ getCommand,
6
+ liveCommandNames,
7
+ liveSubcommandNames
8
+ } from "./chunk-YYRDLFSJ.js";
9
+
10
+ // src/emit/completion.ts
11
+ var COMPLETION_SHELLS = ["bash", "zsh", "fish"];
12
+ function isCompletionShell(s) {
13
+ return COMPLETION_SHELLS.includes(s);
14
+ }
15
+ function flagTokens(ref) {
16
+ const spec = FLAGS[flagKey(ref)]?.spec ?? "";
17
+ return spec.match(/-{1,2}[a-z][a-z-]*/g) ?? [];
18
+ }
19
+ function tokensFor(flags) {
20
+ return (flags ?? []).flatMap(flagTokens);
21
+ }
22
+ function wantsPaths(args) {
23
+ return (args ?? []).some((a) => a.path === true);
24
+ }
25
+ function argValues(args) {
26
+ return [...args?.[0]?.values ?? []];
27
+ }
28
+ function valuedFlags(flags) {
29
+ const out = [];
30
+ for (const ref of flags ?? []) {
31
+ const values = flagValues(ref);
32
+ if (values === void 0) continue;
33
+ for (const token of flagTokens(ref)) out.push([token, [...values]]);
34
+ }
35
+ return out;
36
+ }
37
+ function describe(text) {
38
+ return text.replace(/`/g, "").replace(/[:]/g, " -").replace(/\s+/g, " ").trim();
39
+ }
40
+ function sq(text) {
41
+ return `'${text.replace(/'/g, `'\\''`)}'`;
42
+ }
43
+ function scopes() {
44
+ const out = [];
45
+ for (const name of liveCommandNames()) {
46
+ const spec = getCommand(name);
47
+ out.push({
48
+ key: name,
49
+ flags: tokensFor(spec.flags),
50
+ paths: wantsPaths(spec.args),
51
+ values: argValues(spec.args),
52
+ valued: valuedFlags(spec.flags)
53
+ });
54
+ for (const verb of liveSubcommandNames(name)) {
55
+ const sub = spec.subcommands[verb];
56
+ out.push({
57
+ key: `${name} ${verb}`,
58
+ flags: tokensFor(sub.flags),
59
+ paths: wantsPaths(sub.args),
60
+ values: argValues(sub.args),
61
+ valued: valuedFlags(sub.flags)
62
+ });
63
+ }
64
+ }
65
+ return out;
66
+ }
67
+ function commandRows() {
68
+ return liveCommandNames().map((n) => [n, describe(getCommand(n).summary)]);
69
+ }
70
+ function subcommandRows(command) {
71
+ const spec = getCommand(command);
72
+ return liveSubcommandNames(command).map((v) => [v, describe(spec.subcommands[v].summary)]);
73
+ }
74
+ function renderBash() {
75
+ const commands = liveCommandNames().join(" ");
76
+ const subLines = liveCommandNames().filter((c) => liveSubcommandNames(c).length > 0).map((c) => ` ${c}) echo ${sq(liveSubcommandNames(c).join(" "))} ;;`);
77
+ const flagLines = scopes().filter((s) => s.flags.length > 0).map((s) => ` ${sq(s.key)}) echo ${sq(s.flags.join(" "))} ;;`);
78
+ const pathLines = scopes().filter((s) => s.paths).map((s) => sq(s.key)).join("|");
79
+ const valueLines = scopes().filter((s) => s.values.length > 0).map((s) => ` ${sq(s.key)}) echo ${sq(s.values.join(" "))} ;;`);
80
+ const flagValueLines = scopes().flatMap((s) => s.valued.map(([token, values]) => [`${s.key} ${token}`, values])).map(([k, values]) => ` ${sq(k)}) echo ${sq(values.join(" "))} ;;`);
81
+ return `# xanots completion for bash. Regenerate after upgrading:
82
+ # xanots completion bash > ~/.xanots-completion.bash
83
+ # echo 'source ~/.xanots-completion.bash' >> ~/.bashrc
84
+
85
+ _xanots_subcommands() {
86
+ case "$1" in
87
+ ${subLines.join("\n")}
88
+ esac
89
+ }
90
+
91
+ _xanots_flags() {
92
+ case "$1" in
93
+ ${flagLines.join("\n")}
94
+ esac
95
+ }
96
+
97
+ _xanots_argvalues() {
98
+ case "$1" in
99
+ ${valueLines.join("\n")}
100
+ esac
101
+ }
102
+
103
+ _xanots_flagvalues() {
104
+ case "$1" in
105
+ ${flagValueLines.join("\n")}
106
+ esac
107
+ }
108
+
109
+ _xanots() {
110
+ local cur cmd sub scope
111
+ cur="\${COMP_WORDS[COMP_CWORD]}"
112
+ cmd="\${COMP_WORDS[1]}"
113
+ sub="\${COMP_WORDS[2]}"
114
+ COMPREPLY=()
115
+
116
+ # Position 1 is always the command.
117
+ if [ "$COMP_CWORD" -eq 1 ]; then
118
+ COMPREPLY=( $(compgen -W ${sq(commands)} -- "$cur") )
119
+ return
120
+ fi
121
+
122
+ # Position 2 under a noun command is its verb.
123
+ local subs
124
+ subs="$(_xanots_subcommands "$cmd")"
125
+ if [ "$COMP_CWORD" -eq 2 ] && [ -n "$subs" ]; then
126
+ COMPREPLY=( $(compgen -W "$subs" -- "$cur") )
127
+ return
128
+ fi
129
+
130
+ scope="$cmd"
131
+ if [ -n "$subs" ]; then scope="$cmd $sub"; fi
132
+
133
+ # A dash starts a flag; anything else is a positional.
134
+ case "$cur" in
135
+ -*)
136
+ COMPREPLY=( $(compgen -W "$(_xanots_flags "$scope")" -- "$cur") )
137
+ return
138
+ ;;
139
+ esac
140
+
141
+ # Directly after a flag that takes a closed set, offer that set.
142
+ local prev values
143
+ prev="\${COMP_WORDS[COMP_CWORD-1]}"
144
+ values="$(_xanots_flagvalues "$scope $prev")"
145
+ if [ -n "$values" ]; then
146
+ COMPREPLY=( $(compgen -W "$values" -- "$cur") )
147
+ return
148
+ fi
149
+
150
+ values="$(_xanots_argvalues "$scope")"
151
+ if [ -n "$values" ]; then
152
+ COMPREPLY=( $(compgen -W "$values" -- "$cur") )
153
+ return
154
+ fi
155
+
156
+ case "$scope" in
157
+ ${pathLines || "''"}) COMPREPLY=( $(compgen -f -- "$cur") ) ;;
158
+ esac
159
+ }
160
+
161
+ complete -o default -F _xanots xanots
162
+ `;
163
+ }
164
+ function renderZsh() {
165
+ const commandBlock = commandRows().map(([n, d]) => ` ${sq(`${n}:${d}`)}`).join("\n");
166
+ const familyBlocks = liveCommandNames().filter((c) => liveSubcommandNames(c).length > 0).map((c) => {
167
+ const rows = subcommandRows(c).map(([v, d]) => ` ${sq(`${v}:${d}`)}`).join("\n");
168
+ return ` ${c})
169
+ _xanots_verbs=(
170
+ ${rows}
171
+ )
172
+ ;;`;
173
+ }).join("\n");
174
+ const flagBlocks = scopes().filter((s) => s.flags.length > 0).map((s) => ` ${sq(s.key)}) _xanots_flags=(${s.flags.map(sq).join(" ")}) ;;`).join("\n");
175
+ const pathBlock = scopes().filter((s) => s.paths).map((s) => sq(s.key)).join("|");
176
+ const valueBlocks = scopes().filter((s) => s.values.length > 0).map((s) => ` ${sq(s.key)}) compadd ${s.values.map(sq).join(" ")}; return ;;`).join("\n");
177
+ const flagValueBlocks = scopes().flatMap((s) => s.valued.map(([token, values]) => [`${s.key} ${token}`, values])).map(([k, values]) => ` ${sq(k)}) compadd ${values.map(sq).join(" ")}; return ;;`).join("\n");
178
+ return `#compdef xanots
179
+ # xanots completion for zsh. Regenerate after upgrading:
180
+ # xanots completion zsh > "\${fpath[1]}/_xanots"
181
+ # # \u2026then restart your shell, or: autoload -U compinit && compinit
182
+
183
+ _xanots() {
184
+ local -a _xanots_commands _xanots_verbs _xanots_flags
185
+ local cmd sub scope
186
+ _xanots_commands=(
187
+ ${commandBlock}
188
+ )
189
+
190
+ if (( CURRENT == 2 )); then
191
+ _describe -t commands 'xanots command' _xanots_commands
192
+ return
193
+ fi
194
+
195
+ cmd="\${words[2]}"
196
+ case "$cmd" in
197
+ ${familyBlocks}
198
+ esac
199
+
200
+ if (( CURRENT == 3 )) && (( \${#_xanots_verbs} )); then
201
+ _describe -t subcommands "xanots $cmd subcommand" _xanots_verbs
202
+ return
203
+ fi
204
+
205
+ scope="$cmd"
206
+ if (( \${#_xanots_verbs} )); then
207
+ sub="\${words[3]}"
208
+ scope="$cmd $sub"
209
+ fi
210
+
211
+ case "$scope" in
212
+ ${flagBlocks}
213
+ esac
214
+
215
+ if [[ "\${words[CURRENT]}" == -* ]]; then
216
+ compadd -a _xanots_flags
217
+ return
218
+ fi
219
+
220
+ # Directly after a flag that takes a closed set, offer that set.
221
+ case "$scope \${words[CURRENT-1]}" in
222
+ ${flagValueBlocks}
223
+ esac
224
+
225
+ case "$scope" in
226
+ ${valueBlocks}
227
+ esac
228
+
229
+ case "$scope" in
230
+ ${pathBlock || "'__none__'"}) _files ;;
231
+ esac
232
+ }
233
+
234
+ _xanots "$@"
235
+ `;
236
+ }
237
+ function renderFish() {
238
+ const lines = [
239
+ "# xanots completion for fish. Regenerate after upgrading:",
240
+ "# xanots completion fish > ~/.config/fish/completions/xanots.fish",
241
+ "",
242
+ // Without this, fish offers files at every position.
243
+ "complete -c xanots -f",
244
+ ""
245
+ ];
246
+ for (const [name, desc] of commandRows()) {
247
+ lines.push(`complete -c xanots -n __fish_use_subcommand -a ${sq(name)} -d ${sq(desc)}`);
248
+ }
249
+ for (const command of liveCommandNames()) {
250
+ const verbs = subcommandRows(command);
251
+ if (verbs.length === 0) continue;
252
+ lines.push("");
253
+ for (const [verb, desc] of verbs) {
254
+ lines.push(
255
+ `complete -c xanots -n ${sq(`__fish_seen_subcommand_from ${command}; and not __fish_seen_subcommand_from ${verbs.map(([v]) => v).join(" ")}`)} -a ${sq(verb)} -d ${sq(desc)}`
256
+ );
257
+ }
258
+ }
259
+ lines.push("");
260
+ for (const scope of scopes()) {
261
+ if (scope.flags.length === 0 && !scope.paths && scope.values.length === 0) continue;
262
+ const words = scope.key.split(" ");
263
+ const condition = `__fish_seen_subcommand_from ${words.join(" ")}`;
264
+ const values = new Map(scope.valued);
265
+ for (const token of scope.flags) {
266
+ const bare = token.replace(/^-+/, "");
267
+ const which = token.startsWith("--") ? "-l" : "-s";
268
+ const set = values.get(token);
269
+ const suffix = set ? ` -r -a ${sq(set.join(" "))}` : "";
270
+ lines.push(`complete -c xanots -n ${sq(condition)} ${which} ${sq(bare)}${suffix}`);
271
+ }
272
+ if (scope.values.length > 0) {
273
+ lines.push(`complete -c xanots -n ${sq(condition)} -a ${sq(scope.values.join(" "))}`);
274
+ }
275
+ if (scope.paths) lines.push(`complete -c xanots -n ${sq(condition)} -F`);
276
+ }
277
+ return lines.join("\n") + "\n";
278
+ }
279
+ function renderCompletion(shell) {
280
+ switch (shell) {
281
+ case "bash":
282
+ return renderBash();
283
+ case "zsh":
284
+ return renderZsh();
285
+ case "fish":
286
+ return renderFish();
287
+ }
288
+ }
289
+ function runCompletionCommand(shell) {
290
+ process.stdout.write(renderCompletion(shell));
291
+ }
292
+ export {
293
+ COMPLETION_SHELLS,
294
+ isCompletionShell,
295
+ renderCompletion,
296
+ runCompletionCommand
297
+ };
298
+ //# sourceMappingURL=completion-TIPPZN7H.js.map
@@ -0,0 +1,84 @@
1
+ // src/validate/config.ts
2
+ import { existsSync, readFileSync } from "fs";
3
+ import { resolve as resolvePath } from "path";
4
+ var AUTH_CHECK_TIMEOUT_MS = 3e4;
5
+ var ENV_INSTANCE = "XANO_VALIDATE_INSTANCE";
6
+ var ENV_TOKEN = "XANO_VALIDATE_TOKEN";
7
+ var ENV_WORKSPACE = "XANO_VALIDATE_WORKSPACE_ID";
8
+ function loadDotEnv() {
9
+ const path = resolvePath(process.cwd(), ".env");
10
+ if (!existsSync(path)) return;
11
+ for (const line of readFileSync(path, "utf8").split("\n")) {
12
+ const trimmed = line.trim();
13
+ if (trimmed === "" || trimmed.startsWith("#")) continue;
14
+ const eq = trimmed.indexOf("=");
15
+ if (eq <= 0) continue;
16
+ const key = trimmed.slice(0, eq).trim();
17
+ let val = trimmed.slice(eq + 1).trim();
18
+ if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
19
+ val = val.slice(1, -1);
20
+ }
21
+ if (!(key in process.env)) process.env[key] = val;
22
+ }
23
+ }
24
+ function resolveOrigin(raw) {
25
+ let url;
26
+ try {
27
+ url = new URL(raw);
28
+ } catch {
29
+ throw new Error(`${ENV_INSTANCE} must be a full URL (got "${raw}"), e.g. https://your-instance.xano.io or http://localhost:8080.`);
30
+ }
31
+ if (url.protocol !== "https:" && url.protocol !== "http:") {
32
+ throw new Error(`${ENV_INSTANCE} must be an http(s) URL (got protocol "${url.protocol}").`);
33
+ }
34
+ return url.origin;
35
+ }
36
+ function resolveValidateConfig(overrides = {}) {
37
+ loadDotEnv();
38
+ const rawInstance = overrides.instance ?? process.env[ENV_INSTANCE];
39
+ if (rawInstance === void 0 || rawInstance === "") {
40
+ throw new Error(`Missing target instance. Set ${ENV_INSTANCE} (a base URL) or pass --instance <url>.`);
41
+ }
42
+ const instance = resolveOrigin(rawInstance);
43
+ const token = process.env[ENV_TOKEN];
44
+ if (token === void 0 || token === "") {
45
+ throw new Error(`Missing token. Set ${ENV_TOKEN} in your environment or a .env file (kept out of git).`);
46
+ }
47
+ let workspaceId = overrides.workspaceId;
48
+ if (workspaceId === void 0) {
49
+ const raw = process.env[ENV_WORKSPACE];
50
+ if (raw !== void 0 && raw !== "") {
51
+ workspaceId = Number(raw);
52
+ if (!Number.isInteger(workspaceId) || workspaceId < 1) {
53
+ throw new Error(`${ENV_WORKSPACE} must be a positive integer (got "${raw}").`);
54
+ }
55
+ }
56
+ }
57
+ return { instance, token, workspaceId };
58
+ }
59
+ async function verifyToken(config) {
60
+ const url = new URL("/api:meta/auth/me", config.instance);
61
+ const res = await fetch(url.href, {
62
+ headers: { Authorization: `Bearer ${config.token}` },
63
+ signal: AbortSignal.timeout(AUTH_CHECK_TIMEOUT_MS)
64
+ });
65
+ const text = await res.text();
66
+ if (!res.ok) {
67
+ throw new Error(
68
+ `Token check failed (${res.status} ${res.statusText}) against ${url.host}. Is ${ENV_TOKEN} valid for this instance?
69
+ ${text}`
70
+ );
71
+ }
72
+ let data = {};
73
+ try {
74
+ data = JSON.parse(text);
75
+ } catch {
76
+ }
77
+ const name = typeof data.name === "string" ? data.name : void 0;
78
+ return { name };
79
+ }
80
+ export {
81
+ resolveValidateConfig,
82
+ verifyToken
83
+ };
84
+ //# sourceMappingURL=config-NL33PN4D.js.map