MCPcopy Create free account
hub / github.com/instantdb/instant / roomDefToCodeStr

Function roomDefToCodeStr

client/packages/platform/src/schema.ts:329–348  ·  view source on GitHub ↗
(room: RoomsDef[string])

Source from the content-addressed store, hash-verified

327}
328
329function roomDefToCodeStr(room: RoomsDef[string]) {
330 let ret = '{';
331
332 if (room.presence) {
333 ret += `\n${indentLines(entityDefToCodeStr('presence', room.presence), 4)},`;
334 }
335
336 if (room.topics) {
337 ret += `\n "topics": {`;
338
339 for (const [topicName, topicConfig] of Object.entries(room.topics)) {
340 ret += `\n${indentLines(entityDefToCodeStr(topicName, topicConfig), 6)},`;
341 }
342 ret += `\n }`;
343 }
344
345 ret += ret === '{' ? '}' : '\n }';
346
347 return ret;
348}
349
350function roomsCodeStr(rooms: RoomsDef) {
351 let ret = '{';

Callers 1

roomsCodeStrFunction · 0.85

Calls 2

indentLinesFunction · 0.90
entityDefToCodeStrFunction · 0.85

Tested by

no test coverage detected