@mengine/medeo-client 2.0.1-alpha.2 → 2.0.1-alpha.4

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.
@@ -25,8 +25,13 @@ function newRelayDoc() {
25
25
  /** Load a detached relay doc from a stored snapshot. */
26
26
  function relayDocFromSnapshot(snapshot) {
27
27
  const doc = newRelayDoc();
28
- doc.import(snapshot);
29
- return doc;
28
+ try {
29
+ doc.import(snapshot);
30
+ return doc;
31
+ } catch (error) {
32
+ doc.free();
33
+ throw error;
34
+ }
30
35
  }
31
36
  /** A full-oplog clone (via snapshot round-trip) for non-destructive probing. */
32
37
  function cloneRelayDoc(doc) {
package/dist/relay.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as newRelayDoc, r as relayDocFromSnapshot, t as classifyUpdate } from "./loro-relay-doc-ssdYpuef.js";
1
+ import { n as newRelayDoc, r as relayDocFromSnapshot, t as classifyUpdate } from "./loro-relay-doc-cJSY-uau.js";
2
2
  export { classifyUpdate, newRelayDoc, relayDocFromSnapshot };
package/dist/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { At as VideoDraft, c as MirrorVideoDocumentAdapter } from "./index-B31KeDzA.js";
1
+ import { $ as VideoDraft, i as MirrorVideoDocumentAdapter } from "./index-CnZ9l3rb.js";
2
2
 
3
3
  //#region src/testing/in-memory-mengine-server.d.ts
4
4
  /**
@@ -55,7 +55,7 @@ interface SeedOptions {
55
55
  mainTrack?: string[];
56
56
  }
57
57
  declare function createTestDraft(): VideoDraft;
58
- declare function createSeededDoc(docId: string, opts?: SeedOptions, actor?: `${number}`): MirrorVideoDocumentAdapter;
58
+ declare function createSeededDoc(_docId: string, opts?: SeedOptions, actor?: `${number}`): MirrorVideoDocumentAdapter;
59
59
  declare function mainTrackPartIds(doc: MirrorVideoDocumentAdapter): string[];
60
60
  //#endregion
61
61
  export { ACTOR_TEST, InMemoryMengineServer, SeedOptions, createSeededDoc, createTestDraft, mainTrackPartIds };
package/dist/testing.js CHANGED
@@ -1,5 +1,5 @@
1
- import { bt as bytesToBase64, pt as VIDEO_DOCUMENT_SCHEMA_VERSION, s as createMirrorVideoDocumentAdapter, yt as base64ToBytes } from "./document-BSAUud6c.js";
2
- import { t as classifyUpdate } from "./loro-relay-doc-ssdYpuef.js";
1
+ import { R as base64ToBytes, r as createMirrorVideoDocumentAdapter, z as bytesToBase64 } from "./document-B_JQwrC5.js";
2
+ import { t as classifyUpdate } from "./loro-relay-doc-cJSY-uau.js";
3
3
  import { LoroDoc, VersionVector, encodeFrontiers } from "loro-crdt";
4
4
  //#region src/testing/in-memory-mengine-server.ts
5
5
  /**
@@ -32,14 +32,10 @@ var InMemoryMengineServer = class {
32
32
  const method = (init?.method ?? "GET").toUpperCase();
33
33
  const path = this.parsePath(url);
34
34
  if (path === "snapshot" && method === "GET") return this.handleSnapshot();
35
- if (path.startsWith("bootstrap") && method === "POST") return this.handleBootstrap(init);
35
+ if (/^\/internal\/mengine\/v1\/docs\/[^/]+\/bootstrap$/.test(new URL(url).pathname) && method === "POST") return this.handleBootstrap(init);
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
@@ -364,23 +325,8 @@ function createTestDraft() {
364
325
  version: 1
365
326
  };
366
327
  }
367
- function createSeededDoc(docId, opts = {}, actor = ACTOR_TEST) {
328
+ function createSeededDoc(_docId, opts = {}, actor = ACTOR_TEST) {
368
329
  return createMirrorVideoDocumentAdapter({
369
- meta: {
370
- schema_version: VIDEO_DOCUMENT_SCHEMA_VERSION,
371
- draft_id: docId,
372
- project_id: "project-test",
373
- owner_id: "owner-test",
374
- thumbnail_storage_key: "thumb-test",
375
- chat_session_id: "chat-test",
376
- video_creation_settings: {
377
- aspect_ratio: "16:9",
378
- voice_id: "test-voice",
379
- video_style_id: null,
380
- asset_sources: []
381
- },
382
- version: 1
383
- },
384
330
  timeline: { unit_time_ms: 33.33 },
385
331
  tracks: [{
386
332
  id: "main_track",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mengine/medeo-client",
3
- "version": "2.0.1-alpha.2",
3
+ "version": "2.0.1-alpha.4",
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,27 +23,23 @@
24
23
  "registry": "https://registry.npmjs.org/"
25
24
  },
26
25
  "dependencies": {
27
- "@noble/hashes": "^2.4.0",
28
- "immer": "^10.2.0",
29
- "loro-mirror": "^2.2.0",
26
+ "loro-mirror": "^2.3.3",
30
27
  "zod": "^4.4.3",
31
- "@mengine/storage": "2.0.1-alpha.2",
32
- "@mengine/sync": "2.0.1-alpha.2",
33
- "@mengine/utils": "2.0.1-alpha.2"
28
+ "@mengine/storage": "2.0.1-alpha.4",
29
+ "@mengine/sync": "2.0.1-alpha.4",
30
+ "@mengine/utils": "2.0.1-alpha.4"
34
31
  },
35
32
  "devDependencies": {
36
33
  "@types/node": "^25.9.1",
37
34
  "@typescript/native-preview": "7.0.0-dev.20260521.1",
38
- "loro-crdt": "^1.13.6",
39
- "tsx": "^4.22.3",
35
+ "loro-crdt": "^1.16.1",
40
36
  "typescript": "^6.0.3",
41
37
  "vite-plugin-wasm": "^3.6.0",
42
38
  "vite-plus": "^0.1.23",
43
- "@mengine/medeo-dsl": "0.0.0",
44
39
  "@mengine/idl-codegen": "0.0.0"
45
40
  },
46
41
  "peerDependencies": {
47
- "loro-crdt": "^1.13.6"
42
+ "loro-crdt": "^1.16.1"
48
43
  },
49
44
  "scripts": {
50
45
  "build": "vp pack",