@xanots/sdk 0.0.4 → 0.0.5

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 (49) hide show
  1. package/CHANGELOG.md +9 -10
  2. package/README.md +4 -0
  3. package/dist/.build-fingerprint +1 -0
  4. package/dist/bin.js +4 -4
  5. package/dist/{chunk-AJ7JQ4OU.js → chunk-AAFBSOSD.js} +3 -3
  6. package/dist/{chunk-VWGJQTNA.js → chunk-APOR6TCV.js} +4 -4
  7. package/dist/{chunk-YYSJAAJM.js → chunk-F5T45NAM.js} +7 -2
  8. package/dist/{chunk-KGNJM4LN.js → chunk-IVP6TS26.js} +2 -2
  9. package/dist/{chunk-EAIR6VUL.js → chunk-KXCPZUUM.js} +3 -3
  10. package/dist/{chunk-7REDODS2.js → chunk-LLWK6H77.js} +20 -2
  11. package/dist/{chunk-DUC3PXDG.js → chunk-MS3BRZAZ.js} +26 -22
  12. package/dist/{chunk-VKD3EBKG.js → chunk-OARSPAIE.js} +7 -7
  13. package/dist/{chunk-ACQCK4DT.js → chunk-OR43PDCW.js} +2 -2
  14. package/dist/chunk-PGBK64U5.js +59 -0
  15. package/dist/{chunk-SWIXWJIY.js → chunk-QA5ICJ4M.js} +3 -3
  16. package/dist/{chunk-C56BC2FY.js → chunk-SG4UBJ47.js} +2 -2
  17. package/dist/{chunk-VTIL47DT.js → chunk-W5NOKYEG.js} +6 -2
  18. package/dist/{chunk-DGSF2Q5H.js → chunk-WJYB7DSI.js} +2 -2
  19. package/dist/{chunk-T6N3VMMO.js → chunk-ZGA5MUNC.js} +2 -2
  20. package/dist/cli.d.ts +8 -1
  21. package/dist/cli.js +3 -3
  22. package/dist/{codegen-command-Z7WQMOJ7.js → codegen-command-BLOS3GR3.js} +8 -8
  23. package/dist/{completion-4GYN752B.js → completion-GHP5RRLQ.js} +2 -2
  24. package/dist/{deploy-command-M2S4HHLC.js → deploy-command-XOH76USO.js} +11 -11
  25. package/dist/{env-target-GSFCYHKZ.js → env-target-POGJMD6Q.js} +6 -6
  26. package/dist/{ephemeral-command-6WJW7LP6.js → ephemeral-command-46SL27GJ.js} +13 -13
  27. package/dist/{init-command-GJUPWTKA.js → init-command-NCRPVFGE.js} +5 -5
  28. package/dist/internal.js +1 -1
  29. package/dist/{lock-commands-7IH7RSSP.js → lock-commands-6UONZW26.js} +4 -4
  30. package/dist/{login-command-QM5SBBI2.js → login-command-SG7IWTHW.js} +139 -36
  31. package/dist/{logout-command-THPASOHM.js → logout-command-J2AG5NKC.js} +2 -2
  32. package/dist/{marketplace-command-463DT7O7.js → marketplace-command-NKTQ3VPS.js} +3 -3
  33. package/dist/node.js +3 -3
  34. package/dist/{profile-command-EUWPVWED.js → profile-command-ZPC2DPFV.js} +3 -3
  35. package/dist/{release-command-M4CVNTWL.js → release-command-FKQ6E3TD.js} +10 -10
  36. package/dist/{sandbox-details-command-BRII3QHG.js → sandbox-details-command-DMY2KGA2.js} +4 -4
  37. package/dist/{sandbox-export-command-PCZ5FL4U.js → sandbox-export-command-R6QMEK3D.js} +5 -5
  38. package/dist/{test-command-U4G5Y3UM.js → test-command-56IAEYHX.js} +8 -8
  39. package/dist/{upgrade-command-CKJ4BS2P.js → upgrade-command-M2DZ3ZPD.js} +5 -5
  40. package/dist/{validate-command-S5N37JRP.js → validate-command-CIBQJND7.js} +5 -5
  41. package/dist/{workspace-command-RALSEJSW.js → workspace-command-HZS43PHJ.js} +10 -10
  42. package/guides/cli.md +1 -0
  43. package/guides/deploying.md +18 -0
  44. package/guides/environment.md +1 -1
  45. package/llms-full.txt +1 -1
  46. package/llms.txt +1 -1
  47. package/manifest.json +6 -2
  48. package/package.json +1 -1
  49. package/dist/chunk-ALNQCWAW.js +0 -29
