5htp-core 0.6.2-91 → 0.6.2-92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp-core",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.6.2-91",
4
+ "version": "0.6.2-92",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -105,6 +105,10 @@ export abstract class Application<
105
105
  this.on('error', (e, request) => this.container.handleBug(e, "An error occured in the application", request));
106
106
 
107
107
  process.on('unhandledRejection', (error: any, promise: any) => {
108
+
109
+ // Log so we know it's coming from unhandledRejection
110
+ console.error("unhandledRejection", error);
111
+
108
112
  // We don't log the error here because it's the role of the app to decidehiw to log errors
109
113
  this.runHook('error', error);
110
114
  });
@@ -55,7 +55,7 @@ export type { default as Request, UploadedFile } from "./request";
55
55
  export type { default as Response, TRouterContext } from "./response";
56
56
  export type { TRoute, TAnyRoute } from '@common/router';
57
57
 
58
- export type TApiRegisterArgs<TRouter extends ServerRouter<Application>> = ([
58
+ export type TApiRegisterArgs<TRouter extends TServerRouter> = ([
59
59
  path: string,
60
60
  controller: TServerController<TRouter>
61
61
  ] | [
@@ -64,7 +64,7 @@ export type TApiRegisterArgs<TRouter extends ServerRouter<Application>> = ([
64
64
  controller: TServerController<TRouter>
65
65
  ])
66
66
 
67
- export type TServerController<TRouter extends ServerRouter<Application>> = (context: TRouterContext<TRouter>) => any;
67
+ export type TServerController<TRouter extends TServerRouter> = (context: TRouterContext<TRouter>) => any;
68
68
 
69
69
  export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS'
70
70
  export type TRouteHttpMethod = HttpMethod | '*';
@@ -83,8 +83,7 @@ export type HttpHeaders = { [cle: string]: string }
83
83
  const LogPrefix = '[router]';
84
84
 
85
85
  export type Config<
86
- TServiceList extends TRouterServicesList,
87
- TAdditionnalSsrData extends {}
86
+ TServices extends TRouterServicesList
88
87
  > = {
89
88
 
90
89
  debug: boolean,
@@ -98,9 +97,9 @@ export type Config<
98
97
  context: (
99
98
  request: ServerRequest<TServerRouter>,
100
99
  app: Application
101
- ) => TAdditionnalSsrData,
100
+ ) => {},
102
101
 
103
- plugins: TServiceList
102
+ plugins: TServices
104
103
  }
105
104
 
106
105
  // Set it as a function, so when we instanciate the services, we can callthis.router to pass the router instance in roiuter services
@@ -118,16 +117,15 @@ export type TControllerDefinition = {
118
117
  controller: TServerController<TServerRouter>,
119
118
  }
120
119
 
121
- export type TServerRouter = ServerRouter<Application, Config<TRouterServicesList, {}>, TRouterServicesList, {}>;
120
+ export type TServerRouter = ServerRouter<Application, TRouterServicesList, Config<TRouterServicesList>>;
122
121
 
123
122
  /*----------------------------------
124
123
  - CLASSE
125
124
  ----------------------------------*/
126
125
  export default class ServerRouter<
127
126
  TApplication extends Application,
128
- TConfig extends Config<TServiceList, TAdditionnalSsrData>,
129
- TServiceList extends TRouterServicesList,
130
- TAdditionnalSsrData extends {}
127
+ TServices extends TRouterServicesList,
128
+ TConfig extends Config<TServices>,
131
129
  >
132
130
  extends Service<TConfig, Hooks, TApplication> implements BaseRouter {
133
131
 
@@ -156,7 +154,7 @@ export default class ServerRouter<
156
154
  - SERVICE
157
155
  ----------------------------------*/
158
156
 
159
- public constructor( ...args: TServiceArgs< ServerRouter<TApplication, TConfig, TServiceList, TAdditionnalSsrData> >) {
157
+ public constructor( ...args: TServiceArgs< ServerRouter<TApplication, TServices, TConfig> >) {
160
158
 
161
159
  super(...args);
162
160
 
@@ -12,7 +12,7 @@ import express from 'express';
12
12
 
13
13
  // Core
14
14
  import { Application } from '@server/app';
15
- import type ServerRouter from '@server/services/router';
15
+ import type { default as ServerRouter, TServerRouter } from '@server/services/router';
16
16
  import ServerRequest from '@server/services/router/request';
17
17
  import { TRoute, TAnyRoute, TDomainsList } from '@common/router';
18
18
  import { NotFound, Forbidden, Anomaly } from '@common/errors';
@@ -38,7 +38,7 @@ export type TBasicSSrData = {
38
38
  domains: TDomainsList
39
39
  }
40
40
 
41
- export type TRouterContext<TRouter extends ServerRouter = ServerRouter> = (
41
+ export type TRouterContext<TRouter extends TServerRouter> = (
42
42
  // Request context
43
43
  {
44
44
  app: TRouter["app"],
@@ -56,13 +56,13 @@ export type TRouterContext<TRouter extends ServerRouter = ServerRouter> = (
56
56
  )
57
57
 
58
58
  export type TRouterContextServices<
59
- TRouter extends ServerRouter<Application>,
59
+ TRouter extends TServerRouter,
60
60
  TPlugins = TRouter["config"]["plugins"]
61
61
  > = (
62
62
  // Custom context via servuces
63
63
  // For each roiuter service, return the request service (returned by roiuterService.requestService() )
64
64
  {
65
- [serviceName in keyof TPlugins]: TPlugins[serviceName]
65
+ [serviceName in keyof TPlugins]: TRouter["config"]["plugins"]//TPlugins[serviceName]
66
66
  }
67
67
  )
68
68
 
package/types/icons.d.ts CHANGED
@@ -1 +1 @@
1
- export type TIcones = "times"|"solid/spinner-third"|"long-arrow-right"|"check-circle"|"chart-bar"|"user-circle"|"rocket"|"user-shield"|"shield-alt"|"chart-line"|"money-bill-wave"|"star"|"link"|"file-alt"|"long-arrow-left"|"crosshairs"|"plane-departure"|"plus-circle"|"comments-alt"|"arrow-right"|"user-plus"|"paper-plane"|"magnet"|"sack-dollar"|"info-circle"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"brands/whatsapp"|"user"|"brands/linkedin"|"at"|"plus"|"minus"|"trash"|"search"|"clock"|"cog"|"ellipsis-h"|"check"|"regular/shield-check"|"angle-down"|"play"|"stop"|"calendar-alt"|"lightbulb"|"phone"|"angle-up"|"solid/crown"|"eye"|"pen"|"file"|"envelope"|"coins"|"download"|"exclamation-circle"|"times-circle"|"arrow-left"|"meh-rolling-eyes"|"bars"|"chevron-left"|"bolt"|"key"|"power-off"|"comment-alt"|"wind"|"minus-circle"|"question-circle"|"broom"|"brands/google"|"copy"|"external-link"|"solid/check-circle"|"solid/exclamation-triangle"|"solid/times-circle"|"hourglass"|"plug"|"coin"|"building"|"briefcase"|"map-marker-alt"|"graduation-cap"|"angle-left"|"angle-right"|"arrow-to-bottom"|"solid/magic"|"globe"|"users"|"industry"|"map-marker"|"calendar"|"fire"|"magic"|"bug"|"binoculars"|"unlink"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"code"|"font"|"empty-set"|"horizontal-rule"|"page-break"|"image"|"table"|"poll"|"columns"|"sticky-note"|"caret-right"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"
1
+ export type TIcones = "times"|"solid/spinner-third"|"long-arrow-right"|"check-circle"|"rocket"|"user-circle"|"plane-departure"|"plus-circle"|"comments-alt"|"chart-bar"|"crosshairs"|"arrow-right"|"user-shield"|"shield-alt"|"chart-line"|"money-bill-wave"|"star"|"link"|"file-alt"|"long-arrow-left"|"calendar-alt"|"paper-plane"|"at"|"phone"|"brands/linkedin"|"search"|"lightbulb"|"magnet"|"user-plus"|"sack-dollar"|"info-circle"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"user"|"brands/whatsapp"|"plus"|"minus"|"trash"|"check"|"clock"|"cog"|"ellipsis-h"|"play"|"stop"|"regular/shield-check"|"angle-down"|"angle-up"|"solid/crown"|"eye"|"pen"|"file"|"envelope"|"coins"|"download"|"exclamation-circle"|"times-circle"|"bars"|"arrow-left"|"meh-rolling-eyes"|"minus-circle"|"chevron-left"|"bolt"|"key"|"power-off"|"comment-alt"|"external-link"|"question-circle"|"wind"|"broom"|"brands/google"|"copy"|"solid/check-circle"|"solid/exclamation-triangle"|"solid/times-circle"|"hourglass"|"users"|"bug"|"binoculars"|"building"|"briefcase"|"map-marker-alt"|"graduation-cap"|"coin"|"plug"|"angle-left"|"angle-right"|"arrow-to-bottom"|"magic"|"solid/magic"|"map-marker"|"fire"|"globe"|"industry"|"calendar"|"code"|"bold"|"italic"|"underline"|"font"|"strikethrough"|"subscript"|"superscript"|"empty-set"|"horizontal-rule"|"page-break"|"image"|"table"|"poll"|"columns"|"sticky-note"|"caret-right"|"unlink"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"