fixed problem with decorators-shim

This commit is contained in:
Umed Khudoiberdiev 2016-12-07 09:28:53 +05:00
parent 2637e9ccfb
commit 393d1ec587
7 changed files with 201 additions and 211 deletions

View File

@ -1,3 +1,8 @@
# 0.0.4
* fixed problem when `order by` is used with `limit`
* fixed problem when `decorators-shim.d.ts` exist and does not allow to import decorators (treats like they exist in global)
# 0.0.3
* completely refactored persistence mechanism:

177
extra/decorators-shim.js Normal file
View File

@ -0,0 +1,177 @@
// this "shim" can be used on the frontend to prevent from errors on undefined
// decorators in the models, when you are sharing same models across backend and frontend
// columns
/* export */ function Column(typeOrOptions, options) {
return function (object, propertyName) {
};
}
/* export */ function CreateDateColumn(options) {
return function (object, propertyName) {
};
}
/* export */ function DiscriminatorColumn(discriminatorOptions) {
return function (object, propertyName) {
};
}
/* export */ function PrimaryColumn(typeOrOptions, options) {
return function (object, propertyName) {
};
}
/* export */ function PrimaryGeneratedColumn(options) {
return function (object, propertyName) {
};
}
/* export */ function UpdateDateColumn(options) {
return function (object, propertyName) {
};
}
/* export */ function VersionColumn(options) {
return function (object, propertyName) {
};
}
// listeners
/* export */ function AfterInsert() {
return function (object, propertyName) {
};
}
/* export */ function AfterLoad() {
return function (object, propertyName) {
};
}
/* export */ function AfterRemove() {
return function (object, propertyName) {
};
}
/* export */ function AfterUpdate() {
return function (object, propertyName) {
};
}
/* export */ function BeforeInsert() {
return function (object, propertyName) {
};
}
/* export */ function BeforeRemove() {
return function (object, propertyName) {
};
}
/* export */ function BeforeUpdate() {
return function (object, propertyName) {
};
}
/* export */ function EventSubscriber() {
return function (object, propertyName) {
};
}
// relations
/* export */ function JoinColumn(options) {
return function (object, propertyName) {
};
}
/* export */ function JoinTable(options) {
return function (object, propertyName) {
};
}
/* export */ function ManyToMany(typeFunction, inverseSideOrOptions, options) {
return function (object, propertyName) {
};
}
/* export */ function ManyToOne(typeFunction, inverseSideOrOptions, options) {
return function (object, propertyName) {
};
}
/* export */ function OneToMany(typeFunction, inverseSideOrOptions, options) {
return function (object, propertyName) {
};
}
/* export */ function OneToOne(typeFunction, inverseSideOrOptions, options) {
return function (object, propertyName) {
};
}
/* export */ function RelationCount(relation) {
return function (object, propertyName) {
};
}
/* export */ function RelationId(relation) {
return function (object, propertyName) {
};
}
// tables
/* export */ function AbstractTable() {
return function (object) {
};
}
/* export */ function ClassTableChild(tableName, options) {
return function (object) {
};
}
/* export */ function ClosureTable(name, options) {
return function (object) {
};
}
/* export */ function EmbeddableTable() {
return function (object) {
};
}
/* export */ function SingleTableChild() {
return function (object) {
};
}
/* export */ function Table(name, options) {
return function (object) {
};
}
/* export */ function TableInheritance(type) {
return function (object) {
};
}
// tree
/* export */ function TreeChildren(options) {
return function (object, propertyName) {
};
}
/* export */ function TreeLevelColumn() {
return function (object, propertyName) {
};
}
/* export */ function TreeParent(options) {
return function (object, propertyName) {
};
}

View File

@ -240,6 +240,15 @@ export class Gulpfile {
.pipe(gulp.dest("./build/package"));
}
/**
* Copies "decorators-shim.js" file into package.
*/
@Task()
packageCopyDecoratorsShim() {
return gulp.src("./extra/decorators-shim.js")
.pipe(gulp.dest("./build/package"));
}
/**
* Creates a package that can be published to npm.
*/
@ -248,7 +257,13 @@ export class Gulpfile {
return [
"packageCompile",
"packageMoveCompiledFiles",
["packageClearCompileDirectory", "packageReplaceReferences", "packagePreparePackageFile", "packageCopyReadme"],
[
"packageClearCompileDirectory",
"packageReplaceReferences",
"packagePreparePackageFile",
"packageCopyReadme",
"packageCopyDecoratorsShim"
],
];
}

View File

@ -1,7 +1,7 @@
{
"name": "typeorm",
"private": true,
"version": "0.0.3",
"version": "0.0.4-alpha.1",
"description": "Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL databases.",
"license": "MIT",
"readmeFilename": "README.md",

View File

@ -1,7 +1,7 @@
{
"name": "typeorm-browser",
"private": true,
"version": "0.0.3",
"version": "0.0.4-alpha.1",
"description": "Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL databases.",
"license": "MIT",
"readmeFilename": "README.md",

View File

@ -1,207 +0,0 @@
// columns
/* export */
function Column(typeOrOptions?: any, options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function CreateDateColumn(options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function DiscriminatorColumn(discriminatorOptions: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function PrimaryColumn(typeOrOptions?: any, options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function PrimaryGeneratedColumn(options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function UpdateDateColumn(options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function VersionColumn(options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
// listeners
/* export */
function AfterInsert(): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function AfterLoad(): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function AfterRemove(): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function AfterUpdate(): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function BeforeInsert(): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function BeforeRemove(): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function BeforeUpdate(): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function EventSubscriber(): Function {
return function (object: Object, propertyName: string) {
};
}
// relations
/* export */
function JoinColumn(options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function JoinTable(options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function ManyToMany<T>(typeFunction: any, inverseSideOrOptions?: any, options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function ManyToOne<T>(typeFunction: any, inverseSideOrOptions?: any, options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function OneToMany<T>(typeFunction: any, inverseSideOrOptions?: any, options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function OneToOne<T>(typeFunction: any, inverseSideOrOptions?: any, options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function RelationCount<T>(relation: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function RelationId<T>(relation: any): Function {
return function (object: Object, propertyName: string) {
};
}
// tables
/* export */
function AbstractTable(): Function {
return function (object: Object) {
};
}
/* export */
function ClassTableChild(tableName?: any, options?: any): Function {
return function (object: Object) {
};
}
/* export */
function ClosureTable(name?: any, options?: any): Function {
return function (object: Object) {
};
}
/* export */
function EmbeddableTable(): Function {
return function (object: Object) {
};
}
/* export */
function SingleTableChild(): Function {
return function (object: Object) {
};
}
/* export */
function Table(name?: any, options?: any): Function {
return function (object: Object) {
};
}
/* export */
function TableInheritance(type?: any): Function {
return function (object: Object) {
};
}
// tree
/* export */
function TreeChildren(options?: any): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function TreeLevelColumn(): Function {
return function (object: Object, propertyName: string) {
};
}
/* export */
function TreeParent(options?: any): Function {
return function (object: Object, propertyName: string) {
};
}

View File

@ -3,7 +3,7 @@
"compilerOptions": {
"lib": ["es5", "es6", "dom"],
"outDir": "build/compiled",
"target": "es6",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,