better-auth-studio 1.0.79-beta.20 → 1.0.79-beta.21
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/public/assets/{main-6qxNhi40.js → main-C-eJoLJ_.js} +13 -13
- package/dist/public/index.html +1 -1
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +66 -5
- package/dist/routes.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{main-6qxNhi40.js → main-C-eJoLJ_.js} +13 -13
- package/public/index.html +1 -1
package/dist/public/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/png" href="/logo.png" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Better Auth Studio</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/main-
|
|
8
|
+
<script type="module" crossorigin src="/assets/main-C-eJoLJ_.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/main-C0mBl_hH.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAeA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAS9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAK9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AA2FnE,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAqLhG;AAeD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,GAAG,EACtB,oBAAoB,CA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A;KAAE,CAAC,CAAC;CAChE,CAAC,CA+FD"}
|
package/dist/routes.js
CHANGED
|
@@ -2181,8 +2181,7 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
|
|
|
2181
2181
|
const context = await authInstance.$context;
|
|
2182
2182
|
return context?.tables || null;
|
|
2183
2183
|
}
|
|
2184
|
-
catch (_error) {
|
|
2185
|
-
}
|
|
2184
|
+
catch (_error) { }
|
|
2186
2185
|
}
|
|
2187
2186
|
const authConfigPath = await resolveSchemaConfigPath();
|
|
2188
2187
|
if (!authConfigPath) {
|
|
@@ -2373,12 +2372,13 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
|
|
|
2373
2372
|
});
|
|
2374
2373
|
router.get('/api/plugins/teams/status', async (_req, res) => {
|
|
2375
2374
|
try {
|
|
2375
|
+
// Prioritize preloadedAuthOptions for self-hosted mode
|
|
2376
2376
|
const betterAuthConfig = preloadedAuthOptions || (await getAuthConfigSafe());
|
|
2377
2377
|
if (!betterAuthConfig) {
|
|
2378
2378
|
return res.json({
|
|
2379
2379
|
enabled: false,
|
|
2380
2380
|
error: 'No auth config found',
|
|
2381
|
-
configPath: null,
|
|
2381
|
+
configPath: isSelfHosted ? null : configPath || null,
|
|
2382
2382
|
});
|
|
2383
2383
|
}
|
|
2384
2384
|
const plugins = betterAuthConfig.plugins || [];
|
|
@@ -2387,14 +2387,14 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
|
|
|
2387
2387
|
const teamsEnabled = organizationPlugin.options?.teams?.enabled === true;
|
|
2388
2388
|
return res.json({
|
|
2389
2389
|
enabled: teamsEnabled,
|
|
2390
|
-
configPath: configPath || null,
|
|
2390
|
+
configPath: isSelfHosted ? null : configPath || null,
|
|
2391
2391
|
organizationPlugin: organizationPlugin || null,
|
|
2392
2392
|
});
|
|
2393
2393
|
}
|
|
2394
2394
|
else {
|
|
2395
2395
|
return res.json({
|
|
2396
2396
|
enabled: false,
|
|
2397
|
-
configPath: configPath || null,
|
|
2397
|
+
configPath: isSelfHosted ? null : configPath || null,
|
|
2398
2398
|
organizationPlugin: null,
|
|
2399
2399
|
error: 'Organization plugin not found',
|
|
2400
2400
|
});
|
|
@@ -2752,6 +2752,67 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
|
|
|
2752
2752
|
res.status(500).json({ error: 'Failed to create invitation' });
|
|
2753
2753
|
}
|
|
2754
2754
|
});
|
|
2755
|
+
router.get('/api/teams', async (req, res) => {
|
|
2756
|
+
try {
|
|
2757
|
+
const adapter = await getAuthAdapterWithConfig();
|
|
2758
|
+
if (adapter && typeof adapter.findMany === 'function') {
|
|
2759
|
+
try {
|
|
2760
|
+
const teams = await adapter.findMany({
|
|
2761
|
+
model: 'team',
|
|
2762
|
+
limit: 10000,
|
|
2763
|
+
});
|
|
2764
|
+
const transformedTeams = await Promise.all((teams || []).map(async (team) => {
|
|
2765
|
+
if (!adapter.findMany) {
|
|
2766
|
+
return null;
|
|
2767
|
+
}
|
|
2768
|
+
// Fetch organization details
|
|
2769
|
+
let organization = null;
|
|
2770
|
+
try {
|
|
2771
|
+
if (team.organizationId) {
|
|
2772
|
+
const orgs = await adapter.findMany({
|
|
2773
|
+
model: 'organization',
|
|
2774
|
+
where: [{ field: 'id', value: team.organizationId }],
|
|
2775
|
+
limit: 1,
|
|
2776
|
+
});
|
|
2777
|
+
organization = orgs && orgs.length > 0 ? orgs[0] : null;
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
catch (_error) { }
|
|
2781
|
+
// Fetch team members count
|
|
2782
|
+
const teamMembers = await adapter.findMany({
|
|
2783
|
+
model: 'teamMember',
|
|
2784
|
+
where: [{ field: 'teamId', value: team.id }],
|
|
2785
|
+
limit: 10000,
|
|
2786
|
+
});
|
|
2787
|
+
return {
|
|
2788
|
+
id: team.id,
|
|
2789
|
+
name: team.name,
|
|
2790
|
+
organizationId: team.organizationId,
|
|
2791
|
+
metadata: team.metadata,
|
|
2792
|
+
createdAt: team.createdAt,
|
|
2793
|
+
updatedAt: team.updatedAt,
|
|
2794
|
+
memberCount: teamMembers ? teamMembers.length : 0,
|
|
2795
|
+
organization: organization
|
|
2796
|
+
? {
|
|
2797
|
+
id: organization.id,
|
|
2798
|
+
name: organization.name,
|
|
2799
|
+
slug: organization.slug,
|
|
2800
|
+
}
|
|
2801
|
+
: null,
|
|
2802
|
+
};
|
|
2803
|
+
}));
|
|
2804
|
+
const validTeams = transformedTeams.filter((team) => team !== null);
|
|
2805
|
+
res.json({ success: true, teams: validTeams });
|
|
2806
|
+
return;
|
|
2807
|
+
}
|
|
2808
|
+
catch (_error) { }
|
|
2809
|
+
}
|
|
2810
|
+
res.json({ success: true, teams: [] });
|
|
2811
|
+
}
|
|
2812
|
+
catch (_error) {
|
|
2813
|
+
res.status(500).json({ error: 'Failed to fetch teams' });
|
|
2814
|
+
}
|
|
2815
|
+
});
|
|
2755
2816
|
router.get('/api/organizations/:orgId/teams', async (req, res) => {
|
|
2756
2817
|
try {
|
|
2757
2818
|
const { orgId } = req.params;
|