( db: T, prefix: string )
| 20 | }; |
| 21 | |
| 22 | export const addPrefixToDocs = <T extends SerializedOramaDb>( |
| 23 | db: T, |
| 24 | prefix: string |
| 25 | ): T => { |
| 26 | const prefixedDocs: Record<string, OramaDoc> = {}; |
| 27 | |
| 28 | for (const [id, doc] of Object.entries(db.docs.docs)) { |
| 29 | prefixedDocs[id] = { ...doc, href: `${prefix}${doc.href}` }; |
| 30 | } |
| 31 | |
| 32 | return { |
| 33 | ...db, |
| 34 | docs: { ...db.docs, docs: prefixedDocs }, |
| 35 | }; |
| 36 | }; |
| 37 | |
| 38 | const loadOrama = async (db: AnyOrama): Promise<void> => { |
| 39 | const indexes = await Promise.all( |