@base44-preview/cli 0.0.2-pr.23.6657a26 → 0.0.3-pr.28.837cbfa
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 +37 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -18389,6 +18389,38 @@ async function refreshAndSaveTokens() {
|
|
|
18389
18389
|
})();
|
|
18390
18390
|
return refreshPromise;
|
|
18391
18391
|
}
|
|
18392
|
+
/**
|
|
18393
|
+
* Checks if the user is currently logged in.
|
|
18394
|
+
*
|
|
18395
|
+
* @returns True if authentication data exists and is valid, false otherwise.
|
|
18396
|
+
*
|
|
18397
|
+
* @example
|
|
18398
|
+
* if (await isLoggedIn()) {
|
|
18399
|
+
* console.log("User is logged in");
|
|
18400
|
+
* } else {
|
|
18401
|
+
* console.log("Please login first");
|
|
18402
|
+
* }
|
|
18403
|
+
*/
|
|
18404
|
+
async function isLoggedIn() {
|
|
18405
|
+
try {
|
|
18406
|
+
await readAuth();
|
|
18407
|
+
return true;
|
|
18408
|
+
} catch {
|
|
18409
|
+
return false;
|
|
18410
|
+
}
|
|
18411
|
+
}
|
|
18412
|
+
/**
|
|
18413
|
+
* Ensures the user is logged in before proceeding.
|
|
18414
|
+
*
|
|
18415
|
+
* @throws {Error} If the user is not logged in.
|
|
18416
|
+
*
|
|
18417
|
+
* @example
|
|
18418
|
+
* await requireAuth();
|
|
18419
|
+
* // Code here will only run if user is authenticated
|
|
18420
|
+
*/
|
|
18421
|
+
async function requireAuth() {
|
|
18422
|
+
if (!await isLoggedIn()) throw new Error("Not logged in. Please run 'base44 login' first.");
|
|
18423
|
+
}
|
|
18392
18424
|
|
|
18393
18425
|
//#endregion
|
|
18394
18426
|
//#region src/core/clients/base44-client.ts
|
|
@@ -18671,6 +18703,7 @@ const loginCommand = new Command("login").description("Authenticate with Base44"
|
|
|
18671
18703
|
//#endregion
|
|
18672
18704
|
//#region src/cli/commands/auth/whoami.ts
|
|
18673
18705
|
async function whoami() {
|
|
18706
|
+
await requireAuth();
|
|
18674
18707
|
const auth = await readAuth();
|
|
18675
18708
|
M.info(`Logged in as: ${auth.name} (${auth.email})`);
|
|
18676
18709
|
}
|
|
@@ -18681,6 +18714,7 @@ const whoamiCommand = new Command("whoami").description("Display current authent
|
|
|
18681
18714
|
//#endregion
|
|
18682
18715
|
//#region src/cli/commands/auth/logout.ts
|
|
18683
18716
|
async function logout() {
|
|
18717
|
+
await requireAuth();
|
|
18684
18718
|
await deleteAuth();
|
|
18685
18719
|
M.info("Logged out successfully");
|
|
18686
18720
|
}
|
|
@@ -18707,6 +18741,7 @@ const showProjectCommand = new Command("show-project").description("Display proj
|
|
|
18707
18741
|
//#endregion
|
|
18708
18742
|
//#region src/cli/commands/entities/push.ts
|
|
18709
18743
|
async function pushEntitiesAction() {
|
|
18744
|
+
await requireAuth();
|
|
18710
18745
|
const { entities } = await readProjectConfig();
|
|
18711
18746
|
if (entities.length === 0) {
|
|
18712
18747
|
M.warn("No entities found in project");
|
|
@@ -19240,6 +19275,7 @@ var require_lodash = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19240
19275
|
//#region src/cli/commands/project/create.ts
|
|
19241
19276
|
var import_lodash = /* @__PURE__ */ __toESM(require_lodash(), 1);
|
|
19242
19277
|
async function create() {
|
|
19278
|
+
await requireAuth();
|
|
19243
19279
|
const templateOptions = (await listTemplates()).map((t) => ({
|
|
19244
19280
|
value: t,
|
|
19245
19281
|
label: t.name,
|
|
@@ -19291,7 +19327,7 @@ const createCommand = new Command("create").description("Create a new Base44 pro
|
|
|
19291
19327
|
|
|
19292
19328
|
//#endregion
|
|
19293
19329
|
//#region package.json
|
|
19294
|
-
var version = "0.0.
|
|
19330
|
+
var version = "0.0.3";
|
|
19295
19331
|
|
|
19296
19332
|
//#endregion
|
|
19297
19333
|
//#region src/cli/index.ts
|
package/package.json
CHANGED