@meistrari/auth-core 1.37.0 → 1.39.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
@@ -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.
@@ -6386,6 +6392,13 @@ type InviteAdminOrganizationUsersOptions = {
6386
6392
  /** Teams joined when each invitation is accepted. */
6387
6393
  teamIds?: string[];
6388
6394
  applicationId?: string;
6395
+ /**
6396
+ * When false, skips the invitation flow and adds each user as a member
6397
+ * immediately, creating the user account if it does not exist yet.
6398
+ * This mode is restricted to global administrators.
6399
+ * Defaults to true (send an invitation email).
6400
+ */
6401
+ sendInvite?: boolean;
6389
6402
  };
6390
6403
  /**
6391
6404
  * Per-email outcome of a batch organization invite.
@@ -6516,10 +6529,12 @@ declare class AdminService {
6516
6529
  error: null;
6517
6530
  }>;
6518
6531
  /**
6519
- * Lists users as a global admin, optionally with organization previews
6520
- * and totals when a preview size is requested.
6532
+ * Lists users, optionally with organization previews and totals when a
6533
+ * preview size is requested. Global admins list across every organization
6534
+ * and may narrow to one with organizationId; an organization admin always
6535
+ * gets their own organization's users, without previews.
6521
6536
  *
6522
- * @param options - Pagination, ordering, search, and preview options
6537
+ * @param options - Pagination, ordering, search, preview, and organization options
6523
6538
  * @returns The paginated user listing
6524
6539
  */
6525
6540
  listUsers(options?: ListAdminUsersOptions): Promise<{
@@ -6591,7 +6606,8 @@ declare class AdminService {
6591
6606
  error: null;
6592
6607
  }>;
6593
6608
  /**
6594
- * Lists teams for one organization as a global admin.
6609
+ * Lists teams for one organization. Global admins may list any organization;
6610
+ * an organization admin only their own.
6595
6611
  *
6596
6612
  * @param options - Organization ID, pagination, search, and ordering options
6597
6613
  * @returns The paginated organization team listing
@@ -6656,7 +6672,10 @@ declare class AdminService {
6656
6672
  data: AdminOrganization;
6657
6673
  } | null>;
6658
6674
  /**
6659
- * Updates an organization's profile and settings.
6675
+ * Updates an organization's profile and settings. Global admins may update
6676
+ * any organization; an organization admin only their own, and only the
6677
+ * fields they own — the slug, metadata, and billing configuration stay
6678
+ * global admin territory.
6660
6679
  *
6661
6680
  * @param options - Organization ID and the fields to update
6662
6681
  * @returns The updated organization
@@ -6722,8 +6741,10 @@ declare class AdminService {
6722
6741
  */
6723
6742
  resendInvite(options: ResendAdminInviteOptions): Promise<void>;
6724
6743
  /**
6725
- * Invites several users to an organization in one call. Failures are
6726
- * isolated per email in the results payload.
6744
+ * Invites several users to an organization in one call, or — with
6745
+ * `sendInvite: false` — adds them as members immediately, creating user
6746
+ * accounts as needed. Failures are isolated per email in the results
6747
+ * payload.
6727
6748
  *
6728
6749
  * @param options - Organization, emails, role, and optional teams/application
6729
6750
  * @returns Per-email invite outcomes
@@ -6779,6 +6800,10 @@ type ListMembersOptions = {
6779
6800
  limit?: number;
6780
6801
  /** Number of members to skip for pagination. */
6781
6802
  offset?: number;
6803
+ /** Member field used to order the page. */
6804
+ sortBy?: 'createdAt';
6805
+ /** Sort direction for the member page. */
6806
+ sortDirection?: 'asc' | 'desc';
6782
6807
  };
6783
6808
  /**
6784
6809
  * Options for inviting a user to the active organization.
@@ -6823,7 +6848,10 @@ type UpdateMemberRoleOptions = {
6823
6848
  /**
6824
6849
  * Payload for creating a new team.
6825
6850
  */
6826
- type CreateTeamPayload = Pick<Team, 'name'>;
6851
+ type CreateTeamPayload = Pick<Team, 'name'> & {
6852
+ /** User IDs of organization members to add to the team as it is created. */
6853
+ memberIds?: string[];
6854
+ };
6827
6855
  /**
6828
6856
  * Payload for updating an existing team.
6829
6857
  */
