@neta-art/cohub 6.0.0 → 8.0.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.
Files changed (57) hide show
  1. package/README.md +6 -5
  2. package/dist/board/animation.d.ts +2 -1
  3. package/dist/board/animation.js +0 -1
  4. package/dist/board/core/connections.js +4 -4
  5. package/dist/board/core/export-plan.js +1 -1
  6. package/dist/board/core/shape-types.js +0 -1
  7. package/dist/board/index.d.ts +6 -5
  8. package/dist/board/index.js +7 -7
  9. package/dist/board/mutation.d.ts +2 -11
  10. package/dist/board/mutation.js +2 -56
  11. package/dist/board/render/renderers/text-card-renderer.js +1 -1
  12. package/dist/board/semantic-document.d.ts +30 -0
  13. package/dist/board/semantic-document.js +271 -0
  14. package/dist/board/semantic-mutation.d.ts +10 -0
  15. package/dist/board/semantic-mutation.js +203 -0
  16. package/dist/chunks/http.d.ts +340 -317
  17. package/dist/chunks/http.js +477 -1784
  18. package/dist/chunks/transport.js +1 -1
  19. package/dist/chunks/websocket.d.ts +3677 -3151
  20. package/dist/chunks/websocket.js +1 -1
  21. package/dist/http.d.ts +3 -3
  22. package/dist/index.d.ts +165 -119
  23. package/dist/index.js +1419 -446
  24. package/dist/protocol/dist/board-authoring.d.ts +1305 -1
  25. package/dist/protocol/dist/board-authoring.js +80 -6
  26. package/dist/protocol/dist/board-codec.d.ts +2 -2
  27. package/dist/protocol/dist/board-codec.js +19 -4
  28. package/dist/protocol/dist/board-composition.d.ts +126 -1
  29. package/dist/protocol/dist/board-composition.js +1 -9
  30. package/dist/protocol/dist/board-connection.d.ts +16 -16
  31. package/dist/protocol/dist/board-connection.js +16 -16
  32. package/dist/protocol/dist/board-document.d.ts +34 -3
  33. package/dist/protocol/dist/board-document.js +3 -1
  34. package/dist/protocol/dist/board-effect.d.ts +94 -0
  35. package/dist/protocol/dist/board-effect.js +53 -0
  36. package/dist/protocol/dist/board-json.js +16 -0
  37. package/dist/protocol/dist/board.d.ts +34 -164
  38. package/dist/protocol/dist/board.js +44 -45
  39. package/dist/protocol/dist/index.d.ts +8 -8
  40. package/dist/protocol/dist/realtime/types.d.ts +1 -1
  41. package/dist/types.d.ts +3 -1
  42. package/package.json +1 -2
  43. package/dist/board/codec.d.ts +0 -27
  44. package/dist/board/codec.js +0 -277
  45. package/dist/protocol/dist/board-content.js +0 -26
  46. package/dist/protocol/dist/board-upgrade.js +0 -2
  47. package/dist/protocol/dist/identifiers.js +0 -10
  48. package/dist/protocol/dist/index.js +0 -19
  49. package/dist/protocol/dist/provenance.js +0 -15
  50. package/dist/protocol/dist/public-identifiers.js +0 -38
  51. package/dist/protocol/dist/realtime/board-awareness.js +0 -119
  52. package/dist/protocol/dist/ui-command.js +0 -2
  53. package/dist/protocol/dist/work-promotion-stats.js +0 -11
  54. package/dist/protocol/dist/work-surface.js +0 -2
  55. package/dist/protocol/dist/work-view-stats.js +0 -3
  56. package/dist/protocol/dist/work.d.ts +0 -1
  57. /package/dist/protocol/dist/{board-upgrade.d.ts → app.d.ts} +0 -0
@@ -100,6 +100,7 @@ declare const BoardTextItemSchema: z.ZodObject<{
100
100
  height: z.ZodNumber;
101
101
  rotation: z.ZodDefault<z.ZodNumber>;
102
102
  }, z.core.$strip>;
103
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
104
  locked: z.ZodOptional<z.ZodBoolean>;
