auth 1.2.2 → 1.5.0-beta.15

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/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2024 - present, Bereket Engida
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ this software and associated documentation files (the “Software”), to deal in
6
+ the Software without restriction, including without limitation the rights to
7
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ the Software, and to permit persons to whom the Software is furnished to do so,
9
+ subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20
+ DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,194 +1,47 @@
1
- <p align="center">
2
- <img width="96px" src="https://authjs.dev/img/etc/cli.svg" style="margin-right: 16px"/>
3
- <a href="https://authjs.dev" target="_blank"><img width="96px" src="https://authjs.dev/img/logo-sm.png" /></a>
4
- <h1 align="center">Auth.js CLI</h1>
5
- </p>
6
- <p align="center">
7
- The CLI tool by <a href="https://authjs.dev">Auth.js</a> to supercharge your authentication workflows.
8
- </p>
9
- <p align="center">
10
- <a href="https://npm.im/auth"><img src="https://img.shields.io/badge/JavaScript-grey?style=flat-square&logo=javascript" alt="JavaScript" /></a>
11
- <a href="https://www.npmtrends.com/auth"><img src="https://img.shields.io/npm/dm/auth?style=flat-square&color=cyan" alt="Downloads" /></a>
12
- <a href="https://www.npmjs.com/package/auth"><img src="https://img.shields.io/npm/v/auth?style=flat-square&label=latest&color=purple" alt="npm latest release" /></a>
13
- <a href="https://github.com/nextauthjs/cli/stargazers"><img src="https://img.shields.io/github/stars/nextauthjs/cli?style=flat-square&color=orange" alt="Github Stars" /></a>
14
- </p>
1
+ # Better Auth CLI
15
2
 
16
- ## Features
3
+ Better Auth comes with a built-in CLI to help you manage the database schema
4
+ needed for both core functionality and plugins.
17
5
 
18
- - Natural language search to answer questions about Auth.js, docs, APIs, or general auth concepts
19
- - Initialize new projects with Auth.js for any of the supported frameworks
20
- - Guides you through adding authentication providers to your existing project
21
- - ... and more coming soon!
6
+ ### **Init**
22
7
 
23
- ## Installation
8
+ The CLI includes an `init` command to add Better Auth to your project.
24
9
 
25
- You don't need to install this package, run the following:
26
-
27
- ```sh
28
- npx auth # or pnpx, bunx, yarn dlx, etc.
10
+ ```bash title="terminal"
11
+ npx auth@latest init
29
12
  ```
30
13
 
31
- ## Usage
32
-
33
- <!-- GENERATED START -->
34
-
35
- ```
36
- Usage: auth [options] [command]
14
+ ### **Generate**
37
15
 
38
- Options:
39
- -V, --version output the version number
40
- -h, --help display help for command
16
+ The `generate` command creates the schema required by Better Auth.
17
+ If you’re using a database adapter like Prisma or Drizzle, this command will
18
+ generate the right schema for your ORM.
19
+ If you’re using the built-in Kysely adapter, it will generate an SQL file you
20
+ can run directly on your database.
41
21
 
42
- Commands:
43
- ask [options] Ask about docs, API, or auth concepts.
44
- init [options] [framework] Initialize a project.
45
- secret [options] Generate a random string and add it to the .env
46
- file.
47
- add [provider] Register a new authentication provider
48
- help [command] display help for command
22
+ ```bash title="terminal"
23
+ npx auth@latest generate
49
24
  ```
50
25
 
