@seip/blue-bird 0.7.6 → 0.9.0

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.
Files changed (40) hide show
  1. package/.env_example +34 -34
  2. package/AGENTS.md +174 -249
  3. package/LICENSE +21 -21
  4. package/README.md +331 -367
  5. package/{index.js → backend/index.js} +22 -30
  6. package/backend/routes/api.js +57 -57
  7. package/core/app.js +338 -402
  8. package/core/auth.js +262 -256
  9. package/core/cache.js +174 -174
  10. package/core/cli/docker.js +488 -457
  11. package/core/cli/init.js +333 -337
  12. package/core/cli/route.js +42 -42
  13. package/core/config.js +52 -52
  14. package/core/database.js +263 -263
  15. package/core/debug.js +248 -248
  16. package/core/logger.js +115 -115
  17. package/core/middleware.js +27 -27
  18. package/core/router.js +144 -144
  19. package/core/swagger.js +40 -40
  20. package/core/upload.js +77 -77
  21. package/core/validate.js +380 -380
  22. package/docker/Dockerfile +16 -16
  23. package/docker/docker-compose.dev.yml +6 -0
  24. package/docker/docker-compose.mysql.yml +92 -92
  25. package/docker/docker-compose.none.yml +68 -68
  26. package/docker/docker-compose.postgres.yml +93 -93
  27. package/docker/nginx.conf +98 -106
  28. package/docker-compose.yml +92 -92
  29. package/frontend/about.html +103 -0
  30. package/frontend/images/favicon.ico +0 -0
  31. package/frontend/index.html +141 -0
  32. package/frontend/js/tailwind.js +8 -0
  33. package/package.json +64 -71
  34. package/frontend/astro.config.mjs +0 -35
  35. package/frontend/public/css/app.css +0 -319
  36. package/frontend/public/favicon.ico +0 -0
  37. package/frontend/src/http/api.js +0 -29
  38. package/frontend/src/layouts/Layout.astro +0 -20
  39. package/frontend/src/pages/about.astro +0 -54
  40. package/frontend/src/pages/index.astro +0 -110
package/core/cli/route.js CHANGED
@@ -1,43 +1,43 @@
1
- import path from 'path';
2
- import fs from 'fs';
3
- import Config from "../config.js";
4
-
5
- const __dirname = Config.dirname();
6
-
7
- class RouteCLI {
8
- /**
9
- * Create route
10
- */
11
- create() {
12
- let nameRoute = process.argv[2];
13
- if (!nameRoute) {
14
- console.log("Please provide a route name. Usage: npm run route <route-name>");
15
- return;
16
- }
17
- nameRoute =nameRoute.charAt(0).toUpperCase() + nameRoute.slice(1);
18
- const folder= path.join(__dirname, 'backend/routes');
19
- if (!fs.existsSync(folder)){
20
- fs.mkdirSync(folder, { recursive: true });
21
- }
22
- const filePath = path.join(folder, `${nameRoute}.js`);
23
- if (fs.existsSync(filePath)) {
24
- console.log(`Route ${nameRoute} already exists.`);
25
- return;
26
- }
27
- const content =`import Router from "@seip/blue-bird/core/router.js"
28
-
29
- const router${nameRoute} = new Router("/${nameRoute.toLowerCase()}");
30
-
31
- router${nameRoute}.get("/", (req, res) => {
32
- res.json({ message: "Hello from ${nameRoute} route!" });
33
- });
34
-
35
- export default router${nameRoute};
36
- `;
37
- fs.writeFileSync(filePath, content);
38
- console.log(`Route ${nameRoute} created successfully at ${filePath}`);
39
- }
40
- }
41
-
42
- const routeCLI = new RouteCLI();
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+ import Config from "../config.js";
4
+
5
+ const __dirname = Config.dirname();
6
+
7
+ class RouteCLI {
8
+ /**
9
+ * Create route
10
+ */
11
+ create() {
12
+ let nameRoute = process.argv[2];
13
+ if (!nameRoute) {
14
+ console.log("Please provide a route name. Usage: npm run route <route-name>");
15
+ return;
16
+ }
17
+ nameRoute =nameRoute.charAt(0).toUpperCase() + nameRoute.slice(1);
18
+ const folder= path.join(__dirname, 'backend/routes');
19
+ if (!fs.existsSync(folder)){
20
+ fs.mkdirSync(folder, { recursive: true });
21
+ }
22
+ const filePath = path.join(folder, `${nameRoute}.js`);
23
+ if (fs.existsSync(filePath)) {
24
+ console.log(`Route ${nameRoute} already exists.`);
25
+ return;
26
+ }
27
+ const content =`import Router from "@seip/blue-bird/core/router.js"
28
+
29
+ const router${nameRoute} = new Router("/${nameRoute.toLowerCase()}");
30
+
31
+ router${nameRoute}.get("/", (req, res) => {
32
+ res.json({ message: "Hello from ${nameRoute} route!" });
33
+ });
34
+
35
+ export default router${nameRoute};
36
+ `;
37
+ fs.writeFileSync(filePath, content);
38
+ console.log(`Route ${nameRoute} created successfully at ${filePath}`);
39
+ }
40
+ }
41
+
42
+ const routeCLI = new RouteCLI();
43
43
  routeCLI.create()
