@xanots/sdk 0.0.9 → 0.0.11

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 (116) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +66 -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 +10 -8
  6. package/dist/{branch-commands-PBQ36L4A.js → branch-commands-2BLOC2GR.js} +13 -11
  7. package/dist/bundle.d.ts +218 -0
  8. package/dist/bundle.js +143 -0
  9. package/dist/{capture-7PO6SGB4.js → capture-4WVJY4DQ.js} +2 -2
  10. package/dist/{chunk-OW2QZEWL.js → chunk-22TKBSDV.js} +2 -2
  11. package/dist/{chunk-ZOYMZZ3S.js → chunk-3INK4Y4E.js} +1 -1
  12. package/dist/{chunk-NDZFBZHC.js → chunk-3UABJA4X.js} +1 -1
  13. package/dist/{chunk-6Z5CNWFC.js → chunk-4IF54NU5.js} +37 -6
  14. package/dist/{chunk-KSV7VOEX.js → chunk-4Q7ZOHH7.js} +3 -3
  15. package/dist/{chunk-QTNO2WD6.js → chunk-7ZYW652H.js} +1 -1
  16. package/dist/{chunk-4PTSTDIG.js → chunk-AIZKXUNP.js} +2 -2
  17. package/dist/{chunk-P5C2YKAM.js → chunk-ANUDXFEX.js} +18 -27
  18. package/dist/{chunk-4BXJGVZ3.js → chunk-BC2C5GVI.js} +2 -69
  19. package/dist/chunk-BSK7ELHU.js +70 -0
  20. package/dist/chunk-CTD5ZCV6.js +28 -0
  21. package/dist/{chunk-5HCDZ2XN.js → chunk-DBFU47BJ.js} +2 -2
  22. package/dist/{chunk-OKNSR7MT.js → chunk-DIA7CT7J.js} +129 -150
  23. package/dist/chunk-EHP3WPEG.js +21 -0
  24. package/dist/{chunk-JQLR64UC.js → chunk-F6CYJ7TN.js} +21 -6
  25. package/dist/{chunk-BKDJN76G.js → chunk-FE5I6S6N.js} +1 -1
  26. package/dist/{chunk-5YQOIFT4.js → chunk-G4EJMQLD.js} +2 -2
  27. package/dist/{chunk-L6TPHWAU.js → chunk-HYBN4H3F.js} +60 -86
  28. package/dist/{chunk-QIWBCS7N.js → chunk-JGCWTCA7.js} +2 -2
  29. package/dist/{chunk-MDXR5E5Q.js → chunk-K5IOND4K.js} +2 -2
  30. package/dist/{chunk-4PE4ZAB7.js → chunk-KA6G2L7U.js} +5 -5
  31. package/dist/chunk-OHX6MIUZ.js +184 -0
  32. package/dist/{chunk-UDL46O35.js → chunk-OWGCOGKK.js} +155 -3
  33. package/dist/{chunk-QONOJO45.js → chunk-QK7ZQJLP.js} +140 -20
  34. package/dist/{chunk-3QW5NFZJ.js → chunk-QKM4U5UK.js} +3 -3
  35. package/dist/{chunk-7OXFMCTX.js → chunk-QYMAZRAU.js} +7 -7
  36. package/dist/{chunk-K3YSQDXJ.js → chunk-RCT7UX7B.js} +92 -75
  37. package/dist/{chunk-T4XPCJRF.js → chunk-TCFIPDB3.js} +1 -1
  38. package/dist/{chunk-ZZLPTHT5.js → chunk-UOZMSF4C.js} +15 -8
  39. package/dist/{chunk-7JDT4PBU.js → chunk-VAF6A3YD.js} +5 -179
  40. package/dist/{chunk-6DHBYBTO.js → chunk-VNQM3V2C.js} +1 -2
  41. package/dist/chunk-WGPXT2G2.js +22 -0
  42. package/dist/{chunk-6AAT2AYQ.js → chunk-WP4OZZV4.js} +2 -2
  43. package/dist/{chunk-OYMR5AMJ.js → chunk-XEOX6AM7.js} +2 -2
  44. package/dist/{chunk-MU3O43L2.js → chunk-YBC3IKMF.js} +2 -2
  45. package/dist/chunk-ZQ2PKR6R.js +40 -0
  46. package/dist/cli.d.ts +57 -31
  47. package/dist/cli.js +9 -7
  48. package/dist/codegen-command-FUT2KJB6.js +49 -0
  49. package/dist/codegen.d.ts +2 -1
  50. package/dist/{completion-A6BZ3XGU.js → completion-WF46272M.js} +2 -2
  51. package/dist/{config-NL33PN4D.js → config-476F3PT5.js} +1 -1
  52. package/dist/{deploy-command-5TTI4TUP.js → deploy-command-IP7V7GT4.js} +69 -100
  53. package/dist/{ephemeral-command-7TK52YQM.js → ephemeral-command-U4AQ3TXX.js} +25 -28
  54. package/dist/index.d.ts +6 -4
  55. package/dist/index.js +10 -9
  56. package/dist/init-command-NPVL32L6.js +34 -0
  57. package/dist/{onboard-command-EHOHKQQU.js → init-web-3JNFG6GI.js} +10 -10
  58. package/dist/internal.d.ts +4 -4
  59. package/dist/internal.js +86 -73
  60. package/dist/io-P2H75UV2.js +12 -0
  61. package/dist/{live-diff-QK4KC2FJ.js → live-diff-IXKBVG4K.js} +3 -3
  62. package/dist/{lock-GFXD6G2E.js → lock-46FWYE4D.js} +3 -2
  63. package/dist/{lock-commands-ET7NIOLH.js → lock-commands-ZZKZ4LZJ.js} +23 -21
  64. package/dist/{login-command-DFCURZLC.js → login-command-Z6CHTA57.js} +7 -7
  65. package/dist/{logout-command-WXVZQCAV.js → logout-command-ER6IKAYJ.js} +2 -2
  66. package/dist/{loop-7SAIGRCZ.js → loop-D5NPL4VH.js} +3 -3
  67. package/dist/{marketplace-command-BCOAAN2I.js → marketplace-command-P4IPLJ6J.js} +6 -6
  68. package/dist/{meta-client-57ZWVHST.js → meta-client-K2J4XH64.js} +6 -6
  69. package/dist/node.d.ts +5 -4
  70. package/dist/node.js +15 -13
  71. package/dist/{validate-command-SK5FPCV7.js → preflight-command-K346GPTY.js} +20 -18
  72. package/dist/{profile-command-QJAAUZIV.js → profile-command-LJSBDV2L.js} +5 -5
  73. package/dist/{release-command-4EXVLYV2.js → release-command-IMNTIVWK.js} +42 -38
  74. package/dist/response-BQVQ24l1.d.ts +844 -0
  75. package/dist/{routes-manifest-SP3ZXLMR.js → routes-manifest-PWZHDOI5.js} +2 -2
  76. package/dist/scaffold.js +2 -2
  77. package/dist/{static-host-D6KS7X45.js → static-host-3WMV7IZO.js} +1 -1
  78. package/dist/status-command-AL47VG7H.js +162 -0
  79. package/dist/{store-CUCBSYLj.d.ts → store-BLyNeQ8S.d.ts} +21 -8
  80. package/dist/{test-command-2F5LKMI6.js → test-command-YAZLKLGQ.js} +45 -28
  81. package/dist/{upgrade-command-QL523I62.js → upgrade-command-BN3EHAOI.js} +16 -14
  82. package/dist/{workspace-K72NP7SX.js → workspace-2COHDBM3.js} +1 -1
  83. package/dist/{workspace-command-HYA6JEKK.js → workspace-command-MNK7Y7MQ.js} +36 -34
  84. package/dist/{workspace-export-AJMGN3CQ.js → workspace-export-DURY5WYL.js} +2 -2
  85. package/dist/{response-CVAE2kMj.d.ts → xdo-BjJj5W_E.d.ts} +1 -837
  86. package/guides/README.md +2 -2
  87. package/guides/cli.md +17 -19
  88. package/guides/codegen.md +21 -5
  89. package/guides/coverage.md +1 -1
  90. package/guides/deploying.md +31 -34
  91. package/guides/environment.md +4 -4
  92. package/guides/object-kinds.md +3 -3
  93. package/guides/project-structure.md +1 -1
  94. package/guides/scaffold.md +25 -2
  95. package/guides/typed-frontend.md +2 -2
  96. package/llms/filters.md +11 -10
  97. package/llms/kinds-agent-mcp.md +1 -1
  98. package/llms/kinds-core.md +2 -2
  99. package/llms/kinds-realtime.md +1 -1
  100. package/llms/lock.md +5 -5
  101. package/llms/statements-data.md +3 -1
  102. package/llms/tests.md +1 -1
  103. package/llms/values.md +1 -1
  104. package/llms-full.txt +65 -63
  105. package/llms.txt +40 -41
  106. package/manifest.json +96 -427
  107. package/package.json +7 -2
  108. package/dist/chunk-3EYUR3TX.js +0 -100
  109. package/dist/chunk-JQJPFUZI.js +0 -118
  110. package/dist/chunk-YNZFIY4J.js +0 -78
  111. package/dist/codegen-command-YSCSCVT5.js +0 -43
  112. package/dist/env-target-4T7AT347.js +0 -16
  113. package/dist/init-command-OVFFW4QS.js +0 -30
  114. package/dist/io-M7XZEMK7.js +0 -11
  115. package/dist/sandbox-details-command-EDO56IY3.js +0 -18
  116. package/dist/sandbox-export-command-MO6DEZ7Z.js +0 -24
