@omnibase/cli 0.0.1 → 0.1.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 (104) hide show
  1. package/dist/commands/auth.d.ts +6 -0
  2. package/dist/commands/auth.d.ts.map +1 -0
  3. package/dist/commands/auth.js +98 -0
  4. package/dist/commands/auth.js.map +1 -0
  5. package/dist/commands/cloud.d.ts +10 -0
  6. package/dist/commands/cloud.d.ts.map +1 -0
  7. package/dist/commands/cloud.js +435 -0
  8. package/dist/commands/cloud.js.map +1 -0
  9. package/dist/commands/db.d.ts +10 -0
  10. package/dist/commands/db.d.ts.map +1 -0
  11. package/dist/commands/db.js +373 -0
  12. package/dist/commands/db.js.map +1 -0
  13. package/dist/commands/email.d.ts +4 -0
  14. package/dist/commands/email.d.ts.map +1 -1
  15. package/dist/commands/email.js +59 -28
  16. package/dist/commands/email.js.map +1 -1
  17. package/dist/commands/environment.d.ts.map +1 -1
  18. package/dist/commands/environment.js +7 -52
  19. package/dist/commands/environment.js.map +1 -1
  20. package/dist/commands/migrate.d.ts +6 -0
  21. package/dist/commands/migrate.d.ts.map +1 -0
  22. package/dist/commands/migrate.js +204 -0
  23. package/dist/commands/migrate.js.map +1 -0
  24. package/dist/commands/permissions.d.ts +7 -17
  25. package/dist/commands/permissions.d.ts.map +1 -1
  26. package/dist/commands/permissions.js +133 -104
  27. package/dist/commands/permissions.js.map +1 -1
  28. package/dist/commands/restart.d.ts +3 -0
  29. package/dist/commands/restart.d.ts.map +1 -0
  30. package/dist/commands/restart.js +245 -0
  31. package/dist/commands/restart.js.map +1 -0
  32. package/dist/commands/stripe.d.ts +4 -0
  33. package/dist/commands/stripe.d.ts.map +1 -1
  34. package/dist/commands/stripe.js +150 -98
  35. package/dist/commands/stripe.js.map +1 -1
  36. package/dist/commands/sync.d.ts +3 -0
  37. package/dist/commands/sync.d.ts.map +1 -0
  38. package/dist/commands/sync.js +144 -0
  39. package/dist/commands/sync.js.map +1 -0
  40. package/dist/commands/workers.d.ts +3 -0
  41. package/dist/commands/workers.d.ts.map +1 -0
  42. package/dist/commands/workers.js +133 -0
  43. package/dist/commands/workers.js.map +1 -0
  44. package/dist/config/services.d.ts +19 -0
  45. package/dist/config/services.d.ts.map +1 -0
  46. package/dist/config/services.js +34 -0
  47. package/dist/config/services.js.map +1 -0
  48. package/dist/index.js +48 -32
  49. package/dist/index.js.map +1 -1
  50. package/dist/utils/api-client.d.ts +16 -0
  51. package/dist/utils/api-client.d.ts.map +1 -0
  52. package/dist/utils/api-client.js +66 -0
  53. package/dist/utils/api-client.js.map +1 -0
  54. package/dist/utils/context.d.ts +22 -0
  55. package/dist/utils/context.d.ts.map +1 -0
  56. package/dist/utils/context.js +30 -0
  57. package/dist/utils/context.js.map +1 -0
  58. package/dist/utils/credentials.d.ts +19 -0
  59. package/dist/utils/credentials.d.ts.map +1 -0
  60. package/dist/utils/credentials.js +77 -0
  61. package/dist/utils/credentials.js.map +1 -0
  62. package/dist/utils/environment.d.ts +14 -4
  63. package/dist/utils/environment.d.ts.map +1 -1
  64. package/dist/utils/environment.js +65 -21
  65. package/dist/utils/environment.js.map +1 -1
  66. package/dist/utils/errors.d.ts +3 -0
  67. package/dist/utils/errors.d.ts.map +1 -0
  68. package/dist/utils/errors.js +30 -0
  69. package/dist/utils/errors.js.map +1 -0
  70. package/dist/utils/logger.d.ts +14 -0
  71. package/dist/utils/logger.d.ts.map +1 -0
  72. package/dist/utils/logger.js +66 -0
  73. package/dist/utils/logger.js.map +1 -0
  74. package/docker/db/{001-seed.sql → 000001_seed.up.sql} +1 -0
  75. package/docker/db/{002-rls.sql → 000002_rls.up.sql} +53 -5
  76. package/docker/db/000003_keto.up.sql +1 -0
  77. package/docker/db/000005_neon_rls.up.sql +23 -0
  78. package/docker/db/000006_db_events.up.sql +28 -0
  79. package/docker/db/000007_add_rbac_system.up.sql +33 -0
  80. package/docker/db/000008_stripe_id_history.up.sql +2 -0
  81. package/docker/db/000009_not_null_fix.up.sql +15 -0
  82. package/docker/db/000010_add_role_templates.up.sql +29 -0
  83. package/docker/db/000011_add_subject_relations.up.sql +7 -0
  84. package/docker/docker-compose.dev.yml +40 -50
  85. package/docker/docker-compose.yml +82 -75
  86. package/docker/permissions/namespaces/2025-12-11T03:42:51.799Z-permissions.ts +101 -0
  87. package/package.json +12 -7
  88. package/templates/.omnibase-config +1 -1
  89. package/templates/db/README.md +91 -0
  90. package/templates/environments/.env.dev +8 -31
  91. package/templates/environments/.env.local +35 -0
  92. package/templates/environments/.env.prod +8 -9
  93. package/templates/environments/.env.staging +8 -9
  94. package/templates/permissions/roles.config.json +38 -0
  95. package/templates/permissions/tenants.ts +20 -12
  96. package/templates/{edge → workers}/package.json +1 -0
  97. package/templates/{edge → workers}/src/index.ts +3 -1
  98. package/docker/db/003-keto.sql +0 -1
  99. package/templates/edge/dev.ts +0 -13
  100. /package/docker/db/{004-email.sql → 000004_email.up.sql} +0 -0
  101. /package/templates/{stripe.config.json → payments/example.config.json} +0 -0
  102. /package/templates/{edge → workers}/bun.lock +0 -0
  103. /package/templates/{edge → workers}/tsconfig.json +0 -0
  104. /package/templates/{edge → workers}/wrangler.toml +0 -0
