@meistrari/auth-core 1.37.0 → 1.38.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/index.d.mts CHANGED
@@ -92,7 +92,7 @@ type AssuranceFields = {
92
92
  };
93
93
 
94
94
  declare const ac: {
95
- newRole<K extends "organization" | "ac" | "member" | "access" | "invitation" | "team">(statements: better_auth_plugins.Subset<K, {
95
+ newRole<K extends "member" | "access" | "organization" | "invitation" | "team" | "ac">(statements: better_auth_plugins.Subset<K, {
96
96
  access: string[];
97
97
  organization: readonly ["update", "delete"];
98
98
  member: readonly ["create", "update", "delete"];
@@ -166,7 +166,7 @@ type Role = typeof Roles[keyof typeof Roles];
166
166
  */
167
167
  declare const rolesAccessControl: {
168
168
  "org:admin": {
169
- authorize<K_1 extends "organization" | "member" | "access" | "invitation" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins.Subset<"organization" | "member" | "access" | "invitation" | "team", {
169
+ authorize<K_1 extends "member" | "access" | "organization" | "invitation" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins.Subset<"member" | "access" | "organization" | "invitation" | "team", {
170
170
  access: string[];
171
171
  organization: readonly ["update", "delete"];
172
172
  member: readonly ["create", "update", "delete"];
@@ -174,7 +174,7 @@ declare const rolesAccessControl: {
174
174
  team: readonly ["create", "update", "delete"];
175
175
  ac: readonly ["create", "read", "update", "delete"];
176
176
  }>[key] | {
177
- actions: better_auth_plugins.Subset<"organization" | "member" | "access" | "invitation" | "team", {
177
+ actions: better_auth_plugins.Subset<"member" | "access" | "organization" | "invitation" | "team", {
178
178
  access: string[];
179
179
  organization: readonly ["update", "delete"];
180
180
  member: readonly ["create", "update", "delete"];
@@ -184,7 +184,7 @@ declare const rolesAccessControl: {
184
184
  }>[key];
185
185
  connector: "OR" | "AND";
186
186
  } | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins.AuthorizeResponse;
187
- statements: better_auth_plugins.Subset<"organization" | "member" | "access" | "invitation" | "team", {
187
+ statements: better_auth_plugins.Subset<"member" | "access" | "organization" | "invitation" | "team", {
188
188
  access: string[];
189
189
  organization: readonly ["update", "delete"];
190
190
  member: readonly ["create", "update", "delete"];
@@ -2720,10 +2720,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2720
2720
  } & {
2721
2721
  preferredLanguage: string;
2722
2722
  } & {
2723
+ lastActiveAt?: Date | null | undefined;
2723
2724
  displayName?: string | null | undefined;
2724
2725
  title?: string | null | undefined;
2725
2726
  pronouns?: string | null | undefined;
2726
- lastActiveAt?: Date | null | undefined;
2727
2727
  }>;
2728
2728
  }, {
2729
2729
  code?: string | undefined;
@@ -2793,10 +2793,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2793
2793
  } & {
2794
2794
  preferredLanguage: string;
2795
2795
  } & {
2796
+ lastActiveAt?: Date | null | undefined;
2796
2797
  displayName?: string | null | undefined;
2797
2798
  title?: string | null | undefined;
2798
2799
  pronouns?: string | null | undefined;
2799
- lastActiveAt?: Date | null | undefined;
2800
2800
  }>;
2801
2801
  }) | (Omit<{
2802
2802
  token: string;
@@ -2829,10 +2829,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2829
2829
  } & {
2830
2830
  preferredLanguage: string;
2831
2831
  } & {
2832
+ lastActiveAt?: Date | null | undefined;
2832
2833
  displayName?: string | null | undefined;
2833
2834
  title?: string | null | undefined;
2834
2835
  pronouns?: string | null | undefined;
2835
- lastActiveAt?: Date | null | undefined;
2836
2836
  }>;
2837
2837
  }), {
2838
2838
  code?: string | undefined;
@@ -2887,10 +2887,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2887
2887
  } & {
2888
2888
  preferredLanguage: string;
2889
2889
  } & {
2890
+ lastActiveAt?: Date | null | undefined;
2890
2891
  displayName?: string | null | undefined;
2891
2892
  title?: string | null | undefined;
2892
2893
  pronouns?: string | null | undefined;
2893
- lastActiveAt?: Date | null | undefined;
2894
2894
  }>;
2895
2895
  }) | (Omit<{
2896
2896
  token: string;
@@ -2923,10 +2923,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2923
2923
  } & {
2924
2924
  preferredLanguage: string;
2925
2925
  } & {
2926
+ lastActiveAt?: Date | null | undefined;
2926
2927
  displayName?: string | null | undefined;
2927
2928
  title?: string | null | undefined;
2928
2929
  pronouns?: string | null | undefined;
2929
- lastActiveAt?: Date | null | undefined;
2930
2930
  }>;
2931
2931
  }), {
2932
2932
  code?: string | undefined;
@@ -3554,10 +3554,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3554
3554
  } & {
3555
3555
  preferredLanguage: string;
3556
3556
  } & {
3557
+ lastActiveAt?: Date | null | undefined;
3557
3558
  displayName?: string | null | undefined;
3558
3559
  title?: string | null | undefined;
3559
3560
  pronouns?: string | null | undefined;
3560
- lastActiveAt?: Date | null | undefined;
3561
3561
  }>;
3562
3562
  }) | (Omit<{
3563
3563
  status: boolean;
@@ -3591,10 +3591,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3591
3591
  } & {
3592
3592
  preferredLanguage: string;
3593
3593
  } & {
3594
+ lastActiveAt?: Date | null | undefined;
3594
3595
  displayName?: string | null | undefined;
3595
3596
  title?: string | null | undefined;
3596
3597
  pronouns?: string | null | undefined;
3597
- lastActiveAt?: Date | null | undefined;
3598
3598
  }>;
3599
3599
  }), {
3600
3600
  code?: string | undefined;
@@ -3646,10 +3646,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3646
3646
  } & {
3647
3647
  preferredLanguage: string;
3648
3648
  } & {
3649
+ lastActiveAt?: Date | null | undefined;
3649
3650
  displayName?: string | null | undefined;
3650
3651
  title?: string | null | undefined;
3651
3652
  pronouns?: string | null | undefined;
3652
- lastActiveAt?: Date | null | undefined;
3653
3653
  }>;
3654
3654
  }, {
3655
3655
  code?: string | undefined;
@@ -3813,10 +3813,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3813
3813
  } & {
3814
3814
  preferredLanguage: string;
3815
3815
  } & {
3816
+ lastActiveAt?: Date | null | undefined;
3816
3817
  displayName?: string | null | undefined;
3817
3818
  title?: string | null | undefined;
3818
3819
  pronouns?: string | null | undefined;
3819
- lastActiveAt?: Date | null | undefined;
3820
3820
  }>;
3821
3821
  }), {
3822
3822
  code?: string | undefined;
@@ -3850,11 +3850,11 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3850
3850
  callbackURL?: string | undefined;
3851
3851
  fetchOptions?: FetchOptions | undefined;
3852
3852
  } & {} & {} & {} & {} & {} & {
3853
+ lastActiveAt?: Date | null | undefined;
3853
3854
  displayName?: string | null | undefined;
3854
3855
  title?: string | null | undefined;
3855
3856
  pronouns?: string | null | undefined;
3856
3857
  preferredLanguage?: string | null | undefined;
3857
- lastActiveAt?: Date | null | undefined;
3858
3858
  }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<(Omit<{
3859
3859
  token: null;
3860
3860
  user: {
@@ -3886,10 +3886,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3886
3886
  } & {
3887
3887
  preferredLanguage: string;
3888
3888
  } & {
3889
+ lastActiveAt?: Date | null | undefined;
3889
3890
  displayName?: string | null | undefined;
3890
3891
  title?: string | null | undefined;
3891
3892
  pronouns?: string | null | undefined;
3892
- lastActiveAt?: Date | null | undefined;
3893
3893
  }>;
3894
3894
  }) | (Omit<{
3895
3895
  token: string;
@@ -3922,10 +3922,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3922
3922
  } & {
3923
3923
  preferredLanguage: string;
3924
3924
  } & {
3925
+ lastActiveAt?: Date | null | undefined;
3925
3926
  displayName?: string | null | undefined;
3926
3927
  title?: string | null | undefined;
3927
3928
  pronouns?: string | null | undefined;
3928
- lastActiveAt?: Date | null | undefined;
3929
3929
  }>;
3930
3930
  }), {
3931
3931
  code?: string | undefined;
@@ -3979,10 +3979,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3979
3979
  } & {
3980
3980
  preferredLanguage: string;
3981
3981
  } & {
3982
+ lastActiveAt?: Date | null | undefined;
3982
3983
  displayName?: string | null | undefined;
3983
3984
  title?: string | null | undefined;
3984
3985
  pronouns?: string | null | undefined;
3985
- lastActiveAt?: Date | null | undefined;
3986
3986
  }>;
