@omnibase/cli 0.12.0 → 0.13.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.
Files changed (75) hide show
  1. package/dist/commands/auth.js +1 -1
  2. package/dist/commands/auth.js.map +1 -1
  3. package/dist/commands/cloud.d.ts +19 -0
  4. package/dist/commands/cloud.d.ts.map +1 -1
  5. package/dist/commands/cloud.js +129 -80
  6. package/dist/commands/cloud.js.map +1 -1
  7. package/dist/commands/docs.d.ts +3 -0
  8. package/dist/commands/docs.d.ts.map +1 -0
  9. package/dist/commands/docs.js +105 -0
  10. package/dist/commands/docs.js.map +1 -0
  11. package/dist/commands/permissions.d.ts.map +1 -1
  12. package/dist/commands/permissions.js +46 -4
  13. package/dist/commands/permissions.js.map +1 -1
  14. package/dist/commands/restart.d.ts.map +1 -1
  15. package/dist/commands/restart.js +6 -2
  16. package/dist/commands/restart.js.map +1 -1
  17. package/dist/commands/stripe.d.ts.map +1 -1
  18. package/dist/commands/stripe.js +141 -26
  19. package/dist/commands/stripe.js.map +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +235 -34
  22. package/dist/index.js.map +1 -1
  23. package/dist/services/docs/client.d.ts +28 -0
  24. package/dist/services/docs/client.d.ts.map +1 -0
  25. package/dist/services/docs/client.js +140 -0
  26. package/dist/services/docs/client.js.map +1 -0
  27. package/dist/utils/agent-files.d.ts +2 -0
  28. package/dist/utils/agent-files.d.ts.map +1 -0
  29. package/dist/utils/agent-files.js +70 -0
  30. package/dist/utils/agent-files.js.map +1 -0
  31. package/dist/utils/docker.d.ts +7 -1
  32. package/dist/utils/docker.d.ts.map +1 -1
  33. package/dist/utils/docker.js +45 -22
  34. package/dist/utils/docker.js.map +1 -1
  35. package/dist/utils/environment.d.ts +3 -0
  36. package/dist/utils/environment.d.ts.map +1 -1
  37. package/dist/utils/environment.js +24 -0
  38. package/dist/utils/environment.js.map +1 -1
  39. package/dist/utils/permission-namespaces.d.ts +33 -0
  40. package/dist/utils/permission-namespaces.d.ts.map +1 -0
  41. package/dist/utils/permission-namespaces.js +326 -0
  42. package/dist/utils/permission-namespaces.js.map +1 -0
  43. package/dist/utils/start-summary.d.ts +21 -0
  44. package/dist/utils/start-summary.d.ts.map +1 -0
  45. package/dist/utils/start-summary.js +55 -0
  46. package/dist/utils/start-summary.js.map +1 -0
  47. package/dist/utils/versions.d.ts +7 -0
  48. package/dist/utils/versions.d.ts.map +1 -0
  49. package/dist/utils/versions.js +64 -0
  50. package/dist/utils/versions.js.map +1 -0
  51. package/docker/db/000022_drop_stripe_id_mappings.down.sql +18 -0
  52. package/docker/db/000022_drop_stripe_id_mappings.up.sql +1 -0
  53. package/docker/db/000023_email_tenant_templates.down.sql +30 -0
  54. package/docker/db/000023_email_tenant_templates.up.sql +48 -0
  55. package/docker/db/000024_email_history.down.sql +1 -0
  56. package/docker/db/000024_email_history.up.sql +15 -0
  57. package/docker/db/000025_manage_billing.down.sql +4 -0
  58. package/docker/db/000025_manage_billing.up.sql +5 -0
  59. package/docker/db/000026_authenticated_role.down.sql +2 -0
  60. package/docker/db/000026_authenticated_role.up.sql +21 -0
  61. package/docker/db/000027_unique_active_tenant.down.sql +1 -0
  62. package/docker/db/000027_unique_active_tenant.up.sql +13 -0
  63. package/docker/db/000028_drop_enterprise_pricing.down.sql +7 -0
  64. package/docker/db/000028_drop_enterprise_pricing.up.sql +8 -0
  65. package/docker/docker-compose.base.yml +11 -6
  66. package/docker/docker-compose.dev.yml +4 -4
  67. package/package.json +5 -5
  68. package/templates/.env.example +36 -0
  69. package/templates/AGENTS.md +40 -0
  70. package/templates/CLAUDE.md +1 -0
  71. package/templates/omnibase.toml +1 -0
  72. package/templates/stripe/example.config.json +7 -1
  73. package/templates/permissions/storage.ts +0 -50
  74. package/templates/permissions/tenants.ts +0 -120
  75. package/templates/permissions/types.ts +0 -16
