@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.
- package/LICENSE +21 -0
- package/README.md +384 -0
- package/dist/agent-file-refresh-7XCACU34.js +95 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +184 -0
- package/dist/capture-HUV5BNTC.js +32 -0
- package/dist/chunk-26CNBZE2.js +963 -0
- package/dist/chunk-33ND6LKO.js +78 -0
- package/dist/chunk-3DUAGYGP.js +1550 -0
- package/dist/chunk-3IGNIP6R.js +89 -0
- package/dist/chunk-47WDWMBJ.js +14 -0
- package/dist/chunk-4BXJGVZ3.js +318 -0
- package/dist/chunk-4HT3BNZ7.js +675 -0
- package/dist/chunk-4YMD2OOZ.js +23 -0
- package/dist/chunk-5WGEURVI.js +156 -0
- package/dist/chunk-5YTBTF25.js +29 -0
- package/dist/chunk-6DHBYBTO.js +166 -0
- package/dist/chunk-76QBEIGO.js +66 -0
- package/dist/chunk-7DKX2SPN.js +100 -0
- package/dist/chunk-7REDODS2.js +468 -0
- package/dist/chunk-C56BC2FY.js +254 -0
- package/dist/chunk-DGSF2Q5H.js +60 -0
- package/dist/chunk-EMCAWMHC.js +3982 -0
- package/dist/chunk-EZG76F7R.js +159 -0
- package/dist/chunk-FJ6ZS5KB.js +3607 -0
- package/dist/chunk-GNPVYOPB.js +17 -0
- package/dist/chunk-HJPTWBLH.js +38 -0
- package/dist/chunk-IZW6MK3U.js +248 -0
- package/dist/chunk-LH6Z6KFV.js +247 -0
- package/dist/chunk-MZUI3JNX.js +93 -0
- package/dist/chunk-NDZFBZHC.js +167 -0
- package/dist/chunk-NOO35BQ2.js +37 -0
- package/dist/chunk-NUQCEOKA.js +13 -0
- package/dist/chunk-QTNO2WD6.js +56 -0
- package/dist/chunk-RVB7ITKN.js +49 -0
- package/dist/chunk-TRU5OHQ5.js +6904 -0
- package/dist/chunk-VKFQJEMW.js +814 -0
- package/dist/chunk-VTIL47DT.js +125 -0
- package/dist/chunk-WHOJWOSV.js +112 -0
- package/dist/chunk-WKP4D5MO.js +1692 -0
- package/dist/chunk-X4DVXBFY.js +38 -0
- package/dist/chunk-XQ22GLYS.js +118 -0
- package/dist/chunk-YDZYMZBE.js +670 -0
- package/dist/chunk-YGPIY3WT.js +1146 -0
- package/dist/chunk-YYRDLFSJ.js +602 -0
- package/dist/chunk-ZUTSMMAG.js +46 -0
- package/dist/cli.d.ts +331 -0
- package/dist/cli.js +33 -0
- package/dist/codegen-command-OOKK6AZK.js +40 -0
- package/dist/codegen.d.ts +114 -0
- package/dist/codegen.js +71 -0
- package/dist/completion-TIPPZN7H.js +298 -0
- package/dist/config-NL33PN4D.js +84 -0
- package/dist/deploy-command-4EQ7XX5G.js +451 -0
- package/dist/env-target-IFJ5QDHC.js +16 -0
- package/dist/ephemeral-command-3X3I4ULC.js +242 -0
- package/dist/index.d.ts +4477 -0
- package/dist/index.js +300 -0
- package/dist/init-command-R6H7ZXW5.js +27 -0
- package/dist/internal.d.ts +74 -0
- package/dist/internal.js +2065 -0
- package/dist/io-AMIKRLPC.js +11 -0
- package/dist/live-diff-Y3AKETHE.js +196 -0
- package/dist/lock-3CVKALKT.js +37 -0
- package/dist/lock-commands-XTR2YKLY.js +232 -0
- package/dist/login-command-ACJF6KWQ.js +167 -0
- package/dist/logout-command-MX3MJS5U.js +68 -0
- package/dist/loop-OM3P2Z6O.js +93 -0
- package/dist/marketplace-command-RATXTKXN.js +379 -0
- package/dist/meta-client-OW5WKWW7.js +170 -0
- package/dist/node.d.ts +59 -0
- package/dist/node.js +442 -0
- package/dist/profile-command-SWJ3SPKR.js +77 -0
- package/dist/release-command-VV5UVZKL.js +427 -0
- package/dist/response-CVAE2kMj.d.ts +1915 -0
- package/dist/routes-manifest-SP3ZXLMR.js +244 -0
- package/dist/runtime-V4C3AC3A.js +13 -0
- package/dist/sandbox-details-command-HJE5SPVG.js +18 -0
- package/dist/sandbox-export-command-QCJY4GMV.js +24 -0
- package/dist/static-host-D6KS7X45.js +138 -0
- package/dist/store-BQ97nKIF.d.ts +7760 -0
- package/dist/test-command-TSPBQHBM.js +383 -0
- package/dist/validate-command-4ERHJSCO.js +122 -0
- package/dist/verify-rollout-FAVQ6EJY.js +40 -0
- package/dist/workspace-K72NP7SX.js +49 -0
- package/dist/workspace-command-OF23DPNI.js +156 -0
- package/dist/workspace-export-AJMGN3CQ.js +10 -0
- package/llms/fields.md +104 -0
- package/llms/filters.md +183 -0
- package/llms/kinds-agent-mcp.md +11 -0
- package/llms/kinds-core.md +68 -0
- package/llms/kinds-realtime.md +76 -0
- package/llms/lambda.md +111 -0
- package/llms/legacy.md +43 -0
- package/llms/object-kinds.md +31 -0
- package/llms/statements-calls.md +23 -0
- package/llms/statements-catalog.md +309 -0
- package/llms/statements-data.md +58 -0
- package/llms/statements-runtime.md +48 -0
- package/llms/tests.md +58 -0
- package/llms/triggers.md +22 -0
- package/llms/values.md +29 -0
- package/llms-full.txt +1672 -0
- package/llms.txt +483 -0
- package/manifest.json +9592 -0
- package/package.json +110 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getEnvironment,
|
|
3
|
+
readEphemeralState
|
|
4
|
+
} from "./chunk-DGSF2Q5H.js";
|
|
5
|
+
import {
|
|
6
|
+
sandboxBaseUrl
|
|
7
|
+
} from "./chunk-7DKX2SPN.js";
|
|
8
|
+
import {
|
|
9
|
+
fetchReadOrExplain,
|
|
10
|
+
httpFailure
|
|
11
|
+
} from "./chunk-3IGNIP6R.js";
|
|
12
|
+
|
|
13
|
+
// src/emit/env-target.ts
|
|
14
|
+
var TIMEOUT_MS = 3e4;
|
|
15
|
+
async function getJson(url, auth, action) {
|
|
16
|
+
const res = await fetchReadOrExplain(
|
|
17
|
+
url,
|
|
18
|
+
{
|
|
19
|
+
headers: { accept: "application/json", Authorization: `Bearer ${auth.access_token}` },
|
|
20
|
+
signal: AbortSignal.timeout(TIMEOUT_MS)
|
|
21
|
+
},
|
|
22
|
+
action,
|
|
23
|
+
TIMEOUT_MS
|
|
24
|
+
);
|
|
25
|
+
const text = await res.text();
|
|
26
|
+
if (!res.ok) throw new Error(httpFailure(action, res, text));
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(text);
|
|
29
|
+
} catch {
|
|
30
|
+
throw new Error(`${action}: could not parse the response as JSON:
|
|
31
|
+
${text.slice(0, 200)}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function resolveSandbox(auth) {
|
|
35
|
+
const tenant = await getJson(`${auth.instance}/api:meta/sandbox/me`, auth, "resolve sandbox");
|
|
36
|
+
const base = sandboxBaseUrl(tenant, auth.instance);
|
|
37
|
+
const list = await getJson(`${base}/api:meta/workspace`, auth, "resolve sandbox workspace");
|
|
38
|
+
const workspaces = Array.isArray(list) ? list : [];
|
|
39
|
+
const workspaceId = workspaces.find((w) => typeof w.id === "number")?.id;
|
|
40
|
+
if (workspaceId === void 0) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Your sandbox has no workspace yet. Run \`xanots deploy --dest sandbox\` first.`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
return { base, workspaceId, label: "sandbox" };
|
|
46
|
+
}
|
|
47
|
+
async function resolveEphemeral(auth, name, deps) {
|
|
48
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
49
|
+
const tracked = getEnvironment(readEphemeralState(cwd), auth.workspaceId)?.name;
|
|
50
|
+
const resolved = name ?? tracked;
|
|
51
|
+
if (resolved === void 0 || resolved === "") {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`No ephemeral environment to target. Name one with \`--name <env>\` (\`xanots ephemeral list\` shows them), or run \`xanots deploy\` first \u2014 this project then remembers the env it deployed to.`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
const summary = await deps.resolveLive(auth, auth.workspaceId, resolved);
|
|
57
|
+
if (summary.url === void 0) {
|
|
58
|
+
throw new Error(`Ephemeral "${resolved}" has no base URL to address yet \u2014 it may still be provisioning.`);
|
|
59
|
+
}
|
|
60
|
+
return { base: summary.url, workspaceId: 1, label: `ephemeral ${resolved}`, env: resolved };
|
|
61
|
+
}
|
|
62
|
+
async function resolveMetaTarget(auth, opts, deps = {}) {
|
|
63
|
+
switch (opts.dest) {
|
|
64
|
+
case "workspace":
|
|
65
|
+
return { base: auth.instance, workspaceId: auth.workspaceId, label: `workspace ${auth.workspaceId}` };
|
|
66
|
+
case "sandbox":
|
|
67
|
+
return resolveSandbox(auth);
|
|
68
|
+
case "ephemeral": {
|
|
69
|
+
const resolveLive = deps.resolveLive ?? (await import("./ephemeral-command-3X3I4ULC.js")).resolveLive;
|
|
70
|
+
return resolveEphemeral(auth, opts.name, { ...deps, resolveLive });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
resolveMetaTarget
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=chunk-33ND6LKO.js.map
|