@checkstack/auth-backend 0.1.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,101 @@
1
1
  # @checkstack/auth-backend
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9faec1f: # Unified AccessRule Terminology Refactoring
8
+
9
+ This release completes a comprehensive terminology refactoring from "permission" to "accessRule" across the entire codebase, establishing a consistent and modern access control vocabulary.
10
+
11
+ ## Changes
12
+
13
+ ### Core Infrastructure (`@checkstack/common`)
14
+
15
+ - Introduced `AccessRule` interface as the primary access control type
16
+ - Added `accessPair()` helper for creating read/manage access rule pairs
17
+ - Added `access()` builder for individual access rules
18
+ - Replaced `Permission` type with `AccessRule` throughout
19
+
20
+ ### API Changes
21
+
22
+ - `env.registerPermissions()` → `env.registerAccessRules()`
23
+ - `meta.permissions` → `meta.access` in RPC contracts
24
+ - `usePermission()` → `useAccess()` in frontend hooks
25
+ - Route `permission:` field → `accessRule:` field
26
+
27
+ ### UI Changes
28
+
29
+ - "Roles & Permissions" tab → "Roles & Access Rules"
30
+ - "You don't have permission..." → "You don't have access..."
31
+ - All permission-related UI text updated
32
+
33
+ ### Documentation & Templates
34
+
35
+ - Updated 18 documentation files with AccessRule terminology
36
+ - Updated 7 scaffolding templates with `accessPair()` pattern
37
+ - All code examples use new AccessRule API
38
+
39
+ ## Migration Guide
40
+
41
+ ### Backend Plugins
42
+
43
+ ```diff
44
+ - import { permissionList } from "./permissions";
45
+ - env.registerPermissions(permissionList);
46
+ + import { accessRules } from "./access";
47
+ + env.registerAccessRules(accessRules);
48
+ ```
49
+
50
+ ### RPC Contracts
51
+
52
+ ```diff
53
+ - .meta({ userType: "user", permissions: [permissions.read.id] })
54
+ + .meta({ userType: "user", access: [access.read] })
55
+ ```
56
+
57
+ ### Frontend Hooks
58
+
59
+ ```diff
60
+ - const canRead = accessApi.usePermission(permissions.read.id);
61
+ + const canRead = accessApi.useAccess(access.read);
62
+ ```
63
+
64
+ ### Routes
65
+
66
+ ```diff
67
+ - permission: permissions.entityRead.id,
68
+ + accessRule: access.read,
69
+ ```
70
+
71
+ ### Patch Changes
72
+
73
+ - 95eeec7: # Auto-login after credential registration
74
+
75
+ Users are now automatically logged in after successful registration when using the credential (email & password) authentication strategy.
76
+
77
+ ## Changes
78
+
79
+ ### Backend (`@checkstack/auth-backend`)
80
+
81
+ - Added `autoSignIn: true` to the `emailAndPassword` configuration in better-auth
82
+ - Users no longer need to manually log in after registration; a session is created immediately upon successful sign-up
83
+
84
+ ### Frontend (`@checkstack/auth-frontend`)
85
+
86
+ - Updated `RegisterPage` to use full page navigation after registration to ensure the session state refreshes correctly
87
+ - Updated `LoginPage` to use full page navigation after login to ensure fresh permissions state when switching between users
88
+
89
+ - Updated dependencies [9faec1f]
90
+ - Updated dependencies [827b286]
91
+ - Updated dependencies [f533141]
92
+ - Updated dependencies [aa4a8ab]
93
+ - @checkstack/auth-common@0.2.0
94
+ - @checkstack/backend-api@0.3.0
95
+ - @checkstack/command-backend@0.1.0
96
+ - @checkstack/common@0.2.0
97
+ - @checkstack/notification-common@0.1.0
98
+
3
99
  ## 0.1.0
4
100
 
5
101
  ### Minor Changes
@@ -0,0 +1,21 @@
1
+ ALTER TABLE "permission" RENAME TO "access_rule";--> statement-breakpoint
2
+ ALTER TABLE "disabled_default_permission" RENAME TO "disabled_default_access_rule";--> statement-breakpoint
3
+ ALTER TABLE "disabled_public_default_permission" RENAME TO "disabled_public_default_access_rule";--> statement-breakpoint
4
+ ALTER TABLE "role_permission" RENAME TO "role_access_rule";--> statement-breakpoint
5
+ ALTER TABLE "disabled_default_access_rule" RENAME COLUMN "permission_id" TO "access_rule_id";--> statement-breakpoint
6
+ ALTER TABLE "disabled_public_default_access_rule" RENAME COLUMN "permission_id" TO "access_rule_id";--> statement-breakpoint
7
+ ALTER TABLE "role_access_rule" RENAME COLUMN "permission_id" TO "access_rule_id";--> statement-breakpoint
8
+ ALTER TABLE "disabled_default_access_rule" DROP CONSTRAINT "disabled_default_permission_permission_id_permission_id_fk";
9
+ --> statement-breakpoint
10
+ ALTER TABLE "disabled_public_default_access_rule" DROP CONSTRAINT "disabled_public_default_permission_permission_id_permission_id_fk";
11
+ --> statement-breakpoint
12
+ ALTER TABLE "role_access_rule" DROP CONSTRAINT "role_permission_role_id_role_id_fk";
13
+ --> statement-breakpoint
14
+ ALTER TABLE "role_access_rule" DROP CONSTRAINT "role_permission_permission_id_permission_id_fk";
15
+ --> statement-breakpoint
16
+ ALTER TABLE "role_access_rule" DROP CONSTRAINT "role_permission_role_id_permission_id_pk";--> statement-breakpoint
17
+ ALTER TABLE "role_access_rule" ADD CONSTRAINT "role_access_rule_role_id_access_rule_id_pk" PRIMARY KEY("role_id","access_rule_id");--> statement-breakpoint
18
+ ALTER TABLE "disabled_default_access_rule" ADD CONSTRAINT "disabled_default_access_rule_access_rule_id_access_rule_id_fk" FOREIGN KEY ("access_rule_id") REFERENCES "access_rule"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
19
+ ALTER TABLE "disabled_public_default_access_rule" ADD CONSTRAINT "disabled_public_default_access_rule_access_rule_id_access_rule_id_fk" FOREIGN KEY ("access_rule_id") REFERENCES "access_rule"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
20
+ ALTER TABLE "role_access_rule" ADD CONSTRAINT "role_access_rule_role_id_role_id_fk" FOREIGN KEY ("role_id") REFERENCES "role"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
21
+ ALTER TABLE "role_access_rule" ADD CONSTRAINT "role_access_rule_access_rule_id_access_rule_id_fk" FOREIGN KEY ("access_rule_id") REFERENCES "access_rule"("id") ON DELETE no action ON UPDATE no action;