Permalink
Browse files

feat(typescript): Upgrad to typescript 2.0, extract execeptions to co…

…mmon to stop browser linking server modules, remove typings, remove

BREAKING CHANGE:
You typescript 2.0 lands with this release, with it comes a total refactor on how tsconfig is used. To see the recommended implementation, review the changes in ubiquits/quickstart#22
  • Loading branch information...
zakhenry committed Jul 19, 2016
1 parent 3da128a commit 4aa3446daf448c5ff50d3dbc4d36468457eaa3e0
View
@@ -1 +0,0 @@
export * from './lib/browser/index';
View
@@ -1,5 +0,0 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require('./lib/browser'));
View
@@ -1 +0,0 @@
export * from './lib/browser/index';
View
@@ -1 +0,0 @@
export * from './lib/common/index';
View
@@ -1,5 +0,0 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require('./lib/common'));
View
@@ -1 +0,0 @@
export * from './lib/common/index';
View
No changes.
View
No changes.
View
No changes.
View
@@ -9,7 +9,6 @@
"test": "u test -s",
"coveralls": "u coveralls",
"build": "u build",
"postinstall": "typings install",
"postpublish": "u deploy docs"
},
"repository": {
@@ -53,13 +52,24 @@
"timestamp": "0.0.1",
"typeorm": "0.0.2-alpha.43",
"vantage": "^1.7.0",
"zone.js": "^0.6.12"
},
"devDependencies": {
"@ubiquits/toolchain": "^0.1.42",
"zone.js": "^0.6.12",
"@types/chalk": "^0.4.28",
"@types/chance": "^0.7.28",
"@types/dotenv": "^2.0.17",
"@types/express": "^4.0.29",
"@types/express-serve-static-core": "^4.0.29",
"@types/hapi": "^13.0.28",
"@types/jasmine": "^2.2.29",
"@types/lodash": "0.0.27",
"@types/moment": "^2.11.28",
"@types/node": "^4.0.29",
"@types/proxyquire": "^1.3.26",
"@types/socket.io": "^1.4.26",
"@types/validator": "^4.5.26",
"@ubiquits/toolchain": "^0.2.0",
"proxyquire": "^1.7.10"
},
"directories": {
"doc": "docs"
}
}
}
View
@@ -1 +0,0 @@
export * from './lib/server/index';
View
@@ -1,5 +0,0 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require('./lib/server'));
@@ -1,5 +1,5 @@
/**
* @module server
* @module common
*/
/** End Typedoc Module Declaration */
import { ValidationError } from 'class-validator';
@@ -1,5 +1,5 @@
/**
* @module server
* @module common
*/
/** End Typedoc Module Declaration */
export * from './exceptions';
View
@@ -19,3 +19,4 @@ export * from './stores';
export * from './validation';
export * from './services';
export * from './registry';
export * from './exeptions';
@@ -1,15 +1,5 @@
import { UUID, AbstractModel } from './model';
import { Primary } from './types/primary.decorator';
import Moment = moment.Moment;
class ChildModel extends AbstractModel {
@Primary()
public id: string;//UUID;
public name: string;
}
class BasicModel extends AbstractModel {
@@ -1,4 +1,7 @@
import Moment = moment.Moment;
/**
* @module common
*/
/** End Typedoc Module Declaration */
import { HasOne } from './hasOne.decorator';
import { AbstractModel } from '../model';
import { Primary } from '../types/primary.decorator';
@@ -1,4 +1,3 @@
import Moment = moment.Moment;
import { ThumbModel } from './thumb.model.fixture';
import { HandModel } from './hand.model.fixture';
@@ -27,6 +26,10 @@ describe('Model Relations', () => {
.get('hand').foreign)
.toEqual(HandModel);
expect(relations.get('belongsTo')
.get('hand').viaProperty(new HandModel({handId:1})))
.toEqual(1);
});
});
@@ -1,4 +1,7 @@
import Moment = moment.Moment;
/**
* @module common
*/
/** End Typedoc Module Declaration */
import { AbstractModel } from '../model';
import { Primary } from '../types/primary.decorator';
import { BelongsTo } from './belongsTo.decorator';
@@ -4,7 +4,6 @@
/** End Typedoc Module Declaration */
import { Injectable } from '@angular/core';
import { AbstractService } from './service';
import { InternalServerErrorException } from '../../server/exeptions/exceptions';
/**
* Syslog Levels
@@ -9,8 +9,6 @@ import { Injector } from '@angular/core';
import { Chance } from 'chance';
import * as _ from 'lodash';
export type ChanceInstance = Chance.Chance;
/**
* Provides abstract class to build concrete mock stores which can create new mock instances of
* models.
@@ -21,7 +19,7 @@ export abstract class MockStore<T extends AbstractModel> extends AbstractStore<T
* Instance of chancejs
* @see http://chancejs.com
*/
protected chanceInstance: ChanceInstance;
protected chanceInstance: Chance.Chance;
protected modelCollection: Collection<T>;
@@ -45,7 +43,7 @@ export abstract class MockStore<T extends AbstractModel> extends AbstractStore<T
* @param seed
* @returns {ChanceInstance}
*/
protected chance(seed?: any): ChanceInstance {
protected chance(seed?: any): Chance.Chance {
if (!this.chanceInstance || !!seed) {
this.chanceInstance = new Chance(seed);
}
@@ -9,10 +9,10 @@ import {
ValidatorConstraint,
ValidatorConstraintInterface
} from '../validation';
import { ValidationException } from '../../server/exeptions/exceptions';
import { Primary } from '../models/types/primary.decorator';
import Spy = jasmine.Spy;
import { Collection } from '../models/collection';
import { ValidationException } from '../exeptions/exceptions';
@Injectable()
class StubService {
@@ -5,8 +5,8 @@
import { identifier, ModelStatic, AbstractModel } from '../models/model';
import { Injector } from '@angular/core';
import { Collection } from '../models/collection';
import { ValidationException } from '../../server/exeptions/exceptions';
import { ValidatorOptions, ValidationError, getValidator, Validator } from '../validation';
import { ValidationException } from '../exeptions/exceptions';
export interface Query {
}
@@ -10,7 +10,7 @@ import { Request } from './request';
import { Response } from './response';
import { AbstractController } from './abstract.controller';
import { Route } from './route.decorator';
import { UnavailableForLegalReasonsException } from '../exeptions/exceptions';
import { UnavailableForLegalReasonsException } from '../../common/exeptions/exceptions';
@Injectable()
class TestController extends AbstractController {
@@ -10,9 +10,9 @@ import { PromiseFactory } from '../../common/util/serialPromise';
import { Response } from './response';
import { Request } from './request';
import { initializeMiddlewareRegister } from '../middleware/middleware.decorator';
import { HttpException, InternalServerErrorException } from '../exeptions/exceptions';
import { RegistryEntityStatic, RegistryEntity } from '../../common/registry/entityRegistry';
import { ControllerMetadata } from '../../common/metadata/metadata';
import { InternalServerErrorException, HttpException } from '../../common/exeptions/exceptions';
export interface MethodDefinition {
method: HttpMethod;
@@ -1,7 +1,10 @@
import { Request } from '../controllers/request';
import { IncomingMessage } from 'http';
import { EventEmitter } from 'events';
import { PayloadTooLargeException, UnprocessableEntityException } from '../exeptions/exceptions';
import {
UnprocessableEntityException,
PayloadTooLargeException
} from '../../common/exeptions/exceptions';
describe('Request', () => {
@@ -3,8 +3,11 @@
*/
/** End Typedoc Module Declaration */
import { IncomingMessage } from 'http';
import { UnprocessableEntityException, PayloadTooLargeException } from '../exeptions/exceptions';
import EventEmitter = NodeJS.EventEmitter;
import {
PayloadTooLargeException,
UnprocessableEntityException
} from '../../common/exeptions/exceptions';
/**
* Request class that is passed into all middleware and controller methods to extract data from the
@@ -12,7 +12,7 @@ import { Request } from './request';
import { AbstractStore } from '../../common/stores/store';
import { Collection } from '../../common/models/collection';
import { ValidatorOptions } from '../../common/validation';
import { NotFoundException } from '../exeptions/exceptions';
import { NotFoundException } from '../../common/exeptions/exceptions';
/**
* Provides resource controller that all controllers that interact RESTfully with ModelStores
View
@@ -23,4 +23,3 @@ export * from './seeders';
export * from './migrations';
export * from './stores';
export * from './middleware';
export * from './exeptions';
@@ -7,10 +7,10 @@ import { DatabaseStore } from './db.store';
import { AbstractModel } from '../../common/models/model';
import { Primary } from '../../common/models/types/primary.decorator';
import { StoredProperty } from '../../common/models/types/storedProperty.decorator';
import { NotFoundException } from '../exeptions/exceptions';
import { Collection } from '../../common/models/collection';
import { DatabaseMock } from '../services/database.service.mock';
import Spy = jasmine.Spy;
import { NotFoundException } from '../../common/exeptions/exceptions';
class TestModel extends AbstractModel {
@@ -8,8 +8,8 @@ import { Database } from '../services/database.service';
import { Logger } from '../../common/services/logger.service';
import { AbstractStore, Query } from '../../common/stores/store';
import { Collection } from '../../common/models/collection';
import { NotFoundException } from '../exeptions/exceptions';
import { Repository, Connection } from 'typeorm';
import { NotFoundException } from '../../common/exeptions/exceptions';
/**
* Database store should be extended with a specific implementation for a model. Interacts with
@@ -9,19 +9,21 @@
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"declaration": true
"declaration": true,
"outDir": "lib",
"sourceRoot": "src",
"types": [
"node",
"jasmine",
"socket.io"
]
},
"exclude": [
"node_modules",
"lib",
"dist",
"index.ts",
"index.d.ts",
"server.ts",
"server.d.ts",
"browser.ts",
"browser.d.ts",
"common.ts",
"common.d.ts"
"dist"
],
"include": [
"src/**/*"
]
}
View
@@ -8,22 +8,17 @@
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
"suppressImplicitAnyIndexErrors": true,
"sourceRoot": "src",
"outDir": "dist/browser",
"types": [
"jasmine"
]
},
"exclude": [
"node_modules",
"lib",
"dist",
"src/server",
"index.ts",
"index.d.ts",
"server.ts",
"server.d.ts",
"browser.ts",
"browser.d.ts",
"common.ts",
"common.d.ts",
"browser.d.ts"
"src/server"
]
}
View
@@ -0,0 +1,31 @@
{
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"declaration": false,
"outDir": "dist/server",
"sourceRoot": "src",
"inlineSources": true,
"types": [
"node",
"jasmine",
"socket.io"
]
},
"exclude": [
"node_modules",
"lib",
"dist",
"src/browser"
],
"include": [
"src/**/*"
]
}
View
@@ -1,21 +0,0 @@
{
"globalDependencies": {
"chance": "registry:dt/chance#0.7.3+20160317120654",
"dotenv": "registry:dt/dotenv#2.0.0+20160327131627",
"express": "registry:dt/express#4.0.0+20160317120654",
"express-serve-static-core": "registry:dt/express-serve-static-core#0.0.0+20160701212727",
"hapi": "registry:dt/hapi#13.0.0+20160602125023",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"moment-node": "registry:dt/moment-node#2.11.1+20160511043338",
"node": "registry:dt/node#6.0.0+20160621231320",
"serve-static": "registry:dt/serve-static#0.0.0+20160606155157",
"socket.io": "registry:dt/socket.io#1.4.4+20160317120654",
"validator": "registry:dt/validator#4.5.1+20160316155526"
},
"dependencies": {
"chalk": "registry:npm/chalk#1.0.0+20160211003958",
"lodash": "registry:npm/lodash#4.0.0+20160701205107",
"mime": "registry:npm/mime#1.3.0+20160423043021",
"proxyquire": "registry:npm/proxyquire#1.0.0+20160211003958"
}
}

0 comments on commit 4aa3446

Please sign in to comment.