Skip to main content

Class: CollectionService<T, M, S>

Type parameters

NameType
Tany
Mextends ItemMetaItemMeta
Sextends CollectionState<T, M>CollectionState<T, M>

Hierarchy

Implements

Constructors

constructor

new CollectionService<T, M, S>()

Type parameters

NameType
Tany
Mextends ItemMetaItemMeta
Sextends CollectionState<T, M, S>CollectionState<T, M>

Inherited from

DefaultService.constructor

Properties

[combinedReducers]

[combinedReducers]: (state: any, action: any) => any

Type declaration

▸ (state, action): any

Parameters
NameType
stateany
actionany
Returns

any

Inherited from

DefaultService.[combinedReducers]

Defined in

onekijs/packages/onekijs-framework/src/core/Service.ts:63


[dispatch]

[dispatch]: any

Inherited from

DefaultService.[dispatch]

Defined in

onekijs/packages/onekijs-framework/src/core/Service.ts:62


[inReducer]

[inReducer]: boolean

Inherited from

DefaultService.[inReducer]

Defined in

onekijs/packages/onekijs-framework/src/core/Service.ts:64


[reducers]

[reducers]: any

Inherited from

DefaultService.[reducers]

Defined in

onekijs/packages/onekijs-framework/src/core/Service.ts:59


[sagas]

[sagas]: any

Inherited from

DefaultService.[sagas]

Defined in

onekijs/packages/onekijs-framework/src/core/Service.ts:61


[types]

[types]: any

Inherited from

DefaultService.[types]

Defined in

onekijs/packages/onekijs-framework/src/core/Service.ts:60


cache

Protected cache: AnonymousObject<any> = {}

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:71


initialState

Protected initialState: S

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:68


itemMeta

Protected itemMeta: AnonymousObject<undefined | M> = {}

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:72


state

state: S

Inherited from

DefaultService.state

Defined in

onekijs/packages/onekijs-framework/src/core/Service.ts:66

Accessors

data

get data(): undefined | (undefined | T)[]

Returns

undefined | (undefined | T)[]

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:217


hasMore

get hasMore(): boolean

Returns

boolean

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:225


items

get items(): undefined | (undefined | Item<T, M>)[]

Returns

undefined | (undefined | Item<T, M>)[]

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:229


status

get status(): CollectionStatus

Returns

CollectionStatus

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:233


total

get total(): undefined | number

Returns

undefined | number

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:238


url

get url(): string

Returns

string

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:242

Methods

[create]

[create](initialState): void

Parameters

NameType
initialStateS

Returns

void

Inherited from

DefaultService.[create]

Defined in

onekijs/packages/onekijs-framework/src/core/Service.ts:69


[run]

[run](): void

Returns

void

Inherited from

DefaultService.[run]

Defined in

onekijs/packages/onekijs-framework/src/core/Service.ts:208


[stop]

[stop](): void

Returns

void

Inherited from

DefaultService.[stop]

Defined in

onekijs/packages/onekijs-framework/src/core/Service.ts:226


_adapt

Protected _adapt(data): Item<T, M>

Parameters

NameType
dataundefined | T

Returns

Item<T, M>

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:513


_addFilter

Protected _addFilter(query, filterOrCriteria, parentFilterId?): void

Parameters

NameType
queryQuery
filterOrCriteriaQueryFilterOrCriteria
parentFilterIdQueryFilterId

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:517


_addSortBy

Protected _addSortBy(query, sortBy, prepend?): void

Parameters

NameTypeDefault value
queryQueryundefined
sortByQuerySortByundefined
prependbooleantrue

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:541


_applyCriteria

Protected _applyCriteria(item, criteria): boolean

Parameters

NameType
itemItem<T, M>
criteriaQueryFilterCriteria

Returns

boolean

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:552


_applyFields

Protected _applyFields(items, fields?): Item<T, M>[]

Parameters

NameType
itemsItem<T, M>[]
fields?string[]

Returns

Item<T, M>[]

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:561


_applyFilter

Protected _applyFilter(item, filter?): boolean

Parameters

NameType
itemItem<T, M>
filter?QueryFilter

Returns

boolean

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:578


_applyOperator

