@aotter/mantle 0.1.2-alpha.1 → 0.1.2-alpha.2

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.
@@ -113,6 +113,14 @@ function schemaLines(name, namespace) {
113
113
  ` runtime.createDraft.execute({ ...request, collection: ${JSON.stringify(name)}, data: request.data as unknown as Record<string, unknown> }),`,
114
114
  ` get: (request: Omit<Parameters<CoreMantleRuntime["getEntry"]["execute"]>[0], "collection">) =>`,
115
115
  ` runtime.getEntry.execute({ ...request, collection: ${JSON.stringify(name)} }),`,
116
+ ` updateDraft: (request: Omit<Parameters<CoreMantleRuntime["updateDraft"]["execute"]>[0], "collection">) =>`,
117
+ ` runtime.updateDraft.execute({ ...request, collection: ${JSON.stringify(name)} }),`,
118
+ ` requestPublish: (request: Omit<Parameters<CoreMantleRuntime["requestPublish"]["execute"]>[0], "collection">) =>`,
119
+ ` runtime.requestPublish.execute({ ...request, collection: ${JSON.stringify(name)} }),`,
120
+ ` unpublish: (request: Omit<Parameters<CoreMantleRuntime["unpublish"]["execute"]>[0], "collection">) =>`,
121
+ ` runtime.unpublish.execute({ ...request, collection: ${JSON.stringify(name)} }),`,
122
+ ` archive: (request: Omit<Parameters<CoreMantleRuntime["archive"]["execute"]>[0], "collection">) =>`,
123
+ ` runtime.archive.execute({ ...request, collection: ${JSON.stringify(name)} }),`,
116
124
  ` list: (request: Omit<Parameters<CoreMantleRuntime["listEntries"]["execute"]>[0], "collection"> = {}) =>`,
117
125
  ` runtime.listEntries.execute({ ...request, collection: ${JSON.stringify(name)} }),`,
118
126
  ` delete: (request: Omit<Parameters<CoreMantleRuntime["deleteEntry"]["execute"]>[0], "collection">) =>`,
@@ -1 +1 @@
1
- {"version":3,"file":"emitMantleModule.js","sourceRoot":"","sources":["../../src/codegen/emitMantleModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,GAGnB,MAAM,qBAAqB,CA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C,IAAI,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,WAAW,CAAC,CAAS,EAAE,CAAS;IACvC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IAChD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACvC,KAAK,KAAK,CAAC;QACT,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAC3C,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACX,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;AAC5D,CAAC"}
@@ -82,8 +82,9 @@ The prepared revision carries its exact plan, but exposes both `plan` and
82
82
  capabilities. Omit `handlerNames` only for a read-only embedding that never
83
83
  dispatches Procedures.
84
84
 
85
- The official SQLite adapter runs canonical migrations, defaults, indexes, and
86
- schema-View reconciliation, and skips mutation for an unchanged revision. A
85
+ The official SQLite adapter runs canonical migrations, materializes one native
86
+ table per Schema, prepares indexes and Views, and skips mutation for an
87
+ unchanged storage revision. A
87
88
  custom adapter owns its own preparation and returns application-owned semantic
88
89
  ports. Unsupported native View dialects fail before the adapter mutates state.
89
90
 
@@ -1,6 +1,8 @@
1
1
  # ADR-0010: Locale three-layer model and parent/child translates pattern
2
2
 
3
- **Status:** Carried over from POC v0.0.x; refreshed for v0.1.0.
3
+ **Status:** Carried over from POC v0.0.x; storage details superseded by
4
+ [ADR-0024](0024-manifest-native-schema-tables.md). Locale semantics remain in
5
+ force, but `locale` is now a native field on each localized Schema table.
4
6
 
5
7
  **Date**: 2026-05-01 (POC) / refreshed 2026-05-03 (v0.1.0 rebuild)
6
8
 
@@ -122,18 +124,18 @@ canonicalize-on-write keeps the cold-start path free of ceremony and
122
124
  lets the manifest, the CmsConfig, and the D1 row drift apart safely
123
125
  (the runtime gate in Layer 3 is what reconciles them).
124
126
 
125
- ### Layer 3 — Per-entry data (`data.locale`)
127
+ ### Layer 3 — Per-entry data (`locale`)
126
128
 
127
129
  ```jsonc
128
- // entries.data for a localized Schema
130
+ // a localized Schema record
129
131
  { "title": "...", "body": "...", "locale": "zh-TW" }
130
132
 
131
- // entries.data for a non-localized Schema
133
+ // a non-localized Schema record
132
134
  { "name": "...", "color": "..." } // no locale field
133
135
  ```
134
136
 
135
- - There is no top-level `entries.locale` column. Locale lives inside
136
- the `data` JSON.
137
+ - There is no shared `entries.locale` column. `locale` is the authored native
138
+ field on each localized Schema table.
137
139
  - The runtime locale gate (in `mantle-runtime`'s content-ops
138
140
  `helpers.ts`) is the **authoritative per-request check**. On every
139
141
  read and write the gate validates:
@@ -145,10 +147,8 @@ lets the manifest, the CmsConfig, and the D1 row drift apart safely
145
147
  - `localized: false` Schema → `data.locale` MUST be absent
146
148
  (`null` is treated as absent and stripped on the read path; any
147
149
  other value is rejected to catch typos like `locaIe: en`).
148
- - Indexed via virtual generated column + partial unique index on
149
- `json_extract(data, '$.locale')`, scoped to the Schema's
150
- `collection`. Same pattern as `Schema.spec.unique`. Created only
151
- for localized Schemas; non-localized Schemas have no locale index.
150
+ - Indexed directly on the localized Schema table. Non-localized Schemas have
151
+ no locale field or locale index.
152
152
 
153
153
  The boot/runtime split is the load-bearing change carried over from
154
154
  the POC's issue #60 fix (POC PR #71, plus the canonicalize follow-up
@@ -310,10 +310,8 @@ Validation rules introduced:
310
310
  must resolve all Schema names before checking `translates.parent`
311
311
  references. The two-pass pattern (collect names → check references)
312
312
  handles this; it's just one more reference type.
313
- - **Index pattern adds DDL complexity.** Virtual generated columns +
314
- partial unique indexes per Schema means the migration emitter
315
- generates more SQL than before. Acceptable given the pattern is
316
- already used by `Schema.spec.unique`.
313
+ - **Index pattern adds DDL complexity.** Each localized native Schema table
314
+ needs its declared locale index. The migration artifact owns that SQL.
317
315
  - **Two places define "what locales exist."** Manifest declares
318
316
  `localized: true`; D1 declares which actual locales the site
319
317
  serves. The runtime gate reconciles them; if they drift, the gate
@@ -444,8 +442,8 @@ for `createCmsRuntime().bootInit()` + `DatabaseSiteConfigRepository.seed`):
444
442
  - Grammar in `packages/mantle-spec/src/domain/model/ManifestGrammar.ts`
445
443
  + the manifest parser.
446
444
  - Cross-Schema validation in the validate + boot phases.
447
- - D1 schema: no `entries.locale` column; `data.locale` is the
448
- authoritative storage; partial unique index per localized Schema.
445
+ - D1 schema: no shared `entries.locale` column; each localized native Schema
446
+ table owns its `locale` field and declared index.
449
447
  - `site_config` key/value table with the `locales` key.
450
448
  - Runtime locale gate in `packages/mantle-runtime/src/domain/service/ContentLocaleGate.ts`.
451
449
  - `CmsConfig.siteDefaults` consumed by runtime `bootInit()`, with
@@ -1,6 +1,7 @@
1
1
  # ADR-0011: Adapter port spec
2
2
 
3
- **Status:** Superseded for Core storage and Admin composition by ADR-0019.
3
+ **Status:** Superseded for Core storage and Admin composition by ADR-0019 and
4
+ for SQLite/D1 physical storage by ADR-0024.
4
5
  Retained as the alpha.7 Cloudflare adapter record; `DatabaseDriver` is now an
5
6
  implementation detail of the SQLite/D1 `MantleStorageAdapter`, while the asset
6
7
  contract belongs to optional `@aotter/mantle-admin`.
@@ -69,7 +69,7 @@ semantic fingerprint.
69
69
  | Parse + normalize | YAML syntax/alias limits, closed four-atom shape, primitive and atom-local rules, behavior-affecting defaults, source metadata | Cross-atom references, handlers, storage, optional routes |
70
70
  | Link | Duplicate symbols, cross-atom references, guard graphs, translations, manifest-owned route/tool collisions | I/O, selected modules, handler availability |
71
71
  | Compile | Immutable lookup records, authorization plans, Trigger indices, Procedure descriptors, logical View plans, semantic fingerprint | Connections, repositories, handlers, requests, templates, assets |
72
- | Prepare | Selected storage migrations/indexes/native Views, handler availability, selected capability/route checks, readiness revision | YAML interpretation or request execution |
72
+ | Prepare | Selected storage migrations/native Schema tables and indexes/prepared Views, handler availability, selected capability/route checks, readiness revision | YAML interpretation or request execution |
73
73
  | Bind/invoke | Semantic ports, handler dispatch, parameter binding, centralized authorization, content/View/Procedure/Trigger/lifecycle operations | DDL, route mounting, assets, HTTP/session/cache policy |
74
74
  | Optional modules/adapters | Web/Admin composition and request/session/cache/platform translation | Re-parsing, re-linking, or a second authorization/runtime stack |
75
75
 
@@ -0,0 +1,260 @@
1
+ # ADR-0024: Materialize each Schema as a native storage table
2
+
3
+ **Status:** Accepted
4
+
5
+ **Date:** 2026-09-18
6
+
7
+ **Related:** ADR-0010, ADR-0011, ADR-0019, ADR-0020, ADR-0022, ADR-0023
8
+
9
+ ## Context
10
+
11
+ The SQLite adapter currently stores every Schema row in one `entries` table.
12
+ Business fields live in a JSON `data` column. Schema indexes add generated
13
+ columns and partial indexes to that shared table, and Schema-shaped SQL views
14
+ project JSON fields back into columns.
15
+
16
+ That layout made the first dynamic runtime small, but it is now the wrong
17
+ authority for a manifest-built system:
18
+
19
+ - a successfully built Manifest already fixes every Schema and field type;
20
+ - generated columns for every historical indexed field accumulate on one
21
+ table, while D1 allows at most 100 columns per table;
22
+ - native SQL, inspection, export, and migration tooling see an implementation
23
+ envelope instead of the authored data model;
24
+ - application migrations and Mantle's canonical `entries` migrations form two
25
+ persistence systems;
26
+ - the compatibility layer is now larger than direct table CRUD.
27
+
28
+ Mantle has not shipped a stable storage format. Keeping the generic table for
29
+ downward compatibility would create the dual path this change is intended to
30
+ remove.
31
+
32
+ ## Decision
33
+
34
+ ### One physical table per Schema
35
+
36
+ The SQLite/D1 storage adapter materializes every compiled Schema as a quoted
37
+ native table. The table contains:
38
+
39
+ - Mantle columns: `_mantle_id`, `_mantle_status`, `_mantle_version`,
40
+ `_mantle_created_at`, `_mantle_updated_at`, and `_mantle_author_id`;
41
+ - one column for every top-level Schema property;
42
+ - native indexes for every `indexes` and `uniqueIndexes` tuple.
43
+
44
+ Single scalar JSON Schema types map to SQLite affinities: string to `TEXT`,
45
+ integer and boolean to `INTEGER`, and number to `REAL`. Objects, arrays, unions,
46
+ and otherwise polymorphic values use `TEXT` containing canonical JSON so a
47
+ round trip cannot change their JSON type. Nullable values use SQL `NULL`.
48
+
49
+ Business columns remain nullable at the database layer. Mantle allows an
50
+ incomplete authoring draft; Runtime validation enforces required fields when a
51
+ record becomes complete or when an operational Schema is written. An optional
52
+ nullable property reads as `null` when its column is null. This is the v0.1
53
+ native-table contract; it intentionally does not preserve a distinction
54
+ between an absent optional nullable field and an explicit null.
55
+
56
+ Schema names and field names remain authored wire names and are always SQL
57
+ identifier quoted. A Schema table uses its authored Schema name. SQLite
58
+ preparation rejects collisions with selected infrastructure tables or views,
59
+ including auth tables; this check belongs to the concrete deployment because
60
+ the portable Manifest cannot know which optional infrastructure a host binds.
61
+ Internal Mantle tables and columns use the reserved `_mantle_` prefix. The
62
+ prefix prevents Mantle metadata from stealing ordinary authored names such as
63
+ `id`, `status`, or `createdAt`.
64
+
65
+ The SQLite adapter no longer creates `entries`, generated field columns, or
66
+ Schema projection views. There is no dual write, compatibility view, or
67
+ fallback JSON repository.
68
+
69
+ ### The compiled storage plan owns DDL
70
+
71
+ SQLite preparation lowers the Schemas already present in the sealed
72
+ `RuntimePlan` into quoted DDL and prepared queries. A persistence-only
73
+ projection of those Schemas has a deterministic storage fingerprint; changes
74
+ to Procedures, Views, or Triggers do not create a storage revision. No second
75
+ physical-plan model mirrors `RuntimePlan`.
76
+
77
+ Other adapters map the same Schema manifests into their own native storage.
78
+ Runtime continues to consume semantic `EntryRepository`,
79
+ `EntryReader`, and `ViewQueryExecutor` ports; SQL remains infrastructure.
80
+
81
+ Repository operations that address one row carry its Schema collection.
82
+ `get(id)` and `readById(id)` become collection-qualified operations. Generated
83
+ bindings hide this argument behind Schema-specific APIs. Runtime operations
84
+ already know the target Schema from their compiled handler, route, or row
85
+ context; callers must not search every table for an unqualified id.
86
+
87
+ Cross-Schema reads are compiled explicitly from the Runtime plan. There is no
88
+ implicit union of all tables. A caller that needs several Schemas invokes the
89
+ declared Views or Schema-specific readers and combines their results at the
90
+ application layer.
91
+
92
+ ### Migrations are build artifacts
93
+
94
+ The SQLite build compares a stored source Schema description with the target
95
+ RuntimePlan and emits a versioned SQL migration artifact containing:
96
+
97
+ - source and target storage fingerprints;
98
+ - ordered SQLite SQL;
99
+ - a checksum over the exact migration content;
100
+ - whether the change is expand-only or destructive.
101
+
102
+ Mantle deterministically emits initial tables and safe additive changes. Field
103
+ renames, type conversions, data transforms, and narrowing constraints are
104
+ destructive in the pre-beta contract. Cloud rejects them; operators rebuild the
105
+ database and move required data manually outside Mantle and Control. Production
106
+ neither generates nor accepts arbitrary migration SQL.
107
+
108
+ Preparation records applied migration ids in the existing `_migrations` ledger.
109
+ The enclosing immutable artifact checksum protects the ordered SQL,
110
+ fingerprints, and target projections. Preparation rejects an unknown source
111
+ fingerprint, changed artifact checksum, skipped revision, or target mismatch.
112
+ Generated migrations are idempotent and retryable after partial application;
113
+ activation and integrity verification run on every attempt instead of being
114
+ treated as one-time ledger entries.
115
+
116
+ Generated migrations quote all identifiers and never interpolate runtime
117
+ input. Automatic deployments retain removed fields, indexes, and tables as a
118
+ physical superset; logical reads follow the selected plan, while retained
119
+ storage keeps the previous Worker rollback-compatible.
120
+
121
+ ### Builder support
122
+
123
+ Builder keeps its in-memory or IndexedDB semantic adapter for interactive
124
+ preview. It does not carry SQLite into portable Runtime.
125
+
126
+ Each successful build can show a draft-to-draft storage delta for authoring
127
+ feedback. It is not labeled as the deployment artifact: only Cloud knows the
128
+ last successfully deployed source revision and produces the exact immutable
129
+ artifact used by deployment. The publish result shows its source/target
130
+ fingerprints, risk classification, ordered SQL, and checksum.
131
+ The interactive preview continues to run the real Mantle Runtime over the
132
+ existing IndexedDB semantic adapter; it does not carry a second SQLite runtime
133
+ or copy preview data into one. Destructive changes remain previewable but are
134
+ not deployable on the pre-beta Cloud path.
135
+
136
+ CI executes generated SQL against SQLite. Mantle Cloud/D1 is authoritative at
137
+ deployment: it checks the immutable artifact, migration ledger, source/target
138
+ fingerprints, database integrity, and canary before restoring traffic. Running
139
+ the same DDL in every Builder browser would duplicate those gates while adding
140
+ WASM weight and a second Worker/browser compatibility surface.
141
+
142
+ Unsaved invalid Manifest edits produce diagnostics and no storage revision.
143
+ Intermediate Builder edits do not become production migrations. Deployment
144
+ diffs the last deployed storage revision against the selected project revision.
145
+
146
+ ### Cloud runtime and Schema upgrades
147
+
148
+ Every Cloud deployment pins these immutable identities:
149
+
150
+ - Mantle runtime release;
151
+ - project revision and compiled plan fingerprint;
152
+ - source and target storage fingerprints;
153
+ - migration checksum;
154
+ - application artifact checksum.
155
+
156
+ Automatic migrations are expand-only and therefore run online. The deployment
157
+ sequence is:
158
+
159
+ 1. verify the current tenant D1 storage fingerprint;
160
+ 2. apply idempotent additive DDL and verify the ledger, marker, and integrity;
161
+ 3. upload an immutable Worker script named by project revision;
162
+ 4. run the canary directly against that script and the actual D1 marker;
163
+ 5. select that revision for the default and custom host routes;
164
+ 6. record the revision active.
165
+
166
+ There is no KV maintenance gate: KV propagation cannot drain in-flight writes,
167
+ and additive DDL does not need one. Destructive changes stop before deployment.
168
+ The old revision script remains addressable, so route failure or operator
169
+ rollback selects the previous script without rebuilding or replacing it.
170
+
171
+ Automatic deployments retain old columns and tables needed by the previous
172
+ active Worker. This keeps code rollback valid. Physical cleanup happens only
173
+ during a later reset or rebuild. Mantle runtime upgrades use the same mechanism
174
+ even when the authored Manifest does not change.
175
+
176
+ Release and application objects are content-addressed. A retry validates and
177
+ reads the same bytes selected by the original operation; mutable release names
178
+ are not valid deployment input.
179
+
180
+ ## Consequences
181
+
182
+ ### Positive
183
+
184
+ - D1, SQLite tools, generated types, and the Manifest describe the same tables.
185
+ - Each Schema gets independent native limits, indexes, query plans, and schema
186
+ evolution.
187
+ - The shared-table column ceiling and permanent generated-column buildup are
188
+ removed.
189
+ - Application migrations and Mantle runtime upgrades use one revision model.
190
+ - Removing the compatibility repository leaves less persistence code.
191
+
192
+ ### Negative
193
+
194
+ - This is a storage-format break and requires coordinated changes across Spec,
195
+ Runtime, SQLite adapters, conformance tests, Builder, and Cloud deployment.
196
+ - Unqualified global entry lookups and implicit cross-Schema lists disappear.
197
+ - Optional nullable fields no longer distinguish absent from explicit null.
198
+ - Destructive schema changes require a manual rebuild and data move outside
199
+ Mantle and Control.
200
+
201
+ ## Alternatives
202
+
203
+ ### Keep `entries` and improve its generated indexes
204
+
205
+ Rejected. It preserves the shared table's column ceiling, JSON inspection
206
+ surface, and a second schema representation after Manifest build already knows
207
+ the physical model.
208
+
209
+ ### Keep `entries` as a registry beside native Schema tables
210
+
211
+ Rejected. A registry adds dual-write atomicity and stale-index failure modes.
212
+ Schema-qualified access removes the need for it.
213
+
214
+ ### Put SQLite WASM in the portable Runtime
215
+
216
+ Rejected. Runtime already has a semantic storage boundary. Builder can verify
217
+ the SQLite lowering as a build check without making every adapter or browser
218
+ preview depend on SQLite.
219
+
220
+ ### Generate production migrations at deploy time
221
+
222
+ Rejected. Deployment must execute an immutable reviewed artifact and remain
223
+ deterministic when retried. AI generation belongs before review, not inside a
224
+ production mutation.
225
+
226
+ ## How to apply
227
+
228
+ 1. Add the sealed physical storage plan and SQLite DDL lowering.
229
+ 2. Change semantic row operations to require collection identity and update all
230
+ first-party callers.
231
+ 3. Replace the shared SQLite repository and View compiler with native-table
232
+ implementations; delete shared-table DDL, views, index reconciliation, and
233
+ compatibility helpers.
234
+ 4. Update memory and IndexedDB adapters to the new semantic port shape.
235
+ 5. Add build-time migration diff/artifact inspection, plus SQLite execution in
236
+ CI and Cloud/D1 deployment verification.
237
+ 6. Pin content-addressed runtime, storage, migration, application, and Worker
238
+ revision identities in Cloud deploys; test initial deploy, additive Schema
239
+ change, runtime-only upgrade, partial migration retry, and route rollback.
240
+ 7. Update all public storage, Schema, Builder, deployment, and migration
241
+ documentation after the conformance and consumer checks pass.
242
+
243
+ ## Decision review
244
+
245
+ Reviewed after implementation against ADR-0019, the semantic storage ports,
246
+ Builder preview persistence, and Mantle Cloud's retryable deployment state.
247
+ The review found and corrected three boundary mistakes before acceptance:
248
+
249
+ - authored data may legitimately contain `id`, `status`, or `createdAt`, so
250
+ physical envelope columns require the `_mantle_` prefix;
251
+ - Builder should expose draft storage risk without pretending it knows the
252
+ deployed baseline; Cloud shows the exact immutable artifact, while CI and
253
+ Cloud/D1 own executable DDL verification and preview stays on IndexedDB;
254
+ - Cloud must pin the runtime release and storage artifact selected when the
255
+ operation starts; a mutable current release would make retry and rollback
256
+ nondeterministic.
257
+
258
+ The native-table path is implemented without a compatibility `entries` table.
259
+ Acceptance is gated by the repository consumer check and the Cloud upgrade,
260
+ retry, and rollback checks in the ADR's final application step.
@@ -23,6 +23,7 @@ Records of *why* mantle ended up shaped this way. The numbering preserves POC AD
23
23
  | [0020](0020-builtin-handler-contracts-and-matched-upsert.md) | Static builtin handler contracts and natural-key matched upsert (`handler.match`). | Accepted + amended by 0022 |
24
24
  | [0021](0021-retire-starter-scaffolding.md) | Direct authoring; retire Starter scaffolding. | Accepted; supersedes 0018 |
25
25
  | [0022](0022-caller-observed-version-occ.md) | Caller-observed `expectedVersion` for Admin bind and builtin upsert OCC. | Accepted |
26
+ | [0024](0024-manifest-native-schema-tables.md) | Materialize each Schema as a native storage table and deploy reviewed migration artifacts. | Accepted |
26
27
 
27
28
  ## Reading order
28
29
 
@@ -30,9 +30,10 @@ The shared comparison bundle intentionally keeps dependencies/configuration equa
30
30
  it cannot measure the difference between standalone application bundle sizes.
31
31
 
32
32
  The planner runs outside workerd. Route/Schema/View axes each use 1/10/100/1,000;
33
- extra Schemas are unindexed to keep the index-count axis fixed. D1 has a 100-column
34
- limit, including generated index columns, so this is not a claim that 1,000 indexed
35
- Schemas fit one entries table. Body/row axes use 64 B/4 KiB and 100/10,000/50,000;
33
+ extra Schemas are unindexed to keep the index-count axis fixed. Each Schema is a
34
+ native table, so the axis is not a claim that 1,000 simultaneous Schema tables
35
+ are an advisable production design. Body/row axes use 64 B/4 KiB and
36
+ 100/10,000/50,000;
36
37
  locales use 1/3/10, MCP client concurrency uses 1/4/8, R2 uses 1/3/12 variants at
37
38
  1/64/256 KiB. Actual simultaneous arrivals can be below client concurrency. The remote fleet
38
39
  can add isolates during a batch. A request is repeat-in-isolate only after that
@@ -26,9 +26,10 @@ CSV cells are quoted and formula-shaped headers are neutralized.
26
26
  ## Aggregation and freshness
27
27
 
28
28
  A single SQL statement returns a total and sparse grouped counts from one SQLite
29
- snapshot. `entries(collection, created_at)` is prepared by canonical migration
30
- 0008. The range branch searches the index, and the total branch counts index
31
- entries. Payload JSON stays in the database; only count rows reach the Worker.
29
+ snapshot. Each native Schema table carries `_mantle_created_at` and its own
30
+ creation index. The range branch searches that index, and the total branch
31
+ counts index entries. Other field columns stay in the database; only count rows
32
+ reach the Worker.
32
33
 
33
34
  The existing Cloudflare KV decorator caches MCP site configuration, not entry
34
35
  queries. Reusing that key/projection would mix unrelated data and mutation
@@ -50,7 +50,10 @@ export interface Env extends MantleCloudflareEnv {
50
50
 
51
51
  ## D1: `DB` (required)
52
52
 
53
- D1 is canonical storage. It holds `entries` (JSON data plus generated index columns), site settings, media metadata and pending uploads, and the Better Auth tables. `createConventionalBindings` throws without `DB`.
53
+ D1 is canonical storage. It holds one native table per Manifest Schema, Mantle's
54
+ `_mantle_*` envelope and migration metadata, site settings, media metadata and
55
+ pending uploads, and the Better Auth tables. `createConventionalBindings`
56
+ throws without `DB`.
54
57
 
55
58
  ```jsonc
56
59
  "d1_databases": [
@@ -34,7 +34,7 @@ Add tests and the frontend build where the project has them, then confirm index
34
34
  pnpm exec mantle-harness indexes --require-public --format text
35
35
  ```
36
36
 
37
- A required path fails on an `entries` table scan, a temporary sort or an unindexed data-field predicate. Then dry-run and deploy:
37
+ A required path fails on a required Schema-table scan, a temporary sort or an unindexed data-field predicate. Then dry-run and deploy:
38
38
 
39
39
  ```sh
40
40
  wrangler deploy --dry-run
@@ -83,6 +83,13 @@ Read the migration notes shipped with the target release before changing version
83
83
  3. Run `mantle generate`, `generate --check`, `skills`, `skills --check`, `validate`, typecheck and tests.
84
84
  4. Test local routes and authorization, then deploy.
85
85
 
86
+ The native-table storage contract is a pre-beta breaking change. Existing
87
+ generic-`entries` databases are unsupported: rebuild the instance and move any
88
+ required data manually outside Mantle. New native-table instances deploy safe
89
+ additive changes online; destructive changes are rejected and require another
90
+ manual rebuild. Mantle does not ship an in-product migration workflow for this
91
+ unreleased storage format.
92
+
86
93
  ## Source
87
94
  - [`packages/mantle/README.md`](../../../packages/mantle/README.md)
88
95
  - [`packages/adapters/cloudflare/README.md`](../../../packages/adapters/cloudflare/README.md)
@@ -23,7 +23,7 @@ Each stage's output can be constructed only by the stage that owns it, and a fai
23
23
  | Parse + normalize | YAML syntax and alias limits, the closed four-atom shape, atom-local rules, behavior-affecting defaults, source metadata | Unknown keys, bad envelopes, unsupported JSON Schema keywords, invalid index and `uiSchema` shapes | Cross-atom references, handlers, storage, routes |
24
24
  | Link | Duplicate symbols, cross-atom references, guard graphs, translations, manifest-owned route and tool collisions | Unknown Schema or Procedure references, guard self-reference and chains, duplicate HTTP paths, MCP tool-name collisions | I/O, selected modules, handler availability |
25
25
  | Compile | Immutable lookup records, authorization plans, Trigger indices, Procedure descriptors, logical View plans, the semantic fingerprint | Nothing new; it projects an already valid graph | Connections, repositories, handlers, requests, templates, assets |
26
- | Prepare | Storage migrations, indexes and native Views, handler availability, selected capability and reserved-route checks, the readiness revision | Missing handler refs, reserved-path conflicts, `View.spec.sql` on storage that does not declare the SQLite dialect | Re-interpreting YAML, executing requests |
26
+ | Prepare | Storage migrations, native Schema tables and indexes, prepared Views, handler availability, selected capability and reserved-route checks, the readiness revision | Missing handler refs, reserved-path conflicts, `View.spec.sql` on storage that does not declare the SQLite dialect | Re-interpreting YAML, executing requests |
27
27
  | Bind and invoke | Semantic ports, handler dispatch, parameter binding, centralized authorization, content, View, Procedure, Trigger and lifecycle operations | Invalid input, unauthorized callers, lifecycle transitions the state machine forbids | DDL, route mounting, assets, HTTP, session and cache policy |
28
28
  | Optional modules and adapters | Web and Admin composition; request, session, cache and platform translation | Whatever the platform itself rejects | Re-parsing, re-linking, or a second authorization stack |
29
29
 
@@ -89,7 +89,7 @@ A storage adapter prepares one `RuntimePlan` into semantic ports. Three are requ
89
89
 
90
90
  | Port | Role |
91
91
  |---|---|
92
- | `MantleStorageAdapter` / `PreparedMantleStorage` | Prepares one plan into a revision: migrations, indexes, native Views |
92
+ | `MantleStorageAdapter` / `PreparedMantleStorage` | Prepares one plan into a revision: migrations, native Schema tables and indexes, prepared Views |
93
93
  | `EntryRepository` and `EntryReader` | Entry writes and reads |
94
94
  | `ViewQueryExecutor` | Executes compiled logical View plans |
95
95
 
@@ -155,7 +155,7 @@ await runtime.invokeTrigger({ trigger: "rename-board-mcp", input, ctx });
155
155
 
156
156
  Platform bindings belong at the composition root only: the Worker entry, `createMantleWorker` options, the `bindings` hook and `wrangler.jsonc`. Procedure handlers receive them through `ctx.env`.
157
157
 
158
- Application code never queries Mantle-owned tables — `entries`, `site_config`, media, Auth — and never reaches through a raw database handle to get at them. Use Manifests, runtime use cases, `runtime.entries`, `runtime.siteConfig`, generated `bindMantle(runtime)` and Views instead, and do not copy generated-column names or construct SDK storage keys. An application may of course own its own tables behind its own repository; that is different from writing to Core's.
158
+ Application code does not bypass Mantle's storage ports to write Schema tables, `site_config`, media, or Auth tables. Each Schema is a native table, but Mantle still owns its metadata columns, lifecycle checks, and optimistic concurrency. Use Manifests, runtime use cases, `runtime.entries`, `runtime.siteConfig`, generated `bindMantle(runtime)`, and Views instead. An application may own separate tables behind its own repository; that is different from writing around Core's invariants.
159
159
 
160
160
  If a normal feature cannot be expressed through a purpose-shaped surface, treat that as a gap in the abstraction rather than teaching the project Mantle's internals. Internals change between versions; the ports do not.
161
161
 
@@ -92,7 +92,10 @@ Every View is also a tool. The name is the View name lowercased with hyphens rep
92
92
 
93
93
  ## Performance: declare the index the query needs
94
94
 
95
- Schema properties live inside a JSON column. Declared `indexes` and `uniqueIndexes` become generated columns with partial B-tree indexes, and Core-compiled projections, filters and ordering automatically reference the generated column when a field is declared. Undeclared fields fall back to `json_extract` and scan.
95
+ On SQLite and D1, every Schema is a native table and each top-level property is
96
+ a native column. Declared `indexes` and `uniqueIndexes` become B-tree indexes
97
+ over those columns; Core-compiled projections, filters and ordering reference
98
+ the same columns directly.
96
99
 
97
100
  Declare the **smallest ordered index justified by the measured path**, and respect SQLite's leftmost-prefix rule. An index on `[locale, publishedAt]` serves `WHERE locale = ?`, `WHERE locale = ? AND publishedAt > ?`, and `WHERE locale = ? ORDER BY publishedAt`. It does not serve `WHERE publishedAt > ?` alone. If a second hot path needs a different leading field, that is a second index — not a reason to enumerate every permutation, since each index costs storage and slows every write.
98
101
 
@@ -100,7 +103,12 @@ Declare the **smallest ordered index justified by the measured path**, and respe
100
103
  pnpm exec mantle-harness indexes --require-public --format text
101
104
  ```
102
105
 
103
- The harness applies the real migrations and generated DDL, seeds skewed rows, compiles and executes the actual View SQL, and records `EXPLAIN QUERY PLAN`. A healthy plan contains `SEARCH entries USING INDEX`; an indexed filter-and-order path should not contain `USE TEMP B-TREE FOR ORDER BY`. Findings are advisory unless you opt a View into the gate. Never change user-visible filter or ordering semantics just to make the gate pass.
106
+ The harness applies the real migrations and generated DDL, seeds skewed rows,
107
+ compiles and executes the actual View SQL, and records `EXPLAIN QUERY PLAN`. A
108
+ healthy indexed plan contains `SEARCH <schema-table> USING INDEX`; an indexed
109
+ filter-and-order path should not contain `USE TEMP B-TREE FOR ORDER BY`.
110
+ Findings are advisory unless you opt a View into the gate. Never change
111
+ user-visible filter or ordering semantics just to make the gate pass.
104
112
 
105
113
  ## Example: a public localized list
106
114
 
@@ -146,15 +154,15 @@ spec:
146
154
  title: Requests by tag
147
155
  surface: staff
148
156
  sql: |
149
- SELECT r.id AS requestId,
157
+ SELECT r._mantle_id AS requestId,
150
158
  r.subject AS subject,
151
159
  r.requestStatus AS requestStatus,
152
160
  tag.value AS tag,
153
- r.createdAt AS createdAt
161
+ r._mantle_created_at AS createdAt
154
162
  FROM requests AS r
155
163
  JOIN json_each(r.tags) AS tag
156
164
  WHERE r.requestStatus = :requestStatus
157
- ORDER BY r.createdAt DESC
165
+ ORDER BY r._mantle_created_at DESC
158
166
  params:
159
167
  type: object
160
168
  required: [requestStatus]
@@ -184,7 +184,7 @@ spec:
184
184
  FROM orders AS o
185
185
  JOIN json_each(o.items) AS item
186
186
  WHERE o.orderStatus = 'paid'
187
- ORDER BY o.createdAt ASC, o.orderNumber ASC, item.key ASC
187
+ ORDER BY o._mantle_created_at ASC, o.orderNumber ASC, item.key ASC
188
188
  limit: 200
189
189
  ---
190
190
  apiVersion: cms.mantle.aotter.net/v1
@@ -198,7 +198,7 @@ export async function requirePublishedLegalDocument(
198
198
  ctx: HandlerContext<{ DB: D1Database }>,
199
199
  ) {
200
200
  const row = await ctx.env.DB.prepare(
201
- "SELECT 1 FROM entries WHERE id = ? AND collection = 'legal-documents' AND status = 'published'",
201
+ 'SELECT 1 FROM "legal-documents" WHERE "_mantle_id" = ? AND "_mantle_status" = \'published\'',
202
202
  ).bind(documentId).first();
203
203
  if (!row) throw new Error("published_legal_document_required");
204
204
  return {};
@@ -164,7 +164,7 @@ Closed Admin-only roots: `fields`, `list`, `nav`. Nested keys are closed too. Un
164
164
  | `fields.<field>.widget` | Only `textarea`. The field must be a top-level property with a string type (`string` or `[string, null]`). |
165
165
  | `list.filterField` | Operational Schemas only. A declared property with a non-empty string `enum` that is the first field of some `indexes` or `uniqueIndexes` tuple. Admin renders the enum as sidebar links and list tabs. |
166
166
  | `list.primaryField` | Operational Schemas only. A non-empty top-level scalar property; rendered as the linked leading column. |
167
- | `list.columns` | Operational Schemas only. Top-level scalar properties, no repeats and not repeating `primaryField`. |
167
+ | `list.columns` | Operational Schemas only. Top-level properties, no repeats and not repeating `primaryField`; structured values render as compact JSON. |
168
168
  | `nav.standalone` | Boolean. `true` also emits a main Admin Nav list entry with a **parent autocomplete filter**. It does not unfold: required `x-mantle-ref` children still compose under the parent. Omit or `false` means fold-only (discover via the parent-entry workbench). Rejected on top-level Schemas, `translates` children, and Schemas with no eligible required-ref parent. |
169
169
  | `nav.parentField` | Allowed only with `standalone: true`. Names a required `x-mantle-ref` field used as the parent filter. One eligible required ref is inferred; more than one requires an explicit `parentField`. Do not rely on property-order heuristics when multiple refs exist. |
170
170
 
@@ -196,7 +196,10 @@ Keep implementation-detail children fold-only. Use `nav.standalone: true` when s
196
196
  | Fields are indexable scalars: exactly one non-null type, optionally nullable. `string` maps to TEXT, `integer` and `boolean` to INTEGER, `number` to REAL. | `SCHEMA_INDEX_INVALID` |
197
197
  | No tuple repeats within a list; `indexes` does not repeat a `uniqueIndexes` tuple. | `SCHEMA_INDEX_INVALID` |
198
198
 
199
- On SQLite storage each tuple becomes a partial index over generated columns of `entries.data`; queries benefit from a leftmost prefix. Unique indexes are also checked before every write; a conflicting row is `CONFLICT`.
199
+ On SQLite storage each Schema is a native table and every tuple becomes an
200
+ index over its native field columns; queries benefit from a leftmost prefix.
201
+ Unique indexes are also checked before every write; a conflicting row is
202
+ `CONFLICT`.
200
203
 
201
204
  ## `searchableFields`
202
205
 
@@ -31,9 +31,9 @@ All `/admin/api/*` routes require a staff session, carry a 1 MiB JSON body limit
31
31
  | `GET /admin/api/views-manifest` | `{ views: … }` — the View manifest projection the SPA renders from. |
32
32
  | `GET /admin/api/operations` | `{ operations: [ { name, title, description, input, uiSchema, triggers, rowBindings } ] }`, filtered per caller by re-evaluating each Procedure's `requires.auth.all`. |
33
33
  | `POST /admin/api/operations/:name` | Invokes a staff-operable Procedure through the same use case the staff MCP surface uses. `404` when the name is not staff-operable. |
34
- | `GET /admin/api/me`, `/collections`, `/collections/:name/statistics`, `/entries`, `/entries/export`, `/entries/:id`, `/site` | Session, catalog and entry reads. |
35
- | `POST /admin/api/entries`, `PATCH /admin/api/entries/:id` | Create and edit. Contributors are limited to drafts on publishing Schemas. |
36
- | `POST /admin/api/entries/:id/publish`, `/unpublish`, `DELETE /admin/api/entries/:id` | Lifecycle. Editor or above. |
34
+ | `GET /admin/api/me`, `/collections`, `/collections/:name/statistics`, `/entries`, `/entries/export`, `/entries/:id`, `/site` | Session, catalog and entry reads. Entry detail requires `?collection=<schema>`. |
35
+ | `POST /admin/api/entries`, `PATCH /admin/api/entries/:id` | Create and edit. Entry mutation routes require `?collection=<schema>`; contributors are limited to drafts on publishing Schemas. |
36
+ | `POST /admin/api/entries/:id/publish`, `/unpublish`, `DELETE /admin/api/entries/:id` | Lifecycle. Requires `?collection=<schema>` and editor or above. |
37
37
  | `POST /admin/api/media/uploads`, `POST /admin/api/media/uploads/:uploadGroupId/commit`, `GET /admin/api/media`, `GET`, `PATCH` and `DELETE /admin/api/media/:id` | Media lifecycle. Editor or above. |
38
38
  | `GET /admin/api/staff`, `PATCH /admin/api/staff/:id/role`, `POST /admin/api/staff/invitations`, `DELETE /admin/api/staff/invitations/:id`, `GET /admin/api/developer-console`, `GET` and `PATCH /admin/api/site-settings` | Owner only. |
39
39
  | `GET /admin/api/members` | Editor or above. |
@@ -152,7 +152,7 @@ mantle.triggers.expireOrderHttp; // { name, source, target }
152
152
  await mantle.runtime.archive.execute({ id, ctx });
153
153
  ```
154
154
 
155
- `entries.<collection>` exposes `createDraft`, `get`, `list` and `delete`. `runtime` is the underlying Core runtime, so the typed projection never hides it. A host that owns its own lifecycle can skip generation entirely and call `runtime.executeView({ view: "published-notes" })` directly.
155
+ `entries.<collection>` exposes `createDraft`, `get`, `list` and `delete`, supplying the required collection identity to Core. Generic MCP entry tools require a `collection` argument. `runtime` is the underlying Core runtime, so the typed projection never hides it. A host that owns its own lifecycle can skip generation entirely and call `runtime.executeView({ view: "published-notes" })` directly.
156
156
 
157
157
  ## Packages
158
158
 
@@ -77,7 +77,7 @@ spec:
77
77
  title: Order lines by status
78
78
  surface: staff
79
79
  sql: |
80
- SELECT o.id AS orderId,
80
+ SELECT o._mantle_id AS orderId,
81
81
  o.orderNumber AS orderNumber,
82
82
  json_extract(line.value, '$.sku') AS sku,
83
83
  json_extract(line.value, '$.quantity') AS quantity
@@ -26,6 +26,29 @@ To upgrade an existing application:
26
26
  `skills --check`, `validate`, and the project's TypeScript/tests. Test local
27
27
  routes and configured authorization before considering deployment.
28
28
 
29
+ ## Native Schema-table storage reset
30
+
31
+ The 0.1.2 pre-beta line replaces the generic `entries` JSON table with one
32
+ native SQLite/D1 table per Manifest Schema. Mantle's row envelope uses
33
+ `_mantle_id`, `_mantle_status`, `_mantle_version`, `_mantle_author_id`,
34
+ `_mantle_created_at`, and `_mantle_updated_at`; authored fields keep their exact
35
+ names as native columns. The old generated columns, projection views and
36
+ compatibility repository were removed.
37
+
38
+ This is intentionally a storage-format break before beta. Reset and
39
+ re-bootstrap development or internal-alpha content databases that contain the
40
+ old `entries` layout. Move required data manually outside Mantle and Control;
41
+ there is no product migration workflow for this unreleased format. Automatic
42
+ artifacts cover initial and additive changes only. Removed columns and tables
43
+ remain physically present so the previous Worker can still run. Renames, type
44
+ changes and data transforms require the same manual rebuild. The pre-beta Cloud
45
+ path does not accept or execute destructive SQL.
46
+
47
+ Row APIs are now Schema-qualified. `EntryRepository.get` and
48
+ `EntryReader.readById` accept `{ collection, id }`; Admin entry detail and
49
+ mutation routes require `?collection=<schema>`, and generic MCP entry tools
50
+ require `collection`. Generated `entries.<schema>` bindings supply it for you.
51
+
29
52
  A new project follows [direct authoring](direct-authoring.md). Templates and
30
53
  provider setup are not hidden inside `generate`. Future Builder/landing-next
31
54
  provisioning is a separate decision; this change does not migrate those hosts.
@@ -74,5 +97,6 @@ Intentional behavior changes:
74
97
 
75
98
  This alpha changes the Better Auth D1 schema, including required account
76
99
  issuer identity and OAuth resource/client tables. Reset and re-bootstrap a
77
- pre-1.7 alpha auth database; do not guess an issuer backfill. Content tables
78
- remain portable through the normal application migration/export path.
100
+ pre-1.7 alpha auth database; do not guess an issuer backfill. Reset old generic
101
+ content storage as described above and move required data manually outside
102
+ Mantle.
@@ -50,7 +50,7 @@ pnpm exec mantle-harness indexes --require account-members --format json
50
50
  ```
51
51
 
52
52
  Without `--require-public` or `--require`, findings are advisory. A required
53
- path fails on an `entries` table scan, a temporary ORDER BY B-tree, or a
53
+ path fails on a required Schema-table scan, a temporary ORDER BY B-tree, or a
54
54
  data-field predicate/order that does not use a declared Schema index.
55
55
  Projection alone does not require an index. `mantle validate` remains a pure
56
56
  correctness check; no performance grammar or manifest atom was added.
@@ -92,7 +92,7 @@ diagnostic, while query/row counts are the stable assertions.
92
92
  | Finding | Disposition |
93
93
  |---|---|
94
94
  | Public cache hits read D1 first | Removed from Worker code. Cloudflare's entrypoint Workers Cache runs before the Worker; Core has no inner render cache. |
95
- | Slug/locale reads bypass generated indexes | Fixed by the shared schema-aware entry-read boundary. A 10,000-row page MISS measured 2 queries / 5 rows read. |
95
+ | Slug/locale reads bypass Schema indexes | Fixed by the shared schema-aware entry-read boundary over native columns. A 10,000-row page MISS measured 2 queries / 5 rows read. |
96
96
  | OFFSET pagination | Retained only where the View/Admin contract explicitly uses it, with a 500-row response cap. Public content lists and discovery now use forward keyset pages; they are not covered by the old 500-row claim. |
97
97
  | Admin substring search scans | Accepted only for the authenticated Admin collection browser, with a 500-row response cap. Large/search-heavy sites should add a purpose-shaped indexed View or dedicated search service; do not expose this scan publicly. |
98
98
  | Published list/sitemap/llms paths lack system indexes | Fixed with measured partial indexes for published global, locale, collection, and collection+locale ordering. The 100-row and 10,000-row API runs both measured 1 query / 20 rows read. |
@@ -26,7 +26,7 @@ issue that must delete or delegate the old path.
26
26
  | Semantic fingerprint | Runtime boot from raw manifests | Compile plan | #665 |
27
27
  | Declarative View resolution | `ViewSqlCompiler` during each `ExecuteViewUseCase` call | Compile logical plan once | #665 |
28
28
  | SQLite/JSON1 View lowering and native `spec.sql` | `ViewSqlCompiler` plus `DatabaseDriver` invocation | Selected storage preparation | #666 |
29
- | Canonical SQL migrations, indexes, schema SQL Views, readiness | `createCmsRuntime.bootInit` and runtime infrastructure | Prepare | #666 |
29
+ | Canonical SQL migrations, native Schema tables/indexes, readiness | `createCmsRuntime.bootInit` and runtime infrastructure | Prepare | #666 |
30
30
  | Entry/media/site repositories | Runtime constructs `Database*Repository` from `DatabaseDriver` | Prepared semantic storage ports; media/config move with final owner | #666, #669, #670 |
31
31
  | Content, View, Procedure, Trigger, lifecycle invocation | Runtime use cases over raw maps/driver | `MantleRuntime` over plan + semantic ports | #667 |
32
32
  | Target authorization/admin bypass | Runtime plus adapter entry points | One Core invocation policy; adapter resolves caller only | #667 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aotter/mantle",
3
- "version": "0.1.2-alpha.1",
3
+ "version": "0.1.2-alpha.2",
4
4
  "description": "Embeddable Mantle Core umbrella with Spec and Runtime; Web, Admin, Bun, Vercel, Cloudflare, and Admin UI are optional peer packages.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://mantle.tools/",
@@ -79,8 +79,8 @@
79
79
  "README.md"
80
80
  ],
81
81
  "dependencies": {
82
- "@aotter/mantle-spec": "0.1.2-alpha.1",
83
- "@aotter/mantle-runtime": "0.1.2-alpha.1"
82
+ "@aotter/mantle-runtime": "0.1.2-alpha.2",
83
+ "@aotter/mantle-spec": "0.1.2-alpha.2"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "aws4fetch": "^1.0.20",
@@ -88,12 +88,12 @@
88
88
  "hono": "^4.12.0",
89
89
  "@libsql/client": "^0.17.4",
90
90
  "zod": "^4.5.0",
91
- "@aotter/mantle-admin": "0.1.2-alpha.1",
92
- "@aotter/mantle-admin-ui": "0.1.2-alpha.1",
93
- "@aotter/mantle-bun": "0.1.2-alpha.1",
94
- "@aotter/mantle-cloudflare": "0.1.2-alpha.1",
95
- "@aotter/mantle-vercel": "0.1.2-alpha.1",
96
- "@aotter/mantle-web": "0.1.2-alpha.1"
91
+ "@aotter/mantle-admin": "0.1.2-alpha.2",
92
+ "@aotter/mantle-admin-ui": "0.1.2-alpha.2",
93
+ "@aotter/mantle-bun": "0.1.2-alpha.2",
94
+ "@aotter/mantle-vercel": "0.1.2-alpha.2",
95
+ "@aotter/mantle-web": "0.1.2-alpha.2",
96
+ "@aotter/mantle-cloudflare": "0.1.2-alpha.2"
97
97
  },
98
98
  "peerDependenciesMeta": {
99
99
  "@aotter/mantle-admin": {
@@ -136,12 +136,12 @@
136
136
  "typescript": "^6.0.3",
137
137
  "vitest": "^4.1.11",
138
138
  "zod": "^4.5.4",
139
- "@aotter/mantle-admin": "0.1.2-alpha.1",
140
- "@aotter/mantle-admin-ui": "0.1.2-alpha.1",
141
- "@aotter/mantle-cloudflare": "0.1.2-alpha.1",
142
- "@aotter/mantle-bun": "0.1.2-alpha.1",
143
- "@aotter/mantle-vercel": "0.1.2-alpha.1",
144
- "@aotter/mantle-web": "0.1.2-alpha.1"
139
+ "@aotter/mantle-admin-ui": "0.1.2-alpha.2",
140
+ "@aotter/mantle-admin": "0.1.2-alpha.2",
141
+ "@aotter/mantle-bun": "0.1.2-alpha.2",
142
+ "@aotter/mantle-cloudflare": "0.1.2-alpha.2",
143
+ "@aotter/mantle-vercel": "0.1.2-alpha.2",
144
+ "@aotter/mantle-web": "0.1.2-alpha.2"
145
145
  },
146
146
  "engines": {
147
147
  "node": ">=22"