@@ -7031,6 +7059,8 @@ declare class OrganizationService {
7031
7059
  * Removes a user from the active organization.
7032
7060
  *
7033
7061
  * @param options - Provide either `memberId` or `userEmail` to identify the user
7062
+ * @param options.memberId - Membership ID to remove
7063
+ * @param options.userEmail - Email address of the member to remove
7034
7064
  */
7035
7065
  removeUserFromOrganization({ memberId, userEmail }: RemoveUserFromOrganizationOptions): Promise<void>;
7036
7066
  /**
@@ -7044,7 +7074,7 @@ declare class OrganizationService {
7044
7074
  /**
7045
7075
  * Creates a new team within the active organization.
7046
7076
  *
7047
- * @param payload - Team configuration with a `name` field
7077
+ * @param payload - Team configuration with a `name` field and optional `memberIds`
7048
7078
  * @returns The created team
7049
7079
  */
7050
7080
  createTeam(payload: CreateTeamPayload): Promise<{
package/dist/index.d.ts CHANGED
@@ -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.
@@ -6386,6 +6392,13 @@ type InviteAdminOrganizationUsersOptions = {
6386
6392
  /** Teams joined when each invitation is accepted. */
6387
6393
  teamIds?: string[];
6388
6394
  applicationId?: string;
6395
+ /**
6396
+ * When false, skips the invitation flow and adds each user as a member
6397
+ * immediately, creating the user account if it does not exist yet.
6398
+ * This mode is restricted to global administrators.
6399
+ * Defaults to true (send an invitation email).
6400
+ */
6401
+ sendInvite?: boolean;
6389
6402
  };
6390
6403
  /**
6391
6404
  * Per-email outcome of a batch organization invite.
@@ -6516,10 +6529,12 @@ declare class AdminService {
6516
6529
  error: null;
6517
6530
  }>;
6518
6531
  /**
6519
- * Lists users as a global admin, optionally with organization previews
6520
- * and totals when a preview size is requested.
6532
+ * Lists users, optionally with organization previews and totals when a
6533
+ * preview size is requested. Global admins list across every organization
6534
+ * and may narrow to one with organizationId; an organization admin always
6535
+ * gets their own organization's users, without previews.
6521
6536
  *
6522
- * @param options - Pagination, ordering, search, and preview options
6537
+ * @param options - Pagination, ordering, search, preview, and organization options
6523
6538
  * @returns The paginated user listing
6524
6539
  */
6525
6540
  listUsers(options?: ListAdminUsersOptions): Promise<{
@@ -6591,7 +6606,8 @@ declare class AdminService {
6591
6606
  error: null;
6592
6607
  }>;
6593
6608
  /**
6594
- * Lists teams for one organization as a global admin.
6609
+ * Lists teams for one organization. Global admins may list any organization;
6610
+ * an organization admin only their own.
6595
6611
  *
6596
6612
  * @param options - Organization ID, pagination, search, and ordering options
6597
6613
  * @returns The paginated organization team listing
@@ -6656,7 +6672,10 @@ declare class AdminService {
6656
6672
  data: AdminOrganization;
6657
6673
  } | null>;
6658
6674
  /**
6659
- * Updates an organization's profile and settings.
6675
+ * Updates an organization's profile and settings. Global admins may update
6676
+ * any organization; an organization admin only their own, and only the
6677
+ * fields they own — the slug, metadata, and billing configuration stay
6678
+ * global admin territory.
6660
6679
  *
6661
6680
  * @param options - Organization ID and the fields to update
6662
6681
  * @returns The updated organization
@@ -6722,8 +6741,10 @@ declare class AdminService {
6722
6741
  */
6723
6742
  resendInvite(options: ResendAdminInviteOptions): Promise<void>;
6724
6743
  /**
6725
- * Invites several users to an organization in one call. Failures are
6726
- * isolated per email in the results payload.
6744
+ * Invites several users to an organization in one call, or — with
6745
+ * `sendInvite: false` — adds them as members immediately, creating user
6746
+ * accounts as needed. Failures are isolated per email in the results
6747
+ * payload.
6727
6748
  *
6728
6749
  * @param options - Organization, emails, role, and optional teams/application
6729
6750
  * @returns Per-email invite outcomes
@@ -6779,6 +6800,10 @@ type ListMembersOptions = {
6779
6800
  limit?: number;
6780
6801
  /** Number of members to skip for pagination. */
6781
6802
  offset?: number;
6803
+ /** Member field used to order the page. */
6804
+ sortBy?: 'createdAt';
6805
+ /** Sort direction for the member page. */
6806
+ sortDirection?: 'asc' | 'desc';
6782
6807
  };
6783
6808
  /**
6784
6809
  * Options for inviting a user to the active organization.
@@ -6823,7 +6848,10 @@ type UpdateMemberRoleOptions = {
6823
6848
  /**
6824
6849
  * Payload for creating a new team.
6825
6850
  */
6826
- type CreateTeamPayload = Pick<Team, 'name'>;
6851
+ type CreateTeamPayload = Pick<Team, 'name'> & {
6852
+ /** User IDs of organization members to add to the team as it is created. */
6853
+ memberIds?: string[];
6854
+ };
6827
6855
  /**
6828
6856
  * Payload for updating an existing team.
6829
6857
  */
@@ -7031,6 +7059,8 @@ declare class OrganizationService {
7031
7059
  * Removes a user from the active organization.
7032
7060
  *
7033
7061
  * @param options - Provide either `memberId` or `userEmail` to identify the user
7062
+ * @param options.memberId - Membership ID to remove
7063
+ * @param options.userEmail - Email address of the member to remove
7034
7064
  */
7035
7065
  removeUserFromOrganization({ memberId, userEmail }: RemoveUserFromOrganizationOptions): Promise<void>;
7036
7066
  /**
@@ -7044,7 +7074,7 @@ declare class OrganizationService {
7044
7074
  /**
7045
7075
  * Creates a new team within the active organization.
7046
7076
  *
7047
- * @param payload - Team configuration with a `name` field
7077
+ * @param payload - Team configuration with a `name` field and optional `memberIds`
7048
7078
  * @returns The created team
7049
7079
  */
7050
7080
  createTeam(payload: CreateTeamPayload): 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.39.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
@@ -970,8 +977,10 @@ class AdminService {
970
977
  });
971
978
  }
972
979
  /**
973
- * Invites several users to an organization in one call. Failures are
974
- * isolated per email in the results payload.
980
+ * Invites several users to an organization in one call, or — with
981
+ * `sendInvite: false` — adds them as members immediately, creating user
982
+ * accounts as needed. Failures are isolated per email in the results
983
+ * payload.
975
984
  *
976
985
  * @param options - Organization, emails, role, and optional teams/application
977
986
  * @returns Per-email invite outcomes
@@ -979,7 +988,7 @@ class AdminService {
979
988
  async inviteOrganizationUsers(options) {
980
989
  const { data } = await this.client.$fetch("/admin/organizations/users", {
981
990
  method: "POST",
982
- body: { ...options, sendInvite: true }
991
+ body: { ...options, sendInvite: options.sendInvite ?? true }
983
992
  });
984
993
  return data;
985
994
  }
@@ -1679,6 +1688,8 @@ class OrganizationService {
1679
1688
  * Removes a user from the active organization.
1680
1689
  *
1681
1690
  * @param options - Provide either `memberId` or `userEmail` to identify the user
1691
+ * @param options.memberId - Membership ID to remove
1692
+ * @param options.userEmail - Email address of the member to remove
1682
1693
  */
1683
1694
  async removeUserFromOrganization({ memberId, userEmail }) {
1684
1695
  await this.client.organization.removeMember({
@@ -1701,7 +1712,7 @@ class OrganizationService {
1701
1712
  /**
1702
1713
  * Creates a new team within the active organization.
1703
1714
  *
1704
- * @param payload - Team configuration with a `name` field
1715
+ * @param payload - Team configuration with a `name` field and optional `memberIds`
1705
1716
  * @returns The created team
1706
1717
  */
1707
1718
  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.39.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {