@develit-services/rbac 0.1.1 → 0.2.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.
@@ -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.Cra1T2nC.cjs');
7
7
  const drizzleOrm = require('drizzle-orm');
8
- const verifyScope = require('../shared/rbac.CS8i19gH.cjs');
8
+ const verifyScope = require('../shared/rbac.B2KUW5xp.cjs');
9
9
  const zod = require('zod');
10
10
  const cloudflare_workers = require('cloudflare:workers');
11
11
  const d1 = require('drizzle-orm/d1');
@@ -627,11 +627,13 @@ let RbacServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
627
627
  const scopes = resultScopes.map((scope) => ({
628
628
  id: scope.id,
629
629
  scope: scope.scope,
630
+ label: this.SCOPES.find((s) => s.value === scope.scope)?.label || null,
630
631
  resourceId: scope.resourceId
631
632
  }));
632
633
  const roleScopes = resultRoleScopes.map((scope) => ({
633
634
  id: scope.id,
634
635
  scope: scope.scope,
636
+ label: this.SCOPES.find((s) => s.value === scope.scope)?.label || null,
635
637
  resourceId: scope.resourceId
636
638
  }));
637
639
  return {
@@ -1,6 +1,6 @@
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, 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.CZnF-YgH.cjs';
3
+ import { L as LabeledScope, 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.ChX0LW__.cjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import 'zod';
@@ -1,6 +1,6 @@
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, 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.DhS7RHC3.mjs';
3
+ import { L as LabeledScope, 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.tHFc50IZ.mjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import 'zod';
@@ -1,6 +1,6 @@
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, 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.DqMMROM3.js';
3
+ import { L as LabeledScope, 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.tvGvbXUm.js';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import 'zod';
@@ -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.D5OV7UPA.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, j as revokeScopeFromUserInputSchema, e as grantScopeToRoleInputSchema, i as revokeScopeFromRoleInputSchema, g as getUserPermissionsInputSchema, v as verifyAccessInputSchema, d as deleteRoleInputSchema, u as updateRoleInputSchema } from '../shared/rbac.wzMQF48s.mjs';
4
+ import { c as createRoleInputSchema, a as assignRoleToUserInputSchema, b as assignRolesToUserInputSchema, r as revokeRoleFromUserInputSchema, f as grantScopeToUserInputSchema, h as grantScopesToUserInputSchema, j as revokeScopeFromUserInputSchema, e as grantScopeToRoleInputSchema, i as revokeScopeFromRoleInputSchema, g as getUserPermissionsInputSchema, v as verifyAccessInputSchema, d as deleteRoleInputSchema, u as updateRoleInputSchema } from '../shared/rbac.CUCczegz.mjs';
5
5
  import { z } from 'zod';
6
6
  import { WorkerEntrypoint } from 'cloudflare:workers';
7
7
  import { drizzle } from 'drizzle-orm/d1';
@@ -623,11 +623,13 @@ let RbacServiceBase = class extends develitWorker(WorkerEntrypoint) {
623
623
  const scopes = resultScopes.map((scope) => ({
624
624
  id: scope.id,
625
625
  scope: scope.scope,
626
+ label: this.SCOPES.find((s) => s.value === scope.scope)?.label || null,
626
627
  resourceId: scope.resourceId
627
628
  }));
628
629
  const roleScopes = resultRoleScopes.map((scope) => ({
629
630
  id: scope.id,
630
631
  scope: scope.scope,
632
+ label: this.SCOPES.find((s) => s.value === scope.scope)?.label || null,
631
633
  resourceId: scope.resourceId
632
634
  }));
633
635
  return {
@@ -73,13 +73,38 @@ const userDataSchema = zod.z.object({
73
73
  email: zod.z.string().optional(),
74
74
  role: zod.z.string().optional()
75
75
  });
76
+ const jwtUserSchema = zod.z.object({
77
+ id: zod.z.uuid(),
78
+ createdAt: zod.z.date().nullable(),
79
+ createdBy: zod.z.string().nullable().optional(),
80
+ updatedAt: zod.z.date().nullable(),
81
+ updatedBy: zod.z.string().nullable().optional(),
82
+ deletedAt: zod.z.date().nullable(),
83
+ deletedBy: zod.z.string().nullable().optional(),
84
+ role: zod.z.string(),
85
+ email: zod.z.email(),
86
+ rawAppMetaData: zod.z.any(),
87
+ rawUserMetaData: zod.z.any(),
88
+ isSuperAdmin: zod.z.boolean().default(false),
89
+ isSsoUser: zod.z.boolean().default(false),
90
+ lastSignInAt: zod.z.date().nullable().optional(),
91
+ emailConfirmedAt: zod.z.date().nullable().optional(),
92
+ confirmationSentAt: zod.z.date().nullable().optional(),
93
+ recoverySentAt: zod.z.date().nullable().optional(),
94
+ emailChangeToken: zod.z.string().nullable().optional(),
95
+ emailChangeSentAt: zod.z.date().nullable().optional(),
96
+ isBanned: zod.z.boolean().default(false).nullable().optional()
97
+ });
76
98
  const jwtPayloadSchema = zod.z.object({
77
99
  sub: zod.z.string(),
78
100
  user: zod.z.object({
79
101
  id: zod.z.uuid(),
80
102
  createdAt: zod.z.date().nullable(),
103
+ createdBy: zod.z.string().nullable().optional(),
81
104
  updatedAt: zod.z.date().nullable(),
105
+ updatedBy: zod.z.string().nullable().optional(),
82
106
  deletedAt: zod.z.date().nullable(),
107
+ deletedBy: zod.z.string().nullable().optional(),
83
108
  role: zod.z.string(),
84
109
  email: zod.z.email(),
85
110
  rawAppMetaData: zod.z.any(),
@@ -99,6 +124,19 @@ const jwtPayloadSchema = zod.z.object({
99
124
  userData: userDataSchema.optional()
100
125
  });
101
126
 
127
+ const coercedUserSchema = jwtUserSchema.extend({
128
+ createdAt: zod.z.coerce.date().nullable(),
129
+ updatedAt: zod.z.coerce.date().nullable(),
130
+ deletedAt: zod.z.coerce.date().nullable(),
131
+ lastSignInAt: zod.z.coerce.date().nullable().optional(),
132
+ emailConfirmedAt: zod.z.coerce.date().nullable().optional(),
133
+ confirmationSentAt: zod.z.coerce.date().nullable().optional(),
134
+ recoverySentAt: zod.z.coerce.date().nullable().optional(),
135
+ emailChangeSentAt: zod.z.coerce.date().nullable().optional()
136
+ });
137
+ const coercedJwtPayloadSchema = jwtPayloadSchema.extend({
138
+ user: coercedUserSchema
139
+ });
102
140
  const verifyAccessInputSchema = zod.z.object({
103
141
  userId: zod.z.uuid(),
104
142
  accessRequests: zod.z.array(
@@ -108,26 +146,7 @@ const verifyAccessInputSchema = zod.z.object({
108
146
  resourcePath: zod.z.string().optional()
109
147
  })
110
148
  ),
111
- jwt: jwtPayloadSchema.extend({
112
- createdAt: zod.z.coerce.date().nullable().optional(),
113
- updatedAt: zod.z.coerce.date().nullable().optional(),
114
- deletedAt: zod.z.coerce.date().nullable().optional(),
115
- lastSignInAt: zod.z.coerce.date().nullable().optional(),
116
- emailConfirmedAt: zod.z.coerce.date().nullable().optional(),
117
- confirmationSentAt: zod.z.coerce.date().nullable().optional(),
118
- recoverySentAt: zod.z.coerce.date().nullable().optional(),
119
- emailChangeSentAt: zod.z.coerce.date().nullable().optional(),
120
- user: jwtPayloadSchema.shape.user.extend({
121
- createdAt: zod.z.coerce.date().nullable().optional(),
122
- updatedAt: zod.z.coerce.date().nullable().optional(),
123
- deletedAt: zod.z.coerce.date().nullable().optional(),
124
- lastSignInAt: zod.z.coerce.date().nullable().optional(),
125
- emailConfirmedAt: zod.z.coerce.date().nullable().optional(),
126
- confirmationSentAt: zod.z.coerce.date().nullable().optional(),
127
- recoverySentAt: zod.z.coerce.date().nullable().optional(),
128
- emailChangeSentAt: zod.z.coerce.date().nullable().optional()
129
- })
130
- }).optional()
149
+ jwt: coercedJwtPayloadSchema.optional()
131
150
  });
132
151
 
133
152
  const verifyScopeInputSchema = zod.z.object({
@@ -71,13 +71,38 @@ const userDataSchema = z.object({
71
71
  email: z.string().optional(),
72
72
  role: z.string().optional()
73
73
  });
74
+ const jwtUserSchema = z.object({
75
+ id: z.uuid(),
76
+ createdAt: z.date().nullable(),
77
+ createdBy: z.string().nullable().optional(),
78
+ updatedAt: z.date().nullable(),
79
+ updatedBy: z.string().nullable().optional(),
80
+ deletedAt: z.date().nullable(),
81
+ deletedBy: z.string().nullable().optional(),
82
+ role: z.string(),
83
+ email: z.email(),
84
+ rawAppMetaData: z.any(),
85
+ rawUserMetaData: z.any(),
86
+ isSuperAdmin: z.boolean().default(false),
87
+ isSsoUser: z.boolean().default(false),
88
+ lastSignInAt: z.date().nullable().optional(),
89
+ emailConfirmedAt: z.date().nullable().optional(),
90
+ confirmationSentAt: z.date().nullable().optional(),
91
+ recoverySentAt: z.date().nullable().optional(),
92
+ emailChangeToken: z.string().nullable().optional(),
93
+ emailChangeSentAt: z.date().nullable().optional(),
94
+ isBanned: z.boolean().default(false).nullable().optional()
95
+ });
74
96
  const jwtPayloadSchema = z.object({
75
97
  sub: z.string(),
76
98
  user: z.object({
77
99
  id: z.uuid(),
78
100
  createdAt: z.date().nullable(),
101
+ createdBy: z.string().nullable().optional(),
79
102
  updatedAt: z.date().nullable(),
103
+ updatedBy: z.string().nullable().optional(),
80
104
  deletedAt: z.date().nullable(),
105
+ deletedBy: z.string().nullable().optional(),
81
106
  role: z.string(),
82
107
  email: z.email(),
83
108
  rawAppMetaData: z.any(),
@@ -97,6 +122,19 @@ const jwtPayloadSchema = z.object({
97
122
  userData: userDataSchema.optional()
98
123
  });
99
124
 
125
+ const coercedUserSchema = jwtUserSchema.extend({
126
+ createdAt: z.coerce.date().nullable(),
127
+ updatedAt: z.coerce.date().nullable(),
128
+ deletedAt: z.coerce.date().nullable(),
129
+ lastSignInAt: z.coerce.date().nullable().optional(),
130
+ emailConfirmedAt: z.coerce.date().nullable().optional(),
131
+ confirmationSentAt: z.coerce.date().nullable().optional(),
132
+ recoverySentAt: z.coerce.date().nullable().optional(),
133
+ emailChangeSentAt: z.coerce.date().nullable().optional()
134
+ });
135
+ const coercedJwtPayloadSchema = jwtPayloadSchema.extend({
136
+ user: coercedUserSchema
137
+ });
100
138
  const verifyAccessInputSchema = z.object({
101
139
  userId: z.uuid(),
102
140
  accessRequests: z.array(
@@ -106,26 +144,7 @@ const verifyAccessInputSchema = z.object({
106
144
  resourcePath: z.string().optional()
107
145
  })
108
146
  ),
109
- jwt: jwtPayloadSchema.extend({
110
- createdAt: z.coerce.date().nullable().optional(),
111
- updatedAt: z.coerce.date().nullable().optional(),
112
- deletedAt: z.coerce.date().nullable().optional(),
113
- lastSignInAt: z.coerce.date().nullable().optional(),
114
- emailConfirmedAt: z.coerce.date().nullable().optional(),
115
- confirmationSentAt: z.coerce.date().nullable().optional(),
116
- recoverySentAt: z.coerce.date().nullable().optional(),
117
- emailChangeSentAt: z.coerce.date().nullable().optional(),
118
- user: jwtPayloadSchema.shape.user.extend({
119
- createdAt: z.coerce.date().nullable().optional(),
120
- updatedAt: z.coerce.date().nullable().optional(),
121
- deletedAt: z.coerce.date().nullable().optional(),
122
- lastSignInAt: z.coerce.date().nullable().optional(),
123
- emailConfirmedAt: z.coerce.date().nullable().optional(),
124
- confirmationSentAt: z.coerce.date().nullable().optional(),
125
- recoverySentAt: z.coerce.date().nullable().optional(),
126
- emailChangeSentAt: z.coerce.date().nullable().optional()
127
- })
128
- }).optional()
147
+ jwt: coercedJwtPayloadSchema.optional()
129
148
  });
130
149
 
131
150
  const verifyScopeInputSchema = z.object({
@@ -100,12 +100,14 @@ interface GetUserPermissionsOutput {
100
100
  roleScopes: {
101
101
  id: string;
102
102
  scope: Scope;
103
+ label: string | null;
103
104
  resourceId: string | null;
104
105
  }[];
105
106
  roleScopesCount: number;
106
107
  scopes: {
107
108
  id: string;
108
109
  scope: Scope;
110
+ label: string | null;
109
111
  resourceId: string | null;
110
112
  }[];
111
113
  scopesCount: number;
@@ -197,16 +199,11 @@ declare const verifyAccessInputSchema: z.ZodObject<{
197
199
  email: z.ZodOptional<z.ZodString>;
198
200
  role: z.ZodOptional<z.ZodString>;
199
201
  }, z.core.$strip>>;
200
- createdAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
201
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
202
- deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
203
- lastSignInAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
204
- emailConfirmedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
205
- confirmationSentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
206
- recoverySentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
207
- emailChangeSentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
208
202
  user: z.ZodObject<{
209
203
  id: z.ZodUUID;
204
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
205
+ updatedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
+ deletedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
210
207
  role: z.ZodString;
211
208
  email: z.ZodEmail;
212
209
  rawAppMetaData: z.ZodAny;
@@ -215,9 +212,9 @@ declare const verifyAccessInputSchema: z.ZodObject<{
215
212
  isSsoUser: z.ZodDefault<z.ZodBoolean>;
216
213
  emailChangeToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
217
214
  isBanned: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>;
218
- createdAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
219
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
220
- deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
215
+ createdAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
216
+ updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
217
+ deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
221
218
  lastSignInAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
222
219
  emailConfirmedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
223
220
  confirmationSentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
@@ -100,12 +100,14 @@ interface GetUserPermissionsOutput {
100
100
  roleScopes: {
101
101
  id: string;
102
102
  scope: Scope;
103
+ label: string | null;
103
104
  resourceId: string | null;
104
105
  }[];
105
106
  roleScopesCount: number;
106
107
  scopes: {
107
108
  id: string;
108
109
  scope: Scope;
110
+ label: string | null;
109
111
  resourceId: string | null;
110
112
  }[];
111
113
  scopesCount: number;
@@ -197,16 +199,11 @@ declare const verifyAccessInputSchema: z.ZodObject<{
197
199
  email: z.ZodOptional<z.ZodString>;
198
200
  role: z.ZodOptional<z.ZodString>;
199
201
  }, z.core.$strip>>;
200
- createdAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
201
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
202
- deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
203
- lastSignInAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
204
- emailConfirmedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
205
- confirmationSentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
206
- recoverySentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
207
- emailChangeSentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
208
202
  user: z.ZodObject<{
209
203
  id: z.ZodUUID;
204
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
205
+ updatedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
+ deletedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
210
207
  role: z.ZodString;
211
208
  email: z.ZodEmail;
212
209
  rawAppMetaData: z.ZodAny;
@@ -215,9 +212,9 @@ declare const verifyAccessInputSchema: z.ZodObject<{
215
212
  isSsoUser: z.ZodDefault<z.ZodBoolean>;
216
213
  emailChangeToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
217
214
  isBanned: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>;
218
- createdAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
219
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
220
- deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
215
+ createdAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
216
+ updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
217
+ deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
221
218
  lastSignInAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
222
219
  emailConfirmedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
223
220
  confirmationSentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
@@ -100,12 +100,14 @@ interface GetUserPermissionsOutput {
100
100
  roleScopes: {
101
101
  id: string;
102
102
  scope: Scope;
103
+ label: string | null;
103
104
  resourceId: string | null;
104
105
  }[];
105
106
  roleScopesCount: number;
106
107
  scopes: {
107
108
  id: string;
108
109
  scope: Scope;
110
+ label: string | null;
109
111
  resourceId: string | null;
110
112
  }[];
111
113
  scopesCount: number;
@@ -197,16 +199,11 @@ declare const verifyAccessInputSchema: z.ZodObject<{
197
199
  email: z.ZodOptional<z.ZodString>;
198
200
  role: z.ZodOptional<z.ZodString>;
199
201
  }, z.core.$strip>>;
200
- createdAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
201
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
202
- deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
203
- lastSignInAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
204
- emailConfirmedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
205
- confirmationSentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
206
- recoverySentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
207
- emailChangeSentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
208
202
  user: z.ZodObject<{
209
203
  id: z.ZodUUID;
204
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
205
+ updatedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
+ deletedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
210
207
  role: z.ZodString;
211
208
  email: z.ZodEmail;
212
209
  rawAppMetaData: z.ZodAny;
@@ -215,9 +212,9 @@ declare const verifyAccessInputSchema: z.ZodObject<{
215
212
  isSsoUser: z.ZodDefault<z.ZodBoolean>;
216
213
  emailChangeToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
217
214
  isBanned: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>;
218
- createdAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
219
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
220
- deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
215
+ createdAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
216
+ updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
217
+ deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
221
218
  lastSignInAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
222
219
  emailConfirmedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
223
220
  confirmationSentAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
package/dist/types.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const verifyScope = require('./shared/rbac.CS8i19gH.cjs');
3
+ const verifyScope = require('./shared/rbac.B2KUW5xp.cjs');
4
4
  require('zod');
5
5
 
6
6
 
package/dist/types.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, C as CreateRoleInput, a as CreateRoleOutput, D as DeleteRoleInput, s as DeleteRoleOutput, o as GetPermissionsOutput, p as GetUserPermissionsInput, q as GetUserPermissionsOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, L as LabeledScope, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, y as RoleInsertType, w as RoleScopeInsertType, v as RoleScopeSelectType, x as RoleSelectType, S as Scope, U as UpdateRoleInput, u as UpdateRoleOutput, B as UserRoleInsertType, z as UserRoleSelectType, F as UserScopeInsertType, E as UserScopeSelectType, V as VerifyAccessInput, r as VerifyAccessOutput, H as assignRoleToUserInputSchema, I as assignRolesToUserInputSchema, J as createRoleInputSchema, K as deleteRoleInputSchema, M as getUserPermissionsInputSchema, N as grantScopeToRoleInputSchema, O as grantScopeToUserInputSchema, P as grantScopesToUserInputSchema, Q as revokeRoleFromUserInputSchema, T as revokeScopeFromRoleInputSchema, W as revokeScopeFromUserInputSchema, X as updateRoleInputSchema, Y as verifyAccessInputSchema } from './shared/rbac.CZnF-YgH.cjs';
1
+ export { A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, C as CreateRoleInput, a as CreateRoleOutput, D as DeleteRoleInput, s as DeleteRoleOutput, o as GetPermissionsOutput, p as GetUserPermissionsInput, q as GetUserPermissionsOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, L as LabeledScope, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, y as RoleInsertType, w as RoleScopeInsertType, v as RoleScopeSelectType, x as RoleSelectType, S as Scope, U as UpdateRoleInput, u as UpdateRoleOutput, B as UserRoleInsertType, z as UserRoleSelectType, F as UserScopeInsertType, E as UserScopeSelectType, V as VerifyAccessInput, r as VerifyAccessOutput, H as assignRoleToUserInputSchema, I as assignRolesToUserInputSchema, J as createRoleInputSchema, K as deleteRoleInputSchema, M as getUserPermissionsInputSchema, N as grantScopeToRoleInputSchema, O as grantScopeToUserInputSchema, P as grantScopesToUserInputSchema, Q as revokeRoleFromUserInputSchema, T as revokeScopeFromRoleInputSchema, W as revokeScopeFromUserInputSchema, X as updateRoleInputSchema, Y as verifyAccessInputSchema } from './shared/rbac.ChX0LW__.cjs';
2
2
  import { z } from 'zod';
3
3
  export { b as RbacServiceEnv, a as RbacServiceEnvironmentConfig, R as RbacServiceWranglerConfig } from './shared/rbac.ClMKyW8J.cjs';
4
4
  import 'drizzle-orm';
package/dist/types.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, C as CreateRoleInput, a as CreateRoleOutput, D as DeleteRoleInput, s as DeleteRoleOutput, o as GetPermissionsOutput, p as GetUserPermissionsInput, q as GetUserPermissionsOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, L as LabeledScope, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, y as RoleInsertType, w as RoleScopeInsertType, v as RoleScopeSelectType, x as RoleSelectType, S as Scope, U as UpdateRoleInput, u as UpdateRoleOutput, B as UserRoleInsertType, z as UserRoleSelectType, F as UserScopeInsertType, E as UserScopeSelectType, V as VerifyAccessInput, r as VerifyAccessOutput, H as assignRoleToUserInputSchema, I as assignRolesToUserInputSchema, J as createRoleInputSchema, K as deleteRoleInputSchema, M as getUserPermissionsInputSchema, N as grantScopeToRoleInputSchema, O as grantScopeToUserInputSchema, P as grantScopesToUserInputSchema, Q as revokeRoleFromUserInputSchema, T as revokeScopeFromRoleInputSchema, W as revokeScopeFromUserInputSchema, X as updateRoleInputSchema, Y as verifyAccessInputSchema } from './shared/rbac.DhS7RHC3.mjs';
1
+ export { A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, C as CreateRoleInput, a as CreateRoleOutput, D as DeleteRoleInput, s as DeleteRoleOutput, o as GetPermissionsOutput, p as GetUserPermissionsInput, q as GetUserPermissionsOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, L as LabeledScope, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, y as RoleInsertType, w as RoleScopeInsertType, v as RoleScopeSelectType, x as RoleSelectType, S as Scope, U as UpdateRoleInput, u as UpdateRoleOutput, B as UserRoleInsertType, z as UserRoleSelectType, F as UserScopeInsertType, E as UserScopeSelectType, V as VerifyAccessInput, r as VerifyAccessOutput, H as assignRoleToUserInputSchema, I as assignRolesToUserInputSchema, J as createRoleInputSchema, K as deleteRoleInputSchema, M as getUserPermissionsInputSchema, N as grantScopeToRoleInputSchema, O as grantScopeToUserInputSchema, P as grantScopesToUserInputSchema, Q as revokeRoleFromUserInputSchema, T as revokeScopeFromRoleInputSchema, W as revokeScopeFromUserInputSchema, X as updateRoleInputSchema, Y as verifyAccessInputSchema } from './shared/rbac.tHFc50IZ.mjs';
2
2
  import { z } from 'zod';
3
3
  export { b as RbacServiceEnv, a as RbacServiceEnvironmentConfig, R as RbacServiceWranglerConfig } from './shared/rbac.ClMKyW8J.mjs';
4
4
  import 'drizzle-orm';
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, C as CreateRoleInput, a as CreateRoleOutput, D as DeleteRoleInput, s as DeleteRoleOutput, o as GetPermissionsOutput, p as GetUserPermissionsInput, q as GetUserPermissionsOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, L as LabeledScope, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, y as RoleInsertType, w as RoleScopeInsertType, v as RoleScopeSelectType, x as RoleSelectType, S as Scope, U as UpdateRoleInput, u as UpdateRoleOutput, B as UserRoleInsertType, z as UserRoleSelectType, F as UserScopeInsertType, E as UserScopeSelectType, V as VerifyAccessInput, r as VerifyAccessOutput, H as assignRoleToUserInputSchema, I as assignRolesToUserInputSchema, J as createRoleInputSchema, K as deleteRoleInputSchema, M as getUserPermissionsInputSchema, N as grantScopeToRoleInputSchema, O as grantScopeToUserInputSchema, P as grantScopesToUserInputSchema, Q as revokeRoleFromUserInputSchema, T as revokeScopeFromRoleInputSchema, W as revokeScopeFromUserInputSchema, X as updateRoleInputSchema, Y as verifyAccessInputSchema } from './shared/rbac.DqMMROM3.js';
1
+ export { A as AssignRoleToUserInput, b as AssignRoleToUserOutput, c as AssignRolesToUserInput, d as AssignRolesToUserOutput, C as CreateRoleInput, a as CreateRoleOutput, D as DeleteRoleInput, s as DeleteRoleOutput, o as GetPermissionsOutput, p as GetUserPermissionsInput, q as GetUserPermissionsOutput, k as GrantScopeToRoleInput, l as GrantScopeToRoleOutput, G as GrantScopeToUserInput, f as GrantScopeToUserOutput, g as GrantScopesToUserInput, h as GrantScopesToUserOutput, L as LabeledScope, R as RevokeRoleFromUserInput, e as RevokeRoleFromUserOutput, m as RevokeScopeFromRoleInput, n as RevokeScopeFromRoleOutput, i as RevokeScopeFromUserInput, j as RevokeScopeFromUserOutput, y as RoleInsertType, w as RoleScopeInsertType, v as RoleScopeSelectType, x as RoleSelectType, S as Scope, U as UpdateRoleInput, u as UpdateRoleOutput, B as UserRoleInsertType, z as UserRoleSelectType, F as UserScopeInsertType, E as UserScopeSelectType, V as VerifyAccessInput, r as VerifyAccessOutput, H as assignRoleToUserInputSchema, I as assignRolesToUserInputSchema, J as createRoleInputSchema, K as deleteRoleInputSchema, M as getUserPermissionsInputSchema, N as grantScopeToRoleInputSchema, O as grantScopeToUserInputSchema, P as grantScopesToUserInputSchema, Q as revokeRoleFromUserInputSchema, T as revokeScopeFromRoleInputSchema, W as revokeScopeFromUserInputSchema, X as updateRoleInputSchema, Y as verifyAccessInputSchema } from './shared/rbac.tvGvbXUm.js';
2
2
  import { z } from 'zod';
3
3
  export { b as RbacServiceEnv, a as RbacServiceEnvironmentConfig, R as RbacServiceWranglerConfig } from './shared/rbac.ClMKyW8J.js';
4
4
  import 'drizzle-orm';
package/dist/types.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export { a as assignRoleToUserInputSchema, b as assignRolesToUserInputSchema, c as createRoleInputSchema, d as deleteRoleInputSchema, g as getUserPermissionsInputSchema, e as grantScopeToRoleInputSchema, f as grantScopeToUserInputSchema, h as grantScopesToUserInputSchema, r as revokeRoleFromUserInputSchema, i as revokeScopeFromRoleInputSchema, j as revokeScopeFromUserInputSchema, u as updateRoleInputSchema, v as verifyAccessInputSchema, k as verifyScopeInputSchema, l as verifyScopeOutputSchema } from './shared/rbac.wzMQF48s.mjs';
1
+ export { a as assignRoleToUserInputSchema, b as assignRolesToUserInputSchema, c as createRoleInputSchema, d as deleteRoleInputSchema, g as getUserPermissionsInputSchema, e as grantScopeToRoleInputSchema, f as grantScopeToUserInputSchema, h as grantScopesToUserInputSchema, r as revokeRoleFromUserInputSchema, i as revokeScopeFromRoleInputSchema, j as revokeScopeFromUserInputSchema, u as updateRoleInputSchema, v as verifyAccessInputSchema, k as verifyScopeInputSchema, l as verifyScopeOutputSchema } from './shared/rbac.CUCczegz.mjs';
2
2
  import 'zod';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/rbac",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {