@base44-preview/cli 0.0.1-pr.5.e49d892 → 0.0.1-pr.6.f28d227

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.
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiIpC,eAAO,MAAM,YAAY,SAIrB,CAAC"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiGpC,eAAO,MAAM,YAAY,SAIrB,CAAC"}
@@ -1,87 +1,57 @@
1
1
  import { Command } from "commander";
2
- import { log, spinner } from "@clack/prompts";
2
+ import { log } from "@clack/prompts";
3
3
  import pWaitFor from "p-wait-for";
4
4
  import { writeAuth } from "../../../core/config/auth.js";
5
- import { generateDeviceCode, getTokenFromDeviceCode, AuthApiError, AuthValidationError, } from "../../../core/api/auth";
6
- import { runCommand } from "../../utils/index.js";
5
+ import { generateDeviceCode, getTokenFromDeviceCode, } from "../../../core/api/auth/index.js";
6
+ import { runCommand, runTask } from "../../utils/index.js";
7
7
  async function generateAndDisplayDeviceCode() {
8
- const s = spinner();
9
- s.start("Generating device code...");
10
- try {
11
- const deviceCodeResponse = await generateDeviceCode();
12
- s.stop("Device code generated");
13
- log.info(`Please visit: ${deviceCodeResponse.verificationUrl}\n` +
14
- `Enter your device code: ${deviceCodeResponse.userCode}`);
15
- return deviceCodeResponse;
16
- }
17
- catch (error) {
18
- s.stop("Failed to generate device code");
19
- if (error instanceof AuthValidationError) {
20
- const issues = error.issues.map((i) => i.message).join(", ");
21
- throw new Error(`Invalid response from server: ${issues}`);
22
- }
23
- if (error instanceof AuthApiError) {
24
- throw new Error(`Failed to generate device code: ${error.message}`);
25
- }
26
- throw new Error(`Unexpected error: ${error instanceof Error ? error.message : String(error)}`);
27
- }
8
+ const deviceCodeResponse = await runTask("Generating device code...", async () => {
9
+ return await generateDeviceCode();
10
+ }, {
11
+ successMessage: "Device code generated",
12
+ errorMessage: "Failed to generate device code",
13
+ });
14
+ log.info(`Please visit: ${deviceCodeResponse.verificationUrl}\n` +
15
+ `Enter your device code: ${deviceCodeResponse.userCode}`);
16
+ return deviceCodeResponse;
28
17
  }
