auth 1.7.0-rc.5 → 1.7.0
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/api.d.mts +1 -0
- package/dist/api.mjs +1 -1
- package/dist/index.mjs +13 -17
- package/package.json +6 -6
- package/dist/index.d.mts +0 -1
package/dist/api.d.mts
CHANGED
package/dist/api.mjs
CHANGED
|
@@ -35,7 +35,7 @@ const generateDrizzleSchema = async ({ options, file, adapter }) => {
|
|
|
35
35
|
if (databaseType === "pg" && schemaName) {
|
|
36
36
|
schemaVarName = `${toValidIdentifier(schemaName)}Schema`;
|
|
37
37
|
if (schemaVarName === "pgSchema") schemaVarName = "pgCustomSchema";
|
|
38
|
-
code += `\
|
|
38
|
+
code += `\nexport const ${schemaVarName} = pgSchema(${JSON.stringify(schemaName)});\n\n`;
|
|
39
39
|
}
|
|
40
40
|
const getModelName = initGetModelName({
|
|
41
41
|
schema: tables,
|
package/dist/index.mjs
CHANGED
|
@@ -865,7 +865,7 @@ function filterPublicEnv(publicPrefix, privatePrefix) {
|
|
|
865
865
|
return Object.fromEntries(Object.entries(process.env).filter(([k]) => k.startsWith(publicPrefix) && (privatePrefix === "" || !k.startsWith(privatePrefix))));
|
|
866
866
|
}
|
|
867
867
|
const validIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
|
|
868
|
-
const reserved =
|
|
868
|
+
const reserved = new Set([
|
|
869
869
|
"do",
|
|
870
870
|
"if",
|
|
871
871
|
"in",
|
|
@@ -1085,7 +1085,7 @@ function resolveWithMatchers(specifier, matchers) {
|
|
|
1085
1085
|
* a jiti-side preprocessor artifact observed in the AST; revisit on jiti
|
|
1086
1086
|
* major version bumps (the regression suite catches a rename but not the why).
|
|
1087
1087
|
*/
|
|
1088
|
-
const LOADER_IDENTIFIERS =
|
|
1088
|
+
const LOADER_IDENTIFIERS = new Set([
|
|
1089
1089
|
"require",
|
|
1090
1090
|
"import",
|
|
1091
1091
|
"jitiImport"
|
|
@@ -1381,7 +1381,7 @@ const generateDrizzleSchema = async ({ options, file, adapter }) => {
|
|
|
1381
1381
|
if (databaseType === "pg" && schemaName) {
|
|
1382
1382
|
schemaVarName = `${toValidIdentifier(schemaName)}Schema`;
|
|
1383
1383
|
if (schemaVarName === "pgSchema") schemaVarName = "pgCustomSchema";
|
|
1384
|
-
code += `\
|
|
1384
|
+
code += `\nexport const ${schemaVarName} = pgSchema(${JSON.stringify(schemaName)});\n\n`;
|
|
1385
1385
|
}
|
|
1386
1386
|
const getModelName = initGetModelName({
|
|
1387
1387
|
schema: tables,
|
|
@@ -2955,7 +2955,7 @@ function installDependencies({ dependencies, packageManager, cwd, type = "prod",
|
|
|
2955
2955
|
}
|
|
2956
2956
|
//#endregion
|
|
2957
2957
|
//#region src/version.ts
|
|
2958
|
-
const cliVersion = "1.7.0
|
|
2958
|
+
const cliVersion = "1.7.0";
|
|
2959
2959
|
//#endregion
|
|
2960
2960
|
//#region src/commands/init/configs/frameworks.config.ts
|
|
2961
2961
|
const FRAMEWORKS = [
|
|
@@ -5366,12 +5366,11 @@ const getAuthPluginsCode = async ({ plugins, options = {}, installDependency })
|
|
|
5366
5366
|
const getArguments = await getArgumentsPrompt(options, plugins, "auth");
|
|
5367
5367
|
const pluginsCode = [];
|
|
5368
5368
|
for (const plugin of plugins) {
|
|
5369
|
-
const
|
|
5370
|
-
const args = convertArgumentsCodeToStringArray(argumentsCode);
|
|
5369
|
+
const args = convertArgumentsCodeToStringArray(await buildArgumentsCode(plugin.auth.arguments, getArguments, plugin.auth.function));
|
|
5371
5370
|
removeTrailingUndefined(args);
|
|
5372
5371
|
pluginsCode.push(`${plugin.auth.function}(${args.join(", ")})`);
|
|
5373
|
-
const dependencies =
|
|
5374
|
-
const devDependencies =
|
|
5372
|
+
const dependencies = new Set([...plugin.dependencies || [], ...plugin.auth.dependencies || []]);
|
|
5373
|
+
const devDependencies = new Set([...plugin.devDependencies || [], ...plugin.auth.devDependencies || []]);
|
|
5375
5374
|
if (dependencies.size > 0) await installDependency([...dependencies]);
|
|
5376
5375
|
if (devDependencies.size > 0) await installDependency([...devDependencies], "dev");
|
|
5377
5376
|
}
|
|
@@ -5385,12 +5384,11 @@ const getAuthClientPluginsCode = async ({ plugins, options = {}, installDependen
|
|
|
5385
5384
|
const pluginsCode = [];
|
|
5386
5385
|
for (const plugin of pluginsWithClient) {
|
|
5387
5386
|
if (!plugin.authClient) continue;
|
|
5388
|
-
const
|
|
5389
|
-
const args = convertArgumentsCodeToStringArray(argumentsCode);
|
|
5387
|
+
const args = convertArgumentsCodeToStringArray(await buildArgumentsCode(plugin.authClient.arguments, getArguments, plugin.authClient.function));
|
|
5390
5388
|
removeTrailingUndefined(args);
|
|
5391
5389
|
pluginsCode.push(`${plugin.authClient.function}(${args.join(", ")})`);
|
|
5392
|
-
const dependencies =
|
|
5393
|
-
const devDependencies =
|
|
5390
|
+
const dependencies = new Set([...plugin.dependencies || [], ...plugin.authClient.dependencies || []]);
|
|
5391
|
+
const devDependencies = new Set([...plugin.devDependencies || [], ...plugin.authClient.devDependencies || []]);
|
|
5394
5392
|
if (dependencies.size > 0) await installDependency([...dependencies]);
|
|
5395
5393
|
if (devDependencies.size > 0) await installDependency([...devDependencies], "dev");
|
|
5396
5394
|
}
|
|
@@ -6563,10 +6561,9 @@ export const auth = betterAuth({
|
|
|
6563
6561
|
}
|
|
6564
6562
|
databaseChoice = dbChoice || null;
|
|
6565
6563
|
if (databaseChoice === "yes") {
|
|
6566
|
-
const availableORMs = getAvailableORMs();
|
|
6567
6564
|
const selectedOption = await select({
|
|
6568
6565
|
message: `Select the database you want to use:`,
|
|
6569
|
-
options:
|
|
6566
|
+
options: getAvailableORMs().map((opt) => ({
|
|
6570
6567
|
value: opt.adapter || opt.value,
|
|
6571
6568
|
label: opt.label
|
|
6572
6569
|
}))
|
|
@@ -6600,10 +6597,9 @@ export const auth = betterAuth({
|
|
|
6600
6597
|
database = sqliteVariants;
|
|
6601
6598
|
} else if (isDirectAdapter(selectedOption)) database = selectedOption;
|
|
6602
6599
|
else {
|
|
6603
|
-
const availableDialects = getDialectsForORM(selectedOption);
|
|
6604
6600
|
const selectedDialect = await select({
|
|
6605
6601
|
message: `Select the database dialect:`,
|
|
6606
|
-
options:
|
|
6602
|
+
options: getDialectsForORM(selectedOption).map((d) => ({
|
|
6607
6603
|
value: d.adapter,
|
|
6608
6604
|
label: d.label
|
|
6609
6605
|
}))
|
|
@@ -6621,7 +6617,7 @@ export const auth = betterAuth({
|
|
|
6621
6617
|
const { shouldInstallDeps } = await prompts({
|
|
6622
6618
|
type: "confirm",
|
|
6623
6619
|
name: "shouldInstallDeps",
|
|
6624
|
-
message: `Would you like to install the following dependencies: ${[
|
|
6620
|
+
message: `Would you like to install the following dependencies: ${[...new Set([...databaseConfig.dependencies, ...databaseConfig.devDependencies || []])].map((x) => chalk.cyan(x)).join(", ")}?`,
|
|
6625
6621
|
initial: true
|
|
6626
6622
|
});
|
|
6627
6623
|
if (isCancel(shouldInstallDeps)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth",
|
|
3
|
-
"version": "1.7.0
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "The CLI for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"semver": "^7.8.4",
|
|
65
65
|
"yocto-spinner": "^1.2.0",
|
|
66
66
|
"zod": "^4.3.6",
|
|
67
|
-
"@better-auth/core": "1.7.0
|
|
68
|
-
"@better-auth/telemetry": "1.7.0
|
|
69
|
-
"better-auth": "1.7.0
|
|
67
|
+
"@better-auth/core": "1.7.0",
|
|
68
|
+
"@better-auth/telemetry": "1.7.0",
|
|
69
|
+
"better-auth": "1.7.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/better-sqlite3": "^7.6.13",
|
|
@@ -74,11 +74,11 @@
|
|
|
74
74
|
"@types/semver": "^7.7.1",
|
|
75
75
|
"better-sqlite3": "^12.11.1",
|
|
76
76
|
"memfs": "^4.56.10",
|
|
77
|
-
"tsdown": "0.
|
|
77
|
+
"tsdown": "0.21.10",
|
|
78
78
|
"tsx": "^4.21.0",
|
|
79
79
|
"type-fest": "^5.7.0",
|
|
80
80
|
"typescript": "^6.0.3",
|
|
81
|
-
"@better-auth/passkey": "1.7.0
|
|
81
|
+
"@better-auth/passkey": "1.7.0"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"build": "tsdown",
|
package/dist/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "dotenv/config";
|