@ncukondo/gcal-cli 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -3
  2. 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.0",
587721
+ version: "0.2.1",
587722
587722
  type: "module",
587723
587723
  exports: {
587724
587724
  ".": "./dist/index.js"
@@ -588135,8 +588135,16 @@ async function handleAuthStatus(opts) {
588135
588135
  }
588136
588136
  return { exitCode: ExitCode.AUTH };
588137
588137
  }
588138
- const email2 = await fetchUserEmail(tokens.access_token, fetchFn);
588139
- const expiresAt = new Date(tokens.expiry_date);
588138
+ let currentTokens = tokens;
588139
+ if (isTokenExpired(tokens.expiry_date)) {
588140
+ try {
588141
+ const credentials = getClientCredentials(fs);
588142
+ currentTokens = await refreshAccessToken(credentials, tokens, fetchFn);
588143
+ saveTokens(fs, currentTokens);
588144
+ } catch {}
588145
+ }
588146
+ const email2 = await fetchUserEmail(currentTokens.access_token, fetchFn);
588147
+ const expiresAt = new Date(currentTokens.expiry_date);
588140
588148
  if (format === "json") {
588141
588149
  write(formatJsonSuccess({
588142
588150
  authenticated: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ncukondo/gcal-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dist/index.js"