Protected _applyOperator(operator, left, right?): boolean

Parameters

NameType
operatorQueryFilterCriteriaOperator
leftany
right?QueryFilterCriteriaValue | QueryFilterCriteriaValue[]

Returns

boolean

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:597


_applySearch

Protected _applySearch(item, search?): boolean

Parameters

NameType
itemItem<T, M>
search?QueryFilterCriteriaValue

Returns

boolean

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:629


_applySort

Protected _applySort(items, dir, comparator): Item<T, M>[]

Parameters

NameType
itemsItem<T, M>[]
dirQuerySortDir
comparatorQuerySortComparator

Returns

Item<T, M>[]

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:640


_applySortBy

Protected _applySortBy(items, sortBy, comparators): Item<T, M>[]

Parameters

NameType
itemsItem<T, M>[]
sortByQuerySortBy[]
comparatorsAnonymousObject<QuerySortComparator>

Returns

Item<T, M>[]

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:652


_clearFields

Protected _clearFields(query): void

Parameters

NameType
queryQuery

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:700


_clearFilter

Protected _clearFilter(query): void

Parameters

NameType
queryQuery

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:704


_clearLimit

Protected _clearLimit(query): void

Parameters

NameType
queryQuery

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:727


_clearOffset

Protected _clearOffset(query): void

Parameters

NameType
queryQuery

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:708


_clearParam

Protected _clearParam(query, key): void

Parameters

NameType
queryQuery
keystring

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:712


_clearParams

Protected _clearParams(query): void

Parameters

NameType
queryQuery

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:718


_clearSearch

Protected _clearSearch(query): void

Parameters

NameType
queryQuery

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:722


_clearSort

Protected _clearSort(query): void

Parameters

NameType
queryQuery

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:737


_clearSortBy

Protected _clearSortBy(query): void

Parameters

NameType
queryQuery

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:732


_delayLoading

Protected _delayLoading(delay_ms, limit?, offset?, resetData?): Generator<void | CallEffect<true>, void, unknown>

Parameters

NameType
delay_msnumber
limit?string | number
offset?string | number
resetData?boolean

Returns

Generator<void | CallEffect<true>, void, unknown>

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:742


_execute

Protected _execute(items, query, comparator, comparators): Item<T, M>[]

Parameters

NameType
itemsItem<T, M>[]
queryLocalQuery
comparatorQuerySortComparator
comparatorsAnonymousObject<QuerySortComparator>

Returns

Item<T, M>[]

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:759


_fetch

Protected _fetch(query, resetData): Generator<void | ForkEffect<Generator<void | CallEffect<true>, void, unknown>> | CancelEffect | Promise<CollectionFetcherResult<T>>, void, Task & T[] & Task & AnonymousObject<any>>

Parameters

NameType
queryQuery
resetDataboolean

Returns

Generator<void | ForkEffect<Generator<void | CallEffect<true>, void, unknown>> | CancelEffect | Promise<CollectionFetcherResult<T>>, void, Task & T[] & Task & AnonymousObject<any>>

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:792


_fetchError

Protected _fetchError(e): void

Parameters

NameType
eany

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:849


_fetchSuccess

Protected _fetchSuccess(result, resetData, query): void

Parameters

NameType
resultCollectionFetcherResult<T>
resetDataboolean
queryQuery

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:855


_getId

Protected _getId(data): undefined | string

Parameters

NameType
dataT

Returns

undefined | string

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:949


_onLocationChange

Protected _onLocationChange(location): void

Parameters

NameType
locationLocation

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:954


_parseLocation

Protected _parseLocation(location): Query

Parameters

NameType
locationLocation

Returns

Query

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:987


_removeFilter

Protected _removeFilter(query, filterId): void

Parameters

NameType
queryQuery
filterIdQueryFilterId

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:991


_removeSortBy

Protected _removeSortBy(query, sort): void

Parameters

NameType
queryQuery
sortQuerySortBy

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1007


_removeSortById

Protected _removeSortById(query, id): void

Parameters

NameType
queryQuery
idstring

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1014


_setFields

Protected _setFields(query, fields): void

Parameters

NameType
queryQuery
fieldsstring[]

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1021


_setFilter