51
- <!-- GENERATED END -->
52
-
53
- ## Security
54
-
55
- If you think you have found a vulnerability (or are not sure) in Auth.js or any of the related packages (i.e. Adapters), we ask you to read our [Security Policy](https://authjs.dev/security) to reach out responsibly. Please do not open Pull Requests/Issues/Discussions before consulting with us.
26
+ ### **Migrate**
56
27
 
57
- ## Acknowledgements
28
+ The `migrate` command applies the Better Auth schema directly to your database.
29
+ This is available if you’re using the built-in Kysely adapter.
30
+ For other adapters, you’ll need to apply the schema using your ORM’s migration
31
+ tool.
58
32
 
59
- Special thanks to Craig for the `auth` package name on npm.
60
-
61
- ### Sponsors
62
-
63
- We have an [OpenCollective](https://opencollective.com/nextauth) for companies and individuals looking to contribute financially to the project!
64
-
65
- <!--sponsors start-->
66
- <table>
67
- <tbody>
68
- <tr>
69
- <td align="center" valign="top">
70
- <a href="https://clerk.com?utm_source=sponsorship&utm_medium=github&utm_campaign=authjs&utm_content=sponsor" target="_blank">
71
- <img height="96" src="https://avatars.githubusercontent.com/u/49538330?s=200&v=4" alt="Clerk Logo" />
72
- </a><br />
73
- <div>Clerk</div>
74
- <sub>💵</sub>
75
- </td>
76
- <td align="center" valign="top">
77
- <a href="https://a0.to/signup/nextauthjs" target="_blank">
78
- <img height="96" src="https://avatars.githubusercontent.com/u/2824157?v=4" alt="Auth0 Logo" />
79
- </a><br />
80
- <div>Auth0</div>
81
- <sub>💵</sub>
82
- </td>
83
- <td align="center" valign="top">
84
- <a href="https://fusionauth.io" target="_blank">
85
- <img height="96" src="https://avatars.githubusercontent.com/u/41974756?s=200&v=4" alt="FusionAuth Logo" />
86
- </a><br />
87
- <div>FusionAuth</div>
88
- <sub>💵</sub>
89
- </td>
90
- <td align="center" valign="top">
91
- <a href="https://www.beyondidentity.com" target="_blank">
92
- <img height="96" src="https://avatars.githubusercontent.com/u/69811361?s=200&v=4" alt="Beyond Identity Logo" />
93
- </a><br />
94
- <div>Beyond Identity</div>
95
- <sub>💵</sub>
96
- </td>
97
- <td align="center" valign="top">
98
- <a href="https://stytch.com" target="_blank">
99
- <img height="96" src="https://avatars.githubusercontent.com/u/69983493?s=200&v=4" alt="Stytch Logo" />
100
- </a><br />
101
- <div>Stytch</div>
102
- <sub>💵</sub>
103
- </td>
104
- <td align="center" valign="top">
105
- <a href="https://prisma.io" target="_blank">
106
- <img height="96" src="https://avatars.githubusercontent.com/u/17219288?s=200&v=4" alt="Prisma Logo" />
107
- </a><br />
108
- <div>Prisma</div>
109
- <sub>💵</sub>
110
- </td>
111
- </tr>
112
- <tr>
113
- <td align="center" valign="top">
114
- <a href="https://lowdefy.com" target="_blank">
115
- <img height="96" src="https://avatars.githubusercontent.com/u/47087496?s=200&v=4" alt="Lowdefy Logo" />
116
- </a><br />
117
- <div>Lowdefy</div>
118
- <sub>💵</sub>
119
- </td>
120
- <td align="center" valign="top">
121
- <a href="https://www.descope.com" target="_blank">
122
- <img height="96" src="https://avatars.githubusercontent.com/u/97479186?s=200&v=4" alt="Descope Logo" />
123
- </a><br />
124
- <div>Descope</div>
125
- <sub>💵</sub>
126
- </td>
127
- <td align="center" valign="top">
128
- <a href="https://badass.dev" target="_blank">
129
- <img height="96" src="https://avatars.githubusercontent.com/u/136839242?v=4" alt="Badass Courses Logo" />
130
- </a><br />
131
- <div>Badass Courses</div>
132
- <sub>💵</sub>
133
- </td>
134
- <td align="center" valign="top">
135
- <a href="https://github.com/encoredev/encore" target="_blank">
136
- <img height="96" src="https://avatars.githubusercontent.com/u/50438175?v=4" alt="Encore Logo" />
137
- </a><br />
138
- <div>Encore</div>
139
- <sub>💵</sub>
140
- </td>
141
- <td align="center" valign="top">
142
- <a href="https://arcjet.com/?ref=auth.js" target="_blank">
143
- <img width="108" src="https://avatars.githubusercontent.com/u/24397786?s=200&v=4" alt="Arcjet Logo" />
144
- </a><br />
145
- <div>Arcjet</div>
146
- <sub>💵</sub>
147
- </td>
148
- <td align="center" valign="top">
149
- <a href="https://www.netlight.com/" target="_blank">
150
- <img height="96" src="https://avatars.githubusercontent.com/u/1672348?s=200&v=4" alt="Netlight logo" />
151
- </a><br />
152
- <div>Netlight</div>
153
- <sub>☁️</sub>
154
- </td>
155
- </tr>
156
- <tr>
157
- <td align="center" valign="top">
158
- <a href="https://checklyhq.com" target="_blank">
159
- <img height="96" src="https://avatars.githubusercontent.com/u/25982255?s=200&v=4" alt="Checkly Logo" />
160
- </a><br />
161
- <div>Checkly</div>
162
- <sub>☁️</sub>
163
- </td>
164
- <td align="center" valign="top">
165
- <a href="https://superblog.ai/" target="_blank">
166
- <img height="96" src="https://d33wubrfki0l68.cloudfront.net/cdc4a3833bd878933fcc131655878dbf226ac1c5/10cd6/images/logo_bolt_small.png" alt="superblog Logo" />
167
- </a><br />
168
- <div>superblog</div>
169
- <sub>☁️</sub>
170
- </td>
171
- <td align="center" valign="top">
172
- <a href="https://vercel.com" target="_blank">
173
- <img height="96" src="https://avatars.githubusercontent.com/u/14985020?s=200&v=4" alt="Vercel Logo" />
174
- </a><br />
175
- <div>Vercel</div>
176
- <sub>☁️</sub>
177
- </td>
178
- </tr>
179
- </tbody>
180
- </table>
181
-
182
- - 💵 Financial Sponsor
183
- - ☁️ Infrastructure Support
33
+ ```bash title="terminal"
34
+ npx auth@latest migrate
35
+ ```
184
36
 
185
- <br />
186
- <!--sponsors end-->
37
+ ### **Secret**
187
38
 
188
- ## Contributing
39
+ The CLI also provides a way to generate a secret key for your Better Auth
40
+ instance.
189
41
 
190
- We're open to all community contributions! If you'd like to contribute in any way, please first read
191
- our [Contributing Guide](https://github.com/nextauthjs/.github/blob/main/CONTRIBUTING.md).
42
+ ```bash title="terminal"
43
+ npx auth@latest secret
44
+ ```
192
45
 
193
46
  ## License
194
47
 
package/dist/api.d.mts ADDED
@@ -0,0 +1,45 @@
1
+ import { DBAdapter, DBAdapter as DBAdapter$1 } from "@better-auth/core/db/adapter";
2
+ import { BetterAuthOptions } from "@better-auth/core";
3
+
4
+ //#region src/generators/types.d.ts
5
+ interface SchemaGeneratorResult {
6
+ code?: string;
7
+ fileName: string;
8
+ overwrite?: boolean;
9
+ append?: boolean;
10
+ }
11
+ interface SchemaGenerator {
12
+ <Options extends BetterAuthOptions>(opts: {
13
+ file?: string;
14
+ adapter: DBAdapter$1;
15
+ options: Options;
16
+ }): Promise<SchemaGeneratorResult>;
17
+ }
18
+ //#endregion
19
+ //#region src/generators/index.d.ts
20
+ declare const adapters: {
21
+ prisma: SchemaGenerator;
22
+ drizzle: SchemaGenerator;
23
+ kysely: SchemaGenerator;
24
+ };
25
+ declare const generateSchema: (opts: {
26
+ adapter: DBAdapter$1;
27
+ file?: string;
28
+ options: BetterAuthOptions;
29
+ }) => Promise<SchemaGeneratorResult> | Promise<{
30
+ code: string;
31
+ fileName: string;
32
+ overwrite: boolean | undefined;
33
+ }>;
34
+ //#endregion
35
+ //#region src/generators/drizzle.d.ts
36
+ declare const generateDrizzleSchema: SchemaGenerator;
37
+ //#endregion
38
+ //#region src/generators/kysely.d.ts
39
+ declare const generateKyselySchema: SchemaGenerator;
40
+ //#endregion
41
+ //#region src/generators/prisma.d.ts
42
+ declare const generatePrismaSchema: SchemaGenerator;
43
+ //#endregion
44
+ export { type DBAdapter, type SchemaGenerator, type SchemaGeneratorResult, adapters, generateDrizzleSchema, generateKyselySchema, generatePrismaSchema, generateSchema };
45
+ //# sourceMappingURL=api.d.mts.map
package/dist/api.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { d as generateDrizzleSchema, n as generateSchema, r as generatePrismaSchema, t as adapters, u as generateKyselySchema } from "./generators-DNY9D4Si.mjs";
2
+
3
+ export { adapters, generateDrizzleSchema, generateKyselySchema, generatePrismaSchema, generateSchema };