package/core/config.js CHANGED
@@ -1,52 +1,52 @@
1
- import path from "path";
2
-
3
- let _cachedProps = null;
4
-
5
- /**
6
- * Configuration class to manage application-wide settings and environment variables.
7
- */
8
- class Config {
9
- /**
10
- * Returns the base directory of the application.
11
- * @returns {string} The current working directory.
12
- */
13
- static dirname() {
14
- return process.cwd();
15
- }
16
-
17
- /**
18
- * Retrieves application properties from environment variables or default values.
19
- * Results are cached after first call for performance.
20
- * @returns {{debug: boolean, descriptionMeta: string, keywordsMeta: string, titleMeta: string, authorMeta: string, description: string, title: string, version: string, langMeta: string, host: string, appUrl: string, port: number, static: {path: string, options: Object}}} The configuration properties object.
21
- * @example
22
- * const props = Config.props();
23
- * console.log(props);
24
- */
25
- static props() {
26
- if (_cachedProps) return _cachedProps;
27
-
28
- const portRaw = parseInt(process.env.PORT);
29
-
30
- _cachedProps = {
31
- debug: process.env.DEBUG === "true",
32
- descriptionMeta: process.env.DESCRIPTION_META || "",
33
- keywordsMeta: process.env.KEYWORDS_META || "",
34
- titleMeta: process.env.TITLE_META || "",
35
- authorMeta: process.env.AUTHOR_META || "",
36
- description: process.env.DESCRIPTION || "",
37
- title: process.env.TITLE || "",
38
- version: process.env.VERSION || "1.0.0",
39
- langMeta: process.env.LANGMETA || "en",
40
- host: process.env.HOST || "http://localhost",
41
- appUrl: process.env.APP_URL || process.env.HOST || "http://localhost",
42
- port: Number.isNaN(portRaw) ? 3000 : portRaw,
43
- jwtSecret: process.env.JWT_SECRET,
44
- static: {
45
- path: process.env.STATIC_PATH || "frontend/public",
46
- options: {},
47
- },
48
- };
49
- return _cachedProps;
50
- }
51
- }
52
- export default Config;
1
+ import path from "path";
2
+
3
+ let _cachedProps = null;
4
+
5
+ /**
6
+ * Configuration class to manage application-wide settings and environment variables.
7
+ */
8
+ class Config {
9
+ /**
10
+ * Returns the base directory of the application.
11
+ * @returns {string} The current working directory.
12
+ */
13
+ static dirname() {
14
+ return process.cwd();
15
+ }
16
+
17
+ /**
18
+ * Retrieves application properties from environment variables or default values.
19
+ * Results are cached after first call for performance.
20
+ * @returns {{debug: boolean, descriptionMeta: string, keywordsMeta: string, titleMeta: string, authorMeta: string, description: string, title: string, version: string, langMeta: string, host: string, appUrl: string, port: number, static: {path: string, options: Object}}} The configuration properties object.
21
+ * @example
22
+ * const props = Config.props();
23
+ * console.log(props);
24
+ */
25
+ static props() {
26
+ if (_cachedProps) return _cachedProps;
27
+
28
+ const portRaw = parseInt(process.env.PORT);
29
+
30
+ _cachedProps = {
31
+ debug: process.env.DEBUG === "true",
32
+ descriptionMeta: process.env.DESCRIPTION_META || "",
33
+ keywordsMeta: process.env.KEYWORDS_META || "",
34
+ titleMeta: process.env.TITLE_META || "",
35
+ authorMeta: process.env.AUTHOR_META || "",
36
+ description: process.env.DESCRIPTION || "",
37
+ title: process.env.TITLE || "",
38
+ version: process.env.VERSION || "1.0.0",
39
+ langMeta: process.env.LANGMETA || "en",
40
+ host: process.env.HOST || "http://localhost",
41
+ appUrl: process.env.APP_URL || process.env.HOST || "http://localhost",
42
+ port: Number.isNaN(portRaw) ? 3000 : portRaw,
43
+ jwtSecret: process.env.JWT_SECRET,
44
+ static: {
45
+ path: process.env.STATIC_PATH || "frontend/public",
46
+ options: {},
47
+ },
48
+ };
49
+ return _cachedProps;
50
+ }
51
+ }
52
+ export default Config;