# `Collection`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `configurator-runtime.d.ts` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

Interface · `import type { Collection } from '@holostep-configurators/runtime-client/contract';` · stable · since 2.0.0 · section 7. Collections and shapes

Content you create. Disposing removes everything it created, its rules, its stage settings and
the hooks on its parts, and aborts its [`signal`](Collection.signal.md): pass that to [`onFrame`](Session.onFrame.md), `on` or
[`materials.create`](Materials.create.md) to end them with it. `C`: the commit options of the writer it is bound to.
A bare `Collection` is `Collection<NoCommitOptions>` (member options only), which fits a handle
from either writer; store a session handle that takes `origin` as `Collection<CommitOptions>`.

## Members

| Member | Kind | Summary |
| --- | --- | --- |
| <a id="name"></a>[`name`](Collection.name.md) | property | The name it was created with; unique among live collections. |
| <a id="role"></a>[`role`](Collection.role.md) | property | Fixed at creation. |
| <a id="signal"></a>[`signal`](Collection.signal.md) | property | Aborts when the collection is disposed. |
| <a id="disposed"></a>[`disposed`](Collection.disposed.md) | property | True once disposed: writes then do nothing, record 'handle-disposed' and resolve 'refused' with reason 'disposed'; `load()` starts nothing and rejects AbortError (spec section 3.4). |
| <a id="root"></a>[`root`](Collection.root.md) | property | The collection's root part. |
| <a id="set"></a>[`set`](Collection.set.md) | method | Keyed reconcile to the whole `spec` (not a merge patch): items are added, changed in place or removed by `key`, including items that `load()` added. |
| <a id="load"></a>[`load`](Collection.load.md) | method | Loads a glTF/GLB as one item. |
| <a id="part"></a>[`part`](Collection.part.md) | method | The part for an item key; `exists: false` when there is none. |
| <a id="dispose"></a>[`dispose`](Collection.dispose.md) | method | Terminal and immediate. |

## Declaration

```ts
export interface Collection<C extends object = NoCommitOptions> {
  readonly name: string;
  readonly role: Role;
  readonly signal: AbortSignal;
  readonly disposed: boolean;
  readonly root: Part<C>;
  set(spec: CollectionSpec, options?: C & SignalOption): Promise<CollectionReport>;
  load(url: string, placement?: Placement & {
    key?: string;
    signal?: AbortSignal;
  }): Promise<Part<C>>;
  part(key: string): Part<C>;
  dispose(): void;
}
```

## Generic-API test (spec 3.1)

| Rule | Result |
| --- | --- |
| 1. Neutral name | pass: `Collection` names no product |
| 2. A precedent | not recorded: no ledger row (coverage.json) names this member or its owner |
| 3. Two apps, or labs | not recorded: no ledger row names this member or its owner |
| 4. The cheaper fix first | not recorded per member (Appendix B decides it per need) |
