{"version":3,"sources":["../../../../src/types/options/drivers-options.ts"],"sourcesContent":["import type { Knex } from 'knex';\nimport type { Kysely } from 'kysely';\nimport type { DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';\nimport type { Redis as IoRedis, RedisOptions as IoRedisOptions } from 'ioredis';\nimport type { DbResult, DefaultColumnTypes, DefaultSchemaConfig } from 'orchid-orm';\n\nimport type { Duration } from '../helpers';\n\n/**\n * Options that are common to all drivers\n *\n * Some of theses options may be also defined in\n * the MasterCache options. Setting them specifically\n * for a driver will override the MasterCache options.\n */\nexport type DriverCommonOptions = {\n  prefix?: string\n}\n\n/**\n * Options for DynamoDB driver\n */\nexport type DynamoDBConfig = {\n  /**\n   * DynamoDB table name to use.\n   */\n  table: {\n    name: string\n  }\n\n  /**\n   * AWS credentials\n   */\n  credentials?: DynamoDBClientConfig['credentials']\n\n  /**\n   * Region of your DynamoDB instance\n   */\n  region: DynamoDBClientConfig['region']\n\n  /**\n   * Endpoint to your DynamoDB instance\n   */\n  endpoint: DynamoDBClientConfig['endpoint']\n} & DriverCommonOptions\n\n/**\n * Options for Memory driver\n */\nexport type MemoryConfig = {\n  /**\n   * Maximum number of items to store in the cache.\n   *\n   * Note that fewer items may be stored if you\n   * are also using `maxSize` and the cache is full.\n   *\n   * @default 1000\n   */\n  maxItems?: number\n\n  /**\n   * Maximum size of the cache in bytes.\n   */\n  maxSize?: number\n\n  /**\n   * Maximum size of one entry in bytes.\n   *\n   * If an entry is larger than this value,\n   * it will NOT be stored\n   */\n  maxEntrySize?: number\n} & DriverCommonOptions\n\n/**\n * Options for Redis driver\n */\nexport type RedisConfig = {\n  /**\n   * A IoRedis connection instance or connection options\n   */\n  connection: IoRedis | IoRedisOptions\n} & DriverCommonOptions\n\n/**\n * Options for File driver\n */\nexport type FileConfig = {\n  /**\n   * Directory where the cache files will be stored\n   */\n  directory: string\n\n  /**\n   * The interval between each expired entry pruning\n   * Can be set to `false` to disable pruning.\n   *\n   * @default false\n   */\n  pruneInterval?: Duration | false\n} & DriverCommonOptions\n\n/**\n * Common options for database drivers\n */\nexport interface DatabaseConfig extends DriverCommonOptions {\n  /**\n   * Table name to use\n   */\n  tableName?: string\n\n  /**\n   * Should the driver automatically create the table\n   * @default true\n   */\n  autoCreateTable?: boolean\n\n  /**\n   * The interval between each expired entry pruning\n   * run. Can be set to `false` to disable pruning.\n   *\n   * @default false\n   */\n  pruneInterval?: Duration | false\n}\n\n/**\n * Configuration accepted by the Knex adapter\n */\nexport interface KnexConfig extends DatabaseConfig {\n  /**\n   * The Knex instance\n   */\n  connection: Knex\n}\n\n/**\n * Configuration accepted by the Kysely adapter\n */\nexport interface KyselyConfig extends DatabaseConfig {\n  /**\n   * The Kysely instance\n   */\n  connection: Kysely<any>\n}\n\n/**\n * Configuration accepted by the Orchid ORM adapter\n */\nexport interface OrchidConfig extends DatabaseConfig {\n  /**\n   * The Orchid ORM instance\n   */\n  connection: DbResult<DefaultColumnTypes<DefaultSchemaConfig>>\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}