@neta-art/cohub 2.15.0 → 3.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/README.md +56 -0
- package/dist/board.d.ts +99 -0
- package/dist/board.js +2 -0
- package/dist/chunks/board.d.ts +2589 -0
- package/dist/chunks/board.js +392 -0
- package/dist/chunks/http.d.ts +211 -54
- package/dist/chunks/http.js +202 -67
- package/dist/chunks/transport.js +4 -2
- package/dist/chunks/websocket.d.ts +394 -108
- package/dist/chunks/websocket.js +14 -13
- package/dist/http.d.ts +4 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -2
- package/package.json +5 -1
package/dist/chunks/http.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as HttpTransport, t as HttpError,
|
|
1
|
+
import { b as getRealtimeBoardRoom, n as HttpTransport, t as HttpError, x as getRealtimeSpaceRoom } from "./transport.js";
|
|
2
2
|
import { a as resolveApiBaseUrl } from "./environment.js";
|
|
3
3
|
//#region src/apis/channels.ts
|
|
4
4
|
var ChannelsApi = class {
|
|
@@ -169,6 +169,9 @@ var ModelsApi = class {
|
|
|
169
169
|
async listMultimodal() {
|
|
170
170
|
return this.transport.request(`/api/models?modelType=${MULTIMODAL_MODEL_TYPE}`);
|
|
171
171
|
}
|
|
172
|
+
async status() {
|
|
173
|
+
return this.transport.request("/api/models/status");
|
|
174
|
+
}
|
|
172
175
|
};
|
|
173
176
|
//#endregion
|
|
174
177
|
//#region src/apis/prompts.ts
|
|
@@ -1313,21 +1316,23 @@ const getFilenameFromContentDisposition = (value) => {
|
|
|
1313
1316
|
return value.match(/filename="?([^";]+)"?/i)?.[1] ?? null;
|
|
1314
1317
|
};
|
|
1315
1318
|
/**
|
|
1316
|
-
* A
|
|
1319
|
+
* A board transaction rejected by the server. `status`/`code` let callers
|
|
1317
1320
|
* distinguish a recoverable version conflict (409 / "VERSION_CONFLICT") from
|
|
1318
1321
|
* transient failures, so they can rebase and retry instead of surfacing an error.
|
|
1319
1322
|
*/
|
|
1320
|
-
var
|
|
1323
|
+
var BoardTransactionError = class extends Error {
|
|
1321
1324
|
status;
|
|
1322
1325
|
code;
|
|
1323
|
-
|
|
1324
|
-
|
|
1326
|
+
body;
|
|
1327
|
+
constructor(message, status, code, body, options) {
|
|
1328
|
+
super(message, options);
|
|
1325
1329
|
this.status = status;
|
|
1326
1330
|
this.code = code;
|
|
1327
|
-
this.
|
|
1331
|
+
this.body = body;
|
|
1332
|
+
this.name = "BoardTransactionError";
|
|
1328
1333
|
}
|
|
1329
1334
|
get isVersionConflict() {
|
|
1330
|
-
return this.
|
|
1335
|
+
return this.code === "VERSION_CONFLICT";
|
|
1331
1336
|
}
|
|
1332
1337
|
};
|
|
1333
1338
|
const toSessionEventName = (type) => {
|
|
@@ -1805,15 +1810,11 @@ var SpaceEventsApi = class {
|
|
|
1805
1810
|
handler(event);
|
|
1806
1811
|
return;
|
|
1807
1812
|
}
|
|
1808
|
-
if (type === "
|
|
1809
|
-
handler(event);
|
|
1810
|
-
return;
|
|
1811
|
-
}
|
|
1812
|
-
if (type === "canvas.tx.ack" && event.type === "canvas.tx.ack") {
|
|
1813
|
+
if (type === "board.transaction.applied" && event.type === "board.transaction.applied") {
|
|
1813
1814
|
handler(event);
|
|
1814
1815
|
return;
|
|
1815
1816
|
}
|
|
1816
|
-
if (type === "
|
|
1817
|
+
if (type === "board.playback.changed" && event.type === "board.playback.changed") {
|
|
1817
1818
|
handler(event);
|
|
1818
1819
|
return;
|
|
1819
1820
|
}
|
|
@@ -2148,34 +2149,181 @@ var SpaceCommerceApi = class {
|
|
|
2148
2149
|
return this.transport.request(`/api/spaces/${this.spaceId}/commerce/orders${params.toString() ? `?${params.toString()}` : ""}`);
|
|
2149
2150
|
}
|
|
2150
2151
|
};
|
|
2151
|
-
var
|
|
2152
|
+
var BoardRealtimeClient = class {
|
|
2153
|
+
websocketClient;
|
|
2154
|
+
spaceId;
|
|
2155
|
+
boardId;
|
|
2156
|
+
constructor(websocketClient, spaceId, boardId) {
|
|
2157
|
+
this.websocketClient = websocketClient;
|
|
2158
|
+
this.spaceId = spaceId;
|
|
2159
|
+
this.boardId = boardId;
|
|
2160
|
+
}
|
|
2161
|
+
subscribe(handlers) {
|
|
2162
|
+
if (!this.websocketClient) throw new Error("realtime transport is not configured for this client");
|
|
2163
|
+
ensureRealtimeConnected(this.websocketClient);
|
|
2164
|
+
const releaseRoom = this.websocketClient.retainRooms([getRealtimeSpaceRoom(this.spaceId), getRealtimeBoardRoom(this.boardId)]);
|
|
2165
|
+
const unsubscribe = this.websocketClient.on("event", (event) => {
|
|
2166
|
+
if (event.spaceId !== this.spaceId) return;
|
|
2167
|
+
if (event.type === "board.transaction.applied" && event.payload.boardId === this.boardId) {
|
|
2168
|
+
const transactionEvent = event;
|
|
2169
|
+
handlers.event?.(transactionEvent);
|
|
2170
|
+
handlers.transaction?.(transactionEvent);
|
|
2171
|
+
}
|
|
2172
|
+
if (event.type === "board.awareness.updated" && event.payload.boardId === this.boardId) {
|
|
2173
|
+
const awarenessEvent = event;
|
|
2174
|
+
if (awarenessEvent.payload.connectionId !== this.websocketClient?.connectionId) {
|
|
2175
|
+
handlers.event?.(awarenessEvent);
|
|
2176
|
+
handlers.awareness?.(awarenessEvent);
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
if (event.type === "board.playback.changed" && event.payload.boardId === this.boardId) {
|
|
2180
|
+
const playbackEvent = event;
|
|
2181
|
+
handlers.event?.(playbackEvent);
|
|
2182
|
+
handlers.playback?.(playbackEvent);
|
|
2183
|
+
}
|
|
2184
|
+
});
|
|
2185
|
+
return () => {
|
|
2186
|
+
unsubscribe();
|
|
2187
|
+
releaseRoom();
|
|
2188
|
+
};
|
|
2189
|
+
}
|
|
2190
|
+
on(type, handler) {
|
|
2191
|
+
if (type === "transaction") return this.subscribe({ transaction: handler });
|
|
2192
|
+
if (type === "awareness") return this.subscribe({ awareness: handler });
|
|
2193
|
+
return this.subscribe({ playback: handler });
|
|
2194
|
+
}
|
|
2195
|
+
};
|
|
2196
|
+
var BoardClient = class {
|
|
2197
|
+
spaceId;
|
|
2198
|
+
id;
|
|
2199
|
+
websocketClient;
|
|
2200
|
+
realtime;
|
|
2201
|
+
boards;
|
|
2202
|
+
constructor(spaceId, id, transport, websocketClient) {
|
|
2203
|
+
this.spaceId = spaceId;
|
|
2204
|
+
this.id = id;
|
|
2205
|
+
this.websocketClient = websocketClient;
|
|
2206
|
+
this.boards = new SpaceBoardsApi(transport, spaceId, websocketClient);
|
|
2207
|
+
this.realtime = new BoardRealtimeClient(websocketClient, spaceId, id);
|
|
2208
|
+
}
|
|
2209
|
+
inspect(input = {}, customFetch) {
|
|
2210
|
+
return this.boards.inspect(this.id, input, customFetch);
|
|
2211
|
+
}
|
|
2212
|
+
capabilities(customFetch) {
|
|
2213
|
+
return this.boards.capabilities(this.id, customFetch);
|
|
2214
|
+
}
|
|
2215
|
+
validate(transaction) {
|
|
2216
|
+
return this.boards.validate({
|
|
2217
|
+
...transaction,
|
|
2218
|
+
boardId: this.id
|
|
2219
|
+
});
|
|
2220
|
+
}
|
|
2221
|
+
apply(transaction) {
|
|
2222
|
+
return this.boards.apply({
|
|
2223
|
+
...transaction,
|
|
2224
|
+
boardId: this.id
|
|
2225
|
+
});
|
|
2226
|
+
}
|
|
2227
|
+
updateAwareness(seq, update) {
|
|
2228
|
+
if (!this.websocketClient) return Promise.resolve();
|
|
2229
|
+
return this.websocketClient.updateBoardAwareness({
|
|
2230
|
+
spaceId: this.spaceId,
|
|
2231
|
+
boardId: this.id,
|
|
2232
|
+
seq,
|
|
2233
|
+
update
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
playback(command) {
|
|
2237
|
+
return this.boards.playback(this.id, command);
|
|
2238
|
+
}
|
|
2239
|
+
play(command) {
|
|
2240
|
+
return this.boards.play(this.id, command);
|
|
2241
|
+
}
|
|
2242
|
+
pause(command) {
|
|
2243
|
+
return this.boards.pause(this.id, command);
|
|
2244
|
+
}
|
|
2245
|
+
seek(command) {
|
|
2246
|
+
return this.boards.seek(this.id, command);
|
|
2247
|
+
}
|
|
2248
|
+
stop(command) {
|
|
2249
|
+
return this.boards.stop(this.id, command);
|
|
2250
|
+
}
|
|
2251
|
+
subscribe(handlers) {
|
|
2252
|
+
return this.realtime.subscribe(handlers);
|
|
2253
|
+
}
|
|
2254
|
+
on(type, handler) {
|
|
2255
|
+
if (type === "transaction") return this.realtime.on("transaction", handler);
|
|
2256
|
+
if (type === "awareness") return this.realtime.on("awareness", handler);
|
|
2257
|
+
return this.realtime.on("playback", handler);
|
|
2258
|
+
}
|
|
2259
|
+
};
|
|
2260
|
+
var SpaceBoardsApi = class {
|
|
2152
2261
|
transport;
|
|
2153
2262
|
spaceId;
|
|
2154
|
-
|
|
2263
|
+
websocketClient;
|
|
2264
|
+
constructor(transport, spaceId, websocketClient) {
|
|
2155
2265
|
this.transport = transport;
|
|
2156
2266
|
this.spaceId = spaceId;
|
|
2267
|
+
this.websocketClient = websocketClient;
|
|
2268
|
+
}
|
|
2269
|
+
byId(boardId) {
|
|
2270
|
+
return new BoardClient(this.spaceId, boardId, this.transport, this.websocketClient);
|
|
2157
2271
|
}
|
|
2158
2272
|
create(input) {
|
|
2159
|
-
return this.transport.request(`/api/spaces/${this.spaceId}/
|
|
2273
|
+
return this.transport.request(`/api/spaces/${this.spaceId}/boards`, {
|
|
2160
2274
|
method: "POST",
|
|
2161
2275
|
headers: { "Content-Type": "application/json" },
|
|
2162
2276
|
body: JSON.stringify(input)
|
|
2163
2277
|
});
|
|
2164
2278
|
}
|
|
2165
|
-
|
|
2166
|
-
const params = new URLSearchParams(
|
|
2167
|
-
|
|
2279
|
+
inspect(boardId, input = {}, customFetch) {
|
|
2280
|
+
const params = new URLSearchParams();
|
|
2281
|
+
for (const section of input.include ?? []) params.append("include", section);
|
|
2282
|
+
if (input.viewport) params.set("viewport", JSON.stringify(input.viewport));
|
|
2283
|
+
const query = params.toString();
|
|
2284
|
+
return this.transport.request(`/api/spaces/${this.spaceId}/boards/${boardId}${query ? `?${query}` : ""}`, { fetch: customFetch });
|
|
2168
2285
|
}
|
|
2169
|
-
|
|
2170
|
-
return this.transport.request(`/api/spaces/${this.spaceId}/
|
|
2286
|
+
capabilities(boardId, customFetch) {
|
|
2287
|
+
return this.transport.request(`/api/spaces/${this.spaceId}/boards/${boardId}/capabilities`, { fetch: customFetch });
|
|
2171
2288
|
}
|
|
2172
|
-
|
|
2173
|
-
return this.transport.request(`/api/spaces/${this.spaceId}/
|
|
2289
|
+
validate(transaction) {
|
|
2290
|
+
return this.transport.request(`/api/spaces/${this.spaceId}/boards/${transaction.boardId}/validate`, {
|
|
2174
2291
|
method: "POST",
|
|
2175
2292
|
headers: { "Content-Type": "application/json" },
|
|
2176
|
-
body: JSON.stringify(
|
|
2293
|
+
body: JSON.stringify(transaction)
|
|
2177
2294
|
});
|
|
2178
2295
|
}
|
|
2296
|
+
async apply(transaction) {
|
|
2297
|
+
try {
|
|
2298
|
+
return await this.transport.request(`/api/spaces/${this.spaceId}/boards/${transaction.boardId}/transactions`, {
|
|
2299
|
+
method: "POST",
|
|
2300
|
+
headers: { "Content-Type": "application/json" },
|
|
2301
|
+
body: JSON.stringify(transaction)
|
|
2302
|
+
});
|
|
2303
|
+
} catch (cause) {
|
|
2304
|
+
if (cause instanceof HttpError) throw new BoardTransactionError(cause.message, cause.status, cause.code ?? void 0, cause.body, { cause });
|
|
2305
|
+
throw cause;
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
playback(boardId, command) {
|
|
2309
|
+
return this.transport.request(`/api/spaces/${this.spaceId}/boards/${boardId}/playback`, {
|
|
2310
|
+
method: "POST",
|
|
2311
|
+
headers: { "Content-Type": "application/json" },
|
|
2312
|
+
body: JSON.stringify(command)
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
play(boardId, command) {
|
|
2316
|
+
return this.playback(boardId, command);
|
|
2317
|
+
}
|
|
2318
|
+
pause(boardId, command) {
|
|
2319
|
+
return this.playback(boardId, command);
|
|
2320
|
+
}
|
|
2321
|
+
seek(boardId, command) {
|
|
2322
|
+
return this.playback(boardId, command);
|
|
2323
|
+
}
|
|
2324
|
+
stop(boardId, command) {
|
|
2325
|
+
return this.playback(boardId, command);
|
|
2326
|
+
}
|
|
2179
2327
|
};
|
|
2180
2328
|
var SpaceCheckpointFilesApi = class {
|
|
2181
2329
|
transport;
|
|
@@ -2313,7 +2461,7 @@ var SpaceClient = class {
|
|
|
2313
2461
|
sandbox;
|
|
2314
2462
|
invitations;
|
|
2315
2463
|
labels;
|
|
2316
|
-
|
|
2464
|
+
boards;
|
|
2317
2465
|
commerce;
|
|
2318
2466
|
constructor(id, transport, websocketClient) {
|
|
2319
2467
|
this.id = id;
|
|
@@ -2332,12 +2480,15 @@ var SpaceClient = class {
|
|
|
2332
2480
|
this.sandbox = new SpaceSandboxApi(transport, id);
|
|
2333
2481
|
this.invitations = new SpaceInvitationsApi(transport, id);
|
|
2334
2482
|
this.labels = new SpaceLabelsApi(transport, id);
|
|
2335
|
-
this.
|
|
2483
|
+
this.boards = new SpaceBoardsApi(transport, id, websocketClient);
|
|
2336
2484
|
this.commerce = new SpaceCommerceApi(transport, id);
|
|
2337
2485
|
}
|
|
2338
2486
|
get(customFetch) {
|
|
2339
2487
|
return this.transport.request(`/api/spaces/${this.id}`, { fetch: customFetch });
|
|
2340
2488
|
}
|
|
2489
|
+
getStartup(customFetch) {
|
|
2490
|
+
return this.transport.request(`/api/spaces/${this.id}/startup`, { fetch: customFetch });
|
|
2491
|
+
}
|
|
2341
2492
|
prompt(input) {
|
|
2342
2493
|
return this.transport.request(`/api/spaces/${this.id}/prompt`, {
|
|
2343
2494
|
method: "POST",
|
|
@@ -2471,46 +2622,6 @@ var SpaceClient = class {
|
|
|
2471
2622
|
rename(name) {
|
|
2472
2623
|
return this.update({ name });
|
|
2473
2624
|
}
|
|
2474
|
-
async sendCanvasTransactionRealtime(documentId, input) {
|
|
2475
|
-
if (!this.websocketClient) return this.canvas.sendTransaction(documentId, input);
|
|
2476
|
-
const requestId = `canvas-${input.txId}`;
|
|
2477
|
-
const result = new Promise((resolve, reject) => {
|
|
2478
|
-
let settled = false;
|
|
2479
|
-
let timeout = null;
|
|
2480
|
-
const settle = (fn) => {
|
|
2481
|
-
if (settled) return;
|
|
2482
|
-
settled = true;
|
|
2483
|
-
if (timeout) clearTimeout(timeout);
|
|
2484
|
-
cleanupAck?.();
|
|
2485
|
-
cleanupError?.();
|
|
2486
|
-
fn();
|
|
2487
|
-
};
|
|
2488
|
-
const cleanupAck = this.websocketClient?.on("event", (event) => {
|
|
2489
|
-
if (event.type !== "canvas.tx.ack" || event.requestId !== requestId) return;
|
|
2490
|
-
const version = event.payload.version;
|
|
2491
|
-
settle(() => {
|
|
2492
|
-
if (typeof version === "number") resolve({ document: { version } });
|
|
2493
|
-
else reject(/* @__PURE__ */ new Error("Invalid canvas ack"));
|
|
2494
|
-
});
|
|
2495
|
-
});
|
|
2496
|
-
const cleanupError = this.websocketClient?.on("event", (event) => {
|
|
2497
|
-
if (event.type !== "canvas.tx.error" || event.requestId !== requestId) return;
|
|
2498
|
-
settle(() => reject(new CanvasTransactionError(typeof event.payload.message === "string" ? event.payload.message : "Canvas sync failed", typeof event.payload.status === "number" ? event.payload.status : void 0, typeof event.payload.code === "string" ? event.payload.code : void 0)));
|
|
2499
|
-
});
|
|
2500
|
-
timeout = setTimeout(() => settle(() => reject(/* @__PURE__ */ new Error("Canvas sync timed out"))), 15e3);
|
|
2501
|
-
});
|
|
2502
|
-
await this.websocketClient.sendCanvasTransaction({
|
|
2503
|
-
spaceId: this.id,
|
|
2504
|
-
documentId,
|
|
2505
|
-
txId: input.txId,
|
|
2506
|
-
baseVersion: input.baseVersion ?? null,
|
|
2507
|
-
clientId: input.clientId ?? null,
|
|
2508
|
-
undoGroupId: input.undoGroupId ?? null,
|
|
2509
|
-
ops: input.ops,
|
|
2510
|
-
requestId
|
|
2511
|
-
});
|
|
2512
|
-
return result;
|
|
2513
|
-
}
|
|
2514
2625
|
profile(body) {
|
|
2515
2626
|
return this.transport.request(`/api/spaces/${this.id}/profile`, {
|
|
2516
2627
|
method: "PATCH",
|
|
@@ -2538,6 +2649,9 @@ var SpaceClient = class {
|
|
|
2538
2649
|
session(sessionId) {
|
|
2539
2650
|
return new SessionClient(this.id, sessionId, this.transport, this.websocketClient);
|
|
2540
2651
|
}
|
|
2652
|
+
board(boardId) {
|
|
2653
|
+
return new BoardClient(this.id, boardId, this.transport, this.websocketClient);
|
|
2654
|
+
}
|
|
2541
2655
|
updatePresence(meta) {
|
|
2542
2656
|
if (!this.websocketClient) return Promise.resolve();
|
|
2543
2657
|
return this.websocketClient.updatePresence({
|
|
@@ -2582,11 +2696,13 @@ var UserApi = class {
|
|
|
2582
2696
|
transportBaseUrl;
|
|
2583
2697
|
setStoredAuthToken;
|
|
2584
2698
|
clearStoredAuthToken;
|
|
2699
|
+
labels;
|
|
2585
2700
|
constructor(transport, transportBaseUrl, setStoredAuthToken, clearStoredAuthToken) {
|
|
2586
2701
|
this.transport = transport;
|
|
2587
2702
|
this.transportBaseUrl = transportBaseUrl;
|
|
2588
2703
|
this.setStoredAuthToken = setStoredAuthToken;
|
|
2589
2704
|
this.clearStoredAuthToken = clearStoredAuthToken;
|
|
2705
|
+
this.labels = new UserLabelsApi(transport);
|
|
2590
2706
|
}
|
|
2591
2707
|
getMe(options) {
|
|
2592
2708
|
const init = typeof options === "function" ? { fetch: options } : options;
|
|
@@ -2636,6 +2752,25 @@ var UserApi = class {
|
|
|
2636
2752
|
return null;
|
|
2637
2753
|
}
|
|
2638
2754
|
};
|
|
2755
|
+
/** User-scoped labels — same label/assignment model as space labels, but private to the viewer. */
|
|
2756
|
+
var UserLabelsApi = class {
|
|
2757
|
+
transport;
|
|
2758
|
+
constructor(transport) {
|
|
2759
|
+
this.transport = transport;
|
|
2760
|
+
}
|
|
2761
|
+
getResourceLabels(resourceType, resourceRef) {
|
|
2762
|
+
const params = new URLSearchParams({ resourceRef });
|
|
2763
|
+
return this.transport.request(`/api/me/resources/${resourceType}/labels?${params.toString()}`);
|
|
2764
|
+
}
|
|
2765
|
+
patchResourceLabels(resourceType, resourceRef, input) {
|
|
2766
|
+
const params = new URLSearchParams({ resourceRef });
|
|
2767
|
+
return this.transport.request(`/api/me/resources/${resourceType}/labels?${params.toString()}`, {
|
|
2768
|
+
method: "PATCH",
|
|
2769
|
+
headers: { "Content-Type": "application/json" },
|
|
2770
|
+
body: JSON.stringify(input)
|
|
2771
|
+
});
|
|
2772
|
+
}
|
|
2773
|
+
};
|
|
2639
2774
|
//#endregion
|
|
2640
2775
|
//#region src/apis/users.ts
|
|
2641
2776
|
const MAX_BATCH_USER_PROFILES = 100;
|
|
@@ -2822,4 +2957,4 @@ var CohubHttpClient = class {
|
|
|
2822
2957
|
};
|
|
2823
2958
|
const createHttpClient = (options) => new CohubHttpClient(options);
|
|
2824
2959
|
//#endregion
|
|
2825
|
-
export {
|
|
2960
|
+
export { PublicAssetsApi as C, GenerationsApi as D, ModelsApi as E, CronJobsApi as O, SearchApi as S, PromptsApi as T, SessionPatchReducer as _, ReferralsApi as a, SessionAccessApi as b, TasksApi as c, SpaceClient as d, SpacesApi as f, parseAssistantMessageCommit as g, createSessionGenerationStreamClient as h, WorksApi as i, ChannelsApi as k, BoardClient as l, SessionGenerationStreamClient as m, createHttpClient as n, UsersApi as o, PublicInviteApi as p, WorkCommerceApi as r, UserApi as s, CohubHttpClient as t, BoardTransactionError as u, createSessionPatchReducer as v, SkillsApi as w, ReferencesApi as x, ensureRealtimeConnected as y };
|
package/dist/chunks/transport.js
CHANGED
|
@@ -2,7 +2,9 @@ import { a as resolveApiBaseUrl } from "./environment.js";
|
|
|
2
2
|
//#region ../protocol/dist/realtime/types.js
|
|
3
3
|
const WS_COMPACT_STREAM_CAPABILITY = "session.compact_stream.v1";
|
|
4
4
|
const WS_ROOM_SUBSCRIPTION_CAPABILITY = "realtime.rooms.v1";
|
|
5
|
+
const WS_BOARD_AWARENESS_CAPABILITY = "board.awareness.v1";
|
|
5
6
|
const getRealtimeSpaceRoom = (spaceId) => `space:${spaceId}`;
|
|
7
|
+
const getRealtimeBoardRoom = (boardId) => `board:${boardId}`;
|
|
6
8
|
const parseRealtimeRoom = (room) => {
|
|
7
9
|
const trimmed = room.trim();
|
|
8
10
|
const separatorIndex = trimmed.indexOf(":");
|
|
@@ -10,7 +12,7 @@ const parseRealtimeRoom = (room) => {
|
|
|
10
12
|
const kind = trimmed.slice(0, separatorIndex);
|
|
11
13
|
const id = trimmed.slice(separatorIndex + 1).trim();
|
|
12
14
|
if (!id) return null;
|
|
13
|
-
if (kind !== "space" && kind !== "user") return null;
|
|
15
|
+
if (kind !== "space" && kind !== "user" && kind !== "board") return null;
|
|
14
16
|
return {
|
|
15
17
|
kind,
|
|
16
18
|
id
|
|
@@ -302,4 +304,4 @@ var HttpTransport = class {
|
|
|
302
304
|
}
|
|
303
305
|
};
|
|
304
306
|
//#endregion
|
|
305
|
-
export {
|
|
307
|
+
export { normalizeRealtimeRooms as C, getSessionTurnPatchStreamKey as S, WS_BOARD_AWARENESS_CAPABILITY as _, COHUB_SOURCE_HEADER as a, getRealtimeBoardRoom as b, hasRequestSourceIdentity as c, mergeRequestSourceIntoMeta as d, normalizeRequestSource as f, resolveRequestSourceChannel as g, requestSourceToHeaders as h, sanitizeAccessToken as i, isRequestSourceEmpty as l, readRequestSourceFromEnv as m, HttpTransport as n, COHUB_SOURCE_HEADER_NAMES as o, parseRequestSourceFromHeaders as p, joinApiUrl as r, REQUEST_SOURCE_VIA_MAX_LENGTH as s, HttpError as t, isRequestSourceUuid as u, WS_COMPACT_STREAM_CAPABILITY as v, getRealtimeSpaceRoom as x, WS_ROOM_SUBSCRIPTION_CAPABILITY as y };
|