doxum 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { Dt as ImpactTarget, H as DocumentReader, o as DocumentReadable, xt as DocumentSchema } from "./contract-D8kjdfqT.cjs";
1
+ import { Ot as ImpactTarget, V as DocumentReader, o as DocumentReadable, xt as DocumentSchema } from "./contract-uYJTmT8o.cjs";
2
2
 
3
3
  //#region core/src/integration.d.ts
4
4
  type TrackedSelection<TValue> = {
@@ -1,4 +1,4 @@
1
- import { Dt as ImpactTarget, H as DocumentReader, o as DocumentReadable, xt as DocumentSchema } from "./contract-BsY1XLiG.js";
1
+ import { Ot as ImpactTarget, V as DocumentReader, o as DocumentReadable, xt as DocumentSchema } from "./contract-4E3moCbY.js";
2
2
 
3
3
  //#region core/src/integration.d.ts
4
4
  type TrackedSelection<TValue> = {
@@ -1,4 +1,4 @@
1
- import { c as DocumentRuntime, xt as DocumentSchema } from "./contract-D8kjdfqT.cjs";
1
+ import { c as DocumentRuntime, xt as DocumentSchema } from "./contract-uYJTmT8o.cjs";
2
2
 
3
3
  //#region core/src/local-sync/json.d.ts
4
4
  type JsonPrimitive = null | boolean | number | string;
@@ -1,4 +1,4 @@
1
- import { c as DocumentRuntime, xt as DocumentSchema } from "./contract-BsY1XLiG.js";
1
+ import { c as DocumentRuntime, xt as DocumentSchema } from "./contract-4E3moCbY.js";
2
2
 
3
3
  //#region core/src/local-sync/json.d.ts
4
4
  type JsonPrimitive = null | boolean | number | string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doxum",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "Doxum is a typed runtime for complex mutable documents.",
@@ -163,6 +163,11 @@ the same API except `move`, because it is unordered. Lists offer `insert`,
163
163
  specified in the schema. See [patterns.en.md](patterns.en.md) for complete
164
164
  collection and tree examples.
165
165
 
166
+ Optional field, variant, dict, list, and tree writers expose `clear()`. Optional
167
+ structured leaves can also be initialized from an absent state with `replace()`.
168
+ Optional objects, tables, and maps have no whole-value clear; modify them through
169
+ their child writers or collection operations.
170
+
166
171
  ## Replay operations at the boundary
167
172
 
168
173
  Use `apply` for operation batches that came from persistence, a network
@@ -135,6 +135,10 @@ runtime.update(tx => {
135
135
 
136
136
  table 支持 `create`、`item`、`remove` 和 `move`。map 与之相同,但没有 `move`,因为它无顺序。list 支持 `insert`、`move`、`remove` 与 `replace`;其身份来自 schema 中的 `keyOf`。完整的集合与 tree 模式见 [patterns.zh-CN.md](patterns.zh-CN.md)。
137
137
 
138
+ optional 的 field、variant、dict、list 和 tree writer 提供 `clear()`;其中结构化叶子也可
139
+ 在当前缺失时直接调用 `replace()` 建立值。optional object、table 和 map 没有整体 clear,
140
+ 应通过子 writer 或集合操作修改。
141
+
138
142
  ## 在边界回放 operation
139
143
 
140
144
  来自持久化、网络适配器或其他外部边界的 operation batch 应通过 `apply` 回放。Doxum 会在 mutation code 看到数据前解码未知 operation payload,按 schema 解析每个地址,并原子地执行整个 batch。
@@ -24,6 +24,13 @@ array of ids: that creates two mutation protocols and two sources of order.
24
24
  Use a list only when every item has a stable, unique application key; never use
25
25
  the current index as `keyOf`.
26
26
 
27
+ Entry readers and writers for tables and maps are derived directly from the entry
28
+ schema node. Structured entries retain their specialized tree, list, dict, or
29
+ variant access instead of being reconstructed from runtime values into a broad
30
+ object union. Optional fields and optional variant, dict, list, and tree leaves
31
+ also expose `clear()` and can be initialized from an absent state with
32
+ `replace()`; objects, tables, and maps keep their child or collection operations.
33
+
27
34
  ```ts
28
35
  import { field, list, map, object, schema, table, tree } from 'doxum';
29
36
 
@@ -19,6 +19,12 @@
19
19
 
20
20
  当顺序对产品可见时使用 table。不要用 map 加另一份 ids array 表示顺序:这会产生两套 mutation protocol 和两个顺序来源。list 只适合每个条目都有稳定、唯一应用 key 的情形;不能把当前 index 当作 `keyOf`。
21
21
 
22
+ table/map 的 entry reader 与 writer 直接由 entry schema node 推导。结构化 entry 会保留
23
+ 自己的 tree、list、dict、variant 等专用 access,而不会从运行时 value 反推成普通对象或
24
+ 产生 value union。optional field 以及 optional 的 variant、dict、list、tree 结构叶子额外
25
+ 提供 `clear()`,并可在缺失状态通过 `replace()` 初始化;object、table、map 仍使用各自的
26
+ 子 writer 或集合操作。
27
+
22
28
  ```ts
23
29
  import { field, list, map, object, schema, table, tree } from 'doxum';
24
30