miolo 3.0.0-beta.182 → 3.0.0-beta.184

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,6 +1,6 @@
1
1
  {
2
2
  "name": "miolo",
3
- "version": "3.0.0-beta.182",
3
+ "version": "3.0.0-beta.184",
4
4
  "description": "all-in-one koa-based server",
5
5
  "author": "Donato Lorenzo <donato@afialapis.com>",
6
6
  "contributors": [
@@ -19,6 +19,12 @@ export default function make_config_defaults() {
19
19
  ? process.env?.MIOLO_HOSTNAME_DOCKER || "0.0.0.0"
20
20
  : process.env?.MIOLO_HOSTNAME || "localhost",
21
21
 
22
+ ssl: undefined,
23
+ //ssl: {
24
+ // key: fs.readFileSync('.../key.pem'),
25
+ // cert: fs.readFileSync('.../cert.pem'),
26
+ // }
27
+
22
28
  catcher_url: "/sys/jserror",
23
29
 
24
30
  static: {
@@ -1,4 +1,5 @@
1
1
  import http from "node:http"
2
+ import https from "node:https"
2
3
  //import util from 'util'
3
4
  import { createHttpTerminator } from "http-terminator"
4
5
 
@@ -37,7 +38,14 @@ export function init_http_server(app, config) {
37
38
  }
38
39
 
39
40
  // Init server
40
- const server = http.createServer(app.callback())
41
+ const server =
42
+ config?.ssl === undefined
43
+ ? http.createServer(app.callback())
44
+ : https
45
+ .createServer(config.ssl, app.callback())
46
+ .listen(config.port, config.hostname, () => {
47
+ logger.info("[http][start] Server running at https://localhost:8010")
48
+ })
41
49
 
42
50
  // Init terminator
43
51
  const httpTerminator = createHttpTerminator({
@@ -26,7 +26,7 @@ import { init_session_middleware } from "./session/index.mjs"
26
26
 
27
27
  const def_get_user_id = async (user, _ctx) => user?.id
28
28
 
29
- const def_find_user_by_id = async (_id, ctx) => {
29
+ const def_find_user_by_id = async (_id, _ctx) => {
30
30
  throw new Error("You need to define auth.passport.find_user_by_id")
31
31
  }
32
32
 
@@ -13,13 +13,18 @@ export async function init_vite_dev_server_middleware(app, viteConfig) {
13
13
  // const tailwindConfigPath = resolve(process.cwd(), 'tailwind.config.js')
14
14
  // const tailwindConfig = await import(tailwindConfigPath)
15
15
 
16
+ const serverConfig = viteConfig?.server || {}
17
+ delete viteConfig?.server
18
+
16
19
  vite = await createServer({
17
20
  server: {
18
21
  middlewareMode: true,
19
22
  port: process.env?.MIOLO_PORT || 8001,
20
23
  hmr: {
21
24
  port: process.env?.MIOLO_DEV_PORT || (process.env?.MIOLO_PORT || 8001) - 1000
22
- }
25
+ },
26
+
27
+ ...serverConfig
23
28
  },
24
29
  appType: "custom",
25
30
  plugins: [
@@ -44,9 +44,9 @@
44
44
  "intre": "^3.0.0-beta.4",
45
45
  "joi": "^18.1.2",
46
46
  "lucide-react": "^1.14.0",
47
- "miolo-cli": "^3.0.0-beta.182",
47
+ "miolo-cli": "^3.0.0-beta.184",
48
48
  "miolo-model": "file:../miolo-model",
49
- "miolo-react": "^3.0.0-beta.182",
49
+ "miolo-react": "^3.0.0-beta.184",
50
50
  "next-themes": "^0.4.6",
51
51
  "radix-ui": "^1.4.3",
52
52
  "react": "^19.2.5",
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "devDependencies": {
63
63
  "@biomejs/biome": "2.4.14",
64
- "miolo": "^3.0.0-beta.182",
64
+ "miolo": "^3.0.0-beta.184",
65
65
  "sass-embedded": "^1.99.0"
66
66
  },
67
67
  "overrides": {
@@ -1,7 +1,7 @@
1
1
  import { db_todo_find } from "#server/db/io/todos/find.mjs"
2
2
  import { db_todo_read } from "#server/db/io/todos/read.mjs"
3
3
 
4
- export async function r_todo_list(ctx, params) {
4
+ export async function r_todo_list(ctx, _params) {
5
5
  try {
6
6
  ctx.miolo.logger.info(`[r_todo_list] Reading todo list`)
7
7
 
@@ -18,4 +18,4 @@
18
18
  "type": "image/png"
19
19
  }
20
20
  ]
21
- }
21
+ }
@@ -2,7 +2,7 @@ const CACHE_NAME = "miolo-sample-cache-v1"
2
2
 
3
3
  // 1. EVENTO INSTALL: Ocurre la primera vez que el usuario entra.
4
4
  // Aquí cacheamos el "App Shell" (lo básico para que la app abra sin red).
5
- self.addEventListener("install", (event) => {
5
+ self.addEventListener("install", (_event) => {
6
6
  /*console.log(`[miolo][sw] installing`)
7
7
  event.waitUntil(
8
8
  caches.open(CACHE_NAME).then((cache) => {
@@ -33,7 +33,7 @@ self.addEventListener("activate", (event) => {
33
33
  })
34
34
 
35
35
  // 3. EVENTO FETCH: El núcleo de tu estrategia
36
- self.addEventListener("fetch", (event) => {
36
+ self.addEventListener("fetch", (_event) => {
37
37
  /*console.log(`[miolo][sw] fetching`)
38
38
  // ESTRATEGIA PARA LLAMADAS POST
39
39
  if (event.request.method === "POST" || event.request.method === "PUT") {