@@ -98,7 +98,7 @@ ${overloadsFor("routePath", rows)}
98
98
  ${IMPLEMENTATION}${realtimeSection}`;
99
99
  }
100
100
  var HEADER = `/**
101
- * GENERATED by \`xanots paths --emit\`. Do not edit.
101
+ * GENERATED by \`xanots routes --emit\`. Do not edit.
102
102
  *
103
103
  * Plain data plus one interpolator \u2014 this file imports nothing, so a frontend
104
104
  * gets the typed path/verb (and socket) contract without pulling the SDK runtime
@@ -241,4 +241,4 @@ export {
241
241
  RouteManifestError,
242
242
  renderRouteManifest
243
243
  };
244
- //# sourceMappingURL=routes-manifest-SP3ZXLMR.js.map
244
+ //# sourceMappingURL=routes-manifest-PWZHDOI5.js.map
package/dist/scaffold.js CHANGED
@@ -4,10 +4,10 @@ import {
4
4
  allFrontendPresets,
5
5
  findFrontendPreset,
6
6
  resolveFrameworkFlag
7
- } from "./chunk-MU3O43L2.js";
7
+ } from "./chunk-YBC3IKMF.js";
8
8
  import {
9
9
  renderIndexCss
10
- } from "./chunk-P5C2YKAM.js";
10
+ } from "./chunk-ANUDXFEX.js";
11
11
  import {
12
12
  ACCENTS,
13
13
  ACCENT_TOKENS,
@@ -135,4 +135,4 @@ export {
135
135
  findSeedLeaks,
136
136
  tarGz2 as tarGz
137
137
  };
138
- //# sourceMappingURL=static-host-D6KS7X45.js.map
138
+ //# sourceMappingURL=static-host-3WMV7IZO.js.map
@@ -0,0 +1,162 @@
1
+ import {
2
+ getEphemeral,
3
+ isExpired
4
+ } from "./chunk-VNQM3V2C.js";
5
+ import {
6
+ isMachineOutput,
7
+ writeJson
8
+ } from "./chunk-NUQCEOKA.js";
9
+ import {
10
+ getEnvironment,
11
+ readEphemeralState
12
+ } from "./chunk-K5IOND4K.js";
13
+ import {
14
+ getAccessToken
15
+ } from "./chunk-QKM4U5UK.js";
16
+ import "./chunk-FE5I6S6N.js";
17
+ import {
18
+ fetchOrExplain,
19
+ httpFailure
20
+ } from "./chunk-3IGNIP6R.js";
21
+ import "./chunk-GNPVYOPB.js";
22
+ import {
23
+ formatExpiration,
24
+ formatFields,
25
+ stdoutStyle
26
+ } from "./chunk-EZG76F7R.js";
27
+
28
+ // src/emit/status-command.ts
29
+ var TIMEOUT_MS = 3e4;
30
+ function asString(v) {
31
+ return typeof v === "string" && v !== "" ? v : void 0;
32
+ }
33
+ async function getJson(url, auth, action) {
34
+ const res = await fetchOrExplain(
35
+ url,
36
+ {
37
+ headers: { accept: "application/json", Authorization: `Bearer ${auth.access_token}` },
38
+ signal: AbortSignal.timeout(TIMEOUT_MS)
39
+ },
40
+ action,
41
+ TIMEOUT_MS
42
+ );
43
+ const text = await res.text();
44
+ if (!res.ok) throw new Error(httpFailure(action, res, text));
45
+ try {
46
+ return JSON.parse(text);
47
+ } catch {
48
+ throw new Error(`${action}: could not parse the response as JSON:
49
+ ${text.slice(0, 200)}`);
50
+ }
51
+ }
52
+ async function readWorkspace(auth) {
53
+ const list = await getJson(`${auth.instance}/api:meta/workspace`, auth, "workspace list");
54
+ const all = Array.isArray(list) ? list : [];
55
+ const match = all.find((w) => w.id === auth.workspaceId);
56
+ if (match === void 0) {
57
+ return {
58
+ id: auth.workspaceId,
59
+ name: null,
60
+ credential: auth.credentialType,
61
+ note: `this credential cannot see workspace ${auth.workspaceId} \u2014 run \`xanots workspace details\` for the ids that would work`
62
+ };
63
+ }
64
+ return {
65
+ id: auth.workspaceId,
66
+ name: asString(match.name) ?? null,
67
+ credential: auth.credentialType
68
+ };
69
+ }
70
+ async function readEnvironment(auth, cwd) {
71
+ const tracked = getEnvironment(readEphemeralState(cwd), auth.workspaceId);
72
+ if (tracked === void 0) return null;
73
+ const summary = await getEphemeral(auth, { parentWorkspaceId: auth.workspaceId, name: tracked.name });
74
+ if (summary === null) {
75
+ return {
76
+ name: tracked.name,
77
+ display: tracked.display,
78
+ url: tracked.url,
79
+ state: null,
80
+ expiresAt: tracked.expires_at,
81
+ alive: false
82
+ };
83
+ }
84
+ return {
85
+ name: summary.name,
86
+ display: summary.display,
87
+ url: summary.url,
88
+ state: summary.state ?? null,
89
+ expiresAt: summary.expiresAt,
90
+ alive: !isExpired(summary.expiresAt)
91
+ };
92
+ }
93
+ async function readStatus(args, cwd = process.cwd()) {
94
+ let auth;
95
+ try {
96
+ auth = await getAccessToken(args);
97
+ } catch {
98
+ return { signedIn: false, instance: null, user: null, workspace: null, environment: null };
99
+ }
100
+ const me = await getJson(`${auth.instance}/api:meta/auth/me`, auth, "whoami");
101
+ return {
102
+ signedIn: true,
103
+ instance: auth.instance,
104
+ user: {
105
+ id: typeof me.id === "number" ? me.id : void 0,
106
+ name: asString(me.name),
107
+ email: asString(me.email)
108
+ },
109
+ workspace: await readWorkspace(auth),
110
+ environment: await readEnvironment(auth, cwd)
111
+ };
112
+ }
113
+ function prettyStatus(status) {
114
+ const s = stdoutStyle();
115
+ if (!status.signedIn) {
116
+ return `
117
+ ${formatFields([
118
+ ["Signed in", `${s.bold("no")} ${s.dim("\xB7 run `xanots login`")}`]
119
+ ])}`;
120
+ }
121
+ const who = [status.user?.name, status.user?.email && `<${status.user.email}>`].filter(Boolean).join(" ");
122
+ const rows = [
123
+ ["Signed in", who !== "" ? who : s.dim("(unknown user)")],
124
+ ["Instance", s.bold(s.cyan(status.instance ?? ""))]
125
+ ];
126
+ const ws = status.workspace;
127
+ if (ws !== null) {
128
+ rows.push([
129
+ "Workspace",
130
+ `${ws.id}${ws.name === null ? "" : ` \xB7 ${ws.name}`} ${s.dim(`\xB7 ${ws.credential}`)}`
131
+ ]);
132
+ if (ws.note !== void 0) rows.push(["", s.dim(ws.note)]);
133
+ }
134
+ const env = status.environment;
135
+ if (env === null) {
136
+ rows.push(["Environment", s.dim("none yet \xB7 run `xanots deploy`")]);
137
+ } else if (!env.alive) {
138
+ rows.push([
139
+ "Environment",
140
+ `${env.name} ${s.dim("\xB7 gone or expired \xB7 run `xanots deploy` for a fresh one")}`
141
+ ]);
142
+ } else {
143
+ const state = env.state === null ? "" : ` ${s.dim(`\xB7 ${env.state}`)}`;
144
+ rows.push(["Environment", `${env.name}${state} ${s.dim(`\xB7 expires ${formatExpiration(env.expiresAt)}`)}`]);
145
+ if (env.url !== void 0) rows.push(["URL", s.bold(s.cyan(env.url))]);
146
+ }
147
+ return `
148
+ ${formatFields(rows)}`;
149
+ }
150
+ async function runStatusCommand(args) {
151
+ const status = await readStatus(args);
152
+ if (isMachineOutput(args)) {
153
+ writeJson(status);
154
+ } else {
155
+ process.stdout.write(prettyStatus(status));
156
+ }
157
+ }
158
+ export {
159
+ readStatus,
160
+ runStatusCommand
161
+ };
162
+ //# sourceMappingURL=status-command-AL47VG7H.js.map
@@ -1,4 +1,5 @@
1
- import { V as Value, aG as FieldOptions, q as FieldMap, aH as Prettify, $ as RowFromFieldMap, v as FieldXdo, l as ExprNode, y as FromFieldMap, aI as ReadonlyMethods, M as MethodArg, af as TextMethod, ag as TypeBrand, z as IntMethod, D as DecimalMethod, E as EmailMethod, U as PasswordMethod, aJ as XanoFileUpload, T as ObjectRef, aK as XanoDbLink, aL as ConstMethodOpts, p as FieldDescriptor, aj as XanoFileRef, al as XanoGeoValue, ai as VectorMethod, a7 as TableRefMethod, c as BrandValue, a0 as StackItemXdo, a1 as Statement, Z as ResponseDef, aa as TestDef, C as CacheXdo, w as FilterXdo, I as InputXdo, _ as ResultItemXdo, N as MockMap, ad as TestXdo } from './response-CVAE2kMj.js';
1
+ import { V as Value, g as FieldXdo, d as ExprNode, S as StackItemXdo, p as TestDef, C as CacheXdo, h as FilterXdo, I as InputXdo, k as ResultItemXdo, s as TestXdo } from './xdo-BjJj5W_E.js';
2
+ import { W as FieldOptions, h as FieldMap, Y as Prettify, x as RowFromFieldMap, l as FromFieldMap, Z as ReadonlyMethods, M as MethodArg, C as TextMethod, G as TypeBrand, I as IntMethod, D as DecimalMethod, E as EmailMethod, P as PasswordMethod, _ as XanoFileUpload, v as ObjectRef, $ as XanoDbLink, a0 as ConstMethodOpts, f as FieldDescriptor, X as XanoFileRef, K as XanoGeoValue, H as VectorMethod, T as TableRefMethod, b as BrandValue, S as Statement, w as ResponseDef, p as MockMap } from './response-BQVQ24l1.js';
2
3
 
3
4
  /**
4
5
  * The single boolean-expression algebra shared by every SDK surface that emits
@@ -5051,7 +5052,7 @@ type RealtimeServerHandle = RealtimeServerDef & {
5051
5052
  * IN A BROWSER BUNDLE, prefer the generated manifest: importing this def for
5052
5053
  * its `getUrl()` pulls the SDK runtime in with it (the same ~289 kB floor a
5053
5054
  * query def costs — the factory CALLS that build the def run at module load).
5054
- * `xanots paths <entry> --emit xano/routes.gen.ts` writes the identical
5055
+ * `xanots routes <entry> --emit xano/routes.gen.ts` writes the identical
5055
5056
  * address, tenant lift included, as `socketUrl("<server>", baseUrl)` in a file
5056
5057
  * that imports nothing.
5057
5058
  *
@@ -5353,7 +5354,7 @@ type RealtimeChannelHandle<I extends Record<string, InputDescriptor> = Record<st
5353
5354
  * channel).
5354
5355
  *
5355
5356
  * IN A BROWSER BUNDLE, prefer the generated manifest's `channelPath()`
5356
- * (`xanots paths <entry> --emit`): identical output and the same
5357
+ * (`xanots routes <entry> --emit`): identical output and the same
5357
5358
  * compile-time param checking, in a file that imports no SDK runtime.
5358
5359
  */
