@neta-art/cohub 6.0.0 → 7.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.
- package/README.md +6 -5
- package/dist/board/animation.d.ts +2 -1
- package/dist/board/animation.js +0 -1
- package/dist/board/core/connections.js +4 -4
- package/dist/board/core/export-plan.js +1 -1
- package/dist/board/core/shape-types.js +0 -1
- package/dist/board/index.d.ts +6 -5
- package/dist/board/index.js +7 -7
- package/dist/board/mutation.d.ts +2 -11
- package/dist/board/mutation.js +2 -56
- package/dist/board/render/renderers/text-card-renderer.js +1 -1
- package/dist/board/semantic-document.d.ts +30 -0
- package/dist/board/semantic-document.js +271 -0
- package/dist/board/semantic-mutation.d.ts +10 -0
- package/dist/board/semantic-mutation.js +203 -0
- package/dist/chunks/http.d.ts +15 -94
- package/dist/chunks/http.js +248 -1588
- package/dist/chunks/transport.js +1 -1
- package/dist/chunks/websocket.d.ts +3646 -3139
- package/dist/chunks/websocket.js +1 -1
- package/dist/http.d.ts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1045 -195
- package/dist/protocol/dist/board-authoring.d.ts +1305 -1
- package/dist/protocol/dist/board-authoring.js +80 -6
- package/dist/protocol/dist/board-codec.d.ts +2 -2
- package/dist/protocol/dist/board-codec.js +19 -4
- package/dist/protocol/dist/board-composition.d.ts +126 -1
- package/dist/protocol/dist/board-composition.js +1 -9
- package/dist/protocol/dist/board-connection.d.ts +16 -16
- package/dist/protocol/dist/board-connection.js +16 -16
- package/dist/protocol/dist/board-document.d.ts +34 -3
- package/dist/protocol/dist/board-document.js +3 -1
- package/dist/protocol/dist/board-effect.d.ts +94 -0
- package/dist/protocol/dist/board-effect.js +53 -0
- package/dist/protocol/dist/board-json.js +16 -0
- package/dist/protocol/dist/board.d.ts +34 -164
- package/dist/protocol/dist/board.js +44 -45
- package/dist/protocol/dist/index.d.ts +7 -7
- package/dist/types.d.ts +3 -1
- package/package.json +1 -2
- package/dist/board/codec.d.ts +0 -27
- package/dist/board/codec.js +0 -277
- package/dist/protocol/dist/board-content.js +0 -26
- package/dist/protocol/dist/board-upgrade.d.ts +0 -1
- package/dist/protocol/dist/board-upgrade.js +0 -2
- package/dist/protocol/dist/identifiers.js +0 -10
- package/dist/protocol/dist/index.js +0 -19
- package/dist/protocol/dist/provenance.js +0 -15
- package/dist/protocol/dist/public-identifiers.js +0 -38
- package/dist/protocol/dist/realtime/board-awareness.js +0 -119
- package/dist/protocol/dist/ui-command.js +0 -2
- package/dist/protocol/dist/work-promotion-stats.js +0 -11
- package/dist/protocol/dist/work-surface.js +0 -2
- package/dist/protocol/dist/work-view-stats.js +0 -3
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import "./board-constants.js";
|
|
2
|
+
import { BoardConnectionPatchSchema, BoardConnectionSchema } from "./board-connection.js";
|
|
3
|
+
import { BoardCompositionInputSchema } from "./board-composition.js";
|
|
4
|
+
import { BoardEffectInputSchema } from "./board-effect.js";
|
|
2
5
|
import { z } from "zod";
|
|
3
6
|
//#region ../protocol/dist/board-authoring.js
|
|
4
|
-
const
|
|
7
|
+
const BOARD_AUTHORING_COLOR_IDS = [
|
|
5
8
|
"brand",
|
|
6
9
|
"neutral",
|
|
7
10
|
"black",
|
|
@@ -12,7 +15,7 @@ const BOARD_COLOR_IDS = [
|
|
|
12
15
|
"violet",
|
|
13
16
|
"rose"
|
|
14
17
|
];
|
|
15
|
-
const
|
|
18
|
+
const BOARD_AUTHORING_GEO_KINDS = [
|
|
16
19
|
"rectangle",
|
|
17
20
|
"rounded",
|
|
18
21
|
"ellipse",
|
|
@@ -46,7 +49,7 @@ const cropSchema = z.object({
|
|
|
46
49
|
h: finiteSchema.min(0).max(1)
|
|
47
50
|
}).strict();
|
|
48
51
|
const BoardItemStyleSchema = z.object({
|
|
49
|
-
color: z.enum(
|
|
52
|
+
color: z.enum(BOARD_AUTHORING_COLOR_IDS).optional(),
|
|
50
53
|
strokeWidth: finiteSchema.min(1).max(64).optional(),
|
|
51
54
|
fillOpacity: finiteSchema.min(0).max(1).optional()
|
|
52
55
|
}).strict();
|
|
@@ -82,7 +85,7 @@ const BoardGeoAuthoringItemSchema = z.object({
|
|
|
82
85
|
...styledBaseFields,
|
|
83
86
|
type: z.literal("geo"),
|
|
84
87
|
props: z.object({
|
|
85
|
-
shape: z.enum(
|
|
88
|
+
shape: z.enum(BOARD_AUTHORING_GEO_KINDS).default("rectangle"),
|
|
86
89
|
text: z.string().default("")
|
|
87
90
|
}).strict()
|
|
88
91
|
}).strict();
|
|
@@ -185,7 +188,23 @@ const BoardItemPatchSchema = z.object({
|
|
|
185
188
|
source: jsonObjectSchema.nullable().optional(),
|
|
186
189
|
metadata: jsonObjectSchema.nullable().optional()
|
|
187
190
|
}).strict().refine((patch) => Object.keys(patch).length > 0, "item patch is empty");
|
|
191
|
+
const BoardConnectionInputSchema = BoardConnectionSchema;
|
|
192
|
+
const stripServerFields = (value) => {
|
|
193
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
194
|
+
const { boardId: _boardId, revision: _revision, ...input } = value;
|
|
195
|
+
return input;
|
|
196
|
+
};
|
|
197
|
+
const BoardEffectCommandInputSchema = z.preprocess(stripServerFields, BoardEffectInputSchema);
|
|
198
|
+
const BoardCompositionCommandInputSchema = z.preprocess(stripServerFields, BoardCompositionInputSchema);
|
|
188
199
|
const BoardSemanticCommandSchema = z.discriminatedUnion("type", [
|
|
200
|
+
z.object({
|
|
201
|
+
type: z.literal("board.patch"),
|
|
202
|
+
patch: z.object({
|
|
203
|
+
title: z.string().min(1).max(255).optional(),
|
|
204
|
+
metadata: jsonObjectSchema.nullable().optional(),
|
|
205
|
+
metadataPatch: jsonObjectSchema.optional()
|
|
206
|
+
}).strict().refine((patch) => Object.keys(patch).length > 0, "board patch is empty")
|
|
207
|
+
}).strict(),
|
|
189
208
|
z.object({
|
|
190
209
|
type: z.literal("item.create"),
|
|
191
210
|
item: BoardAuthoringItemSchema
|
|
@@ -204,14 +223,69 @@ const BoardSemanticCommandSchema = z.discriminatedUnion("type", [
|
|
|
204
223
|
type: z.literal("item.delete"),
|
|
205
224
|
itemId: idSchema,
|
|
206
225
|
cascade: z.boolean().default(false)
|
|
226
|
+
}).strict(),
|
|
227
|
+
z.object({
|
|
228
|
+
type: z.literal("item.reorder"),
|
|
229
|
+
itemId: idSchema,
|
|
230
|
+
index: z.number().int().nonnegative()
|
|
231
|
+
}).strict(),
|
|
232
|
+
z.object({
|
|
233
|
+
type: z.literal("connection.create"),
|
|
234
|
+
connection: BoardConnectionInputSchema
|
|
235
|
+
}).strict(),
|
|
236
|
+
z.object({
|
|
237
|
+
type: z.literal("connection.patch"),
|
|
238
|
+
connectionId: idSchema,
|
|
239
|
+
patch: BoardConnectionPatchSchema
|
|
240
|
+
}).strict(),
|
|
241
|
+
z.object({
|
|
242
|
+
type: z.literal("connection.delete"),
|
|
243
|
+
connectionId: idSchema
|
|
244
|
+
}).strict(),
|
|
245
|
+
z.object({
|
|
246
|
+
type: z.literal("effect.apply"),
|
|
247
|
+
effect: BoardEffectCommandInputSchema
|
|
248
|
+
}).strict(),
|
|
249
|
+
z.object({
|
|
250
|
+
type: z.literal("effect.delete"),
|
|
251
|
+
effectId: idSchema
|
|
252
|
+
}).strict(),
|
|
253
|
+
z.object({
|
|
254
|
+
type: z.literal("composition.apply"),
|
|
255
|
+
composition: BoardCompositionCommandInputSchema
|
|
256
|
+
}).strict(),
|
|
257
|
+
z.object({
|
|
258
|
+
type: z.literal("composition.delete"),
|
|
259
|
+
compositionId: idSchema
|
|
207
260
|
}).strict()
|
|
208
261
|
]);
|
|
209
|
-
z.object({
|
|
262
|
+
const BoardSemanticMutationSchema = z.object({
|
|
210
263
|
mutationId: idSchema,
|
|
211
264
|
baseVersion: z.number().int().nonnegative(),
|
|
212
265
|
clientId: idSchema.optional(),
|
|
213
266
|
undoGroupId: idSchema.optional(),
|
|
267
|
+
/** Validate (including server-side reference checks) without writing. */
|
|
268
|
+
dryRun: z.boolean().default(false),
|
|
214
269
|
commands: z.array(BoardSemanticCommandSchema).min(1).max(5e4)
|
|
215
270
|
}).strict();
|
|
271
|
+
z.object({
|
|
272
|
+
include: z.array(z.enum([
|
|
273
|
+
"items",
|
|
274
|
+
"connections",
|
|
275
|
+
"effects",
|
|
276
|
+
"compositions",
|
|
277
|
+
"playback"
|
|
278
|
+
])).optional(),
|
|
279
|
+
itemIds: z.array(idSchema).max(5e4).optional(),
|
|
280
|
+
connectionIds: z.array(idSchema).max(5e4).optional(),
|
|
281
|
+
effectIds: z.array(idSchema).max(5e4).optional(),
|
|
282
|
+
compositionIds: z.array(idSchema).max(5e4).optional(),
|
|
283
|
+
viewport: z.object({
|
|
284
|
+
x: finiteSchema,
|
|
285
|
+
y: finiteSchema,
|
|
286
|
+
width: finiteSchema.positive(),
|
|
287
|
+
height: finiteSchema.positive()
|
|
288
|
+
}).optional()
|
|
289
|
+
}).strict();
|
|
216
290
|
//#endregion
|
|
217
|
-
export { BoardArrowAuthoringItemSchema, BoardAudioAuthoringItemSchema, BoardAuthoringItemSchema, BoardBuiltinAuthoringItemSchema, BoardDrawAuthoringItemSchema, BoardExtensionAuthoringItemSchema, BoardFileAuthoringItemSchema, BoardFrameAuthoringItemSchema, BoardGeoAuthoringItemSchema, BoardImageAuthoringItemSchema, BoardItemPatchSchema, BoardItemSourceSchema, BoardItemStyleSchema, BoardSemanticCommandSchema, BoardTaskAuthoringItemSchema, BoardTextAuthoringItemSchema, BoardVideoAuthoringItemSchema, isSafeBoardSourcePath };
|
|
291
|
+
export { BOARD_AUTHORING_COLOR_IDS, BOARD_AUTHORING_GEO_KINDS, BoardArrowAuthoringItemSchema, BoardAudioAuthoringItemSchema, BoardAuthoringItemSchema, BoardBuiltinAuthoringItemSchema, BoardDrawAuthoringItemSchema, BoardExtensionAuthoringItemSchema, BoardFileAuthoringItemSchema, BoardFrameAuthoringItemSchema, BoardGeoAuthoringItemSchema, BoardImageAuthoringItemSchema, BoardItemPatchSchema, BoardItemSourceSchema, BoardItemStyleSchema, BoardSemanticCommandSchema, BoardSemanticMutationSchema, BoardTaskAuthoringItemSchema, BoardTextAuthoringItemSchema, BoardVideoAuthoringItemSchema, isSafeBoardSourcePath };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./board.js";
|
|
2
|
-
import "./board
|
|
1
|
+
import "./board-authoring.js";
|
|
2
|
+
import "./board.js";
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import "./board-authoring.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { BoardAuthoringItemSchema, BoardItemPatchSchema } from "./board-authoring.js";
|
|
2
|
+
//#region ../protocol/dist/board-codec.js
|
|
3
|
+
const isRecord = (value) => Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
4
|
+
function applyBoardItemPatch(current, value) {
|
|
5
|
+
const merged = mergePatch(current, BoardItemPatchSchema.parse(value));
|
|
6
|
+
merged.id = current.id;
|
|
7
|
+
merged.type = current.type;
|
|
8
|
+
if ("kindVersion" in current) merged.kindVersion = current.kindVersion;
|
|
9
|
+
return BoardAuthoringItemSchema.parse(merged);
|
|
10
|
+
}
|
|
11
|
+
function mergePatch(current, patch) {
|
|
12
|
+
if (!isRecord(patch)) return patch;
|
|
13
|
+
const result = isRecord(current) ? { ...current } : {};
|
|
14
|
+
for (const [key, value] of Object.entries(patch)) if (value === null) delete result[key];
|
|
15
|
+
else result[key] = isRecord(value) ? mergePatch(result[key], value) : value;
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { applyBoardItemPatch };
|
|
@@ -128,6 +128,131 @@ declare const BoardTimelineMarkerSchema: z.ZodObject<{
|
|
|
128
128
|
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
129
129
|
}, z.core.$strict>;
|
|
130
130
|
type BoardTimelineMarker = z.infer<typeof BoardTimelineMarkerSchema>;
|
|
131
|
+
declare const BoardCompositionInputSchema: z.ZodObject<{
|
|
132
|
+
id: z.ZodString;
|
|
133
|
+
name: z.ZodString;
|
|
134
|
+
timeline: z.ZodObject<{
|
|
135
|
+
duration: z.ZodNumber;
|
|
136
|
+
tracks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
137
|
+
id: z.ZodString;
|
|
138
|
+
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
139
|
+
type: z.ZodLiteral<"item">;
|
|
140
|
+
itemId: z.ZodString;
|
|
141
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<"effect">;
|
|
143
|
+
effectId: z.ZodString;
|
|
144
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
145
|
+
type: z.ZodLiteral<"camera">;
|
|
146
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
147
|
+
type: z.ZodLiteral<"board">;
|
|
148
|
+
}, z.core.$strict>], "type">;
|
|
149
|
+
channel: z.ZodString;
|
|
150
|
+
channelVersion: z.ZodDefault<z.ZodNumber>;
|
|
151
|
+
interpolation: z.ZodDefault<z.ZodEnum<{
|
|
152
|
+
linear: "linear";
|
|
153
|
+
step: "step";
|
|
154
|
+
}>>;
|
|
155
|
+
fill: z.ZodDefault<z.ZodEnum<{
|
|
156
|
+
backwards: "backwards";
|
|
157
|
+
both: "both";
|
|
158
|
+
forwards: "forwards";
|
|
159
|
+
none: "none";
|
|
160
|
+
}>>;
|
|
161
|
+
keyframes: z.ZodArray<z.ZodObject<{
|
|
162
|
+
time: z.ZodNumber;
|
|
163
|
+
value: z.ZodUnknown;
|
|
164
|
+
easing: z.ZodOptional<z.ZodEnum<{
|
|
165
|
+
"ease-in-cubic": "ease-in-cubic";
|
|
166
|
+
"ease-in-out-cubic": "ease-in-out-cubic";
|
|
167
|
+
"ease-in-out-quad": "ease-in-out-quad";
|
|
168
|
+
"ease-in-quad": "ease-in-quad";
|
|
169
|
+
"ease-out-cubic": "ease-out-cubic";
|
|
170
|
+
"ease-out-expo": "ease-out-expo";
|
|
171
|
+
"ease-out-quad": "ease-out-quad";
|
|
172
|
+
"ease-out-quart": "ease-out-quart";
|
|
173
|
+
linear: "linear";
|
|
174
|
+
}>>;
|
|
175
|
+
}, z.core.$strict>>;
|
|
176
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
177
|
+
}, z.core.$strict>>>;
|
|
178
|
+
clips: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
179
|
+
id: z.ZodString;
|
|
180
|
+
kind: z.ZodString;
|
|
181
|
+
kindVersion: z.ZodNumber;
|
|
182
|
+
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
183
|
+
type: z.ZodLiteral<"item">;
|
|
184
|
+
itemId: z.ZodString;
|
|
185
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
186
|
+
type: z.ZodLiteral<"effect">;
|
|
187
|
+
effectId: z.ZodString;
|
|
188
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
189
|
+
type: z.ZodLiteral<"camera">;
|
|
190
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
191
|
+
type: z.ZodLiteral<"board">;
|
|
192
|
+
}, z.core.$strict>], "type">;
|
|
193
|
+
start: z.ZodNumber;
|
|
194
|
+
duration: z.ZodNumber;
|
|
195
|
+
layer: z.ZodDefault<z.ZodEnum<{
|
|
196
|
+
behind: "behind";
|
|
197
|
+
content: "content";
|
|
198
|
+
front: "front";
|
|
199
|
+
screen: "screen";
|
|
200
|
+
}>>;
|
|
201
|
+
fill: z.ZodDefault<z.ZodEnum<{
|
|
202
|
+
backwards: "backwards";
|
|
203
|
+
both: "both";
|
|
204
|
+
forwards: "forwards";
|
|
205
|
+
none: "none";
|
|
206
|
+
}>>;
|
|
207
|
+
easing: z.ZodDefault<z.ZodEnum<{
|
|
208
|
+
"ease-in-cubic": "ease-in-cubic";
|
|
209
|
+
"ease-in-out-cubic": "ease-in-out-cubic";
|
|
210
|
+
"ease-in-out-quad": "ease-in-out-quad";
|
|
211
|
+
"ease-in-quad": "ease-in-quad";
|
|
212
|
+
"ease-out-cubic": "ease-out-cubic";
|
|
213
|
+
"ease-out-expo": "ease-out-expo";
|
|
214
|
+
"ease-out-quad": "ease-out-quad";
|
|
215
|
+
"ease-out-quart": "ease-out-quart";
|
|
216
|
+
linear: "linear";
|
|
217
|
+
}>>;
|
|
218
|
+
params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
219
|
+
assetRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
220
|
+
type: z.ZodEnum<{
|
|
221
|
+
extension: "extension";
|
|
222
|
+
"space-file": "space-file";
|
|
223
|
+
}>;
|
|
224
|
+
ref: z.ZodString;
|
|
225
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
226
|
+
}, z.core.$strict>>>;
|
|
227
|
+
seed: z.ZodString;
|
|
228
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
229
|
+
}, z.core.$strict>>>;
|
|
230
|
+
markers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
231
|
+
id: z.ZodString;
|
|
232
|
+
time: z.ZodNumber;
|
|
233
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
234
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
235
|
+
}, z.core.$strict>>>;
|
|
236
|
+
}, z.core.$strict>;
|
|
237
|
+
playback: z.ZodDefault<z.ZodObject<{
|
|
238
|
+
loop: z.ZodDefault<z.ZodBoolean>;
|
|
239
|
+
endBehavior: z.ZodDefault<z.ZodEnum<{
|
|
240
|
+
hold: "hold";
|
|
241
|
+
reset: "reset";
|
|
242
|
+
}>>;
|
|
243
|
+
reducedMotion: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
244
|
+
mode: z.ZodLiteral<"base">;
|
|
245
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
246
|
+
mode: z.ZodLiteral<"time">;
|
|
247
|
+
time: z.ZodNumber;
|
|
248
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
249
|
+
mode: z.ZodLiteral<"marker">;
|
|
250
|
+
markerId: z.ZodString;
|
|
251
|
+
}, z.core.$strict>], "mode">>;
|
|
252
|
+
}, z.core.$strict>>;
|
|
253
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
254
|
+
}, z.core.$strict>;
|
|
255
|
+
type BoardCompositionInput = z.infer<typeof BoardCompositionInputSchema>;
|
|
131
256
|
declare const BoardCompositionSchema: z.ZodObject<{
|
|
132
257
|
id: z.ZodString;
|
|
133
258
|
name: z.ZodString;
|
|
@@ -255,4 +380,4 @@ declare const BoardCompositionSchema: z.ZodObject<{
|
|
|
255
380
|
}, z.core.$strict>;
|
|
256
381
|
type BoardComposition = z.infer<typeof BoardCompositionSchema>;
|
|
257
382
|
//#endregion
|
|
258
|
-
export { BoardAnimationTarget, BoardAnimationTargetSchema, BoardComposition, BoardCompositionSchema, BoardEasing, BoardEasingSchema, BoardProceduralClip, BoardProceduralClipSchema, BoardTimelineMarker, BoardTimelineMarkerSchema, BoardTrack, BoardTrackInterpolation, BoardTrackSchema };
|
|
383
|
+
export { BoardAnimationTarget, BoardAnimationTargetSchema, BoardComposition, BoardCompositionInput, BoardCompositionInputSchema, BoardCompositionSchema, BoardEasing, BoardEasingSchema, BoardProceduralClip, BoardProceduralClipSchema, BoardTimelineMarker, BoardTimelineMarkerSchema, BoardTrack, BoardTrackInterpolation, BoardTrackSchema };
|
|
@@ -297,14 +297,6 @@ const BoardCompositionSchema = z.object({
|
|
|
297
297
|
...compositionFields,
|
|
298
298
|
revision: z.number().int().nonnegative().default(0)
|
|
299
299
|
}).strict().superRefine(validateCompositionFallback);
|
|
300
|
-
/** Accept inspect/get output as apply input while stripping server-owned revision. */
|
|
301
|
-
function parseBoardCompositionInput(value) {
|
|
302
|
-
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
303
|
-
const { revision: _revision, ...input } = value;
|
|
304
|
-
return BoardCompositionInputSchema.parse(input);
|
|
305
|
-
}
|
|
306
|
-
return BoardCompositionInputSchema.parse(value);
|
|
307
|
-
}
|
|
308
300
|
Object.entries(BOARD_ANIMATION_CHANNELS).map(([id, definition]) => ({
|
|
309
301
|
id,
|
|
310
302
|
version: 1,
|
|
@@ -315,4 +307,4 @@ Object.entries(BOARD_ANIMATION_CHANNELS).map(([id, definition]) => ({
|
|
|
315
307
|
valueSchema: z.toJSONSchema(definition.value)
|
|
316
308
|
}));
|
|
317
309
|
//#endregion
|
|
318
|
-
export { BOARD_ANIMATION_CHANNELS, BOARD_EASINGS, BoardAnimationTargetSchema, BoardCompositionInputSchema, BoardCompositionPlaybackSchema, BoardCompositionSchema, BoardEasingSchema, BoardProceduralClipSchema, BoardTimelineMarkerSchema, BoardTimelineSchema, BoardTrackSchema
|
|
310
|
+
export { BOARD_ANIMATION_CHANNELS, BOARD_EASINGS, BoardAnimationTargetSchema, BoardCompositionInputSchema, BoardCompositionPlaybackSchema, BoardCompositionSchema, BoardEasingSchema, BoardProceduralClipSchema, BoardTimelineMarkerSchema, BoardTimelineSchema, BoardTrackSchema };
|
|
@@ -35,7 +35,7 @@ declare const BoardConnectionAnchorSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
35
35
|
type BoardConnectionAnchor = z.infer<typeof BoardConnectionAnchorSchema>;
|
|
36
36
|
declare const AUTO_BOARD_CONNECTION_ANCHOR: BoardConnectionAnchor;
|
|
37
37
|
declare const BoardConnectionEndpointSchema: z.ZodObject<{
|
|
38
|
-
|
|
38
|
+
itemId: z.ZodString;
|
|
39
39
|
portId: z.ZodOptional<z.ZodString>;
|
|
40
40
|
anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
|
|
41
41
|
kind: z.ZodLiteral<"auto">;
|
|
@@ -125,7 +125,7 @@ declare const DEFAULT_BOARD_CONNECTION_STYLE: BoardConnectionStyle;
|
|
|
125
125
|
declare const BoardConnectionSchema: z.ZodObject<{
|
|
126
126
|
id: z.ZodString;
|
|
127
127
|
source: z.ZodObject<{
|
|
128
|
-
|
|
128
|
+
itemId: z.ZodString;
|
|
129
129
|
portId: z.ZodOptional<z.ZodString>;
|
|
130
130
|
anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
|
|
131
131
|
kind: z.ZodLiteral<"auto">;
|
|
@@ -145,7 +145,7 @@ declare const BoardConnectionSchema: z.ZodObject<{
|
|
|
145
145
|
}, z.core.$strip>]>>;
|
|
146
146
|
}, z.core.$strip>;
|
|
147
147
|
target: z.ZodObject<{
|
|
148
|
-
|
|
148
|
+
itemId: z.ZodString;
|
|
149
149
|
portId: z.ZodOptional<z.ZodString>;
|
|
150
150
|
anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
|
|
151
151
|
kind: z.ZodLiteral<"auto">;
|
|
@@ -193,7 +193,7 @@ declare const BoardConnectionSchema: z.ZodObject<{
|
|
|
193
193
|
}>>;
|
|
194
194
|
}, z.core.$strip>>;
|
|
195
195
|
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
196
|
-
}, z.core.$
|
|
196
|
+
}, z.core.$strict>;
|
|
197
197
|
type BoardConnection = z.infer<typeof BoardConnectionSchema>;
|
|
198
198
|
/** Server-owned fields, mirroring how nodes carry a board id and revision. */
|
|
199
199
|
type BoardConnectionRecord = BoardConnection & {
|
|
@@ -212,7 +212,7 @@ type BoardConnectionInput = BoardConnection;
|
|
|
212
212
|
*/
|
|
213
213
|
declare const BoardConnectionPatchSchema: z.ZodObject<{
|
|
214
214
|
source: z.ZodOptional<z.ZodObject<{
|
|
215
|
-
|
|
215
|
+
itemId: z.ZodString;
|
|
216
216
|
portId: z.ZodOptional<z.ZodString>;
|
|
217
217
|
anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
|
|
218
218
|
kind: z.ZodLiteral<"auto">;
|
|
@@ -232,7 +232,7 @@ declare const BoardConnectionPatchSchema: z.ZodObject<{
|
|
|
232
232
|
}, z.core.$strip>]>>;
|
|
233
233
|
}, z.core.$strip>>;
|
|
234
234
|
target: z.ZodOptional<z.ZodObject<{
|
|
235
|
-
|
|
235
|
+
itemId: z.ZodString;
|
|
236
236
|
portId: z.ZodOptional<z.ZodString>;
|
|
237
237
|
anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
|
|
238
238
|
kind: z.ZodLiteral<"auto">;
|
|
@@ -280,26 +280,26 @@ declare const BoardConnectionPatchSchema: z.ZodObject<{
|
|
|
280
280
|
}>>;
|
|
281
281
|
}, z.core.$strip>>>;
|
|
282
282
|
metadata: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
283
|
-
}, z.core.$
|
|
283
|
+
}, z.core.$strict>;
|
|
284
284
|
type BoardConnectionPatch = z.infer<typeof BoardConnectionPatchSchema>;
|
|
285
|
-
/** Both
|
|
286
|
-
declare function
|
|
285
|
+
/** Both item ids a connection touches, deduped for a self-loop. */
|
|
286
|
+
declare function connectionItemIds(connection: BoardConnection): string[];
|
|
287
287
|
/** Whether a connection touches the given node. */
|
|
288
|
-
declare function
|
|
289
|
-
/** The
|
|
290
|
-
declare function
|
|
288
|
+
declare function connectionTouchesItem(connection: BoardConnection, itemId: string): boolean;
|
|
289
|
+
/** The item at the far end of a connection from `itemId`, or null. */
|
|
290
|
+
declare function connectionOtherItemId(connection: BoardConnection, itemId: string): string | null;
|
|
291
291
|
declare function normalizeBoardConnectionStyle(style: Partial<BoardConnectionStyle> | undefined): BoardConnectionStyle;
|
|
292
292
|
/**
|
|
293
293
|
* Build a connection with every default filled in.
|
|
294
294
|
*
|
|
295
|
-
* Callers only state what they mean (which
|
|
295
|
+
* Callers only state what they mean (which items, and optionally the relation),
|
|
296
296
|
* so a connection created by the editor, an agent or the CLI is byte-identical
|
|
297
297
|
* for the same intent.
|
|
298
298
|
*/
|
|
299
299
|
declare function createBoardConnection(input: {
|
|
300
300
|
id: string;
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
sourceItemId: string;
|
|
302
|
+
targetItemId: string;
|
|
303
303
|
relation?: string;
|
|
304
304
|
direction?: BoardConnectionDirection;
|
|
305
305
|
label?: string;
|
|
@@ -314,4 +314,4 @@ declare function createBoardConnection(input: {
|
|
|
314
314
|
/** Reverse a connection's endpoints, preserving the relation's reading order. */
|
|
315
315
|
declare function flipBoardConnection(connection: BoardConnection): BoardConnection;
|
|
316
316
|
//#endregion
|
|
317
|
-
export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BoardConnection, BoardConnectionAnchor, BoardConnectionAnchorSchema, BoardConnectionDirection, BoardConnectionEndpoint, BoardConnectionEndpointSchema, BoardConnectionInput, BoardConnectionLine, BoardConnectionPatch, BoardConnectionPatchSchema, BoardConnectionRecord, BoardConnectionRouting, BoardConnectionRoutingConfig, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionSide, BoardConnectionStyle, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardRelationSchema, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION,
|
|
317
|
+
export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BoardConnection, BoardConnectionAnchor, BoardConnectionAnchorSchema, BoardConnectionDirection, BoardConnectionEndpoint, BoardConnectionEndpointSchema, BoardConnectionInput, BoardConnectionLine, BoardConnectionPatch, BoardConnectionPatchSchema, BoardConnectionRecord, BoardConnectionRouting, BoardConnectionRoutingConfig, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionSide, BoardConnectionStyle, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardRelationSchema, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION, connectionItemIds, connectionOtherItemId, connectionTouchesItem, createBoardConnection, flipBoardConnection, normalizeBoardConnectionStyle };
|
|
@@ -10,7 +10,7 @@ import { z } from "zod";
|
|
|
10
10
|
* force a bounding box to be persisted and kept in sync with both endpoints —
|
|
11
11
|
* a second source of truth that is stale the moment either node moves.
|
|
12
12
|
*
|
|
13
|
-
* The stored form is therefore purely semantic: which
|
|
13
|
+
* The stored form is therefore purely semantic: which items, in which direction,
|
|
14
14
|
* anchored where, routed how. Every world coordinate is resolved at read time
|
|
15
15
|
* from the live node frames (see the SDK's connection geometry), so a connection
|
|
16
16
|
* can never drift from the nodes it describes.
|
|
@@ -54,7 +54,7 @@ const BoardConnectionAnchorSchema = z.union([
|
|
|
54
54
|
]);
|
|
55
55
|
const AUTO_BOARD_CONNECTION_ANCHOR = { kind: "auto" };
|
|
56
56
|
const BoardConnectionEndpointSchema = z.object({
|
|
57
|
-
|
|
57
|
+
itemId: z.string().min(1).max(160),
|
|
58
58
|
/** Optional semantic port. Older connections omit it and remain valid. */
|
|
59
59
|
portId: z.string().min(1).max(120).optional(),
|
|
60
60
|
anchor: BoardConnectionAnchorSchema.default(AUTO_BOARD_CONNECTION_ANCHOR)
|
|
@@ -140,7 +140,7 @@ const BoardConnectionSchema = z.object({
|
|
|
140
140
|
routing: BoardConnectionRoutingSchema.default(DEFAULT_BOARD_CONNECTION_ROUTING),
|
|
141
141
|
style: BoardConnectionStyleSchema.default(DEFAULT_BOARD_CONNECTION_STYLE),
|
|
142
142
|
metadata: z.record(z.string(), z.unknown()).default({})
|
|
143
|
-
});
|
|
143
|
+
}).strict();
|
|
144
144
|
/**
|
|
145
145
|
* A patch to an existing connection.
|
|
146
146
|
*
|
|
@@ -148,18 +148,18 @@ const BoardConnectionSchema = z.object({
|
|
|
148
148
|
* endpoints is an edit of the same relation, not a new one.
|
|
149
149
|
*/
|
|
150
150
|
const BoardConnectionPatchSchema = BoardConnectionSchema.omit({ id: true }).partial();
|
|
151
|
-
/** Both
|
|
152
|
-
function
|
|
153
|
-
return connection.source.
|
|
151
|
+
/** Both item ids a connection touches, deduped for a self-loop. */
|
|
152
|
+
function connectionItemIds(connection) {
|
|
153
|
+
return connection.source.itemId === connection.target.itemId ? [connection.source.itemId] : [connection.source.itemId, connection.target.itemId];
|
|
154
154
|
}
|
|
155
155
|
/** Whether a connection touches the given node. */
|
|
156
|
-
function
|
|
157
|
-
return connection.source.
|
|
156
|
+
function connectionTouchesItem(connection, itemId) {
|
|
157
|
+
return connection.source.itemId === itemId || connection.target.itemId === itemId;
|
|
158
158
|
}
|
|
159
|
-
/** The
|
|
160
|
-
function
|
|
161
|
-
if (connection.source.
|
|
162
|
-
if (connection.target.
|
|
159
|
+
/** The item at the far end of a connection from `itemId`, or null. */
|
|
160
|
+
function connectionOtherItemId(connection, itemId) {
|
|
161
|
+
if (connection.source.itemId === itemId) return connection.target.itemId;
|
|
162
|
+
if (connection.target.itemId === itemId) return connection.source.itemId;
|
|
163
163
|
return null;
|
|
164
164
|
}
|
|
165
165
|
function normalizeBoardConnectionStyle(style) {
|
|
@@ -172,7 +172,7 @@ function normalizeBoardConnectionStyle(style) {
|
|
|
172
172
|
/**
|
|
173
173
|
* Build a connection with every default filled in.
|
|
174
174
|
*
|
|
175
|
-
* Callers only state what they mean (which
|
|
175
|
+
* Callers only state what they mean (which items, and optionally the relation),
|
|
176
176
|
* so a connection created by the editor, an agent or the CLI is byte-identical
|
|
177
177
|
* for the same intent.
|
|
178
178
|
*/
|
|
@@ -180,12 +180,12 @@ function createBoardConnection(input) {
|
|
|
180
180
|
return {
|
|
181
181
|
id: input.id,
|
|
182
182
|
source: {
|
|
183
|
-
|
|
183
|
+
itemId: input.sourceItemId,
|
|
184
184
|
...input.sourcePortId ? { portId: input.sourcePortId } : {},
|
|
185
185
|
anchor: input.sourceAnchor ?? AUTO_BOARD_CONNECTION_ANCHOR
|
|
186
186
|
},
|
|
187
187
|
target: {
|
|
188
|
-
|
|
188
|
+
itemId: input.targetItemId,
|
|
189
189
|
...input.targetPortId ? { portId: input.targetPortId } : {},
|
|
190
190
|
anchor: input.targetAnchor ?? AUTO_BOARD_CONNECTION_ANCHOR
|
|
191
191
|
},
|
|
@@ -216,4 +216,4 @@ function flipBoardConnection(connection) {
|
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
//#endregion
|
|
219
|
-
export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BoardConnectionAnchorSchema, BoardConnectionEndpointSchema, BoardConnectionPatchSchema, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardRelationSchema, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION,
|
|
219
|
+
export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BoardConnectionAnchorSchema, BoardConnectionEndpointSchema, BoardConnectionPatchSchema, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardRelationSchema, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION, connectionItemIds, connectionOtherItemId, connectionTouchesItem, createBoardConnection, flipBoardConnection, normalizeBoardConnectionStyle };
|