@batterai/collab-protocol 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # @batterai/collab-protocol
2
+
3
+ ## 0.1.0
4
+
5
+ - Baseline collaboration protocol frames and page-operation reducer.
6
+ - Ships as Node-compatible ESM with declaration files under `dist/`.
package/LICENSE ADDED
@@ -0,0 +1,101 @@
1
+ Business Source License 1.1
2
+
3
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
5
+
6
+ Parameters
7
+
8
+ Licensor: Batterai.eu
9
+
10
+ Licensed Work: @batterai/collab-protocol, a package of the Battery Editor.
11
+ The Licensed Work is (c) 2026 Batterai.eu.
12
+
13
+ Additional Use Grant: You may use the Licensed Work in
14
+ non-production environments without a commercial
15
+ license. Non-production use means use for development,
16
+ testing, evaluation, demonstration, or staging, where
17
+ the Licensed Work is not used to author or manage
18
+ content served to persons other than your developers,
19
+ testers, and reviewers. Any other use is production use
20
+ and requires a commercial license from the Licensor.
21
+
22
+ Change Date: Two years from the date each version of the Licensed
23
+ Work is first publicly distributed under this License.
24
+
25
+ Change License: Apache License, Version 2.0
26
+
27
+ For information about alternative licensing arrangements for the Licensed
28
+ Work, please contact Batterai.eu.
29
+
30
+ Terms
31
+
32
+ The Licensor hereby grants you the right to copy, modify, create derivative
33
+ works, redistribute, and make non-production use of the Licensed Work. The
34
+ Licensor may make an Additional Use Grant, above, permitting limited
35
+ production use.
36
+
37
+ Effective on the Change Date, or the fourth anniversary of the first publicly
38
+ available distribution of a specific version of the Licensed Work under this
39
+ License, whichever comes first, the Licensor hereby grants you rights under
40
+ the terms of the Change License, and the rights granted in the paragraph
41
+ above terminate.
42
+
43
+ If your use of the Licensed Work does not comply with the requirements
44
+ currently in effect as described in this License, you must purchase a
45
+ commercial license from the Licensor, its affiliated entities, or authorized
46
+ resellers, or you must refrain from using the Licensed Work.
47
+
48
+ All copies of the original and modified Licensed Work, and derivative works
49
+ of the Licensed Work, are subject to this License. This License applies
50
+ separately for each version of the Licensed Work and the Change Date may vary
51
+ for each version of the Licensed Work released by Licensor.
52
+
53
+ You must conspicuously display this License on each original or modified copy
54
+ of the Licensed Work. If you receive the Licensed Work in original or
55
+ modified form from a third party, the terms and conditions set forth in this
56
+ License apply to your use of that work.
57
+
58
+ Any use of the Licensed Work in violation of this License will automatically
59
+ terminate your rights under this License for the current and all other
60
+ versions of the Licensed Work.
61
+
62
+ This License does not grant you any right in any trademark or logo of
63
+ Licensor or its affiliates (provided that you may use a trademark or logo of
64
+ Licensor as expressly required by this License).
65
+
66
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
67
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
68
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
69
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
70
+ TITLE.
71
+
72
+ MariaDB hereby grants you permission to use this License's text to license
73
+ your works, and to refer to it using the trademark "Business Source License",
74
+ as long as you comply with the Covenants of Licensor below.
75
+
76
+ Covenants of Licensor
77
+
78
+ In consideration of the right to use this License's text and the "Business
79
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
80
+ other recipients of the licensed work to be provided by Licensor:
81
+
82
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
83
+ or a license that is compatible with GPL Version 2.0 or any later version,
84
+ where "compatible" means that software provided under the Change License
85
+ can be included in a program with software provided under GPL Version 2.0
86
+ or a later version. Licensor may specify additional Change Licenses
87
+ without limitation.
88
+
89
+ 2. To either: (a) specify an additional grant of rights to use that does not
90
+ impose any additional restriction on the right granted in this License, as
91
+ the Additional Use Grant; or (b) insert the text "None".
92
+
93
+ 3. To specify a Change Date.
94
+
95
+ 4. Not to modify this License in any other way.
96
+
97
+ Notice
98
+
99
+ The Business Source License (this document, or the "License") is not an Open
100
+ Source license. However, the Licensed Work will eventually be made available
101
+ under an Open Source License, as stated in this License.
@@ -0,0 +1,3 @@
1
+ export * from "./schema";
2
+ export * from "./page-reducer";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./schema.js";
2
+ export * from "./page-reducer.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Page } from "@batterai/bind-core";
2
+ import type { PageOp, CollabPageRecord, PageRecordReduceResult, PageReduceResult } from "./schema";
3
+ export declare function applyPageOp(page: Page, op: PageOp): PageReduceResult;
4
+ export declare function applyPageRecordOp(record: CollabPageRecord, op: PageOp): PageRecordReduceResult;
5
+ //# sourceMappingURL=page-reducer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-reducer.d.ts","sourceRoot":"","sources":["../src/page-reducer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,IAAI,EAAqC,MAAM,qBAAqB,CAAC;AAC9F,OAAO,KAAK,EAKV,MAAM,EACN,gBAAgB,EAChB,sBAAsB,EAEtB,gBAAgB,EAIjB,MAAM,UAAU,CAAC;AAoQlB,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,gBAAgB,CAiBpE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,GAAG,sBAAsB,CAmB9F"}
@@ -0,0 +1,277 @@
1
+ function reject(code, message) {
2
+ return { ok: false, code, message };
3
+ }
4
+ function clonePage(page) {
5
+ return structuredClone(page);
6
+ }
7
+ function pageIdsMatch(page, op) {
8
+ return page.id === op.pageId;
9
+ }
10
+ function isPropValue(value) {
11
+ if (typeof value !== "object" || value === null || Array.isArray(value))
12
+ return false;
13
+ const kind = value.kind;
14
+ return kind === "literal" || kind === "binding" || kind === "rich";
15
+ }
16
+ function visitAll(nodes, visit) {
17
+ for (const node of nodes) {
18
+ visit(node, false);
19
+ if (node.kind === "block" && node.children)
20
+ visitAll(node.children, visit);
21
+ if (node.kind === "repeater")
22
+ visitTemplate(node.itemTemplate, visit);
23
+ }
24
+ }
25
+ function visitTemplate(node, visit) {
26
+ visit(node, true);
27
+ if (node.kind === "block" && node.children) {
28
+ for (const child of node.children)
29
+ visitTemplate(child, visit);
30
+ }
31
+ if (node.kind === "repeater")
32
+ visitTemplate(node.itemTemplate, visit);
33
+ }
34
+ function idsInSubtree(node) {
35
+ const ids = [];
36
+ const visit = (candidate) => {
37
+ ids.push(candidate.id);
38
+ if (candidate.kind === "block" && candidate.children) {
39
+ for (const child of candidate.children)
40
+ visit(child);
41
+ }
42
+ if (candidate.kind === "repeater")
43
+ visit(candidate.itemTemplate);
44
+ };
45
+ visit(node);
46
+ return ids;
47
+ }
48
+ function findInRepeaterTemplate(page, nodeId) {
49
+ let found = false;
50
+ visitAll(page.root, (node, inRepeaterTemplate) => {
51
+ if (inRepeaterTemplate && node.id === nodeId)
52
+ found = true;
53
+ });
54
+ return found;
55
+ }
56
+ function templateContainerNodeId(page, container) {
57
+ if (container.kind !== "block-children")
58
+ return undefined;
59
+ return findInRepeaterTemplate(page, container.nodeId) ? container.nodeId : undefined;
60
+ }
61
+ function collectExistingIds(page) {
62
+ const ids = new Set();
63
+ visitAll(page.root, (node) => {
64
+ ids.add(node.id);
65
+ });
66
+ return ids;
67
+ }
68
+ function hasDuplicateIds(node) {
69
+ const seen = new Set();
70
+ for (const id of idsInSubtree(node)) {
71
+ if (seen.has(id))
72
+ return true;
73
+ seen.add(id);
74
+ }
75
+ return false;
76
+ }
77
+ function findOperationalNode(list, nodeId, parentContainer = { kind: "root" }) {
78
+ for (let index = 0; index < list.length; index += 1) {
79
+ const node = list[index];
80
+ if (!node)
81
+ continue;
82
+ if (node.id === nodeId)
83
+ return { node, list, index, parentContainer };
84
+ if (node.kind === "block" && node.children) {
85
+ const found = findOperationalNode(node.children, nodeId, {
86
+ kind: "block-children",
87
+ nodeId: node.id,
88
+ });
89
+ if (found)
90
+ return found;
91
+ }
92
+ }
93
+ return undefined;
94
+ }
95
+ function findOperationalNodeById(page, nodeId) {
96
+ return findOperationalNode(page.root, nodeId);
97
+ }
98
+ function resolveContainer(page, container) {
99
+ if (container.kind === "root")
100
+ return { list: page.root, ref: container };
101
+ const located = findOperationalNodeById(page, container.nodeId);
102
+ if (!located)
103
+ return reject("container_not_found", `container block ${container.nodeId} was not found`);
104
+ if (located.node.kind !== "block") {
105
+ return reject("unsupported_repeater_template", `container ${container.nodeId} is not a block`);
106
+ }
107
+ located.node.children ??= [];
108
+ return { list: located.node.children, ref: container };
109
+ }
110
+ function positionIndex(list, position) {
111
+ switch (position.kind) {
112
+ case "first":
113
+ return 0;
114
+ case "last":
115
+ return list.length;
116
+ case "before": {
117
+ const index = list.findIndex((node) => node.id === position.siblingId);
118
+ return index < 0
119
+ ? reject("position_anchor_not_found", `sibling ${position.siblingId} was not found`)
120
+ : index;
121
+ }
122
+ case "after": {
123
+ const index = list.findIndex((node) => node.id === position.siblingId);
124
+ return index < 0
125
+ ? reject("position_anchor_not_found", `sibling ${position.siblingId} was not found`)
126
+ : index + 1;
127
+ }
128
+ }
129
+ }
130
+ function isReject(value) {
131
+ return typeof value === "object" && "ok" in value && value.ok === false;
132
+ }
133
+ function sameContainer(a, b) {
134
+ if (a.kind !== b.kind)
135
+ return false;
136
+ return a.kind === "root" ? true : a.nodeId === b.nodeId;
137
+ }
138
+ function subtreeContains(node, nodeId) {
139
+ if (node.id === nodeId)
140
+ return true;
141
+ if (node.kind === "block" && node.children) {
142
+ return node.children.some((child) => subtreeContains(child, nodeId));
143
+ }
144
+ return false;
145
+ }
146
+ function insertNode(page, original, op) {
147
+ const templateContainer = templateContainerNodeId(original, op.container);
148
+ if (templateContainer) {
149
+ return reject("unsupported_repeater_template", `container ${templateContainer} is inside a repeater template`);
150
+ }
151
+ if (hasDuplicateIds(op.node))
152
+ return reject("duplicate_node_id", "inserted subtree contains duplicate ids");
153
+ const existing = collectExistingIds(page);
154
+ for (const id of idsInSubtree(op.node)) {
155
+ if (existing.has(id))
156
+ return reject("duplicate_node_id", `node id ${id} already exists`);
157
+ }
158
+ const container = resolveContainer(page, op.container);
159
+ if (isReject(container))
160
+ return container;
161
+ const index = positionIndex(container.list, op.position);
162
+ if (isReject(index))
163
+ return index;
164
+ container.list.splice(index, 0, structuredClone(op.node));
165
+ return { ok: true, page };
166
+ }
167
+ function setPageProp(page, original, op) {
168
+ const located = findOperationalNodeById(page, op.nodeId);
169
+ if (!located) {
170
+ if (findInRepeaterTemplate(original, op.nodeId)) {
171
+ return reject("unsupported_repeater_template", `node ${op.nodeId} is inside a repeater template`);
172
+ }
173
+ return reject("node_not_found", `node ${op.nodeId} was not found`);
174
+ }
175
+ if (located.node.kind !== "block")
176
+ return reject("invalid_prop", `node ${op.nodeId} is not a block`);
177
+ if (!isPropValue(op.value))
178
+ return reject("invalid_prop", `value for ${op.field} is not a PropValue`);
179
+ located.node.props = { ...located.node.props, [op.field]: structuredClone(op.value) };
180
+ return { ok: true, page };
181
+ }
182
+ function removePageProp(page, original, op) {
183
+ const located = findOperationalNodeById(page, op.nodeId);
184
+ if (!located) {
185
+ if (findInRepeaterTemplate(original, op.nodeId)) {
186
+ return reject("unsupported_repeater_template", `node ${op.nodeId} is inside a repeater template`);
187
+ }
188
+ return reject("node_not_found", `node ${op.nodeId} was not found`);
189
+ }
190
+ if (located.node.kind !== "block")
191
+ return reject("invalid_prop", `node ${op.nodeId} is not a block`);
192
+ const props = { ...located.node.props };
193
+ delete props[op.field];
194
+ located.node.props = props;
195
+ return { ok: true, page };
196
+ }
197
+ function removeNode(page, original, op) {
198
+ const located = findOperationalNodeById(page, op.nodeId);
199
+ if (!located) {
200
+ if (findInRepeaterTemplate(original, op.nodeId)) {
201
+ return reject("unsupported_repeater_template", `node ${op.nodeId} is inside a repeater template`);
202
+ }
203
+ return reject("node_not_found", `node ${op.nodeId} was not found`);
204
+ }
205
+ located.list.splice(located.index, 1);
206
+ return { ok: true, page };
207
+ }
208
+ function moveNode(page, original, op) {
209
+ const located = findOperationalNodeById(page, op.nodeId);
210
+ if (!located) {
211
+ if (findInRepeaterTemplate(original, op.nodeId)) {
212
+ return reject("unsupported_repeater_template", `node ${op.nodeId} is inside a repeater template`);
213
+ }
214
+ return reject("node_not_found", `node ${op.nodeId} was not found`);
215
+ }
216
+ if (op.to.container.kind === "block-children" && subtreeContains(located.node, op.to.container.nodeId)) {
217
+ return reject("cycle", `cannot move ${op.nodeId} inside itself`);
218
+ }
219
+ if (sameContainer(located.parentContainer, op.to.container) &&
220
+ (op.to.position.kind === "before" || op.to.position.kind === "after") &&
221
+ op.to.position.siblingId === op.nodeId) {
222
+ return { ok: true, page };
223
+ }
224
+ const [moved] = located.list.splice(located.index, 1);
225
+ if (!moved)
226
+ return reject("node_not_found", `node ${op.nodeId} was not found`);
227
+ const container = resolveContainer(page, op.to.container);
228
+ if (isReject(container))
229
+ return container;
230
+ const index = positionIndex(container.list, op.to.position);
231
+ if (isReject(index))
232
+ return index;
233
+ container.list.splice(index, 0, moved);
234
+ return { ok: true, page };
235
+ }
236
+ export function applyPageOp(page, op) {
237
+ if (!pageIdsMatch(page, op))
238
+ return reject("page_id_mismatch", `op targets ${op.pageId}, page is ${page.id}`);
239
+ const next = clonePage(page);
240
+ switch (op.t) {
241
+ case "set-page-setting":
242
+ return reject("invalid_prop", "page settings must be reduced against the collab page record");
243
+ case "set-page-prop":
244
+ return setPageProp(next, page, op);
245
+ case "remove-page-prop":
246
+ return removePageProp(next, page, op);
247
+ case "insert-node":
248
+ return insertNode(next, page, op);
249
+ case "remove-node":
250
+ return removeNode(next, page, op);
251
+ case "move-node":
252
+ return moveNode(next, page, op);
253
+ }
254
+ }
255
+ export function applyPageRecordOp(record, op) {
256
+ if (record.page.id !== op.pageId) {
257
+ return {
258
+ ok: false,
259
+ code: "page_id_mismatch",
260
+ message: `op targets ${op.pageId}, page is ${record.page.id}`,
261
+ };
262
+ }
263
+ if (op.t !== "set-page-setting") {
264
+ const reduced = applyPageOp(record.page, op);
265
+ return reduced.ok ? { ok: true, record: { ...record, page: reduced.page } } : reduced;
266
+ }
267
+ const settings = { ...(record.canvasSettings ?? {}) };
268
+ if (op.value === null)
269
+ delete settings[op.field];
270
+ else
271
+ settings[op.field] = structuredClone(op.value);
272
+ return {
273
+ ok: true,
274
+ record: { ...record, canvasSettings: settings },
275
+ };
276
+ }
277
+ //# sourceMappingURL=page-reducer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-reducer.js","sourceRoot":"","sources":["../src/page-reducer.ts"],"names":[],"mappings":"AAoCA,SAAS,MAAM,CAAC,IAA0B,EAAE,OAAe;IACzD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,SAAS,CAAC,IAAU;IAC3B,OAAO,eAAe,CAAC,IAAI,CAAgB,CAAC;AAC9C,CAAC;AAED,SAAS,YAAY,CAAC,IAAU,EAAE,EAAU;IAC1C,OAAO,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC;AAC/B,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtF,MAAM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EAAE,EAAE,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IACxF,CAAC;IACD,MAAM,QAAQ,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,cAAc,IAAI,EAAE,CAAC,EAA6B,CAAC;IACjF,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI;QAAE,OAAO,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;;QAC5C,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO;QACL,EAAE,EAAE,IAAI;QACR,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,cAAc,EAAE,QAAyD,EAAE;KACjG,CAAC;AACJ,CAAC"}
@@ -0,0 +1,318 @@
1
+ import type { FieldName, Locale, Page, PageId, PageNode, PropValue, SchemaVersion } from "@batterai/bind-core";
2
+ import type { CanvasPage } from "@batterai/contract";
3
+ export type ProtocolVersion = 1;
4
+ export type SessionId = string & {
5
+ readonly __brand: "CollabSessionId";
6
+ };
7
+ export type ClientOpId = string & {
8
+ readonly __brand: "CollabClientOpId";
9
+ };
10
+ export type RoomEpoch = string & {
11
+ readonly __brand: "CollabRoomEpoch";
12
+ };
13
+ export type RoomSeq = number & {
14
+ readonly __brand: "CollabRoomSeq";
15
+ };
16
+ export type DraftVersion = string & {
17
+ readonly __brand: "CollabDraftVersion";
18
+ };
19
+ export interface PageRef {
20
+ readonly pageId: PageId;
21
+ }
22
+ export interface RoomRef extends PageRef {
23
+ readonly epoch: RoomEpoch;
24
+ }
25
+ export interface CollabPageSnapshot {
26
+ readonly page: Page;
27
+ readonly metadata?: unknown;
28
+ readonly canvasSettings?: CanvasPageSettings;
29
+ }
30
+ export type ContainerRef = {
31
+ readonly kind: "root";
32
+ } | {
33
+ readonly kind: "block-children";
34
+ readonly nodeId: string;
35
+ };
36
+ export type InsertPosition = {
37
+ readonly kind: "first";
38
+ } | {
39
+ readonly kind: "last";
40
+ } | {
41
+ readonly kind: "before";
42
+ readonly siblingId: string;
43
+ } | {
44
+ readonly kind: "after";
45
+ readonly siblingId: string;
46
+ };
47
+ export type CanvasPageSettings = Omit<CanvasPage, "id" | "root">;
48
+ export type SetPageSettingOp = {
49
+ readonly [K in keyof CanvasPageSettings]-?: {
50
+ readonly t: "set-page-setting";
51
+ readonly pageId: PageId;
52
+ readonly field: K;
53
+ readonly value: CanvasPageSettings[K] | null;
54
+ };
55
+ }[keyof CanvasPageSettings];
56
+ export type PageOp = SetPagePropOp | RemovePagePropOp | SetPageSettingOp | InsertNodeOp | RemoveNodeOp | MoveNodeOp;
57
+ export interface SetPagePropOp {
58
+ readonly t: "set-page-prop";
59
+ readonly pageId: PageId;
60
+ readonly nodeId: string;
61
+ readonly field: FieldName;
62
+ readonly locale: Locale;
63
+ readonly schemaVersion: SchemaVersion;
64
+ readonly value: PropValue;
65
+ }
66
+ export interface RemovePagePropOp {
67
+ readonly t: "remove-page-prop";
68
+ readonly pageId: PageId;
69
+ readonly nodeId: string;
70
+ readonly field: FieldName;
71
+ }
72
+ export interface InsertNodeOp {
73
+ readonly t: "insert-node";
74
+ readonly pageId: PageId;
75
+ readonly container: ContainerRef;
76
+ readonly position: InsertPosition;
77
+ readonly node: PageNode;
78
+ }
79
+ export interface RemoveNodeOp {
80
+ readonly t: "remove-node";
81
+ readonly pageId: PageId;
82
+ readonly nodeId: string;
83
+ }
84
+ export interface MoveNodeOp {
85
+ readonly t: "move-node";
86
+ readonly pageId: PageId;
87
+ readonly nodeId: string;
88
+ readonly to: {
89
+ readonly container: ContainerRef;
90
+ readonly position: InsertPosition;
91
+ };
92
+ }
93
+ export type PageReduceRejectCode = "page_id_mismatch" | "node_not_found" | "duplicate_node_id" | "container_not_found" | "position_anchor_not_found" | "cycle" | "target_removed" | "unsupported_repeater_template" | "invalid_prop";
94
+ export type PageReduceResult = {
95
+ readonly ok: true;
96
+ readonly page: Page;
97
+ } | {
98
+ readonly ok: false;
99
+ readonly code: PageReduceRejectCode;
100
+ readonly message: string;
101
+ };
102
+ export interface CollabPageRecord {
103
+ readonly page: Page;
104
+ readonly canvasSettings?: CanvasPageSettings;
105
+ }
106
+ export type PageRecordReduceResult = {
107
+ readonly ok: true;
108
+ readonly record: CollabPageRecord;
109
+ } | {
110
+ readonly ok: false;
111
+ readonly code: PageReduceRejectCode;
112
+ readonly message: string;
113
+ };
114
+ export type AdmissionRejectCode = "bad_version" | "bad_frame" | "unauthenticated" | "token_expired" | "token_revoked" | "forbidden_page" | "forbidden_publish" | "stale_epoch" | "stale_base_seq" | "rate_limited" | "frame_too_large" | "op_too_large" | "lock_denied" | "manifest_rejected" | "instance_field_unsupported" | "route_edit_unsupported" | "op_replay_conflict" | "reducer_rejected" | "durability_failed" | "publish_conflict";
115
+ export type LockTarget = {
116
+ readonly kind: "block-edit";
117
+ readonly nodeId: string;
118
+ } | {
119
+ readonly kind: "subtree-structure";
120
+ readonly nodeId: string;
121
+ } | {
122
+ readonly kind: "container-structure";
123
+ readonly container: ContainerRef;
124
+ } | {
125
+ readonly kind: "page-settings";
126
+ };
127
+ export interface HelloFrame {
128
+ readonly v: ProtocolVersion;
129
+ readonly type: "hello";
130
+ readonly token: string;
131
+ readonly pageId: PageId;
132
+ readonly resume?: {
133
+ readonly sessionId: SessionId;
134
+ readonly roomEpoch: RoomEpoch;
135
+ readonly lastSeq: RoomSeq;
136
+ };
137
+ }
138
+ export interface WelcomeFrame {
139
+ readonly v: ProtocolVersion;
140
+ readonly type: "welcome";
141
+ readonly sessionId: SessionId;
142
+ readonly room: RoomRef;
143
+ readonly seq: RoomSeq;
144
+ readonly baseSeq: RoomSeq;
145
+ readonly draftVersion?: DraftVersion;
146
+ readonly snapshot?: CollabPageSnapshot;
147
+ readonly opsSince?: readonly DurableRemoteOp[];
148
+ readonly roster: readonly RosterEntry[];
149
+ readonly locks: readonly HeldLock[];
150
+ }
151
+ export interface OpFrame {
152
+ readonly v: ProtocolVersion;
153
+ readonly type: "op";
154
+ readonly clientOpId: ClientOpId;
155
+ readonly roomEpoch: RoomEpoch;
156
+ readonly baseSeq: RoomSeq;
157
+ readonly op: PageOp;
158
+ }
159
+ export interface AcceptedFrame {
160
+ readonly v: ProtocolVersion;
161
+ readonly type: "accepted";
162
+ readonly clientOpId: ClientOpId;
163
+ readonly seq: RoomSeq;
164
+ readonly durability: "op-log";
165
+ }
166
+ export interface RejectedFrame {
167
+ readonly v: ProtocolVersion;
168
+ readonly type: "rejected";
169
+ readonly clientOpId?: ClientOpId;
170
+ readonly code: AdmissionRejectCode | PageReduceRejectCode;
171
+ readonly message: string;
172
+ readonly recovery: {
173
+ readonly kind: "none";
174
+ } | {
175
+ readonly kind: "restore-local";
176
+ readonly label: string;
177
+ } | {
178
+ readonly kind: "refresh-room";
179
+ };
180
+ }
181
+ export interface DurableRemoteOp {
182
+ readonly seq: RoomSeq;
183
+ readonly clientOpId: ClientOpId;
184
+ readonly authorSessionId: SessionId;
185
+ readonly op: PageOp;
186
+ }
187
+ export interface CollabEventCursor {
188
+ readonly seq: RoomSeq;
189
+ readonly presenceVersion: number;
190
+ readonly lockVersion: number;
191
+ }
192
+ export interface RemoteOpFrame {
193
+ readonly v: ProtocolVersion;
194
+ readonly type: "remote-op";
195
+ readonly entry: DurableRemoteOp;
196
+ }
197
+ export interface LockRequestFrame {
198
+ readonly v: ProtocolVersion;
199
+ readonly type: "lock-request";
200
+ readonly requestId: string;
201
+ readonly target: LockTarget;
202
+ }
203
+ export interface LockReleaseFrame {
204
+ readonly v: ProtocolVersion;
205
+ readonly type: "lock-release";
206
+ readonly requestId: string;
207
+ readonly target: LockTarget;
208
+ readonly releaseAfterClientOpId?: ClientOpId;
209
+ }
210
+ export interface HeldLock {
211
+ readonly target: LockTarget;
212
+ readonly holderSessionId: SessionId;
213
+ readonly holderName: string;
214
+ readonly holderColor: string;
215
+ readonly expiresAt: string;
216
+ }
217
+ export interface LockGrantedFrame {
218
+ readonly v: ProtocolVersion;
219
+ readonly type: "lock-granted";
220
+ readonly requestId: string;
221
+ readonly lock: HeldLock;
222
+ }
223
+ export interface LockDeniedFrame {
224
+ readonly v: ProtocolVersion;
225
+ readonly type: "lock-denied";
226
+ readonly requestId: string;
227
+ readonly target: LockTarget;
228
+ readonly holder?: HeldLock;
229
+ readonly reason: string;
230
+ }
231
+ export interface LockRevokedFrame {
232
+ readonly v: ProtocolVersion;
233
+ readonly type: "lock-revoked";
234
+ readonly target: LockTarget;
235
+ readonly reason: "expired" | "release" | "room-closed" | "revoked";
236
+ }
237
+ export interface LockStateFrame {
238
+ readonly v: ProtocolVersion;
239
+ readonly type: "lock-state";
240
+ readonly locks: readonly HeldLock[];
241
+ }
242
+ export interface PresenceFrame {
243
+ readonly v: ProtocolVersion;
244
+ readonly type: "presence";
245
+ readonly pointer?: {
246
+ readonly x: number;
247
+ readonly y: number;
248
+ readonly nodeId?: string;
249
+ };
250
+ readonly selection?: readonly LockTarget[];
251
+ }
252
+ export interface PresenceUpdateFrame {
253
+ readonly v: ProtocolVersion;
254
+ readonly type: "presence-update";
255
+ readonly sessionId: SessionId;
256
+ readonly pointer?: {
257
+ readonly x: number;
258
+ readonly y: number;
259
+ readonly nodeId?: string;
260
+ };
261
+ readonly selection?: readonly LockTarget[];
262
+ }
263
+ export interface RosterEntry {
264
+ readonly sessionId: SessionId;
265
+ readonly displayName: string;
266
+ readonly color: string;
267
+ }
268
+ export interface RosterFrame {
269
+ readonly v: ProtocolVersion;
270
+ readonly type: "roster";
271
+ readonly entries: readonly RosterEntry[];
272
+ }
273
+ export interface ReauthFrame {
274
+ readonly v: ProtocolVersion;
275
+ readonly type: "reauth";
276
+ readonly token: string;
277
+ }
278
+ export interface PublishRequestFrame {
279
+ readonly v: ProtocolVersion;
280
+ readonly type: "publish-request";
281
+ readonly requestId: string;
282
+ readonly roomEpoch: RoomEpoch;
283
+ readonly seq: RoomSeq;
284
+ readonly draftVersion?: DraftVersion;
285
+ }
286
+ export interface PersistRequestFrame {
287
+ readonly v: ProtocolVersion;
288
+ readonly type: "persist-request";
289
+ readonly requestId: string;
290
+ readonly roomEpoch: RoomEpoch;
291
+ readonly seq: RoomSeq;
292
+ readonly draftVersion?: DraftVersion;
293
+ }
294
+ export interface DocPersistedFrame {
295
+ readonly v: ProtocolVersion;
296
+ readonly type: "doc-persisted";
297
+ readonly seq: RoomSeq;
298
+ readonly draftVersion: DraftVersion;
299
+ }
300
+ export interface PublishedFrame {
301
+ readonly v: ProtocolVersion;
302
+ readonly type: "published";
303
+ readonly requestId: string;
304
+ readonly seq: RoomSeq;
305
+ readonly publishedVersion: DraftVersion;
306
+ readonly publishedAt: string;
307
+ readonly newEpoch: RoomEpoch;
308
+ }
309
+ export interface RoomClosedFrame {
310
+ readonly v: ProtocolVersion;
311
+ readonly type: "room-closed";
312
+ readonly reason: "stale-epoch" | "page-deleted" | "tenant-revoked" | "token-revoked" | "unrecoverable-conflict";
313
+ readonly message: string;
314
+ }
315
+ export type ClientFrame = HelloFrame | OpFrame | LockRequestFrame | LockReleaseFrame | PresenceFrame | ReauthFrame | PersistRequestFrame | PublishRequestFrame;
316
+ export type ServerFrame = WelcomeFrame | AcceptedFrame | RejectedFrame | RemoteOpFrame | LockGrantedFrame | LockDeniedFrame | LockRevokedFrame | LockStateFrame | PresenceUpdateFrame | RosterFrame | DocPersistedFrame | PublishedFrame | RoomClosedFrame;
317
+ export type ServerPushFrame = RemoteOpFrame | LockRevokedFrame | LockStateFrame | PresenceUpdateFrame | RosterFrame | RoomClosedFrame;
318
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,MAA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ceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@batterai/collab-protocol",
3
+ "version": "0.1.0",
4
+ "license": "BUSL-1.1",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
12
+ "scripts": {
13
+ "check": "tsc --noEmit",
14
+ "test": "bun test test",
15
+ "build": "node ../../scripts/build-package.mjs",
16
+ "prepack": "bun run build"
17
+ },
18
+ "dependencies": {
19
+ "@batterai/bind-core": "^0.1.0",
20
+ "@batterai/contract": "^0.1.0"
21
+ },
22
+ "devDependencies": {
23
+ "@types/bun": "^1.3.14"
24
+ },
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "files": [
28
+ "dist",
29
+ "LICENSE",
30
+ "README.md",
31
+ "CHANGELOG.md"
32
+ ],
33
+ "engines": {
34
+ "node": ">=20.11"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ }
39
+ }