miolo 3.0.0-beta.21 → 3.0.0-beta.210
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/bin/build/build.mjs +53 -0
- package/bin/build/build_bin.mjs +17 -0
- package/bin/build/cli/client.mjs +52 -0
- package/bin/build/cli/css.mjs +22 -0
- package/bin/build/cli/index.mjs +40 -0
- package/bin/build/cli/ssr.mjs +21 -0
- package/bin/build/server/aliases.mjs +112 -0
- package/bin/build/server/babel.config.js +24 -0
- package/bin/build/server/banner.mjs +20 -0
- package/bin/build/server/bundle.mjs +111 -0
- package/bin/build/server/fix.mjs +15 -0
- package/bin/build/server/index.mjs +69 -0
- package/bin/build/server/options.mjs +83 -0
- package/bin/create/auth.mjs +23 -0
- package/bin/create/copy.mjs +175 -0
- package/bin/create/docker.mjs +25 -0
- package/bin/create/index.mjs +137 -0
- package/bin/create/pkgjson.mjs +72 -0
- package/bin/create/prepare-template.mjs +158 -0
- package/bin/create/validation.mjs +27 -0
- package/bin/dev/dev.mjs +32 -23
- package/bin/dev/dev_start.mjs +6 -5
- package/bin/index.mjs +94 -52
- package/bin/prod-bin/create-bin.mjs +42 -27
- package/bin/prod-bin/run.mjs +13 -9
- package/bin/{prod-run → run}/pid.mjs +4 -4
- package/bin/run/restart.mjs +13 -0
- package/bin/run/start.mjs +18 -0
- package/bin/run/stop.mjs +20 -0
- package/bin/util.mjs +35 -11
- package/package.json +59 -39
- package/src/config/.env +34 -12
- package/src/config/defaults.mjs +253 -185
- package/src/config/env.mjs +40 -22
- package/src/config/index.mjs +19 -24
- package/src/config/util.mjs +25 -10
- package/src/db-conn.mjs +34 -0
- package/src/engines/cron/emails.mjs +10 -5
- package/src/engines/cron/index.mjs +45 -51
- package/src/engines/cron/init.mjs +16 -17
- package/src/engines/cron/ipsum.mjs +65 -60
- package/src/engines/cron/syscheck.mjs +30 -30
- package/src/engines/emailer/index.mjs +1 -2
- package/src/engines/emailer/queue.mjs +14 -20
- package/src/engines/emailer/transporter.mjs +86 -74
- package/src/engines/geoip/index.mjs +23 -28
- package/src/engines/http/index.mjs +26 -15
- package/src/engines/logger/buildErrorEmailBody.mjs +72 -0
- package/src/engines/logger/index.mjs +114 -122
- package/src/engines/logger/injectStackTrace.mjs +59 -0
- package/src/engines/logger/logger_mail.mjs +47 -61
- package/src/engines/logger/reopenTransportOnHupSignal.mjs +12 -13
- package/src/engines/parser/Parser.mjs +77 -60
- package/src/engines/parser/index.mjs +1 -1
- package/src/engines/schema/diffObjs.mjs +41 -0
- package/src/engines/schema/index.mjs +4 -0
- package/src/engines/schema/input.mjs +54 -0
- package/src/engines/schema/output.mjs +66 -0
- package/src/engines/socket/index.mjs +44 -46
- package/src/index.mjs +15 -10
- package/src/middleware/auth/basic.mjs +41 -40
- package/src/middleware/auth/custom.mjs +10 -13
- package/src/middleware/auth/guest.mjs +27 -27
- package/src/middleware/auth/passport/index.mjs +374 -0
- package/src/middleware/auth/passport/session/index.mjs +43 -0
- package/src/middleware/auth/{credentials → passport}/session/store.mjs +35 -15
- package/src/middleware/auth/passport/session/store_koa_redis.mjs +3 -0
- package/src/middleware/context/cache/index.mjs +78 -33
- package/src/middleware/context/cache/options.mjs +19 -21
- package/src/middleware/context/db.mjs +45 -20
- package/src/middleware/context/index.mjs +12 -12
- package/src/middleware/extra.mjs +4 -5
- package/src/middleware/http/body.mjs +25 -25
- package/src/middleware/http/catcher.mjs +81 -8
- package/src/middleware/http/custom_blacklist.mjs +19 -16
- package/src/middleware/http/headers.mjs +37 -34
- package/src/middleware/http/ratelimit.mjs +16 -23
- package/src/middleware/http/request.mjs +60 -65
- package/src/middleware/routes/catch_js_error.mjs +30 -23
- package/src/middleware/routes/robots.mjs +4 -7
- package/src/middleware/routes/router/crud/attachCrudRoutes.mjs +108 -90
- package/src/middleware/routes/router/crud/getCrudConfig.mjs +31 -55
- package/src/middleware/routes/router/defaults.mjs +6 -19
- package/src/middleware/routes/router/index.mjs +17 -21
- package/src/middleware/routes/router/queries/attachQueriesRoutes.mjs +227 -50
- package/src/middleware/routes/router/queries/getQueriesConfig.mjs +45 -55
- package/src/middleware/routes/router/utils.mjs +41 -26
- package/src/middleware/ssr/context.mjs +5 -7
- package/src/middleware/ssr/html.mjs +66 -43
- package/src/middleware/ssr/loader.mjs +11 -14
- package/src/middleware/ssr/ssr_render.mjs +39 -22
- package/src/middleware/static/index.mjs +33 -14
- package/src/middleware/vite/devserver.mjs +38 -22
- package/src/middleware/vite/watcher.mjs +12 -14
- package/src/server-cron.mjs +13 -8
- package/src/server-dev.mjs +13 -16
- package/src/server.mjs +49 -51
- package/template/.agent/skills/miolo-app-arch/SKILL.md +218 -0
- package/template/.agent/skills/miolo-auth/SKILL.md +450 -0
- package/template/.agent/skills/miolo-cli-router/SKILL.md +394 -0
- package/template/.agent/skills/miolo-database/SKILL.md +358 -0
- package/template/.agent/skills/miolo-react-patterns/SKILL.md +426 -0
- package/template/.agent/skills/miolo-routing/SKILL.md +326 -0
- package/template/.agent/skills/miolo-schemas/SKILL.md +329 -0
- package/template/.agent/skills/miolo-session-context/SKILL.md +397 -0
- package/template/.agent/skills/miolo-ssr/SKILL.md +433 -0
- package/template/.editorconfig +18 -0
- package/template/.env +120 -0
- package/template/biome.json +63 -0
- package/template/components.json +21 -0
- package/template/db/init.sh +89 -0
- package/template/db/sql/00_drop.sql +2 -0
- package/template/db/sql/01_users.sql +31 -0
- package/template/db/sql/02_todos.sql +20 -0
- package/template/docker/Dockerfile +13 -0
- package/template/docker/docker-compose.yaml +79 -0
- package/template/gitignore +42 -0
- package/template/jsconfig.json +18 -0
- package/template/package.json +88 -0
- package/template/postcss.config.js +9 -0
- package/template/src/cli/App.jsx +25 -0
- package/template/src/cli/components/JsonTreeViewer.jsx +128 -0
- package/template/src/cli/components/shadcn-io/spinner/index.jsx +232 -0
- package/template/src/cli/components/stepper.jsx +408 -0
- package/template/src/cli/components/ui/avatar.jsx +36 -0
- package/template/src/cli/components/ui/badge.jsx +31 -0
- package/template/src/cli/components/ui/breadcrumb.jsx +97 -0
- package/template/src/cli/components/ui/card.jsx +73 -0
- package/template/src/cli/components/ui/collapsible.jsx +16 -0
- package/template/src/cli/components/ui/dropdown-menu.jsx +179 -0
- package/template/src/cli/components/ui/field.jsx +217 -0
- package/template/src/cli/components/ui/input.jsx +19 -0
- package/template/src/cli/components/ui/label.jsx +17 -0
- package/template/src/cli/components/ui/pagination.jsx +99 -0
- package/template/src/cli/components/ui/patched/alert.jsx +56 -0
- package/template/src/cli/components/ui/patched/button.jsx +45 -0
- package/template/src/cli/components/ui/patched/dialog.jsx +114 -0
- package/template/src/cli/components/ui/patched/sidebar.jsx +660 -0
- package/template/src/cli/components/ui/select.jsx +141 -0
- package/template/src/cli/components/ui/separator.jsx +21 -0
- package/template/src/cli/components/ui/sheet.jsx +115 -0
- package/template/src/cli/components/ui/skeleton.jsx +13 -0
- package/template/src/cli/components/ui/sonner.jsx +22 -0
- package/template/src/cli/components/ui/switch.jsx +25 -0
- package/template/src/cli/components/ui/table.jsx +88 -0
- package/template/src/cli/components/ui/textarea.jsx +16 -0
- package/template/src/cli/components/ui/tooltip.jsx +45 -0
- package/template/src/cli/config/store_keys.mjs +2 -0
- package/template/src/cli/context/data/DataContext.jsx +5 -0
- package/template/src/cli/context/data/DataProvider.jsx +44 -0
- package/template/src/cli/context/data/useBreads.mjs +15 -0
- package/template/src/cli/context/data/useDataContext.mjs +4 -0
- package/template/src/cli/context/session/SessionContext.mjs +4 -0
- package/template/src/cli/context/session/SessionProvider.jsx +31 -0
- package/template/src/cli/context/session/makePermissioner.mjs +34 -0
- package/template/src/cli/context/session/useSessionContext.mjs +6 -0
- package/template/src/cli/context/theme/ThemeContext.mjs +4 -0
- package/template/src/cli/context/theme/ThemeProvider.jsx +49 -0
- package/template/src/cli/context/theme/useThemeContext.mjs +6 -0
- package/template/src/cli/context/ui/UIContext.jsx +5 -0
- package/template/src/cli/context/ui/UIProvider.jsx +16 -0
- package/template/src/cli/context/ui/useUIContext.mjs +4 -0
- package/template/src/cli/context/util.mjs +17 -0
- package/template/src/cli/entry-cli.jsx +33 -0
- package/template/src/cli/hooks/useIsMobile.mjs +19 -0
- package/template/src/cli/hooks/useStoragedState.mjs +63 -0
- package/template/src/cli/index.html +29 -0
- package/template/src/cli/layout/app-sidebar.jsx +25 -0
- package/template/src/cli/layout/main-layout.jsx +63 -0
- package/template/src/cli/layout/nav-last-todos.jsx +72 -0
- package/template/src/cli/layout/nav-main.jsx +39 -0
- package/template/src/cli/layout/nav-user.jsx +105 -0
- package/template/src/cli/layout/prop-switcher.jsx +93 -0
- package/template/src/cli/lib/utils.mjs +10 -0
- package/template/src/cli/pages/Index.jsx +13 -0
- package/template/src/cli/pages/IndexOffline.jsx +13 -0
- package/template/src/cli/pages/IndexOnline.jsx +18 -0
- package/template/src/cli/pages/dash/Dashboard.jsx +29 -0
- package/template/src/cli/pages/offline/Login.jsx +43 -0
- package/template/src/cli/pages/offline/LoginForm.jsx +115 -0
- package/template/src/cli/pages/security/Security.jsx +39 -0
- package/template/src/cli/pages/security/SecurityForm.jsx +106 -0
- package/template/src/cli/pages/todos/TodoActions.jsx +99 -0
- package/template/src/cli/pages/todos/TodoAdd.jsx +43 -0
- package/template/src/cli/pages/todos/TodoList.jsx +60 -0
- package/template/src/cli/pages/todos/Todos.jsx +23 -0
- package/template/src/cli/pages/todos/context/TodosContext.jsx +5 -0
- package/template/src/cli/pages/todos/context/TodosProvider.jsx +191 -0
- package/template/src/cli/pages/todos/context/useTodosContext.mjs +4 -0
- package/template/src/ns/models/Todo.mjs +29 -0
- package/template/src/ns/models/TodoList.mjs +8 -0
- package/template/src/ns/models/User.mjs +40 -0
- package/template/src/server/bot/check_today.mjs +10 -0
- package/template/src/server/io/cache/base.mjs +21 -0
- package/template/src/server/io/db/filter.mjs +92 -0
- package/template/src/server/io/db/todos/delete.mjs +29 -0
- package/template/src/server/io/db/todos/find.mjs +13 -0
- package/template/src/server/io/db/todos/read.mjs +83 -0
- package/template/src/server/io/db/todos/toggle.mjs +37 -0
- package/template/src/server/io/db/todos/upsave.mjs +32 -0
- package/template/src/server/io/db/triggers/user.mjs +13 -0
- package/template/src/server/io/db/users/auth.mjs +132 -0
- package/template/src/server/io/db/users/pwd.mjs +38 -0
- package/template/src/server/io/db/users/save.mjs +17 -0
- package/template/src/server/miolo/auth/basic.mjs +15 -0
- package/template/src/server/miolo/auth/guest.mjs +3 -0
- package/template/src/server/miolo/auth/passport.mjs +73 -0
- package/template/src/server/miolo/cache.mjs +11 -0
- package/template/src/server/miolo/cron/foo.mjs +7 -0
- package/template/src/server/miolo/cron/index.mjs +28 -0
- package/template/src/server/miolo/cron/invalidate.mjs +21 -0
- package/template/src/server/miolo/db.mjs +36 -0
- package/template/src/server/miolo/http.mjs +14 -0
- package/template/src/server/miolo/index.mjs +43 -0
- package/template/src/server/miolo/routes/crud.mjs +16 -0
- package/template/src/server/miolo/routes/index.mjs +8 -0
- package/template/src/server/miolo/ssr/entry-server.jsx +13 -0
- package/template/src/server/miolo/ssr/loader.mjs +18 -0
- package/template/src/server/routes/index.mjs +66 -0
- package/template/src/server/routes/todos/mod.mjs +52 -0
- package/template/src/server/routes/todos/read.mjs +45 -0
- package/template/src/server/routes/todos/special.mjs +47 -0
- package/template/src/server/routes/users/user.mjs +54 -0
- package/template/src/server/server.mjs +10 -0
- package/template/src/server/utils/crypt.mjs +38 -0
- package/template/src/server/utils/io.mjs +15 -0
- package/template/src/server/utils/pwdfor.mjs +25 -0
- package/template/src/server/utils/schema.mjs +22 -0
- package/template/src/static/img/default/profile.png +0 -0
- package/template/src/static/img/favicon.ico +0 -0
- package/template/src/static/img/miolo_logo.png +0 -0
- package/template/src/static/img/miolo_name.png +0 -0
- package/template/src/static/public/manifest.json +21 -0
- package/template/src/static/public/sw.js +79 -0
- package/template/src/static/style/globals.css +156 -0
- package/template/src/static/style/json-tree.css +54 -0
- package/template/src/static/style/skeleton.css +49 -0
- package/bin/prod-build/build-client.mjs +0 -67
- package/bin/prod-build/build-server.mjs +0 -58
- package/bin/prod-run/restart.mjs +0 -9
- package/bin/prod-run/start.mjs +0 -15
- package/bin/prod-run/stop.mjs +0 -20
- package/src/engines/logger/verify.mjs +0 -22
- package/src/middleware/auth/credentials/index.mjs +0 -151
- package/src/middleware/auth/credentials/session/index.mjs +0 -24
- package/src/middleware/auth/credentials/session/store_koa_redis.mjs +0 -3
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Database initialization script for miolo-sample
|
|
4
|
+
# Usage: ./db/init.sh <database_name>
|
|
5
|
+
|
|
6
|
+
set -e # Exit on error
|
|
7
|
+
|
|
8
|
+
# Colors for output
|
|
9
|
+
RED='\033[0;31m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
NC='\033[0m' # No Color
|
|
13
|
+
|
|
14
|
+
DB_NAME=$1
|
|
15
|
+
|
|
16
|
+
if [ -z "$DB_NAME" ]; then
|
|
17
|
+
echo -e "${RED}Error: Database name is required${NC}"
|
|
18
|
+
echo "Usage: $0 <database_name>"
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
echo -e "${GREEN}[miolo-sample] Database initialization${NC}"
|
|
23
|
+
echo "Database: $DB_NAME"
|
|
24
|
+
|
|
25
|
+
# Get the directory where this script is located
|
|
26
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
27
|
+
SQL_DIR="$SCRIPT_DIR/sql"
|
|
28
|
+
|
|
29
|
+
# Check if PostgreSQL is installed
|
|
30
|
+
if ! command -v psql &> /dev/null; then
|
|
31
|
+
echo -e "${RED}Error: PostgreSQL client (psql) not found${NC}"
|
|
32
|
+
echo "Please install PostgreSQL first"
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Ask for confirmation
|
|
37
|
+
echo ""
|
|
38
|
+
read -p "Do you want to create/recreate database '$DB_NAME'? (y/N): " -n 1 -r
|
|
39
|
+
echo
|
|
40
|
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
41
|
+
echo "Database creation skipped"
|
|
42
|
+
echo "Proceeding with SQL execution only..."
|
|
43
|
+
else
|
|
44
|
+
# Try to create database with sudo
|
|
45
|
+
echo -e "${YELLOW}Creating database as postgres user (requires sudo)...${NC}"
|
|
46
|
+
|
|
47
|
+
if sudo -u postgres createdb "$DB_NAME" 2>/dev/null; then
|
|
48
|
+
echo -e "${GREEN}✓ Database '$DB_NAME' created${NC}"
|
|
49
|
+
else
|
|
50
|
+
# Database creation failed - probably already exists, continue anyway
|
|
51
|
+
echo -e "${YELLOW}⚠ Database creation failed (database may already exist)${NC}"
|
|
52
|
+
echo -e "${YELLOW}Continuing with SQL execution...${NC}"
|
|
53
|
+
fi
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
# Execute SQL files in order
|
|
57
|
+
echo ""
|
|
58
|
+
echo -e "${YELLOW}Executing SQL files...${NC}"
|
|
59
|
+
|
|
60
|
+
if [ ! -d "$SQL_DIR" ]; then
|
|
61
|
+
echo -e "${RED}Error: SQL directory not found: $SQL_DIR${NC}"
|
|
62
|
+
exit 1
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
# Find all .sql files and sort them
|
|
66
|
+
SQL_FILES=$(find "$SQL_DIR" -name "*.sql" -type f | sort)
|
|
67
|
+
|
|
68
|
+
if [ -z "$SQL_FILES" ]; then
|
|
69
|
+
echo -e "${YELLOW}No SQL files found in $SQL_DIR${NC}"
|
|
70
|
+
else
|
|
71
|
+
for sql_file in $SQL_FILES; do
|
|
72
|
+
filename=$(basename "$sql_file")
|
|
73
|
+
echo -ne " Executing $filename... "
|
|
74
|
+
|
|
75
|
+
if psql -d "$DB_NAME" -f "$sql_file" -U postgres -h localhost -q 2>&1 | grep -q "ERROR"; then
|
|
76
|
+
echo -e "${RED}✗ Failed${NC}"
|
|
77
|
+
exit 1
|
|
78
|
+
else
|
|
79
|
+
echo -e "${GREEN}✓${NC}"
|
|
80
|
+
fi
|
|
81
|
+
done
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
echo ""
|
|
85
|
+
echo -e "${GREEN}✓ Database initialization complete!${NC}"
|
|
86
|
+
echo ""
|
|
87
|
+
echo "Connection info:"
|
|
88
|
+
echo " Database: $DB_NAME"
|
|
89
|
+
echo " Connect: psql -d $DB_NAME"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
CREATE TABLE account (
|
|
2
|
+
--sqlite
|
|
3
|
+
--id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
|
+
id serial,
|
|
5
|
+
username text,
|
|
6
|
+
password text,
|
|
7
|
+
name text,
|
|
8
|
+
email text,
|
|
9
|
+
active integer,
|
|
10
|
+
|
|
11
|
+
google_id text,
|
|
12
|
+
google_picture text,
|
|
13
|
+
|
|
14
|
+
last_login_date integer,
|
|
15
|
+
last_login_ip text,
|
|
16
|
+
login_count integer DEFAULT 0,
|
|
17
|
+
|
|
18
|
+
last_conn_at integer,
|
|
19
|
+
created_at integer,
|
|
20
|
+
last_update_at integer
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
INSERT INTO account
|
|
25
|
+
(username, password, name, email)
|
|
26
|
+
VALUES
|
|
27
|
+
('miolo-sample@miolo-sample.com',
|
|
28
|
+
'3dc91ce0dd374a6daf9ccaa4f64c5e0972eb2e7c9857a6aa524174897c0f7c55a3853e696ef8b4c3156f5fd39d65a49496a929f278ae96577e948fb85546e222',
|
|
29
|
+
'miolo-sample',
|
|
30
|
+
'miolo-sample@miolo-sample.com')
|
|
31
|
+
;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
create table todo (
|
|
2
|
+
--sqlite
|
|
3
|
+
--id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
|
+
id serial,
|
|
5
|
+
description text,
|
|
6
|
+
done boolean,
|
|
7
|
+
--sqlite
|
|
8
|
+
--created_at INTEGER DEFAULT (strftime('%s', 'now')),
|
|
9
|
+
--last_update_at INTEGER DEFAULT (strftime('%s', 'now')),
|
|
10
|
+
created_At int default extract(epoch from now()),
|
|
11
|
+
last_update_At int default extract(epoch from now()),
|
|
12
|
+
created_by int,
|
|
13
|
+
last_update_by int
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
INSERT INTO todo (description, done) VALUES ('Buy milk', false);
|
|
17
|
+
INSERT INTO todo (description, done) VALUES ('Buy eggs', true);
|
|
18
|
+
INSERT INTO todo (description, done) VALUES ('Buy bread', false);
|
|
19
|
+
INSERT INTO todo (description, done) VALUES ('Buy butter', true);
|
|
20
|
+
INSERT INTO todo (description, done) VALUES ('Buy cheese', false);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
services:
|
|
2
|
+
redis:
|
|
3
|
+
# Redis info
|
|
4
|
+
# Important! Disallow external access: "127.0.0.1:6379"
|
|
5
|
+
# Customize persistence: "--save 60 1"
|
|
6
|
+
# Info: https://redis.io/docs/latest/operate/oss_and_stack/management/persistence/
|
|
7
|
+
# Ensure No-Replica mode: "--replicaof no one --maxmemory-policy noeviction"
|
|
8
|
+
# Info: https://awstip.com/fixing-intermittent-read-only-replica-issues-in-redis-with-docker-compose-2ae7c3821be8
|
|
9
|
+
image: redis:latest
|
|
10
|
+
container_name: redis
|
|
11
|
+
restart: "unless-stopped"
|
|
12
|
+
ports:
|
|
13
|
+
- "127.0.0.1:6379:6379"
|
|
14
|
+
volumes:
|
|
15
|
+
- redis_data:/data
|
|
16
|
+
- /etc/localtime:/etc/localtime:ro
|
|
17
|
+
- /etc/timezone:/etc/timezone:ro
|
|
18
|
+
networks:
|
|
19
|
+
- afialapis-app-network
|
|
20
|
+
command: redis-server --save 60 1 --replicaof no one --maxmemory-policy noeviction
|
|
21
|
+
|
|
22
|
+
postgres:
|
|
23
|
+
# Postgres info
|
|
24
|
+
# Important! Disallow external access: "127.0.0.1:5432"
|
|
25
|
+
# Important! PGDATA needs to point to a subfolder
|
|
26
|
+
# Info: https://hub.docker.com/_/postgres
|
|
27
|
+
image: postgres:13
|
|
28
|
+
container_name: postgres
|
|
29
|
+
restart: "unless-stopped"
|
|
30
|
+
#shm_size: 1gb
|
|
31
|
+
ports:
|
|
32
|
+
- "127.0.0.1:5432:5432"
|
|
33
|
+
volumes:
|
|
34
|
+
- /postgres_data:/var/lib/postgresql/data/
|
|
35
|
+
- /etc/localtime:/etc/localtime:ro
|
|
36
|
+
- /etc/timezone:/etc/timezone:ro
|
|
37
|
+
networks:
|
|
38
|
+
- afialapis-app-network
|
|
39
|
+
environment:
|
|
40
|
+
POSTGRES_PASSWORD: "postgres"
|
|
41
|
+
POSTGRES_USER: "postgres"
|
|
42
|
+
PGDATA: /var/lib/postgresql/data/pgdata
|
|
43
|
+
|
|
44
|
+
miolo-sample:
|
|
45
|
+
build:
|
|
46
|
+
context: ..
|
|
47
|
+
dockerfile: docker/Dockerfile
|
|
48
|
+
container_name: miolo-sample
|
|
49
|
+
working_dir: /miolo-sample
|
|
50
|
+
volumes:
|
|
51
|
+
- ..:/miolo-sample
|
|
52
|
+
- /var/ipsum:/var/ipsum
|
|
53
|
+
- /var/lib/GeoIP:/var/lib/GeoIP
|
|
54
|
+
- /var/log/afialapis:/var/log/afialapis
|
|
55
|
+
#- /var/run/sendmail:/var/run/sendmail
|
|
56
|
+
- /etc/localtime:/etc/localtime:ro
|
|
57
|
+
- /etc/timezone:/etc/timezone:ro
|
|
58
|
+
ports:
|
|
59
|
+
- "8001:8001"
|
|
60
|
+
depends_on:
|
|
61
|
+
- redis
|
|
62
|
+
- postgres
|
|
63
|
+
networks:
|
|
64
|
+
- afialapis-app-network
|
|
65
|
+
environment:
|
|
66
|
+
IS_DOCKER: "true"
|
|
67
|
+
REDIS_HOST: redis
|
|
68
|
+
REDIS_PORT: 6379
|
|
69
|
+
restart: "unless-stopped"
|
|
70
|
+
command:
|
|
71
|
+
/usr/bin/tail -f /dev/null # keep container alive
|
|
72
|
+
|
|
73
|
+
networks:
|
|
74
|
+
afialapis-app-network:
|
|
75
|
+
external: true
|
|
76
|
+
|
|
77
|
+
volumes:
|
|
78
|
+
redis_data:
|
|
79
|
+
postgres_data:
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
### SublimeText ###
|
|
2
|
+
#*.sublime-workspace
|
|
3
|
+
|
|
4
|
+
### OSX ###
|
|
5
|
+
#.DS_Store
|
|
6
|
+
#.AppleDouble
|
|
7
|
+
#.LSOverride
|
|
8
|
+
#Icon
|
|
9
|
+
|
|
10
|
+
# Thumbnails
|
|
11
|
+
#._*
|
|
12
|
+
|
|
13
|
+
# Files that might appear on external disk
|
|
14
|
+
#.Spotlight-V100
|
|
15
|
+
#.Trashes
|
|
16
|
+
|
|
17
|
+
### Windows ###
|
|
18
|
+
Thumbs.db
|
|
19
|
+
ehthumbs.db
|
|
20
|
+
Desktop.ini
|
|
21
|
+
$RECYCLE.BIN/
|
|
22
|
+
|
|
23
|
+
# App specific
|
|
24
|
+
|
|
25
|
+
node_modules
|
|
26
|
+
.tmp
|
|
27
|
+
npm-debug.log*
|
|
28
|
+
.pyc
|
|
29
|
+
*.ods#
|
|
30
|
+
*.xls#
|
|
31
|
+
*.xlsx#
|
|
32
|
+
*.odt#
|
|
33
|
+
*.doc#
|
|
34
|
+
*.docx#
|
|
35
|
+
*_pycache_
|
|
36
|
+
.yalc
|
|
37
|
+
.vscode/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
.editorconfig
|
|
41
|
+
.env
|
|
42
|
+
.env.*
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES6",
|
|
4
|
+
"module": "ES6",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"allowSyntheticDefaultImports": true,
|
|
7
|
+
"baseUrl": "./src",
|
|
8
|
+
"paths": {
|
|
9
|
+
"#cli/*": ["./cli/*"],
|
|
10
|
+
"#ns/*": ["./ns/*"],
|
|
11
|
+
"#server/*": ["./server/*"],
|
|
12
|
+
"#static/*": ["./static/*"]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"exclude": [
|
|
16
|
+
"node_modules"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "miolo-sample",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "miolo-sample",
|
|
5
|
+
"private": "true",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"postinstall": "patch-package",
|
|
9
|
+
"reset": "rm -fr node_modules package-lock.json npm-lock.yaml && npm i",
|
|
10
|
+
"lint": "biome check ./src --reporter=github",
|
|
11
|
+
"lint:fix": "biome check --write ./src --reporter=github",
|
|
12
|
+
"dev": "npx miolo dev",
|
|
13
|
+
"deb": "npx miolo deb",
|
|
14
|
+
"create-bin": "npx miolo create-bin",
|
|
15
|
+
"build": "rm -fr build/cli/* build/server/* &&npx miolo build && npm run create-bin",
|
|
16
|
+
"build-bin": "npx miolo build-bin --bin-entry=src/server/bot/check_today.mjs",
|
|
17
|
+
"start": "node ./build/server/run.mjs start 1>> /var/log/miolo-sample.log 2>&1",
|
|
18
|
+
"stop": "node ./build/server/run.mjs stop 1>> /var/log/miolo-sample.log 2>&1",
|
|
19
|
+
"restart": "node ./build/server/run.mjs restart 1>> /var/log/miolo-sample.log 2>&1"
|
|
20
|
+
},
|
|
21
|
+
"author": "Afialapis <info@afialapis.com>",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"imports": {
|
|
24
|
+
"#cli/*": "./src/cli/*",
|
|
25
|
+
"#ns/*": "./src/ns/*",
|
|
26
|
+
"#server/*": "./src/server/*",
|
|
27
|
+
"#static/*": "./src/static/*"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@radix-ui/react-avatar": "^1.2.0",
|
|
31
|
+
"@radix-ui/react-collapsible": "^1.1.14",
|
|
32
|
+
"@radix-ui/react-dialog": "^1.1.17",
|
|
33
|
+
"@radix-ui/react-dropdown-menu": "^2.1.18",
|
|
34
|
+
"@radix-ui/react-label": "^2.1.10",
|
|
35
|
+
"@radix-ui/react-select": "^2.3.1",
|
|
36
|
+
"@radix-ui/react-separator": "^1.1.10",
|
|
37
|
+
"@radix-ui/react-slot": "^1.3.0",
|
|
38
|
+
"@radix-ui/react-tooltip": "^1.2.10",
|
|
39
|
+
"@stepperize/react": "^7.0.0",
|
|
40
|
+
"@tailwindcss/postcss": "^4.3.1",
|
|
41
|
+
"@tanstack/react-table": "^8.21.3",
|
|
42
|
+
"class-variance-authority": "^0.7.1",
|
|
43
|
+
"clsx": "^2.1.1",
|
|
44
|
+
"farrapa": "^3.0.0-beta.10",
|
|
45
|
+
"intre": "^3.0.0-beta.4",
|
|
46
|
+
"joi": "^18.2.3",
|
|
47
|
+
"lucide-react": "^1.21.0",
|
|
48
|
+
"miolo-cli": "^3.0.0-beta.210",
|
|
49
|
+
"miolo-model": "file:../miolo-model",
|
|
50
|
+
"miolo-react": "^3.0.0-beta.210",
|
|
51
|
+
"next-themes": "^0.4.6",
|
|
52
|
+
"radix-ui": "^1.6.0",
|
|
53
|
+
"react": "^19.2.7",
|
|
54
|
+
"react-dom": "^19.2.7",
|
|
55
|
+
"react-router": "^7.16.0",
|
|
56
|
+
"recharts": "^3.8.1",
|
|
57
|
+
"sonner": "^2.0.7",
|
|
58
|
+
"tailwind": "^4.0.0",
|
|
59
|
+
"tailwind-merge": "^3.6.0",
|
|
60
|
+
"tinguir": "^0.0.7",
|
|
61
|
+
"tw-animate-css": "^1.4.0"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@biomejs/biome": "2.5.0",
|
|
65
|
+
"miolo": "^3.0.0-beta.210",
|
|
66
|
+
"sass-embedded": "^1.100.0"
|
|
67
|
+
},
|
|
68
|
+
"overrides": {
|
|
69
|
+
"@babel/runtime": "^7.28.6",
|
|
70
|
+
"body-parser": "^2.2.2",
|
|
71
|
+
"cookie": "^1.1.1",
|
|
72
|
+
"depd": "2.0.0",
|
|
73
|
+
"express": "^5.2.1",
|
|
74
|
+
"jsonwebtoken": "^9.0.3",
|
|
75
|
+
"lodash": "^4.17.23",
|
|
76
|
+
"moment": "^2.30.1",
|
|
77
|
+
"on-headers": "^1.1.0",
|
|
78
|
+
"path-to-regexp": "^8.3.0",
|
|
79
|
+
"qs": "^6.14.1",
|
|
80
|
+
"send": "^1.2.1",
|
|
81
|
+
"serve-static": "^2.2.1",
|
|
82
|
+
"tar": "^7.5.7",
|
|
83
|
+
"ws": "^8.19.0"
|
|
84
|
+
},
|
|
85
|
+
"engines": {
|
|
86
|
+
"node": ">=24"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { intre_locale_init } from "intre"
|
|
2
|
+
import DataProvider from "#cli/context/data/DataProvider.jsx"
|
|
3
|
+
import SessionProvider from "#cli/context/session/SessionProvider.jsx"
|
|
4
|
+
import ThemeProvider from "#cli/context/theme/ThemeProvider.jsx"
|
|
5
|
+
import UIProvider from "#cli/context/ui/UIProvider.jsx"
|
|
6
|
+
|
|
7
|
+
import Index from "#cli/pages/Index.jsx"
|
|
8
|
+
|
|
9
|
+
intre_locale_init("es")
|
|
10
|
+
|
|
11
|
+
const App = () => {
|
|
12
|
+
return (
|
|
13
|
+
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
|
14
|
+
<UIProvider>
|
|
15
|
+
<SessionProvider>
|
|
16
|
+
<DataProvider>
|
|
17
|
+
<Index />
|
|
18
|
+
</DataProvider>
|
|
19
|
+
</SessionProvider>
|
|
20
|
+
</UIProvider>
|
|
21
|
+
</ThemeProvider>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default App
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { useState } from "react"
|
|
2
|
+
|
|
3
|
+
const JsonTreeViewer = ({ data }) => {
|
|
4
|
+
// Función para ordenar las claves de un objeto
|
|
5
|
+
const sortObjectKeys = (obj) => {
|
|
6
|
+
if (typeof obj !== "object" || obj === null) {
|
|
7
|
+
return obj
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (Array.isArray(obj)) {
|
|
11
|
+
return obj.map((item) => sortObjectKeys(item))
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const sortedKeys = Object.keys(obj).sort()
|
|
15
|
+
const newObj = {}
|
|
16
|
+
for (const key of sortedKeys) {
|
|
17
|
+
newObj[key] = sortObjectKeys(obj[key])
|
|
18
|
+
}
|
|
19
|
+
return newObj
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const sortedData = sortObjectKeys(data)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="json-tree-viewer">
|
|
26
|
+
<JsonNode value={sortedData} expanded />
|
|
27
|
+
</div>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const JsonNode = ({ label, value, expanded }) => {
|
|
32
|
+
const [isExpanded, setIsExpanded] = useState(expanded === true)
|
|
33
|
+
|
|
34
|
+
const toggleExpand = () => {
|
|
35
|
+
setIsExpanded(!isExpanded)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const renderValue = (val) => {
|
|
39
|
+
if (typeof val === "object" && val !== null) {
|
|
40
|
+
if (Array.isArray(val)) {
|
|
41
|
+
return (
|
|
42
|
+
<span className="json-array">
|
|
43
|
+
{isExpanded ? (
|
|
44
|
+
<>
|
|
45
|
+
{/* biome-ignore lint/a11y/noStaticElementInteractions: biome-ignore */}
|
|
46
|
+
<span className="toggle-icon" onClick={toggleExpand} onKeyDown={toggleExpand}>
|
|
47
|
+
▼
|
|
48
|
+
</span>
|
|
49
|
+
[
|
|
50
|
+
<div className="indent">
|
|
51
|
+
{val.map((item, index) => (
|
|
52
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: biome-ignore
|
|
53
|
+
<JsonNode key={index} value={item} />
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
]
|
|
57
|
+
</>
|
|
58
|
+
) : (
|
|
59
|
+
<>
|
|
60
|
+
{/* biome-ignore lint/a11y/noStaticElementInteractions: biome-ignore */}
|
|
61
|
+
<span className="toggle-icon" onClick={toggleExpand} onKeyDown={toggleExpand}>
|
|
62
|
+
▶
|
|
63
|
+
</span>
|
|
64
|
+
[...]{` (${val.length} ${val.length === 1 ? "item" : "items"})`}
|
|
65
|
+
</>
|
|
66
|
+
)}
|
|
67
|
+
</span>
|
|
68
|
+
)
|
|
69
|
+
} else {
|
|
70
|
+
// Es un objeto
|
|
71
|
+
return (
|
|
72
|
+
<span className="json-object">
|
|
73
|
+
{isExpanded ? (
|
|
74
|
+
<>
|
|
75
|
+
{/* biome-ignore lint/a11y/noStaticElementInteractions: biome-ignore */}
|
|
76
|
+
<span className="toggle-icon" onClick={toggleExpand} onKeyDown={toggleExpand}>
|
|
77
|
+
▼
|
|
78
|
+
</span>
|
|
79
|
+
{"{"}
|
|
80
|
+
<div className="indent">
|
|
81
|
+
{Object.entries(val).map(([key, itemValue]) => (
|
|
82
|
+
<JsonNode key={key} label={key} value={itemValue} />
|
|
83
|
+
))}
|
|
84
|
+
</div>
|
|
85
|
+
{"}"}
|
|
86
|
+
</>
|
|
87
|
+
) : (
|
|
88
|
+
<>
|
|
89
|
+
{/* biome-ignore lint/a11y/noStaticElementInteractions: biome-ignore */}
|
|
90
|
+
<span className="toggle-icon" onClick={toggleExpand} onKeyDown={toggleExpand}>
|
|
91
|
+
▶
|
|
92
|
+
</span>
|
|
93
|
+
{"{...}"}
|
|
94
|
+
{` (${Object.keys(val).length} ${Object.keys(val).length === 1 ? "key" : "keys"})`}
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
</span>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
// Es un tipo de dato primitivo
|
|
102
|
+
let displayValue = String(val)
|
|
103
|
+
let valueClass = "json-value-string"
|
|
104
|
+
|
|
105
|
+
if (typeof val === "number") {
|
|
106
|
+
valueClass = "json-value-number"
|
|
107
|
+
} else if (typeof val === "boolean") {
|
|
108
|
+
valueClass = "json-value-boolean"
|
|
109
|
+
} else if (val === null) {
|
|
110
|
+
displayValue = "null"
|
|
111
|
+
valueClass = "json-value-null"
|
|
112
|
+
} else if (typeof val === "string") {
|
|
113
|
+
displayValue = `"${val}"`
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return <span className={valueClass}>{displayValue}</span>
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<div className="json-node">
|
|
122
|
+
{label && <span className="json-key">{label}: </span>}
|
|
123
|
+
{renderValue(value)}
|
|
124
|
+
</div>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export default JsonTreeViewer
|