@mengine/medeo-client 1.2.1-alpha.0 → 1.2.1-alpha.1
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/dist/{document-49OdvviW.js → document-Dcu87api.js} +22 -126
- package/dist/{index-BO2fSUKi.d.ts → index-CZlTzzrm.d.ts} +624 -105
- package/dist/index.d.ts +25 -28
- package/dist/index.js +605 -135
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -40
- package/package.json +4 -7
- package/dist/index-InEWX9rk.d.ts +0 -609
- package/dist/schemas.d.ts +0 -2
- package/dist/schemas.js +0 -518
package/dist/testing.d.ts
CHANGED
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as VIDEO_DOCUMENT_SCHEMA_VERSION, R as base64ToBytes, r as createMirrorVideoDocumentAdapter, z as bytesToBase64 } from "./document-Dcu87api.js";
|
|
2
2
|
import { t as classifyUpdate } from "./loro-relay-doc-ssdYpuef.js";
|
|
3
3
|
import { LoroDoc, VersionVector, encodeFrontiers } from "loro-crdt";
|
|
4
4
|
//#region src/testing/in-memory-mengine-server.ts
|
|
@@ -36,10 +36,6 @@ var InMemoryMengineServer = class {
|
|
|
36
36
|
if (path.startsWith("sync") && method === "GET") return this.handleSync(url);
|
|
37
37
|
if (path === "updates" && method === "POST") return this.handlePush(init);
|
|
38
38
|
if (path === "events" && method === "GET") return this.handleEvents(init);
|
|
39
|
-
if (path === "audit" && method === "GET") return Response.json({ entries: extractAllMeta(this.doc).map((meta, index) => ({
|
|
40
|
-
...meta,
|
|
41
|
-
update_seq: index
|
|
42
|
-
})) });
|
|
43
39
|
return new Response("not found", { status: 404 });
|
|
44
40
|
};
|
|
45
41
|
parsePath(url) {
|
|
@@ -222,41 +218,6 @@ function extractMeta(doc, baseVV) {
|
|
|
222
218
|
frontiers
|
|
223
219
|
};
|
|
224
220
|
}
|
|
225
|
-
/** Mirror the real server audit: one deterministic entry per Loro Change. */
|
|
226
|
-
function extractAllMeta(doc) {
|
|
227
|
-
const json = doc.exportJsonUpdates(new VersionVector(/* @__PURE__ */ new Map()));
|
|
228
|
-
const parsed = typeof json === "string" ? JSON.parse(json) : json;
|
|
229
|
-
const peers = parsed.peers ?? [];
|
|
230
|
-
return (parsed.changes ?? []).map((change) => {
|
|
231
|
-
const [counterPart, peerPart] = change.id.split("@");
|
|
232
|
-
return {
|
|
233
|
-
peer: peers[Number(peerPart)] ?? peerPart ?? "0",
|
|
234
|
-
counter: Number(counterPart),
|
|
235
|
-
opsLen: change.ops?.length ?? 1,
|
|
236
|
-
lamport: change.lamport ?? 0,
|
|
237
|
-
timestamp: change.timestamp ?? 0,
|
|
238
|
-
message: change.msg ?? change.message ?? null
|
|
239
|
-
};
|
|
240
|
-
}).sort((a, b) => a.lamport - b.lamport || a.peer.localeCompare(b.peer)).map((change) => {
|
|
241
|
-
const { semantic_op, payload, intent, actor, parse_error } = parseMessage(change.message);
|
|
242
|
-
return {
|
|
243
|
-
semantic_op,
|
|
244
|
-
payload,
|
|
245
|
-
intent,
|
|
246
|
-
actor,
|
|
247
|
-
message: change.message,
|
|
248
|
-
parse_error,
|
|
249
|
-
peer: change.peer,
|
|
250
|
-
counter: change.counter,
|
|
251
|
-
lamport: change.lamport,
|
|
252
|
-
timestamp: change.timestamp,
|
|
253
|
-
frontiers: bytesToBase64(encodeFrontiers([{
|
|
254
|
-
peer: change.peer,
|
|
255
|
-
counter: change.counter + change.opsLen - 1
|
|
256
|
-
}]))
|
|
257
|
-
};
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
221
|
/**
|
|
261
222
|
* Mirrors `apps/mengine-server`'s `parseMessage` / `parseActor`. Kept in step
|
|
262
223
|
* deliberately: this double is what harness tests push against, so a divergence
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mengine/medeo-client",
|
|
3
|
-
"version": "1.2.1-alpha.
|
|
3
|
+
"version": "1.2.1-alpha.1",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"exports": {
|
|
16
16
|
".": "./dist/index.js",
|
|
17
17
|
"./relay": "./dist/relay.js",
|
|
18
|
-
"./schemas": "./dist/schemas.js",
|
|
19
18
|
"./testing": "./dist/testing.js",
|
|
20
19
|
"./package.json": "./package.json"
|
|
21
20
|
},
|
|
@@ -24,18 +23,16 @@
|
|
|
24
23
|
"registry": "https://registry.npmjs.org/"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"immer": "^10.2.0",
|
|
28
26
|
"loro-mirror": "^2.2.0",
|
|
29
27
|
"zod": "^4.4.3",
|
|
30
|
-
"@mengine/storage": "1.2.1-alpha.
|
|
31
|
-
"@mengine/sync": "1.2.1-alpha.
|
|
32
|
-
"@mengine/utils": "1.2.1-alpha.
|
|
28
|
+
"@mengine/storage": "1.2.1-alpha.1",
|
|
29
|
+
"@mengine/sync": "1.2.1-alpha.1",
|
|
30
|
+
"@mengine/utils": "1.2.1-alpha.1"
|
|
33
31
|
},
|
|
34
32
|
"devDependencies": {
|
|
35
33
|
"@types/node": "^25.9.1",
|
|
36
34
|
"@typescript/native-preview": "7.0.0-dev.20260521.1",
|
|
37
35
|
"loro-crdt": "^1.13.6",
|
|
38
|
-
"tsx": "^4.22.3",
|
|
39
36
|
"typescript": "^6.0.3",
|
|
40
37
|
"vite-plugin-wasm": "^3.6.0",
|
|
41
38
|
"vite-plus": "^0.1.23",
|