@plaud-ai/cli 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +14 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -128,8 +128,12 @@ var OAuth = class {
128
128
  return null;
129
129
  if (tokenSet.expires_at && Date.now() > tokenSet.expires_at - 6e4) {
130
130
  if (tokenSet.refresh_token) {
131
- const refreshed = await this.refresh(tokenSet.refresh_token);
132
- return refreshed.access_token;
131
+ try {
132
+ const refreshed = await this.refresh(tokenSet.refresh_token);
133
+ return refreshed.access_token;
134
+ } catch {
135
+ return null;
136
+ }
133
137
  }
134
138
  return null;
135
139
  }
@@ -261,10 +265,14 @@ var CORS_HEADERS = {
261
265
  };
262
266
  var loginCommand = new Command("login").description("Authenticate with Plaud via OAuth").action(async () => {
263
267
  const client2 = getClient();
264
- const token = await client2.auth.getAccessToken();
265
- if (token) {
266
- console.log(chalk.yellow("Already logged in. Run `plaud logout` first to switch accounts."));
267
- return;
268
+ try {
269
+ const token = await client2.auth.getAccessToken();
270
+ if (token) {
271
+ console.log(chalk.yellow("Already logged in. Run `plaud logout` first to switch accounts."));
272
+ return;
273
+ }
274
+ } catch {
275
+ await client2.auth.logout();
268
276
  }
269
277
  const { url, codeVerifier } = client2.auth.createAuthorizationRequest();
270
278
  const spinner = ora("Waiting for browser authentication...").start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaud-ai/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "plaud": "dist/index.js"