Protected _setFilter(query, filter): void

Parameters

NameType
queryQuery
filterQueryFilter | QueryFilterCriteria | QueryFilterOrCriteria[]

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1025


_setItems

Protected _setItems(items): void

Parameters

NameType
items(undefined | Item<T, M>)[]

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1029


_setLimit

Protected _setLimit(query, limit): void

Parameters

NameType
queryQuery
limitnumber

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1033


_setLimitOffset

Protected _setLimitOffset(query, limit?, offset?): void

Parameters

NameType
queryQuery
limit?number
offset?number

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1037


_setLoading

Protected _setLoading(options?): void

Parameters

NameType
optionsObject
options.limit?number
options.offset?number
options.resetData?boolean
options.resetLimit?boolean
options.status?LoadingItemStatus

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1043


_setOffset

Protected _setOffset(query, offset): void

Parameters

NameType
queryQuery
offsetnumber

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1136


_setParams

Protected _setParams(query, params): void

Parameters

NameType
queryQuery
paramsAnonymousObject<any>

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1140


_setQuery

Protected _setQuery(query, force?): void

Parameters

NameTypeDefault value
queryQueryundefined
forcebooleantrue

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1123


_setSearch

Protected _setSearch(query, search): void

Parameters

NameType
queryQuery
searchPrimitive

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1144


_setSort

Protected _setSort(query, dir): void

Parameters

NameType
queryQuery
dirQuerySortDir

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1148


_setSortBy

Protected _setSortBy(query, sortBy): void

Parameters

NameType
queryQuery
sortBystring | QuerySortBy | QuerySortBy[]

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:1152


addFilter

addFilter(filterOrCriteria, parentFilterId?): void

Parameters

NameType
filterOrCriteriaQueryFilterOrCriteria
parentFilterIdQueryFilterId

Returns

void

Implementation of

Collection.addFilter

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:97


addFilterCriteria

addFilterCriteria(field, operator, value, not?, id?, parentFilterId?): void

Parameters

NameType
fieldstring
operatorQueryFilterCriteriaOperator
valuenull | string | number | boolean | QueryFilterCriteriaValue[]
not?boolean
id?string | number | symbol
parentFilterId?string | number | symbol

Returns

void

Implementation of

Collection.addFilterCriteria

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:105


addSortBy

addSortBy(sortBy, prepend?): void

Parameters

NameType
sortByQuerySortBy
prepend?boolean

Returns

void

Implementation of

Collection.addSortBy

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:126


asService

asService(): CollectionService<T, M, CollectionState<T, M>>

Returns

CollectionService<T, M, CollectionState<T, M>>

Implementation of

Collection.asService

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:133


clearFields

clearFields(): void

Returns

void

Implementation of

Collection.clearFields

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:138


clearFilter

clearFilter(): void

Returns

void

Implementation of

Collection.clearFilter

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:146


clearLimit

clearLimit(): void

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:154


clearOffset

clearOffset(): void

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:162


clearParam

clearParam(key): void

Parameters

NameType
keystring

Returns

void

Implementation of

Collection.clearParam

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:170


clearParams

clearParams(): void

Returns

void

Implementation of

Collection.clearParams

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:178


clearSearch

clearSearch(): void

Returns

void

Implementation of

Collection.clearSearch

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:186


clearSort

clearSort(): void

Returns

void

Implementation of

Collection.clearSort

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:194


clearSortBy

clearSortBy(): void

Returns

void

Implementation of

Collection.clearSortBy

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:202


filter

filter(filter): void

Parameters

NameType
filterQueryFilter | QueryFilterCriteria | QueryFilterOrCriteria[]

Returns

void

Implementation of

Collection.filter

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:210


getAdapter

getAdapter(): undefined | CollectionItemAdapter<T, M>

Returns

undefined | CollectionItemAdapter<T, M>

Implementation of

Collection.getAdapter

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:249


getFields

getFields(): undefined | string[]

Returns

undefined | string[]

Implementation of

Collection.getFields

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:253


getFilter

getFilter(): undefined | QueryFilter

Returns

undefined | QueryFilter

Implementation of

Collection.getFilter

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:257


getFilterById

getFilterById(id): undefined | QueryFilterOrCriteria

