better-auth 1.2.1-beta.5 → 1.2.1-beta.7

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.
@@ -3,7 +3,7 @@ import { atom } from 'nanostores';
3
3
  import { AccessControl, Role, Statements, Subset, AuthortizeResponse } from '../../plugins/access/index.cjs';
4
4
  import * as _better_fetch_fetch from '@better-fetch/fetch';
5
5
  import { BetterFetch, BetterFetchOption } from '@better-fetch/fetch';
6
- import { o as organization, I as InferMember, a as InferInvitation, T as Team, b as Organization, M as Member, c as Invitation } from '../../shared/better-auth.BjLde38z.cjs';
6
+ import { o as organization, I as InferMember, a as InferInvitation, T as Team, b as Organization, M as Member, c as Invitation } from '../../shared/better-auth.BSGhjwQl.cjs';
7
7
  import { b as Prettify } from '../../shared/better-auth.Bi8FQwDD.cjs';
8
8
  import { username } from '../../plugins/username/index.cjs';
9
9
  import { Passkey, passkey } from '../../plugins/passkey/index.cjs';
@@ -3,7 +3,7 @@ import { atom } from 'nanostores';
3
3
  import { AccessControl, Role, Statements, Subset, AuthortizeResponse } from '../../plugins/access/index.mjs';
4
4
  import * as _better_fetch_fetch from '@better-fetch/fetch';
5
5
  import { BetterFetch, BetterFetchOption } from '@better-fetch/fetch';
6
- import { o as organization, I as InferMember, a as InferInvitation, T as Team, b as Organization, M as Member, c as Invitation } from '../../shared/better-auth.BtbcLXIn.mjs';
6
+ import { o as organization, I as InferMember, a as InferInvitation, T as Team, b as Organization, M as Member, c as Invitation } from '../../shared/better-auth.Do86a39J.mjs';
7
7
  import { b as Prettify } from '../../shared/better-auth.Bi8FQwDD.mjs';
8
8
  import { username } from '../../plugins/username/index.mjs';
9
9
  import { Passkey, passkey } from '../../plugins/passkey/index.mjs';
@@ -3,7 +3,7 @@ import { atom } from 'nanostores';
3
3
  import { AccessControl, Role, Statements, Subset, AuthortizeResponse } from '../../plugins/access/index.js';
4
4
  import * as _better_fetch_fetch from '@better-fetch/fetch';
5
5
  import { BetterFetch, BetterFetchOption } from '@better-fetch/fetch';
6
- import { o as organization, I as InferMember, a as InferInvitation, T as Team, b as Organization, M as Member, c as Invitation } from '../../shared/better-auth.CW0qngYD.js';
6
+ import { o as organization, I as InferMember, a as InferInvitation, T as Team, b as Organization, M as Member, c as Invitation } from '../../shared/better-auth.CU8biKFT.js';
7
7
  import { b as Prettify } from '../../shared/better-auth.Bi8FQwDD.js';
8
8
  import { username } from '../../plugins/username/index.js';
9
9
  import { Passkey, passkey } from '../../plugins/passkey/index.js';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const organization = require('../shared/better-auth.BUSrqHXr.cjs');
3
+ const organization = require('../shared/better-auth.So1syTlx.cjs');
4
4
  const plugins_twoFactor_index = require('./two-factor/index.cjs');
5
5
  const plugins_username_index = require('./username/index.cjs');
6
6
  const plugins_bearer_index = require('./bearer/index.cjs');
@@ -1,4 +1,4 @@
1
- export { O as OrganizationOptions, o as organization } from '../shared/better-auth.BjLde38z.cjs';
1
+ export { O as OrganizationOptions, o as organization } from '../shared/better-auth.BSGhjwQl.cjs';
2
2
  export { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor, twoFactor, twoFactorClient } from './two-factor/index.cjs';
3
3
  export { UsernameOptions, username } from './username/index.cjs';
4
4
  export { bearer } from './bearer/index.cjs';
@@ -1,4 +1,4 @@
1
- export { O as OrganizationOptions, o as organization } from '../shared/better-auth.BtbcLXIn.mjs';
1
+ export { O as OrganizationOptions, o as organization } from '../shared/better-auth.Do86a39J.mjs';
2
2
  export { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor, twoFactor, twoFactorClient } from './two-factor/index.mjs';
