Skip to content

Commit

Permalink
include dist
Browse files Browse the repository at this point in the history
  • Loading branch information
joesonw committed Aug 8, 2016
1 parent 16e6640 commit 7591f49
Show file tree
Hide file tree
Showing 21 changed files with 1,031 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules/
dist/
npm-debug.log
coverage/
.DS_Storage
Expand Down
9 changes: 9 additions & 0 deletions dist/context.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference types="chai" />
import * as Koa from 'koa';
import Cookie from './cookie';
interface Context extends Koa.Context {
cookie?: Cookie;
params?: Object;
requestBody?: any;
}
export default Context;
1 change: 1 addition & 0 deletions dist/context.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"use strict";
3 changes: 3 additions & 0 deletions dist/controller.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare abstract class Controller {
}
export default Controller;
5 changes: 5 additions & 0 deletions dist/controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";
class Controller {
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Controller;
13 changes: 13 additions & 0 deletions dist/cookie.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
declare class Cookie {
content: string;
path: string;
secure: boolean;
httpOnly: boolean;
private _expires;
private _maxAge;
constructor();
expires: Date;
maxAge: number;
toString(): string;
}
export default Cookie;
37 changes: 37 additions & 0 deletions dist/cookie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"use strict";
class Cookie {
constructor() {
this.content = '';
this.path = '/';
this.secure = true;
this.httpOnly = true;
this._expires = new Date();
this._maxAge = 0;
}
get expires() {
return this._expires;
}
set expires(date) {
this._maxAge += (Math.floor(date.getTime() / 1000) - Math.floor(this._expires.getTime() / 1000));
this._expires = date;
}
get maxAge() {
return this._maxAge;
}
set maxAge(date) {
this._expires = new Date(this._expires.getTime() + (date - this.maxAge) * 1000);
this._maxAge = date;
}
toString() {
let ret = this.content;
ret += '; Path=' + this.path;
ret += '; Expires=' + this.expires.toUTCString();
if (this.secure)
ret += '; Secure';
if (this.httpOnly)
ret += '; HttpOnly';
return ret;
}
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Cookie;
24 changes: 24 additions & 0 deletions dist/decorators.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Controller from './controller';
import { MediaType } from './util';
import 'reflect-metadata';
export declare function Before(target: Controller, key: string): void;
export declare function After(target: Controller, key: string): void;
export declare function GET(target: Controller, key: string): void;
export declare function POST(target: Controller, key: string): void;
export declare function PUT(target: Controller, key: string): void;
export declare function DELETE(target: Controller, key: string): void;
export declare function Inject(func: Function): (target: Controller, key: string) => void;
export declare function Path(path: string): (target: Controller | (new () => Controller), key?: string) => void;
export declare function Produce(type: MediaType): (target: Controller, key: string) => void;
export declare function Consume(type: MediaType): (target: Controller, key: string) => void;
export declare function QueryParam(param: string): (target: Controller, key: string, index?: number) => void;
export declare function PathParam(param: string): (target: Controller, key: string, index?: number) => void;
export declare function BodyParam(param: string): (target: Controller, key: string, index?: number) => void;
export declare function HeaderParam(param: string): (target: Controller, key: string, index?: number) => void;
export declare function Query(target: Controller, key: string, index?: number): void;
export declare function Params(target: Controller, key: string, index?: number): void;
export declare function Body(target: Controller, key: string, index?: number): void;
export declare function Headers(target: Controller, key: string, index?: number): void;
export declare function AppContext(target: Controller, key: string, index?: number): void;
export declare function HttpContext(target: Controller, key: string, index?: number): void;
export declare function RouteResponse(target: Controller, key: string, index: number): void;

0 comments on commit 7591f49

Please sign in to comment.