@checkstack/infrastructure-common 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 +32 -0
- package/package.json +29 -0
- package/src/index.ts +7 -0
- package/src/plugin-metadata.ts +9 -0
- package/src/routes.ts +8 -0
- package/src/tabs.ts +62 -0
- package/tsconfig.json +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @checkstack/infrastructure-common
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8d1ef12: ## Infrastructure Configuration Shell & Cache System
|
|
8
|
+
|
|
9
|
+
### New Packages
|
|
10
|
+
|
|
11
|
+
- **`@checkstack/cache-api`**: Core cache abstractions — `CacheProvider` interface, `createScopedCache` factory for plugin key isolation, `CachePlugin`/`CacheManager` lifecycle interfaces.
|
|
12
|
+
- **`@checkstack/cache-common`**: Shared cache types, RPC contract (`getPlugins`, `getConfiguration`, `updateConfiguration`), access rules, and plugin metadata.
|
|
13
|
+
- **`@checkstack/cache-backend`**: Cache settings RPC router — exposes plugin discovery, configuration read/write endpoints with access-gated authorization.
|
|
14
|
+
- **`@checkstack/cache-frontend`**: Cache configuration tab component for the Infrastructure Settings page.
|
|
15
|
+
- **`@checkstack/infrastructure-common`**: Infrastructure tab registry, routes, and shared types for the IDE-style configuration shell.
|
|
16
|
+
- **`@checkstack/infrastructure-frontend`**: Infrastructure Settings page with vertical tab bar, per-tab access control, and user menu integration.
|
|
17
|
+
|
|
18
|
+
### Modified Packages
|
|
19
|
+
|
|
20
|
+
- **`@checkstack/backend-api`**: Added `cachePluginRegistry` and `cacheManager` to `RpcContext` and `coreServices`.
|
|
21
|
+
- **`@checkstack/backend`**: Registered cache services in boot sequence, added cache config loading, extended dependency sorter for cache plugin ordering.
|
|
22
|
+
- **`@checkstack/queue-frontend`**: Refactored from standalone `/queue/config` route to an infrastructure tab. Queue settings now live inside the Infrastructure Settings page.
|
|
23
|
+
|
|
24
|
+
### Architecture
|
|
25
|
+
|
|
26
|
+
The former monolithic Queue Config page is replaced by a pluggable Infrastructure Settings shell (`/infrastructure/config`). Plugins register configuration tabs via `registerInfrastructureTab()` with their own access rules, icons, and components. The shell evaluates per-tab access and only renders tabs the user can see.
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [8d1ef12]
|
|
31
|
+
- @checkstack/common@0.7.0
|
|
32
|
+
- @checkstack/frontend-api@0.3.11
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@checkstack/infrastructure-common",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": "./src/index.ts"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"typecheck": "tsc --noEmit",
|
|
12
|
+
"lint": "bun run lint:code",
|
|
13
|
+
"lint:code": "eslint . --max-warnings 0"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@checkstack/common": "0.6.5",
|
|
17
|
+
"@checkstack/frontend-api": "0.3.10"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.7.2",
|
|
21
|
+
"@checkstack/tsconfig": "0.0.5",
|
|
22
|
+
"@checkstack/scripts": "0.1.2",
|
|
23
|
+
"@types/react": "^18.3.18",
|
|
24
|
+
"react": "^18.3.1"
|
|
25
|
+
},
|
|
26
|
+
"checkstack": {
|
|
27
|
+
"type": "common"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { definePluginMetadata } from "@checkstack/common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plugin metadata for the infrastructure plugin.
|
|
5
|
+
* This is the single source of truth for the plugin ID.
|
|
6
|
+
*/
|
|
7
|
+
export const pluginMetadata = definePluginMetadata({
|
|
8
|
+
pluginId: "infrastructure",
|
|
9
|
+
});
|
package/src/routes.ts
ADDED
package/src/tabs.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { AccessRule } from "@checkstack/common";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tab registration for the Infrastructure Configuration page.
|
|
6
|
+
*
|
|
7
|
+
* Each infrastructure concern (Queue, Cache, etc.) registers a tab
|
|
8
|
+
* with its own access rules, icon, and component.
|
|
9
|
+
*
|
|
10
|
+
* The shell page evaluates user access per tab and only shows
|
|
11
|
+
* tabs the user can read. If no tabs are visible, it shows "not authorized".
|
|
12
|
+
*/
|
|
13
|
+
export interface InfrastructureTab {
|
|
14
|
+
/** Unique tab ID (e.g., "queue", "cache") */
|
|
15
|
+
id: string;
|
|
16
|
+
|
|
17
|
+
/** Plugin ID that registers this tab (e.g., "queue", "cache") */
|
|
18
|
+
pluginId: string;
|
|
19
|
+
|
|
20
|
+
/** Tab display label */
|
|
21
|
+
label: string;
|
|
22
|
+
|
|
23
|
+
/** Tab icon component */
|
|
24
|
+
icon: React.ComponentType<{ className?: string }>;
|
|
25
|
+
|
|
26
|
+
/** The tab content component */
|
|
27
|
+
component: React.ComponentType<{ canUpdate: boolean }>;
|
|
28
|
+
|
|
29
|
+
/** Access rule required to view this tab */
|
|
30
|
+
readAccess: AccessRule;
|
|
31
|
+
|
|
32
|
+
/** Access rule required to modify settings in this tab */
|
|
33
|
+
manageAccess: AccessRule;
|
|
34
|
+
|
|
35
|
+
/** Sort order — lower numbers appear first */
|
|
36
|
+
order?: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Global tab registry for Infrastructure Configuration.
|
|
41
|
+
*
|
|
42
|
+
* Plugins register their tabs here during frontend plugin initialization.
|
|
43
|
+
* The infrastructure page reads from this registry to build its tab bar.
|
|
44
|
+
*
|
|
45
|
+
* This is a simple module-level registry — no React context needed
|
|
46
|
+
* since tabs are registered at module load time (during eager plugin loading).
|
|
47
|
+
*/
|
|
48
|
+
const tabs: InfrastructureTab[] = [];
|
|
49
|
+
|
|
50
|
+
export function registerInfrastructureTab(tab: InfrastructureTab): void {
|
|
51
|
+
// Prevent duplicate registration
|
|
52
|
+
if (tabs.some((t) => t.id === tab.id)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
tabs.push(tab);
|
|
56
|
+
// Keep sorted by order
|
|
57
|
+
tabs.sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function getInfrastructureTabs(): readonly InfrastructureTab[] {
|
|
61
|
+
return tabs;
|
|
62
|
+
}
|