package/dist/cli.js CHANGED
@@ -8,13 +8,13 @@ import {
8
8
  resolveHelpRequest,
9
9
  resolveLockPath,
10
10
  run
11
- } from "./chunk-DUC3PXDG.js";
12
- import "./chunk-KGNJM4LN.js";
11
+ } from "./chunk-MS3BRZAZ.js";
12
+ import "./chunk-IVP6TS26.js";
13
13
  import "./chunk-MFIHIS6B.js";
14
14
  import "./chunk-GNPVYOPB.js";
15
15
  import "./chunk-EZG76F7R.js";
16
16
  import "./chunk-BPEEGJJA.js";
17
- import "./chunk-YYSJAAJM.js";
17
+ import "./chunk-F5T45NAM.js";
18
18
  import "./chunk-YUPQOLFX.js";
19
19
  import "./chunk-WHOJWOSV.js";
20
20
  import "./chunk-5XZ744TS.js";
@@ -4,14 +4,14 @@ import {
4
4
  isMissingDependencyError,
5
5
  runCodegenCommand,
6
6
  verifyCrashEntry
7
- } from "./chunk-VKD3EBKG.js";
7
+ } from "./chunk-OARSPAIE.js";
8
8
  import "./chunk-ZOYMZZ3S.js";
9
- import "./chunk-C56BC2FY.js";
10
- import "./chunk-7REDODS2.js";
9
+ import "./chunk-SG4UBJ47.js";
10
+ import "./chunk-LLWK6H77.js";
11
11
  import "./chunk-QTNO2WD6.js";
12
12
  import "./chunk-ZUTSMMAG.js";
13
13
  import "./chunk-X4DVXBFY.js";
14
- import "./chunk-EAIR6VUL.js";
14
+ import "./chunk-KXCPZUUM.js";
15
15
  import "./chunk-7SISR3CS.js";
16
16
  import "./chunk-ZSYZTGJH.js";
17
17
  import "./chunk-3IGNIP6R.js";
@@ -22,13 +22,13 @@ import "./chunk-QUUB7HYK.js";
22
22
  import "./chunk-6DHJVLYP.js";
23
23
  import "./chunk-4BXJGVZ3.js";
24
24
  import "./chunk-CYJ7R3AD.js";
25
- import "./chunk-DUC3PXDG.js";
26
- import "./chunk-KGNJM4LN.js";
25
+ import "./chunk-MS3BRZAZ.js";
26
+ import "./chunk-IVP6TS26.js";
27
27
  import "./chunk-MFIHIS6B.js";
28
28
  import "./chunk-GNPVYOPB.js";
29
29
  import "./chunk-EZG76F7R.js";
30
30
  import "./chunk-BPEEGJJA.js";
31
- import "./chunk-YYSJAAJM.js";
31
+ import "./chunk-F5T45NAM.js";
32
32
  import "./chunk-YUPQOLFX.js";
33
33
  import "./chunk-WHOJWOSV.js";
34
34
  import "./chunk-5XZ744TS.js";
@@ -40,4 +40,4 @@ export {
40
40
  runCodegenCommand,
41
41
  verifyCrashEntry
42
42
  };
43
- //# sourceMappingURL=codegen-command-Z7WQMOJ7.js.map
43
+ //# sourceMappingURL=codegen-command-BLOS3GR3.js.map
@@ -5,7 +5,7 @@ import {
5
5
  getCommand,
6
6
  liveCommandNames,
7
7
  liveSubcommandNames
8
- } from "./chunk-YYSJAAJM.js";
8
+ } from "./chunk-F5T45NAM.js";
9
9
 
10
10
  // src/emit/completion.ts
11
11
  var COMPLETION_SHELLS = ["bash", "zsh", "fish"];
@@ -295,4 +295,4 @@ export {
295
295
  renderCompletion,
296
296
  runCompletionCommand
297
297
  };
298
- //# sourceMappingURL=completion-4GYN752B.js.map
298
+ //# sourceMappingURL=completion-GHP5RRLQ.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  assertBundleInput,
6
6
  loadBundleText
7
- } from "./chunk-SWIXWJIY.js";
7
+ } from "./chunk-QA5ICJ4M.js";
8
8
  import {
9
9
  createEphemeral,
10
10
  getEphemeral,
@@ -17,10 +17,10 @@ import {
17
17
  getEnvironment,
18
18
  readEphemeralState,
19
19
  setEnvironment
20
- } from "./chunk-DGSF2Q5H.js";
20
+ } from "./chunk-WJYB7DSI.js";
21
21
  import {
22
22
  openBrowser
23
- } from "./chunk-VTIL47DT.js";
23
+ } from "./chunk-W5NOKYEG.js";
24
24
  import {
25
25
  microserviceLine,
26
26
  readyRatio,
@@ -28,8 +28,8 @@ import {
28
28
  } from "./chunk-NDZFBZHC.js";
29
29
  import {
30
30
  getAccessToken
31
- } from "./chunk-C56BC2FY.js";
32
- import "./chunk-7REDODS2.js";
31
+ } from "./chunk-SG4UBJ47.js";
32
+ import "./chunk-LLWK6H77.js";
33
33
  import {
34
34
  encodeWorkspaceArchive
35
35
  } from "./chunk-ZUTSMMAG.js";
@@ -42,10 +42,10 @@ import {
42
42
  fetchOrExplain,
43
43
  httpFailure
44
44
  } from "./chunk-3IGNIP6R.js";
45
- import "./chunk-DUC3PXDG.js";
45
+ import "./chunk-MS3BRZAZ.js";
46
46
  import {
47
47
  assertWritableDest
48
- } from "./chunk-KGNJM4LN.js";
48
+ } from "./chunk-IVP6TS26.js";
49
49
  import "./chunk-MFIHIS6B.js";
50
50
  import "./chunk-GNPVYOPB.js";
51
51
  import {
@@ -63,7 +63,7 @@ import {
63
63
  withSpinner
64
64
  } from "./chunk-EZG76F7R.js";
65
65
  import "./chunk-BPEEGJJA.js";
66
- import "./chunk-YYSJAAJM.js";
66
+ import "./chunk-F5T45NAM.js";
67
67
  import "./chunk-YUPQOLFX.js";
68
68
  import "./chunk-WHOJWOSV.js";
69
69
  import "./chunk-5XZ744TS.js";
@@ -158,7 +158,7 @@ async function runDeployedTests(auth, dest, summary, args) {
158
158
  }
159
159
  }
160
160
  async function runTestsOrThrow(auth, dest, summary, args) {
161
- const { runSuite, EXIT_TESTS_FAILED } = await import("./test-command-U4G5Y3UM.js");
161
+ const { runSuite, EXIT_TESTS_FAILED } = await import("./test-command-56IAEYHX.js");
162
162
  let target;
163
163
  if (dest === "ephemeral") {
164
164
  if (summary.url === void 0) {
@@ -168,7 +168,7 @@ async function runTestsOrThrow(auth, dest, summary, args) {
168
168
  const name = summary.ephemeral?.name;
169
169
  target = { base: summary.url, workspaceId: 1, label: name ? `ephemeral ${name}` : "the ephemeral", env: name };
170
170
  } else {
171
- const { resolveMetaTarget } = await import("./env-target-GSFCYHKZ.js");
171
+ const { resolveMetaTarget } = await import("./env-target-POGJMD6Q.js");
172
172
  target = await resolveMetaTarget(auth, { dest: "sandbox" });
173
173
  }
174
174
  const outcomes = await runSuite(auth, target, {
@@ -448,4 +448,4 @@ export {
448
448
  runDeployedTests,
449
449
  verifyMicroservices
450
450
  };
451
- //# sourceMappingURL=deploy-command-M2S4HHLC.js.map
451
+ //# sourceMappingURL=deploy-command-XOH76USO.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  resolveMetaTarget
3
- } from "./chunk-VWGJQTNA.js";
4
- import "./chunk-DGSF2Q5H.js";
5
- import "./chunk-ACQCK4DT.js";
3
+ } from "./chunk-APOR6TCV.js";
4
+ import "./chunk-WJYB7DSI.js";
5
+ import "./chunk-OR43PDCW.js";
6
6
  import "./chunk-NDZFBZHC.js";
7
- import "./chunk-C56BC2FY.js";
8
- import "./chunk-7REDODS2.js";
7
+ import "./chunk-SG4UBJ47.js";
8
+ import "./chunk-LLWK6H77.js";
9
9
  import "./chunk-NUQCEOKA.js";
10
10
  import "./chunk-3IGNIP6R.js";
11
11
  import "./chunk-GNPVYOPB.js";
@@ -13,4 +13,4 @@ import "./chunk-EZG76F7R.js";
13
13
  export {
14
14
  resolveMetaTarget
15
15
  };
16
- //# sourceMappingURL=env-target-GSFCYHKZ.js.map
16
+ //# sourceMappingURL=env-target-POGJMD6Q.js.map
@@ -10,25 +10,25 @@ import {
10
10
  clearEnvironment,
11
11
  getEnvironment,
12
12
  readEphemeralState
13
- } from "./chunk-DGSF2Q5H.js";
14
- import {
15
- confirm
16
- } from "./chunk-ALNQCWAW.js";
13
+ } from "./chunk-WJYB7DSI.js";
17
14
  import {
18
15
  openBrowser
19
- } from "./chunk-VTIL47DT.js";
16
+ } from "./chunk-W5NOKYEG.js";
17
+ import {
18
+ confirm
19
+ } from "./chunk-PGBK64U5.js";
20
20
  import {
21
21
  resolveOutputTarget
22
- } from "./chunk-AJ7JQ4OU.js";
23
- import "./chunk-ACQCK4DT.js";
22
+ } from "./chunk-AAFBSOSD.js";
23
+ import "./chunk-OR43PDCW.js";
24
24
  import {
25
25
  printMicroserviceSection,
26
26
  readMicroservices
27
27
  } from "./chunk-NDZFBZHC.js";
