Move fxn into its own module

This commit is contained in:
charrondev 2016-11-22 12:51:15 -05:00
parent 1508f1fcba
commit b31a80276c
4 changed files with 83 additions and 67 deletions

64
fxn/index.d.ts vendored Normal file
View File

@ -0,0 +1,64 @@
// Type definitions for fxn 0.0.1
// Project: https://fgithub.com/poly/fxn
// Definitions by: Adam Charron <https://github.com/charrondev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS';
export interface HttpHeaders {
[item: string]: string;
}
export abstract class Controller {
protected _method: HttpMethod;
protected _path: string;
protected _requestHeaders: Object;
protected _headers: Object;
protected _status: number;
protected _responder: Function;
protected _securityPolicies: Object;
protected params: any;
constructor(path: string, method: string, requestHeaders: Object, params: Object, responder: Function);
convertMethod(method: HttpMethod, id: number): string;
run(): void;
notImplemented(msg: string, details: Object): boolean;
before(): void;
after(): void;
get(): void;
put(): void;
post(): void;
del(): void;
options(): void;
index(): void;
show(): void;
update(): void;
create(): void;
destroy(): void;
status(value: number): boolean;
setHeaders(): HttpHeaders;
setHeader(key: string, value: string): string;
appendHeader(key: string, value: string): string;
getHeader(key: string, value: string): string;
code(code: number): number;
getStatus(): number;
render(data: Buffer | String | Object): void;
allowOrigin(value: string): this;
securityPolicy(directive: string, src: string): string;
redirect(location: string): void;
}
export abstract class Daemon {
constructor(string: string);
}
export abstract class Application {
constructor(string: string);
send: Function;
}
export abstract class Router {}
export abstract class Scheduler {}

18
fxn/tsconfig.json Normal file
View File

@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts"
]
}

65
nodal/fxn.d.ts vendored
View File

@ -1,65 +0,0 @@
/// <reference types="node"/>
declare module "fxn" {
namespace fxn {
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS';
interface HttpHeaders {
[item: string]: string;
}
abstract class Controller {
protected _method: HttpMethod;
protected _path: string;
protected _requestHeaders: Object;
protected _headers: Object;
protected _status: number;
protected _responder: Function;
protected _securityPolicies: Object;
protected params: any;
constructor(path: string, method: string, requestHeaders: Object, params: Object, responder: Function);
convertMethod(method: HttpMethod, id: number): string;
run(): void;
notImplemented(msg: string, details: Object): boolean;
before(): void;
after(): void;
get(): void;
put(): void;
post(): void;
del(): void;
options(): void;
index(): void;
show(): void;
update(): void;
create(): void;
destroy(): void;
status(value: number): boolean;
setHeaders(): HttpHeaders;
setHeader(key: string, value: string): string;
appendHeader(key: string, value: string): string;
getHeader(key: string, value: string): string;
code(code: number): number;
getStatus(): number;
render(data: Buffer | String | Object): void;
allowOrigin(value: string): this;
securityPolicy(directive: string, src: string): string;
redirect(location: string): void;
}
abstract class Daemon {
constructor(string: string);
}
abstract class Application {
constructor(string: string);
send: Function;
}
abstract class Router {}
abstract class Scheduler {}
}
export = fxn;
}

View File

@ -14,7 +14,6 @@
},
"files": [
"index.d.ts",
"nodal-tests.ts",
"fxn.d.ts"
"nodal-tests.ts"
]
}