@meistrari/auth-nuxt 3.26.0 → 3.28.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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meistrari/auth-nuxt",
3
3
  "configKey": "telaAuth",
4
- "version": "3.26.0",
4
+ "version": "3.28.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -1,9 +1,11 @@
1
1
  import type { AdminApplicationRecord, AdminApplicationRole, AdminApplicationEntitlementRecord, AdminApplicationSecret, AdminEntitlementWithRules, AdminOrganization, AdminOrganizationSummary, AdminOrganizationTeamRecord, AdminUser, AdminUserAccess, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreatedAdminApplicationSecret, GetAdminOrganizationOptions, GetAdminOrganizationsSummaryOptions, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminUsersOptions, ListAdminUsersResult, AdminMember, RemoveAdminMemberOptions, ResendAdminInviteOptions, SetAdminEntitlementRulesOptions, SetAdminUserApplicationRoleOptions, SetAdminUserTeamOptions, UpdateAdminEntitlementOptions, UpdateAdminApplicationRoleOptions, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions } from '@meistrari/auth-core';
2
2
  export interface UseTelaAdminReturn {
3
3
  /**
4
- * Lists users as a global admin, optionally with organization previews
5
- * and totals when a preview size is requested.
6
- * @param options - Pagination, ordering, search, and preview options
4
+ * Lists users, optionally with organization previews and totals when a
5
+ * preview size is requested. Global admins list across every organization
6
+ * and may narrow to one with organizationId; an organization admin always
7
+ * gets their own organization's users, without previews.
8
+ * @param options - Pagination, ordering, search, preview, and organization options
7
9
  * @returns The paginated user listing
8
10
  */
9
11
  listUsers: (options?: ListAdminUsersOptions) => Promise<ListAdminUsersResult>;
@@ -129,7 +131,8 @@ export interface UseTelaAdminReturn {
129
131
  */
130
132
  listOrganizationMembers: (options: ListAdminOrganizationMembersOptions) => Promise<ListAdminOrganizationMembersResult>;
131
133
  /**
132
- * Lists teams for a single organization as a global admin.
134
+ * Lists teams for a single organization. Global admins may list any
135
+ * organization; an organization admin only their own.
133
136
  * @param options - Organization ID, pagination, search, and ordering options
134
137
  * @returns The paginated organization team listing
135
138
  */
@@ -155,7 +158,10 @@ export interface UseTelaAdminReturn {
155
158
  */
156
159
  createOrganization: (options: CreateAdminOrganizationOptions) => Promise<AdminOrganization>;
157
160
  /**
158
- * Updates an organization's profile and settings as a global admin.
161
+ * Updates an organization's profile and settings. Global admins may update
162
+ * any organization; an organization admin only their own, and only the
163
+ * fields they own — the slug, metadata, and billing configuration stay
164
+ * global admin territory.
159
165
  * @param options - Organization ID and the fields to update
160
166
  * @returns The updated organization
161
167
  */
@@ -1,4 +1,4 @@
1
- import type { AcceptInvitationResult, CreateTeamPayload, FullOrganization, Invitation, InviteUserToOrganizationOptions, ListMembersOptions, Member, RemoveUserFromOrganizationOptions, Team, TeamMember, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload } from '@meistrari/auth-core';
1
+ import type { AcceptInvitationResult, CreateTeamPayload, FullOrganization, Invitation, InviteUserToOrganizationOptions, ListMembersOptions, ListOrganizationsOptions, ListOrganizationsWithRoleOptions, Member, OrganizationWithRole, RemoveUserFromOrganizationOptions, Team, TeamMember, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload } from '@meistrari/auth-core';
2
2
  import type { Ref } from 'vue';
3
3
  export interface UseTelaOrganizationReturn {
4
4
  /** Reactive reference to the active organization with members, invitations, and teams. */
@@ -14,7 +14,10 @@ export interface UseTelaOrganizationReturn {
14
14
  * Lists all organizations for the current user session.
15
15
  * @returns A list of organizations
16
16
  */
17
- listOrganizations: () => Promise<FullOrganization[]>;
17
+ listOrganizations: {
18
+ (options: ListOrganizationsWithRoleOptions): Promise<Array<FullOrganization & OrganizationWithRole>>;
19
+ (options?: ListOrganizationsOptions): Promise<FullOrganization[]>;
20
+ };
18
21
  /**
19
22
  * Sets the active organization for the current user session and updates the active organization state.
20
23
  * @param id - The ID of the organization to set as active
@@ -15,17 +15,25 @@ export function useTelaOrganization() {
15
15
  activeOrganization.value = organization;
16
16
  return organization;
17
17
  }
18
- async function listOrganizations() {
19
- return await authClient.organization.listOrganizations();
18
+ async function listOrganizations(options) {
19
+ return await authClient.organization.listOrganizations(options);
20
20
  }
21
21
  async function setActiveOrganization(id) {
22
22
  await authClient.organization.setActiveOrganization(id);
23
- const [organization, { token }] = await Promise.all([
23
+ const [organization, member, { token }] = await Promise.all([
24
24
  authClient.organization.getOrganization(id),
25
+ authClient.organization.getActiveMember(),
25
26
  authClient.session.getToken()
26
27
  ]);
27
28
  useCookie(jwtCookieName).value = token;
28
29
  activeOrganization.value = organization;
30
+ activeMember.value = member;
31
+ if (session.value) {
32
+ session.value = {
33
+ ...session.value,
34
+ activeOrganizationId: id
35
+ };
36
+ }
29
37
  }
30
38
  async function updateOrganization(payload) {
31
39
  if (!activeOrganization.value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/auth-nuxt",
3
- "version": "3.26.0",
3
+ "version": "3.28.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -36,7 +36,7 @@
36
36
  "docs": "nuxt-module-build prepare && typedoc"
37
37
  },
38
38
  "dependencies": {
39
- "@meistrari/auth-core": "1.36.0",
39
+ "@meistrari/auth-core": "1.38.0",
40
40
  "jose": "6.1.3"
41
41
  },
42
42
  "peerDependencies": {