29
18
  async function waitForAuthentication(deviceCode, expiresIn) {
30
- const s = spinner();
31
- s.start("Waiting for you to complete authentication...");
32
19
  let tokenResponse = null;
33
20
  try {
34
- await pWaitFor(async () => {
35
- try {
21
+ await runTask("Waiting for you to complete authentication...", async () => {
22
+ await pWaitFor(async () => {
36
23
  const result = await getTokenFromDeviceCode(deviceCode);
37
24
  if (result !== null) {
38
25
  tokenResponse = result;
39
26
  return true;
40
27
  }
41
28
  return false;
42
- }
43
- catch (error) {
44
- if (error instanceof AuthValidationError) {
45
- const issues = error.issues.map((i) => i.message).join(", ");
46
- throw new Error(`Invalid response from server: ${issues}`);
47
- }
48
- if (error instanceof AuthApiError) {
49
- throw new Error(`API error: ${error.message}`);
50
- }
51
- throw error;
52
- }
29
+ }, {
30
+ interval: 2000,
31
+ timeout: expiresIn * 1000,
32
+ });
53
33
  }, {
54
- interval: 2000,
55
- timeout: expiresIn * 1000,
34
+ successMessage: "Authentication completed!",
35
+ errorMessage: "Authentication failed",
56
36
  });
57
37
  }
58
38
  catch (error) {
59
- s.stop("Authentication failed");
60
39
  if (error instanceof Error && error.message.includes("timed out")) {
61
40
  throw new Error("Authentication timed out. Please try again.");
62
41
  }
63
- if (error instanceof Error) {
64
- throw error;
65
- }
66
- throw new Error("Unexpected error during authentication");
42
+ throw error;
67
43
  }
68
- s.stop("Authentication completed!");
69
44
  if (!tokenResponse) {
70
45
  throw new Error("Failed to retrieve authentication token.");
71
46
  }
72
47
  return tokenResponse;
73
48
  }
74
49
  async function saveAuthData(token) {
75
- try {
76
- await writeAuth({
77
- token: token.token,
78
- email: token.email,
79
- name: token.name,
80
- });
81
- }
82
- catch (error) {
83
- throw new Error(`Failed to save authentication data: ${error instanceof Error ? error.message : String(error)}`);
84
- }
50
+ await writeAuth({
51
+ token: token.token,
52
+ email: token.email,
53
+ name: token.name,
54
+ });
85
55
  }
86
56
  async function login() {
87
57
  const deviceCodeResponse = await generateAndDisplayDeviceCode();
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../../src/cli/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,GAGpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK,UAAU,4BAA4B;IACzC,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,CAAC,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAErC,IAAI,CAAC;QACH,MAAM,kBAAkB,GAAG,MAAM,kBAAkB,EAAE,CAAC;QACtD,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAEhC,GAAG,CAAC,IAAI,CACN,iBAAiB,kBAAkB,CAAC,eAAe,IAAI;YACrD,2BAA2B,kBAAkB,CAAC,QAAQ,EAAE,CAC3D,CAAC;QAEF,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QACzC,IAAI,KAAK,YAAY,mBAAmB,EAAE,CAAC;YACzC,MAAM,MAAM,GAA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EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,KAAK;IAClB,MAAM,kBAAkB,GAAG,MAAM,4BAA4B,EAAE,CAAC;IAEhE,MAAM,KAAK,GAAG,MAAM,qBAAqB,CACvC,kBAAkB,CAAC,UAAU,EAC7B,kBAAkB,CAAC,SAAS,CAC7B,CAAC;IAEF,MAAM,YAAY,CAAC,KAAK,CAAC,CAAC;IAE1B,GAAG,CAAC,OAAO,CAAC,gBAAgB,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,UAAU,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,eAAO,MAAM,aAAa,SAItB,CAAC"}
1
+ {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,aAAa,SAItB,CAAC"}
@@ -3,18 +3,8 @@ import { log } from "@clack/prompts";
3
3
  import { deleteAuth } from "../../../core/config/auth.js";
4
4
  import { runCommand } from "../../utils/index.js";
5
5
  async function logout() {
6
- try {
7
- await deleteAuth();
8
- log.info("Logged out successfully");
9
- }
10
- catch (error) {
11
- if (error instanceof Error) {
12
- log.error(error.message);
13
- }
14
- else {
15
- log.error("Failed to logout");
16
- }
17
- }
6
+ await deleteAuth();
7
+ log.info("Logged out successfully");
18
8
  }
19
9
  export const logoutCommand = new Command("logout")
20
10
  .description("Logout from current device")
@@ -1 +1 @@
1
- {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../../src/cli/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK,UAAU,MAAM;IACnB,IAAI,CAAC;QACH,MAAM,UAAU,EAAE,CAAC;QACnB,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../../src/cli/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK,UAAU,MAAM;IACnB,MAAM,UAAU,EAAE,CAAC;IACnB,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,eAAO,MAAM,aAAa,SAItB,CAAC"}
1
+ {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,aAAa,SAItB,CAAC"}
@@ -3,18 +3,8 @@ import { log } from "@clack/prompts";
3
3
  import { readAuth } from "../../../core/config/auth.js";
4
4
  import { runCommand } from "../../utils/index.js";
5
5
  async function whoami() {
6
- try {
7
- const auth = await readAuth();
8
- log.info(`Logged in as: ${auth.name} (${auth.email})`);
9
- }
10
- catch (error) {
11
- if (error instanceof Error) {
12
- log.error(error.message);
13
- }
14
- else {
15
- log.error("Failed to read authentication data");
16
- }
17
- }
6
+ const auth = await readAuth();
7
+ log.info(`Logged in as: ${auth.name} (${auth.email})`);
18
8
  }
19
9
  export const whoamiCommand = new Command("whoami")
20
10
  .description("Display current authenticated user")
@@ -1 +1 @@
1
- {"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../../src/cli/commands/auth/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE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GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,oCAAoC,CAAC;KACjD,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from "./packageVersion.js";
2
2
  export * from "./runCommand.js";
3
+ export * from "./runTask.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from "./packageVersion.js";
2
2
  export * from "./runCommand.js";
3
+ export * from "./runTask.js";
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runCommand.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/runCommand.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC7B,OAAO,CAAC,IAAI,CAAC,CASf"}
1
+ {"version":3,"file":"runCommand.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/runCommand.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC7B,OAAO,CAAC,IAAI,CAAC,CAkBf"}
@@ -1,5 +1,6 @@
1
1
  import { intro, log } from "@clack/prompts";
2
2
  import chalk from "chalk";
3
+ import { AuthApiError, AuthValidationError } from "../../core/errors/index.js";
3
4
  const base44Color = chalk.bgHex("#E86B3C");
4
5
  /**
5
6
  * Wraps a command function with the Base44 intro banner.
@@ -13,7 +14,19 @@ export async function runCommand(commandFn) {
13
14
  await commandFn();
14
15
  }
15
16
  catch (e) {
16
- log.error(e instanceof Error ? e.message : String(e));
17
+ if (e instanceof AuthValidationError) {
18
+ const issues = e.issues.map((i) => i.message).join(", ");
19
+ log.error(`Invalid response from server: ${issues}`);
20
+ }
21
+ else if (e instanceof AuthApiError) {
22
+ log.error(e.message);
23
+ }
24
+ else if (e instanceof Error) {
25
+ log.error(e.message);
26
+ }
27
+ else {
28
+ log.error(String(e));
29
+ }
17
30
  process.exit(1);
18
31
  }
19
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"runCommand.js","sourceRoot":"","sources":["../../../src/cli/utils/runCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,SAA8B;IAE9B,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;IAEhC,IAAI,CAAC;QACH,MAAM,SAAS,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,GAAG,CAAC,KAAK,CAAC,CAAC,YAAY,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,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Wraps an async operation with automatic spinner management.
3
+ * The spinner is automatically started, and stopped on both success and error.
4
+ *
5
+ * @param startMessage - Message to show when spinner starts
6
+ * @param operation - The async operation to execute
7
+ * @param options - Optional configuration
8
+ * @returns The result of the operation
9
+ */
10
+ export declare function runTask<T>(startMessage: string, operation: () => Promise<T>, options?: {
11
+ successMessage?: string;
12
+ errorMessage?: string;
13
+ }): Promise<T>;
14
+ //# sourceMappingURL=runTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runTask.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/runTask.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC7B,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,CAAC,EAAE;IACR,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GACA,OAAO,CAAC,CAAC,CAAC,CAYZ"}
@@ -0,0 +1,24 @@
1
+ import { spinner } from "@clack/prompts";
2
+ /**
3
+ * Wraps an async operation with automatic spinner management.
4
+ * The spinner is automatically started, and stopped on both success and error.
5
+ *
6
+ * @param startMessage - Message to show when spinner starts
7
+ * @param operation - The async operation to execute
8
+ * @param options - Optional configuration
9
+ * @returns The result of the operation
10
+ */
11
+ export async function runTask(startMessage, operation, options) {
12
+ const s = spinner();
13
+ s.start(startMessage);
14
+ try {
15
+ const result = await operation();
16
+ s.stop(options?.successMessage || startMessage);
17
+ return result;
18
+ }
19
+ catch (error) {
20
+ s.stop(options?.errorMessage || "Failed");
21
+ throw error;
22
+ }
23
+ }
24
+ //# sourceMappingURL=runTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runTask.js","sourceRoot":"","sources":["../../../src/cli/utils/runTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,YAAoB,EACpB,SAA2B,EAC3B,OAGC;IAED,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAEtB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;QACjC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,IAAI,YAAY,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,IAAI,QAAQ,CAAC,CAAC;QAC1C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/cli",
3
- "version": "0.0.1-pr.5.e49d892",
3
+ "version": "0.0.1-pr.6.f28d227",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
6
  "main": "./dist/cli/index.js",