28
28
  import {
29
29
  getAccessToken
30
- } from "./chunk-C56BC2FY.js";
31
- import "./chunk-7REDODS2.js";
30
+ } from "./chunk-SG4UBJ47.js";
31
+ import "./chunk-LLWK6H77.js";
32
32
  import {
33
33
  exportWorkspaceBundle
34
34
  } from "./chunk-QTNO2WD6.js";
@@ -41,7 +41,7 @@ import {
41
41
  import "./chunk-3IGNIP6R.js";
42
42
  import {
43
43
  unknownSubcommand
44
- } from "./chunk-KGNJM4LN.js";
44
+ } from "./chunk-IVP6TS26.js";
45
45
  import "./chunk-GNPVYOPB.js";
46
46
  import {
47
47
  detail,
@@ -53,7 +53,7 @@ import {
53
53
  success,
54
54
  warn
55
55
  } from "./chunk-EZG76F7R.js";
56
- import "./chunk-YYSJAAJM.js";
56
+ import "./chunk-F5T45NAM.js";
57
57
 
58
58
  // src/emit/ephemeral-command.ts
59
59
  import { writeFileSync } from "fs";
@@ -90,7 +90,7 @@ async function runEphemeralCommand(args) {
90
90
  case "impersonate":
91
91
  return runImpersonate(args);
92
92
  case "codegen": {
93
- const { runCodegenCommand } = await import("./codegen-command-Z7WQMOJ7.js");
93
+ const { runCodegenCommand } = await import("./codegen-command-BLOS3GR3.js");
94
94
  return runCodegenCommand(args, { kind: "ephemeral" });
95
95
  }
96
96
  default:
@@ -239,4 +239,4 @@ export {
239
239
  resolveLive,
240
240
  runEphemeralCommand
241
241
  };
242
- //# sourceMappingURL=ephemeral-command-6WJW7LP6.js.map
242
+ //# sourceMappingURL=ephemeral-command-46SL27GJ.js.map
@@ -2,7 +2,7 @@ import {
2
2
  projectShellFiles,
3
3
  runInitCommand,
4
4
  sanitizeAppName
5
- } from "./chunk-EAIR6VUL.js";
5
+ } from "./chunk-KXCPZUUM.js";
6
6
  import {
7
7
  resolveAiFlags
8
8
  } from "./chunk-7SISR3CS.js";
@@ -10,13 +10,13 @@ import "./chunk-ZSYZTGJH.js";
10
10
  import "./chunk-WGDAOOXG.js";
11
11
  import "./chunk-QUUB7HYK.js";
12
12
  import "./chunk-6DHJVLYP.js";
13
- import "./chunk-DUC3PXDG.js";
14
- import "./chunk-KGNJM4LN.js";
13
+ import "./chunk-MS3BRZAZ.js";
14
+ import "./chunk-IVP6TS26.js";
15
15
  import "./chunk-MFIHIS6B.js";
16
16
  import "./chunk-GNPVYOPB.js";
17
17
  import "./chunk-EZG76F7R.js";
18
18
  import "./chunk-BPEEGJJA.js";
19
- import "./chunk-YYSJAAJM.js";
19
+ import "./chunk-F5T45NAM.js";
20
20
  import "./chunk-YUPQOLFX.js";
21
21
  import "./chunk-WHOJWOSV.js";
22
22
  import "./chunk-5XZ744TS.js";
@@ -27,4 +27,4 @@ export {
27
27
  runInitCommand,
28
28
  sanitizeAppName
29
29
  };
30
- //# sourceMappingURL=init-command-GJUPWTKA.js.map
30
+ //# sourceMappingURL=init-command-NCRPVFGE.js.map
package/dist/internal.js CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  GLOBAL_FLAGS,
63
63
  flagKey,
64
64
  flagSummary
65
- } from "./chunk-YYSJAAJM.js";
65
+ } from "./chunk-F5T45NAM.js";
66
66
  import {
67
67
  DECODE_ONLY_STATEMENTS,
68
68
  FILTER_NAMES,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  loadDefault
3
- } from "./chunk-DUC3PXDG.js";
3
+ } from "./chunk-MS3BRZAZ.js";
4
4
  import {
5
5
  UsageError,
6
6
  missingArgument,
7
7
  unknownSubcommand
8
- } from "./chunk-KGNJM4LN.js";
8
+ } from "./chunk-IVP6TS26.js";
9
9
  import {
10
10
  readLockFile,
11
11
  writeLockFile
@@ -15,7 +15,7 @@ import "./chunk-EZG76F7R.js";
15
15
  import {
16
16
  Xano
17
17
  } from "./chunk-BPEEGJJA.js";
18
- import "./chunk-YYSJAAJM.js";
18
+ import "./chunk-F5T45NAM.js";
19
19
  import "./chunk-YUPQOLFX.js";
20
20
  import "./chunk-WHOJWOSV.js";
21
21
  import "./chunk-5XZ744TS.js";
@@ -229,4 +229,4 @@ ${lines}
229
229
  export {
230
230
  runLockCommand
231
231
  };
232
- //# sourceMappingURL=lock-commands-7IH7RSSP.js.map
232
+ //# sourceMappingURL=lock-commands-6UONZW26.js.map
@@ -1,10 +1,14 @@
1
1
  import {
2
+ loopbackRedirectUri,
2
3
  openBrowser,
3
4
  startCallbackServer
4
- } from "./chunk-VTIL47DT.js";
5
+ } from "./chunk-W5NOKYEG.js";
6
+ import {
7
+ promptLine
8
+ } from "./chunk-PGBK64U5.js";
5
9
  import {
6
10
  envMetaCredentialVarsSet
7
- } from "./chunk-C56BC2FY.js";
11
+ } from "./chunk-SG4UBJ47.js";
8
12
  import {
9
13
  CALLBACK_PATH,
10
14
  DEFAULT_PORT,
@@ -19,7 +23,10 @@ import {
19
23
  resolveAuthHost,
20
24
  resolveScope,
21
25
  writeCredential
22
- } from "./chunk-7REDODS2.js";
26
+ } from "./chunk-LLWK6H77.js";
27
+ import {
28
+ UsageError
29
+ } from "./chunk-IVP6TS26.js";
23
30
  import "./chunk-GNPVYOPB.js";
24
31
  import {
25
32
  blank,
@@ -30,23 +37,81 @@ import {
30
37
  success,
31
38
  warn
32
39
  } from "./chunk-EZG76F7R.js";
40
+ import "./chunk-F5T45NAM.js";
33
41
 
34
42
  // src/emit/login-command.ts
35
43
  import * as client from "openid-client";
44
+
45
+ // src/auth/paste.ts
46
+ var EXAMPLE = "Paste either the full URL from your browser's address bar (http://127.0.0.1:\u2026/oauth/callback?code=\u2026) or just the code=\u2026 value from it.";
47
+ function normalizePastedCallback(input, ctx) {
48
+ const trimmed = input.trim();
49
+ if (trimmed === "") throw new Error(`Nothing was pasted. ${EXAMPLE}`);
50
+ const params = extractParams(trimmed, ctx);
51
+ const error = params.get("error");
52
+ if (error) {
53
+ const description = params.get("error_description");
54
+ const authError = new Error(
55
+ `Authorization server returned error: ${error}${description ? ` (${description})` : ""}`
56
+ );
57
+ authError.error = error;
58
+ throw authError;
59
+ }
60
+ if (!params.get("code")) {
61
+ throw new Error(`That paste carries no \`code\` value. ${EXAMPLE}`);
62
+ }
63
+ if (!params.get("iss")) params.set("iss", ctx.issuer);
64
+ return `${ctx.redirectUri}?${params.toString()}`;
65
+ }
66
+ function extractParams(trimmed, ctx) {
67
+ const url = parseUrl(trimmed);
68
+ if (url) return url.searchParams;
69
+ const queryStart = trimmed.indexOf("?");
70
+ if (queryStart !== -1 && isRecognizedQuery(trimmed.slice(queryStart + 1))) {
71
+ return new URLSearchParams(trimmed.slice(queryStart + 1));
72
+ }
73
+ if (isRecognizedQuery(trimmed)) return new URLSearchParams(trimmed);
74
+ return new URLSearchParams({ code: trimmed, state: ctx.state, iss: ctx.issuer });
75
+ }
76
+ function isRecognizedQuery(value) {
77
+ return /(^|&)(code|error)=/.test(value);
78
+ }
79
+ function parseUrl(value) {
80
+ try {
81
+ const url = new URL(value);
82
+ return url.protocol === "http:" || url.protocol === "https:" ? url : void 0;
83
+ } catch {
84
+ return void 0;
85
+ }
86
+ }
87
+
88
+ // src/emit/login-command.ts
36
89
  async function runLoginCommand(args) {
37
90
  const authHost = resolveAuthHost(args);
38
91
  const scope = resolveScope(args);
39
92
  const port = args.port ?? DEFAULT_PORT;
40
93
  assertHttpsOrigin(authHost, "--origin");
94
+ if (args.paste && port === 0) {
95
+ throw new UsageError(
96
+ "`--port 0` asks for an ephemeral port, which --paste cannot use: nothing is bound, so the port is only part of the redirect URL's identity. Drop --port to use the default.",
97
+ { helpFor: { command: "login" } }
98
+ );
99
+ }
41
100
  if (!args.force && reportAlreadySignedIn(resolveAuthFilePath(args, "write"))) return;
101
+ if (args.paste && process.stdin.isTTY !== true) {
102
+ throw new UsageError(
103
+ "`--paste` reads the authorization code back from you, so it needs a terminal. For automation, use the XANO_REFRESH_TOKEN / XANO_CLIENT_ID environment credential instead.",
104
+ { helpFor: { command: "login" } }
105
+ );
106
+ }
42
107
  step(`Signing in to ${hostLabel(authHost)}`);
43
108
  let record;
44
109
  try {
45
- record = await attemptLogin({ authHost, scope, port });
110
+ record = await attemptLogin({ authHost, scope, port, paste: args.paste });
46
111
  } catch (err) {
47
112
  if (oauthErrorCode(err) !== "invalid_client") throw err;
48
113
  warn("The registered client was rejected \u2014 re-registering and retrying once.");
49
- record = await attemptLogin({ authHost, scope, port });
114
+ record = await attemptLogin({ authHost, scope, port, paste: args.paste, retry: true });
50
115
  }
51
116
  const authFilePath = resolveAuthFilePath(args, "write");
52
117
  writeCredential(authFilePath, record);
@@ -98,36 +163,7 @@ function reportAlreadySignedIn(authFilePath) {
98
163
  async function attemptLogin(p) {
99
164
  const verifier = client.randomPKCECodeVerifier();
100
165
  const state = client.randomState();
101
- let listener;
102
- try {
103
- listener = await startCallbackServer({ callbackPath: CALLBACK_PATH, expectedState: state, port: p.port });
104
- } catch (err) {
105
- const code = err.code;
106
- if (code === "EADDRINUSE") {
107
- throw new Error(`Loopback port ${p.port} is in use. Pass a free one with --port <n> and retry.`);
108
- }
109
- throw err;
110
- }
111
- const provider = new OpenIdProvider({ authHost: p.authHost, redirectUri: listener.redirectUri, scope: p.scope });
112
- let authorizeUrl;
113
- try {
114
- authorizeUrl = await provider.buildAuthUrl({ verifier, state });
115
- } catch (err) {
116
- listener.close();
117
- throw err;
118
- }
119
- detail("Opening your browser to authorize \u2014 waiting for you to finish\u2026");
120
- detail("If it doesn't open, paste this URL into your browser:");
121
- detail(authorizeUrl);
122
- openBrowser(authorizeUrl);
123
- let callbackUrl;
124
- try {
125
- ({ callbackUrl } = await listener.waitForCallback);
126
- } catch (err) {
127
- listener.close();
128
- if (oauthErrorCode(err) === "invalid_client") await provider.reset();
129
- throw err;
130
- }
166
+ const { callbackUrl, provider } = p.paste ? await acquireByPaste({ ...p, verifier, state }) : await acquireByLoopback({ ...p, verifier, state });
131
167
  let tokens;
132
168
  try {
133
169
  tokens = await provider.exchange(callbackUrl, { verifier, state });
@@ -161,7 +197,74 @@ async function attemptLogin(p) {
161
197
  client_id: provider.clientId()
162
198
  };
163
199
  }
200
+ var MAX_PASTE_ATTEMPTS = 3;
201
+ async function acquireByLoopback(p) {
202
+ let listener;
203
+ try {
204
+ listener = await startCallbackServer({ callbackPath: CALLBACK_PATH, expectedState: p.state, port: p.port });
205
+ } catch (err) {
206
+ const code = err.code;
207
+ if (code === "EADDRINUSE") {
208
+ throw new Error(`Loopback port ${p.port} is in use. Pass a free one with --port <n> and retry.`);
209
+ }
210
+ throw err;
211
+ }
212
+ const provider = new OpenIdProvider({ authHost: p.authHost, redirectUri: listener.redirectUri, scope: p.scope });
213
+ let authorizeUrl;
214
+ try {
215
+ authorizeUrl = await provider.buildAuthUrl({ verifier: p.verifier, state: p.state });
216
+ } catch (err) {
217
+ listener.close();
218
+ throw err;
219
+ }
220
+ detail("Opening your browser to authorize \u2014 waiting for you to finish\u2026");
221
+ detail("If it doesn't open, paste this URL into your browser:");
222
+ detail(authorizeUrl);
223
+ openBrowser(authorizeUrl);
224
+ try {
225
+ const { callbackUrl } = await listener.waitForCallback;
226
+ return { callbackUrl, provider };
227
+ } catch (err) {
228
+ listener.close();
229
+ if (oauthErrorCode(err) === "invalid_client") await provider.reset();
230
+ throw err;
231
+ }
232
+ }
233
+ async function acquireByPaste(p) {
234
+ const redirectUri = loopbackRedirectUri(p.port, CALLBACK_PATH);
235
+ const provider = new OpenIdProvider({ authHost: p.authHost, redirectUri, scope: p.scope });
236
+ const authorizeUrl = await provider.buildAuthUrl({ verifier: p.verifier, state: p.state });
237
+ blank();
238
+ if (p.retry) detail("Starting over with a freshly registered client \u2014 this is a NEW link and a NEW code.");
239
+ detail("Open this URL in any browser and finish signing in:");
240
+ detail(authorizeUrl);
241
+ blank();
242
+ detail(
243
+ `Your browser will then fail to load ${redirectUri} \u2014 that is expected, nothing is listening here. The address bar is what you want.`
244
+ );
245
+ openBrowser(authorizeUrl);
246
+ for (let attempt = 0; ; attempt++) {
247
+ const pasted = await promptLine("Paste that URL (or just the code from it):", {
248
+ noTtyHint: "--paste has to read the code from you, so it needs a terminal. For automation, use the XANO_REFRESH_TOKEN / XANO_CLIENT_ID environment credential instead.",
249
+ helpFor: { command: "login" }
250
+ });
251
+ try {
252
+ const callbackUrl = normalizePastedCallback(pasted, {
253
+ redirectUri,
254
+ state: p.state,
255
+ issuer: provider.issuer()
256
+ });
257
+ return { callbackUrl, provider };
258
+ } catch (err) {
259
+ if (oauthErrorCode(err) === "invalid_client") await provider.reset();
260
+ const unreadable = oauthErrorCode(err) === void 0;
261
+ if (!unreadable || attempt + 1 >= MAX_PASTE_ATTEMPTS) throw err;
262
+ warn(`${err instanceof Error ? err.message : String(err)}`);
263
+ detail("The link above is still valid \u2014 try pasting again.");
264
+ }
265
+ }
266
+ }
164
267
  export {
165
268
  runLoginCommand
166
269
  };
167
- //# sourceMappingURL=login-command-QM5SBBI2.js.map
270
+ //# sourceMappingURL=login-command-SG7IWTHW.js.map
@@ -5,7 +5,7 @@ import {
5
5
  readCredential,
6
6
  resolveAuthFilePath,
7
7
  resolveScope
8
- } from "./chunk-7REDODS2.js";
8
+ } from "./chunk-LLWK6H77.js";
9
9
  import "./chunk-GNPVYOPB.js";
10
10
  import {
11
11
  detail,
@@ -65,4 +65,4 @@ async function runLogoutCommand(args) {
65
65
  export {
66
66
  runLogoutCommand
67
67
  };
68
- //# sourceMappingURL=logout-command-THPASOHM.js.map
68
+ //# sourceMappingURL=logout-command-J2AG5NKC.js.map
@@ -15,7 +15,7 @@ import {
15
15
  UsageError,
16
16
  indentBlock,
17
17
  missingArgument
18
- } from "./chunk-KGNJM4LN.js";
18
+ } from "./chunk-IVP6TS26.js";
19
19
  import {
20
20
  blank,
21
21
  detail,
@@ -26,7 +26,7 @@ import {
26
26
  success,
27
27
  warn
28
28
  } from "./chunk-EZG76F7R.js";
29
- import "./chunk-YYSJAAJM.js";
29
+ import "./chunk-F5T45NAM.js";
30
30
 
31
31
  // src/emit/marketplace-catalogue.ts
32
32
  var DEFAULT_BASE_URL = "https://xare-rvr8-mnnt.dev.xano.io";
@@ -362,4 +362,4 @@ export {
362
362
  runMarketplaceListCommand,
363
363
  runMarketplaceSearchCommand
364
364
  };
365
- //# sourceMappingURL=marketplace-command-463DT7O7.js.map
365
+ //# sourceMappingURL=marketplace-command-NKTQ3VPS.js.map
package/dist/node.js CHANGED
@@ -108,8 +108,8 @@ import {
108
108
  run,
109
109
  writeArtifact,
110
110
  writeBundle
111
- } from "./chunk-DUC3PXDG.js";
112
- import "./chunk-KGNJM4LN.js";
111
+ } from "./chunk-MS3BRZAZ.js";
112
+ import "./chunk-IVP6TS26.js";
113
113
  import {
114
114
  readLockFile,
115
115
  writeLockFile
@@ -120,7 +120,7 @@ import {
120
120
  Xano,
121
121
  workspace
122
122
  } from "./chunk-BPEEGJJA.js";
123
- import "./chunk-YYSJAAJM.js";
123
+ import "./chunk-F5T45NAM.js";
124
124
  import {
125
125
  LAMBDA_BINDINGS,
126
126
  LAMBDA_CODE_FILTERS,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getAccessToken
3
- } from "./chunk-C56BC2FY.js";
4
- import "./chunk-7REDODS2.js";
3
+ } from "./chunk-SG4UBJ47.js";
4
+ import "./chunk-LLWK6H77.js";
5
5
  import {
6
6
  isMachineOutput,
7
7
  writeJson
@@ -74,4 +74,4 @@ export {
74
74
  fetchProfile,
75
75
  runProfileCommand
76
76
  };
77
- //# sourceMappingURL=profile-command-EUWPVWED.js.map
77
+ //# sourceMappingURL=profile-command-ZPC2DPFV.js.map
@@ -5,14 +5,14 @@ import {
5
5
  import {
6
6
  assertBundleInput,
7
7
  loadBundleText
8
- } from "./chunk-SWIXWJIY.js";
8
+ } from "./chunk-QA5ICJ4M.js";
9
9
  import {
10
10
  confirm
11
- } from "./chunk-ALNQCWAW.js";
11
+ } from "./chunk-PGBK64U5.js";
12
12
  import {
13
13
  getAccessToken
14
- } from "./chunk-C56BC2FY.js";
15
- import "./chunk-7REDODS2.js";
14
+ } from "./chunk-SG4UBJ47.js";
15
+ import "./chunk-LLWK6H77.js";
16
16
  import {
17
17
  encodeWorkspaceArchive
18
18
  } from "./chunk-ZUTSMMAG.js";
@@ -24,11 +24,11 @@ import {
24
24
  import "./chunk-3IGNIP6R.js";
25
25
  import {
26
26
  resolveLockPath
27
- } from "./chunk-DUC3PXDG.js";
27
+ } from "./chunk-MS3BRZAZ.js";
28
28
  import {
29
29
  UsageError,
30
30
  assertWritableDest
31
- } from "./chunk-KGNJM4LN.js";
31
+ } from "./chunk-IVP6TS26.js";
32
32
  import {
33
33
  readLockFile
34
34
  } from "./chunk-MFIHIS6B.js";
@@ -43,7 +43,7 @@ import {
43
43
  warn
44
44
  } from "./chunk-EZG76F7R.js";
45
45
  import "./chunk-BPEEGJJA.js";
46
- import "./chunk-YYSJAAJM.js";
46
+ import "./chunk-F5T45NAM.js";
47
47
  import "./chunk-YUPQOLFX.js";
48
48
  import "./chunk-WHOJWOSV.js";
49
49
  import "./chunk-5XZ744TS.js";
@@ -338,7 +338,7 @@ async function runReleaseCommand(args) {
338
338
  { withSeed: req.records === true }
339
339
  );
340
340
  if (args.static !== void 0) {
341
- const { assertNoSeedLeaks } = await import("./deploy-command-M2S4HHLC.js");
341
+ const { assertNoSeedLeaks } = await import("./deploy-command-XOH76USO.js");
342
342
  await assertNoSeedLeaks(args.static, nonPublicSeedValues, args.allowSeedInStatic);
343
343
  }
344
344
  const workspaceId = auth.workspaceId;
@@ -405,7 +405,7 @@ async function runReleaseCommand(args) {
405
405
  unchangedEnv: losses.unchangedEnv
406
406
  };
407
407
  if (args.static !== void 0) {
408
- const { buildStaticEnv, deployStaticTo } = await import("./deploy-command-M2S4HHLC.js");
408
+ const { buildStaticEnv, deployStaticTo } = await import("./deploy-command-XOH76USO.js");
409
409
  const env = buildStaticEnv(auth.instance, args.staticEnv);
410
410
  const explicit = Object.keys(args.staticEnv).length > 0;
411
411
  summary.static = await deployStaticTo(
@@ -424,4 +424,4 @@ async function runReleaseCommand(args) {
424
424
  export {
425
425
  runReleaseCommand
426
426
  };
427
- //# sourceMappingURL=release-command-M4CVNTWL.js.map
427
+ //# sourceMappingURL=release-command-FKQ6E3TD.js.map