@aotter/mantle 0.2.0-alpha.5 → 0.2.0-alpha.6
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/README.md +2 -2
- package/dist/admin/createAdminSurface.d.ts +3 -0
- package/dist/admin/createAdminSurface.d.ts.map +1 -1
- package/dist/admin/createAdminSurface.js +51 -8
- package/dist/admin/createAdminSurface.js.map +1 -1
- package/dist/admin/extensions.d.ts +290 -0
- package/dist/admin/extensions.d.ts.map +1 -0
- package/dist/admin/extensions.js +532 -0
- package/dist/admin/extensions.js.map +1 -0
- package/dist/admin/index.d.ts +1 -0
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +1 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/auth/buildAuth.d.ts +3 -1
- package/dist/auth/buildAuth.d.ts.map +1 -1
- package/dist/auth/buildAuth.js +3 -2
- package/dist/auth/buildAuth.js.map +1 -1
- package/dist/auth/callerResolver.d.ts +4 -0
- package/dist/auth/callerResolver.d.ts.map +1 -1
- package/dist/auth/callerResolver.js +4 -1
- package/dist/auth/callerResolver.js.map +1 -1
- package/dist/auth/createMantleAuth.d.ts.map +1 -1
- package/dist/auth/createMantleAuth.js +3 -2
- package/dist/auth/createMantleAuth.js.map +1 -1
- package/dist/auth/db.d.ts +1 -0
- package/dist/auth/db.d.ts.map +1 -1
- package/dist/auth/db.js +6 -3
- package/dist/auth/db.js.map +1 -1
- package/dist/bun/index.d.ts +0 -44
- package/dist/bun/index.d.ts.map +1 -1
- package/dist/bun/index.js +0 -84
- package/dist/bun/index.js.map +1 -1
- package/dist/cli/generate.js +3 -3
- package/dist/cli/generate.js.map +1 -1
- package/dist/cli/preset.d.ts.map +1 -1
- package/dist/cli/preset.js +80 -28
- package/dist/cli/preset.js.map +1 -1
- package/dist/cloudflare/index.d.ts +4 -0
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +2 -0
- package/dist/cloudflare/index.js.map +1 -1
- package/dist/core/dialect.d.ts +13 -1
- package/dist/core/dialect.d.ts.map +1 -1
- package/dist/core/driver.d.ts +7 -0
- package/dist/core/driver.d.ts.map +1 -1
- package/dist/core/runtime/createRuntime.js +1 -1
- package/dist/core/runtime/createRuntime.js.map +1 -1
- package/dist/core/sessionUser.d.ts +14 -0
- package/dist/core/sessionUser.d.ts.map +1 -0
- package/dist/core/sessionUser.js +4 -0
- package/dist/core/sessionUser.js.map +1 -0
- package/dist/core/sql/allowlist.d.ts +2 -0
- package/dist/core/sql/allowlist.d.ts.map +1 -1
- package/dist/core/sql/allowlist.js +43 -11
- package/dist/core/sql/allowlist.js.map +1 -1
- package/dist/core/sql/ast.js +1 -1
- package/dist/core/sql/ast.js.map +1 -1
- package/dist/core/sql/compile.js +1 -1
- package/dist/core/sql/compile.js.map +1 -1
- package/dist/core/sql/policy.d.ts +2 -0
- package/dist/core/sql/policy.d.ts.map +1 -1
- package/dist/core/sql/policy.js +25 -6
- package/dist/core/sql/policy.js.map +1 -1
- package/dist/core/sql/run.d.ts +0 -8
- package/dist/core/sql/run.d.ts.map +1 -1
- package/dist/core/sql/run.js +152 -35
- package/dist/core/sql/run.js.map +1 -1
- package/dist/d1/executor.d.ts +2 -0
- package/dist/d1/executor.d.ts.map +1 -1
- package/dist/d1/executor.js +6 -1
- package/dist/d1/executor.js.map +1 -1
- package/dist/postgres/adapter.d.ts +5 -2
- package/dist/postgres/adapter.d.ts.map +1 -1
- package/dist/postgres/adapter.js +7 -1
- package/dist/postgres/adapter.js.map +1 -1
- package/dist/postgres/compile/index.d.ts +1 -1
- package/dist/postgres/compile/index.js +1 -1
- package/dist/postgres/driver.d.ts +38 -21
- package/dist/postgres/driver.d.ts.map +1 -1
- package/dist/postgres/driver.js +100 -24
- package/dist/postgres/driver.js.map +1 -1
- package/dist/postgres/executor.d.ts +8 -0
- package/dist/postgres/executor.d.ts.map +1 -1
- package/dist/postgres/executor.js +40 -13
- package/dist/postgres/executor.js.map +1 -1
- package/dist/postgres/index.d.ts +2 -1
- package/dist/postgres/index.d.ts.map +1 -1
- package/dist/postgres/index.js +1 -0
- package/dist/postgres/index.js.map +1 -1
- package/dist/postgres/lower.d.ts.map +1 -1
- package/dist/postgres/lower.js +3 -8
- package/dist/postgres/lower.js.map +1 -1
- package/dist/postgres/print.d.ts.map +1 -1
- package/dist/postgres/print.js +2 -15
- package/dist/postgres/print.js.map +1 -1
- package/dist/postgres/session.d.ts +9 -0
- package/dist/postgres/session.d.ts.map +1 -0
- package/dist/postgres/session.js +111 -0
- package/dist/postgres/session.js.map +1 -0
- package/dist/postgres/storage.d.ts +14 -1
- package/dist/postgres/storage.d.ts.map +1 -1
- package/dist/postgres/storage.js +136 -54
- package/dist/postgres/storage.js.map +1 -1
- package/dist/postgres/validator.d.ts +4 -3
- package/dist/postgres/validator.d.ts.map +1 -1
- package/dist/postgres/validator.js +13 -6
- package/dist/postgres/validator.js.map +1 -1
- package/dist/spec/domain/model/ManifestGrammar.d.ts +4 -0
- package/dist/spec/domain/model/ManifestGrammar.d.ts.map +1 -1
- package/dist/spec/domain/model/ManifestGrammar.js +4 -0
- package/dist/spec/domain/model/ManifestGrammar.js.map +1 -1
- package/dist/spec/domain/service/SchemaAdminUiChecker.d.ts +2 -0
- package/dist/spec/domain/service/SchemaAdminUiChecker.d.ts.map +1 -1
- package/dist/spec/domain/service/SchemaAdminUiChecker.js +50 -6
- package/dist/spec/domain/service/SchemaAdminUiChecker.js.map +1 -1
- package/dist/spec/domain/service/ViewAdminUiChecker.d.ts +1 -1
- package/dist/spec/domain/service/ViewAdminUiChecker.d.ts.map +1 -1
- package/dist/spec/domain/service/ViewAdminUiChecker.js +7 -2
- package/dist/spec/domain/service/ViewAdminUiChecker.js.map +1 -1
- package/dist/spec/infrastructure/sql/compilePlan.d.ts.map +1 -1
- package/dist/spec/infrastructure/sql/compilePlan.js +5 -0
- package/dist/spec/infrastructure/sql/compilePlan.js.map +1 -1
- package/dist/spec/kernel/diagnostic.d.ts +1 -1
- package/dist/spec/kernel/diagnostic.d.ts.map +1 -1
- package/dist/spec/kernel/diagnostic.js +5 -0
- package/dist/spec/kernel/diagnostic.js.map +1 -1
- package/dist/testing/cases/corpus.d.ts +2 -0
- package/dist/testing/cases/corpus.d.ts.map +1 -1
- package/dist/testing/cases/corpus.js +7 -5
- package/dist/testing/cases/corpus.js.map +1 -1
- package/dist/testing/cases/policy.d.ts +14 -1
- package/dist/testing/cases/policy.d.ts.map +1 -1
- package/dist/testing/cases/policy.js +3 -2
- package/dist/testing/cases/policy.js.map +1 -1
- package/dist/testing/cases/printer.d.ts.map +1 -1
- package/dist/testing/cases/printer.js +3 -1
- package/dist/testing/cases/printer.js.map +1 -1
- package/dist/testing/cases/report-view.d.ts.map +1 -1
- package/dist/testing/cases/report-view.js +18 -0
- package/dist/testing/cases/report-view.js.map +1 -1
- package/docs/adr/0037-postgresql-is-the-reference-dialect.md +2 -1
- package/docs/adr/0039-postgresql-is-native.md +130 -0
- package/docs/adr/README.md +2 -0
- package/docs/adr/adr-lite-1376-admin-extensions.md +330 -0
- package/docs/examples/commerce-inventory.md +18 -1
- package/docs/examples/reference-service/package.json +2 -2
- package/docs/handbook/cloudflare/authentication.md +3 -3
- package/docs/handbook/cloudflare/deploy-and-operate.md +4 -1
- package/docs/handbook/concepts/runtime-and-adapters.md +74 -33
- package/docs/handbook/concepts/views.md +1 -1
- package/docs/handbook/guides/admin-extensions.md +191 -0
- package/docs/handbook/guides/admin-ui.md +2 -1
- package/docs/handbook/navigation.json +2 -1
- package/docs/handbook/reference/diagnostics.md +1 -0
- package/docs/handbook/reference/procedure.md +2 -1
- package/docs/handbook/reference/schema.md +6 -3
- package/docs/handbook/reference/surface.md +6 -2
- package/docs/handbook/reference/view.md +7 -5
- package/docs/handbook/releases/index.md +78 -4
- package/docs/handbook/start/project-and-cli.md +20 -12
- package/docs/skills/develop/SKILL.md +8 -2
- package/docs/skills/provision/SKILL.md +4 -1
- package/docs/skills/update/SKILL.md +3 -0
- package/docs/upgrade-0.1-to-0.2.md +1 -1
- package/package.json +6 -5
- package/dist/postgres/textRows.d.ts +0 -10
- package/dist/postgres/textRows.d.ts.map +0 -1
- package/dist/postgres/textRows.js +0 -44
- package/dist/postgres/textRows.js.map +0 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# ADR-0039: PostgreSQL is native, and node-postgres is its only driver
|
|
2
|
+
|
|
3
|
+
**Status:** Accepted (2026-10-08).
|
|
4
|
+
|
|
5
|
+
**Date:** 2026-10-08.
|
|
6
|
+
|
|
7
|
+
**Supersedes:**
|
|
8
|
+
- ADR-0035: the cross-dialect parity clauses (one shared subset, identical results on every dialect).
|
|
9
|
+
- ADR-0037: "moving from D1 to PostgreSQL still needs no rewrite", and the SQLite emulation it implies.
|
|
10
|
+
- ADR-0038: the Bun.SQL PostgreSQL host and its temporary-table result description. Bun's SQLite preset is unchanged.
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
|
|
14
|
+
Mantle has run PostgreSQL as an emulation of D1/SQLite, so that one manifest returns identical results on both engines.
|
|
15
|
+
|
|
16
|
+
### What the emulation costs
|
|
17
|
+
|
|
18
|
+
The PostgreSQL audit on the procurement fixture (S, M and L tiers, Bun and Workers hosts) measured three costs.
|
|
19
|
+
|
|
20
|
+
**1. No declared index can serve a paged sort.**
|
|
21
|
+
- Paging forces SQLite's NULL order: `ASC NULLS FIRST`, `DESC NULLS LAST` (`core/sql/run.ts:257,297`). The tiebreak is `id COLLATE "C"`.
|
|
22
|
+
- PostgreSQL btree indexes have the opposite default order (`postgres/storage.ts:88-93`).
|
|
23
|
+
- As a result, every Admin list and every View with an ORDER BY does a full scan plus a sort, even with an index:
|
|
24
|
+
|
|
25
|
+
| Measurement | Today | With an order-matching index |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| Admin list, L tier, c=8 | 3 rps | 139 rps |
|
|
28
|
+
| procurement report | 47 ms | 0.26 ms |
|
|
29
|
+
|
|
30
|
+
- Matching the indexes to the emulated order would mean a `NULLS FIRST` index migration, permanently.
|
|
31
|
+
|
|
32
|
+
**2. Translation shims in SQL that authors never see.**
|
|
33
|
+
- `_mantle_jget` reproduces SQLite's `->>` and `$` paths.
|
|
34
|
+
- `_mantle_bool` reproduces SQLite's integer truthiness.
|
|
35
|
+
- `_mantle_json_each` reproduces SQLite's json_each columns.
|
|
36
|
+
- `||` is cast to text, and pinned `DateStyle`/`IntervalStyle`/`extra_float_digits` settings exist only so that text decodes the way D1's does.
|
|
37
|
+
|
|
38
|
+
**3. A second driver on Bun that exists only to recover type metadata.**
|
|
39
|
+
- Bun.SQL exposes no column OIDs or typmods: verified on Bun 1.4.2, and its docs list column type transforms as unfinished.
|
|
40
|
+
- Mantle therefore describes every result through `CREATE TEMP TABLE … WITH NO DATA` plus `pg_attribute`.
|
|
41
|
+
- A View read costs 12 statements and 10 round trips on Bun.SQL, against 4 and 4 on node-postgres.
|
|
42
|
+
- Every Bun role also needs `TEMPORARY`.
|
|
43
|
+
|
|
44
|
+
### Who actually needs D1/PostgreSQL parity
|
|
45
|
+
|
|
46
|
+
No caller needs one manifest to switch engines without changes:
|
|
47
|
+
- **Cloud tenants** are moving to PostgreSQL.
|
|
48
|
+
- **On-premises single-organization deployments** run PostgreSQL on Bun.
|
|
49
|
+
- **D1 services** stay on D1.
|
|
50
|
+
|
|
51
|
+
What callers do need is that one PostgreSQL plan behaves the same on Bun and on Workers. The same app runs in Cloud and on-premises, and handler code and output schemas see the values directly.
|
|
52
|
+
|
|
53
|
+
## Decision
|
|
54
|
+
|
|
55
|
+
### 1. Each dialect is its own target
|
|
56
|
+
|
|
57
|
+
- A manifest targets one dialect.
|
|
58
|
+
- Mantle does not promise that a PostgreSQL manifest compiles for D1, or that a D1 manifest compiles for PostgreSQL.
|
|
59
|
+
- Mantle does not promise that the two dialects return equal values.
|
|
60
|
+
- The compliance suite checks each dialect against its own semantics, not against the other dialect.
|
|
61
|
+
- The closed allowlist stays: base for D1, reference for PostgreSQL (ADR-0037 decision 1).
|
|
62
|
+
|
|
63
|
+
### 2. PostgreSQL semantics are PostgreSQL's
|
|
64
|
+
|
|
65
|
+
**Ordering.** Paging uses PostgreSQL's own NULL order (`ASC NULLS LAST`, `DESC NULLS FIRST`), and the cursor follows it. The tiebreak uses the column's own collation, so declared indexes serve ORDER BY … LIMIT. An index matches a sort only when every key in it runs in the same direction; that remains an authoring rule for indexes.
|
|
66
|
+
|
|
67
|
+
**The SQLite shims go.** `_mantle_jget`, `_mantle_bool`, `_mantle_json_each`, the `||` text cast and the `$`-path lowering are removed. PostgreSQL manifests use PostgreSQL's jsonb operators, booleans and `jsonb_array_elements`. A manifest that relied on a SQLite-ism fails validation with a position and the PostgreSQL spelling.
|
|
68
|
+
|
|
69
|
+
**What stays.** Mantle's own functions that are not emulation stay:
|
|
70
|
+
- `_mantle_expect` (#1379);
|
|
71
|
+
- the policy rewrite;
|
|
72
|
+
- convergence;
|
|
73
|
+
- the boot-time settings check, reduced to what the remaining decoding needs.
|
|
74
|
+
|
|
75
|
+
### 3. node-postgres is the only PostgreSQL driver
|
|
76
|
+
|
|
77
|
+
- **Every host uses node-postgres (`pg` 8.23 or later):** the Bun preset (a `pg.Pool`), the Workers/Hyperdrive preset (a client per request), and any host composed by hand.
|
|
78
|
+
- **Request scoping and pipelining are the same everywhere:** `requestScoped` and the pipelined write path from #1379 run identically on every host.
|
|
79
|
+
- **The Bun.SQL host is removed**, along with its result description and the `TEMPORARY` grant.
|
|
80
|
+
- **Values come out of one decoder** (`decodeField` over RowDescription OIDs and typmods). Bun and Workers therefore return the same values for the same plan, with no separate value contract to maintain.
|
|
81
|
+
|
|
82
|
+
## Consequences
|
|
83
|
+
|
|
84
|
+
- **Indexes work on PostgreSQL**, with no `NULLS FIRST` migration. The keyset cursor (row comparison, #1391 follow-up) becomes the next step for deep pages.
|
|
85
|
+
- **There is one PostgreSQL code path** to test, profile and secure, and no `TEMPORARY` privilege.
|
|
86
|
+
- **This is breaking for existing PostgreSQL services:**
|
|
87
|
+
- NULL position in sorted results changes.
|
|
88
|
+
- Manifests that use SQLite JSON paths or integer truthiness on PostgreSQL must be rewritten.
|
|
89
|
+
- The Bun PostgreSQL preset's entry changes.
|
|
90
|
+
- Release notes give the rewrites.
|
|
91
|
+
- **D1 → PostgreSQL is a migration, not a switch:**
|
|
92
|
+
- Export, rewrite the manifest's SQL, import.
|
|
93
|
+
- aotter/mantle#1298 (portable dump) is re-scoped to data only.
|
|
94
|
+
- aotter/mantle-home#251 (tenant upgrade from D1) becomes an explicit migration.
|
|
95
|
+
- **Bun gives up Bun.SQL's native client.** The audit measured no gain from it where Mantle's wrapper was absent: the session check ran 390 rps on Bun.SQL and 388 rps on node-postgres. If Bun later exposes column metadata and a measured gain appears, a Bun.SQL driver can return as a second implementation of the same contract.
|
|
96
|
+
|
|
97
|
+
## Alternatives
|
|
98
|
+
|
|
99
|
+
- **Keep parity and build `NULLS FIRST` indexes.** Rejected. It keeps every shim, needs an index migration on every existing database, and buys a guarantee no caller uses.
|
|
100
|
+
- **Keep Bun.SQL with a cached result description.** Rejected. It makes the wrapper cheaper but keeps it, keeps the `TEMPORARY` grant, and keeps two drivers to maintain.
|
|
101
|
+
- **Keep Bun.SQL, with a value contract both drivers normalise to.** Rejected. Two drivers plus a normalisation layer cost more than one driver, and the contract would need maintaining.
|
|
102
|
+
|
|
103
|
+
## How to apply
|
|
104
|
+
|
|
105
|
+
Each step is its own PR. Each is breaking where noted.
|
|
106
|
+
|
|
107
|
+
1. **Bun preset on node-postgres.**
|
|
108
|
+
- `cli/preset.ts`/`generate.ts` write a `pg.Pool` entry with `requestScoped`.
|
|
109
|
+
- Remove `bunPgConnect`, `bunPostgresStorage` and the result-description path from `src/bun`, and the `TEMPORARY` note from the handbook.
|
|
110
|
+
- `test/bun/native.ts` runs the PostgreSQL conformance on node-postgres under Bun.
|
|
111
|
+
2. **Native ordering.**
|
|
112
|
+
- `run.ts` stops emitting NULLS clauses on PostgreSQL. The dialect supplies its default NULL order, and the cursor predicate follows it.
|
|
113
|
+
- The tiebreak drops `COLLATE "C"` on PostgreSQL.
|
|
114
|
+
- Add EXPLAIN-based tests showing a declared index serves each paged sort.
|
|
115
|
+
3. **Remove the SQLite shims** from `postgres/lower.ts`, `print.ts` and `storage.ts` `FUNCTIONS`.
|
|
116
|
+
- Add validation diagnostics that name the PostgreSQL spelling.
|
|
117
|
+
- Rewrite the PostgreSQL compliance fixtures and the reference suite in PostgreSQL's own semantics.
|
|
118
|
+
4. **Docs and skills.**
|
|
119
|
+
- The handbook's dialect pages and the consumer skills say that each dialect is its own target.
|
|
120
|
+
- Add release notes with the rewrites.
|
|
121
|
+
5. **Follow-ups from the audit** (#1391 and the audit report), in this order:
|
|
122
|
+
- keyset cursor;
|
|
123
|
+
- auth: drop the discarded JWT header, plain reads;
|
|
124
|
+
- SQL compile cache;
|
|
125
|
+
- boot trim;
|
|
126
|
+
- convergence safety (CHECK diffing, re-reading the fingerprint under the lock).
|
|
127
|
+
|
|
128
|
+
## Implementation status
|
|
129
|
+
|
|
130
|
+
Accepted. Implementation follows in the stacked PRs listed under How to apply.
|
package/docs/adr/README.md
CHANGED
|
@@ -39,6 +39,7 @@ Records of *why* mantle ended up shaped this way. The numbering preserves POC AD
|
|
|
39
39
|
| [0036](0036-host-and-dialect.md) | A project picks a host (`cloudflare`, `none`) and a dialect (`sqlite`, `postgres`, a package) once; `mantle generate` writes the pair's preset; the host never enters the plan. | Accepted for 0.2.0; reserved Bun host amended by 0038 |
|
|
40
40
|
| [0037](0037-postgresql-is-the-reference-dialect.md) | PostgreSQL is the reference dialect: one closed allowlist in Core (base and reference profiles), D1 runs the base subset; a View reads an internal View; `restrict` narrows at runtime; a statement timeout on PostgreSQL; Cloud's PostgreSQL connection stays with the platform. | Accepted for 0.2.0 |
|
|
41
41
|
| [0038](0038-bun-native-host.md) | Bun is a native host: `@aotter/mantle/bun` owns the native SQLite and PostgreSQL drivers and Admin files; `host: bun` defaults to `dialect: postgres`; the CLI writes a `Bun.serve` entry once. | Accepted for 0.2.0 |
|
|
42
|
+
| [0039](0039-postgresql-is-native.md) | PostgreSQL is native, not a D1 emulation: each dialect is its own target, PostgreSQL ordering and SQL are PostgreSQL's, and node-postgres is the only PostgreSQL driver on every host. | Accepted; supersedes parts of 0035, 0037 and 0038 |
|
|
42
43
|
|
|
43
44
|
## Reading order
|
|
44
45
|
|
|
@@ -94,3 +95,4 @@ These retain their issue-based filenames and original decision status.
|
|
|
94
95
|
| [#845 Frontend client](adr-lite-845-frontend-client.md) | Accepted |
|
|
95
96
|
| [#861 Admin WebMCP](adr-lite-861-admin-webmcp.md) | Accepted |
|
|
96
97
|
| [909 Admin UI kit](adr-lite-909-admin-ui-kit.md) | Accepted; amended by 0029 |
|
|
98
|
+
| [#1376 Admin extensions](adr-lite-1376-admin-extensions.md) | Accepted |
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
# ADR-lite 1376: Admin extensions
|
|
2
|
+
|
|
3
|
+
**Status:** Accepted (revision 3: the full contract, for hosts and for
|
|
4
|
+
projects; replaces the pages-only draft)
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
A project or the host that mounts Admin sometimes needs its own UI next to the generated
|
|
9
|
+
collections, Views and operations. Examples are an operator's
|
|
10
|
+
access-management screen, a record action that calls a host service, or a
|
|
11
|
+
field widget for a host-specific format. Today the Admin SPA has no way to add
|
|
12
|
+
any of these:
|
|
13
|
+
|
|
14
|
+
- Its routes and navigation are fixed.
|
|
15
|
+
- `createAdminSurface` has no host routes.
|
|
16
|
+
- The UI kit (ADR-lite 909) deliberately does not export the application
|
|
17
|
+
shell.
|
|
18
|
+
|
|
19
|
+
Hosts are left with forking the SPA or patching its private DOM.
|
|
20
|
+
|
|
21
|
+
The first draft of this record added whole pages only. A survey of how other
|
|
22
|
+
products open their admin turns up the same set of extension points in
|
|
23
|
+
almost all of them. The CMS products were Strapi, Directus, Payload, Sanity,
|
|
24
|
+
Contentful, Keystone, Decap, Tina and WordPress. The platforms were Shopify
|
|
25
|
+
Admin UI extensions, VS Code, Grafana, Backstage, Atlassian Forge, Figma and
|
|
26
|
+
the Keycloak admin console. The recurring points are:
|
|
27
|
+
|
|
28
|
+
- pages with a navigation entry
|
|
29
|
+
- record and list actions
|
|
30
|
+
- record side panels
|
|
31
|
+
- field widgets
|
|
32
|
+
- dashboard widgets
|
|
33
|
+
- settings pages
|
|
34
|
+
- server endpoints
|
|
35
|
+
|
|
36
|
+
The survey also turns up five lessons that bear on this design:
|
|
37
|
+
|
|
38
|
+
1. **Only a narrow, typed surface survives major versions.** Every product
|
|
39
|
+
that exposed its internal context or helper packages broke all its plugins
|
|
40
|
+
at the next major: Strapi's helper-plugin, Sanity's Parts, Payload 2→3,
|
|
41
|
+
Decap's React pin. Contentful's location-scoped SDK and Backstage's typed
|
|
42
|
+
data refs aged well.
|
|
43
|
+
2. **Declare in data, run in code.** The extension says *what* attaches
|
|
44
|
+
*where* as data. Code supplies only the behavior. Grafana had to retrofit a
|
|
45
|
+
static mirror of its imperative `addLink` calls before it could index,
|
|
46
|
+
validate or lazy-load extensions. Declarations can also be validated and
|
|
47
|
+
diffed before anything runs. That matters here because agents author and
|
|
48
|
+
deploy Mantle projects.
|
|
49
|
+
3. **Typed contribution points beat free-form injection zones.** Strapi 5 and
|
|
50
|
+
Sanity steer integrators to typed actions with a position and a dialog
|
|
51
|
+
kind. Strapi now marks its free zones internal.
|
|
52
|
+
4. **Navigation visibility is not authorization.** Strapi, Payload and
|
|
53
|
+
Directus all warn about this. Every extension route has to check the
|
|
54
|
+
caller on the server.
|
|
55
|
+
5. **Same-origin code has no security boundary.** That is acceptable for code
|
|
56
|
+
the host installs and trusts. Untrusted third-party code needs an iframe
|
|
57
|
+
(Contentful, Forge Custom UI) or remote rendering (Shopify). The contract
|
|
58
|
+
should allow such an isolation tier later without changing.
|
|
59
|
+
|
|
60
|
+
## Decision
|
|
61
|
+
|
|
62
|
+
### 1. One declaration per extension, from the project or the host
|
|
63
|
+
|
|
64
|
+
`createAdminSurface` accepts `extensions: AdminExtension[]`. Each extension
|
|
65
|
+
pairs a declaration, which is plain data, with server handlers, which are
|
|
66
|
+
code:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
{
|
|
70
|
+
apiVersion: 1,
|
|
71
|
+
id: 'access', // kebab-case, unique, immutable once deployed
|
|
72
|
+
title: { en: 'Access', 'zh-TW': '存取權限' },
|
|
73
|
+
source: ACCESS_MODULE, // the module's code; Admin serves it at {basePath}/extensions/access.js
|
|
74
|
+
// or, served by the host instead: module: '/assets/access/admin.js', integrity?: 'sha384-…'
|
|
75
|
+
contributes: {
|
|
76
|
+
pages: [{ id, title, role, nav: { group: 'more' | 'settings', order? } }],
|
|
77
|
+
settings: [{ id, title, role, schema }], // JSON Schema form, no client code
|
|
78
|
+
actions: [{ id, title, role, target, presentation, destructive?, when? }],
|
|
79
|
+
panels: [{ id, title, role, target, when? }],
|
|
80
|
+
fields: [{ id, target, when?, optionsSchema? }],
|
|
81
|
+
},
|
|
82
|
+
handlers: {
|
|
83
|
+
api?(request, { caller, extension, path }): Promise<Response | null>,
|
|
84
|
+
settings?: { [id]: { load(caller), save(caller, value) } },
|
|
85
|
+
actions?: { [id]: { run(caller, { record?, selection?, schema? }) } },
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 1a. Projects author extensions; hosts may add their own
|
|
91
|
+
|
|
92
|
+
Extensions are not a host-only feature. An agent customizing a project's Admin
|
|
93
|
+
is the main author:
|
|
94
|
+
|
|
95
|
+
- A project exports `adminExtensions: AdminExtension[]`. For a new project the
|
|
96
|
+
generated preset writes `src/admin-extensions.ts` and passes it to
|
|
97
|
+
`createAdminSurface`; the preset is written once, so an existing
|
|
98
|
+
`src/service.ts` wires it by hand. A host that builds Admin itself (for example a hosted
|
|
99
|
+
platform) reads the same export and appends its own extensions.
|
|
100
|
+
- Extension ids are one namespace per Admin. A host extension whose id
|
|
101
|
+
collides with a project extension fails construction, so a project can
|
|
102
|
+
never shadow a host page, and the reverse.
|
|
103
|
+
- A module needs no build step: Admin's import map provides React, the kit and
|
|
104
|
+
the extension helper (§4), so plain ESM works. `source` lets Admin serve the
|
|
105
|
+
module itself, so a project needs no static-file setup; Admin computes its
|
|
106
|
+
integrity. The same project shows the same extensions locally and when
|
|
107
|
+
deployed; a host only adds.
|
|
108
|
+
|
|
109
|
+
**Trust.** A project extension's module runs in Admin's origin with the
|
|
110
|
+
viewer's session. That gives it no more power than the project already has:
|
|
111
|
+
whoever can deploy the project already controls its server code, its
|
|
112
|
+
handlers and its storage. Two rules keep that equivalence true:
|
|
113
|
+
|
|
114
|
+
- Host extension routes reachable from a project's Admin origin must act only
|
|
115
|
+
on that project. Anything wider (an organization console, other projects)
|
|
116
|
+
lives on a different origin, so a project module never holds its session.
|
|
117
|
+
- A host that restricts what some staff may do inside a project (fine-grained
|
|
118
|
+
policies) must treat the right to deploy as full trust in that project, and
|
|
119
|
+
govern deployment separately.
|
|
120
|
+
|
|
121
|
+
Contributions and their targets (§1b covers how manifests use them):
|
|
122
|
+
|
|
123
|
+
| Contribution | Targets (`/v1`) | Client code |
|
|
124
|
+
| --- | --- | --- |
|
|
125
|
+
| page | its own route `/admin/x/{extension}/{page}`; in navigation when it declares `nav` | a renderer |
|
|
126
|
+
| settings | its own route `/admin/x/{extension}/{id}`, always in navigation | none. Admin renders `schema` (the form subset) with its form; `load` and `save` run on the server |
|
|
127
|
+
| action | `record/v1` (record header), `list.selection/v1` (bulk), `list.toolbar/v1` | `presentation: 'run' \| 'confirm'` needs none (the server `run` is called). `'dialog'` mounts client code in an Admin dialog |
|
|
128
|
+
| panel | `record.sidebar/v1`, `home/v1` | a renderer |
|
|
129
|
+
| field | `field.input/v1`, `field.cell/v1` | a renderer |
|
|
130
|
+
|
|
131
|
+
`when` is a closed predicate over names only: `{ schema?: string[], field?:
|
|
132
|
+
string[], format?: string[] }`. It contains no expressions and no record
|
|
133
|
+
values, so the server can evaluate it.
|
|
134
|
+
|
|
135
|
+
`role` is the minimum staff role, the same vocabulary as `requires.auth`. It is
|
|
136
|
+
required except on `fields`, where it defaults to `contributor`.
|
|
137
|
+
|
|
138
|
+
### 1b. Manifests pick contributions through `uiSchema`
|
|
139
|
+
|
|
140
|
+
There are two ways to attach a contribution. Both stay:
|
|
141
|
+
|
|
142
|
+
- **From the manifest.** `uiSchema` already chooses Admin presentation
|
|
143
|
+
(`fields.<name>.widget: textarea`, `list.columns`, `collectionAction`).
|
|
144
|
+
It may also name a contribution as `<extension>/<contribution>`:
|
|
145
|
+
|
|
146
|
+
```yaml
|
|
147
|
+
# Schema products
|
|
148
|
+
uiSchema:
|
|
149
|
+
fields:
|
|
150
|
+
color: { widget: brand-kit/color, options: { palette: brand } }
|
|
151
|
+
notes: { widget: textarea }
|
|
152
|
+
list:
|
|
153
|
+
cells: { color: brand-kit/swatch } # field.cell/v1
|
|
154
|
+
panels: [brand-kit/usage] # record.sidebar/v1
|
|
155
|
+
# Procedure reassign-order (uiSchema.fields.<name>.widget works the same)
|
|
156
|
+
# View sales-by-region
|
|
157
|
+
uiSchema:
|
|
158
|
+
list: { cells: { region: maps/region-badge } }
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- The binding sits next to the field it changes. An agent writes both in
|
|
162
|
+
one change, and a manifest review shows it.
|
|
163
|
+
- `options` is passed to the renderer as `ctx.options`. A contribution may
|
|
164
|
+
declare `optionsSchema` (the settings form subset). `options` is checked
|
|
165
|
+
against it, and a contribution without one refuses `options`.
|
|
166
|
+
- The target kind must match the key: `fields.*.widget` names a
|
|
167
|
+
`field.input/v1` contribution, `list.cells.*` a `field.cell/v1`
|
|
168
|
+
contribution, and `panels` a `record.sidebar/v1` contribution.
|
|
169
|
+
- **From the extension.** `when: { schema, field, format }` attaches a
|
|
170
|
+
contribution everywhere it matches without touching manifests, for example
|
|
171
|
+
every field with `x-mcp-hint: money-minor`. This suits host extensions and
|
|
172
|
+
cross-cutting widgets.
|
|
173
|
+
|
|
174
|
+
When both apply to one place, the manifest wins.
|
|
175
|
+
|
|
176
|
+
**Validation.**
|
|
177
|
+
- The manifest grammar checks the shape: `<extension>/<contribution>` with
|
|
178
|
+
kebab-case parts. `textarea` stays the one built-in widget.
|
|
179
|
+
- Whether the named contribution exists, has the right target and accepts the
|
|
180
|
+
`options` is checked where the plan and the extensions meet:
|
|
181
|
+
- `createAdminSurface` fails construction with `UI_EXTENSION_UNKNOWN`,
|
|
182
|
+
`UI_EXTENSION_TARGET` or `UI_EXTENSION_OPTIONS`.
|
|
183
|
+
- `checkPlanUiExtensions(plan, extensions)` is exported, so a deploy step or
|
|
184
|
+
a test can run the same check before the service starts.
|
|
185
|
+
|
|
186
|
+
**Who may be named.** A manifest should name only the project's own
|
|
187
|
+
extensions, so the project renders the same locally and when deployed; a host
|
|
188
|
+
attaches its contributions with `when` instead. Core cannot enforce this: the
|
|
189
|
+
extensions reach `createAdminSurface` as one list with no provenance, so it
|
|
190
|
+
checks existence, target and options, not ownership. A host that must keep
|
|
191
|
+
manifests from naming its contributions checks the plan's names
|
|
192
|
+
(`planUiExtensionRefs`) against its own ids before it starts Admin.
|
|
193
|
+
|
|
194
|
+
**A named widget is a decision.** When `uiSchema.fields.<name>.widget` names
|
|
195
|
+
any widget, `textarea` included, a matching `when` does not replace it; a
|
|
196
|
+
contribution the viewer's role does not reach falls back to Admin's own
|
|
197
|
+
control, not to `when`.
|
|
198
|
+
|
|
199
|
+
**Effect.** `uiSchema` stays presentation only. It never changes validation,
|
|
200
|
+
MCP schemas or authorization. The field's JSON Schema still validates what a
|
|
201
|
+
widget sends.
|
|
202
|
+
|
|
203
|
+
### 2. The server decides what a caller sees, and checks again on use
|
|
204
|
+
|
|
205
|
+
- `GET /admin/api/site` (and bootstrap's `site`) returns the contributions
|
|
206
|
+
the caller's role reaches, with their declarations only. Handlers and
|
|
207
|
+
`integrity` are not sent.
|
|
208
|
+
- Every extension route checks a signed-in staff session and the
|
|
209
|
+
contribution's role before it calls the host:
|
|
210
|
+
- `{basePath}/api/x/{extension}/settings/{id}`: `GET` → `load`, `PATCH { value }` → `save`
|
|
211
|
+
- `{basePath}/api/x/{extension}/actions/{id}`: `POST` → `run`, with `{ record }`, `{ selection }` or `{ schema }` for the action's target; `when.schema` is enforced here too
|
|
212
|
+
- `{basePath}/api/x/{extension}/api/{path}` → `api`, for the extension's lowest contribution role
|
|
213
|
+
- `GET {basePath}/extensions/{id}.js` → a `source` extension's module, for the same role
|
|
214
|
+
- `save` input is validated against `schema` before the host sees it (400 with
|
|
215
|
+
`error.fields` otherwise).
|
|
216
|
+
- `null` answers 404. Answers are `no-store` unless the host sets
|
|
217
|
+
`cache-control`. Cross-site mutation protection is the `withCaller`
|
|
218
|
+
wrapper's, as for every Admin route.
|
|
219
|
+
- The checks above are the minimum. Finer authorization is the host's, inside
|
|
220
|
+
its handlers.
|
|
221
|
+
|
|
222
|
+
### 3. Client modules supply renderers keyed by contribution id
|
|
223
|
+
|
|
224
|
+
```ts
|
|
225
|
+
import { defineAdminExtension } from '@aotter/mantle-ui/extension'
|
|
226
|
+
|
|
227
|
+
export default defineAdminExtension({
|
|
228
|
+
pages: { overview: (element, ctx) => cleanup },
|
|
229
|
+
actions: { 'reassign': (element, ctx) => cleanup }, // dialog presentation only
|
|
230
|
+
panels: { 'history': (element, ctx) => cleanup },
|
|
231
|
+
fields: { 'color': (element, ctx) => ({ update(next) {}, unmount() {} }) },
|
|
232
|
+
})
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
A renderer returns nothing, a cleanup, or `{ update, unmount }`. With `update`,
|
|
236
|
+
Admin passes later contexts (a new value, a new language) in place instead of
|
|
237
|
+
mounting again; a field value the renderer reported itself never remounts it.
|
|
238
|
+
|
|
239
|
+
- Admin imports `module` once, when a contribution that needs it is first
|
|
240
|
+
shown, and calls the renderer for that contribution.
|
|
241
|
+
- A renderer for an undeclared contribution is ignored. A declared
|
|
242
|
+
contribution without a renderer shows an error in its place.
|
|
243
|
+
- The context is serializable and typed per target. It holds `{ extension,
|
|
244
|
+
contribution, apiBase, language, theme, caller: { role } }` plus:
|
|
245
|
+
- `record: { schema, id, version }` for record targets
|
|
246
|
+
- `selection: { schema, ids }` for list targets
|
|
247
|
+
- `field: { schema, name, value, readOnly, property }` for field targets,
|
|
248
|
+
and `options` from `uiSchema`; `field.input/v1` also gets `onChange(value)`
|
|
249
|
+
- A small `host` object offers `navigate(path)`, `notify(message)` and
|
|
250
|
+
`close()` for dialogs.
|
|
251
|
+
- Admin offers no other SPA API. This is a supported surface, not a sandbox:
|
|
252
|
+
the module is trusted same-origin code (§5).
|
|
253
|
+
- Each mount gets a fresh element. A renderer that resolves after its mount was
|
|
254
|
+
replaced writes into a detached node, never over the current one.
|
|
255
|
+
|
|
256
|
+
### 4. Shared dependencies come from Admin
|
|
257
|
+
|
|
258
|
+
- Admin's HTML declares an import map for `react`, `react/jsx-runtime`,
|
|
259
|
+
`react-dom`, `react-dom/client`, `@aotter/mantle-ui/kit` and
|
|
260
|
+
`@aotter/mantle-ui/extension`, served beside the shell. The React entries
|
|
261
|
+
re-export Admin's own instance; the kit and the helper are real modules
|
|
262
|
+
that import React through the same map, and the kit's stylesheet loads with
|
|
263
|
+
the first extension.
|
|
264
|
+
- Extension modules use these specifiers directly (or mark them external when
|
|
265
|
+
bundling). They share Admin's single React and keep its look, theme and
|
|
266
|
+
accessibility.
|
|
267
|
+
- The kit and the extension helper are the whole public UI surface. The shell
|
|
268
|
+
stays private (ADR-lite 909).
|
|
269
|
+
|
|
270
|
+
### 5. Trust tier
|
|
271
|
+
|
|
272
|
+
- Extensions are trusted host code. They run in Admin's origin with Admin's
|
|
273
|
+
privileges, and Core does not sandbox them.
|
|
274
|
+
- `module` must be a same-origin path, so Admin keeps its existing CSP and
|
|
275
|
+
framing policy.
|
|
276
|
+
- `integrity` (given for `module`, computed for `source`) goes into the
|
|
277
|
+
shell's import map, so the browser enforces it on import.
|
|
278
|
+
- An isolated tier for untrusted extensions is reserved and is not part of
|
|
279
|
+
this decision. Because contexts are serializable and the UI surface is the
|
|
280
|
+
kit, an iframe or remote-rendering tier can reuse this declaration format
|
|
281
|
+
unchanged.
|
|
282
|
+
|
|
283
|
+
### 6. Stability and tooling
|
|
284
|
+
|
|
285
|
+
- `apiVersion` and the `/v1` target names version the contract. Within a
|
|
286
|
+
version, changes are additive only. A breaking change adds `/v2`, and both
|
|
287
|
+
run side by side through a deprecation window.
|
|
288
|
+
- Construction validates every declaration and fails on:
|
|
289
|
+
- a bad or duplicate id
|
|
290
|
+
- an unknown target or `apiVersion`
|
|
291
|
+
- a non-same-origin `module`, or both `module` and `source`
|
|
292
|
+
- a contribution that needs code when there is neither
|
|
293
|
+
- a settings `schema` outside the form subset
|
|
294
|
+
- Core exports the declaration's JSON Schema, so tooling and agents can check
|
|
295
|
+
a declaration without running it.
|
|
296
|
+
- Core also exports `diffAdminExtensions(previous, next)`. It reports added
|
|
297
|
+
and removed contributions, role changes and module changes, for review
|
|
298
|
+
screens.
|
|
299
|
+
|
|
300
|
+
## Non-goals
|
|
301
|
+
|
|
302
|
+
- Replacing the shell, navigation component or layout.
|
|
303
|
+
- Free-form injection into arbitrary DOM.
|
|
304
|
+
- A marketplace or untrusted third-party extensions (reserved tier, above).
|
|
305
|
+
- Server-side sandboxing of handlers. They are host code in the host's
|
|
306
|
+
process.
|
|
307
|
+
- Declaring extensions in the YAML manifest. They live in the project's
|
|
308
|
+
service module (TypeScript), so the four-atom grammar does not change.
|
|
309
|
+
|
|
310
|
+
## Consequences
|
|
311
|
+
|
|
312
|
+
- Projects and hosts add pages, settings, actions, panels and field widgets
|
|
313
|
+
without forking the SPA, and the SPA stays one build. Without
|
|
314
|
+
`extensions`, nothing changes.
|
|
315
|
+
- An agent can customize a project's Admin with a small module and a
|
|
316
|
+
declaration that tooling validates and diffs before deploy. A `uiSchema`
|
|
317
|
+
line in the manifest binds it to a field, a list cell or a record panel.
|
|
318
|
+
- The `uiSchema` vocabulary widens: `fields.<name>.widget` accepts
|
|
319
|
+
`<extension>/<contribution>` beside `textarea`, with `options`; Schemas gain
|
|
320
|
+
`list.cells` and `panels`; staff Views gain `list.cells`. This record is the
|
|
321
|
+
grammar decision CONTRIBUTING requires for new keys: the name's shape is
|
|
322
|
+
closed and checked at generate time (`SCHEMA_UI_INVALID`,
|
|
323
|
+
`VIEW_UI_INVALID`), and its existence at construction
|
|
324
|
+
(`UI_EXTENSION_UNKNOWN`, `UI_EXTENSION_TARGET`, `UI_EXTENSION_OPTIONS`).
|
|
325
|
+
- Settings pages need no client code at all. This covers most host
|
|
326
|
+
configuration screens and is the easiest kind for an agent to author and
|
|
327
|
+
review.
|
|
328
|
+
- Admin takes on an import map and the `@aotter/mantle-ui/extension` entry.
|
|
329
|
+
- The first draft's `extensions: { pages, api }` is replaced before any
|
|
330
|
+
release; it was never published.
|
|
@@ -321,7 +321,24 @@ Points worth noticing:
|
|
|
321
321
|
- **`expired-orders` is `internal`:** callable only through
|
|
322
322
|
`ctx.store.view` or `runtime.store`. SQL compares `expiresAt` with `now()`.
|
|
323
323
|
- **`picking-list`** unnests order lines with `json_each`, the one comma join
|
|
324
|
-
the dialect allows.
|
|
324
|
+
the D1 dialect allows. This example's SQL is D1 (SQLite) SQL. On PostgreSQL
|
|
325
|
+
the same View reads:
|
|
326
|
+
|
|
327
|
+
```sql
|
|
328
|
+
SELECT o.orderToken, o.customerName, o.shippingAddress,
|
|
329
|
+
item.value ->> 'productSlug' AS "productSlug",
|
|
330
|
+
item.value ->> 'title' AS "productTitle",
|
|
331
|
+
item.value ->> 'quantity' AS quantity
|
|
332
|
+
FROM orders o, jsonb_array_elements(o.items) WITH ORDINALITY AS item(value, n)
|
|
333
|
+
WHERE o.orderStatus = 'paid'
|
|
334
|
+
ORDER BY o.created_at, item.n LIMIT 200
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
`jsonb_array_elements_text(o.items) WITH ORDINALITY AS j(value, n)` is the
|
|
338
|
+
form for text elements. A sorted View over a row source needs the alias and
|
|
339
|
+
`WITH ORDINALITY`; Mantle pages by `n`. The
|
|
340
|
+
[rewrite table](../handbook/concepts/runtime-and-adapters.md#the-postgresql-dialect)
|
|
341
|
+
lists the other SQLite spellings PostgreSQL refuses.
|
|
325
342
|
|
|
326
343
|
## Handlers
|
|
327
344
|
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"check": "mantle generate && mantle generate --check && tsc --noEmit && node smoke.mjs"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@aotter/mantle": "0.2.0-alpha.
|
|
12
|
-
"@aotter/mantle-ui": "0.2.0-alpha.
|
|
11
|
+
"@aotter/mantle": "0.2.0-alpha.6",
|
|
12
|
+
"@aotter/mantle-ui": "0.2.0-alpha.6",
|
|
13
13
|
"@better-auth/cimd": "1.7.7",
|
|
14
14
|
"@better-auth/mcp": "1.7.7",
|
|
15
15
|
"@better-auth/oauth-provider": "1.7.7",
|
|
@@ -35,9 +35,9 @@ preset does); without Admin it is `/oauth/consent`, the plain page
|
|
|
35
35
|
then `createCallerResolver(auth, { jwtBearer: { audience: `${origin}/mcp`, scopes: ["mcp"] } })`,
|
|
36
36
|
`createAuthRoutes(auth, { resolver })` and an `AdminIdentity` over the auth's
|
|
37
37
|
own methods. With dialect `postgres` the preset passes `database:
|
|
38
|
-
pgPool(connect), driver: pgDatabaseDriver(connect)`
|
|
39
|
-
|
|
40
|
-
`Database` and `bunSqliteDriver(db)
|
|
38
|
+
pgPool(connect), driver: pgDatabaseDriver(connect)` on both hosts (Hyperdrive on
|
|
39
|
+
`cloudflare`, a `pg.Pool` on `bun`); host `bun` over SQLite passes the bun:sqlite
|
|
40
|
+
`Database` and `bunSqliteDriver(db)`, with `ipAddressHeaders:
|
|
41
41
|
["x-mantle-client-ip"]`, which its entry sets from the socket.
|
|
42
42
|
|
|
43
43
|
### Local sign-in
|
|
@@ -16,7 +16,10 @@ pnpm exec wrangler deploy
|
|
|
16
16
|
|
|
17
17
|
With dialect `postgres`, create the Hyperdrive config instead of the D1
|
|
18
18
|
database (`pnpm exec wrangler hyperdrive create my-service --caching-disabled
|
|
19
|
-
--connection-string=…`) and copy its id into `hyperdrive[0].id`.
|
|
19
|
+
--connection-string=…`) and copy its id into `hyperdrive[0].id`. Give the
|
|
20
|
+
role a statement limit and UTC, which boot checks (`ALTER ROLE app SET
|
|
21
|
+
statement_timeout = '10s'; ALTER ROLE app SET TimeZone = 'UTC'`); the boot
|
|
22
|
+
error names any other setting to change.
|
|
20
23
|
|
|
21
24
|
Set `PUBLIC_ORIGIN` in `wrangler.jsonc` `vars` to the deployed origin, and
|
|
22
25
|
replace the console email sender first
|