@rio.js/enterprise 1.4.4 → 1.4.6

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.
@@ -0,0 +1,10 @@
1
+ import { t as Connection } from "./db-BO4CGoP4.mjs";
2
+ import { BetterAuthPlugin, betterAuth } from "better-auth";
3
+
4
+ //#region src/better-auth.d.ts
5
+ declare function createAuthSystem(options: {
6
+ plugins?: BetterAuthPlugin[];
7
+ db: Connection;
8
+ }): ReturnType<typeof betterAuth>;
9
+ //#endregion
10
+ export { createAuthSystem as t };
@@ -1,18 +1,19 @@
1
- import { $ as teamRole, A as oauthAccessTokenRelations, B as organizationRoleRelations, C as memberAssetRoleRelations, D as memberTeamRole, E as memberRelations, F as object, G as schemaDefinition, H as platformRole, I as objectRelations, J as sessionRelations, K as schemaDefinitionRelations, L as organization$1, M as oauthApplicationRelations, N as oauthConsent, O as memberTeamRoleRelations, P as oauthConsentRelations, Q as teamRelations, R as organizationRelations, S as memberAssetRole, T as memberOrganizationRoleRelations, U as relationship, V as person, W as relationshipRelations, X as teamMember, Y as team, Z as teamMemberRelations, _ as assetType, a as agent, at as verification, b as invitationRelations, c as apikeyRelations, d as assetRole, et as teamRoleRelations, f as assetRoleRelations, g as assetShareRelations, h as assetShareLinkRelations, i as accountRelations, it as userRelations, j as oauthApplication, k as oauthAccessToken, l as asset, m as assetShareLink, nt as twoFactorRelations, o as agentRelations, ot as enterpriseSchema, p as assetShare, q as session, r as account, rt as user, s as apikey, st as __export, t as db, tt as twoFactor$1, u as assetRelations, v as assetTypeRelations, w as memberOrganizationRole, x as member, y as invitation, z as organizationRole } from "./db-Bu7FlEtc.mjs";
1
+ import { $ as teamRoleRelations, A as oauthApplication, B as person, C as memberOrganizationRole, D as memberTeamRoleRelations, E as memberTeamRole, F as objectRelations, G as schemaDefinitionRelations, H as relationship, I as organization$1, J as team, K as session, L as organizationRelations, M as oauthConsent, N as oauthConsentRelations, O as oauthAccessToken, P as object, Q as teamRole, R as organizationRole, S as memberAssetRoleRelations, T as memberRelations, U as relationshipRelations, V as platformRole, W as schemaDefinition, X as teamMemberRelations, Y as teamMember, Z as teamRelations, a as apikey, at as enterpriseSchema, b as member, c as assetRelations, d as assetShare, et as twoFactor$1, f as assetShareLink, g as assetTypeRelations, h as assetType, i as agentRelations, it as verification, j as oauthApplicationRelations, k as oauthAccessTokenRelations, l as assetRole, m as assetShareRelations, n as accountRelations, nt as user, o as apikeyRelations, ot as __export, p as assetShareLinkRelations, q as sessionRelations, r as agent, rt as userRelations, s as asset, t as account, tt as twoFactorRelations, u as assetRoleRelations, v as invitation, w as memberOrganizationRoleRelations, x as memberAssetRole, y as invitationRelations, z as organizationRoleRelations } from "./db-schema.generated-t7hCTMF5.mjs";
2
2
  import { G as getCurrentTransactionAdapter, W as getCurrentGraphContext } from "./json-oFuWgANh-CZSe35mm.mjs";
3
3
  import { f as logger, g as BetterAuthError, v as invariant } from "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
4
- import { A as apiKey, E as admin, K as graph, R as lastLoginMethod, U as organization, a as openAPI, it as APIError$1, j as assets, k as agents, rt as twoFactor, z as mcp } from "./plugins-C_-kHHzW.mjs";
5
- import { t as betterAuth } from "./dist-DGeBMuXr.mjs";
4
+ import { A as apiKey, E as admin, K as graph, R as lastLoginMethod, T as anonymous, U as organization, a as openAPI, i as phoneNumber, it as APIError$1, j as assets, k as agents, rt as twoFactor, z as mcp } from "./plugins-4UnCRez7.mjs";
5
+ import { t as betterAuth } from "./dist-Dt0ifDbX.mjs";
6
6
  import { t as createAdapterFactory } from "./adapter-factory-BTRALCLD-Bv_0fQx-.mjs";
7
7
  import { and, asc, count, desc, eq, gt, gte, inArray, like, lt, lte, ne, notInArray, or, sql } from "drizzle-orm";
8
8
  import cuid from "cuid";
9
+ import bcrypt from "bcrypt";
9
10
 
10
11
  //#region ../better-auth/dist/adapters/drizzle-adapter/index.mjs
11
- const drizzleAdapter = (db$1, config) => {
12
+ const drizzleAdapter = (db, config) => {
12
13
  let lazyOptions = null;
13
- const createCustomAdapter = (db$1$1) => ({ getFieldName, options }) => {
14
+ const createCustomAdapter = (db$1) => ({ getFieldName, options }) => {
14
15
  function getSchema(model) {
15
- const schema = config.schema || db$1$1._.fullSchema;
16
+ const schema = config.schema || db$1._.fullSchema;
16
17
  if (!schema) throw new BetterAuthError("Drizzle adapter failed to initialize. Schema not found. Please provide a schema object in the adapter options object.");
17
18
  const schemaModel = schema[model];
18
19
  if (!schemaModel) throw new BetterAuthError(`[# Drizzle Adapter]: The model "${model}" was not found in the schema object. Please pass the schema directly to the adapter options.`);
@@ -31,15 +32,15 @@ const drizzleAdapter = (db$1, config) => {
31
32
  };
32
33
  return w;
33
34
  }), model);
34
- return (await db$1$1.select().from(schemaModel).where(...clause))[0];
35
+ return (await db$1.select().from(schemaModel).where(...clause))[0];
35
36
  } else if (builderVal && builderVal[0]?.id?.value) {
36
37
  let tId = builderVal[0]?.id?.value;
37
- if (!tId) tId = (await db$1$1.select({ id: sql`LAST_INSERT_ID()` }).from(schemaModel).orderBy(desc(schemaModel.id)).limit(1))[0].id;
38
- return (await db$1$1.select().from(schemaModel).where(eq(schemaModel.id, tId)).limit(1).execute())[0];
39
- } else if (data.id) return (await db$1$1.select().from(schemaModel).where(eq(schemaModel.id, data.id)).limit(1).execute())[0];
38
+ if (!tId) tId = (await db$1.select({ id: sql`LAST_INSERT_ID()` }).from(schemaModel).orderBy(desc(schemaModel.id)).limit(1))[0].id;
39
+ return (await db$1.select().from(schemaModel).where(eq(schemaModel.id, tId)).limit(1).execute())[0];
40
+ } else if (data.id) return (await db$1.select().from(schemaModel).where(eq(schemaModel.id, data.id)).limit(1).execute())[0];
40
41
  else {
41
42
  if (!("id" in schemaModel)) throw new BetterAuthError(`The model "${model}" does not have an "id" field. Please use the "id" field as your primary key.`);
42
- return (await db$1$1.select().from(schemaModel).orderBy(desc(schemaModel.id)).limit(1).execute())[0];
43
+ return (await db$1.select().from(schemaModel).orderBy(desc(schemaModel.id)).limit(1).execute())[0];
43
44
  }
44
45
  };
