proteum 1.0.0-1
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/.dockerignore +10 -0
- package/Rte.zip +0 -0
- package/cli/app/config.ts +54 -0
- package/cli/app/index.ts +195 -0
- package/cli/bin.js +11 -0
- package/cli/commands/build.ts +34 -0
- package/cli/commands/deploy/app.ts +29 -0
- package/cli/commands/deploy/web.ts +60 -0
- package/cli/commands/dev.ts +109 -0
- package/cli/commands/init.ts +85 -0
- package/cli/compiler/client/identite.ts +72 -0
- package/cli/compiler/client/index.ts +334 -0
- package/cli/compiler/common/babel/index.ts +170 -0
- package/cli/compiler/common/babel/plugins/index.ts +0 -0
- package/cli/compiler/common/babel/plugins/services.ts +579 -0
- package/cli/compiler/common/babel/routes/imports.ts +127 -0
- package/cli/compiler/common/babel/routes/routes.ts +1130 -0
- package/cli/compiler/common/files/autres.ts +39 -0
- package/cli/compiler/common/files/images.ts +35 -0
- package/cli/compiler/common/files/style.ts +78 -0
- package/cli/compiler/common/index.ts +154 -0
- package/cli/compiler/index.ts +532 -0
- package/cli/compiler/server/index.ts +211 -0
- package/cli/index.ts +189 -0
- package/cli/paths.ts +165 -0
- package/cli/print.ts +12 -0
- package/cli/tsconfig.json +38 -0
- package/cli/utils/index.ts +22 -0
- package/cli/utils/keyboard.ts +78 -0
- package/client/app/component.tsx +54 -0
- package/client/app/index.ts +142 -0
- package/client/app/service.ts +34 -0
- package/client/app.tsconfig.json +28 -0
- package/client/components/Button.tsx +298 -0
- package/client/components/Dialog/Manager.tsx +309 -0
- package/client/components/Dialog/card.tsx +208 -0
- package/client/components/Dialog/index.less +151 -0
- package/client/components/Dialog/status.less +176 -0
- package/client/components/Dialog/status.tsx +48 -0
- package/client/components/index.ts +2 -0
- package/client/components/types.d.ts +3 -0
- package/client/data/input.ts +32 -0
- package/client/global.d.ts +5 -0
- package/client/hooks.ts +22 -0
- package/client/index.ts +6 -0
- package/client/pages/_layout/index.less +6 -0
- package/client/pages/_layout/index.tsx +43 -0
- package/client/pages/bug.tsx.old +60 -0
- package/client/pages/useHeader.tsx +50 -0
- package/client/services/captcha/index.ts +67 -0
- package/client/services/router/components/Link.tsx +46 -0
- package/client/services/router/components/Page.tsx +55 -0
- package/client/services/router/components/router.tsx +218 -0
- package/client/services/router/index.tsx +521 -0
- package/client/services/router/request/api.ts +267 -0
- package/client/services/router/request/history.ts +5 -0
- package/client/services/router/request/index.ts +53 -0
- package/client/services/router/request/multipart.ts +147 -0
- package/client/services/router/response/index.tsx +128 -0
- package/client/services/router/response/page.ts +86 -0
- package/client/services/socket/index.ts +147 -0
- package/client/utils/dom.ts +77 -0
- package/common/app/index.ts +9 -0
- package/common/data/chaines/index.ts +54 -0
- package/common/data/dates.ts +179 -0
- package/common/data/markdown.ts +73 -0
- package/common/data/rte/nodes.ts +83 -0
- package/common/data/stats.ts +90 -0
- package/common/errors/index.tsx +326 -0
- package/common/router/index.ts +213 -0
- package/common/router/layouts.ts +93 -0
- package/common/router/register.ts +55 -0
- package/common/router/request/api.ts +77 -0
- package/common/router/request/index.ts +35 -0
- package/common/router/response/index.ts +45 -0
- package/common/router/response/page.ts +128 -0
- package/common/utils/rte.ts +183 -0
- package/common/utils.ts +7 -0
- package/doc/TODO.md +71 -0
- package/doc/front/router.md +27 -0
- package/doc/workspace/workspace.png +0 -0
- package/doc/workspace/workspace2.png +0 -0
- package/doc/workspace/workspace_26.01.22.png +0 -0
- package/package.json +171 -0
- package/server/app/commands.ts +141 -0
- package/server/app/container/config.ts +203 -0
- package/server/app/container/console/index.ts +550 -0
- package/server/app/container/index.ts +137 -0
- package/server/app/index.ts +273 -0
- package/server/app/service/container.ts +88 -0
- package/server/app/service/index.ts +235 -0
- package/server/app.tsconfig.json +28 -0
- package/server/context.ts +4 -0
- package/server/index.ts +4 -0
- package/server/services/auth/index.ts +250 -0
- package/server/services/auth/old.ts +277 -0
- package/server/services/auth/router/index.ts +95 -0
- package/server/services/auth/router/request.ts +54 -0
- package/server/services/auth/router/service.json +6 -0
- package/server/services/auth/service.json +6 -0
- package/server/services/cache/commands.ts +41 -0
- package/server/services/cache/index.ts +297 -0
- package/server/services/cache/service.json +6 -0
- package/server/services/cron/CronTask.ts +86 -0
- package/server/services/cron/index.ts +112 -0
- package/server/services/cron/service.json +6 -0
- package/server/services/disks/driver.ts +103 -0
- package/server/services/disks/drivers/local/index.ts +188 -0
- package/server/services/disks/drivers/local/service.json +6 -0
- package/server/services/disks/drivers/s3/index.ts +301 -0
- package/server/services/disks/drivers/s3/service.json +6 -0
- package/server/services/disks/index.ts +90 -0
- package/server/services/disks/service.json +6 -0
- package/server/services/email/index.ts +188 -0
- package/server/services/email/utils.ts +53 -0
- package/server/services/fetch/index.ts +201 -0
- package/server/services/fetch/service.json +7 -0
- package/server/services/models.7z +0 -0
- package/server/services/prisma/Facet.ts +142 -0
- package/server/services/prisma/index.ts +201 -0
- package/server/services/prisma/service.json +6 -0
- package/server/services/router/http/index.ts +217 -0
- package/server/services/router/http/multipart.ts +102 -0
- package/server/services/router/http/session.ts.old +40 -0
- package/server/services/router/index.ts +801 -0
- package/server/services/router/request/api.ts +87 -0
- package/server/services/router/request/index.ts +184 -0
- package/server/services/router/request/service.ts +21 -0
- package/server/services/router/request/validation/zod.ts +180 -0
- package/server/services/router/response/index.ts +338 -0
- package/server/services/router/response/mask/Filter.ts +323 -0
- package/server/services/router/response/mask/index.ts +60 -0
- package/server/services/router/response/mask/selecteurs.ts +92 -0
- package/server/services/router/response/page/document.tsx +160 -0
- package/server/services/router/response/page/index.tsx +196 -0
- package/server/services/router/service.json +6 -0
- package/server/services/router/service.ts +36 -0
- package/server/services/schema/index.ts +44 -0
- package/server/services/schema/request.ts +49 -0
- package/server/services/schema/router/index.ts +28 -0
- package/server/services/schema/router/service.json +6 -0
- package/server/services/schema/service.json +6 -0
- package/server/services/security/encrypt/aes/index.ts +85 -0
- package/server/services/security/encrypt/aes/service.json +6 -0
- package/server/services/socket/index.ts +162 -0
- package/server/services/socket/scope.ts +226 -0
- package/server/services/socket/service.json +6 -0
- package/server/services_old/SocketClient.ts +92 -0
- package/server/services_old/Token.old.ts +97 -0
- package/server/utils/slug.ts +79 -0
- package/tsconfig.common.json +45 -0
- package/tsconfig.json +3 -0
- package/types/aliases.d.ts +54 -0
- package/types/global/modules.d.ts +49 -0
- package/types/global/utils.d.ts +103 -0
- package/types/icons.d.ts +1 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*----------------------------------
|
|
2
|
+
- DEPENDANCES
|
|
3
|
+
----------------------------------*/
|
|
4
|
+
|
|
5
|
+
// Npm
|
|
6
|
+
import escapeStringRegexp from 'escape-regexp';
|
|
7
|
+
import slugify from 'slugify';
|
|
8
|
+
import { removeStopwords, eng } from 'stopword';
|
|
9
|
+
|
|
10
|
+
// Core
|
|
11
|
+
import type SQL from "@server/services/database";
|
|
12
|
+
|
|
13
|
+
/*----------------------------------
|
|
14
|
+
- TYPES
|
|
15
|
+
----------------------------------*/
|
|
16
|
+
|
|
17
|
+
/*----------------------------------
|
|
18
|
+
- SERVICE
|
|
19
|
+
----------------------------------*/
|
|
20
|
+
export class Slug {
|
|
21
|
+
|
|
22
|
+
public async generate( label: string );
|
|
23
|
+
public async generate( label: string, SQL: SQL, table: string, column: string );
|
|
24
|
+
public async generate( label: string, SQL?: SQL, table?: string, column?: string ) {
|
|
25
|
+
|
|
26
|
+
// Generate slug
|
|
27
|
+
let slug = slugify(label, {
|
|
28
|
+
replacement: '-', // replace spaces with replacement character, defaults to `-`
|
|
29
|
+
remove: /[^a-z\s]/ig, // remove characters that match regex, defaults to `undefined`
|
|
30
|
+
lower: true, // convert to lower case, defaults to `false`
|
|
31
|
+
strict: true, // strip special characters except replacement, defaults to `false`
|
|
32
|
+
locale: 'vi', // language code of the locale to use
|
|
33
|
+
trim: true // trim leading and trailing replacement chars, defaults to `true`
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
slug = removeStopwords( slug.split('-'), eng).join('-');
|
|
37
|
+
|
|
38
|
+
// Check if already existing
|
|
39
|
+
if (SQL !== undefined) {
|
|
40
|
+
slug = await this.Correct(slug, SQL, table, column);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return slug;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public async Correct(
|
|
47
|
+
slug: string,
|
|
48
|
+
SQL: SQL,
|
|
49
|
+
table: string,
|
|
50
|
+
column: string
|
|
51
|
+
) {
|
|
52
|
+
|
|
53
|
+
const escapedSlug = escapeStringRegexp(slug);
|
|
54
|
+
|
|
55
|
+
const duplicates = await SQL.selectVal<number>(`
|
|
56
|
+
SELECT
|
|
57
|
+
IF( ${column} LIKE ${SQL.esc(slug)},
|
|
58
|
+
1,
|
|
59
|
+
CAST(SUBSTRING_INDEX(slug, '-', -1) AS UNSIGNED)
|
|
60
|
+
) AS duplicates
|
|
61
|
+
FROM ${table}
|
|
62
|
+
WHERE
|
|
63
|
+
${column} LIKE ${SQL.esc(slug)}
|
|
64
|
+
OR
|
|
65
|
+
${column} REGEXP '^${escapedSlug}-[0-9]+$'
|
|
66
|
+
ORDER BY duplicates DESC
|
|
67
|
+
LIMIT 1
|
|
68
|
+
`);
|
|
69
|
+
|
|
70
|
+
if (duplicates && duplicates > 0)
|
|
71
|
+
slug += `-${duplicates + 1}`;
|
|
72
|
+
|
|
73
|
+
return slug;
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default new Slug;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Condiguration de base pour l'app ET le framework
|
|
3
|
+
*/
|
|
4
|
+
{
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"strict": false,
|
|
11
|
+
"downlevelIteration": true,
|
|
12
|
+
// Force case sensitive import filenames on Window and Mac
|
|
13
|
+
// https://briandesousa.net/?p=870
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
|
|
16
|
+
// Equivalent webpack: resolve.symblinks = false
|
|
17
|
+
"preserveSymlinks": true,
|
|
18
|
+
// Décorateurs
|
|
19
|
+
"experimentalDecorators": true,
|
|
20
|
+
|
|
21
|
+
"inlineSourceMap": true,
|
|
22
|
+
|
|
23
|
+
// React
|
|
24
|
+
"jsx": "react-jsx",
|
|
25
|
+
"jsxImportSource": "preact",
|
|
26
|
+
|
|
27
|
+
"strictPropertyInitialization": true,
|
|
28
|
+
"strictNullChecks": true,
|
|
29
|
+
|
|
30
|
+
"rootDir": "./",
|
|
31
|
+
"baseUrl": "./",
|
|
32
|
+
"paths": {
|
|
33
|
+
|
|
34
|
+
"@client/*": ["./client/*"],
|
|
35
|
+
"@common/*": ["./common/*"],
|
|
36
|
+
"@server/*": ["./server/*"],
|
|
37
|
+
|
|
38
|
+
"react": ["preact/compat"],
|
|
39
|
+
"react-dom": ["preact/compat"],
|
|
40
|
+
"react/jsx-runtime": ["preact/jsx-runtime"]
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
"include": ["."],
|
|
44
|
+
"exclude": ["cli"]
|
|
45
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
declare module "@/client/pages/\*\*/_layout/index.tsx" {
|
|
2
|
+
const Layout: import("../common/router/layouts").ImportedLayouts;
|
|
3
|
+
export = LayoutsList
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare module "@/client/pages/\*.tsx" {
|
|
7
|
+
const value: import("../client/services/router").TRoutesLoaders;
|
|
8
|
+
export = value;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module "@/server/services/auth" {
|
|
12
|
+
const UserAuthService: import("../../server/services/auth/base").default;
|
|
13
|
+
export = UserAuthService;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module "@/server" {
|
|
17
|
+
const ServerApplicationClass: import("../server/app").default;
|
|
18
|
+
export = InstanceType<ServerApplicationClass>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare module "@/client" {
|
|
22
|
+
const ClientApplicationClass: import("../client/app").default;
|
|
23
|
+
export = InstanceType<ClientApplicationClass>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare module "@/client/context" {
|
|
27
|
+
|
|
28
|
+
const Test: true;
|
|
29
|
+
|
|
30
|
+
const ClientRouter: import('../client/services/router').default;
|
|
31
|
+
const ServerRouter: import('../server/services/router').default;
|
|
32
|
+
|
|
33
|
+
type TServerRouterRequestContext = import('../server/services/router/response').TRouterContext;
|
|
34
|
+
type TClientRouterRequestContext = import('../client/services/router/response').TRouterContext;
|
|
35
|
+
|
|
36
|
+
export type ClientContext = (
|
|
37
|
+
// TO Fix: TClientRouterRequestContext is unable to get the right type of CrossPathClient["router"]
|
|
38
|
+
// (it gets ClientApplication instead of CrossPathClient)
|
|
39
|
+
TClientRouterRequestContext<ClientRouter, ClientRouter["app"]>
|
|
40
|
+
|
|
|
41
|
+
TServerRouterRequestContext<ServerRouter>
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
export const ReactClientContext: preact.Context<ClientContext>;
|
|
45
|
+
|
|
46
|
+
const useContext: () => ClientContext;
|
|
47
|
+
|
|
48
|
+
export default useContext;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare module "@app" {
|
|
52
|
+
const ServerApplicationClass: import("../server/app").default;
|
|
53
|
+
export = ServerApplicationClass;
|
|
54
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*----------------------------------
|
|
2
|
+
- CONTENU TRANSFORMÉ
|
|
3
|
+
----------------------------------*/
|
|
4
|
+
|
|
5
|
+
// Contenu brut + métadonnées
|
|
6
|
+
declare module "*.sql" {
|
|
7
|
+
const value: String & {
|
|
8
|
+
id: string,
|
|
9
|
+
sourcefile: string
|
|
10
|
+
};
|
|
11
|
+
export = value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Contenu brut + métadonnées
|
|
15
|
+
declare module "*.json" {
|
|
16
|
+
const value: any;
|
|
17
|
+
export = value;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/*----------------------------------
|
|
21
|
+
- CONTENU BRUT
|
|
22
|
+
----------------------------------*/
|
|
23
|
+
|
|
24
|
+
// Contenu brut
|
|
25
|
+
declare module "*.md" {
|
|
26
|
+
const value: string;
|
|
27
|
+
export = value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/*----------------------------------
|
|
31
|
+
- ASSETS: CHEMIN PUBLIC
|
|
32
|
+
----------------------------------*/
|
|
33
|
+
|
|
34
|
+
declare module "*.svg" {
|
|
35
|
+
const value: string;
|
|
36
|
+
export = value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module "*.png";
|
|
40
|
+
declare module "*.jpg";
|
|
41
|
+
declare module "*.jpeg";
|
|
42
|
+
declare module "*.webp";
|
|
43
|
+
declare module "*.gif";
|
|
44
|
+
declare module "*.bmp";
|
|
45
|
+
|
|
46
|
+
declare module "*.mp3" {
|
|
47
|
+
const value: string;
|
|
48
|
+
export = value;
|
|
49
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
declare type TObjetDonnees = {[cle: string]: any}
|
|
2
|
+
|
|
3
|
+
// Rend certaines clés d'un objet obligatoires
|
|
4
|
+
declare type With<
|
|
5
|
+
TObject,
|
|
6
|
+
TRequired extends (keyof TObject) | {[key in keyof TObject]?: any},
|
|
7
|
+
TAdditionnal extends {[key: string]: any} = {}
|
|
8
|
+
> = (
|
|
9
|
+
Omit<TObject, TRequired extends (keyof TObject) ? TRequired : keyof TRequired>
|
|
10
|
+
&
|
|
11
|
+
(TRequired extends (keyof TObject) ? Required<Pick<TObject, TRequired>> : TRequired)
|
|
12
|
+
&
|
|
13
|
+
TAdditionnal
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
declare type NonNullFields<T, K extends keyof T> = Omit<T, K> & {
|
|
17
|
+
[P in K]: NonNullable<T[P]>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
declare type ValueOf<T> = T[keyof T];
|
|
21
|
+
|
|
22
|
+
// Extrait la valeur de retour d'une promise
|
|
23
|
+
// https://stackoverflow.com/questions/48011353/how-to-unwrap-type-of-a-promise
|
|
24
|
+
declare type ThenArg<T> = T extends PromiseLike<infer U> ? U : T
|
|
25
|
+
|
|
26
|
+
declare type TPagination<TElement> = {
|
|
27
|
+
list: TElement[],
|
|
28
|
+
page: number,
|
|
29
|
+
pages: number,
|
|
30
|
+
total: number
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// https://stackoverflow.com/questions/39392853/is-there-a-type-for-class-in-typescript-and-does-any-include-it
|
|
34
|
+
declare interface ClassType<T> extends Function { new(): T; }
|
|
35
|
+
|
|
36
|
+
declare type TPagination<T> = {
|
|
37
|
+
docs: Array<T>;
|
|
38
|
+
pages: number;
|
|
39
|
+
total: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare type TStats<T> = {
|
|
43
|
+
[time: number]: T
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/*declare namespace JSX {
|
|
47
|
+
interface IntrinsicElements {
|
|
48
|
+
i: { src: TIcons } & React.HTMLAttributes<HTMLElement>;
|
|
49
|
+
}
|
|
50
|
+
}*/
|
|
51
|
+
|
|
52
|
+
declare type Routes = {
|
|
53
|
+
[path: string]: {
|
|
54
|
+
params: {
|
|
55
|
+
[param: string]: any
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare type PrimitiveValue = string | number | boolean;
|
|
61
|
+
|
|
62
|
+
/*----------------------------------
|
|
63
|
+
- COPY FROM CLI/APP/INDEX.TS
|
|
64
|
+
----------------------------------*/
|
|
65
|
+
|
|
66
|
+
/*type TEnvConfig = {
|
|
67
|
+
name: 'local' | 'server',
|
|
68
|
+
profile: 'dev' | 'testing' | 'prod',
|
|
69
|
+
|
|
70
|
+
router: {
|
|
71
|
+
port: number,
|
|
72
|
+
domains: TDomainsList
|
|
73
|
+
},
|
|
74
|
+
database: {
|
|
75
|
+
name: string,
|
|
76
|
+
databases: string[],
|
|
77
|
+
host: string,
|
|
78
|
+
port: number,
|
|
79
|
+
login: string,
|
|
80
|
+
password: string,
|
|
81
|
+
},
|
|
82
|
+
console: {
|
|
83
|
+
enable: boolean,
|
|
84
|
+
debug: boolean,
|
|
85
|
+
bufferLimit: number,
|
|
86
|
+
level: TLogProfile,
|
|
87
|
+
},
|
|
88
|
+
}*/
|
|
89
|
+
|
|
90
|
+
type TServiceSetup = {
|
|
91
|
+
id: string,
|
|
92
|
+
name: string,
|
|
93
|
+
config: {},
|
|
94
|
+
subservices: TServiceSubservices
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
type TServiceRef = {
|
|
98
|
+
refTo: string
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
type TServiceSubservices = {
|
|
102
|
+
[key: string]: TServiceSetup | TServiceRef
|
|
103
|
+
}
|
package/types/icons.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TIcones = "solid/spinner-third"|"info-circle"|"check-circle"|"exclamation-circle"|"times-circle"|"times"|"clock"|"stars"|"crosshairs"|"radar"|"chart-line"|"home"|"search"|"user"|"chart-bar"|"columns"|"globe"|"bookmark"|"tag"|"angle-down"|"check"|"meh-rolling-eyes"|"arrow-left"|"arrow-right"|"eye"|"trash"|"sparkles"|"unlink"|"pen"|"link"|"file"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"code"|"plus"|"font"|"empty-set"|"plus-circle"|"horizontal-rule"|"page-break"|"image"|"table"|"poll"|"sticky-note"|"caret-right"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"
|