@mdrv/db-config 0.6.3 → 0.6.5

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.
Files changed (3) hide show
  1. package/bun.lock +2 -2
  2. package/index.ts +30 -7
  3. package/package.json +2 -2
package/bun.lock CHANGED
@@ -5,11 +5,11 @@
5
5
  "": {
6
6
  "name": "@mdrv/db-config",
7
7
  "dependencies": {
8
- "smol-toml": "^1.3.1",
8
+ "smol-toml": "^1.9.1",
9
9
  },
10
10
  },
11
11
  },
12
12
  "packages": {
13
- "smol-toml": ["smol-toml@1.8.0", "", {}, "sha512-kCZr2V3ch9i00x8zXRhjUNVcjG9ijES5dDudkXvUVCT5QlJNQWElSJdZqyPemffHoLNUYwOcou0Fy+ojN0uHSQ=="],
13
+ "smol-toml": ["smol-toml@1.9.1", "", {}, "sha512-j7WyPdf0CJoutMzMoPLF/bVXHtKZIT9Rb4eGeEbWw8X2t5oirjPgpL+OpaENZrILYaXqYwnVH+qgUwVbl+pUJQ=="],
14
14
  }
15
15
  }
package/index.ts CHANGED
@@ -1,16 +1,27 @@
1
1
  /**
2
- * @mdrv/db-config — typed config + hooks layer.
3
- * Static fleet config lives in ~/.config/mdrv-db/config.toml (read by
4
- * @mdrv/db-maintenance); dynamic hooks live in hooks/<slug>.ts and run inside
5
- * each Bun app. The daemon never executes scripts.
2
+ * @mdrv/db-config — typed fleet config (loadConfig over smol-toml).
3
+ * The static config lives in ~/.config/mdrv-db/config.toml; only the
4
+ * mdrv-db CLI and daemon read it (apps never do). MdrvDbHooks types the
5
+ * optional per-app event hooks; the daemon never executes scripts.
6
6
  */
7
7
  import { parse } from 'smol-toml'
8
8
 
9
- export type Durability = 'per-write' | 'group-commit-10ms'
9
+ /**
10
+ * Display label for `mdrv-db config`, nothing more. The engine's fsync
11
+ * setting is the owning app's call (`fsyncEachWrite` on the `MdrvDb`
12
+ * constructor); nothing routes this value into an engine.
13
+ */
14
+ export type Durability = 'per-write'
10
15
 
11
16
  export interface BackupPolicy {
12
17
  cron: string
13
- retention_days: number
18
+ /** Age-based prune. Union with `keep`: either rule retires, newest always kept */
19
+ retention_days?: number
20
+ /** Count-based cap (newest backup always exempt) */
21
+ keep?: number
22
+ /** Disk-guard floor on the backup volume, e.g. "10G" (default "1G", "0" = off) */
23
+ min_free?: string
24
+ /** Legacy; not read by the daemon */
14
25
  mode?: 'online-or-offline' | 'online' | 'offline'
15
26
  }
16
27
 
@@ -21,7 +32,7 @@ export interface CircleConfig {
21
32
  }
22
33
 
23
34
  export interface RpcConfig {
24
- /** Owner app's maintenance endpoint, e.g. http://127.0.0.1:3111/mdrv/rpc */
35
+ /** Owner app's admin RPC endpoint, e.g. http://127.0.0.1:8100/mdrv/rpc */
25
36
  url: string
26
37
  /** Env var holding the shared token (read by both owner and daemon) */
27
38
  token_env: string
@@ -34,9 +45,20 @@ export interface DbConfig {
34
45
  data_dir?: string
35
46
  /** Maintenance RPC on the owner app; absent = offline-only */
36
47
  rpc?: RpcConfig
48
+ /** Console display label (PATCH /api/slugs/{slug}/meta or config --set) */
49
+ title?: string
50
+ /** Console, free-form */
51
+ description?: string
52
+ /** Console filter chips */
53
+ labels?: string[]
54
+ /** Console display rank, ascending (PATCH /api/fleet/order rewrites densely) */
55
+ order?: number
56
+ /** Display label (see `Durability`); not an engine setting */
37
57
  durability?: Durability
38
58
  backup?: BackupPolicy
59
+ /** Legacy cadence; not read by the daemon (a backup job verifies its own backup) */
39
60
  verify?: 'weekly' | 'daily' | 'off'
61
+ /** Legacy app-domain table; not read by the CLI or daemon (convention only) */
40
62
  mid?: {
41
63
  admins?: string[]
42
64
  session?: { access_ttl_min?: number; refresh_ttl_days?: number; max_per_user?: number }
@@ -56,6 +78,7 @@ export interface DbConfig {
56
78
  }
57
79
 
58
80
  export interface MdrvDbConfig {
81
+ /** Reserved: read by nothing today, typed so existing files still parse */
59
82
  defaults?: { durability?: Durability; verify?: string }
60
83
  sched?: { data_root?: string }
61
84
  db: Record<string, DbConfig>
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@mdrv/db-config",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "license": "MIT",
5
5
  "description": "Typed config + event hooks for the mdrv-db suite",
6
6
  "type": "module",
7
7
  "main": "index.ts",
8
8
  "dependencies": {
9
- "smol-toml": "^1.3.1"
9
+ "smol-toml": "^1.9.1"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",