kamboja-core
Advanced tools
Comparing version 0.4.0-alpha.be62ddac to 0.4.0-alpha.bed61e37
@@ -14,7 +14,12 @@ /// <reference types="node" /> | ||
export declare type MiddlewareFactory = (opt: KambojaOption) => MiddlewaresType; | ||
export declare const MethodDecorator: (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; | ||
export declare class Decorator { | ||
internal(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; | ||
/** | ||
* Add type metadata information | ||
* @param typ Qualified name of the type | ||
*/ | ||
type(typ: string): (...target: any[]) => void; | ||
} | ||
export declare class HttpDecorator { | ||
ignore(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; | ||
root(route: string): (constructor: Function) => void; | ||
@@ -26,3 +31,3 @@ get(route?: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; | ||
delete(route?: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; | ||
event(route: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; | ||
on(event: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; | ||
} | ||
@@ -157,2 +162,3 @@ export declare class BinderDecorator { | ||
export interface BaseController { | ||
context: HttpRequest | Handshake; | ||
validator: Validator; | ||
@@ -274,3 +280,3 @@ } | ||
export interface SocketEvent { | ||
type: "Broadcast" | "Private" | "Room"; | ||
type: "Broadcast" | "Private"; | ||
name: string; | ||
@@ -290,4 +296,9 @@ id?: string | string[]; | ||
constructor(body: any, status?: number | undefined, type?: string | undefined); | ||
emit(event: SocketEvent): this; | ||
execute(context: HttpRequest | Handshake, response: Response, routeInfo?: RouteInfo): Promise<void>; | ||
setHeader(key: string, value: string | string[]): this; | ||
setCookie(key: string, value: string, options?: CookieOptions): this; | ||
setStatus(status: number): this; | ||
setType(type: string): this; | ||
broadcast(event: string, data?: any): this; | ||
emit(event: string, id: string | string[], data?: any): this; | ||
execute(context: HttpRequest | Handshake, response: Response, routeInfo?: RouteInfo): void; | ||
} | ||
@@ -294,0 +305,0 @@ export declare function getRouteDetail(info: RouteInfo): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
require("reflect-metadata"); | ||
exports.ValidationTypesAccepted = ["string", "string[]", "number", "number[]", "boolean", "boolean[]", "date", "date[]"]; | ||
exports.MethodDecorator = function (target, propertyKey, descriptor) { }; | ||
var Decorator = (function () { | ||
function Decorator() { | ||
} | ||
Decorator.prototype.internal = function () { return function (target, propertyKey, descriptor) { }; }; | ||
/** | ||
* Add type metadata information | ||
* @param typ Qualified name of the type | ||
*/ | ||
Decorator.prototype.type = function (typ) { return function () { | ||
@@ -22,9 +25,10 @@ var target = []; | ||
} | ||
HttpDecorator.prototype.ignore = function () { return exports.MethodDecorator; }; | ||
HttpDecorator.prototype.root = function (route) { return function (constructor) { }; }; | ||
HttpDecorator.prototype.get = function (route) { return function (target, propertyKey, descriptor) { }; }; | ||
HttpDecorator.prototype.post = function (route) { return function (target, propertyKey, descriptor) { }; }; | ||
HttpDecorator.prototype.put = function (route) { return function (target, propertyKey, descriptor) { }; }; | ||
HttpDecorator.prototype.patch = function (route) { return function (target, propertyKey, descriptor) { }; }; | ||
HttpDecorator.prototype.delete = function (route) { return function (target, propertyKey, descriptor) { }; }; | ||
HttpDecorator.prototype.event = function (route) { return function (target, propertyKey, descriptor) { }; }; | ||
HttpDecorator.prototype.get = function (route) { return exports.MethodDecorator; }; | ||
HttpDecorator.prototype.post = function (route) { return exports.MethodDecorator; }; | ||
HttpDecorator.prototype.put = function (route) { return exports.MethodDecorator; }; | ||
HttpDecorator.prototype.patch = function (route) { return exports.MethodDecorator; }; | ||
HttpDecorator.prototype.delete = function (route) { return exports.MethodDecorator; }; | ||
HttpDecorator.prototype.on = function (event) { return exports.MethodDecorator; }; | ||
return HttpDecorator; | ||
@@ -104,15 +108,34 @@ }()); | ||
} | ||
ActionResult.prototype.emit = function (event) { | ||
ActionResult.prototype.setHeader = function (key, value) { | ||
this.header[key] = value; | ||
return this; | ||
}; | ||
ActionResult.prototype.setCookie = function (key, value, options) { | ||
if (!this.cookies) | ||
this.cookies = []; | ||
this.cookies.push({ key: key, value: value, options: options }); | ||
return this; | ||
}; | ||
ActionResult.prototype.setStatus = function (status) { | ||
this.status = status; | ||
return this; | ||
}; | ||
ActionResult.prototype.setType = function (type) { | ||
this.type = type; | ||
return this; | ||
}; | ||
ActionResult.prototype.broadcast = function (event, data) { | ||
if (!this.events) | ||
this.events = []; | ||
this.events.push(event); | ||
this.events.push({ type: "Broadcast", name: event, payload: data || this.body }); | ||
return this; | ||
}; | ||
ActionResult.prototype.emit = function (event, id, data) { | ||
if (!this.events) | ||
this.events = []; | ||
this.events.push({ type: "Private", id: id, name: event, payload: data || this.body }); | ||
return this; | ||
}; | ||
ActionResult.prototype.execute = function (context, response, routeInfo) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
response.send(this); | ||
return [2 /*return*/]; | ||
}); | ||
}); | ||
response.send(this); | ||
}; | ||
@@ -119,0 +142,0 @@ return ActionResult; |
{ | ||
"name": "kamboja-core", | ||
"version": "0.4.0-alpha.be62ddac", | ||
"version": "0.4.0-alpha.bed61e37", | ||
"description": "Core library of KambojaJS", | ||
@@ -22,5 +22,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@types/lodash": "^4.14.66", | ||
"@types/node": "^8.0.1", | ||
"kecubung": "0.4.0-alpha.be62ddac", | ||
"@types/lodash": "^4.14.71", | ||
"@types/node": "^8.0.19", | ||
"kecubung": "0.4.0-alpha.bed61e37", | ||
"lodash": "^4.17.4", | ||
@@ -31,6 +31,6 @@ "reflect-metadata": "^0.1.10", | ||
"devDependencies": { | ||
"@types/chai": "^4.0.0", | ||
"@types/chai": "^4.0.2", | ||
"@types/mocha": "^2.2.41", | ||
"@types/sinon": "^2.3.1", | ||
"chai": "^4.0.2", | ||
"@types/sinon": "^2.3.3", | ||
"chai": "^4.1.0", | ||
"coveralls": "^2.13.1", | ||
@@ -42,8 +42,8 @@ "del": "^3.0.0", | ||
"gulp-sourcemaps": "^2.6.0", | ||
"gulp-typescript": "^3.1.7", | ||
"mocha": "^3.4.2", | ||
"run-sequence": "^1.2.2", | ||
"sinon": "^2.3.5", | ||
"typescript": "^2.3.4" | ||
"gulp-typescript": "^3.2.1", | ||
"mocha": "^3.5.0", | ||
"run-sequence": "^2.1.0", | ||
"sinon": "^3.0.0", | ||
"typescript": "^2.4.2" | ||
} | ||
} |
21148
493
+ Addedkecubung@0.4.0-alpha.bed61e37(transitive)
- Removedkecubung@0.4.0-alpha.be62ddac(transitive)
Updated@types/lodash@^4.14.71
Updated@types/node@^8.0.19