@ncukondo/gcal-cli 0.2.1 → 0.2.2
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/index.js +9 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -587718,7 +587718,7 @@ function errorCodeToExitCode(code) {
|
|
|
587718
587718
|
// package.json
|
|
587719
587719
|
var package_default = {
|
|
587720
587720
|
name: "@ncukondo/gcal-cli",
|
|
587721
|
-
version: "0.2.
|
|
587721
|
+
version: "0.2.2",
|
|
587722
587722
|
type: "module",
|
|
587723
587723
|
exports: {
|
|
587724
587724
|
".": "./dist/index.js"
|
|
@@ -587989,7 +587989,8 @@ async function getAuthenticatedClient(fs, fetchFn = globalThis.fetch) {
|
|
|
587989
587989
|
}
|
|
587990
587990
|
var OAUTH_SCOPES = [
|
|
587991
587991
|
"https://www.googleapis.com/auth/calendar.readonly",
|
|
587992
|
-
"https://www.googleapis.com/auth/calendar.events"
|
|
587992
|
+
"https://www.googleapis.com/auth/calendar.events",
|
|
587993
|
+
"email"
|
|
587993
587994
|
];
|
|
587994
587995
|
async function startOAuthFlow(credentials, fs, fetchFn = globalThis.fetch) {
|
|
587995
587996
|
return new Promise((resolve) => {
|
|
@@ -588145,15 +588146,20 @@ async function handleAuthStatus(opts) {
|
|
|
588145
588146
|
}
|
|
588146
588147
|
const email2 = await fetchUserEmail(currentTokens.access_token, fetchFn);
|
|
588147
588148
|
const expiresAt = new Date(currentTokens.expiry_date);
|
|
588149
|
+
const reAuthHint = "Run `gcal auth --logout` then `gcal auth` to re-authenticate with updated permissions.";
|
|
588148
588150
|
if (format === "json") {
|
|
588149
588151
|
write(formatJsonSuccess({
|
|
588150
588152
|
authenticated: true,
|
|
588151
588153
|
email: email2,
|
|
588152
|
-
expires_at: expiresAt.toISOString()
|
|
588154
|
+
expires_at: expiresAt.toISOString(),
|
|
588155
|
+
...email2 == null ? { hint: reAuthHint } : {}
|
|
588153
588156
|
}));
|
|
588154
588157
|
} else {
|
|
588155
588158
|
write(`Authenticated as: ${email2 ?? "unknown"}`);
|
|
588156
588159
|
write(`Token expires: ${expiresAt.toISOString()}`);
|
|
588160
|
+
if (email2 == null) {
|
|
588161
|
+
write(reAuthHint);
|
|
588162
|
+
}
|
|
588157
588163
|
}
|
|
588158
588164
|
return { exitCode: ExitCode.SUCCESS };
|
|
588159
588165
|
}
|