45
46
  function convertWhereClause(where, model) {
@@ -132,20 +133,20 @@ const drizzleAdapter = (db$1, config) => {
132
133
  async create({ model, data: values }) {
133
134
  const schemaModel = getSchema(model);
134
135
  checkMissingFields(schemaModel, model, values);
135
- return await withReturning(model, db$1$1.insert(schemaModel).values(values), values);
136
+ return await withReturning(model, db$1.insert(schemaModel).values(values), values);
136
137
  },
137
138
  async createMany({ model, data: rows }) {
138
139
  const schemaModel = getSchema(model);
139
140
  rows.forEach((row) => {
140
141
  checkMissingFields(schemaModel, model, row);
141
142
  });
142
- await db$1$1.insert(schemaModel).values(rows).execute();
143
+ await db$1.insert(schemaModel).values(rows).execute();
143
144
  return rows;
144
145
  },
145
146
  async findOne({ model, where, join }) {
146
147
  const schemaModel = getSchema(model);
147
148
  const clause = convertWhereClause(where, model);
148
- if (options.experimental?.joins) if (!db$1$1.query || !db$1$1.query[model]) {
149
+ if (options.experimental?.joins) if (!db$1.query || !db$1.query[model]) {
149
150
  logger.error(`[# Drizzle Adapter]: The model "${model}" was not found in the query object. Please update your Drizzle schema to include relations or re-generate using "npx @better-auth/cli@latest generate".`);
150
151
  logger.info("Falling back to regular query");
151
152
  } else {
@@ -162,7 +163,7 @@ const drizzleAdapter = (db$1, config) => {
162
163
  if (!isUnique) pluralJoinResults.push(`${model$1}${pluralSuffix}`);
163
164
  }
164
165
  }
165
- const res$1 = await db$1$1.query[model].findFirst({
166
+ const res$1 = await db$1.query[model].findFirst({
166
167
  where: clause[0],
167
168
  with: includes
168
169
  });
@@ -173,7 +174,7 @@ const drizzleAdapter = (db$1, config) => {
173
174
  }
174
175
  return res$1;
175
176
  }
176
- const res = await db$1$1.select().from(schemaModel).where(...clause);
177
+ const res = await db$1.select().from(schemaModel).where(...clause);
177
178
  if (!res.length) return null;
178
179
  return res[0];
179
180
  },
@@ -181,7 +182,7 @@ const drizzleAdapter = (db$1, config) => {
181
182
  const schemaModel = getSchema(model);
182
183
  const clause = where ? convertWhereClause(where, model) : [];
183
184
  const sortFn = sortBy?.direction === "desc" ? desc : asc;
184
- if (options.experimental?.joins) if (!db$1$1.query[model]) {
185
+ if (options.experimental?.joins) if (!db$1.query[model]) {
185
186
  logger.error(`[# Drizzle Adapter]: The model "${model}" was not found in the query object. Please update your Drizzle schema to include relations or re-generate using "npx @better-auth/cli@latest generate".`);
186
187
  logger.info("Falling back to regular query");
187
188
  } else {
@@ -203,7 +204,7 @@ const drizzleAdapter = (db$1, config) => {
203
204
  model,
204
205
  field: sortBy?.field
205
206
  })])];
206
- let res = await db$1$1.query[model].findMany({
207
+ let res = await db$1.query[model].findMany({
207
208
  where: clause[0],
208
209
  with: includes,
209
210
  limit: limit ?? 100,
@@ -218,7 +219,7 @@ const drizzleAdapter = (db$1, config) => {
218
219
  }
219
220
  return res;
220
221
  }
221
- let builder = db$1$1.select().from(schemaModel);
222
+ let builder = db$1.select().from(schemaModel);
222
223
  const effectiveLimit = limit;
223
224
  const effectiveOffset = offset;
224
225
  if (typeof effectiveLimit !== "undefined") builder = builder.limit(effectiveLimit);
@@ -232,27 +233,27 @@ const drizzleAdapter = (db$1, config) => {
232
233
  async count({ model, where }) {
233
234
  const schemaModel = getSchema(model);
234
235
  const clause = where ? convertWhereClause(where, model) : [];
235
- return (await db$1$1.select({ count: count() }).from(schemaModel).where(...clause))[0].count;
236
+ return (await db$1.select({ count: count() }).from(schemaModel).where(...clause))[0].count;
236
237
  },
237
238
  async update({ model, where, update: values }) {
238
239
  const schemaModel = getSchema(model);
239
240
  const clause = convertWhereClause(where, model);
240
- return await withReturning(model, db$1$1.update(schemaModel).set(values).where(...clause), values, where);
241
+ return await withReturning(model, db$1.update(schemaModel).set(values).where(...clause), values, where);
241
242
  },
242
243
  async updateMany({ model, where, update: values }) {
243
244
  const schemaModel = getSchema(model);
244
245
  const clause = convertWhereClause(where, model);
245
- return await db$1$1.update(schemaModel).set(values).where(...clause);
246
+ return await db$1.update(schemaModel).set(values).where(...clause);
246
247
  },
247
248
  async delete({ model, where }) {
248
249
  const schemaModel = getSchema(model);
249
250
  const clause = convertWhereClause(where, model);
250
- return await db$1$1.delete(schemaModel).where(...clause);
251
+ return await db$1.delete(schemaModel).where(...clause);
251
252
  },
252
253
  async deleteMany({ model, where }) {
253
254
  const schemaModel = getSchema(model);
254
255
  const clause = convertWhereClause(where, model);
255
- const res = await db$1$1.delete(schemaModel).where(...clause);
256
+ const res = await db$1.delete(schemaModel).where(...clause);
256
257
  let count$1 = 0;
257
258
  if (res && "rowCount" in res) count$1 = res.rowCount;
258
259
  else if (Array.isArray(res)) count$1 = res.length;
@@ -275,7 +276,7 @@ const drizzleAdapter = (db$1, config) => {
275
276
  usePlural: config.usePlural ?? false,
276
277
  debugLogs: config.debugLogs ?? false,
277
278
  supportsUUIDs: config.provider === "pg" ? true : false,
278
- transaction: config.transaction ?? false ? (cb) => db$1.transaction((tx) => {
279
+ transaction: config.transaction ?? false ? (cb) => db.transaction((tx) => {
279
280
  return cb(createAdapterFactory({
280
281
  config: {
281
282
  ...adapterOptions.config,
@@ -286,7 +287,7 @@ const drizzleAdapter = (db$1, config) => {
286
287
  })(lazyOptions));
287
288
  }) : false
288
289
  },
289
- adapter: createCustomAdapter(db$1)
290
+ adapter: createCustomAdapter(db)
290
291
  };
291
292
  const adapter = createAdapterFactory(adapterOptions);
292
293
  return (options) => {
@@ -505,6 +506,8 @@ function createAuthSystem(options) {
505
506
  return betterAuth({
506
507
  plugins: [
507
508
  admin({ adminUserIds: ["user_cmhz0nka100003xv322cn6ffp"] }),
509
+ anonymous(),
510
+ phoneNumber(),
508
511
  apiKey(),
509
512
  organization({
510
513
  teams: { enabled: true },
@@ -552,6 +555,14 @@ function createAuthSystem(options) {
552
555
  emailAndPassword: {
553
556
  enabled: true,
554
557
  requireEmailVerification: true,
558
+ password: {
559
+ hash: async (password) => {
560
+ return await bcrypt.hash(password, 10);
561
+ },
562
+ verify: async ({ hash, password }) => {
563
+ return await bcrypt.compare(password, hash);
564
+ }
565
+ },
555
566
  sendResetPassword: async ({ user: user$1, url, token }, request) => {
556
567
  await sendEmail({
557
568
  to: user$1.email,
@@ -595,7 +606,27 @@ function createAuthSystem(options) {
595
606
  type: "string",
596
607
  defaultValue: "person"
597
608
  },
598
- actorId: { type: "string" }
609
+ actorId: { type: "string" },
610
+ userMetadata: {
611
+ type: "json",
612
+ required: false,
613
+ input: false
614
+ },
615
+ appMetadata: {
616
+ type: "json",
617
+ required: false,
618
+ input: false
619
+ },
620
+ invitedAt: {
621
+ type: "date",
622
+ required: false,
623
+ input: false
624
+ },
625
+ lastSignInAt: {
626
+ type: "date",
627
+ required: false,
628
+ input: false
629
+ }
599
630
  } },
600
631
  advanced: { database: { generateId: (options$1) => {
601
632
  return generatePrefixedId(options$1.model);
@@ -610,7 +641,7 @@ function createAuthSystem(options) {
610
641
  });
611
642
  }
612
643
  },
613
- database: drizzleAdapter(options.db ?? db, {
644
+ database: drizzleAdapter(options.db, {
614
645
  provider: "pg",
615
646
  schema: db_schema_final_exports,
616
647
  usePlural: false,
@@ -620,7 +651,6 @@ function createAuthSystem(options) {
620
651
  graph: { enabled: true }
621
652
  });
622
653
  }
623
- const auth = createAuthSystem({});
624
654
 
625
655
  //#endregion
626
- export { createAuthSystem as n, auth as t };
656
+ export { createAuthSystem as t };
@@ -1,3 +1,3 @@
1
- import "./db-BQg74X-T.mjs";
2
- import { n as createAuthSystem, t as auth } from "./better-auth-dl6JU4vx.mjs";
3
- export { auth, createAuthSystem };
1
+ import "./db-BO4CGoP4.mjs";
2
+ import { t as createAuthSystem } from "./better-auth-Bf2gcwDi.mjs";
3
+ export { createAuthSystem };
@@ -1,17 +1,17 @@
1
- import "./db-Bu7FlEtc.mjs";
1
+ import "./db-schema.generated-t7hCTMF5.mjs";
2
2
  import "./json-oFuWgANh-CZSe35mm.mjs";
3
3
  import "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
4
4
  import "./verify-BmFXks5a.mjs";
5
5
  import "./social-providers-DNfE9Ak7-DHuA3WFT.mjs";
6
- import "./plugins-C_-kHHzW.mjs";
6
+ import "./plugins-4UnCRez7.mjs";
7
7
  import "./esm-UlqE2SXT.mjs";
8
- import "./dialect-C6_pK3V9-CnxpsNGP.mjs";
8
+ import "./dialect-C6_pK3V9-CwYiGC9t.mjs";
9
9
  import "./dist-BidhxJQx.mjs";
10
10
  import "./misc-CbURQDlR-Dpe-5X_i.mjs";
11
11
  import "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
12
12
  import "./client--1_AEBPu-Dl2Y0Yen.mjs";
13
- import "./dist-DGeBMuXr.mjs";
13
+ import "./dist-Dt0ifDbX.mjs";
14
14
  import "./adapter-factory-BTRALCLD-Bv_0fQx-.mjs";
15
- import { n as createAuthSystem, t as auth } from "./better-auth-CgVuDqHf.mjs";
15
+ import { t as createAuthSystem } from "./better-auth-CJiGwyjC.mjs";
16
16
 
17
- export { auth, createAuthSystem };
17
+ export { createAuthSystem };
package/dist/client.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AuthClient } from "better-auth/react";
2
- import { adminClient, apiKeyClient, lastLoginMethodClient, organizationClient, twoFactorClient } from "better-auth/client/plugins";
2
+ import { adminClient, anonymousClient, apiKeyClient, lastLoginMethodClient, organizationClient, phoneNumberClient, twoFactorClient } from "better-auth/client/plugins";
3
3
  import { ssoClient } from "@better-auth/sso/client";
4
4
  export * from "better-auth/client/plugins";
5
5
 
@@ -11,7 +11,7 @@ declare const createEnterpriseClient: ({
11
11
  baseURL: string;
12
12
  }) => AuthClient<{
13
13
  baseURL: string;
14
- plugins: [ReturnType<typeof organizationClient>, ReturnType<typeof adminClient>, ReturnType<typeof apiKeyClient>, ReturnType<typeof ssoClient>, ReturnType<typeof twoFactorClient>, ReturnType<typeof lastLoginMethodClient>];
14
+ plugins: [ReturnType<typeof organizationClient>, ReturnType<typeof adminClient>, ReturnType<typeof apiKeyClient>, ReturnType<typeof ssoClient>, ReturnType<typeof twoFactorClient>, ReturnType<typeof anonymousClient>, ReturnType<typeof phoneNumberClient>, ReturnType<typeof lastLoginMethodClient>];
15
15
  }>;
16
16
  //#endregion
17
17
  export { createEnterpriseClient };
package/dist/client.mjs CHANGED
@@ -3,7 +3,7 @@ import "./dist-BidhxJQx.mjs";
3
3
  import "./misc-CbURQDlR-Dpe-5X_i.mjs";
4
4
  import "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
5
5
  import { i as hasPermission, n as adminAc, o as userAc, t as twoFactorClient } from "./client--1_AEBPu-Dl2Y0Yen.mjs";
6
- import { i as useAuthQuery, n as createAuthClient } from "./react-BZlUztTq.mjs";
6
+ import { i as useAuthQuery, n as createAuthClient } from "./react-DkVozQEM.mjs";
7
7
  import { atom } from "nanostores";
8
8
 
9
9
  //#region ../better-auth/dist/client/plugins/index.mjs
@@ -370,6 +370,8 @@ const createEnterpriseClient = ({ baseURL }) => {
370
370
  organizationClient(),
371
371
  adminClient(),
372
372
  apiKeyClient(),
373
+ anonymousClient(),
374
+ phoneNumberClient(),
373
375
  ssoClient(),
374
376
  twoFactorClient(),
375
377
  lastLoginMethodClient()
@@ -1,6 +1,6 @@
1
1
  import * as drizzle_orm0 from "drizzle-orm";
2
- import * as drizzle_orm_node_postgres0 from "drizzle-orm/node-postgres";
3
2
  import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
3
+ import * as drizzle_orm_node_postgres0 from "drizzle-orm/node-postgres";
4
4
  import * as pg0 from "pg";
5
5
 
6
6
  //#region src/db.d.ts
@@ -179,6 +179,57 @@ declare const schema: {
179
179
  identity: undefined;
180
180
  generated: undefined;
181
181
  }, {}, {}>;
182
+ isAnonymous: drizzle_orm_pg_core0.PgColumn<{
183
+ name: "is_anonymous";
184
+ tableName: "user";
185
+ dataType: "boolean";
186
+ columnType: "PgBoolean";
187
+ data: boolean;
188
+ driverParam: boolean;
189
+ notNull: false;
190
+ hasDefault: true;
191
+ isPrimaryKey: false;
192
+ isAutoincrement: false;
193
+ hasRuntimeDefault: false;
194
+ enumValues: undefined;
195
+ baseColumn: never;
196
+ identity: undefined;
197
+ generated: undefined;
198
+ }, {}, {}>;
199
+ phoneNumber: drizzle_orm_pg_core0.PgColumn<{
200
+ name: "phone_number";
201
+ tableName: "user";
202
+ dataType: "string";
203
+ columnType: "PgText";
204
+ data: string;
205
+ driverParam: string;
206
+ notNull: false;
207
+ hasDefault: false;
208
+ isPrimaryKey: false;
209
+ isAutoincrement: false;
210
+ hasRuntimeDefault: false;
211
+ enumValues: [string, ...string[]];
212
+ baseColumn: never;
213
+ identity: undefined;
214
+ generated: undefined;
215
+ }, {}, {}>;
216
+ phoneNumberVerified: drizzle_orm_pg_core0.PgColumn<{
217
+ name: "phone_number_verified";
218
+ tableName: "user";
219
+ dataType: "boolean";
220
+ columnType: "PgBoolean";
221
+ data: boolean;
222
+ driverParam: boolean;
223
+ notNull: false;
224
+ hasDefault: false;
225
+ isPrimaryKey: false;
226
+ isAutoincrement: false;
227
+ hasRuntimeDefault: false;
228
+ enumValues: undefined;
229
+ baseColumn: never;
230
+ identity: undefined;
231
+ generated: undefined;
232
+ }, {}, {}>;
182
233
  twoFactorEnabled: drizzle_orm_pg_core0.PgColumn<{
183
234
  name: "two_factor_enabled";
184
235
  tableName: "user";
@@ -230,6 +281,74 @@ declare const schema: {
230
281
  identity: undefined;
231
282
  generated: undefined;
232
283
  }, {}, {}>;
284
+ userMetadata: drizzle_orm_pg_core0.PgColumn<{
285
+ name: "user_metadata";
286
+ tableName: "user";
287
+ dataType: "json";
288
+ columnType: "PgJsonb";
289
+ data: unknown;
290
+ driverParam: unknown;
291
+ notNull: false;
292
+ hasDefault: false;
293
+ isPrimaryKey: false;
294
+ isAutoincrement: false;
295
+ hasRuntimeDefault: false;
296
+ enumValues: undefined;
297
+ baseColumn: never;
298
+ identity: undefined;
299
+ generated: undefined;
300
+ }, {}, {}>;
301
+ appMetadata: drizzle_orm_pg_core0.PgColumn<{
302
+ name: "app_metadata";
303
+ tableName: "user";
304
+ dataType: "json";
305
+ columnType: "PgJsonb";
306
+ data: unknown;
307
+ driverParam: unknown;
308
+ notNull: false;
309
+ hasDefault: false;
310
+ isPrimaryKey: false;
311
+ isAutoincrement: false;
312
+ hasRuntimeDefault: false;
313
+ enumValues: undefined;
314
+ baseColumn: never;
315
+ identity: undefined;
316
+ generated: undefined;
317
+ }, {}, {}>;
318
+ invitedAt: drizzle_orm_pg_core0.PgColumn<{
319
+ name: "invited_at";
320
+ tableName: "user";
321
+ dataType: "date";
322
+ columnType: "PgTimestamp";
323
+ data: Date;
324
+ driverParam: string;
325
+ notNull: false;
326
+ hasDefault: false;
327
+ isPrimaryKey: false;
328
+ isAutoincrement: false;
329
+ hasRuntimeDefault: false;
330
+ enumValues: undefined;
331
+ baseColumn: never;
332
+ identity: undefined;
333
+ generated: undefined;
334
+ }, {}, {}>;
335
+ lastSignInAt: drizzle_orm_pg_core0.PgColumn<{
336
+ name: "last_sign_in_at";
337
+ tableName: "user";
338
+ dataType: "date";
339
+ columnType: "PgTimestamp";
340
+ data: Date;
341
+ driverParam: string;
342
+ notNull: false;
343
+ hasDefault: false;
344
+ isPrimaryKey: false;
345
+ isAutoincrement: false;
346
+ hasRuntimeDefault: false;
347
+ enumValues: undefined;
348
+ baseColumn: never;
349
+ identity: undefined;
350
+ generated: undefined;
351
+ }, {}, {}>;
233
352
  };
234
353
  dialect: "pg";
235
354
  }>;
@@ -4770,7 +4889,7 @@ declare const schema: {
4770
4889
  user: drizzle_orm0.One<"user", false>;
4771
4890
  }>;
4772
4891
  };
4773
- declare const db: drizzle_orm_node_postgres0.NodePgDatabase<{
4892
+ declare const connection: (url: string) => drizzle_orm_node_postgres0.NodePgDatabase<{
4774
4893
  user: drizzle_orm_pg_core0.PgTableWithColumns<{
4775
4894
  name: "user";
4776
4895
  schema: "enterprise";
@@ -4945,6 +5064,57 @@ declare const db: drizzle_orm_node_postgres0.NodePgDatabase<{
4945
5064
  identity: undefined;
4946
5065
  generated: undefined;
4947
5066
  }, {}, {}>;
5067
+ isAnonymous: drizzle_orm_pg_core0.PgColumn<{
5068
+ name: "is_anonymous";
5069
+ tableName: "user";
5070
+ dataType: "boolean";
5071
+ columnType: "PgBoolean";
5072
+ data: boolean;
5073
+ driverParam: boolean;
5074
+ notNull: false;
5075
+ hasDefault: true;
5076
+ isPrimaryKey: false;
5077
+ isAutoincrement: false;
5078
+ hasRuntimeDefault: false;
5079
+ enumValues: undefined;
5080
+ baseColumn: never;
5081
+ identity: undefined;
5082
+ generated: undefined;
5083
+ }, {}, {}>;
5084
+ phoneNumber: drizzle_orm_pg_core0.PgColumn<{
5085
+ name: "phone_number";
5086
+ tableName: "user";
5087
+ dataType: "string";
5088
+ columnType: "PgText";
5089
+ data: string;
5090
+ driverParam: string;
5091
+ notNull: false;
5092
+ hasDefault: false;
5093
+ isPrimaryKey: false;
5094
+ isAutoincrement: false;
5095
+ hasRuntimeDefault: false;
5096
+ enumValues: [string, ...string[]];
5097
+ baseColumn: never;
5098
+ identity: undefined;
5099
+ generated: undefined;
5100
+ }, {}, {}>;
5101
+ phoneNumberVerified: drizzle_orm_pg_core0.PgColumn<{
5102
+ name: "phone_number_verified";
5103
+ tableName: "user";
5104
+ dataType: "boolean";
5105
+ columnType: "PgBoolean";
5106
+ data: boolean;
5107
+ driverParam: boolean;
5108
+ notNull: false;
5109
+ hasDefault: false;
5110
+ isPrimaryKey: false;
5111
+ isAutoincrement: false;
5112
+ hasRuntimeDefault: false;
5113
+ enumValues: undefined;
5114
+ baseColumn: never;
5115
+ identity: undefined;
5116
+ generated: undefined;
5117
+ }, {}, {}>;
4948
5118
  twoFactorEnabled: drizzle_orm_pg_core0.PgColumn<{
4949
5119
  name: "two_factor_enabled";
4950
5120
  tableName: "user";
@@ -4996,6 +5166,74 @@ declare const db: drizzle_orm_node_postgres0.NodePgDatabase<{
4996
5166
  identity: undefined;
4997
5167
  generated: undefined;
4998
5168
  }, {}, {}>;
5169
+ userMetadata: drizzle_orm_pg_core0.PgColumn<{
5170
+ name: "user_metadata";
5171
+ tableName: "user";
5172
+ dataType: "json";
5173
+ columnType: "PgJsonb";
5174
+ data: unknown;
5175
+ driverParam: unknown;
5176
+ notNull: false;
5177
+ hasDefault: false;
5178
+ isPrimaryKey: false;
5179
+ isAutoincrement: false;
5180
+ hasRuntimeDefault: false;
5181
+ enumValues: undefined;
5182
+ baseColumn: never;
5183
+ identity: undefined;
5184
+ generated: undefined;
5185
+ }, {}, {}>;
5186
+ appMetadata: drizzle_orm_pg_core0.PgColumn<{
5187
+ name: "app_metadata";
5188
+ tableName: "user";
5189
+ dataType: "json";
5190
+ columnType: "PgJsonb";
5191
+ data: unknown;
5192
+ driverParam: unknown;
5193
+ notNull: false;
5194
+ hasDefault: false;
5195
+ isPrimaryKey: false;
5196
+ isAutoincrement: false;
5197
+ hasRuntimeDefault: false;
5198
+ enumValues: undefined;
5199
+ baseColumn: never;
5200
+ identity: undefined;
5201
+ generated: undefined;
5202
+ }, {}, {}>;
5203
+ invitedAt: drizzle_orm_pg_core0.PgColumn<{
5204
+ name: "invited_at";
5205
+ tableName: "user";
5206
+ dataType: "date";
5207
+ columnType: "PgTimestamp";
5208
+ data: Date;
5209
+ driverParam: string;
5210
+ notNull: false;
5211
+ hasDefault: false;
5212
+ isPrimaryKey: false;
5213
+ isAutoincrement: false;
5214
+ hasRuntimeDefault: false;
5215
+ enumValues: undefined;
5216
+ baseColumn: never;
5217
+ identity: undefined;
5218
+ generated: undefined;
5219
+ }, {}, {}>;
5220
+ lastSignInAt: drizzle_orm_pg_core0.PgColumn<{
5221
+ name: "last_sign_in_at";
5222
+ tableName: "user";
5223
+ dataType: "date";
5224
+ columnType: "PgTimestamp";
5225
+ data: Date;
5226
+ driverParam: string;
5227
+ notNull: false;
5228
+ hasDefault: false;
5229
+ isPrimaryKey: false;
5230
+ isAutoincrement: false;
5231
+ hasRuntimeDefault: false;
5232
+ enumValues: undefined;
5233
+ baseColumn: never;
5234
+ identity: undefined;
5235
+ generated: undefined;
5236
+ }, {}, {}>;
4999
5237
  };
5000
5238
  dialect: "pg";
5001
5239
  }>;
@@ -9538,5 +9776,6 @@ declare const db: drizzle_orm_node_postgres0.NodePgDatabase<{
9538
9776
  }> & {
9539
9777
  $client: pg0.Pool;
9540
9778
  };
9779
+ type Connection = ReturnType<typeof connection>;
9541
9780
  //#endregion
9542
- export { schema as n, db as t };
9781
+ export { connection as n, schema as r, Connection as t };
@@ -0,0 +1,15 @@
1
+ import { _ as db_schema_generated_exports, ot as __export, st as __reExport } from "./db-schema.generated-t7hCTMF5.mjs";
2
+ import { drizzle } from "drizzle-orm/node-postgres";
3
+
4
+ //#region src/db.ts
5
+ var db_exports = /* @__PURE__ */ __export({
6
+ connection: () => connection,
7
+ schema: () => schema
8
+ });
9
+ import * as import_drizzle_orm_node_postgres from "drizzle-orm/node-postgres";
10
+ __reExport(db_exports, import_drizzle_orm_node_postgres);
11
+ const schema = { ...db_schema_generated_exports };
12
+ const connection = (url) => drizzle(url + "?options=-c search_path=enterprise", { schema });
13
+
14
+ //#endregion
15
+ export { db_exports as n, schema as r, connection as t };
@@ -1,9 +1,11 @@
1
1
  import { relations } from "drizzle-orm";
2
- import { drizzle } from "drizzle-orm/node-postgres";
3
2
  import { boolean, index, integer, jsonb, pgSchema, text, timestamp } from "drizzle-orm/pg-core";
4
3
 
5
4
  //#region rolldown:runtime
6
5
  var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (all, symbols) => {
8
10
  let target = {};
9
11
  for (var name in all) {
@@ -17,6 +19,27 @@ var __export = (all, symbols) => {
17
19
  }
18
20
  return target;
19
21
  };
22
+ var __copyProps = (to, from, except, desc$1) => {
23
+ if (from && typeof from === "object" || typeof from === "function") {
24
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
25
+ key = keys[i];
26
+ if (!__hasOwnProp.call(to, key) && key !== except) {
27
+ __defProp(to, key, {
28
+ get: ((k) => from[k]).bind(null, key),
29
+ enumerable: !(desc$1 = __getOwnPropDesc(from, key)) || desc$1.enumerable
30
+ });
31
+ }
32
+ }
33
+ }
34
+ return to;
35
+ };
36
+ var __reExport = (target, mod, secondTarget, symbols) => {
37
+ if (symbols) {
38
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
39
+ secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
40
+ }
41
+ __copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
42
+ };
20
43
 
21
44
  //#endregion
22
45
  //#region src/db-schema.default.ts
@@ -94,9 +117,16 @@ const user = enterpriseSchema.table("user", {
94
117
  banned: boolean("banned").default(false),
95
118
  banReason: text("ban_reason"),
96
119
  banExpires: timestamp("ban_expires"),
120
+ isAnonymous: boolean("is_anonymous").default(false),
121
+ phoneNumber: text("phone_number").unique(),
122
+ phoneNumberVerified: boolean("phone_number_verified"),
97
123
  twoFactorEnabled: boolean("two_factor_enabled").default(false),
98
124
  actorType: text("actor_type").default("person"),
99
- actorId: text("actor_id")
125
+ actorId: text("actor_id"),
126
+ userMetadata: jsonb("user_metadata"),
127
+ appMetadata: jsonb("app_metadata"),
128
+ invitedAt: timestamp("invited_at"),
129
+ lastSignInAt: timestamp("last_sign_in_at")
100
130
  });
101
131
  const session = enterpriseSchema.table("session", {
102
132
  id: text("id").primaryKey(),
@@ -668,9 +698,4 @@ const schemaDefinitionRelations = relations(schemaDefinition, ({ one }) => ({ us
668
698
  }) }));
669
699
 
670
700
  //#endregion
671
- //#region src/db.ts
672
- const schema = { ...db_schema_generated_exports };
673
- const db = drizzle(process.env.DATABASE_URL + "?options=-c search_path=enterprise", { schema });
674
-
675
- //#endregion
676
- export { teamRole as $, oauthAccessTokenRelations as A, organizationRoleRelations as B, memberAssetRoleRelations as C, memberTeamRole as D, memberRelations as E, object as F, schemaDefinition as G, platformRole as H, objectRelations as I, sessionRelations as J, schemaDefinitionRelations as K, organization as L, oauthApplicationRelations as M, oauthConsent as N, memberTeamRoleRelations as O, oauthConsentRelations as P, teamRelations as Q, organizationRelations as R, memberAssetRole as S, memberOrganizationRoleRelations as T, relationship as U, person as V, relationshipRelations as W, teamMember as X, team as Y, teamMemberRelations as Z, assetType as _, agent as a, verification as at, invitationRelations as b, apikeyRelations as c, assetRole as d, teamRoleRelations as et, assetRoleRelations as f, assetShareRelations as g, assetShareLinkRelations as h, accountRelations as i, userRelations as it, oauthApplication as j, oauthAccessToken as k, asset as l, assetShareLink as m, schema as n, twoFactorRelations as nt, agentRelations as o, enterpriseSchema as ot, assetShare as p, session as q, account as r, user as rt, apikey as s, __export as st, db as t, twoFactor as tt, assetRelations as u, assetTypeRelations as v, memberOrganizationRole as w, member as x, invitation as y, organizationRole as z };
701
+ export { teamRoleRelations as $, oauthApplication as A, person as B, memberOrganizationRole as C, memberTeamRoleRelations as D, memberTeamRole as E, objectRelations as F, schemaDefinitionRelations as G, relationship as H, organization as I, team as J, session as K, organizationRelations as L, oauthConsent as M, oauthConsentRelations as N, oauthAccessToken as O, object as P, teamRole as Q, organizationRole as R, memberAssetRoleRelations as S, memberRelations as T, relationshipRelations as U, platformRole as V, schemaDefinition as W, teamMemberRelations as X, teamMember as Y, teamRelations as Z, db_schema_generated_exports as _, apikey as a, enterpriseSchema as at, member as b, assetRelations as c, assetShare as d, twoFactor as et, assetShareLink as f, assetTypeRelations as g, assetType as h, agentRelations as i, verification as it, oauthApplicationRelations as j, oauthAccessTokenRelations as k, assetRole as l, assetShareRelations as m, accountRelations as n, user as nt, apikeyRelations as o, __export as ot, assetShareLinkRelations as p, sessionRelations as q, agent as r, userRelations as rt, asset as s, __reExport as st, account as t, twoFactorRelations as tt, assetRoleRelations as u, invitation as v, memberOrganizationRoleRelations as w, memberAssetRole as x, invitationRelations as y, organizationRoleRelations as z };
package/dist/db.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { n as schema, t as db } from "./db-BQg74X-T.mjs";
1
+ import { n as connection, r as schema, t as Connection } from "./db-BO4CGoP4.mjs";
2
2
  export * from "drizzle-orm/node-postgres";
3
- export { db, schema };
3
+ export { Connection, connection, schema };
package/dist/db.mjs CHANGED
@@ -1,5 +1,6 @@
1
- import { n as schema, t as db } from "./db-Bu7FlEtc.mjs";
1
+ import "./db-schema.generated-t7hCTMF5.mjs";
2
+ import { r as schema, t as connection } from "./db-CZhOn-9W.mjs";
2
3
 
3
4
  export * from "drizzle-orm/node-postgres"
4
5
 
5
- export { db, schema };
6
+ export { connection, schema };
@@ -41,7 +41,7 @@ const createKyselyAdapter = async (config) => {
41
41
  if ("getConnection" in db) dialect = new MysqlDialect(db);
42
42
  if ("connect" in db) dialect = new PostgresDialect({ pool: db });
43
43
  if ("fileControl" in db) {
44
- const { BunSqliteDialect } = await import("./bun-sqlite-dialect-2R9nCsVF-Bnna8w0Z.mjs");
44
+ const { BunSqliteDialect } = await import("./bun-sqlite-dialect-2R9nCsVF-CnQcwp5D.mjs");
45
45
  dialect = new BunSqliteDialect({ database: db });
46
46
  }
47
47
  if ("createSession" in db && typeof window === "undefined") {
@@ -57,7 +57,7 @@ const createKyselyAdapter = async (config) => {
57
57
  if (error !== null && typeof error === "object" && "code" in error && error.code !== "ERR_UNKNOWN_BUILTIN_MODULE") throw error;
58
58
  }
59
59
  if (DatabaseSync && db instanceof DatabaseSync) {
60
- const { NodeSqliteDialect } = await import("./node-sqlite-dialect-CdC7L-ji-CIdCw4_X.mjs");
60
+ const { NodeSqliteDialect } = await import("./node-sqlite-dialect-CdC7L-ji-Q1IU8C2u.mjs");
61
61
  dialect = new NodeSqliteDialect({ database: db });
62
62
  }
63
63
  }
@@ -2,8 +2,8 @@ import { c as generateId, f as createHash, h as hashPassword, n as getAuthTables
2
2
  import { a as getBooleanEnvVar, f as logger, g as BetterAuthError, h as BASE_ERROR_CODES, i as env, l as isProduction, r as createLogger, s as getEnvVar, t as ENV, u as isTest } from "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
3
3
  import { H as base64 } from "./verify-BmFXks5a.mjs";
4
4
  import { z as socialProviders } from "./social-providers-DNfE9Ak7-DHuA3WFT.mjs";
5
- import { N as createGraphAdapter, _t as createInternalAdapter, at as checkEndpointConflicts, ct as defu, lt as createCookieGetter, nt as checkPassword, ot as getEndpoints, st as router, ut as getCookies, vt as getAdapter, yt as getMigrations } from "./plugins-C_-kHHzW.mjs";
6
- import { n as getKyselyDatabaseType } from "./dialect-C6_pK3V9-CnxpsNGP.mjs";
5
+ import { N as createGraphAdapter, _t as createInternalAdapter, at as checkEndpointConflicts, ct as defu, lt as createCookieGetter, nt as checkPassword, ot as getEndpoints, st as router, ut as getCookies, vt as getAdapter, yt as getMigrations } from "./plugins-4UnCRez7.mjs";
6
+ import { n as getKyselyDatabaseType } from "./dialect-C6_pK3V9-CwYiGC9t.mjs";
7
7
  import { t as betterFetch } from "./dist-BidhxJQx.mjs";
8
8
  import { a as getOrigin, r as getBaseURL } from "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
9
9
 
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { t as db } from "./db-BQg74X-T.mjs";
2
- import { n as createAuthSystem } from "./better-auth-dl6JU4vx.mjs";
1
+ import "./db-BO4CGoP4.mjs";
2
+ import { t as createAuthSystem } from "./better-auth-Bf2gcwDi.mjs";
3
3
  import { parseSetCookieHeader } from "better-auth/cookies";
4
4
  export * from "better-auth";
5
5
  export * from "better-auth/crypto";
6
- export { createAuthSystem, db as enterpriseDB, parseSetCookieHeader };
6
+ export { createAuthSystem, parseSetCookieHeader };
package/dist/index.mjs CHANGED
@@ -1,17 +1,17 @@
1
- import { t as db } from "./db-Bu7FlEtc.mjs";
1
+ import "./db-schema.generated-t7hCTMF5.mjs";
2
2
  import { C as symmetricEncodeJWT, G as getCurrentTransactionAdapter, H as getCurrentAdapter, S as symmetricDecodeJWT, W as getCurrentGraphContext, _ as symmetricEncrypt, c as generateId, d as constantTimeEqual, g as symmetricDecrypt, h as hashPassword, l as generateState, m as generateRandomString, s as HIDE_METADATA, u as parseState, v as verifyPassword, w as verifyJWT, x as signJWT } from "./json-oFuWgANh-CZSe35mm.mjs";
3
3
  import { _ as defineErrorCodes, a as getBooleanEnvVar, c as isDevelopment, d as levels, f as logger, g as BetterAuthError, h as BASE_ERROR_CODES, i as env, l as isProduction, m as shouldPublishLog, n as TTY_COLORS, o as getColorDepth, p as nodeENV, r as createLogger, s as getEnvVar, t as ENV, u as isTest, v as invariant } from "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
4
4
  import "./verify-BmFXks5a.mjs";
5
5
  import { G as validateToken, P as refreshAccessToken, W as validateAuthorizationCode, _ as getOAuth2Tokens, c as createClientCredentialsTokenRequest, i as clientCredentialsToken, l as createRefreshAccessTokenRequest, m as generateCodeChallenge, o as createAuthorizationCodeRequest, s as createAuthorizationURL } from "./social-providers-DNfE9Ak7-DHuA3WFT.mjs";
6
- import { Ct as verificationSchema, L as initializeGraph, St as userSchema, bt as rateLimitSchema, dt as parseSetCookieHeader, gt as coreSchema, ht as accountSchema, it as APIError$1, xt as sessionSchema } from "./plugins-C_-kHHzW.mjs";
6
+ import { Ct as verificationSchema, L as initializeGraph, St as userSchema, bt as rateLimitSchema, dt as parseSetCookieHeader, gt as coreSchema, ht as accountSchema, it as APIError$1, xt as sessionSchema } from "./plugins-4UnCRez7.mjs";
7
7
  import "./esm-UlqE2SXT.mjs";
8
- import "./dialect-C6_pK3V9-CnxpsNGP.mjs";
8
+ import "./dialect-C6_pK3V9-CwYiGC9t.mjs";
9
9
  import "./dist-BidhxJQx.mjs";
10
10
  import { t as capitalizeFirstLetter } from "./misc-CbURQDlR-Dpe-5X_i.mjs";
11
11
  import "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
12
12
  import "./client--1_AEBPu-Dl2Y0Yen.mjs";
13
- import { n as createTelemetry, r as getTelemetryAuthConfig, t as betterAuth } from "./dist-DGeBMuXr.mjs";
13
+ import { n as createTelemetry, r as getTelemetryAuthConfig, t as betterAuth } from "./dist-Dt0ifDbX.mjs";
14
14
  import "./adapter-factory-BTRALCLD-Bv_0fQx-.mjs";
15
- import { n as createAuthSystem } from "./better-auth-CgVuDqHf.mjs";
15
+ import { t as createAuthSystem } from "./better-auth-CJiGwyjC.mjs";
16
16
 
17
- export { APIError$1 as APIError, BASE_ERROR_CODES, BetterAuthError, ENV, HIDE_METADATA, TTY_COLORS, accountSchema, betterAuth, capitalizeFirstLetter, clientCredentialsToken, constantTimeEqual, coreSchema, createAuthSystem, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createLogger, createRefreshAccessTokenRequest, createTelemetry, defineErrorCodes, db as enterpriseDB, env, generateCodeChallenge, generateId, generateRandomString, generateState, getBooleanEnvVar, getColorDepth, getCurrentAdapter, getCurrentGraphContext, getCurrentTransactionAdapter, getEnvVar, getOAuth2Tokens, getTelemetryAuthConfig, hashPassword, initializeGraph, invariant, isDevelopment, isProduction, isTest, levels, logger, nodeENV, parseSetCookieHeader, parseState, rateLimitSchema, refreshAccessToken, sessionSchema, shouldPublishLog, signJWT, symmetricDecodeJWT, symmetricDecrypt, symmetricEncodeJWT, symmetricEncrypt, userSchema, validateAuthorizationCode, validateToken, verificationSchema, verifyJWT, verifyPassword };
17
+ export { APIError$1 as APIError, BASE_ERROR_CODES, BetterAuthError, ENV, HIDE_METADATA, TTY_COLORS, accountSchema, betterAuth, capitalizeFirstLetter, clientCredentialsToken, constantTimeEqual, coreSchema, createAuthSystem, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createLogger, createRefreshAccessTokenRequest, createTelemetry, defineErrorCodes, env, generateCodeChallenge, generateId, generateRandomString, generateState, getBooleanEnvVar, getColorDepth, getCurrentAdapter, getCurrentGraphContext, getCurrentTransactionAdapter, getEnvVar, getOAuth2Tokens, getTelemetryAuthConfig, hashPassword, initializeGraph, invariant, isDevelopment, isProduction, isTest, levels, logger, nodeENV, parseSetCookieHeader, parseState, rateLimitSchema, refreshAccessToken, sessionSchema, shouldPublishLog, signJWT, symmetricDecodeJWT, symmetricDecrypt, symmetricEncodeJWT, symmetricEncrypt, userSchema, validateAuthorizationCode, validateToken, verificationSchema, verifyJWT, verifyPassword };
package/dist/init.mjs CHANGED
@@ -2,14 +2,14 @@ import "./json-oFuWgANh-CZSe35mm.mjs";
2
2
  import "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
3
3
  import "./verify-BmFXks5a.mjs";
4
4
  import "./social-providers-DNfE9Ak7-DHuA3WFT.mjs";
5
- import { G as AuthzedSyncClient, L as initializeGraph } from "./plugins-C_-kHHzW.mjs";
5
+ import { G as AuthzedSyncClient, L as initializeGraph } from "./plugins-4UnCRez7.mjs";
6
6
  import "./esm-UlqE2SXT.mjs";
7
- import "./dialect-C6_pK3V9-CnxpsNGP.mjs";
7
+ import "./dialect-C6_pK3V9-CwYiGC9t.mjs";
8
8
  import "./dist-BidhxJQx.mjs";
9
9
  import "./misc-CbURQDlR-Dpe-5X_i.mjs";
10
10
  import "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
11
11
  import "./client--1_AEBPu-Dl2Y0Yen.mjs";
12
- import "./dist-DGeBMuXr.mjs";
12
+ import "./dist-Dt0ifDbX.mjs";
13
13
  import { readFile } from "fs/promises";
14
14
 
15
15
  //#region src/init.ts
@@ -2,7 +2,7 @@ import "./json-oFuWgANh-CZSe35mm.mjs";
2
2
  import "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
3
3
  import "./verify-BmFXks5a.mjs";
4
4
  import { l as sql } from "./esm-UlqE2SXT.mjs";
5
- import { n as getKyselyDatabaseType, t as createKyselyAdapter } from "./dialect-C6_pK3V9-CnxpsNGP.mjs";
5
+ import { n as getKyselyDatabaseType, t as createKyselyAdapter } from "./dialect-C6_pK3V9-CwYiGC9t.mjs";
6
6
  import "./misc-CbURQDlR-Dpe-5X_i.mjs";
7
7
  import { t as createAdapterFactory } from "./adapter-factory-BTRALCLD-Bv_0fQx-.mjs";
8
8
 
@@ -3,7 +3,7 @@ import { _ as defineErrorCodes, c as isDevelopment, f as logger, g as BetterAuth
3
3
  import { C as JOSENotSupported, H as base64, N as JWTExpired, U as base64Url, d as importJWK, t as jwtVerify } from "./verify-BmFXks5a.mjs";
4
4
  import { J as decodeJwt, P as refreshAccessToken, W as validateAuthorizationCode, Y as createRemoteJWKSet, s as createAuthorizationURL, t as SocialProviderListEnum } from "./social-providers-DNfE9Ak7-DHuA3WFT.mjs";
5
5
  import { l as sql$1 } from "./esm-UlqE2SXT.mjs";
6
- import { t as createKyselyAdapter } from "./dialect-C6_pK3V9-CnxpsNGP.mjs";
6
+ import { t as createKyselyAdapter } from "./dialect-C6_pK3V9-CwYiGC9t.mjs";
7
7
  import { t as betterFetch } from "./dist-BidhxJQx.mjs";
8
8
  import { a as getOrigin, i as getHost, n as parser_default, o as getProtocol, r as getBaseURL, t as parseJSON } from "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
9
9
  import { a as role, i as hasPermission } from "./client--1_AEBPu-Dl2Y0Yen.mjs";
@@ -294,7 +294,7 @@ async function getBaseAdapter(options, handleDirectDatabase) {
294
294
  acc[key] = [];
295
295
  return acc;
296
296
  }, {});
297
- const { memoryAdapter } = await import("./memory-adapter-Cqp5pNDz.mjs");
297
+ const { memoryAdapter } = await import("./memory-adapter-DBNi0Kds.mjs");
298
298
  adapter = memoryAdapter(memoryDB)(options);
299
299
  } else if (typeof options.database === "function") adapter = options.database(options);
300
300
  else adapter = await handleDirectDatabase(options);
@@ -308,10 +308,10 @@ async function getBaseAdapter(options, handleDirectDatabase) {
308
308
  }
309
309
  async function getAdapter(options) {
310
310
  return getBaseAdapter(options, async (opts) => {
311
- const { createKyselyAdapter: createKyselyAdapter$1 } = await import("./kysely-adapter-BJCvIqXV.mjs");
311
+ const { createKyselyAdapter: createKyselyAdapter$1 } = await import("./kysely-adapter-uZQ9e2n3.mjs");
312
312
  const { kysely, databaseType, transaction } = await createKyselyAdapter$1(opts);
313
313
  if (!kysely) throw new BetterAuthError("Failed to initialize database adapter");
314
- const { kyselyAdapter } = await import("./kysely-adapter-BJCvIqXV.mjs");
314
+ const { kyselyAdapter } = await import("./kysely-adapter-uZQ9e2n3.mjs");
315
315
  return kyselyAdapter(kysely, {
316
316
  type: databaseType || "sqlite",
317
317
  debugLogs: opts.database && "debugLogs" in opts.database ? opts.database.debugLogs : false,
package/dist/plugins.mjs CHANGED
@@ -2,9 +2,9 @@ import { s as HIDE_METADATA } from "./json-oFuWgANh-CZSe35mm.mjs";
2
2
  import "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
3
3
  import "./verify-BmFXks5a.mjs";
4
4
  import "./social-providers-DNfE9Ak7-DHuA3WFT.mjs";
5
- import { $ as jwt, A as apiKey, B as oAuthDiscoveryMetadata, C as captcha, D as API_KEY_TABLE_NAME, E as admin, F as getMCPProtectedResourceMetadata, G as AuthzedSyncClient, H as oneTimeToken, I as getMCPProviderMetadata, J as getMetadata, K as graph, M as assetsClient, O as ERROR_CODES, P as defaultKeyHasher, Q as getJwtToken, R as lastLoginMethod, S as customSession, T as anonymous, U as organization, V as oAuthProtectedResourceMetadata, W as withMcpAuth, X as createJwk, Y as oidcProvider, Z as generateExportedKeyPair, _ as okta, a as openAPI, b as deviceAuthorization, c as multiSession, d as auth0, et as verifyJWT, f as genericOAuth, ft as createAuthEndpoint, g as microsoftEntraId, h as line, i as phoneNumber, j as assets, k as agents, l as magicLink, m as keycloak, mt as optionsMiddleware, n as username, o as oneTap, p as hubspot, pt as createAuthMiddleware, q as getClient, r as siwe, rt as twoFactor, s as oAuthProxy, t as USERNAME_ERROR_CODES, tt as TWO_FACTOR_ERROR_CODES, u as haveIBeenPwned, v as slack, w as bearer, x as deviceAuthorizationOptionsSchema, y as emailOTP, z as mcp } from "./plugins-C_-kHHzW.mjs";
5
+ import { $ as jwt, A as apiKey, B as oAuthDiscoveryMetadata, C as captcha, D as API_KEY_TABLE_NAME, E as admin, F as getMCPProtectedResourceMetadata, G as AuthzedSyncClient, H as oneTimeToken, I as getMCPProviderMetadata, J as getMetadata, K as graph, M as assetsClient, O as ERROR_CODES, P as defaultKeyHasher, Q as getJwtToken, R as lastLoginMethod, S as customSession, T as anonymous, U as organization, V as oAuthProtectedResourceMetadata, W as withMcpAuth, X as createJwk, Y as oidcProvider, Z as generateExportedKeyPair, _ as okta, a as openAPI, b as deviceAuthorization, c as multiSession, d as auth0, et as verifyJWT, f as genericOAuth, ft as createAuthEndpoint, g as microsoftEntraId, h as line, i as phoneNumber, j as assets, k as agents, l as magicLink, m as keycloak, mt as optionsMiddleware, n as username, o as oneTap, p as hubspot, pt as createAuthMiddleware, q as getClient, r as siwe, rt as twoFactor, s as oAuthProxy, t as USERNAME_ERROR_CODES, tt as TWO_FACTOR_ERROR_CODES, u as haveIBeenPwned, v as slack, w as bearer, x as deviceAuthorizationOptionsSchema, y as emailOTP, z as mcp } from "./plugins-4UnCRez7.mjs";
6
6
  import "./esm-UlqE2SXT.mjs";
7
- import "./dialect-C6_pK3V9-CnxpsNGP.mjs";
7
+ import "./dialect-C6_pK3V9-CwYiGC9t.mjs";
8
8
  import "./dist-BidhxJQx.mjs";
9
9
  import "./misc-CbURQDlR-Dpe-5X_i.mjs";
10
10
  import "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
package/dist/react.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
2
2
  import "./dist-BidhxJQx.mjs";
3
3
  import "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
4
- import { n as createAuthClient, r as useStore, t as capitalizeFirstLetter } from "./react-BZlUztTq.mjs";
4
+ import { n as createAuthClient, r as useStore, t as capitalizeFirstLetter } from "./react-DkVozQEM.mjs";
5
5
 
6
6
  export { capitalizeFirstLetter, createAuthClient, useStore };
package/dist/server.mjs CHANGED
@@ -1,18 +1,19 @@
1
- import { t as db } from "./db-Bu7FlEtc.mjs";
1
+ import "./db-schema.generated-t7hCTMF5.mjs";
2
2
  import "./json-oFuWgANh-CZSe35mm.mjs";
3
3
  import "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
4
4
  import "./verify-BmFXks5a.mjs";
5
5
  import "./social-providers-DNfE9Ak7-DHuA3WFT.mjs";
6
- import "./plugins-C_-kHHzW.mjs";
6
+ import "./plugins-4UnCRez7.mjs";
7
7
  import "./esm-UlqE2SXT.mjs";
8
- import "./dialect-C6_pK3V9-CnxpsNGP.mjs";
8
+ import "./dialect-C6_pK3V9-CwYiGC9t.mjs";
9
9
  import "./dist-BidhxJQx.mjs";
10
10
  import "./misc-CbURQDlR-Dpe-5X_i.mjs";
11
11
  import "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
12
12
  import "./client--1_AEBPu-Dl2Y0Yen.mjs";
13
- import "./dist-DGeBMuXr.mjs";
13
+ import "./dist-Dt0ifDbX.mjs";
14
14
  import "./adapter-factory-BTRALCLD-Bv_0fQx-.mjs";
15
- import { t as auth } from "./better-auth-CgVuDqHf.mjs";
15
+ import { t as createAuthSystem } from "./better-auth-CJiGwyjC.mjs";
16
+ import { n as db_exports, r as schema } from "./db-CZhOn-9W.mjs";
16
17
  import "dotenv/config";
17
18
  import { cors } from "@elysiajs/cors";
18
19
  import { jwt } from "@elysiajs/jwt";
@@ -21,6 +22,8 @@ import { migrate } from "drizzle-orm/node-postgres/migrator";
21
22
  import { Elysia } from "elysia";
22
23
 
23
24
  //#region src/server.ts
25
+ const db = (0, db_exports.drizzle)(process.env.DATABASE_URL + "?options=-c search_path=enterprise", { schema });
26
+ const auth = createAuthSystem({ db });
24
27
  await migrate(db, {
25
28
  migrationsFolder: "./drizzle",
26
29
  migrationsSchema: "enterprise",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rio.js/enterprise",
3
- "version": "1.4.4",
3
+ "version": "1.4.6",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "srvx --import=jiti/register --port 3001",
@@ -15,12 +15,14 @@
15
15
  "@elysiajs/cors": "^1.4.0",
16
16
  "@elysiajs/jwt": "^1.4.0",
17
17
  "@elysiajs/openapi": "^1.4.11",
18
+ "bcrypt": "^6.0.0",
18
19
  "better-call": "^1.0.26",
19
20
  "cuid": "^3.0.0",
20
21
  "dotenv": "^17.2.3",
21
22
  "drizzle-orm": "^0.44.7",
22
23
  "elysia": "latest",
23
24
  "nanostores": "^1.0.1",
25
+ "npm": "^11.7.0",
24
26
  "pg": "^8.16.3",
25
27
  "resend": "^6.4.2",
26
28
  "zod": "^4.1.12",
@@ -29,12 +31,13 @@
29
31
  "devDependencies": {
30
32
  "@better-auth/cli": "workspace:*",
31
33
  "@better-auth/core": "workspace:*",
32
- "jiti": "^2.6.1",
33
34
  "@better-auth/sso": "workspace:*",
34
- "better-auth": "workspace:*",
35
+ "@types/bcrypt": "^6.0.0",
35
36
  "@types/pg": "^8.15.6",
37
+ "better-auth": "workspace:*",
36
38
  "bun-types": "latest",
37
39
  "drizzle-kit": "^0.31.6",
40
+ "jiti": "^2.6.1",
38
41
  "srvx": "^0.9.6",
39
42
  "tsdown": "latest"
40
43
  },
@@ -1,12 +0,0 @@
1
- import { t as db } from "./db-BQg74X-T.mjs";
2
- import * as better_auth0 from "better-auth";
3
- import { BetterAuthPlugin, betterAuth } from "better-auth";
4
-
5
- //#region src/better-auth.d.ts
6
- declare function createAuthSystem(options: {
7
- plugins?: BetterAuthPlugin[];
8
- db?: typeof db;
9
- }): ReturnType<typeof betterAuth>;
10
- declare const auth: better_auth0.Auth<better_auth0.BetterAuthOptions>;
11
- //#endregion
12
- export { createAuthSystem as n, auth as t };
File without changes