{"version":3,"file":"base-CfojwyC3.cjs","names":["MastraBase"],"sources":["../src/storage/domains/base.ts"],"sourcesContent":["import { MastraBase } from '../../base';\nimport type { PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '../retention';\n\n/**\n * Base class for all storage domains.\n * Provides common interface for initialization and data clearing.\n */\nexport abstract class StorageDomain extends MastraBase {\n  /**\n   * Declares which of this domain's tables are eligible for age-based\n   * retention, mapping a stable table key → physical table name, timestamp\n   * anchor column, and whether that column is indexed.\n   *\n   * This is the single source of truth used by `prune()` implementations to\n   * resolve policies to physical deletes. Domains that support retention\n   * override this; the default is empty (nothing prunable).\n   */\n  static readonly retentionTables: RetentionTablesDescriptor = {};\n\n  /**\n   * Initialize the storage domain.\n   * This should create any necessary tables/collections.\n   * Default implementation is a no-op - override in adapters that need initialization.\n   */\n  async init(): Promise<void> {\n    // Default no-op - adapters override if they need to create tables/collections\n  }\n\n  /**\n   * Clears all data from this storage domain.\n   * This is a destructive operation - use with caution.\n   * Primarily used for testing.\n   */\n  abstract dangerouslyClearAll(): Promise<void>;\n\n  /**\n   * Delete rows older than each policy's `maxAge`, batched, bounded, and\n   * cancellable so it is safe to run against very large tables.\n   *\n   * - `policies` maps this domain's stable table keys to their retention policy.\n   * - `options` bound the work (`maxBatches`/`maxRows`), pace it (`pauseMs`),\n   *   and allow cooperative cancellation (`signal`).\n   *\n   * Returns one {@link PruneResult} per table touched. A result with\n   * `done: false` means eligible rows remain — call `prune()` again to continue.\n   *\n   * `prune()` only deletes rows. On SQLite/LibSQL freed pages are reused by\n   * future writes so the file stops growing. Handing disk back to the OS is left\n   * to the underlying database and the operator to manage.\n   *\n   * Default implementation is a no-op (retention not supported).\n   */\n  async prune(_policies: Record<string, TableRetentionPolicy>, _options?: PruneOptions): Promise<PruneResult[]> {\n    return [];\n  }\n}\n"],"mappings":";;;;;;AAOA,IAAsB,gBAAtB,cAA4CA,aAAAA,WAAW;;;;;;;;;;CAUrD,OAAgB,kBAA6C,CAAC;;;;;;CAO9D,MAAM,OAAsB,CAE5B;;;;;;;;;;;;;;;;;;CA0BA,MAAM,MAAM,WAAiD,UAAiD;EAC5G,OAAO,CAAC;CACV;AACF"}