@develit-services/rbac 0.0.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.
- package/dist/@types.cjs +24 -0
- package/dist/@types.d.cts +27 -0
- package/dist/@types.d.mts +27 -0
- package/dist/@types.d.ts +27 -0
- package/dist/@types.mjs +2 -0
- package/dist/database/schema.cjs +12 -0
- package/dist/database/schema.d.cts +2 -0
- package/dist/database/schema.d.mts +2 -0
- package/dist/database/schema.d.ts +2 -0
- package/dist/database/schema.mjs +3 -0
- package/dist/export/worker.cjs +776 -0
- package/dist/export/worker.d.cts +36 -0
- package/dist/export/worker.d.mts +34 -0
- package/dist/export/worker.d.ts +36 -0
- package/dist/export/worker.mjs +771 -0
- package/dist/export/wrangler.cjs +48 -0
- package/dist/export/wrangler.d.cts +33 -0
- package/dist/export/wrangler.d.mts +33 -0
- package/dist/export/wrangler.d.ts +33 -0
- package/dist/export/wrangler.mjs +46 -0
- package/dist/shared/rbac.2EhZ2epo.cjs +363 -0
- package/dist/shared/rbac.BmuK3PNh.d.cts +499 -0
- package/dist/shared/rbac.BmuK3PNh.d.mts +499 -0
- package/dist/shared/rbac.BmuK3PNh.d.ts +499 -0
- package/dist/shared/rbac.C9brkvW9.mjs +344 -0
- package/dist/shared/rbac.CHxy3VJb.d.ts +1034 -0
- package/dist/shared/rbac.CJLU5iuV.mjs +45 -0
- package/dist/shared/rbac.CaoDccv4.d.cts +1034 -0
- package/dist/shared/rbac.ClMKyW8J.d.cts +20 -0
- package/dist/shared/rbac.ClMKyW8J.d.mts +20 -0
- package/dist/shared/rbac.ClMKyW8J.d.ts +20 -0
- package/dist/shared/rbac.Cra1T2nC.cjs +51 -0
- package/dist/shared/rbac.DH5084jg.d.mts +1034 -0
- package/package.json +59 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { base } from '@develit-io/backend-sdk';
|
|
2
|
+
import { sqliteTable, text, unique } from 'drizzle-orm/sqlite-core';
|
|
3
|
+
|
|
4
|
+
const role = sqliteTable("roles", {
|
|
5
|
+
...base,
|
|
6
|
+
name: text("name").notNull()
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const roleScope = sqliteTable("roles_scopes", {
|
|
10
|
+
...base,
|
|
11
|
+
roleId: text("role_id").notNull().references(() => role.id, { onDelete: "cascade" }),
|
|
12
|
+
scope: text("scope").notNull(),
|
|
13
|
+
resourceId: text("resource_id")
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const userRole = sqliteTable(
|
|
17
|
+
"user_roles",
|
|
18
|
+
{
|
|
19
|
+
...base,
|
|
20
|
+
userId: text("user_id").notNull(),
|
|
21
|
+
roleId: text("role_id").notNull().references(() => role.id, { onDelete: "cascade" })
|
|
22
|
+
},
|
|
23
|
+
(t) => [unique().on(t.userId, t.roleId)]
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const userScope = sqliteTable(
|
|
27
|
+
"user_scopes",
|
|
28
|
+
{
|
|
29
|
+
...base,
|
|
30
|
+
userId: text("user_id").notNull(),
|
|
31
|
+
scope: text("scope").notNull(),
|
|
32
|
+
resourceId: text("resource_id")
|
|
33
|
+
},
|
|
34
|
+
(t) => [unique().on(t.userId, t.scope)]
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const schema = {
|
|
38
|
+
__proto__: null,
|
|
39
|
+
role: role,
|
|
40
|
+
roleScope: roleScope,
|
|
41
|
+
userRole: userRole,
|
|
42
|
+
userScope: userScope
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { roleScope as a, userScope as b, role as r, schema as s, userRole as u };
|