@voidhash/mimic 1.0.0-beta.15 → 1.0.0-beta.16

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,5 +1,5 @@
1
1
 
2
- > @voidhash/mimic@1.0.0-beta.15 build /home/runner/work/mimic/mimic/packages/mimic
2
+ > @voidhash/mimic@1.0.0-beta.16 build /home/runner/work/mimic/mimic/packages/mimic
3
3
  > tsdown
4
4
 
5
5
  ℹ tsdown v0.18.2 powered by rolldown v1.0.0-beta.55
@@ -14,17 +14,17 @@
14
14
  ℹ [CJS] dist/primitives/Tree.cjs 30.01 kB │ gzip: 4.99 kB
15
15
  ℹ [CJS] dist/client/ClientDocument.cjs 24.61 kB │ gzip: 5.36 kB
16
16
  ℹ [CJS] dist/FractionalIndex.cjs 16.98 kB │ gzip: 3.39 kB
17
+ ℹ [CJS] dist/primitives/Struct.cjs 13.67 kB │ gzip: 2.98 kB
17
18
  ℹ [CJS] dist/utils/tree-helpers.cjs 13.42 kB │ gzip: 3.18 kB
18
19
  ℹ [CJS] dist/primitives/Array.cjs 12.23 kB │ gzip: 2.67 kB
19
- ℹ [CJS] dist/primitives/Struct.cjs 11.53 kB │ gzip: 2.58 kB
20
20
  ℹ [CJS] dist/client/WebSocketTransport.cjs 10.98 kB │ gzip: 2.71 kB
21
21
  ℹ [CJS] dist/primitives/Either.cjs  8.08 kB │ gzip: 2.06 kB
22
22
  ℹ [CJS] dist/client/Rebase.cjs  7.85 kB │ gzip: 1.76 kB
23
23
  ℹ [CJS] dist/primitives/Union.cjs  7.49 kB │ gzip: 1.78 kB
24
24
  ℹ [CJS] dist/EffectSchema.cjs  6.75 kB │ gzip: 1.63 kB
25
- ℹ [CJS] dist/Document.cjs  5.30 kB │ gzip: 1.77 kB
26
- ℹ [CJS] dist/primitives/shared.cjs  5.12 kB │ gzip: 1.66 kB
25
+ ℹ [CJS] dist/Document.cjs  5.22 kB │ gzip: 1.73 kB
27
26
  ℹ [CJS] dist/primitives/String.cjs  5.05 kB │ gzip: 1.37 kB
27
+ ℹ [CJS] dist/primitives/shared.cjs  5.05 kB │ gzip: 1.62 kB
28
28
  ℹ [CJS] dist/client/errors.cjs  4.80 kB │ gzip: 0.97 kB
29
29
  ℹ [CJS] dist/primitives/Number.cjs  4.63 kB │ gzip: 1.23 kB
30
30
  ℹ [CJS] dist/OperationPath.cjs  4.24 kB │ gzip: 1.19 kB
@@ -52,9 +52,9 @@
52
52
  ℹ [CJS] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectWithoutPropertiesLoose.cjs  0.37 kB │ gzip: 0.24 kB
53
53
  ℹ [CJS] dist/client/Transport.cjs  0.21 kB │ gzip: 0.16 kB
54
54
  ℹ [CJS] dist/Transform.cjs  0.20 kB │ gzip: 0.16 kB
55
- ℹ [CJS] 44 files, total: 223.58 kB
55
+ ℹ [CJS] 44 files, total: 225.56 kB
56
56
  ℹ [CJS] dist/primitives/Tree.d.cts.map  6.90 kB │ gzip: 2.60 kB
57
- ℹ [CJS] dist/primitives/Struct.d.cts.map  4.63 kB │ gzip: 1.94 kB
57
+ ℹ [CJS] dist/primitives/Struct.d.cts.map  5.26 kB │ gzip: 2.17 kB
58
58
  ℹ [CJS] dist/utils/tree-helpers.d.cts.map  3.61 kB │ gzip: 1.31 kB
59
59
  ℹ [CJS] dist/primitives/Array.d.cts.map  3.27 kB │ gzip: 1.36 kB
60
60
  ℹ [CJS] dist/primitives/Union.d.cts.map  3.16 kB │ gzip: 1.38 kB
@@ -90,17 +90,17 @@
90
90
  ℹ [CJS] dist/server/index.d.cts  0.68 kB │ gzip: 0.24 kB
91
91
  ℹ [CJS] dist/primitives/Tree.d.cts 13.50 kB │ gzip: 3.50 kB
92
92
  ℹ [CJS] dist/utils/tree-helpers.d.cts 12.18 kB │ gzip: 2.52 kB
93
+ ℹ [CJS] dist/primitives/Struct.d.cts  8.04 kB │ gzip: 2.06 kB
93
94
  ℹ [CJS] dist/client/Transport.d.cts  7.30 kB │ gzip: 1.84 kB
94
- ℹ [CJS] dist/primitives/shared.d.cts  7.16 kB │ gzip: 2.19 kB
95
+ ℹ [CJS] dist/primitives/shared.d.cts  6.99 kB │ gzip: 2.12 kB
95
96
  ℹ [CJS] dist/client/ClientDocument.d.cts  6.99 kB │ gzip: 2.01 kB
96
- ℹ [CJS] dist/primitives/Struct.d.cts  6.96 kB │ gzip: 1.86 kB
97
97
  ℹ [CJS] dist/server/ServerDocument.d.cts  5.48 kB │ gzip: 1.76 kB
98
98
  ℹ [CJS] dist/primitives/Either.d.cts  5.44 kB │ gzip: 1.54 kB
99
99
  ℹ [CJS] dist/primitives/Array.d.cts  5.01 kB │ gzip: 1.44 kB
100
100
  ℹ [CJS] dist/client/Rebase.d.cts  4.88 kB │ gzip: 1.14 kB
101
101
  ℹ [CJS] dist/primitives/Union.d.cts  4.58 kB │ gzip: 1.26 kB
102
102
  ℹ [CJS] dist/primitives/TreeNode.d.cts  4.28 kB │ gzip: 1.29 kB
103
- ℹ [CJS] dist/Primitive.d.cts  3.85 kB │ gzip: 0.83 kB
103
+ ℹ [CJS] dist/Primitive.d.cts  3.94 kB │ gzip: 0.84 kB
104
104
  ℹ [CJS] dist/client/StateMonitor.d.cts  3.33 kB │ gzip: 1.07 kB
105
105
  ℹ [CJS] dist/EffectSchema.d.cts  3.20 kB │ gzip: 0.92 kB
106
106
  ℹ [CJS] dist/primitives/String.d.cts  3.08 kB │ gzip: 0.85 kB
@@ -120,16 +120,16 @@
120
120
  ℹ [CJS] dist/client/WebSocketTransport.d.cts  1.22 kB │ gzip: 0.55 kB
121
121
  ℹ [CJS] dist/OperationDefinition.d.cts  1.21 kB │ gzip: 0.40 kB
122
122
  ℹ [CJS] dist/Transform.d.cts  0.48 kB │ gzip: 0.26 kB
123
- ℹ [CJS] 67 files, total: 186.35 kB
124
- ✔ Build complete in 6049ms
123
+ ℹ [CJS] 67 files, total: 187.98 kB
124
+ ✔ Build complete in 6056ms
125
125
  ℹ [ESM] dist/index.mjs  1.13 kB │ gzip: 0.29 kB
126
126
  ℹ [ESM] dist/client/index.mjs  0.99 kB │ gzip: 0.28 kB
127
127
  ℹ [ESM] dist/server/index.mjs  0.41 kB │ gzip: 0.17 kB
128
128
  ℹ [ESM] dist/primitives/Tree.mjs.map 68.20 kB │ gzip: 12.85 kB
129
129
  ℹ [ESM] dist/client/ClientDocument.mjs.map 56.58 kB │ gzip: 12.99 kB
130
130
  ℹ [ESM] dist/FractionalIndex.mjs.map 52.10 kB │ gzip: 10.05 kB
131
+ ℹ [ESM] dist/primitives/Struct.mjs.map 32.95 kB │ gzip: 7.96 kB
131
132
  ℹ [ESM] dist/primitives/Tree.mjs 28.14 kB │ gzip: 4.95 kB
132
- ℹ [ESM] dist/primitives/Struct.mjs.map 27.59 kB │ gzip: 6.97 kB
133
133
  ℹ [ESM] dist/primitives/Array.mjs.map 26.06 kB │ gzip: 6.49 kB
134
134
  ℹ [ESM] dist/utils/tree-helpers.mjs.map 24.70 kB │ gzip: 5.20 kB