3987
3987
  }, {
3988
3988
  code?: string | undefined;
@@ -4102,10 +4102,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4102
4102
  } & {
4103
4103
  preferredLanguage: string;
4104
4104
  } & {
4105
+ lastActiveAt?: Date | null | undefined;
4105
4106
  displayName?: string | null | undefined;
4106
4107
  title?: string | null | undefined;
4107
4108
  pronouns?: string | null | undefined;
4108
- lastActiveAt?: Date | null | undefined;
4109
4109
  }>;
4110
4110
  }, {
4111
4111
  code?: string | undefined;
@@ -4138,11 +4138,11 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4138
4138
  name?: string | undefined;
4139
4139
  fetchOptions?: FetchOptions | undefined;
4140
4140
  } & Partial<{} & {} & {} & {} & {} & {
4141
+ lastActiveAt?: Date | null | undefined;
4141
4142
  displayName?: string | null | undefined;
4142
4143
  title?: string | null | undefined;
4143
4144
  pronouns?: string | null | undefined;
4144
4145
  preferredLanguage?: string | null | undefined;
4145
- lastActiveAt?: Date | null | undefined;
4146
4146
  }>> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
4147
4147
  status: boolean;
4148
4148
  }, {
@@ -4428,10 +4428,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4428
4428
  } & {
4429
4429
  preferredLanguage: string;
4430
4430
  } & {
4431
+ lastActiveAt?: Date | null | undefined;
4431
4432
  displayName?: string | null | undefined;
4432
4433
  title?: string | null | undefined;
4433
4434
  pronouns?: string | null | undefined;
4434
- lastActiveAt?: Date | null | undefined;
4435
4435
  }>;
