@develit-services/rbac 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database/schema.cjs +1 -1
- package/dist/database/schema.d.cts +1 -1
- package/dist/database/schema.d.mts +1 -1
- package/dist/database/schema.d.ts +1 -1
- package/dist/database/schema.mjs +1 -1
- package/dist/export/worker.cjs +15 -5
- package/dist/export/worker.d.cts +2 -2
- package/dist/export/worker.d.mts +2 -2
- package/dist/export/worker.d.ts +2 -2
- package/dist/export/worker.mjs +15 -5
- package/dist/export/wrangler.d.cts +1 -1
- package/dist/export/wrangler.d.mts +1 -1
- package/dist/export/wrangler.d.ts +1 -1
- package/dist/shared/{rbac.CG3CtEwh.d.mts → rbac.4NEkwyHb.d.mts} +7 -3
- package/dist/shared/{rbac.BrefTsLW.d.ts → rbac.B4swuPCq.d.ts} +7 -3
- package/dist/shared/{rbac.JCf4hSCf.cjs → rbac.DH2MYF0T.cjs} +5 -1
- package/dist/shared/{rbac.ClMKyW8J.d.mts → rbac.DUk_qXWk.d.cts} +1 -1
- package/dist/shared/{rbac.ClMKyW8J.d.ts → rbac.DUk_qXWk.d.mts} +1 -1
- package/dist/shared/{rbac.ClMKyW8J.d.cts → rbac.DUk_qXWk.d.ts} +1 -1
- package/dist/shared/{rbac.DBpIRbd3.d.cts → rbac.DiIYl-FR.d.cts} +7 -3
- package/dist/shared/rbac.Dk5HPpHF.d.cts +247 -0
- package/dist/shared/rbac.Dk5HPpHF.d.mts +247 -0
- package/dist/shared/rbac.Dk5HPpHF.d.ts +247 -0
- package/dist/shared/{rbac.D5OV7UPA.mjs → rbac.H1LXb5Lk.mjs} +2 -2
- package/dist/shared/{rbac.Cra1T2nC.cjs → rbac.gXUvaSJ2.cjs} +1 -1
- package/dist/shared/{rbac.2_i8g_mW.mjs → rbac.tv1QQcSW.mjs} +6 -2
- package/dist/types.cjs +1 -1
- package/dist/types.d.cts +3 -3
- package/dist/types.d.mts +3 -3
- package/dist/types.d.ts +3 -3
- package/dist/types.mjs +1 -1
- package/package.json +7 -10
- package/dist/shared/rbac.CqpxM3E5.d.cts +0 -499
- package/dist/shared/rbac.CqpxM3E5.d.mts +0 -499
- package/dist/shared/rbac.CqpxM3E5.d.ts +0 -499
package/dist/database/schema.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.Dk5HPpHF.cjs';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.Dk5HPpHF.mjs';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.Dk5HPpHF.js';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
package/dist/database/schema.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { r as role, a as roleScope, u as userRole, b as userScope } from '../shared/rbac.H1LXb5Lk.mjs';
|
|
2
2
|
import '@develit-io/backend-sdk';
|
|
3
3
|
import 'drizzle-orm/sqlite-core';
|
package/dist/export/worker.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
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.
|
|
6
|
+
const database_schema = require('../shared/rbac.gXUvaSJ2.cjs');
|
|
7
7
|
const drizzleOrm = require('drizzle-orm');
|
|
8
|
-
const verifyScope = require('../shared/rbac.
|
|
8
|
+
const verifyScope = require('../shared/rbac.DH2MYF0T.cjs');
|
|
9
9
|
const zod = require('zod');
|
|
10
10
|
const cloudflare_workers = require('cloudflare:workers');
|
|
11
11
|
const d1 = require('drizzle-orm/d1');
|
|
@@ -638,24 +638,34 @@ let RbacServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
638
638
|
return this.handleAction(
|
|
639
639
|
{ data: input, schema: verifyScope.getUserPermissionsInputSchema },
|
|
640
640
|
{ successMessage: "User permissions successfully returned." },
|
|
641
|
-
async ({ userId }) => {
|
|
641
|
+
async ({ userId, filter }) => {
|
|
642
642
|
const resultRoles = await getRolesByUserQuery({ db: this.db, userId });
|
|
643
643
|
const resultScopes = await getScopesByUserQuery({ db: this.db, userId });
|
|
644
644
|
const resultRoleScopes = await getScopesByRolesQuery({
|
|
645
645
|
db: this.db,
|
|
646
646
|
roleIds: resultRoles.filter((role) => role.id).map((role) => role.id)
|
|
647
647
|
});
|
|
648
|
+
const applyFilter = (scopeValue) => {
|
|
649
|
+
if (!filter) return true;
|
|
650
|
+
if (filter.scopeContains && !scopeValue.includes(filter.scopeContains)) {
|
|
651
|
+
return false;
|
|
652
|
+
}
|
|
653
|
+
if (filter.scopeStartsWith && !scopeValue.startsWith(filter.scopeStartsWith)) {
|
|
654
|
+
return false;
|
|
655
|
+
}
|
|
656
|
+
return true;
|
|
657
|
+
};
|
|
648
658
|
const roles = resultRoles.map((role) => ({
|
|
649
659
|
id: role.id,
|
|
650
660
|
name: role.name
|
|
651
661
|
}));
|
|
652
|
-
const scopes = resultScopes.map((scope) => ({
|
|
662
|
+
const scopes = resultScopes.filter((scope) => applyFilter(scope.scope)).map((scope) => ({
|
|
653
663
|
id: scope.id,
|
|
654
664
|
scope: scope.scope,
|
|
655
665
|
label: this.SCOPES.find((s) => s.value === scope.scope)?.label || null,
|
|
656
666
|
resourceId: scope.resourceId
|
|
657
667
|
}));
|
|
658
|
-
const roleScopes = resultRoleScopes.map((scope) => ({
|
|
668
|
+
const roleScopes = resultRoleScopes.filter((scope) => applyFilter(scope.scope)).map((scope) => ({
|
|
659
669
|
id: scope.id,
|
|
660
670
|
scope: scope.scope,
|
|
661
671
|
label: this.SCOPES.find((s) => s.value === scope.scope)?.label || null,
|
package/dist/export/worker.d.cts
CHANGED
|
@@ -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.
|
|
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';
|
|
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.
|
|
8
|
+
import '../shared/rbac.Dk5HPpHF.cjs';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
|
|
11
11
|
type TypedScopeObject<TScopes extends readonly LabeledScope$1[]> = {
|
package/dist/export/worker.d.mts
CHANGED
|
@@ -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.
|
|
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';
|
|
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.
|
|
8
|
+
import '../shared/rbac.Dk5HPpHF.mjs';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
|
|
11
11
|
type TypedScopeObject<TScopes extends readonly LabeledScope$1[]> = {
|
package/dist/export/worker.d.ts
CHANGED
|
@@ -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.
|
|
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';
|
|
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.
|
|
8
|
+
import '../shared/rbac.Dk5HPpHF.js';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
|
|
11
11
|
type TypedScopeObject<TScopes extends readonly LabeledScope$1[]> = {
|
package/dist/export/worker.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { uuidv4, first, createInternalError, develitWorker, action, service } from '@develit-io/backend-sdk';
|
|
2
|
-
import { s as schema } from '../shared/rbac.
|
|
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,
|
|
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';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
7
7
|
import { drizzle } from 'drizzle-orm/d1';
|
|
@@ -634,24 +634,34 @@ let RbacServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
634
634
|
return this.handleAction(
|
|
635
635
|
{ data: input, schema: getUserPermissionsInputSchema },
|
|
636
636
|
{ successMessage: "User permissions successfully returned." },
|
|
637
|
-
async ({ userId }) => {
|
|
637
|
+
async ({ userId, filter }) => {
|
|
638
638
|
const resultRoles = await getRolesByUserQuery({ db: this.db, userId });
|
|
639
639
|
const resultScopes = await getScopesByUserQuery({ db: this.db, userId });
|
|
640
640
|
const resultRoleScopes = await getScopesByRolesQuery({
|
|
641
641
|
db: this.db,
|
|
642
642
|
roleIds: resultRoles.filter((role) => role.id).map((role) => role.id)
|
|
643
643
|
});
|
|
644
|
+
const applyFilter = (scopeValue) => {
|
|
645
|
+
if (!filter) return true;
|
|
646
|
+
if (filter.scopeContains && !scopeValue.includes(filter.scopeContains)) {
|
|
647
|
+
return false;
|
|
648
|
+
}
|
|
649
|
+
if (filter.scopeStartsWith && !scopeValue.startsWith(filter.scopeStartsWith)) {
|
|
650
|
+
return false;
|
|
651
|
+
}
|
|
652
|
+
return true;
|
|
653
|
+
};
|
|
644
654
|
const roles = resultRoles.map((role) => ({
|
|
645
655
|
id: role.id,
|
|
646
656
|
name: role.name
|
|
647
657
|
}));
|
|
648
|
-
const scopes = resultScopes.map((scope) => ({
|
|
658
|
+
const scopes = resultScopes.filter((scope) => applyFilter(scope.scope)).map((scope) => ({
|
|
649
659
|
id: scope.id,
|
|
650
660
|
scope: scope.scope,
|
|
651
661
|
label: this.SCOPES.find((s) => s.value === scope.scope)?.label || null,
|
|
652
662
|
resourceId: scope.resourceId
|
|
653
663
|
}));
|
|
654
|
-
const roleScopes = resultRoleScopes.map((scope) => ({
|
|
664
|
+
const roleScopes = resultRoleScopes.filter((scope) => applyFilter(scope.scope)).map((scope) => ({
|
|
655
665
|
id: scope.id,
|
|
656
666
|
scope: scope.scope,
|
|
657
667
|
label: this.SCOPES.find((s) => s.value === scope.scope)?.label || null,
|
|
@@ -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.
|
|
3
|
+
import { s as schema } from './rbac.Dk5HPpHF.mjs';
|
|
4
4
|
|
|
5
5
|
declare const tables: typeof schema;
|
|
6
6
|
|
|
@@ -93,6 +93,10 @@ interface GetPermissionsOutput {
|
|
|
93
93
|
|
|
94
94
|
declare const getUserPermissionsInputSchema: z.ZodObject<{
|
|
95
95
|
userId: z.ZodUUID;
|
|
96
|
+
filter: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
scopeContains: z.ZodOptional<z.ZodString>;
|
|
98
|
+
scopeStartsWith: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>>;
|
|
96
100
|
}, z.core.$strip>;
|
|
97
101
|
interface GetUserPermissionsInput extends z.infer<typeof getUserPermissionsInputSchema> {
|
|
98
102
|
}
|
|
@@ -250,5 +254,5 @@ declare function isAndCondition(condition: ScopeCondition): condition is {
|
|
|
250
254
|
};
|
|
251
255
|
declare function isImplicitAndCondition(condition: ScopeCondition): condition is ScopeCondition[];
|
|
252
256
|
|
|
253
|
-
export {
|
|
254
|
-
export type { AssignRoleToUserInput as A,
|
|
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 };
|
|
@@ -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.
|
|
3
|
+
import { s as schema } from './rbac.Dk5HPpHF.js';
|
|
4
4
|
|
|
5
5
|
declare const tables: typeof schema;
|
|
6
6
|
|
|
@@ -93,6 +93,10 @@ interface GetPermissionsOutput {
|
|
|
93
93
|
|
|
94
94
|
declare const getUserPermissionsInputSchema: z.ZodObject<{
|
|
95
95
|
userId: z.ZodUUID;
|
|
96
|
+
filter: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
scopeContains: z.ZodOptional<z.ZodString>;
|
|
98
|
+
scopeStartsWith: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>>;
|
|
96
100
|
}, z.core.$strip>;
|
|
97
101
|
interface GetUserPermissionsInput extends z.infer<typeof getUserPermissionsInputSchema> {
|
|
98
102
|
}
|
|
@@ -250,5 +254,5 @@ declare function isAndCondition(condition: ScopeCondition): condition is {
|
|
|
250
254
|
};
|
|
251
255
|
declare function isImplicitAndCondition(condition: ScopeCondition): condition is ScopeCondition[];
|
|
252
256
|
|
|
253
|
-
export {
|
|
254
|
-
export type { AssignRoleToUserInput as A,
|
|
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 };
|
|
@@ -21,7 +21,11 @@ const deleteRoleInputSchema = zod.z.object({
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
const getUserPermissionsInputSchema = zod.z.object({
|
|
24
|
-
userId: zod.z.uuid()
|
|
24
|
+
userId: zod.z.uuid(),
|
|
25
|
+
filter: zod.z.object({
|
|
26
|
+
scopeContains: zod.z.string().optional(),
|
|
27
|
+
scopeStartsWith: zod.z.string().optional()
|
|
28
|
+
}).optional()
|
|
25
29
|
});
|
|
26
30
|
|
|
27
31
|
const grantScopeToRoleInputSchema = zod.z.object({
|
|
@@ -17,4 +17,4 @@ interface RbacServiceWranglerConfig {
|
|
|
17
17
|
interface RbacServiceEnv extends RbacEnv {
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export type { RbacServiceWranglerConfig as R,
|
|
20
|
+
export type { RbacServiceWranglerConfig as R, RbacServiceEnv as a, RbacServiceEnvironmentConfig as b };
|
|
@@ -17,4 +17,4 @@ interface RbacServiceWranglerConfig {
|
|
|
17
17
|
interface RbacServiceEnv extends RbacEnv {
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export type { RbacServiceWranglerConfig as R,
|
|
20
|
+
export type { RbacServiceWranglerConfig as R, RbacServiceEnv as a, RbacServiceEnvironmentConfig as b };
|
|
@@ -17,4 +17,4 @@ interface RbacServiceWranglerConfig {
|
|
|
17
17
|
interface RbacServiceEnv extends RbacEnv {
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export type { RbacServiceWranglerConfig as R,
|
|
20
|
+
export type { RbacServiceWranglerConfig as R, RbacServiceEnv as a, RbacServiceEnvironmentConfig as b };
|
|
@@ -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.
|
|
3
|
+
import { s as schema } from './rbac.Dk5HPpHF.cjs';
|
|
4
4
|
|
|
5
5
|
declare const tables: typeof schema;
|
|
6
6
|
|
|
@@ -93,6 +93,10 @@ interface GetPermissionsOutput {
|
|
|
93
93
|
|
|
94
94
|
declare const getUserPermissionsInputSchema: z.ZodObject<{
|
|
95
95
|
userId: z.ZodUUID;
|
|
96
|
+
filter: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
scopeContains: z.ZodOptional<z.ZodString>;
|
|
98
|
+
scopeStartsWith: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>>;
|
|
96
100
|
}, z.core.$strip>;
|
|
97
101
|
interface GetUserPermissionsInput extends z.infer<typeof getUserPermissionsInputSchema> {
|
|
98
102
|
}
|
|
@@ -250,5 +254,5 @@ declare function isAndCondition(condition: ScopeCondition): condition is {
|
|
|
250
254
|
};
|
|
251
255
|
declare function isImplicitAndCondition(condition: ScopeCondition): condition is ScopeCondition[];
|
|
252
256
|
|
|
253
|
-
export {
|
|
254
|
-
export type { AssignRoleToUserInput as A,
|
|
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 };
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
2
|
+
|
|
3
|
+
declare const roleScope: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
4
|
+
name: "roles_scopes";
|
|
5
|
+
schema: undefined;
|
|
6
|
+
columns: {
|
|
7
|
+
roleId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
8
|
+
name: "role_id";
|
|
9
|
+
tableName: "roles_scopes";
|
|
10
|
+
dataType: "string";
|
|
11
|
+
columnType: "SQLiteText";
|
|
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
|
+
length: number | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
scope: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
27
|
+
name: "scope";
|
|
28
|
+
tableName: "roles_scopes";
|
|
29
|
+
dataType: "string";
|
|
30
|
+
columnType: "SQLiteText";
|
|
31
|
+
data: string;
|
|
32
|
+
driverParam: string;
|
|
33
|
+
notNull: true;
|
|
34
|
+
hasDefault: false;
|
|
35
|
+
isPrimaryKey: false;
|
|
36
|
+
isAutoincrement: false;
|
|
37
|
+
hasRuntimeDefault: false;
|
|
38
|
+
enumValues: [string, ...string[]];
|
|
39
|
+
baseColumn: never;
|
|
40
|
+
identity: undefined;
|
|
41
|
+
generated: undefined;
|
|
42
|
+
}, {}, {
|
|
43
|
+
length: number | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
resourceId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
46
|
+
name: "resource_id";
|
|
47
|
+
tableName: "roles_scopes";
|
|
48
|
+
dataType: "string";
|
|
49
|
+
columnType: "SQLiteText";
|
|
50
|
+
data: string;
|
|
51
|
+
driverParam: string;
|
|
52
|
+
notNull: false;
|
|
53
|
+
hasDefault: false;
|
|
54
|
+
isPrimaryKey: false;
|
|
55
|
+
isAutoincrement: false;
|
|
56
|
+
hasRuntimeDefault: false;
|
|
57
|
+
enumValues: [string, ...string[]];
|
|
58
|
+
baseColumn: never;
|
|
59
|
+
identity: undefined;
|
|
60
|
+
generated: undefined;
|
|
61
|
+
}, {}, {
|
|
62
|
+
length: number | undefined;
|
|
63
|
+
}>;
|
|
64
|
+
id: _packages_backend_sdk.IsPrimaryKey<_packages_backend_sdk.NotNull<_packages_backend_sdk.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
|
|
65
|
+
createdAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"created_at">>;
|
|
66
|
+
createdBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"created_by", [string, ...string[]], number | undefined>;
|
|
67
|
+
updatedAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"updated_at">>>;
|
|
68
|
+
updatedBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"updated_by", [string, ...string[]], number | undefined>;
|
|
69
|
+
deletedAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"deleted_at">>;
|
|
70
|
+
deletedBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"deleted_by", [string, ...string[]], number | undefined>;
|
|
71
|
+
};
|
|
72
|
+
dialect: "sqlite";
|
|
73
|
+
}>;
|
|
74
|
+
|
|
75
|
+
declare const role: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
76
|
+
name: "roles";
|
|
77
|
+
schema: undefined;
|
|
78
|
+
columns: {
|
|
79
|
+
name: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
80
|
+
name: "name";
|
|
81
|
+
tableName: "roles";
|
|
82
|
+
dataType: "string";
|
|
83
|
+
columnType: "SQLiteText";
|
|
84
|
+
data: string;
|
|
85
|
+
driverParam: string;
|
|
86
|
+
notNull: true;
|
|
87
|
+
hasDefault: false;
|
|
88
|
+
isPrimaryKey: false;
|
|
89
|
+
isAutoincrement: false;
|
|
90
|
+
hasRuntimeDefault: false;
|
|
91
|
+
enumValues: [string, ...string[]];
|
|
92
|
+
baseColumn: never;
|
|
93
|
+
identity: undefined;
|
|
94
|
+
generated: undefined;
|
|
95
|
+
}, {}, {
|
|
96
|
+
length: number | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
id: _packages_backend_sdk.IsPrimaryKey<_packages_backend_sdk.NotNull<_packages_backend_sdk.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
|
|
99
|
+
createdAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"created_at">>;
|
|
100
|
+
createdBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"created_by", [string, ...string[]], number | undefined>;
|
|
101
|
+
updatedAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"updated_at">>>;
|
|
102
|
+
updatedBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"updated_by", [string, ...string[]], number | undefined>;
|
|
103
|
+
deletedAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"deleted_at">>;
|
|
104
|
+
deletedBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"deleted_by", [string, ...string[]], number | undefined>;
|
|
105
|
+
};
|
|
106
|
+
dialect: "sqlite";
|
|
107
|
+
}>;
|
|
108
|
+
|
|
109
|
+
declare const userRole: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
110
|
+
name: "user_roles";
|
|
111
|
+
schema: undefined;
|
|
112
|
+
columns: {
|
|
113
|
+
userId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
114
|
+
name: "user_id";
|
|
115
|
+
tableName: "user_roles";
|
|
116
|
+
dataType: "string";
|
|
117
|
+
columnType: "SQLiteText";
|
|
118
|
+
data: string;
|
|
119
|
+
driverParam: string;
|
|
120
|
+
notNull: true;
|
|
121
|
+
hasDefault: false;
|
|
122
|
+
isPrimaryKey: false;
|
|
123
|
+
isAutoincrement: false;
|
|
124
|
+
hasRuntimeDefault: false;
|
|
125
|
+
enumValues: [string, ...string[]];
|
|
126
|
+
baseColumn: never;
|
|
127
|
+
identity: undefined;
|
|
128
|
+
generated: undefined;
|
|
129
|
+
}, {}, {
|
|
130
|
+
length: number | undefined;
|
|
131
|
+
}>;
|
|
132
|
+
roleId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
133
|
+
name: "role_id";
|
|
134
|
+
tableName: "user_roles";
|
|
135
|
+
dataType: "string";
|
|
136
|
+
columnType: "SQLiteText";
|
|
137
|
+
data: string;
|
|
138
|
+
driverParam: string;
|
|
139
|
+
notNull: true;
|
|
140
|
+
hasDefault: false;
|
|
141
|
+
isPrimaryKey: false;
|
|
142
|
+
isAutoincrement: false;
|
|
143
|
+
hasRuntimeDefault: false;
|
|
144
|
+
enumValues: [string, ...string[]];
|
|
145
|
+
baseColumn: never;
|
|
146
|
+
identity: undefined;
|
|
147
|
+
generated: undefined;
|
|
148
|
+
}, {}, {
|
|
149
|
+
length: number | undefined;
|
|
150
|
+
}>;
|
|
151
|
+
id: _packages_backend_sdk.IsPrimaryKey<_packages_backend_sdk.NotNull<_packages_backend_sdk.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
|
|
152
|
+
createdAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"created_at">>;
|
|
153
|
+
createdBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"created_by", [string, ...string[]], number | undefined>;
|
|
154
|
+
updatedAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"updated_at">>>;
|
|
155
|
+
updatedBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"updated_by", [string, ...string[]], number | undefined>;
|
|
156
|
+
deletedAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"deleted_at">>;
|
|
157
|
+
deletedBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"deleted_by", [string, ...string[]], number | undefined>;
|
|
158
|
+
};
|
|
159
|
+
dialect: "sqlite";
|
|
160
|
+
}>;
|
|
161
|
+
|
|
162
|
+
declare const userScope: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
163
|
+
name: "user_scopes";
|
|
164
|
+
schema: undefined;
|
|
165
|
+
columns: {
|
|
166
|
+
userId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
167
|
+
name: "user_id";
|
|
168
|
+
tableName: "user_scopes";
|
|
169
|
+
dataType: "string";
|
|
170
|
+
columnType: "SQLiteText";
|
|
171
|
+
data: string;
|
|
172
|
+
driverParam: string;
|
|
173
|
+
notNull: true;
|
|
174
|
+
hasDefault: false;
|
|
175
|
+
isPrimaryKey: false;
|
|
176
|
+
isAutoincrement: false;
|
|
177
|
+
hasRuntimeDefault: false;
|
|
178
|
+
enumValues: [string, ...string[]];
|
|
179
|
+
baseColumn: never;
|
|
180
|
+
identity: undefined;
|
|
181
|
+
generated: undefined;
|
|
182
|
+
}, {}, {
|
|
183
|
+
length: number | undefined;
|
|
184
|
+
}>;
|
|
185
|
+
scope: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
186
|
+
name: "scope";
|
|
187
|
+
tableName: "user_scopes";
|
|
188
|
+
dataType: "string";
|
|
189
|
+
columnType: "SQLiteText";
|
|
190
|
+
data: string;
|
|
191
|
+
driverParam: string;
|
|
192
|
+
notNull: true;
|
|
193
|
+
hasDefault: false;
|
|
194
|
+
isPrimaryKey: false;
|
|
195
|
+
isAutoincrement: false;
|
|
196
|
+
hasRuntimeDefault: false;
|
|
197
|
+
enumValues: [string, ...string[]];
|
|
198
|
+
baseColumn: never;
|
|
199
|
+
identity: undefined;
|
|
200
|
+
generated: undefined;
|
|
201
|
+
}, {}, {
|
|
202
|
+
length: number | undefined;
|
|
203
|
+
}>;
|
|
204
|
+
resourceId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
205
|
+
name: "resource_id";
|
|
206
|
+
tableName: "user_scopes";
|
|
207
|
+
dataType: "string";
|
|
208
|
+
columnType: "SQLiteText";
|
|
209
|
+
data: string;
|
|
210
|
+
driverParam: string;
|
|
211
|
+
notNull: false;
|
|
212
|
+
hasDefault: false;
|
|
213
|
+
isPrimaryKey: false;
|
|
214
|
+
isAutoincrement: false;
|
|
215
|
+
hasRuntimeDefault: false;
|
|
216
|
+
enumValues: [string, ...string[]];
|
|
217
|
+
baseColumn: never;
|
|
218
|
+
identity: undefined;
|
|
219
|
+
generated: undefined;
|
|
220
|
+
}, {}, {
|
|
221
|
+
length: number | undefined;
|
|
222
|
+
}>;
|
|
223
|
+
id: _packages_backend_sdk.IsPrimaryKey<_packages_backend_sdk.NotNull<_packages_backend_sdk.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
|
|
224
|
+
createdAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"created_at">>;
|
|
225
|
+
createdBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"created_by", [string, ...string[]], number | undefined>;
|
|
226
|
+
updatedAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"updated_at">>>;
|
|
227
|
+
updatedBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"updated_by", [string, ...string[]], number | undefined>;
|
|
228
|
+
deletedAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"deleted_at">>;
|
|
229
|
+
deletedBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"deleted_by", [string, ...string[]], number | undefined>;
|
|
230
|
+
};
|
|
231
|
+
dialect: "sqlite";
|
|
232
|
+
}>;
|
|
233
|
+
|
|
234
|
+
declare const schema_role: typeof role;
|
|
235
|
+
declare const schema_roleScope: typeof roleScope;
|
|
236
|
+
declare const schema_userRole: typeof userRole;
|
|
237
|
+
declare const schema_userScope: typeof userScope;
|
|
238
|
+
declare namespace schema {
|
|
239
|
+
export {
|
|
240
|
+
schema_role as role,
|
|
241
|
+
schema_roleScope as roleScope,
|
|
242
|
+
schema_userRole as userRole,
|
|
243
|
+
schema_userScope as userScope,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export { roleScope as a, userScope as b, role as r, schema as s, userRole as u };
|