import { NamespaceAdapter } from '../index.js'; type MongooseModel = { findOne: (conditions: Record, projection?: Record | string) => { lean: () => Promise | null>; collation: (options: Record) => { lean: () => Promise | null>; }; }; }; /** * Create a namespace adapter for Mongoose * * Note: For Mongoose sources, `idColumn` defaults to "_id" instead of "id". * * @example * ```ts * import mongoose from "mongoose"; * import { createNamespaceGuard } from "namespace-guard"; * import { createMongooseAdapter } from "namespace-guard/adapters/mongoose"; * * const User = mongoose.model("User", userSchema); * const Organization = mongoose.model("Organization", orgSchema); * * const guard = createNamespaceGuard( * { * reserved: ["admin", "api", "settings"], * sources: [ * { name: "user", column: "handle", idColumn: "_id", scopeKey: "_id" }, * { name: "organization", column: "slug", idColumn: "_id", scopeKey: "_id" }, * ], * }, * createMongooseAdapter({ user: User, organization: Organization }) * ); * ``` */ declare function createMongooseAdapter(models: Record): NamespaceAdapter; export { createMongooseAdapter };