4436
4436
  session: better_auth.StripEmptyObjects<{
4437
4437
  id: string;
@@ -4823,10 +4823,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4823
4823
  } & {
4824
4824
  preferredLanguage: string;
4825
4825
  } & {
4826
+ lastActiveAt?: Date | null | undefined;
4826
4827
  displayName?: string | null | undefined;
4827
4828
  title?: string | null | undefined;
4828
4829
  pronouns?: string | null | undefined;
4829
- lastActiveAt?: Date | null | undefined;
4830
4830
  }>;
4831
4831
  session: better_auth.StripEmptyObjects<{
4832
4832
  id: string;
@@ -4943,10 +4943,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4943
4943
  } & {
4944
4944
  preferredLanguage: string;
4945
4945
  } & {
4946
+ lastActiveAt?: Date | null | undefined;
4946
4947
  displayName?: string | null | undefined;
4947
4948
  title?: string | null | undefined;
4948
4949
  pronouns?: string | null | undefined;
4949
- lastActiveAt?: Date | null | undefined;
4950
4950
  }>;
4951
4951
  session: better_auth.StripEmptyObjects<{
4952
4952
  id: string;
@@ -5745,6 +5745,12 @@ type ListAdminUsersOptions = {
5745
5745
  * are merged into the listing, grouped by email. Defaults to false.
5746
5746
  */
5747
5747
  includeInvitations?: boolean;
5748
+ /**
5749
+ * Restricts the listing to users with an active membership in this
5750
+ * organization, and to invitations sent by it. Ignored for an organization
5751
+ * admin, whose listing is always pinned to their own organization.
5752
+ */
5753
+ organizationId?: string;
5748
5754
  };
5749
5755
  /**
5750
5756
  * Organization preview returned alongside each admin user row.
@@ -6516,10 +6522,12 @@ declare class AdminService {
6516
6522
  error: null;
6517
6523
  }>;
6518
6524
  /**
6519
- * Lists users as a global admin, optionally with organization previews
6520
- * and totals when a preview size is requested.
6525
+ * Lists users, optionally with organization previews and totals when a
6526
+ * preview size is requested. Global admins list across every organization
6527
+ * and may narrow to one with organizationId; an organization admin always
6528
+ * gets their own organization's users, without previews.
6521
6529
  *
6522
- * @param options - Pagination, ordering, search, and preview options
6530
+ * @param options - Pagination, ordering, search, preview, and organization options
6523
6531
  * @returns The paginated user listing
6524
6532
  */
6525
6533
  listUsers(options?: ListAdminUsersOptions): Promise<{
@@ -6591,7 +6599,8 @@ declare class AdminService {
6591
6599
  error: null;
6592
6600
  }>;
6593
6601
  /**
6594
- * Lists teams for one organization as a global admin.
6602
+ * Lists teams for one organization. Global admins may list any organization;
6603
+ * an organization admin only their own.
6595
6604
  *
6596
6605
  * @param options - Organization ID, pagination, search, and ordering options
6597
6606
  * @returns The paginated organization team listing
@@ -6656,7 +6665,10 @@ declare class AdminService {
6656
6665
  data: AdminOrganization;
6657
6666
  } | null>;
6658
6667
  /**
6659
- * Updates an organization's profile and settings.
6668
+ * Updates an organization's profile and settings. Global admins may update
6669
+ * any organization; an organization admin only their own, and only the
6670
+ * fields they own — the slug, metadata, and billing configuration stay
6671
+ * global admin territory.
6660
6672
  *
6661
6673
  * @param options - Organization ID and the fields to update
6662
6674
  * @returns The updated organization
@@ -6779,6 +6791,10 @@ type ListMembersOptions = {
6779
6791
  limit?: number;
6780
6792
  /** Number of members to skip for pagination. */
6781
6793
  offset?: number;
6794
+ /** Member field used to order the page. */
6795
+ sortBy?: 'createdAt';
6796
+ /** Sort direction for the member page. */
6797
+ sortDirection?: 'asc' | 'desc';
6782
6798
  };
6783
6799
  /**
6784
6800
  * Options for inviting a user to the active organization.
@@ -6823,7 +6839,10 @@ type UpdateMemberRoleOptions = {
6823
6839
  /**
6824
6840
  * Payload for creating a new team.
6825
6841
  */
6826
- type CreateTeamPayload = Pick<Team, 'name'>;
6842
+ type CreateTeamPayload = Pick<Team, 'name'> & {
6843
+ /** User IDs of organization members to add to the team as it is created. */
6844
+ memberIds?: string[];
6845
+ };
6827
6846
  /**
6828
6847
  * Payload for updating an existing team.
6829
6848
  */
@@ -7031,6 +7050,8 @@ declare class OrganizationService {
7031
7050
  * Removes a user from the active organization.
7032
7051
  *
7033
7052
  * @param options - Provide either `memberId` or `userEmail` to identify the user
7053
+ * @param options.memberId - Membership ID to remove
7054
+ * @param options.userEmail - Email address of the member to remove
7034
7055
  */
7035
7056
  removeUserFromOrganization({ memberId, userEmail }: RemoveUserFromOrganizationOptions): Promise<void>;
7036
7057
  /**
@@ -7044,7 +7065,7 @@ declare class OrganizationService {
7044
7065
  /**
7045
7066
  * Creates a new team within the active organization.
7046
7067
  *
7047
- * @param payload - Team configuration with a `name` field
7068
+ * @param payload - Team configuration with a `name` field and optional `memberIds`
7048
7069
  * @returns The created team
7049
7070
  */
7050
7071
  createTeam(payload: CreateTeamPayload): Promise<{
@@ -7195,10 +7216,10 @@ declare class SessionService {
7195
7216
  } & {
7196
7217
  preferredLanguage: string;
7197
7218
  } & {
7219
+ lastActiveAt?: Date | null | undefined;
7198
7220
  displayName?: string | null | undefined;
7199
7221
  title?: string | null | undefined;
7200
7222
  pronouns?: string | null | undefined;
7201
- lastActiveAt?: Date | null | undefined;
7202
7223
  }>;
7203
7224
  session: better_auth.StripEmptyObjects<{
7204
7225
  id: string;
@@ -7436,10 +7457,10 @@ declare class EmailOTPService {
7436
7457
  } & {
7437
7458
  preferredLanguage: string;
7438
7459
  } & {
7460
+ lastActiveAt?: Date | null | undefined;
7439
7461
  displayName?: string | null | undefined;
7440
7462
  title?: string | null | undefined;
7441
7463
  pronouns?: string | null | undefined;
7442
- lastActiveAt?: Date | null | undefined;
7443
7464
  }>;
7444
7465
  }>;
7445
7466
  }
@@ -7489,10 +7510,10 @@ declare class UserService {
7489
7510
  } & {
7490
7511
  preferredLanguage: string;
7491
7512
  } & {
7513
+ lastActiveAt?: Date | null | undefined;
7492
7514
  displayName?: string | null | undefined;
7493
7515
  title?: string | null | undefined;
7494
7516
  pronouns?: string | null | undefined;
7495
- lastActiveAt?: Date | null | undefined;
7496
7517
  }>;
7497
7518
  }>;
7498
7519
  updateProfile(profile: UpdateUserProfilePayload): Promise<{
package/dist/index.d.ts CHANGED
@@ -92,7 +92,7 @@ type AssuranceFields = {
92
92
  };
93
93
 
94
94
  declare const ac: {
95
- newRole<K extends "organization" | "ac" | "member" | "access" | "invitation" | "team">(statements: better_auth_plugins.Subset<K, {
95
+ newRole<K extends "member" | "access" | "organization" | "invitation" | "team" | "ac">(statements: better_auth_plugins.Subset<K, {
96
96
  access: string[];
97
97
  organization: readonly ["update", "delete"];
98
98
  member: readonly ["create", "update", "delete"];
@@ -166,7 +166,7 @@ type Role = typeof Roles[keyof typeof Roles];
166
166
  */
167
167
  declare const rolesAccessControl: {
168
168
  "org:admin": {
169
- authorize<K_1 extends "organization" | "member" | "access" | "invitation" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins.Subset<"organization" | "member" | "access" | "invitation" | "team", {
169
+ authorize<K_1 extends "member" | "access" | "organization" | "invitation" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins.Subset<"member" | "access" | "organization" | "invitation" | "team", {
170
170
  access: string[];
171
171
  organization: readonly ["update", "delete"];
172
172
  member: readonly ["create", "update", "delete"];
@@ -174,7 +174,7 @@ declare const rolesAccessControl: {
174
174
  team: readonly ["create", "update", "delete"];
175
175
  ac: readonly ["create", "read", "update", "delete"];
176
176
  }>[key] | {
177
- actions: better_auth_plugins.Subset<"organization" | "member" | "access" | "invitation" | "team", {
177
+ actions: better_auth_plugins.Subset<"member" | "access" | "organization" | "invitation" | "team", {
178
178
  access: string[];
179
179
  organization: readonly ["update", "delete"];
180
180
  member: readonly ["create", "update", "delete"];
@@ -184,7 +184,7 @@ declare const rolesAccessControl: {
184
184
  }>[key];
185
185
  connector: "OR" | "AND";
186
186
  } | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins.AuthorizeResponse;
187
- statements: better_auth_plugins.Subset<"organization" | "member" | "access" | "invitation" | "team", {
187
+ statements: better_auth_plugins.Subset<"member" | "access" | "organization" | "invitation" | "team", {
188
188
  access: string[];
189
189
  organization: readonly ["update", "delete"];
190
190
  member: readonly ["create", "update", "delete"];
@@ -2720,10 +2720,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2720
2720
  } & {
2721
2721
  preferredLanguage: string;
2722
2722
  } & {
2723
+ lastActiveAt?: Date | null | undefined;
2723
2724
  displayName?: string | null | undefined;
2724
2725
  title?: string | null | undefined;
2725
2726
  pronouns?: string | null | undefined;
2726
- lastActiveAt?: Date | null | undefined;
2727
2727
  }>;
2728
2728
  }, {
2729
2729
  code?: string | undefined;
@@ -2793,10 +2793,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2793
2793
  } & {
2794
2794
  preferredLanguage: string;
2795
2795
  } & {
2796
+ lastActiveAt?: Date | null | undefined;
2796
2797
  displayName?: string | null | undefined;
2797
2798
  title?: string | null | undefined;
2798
2799
  pronouns?: string | null | undefined;
2799
- lastActiveAt?: Date | null | undefined;
2800
2800
  }>;
2801
2801
  }) | (Omit<{
2802
2802
  token: string;
@@ -2829,10 +2829,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2829
2829
  } & {
2830
2830
  preferredLanguage: string;
2831
2831
  } & {
2832
+ lastActiveAt?: Date | null | undefined;
2832
2833
  displayName?: string | null | undefined;
2833
2834
  title?: string | null | undefined;
2834
2835
  pronouns?: string | null | undefined;
2835
- lastActiveAt?: Date | null | undefined;
2836
2836
  }>;
2837
2837
  }), {
2838
2838
  code?: string | undefined;
@@ -2887,10 +2887,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2887
2887
  } & {
2888
2888
  preferredLanguage: string;
2889
2889
  } & {
2890
+ lastActiveAt?: Date | null | undefined;
2890
2891
  displayName?: string | null | undefined;
2891
2892
  title?: string | null | undefined;
2892
2893
  pronouns?: string | null | undefined;
2893
- lastActiveAt?: Date | null | undefined;
2894
2894
  }>;
2895
2895
  }) | (Omit<{
2896
2896
  token: string;
@@ -2923,10 +2923,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2923
2923
  } & {
2924
2924
  preferredLanguage: string;
2925
2925
  } & {
2926
+ lastActiveAt?: Date | null | undefined;
2926
2927
  displayName?: string | null | undefined;
2927
2928
  title?: string | null | undefined;
2928
2929
  pronouns?: string | null | undefined;
2929
- lastActiveAt?: Date | null | undefined;
2930
2930
  }>;
2931
2931
  }), {
2932
2932
  code?: string | undefined;
@@ -3554,10 +3554,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3554
3554
  } & {
3555
3555
  preferredLanguage: string;
3556
3556
  } & {
3557
+ lastActiveAt?: Date | null | undefined;
3557
3558
  displayName?: string | null | undefined;
3558
3559
  title?: string | null | undefined;
3559
3560
  pronouns?: string | null | undefined;
3560
- lastActiveAt?: Date | null | undefined;
3561
3561
  }>;
3562
3562
  }) | (Omit<{
3563
3563
  status: boolean;
@@ -3591,10 +3591,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3591
3591
  } & {
3592
3592
  preferredLanguage: string;
3593
3593
  } & {
3594
+ lastActiveAt?: Date | null | undefined;
3594
3595
  displayName?: string | null | undefined;
3595
3596
  title?: string | null | undefined;
3596
3597
  pronouns?: string | null | undefined;
3597
- lastActiveAt?: Date | null | undefined;
3598
3598
  }>;
3599
3599
  }), {
3600
3600
  code?: string | undefined;
@@ -3646,10 +3646,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3646
3646
  } & {
3647
3647
  preferredLanguage: string;
3648
3648
  } & {
3649
+ lastActiveAt?: Date | null | undefined;
3649
3650
  displayName?: string | null | undefined;
3650
3651
  title?: string | null | undefined;
3651
3652
  pronouns?: string | null | undefined;
3652
- lastActiveAt?: Date | null | undefined;
3653
3653
  }>;
3654
3654
  }, {
3655
3655
  code?: string | undefined;
@@ -3813,10 +3813,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3813
3813
  } & {
3814
3814
  preferredLanguage: string;
3815
3815
  } & {
3816
+ lastActiveAt?: Date | null | undefined;
3816
3817
  displayName?: string | null | undefined;
3817
3818
  title?: string | null | undefined;
3818
3819
  pronouns?: string | null | undefined;
3819
- lastActiveAt?: Date | null | undefined;
3820
3820
  }>;
3821
3821
  }), {
3822
3822
  code?: string | undefined;
@@ -3850,11 +3850,11 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3850
3850
  callbackURL?: string | undefined;
3851
3851
  fetchOptions?: FetchOptions | undefined;
3852
3852
  } & {} & {} & {} & {} & {} & {
3853
+ lastActiveAt?: Date | null | undefined;
3853
3854
  displayName?: string | null | undefined;
3854
3855
  title?: string | null | undefined;
3855
3856
  pronouns?: string | null | undefined;
3856
3857
  preferredLanguage?: string | null | undefined;
3857
- lastActiveAt?: Date | null | undefined;
3858
3858
  }>, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<(Omit<{
3859
3859
  token: null;
3860
3860
  user: {
@@ -3886,10 +3886,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3886
3886
  } & {
3887
3887
  preferredLanguage: string;
3888
3888
  } & {
3889
+ lastActiveAt?: Date | null | undefined;
3889
3890
  displayName?: string | null | undefined;
3890
3891
  title?: string | null | undefined;
3891
3892
  pronouns?: string | null | undefined;
3892
- lastActiveAt?: Date | null | undefined;
3893
3893
  }>;
3894
3894
  }) | (Omit<{
3895
3895
  token: string;
@@ -3922,10 +3922,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3922
3922
  } & {
3923
3923
  preferredLanguage: string;
3924
3924
  } & {
3925
+ lastActiveAt?: Date | null | undefined;
3925
3926
  displayName?: string | null | undefined;
3926
3927
  title?: string | null | undefined;
3927
3928
  pronouns?: string | null | undefined;
3928
- lastActiveAt?: Date | null | undefined;
3929
3929
  }>;
3930
3930
  }), {
3931
3931
  code?: string | undefined;
@@ -3979,10 +3979,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3979
3979
  } & {
3980
3980
  preferredLanguage: string;
3981
3981
  } & {
3982
+ lastActiveAt?: Date | null | undefined;
3982
3983
  displayName?: string | null | undefined;
3983
3984
  title?: string | null | undefined;
3984
3985
  pronouns?: string | null | undefined;
3985
- lastActiveAt?: Date | null | undefined;
3986
3986
  }>;
