Skip to content

Commit dc56a6c

Browse files
committed
Initial commit of RBAC split setup
1 parent fefe61f commit dc56a6c

10 files changed

Lines changed: 128 additions & 1 deletion

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "@trigger.dev/rbac",
3+
"private": true,
4+
"version": "0.0.1",
5+
"main": "./dist/index.js",
6+
"types": "./dist/index.d.ts",
7+
"dependencies": {
8+
"@trigger.dev/plugins": "workspace:*"
9+
},
10+
"devDependencies": {
11+
"@types/node": "^20.14.14",
12+
"rimraf": "6.0.1"
13+
},
14+
"scripts": {
15+
"clean": "rimraf dist",
16+
"typecheck": "tsc --noEmit",
17+
"build": "pnpm run clean && tsc --noEmit false --outDir dist --declaration",
18+
"dev": "tsc --noEmit false --outDir dist --declaration --watch"
19+
}
20+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { RBACPlugin } from "@trigger.dev/plugins";
2+
3+
export function create(): RBACPlugin {
4+
return {
5+
type: "rbac",
6+
};
7+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { RBACPlugin } from "@trigger.dev/plugins";
2+
3+
export type { RBACPlugin };
4+
5+
type PluginModule = {
6+
create(): RBACPlugin | Promise<RBACPlugin>;
7+
};
8+
9+
export async function createRBACPlugin(): Promise<RBACPlugin> {
10+
try {
11+
// Installed in cloud deployments; absent in OSS
12+
// eslint-disable-next-line @typescript-eslint/no-require-imports
13+
const { create } = require("@triggerdotdev/plugin-rbac") as PluginModule;
14+
return create();
15+
} catch {
16+
// eslint-disable-next-line @typescript-eslint/no-require-imports
17+
const { create } = require("./fallback") as PluginModule;
18+
return create();
19+
}
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"esModuleInterop": true,
4+
"forceConsistentCasingInFileNames": true,
5+
"isolatedModules": true,
6+
"moduleResolution": "node",
7+
"preserveWatchOutput": true,
8+
"skipLibCheck": true,
9+
"noEmit": true,
10+
"strict": true
11+
},
12+
"exclude": ["node_modules"]
13+
}

packages/plugins/package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@trigger.dev/plugins",
3+
"version": "4.4.4",
4+
"description": "Plugin contracts and interfaces for Trigger.dev",
5+
"license": "MIT",
6+
"publishConfig": {
7+
"access": "public"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/triggerdotdev/trigger.dev",
12+
"directory": "packages/plugins"
13+
},
14+
"type": "module",
15+
"files": [
16+
"dist"
17+
],
18+
"scripts": {
19+
"clean": "rimraf dist .turbo",
20+
"build": "tsup",
21+
"dev": "tsup --watch --onSuccess 'yalc push --no-sig || true'",
22+
"typecheck": "tsc --noEmit"
23+
},
24+
"devDependencies": {
25+
"@types/node": "^20.14.14",
26+
"rimraf": "6.0.1",
27+
"tsup": "^8.4.0",
28+
"typescript": "^5.3.0"
29+
},
30+
"engines": {
31+
"node": ">=18.20.0"
32+
},
33+
"main": "./dist/index.cjs",
34+
"module": "./dist/index.js",
35+
"types": "./dist/index.d.ts",
36+
"exports": {
37+
".": {
38+
"types": "./dist/index.d.ts",
39+
"import": "./dist/index.js",
40+
"require": "./dist/index.cjs"
41+
}
42+
}
43+
}

packages/plugins/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type { RBACPlugin } from "./rbac.js";

packages/plugins/src/rbac.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface RBACPlugin {
2+
readonly type: "rbac";
3+
}

packages/plugins/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../../.configs/tsconfig.base.json",
3+
"compilerOptions": {
4+
"composite": true,
5+
"isolatedDeclarations": false,
6+
"sourceMap": true
7+
},
8+
"include": ["./src/**/*.ts"]
9+
}

packages/plugins/tsup.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from "tsup";
2+
3+
export default defineConfig({
4+
entry: ["src/index.ts"],
5+
format: ["cjs", "esm"],
6+
dts: true,
7+
splitting: false,
8+
sourcemap: true,
9+
clean: true,
10+
treeshake: true,
11+
});

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)