@base44-preview/cli 0.0.1-pr.5.e49d892 → 0.0.1-pr.7.1d9f5eb
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/README.md +18 -14
- package/dist/cli/commands/auth/login.d.ts.map +1 -1
- package/dist/cli/commands/auth/login.js +28 -58
- 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 +2 -12
- 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 +2 -12
- package/dist/cli/commands/auth/whoami.js.map +1 -1
- package/dist/cli/commands/project/show-project.d.ts +3 -0
- package/dist/cli/commands/project/show-project.d.ts.map +1 -0
- package/dist/cli/commands/project/show-project.js +20 -0
- package/dist/cli/commands/project/show-project.js.map +1 -0
- package/dist/cli/index.js +10 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/index.d.ts +1 -0
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +1 -0
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/packageVersion.js +3 -3
- package/dist/cli/utils/packageVersion.js.map +1 -1
- package/dist/cli/utils/runCommand.d.ts.map +1 -1
- package/dist/cli/utils/runCommand.js +11 -1
- package/dist/cli/utils/runCommand.js.map +1 -1
- package/dist/cli/utils/runTask.d.ts +14 -0
- package/dist/cli/utils/runTask.d.ts.map +1 -0
- package/dist/cli/utils/runTask.js +24 -0
- package/dist/cli/utils/runTask.js.map +1 -0
- package/dist/core/api/auth/client.d.ts +1 -1
- package/dist/core/api/auth/client.d.ts.map +1 -1
- package/dist/core/api/auth/client.js +4 -4
- package/dist/core/api/auth/client.js.map +1 -1
- package/dist/core/api/auth/index.d.ts +3 -3
- package/dist/core/api/auth/index.js +3 -3
- package/dist/core/api/auth/schema.d.ts +1 -1
- package/dist/core/api/auth/schema.js +8 -8
- package/dist/core/api/index.d.ts +1 -1
- package/dist/core/api/index.js +1 -1
- package/dist/core/config/auth.d.ts +1 -1
- package/dist/core/config/auth.d.ts.map +1 -1
- package/dist/core/config/auth.js +1 -1
- package/dist/core/config/auth.js.map +1 -1
- package/dist/core/config/constants.d.ts +3 -0
- package/dist/core/config/constants.d.ts.map +1 -1
- package/dist/core/config/constants.js +8 -5
- package/dist/core/config/constants.js.map +1 -1
- package/dist/core/config/entities.d.ts +3 -0
- package/dist/core/config/entities.d.ts.map +1 -0
- package/dist/core/config/entities.js +25 -0
- package/dist/core/config/entities.js.map +1 -0
- package/dist/core/config/functions.d.ts +4 -0
- package/dist/core/config/functions.d.ts.map +1 -0
- package/dist/core/config/functions.js +26 -0
- package/dist/core/config/functions.js.map +1 -0
- package/dist/core/config/index.d.ts +5 -2
- package/dist/core/config/index.d.ts.map +1 -1
- package/dist/core/config/index.js +5 -2
- package/dist/core/config/index.js.map +1 -1
- package/dist/core/config/project.d.ts +15 -0
- package/dist/core/config/project.d.ts.map +1 -0
- package/dist/core/config/project.js +64 -0
- package/dist/core/config/project.js.map +1 -0
- package/dist/core/errors/index.d.ts +1 -1
- package/dist/core/errors/index.js +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +5 -5
- package/dist/core/schemas/auth.d.ts +1 -1
- package/dist/core/schemas/auth.js +3 -3
- package/dist/core/schemas/entity.d.ts +16 -0
- package/dist/core/schemas/entity.d.ts.map +1 -0
- package/dist/core/schemas/entity.js +10 -0
- package/dist/core/schemas/entity.js.map +1 -0
- package/dist/core/schemas/function.d.ts +53 -0
- package/dist/core/schemas/function.d.ts.map +1 -0
- package/dist/core/schemas/function.js +19 -0
- package/dist/core/schemas/function.js.map +1 -0
- package/dist/core/schemas/index.d.ts +4 -1
- package/dist/core/schemas/index.d.ts.map +1 -1
- package/dist/core/schemas/index.js +4 -1
- package/dist/core/schemas/index.js.map +1 -1
- package/dist/core/schemas/project.d.ts +14 -0
- package/dist/core/schemas/project.d.ts.map +1 -0
- package/dist/core/schemas/project.js +9 -0
- package/dist/core/schemas/project.js.map +1 -0
- package/dist/core/utils/fs.d.ts +1 -1
- package/dist/core/utils/fs.d.ts.map +1 -1
- package/dist/core/utils/fs.js +21 -11
- package/dist/core/utils/fs.js.map +1 -1
- package/dist/core/utils/index.d.ts +1 -1
- package/dist/core/utils/index.js +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -11,32 +11,42 @@ npm install
|
|
|
11
11
|
# Build the project
|
|
12
12
|
npm run build
|
|
13
13
|
|
|
14
|
-
# Run the CLI
|
|
14
|
+
# Run the CLI
|
|
15
15
|
npm start # Using node directly
|
|
16
|
-
npm run base44 # Using npm (runs node_modules/.bin/base44)
|
|
17
16
|
./dist/cli/index.js # Run executable directly
|
|
18
17
|
```
|
|
19
18
|
|
|
20
19
|
## Development
|
|
21
20
|
|
|
22
21
|
```bash
|
|
23
|
-
# Run in development mode
|
|
22
|
+
# Run in development mode
|
|
24
23
|
npm run dev
|
|
25
24
|
|
|
26
25
|
# Build the project
|
|
27
26
|
npm run build
|
|
28
27
|
|
|
28
|
+
# Run the built CLI
|
|
29
|
+
npm run start
|
|
30
|
+
|
|
29
31
|
# Clean build artifacts
|
|
30
32
|
npm run clean
|
|
33
|
+
|
|
34
|
+
# Lint the code
|
|
35
|
+
npm run lint
|
|
31
36
|
```
|
|
32
37
|
|
|
33
38
|
## Commands
|
|
34
39
|
|
|
35
40
|
### Authentication
|
|
36
|
-
|
|
41
|
+
|
|
42
|
+
- `base44 login` - Authenticate with Base44 using device code flow
|
|
37
43
|
- `base44 whoami` - Display current authenticated user
|
|
38
44
|
- `base44 logout` - Logout from current device
|
|
39
45
|
|
|
46
|
+
### Project
|
|
47
|
+
|
|
48
|
+
- `base44 show-project` - Display project configuration, entities, and functions
|
|
49
|
+
|
|
40
50
|
## Project Structure
|
|
41
51
|
|
|
42
52
|
```
|
|
@@ -45,28 +55,22 @@ cli/
|
|
|
45
55
|
│ ├── core/ # Core module (shared code)
|
|
46
56
|
│ │ ├── api/ # API client code
|
|
47
57
|
│ │ ├── config/ # Configuration management
|
|
58
|
+
│ │ ├── errors/ # Custom error classes
|
|
48
59
|
│ │ ├── schemas/ # Zod schemas
|
|
49
60
|
│ │ ├── utils/ # Utility functions
|
|
50
61
|
│ │ └── index.ts # Core module exports
|
|
51
62
|
│ └── cli/ # CLI module (main CLI)
|
|
52
63
|
│ ├── commands/ # Command implementations
|
|
53
|
-
│ │
|
|
64
|
+
│ │ ├── auth/ # Authentication commands
|
|
65
|
+
│ │ └── project/ # Project commands
|
|
54
66
|
│ ├── utils/ # CLI-specific utilities
|
|
55
|
-
│ └── index.ts # Main CLI entry point
|
|
67
|
+
│ └── index.ts # Main CLI entry point
|
|
56
68
|
├── dist/ # Build output (compiled JavaScript)
|
|
57
69
|
├── package.json # Package configuration
|
|
58
70
|
├── tsconfig.json # TypeScript configuration
|
|
59
71
|
└── README.md
|
|
60
72
|
```
|
|
61
73
|
|
|
62
|
-
## Technologies
|
|
63
|
-
|
|
64
|
-
- **TypeScript** - Primary language
|
|
65
|
-
- **Commander.js** - CLI framework
|
|
66
|
-
- **@clack/prompts** - Interactive user prompts
|
|
67
|
-
- **Zod** - Schema validation
|
|
68
|
-
|
|
69
74
|
## License
|
|
70
75
|
|
|
71
76
|
ISC
|
|
72
|
-
|
|
@@ -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;AA6FpC,eAAO,MAAM,YAAY,SAIrB,CAAC"}
|
|
@@ -1,87 +1,57 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import { log
|
|
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
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
31
|
-
s.start("Waiting for you to complete authentication...");
|
|
32
|
-
let tokenResponse = null;
|
|
19
|
+
let tokenResponse;
|
|
33
20
|
try {
|
|
34
|
-
await
|
|
35
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
55
|
-
|
|
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
|
-
|
|
64
|
-
throw error;
|
|
65
|
-
}
|
|
66
|
-
throw new Error("Unexpected error during authentication");
|
|
42
|
+
throw error;
|
|
67
43
|
}
|
|
68
|
-
|
|
69
|
-
if (!tokenResponse) {
|
|
44
|
+
if (tokenResponse === undefined) {
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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,
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../../src/cli/commands/auth/login.ts"],"names":[],"mappings":"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"}
|
|
@@ -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;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
|
-
|
|
7
|
-
|
|
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,
|
|
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;
|
|
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
|
-
|
|
7
|
-
|
|
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,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK,UAAU,MAAM;IACnB,
|
|
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;IAC9B,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;AACzD,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show-project.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/project/show-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,eAAO,MAAM,kBAAkB,SAI3B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { log } from "@clack/prompts";
|
|
3
|
+
import { readProjectConfig } from "../../../core/config/project.js";
|
|
4
|
+
import { runCommand, runTask } from "../../utils/index.js";
|
|
5
|
+
async function showProject() {
|
|
6
|
+
const projectData = await runTask("Reading project configuration", async () => {
|
|
7
|
+
return await readProjectConfig();
|
|
8
|
+
}, {
|
|
9
|
+
successMessage: "Project configuration loaded",
|
|
10
|
+
errorMessage: "Failed to load project configuration",
|
|
11
|
+
});
|
|
12
|
+
const jsonOutput = JSON.stringify(projectData, null, 2);
|
|
13
|
+
log.info(jsonOutput);
|
|
14
|
+
}
|
|
15
|
+
export const showProjectCommand = new Command("show-project")
|
|
16
|
+
.description("Display project configuration, entities, and functions")
|
|
17
|
+
.action(async () => {
|
|
18
|
+
await runCommand(showProject);
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=show-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show-project.js","sourceRoot":"","sources":["../../../../src/cli/commands/project/show-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAG,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE5D,KAAK,UAAU,WAAW;IACxB,MAAM,WAAW,GAAG,MAAM,OAAO,CAC/B,+BAA+B,EAC/B,KAAK,IAAI,EAAE;QACT,OAAO,MAAM,iBAAiB,EAAE,CAAC;IACnC,CAAC,EACD;QACE,cAAc,EAAE,8BAA8B;QAC9C,YAAY,EAAE,sCAAsC;KACrD,CACF,CAAC;IAEF,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACxD,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC;KAC1D,WAAW,CAAC,wDAAwD,CAAC;KACrE,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,UAAU,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command } from
|
|
3
|
-
import { getPackageVersion } from
|
|
4
|
-
import { loginCommand } from
|
|
5
|
-
import { whoamiCommand } from
|
|
6
|
-
import { logoutCommand } from
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { getPackageVersion } from "./utils/index.js";
|
|
4
|
+
import { loginCommand } from "./commands/auth/login.js";
|
|
5
|
+
import { whoamiCommand } from "./commands/auth/whoami.js";
|
|
6
|
+
import { logoutCommand } from "./commands/auth/logout.js";
|
|
7
|
+
import { showProjectCommand } from "./commands/project/show-project.js";
|
|
7
8
|
const program = new Command();
|
|
8
9
|
program
|
|
9
|
-
.name(
|
|
10
|
-
.description(
|
|
10
|
+
.name("base44")
|
|
11
|
+
.description("Base44 CLI - Unified interface for managing Base44 applications")
|
|
11
12
|
.version(getPackageVersion());
|
|
12
13
|
// Register authentication commands
|
|
13
14
|
program.addCommand(loginCommand);
|
|
14
15
|
program.addCommand(whoamiCommand);
|
|
15
16
|
program.addCommand(logoutCommand);
|
|
17
|
+
// Register project commands
|
|
18
|
+
program.addCommand(showProjectCommand);
|
|
16
19
|
// Parse command line arguments
|
|
17
20
|
program.parse();
|
|
18
21
|
//# sourceMappingURL=index.js.map
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CACV,iEAAiE,CAClE;KACA,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAEhC,mCAAmC;AACnC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AACjC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAElC,4BAA4B;AAC5B,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAEvC,+BAA+B;AAC/B,OAAO,CAAC,KAAK,EAAE,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;AAChC,cAAc,cAAc,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;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { readFileSync } from "fs";
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
import { dirname, join } from "path";
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
4
|
export function getPackageVersion() {
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = dirname(__filename);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../../../src/cli/utils/packageVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../../../src/cli/utils/packageVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,UAAU,iBAAiB;IAC/B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEtC,+CAA+C;IAC/C,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAC1E,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,OAAO,WAAW,CAAC,OAAO,CAAC;AAC7B,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":"AAMA;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC7B,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|
|
@@ -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,16 @@ export async function runCommand(commandFn) {
|
|
|
13
14
|
await commandFn();
|
|
14
15
|
}
|
|
15
16
|
catch (e) {
|
|
16
|
-
|
|
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 || e instanceof Error) {
|
|
22
|
+
log.error(e.message);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
log.error(String(e));
|
|
26
|
+
}
|
|
17
27
|
process.exit(1);
|
|
18
28
|
}
|
|
19
29
|
}
|
|
@@ -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;AAC1B,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE1E,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,IAAI,CAAC,YAAY,mBAAmB,EAAE,CAAC;YACrC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzD,GAAG,CAAC,KAAK,CAAC,iCAAiC,MAAM,EAAE,CAAC,CAAC;QACvD,CAAC;aAAM,IAAI,CAAC,YAAY,YAAY,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;YAC3D,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,CAAC,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DeviceCodeResponse, TokenResponse } from "./schema.js";
|
|
2
2
|
export declare function generateDeviceCode(): Promise<DeviceCodeResponse>;
|
|
3
3
|
export declare function getTokenFromDeviceCode(deviceCode: string): Promise<TokenResponse | null>;
|
|
4
4
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/core/api/auth/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/core/api/auth/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAWrE,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAuCtE;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA4C/B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DeviceCodeResponseSchema, TokenResponseSchema, } from "./schema.js";
|
|
2
1
|
import { AuthApiError, AuthValidationError } from "../../errors/index.js";
|
|
2
|
+
import { DeviceCodeResponseSchema, TokenResponseSchema } from "./schema.js";
|
|
3
3
|
async function delay(ms) {
|
|
4
4
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5
5
|
}
|
|
@@ -46,9 +46,9 @@ export async function getTokenFromDeviceCode(deviceCode) {
|
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
const mockResponse = {
|
|
49
|
-
token:
|
|
50
|
-
email: "
|
|
51
|
-
name: "
|
|
49
|
+
token: `mock-token-${Date.now()}`,
|
|
50
|
+
email: "shahart@base44.com",
|
|
51
|
+
name: "Shahar Talmi",
|
|
52
52
|
};
|
|
53
53
|
const result = TokenResponseSchema.safeParse(mockResponse);
|
|
54
54
|
if (!result.success) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/core/api/auth/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/core/api/auth/client.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export { AuthApiError, AuthValidationError } from
|
|
1
|
+
export * from "./client.js";
|
|
2
|
+
export * from "./schema.js";
|
|
3
|
+
export { AuthApiError, AuthValidationError } from "../../errors/index.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export { AuthApiError, AuthValidationError } from
|
|
1
|
+
export * from "./client.js";
|
|
2
|
+
export * from "./schema.js";
|
|
3
|
+
export { AuthApiError, AuthValidationError } from "../../errors/index.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export const DeviceCodeResponseSchema = z.object({
|
|
3
|
-
deviceCode: z.string().min(1,
|
|
4
|
-
userCode: z.string().min(1,
|
|
5
|
-
verificationUrl: z.url(
|
|
6
|
-
expiresIn: z.number().int().positive(
|
|
3
|
+
deviceCode: z.string().min(1, "Device code cannot be empty"),
|
|
4
|
+
userCode: z.string().min(1, "User code cannot be empty"),
|
|
5
|
+
verificationUrl: z.url("Invalid verification URL"),
|
|
6
|
+
expiresIn: z.number().int().positive("Expires in must be a positive integer"),
|
|
7
7
|
});
|
|
8
8
|
export const TokenResponseSchema = z.object({
|
|
9
|
-
token: z.string().min(1,
|
|
10
|
-
email: z.email(
|
|
11
|
-
name: z.string().min(1,
|
|
9
|
+
token: z.string().min(1, "Token cannot be empty"),
|
|
10
|
+
email: z.email("Invalid email address"),
|
|
11
|
+
name: z.string().min(1, "Name cannot be empty"),
|
|
12
12
|
});
|
|
13
13
|
//# sourceMappingURL=schema.js.map
|
package/dist/core/api/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./auth/index.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/api/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./auth/index.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AuthData } from "../schemas/auth.js";
|
|
2
2
|
export declare function readAuth(): Promise<AuthData>;
|
|
3
3
|
export declare function writeAuth(authData: AuthData): Promise<void>;
|
|
4
4
|
export declare function deleteAuth(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/core/config/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/core/config/auth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAInD,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA2BlD;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBjE;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAUhD"}
|