View

source

Constructors

new View<T extends Model<string, T> = Model<string>>(context: Context, query: Query, isRootInContext: boolean = false): Viewsource

Properties

alreadyDisposed: booleansource

readonlybaseModel: ModelType<T>source

readonlycompareRecordsByPrimaryKey: SortPredicateFnsource

Compares two records of the view according to their primary keys.

readonlycompareRecordsBySortOrder: SortPredicateFnsource

Compares two records of the view according to the chosen sort order.

eventSources: Set<ModelDispatcher>source

Model event dispatchers to which we have attached listeners.

filter: FilterPredicateFnsource

Returns true if the given record should be included in the view.

hasInnerJoins: booleansource

readonlyisRootInContext: booleansource

readonlymetadata: QueryReflectionMetadatasource

Reflection metadata for the schema of the composed query.

pendingReset: booleansource

Whether or not we need to rebuild the view the next time it is accessed.

permissionCheck: PermissionChecksource

The permission check predicates in use and the models upon which the checks depend. When there is a change in one of those dependent models, we will rebuild the checks: if the check predicates changed, then we'll rebuild the view.

readonlypostJoinFilterPredicates: FilterPredicate[]source

Filter predicates that require joins.

readonlypreJoinFilterPredicates: FilterPredicate[]source

Filter predicates that don't require joins.

readonlyquery: Querysource

readonlyrecordMap: Map<string, MaybeProxied<T>>source

Map of record ID to the record (or proxy for the record).

readonlyrecordProxyProvider: RecordProxyProvidersource

If joins are used, this is the provider that generates proxy objects for each record that intercept property accesses and perform the joins.

rows: MaybeProxied<T>[]source

Every record in the view in sorted order.

readonlyschema: Schemasource

readonlytransform: TransformFn<T, MaybeProxied<T>>source

When joins are used, returns a proxy that intercepts property accesses on the record. Where no joins are used, returns the original record.

readonlyuserId: Id<User>source

Methods

Static methods

staticgetPersistent<T extends Model<string, T>>(context: Context, query: Query, isRootInContext: boolean = false): Handlesource

staticgetTemporary<T extends Model<string, T> = Model<string>>(context: Context, query: Query, isRootInContext: boolean = false): Viewsource

Instance methods

[custom](): stringsource

[iterator](): IterableIterator<T>source

assertNotDisposed(): voidsource

attachEventListeners(): voidsource

build(): voidsource

consumeForeignModel(foreignRecord: Model<string>): voidsource

consumePass1<U extends Model<string, U>>(record: U): voidsource

consumePass2<U extends Model<string, U>>(record: U): voidsource

consumePrimaryModel(record: T): voidsource

dispose(): voidsource

find(predicates: FilterPredicate[]): undefined | Tsource

Find the first record in this view that matches the supplied predicates.

findOffsetOfRow(target: T): undefined | ViewOffsetsource

Given a row of the view, resolve it to its corresponding offset.

findRaw(predicateFn: FilterPredicateFn): undefined | Tsource

Find the first record in this view that matches the supplied predicate function.

forceBuild(): Viewsource

get(id: Id<T>): undefined | Tsource

getContext(): Contextsource

getCopyOfRows(): T[]source

getLength(): numbersource

getRowAtIndex(index: number | ViewOffset): undefined | Tsource

insert(row: T): voidsource

Insert a row into the view. Calculates the insertion index according to the sort order. Publishes a ViewUpdate with the new length of the view, and invokes the Page#consume method of each page.

isPendingReset(): booleansource

makeFilterFromPermissionCheckAndFilterPredicates(): FilterPredicateFnsource

map<U>(fn: TransformFn<T, U>): U[]source

maybeInvalidatePermissionCheck(receivedModel: ModelType<Model<string>>): booleansource

Recompute the permission check predicate if a model that is a dependency of the permission checks is updated. If the newly computed predicate differs to the current one, then the view needs to be rebuilt.

orderBy(predicates: SortPredicate[]): ServerQueryBuildersource

Create a new query that is a re-sorting of this view.

rebuildIfRequired(): voidsource

remove(updatedRow: T): voidsource

reset(rows: T[] = []): voidsource

resetFromRecordMap(): voidsource

slice(slice: Slice): T[]source

sliceCount(slice: Slice): numbersource

toString(): stringsource

update(newRow: T, oldRow: MaybeProxied<T>, offset: ViewOffset): voidsource

where(predicates: FilterPredicate[]): ServerQueryBuildersource

Create a query that is the application of a filter to this view.

Inherited methods

emit<K extends keyof ViewEventMap<T>>(event: K, args: Parameters<ViewEventMap<T>[K]>): Viewsource

inherited from Emitter.emit

off<K extends keyof ViewEventMap<T>>(event: K, callback: ViewEventMap<T>[K]): Viewsource

inherited from Emitter.off

offAll(callback: CatchAllCallback<ViewEventMap<T>>): Viewsource

inherited from Emitter.offAll

on<K extends keyof ViewEventMap<T>>(event: K, callback: ViewEventMap<T>[K], __namedParameters: Object = {}): Viewsource

inherited from Emitter.on

onAll(callback: CatchAllCallback<ViewEventMap<T>>, __namedParameters: Object = {}): Viewsource

inherited from Emitter.onAll

removeAllListeners(): Viewsource

inherited from Emitter.removeAllListeners

removeAllListenersForOwner(targetOwner: object): Viewsource

inherited from Emitter.removeAllListenersForOwner