Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 2x 2x 2x 3x 3x 12x 12x 12x 12x | // A basic collection of entities // This may be extended to house a collection of objects that all follow a common schema. // It should enable operations like removing a property removes the value from the entities in the collection // It could then be further extended with e.g. table semantics like filter, sort, join import {Collection} from './collection-abstract'; import {LastWriteWins, ResolvedViewOne} from './last-write-wins'; export class BasicCollection extends Collection<LastWriteWins> { lossy?: LastWriteWins; initializeView() { Iif (!this.rhizomeNode) throw new Error('not connected to rhizome'); this.lossy = new LastWriteWins(this.rhizomeNode.lossless); } resolve( id: string ): ResolvedViewOne | undefined { Iif (!this.rhizomeNode) throw new Error('collection not connected to rhizome'); Iif (!this.lossy) throw new Error('lossy view not initialized'); const res = this.lossy.resolve([id]) || {}; return res[id]; } } |