@checkstack/cache-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 +31 -0
- package/package.json +28 -0
- package/src/access.ts +22 -0
- package/src/index.ts +4 -0
- package/src/plugin-metadata.ts +9 -0
- package/src/rpc-contract.ts +43 -0
- package/src/schemas.ts +38 -0
- package/tsconfig.json +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @checkstack/cache-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
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@checkstack/cache-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
|
+
"@orpc/contract": "^1.13.14",
|
|
18
|
+
"zod": "^4.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "^5.7.2",
|
|
22
|
+
"@checkstack/tsconfig": "0.0.5",
|
|
23
|
+
"@checkstack/scripts": "0.1.2"
|
|
24
|
+
},
|
|
25
|
+
"checkstack": {
|
|
26
|
+
"type": "common"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/access.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { accessPair } from "@checkstack/common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Access rules for the Cache plugin.
|
|
5
|
+
*/
|
|
6
|
+
export const cacheAccess = {
|
|
7
|
+
/**
|
|
8
|
+
* Cache settings access.
|
|
9
|
+
*/
|
|
10
|
+
settings: accessPair("cache", {
|
|
11
|
+
read: { description: "Read Cache Settings" },
|
|
12
|
+
manage: { description: "Update Cache Settings" },
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* All access rules for registration with the plugin system.
|
|
18
|
+
*/
|
|
19
|
+
export const cacheAccessRules = [
|
|
20
|
+
cacheAccess.settings.read,
|
|
21
|
+
cacheAccess.settings.manage,
|
|
22
|
+
];
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { definePluginMetadata } from "@checkstack/common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plugin metadata for the cache plugin.
|
|
5
|
+
* Exported from the common package so both backend and frontend can reference it.
|
|
6
|
+
*/
|
|
7
|
+
export const pluginMetadata = definePluginMetadata({
|
|
8
|
+
pluginId: "cache",
|
|
9
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createClientDefinition, proc } from "@checkstack/common";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { cacheAccess } from "./access";
|
|
4
|
+
import { pluginMetadata } from "./plugin-metadata";
|
|
5
|
+
import {
|
|
6
|
+
CachePluginDtoSchema,
|
|
7
|
+
CacheConfigurationDtoSchema,
|
|
8
|
+
UpdateCacheConfigurationSchema,
|
|
9
|
+
} from "./schemas";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Cache RPC Contract with access metadata.
|
|
13
|
+
* Mirrors queue contract structure.
|
|
14
|
+
*/
|
|
15
|
+
export const cacheContract = {
|
|
16
|
+
// Cache plugin queries - Read access
|
|
17
|
+
getPlugins: proc({
|
|
18
|
+
operationType: "query",
|
|
19
|
+
userType: "authenticated",
|
|
20
|
+
access: [cacheAccess.settings.read],
|
|
21
|
+
}).output(z.array(CachePluginDtoSchema)),
|
|
22
|
+
|
|
23
|
+
getConfiguration: proc({
|
|
24
|
+
operationType: "query",
|
|
25
|
+
userType: "authenticated",
|
|
26
|
+
access: [cacheAccess.settings.read],
|
|
27
|
+
}).output(CacheConfigurationDtoSchema),
|
|
28
|
+
|
|
29
|
+
// Cache configuration updates - Manage access
|
|
30
|
+
updateConfiguration: proc({
|
|
31
|
+
operationType: "mutation",
|
|
32
|
+
userType: "authenticated",
|
|
33
|
+
access: [cacheAccess.settings.manage],
|
|
34
|
+
})
|
|
35
|
+
.input(UpdateCacheConfigurationSchema)
|
|
36
|
+
.output(CacheConfigurationDtoSchema),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Export contract type
|
|
40
|
+
export type CacheContract = typeof cacheContract;
|
|
41
|
+
|
|
42
|
+
// Export client definition for type-safe forPlugin usage
|
|
43
|
+
export const CacheApi = createClientDefinition(cacheContract, pluginMetadata);
|
package/src/schemas.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* DTO for cache plugin information
|
|
5
|
+
*/
|
|
6
|
+
export const CachePluginDtoSchema = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
displayName: z.string(),
|
|
9
|
+
description: z.string().optional(),
|
|
10
|
+
configVersion: z.number(),
|
|
11
|
+
configSchema: z.record(z.string(), z.unknown()),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type CachePluginDto = z.infer<typeof CachePluginDtoSchema>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* DTO for current cache configuration
|
|
18
|
+
*/
|
|
19
|
+
export const CacheConfigurationDtoSchema = z.object({
|
|
20
|
+
pluginId: z.string(),
|
|
21
|
+
config: z.record(z.string(), z.unknown()),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type CacheConfigurationDto = z.infer<typeof CacheConfigurationDtoSchema>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Schema for updating cache configuration
|
|
28
|
+
*/
|
|
29
|
+
export const UpdateCacheConfigurationSchema = z.object({
|
|
30
|
+
pluginId: z.string().describe("ID of the cache plugin to use"),
|
|
31
|
+
config: z
|
|
32
|
+
.record(z.string(), z.unknown())
|
|
33
|
+
.describe("Plugin-specific configuration"),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type UpdateCacheConfiguration = z.infer<
|
|
37
|
+
typeof UpdateCacheConfigurationSchema
|
|
38
|
+
>;
|