UNPKG

pinia-orm

Version:

The Pinia plugin to enable Object-Relational Mapping access to the Pinia Store.

127 lines (104 loc) 4.61 kB
import { T as TypeDefault, F as FieldDecorator, a as TypeOptions, U as UidOptions, b as Model, P as PrimaryKey, d as deleteModes, C as CastAttribute, c as Mutator } from './shared/pinia-orm.DkHEBXTz.cjs'; export { N as NanoidOptions } from './shared/pinia-orm.DkHEBXTz.cjs'; import 'pinia'; import 'vue'; import '@pinia-orm/normalizr'; import '@/composables'; /** * Create an Attr attribute property decorator. */ declare function Attr(value?: TypeDefault<any>): FieldDecorator; /** * Create a String attribute property decorator. */ declare function Str(value: TypeDefault<string>, options?: TypeOptions): FieldDecorator; /** * Create a Number attribute property decorator. */ declare function Num(value: TypeDefault<number>, options?: TypeOptions): FieldDecorator; /** * Create a Boolean attribute property decorator. */ declare function Bool(value: TypeDefault<boolean>, options?: TypeOptions): FieldDecorator; /** * Create a Uid attribute property decorator. */ declare function Uid(options?: UidOptions): FieldDecorator; /** * Create a has-one attribute property decorator. */ declare function HasOne(related: () => typeof Model, foreignKey: PrimaryKey, localKey?: PrimaryKey): FieldDecorator; /** * Create a belongs-to attribute property decorator. */ declare function BelongsTo(related: () => typeof Model, foreignKey: PrimaryKey, ownerKey?: PrimaryKey): FieldDecorator; /** * Create a belongs-to-many attribute property decorator. */ declare function BelongsToMany(related: () => typeof Model, pivot: (() => typeof Model) | { as: string; model: () => typeof Model; }, foreignPivotKey: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): FieldDecorator; /** * Create a has-many attribute property decorator. */ declare function HasMany(related: () => typeof Model, foreignKey: PrimaryKey, localKey?: PrimaryKey): FieldDecorator; /** * Create a has-many-by attribute property decorator. */ declare function HasManyBy(related: () => typeof Model, foreignKey: string, ownerKey?: string): FieldDecorator; /** * Create a has-many attribute property decorator. */ declare function HasManyThrough(related: () => typeof Model, through: () => typeof Model, firstKey: string, secondKey: string, localKey?: string, secondLocalKey?: string): FieldDecorator; /** * Create a morph-one attribute property decorator. */ declare function MorphOne(related: () => typeof Model, id: string, type: string, localKey?: string): FieldDecorator; /** * Create a morph-to attribute property decorator. */ declare function MorphTo(related: () => typeof Model[], id: string, type: string, ownerKey?: string): FieldDecorator; /** * Create a morph-to-many attribute property decorator. */ declare function MorphToMany(related: () => typeof Model, pivot: (() => typeof Model) | { as: string; model: () => typeof Model; }, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): FieldDecorator; /** * Create a morphed-by-many attribute property decorator. */ declare function MorphedByMany(related: () => typeof Model, pivot: (() => typeof Model) | { as: string; model: () => typeof Model; }, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): FieldDecorator; /** * Create a morph-many attribute property decorator. */ declare function MorphMany(related: () => typeof Model, id: string, type: string, localKey?: string): FieldDecorator; /** * Define the delete behaviour for a relation */ declare function OnDelete(mode: deleteModes): FieldDecorator; /** * Create a cast for an attribute property decorator. */ declare function Cast(to: (() => typeof CastAttribute)): FieldDecorator; /** * Create a Mutate attribute property decorator. */ declare function Mutate(get?: Mutator<any>, set?: Mutator<any>): FieldDecorator; /** * Create a hidden attribute property decorator. */ declare function Hidden(): FieldDecorator; /** * Marks a property as non enumerable so it is skipped during enumeration * (e.g. Object.keys, for...in or JSON.stringify). Must be used together * with the `accessor` keyword: `@NonEnumerable accessor pivot!: Pivot`. */ declare function NonEnumerable(_target: ClassAccessorDecoratorTarget<unknown, unknown>, context: ClassAccessorDecoratorContext | { kind?: string; }): void; export { Attr, BelongsTo, BelongsToMany, Bool, Cast, FieldDecorator, HasMany, HasManyBy, HasManyThrough, HasOne, Hidden, MorphMany, MorphOne, MorphTo, MorphToMany, MorphedByMany, Mutate, NonEnumerable, Num, OnDelete, Str, TypeOptions, Uid, UidOptions };