@voidhash/mimic 0.0.1-alpha.5 → 0.0.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +13 -13
- package/dist/index.cjs +8 -7
- package/dist/index.d.cts +34 -18
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +34 -18
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/client/ClientDocument.ts +1 -1
- package/src/client/errors.ts +10 -10
- package/src/primitives/Boolean.ts +1 -1
- package/src/primitives/Literal.ts +1 -1
- package/src/primitives/Number.ts +1 -1
- package/src/primitives/String.ts +1 -1
- package/src/primitives/Struct.ts +2 -2
- package/src/primitives/Tree.ts +2 -2
- package/src/primitives/TreeNode.ts +49 -27
- package/src/primitives/Union.ts +1 -1
- package/src/server/errors.ts +6 -6
package/dist/index.mjs
CHANGED
|
@@ -309,7 +309,7 @@ var StringPrimitive = class StringPrimitive {
|
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
311
|
},
|
|
312
|
-
applyOperation: (
|
|
312
|
+
applyOperation: (_state, operation) => {
|
|
313
313
|
if (!isCompatibleOperation(operation, this._opDefinitions)) throw new ValidationError(`StringPrimitive cannot apply operation of kind: ${operation.kind}`);
|
|
314
314
|
const payload = operation.payload;
|
|
315
315
|
if (typeof payload !== "string") throw new ValidationError(`StringPrimitive.set requires a string payload, got: ${typeof payload}`);
|
|
@@ -431,7 +431,7 @@ var StructPrimitive = class StructPrimitive {
|
|
|
431
431
|
return buildSnapshot();
|
|
432
432
|
}
|
|
433
433
|
}, {
|
|
434
|
-
get: (target, prop,
|
|
434
|
+
get: (target, prop, _receiver) => {
|
|
435
435
|
if (prop === "get") return target.get;
|
|
436
436
|
if (prop === "set") return target.set;
|
|
437
437
|
if (prop === "toSnapshot") return target.toSnapshot;
|
|
@@ -442,7 +442,7 @@ var StructPrimitive = class StructPrimitive {
|
|
|
442
442
|
return fieldPrimitive._internal.createProxy(env, fieldPath);
|
|
443
443
|
}
|
|
444
444
|
},
|
|
445
|
-
has: (
|
|
445
|
+
has: (_target, prop) => {
|
|
446
446
|
if (prop === "get" || prop === "set" || prop === "toSnapshot") return true;
|
|
447
447
|
if (typeof prop === "string" && prop in fields) return true;
|
|
448
448
|
return false;
|
|
@@ -594,7 +594,7 @@ var BooleanPrimitive = class BooleanPrimitive {
|
|
|
594
594
|
}
|
|
595
595
|
};
|
|
596
596
|
},
|
|
597
|
-
applyOperation: (
|
|
597
|
+
applyOperation: (_state, operation) => {
|
|
598
598
|
if (operation.kind !== "boolean.set") throw new ValidationError(`BooleanPrimitive cannot apply operation of kind: ${operation.kind}`);
|
|
599
599
|
const payload = operation.payload;
|
|
600
600
|
if (typeof payload !== "boolean") throw new ValidationError(`BooleanPrimitive.set requires a boolean payload, got: ${typeof payload}`);
|
|
@@ -671,7 +671,7 @@ var NumberPrimitive = class NumberPrimitive {
|
|
|
671
671
|
}
|
|
672
672
|
};
|
|
673
673
|
},
|
|
674
|
-
applyOperation: (
|
|
674
|
+
applyOperation: (_state, operation) => {
|
|
675
675
|
if (operation.kind !== "number.set") throw new ValidationError(`NumberPrimitive cannot apply operation of kind: ${operation.kind}`);
|
|
676
676
|
const payload = operation.payload;
|
|
677
677
|
if (typeof payload !== "number") throw new ValidationError(`NumberPrimitive.set requires a number payload, got: ${typeof payload}`);
|
|
@@ -768,7 +768,7 @@ var LiteralPrimitive = class LiteralPrimitive {
|
|
|
768
768
|
}
|
|
769
769
|
};
|
|
770
770
|
},
|
|
771
|
-
applyOperation: (
|
|
771
|
+
applyOperation: (_state, operation) => {
|
|
772
772
|
if (operation.kind !== "literal.set") throw new ValidationError(`LiteralPrimitive cannot apply operation of kind: ${operation.kind}`);
|
|
773
773
|
const payload = operation.payload;
|
|
774
774
|
if (payload !== this._schema.literal) throw new ValidationError(`LiteralPrimitive.set requires the exact literal value "${globalThis.String(this._schema.literal)}", got: "${globalThis.String(payload)}"`);
|
|
@@ -1828,7 +1828,7 @@ const TreeNodeSelfSymbol = Symbol.for("TreeNode.Self");
|
|
|
1828
1828
|
* ```typescript
|
|
1829
1829
|
* const FolderNode = TreeNode("folder", {
|
|
1830
1830
|
* data: Struct({ name: String() }),
|
|
1831
|
-
* children: [
|
|
1831
|
+
* children: [TreeNodeSelf], // Folder can contain other folders
|
|
1832
1832
|
* });
|
|
1833
1833
|
* ```
|
|
1834
1834
|
*/
|
|
@@ -1850,6 +1850,7 @@ var TreeNodePrimitive = class {
|
|
|
1850
1850
|
_defineProperty(this, "_tag", "TreeNodePrimitive");
|
|
1851
1851
|
_defineProperty(this, "_Type", void 0);
|
|
1852
1852
|
_defineProperty(this, "_Data", void 0);
|
|
1853
|
+
_defineProperty(this, "_Children", void 0);
|
|
1853
1854
|
_defineProperty(this, "_type", void 0);
|
|
1854
1855
|
_defineProperty(this, "_data", void 0);
|
|
1855
1856
|
_defineProperty(this, "_children", void 0);
|