better-auth-studio 1.0.45-beta.1 → 1.0.45-beta.3
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/routes.d.ts.map +1 -1
- package/dist/routes.js +72 -0
- package/dist/routes.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/main-B5vEtB6K.js +698 -0
- package/public/assets/main-B9YFvJgD.css +1 -0
- package/public/index.html +2 -2
- package/public/assets/main-BVw839VB.js +0 -698
- package/public/assets/main-BxbyhGfe.css +0 -1
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAMA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAS9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA8D9C,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CA8I/E;AAwBD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAMA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAS9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA8D9C,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CA8I/E;AAwBD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAuqHR"}
|
package/dist/routes.js
CHANGED
|
@@ -1245,6 +1245,78 @@ export function createRoutes(authConfig, configPath, geoDbPath) {
|
|
|
1245
1245
|
});
|
|
1246
1246
|
}
|
|
1247
1247
|
});
|
|
1248
|
+
router.post('/api/tools/health-check', async (_req, res) => {
|
|
1249
|
+
try {
|
|
1250
|
+
const baseUrl = authConfig.baseURL?.replace(/\/$/, '') ||
|
|
1251
|
+
process.env.BETTER_AUTH_URL?.replace(/\/$/, '') ||
|
|
1252
|
+
'http://localhost:3000';
|
|
1253
|
+
const basePathRaw = authConfig.basePath || '/api/auth';
|
|
1254
|
+
const basePath = basePathRaw === '/' ? '' : basePathRaw.startsWith('/') ? basePathRaw : `/${basePathRaw}`;
|
|
1255
|
+
const endpointChecks = [
|
|
1256
|
+
{ label: 'Sign In', method: 'OPTIONS', path: '/sign-in/email' },
|
|
1257
|
+
{ label: 'Sign Up', method: 'OPTIONS', path: '/sign-up/email' },
|
|
1258
|
+
];
|
|
1259
|
+
const checks = await Promise.all(endpointChecks.map(async (check) => {
|
|
1260
|
+
const targetUrl = `${baseUrl}${basePath}${check.path}`;
|
|
1261
|
+
try {
|
|
1262
|
+
const response = await fetch(targetUrl, {
|
|
1263
|
+
method: check.method,
|
|
1264
|
+
});
|
|
1265
|
+
const ok = response.status < 500 && response.status !== 404;
|
|
1266
|
+
if (!ok) {
|
|
1267
|
+
return {
|
|
1268
|
+
label: check.label,
|
|
1269
|
+
endpoint: check.path,
|
|
1270
|
+
ok: false,
|
|
1271
|
+
status: response.status,
|
|
1272
|
+
error: response.statusText,
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1275
|
+
return {
|
|
1276
|
+
label: check.label,
|
|
1277
|
+
endpoint: check.path,
|
|
1278
|
+
ok,
|
|
1279
|
+
status: response.status,
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
catch (error) {
|
|
1283
|
+
return {
|
|
1284
|
+
label: check.label,
|
|
1285
|
+
endpoint: check.path,
|
|
1286
|
+
ok: false,
|
|
1287
|
+
status: null,
|
|
1288
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
}));
|
|
1292
|
+
const allPassed = checks.every((check) => check.ok);
|
|
1293
|
+
const failedChecks = checks.filter((check) => !check.ok);
|
|
1294
|
+
if (allPassed) {
|
|
1295
|
+
res.json({
|
|
1296
|
+
success: true,
|
|
1297
|
+
message: 'All Better Auth endpoints are healthy',
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
else {
|
|
1301
|
+
res.json({
|
|
1302
|
+
success: false,
|
|
1303
|
+
message: 'Some Better Auth endpoints failed health checks',
|
|
1304
|
+
failedEndpoints: failedChecks.map((check) => ({
|
|
1305
|
+
endpoint: check.endpoint,
|
|
1306
|
+
status: check.status,
|
|
1307
|
+
error: check.error,
|
|
1308
|
+
})),
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
catch (error) {
|
|
1313
|
+
res.status(500).json({
|
|
1314
|
+
success: false,
|
|
1315
|
+
error: 'Health check failed',
|
|
1316
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
});
|
|
1248
1320
|
// Database Detection endpoint - Auto-detect database from installed packages
|
|
1249
1321
|
router.get('/api/database/detect', async (_req, res) => {
|
|
1250
1322
|
try {
|