@base44-preview/cli 0.0.1-pr.7.94b130d → 0.0.1-pr.7.c46ed71
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 +3 -3
- package/dist/cli/commands/auth/login.js.map +1 -1
- package/dist/cli/commands/project/show-project.d.ts.map +1 -1
- package/dist/cli/commands/project/show-project.js +1 -2
- package/dist/cli/commands/project/show-project.js.map +1 -1
- package/dist/cli/index.js +8 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/packageVersion.js +3 -3
- package/dist/cli/utils/packageVersion.js.map +1 -1
- 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 +2 -2
- 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 +5 -5
- package/dist/core/config/auth.js.map +1 -1
- package/dist/core/config/entities.d.ts +1 -2
- package/dist/core/config/entities.d.ts.map +1 -1
- package/dist/core/config/entities.js +19 -55
- package/dist/core/config/entities.js.map +1 -1
- package/dist/core/config/functions.d.ts +1 -1
- package/dist/core/config/functions.d.ts.map +1 -1
- package/dist/core/config/functions.js +13 -25
- package/dist/core/config/functions.js.map +1 -1
- package/dist/core/config/index.d.ts +5 -5
- package/dist/core/config/index.d.ts.map +1 -1
- package/dist/core/config/index.js +5 -5
- package/dist/core/config/index.js.map +1 -1
- package/dist/core/config/project.d.ts +4 -4
- package/dist/core/config/project.d.ts.map +1 -1
- package/dist/core/config/project.js +44 -43
- package/dist/core/config/project.js.map +1 -1
- package/dist/core/consts.d.ts +6 -0
- package/dist/core/consts.d.ts.map +1 -0
- package/dist/core/consts.js +19 -0
- package/dist/core/consts.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 +1 -1
- package/dist/core/schemas/entity.d.ts.map +1 -1
- package/dist/core/schemas/entity.js +5 -5
- package/dist/core/schemas/entity.js.map +1 -1
- package/dist/core/schemas/index.d.ts +4 -4
- package/dist/core/schemas/index.js +4 -4
- 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 +9 -8
- 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 +9 -4
- package/dist/core/config/constants.d.ts +0 -7
- package/dist/core/config/constants.d.ts.map +0 -1
- package/dist/core/config/constants.js +0 -9
- package/dist/core/config/constants.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;AA6FpC,eAAO,MAAM,YAAY,SAIrB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { Command } from "commander";
|
|
|
2
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
|
|
5
|
+
import { generateDeviceCode, getTokenFromDeviceCode } from "../../../core/api/auth/index.js";
|
|
6
6
|
import { runCommand, runTask } from "../../utils/index.js";
|
|
7
7
|
async function generateAndDisplayDeviceCode() {
|
|
8
8
|
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
@@ -16,7 +16,7 @@ async function generateAndDisplayDeviceCode() {
|
|
|
16
16
|
return deviceCodeResponse;
|
|
17
17
|
}
|
|
18
18
|
async function waitForAuthentication(deviceCode, expiresIn) {
|
|
19
|
-
let tokenResponse
|
|
19
|
+
let tokenResponse;
|
|
20
20
|
try {
|
|
21
21
|
await runTask("Waiting for you to complete authentication...", async () => {
|
|
22
22
|
await pWaitFor(async () => {
|
|
@@ -41,7 +41,7 @@ async function waitForAuthentication(deviceCode, expiresIn) {
|
|
|
41
41
|
}
|
|
42
42
|
throw error;
|
|
43
43
|
}
|
|
44
|
-
if (
|
|
44
|
+
if (tokenResponse === undefined) {
|
|
45
45
|
throw new Error("Failed to retrieve authentication token.");
|
|
46
46
|
}
|
|
47
47
|
return tokenResponse;
|
|
@@ -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;AACrC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,
|
|
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;AACrC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,SAAS,EA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C,WAAW,CAAC,EAAE,CAAC;YAClE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;IAED,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,KAAoB;IAC9C,MAAM,SAAS,CAAC;QACd,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,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":"show-project.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/project/show-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
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"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import { log } from "@clack/prompts";
|
|
3
3
|
import { readProjectConfig } from "../../../core/config/project.js";
|
|
4
|
-
import { runCommand } from "../../utils/index.js";
|
|
5
|
-
import { runTask } from "../../utils/index.js";
|
|
4
|
+
import { runCommand, runTask } from "../../utils/index.js";
|
|
6
5
|
async function showProject() {
|
|
7
6
|
const projectData = await runTask("Reading project configuration", async () => {
|
|
8
7
|
return await readProjectConfig();
|
|
@@ -1 +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,
|
|
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,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE3D,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,14 +1,14 @@
|
|
|
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
|
|
7
|
-
import { showProjectCommand } 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";
|
|
8
8
|
const program = new Command();
|
|
9
9
|
program
|
|
10
|
-
.name(
|
|
11
|
-
.description(
|
|
10
|
+
.name("base44")
|
|
11
|
+
.description("Base44 CLI - Unified interface for managing Base44 applications")
|
|
12
12
|
.version(getPackageVersion());
|
|
13
13
|
// Register authentication commands
|
|
14
14
|
program.addCommand(loginCommand);
|
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;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,
|
|
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,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,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,7 +46,7 @@ export async function getTokenFromDeviceCode(deviceCode) {
|
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
const mockResponse = {
|
|
49
|
-
token:
|
|
49
|
+
token: `mock-token-${Date.now()}`,
|
|
50
50
|
email: "shahart@base44.com",
|
|
51
51
|
name: "Shahar Talmi",
|
|
52
52
|
};
|
|
@@ -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":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAG5E,KAAK,UAAU,KAAK,CAAC,EAAU;IAC7B,OAAO,IAAI,OAAO,CAAC,CAAC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K,CAAC;QACd,CAAC;QACD,MAAM,IAAI,YAAY,CACpB,2CAA2C,EAC3C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAC1D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -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"}
|
package/dist/core/config/auth.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AuthDataSchema } from "../schemas/auth.js";
|
|
2
|
-
import {
|
|
3
|
-
import { readJsonFile, writeJsonFile, deleteFile
|
|
2
|
+
import { getAuthFilePath } from "../consts.js";
|
|
3
|
+
import { readJsonFile, writeJsonFile, deleteFile } from "../utils/fs.js";
|
|
4
4
|
export async function readAuth() {
|
|
5
5
|
try {
|
|
6
|
-
const parsed = await readJsonFile(
|
|
6
|
+
const parsed = await readJsonFile(getAuthFilePath());
|
|
7
7
|
const result = AuthDataSchema.safeParse(parsed);
|
|
8
8
|
if (!result.success) {
|
|
9
9
|
throw new Error(`Invalid authentication data: ${result.error.issues
|
|
@@ -30,7 +30,7 @@ export async function writeAuth(authData) {
|
|
|
30
30
|
.join(", ")}`);
|
|
31
31
|
}
|
|
32
32
|
try {
|
|
33
|
-
await writeJsonFile(
|
|
33
|
+
await writeJsonFile(getAuthFilePath(), result.data);
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
|
36
36
|
throw new Error(`Failed to write authentication file: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -38,7 +38,7 @@ export async function writeAuth(authData) {
|
|
|
38
38
|
}
|
|
39
39
|
export async function deleteAuth() {
|
|
40
40
|
try {
|
|
41
|
-
await deleteFile(
|
|
41
|
+
await deleteFile(getAuthFilePath());
|
|
42
42
|
}
|
|
43
43
|
catch (error) {
|
|
44
44
|
throw new Error(`Failed to delete authentication file: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/core/config/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/core/config/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEzE,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,eAAe,EAAE,CAAC,CAAC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M,aAAa,CAAC,eAAe,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,wCACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,IAAI,CAAC;QACH,MAAM,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,yCACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function readEntityFile(entityPath: string): Promise<Entity>;
|
|
1
|
+
import type { Entity } from "../schemas/entity.js";
|
|
3
2
|
export declare function readAllEntities(entitiesDir: string): Promise<Entity[]>;
|
|
4
3
|
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/core/config/entities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/core/config/entities.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAkBnD,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAe5E"}
|
|
@@ -1,61 +1,25 @@
|
|
|
1
|
-
import { globby } from
|
|
2
|
-
import { EntitySchema } from
|
|
3
|
-
import { readJsonFile,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (!result.success) {
|
|
12
|
-
throw new Error(`Invalid entity configuration in ${entityPath}: ${result.error.issues
|
|
13
|
-
.map((e) => e.message)
|
|
14
|
-
.join(', ')}`);
|
|
15
|
-
}
|
|
16
|
-
return result.data;
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
if (error instanceof Error && error.message.includes('Invalid entity')) {
|
|
20
|
-
throw error;
|
|
21
|
-
}
|
|
22
|
-
if (error instanceof Error && error.message.includes('File not found')) {
|
|
23
|
-
throw error;
|
|
24
|
-
}
|
|
25
|
-
throw new Error(`Failed to read entity file ${entityPath}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
1
|
+
import { globby } from "globby";
|
|
2
|
+
import { EntitySchema } from "../schemas/entity.js";
|
|
3
|
+
import { readJsonFile, pathExists } from "../utils/fs.js";
|
|
4
|
+
async function readEntityFile(entityPath) {
|
|
5
|
+
const parsed = await readJsonFile(entityPath);
|
|
6
|
+
const result = EntitySchema.safeParse(parsed);
|
|
7
|
+
if (!result.success) {
|
|
8
|
+
throw new Error(`Invalid entity configuration in ${entityPath}: ${result.error.issues
|
|
9
|
+
.map((e) => e.message)
|
|
10
|
+
.join(", ")}`);
|
|
26
11
|
}
|
|
12
|
+
return result.data;
|
|
27
13
|
}
|
|
28
14
|
export async function readAllEntities(entitiesDir) {
|
|
29
|
-
if (!
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
const files = await globby('*.{json,jsonc}', { cwd: entitiesDir, absolute: true });
|
|
34
|
-
const entities = [];
|
|
35
|
-
const errors = [];
|
|
36
|
-
for (const filePath of files) {
|
|
37
|
-
try {
|
|
38
|
-
const entity = await readEntityFile(filePath);
|
|
39
|
-
entities.push(entity);
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
43
|
-
errors.push(`${filePath}: ${errorMessage}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (errors.length > 0 && entities.length === 0) {
|
|
47
|
-
throw new Error(`Failed to read any entity files:\n${errors.join('\n')}`);
|
|
48
|
-
}
|
|
49
|
-
if (errors.length > 0) {
|
|
50
|
-
console.warn(`Warning: Some entity files could not be read:\n${errors.join('\n')}`);
|
|
51
|
-
}
|
|
52
|
-
return entities;
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
if (error instanceof Error && error.message.includes('Failed to read')) {
|
|
56
|
-
throw error;
|
|
57
|
-
}
|
|
58
|
-
throw new Error(`Failed to read entities directory ${entitiesDir}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
15
|
+
if (!(await pathExists(entitiesDir))) {
|
|
16
|
+
return [];
|
|
59
17
|
}
|
|
18
|
+
const files = await globby("*.{json,jsonc}", {
|
|
19
|
+
cwd: entitiesDir,
|
|
20
|
+
absolute: true,
|
|
21
|
+
});
|
|
22
|
+
const entities = await Promise.all(files.map((filePath) => readEntityFile(filePath)));
|
|
23
|
+
return entities;
|
|
60
24
|
}
|
|
61
25
|
//# sourceMappingURL=entities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/core/config/entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/core/config/entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE1D,KAAK,UAAU,cAAc,CAAC,UAAkB;IAC9C,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAE9C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,mCAAmC,UAAU,KAAK,MAAM,CAAC,KAAK,CAAC,MAAM;aAClE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;aACrB,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,WAAmB;IACvD,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QACrC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,gBAAgB,EAAE;QAC3C,GAAG,EAAE,WAAW;QAChB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAChC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAClD,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FunctionConfig } from "../schemas/function.js";
|
|
2
2
|
export declare function readFunctionConfig(configPath: string): Promise<FunctionConfig>;
|
|
3
3
|
export declare function readAllFunctions(functionsDir: string): Promise<FunctionConfig[]>;
|
|
4
4
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/core/config/functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/core/config/functions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7D,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC,CAazB;AAED,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,cAAc,EAAE,CAAC,CAe3B"}
|
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
import { globby } from "globby";
|
|
2
|
-
import { FunctionConfigSchema
|
|
3
|
-
import { FUNCTION_CONFIG_FILE } from "
|
|
4
|
-
import { readJsonFile,
|
|
2
|
+
import { FunctionConfigSchema } from "../schemas/function.js";
|
|
3
|
+
import { FUNCTION_CONFIG_FILE } from "../consts.js";
|
|
4
|
+
import { readJsonFile, pathExists } from "../utils/fs.js";
|
|
5
5
|
export async function readFunctionConfig(configPath) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (!result.success) {
|
|
13
|
-
throw new Error(`Invalid function configuration in ${configPath}: ${result.error.issues
|
|
14
|
-
.map((e) => e.message)
|
|
15
|
-
.join(", ")}`);
|
|
16
|
-
}
|
|
17
|
-
return result.data;
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
throw new Error(`Failed to read function configuration ${configPath}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
6
|
+
const parsed = await readJsonFile(configPath);
|
|
7
|
+
const result = FunctionConfigSchema.safeParse(parsed);
|
|
8
|
+
if (!result.success) {
|
|
9
|
+
throw new Error(`Invalid function configuration in ${configPath}: ${result.error.issues
|
|
10
|
+
.map((e) => e.message)
|
|
11
|
+
.join(", ")}`);
|
|
21
12
|
}
|
|
13
|
+
return result.data;
|
|
22
14
|
}
|
|
23
15
|
export async function readAllFunctions(functionsDir) {
|
|
24
|
-
if (!
|
|
25
|
-
|
|
16
|
+
if (!(await pathExists(functionsDir))) {
|
|
17
|
+
return [];
|
|
26
18
|
}
|
|
27
19
|
const configFiles = await globby(`*/${FUNCTION_CONFIG_FILE}`, {
|
|
28
20
|
cwd: functionsDir,
|
|
29
21
|
absolute: true,
|
|
30
22
|
});
|
|
31
|
-
const functionConfigs =
|
|
32
|
-
for (const configPath of configFiles) {
|
|
33
|
-
const config = await readFunctionConfig(configPath);
|
|
34
|
-
functionConfigs.push(config);
|
|
35
|
-
}
|
|
23
|
+
const functionConfigs = await Promise.all(configFiles.map((configPath) => readFunctionConfig(configPath)));
|
|
36
24
|
return functionConfigs;
|
|
37
25
|
}
|
|
38
26
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/core/config/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/core/config/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,UAAkB;IAElB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,oBAAoB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAEtD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,qCAAqC,UAAU,KAAK,MAAM,CAAC,KAAK,CAAC,MAAM;aACpE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;aACrB,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,YAAoB;IAEpB,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,KAAK,oBAAoB,EAAE,EAAE;QAC5D,GAAG,EAAE,YAAY;QACjB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,GAAG,CACvC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAChE,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "../consts.js";
|
|
2
|
+
export * from "./auth.js";
|
|
3
|
+
export * from "./project.js";
|
|
4
|
+
export * from "./entities.js";
|
|
5
|
+
export * from "./functions.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "../consts.js";
|
|
2
|
+
export * from "./auth.js";
|
|
3
|
+
export * from "./project.js";
|
|
4
|
+
export * from "./entities.js";
|
|
5
|
+
export * from "./functions.js";
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ProjectWithPaths } from "../schemas/project.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { ProjectWithPaths } from "../schemas/project.js";
|
|
2
|
+
import type { Entity } from "../schemas/entity.js";
|
|
3
|
+
import type { FunctionConfig } from "../schemas/function.js";
|
|
4
4
|
export interface ProjectRoot {
|
|
5
5
|
root: string;
|
|
6
6
|
configPath: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function findProjectRoot(startPath?: string): ProjectRoot | null;
|
|
9
8
|
export interface ProjectData {
|
|
10
9
|
project: ProjectWithPaths;
|
|
11
10
|
entities: Entity[];
|
|
12
11
|
functions: FunctionConfig[];
|
|
13
12
|
}
|
|
13
|
+
export declare function findProjectRoot(startPath?: string): Promise<ProjectRoot | null>;
|
|
14
14
|
export declare function readProjectConfig(projectRoot?: string): Promise<ProjectData>;
|
|
15
15
|
//# sourceMappingURL=project.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/core/config/project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/core/config/project.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAM7D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B;AAYD,wBAAsB,eAAe,CACnC,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAY7B;AAED,wBAAsB,iBAAiB,CACrC,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,WAAW,CAAC,CAyCtB"}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { join, dirname } from "path";
|
|
1
|
+
import { join, dirname } from "node:path";
|
|
2
|
+
import { globby } from "globby";
|
|
2
3
|
import { ProjectConfigSchema } from "../schemas/project.js";
|
|
3
|
-
import {
|
|
4
|
-
import { readJsonFile
|
|
4
|
+
import { getProjectConfigPatterns, PROJECT_SUBDIR } from "../consts.js";
|
|
5
|
+
import { readJsonFile } from "../utils/fs.js";
|
|
5
6
|
import { readAllEntities } from "./entities.js";
|
|
6
7
|
import { readAllFunctions } from "./functions.js";
|
|
7
|
-
// Finds
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
8
|
+
// Finds config file in a directory using globby, respecting priority order.
|
|
9
|
+
async function findConfigInDir(dir) {
|
|
10
|
+
const files = await globby(getProjectConfigPatterns(), {
|
|
11
|
+
cwd: dir,
|
|
12
|
+
absolute: true,
|
|
13
|
+
});
|
|
14
|
+
return files[0] ?? null;
|
|
15
|
+
}
|
|
16
|
+
// Walks up the directory tree to locate a Base44 project config file.
|
|
17
|
+
export async function findProjectRoot(startPath) {
|
|
18
|
+
let current = startPath || process.cwd();
|
|
11
19
|
while (current !== dirname(current)) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (fileExists(subdirConfigPath)) {
|
|
15
|
-
return { root: current, configPath: subdirConfigPath };
|
|
16
|
-
}
|
|
17
|
-
// Then check for config.jsonc in the current directory
|
|
18
|
-
const configPath = join(current, PROJECT_CONFIG_FILE);
|
|
19
|
-
if (fileExists(configPath)) {
|
|
20
|
+
const configPath = await findConfigInDir(current);
|
|
21
|
+
if (configPath) {
|
|
20
22
|
return { root: current, configPath };
|
|
21
23
|
}
|
|
22
24
|
current = dirname(current);
|
|
@@ -24,37 +26,36 @@ export function findProjectRoot(startPath) {
|
|
|
24
26
|
return null;
|
|
25
27
|
}
|
|
26
28
|
export async function readProjectConfig(projectRoot) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
let found;
|
|
30
|
+
if (projectRoot) {
|
|
31
|
+
const configPath = await findConfigInDir(projectRoot);
|
|
32
|
+
found = configPath ? { root: projectRoot, configPath } : null;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
found = await findProjectRoot();
|
|
36
|
+
}
|
|
30
37
|
if (!found) {
|
|
31
|
-
throw new Error(`Project root not found. Please ensure
|
|
38
|
+
throw new Error(`Project root not found. Please ensure config.jsonc or config.json exists in the project directory or ${PROJECT_SUBDIR}/ subdirectory.`);
|
|
32
39
|
}
|
|
33
40
|
const { root, configPath } = found;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.map((e) => e.message)
|
|
40
|
-
.join(", ")}`);
|
|
41
|
-
}
|
|
42
|
-
const project = result.data;
|
|
43
|
-
const configDir = dirname(configPath);
|
|
44
|
-
const entitiesPath = join(configDir, project.entitySrc);
|
|
45
|
-
const functionsPath = join(configDir, project.functionSrc);
|
|
46
|
-
const [entities, functions] = await Promise.all([
|
|
47
|
-
fileExists(entitiesPath) ? readAllEntities(entitiesPath) : [],
|
|
48
|
-
fileExists(functionsPath) ? readAllFunctions(functionsPath) : [],
|
|
49
|
-
]);
|
|
50
|
-
return {
|
|
51
|
-
project: { ...project, root, configPath },
|
|
52
|
-
entities,
|
|
53
|
-
functions,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
throw new Error(`Failed to read project configuration: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
41
|
+
const parsed = await readJsonFile(configPath);
|
|
42
|
+
const result = ProjectConfigSchema.safeParse(parsed);
|
|
43
|
+
if (!result.success) {
|
|
44
|
+
const errors = result.error.issues.map((e) => e.message).join(", ");
|
|
45
|
+
throw new Error(`Invalid project configuration: ${errors}`);
|
|
58
46
|
}
|
|
47
|
+
const project = result.data;
|
|
48
|
+
const configDir = dirname(configPath);
|
|
49
|
+
const entitiesPath = join(configDir, project.entitySrc);
|
|
50
|
+
const functionsPath = join(configDir, project.functionSrc);
|
|
51
|
+
const [entities, functions] = await Promise.all([
|
|
52
|
+
readAllEntities(entitiesPath),
|
|
53
|
+
readAllFunctions(functionsPath),
|
|
54
|
+
]);
|
|
55
|
+
return {
|
|
56
|
+
project: { ...project, root, configPath },
|
|
57
|
+
entities,
|
|
58
|
+
functions,
|
|
59
|
+
};
|
|
59
60
|
}
|
|
60
61
|
//# sourceMappingURL=project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../../src/core/config/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot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ChC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE;QACzC,QAAQ;QACR,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PROJECT_SUBDIR = "base44";
|
|
2
|
+
export declare const FUNCTION_CONFIG_FILE = "function.jsonc";
|
|
3
|
+
export declare function getBase44Dir(): string;
|
|
4
|
+
export declare function getAuthFilePath(): string;
|
|
5
|
+
export declare function getProjectConfigPatterns(): string[];
|
|
6
|
+
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../src/core/consts.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,WAAW,CAAC;AACvC,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AAErD,wBAAgB,YAAY,WAE3B;AAED,wBAAgB,eAAe,WAE9B;AAED,wBAAgB,wBAAwB,aAOvC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
export const PROJECT_SUBDIR = "base44";
|
|
4
|
+
export const FUNCTION_CONFIG_FILE = "function.jsonc";
|
|
5
|
+
export function getBase44Dir() {
|
|
6
|
+
return join(homedir(), ".base44");
|
|
7
|
+
}
|
|
8
|
+
export function getAuthFilePath() {
|
|
9
|
+
return join(getBase44Dir(), "auth", "auth.json");
|
|
10
|
+
}
|
|
11
|
+
export function getProjectConfigPatterns() {
|
|
12
|
+
return [
|
|
13
|
+
`${PROJECT_SUBDIR}/config.jsonc`,
|
|
14
|
+
`${PROJECT_SUBDIR}/config.json`,
|
|
15
|
+
"config.jsonc",
|
|
16
|
+
"config.json",
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=consts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../src/core/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC;AACvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAErD,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL,GAAG,cAAc,eAAe;QAChC,GAAG,cAAc,cAAc;QAC/B,cAAc;QACd,aAAa;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./errors.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./errors.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "./schemas/index.js";
|
|
2
|
+
export * from "./config/index.js";
|
|
3
|
+
export * from "./utils/index.js";
|
|
4
|
+
export * from "./api/index.js";
|
|
5
|
+
export * from "./errors/index.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "./schemas/index.js";
|
|
2
|
+
export * from "./config/index.js";
|
|
3
|
+
export * from "./utils/index.js";
|
|
4
|
+
export * from "./api/index.js";
|
|
5
|
+
export * from "./errors/index.js";
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export const AuthDataSchema = z.object({
|
|
3
|
-
token: z.string().min(1,
|
|
3
|
+
token: z.string().min(1, "Token cannot be empty"),
|
|
4
4
|
email: z.email(),
|
|
5
|
-
name: z.string().min(1,
|
|
5
|
+
name: z.string().min(1, "Name cannot be empty"),
|
|
6
6
|
});
|
|
7
7
|
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/core/schemas/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,WAAW;;;iBAGf,
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/core/schemas/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,WAAW;;;iBAGf,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;iBAGvB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
const FieldSchema = z.looseObject({
|
|
3
|
-
name: z.string().min(1,
|
|
4
|
-
type: z.string().min(1,
|
|
3
|
+
name: z.string().min(1, "Field name cannot be empty"),
|
|
4
|
+
type: z.string().min(1, "Field type cannot be empty"),
|
|
5
5
|
});
|
|
6
6
|
export const EntitySchema = z.looseObject({
|
|
7
|
-
name: z.string().min(1,
|
|
8
|
-
fields: z.array(FieldSchema)
|
|
7
|
+
name: z.string().min(1, "Entity name cannot be empty"),
|
|
8
|
+
fields: z.array(FieldSchema),
|
|
9
9
|
});
|
|
10
10
|
//# sourceMappingURL=entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/core/schemas/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,4BAA4B,CAAC;IACrD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,4BAA4B,CAAC;CACtD,CAAC,
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/core/schemas/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,4BAA4B,CAAC;IACrD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,4BAA4B,CAAC;CACtD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,6BAA6B,CAAC;IACtD,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;CAC7B,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
export * from "./auth.js";
|
|
2
|
+
export * from "./project.js";
|
|
3
|
+
export * from "./entity.js";
|
|
4
|
+
export * from "./function.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
export * from "./auth.js";
|
|
2
|
+
export * from "./project.js";
|
|
3
|
+
export * from "./entity.js";
|
|
4
|
+
export * from "./function.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/core/utils/fs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function pathExists(path: string): Promise<boolean>;
|
|
2
2
|
export declare function readJsonFile(filePath: string): Promise<unknown>;
|
|
3
3
|
export declare function writeJsonFile(filePath: string, data: unknown): Promise<void>;
|
|
4
4
|
export declare function deleteFile(filePath: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/core/utils/fs.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/core/utils/fs.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,oBAItC;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA8BrE;AAED,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAchE"}
|
package/dist/core/utils/fs.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { dirname } from "path";
|
|
1
|
+
import { readFile, writeFile, mkdir, unlink, access } from "node:fs/promises";
|
|
2
|
+
import { dirname } from "node:path";
|
|
4
3
|
import { parse, printParseErrorCode } from "jsonc-parser";
|
|
5
|
-
export function
|
|
6
|
-
return
|
|
4
|
+
export function pathExists(path) {
|
|
5
|
+
return access(path)
|
|
6
|
+
.then(() => true)
|
|
7
|
+
.catch(() => false);
|
|
7
8
|
}
|
|
8
9
|
export async function readJsonFile(filePath) {
|
|
9
|
-
if (!
|
|
10
|
+
if (!(await pathExists(filePath))) {
|
|
10
11
|
throw new Error(`File not found: ${filePath}`);
|
|
11
12
|
}
|
|
12
13
|
try {
|
|
@@ -31,7 +32,7 @@ export async function readJsonFile(filePath) {
|
|
|
31
32
|
export async function writeJsonFile(filePath, data) {
|
|
32
33
|
try {
|
|
33
34
|
const dir = dirname(filePath);
|
|
34
|
-
if (!
|
|
35
|
+
if (!(await pathExists(dir))) {
|
|
35
36
|
await mkdir(dir, { recursive: true });
|
|
36
37
|
}
|
|
37
38
|
const jsonContent = JSON.stringify(data, null, 2);
|
|
@@ -42,7 +43,7 @@ export async function writeJsonFile(filePath, data) {
|
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
export async function deleteFile(filePath) {
|
|
45
|
-
if (!
|
|
46
|
+
if (!(await pathExists(filePath))) {
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
49
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/core/utils/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/core/utils/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SA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AAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./fs.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./fs.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base44-preview/cli",
|
|
3
|
-
"version": "0.0.1-pr.7.
|
|
3
|
+
"version": "0.0.1-pr.7.c46ed71",
|
|
4
4
|
"description": "Base44 CLI - Unified interface for managing Base44 applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli/index.js",
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
"dev": "tsx src/cli/index.ts",
|
|
21
21
|
"start": "node dist/cli/index.js",
|
|
22
22
|
"clean": "rm -rf dist",
|
|
23
|
-
"lint": "eslint src"
|
|
23
|
+
"lint": "eslint src",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"test:watch": "vitest"
|
|
24
26
|
},
|
|
25
27
|
"keywords": [
|
|
26
28
|
"base44",
|
|
@@ -48,11 +50,14 @@
|
|
|
48
50
|
"@typescript-eslint/parser": "^8.51.0",
|
|
49
51
|
"eslint": "^9.39.2",
|
|
50
52
|
"eslint-plugin-import": "^2.32.0",
|
|
53
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
51
54
|
"tsc-alias": "^1.8.16",
|
|
52
55
|
"tsx": "^4.19.2",
|
|
53
|
-
"typescript": "^5.7.2"
|
|
56
|
+
"typescript": "^5.7.2",
|
|
57
|
+
"typescript-eslint": "^8.52.0",
|
|
58
|
+
"vitest": "^4.0.16"
|
|
54
59
|
},
|
|
55
60
|
"engines": {
|
|
56
|
-
"node": ">=20.
|
|
61
|
+
"node": ">=20.19.0"
|
|
57
62
|
}
|
|
58
63
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const BASE44_DIR: string;
|
|
2
|
-
export declare const AUTH_DIR: string;
|
|
3
|
-
export declare const AUTH_FILE_PATH: string;
|
|
4
|
-
export declare const PROJECT_SUBDIR = ".base44";
|
|
5
|
-
export declare const PROJECT_CONFIG_FILE = "config.jsonc";
|
|
6
|
-
export declare const FUNCTION_CONFIG_FILE = "function.jsonc";
|
|
7
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/config/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,QAA6B,CAAC;AACrD,eAAO,MAAM,QAAQ,QAA2B,CAAC;AACjD,eAAO,MAAM,cAAc,QAA8B,CAAC;AAE1D,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,eAAO,MAAM,oBAAoB,mBAAmB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { join } from 'path';
|
|
2
|
-
import { homedir } from 'os';
|
|
3
|
-
export const BASE44_DIR = join(homedir(), '.base44');
|
|
4
|
-
export const AUTH_DIR = join(BASE44_DIR, 'auth');
|
|
5
|
-
export const AUTH_FILE_PATH = join(AUTH_DIR, 'auth.json');
|
|
6
|
-
export const PROJECT_SUBDIR = '.base44';
|
|
7
|
-
export const PROJECT_CONFIG_FILE = 'config.jsonc';
|
|
8
|
-
export const FUNCTION_CONFIG_FILE = 'function.jsonc';
|
|
9
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/core/config/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAClD,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC"}
|