miolo 3.0.0-beta.222 → 3.0.0-beta.223

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.222",
3
+ "version": "3.0.0-beta.223",
4
4
  "description": "all-in-one koa-based server",
5
5
  "author": "Donato Lorenzo <donato@afialapis.com>",
6
6
  "contributors": [
@@ -47,7 +47,7 @@
47
47
  "@babel/plugin-proposal-decorators": "^7.29.7",
48
48
  "@babel/preset-env": "^7.29.7",
49
49
  "@babel/preset-react": "^7.29.7",
50
- "@dotenvx/dotenvx": "^2.1.4",
50
+ "@dotenvx/dotenvx": "^2.7.3",
51
51
  "@koa/bodyparser": "^6.1.0",
52
52
  "@koa/cors": "^5.0.0",
53
53
  "@koa/router": "^15.7.0",
@@ -82,7 +82,7 @@
82
82
  "koa-ratelimit": "^6.0.0",
83
83
  "koa-session": "^7.0.2",
84
84
  "koa-static": "^5.0.0",
85
- "nanoid": "^5.1.16",
85
+ "nanoid": "^6.0.0",
86
86
  "nodemailer": "^9.0.3",
87
87
  "passport-google-oauth20": "^2.0.0",
88
88
  "passport-local": "^1.0.0",
@@ -94,7 +94,7 @@
94
94
  "statuses": "^2.0.2",
95
95
  "tailwindcss": "^4.3.2",
96
96
  "tinguir": "^0.0.7",
97
- "vite": "^8.1.3",
97
+ "vite": "^8.1.4",
98
98
  "winston": "^3.19.0",
99
99
  "winston-daily-rotate-file": "^5.0.0",
100
100
  "yargs-parser": "^22.0.0"
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.5.2/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.5.3/schema.json",
3
3
  "files": {
4
4
  "includes": [
5
5
  "**/*",
@@ -27,15 +27,15 @@
27
27
  "#static/*": "./src/static/*"
28
28
  },
29
29
  "dependencies": {
30
- "@radix-ui/react-avatar": "^1.2.1",
31
- "@radix-ui/react-collapsible": "^1.1.15",
32
- "@radix-ui/react-dialog": "^1.1.18",
33
- "@radix-ui/react-dropdown-menu": "^2.1.19",
30
+ "@radix-ui/react-avatar": "^1.2.2",
31
+ "@radix-ui/react-collapsible": "^1.1.16",
32
+ "@radix-ui/react-dialog": "^1.1.19",
33
+ "@radix-ui/react-dropdown-menu": "^2.1.20",
34
34
  "@radix-ui/react-label": "^2.1.11",
35
- "@radix-ui/react-select": "^2.3.2",
35
+ "@radix-ui/react-select": "^2.3.3",
36
36
  "@radix-ui/react-separator": "^1.1.11",
37
37
  "@radix-ui/react-slot": "^1.3.0",
38
- "@radix-ui/react-tooltip": "^1.2.11",
38
+ "@radix-ui/react-tooltip": "^1.2.12",
39
39
  "@stepperize/react": "^7.0.0",
40
40
  "@tailwindcss/postcss": "^4.3.2",
41
41
  "@tanstack/react-table": "^8.21.3",
@@ -44,15 +44,15 @@
44
44
  "farrapa": "^3.0.0-beta.10",
45
45
  "intre": "^3.0.0-beta.4",
46
46
  "joi": "^18.2.3",
47
- "lucide-react": "^1.23.0",
48
- "miolo-cli": "^3.0.0-beta.222",
47
+ "lucide-react": "^1.24.0",
48
+ "miolo-cli": "^3.0.0-beta.223",
49
49
  "miolo-model": "file:../miolo-model",
50
- "miolo-react": "^3.0.0-beta.222",
50
+ "miolo-react": "^3.0.0-beta.223",
51
51
  "next-themes": "^0.4.6",
52
- "radix-ui": "^1.6.1",
52
+ "radix-ui": "^1.6.2",
53
53
  "react": "^19.2.7",
54
54
  "react-dom": "^19.2.7",
55
- "react-router": "^8.1.0",
55
+ "react-router": "^8.2.0",
56
56
  "recharts": "^3.9.2",
57
57
  "sonner": "^2.0.7",
58
58
  "tailwind": "^4.0.0",
@@ -61,8 +61,8 @@
61
61
  "tw-animate-css": "^1.4.0"
62
62
  },
63
63
  "devDependencies": {
64
- "@biomejs/biome": "2.5.2",
65
- "miolo": "^3.0.0-beta.222",
64
+ "@biomejs/biome": "2.5.3",
65
+ "miolo": "^3.0.0-beta.223",
66
66
  "sass-embedded": "^1.100.0"
67
67
  },
68
68
  "overrides": {
@@ -3,6 +3,26 @@ import useSessionContext from "#cli/context/session/useSessionContext.mjs"
3
3
  import TodoList from "#ns/models/TodoList.mjs"
4
4
  import DataContext from "./DataContext.jsx"
5
5
 
6
+ /**
7
+ * @typedef {import('#ns/models/TodoList.mjs').default} TodoList
8
+ * @typedef {import('#ns/models/Todo.mjs').default} Todo
9
+ *
10
+ * @typedef {Object} DataContextData
11
+ * @property {TodoList} lastTodos - The list of last todos.
12
+ * @property {(options?: Object) => Promise<void>} refreshLastTodos - Function to refresh the list of last todos.
13
+ * @property {boolean} loading - Whether the data is loading.
14
+ * @property {boolean} loaded - Whether the data is loaded.
15
+ * @property {Array<Object>} breads - The list of breads.
16
+ * @property {(breads: Array<Object>) => void} setBreads - Function to set the list of breads.
17
+ * @property {(title: string) => void} setTitle - Function to set the title of the page.
18
+ */
19
+
20
+ /**
21
+ * @param {Object} props - The props object.
22
+ * @param {React.ReactNode} props.children - The children of the component.
23
+ * @returns {React.ReactNode} The provider.
24
+ * @public
25
+ */
6
26
  const DataProvider = ({ children }) => {
7
27
  const [breads, setBreads] = useState([])
8
28
  const { useSsrData } = useSessionContext()
@@ -1,4 +1,10 @@
1
1
  import { useContext } from "react"
2
2
  import DataContext from "./DataContext.jsx"
3
3
 
4
- export default () => useContext(DataContext)
4
+ /**
5
+ * @typedef {import('./DataContext.jsx').DataContextData} DataContextData
6
+ * @returns {DataContextData}
7
+ */
8
+ const useDataContext = () => useContext(DataContext)
9
+
10
+ export default useDataContext
@@ -5,6 +5,26 @@ import useUIContext from "#cli/context/ui/useUIContext.mjs"
5
5
  import TodoList from "#ns/models/TodoList.mjs"
6
6
  import TodosContext from "./TodosContext.jsx"
7
7
 
8
+
9
+ /**
10
+ * @typedef {Object} TodosProviderData
11
+ * @property {TodoList} todoList - The list of todos.
12
+ * @property {Function} refreshTodoList - Function to refresh the list of todos.
13
+ * @property {boolean} loading - Whether the data is loading.
14
+ * @property {boolean} loaded - Whether the data is loaded.
15
+ * @property {Function} addTodo - Function to add a todo.
16
+ * @property {Function} toggleTodo - Function to toggle a todo.
17
+ * @property {Function} removeTodo - Function to remove a todo.
18
+ * @property {Function} checkLastHours - Function to check last hours.
19
+ * @property {Function} insertFakeTodo - Function to insert a fake todo.
20
+ * @property {boolean} canEdit - Whether the data can be edited.
21
+ * @property {boolean} useCrud - Whether to use crud.
22
+ * @property {Function} setUseCrud - Function to set the use crud.
23
+ * @property {Function} pingSocket - Function to ping the socket.
24
+ */
25
+
26
+
27
+
8
28
  const TodosProvider = ({ children }) => {
9
29
  // const [status, setStatus] = useState("loaded")
10
30
  const { logger } = useMioloContext()
@@ -1,4 +1,11 @@
1
1
  import { useContext } from "react"
2
2
  import TodosContext from "./TodosContext.jsx"
3
3
 
4
- export default () => useContext(TodosContext)
4
+
5
+ /**
6
+ * @typedef {import('./TodosProvider.jsx').TodosProviderData} TodosProviderData
7
+ * @returns {TodosProviderData}
8
+ */
9
+ const useTodosContext = () => useContext(TodosContext)
10
+
11
+ export default useTodosContext
@@ -1,29 +1,73 @@
1
1
  import { MioloModel } from "miolo-model"
2
2
 
3
3
  export default class Todo extends MioloModel {
4
+ /**
5
+ * Get the id of the todo.
6
+ * @returns {number|null} The id of the todo.
7
+ * @public
8
+ */
4
9
  get id() {
5
- return this._get("id", null)
10
+ return this.get_value("id", null)
6
11
  }
12
+
13
+ /**
14
+ * Get the description of the todo.
15
+ * @returns {string} The description of the todo.
16
+ * @public
17
+ */
7
18
  get description() {
8
- return this._get("description", "")
19
+ return this.get_value("description", "")
9
20
  }
21
+
22
+ /**
23
+ * Get the done status of the todo.
24
+ * @returns {boolean} The done status of the todo.
25
+ * @public
26
+ */
10
27
  get done() {
11
- return this._get("done", false)
28
+ return this.get_value("done", false)
12
29
  }
30
+ /**
31
+ * Toggle the done status of the todo.
32
+ * @public
33
+ */
13
34
  toggle() {
14
- this._set("done", !this.done)
35
+ this.set_value("done", !this.done)
15
36
  }
16
37
 
38
+ /**
39
+ * Get the creation date of the todo.
40
+ * @returns {number|undefined} The creation date of the todo.
41
+ * @public
42
+ */
17
43
  get createdAt() {
18
- return this._get("created_at")
44
+ return this.get_value("created_at")
19
45
  }
46
+
47
+ /**
48
+ * Get the last update date of the todo.
49
+ * @returns {number|undefined} The last update date of the todo.
50
+ * @public
51
+ */
20
52
  get lastUpdateAt() {
21
- return this._get("last_update_at")
53
+ return this.get_value("last_update_at")
22
54
  }
55
+
56
+ /**
57
+ * Get the user who created the todo.
58
+ * @returns {number|undefined} The user who created the todo.
59
+ * @public
60
+ */
23
61
  get createdBy() {
24
- return this._get("created_by")
62
+ return this.get_value("created_by")
25
63
  }
64
+
65
+ /**
66
+ * Get the user who last updated the todo.
67
+ * @returns {number|undefined} The user who last updated the todo.
68
+ * @public
69
+ */
26
70
  get lastUpdateBy() {
27
- return this._get("last_update_by")
71
+ return this.get_value("last_update_by")
28
72
  }
29
73
  }
@@ -1,7 +1,12 @@
1
1
  import { MioloArray } from "miolo-model"
2
2
  import Todo from "./Todo.mjs"
3
3
 
4
+
4
5
  export default class TodoList extends MioloArray {
6
+ /**
7
+ * @param {Array<Todo> | Array<Object>} [items=[]]
8
+ * @public
9
+ */
5
10
  constructor(items = []) {
6
11
  super(Todo, items)
7
12
  }
@@ -1,40 +1,111 @@
1
1
  import { MioloModel } from "miolo-model"
2
2
 
3
3
  export default class User extends MioloModel {
4
+ /**
5
+ * Get the id of the user.
6
+ * @returns {number} The id of the user.
7
+ * @public
8
+ */
4
9
  get id() {
5
- return this._get("id")
10
+ return this.get_value("id")
6
11
  }
12
+
13
+ /**
14
+ * Get the username of the user.
15
+ * @returns {string|undefined} The username of the user.
16
+ * @public
17
+ */
7
18
  get username() {
8
- return this._get("username")
19
+ return this.get_value("username")
9
20
  }
21
+
22
+ /**
23
+ * Get the password of the user.
24
+ * @returns {string|undefined} The password of the user.
25
+ * @public
26
+ */
10
27
  get password() {
11
- return this._get("password")
28
+ return this.get_value("password")
12
29
  }
30
+
31
+ /**
32
+ * Get the name of the user.
33
+ * @returns {string|undefined} The name of the user.
34
+ * @public
35
+ */
13
36
  get name() {
14
- return this._get("name")
37
+ return this.get_value("name")
15
38
  }
39
+
40
+ /**
41
+ * Get the email of the user.
42
+ * @returns {string|undefined} The email of the user.
43
+ * @public
44
+ */
16
45
  get email() {
17
- return this._get("email")
46
+ return this.get_value("email")
18
47
  }
48
+
49
+ /**
50
+ * Get the active status of the user.
51
+ * @returns {boolean|undefined} The active status of the user.
52
+ * @public
53
+ */
19
54
  get active() {
20
- return this._get("active")
55
+ return this.get_value("active")
21
56
  }
57
+
58
+ /**
59
+ * Get the last login date of the user.
60
+ * @returns {number|undefined} The last login date of the user.
61
+ * @public
62
+ */
22
63
  get lastLoginDate() {
23
- return this._get("last_login_date")
64
+ return this.get_value("last_login_date")
24
65
  }
66
+
67
+ /**
68
+ * Get the last login IP of the user.
69
+ * @returns {string|undefined} The last login IP of the user.
70
+ * @public
71
+ */
25
72
  get lastLoginIp() {
26
- return this._get("last_login_ip")
73
+ return this.get_value("last_login_ip")
27
74
  }
75
+
76
+ /**
77
+ * Get the login count of the user.
78
+ * @returns {number} The login count of the user.
79
+ * @public
80
+ */
28
81
  get loginCount() {
29
- return this._get("login_count")
82
+ return this.get_value("login_count", 0)
30
83
  }
84
+
85
+ /**
86
+ * Get the last connection date of the user.
87
+ * @returns {number|undefined} The last connection date of the user.
88
+ * @public
89
+ */
31
90
  get lastConnAt() {
32
- return this._get("last_conn_at")
91
+ return this.get_value("last_conn_at")
33
92
  }
93
+
94
+ /**
95
+ * Get the creation date of the user.
96
+ * @returns {number|undefined} The creation date of the user.
97
+ * @public
98
+ */
34
99
  get createdAt() {
35
- return this._get("created_at")
100
+ return this.get_value("created_at")
36
101
  }
102
+
103
+ /**
104
+ * Get the last update date of the user.
105
+ * @returns {number|undefined} The last update date of the user.
106
+ * @public
107
+ */
37
108
  get lastUpdateAt() {
38
- return this._get("last_update_at")
109
+ return this.get_value("last_update_at")
39
110
  }
40
111
  }