@@ -0,0 +1,101 @@
1
+
2
+
3
+ class Project implements Namespace {
4
+ related: {
5
+ tenant: Tenant[];
6
+ can_view_db_secret_key: User[];
7
+ can_rotate_keys: User[];
8
+ can_view_database_password: User[];
9
+ can_view_database_connection_string: User[];
10
+ can_view_postmark_server_token: User[];
11
+ can_view_api_service_key: User[];
12
+ };
13
+
14
+ permits = {
15
+ view_db_secret_key: (ctx: Context): boolean =>
16
+ this.related.can_view_db_secret_key.includes(ctx.subject) ||
17
+ this.related.tenant.traverse((t) =>
18
+ t.related.can_view_db_secret_key.includes(ctx.subject)
19
+ ),
20
+ rotate_keys: (ctx: Context): boolean =>
21
+ this.related.can_rotate_keys.includes(ctx.subject) ||
22
+ this.related.tenant.traverse((t) =>
23
+ t.related.can_rotate_keys.includes(ctx.subject)
24
+ ),
25
+ view_database_password: (ctx: Context): boolean =>
26
+ this.related.can_view_database_password.includes(ctx.subject) ||
27
+ this.related.tenant.traverse((t) =>
28
+ t.related.can_view_database_password.includes(ctx.subject)
29
+ ),
30
+ view_database_connection_string: (ctx: Context): boolean =>
31
+ this.related.can_view_database_connection_string.includes(ctx.subject) ||
32
+ this.related.tenant.traverse((t) =>
33
+ t.related.can_view_database_connection_string.includes(ctx.subject)
34
+ ),
35
+ view_postmark_server_token: (ctx: Context): boolean =>
36
+ this.related.can_view_postmark_server_token.includes(ctx.subject) ||
37
+ this.related.tenant.traverse((t) =>
38
+ t.related.can_view_postmark_server_token.includes(ctx.subject)
39
+ ),
40
+
41
+ view_api_service_key: (ctx: Context): boolean =>
42
+ this.related.can_view_api_service_key.includes(ctx.subject) ||
43
+ this.related.tenant.traverse((t) =>
44
+ t.related.can_view_api_service_key.includes(ctx.subject)
45
+ ),
46
+ };
47
+ }
48
+
49
+
50
+
51
+ class User implements Namespace {}
52
+
53
+ class Tenant implements Namespace {
54
+ related: {
55
+ can_delete_tenant: User[];
56
+ can_invite_user: User[];
57
+ can_update_user_role: User[];
58
+ can_update_user_role_to_owner: User[];
59
+ can_remove_owner_role: User[];
60
+ can_remove_user: User[];
61
+ can_view_users: User[];
62
+ can_view_db_secret_key: User[];
63
+ can_rotate_keys: User[];
64
+ can_view_database_password: User[];
65
+ can_view_database_connection_string: User[];
66
+ can_view_postmark_server_token: User[];
67
+ can_update_roles: User[];
68
+ can_view_api_service_key: User[];
69
+ };
70
+
71
+ permits = {
72
+ invite_user: (ctx: Context): boolean =>
73
+ this.related.can_invite_user.includes(ctx.subject),
74
+
75
+ delete_tenant: (ctx: Context): boolean =>
76
+ this.related.can_delete_tenant.includes(ctx.subject),
77
+
78
+ remove_user: (ctx: Context): boolean =>
79
+ this.related.can_remove_user.includes(ctx.subject),
80
+
81
+ update_user_role: (ctx: Context): boolean =>
82
+ this.related.can_update_user_role.includes(ctx.subject),
83
+
84
+ update_user_role_to_owner: (ctx: Context): boolean =>
85
+ this.related.can_update_user_role_to_owner.includes(ctx.subject),
86
+
87
+ remove_owner_role: (ctx: Context): boolean =>
88
+ this.related.can_remove_owner_role.includes(ctx.subject),
89
+
90
+ view_users: (ctx: Context): boolean =>
91
+ this.related.can_view_users.includes(ctx.subject),
92
+
93
+ view_db_secret_key: (ctx: Context): boolean =>
94
+ this.related.can_view_db_secret_key.includes(ctx.subject),
95
+
96
+ update_roles: (ctx: Context): boolean =>
97
+ this.related.can_update_roles.includes(ctx.subject),
98
+ };
99
+ }
100
+
101
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnibase/cli",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "OmniBase CLI - Manage Docker Compose services and environment configuration",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -26,16 +26,21 @@
26
26
  "author": "Phoenix Solutions Group",
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
+ "@inquirer/prompts": "^8.1.0",
30
+ "@ory/client": "^1.14.3",
31
+ "axios": "^1.6.0",
32
+ "chalk": "^5.6.2",
29
33
  "commander": "^11.1.0",
30
34
  "dotenv": "^16.3.1",
31
- "@ory/client": "^1.14.3",
32
- "adm-zip": "^0.5.10",
33
- "form-data": "^4.0.0"
35
+ "form-data": "^4.0.0",
36
+ "jszip": "^3.10.1",
37
+ "ora": "^9.0.0"
34
38
  },
35
39
  "devDependencies": {
40
+ "@types/bun": "latest",
36
41
  "@types/node": "^20.10.0",
37
42
  "ts-node": "^10.9.2",
38
- "typescript": "^5.3.3",
39
- "@types/bun": "latest"
40
- }
43
+ "typescript": "^5.3.3"
44
+ },
45
+ "gitHead": "17b762d0ff06555ba117734a9804286cbaaedc01"
41
46
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "version": "1.0.0",
3
- "defaultEnvironment": "dev"
3
+ "defaultEnvironment": "local"
4
4
  }
@@ -0,0 +1,91 @@
1
+ # Database Migrations
2
+
3
+ This directory contains SQL migration files that can be applied to your OmniBase database.
4
+
5
+ ## Quick Start
6
+
7
+ ### 1. Create a New Migration
8
+
9
+ ```bash
10
+ # Interactive mode (prompts for name)
11
+ omnibase db migrate new
12
+
13
+ # Or provide name directly
14
+ omnibase db migrate new --name create_users_table
15
+ ```
16
+
17
+ This creates a timestamped migration file like `1729507200_create_users_table.sql`.
18
+
19
+ ### 2. Edit the Migration File
20
+
21
+ Add your SQL commands to the generated file.
22
+
23
+ ### 3. Apply Migrations
24
+
25
+ ```bash
26
+ # Apply to default environment
27
+ omnibase db migrate apply
28
+
29
+ # Apply to specific environment
30
+ omnibase db migrate apply --env production
31
+ ```
32
+
33
+ ## File Naming Convention
34
+
35
+ Migration files are automatically named with timestamps when using `omnibase db migrate new`:
36
+ - `{TIMESTAMP}_{description}.sql` (e.g., `1729507200_create_users_table.sql`)
37
+
38
+ For manual creation, you can use simple numeric prefixes:
39
+ - `001-seed.sql`
40
+ - `002-rls.sql`
41
+ - `003-feature.sql`
42
+
43
+ All files will be automatically converted to golang-migrate format (`001_seed.up.sql`, etc.) when uploaded.
44
+
45
+ ## Commands
46
+
47
+ ### Create Migration
48
+
49
+ ```bash
50
+ # Interactive mode
51
+ omnibase db migrate new
52
+
53
+ # With name flag
54
+ omnibase db migrate new --name add_user_indexes
55
+
56
+ # Custom directory
57
+ omnibase db migrate new --dir custom/migrations --name init_schema
58
+ ```
59
+
60
+ ### Apply Migrations
61
+
62
+ ```bash
63
+ # Default directory (omnibase/db/)
64
+ omnibase db migrate push
65
+
66
+ # Specific environment
67
+ omnibase db migrate push --env prod
68
+ ```
69
+
70
+ ## Requirements
71
+
72
+ - The `OMNIBASE_API_KEY` must be set in your environment configuration (`.env.{environment}` file)
73
+ - The API server must be running and accessible
74
+ - Migration files must have a `.sql` extension
75
+
76
+ ## Example Migration File
77
+
78
+ When you run `omnibase db migrate new`, a file is created with this template:
79
+
80
+ **1729507200_create_users.sql:**
81
+ ```sql
82
+ -- Migration: create users
83
+ -- Created: 2024-10-21T10:00:00.000Z
84
+
85
+ -- Add your SQL migration here
86
+ -- Example:
87
+ -- CREATE TABLE IF NOT EXISTS users (
88
+ -- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
89
+ -- email TEXT NOT NULL UNIQUE,
90
+ -- created_at TIMESTAMP DEFAULT NOW()
91
+ -- );
@@ -1,35 +1,12 @@
1
- # API Configuration
2
- API_URL=http://localhost:8080
3
- OMNIBASE_API_KEY=your-api-key-here
1
+ # OmniBase API Configuration
2
+ OMNIBASE_API_URL=https://api.omnibase.io
3
+ OMNIBASE_SERVICE_KEY=your-service-key-here
4
+ OMNIBASE_PROJECT_ID=SOME-UUID
5
+
6
+ # Managed Hosting API (for cloud operations like worker deployment)
7
+ MANAGED_HOSTING_API_URL=https://api.omnibase.io
4
8
 
5
9
  # Required: Auth Configuration
6
- WEBSITE_URL=http://127.0.0.1:3000
10
+ WEBSITE_URL=https://your-app.com
7
11
  COOKIE_SECRET=PLEASE-CHANGE-ME-I-AM-VERY-INSECURE
8
12
  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
- STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
14
-
15
- # Optional: Uncomment and customize as needed
16
- # Auth URLs (defaults shown)
17
- # AUTH_LOG_LEVEL=info
18
- # AUTH_URL=http://127.0.0.1:4433
19
- # AUTH_ADMIN_URL=http://kratos:4434
20
-
21
- # Website Auth Flow URLs (all default to ${WEBSITE_URL}/auth/<flow>)
22
- # WEBSITE_AUTH_ERROR_URL=http://127.0.0.1:3000/auth/error
23
- # WEBSITE_SETTING_URL=http://127.0.0.1:3000/auth/settings
24
- # WEBSITE_RECOVERY_URL=http://127.0.0.1:3000/auth/recovery
25
- # WEBSITE_VERIFICATION_RECOVERY_URL=http://127.0.0.1:3000/auth/verification
26
- # WEBSITE_LOGIN_URL=http://127.0.0.1:3000/auth/login
27
- # WEBSITE_REGISTRATION_URL=http://127.0.0.1:3000/auth/registration
28
-
29
- # SMTP Configuration
30
- # SMTP_CONNECTION_URI=smtps://test:test@mailslurper:1025/?skip_ssl_verify=true
31
-
32
- # OIDC Provider Configuration
33
- # OIDC_GOOGLE_ENABLED=false
34
- # GOOGLE_CLIENT_ID=
35
- # GOOGLE_CLIENT_SECRET=
@@ -0,0 +1,35 @@
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
+ STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
14
+
15
+ # Optional: Uncomment and customize as needed
16
+ # Auth URLs (defaults shown)
17
+ # AUTH_LOG_LEVEL=info
18
+ # AUTH_URL=http://127.0.0.1:4433
19
+ # AUTH_ADMIN_URL=http://kratos:4434
20
+
21
+ # Website Auth Flow URLs (all default to ${WEBSITE_URL}/auth/<flow>)
22
+ # WEBSITE_AUTH_ERROR_URL=http://127.0.0.1:3000/auth/error
23
+ # WEBSITE_SETTING_URL=http://127.0.0.1:3000/auth/settings
24
+ # WEBSITE_RECOVERY_URL=http://127.0.0.1:3000/auth/recovery
25
+ # WEBSITE_VERIFICATION_RECOVERY_URL=http://127.0.0.1:3000/auth/verification
26
+ # WEBSITE_LOGIN_URL=http://127.0.0.1:3000/auth/login
27
+ # WEBSITE_REGISTRATION_URL=http://127.0.0.1:3000/auth/registration
28
+
29
+ # SMTP Configuration
30
+ # SMTP_CONNECTION_URI=smtps://test:test@mailslurper:1025/?skip_ssl_verify=true
31
+
32
+ # OIDC Provider Configuration
33
+ # OIDC_GOOGLE_ENABLED=false
34
+ # GOOGLE_CLIENT_ID=
35
+ # GOOGLE_CLIENT_SECRET=
@@ -1,13 +1,12 @@
1
- # API Configuration
2
- API_URL=https://api.omnibase.io
3
- OMNIBASE_API_KEY=your-api-key-here
1
+ # OmniBase API Configuration
2
+ OMNIBASE_API_URL=https://api.omnibase.io
3
+ OMNIBASE_SERVICE_KEY=your-service-key-here
4
+ OMNIBASE_PROJECT_ID=SOME-UUID
5
+
6
+ # Managed Hosting API (for cloud operations like worker deployment)
7
+ MANAGED_HOSTING_API_URL=https://api.omnibase.io
4
8
 
5
9
  # Required: Auth Configuration
6
10
  WEBSITE_URL=https://your-app.com
7
11
  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
- STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
12
+ CIPHER_SECRET=32-LONG-SECRET-NOT-SECURE-AT-ALL
@@ -1,13 +1,12 @@
1
- # API Configuration
2
- API_URL=https://staging.api.omnibase.io
3
- OMNIBASE_API_KEY=your-api-key-here
1
+ # OmniBase API Configuration
2
+ OMNIBASE_API_URL=https://staging.api.omnibase.io
3
+ OMNIBASE_SERVICE_KEY=your-service-key-here
4
+ OMNIBASE_PROJECT_ID=SOME-UUID
5
+
6
+ # Managed Hosting API (for cloud operations like worker deployment)
7
+ MANAGED_HOSTING_API_URL=https://staging.api.omnibase.io
4
8
 
5
9
  # Required: Auth Configuration
6
10
  WEBSITE_URL=https://staging.your-app.com
7
11
  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
- STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
12
+ CIPHER_SECRET=32-LONG-SECRET-NOT-SECURE-AT-ALL
@@ -0,0 +1,38 @@
1
+ {
2
+ "roles": [
3
+ {
4
+ "role": "owner",
5
+ "permissions": [
6
+ "tenant#can_delete_tenant",
7
+ "tenant#can_invite_user",
8
+ "tenant#can_remove_user",
9
+ "tenant#can_update_user_role",
10
+ "tenant#can_view_users",
11
+ "tenant#can_create_roles",
12
+ "tenant#can_update_roles",
13
+ "tenant#can_delete_roles"
14
+ ],
15
+ "immutable": true
16
+ },
17
+ {
18
+ "role": "admin",
19
+ "permissions": [
20
+ "tenant#can_invite_user",
21
+ "tenant#can_remove_user",
22
+ "tenant#can_update_user_role",
23
+ "tenant#can_view_users",
24
+ "tenant#can_create_roles",
25
+ "tenant#can_update_roles",
26
+ "tenant#can_delete_roles"
27
+ ],
28
+ "immutable": false
29
+ },
30
+ {
31
+ "role": "member",
32
+ "permissions": [
33
+ "tenant#can_view_users"
34
+ ],
35
+ "immutable": false
36
+ }
37
+ ]
38
+ }
@@ -4,31 +4,39 @@ class User implements Namespace {}
4
4
 
5
5
  class Tenant implements Namespace {
6
6
  related: {
7
- owners: User[];
8
- admins: User[];
9
- members: User[];
10
- can_invite_users: User[];
7
+ can_delete_tenant: User[];
8
+ can_invite_user: User[];
11
9
  can_update_user_role: User[];
12
10
  can_remove_user: User[];
11
+ can_view_users: User[];
12
+ can_create_roles: User[];
13
+ can_update_roles: User[]
14
+ can_delete_roles: User[]
13
15
  };
14
16
 
15
17
  permits = {
16
18
  invite_user: (ctx: Context): boolean =>
17
- this.related.owners.includes(ctx.subject) ||
18
- this.related.admins.includes(ctx.subject) ||
19
- this.related.can_invite_users.includes(ctx.subject),
19
+ this.related.can_invite_user.includes(ctx.subject),
20
20
 
21
21
  delete_tenant: (ctx: Context): boolean =>
22
- this.related.owners.includes(ctx.subject),
22
+ this.related.can_delete_tenant.includes(ctx.subject),
23
23
 
24
24
  remove_user: (ctx: Context): boolean =>
25
- this.related.owners.includes(ctx.subject) ||
26
- this.related.admins.includes(ctx.subject) ||
27
25
  this.related.can_remove_user.includes(ctx.subject),
28
26
 
29
27
  update_user_role: (ctx: Context): boolean =>
30
- this.related.owners.includes(ctx.subject) ||
31
- this.related.admins.includes(ctx.subject) ||
32
28
  this.related.can_update_user_role.includes(ctx.subject),
29
+
30
+ view_users: (ctx: Context): boolean =>
31
+ this.related.can_view_users.includes(ctx.subject),
32
+
33
+ create_roles: (ctx: Context): boolean =>
34
+ this.related.can_create_roles.includes(ctx.subject),
35
+
36
+ update_roles: (ctx: Context): boolean =>
37
+ this.related.can_update_roles.includes(ctx.subject),
38
+
39
+ delete_roles: (ctx: Context): boolean =>
40
+ this.related.can_delete_roles.includes(ctx.subject),
33
41
  };
34
42
  }
@@ -5,6 +5,7 @@
5
5
  "private": true,
6
6
  "scripts": {
7
7
  "dev": "bun run src/index.ts",
8
+ "build": "bun build src/index.ts --outfile dist/worker.js",
8
9
  "deploy": "wrangler deploy"
9
10
  },
10
11
  "devDependencies": {
@@ -23,4 +23,6 @@ app.get("/api/hello", (c) => {
23
23
  });
24
24
  });
25
25
 
26
- export default app;
26
+ export default {
27
+ fetch: app.fetch,
28
+ };
@@ -1 +0,0 @@
1
- CREATE SCHEMA IF NOT EXISTS keto
@@ -1,13 +0,0 @@
1
- import app from "./src/index";
2
-
3
- Bun.serve({
4
- port: parseInt(process.env.PORT || "8787", 10),
5
- fetch(req) {
6
- // Inject process.env as bindings to mimic Cloudflare Workers
7
- return app.fetch(req, process.env as any);
8
- },
9
- });
10
-
11
- console.log(
12
- `🚀 Edge functions running at http://localhost:${process.env.PORT || 8787}`
13
- );
File without changes
File without changes
File without changes