-
Notifications
You must be signed in to change notification settings - Fork 32
/
mod.ts
122 lines (104 loc) · 3.93 KB
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// Version bumps:
// console/install.deno
// README.md
// REQUIREMENTS.md
// Compilers
// TODO(crookse) use docable when docable has TypeScript types developed
import doc_blocks_to_json from "./src/compilers/doc_blocks_to_json.ts";
// Dictionaries
import * as log_levels from "./src/dictionaries/log_levels.ts";
// Exceptions
import http_exception from "./src/exceptions/http_exception.ts";
import http_middleware_exception from "./src/exceptions/http_middleware_exception.ts";
import http_response_exception from "./src/exceptions/http_response_exception.ts";
// Http
import middleware from "./src/http/middleware.ts";
import resource from "./src/http/resource.ts";
import response from "./src/http/response.ts";
import server from "./src/http/server.ts";
// Loggers
import base_logger from "./src/loggers/logger.ts";
import console_logger from "./src/loggers/console_logger.ts";
import file_logger from "./src/loggers/file_logger.ts";
// Services
import http_service from "./src/services/http_service.ts";
import http_request_service from "./src/services/http_request_service.ts";
// Util
import util_object_parser from "./src/util/object_parser.ts";
import * as util_members from "./src/util/members.ts";
////////////////////////////////////////////////////////////////////////////////
// FILE MARKER: NAMESPACE - DRASH //////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
// Usage: import Drash from "/path/to/drash/mod.ts";
//
namespace Drash {
export namespace Compilers {
export type DocBlocksToJson = doc_blocks_to_json;
export const DocBlocksToJson = doc_blocks_to_json;
}
export namespace Dictionaries {
export const LogLevels = log_levels.LogLevels;
// export namespace Enums {
// export const LogLevel = log_levels.LogLevel;
// }
}
export namespace Exceptions {
export type HttpException = http_exception;
export const HttpException = http_exception;
export type HttpMiddlewareException = http_middleware_exception;
export const HttpMiddlewareException = http_middleware_exception;
export type HttpResponseException = http_response_exception;
export const HttpResponseException = http_response_exception;
}
export namespace Loggers {
export type ConsoleLogger = console_logger;
export const ConsoleLogger = console_logger;
export type FileLogger = file_logger;
export const FileLogger = file_logger;
export type Logger = base_logger;
export const Logger = base_logger;
}
export namespace Http {
export type Middleware = middleware;
export let Middleware = middleware;
export type Resource = resource;
export const Resource = resource;
export type Response = response;
export let Response = response;
export type Server = server;
export const Server = server;
}
export namespace Services {
export type HttpService = http_service;
export const HttpService = new http_service();
export type HttpRequestService = http_request_service;
export const HttpRequestService = new http_request_service();
}
export namespace Util {
export type ObjectParser = util_object_parser;
export const ObjectParser = util_object_parser;
export const Exports = util_members;
}
/**
* A property to hold all members added via `Drash.addMember()`. This property
* allows users to access members via `Drash.Members.SomeMember` and acts like
* a namespace for members that are external to Drash.
*
* @property Drash.Members Members
*/
export const Members: any = {};
/**
* Add an app to the Members namespace. After adding an app, you can use the
* app via `Drash.Members.YourApp.doSomething()`.
*
* @param string name
* The app's name which can be accessed via `Drash.Members[name]`.
* @param any app
* The app.
*/
export function addMember(name: string, app: any) {
this.Members[name] = app;
}
}
export default Drash;