5htp-core 0.5.9-55 → 0.5.9-6
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/client/assets/css/components/card.less +20 -0
- package/client/assets/css/utils/sizing.less +2 -0
- package/client/services/router/request/api.ts +0 -0
- package/package.json +1 -1
- package/server/app/index.ts +3 -3
- package/server/app/service/index.ts +8 -4
- package/server/services/auth/index.ts +1 -7
- package/server/services/database/index.ts +3 -7
- package/server/services/disks/index.ts +3 -7
- package/server/services/email/transporter.ts +1 -1
- package/server/services/router/index.ts +11 -11
- package/server/services/router/service.ts +4 -17
- package/server/services/security/encrypt/aes/index.ts +1 -1
- package/types/icons.d.ts +1 -1
|
@@ -17,6 +17,17 @@
|
|
|
17
17
|
|
|
18
18
|
background-color: var(--cBg);
|
|
19
19
|
padding: @cardPadding;
|
|
20
|
+
box-shadow: 0 3px 2px fade(#000, 10%);
|
|
21
|
+
border: 1px solid fade(#000, 10%);
|
|
22
|
+
|
|
23
|
+
&.floating {
|
|
24
|
+
box-shadow: 0 10px 50px fade(black, 15%);
|
|
25
|
+
z-index: 10;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.minimal {
|
|
29
|
+
box-shadow: none;
|
|
30
|
+
}
|
|
20
31
|
|
|
21
32
|
&.row {
|
|
22
33
|
padding: @cardPadding @cardPaddingLong;
|
|
@@ -48,6 +59,15 @@
|
|
|
48
59
|
}
|
|
49
60
|
}
|
|
50
61
|
|
|
62
|
+
a&,
|
|
63
|
+
&.clickable {
|
|
64
|
+
text-decoration: none; // Remove a underline
|
|
65
|
+
|
|
66
|
+
&:hover {
|
|
67
|
+
border-color: #aaa;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
51
71
|
&.col {
|
|
52
72
|
padding: @cardPadding @cardPaddingLong;
|
|
53
73
|
|
|
File without changes
|
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.5.9-
|
|
4
|
+
"version": "0.5.9-6",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/5htp-core.git",
|
|
7
7
|
"license": "MIT",
|
package/server/app/index.ts
CHANGED
|
@@ -55,7 +55,7 @@ export type ApplicationProperties = Prettify<keyof Application>;
|
|
|
55
55
|
----------------------------------*/
|
|
56
56
|
export abstract class Application<
|
|
57
57
|
TServicesContainer extends ServicesContainerClass = ServicesContainerClass
|
|
58
|
-
> extends ApplicationService<Config, Hooks,
|
|
58
|
+
> extends ApplicationService<Config, Hooks, Application> {
|
|
59
59
|
|
|
60
60
|
public app!: this;
|
|
61
61
|
public servicesContainer!: TServicesContainer;
|
|
@@ -113,7 +113,7 @@ export abstract class Application<
|
|
|
113
113
|
// We can't pass this in super so we assign here
|
|
114
114
|
this.parent = this;
|
|
115
115
|
this.app = this;
|
|
116
|
-
|
|
116
|
+
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/*----------------------------------
|
|
@@ -162,7 +162,7 @@ export abstract class Application<
|
|
|
162
162
|
const instance = service.start();
|
|
163
163
|
this[service.name] = instance.getServiceInstance();
|
|
164
164
|
} catch (error) {
|
|
165
|
-
console.error("Error while starting service", serviceId,
|
|
165
|
+
console.error("Error while starting service", serviceId, error);
|
|
166
166
|
throw error;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -38,7 +38,7 @@ export type StartedServicesIndex = {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export type TServiceArgs<TService extends AnyService> = [
|
|
41
|
-
parent:
|
|
41
|
+
parent: AnyService | 'self',
|
|
42
42
|
getConfig: (instance: TService) => {},
|
|
43
43
|
app: TService['app'] | 'self'
|
|
44
44
|
]
|
|
@@ -134,11 +134,15 @@ export default abstract class Service<
|
|
|
134
134
|
- SUBSERVICES
|
|
135
135
|
----------------------------------*/
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
// TODO:; babel plugin: transform Service references to app.use('Service')
|
|
138
|
+
public use<TService extends AnyService = AnyService>(
|
|
139
|
+
serviceId: string,
|
|
140
|
+
useOptions: { optional?: boolean } = {}
|
|
141
|
+
): TService {
|
|
138
142
|
|
|
139
143
|
const registeredService = this.app.registered[serviceId];
|
|
140
|
-
if (registeredService === undefined)
|
|
141
|
-
throw new Error(`Service ${registeredService} not
|
|
144
|
+
if (registeredService === undefined && useOptions.optional === false)
|
|
145
|
+
throw new Error(`Service ${registeredService} not registered.`);
|
|
142
146
|
|
|
143
147
|
return this.app[ registeredService.name ];
|
|
144
148
|
}
|
|
@@ -49,10 +49,6 @@ export type THooks = {
|
|
|
49
49
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export type TServices = {
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
52
|
export type TBasicUser = {
|
|
57
53
|
type: string,
|
|
58
54
|
name: string,
|
|
@@ -73,13 +69,11 @@ export default abstract class AuthService<
|
|
|
73
69
|
TApplication extends Application,
|
|
74
70
|
TJwtSession extends TBasicJwtSession = TBasicJwtSession,
|
|
75
71
|
TRequest extends ServerRequest<Router> = ServerRequest<Router>,
|
|
76
|
-
> extends Service<TConfig, THooks, TApplication
|
|
72
|
+
> extends Service<TConfig, THooks, TApplication> {
|
|
77
73
|
|
|
78
74
|
public abstract login( ...args: any[] ): Promise<{ user: TUser, token: string }>;
|
|
79
75
|
public abstract decodeSession( jwt: TJwtSession, req: THttpRequest ): Promise<TUser | null>;
|
|
80
76
|
|
|
81
|
-
protected abstract displaySessionName(session: TJwtSession): string;
|
|
82
|
-
|
|
83
77
|
// https://beeceptor.com/docs/concepts/authorization-header/#examples
|
|
84
78
|
public async decode( req: THttpRequest, withData: true ): Promise<TUser | null>;
|
|
85
79
|
public async decode( req: THttpRequest, withData?: false ): Promise<TJwtSession | null>;
|
|
@@ -10,7 +10,7 @@ const safeStringify = require('fast-safe-stringify'); // remplace les référenc
|
|
|
10
10
|
|
|
11
11
|
// Core: general
|
|
12
12
|
import { Application, Services } from '@server/app';
|
|
13
|
-
import Service, { AnyService, TRegisteredServicesIndex } from '@server/app/service';
|
|
13
|
+
import Service, { AnyService, TRegisteredServicesIndex, TServiceArgs } from '@server/app/service';
|
|
14
14
|
import { NotFound } from '@common/errors';
|
|
15
15
|
|
|
16
16
|
// Services
|
|
@@ -95,13 +95,9 @@ export default class SQL extends Service<Config, Hooks, Application> {
|
|
|
95
95
|
|
|
96
96
|
public database: Database;
|
|
97
97
|
|
|
98
|
-
public constructor(
|
|
99
|
-
parent: AnyService,
|
|
100
|
-
config: Config,
|
|
101
|
-
app: Application,
|
|
102
|
-
) {
|
|
98
|
+
public constructor( ...args: TServiceArgs<SQL>) {
|
|
103
99
|
|
|
104
|
-
super(
|
|
100
|
+
super(...args);
|
|
105
101
|
|
|
106
102
|
this.database = new Database(this, this.config);
|
|
107
103
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
// Core
|
|
6
6
|
import type { Application } from '@server/app';
|
|
7
|
-
import Service, { AnyService, TRegisteredServicesIndex } from '@server/app/service';
|
|
7
|
+
import Service, { AnyService, TRegisteredServicesIndex, TServiceArgs } from '@server/app/service';
|
|
8
8
|
|
|
9
9
|
// Specific
|
|
10
10
|
import type Driver from './driver';
|
|
@@ -45,13 +45,9 @@ export default class DisksManager<
|
|
|
45
45
|
- LIFECYCLE
|
|
46
46
|
----------------------------------*/
|
|
47
47
|
|
|
48
|
-
public constructor(
|
|
49
|
-
parent: AnyService,
|
|
50
|
-
config: TConfig,
|
|
51
|
-
app: Application,
|
|
52
|
-
) {
|
|
48
|
+
public constructor( ...args: TServiceArgs<DisksManager>) {
|
|
53
49
|
|
|
54
|
-
super(
|
|
50
|
+
super(...args);
|
|
55
51
|
|
|
56
52
|
const drivers = this.config.drivers;
|
|
57
53
|
|
|
@@ -25,7 +25,7 @@ export type TBasicConfig = {
|
|
|
25
25
|
- CLASS
|
|
26
26
|
----------------------------------*/
|
|
27
27
|
export abstract class Transporter<TConfig extends TBasicConfig = TBasicConfig>
|
|
28
|
-
extends Service<TConfig, {}, Application
|
|
28
|
+
extends Service<TConfig, {}, Application> {
|
|
29
29
|
|
|
30
30
|
public abstract send( emails: TCompleteEmail[] ): Promise<void>;
|
|
31
31
|
}
|
|
@@ -18,7 +18,7 @@ import type { GlobImportedWithMetas } from 'babel-plugin-glob-import';
|
|
|
18
18
|
|
|
19
19
|
// Core
|
|
20
20
|
import type { Application } from '@server/app';
|
|
21
|
-
import Service, { AnyService } from '@server/app/service';
|
|
21
|
+
import Service, { AnyService, TServiceArgs } from '@server/app/service';
|
|
22
22
|
import type { TRegisteredServicesIndex } from '@server/app/service/container';
|
|
23
23
|
import context from '@server/context';
|
|
24
24
|
import type DisksManager from '@server/services/disks';
|
|
@@ -120,9 +120,8 @@ export type TControllerDefinition = {
|
|
|
120
120
|
/*----------------------------------
|
|
121
121
|
- CLASSE
|
|
122
122
|
----------------------------------*/
|
|
123
|
-
export default class ServerRouter
|
|
124
|
-
|
|
125
|
-
> extends Service<Config, Hooks, Application, TSubservices> implements BaseRouter {
|
|
123
|
+
export default class ServerRouter
|
|
124
|
+
extends Service<Config, Hooks, Application> implements BaseRouter {
|
|
126
125
|
|
|
127
126
|
public disks = this.use<DisksManager>('Core/Disks', { optional: true });
|
|
128
127
|
|
|
@@ -143,13 +142,9 @@ export default class ServerRouter<
|
|
|
143
142
|
- SERVICE
|
|
144
143
|
----------------------------------*/
|
|
145
144
|
|
|
146
|
-
public constructor(
|
|
147
|
-
parent: AnyService,
|
|
148
|
-
config: Config,
|
|
149
|
-
app: Application,
|
|
150
|
-
) {
|
|
145
|
+
public constructor( ...args: TServiceArgs<ServerRouter>) {
|
|
151
146
|
|
|
152
|
-
super(
|
|
147
|
+
super(...args);
|
|
153
148
|
|
|
154
149
|
this.http = new HTTP(this.config.http, this);
|
|
155
150
|
this.render = new DocumentRenderer(this);
|
|
@@ -454,8 +449,13 @@ export default class ServerRouter<
|
|
|
454
449
|
for (const serviceName in this.config.plugins) {
|
|
455
450
|
|
|
456
451
|
const routerService = this.config.plugins[serviceName];
|
|
457
|
-
|
|
452
|
+
if (!routerService)
|
|
453
|
+
throw new Error(`Could not access router service ${serviceName}. Maybe the referenced service is not started yet? Try to reduce its priority.`);
|
|
458
454
|
|
|
455
|
+
if (!routerService.requestService)
|
|
456
|
+
throw new Error(`Router service ${serviceName} is not implementing the requestService method from the RouterService interface.`);
|
|
457
|
+
|
|
458
|
+
const requestService = routerService.requestService( request );
|
|
459
459
|
if (requestService !== null)
|
|
460
460
|
contextServices[ serviceName ] = requestService;
|
|
461
461
|
|
|
@@ -4,35 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
// Core
|
|
6
6
|
import type { Application } from '@server/app';
|
|
7
|
-
import Service, { TRegisteredServicesIndex } from '@server/app/service';
|
|
7
|
+
import Service, { TRegisteredServicesIndex, TServiceArgs } from '@server/app/service';
|
|
8
8
|
|
|
9
9
|
// Specific
|
|
10
10
|
import type { default as Router } from '.';
|
|
11
11
|
import type ServerRequest from './request';
|
|
12
12
|
import type RequestService from './request/service';
|
|
13
13
|
|
|
14
|
-
export type Services = {
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
14
|
/*----------------------------------
|
|
19
15
|
- SERVICE
|
|
20
16
|
----------------------------------*/
|
|
21
17
|
export default abstract class RouterService<
|
|
22
18
|
TConfig extends {} = {}
|
|
23
|
-
> extends Service<TConfig, {}, Application
|
|
24
|
-
|
|
25
|
-
public constructor(
|
|
26
|
-
// Parent is always a router in RouterService
|
|
27
|
-
// Warning: for now, it's possible that router is actually the app
|
|
28
|
-
// It's fixed with a not very clean way in Service.bindService
|
|
29
|
-
router: Router,
|
|
30
|
-
config: TConfig,
|
|
31
|
-
app: Application
|
|
32
|
-
) {
|
|
19
|
+
> extends Service<TConfig, {}, Application> {
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
public constructor( ...args: TServiceArgs<RouterService>) {
|
|
22
|
+
super(...args);
|
|
36
23
|
}
|
|
37
24
|
|
|
38
25
|
public abstract requestService( request: ServerRequest<Router> ): RequestService | null;
|
|
@@ -47,7 +47,7 @@ type TDecryptOptions = {
|
|
|
47
47
|
/*----------------------------------
|
|
48
48
|
- SERVICE
|
|
49
49
|
----------------------------------*/
|
|
50
|
-
export default class AES<TConfig extends Config = Config> extends Service<TConfig, Hooks, Application
|
|
50
|
+
export default class AES<TConfig extends Config = Config> extends Service<TConfig, Hooks, Application> {
|
|
51
51
|
|
|
52
52
|
public encrypt( keyName: keyof TConfig["keys"], data: any, options: TEncryptOptions = {
|
|
53
53
|
encoding: 'base64url'
|
package/types/icons.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type TIcones = "long-arrow-right"|"times"|"solid/spinner-third"|"sack-dollar"|"bell"|"bullseye"|"project-diagram"|"user-friends"|"eye"|"lock"|"comments"|"phone"|"chalkboard-teacher"|"rocket"|"planet-ringed"|"brands/linkedin"|"user-circle"|"
|
|
1
|
+
export type TIcones = "long-arrow-right"|"times"|"solid/spinner-third"|"sack-dollar"|"bell"|"bullseye"|"project-diagram"|"user-friends"|"eye"|"lock"|"comments"|"phone"|"chalkboard-teacher"|"rocket"|"planet-ringed"|"brands/linkedin"|"chart-bar"|"user-circle"|"at"|"arrow-right"|"calendar-alt"|"paper-plane"|"crosshairs"|"plus-circle"|"comments-alt"|"user-shield"|"shield-alt"|"chart-line"|"money-bill-wave"|"star"|"link"|"file-alt"|"long-arrow-left"|"search"|"lightbulb"|"magnet"|"key"|"user"|"user-plus"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"times-circle"|"angle-up"|"angle-down"|"solid/crown"|"brands/discord"|"pen"|"plus"|"file"|"envelope"|"binoculars"|"check"|"arrow-left"|"info-circle"|"check-circle"|"exclamation-circle"|"meh-rolling-eyes"|"trash"|"solid/star"|"solid/star-half-alt"|"regular/star"|"chevron-left"|"cog"|"power-off"|"bars"|"usd-circle"|"users"|"home-alt"|"trophy"|"play"|"minus-circle"|"plane-departure"|"wind"|"question-circle"|"external-link"|"map-marker-alt"|"clock"|"arrow-to-bottom"|"ellipsis-h"|"building"|"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"
|