135
135
  ℹ [ESM] dist/client/ClientDocument.mjs 24.17 kB │ gzip: 5.32 kB
@@ -138,14 +138,14 @@
138
138
  ℹ [ESM] dist/primitives/Either.mjs.map 16.82 kB │ gzip: 4.14 kB
139
139
  ℹ [ESM] dist/EffectSchema.mjs.map 16.73 kB │ gzip: 3.54 kB
140
140
  ℹ [ESM] dist/FractionalIndex.mjs 16.49 kB │ gzip: 3.36 kB
141
- ℹ [ESM] dist/primitives/shared.mjs.map 15.63 kB │ gzip: 4.45 kB
141
+ ℹ [ESM] dist/primitives/shared.mjs.map 15.92 kB │ gzip: 4.54 kB
142
142
  ℹ [ESM] dist/client/Rebase.mjs.map 14.15 kB │ gzip: 3.21 kB
143
143
  ℹ [ESM] dist/server/ServerDocument.mjs.map 14.09 kB │ gzip: 3.86 kB
144
+ ℹ [ESM] dist/Document.mjs.map 13.50 kB │ gzip: 4.16 kB
144
145
  ℹ [ESM] dist/utils/tree-helpers.mjs 13.31 kB │ gzip: 3.15 kB
145
- ℹ [ESM] dist/Document.mjs.map 13.29 kB │ gzip: 4.11 kB
146
+ ℹ [ESM] dist/primitives/Struct.mjs 12.60 kB │ gzip: 2.95 kB
146
147
  ℹ [ESM] dist/primitives/Array.mjs 11.09 kB │ gzip: 2.65 kB
147
148
  ℹ [ESM] dist/client/WebSocketTransport.mjs 10.81 kB │ gzip: 2.68 kB
148
- ℹ [ESM] dist/primitives/Struct.mjs 10.49 kB │ gzip: 2.56 kB
149
149
  ℹ [ESM] dist/client/StateMonitor.mjs.map 10.39 kB │ gzip: 3.04 kB
150
150
  ℹ [ESM] dist/primitives/String.mjs.map  9.73 kB │ gzip: 2.71 kB
151
151
  ℹ [ESM] dist/client/Transport.mjs.map  9.09 kB │ gzip: 1.86 kB
@@ -160,9 +160,9 @@
160
160
  ℹ [ESM] dist/EffectSchema.mjs  6.47 kB │ gzip: 1.59 kB
161
161
  ℹ [ESM] dist/primitives/TreeNode.mjs.map  6.47 kB │ gzip: 2.05 kB
162
162
  ℹ [ESM] dist/client/errors.mjs.map  5.68 kB │ gzip: 1.37 kB
163
- ℹ [ESM] dist/Document.mjs  5.03 kB │ gzip: 1.74 kB
164
- ℹ [ESM] dist/primitives/shared.mjs  4.94 kB │ gzip: 1.66 kB
165
- ℹ [ESM] dist/primitives/Struct.d.mts.map  4.65 kB │ gzip: 1.98 kB
163
+ ℹ [ESM] dist/primitives/Struct.d.mts.map  5.30 kB │ gzip: 2.21 kB
164
+ ℹ [ESM] dist/Document.mjs  4.94 kB │ gzip: 1.69 kB
165
+ ℹ [ESM] dist/primitives/shared.mjs  4.88 kB │ gzip: 1.62 kB
166
166
  ℹ [ESM] dist/primitives/Lazy.mjs.map  4.59 kB │ gzip: 1.40 kB
167
167
  ℹ [ESM] dist/Presence.mjs.map  4.56 kB │ gzip: 1.30 kB
168
168
  ℹ [ESM] dist/primitives/String.mjs  4.44 kB │ gzip: 1.35 kB
@@ -236,17 +236,17 @@
236
236
  ℹ [ESM] dist/server/index.d.mts  0.68 kB │ gzip: 0.24 kB
237
237
  ℹ [ESM] dist/primitives/Tree.d.mts 13.50 kB │ gzip: 3.50 kB
238
238
  ℹ [ESM] dist/utils/tree-helpers.d.mts 12.18 kB │ gzip: 2.52 kB
239
+ ℹ [ESM] dist/primitives/Struct.d.mts  8.07 kB │ gzip: 2.07 kB
239
240
  ℹ [ESM] dist/client/Transport.d.mts  7.30 kB │ gzip: 1.84 kB
240
- ℹ [ESM] dist/primitives/shared.d.mts  7.16 kB │ gzip: 2.19 kB
241
241
  ℹ [ESM] dist/client/ClientDocument.d.mts  7.02 kB │ gzip: 2.02 kB
242
- ℹ [ESM] dist/primitives/Struct.d.mts  6.99 kB │ gzip: 1.87 kB
242
+ ℹ [ESM] dist/primitives/shared.d.mts  6.99 kB │ gzip: 2.12 kB
243
243
  ℹ [ESM] dist/server/ServerDocument.d.mts  5.50 kB │ gzip: 1.76 kB
244
244
  ℹ [ESM] dist/primitives/Either.d.mts  5.44 kB │ gzip: 1.54 kB
245
245
  ℹ [ESM] dist/primitives/Array.d.mts  5.04 kB │ gzip: 1.45 kB
246
246
  ℹ [ESM] dist/client/Rebase.d.mts  4.91 kB │ gzip: 1.15 kB
247
247
  ℹ [ESM] dist/primitives/Union.d.mts  4.61 kB │ gzip: 1.27 kB
248
248
  ℹ [ESM] dist/primitives/TreeNode.d.mts  4.31 kB │ gzip: 1.29 kB
249
- ℹ [ESM] dist/Primitive.d.mts  3.85 kB │ gzip: 0.83 kB
249
+ ℹ [ESM] dist/Primitive.d.mts  3.94 kB │ gzip: 0.84 kB
250
250
  ℹ [ESM] dist/client/StateMonitor.d.mts  3.33 kB │ gzip: 1.07 kB
251
251
  ℹ [ESM] dist/EffectSchema.d.mts  3.20 kB │ gzip: 0.92 kB
252
252
  ℹ [ESM] dist/primitives/String.d.mts  3.08 kB │ gzip: 0.85 kB
@@ -266,5 +266,5 @@
266
266
  ℹ [ESM] dist/client/WebSocketTransport.d.mts  1.22 kB │ gzip: 0.55 kB
267
267
  ℹ [ESM] dist/OperationDefinition.d.mts  1.21 kB │ gzip: 0.40 kB
268
268
  ℹ [ESM] dist/Transform.d.mts  0.48 kB │ gzip: 0.26 kB