3
3
  export { UsernameOptions, username } from './username/index.mjs';
4
4
  export { bearer } from './bearer/index.mjs';
@@ -1,4 +1,4 @@
1
- export { O as OrganizationOptions, o as organization } from '../shared/better-auth.CW0qngYD.js';
1
+ export { O as OrganizationOptions, o as organization } from '../shared/better-auth.CU8biKFT.js';
2
2
  export { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor, twoFactor, twoFactorClient } from './two-factor/index.js';
3
3
  export { UsernameOptions, username } from './username/index.js';
4
4
  export { bearer } from './bearer/index.js';
@@ -1,4 +1,4 @@
1
- export { o as organization } from '../shared/better-auth.C0ONNNFq.mjs';
1
+ export { o as organization } from '../shared/better-auth.BcFmxlyA.mjs';
2
2
  export { twoFactor } from './two-factor/index.mjs';
3
3
  export { username } from './username/index.mjs';
4
4
  export { bearer } from './bearer/index.mjs';
@@ -61,11 +61,9 @@ const multiSession = (options) => {
61
61
  async ([key]) => await ctx.getSignedCookie(key, ctx.context.secret)
62
62
  )
63
63
  )).filter((v) => v !== null);
64
- const s = await account.getSessionFromCtx(ctx);
65
- console.log({ sessionTokens, s });
64
+ await account.getSessionFromCtx(ctx);
66
65
  if (!sessionTokens.length) return ctx.json([]);
67
66
  const sessions = await ctx.context.internalAdapter.findSessions(sessionTokens);
68
- console.log({ sessions });
69
67
  const validSessions = sessions.filter(
70
68
  (session) => session && session.session.expiresAt > /* @__PURE__ */ new Date()
71
69
  );
@@ -59,11 +59,9 @@ const multiSession = (options) => {
59
59
  async ([key]) => await ctx.getSignedCookie(key, ctx.context.secret)
60
60
  )
61
61
  )).filter((v) => v !== null);
62
- const s = await getSessionFromCtx(ctx);
63
- console.log({ sessionTokens, s });
62
+ await getSessionFromCtx(ctx);
64
63
  if (!sessionTokens.length) return ctx.json([]);
65
64
  const sessions = await ctx.context.internalAdapter.findSessions(sessionTokens);
66
- console.log({ sessions });
67
65
  const validSessions = sessions.filter(
68
66
  (session) => session && session.session.expiresAt > /* @__PURE__ */ new Date()
69
67
  );
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const organization = require('../../shared/better-auth.BUSrqHXr.cjs');
3
+ const organization = require('../../shared/better-auth.So1syTlx.cjs');
4
4
  require('better-call');
5
5
  require('zod');
6
6
  require('../../shared/better-auth.DcdXBLtR.cjs');
@@ -1,4 +1,4 @@
1
- export { O as OrganizationOptions, o as organization } from '../../shared/better-auth.BjLde38z.cjs';
1
+ export { O as OrganizationOptions, o as organization } from '../../shared/better-auth.BSGhjwQl.cjs';
2
2
  import '../access/index.cjs';
3
3
  import '../../shared/better-auth.Bi8FQwDD.cjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { O as OrganizationOptions, o as organization } from '../../shared/better-auth.BtbcLXIn.mjs';
1
+ export { O as OrganizationOptions, o as organization } from '../../shared/better-auth.Do86a39J.mjs';
2
2
  import '../access/index.mjs';
3
3
  import '../../shared/better-auth.Bi8FQwDD.mjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { O as OrganizationOptions, o as organization } from '../../shared/better-auth.CW0qngYD.js';
1
+ export { O as OrganizationOptions, o as organization } from '../../shared/better-auth.CU8biKFT.js';
2
2
  import '../access/index.js';
3
3
  import '../../shared/better-auth.Bi8FQwDD.js';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { o as organization } from '../../shared/better-auth.C0ONNNFq.mjs';
1
+ export { o as organization } from '../../shared/better-auth.BcFmxlyA.mjs';
2
2
  import 'better-call';
3
3
  import 'zod';