3987
3987
  }, {
3988
3988
  code?: string | undefined;
@@ -4102,10 +4102,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4102
4102
  } & {
4103
4103
  preferredLanguage: string;
4104
4104
  } & {
4105
+ lastActiveAt?: Date | null | undefined;
4105
4106
  displayName?: string | null | undefined;
4106
4107
  title?: string | null | undefined;
4107
4108
  pronouns?: string | null | undefined;
4108
- lastActiveAt?: Date | null | undefined;
4109
4109
  }>;
4110
4110
  }, {
4111
4111
  code?: string | undefined;
@@ -4138,11 +4138,11 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4138
4138
  name?: string | undefined;
4139
4139
  fetchOptions?: FetchOptions | undefined;
4140
4140
  } & Partial<{} & {} & {} & {} & {} & {
4141
+ lastActiveAt?: Date | null | undefined;
4141
4142
  displayName?: string | null | undefined;
4142
4143
  title?: string | null | undefined;
4143
4144
  pronouns?: string | null | undefined;
4144
4145
  preferredLanguage?: string | null | undefined;
4145
- lastActiveAt?: Date | null | undefined;
4146
4146
  }>> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_client.BetterFetchResponse<{
4147
4147
  status: boolean;
4148
4148
  }, {
@@ -4428,10 +4428,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4428
4428
  } & {
4429
4429
  preferredLanguage: string;
4430
4430
  } & {
4431
+ lastActiveAt?: Date | null | undefined;
4431
4432
  displayName?: string | null | undefined;
4432
4433
  title?: string | null | undefined;
4433
4434
  pronouns?: string | null | undefined;
4434
- lastActiveAt?: Date | null | undefined;
4435
4435
  }>;
