epicshop 6.85.2 → 6.85.4

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.
@@ -181,53 +181,48 @@ export async function login(options = {}) {
181
181
  reject(new Error('Device authorization timed out'));
182
182
  }, deviceResponse.expires_in * 1000);
183
183
  });
184
- try {
185
- const tokenSet = await Promise.race([
186
- client.pollDeviceAuthorizationGrant(config, deviceResponse),
187
- timeoutPromise,
188
- ]);
189
- if (!tokenSet) {
190
- const message = 'No token received from authorization';
191
- if (!silent) {
192
- console.error(chalk.red(`❌ ${message}`));
193
- }
194
- return { success: false, message };
195
- }
196
- const UserInfoSchema = z.object({
197
- id: z.string(),
198
- email: z.string(),
199
- name: z.string().nullable().optional(),
200
- });
201
- const protectedResourceResponse = await client.fetchProtectedResource(config, tokenSet.access_token, new URL(`${issuer}/userinfo`), 'GET');
202
- const userinfoRaw = await protectedResourceResponse.json();
203
- const userinfoResult = UserInfoSchema.safeParse(userinfoRaw);
204
- if (!userinfoResult.success) {
205
- const message = `Failed to parse user info: ${userinfoResult.error.message}`;
206
- if (!silent) {
207
- console.error(chalk.red(`❌ ${message}`));
208
- }
209
- return { success: false, message };
184
+ const tokenSet = await Promise.race([
185
+ client.pollDeviceAuthorizationGrant(config, deviceResponse),
186
+ timeoutPromise,
187
+ ]);
188
+ if (!tokenSet) {
189
+ const message = 'No token received from authorization';
190
+ if (!silent) {
191
+ console.error(chalk.red(`❌ ${message}`));
210
192
  }
211
- const userinfo = userinfoResult.data;
212
- await saveAuthData(domain.host, {
213
- id: userinfo.id,
214
- tokenSet: {
215
- access_token: tokenSet.access_token,
216
- token_type: tokenSet.token_type ?? 'Bearer',
217
- scope: tokenSet.scope ?? '',
218
- },
219
- email: userinfo.email,
220
- name: userinfo.name,
221
- });
193
+ return { success: false, message };
194
+ }
195
+ const UserInfoSchema = z.object({
196
+ id: z.string(),
197
+ email: z.string(),
198
+ name: z.string().nullable().optional(),
199
+ });
200
+ const protectedResourceResponse = await client.fetchProtectedResource(config, tokenSet.access_token, new URL(`${issuer}/userinfo`), 'GET');
201
+ const userinfoRaw = await protectedResourceResponse.json();
202
+ const userinfoResult = UserInfoSchema.safeParse(userinfoRaw);
203
+ if (!userinfoResult.success) {
204
+ const message = `Failed to parse user info: ${userinfoResult.error.message}`;
222
205
  if (!silent) {
223
- const name = userinfo.name ? ` (${userinfo.name})` : '';
224
- console.log(chalk.green(`\n✅ Successfully logged in to ${domain.displayName} as ${chalk.cyan(userinfo.email)}${name}`));
206
+ console.error(chalk.red(`❌ ${message}`));
225
207
  }
226
- return { success: true, message: `Logged in to ${domain.displayName}` };
208
+ return { success: false, message };
227
209
  }
228
- catch (error) {
229
- throw error;
210
+ const userinfo = userinfoResult.data;
211
+ await saveAuthData(domain.host, {
212
+ id: userinfo.id,
213
+ tokenSet: {
214
+ access_token: tokenSet.access_token,
215
+ token_type: tokenSet.token_type ?? 'Bearer',
216
+ scope: tokenSet.scope ?? '',
217
+ },
218
+ email: userinfo.email,
219
+ name: userinfo.name,
220
+ });
221
+ if (!silent) {
222
+ const name = userinfo.name ? ` (${userinfo.name})` : '';
223
+ console.log(chalk.green(`\n✅ Successfully logged in to ${domain.displayName} as ${chalk.cyan(userinfo.email)}${name}`));
230
224
  }
225
+ return { success: true, message: `Logged in to ${domain.displayName}` };
231
226
  }
232
227
  catch (error) {
233
228
  const message = error instanceof Error ? error.message : String(error);
@@ -1,4 +1,4 @@
1
- // eslint-disable-next-line import/order -- must appear first
1
+ // oxlint-disable-next-line import/order -- must appear first
2
2
  import { getEnv } from '@epic-web/workshop-utils/init-env';
3
3
  import { spawn, execSync } from 'node:child_process';
4
4
  import crypto from 'node:crypto';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epicshop",
3
- "version": "6.85.2",
3
+ "version": "6.85.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -99,13 +99,13 @@
99
99
  "test": "vitest run",
100
100
  "test:watch": "vitest",
101
101
  "typecheck": "tsc --noEmit",
102
- "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
102
+ "lint": "oxlint .",
103
103
  "build": "zshy",
104
104
  "postbuild": "node fix-bin.js",
105
105
  "build:watch": "nx watch --projects=epicshop -- nx run \\$NX_PROJECT_NAME:build"
106
106
  },
107
107
  "dependencies": {
108
- "@epic-web/workshop-utils": "6.85.2",
108
+ "@epic-web/workshop-utils": "6.85.4",
109
109
  "@inquirer/prompts": "^8.2.0",
110
110
  "@sentry/node": "^10.38.0",
111
111
  "chalk": "^5.6.2",
@@ -119,7 +119,7 @@
119
119
  "yargs": "^18.0.0"
120
120
  },
121
121
  "devDependencies": {
122
- "@epic-web/config": "^1.24.0",
122
+ "@epic-web/config": "^1.24.1",
123
123
  "@types/node": "^25.2.3",
124
124
  "@types/yargs": "^17.0.35",
125
125
  "vitest": "^4.0.18",