5359
5360
  getChannel: IsStaticPath<N> extends true ? (params?: Record<string, never>) => string : (params: PathParamValues<N>) => string;
@@ -5977,8 +5978,20 @@ interface QueryDef<I extends Record<string, InputDescriptor> = Record<string, In
5977
5978
  * input deploys as a permanently-broken route. `required: true` is NOT
5978
5979
  * demanded, because Xano's own editor leaves path-param inputs unmarked. A
5979
5980
  * marker need not be a whole segment: `"blog/post-{slug}"` routes fine.
5980
- * Inputs that are not in the path are ordinary query-string/body params and
5981
- * need nothing special.
5981
+ *
5982
+ * The CONVERSE is warned rather than enforced. An input that a `GET`/`DELETE`/
5983
+ * `HEAD` looks ONE ROW up by — the match argument of `s.db.get`,
5984
+ * `get_by_id`, `has`, or the by-field edit/patch/delete family — is
5985
+ * ADDRESSING a resource and belongs in the path; `export()` reports
5986
+ * `query.path-segment-candidate` when the path does not bind it. The endpoint
5987
+ * still serves `?blog_id=1`, which is why it is a warning: what it costs is
5988
+ * that the route is not addressable the way a REST client, cache key, or
5989
+ * access log expects, and `getPath()` types as STATIC, so a caller cannot
5990
+ * pass the value positionally. A segment is any value that names WHICH
5991
+ * resource is wanted, not merely one named like a key — `"shop/{country}"`
5992
+ * and `"blog/{category}"` are this shape too. An input that NARROWS A LIST
5993
+ * (an `s.db.query` filter) is the opposite case and correctly stays a
5994
+ * query-string param; inputs that are not in the path need nothing special.
5982
5995
  *
