better-auth-studio 1.0.59-beta.7 → 1.0.59-beta.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAeA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAS9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA8D9C,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAqLhG;AAeD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAqlLR"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAeA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAS9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA+D9C,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAqLhG;AAeD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CA4mLR"}
package/dist/routes.js CHANGED
@@ -8,10 +8,10 @@ import { scryptAsync } from '@noble/hashes/scrypt.js';
8
8
  import { Router } from 'express';
9
9
  import { createJiti } from 'jiti';
10
10
  import { createMockAccount, createMockSession, createMockUser, createMockVerification, getAuthAdapter, } from './auth-adapter.js';
11
+ import { possiblePaths } from './config.js';
11
12
  import { getAuthData } from './data.js';
12
13
  import { initializeGeoService, resolveIPLocation, setGeoDbPath } from './geo-service.js';
13
14
  import { detectDatabaseWithDialect } from './utils/database-detection.js';
14
- import { possiblePaths } from './config.js';
15
15
  const config = {
16
16
  N: 16384,
17
17
  r: 16,
@@ -4347,7 +4347,30 @@ export function createRoutes(authConfig, configPath, geoDbPath) {
4347
4347
  attrs.push(`required: ${field.required ? 'true' : 'false'}`);
4348
4348
  attrs.push(`unique: ${field.unique ? 'true' : 'false'}`);
4349
4349
  attrs.push('input: false');
4350
- if (field.type === 'boolean') {
4350
+ // Handle defaultValue
4351
+ if (field.defaultValue !== undefined &&
4352
+ field.defaultValue !== null &&
4353
+ field.defaultValue !== '') {
4354
+ if (field.type === 'string') {
4355
+ attrs.push(`defaultValue: "${field.defaultValue}"`);
4356
+ }
4357
+ else if (field.type === 'boolean') {
4358
+ attrs.push(`defaultValue: ${field.defaultValue === 'true' || field.defaultValue === true}`);
4359
+ }
4360
+ else if (field.type === 'number') {
4361
+ attrs.push(`defaultValue: ${field.defaultValue}`);
4362
+ }
4363
+ else if (field.type === 'date') {
4364
+ if (field.defaultValue === 'now()') {
4365
+ attrs.push('defaultValue: new Date()');
4366
+ }
4367
+ else {
4368
+ attrs.push(`defaultValue: new Date("${field.defaultValue}")`);
4369
+ }
4370
+ }
4371
+ }
4372
+ else if (field.type === 'boolean') {
4373
+ // Default to false for boolean if no defaultValue specified
4351
4374
  attrs.push('defaultValue: false');
4352
4375
  }
4353
4376
  const attrStr = attrs.join(',\n ');
@@ -4369,15 +4392,15 @@ ${fields}
4369
4392
  if (!code.trim())
4370
4393
  return '';
4371
4394
  const lines = code.split('\n');
4372
- const nonEmptyLines = lines.filter(line => line.trim());
4395
+ const nonEmptyLines = lines.filter((line) => line.trim());
4373
4396
  if (nonEmptyLines.length === 0)
4374
4397
  return '';
4375
- const minIndent = Math.min(...nonEmptyLines.map(line => {
4398
+ const minIndent = Math.min(...nonEmptyLines.map((line) => {
4376
4399
  const match = line.match(/^(\s*)/);
4377
4400
  return match ? match[1].length : 0;
4378
4401
  }));
4379
4402
  return lines
4380
- .map(line => {
4403
+ .map((line) => {
4381
4404
  if (!line.trim())
4382
4405
  return '';
4383
4406
  const currentIndent = line.match(/^(\s*)/)?.[1] || '';