@checkstack/auth-backend 0.0.2

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 ADDED
@@ -0,0 +1,142 @@
1
+ # @checkstack/auth-backend
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - d20d274: Initial release of all @checkstack packages. Rebranded from Checkmate to Checkstack with new npm organization @checkstack and domain checkstack.dev.
8
+ - Updated dependencies [d20d274]
9
+ - @checkstack/auth-common@0.0.2
10
+ - @checkstack/backend-api@0.0.2
11
+ - @checkstack/command-backend@0.0.2
12
+ - @checkstack/common@0.0.2
13
+ - @checkstack/notification-common@0.0.2
14
+
15
+ ## 1.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - a65e002: Add command palette commands and deep-linking support
20
+
21
+ **Backend Changes:**
22
+
23
+ - `healthcheck-backend`: Add "Manage Health Checks" (⇧⌘H) and "Create Health Check" commands
24
+ - `catalog-backend`: Add "Manage Systems" (⇧⌘S) and "Create System" commands
25
+ - `integration-backend`: Add "Manage Integrations" (⇧⌘G), "Create Integration Subscription", and "View Integration Logs" commands
26
+ - `auth-backend`: Add "Manage Users" (⇧⌘U), "Create User", "Manage Roles", and "Manage Applications" commands
27
+ - `command-backend`: Auto-cleanup command registrations when plugins are deregistered
28
+
29
+ **Frontend Changes:**
30
+
31
+ - `HealthCheckConfigPage`: Handle `?action=create` URL parameter
32
+ - `CatalogConfigPage`: Handle `?action=create` URL parameter
33
+ - `IntegrationsPage`: Handle `?action=create` URL parameter
34
+ - `AuthSettingsPage`: Handle `?tab=` and `?action=create` URL parameters
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies [b4eb432]
39
+ - Updated dependencies [a65e002]
40
+ - Updated dependencies [a65e002]
41
+ - @checkstack/backend-api@1.1.0
42
+ - @checkstack/common@0.2.0
43
+ - @checkstack/command-backend@0.1.0
44
+ - @checkstack/auth-common@0.2.1
45
+ - @checkstack/notification-common@0.1.1
46
+
47
+ ## 1.0.1
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [e26c08e]
52
+ - @checkstack/auth-common@0.2.0
53
+
54
+ ## 1.0.0
55
+
56
+ ### Major Changes
57
+
58
+ - 8e889b4: Add consumer group support to Queue API for distributed event system. BREAKING: consume() now requires ConsumeOptions with consumerGroup parameter.
59
+
60
+ ### Minor Changes
61
+
62
+ - ffc28f6: ### Anonymous Role and Public Access
63
+
64
+ Introduces a configurable "anonymous" role for managing permissions available to unauthenticated users.
65
+
66
+ **Core Changes:**
67
+
68
+ - Added `userType: "public"` - endpoints accessible by both authenticated users (with their permissions) and anonymous users (with anonymous role permissions)
69
+ - Renamed `userType: "both"` to `"authenticated"` for clarity
70
+ - Renamed `isDefault` to `isAuthenticatedDefault` on Permission interface
71
+ - Added `isPublicDefault` flag for permissions that should be granted to the anonymous role by default
72
+
73
+ **Backend Infrastructure:**
74
+
75
+ - New `anonymous` system role created during auth-backend initialization
76
+ - New `disabled_public_default_permission` table tracks admin-disabled public defaults
77
+ - `autoAuthMiddleware` now checks anonymous role permissions for unauthenticated public endpoint access
78
+ - `AuthService.getAnonymousPermissions()` with 1-minute caching for performance
79
+ - Anonymous role filtered from `getRoles` endpoint (not assignable to users)
80
+ - Validation prevents assigning anonymous role to users
81
+
82
+ **Catalog Integration:**
83
+
84
+ - `catalog.read` permission now has both `isAuthenticatedDefault` and `isPublicDefault`
85
+ - Read endpoints (`getSystems`, `getGroups`, `getEntities`) now use `userType: "public"`
86
+
87
+ **UI:**
88
+
89
+ - New `PermissionGate` component for conditionally rendering content based on permissions
90
+
91
+ - 32f2535: Refactor application role assignment
92
+
93
+ - Removed role selection from the application creation dialog
94
+ - New applications now automatically receive the "Applications" role
95
+ - Roles are now manageable inline in the Applications table (similar to user role management)
96
+ - Added informational alert in create dialog explaining default role behavior
97
+
98
+ - b354ab3: # Strategy Instructions Support & Telegram Notification Plugin
99
+
100
+ ## Strategy Instructions Interface
101
+
102
+ Added `adminInstructions` and `userInstructions` optional fields to the `NotificationStrategy` interface. These allow strategies to export markdown-formatted setup guides that are displayed in the configuration UI:
103
+
104
+ - **`adminInstructions`**: Shown when admins configure platform-wide strategy settings (e.g., how to create API keys)
105
+ - **`userInstructions`**: Shown when users configure their personal settings (e.g., how to link their account)
106
+
107
+ ### Updated Components
108
+
109
+ - `StrategyConfigCard` now accepts an `instructions` prop and renders it before config sections
110
+ - `StrategyCard` passes `adminInstructions` to `StrategyConfigCard`
111
+ - `UserChannelCard` renders `userInstructions` when users need to connect
112
+
113
+ ## New Telegram Notification Plugin
114
+
115
+ Added `@checkstack/notification-telegram-backend` plugin for sending notifications via Telegram:
116
+
117
+ - Uses [grammY](https://grammy.dev/) framework for Telegram Bot API integration
118
+ - Sends messages with MarkdownV2 formatting and inline keyboard buttons for actions
119
+ - Includes comprehensive admin instructions for bot setup via @BotFather
120
+ - Includes user instructions for account linking
121
+
122
+ ### Configuration
123
+
124
+ Admins need to configure a Telegram Bot Token obtained from @BotFather.
125
+
126
+ ### User Linking
127
+
128
+ The strategy uses `contactResolution: { type: "custom" }` for Telegram Login Widget integration. Full frontend integration for the Login Widget is pending future work.
129
+
130
+ ### Patch Changes
131
+
132
+ - Updated dependencies [ffc28f6]
133
+ - Updated dependencies [71275dd]
134
+ - Updated dependencies [ae19ff6]
135
+ - Updated dependencies [32f2535]
136
+ - Updated dependencies [b55fae6]
137
+ - Updated dependencies [b354ab3]
138
+ - Updated dependencies [81f3f85]
139
+ - @checkstack/common@0.1.0
140
+ - @checkstack/backend-api@1.0.0
141
+ - @checkstack/auth-common@0.1.0
142
+ - @checkstack/notification-common@0.1.0
@@ -0,0 +1,90 @@
1
+ CREATE TABLE "account" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "account_id" text NOT NULL,
4
+ "provider_id" text NOT NULL,
5
+ "user_id" text NOT NULL,
6
+ "access_token" text,
7
+ "refresh_token" text,
8
+ "id_token" text,
9
+ "access_token_expires_at" timestamp,
10
+ "refresh_token_expires_at" timestamp,
11
+ "scope" text,
12
+ "password" text,
13
+ "created_at" timestamp NOT NULL,
14
+ "updated_at" timestamp NOT NULL
15
+ );
16
+ --> statement-breakpoint
17
+ CREATE TABLE "disabled_default_permission" (
18
+ "permission_id" text PRIMARY KEY NOT NULL,
19
+ "disabled_at" timestamp NOT NULL
20
+ );
21
+ --> statement-breakpoint
22
+ CREATE TABLE "disabled_public_default_permission" (
23
+ "permission_id" text PRIMARY KEY NOT NULL,
24
+ "disabled_at" timestamp NOT NULL
25
+ );
26
+ --> statement-breakpoint
27
+ CREATE TABLE "permission" (
28
+ "id" text PRIMARY KEY NOT NULL,
29
+ "description" text
30
+ );
31
+ --> statement-breakpoint
32
+ CREATE TABLE "role" (
33
+ "id" text PRIMARY KEY NOT NULL,
34
+ "name" text NOT NULL,
35
+ "description" text,
36
+ "is_system" boolean DEFAULT false
37
+ );
38
+ --> statement-breakpoint
39
+ CREATE TABLE "role_permission" (
40
+ "role_id" text NOT NULL,
41
+ "permission_id" text NOT NULL,
42
+ CONSTRAINT "role_permission_role_id_permission_id_pk" PRIMARY KEY("role_id","permission_id")
43
+ );
44
+ --> statement-breakpoint
45
+ CREATE TABLE "session" (
46
+ "id" text PRIMARY KEY NOT NULL,
47
+ "expires_at" timestamp NOT NULL,
48
+ "token" text NOT NULL,
49
+ "created_at" timestamp NOT NULL,
50
+ "updated_at" timestamp NOT NULL,
51
+ "ip_address" text,
52
+ "user_agent" text,
53
+ "user_id" text NOT NULL,
54
+ CONSTRAINT "session_token_unique" UNIQUE("token")
55
+ );
56
+ --> statement-breakpoint
57
+ CREATE TABLE "user" (
58
+ "id" text PRIMARY KEY NOT NULL,
59
+ "name" text NOT NULL,
60
+ "email" text NOT NULL,
61
+ "email_verified" boolean NOT NULL,
62
+ "image" text,
63
+ "created_at" timestamp NOT NULL,
64
+ "updated_at" timestamp NOT NULL,
65
+ CONSTRAINT "user_email_unique" UNIQUE("email")
66
+ );
67
+ --> statement-breakpoint
68
+ CREATE TABLE "user_role" (
69
+ "user_id" text NOT NULL,
70
+ "role_id" text NOT NULL,
71
+ CONSTRAINT "user_role_user_id_role_id_pk" PRIMARY KEY("user_id","role_id")
72
+ );
73
+ --> statement-breakpoint
74
+ CREATE TABLE "verification" (
75
+ "id" text PRIMARY KEY NOT NULL,
76
+ "identifier" text NOT NULL,
77
+ "value" text NOT NULL,
78
+ "expires_at" timestamp NOT NULL,
79
+ "created_at" timestamp,
80
+ "updated_at" timestamp
81
+ );
82
+ --> statement-breakpoint
83
+ ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
84
+ ALTER TABLE "disabled_default_permission" ADD CONSTRAINT "disabled_default_permission_permission_id_permission_id_fk" FOREIGN KEY ("permission_id") REFERENCES "permission"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
85
+ ALTER TABLE "disabled_public_default_permission" ADD CONSTRAINT "disabled_public_default_permission_permission_id_permission_id_fk" FOREIGN KEY ("permission_id") REFERENCES "permission"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
86
+ ALTER TABLE "role_permission" ADD CONSTRAINT "role_permission_role_id_role_id_fk" FOREIGN KEY ("role_id") REFERENCES "role"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
87
+ ALTER TABLE "role_permission" ADD CONSTRAINT "role_permission_permission_id_permission_id_fk" FOREIGN KEY ("permission_id") REFERENCES "permission"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
88
+ ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
89
+ ALTER TABLE "user_role" ADD CONSTRAINT "user_role_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
90
+ ALTER TABLE "user_role" ADD CONSTRAINT "user_role_role_id_role_id_fk" FOREIGN KEY ("role_id") REFERENCES "role"("id") ON DELETE no action ON UPDATE no action;
@@ -0,0 +1,20 @@
1
+ CREATE TABLE "application" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "name" text NOT NULL,
4
+ "description" text,
5
+ "secret_hash" text NOT NULL,
6
+ "created_by_id" text NOT NULL,
7
+ "created_at" timestamp DEFAULT now() NOT NULL,
8
+ "updated_at" timestamp DEFAULT now() NOT NULL,
9
+ "last_used_at" timestamp
10
+ );
11
+ --> statement-breakpoint
12
+ CREATE TABLE "application_role" (
13
+ "application_id" text NOT NULL,
14
+ "role_id" text NOT NULL,
15
+ CONSTRAINT "application_role_application_id_role_id_pk" PRIMARY KEY("application_id","role_id")
16
+ );
17
+ --> statement-breakpoint
18
+ ALTER TABLE "application" ADD CONSTRAINT "application_created_by_id_user_id_fk" FOREIGN KEY ("created_by_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
19
+ ALTER TABLE "application_role" ADD CONSTRAINT "application_role_application_id_application_id_fk" FOREIGN KEY ("application_id") REFERENCES "application"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
20
+ ALTER TABLE "application_role" ADD CONSTRAINT "application_role_role_id_role_id_fk" FOREIGN KEY ("role_id") REFERENCES "role"("id") ON DELETE no action ON UPDATE no action;