@base44-preview/cli 0.0.1-pr.10.3ef6431 → 0.0.1-pr.11.ccd1624
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/index.js +509 -13
- package/package.json +5 -9
- package/dist/cli/commands/auth/login.d.ts +0 -3
- package/dist/cli/commands/auth/login.d.ts.map +0 -1
- package/dist/cli/commands/auth/login.js +0 -71
- package/dist/cli/commands/auth/login.js.map +0 -1
- package/dist/cli/commands/auth/logout.d.ts +0 -3
- package/dist/cli/commands/auth/logout.d.ts.map +0 -1
- package/dist/cli/commands/auth/logout.js +0 -14
- package/dist/cli/commands/auth/logout.js.map +0 -1
- package/dist/cli/commands/auth/whoami.d.ts +0 -3
- package/dist/cli/commands/auth/whoami.d.ts.map +0 -1
- package/dist/cli/commands/auth/whoami.js +0 -14
- package/dist/cli/commands/auth/whoami.js.map +0 -1
- package/dist/cli/commands/project/show-project.d.ts +0 -3
- package/dist/cli/commands/project/show-project.d.ts.map +0 -1
- package/dist/cli/commands/project/show-project.js +0 -20
- package/dist/cli/commands/project/show-project.js.map +0 -1
- package/dist/cli/index.d.ts +0 -3
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/utils/index.d.ts +0 -4
- package/dist/cli/utils/index.d.ts.map +0 -1
- package/dist/cli/utils/index.js +0 -4
- package/dist/cli/utils/index.js.map +0 -1
- package/dist/cli/utils/packageVersion.d.ts +0 -2
- package/dist/cli/utils/packageVersion.d.ts.map +0 -1
- package/dist/cli/utils/packageVersion.js +0 -12
- package/dist/cli/utils/packageVersion.js.map +0 -1
- package/dist/cli/utils/runCommand.d.ts +0 -8
- package/dist/cli/utils/runCommand.d.ts.map +0 -1
- package/dist/cli/utils/runCommand.js +0 -25
- package/dist/cli/utils/runCommand.js.map +0 -1
- 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
- package/dist/core/auth/api.d.ts +0 -5
- package/dist/core/auth/api.d.ts.map +0 -1
- package/dist/core/auth/api.js +0 -81
- package/dist/core/auth/api.js.map +0 -1
- package/dist/core/auth/authClient.d.ts +0 -7
- package/dist/core/auth/authClient.d.ts.map +0 -1
- package/dist/core/auth/authClient.js +0 -14
- package/dist/core/auth/authClient.js.map +0 -1
- package/dist/core/auth/config.d.ts +0 -15
- package/dist/core/auth/config.d.ts.map +0 -1
- package/dist/core/auth/config.js +0 -91
- package/dist/core/auth/config.js.map +0 -1
- package/dist/core/auth/index.d.ts +0 -4
- package/dist/core/auth/index.d.ts.map +0 -1
- package/dist/core/auth/index.js +0 -4
- package/dist/core/auth/index.js.map +0 -1
- package/dist/core/auth/schema.d.ts +0 -58
- package/dist/core/auth/schema.d.ts.map +0 -1
- package/dist/core/auth/schema.js +0 -57
- package/dist/core/auth/schema.js.map +0 -1
- package/dist/core/config/app.d.ts +0 -22
- package/dist/core/config/app.d.ts.map +0 -1
- package/dist/core/config/app.js +0 -14
- package/dist/core/config/app.js.map +0 -1
- package/dist/core/config/index.d.ts +0 -4
- package/dist/core/config/index.d.ts.map +0 -1
- package/dist/core/config/index.js +0 -3
- package/dist/core/config/index.js.map +0 -1
- package/dist/core/config/project.d.ts +0 -25
- package/dist/core/config/project.d.ts.map +0 -1
- package/dist/core/config/project.js +0 -62
- package/dist/core/config/project.js.map +0 -1
- package/dist/core/config/resource.d.ts +0 -4
- package/dist/core/config/resource.d.ts.map +0 -1
- package/dist/core/config/resource.js +0 -2
- package/dist/core/config/resource.js.map +0 -1
- package/dist/core/consts.d.ts +0 -8
- package/dist/core/consts.d.ts.map +0 -1
- package/dist/core/consts.js +0 -24
- package/dist/core/consts.js.map +0 -1
- package/dist/core/errors.d.ts +0 -8
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/errors.js +0 -15
- package/dist/core/errors.js.map +0 -1
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -6
- package/dist/core/index.js.map +0 -1
- package/dist/core/resources/entity/config.d.ts +0 -3
- package/dist/core/resources/entity/config.d.ts.map +0 -1
- package/dist/core/resources/entity/config.js +0 -25
- package/dist/core/resources/entity/config.js.map +0 -1
- package/dist/core/resources/entity/index.d.ts +0 -4
- package/dist/core/resources/entity/index.d.ts.map +0 -1
- package/dist/core/resources/entity/index.js +0 -4
- package/dist/core/resources/entity/index.js.map +0 -1
- package/dist/core/resources/entity/resource.d.ts +0 -4
- package/dist/core/resources/entity/resource.d.ts.map +0 -1
- package/dist/core/resources/entity/resource.js +0 -5
- package/dist/core/resources/entity/resource.js.map +0 -1
- package/dist/core/resources/entity/schema.d.ts +0 -47
- package/dist/core/resources/entity/schema.d.ts.map +0 -1
- package/dist/core/resources/entity/schema.js +0 -29
- package/dist/core/resources/entity/schema.js.map +0 -1
- package/dist/core/resources/function/config.d.ts +0 -4
- package/dist/core/resources/function/config.d.ts.map +0 -1
- package/dist/core/resources/function/config.js +0 -26
- package/dist/core/resources/function/config.js.map +0 -1
- package/dist/core/resources/function/index.d.ts +0 -4
- package/dist/core/resources/function/index.d.ts.map +0 -1
- package/dist/core/resources/function/index.js +0 -4
- package/dist/core/resources/function/index.js.map +0 -1
- package/dist/core/resources/function/resource.d.ts +0 -4
- package/dist/core/resources/function/resource.d.ts.map +0 -1
- package/dist/core/resources/function/resource.js +0 -5
- package/dist/core/resources/function/resource.js.map +0 -1
- package/dist/core/resources/function/schema.d.ts +0 -91
- package/dist/core/resources/function/schema.d.ts.map +0 -1
- package/dist/core/resources/function/schema.js +0 -36
- package/dist/core/resources/function/schema.js.map +0 -1
- package/dist/core/resources/index.d.ts +0 -3
- package/dist/core/resources/index.d.ts.map +0 -1
- package/dist/core/resources/index.js +0 -3
- package/dist/core/resources/index.js.map +0 -1
- package/dist/core/utils/fs.d.ts +0 -5
- package/dist/core/utils/fs.d.ts.map +0 -1
- package/dist/core/utils/fs.js +0 -56
- package/dist/core/utils/fs.js.map +0 -1
- package/dist/core/utils/httpClient.d.ts +0 -3
- package/dist/core/utils/httpClient.d.ts.map +0 -1
- package/dist/core/utils/httpClient.js +0 -57
- package/dist/core/utils/httpClient.js.map +0 -1
- package/dist/core/utils/index.d.ts +0 -3
- package/dist/core/utils/index.d.ts.map +0 -1
- package/dist/core/utils/index.js +0 -3
- package/dist/core/utils/index.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { log } from "@clack/prompts";
|
|
3
|
-
import { readAuth } from "../../../core/auth/index.js";
|
|
4
|
-
import { runCommand } from "../../utils/index.js";
|
|
5
|
-
async function whoami() {
|
|
6
|
-
const auth = await readAuth();
|
|
7
|
-
log.info(`Logged in as: ${auth.name} (${auth.email})`);
|
|
8
|
-
}
|
|
9
|
-
export const whoamiCommand = new Command("whoami")
|
|
10
|
-
.description("Display current authenticated user")
|
|
11
|
-
.action(async () => {
|
|
12
|
-
await runCommand(whoami);
|
|
13
|
-
});
|
|
14
|
-
//# sourceMappingURL=whoami.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,qBAAqB,CAAC;AAC/C,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"}
|
|
@@ -1 +0,0 @@
|
|
|
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,20 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,yBAAyB,CAAC;AAC5D,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.d.ts
DELETED
package/dist/cli/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
package/dist/cli/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/packageVersion.ts"],"names":[],"mappings":"AAIA,wBAAgB,iBAAiB,IAAI,MAAM,CAQ1C"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
export function getPackageVersion() {
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = dirname(__filename);
|
|
7
|
-
// From dist/cli/utils -> package.json at root"
|
|
8
|
-
const packageJsonPath = join(__dirname, "..", "..", "..", "package.json");
|
|
9
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
10
|
-
return packageJson.version;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wraps a command function with the Base44 intro banner.
|
|
3
|
-
* All CLI commands should use this utility to ensure consistent branding.
|
|
4
|
-
*
|
|
5
|
-
* @param commandFn - The async function to execute as the command
|
|
6
|
-
*/
|
|
7
|
-
export declare function runCommand(commandFn: () => Promise<void>): Promise<void>;
|
|
8
|
-
//# sourceMappingURL=runCommand.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,CAaf"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { intro, log } from "@clack/prompts";
|
|
2
|
-
import chalk from "chalk";
|
|
3
|
-
const base44Color = chalk.bgHex("#E86B3C");
|
|
4
|
-
/**
|
|
5
|
-
* Wraps a command function with the Base44 intro banner.
|
|
6
|
-
* All CLI commands should use this utility to ensure consistent branding.
|
|
7
|
-
*
|
|
8
|
-
* @param commandFn - The async function to execute as the command
|
|
9
|
-
*/
|
|
10
|
-
export async function runCommand(commandFn) {
|
|
11
|
-
intro(base44Color(" Base 44 "));
|
|
12
|
-
try {
|
|
13
|
-
await commandFn();
|
|
14
|
-
}
|
|
15
|
-
catch (e) {
|
|
16
|
-
if (e instanceof Error) {
|
|
17
|
-
log.error(e.stack ?? e.message);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
log.error(String(e));
|
|
21
|
-
}
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=runCommand.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;YACvB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;QAClC,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"}
|
|
@@ -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"}
|
package/dist/core/auth/api.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { DeviceCodeResponse, TokenResponse } from "./schema.js";
|
|
2
|
-
export declare function generateDeviceCode(): Promise<DeviceCodeResponse>;
|
|
3
|
-
export declare function getTokenFromDeviceCode(deviceCode: string): Promise<TokenResponse | null>;
|
|
4
|
-
export declare function renewAccessToken(refreshToken: string): Promise<TokenResponse>;
|
|
5
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/core/auth/api.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIrE,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAwBtE;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAgD/B;AAED,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,CAAC,CAoCxB"}
|
package/dist/core/auth/api.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { AuthApiError, AuthValidationError } from "../errors.js";
|
|
2
|
-
import { DeviceCodeResponseSchema, TokenResponseSchema, OAuthErrorSchema, } from "./schema.js";
|
|
3
|
-
import { AUTH_CLIENT_ID } from "../consts.js";
|
|
4
|
-
import authClient from "./authClient.js";
|
|
5
|
-
export async function generateDeviceCode() {
|
|
6
|
-
const response = await authClient.post("oauth/device/code", {
|
|
7
|
-
json: {
|
|
8
|
-
client_id: AUTH_CLIENT_ID,
|
|
9
|
-
scope: "apps:read apps:write",
|
|
10
|
-
},
|
|
11
|
-
throwHttpErrors: false,
|
|
12
|
-
});
|
|
13
|
-
if (!response.ok) {
|
|
14
|
-
throw new AuthApiError(`Failed to generate device code: ${response.status} ${response.statusText}`);
|
|
15
|
-
}
|
|
16
|
-
const result = DeviceCodeResponseSchema.safeParse(await response.json());
|
|
17
|
-
if (!result.success) {
|
|
18
|
-
throw new AuthValidationError(`Invalid device code response from server: ${result.error.message}`);
|
|
19
|
-
}
|
|
20
|
-
return result.data;
|
|
21
|
-
}
|
|
22
|
-
export async function getTokenFromDeviceCode(deviceCode) {
|
|
23
|
-
const searchParams = new URLSearchParams();
|
|
24
|
-
searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
|
|
25
|
-
searchParams.set("device_code", deviceCode);
|
|
26
|
-
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
27
|
-
const response = await authClient.post("oauth/token", {
|
|
28
|
-
body: searchParams.toString(),
|
|
29
|
-
headers: {
|
|
30
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
31
|
-
},
|
|
32
|
-
throwHttpErrors: false,
|
|
33
|
-
});
|
|
34
|
-
const json = await response.json();
|
|
35
|
-
if (!response.ok) {
|
|
36
|
-
const errorResult = OAuthErrorSchema.safeParse(json);
|
|
37
|
-
if (!errorResult.success) {
|
|
38
|
-
throw new AuthValidationError(`Token request failed: ${errorResult.error.message}`);
|
|
39
|
-
}
|
|
40
|
-
const { error, error_description } = errorResult.data;
|
|
41
|
-
// Polling states - user hasn't completed auth yet
|
|
42
|
-
if (error === "authorization_pending" || error === "slow_down") {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
// Actual errors
|
|
46
|
-
throw new AuthApiError(error_description ?? `OAuth error: ${error}`);
|
|
47
|
-
}
|
|
48
|
-
const result = TokenResponseSchema.safeParse(json);
|
|
49
|
-
if (!result.success) {
|
|
50
|
-
throw new AuthValidationError(`Invalid token response from server: ${result.error.message}`);
|
|
51
|
-
}
|
|
52
|
-
return result.data;
|
|
53
|
-
}
|
|
54
|
-
export async function renewAccessToken(refreshToken) {
|
|
55
|
-
const searchParams = new URLSearchParams();
|
|
56
|
-
searchParams.set("grant_type", "refresh_token");
|
|
57
|
-
searchParams.set("refresh_token", refreshToken);
|
|
58
|
-
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
59
|
-
const response = await authClient.post("oauth/token", {
|
|
60
|
-
body: searchParams.toString(),
|
|
61
|
-
headers: {
|
|
62
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
63
|
-
},
|
|
64
|
-
throwHttpErrors: false,
|
|
65
|
-
});
|
|
66
|
-
const json = await response.json();
|
|
67
|
-
if (!response.ok) {
|
|
68
|
-
const errorResult = OAuthErrorSchema.safeParse(json);
|
|
69
|
-
if (!errorResult.success) {
|
|
70
|
-
throw new AuthApiError(`Token refresh failed: ${response.statusText}`);
|
|
71
|
-
}
|
|
72
|
-
const { error, error_description } = errorResult.data;
|
|
73
|
-
throw new AuthApiError(error_description ?? `OAuth error: ${error}`);
|
|
74
|
-
}
|
|
75
|
-
const result = TokenResponseSchema.safeParse(json);
|
|
76
|
-
if (!result.success) {
|
|
77
|
-
throw new AuthValidationError(`Invalid token response from server: ${result.error.message}`);
|
|
78
|
-
}
|
|
79
|
-
return result.data;
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=api.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/core/auth/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,C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P,cAAc,EAAE,mCAAmC;SACpD;QACD,eAAe,EAAE,KAAK;KACvB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEnC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,WAAW,GAAG,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAErD,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YACzB,MAAM,IAAI,YAAY,CAAC,yBAAyB,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC;QACtD,MAAM,IAAI,YAAY,CAAC,iBAAiB,IAAI,gBAAgB,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAEnD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,mBAAmB,CAC3B,uCAAuC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAC9D,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authClient.d.ts","sourceRoot":"","sources":["../../../src/core/auth/authClient.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,QAAA,MAAM,UAAU,yBAKd,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import ky from "ky";
|
|
2
|
-
import { getBase44ApiUrl } from "../consts.js";
|
|
3
|
-
/**
|
|
4
|
-
* Separate ky instance for OAuth endpoints.
|
|
5
|
-
* These don't need Authorization headers (they use client_id + tokens in body).
|
|
6
|
-
*/
|
|
7
|
-
const authClient = ky.create({
|
|
8
|
-
prefixUrl: getBase44ApiUrl(),
|
|
9
|
-
headers: {
|
|
10
|
-
"User-Agent": "Base44 CLI",
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
export default authClient;
|
|
14
|
-
//# sourceMappingURL=authClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authClient.js","sourceRoot":"","sources":["../../../src/core/auth/authClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,GAAG,EAAE,CAAC,MAAM,CAAC;IAC3B,SAAS,EAAE,eAAe,EAAE;IAC5B,OAAO,EAAE;QACP,YAAY,EAAE,YAAY;KAC3B;CACF,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { AuthData } from "./schema.js";
|
|
2
|
-
export declare function readAuth(): Promise<AuthData>;
|
|
3
|
-
export declare function writeAuth(authData: AuthData): Promise<void>;
|
|
4
|
-
export declare function deleteAuth(): Promise<void>;
|
|
5
|
-
/**
|
|
6
|
-
* Checks if the access token is expired or about to expire.
|
|
7
|
-
*/
|
|
8
|
-
export declare function isTokenExpired(auth: AuthData): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Refreshes the access token and saves the new tokens.
|
|
11
|
-
* Returns the new access token, or null if refresh failed.
|
|
12
|
-
* Uses a lock to prevent concurrent refresh requests.
|
|
13
|
-
*/
|
|
14
|
-
export declare function refreshAndSaveTokens(): Promise<string | null>;
|
|
15
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/core/auth/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQ5C,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;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6BnE"}
|
package/dist/core/auth/config.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { getAuthFilePath } from "../consts.js";
|
|
2
|
-
import { readJsonFile, writeJsonFile, deleteFile } from "../utils/fs.js";
|
|
3
|
-
import { renewAccessToken } from "./api.js";
|
|
4
|
-
import { AuthDataSchema } from "./schema.js";
|
|
5
|
-
// Buffer time before expiration to trigger proactive refresh (60 seconds)
|
|
6
|
-
const TOKEN_REFRESH_BUFFER_MS = 60 * 1000;
|
|
7
|
-
// Lock to prevent concurrent token refreshes
|
|
8
|
-
let refreshPromise = null;
|
|
9
|
-
export async function readAuth() {
|
|
10
|
-
try {
|
|
11
|
-
const parsed = await readJsonFile(getAuthFilePath());
|
|
12
|
-
const result = AuthDataSchema.safeParse(parsed);
|
|
13
|
-
if (!result.success) {
|
|
14
|
-
throw new Error(`Invalid authentication data: ${result.error.issues
|
|
15
|
-
.map((e) => e.message)
|
|
16
|
-
.join(", ")}`);
|
|
17
|
-
}
|
|
18
|
-
return result.data;
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
if (error instanceof Error && error.message.includes("Authentication")) {
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
24
|
-
if (error instanceof Error && error.message.includes("File not found")) {
|
|
25
|
-
throw new Error("Authentication file not found. Please login first.");
|
|
26
|
-
}
|
|
27
|
-
throw new Error(`Failed to read authentication file: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export async function writeAuth(authData) {
|
|
31
|
-
const result = AuthDataSchema.safeParse(authData);
|
|
32
|
-
if (!result.success) {
|
|
33
|
-
throw new Error(`Invalid authentication data: ${result.error.issues
|
|
34
|
-
.map((e) => e.message)
|
|
35
|
-
.join(", ")}`);
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
await writeJsonFile(getAuthFilePath(), result.data);
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
throw new Error(`Failed to write authentication file: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export async function deleteAuth() {
|
|
45
|
-
try {
|
|
46
|
-
await deleteFile(getAuthFilePath());
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
throw new Error(`Failed to delete authentication file: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Checks if the access token is expired or about to expire.
|
|
54
|
-
*/
|
|
55
|
-
export function isTokenExpired(auth) {
|
|
56
|
-
return Date.now() >= auth.expiresAt - TOKEN_REFRESH_BUFFER_MS;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Refreshes the access token and saves the new tokens.
|
|
60
|
-
* Returns the new access token, or null if refresh failed.
|
|
61
|
-
* Uses a lock to prevent concurrent refresh requests.
|
|
62
|
-
*/
|
|
63
|
-
export async function refreshAndSaveTokens() {
|
|
64
|
-
// If a refresh is already in progress, wait for it
|
|
65
|
-
if (refreshPromise) {
|
|
66
|
-
return refreshPromise;
|
|
67
|
-
}
|
|
68
|
-
refreshPromise = (async () => {
|
|
69
|
-
try {
|
|
70
|
-
const auth = await readAuth();
|
|
71
|
-
const tokenResponse = await renewAccessToken(auth.refreshToken);
|
|
72
|
-
await writeAuth({
|
|
73
|
-
...auth,
|
|
74
|
-
accessToken: tokenResponse.accessToken,
|
|
75
|
-
refreshToken: tokenResponse.refreshToken,
|
|
76
|
-
expiresAt: Date.now() + tokenResponse.expiresIn * 1000,
|
|
77
|
-
});
|
|
78
|
-
return tokenResponse.accessToken;
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
// Refresh failed - delete auth, user needs to login again
|
|
82
|
-
await deleteAuth();
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
finally {
|
|
86
|
-
refreshPromise = null;
|
|
87
|
-
}
|
|
88
|
-
})();
|
|
89
|
-
return refreshPromise;
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/core/auth/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,0EAA0E;AAC1E,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1C,6CAA6C;AAC7C,IAAI,cAAc,GAAkC,IAAI,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,eAAe,EAAE,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAEhD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACb,gCAAgC,MAAM,CAAC,KAAK,CAAC,MAAM;iBAChD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;iBACrB,IAA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-1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
package/dist/core/auth/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const AuthDataSchema: z.ZodObject<{
|
|
3
|
-
accessToken: z.ZodString;
|
|
4
|
-
refreshToken: z.ZodString;
|
|
5
|
-
expiresAt: z.ZodNumber;
|
|
6
|
-
email: z.ZodEmail;
|
|
7
|
-
name: z.ZodString;
|
|
8
|
-
}, z.core.$strip>;
|
|
9
|
-
export type AuthData = z.infer<typeof AuthDataSchema>;
|
|
10
|
-
export declare const DeviceCodeResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
11
|
-
device_code: z.ZodString;
|
|
12
|
-
user_code: z.ZodString;
|
|
13
|
-
verification_uri: z.ZodURL;
|
|
14
|
-
verification_uri_complete: z.ZodURL;
|
|
15
|
-
expires_in: z.ZodNumber;
|
|
16
|
-
interval: z.ZodNumber;
|
|
17
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
18
|
-
deviceCode: string;
|
|
19
|
-
userCode: string;
|
|
20
|
-
verificationUri: string;
|
|
21
|
-
verificationUriComplete: string;
|
|
22
|
-
expiresIn: number;
|
|
23
|
-
interval: number;
|
|
24
|
-
}, {
|
|
25
|
-
device_code: string;
|
|
26
|
-
user_code: string;
|
|
27
|
-
verification_uri: string;
|
|
28
|
-
verification_uri_complete: string;
|
|
29
|
-
expires_in: number;
|
|
30
|
-
interval: number;
|
|
31
|
-
}>>;
|
|
32
|
-
export type DeviceCodeResponse = z.infer<typeof DeviceCodeResponseSchema>;
|
|
33
|
-
export declare const TokenResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
34
|
-
access_token: z.ZodString;
|
|
35
|
-
token_type: z.ZodString;
|
|
36
|
-
expires_in: z.ZodNumber;
|
|
37
|
-
refresh_token: z.ZodString;
|
|
38
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
39
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
40
|
-
accessToken: string;
|
|
41
|
-
tokenType: string;
|
|
42
|
-
expiresIn: number;
|
|
43
|
-
refreshToken: string;
|
|
44
|
-
scope: string | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
access_token: string;
|
|
47
|
-
token_type: string;
|
|
48
|
-
expires_in: number;
|
|
49
|
-
refresh_token: string;
|
|
50
|
-
scope?: string | undefined;
|
|
51
|
-
}>>;
|
|
52
|
-
export type TokenResponse = z.infer<typeof TokenResponseSchema>;
|
|
53
|
-
export declare const OAuthErrorSchema: z.ZodObject<{
|
|
54
|
-
error: z.ZodString;
|
|
55
|
-
error_description: z.ZodOptional<z.ZodString>;
|
|
56
|
-
}, z.core.$strip>;
|
|
57
|
-
export type OAuthError = z.infer<typeof OAuthErrorSchema>;
|
|
58
|
-
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/core/auth/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,cAAc;;;;;;iBAMzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAGtD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;GAsBhC,CAAC;AAEN,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;GAiB3B,CAAC;AAEN,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGhE,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/core/auth/schema.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
// Auth data schema (stored locally)
|
|
3
|
-
export const AuthDataSchema = z.object({
|
|
4
|
-
accessToken: z.string().min(1, "Token cannot be empty"),
|
|
5
|
-
refreshToken: z.string().min(1, "Refresh token cannot be empty"),
|
|
6
|
-
expiresAt: z.number().int().positive("Expires at must be a positive integer"),
|
|
7
|
-
email: z.email(),
|
|
8
|
-
name: z.string().min(1, "Name cannot be empty"),
|
|
9
|
-
});
|
|
10
|
-
// API response schemas
|
|
11
|
-
export const DeviceCodeResponseSchema = z
|
|
12
|
-
.object({
|
|
13
|
-
device_code: z.string().min(1, "Device code cannot be empty"),
|
|
14
|
-
user_code: z.string().min(1, "User code cannot be empty"),
|
|
15
|
-
verification_uri: z.url("Invalid verification URL"),
|
|
16
|
-
verification_uri_complete: z.url("Invalid complete verification URL"),
|
|
17
|
-
expires_in: z
|
|
18
|
-
.number()
|
|
19
|
-
.int()
|
|
20
|
-
.positive("Expires in must be a positive integer"),
|
|
21
|
-
interval: z
|
|
22
|
-
.number()
|
|
23
|
-
.int()
|
|
24
|
-
.positive("Interval in must be a positive integer"),
|
|
25
|
-
})
|
|
26
|
-
.transform((data) => ({
|
|
27
|
-
deviceCode: data.device_code,
|
|
28
|
-
userCode: data.user_code,
|
|
29
|
-
verificationUri: data.verification_uri,
|
|
30
|
-
verificationUriComplete: data.verification_uri_complete,
|
|
31
|
-
expiresIn: data.expires_in,
|
|
32
|
-
interval: data.interval,
|
|
33
|
-
}));
|
|
34
|
-
export const TokenResponseSchema = z
|
|
35
|
-
.object({
|
|
36
|
-
access_token: z.string().min(1, "Token cannot be empty"),
|
|
37
|
-
token_type: z.string().min(1, "Token type cannot be empty"),
|
|
38
|
-
expires_in: z
|
|
39
|
-
.number()
|
|
40
|
-
.int()
|
|
41
|
-
.positive("Expires in must be a positive integer"),
|
|
42
|
-
refresh_token: z.string().min(1, "Refresh token cannot be empty"),
|
|
43
|
-
scope: z.string().optional(),
|
|
44
|
-
})
|
|
45
|
-
.transform((data) => ({
|
|
46
|
-
accessToken: data.access_token,
|
|
47
|
-
tokenType: data.token_type,
|
|
48
|
-
expiresIn: data.expires_in,
|
|
49
|
-
refreshToken: data.refresh_token,
|
|
50
|
-
scope: data.scope,
|
|
51
|
-
}));
|
|
52
|
-
// OAuth error response schema
|
|
53
|
-
export const OAuthErrorSchema = z.object({
|
|
54
|
-
error: z.string(),
|
|
55
|
-
error_description: z.string().optional(),
|
|
56
|
-
});
|
|
57
|
-
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/core/auth/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oCAAoC;AACpC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IACvD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,+BAA+B,CAAC;IAChE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAC7E,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE;IAChB,IAAI,EAAE,CA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