Parameters

NameType
idQueryFilterId

Returns

undefined | QueryFilterOrCriteria

Implementation of

Collection.getFilterById

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:261


getItem

getItem(id): undefined | Item<T, M>

Parameters

NameType
idstring | number

Returns

undefined | Item<T, M>

Implementation of

Collection.getItem

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:282


getLimit

getLimit(): undefined | number

Returns

undefined | number

Implementation of

Collection.getLimit

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:330


getMeta

getMeta(id): undefined | M

Parameters

NameType
idstring | number

Returns

undefined | M

Implementation of

Collection.getMeta

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:289


getOffset

getOffset(): undefined | number

Returns

undefined | number

Implementation of

Collection.getOffset

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:301


getParam

getParam(key): any

Parameters

NameType
keystring

Returns

any

Implementation of

Collection.getParam

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:305


getParams

getParams(): undefined | AnonymousObject<any>

Returns

undefined | AnonymousObject<any>

Implementation of

Collection.getParams

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:309


getQuery

getQuery(): Query

Returns

Query

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:313


getSearch

getSearch(): undefined | Primitive

Returns

undefined | Primitive

Implementation of

Collection.getSearch

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:326


getSort

getSort(): undefined | QuerySortDir

Returns

undefined | QuerySortDir

Implementation of

Collection.getSort

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:334


getSortBy

getSortBy(): undefined | QuerySortBy[]

Returns

undefined | QuerySortBy[]

Implementation of

Collection.getSortBy

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:338


getSortByField

getSortByField(field): undefined | QuerySortByField

Parameters

NameType
fieldstring

Returns

undefined | QuerySortByField

Implementation of

Collection.getSortByField

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:342


getSortById

getSortById(id): undefined | QuerySortBy

Parameters

NameType
idstring

Returns

undefined | QuerySortBy

Implementation of

Collection.getSortById

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:364


init

init(): void

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:74


load

load(limit?, offset?): void

Parameters

NameType
limit?number
offset?number

Returns

void

Implementation of

Collection.load

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:373


query

query(query): void

Parameters

NameType
queryQuery

Returns

void

Implementation of

Collection.query

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:380


refresh

refresh(query?): void

Parameters

NameType
query?Query

Returns

void

Implementation of

Collection.refresh

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:393


removeFilter

removeFilter(filterId): void

Parameters

NameType
filterIdQueryFilterId

Returns

void

Implementation of

Collection.removeFilter

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:399


removeSortBy

removeSortBy(id): void

Parameters

NameType
idstring

Returns

void

Implementation of

Collection.removeSortBy

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:407


reset

reset(): void

Returns

void

Implementation of

Collection.reset

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:415


search(search): void

Parameters

NameType
searchPrimitive

Returns

void

Implementation of

Collection.search

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:422


serializeQuery

serializeQuery(query): QuerySerializerResult

Parameters

NameType
queryQuery

Returns

QuerySerializerResult

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:429


setData

setData(data): void

Parameters

NameType
dataT[]

Returns

void

Implementation of

Collection.setData

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:435


setFields

setFields(fields): void

Parameters

NameType
fieldsstring[]

Returns

void

Implementation of

Collection.setFields

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:447


setMeta

setMeta(item, key, value): void

Parameters

NameType
itemItem<T, M>
keykeyof M
valueany

Returns

void

Implementation of

Collection.setMeta

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:456


setParam

setParam(key, value): void

Parameters

NameType
keystring
valueany

Returns

void

Implementation of

Collection.setParam

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:477


setParams

setParams(params): void

Parameters

NameType
paramsAnonymousObject<any>

Returns

void

Implementation of

Collection.setParams

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:485


setStatus

setStatus(status): void

Parameters

NameType
statusLoadingStatus

Returns

void

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:493


sort

sort(dir): void

Parameters

NameType
dirQuerySortDir

Returns

void

Implementation of

Collection.sort

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:498


sortBy

sortBy(sortBy): void

Parameters

NameType
sortBystring | QuerySortBy | QuerySortBy[]

Returns

void

Implementation of

Collection.sortBy

Defined in

onekijs/packages/onekijs-framework/src/collection/CollectionService.ts:506