miolo 3.0.0-beta.160 → 3.0.0-beta.162
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 +5 -5
- package/src/db-conn.mjs +34 -0
- package/src/engines/logger/index.mjs +1 -1
- package/src/index.mjs +2 -2
- package/template/package.json +5 -5
- package/template/src/cli/context/data/DataProvider.jsx +7 -5
- package/template/src/cli/layout/nav-last-todos.jsx +1 -1
- package/template/src/cli/pages/todos/context/TodosProvider.jsx +3 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miolo",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.162",
|
|
4
4
|
"description": "all-in-one koa-based server",
|
|
5
5
|
"author": "Donato Lorenzo <donato@afialapis.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"@babel/plugin-proposal-decorators": "^7.29.0",
|
|
48
48
|
"@babel/preset-env": "^7.29.0",
|
|
49
49
|
"@babel/preset-react": "^7.28.5",
|
|
50
|
-
"@dotenvx/dotenvx": "^1.
|
|
50
|
+
"@dotenvx/dotenvx": "^1.54.1",
|
|
51
51
|
"@koa/bodyparser": "^6.1.0",
|
|
52
52
|
"@koa/cors": "^5.0.0",
|
|
53
53
|
"@koa/router": "^15.3.1",
|
|
54
54
|
"@maxmind/geoip2-node": "^6.3.4",
|
|
55
55
|
"@rollup/plugin-alias": "^6.0.0",
|
|
56
|
-
"@rollup/plugin-babel": "^
|
|
57
|
-
"@rollup/plugin-commonjs": "^29.0.
|
|
56
|
+
"@rollup/plugin-babel": "^7.0.0",
|
|
57
|
+
"@rollup/plugin-commonjs": "^29.0.2",
|
|
58
58
|
"@rollup/plugin-json": "^6.1.0",
|
|
59
59
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
60
60
|
"@rollup/plugin-replace": "^6.0.3",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"koa-session": "^7.0.2",
|
|
84
84
|
"koa-static": "^5.0.0",
|
|
85
85
|
"nanoid": "^5.1.6",
|
|
86
|
-
"nodemailer": "^8.0.
|
|
86
|
+
"nodemailer": "^8.0.2",
|
|
87
87
|
"passport-google-oauth20": "^2.0.0",
|
|
88
88
|
"passport-local": "^1.0.0",
|
|
89
89
|
"rollup": "^4.59.0",
|
package/src/db-conn.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { dropConnections, getConnection } from "calustra"
|
|
2
|
+
import { init_config } from "./config/index.mjs"
|
|
3
|
+
import { init_logger } from "./engines/logger/index.mjs"
|
|
4
|
+
import { miolo_cacher_options_for_calustra } from "./middleware/context/cache/options.mjs"
|
|
5
|
+
|
|
6
|
+
export async function miolo_db_connection_pg(makeConfig, options = undefined) {
|
|
7
|
+
const config = init_config(makeConfig)
|
|
8
|
+
|
|
9
|
+
// init logger first
|
|
10
|
+
const logger = init_logger(config.log, undefined, config?.name)
|
|
11
|
+
|
|
12
|
+
if (config.db.config.dialect === "sqlite") {
|
|
13
|
+
logger.error(`[miolo] SQLite is not supported yet`)
|
|
14
|
+
return undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// parse db options
|
|
18
|
+
const dbOptions = {
|
|
19
|
+
...config.db.options,
|
|
20
|
+
...(options || {}),
|
|
21
|
+
log: logger,
|
|
22
|
+
cache: miolo_cacher_options_for_calustra(config, logger)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const conn = await getConnection(config.db.config, dbOptions)
|
|
26
|
+
|
|
27
|
+
conn.get_model = conn.getModel
|
|
28
|
+
|
|
29
|
+
return conn
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function miolo_db_drop_connections() {
|
|
33
|
+
await dropConnections()
|
|
34
|
+
}
|
|
@@ -228,7 +228,7 @@ const init_logger = (config, emailer, prefix = "miolo") => {
|
|
|
228
228
|
//
|
|
229
229
|
// Mail transport
|
|
230
230
|
//
|
|
231
|
-
if (config?.mail?.enabled === true) {
|
|
231
|
+
if (emailer && config?.mail?.enabled === true) {
|
|
232
232
|
const MailerLogger = init_logger_to_mail(config.mail, emailer)
|
|
233
233
|
transports.MailerLogger = MailerLogger
|
|
234
234
|
|
package/src/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cacheiro as miolo_cacher } from "cacheiro"
|
|
2
|
-
import {
|
|
2
|
+
import { miolo_db_connection_pg, miolo_db_drop_connections } from "./db-conn.mjs"
|
|
3
3
|
import { init_emailer_transporter as miolo_emailer } from "./engines/emailer/index.mjs"
|
|
4
4
|
import { init_logger as miolo_logger } from "./engines/logger/index.mjs"
|
|
5
5
|
import { init_parser as miolo_parser } from "./engines/parser/index.mjs"
|
|
@@ -16,6 +16,6 @@ export {
|
|
|
16
16
|
miolo_parser,
|
|
17
17
|
miolo_cacher,
|
|
18
18
|
miolo_db_connection_pg,
|
|
19
|
-
|
|
19
|
+
miolo_db_drop_connections,
|
|
20
20
|
with_miolo_schema
|
|
21
21
|
}
|
package/template/package.json
CHANGED
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
"farrapa": "^3.0.0-beta.10",
|
|
44
44
|
"intre": "^3.0.0-beta.4",
|
|
45
45
|
"joi": "^18.0.2",
|
|
46
|
-
"lucide-react": "^0.
|
|
47
|
-
"miolo-cli": "^3.0.0-beta.
|
|
46
|
+
"lucide-react": "^0.577.0",
|
|
47
|
+
"miolo-cli": "^3.0.0-beta.162",
|
|
48
48
|
"miolo-model": "file:../miolo-model",
|
|
49
|
-
"miolo-react": "^3.0.0-beta.
|
|
49
|
+
"miolo-react": "^3.0.0-beta.162",
|
|
50
50
|
"next-themes": "^0.4.6",
|
|
51
51
|
"radix-ui": "^1.4.3",
|
|
52
52
|
"react": "^19.2.4",
|
|
53
53
|
"react-dom": "^19.2.4",
|
|
54
54
|
"react-router": "^7.13.1",
|
|
55
|
-
"recharts": "^3.
|
|
55
|
+
"recharts": "^3.8.0",
|
|
56
56
|
"sonner": "^2.0.7",
|
|
57
57
|
"tailwind": "^4.0.0",
|
|
58
58
|
"tailwind-merge": "^3.5.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"tw-animate-css": "^1.4.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"miolo": "^3.0.0-beta.
|
|
63
|
+
"miolo": "^3.0.0-beta.162",
|
|
64
64
|
"sass-embedded": "^1.97.3"
|
|
65
65
|
},
|
|
66
66
|
"overrides": {
|
|
@@ -8,11 +8,13 @@ const DataProvider = ({ children }) => {
|
|
|
8
8
|
const [breads, setBreads] = useState([])
|
|
9
9
|
const { useSsrData } = useSessionContext()
|
|
10
10
|
|
|
11
|
-
const [todos, _setTodos, refreshTodos] = useSsrData("todos",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const [todos, _setTodos, refreshTodos] = useSsrData("todos", {
|
|
12
|
+
loader: async (_context, fetcher) => {
|
|
13
|
+
setStatus("loading")
|
|
14
|
+
const { data: nTodos } = await fetcher.get("/api/todo/list")
|
|
15
|
+
setStatus("loaded")
|
|
16
|
+
return new TodoList(nTodos)
|
|
17
|
+
}
|
|
16
18
|
})
|
|
17
19
|
|
|
18
20
|
const setTitle = useCallback((title) => {
|
|
@@ -50,7 +50,7 @@ export function NavLastTodos() {
|
|
|
50
50
|
<CollapsibleContent>
|
|
51
51
|
<SidebarMenuSub>
|
|
52
52
|
{lastTodos.map((todo) => (
|
|
53
|
-
<SidebarMenuSubItem key={todo.
|
|
53
|
+
<SidebarMenuSubItem key={todo.id}>
|
|
54
54
|
<SidebarMenuSubButton asChild>
|
|
55
55
|
<Link to={`/`}>
|
|
56
56
|
{todo.done ? <RouteOff color="red" /> : <Route color="green" />}
|
|
@@ -8,10 +8,8 @@ const TodosProvider = ({ children }) => {
|
|
|
8
8
|
const { useSsrData, fetcher, authenticated } = useSessionContext()
|
|
9
9
|
const [useCrud, setUseCrud] = useState(true)
|
|
10
10
|
|
|
11
|
-
const [todoList, setTodoList, refreshTodoList] = useSsrData(
|
|
12
|
-
|
|
13
|
-
[],
|
|
14
|
-
async (_context, fetcher) => {
|
|
11
|
+
const [todoList, setTodoList, refreshTodoList] = useSsrData("todos", {
|
|
12
|
+
loader: async (_context, fetcher) => {
|
|
15
13
|
setStatus("loading")
|
|
16
14
|
let data
|
|
17
15
|
if (useCrud) {
|
|
@@ -23,7 +21,7 @@ const TodosProvider = ({ children }) => {
|
|
|
23
21
|
setStatus("loaded")
|
|
24
22
|
return new TodoList(data.sort((a, b) => b.created_at - a.created_at))
|
|
25
23
|
}
|
|
26
|
-
)
|
|
24
|
+
})
|
|
27
25
|
|
|
28
26
|
const addTodo = useCallback(
|
|
29
27
|
(text) => {
|