@develit-services/rbac 0.7.0 → 1.0.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.
Files changed (33) hide show
  1. package/dist/database/schema.cjs +2 -1
  2. package/dist/database/schema.d.cts +2 -1
  3. package/dist/database/schema.d.mts +2 -1
  4. package/dist/database/schema.d.ts +2 -1
  5. package/dist/database/schema.mjs +2 -1
  6. package/dist/export/worker.cjs +21 -9
  7. package/dist/export/worker.d.cts +3 -7
  8. package/dist/export/worker.d.mts +4 -6
  9. package/dist/export/worker.d.ts +3 -7
  10. package/dist/export/worker.mjs +23 -8
  11. package/dist/export/wrangler.cjs +5 -11
  12. package/dist/export/wrangler.d.cts +1 -1
  13. package/dist/export/wrangler.d.mts +1 -1
  14. package/dist/export/wrangler.d.ts +1 -1
  15. package/dist/export/wrangler.mjs +5 -11
  16. package/dist/shared/{rbac.H1LXb5Lk.mjs → rbac.BUAU2nhH.mjs} +6 -2
  17. package/dist/shared/rbac.CNbKvNcg.d.cts +221 -0
  18. package/dist/shared/rbac.CNbKvNcg.d.mts +221 -0
  19. package/dist/shared/rbac.CNbKvNcg.d.ts +221 -0
  20. package/dist/shared/{rbac.CSHPMf7E.d.mts → rbac.CusjQLB-.d.mts} +1 -1
  21. package/dist/shared/{rbac.gXUvaSJ2.cjs → rbac.D4H9O9-q.cjs} +5 -1
  22. package/dist/shared/{rbac.CkCfjtKu.d.ts → rbac.DhWWcHCj.d.ts} +1 -1
  23. package/dist/shared/{rbac.DUk_qXWk.d.cts → rbac.ZCOTsP5y.d.cts} +4 -3
  24. package/dist/shared/{rbac.DUk_qXWk.d.mts → rbac.ZCOTsP5y.d.mts} +4 -3
  25. package/dist/shared/{rbac.DUk_qXWk.d.ts → rbac.ZCOTsP5y.d.ts} +4 -3
  26. package/dist/shared/{rbac.DypKJ7qb.d.cts → rbac.bOBgd_Ez.d.cts} +1 -1
  27. package/dist/types.d.cts +3 -3
  28. package/dist/types.d.mts +3 -3
  29. package/dist/types.d.ts +3 -3
  30. package/package.json +6 -6
  31. package/dist/shared/rbac.D5N_wrRb.d.cts +0 -727
  32. package/dist/shared/rbac.D5N_wrRb.d.mts +0 -727
  33. package/dist/shared/rbac.D5N_wrRb.d.ts +0 -727
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('../shared/rbac.gXUvaSJ2.cjs');
3
+ const database_schema = require('../shared/rbac.D4H9O9-q.cjs');
4
4
  require('@develit-io/backend-sdk');
5
5
  require('drizzle-orm/sqlite-core');
6
+ require('drizzle-orm');
6
7
 
7
8
 
8
9
 
@@ -1,2 +1,3 @@
1
- export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.D5N_wrRb.cjs';
1
+ export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.CNbKvNcg.cjs';
2
+ import 'drizzle-orm';
2
3
  import 'drizzle-orm/sqlite-core';
@@ -1,2 +1,3 @@
1
- export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.D5N_wrRb.mjs';
1
+ export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.CNbKvNcg.mjs';
2
+ import 'drizzle-orm';
2
3
  import 'drizzle-orm/sqlite-core';
@@ -1,2 +1,3 @@
1
- export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.D5N_wrRb.js';
1
+ export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.CNbKvNcg.js';
2
+ import 'drizzle-orm';
2
3
  import 'drizzle-orm/sqlite-core';
@@ -1,3 +1,4 @@
1
- export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.H1LXb5Lk.mjs';
1
+ export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.BUAU2nhH.mjs';
2
2
  import '@develit-io/backend-sdk';
3
3
  import 'drizzle-orm/sqlite-core';
4
+ import 'drizzle-orm';
@@ -1,9 +1,7 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  const backendSdk = require('@develit-io/backend-sdk');
6
- const database_schema = require('../shared/rbac.gXUvaSJ2.cjs');
4
+ const database_schema = require('../shared/rbac.D4H9O9-q.cjs');
7
5
  const drizzleOrm = require('drizzle-orm');
8
6
  const verifyScope = require('../shared/rbac.CZCpmLF8.cjs');
9
7
  const zod = require('zod');
@@ -11,6 +9,25 @@ const cloudflare_workers = require('cloudflare:workers');
11
9
  const d1 = require('drizzle-orm/d1');
12
10
  require('drizzle-orm/sqlite-core');
13
11
 
12
+ const relations = drizzleOrm.defineRelations(database_schema.schema, (r) => ({
13
+ role: {
14
+ roleScopes: r.many.roleScope(),
15
+ userRoles: r.many.userRole()
16
+ },
17
+ roleScope: {
18
+ role: r.one.role({
19
+ from: r.roleScope.roleId,
20
+ to: r.role.id
21
+ })
22
+ },
23
+ userRole: {
24
+ role: r.one.role({
25
+ from: r.userRole.roleId,
26
+ to: r.role.id
27
+ })
28
+ }
29
+ }));
30
+
14
31
  const tables = database_schema.schema;