@@ -0,0 +1,2 @@
1
+ DROP OWNED BY authenticated;
2
+ DROP ROLE IF EXISTS authenticated;
@@ -0,0 +1,21 @@
1
+ DO $$ BEGIN
2
+ IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'authenticated') THEN
3
+ CREATE ROLE authenticated NOLOGIN NOBYPASSRLS;
4
+ END IF;
5
+ END $$;
6
+
7
+ GRANT anon_user TO authenticated;
8
+
9
+ GRANT USAGE ON SCHEMA public, auth, storage TO authenticated;
10
+ GRANT SELECT ON ALL TABLES IN SCHEMA public TO authenticated;
11
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO authenticated;
12
+
13
+ GRANT EXECUTE ON FUNCTION auth.active_user_role() TO authenticated;
14
+ GRANT EXECUTE ON FUNCTION auth.has_relation(text, text, text) TO authenticated;
15
+ GRANT EXECUTE ON FUNCTION auth.has_any_relation(text, text, text[]) TO authenticated;
16
+
17
+ DO $$ BEGIN
18
+ GRANT authenticated TO current_user;
19
+ EXCEPTION WHEN insufficient_privilege THEN
20
+ RAISE NOTICE 'Skipping GRANT authenticated to current_user';
21
+ END $$;
@@ -0,0 +1 @@
1
+ DROP INDEX IF EXISTS auth.tenant_users_one_active;
@@ -0,0 +1,13 @@
1
+ WITH ranked AS (
2
+ SELECT id, row_number() OVER (PARTITION BY user_id ORDER BY joined_at DESC) AS rn
3
+ FROM auth.tenant_users
4
+ WHERE is_active
5
+ )
6
+ UPDATE auth.tenant_users tu
7
+ SET is_active = false
8
+ FROM ranked
9
+ WHERE tu.id = ranked.id AND ranked.rn > 1;
10
+
11
+ CREATE UNIQUE INDEX IF NOT EXISTS tenant_users_one_active
12
+ ON auth.tenant_users(user_id)
13
+ WHERE is_active;
@@ -0,0 +1,7 @@
1
+ -- Migration: drop_enterprise_pricing
2
+
3
+ ALTER TABLE auth.tenants ADD COLUMN IF NOT EXISTS enterprise_template VARCHAR(255);
4
+ ALTER TABLE auth.tenants ADD COLUMN IF NOT EXISTS enterprise_id VARCHAR(255);
5
+
6
+ CREATE INDEX IF NOT EXISTS idx_tenants_enterprise_id ON auth.tenants(enterprise_id) WHERE enterprise_id IS NOT NULL;
7
+ CREATE INDEX IF NOT EXISTS idx_tenants_enterprise_template ON auth.tenants(enterprise_template) WHERE enterprise_template IS NOT NULL;
@@ -0,0 +1,8 @@
1
+ -- Migration: drop_enterprise_pricing
2
+ -- Enterprise pricing is replaced by direct Stripe proxy usage.
3
+
4
+ DROP INDEX IF EXISTS auth.idx_tenants_enterprise_id;
5
+ DROP INDEX IF EXISTS auth.idx_tenants_enterprise_template;
6
+
7
+ ALTER TABLE auth.tenants DROP COLUMN IF EXISTS enterprise_template;
8
+ ALTER TABLE auth.tenants DROP COLUMN IF EXISTS enterprise_id;
@@ -61,7 +61,7 @@ services:
61
61
  condition: service_healthy
62
62
 
63
63
  auth-migrate:
64
- image: phoenixsolutionsgroup/omnibase-auth:0.4.4
64
+ image: phoenixsolutionsgroup/omnibase-auth:latest
65
65
  environment:
66
66
  - DSN=postgres://postgres:postgres@postgres:5432/db?sslmode=disable&max_conns=20&max_idle_conns=4&search_path=auth
