@rebasepro/cli 0.29.3 → 0.30.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebasepro/cli",
3
- "version": "0.29.3",
3
+ "version": "0.30.0",
4
4
  "description": "Developer tools for Rebase projects",
5
5
  "keywords": [
6
6
  "cli",
@@ -44,13 +44,13 @@
44
44
  "inquirer": "14.0.2",
45
45
  "jiti": "^2.7.0",
46
46
  "pg": "^8.22.0",
47
- "@rebasepro/client": "0.29.3",
48
- "@rebasepro/agent-skills": "0.29.3",
49
- "@rebasepro/codegen": "0.29.3",
50
- "@rebasepro/rls-check": "0.29.3",
51
- "@rebasepro/server": "0.29.3",
52
- "@rebasepro/server-postgres": "0.29.3",
53
- "@rebasepro/types": "0.29.3"
47
+ "@rebasepro/agent-skills": "0.30.0",
48
+ "@rebasepro/client": "0.30.0",
49
+ "@rebasepro/server": "0.30.0",
50
+ "@rebasepro/codegen": "0.30.0",
51
+ "@rebasepro/types": "0.30.0",
52
+ "@rebasepro/rls-check": "0.30.0",
53
+ "@rebasepro/server-postgres": "0.30.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/node": "^26.1.2",
@@ -31,7 +31,8 @@ export const posts = pgTable("posts", {
31
31
  authorId: integer("author_id").references((): AnyPgColumn => authors.id, { onDelete: "set null" })
32
32
  }, (table) => ([
33
33
  index("posts_author_id_ix_00ad191").on(table.authorId.asc().nullsLast()),
34
- pgPolicy("posts_select_841c287", { as: "permissive", for: "select", to: ["public"], using: sql`true` }),
34
+ pgPolicy("posts_select_f2fe10c", { as: "permissive", for: "select", to: ["public"], using: sql`"public"."posts".status = 'published'` }),
35
+ pgPolicy("posts_select_6264b4d", { as: "permissive", for: "select", to: ["public"], using: sql`(SELECT string_to_array(rebase.roles(), ',') && ARRAY['editor'])` }),
35
36
  pgPolicy("posts_insert_3561e70_0", { as: "permissive", for: "insert", to: ["rebase_admin"], withCheck: sql`(SELECT string_to_array(rebase.roles(), ',') && ARRAY['admin'])` }),
36
37
  pgPolicy("posts_update_3561e70_1", { as: "permissive", for: "update", to: ["rebase_admin"], using: sql`(SELECT string_to_array(rebase.roles(), ',') && ARRAY['admin'])`, withCheck: sql`(SELECT string_to_array(rebase.roles(), ',') && ARRAY['admin'])` }),
37
38
  pgPolicy("posts_delete_3561e70_2", { as: "permissive", for: "delete", to: ["rebase_admin"], using: sql`(SELECT string_to_array(rebase.roles(), ',') && ARRAY['admin'])` }),
@@ -7,6 +7,25 @@ const postsCollection = defineCollection({
7
7
  singularName: "Post",
8
8
  slug: "posts",
9
9
  table: "posts",
10
+ // A post is readable once it is published, not before. Without rules of its
11
+ // own it would take `defaultSecurityRules` from index.ts, and every reader
12
+ // would see drafts — anonymous ones too, once AUTH_REQUIRE=false serves a
13
+ // public site from this backend.
14
+ securityRules: [
15
+ {
16
+ operation: "select",
17
+ using: "{status} = 'published'"
18
+ },
19
+ {
20
+ // Editors read drafts and posts in review; admins already read everything.
21
+ operation: "select",
22
+ roles: ["editor"]
23
+ },
24
+ {
25
+ operations: ["insert", "update", "delete"],
26
+ roles: ["admin"]
27
+ }
28
+ ],
10
29
  properties: {
11
30
  id: {
12
31
  name: "ID",