15
32
 
16
33
  const assignRoleToUserCommand = async ({
@@ -382,7 +399,7 @@ var __decorateClass = (decorators, target, key, kind) => {
382
399
  let RbacServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.WorkerEntrypoint) {
383
400
  constructor(ctx, env, scopes) {
384
401
  super(ctx, env);
385
- this.db = d1.drizzle(this.env.RBAC_D1, { schema: tables });
402
+ this.db = d1.drizzle(this.env.RBAC_D1, { schema: tables, relations });
386
403
  this.SCOPES = scopes;
387
404
  }
388
405
  validateScope(scope) {
@@ -1146,10 +1163,5 @@ const LABELED_SCOPES = [
1146
1163
  // { label: 'Smazat logy účtů', value: 'accounts.logs.delete' },
1147
1164
  ];
1148
1165
 
1149
- const RbacService = defineRbacService({
1150
- scopes: LABELED_SCOPES
1151
- });
1152
-
1153
1166
  exports.LABELED_SCOPES = LABELED_SCOPES;
1154
- exports.default = RbacService;
1155
1167
  exports.defineRbacService = defineRbacService;
@@ -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 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';
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.bOBgd_Ez.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.D5N_wrRb.cjs';
8
+ import '../shared/rbac.CNbKvNcg.cjs';
9
9
  import 'drizzle-orm/sqlite-core';
10
10
 
11
11
  type TypedScopeObject<TScopes extends readonly LabeledScope$1[]> = {
@@ -45,7 +45,7 @@ declare class RbacServiceBase<TScopes extends readonly LabeledScope$1[] = Labele
45
45
  }
46
46
  declare function defineRbacService<const TScopes extends readonly LabeledScope$1[]>(config?: {
47
47
  scopes: TScopes;
48
- }): new (ctx: ExecutionContext, env: RbacEnv) => RbacServiceBase<TScopes>;
48
+ }): typeof RbacServiceBase<TScopes>;
49
49
 
50
50
  declare const SCOPES: readonly ["tickets.read", "tickets.create", "tickets.edit", "tickets.delete", "tickets.archive", "tickets.automations.pause", "tickets.automations.resume", "tickets.dependencies.read", "tickets.dependencies.create", "tickets.dependencies.edit", "tickets.dependencies.delete", "tickets.confirmation.send", "tickets.confirmation.download", "tickets.payments.create", "tickets.payments.read", "tickets.payments.edit", "tickets.payments.delete", "tickets.payments.confirmation.send", "tickets.payments.confirmation.download", "tickets.logs.read", "tickets.logs.create", "tickets.logs.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.edit", "tickets.{jwt.user.rawUserMetaData.organizationId}.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.archive", "tickets.{jwt.user.rawUserMetaData.organizationId}.automations.pause", "tickets.{jwt.user.rawUserMetaData.organizationId}.automations.resume", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.edit", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.confirmation.send", "tickets.{jwt.user.rawUserMetaData.organizationId}.confirmation.download", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.edit", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.confirmation.send", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.confirmation.download", "tickets.{jwt.user.rawUserMetaData.organizationId}.logs.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.logs.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.logs.delete", "clients.read", "clients.create", "clients.edit", "clients.delete", "clients.pin.read", "clients.pin.edit", "clients.trader.edit", "clients.logs.read", "clients.logs.create", "clients.logs.delete", "clients.{jwt.user.rawUserMetaData.organizationId}.read", "clients.{jwt.user.rawUserMetaData.organizationId}.create", "clients.{jwt.user.rawUserMetaData.organizationId}.edit", "clients.{jwt.user.rawUserMetaData.organizationId}.delete", "clients.{jwt.user.rawUserMetaData.organizationId}.pin.read", "clients.{jwt.user.rawUserMetaData.organizationId}.pin.edit", "clients.{jwt.user.rawUserMetaData.organizationId}.trader.edit", "clients.{jwt.user.rawUserMetaData.organizationId}.logs.read", "clients.{jwt.user.rawUserMetaData.organizationId}.logs.create", "clients.{jwt.user.rawUserMetaData.organizationId}.logs.delete", "users.read", "users.create", "users.edit", "users.delete", "users.ban", "users.password.reset.send", "users.password.edit", "users.2fa.enable", "users.2fa.disable", "users.roles.read", "users.roles.edit", "users.scopes.read", "users.scopes.assign", "users.scopes.delete", "users.logs.read", "users.logs.create", "users.logs.delete", "users.{jwt.user.rawUserMetaData.organizationId}.read", "users.{jwt.user.rawUserMetaData.organizationId}.create", "users.{jwt.user.rawUserMetaData.organizationId}.edit", "users.{jwt.user.rawUserMetaData.organizationId}.delete", "users.{jwt.user.rawUserMetaData.organizationId}.ban", "users.{jwt.user.rawUserMetaData.organizationId}.password.reset.send", "users.{jwt.user.rawUserMetaData.organizationId}.password.edit", "users.{jwt.user.rawUserMetaData.organizationId}.2fa.enable", "users.{jwt.user.rawUserMetaData.organizationId}.2fa.disable", "users.{jwt.user.rawUserMetaData.organizationId}.roles.read", "users.{jwt.user.rawUserMetaData.organizationId}.roles.edit", "users.{jwt.user.rawUserMetaData.organizationId}.scopes.read", "users.{jwt.user.rawUserMetaData.organizationId}.scopes.assign", "users.{jwt.user.rawUserMetaData.organizationId}.scopes.delete", "users.{jwt.user.rawUserMetaData.organizationId}.logs.read", "users.{jwt.user.rawUserMetaData.organizationId}.logs.create", "users.{jwt.user.rawUserMetaData.organizationId}.logs.delete", "traders.read", "traders.create", "traders.edit", "traders.delete", "traders.logs", "roles.read", "roles.create", "roles.edit", "roles.delete", "roles.scopes.assign", "roles.scopes.delete", "roles.logs.read", "roles.logs.create", "roles.logs.delete", "roles.users.read", "test.admin", "test.read", "test.edit", "test.delete", "test.{jwt.organizationId}.read", "test.{jwt.user.rawUserMetaData.organizationId}.read", "test.{jwt.user.rawUserMetaData.organizationId}.edit", "test.{param.resourceId}.read", "test.organization.{jwt.user.rawUserMetaData.organizationId}.resource.{jwt.user.rawUserMetaData.organizationId}.read", "test.organization.{jwt.user.rawUserMetaData.organizationId}.branch.{jwt.userData.organizationBranchId}.read", "test.{invalid}.scope", "test.{}.scope", "test.{jwt.}.scope", "test.{.key}.scope"];
51
51
  type LabeledScope = {
@@ -54,8 +54,4 @@ type LabeledScope = {
54
54
  };
55
55
  declare const LABELED_SCOPES: LabeledScope[];
56
56
 
57
- declare const _default: new (ctx: ExecutionContext, env: RbacEnv) => WorkerEntrypoint<RbacEnv>;
58
-
59
- // @ts-ignore
60
- export = _default;
61
57
  export { LABELED_SCOPES, defineRbacService };
@@ -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 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';
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.CusjQLB-.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.D5N_wrRb.mjs';
8
+ import '../shared/rbac.CNbKvNcg.mjs';
9
9
  import 'drizzle-orm/sqlite-core';
10
10
 
11
11
  type TypedScopeObject<TScopes extends readonly LabeledScope$1[]> = {
@@ -45,7 +45,7 @@ declare class RbacServiceBase<TScopes extends readonly LabeledScope$1[] = Labele
45
45
  }
46
46
  declare function defineRbacService<const TScopes extends readonly LabeledScope$1[]>(config?: {
47
47
  scopes: TScopes;
48
- }): new (ctx: ExecutionContext, env: RbacEnv) => RbacServiceBase<TScopes>;
48
+ }): typeof RbacServiceBase<TScopes>;
49
49
 
50
50
  declare const SCOPES: readonly ["tickets.read", "tickets.create", "tickets.edit", "tickets.delete", "tickets.archive", "tickets.automations.pause", "tickets.automations.resume", "tickets.dependencies.read", "tickets.dependencies.create", "tickets.dependencies.edit", "tickets.dependencies.delete", "tickets.confirmation.send", "tickets.confirmation.download", "tickets.payments.create", "tickets.payments.read", "tickets.payments.edit", "tickets.payments.delete", "tickets.payments.confirmation.send", "tickets.payments.confirmation.download", "tickets.logs.read", "tickets.logs.create", "tickets.logs.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.edit", "tickets.{jwt.user.rawUserMetaData.organizationId}.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.archive", "tickets.{jwt.user.rawUserMetaData.organizationId}.automations.pause", "tickets.{jwt.user.rawUserMetaData.organizationId}.automations.resume", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.edit", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.confirmation.send", "tickets.{jwt.user.rawUserMetaData.organizationId}.confirmation.download", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.edit", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.confirmation.send", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.confirmation.download", "tickets.{jwt.user.rawUserMetaData.organizationId}.logs.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.logs.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.logs.delete", "clients.read", "clients.create", "clients.edit", "clients.delete", "clients.pin.read", "clients.pin.edit", "clients.trader.edit", "clients.logs.read", "clients.logs.create", "clients.logs.delete", "clients.{jwt.user.rawUserMetaData.organizationId}.read", "clients.{jwt.user.rawUserMetaData.organizationId}.create", "clients.{jwt.user.rawUserMetaData.organizationId}.edit", "clients.{jwt.user.rawUserMetaData.organizationId}.delete", "clients.{jwt.user.rawUserMetaData.organizationId}.pin.read", "clients.{jwt.user.rawUserMetaData.organizationId}.pin.edit", "clients.{jwt.user.rawUserMetaData.organizationId}.trader.edit", "clients.{jwt.user.rawUserMetaData.organizationId}.logs.read", "clients.{jwt.user.rawUserMetaData.organizationId}.logs.create", "clients.{jwt.user.rawUserMetaData.organizationId}.logs.delete", "users.read", "users.create", "users.edit", "users.delete", "users.ban", "users.password.reset.send", "users.password.edit", "users.2fa.enable", "users.2fa.disable", "users.roles.read", "users.roles.edit", "users.scopes.read", "users.scopes.assign", "users.scopes.delete", "users.logs.read", "users.logs.create", "users.logs.delete", "users.{jwt.user.rawUserMetaData.organizationId}.read", "users.{jwt.user.rawUserMetaData.organizationId}.create", "users.{jwt.user.rawUserMetaData.organizationId}.edit", "users.{jwt.user.rawUserMetaData.organizationId}.delete", "users.{jwt.user.rawUserMetaData.organizationId}.ban", "users.{jwt.user.rawUserMetaData.organizationId}.password.reset.send", "users.{jwt.user.rawUserMetaData.organizationId}.password.edit", "users.{jwt.user.rawUserMetaData.organizationId}.2fa.enable", "users.{jwt.user.rawUserMetaData.organizationId}.2fa.disable", "users.{jwt.user.rawUserMetaData.organizationId}.roles.read", "users.{jwt.user.rawUserMetaData.organizationId}.roles.edit", "users.{jwt.user.rawUserMetaData.organizationId}.scopes.read", "users.{jwt.user.rawUserMetaData.organizationId}.scopes.assign", "users.{jwt.user.rawUserMetaData.organizationId}.scopes.delete", "users.{jwt.user.rawUserMetaData.organizationId}.logs.read", "users.{jwt.user.rawUserMetaData.organizationId}.logs.create", "users.{jwt.user.rawUserMetaData.organizationId}.logs.delete", "traders.read", "traders.create", "traders.edit", "traders.delete", "traders.logs", "roles.read", "roles.create", "roles.edit", "roles.delete", "roles.scopes.assign", "roles.scopes.delete", "roles.logs.read", "roles.logs.create", "roles.logs.delete", "roles.users.read", "test.admin", "test.read", "test.edit", "test.delete", "test.{jwt.organizationId}.read", "test.{jwt.user.rawUserMetaData.organizationId}.read", "test.{jwt.user.rawUserMetaData.organizationId}.edit", "test.{param.resourceId}.read", "test.organization.{jwt.user.rawUserMetaData.organizationId}.resource.{jwt.user.rawUserMetaData.organizationId}.read", "test.organization.{jwt.user.rawUserMetaData.organizationId}.branch.{jwt.userData.organizationBranchId}.read", "test.{invalid}.scope", "test.{}.scope", "test.{jwt.}.scope", "test.{.key}.scope"];
51
51
  type LabeledScope = {
@@ -54,6 +54,4 @@ type LabeledScope = {
54
54
  };
55
55
  declare const LABELED_SCOPES: LabeledScope[];
56
56
 
57
- declare const _default: new (ctx: ExecutionContext, env: RbacEnv) => WorkerEntrypoint<RbacEnv>;
58
-
59
- export { LABELED_SCOPES, _default as default, defineRbacService };
57
+ export { LABELED_SCOPES, defineRbacService };
@@ -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 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';
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.DhWWcHCj.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.D5N_wrRb.js';
8
+ import '../shared/rbac.CNbKvNcg.js';
9
9
  import 'drizzle-orm/sqlite-core';
10
10
 
11
11
  type TypedScopeObject<TScopes extends readonly LabeledScope$1[]> = {
@@ -45,7 +45,7 @@ declare class RbacServiceBase<TScopes extends readonly LabeledScope$1[] = Labele
45
45
  }
46
46
  declare function defineRbacService<const TScopes extends readonly LabeledScope$1[]>(config?: {
47
47
  scopes: TScopes;
48
- }): new (ctx: ExecutionContext, env: RbacEnv) => RbacServiceBase<TScopes>;
48
+ }): typeof RbacServiceBase<TScopes>;
49
49
 
50
50
  declare const SCOPES: readonly ["tickets.read", "tickets.create", "tickets.edit", "tickets.delete", "tickets.archive", "tickets.automations.pause", "tickets.automations.resume", "tickets.dependencies.read", "tickets.dependencies.create", "tickets.dependencies.edit", "tickets.dependencies.delete", "tickets.confirmation.send", "tickets.confirmation.download", "tickets.payments.create", "tickets.payments.read", "tickets.payments.edit", "tickets.payments.delete", "tickets.payments.confirmation.send", "tickets.payments.confirmation.download", "tickets.logs.read", "tickets.logs.create", "tickets.logs.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.edit", "tickets.{jwt.user.rawUserMetaData.organizationId}.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.archive", "tickets.{jwt.user.rawUserMetaData.organizationId}.automations.pause", "tickets.{jwt.user.rawUserMetaData.organizationId}.automations.resume", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.edit", "tickets.{jwt.user.rawUserMetaData.organizationId}.dependencies.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.confirmation.send", "tickets.{jwt.user.rawUserMetaData.organizationId}.confirmation.download", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.edit", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.delete", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.confirmation.send", "tickets.{jwt.user.rawUserMetaData.organizationId}.payments.confirmation.download", "tickets.{jwt.user.rawUserMetaData.organizationId}.logs.read", "tickets.{jwt.user.rawUserMetaData.organizationId}.logs.create", "tickets.{jwt.user.rawUserMetaData.organizationId}.logs.delete", "clients.read", "clients.create", "clients.edit", "clients.delete", "clients.pin.read", "clients.pin.edit", "clients.trader.edit", "clients.logs.read", "clients.logs.create", "clients.logs.delete", "clients.{jwt.user.rawUserMetaData.organizationId}.read", "clients.{jwt.user.rawUserMetaData.organizationId}.create", "clients.{jwt.user.rawUserMetaData.organizationId}.edit", "clients.{jwt.user.rawUserMetaData.organizationId}.delete", "clients.{jwt.user.rawUserMetaData.organizationId}.pin.read", "clients.{jwt.user.rawUserMetaData.organizationId}.pin.edit", "clients.{jwt.user.rawUserMetaData.organizationId}.trader.edit", "clients.{jwt.user.rawUserMetaData.organizationId}.logs.read", "clients.{jwt.user.rawUserMetaData.organizationId}.logs.create", "clients.{jwt.user.rawUserMetaData.organizationId}.logs.delete", "users.read", "users.create", "users.edit", "users.delete", "users.ban", "users.password.reset.send", "users.password.edit", "users.2fa.enable", "users.2fa.disable", "users.roles.read", "users.roles.edit", "users.scopes.read", "users.scopes.assign", "users.scopes.delete", "users.logs.read", "users.logs.create", "users.logs.delete", "users.{jwt.user.rawUserMetaData.organizationId}.read", "users.{jwt.user.rawUserMetaData.organizationId}.create", "users.{jwt.user.rawUserMetaData.organizationId}.edit", "users.{jwt.user.rawUserMetaData.organizationId}.delete", "users.{jwt.user.rawUserMetaData.organizationId}.ban", "users.{jwt.user.rawUserMetaData.organizationId}.password.reset.send", "users.{jwt.user.rawUserMetaData.organizationId}.password.edit", "users.{jwt.user.rawUserMetaData.organizationId}.2fa.enable", "users.{jwt.user.rawUserMetaData.organizationId}.2fa.disable", "users.{jwt.user.rawUserMetaData.organizationId}.roles.read", "users.{jwt.user.rawUserMetaData.organizationId}.roles.edit", "users.{jwt.user.rawUserMetaData.organizationId}.scopes.read", "users.{jwt.user.rawUserMetaData.organizationId}.scopes.assign", "users.{jwt.user.rawUserMetaData.organizationId}.scopes.delete", "users.{jwt.user.rawUserMetaData.organizationId}.logs.read", "users.{jwt.user.rawUserMetaData.organizationId}.logs.create", "users.{jwt.user.rawUserMetaData.organizationId}.logs.delete", "traders.read", "traders.create", "traders.edit", "traders.delete", "traders.logs", "roles.read", "roles.create", "roles.edit", "roles.delete", "roles.scopes.assign", "roles.scopes.delete", "roles.logs.read", "roles.logs.create", "roles.logs.delete", "roles.users.read", "test.admin", "test.read", "test.edit", "test.delete", "test.{jwt.organizationId}.read", "test.{jwt.user.rawUserMetaData.organizationId}.read", "test.{jwt.user.rawUserMetaData.organizationId}.edit", "test.{param.resourceId}.read", "test.organization.{jwt.user.rawUserMetaData.organizationId}.resource.{jwt.user.rawUserMetaData.organizationId}.read", "test.organization.{jwt.user.rawUserMetaData.organizationId}.branch.{jwt.userData.organizationBranchId}.read", "test.{invalid}.scope", "test.{}.scope", "test.{jwt.}.scope", "test.{.key}.scope"];
51
51
  type LabeledScope = {
@@ -54,8 +54,4 @@ type LabeledScope = {
54
54
  };
55
55
  declare const LABELED_SCOPES: LabeledScope[];
56
56
 
57
- declare const _default: new (ctx: ExecutionContext, env: RbacEnv) => WorkerEntrypoint<RbacEnv>;
58
-
59
- // @ts-ignore
60
- export = _default;
61
57
  export { LABELED_SCOPES, defineRbacService };
@@ -1,12 +1,31 @@
1
1
  import { uuidv4, first, createInternalError, develitWorker, action, service } from '@develit-io/backend-sdk';
2
- import { s as schema } from '../shared/rbac.H1LXb5Lk.mjs';
3
- import { eq, and, count, inArray } from 'drizzle-orm';
2
+ import { s as schema } from '../shared/rbac.BUAU2nhH.mjs';
3
+ import { defineRelations, eq, and, count, inArray } from 'drizzle-orm';
4
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';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
 
10
+ const relations = defineRelations(schema, (r) => ({
11
+ role: {
12
+ roleScopes: r.many.roleScope(),
13
+ userRoles: r.many.userRole()
14
+ },
15
+ roleScope: {
16
+ role: r.one.role({
17
+ from: r.roleScope.roleId,
18
+ to: r.role.id
19
+ })
20
+ },
21
+ userRole: {
22
+ role: r.one.role({
23
+ from: r.userRole.roleId,
24
+ to: r.role.id
25
+ })
26
+ }
27
+ }));
28
+
10
29
  const tables = schema;
11
30
 
12
31
  const assignRoleToUserCommand = async ({
@@ -378,7 +397,7 @@ var __decorateClass = (decorators, target, key, kind) => {
378
397
  let RbacServiceBase = class extends develitWorker(WorkerEntrypoint) {
379
398
  constructor(ctx, env, scopes) {
380
399
  super(ctx, env);
381
- this.db = drizzle(this.env.RBAC_D1, { schema: tables });
400
+ this.db = drizzle(this.env.RBAC_D1, { schema: tables, relations });
382
401
  this.SCOPES = scopes;
383
402
  }
384
403
  validateScope(scope) {
@@ -1142,8 +1161,4 @@ const LABELED_SCOPES = [
1142
1161
  // { label: 'Smazat logy účtů', value: 'accounts.logs.delete' },
1143
1162
  ];
1144
1163
 
1145
- const RbacService = defineRbacService({
1146
- scopes: LABELED_SCOPES
1147
- });
1148
-
1149
- export { LABELED_SCOPES, RbacService as default, defineRbacService };
1164
+ export { LABELED_SCOPES, defineRbacService };
@@ -3,13 +3,14 @@
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
4
 
5
5
  function defineRbacServiceWrangler(config) {
6
- const { project, name, envs } = config;
6
+ const { project, name, d1, envs } = config;
7
7
  const base = {
8
8
  ...backendSdk.composeWranglerBase({
9
9
  project,
10
10
  name
11
11
  }),
12
12
  vars: {
13
+ ...envs.local.customVars,
13
14
  ...envs.local.vars,
14
15
  ENVIRONMENT: "localhost"
15
16
  },
@@ -23,7 +24,7 @@ function defineRbacServiceWrangler(config) {
23
24
  {
24
25
  binding: "RBAC_D1",
25
26
  database_name: `${project}-rbac`,
26
- database_id: envs.local.d1.id,
27
+ database_id: d1.id,
27
28
  migrations_dir: "./src/database/migrations"
28
29
  }
29
30
  ],
@@ -34,17 +35,10 @@ function defineRbacServiceWrangler(config) {
34
35
  )) {
35
36
  base.env[envName] = {
36
37
  vars: {
38
+ ...envCfg.customVars,
37
39
  ...envCfg.vars,
38
40
  ENVIRONMENT: envName
39
- },
40
- d1_databases: [
41
- {
42
- binding: "RBAC_D1",
43
- database_name: `${project}-rbac-${envName}`,
44
- database_id: envCfg.d1.id,
45
- migrations_dir: "./src/database/migrations"
46
- }
47
- ]
41
+ }
48
42
  };
49
43
  }
50
44
  return base;
@@ -1,4 +1,4 @@
1
- import { R as RbacServiceWranglerConfig } from '../shared/rbac.DUk_qXWk.cjs';
1
+ import { R as RbacServiceWranglerConfig } from '../shared/rbac.ZCOTsP5y.cjs';
2
2
 
3
3
  declare function defineRbacServiceWrangler(config: RbacServiceWranglerConfig): {
4
4
  vars: {
@@ -1,4 +1,4 @@
1
- import { R as RbacServiceWranglerConfig } from '../shared/rbac.DUk_qXWk.mjs';
1
+ import { R as RbacServiceWranglerConfig } from '../shared/rbac.ZCOTsP5y.mjs';
2
2
 
3
3
  declare function defineRbacServiceWrangler(config: RbacServiceWranglerConfig): {
4
4
  vars: {
@@ -1,4 +1,4 @@
1
- import { R as RbacServiceWranglerConfig } from '../shared/rbac.DUk_qXWk.js';
1
+ import { R as RbacServiceWranglerConfig } from '../shared/rbac.ZCOTsP5y.js';
2
2
 
3
3
  declare function defineRbacServiceWrangler(config: RbacServiceWranglerConfig): {
4
4
  vars: {
@@ -1,13 +1,14 @@
1
1
  import { composeWranglerBase } from '@develit-io/backend-sdk';
2
2
 
3
3
  function defineRbacServiceWrangler(config) {
4
- const { project, name, envs } = config;
4
+ const { project, name, d1, envs } = config;
5
5
  const base = {
6
6
  ...composeWranglerBase({
7
7
  project,
8
8
  name
9
9
  }),
10
10
  vars: {
11
+ ...envs.local.customVars,
11
12
  ...envs.local.vars,
12
13
  ENVIRONMENT: "localhost"
13
14
  },
@@ -21,7 +22,7 @@ function defineRbacServiceWrangler(config) {
21
22
  {
22
23
  binding: "RBAC_D1",
23
24
  database_name: `${project}-rbac`,
24
- database_id: envs.local.d1.id,
25
+ database_id: d1.id,
25
26
  migrations_dir: "./src/database/migrations"
26
27
  }
27
28
  ],
@@ -32,17 +33,10 @@ function defineRbacServiceWrangler(config) {
32
33
  )) {
33
34
  base.env[envName] = {
34
35
  vars: {
36
+ ...envCfg.customVars,
35
37
  ...envCfg.vars,
36
38
  ENVIRONMENT: envName
37
- },
38
- d1_databases: [
39
- {
40
- binding: "RBAC_D1",
41
- database_name: `${project}-rbac-${envName}`,
42
- database_id: envCfg.d1.id,
43
- migrations_dir: "./src/database/migrations"
44
- }
45
- ]
39
+ }
46
40
  };
47
41
  }
48
42
  return base;
@@ -1,5 +1,6 @@
1
1
  import { base } from '@develit-io/backend-sdk';
2
- import { sqliteTable, text, unique } from 'drizzle-orm/sqlite-core';
2
+ import { sqliteTable, text, unique, uniqueIndex } from 'drizzle-orm/sqlite-core';
3
+ import { isNull } from 'drizzle-orm';
3
4
 
4
5
  const role = sqliteTable("roles", {
5
6
  ...base,
@@ -31,7 +32,10 @@ const userScope = sqliteTable(
31
32
  scope: text("scope").notNull(),
32
33
  resourceId: text("resource_id")
33
34
  },
34
- (t) => [unique().on(t.userId, t.scope, t.resourceId)]
35
+ (t) => [
36
+ unique("unique_user_scope_resource").on(t.userId, t.scope, t.resourceId),
37
+ uniqueIndex("unique_user_scope_null_resource").on(t.userId, t.scope).where(isNull(t.resourceId))
38
+ ]
35
39
  );
36
40
 
37
41
  const schema = {
@@ -0,0 +1,221 @@
1
+ import * as drizzle_orm from 'drizzle-orm';
2
+ import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
3
+
4
+ declare const roleScope: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
5
+ name: "roles_scopes";
6
+ schema: undefined;
7
+ columns: {
8
+ roleId: drizzle_orm_sqlite_core.SQLiteColumn<{
9
+ name: string;
10
+ tableName: "roles_scopes";
11
+ dataType: "string";
12
+ data: string;
13
+ driverParam: string;
14
+ notNull: true;
15
+ hasDefault: false;
16
+ isPrimaryKey: false;
17
+ isAutoincrement: false;
18
+ hasRuntimeDefault: false;
19
+ enumValues: [string, ...string[]];
20
+ baseColumn: never;
21
+ identity: undefined;
22
+ generated: undefined;
23
+ }, {}>;
24
+ scope: drizzle_orm_sqlite_core.SQLiteColumn<{
25
+ name: string;
26
+ tableName: "roles_scopes";
27
+ dataType: "string";
28
+ data: string;
29
+ driverParam: string;
30
+ notNull: true;
31
+ hasDefault: false;
32
+ isPrimaryKey: false;
33
+ isAutoincrement: false;
34
+ hasRuntimeDefault: false;
35
+ enumValues: [string, ...string[]];
36
+ baseColumn: never;
37
+ identity: undefined;
38
+ generated: undefined;
39
+ }, {}>;
40
+ resourceId: drizzle_orm_sqlite_core.SQLiteColumn<{
41
+ name: string;
42
+ tableName: "roles_scopes";
43
+ dataType: "string";
44
+ data: string;
45
+ driverParam: string;
46
+ notNull: false;
47
+ hasDefault: false;
48
+ isPrimaryKey: false;
49
+ isAutoincrement: false;
50
+ hasRuntimeDefault: false;
51
+ enumValues: [string, ...string[]];
52
+ baseColumn: never;
53
+ identity: undefined;
54
+ generated: undefined;
55
+ }, {}>;
56
+ id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
57
+ createdAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"created_at">>;
58
+ createdBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"created_by", [string, ...string[]], number | undefined>>;
59
+ updatedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"updated_at">>>;
60
+ updatedBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"updated_by", [string, ...string[]], number | undefined>>;
61
+ deletedAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"deleted_at">>;
62
+ deletedBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"deleted_by", [string, ...string[]], number | undefined>>;
63
+ };
64
+ dialect: "sqlite";
65
+ }>;
66
+
67
+ declare const role: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
68
+ name: "roles";
69
+ schema: undefined;
70
+ columns: {
71
+ name: drizzle_orm_sqlite_core.SQLiteColumn<{
72
+ name: string;
73
+ tableName: "roles";
74
+ dataType: "string";
75
+ data: string;
76
+ driverParam: string;
77
+ notNull: true;
78
+ hasDefault: false;
79
+ isPrimaryKey: false;
80
+ isAutoincrement: false;
81
+ hasRuntimeDefault: false;
82
+ enumValues: [string, ...string[]];
83
+ baseColumn: never;
84
+ identity: undefined;
85
+ generated: undefined;
86
+ }, {}>;
87
+ id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
88
+ createdAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"created_at">>;
89
+ createdBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"created_by", [string, ...string[]], number | undefined>>;
90
+ updatedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"updated_at">>>;
91
+ updatedBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"updated_by", [string, ...string[]], number | undefined>>;
92
+ deletedAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"deleted_at">>;
93
+ deletedBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"deleted_by", [string, ...string[]], number | undefined>>;
94
+ };
95
+ dialect: "sqlite";
96
+ }>;
97
+
98
+ declare const userRole: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
99
+ name: "user_roles";
100
+ schema: undefined;
101
+ columns: {
102
+ userId: drizzle_orm_sqlite_core.SQLiteColumn<{
103
+ name: string;
104
+ tableName: "user_roles";
105
+ dataType: "string";
106
+ data: string;
107
+ driverParam: string;
108
+ notNull: true;
109
+ hasDefault: false;
110
+ isPrimaryKey: false;
111
+ isAutoincrement: false;
112
+ hasRuntimeDefault: false;
113
+ enumValues: [string, ...string[]];
114
+ baseColumn: never;
115
+ identity: undefined;
116
+ generated: undefined;
117
+ }, {}>;
118
+ roleId: drizzle_orm_sqlite_core.SQLiteColumn<{
119
+ name: string;
120
+ tableName: "user_roles";
121
+ dataType: "string";
122
+ data: string;
123
+ driverParam: string;
124
+ notNull: true;
125
+ hasDefault: false;
126
+ isPrimaryKey: false;
127
+ isAutoincrement: false;
128
+ hasRuntimeDefault: false;
129
+ enumValues: [string, ...string[]];
130
+ baseColumn: never;
131
+ identity: undefined;
132
+ generated: undefined;
133
+ }, {}>;
134
+ id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
135
+ createdAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"created_at">>;
136
+ createdBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"created_by", [string, ...string[]], number | undefined>>;
137
+ updatedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"updated_at">>>;
138
+ updatedBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"updated_by", [string, ...string[]], number | undefined>>;
139
+ deletedAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"deleted_at">>;
140
+ deletedBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"deleted_by", [string, ...string[]], number | undefined>>;
141
+ };
142
+ dialect: "sqlite";
143
+ }>;
144
+
145
+ declare const userScope: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
146
+ name: "user_scopes";
147
+ schema: undefined;
148
+ columns: {
149
+ userId: drizzle_orm_sqlite_core.SQLiteColumn<{
150
+ name: string;
151
+ tableName: "user_scopes";
152
+ dataType: "string";
153
+ data: string;
154
+ driverParam: string;
155
+ notNull: true;
156
+ hasDefault: false;
157
+ isPrimaryKey: false;
158
+ isAutoincrement: false;
159
+ hasRuntimeDefault: false;
160
+ enumValues: [string, ...string[]];
161
+ baseColumn: never;
162
+ identity: undefined;
163
+ generated: undefined;
164
+ }, {}>;
165
+ scope: drizzle_orm_sqlite_core.SQLiteColumn<{
166
+ name: string;
167
+ tableName: "user_scopes";
168
+ dataType: "string";
169
+ data: string;
170
+ driverParam: string;
171
+ notNull: true;
172
+ hasDefault: false;
173
+ isPrimaryKey: false;
174
+ isAutoincrement: false;
175
+ hasRuntimeDefault: false;
176
+ enumValues: [string, ...string[]];
177
+ baseColumn: never;
178
+ identity: undefined;
179
+ generated: undefined;
180
+ }, {}>;
181
+ resourceId: drizzle_orm_sqlite_core.SQLiteColumn<{
182
+ name: string;
183
+ tableName: "user_scopes";
184
+ dataType: "string";
185
+ data: string;
186
+ driverParam: string;
187
+ notNull: false;
188
+ hasDefault: false;
189
+ isPrimaryKey: false;
190
+ isAutoincrement: false;
191
+ hasRuntimeDefault: false;
192
+ enumValues: [string, ...string[]];
193
+ baseColumn: never;
194
+ identity: undefined;
195
+ generated: undefined;
196
+ }, {}>;
197
+ id: drizzle_orm.IsPrimaryKey<drizzle_orm.NotNull<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
198
+ createdAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"created_at">>;
199
+ createdBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"created_by", [string, ...string[]], number | undefined>>;
200
+ updatedAt: drizzle_orm.HasDefault<drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"updated_at">>>;
201
+ updatedBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"updated_by", [string, ...string[]], number | undefined>>;
202
+ deletedAt: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTimestampBuilderInitial<"deleted_at">>;
203
+ deletedBy: drizzle_orm.HasDefault<drizzle_orm_sqlite_core.SQLiteTextBuilderInitial<"deleted_by", [string, ...string[]], number | undefined>>;
204
+ };
205
+ dialect: "sqlite";
206
+ }>;
207
+
208
+ declare const schema_role: typeof role;
209
+ declare const schema_roleScope: typeof roleScope;
210
+ declare const schema_userRole: typeof userRole;
211
+ declare const schema_userScope: typeof userScope;
212
+ declare namespace schema {
213
+ export {
214
+ schema_role as role,
215
+ schema_roleScope as roleScope,
216
+ schema_userRole as userRole,
217
+ schema_userScope as userScope,
218
+ };
219
+ }
220
+
221
+ export { roleScope as a, userScope as b, role as r, schema as s, userRole as u };