import { Client } from '../models/client.ts' import { Collection } from '../utils/collection.ts' import { BaseManager } from './base.ts' export class BaseChildManager { client: Client parent: BaseManager constructor(client: Client, parent: BaseManager) { this.client = client this.parent = parent } async get(key: string): Promise { return this.parent.get(key) } async set(key: string, value: T): Promise { return this.parent.set(key, value) } async delete(key: string): Promise { return false } async array(): Promise { return this.parent.array() } async collection(): Promise> { const arr = (await this.array()) as undefined | T2[] if (arr === undefined) return new Collection() const collection = new Collection() for (const elem of arr) { // @ts-expect-error collection.set(elem.id, elem) } return collection } }