vuex-orm-decorators
Advanced tools
Comparing version 1.1.9 to 1.2.0
@@ -28,2 +28,9 @@ import { Model } from '@vuex-orm/core'; | ||
/** | ||
* Adds the property as a uid field | ||
* @param value optional function that makes a custom a uid | ||
*/ | ||
export function UidField(value) { | ||
return Field(Model.uid(value)); | ||
} | ||
/** | ||
* Adds the property as an incremental field | ||
@@ -30,0 +37,0 @@ */ |
@@ -0,0 +0,0 @@ import VuexORM from '@vuex-orm/core'; |
export { OrmModel } from './model'; | ||
export { ORMDatabase } from './database'; | ||
export { AttrField, BelongsToField, BelongsToManyField, BooleanField, Field, HasManyByField, HasManyField, HasManyThroughField, HasOneField, IncrementField, MorphManyField, MorphOneField, MorphToField, MorphToManyField, MorphedByManyField, NumberField, PrimaryKey, StringField } from './attributes'; | ||
export { AttrField, BelongsToField, BelongsToManyField, BooleanField, Field, HasManyByField, HasManyField, HasManyThroughField, HasOneField, IncrementField, MorphManyField, MorphOneField, MorphToField, MorphToManyField, MorphedByManyField, NumberField, PrimaryKey, StringField, UidField } from './attributes'; | ||
//# sourceMappingURL=index.js.map |
@@ -0,0 +0,0 @@ import { ORMDatabase } from './database'; |
@@ -16,7 +16,12 @@ import { Model, Attribute } from '@vuex-orm/core'; | ||
*/ | ||
export declare function StringField(defaultValue?: string): (target: Object, propertyName: string | symbol) => void; | ||
export declare function StringField(defaultValue?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
/** | ||
* Adds the property as a uid field | ||
* @param value optional function that makes a custom a uid | ||
*/ | ||
export declare function UidField(value?: () => string | number): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
/** | ||
* Adds the property as an incremental field | ||
*/ | ||
export declare function IncrementField(): (target: Object, propertyName: string | symbol) => void; | ||
export declare function IncrementField(): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
/** | ||
@@ -26,3 +31,3 @@ * Adds the property as a generic attribute field | ||
*/ | ||
export declare function AttrField(defaultValue?: any): (target: Object, propertyName: string | symbol) => void; | ||
export declare function AttrField(defaultValue?: any): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
/** | ||
@@ -32,3 +37,3 @@ * Adds the property as a number typed field | ||
*/ | ||
export declare function NumberField(defaultValue?: number): (target: Object, propertyName: string | symbol) => void; | ||
export declare function NumberField(defaultValue?: number): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
/** | ||
@@ -38,3 +43,3 @@ * Adds the property as a boolean typed field | ||
*/ | ||
export declare function BooleanField(value: any, mutator?: Mutator<boolean | null>): (target: Object, propertyName: string | symbol) => void; | ||
export declare function BooleanField(value: any, mutator?: Mutator<boolean | null>): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
/** | ||
@@ -46,3 +51,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: string | symbol) => void; | ||
export declare function HasManyField(related: typeof Model | string, foreignKey: string, localKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
/** | ||
@@ -54,3 +59,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: string | symbol) => void; | ||
export declare function HasOneField(related: typeof Model | string, foreignKey: string, localKey?: string): (target: Object, propertyName: import("vue/types/options").InjectKey) => void; | ||
/** | ||
@@ -62,10 +67,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: 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; | ||
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; |
@@ -0,0 +0,0 @@ import { Model } from '@vuex-orm/core'; |
export { OrmModel } from './model'; | ||
export { ORMDatabase } from './database'; | ||
export { AttrField, BelongsToField, BelongsToManyField, BooleanField, Field, HasManyByField, HasManyField, HasManyThroughField, HasOneField, IncrementField, MorphManyField, MorphOneField, MorphToField, MorphToManyField, MorphedByManyField, NumberField, PrimaryKey, StringField } from './attributes'; | ||
export { AttrField, BelongsToField, BelongsToManyField, BooleanField, Field, HasManyByField, HasManyField, HasManyThroughField, HasOneField, IncrementField, MorphManyField, MorphOneField, MorphToField, MorphToManyField, MorphedByManyField, NumberField, PrimaryKey, StringField, UidField } from './attributes'; |
@@ -0,0 +0,0 @@ import { Model } from '@vuex-orm/core'; |
{ | ||
"name": "vuex-orm-decorators", | ||
"version": "1.1.9", | ||
"version": "1.2.0", | ||
"description": "Simple Typescript decorators to improve the vuex-orm experience in Typescript by introducing typed property access.", | ||
@@ -25,7 +25,7 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@vuex-orm/core": "^0.32.1", | ||
"typescript": "^3.6.2", | ||
"@vuex-orm/core": "^0.34.0", | ||
"typescript": "^3.7.2", | ||
"vue": "^2.6.10", | ||
"vuex": "^3.1.1" | ||
"vuex": "^3.1.2" | ||
} | ||
} |
@@ -74,3 +74,3 @@ # vuex-orm-decorators | ||
import { Model } from '@vuex-orm/core' | ||
import { AttrField, StringField } from 'vuex-orm-decorators' | ||
import { AttrField, OrmModel, StringField } from 'vuex-orm-decorators' | ||
@@ -95,3 +95,3 @@ | ||
import { Model } from '@vuex-orm/core'; | ||
import { AttrField, StringField } from 'vuex-orm-decorators'; | ||
import { AttrField, OrmModel, StringField } from 'vuex-orm-decorators'; | ||
@@ -120,3 +120,3 @@ | ||
import { Model } from '@vuex-orm/core'; | ||
import { AttrField, StringField } from 'vuex-orm-decorators'; | ||
import { AttrField, OrmModel, StringField } from 'vuex-orm-decorators'; | ||
@@ -145,2 +145,6 @@ | ||
### Uid | ||
To create [uid field](https://vuex-orm.github.io/vuex-orm/guide/model/defining-models.html#uid-type) which use the ```@UidField``` decorator. | ||
### Auto Increment | ||
@@ -147,0 +151,0 @@ |
@@ -35,2 +35,10 @@ import { Model, Attribute } from '@vuex-orm/core'; | ||
/** | ||
* Adds the property as a uid field | ||
* @param value optional function that makes a custom a uid | ||
*/ | ||
export function UidField(value?: () => string | number) { | ||
return Field(Model.uid(value)); | ||
} | ||
/** | ||
* Adds the property as an incremental field | ||
@@ -37,0 +45,0 @@ */ |
@@ -0,0 +0,0 @@ import VuexORM, { Model, Database } from '@vuex-orm/core'; |
@@ -11,3 +11,3 @@ import { Attribute, Model } from '@vuex-orm/core'; | ||
MorphOneField, MorphToField, MorphToManyField, MorphedByManyField, NumberField, | ||
PrimaryKey, StringField | ||
PrimaryKey, StringField, UidField | ||
} from './attributes'; |
@@ -0,0 +0,0 @@ import { Model } from '@vuex-orm/core'; |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
38252
25
483
173