zitejs 0.9.77 → 0.9.78
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/cjs/auth/index.d.ts +23 -0
- package/dist/cjs/auth/index.js +2 -0
- package/dist/cjs/auth/index.test.d.ts +1 -0
- package/dist/cjs/auth/index.test.js +64 -0
- package/dist/cjs/sync/lib.js +17 -2
- package/dist/cjs/sync/lib.test.d.ts +1 -0
- package/dist/cjs/sync/lib.test.js +38 -0
- package/dist/esm/auth/index.d.ts +23 -0
- package/dist/esm/auth/index.js +2 -0
- package/dist/esm/auth/index.test.d.ts +1 -0
- package/dist/esm/auth/index.test.js +29 -0
- package/dist/esm/sync/lib.js +17 -2
- package/dist/esm/sync/lib.test.d.ts +1 -0
- package/dist/esm/sync/lib.test.js +36 -0
- package/package.json +1 -1
package/dist/cjs/auth/index.d.ts
CHANGED
|
@@ -27,6 +27,29 @@ export declare const useSession: () => {
|
|
|
27
27
|
query?: import("better-auth/types").SessionQueryParams;
|
|
28
28
|
} | undefined) => Promise<void>;
|
|
29
29
|
}, signIn: {
|
|
30
|
+
magicLink: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
|
|
31
|
+
email: string;
|
|
32
|
+
name?: string | undefined;
|
|
33
|
+
callbackURL?: string | undefined;
|
|
34
|
+
newUserCallbackURL?: string | undefined;
|
|
35
|
+
errorCallbackURL?: string | undefined;
|
|
36
|
+
metadata?: Record<string, any> | undefined;
|
|
37
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
|
|
38
|
+
email: string;
|
|
39
|
+
name?: string | undefined;
|
|
40
|
+
callbackURL?: string | undefined;
|
|
41
|
+
newUserCallbackURL?: string | undefined;
|
|
42
|
+
errorCallbackURL?: string | undefined;
|
|
43
|
+
metadata?: Record<string, any> | undefined;
|
|
44
|
+
} & {
|
|
45
|
+
fetchOptions?: FetchOptions | undefined;
|
|
46
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
|
|
47
|
+
status: boolean;
|
|
48
|
+
}, {
|
|
49
|
+
code?: string | undefined;
|
|
50
|
+
message?: string | undefined;
|
|
51
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
52
|
+
} & {
|
|
30
53
|
social: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
|
|
31
54
|
provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
32
55
|
callbackURL?: string | undefined;
|
package/dist/cjs/auth/index.js
CHANGED
|
@@ -4,8 +4,10 @@ exports.signUp = exports.signOut = exports.signIn = exports.useSession = void 0;
|
|
|
4
4
|
exports.loginWithRedirect = loginWithRedirect;
|
|
5
5
|
exports.logout = logout;
|
|
6
6
|
const react_1 = require("better-auth/react");
|
|
7
|
+
const plugins_1 = require("better-auth/client/plugins");
|
|
7
8
|
const authClient = (0, react_1.createAuthClient)({
|
|
8
9
|
baseURL: '',
|
|
10
|
+
plugins: [(0, plugins_1.magicLinkClient)()],
|
|
9
11
|
});
|
|
10
12
|
exports.useSession = authClient.useSession, exports.signIn = authClient.signIn, exports.signOut = authClient.signOut, exports.signUp = authClient.signUp;
|
|
11
13
|
function loginWithRedirect(opts) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const vitest_1 = require("vitest");
|
|
37
|
+
const authExports = __importStar(require("./index.js"));
|
|
38
|
+
(0, vitest_1.describe)('zitejs/auth exports', () => {
|
|
39
|
+
(0, vitest_1.it)('exports loginWithRedirect as a function', () => {
|
|
40
|
+
(0, vitest_1.expect)(typeof authExports.loginWithRedirect).toBe('function');
|
|
41
|
+
});
|
|
42
|
+
(0, vitest_1.it)('exports logout as a function', () => {
|
|
43
|
+
(0, vitest_1.expect)(typeof authExports.logout).toBe('function');
|
|
44
|
+
});
|
|
45
|
+
(0, vitest_1.it)('exports useSession', () => {
|
|
46
|
+
(0, vitest_1.expect)(authExports.useSession).toBeDefined();
|
|
47
|
+
});
|
|
48
|
+
(0, vitest_1.it)('exports signIn with magicLink method (from magicLinkClient plugin)', () => {
|
|
49
|
+
(0, vitest_1.expect)(authExports.signIn).toBeDefined();
|
|
50
|
+
(0, vitest_1.expect)(typeof authExports.signIn.magicLink).toBe('function');
|
|
51
|
+
});
|
|
52
|
+
(0, vitest_1.it)('exports signIn with email method', () => {
|
|
53
|
+
(0, vitest_1.expect)(typeof authExports.signIn.email).toBe('function');
|
|
54
|
+
});
|
|
55
|
+
(0, vitest_1.it)('exports signIn with social method', () => {
|
|
56
|
+
(0, vitest_1.expect)(typeof authExports.signIn.social).toBe('function');
|
|
57
|
+
});
|
|
58
|
+
(0, vitest_1.it)('exports signUp with email method', () => {
|
|
59
|
+
(0, vitest_1.expect)(typeof authExports.signUp.email).toBe('function');
|
|
60
|
+
});
|
|
61
|
+
(0, vitest_1.it)('exports signOut', () => {
|
|
62
|
+
(0, vitest_1.expect)(authExports.signOut).toBeDefined();
|
|
63
|
+
});
|
|
64
|
+
});
|
package/dist/cjs/sync/lib.js
CHANGED
|
@@ -496,8 +496,23 @@ function generateAuthWrapperTs() {
|
|
|
496
496
|
"// The real auth logic lives in the zitejs npm package (zitejs/auth).",
|
|
497
497
|
"// Imports use zitejs/auth/base to avoid circular alias (zitejs/auth → this file).",
|
|
498
498
|
"",
|
|
499
|
-
"export {
|
|
500
|
-
"
|
|
499
|
+
"export {",
|
|
500
|
+
" useSession,",
|
|
501
|
+
" signIn,",
|
|
502
|
+
" signOut,",
|
|
503
|
+
" signUp,",
|
|
504
|
+
" loginWithRedirect,",
|
|
505
|
+
" logout,",
|
|
506
|
+
"} from 'zitejs/auth/base';",
|
|
507
|
+
"",
|
|
508
|
+
"export type {",
|
|
509
|
+
" User,",
|
|
510
|
+
" ZiteAppConfig,",
|
|
511
|
+
" ZiteAuthenticationConfig,",
|
|
512
|
+
" ZiteAuthMethods,",
|
|
513
|
+
" ZiteAuthPage,",
|
|
514
|
+
" ZiteAuthPageMessages,",
|
|
515
|
+
"} from 'zitejs/auth/base';",
|
|
501
516
|
"",
|
|
502
517
|
].join("\n");
|
|
503
518
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const lib_js_1 = require("./lib.js");
|
|
5
|
+
(0, vitest_1.describe)('generateAuthWrapperTs', () => {
|
|
6
|
+
const output = (0, lib_js_1.generateAuthWrapperTs)();
|
|
7
|
+
(0, vitest_1.it)('imports from zitejs/auth/base (not zitejs/auth) to avoid circular alias', () => {
|
|
8
|
+
(0, vitest_1.expect)(output).toContain("from 'zitejs/auth/base'");
|
|
9
|
+
(0, vitest_1.expect)(output).not.toContain("from 'zitejs/auth';");
|
|
10
|
+
});
|
|
11
|
+
(0, vitest_1.it)('re-exports all auth runtime functions', () => {
|
|
12
|
+
for (const fn of [
|
|
13
|
+
'useSession',
|
|
14
|
+
'signIn',
|
|
15
|
+
'signOut',
|
|
16
|
+
'signUp',
|
|
17
|
+
'loginWithRedirect',
|
|
18
|
+
'logout',
|
|
19
|
+
]) {
|
|
20
|
+
(0, vitest_1.expect)(output).toContain(fn);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
(0, vitest_1.it)('re-exports all config types', () => {
|
|
24
|
+
for (const type of [
|
|
25
|
+
'User',
|
|
26
|
+
'ZiteAppConfig',
|
|
27
|
+
'ZiteAuthenticationConfig',
|
|
28
|
+
'ZiteAuthMethods',
|
|
29
|
+
'ZiteAuthPage',
|
|
30
|
+
'ZiteAuthPageMessages',
|
|
31
|
+
]) {
|
|
32
|
+
(0, vitest_1.expect)(output).toContain(type);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
(0, vitest_1.it)('does not export the old useAuth function', () => {
|
|
36
|
+
(0, vitest_1.expect)(output).not.toContain('useAuth');
|
|
37
|
+
});
|
|
38
|
+
});
|
package/dist/esm/auth/index.d.ts
CHANGED
|
@@ -27,6 +27,29 @@ export declare const useSession: () => {
|
|
|
27
27
|
query?: import("better-auth").SessionQueryParams;
|
|
28
28
|
} | undefined) => Promise<void>;
|
|
29
29
|
}, signIn: {
|
|
30
|
+
magicLink: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
31
|
+
email: string;
|
|
32
|
+
name?: string | undefined;
|
|
33
|
+
callbackURL?: string | undefined;
|
|
34
|
+
newUserCallbackURL?: string | undefined;
|
|
35
|
+
errorCallbackURL?: string | undefined;
|
|
36
|
+
metadata?: Record<string, any> | undefined;
|
|
37
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
|
|
38
|
+
email: string;
|
|
39
|
+
name?: string | undefined;
|
|
40
|
+
callbackURL?: string | undefined;
|
|
41
|
+
newUserCallbackURL?: string | undefined;
|
|
42
|
+
errorCallbackURL?: string | undefined;
|
|
43
|
+
metadata?: Record<string, any> | undefined;
|
|
44
|
+
} & {
|
|
45
|
+
fetchOptions?: FetchOptions | undefined;
|
|
46
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
|
|
47
|
+
status: boolean;
|
|
48
|
+
}, {
|
|
49
|
+
code?: string | undefined;
|
|
50
|
+
message?: string | undefined;
|
|
51
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
52
|
+
} & {
|
|
30
53
|
social: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
31
54
|
provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
32
55
|
callbackURL?: string | undefined;
|
package/dist/esm/auth/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createAuthClient } from 'better-auth/react';
|
|
2
|
+
import { magicLinkClient } from 'better-auth/client/plugins';
|
|
2
3
|
const authClient = createAuthClient({
|
|
3
4
|
baseURL: '',
|
|
5
|
+
plugins: [magicLinkClient()],
|
|
4
6
|
});
|
|
5
7
|
export const { useSession, signIn, signOut, signUp } = authClient;
|
|
6
8
|
export function loginWithRedirect(opts) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import * as authExports from './index.js';
|
|
3
|
+
describe('zitejs/auth exports', () => {
|
|
4
|
+
it('exports loginWithRedirect as a function', () => {
|
|
5
|
+
expect(typeof authExports.loginWithRedirect).toBe('function');
|
|
6
|
+
});
|
|
7
|
+
it('exports logout as a function', () => {
|
|
8
|
+
expect(typeof authExports.logout).toBe('function');
|
|
9
|
+
});
|
|
10
|
+
it('exports useSession', () => {
|
|
11
|
+
expect(authExports.useSession).toBeDefined();
|
|
12
|
+
});
|
|
13
|
+
it('exports signIn with magicLink method (from magicLinkClient plugin)', () => {
|
|
14
|
+
expect(authExports.signIn).toBeDefined();
|
|
15
|
+
expect(typeof authExports.signIn.magicLink).toBe('function');
|
|
16
|
+
});
|
|
17
|
+
it('exports signIn with email method', () => {
|
|
18
|
+
expect(typeof authExports.signIn.email).toBe('function');
|
|
19
|
+
});
|
|
20
|
+
it('exports signIn with social method', () => {
|
|
21
|
+
expect(typeof authExports.signIn.social).toBe('function');
|
|
22
|
+
});
|
|
23
|
+
it('exports signUp with email method', () => {
|
|
24
|
+
expect(typeof authExports.signUp.email).toBe('function');
|
|
25
|
+
});
|
|
26
|
+
it('exports signOut', () => {
|
|
27
|
+
expect(authExports.signOut).toBeDefined();
|
|
28
|
+
});
|
|
29
|
+
});
|
package/dist/esm/sync/lib.js
CHANGED
|
@@ -484,8 +484,23 @@ export function generateAuthWrapperTs() {
|
|
|
484
484
|
"// The real auth logic lives in the zitejs npm package (zitejs/auth).",
|
|
485
485
|
"// Imports use zitejs/auth/base to avoid circular alias (zitejs/auth → this file).",
|
|
486
486
|
"",
|
|
487
|
-
"export {
|
|
488
|
-
"
|
|
487
|
+
"export {",
|
|
488
|
+
" useSession,",
|
|
489
|
+
" signIn,",
|
|
490
|
+
" signOut,",
|
|
491
|
+
" signUp,",
|
|
492
|
+
" loginWithRedirect,",
|
|
493
|
+
" logout,",
|
|
494
|
+
"} from 'zitejs/auth/base';",
|
|
495
|
+
"",
|
|
496
|
+
"export type {",
|
|
497
|
+
" User,",
|
|
498
|
+
" ZiteAppConfig,",
|
|
499
|
+
" ZiteAuthenticationConfig,",
|
|
500
|
+
" ZiteAuthMethods,",
|
|
501
|
+
" ZiteAuthPage,",
|
|
502
|
+
" ZiteAuthPageMessages,",
|
|
503
|
+
"} from 'zitejs/auth/base';",
|
|
489
504
|
"",
|
|
490
505
|
].join("\n");
|
|
491
506
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { generateAuthWrapperTs } from './lib.js';
|
|
3
|
+
describe('generateAuthWrapperTs', () => {
|
|
4
|
+
const output = generateAuthWrapperTs();
|
|
5
|
+
it('imports from zitejs/auth/base (not zitejs/auth) to avoid circular alias', () => {
|
|
6
|
+
expect(output).toContain("from 'zitejs/auth/base'");
|
|
7
|
+
expect(output).not.toContain("from 'zitejs/auth';");
|
|
8
|
+
});
|
|
9
|
+
it('re-exports all auth runtime functions', () => {
|
|
10
|
+
for (const fn of [
|
|
11
|
+
'useSession',
|
|
12
|
+
'signIn',
|
|
13
|
+
'signOut',
|
|
14
|
+
'signUp',
|
|
15
|
+
'loginWithRedirect',
|
|
16
|
+
'logout',
|
|
17
|
+
]) {
|
|
18
|
+
expect(output).toContain(fn);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
it('re-exports all config types', () => {
|
|
22
|
+
for (const type of [
|
|
23
|
+
'User',
|
|
24
|
+
'ZiteAppConfig',
|
|
25
|
+
'ZiteAuthenticationConfig',
|
|
26
|
+
'ZiteAuthMethods',
|
|
27
|
+
'ZiteAuthPage',
|
|
28
|
+
'ZiteAuthPageMessages',
|
|
29
|
+
]) {
|
|
30
|
+
expect(output).toContain(type);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
it('does not export the old useAuth function', () => {
|
|
34
|
+
expect(output).not.toContain('useAuth');
|
|
35
|
+
});
|
|
36
|
+
});
|