@mframework/adapter-betterauth 0.0.8 → 0.0.10

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { setAuthAdapter } from '@mframework/sdk';
1
+ import { setAuthAdapter } from '@mframework/core';
2
2
  import { createAuthTransport } from './src/transport';
3
3
  import { createAuthAdapter } from './src/auth';
4
4
  export const installAuthAdapter = (config) => {
@@ -1,2 +1,2 @@
1
- import type { AuthAdapter, TransportAdapter } from '@mframework/sdk';
1
+ import type { AuthAdapter, TransportAdapter } from '@mframework/core';
2
2
  export declare const createAuthAdapter: (transport: TransportAdapter) => AuthAdapter;
package/dist/src/auth.js CHANGED
@@ -1,4 +1,4 @@
1
- import { unwrap } from './utils';
1
+ import { unwrap } from './utils.js';
2
2
  export const createAuthAdapter = (transport) => ({
3
3
  async login(input) {
4
4
  const res = await transport.request('POST', '/login', {
@@ -1,7 +1,7 @@
1
1
  import "dotenv/config";
2
2
  import { betterAuth } from "better-auth";
3
3
  import { prismaAdapter } from "better-auth/adapters/prisma";
4
- import { prisma } from "@mframework/api";
4
+ import { prisma } from "@mframework/core";
5
5
  // Create and export the BetterAuth runtime instance using the centralized
6
6
  // Prisma client exported from packages/modules/api. Layers can import `auth`
7
7
  // from this package to get the configured auth instance.
@@ -1,6 +1,6 @@
1
1
  import * as BetterAuth from 'better-auth';
2
- import { getAuthConfig } from './config';
3
- import { getFrameworkContext } from './framework';
2
+ import { getAuthConfig } from './config.js';
3
+ import { getFrameworkContext } from './framework.js';
4
4
  // Create a single shared Better Auth client instance
5
5
  let client = null;
6
6
  function resolveClientFactory() {
@@ -1,4 +1,4 @@
1
- import type { AuthProvider } from './types';
1
+ import type { AuthProvider } from './types.js';
2
2
  export declare function registerAuthProvider(name: string, provider: AuthProvider): void;
3
3
  export declare function setActiveAuthProvider(name: string): void;
4
4
  export declare function getAuthProvider(): AuthProvider;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@mframework/adapter-betterauth",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Official Better-Auth adapter for M Framework Auth Layer",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "dist/src/index.js",
6
+ "types": "dist/src/index.d.ts",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
9
  "build": "tsc -p tsconfig.json",
@@ -29,9 +29,7 @@
29
29
  "@better-auth/scim": "^1.4.15",
30
30
  "@better-auth/sso": "^1.4.12",
31
31
  "@better-auth/stripe": "^1.4.15",
32
- "@mframework/api": "^0.0.1",
33
- "@mframework/core": "^0.0.1",
34
- "@mframework/sdk": "^0.0.2",
32
+ "@mframework/core": "^0.0.2",
35
33
  "@polar-sh/better-auth": "^1.6.3",
36
34
  "better-auth": "^1.4.12",
37
35
  "typescript": "^5.9.3"
package/src/auth.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type {
2
2
  AuthAdapter,
3
3
  TransportAdapter
4
- } from '@mframework/sdk'
4
+ } from '@mframework/core'
5
5
 
6
6
  import type {
7
7
  LoginInput,
@@ -11,7 +11,7 @@ import type {
11
11
  User
12
12
  } from '@mframework/core'
13
13
 
14
- import { unwrap } from './utils'
14
+ import { unwrap } from './utils.js'
15
15
 
16
16
  export const createAuthAdapter = (
17
17
  transport: TransportAdapter
package/src/betterauth.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import "dotenv/config"
2
2
  import { betterAuth } from "better-auth"
3
3
  import { prismaAdapter } from "better-auth/adapters/prisma"
4
- import { prisma } from "@mframework/api"
4
+ import { prisma } from "@mframework/core"
5
5
 
6
6
  // Create and export the BetterAuth runtime instance using the centralized
7
7
  // Prisma client exported from packages/modules/api. Layers can import `auth`
package/src/index.ts ADDED
@@ -0,0 +1,38 @@
1
+ import {
2
+ setAuthAdapter
3
+ } from '@mframework/core'
4
+
5
+ import { createAuthTransport } from './transport'
6
+ import { createAuthAdapter } from './auth'
7
+
8
+ export const installAuthAdapter = (config: { baseUrl: string; apiKey?: string }) => {
9
+ const transport = createAuthTransport(config)
10
+
11
+ setAuthAdapter(createAuthAdapter(transport))
12
+ }
13
+
14
+ // Export the server-side BetterAuth instance (if present) so other layers can
15
+ // import the runtime `auth` instance from this package. The file is optional
16
+ // and will only exist when BetterAuth is configured for the adapter.
17
+ export { auth, Auth } from './betterauth'
18
+ export { default as BetterAuthProvider } from './provider'
19
+ export { getAuthPlugins } from './plugins'
20
+
21
+ export * from './types'
22
+ export * from './auth'
23
+ export * from './utils'
24
+ export * from './transport'
25
+ export * from './framework'
26
+ export * from './registry'
27
+ export * from './validation'
28
+ export * from './config'
29
+ export * from 'better-auth/client/plugins'
30
+ export * from '@polar-sh/better-auth'
31
+ export * as BetterAuth from 'better-auth'
32
+ export { getAuthConfig } from './config'
33
+ export { getFrameworkContext } from './framework'
34
+ export type { AuthProvider } from './types'
35
+ export { registerAuthProvider } from './registry'
36
+ export { polarClient } from '@polar-sh/better-auth'
37
+ export { adminClient, inferAdditionalFields } from 'better-auth/client/plugins'
38
+ export { stripeClient } from '@better-auth/stripe/client'
package/src/provider.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as BetterAuth from 'better-auth'
2
- import { getAuthConfig } from './config'
3
- import { getFrameworkContext } from './framework'
2
+ import { getAuthConfig } from './config.js'
3
+ import { getFrameworkContext } from './framework.js'
4
4
 
5
5
  // Create a single shared Better Auth client instance
6
6
  let client: any = null
package/src/registry.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AuthProvider } from './types'
1
+ import type { AuthProvider } from './types.js'
2
2
 
3
3
  // allow missing entries in the map so TypeScript understands runtime checks
4
4
  const providers: Record<string, AuthProvider | undefined> = {}
@@ -1,4 +1,4 @@
1
- declare module '@mframework/sdk' {
1
+ declare module '@mframework/core' {
2
2
  export type TransportAdapter = {
3
3
  request<T = any>(method: string, path: string, opts?: any): Promise<any>
4
4
  }
@@ -16,12 +16,12 @@ declare module '@mframework/core' {
16
16
  export type Result<T = any> = any
17
17
  export type Session = any
18
18
  export type User = any
19
- export type TransportAdapter = import('@mframework/sdk').TransportAdapter
19
+ export type TransportAdapter = import('@mframework/core').TransportAdapter
20
20
  export type RequestOptions = any
21
21
  export type APIResponse<T = any> = any
22
22
  }
23
23
 
24
- declare module '@mframework/api' {
24
+ declare module '@mframework/core' {
25
25
  export const prisma: any
26
26
  export function useDB(_event?: any): Promise<any>
27
27
  export function isValidTable(name: string): boolean
package/src/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  // Re-export the canonical SDK/core types so consumers of this adapter can import
2
2
  // from the adapter package and still get accurate types from the source
3
3
  // modules.
4
- export type { TransportAdapter, AuthAdapter, CommerceAdapter, SearchAdapter } from '@mframework/sdk'
4
+ export type { TransportAdapter, AuthAdapter, CommerceAdapter, SearchAdapter } from '@mframework/core'
5
5
  export type { LoginInput, RegisterInput, Result, Session, User } from '@mframework/core'
6
6
 
7
- // Re-export prisma utilities from the api package for convenience.
8
- export { prisma, useDB, isValidTable } from '@mframework/api'
7
+ // Re-export prisma utilities from the core package for convenience.
8
+ export { prisma, useDB, isValidTable } from '@mframework/core'
9
9
 
10
10
  // Adapter exports
11
11
  export function getAuthPlugins(opts?: any): any[]