better-auth-studio 1.0.79-beta.26 → 1.0.79-beta.28

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.
@@ -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-B68uy0QR.js"></script>
8
+ <script type="module" crossorigin src="/assets/main-QUIVxdLh.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/main-C0mBl_hH.css">
10
10
  </head>
11
11
  <body>
@@ -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,CAAC,EAAE,GAAG,EAC1B,YAAY,CAAC,EAAE,kBAAkB,EACjC,YAAY,CAAC,EAAE,GAAG,GACjB,MAAM,CAo6LR;AAED,wBAAsB,sBAAsB,CAAC,GAAG,EAAE;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,GAAG,CAAC;I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,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,GAAG,OAAO,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;CAChE,CAAC,CA+FD"}
package/dist/routes.js CHANGED
@@ -2396,7 +2396,8 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
2396
2396
  else if (organizationPlugin.config?.teams?.enabled === true) {
2397
2397
  teamsEnabled = true;
2398
2398
  }
2399
- else if (organizationPlugin.options?.teams && typeof organizationPlugin.options.teams === 'object') {
2399
+ else if (organizationPlugin.options?.teams &&
2400
+ typeof organizationPlugin.options.teams === 'object') {
2400
2401
  teamsEnabled = organizationPlugin.options.teams.enabled === true;
2401
2402
  }
2402
2403
  else if (organizationPlugin.teams && typeof organizationPlugin.teams === 'object') {
@@ -2779,14 +2780,14 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
2779
2780
  return res.status(500).json({
2780
2781
  success: false,
2781
2782
  error: 'Auth adapter not available',
2782
- teams: []
2783
+ teams: [],
2783
2784
  });
2784
2785
  }
2785
2786
  if (typeof adapter.findMany !== 'function') {
2786
2787
  return res.status(500).json({
2787
2788
  success: false,
2788
2789
  error: 'Adapter findMany method not available',
2789
- teams: []
2790
+ teams: [],
2790
2791
  });
2791
2792
  }
2792
2793
  try {
@@ -2845,21 +2846,18 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
2845
2846
  return res.json({ success: true, teams: validTeams });
2846
2847
  }
2847
2848
  catch (error) {
2848
- // Log the error for debugging but return empty array
2849
- console.error('[Studio] Error fetching teams:', error?.message || error);
2850
2849
  return res.json({
2851
2850
  success: true,
2852
2851
  teams: [],
2853
- error: error?.message || 'Failed to fetch teams'
2852
+ error: error?.message || 'Failed to fetch teams',
2854
2853
  });
2855
2854
  }
2856
2855
  }
2857
2856
  catch (error) {
2858
- console.error('[Studio] Error in /api/organizations/:orgId/teams:', error?.message || error);
2859
2857
  res.status(500).json({
2860
2858
  success: false,
2861
2859
  error: 'Failed to fetch teams',
2862
- message: error?.message || 'Unknown error'
2860
+ message: error?.message || 'Unknown error',
2863
2861
  });
2864
2862
  }
2865
2863
  });
@@ -2885,7 +2883,7 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
2885
2883
  if (!adapter.create) {
2886
2884
  return res.status(500).json({ error: 'Adapter create method not available' });
2887
2885
  }
2888
- await adapter.create({
2886
+ const teamResult = await adapter.create({
2889
2887
  model: 'team',
2890
2888
  data: {
2891
2889
  name: teamData.name,
@@ -2894,6 +2892,9 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
2894
2892
  updatedAt: teamData.updatedAt,
2895
2893
  },
2896
2894
  });
2895
+ if (!teamResult) {
2896
+ return res.status(500).json({ error: 'Failed to create team' });
2897
+ }
2897
2898
  res.json({ success: true, team });
2898
2899
  }
2899
2900
  catch (_error) {
@@ -2986,7 +2987,7 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
2986
2987
  existingMember = existing && existing.length > 0 ? existing[0] : null;
2987
2988
  }
2988
2989
  catch (_findError) {
2989
- // if where clause isn't working.
2990
+ // if where clause isn't working.
2990
2991
  try {
2991
2992
  const allMembers = await adapter.findMany({
2992
2993
  model: 'teamMember',
@@ -2994,8 +2995,7 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
2994
2995
  });
2995
2996
  existingMember = (allMembers || []).find((m) => m.teamId === teamId && m.userId === userId);
2996
2997
  }
2997
- catch (_fallbackError) {
2998
- }
2998
+ catch (_fallbackError) { }
2999
2999
  }
3000
3000
  }
3001
3001
  if (existingMember) {
@@ -3030,7 +3030,7 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
3030
3030
  }
3031
3031
  const successCount = results.filter((r) => r.success).length;
3032
3032
  res.json({
3033
- success: true,
3033
+ success: results.some((r) => r.success),
3034
3034
  message: `Added ${successCount} member${successCount !== 1 ? 's' : ''}`,
3035
3035
  results,
3036
3036
  });
@@ -3039,7 +3039,7 @@ export function createRoutes(authConfig, configPath, geoDbPath, preloadedAdapter
3039
3039
  res.status(500).json({
3040
3040
  success: false,
3041
3041
  error: 'Failed to add team members',
3042
- message: error?.message || 'Unknown error'
3042
+ message: error?.message || 'Unknown error',
3043
3043
  });
3044
3044
  }
3045
3045
  });