@mengine/medeo-client 1.1.0 → 1.2.1-alpha.0
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-C98vSu7J.js → document-49OdvviW.js} +146 -6
- package/dist/{index-BUKA3L7o.d.ts → index-BO2fSUKi.d.ts} +127 -608
- package/dist/index-InEWX9rk.d.ts +609 -0
- package/dist/index.d.ts +42 -34
- package/dist/index.js +148 -575
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.js +518 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +40 -1
- package/package.json +7 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as index_d_exports } from "./index-InEWX9rk.js";
|
|
2
|
+
import { $ as Track, A as TrackDraft, B as DerivedItemPosition, C as SemanticOpKind, D as ValidationError, E as SnapshotReadable, F as VideoDocumentValidationError, G as toVideoDocument, H as buildSpeechHostMap, I as assertValidVideoDocument, J as DEFAULT_UNIT_TIME_MS, K as BgmPart, L as validateVideoDocument, M as VideoDocumentDraft, N as VideoDocumentMirrorSchema, O as PartIdFactory, P as videoDocumentMirrorSchema, Q as Timeline, R as InitialDocumentFacts, S as PlannedSemanticOpKind, T as SchemaValidator, U as derivePositionFromAbs, V as SpeechHostMap, W as fromVideoDocument, X as PartUnion, Y as PartKind, Z as SpeechPart, _ as SemanticOpInput, _t as Timeline$1, a as PlainMemoryAdapter, at as VideoDocumentSchemaVersion, b as IMPLEMENTED_SEMANTIC_OP_KINDS, c as MirrorVideoDocumentAdapter, ct as VideoDraft, d as createMirrorVideoDocumentAdapter, dt as speedOf, et as TrackItem, f as writeVideoDocumentToDraft, ft as Attachment, g as SemanticEditor, gt as SpeedShift, h as SemanticDocumentAdapter, ht as PartAggregation, i as JournalEntry, it as VideoDocument, j as TrackItemDraft, k as generatePartId, l as MirrorVideoDocumentOptions, lt as VideoDraftPartUnion, m as OpActor, mt as CaptionStyle, n as videoDocumentSchema, nt as VIDEO_DOCUMENT_SCHEMA_VERSION, o as PlainMemoryAdapterOptions, ot as VideoDocumentValidationIssue, p as CommitOptions, pt as CaptionPart$1, q as CaptionPart, r as readVideoDocumentFromDraft, rt as VideoClipPart, s as createPlainMemoryAdapter, st as VideoDocumentValidationIssueCode, t as partUnionSchema, tt as TrackItemTimePosition, u as createMirrorVideoDocument, ut as effectiveVideoClipDurationMs, v as SemanticOpName, vt as Track$1, w as isImplementedSemanticOpKind, x as ImplementedSemanticOpKind, y as TransactAudit, yt as TrackItem$1, z as buildInitialVideoDocument } from "./index-BO2fSUKi.js";
|
|
2
3
|
import { PeerID } from "loro-crdt";
|
|
3
4
|
import { DocState } from "@mengine/sync";
|
|
4
|
-
import { BaseDocStorage, Connection, DocDiff, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
|
|
5
|
+
import { BaseDocStorage, Connection, DocDiff, DocPushReceipt, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
|
|
5
6
|
|
|
6
7
|
//#region src/client/base64.d.ts
|
|
7
8
|
declare function bytesToBase64(bytes: Uint8Array): string;
|
|
@@ -177,33 +178,23 @@ interface MengineEventStreamOptions {
|
|
|
177
178
|
}
|
|
178
179
|
declare function readMengineEventStream(options: MengineEventStreamOptions): Promise<void>;
|
|
179
180
|
//#endregion
|
|
180
|
-
//#region src/editor/
|
|
181
|
+
//#region src/editor/journal.d.ts
|
|
181
182
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* The authoritative online producers — agent-harness (`@harness/shared`
|
|
185
|
-
* `genObjId`) and director.v2 (`common/obj_id.py` `gen_obj_id`) — both mint part
|
|
186
|
-
* ids as `` `${prefix}_${ulid()}` ``, and real captured drafts use exactly that
|
|
187
|
-
* shape (`clip_…` / `spe_…` / `cap_…` / `bgm_…`, each a 26-char ULID). The engine
|
|
188
|
-
* previously emitted `vc_<base36 timestamp><6 random>`, a different prefix AND a
|
|
189
|
-
* different encoding — the sole cross-repo id divergence. This module removes it
|
|
190
|
-
* by emitting the same `<prefix>_<ULID>` bytes.
|
|
191
|
-
*
|
|
192
|
-
* The ULID is generated inline (Crockford Base32, 48-bit time + 80-bit random)
|
|
193
|
-
* rather than pulling the `ulid` npm package: the randomness class matches the
|
|
194
|
-
* old generator (both `Math.random`-based) and it keeps `@mengine/medeo-client`
|
|
195
|
-
* dependency-free for a purely mechanical id string. Part ids only need to be
|
|
196
|
-
* unique and lexicographically time-sortable, which this satisfies.
|
|
183
|
+
* Wire a plain-memory adapter + editor that share a recording id factory, so
|
|
184
|
+
* every mutating transact lands in `journal` with ordered `generated_ids`.
|
|
197
185
|
*/
|
|
186
|
+
declare function createEditSandbox(document: VideoDocument, options?: PlainMemoryAdapterOptions): {
|
|
187
|
+
adapter: PlainMemoryAdapter;
|
|
188
|
+
editor: SemanticEditor;
|
|
189
|
+
journal: readonly JournalEntry[];
|
|
190
|
+
};
|
|
198
191
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* `
|
|
203
|
-
* payloads, so the engine never generates them itself.
|
|
192
|
+
* Re-drive `doc` from a recorded journal, forcing each entry's `generated_ids`
|
|
193
|
+
* through a queue-backed id factory. Never mints fresh ids: an empty queue on
|
|
194
|
+
* demand throws `unrecorded id`; leftover ids after an entry throws
|
|
195
|
+
* `unconsumed ids`. Legacy entries without `generated_ids` are treated as `[]`.
|
|
204
196
|
*/
|
|
205
|
-
|
|
206
|
-
declare function generatePartId(prefix: PartIdPrefix): string;
|
|
197
|
+
declare function replayJournal(doc: SemanticDocumentAdapter, journal: readonly JournalEntry[]): Promise<void>;
|
|
207
198
|
//#endregion
|
|
208
199
|
//#region src/editor/snapshot-utils.d.ts
|
|
209
200
|
/** Main-track item identity read from a raw snapshot (only `part_id` is needed). */
|
|
@@ -549,19 +540,24 @@ declare class MedeoHttpDocStorage implements DocStorage {
|
|
|
549
540
|
getDoc(docId: string): Promise<DocSnapshotRecord | null>;
|
|
550
541
|
getDocDiff(docId: string, knownVersion?: Uint8Array): Promise<DocDiff | null>;
|
|
551
542
|
/**
|
|
552
|
-
* Forward one update to the server.
|
|
543
|
+
* Forward one update to the server, returning what the server says it now holds.
|
|
544
|
+
*
|
|
545
|
+
* The returned `server_vv` is the server's own statement about itself, computed
|
|
546
|
+
* inside the write transaction. A caller tracking "what the remote has" can
|
|
547
|
+
* adopt it directly, which is strictly better than inferring that bound from
|
|
548
|
+
* the pushed blob: it also covers ops other peers wrote, so those stop being
|
|
549
|
+
* re-sent on every later push. `ack` and `duplicate` both carry it.
|
|
553
550
|
*
|
|
554
|
-
* The
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
* (bytes contributed nothing) was indistinguishable from a successful write.
|
|
551
|
+
* The verdict itself stays on {@link subscribePushOutcome}, which reports
|
|
552
|
+
* failures too — a return value cannot. Previously the verdict was read and
|
|
553
|
+
* dropped, so a `duplicate` (bytes contributed nothing) was indistinguishable
|
|
554
|
+
* from a successful write.
|
|
559
555
|
*
|
|
560
556
|
* The error is still rethrown after being published: the synchronizer treats a
|
|
561
557
|
* throw as "retry this cycle", and swallowing it here would strand the update.
|
|
562
558
|
* Publishing is therefore additive observability, not error handling.
|
|
563
559
|
*/
|
|
564
|
-
pushDocUpdate(update: DocUpdate, _origin: unknown): Promise<
|
|
560
|
+
pushDocUpdate(update: DocUpdate, _origin: unknown): Promise<DocPushReceipt>;
|
|
565
561
|
/**
|
|
566
562
|
* Observe the server's verdict for every pushed update, including failures.
|
|
567
563
|
*
|
|
@@ -708,6 +704,18 @@ declare class MengineDocSession {
|
|
|
708
704
|
* step. The committed change drives DocManager's local-update push.
|
|
709
705
|
*/
|
|
710
706
|
get editor(): SemanticEditor;
|
|
707
|
+
/**
|
|
708
|
+
* Opaque version token of the local oplog (base64 `VersionVector.encode`).
|
|
709
|
+
* Equality-comparable only: equal means no observed change (local or
|
|
710
|
+
* remote-arrived) since the token was taken. Throws when not started.
|
|
711
|
+
*/
|
|
712
|
+
version(): string;
|
|
713
|
+
/**
|
|
714
|
+
* The live document adapter, exposed for journal replay (commit channel).
|
|
715
|
+
* Replaying through it still goes SemanticEditor → Loro → mengine-server —
|
|
716
|
+
* no write bypass. Typed by the narrow interface on purpose.
|
|
717
|
+
*/
|
|
718
|
+
get documentAdapter(): SemanticDocumentAdapter;
|
|
711
719
|
/** Current document snapshot (read model). */
|
|
712
720
|
snapshot(): VideoDocument;
|
|
713
721
|
/**
|
|
@@ -750,7 +758,7 @@ declare class MemoryDocStorage extends BaseDocStorage {
|
|
|
750
758
|
readonly connection: Connection;
|
|
751
759
|
private readonly entries;
|
|
752
760
|
constructor(options?: DocStorageOptions);
|
|
753
|
-
pushDocUpdate(update: DocUpdate, origin: unknown): Promise<
|
|
761
|
+
pushDocUpdate(update: DocUpdate, origin: unknown): Promise<DocPushReceipt>;
|
|
754
762
|
deleteDoc(docId: string): Promise<void>;
|
|
755
763
|
protected getDocSnapshot(docId: string): Promise<DocSnapshotRecord | null>;
|
|
756
764
|
protected setDocSnapshot(snapshot: DocSnapshotRecord): Promise<boolean>;
|
|
@@ -1059,4 +1067,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
|
|
|
1059
1067
|
*/
|
|
1060
1068
|
declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
|
|
1061
1069
|
//#endregion
|
|
1062
|
-
export { type Aggregation, type Attachment, type BgmPart, type CaptionPart, type CaptionStyle, type CommitOptions, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImplementedSemanticOpKind, type InitialDocumentFacts, LANE_KINDS_IN_STACK_ORDER, type LaneKind, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type OpActor, type PartAggregation, type PartKind, type PartUnion, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, SchemaValidator, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, type VideoDocumentSchemaVersion, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type WaitForServerAckOptions, arrangeMainTrackSeamlessly, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, decodeDocVersionMark, derivePositionFromAbs, encodeDocVersionMark, ensureLaneTrack, fillMainTrackTimeGaps, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, partDurationMs, partUnionSchema, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, resolveAllSpeechOverlaps, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, snapshotToPlain, solveVideoDocument, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
|
|
1070
|
+
export { type Aggregation, type Attachment, type BgmPart, type CaptionPart, type CaptionStyle, type CommitOptions, DEFAULT_UNIT_TIME_MS, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImplementedSemanticOpKind, type InitialDocumentFacts, type JournalEntry, LANE_KINDS_IN_STACK_ORDER, type LaneKind, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type OpActor, type PartAggregation, type PartIdFactory, type PartKind, type PartUnion, PlainMemoryAdapter, type PlainMemoryAdapterOptions, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, SchemaValidator, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, type VideoDocumentSchemaVersion, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type WaitForServerAckOptions, arrangeMainTrackSeamlessly, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureLaneTrack, fillMainTrackTimeGaps, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, partDurationMs, partUnionSchema, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };
|