@hearthlog/ledger 0.1.4 → 0.1.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 (2) hide show
  1. package/README.md +17 -17
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  The separate Ledger admin console provides application metrics,
4
4
  event-log browsing and paginated event inspection using Hearthlog's shared UI components.
5
5
 
6
- `@hearthlog/ledger` (this package) is the sole Ledger runtime; the repository's `ledger/` directory holds the host files for deploying it (`wrangler.jsonc`, the entry that re-exports it, the generated `Env` types, `.dev.vars.example`). An Elysia application owns the stateless
6
+ `@hearthlog/ledger` (this package) is the sole Ledger runtime; the development site's `dev/ledger/` directory holds what running it there needs (the generated `Env` types, the secrets declaration, `.dev.vars.example`); its `wrangler.jsonc` and the entry that re-exports it are generated into `dev/.generated/shared/ledger/`. An Elysia application owns the stateless
7
7
  HTTP boundary and invokes two SQLite-backed Durable Object classes through
8
8
  typed RPC. Elysia's `CloudflareAdapter` is officially experimental.
9
9
 
@@ -33,11 +33,11 @@ them.
33
33
 
34
34
  ## Local development
35
35
 
36
- Create `ledger/.dev.vars` from `ledger/.dev.vars.example` without committing
36
+ Create `dev/ledger/.dev.vars` from `dev/ledger/.dev.vars.example` without committing
37
37
  it, replace all placeholders, and start Wrangler:
38
38
 
39
39
  ```bash
40
- pnpm ledger:dev
40
+ pnpm -C dev ledger:dev
41
41
  ```
42
42
 
43
43
  Wrangler listens on `http://127.0.0.1:8787`. Signing keys must contain at least
@@ -84,9 +84,9 @@ Each application also carries an **event policy** (`GET|PUT /admin/v1/apps/<id>/
84
84
  `dynamicEvents` says whether runtime-defined entity types are allowed, and
85
85
  `validation` (`report` or `enforce`) overrides the deployment's `EVENT_VALIDATION`.
86
86
  An application created without a policy gets `{ contracts: null, dynamicEvents: false,
87
- validation: "enforce" }`; `pnpm ensure:tenant` creates a site's application with the
87
+ validation: "enforce" }`; `pnpm -C dev ensure:tenant` creates a site's application with the
88
88
  modules the site ships. An application that predates policies has none and behaves
89
- as before; `pnpm ensure:tenant -- --site <id> --apply-policy` sets the site's policy on
89
+ as before; `pnpm -C dev ensure:tenant -- --site <id> --apply-policy` sets the site's policy on
90
90
  it. Changing a policy never re-judges accepted events.
91
91
  Switch production to `enforce` once the logs show only intended rejections.
92
92
  A request that was already accepted always replays. Restoring a backup taken
@@ -96,36 +96,36 @@ from older clients replays their events through the same checks, so keep
96
96
  In a second terminal, start the frontend:
97
97
 
98
98
  ```bash
99
- pnpm dev
99
+ pnpm -C dev dev
100
100
  ```
101
101
 
102
- Before Vite starts, `pnpm dev` runs `ledger:provision-local`. It verifies an
102
+ Before Vite starts, `pnpm -C dev dev` runs `ledger:provision-local`. It verifies an
103
103
  existing ignored local app credential or provisions one with `ADMIN_TOKEN`
104
- from `ledger/.dev.vars`. Vite then proxies `/api/ledger` HTTP and WebSocket
104
+ from `dev/ledger/.dev.vars`. Vite then proxies `/api/ledger` HTTP and WebSocket
105
105
  traffic to this local Worker and injects the app token server-side. Neither the
106
106
  administrator token nor the app token is bundled into browser code.
107
107
 
108
108
  ## Checks and deployment
109
109
 
110
110
  ```bash
111
- pnpm ledger:types
112
- pnpm ledger:check
113
- pnpm ledger:test
114
- pnpm ledger:dry-run
111
+ pnpm -C dev ledger:types
112
+ pnpm -C dev ledger:check
113
+ pnpm -C dev ledger:test
114
+ pnpm -C dev ledger:dry-run
115
115
  pnpm test:worker
116
116
  ```
117
117
 
118
118
  Configure production secrets without committing them:
119
119
 
120
120
  ```bash
121
- pnpm exec wrangler secret put ADMIN_TOKEN --config .generated/shared/ledger/wrangler.jsonc
122
- pnpm exec wrangler secret put TOKEN_SIGNING_KEY_CURRENT --config .generated/shared/ledger/wrangler.jsonc
121
+ pnpm -C dev exec wrangler secret put ADMIN_TOKEN --config .generated/shared/ledger/wrangler.jsonc
122
+ pnpm -C dev exec wrangler secret put TOKEN_SIGNING_KEY_CURRENT --config .generated/shared/ledger/wrangler.jsonc
123
123
  ```
124
124
 
125
125
  Then deploy:
126
126
 
127
127
  ```bash
128
- pnpm exec wrangler deploy --config .generated/shared/ledger/wrangler.jsonc
128
+ pnpm -C dev exec wrangler deploy --config .generated/shared/ledger/wrangler.jsonc
129
129
  ```
130
130
 
131
131
  To rotate signing keys without immediately invalidating existing access
@@ -161,11 +161,11 @@ never authentication credentials or internal idempotency records.
161
161
  ```bash
162
162
  LEDGER_BASE_URL=https://st-ledger.example.workers.dev \
163
163
  LEDGER_AUTH_TOKEN=... \
164
- pnpm ledger:export --output ./ledger-export
164
+ pnpm -C dev ledger:export --output ./ledger-export
165
165
 
166
166
  LEDGER_BASE_URL=https://st-ledger.example.workers.dev \
167
167
  LEDGER_ADMIN_TOKEN=... \
168
- pnpm ledger:restore --input ./ledger-export --name restored-app
168
+ pnpm -C dev ledger:restore --input ./ledger-export --name restored-app
169
169
  ```
170
170
 
171
171
  Restore validates the complete export before provisioning, creates an empty
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearthlog/ledger",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Hearthlog's Ledger: the event store Worker (Elysia over SQLite Durable Objects), its contracts and tests, and the logical backup tooling",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@sinclair/typebox": "0.34.52",
32
32
  "elysia": "1.4.30",
33
- "@hearthlog/contracts": "0.1.4"
33
+ "@hearthlog/contracts": "0.1.5"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@hearthlog/generated": "*"