67
67
  - WAIT_FOR_API_HEALTH=true
@@ -81,7 +81,7 @@ services:
81
81
  - auth-migrate
82
82
  - rest-api
83
83
  - pgbouncer
84
- image: phoenixsolutionsgroup/omnibase-auth:0.4.4
84
+ image: phoenixsolutionsgroup/omnibase-auth:latest
85
85
  restart: unless-stopped
86
86
  env_file:
87
87
  - ${OMNIBASE_ENV_FILE}
@@ -212,7 +212,7 @@ services:
212
212
 
213
213
  # REST API Service
214
214
  rest-api:
215
- image: phoenixsolutionsgroup/omnibase-api:0.21.0
215
+ image: phoenixsolutionsgroup/omnibase-api:latest
216
216
  ports:
217
217
  - "8080:8080"
218
218
  depends_on:
@@ -249,7 +249,11 @@ services:
249
249
  # Email Configuration
250
250
  - SMTP_CONNECTION_URI=smtp://mailpit:1025
251
251
  - SMTP_FROM_EMAIL=noreply@yourapp.com
252
- - FRONTEND_URL=http://localhost:3000
252
+ - EMAIL_SEND_LIMIT=${EMAIL_SEND_LIMIT:-100}
253
+ - EMAIL_SEND_WINDOW=${EMAIL_SEND_WINDOW:-1h}
254
+ - FRONTEND_URL=${FRONTEND_URL:-http://localhost:3000}
255
+ - WEBSITE_URL=${WEBSITE_URL:-http://localhost:3000}
256
+ - INVITE_ALLOWED_ORIGINS=${INVITE_ALLOWED_ORIGINS:-}
253
257
 
254
258
  # JWT Configuration
255
259
  - JWT_SIGNING_KEY=${JWT_SIGNING_KEY:-your-secret-jwt-signing-key-change-this-in-production}
@@ -267,13 +271,14 @@ services:
267
271
  - STRIPE_PUBLISHABLE_KEY=${STRIPE_PUBLISHABLE_KEY}
268
272
  - STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
269
273
 
274
+ - ENV=${ENV:-development}
270
275
  - LOG_LEVEL=${LOG_LEVEL:-TRACE}
271
276
  - LOG_FORMAT=${LOG_FORMAT:-pretty}
272
277
 
273
278
  - CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS:-*}
274
279
 
275
280
  permissions-migrate:
276
- image: phoenixsolutionsgroup/omnibase-permissions:0.4.0
281
+ image: phoenixsolutionsgroup/omnibase-permissions:latest
277
282
  environment:
278
283
  - DSN=postgres://postgres:postgres@postgres:5432/db?sslmode=disable&max_conns=20&max_idle_conns=4&search_path=permissions
279
284
  command: migrate up -c /etc/config/permissions/permissions.yml --yes
@@ -291,7 +296,7 @@ services:
291
296
  depends_on:
292
297
  - permissions-migrate
293
298
  - pgbouncer
294
- image: phoenixsolutionsgroup/omnibase-permissions:0.4.0
299
+ image: phoenixsolutionsgroup/omnibase-permissions:latest
295
300
  restart: unless-stopped
296
301
  environment:
297
302
  - DSN=postgres://permissions:permissions@pgbouncer:6432/db?sslmode=disable&max_conns=20&max_idle_conns=4
@@ -42,14 +42,14 @@ services:
42
42
  permissions-migrate:
43
43
  image: ""
44
44
  build:
45
- context: ../../../docker/permissions
46
- dockerfile: Dockerfile
45
+ context: ../../..
46
+ dockerfile: docker/permissions/Dockerfile
47
47
 
48
48
  permissions:
49
49
  image: ""
50
50
  build:
51
- context: ../../../docker/permissions
52
- dockerfile: Dockerfile
51
+ context: ../../..
52
+ dockerfile: docker/permissions/Dockerfile
53
53
 
54
54
  volumes:
55
55
  postgres_data:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnibase/cli",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "OmniBase CLI - Manage Docker Compose services and environment configuration",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "dev": "NODE_ENV=development bun src/index.ts",
27
27
  "test": "bun test",
28
28
  "start": "node dist/index.js",
29
- "prepare": "npm run build"
29
+ "prepare": "bun run --cwd ../../sdk/core/js build && npm run build"
30
30
  },
