├── .gitignore
├── .npmignore
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── doc
└── CHANGELOG.md
├── package.json
├── src
├── Library
│ ├── Application
│ │ ├── Application.ts
│ │ ├── ApplicationConfigType.ts
│ │ ├── ApplicationEvents.ts
│ │ ├── ApplicationModes.ts
│ │ └── index.ts
│ ├── Cli
│ │ ├── Cli.ts
│ │ ├── CliConfigType.ts
│ │ ├── CliService.ts
│ │ ├── CliServiceFactory.ts
│ │ ├── CliTypes.ts
│ │ └── index.ts
│ ├── Command
│ │ ├── AbstractCommand.ts
│ │ ├── CommandManager.ts
│ │ ├── CommandManagerConfigType.ts
│ │ ├── CommandManagerFactory.ts
│ │ ├── HelpCommand.ts
│ │ └── index.ts
│ ├── Config
│ │ ├── Config.ts
│ │ ├── ConfigInterface.ts
│ │ ├── ControllerManagerConfigType.ts
│ │ ├── LoggerConfigInterface.ts
│ │ ├── ModuleManagerConfigInterface.ts
│ │ ├── ResponseConfigInterface.ts
│ │ ├── RouterConfigInterface.ts
│ │ ├── ServerConfigInterface.ts
│ │ └── index.ts
│ ├── Controller
│ │ ├── AbstractActionController.ts
│ │ ├── ControllerManager.ts
│ │ ├── ControllerManagerFactory.ts
│ │ ├── ControllerTypes.ts
│ │ └── index.ts
│ ├── Core
│ │ ├── Types.ts
│ │ └── index.ts
│ ├── Error
│ │ ├── InvalidActionResultError.ts
│ │ ├── InvalidArgumentError.ts
│ │ ├── NotFoundError.ts
│ │ └── index.ts
│ ├── EventManager
│ │ ├── Event.ts
│ │ ├── EventManager.ts
│ │ ├── EventManagerFactory.ts
│ │ ├── EventManagerTypes.ts
│ │ ├── SharedEventManager.ts
│ │ └── index.ts
│ ├── Interface
│ │ ├── ContextInterface.ts
│ │ └── index.ts
│ ├── Logger
│ │ ├── LoggerService.ts
│ │ ├── LoggerServiceFactory.ts
│ │ └── index.ts
│ ├── Middleware
│ │ ├── AbstractMiddleware.ts
│ │ ├── DispatchMiddleware.ts
│ │ ├── MiddlewareInterface.ts
│ │ ├── MiddlewareTypes.ts
│ │ ├── RequestMiddleware.ts
│ │ ├── RouterMiddleware.ts
│ │ └── index.ts
│ ├── ModuleManager
│ │ ├── ModuleClassInterface.ts
│ │ ├── ModuleInterface.ts
│ │ ├── ModuleManager.ts
│ │ ├── ModuleManagerEvents.ts
│ │ ├── ModuleManagerFactory.ts
│ │ └── index.ts
│ ├── Output
│ │ ├── Output.ts
│ │ └── index.ts
│ ├── Response
│ │ ├── AbstractResponseHelper.ts
│ │ ├── ClientErrorResponse.ts
│ │ ├── InformationalResponse.ts
│ │ ├── RedirectionResponse.ts
│ │ ├── Response.ts
│ │ ├── ResponseService.ts
│ │ ├── ResponseServiceFactory.ts
│ │ ├── ResponseStrategies.ts
│ │ ├── ResponseTypes.ts
│ │ ├── ServerErrorResponse.ts
│ │ ├── SuccessfulResponse.ts
│ │ └── index.ts
│ ├── Router
│ │ ├── RegisteredRouteInterface.ts
│ │ ├── Route.ts
│ │ ├── RouteInterface.ts
│ │ ├── RouterService.ts
│ │ ├── RouterServiceFactory.ts
│ │ └── index.ts
│ ├── Server
│ │ ├── HttpStatusCodes.ts
│ │ ├── RequestMethods.ts
│ │ ├── ServerService.ts
│ │ ├── ServerServiceFactory.ts
│ │ └── index.ts
│ ├── ServiceManager
│ │ ├── AbstractFileBasedPluginManager.ts
│ │ ├── AbstractPluginManager.ts
│ │ ├── FactoryInterface.ts
│ │ ├── FileBasedPluginManagerConfigType.ts
│ │ ├── FileBasedPluginType.ts
│ │ ├── InjectedServiceFactory.ts
│ │ ├── ServiceManager.ts
│ │ ├── ServiceManagerConfigInterface.ts
│ │ ├── ServiceManagerInterface.ts
│ │ ├── decorators
│ │ │ ├── config.ts
│ │ │ ├── index.ts
│ │ │ ├── inject.ts
│ │ │ └── patch.ts
│ │ └── index.ts
│ └── index.ts
├── config
│ ├── cli.ts
│ ├── command.ts
│ ├── index.ts
│ ├── logger.ts
│ ├── response.ts
│ ├── routes.ts
│ ├── server.ts
│ └── services.ts
├── debug.ts
└── index.ts
├── stix.svg
├── test
└── Library
│ ├── Config
│ └── Config.test.ts
│ └── ServiceManager
│ └── ServiceManager.test.ts
├── tsconfig.json
├── tslint.json
├── typings
└── yargs-parser
│ └── index.d.ts
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | dist
2 | rlib-cov
3 | *.seed
4 | *.log
5 | *.out
6 | *.pid
7 | npm-debug.log
8 | *~
9 | *#
10 | .DS_STORE
11 | .netbeans
12 | nbproject
13 | node_modules
14 | .idea
15 | .node_history
16 | .nyc_output
17 | .vscode
18 | notes.md
19 | _book
20 | .data
21 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | test
2 | rlib-cov
3 | *.seed
4 | *.log
5 | *.out
6 | *.pid
7 | npm-debug.log
8 | *~
9 | *#
10 | .DS_STORE
11 | .netbeans
12 | nbproject
13 | node_modules
14 | .idea
15 | .node_history
16 | .vscode
17 | notes.md
18 | .travis.yml
19 | .gitignore
20 | wallaby.js
21 | yarn.lock
22 | .data
23 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | We'd love for you to contribute and to make this project even better!
4 | If this interests you, please begin by reading our [contributing guidelines](https://github.com/SpoonX/about/blob/master/CONTRIBUTING.md), which will provide you with all the information you need to get started.
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2018 SpoonX
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # 
5 |
6 | [](https://spoonx-slack.herokuapp.com)
7 |
8 | A module-based, TypeScript-first Node.js® framework.
9 |
10 |

11 |
12 | [Documentation](https://stixjs.io/docs/the-basics/about-stix) - [Website](https://stixjs.io/)
13 |
14 |
15 | ## Usage
16 |
17 | All repositories in a nice list. I like lists.
18 |
19 | - [stix-cli](https://github.com/SpoonX/stix-cli): the cli for your project and its own commands. Includes autocomplete.
20 | - [stix-gates](https://github.com/SpoonX/stix-gates): security and enrichments for your endpoints.
21 | - [stix-wetland](https://github.com/SpoonX/stix-wetland): a stix module for Wetland ORM.
22 | - [stix-swagger](https://github.com/SpoonX/stix-swagger): automatically generate swagger docs based on your stix app.
23 | - [stix-skeleton](https://github.com/SpoonX/stix-skeleton): the official stix skeleton, also used by `stix init`.
24 | - [stix-generator](https://github.com/SpoonX/stix-generator): code generators for stix projects.
25 | - [tape-roller](https://github.com/SpoonX/tape-roller): makes manipulating code projects easier with helpers for packages, files and git.
26 |
27 | ## License
28 |
29 | MIT.
30 |
--------------------------------------------------------------------------------
/doc/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [4.5.2](https://github.com/SpoonX/stix/compare/v4.5.1...v4.5.2) (2019-03-30)
2 |
3 |
4 | ### Bug Fixes
5 |
6 | * **inject:** apply proper metadata hierarchy to prevent unneeded DI ([1647992](https://github.com/SpoonX/stix/commit/1647992))
7 |
8 |
9 |
10 | ## [4.5.1](https://github.com/SpoonX/stix/compare/v4.5.0...v4.5.1) (2019-03-30)
11 |
12 |
13 | ### Bug Fixes
14 |
15 | * **Router:** only remove existing route ([4598ba2](https://github.com/SpoonX/stix/commit/4598ba2))
16 |
17 |
18 |
19 | # [4.5.0](https://github.com/SpoonX/stix/compare/v4.4.0...v4.5.0) (2019-03-26)
20 |
21 |
22 | ### Bug Fixes
23 |
24 | * **Router:** prevent duplicate route listeners ([ebc8a48](https://github.com/SpoonX/stix/commit/ebc8a48))
25 |
26 |
27 | ### Features
28 |
29 | * **ControllerManager:** add debug logging for controller manager ([547d39d](https://github.com/SpoonX/stix/commit/547d39d))
30 | * **ModuleManager:** await init on modules ([833b4d9](https://github.com/SpoonX/stix/commit/833b4d9))
31 |
32 |
33 |
34 | # [4.4.0](https://github.com/SpoonX/stix/compare/v4.3.2...v4.4.0) (2019-03-26)
35 |
36 |
37 |
38 | ## [4.3.2](https://github.com/SpoonX/stix/compare/v4.3.1...v4.3.2) (2019-01-28)
39 |
40 |
41 | ### Bug Fixes
42 |
43 | * **Config:** gracefully handle incorrect config merges ([ca7d4e2](https://github.com/SpoonX/stix/commit/ca7d4e2))
44 |
45 |
46 |
47 |
48 | ## [4.3.1](https://github.com/SpoonX/stix/compare/v4.3.0...v4.3.1) (2018-11-22)
49 |
50 |
51 | ### Bug Fixes
52 |
53 | * **Application:** apply user config last without ref ([f892774](https://github.com/SpoonX/stix/commit/f892774))
54 |
55 |
56 | ### Features
57 |
58 | * **Response:** add data accessor ([1d946ee](https://github.com/SpoonX/stix/commit/1d946ee))
59 |
60 |
61 |
62 |
63 | # [4.3.0](https://github.com/SpoonX/stix/compare/v4.2.3...v4.3.0) (2018-11-20)
64 |
65 |
66 | ### Features
67 |
68 | * **decorators:** add config decorator ([ea61c09](https://github.com/SpoonX/stix/commit/ea61c09))
69 |
70 |
71 |
72 |
73 | ## [4.2.3](https://github.com/SpoonX/stix/compare/v4.2.2...v4.2.3) (2018-11-06)
74 |
75 |
76 |
77 |
78 | ## [4.2.2](https://github.com/SpoonX/stix/compare/v4.2.1...v4.2.2) (2018-11-06)
79 |
80 |
81 | ### Bug Fixes
82 |
83 | * **Route:** fix types for route ([4efa06d](https://github.com/SpoonX/stix/commit/4efa06d))
84 |
85 |
86 |
87 |
88 | ## [4.2.1](https://github.com/SpoonX/stix/compare/v4.2.0...v4.2.1) (2018-11-01)
89 |
90 |
91 | ### Bug Fixes
92 |
93 | * **AbstractFileBasedPluginManager:** graceful continue when no plugins are found ([66e4cfc](https://github.com/SpoonX/stix/commit/66e4cfc))
94 | * **CommandManager:** gracefully fail when there are no plugins ([85f59a0](https://github.com/SpoonX/stix/commit/85f59a0))
95 | * **ControllerManager:** gracefully fail when there are no plugins ([601f9b3](https://github.com/SpoonX/stix/commit/601f9b3))
96 | * **ModuleManager:** gracefully fail when there are no modules ([460be4c](https://github.com/SpoonX/stix/commit/460be4c))
97 |
98 |
99 | ### Features
100 |
101 | * **project:** add logo ([bc7e112](https://github.com/SpoonX/stix/commit/bc7e112))
102 |
103 |
104 |
105 |
106 | # [4.2.0](https://github.com/SpoonX/stix/compare/v4.1.7...v4.2.0) (2018-10-07)
107 |
108 |
109 | ### Bug Fixes
110 |
111 | * **Response:** set response type for html ([445c008](https://github.com/SpoonX/stix/commit/445c008))
112 |
113 |
114 | ### Features
115 |
116 | * **Application:** add environment helper method ([ba59e3e](https://github.com/SpoonX/stix/commit/ba59e3e))
117 | * **RequestMiddleware:** make patchContext async ([1f1c4a2](https://github.com/SpoonX/stix/commit/1f1c4a2))
118 | * **Response:** add file and html responses ([682c7af](https://github.com/SpoonX/stix/commit/682c7af))
119 | * **ServerService:** add SSL support and url helper ([ce80b56](https://github.com/SpoonX/stix/commit/ce80b56))
120 |
121 |
122 |
123 |
124 | ## [4.1.7](https://github.com/SpoonX/stix/compare/v4.1.6...v4.1.7) (2018-10-06)
125 |
126 |
127 |
128 |
129 | ## [4.1.6](https://github.com/SpoonX/stix/compare/v4.1.5...v4.1.6) (2018-10-06)
130 |
131 |
132 | ### Features
133 |
134 | * **Output:** add multiple pieces of data at once ([2163981](https://github.com/SpoonX/stix/commit/2163981))
135 |
136 |
137 |
138 |
139 | ## [4.1.5](https://github.com/SpoonX/stix/compare/v4.1.4...v4.1.5) (2018-10-04)
140 |
141 |
142 | ### Bug Fixes
143 |
144 | * **CliService:** properly parse arguments ([cfc7aaa](https://github.com/SpoonX/stix/commit/cfc7aaa))
145 |
146 |
147 |
148 |
149 | ## [4.1.4](https://github.com/SpoonX/stix/compare/v4.1.3...v4.1.4) (2018-10-04)
150 |
151 |
152 | ### Bug Fixes
153 |
154 | * **AbstractFileBasedPluginManager:** fix regex to also match files not ending in a d ([8299d65](https://github.com/SpoonX/stix/commit/8299d65))
155 |
156 |
157 |
158 |
159 | ## [4.1.3](https://github.com/SpoonX/stix/compare/v4.1.2...v4.1.3) (2018-10-04)
160 |
161 |
162 | ### Bug Fixes
163 |
164 | * **AbstractFileBasedPluginManager:** fix regex to also match files ending in a d ([b62028c](https://github.com/SpoonX/stix/commit/b62028c))
165 | * **Application:** actually set application mode ([cf5cc97](https://github.com/SpoonX/stix/commit/cf5cc97))
166 | * **CommandManager:** fix typings for getCommand ([a32ae6d](https://github.com/SpoonX/stix/commit/a32ae6d))
167 | * **Output:** call toString on all tables for output ([dc7a509](https://github.com/SpoonX/stix/commit/dc7a509))
168 | * **Output:** call toString on table for output ([65866ea](https://github.com/SpoonX/stix/commit/65866ea))
169 |
170 |
171 | ### Features
172 |
173 | * **CliService:** validate and pass options ([33fafcc](https://github.com/SpoonX/stix/commit/33fafcc))
174 |
175 |
176 |
177 |
178 | ## [4.1.2](https://github.com/SpoonX/stix/compare/v4.1.1...v4.1.2) (2018-09-30)
179 |
180 |
181 | ### Bug Fixes
182 |
183 | * **Middleware:** fix typings for middleware ([e19a606](https://github.com/SpoonX/stix/commit/e19a606))
184 |
185 |
186 |
187 |
188 | ## [4.1.1](https://github.com/SpoonX/stix/compare/v4.1.0...v4.1.1) (2018-09-30)
189 |
190 |
191 |
192 |
193 | # [4.1.0](https://github.com/SpoonX/stix/compare/v4.0.1...v4.1.0) (2018-09-30)
194 |
195 |
196 | ### Features
197 |
198 | * **project:** add AbstractResponseHelper ([bea2b59](https://github.com/SpoonX/stix/commit/bea2b59))
199 |
200 |
201 |
202 |
203 | ## [4.0.1](https://github.com/SpoonX/stix/compare/v4.0.0...v4.0.1) (2018-09-30)
204 |
205 |
206 | ### Bug Fixes
207 |
208 | * **typings:** add [@types](https://github.com/types) to typeRoots ([7f8fd13](https://github.com/SpoonX/stix/commit/7f8fd13))
209 |
210 |
211 |
212 |
213 | # [4.0.0](https://github.com/SpoonX/stix/compare/v3.0.1...v4.0.0) (2018-09-30)
214 |
215 |
216 | ### Features
217 |
218 | * **Application:** allow application to be booted without starting ([47fb705](https://github.com/SpoonX/stix/commit/47fb705))
219 | * **Config:** deduping of arrays in patch ([7bbef0c](https://github.com/SpoonX/stix/commit/7bbef0c))
220 | * **Error:** add InvalidArgumentError ([14f9421](https://github.com/SpoonX/stix/commit/14f9421))
221 | * **Output:** add Output class for commands ([36526f4](https://github.com/SpoonX/stix/commit/36526f4))
222 | * **project:** add CLI support ([13fb231](https://github.com/SpoonX/stix/commit/13fb231))
223 | * **project:** add commands for CLI ([eb555ae](https://github.com/SpoonX/stix/commit/eb555ae))
224 | * **project:** add default command config with invokable command ([47a2c9a](https://github.com/SpoonX/stix/commit/47a2c9a))
225 | * **project:** add default help command for cli ([29bb39e](https://github.com/SpoonX/stix/commit/29bb39e))
226 | * **project:** add middleware classes ([c25d6e0](https://github.com/SpoonX/stix/commit/c25d6e0))
227 | * **ServiceManager:** and and implement file based plugin manager ([5e5d5ed](https://github.com/SpoonX/stix/commit/5e5d5ed))
228 |
229 |
230 |
231 |
232 | ## [3.0.1](https://github.com/SpoonX/stix/compare/v3.0.0...v3.0.1) (2018-09-25)
233 |
234 |
235 | ### Features
236 |
237 | * **project:** add support for running in ts-node ([d892ba7](https://github.com/SpoonX/stix/commit/d892ba7))
238 |
239 |
240 |
241 |
242 | # [3.0.0](https://github.com/SpoonX/stix/compare/v2.0.0...v3.0.0) (2018-09-24)
243 |
244 |
245 | ### Code Refactoring
246 |
247 | * **ControllerManager:** force the default use of references ([d266f90](https://github.com/SpoonX/stix/commit/d266f90))
248 |
249 |
250 | ### Features
251 |
252 | * **project:** added [@inject](https://github.com/inject) and [@patch](https://github.com/patch) decorators for greatly simplified DI ([b8305bf](https://github.com/SpoonX/stix/commit/b8305bf))
253 | * **project:** expose namespaced debug logger for modules ([34e6fc9](https://github.com/SpoonX/stix/commit/34e6fc9))
254 | * **Router:** export registered routes ([13805e0](https://github.com/SpoonX/stix/commit/13805e0))
255 | * **ServiceManager:** implement InjectedServiceFactory for [@inject](https://github.com/inject) DI ([e6e179d](https://github.com/SpoonX/stix/commit/e6e179d))
256 |
257 |
258 | ### BREAKING CHANGES
259 |
260 | * **ControllerManager:** this change now registers controllers that were loaded from directories by reference, as invokables. This was needed to cater to Injectables. If you didn't use the recommended reference pattern for controllers, this means you'll have to add aliases for your controllers.
261 |
262 |
263 |
264 |
265 | # [2.0.0](https://github.com/SpoonX/stix/compare/v1.0.2...v2.0.0) (2018-09-22)
266 |
267 |
268 | ### Features
269 |
270 | * **Config:** implement formalized Config service ([9f9ad5f](https://github.com/SpoonX/stix/commit/9f9ad5f))
271 | * **Controller:** load from multiple locations ([069edd5](https://github.com/SpoonX/stix/commit/069edd5))
272 | * **Logger:** create EventManager ([b61522b](https://github.com/SpoonX/stix/commit/b61522b))
273 | * **Logger:** create Logger service ([dc5afc2](https://github.com/SpoonX/stix/commit/dc5afc2))
274 | * **ModuleManager:** implement formalized module system ([6af926e](https://github.com/SpoonX/stix/commit/6af926e))
275 | * **project:** add core types ([4e44d2f](https://github.com/SpoonX/stix/commit/4e44d2f))
276 | * **Server:** add robust middleware support ([6996b9c](https://github.com/SpoonX/stix/commit/6996b9c))
277 | * **ServiceManager:** fix typings and add support for shareable services ([6b12b66](https://github.com/SpoonX/stix/commit/6b12b66))
278 |
279 |
280 |
281 |
282 | ## [1.0.2](https://github.com/SpoonX/stix/compare/v1.0.1...v1.0.2) (2018-09-21)
283 |
284 |
285 | ### Bug Fixes
286 |
287 | * **project:** fix typing locations ([5a6d150](https://github.com/SpoonX/stix/commit/5a6d150))
288 |
289 |
290 |
291 |
292 | ## [1.0.1](https://github.com/SpoonX/stix/compare/v1.0.0...v1.0.1) (2018-09-21)
293 |
294 |
295 |
296 |
297 | # [1.0.0](https://github.com/SpoonX/stix/compare/v0.2.2...v1.0.0) (2018-09-21)
298 |
299 |
300 | ### Features
301 |
302 | * **project:** setup tests and add config with Map support ([3a492b4](https://github.com/SpoonX/stix/commit/3a492b4))
303 | * **ServiceManager:** implement the service manager ([d778841](https://github.com/SpoonX/stix/commit/d778841))
304 |
305 |
306 |
307 |
308 | ## [0.2.2](https://github.com/SpoonX/stix/compare/v0.2.1...v0.2.2) (2018-09-18)
309 |
310 |
311 | ### Bug Fixes
312 |
313 | * **Config:** add missing RoutesConfigInterface export ([80cec7b](https://github.com/SpoonX/stix/commit/80cec7b))
314 |
315 |
316 |
317 |
318 | ## [0.2.1](https://github.com/SpoonX/stix/compare/v0.2.0...v0.2.1) (2018-09-18)
319 |
320 |
321 | ### Bug Fixes
322 |
323 | * **middleware:** fix Middleware typing ([4dce743](https://github.com/SpoonX/stix/commit/4dce743))
324 |
325 |
326 |
327 |
328 | # [0.2.0](https://github.com/SpoonX/stix/compare/v0.1.3...v0.2.0) (2018-09-18)
329 |
330 |
331 |
332 |
333 | ## [0.1.3](https://github.com/SpoonX/stix/compare/v0.1.2...v0.1.3) (2018-09-18)
334 |
335 |
336 |
337 |
338 | ## [0.1.2](https://github.com/SpoonX/stix/compare/v0.1.1...v0.1.2) (2018-09-18)
339 |
340 |
341 |
342 |
343 | ## [0.1.1](https://github.com/SpoonX/stix/compare/v0.1.0...v0.1.1) (2018-09-18)
344 |
345 |
346 | ### Bug Fixes
347 |
348 | * **Library:** add Module exports and use ControllerType ([c2f2553](https://github.com/SpoonX/stix/commit/c2f2553))
349 |
350 |
351 |
352 |
353 | # [0.1.0](https://github.com/SpoonX/stix/compare/v0.0.4...v0.1.0) (2018-09-18)
354 |
355 |
356 | ### Features
357 |
358 | * **Controller:** expose ControllerType ([9de95c8](https://github.com/SpoonX/stix/commit/9de95c8))
359 |
360 |
361 |
362 |
363 | ## [0.0.4](https://github.com/SpoonX/stix/compare/v0.0.3...v0.0.4) (2018-09-18)
364 |
365 |
366 |
367 |
368 | ## [0.0.3](https://github.com/SpoonX/stix/compare/v0.0.2...v0.0.3) (2018-09-18)
369 |
370 |
371 |
372 |
373 | ## [0.0.2](https://github.com/SpoonX/stix/compare/v0.0.1...v0.0.2) (2018-09-18)
374 |
375 |
376 |
377 |
378 | ## 0.0.1 (2018-09-18)
379 |
380 |
381 |
382 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "stix",
3 | "version": "4.5.2",
4 | "description": "A module-based, TypeScript-first Node.js® framework.",
5 | "repository": {
6 | "type": "git",
7 | "url": "git+https://github.com/SpoonX/stix.git"
8 | },
9 | "author": "RWOverdijk ",
10 | "main": "./dist/index.js",
11 | "files": [
12 | "dist"
13 | ],
14 | "types": "dist/index.d.ts",
15 | "keywords": [
16 | "api",
17 | "framework",
18 | "typescript",
19 | "tsc",
20 | "koa",
21 | "koajs",
22 | "node",
23 | "wetland"
24 | ],
25 | "bugs": {
26 | "url": "https://github.com/SpoonX/stix/issues"
27 | },
28 | "homepage": "https://github.com/SpoonX/stix",
29 | "scripts": {
30 | "test": "jest",
31 | "build": "tsc --build tsconfig.json",
32 | "dev": "tsc --build -w tsconfig.json",
33 | "prepare": "yarn build",
34 | "version": "conventional-changelog -p angular -i doc/CHANGELOG.md -s && git add -A doc/CHANGELOG.md",
35 | "postpublish": "git push upstream master && git push upstream --tags"
36 | },
37 | "jest": {
38 | "transform": {
39 | "^.+\\.tsx?$": "ts-jest"
40 | },
41 | "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(ts?)$",
42 | "moduleFileExtensions": [
43 | "ts",
44 | "js"
45 | ]
46 | },
47 | "devDependencies": {
48 | "@types/jest": "^24.0.19",
49 | "jest": "^24.9.0",
50 | "ts-jest": "^24.1.0",
51 | "tslint": "^5.11.0",
52 | "tslint-config-prettier": "^1.15.0",
53 | "tslint-eslint-rules": "^5.4.0",
54 | "typescript": "^3.0.3"
55 | },
56 | "dependencies": {
57 | "@koa/cors": "^2.2.2",
58 | "@types/bytes": "^3.0.0",
59 | "@types/cli-table": "^0.3.0",
60 | "@types/clone": "^0.1.30",
61 | "@types/command-line-usage": "^5.0.1",
62 | "@types/debug": "^0.0.30",
63 | "@types/koa": "^2.0.46",
64 | "@types/koa-bodyparser": "^5.0.1",
65 | "@types/koa-send": "^4.1.1",
66 | "@types/koa__cors": "^2.2.3",
67 | "@types/node": "^10.9.4",
68 | "@types/prettyjson": "^0.0.28",
69 | "chalk": "^2.4.1",
70 | "cli-table": "^0.3.1",
71 | "clone": "^2.1.2",
72 | "command-line-usage": "^5.0.5",
73 | "debug": "^4.0.1",
74 | "koa": "^2.5.3",
75 | "koa-bodyparser": "^4.2.1",
76 | "koa-send": "^5.0.0",
77 | "path-to-regexp": "^2.4.0",
78 | "pretty-error": "^2.1.1",
79 | "prettyjson": "^1.2.1",
80 | "reflect-metadata": "^0.1.12",
81 | "winston": "^3.1.0",
82 | "yargs-parser": "^10.1.0"
83 | },
84 | "license": "MIT"
85 | }
86 |
--------------------------------------------------------------------------------
/src/Library/Application/Application.ts:
--------------------------------------------------------------------------------
1 | import clone from 'clone';
2 | import { ServerService } from '../Server';
3 | import { ModuleManager, ModuleManagerFactory } from '../ModuleManager';
4 | import { Config, ConfigType } from '../Config';
5 | import { FactoryInterface, ServiceManager } from '../ServiceManager';
6 | import { EventManager, EventManagerFactory, SharedEventManager } from '../EventManager';
7 | import { ApplicationEvents } from './ApplicationEvents';
8 | import { Instantiable } from '../Core';
9 | import { createDebugLogger } from '../../debug';
10 | import * as defaultConfig from '../../config';
11 | import { CliService } from '../Cli';
12 | import { ApplicationModes } from './ApplicationModes';
13 |
14 | const debug = createDebugLogger('application');
15 |
16 | export class Application {
17 | private mode: ApplicationModes;
18 |
19 | private readonly environment: string = process.env.NODE_ENV || 'development';
20 |
21 | private readonly config: Config;
22 |
23 | private readonly serviceManager: ServiceManager;
24 |
25 | private readonly applicationConfigs: ConfigType[];
26 |
27 | private moduleManager: ModuleManager;
28 |
29 | private sharedEventManager: SharedEventManager;
30 |
31 | public constructor (...appConfigs: ConfigType[]) {
32 | this.applicationConfigs = appConfigs;
33 | this.config = new Config(defaultConfig, ...clone(this.applicationConfigs));
34 | this.serviceManager = new ServiceManager({
35 | aliases: { config: Config, sharedEventManager: SharedEventManager },
36 | invokables: new Map, Instantiable