feat: add clerk-helpers package
This commit is contained in:
parent
17d1bf065e
commit
e70d4d34c2
5 changed files with 36 additions and 0 deletions
3
packages/auth/helpers.ts
Normal file
3
packages/auth/helpers.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export function hasRole(userRoles: string[], role: string): boolean {
|
||||
return userRoles.includes(role);
|
||||
}
|
||||
2
packages/auth/index.ts
Normal file
2
packages/auth/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export * from "./roles";
|
||||
export * from "./helpers";
|
||||
12
packages/auth/package.json
Normal file
12
packages/auth/package.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "@repo/auth",
|
||||
"version": "0.0.0",
|
||||
"author": "Afiq Zudin Hadi",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"main": "index.ts",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"./indext.ts": "./index.ts"
|
||||
}
|
||||
}
|
||||
5
packages/auth/roles.ts
Normal file
5
packages/auth/roles.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export const ROLES = Object.freeze({
|
||||
SUPER_ADMIN: "super_admin",
|
||||
ADMIN: "admin",
|
||||
USER: "user",
|
||||
});
|
||||
14
packages/auth/tsconfig.json
Normal file
14
packages/auth/tsconfig.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"extends": "@repo/typescript-config/base.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "ES2015"],
|
||||
"sourceMap": true,
|
||||
"types": ["jest", "node"],
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@repo/auth/index.ts": ["./index.ts"]
|
||||
}
|
||||
},
|
||||
"include": [".", "src"],
|
||||
"exclude": ["dist", "build", "node_modules"]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue