epicshop 6.85.3 → 6.85.5
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/commands/auth.js +37 -42
- package/dist/commands/start.js +1 -1
- package/dist/commands/warm.js +2 -2
- package/package.json +4 -4
package/dist/commands/auth.js
CHANGED
|
@@ -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
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
|
|
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:
|
|
208
|
+
return { success: false, message };
|
|
227
209
|
}
|
|
228
|
-
|
|
229
|
-
|
|
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);
|
package/dist/commands/start.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
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/dist/commands/warm.js
CHANGED
|
@@ -9,7 +9,7 @@ export async function warm({ silent = false, } = {}) {
|
|
|
9
9
|
}
|
|
10
10
|
try {
|
|
11
11
|
const { getApps, isProblemApp, isSolutionApp } = await import('@epic-web/workshop-utils/apps.server');
|
|
12
|
-
const { getDiffFiles,
|
|
12
|
+
const { getDiffFiles, getDiffPatch } = await import('@epic-web/workshop-utils/diff.server');
|
|
13
13
|
const { warmCache: warmEpicAPICache } = await import('@epic-web/workshop-utils/epic-api.server');
|
|
14
14
|
void warmEpicAPICache().catch(() => { }); // ignore failure
|
|
15
15
|
// Warm up the apps cache
|
|
@@ -34,7 +34,7 @@ export async function warm({ silent = false, } = {}) {
|
|
|
34
34
|
if (solutionApp) {
|
|
35
35
|
const pairName = `${problemApp.exerciseNumber.toString().padStart(2, '0')}.${problemApp.stepNumber.toString().padStart(2, '0')}.problem vs ${solutionApp.exerciseNumber.toString().padStart(2, '0')}.${solutionApp.stepNumber.toString().padStart(2, '0')}.solution`;
|
|
36
36
|
try {
|
|
37
|
-
await
|
|
37
|
+
await getDiffPatch(problemApp, solutionApp);
|
|
38
38
|
await getDiffFiles(problemApp, solutionApp);
|
|
39
39
|
diffCount++;
|
|
40
40
|
if (!silent) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "epicshop",
|
|
3
|
-
"version": "6.85.
|
|
3
|
+
"version": "6.85.5",
|
|
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": "
|
|
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.
|
|
108
|
+
"@epic-web/workshop-utils": "6.85.5",
|
|
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.
|
|
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",
|