/**
 * Protocol-aware repository factory.
 *
 * `repository()` takes a `TypedEnbox` instance and returns a Proxy-backed
 * object whose shape mirrors the protocol's `structure` tree with
 * ergonomic CRUD methods on each node.
 *
 * - **Collections** (default): `create`, `query`, `get`, `delete`, `subscribe`
 * - **Singletons** (`$recordLimit: { max: 1 }`): `set`, `get`, `delete`
 * - **Nested types**: first argument is `parentContextId`
 * - **`configure()`**: idempotent protocol installation
 *
 * @example
 * ```ts
 * const social = repository(enbox.using(SocialGraphProtocol));
 * await social.configure();
 *
 * // Root collection
 * const { record } = await social.friend.create({
 *   data: { did: 'did:example:alice' },
 * });
 *
 * // Nested under group
 * const members = await social.group.member.query(groupContextId);
 * ```
 *
 * ## Deliberate `as never` pattern
 *
 * The CRUD methods below pass their `options: Record<string, unknown>`
 * parameter to `typed.records.{create, query, subscribe, update}` with
 * `as never`. This is the type-system bridge between the type-erased
 * Proxy (which doesn't carry the per-protocol generic) and the strictly-
 * typed record methods (which take `TypedRecordCreateParams<...>` etc.).
 *
 * `never` is the universal bottom subtype, so any strict generic is
 * satisfied. The structural runtime shape of `options` is validated by
 * the DWN SDK's grant-processing layer downstream — the cast is a
 * narrow, intentional escape hatch at the proxy boundary.
 *
 * SonarCloud's `typescript:S4325` flags these casts as redundant
 * because its rule doesn't model generic-parameter constraints. We
 * suppress S4325 at the file level (see `sonar-project.properties`)
 * because every CRUD method uses the same pattern and per-line
 * `// NOSONAR` would dwarf the actual code.
 *
 * @module
 */
import type { Repository } from './repository-types.js';
import type { SchemaMap } from './protocol-types.js';
import type { TypedEnbox } from './typed-enbox.js';
import type { ProtocolDefinition } from '@enbox/dwn-sdk-js';
/**
 * Creates a protocol-aware repository from a `TypedEnbox` instance.
 *
 * The returned object provides domain-specific CRUD methods that mirror
 * the protocol's structure tree:
 *
 * - Root types: `repo.friend.create()`, `repo.friend.query()`
 * - Nested types: `repo.group.member.create(groupCtxId, { data })`
 * - Singletons: `repo.profile.set()`, `repo.profile.get()`
 * - Protocol install: `repo.configure()`
 *
 * @param typed - A `TypedEnbox` instance from `enbox.using(protocol)`.
 * @returns A typed repository object.
 *
 * @example
 * ```ts
 * const social = repository(enbox.using(SocialGraphProtocol));
 * await social.configure();
 *
 * const rec = await social.friend.create({
 *   data: { did: 'did:example:alice' },
 * });
 * const friends = await social.friend.query();
 * ```
 */
export declare function repository<D extends ProtocolDefinition, M extends SchemaMap>(typed: TypedEnbox<D, M>): Repository<D, M>;
//# sourceMappingURL=repository.d.ts.map