@develit-services/rbac 0.7.0 → 0.7.1

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,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,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';
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const backendSdk = require('@develit-io/backend-sdk');
6
- const database_schema = require('../shared/rbac.gXUvaSJ2.cjs');
6
+ const database_schema = require('../shared/rbac.D4H9O9-q.cjs');
7
7
  const drizzleOrm = require('drizzle-orm');
8
8
  const verifyScope = require('../shared/rbac.CZCpmLF8.cjs');
9
9
  const zod = require('zod');
@@ -1,5 +1,5 @@
1
1
  import { uuidv4, first, createInternalError, develitWorker, action, service } from '@develit-io/backend-sdk';
2
- import { s as schema } from '../shared/rbac.H1LXb5Lk.mjs';
2
+ import { s as schema } from '../shared/rbac.BUAU2nhH.mjs';
3
3
  import { 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';
@@ -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 = {
@@ -2,6 +2,7 @@
2
2
 
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
4
  const sqliteCore = require('drizzle-orm/sqlite-core');
5
+ const drizzleOrm = require('drizzle-orm');
5
6
 
6
7
  const role = sqliteCore.sqliteTable("roles", {
7
8
  ...backendSdk.base,
@@ -33,7 +34,10 @@ const userScope = sqliteCore.sqliteTable(
33
34
  scope: sqliteCore.text("scope").notNull(),
34
35
  resourceId: sqliteCore.text("resource_id")
35
36
  },
36
- (t) => [sqliteCore.unique().on(t.userId, t.scope, t.resourceId)]
37
+ (t) => [
38
+ sqliteCore.unique("unique_user_scope_resource").on(t.userId, t.scope, t.resourceId),
39
+ sqliteCore.uniqueIndex("unique_user_scope_null_resource").on(t.userId, t.scope).where(drizzleOrm.isNull(t.resourceId))
40
+ ]
37
41
  );
38
42
 
39
43
  const schema = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/rbac",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {