import EvaluationContext from "../evaluation-context.js"; /** * Shared behaviour for the build/create/attributesFor strategies: evaluation * context creation, deterministic callback execution, guaranteed `afterAll` * cleanup, record construction (default and `initializeWith`), and association * wiring through public relationship reflection. */ export default class BaseStrategy { /** * Creates an evaluation context for a plan. * @param {import("../factory-registry.js").default} registry - Owning registry. * @param {import("../factory-runner.js").CompiledPlan} plan - Compiled plan. * @param {"attributesFor" | "build" | "create"} strategyName - Strategy name. * @returns {EvaluationContext} - The context. */ _newContext(registry: import("../factory-registry.js").default, plan: import("../factory-runner.js").CompiledPlan, strategyName: "attributesFor" | "build" | "create"): EvaluationContext; /** * Builds the callback `context` object: evaluated transients exposed as plain * properties (no Proxy) plus the named evaluator methods. * @param {EvaluationContext} context - Evaluation context. * @param {Record>} transients - Evaluated transient values. * @returns {Record>} - The callback context. */ _callbackContext(context: EvaluationContext, transients: Record>): Record>; /** * Runs every deduped callback for an event in declaration order. * @param {EvaluationContext} context - Evaluation context. * @param {import("../factory-runner.js").CompiledPlan} plan - Compiled plan. * @param {string} event - Event name (e.g. "afterCreate"). * @param {{record: ReturnType, transients: Record>, strategy: string}} state - Current record/transients/strategy. * @returns {Promise} - Resolves when all callbacks complete. */ _runCallbacks(context: EvaluationContext, plan: import("../factory-runner.js").CompiledPlan, event: string, state: { record: ReturnType; transients: Record>; strategy: string; }): Promise; /** * Runs `body`, then guarantees `afterAll` runs in `finally`. When both the body * and cleanup fail, the body's primary error is preserved and the cleanup error * is attached as a detail rather than masking it. * @param {EvaluationContext} context - Evaluation context. * @param {import("../factory-runner.js").CompiledPlan} plan - Compiled plan. * @param {() => {record: ReturnType, transients: Record>, strategy: string}} state - Late-bound state accessor. * @param {() => Promise>} body - The strategy body. * @returns {Promise>} - The body's result. */ _runWithAfterAll(context: EvaluationContext, plan: import("../factory-runner.js").CompiledPlan, state: () => { record: ReturnType; transients: Record>; strategy: string; }, body: () => Promise>): Promise>; /** * Attaches an afterAll cleanup failure to the primary error without masking it. * @param {ReturnType} primaryError - The original error that will propagate. * @param {ReturnType} cleanupError - The afterAll cleanup failure. * @returns {void} */ _attachCleanupFailure(primaryError: ReturnType, cleanupError: ReturnType): void; /** * Constructs a record from evaluated public attributes, honouring a custom * `initializeWith` constructor and never assigning constructor-consumed * attributes twice. * @param {import("../factory-runner.js").CompiledPlan} plan - Compiled plan. * @param {Record>} publicAttributes - Evaluated public attributes. * @param {EvaluationContext} context - Evaluation context. * @param {Record>} transients - Evaluated transients. * @returns {Promise>} - The constructed record. */ _constructRecord(plan: import("../factory-runner.js").CompiledPlan, publicAttributes: Record>, context: EvaluationContext, transients: Record>): Promise>; /** * Constructs a record via a custom `initializeWith`, tracking which attributes * the constructor consumed through its `get(name)` accessor and assigning only * the remaining public attributes afterwards. * @param {import("../factory-runner.js").CompiledPlan} plan - Compiled plan. * @param {new (attributes?: Record>) => import("../../../database/record/index.js").default} ModelClass - Validated declared model class. * @param {Record>} publicAttributes - Evaluated public attributes. * @param {EvaluationContext} context - Evaluation context. * @param {Record>} transients - Evaluated transients. * @returns {Promise>} - The constructed record. */ _constructWithInitializer(plan: import("../factory-runner.js").CompiledPlan, ModelClass: new (attributes?: Record>) => import("../../../database/record/index.js").default, publicAttributes: Record>, context: EvaluationContext, transients: Record>): Promise>; /** * Wires evaluated associations onto a record through public relationship * reflection and generated setters (never private caches or guessed keys). * @param {ReturnType} record - The owning record. * @param {Array<{name: string, record: ReturnType}>} associations - Evaluated associations. * @returns {void} */ _assignAssociations(record: ReturnType, associations: Array<{ name: string; record: ReturnType; }>): void; /** * Normalizes a has-many association value into an array of records. * @param {ReturnType} value - Association value (record, array, or null). * @returns {Array>} - The normalized record array. */ _toRecordArray(value: ReturnType): Array>; } //# sourceMappingURL=base.d.ts.map