Skip to content

Commit 32f4dc0

Browse files
committed
feat(json-crdt): 🎸 improve metadata and header types
1 parent 1bfe642 commit 32f4dc0

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/json-crdt/log/codec/LogEncoder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class LogEncoder {
2424

2525
public serialize(log: Log, params: SerializeParams = {}): types.LogComponents {
2626
if (params.noView && params.model === 'sidecar') throw new Error('SIDECAR_MODEL_WITHOUT_VIEW');
27-
const metadata: types.LogMetadata = [{}, FileModelEncoding.Auto];
27+
const metadata: types.LogHeader = [{}, FileModelEncoding.Auto];
2828
let model: Uint8Array | unknown | null = null;
2929
const modelFormat = params.model ?? 'sidecar';
3030
switch (modelFormat) {

src/json-crdt/log/codec/types.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import type {FileModelEncoding} from './constants';
22

3-
export type LogMetadata = [
4-
// biome-ignore lint: allow brackets
5-
map: {},
3+
export type LogHeader<LogMetadata extends Record<string, unknown> = Record<string, unknown>> = [
4+
map: LogMetadata,
65
modelFormat: FileModelEncoding,
76
];
87

9-
export type LogComponents = [
8+
export type LogComponents<LogMetadata extends Record<string, unknown> = Record<string, unknown>> = [
109
view: unknown | null,
11-
metadata: LogMetadata,
10+
header: LogHeader<LogMetadata>,
1211
model: Uint8Array | unknown | null,
1312
history: LogHistory,
1413
];

0 commit comments

Comments
 (0)