proteum 1.0.2 → 2.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/AGENTS.md +101 -0
- package/agents/codex/AGENTS.md +95 -0
- package/agents/codex/CODING_STYLE.md +71 -0
- package/agents/codex/agents.md.zip +0 -0
- package/agents/codex/client/AGENTS.md +102 -0
- package/agents/codex/client/pages/AGENTS.md +35 -0
- package/agents/codex/server/routes/AGENTS.md +12 -0
- package/agents/codex/server/services/AGENTS.md +137 -0
- package/agents/codex/tests/AGENTS.md +8 -0
- package/cli/app/config.ts +13 -11
- package/cli/app/index.ts +74 -82
- package/cli/bin.js +1 -1
- package/cli/commands/build.ts +51 -14
- package/cli/commands/check.ts +19 -0
- package/cli/commands/deploy/app.ts +4 -8
- package/cli/commands/deploy/web.ts +16 -20
- package/cli/commands/dev.ts +189 -64
- package/cli/commands/devEvents.ts +106 -0
- package/cli/commands/init.ts +63 -57
- package/cli/commands/lint.ts +21 -0
- package/cli/commands/refresh.ts +18 -0
- package/cli/commands/typecheck.ts +18 -0
- package/cli/compiler/client/identite.ts +80 -53
- package/cli/compiler/client/index.ts +139 -213
- package/cli/compiler/common/bundleAnalysis.ts +94 -0
- package/cli/compiler/common/clientManifest.ts +67 -0
- package/cli/compiler/common/controllers.ts +288 -0
- package/cli/compiler/common/files/autres.ts +7 -18
- package/cli/compiler/common/files/images.ts +40 -37
- package/cli/compiler/common/files/style.ts +11 -22
- package/cli/compiler/common/generatedRouteModules.ts +368 -0
- package/cli/compiler/common/index.ts +31 -65
- package/cli/compiler/common/loaders/forbid-ssr-import.js +13 -0
- package/cli/compiler/common/rspackAliases.ts +13 -0
- package/cli/compiler/common/scripts.ts +37 -0
- package/cli/compiler/index.ts +781 -230
- package/cli/compiler/server/index.ts +59 -75
- package/cli/compiler/writeIfChanged.ts +21 -0
- package/cli/index.ts +71 -72
- package/cli/paths.ts +51 -57
- package/cli/print.ts +17 -11
- package/cli/tsconfig.json +5 -4
- package/cli/utils/agents.ts +100 -0
- package/cli/utils/check.ts +71 -0
- package/cli/utils/index.ts +1 -3
- package/cli/utils/keyboard.ts +8 -25
- package/cli/utils/runProcess.ts +30 -0
- package/client/app/component.tsx +29 -29
- package/client/app/index.ts +36 -57
- package/client/app/service.ts +7 -12
- package/client/app.tsconfig.json +2 -2
- package/client/components/Dialog/Manager.ssr.tsx +40 -0
- package/client/components/Dialog/Manager.tsx +119 -150
- package/client/components/Dialog/status.tsx +3 -3
- package/client/components/index.ts +1 -1
- package/client/components/types.d.ts +1 -3
- package/client/dev/hmr.ts +65 -0
- package/client/global.d.ts +2 -2
- package/client/hooks.ts +6 -9
- package/client/index.ts +2 -1
- package/client/islands/index.ts +7 -0
- package/client/islands/useDeferredModule.ts +199 -0
- package/client/pages/_layout/index.tsx +4 -12
- package/client/pages/useHeader.tsx +14 -21
- package/client/router.ts +27 -0
- package/client/services/router/components/Link.tsx +34 -27
- package/client/services/router/components/Page.tsx +6 -14
- package/client/services/router/components/router.ssr.tsx +36 -0
- package/client/services/router/components/router.tsx +63 -83
- package/client/services/router/index.tsx +185 -220
- package/client/services/router/request/api.ts +97 -119
- package/client/services/router/request/history.ts +2 -2
- package/client/services/router/request/index.ts +13 -12
- package/client/services/router/request/multipart.ts +72 -62
- package/client/services/router/response/index.tsx +68 -61
- package/client/services/router/response/page.ts +28 -32
- package/client/utils/dom.ts +17 -33
- package/common/app/index.ts +3 -3
- package/common/data/chaines/index.ts +22 -23
- package/common/data/dates.ts +35 -70
- package/common/data/markdown.ts +42 -39
- package/common/dev/serverHotReload.ts +26 -0
- package/common/errors/index.tsx +110 -142
- package/common/router/contracts.ts +29 -0
- package/common/router/index.ts +89 -108
- package/common/router/layouts.ts +34 -47
- package/common/router/pageSetup.ts +50 -0
- package/common/router/register.ts +53 -24
- package/common/router/request/api.ts +30 -36
- package/common/router/request/index.ts +2 -8
- package/common/router/response/index.ts +8 -15
- package/common/router/response/page.ts +70 -58
- package/common/utils.ts +1 -1
- package/doc/TODO.md +1 -1
- package/eslint.js +62 -0
- package/package.json +14 -49
- package/prettier.config.cjs +9 -0
- package/scripts/cleanup-generated-controllers.ts +62 -0
- package/scripts/fix-reference-app-typing.ts +490 -0
- package/scripts/refactor-client-app-imports.ts +244 -0
- package/scripts/refactor-client-pages.ts +587 -0
- package/scripts/refactor-server-controllers.ts +470 -0
- package/scripts/refactor-server-runtime-aliases.ts +360 -0
- package/scripts/restore-client-app-import-files.ts +41 -0
- package/scripts/restore-files-from-git-head.ts +20 -0
- package/scripts/update-codex-agents.ts +35 -0
- package/server/app/commands.ts +35 -64
- package/server/app/container/config.ts +48 -59
- package/server/app/container/console/index.ts +202 -248
- package/server/app/container/index.ts +33 -71
- package/server/app/controller/index.ts +61 -0
- package/server/app/index.ts +39 -105
- package/server/app/service/container.ts +41 -42
- package/server/app/service/index.ts +120 -147
- package/server/context.ts +1 -1
- package/server/index.ts +25 -1
- package/server/services/auth/index.ts +75 -115
- package/server/services/auth/router/index.ts +31 -32
- package/server/services/auth/router/request.ts +14 -16
- package/server/services/cron/CronTask.ts +13 -26
- package/server/services/cron/index.ts +14 -36
- package/server/services/disks/driver.ts +40 -58
- package/server/services/disks/drivers/local/index.ts +79 -90
- package/server/services/disks/drivers/s3/index.ts +116 -163
- package/server/services/disks/index.ts +23 -38
- package/server/services/email/index.ts +45 -104
- package/server/services/email/utils.ts +14 -27
- package/server/services/fetch/index.ts +53 -85
- package/server/services/prisma/Facet.ts +39 -91
- package/server/services/prisma/index.ts +74 -110
- package/server/services/router/generatedRuntime.ts +29 -0
- package/server/services/router/http/index.ts +78 -73
- package/server/services/router/http/multipart.ts +19 -42
- package/server/services/router/index.ts +378 -365
- package/server/services/router/request/api.ts +26 -25
- package/server/services/router/request/index.ts +44 -51
- package/server/services/router/request/service.ts +7 -11
- package/server/services/router/request/validation/zod.ts +111 -148
- package/server/services/router/response/index.ts +110 -125
- package/server/services/router/response/mask/Filter.ts +31 -72
- package/server/services/router/response/mask/index.ts +8 -15
- package/server/services/router/response/mask/selecteurs.ts +11 -25
- package/server/services/router/response/page/clientManifest.ts +25 -0
- package/server/services/router/response/page/document.tsx +199 -127
- package/server/services/router/response/page/index.tsx +89 -94
- package/server/services/router/service.ts +13 -15
- package/server/services/schema/index.ts +17 -26
- package/server/services/schema/request.ts +19 -33
- package/server/services/schema/router/index.ts +8 -11
- package/server/services/security/encrypt/aes/index.ts +15 -35
- package/server/utils/slug.ts +29 -35
- package/skills/clean-project-code/SKILL.md +63 -0
- package/skills/clean-project-code/agents/openai.yaml +4 -0
- package/tsconfig.common.json +4 -3
- package/tsconfig.json +4 -1
- package/types/aliases.d.ts +17 -21
- package/types/controller-input.test.ts +48 -0
- package/types/express-extra.d.ts +6 -0
- package/types/global/constants.d.ts +13 -0
- package/types/global/express-extra.d.ts +6 -0
- package/types/global/modules.d.ts +13 -16
- package/types/global/utils.d.ts +17 -49
- package/types/global/vendors.d.ts +62 -0
- package/types/icons.d.ts +65 -1
- package/types/uuid.d.ts +3 -0
- package/types/vendors.d.ts +62 -0
- package/cli/compiler/common/babel/index.ts +0 -170
- package/cli/compiler/common/babel/plugins/index.ts +0 -0
- package/cli/compiler/common/babel/plugins/services.ts +0 -586
- package/cli/compiler/common/babel/routes/imports.ts +0 -127
- package/cli/compiler/common/babel/routes/routes.ts +0 -1130
- package/client/services/captcha/index.ts +0 -67
- package/client/services/socket/index.ts +0 -147
- package/common/data/rte/nodes.ts +0 -83
- package/common/data/stats.ts +0 -90
- package/common/utils/rte.ts +0 -183
- package/server/services/auth/old.ts +0 -277
- package/server/services/cache/commands.ts +0 -41
- package/server/services/cache/index.ts +0 -297
- package/server/services/cache/service.json +0 -6
- package/server/services/socket/index.ts +0 -162
- package/server/services/socket/scope.ts +0 -226
- package/server/services/socket/service.json +0 -6
- package/server/services_old/SocketClient.ts +0 -92
- package/server/services_old/Token.old.ts +0 -97
package/server/utils/slug.ts
CHANGED
|
@@ -7,73 +7,67 @@ import escapeStringRegexp from 'escape-regexp';
|
|
|
7
7
|
import slugify from 'slugify';
|
|
8
8
|
import { removeStopwords, eng } from 'stopword';
|
|
9
9
|
|
|
10
|
-
// Core
|
|
11
|
-
import type SQL from "@server/services/database";
|
|
12
|
-
|
|
13
10
|
/*----------------------------------
|
|
14
11
|
- TYPES
|
|
15
12
|
----------------------------------*/
|
|
16
13
|
|
|
14
|
+
type TSlugSqlClient = {
|
|
15
|
+
esc?: (value: unknown) => string;
|
|
16
|
+
selectVal?: <TValue = number>(query: string) => Promise<TValue | null>;
|
|
17
|
+
};
|
|
18
|
+
|
|
17
19
|
/*----------------------------------
|
|
18
20
|
- SERVICE
|
|
19
21
|
----------------------------------*/
|
|
20
22
|
export class Slug {
|
|
21
|
-
|
|
22
|
-
public async generate(
|
|
23
|
-
public async generate(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
public async generate(label: string): Promise<string>;
|
|
24
|
+
public async generate(label: string, sql: TSlugSqlClient, table: string, column: string): Promise<string>;
|
|
25
|
+
public async generate(
|
|
26
|
+
label: string,
|
|
27
|
+
sql?: TSlugSqlClient,
|
|
28
|
+
table?: string,
|
|
29
|
+
column?: string,
|
|
30
|
+
): Promise<string> {
|
|
27
31
|
let slug = slugify(label, {
|
|
28
|
-
replacement: '-',
|
|
29
|
-
remove: /[^a-z\s]/
|
|
30
|
-
lower: true,
|
|
31
|
-
strict: true,
|
|
32
|
-
locale: 'vi',
|
|
33
|
-
trim: true
|
|
32
|
+
replacement: '-',
|
|
33
|
+
remove: /[^a-z\s]/gi,
|
|
34
|
+
lower: true,
|
|
35
|
+
strict: true,
|
|
36
|
+
locale: 'vi',
|
|
37
|
+
trim: true,
|
|
34
38
|
});
|
|
35
39
|
|
|
36
|
-
slug = removeStopwords(
|
|
40
|
+
slug = removeStopwords(slug.split('-'), eng).join('-');
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
if (SQL !== undefined) {
|
|
40
|
-
slug = await this.Correct(slug, SQL, table, column);
|
|
41
|
-
}
|
|
42
|
+
if (sql && table && column) slug = await this.Correct(slug, sql, table, column);
|
|
42
43
|
|
|
43
44
|
return slug;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
public async Correct(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
table: string,
|
|
50
|
-
column: string
|
|
51
|
-
) {
|
|
52
|
-
|
|
47
|
+
public async Correct(slug: string, sql: TSlugSqlClient, table: string, column: string): Promise<string> {
|
|
48
|
+
if (!sql.esc || !sql.selectVal) return slug;
|
|
49
|
+
|
|
53
50
|
const escapedSlug = escapeStringRegexp(slug);
|
|
54
51
|
|
|
55
|
-
const duplicates = await
|
|
52
|
+
const duplicates = await sql.selectVal<number>(`
|
|
56
53
|
SELECT
|
|
57
|
-
IF( ${column} LIKE ${
|
|
54
|
+
IF( ${column} LIKE ${sql.esc(slug)},
|
|
58
55
|
1,
|
|
59
56
|
CAST(SUBSTRING_INDEX(slug, '-', -1) AS UNSIGNED)
|
|
60
57
|
) AS duplicates
|
|
61
58
|
FROM ${table}
|
|
62
59
|
WHERE
|
|
63
|
-
${column} LIKE ${
|
|
60
|
+
${column} LIKE ${sql.esc(slug)}
|
|
64
61
|
OR
|
|
65
62
|
${column} REGEXP '^${escapedSlug}-[0-9]+$'
|
|
66
63
|
ORDER BY duplicates DESC
|
|
67
64
|
LIMIT 1
|
|
68
65
|
`);
|
|
69
66
|
|
|
70
|
-
if (duplicates && duplicates > 0)
|
|
71
|
-
slug += `-${duplicates + 1}`;
|
|
67
|
+
if (duplicates && duplicates > 0) slug += `-${duplicates + 1}`;
|
|
72
68
|
|
|
73
69
|
return slug;
|
|
74
|
-
|
|
75
70
|
}
|
|
76
|
-
|
|
77
71
|
}
|
|
78
72
|
|
|
79
|
-
export default new Slug;
|
|
73
|
+
export default new Slug();
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clean-project-code
|
|
3
|
+
description: Conservative codebase cleanup for existing projects. Use when Codex is asked to remove dead code, run Prettier, and align touched files with repository style rules without changing behavior or public APIs. Trigger for requests such as "clean this repo", "remove unused code", "format touched files", "apply CODING_STYLE.md", or "do a safe cleanup pass".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Clean Project Code
|
|
7
|
+
|
|
8
|
+
Read the repository instructions first. Prefer `AGENTS.md`, the nearest relevant `CODING_STYLE.md`, and the active Prettier config before making changes.
|
|
9
|
+
|
|
10
|
+
Keep the cleanup conservative. Delete only code that is clearly unused and safe to remove. When safety is ambiguous, leave the code in place and report it as a cleanup candidate.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. Read repo rules.
|
|
15
|
+
Locate and read `AGENTS.md`, `CODING_STYLE.md`, and `prettier.config.*` or `.prettierrc*` before editing. If the user names an exact path, use that file as the source of truth.
|
|
16
|
+
|
|
17
|
+
2. Define safe scope.
|
|
18
|
+
Do not change behavior or public APIs. Do not rewrite large areas only for style. Do not edit generated files unless you also update the source that generates them.
|
|
19
|
+
|
|
20
|
+
3. Identify provably safe cleanup targets.
|
|
21
|
+
Prefer removing:
|
|
22
|
+
- unused imports
|
|
23
|
+
- unused local variables and private helpers
|
|
24
|
+
- unused types and interfaces
|
|
25
|
+
- unreachable branches
|
|
26
|
+
- obsolete files that are provably unreferenced
|
|
27
|
+
- compatibility shims or dead helpers that have no live call sites
|
|
28
|
+
|
|
29
|
+
4. Prove before deleting.
|
|
30
|
+
Use fast search tools such as `rg` to verify references. Check exports, dynamic imports, generated references, route registration, configuration wiring, and framework conventions before deleting a file or symbol.
|
|
31
|
+
|
|
32
|
+
5. Keep uncertain cases.
|
|
33
|
+
If code looks unused but safety is not clear, keep it and report it separately. Favor false negatives over unsafe deletions.
|
|
34
|
+
|
|
35
|
+
6. Apply style only on touched files.
|
|
36
|
+
Follow the repository coding style for files you change. Run Prettier with the repo config, preferably on touched files only unless the user explicitly asks for repo-wide formatting.
|
|
37
|
+
|
|
38
|
+
7. Verify.
|
|
39
|
+
Run the smallest relevant verification available after edits. Prefer project-native checks. If no suitable automated verification exists, say so explicitly.
|
|
40
|
+
|
|
41
|
+
## Deletion Rules
|
|
42
|
+
|
|
43
|
+
- Delete only when the code is clearly unused and the removal does not alter runtime behavior.
|
|
44
|
+
- Treat public exports, framework entrypoints, reflective loading, glob-based discovery, and generated references as high-risk unless you can prove they are inactive.
|
|
45
|
+
- Avoid opportunistic refactors. Keep the diff reviewable.
|
|
46
|
+
- If a cleanup requires structural redesign to become safe, stop at reporting the issue unless the user explicitly asked for refactoring.
|
|
47
|
+
|
|
48
|
+
## Final Report
|
|
49
|
+
|
|
50
|
+
Always report:
|
|
51
|
+
- what was removed
|
|
52
|
+
- what was intentionally left unchanged because it was uncertain
|
|
53
|
+
- what verification was run
|
|
54
|
+
- what could not be verified automatically
|
|
55
|
+
|
|
56
|
+
## Default Response Shape
|
|
57
|
+
|
|
58
|
+
When the user provides a cleanup brief, turn it into an execution checklist before editing:
|
|
59
|
+
- instructions read
|
|
60
|
+
- safe deletion targets identified
|
|
61
|
+
- risky candidates deferred
|
|
62
|
+
- formatting scope confirmed
|
|
63
|
+
- verification plan chosen
|
package/tsconfig.common.json
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
"skipLibCheck": true,
|
|
9
9
|
"allowJs": true,
|
|
10
10
|
"strict": false,
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"noImplicitThis": true,
|
|
13
|
+
"strictBindCallApply": true,
|
|
14
|
+
"useUnknownInCatchVariables": true,
|
|
11
15
|
"downlevelIteration": true,
|
|
12
16
|
// Force case sensitive import filenames on Window and Mac
|
|
13
17
|
// https://briandesousa.net/?p=870
|
|
@@ -15,9 +19,6 @@
|
|
|
15
19
|
|
|
16
20
|
// Equivalent webpack: resolve.symblinks = false
|
|
17
21
|
"preserveSymlinks": true,
|
|
18
|
-
// Décorateurs
|
|
19
|
-
"experimentalDecorators": true,
|
|
20
|
-
|
|
21
22
|
"inlineSourceMap": true,
|
|
22
23
|
|
|
23
24
|
// React
|
package/tsconfig.json
CHANGED
package/types/aliases.d.ts
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
const Layout: import(
|
|
3
|
-
export = LayoutsList
|
|
1
|
+
declare module '@/client/pages/\*\*/_layout/index.tsx' {
|
|
2
|
+
const Layout: import('../common/router/layouts').ImportedLayouts;
|
|
3
|
+
export = LayoutsList;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
declare module
|
|
7
|
-
const value: import(
|
|
6
|
+
declare module '@/client/pages/\*.tsx' {
|
|
7
|
+
const value: import('../client/services/router').TRoutesLoaders;
|
|
8
8
|
export = value;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
declare module
|
|
12
|
-
const UserAuthService: import(
|
|
11
|
+
declare module '@/server/services/auth' {
|
|
12
|
+
const UserAuthService: import('../../server/services/auth/base').default;
|
|
13
13
|
export = UserAuthService;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
declare module
|
|
17
|
-
const ServerApplicationClass: import(
|
|
16
|
+
declare module '@/server' {
|
|
17
|
+
const ServerApplicationClass: import('../server/app').default;
|
|
18
18
|
export = InstanceType<ServerApplicationClass>;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
declare module
|
|
22
|
-
const ClientApplicationClass: import(
|
|
21
|
+
declare module '@/client' {
|
|
22
|
+
const ClientApplicationClass: import('../client/app').default;
|
|
23
23
|
export = InstanceType<ClientApplicationClass>;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare module
|
|
27
|
-
|
|
26
|
+
declare module '@/client/context' {
|
|
28
27
|
const Test: true;
|
|
29
28
|
|
|
30
29
|
const ClientRouter: import('../client/services/router').default;
|
|
@@ -33,13 +32,10 @@ declare module "@/client/context" {
|
|
|
33
32
|
type TServerRouterRequestContext = import('../server/services/router/response').TRouterContext;
|
|
34
33
|
type TClientRouterRequestContext = import('../client/services/router/response').TRouterContext;
|
|
35
34
|
|
|
36
|
-
export type ClientContext =
|
|
35
|
+
export type ClientContext =
|
|
37
36
|
// TO Fix: TClientRouterRequestContext is unable to get the right type of CrossPathClient["router"]
|
|
38
37
|
// (it gets ClientApplication instead of CrossPathClient)
|
|
39
|
-
TClientRouterRequestContext<ClientRouter, ClientRouter[
|
|
40
|
-
|
|
|
41
|
-
TServerRouterRequestContext<ServerRouter>
|
|
42
|
-
)
|
|
38
|
+
TClientRouterRequestContext<ClientRouter, ClientRouter['app']> | TServerRouterRequestContext<ServerRouter>;
|
|
43
39
|
|
|
44
40
|
export const ReactClientContext: preact.Context<ClientContext>;
|
|
45
41
|
|
|
@@ -48,7 +44,7 @@ declare module "@/client/context" {
|
|
|
48
44
|
export default useContext;
|
|
49
45
|
}
|
|
50
46
|
|
|
51
|
-
declare module
|
|
52
|
-
const ServerApplicationClass: import(
|
|
47
|
+
declare module '@app' {
|
|
48
|
+
const ServerApplicationClass: import('../server/app').default;
|
|
53
49
|
export = ServerApplicationClass;
|
|
54
|
-
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Controller, { schema } from '@server/app/controller';
|
|
2
|
+
|
|
3
|
+
type Assert<T extends true> = T;
|
|
4
|
+
|
|
5
|
+
type Equals<TLeft, TRight> = (<T>() => T extends TLeft ? 1 : 2) extends <T>() => T extends TRight ? 1 : 2
|
|
6
|
+
? (<T>() => T extends TRight ? 1 : 2) extends <T>() => T extends TLeft ? 1 : 2
|
|
7
|
+
? true
|
|
8
|
+
: false
|
|
9
|
+
: false;
|
|
10
|
+
|
|
11
|
+
class InputInferenceController extends Controller {
|
|
12
|
+
public fromShape() {
|
|
13
|
+
return this.input({
|
|
14
|
+
name: schema.string(),
|
|
15
|
+
age: schema.number().optional(),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public fromSchema() {
|
|
20
|
+
return this.input(
|
|
21
|
+
schema.object({
|
|
22
|
+
slug: schema.string(),
|
|
23
|
+
}),
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type TFromShape = ReturnType<InputInferenceController['fromShape']>;
|
|
29
|
+
type TFromSchema = ReturnType<InputInferenceController['fromSchema']>;
|
|
30
|
+
|
|
31
|
+
type _AssertShapeInference = Assert<
|
|
32
|
+
Equals<
|
|
33
|
+
TFromShape,
|
|
34
|
+
{
|
|
35
|
+
name: string;
|
|
36
|
+
age?: number | undefined;
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
>;
|
|
40
|
+
|
|
41
|
+
type _AssertSchemaInference = Assert<
|
|
42
|
+
Equals<
|
|
43
|
+
TFromSchema,
|
|
44
|
+
{
|
|
45
|
+
slug: string;
|
|
46
|
+
}
|
|
47
|
+
>
|
|
48
|
+
>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const __DEV__: boolean;
|
|
2
|
+
declare const SERVER: boolean;
|
|
3
|
+
|
|
4
|
+
declare const CORE_VERSION: string;
|
|
5
|
+
declare const CORE_PATH: string;
|
|
6
|
+
|
|
7
|
+
declare const BUILD_DATE: string;
|
|
8
|
+
declare const BUILD_ID: number;
|
|
9
|
+
|
|
10
|
+
declare const APP_PATH: string;
|
|
11
|
+
declare const APP_NAME: string;
|
|
12
|
+
declare const APP_OUTPUT_DIR: string;
|
|
13
|
+
declare const PROTEUM_DEV_EVENT_PORT: number | null;
|
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
----------------------------------*/
|
|
4
4
|
|
|
5
5
|
// Contenu brut + métadonnées
|
|
6
|
-
declare module
|
|
7
|
-
const value: String & {
|
|
8
|
-
id: string,
|
|
9
|
-
sourcefile: string
|
|
10
|
-
};
|
|
6
|
+
declare module '*.sql' {
|
|
7
|
+
const value: String & { id: string; sourcefile: string };
|
|
11
8
|
export = value;
|
|
12
9
|
}
|
|
13
10
|
|
|
14
11
|
// Contenu brut + métadonnées
|
|
15
|
-
declare module
|
|
12
|
+
declare module '*.json' {
|
|
16
13
|
const value: any;
|
|
17
14
|
export = value;
|
|
18
15
|
}
|
|
@@ -22,7 +19,7 @@ declare module "*.json" {
|
|
|
22
19
|
----------------------------------*/
|
|
23
20
|
|
|
24
21
|
// Contenu brut
|
|
25
|
-
declare module
|
|
22
|
+
declare module '*.md' {
|
|
26
23
|
const value: string;
|
|
27
24
|
export = value;
|
|
28
25
|
}
|
|
@@ -31,19 +28,19 @@ declare module "*.md" {
|
|
|
31
28
|
- ASSETS: CHEMIN PUBLIC
|
|
32
29
|
----------------------------------*/
|
|
33
30
|
|
|
34
|
-
declare module
|
|
31
|
+
declare module '*.svg' {
|
|
35
32
|
const value: string;
|
|
36
33
|
export = value;
|
|
37
34
|
}
|
|
38
35
|
|
|
39
|
-
declare module
|
|
40
|
-
declare module
|
|
41
|
-
declare module
|
|
42
|
-
declare module
|
|
43
|
-
declare module
|
|
44
|
-
declare module
|
|
36
|
+
declare module '*.png';
|
|
37
|
+
declare module '*.jpg';
|
|
38
|
+
declare module '*.jpeg';
|
|
39
|
+
declare module '*.webp';
|
|
40
|
+
declare module '*.gif';
|
|
41
|
+
declare module '*.bmp';
|
|
45
42
|
|
|
46
|
-
declare module
|
|
43
|
+
declare module '*.mp3' {
|
|
47
44
|
const value: string;
|
|
48
45
|
export = value;
|
|
49
|
-
}
|
|
46
|
+
}
|
package/types/global/utils.d.ts
CHANGED
|
@@ -1,47 +1,30 @@
|
|
|
1
|
-
declare type TObjetDonnees = {[cle: string]: any}
|
|
1
|
+
declare type TObjetDonnees = { [cle: string]: any };
|
|
2
2
|
|
|
3
3
|
// Rend certaines clés d'un objet obligatoires
|
|
4
4
|
declare type With<
|
|
5
5
|
TObject,
|
|
6
|
-
TRequired extends
|
|
7
|
-
TAdditionnal extends {[key: string]: any} = {}
|
|
8
|
-
> =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
};
|
|
6
|
+
TRequired extends keyof TObject | { [key in keyof TObject]?: any },
|
|
7
|
+
TAdditionnal extends { [key: string]: any } = {},
|
|
8
|
+
> = Omit<TObject, TRequired extends keyof TObject ? TRequired : keyof TRequired> &
|
|
9
|
+
(TRequired extends keyof TObject ? Required<Pick<TObject, TRequired>> : TRequired) &
|
|
10
|
+
TAdditionnal;
|
|
11
|
+
|
|
12
|
+
declare type NonNullFields<T, K extends keyof T> = Omit<T, K> & { [P in K]: NonNullable<T[P]> };
|
|
19
13
|
|
|
20
14
|
declare type ValueOf<T> = T[keyof T];
|
|
21
15
|
|
|
22
16
|
// Extrait la valeur de retour d'une promise
|
|
23
17
|
// https://stackoverflow.com/questions/48011353/how-to-unwrap-type-of-a-promise
|
|
24
|
-
declare type ThenArg<T> = T extends PromiseLike<infer U> ? U : T
|
|
18
|
+
declare type ThenArg<T> = T extends PromiseLike<infer U> ? U : T;
|
|
25
19
|
|
|
26
|
-
declare type TPagination<TElement> = {
|
|
27
|
-
list: TElement[],
|
|
28
|
-
page: number,
|
|
29
|
-
pages: number,
|
|
30
|
-
total: number
|
|
31
|
-
}
|
|
20
|
+
declare type TPagination<TElement> = { list: TElement[]; page: number; pages: number; total: number };
|
|
32
21
|
|
|
33
22
|
// https://stackoverflow.com/questions/39392853/is-there-a-type-for-class-in-typescript-and-does-any-include-it
|
|
34
|
-
declare
|
|
23
|
+
declare type ClassType<T> = abstract new (...args: any[]) => T;
|
|
35
24
|
|
|
36
|
-
declare type TPagination<T> = {
|
|
37
|
-
docs: Array<T>;
|
|
38
|
-
pages: number;
|
|
39
|
-
total: number;
|
|
40
|
-
}
|
|
25
|
+
declare type TPagination<T> = { docs: Array<T>; pages: number; total: number };
|
|
41
26
|
|
|
42
|
-
declare type TStats<T> = {
|
|
43
|
-
[time: number]: T
|
|
44
|
-
}
|
|
27
|
+
declare type TStats<T> = { [time: number]: T };
|
|
45
28
|
|
|
46
29
|
/*declare namespace JSX {
|
|
47
30
|
interface IntrinsicElements {
|
|
@@ -49,13 +32,7 @@ declare type TStats<T> = {
|
|
|
49
32
|
}
|
|
50
33
|
}*/
|
|
51
34
|
|
|
52
|
-
declare type Routes = {
|
|
53
|
-
[path: string]: {
|
|
54
|
-
params: {
|
|
55
|
-
[param: string]: any
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
35
|
+
declare type Routes = { [path: string]: { params: { [param: string]: any } } };
|
|
59
36
|
|
|
60
37
|
declare type PrimitiveValue = string | number | boolean;
|
|
61
38
|
|
|
@@ -87,17 +64,8 @@ declare type PrimitiveValue = string | number | boolean;
|
|
|
87
64
|
},
|
|
88
65
|
}*/
|
|
89
66
|
|
|
90
|
-
type TServiceSetup = {
|
|
91
|
-
id: string,
|
|
92
|
-
name: string,
|
|
93
|
-
config: {},
|
|
94
|
-
subservices: TServiceSubservices
|
|
95
|
-
}
|
|
67
|
+
type TServiceSetup = { id: string; name: string; config: {}; subservices: TServiceSubservices };
|
|
96
68
|
|
|
97
|
-
type TServiceRef = {
|
|
98
|
-
refTo: string
|
|
99
|
-
}
|
|
69
|
+
type TServiceRef = { refTo: string };
|
|
100
70
|
|
|
101
|
-
type TServiceSubservices = {
|
|
102
|
-
[key: string]: TServiceSetup | TServiceRef
|
|
103
|
-
}
|
|
71
|
+
type TServiceSubservices = { [key: string]: TServiceSetup | TServiceRef };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
declare module 'accepts' {
|
|
2
|
+
const accepts: any;
|
|
3
|
+
export default accepts;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare module 'bytes' {
|
|
7
|
+
const bytes: (value: string | number) => number;
|
|
8
|
+
export default bytes;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module 'compression' {
|
|
12
|
+
const compression: any;
|
|
13
|
+
export default compression;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module 'cookie-parser' {
|
|
17
|
+
const cookieParser: any;
|
|
18
|
+
export default cookieParser;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare module 'cors' {
|
|
22
|
+
export type CorsOptions = any;
|
|
23
|
+
const cors: any;
|
|
24
|
+
export default cors;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare module 'escape-html' {
|
|
28
|
+
export default function escapeHtml(value: string): string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare module 'escape-regexp' {
|
|
32
|
+
export default function escapeRegexp(value: string): string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare module 'express-fileupload' {
|
|
36
|
+
const fileUpload: any;
|
|
37
|
+
export default fileUpload;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare module 'hpp' {
|
|
41
|
+
const hpp: any;
|
|
42
|
+
export default hpp;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare module 'jsonwebtoken' {
|
|
46
|
+
const jwt: any;
|
|
47
|
+
export default jwt;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare module 'md5' {
|
|
51
|
+
export default function md5(value: string): string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare module 'morgan' {
|
|
55
|
+
const morgan: any;
|
|
56
|
+
export default morgan;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare module 'stopword' {
|
|
60
|
+
export const eng: string[];
|
|
61
|
+
export function removeStopwords(words: string[], stopwords?: string[]): string[];
|
|
62
|
+
}
|
package/types/icons.d.ts
CHANGED
|
@@ -1 +1,65 @@
|
|
|
1
|
-
export type TIcones =
|
|
1
|
+
export type TIcones =
|
|
2
|
+
| 'solid/spinner-third'
|
|
3
|
+
| 'info-circle'
|
|
4
|
+
| 'check-circle'
|
|
5
|
+
| 'exclamation-circle'
|
|
6
|
+
| 'times-circle'
|
|
7
|
+
| 'times'
|
|
8
|
+
| 'clock'
|
|
9
|
+
| 'stars'
|
|
10
|
+
| 'crosshairs'
|
|
11
|
+
| 'radar'
|
|
12
|
+
| 'chart-line'
|
|
13
|
+
| 'home'
|
|
14
|
+
| 'search'
|
|
15
|
+
| 'user'
|
|
16
|
+
| 'chart-bar'
|
|
17
|
+
| 'columns'
|
|
18
|
+
| 'globe'
|
|
19
|
+
| 'bookmark'
|
|
20
|
+
| 'tag'
|
|
21
|
+
| 'angle-down'
|
|
22
|
+
| 'check'
|
|
23
|
+
| 'meh-rolling-eyes'
|
|
24
|
+
| 'arrow-left'
|
|
25
|
+
| 'arrow-right'
|
|
26
|
+
| 'eye'
|
|
27
|
+
| 'trash'
|
|
28
|
+
| 'sparkles'
|
|
29
|
+
| 'unlink'
|
|
30
|
+
| 'pen'
|
|
31
|
+
| 'link'
|
|
32
|
+
| 'file'
|
|
33
|
+
| 'bold'
|
|
34
|
+
| 'italic'
|
|
35
|
+
| 'underline'
|
|
36
|
+
| 'strikethrough'
|
|
37
|
+
| 'subscript'
|
|
38
|
+
| 'superscript'
|
|
39
|
+
| 'code'
|
|
40
|
+
| 'plus'
|
|
41
|
+
| 'font'
|
|
42
|
+
| 'empty-set'
|
|
43
|
+
| 'plus-circle'
|
|
44
|
+
| 'horizontal-rule'
|
|
45
|
+
| 'page-break'
|
|
46
|
+
| 'image'
|
|
47
|
+
| 'table'
|
|
48
|
+
| 'poll'
|
|
49
|
+
| 'sticky-note'
|
|
50
|
+
| 'caret-right'
|
|
51
|
+
| 'list-ul'
|
|
52
|
+
| 'check-square'
|
|
53
|
+
| 'h1'
|
|
54
|
+
| 'h2'
|
|
55
|
+
| 'h3'
|
|
56
|
+
| 'h4'
|
|
57
|
+
| 'list-ol'
|
|
58
|
+
| 'paragraph'
|
|
59
|
+
| 'quote-left'
|
|
60
|
+
| 'align-left'
|
|
61
|
+
| 'align-center'
|
|
62
|
+
| 'align-right'
|
|
63
|
+
| 'align-justify'
|
|
64
|
+
| 'indent'
|
|
65
|
+
| 'outdent';
|
package/types/uuid.d.ts
ADDED