@base44-preview/cli 0.0.54-pr.538.77dd117 → 0.0.54-pr.538.7e2f1d6
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 +17 -16
- package/dist/cli/index.js.map +4 -4
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -235165,28 +235165,27 @@ function decodeJwtClaims(token) {
|
|
|
235165
235165
|
return null;
|
|
235166
235166
|
}
|
|
235167
235167
|
}
|
|
235168
|
-
|
|
235168
|
+
function readEnvAuth() {
|
|
235169
235169
|
const accessToken = process.env.BASE44_ACCESS_TOKEN;
|
|
235170
235170
|
if (!accessToken) {
|
|
235171
|
-
return
|
|
235171
|
+
return null;
|
|
235172
235172
|
}
|
|
235173
|
-
const refreshToken = process.env.BASE44_REFRESH_TOKEN;
|
|
235174
235173
|
const claims = decodeJwtClaims(accessToken);
|
|
235175
|
-
const sub = typeof claims?.sub === "string" ? claims.sub :
|
|
235176
|
-
const exp = typeof claims?.exp === "number" ? claims.exp :
|
|
235177
|
-
|
|
235178
|
-
return false;
|
|
235179
|
-
}
|
|
235180
|
-
await writeAuth({
|
|
235174
|
+
const sub = typeof claims?.sub === "string" ? claims.sub : "";
|
|
235175
|
+
const exp = typeof claims?.exp === "number" ? claims.exp : null;
|
|
235176
|
+
return {
|
|
235181
235177
|
accessToken,
|
|
235182
|
-
refreshToken,
|
|
235183
|
-
expiresAt: exp * 1000,
|
|
235178
|
+
refreshToken: process.env.BASE44_REFRESH_TOKEN ?? "",
|
|
235179
|
+
expiresAt: exp !== null ? exp * 1000 : Number.POSITIVE_INFINITY,
|
|
235184
235180
|
email: sub,
|
|
235185
|
-
name:
|
|
235186
|
-
}
|
|
235187
|
-
return true;
|
|
235181
|
+
name: ""
|
|
235182
|
+
};
|
|
235188
235183
|
}
|
|
235189
235184
|
async function readAuth() {
|
|
235185
|
+
const envAuth = readEnvAuth();
|
|
235186
|
+
if (envAuth) {
|
|
235187
|
+
return envAuth;
|
|
235188
|
+
}
|
|
235190
235189
|
try {
|
|
235191
235190
|
const authData = await readJsonFile(getAuthFilePath());
|
|
235192
235191
|
const result = AuthDataSchema.safeParse(authData);
|
|
@@ -235223,6 +235222,9 @@ function isTokenExpired(auth) {
|
|
|
235223
235222
|
return Date.now() >= auth.expiresAt - TOKEN_REFRESH_BUFFER_MS;
|
|
235224
235223
|
}
|
|
235225
235224
|
async function refreshAndSaveTokens() {
|
|
235225
|
+
if (readEnvAuth()) {
|
|
235226
|
+
return null;
|
|
235227
|
+
}
|
|
235226
235228
|
if (refreshPromise) {
|
|
235227
235229
|
return refreshPromise;
|
|
235228
235230
|
}
|
|
@@ -244422,7 +244424,6 @@ async function login({
|
|
|
244422
244424
|
|
|
244423
244425
|
// src/cli/utils/command/middleware.ts
|
|
244424
244426
|
async function ensureAuth(ctx) {
|
|
244425
|
-
await seedAuthFromEnv();
|
|
244426
244427
|
const loggedIn = await isLoggedIn();
|
|
244427
244428
|
if (!loggedIn) {
|
|
244428
244429
|
ctx.log.info("You need to login first to continue.");
|
|
@@ -261822,4 +261823,4 @@ export {
|
|
|
261822
261823
|
CLIExitError
|
|
261823
261824
|
};
|
|
261824
261825
|
|
|
261825
|
-
//# debugId=
|
|
261826
|
+
//# debugId=B453E5669D23DDA064756E2164756E21
|