{"_id":"@indexeddb-orm/idb-orm","_rev":"4-2a478fab0f5432069cbdc3fd24ecdd93","name":"@indexeddb-orm/idb-orm","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.1":{"name":"@indexeddb-orm/idb-orm","version":"0.0.1","keywords":["dexie","orm","typescript","zod","validation","indexeddb"],"author":{"name":"radommaciej"},"license":"MIT","_id":"@indexeddb-orm/idb-orm@0.0.1","maintainers":[{"name":"indexeddborm","email":"indexeddborm@gmail.com"}],"homepage":"https://www.idb-orm.com","bugs":{"url":"https://github.com/radommaciej/idb-orm","email":"indexeddborm@gmail.com"},"dist":{"shasum":"574217c2897aba2a6889a4d66564cf28a9bef955","tarball":"https://registry.npmjs.org/@indexeddb-orm/idb-orm/-/idb-orm-0.0.1.tgz","fileCount":216,"integrity":"sha512-oRgg5ggB/VO7hj3woe/whloPHGRJvya5gIBRz4SR3ob7KiopD13X47WqjrVHJ+LPWkFs2Ayss6m9u9Ds80sDIQ==","signatures":[{"sig":"MEQCIAH5ldZ7vkHNz34Zs3J99iSumFQRfAfyw8B1BVIImn8ZAiBg3N6nx7PyG2Rb6l3WV1RDvqnLhxjYtHelwLXAgwxBTA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1532723},"main":"dist/index.js","type":"module","email":"indexeddborm@gmail.com","types":"dist/index.d.ts","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./metadata":{"types":"./dist/metadata/index.d.ts","import":"./dist/metadata/index.js","require":"./dist/metadata/index.js"}},"gitHead":"78677057ae42eb0c4bf2310ead540788a124ea3f","scripts":{"dev":"tsc --watch","lint":"eslint \"src/**/*.{ts,tsx}\"","test":"npm run build && vitest --run","build":"tsc","clean":"rm -rf dist","prepare":"npm run build","precommit:fix":"eslint . --fix --ext .ts,.tsx","build:homepage":"html-minifier-terser homepage/index.html -o homepage/dist/index.html --collapse-whitespace --remove-comments --minify-css true --minify-js true","precommit:lint":"eslint . --ext .ts,.tsx"},"_npmUser":{"name":"indexeddborm","email":"indexeddborm@gmail.com"},"repository":{"url":"git+https://github.com/radommaciej/idb-orm.git","type":"git"},"_npmVersion":"11.10.1","description":"TypeScript ORM wrapper for indexeddb with Zod runtime validation, build on top of dexie.js","directories":{},"lint-staged":{"*.{ts,tsx}":["eslint --fix"]},"_nodeVersion":"25.6.1","dependencies":{"zod":"^4.1.11","dexie":"4.0.0-alpha.1","loglevel":"^1.9.2","dexie-cloud-addon":"4.0.0-beta.18"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","vite":"^5.4.10","husky":"^9.1.7","eslint":"^9.33.0","vitest":"^3.2.4","ts-node":"^10.9.2","typescript":"^5.0.0","@types/jest":"^29.0.0","lint-staged":"^15.2.10","fake-indexeddb":"^6.0.0","typescript-eslint":"^8.39.1","html-minifier-terser":"^7.2.0","eslint-plugin-simple-import-sort":"^12.1.1"},"_npmOperationalInternal":{"tmp":"tmp/idb-orm_0.0.1_1772529353318_0.32287465471572774","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@indexeddb-orm/idb-orm","version":"0.0.2","keywords":["dexie","orm","typescript","zod","validation","indexeddb"],"author":{"name":"radommaciej"},"license":"MIT","_id":"@indexeddb-orm/idb-orm@0.0.2","maintainers":[{"name":"indexeddborm","email":"indexeddborm@gmail.com"}],"homepage":"https://www.idb-orm.com","bugs":{"url":"https://github.com/radommaciej/idb-orm","email":"indexeddborm@gmail.com"},"dist":{"shasum":"86c64e21f502a3ffd35a10fe974bac008e9e2abc","tarball":"https://registry.npmjs.org/@indexeddb-orm/idb-orm/-/idb-orm-0.0.2.tgz","fileCount":216,"integrity":"sha512-b081GD0uHclQTfdCdBCANSlRGTmMQyfeSpfAp3JQcsc541GT4BU9fW7RX9JoGpfVC/Vt7w+RFNVdOCSD4qNOQw==","signatures":[{"sig":"MEUCIQChFsc8FmhFankWolZWWnexUNUtZ8RFFpt8jn199V7KPgIgASpVSMscxxiTmhPoQp9d6RP+rIqrg5AdUQ4XvWpRnjY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1534952},"main":"dist/index.js","type":"module","email":"indexeddborm@gmail.com","types":"dist/index.d.ts","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./metadata":{"types":"./dist/metadata/index.d.ts","import":"./dist/metadata/index.js","require":"./dist/metadata/index.js"}},"gitHead":"db0febfe65ee208f8ddfdca66e9480530dac2918","scripts":{"dev":"tsc --watch","lint":"eslint \"src/**/*.{ts,tsx}\"","test":"npm run build && vitest --run","build":"tsc","clean":"rm -rf dist","prepare":"npm run build","precommit:fix":"eslint . --fix --ext .ts,.tsx","build:homepage":"html-minifier-terser homepage/index.html -o homepage/dist/index.html --collapse-whitespace --remove-comments --minify-css true --minify-js true","precommit:lint":"eslint . --ext .ts,.tsx"},"_npmUser":{"name":"indexeddborm","email":"indexeddborm@gmail.com"},"repository":{"url":"git+https://github.com/radommaciej/idb-orm.git","type":"git"},"_npmVersion":"11.10.1","description":"TypeScript ORM wrapper for indexeddb with Zod runtime validation, build on top of dexie.js","directories":{},"lint-staged":{"*.{ts,tsx}":["eslint --fix"]},"_nodeVersion":"25.6.1","dependencies":{"zod":"^4.1.11","dexie":"4.0.0-alpha.1","loglevel":"^1.9.2","dexie-cloud-addon":"4.0.0-beta.18"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","vite":"^5.4.10","husky":"^9.1.7","eslint":"^9.33.0","vitest":"^3.2.4","ts-node":"^10.9.2","typescript":"^5.0.0","@types/jest":"^29.0.0","lint-staged":"^15.2.10","fake-indexeddb":"^6.0.0","typescript-eslint":"^8.39.1","html-minifier-terser":"^7.2.0","eslint-plugin-simple-import-sort":"^12.1.1"},"_npmOperationalInternal":{"tmp":"tmp/idb-orm_0.0.2_1772531245569_0.06704715392648208","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@indexeddb-orm/idb-orm","version":"0.0.3","keywords":["dexie","orm","typescript","zod","validation","indexeddb"],"author":{"name":"radommaciej"},"license":"MIT","_id":"@indexeddb-orm/idb-orm@0.0.3","maintainers":[{"name":"indexeddborm","email":"indexeddborm@gmail.com"}],"homepage":"https://www.idb-orm.com","bugs":{"url":"https://github.com/radommaciej/idb-orm","email":"indexeddborm@gmail.com"},"dist":{"shasum":"87a8b5b4d6a5779770425fafaae149c0531ae484","tarball":"https://registry.npmjs.org/@indexeddb-orm/idb-orm/-/idb-orm-0.0.3.tgz","fileCount":216,"integrity":"sha512-vBKLc6To096mI5ncFlCwDBnKEaJ7O6vbH2UYS45VwDNZvhUvW3Xtsf/z6ROZ1DifN0MrzHByrKTciBAMXPVsMA==","signatures":[{"sig":"MEQCIFFBXEHuZj6/7aQX8sAU4lGnPrC24rL3gknWozoUOwTiAiAPKd5ytZUHFcl8ZDC/u6puSDkVYe/jby5xr4vp1JJ3ig==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1534952},"main":"dist/index.js","type":"module","email":"indexeddborm@gmail.com","types":"dist/index.d.ts","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./metadata":{"types":"./dist/metadata/index.d.ts","import":"./dist/metadata/index.js","require":"./dist/metadata/index.js"}},"gitHead":"db0febfe65ee208f8ddfdca66e9480530dac2918","scripts":{"dev":"tsc --watch","lint":"eslint \"src/**/*.{ts,tsx}\"","test":"npm run build && vitest --run","build":"tsc","clean":"rm -rf dist","prepare":"npm run build","precommit:fix":"eslint . --fix --ext .ts,.tsx","build:homepage":"html-minifier-terser homepage/index.html -o homepage/dist/index.html --collapse-whitespace --remove-comments --minify-css true --minify-js true","precommit:lint":"eslint . --ext .ts,.tsx"},"_npmUser":{"name":"indexeddborm","email":"indexeddborm@gmail.com"},"repository":{"url":"git+https://github.com/radommaciej/idb-orm.git","type":"git"},"_npmVersion":"11.10.1","description":"TypeScript ORM wrapper for indexeddb with Zod runtime validation, build on top of dexie.js","directories":{},"lint-staged":{"*.{ts,tsx}":["eslint --fix"]},"_nodeVersion":"25.6.1","dependencies":{"zod":"^4.1.11","dexie":"4.0.0-alpha.1","loglevel":"^1.9.2","dexie-cloud-addon":"4.0.0-beta.18"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","vite":"^5.4.10","husky":"^9.1.7","eslint":"^9.33.0","vitest":"^3.2.4","ts-node":"^10.9.2","typescript":"^5.0.0","@types/jest":"^29.0.0","lint-staged":"^15.2.10","fake-indexeddb":"^6.0.0","typescript-eslint":"^8.39.1","html-minifier-terser":"^7.2.0","eslint-plugin-simple-import-sort":"^12.1.1"},"_npmOperationalInternal":{"tmp":"tmp/idb-orm_0.0.3_1772531892869_0.6011580261100782","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@indexeddb-orm/idb-orm","version":"0.0.4","description":"TypeScript ORM wrapper for indexeddb with Zod runtime validation, build on top of dexie.js","author":{"name":"radommaciej"},"email":"indexeddborm@gmail.com","license":"MIT","keywords":["dexie","orm","typescript","zod","validation","indexeddb"],"bugs":{"url":"https://github.com/radommaciej/idb-orm","email":"indexeddborm@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/radommaciej/idb-orm.git"},"homepage":"https://www.idb-orm.com","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./metadata":{"types":"./dist/metadata/index.d.ts","import":"./dist/metadata/index.js","require":"./dist/metadata/index.js"}},"module":"dist/index.js","scripts":{"build":"tsc","build:homepage":"html-minifier-terser homepage/index.html -o homepage/dist/index.html --collapse-whitespace --remove-comments --minify-css true --minify-js true","dev":"tsc --watch","test":"npm run build && vitest --run","lint":"eslint \"src/**/*.{ts,tsx}\"","clean":"rm -rf dist","prepare":"npm run build","precommit:lint":"eslint . --ext .ts,.tsx","precommit:fix":"eslint . --fix --ext .ts,.tsx"},"dependencies":{"dexie":"4.0.0-alpha.1","dexie-cloud-addon":"4.0.0-beta.18","loglevel":"^1.9.2","zod":"^4.1.11"},"devDependencies":{"@types/jest":"^29.0.0","eslint":"^9.33.0","eslint-plugin-simple-import-sort":"^12.1.1","fake-indexeddb":"^6.0.0","html-minifier-terser":"^7.2.0","husky":"^9.1.7","jest":"^29.0.0","lint-staged":"^15.2.10","ts-node":"^10.9.2","typescript":"^5.0.0","typescript-eslint":"^8.39.1","vite":"^5.4.10","vitest":"^3.2.4"},"lint-staged":{"*.{ts,tsx}":["eslint --fix"]},"gitHead":"4733eea9bd1ce190f517c9b8979ed50ff8d549d6","_id":"@indexeddb-orm/idb-orm@0.0.4","_nodeVersion":"26.4.0","_npmVersion":"12.0.2","dist":{"integrity":"sha512-M6vFmoy25s+DKlpmPJHhUKMav5ZPaimXn9EpCOr56EQliSVbXxq5Hp/c4yTmTs5EAFjoHUeQqk2BJdtYIugh9Q==","shasum":"c14eb2de0b088574cef965159d8e5f2e00b97fd1","tarball":"https://registry.npmjs.org/@indexeddb-orm/idb-orm/-/idb-orm-0.0.4.tgz","fileCount":50,"unpackedSize":154764,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHU1zOO7qZsTO1k/FIHUmcatNfoOmkzj67qSOYLSxD78AiEAjVtUCAfHjMd3c2Vv1TQZlPwwl7fW5uEuvQMs1vEZTeY="}]},"_npmUser":{"name":"indexeddborm","email":"indexeddborm@gmail.com"},"directories":{},"maintainers":[{"name":"indexeddborm","email":"indexeddborm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/idb-orm_0.0.4_1788172093323_0.08016739053570099"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-03T09:15:53.147Z","modified":"2026-08-31T10:28:13.790Z","0.0.1":"2026-03-03T09:15:53.586Z","0.0.2":"2026-03-03T09:47:25.768Z","0.0.3":"2026-03-03T09:58:13.067Z","0.0.4":"2026-08-31T10:28:13.507Z"},"bugs":{"url":"https://github.com/radommaciej/idb-orm","email":"indexeddborm@gmail.com"},"author":{"name":"radommaciej"},"license":"MIT","homepage":"https://www.idb-orm.com","keywords":["dexie","orm","typescript","zod","validation","indexeddb"],"repository":{"type":"git","url":"git+https://github.com/radommaciej/idb-orm.git"},"description":"TypeScript ORM wrapper for indexeddb with Zod runtime validation, build on top of dexie.js","maintainers":[{"name":"indexeddborm","email":"indexeddborm@gmail.com"}],"readme":"# Dexie ORM\n\nTypeScript ORM wrapper for indexed-db with Zod runtime validation, built on the top of dexie.js.\n\n**[View Homepage](https://idb-orm.com)** - Interactive documentation and examples\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Important Notes](#important-notes)\n  - [Dexie Dependencies](#dexie-dependencies)\n  - [Built on Dexie.js](#built-on-dexiejs)\n  - [Index Requirements for Queries](#index-requirements-for-queries)\n  - [Compound Indexes for Complex Queries](#compound-indexes-for-complex-queries)\n- [Usage](#usage)\n  - [1. Define Entities](#1-define-entities)\n  - [2. Create Database](#2-create-database)\n  - [3. Basic CRUD Operations](#3-basic-crud-operations)\n  - [4. Entity Relations](#4-entity-relations)\n  - [5. Reactive Queries with liveQuery](#5-reactive-queries-with-livequery)\n  - [6. Advanced Queries and Aggregation](#6-advanced-queries-and-aggregation)\n  - [6. Entity Validation](#6-entity-validation-1)\n  - [7. Database Management](#7-database-management)\n  - [8. Cloud Synchronization](#8-cloud-synchronization)\n  - [9. Compound Indexes](#9-compound-indexes)\n- [Example Applications](#example-applications)\n- [API Reference](#api-reference)\n- [License](#license)\n\n## Features\n\n- **TypeScript Support** - Full type safety with generics\n- **Zod Validation** - Runtime validation with Zod schemas\n- **Config-based entities** - Define entities with a simple `defineEntity(...)` API\n \n- **Dexie Compatibility** - All Dexie.js operations supported\n- **Clean API** - Simple and intuitive API design\n\n## Installation\n\n```bash\nnpm i @indexeddb-orm/idb-orm\n```\n\n## Important Notes\n\n### Dexie Dependencies\nThis library includes Dexie.js internally. To ensure that `liveQuery` works properly, you need to configure Vite to dedupe Dexie.\n\n```typescript\n// In your vite.config.ts, add:\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n  resolve: {\n    dedupe: ['dexie'],\n  },\n  // ... other config\n});\n\n// This ensures liveQuery works correctly\n// Without dedupe, liveQuery may not function properly\n```\n\n### Built on Dexie.js\nThis library is built on top of [Dexie.js](https://dexie.org) - a powerful wrapper for IndexedDB. All Dexie.js methods and features are available through the `db` object.\n\n```typescript\n// All Dexie.js methods work with our library\nconst db = await Database.createDatabase({...});\n\n// Direct Dexie.js operations\nawait db.transaction('rw', db.users, async () => {\n    await db.users.add({ name: 'John', email: 'john@example.com' });\n});\n\n// Dexie.js query methods\nconst users = await db.users\n    .where('age')\n    .above(18)\n    .and(user => user.name.startsWith('J'))\n    .toArray();\n\n// Dexie.js liveQuery (reactive queries)\nimport { liveQuery } from 'dexie';\nconst observableUsers = liveQuery(() => \n    db.users.where('active').equals(true).toArray()\n);\n```\n\n**Benefits:** You get all the power of Dexie.js plus our ORM features like entity validation, relations, and cloud sync.\n\n### Index Requirements for Queries\n**Critical:** When searching by any field, you MUST create an index on that field. Queries without proper indexes will fail.\n\n```typescript\nconst UserSchema = z.object({\n    id: z.number(),\n    name: z.string(),\n    email: z.string(),\n    age: z.number()\n});\n\ndefineEntity(User, {\n    schema: UserSchema,\n    indexes: [\n        { key: 'email' },        // Required for email queries\n        { key: 'age' },          // Required for age queries\n        { key: 'name' }          // Required for name queries\n    ]\n});\n```\n\n### Compound Indexes for Complex Queries\nFor queries involving multiple fields, you need compound indexes. Single field indexes won't work for multi-field queries.\n\n```typescript\ndefineEntity(Post, {\n    schema: PostSchema,\n    compoundIndexes: [\n        { key: ['category', 'status'] },\n        { key: ['authorId', 'createdAt'] }\n    ]\n});\n```\n\n## Usage\n\n### 1. Define Entities \n\n```typescript\nimport { BaseEntity, defineEntity } from '@indexeddb-orm/idb-orm';\nimport { z } from 'zod';\n\n// Zod schema for validation\nconst UserSchema = z.object({\n  id: z.number().optional(),\n  name: z.string().min(2, 'Name must be at least 2 characters'),\n  email: z.string().email('Invalid email format'),\n  age: z.number().min(18, 'Must be at least 18 years old'),\n  createdAt: z.number(),\n  updatedAt: z.number(),\n  isActive: z.boolean().default(true),\n  tags: z.array(z.string()).default([]),\n  metadata: z.record(z.string(), z.unknown()).default({}),\n});\n\nexport class UserEntity extends BaseEntity<number> {\n  name!: string;\n  email!: string;\n  age!: number;\n  createdAt!: number;\n  updatedAt!: number;\n  isActive!: boolean;\n  tags!: string[];\n  metadata!: Record<string, unknown>;\n}\n\ndefineEntity(UserEntity, {\n  tableName: 'users',\n  schema: UserSchema,\n  columns: {\n    name: { required: true, indexed: true },\n    email: { required: true, unique: true },\n    age: { indexed: true },\n    createdAt: { indexed: true },\n    updatedAt: { indexed: true },\n    isActive: { indexed: true },\n    tags: {},\n    metadata: {},\n  },\n  // Example relations (optional)\n  // relations: {\n  //   posts: { type: 'one-to-many', target: PostEntity, foreignKey: 'authorId' },\n  // },\n});\n```\n\n### 2. Create Database\n\n```typescript\nimport { Database } from '@indexeddb-orm/idb-orm';\nimport { UserEntity } from './entities/User';\nimport { PostEntity } from './entities/Post';\n\nexport const db = Database.createDatabase({\n  name: 'MyApp',\n  version: 1,\n  entities: [UserEntity, PostEntity],\n  config: { \n    onSchemaChangeStrategy: 'all',\n    cloudSync: {\n      databaseUrl: 'https://your-sync-server.com',\n      enableOfflineQueue: true,\n      syncInterval: 30000\n    }\n  },\n});\n```\n\n### Database Configuration Options\n\nThe `createDatabase()` method accepts the following configuration options:\n\n#### Basic Configuration\n```typescript\nconst db = Database.createDatabase({\n  name: string,           // Required: Database name\n  version: number,        // Required: Schema version\n  entities: EntityConstructor[], // Required: Array of entity classes\n  config?: {             // Optional: Additional configuration\n    // Schema change handling\n    onSchemaChangeStrategy?: 'selective' | 'all',\n    \n    // Migrations list\n    migrations?: Migration[],\n    \n    // Cloud synchronization\n    cloudSync?: CloudSyncConfig\n  }\n});\n```\n\n#### Schema Change Strategy Options\n\n**`onSchemaChangeStrategy`** - Defines how to handle database schema changes:\n\n- **`'selective'`** (recommended for production): Only resets tables that have schema changes, preserving data in unchanged tables\n- **`'all'`**: Resets the entire database when any schema change is detected, useful for development\n\n#### Cloud Sync Configuration Options\n\n**`CloudSyncConfig`** - Configuration for cloud synchronization:\n\n```typescript\ninterface CloudSyncConfig {\n  databaseUrl: string;                    // Required: Base URL of the sync server\n  enableOfflineSupport?: boolean;         // Optional: Queue changes when offline (default: false)\n  syncInterval?: number;                  // Optional: Auto-sync interval in milliseconds (default: 30000)\n  // Note: Authentication is handled by Dexie Cloud addon configuration\n}\n```\n\n**Cloud Sync Options:**\n- **`databaseUrl`** (required): The base URL of your synchronization server\n- **`enableOfflineSupport`** (optional): If `true`, changes are queued when offline and synced when connection is restored\n- **`syncInterval`** (optional): Automatic synchronization interval in milliseconds (default: 30 seconds)\n\n**Authentication Note:**\nAuthentication for cloud sync is handled by the Dexie Cloud addon configuration, not through this interface. You need to configure authentication separately when setting up the Dexie Cloud addon.\n\n#### Schema Change Strategy Examples\n```typescript\n// Option 1: Reset only changed tables (recommended for production)\nconst db = Database.createDatabase({\n  name: 'MyApp',\n  version: 1,\n  entities: [UserEntity, PostEntity],\n  config: {\n    onSchemaChangeStrategy: 'selective' // Only reset tables that changed\n  }\n});\n\n// Option 2: Reset entire database on schema changes\nconst db = Database.createDatabase({\n  name: 'MyApp',\n  version: 1,\n  entities: [UserEntity, PostEntity],\n  config: {\n    onSchemaChangeStrategy: 'all' // Reset all data when schema changes\n  }\n});\n```\n\n#### Migration Configuration\n```typescript\nconst db = Database.createDatabase({\n  name: 'MyApp',\n  version: 2,\n  entities: [UserEntity, PostEntity],\n  config: {\n    migrations: [\n      {\n        version: 2,\n        name: 'Add fullName field',\n        up: async (db) => {\n          await db.getRepository(UserEntity).toCollection().modify(user => {\n            user.fullName = `${user.firstName} ${user.lastName}`;\n          });\n        },\n        down: async (db) => {\n          await db.getRepository(UserEntity).toCollection().modify(user => {\n            delete user.fullName;\n          });\n        }\n      }\n    ]\n  }\n});\n```\n\n#### Cloud Synchronization Configuration\n```typescript\nconst db = Database.createDatabase({\n  name: 'MyApp',\n  version: 1,\n  entities: [UserEntity, PostEntity],\n  config: {\n    cloudSync: {\n      databaseUrl: 'https://your-sync-server.com', // Required: Sync server URL\n      enableOfflineSupport: true,                  // Optional: Queue changes when offline\n      syncInterval: 30000                          // Optional: Auto-sync interval (30s)\n    }\n  }\n});\n```\n\n#### Complete Configuration Example\n```typescript\nconst db = Database.createDatabase({\n  name: 'MyApp',\n  version: 3,\n  entities: [UserEntity, PostEntity, CommentEntity],\n  config: {\n    // Handle schema changes by resetting only affected tables\n    onSchemaChangeStrategy: 'selective',\n    \n    // Define migrations for version upgrades\n    migrations: [\n      {\n        version: 2,\n        name: 'Add user profiles',\n        up: async (db) => {\n          // Migration logic for version 2\n        }\n      },\n      {\n        version: 3,\n        name: 'Add comment system',\n        up: async (db) => {\n          // Migration logic for version 3\n        }\n      }\n    ],\n    \n    // Enable cloud synchronization\n    cloudSync: {\n      databaseUrl: 'https://api.myapp.com/sync',\n      enableOfflineSupport: true,\n      syncInterval: 60000 // Sync every minute\n    }\n  }\n});\n```\n\n### 3. Basic CRUD Operations\n\n```typescript\n// Prefer explicit repositories for strict typing\nconst users = await db.getRepository(UserEntity).toArray(); // Type: UserEntity[]\nconst posts = await db.getRepository(PostEntity).toArray(); // Type: PostEntity[]\n\n// Create new entity with validation in one call\nimport { newEntity } from '@indexeddb-orm/idb-orm';\n\nconst newUser = newEntity(UserEntity, {\n  name: 'John Doe',\n  email: 'john@example.com',\n  age: 25,\n  createdAt: Date.now(),\n  updatedAt: Date.now(),\n  tags: ['developer'],\n  metadata: { source: 'manual' },\n});\n\n// Save to database\nawait db.getRepository(UserEntity).add(newUser);\n\n// Query with full Dexie.js API\nconst activeUsers = await db.getRepository(UserEntity)\n  .where('isActive')\n  .equals(true)\n  .toArray();\n```\n\n### 4. Entity Relations\n\n```typescript\n// Define entities with relations\ndefineEntity(UserEntity, {\n  tableName: 'users',\n  schema: UserSchema,\n  columns: { /* ... */ },\n  relations: {\n    posts: { \n      type: 'one-to-many', \n      target: PostEntity, \n      foreignKey: 'authorId' \n    },\n    profile: { \n      type: 'one-to-one', \n      target: ProfileEntity, \n      foreignKey: 'userId' \n    }\n  }\n});\n\ndefineEntity(PostEntity, {\n  tableName: 'posts',\n  schema: PostSchema,\n  columns: { /* ... */ },\n  relations: {\n    author: { \n      type: 'many-to-one', \n      target: UserEntity, \n      foreignKey: 'authorId' \n    },\n    tags: { \n      type: 'many-to-many', \n      target: TagEntity, \n      joinTable: 'post_tags' \n    }\n  }\n});\n\n// Load relations\nconst userWithPosts = await db.loadRelations({\n  entity: user,\n  entityClass: UserEntity,\n  relationNames: ['posts', 'profile']\n});\n\n// Load specific relation\nconst userPosts = await db.loadRelationByName({\n  entity: user,\n  entityClass: UserEntity,\n  relationName: 'posts'\n});\n\n// Save entity with all its relations\nconst savedUser = await db.saveWithRelations({\n  entity: user,\n  entityClass: UserEntity\n});\n\n// Delete entity with cascade handling for relations\nawait db.deleteWithRelations({\n  entity: user,\n  entityClass: UserEntity\n});\n```\n\n### 5. Reactive Queries with liveQuery\n\nUse Dexie's `liveQuery` for reactive data that automatically updates when the database changes. Works with all major frameworks:\n\n#### React Example\n```typescript\nimport { liveQuery } from 'dexie';\nimport { useObservable } from 'dexie-react-hooks';\nimport { Database } from 'indexed-db-orm';\nimport { User } from './entities/User';\n\nfunction UserList() {\n  const users = useObservable(\n    liveQuery(() => {\n      const userRepo = db.getRepository(User);\n      return userRepo.where('active').equals(true).toArray();\n    })\n  );\n  \n  return (\n    <div>\n      {users?.map(user => (\n        <div key={user.id}>{user.name}</div>\n      ))}\n    </div>\n  );\n}\n```\n\n#### Vue Example\n```typescript\nimport { liveQuery } from 'dexie';\nimport { ref, onMounted, onUnmounted } from 'vue';\nimport { Database } from 'indexed-db-orm';\nimport { User } from './entities/User';\n\nexport default {\n  setup() {\n    const users = ref<User[]>([]);\n    let subscription;\n    \n    onMounted(() => {\n      subscription = liveQuery(() => {\n        const userRepo = db.getRepository(User);\n        return userRepo.where('active').equals(true).toArray();\n      }).subscribe(result => {\n        users.value = result;\n      });\n    });\n    \n    onUnmounted(() => {\n      subscription?.unsubscribe();\n    });\n    \n    return { users };\n  }\n};\n```\n\n#### Svelte Example\n```typescript\nimport { liveQuery } from 'dexie';\nimport { onMount, onDestroy } from 'svelte';\nimport { Database } from 'indexed-db-orm';\nimport { User } from './entities/User';\n\nlet users: User[] = [];\nlet subscription;\n\nonMount(() => {\n  subscription = liveQuery(() => {\n    const userRepo = db.getRepository(User);\n    return userRepo.where('active').equals(true).toArray();\n  }).subscribe(result => {\n    users = result;\n  });\n});\n\nonDestroy(() => {\n  subscription?.unsubscribe();\n});\n```\n\n#### Angular Example\n```typescript\nimport { liveQuery } from 'dexie';\nimport { Component, OnInit, OnDestroy } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { Database } from 'indexed-db-orm';\nimport { User } from './entities/User';\n\n@Component({\n  selector: 'app-user-list',\n  template: '<div *ngFor=\"let user of users\">{{user.name}}</div>'\n})\nexport class UserListComponent implements OnInit, OnDestroy {\n  users: User[] = [];\n  private subscription?: Subscription;\n  \n  ngOnInit() {\n    this.subscription = liveQuery(() => {\n      const userRepo = db.getRepository(User);\n      return userRepo.where('active').equals(true).toArray();\n    }).subscribe(result => {\n      this.users = result;\n    });\n  }\n  \n  ngOnDestroy() {\n    this.subscription?.unsubscribe();\n  }\n}\n```\n\n### 6. Advanced Queries and Aggregation\n\n```typescript\n// Aggregation operations\nconst result = await db.aggregate({\n  entityClass: PostEntity,\n  options: {\n    where: { category: 'tech' },\n    sort: { field: 'views', direction: 'desc' },\n    limit: 10,\n    count: true,\n    sum: ['views'],\n    avg: ['likes'],\n    groupBy: ['category']\n  }\n});\n\n// Complex filtering and sorting\nconst topPosts = await db.getRepository(PostEntity)\n  .where('published')\n  .equals(true)\n  .and(post => post.views > 100)\n  .orderBy('views')\n  .reverse()\n  .limit(5)\n  .toArray();\n```\n\n### 6. Entity Validation\n\n```typescript\n// Manual validation\nconst user = new UserEntity();\nuser.name = 'A'; // Too short\nuser.email = 'invalid-email'; // Invalid format\n\nconst result = user.validate();\nif (!result.isValid) {\n  console.log(result.errors);\n  // ['name: Name must be at least 2 characters', 'email: Invalid email format']\n}\n\n// Validation with error throwing\ntry {\n  user.validateOrThrow();\n} catch (error) {\n  console.log('Validation failed:', error.message);\n}\n\n// Initialize with validation\nconst validUser = new UserEntity().init({\n  name: 'John Doe',\n  email: 'john@example.com',\n  age: 25\n});\n```\n\n### 7. Database Management\n\n```typescript\n// Check for schema changes\nconst hasChanges = await db.checkSchemaChanges();\nif (hasChanges) {\n  await db.performSelectiveReset(); // Reset only changed tables\n  // or\n  await db.resetDatabase(); // Reset entire database\n}\n\n// Clear all data\nawait db.clearAllData();\n\n// Run migrations\nawait db.runMigrations([\n  {\n    version: 2,\n    up: async (db) => {\n      await db.getRepository(UserEntity).toCollection().modify(user => {\n        user.fullName = `${user.firstName} ${user.lastName}`;\n      });\n    }\n  }\n]);\n```\n\n### 8. Cloud Synchronization\n\n#### Installation\n```bash\nnpm install dexie-cloud-addon\n```\n\n#### Configuration\n```typescript\n// Basic cloud sync configuration\nconst db = Database.createDatabase({\n  name: 'MyApp',\n  version: 1,\n  entities: [UserEntity, PostEntity],\n  config: {\n    cloudSync: {\n      databaseUrl: 'https://your-database-url.dexie.cloud',\n      enableOfflineSupport: true,\n      syncInterval: 30000 // 30 seconds\n    }\n  }\n});\n\n// Enable cloud sync manually\nawait db.enableCloudSync({\n  databaseUrl: 'https://your-sync-server.com',\n  enableOfflineSupport: true,\n  syncInterval: 30000\n});\n```\n\n#### Cloud Sync API\n```typescript\n// Check sync status\nconst status = db.getSyncStatus();\nconsole.log('Sync enabled:', status.enabled);\nconsole.log('Last sync:', status.lastSync);\nconsole.log('Online:', status.isOnline);\n\n// Manual sync\nawait db.sync();\n\n// Sync specific tables\nawait db.syncTables(['users', 'posts']);\n\n// Check if cloud sync is enabled\nconst isEnabled = db.isCloudSyncEnabled();\n\n// Get cloud sync configuration\nconst config = db.getCloudSyncConfig();\n\n// Disable cloud sync\ndb.disableCloudSync();\n```\n\n#### Automatic Synchronization\n```typescript\n// Configure automatic sync with interval\nconst db = Database.createDatabase({\n  name: 'MyApp',\n  version: 1,\n  entities: [UserEntity, PostEntity],\n  config: {\n    cloudSync: {\n      databaseUrl: 'https://your-database-url.dexie.cloud',\n      syncInterval: 60000 // Sync every minute\n    }\n  }\n});\n```\n\n#### React Integration Example\n```typescript\nimport { useState, useEffect } from 'react';\nimport { useLiveQuery } from 'dexie-react-hooks';\n\nfunction MyComponent() {\n  const [syncStatus, setSyncStatus] = useState({ enabled: false });\n  \n  // Data with automatic synchronization\n  const users = useLiveQuery(() => db.getRepository(UserEntity).toArray());\n  \n  useEffect(() => {\n    const status = db.getSyncStatus();\n    setSyncStatus(status);\n  }, []);\n  \n  const handleSync = async () => {\n    try {\n      await db.sync();\n      alert('Synchronization completed!');\n    } catch (error) {\n      alert(`Sync error: ${error.message}`);\n    }\n  };\n  \n  return (\n    <div>\n      <h2>Status: {syncStatus.enabled ? 'Enabled' : 'Disabled'}</h2>\n      <button onClick={handleSync}>Sync Now</button>\n      \n      {users?.map(user => (\n        <div key={user.id}>{user.name}</div>\n      ))}\n    </div>\n  );\n}\n```\n\n#### Troubleshooting\n```typescript\n// Check if cloud sync is configured\nconst config = db.getCloudSyncConfig();\n\nif (!config) {\n  await db.enableCloudSync({\n    databaseUrl: 'https://your-database-url.dexie.cloud'\n  });\n}\n\n// Check sync status for debugging\nconst status = db.getSyncStatus();\nconsole.log('Online:', status.isOnline);\nconsole.log('Last sync:', status.lastSync);\n\n// Try manual sync if automatic sync fails\nawait db.sync();\n\n```\n\n### 9. Compound Indexes\n\nCompound indexes allow you to create indexes on multiple columns for better query performance.\n\n#### Defining Compound Indexes\n\n```typescript\nimport { BaseEntity, defineEntity } from '@indexeddb-orm/idb-orm';\nimport { z } from 'zod';\n\n// Zod schema for validation\nconst UserSchema = z.object({\n  id: z.number().optional(),\n  name: z.string(),\n  email: z.string().email(),\n  age: z.number(),\n  isActive: z.boolean(),\n});\n\nexport class UserEntity extends BaseEntity {\n  name!: string;\n  email!: string;\n  age!: number;\n  isActive!: boolean;\n}\n\n// Define entity with compound indexes\ndefineEntity(UserEntity, {\n  tableName: 'users',\n  schema: UserSchema,\n  columns: {\n    name: { indexed: true },\n    email: { indexed: true, unique: true },\n    age: { indexed: true },\n    isActive: { indexed: true },\n  },\n  compoundIndexes: [\n    {\n      columns: ['name', 'email'],\n      unique: false,\n      name: 'name_email_index'\n    },\n    {\n      columns: ['age', 'isActive'],\n      unique: false,\n      name: 'age_active_index'\n    },\n    {\n      columns: ['email'],\n      unique: true,\n      name: 'unique_email_index'\n    }\n  ]\n});\n```\n\n#### Querying with Compound Indexes\n\n```typescript\n// Query using compound index (name + email)\nconst users = await db.getRepository(UserEntity)\n  .where(['name', 'email'])\n  .equals(['John Doe', 'john@example.com'])\n  .toArray();\n\n// Query using compound index (age + isActive)\nconst activeAdults = await db.getRepository(UserEntity)\n  .where(['age', 'isActive'])\n  .above([18, 1]) // age > 18, isActive = true\n  .toArray();\n\n// Query using unique compound index\nconst user = await db.getRepository(UserEntity)\n  .where('email')\n  .equals('john@example.com')\n  .first();\n```\n\n#### Different Query Operators\n\n```typescript\n// equals - exact match\nconst users = await db.getRepository(UserEntity)\n  .where(['name', 'email'])\n  .equals(['John', 'john@example.com'])\n  .toArray();\n\n// above - greater than\nconst adults = await db.getRepository(UserEntity)\n  .where(['age', 'isActive'])\n  .above([18, 1])\n  .toArray();\n\n// below - less than\nconst youngUsers = await db.getRepository(UserEntity)\n  .where(['age'])\n  .below([25])\n  .toArray();\n\n// between - between values\nconst middleAged = await db.getRepository(UserEntity)\n  .where(['age'])\n  .between([25, 50])\n  .toArray();\n```\n\n#### Real-world Examples\n\n```typescript\n// 1. User search by name and email\ndefineEntity(UserEntity, {\n  tableName: 'users',\n  schema: UserSchema,\n  columns: {\n    name: { indexed: true },\n    email: { indexed: true },\n  },\n  compoundIndexes: [\n    { columns: ['name', 'email'], name: 'name_email_index' }\n  ]\n});\n// Usage: Find user by exact name and email\nconst user = await db.getRepository(UserEntity)\n  .where(['name', 'email'])\n  .equals(['John Doe', 'john@example.com'])\n  .first();\n\n// 2. Active adults filter\ndefineEntity(UserEntity, {\n  tableName: 'users',\n  schema: UserSchema,\n  columns: {\n    age: { indexed: true },\n    isActive: { indexed: true },\n  },\n  compoundIndexes: [\n    { columns: ['age', 'isActive'], name: 'age_active_index' }\n  ]\n});\n// Usage: Find active adults\nconst activeAdults = await db.getRepository(UserEntity)\n  .where(['age', 'isActive'])\n  .above([18, 1])\n  .toArray();\n\n// 3. Posts by date and category\ndefineEntity(PostEntity, {\n  tableName: 'posts',\n  schema: PostSchema,\n  columns: {\n    createdAt: { indexed: true },\n    category: { indexed: true },\n  },\n  compoundIndexes: [\n    { columns: ['createdAt', 'category'], name: 'date_category_index' }\n  ]\n});\n// Usage: Find recent posts in specific category\nconst recentTechPosts = await db.getRepository(PostEntity)\n  .where(['createdAt', 'category'])\n  .above([Date.now() - 7 * 24 * 60 * 60 * 1000, 'tech'])\n  .toArray();\n```\n\n#### Compound Index Benefits\n\n- **Query Performance**: Faster searches on multiple columns\n- **Uniqueness**: Guarantee unique combinations of values\n- **Flexibility**: Create indexes on any column combinations\n- **Optimization**: Better performance for complex queries\n\n### Vite note: ensure a single Dexie instance for live queries\n\nIf `useLiveQuery` doesn't re-render with this library's `Database`, make sure Vite bundles a single Dexie copy by deduping Dexie:\n\n```ts\n// vite.config.ts\nimport react from '@vitejs/plugin-react';\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n  plugins: [react()],\n  resolve: { dedupe: ['dexie'] },\n});\n```\n\nThis ensures the app and the library share the same Dexie singleton so reactivity works correctly.\n\n### Indexing Note\n\nWhen querying with `where('field')` or sorting with `orderBy('field')`, ensure the field is indexed in your entity definition:\n\n```ts\ndefineEntity(PostEntity, {\n  tableName: 'posts',\n  columns: {\n    createdAt: { indexed: true },\n    published: { indexed: true },\n    likes: { indexed: true },\n  },\n});\n```\n\nIf you change indexes, bump your database `version` or run a migration so Dexie can apply the schema update.\n\n## Example Applications\n\nThe library includes comprehensive demo applications showcasing all features across different frameworks:\n\n### Available Demo Apps\n\n#### **React Demo App** \n- **Framework**: React 19 + TypeScript\n- **UI Library**: Material-UI (MUI)\n- **Features**: Live queries, TypeScript demo, Cloud sync, Aggregations\n- **Run**: `cd react-demo-app && npm install && npm run dev`\n- **URL**: `http://localhost:5173`\n\n#### **Vue Demo App**\n- **Framework**: Vue 3 + TypeScript  \n- **UI Library**: Vuetify 3\n- **Features**: Reactive components, Cloud sync, Entity management\n- **Run**: `cd vue-demo-app && npm install && npm run dev`\n- **URL**: `http://localhost:5173`\n\n#### **Svelte Demo App**\n- **Framework**: SvelteKit + TypeScript\n- **UI Library**: Material-UI (MUI)\n- **Features**: Server-side rendering, Live queries, TypeScript integration\n- **Run**: `cd svelte-demo-app && npm install && npm run dev`\n- **URL**: `http://localhost:5173`\n\n#### **Angular Demo App**\n- **Framework**: Angular 17 + TypeScript\n- **UI Library**: Angular Material\n- **Features**: Services, Dependency injection, Reactive forms\n- **Run**: `cd angular-demo-app && npm install && npm start`\n- **URL**: `http://localhost:4200`\n\n### Demo App Features\n\nAll demo applications showcase:\n\n#### **Core Features**\n- **Entity Definition** - Using `defineEntity()` API\n- **Zod Validation** - Runtime validation with error handling\n- **Relations** - One-to-one, one-to-many, many-to-many relationships\n- **Aggregations** - Count, sum, average, min, max operations\n- **Live Queries** - Reactive data with `useLiveQuery()`\n- **TypeScript** - Full type safety and IntelliSense\n\n#### **Advanced Features**\n- **Cloud Sync** - Dexie Cloud synchronization\n- **Migrations** - Database schema migrations\n- **Compound Indexes** - Multi-column indexing\n- **Entity Management** - CRUD operations with relations\n- **Error Handling** - Validation errors and user feedback\n\n### Demo App Structure\n\nEach demo app follows similar structure:\n\n```\ndemo-app/\n├── src/\n│   ├── entities/         # Entity definitions\n│   ├── database/         # Database configuration\n│   └── migrations/       # Database migrations\n├── package.json\n└── README.md\n```\n\nEach demo is fully functional and can serve as a starting point for your own applications!\n\n## API Reference\n\n### Core Classes\n\n#### `Database`\nMain database class extending Dexie with ORM capabilities.\n\n**Static Methods:**\n- `Database.createDatabase(params)` - Create database with entity registration\n\n**Instance Methods:**\n- `getRepository<T>(entityClass)` - Get typed repository for entity\n- `aggregate<T>(params)` - Perform aggregation operations\n- `clearAllData()` - Clear all data from database\n- `resetDatabase()` - Reset database when schema changes\n- `checkSchemaChanges()` - Check if schema has changed\n- `performSelectiveReset()` - Reset only changed tables\n- `runMigrations(migrations)` - Run database migrations\n- `getTypedTable<T>(entityClass)` - Get typed table for entity\n- `getTableForEntity<T>(entityClass)` - Get table with proper typing\n- `getEntities()` - Get all registered entities\n- `getEntity(tableName)` - Get entity by table name\n- `loadRelations<T>(params)` - Load relations for entity\n- `loadRelationByName<T, K>(params)` - Load specific relation\n- `saveWithRelations<T>(params)` - Save entity with relations\n- `deleteWithRelations<T>(params)` - Delete entity with cascade\n- `sync()` - Manual cloud sync\n- `getSyncStatus()` - Get cloud sync status\n- `enableCloudSync(config)` - Enable cloud synchronization\n- `disableCloudSync()` - Disable cloud sync\n- `isCloudSyncEnabled()` - Check if cloud sync is enabled\n- `getCloudSyncConfig()` - Get cloud sync configuration\n- `syncTables(tableNames)` - Sync specific tables\n\n#### `BaseEntity<TKey>`\nBase class for all entities with validation capabilities.\n\n**Methods:**\n- `validate(): ValidationResult` - Validate entity against schema\n- `validateOrThrow(): void` - Validate and throw error if invalid\n- `init(data): this` - Initialize entity with data and validate\n\n#### `EntitySchema<T>`\nSchema management for entities.\n\n**Methods:**\n- `getTableName(): string` - Get table name for entity\n- `getSchema(): ZodSchema | undefined` - Get Zod schema\n- `getColumns(): Record<string, ColumnOptions>` - Get column metadata\n- `validate(data): ValidationResult` - Validate data against schema\n- `create(data?): T` - Create new entity instance\n\n### Entity Definition\n\n#### `defineEntity(EntityClass, options)`\nDefine entity with metadata and configuration.\n\n**Parameters:**\n- `EntityClass` - Entity constructor class\n- `options` - Entity configuration object\n\n**Options:**\n```typescript\ninterface EntityOptions {\n  tableName?: string;           // Custom table name\n  schema?: ZodSchema;           // Zod validation schema\n  timestamps?: boolean;         // Enable timestamps\n  columns?: Record<string, ColumnOptions>;\n  relations?: Record<string, RelationOptions>;\n  compoundIndexes?: CompoundIndexOptions[];\n}\n```\n\n#### `newEntity(EntityClass, data)`\nCreate new entity instance with validation.\n\n**Parameters:**\n- `EntityClass` - Entity constructor\n- `data` - Partial entity data\n\n**Returns:** Fully initialized and validated entity instance\n\n### Decorators\n\n#### `@Entity(options?)`\nClass decorator for entity definition.\n\n#### `@Column(options?)`\nProperty decorator for column configuration.\n\n#### `@Relation(options)`\nProperty decorator for relation definition.\n\n**Relation Types:**\n- `@OneToOne(target, options?)` - One-to-one relation\n- `@OneToMany(target, foreignKey)` - One-to-many relation\n- `@ManyToMany(target, joinTable)` - Many-to-many relation\n\n### Type Definitions\n\n#### `EntityConstructor<T>`\n```typescript\ninterface EntityConstructor<T extends BaseEntity = BaseEntity> {\n  new (): T;\n  schema?: ZodSchema;\n  tableName?: string;\n}\n```\n\n#### `ColumnOptions`\n```typescript\ninterface ColumnOptions {\n  kind?: 'string' | 'number' | 'boolean' | 'array' | 'object';\n  unique?: boolean;\n  indexed?: boolean;\n  required?: boolean;\n  default?: unknown;\n  primaryKey?: boolean;\n  autoIncrement?: boolean;\n}\n```\n\n#### `RelationOptions`\n```typescript\ninterface RelationOptions {\n  type: 'one-to-one' | 'one-to-many' | 'many-to-many';\n  target: EntityConstructor | string;\n  foreignKey?: string;\n  joinTable?: string;\n  cascade?: boolean;\n  eager?: boolean;\n}\n```\n\n#### `ValidationResult`\n```typescript\ninterface ValidationResult {\n  isValid: boolean;\n  errors: string[];\n}\n```\n\n#### `DatabaseConfig`\n```typescript\ninterface DatabaseConfig {\n  name: string;\n  version: number;\n  entities: EntityConstructor[];\n  onSchemaChangeStrategy?: 'selective' | 'all';\n  migrations?: Migration[];\n  cloudSync?: CloudSyncConfig;\n}\n```\n\n#### `CloudSyncConfig`\n```typescript\ninterface CloudSyncConfig {\n  databaseUrl: string;\n  enableOfflineSupport?: boolean;\n  syncInterval?: number;\n}\n```\n\n#### `Migration`\n```typescript\ninterface Migration {\n  version: number;\n  name: string;\n  up: (db: Dexie) => Promise<void>;\n  down?: (db: Dexie) => Promise<void>;\n}\n```\n\n#### `AggregationOptions<T>`\n```typescript\ninterface AggregationOptions<T extends BaseEntity> {\n  where?: Partial<T>;\n  count?: boolean;\n  sum?: (keyof T)[];\n  avg?: (keyof T)[];\n  min?: (keyof T)[];\n  max?: (keyof T)[];\n  groupBy?: keyof T;\n  include?: string[];\n  limit?: number;\n  sort?: {\n    field: keyof T;\n    direction: 'asc' | 'desc';\n  };\n}\n```\n\n#### `AggregationResult`\n```typescript\ninterface AggregationResult {\n  count?: number;\n  sum?: Record<string, number>;\n  avg?: Record<string, number>;\n  min?: Record<string, number>;\n  max?: Record<string, number>;\n  groups?: Array<{\n    key: unknown;\n    count: number;\n    sum?: Record<string, number>;\n    avg?: Record<string, number>;\n    min?: Record<string, number>;\n    max?: Record<string, number>;\n  }>;\n  data?: unknown[];\n}\n```\n\n### Error Classes\n\n#### `ValidationError`\nError thrown when entity validation fails.\n\n**Properties:**\n- `message: string` - Error message\n- `errors: string[]` - Array of validation errors\n\n### Utility Functions\n\n#### `newEntity(EntityClass, data)`\nFactory function for creating validated entities.\n\n#### `defineEntity(EntityClass, options)`\nFunction for defining entity metadata.\n\n### Schema Change Strategies\n\n#### `'selective'`\nOnly resets tables that have schema changes, preserving data in unchanged tables.\n\n#### `'all'`\nResets the entire database when any schema change is detected.\n\n### Cloud Sync Status\n\n```typescript\ninterface SyncStatus {\n  enabled: boolean;\n  lastSync?: Date;\n  isOnline?: boolean;\n}\n```\n\n## License\nMIT\n","readmeFilename":"README.md"}