104
105
  style: z.ZodOptional<z.ZodObject<{
105
106
  variant: z.ZodDefault<z.ZodString>;
@@ -133,6 +134,7 @@ declare const BoardGeoItemSchema: z.ZodObject<{
133
134
  height: z.ZodNumber;
134
135
  rotation: z.ZodDefault<z.ZodNumber>;
135
136
  }, z.core.$strip>;
137
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
136
138
  locked: z.ZodOptional<z.ZodBoolean>;
137
139
  style: z.ZodOptional<z.ZodObject<{
138
140
  variant: z.ZodDefault<z.ZodString>;
@@ -178,6 +180,7 @@ declare const BoardDrawItemSchema: z.ZodObject<{
178
180
  height: z.ZodNumber;
179
181
  rotation: z.ZodDefault<z.ZodNumber>;
180
182
  }, z.core.$strip>;
183
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
181
184
  locked: z.ZodOptional<z.ZodBoolean>;
182
185
  style: z.ZodOptional<z.ZodObject<{
183
186
  variant: z.ZodDefault<z.ZodString>;
@@ -224,6 +227,7 @@ declare const BoardArrowItemSchema: z.ZodObject<{
224
227
  height: z.ZodNumber;
225
228
  rotation: z.ZodDefault<z.ZodNumber>;
226
229
  }, z.core.$strip>;
230
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
227
231
  locked: z.ZodOptional<z.ZodBoolean>;
228
232
  style: z.ZodOptional<z.ZodObject<{
229
233
  variant: z.ZodDefault<z.ZodString>;
@@ -269,6 +273,7 @@ declare const BoardFrameItemSchema: z.ZodObject<{
269
273
  height: z.ZodNumber;
270
274
  rotation: z.ZodDefault<z.ZodNumber>;
271
275
  }, z.core.$strip>;
276
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
272
277
  locked: z.ZodOptional<z.ZodBoolean>;
273
278
  style: z.ZodOptional<z.ZodObject<{
274
279
  variant: z.ZodDefault<z.ZodString>;
@@ -302,6 +307,7 @@ declare const BoardImageItemSchema: z.ZodObject<{
302
307
  height: z.ZodNumber;
303
308
  rotation: z.ZodDefault<z.ZodNumber>;
304
309
  }, z.core.$strip>;
310
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
305
311
  locked: z.ZodOptional<z.ZodBoolean>;
306
312
  style: z.ZodOptional<z.ZodObject<{
307
313
  variant: z.ZodDefault<z.ZodString>;
@@ -351,6 +357,7 @@ declare const BoardVideoItemSchema: z.ZodObject<{
351
357
  height: z.ZodNumber;
352
358
  rotation: z.ZodDefault<z.ZodNumber>;
353
359
  }, z.core.$strip>;
360
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
354
361
  locked: z.ZodOptional<z.ZodBoolean>;
355
362
  style: z.ZodOptional<z.ZodObject<{
356
363
  variant: z.ZodDefault<z.ZodString>;
@@ -394,6 +401,7 @@ declare const BoardAudioItemSchema: z.ZodObject<{
394
401
  height: z.ZodNumber;
395
402
  rotation: z.ZodDefault<z.ZodNumber>;
396
403
  }, z.core.$strip>;
404
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
397
405
  locked: z.ZodOptional<z.ZodBoolean>;
398
406
  style: z.ZodOptional<z.ZodObject<{
399
407
  variant: z.ZodDefault<z.ZodString>;
@@ -464,6 +472,7 @@ declare const BoardFileItemSchema: z.ZodObject<{
464
472
  height: z.ZodNumber;
465
473
  rotation: z.ZodDefault<z.ZodNumber>;
466
474
  }, z.core.$strip>;
475
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
467
476
  locked: z.ZodOptional<z.ZodBoolean>;
468
477
  style: z.ZodOptional<z.ZodObject<{
469
478
  variant: z.ZodDefault<z.ZodString>;
@@ -591,6 +600,7 @@ declare const BoardTaskItemSchema: z.ZodObject<{
591
600
  height: z.ZodNumber;
592
601
  rotation: z.ZodDefault<z.ZodNumber>;
593
602
  }, z.core.$strip>;
603
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
594
604
  locked: z.ZodOptional<z.ZodBoolean>;
595
605
  style: z.ZodOptional<z.ZodObject<{
596
606
  variant: z.ZodDefault<z.ZodString>;
@@ -678,6 +688,7 @@ type BoardUnknownItem = {
678
688
  id: string;
679
689
  type: typeof UNKNOWN_BOARD_ITEM_TYPE;
680
690
  frame: z.infer<typeof BoardFrameSchema>;
691
+ parentId?: string | null;
681
692
  locked?: boolean;
682
693
  style?: z.infer<typeof BoardItemStyleSchema>;
683
694
  metadata?: Record<string, unknown>;
@@ -695,6 +706,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
695
706
  height: number;
696
707
  rotation: number;
697
708
  };
709
+ parentId?: string | null | undefined;
698
710
  locked?: boolean | undefined;
699
711
  style?: {
700
712
  variant: string;
@@ -733,6 +745,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
733
745
  height: number;
734
746
  rotation: number;
735
747
  };
748
+ parentId?: string | null | undefined;
736
749
  locked?: boolean | undefined;
737
750
  style?: {
738
751
  variant: string;
@@ -765,6 +778,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
765
778
  height: number;
766
779
  rotation: number;
767
780
  };
781
+ parentId?: string | null | undefined;
768
782
  locked?: boolean | undefined;
769
783
  style?: {
770
784
  variant: string;
@@ -798,6 +812,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
798
812
  height: number;
799
813
  rotation: number;
800
814
  };
815
+ parentId?: string | null | undefined;
801
816
  locked?: boolean | undefined;
802
817
  style?: {
803
818
  variant: string;
@@ -831,6 +846,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
831
846
  height: number;
832
847
  rotation: number;
833
848
  };
849
+ parentId?: string | null | undefined;
834
850
  locked?: boolean | undefined;
835
851
  style?: {
836
852
  variant: string;
@@ -893,6 +909,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
893
909
  height: number;
894
910
  rotation: number;
895
911
  };
912
+ parentId?: string | null | undefined;
896
913
  locked?: boolean | undefined;
897
914
  style?: {
898
915
  variant: string;
@@ -916,6 +933,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
916
933
  height: number;
917
934
  rotation: number;
918
935
  };
936
+ parentId?: string | null | undefined;
919
937
  locked?: boolean | undefined;
920
938
  style?: {
921
939
  variant: string;
@@ -940,6 +958,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
940
958
  height: number;
941
959
  rotation: number;
942
960
  };
961
+ parentId?: string | null | undefined;
943
962
  locked?: boolean | undefined;
944
963
  style?: {
945
964
  variant: string;
@@ -967,6 +986,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
967
986
  height: number;
968
987
  rotation: number;
969
988
  };
989
+ parentId?: string | null | undefined;
970
990
  locked?: boolean | undefined;
971
991
  style?: {
972
992
  variant: string;
@@ -1001,6 +1021,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
1001
1021
  height: number;
1002
1022
  rotation: number;
1003
1023
  };
1024
+ parentId?: string | null | undefined;
1004
1025
  locked?: boolean | undefined;
1005
1026
  style?: {
1006
1027
  variant: string;
@@ -1078,6 +1099,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1078
1099
  height: number;
1079
1100
  rotation: number;
1080
1101
  };
1102
+ parentId?: string | null | undefined;
1081
1103
  locked?: boolean | undefined;
1082
1104
  style?: {
1083
1105
  variant: string;
@@ -1116,6 +1138,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1116
1138
  height: number;
1117
1139
  rotation: number;
1118
1140
  };
1141
+ parentId?: string | null | undefined;
1119
1142
  locked?: boolean | undefined;
1120
1143
  style?: {
1121
1144
  variant: string;
@@ -1148,6 +1171,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1148
1171
  height: number;
1149
1172
  rotation: number;
1150
1173
  };
1174
+ parentId?: string | null | undefined;
1151
1175
  locked?: boolean | undefined;
1152
1176
  style?: {
1153
1177
  variant: string;
@@ -1181,6 +1205,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1181
1205
  height: number;
1182
1206
  rotation: number;
1183
1207
  };
1208
+ parentId?: string | null | undefined;
1184
1209
  locked?: boolean | undefined;
1185
1210
  style?: {
1186
1211
  variant: string;
@@ -1214,6 +1239,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1214
1239
  height: number;
1215
1240
  rotation: number;
1216
1241
  };
1242
+ parentId?: string | null | undefined;
1217
1243
  locked?: boolean | undefined;
1218
1244
  style?: {
1219
1245
  variant: string;
@@ -1276,6 +1302,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1276
1302
  height: number;
1277
1303
  rotation: number;
1278
1304
  };
1305
+ parentId?: string | null | undefined;
1279
1306
  locked?: boolean | undefined;
1280
1307
  style?: {
1281
1308
  variant: string;
@@ -1299,6 +1326,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1299
1326
  height: number;
1300
1327
  rotation: number;
1301
1328
  };
1329
+ parentId?: string | null | undefined;
1302
1330
  locked?: boolean | undefined;
1303
1331
  style?: {
1304
1332
  variant: string;
@@ -1323,6 +1351,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1323
1351
  height: number;
1324
1352
  rotation: number;
1325
1353
  };
1354
+ parentId?: string | null | undefined;
1326
1355
  locked?: boolean | undefined;
1327
1356
  style?: {
1328
1357
  variant: string;
@@ -1350,6 +1379,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1350
1379
  height: number;
1351
1380
  rotation: number;
1352
1381
  };
1382
+ parentId?: string | null | undefined;
1353
1383
  locked?: boolean | undefined;
1354
1384
  style?: {
1355
1385
  variant: string;
@@ -1384,6 +1414,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1384
1414
  height: number;
1385
1415
  rotation: number;
1386
1416
  };
1417
+ parentId?: string | null | undefined;
1387
1418
  locked?: boolean | undefined;
1388
1419
  style?: {
1389
1420
  variant: string;
@@ -1401,7 +1432,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1401
1432
  connections: z.ZodDefault<z.ZodArray<z.ZodObject<{
1402
1433
  id: z.ZodString;
1403
1434
  source: z.ZodObject<{
1404
- nodeId: z.ZodString;
1435
+ itemId: z.ZodString;
1405
1436
  portId: z.ZodOptional<z.ZodString>;
1406
1437
  anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
1407
1438
  kind: z.ZodLiteral<"auto">;
@@ -1421,7 +1452,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1421
1452
  }, z.core.$strip>]>>;
1422
1453
  }, z.core.$strip>;
1423
1454
  target: z.ZodObject<{
1424
- nodeId: z.ZodString;
1455
+ itemId: z.ZodString;
1425
1456
  portId: z.ZodOptional<z.ZodString>;
1426
1457
  anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
1427
1458
  kind: z.ZodLiteral<"auto">;
@@ -1469,7 +1500,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1469
1500
  }>>;
1470
1501
  }, z.core.$strip>>;
1471
1502
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1472
- }, z.core.$strip>>>;
1503
+ }, z.core.$strict>>>;
1473
1504
  }, z.core.$strip>;
1474
1505
  type BoardFrame = z.infer<typeof BoardFrameSchema>;
1475
1506
  type BoardViewport = z.infer<typeof BoardViewportSchema>;
@@ -100,6 +100,7 @@ const BoardMediaSnapshotSchema = z.object({
100
100
  const BoardItemBaseSchema = z.object({
101
101
  id: z.string().min(1),
102
102
  frame: BoardFrameSchema,
103
+ parentId: z.string().min(1).nullable().optional(),
103
104
  /** When true the shape cannot be moved, resized, or deleted. */
104
105
  locked: z.boolean().optional(),
105
106
  style: BoardItemStyleSchema.optional(),
@@ -378,6 +379,7 @@ function makeUnknownItem(raw) {
378
379
  height: 80,
379
380
  rotation: 0
380
381
  },
382
+ ...typeof record.parentId === "string" || record.parentId === null ? { parentId: record.parentId } : {},
381
383
  ...record.locked === true ? { locked: true } : {},
382
384
  ...styleParsed.success && record.style ? { style: styleParsed.data } : {},
383
385
  ...record.metadata && typeof record.metadata === "object" ? { metadata: record.metadata } : {},
@@ -431,7 +433,7 @@ function parseBoardDocument(input) {
431
433
  function withResolvedConnections(document) {
432
434
  if (document.connections.length === 0) return document;
433
435
  const ids = new Set(document.items.map((item) => item.id));
434
- const connections = document.connections.filter((connection) => ids.has(connection.source.nodeId) && ids.has(connection.target.nodeId));
436
+ const connections = document.connections.filter((connection) => ids.has(connection.source.itemId) && ids.has(connection.target.itemId));
435
437
  return connections.length === document.connections.length ? document : {
436
438
  ...document,
437
439
  connections
@@ -0,0 +1,94 @@
1
+ import { z } from "zod";
2
+ //#region ../protocol/dist/board-effect.d.ts
3
+ declare const BoardAssetRefSchema: z.ZodObject<{
4
+ type: z.ZodEnum<{
5
+ extension: "extension";
6
+ "space-file": "space-file";
7
+ }>;
8
+ ref: z.ZodString;
9
+ digest: z.ZodOptional<z.ZodString>;
10
+ }, z.core.$strict>;
11
+ declare const BoardEffectSchema: z.ZodObject<{
12
+ id: z.ZodString;
13
+ boardId: z.ZodString;
14
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
15
+ type: z.ZodLiteral<"item">;
16
+ itemId: z.ZodString;
17
+ }, z.core.$strict>, z.ZodObject<{
18
+ type: z.ZodLiteral<"board">;
19
+ }, z.core.$strict>], "type">;
20
+ kind: z.ZodString;
21
+ kindVersion: z.ZodNumber;
22
+ enabled: z.ZodDefault<z.ZodBoolean>;
23
+ lifecycle: z.ZodEnum<{
24
+ manual: "manual";
25
+ persistent: "persistent";
26
+ "when-visible": "when-visible";
27
+ }>;
28
+ timeOrigin: z.ZodEnum<{
29
+ activation: "activation";
30
+ board: "board";
31
+ visible: "visible";
32
+ }>;
33
+ layer: z.ZodDefault<z.ZodEnum<{
34
+ behind: "behind";
35
+ front: "front";
36
+ screen: "screen";
37
+ }>>;
38
+ seed: z.ZodString;
39
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
40
+ assetRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
41
+ type: z.ZodEnum<{
42
+ extension: "extension";
43
+ "space-file": "space-file";
44
+ }>;
45
+ ref: z.ZodString;
46
+ digest: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strict>>>;
48
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
49
+ revision: z.ZodNumber;
50
+ }, z.core.$strict>;
51
+ type BoardAssetRef = z.infer<typeof BoardAssetRefSchema>;
52
+ type BoardEffect = z.infer<typeof BoardEffectSchema>;
53
+ /** The client-authored effect form: no server-owned `boardId`/`revision`. */
54
+ declare const BoardEffectInputSchema: z.ZodObject<{
55
+ id: z.ZodString;
56
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
57
+ type: z.ZodLiteral<"item">;
58
+ itemId: z.ZodString;
59
+ }, z.core.$strict>, z.ZodObject<{
60
+ type: z.ZodLiteral<"board">;
61
+ }, z.core.$strict>], "type">;
62
+ kind: z.ZodString;
63
+ kindVersion: z.ZodNumber;
64
+ enabled: z.ZodDefault<z.ZodBoolean>;
65
+ lifecycle: z.ZodEnum<{
66
+ manual: "manual";
67
+ persistent: "persistent";
68
+ "when-visible": "when-visible";
69
+ }>;
70
+ timeOrigin: z.ZodEnum<{
71
+ activation: "activation";
72
+ board: "board";
73
+ visible: "visible";
74
+ }>;
75
+ layer: z.ZodDefault<z.ZodEnum<{
76
+ behind: "behind";
77
+ front: "front";
78
+ screen: "screen";
79
+ }>>;
80
+ seed: z.ZodString;
81
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
82
+ assetRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
83
+ type: z.ZodEnum<{
84
+ extension: "extension";
85
+ "space-file": "space-file";
86
+ }>;
87
+ ref: z.ZodString;
88
+ digest: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strict>>>;
90
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
91
+ }, z.core.$strict>;
92
+ type BoardEffectInput = z.infer<typeof BoardEffectInputSchema>;
93
+ //#endregion
94
+ export { BoardAssetRef, BoardAssetRefSchema, BoardEffect, BoardEffectInput, BoardEffectInputSchema, BoardEffectSchema };
@@ -0,0 +1,53 @@
1
+ import { z } from "zod";
2
+ //#region ../protocol/dist/board-effect.js
3
+ /**
4
+ * Board effect schema, isolated so `board-authoring.ts` can reuse the exact
5
+ * definition without a runtime cycle through `board.ts`. One definition, one
6
+ * strictness level — semantic mutations and Board create must not drift apart.
7
+ */
8
+ const idSchema = z.string().min(1).max(160);
9
+ const extensionIdSchema = z.string().regex(/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)+$/).max(160);
10
+ const jsonObjectSchema = z.record(z.string(), z.unknown());
11
+ const BoardAssetRefSchema = z.object({
12
+ type: z.enum(["space-file", "extension"]),
13
+ ref: z.string().min(1).max(4096),
14
+ digest: z.string().min(16).max(160).optional()
15
+ }).strict();
16
+ const BoardEffectSchema = z.object({
17
+ id: idSchema,
18
+ boardId: z.string().uuid(),
19
+ target: z.discriminatedUnion("type", [z.object({
20
+ type: z.literal("item"),
21
+ itemId: idSchema
22
+ }).strict(), z.object({ type: z.literal("board") }).strict()]),
23
+ kind: extensionIdSchema,
24
+ kindVersion: z.number().int().positive(),
25
+ enabled: z.boolean().default(true),
26
+ lifecycle: z.enum([
27
+ "persistent",
28
+ "when-visible",
29
+ "manual"
30
+ ]),
31
+ timeOrigin: z.enum([
32
+ "board",
33
+ "visible",
34
+ "activation"
35
+ ]),
36
+ layer: z.enum([
37
+ "behind",
38
+ "front",
39
+ "screen"
40
+ ]).default("front"),
41
+ seed: z.string().min(1).max(160),
42
+ params: jsonObjectSchema.default({}),
43
+ assetRefs: z.array(BoardAssetRefSchema).default([]),
44
+ metadata: jsonObjectSchema.default({}),
45
+ revision: z.number().int().nonnegative()
46
+ }).strict();
47
+ /** The client-authored effect form: no server-owned `boardId`/`revision`. */
48
+ const BoardEffectInputSchema = BoardEffectSchema.omit({
49
+ boardId: true,
50
+ revision: true
51
+ });
52
+ //#endregion
53
+ export { BoardAssetRefSchema, BoardEffectInputSchema, BoardEffectSchema };
@@ -0,0 +1,16 @@
1
+ //#region ../protocol/dist/board-json.js
2
+ /** Structural equality for JSON-shaped semantic values. */
3
+ function boardJsonEquals(a, b) {
4
+ if (a === b) return true;
5
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return Number.isNaN(a) && Number.isNaN(b);
6
+ const aArray = Array.isArray(a);
7
+ const bArray = Array.isArray(b);
8
+ if (aArray !== bArray) return false;
9
+ if (aArray && bArray) return a.length === b.length && a.every((value, index) => boardJsonEquals(value, b[index]));
10
+ const aRecord = a;
11
+ const bRecord = b;
12
+ const keys = Object.keys(aRecord);
13
+ return keys.length === Object.keys(bRecord).length && keys.every((key) => Object.hasOwn(bRecord, key) && boardJsonEquals(aRecord[key], bRecord[key]));
14
+ }
15
+ //#endregion
16
+ export { boardJsonEquals };
@@ -1,7 +1,8 @@
1
1
  import { BoardCapability, BoardCoordinateSpace, BoardRenderCost } from "./board-constants.js";
2
- import { BoardConnectionInput, BoardConnectionPatch } from "./board-connection.js";
3
- import { BoardComposition } from "./board-composition.js";
4
- import "./board-node.js";
2
+ import "./board-connection.js";
3
+ import "./board-composition.js";
4
+ import { BoardAssetRef, BoardAssetRefSchema, BoardEffect, BoardEffectInput, BoardEffectInputSchema, BoardEffectSchema } from "./board-effect.js";
5
+ import "./board-authoring.js";
5
6
  import { z } from "zod";
6
7
  //#region ../protocol/dist/board.d.ts
7
8
  declare const BOARD_EXTENSION: ".board";
@@ -13,10 +14,6 @@ declare const BoardManifestSchema: z.ZodObject<{
13
14
  title: z.ZodString;
14
15
  }, z.core.$strip>;
15
16
  type BoardManifest = z.infer<typeof BoardManifestSchema>;
16
- declare class InvalidBoardFileError extends Error {
17
- readonly code = "INVALID_BOARD_FILE";
18
- constructor(message?: string);
19
- }
20
17
  declare function parseBoardManifest(input: string | unknown): BoardManifest;
21
18
  declare function serializeBoardManifest(manifest: BoardManifest): string;
22
19
  declare const BoardCameraStateSchema: z.ZodObject<{
@@ -69,161 +66,27 @@ declare const BoardCameraFocusParamsSchema: z.ZodObject<{
69
66
  minZoom: z.ZodOptional<z.ZodNumber>;
70
67
  maxZoom: z.ZodOptional<z.ZodNumber>;
71
68
  }, z.core.$strip>;
72
- declare const BoardAssetRefSchema: z.ZodObject<{
73
- type: z.ZodEnum<{
74
- extension: "extension";
75
- "space-file": "space-file";
76
- }>;
77
- ref: z.ZodString;
78
- digest: z.ZodOptional<z.ZodString>;
79
- }, z.core.$strip>;
80
- declare const BoardEffectSchema: z.ZodObject<{
81
- id: z.ZodString;
82
- boardId: z.ZodString;
83
- target: z.ZodDiscriminatedUnion<[z.ZodObject<{
84
- type: z.ZodLiteral<"item">;
85
- itemId: z.ZodString;
86
- }, z.core.$strict>, z.ZodObject<{
87
- type: z.ZodLiteral<"board">;
88
- }, z.core.$strict>], "type">;
89
- kind: z.ZodString;
90
- kindVersion: z.ZodNumber;
91
- enabled: z.ZodDefault<z.ZodBoolean>;
92
- lifecycle: z.ZodEnum<{
93
- manual: "manual";
94
- persistent: "persistent";
95
- "when-visible": "when-visible";
96
- }>;
97
- timeOrigin: z.ZodEnum<{
98
- activation: "activation";
99
- board: "board";
100
- visible: "visible";
101
- }>;
102
- layer: z.ZodDefault<z.ZodEnum<{
103
- behind: "behind";
104
- front: "front";
105
- screen: "screen";
106
- }>>;
107
- seed: z.ZodString;
108
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
109
- assetRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
110
- type: z.ZodEnum<{
111
- extension: "extension";
112
- "space-file": "space-file";
113
- }>;
114
- ref: z.ZodString;
115
- digest: z.ZodOptional<z.ZodString>;
116
- }, z.core.$strip>>>;
117
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
118
- revision: z.ZodNumber;
119
- }, z.core.$strip>;
120
69
  type BoardCameraState = z.infer<typeof BoardCameraStateSchema>;
121
70
  type BoardCameraFocus = z.infer<typeof BoardCameraFocusSchema>;
122
71
  type BoardCameraFocusParams = z.infer<typeof BoardCameraFocusParamsSchema>;
123
- type BoardAssetRef = z.infer<typeof BoardAssetRefSchema>;
124
- type BoardEffect = z.infer<typeof BoardEffectSchema>;
125
- type BoardRecord = {
126
- id: string;
127
- spaceId: string;
128
- title: string;
129
- version: number;
130
- metadata: Record<string, unknown>;
131
- createdAt: string | null;
132
- updatedAt: string | null;
133
- };
134
- type BoardNodeRecord = {
135
- boardId: string;
136
- nodeId: string;
137
- type: string;
138
- parentId: string | null;
139
- orderKey: string | null;
140
- x: number;
141
- y: number;
142
- width: number;
143
- height: number;
144
- rotation: number;
145
- refKind: string | null;
146
- refPath: string | null;
147
- refUrl: string | null;
148
- view: Record<string, unknown>;
149
- style: Record<string, unknown>;
150
- data: Record<string, unknown>;
151
- version: number;
152
- createdAt: string | null;
153
- updatedAt: string | null;
154
- };
155
- type BoardNodeInput = Omit<BoardNodeRecord, "boardId" | "version" | "createdAt" | "updatedAt">;
156
- declare const BOARD_DELETE_REASONS: readonly ["user-delete", "orphan-cleanup", "layout-replace", "placeholder-cascade", "node-cascade"];
157
- type BoardDeleteReason = (typeof BOARD_DELETE_REASONS)[number] | (string & {});
158
- type BoardOperationBase = {
159
- opId?: string;
160
- /** Optional local undo hint. Servers recompute authoritative inverse data. */
161
- inverse?: Record<string, unknown>;
162
- };
163
- type BoardOperation = (BoardOperationBase & {
164
- type: "board.patch";
165
- payload: {
166
- patch: {
167
- title?: string;
168
- metadata?: Record<string, unknown>;
169
- metadataPatch?: Record<string, unknown>;
170
- };
171
- };
172
- }) | (BoardOperationBase & {
173
- type: "node.create";
174
- payload: {
175
- node: BoardNodeInput;
176
- };
177
- }) | (BoardOperationBase & {
178
- type: "node.patch";
179
- payload: {
180
- nodeId: string;
181
- patch: Partial<BoardNodeInput>;
72
+ type BoardMutationReceipt = {
73
+ mutationId: string;
74
+ status: "applied" | "validated";
75
+ outcome: "applied" | "noop" | "dry-run";
76
+ replayed: boolean;
77
+ board: {
78
+ id: string;
79
+ version: number;
182
80
  };
183
- }) | (BoardOperationBase & {
184
- type: "node.delete";
185
- payload: {
186
- nodeId: string;
187
- reason?: BoardDeleteReason;
81
+ changed: {
82
+ items: string[];
83
+ connections: string[];
84
+ effects: string[];
85
+ compositions: string[];
86
+ board: boolean;
87
+ orderChanged: boolean;
188
88
  };
189
- }) | (BoardOperationBase & {
190
- type: "connection.create";
191
- payload: {
192
- connection: BoardConnectionInput;
193
- };
194
- }) | (BoardOperationBase & {
195
- type: "connection.patch";
196
- payload: {
197
- connectionId: string;
198
- patch: BoardConnectionPatch;
199
- };
200
- }) | (BoardOperationBase & {
201
- type: "connection.delete";
202
- payload: {
203
- connectionId: string;
204
- reason?: BoardDeleteReason;
205
- };
206
- }) | (BoardOperationBase & {
207
- type: "effect.upsert";
208
- payload: {
209
- effect: Omit<BoardEffect, "boardId" | "revision">;
210
- };
211
- }) | (BoardOperationBase & {
212
- type: "effect.delete";
213
- payload: {
214
- effectId: string;
215
- };
216
- }) | (BoardOperationBase & {
217
- type: "composition.apply";
218
- payload: {
219
- composition: Omit<BoardComposition, "revision">;
220
- };
221
- }) | (BoardOperationBase & {
222
- type: "composition.delete";
223
- payload: {
224
- compositionId: string;
225
- };
226
- });
89
+ };
227
90
  type BoardDiagnostic = {
228
91
  severity: "info" | "warning" | "error";
229
92
  code: string;
@@ -240,12 +103,19 @@ type BoardValidationResult = {
240
103
  diagnostics: BoardDiagnostic[];
241
104
  peakCost: BoardRenderCost;
242
105
  };
243
- /** Persisted on `boards.metadata.playback`: how a Board plays when opened. */
244
- declare const BoardPlaybackPolicySchema: z.ZodObject<{
245
- compositionId: z.ZodString;
246
- delayMs: z.ZodDefault<z.ZodNumber>;
247
- }, z.core.$strip>;
248
- type BoardPlaybackPolicy = z.infer<typeof BoardPlaybackPolicySchema>;
106
+ type BoardPlaybackStatus = "playing" | "paused" | "stopped";
107
+ type BoardPlaybackSnapshot = {
108
+ boardId: string;
109
+ playbackId: string;
110
+ compositionId: string;
111
+ compositionRevision: number;
112
+ playbackRevision: number;
113
+ status: BoardPlaybackStatus;
114
+ position: number;
115
+ effectiveAt: number;
116
+ timeScale: number;
117
+ seed: string;
118
+ };
249
119
  declare function isBoardPath(path: string): boolean;
250
120
  //#endregion
251
- export { BOARD_DELETE_REASONS, BOARD_DOCUMENT_KIND, BOARD_EXTENSION, BoardAssetRef, BoardAssetRefSchema, BoardCameraFocus, BoardCameraFocusParams, BoardCameraFocusParamsSchema, BoardCameraFocusSchema, BoardCameraState, BoardCameraStateSchema, type BoardCapability, BoardDeleteReason, BoardDiagnostic, BoardEffect, BoardEffectSchema, BoardManifest, BoardManifestSchema, BoardNodeInput, BoardNodeRecord, BoardOperation, BoardPlaybackPolicy, BoardPlaybackPolicySchema, BoardRecord, type BoardRenderCost, BoardValidationResult, InvalidBoardFileError, isBoardPath, parseBoardManifest, serializeBoardManifest };
121
+ export { BOARD_DOCUMENT_KIND, BOARD_EXTENSION, type BoardAssetRef, BoardCameraFocus, BoardCameraFocusParams, BoardCameraFocusParamsSchema, BoardCameraFocusSchema, BoardCameraState, BoardCameraStateSchema, type BoardCapability, BoardDiagnostic, type BoardEffect, BoardManifest, BoardManifestSchema, BoardMutationReceipt, BoardPlaybackSnapshot, BoardPlaybackStatus, type BoardRenderCost, BoardValidationResult, isBoardPath, parseBoardManifest, serializeBoardManifest };