4
4
  import '../../shared/better-auth.DEf1xRKI.mjs';
@@ -6848,6 +6848,17 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
6848
6848
  member: {
6849
6849
  modelName: string | undefined;
6850
6850
  fields: {
6851
+ createdAt: {
6852
+ type: "date";
6853
+ required: true;
6854
+ fieldName: string | undefined;
6855
+ };
6856
+ teamId?: {
6857
+ type: "string";
6858
+ required: false;
6859
+ sortable: true;
6860
+ fieldName: string | undefined;
6861
+ } | undefined;
6851
6862
  organizationId: {
6852
6863
  type: "string";
6853
6864
  required: true;
@@ -6873,69 +6884,58 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
6873
6884
  defaultValue: string;
6874
6885
  fieldName: string | undefined;
6875
6886
  };
6876
- teamId: {
6887
+ };
6888
+ };
6889
+ invitation: {
6890
+ modelName: string | undefined;
6891
+ fields: {
6892
+ status: {
6877
6893
  type: "string";
6878
- required: false;
6894
+ required: true;
6879
6895
  sortable: true;
6896
+ defaultValue: string;
6880
6897
  fieldName: string | undefined;
6881
6898
  };
6882
- createdAt: {
6899
+ expiresAt: {
6883
6900
  type: "date";
6884
6901
  required: true;
6885
6902
  fieldName: string | undefined;
6886
6903
  };
6887
- };
6888
- };
6889
- invitation: {
6890
- modelName: string | undefined;
6891
- fields: {
6892
- organizationId: {
6904
+ inviterId: {
6893
6905
  type: "string";
6894
- required: true;
6895
6906
  references: {
6896
6907
  model: string;
6897
6908
  field: string;
6898
6909
  };
6899
6910
  fieldName: string | undefined;
6900
- };
6901
- email: {
6902
- type: "string";
6903
6911
  required: true;
6904
- sortable: true;
6905
- fieldName: string | undefined;
6906
6912
  };
6907
- role: {
6913
+ teamId?: {
6908
6914
  type: "string";
6909
6915
  required: false;
6910
6916
  sortable: true;
6911
6917
  fieldName: string | undefined;
6912
- };
6913
- teamId: {
6918
+ } | undefined;
6919
+ organizationId: {
6914
6920
  type: "string";
6915
- required: false;
6916
- sortable: true;
6921
+ required: true;
6922
+ references: {
6923
+ model: string;
6924
+ field: string;
6925
+ };
6917
6926
  fieldName: string | undefined;
6918
6927
  };
6919
- status: {
6928
+ email: {
6920
6929
  type: "string";
6921
6930
  required: true;
6922
6931
  sortable: true;
6923
- defaultValue: string;
6924
- fieldName: string | undefined;
6925
- };
6926
- expiresAt: {
6927
- type: "date";
6928
- required: true;
6929
6932
  fieldName: string | undefined;
6930
6933
  };
6931
- inviterId: {
6934
+ role: {
6932
6935
  type: "string";
6933
- references: {
6934
- model: string;
6935
- field: string;
6936
- };
6936
+ required: false;
6937
+ sortable: true;
6937
6938
  fieldName: string | undefined;
6938
- required: true;
6939
6939
  };
6940
6940
  };
6941
6941
  };
@@ -267,12 +267,14 @@ const organization = (options) => {
267
267
  defaultValue: "member",
268
268
  fieldName: options?.schema?.member?.fields?.role
269
269
  },
270
- teamId: {
271
- type: "string",
272
- required: false,
273
- sortable: true,
274
- fieldName: options?.schema?.member?.fields?.teamId
275
- },
270
+ ...teamSupport ? {
271
+ teamId: {
272
+ type: "string",
273
+ required: false,
274
+ sortable: true,
275
+ fieldName: options?.schema?.member?.fields?.teamId
276
+ }
277
+ } : {},
276
278
  createdAt: {
277
279
  type: "date",
278
280
  required: true,
@@ -304,12 +306,14 @@ const organization = (options) => {
304
306
  sortable: true,
305
307
  fieldName: options?.schema?.invitation?.fields?.role
306
308
  },
307
- teamId: {
308
- type: "string",
309
- required: false,
310
- sortable: true,
311
- fieldName: options?.schema?.invitation?.fields?.teamId
312
- },
309
+ ...teamSupport ? {
310
+ teamId: {
311
+ type: "string",
312
+ required: false,
313
+ sortable: true,
314
+ fieldName: options?.schema?.invitation?.fields?.teamId
315
+ }
316
+ } : {},
313
317
  status: {
314
318
  type: "string",
315
319
  required: true,
@@ -6848,6 +6848,17 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
6848
6848
  member: {
6849
6849
  modelName: string | undefined;
6850
6850
  fields: {
6851
+ createdAt: {
6852
+ type: "date";
6853
+ required: true;
6854
+ fieldName: string | undefined;
6855
+ };
6856
+ teamId?: {
6857
+ type: "string";
6858
+ required: false;
6859
+ sortable: true;
6860
+ fieldName: string | undefined;
6861
+ } | undefined;
6851
6862
  organizationId: {
6852
6863
  type: "string";
6853
6864
  required: true;
@@ -6873,69 +6884,58 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
6873
6884
  defaultValue: string;
6874
6885
  fieldName: string | undefined;
6875
6886
  };
6876
- teamId: {
6887
+ };
6888
+ };
6889
+ invitation: {
6890
+ modelName: string | undefined;
6891
+ fields: {
6892
+ status: {
6877
6893
  type: "string";
6878
- required: false;
6894
+ required: true;
6879
6895
  sortable: true;
6896
+ defaultValue: string;
6880
6897
  fieldName: string | undefined;
6881
6898
  };
6882
- createdAt: {
6899
+ expiresAt: {
6883
6900
  type: "date";
6884
6901
  required: true;
6885
6902
  fieldName: string | undefined;
6886
6903
  };
6887
- };
6888
- };
6889
- invitation: {
6890
- modelName: string | undefined;
6891
- fields: {
6892
- organizationId: {
6904
+ inviterId: {
6893
6905
  type: "string";
6894
- required: true;
6895
6906
  references: {
6896
6907
  model: string;
6897
6908
  field: string;
6898
6909
  };
6899
6910
  fieldName: string | undefined;
6900
- };
6901
- email: {
6902
- type: "string";
6903
6911
  required: true;
6904
- sortable: true;
6905
- fieldName: string | undefined;
6906
6912
  };
6907
- role: {
6913
+ teamId?: {
6908
6914
  type: "string";
6909
6915
  required: false;
6910
6916
  sortable: true;
6911
6917
  fieldName: string | undefined;
6912
- };
6913
- teamId: {
6918
+ } | undefined;
6919
+ organizationId: {
6914
6920
  type: "string";
6915
- required: false;
6916
- sortable: true;
6921
+ required: true;
6922
+ references: {
6923
+ model: string;
6924
+ field: string;
6925
+ };
6917
6926
  fieldName: string | undefined;
6918
6927
  };
6919
- status: {
6928
+ email: {
6920
6929
  type: "string";
6921
6930
  required: true;
6922
6931
  sortable: true;
6923
- defaultValue: string;
6924
- fieldName: string | undefined;
6925
- };
6926
- expiresAt: {
6927
- type: "date";
6928
- required: true;
6929
6932
  fieldName: string | undefined;
6930
6933
  };
6931
- inviterId: {
6934
+ role: {
6932
6935
  type: "string";
6933
- references: {
6934
- model: string;
6935
- field: string;
6936
- };
6936
+ required: false;
6937
+ sortable: true;
6937
6938
  fieldName: string | undefined;
6938
- required: true;
6939
6939
  };
6940
6940
  };
6941
6941
  };
@@ -6848,6 +6848,17 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
6848
6848
  member: {
6849
6849
  modelName: string | undefined;
6850
6850
  fields: {
6851
+ createdAt: {
6852
+ type: "date";
6853
+ required: true;
6854
+ fieldName: string | undefined;
6855
+ };
6856
+ teamId?: {
6857
+ type: "string";
6858
+ required: false;
6859
+ sortable: true;
6860
+ fieldName: string | undefined;
6861
+ } | undefined;
6851
6862
  organizationId: {
6852
6863
  type: "string";
6853
6864
  required: true;
@@ -6873,69 +6884,58 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
6873
6884
  defaultValue: string;
6874
6885
  fieldName: string | undefined;
6875
6886
  };
6876
- teamId: {
6887
+ };
6888
+ };
6889
+ invitation: {
6890
+ modelName: string | undefined;
6891
+ fields: {
6892
+ status: {
6877
6893
  type: "string";
6878
- required: false;
6894
+ required: true;
6879
6895
  sortable: true;
6896
+ defaultValue: string;
6880
6897
  fieldName: string | undefined;
6881
6898
  };
6882
- createdAt: {
6899
+ expiresAt: {
6883
6900
  type: "date";
6884
6901
  required: true;
6885
6902
  fieldName: string | undefined;
6886
6903
  };
6887
- };
6888
- };
6889
- invitation: {
6890
- modelName: string | undefined;
6891
- fields: {
6892
- organizationId: {
6904
+ inviterId: {
6893
6905
  type: "string";
6894
- required: true;
6895
6906
  references: {
6896
6907
  model: string;
6897
6908
  field: string;
6898
6909
  };
6899
6910
  fieldName: string | undefined;
6900
- };
6901
- email: {
6902
- type: "string";
6903
6911
  required: true;
6904
- sortable: true;
6905
- fieldName: string | undefined;
6906
6912
  };
6907
- role: {
6913
+ teamId?: {
6908
6914
  type: "string";
6909
6915
  required: false;
6910
6916
  sortable: true;
6911
6917
  fieldName: string | undefined;
6912
- };
6913
- teamId: {
6918
+ } | undefined;
6919
+ organizationId: {
6914
6920
  type: "string";
6915
- required: false;
6916
- sortable: true;
6921
+ required: true;
6922
+ references: {
6923
+ model: string;
6924
+ field: string;
6925
+ };
6917
6926
  fieldName: string | undefined;
6918
6927
  };
6919
- status: {
6928
+ email: {
6920
6929
  type: "string";
6921
6930
  required: true;
6922
6931
  sortable: true;
6923
- defaultValue: string;
6924
- fieldName: string | undefined;
6925
- };
6926
- expiresAt: {
6927
- type: "date";
6928
- required: true;
6929
6932
  fieldName: string | undefined;
6930
6933
  };
6931
- inviterId: {
6934
+ role: {
6932
6935
  type: "string";
6933
- references: {
6934
- model: string;
6935
- field: string;
6936
- };
6936
+ required: false;
6937
+ sortable: true;
6937
6938
  fieldName: string | undefined;
6938
- required: true;
6939
6939
  };
6940
6940
  };
6941
6941
  };
@@ -269,12 +269,14 @@ const organization = (options) => {
269
269
  defaultValue: "member",
270
270
  fieldName: options?.schema?.member?.fields?.role
271
271
  },
272
- teamId: {
273
- type: "string",
274
- required: false,
275
- sortable: true,
276
- fieldName: options?.schema?.member?.fields?.teamId
277
- },
272
+ ...teamSupport ? {
273
+ teamId: {
274
+ type: "string",
275
+ required: false,
276
+ sortable: true,
277
+ fieldName: options?.schema?.member?.fields?.teamId
278
+ }
279
+ } : {},
278
280
  createdAt: {
279
281
  type: "date",
280
282
  required: true,
@@ -306,12 +308,14 @@ const organization = (options) => {
306
308
  sortable: true,
307
309
  fieldName: options?.schema?.invitation?.fields?.role
308
310
  },
309
- teamId: {
310
- type: "string",
311
- required: false,
312
- sortable: true,
313
- fieldName: options?.schema?.invitation?.fields?.teamId
314
- },
311
+ ...teamSupport ? {
312
+ teamId: {
313
+ type: "string",
314
+ required: false,
315
+ sortable: true,
316
+ fieldName: options?.schema?.invitation?.fields?.teamId
317
+ }
318
+ } : {},
315
319
  status: {
316
320
  type: "string",
317
321
  required: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-auth",
3
- "version": "1.2.1-beta.5",
3
+ "version": "1.2.1-beta.7",
4
4
  "description": "The most comprehensive authentication library for TypeScript.",
5
5
  "type": "module",
6
6
  "repository": {