feature: the beginnings of chat working

This commit is contained in:
Andy Burke 2025-07-01 15:37:35 -07:00
parent 85024c6e62
commit 649ff432bb
24 changed files with 1555 additions and 918 deletions

View file

@ -1,6 +1,6 @@
import { by_character, by_lurid } from '@andyburke/fsdb/organizers';
import { by_character, by_lurid } from 'jsr:@andyburke/fsdb/organizers';
import { FSDB_COLLECTION } from 'jsr:@andyburke/fsdb';
import { FSDB_INDEXER_SYMLINKS } from '@andyburke/fsdb/indexers';
import { FSDB_INDEXER_SYMLINKS } from 'jsr:@andyburke/fsdb/indexers';
/**
* @typedef {object} TIMESTAMPS
@ -34,7 +34,7 @@ export type EVENT = {
export const EVENTS = new FSDB_COLLECTION<EVENT>({
name: 'events',
id_field: 'id',
organize: (combined_id) => {
organize: (combined_id: string) => {
const [room_id, event_id] = combined_id.split(':', 2);
return ['rooms', room_id, event_id.substring(0, 14), `${event_id}.json`];
},
@ -42,14 +42,16 @@ export const EVENTS = new FSDB_COLLECTION<EVENT>({
creator_id: new FSDB_INDEXER_SYMLINKS<EVENT>({
name: 'creator_id',
field: 'creator_id',
to_many: true,
organize: by_lurid
}),
tags: new FSDB_INDEXER_SYMLINKS<EVENT>({
name: 'tags',
get_values_to_index: (event): string[] => {
return (event.tags ?? []).map((tag) => tag.toLowerCase());
get_values_to_index: (event: EVENT): string[] => {
return (event.tags ?? []).map((tag: string) => tag.toLowerCase());
},
to_many: true,
organize: by_character
})
}