5983
5996
  * Captured as a literal so `getPath({ params })` types its keys from it.
5984
5997
  */
@@ -7332,10 +7345,10 @@ interface ManifestCliFlag {
7332
7345
  * `src/emit/commands.ts` — the same table that renders `--help` and generates the
7333
7346
  * shell completions.
7334
7347
  *
7335
- * It used to be hand-maintained here, and it drifted: `init` and `validate` were
7348
+ * It used to be hand-maintained here, and it drifted: `init` and `preflight` were
7336
7349
  * missing outright, `deploy` was short six flags, and the `--static` description
7337
- * claimed the frontend always lands on the parent workspace (true only under
7338
- * `--dest sandbox`). Deriving it makes that class of drift unrepresentable, which
7350
+ * claimed the frontend lands on the parent workspace, which it does not.
7351
+ * Deriving it makes that class of drift unrepresentable, which
7339
7352
  * matters more now that `llms.txt` no longer documents the CLI — this array and
7340
7353
  * `--help` are the only two surfaces, and they are now one source.
7341
7354
  */
@@ -1,25 +1,28 @@
1
- import {
2
- resolveMetaTarget
3
- } from "./chunk-YNZFIY4J.js";
4
- import "./chunk-MDXR5E5Q.js";
5
- import "./chunk-3EYUR3TX.js";
6
- import "./chunk-NDZFBZHC.js";
7
- import {
8
- getAccessToken
9
- } from "./chunk-3QW5NFZJ.js";
10
- import "./chunk-BKDJN76G.js";
11
1
  import {
12
2
  isMachineOutput,
13
3
  writeJson
14
4
  } from "./chunk-NUQCEOKA.js";
5
+ import {
6
+ resolveMetaTarget
7
+ } from "./chunk-ZQ2PKR6R.js";
8
+ import "./chunk-K5IOND4K.js";
9
+ import {
10
+ getAccessToken
11
+ } from "./chunk-QKM4U5UK.js";
12
+ import "./chunk-FE5I6S6N.js";
15
13
  import {
16
14
  fetchOrExplain,
17
15
  httpFailure,
18
16
  serverMessage
19
17
  } from "./chunk-3IGNIP6R.js";
20
18
  import {
19
+ parseEnvSelector,
20
+ unknownEnv
21
+ } from "./chunk-CTD5ZCV6.js";
22
+ import {
23
+ UsageError,
21
24
  unknownSubcommand
22
- } from "./chunk-JQLR64UC.js";
25
+ } from "./chunk-F6CYJ7TN.js";
23
26
  import "./chunk-GNPVYOPB.js";