4436
4436
  session: better_auth.StripEmptyObjects<{
4437
4437
  id: string;
@@ -4823,10 +4823,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4823
4823
  } & {
4824
4824
  preferredLanguage: string;
4825
4825
  } & {
4826
+ lastActiveAt?: Date | null | undefined;
4826
4827
  displayName?: string | null | undefined;
4827
4828
  title?: string | null | undefined;
4828
4829
  pronouns?: string | null | undefined;
4829
- lastActiveAt?: Date | null | undefined;
4830
4830
  }>;
4831
4831
  session: better_auth.StripEmptyObjects<{
4832
4832
  id: string;
@@ -4943,10 +4943,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4943
4943
  } & {
4944
4944
  preferredLanguage: string;
4945
4945
  } & {
4946
+ lastActiveAt?: Date | null | undefined;
4946
4947
  displayName?: string | null | undefined;
4947
4948
  title?: string | null | undefined;
4948
4949
  pronouns?: string | null | undefined;
4949
- lastActiveAt?: Date | null | undefined;
4950
4950
  }>;
4951
4951
  session: better_auth.StripEmptyObjects<{
4952
4952
  id: string;
@@ -5745,6 +5745,12 @@ type ListAdminUsersOptions = {
5745
5745
  * are merged into the listing, grouped by email. Defaults to false.
5746
5746
  */
5747
5747
  includeInvitations?: boolean;
5748
+ /**
5749
+ * Restricts the listing to users with an active membership in this
5750
+ * organization, and to invitations sent by it. Ignored for an organization
5751
+ * admin, whose listing is always pinned to their own organization.
5752
+ */
5753
+ organizationId?: string;
5748
5754
  };
5749
5755
  /**
5750
5756
  * Organization preview returned alongside each admin user row.
@@ -6516,10 +6522,12 @@ declare class AdminService {
6516
6522
  error: null;
6517
6523
  }>;
6518
6524
  /**
6519
- * Lists users as a global admin, optionally with organization previews
6520
- * and totals when a preview size is requested.
6525
+ * Lists users, optionally with organization previews and totals when a
6526
+ * preview size is requested. Global admins list across every organization
6527
+ * and may narrow to one with organizationId; an organization admin always
6528
+ * gets their own organization's users, without previews.
6521
6529
  *
6522
- * @param options - Pagination, ordering, search, and preview options
6530
+ * @param options - Pagination, ordering, search, preview, and organization options
6523
6531
  * @returns The paginated user listing
6524
6532
  */
6525
6533
  listUsers(options?: ListAdminUsersOptions): Promise<{
@@ -6591,7 +6599,8 @@ declare class AdminService {
6591
6599
  error: null;
6592
6600
  }>;
6593
6601
  /**
6594
- * Lists teams for one organization as a global admin.
6602
+ * Lists teams for one organization. Global admins may list any organization;
6603
+ * an organization admin only their own.
6595
6604
  *
6596
6605
  * @param options - Organization ID, pagination, search, and ordering options
6597
6606
  * @returns The paginated organization team listing
@@ -6656,7 +6665,10 @@ declare class AdminService {
6656
6665
  data: AdminOrganization;
6657
6666
  } | null>;
6658
6667
  /**
6659
- * Updates an organization's profile and settings.
6668
+ * Updates an organization's profile and settings. Global admins may update
6669
+ * any organization; an organization admin only their own, and only the
6670
+ * fields they own — the slug, metadata, and billing configuration stay
6671
+ * global admin territory.
6660
6672
  *
6661
6673
  * @param options - Organization ID and the fields to update
6662
6674
  * @returns The updated organization
@@ -6779,6 +6791,10 @@ type ListMembersOptions = {
6779
6791
  limit?: number;
6780
6792
  /** Number of members to skip for pagination. */
6781
6793
  offset?: number;
6794
+ /** Member field used to order the page. */
6795
+ sortBy?: 'createdAt';
6796
+ /** Sort direction for the member page. */
6797
+ sortDirection?: 'asc' | 'desc';
6782
6798
  };
6783
6799
  /**
6784
6800
  * Options for inviting a user to the active organization.
@@ -6823,7 +6839,10 @@ type UpdateMemberRoleOptions = {
6823
6839
  /**
6824
6840
  * Payload for creating a new team.
6825
6841
  */
6826
- type CreateTeamPayload = Pick<Team, 'name'>;
6842
+ type CreateTeamPayload = Pick<Team, 'name'> & {
6843
+ /** User IDs of organization members to add to the team as it is created. */
6844
+ memberIds?: string[];
6845
+ };
6827
6846
  /**
6828
6847
  * Payload for updating an existing team.
6829
6848
  */
@@ -7031,6 +7050,8 @@ declare class OrganizationService {
7031
7050
  * Removes a user from the active organization.
7032
7051
  *
7033
7052
  * @param options - Provide either `memberId` or `userEmail` to identify the user
7053
+ * @param options.memberId - Membership ID to remove
7054
+ * @param options.userEmail - Email address of the member to remove
7034
7055
  */
7035
7056
  removeUserFromOrganization({ memberId, userEmail }: RemoveUserFromOrganizationOptions): Promise<void>;
7036
7057
  /**
@@ -7044,7 +7065,7 @@ declare class OrganizationService {
7044
7065
  /**
7045
7066
  * Creates a new team within the active organization.
7046
7067
  *
7047
- * @param payload - Team configuration with a `name` field
7068
+ * @param payload - Team configuration with a `name` field and optional `memberIds`
7048
7069
  * @returns The created team
7049
7070
  */
7050
7071
  createTeam(payload: CreateTeamPayload): Promise<{
@@ -7195,10 +7216,10 @@ declare class SessionService {
7195
7216
  } & {
7196
7217
  preferredLanguage: string;
7197
7218
  } & {
7219
+ lastActiveAt?: Date | null | undefined;
7198
7220
  displayName?: string | null | undefined;
7199
7221
  title?: string | null | undefined;
7200
7222
  pronouns?: string | null | undefined;
7201
- lastActiveAt?: Date | null | undefined;
7202
7223
  }>;
7203
7224
  session: better_auth.StripEmptyObjects<{
7204
7225
  id: string;
@@ -7436,10 +7457,10 @@ declare class EmailOTPService {
7436
7457
  } & {
7437
7458
  preferredLanguage: string;
7438
7459
  } & {
7460
+ lastActiveAt?: Date | null | undefined;
7439
7461
  displayName?: string | null | undefined;
7440
7462
  title?: string | null | undefined;
7441
7463
  pronouns?: string | null | undefined;
7442
- lastActiveAt?: Date | null | undefined;
7443
7464
  }>;
7444
7465
  }>;
7445
7466
  }
@@ -7489,10 +7510,10 @@ declare class UserService {
7489
7510
  } & {
7490
7511
  preferredLanguage: string;
7491
7512
  } & {
7513
+ lastActiveAt?: Date | null | undefined;
7492
7514
  displayName?: string | null | undefined;
7493
7515
  title?: string | null | undefined;
7494
7516
  pronouns?: string | null | undefined;
7495
- lastActiveAt?: Date | null | undefined;
7496
7517
  }>;
7497
7518
  }>;
7498
7519
  updateProfile(profile: UpdateUserProfilePayload): Promise<{
package/dist/index.mjs CHANGED
@@ -21,7 +21,7 @@ function isTokenExpired(token, expiresInMs) {
21
21
  return nowInSeconds > expirationTime;
22
22
  }
23
23
 
24
- const version = "1.37.0";
24
+ const version = "1.38.0";
25
25
 
26
26
  function parsedEnumValues(schema) {
27
27
  return Object.fromEntries(
@@ -652,10 +652,12 @@ class AdminService {
652
652
  });
653
653
  }
654
654
  /**
655
- * Lists users as a global admin, optionally with organization previews
656
- * and totals when a preview size is requested.
655
+ * Lists users, optionally with organization previews and totals when a
656
+ * preview size is requested. Global admins list across every organization
657
+ * and may narrow to one with organizationId; an organization admin always
658
+ * gets their own organization's users, without previews.
657
659
  *
658
- * @param options - Pagination, ordering, search, and preview options
660
+ * @param options - Pagination, ordering, search, preview, and organization options
659
661
  * @returns The paginated user listing
660
662
  */
661
663
  async listUsers(options = {}) {
@@ -668,7 +670,8 @@ class AdminService {
668
670
  ...options.sortDirection ? { sortDirection: options.sortDirection } : {},
669
671
  ...options.query ? { query: options.query } : {},
670
672
  ...options.organizationsPreview !== void 0 ? { organizations_preview: options.organizationsPreview } : {},
671
- ...options.includeInvitations !== void 0 ? { include_invitations: options.includeInvitations } : {}
673
+ ...options.includeInvitations !== void 0 ? { include_invitations: options.includeInvitations } : {},
674
+ ...options.organizationId ? { organization_id: options.organizationId } : {}
672
675
  }
673
676
  });
674
677
  }
