protected setAllItems()

in lib/api/repository/readonly-repository.ts [113:133]


	protected setAllItems(): Observable<Array<TEntity>> {
		if (this._allValues)
			return of(this._allValues);

		if (this._allItemsBeingSet$)
			return this._allItemsBeingSet$;

		this._allItemsBeingSet$ = this.query().pipe(
			take(1),
			tap((dataSet: DataSet<TEntity>) => {
				this._allValues = dataSet.items;
				this._allValuesMap = new Map();
				this._allValues.forEach((value: TEntity) => this._allValuesMap.set(String(value instanceof EntityModelBase ? value.id : value.toString()), value));
			}),
			map((dataSet:DataSet<TEntity>) => dataSet.items),
			shareReplay({refCount: true}),
			finalize(() => this._allItemsBeingSet$ = null)
		);

		return this._allItemsBeingSet$;
	}