/** * Once-per-class warning when a subclass overrides a {@link FirestoreRepository} write method. * * Why this exists: overriding `update` / `create` / `delete` (etc.) compiles and looks like an * enforced invariant, but sibling write paths do not self-delegate through the override. The * constructor-time check catches the common prototype/method override shape; class-field and * ctor-body assignments are invisible until after `super()` returns (see issue #103). * * @see ADR-0043 — write-override warning (issue #103) * @see ADR-0040 — write interceptors (issue #108), the enforcement mechanism this warning now * redirects to. Wiring the lazy field-style/ctor-body check into that choke point is still * outstanding; interceptors do not remove the blind spot, they give the warning somewhere correct * to point. */ /** * Public write entry points on {@link FirestoreRepository}. Overriding any of these does **not** * enforce an invariant across sibling paths — the warning names the bypasses. * * Durability: keep this list in sync with the type-test partition in * `src/tests/types/write-override-warning.type-test.ts`. The type-test `Missing` / `Extra` guards * fail when a public instance member is unclassified or when a listed write name is not on the class. */ export declare const REPOSITORY_WRITE_METHODS: readonly ["bulkCreate", "bulkCreateWithIds", "bulkDelete", "bulkPatch", "bulkUpdate", "bulkWrite", "create", "createInTransaction", "createWithId", "createWithIdInTransaction", "delete", "deleteInTransaction", "patch", "patchInTransaction", "recursiveDelete", "recursiveDeleteCollection", "update", "updateInTransaction", "upsert"]; /** One of {@link REPOSITORY_WRITE_METHODS}. */ export type RepositoryWriteMethod = (typeof REPOSITORY_WRITE_METHODS)[number]; /** * Constructor identity used for WeakSet keying and the suppress flag. Never invoked — only compared * by reference and read for `.name` / `.prototype` / the static opt-out. Replaces bare `Function` * so `@typescript-eslint/no-unsafe-function-type` stays clean (prototype.patch used `Function`). */ type ConstructorIdentity = { readonly name: string; readonly prototype: object; suppressWriteOverrideWarning?: boolean; }; /** * Walk the prototype chain between `ctor.prototype` and `FirestoreRepository.prototype`, collecting * write-method names that are own properties on an intermediate prototype (method-style overrides). * * Class-field and ctor-body assignments are invisible here — they land on the instance after * `super()` returns. */ export declare function collectOverriddenWriteMethods(ctor: ConstructorIdentity, basePrototype: object): RepositoryWriteMethod[]; /** * Build the once-per-class warning string. * * The redirect points at `registerWriteInterceptor` first (ADR-0040, shipped in 3.0.0): it is the * only mechanism that actually enforces an invariant across every write path, which is what a * write-method override looks like it does and does not. The facade stays as the fallback, because * it is still the right answer when the invariant needs composition or a narrowed public surface * rather than an atomic sibling write. * * The warning itself stays: interceptors add a correct path, they do not remove the wrong one. */ export declare function formatWriteOverrideWarning(className: string, overridden: readonly RepositoryWriteMethod[]): string; /** * Emit at most one `console.warn` per subclass constructor when that class overrides one or more * write methods on its prototype chain. * * @param instance - The repository being constructed (`this` from the base constructor) * @param baseConstructor - The `FirestoreRepository` constructor function (identity short-circuit) * @param basePrototype - `FirestoreRepository.prototype` (walk stop) */ export declare function warnIfWriteMethodsOverridden(instance: object, baseConstructor: ConstructorIdentity, basePrototype: object): void; export {};