Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Entity
✓ import { Entity } from 'hydro-vue-orm'
✗ import { Entity } from 'hydro-vue-orm' (incorrect path, but no common mistake)
Decorator for class definition.
Repository
✓ import { Repository } from 'hydro-vue-orm'
Used for CRUD operations on entities.
Reactive
✓ import { Reactive } from 'hydro-vue-orm'
Type helper for reactive entity instances.
defineSchema
✓ import { defineSchema } from 'hydro-vue-orm'
Used to transform nested data into reactive entities.
Shows how to define an entity class, insert reactive entities, update via Repository, and transform nested data with defineSchema.
import { Entity, Repository, defineSchema } from 'hydro-vue-orm'
import { reactive } from 'vue'
@Entity()
class UserModel {
id: number
name: string
age: number
get userInfo() {
return `${this.name} (${this.age})`
}
}
// Insert a reactive entity
const user = Repository(UserModel).insert({ id: 1, name: 'Alice', age: 30 }) as Reactive<UserModel>
// Update all entities matching condition
Repository(UserModel).where({ id: 1 }).update(u => { u.name = 'Bob' })
// Transform nested data
const data = { book: { author: { id: 2, name: 'Charlie', age: 25 } } }
const schema = defineSchema({ book: { author: UserModel } })
transform(data)
console.log(data.book.author) // Reactive UserModel instance
Errors
Common errors & fixes
Cannot find module 'hydro-vue-orm' or its corresponding type declarations.
Package not installed or TypeScript cannot locate types.
fixnpm install hydro-vue-orm; ensure tsconfig includes types (e.g., "types": ["hydro-vue-orm"]) or import directly.
Unexpected token @ - decorators are not valid in this context.
TypeScript decorators require experimentalDecorators compiler option.
fixAdd "experimentalDecorators": true to tsconfig.json compilerOptions.
Repository(UserModel).insert() returns an object but not a class instance?
Forgetting to define the class with @Entity() or not using the class as a constructor.
fixEnsure the class is decorated with @Entity() and that you pass the class itself to Repository.
Audit
Dependencies
vuerequiredRequired for reactivity system (peer dependency)
mittrequiredEvent emitter used internally for cross-component communication (peer dependency)