31
31
  "keywords": [
32
32
  "cli",
@@ -38,7 +38,7 @@
38
38
  "license": "MIT",
39
39
  "dependencies": {
40
40
  "@inquirer/prompts": "^8.1.0",
41
- "@omnibase/core-js": "0.21.0",
41
+ "@omnibase/core-js": "0.23.0",
42
42
  "@ory/client": "^1.14.3",
43
43
  "adm-zip": "^0.5.16",
44
44
  "axios": "^1.6.0",
@@ -50,6 +50,7 @@
50
50
  "ora": "^9.0.0",
51
51
  "smol-toml": "^1.7.0",
52
52
  "tsx": "^4.19.0",
53
+ "typescript": "^5.3.3",
53
54
  "uuid": "^14.0.1"
54
55
  },
55
56
  "devDependencies": {
@@ -58,7 +59,6 @@
58
59
  "@types/bun": "latest",
59
60
  "@types/node": "^20.10.0",
60
61
  "@types/uuid": "^11.0.0",
61
- "ts-node": "^10.9.2",
62
- "typescript": "^5.3.3"
62
+ "ts-node": "^10.9.2"
63
63
  }
64
64
  }
@@ -0,0 +1,36 @@
1
+ # OmniBase API Configuration
2
+ OMNIBASE_API_URL=http://localhost:8080
3
+ OMNIBASE_SERVICE_KEY=VERY_SECRET_KEY
4
+
5
+ # Required: Auth Configuration
6
+ WEBSITE_URL=http://127.0.0.1:3000
7
+ COOKIE_SECRET=PLEASE-CHANGE-ME-I-AM-VERY-INSECURE
8
+ CIPHER_SECRET=32-LONG-SECRET-NOT-SECURE-AT-ALL
9
+
10
+ # Stripe Configuration (update with your keys)
11
+ STRIPE_SECRET_KEY=stripe-secret-key
12
+ STRIPE_PUBLISHABLE_KEY=stripe-publishable-key
13
+
14
+ # Optional: Uncomment and customize as needed
15
+ # Invite link origins (defaults to FRONTEND_URL, then WEBSITE_URL)
16
+ # INVITE_ALLOWED_ORIGINS=https://app.example.com,https://admin.example.com
17
+ # Auth URLs (defaults shown)
18
+ # AUTH_LOG_LEVEL=info
19
+ # AUTH_URL=http://127.0.0.1:4433
20
+ # AUTH_ADMIN_URL=http://kratos:4434
21
+
22
+ # Website Auth Flow URLs (all default to ${WEBSITE_URL}/auth/<flow>)
23
+ # WEBSITE_AUTH_ERROR_URL=http://127.0.0.1:3000/auth/error
24
+ # WEBSITE_SETTING_URL=http://127.0.0.1:3000/auth/settings
25
+ # WEBSITE_RECOVERY_URL=http://127.0.0.1:3000/auth/recovery
26
+ # WEBSITE_VERIFICATION_RECOVERY_URL=http://127.0.0.1:3000/auth/verification
27
+ # WEBSITE_LOGIN_URL=http://127.0.0.1:3000/auth/login
28
+ # WEBSITE_REGISTRATION_URL=http://127.0.0.1:3000/auth/registration
29
+
30
+ # SMTP Configuration
31
+ # SMTP_CONNECTION_URI=smtps://test:test@mailslurper:1025/?skip_ssl_verify=true
32
+
33
+ # OIDC Provider Configuration
34
+ # OIDC_GOOGLE_ENABLED=false
35
+ # GOOGLE_CLIENT_ID=
36
+ # GOOGLE_CLIENT_SECRET=
@@ -0,0 +1,40 @@
1
+ # OmniBase
2
+
3
+ This project uses OmniBase, an open-source backend for authentication, multi-tenancy, permissions, storage, payments, email, and edge workers.
4
+
5
+ ## What OmniBase offers
6
+
7
+ - **Auth** — sessions, identities, OIDC login, API keys, and tenant switching.
8
+ - **Multi-tenancy** — tenants, invitations, and tenant isolation.
9
+ - **Permissions** — role-based access control with relationship-based policies.
10
+ - **Database** — Postgres with a Prisma schema, SQL migrations, RLS, and type generation.
11
+ - **Storage** — S3-compatible uploads, downloads, and public objects. Paths are bucket-wide; prefix them with the tenant ID.
12
+ - **Payments** — Stripe checkout, invoices, subscriptions, metered usage, and customer portal.
13
+ - **Email** — templates and send APIs.
14
+ - **Workers** — Bun edge functions, cron jobs, and queues. The deployment `path` in `omnibase/omnibase.toml` points at the worker directory, which can be the whole application.
15
+ - **Managed hosting** — branches, domains, environment variables, and deploys through `omnibase cloud`.
16
+ - **SDKs** — `@omnibase/core-js`, `@omnibase/nextjs`, `@omnibase/react`, `@omnibase/shadcn`, and `@omnibase/mcp-server`.
17
+
18
+ ## Project layout
19
+
20
+ - `omnibase/omnibase.toml` — project and deployment configuration
21
+ - `omnibase/.env.local` — local secrets
22
+ - `omnibase/db/` — Prisma schema, migrations, and RLS policies
23
+ - `omnibase/permissions/` — RBAC namespaces
24
+ - `omnibase/email/` — email templates
25
+ - `omnibase/stripe/` — Stripe product configuration
26
+ - Application code — wherever the deployment `path` points in `omnibase/omnibase.toml`; this can be the whole project, not only a directory inside `omnibase/`.
27
+
28
+ ## Documentation
29
+
30
+ Do not guess OmniBase APIs or configuration. Query the current docs with the CLI:
31
+
32
+ ```bash
33
+ omnibase docs list # latest docs pages
34
+ omnibase docs search "storage upload" # ranked results with snippets
35
+ omnibase docs get guides/storage # full markdown page
36
+ omnibase docs get /api/latest/storage/uploadFile
37
+ omnibase docs search "tenant jwt" --json # agent-friendly output
38
+ ```
39
+
40
+ Results are cached for one hour; add `--refresh` to bypass the cache. Set `OMNIBASE_DOCS_URL` to use a different docs deployment.
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -28,6 +28,7 @@ path = "workers"
28
28
 
