vuex-orm-decorators
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -23,5 +23,6 @@ import { Model } from '@vuex-orm/core'; | ||
* @param defaultValue The default value for the field (if undefined the default will be '') | ||
* @param mutator Mutate the given value | ||
*/ | ||
export function StringField(defaultValue) { | ||
return Field(Model.string(defaultValue || '')); | ||
export function StringField(defaultValue, mutator) { | ||
return Field(Model.string(defaultValue || '', mutator)); | ||
} | ||
@@ -43,6 +44,7 @@ /** | ||
* Adds the property as a generic attribute field | ||
* @param defaultValue The default value for the field (if undiefine dthe default will be '') | ||
* @param defaultValue The default value for the field (if undefined the default will be '') | ||
* @param mutator Mutate the given value | ||
*/ | ||
export function AttrField(defaultValue) { | ||
return Field(Model.attr(defaultValue)); | ||
export function AttrField(defaultValue, mutator) { | ||
return Field(Model.attr(defaultValue, mutator)); | ||
} | ||
@@ -52,5 +54,6 @@ /** | ||
* @param defaultValue The default value for the field (if undefined the default will be 0) | ||
* @param mutator Mutate the given value | ||
*/ | ||
export function NumberField(defaultValue) { | ||
return Field(Model.number(defaultValue || 0)); | ||
export function NumberField(defaultValue, mutator) { | ||
return Field(Model.number(defaultValue || 0, mutator)); | ||
} | ||
@@ -60,5 +63,6 @@ /** | ||
* @param defaultValue The default value for the field (if undefined the default will be FALSE) | ||
* @param mutator Mutate the given value | ||
*/ | ||
export function BooleanField(value, mutator) { | ||
return Field(Model.boolean(value, mutator)); | ||
export function BooleanField(defaultValue, mutator) { | ||
return Field(Model.boolean(defaultValue, mutator)); | ||
} | ||
@@ -65,0 +69,0 @@ /** |
@@ -15,4 +15,5 @@ import { Model, Attribute } from '@vuex-orm/core'; | ||
* @param defaultValue The default value for the field (if undefined the default will be '') | ||
* @param mutator Mutate the given value | ||
*/ | ||
export declare function StringField(defaultValue?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function StringField(defaultValue?: string, mutator?: Mutator<string | null>): (target: Object, propertyName: string | symbol) => void; | ||
/** | ||
@@ -22,22 +23,25 @@ * Adds the property as a uid field | ||
*/ | ||
export declare function UidField(value?: () => string | number): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function UidField(value?: () => string | number): (target: Object, propertyName: string | symbol) => void; | ||
/** | ||
* Adds the property as an incremental field | ||
*/ | ||
export declare function IncrementField(): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function IncrementField(): (target: Object, propertyName: string | symbol) => void; | ||
/** | ||
* Adds the property as a generic attribute field | ||
* @param defaultValue The default value for the field (if undiefine dthe default will be '') | ||
* @param defaultValue The default value for the field (if undefined the default will be '') | ||
* @param mutator Mutate the given value | ||
*/ | ||
export declare function AttrField(defaultValue?: any): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function AttrField(defaultValue?: any, mutator?: Mutator<any>): (target: Object, propertyName: string | symbol) => void; | ||
/** | ||
* Adds the property as a number typed field | ||
* @param defaultValue The default value for the field (if undefined the default will be 0) | ||
* @param mutator Mutate the given value | ||
*/ | ||
export declare function NumberField(defaultValue?: number): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function NumberField(defaultValue?: number, mutator?: Mutator<number | null>): (target: Object, propertyName: string | symbol) => void; | ||
/** | ||
* Adds the property as a boolean typed field | ||
* @param defaultValue The default value for the field (if undefined the default will be FALSE) | ||
* @param mutator Mutate the given value | ||
*/ | ||
export declare function BooleanField(value: any, mutator?: Mutator<boolean | null>): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function BooleanField(defaultValue: any, mutator?: Mutator<boolean | null>): (target: Object, propertyName: string | symbol) => void; | ||
/** | ||
@@ -49,3 +53,3 @@ * Adds the property as a 'Has Many' relationship field | ||
*/ | ||
export declare function HasManyField(related: typeof Model | string, foreignKey: string, localKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function HasManyField(related: typeof Model | string, foreignKey: string, localKey?: string): (target: Object, propertyName: string | symbol) => void; | ||
/** | ||
@@ -57,3 +61,3 @@ * Adds the property as a 'Has One' relationship field | ||
*/ | ||
export declare function HasOneField(related: typeof Model | string, foreignKey: string, localKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function HasOneField(related: typeof Model | string, foreignKey: string, localKey?: string): (target: Object, propertyName: string | symbol) => void; | ||
/** | ||
@@ -65,10 +69,10 @@ * Adds the property as a 'Belongs To' relationship field | ||
*/ | ||
export declare function BelongsToField(parent: typeof Model | string, foreignKey: string, ownerKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function HasManyByField(parent: typeof Model | string, foreignKey: string, ownerKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function HasManyThroughField(related: typeof Model | string, through: typeof Model | string, firstKey: string, secondKey: string, localKey?: string, secondLocalKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function BelongsToManyField(related: typeof Model | string, pivot: typeof Model | string, foreignPivotKey: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function MorphToField(id: string, type: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function MorphOneField(related: typeof Model | string, id: string, type: string, localKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function MorphManyField(related: typeof Model | string, id: string, type: string, localKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function MorphToManyField(related: typeof Model | string, pivot: typeof Model | string, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function MorphedByManyField(related: typeof Model | string, pivot: typeof Model | string, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
export declare function BelongsToField(parent: typeof Model | string, foreignKey: string, ownerKey?: string): (target: Object, propertyName: string | symbol) => void; | ||
export declare function HasManyByField(parent: typeof Model | string, foreignKey: string, ownerKey?: string): (target: Object, propertyName: string | symbol) => void; | ||
export declare function HasManyThroughField(related: typeof Model | string, through: typeof Model | string, firstKey: string, secondKey: string, localKey?: string, secondLocalKey?: string): (target: Object, propertyName: string | symbol) => void; | ||
export declare function BelongsToManyField(related: typeof Model | string, pivot: typeof Model | string, foreignPivotKey: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): (target: Object, propertyName: string | symbol) => void; | ||
export declare function MorphToField(id: string, type: string): (target: Object, propertyName: string | symbol) => void; | ||
export declare function MorphOneField(related: typeof Model | string, id: string, type: string, localKey?: string): (target: Object, propertyName: string | symbol) => void; | ||
export declare function MorphManyField(related: typeof Model | string, id: string, type: string, localKey?: string): (target: Object, propertyName: string | symbol) => void; | ||
export declare function MorphToManyField(related: typeof Model | string, pivot: typeof Model | string, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): (target: Object, propertyName: string | symbol) => void; | ||
export declare function MorphedByManyField(related: typeof Model | string, pivot: typeof Model | string, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): (target: Object, propertyName: string | symbol) => void; |
{ | ||
"name": "vuex-orm-decorators", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Simple Typescript decorators to improve the vuex-orm experience in Typescript by introducing typed property access.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -29,5 +29,6 @@ import { Model, Attribute } from '@vuex-orm/core'; | ||
* @param defaultValue The default value for the field (if undefined the default will be '') | ||
* @param mutator Mutate the given value | ||
*/ | ||
export function StringField(defaultValue?: string) { | ||
return Field(Model.string(defaultValue || '')); | ||
export function StringField(defaultValue?: string, mutator?: Mutator<string | null>) { | ||
return Field(Model.string(defaultValue || '', mutator)); | ||
} | ||
@@ -52,6 +53,7 @@ | ||
* Adds the property as a generic attribute field | ||
* @param defaultValue The default value for the field (if undiefine dthe default will be '') | ||
* @param defaultValue The default value for the field (if undefined the default will be '') | ||
* @param mutator Mutate the given value | ||
*/ | ||
export function AttrField(defaultValue?: any) { | ||
return Field(Model.attr(defaultValue)); | ||
export function AttrField(defaultValue?: any, mutator?: Mutator<any>) { | ||
return Field(Model.attr(defaultValue, mutator)); | ||
} | ||
@@ -62,5 +64,6 @@ | ||
* @param defaultValue The default value for the field (if undefined the default will be 0) | ||
* @param mutator Mutate the given value | ||
*/ | ||
export function NumberField(defaultValue?: number) { | ||
return Field(Model.number(defaultValue || 0)); | ||
export function NumberField(defaultValue?: number, mutator?: Mutator<number | null>) { | ||
return Field(Model.number(defaultValue || 0, mutator)); | ||
} | ||
@@ -71,5 +74,6 @@ | ||
* @param defaultValue The default value for the field (if undefined the default will be FALSE) | ||
* @param mutator Mutate the given value | ||
*/ | ||
export function BooleanField(value: any, mutator?: Mutator<boolean | null>) { | ||
return Field(Model.boolean(value, mutator)); | ||
export function BooleanField(defaultValue: any, mutator?: Mutator<boolean | null>) { | ||
return Field(Model.boolean(defaultValue, mutator)); | ||
} | ||
@@ -76,0 +80,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38766
495