@bagelink/auth 1.7.51 → 1.7.55

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/README.md CHANGED
@@ -13,9 +13,9 @@ npm install @bagelink/auth
13
13
  ### 1. Initialize Auth
14
14
 
15
15
  ```typescript
16
- import { initAuth } from '@bagelink/auth'
16
+ import { createAuth } from '@bagelink/auth'
17
17
 
18
- initAuth({
18
+ createAuth({
19
19
  baseURL: 'https://api.your-app.com'
20
20
  })
21
21
  ```
@@ -200,12 +200,12 @@ Returns the authentication composable with:
200
200
  - `resetPassword(token, password)` - Reset password with token
201
201
  - `sso` - SSO methods object
202
202
 
203
- ### `initAuth(config)`
203
+ ### `createAuth(config)`
204
204
 
205
205
  Initialize the auth module:
206
206
 
207
207
  ```typescript
208
- initAuth({
208
+ createAuth({
209
209
  baseURL: string // Required: Your API endpoint
210
210
  })
211
211
  ```
package/dist/index.cjs CHANGED
@@ -1905,7 +1905,7 @@ function accountToUser(account) {
1905
1905
  let authApi = null;
1906
1906
  let eventEmitter = null;
1907
1907
  const accountInfo = vue.ref(null);
1908
- function initAuth(params) {
1908
+ function createAuth(params) {
1909
1909
  if (authApi === null) {
1910
1910
  authApi = new AuthApi(params.baseURL);
1911
1911
  }
@@ -1936,10 +1936,10 @@ function initAuth(params) {
1936
1936
  }
1937
1937
  function useAuth() {
1938
1938
  if (authApi === null) {
1939
- throw new Error("Auth not initialized. Call initAuth first.");
1939
+ throw new Error("Auth not initialized. Call createAuth first.");
1940
1940
  }
1941
1941
  if (eventEmitter === null) {
1942
- throw new Error("Event emitter not initialized. Call initAuth first.");
1942
+ throw new Error("Event emitter not initialized. Call createAuth first.");
1943
1943
  }
1944
1944
  const api = authApi;
1945
1945
  const emitter = eventEmitter;
@@ -2181,7 +2181,7 @@ function useAuth() {
2181
2181
  }
2182
2182
  const useAuth$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2183
2183
  __proto__: null,
2184
- initAuth,
2184
+ createAuth,
2185
2185
  useAuth
2186
2186
  }, Symbol.toStringTag, { value: "Module" }));
2187
2187
  exports.AuthApi = AuthApi;
@@ -2203,11 +2203,11 @@ exports.SignupForm = _sfc_main$5;
2203
2203
  exports.SignupPage = _sfc_main;
2204
2204
  exports.StateMismatchError = StateMismatchError;
2205
2205
  exports.accountToUser = accountToUser;
2206
+ exports.createAuth = createAuth;
2206
2207
  exports.createAuthGuard = createAuthGuard;
2207
2208
  exports.createAuthRoutes = createAuthRoutes;
2208
2209
  exports.getAllSSOProviders = getAllSSOProviders;
2209
2210
  exports.getSSOProvider = getSSOProvider;
2210
- exports.initAuth = initAuth;
2211
2211
  exports.isSupportedProvider = isSupportedProvider;
2212
2212
  exports.providers = providers;
2213
2213
  exports.setAuthContext = setAuthContext;
package/dist/index.mjs CHANGED
@@ -1903,7 +1903,7 @@ function accountToUser(account) {
1903
1903
  let authApi = null;
1904
1904
  let eventEmitter = null;
1905
1905
  const accountInfo = ref(null);
1906
- function initAuth(params) {
1906
+ function createAuth(params) {
1907
1907
  if (authApi === null) {
1908
1908
  authApi = new AuthApi(params.baseURL);
1909
1909
  }
@@ -1934,10 +1934,10 @@ function initAuth(params) {
1934
1934
  }
1935
1935
  function useAuth() {
1936
1936
  if (authApi === null) {
1937
- throw new Error("Auth not initialized. Call initAuth first.");
1937
+ throw new Error("Auth not initialized. Call createAuth first.");
1938
1938
  }
1939
1939
  if (eventEmitter === null) {
1940
- throw new Error("Event emitter not initialized. Call initAuth first.");
1940
+ throw new Error("Event emitter not initialized. Call createAuth first.");
1941
1941
  }
1942
1942
  const api = authApi;
1943
1943
  const emitter = eventEmitter;
@@ -2179,7 +2179,7 @@ function useAuth() {
2179
2179
  }
2180
2180
  const useAuth$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2181
2181
  __proto__: null,
2182
- initAuth,
2182
+ createAuth,
2183
2183
  useAuth
2184
2184
  }, Symbol.toStringTag, { value: "Module" }));
2185
2185
  export {
@@ -2202,11 +2202,11 @@ export {
2202
2202
  _sfc_main as SignupPage,
2203
2203
  StateMismatchError,
2204
2204
  accountToUser,
2205
+ createAuth,
2205
2206
  createAuthGuard,
2206
2207
  createAuthRoutes,
2207
2208
  getAllSSOProviders,
2208
2209
  getSSOProvider,
2209
- initAuth,
2210
2210
  isSupportedProvider,
2211
2211
  providers,
2212
2212
  setAuthContext,
package/dist/useAuth.d.ts CHANGED
@@ -3,7 +3,7 @@ import { AccountInfo, User, NewUser, UpdatePasswordForm, UpdateAccountRequest, A
3
3
  interface InitParams {
4
4
  baseURL: string;
5
5
  }
6
- export declare function initAuth(params: InitParams): {
6
+ export declare function createAuth(params: InitParams): {
7
7
  on<K extends AuthState>(event: K, handler: AuthEventMap[K]): void;
8
8
  off<K extends AuthState>(event: K, handler: AuthEventMap[K]): void;
9
9
  removeAllListeners<K extends AuthState>(event?: K): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/auth",
3
3
  "type": "module",
4
- "version": "1.7.51",
4
+ "version": "1.7.55",
5
5
  "description": "Bagelink auth package",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
package/src/useAuth.ts CHANGED
@@ -27,7 +27,7 @@ interface InitParams {
27
27
  }
28
28
 
29
29
  // Initialize auth
30
- export function initAuth(params: InitParams) {
30
+ export function createAuth(params: InitParams) {
31
31
  if (authApi === null) {
32
32
  authApi = new AuthApi(params.baseURL)
33
33
  }
@@ -66,11 +66,11 @@ export function initAuth(params: InitParams) {
66
66
  // Composable
67
67
  export function useAuth() {
68
68
  if (authApi === null) {
69
- throw new Error('Auth not initialized. Call initAuth first.')
69
+ throw new Error('Auth not initialized. Call createAuth first.')
70
70
  }
71
71
 
72
72
  if (eventEmitter === null) {
73
- throw new Error('Event emitter not initialized. Call initAuth first.')
73
+ throw new Error('Event emitter not initialized. Call createAuth first.')
74
74
  }
75
75
 
76
76
  const api = authApi