269
- ℹ [ESM] 144 files, total: 880.98 kB
270
- ✔ Build complete in 6093ms
269
+ ℹ [ESM] 144 files, total: 890.45 kB
270
+ ✔ Build complete in 6139ms
package/dist/Document.cjs CHANGED
@@ -35,9 +35,6 @@ var OperationError = class extends Error {
35
35
  */
36
36
  const make = (schema, options) => {
37
37
  let _state = (options === null || options === void 0 ? void 0 : options.initialState) !== void 0 ? options.initialState : (options === null || options === void 0 ? void 0 : options.initial) !== void 0 ? schema._internal.convertSetInputToState ? schema._internal.convertSetInputToState(options.initial) : options.initial : schema._internal.getInitialState();
38
- /**
39
- * An ops buffer that maintains a dedup index for O(1) lookups by path:kind.
40
- */
41
38
  const makeOpsBuffer = () => {
42
39
  let ops = [];
43
40
  let index = /* @__PURE__ */ new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"Document.d.mts","names":[],"sources":["../src/Document.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;cAaa,sBAAA,SAA+B,KAAA;;;;;;;cAW/B,cAAA,SAAuB,KAAA;EAXvB,SAAA,IAAA,GAAA,gBAAuB;EAWvB,WAAA,CAAA,OAAe,EAAA,MAAA;AAe5B;;;;AAKiB,UALA,QAKA,CAAA,gBALyB,YAKzB,CAAA,CAAA;EAGa;EAArB,SAAA,MAAA,EANU,OAMV;EAQ+B;EAAxB,SAAA,IAAA,EAXC,UAWD,CAXsB,OAWtB,CAAA;EAQiC;EAArB,GAAA,EAAA,EAhBnB,UAgBmB,CAhBE,OAgBF,CAAA,GAAA,SAAA;EAAkC;;;;;;EAkB7C,UAAA,EAAA,EA1BD,aA0BgB,CA1BQ,OA0BR,CAAA;EAAiB;;;;;;EAkBpC,WA8NZ,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,IAAA,EAlQ2B,UAkQ3B,CAlQgD,OAkQhD,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BACE,gBAAgB,aACzB,SAAS"}
package/dist/Document.mjs CHANGED
@@ -35,9 +35,6 @@ var OperationError = class extends Error {
35
35
  */
36
36
  const make = (schema, options) => {
37
37
  let _state = (options === null || options === void 0 ? void 0 : options.initialState) !== void 0 ? options.initialState : (options === null || options === void 0 ? void 0 : options.initial) !== void 0 ? schema._internal.convertSetInputToState ? schema._internal.convertSetInputToState(options.initial) : options.initial : schema._internal.getInitialState();
38
- /**
39
- * An ops buffer that maintains a dedup index for O(1) lookups by path:kind.
40
- */
41
38
  const makeOpsBuffer = () => {
42
39
  let ops = [];
43
40
  let index = /* @__PURE__ */ new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"Document.mjs","names":["_state: Primitive.InferState<TSchema> | undefined","ops: Operation.Operation<any, any, any>[]","OperationPath.encode","_txBaseState: Primitive.InferState<TSchema> | undefined","current: unknown","ProxyEnvironment.make","OperationPath.make","Transaction.make"],"sources":["../src/Document.ts"],"sourcesContent":["import * as Operation from \"./Operation\";\nimport * as OperationPath from \"./OperationPath\";\nimport * as ProxyEnvironment from \"./ProxyEnvironment\";\nimport * as Transaction from \"./Transaction\";\nimport type * as Primitive from \"./Primitive\";\n\n// =============================================================================\n// Document Errors\n// =============================================================================\n\n/**\n * Error thrown when attempting to start a nested transaction.\n */\nexport class NestedTransactionError extends Error {\n readonly _tag = \"NestedTransactionError\";\n constructor() {\n super(\"Nested transactions are not supported\");\n this.name = \"NestedTransactionError\";\n }\n}\n\n/**\n * Error thrown when an operation fails to apply.\n */\nexport class OperationError extends Error {\n readonly _tag = \"OperationError\";\n constructor(message: string) {\n super(message);\n this.name = \"OperationError\";\n }\n}\n\n// =============================================================================\n// Document Interface\n// =============================================================================\n\n/**\n * A Document manages state for a primitive-based schema with transaction support.\n */\nexport interface Document<TSchema extends Primitive.AnyPrimitive> {\n /** The schema defining this document's structure */\n readonly schema: TSchema;\n \n /** Root proxy for accessing and modifying document data */\n readonly root: Primitive.InferProxy<TSchema>;\n \n /** Returns the current document state */\n get(): Primitive.InferState<TSchema> | undefined;\n \n /**\n * Returns a readonly snapshot of the entire document state for rendering.\n * The snapshot is a type-safe, readonly structure where:\n * - Required fields and fields with defaults are guaranteed to be defined\n * - Optional fields may be undefined\n */\n toSnapshot(): Primitive.InferSnapshot<TSchema>;\n \n /**\n * Runs a function within a transaction.\n * All operations are collected and applied atomically.\n * If the function throws, all changes are rolled back.\n * @returns The return value of the function\n */\n transaction<R>(fn: (root: Primitive.InferProxy<TSchema>) => R): R;\n \n /**\n * Applies external operations (e.g., from server/peers) to the document.\n * These operations are NOT added to pending operations.\n */\n apply(ops: ReadonlyArray<Operation.Operation<any, any, any>>): void;\n \n /**\n * Returns pending local operations as a Transaction and clears the buffer.\n */\n flush(): Transaction.Transaction;\n}\n\n// =============================================================================\n// Document Options\n// =============================================================================\n\nexport interface DocumentOptions<TSchema extends Primitive.AnyPrimitive> {\n /** Initial value for the document (using set input format) */\n readonly initial?: Primitive.InferSetInput<TSchema>;\n /**\n * Raw initial state for the document (already in internal state format).\n * Use this when loading state from the server or storage.\n * Takes precedence over `initial` if both are provided.\n */\n readonly initialState?: Primitive.InferState<TSchema>;\n}\n\n// =============================================================================\n// Document Implementation\n// =============================================================================\n\n/**\n * Creates a new Document for the given schema.\n */\nexport const make = <TSchema extends Primitive.AnyPrimitive>(\n schema: TSchema,\n options?: DocumentOptions<TSchema>\n): Document<TSchema> => {\n // Internal state - determine initial state based on options\n // Priority: initialState (raw) > initial (needs conversion) > schema defaults\n let _state: Primitive.InferState<TSchema> | undefined =\n options?.initialState !== undefined\n ? options.initialState\n : options?.initial !== undefined\n ? (schema._internal.convertSetInputToState\n ? schema._internal.convertSetInputToState(options.initial)\n : options.initial as Primitive.InferState<TSchema>)\n : schema._internal.getInitialState();\n \n /**\n * An ops buffer that maintains a dedup index for O(1) lookups by path:kind.\n */\n const makeOpsBuffer = () => {\n let ops: Operation.Operation<any, any, any>[] = [];\n // Maps \"encodedPath:kind\" → array index for deduplicable ops\n let index = new Map<string, number>();\n\n const dedupKey = (op: Operation.Operation<any, any, any>): string =>\n `${OperationPath.encode(op.path)}:${String(op.kind)}`;\n\n return {\n push(op: Operation.Operation<any, any, any>): void {\n if (op.deduplicable) {\n const key = dedupKey(op);\n const existing = index.get(key);\n if (existing !== undefined) {\n // Remove old entry; shift indices above it down by 1\n ops.splice(existing, 1);\n // Rebuild affected index entries\n const newIndex = new Map<string, number>();\n for (const [k, v] of index) {\n if (k === key) continue;\n newIndex.set(k, v > existing ? v - 1 : v);\n }\n index = newIndex;\n }\n index.set(key, ops.length);\n }\n ops.push(op);\n },\n /** Drains all ops and resets the buffer. */\n drain(): Operation.Operation<any, any, any>[] {\n const result = ops;\n ops = [];\n index = new Map();\n return result;\n },\n /** Appends all ops from another buffer (used on tx commit). */\n mergeFrom(other: ReturnType<typeof makeOpsBuffer>): void {\n for (const op of other.toArray()) {\n this.push(op);\n }\n },\n toArray(): readonly Operation.Operation<any, any, any>[] {\n return ops;\n },\n reset(): void {\n ops = [];\n index = new Map();\n },\n };\n };\n\n // Pending operations buffer (local changes not yet flushed)\n const _pending = makeOpsBuffer();\n\n // Transaction state\n let _inTransaction = false;\n let _txOps = makeOpsBuffer();\n let _txBaseState: Primitive.InferState<TSchema> | undefined = undefined;\n\n /**\n * Gets state at the given path.\n */\n const getStateAtPath = (path: OperationPath.OperationPath): unknown => {\n const tokens = path.toTokens().filter(t => t !== \"\");\n \n if (tokens.length === 0) {\n return _state;\n }\n \n let current: unknown = _state;\n for (const token of tokens) {\n if (current === null || current === undefined) {\n return undefined;\n }\n \n if (typeof current === \"object\") {\n // Handle array entries (which have { id, pos, value } structure)\n if (Array.isArray(current)) {\n // Try to find by ID in array entries\n const entry = current.find((e: any) => e.id === token);\n if (entry) {\n current = entry.value;\n continue;\n }\n }\n \n // Handle regular object property access\n current = (current as Record<string, unknown>)[token];\n } else {\n return undefined;\n }\n }\n \n return current;\n };\n\n /**\n * Applies a single operation to the current state.\n */\n const applyOperation = (op: Operation.Operation<any, any, any>): void => {\n try {\n _state = schema._internal.applyOperation(_state, op);\n } catch (error) {\n if (error instanceof Error) {\n throw new OperationError(error.message);\n }\n throw new OperationError(String(error));\n }\n };\n\n /**\n * Handles an operation from a proxy.\n * In transaction mode: collects operations, applies to state immediately for subsequent reads.\n * Outside transaction mode: auto-wraps in a single-operation transaction.\n */\n const handleOperation = (op: Operation.Operation<any, any, any>): void => {\n if (_inTransaction) {\n // In transaction: collect op and apply immediately for subsequent reads\n _txOps.push(op);\n applyOperation(op);\n } else {\n // Not in transaction: auto-wrap in single-operation transaction\n const baseState = _state;\n try {\n applyOperation(op);\n _pending.push(op);\n } catch (error) {\n // Rollback on error\n _state = baseState;\n throw error;\n }\n }\n };\n\n /**\n * Creates a ProxyEnvironment for the document.\n */\n const createEnv = (): ProxyEnvironment.ProxyEnvironment => {\n return ProxyEnvironment.make({\n onOperation: handleOperation,\n getState: getStateAtPath,\n });\n };\n\n // Create the root proxy\n const env = createEnv();\n const rootProxy = schema._internal.createProxy(env, OperationPath.make(\"\")) as Primitive.InferProxy<TSchema>;\n\n // Document implementation\n const document: Document<TSchema> = {\n schema,\n root: rootProxy,\n \n get: (): Primitive.InferState<TSchema> | undefined => {\n return _state;\n },\n \n toSnapshot: (): Primitive.InferSnapshot<TSchema> => {\n return (rootProxy as { toSnapshot(): Primitive.InferSnapshot<TSchema> }).toSnapshot();\n },\n \n transaction: <R,>(fn: (root: Primitive.InferProxy<TSchema>) => R): R => {\n if (_inTransaction) {\n throw new NestedTransactionError();\n }\n \n // Start transaction\n _inTransaction = true;\n _txOps.reset();\n _txBaseState = _state;\n \n try {\n // Execute the transaction function\n const result = fn(rootProxy);\n \n // Commit: add transaction ops to pending\n _pending.mergeFrom(_txOps);\n \n return result;\n } catch (error) {\n // Rollback: restore base state\n _state = _txBaseState;\n throw error;\n } finally {\n // Clean up transaction state\n _inTransaction = false;\n _txOps.reset();\n _txBaseState = undefined;\n }\n },\n \n apply: (ops: ReadonlyArray<Operation.Operation<any, any, any>>): void => {\n for (const op of ops) {\n applyOperation(op);\n }\n },\n \n flush: (): Transaction.Transaction => {\n const tx = Transaction.make(_pending.drain());\n return tx;\n },\n };\n\n return document;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,IAAa,yBAAb,cAA4C,MAAM;CAEhD,cAAc;AACZ,QAAM,wCAAwC;wBAFvC,QAAO;AAGd,OAAK,OAAO;;;;;;AAOhB,IAAa,iBAAb,cAAoC,MAAM;CAExC,YAAY,SAAiB;AAC3B,QAAM,QAAQ;wBAFP,QAAO;AAGd,OAAK,OAAO;;;;;;AAuEhB,MAAa,QACX,QACA,YACsB;CAGtB,IAAIA,4DACF,QAAS,kBAAiB,SACtB,QAAQ,kEACR,QAAS,aAAY,SAClB,OAAO,UAAU,yBACd,OAAO,UAAU,uBAAuB,QAAQ,QAAQ,GACxD,QAAQ,UACZ,OAAO,UAAU,iBAAiB;;;;CAK1C,MAAM,sBAAsB;EAC1B,IAAIC,MAA4C,EAAE;EAElD,IAAI,wBAAQ,IAAI,KAAqB;EAErC,MAAM,YAAY,OAChB,GAAGC,OAAqB,GAAG,KAAK,CAAC,GAAG,OAAO,GAAG,KAAK;AAErD,SAAO;GACL,KAAK,IAA8C;AACjD,QAAI,GAAG,cAAc;KACnB,MAAM,MAAM,SAAS,GAAG;KACxB,MAAM,WAAW,MAAM,IAAI,IAAI;AAC/B,SAAI,aAAa,QAAW;AAE1B,UAAI,OAAO,UAAU,EAAE;MAEvB,MAAM,2BAAW,IAAI,KAAqB;AAC1C,WAAK,MAAM,CAAC,GAAG,MAAM,OAAO;AAC1B,WAAI,MAAM,IAAK;AACf,gBAAS,IAAI,GAAG,IAAI,WAAW,IAAI,IAAI,EAAE;;AAE3C,cAAQ;;AAEV,WAAM,IAAI,KAAK,IAAI,OAAO;;AAE5B,QAAI,KAAK,GAAG;;GAGd,QAA8C;IAC5C,MAAM,SAAS;AACf,UAAM,EAAE;AACR,4BAAQ,IAAI,KAAK;AACjB,WAAO;;GAGT,U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AAO,UAAU,YAAY,KAAKC,OAAmB,GAAG,CAAC;AAyD3E,QAtDoC;EAClC;EACA,MAAM;EAEN,WAAsD;AACpD,UAAO;;EAGT,kBAAoD;AAClD,UAAQ,UAAiE,YAAY;;EAGvF,cAAkB,OAAsD;AACtE,OAAI,eACF,OAAM,IAAI,wBAAwB;AAIpC,oBAAiB;AACjB,UAAO,OAAO;AACd,kBAAe;AAEf,OAAI;IAEF,MAAM,SAAS,GAAG,UAAU;AAG5B,aAAS,UAAU,OAAO;AAE1B,WAAO;YACA,OAAO;AAEd,aAAS;AACT,UAAM;aACE;AAER,qBAAiB;AACjB,WAAO,OAAO;AACd,mBAAe;;;EAInB,QAAQ,QAAiE;AACvE,QAAK,MAAM,MAAM,IACf,gBAAe,GAAG;;EAItB,aAAsC;AAEpC,UADWC,OAAiB,SAAS,OAAO,CAAC;;EAGhD"}
1
+ {"version":3,"file":"Document.mjs","names":["_state: Primitive.InferState<TSchema> | undefined","ops: BufferedOperation[]","OperationPath.encode","_txBaseState: Primitive.InferState<TSchema> | undefined","current: unknown","ProxyEnvironment.make","OperationPath.make","Transaction.make"],"sources":["../src/Document.ts"],"sourcesContent":["import * as Operation from \"./Operation\";\nimport * as OperationPath from \"./OperationPath\";\nimport * as ProxyEnvironment from \"./ProxyEnvironment\";\nimport * as Transaction from \"./Transaction\";\nimport type * as Primitive from \"./Primitive\";\n\n// =============================================================================\n// Document Errors\n// =============================================================================\n\n/**\n * Error thrown when attempting to start a nested transaction.\n */\nexport class NestedTransactionError extends Error {\n readonly _tag = \"NestedTransactionError\";\n constructor() {\n super(\"Nested transactions are not supported\");\n this.name = \"NestedTransactionError\";\n }\n}\n\n/**\n * Error thrown when an operation fails to apply.\n */\nexport class OperationError extends Error {\n readonly _tag = \"OperationError\";\n constructor(message: string) {\n super(message);\n this.name = \"OperationError\";\n }\n}\n\n// =============================================================================\n// Document Interface\n// =============================================================================\n\n/**\n * A Document manages state for a primitive-based schema with transaction support.\n */\nexport interface Document<TSchema extends Primitive.AnyPrimitive> {\n /** The schema defining this document's structure */\n readonly schema: TSchema;\n \n /** Root proxy for accessing and modifying document data */\n readonly root: Primitive.InferProxy<TSchema>;\n \n /** Returns the current document state */\n get(): Primitive.InferState<TSchema> | undefined;\n \n /**\n * Returns a readonly snapshot of the entire document state for rendering.\n * The snapshot is a type-safe, readonly structure where:\n * - Required fields and fields with defaults are guaranteed to be defined\n * - Optional fields may be undefined\n */\n toSnapshot(): Primitive.InferSnapshot<TSchema>;\n \n /**\n * Runs a function within a transaction.\n * All operations are collected and applied atomically.\n * If the function throws, all changes are rolled back.\n * @returns The return value of the function\n */\n transaction<R>(fn: (root: Primitive.InferProxy<TSchema>) => R): R;\n \n /**\n * Applies external operations (e.g., from server/peers) to the document.\n * These operations are NOT added to pending operations.\n */\n apply(ops: ReadonlyArray<Operation.Operation<any, any, any>>): void;\n \n /**\n * Returns pending local operations as a Transaction and clears the buffer.\n */\n flush(): Transaction.Transaction;\n}\n\n// =============================================================================\n// Document Options\n// =============================================================================\n\nexport interface DocumentOptions<TSchema extends Primitive.AnyPrimitive> {\n /** Initial value for the document (using set input format) */\n readonly initial?: Primitive.InferSetInput<TSchema>;\n /**\n * Raw initial state for the document (already in internal state format).\n * Use this when loading state from the server or storage.\n * Takes precedence over `initial` if both are provided.\n */\n readonly initialState?: Primitive.InferState<TSchema>;\n}\n\n// =============================================================================\n// Document Implementation\n// =============================================================================\n\n/**\n * Creates a new Document for the given schema.\n */\nexport const make = <TSchema extends Primitive.AnyPrimitive>(\n schema: TSchema,\n options?: DocumentOptions<TSchema>\n): Document<TSchema> => {\n // Internal state - determine initial state based on options\n // Priority: initialState (raw) > initial (needs conversion) > schema defaults\n let _state: Primitive.InferState<TSchema> | undefined =\n options?.initialState !== undefined\n ? options.initialState\n : options?.initial !== undefined\n ? (schema._internal.convertSetInputToState\n ? schema._internal.convertSetInputToState(options.initial)\n : options.initial as Primitive.InferState<TSchema>)\n : schema._internal.getInitialState();\n \n /**\n * An ops buffer that maintains a dedup index for O(1) lookups by path:kind.\n */\n type BufferedOperation = Operation.Operation<any, any, any>;\n interface OpsBuffer {\n push(op: BufferedOperation): void;\n drain(): BufferedOperation[];\n mergeFrom(other: OpsBuffer): void;\n toArray(): readonly BufferedOperation[];\n reset(): void;\n }\n\n const makeOpsBuffer = (): OpsBuffer => {\n let ops: BufferedOperation[] = [];\n // Maps \"encodedPath:kind\" → array index for deduplicable ops\n let index = new Map<string, number>();\n\n const dedupKey = (op: BufferedOperation): string =>\n `${OperationPath.encode(op.path)}:${String(op.kind)}`;\n\n return {\n push(op: Operation.Operation<any, any, any>): void {\n if (op.deduplicable) {\n const key = dedupKey(op);\n const existing = index.get(key);\n if (existing !== undefined) {\n // Remove old entry; shift indices above it down by 1\n ops.splice(existing, 1);\n // Rebuild affected index entries\n const newIndex = new Map<string, number>();\n for (const [k, v] of index) {\n if (k === key) continue;\n newIndex.set(k, v > existing ? v - 1 : v);\n }\n index = newIndex;\n }\n index.set(key, ops.length);\n }\n ops.push(op);\n },\n /** Drains all ops and resets the buffer. */\n drain(): Operation.Operation<any, any, any>[] {\n const result = ops;\n ops = [];\n index = new Map();\n return result;\n },\n /** Appends all ops from another buffer (used on tx commit). */\n mergeFrom(other: OpsBuffer): void {\n for (const op of other.toArray()) {\n this.push(op);\n }\n },\n toArray(): readonly Operation.Operation<any, any, any>[] {\n return ops;\n },\n reset(): void {\n ops = [];\n index = new Map();\n },\n };\n };\n\n // Pending operations buffer (local changes not yet flushed)\n const _pending = makeOpsBuffer();\n\n // Transaction state\n let _inTransaction = false;\n let _txOps = makeOpsBuffer();\n let _txBaseState: Primitive.InferState<TSchema> | undefined = undefined;\n\n /**\n * Gets state at the given path.\n */\n const getStateAtPath = (path: OperationPath.OperationPath): unknown => {\n const tokens = path.toTokens().filter(t => t !== \"\");\n \n if (tokens.length === 0) {\n return _state;\n }\n \n let current: unknown = _state;\n for (const token of tokens) {\n if (current === null || current === undefined) {\n return undefined;\n }\n \n if (typeof current === \"object\") {\n // Handle array entries (which have { id, pos, value } structure)\n if (Array.isArray(current)) {\n // Try to find by ID in array entries\n const entry = current.find((e: any) => e.id === token);\n if (entry) {\n current = entry.value;\n continue;\n }\n }\n \n // Handle regular object property access\n current = (current as Record<string, unknown>)[token];\n } else {\n return undefined;\n }\n }\n \n return current;\n };\n\n /**\n * Applies a single operation to the current state.\n */\n const applyOperation = (op: Operation.Operation<any, any, any>): void => {\n try {\n _state = schema._internal.applyOperation(_state, op);\n } catch (error) {\n if (error instanceof Error) {\n throw new OperationError(error.message);\n }\n throw new OperationError(String(error));\n }\n };\n\n /**\n * Handles an operation from a proxy.\n * In transaction mode: collects operations, applies to state immediately for subsequent reads.\n * Outside transaction mode: auto-wraps in a single-operation transaction.\n */\n const handleOperation = (op: Operation.Operation<any, any, any>): void => {\n if (_inTransaction) {\n // In transaction: collect op and apply immediately for subsequent reads\n _txOps.push(op);\n applyOperation(op);\n } else {\n // Not in transaction: auto-wrap in single-operation transaction\n const baseState = _state;\n try {\n applyOperation(op);\n _pending.push(op);\n } catch (error) {\n // Rollback on error\n _state = baseState;\n throw error;\n }\n }\n };\n\n /**\n * Creates a ProxyEnvironment for the document.\n */\n const createEnv = (): ProxyEnvironment.ProxyEnvironment => {\n return ProxyEnvironment.make({\n onOperation: handleOperation,\n getState: getStateAtPath,\n });\n };\n\n // Create the root proxy\n const env = createEnv();\n const rootProxy = schema._internal.createProxy(env, OperationPath.make(\"\")) as Primitive.InferProxy<TSchema>;\n\n // Document implementation\n const document: Document<TSchema> = {\n schema,\n root: rootProxy,\n \n get: (): Primitive.InferState<TSchema> | undefined => {\n return _state;\n },\n \n toSnapshot: (): Primitive.InferSnapshot<TSchema> => {\n return (rootProxy as { toSnapshot(): Primitive.InferSnapshot<TSchema> }).toSnapshot();\n },\n \n transaction: <R,>(fn: (root: Primitive.InferProxy<TSchema>) => R): R => {\n if (_inTransaction) {\n throw new NestedTransactionError();\n }\n \n // Start transaction\n _inTransaction = true;\n _txOps.reset();\n _txBaseState = _state;\n \n try {\n // Execute the transaction function\n const result = fn(rootProxy);\n \n // Commit: add transaction ops to pending\n _pending.mergeFrom(_txOps);\n \n return result;\n } catch (error) {\n // Rollback: restore base state\n _state = _txBaseState;\n throw error;\n } finally {\n // Clean up transaction state\n _inTransaction = false;\n _txOps.reset();\n _txBaseState = undefined;\n }\n },\n \n apply: (ops: ReadonlyArray<Operation.Operation<any, any, any>>): void => {\n for (const op of ops) {\n applyOperation(op);\n }\n },\n \n flush: (): Transaction.Transaction => {\n const tx = Transaction.make(_pending.drain());\n return tx;\n },\n };\n\n return document;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,IAAa,yBAAb,cAA4C,MAAM;CAEhD,cAAc;AACZ,QAAM,wCAAwC;wBAFvC,QAAO;AAGd,OAAK,OAAO;;;;;;AAOhB,IAAa,iBAAb,cAAoC,MAAM;CAExC,YAAY,SAAiB;AAC3B,QAAM,QAAQ;wBAFP,QAAO;AAGd,OAAK,OAAO;;;;;;AAuEhB,MAAa,QACX,QACA,YACsB;CAGtB,IAAIA,4DACF,QAAS,kBAAiB,SACtB,QAAQ,kEACR,QAAS,aAAY,SAClB,OAAO,UAAU,yBACd,OAAO,UAAU,uBAAuB,QAAQ,QAAQ,GACxD,QAAQ,UACZ,OAAO,UAAU,iBAAiB;CAc1C,MAAM,sBAAiC;EACrC,IAAIC,MAA2B,EAAE;EAEjC,IAAI,wBAAQ,IAAI,KAAqB;EAErC,MAAM,YAAY,OAChB,GAAGC,OAAqB,GAAG,KAAK,CAAC,GAAG,OAAO,GAAG,KAAK;AAErD,SAAO;GACL,KAAK,IAA8C;AACjD,QAAI,GAAG,cAAc;KACnB,MAAM,MAAM,SAAS,GAAG;KACxB,MAAM,WAAW,MAAM,IAAI,IAAI;AAC/B,SAAI,aAAa,QAAW;AAE1B,UAAI,OAAO,UAAU,EAAE;MAEvB,MAAM,2BAAW,IAAI,KAAqB;AAC1C,WAAK,MAAM,CAAC,GAAG,MAAM,OAAO;AAC1B,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,GAAG;SACb;GAEL,MAAM,YAAY;AAClB,OAAI;AACF,mBAAe,GAAG;AAClB,aAAS,KAAK,GAAG;YACV,OAAO;AAEd,aAAS;AACT,UAAM;;;;;;;CAQZ,MAAM,kBAAqD;AACzD,SAAOC,OAAsB;GAC3B,aAAa;GACb,UAAU;GACX,CAAC;;CAIJ,MAAM,MAAM,WAAW;CACvB,MAAM,YAAY,OAAO,UAAU,YAAY,KAAKC,OAAmB,GAAG,CAAC;AAyD3E,QAtDoC;EAClC;EACA,MAAM;EAEN,WAAsD;AACpD,UAAO;;EAGT,kBAAoD;AAClD,UAAQ,UAAiE,YAAY;;EAGvF,cAAkB,OAAsD;AACtE,OAAI,eACF,OAAM,IAAI,wBAAwB;AAIpC,oBAAiB;AACjB,UAAO,OAAO;AACd,kBAAe;AAEf,OAAI;IAEF,MAAM,SAAS,GAAG,UAAU;AAG5B,aAAS,UAAU,OAAO;AAE1B,WAAO;YACA,OAAO;AAEd,aAAS;AACT,UAAM;aACE;AAER,qBAAiB;AACjB,WAAO,OAAO;AACd,mBAAe;;;EAInB,QAAQ,QAAiE;AACvE,QAAK,MAAM,MAAM,IACf,gBAAe,GAAG;;EAItB,aAAsC;AAEpC,UADWC,OAAiB,SAAS,OAAO,CAAC;;EAGhD"}
@@ -1,6 +1,6 @@
1
1
  import { AnyPrimitive, HasDefault, InferProxy, InferSetInput, InferSnapshot, InferState, InferUpdateInput, IsDefined, IsRequired, MaybeUndefined, NeedsValue, Optional, Primitive, PrimitiveInternal, ValidationError, Validator, applyDefaults, isCompatibleOperation, primitiveAllowsNullValue, runValidators } from "./primitives/shared.cjs";
2
2
  import { String, StringPrimitive, StringProxy } from "./primitives/String.cjs";
3
- import { InferStructSnapshot, InferStructState, MakeOptional, PartialFields, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue } from "./primitives/Struct.cjs";
3
+ import { InferStructSnapshot, InferStructState, MakeOptional, MakeOptionalNoDefault, PartialFields, PartialFieldsNoDefault, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue } from "./primitives/Struct.cjs";
4
4
  import { Boolean, BooleanPrimitive, BooleanProxy } from "./primitives/Boolean.cjs";
5
5
  import { Number, NumberPrimitive, NumberProxy } from "./primitives/Number.cjs";
6
6
  import { Literal, LiteralPrimitive, LiteralProxy, LiteralValue } from "./primitives/Literal.cjs";
@@ -13,7 +13,7 @@ import { InferTreeSetInput, InferTreeSnapshot, Tree, TreeNodeDataSetInput, TreeN
13
13
 
14
14
  //#region src/Primitive.d.ts
15
15
  declare namespace Primitive_d_exports {
16
- export { AnyPrimitive, AnyTreeNodePrimitive, Array, ArrayElementSetInput, ArrayEntry, ArrayEntrySnapshot, ArrayPrimitive, ArrayProxy, ArraySetInput, ArraySnapshot, ArrayState, ArrayUpdateInput, Boolean, BooleanPrimitive, BooleanProxy, Either, EitherMatchHandlers, EitherPrimitive, EitherProxy, HasDefault, InferEitherSnapshot, InferEitherState, InferLazyProxy, InferLazySetInput, InferLazySnapshot, InferLazyState, InferLazyUpdateInput, InferProxy, InferSetInput, InferSnapshot, InferState, InferStructSnapshot, InferStructState, InferTreeNodeChildren, InferTreeNodeDataState, InferTreeNodeType, InferTreeSetInput, InferTreeSnapshot, InferUnionSnapshot, InferUnionState, InferUpdateInput, IsDefined, IsRequired, Lazy, LazyPrimitive, Literal, LiteralPrimitive, LiteralProxy, LiteralValue, MakeOptional, MaybeUndefined, NeedsValue, Number, NumberPrimitive, NumberProxy, Optional, PartialFields, Primitive, PrimitiveInternal, ScalarPrimitive, String, StringPrimitive, StringProxy, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue, Tree, TreeNode, TreeNodeChildrenInput, TreeNodeConfig, TreeNodeDataSetInput, TreeNodePrimitive, TreeNodeProxyBase, TreeNodeSelf, TreeNodeSelfType, TreeNodeSetInput, TreeNodeSetInputUnion, TreeNodeSnapshot, TreeNodeState, TreeNodeUpdateValue, TreeOptions, TreePrimitive, TreeProxy, TreeSetInput, TreeState, TreeUpdateInput, TypedNodeProxy, TypedTreeNodeState, Union, UnionOptions, UnionPrimitive, UnionProxy, UnionSetInput, UnionVariants, ValidationError, Validator, applyDefaults, isCompatibleOperation, primitiveAllowsNullValue, runValidators };
16
+ export { AnyPrimitive, AnyTreeNodePrimitive, Array, ArrayElementSetInput, ArrayEntry, ArrayEntrySnapshot, ArrayPrimitive, ArrayProxy, ArraySetInput, ArraySnapshot, ArrayState, ArrayUpdateInput, Boolean, BooleanPrimitive, BooleanProxy, Either, EitherMatchHandlers, EitherPrimitive, EitherProxy, HasDefault, InferEitherSnapshot, InferEitherState, InferLazyProxy, InferLazySetInput, InferLazySnapshot, InferLazyState, InferLazyUpdateInput, InferProxy, InferSetInput, InferSnapshot, InferState, InferStructSnapshot, InferStructState, InferTreeNodeChildren, InferTreeNodeDataState, InferTreeNodeType, InferTreeSetInput, InferTreeSnapshot, InferUnionSnapshot, InferUnionState, InferUpdateInput, IsDefined, IsRequired, Lazy, LazyPrimitive, Literal, LiteralPrimitive, LiteralProxy, LiteralValue, MakeOptional, MakeOptionalNoDefault, MaybeUndefined, NeedsValue, Number, NumberPrimitive, NumberProxy, Optional, PartialFields, PartialFieldsNoDefault, Primitive, PrimitiveInternal, ScalarPrimitive, String, StringPrimitive, StringProxy, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue, Tree, TreeNode, TreeNodeChildrenInput, TreeNodeConfig, TreeNodeDataSetInput, TreeNodePrimitive, TreeNodeProxyBase, TreeNodeSelf, TreeNodeSelfType, TreeNodeSetInput, TreeNodeSetInputUnion, TreeNodeSnapshot, TreeNodeState, TreeNodeUpdateValue, TreeOptions, TreePrimitive, TreeProxy, TreeSetInput, TreeState, TreeUpdateInput, TypedNodeProxy, TypedTreeNodeState, Union, UnionOptions, UnionPrimitive, UnionProxy, UnionSetInput, UnionVariants, ValidationError, Validator, applyDefaults, isCompatibleOperation, primitiveAllowsNullValue, runValidators };
17
17
  }
18
18
  //#endregion
19
19
  export { Primitive_d_exports };
@@ -1,6 +1,6 @@
1
1
  import { AnyPrimitive, HasDefault, InferProxy, InferSetInput, InferSnapshot, InferState, InferUpdateInput, IsDefined, IsRequired, MaybeUndefined, NeedsValue, Optional, Primitive, PrimitiveInternal, ValidationError, Validator, applyDefaults, isCompatibleOperation, primitiveAllowsNullValue, runValidators } from "./primitives/shared.mjs";
2
2
  import { String, StringPrimitive, StringProxy } from "./primitives/String.mjs";
3
- import { InferStructSnapshot, InferStructState, MakeOptional, PartialFields, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue } from "./primitives/Struct.mjs";
3
+ import { InferStructSnapshot, InferStructState, MakeOptional, MakeOptionalNoDefault, PartialFields, PartialFieldsNoDefault, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue } from "./primitives/Struct.mjs";
4
4
  import { Boolean, BooleanPrimitive, BooleanProxy } from "./primitives/Boolean.mjs";
5
5
  import { Number, NumberPrimitive, NumberProxy } from "./primitives/Number.mjs";
6
6
  import { Literal, LiteralPrimitive, LiteralProxy, LiteralValue } from "./primitives/Literal.mjs";
@@ -13,7 +13,7 @@ import { InferTreeSetInput, InferTreeSnapshot, Tree, TreeNodeDataSetInput, TreeN
13
13
 
14
14
  //#region src/Primitive.d.ts
15
15
  declare namespace Primitive_d_exports {
16
- export { AnyPrimitive, AnyTreeNodePrimitive, Array, ArrayElementSetInput, ArrayEntry, ArrayEntrySnapshot, ArrayPrimitive, ArrayProxy, ArraySetInput, ArraySnapshot, ArrayState, ArrayUpdateInput, Boolean, BooleanPrimitive, BooleanProxy, Either, EitherMatchHandlers, EitherPrimitive, EitherProxy, HasDefault, InferEitherSnapshot, InferEitherState, InferLazyProxy, InferLazySetInput, InferLazySnapshot, InferLazyState, InferLazyUpdateInput, InferProxy, InferSetInput, InferSnapshot, InferState, InferStructSnapshot, InferStructState, InferTreeNodeChildren, InferTreeNodeDataState, InferTreeNodeType, InferTreeSetInput, InferTreeSnapshot, InferUnionSnapshot, InferUnionState, InferUpdateInput, IsDefined, IsRequired, Lazy, LazyPrimitive, Literal, LiteralPrimitive, LiteralProxy, LiteralValue, MakeOptional, MaybeUndefined, NeedsValue, Number, NumberPrimitive, NumberProxy, Optional, PartialFields, Primitive, PrimitiveInternal, ScalarPrimitive, String, StringPrimitive, StringProxy, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue, Tree, TreeNode, TreeNodeChildrenInput, TreeNodeConfig, TreeNodeDataSetInput, TreeNodePrimitive, TreeNodeProxyBase, TreeNodeSelf, TreeNodeSelfType, TreeNodeSetInput, TreeNodeSetInputUnion, TreeNodeSnapshot, TreeNodeState, TreeNodeUpdateValue, TreeOptions, TreePrimitive, TreeProxy, TreeSetInput, TreeState, TreeUpdateInput, TypedNodeProxy, TypedTreeNodeState, Union, UnionOptions, UnionPrimitive, UnionProxy, UnionSetInput, UnionVariants, ValidationError, Validator, applyDefaults, isCompatibleOperation, primitiveAllowsNullValue, runValidators };
16
+ export { AnyPrimitive, AnyTreeNodePrimitive, Array, ArrayElementSetInput, ArrayEntry, ArrayEntrySnapshot, ArrayPrimitive, ArrayProxy, ArraySetInput, ArraySnapshot, ArrayState, ArrayUpdateInput, Boolean, BooleanPrimitive, BooleanProxy, Either, EitherMatchHandlers, EitherPrimitive, EitherProxy, HasDefault, InferEitherSnapshot, InferEitherState, InferLazyProxy, InferLazySetInput, InferLazySnapshot, InferLazyState, InferLazyUpdateInput, InferProxy, InferSetInput, InferSnapshot, InferState, InferStructSnapshot, InferStructState, InferTreeNodeChildren, InferTreeNodeDataState, InferTreeNodeType, InferTreeSetInput, InferTreeSnapshot, InferUnionSnapshot, InferUnionState, InferUpdateInput, IsDefined, IsRequired, Lazy, LazyPrimitive, Literal, LiteralPrimitive, LiteralProxy, LiteralValue, MakeOptional, MakeOptionalNoDefault, MaybeUndefined, NeedsValue, Number, NumberPrimitive, NumberProxy, Optional, PartialFields, PartialFieldsNoDefault, Primitive, PrimitiveInternal, ScalarPrimitive, String, StringPrimitive, StringProxy, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue, Tree, TreeNode, TreeNodeChildrenInput, TreeNodeConfig, TreeNodeDataSetInput, TreeNodePrimitive, TreeNodeProxyBase, TreeNodeSelf, TreeNodeSelfType, TreeNodeSetInput, TreeNodeSetInputUnion, TreeNodeSnapshot, TreeNodeState, TreeNodeUpdateValue, TreeOptions, TreePrimitive, TreeProxy, TreeSetInput, TreeState, TreeUpdateInput, TypedNodeProxy, TypedTreeNodeState, Union, UnionOptions, UnionPrimitive, UnionProxy, UnionSetInput, UnionVariants, ValidationError, Validator, applyDefaults, isCompatibleOperation, primitiveAllowsNullValue, runValidators };
17
17
  }
18
18
  //#endregion
19
19
  export { Primitive_d_exports };
@@ -223,13 +223,19 @@ var StructPrimitive = class StructPrimitive {
223
223
  validators: []
224
224
  });
225
225
  }
226
- /** Make all properties of this struct optional (TRequired = false for all fields) */
227
- partial() {
226
+ partial(options) {
227
+ const stripDefaults = options === null || options === void 0 ? void 0 : options.stripDefaults;
228
228
  const partialFields = {};
229
229
  for (const key in this._schema.fields) {
230
230
  const field = this._schema.fields[key];
231
- partialFields[key] = this._makeFieldOptional(field);
231
+ partialFields[key] = this._makeFieldOptional(field, stripDefaults);
232
232
  }
233
+ if (stripDefaults) return new StructPrimitive({
234
+ required: this._schema.required,
235
+ defaultValue: void 0,
236
+ fields: partialFields,
237
+ validators: []
238
+ });
233
239
  return new StructPrimitive({
234
240
  required: this._schema.required,
235
241
  defaultValue: void 0,
@@ -237,13 +243,46 @@ var StructPrimitive = class StructPrimitive {
237
243
  validators: []
238
244
  });
239
245
  }
240
- _makeFieldOptional(field) {
241
- const fieldAny = field;
242
- if (fieldAny._schema && typeof fieldAny._schema === "object") {
243
- const Constructor = field.constructor;
244
- return new Constructor(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, fieldAny._schema), {}, { required: false }));
246
+ _makeFieldOptional(field, stripDefaults) {
247
+ const maybeStripped = stripDefaults ? this._stripDefaultsRecursively(field) : field;
248
+ const fieldWithSchema = maybeStripped;
249
+ if (fieldWithSchema._schema && typeof fieldWithSchema._schema === "object") {
250
+ const Constructor = maybeStripped.constructor;
251
+ return new Constructor(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, fieldWithSchema._schema), {}, { required: false }));
252
+ }
253
+ return maybeStripped;
254
+ }
255
+ /**
256
+ * Recursively strips defaults from a primitive and nested child primitives.
257
+ * This is used by partial({ stripDefaults: true }) so omitted fields resolve to undefined.
258
+ */
259
+ _stripDefaultsRecursively(field) {
260
+ const fieldWithSchema = field;
261
+ if (!fieldWithSchema._schema || typeof fieldWithSchema._schema !== "object") return field;
262
+ const nextSchema = require_objectSpread2._objectSpread2({}, fieldWithSchema._schema);
263
+ if (nextSchema["fields"] && typeof nextSchema["fields"] === "object" && !Array.isArray(nextSchema["fields"])) {
264
+ const nextFields = {};
265
+ for (const key in nextSchema["fields"]) {
266
+ const nestedField = nextSchema["fields"][key];
267
+ nextFields[key] = this._stripDefaultsRecursively(nestedField);
268
+ }
269
+ nextSchema["fields"] = nextFields;
270
+ }
271
+ if (nextSchema["element"] && typeof nextSchema["element"] === "object") nextSchema["element"] = this._stripDefaultsRecursively(nextSchema["element"]);
272
+ if (Array.isArray(nextSchema["variants"])) nextSchema["variants"] = nextSchema["variants"].map((variant) => this._stripDefaultsRecursively(variant));
273
+ else if (nextSchema["variants"] && typeof nextSchema["variants"] === "object") {
274
+ const nextVariants = {};
275
+ for (const key in nextSchema["variants"]) {
276
+ const nestedVariant = nextSchema["variants"][key];
277
+ nextVariants[key] = this._stripDefaultsRecursively(nestedVariant);
278
+ }
279
+ nextSchema["variants"] = nextVariants;
245
280
  }
246
- return field;
281
+ if (nextSchema["root"] && typeof nextSchema["root"] === "object") nextSchema["root"] = this._stripDefaultsRecursively(nextSchema["root"]);
282
+ if ("defaultValue" in nextSchema) nextSchema["defaultValue"] = void 0;
283
+ if ("defaultInput" in nextSchema) nextSchema["defaultInput"] = void 0;
284
+ const Constructor = field.constructor;
285
+ return new Constructor(nextSchema);
247
286
  }
248
287
  _isRequiredWithoutDefault(field) {
249
288
  var _schema;
@@ -53,11 +53,20 @@ type StructUpdateValue<TFields extends Record<string, AnyPrimitive>> = { readonl
53
53
  * Preserves the primitive structure while changing the required flag.
54
54
  */
55
55
  type MakeOptional<T extends AnyPrimitive> = T extends Primitive<infer S, infer P, any, infer H, infer SI, infer UI> ? Primitive<S, P, false, H, SI, UI> : T;
56
+ /**
57
+ * Transforms a primitive type to make it optional and strip its default (TRequired = false, THasDefault = false).
58
+ */
59
+ type MakeOptionalNoDefault<T extends AnyPrimitive> = T extends Primitive<infer S, infer P, any, any, infer SI, infer UI> ? Primitive<S, P, false, false, SI, UI> : T;
56
60
  /**
57
61
  * Maps each field in a struct to its optional version.
58
62
  * All fields become optional (TRequired = false).
59
63
  */
60
64
  type PartialFields<TFields extends Record<string, AnyPrimitive>> = { [K in keyof TFields]: MakeOptional<TFields[K]> };
65
+ /**
66
+ * Maps each field in a struct to its optional version with defaults stripped.
67
+ * All fields become optional (TRequired = false) and lose their defaults (THasDefault = false).
68
+ */
69
+ type PartialFieldsNoDefault<TFields extends Record<string, AnyPrimitive>> = { [K in keyof TFields]: MakeOptionalNoDefault<TFields[K]> };
61
70
  /**
62
71
  * Maps a schema definition to its proxy type.
63
72
  * Provides nested field access + get()/set()/toSnapshot() methods for the whole struct.
@@ -99,14 +108,24 @@ declare class StructPrimitive<TFields extends Record<string, AnyPrimitive>, TReq
99
108
  refine(fn: (value: InferStructState<TFields>) => boolean, message: string): StructPrimitive<TFields, TRequired, THasDefault>;
100
109
  /** Extend this struct with additional fields */
101
110
  extend<TNewFields extends Record<string, AnyPrimitive>>(newFields: TNewFields): StructPrimitive<TFields & TNewFields, TRequired, THasDefault>;
102
- /** Make all properties of this struct optional (TRequired = false for all fields) */
103
- partial(): StructPrimitive<PartialFields<TFields>, TRequired, THasDefault>;
111
+ /** Make all properties of this struct optional (TRequired = false for all fields), optionally stripping defaults */
112
+ partial(options: {
113
+ stripDefaults: true;
114
+ }): StructPrimitive<PartialFieldsNoDefault<TFields>, TRequired, THasDefault>;
115
+ partial(options?: {
116
+ stripDefaults?: boolean;
117
+ }): StructPrimitive<PartialFields<TFields>, TRequired, THasDefault>;
104
118
  private _makeFieldOptional;
119
+ /**
120
+ * Recursively strips defaults from a primitive and nested child primitives.
121
+ * This is used by partial({ stripDefaults: true }) so omitted fields resolve to undefined.
122
+ */
123
+ private _stripDefaultsRecursively;
105
124
  private _isRequiredWithoutDefault;
106
125
  readonly _internal: PrimitiveInternal<InferStructState<TFields>, StructProxy<TFields, TRequired, THasDefault>>;
107
126
  }
108
127
  /** Creates a new StructPrimitive with the given fields */
109
128
  declare const Struct: <TFields extends Record<string, AnyPrimitive>>(fields: TFields) => StructPrimitive<TFields, false, false>;
110
129
  //#endregion
111
- export { InferStructSnapshot, InferStructState, MakeOptional, PartialFields, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue };
130
+ export { InferStructSnapshot, InferStructState, MakeOptional, MakeOptionalNoDefault, PartialFields, PartialFieldsNoDefault, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue };
112
131
  //# sourceMappingURL=Struct.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Struct.d.cts","names":[],"sources":["../../src/primitives/Struct.ts"],"sourcesContent":[],"mappings":";;;;;;AAM8L;AAYhJ;KAAzC,gBAK+C,CAAA,CAAA,CAAA,GALzB,CAKyB,SALf,SAKe,CAAA,GAAA,EAAA,GAAA,EAAA,IAAA,EAAA,KAAA,CAAA,GAAA,IAAA,GAAA,KAAA;;;;KAA/C,eAC4C,CAAA,gBADZ,MACY,CAAA,MAAA,EADG,YACH,CAAA,CAAA,GAAA,QAAzB,MAAV,OAAU,GAAA,gBAAA,CAAiB,OAAjB,CAAyB,CAAzB,CAAA,CAAA,SAAA,IAAA,GAA4C,CAA5C,GAAA,KAAA,EAA4C,CAAA,MAC5D,OAD4D,CAAA;;;AACrD;KAKV,eAA+C,CAAA,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eN,OA3eM,EAAA,KAAA,EAAA,KAAA,CAAA"}
@@ -54,11 +54,20 @@ type StructUpdateValue<TFields extends Record<string, AnyPrimitive>> = { readonl
54
54
  * Preserves the primitive structure while changing the required flag.
55
55
  */
56
56
  type MakeOptional<T extends AnyPrimitive> = T extends Primitive<infer S, infer P, any, infer H, infer SI, infer UI> ? Primitive<S, P, false, H, SI, UI> : T;
57
+ /**
58
+ * Transforms a primitive type to make it optional and strip its default (TRequired = false, THasDefault = false).
59
+ */
60
+ type MakeOptionalNoDefault<T extends AnyPrimitive> = T extends Primitive<infer S, infer P, any, any, infer SI, infer UI> ? Primitive<S, P, false, false, SI, UI> : T;
57
61
  /**
58
62
  * Maps each field in a struct to its optional version.
59
63
  * All fields become optional (TRequired = false).
60
64
  */
61
65
  type PartialFields<TFields extends Record<string, AnyPrimitive>> = { [K in keyof TFields]: MakeOptional<TFields[K]> };
66
+ /**
67
+ * Maps each field in a struct to its optional version with defaults stripped.
68
+ * All fields become optional (TRequired = false) and lose their defaults (THasDefault = false).
69
+ */
70
+ type PartialFieldsNoDefault<TFields extends Record<string, AnyPrimitive>> = { [K in keyof TFields]: MakeOptionalNoDefault<TFields[K]> };
62
71
  /**
63
72
  * Maps a schema definition to its proxy type.
64
73
  * Provides nested field access + get()/set()/toSnapshot() methods for the whole struct.
@@ -100,14 +109,24 @@ declare class StructPrimitive<TFields extends Record<string, AnyPrimitive>, TReq
100
109
  refine(fn: (value: InferStructState<TFields>) => boolean, message: string): StructPrimitive<TFields, TRequired, THasDefault>;
101
110
  /** Extend this struct with additional fields */
102
111
  extend<TNewFields extends Record<string, AnyPrimitive>>(newFields: TNewFields): StructPrimitive<TFields & TNewFields, TRequired, THasDefault>;
103
- /** Make all properties of this struct optional (TRequired = false for all fields) */
104
- partial(): StructPrimitive<PartialFields<TFields>, TRequired, THasDefault>;
112
+ /** Make all properties of this struct optional (TRequired = false for all fields), optionally stripping defaults */
113
+ partial(options: {
114
+ stripDefaults: true;
115
+ }): StructPrimitive<PartialFieldsNoDefault<TFields>, TRequired, THasDefault>;
116
+ partial(options?: {
117
+ stripDefaults?: boolean;
118
+ }): StructPrimitive<PartialFields<TFields>, TRequired, THasDefault>;
105
119
  private _makeFieldOptional;
120
+ /**
121
+ * Recursively strips defaults from a primitive and nested child primitives.
122
+ * This is used by partial({ stripDefaults: true }) so omitted fields resolve to undefined.
123
+ */
124
+ private _stripDefaultsRecursively;
106
125
  private _isRequiredWithoutDefault;
107
126
  readonly _internal: PrimitiveInternal<InferStructState<TFields>, StructProxy<TFields, TRequired, THasDefault>>;
108
127
  }
109
128
  /** Creates a new StructPrimitive with the given fields */
110
129
  declare const Struct: <TFields extends Record<string, AnyPrimitive>>(fields: TFields) => StructPrimitive<TFields, false, false>;
111
130
  //#endregion
112
- export { InferStructSnapshot, InferStructState, MakeOptional, PartialFields, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue };
131
+ export { InferStructSnapshot, InferStructState, MakeOptional, MakeOptionalNoDefault, PartialFields, PartialFieldsNoDefault, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue };
113
132
  //# sourceMappingURL=Struct.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Struct.d.mts","names":[],"sources":["../../src/primitives/Struct.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAM8L;AAYhJ,KAAzC,gBAKA,CAAe,CAAA,CAAA,GALO,CAKP,SALiB,SAKjB,CAAA,GAAA,EAAA,GAAA,EAAA,IAAA,EAAA,KAAA,CAAA,GAAA,IAAA,GAAA,KAAA;;;;KAAf,eACoC,CAAA,gBADJ,MACI,CAAA,MAAA,EADW,YACX,CAAA,CAAA,GAAA,QAAQ,MAAnC,OAAmC,GAAzB,gBAAyB,CAAR,OAAQ,CAAA,CAAA,CAAA,CAAA,SAAA,IAAA,GAAmB,CAAnB,GAAA,KAAA,EAAzB,CAAA,MAChB,OADgB,CAAA;;;;AACT,KAKV,eAAA,CAAA,gBAAgC,MAAjB,CAAA,MAAA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