@base44-preview/cli 0.0.1-pr.5.2dd0b1b → 0.0.1-pr.5.668b7ca
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/dist/cli/commands/auth/login.d.ts.map +1 -1
- package/dist/cli/commands/auth/login.js +56 -26
- package/dist/cli/commands/auth/login.js.map +1 -1
- package/dist/cli/commands/auth/logout.d.ts.map +1 -1
- package/dist/cli/commands/auth/logout.js +12 -2
- package/dist/cli/commands/auth/logout.js.map +1 -1
- package/dist/cli/commands/auth/whoami.d.ts.map +1 -1
- package/dist/cli/commands/auth/whoami.js +12 -2
- package/dist/cli/commands/auth/whoami.js.map +1 -1
- package/dist/cli/utils/index.d.ts +0 -1
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +0 -1
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/runCommand.d.ts.map +1 -1
- package/dist/cli/utils/runCommand.js +1 -14
- package/dist/cli/utils/runCommand.js.map +1 -1
- package/dist/core/api/auth/client.d.ts.map +1 -1
- package/dist/core/api/auth/client.js +1 -1
- package/dist/core/api/auth/client.js.map +1 -1
- package/package.json +2 -2
- package/dist/cli/utils/runTask.d.ts +0 -14
- package/dist/cli/utils/runTask.d.ts.map +0 -1
- package/dist/cli/utils/runTask.js +0 -24
- package/dist/cli/utils/runTask.js.map +0 -1
|
@@ -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;
|
|
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,57 +1,87 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import { log } from "@clack/prompts";
|
|
2
|
+
import { log, spinner } from "@clack/prompts";
|
|
3
3
|
import pWaitFor from "p-wait-for";
|
|
4
4
|
import { writeAuth } from "../../../core/config/auth.js";
|
|
5
|
-
import { generateDeviceCode, getTokenFromDeviceCode, } from "../../../core/api/auth";
|
|
6
|
-
import { runCommand
|
|
5
|
+
import { generateDeviceCode, getTokenFromDeviceCode, AuthApiError, AuthValidationError, } from "../../../core/api/auth";
|
|
6
|
+
import { runCommand } from "../../utils/index.js";
|
|
7
7
|
async function generateAndDisplayDeviceCode() {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
+
}
|
|
17
28
|
}
|
|
18
29
|
async function waitForAuthentication(deviceCode, expiresIn) {
|
|
30
|
+
const s = spinner();
|
|
31
|
+
s.start("Waiting for you to complete authentication...");
|
|
19
32
|
let tokenResponse = null;
|
|
20
33
|
try {
|
|
21
|
-
await
|
|
22
|
-
|
|
34
|
+
await pWaitFor(async () => {
|
|
35
|
+
try {
|
|
23
36
|
const result = await getTokenFromDeviceCode(deviceCode);
|
|
24
37
|
if (result !== null) {
|
|
25
38
|
tokenResponse = result;
|
|
26
39
|
return true;
|
|
27
40
|
}
|
|
28
41
|
return false;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
+
}
|
|
33
53
|
}, {
|
|
34
|
-
|
|
35
|
-
|
|
54
|
+
interval: 2000,
|
|
55
|
+
timeout: expiresIn * 1000,
|
|
36
56
|
});
|
|
37
57
|
}
|
|
38
58
|
catch (error) {
|
|
59
|
+
s.stop("Authentication failed");
|
|
39
60
|
if (error instanceof Error && error.message.includes("timed out")) {
|
|
40
61
|
throw new Error("Authentication timed out. Please try again.");
|
|
41
62
|
}
|
|
42
|
-
|
|
63
|
+
if (error instanceof Error) {
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
throw new Error("Unexpected error during authentication");
|
|
43
67
|
}
|
|
68
|
+
s.stop("Authentication completed!");
|
|
44
69
|
if (!tokenResponse) {
|
|
45
70
|
throw new Error("Failed to retrieve authentication token.");
|
|
46
71
|
}
|
|
47
72
|
return tokenResponse;
|
|
48
73
|
}
|
|
49
74
|
async function saveAuthData(token) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
+
}
|
|
55
85
|
}
|
|
56
86
|
async function login() {
|
|
57
87
|
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,MAAM,gBAAgB,CAAC;
|
|
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,OA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AAC,IAAI;SACjB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,uCACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE,CACH,CAAC;IACJ,CAAC;AACH,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;
|
|
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"}
|
|
@@ -3,8 +3,18 @@ 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
|
-
|
|
7
|
-
|
|
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
|
+
}
|
|
8
18
|
}
|
|
9
19
|
export const logoutCommand = new Command("logout")
|
|
10
20
|
.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,MAAM,UAAU,EAAE,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,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 +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;
|
|
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"}
|
|
@@ -3,8 +3,18 @@ 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
|
-
|
|
7
|
-
|
|
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
|
+
}
|
|
8
18
|
}
|
|
9
19
|
export const whoamiCommand = new Command("whoami")
|
|
10
20
|
.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,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK,UAAU,MAAM;IACnB,MAAM,IAAI,GAAG,MAAM,QAAQ,EAAE,CAAC;
|
|
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,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK,UAAU,MAAM;IACnB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,QAAQ,EAAE,CAAC;QAC9B,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACzD,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,oCAAoC,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,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 +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"}
|
package/dist/cli/utils/index.js
CHANGED
|
@@ -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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runCommand.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/runCommand.ts"],"names":[],"mappings":"
|
|
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,6 +1,5 @@
|
|
|
1
1
|
import { intro, log } from "@clack/prompts";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
import { AuthApiError, AuthValidationError } from "../../core/errors/index.js";
|
|
4
3
|
const base44Color = chalk.bgHex("#E86B3C");
|
|
5
4
|
/**
|
|
6
5
|
* Wraps a command function with the Base44 intro banner.
|
|
@@ -14,19 +13,7 @@ export async function runCommand(commandFn) {
|
|
|
14
13
|
await commandFn();
|
|
15
14
|
}
|
|
16
15
|
catch (e) {
|
|
17
|
-
|
|
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
|
-
}
|
|
16
|
+
log.error(e instanceof Error ? e.message : String(e));
|
|
30
17
|
process.exit(1);
|
|
31
18
|
}
|
|
32
19
|
}
|
|
@@ -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;
|
|
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,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/core/api/auth/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAYrB,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAuCtE;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/core/api/auth/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAYrB,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAuCtE;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA6C/B"}
|
|
@@ -47,7 +47,7 @@ export async function getTokenFromDeviceCode(deviceCode) {
|
|
|
47
47
|
}
|
|
48
48
|
const mockResponse = {
|
|
49
49
|
token: "mock-token-" + Date.now(),
|
|
50
|
-
email: "
|
|
50
|
+
email: "sd.com",
|
|
51
51
|
name: "Test User",
|
|
52
52
|
};
|
|
53
53
|
const result = TokenResponseSchema.safeParse(mockResponse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/core/api/auth/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAExB,mBAAmB,GAEpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC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
3
|
-
"version": "0.0.1-pr.5.
|
|
3
|
+
"version": "0.0.1-pr.5.668b7ca",
|
|
4
4
|
"description": "Base44 CLI - Unified interface for managing Base44 applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli/index.js",
|
|
@@ -51,6 +51,6 @@
|
|
|
51
51
|
"typescript": "^5.7.2"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
54
|
+
"node": ">=18.0.0"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|