Comparing version 0.0.1-alpha.0848b3b3 to 0.0.1-alpha.18067db3
@@ -74,3 +74,3 @@ "use strict"; | ||
}) | ||
.then(function () { return _this.checkPropertyTypes(_this.constructor.prototype.properties, _this.properties); }) | ||
.then(function () { return _this.checkPropertyTypes(_this.constructor.prototype.propertyTypes, _this.properties); }) | ||
.then( | ||
@@ -138,5 +138,5 @@ // Then, check the properties of the item match up with the propertyTypes provided | ||
}()); | ||
Model.properties = { | ||
id: [PropertyTypes_1.default.string()] | ||
Model.propertyTypes = { | ||
id: [PropertyTypes_1.default.string] | ||
}; | ||
exports.default = Model; |
@@ -30,5 +30,5 @@ "use strict"; | ||
}()); | ||
PropertyTypes.string = function () { return function (o) { return typeof o === 'string'; }; }; | ||
PropertyTypes.number = function () { return function (o) { return typeof o === 'number'; }; }; | ||
PropertyTypes.boolean = function () { return function (o) { return typeof o === 'boolean'; }; }; | ||
PropertyTypes.string = function (o) { return typeof o === 'string'; }; | ||
PropertyTypes.number = function (o) { return typeof o === 'number'; }; | ||
PropertyTypes.boolean = function (o) { return typeof o === 'boolean'; }; | ||
exports.default = PropertyTypes; |
{ | ||
"name": "blvd", | ||
"version": "0.0.1-alpha.0848b3b3", | ||
"version": "0.0.1-alpha.18067db3", | ||
"description": "A framework for building full-stack JS applications.", | ||
"main": "build/index.js", | ||
"main": "./build/index.js", | ||
"types": "./build/index.d.ts", | ||
"scripts": { | ||
"build": "rimraf ./build && tsc", | ||
"lint": "tslint -c ./tslint.json src/**/*.ts", | ||
"lint": "tslint --force -c ./tslint.json src/**/*.ts", | ||
"prepublish": "npm run build" | ||
@@ -22,6 +23,4 @@ }, | ||
"devDependencies": { | ||
"@types/node": "^7.0.8", | ||
"rimraf": "^2.6.1", | ||
"tslint": "^4.5.1", | ||
"tslint-eslint-rules": "^3.4.0", | ||
"typescript": "^2.2.1" | ||
@@ -28,0 +27,0 @@ }, |
import { EventEmitter } from 'events' | ||
import ItemFetcher from './ItemFetcher' | ||
import ItemStorer from './ItemStorer' | ||
import { Status, Result, reduceResults } from '../utils' | ||
import Model from '../model/Model' | ||
import ModelConstructor from '../model/ModelConstructor' | ||
interface ItemFetcher { | ||
<M extends Model>(model: ModelConstructor<M>, index: string): Promise<M> | ||
} | ||
interface ItemStorer { | ||
<M extends Model>(item: M, index: string): Promise<Result> | ||
} | ||
/** | ||
@@ -28,3 +24,2 @@ * A context is an area where Items are stored. A traffic application has two | ||
public async item<M extends Model>(ItemModel: ModelConstructor<M>, index: string): Promise<M> { | ||
@@ -31,0 +26,0 @@ // TODO: This is just a dummy method - Should actually attempt to fetch an item. |
@@ -8,3 +8,3 @@ import { randomBytes } from 'crypto-promise' | ||
interface ObjectThatMightHaveId { | ||
export interface ObjectThatMightHaveId { | ||
id?: string | ||
@@ -28,4 +28,4 @@ } | ||
public static properties: object = { | ||
id: [PropertyTypes.string()] | ||
public static propertyTypes: object = { | ||
id: [PropertyTypes.string] | ||
} | ||
@@ -40,3 +40,3 @@ | ||
}) | ||
.then(() => this.checkPropertyTypes(this.constructor.prototype.properties, this.properties)) | ||
.then(() => this.checkPropertyTypes(this.constructor.prototype.propertyTypes, this.properties)) | ||
.then( | ||
@@ -43,0 +43,0 @@ // Then, check the properties of the item match up with the propertyTypes provided |
@@ -1,2 +0,2 @@ | ||
import PropertyTypeWrapper from './PropertyTypeWrapper' | ||
import PropertyType from './PropertyType' | ||
@@ -26,7 +26,7 @@ /** | ||
class PropertyTypes { | ||
public static string: PropertyTypeWrapper = () => (o: any) => typeof o === 'string' | ||
public static number: PropertyTypeWrapper = () => (o: any) => typeof o === 'number' | ||
public static boolean: PropertyTypeWrapper = () => (o: any) => typeof o === 'boolean' | ||
public static string: PropertyType = (o: any) => typeof o === 'string' | ||
public static number: PropertyType = (o: any) => typeof o === 'number' | ||
public static boolean: PropertyType = (o: any) => typeof o === 'boolean' | ||
} | ||
export default PropertyTypes |
@@ -7,10 +7,8 @@ { | ||
"moduleResolution": "Node", | ||
"lib": ["es2015"] | ||
"lib": ["es2015"], | ||
"declaration": true | ||
}, | ||
"include": [ | ||
"src/**/*.ts" | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
65744
3
33
752