29
29
  # Pin the version of an OmniBase-built service. Omitted services use "latest".
30
30
  # Must be an exact published tag; checked against Docker Hub before applying.
31
+ # `omnibase init` pins the versions published at init time.
31
32
  # [versions]
32
33
  # auth = "0.4.1"
33
34
  # api = "0.20.3"
@@ -20,13 +20,19 @@
20
20
  "name": "Test Basic Plan",
21
21
  "description": "Basic test product",
22
22
  "type": "service",
23
+ "metadata": {
24
+ "tier": "basic"
25
+ },
23
26
  "prices": [
24
27
  {
25
28
  "id": "price_test_basic_monthly",
26
29
  "amount": 999,
27
30
  "currency": "usd",
28
31
  "interval": "month",
29
- "interval_count": 1
32
+ "interval_count": 1,
33
+ "metadata": {
34
+ "billing": "monthly"
35
+ }
30
36
  }
31
37
  ]
32
38
  }
@@ -1,50 +0,0 @@
1
- import { Tenant, User } from "./tenants";
2
- import { Context, Namespace } from "./types";
3
-
4
- export class StorageObject implements Namespace {
5
- related: {
6
- /**
7
- * @group Storage Objects
8
- * @displayName Owner
9
- * @hidden
10
- */
11
- owner: User[];
12
-
13
- /**
14
- * @group Storage Objects
15
- * @displayName Read Access
16
- */
17
- can_read: User[];
18
-
19
- /**
20
- * @group Storage Objects
21
- * @displayName Delete Access
22
- */
23
- can_delete: User[];
24
-
25
- /**
26
- * @group Storage Objects
27
- * @displayName Make Public
28
- */
29
- can_make_public: User[];
30
-
31
- /**
32
- * @hidden — parent link for OPL traversal
33
- */
34
- tenant: Tenant[];
35
- };
36
-
37
- permits = {
38
- read: (ctx: Context): boolean =>
39
- this.related.owner.includes(ctx.subject) ||
40
- this.related.can_read.includes(ctx.subject),
41
-
42
- delete: (ctx: Context): boolean =>
43
- this.related.owner.includes(ctx.subject) ||
44
- this.related.can_delete.includes(ctx.subject),
45
-
46
- make_public: (ctx: Context): boolean =>
47
- this.related.owner.includes(ctx.subject) ||
48
- this.related.can_make_public.includes(ctx.subject),
49
- };
50
- }
@@ -1,120 +0,0 @@
1
- import { Context, Namespace } from "./types";
2
-
3
- export class User implements Namespace {}
4
-
5
- export class Tenant implements Namespace {
6
- related: {
7
- /**
8
- * @group Tenant Administration
9
- * @displayName Delete Tenant
10
- * @role owner
11
- */
12
- can_delete_tenant: User[];
13
-
14
- /**
15
- * @group User Management
16
- * @displayName Invite Users
17
- * @role owner
18
- * @role admin
19
- */
20
- can_invite_user: User[];
21
-
22
- /**
23
- * @group User Management
24
- * @subGroup Role Assignment
25
- * @displayName Update User Roles
26
- * @role owner
27
- * @role admin
28
- */
29
- can_update_user_role: User[];
30
-
31
- /**
32
- * @group User Management
33
- * @subGroup Role Assignment
34
- * @displayName Promote to Owner
35
- * @role owner
36
- */
37
- can_update_user_role_to_owner: User[];
38
-
39
- /**
40
- * @group User Management
41
- * @subGroup Role Assignment
42
- * @displayName Demote Owner
43
- * @role owner
44
- */
45
- can_remove_owner_role: User[];
46
-
47
- /**
48
- * @group User Management
49
- * @displayName Remove Users
50
- * @role owner
51
- * @role admin
52
- */
53
- can_remove_user: User[];
54
-
55
- /**
56
- * @group User Management
57
- * @displayName View Users
58
- * @role owner
59
- * @role admin
60
- * @role member
61
- */
62
- can_view_users: User[];
63
-
64
- /**
65
- * @group Roles & Permissions
66
- * @displayName Create Roles
67
- * @role owner
68
- * @role admin
69
- */
70
- can_create_roles: User[];
71
-
72
- /**
73
- * @group Roles & Permissions
74
- * @displayName Update Roles
75
- * @role owner
76
- * @role admin
77
- */
78
- can_update_roles: User[];
79
-
80
- /**
81
- * @group Roles & Permissions
82
- * @displayName Delete Roles
83
- * @role owner
84
- * @role admin
85
- */
86
- can_delete_roles: User[];
87
- };
88
-
89
- permits = {
90
- invite_user: (ctx: Context): boolean =>
91
- this.related.can_invite_user.includes(ctx.subject),
92
-
93
- delete_tenant: (ctx: Context): boolean =>
94
- this.related.can_delete_tenant.includes(ctx.subject),
95
-
96
- remove_user: (ctx: Context): boolean =>
97
- this.related.can_remove_user.includes(ctx.subject),
98
-
99
- update_user_role: (ctx: Context): boolean =>
100
- this.related.can_update_user_role.includes(ctx.subject),
101
-
102
- update_user_role_to_owner: (ctx: Context): boolean =>
103
- this.related.can_update_user_role_to_owner.includes(ctx.subject),
104
-
105
- remove_owner_role: (ctx: Context): boolean =>
106
- this.related.can_remove_owner_role.includes(ctx.subject),
107
-
108
- view_users: (ctx: Context): boolean =>
109
- this.related.can_view_users.includes(ctx.subject),
110
-
111
- create_roles: (ctx: Context): boolean =>
112
- this.related.can_create_roles.includes(ctx.subject),
113
-
114
- update_roles: (ctx: Context): boolean =>
115
- this.related.can_update_roles.includes(ctx.subject),
116
-
117
- delete_roles: (ctx: Context): boolean =>
118
- this.related.can_delete_roles.includes(ctx.subject),
119
- };
120
- }
@@ -1,16 +0,0 @@
1
- export type Context = { subject: never };
2
-
3
- export interface Namespace {
4
- related?: { [relation: string]: Namespace[] };
5
- permits?: { [method: string]: (ctx: Context) => boolean };
6
- }
7
-
8
- export interface KetoArray extends Array<Namespace> {
9
- includes(element: Namespace): boolean;
10
- traverse(iteratorfn: (element: Namespace) => boolean): boolean;
11
- }
12
-
13
- export type SubjectSet<
14
- A extends Namespace,
15
- R extends keyof A["related"]
16
- > = A["related"][R] extends Array<infer T> ? T : never;