diff --git a/fxn/index.d.ts b/fxn/index.d.ts new file mode 100644 index 0000000000..f203ebfdda --- /dev/null +++ b/fxn/index.d.ts @@ -0,0 +1,64 @@ +// Type definitions for fxn 0.0.1 +// Project: https://fgithub.com/poly/fxn +// Definitions by: Adam Charron +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +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 {} diff --git a/fxn/tsconfig.json b/fxn/tsconfig.json new file mode 100644 index 0000000000..0f2be78cfb --- /dev/null +++ b/fxn/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/nodal/fxn.d.ts b/nodal/fxn.d.ts deleted file mode 100644 index 1344d69782..0000000000 --- a/nodal/fxn.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/// - -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; -} diff --git a/nodal/tsconfig.json b/nodal/tsconfig.json index d8e0c99bb5..b9bc3ba19a 100644 --- a/nodal/tsconfig.json +++ b/nodal/tsconfig.json @@ -14,7 +14,6 @@ }, "files": [ "index.d.ts", - "nodal-tests.ts", - "fxn.d.ts" + "nodal-tests.ts" ] } \ No newline at end of file