astro
Version:
Astro is a modern site builder with web best practices, performance, and DX front-of-mind.
33 lines (32 loc) • 762 B
JavaScript
/**
* A {@link DataStoreSource} backed by an in-memory {@link ImmutableDataStore}.
* All queries resolve synchronously; the async signatures exist to satisfy the
* {@link DataStoreSource} contract.
*/
export class InMemorySource {
#store;
constructor(store) {
this.#store = store;
}
hasCollection(collection) {
return this.#store.hasCollection(collection);
}
get(collection, key) {
return this.#store.get(collection, key);
}
entries(collection) {
return this.#store.entries(collection);
}
values(collection) {
return this.#store.values(collection);
}
keys(collection) {
return this.#store.keys(collection);
}
has(collection, key) {
return this.#store.has(collection, key);
}
collections() {
return this.#store.collections();
}
}