@@ -766,7 +769,8 @@ class AdminService {
766
769
  });
767
770
  }
768
771
  /**
769
- * Lists teams for one organization as a global admin.
772
+ * Lists teams for one organization. Global admins may list any organization;
773
+ * an organization admin only their own.
770
774
  *
771
775
  * @param options - Organization ID, pagination, search, and ordering options
772
776
  * @returns The paginated organization team listing
@@ -862,7 +866,10 @@ class AdminService {
862
866
  return data;
863
867
  }
864
868
  /**
865
- * Updates an organization's profile and settings.
869
+ * Updates an organization's profile and settings. Global admins may update
870
+ * any organization; an organization admin only their own, and only the
871
+ * fields they own — the slug, metadata, and billing configuration stay
872
+ * global admin territory.
866
873
  *
867
874
  * @param options - Organization ID and the fields to update
868
875
  * @returns The updated organization
@@ -1679,6 +1686,8 @@ class OrganizationService {
1679
1686
  * Removes a user from the active organization.
1680
1687
  *
1681
1688
  * @param options - Provide either `memberId` or `userEmail` to identify the user
1689
+ * @param options.memberId - Membership ID to remove
1690
+ * @param options.userEmail - Email address of the member to remove
1682
1691
  */
1683
1692
  async removeUserFromOrganization({ memberId, userEmail }) {
1684
1693
  await this.client.organization.removeMember({
@@ -1701,7 +1710,7 @@ class OrganizationService {
1701
1710
  /**
1702
1711
  * Creates a new team within the active organization.
1703
1712
  *
1704
- * @param payload - Team configuration with a `name` field
1713
+ * @param payload - Team configuration with a `name` field and optional `memberIds`
1705
1714
  * @returns The created team
1706
1715
  */
1707
1716
  async createTeam(payload) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/auth-core",
3
- "version": "1.37.0",
3
+ "version": "1.38.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {