(
id: string,
source: ReturnType<typeof createSyncCollection<any>>[`collection`],
extraFields?: (d: any) => Record<string, unknown>,
)
| 6335 | type RawItem = { key: string; _seq: number; [k: string]: unknown } |
| 6336 | |
| 6337 | function createDerivedCollection( |
| 6338 | id: string, |
| 6339 | source: ReturnType<typeof createSyncCollection<any>>[`collection`], |
| 6340 | extraFields?: (d: any) => Record<string, unknown>, |
| 6341 | ) { |
| 6342 | return createLiveQueryCollection({ |
| 6343 | id: `${id}:derived`, |
| 6344 | query: (q: any) => |
| 6345 | q.from({ d: source }).select(({ d }: any) => ({ |
| 6346 | timelineKey: TIMELINE_KEY, |
| 6347 | key: d.key, |
| 6348 | order: coalesce(d._seq, -1), |
| 6349 | ...(extraFields ? extraFields(d) : {}), |
| 6350 | })), |
| 6351 | }) |
| 6352 | } |
| 6353 | |
| 6354 | it(`second insert propagates with 5 sibling chained toArray includes`, async () => { |
| 6355 | const runs = createSyncCollection<RawItem>(`raw-runs`, (r) => r.key) |
no test coverage detected