24
27
  import {
25
28
  blank,
@@ -29,7 +32,7 @@ import {
29
32
  success,
30
33
  warn
31
34
  } from "./chunk-EZG76F7R.js";
32
- import "./chunk-OKNSR7MT.js";
35
+ import "./chunk-DIA7CT7J.js";
33
36
 
34
37
  // src/deploy/tests.ts
35
38
  var TIMEOUT_MS = 12e4;
@@ -189,7 +192,7 @@ async function runTest(auth, target, handle) {
189
192
 
190
193
  // src/emit/test-command.ts
191
194
  var EXIT_TESTS_FAILED = 5;
192
- var DEFAULT_DEST = "ephemeral";
195
+ var DEFAULT_ENV = { kind: "ephemeral" };
193
196
  async function mapWithConcurrency(items, limit, work) {
194
197
  const results = new Array(items.length);
195
198
  let next = 0;
@@ -250,10 +253,22 @@ function report(args, dest, env, outcomes) {
250
253
  }
251
254
  if (summary.failed > 0) process.exitCode = EXIT_TESTS_FAILED;
252
255
  }
253
- async function resolveTarget(args, auth) {
254
- const dest = args.dest ?? DEFAULT_DEST;
255
- const target = await resolveMetaTarget(auth, { dest, name: args.name });
256
- return { dest, env: target.env ?? null, target };
256
+ function assertNoName(args) {
257
+ if (args.name === void 0) return;
258
+ throw new UsageError(
259
+ `\`xanots test\` takes no \`--name\` \u2014 name the environment inside \`--env\` instead: \`--env ephemeral:${args.name}\`.`,
260
+ { helpFor: { command: "test", subcommand: args.subcommand } }
261
+ );
262
+ }
263
+ function selectEnv(args) {
264
+ if (args.env === void 0) return DEFAULT_ENV;
265
+ return parseEnvSelector(args.env) ?? (() => {
266
+ throw unknownEnv("--env", args.env, { command: "test", subcommand: args.subcommand });
267
+ })();
268
+ }
269
+ async function resolveTarget(selector, auth) {
270
+ const target = await resolveMetaTarget(auth, selector);
271
+ return { dest: selector.kind, env: target.env ?? null, target };
257
272
  }
258
273
  async function collect(auth, target, kind) {
259
274
  return listTests(auth, target, {
@@ -264,8 +279,8 @@ async function collect(auth, target, kind) {
264
279
  function nameWidth(handles) {
265
280
  return Math.max(0, ...handles.map((h) => h.name.length));
266
281
  }
267
- async function runList(args, auth) {
268
- const { dest, env, target } = await resolveTarget(args, auth);
282
+ async function runList(args, auth, selector) {
283
+ const { dest, env, target } = await resolveTarget(selector, auth);
269
284
  const handles = await collect(auth, target, args.kind);
270
285
  if (isMachineOutput(args)) {
271
286
  writeJson({
@@ -300,13 +315,13 @@ function match(handles, needle) {
300
315
  if (qualified.length > 0) return qualified;
301
316
  return handles.filter((h) => h.name === needle);
302
317
  }
303
- async function runOne(args, auth, name) {
304
- const { dest, env, target } = await resolveTarget(args, auth);
318
+ async function runOne(args, auth, selector, name) {
319
+ const { dest, env, target } = await resolveTarget(selector, auth);
305
320
  const handles = await collect(auth, target, args.kind);
306
321
  const found = match(handles, name);
307
322
  if (found.length === 0) {
308
323
  throw new Error(
309
- `No test named "${name}" in ${target.label}. Run \`xanots test list${args.dest ? ` --dest ${args.dest}` : ""}\` to see what is there.`
324
+ `No test named "${name}" in ${target.label}. Run \`xanots test list${args.env ? ` --env ${args.env}` : ""}\` to see what is there.`
310
325
  );
311
326
  }
312
327
  if (found.length > 1) {
@@ -348,8 +363,8 @@ async function runSuite(auth, target, opts) {
348
363
  return outcome;
349
364
  });
350
365
  }
351
- async function runAll(args, auth) {
352
- const { dest, env, target } = await resolveTarget(args, auth);
366
+ async function runAll(args, auth, selector) {
367
+ const { dest, env, target } = await resolveTarget(selector, auth);
353
368
  const outcomes = await runSuite(auth, target, {
354
369
  kind: args.kind,
355
370
  concurrency: args.concurrency,
@@ -358,19 +373,21 @@ async function runAll(args, auth) {
358
373
  report(args, dest, env, outcomes);
359
374
  }
360
375
  async function runTestCommand(args) {
376
+ assertNoName(args);
377
+ const selector = selectEnv(args);
361
378
  const auth = await getAccessToken(args);
362
379
  switch (args.subcommand) {
363
380
  case "list":
364
- return runList(args, auth);
381
+ return runList(args, auth, selector);
365
382
  case "run": {
366
383
  const name = args.positionals[0];
367
384
  if (name === void 0 || name === "") {
368
385
  throw new Error('`xanots test run` needs a test name: `xanots test run "<name>"`.');
369
386
  }
370
- return runOne(args, auth, name);
387
+ return runOne(args, auth, selector, name);
371
388
  }
372
389
  case "run-all":
373
- return runAll(args, auth);
390
+ return runAll(args, auth, selector);
374
391
  default:
375
392
  throw unknownSubcommand("test", args.subcommand);
376
393
  }
@@ -380,4 +397,4 @@ export {
380
397
  runSuite,
381
398
  runTestCommand
382
399
  };
383
- //# sourceMappingURL=test-command-2F5LKMI6.js.map
400
+ //# sourceMappingURL=test-command-YAZLKLGQ.js.map
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  assertProjectDir
3
3
  } from "./chunk-ERQZFWIW.js";
4
+ import {
5
+ refreshAgentFiles
6
+ } from "./chunk-JGCWTCA7.js";
4
7
  import {
5
8
  isMachineOutput,
6
9
  writeJson
7
10
  } from "./chunk-NUQCEOKA.js";
8
- import {
9
- refreshAgentFiles
10
- } from "./chunk-QIWBCS7N.js";
11
- import "./chunk-4PE4ZAB7.js";
11
+ import "./chunk-KA6G2L7U.js";
12
12
  import {
13
13
  runNpm
14
14
  } from "./chunk-ZSYZTGJH.js";
15
15
  import {
16
16
  sdkDep
17
- } from "./chunk-P5C2YKAM.js";
17
+ } from "./chunk-ANUDXFEX.js";
18
18
  import "./chunk-Q77KNEUL.js";
19
19
  import {
20
20
  checkForUpgrade,
@@ -22,10 +22,11 @@ import {
22
22
  registryUrl,
23
23
  suppressUpdateNotice,
24
24
  upgradeCommand
25
- } from "./chunk-OW2QZEWL.js";
26
- import "./chunk-K3YSQDXJ.js";
27
- import "./chunk-JQLR64UC.js";
28
- import "./chunk-OYMR5AMJ.js";
25
+ } from "./chunk-22TKBSDV.js";
26
+ import "./chunk-RCT7UX7B.js";
27
+ import "./chunk-CTD5ZCV6.js";
28
+ import "./chunk-XEOX6AM7.js";
29
+ import "./chunk-F6CYJ7TN.js";
29
30
  import "./chunk-GNPVYOPB.js";
30
31
  import {
31
32
  blank,
@@ -35,12 +36,13 @@ import {
35
36
  success,
36
37
  warn
37
38
  } from "./chunk-EZG76F7R.js";
38
- import "./chunk-UDL46O35.js";
39
- import "./chunk-OKNSR7MT.js";
40
- import "./chunk-QONOJO45.js";
39
+ import "./chunk-OWGCOGKK.js";
40
+ import "./chunk-DIA7CT7J.js";
41
+ import "./chunk-QK7ZQJLP.js";
41
42
  import "./chunk-WHOJWOSV.js";
43
+ import "./chunk-VAF6A3YD.js";
42
44
  import "./chunk-5XZ744TS.js";
43
- import "./chunk-7JDT4PBU.js";
45
+ import "./chunk-OHX6MIUZ.js";
44
46
 
45
47
  // src/emit/upgrade-command.ts
46
48
  import { readFileSync, writeFileSync } from "fs";
@@ -174,4 +176,4 @@ function messageOf(err) {
174
176
  export {
175
177
  runUpgradeCommand
176
178
  };
177
- //# sourceMappingURL=upgrade-command-QL523I62.js.map
179
+ //# sourceMappingURL=upgrade-command-BN3EHAOI.js.map
@@ -46,4 +46,4 @@ ${text}`);
46
46
  export {
47
47
  resolveScopedWorkspaceId
48
48
  };
49
- //# sourceMappingURL=workspace-K72NP7SX.js.map
49
+ //# sourceMappingURL=workspace-2COHDBM3.js.map
@@ -1,48 +1,51 @@
1
- import {
2
- fetchWorkspaceBundle,
3
- runCodegenCommand
4
- } from "./chunk-L6TPHWAU.js";
5
- import "./chunk-ZOYMZZ3S.js";
6
1
  import {
7
2
  resolveOutputTarget
8
- } from "./chunk-JQJPFUZI.js";
9
- import "./chunk-3EYUR3TX.js";
3
+ } from "./chunk-WGPXT2G2.js";
10
4
  import {
11
5
  printMicroserviceSection,
12
6
  readMicroservices
13
- } from "./chunk-NDZFBZHC.js";
7
+ } from "./chunk-3UABJA4X.js";
8
+ import {
9
+ isMachineOutput,
10
+ writeJson
11
+ } from "./chunk-NUQCEOKA.js";
12
+ import {
13
+ fetchWorkspaceBundle
14
+ } from "./chunk-HYBN4H3F.js";
15
+ import "./chunk-ZQ2PKR6R.js";
16
+ import "./chunk-K5IOND4K.js";
14
17
  import {
15
18
  ENV_WORKSPACE,
16
19
  getAccessToken
17
- } from "./chunk-3QW5NFZJ.js";
18
- import "./chunk-BKDJN76G.js";
19
- import "./chunk-QTNO2WD6.js";
20
+ } from "./chunk-QKM4U5UK.js";
21
+ import "./chunk-FE5I6S6N.js";
22
+ import "./chunk-7ZYW652H.js";
20
23
  import "./chunk-ZUTSMMAG.js";
21
24
  import "./chunk-X4DVXBFY.js";
22
- import "./chunk-6Z5CNWFC.js";
23
- import {
24
- isMachineOutput,
25
- writeJson
26
- } from "./chunk-NUQCEOKA.js";
27
- import "./chunk-4PE4ZAB7.js";
28
- import "./chunk-ZSYZTGJH.js";
29
25
  import {
30
26
  fetchOrExplain,
31
27
  httpFailure
32
28
  } from "./chunk-3IGNIP6R.js";
33
- import "./chunk-5YQOIFT4.js";
29
+ import "./chunk-4IF54NU5.js";
30
+ import "./chunk-KA6G2L7U.js";
31
+ import "./chunk-ZSYZTGJH.js";
32
+ import "./chunk-G4EJMQLD.js";
34
33
  import "./chunk-LU7TRWMC.js";
35
- import "./chunk-MU3O43L2.js";
36
- import "./chunk-P5C2YKAM.js";
34
+ import "./chunk-YBC3IKMF.js";
35
+ import "./chunk-ANUDXFEX.js";
37
36
  import "./chunk-Q77KNEUL.js";
38
- import "./chunk-4BXJGVZ3.js";
39
- import "./chunk-ZZLPTHT5.js";
40
- import "./chunk-K3YSQDXJ.js";
37
+ import "./chunk-BSK7ELHU.js";
38
+ import "./chunk-UOZMSF4C.js";
39
+ import "./chunk-EHP3WPEG.js";
40
+ import "./chunk-3INK4Y4E.js";
41
+ import "./chunk-BC2C5GVI.js";
42
+ import "./chunk-RCT7UX7B.js";
43
+ import "./chunk-CTD5ZCV6.js";
44
+ import "./chunk-XEOX6AM7.js";
41
45
  import {
42
46
  removedSubcommand,
43
47
  unknownSubcommand
44
- } from "./chunk-JQLR64UC.js";
45
- import "./chunk-OYMR5AMJ.js";
48
+ } from "./chunk-F6CYJ7TN.js";
46
49
  import "./chunk-GNPVYOPB.js";
47
50
  import {
48
51
  formatFields,
@@ -50,12 +53,13 @@ import {
50
53
  step,
51
54
  success
52
55
  } from "./chunk-EZG76F7R.js";
53
- import "./chunk-UDL46O35.js";
54
- import "./chunk-OKNSR7MT.js";
55
- import "./chunk-QONOJO45.js";
56
+ import "./chunk-OWGCOGKK.js";
57
+ import "./chunk-DIA7CT7J.js";
58
+ import "./chunk-QK7ZQJLP.js";
56
59
  import "./chunk-WHOJWOSV.js";
60
+ import "./chunk-VAF6A3YD.js";
57
61
  import "./chunk-5XZ744TS.js";
58
- import "./chunk-7JDT4PBU.js";
62
+ import "./chunk-OHX6MIUZ.js";
59
63
 
60
64
  // src/emit/workspace-command.ts
61
65
  import { writeFileSync } from "fs";
@@ -67,10 +71,8 @@ async function runWorkspaceCommand(args) {
67
71
  return runDetails(args);
68
72
  case "export":
69
73
  return runExport(args);
70
- case "codegen":
71
- return runCodegenCommand(args, { kind: "workspace" });
72
74
  case "branch": {
73
- const { runBranchCommand } = await import("./branch-commands-PBQ36L4A.js");
75
+ const { runBranchCommand } = await import("./branch-commands-2BLOC2GR.js");
74
76
  return runBranchCommand(args);
75
77
  }
76
78
  case "deploy":
@@ -160,4 +162,4 @@ async function runExport(args) {
160
162
  export {
161
163
  runWorkspaceCommand
162
164
  };
163
- //# sourceMappingURL=workspace-command-HYA6JEKK.js.map
165
+ //# sourceMappingURL=workspace-command-MNK7Y7MQ.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  exportWorkspaceBundle
3
- } from "./chunk-QTNO2WD6.js";
3
+ } from "./chunk-7ZYW652H.js";
4
4
  import "./chunk-ZUTSMMAG.js";
5
5
  import "./chunk-X4DVXBFY.js";
6
6
  import "./chunk-3IGNIP6R.js";
7
7
  export {
8
8
  exportWorkspaceBundle
9
9
  };
10
- //# sourceMappingURL=workspace-export-AJMGN3CQ.js.map
10
+ //# sourceMappingURL=workspace-export-DURY5WYL.js.map