Documentation / @imvu/client / Collection
Class: Collection<T>
Defined in: packages/client/src/collections/Collection.ts:36
A sparse URL-backed collection with fresh page reads and optional realtime invalidation.
Extends
Type Parameters
| Type Parameter | Default type |
|---|---|
T | APIResource |
Implements
AsyncIterable<T>
Constructors
Constructor
new Collection<T>(
client,
url,
itemType?,
options?
): Collection<T>;Defined in: packages/client/src/collections/Collection.ts:40
Parameters
| Parameter | Type | Description |
|---|---|---|
client | Client | - |
url | string | - |
itemType? | Constructor<Resource<APIRelations, APIUpdateTarget>> | The model used to hydrate each normalized item, if any. |
options? | CollectionOptions | - |
Returns
Collection<T>
Overrides
Properties
_url
protected _url: string = '';Defined in: packages/client/src/resources/RemoteDocument.ts:13
Inherited from
client
protected readonly client: Client;Defined in: packages/client/src/resources/RemoteDocument.ts:16
Inherited from
itemType?
readonly itemType?: Constructor<Resource<APIRelations, APIUpdateTarget>>;Defined in: packages/client/src/collections/Collection.ts:44
Internal
The model used to hydrate each normalized item, if any.
options
readonly options: CollectionOptions = {};Defined in: packages/client/src/collections/Collection.ts:46
Internal
revision
revision: number = 0;Defined in: packages/client/src/resources/RemoteDocument.ts:8
Inherited from
stale
stale: boolean = false;Defined in: packages/client/src/resources/RemoteDocument.ts:9
Inherited from
totalCount?
totalCount?: number;Defined in: packages/client/src/collections/Collection.ts:38
Total reported by the most recent page/count response.
updateTarget
updateTarget:
| APIUpdateTarget
| null
| undefined;Defined in: packages/client/src/resources/RemoteDocument.ts:11
Undefined until metadata is loaded; null means the API explicitly provides no update target.
Inherited from
Accessors
url
Get Signature
get url(): string;Defined in: packages/client/src/resources/RemoteDocument.ts:28
Canonical REST URL and cache identity for this document.
Returns
string
Inherited from
watchability
Get Signature
get watchability(): "unknown" | "supported" | "unsupported";Defined in: packages/client/src/collections/Collection.ts:51
Returns
"unknown" | "supported" | "unsupported"
Methods
_applyRemoteMetadata()
_applyRemoteMetadata(url, updateTarget): void;Defined in: packages/client/src/resources/RemoteDocument.ts:33
Internal
Apply address/update metadata from an authoritative REST response.
Parameters
| Parameter | Type |
|---|---|
url | string |
updateTarget | APIUpdateTarget | null |
Returns
void
Inherited from
RemoteDocument._applyRemoteMetadata
_invalidate()
_invalidate(): void;Defined in: packages/client/src/resources/RemoteDocument.ts:40
Internal
Mark this document stale after an IMQ invalidation.
Returns
void
Inherited from
[asyncIterator]()
[asyncIterator](): AsyncIterableIterator<T>;Defined in: packages/client/src/collections/Collection.ts:67
Returns
AsyncIterableIterator<T>
Implementation of
AsyncIterable.[asyncIterator]
count()
count(): Promise<number>;Defined in: packages/client/src/collections/Collection.ts:56
Returns
Promise<number>
page()
page(__namedParameters?): Promise<readonly T[]>;Defined in: packages/client/src/collections/Collection.ts:63
Fetch a fresh range of items. Collection membership is intentionally not cached.
Parameters
| Parameter | Type |
|---|---|
__namedParameters? | PageOptions |
Returns
Promise<readonly T[]>
watch()
watch(): Promise<DocumentWatch<Collection<T>>>;Defined in: packages/client/src/collections/Collection.ts:80
Observe explicit IMQ invalidations for this document.
Returns
Promise<DocumentWatch<Collection<T>>>