@develit-services/rbac 0.6.0 → 0.7.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.
@@ -1,2 +1,2 @@
1
- export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.Dk5HPpHF.cjs';
1
+ export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.D5N_wrRb.cjs';
2
2
  import 'drizzle-orm/sqlite-core';
@@ -1,2 +1,2 @@
1
- export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.Dk5HPpHF.mjs';
1
+ export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.D5N_wrRb.mjs';
2
2
  import 'drizzle-orm/sqlite-core';
@@ -1,2 +1,2 @@
1
- export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.Dk5HPpHF.js';
1
+ export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.D5N_wrRb.js';
2
2
  import 'drizzle-orm/sqlite-core';
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const backendSdk = require('@develit-io/backend-sdk');
6
6
  const database_schema = require('../shared/rbac.gXUvaSJ2.cjs');
7
7
  const drizzleOrm = require('drizzle-orm');
8
- const verifyScope = require('../shared/rbac.DH2MYF0T.cjs');
8
+ const verifyScope = require('../shared/rbac.CZCpmLF8.cjs');
9
9
  const zod = require('zod');
10
10
  const cloudflare_workers = require('cloudflare:workers');
11
11
  const d1 = require('drizzle-orm/d1');
@@ -181,6 +181,16 @@ const getAllRolesQuery = async ({
181
181
  return result;
182
182
  };
183
183
 
184
+ const getAllUserRolesQuery = async ({
185
+ db
186
+ }) => {
187
+ return await db.select({
188
+ userId: tables.userRole.userId,
189
+ roleId: tables.role.id,
190
+ roleName: tables.role.name
191
+ }).from(tables.userRole).leftJoin(tables.role, drizzleOrm.eq(tables.role.id, tables.userRole.roleId));
192
+ };
193
+
184
194
  const getRoleQuery = async ({
185
195
  db,
186
196
  roleId
@@ -590,6 +600,19 @@ let RbacServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
590
600
  }
591
601
  );
592
602
  }
603
+ async getAllUserRoles() {
604
+ return this.handleAction(
605
+ null,
606
+ { successMessage: "User roles successfully returned." },
607
+ async () => {
608
+ const userRoles = await getAllUserRolesQuery({ db: this.db });
609
+ return {
610
+ userRoles,
611
+ count: userRoles.length
612
+ };
613
+ }
614
+ );
615
+ }
593
616
  async getPermissions() {
594
617
  return this.handleAction(
595
618
  null,
@@ -834,6 +857,9 @@ __decorateClass([
834
857
  __decorateClass([
835
858
  backendSdk.action("revokeScopeFromRole")
836
859
  ], RbacServiceBase.prototype, "revokeScopeFromRole", 1);
860
+ __decorateClass([
861
+ backendSdk.action("getAllUserRoles")
862
+ ], RbacServiceBase.prototype, "getAllUserRoles", 1);
837
863
  __decorateClass([
838
864
  backendSdk.action("getPermissions")
839
865
  ], RbacServiceBase.prototype, "getPermissions", 1);
@@ -1,11 +1,11 @@
1
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
2
  import { IRPCResponse } from '@develit-io/backend-sdk';
3
- import { L as LabeledScope$1, t as tables, C as CreateRoleInput, a as CreateRoleOutput, A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, o as GetPermissionsOutput, p as GetUserPermissionsInput, q as GetUserPermissionsOutput, V as VerifyAccessInput, r as VerifyAccessOutput, D as DeleteRoleInput, s as DeleteRoleOutput, U as UpdateRoleInput, u as UpdateRoleOutput } from '../shared/rbac.DiIYl-FR.cjs';
3
+ import { L as LabeledScope$1, t as tables, C as CreateRoleInput, a as CreateRoleOutput, A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, o as GetAllUserRolesOutput, p as GetPermissionsOutput, q as GetUserPermissionsInput, r as GetUserPermissionsOutput, V as VerifyAccessInput, s as VerifyAccessOutput, D as DeleteRoleInput, u as DeleteRoleOutput, U as UpdateRoleInput, v as UpdateRoleOutput } from '../shared/rbac.DypKJ7qb.cjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import 'zod';
7
7
  import 'drizzle-orm';
8
- import '../shared/rbac.Dk5HPpHF.cjs';
8
+ import '../shared/rbac.D5N_wrRb.cjs';
9
9
  import 'drizzle-orm/sqlite-core';
10
10
 
11
11
  type TypedScopeObject<TScopes extends readonly LabeledScope$1[]> = {
@@ -33,6 +33,7 @@ declare class RbacServiceBase<TScopes extends readonly LabeledScope$1[] = Labele
33
33
  revokeScopeFromUser(input: RevokeScopeFromUserInput): Promise<IRPCResponse<RevokeScopeFromUserOutput>>;
34
34
  grantScopeToRole(input: GrantScopeToRoleInput): Promise<IRPCResponse<GrantScopeToRoleOutput>>;
35
35
  revokeScopeFromRole(input: RevokeScopeFromRoleInput): Promise<IRPCResponse<RevokeScopeFromRoleOutput>>;
36
+ getAllUserRoles(): Promise<IRPCResponse<GetAllUserRolesOutput>>;
36
37
  getPermissions(): Promise<IRPCResponse<GetPermissionsOutput>>;
37
38
  getUserPermissions(input: GetUserPermissionsInput): Promise<IRPCResponse<GetUserPermissionsOutput>>;
38
39
  verifyAccess(input: Omit<VerifyAccessInput, 'accessRequests'> & {
@@ -1,11 +1,11 @@
1
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
2
  import { IRPCResponse } from '@develit-io/backend-sdk';
3
- import { L as LabeledScope$1, t as tables, C as CreateRoleInput, a as CreateRoleOutput, A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, o as GetPermissionsOutput, p as GetUserPermissionsInput, q as GetUserPermissionsOutput, V as VerifyAccessInput, r as VerifyAccessOutput, D as DeleteRoleInput, s as DeleteRoleOutput, U as UpdateRoleInput, u as UpdateRoleOutput } from '../shared/rbac.4NEkwyHb.mjs';
3
+ import { L as LabeledScope$1, t as tables, C as CreateRoleInput, a as CreateRoleOutput, A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, o as GetAllUserRolesOutput, p as GetPermissionsOutput, q as GetUserPermissionsInput, r as GetUserPermissionsOutput, V as VerifyAccessInput, s as VerifyAccessOutput, D as DeleteRoleInput, u as DeleteRoleOutput, U as UpdateRoleInput, v as UpdateRoleOutput } from '../shared/rbac.CSHPMf7E.mjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import 'zod';
7
7
  import 'drizzle-orm';
8
- import '../shared/rbac.Dk5HPpHF.mjs';
8
+ import '../shared/rbac.D5N_wrRb.mjs';
9
9
  import 'drizzle-orm/sqlite-core';
10
10
 
11
11
  type TypedScopeObject<TScopes extends readonly LabeledScope$1[]> = {
@@ -33,6 +33,7 @@ declare class RbacServiceBase<TScopes extends readonly LabeledScope$1[] = Labele
33
33
  revokeScopeFromUser(input: RevokeScopeFromUserInput): Promise<IRPCResponse<RevokeScopeFromUserOutput>>;
34
34
  grantScopeToRole(input: GrantScopeToRoleInput): Promise<IRPCResponse<GrantScopeToRoleOutput>>;
35
35
  revokeScopeFromRole(input: RevokeScopeFromRoleInput): Promise<IRPCResponse<RevokeScopeFromRoleOutput>>;
36
+ getAllUserRoles(): Promise<IRPCResponse<GetAllUserRolesOutput>>;
36
37
  getPermissions(): Promise<IRPCResponse<GetPermissionsOutput>>;
37
38
  getUserPermissions(input: GetUserPermissionsInput): Promise<IRPCResponse<GetUserPermissionsOutput>>;
38
39
  verifyAccess(input: Omit<VerifyAccessInput, 'accessRequests'> & {
@@ -1,11 +1,11 @@
1
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
2
  import { IRPCResponse } from '@develit-io/backend-sdk';
3
- import { L as LabeledScope$1, t as tables, C as CreateRoleInput, a as CreateRoleOutput, A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, o as GetPermissionsOutput, p as GetUserPermissionsInput, q as GetUserPermissionsOutput, V as VerifyAccessInput, r as VerifyAccessOutput, D as DeleteRoleInput, s as DeleteRoleOutput, U as UpdateRoleInput, u as UpdateRoleOutput } from '../shared/rbac.B4swuPCq.js';
3
+ import { L as LabeledScope$1, t as tables, C as CreateRoleInput, a as CreateRoleOutput, A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, o as GetAllUserRolesOutput, p as GetPermissionsOutput, q as GetUserPermissionsInput, r as GetUserPermissionsOutput, V as VerifyAccessInput, s as VerifyAccessOutput, D as DeleteRoleInput, u as DeleteRoleOutput, U as UpdateRoleInput, v as UpdateRoleOutput } from '../shared/rbac.CkCfjtKu.js';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import 'zod';
7
7
  import 'drizzle-orm';
8
- import '../shared/rbac.Dk5HPpHF.js';
8
+ import '../shared/rbac.D5N_wrRb.js';
9
9
  import 'drizzle-orm/sqlite-core';
10
10
 
11
11
  type TypedScopeObject<TScopes extends readonly LabeledScope$1[]> = {
@@ -33,6 +33,7 @@ declare class RbacServiceBase<TScopes extends readonly LabeledScope$1[] = Labele
33
33
  revokeScopeFromUser(input: RevokeScopeFromUserInput): Promise<IRPCResponse<RevokeScopeFromUserOutput>>;
34
34
  grantScopeToRole(input: GrantScopeToRoleInput): Promise<IRPCResponse<GrantScopeToRoleOutput>>;
35
35
  revokeScopeFromRole(input: RevokeScopeFromRoleInput): Promise<IRPCResponse<RevokeScopeFromRoleOutput>>;
36
+ getAllUserRoles(): Promise<IRPCResponse<GetAllUserRolesOutput>>;
36
37
  getPermissions(): Promise<IRPCResponse<GetPermissionsOutput>>;
37
38
  getUserPermissions(input: GetUserPermissionsInput): Promise<IRPCResponse<GetUserPermissionsOutput>>;
38
39
  verifyAccess(input: Omit<VerifyAccessInput, 'accessRequests'> & {
@@ -1,7 +1,7 @@
1
1
  import { uuidv4, first, createInternalError, develitWorker, action, service } from '@develit-io/backend-sdk';
2
2
  import { s as schema } from '../shared/rbac.H1LXb5Lk.mjs';
3
3
  import { eq, and, count, inArray } from 'drizzle-orm';
4
- import { c as createRoleInputSchema, a as assignRoleToUserInputSchema, b as assignRolesToUserInputSchema, r as revokeRoleFromUserInputSchema, f as grantScopeToUserInputSchema, h as grantScopesToUserInputSchema, n as revokeScopeFromUserInputSchema, e as grantScopeToRoleInputSchema, m as revokeScopeFromRoleInputSchema, g as getUserPermissionsInputSchema, v as verifyAccessInputSchema, d as deleteRoleInputSchema, u as updateRoleInputSchema, l as isScopeObject, k as isOrCondition, i as isAndCondition, j as isImplicitAndCondition } from '../shared/rbac.tv1QQcSW.mjs';
4
+ import { c as createRoleInputSchema, a as assignRoleToUserInputSchema, b as assignRolesToUserInputSchema, r as revokeRoleFromUserInputSchema, f as grantScopeToUserInputSchema, h as grantScopesToUserInputSchema, n as revokeScopeFromUserInputSchema, e as grantScopeToRoleInputSchema, m as revokeScopeFromRoleInputSchema, g as getUserPermissionsInputSchema, v as verifyAccessInputSchema, d as deleteRoleInputSchema, u as updateRoleInputSchema, l as isScopeObject, k as isOrCondition, i as isAndCondition, j as isImplicitAndCondition } from '../shared/rbac.BypNeIm_.mjs';
5
5
  import { z } from 'zod';
6
6
  import { WorkerEntrypoint } from 'cloudflare:workers';
7
7
  import { drizzle } from 'drizzle-orm/d1';
@@ -177,6 +177,16 @@ const getAllRolesQuery = async ({
177
177
  return result;
178
178
  };
179
179
 
180
+ const getAllUserRolesQuery = async ({
181
+ db
182
+ }) => {
183
+ return await db.select({
184
+ userId: tables.userRole.userId,
185
+ roleId: tables.role.id,
186
+ roleName: tables.role.name
187
+ }).from(tables.userRole).leftJoin(tables.role, eq(tables.role.id, tables.userRole.roleId));
188
+ };
189
+
180
190
  const getRoleQuery = async ({
181
191
  db,
182
192
  roleId
@@ -586,6 +596,19 @@ let RbacServiceBase = class extends develitWorker(WorkerEntrypoint) {
586
596
  }
587
597
  );
588
598
  }
599
+ async getAllUserRoles() {
600
+ return this.handleAction(
601
+ null,
602
+ { successMessage: "User roles successfully returned." },
603
+ async () => {
604
+ const userRoles = await getAllUserRolesQuery({ db: this.db });
605
+ return {
606
+ userRoles,
607
+ count: userRoles.length
608
+ };
609
+ }
610
+ );
611
+ }
589
612
  async getPermissions() {
590
613
  return this.handleAction(
591
614
  null,
@@ -830,6 +853,9 @@ __decorateClass([
830
853
  __decorateClass([
831
854
  action("revokeScopeFromRole")
832
855
  ], RbacServiceBase.prototype, "revokeScopeFromRole", 1);
856
+ __decorateClass([
857
+ action("getAllUserRoles")
858
+ ], RbacServiceBase.prototype, "getAllUserRoles", 1);
833
859
  __decorateClass([
834
860
  action("getPermissions")
835
861
  ], RbacServiceBase.prototype, "getPermissions", 1);
@@ -72,8 +72,7 @@ const updateRoleInputSchema = z.object({
72
72
 
73
73
  const userDataSchema = z.object({
74
74
  referenceId: z.string(),
75
- email: z.string().optional(),
76
- role: z.string().optional()
75
+ email: z.string().optional()
77
76
  });
78
77
  const jwtUserSchema = z.object({
79
78
  id: z.uuid(),
@@ -83,7 +82,6 @@ const jwtUserSchema = z.object({
83
82
  updatedBy: z.string().nullable().optional(),
84
83
  deletedAt: z.date().nullable(),
85
84
  deletedBy: z.string().nullable().optional(),
86
- role: z.string(),
87
85
  email: z.email(),
88
86
  rawAppMetaData: z.any(),
89
87
  rawUserMetaData: z.any(),
@@ -107,7 +105,6 @@ const jwtPayloadSchema = z.object({
107
105
  updatedBy: z.string().nullable().optional(),
108
106
  deletedAt: z.date().nullable(),
109
107
  deletedBy: z.string().nullable().optional(),
110
- role: z.string(),
111
108
  email: z.email(),
112
109
  rawAppMetaData: z.any(),
113
110
  rawUserMetaData: z.any(),
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { InferSelectModel, InferInsertModel } from 'drizzle-orm';
3
- import { s as schema } from './rbac.Dk5HPpHF.js';
3
+ import { s as schema } from './rbac.D5N_wrRb.mjs';
4
4
 
5
5
  declare const tables: typeof schema;
6
6
 
@@ -64,6 +64,15 @@ interface DeleteRoleInput extends z.infer<typeof deleteRoleInputSchema> {
64
64
  interface DeleteRoleOutput {
65
65
  }
66
66
 
67
+ interface GetAllUserRolesOutput {
68
+ userRoles: {
69
+ userId: string;
70
+ roleId: string | null;
71
+ roleName: string | null;
72
+ }[];
73
+ count: number;
74
+ }
75
+
67
76
  interface GetPermissionsOutput {
68
77
  roles: {
69
78
  id: string;
@@ -214,14 +223,12 @@ declare const verifyAccessInputSchema: z.ZodObject<{
214
223
  userData: z.ZodOptional<z.ZodObject<{
215
224
  referenceId: z.ZodString;
216
225
  email: z.ZodOptional<z.ZodString>;
217
- role: z.ZodOptional<z.ZodString>;
218
226
  }, z.core.$strip>>;
219
227
  user: z.ZodObject<{
220
228
  id: z.ZodUUID;
221
229
  createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
222
230
  updatedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
223
231
  deletedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
224
- role: z.ZodString;
225
232
  email: z.ZodEmail;
226
233
  rawAppMetaData: z.ZodAny;
227
234
  rawUserMetaData: z.ZodAny;
@@ -254,5 +261,5 @@ declare function isAndCondition(condition: ScopeCondition): condition is {
254
261
  };
255
262
  declare function isImplicitAndCondition(condition: ScopeCondition): condition is ScopeCondition[];
256
263
 
257
- export { revokeScopeFromRoleInputSchema as $, assignRoleToUserInputSchema as J, assignRolesToUserInputSchema as K, createRoleInputSchema as M, deleteRoleInputSchema as N, getUserPermissionsInputSchema as O, grantScopeToRoleInputSchema as P, grantScopeToUserInputSchema as Q, grantScopesToUserInputSchema as T, isAndCondition as W, isImplicitAndCondition as X, isOrCondition as Y, isScopeObject as Z, revokeRoleFromUserInputSchema as _, revokeScopeFromUserInputSchema as a0, scopeConditionSchema as a1, scopeObjectSchema as a2, updateRoleInputSchema as a3, verifyAccessInputSchema as a4, tables as t };
258
- export type { AssignRoleToUserInput as A, ScopeObject as B, CreateRoleInput as C, DeleteRoleInput as D, UserRoleInsertType as E, UserRoleSelectType as F, GrantScopeToUserInput as G, UserScopeInsertType as H, UserScopeSelectType as I, LabeledScope as L, RevokeRoleFromUserInput as R, Scope as S, UpdateRoleInput as U, VerifyAccessInput as V, CreateRoleOutput as a, AssignRoleToUserOutput as b, AssignRolesToUserInput as c, AssignRolesToUserOutput as d, RevokeRoleFromUserOutput as e, GrantScopeToUserOutput as f, GrantScopesToUserInput as g, GrantScopesToUserOutput as h, RevokeScopeFromUserInput as i, RevokeScopeFromUserOutput as j, GrantScopeToRoleInput as k, GrantScopeToRoleOutput as l, RevokeScopeFromRoleInput as m, RevokeScopeFromRoleOutput as n, GetPermissionsOutput as o, GetUserPermissionsInput as p, GetUserPermissionsOutput as q, VerifyAccessOutput as r, DeleteRoleOutput as s, UpdateRoleOutput as u, RoleInsertType as v, RoleScopeInsertType as w, RoleScopeSelectType as x, RoleSelectType as y, ScopeCondition as z };
264
+ export { revokeRoleFromUserInputSchema as $, assignRoleToUserInputSchema as K, assignRolesToUserInputSchema as M, createRoleInputSchema as N, deleteRoleInputSchema as O, getUserPermissionsInputSchema as P, grantScopeToRoleInputSchema as Q, grantScopeToUserInputSchema as T, grantScopesToUserInputSchema as W, isAndCondition as X, isImplicitAndCondition as Y, isOrCondition as Z, isScopeObject as _, revokeScopeFromRoleInputSchema as a0, revokeScopeFromUserInputSchema as a1, scopeConditionSchema as a2, scopeObjectSchema as a3, updateRoleInputSchema as a4, verifyAccessInputSchema as a5, tables as t };
265
+ export type { AssignRoleToUserInput as A, ScopeCondition as B, CreateRoleInput as C, DeleteRoleInput as D, ScopeObject as E, UserRoleInsertType as F, GrantScopeToUserInput as G, UserRoleSelectType as H, UserScopeInsertType as I, UserScopeSelectType as J, LabeledScope as L, RevokeRoleFromUserInput as R, Scope as S, UpdateRoleInput as U, VerifyAccessInput as V, CreateRoleOutput as a, AssignRoleToUserOutput as b, AssignRolesToUserInput as c, AssignRolesToUserOutput as d, RevokeRoleFromUserOutput as e, GrantScopeToUserOutput as f, GrantScopesToUserInput as g, GrantScopesToUserOutput as h, RevokeScopeFromUserInput as i, RevokeScopeFromUserOutput as j, GrantScopeToRoleInput as k, GrantScopeToRoleOutput as l, RevokeScopeFromRoleInput as m, RevokeScopeFromRoleOutput as n, GetAllUserRolesOutput as o, GetPermissionsOutput as p, GetUserPermissionsInput as q, GetUserPermissionsOutput as r, VerifyAccessOutput as s, DeleteRoleOutput as u, UpdateRoleOutput as v, RoleInsertType as w, RoleScopeInsertType as x, RoleScopeSelectType as y, RoleSelectType as z };
@@ -74,8 +74,7 @@ const updateRoleInputSchema = zod.z.object({
74
74
 
75
75
  const userDataSchema = zod.z.object({
76
76
  referenceId: zod.z.string(),
77
- email: zod.z.string().optional(),
78
- role: zod.z.string().optional()
77
+ email: zod.z.string().optional()
79
78
  });
80
79
  const jwtUserSchema = zod.z.object({
81
80
  id: zod.z.uuid(),
@@ -85,7 +84,6 @@ const jwtUserSchema = zod.z.object({
85
84
  updatedBy: zod.z.string().nullable().optional(),
86
85
  deletedAt: zod.z.date().nullable(),
87
86
  deletedBy: zod.z.string().nullable().optional(),
88
- role: zod.z.string(),
89
87
  email: zod.z.email(),
90
88
  rawAppMetaData: zod.z.any(),
91
89
  rawUserMetaData: zod.z.any(),
@@ -109,7 +107,6 @@ const jwtPayloadSchema = zod.z.object({
109
107
  updatedBy: zod.z.string().nullable().optional(),
110
108
  deletedAt: zod.z.date().nullable(),
111
109
  deletedBy: zod.z.string().nullable().optional(),
112
- role: zod.z.string(),
113
110
  email: zod.z.email(),
114
111
  rawAppMetaData: zod.z.any(),
115
112
  rawUserMetaData: zod.z.any(),
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { InferSelectModel, InferInsertModel } from 'drizzle-orm';
3
- import { s as schema } from './rbac.Dk5HPpHF.mjs';
3
+ import { s as schema } from './rbac.D5N_wrRb.js';
4
4
 
5
5
  declare const tables: typeof schema;
6
6
 
@@ -64,6 +64,15 @@ interface DeleteRoleInput extends z.infer<typeof deleteRoleInputSchema> {
64
64
  interface DeleteRoleOutput {
65
65
  }
66
66
 
67
+ interface GetAllUserRolesOutput {
68
+ userRoles: {
69
+ userId: string;
70
+ roleId: string | null;
71
+ roleName: string | null;
72
+ }[];
73
+ count: number;
74
+ }
75
+
67
76
  interface GetPermissionsOutput {
68
77
  roles: {
69
78
  id: string;
@@ -214,14 +223,12 @@ declare const verifyAccessInputSchema: z.ZodObject<{
214
223
  userData: z.ZodOptional<z.ZodObject<{
215
224
  referenceId: z.ZodString;
216
225
  email: z.ZodOptional<z.ZodString>;
217
- role: z.ZodOptional<z.ZodString>;
218
226
  }, z.core.$strip>>;
219
227
  user: z.ZodObject<{
220
228
  id: z.ZodUUID;
221
229
  createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
222
230
  updatedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
223
231
  deletedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
224
- role: z.ZodString;
225
232
  email: z.ZodEmail;
226
233
  rawAppMetaData: z.ZodAny;
227
234
  rawUserMetaData: z.ZodAny;
@@ -254,5 +261,5 @@ declare function isAndCondition(condition: ScopeCondition): condition is {
254
261
  };
255
262
  declare function isImplicitAndCondition(condition: ScopeCondition): condition is ScopeCondition[];
256
263
 
257
- export { revokeScopeFromRoleInputSchema as $, assignRoleToUserInputSchema as J, assignRolesToUserInputSchema as K, createRoleInputSchema as M, deleteRoleInputSchema as N, getUserPermissionsInputSchema as O, grantScopeToRoleInputSchema as P, grantScopeToUserInputSchema as Q, grantScopesToUserInputSchema as T, isAndCondition as W, isImplicitAndCondition as X, isOrCondition as Y, isScopeObject as Z, revokeRoleFromUserInputSchema as _, revokeScopeFromUserInputSchema as a0, scopeConditionSchema as a1, scopeObjectSchema as a2, updateRoleInputSchema as a3, verifyAccessInputSchema as a4, tables as t };
258
- export type { AssignRoleToUserInput as A, ScopeObject as B, CreateRoleInput as C, DeleteRoleInput as D, UserRoleInsertType as E, UserRoleSelectType as F, GrantScopeToUserInput as G, UserScopeInsertType as H, UserScopeSelectType as I, LabeledScope as L, RevokeRoleFromUserInput as R, Scope as S, UpdateRoleInput as U, VerifyAccessInput as V, CreateRoleOutput as a, AssignRoleToUserOutput as b, AssignRolesToUserInput as c, AssignRolesToUserOutput as d, RevokeRoleFromUserOutput as e, GrantScopeToUserOutput as f, GrantScopesToUserInput as g, GrantScopesToUserOutput as h, RevokeScopeFromUserInput as i, RevokeScopeFromUserOutput as j, GrantScopeToRoleInput as k, GrantScopeToRoleOutput as l, RevokeScopeFromRoleInput as m, RevokeScopeFromRoleOutput as n, GetPermissionsOutput as o, GetUserPermissionsInput as p, GetUserPermissionsOutput as q, VerifyAccessOutput as r, DeleteRoleOutput as s, UpdateRoleOutput as u, RoleInsertType as v, RoleScopeInsertType as w, RoleScopeSelectType as x, RoleSelectType as y, ScopeCondition as z };
264
+ export { revokeRoleFromUserInputSchema as $, assignRoleToUserInputSchema as K, assignRolesToUserInputSchema as M, createRoleInputSchema as N, deleteRoleInputSchema as O, getUserPermissionsInputSchema as P, grantScopeToRoleInputSchema as Q, grantScopeToUserInputSchema as T, grantScopesToUserInputSchema as W, isAndCondition as X, isImplicitAndCondition as Y, isOrCondition as Z, isScopeObject as _, revokeScopeFromRoleInputSchema as a0, revokeScopeFromUserInputSchema as a1, scopeConditionSchema as a2, scopeObjectSchema as a3, updateRoleInputSchema as a4, verifyAccessInputSchema as a5, tables as t };
265
+ export type { AssignRoleToUserInput as A, ScopeCondition as B, CreateRoleInput as C, DeleteRoleInput as D, ScopeObject as E, UserRoleInsertType as F, GrantScopeToUserInput as G, UserRoleSelectType as H, UserScopeInsertType as I, UserScopeSelectType as J, LabeledScope as L, RevokeRoleFromUserInput as R, Scope as S, UpdateRoleInput as U, VerifyAccessInput as V, CreateRoleOutput as a, AssignRoleToUserOutput as b, AssignRolesToUserInput as c, AssignRolesToUserOutput as d, RevokeRoleFromUserOutput as e, GrantScopeToUserOutput as f, GrantScopesToUserInput as g, GrantScopesToUserOutput as h, RevokeScopeFromUserInput as i, RevokeScopeFromUserOutput as j, GrantScopeToRoleInput as k, GrantScopeToRoleOutput as l, RevokeScopeFromRoleInput as m, RevokeScopeFromRoleOutput as n, GetAllUserRolesOutput as o, GetPermissionsOutput as p, GetUserPermissionsInput as q, GetUserPermissionsOutput as r, VerifyAccessOutput as s, DeleteRoleOutput as u, UpdateRoleOutput as v, RoleInsertType as w, RoleScopeInsertType as x, RoleScopeSelectType as y, RoleSelectType as z };